@wjarka/cezarion 0.18.0-dev.7899 → 0.18.0-dev.7909
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/web/dist/assets/accounts-section-C7qacMAX.js +1 -0
- package/web/dist/assets/activity-motion-CkAbct6K.js +2 -0
- package/web/dist/assets/activity-route-DkSc-BB_.js +1 -0
- package/web/dist/assets/agent-config-section-DBqtxqrI.js +4 -0
- package/web/dist/assets/agent-defaults-section-AHmatJKy.js +1 -0
- package/web/dist/assets/agents-settings-path-7X6_cvUg.js +1 -0
- package/web/dist/assets/appearance-Uyrw7pjm.js +1 -0
- package/web/dist/assets/archive-on-merge-field-w_cfxV6m.js +1 -0
- package/web/dist/assets/attention-BMiaqJnx.js +1 -0
- package/web/dist/assets/automation-format-1lHzRTbq.js +1 -0
- package/web/dist/assets/automations-route-BBzRefYM.js +1 -0
- package/web/dist/assets/badge-D9JrXe0o.js +1 -0
- package/web/dist/assets/bot-TkDIw4y-.js +1 -0
- package/web/dist/assets/bundle-mjs-rHxsej31.js +1 -0
- package/web/dist/assets/button-BQ2y4XRB.js +1 -0
- package/web/dist/assets/centered-state-V15AR_qo.js +1 -0
- package/web/dist/assets/chevron-down-CHGyCDBH.js +1 -0
- package/web/dist/assets/chevron-right-BENZ-1ZN.js +1 -0
- package/web/dist/assets/{chunk-BO2N2NFS-y7WHTKOf.js → chunk-BO2N2NFS-DQrpGzb-.js} +4 -4
- package/web/dist/assets/chunk-KS7C4IRE-Cg8l-LDN.js +3 -0
- package/web/dist/assets/collapsible-BEV4FO-1.js +1 -0
- package/web/dist/assets/command-CDt1BsZy.js +1 -0
- package/web/dist/assets/commit-diff-panel-Ba-6F5So.js +1 -0
- package/web/dist/assets/dialog-BVF6dIeS.js +1 -0
- package/web/dist/assets/diff-D3RVmX07.js +3 -0
- package/web/dist/assets/diff-controls-BSWICnsb.js +1 -0
- package/web/dist/assets/{diff-view-BG91xPpY.js → diff-view-CYIMlq04.js} +4 -4
- package/web/dist/assets/dist-BAoXdNsT.js +1 -0
- package/web/dist/assets/dist-BW234Kg5.js +1 -0
- package/web/dist/assets/dist-C28wFbz0.js +1 -0
- package/web/dist/assets/dist-C5mlVBmd.js +1 -0
- package/web/dist/assets/dist-DXO3xwbC.js +1 -0
- package/web/dist/assets/dist-Da4ckcJG.js +1 -0
- package/web/dist/assets/dropdown-menu-4e2iKSMT.js +1 -0
- package/web/dist/assets/es2015-CQth82uv.js +41 -0
- package/web/dist/assets/external-link-BE6y205O.js +1 -0
- package/web/dist/assets/file-preview-jj3RWAaW.js +2 -0
- package/web/dist/assets/folder-browser-CH0gdxd-.js +1 -0
- package/web/dist/assets/folder-o-AvL3y3.js +1 -0
- package/web/dist/assets/git-toolbar-BOaq9GcR.js +1 -0
- package/web/dist/assets/github-wkggyCqa.js +1 -0
- package/web/dist/assets/global-activity-route-BTrelHAD.js +1 -0
- package/web/dist/assets/{highlighted-body-OFNGDK62-D62LjTH2.js → highlighted-body-OFNGDK62-Cx8MiNVZ.js} +1 -1
- package/web/dist/assets/highlighter-DvLzHjjY.js +3 -0
- package/web/dist/assets/{image-preview-2AnVvt0e.js → image-preview-CNBuRrK5.js} +1 -1
- package/web/dist/assets/index-CRfojAQ1.js +21 -0
- package/web/dist/assets/index-F-X4qZSv.css +1 -0
- package/web/dist/assets/label-D6DhdNb7.js +1 -0
- package/web/dist/assets/markdown-i80v6qNq.js +4 -0
- package/web/dist/assets/mermaid-GHXKKRXX-lTc_AjAC.js +1 -0
- package/web/dist/assets/moon-CRE9nU5R.js +1 -0
- package/web/dist/assets/nav-row-styles-DqKjMToI.js +1 -0
- package/web/dist/assets/notifications-section-GGsdkedq.js +1 -0
- package/web/dist/assets/open-in-menu-DgScIVvr.js +1 -0
- package/web/dist/assets/own-lookup-DS54wXvD.js +1 -0
- package/web/dist/assets/popover-BPgUYFyu.js +1 -0
- package/web/dist/assets/preload-helper-Czpn1I53.js +1 -0
- package/web/dist/assets/preview-pane-connected-B3mexb-I.js +3 -0
- package/web/dist/assets/project-location-4UN0Eqf-.js +1 -0
- package/web/dist/assets/project-order-AcHI4Dcl.js +1 -0
- package/web/dist/assets/project-rail-sortable-BmVI4_-T.js +1 -0
- package/web/dist/assets/project-router-UyyzK1j2.js +1 -0
- package/web/dist/assets/project-scope-context-BRvkKGX1.js +4 -0
- package/web/dist/assets/projects-section-DjeKfkRK.js +1 -0
- package/web/dist/assets/prompt-templates-section-CPH3RU9O.js +1 -0
- package/web/dist/assets/queries-CQWAcH8p.js +1 -0
- package/web/dist/assets/reference-chip-DGOmeh0l.js +1 -0
- package/web/dist/assets/remote-settings-notice-BFDdo8X5.js +1 -0
- package/web/dist/assets/repo-git-PaJ9uJ6o.js +1 -0
- package/web/dist/assets/report-reader-DDDg-Iyz.js +1 -0
- package/web/dist/assets/reports-DRSGsu5b.js +1 -0
- package/web/dist/assets/resources-section-Dwx13rfP.js +1 -0
- package/web/dist/assets/run-header-q5egOxrK.js +2 -0
- package/web/dist/assets/{runners-CKrq5tR_.js → runners-BFhbiSKy.js} +1 -1
- package/web/dist/assets/settings-agent-picker-YO8UtetZ.js +1 -0
- package/web/dist/assets/settings-field-Bl6WuvGX.js +1 -0
- package/web/dist/assets/settings-shell-De1IxHYf.js +1 -0
- package/web/dist/assets/settings-shell-xK8txSJo.css +1 -0
- package/web/dist/assets/sidebar-section-CYKz48EO.js +1 -0
- package/web/dist/assets/skills-hTBIyeAr.js +1 -0
- package/web/dist/assets/smartphone-Lr8Ug2z_.js +1 -0
- package/web/dist/assets/sortable.esm-CAVTYaA3.js +5 -0
- package/web/dist/assets/square-terminal-B6RYYieR.js +1 -0
- package/web/dist/assets/status-dot-DtAOFiIi.js +1 -0
- package/web/dist/assets/switch-Bv2Zf1uU.js +1 -0
- package/web/dist/assets/tab-link-BmEGnV4R.js +1 -0
- package/web/dist/assets/task-changes-CvbqO0ug.js +1 -0
- package/web/dist/assets/task-commits-kVuYqkqB.js +1 -0
- package/web/dist/assets/task-files-DOFkMbFg.js +1 -0
- package/web/dist/assets/task-github-item-13sbVXYb.js +1 -0
- package/web/dist/assets/task-groups-Dc7pXgaS.js +1 -0
- package/web/dist/assets/task-thread-B0d0xyLV.js +9 -0
- package/web/dist/assets/tasks-table-lb5Dy-8O.js +1 -0
- package/web/dist/assets/textarea-vJt9undk.js +1 -0
- package/web/dist/assets/thread-state-BwzJmXzv.js +4 -0
- package/web/dist/assets/toaster-Bo5vCbz-.js +1 -0
- package/web/dist/assets/use-hand-to-agent-state-wRTXiZqE.js +1 -0
- package/web/dist/assets/{useInfiniteQuery-BdIIhzMI.js → useInfiniteQuery-rgb-nitU.js} +1 -1
- package/web/dist/assets/useQuery-SVV6EtG7.js +1 -0
- package/web/dist/assets/utils-DSMR_WLb.js +1 -0
- package/web/dist/assets/workflows-35bEvVkH.js +7 -0
- package/web/dist/assets/workspace-tools-Bw4MyHOW.js +1 -0
- package/web/dist/assets/worktrees-section-CLwPLrl2.js +4 -0
- package/web/dist/assets/{ws-DiWUfn_t.js → ws-D3-jE1IB.js} +1 -1
- package/web/dist/assets/zoomable-image-CIQl1Wpe.js +1 -0
- package/web/dist/index.html +49 -25
- package/web/dist/assets/activity-motion-DKY_Cd-w.js +0 -2
- package/web/dist/assets/activity-route-CFOKEc61.js +0 -1
- package/web/dist/assets/attention-B0IBc2_D.js +0 -1
- package/web/dist/assets/bundle-mjs-BT31bpU6.js +0 -1
- package/web/dist/assets/button-C1fD-ZFr.js +0 -3
- package/web/dist/assets/centered-state-CiiA8Vgw.js +0 -1
- package/web/dist/assets/commit-diff-panel-BiNUdbd8.js +0 -1
- package/web/dist/assets/dialog-B3EUmMBQ.js +0 -1
- package/web/dist/assets/diff-WtmvA0fu.js +0 -3
- package/web/dist/assets/diff-controls-CA6lS7Yp.js +0 -1
- package/web/dist/assets/dist-Du8mGhoH.js +0 -1
- package/web/dist/assets/dropdown-menu-Dso6iTId.js +0 -1
- package/web/dist/assets/es2015-Ch36azR0.js +0 -41
- package/web/dist/assets/file-preview-YCD-8e6S.js +0 -2
- package/web/dist/assets/git-toolbar-B5YAUWQ7.js +0 -1
- package/web/dist/assets/github-DHeSsbSc.js +0 -1
- package/web/dist/assets/global-activity-route-CMq49K4H.js +0 -1
- package/web/dist/assets/index-C3pMUosD.js +0 -14
- package/web/dist/assets/index-DXvh46tl.css +0 -1
- package/web/dist/assets/markdown-OTuqNLUj.js +0 -4
- package/web/dist/assets/mermaid-GHXKKRXX-C7OP146z.js +0 -1
- package/web/dist/assets/nav-row-styles-CFjnD-9J.js +0 -1
- package/web/dist/assets/picker-pill-BhCKGHAn.js +0 -15
- package/web/dist/assets/preview-pane-connected-BvOk8924.js +0 -3
- package/web/dist/assets/project-router-CcyPWtFH.js +0 -1
- package/web/dist/assets/project-scope-context-CX36ze1Q.js +0 -4
- package/web/dist/assets/prompt-template-menu-YN8kTo5-.js +0 -1
- package/web/dist/assets/queries-Cb76PEoL.js +0 -1
- package/web/dist/assets/reference-chip-BuUCKkhB.js +0 -1
- package/web/dist/assets/repo-git-B2M2bD92.js +0 -1
- package/web/dist/assets/report-reader-DeyzG6gC.js +0 -1
- package/web/dist/assets/reports-Ca8vCNah.js +0 -1
- package/web/dist/assets/run-header-DP7P0saA.js +0 -2
- package/web/dist/assets/skills-5ODbLwjd.js +0 -1
- package/web/dist/assets/sortable.esm-zp_qkYGV.js +0 -5
- package/web/dist/assets/tab-link-Dn7KFNYr.js +0 -1
- package/web/dist/assets/task-changes-BkeLycTI.js +0 -1
- package/web/dist/assets/task-commits-Db8B7L6o.js +0 -1
- package/web/dist/assets/task-files-CFVAB4Bl.js +0 -1
- package/web/dist/assets/task-github-item-z295iYNd.js +0 -1
- package/web/dist/assets/task-thread-UXl-CsYi.js +0 -9
- package/web/dist/assets/thread-state-BsbjdGGk.js +0 -4
- package/web/dist/assets/toaster-Cxgzn9ip.js +0 -1
- package/web/dist/assets/use-desktop-BqVEJ3dr.js +0 -1
- package/web/dist/assets/use-hand-to-agent-state-DXfR9R5L.js +0 -1
- package/web/dist/assets/useQuery-Dg1rzYtR.js +0 -1
- package/web/dist/assets/workflows-BCuRK6_a.js +0 -7
- package/web/dist/assets/zoomable-image-DrDnCL4V.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{l as r,t as i,u as a}from"./button-C1fD-ZFr.js";import{C as o,Dr as s,Er as c,Ln as l,Nt as u,et as d,qt as f,r as p,ti as m,tt as h}from"./project-scope-context-CX36ze1Q.js";import{A as g,E as _,Gt as v,J as y,Pt as b,Tt as x,Yt as S,Z as C,kt as w,p as T,t as E}from"./queries-Cb76PEoL.js";import{t as D}from"./useQuery-Dg1rzYtR.js";import{a as O,o as k,r as A,tt as j}from"./use-desktop-BqVEJ3dr.js";import{n as M}from"./toaster-Cxgzn9ip.js";import{s as N}from"./runners-CKrq5tR_.js";import{Y as ee,c as P,ct as F,ft as I,g as L,it as R,k as te,l as z,m as ne,ot as re,r as ie,tt as ae,u as oe,ut as se,y as ce}from"./design-icons-CzEoMH9c.js";import{t as le}from"./eye-B8okNWXU.js";import{a as ue,i as B}from"./format-BNCkW110.js";import{t as de}from"./message-square-B-MD-8rD.js";import{t as fe}from"./play-CmVAj_fu.js";import{a as pe,i as me,o as he,r as ge,s as _e,t as ve}from"./dialog-B3EUmMBQ.js";import{d as V,t as ye,y as H}from"./prompt-template-menu-YN8kTo5-.js";import{t as U}from"./project-router-CcyPWtFH.js";import{F as W,I as be,L as G,M as xe,P as Se,R as Ce,S as we,_ as Te,a as Ee,b as De,c as Oe,d as ke,f as Ae,g as je,n as Me,r as Ne,s as Pe,t as K,u as Fe,v as Ie,w as Le,x as Re}from"./picker-pill-BhCKGHAn.js";import{d as ze,f as q,i as Be,o as Ve,p as He,s as Ue,t as We,u as Ge}from"./skills-pM_PouEs.js";import{B as Ke,F as qe,L as Je,P as Ye,U as Xe,_n as Ze,z as Qe}from"./index-C3pMUosD.js";import{t as $e}from"./markdown-OTuqNLUj.js";import{t as et}from"./diff-WtmvA0fu.js";import{t as tt}from"./tab-link-Dn7KFNYr.js";var J=e(t(),1),Y=n(),nt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function X({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Y.jsx)(P,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:r(t,`text-success`)}):e===`failing`?(0,Y.jsx)(L,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:r(t,`text-danger`)}):e===`pending`?(0,Y.jsx)(ue,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:r(t,`animate-spin text-warning`)}):(0,Y.jsx)(ne,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:r(t,`text-soft-foreground`)})}function rt(e){return e?.available?e.mergeState:null}function it(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function at(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function ot(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function st(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function ct(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function lt(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function ut(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function dt(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function Z(e){return e?nt[e]:`Merge`}function ft(e){return e===`conflicting`?`true`:void 0}function pt({check:e}){return(0,Y.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(X,{state:e.state}),(0,Y.jsxs)(`span`,{children:[e.name,` · `,e.state,lt(e.required)]})]}),e.url&&a(e.url)?(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function mt({reason:e}){return(0,Y.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function ht({state:e,selectedMethod:t,overrideRules:n,mergeEnabled:a,refreshPending:o,onRefresh:s,onRunAgent:c,onConfirm:l,onMethodChange:u,onOverrideChange:d}){let f=at(e),p=ot(e.reviewDecision),m=st(e.mergeable);return(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,Y.jsx)(P,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Y.jsx)(re,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold`,children:f}),(0,Y.jsxs)(i,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:s,children:[(0,Y.jsx)(ee,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,o&&`animate-spin`)}),`Refresh`]})]}),(0,Y.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,Y.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Y.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(X,{state:p}),(0,Y.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Y.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(X,{state:m}),(0,Y.jsxs)(`span`,{children:[`Conflicts: `,ct(e.mergeable)]})]}),e.checks.length===0?(0,Y.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,Y.jsx)(pt,{check:e},e.name)),e.blockers.map(e=>(0,Y.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&c?(0,Y.jsx)(i,{className:`mt-4`,onClick:c,children:`Run agent on this PR`}):null,e.canOverride?(0,Y.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>d(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Y.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,Y.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,Y.jsx)(`select`,{"aria-label":`Merge method`,value:t??``,onChange:e=>u(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:e.methods.map(e=>(0,Y.jsx)(`option`,{value:e,children:nt[e]},e))}),(0,Y.jsx)(i,{disabled:!a,onClick:l,children:Z(t)})]}):null]})]})}function gt({number:e,state:t,selectedMethod:n,confirming:r,overrideRules:a,mergePending:o,mergeError:s,onOpenChange:c,onMerge:l}){return(0,Y.jsx)(ve,{open:r,onOpenChange:c,children:(0,Y.jsxs)(ge,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Y.jsxs)(he,{children:[(0,Y.jsxs)(_e,{children:[Z(n),` pull request #`,e,`?`]}),(0,Y.jsx)(me,{asChild:!0,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),a&&t.canOverride?(0,Y.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),s?(0,Y.jsx)(`p`,{className:`text-sm text-danger`,children:s.message}):null,(0,Y.jsxs)(pe,{children:[(0,Y.jsx)(i,{variant:`outline`,disabled:o,onClick:()=>c(!1),children:`Cancel`}),(0,Y.jsx)(i,{disabled:o,onClick:l,children:o?`Merging…`:Z(n)})]})]})})}function _t({number:e,onRunAgent:t}){let n=m(),r=C(),i=D({queryKey:E.githubMergeState(e),queryFn:({signal:t})=>h(e,{},{signal:t}),retry:!1}),a=rt(i.data),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),[d,f]=(0,J.useState)(!1),p=S({mutationFn:t=>h(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>M(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=it(o,a),_=()=>({mergeState:E.githubMergeState(e),list:E.githubPages(50),comments:E.githubComments(`pr`,e),item:E.githubItem(`pr`,e),refStatus:r===void 0?void 0:E.githubRefStatusOf(r)}),v=S({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return u(e,{method:g,expectedHeadSha:a.headSha,...d&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{l(!1),M(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{M(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,Y.jsx)(H,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,Y.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":ft(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsx)(ht,{state:a,selectedMethod:g,overrideRules:d,mergeEnabled:dt(g,a,d),refreshPending:p.isPending,onRefresh:()=>p.mutate(E.githubMergeState(e)),onRunAgent:t,onConfirm:()=>l(!0),onMethodChange:s,onOverrideChange:f}),(0,Y.jsx)(gt,{number:e,state:a,selectedMethod:g,confirming:c,overrideRules:d,mergePending:v.isPending,mergeError:v.error,onOpenChange:l,onMerge:()=>v.mutate(_())})]}):(0,Y.jsx)(mt,{reason:ut(i.data)})}function vt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function yt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function bt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function xt(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function St({label:e,color:t,plain:n=!1}){return(0,Y.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:xt(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function Ct(e){return e===`pr`?`pull request`:`issue`}function wt(e,t,n){return e===`pr`&&!!(t||n)}function Tt({backLink:e}){return e?(0,Y.jsxs)(U,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Y.jsx)(ie,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}function Et({item:e,kindWord:t,commentCount:n,hasDiffStat:r,additions:i,deletions:o}){return(0,Y.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Y.jsx)(`span`,{children:t}),`·`,(0,Y.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Y.jsxs)(`span`,{children:[B(e.createdAt),` ago`]}),n?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsx)(Xt,{count:n})]}):null,r?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,i??0]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,o??0]})]})]}):null,`·`,a(e.url)?(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Y.jsx)(j,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Y.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function Dt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,Y.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Y.jsx)(tt,{to:V(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,Y.jsx)(tt,{to:V(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,Y.jsx)(U,{to:V(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function Ot({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Y.jsx)(St,{label:e,color:t[e]},e)),n?(0,Y.jsx)(Zt,{checks:n,url:e.url}):null]}):null}function kt({item:e,colors:t,body:n}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:n?(0,Y.jsx)($e,{children:n}):(0,Y.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Y.jsx)(Mt,{item:e,colors:t})]})}function At({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,children:c}){let l=a?.changes??!1,u=Ct(e.kind),d=_(e.kind,e.number,!l).data?.detail,f=d?.body??e.body,p=d?.additions??e.additions,m=d?.deletions??e.deletions,h=wt(e.kind,p,m),g=r??e.comments;return(0,Y.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Y.jsx)(Tt,{backLink:i}),(0,Y.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,Y.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,Y.jsx)(Et,{item:e,kindWord:u,commentCount:g,hasDiffStat:h,additions:p,deletions:m}),e.kind===`pr`?null:(0,Y.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),s,(0,Y.jsx)(Dt,{item:e,subNav:a,changes:l}),(0,Y.jsx)(Ot,{item:e,colors:t,checks:n}),l&&e.kind===`pr`?(0,Y.jsx)(jt,{item:e}):(0,Y.jsx)(kt,{item:e,colors:t,body:f})]}),e.kind===`pr`?(0,Y.jsx)(_t,{number:e.number,onRunAgent:o}):null,c]})}function jt({item:e}){let t=m(),n=g(e.number),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(null),u=n.data,f=u?.available?u.files.filter(e=>e.path.toLowerCase().includes(o.toLowerCase())):[],p=f.findIndex(e=>e.path===c);(0,J.useEffect)(()=>{f.length>0&&!f.some(e=>e.path===c)&&l(f[0].path)},[u?.available?u.headSha:``,o]);let h=async()=>{let n=u?.available?u.headSha:null,r=E.githubPrChanges(e.number),i=await d(e.number,{refresh:!0});t.setQueryData(r,i),i.available&&n&&n!==i.headSha&&(l(i.files[0]?.path??null),M(`The reviewed revision changed.`))};if(n.isPending)return(0,Y.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!u)return(0,Y.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!u.available)return(0,Y.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:u.reason});let _=f.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),v=a(e.url)?`${e.url}/files`:null,y=f.find(e=>e.path===c);return(0,Y.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Y.jsxs)(`strong`,{children:[u.files.length,` changed files`]}),(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,u.additions]}),(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,u.deletions]}),(0,Y.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:u.headSha,children:[`head `,u.headSha.slice(0,8)]}),(0,Y.jsx)(i,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void h(),children:`Refresh`})]}),u.truncated?(0,Y.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[u.reason??`This response is incomplete.`,` `,v?(0,Y.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Y.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Y.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Y.jsx)(`input`,{"aria-label":`Filter changed files`,value:o,onChange:e=>s(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,Y.jsx)(`select`,{"aria-label":`Select changed file`,value:c??``,onChange:e=>l(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:f.map(e=>(0,Y.jsx)(`option`,{children:e.path},e.path))}),(0,Y.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:f.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>l(e.path),className:r(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,c===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Y.jsx)(i,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:p<=0,onClick:()=>l(f[p-1]?.path??null),children:(0,Y.jsx)(Ze,{})}),(0,Y.jsx)(i,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:p<0||p>=f.length-1,onClick:()=>l(f[p+1]?.path??null),children:(0,Y.jsx)(oe,{size:16})})]}),f.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(et,{files:_.filter(e=>e.path===c),wrap:!0,className:`min-w-0`}),y&&!y.patch?(0,Y.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,y.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Mt({item:e,colors:t}){let n=_(e.kind,e.number),r=n.data,i=(0,J.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(Nt(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,Y.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Y.jsx)(H,{className:`mb-3 h-3 w-24`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(H,{className:`h-14 w-full`}),(0,Y.jsx)(H,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Y.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Y.jsx)(j,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Y.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Y.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Y.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Pt(i).map(e=>e.group===`commits`?(0,Y.jsx)(Ft,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Y.jsx)(Kt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Y.jsx)(Lt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Y.jsx)(j,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Nt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Pt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function Ft({commits:e,colors:t}){let[n,r]=(0,J.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:It.committed}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Y.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Y.jsx)(Lt,{event:e,colors:t},e.id))]}):(0,Y.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:It.committed}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Y.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:B(e[e.length-1].createdAt)})]})})}var It={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Lt({event:e,colors:t}){return(0,Y.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:r(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:It[e.kind]}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Y.jsx)(Ut,{event:e,colors:t}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:B(e.createdAt)}),e.url?(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(j,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Rt({event:e}){return(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Y.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Y.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Y.jsx)(Wt,{checks:e.checks})]})}function zt({event:e,colors:t}){return(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Y.jsx)(`span`,{"data-slot":`gh-event-label`,style:xt(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,Y.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Bt({event:e}){return(0,Y.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Vt({event:e}){return(0,Y.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Ht={committed:e=>(0,Y.jsx)(Rt,{event:e}),labeled:(e,t)=>(0,Y.jsx)(zt,{event:e,colors:t}),unlabeled:(e,t)=>(0,Y.jsx)(zt,{event:e,colors:t}),assigned:e=>(0,Y.jsx)(Bt,{event:e}),unassigned:e=>(0,Y.jsx)(Bt,{event:e}),merged:()=>(0,Y.jsx)(`span`,{children:`merged this`}),closed:()=>(0,Y.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,Y.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,Y.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,Y.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,Y.jsx)(Vt,{event:e})};function Ut({event:e,colors:t}){return Ht[e.kind]?.(e,t)??null}function Wt({checks:e}){return e?(0,Y.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:r(`shrink-0`,Yt[e]),children:Jt[e]}):null}var Gt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Kt({comment:e}){let t=e.reviewState?Gt[e.reviewState]:null;return(0,Y.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Y.jsx)(qt,{url:e.avatarUrl,login:e.author}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Y.jsx)(`span`,{children:B(e.createdAt)}),t?(0,Y.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:r(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(j,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Y.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Y.jsx)($e,{children:e.body}):(0,Y.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function qt({url:e,login:t}){let[n,r]=(0,J.useState)(!1);return e&&!n?(0,Y.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,Y.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Jt={passing:`✓`,failing:`✗`,pending:`○`},Yt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Xt({count:e}){return e?(0,Y.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,Y.jsx)(de,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Zt({checks:e,url:t}){let n=r(`text-[11px] font-medium`,Yt[e],t&&`hover:underline`),i=`${Jt[e]} checks ${e}`;return t?(0,Y.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:i}):(0,Y.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:i})}function Qt({checks:e}){return(0,Y.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:r(`shrink-0 font-sans text-[11px] font-semibold`,Yt[e]),children:Jt[e]})}function Q(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function $t(e,t=[]){let n=Q(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=en(t)),n}function en(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function tn(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function nn(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function rn(e,t,n){let r=(n??``).trim();if(!r)return $t(e,t);let i=Q(e),a=r.startsWith(i)?i+tn(r.slice(i.length),e):tn(r,e),o=nn(a,e)?a:`${i}\n\n${a}`;return t.length?o+en(t):o}function an(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function on(e,t,n,r,i={}){return t?{...i,workflow:t,task:rn(e,n.map(e=>e.id),r)}:n.length?{...i,steps:an(n.map(e=>e.id)).map((e,t)=>({...e,...n[t]?.path===void 0?{}:{skillPath:n[t].path}})),task:rn(e,[],r)}:{...i,workflow:`quick-task`,task:rn(e,[],r)}}function sn(e){let t=y(),n=T(),r=N(),i=s(t.data,r.data),a=c(t.data,r.data),o=n.data?.defaultRunner,l=we(e.runner,i,o??i[0]??`claude`),u=n.data?.modelsLocked===!0,{accounts:d,repoAccount:f}=qe(),p=d.some(t=>t.provider===l&&t.id===e.account)?e.account:null,m=v(l,!0,p??f?.[l]),h=Re(u?null:e.model,l,r.data,n.data?.defaultModels,m.data),g=Te(h,m.data);return{runner:l,runnerExplicit:e.runner!==null,model:h,effort:u?``:De(e.effort,g),effortOptions:g,runners:i,uninstalled:a,defaultRunner:o,canRun:t.isSuccess&&i.length>0,modelsLocked:u,providerPending:t.isPending,providerError:t.isError,accounts:d,account:p,repoAccount:f}}function cn(e){return{runner:Le(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function ln(e){return{...cn(e),...e.account?{agentProfile:e.account}:{}}}function un(e,t){let{runners:n,uninstalled:r}=e;return n.length>1||r.length>0||n.some(e=>Ye(t,e))}function dn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,J.useRef)(null),o=(0,J.useRef)(null),[s,c]=(0,J.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,J.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,J.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let l=sn(e),{runner:u,model:d,effort:f,effortOptions:p,runners:m,canRun:h,modelsLocked:g}=l,_=T(),y=N(),b=v(u,!0,l.account??l.repoAccount?.[u]),x=Ie(u,y.data,b.data,[e.model,_.data?.defaultModels?.[u]]),S=n||!h,C=r?l.accounts:[],w=un(l,C)?(0,Y.jsx)(Ne,{icon:(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:m,uninstalled:l.uninstalled,value:u,accounts:C,account:r?l.account:null,repoAccount:r?l.repoAccount:void 0,disabled:S,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===u?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,E=(0,Y.jsx)(K,{icon:(0,Y.jsx)(ce,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:d===``?`Default`:x.find(e=>e.id===d).label,value:d,disabled:S,readOnly:g===!0,disabledHint:g?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Te(n,b.data);t({...e,model:n,effort:e.effort===null?null:De(e.effort,r)})},options:x.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:je(u,y.data,b)},`model`),D=(0,Y.jsx)(K,{icon:(0,Y.jsx)(te,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:p.find(e=>e.value===f)?.label??`auto`,value:f,disabled:S,readOnly:g===!0,disabledHint:g?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:p.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,Y.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,Y.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,Y.jsx)(Me,{children:s?[w,D,E]:[w,E,D]})})}):(0,Y.jsxs)(Me,{children:[w,E,D]})}var fn={workflow:null,skills:[]},pn=`cez-followup-selection`;function mn(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.flatMap(e=>typeof e==`string`?[{id:e}]:!e||typeof e!=`object`||typeof e.id!=`string`?[]:[{id:e.id,...typeof e.path==`string`?{path:e.path}:{}}]):[]}}function hn(){try{let e=localStorage.getItem(pn);return e?mn(JSON.parse(e)):{...fn}}catch{return{...fn}}}function gn(e){try{localStorage.setItem(pn,JSON.stringify(e))}catch{}}var $=`cez-followup-prompt:`;function _n(e){try{return localStorage.getItem($+e)??``}catch{return``}}function vn(e,t){try{t===``?localStorage.removeItem($+e):localStorage.setItem($+e,t)}catch{}}function yn({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:s,selectedSkills:c,onSkillsChange:l,engine:u,onEngineChange:d,queuedRunId:p,onQueued:h}){let g=m(),_=x(),v=e.kind===`pr`?`PR`:`issue`,y=sn(u),C=b(y.runner,y.account),w=c.filter(e=>C.unchecked||e.path===void 0||n.some(t=>t.id===e.id&&(e.path===void 0||t.path===e.path))),T=w.length!==c.length,[D]=(0,J.useState)(()=>Q(e)),[O,k]=(0,J.useState)(()=>_n(e.url)||D),A=(0,J.useRef)(null),j=(0,J.useRef)(null);(0,J.useEffect)(()=>{vn(e.url,O===D?``:O)},[e.url,O,D]);let N=(0,J.useMemo)(()=>Fe(_.data?.promptTemplates),[_.data?.promptTemplates]),ee=e=>{let t=A.current,n=Ae({prompt:O,base:D,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:j.current}),r=Oe(O,n,e);k(r.text),j.current=r.caret,requestAnimationFrame(()=>{A.current?.focus(),A.current?.setSelectionRange(r.caret,r.caret)})},F=Pe(N,w.map(e=>e.id)),I=(0,J.useRef)(O);I.current=O;let L=(0,J.useRef)(``);(0,J.useEffect)(()=>{let e=ke(I.current,L.current,F,D);L.current=e.applied,e.text!==I.current&&k(e.text)},[F,D]);let R=S({mutationFn:async()=>!y.canRun||T?null:o(on(e,r,w,O,ln(y))),onSuccess:t=>{if(t===null)return;let n=t;n&&h(e.url,n.id),M(`Added to the queue — ${v} #${e.number}`),w.length>0&&_.data!==void 0&&f({skillUsage:w.reduce((e,t)=>We(e,t.id),_.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:E.uiState})).catch(()=>{}),vn(e.url,``),k(D),L.current=``,g.invalidateQueries({queryKey:E.runs.all})},onError:e=>M(e.message,{tone:`danger`})}),te=e=>{Qe({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(),!R.isPending&&y.canRun&&R.mutate())},z=e=>l(c.some(t=>q(t)===q(e))?c.filter(t=>q(t)!==q(e)):[...c,Ue(e)]);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Y.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Y.jsx)(`span`,{children:`Instructions for the agent`}),(0,Y.jsx)(Xe,{ref:A,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:O,onChange:e=>k(e.target.value),onSelect:e=>{j.current=e.currentTarget.selectionStart},onKeyDown:te,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Y.jsx)(ye,{templates:N,onInsert:ee}),(0,Y.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Y.jsxs)(`div`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Workflow`}),(0,Y.jsx)(xn,{workflows:t,value:r,onChange:s})]}),(0,Y.jsxs)(`div`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Skills · select one or more`}),(0,Y.jsx)(Cn,{skills:n,skillUsage:_.data?.skillUsage,selected:c,onToggle:z})]}),c.length>0?(0,Y.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:c.map(e=>(0,Y.jsx)(bn,{skill:e,skills:n,unchecked:C.unchecked,onRemove:()=>z(e)},q(e)))}):null,T?(0,Y.jsx)(`p`,{role:`alert`,children:`A selected skill path is unavailable. Remove it or choose a current copy before starting.`}):null,(0,Y.jsx)(dn,{layout:`row`,pick:u,onChange:d,disabled:R.isPending||!y.canRun,accounts:!0}),(0,Y.jsxs)(`div`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Account`}),(0,Y.jsx)(Sn,{resolved:y,disabled:R.isPending||!y.canRun,onPick:e=>d({...u,account:e})})]}),!y.providerPending&&!y.canRun?(0,Y.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[y.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Y.jsx)(U,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Y.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,Y.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[a(e.url)?(0,Y.jsx)(i,{asChild:!0,variant:`outline`,children:(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Y.jsxs)(i,{variant:`primary`,"data-action":`gh-run`,disabled:R.isPending||!y.canRun||T,onClick:()=>R.mutate(),children:[(0,Y.jsx)(fe,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,v]}),(0,Y.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground`,children:Ke()}),p?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Y.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Y.jsx)(U,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function bn({skill:e,skills:t,unchecked:n,onRemove:r}){let i=t.find(t=>t.id===e.id&&(e.path===void 0||t.path===e.path)),a=[i?.name??e.id,e.path].filter(Boolean).join(` · `),o=!n&&e.path!==void 0&&!i?` (unavailable)`:n||!i?` (unchecked)`:``;return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e.id,onClick:r,title:`Remove skill ${a}`,"aria-label":`Remove skill ${a}`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[a,o,(0,Y.jsx)(I,{size:16,"aria-hidden":`true`,className:`size-3`})]})}function xn({workflows:e,value:t,onChange:n}){let[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(``),c=(0,J.useRef)(null),l=ze(e,o);return(0,Y.jsxs)(A,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Y.jsx)(k,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(Ee,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,Y.jsx)(se,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Y.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Y.jsx)(z,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(O,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(xe,{shouldFilter:!1,children:[(0,Y.jsx)(be,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Y.jsxs)(Ce,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,Y.jsx)(Se,{children:`Nothing matches.`}):null,(0,Y.jsx)(W,{children:l.map(e=>{let r=t===e.name;return(0,Y.jsxs)(G,{value:`workflow ${e.name}`,keywords:He(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Y.jsx)(P,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function Sn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:l,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Y.jsx)(K,{icon:(0,Y.jsx)(F,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function Cn({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(null),d=(0,J.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=Ge(e,s,t),g=(e,t)=>{let a=n.some(t=>q(t)===q(e));return(0,Y.jsxs)(G,{value:q(e),keywords:He(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.id,"data-selected":a?`true`:void 0,onSelect:()=>i(Ue(e)),children:[(0,Y.jsx)(`span`,{className:r(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.path?(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Y.jsx)(le,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,Y.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},q(e))};return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Je,{skill:l,onClose:()=>u(null)}),(0,Y.jsxs)(A,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Y.jsx)(k,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:r(Ee,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Y.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Y.jsx)(z,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(O,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(xe,{shouldFilter:!1,children:[(0,Y.jsx)(be,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,Y.jsxs)(Ce,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[s.trim()&&!e.some(e=>e.id===s.trim())?(0,Y.jsx)(W,{children:(0,Y.jsxs)(G,{value:`typed-skill`,onSelect:()=>i({id:s.trim()}),children:[`Use skill id “`,s.trim(),`” (unchecked)`]})}):null,(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,Y.jsx)(Se,{children:`Nothing matches.`}):null,h?h.length>0?(0,Y.jsx)(W,{children:h.map(e=>g(e,Be(e)))}):null:(0,Y.jsxs)(Y.Fragment,{children:[f.length>0?(0,Y.jsx)(W,{heading:`Most used`,children:f.map(e=>g(e,Be(e)))}):null,p.length>0?(0,Y.jsx)(W,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,Y.jsx)(W,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var wn=new WeakMap;function Tn(){let e=hn(),t={workflow:e.workflow,selectedSkills:e.skills,engine:{runner:null,model:null,effort:null,account:null},queued:new Map},n=new Set;return{snapshot:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)}),update:e=>{t={...t,...e},(e.workflow!==void 0||e.selectedSkills!==void 0)&&gn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function En(){let e=m(),{projectId:t}=p(),n=wn.get(e);n||wn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=Tn());let{snapshot:i,subscribe:a,update:o}=r,s=(0,J.useSyncExternalStore)(a,i,i),c=w(),l=sn(s.engine),u=b(l.runner,l.account),d=x(),f=c.data?.workflows;(0,J.useEffect)(()=>{f&&s.workflow!==null&&!f.some(e=>e.name===s.workflow)&&o({workflow:null})},[o,f,s.workflow]);let h=(0,J.useMemo)(()=>Ve(u.data??[],d.data?.skillUsage),[u.data,d.data?.skillUsage]);return{...s,workflows:c,skillList:h,skillsUnchecked:u.unchecked,setWorkflow:e=>o({workflow:e}),setSelectedSkills:e=>o({selectedSkills:e}),setEngine:e=>o({engine:e}),onQueued:(e,t)=>o({queued:new Map(i().queued).set(e,t)})}}export{Xt as a,Pt as c,xt as d,bt as f,Qt as i,vt as l,yn as n,At as o,$t as r,St as s,En as t,yt as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Gr as e,ni as t}from"./project-scope-context-CX36ze1Q.js";function n(n,r){return e(n,t,r)}export{n as t};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{E as r,l as i,t as a}from"./button-C1fD-ZFr.js";import{A as o,Ht as s,T as c,i as l,ti as u,zt as d}from"./project-scope-context-CX36ze1Q.js";import{Pt as f,Tt as p,Yt as m,kt as ee,t as te}from"./queries-Cb76PEoL.js";import{n as h}from"./toaster-Cxgzn9ip.js";import{J as g,S as _,X as v,at as y,b as ne,c as re,ft as ie,i as b,l as x,lt as S,n as ae,ot as oe,st as C,tt as se,v as w,x as T}from"./design-icons-CzEoMH9c.js";import{i as E,p as ce,r as D,t as O}from"./dropdown-menu-Dso6iTId.js";import{i as k,o as A,r as j,s as le,t as M}from"./dialog-B3EUmMBQ.js";import{_ as ue,a as de,d as fe,g as pe,h as N,i as P,l as me,m as F,o as he,p as ge,r as _e,s as ve,t as ye,v as I}from"./sortable.esm-zp_qkYGV.js";import{i as L,l as be,o as xe}from"./skills-pM_PouEs.js";import{t as Se}from"./centered-state-CiiA8Vgw.js";import{O as Ce,U as R,dt as z,ft as B,gt as V,ht as H,lt as U,mt as W,pt as G,tn as K,ut as we}from"./index-C3pMUosD.js";var q=e(t(),1);function J(e){let t=[];for(let n of e){if(n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.timeoutMs!==void 0||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Te(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function Ee(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function De(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function Oe(e,t){return e.filter((e,n)=>n!==t)}function Y(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function X(e,t,n){let r=` `.repeat(n);return t.includes(`
|
|
2
|
-
`)?[`${r}${e}: |`,...t.split(`
|
|
3
|
-
`).map(e=>`${r} ${e}`)]:[`${r}${e}: ${Y(t)}`]}function ke(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${Y(e.name)}`),e.skill&&t.push(` skill: ${Y(e.skill)}`),t}function Ae(e){let t=[];return e.model&&t.push(` model: ${Y(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${Y(e.effort)}`),e.runner&&t.push(` runner: ${Y(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${Y(e.agentProfile)}`),t}function Z(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(Y).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(Y).join(`, `)}]`),t}function je(e){return e.onFail?[` onFail:`,` retry: ${Y(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function Me(e){return[` - id: ${Y(e.id)}`,...ke(e),...e.prompt?X(`prompt`,e.prompt,4):[],...Ae(e),...Z(e),...e.command?X(`command`,e.command,4):[],...je(e)]}function Ne(e,t,n){let r=[`name: ${Y(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...X(`description`,t.trim(),0));let i=J(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${Y(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...Me(e))}else r.push(`skills: []`);return`${r.join(`
|
|
4
|
-
`)}\n`}function Pe(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function Fe(e){let t=J(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Ie(e,t){let n=new Set,r=[];for(let t of e.steps.slice(0,8)){let e=t.id||`step`,i=e;for(let t=2;n.has(i);t++)i=`${e}-${t}`;n.add(i),r.push({...t,id:i})}return{name:e.name?.trim()||t,steps:r}}function Le(e,t,n){let r=J(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var Q=n();function Re({workflows:e,draft:t,trimmedName:n,nameRef:r,onDraft:i,onLoadWorkflow:a}){return(0,Q.jsxs)(`section`,{"data-slot":`wb-metadata`,className:`flex min-w-0 flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex flex-col items-start gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs text-muted-foreground`,children:`Load an existing workflow`}),(0,Q.jsxs)(`div`,{className:`relative max-w-full`,children:[(0,Q.jsx)(x,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsxs)(`select`,{id:`workflow-load`,value:e.some(e=>e.name===n)?n:``,onChange:t=>{let n=e.find(e=>e.name===t.target.value);n&&a(n)},className:`h-11 max-w-full rounded-lg border border-border bg-card pl-9 pr-3 text-xs font-medium appearance-none focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(`option`,{value:``,disabled:!0,children:`Choose a workflow`}),e.map(e=>(0,Q.jsx)(`option`,{value:e.name,"data-slot":`wb-load-option`,"data-name":e.name,children:e.name},e.name))]})]})]}),(0,Q.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-semibold`,children:`Workflow name`}),(0,Q.jsx)(K,{id:`workflow-name`,ref:r,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:t.name,onChange:e=>i({...t,name:e.target.value}),className:`h-12 bg-card text-sm`}),(0,Q.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-semibold`,children:`Description`}),(0,Q.jsx)(R,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,value:t.description,onChange:e=>i({...t,description:e.target.value}),className:`min-h-[72px] bg-card p-3.5 text-sm`})]})}function ze({savedFile:e,autoOpen:t,onImportToggle:n,onExport:r,onAutoToggle:i,onDeleteRequest:o}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-actions`,className:`grid grid-cols-[max-content_max-content] items-center justify-start gap-2 sm:flex sm:flex-wrap [&_button]:min-h-11 [&_button]:border [&_button]:border-border [&_button]:bg-card`,children:[(0,Q.jsxs)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:n,children:[(0,Q.jsx)(C,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,Q.jsxs)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:r,children:[(0,Q.jsx)(ne,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,Q.jsxs)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":t,title:`Describe a chain — the agent builds it`,onClick:i,children:[(0,Q.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),`Auto`]}),e?(0,Q.jsxs)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-delete`,className:`text-danger hover:text-danger`,title:`Delete the saved workflow file`,onClick:o,children:[(0,Q.jsx)(y,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function Be({text:e,onTextChange:t,pending:n,onRun:r,onCancel:i}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] leading-relaxed text-muted-foreground`,children:`Describe the outcome. An agent proposes a title and ordered skill/check steps. Review the result, edit it, then Save.`}),(0,Q.jsx)(R,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),r())},className:`mt-4 min-h-[108px] bg-background p-4 text-sm`}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsxs)(a,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:n||e.trim()===``,onClick:r,children:[(0,Q.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),n?`Building…`:`Build chain`]}),(0,Q.jsxs)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:i,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,Q.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function Ve({open:e,onOpenChange:t,text:n,onTextChange:r,error:i,pending:o,onRun:s,onCancel:c}){return(0,Q.jsx)(M,{open:e,onOpenChange:t,children:(0,Q.jsxs)(j,{showCloseButton:!1,"data-slot":`wb-import-panel`,className:`max-md:translate-x-0 max-md:translate-y-0 sm:max-w-[660px] rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(le,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,Q.jsx)(k,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,Q.jsx)(R,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
|
|
5
|
-
skills:
|
|
6
|
-
- test-conventions
|
|
7
|
-
- commit-style`,value:n,onChange:e=>r(e.target.value),className:`mt-4 min-h-[124px] bg-background p-4 font-mono text-[13px] leading-relaxed`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] text-muted-foreground`,children:`Paste a portable workflow definition. Imported steps appear in execution order.`}),i===``?null:(0,Q.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:i}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsx)(a,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:o,onClick:s,children:`Import`}),(0,Q.jsx)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:c,children:`Cancel`})]})]})})}function He({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,Q.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,Q.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,Q.jsx)(v,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(K,{"data-slot":`wb-filter`,placeholder:`Find a skill…`,"aria-label":`Filter skills`,value:t,onChange:e=>n(e.target.value),className:`h-11 pl-9 text-xs`})]}),(0,Q.jsx)(nt,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,Q.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,Q.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,Q.jsxs)(`summary`,{"data-slot":`wb-yaml-toggle`,className:`inline-flex min-h-[44px] cursor-pointer items-center rounded-lg border border-border px-3 text-xs font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(it,{yaml:o})}),(0,Q.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 max-h-96 overflow-auto rounded-lg border border-border bg-background p-3 font-mono text-[11px] leading-relaxed whitespace-pre text-muted-foreground`,children:o})]})]})}function Ue({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,Q.jsx)(tt,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function We({open:e,onOpenChange:t,query:n,onQueryChange:r,matches:i,skillsCount:o,error:s,selectedSkill:c,onSelectSkill:l,stepsCount:u,onCloseAutoFocus:d,onCancel:f,onAdd:p}){return(0,Q.jsx)(M,{open:e,onOpenChange:t,children:(0,Q.jsxs)(j,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:d,className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button]:min-h-11`,children:[(0,Q.jsxs)(A,{children:[(0,Q.jsx)(le,{className:`text-xl font-normal`,children:`Add step`}),(0,Q.jsx)(k,{className:`sr-only`,children:`Choose a skill to append to this workflow.`})]}),(0,Q.jsx)(K,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:n,onChange:e=>r(e.target.value)}),s===null?(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[i.map(e=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg py-2 has-[:checked]:bg-accent-strong/10 has-[:focus-visible]:outline-2`,children:[(0,Q.jsx)(`input`,{type:`radio`,name:`workflow-add-skill`,className:`sr-only`,value:e.id,checked:c===e.id,onChange:()=>l(e.id)}),(0,Q.jsxs)(`span`,{className:`min-w-0 break-words text-sm`,children:[(0,Q.jsx)(`span`,{className:`block`,children:e.name}),(0,Q.jsx)(`span`,{className:`mt-2 block text-xs text-muted-foreground`,children:e.description}),e.path?(0,Q.jsx)(`span`,{className:`block break-all text-xs`,children:e.path}):null]})]},JSON.stringify([e.id,e.path]))),i.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o===0?`No skills available in this project.`:`No matching skills.`}):null]}):(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not load skills: `,s]}),n.trim()&&!i.some(e=>e.id===n.trim())?(0,Q.jsxs)(a,{onClick:()=>l(n.trim()),children:[`Use skill id “`,n.trim(),`” (unchecked)`]}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(a,{variant:`outline`,onClick:f,children:`Cancel`}),(0,Q.jsx)(a,{variant:`primary`,disabled:!c||u>=8,onClick:()=>{c&&p(c)},children:`Add selected skill`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the selected skill, then reorder it in the existing canvas.`}),u>=8?(0,Q.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`A workflow can contain up to `,8,` steps. Remove a step before adding another.`]}):null]})})}function Ge({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{open:n,onOpenChange:e=>!e&&r(),children:(0,Q.jsxs)(B,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(H,{children:[(0,Q.jsxs)(V,{children:[`“`,e,`” already exists`]}),(0,Q.jsx)(G,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,Q.jsxs)(W,{children:[(0,Q.jsx)(z,{children:`Keep the file`}),(0,Q.jsx)(we,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,Q.jsx)(U,{open:i,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(B,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(H,{children:[(0,Q.jsxs)(V,{children:[`Delete workflow “`,e,`”?`]}),(0,Q.jsxs)(G,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,Q.jsxs)(W,{children:[(0,Q.jsx)(z,{children:`Keep the file`}),(0,Q.jsx)(we,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function Ke(e){return e.name??e.skill??e.id}function qe(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function Je(e){let t=e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``;return`$ ${e.command}${t}`}function Ye(e,t){return qe(e)||t?.description||`Not listed by this runner and account. Step open will check the skill id.`}function Xe(e,t){return e.command?Je(e):e.skill?Ye(e,t):e.prompt??``}function Ze(e,t){return e.skill&&!t?`unknown`:null}function Qe(e){return e.command?`Command step${e.onFail?` · Retry ×${e.onFail.max??2}`:``}`:e.skill?`Skill step`:`Prompt step`}function $e({index:e,title:t,badge:n,onRemove:r,gripProps:o}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${e+1}: ${t}`,className:`inline-flex size-[26px] shrink-0 cursor-grab items-center justify-center rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,...o,children:(0,Q.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:String(e+1).padStart(2,`0`)})}),(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),n?(0,Q.jsx)(`span`,{"data-slot":`wb-step-badge`,className:i(`shrink-0 rounded-full border px-2 py-px font-mono text-[11px]`,n===`unknown`&&`border-danger/35 text-danger`),children:n}):null,r?(0,Q.jsxs)(O,{children:[(0,Q.jsx)(ce,{asChild:!0,children:(0,Q.jsx)(a,{"data-slot":`wb-step-actions`,variant:`ghost`,size:`icon`,className:`size-[26px]`,"aria-label":`Step ${e+1} actions: ${t}`,children:(0,Q.jsx)(T,{"aria-hidden":`true`,className:`size-4`})})}),(0,Q.jsx)(D,{align:`end`,children:(0,Q.jsxs)(E,{"data-slot":`wb-step-remove`,"aria-label":`Remove step ${e+1}: ${t}`,onSelect:r,children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),` Remove step`]})})]}):null]})}function et({index:e,onMoveUp:t,onMoveDown:n}){return(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 @min-[900px]:hidden`,children:[(0,Q.jsxs)(a,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} up`,disabled:!t,onClick:t,children:[(0,Q.jsx)(b,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,Q.jsxs)(a,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} down`,disabled:!n,onClick:n,children:[(0,Q.jsx)(ae,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function tt({step:e,index:t,skills:n,onRemove:r,gripProps:a,onMoveUp:o,onMoveDown:s,overlay:c=!1}){let l=n.find(t=>t.id===e.skill),u=Ke(e),d=Xe(e,l),f=Ze(e,l);return(0,Q.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:i(`rounded-lg border border-border bg-background p-4`,c&&`shadow-md`),children:[(0,Q.jsx)($e,{index:t,title:u,badge:f,onRemove:r,gripProps:a}),d?(0,Q.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-3 break-words text-xs leading-relaxed text-muted-foreground`,children:d}):null,(0,Q.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-3 text-[12px] text-link-foreground`,children:Qe(e)}),c?null:(0,Q.jsx)(et,{index:t,onMoveUp:o,onMoveDown:s})]})}function nt({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,Q.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=be(e,t);return(0,Q.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,Q.jsx)(rt,{skill:e,inFlow:r.has(e.id),onAdd:i},JSON.stringify([e.id,e.path]))):(0,Q.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:`This runner reports no skills.`})})}function rt({skill:e,inFlow:t,onAdd:n}){let{attributes:r,listeners:a,setNodeRef:o,isDragging:s}=F({id:`palette:${JSON.stringify([e.id,e.path])}`,data:{type:`palette`,skill:e.id}});return(0,Q.jsxs)(`div`,{ref:o,"data-slot":`wb-skill`,"data-skill":e.id,"data-in-flow":t||void 0,title:e.description??``,className:i(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,s&&`opacity-40`),...r,...a,children:[(0,Q.jsxs)(`span`,{className:i(`min-w-0 flex-1 break-words text-xs`,L(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:[e.name,e.path?(0,Q.jsx)(`span`,{className:`block break-all text-xs text-soft-foreground`,children:e.path}):null]}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.id),className:`inline-flex size-11 shrink-0 items-center justify-center rounded-md text-link-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-3.5`})})]})}function it({yaml:e}){let[t,n]=(0,q.useState)(!1),r=(0,q.useRef)(null);return(0,q.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(re,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(w,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}var at=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function ot(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function st(){let{name:e}=r();return(0,Q.jsx)(ct,{routeName:e},e??``)}function ct({routeName:e}){let t=ee(),n=f(),r=p(),i=u(),[_,v]=(0,q.useState)(null),[y,ne]=(0,q.useState)(``),[ie,b]=(0,q.useState)(!1),[x,S]=(0,q.useState)(``),[ae,C]=(0,q.useState)(null),[se,w]=(0,q.useState)(!1),[T,E]=(0,q.useState)(``),[ce,D]=(0,q.useState)(``),[O,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(``),[le,M]=(0,q.useState)(!1),[de,N]=(0,q.useState)(!1),[P,F]=(0,q.useState)(null),[ye,I]=(0,q.useState)(null),L=(0,q.useRef)(null),R=(0,q.useRef)(null),z=t.data?.workflows??[],B=n.data??[],V=xe(B,r.data?.skillUsage),H=be(V,x,r.data?.skillUsage);(0,q.useEffect)(()=>{if(_!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);v(r?ot(r):$())},[_,t.data,e]);let U=e=>v(t=>t===null?t:{...t,steps:e}),W=m({mutationFn:e=>d(e),onSuccess:e=>{v({name:e.name,description:e.description??``,steps:e.steps}),w(!1),E(``),D(``),h(`Imported "${e.name}" — review, then Save.`)},onError:e=>D(e.message)}),G=m({mutationFn:e=>s(e),onSuccess:e=>{v(t=>{let n=t??$(),{name:r,steps:i}=Ie(e,n.name);return{...n,name:r,steps:i}}),k(!1),j(``),h(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??_?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>h(e instanceof Error?e.message:String(e),{tone:`danger`})}),K=m({mutationFn:e=>c({...Le(_?.name??``,_?.description??``,_?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{M(!1),h(`Saved — ${e.path.split(`/`).pop()??e.path}`),i.invalidateQueries({queryKey:te.workflows})},onError:e=>{e instanceof l&&e.exists===!0?M(!0):h(e instanceof Error?e.message:String(e),{tone:`danger`})}}),we=m({mutationFn:e=>o(e),onSuccess:(e,t)=>{N(!1),h(`Deleted "${t}".`),v($()),i.invalidateQueries({queryKey:te.workflows})},onError:e=>{N(!1),h(e instanceof Error?e.message:String(e),{tone:`danger`})}}),J=ue(pe(fe,{activationConstraint:{distance:4}}),pe(me,{coordinateGetter:_e}));if(t.isError)return(0,Q.jsx)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,Q.jsx)(Se,{icon:(0,Q.jsx)(oe,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(_===null)return(0,Q.jsx)(Ce,{});let Y=_.steps,X=_.name.trim(),ke=z.find(e=>e.name===X&&e.source===`file`),Ae=Ne(_.name,_.description,Y),Z=(e,t=Y.length)=>{if(Y.length>=8){h(`A workflow holds at most 8 steps.`,{tone:`danger`});return}U(Ee(Y,Te(e,Y),t))};return(0,Q.jsxs)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,Q.jsxs)(`header`,{className:`mb-[22px] flex flex-wrap items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Workflows`}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Portable skill chains. Steps run from top to bottom.`})]}),(0,Q.jsxs)(a,{variant:`primary`,"data-slot":`wb-new`,className:`min-h-11`,onClick:()=>v($()),children:[(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]})]}),(0,Q.jsxs)(he,{sensors:J,collisionDetection:ge,onDragStart:e=>{let t=e.active.data.current;F(t??null)},onDragOver:e=>{I(e.over?String(e.over.id):null)},onDragEnd:e=>{F(null),I(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===at?Y.length:Y.findIndex(e=>e.id===n.id);Z(r.skill,e===-1?Y.length:e);return}if(n.id===t.id)return;let i=Y.findIndex(e=>e.id===t.id),a=Y.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&U(De(Y,i,a))},onDragCancel:()=>{F(null),I(null)},children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-[22px] pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,Q.jsx)(Re,{workflows:z,draft:_,trimmedName:X,nameRef:L,onDraft:v,onLoadWorkflow:e=>v(ot(e))}),(0,Q.jsx)(ze,{savedFile:ke,autoOpen:O,onImportToggle:()=>{D(``),k(!1),w(e=>!e)},onExport:()=>{let e=new Blob([Ae],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${Pe(_.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{w(!1),k(e=>!e)},onDeleteRequest:()=>N(!0)}),O?(0,Q.jsx)(Be,{text:A,onTextChange:j,pending:G.isPending,onRun:()=>{let e=A.trim();e===``||G.isPending||G.mutate(e)},onCancel:()=>{k(!1),j(``)}}):null,(0,Q.jsx)(Ve,{open:se,onOpenChange:w,text:T,onTextChange:E,error:ce,pending:W.isPending,onRun:()=>{let e=T.trim();e!==``&&W.mutate(e)},onCancel:()=>{w(!1),E(``),D(``)}}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,Q.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Steps · `,Y.length,` of `,8,(0,Q.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Fe(Y)})]}),(0,Q.jsx)(lt,{steps:Y,skills:B,dragging:P!==null,overId:ye,activeStepId:P?.type===`step`?P.step.id:null,onRemove:e=>U(Oe(Y,e)),onMove:(e,t)=>U(De(Y,e,t))}),(0,Q.jsxs)(a,{ref:R,variant:`outline`,className:`mt-4 min-h-11`,onClick:()=>{C(null),S(``),b(!0)},children:[(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,Q.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,Q.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]}),(0,Q.jsxs)(`footer`,{className:`mt-4 flex flex-wrap items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Review the name and steps, then save to a workflow file.`}),(0,Q.jsxs)(a,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 max-sm:w-full`,"data-slot":`wb-save`,disabled:K.isPending,onClick:()=>{if(X===``){L.current?.focus();return}if(Y.length===0){h(`Add at least one step first.`,{tone:`danger`});return}K.mutate(!1)},children:[(0,Q.jsx)(re,{"aria-hidden":`true`,className:`size-3`}),`Save`]})]})]}),(0,Q.jsx)(He,{paletteSkills:V,query:y,onQueryChange:ne,error:n.isError?n.error.message:null,inFlow:new Set(Y.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Z(e),yaml:Ae})]})]}),(0,Q.jsx)(ve,{children:(0,Q.jsx)(dt,{dragging:P,steps:Y,skills:B})})]}),(0,Q.jsx)(We,{open:ie,onOpenChange:b,query:x,onQueryChange:S,matches:H,skillsCount:B.length,error:n.isError?n.error.message:null,selectedSkill:ae,onSelectSkill:C,stepsCount:Y.length,onCloseAutoFocus:e=>{e.preventDefault(),R.current?.focus()},onCancel:()=>b(!1),onAdd:e=>{Z(e),b(!1)}}),(0,Q.jsx)(Ge,{trimmedName:X,savedFile:ke,overwriteOpen:le,onOverwriteDismiss:()=>M(!1),deleteOpen:de,onDeleteDismiss:()=>N(!1),onOverwrite:()=>K.mutate(!0),onDelete:()=>we.mutate(X)})]})}function lt({steps:e,skills:t,dragging:n,overId:r,activeStepId:a,onRemove:o,onMove:s}){let{setNodeRef:c,isOver:l}=N({id:at}),u=n&&r===at;return(0,Q.jsx)(`div`,{ref:c,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:i(`relative mt-4 rounded-lg transition-colors`,l?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,Q.jsx)(`p`,{className:i(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,l?`text-link-foreground`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,Q.jsxs)(ye,{items:e.map(e=>e.id),strategy:de,children:[(0,Q.jsx)(`ol`,{className:`flex flex-col gap-4`,children:e.map((i,c)=>(0,Q.jsx)(ut,{step:i,index:c,skills:t,dragging:n,insertBefore:n&&r===i.id&&a!==i.id,onRemove:()=>o(c),onMoveUp:c>0?()=>s(c,c-1):void 0,onMoveDown:c<e.length-1?()=>s(c,c+1):void 0},i.id))}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:i(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,u?`bg-accent-strong`:`bg-transparent`)})]})})}function ut({step:e,index:t,insertBefore:n,onRemove:r,onMoveUp:a,onMoveDown:o}){let s=f(e.runner,e.agentProfile),{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:p,isDragging:m}=P({id:e.id,data:{type:`step`,step:e}});return(0,Q.jsxs)(`li`,{ref:u,style:{transform:I.Transform.toString(d),transition:p},className:i(`relative`,m&&`opacity-40`),children:[n?(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[7px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,Q.jsx)(tt,{step:e,index:t,skills:s.data??[],onRemove:r,onMoveUp:a,onMoveDown:o,gripProps:{...c,...l}})]})}function dt(e){let t=e.dragging?.type===`step`?e.dragging.step:void 0,n=f(t?.runner,t?.agentProfile,!!t);return(0,Q.jsx)(Ue,{...e,skills:t?n.data??[]:e.skills})}export{st as WorkflowsRoute};
|
|
@@ -1 +0,0 @@
|
|
|
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{N as i,l as a}from"./button-C1fD-ZFr.js";var o=e(t(),1),s=e(n(),1),c=r();function l({src:e,alt:t=``,className:n,...r}){let[l,u]=(0,o.useState)(!1),d=i(e);return(0,o.useEffect)(()=>{if(!l)return;let e=e=>{e.key===`Escape`&&u(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l]),(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`img`,{...r,src:d,alt:t,loading:`lazy`,onClick:()=>u(!0),className:a(`cursor-zoom-in`,n)}),l?(0,s.createPortal)((0,c.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Image preview`,"data-slot":`image-lightbox`,onClick:()=>u(!1),className:`fixed inset-0 z-[100] flex cursor-zoom-out items-center justify-center bg-black/80 p-4 backdrop-blur-sm`,children:(0,c.jsx)(`img`,{src:d,alt:t,className:`max-h-full max-w-full rounded-md object-contain shadow-2xl`})}),document.body):null]})}export{l as t};
|