@hearsay-tools/squawk 0.19.0-dev.9298 → 0.19.0-dev.9308

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.
Files changed (69) hide show
  1. package/dist/ci-wait/controller.d.ts +7 -7
  2. package/dist/features/reports/routes.d.ts +2 -2
  3. package/dist/server/activity-routes.d.ts +23 -23
  4. package/dist/server/projects-routes.d.ts +41 -41
  5. package/dist/server/runs-routes.d.ts +313 -313
  6. package/dist/server/server.d.ts +58 -58
  7. package/package.json +4 -4
  8. package/web/dist/assets/{accounts-section-BHP8K_nY.js → accounts-section-B8X63Wvk.js} +1 -1
  9. package/web/dist/assets/{activity-motion-DEEIuaki.js → activity-motion-BX7w9uwa.js} +1 -1
  10. package/web/dist/assets/{activity-route-vtZmQsDB.js → activity-route-D6OhCzkJ.js} +1 -1
  11. package/web/dist/assets/{agent-config-section-CbnVaIx7.js → agent-config-section-RluVjTDv.js} +1 -1
  12. package/web/dist/assets/{agent-defaults-section-Blxd9IpY.js → agent-defaults-section-Bl67Iurg.js} +1 -1
  13. package/web/dist/assets/{appearance-B_y9StVj.js → appearance-ChGEz79A.js} +1 -1
  14. package/web/dist/assets/{archive-on-merge-field-DlChylWt.js → archive-on-merge-field-DtMYAmPH.js} +1 -1
  15. package/web/dist/assets/{ask-card-DzWKRJ1x.js → ask-card-Bk87kXMi.js} +1 -1
  16. package/web/dist/assets/{automations-route-DxE9u9p0.js → automations-route-DpEqMGRx.js} +1 -1
  17. package/web/dist/assets/{commit-list-SxBDO_q5.js → commit-list-DGLW8f7_.js} +1 -1
  18. package/web/dist/assets/{diff-B6Ye5Xg9.js → diff-BQIvq2Ar.js} +2 -2
  19. package/web/dist/assets/{diff-controls-BFQOIJ97.js → diff-controls-CcYIa7pJ.js} +1 -1
  20. package/web/dist/assets/{diff-view-BkF3xtYW.js → diff-view-BSYPKJkF.js} +1 -1
  21. package/web/dist/assets/{discard-changes-dialog-CaS0koto.js → discard-changes-dialog-CEeuND_i.js} +1 -1
  22. package/web/dist/assets/{file-preview-ByWn2eDz.js → file-preview-BPSpXZ6G.js} +1 -1
  23. package/web/dist/assets/{git-toolbar-COI-N232.js → git-toolbar-D3O7S7vw.js} +1 -1
  24. package/web/dist/assets/{github-CAQJIg-J.js → github-b6pU4RVM.js} +1 -1
  25. package/web/dist/assets/{global-activity-route-99-UqSlC.js → global-activity-route-sTvejVUG.js} +1 -1
  26. package/web/dist/assets/index-BToDejlf.css +1 -0
  27. package/web/dist/assets/{index-BAXboPqe.js → index-CIyGnGfm.js} +4 -4
  28. package/web/dist/assets/{markdown-D7p7x8Pe.js → markdown-DnBvknF9.js} +1 -1
  29. package/web/dist/assets/{option-select-BvsSDWBz.js → option-select-HC8juekO.js} +1 -1
  30. package/web/dist/assets/{preferences-section-DkdcKxmS.js → preferences-section-DuV8JFqQ.js} +1 -1
  31. package/web/dist/assets/{preview-pane-connected-B3f0fR6q.js → preview-pane-connected-E8n0RgYL.js} +1 -1
  32. package/web/dist/assets/{project-location-CvZY7aOx.js → project-location-bPiIsStE.js} +1 -1
  33. package/web/dist/assets/{projects-section-DGzDfKN_.js → projects-section-0eQ2TVqw.js} +1 -1
  34. package/web/dist/assets/{prompt-templates-section-DbHe-j9Z.js → prompt-templates-section-CVNw5v0w.js} +1 -1
  35. package/web/dist/assets/{remote-settings-notice-ByPYNQyB.js → remote-settings-notice-tNcad9fA.js} +1 -1
  36. package/web/dist/assets/{repo-git-4rKalM-L.js → repo-git-DA66978k.js} +1 -1
  37. package/web/dist/assets/{report-reader-IAYhP0KQ.js → report-reader-DHB5teJQ.js} +1 -1
  38. package/web/dist/assets/{reports-BP_hajNp.js → reports-Oxg0v5bR.js} +1 -1
  39. package/web/dist/assets/{resources-section-QNbLbu3j.js → resources-section-BAj-A1Ou.js} +1 -1
  40. package/web/dist/assets/{review-notes-drafts-CB8u-M0E.js → review-notes-drafts-agZQaBcF.js} +1 -1
  41. package/web/dist/assets/{review-panel-Bw8yG2xg.js → review-panel-858YvYOc.js} +1 -1
  42. package/web/dist/assets/{review-strip-BojRnCkg.js → review-strip-tiqQt7qS.js} +1 -1
  43. package/web/dist/assets/{run-diff-CMZgQG9B.js → run-diff-BDFptONx.js} +1 -1
  44. package/web/dist/assets/{run-header-D7LZBbaL.js → run-header-CEIKmo_0.js} +1 -1
  45. package/web/dist/assets/{select-D9BIA_Kn.js → select-C4s2-ztq.js} +1 -1
  46. package/web/dist/assets/{session-context-section-CxFRidmv.js → session-context-section-CihFGtUL.js} +1 -1
  47. package/web/dist/assets/{settings-agent-picker-Cy_ZpuNd.js → settings-agent-picker-B-LnnccN.js} +1 -1
  48. package/web/dist/assets/{settings-save-bar-DzbndGGQ.js → settings-save-bar-l5vO-fT3.js} +1 -1
  49. package/web/dist/assets/{settings-shell-DS8k_xP6.js → settings-shell-B_o8TQYi.js} +1 -1
  50. package/web/dist/assets/{sidebar-section-CY978tNF.js → sidebar-section-BTjJD2PF.js} +1 -1
  51. package/web/dist/assets/{skills-WZ5YRCbF.js → skills-C-PLlLf0.js} +1 -1
  52. package/web/dist/assets/{task-changes-Dd2KHRQ6.js → task-changes-BZ7Hlj9q.js} +1 -1
  53. package/web/dist/assets/{task-commits-De0FVgKP.js → task-commits-Jf35_1k0.js} +1 -1
  54. package/web/dist/assets/{task-file-scope-C_cr_ix-.js → task-file-scope-npOd7AhM.js} +1 -1
  55. package/web/dist/assets/{task-files-resMdu9u.js → task-files--54CdvAw.js} +1 -1
  56. package/web/dist/assets/{task-github-item-Hz1RbO88.js → task-github-item-QzP9IPGg.js} +1 -1
  57. package/web/dist/assets/{task-thread-D7vUf0g7.js → task-thread-BgxYbzJU.js} +1 -1
  58. package/web/dist/assets/{thread-state-Bjh3rImx.js → thread-state-CfmY7F3h.js} +1 -1
  59. package/web/dist/assets/{unified-diff-weWjKedZ.js → unified-diff-DdU6bcRV.js} +1 -1
  60. package/web/dist/assets/{use-finish-run-BuyJkeEN.js → use-finish-run-Bv7_Ezz_.js} +1 -1
  61. package/web/dist/assets/{use-hand-to-agent-state-CSDPzpM7.js → use-hand-to-agent-state-dHej93ZU.js} +1 -1
  62. package/web/dist/assets/use-path-bases-B6yYqrmU.js +1 -0
  63. package/web/dist/assets/workflows-CeUWNdYH.js +7 -0
  64. package/web/dist/assets/{workspace-tools-CSLTEwLa.js → workspace-tools-BwMECWWr.js} +1 -1
  65. package/web/dist/assets/{worktrees-section-Crp31i8F.js → worktrees-section-CytHZvmT.js} +1 -1
  66. package/web/dist/index.html +2 -2
  67. package/web/dist/assets/index-B5vWsR62.css +0 -1
  68. package/web/dist/assets/use-path-bases-DgEkRWYi.js +0 -1
  69. package/web/dist/assets/workflows-DtnnAq4w.js +0 -7
@@ -1 +1 @@
1
- import{W as e,bt as t,ft as n,g as r,gt as i,on as a,zn as o}from"./queries-CPNrCEon.js";import{a as s,bi as c,ha as l,ht as u,si as d}from"./project-scope-context-_6sNMsAf.js";import"./task-groups-Bc_WNTMe.js";import{a as f}from"./agent-accounts-BC78GKYv.js";import{V as p,mn as m,xn as h}from"./index-BAXboPqe.js";function g(e,t,n,r){return d(e,t)?.runner??e.runner??(t||n?r:void 0)??`claude`}function _(e,t,n){let r=new Set;for(let i of e.workflowDef?.steps??[]){if(i.command!==void 0||i.kind===`plugin`)continue;let a=i.runner??t,o=i.agentProfile??(a===(e.runner??t)?e.agentProfile:void 0)??n.repoAccount?.[a];n.readyOn(a,o)||r.add(a)}return[...r]}function v(e,t,n,r,i){if(!e)return t!==null||!n||r?i:void 0}function y(e){return e.needsConfig&&e.configPending?`Checking task settings…`:e.needsConfig&&e.configError?`Task settings could not be loaded.`:e.providersPending?`Checking agent providers…`:e.providersError?`Provider authentication could not be verified.`:e.canContinue?void 0:e.untouched?`Connect the required workflow providers (${e.missing.join(`, `)}) to continue.`:`Connect an agent provider to continue.`}function b(){let n=e(),r=t();return{providers:n,registered:r,providersPending:n.isPending||r.isPending,providersError:n.isError||r.isError,providersReady:n.isSuccess&&r.isSuccess}}function x(e,t=null,a){let{registered:o,providersPending:s,providersError:l,providersReady:u}=b(),d=r(a),x=m(e),S=e.removedRunner!==void 0,C=x&&!e.runner||S,w=f(a),T=e.delegation?.role===`worker`,E=d.data?.defaultRunner,D=g(e,x,S,n(E,i(o.data))??E),O=(t,n)=>h(e,t,w.repoAccount,{original:D,target:n},x),{runners:k,signedOut:A}=w.runnersOn(e=>O(e,e)),j=T?D:p(t,k,D),M=k.includes(D),N=x?c(e.workflowDef,j,i(o.data)):[j],P=x&&T&&e.workflowDef?_(e,j,w):N.filter(e=>!w.readyOn(e,O(e,j))),F=u&&(!C||d.isSuccess)&&P.length===0,I=y({needsConfig:C,configPending:d.isPending,configError:d.isError,providersPending:s,providersError:l,canContinue:F,untouched:x,missing:P});return{runners:k,signedOut:A,currentRunner:D,runner:j,currentRunnerConnected:M,canContinue:F,providerPending:s||C&&d.isPending,providerError:l,reason:I,runnerOverride:v(T,t,M,S,j)}}function S(e,t){let n=l();return o({mutationFn:()=>u(e,t?.projectId),onSuccess:()=>{n.invalidateQueries({queryKey:a.runs.all}),t?.onSuccess?.()},onError:e=>s(e.message,{tone:`danger`})})}export{x as n,S as t};
1
+ import{W as e,bt as t,ft as n,g as r,gt as i,on as a,zn as o}from"./queries-CPNrCEon.js";import{a as s,bi as c,ha as l,ht as u,si as d}from"./project-scope-context-_6sNMsAf.js";import"./task-groups-Bc_WNTMe.js";import{a as f}from"./agent-accounts-BC78GKYv.js";import{V as p,mn as m,xn as h}from"./index-CIyGnGfm.js";function g(e,t,n,r){return d(e,t)?.runner??e.runner??(t||n?r:void 0)??`claude`}function _(e,t,n){let r=new Set;for(let i of e.workflowDef?.steps??[]){if(i.command!==void 0||i.kind===`plugin`)continue;let a=i.runner??t,o=i.agentProfile??(a===(e.runner??t)?e.agentProfile:void 0)??n.repoAccount?.[a];n.readyOn(a,o)||r.add(a)}return[...r]}function v(e,t,n,r,i){if(!e)return t!==null||!n||r?i:void 0}function y(e){return e.needsConfig&&e.configPending?`Checking task settings…`:e.needsConfig&&e.configError?`Task settings could not be loaded.`:e.providersPending?`Checking agent providers…`:e.providersError?`Provider authentication could not be verified.`:e.canContinue?void 0:e.untouched?`Connect the required workflow providers (${e.missing.join(`, `)}) to continue.`:`Connect an agent provider to continue.`}function b(){let n=e(),r=t();return{providers:n,registered:r,providersPending:n.isPending||r.isPending,providersError:n.isError||r.isError,providersReady:n.isSuccess&&r.isSuccess}}function x(e,t=null,a){let{registered:o,providersPending:s,providersError:l,providersReady:u}=b(),d=r(a),x=m(e),S=e.removedRunner!==void 0,C=x&&!e.runner||S,w=f(a),T=e.delegation?.role===`worker`,E=d.data?.defaultRunner,D=g(e,x,S,n(E,i(o.data))??E),O=(t,n)=>h(e,t,w.repoAccount,{original:D,target:n},x),{runners:k,signedOut:A}=w.runnersOn(e=>O(e,e)),j=T?D:p(t,k,D),M=k.includes(D),N=x?c(e.workflowDef,j,i(o.data)):[j],P=x&&T&&e.workflowDef?_(e,j,w):N.filter(e=>!w.readyOn(e,O(e,j))),F=u&&(!C||d.isSuccess)&&P.length===0,I=y({needsConfig:C,configPending:d.isPending,configError:d.isError,providersPending:s,providersError:l,canContinue:F,untouched:x,missing:P});return{runners:k,signedOut:A,currentRunner:D,runner:j,currentRunnerConnected:M,canContinue:F,providerPending:s||C&&d.isPending,providerError:l,reason:I,runnerOverride:v(T,t,M,S,j)}}function S(e,t){let n=l();return o({mutationFn:()=>u(e,t?.projectId),onSuccess:()=>{n.invalidateQueries({queryKey:a.runs.all}),t?.onSuccess?.()},onError:e=>s(e.message,{tone:`danger`})})}export{x as n,S as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ct as r,O as i,W as a,bt as o,d as s,dt as c,g as l,i as u,k as d,on as f,s as p,zn as m}from"./queries-CPNrCEon.js";import{Jn as h,R as g,X as _,Z as v,a as y,ha as b,ia as x,lt as S,r as C,tt as w}from"./project-scope-context-_6sNMsAf.js";import{o as T,s as E}from"./dist-CCX8mhHc.js";import{n as D}from"./host-storage-BHtMSWBL.js";import{A as O,Z as k,_ as A,b as j,ct as M,d as ee,ft as N,h as P,l as F,mt as I,ot as L,r as te,rt as R,u as ne,ut as re}from"./design-icons-QbNMZniQ.js";import{t as z}from"./external-link-BE6y205O.js";import{t as ie}from"./eye-B8okNWXU.js";import{t as ae}from"./loader-circle-CPBhhDbB.js";import{t as oe}from"./message-square-B-MD-8rD.js";import{t as se}from"./play-CmVAj_fu.js";import{t as B}from"./button-BV_AiLj2.js";import{i as ce,r as le,t as ue}from"./popover-BQolmvDR.js";import{a as de,i as fe,o as pe,r as me,s as he,t as ge}from"./dialog-DKr-j9S6.js";import{t as V}from"./project-router-l_pJCK5X.js";import{a as _e,i as H,o as U,r as ve,s as ye,t as be}from"./command-4D8sPZJy.js";import{d as xe,f as W,i as Se,o as Ce,p as we,s as Te,t as Ee,u as De}from"./skills-pM_PouEs.js";import{a as Oe,t as ke}from"./agent-accounts-BC78GKYv.js";import{B as Ae,Bn as je,H as Me,I as Ne,J as Pe,L as Fe,Q as Ie,R as Le,V as Re,Vn as ze,X as G,Y as Be,Z as Ve,dt as He,et as Ue,it as We,kt as K,lt as Ge,ot as Ke,rt as qe,sr as q,st as Je,ut as Ye,wr as Xe,z as Ze,zn as J}from"./index-BAXboPqe.js";import{t as Qe}from"./textarea-BGp28xFr.js";import{t as $e}from"./markdown-D7p7x8Pe.js";import{t as et}from"./diff-B6Ye5Xg9.js";import{t as Y}from"./change-counts-BLLRvt46.js";import{t as tt}from"./option-select-BvsSDWBz.js";import{t as nt}from"./tab-link-BPkGPOYd.js";var X=e(t(),1),Z=n(),rt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Q({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:T(t,`text-semantic-green`)}):e===`failing`?(0,Z.jsx)(A,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:T(t,`text-semantic-red`)}):e===`pending`?(0,Z.jsx)(ae,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:T(t,`animate-spin text-semantic-amber motion-reduce:animate-none`)}):e===`review`?(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-review`,className:T(t,`text-semantic-info`)}):e===`conflict`?(0,Z.jsx)(M,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-conflict`,className:T(t,`text-semantic-conflict`)}):(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:T(t,`text-soft-foreground`)})}function it(e){return e?.available?e.mergeState:null}function at(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function ot(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 st(e){return e===`approved`||e===`not-required`?`passing`:e===`review-required`?`review`:e===`unknown`?`unknown`:`failing`}function ct(e){switch(e){case`approved`:return`Approved`;case`not-required`:return`Not required`;case`review-required`:return`Waiting for review`;case`changes-requested`:return`Changes requested`;case`unknown`:return`Unknown`}}function lt(e){return e===`mergeable`?`passing`:e===`conflicting`?`conflict`:`unknown`}function ut(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function dt(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function ft(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function pt(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function mt(e){return e?rt[e]:`Merge`}function ht(e){return e===`conflicting`?`true`:void 0}function gt({check:e}){return(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(Q,{state:e.state}),(0,Z.jsxs)(`span`,{children:[e.name,` · `,e.state,dt(e.required)]})]}),e.url&&E(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function _t({reason:e}){return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function vt({state:e,selectedMethod:t,overrideRules:n,mergeEnabled:r,refreshPending:i,onRefresh:a,onRunAgent:o,onConfirm:s,onMethodChange:c,onOverrideChange:l}){let u=ot(e),d=st(e.reviewDecision),f=lt(e.mergeable);return(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-semantic-green`}):(0,Z.jsx)(M,{size:16,"aria-hidden":`true`,className:T(`mt-0.5 size-5 shrink-0`,e.mergeable===`conflicting`?`text-semantic-conflict`:`text-semantic-amber`)}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold`,children:u}),(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:i,onClick:a,children:[(0,Z.jsx)(k,{size:16,"aria-hidden":`true`,className:T(`size-3.5`,i&&`animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-xs text-soft-foreground`,children:[e.headRef,` (`,ze(e.headSha),`) → `,e.baseRef]}),(0,Z.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Q,{state:d}),(0,Z.jsxs)(`span`,{children:[`Reviews: `,ct(e.reviewDecision)]})]}),(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Q,{state:f}),(0,Z.jsxs)(`span`,{children:[`Conflicts: `,ut(e.mergeable)]})]}),e.checks.length===0?(0,Z.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,Z.jsx)(gt,{check:e},e.name)),e.blockers.map(e=>(0,Z.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&o?(0,Z.jsx)(B,{className:`mt-4`,onClick:o,children:`Run agent on this PR`}):null,e.canOverride?(0,Z.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-pending-strong/40 bg-pending/10 p-3 text-xs`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>l(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Z.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,Z.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,Z.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,Z.jsx)(tt,{"aria-label":`Merge method`,value:t??``,onValueChange:e=>c(e),options:e.methods.map(e=>({value:e,label:rt[e]})),className:`w-full min-w-0 flex-1 bg-background sm:w-auto`}),(0,Z.jsx)(B,{disabled:!r,onClick:s,children:mt(t)})]}):null]})]})}function yt({number:e,state:t,selectedMethod:n,confirming:r,overrideRules:i,mergePending:a,mergeError:o,onOpenChange:s,onMerge:c}){return(0,Z.jsx)(ge,{open:r,onOpenChange:s,children:(0,Z.jsxs)(me,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Z.jsxs)(pe,{children:[(0,Z.jsxs)(he,{children:[mt(n),` pull request #`,e,`?`]}),(0,Z.jsx)(fe,{asChild:!0,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),i&&t.canOverride?(0,Z.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-semantic-amber`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),o?(0,Z.jsx)(`p`,{className:`text-sm text-danger`,children:o.message}):null,(0,Z.jsxs)(de,{children:[(0,Z.jsx)(B,{variant:`outline`,disabled:a,onClick:()=>s(!1),children:`Cancel`}),(0,Z.jsx)(B,{disabled:a,onClick:c,children:a?`Merging…`:mt(n)})]})]})})}function bt({number:e,onRunAgent:t}){let n=b(),r=s(),i=x({queryKey:f.githubMergeState(e),queryFn:({signal:t})=>v(e,{},{signal:t}),retry:!1}),a=it(i.data),[o,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(!1),[d,p]=(0,X.useState)(!1),h=m({mutationFn:t=>v(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>y(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=at(o,a),_=()=>({mergeState:f.githubMergeState(e),list:f.githubPages(50),comments:f.githubComments(`pr`,e),item:f.githubItem(`pr`,e),refStatus:r===void 0?void 0:f.githubRefStatusOf(r)}),S=m({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return w(e,{method:g,expectedHeadSha:a.headSha,...d&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{u(!1),y(`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)=>{y(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,Z.jsx)(q,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":ht(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-card-edge bg-card p-4 shadow-card`,children:[(0,Z.jsx)(vt,{state:a,selectedMethod:g,overrideRules:d,mergeEnabled:pt(g,a,d),refreshPending:h.isPending,onRefresh:()=>h.mutate(f.githubMergeState(e)),onRunAgent:t,onConfirm:()=>u(!0),onMethodChange:c,onOverrideChange:p}),(0,Z.jsx)(yt,{number:e,state:a,selectedMethod:g,confirming:l,overrideRules:d,mergePending:S.isPending,mergeError:S.error,onOpenChange:u,onMerge:()=>S.mutate(_())})]}):(0,Z.jsx)(_t,{reason:ft(i.data)})}function xt(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 St(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 Ct(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 wt(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 Tt(e){return!e||!/^[0-9a-fA-F]{6}$/.test(e)?{backgroundColor:`var(--border)`}:{backgroundColor:`#${e}`}}function Et({label:e,color:t,className:n}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,title:e,style:wt(t),className:T(`rounded-full border px-1.5 py-px text-[12px] font-medium`,n),children:e})}function Dt(e){return e===`pr`?`pull request`:`issue`}function Ot(e,t,n){return e===`pr`&&!!(t||n)}function kt({backLink:e}){return e?(0,Z.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(te,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}var At=T(`text-sm`,`[&_[data-streamdown="code-block"]]:relative [&_[data-streamdown="code-block"]]:my-2.5 [&_[data-streamdown="code-block"]]:gap-0 [&_[data-streamdown="code-block"]]:overflow-hidden [&_[data-streamdown="code-block"]]:rounded-lg [&_[data-streamdown="code-block"]]:border [&_[data-streamdown="code-block"]]:border-border [&_[data-streamdown="code-block"]]:bg-background [&_[data-streamdown="code-block"]]:p-0 [&_[data-streamdown="code-block"]]:![content-visibility:visible] [&_[data-streamdown="code-block"]]:![contain-intrinsic-size:auto]`,`[&_[data-streamdown="code-block-header"]]:h-7 [&_[data-streamdown="code-block-header"]]:border-b [&_[data-streamdown="code-block-header"]]:border-border [&_[data-streamdown="code-block-header"]]:bg-muted/40 [&_[data-streamdown="code-block-header"]]:px-3 [&_[data-streamdown="code-block-header"]]:text-xs`,`[&_[data-streamdown="code-block-header"][data-language=""]]:hidden [&_[data-streamdown="code-block-header"]:not([data-language])]:hidden [&_[data-streamdown="code-block-header"]:has(>span:empty)]:hidden`,`[&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:absolute [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:top-1 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:right-1.5 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:mt-0 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:h-auto`,`[&_[data-streamdown="code-block-actions"]]:border-0 [&_[data-streamdown="code-block-actions"]]:bg-transparent [&_[data-streamdown="code-block-actions"]]:p-0 [&_[data-streamdown="code-block-actions"]]:backdrop-blur-none`,`[&_[data-streamdown="image-fallback"]]:inline-flex [&_[data-streamdown="image-fallback"]]:rounded-md [&_[data-streamdown="image-fallback"]]:border [&_[data-streamdown="image-fallback"]]:border-dashed [&_[data-streamdown="image-fallback"]]:border-border [&_[data-streamdown="image-fallback"]]:bg-muted/40 [&_[data-streamdown="image-fallback"]]:px-3 [&_[data-streamdown="image-fallback"]]:py-2 [&_[data-streamdown="image-fallback"]]:not-italic [&_[data-streamdown="image-fallback"]]:after:content-["_—_open_on_GitHub_to_view"]`,`[&_[data-streamdown="code-block-body"]]:rounded-none [&_[data-streamdown="code-block-body"]]:border-0 [&_[data-streamdown="code-block-body"]]:bg-transparent [&_[data-streamdown="code-block-body"]]:px-3.5 [&_[data-streamdown="code-block-body"]]:py-2.5 [&_[data-streamdown="code-block-body"]]:pr-10`);function jt(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function Mt({item:e,kindWord:t,commentCount:n,hasDiffStat:r,additions:i,deletions:a}){return(0,Z.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[`#`,e.number]}),`·`,(0,Z.jsx)(`span`,{children:t}),`·`,(0,Z.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Z.jsx)(J,{iso:e.createdAt,title:jt(e.createdAt)}),n?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(an,{count:n})]}):null,r?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(`span`,{"data-slot":`gh-diffstat`,children:(0,Z.jsx)(Y,{adds:i??0,dels:a??0})})]}):null,`·`,E(e.url)?(0,Z.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,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Z.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function Nt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,Z.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Z.jsx)(nt,{to:K(`prs`,t.filter,e.number,``,t.narrows),active:!n,children:`Conversation`}),(0,Z.jsx)(nt,{to:K(`prs`,t.filter,e.number,`/changes`,t.narrows),active:n,children:`Changes`})]}):(0,Z.jsx)(V,{to:K(`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 Pt({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Z.jsx)(Et,{label:e,color:t[e]},e)),n?(0,Z.jsx)(on,{checks:n,url:e.url}):null]}):null}function Ft({item:e,colors:t,body:n}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"data-slot":`gh-body`,className:T(`mt-5`,At),children:n?(0,Z.jsx)($e,{children:n}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no description)`})}),(0,Z.jsx)(Bt,{item:e,colors:t})]})}function It({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,headerAction:c,children:l}){let d=a?.changes??!1,f=Dt(e.kind),p=u(e.kind,e.number,!d).data?.detail,m=p?.body??e.body,h=p?.additions??e.additions,g=p?.deletions??e.deletions,_=Ot(e.kind,h,g),v=r??e.comments;return(0,Z.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Z.jsx)(kt,{backLink:i}),(0,Z.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,Z.jsx)(Lt,{action:c,className:`mb-4`,children:(0,Z.jsxs)(`h2`,{className:`min-w-0 text-[22px] leading-snug font-semibold tracking-tight`,children:[`#`,e.number,` `,e.title]})}):null,(0,Z.jsx)(Lt,{action:e.kind===`pr`?void 0:c,children:(0,Z.jsx)(Mt,{item:e,kindWord:f,commentCount:v,hasDiffStat:_,additions:h,deletions:g})}),e.kind===`pr`?null:(0,Z.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-semibold tracking-tight`,children:e.title}),s,(0,Z.jsx)(Nt,{item:e,subNav:a,changes:d}),(0,Z.jsx)(Pt,{item:e,colors:t,checks:n}),d&&e.kind===`pr`?(0,Z.jsx)(Rt,{item:e}):(0,Z.jsx)(Ft,{item:e,colors:t,body:m})]}),e.kind===`pr`?(0,Z.jsx)(bt,{number:e.number,onRunAgent:o}):null,l]})}function Lt({action:e,className:t,children:n}){return e?(0,Z.jsxs)(`div`,{"data-slot":`gh-header-row`,className:T(`flex flex-wrap items-center gap-x-3 gap-y-2`,t),children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:n}),(0,Z.jsx)(`div`,{"data-slot":`gh-header-action`,className:`flex shrink-0 items-center gap-2`,children:e})]}):t?(0,Z.jsx)(`div`,{className:t,children:n}):(0,Z.jsx)(Z.Fragment,{children:n})}function Rt({item:e}){let t=b(),n=p(e.number),[r,i]=(0,X.useState)(``),[a,o]=(0,X.useState)(null),s=n.data,c=e=>s?.available?s.files.filter(t=>t.path.toLowerCase().includes(e.toLowerCase())):[],l=c(r),u=l.some(e=>e.path===a)?a:l[0]?.path??null,d=l.findIndex(e=>e.path===u),m=e=>{i(e);let t=c(e),n=u??a,r=t.some(e=>e.path===n)?n:t[0]?.path??n;r!==a&&o(r)},h=async()=>{let n=s?.available?s.headSha:null,r=f.githubPrChanges(e.number),i=await _(e.number,{refresh:!0});t.setQueryData(r,i),i.available&&n&&n!==i.headSha&&(o(i.files[0]?.path??null),y(`The reviewed revision changed.`))};if(n.isPending)return(0,Z.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!s)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!s.available)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:s.reason});let g=l.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=E(e.url)?`${e.url}/files`:null,x=l.find(e=>e.path===u);return(0,Z.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Z.jsxs)(`strong`,{children:[s.files.length,` changed files`]}),(0,Z.jsx)(Y,{adds:s.additions,dels:s.deletions}),(0,Z.jsx)(je,{sha:s.headSha,variant:`inline`,prefix:`head `,className:`text-muted-foreground`}),(0,Z.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto`,onClick:()=>void h(),children:`Refresh`})]}),s.truncated?(0,Z.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-pending-strong/40 bg-pending/10 p-3 text-xs`,children:[s.reason??`This response is incomplete.`,` `,v?(0,Z.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Z.jsx)(`input`,{"aria-label":`Filter changed files`,value:r,onChange:e=>m(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,Z.jsx)(tt,{"aria-label":`Select changed file`,value:u??``,onValueChange:o,options:l.map(e=>({value:e.path,label:e.path})),className:`mt-2 w-full min-w-0 bg-background lg:hidden`,contentClassName:`max-w-[calc(100vw-2rem)]`}),(0,Z.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:l.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>o(e.path),className:T(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,u===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Z.jsx)(Y,{adds:e.additions,dels:e.deletions})]})},e.path))})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Z.jsx)(B,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,disabled:d<=0,onClick:()=>o(l[d-1]?.path??null),children:(0,Z.jsx)(Xe,{})}),(0,Z.jsx)(B,{"aria-label":`Next file`,variant:`outline`,size:`icon`,disabled:d<0||d>=l.length-1,onClick:()=>o(l[d+1]?.path??null),children:(0,Z.jsx)(ee,{size:16})})]}),l.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(et,{files:g.filter(e=>e.path===u),wrap:!0,className:`min-w-0`}),x&&!x.patch?(0,Z.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,x.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function zt(e){let t=e.filter(e=>e.kind===`review`).length,n=e.length-t,r=`${n} comment${n===1?``:`s`}`;return t===0?r:`${r} · ${t} review${t===1?``:`s`}`}function Bt({item:e,colors:t}){let n=u(e.kind,e.number),r=n.data,i=(0,X.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(Vt(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,Z.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsx)(q,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(q,{className:`h-14 w-full`}),(0,Z.jsx)(q,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.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,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-xs font-semibold tracking-wide text-muted-foreground uppercase`,children:[`Activity · `,zt(r.comments)]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Ht(i).map(e=>e.group===`commits`?(0,Z.jsx)(Ut,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(en,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Gt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.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-muted-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Vt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Ht(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 Ut({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Wt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(Gt,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Wt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(J,{iso:e[e.length-1].createdAt,className:`shrink-0`})]})})}var Wt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Gt({event:e,colors:t}){return(0,Z.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:T(`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Wt[e.kind]}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Z.jsx)(Zt,{event:e,colors:t}),(0,Z.jsx)(J,{iso:e.createdAt,className:`shrink-0`}),e.url?(0,Z.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,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Kt({event:e}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Z.jsx)(je,{sha:e.sha,variant:`inline`,className:`shrink-0 text-xs text-muted-foreground`}):null,e.message?(0,Z.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Z.jsx)(Qt,{checks:e.checks})]})}function qt({event:e,colors:t}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Z.jsx)(`span`,{"data-slot":`gh-event-label`,style:wt(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,Z.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Jt({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Yt({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Xt={committed:e=>(0,Z.jsx)(Kt,{event:e}),labeled:(e,t)=>(0,Z.jsx)(qt,{event:e,colors:t}),unlabeled:(e,t)=>(0,Z.jsx)(qt,{event:e,colors:t}),assigned:e=>(0,Z.jsx)(Jt,{event:e}),unassigned:e=>(0,Z.jsx)(Jt,{event:e}),merged:()=>(0,Z.jsx)(`span`,{children:`merged this`}),closed:()=>(0,Z.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,Z.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,Z.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,Z.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,Z.jsx)(Yt,{event:e})};function Zt({event:e,colors:t}){return Xt[e.kind]?.(e,t)??null}function Qt({checks:e}){return e?(0,Z.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:T(`shrink-0`,rn[e]),children:nn[e]}):null}var $t={approved:{label:`Approved`,tone:`border-success/40 text-semantic-green`},changes_requested:{label:`Changes requested`,tone:`border-danger/40 text-semantic-red`},commented:{label:`Commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`Dismissed`,tone:`border-border text-muted-foreground`}};function en({comment:e}){let t=e.reviewState?$t[e.reviewState]:null;return(0,Z.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(tn,{url:e.avatarUrl,login:e.author}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Z.jsx)(J,{iso:e.createdAt}),t?(0,Z.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:T(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,Z.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,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Z.jsx)(`div`,{"data-slot":`gh-thread-body`,className:At,children:e.body?(0,Z.jsx)($e,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no body)`})})]})}function tn({url:e,login:t}){let[n,r]=(0,X.useState)(!1);return e&&!n?(0,Z.jsx)(`img`,{src:e,alt:``,width:20,height:20,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-5 shrink-0 rounded-full`}):(0,Z.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var nn={passing:`✓`,failing:`✗`,pending:`○`},rn={passing:`text-semantic-green`,failing:`text-semantic-red`,pending:`text-semantic-amber`},$={passing:`Checks passing`,failing:`Checks failing`,pending:`Checks pending`};function an({count:e}){return e?(0,Z.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,Z.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function on({checks:e,url:t}){let n=T(`text-xs font-medium`,rn[e],t&&`hover:underline`),r=`${nn[e]} ${$[e]}`;return t?(0,Z.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Z.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function sn({checks:e}){return(0,Z.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:$[e],"aria-label":$[e],className:T(`shrink-0 font-sans text-xs font-semibold`,rn[e]),children:nn[e]})}function cn(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function ln(e,t=[]){let n=cn(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=un(t)),n}function un(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function dn(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 fn(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 pn(e,t,n){let r=(n??``).trim();if(!r)return ln(e,t);let i=cn(e),a=r.startsWith(i)?i+dn(r.slice(i.length),e):dn(r,e),o=fn(a,e)?a:`${i}\n\n${a}`;return t.length?o+un(t):o}function mn(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 hn(e,t,n,r,i={}){return t?{...i,workflow:t,task:pn(e,n.map(e=>e.id),r)}:n.length?{...i,steps:mn(n.map(e=>e.id)).map((e,t)=>({...e,...n[t]?.path===void 0?{}:{skillPath:n[t].path}})),task:pn(e,[],r)}:{...i,workflow:`quick-task`,task:pn(e,[],r)}}function gn(e){let t=a(),n=l(),i=o(),{runners:s,uninstalled:c,signedOut:u,accounts:d,repoAccount:f,accountFor:p}=Oe(),m=n.data?.defaultRunner,h=Re(e.runner,s,m??s[0]??`claude`),g=n.data?.modelsLocked===!0,_=p(h,e.account),v=r(h,!0,_??f?.[h]),y=Ae(g?null:e.model,h,i.data,n.data?.defaultModels,v.data),b=Fe(y,v.data);return{runner:h,runnerExplicit:e.runner!==null,model:y,effort:g?``:Ze(e.effort,b),effortOptions:b,runners:s,uninstalled:c,signedOut:u,defaultRunner:m,canRun:t.isSuccess&&s.length>0,modelsLocked:g,providerPending:t.isPending,providerError:t.isError,accounts:d,account:_,repoAccount:f}}function _n(e){return{runner:Me(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 vn(e){return{..._n(e),...e.account?{agentProfile:e.account}:{}}}function yn(e,t){return e.find(e=>e.id===t)?.label??(t===``?`Runner default`:t)}function bn(e,t){let{runners:n,uninstalled:r,signedOut:i}=e;return n.length>1||r.length>0||i.length>0||n.some(e=>ke(t,e))}function xn({pick:e,onChange:t,disabled:n=!1,accounts:i=!1,layout:a}){let s=(0,X.useRef)(null),c=(0,X.useRef)(null),[u,d]=(0,X.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,X.useLayoutEffect)(()=>{let e=s.current;if(a!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;c.current=n instanceof HTMLElement&&e.contains(n)?n:null,d(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)}},[a]),(0,X.useLayoutEffect)(()=>{let e=c.current;c.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[u]);let f=gn(e),{runner:p,model:m,effort:h,effortOptions:g,runners:_,canRun:v,modelsLocked:y}=f,b=l(),x=o(),S=r(p,!0,f.account??f.repoAccount?.[p]),C=Le(p,x.data,S.data,[e.model,b.data?.defaultModels?.[p]]),w=n||!v,T=i?f.accounts:[],E=bn(f,T)?(0,Z.jsx)(Ie,{icon:(0,Z.jsx)(L,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:_,uninstalled:f.uninstalled,signedOut:f.signedOut,value:p,accounts:T,account:i?f.account:null,repoAccount:i?f.repoAccount:void 0,disabled:w,onPick:(n,r)=>t(i?{runner:n,account:r,model:n===p?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,D=(0,Z.jsx)(G,{icon:(0,Z.jsx)(j,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:yn(C,m),value:m,disabled:w,readOnly:y===!0,disabledHint:y?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Fe(n,S.data);t({...e,model:n,effort:e.effort===null?null:Ze(e.effort,r)})},options:C.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Ne(p,x.data,S)},`model`),k=(0,Z.jsx)(G,{icon:(0,Z.jsx)(O,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:g.find(e=>e.value===h)?.label??`Runner default`,value:h,disabled:w,readOnly:y===!0,disabledHint:y?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:g.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return a===`row`?(0,Z.jsx)(`div`,{ref:s,"data-slot":`engine-row-box`,children:(0,Z.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,Z.jsx)(Ve,{fill:`model-pill`,children:u?[E,k,D]:[E,D,k]})})}):(0,Z.jsxs)(Ve,{children:[E,D,k]})}var Sn={workflow:null,skills:[]},Cn=`cez-followup-selection`;function wn(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 Tn(){try{let e=localStorage.getItem(D(Cn));return e?wn(JSON.parse(e)):{...Sn}}catch{return{...Sn}}}function En(e){try{localStorage.setItem(D(Cn),JSON.stringify(e))}catch{}}var Dn=`cez-followup-prompt:`;function On(e){try{return localStorage.getItem(D(Dn+e))??``}catch{return``}}function kn(e,t){try{let n=D(Dn+e);t===``?localStorage.removeItem(n):localStorage.setItem(n,t)}catch{}}function An({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:a,selectedSkills:o,onSkillsChange:s,engine:l,onEngineChange:u,queuedRunId:d,onQueued:p}){let h=b(),_=i(),v=e.kind===`pr`?`PR`:`issue`,x=gn(l),C=c(x.runner,x.account),w=o.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!==o.length,[D]=(0,X.useState)(()=>cn(e)),[O,k]=(0,X.useState)(()=>On(e.url)||D),A=(0,X.useRef)(null),j=(0,X.useRef)(null);(0,X.useEffect)(()=>{kn(e.url,O===D?``:O)},[e.url,O,D]);let M=(0,X.useMemo)(()=>Ge(_.data?.promptTemplates),[_.data?.promptTemplates]),ee=e=>{let t=A.current,n=He({prompt:O,base:D,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:j.current}),r=Je(O,n,e);k(r.text),j.current=r.caret,requestAnimationFrame(()=>{A.current?.focus(),A.current?.setSelectionRange(r.caret,r.caret)})},N=Ke(M,w.map(e=>e.id)),P=(0,X.useRef)(O);P.current=O;let I=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=Ye(P.current,I.current,N,D);I.current=e.applied,e.text!==P.current&&k(e.text)},[N,D]);let L=m({mutationFn:async()=>!x.canRun||T?null:S(hn(e,r,w,O,vn(x))),onSuccess:t=>{if(t===null)return;let n=t;n&&p(e.url,n.id),y(`Added to the queue — ${v} #${e.number}`),w.length>0&&_.data!==void 0&&g({skillUsage:w.reduce((e,t)=>Ee(e,t.id),_.data.skillUsage)}).then(()=>h.invalidateQueries({queryKey:f.uiState})).catch(()=>{}),kn(e.url,``),k(D),I.current=``,h.invalidateQueries({queryKey:f.runs.all})},onError:e=>y(e.message,{tone:`danger`})}),te=e=>{qe(e)&&(e.preventDefault(),!L.isPending&&x.canRun&&L.mutate())},R=e=>s(o.some(t=>W(t)===W(e))?o.filter(t=>W(t)!==W(e)):[...o,Te(e)]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Z.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Z.jsx)(`span`,{children:`Instructions for the agent`}),(0,Z.jsx)(Qe,{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,Z.jsx)(Be,{templates:M,onInsert:ee}),(0,Z.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Workflow`}),(0,Z.jsx)(Mn,{workflows:t,value:r,onChange:a})]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Skills · select one or more`}),(0,Z.jsx)(Pn,{skills:n,skillUsage:_.data?.skillUsage,selected:o,onToggle:R})]}),o.length>0?(0,Z.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:o.map(e=>(0,Z.jsx)(jn,{skill:e,skills:n,unchecked:C.unchecked,onRemove:()=>R(e)},W(e)))}):null,T?(0,Z.jsx)(`p`,{role:`alert`,children:`A selected skill path is unavailable. Remove it or choose a current copy before starting.`}):null,(0,Z.jsx)(xn,{layout:`row`,pick:l,onChange:u,disabled:L.isPending||!x.canRun,accounts:!0}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Account`}),(0,Z.jsx)(Nn,{resolved:x,disabled:L.isPending||!x.canRun,onPick:e=>u({...l,account:e})})]}),!x.providerPending&&!x.canRun?(0,Z.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[x.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Z.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Z.jsxs)(`p`,{className:`text-xs 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,Z.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[E(e.url)?(0,Z.jsx)(B,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Z.jsxs)(B,{variant:`primary`,"data-action":`gh-run`,disabled:L.isPending||!x.canRun||T,onClick:()=>L.mutate(),children:[(0,Z.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,v]}),(0,Z.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-xs font-medium text-muted-foreground`,children:We()}),d?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Z.jsx)(V,{to:`/tasks/${d}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function jn({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,Z.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,Z.jsx)(I,{size:16,"aria-hidden":`true`,className:`size-3`})]})}function Mn({workflows:e,value:t,onChange:n}){let[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(``),s=(0,X.useRef)(null),c=xe(e,a);return(0,Z.jsxs)(ue,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:T(Ue,t&&`border-foreground/60 font-mono text-xs font-semibold text-foreground`),children:[(0,Z.jsx)(N,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Z.jsx)(ne,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(le,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(be,{shouldFilter:!1,children:[(0,Z.jsx)(_e,{placeholder:`Search workflows…`,value:a,onValueChange:o,onInput:()=>s.current?.scrollTo(0,0)}),(0,Z.jsxs)(ye,{ref:s,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,Z.jsx)(ve,{children:`Nothing matches.`}):null,(0,Z.jsx)(H,{children:c.map(e=>{let r=t===e.name;return(0,Z.jsxs)(U,{value:`workflow ${e.name}`,keywords:we(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),i(!1)},children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function Nn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:h,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,...e.configDir?{desc:e.configDir}:{}}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Z.jsx)(G,{icon:(0,Z.jsx)(re,{"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 Pn({skills:e,skillUsage:t,selected:n,onToggle:r}){let[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(null),u=(0,X.useRef)(null),{mostUsed:d,project:f,global:p,ranked:m}=De(e,o,t),h=(e,t)=>{let i=n.some(t=>W(t)===W(e));return(0,Z.jsxs)(U,{value:W(e),keywords:we(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.id,"data-selected":i?`true`:void 0,onSelect:()=>r(Te(e)),children:[(0,Z.jsx)(`span`,{className:T(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.path?(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Z.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),l(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Z.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5`})}),i?(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},W(e))};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Pe,{skill:c,onClose:()=>l(null)}),(0,Z.jsxs)(ue,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:T(Ue,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Z.jsx)(R,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Z.jsx)(ne,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(le,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(be,{shouldFilter:!1,children:[(0,Z.jsx)(_e,{placeholder:`Search skills…`,value:o,onValueChange:s,onInput:()=>u.current?.scrollTo(0,0)}),(0,Z.jsxs)(ye,{ref:u,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[o.trim()&&!e.some(e=>e.id===o.trim())?(0,Z.jsx)(H,{children:(0,Z.jsxs)(U,{value:`typed-skill`,onSelect:()=>r({id:o.trim()}),children:[`Use skill id “`,o.trim(),`” (unchecked)`]})}):null,(m?m.length===0:d.length===0&&f.length===0&&p.length===0)?(0,Z.jsx)(ve,{children:`Nothing matches.`}):null,m?m.length>0?(0,Z.jsx)(H,{children:m.map(e=>h(e,Se(e)))}):null:(0,Z.jsxs)(Z.Fragment,{children:[d.length>0?(0,Z.jsx)(H,{heading:`Most used`,children:d.map(e=>h(e,Se(e)))}):null,f.length>0?(0,Z.jsx)(H,{heading:`Project skills`,children:f.map(e=>h(e,!0))}):null,p.length>0?(0,Z.jsx)(H,{heading:`Global`,children:p.map(e=>h(e,!1))}):null]})]})]})})]})]})}var Fn=new WeakMap;function In(){let e=Tn(),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)&&En({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function Ln(){let e=b(),{projectId:t}=C(),n=Fn.get(e);n||Fn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=In());let{snapshot:a,subscribe:o,update:s}=r,l=(0,X.useSyncExternalStore)(o,a,a),u=d(),f=gn(l.engine),p=c(f.runner,f.account),m=i(),h=u.data?.workflows;(0,X.useEffect)(()=>{h&&l.workflow!==null&&!h.some(e=>e.name===l.workflow)&&s({workflow:null})},[s,h,l.workflow]);let g=(0,X.useMemo)(()=>Ce(p.data??[],m.data?.skillUsage),[p.data,m.data?.skillUsage]);return{...l,workflows:u,skillList:g,skillsUnchecked:p.unchecked,setWorkflow:e=>s({workflow:e}),setSelectedSkills:e=>s({selectedSkills:e}),setEngine:e=>s({engine:e}),onQueued:(e,t)=>s({queued:new Map(a().queued).set(e,t)})}}export{on as a,kt as c,Ht as d,xt as f,Ct as h,tn as i,It as l,Tt as m,An as n,sn as o,St as p,ln as r,an as s,Ln as t,Et as u};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ct as r,O as i,W as a,bt as o,d as s,dt as c,g as l,i as u,k as d,on as f,s as p,zn as m}from"./queries-CPNrCEon.js";import{Jn as h,R as g,X as _,Z as v,a as y,ha as b,ia as x,lt as S,r as C,tt as w}from"./project-scope-context-_6sNMsAf.js";import{o as T,s as E}from"./dist-CCX8mhHc.js";import{n as D}from"./host-storage-BHtMSWBL.js";import{A as O,Z as k,_ as A,b as j,ct as M,d as ee,ft as N,h as P,l as F,mt as I,ot as L,r as te,rt as R,u as ne,ut as re}from"./design-icons-QbNMZniQ.js";import{t as z}from"./external-link-BE6y205O.js";import{t as ie}from"./eye-B8okNWXU.js";import{t as ae}from"./loader-circle-CPBhhDbB.js";import{t as oe}from"./message-square-B-MD-8rD.js";import{t as se}from"./play-CmVAj_fu.js";import{t as B}from"./button-BV_AiLj2.js";import{i as ce,r as le,t as ue}from"./popover-BQolmvDR.js";import{a as de,i as fe,o as pe,r as me,s as he,t as ge}from"./dialog-DKr-j9S6.js";import{t as V}from"./project-router-l_pJCK5X.js";import{a as _e,i as H,o as U,r as ve,s as ye,t as be}from"./command-4D8sPZJy.js";import{d as xe,f as W,i as Se,o as Ce,p as we,s as Te,t as Ee,u as De}from"./skills-pM_PouEs.js";import{a as Oe,t as ke}from"./agent-accounts-BC78GKYv.js";import{B as Ae,Bn as je,H as Me,I as Ne,J as Pe,L as Fe,Q as Ie,R as Le,V as Re,Vn as ze,X as G,Y as Be,Z as Ve,dt as He,et as Ue,it as We,kt as K,lt as Ge,ot as Ke,rt as qe,sr as q,st as Je,ut as Ye,wr as Xe,z as Ze,zn as J}from"./index-CIyGnGfm.js";import{t as Qe}from"./textarea-BGp28xFr.js";import{t as $e}from"./markdown-DnBvknF9.js";import{t as et}from"./diff-BQIvq2Ar.js";import{t as Y}from"./change-counts-BLLRvt46.js";import{t as tt}from"./option-select-HC8juekO.js";import{t as nt}from"./tab-link-BPkGPOYd.js";var X=e(t(),1),Z=n(),rt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Q({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:T(t,`text-semantic-green`)}):e===`failing`?(0,Z.jsx)(A,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:T(t,`text-semantic-red`)}):e===`pending`?(0,Z.jsx)(ae,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:T(t,`animate-spin text-semantic-amber motion-reduce:animate-none`)}):e===`review`?(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-review`,className:T(t,`text-semantic-info`)}):e===`conflict`?(0,Z.jsx)(M,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-conflict`,className:T(t,`text-semantic-conflict`)}):(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:T(t,`text-soft-foreground`)})}function it(e){return e?.available?e.mergeState:null}function at(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function ot(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 st(e){return e===`approved`||e===`not-required`?`passing`:e===`review-required`?`review`:e===`unknown`?`unknown`:`failing`}function ct(e){switch(e){case`approved`:return`Approved`;case`not-required`:return`Not required`;case`review-required`:return`Waiting for review`;case`changes-requested`:return`Changes requested`;case`unknown`:return`Unknown`}}function lt(e){return e===`mergeable`?`passing`:e===`conflicting`?`conflict`:`unknown`}function ut(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function dt(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function ft(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function pt(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function mt(e){return e?rt[e]:`Merge`}function ht(e){return e===`conflicting`?`true`:void 0}function gt({check:e}){return(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(Q,{state:e.state}),(0,Z.jsxs)(`span`,{children:[e.name,` · `,e.state,dt(e.required)]})]}),e.url&&E(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function _t({reason:e}){return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function vt({state:e,selectedMethod:t,overrideRules:n,mergeEnabled:r,refreshPending:i,onRefresh:a,onRunAgent:o,onConfirm:s,onMethodChange:c,onOverrideChange:l}){let u=ot(e),d=st(e.reviewDecision),f=lt(e.mergeable);return(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-semantic-green`}):(0,Z.jsx)(M,{size:16,"aria-hidden":`true`,className:T(`mt-0.5 size-5 shrink-0`,e.mergeable===`conflicting`?`text-semantic-conflict`:`text-semantic-amber`)}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold`,children:u}),(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:i,onClick:a,children:[(0,Z.jsx)(k,{size:16,"aria-hidden":`true`,className:T(`size-3.5`,i&&`animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-xs text-soft-foreground`,children:[e.headRef,` (`,ze(e.headSha),`) → `,e.baseRef]}),(0,Z.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Q,{state:d}),(0,Z.jsxs)(`span`,{children:[`Reviews: `,ct(e.reviewDecision)]})]}),(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Q,{state:f}),(0,Z.jsxs)(`span`,{children:[`Conflicts: `,ut(e.mergeable)]})]}),e.checks.length===0?(0,Z.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,Z.jsx)(gt,{check:e},e.name)),e.blockers.map(e=>(0,Z.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&o?(0,Z.jsx)(B,{className:`mt-4`,onClick:o,children:`Run agent on this PR`}):null,e.canOverride?(0,Z.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-pending-strong/40 bg-pending/10 p-3 text-xs`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>l(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Z.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,Z.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,Z.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,Z.jsx)(tt,{"aria-label":`Merge method`,value:t??``,onValueChange:e=>c(e),options:e.methods.map(e=>({value:e,label:rt[e]})),className:`w-full min-w-0 flex-1 bg-background sm:w-auto`}),(0,Z.jsx)(B,{disabled:!r,onClick:s,children:mt(t)})]}):null]})]})}function yt({number:e,state:t,selectedMethod:n,confirming:r,overrideRules:i,mergePending:a,mergeError:o,onOpenChange:s,onMerge:c}){return(0,Z.jsx)(ge,{open:r,onOpenChange:s,children:(0,Z.jsxs)(me,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Z.jsxs)(pe,{children:[(0,Z.jsxs)(he,{children:[mt(n),` pull request #`,e,`?`]}),(0,Z.jsx)(fe,{asChild:!0,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),i&&t.canOverride?(0,Z.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-semantic-amber`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),o?(0,Z.jsx)(`p`,{className:`text-sm text-danger`,children:o.message}):null,(0,Z.jsxs)(de,{children:[(0,Z.jsx)(B,{variant:`outline`,disabled:a,onClick:()=>s(!1),children:`Cancel`}),(0,Z.jsx)(B,{disabled:a,onClick:c,children:a?`Merging…`:mt(n)})]})]})})}function bt({number:e,onRunAgent:t}){let n=b(),r=s(),i=x({queryKey:f.githubMergeState(e),queryFn:({signal:t})=>v(e,{},{signal:t}),retry:!1}),a=it(i.data),[o,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(!1),[d,p]=(0,X.useState)(!1),h=m({mutationFn:t=>v(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>y(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=at(o,a),_=()=>({mergeState:f.githubMergeState(e),list:f.githubPages(50),comments:f.githubComments(`pr`,e),item:f.githubItem(`pr`,e),refStatus:r===void 0?void 0:f.githubRefStatusOf(r)}),S=m({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return w(e,{method:g,expectedHeadSha:a.headSha,...d&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{u(!1),y(`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)=>{y(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,Z.jsx)(q,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":ht(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-card-edge bg-card p-4 shadow-card`,children:[(0,Z.jsx)(vt,{state:a,selectedMethod:g,overrideRules:d,mergeEnabled:pt(g,a,d),refreshPending:h.isPending,onRefresh:()=>h.mutate(f.githubMergeState(e)),onRunAgent:t,onConfirm:()=>u(!0),onMethodChange:c,onOverrideChange:p}),(0,Z.jsx)(yt,{number:e,state:a,selectedMethod:g,confirming:l,overrideRules:d,mergePending:S.isPending,mergeError:S.error,onOpenChange:u,onMerge:()=>S.mutate(_())})]}):(0,Z.jsx)(_t,{reason:ft(i.data)})}function xt(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 St(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 Ct(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 wt(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 Tt(e){return!e||!/^[0-9a-fA-F]{6}$/.test(e)?{backgroundColor:`var(--border)`}:{backgroundColor:`#${e}`}}function Et({label:e,color:t,className:n}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,title:e,style:wt(t),className:T(`rounded-full border px-1.5 py-px text-[12px] font-medium`,n),children:e})}function Dt(e){return e===`pr`?`pull request`:`issue`}function Ot(e,t,n){return e===`pr`&&!!(t||n)}function kt({backLink:e}){return e?(0,Z.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(te,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}var At=T(`text-sm`,`[&_[data-streamdown="code-block"]]:relative [&_[data-streamdown="code-block"]]:my-2.5 [&_[data-streamdown="code-block"]]:gap-0 [&_[data-streamdown="code-block"]]:overflow-hidden [&_[data-streamdown="code-block"]]:rounded-lg [&_[data-streamdown="code-block"]]:border [&_[data-streamdown="code-block"]]:border-border [&_[data-streamdown="code-block"]]:bg-background [&_[data-streamdown="code-block"]]:p-0 [&_[data-streamdown="code-block"]]:![content-visibility:visible] [&_[data-streamdown="code-block"]]:![contain-intrinsic-size:auto]`,`[&_[data-streamdown="code-block-header"]]:h-7 [&_[data-streamdown="code-block-header"]]:border-b [&_[data-streamdown="code-block-header"]]:border-border [&_[data-streamdown="code-block-header"]]:bg-muted/40 [&_[data-streamdown="code-block-header"]]:px-3 [&_[data-streamdown="code-block-header"]]:text-xs`,`[&_[data-streamdown="code-block-header"][data-language=""]]:hidden [&_[data-streamdown="code-block-header"]:not([data-language])]:hidden [&_[data-streamdown="code-block-header"]:has(>span:empty)]:hidden`,`[&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:absolute [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:top-1 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:right-1.5 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:mt-0 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:h-auto`,`[&_[data-streamdown="code-block-actions"]]:border-0 [&_[data-streamdown="code-block-actions"]]:bg-transparent [&_[data-streamdown="code-block-actions"]]:p-0 [&_[data-streamdown="code-block-actions"]]:backdrop-blur-none`,`[&_[data-streamdown="image-fallback"]]:inline-flex [&_[data-streamdown="image-fallback"]]:rounded-md [&_[data-streamdown="image-fallback"]]:border [&_[data-streamdown="image-fallback"]]:border-dashed [&_[data-streamdown="image-fallback"]]:border-border [&_[data-streamdown="image-fallback"]]:bg-muted/40 [&_[data-streamdown="image-fallback"]]:px-3 [&_[data-streamdown="image-fallback"]]:py-2 [&_[data-streamdown="image-fallback"]]:not-italic [&_[data-streamdown="image-fallback"]]:after:content-["_—_open_on_GitHub_to_view"]`,`[&_[data-streamdown="code-block-body"]]:rounded-none [&_[data-streamdown="code-block-body"]]:border-0 [&_[data-streamdown="code-block-body"]]:bg-transparent [&_[data-streamdown="code-block-body"]]:px-3.5 [&_[data-streamdown="code-block-body"]]:py-2.5 [&_[data-streamdown="code-block-body"]]:pr-10`);function jt(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function Mt({item:e,kindWord:t,commentCount:n,hasDiffStat:r,additions:i,deletions:a}){return(0,Z.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[`#`,e.number]}),`·`,(0,Z.jsx)(`span`,{children:t}),`·`,(0,Z.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Z.jsx)(J,{iso:e.createdAt,title:jt(e.createdAt)}),n?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(an,{count:n})]}):null,r?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(`span`,{"data-slot":`gh-diffstat`,children:(0,Z.jsx)(Y,{adds:i??0,dels:a??0})})]}):null,`·`,E(e.url)?(0,Z.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,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Z.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function Nt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,Z.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Z.jsx)(nt,{to:K(`prs`,t.filter,e.number,``,t.narrows),active:!n,children:`Conversation`}),(0,Z.jsx)(nt,{to:K(`prs`,t.filter,e.number,`/changes`,t.narrows),active:n,children:`Changes`})]}):(0,Z.jsx)(V,{to:K(`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 Pt({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Z.jsx)(Et,{label:e,color:t[e]},e)),n?(0,Z.jsx)(on,{checks:n,url:e.url}):null]}):null}function Ft({item:e,colors:t,body:n}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"data-slot":`gh-body`,className:T(`mt-5`,At),children:n?(0,Z.jsx)($e,{children:n}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no description)`})}),(0,Z.jsx)(Bt,{item:e,colors:t})]})}function It({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,headerAction:c,children:l}){let d=a?.changes??!1,f=Dt(e.kind),p=u(e.kind,e.number,!d).data?.detail,m=p?.body??e.body,h=p?.additions??e.additions,g=p?.deletions??e.deletions,_=Ot(e.kind,h,g),v=r??e.comments;return(0,Z.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Z.jsx)(kt,{backLink:i}),(0,Z.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,Z.jsx)(Lt,{action:c,className:`mb-4`,children:(0,Z.jsxs)(`h2`,{className:`min-w-0 text-[22px] leading-snug font-semibold tracking-tight`,children:[`#`,e.number,` `,e.title]})}):null,(0,Z.jsx)(Lt,{action:e.kind===`pr`?void 0:c,children:(0,Z.jsx)(Mt,{item:e,kindWord:f,commentCount:v,hasDiffStat:_,additions:h,deletions:g})}),e.kind===`pr`?null:(0,Z.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-semibold tracking-tight`,children:e.title}),s,(0,Z.jsx)(Nt,{item:e,subNav:a,changes:d}),(0,Z.jsx)(Pt,{item:e,colors:t,checks:n}),d&&e.kind===`pr`?(0,Z.jsx)(Rt,{item:e}):(0,Z.jsx)(Ft,{item:e,colors:t,body:m})]}),e.kind===`pr`?(0,Z.jsx)(bt,{number:e.number,onRunAgent:o}):null,l]})}function Lt({action:e,className:t,children:n}){return e?(0,Z.jsxs)(`div`,{"data-slot":`gh-header-row`,className:T(`flex flex-wrap items-center gap-x-3 gap-y-2`,t),children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:n}),(0,Z.jsx)(`div`,{"data-slot":`gh-header-action`,className:`flex shrink-0 items-center gap-2`,children:e})]}):t?(0,Z.jsx)(`div`,{className:t,children:n}):(0,Z.jsx)(Z.Fragment,{children:n})}function Rt({item:e}){let t=b(),n=p(e.number),[r,i]=(0,X.useState)(``),[a,o]=(0,X.useState)(null),s=n.data,c=e=>s?.available?s.files.filter(t=>t.path.toLowerCase().includes(e.toLowerCase())):[],l=c(r),u=l.some(e=>e.path===a)?a:l[0]?.path??null,d=l.findIndex(e=>e.path===u),m=e=>{i(e);let t=c(e),n=u??a,r=t.some(e=>e.path===n)?n:t[0]?.path??n;r!==a&&o(r)},h=async()=>{let n=s?.available?s.headSha:null,r=f.githubPrChanges(e.number),i=await _(e.number,{refresh:!0});t.setQueryData(r,i),i.available&&n&&n!==i.headSha&&(o(i.files[0]?.path??null),y(`The reviewed revision changed.`))};if(n.isPending)return(0,Z.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!s)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!s.available)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:s.reason});let g=l.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=E(e.url)?`${e.url}/files`:null,x=l.find(e=>e.path===u);return(0,Z.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Z.jsxs)(`strong`,{children:[s.files.length,` changed files`]}),(0,Z.jsx)(Y,{adds:s.additions,dels:s.deletions}),(0,Z.jsx)(je,{sha:s.headSha,variant:`inline`,prefix:`head `,className:`text-muted-foreground`}),(0,Z.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto`,onClick:()=>void h(),children:`Refresh`})]}),s.truncated?(0,Z.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-pending-strong/40 bg-pending/10 p-3 text-xs`,children:[s.reason??`This response is incomplete.`,` `,v?(0,Z.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Z.jsx)(`input`,{"aria-label":`Filter changed files`,value:r,onChange:e=>m(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,Z.jsx)(tt,{"aria-label":`Select changed file`,value:u??``,onValueChange:o,options:l.map(e=>({value:e.path,label:e.path})),className:`mt-2 w-full min-w-0 bg-background lg:hidden`,contentClassName:`max-w-[calc(100vw-2rem)]`}),(0,Z.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:l.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>o(e.path),className:T(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,u===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Z.jsx)(Y,{adds:e.additions,dels:e.deletions})]})},e.path))})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Z.jsx)(B,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,disabled:d<=0,onClick:()=>o(l[d-1]?.path??null),children:(0,Z.jsx)(Xe,{})}),(0,Z.jsx)(B,{"aria-label":`Next file`,variant:`outline`,size:`icon`,disabled:d<0||d>=l.length-1,onClick:()=>o(l[d+1]?.path??null),children:(0,Z.jsx)(ee,{size:16})})]}),l.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(et,{files:g.filter(e=>e.path===u),wrap:!0,className:`min-w-0`}),x&&!x.patch?(0,Z.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,x.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function zt(e){let t=e.filter(e=>e.kind===`review`).length,n=e.length-t,r=`${n} comment${n===1?``:`s`}`;return t===0?r:`${r} · ${t} review${t===1?``:`s`}`}function Bt({item:e,colors:t}){let n=u(e.kind,e.number),r=n.data,i=(0,X.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(Vt(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,Z.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsx)(q,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(q,{className:`h-14 w-full`}),(0,Z.jsx)(q,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.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,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-xs font-semibold tracking-wide text-muted-foreground uppercase`,children:[`Activity · `,zt(r.comments)]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Ht(i).map(e=>e.group===`commits`?(0,Z.jsx)(Ut,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(en,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Gt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.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-muted-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Vt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Ht(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 Ut({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Wt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(Gt,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Wt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(J,{iso:e[e.length-1].createdAt,className:`shrink-0`})]})})}var Wt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Gt({event:e,colors:t}){return(0,Z.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:T(`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Wt[e.kind]}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Z.jsx)(Zt,{event:e,colors:t}),(0,Z.jsx)(J,{iso:e.createdAt,className:`shrink-0`}),e.url?(0,Z.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,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Kt({event:e}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Z.jsx)(je,{sha:e.sha,variant:`inline`,className:`shrink-0 text-xs text-muted-foreground`}):null,e.message?(0,Z.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Z.jsx)(Qt,{checks:e.checks})]})}function qt({event:e,colors:t}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Z.jsx)(`span`,{"data-slot":`gh-event-label`,style:wt(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,Z.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Jt({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Yt({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Xt={committed:e=>(0,Z.jsx)(Kt,{event:e}),labeled:(e,t)=>(0,Z.jsx)(qt,{event:e,colors:t}),unlabeled:(e,t)=>(0,Z.jsx)(qt,{event:e,colors:t}),assigned:e=>(0,Z.jsx)(Jt,{event:e}),unassigned:e=>(0,Z.jsx)(Jt,{event:e}),merged:()=>(0,Z.jsx)(`span`,{children:`merged this`}),closed:()=>(0,Z.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,Z.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,Z.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,Z.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,Z.jsx)(Yt,{event:e})};function Zt({event:e,colors:t}){return Xt[e.kind]?.(e,t)??null}function Qt({checks:e}){return e?(0,Z.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:T(`shrink-0`,rn[e]),children:nn[e]}):null}var $t={approved:{label:`Approved`,tone:`border-success/40 text-semantic-green`},changes_requested:{label:`Changes requested`,tone:`border-danger/40 text-semantic-red`},commented:{label:`Commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`Dismissed`,tone:`border-border text-muted-foreground`}};function en({comment:e}){let t=e.reviewState?$t[e.reviewState]:null;return(0,Z.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(tn,{url:e.avatarUrl,login:e.author}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Z.jsx)(J,{iso:e.createdAt}),t?(0,Z.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:T(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,Z.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,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Z.jsx)(`div`,{"data-slot":`gh-thread-body`,className:At,children:e.body?(0,Z.jsx)($e,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no body)`})})]})}function tn({url:e,login:t}){let[n,r]=(0,X.useState)(!1);return e&&!n?(0,Z.jsx)(`img`,{src:e,alt:``,width:20,height:20,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-5 shrink-0 rounded-full`}):(0,Z.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var nn={passing:`✓`,failing:`✗`,pending:`○`},rn={passing:`text-semantic-green`,failing:`text-semantic-red`,pending:`text-semantic-amber`},$={passing:`Checks passing`,failing:`Checks failing`,pending:`Checks pending`};function an({count:e}){return e?(0,Z.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,Z.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function on({checks:e,url:t}){let n=T(`text-xs font-medium`,rn[e],t&&`hover:underline`),r=`${nn[e]} ${$[e]}`;return t?(0,Z.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Z.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function sn({checks:e}){return(0,Z.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:$[e],"aria-label":$[e],className:T(`shrink-0 font-sans text-xs font-semibold`,rn[e]),children:nn[e]})}function cn(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function ln(e,t=[]){let n=cn(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=un(t)),n}function un(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function dn(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 fn(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 pn(e,t,n){let r=(n??``).trim();if(!r)return ln(e,t);let i=cn(e),a=r.startsWith(i)?i+dn(r.slice(i.length),e):dn(r,e),o=fn(a,e)?a:`${i}\n\n${a}`;return t.length?o+un(t):o}function mn(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 hn(e,t,n,r,i={}){return t?{...i,workflow:t,task:pn(e,n.map(e=>e.id),r)}:n.length?{...i,steps:mn(n.map(e=>e.id)).map((e,t)=>({...e,...n[t]?.path===void 0?{}:{skillPath:n[t].path}})),task:pn(e,[],r)}:{...i,workflow:`quick-task`,task:pn(e,[],r)}}function gn(e){let t=a(),n=l(),i=o(),{runners:s,uninstalled:c,signedOut:u,accounts:d,repoAccount:f,accountFor:p}=Oe(),m=n.data?.defaultRunner,h=Re(e.runner,s,m??s[0]??`claude`),g=n.data?.modelsLocked===!0,_=p(h,e.account),v=r(h,!0,_??f?.[h]),y=Ae(g?null:e.model,h,i.data,n.data?.defaultModels,v.data),b=Fe(y,v.data);return{runner:h,runnerExplicit:e.runner!==null,model:y,effort:g?``:Ze(e.effort,b),effortOptions:b,runners:s,uninstalled:c,signedOut:u,defaultRunner:m,canRun:t.isSuccess&&s.length>0,modelsLocked:g,providerPending:t.isPending,providerError:t.isError,accounts:d,account:_,repoAccount:f}}function _n(e){return{runner:Me(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 vn(e){return{..._n(e),...e.account?{agentProfile:e.account}:{}}}function yn(e,t){return e.find(e=>e.id===t)?.label??(t===``?`Runner default`:t)}function bn(e,t){let{runners:n,uninstalled:r,signedOut:i}=e;return n.length>1||r.length>0||i.length>0||n.some(e=>ke(t,e))}function xn({pick:e,onChange:t,disabled:n=!1,accounts:i=!1,layout:a}){let s=(0,X.useRef)(null),c=(0,X.useRef)(null),[u,d]=(0,X.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,X.useLayoutEffect)(()=>{let e=s.current;if(a!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;c.current=n instanceof HTMLElement&&e.contains(n)?n:null,d(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)}},[a]),(0,X.useLayoutEffect)(()=>{let e=c.current;c.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[u]);let f=gn(e),{runner:p,model:m,effort:h,effortOptions:g,runners:_,canRun:v,modelsLocked:y}=f,b=l(),x=o(),S=r(p,!0,f.account??f.repoAccount?.[p]),C=Le(p,x.data,S.data,[e.model,b.data?.defaultModels?.[p]]),w=n||!v,T=i?f.accounts:[],E=bn(f,T)?(0,Z.jsx)(Ie,{icon:(0,Z.jsx)(L,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:_,uninstalled:f.uninstalled,signedOut:f.signedOut,value:p,accounts:T,account:i?f.account:null,repoAccount:i?f.repoAccount:void 0,disabled:w,onPick:(n,r)=>t(i?{runner:n,account:r,model:n===p?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,D=(0,Z.jsx)(G,{icon:(0,Z.jsx)(j,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:yn(C,m),value:m,disabled:w,readOnly:y===!0,disabledHint:y?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Fe(n,S.data);t({...e,model:n,effort:e.effort===null?null:Ze(e.effort,r)})},options:C.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Ne(p,x.data,S)},`model`),k=(0,Z.jsx)(G,{icon:(0,Z.jsx)(O,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:g.find(e=>e.value===h)?.label??`Runner default`,value:h,disabled:w,readOnly:y===!0,disabledHint:y?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:g.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return a===`row`?(0,Z.jsx)(`div`,{ref:s,"data-slot":`engine-row-box`,children:(0,Z.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,Z.jsx)(Ve,{fill:`model-pill`,children:u?[E,k,D]:[E,D,k]})})}):(0,Z.jsxs)(Ve,{children:[E,D,k]})}var Sn={workflow:null,skills:[]},Cn=`cez-followup-selection`;function wn(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 Tn(){try{let e=localStorage.getItem(D(Cn));return e?wn(JSON.parse(e)):{...Sn}}catch{return{...Sn}}}function En(e){try{localStorage.setItem(D(Cn),JSON.stringify(e))}catch{}}var Dn=`cez-followup-prompt:`;function On(e){try{return localStorage.getItem(D(Dn+e))??``}catch{return``}}function kn(e,t){try{let n=D(Dn+e);t===``?localStorage.removeItem(n):localStorage.setItem(n,t)}catch{}}function An({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:a,selectedSkills:o,onSkillsChange:s,engine:l,onEngineChange:u,queuedRunId:d,onQueued:p}){let h=b(),_=i(),v=e.kind===`pr`?`PR`:`issue`,x=gn(l),C=c(x.runner,x.account),w=o.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!==o.length,[D]=(0,X.useState)(()=>cn(e)),[O,k]=(0,X.useState)(()=>On(e.url)||D),A=(0,X.useRef)(null),j=(0,X.useRef)(null);(0,X.useEffect)(()=>{kn(e.url,O===D?``:O)},[e.url,O,D]);let M=(0,X.useMemo)(()=>Ge(_.data?.promptTemplates),[_.data?.promptTemplates]),ee=e=>{let t=A.current,n=He({prompt:O,base:D,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:j.current}),r=Je(O,n,e);k(r.text),j.current=r.caret,requestAnimationFrame(()=>{A.current?.focus(),A.current?.setSelectionRange(r.caret,r.caret)})},N=Ke(M,w.map(e=>e.id)),P=(0,X.useRef)(O);P.current=O;let I=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=Ye(P.current,I.current,N,D);I.current=e.applied,e.text!==P.current&&k(e.text)},[N,D]);let L=m({mutationFn:async()=>!x.canRun||T?null:S(hn(e,r,w,O,vn(x))),onSuccess:t=>{if(t===null)return;let n=t;n&&p(e.url,n.id),y(`Added to the queue — ${v} #${e.number}`),w.length>0&&_.data!==void 0&&g({skillUsage:w.reduce((e,t)=>Ee(e,t.id),_.data.skillUsage)}).then(()=>h.invalidateQueries({queryKey:f.uiState})).catch(()=>{}),kn(e.url,``),k(D),I.current=``,h.invalidateQueries({queryKey:f.runs.all})},onError:e=>y(e.message,{tone:`danger`})}),te=e=>{qe(e)&&(e.preventDefault(),!L.isPending&&x.canRun&&L.mutate())},R=e=>s(o.some(t=>W(t)===W(e))?o.filter(t=>W(t)!==W(e)):[...o,Te(e)]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Z.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Z.jsx)(`span`,{children:`Instructions for the agent`}),(0,Z.jsx)(Qe,{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,Z.jsx)(Be,{templates:M,onInsert:ee}),(0,Z.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Workflow`}),(0,Z.jsx)(Mn,{workflows:t,value:r,onChange:a})]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Skills · select one or more`}),(0,Z.jsx)(Pn,{skills:n,skillUsage:_.data?.skillUsage,selected:o,onToggle:R})]}),o.length>0?(0,Z.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:o.map(e=>(0,Z.jsx)(jn,{skill:e,skills:n,unchecked:C.unchecked,onRemove:()=>R(e)},W(e)))}):null,T?(0,Z.jsx)(`p`,{role:`alert`,children:`A selected skill path is unavailable. Remove it or choose a current copy before starting.`}):null,(0,Z.jsx)(xn,{layout:`row`,pick:l,onChange:u,disabled:L.isPending||!x.canRun,accounts:!0}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Account`}),(0,Z.jsx)(Nn,{resolved:x,disabled:L.isPending||!x.canRun,onPick:e=>u({...l,account:e})})]}),!x.providerPending&&!x.canRun?(0,Z.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[x.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Z.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Z.jsxs)(`p`,{className:`text-xs 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,Z.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[E(e.url)?(0,Z.jsx)(B,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Z.jsxs)(B,{variant:`primary`,"data-action":`gh-run`,disabled:L.isPending||!x.canRun||T,onClick:()=>L.mutate(),children:[(0,Z.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,v]}),(0,Z.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-xs font-medium text-muted-foreground`,children:We()}),d?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Z.jsx)(V,{to:`/tasks/${d}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function jn({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,Z.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,Z.jsx)(I,{size:16,"aria-hidden":`true`,className:`size-3`})]})}function Mn({workflows:e,value:t,onChange:n}){let[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(``),s=(0,X.useRef)(null),c=xe(e,a);return(0,Z.jsxs)(ue,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:T(Ue,t&&`border-foreground/60 font-mono text-xs font-semibold text-foreground`),children:[(0,Z.jsx)(N,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Z.jsx)(ne,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(le,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(be,{shouldFilter:!1,children:[(0,Z.jsx)(_e,{placeholder:`Search workflows…`,value:a,onValueChange:o,onInput:()=>s.current?.scrollTo(0,0)}),(0,Z.jsxs)(ye,{ref:s,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,Z.jsx)(ve,{children:`Nothing matches.`}):null,(0,Z.jsx)(H,{children:c.map(e=>{let r=t===e.name;return(0,Z.jsxs)(U,{value:`workflow ${e.name}`,keywords:we(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),i(!1)},children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function Nn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:h,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,...e.configDir?{desc:e.configDir}:{}}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Z.jsx)(G,{icon:(0,Z.jsx)(re,{"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 Pn({skills:e,skillUsage:t,selected:n,onToggle:r}){let[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(null),u=(0,X.useRef)(null),{mostUsed:d,project:f,global:p,ranked:m}=De(e,o,t),h=(e,t)=>{let i=n.some(t=>W(t)===W(e));return(0,Z.jsxs)(U,{value:W(e),keywords:we(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.id,"data-selected":i?`true`:void 0,onSelect:()=>r(Te(e)),children:[(0,Z.jsx)(`span`,{className:T(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.path?(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Z.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),l(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Z.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5`})}),i?(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},W(e))};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Pe,{skill:c,onClose:()=>l(null)}),(0,Z.jsxs)(ue,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:T(Ue,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Z.jsx)(R,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Z.jsx)(ne,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(le,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(be,{shouldFilter:!1,children:[(0,Z.jsx)(_e,{placeholder:`Search skills…`,value:o,onValueChange:s,onInput:()=>u.current?.scrollTo(0,0)}),(0,Z.jsxs)(ye,{ref:u,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[o.trim()&&!e.some(e=>e.id===o.trim())?(0,Z.jsx)(H,{children:(0,Z.jsxs)(U,{value:`typed-skill`,onSelect:()=>r({id:o.trim()}),children:[`Use skill id “`,o.trim(),`” (unchecked)`]})}):null,(m?m.length===0:d.length===0&&f.length===0&&p.length===0)?(0,Z.jsx)(ve,{children:`Nothing matches.`}):null,m?m.length>0?(0,Z.jsx)(H,{children:m.map(e=>h(e,Se(e)))}):null:(0,Z.jsxs)(Z.Fragment,{children:[d.length>0?(0,Z.jsx)(H,{heading:`Most used`,children:d.map(e=>h(e,Se(e)))}):null,f.length>0?(0,Z.jsx)(H,{heading:`Project skills`,children:f.map(e=>h(e,!0))}):null,p.length>0?(0,Z.jsx)(H,{heading:`Global`,children:p.map(e=>h(e,!1))}):null]})]})]})})]})]})}var Fn=new WeakMap;function In(){let e=Tn(),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)&&En({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function Ln(){let e=b(),{projectId:t}=C(),n=Fn.get(e);n||Fn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=In());let{snapshot:a,subscribe:o,update:s}=r,l=(0,X.useSyncExternalStore)(o,a,a),u=d(),f=gn(l.engine),p=c(f.runner,f.account),m=i(),h=u.data?.workflows;(0,X.useEffect)(()=>{h&&l.workflow!==null&&!h.some(e=>e.name===l.workflow)&&s({workflow:null})},[s,h,l.workflow]);let g=(0,X.useMemo)(()=>Ce(p.data??[],m.data?.skillUsage),[p.data,m.data?.skillUsage]);return{...l,workflows:u,skillList:g,skillsUnchecked:p.unchecked,setWorkflow:e=>s({workflow:e}),setSelectedSkills:e=>s({selectedSkills:e}),setEngine:e=>s({engine:e}),onQueued:(e,t)=>s({queued:new Map(a().queued).set(e,t)})}}export{on as a,kt as c,Ht as d,xt as f,Ct as h,tn as i,It as l,Tt as m,An as n,sn as o,St as p,ln as r,an as s,Ln as t,Et as u};
@@ -0,0 +1 @@
1
+ import{rt as e}from"./queries-CPNrCEon.js";import{n as t}from"./project-location-bPiIsStE.js";function n(){return{home:e().data?.homeDir??null,root:t()}}export{n as t};
@@ -0,0 +1,7 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{O as r,dt as i,k as a,on as o,zn as s}from"./queries-CPNrCEon.js";import{M as c,a as l,ha as u,j as d,p as f,u as p,wn as m}from"./project-scope-context-_6sNMsAf.js";import{g as h}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as g}from"./dist-CCX8mhHc.js";import{C as _,K as v,Q as y,R as ee,S as te,W as ne,X as re,Z as b,a as ie,ct as ae,dt as oe,l as se,lt as ce,mt as le,n as ue,ot as de,rt as fe,st as x,x as pe,y as S}from"./design-icons-QbNMZniQ.js";import{t as C}from"./button-BV_AiLj2.js";import{i as w,l as T,p as me,r as E,t as he}from"./dropdown-menu-NJZfnQCU.js";import{i as D,o as ge,r as O,s as _e,t as k}from"./dialog-DKr-j9S6.js";import{c as ve,f as ye,u as be}from"./page-shell-BdjH5hyc.js";import{i as xe,l as Se,o as Ce}from"./skills-pM_PouEs.js";import{t as we}from"./centered-state-N8vWM_Hw.js";import{$t as A,O as Te,an as j,en as M,in as N,lr as P,nn as F,on as I,rn as L,tn as R,wn as z}from"./index-CIyGnGfm.js";import{t as B}from"./textarea-BGp28xFr.js";import{_ as Ee,a as De,c as Oe,f as ke,g as Ae,h as je,i as V,m as Me,n as Ne,o as Pe,p as H,r as U,t as Fe,u as Ie}from"./sortable.esm-CAVTYaA3.js";import{t as Le}from"./option-select-HC8juekO.js";import{t as Re}from"./discard-changes-dialog-CEeuND_i.js";var W=e(t(),1);function G(e){let t=[];for(let n of e){if(n.kind===`plugin`||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 ze(e,t){return{id:K(e,t),name:e,skill:e,prompt:`{{task}}`}}function K(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 r}function Be(e,t,n){return{id:K(e,n),[e]:t.trim()}}function q(e){if(!(e.kind===`plugin`||e.skill))return e.command===void 0?e.prompt===void 0?void 0:`prompt`:`command`}function Ve(e,t,n){let r=e[t],i=r&&q(r);return!r||!i?[...e]:e.map((e,r)=>r===t?{...e,[i]:n}:e)}function J(e){return e.some(e=>{let t=q(e);return t!==void 0&&!e[t]?.trim()})}function He(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function Ue(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 We(e,t){return e.filter((e,n)=>n!==t)}function Y(e){let t=e.map(e=>e.id),n=e.map(()=>({sources:[]}));return e.forEach((e,r)=>{if(!e.onFail)return;let i=e.onFail.retry,a=e.onFail.max??2,o=t.indexOf(i),s=n[r]?.sources??[];if(o===-1||o>=r){n[r]={link:{kind:o===-1?`missing`:`not-earlier`,target:i,max:a},sources:s};return}n[r]={link:{kind:`ok`,target:i,targetIndex:o,max:a},sources:s},n[o]?.sources.push(r)}),n}function X(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 Z(e,t,n){let r=` `.repeat(n);return!t.includes(`
2
+ `)||/^\s/.test(t)?[`${r}${e}: ${X(t)}`]:[`${r}${e}: |`,...t.split(`
3
+ `).map(e=>`${r} ${e}`)]}function Ge(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${X(e.name)}`),e.skill&&t.push(` skill: ${X(e.skill)}`),t}function Ke(e){let t=[];return e.model&&t.push(` model: ${X(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${X(e.effort)}`),e.runner&&t.push(` runner: ${X(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${X(e.agentProfile)}`),t}function qe(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(X).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(X).join(`, `)}]`),t}function Je(e){return e.onFail?[` onFail:`,` retry: ${X(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function Ye(e){return[` - id: ${X(e.id)}`,...Ge(e),...e.prompt?Z(`prompt`,e.prompt,4):[],...e.kind===`plugin`?[` kind: plugin`,` pluginKind: ${X(e.pluginKind)}`,...e.config===void 0?[]:[` config: ${JSON.stringify(e.config)}`]]:[],...Ke(e),...qe(e),...e.command?Z(`command`,e.command,4):[],...Je(e)]}function Xe(e,t,n){let r=[`name: ${X(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...Z(`description`,t.trim(),0));let i=G(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${X(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...Ye(e))}else r.push(`skills: []`);return`${r.join(`
4
+ `)}\n`}function Ze(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`chain`}function Qe(e){let t=G(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function $e(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 et(e,t,n){let r=G(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var Q=n(),tt=[{value:`skill`,label:`Skill`,icon:fe},{value:`prompt`,label:`Prompt`,icon:ne},{value:`command`,label:`Command`,icon:de}],nt={prompt:{field:`Prompt the agent runs`,placeholder:`Review the change for {{task}}…`,add:`Add prompt step`,blank:`A prompt step needs text.`},command:{field:`Shell command`,placeholder:`npm test`,add:`Add command step`,blank:`A command step needs text.`}};function rt({kind:e,onKindChange:t}){return(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`Step kind`,"data-slot":`wb-add-kind`,className:`grid grid-cols-3 gap-0.5 rounded-lg border border-border bg-muted/60 p-1 sm:inline-flex sm:w-fit`,children:tt.map(n=>(0,Q.jsxs)(`label`,{className:g(`flex min-h-11 cursor-pointer items-center justify-center gap-2 rounded-md border border-transparent px-2 py-1.5 sm:px-3 text-[13px] font-medium transition-colors has-[:focus-visible]:outline-2`,e===n.value?`border-border bg-card text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),children:[(0,Q.jsx)(`input`,{type:`radio`,name:`workflow-add-kind`,className:`sr-only`,value:n.value,checked:e===n.value,onChange:()=>t(n.value)}),(0,Q.jsx)(n.icon,{"aria-hidden":`true`,className:`size-3.5 max-sm:hidden`}),n.label]},n.value))})}function it({query:e,onQueryChange:t,matches:n,skillsCount:r,error:i,selectedSkill:a,onSelectSkill:o}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(P,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:e,onChange:e=>t(e.target.value)}),i===null?(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[n.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:a===e.id,onChange:()=>o(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]))),n.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r===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: `,i]}),e.trim()&&!n.some(t=>t.id===e.trim())?(0,Q.jsxs)(C,{onClick:()=>o(e.trim()),children:[`Use skill id “`,e.trim(),`” (unchecked)`]}):null]})}function at({open:e,onOpenChange:t,kind:n,onKindChange:r,text:i,onTextChange:a,stepsCount:o,onCloseAutoFocus:s,onCancel:c,onAdd:l,onAddText:u,...d}){let f=o>=8,p=d.selectedSkill;return(0,Q.jsx)(k,{open:e,onOpenChange:t,children:(0,Q.jsxs)(O,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:s,className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button:not([data-button-size])]:min-h-11`,children:[(0,Q.jsxs)(ge,{children:[(0,Q.jsx)(_e,{className:`text-xl font-normal`,children:`Add step`}),(0,Q.jsx)(D,{className:`sr-only`,children:`Choose a skill, write a prompt or a shell command to append to this workflow.`})]}),(0,Q.jsx)(rt,{kind:n,onKindChange:r}),n===`skill`?(0,Q.jsx)(it,{...d}):(0,Q.jsx)(B,{"aria-label":nt[n].field,placeholder:nt[n].placeholder,value:i,rows:4,className:g(n===`command`&&`font-mono`),onChange:e=>a(e.target.value)}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(C,{variant:`outline`,onClick:c,children:`Cancel`}),n===`skill`?(0,Q.jsx)(C,{variant:`primary`,disabled:!p||f,onClick:()=>{p&&l(p)},children:`Add selected skill`}):(0,Q.jsx)(C,{variant:`primary`,disabled:!i.trim()||f,onClick:()=>u(n,i),children:nt[n].add})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the new step, then reorder it in the existing canvas.`}),f?(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 ot({kind:e,text:t,index:n,editing:r,onTextChange:i}){let a=(0,W.useId)(),o=!t.trim();return(0,Q.jsxs)(Q.Fragment,{children:[r?(0,Q.jsx)(B,{"data-slot":`wb-step-text`,"aria-label":`Step ${n+1} ${e}`,"aria-invalid":o||void 0,"aria-describedby":o?a:void 0,value:t,rows:3,className:g(`mt-2`,e===`command`&&`font-mono`),onChange:e=>i(e.target.value)}):null,o?(0,Q.jsx)(`p`,{id:a,"data-slot":`wb-step-text-error`,className:`mt-1 text-xs text-danger`,children:nt[e].blank}):null]})}function st({kind:e,index:t,editing:n,onEditingChange:r}){return(0,Q.jsxs)(C,{variant:`outline`,size:`sm`,"data-slot":`wb-step-edit`,"aria-label":n?`Done editing step ${t+1}`:`Edit ${e} of step ${t+1}`,"aria-expanded":n,onClick:()=>r(!n),children:[n?(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-4`}):(0,Q.jsx)(v,{"aria-hidden":`true`,className:`size-4`}),n?`Done`:`Edit ${e}`]})}function ct({workflows:e,trimmedName:t,onLoadWorkflow:n}){return(0,Q.jsx)(Le,{id:`workflow-load`,"data-slot":`wb-load-picker`,"data-page-shell-action":``,"aria-label":`Workflow`,value:e.some(e=>e.name===t)?t:``,placeholder:`Choose a workflow`,onValueChange:t=>{let r=e.find(e=>e.name===t);r&&n(r)},options:e.map(e=>({value:e.name,label:e.name})),className:`w-56 max-w-full min-w-0 border-border bg-card font-medium text-foreground max-md:w-full`})}function lt({draft:e,trimmedName:t,nameRef:n,onDraft:r,renamedFrom:i}){return(0,Q.jsxs)(`section`,{"data-slot":`wb-details`,"data-reports-dirty":``,className:`flex min-w-0 flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{"data-slot":`wb-details-line`,className:`grid min-w-0 gap-1.5 @xl:grid-cols-[96px_minmax(0,1fr)] @xl:items-center @xl:gap-x-3`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-medium text-foreground`,children:`Name`}),(0,Q.jsx)(P,{id:`workflow-name`,ref:n,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:e.name,"aria-describedby":i===void 0?void 0:`workflow-rename-note`,onChange:t=>r({...e,name:t.target.value}),className:`h-10 bg-card text-sm max-md:h-11 @xl:max-w-sm`}),(0,Q.jsx)(`p`,{id:`workflow-rename-note`,"aria-live":`polite`,className:`text-xs text-muted-foreground empty:hidden @xl:col-start-2`,children:i===void 0?null:(0,Q.jsxs)(`span`,{"data-slot":`wb-rename-note`,children:[`Saving creates a new workflow “`,t,`”. “`,i,`” stays as it is.`]})})]}),(0,Q.jsxs)(`div`,{"data-slot":`wb-details-line`,className:`grid min-w-0 gap-1.5 @xl:grid-cols-[96px_minmax(0,1fr)] @xl:items-center @xl:gap-x-3`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-medium text-foreground`,children:`Description`}),(0,Q.jsx)(B,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,rows:1,placeholder:`What this workflow does`,value:e.description,onChange:t=>r({...e,description:t.target.value}),className:`min-h-10 w-full bg-card px-3 py-2 text-sm max-md:min-h-11`})]})]})}function ut({savedFile:e,autoOpen:t,onImportToggle:n,onExport:r,onAutoToggle:i,onDeleteRequest:a}){let o=(0,W.useRef)(null),s={import:n,auto:i,delete:a};return(0,Q.jsxs)(he,{children:[(0,Q.jsx)(me,{asChild:!0,children:(0,Q.jsx)(C,{type:`button`,variant:`outline`,size:`icon`,"data-slot":`wb-more`,"aria-label":`More workflow actions`,title:`More workflow actions`,children:(0,Q.jsx)(te,{"aria-hidden":`true`})})}),(0,Q.jsxs)(E,{align:`end`,"data-slot":`wb-actions`,className:`min-w-48`,onCloseAutoFocus:()=>{let e=o.current;o.current=null,e&&s[e]()},children:[(0,Q.jsxs)(w,{"data-slot":`wb-import`,className:`min-h-[44px]`,onSelect:()=>{o.current=`import`},children:[(0,Q.jsx)(ce,{"aria-hidden":`true`}),`Import`]}),(0,Q.jsxs)(w,{"data-slot":`wb-export`,className:`min-h-[44px]`,title:`Download workflow.yaml`,onSelect:r,children:[(0,Q.jsx)(pe,{"aria-hidden":`true`}),`Export`]}),(0,Q.jsxs)(w,{"data-slot":`wb-auto`,className:`min-h-[44px]`,"aria-describedby":`wb-auto-hint`,title:`Auto-build: describe the chain in words and an agent drafts its steps for you to review`,onSelect:()=>{o.current=`auto`},children:[(0,Q.jsx)(oe,{"aria-hidden":`true`}),t?`Close Auto-build`:`Auto-build`]}),(0,Q.jsx)(`span`,{id:`wb-auto-hint`,className:`sr-only`,children:`Describe the chain in words and an agent drafts its steps for you to review.`}),e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(T,{}),(0,Q.jsxs)(w,{"data-slot":`wb-delete`,variant:`destructive`,className:`min-h-[44px]`,title:`Delete the saved workflow file`,onSelect:()=>{o.current=`delete`},children:[(0,Q.jsx)(x,{"aria-hidden":`true`}),`Delete`]})]}):null]})]})}function dt({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:not([data-button-size])]: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)(B,{"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)(C,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:n||e.trim()===``,onClick:r,children:[(0,Q.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),n?`Building…`:`Build chain`]}),(0,Q.jsxs)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:i,children:[(0,Q.jsx)(le,{"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 ft({open:e,onOpenChange:t,text:n,onTextChange:r,error:i,pending:a,onRun:o,onCancel:s}){return(0,Q.jsx)(k,{open:e,onOpenChange:t,children:(0,Q.jsxs)(O,{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:not([data-button-size])]:min-h-11`,children:[(0,Q.jsx)(_e,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,Q.jsx)(D,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,Q.jsx)(B,{"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)(C,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:a,onClick:o,children:`Import`}),(0,Q.jsx)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:s,children:`Cancel`})]})]})})}function pt({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)(y,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(P,{"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)(At,{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)(Mt,{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-xs leading-relaxed whitespace-pre text-muted-foreground`,children:o})]})]})}function mt({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)(fe,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,Q.jsx)(kt,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function ht({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)(A,{open:n,onOpenChange:e=>!e&&r(),children:(0,Q.jsxs)(F,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(j,{children:[(0,Q.jsxs)(I,{children:[`“`,e,`” already exists`]}),(0,Q.jsx)(L,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(R,{children:`Keep the file`}),(0,Q.jsx)(M,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,Q.jsx)(A,{open:i,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(F,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(j,{children:[(0,Q.jsxs)(I,{children:[`Delete workflow “`,e,`”?`]}),(0,Q.jsxs)(L,{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)(N,{children:[(0,Q.jsx)(R,{children:`Keep the file`}),(0,Q.jsx)(M,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function gt(e){return e.name??e.skill??e.id}function _t(e){return e.skill&&e.name&&e.name!==e.skill?e.skill:void 0}function vt(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function yt(e){return`$ ${e.command}`}function bt(e,t){return vt(e)||t?.description||`Not listed by this runner and account. Step open will check the skill id.`}function xt(e,t){return e.command===void 0?e.skill?bt(e,t):e.prompt??``:yt(e)}function St(e,t){return e.skill&&!t?`unknown`:null}function Ct(e){return e.command===void 0?e.skill?`Skill step`:`Prompt step`:`Command step`}function wt(e){return String(e+1).padStart(2,`0`)}function Tt({link:e}){let t=e.kind!==`ok`;return(0,Q.jsxs)(`p`,{"data-slot":`wb-step-retry`,"data-state":e.kind,className:g(`mt-2 inline-flex max-w-full items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium [overflow-wrap:anywhere]`,t?`border-danger/40 text-danger`:`border-accent-strong/40 bg-accent-strong/10 text-link-foreground`),children:[t?(0,Q.jsx)(ae,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}):(0,Q.jsx)(b,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e.kind===`ok`?`Retry from ${wt(e.targetIndex)} · up to ×${e.max}`:e.kind===`missing`?`Retry target “${e.target}” is missing`:`Retry target “${e.target}” must come before this step`]})}function Et({sources:e}){return(0,Q.jsxs)(`p`,{"data-slot":`wb-step-retry-target`,className:`mt-2 inline-flex max-w-full items-center gap-1.5 rounded-full border border-dashed border-accent-strong/40 px-2.5 py-1 text-xs text-link-foreground`,children:[(0,Q.jsx)(b,{"aria-hidden":`true`,className:`size-3.5 shrink-0 -scale-x-100`}),`Retry target of `,e.map(wt).join(`, `)]})}function Dt({index:e,title:t,badge:n,onRemove:r,gripProps:i}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${e+1}: ${t}`,className:`group/grip inline-flex h-[26px] shrink-0 cursor-grab items-center justify-center gap-0.5 rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 active:cursor-grabbing`,...i,children:[(0,Q.jsx)(ee,{"aria-hidden":`true`,className:`size-4 opacity-70 transition-opacity group-hover/grip:opacity-100`}),(0,Q.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:wt(e)})]}),(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:g(`shrink-0 rounded-full border px-2 py-px font-mono text-xs`,n===`unknown`&&`border-danger/35 text-danger`),children:n}):null,r?(0,Q.jsxs)(C,{"data-slot":`wb-step-remove`,variant:`ghost`,size:`sm`,className:`shrink-0`,"aria-label":`Remove step ${e+1}: ${t}`,onClick:r,children:[(0,Q.jsx)(x,{"aria-hidden":`true`}),` Remove`]}):null]})}function Ot({index:e,inRow:t=!1,onMoveUp:n,onMoveDown:r}){return(0,Q.jsxs)(`div`,{className:g(`flex flex-wrap gap-2 @min-[900px]:hidden`,!t&&`mt-3`),children:[(0,Q.jsxs)(C,{variant:`outline`,size:`sm`,"aria-label":`Move step ${e+1} up`,disabled:!n,onClick:n,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,Q.jsxs)(C,{variant:`outline`,size:`sm`,"aria-label":`Move step ${e+1} down`,disabled:!r,onClick:r,children:[(0,Q.jsx)(ue,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function kt({step:e,index:t,skills:n,onRemove:r,gripProps:i,onMoveUp:a,onMoveDown:o,retry:s,onTextChange:c,overlay:l=!1}){let u=n.find(t=>t.id===e.skill),d=gt(e),f=xt(e,u),p=St(e,u),m=c&&!l?q(e):void 0,[h,_]=(0,W.useState)(!1);return(0,Q.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:g(`rounded-lg border border-border bg-background p-4`,l&&`shadow-md`),children:[(0,Q.jsx)(Dt,{index:t,title:d,badge:p,onRemove:r,gripProps:i}),f&&!(m&&h)?(0,Q.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-1.5 break-words text-xs leading-relaxed text-muted-foreground`,children:f}):null,(0,Q.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-1.5 text-xs text-link-foreground`,children:Ct(e)}),_t(e)?(0,Q.jsx)(`p`,{"data-slot":`wb-step-skill`,className:`mt-1 font-mono text-xs text-muted-foreground`,children:_t(e)}):null,s?.link||s?.sources.length?(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[s.link?(0,Q.jsx)(Tt,{link:s.link}):null,s.sources.length>0?(0,Q.jsx)(Et,{sources:s.sources}):null]}):null,m&&c?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ot,{kind:m,text:e[m]??``,index:t,editing:h,onTextChange:c}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,Q.jsx)(st,{kind:m,index:t,editing:h,onEditingChange:_}),(0,Q.jsx)(Ot,{index:t,inRow:!0,onMoveUp:a,onMoveDown:o})]})]}):l?null:(0,Q.jsx)(Ot,{index:t,onMoveUp:a,onMoveDown:o})]})}function At({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=Se(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)(jt,{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 jt({skill:e,inFlow:t,onAdd:n}){let{listeners:r,setNodeRef:i,isDragging:a}=H({id:`palette:${JSON.stringify([e.id,e.path])}`,data:{type:`palette`,skill:e.id}});return(0,Q.jsxs)(`div`,{ref:i,"data-slot":`wb-skill`,"data-skill":e.id,"data-in-flow":t||void 0,title:e.description??``,className:g(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,a&&`opacity-40`),...r,children:[(0,Q.jsxs)(`span`,{className:g(`min-w-0 flex-1 break-words text-xs`,xe(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)(re,{"aria-hidden":`true`,className:`size-3.5`})})]})}function Mt({yaml:e}){let[t,n]=(0,W.useState)(!1),r=(0,W.useRef)(null);return(0,W.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)(se,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}function Nt(e,t){return{yaml:Xe(e.name,e.description,e.steps),loadedName:t}}function Pt(){let[e,t]=(0,W.useState)(null),[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(null),o=(0,W.useRef)(0),s=e!==null&&n!==null&&Nt(e,void 0).yaml!==n.yaml;z(s);let c=(e,n)=>{o.current+=1,t(e),r(Nt(e,n))};return{draft:e,setDraft:t,dirty:s,replace:c,guardedReplace:(e,t)=>{s?a({draft:e,loadedName:t}):c(e,t)},sending:()=>e===null?null:{baseline:Nt(e,e.name.trim()),replacement:o.current},saved:e=>{e&&e.replacement===o.current&&r(e.baseline)},renamedFrom:e=>{let t=n?.loadedName;if(!(t===void 0||e===``))return Ze(e)===Ze(t)?void 0:t},discardOpen:i!==null,keepEditing:()=>a(null),discard:()=>{i&&c(i.draft,i.loadedName),a(null)}}}var Ft=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function It(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function Lt(e,t){return e?`No unsaved changes`:J(t)?`A step has no text`:void 0}function Rt(){let{name:e}=h();return(0,Q.jsx)(zt,{routeName:e},e??``)}function zt({routeName:e}){let t=a(),n=i(),h=r(),g=u(),_=Pt(),{draft:v,setDraft:y}=_,[ee,te]=(0,W.useState)(``),[ne,b]=(0,W.useState)(!1),[ie,oe]=(0,W.useState)(``),[ce,le]=(0,W.useState)(null),[ue,de]=(0,W.useState)(`skill`),[fe,x]=(0,W.useState)(``),[pe,S]=(0,W.useState)(!1),[w,T]=(0,W.useState)(``),[me,E]=(0,W.useState)(``),[he,D]=(0,W.useState)(!1),[ge,O]=(0,W.useState)(``),[_e,k]=(0,W.useState)(!1),[xe,A]=(0,W.useState)(!1),j=(0,W.useId)(),[M,N]=(0,W.useState)(null),[P,F]=(0,W.useState)(null),I=(0,W.useRef)(null),L=(0,W.useRef)(null),R=t.data?.workflows??[],z=n.data??[],B=Ce(z,h.data?.skillUsage),Ee=Se(B,ie,h.data?.skillUsage);(0,W.useEffect)(()=>{if(v!==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`);_.replace(r?It(r):$(),r?.name)},[v,t.data,e,_.replace]);let V=e=>y(t=>t===null?t:{...t,steps:e}),Me=s({mutationFn:e=>d(e),onSuccess:e=>{y({name:e.name,description:e.description??``,steps:e.steps}),S(!1),T(``),E(``),l(`Imported "${e.name}" — review, then Save.`)},onError:e=>E(e.message)}),H=s({mutationFn:e=>c(e),onSuccess:e=>{y(t=>{let n=t??$(),{name:r,steps:i}=$e(e,n.name);return{...n,name:r,steps:i}}),D(!1),O(``),l(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??v?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>l(e instanceof Error?e.message:String(e),{tone:`danger`})}),U=s({onMutate:()=>_.sending(),mutationFn:e=>p({...et(v?.name??``,v?.description??``,v?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:(e,t,n)=>{k(!1),_.saved(n),l(`Saved — ${e.path.split(`/`).pop()??e.path}`),g.invalidateQueries({queryKey:o.workflows})},onError:e=>{e instanceof m&&e.exists===!0?k(!0):l(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Fe=s({mutationFn:e=>f(e),onSuccess:(e,t)=>{A(!1),l(`Deleted "${t}".`),_.replace($(),void 0),g.invalidateQueries({queryKey:o.workflows})},onError:e=>{A(!1),l(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Le=Ae(je(Ie,{activationConstraint:{distance:4}}),je(Oe,{coordinateGetter:Ne}));if(t.isError)return(0,Q.jsx)(be,{route:`workflows`,density:`empty`,className:`@container`,children:(0,Q.jsx)(we,{icon:(0,Q.jsx)(ae,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(v===null)return(0,Q.jsx)(Te,{});let G=v.steps,K=v.name.trim(),q=R.find(e=>e.name===K&&e.source===`file`),J=Xe(v.name,v.description,G),Y=Lt(q!==void 0&&Xe(q.name,q.description??``,q.steps??[])===J,G),X=(e,t=G.length)=>{if(G.length>=8){l(`A workflow holds at most 8 steps.`,{tone:`danger`});return}V(He(G,e,t))},Z=(e,t=G.length)=>X(ze(e,G),t);return(0,Q.jsxs)(be,{route:`workflows`,density:ye(G.length),className:`@container`,header:{title:`Workflows`,subtitle:`Portable skill chains. Steps run from top to bottom.`,secondaryActions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ct,{workflows:R,trimmedName:K,onLoadWorkflow:e=>_.guardedReplace(It(e),e.name)}),Y?(0,Q.jsx)(`span`,{id:j,"data-slot":`wb-save-cue`,className:`whitespace-nowrap text-xs text-muted-foreground`,children:Y}):null,(0,Q.jsxs)(ve,{type:`button`,variant:`outline`,"data-slot":`wb-save`,disabled:U.isPending||Y!==void 0,"aria-describedby":Y?j:void 0,onClick:()=>{if(K===``){I.current?.focus();return}if(G.length===0){l(`Add at least one step first.`,{tone:`danger`});return}U.mutate(!1)},children:[(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-4`}),`Save workflow`]}),(0,Q.jsx)(ut,{savedFile:q,autoOpen:he,onImportToggle:()=>{E(``),D(!1),S(e=>!e)},onExport:()=>{let e=new Blob([J],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${Ze(v.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{S(!1),D(e=>!e)},onDeleteRequest:()=>A(!0)})]}),primaryAction:(0,Q.jsxs)(ve,{type:`button`,variant:`primary`,"data-slot":`wb-new`,onClick:()=>_.guardedReplace($(),void 0),children:[(0,Q.jsx)(re,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]})},children:[(0,Q.jsxs)(De,{sensors:Le,collisionDetection:ke,onDragStart:e=>{let t=e.active.data.current;N(t??null)},onDragOver:e=>{F(e.over?String(e.over.id):null)},onDragEnd:e=>{N(null),F(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===Ft?G.length:G.findIndex(e=>e.id===n.id);Z(r.skill,e===-1?G.length:e);return}if(n.id===t.id)return;let i=G.findIndex(e=>e.id===t.id),a=G.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&V(Ue(G,i,a))},onDragCancel:()=>{N(null),F(null)},children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4 pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,Q.jsx)(lt,{draft:v,trimmedName:K,nameRef:I,onDraft:y,renamedFrom:_.renamedFrom(K)}),he?(0,Q.jsx)(dt,{text:ge,onTextChange:O,pending:H.isPending,onRun:()=>{let e=ge.trim();e===``||H.isPending||H.mutate(e)},onCancel:()=>{D(!1),O(``)}}):null,(0,Q.jsx)(ft,{open:pe,onOpenChange:S,text:w,onTextChange:T,error:me,pending:Me.isPending,onRun:()=>{let e=w.trim();e!==``&&Me.mutate(e)},onCancel:()=>{S(!1),T(``),E(``)}}),(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`,title:`A workflow holds at most 8 steps`,children:[`Steps · `,G.length,` of `,8,` max`,(0,Q.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Qe(G)})]}),(0,Q.jsx)(Bt,{steps:G,skills:z,dragging:M!==null,overId:P,activeStepId:M?.type===`step`?M.step.id:null,onRemove:e=>V(We(G,e)),onTextChange:(e,t)=>V(Ve(G,e,t)),onMove:(e,t)=>V(Ue(G,e,t))}),(0,Q.jsxs)(C,{ref:L,variant:`outline`,className:`mt-4`,onClick:()=>{le(null),oe(``),de(`skill`),x(``),b(!0)},children:[(0,Q.jsx)(re,{"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.jsx)(pt,{paletteSkills:B,query:ee,onQueryChange:te,error:n.isError?n.error.message:null,inFlow:new Set(G.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Z(e),yaml:J})]})]}),(0,Q.jsx)(Pe,{children:(0,Q.jsx)(Ht,{dragging:M,steps:G,skills:z})})]}),(0,Q.jsx)(at,{open:ne,onOpenChange:b,query:ie,onQueryChange:oe,matches:Ee,skillsCount:z.length,error:n.isError?n.error.message:null,selectedSkill:ce,onSelectSkill:le,kind:ue,onKindChange:de,text:fe,onTextChange:x,stepsCount:G.length,onCloseAutoFocus:e=>{e.preventDefault(),L.current?.focus()},onCancel:()=>b(!1),onAdd:e=>{Z(e),b(!1)},onAddText:(e,t)=>{X(Be(e,t,G)),b(!1)}}),(0,Q.jsx)(ht,{trimmedName:K,savedFile:q,overwriteOpen:_e,onOverwriteDismiss:()=>k(!1),deleteOpen:xe,onDeleteDismiss:()=>A(!1),onOverwrite:()=>U.mutate(!0),onDelete:()=>Fe.mutate(K)}),(0,Q.jsx)(Re,{open:_.discardOpen,subject:K===``?`this workflow`:`“${K}”`,onKeep:_.keepEditing,onDiscard:_.discard})]})}function Bt({steps:e,skills:t,dragging:n,overId:r,activeStepId:i,onRemove:a,onTextChange:o,onMove:s}){let{setNodeRef:c,isOver:l}=Me({id:Ft}),u=n&&r===Ft,d=Y(e);return(0,Q.jsx)(`div`,{ref:c,"data-slot":`wb-steps`,"data-reports-dirty":``,"data-dragging":n||void 0,className:g(`relative mt-3 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:g(`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)(Fe,{items:e.map(e=>e.id),strategy:V,children:[(0,Q.jsx)(`ol`,{className:`flex flex-col gap-4`,children:e.map((c,l)=>(0,Q.jsx)(Vt,{step:c,index:l,skills:t,retry:d[l],dragging:n,insertBefore:n&&r===c.id&&i!==c.id,onRemove:()=>a(l),onTextChange:e=>o(l,e),onMoveUp:l>0?()=>s(l,l-1):void 0,onMoveDown:l<e.length-1?()=>s(l,l+1):void 0},c.id))}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:g(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,u?`bg-accent-strong`:`bg-transparent`)})]})})}function Vt({step:e,index:t,retry:n,dragging:r,insertBefore:a,onRemove:o,onTextChange:s,onMoveUp:c,onMoveDown:l}){let u=i(e.runner,e.agentProfile),{attributes:d,listeners:f,setNodeRef:p,transform:m,transition:h,isDragging:_}=U({id:e.id,data:{type:`step`,step:e}});return(0,Q.jsxs)(`li`,{ref:p,style:{transform:Ee.Transform.toString(m),transition:h},className:g(`relative`,_&&`opacity-40`),children:[t>0&&!r?(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-step-connector`,className:`pointer-events-none absolute -top-4 left-[48px] h-4 w-0.5 rounded-full bg-border`}):null,a?(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[10px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,Q.jsx)(kt,{step:e,index:t,skills:u.data??[],onRemove:o,onTextChange:s,onMoveUp:c,onMoveDown:l,retry:n,gripProps:{...d,...f}})]})}function Ht(e){let t=e.dragging?.type===`step`?e.dragging.step:void 0,n=i(t?.runner,t?.agentProfile,!!t);return(0,Q.jsx)(mt,{...e,skills:t?n.data??[]:e.skills})}export{Rt as WorkflowsRoute};
@@ -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{B as r,U as i,bt as a,ht as o,rt as s}from"./queries-CPNrCEon.js";import{a as c}from"./project-scope-context-_6sNMsAf.js";import{n as l}from"./chunk-KS7C4IRE-BdLLx37K.js";import{t as u}from"./chevron-right-BENZ-1ZN.js";import{t as d}from"./external-link-BE6y205O.js";import{t as f}from"./button-BV_AiLj2.js";import{t as p}from"./status-dot-Dvy-rnDJ.js";import{f as m,o as h}from"./page-shell-BdjH5hyc.js";import{t as g}from"./agents-settings-path-7X6_cvUg.js";import{In as _,Rn as v,cn as y,cr as b,or as x,sn as S,ur as C}from"./index-BAXboPqe.js";var w=e(t(),1),T=n();function E(e){let t=e.replace(/\binstall\b/g,(e,t)=>t===0?`Install`:e),n=t.split(/(`[^`]+`)/g);if(n.length===1){let e=t.split(/(\bgh auth login\b)/g);return e.length===1?t:e.map((e,t)=>e===`gh auth login`?(0,T.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:e},t):(0,T.jsx)(`span`,{children:e},t))}return n.map((e,t)=>e.startsWith("`")&&e.endsWith("`")&&e.length>2?(0,T.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:e.slice(1,-1)},t):e?(0,T.jsx)(`span`,{children:e},t):null)}function D(e,t){let n=o(t,e);return n?{label:n.displayName,isAgent:!0}:{label:e,isAgent:!1}}function O({mode:e,version:t,rawVersion:n}){return e?(0,T.jsx)(`span`,{"data-slot":`tool-dry-run`,title:n,className:`shrink-0 rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:e.label}):t?(0,T.jsxs)(`span`,{className:`min-w-0 break-words`,children:[`· `,t]}):null}var k=`text-xs font-medium`;function A({projectsDir:e,home:t,onAction:n}){return(0,T.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-card-edge bg-card px-6 py-4 shadow-card max-md:px-4`,"aria-labelledby":`projects-heading`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`h2`,{id:`projects-heading`,className:`text-sm font-semibold text-foreground`,children:`Projects`}),(0,T.jsx)(`p`,{className:`mt-0.5 text-[13px] leading-[1.5] text-muted-foreground`,children:`Start a repository, open a local folder, or clone from GitHub.`})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,T.jsx)(f,{variant:`outline`,size:`sm`,className:k,"data-action":`new-project`,onClick:()=>n(`new`),children:`New project`}),(0,T.jsx)(f,{variant:`outline`,size:`sm`,className:k,onClick:()=>n(`local`),children:`Open local folder`}),(0,T.jsx)(f,{variant:`outline`,size:`sm`,className:k,onClick:()=>n(`clone`),children:`Clone from GitHub`})]})]}),e?(0,T.jsxs)(`p`,{"data-slot":`projects-checkout`,className:`flex min-w-0 items-baseline gap-1.5 text-xs text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`shrink-0`,children:`New clones go to`}),(0,T.jsx)(v,{value:e,bases:{home:t,root:null},className:`text-foreground`})]}):null]})}function j({recovery:e}){let t=`${k} ml-auto`;return e.kind===`settings`?(0,T.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,className:t,children:(0,T.jsxs)(l,{to:e.to,"data-slot":`tool-setup`,children:[e.label,(0,T.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})}):(0,T.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,className:t,children:(0,T.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,"data-slot":`tool-setup`,children:[e.label,(0,T.jsx)(d,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,T.jsx)(`span`,{className:`sr-only`,children:` (opens in a new tab)`})]})})}function M({health:e,runners:t,copying:n,onCopy:r,recheckStatus:i,onRecheck:a}){return(0,T.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-card-edge bg-card p-6 shadow-card max-md:p-4`,"aria-labelledby":`tools-heading`,children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{id:`tools-heading`,className:`text-base font-semibold text-foreground`,children:`Tools diagnostics`}),(0,T.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.5] text-muted-foreground`,children:`Check the tools available to this local workspace.`})]}),(0,T.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,className:k,children:(0,T.jsxs)(l,{to:g,"data-slot":`tools-settings`,children:[`Tool settings`,(0,T.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})})]}),e.isError?(0,T.jsx)(`p`,{role:`alert`,className:`text-sm text-semantic-red`,children:`Could not refresh tool diagnostics. Recheck to retry.`}):null,!e.data&&!e.isError?(0,T.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Checking installed tools…`}):null,e.data?(0,T.jsx)(`dl`,{className:`divide-y divide-border border-y border-border text-[13px] leading-[1.5] text-muted-foreground`,children:e.data.checks.map(e=>{let n=S(e),r=D(e.name,t),i=_(e),a=y(e,t);return(0,T.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":e.available,className:`grid grid-cols-1 gap-x-4 gap-y-1 py-3 sm:grid-cols-[160px_minmax(0,1fr)] sm:items-center`,children:[(0,T.jsxs)(`dt`,{className:`flex items-center gap-2.5`,children:[(0,T.jsx)(p,{tone:i.availability.tone,shape:i.availability.shape}),(0,T.jsx)(`span`,{className:r.isAgent?`text-[14px] font-semibold text-foreground`:`font-mono text-[13px] font-semibold text-foreground`,children:r.label})]}),(0,T.jsxs)(`dd`,{className:`flex min-w-0 items-center gap-x-1.5 text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`shrink-0`,children:i.availability.label}),(0,T.jsx)(O,{mode:i.mode,version:i.version,rawVersion:i.rawVersion}),a?(0,T.jsx)(j,{recovery:a}):null]}),n?(0,T.jsx)(`dd`,{"data-slot":`tool-hint`,className:`min-w-0 break-words text-xs leading-relaxed text-muted-foreground sm:col-start-2`,children:E(n)}):null]},e.name)})}):null,e.data?.checks.length===0?(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tool diagnostics reported by this server.`}):null,(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,T.jsx)(f,{variant:`outline`,className:`rounded-lg px-3.5 text-xs font-medium`,disabled:e.isFetching,onClick:()=>void a(),children:e.isFetching?`Checking tools…`:`Recheck tools`}),(0,T.jsx)(f,{variant:`outline`,className:`rounded-lg px-3.5 text-xs font-medium`,disabled:!e.data||n,onClick:()=>void r(),children:n?`Copying…`:`Copy diagnostics`}),(0,T.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`text-xs text-muted-foreground`,children:i?(0,T.jsx)(`span`,{"data-slot":`recheck-status`,children:i}):null})]})]})}function N(e,t){let n=e.filter(e=>e.available).length;return`Rechecked at ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})} — ${n} of ${e.length} ${e.length===1?`tool`:`tools`} available.`}function P(){let e=r(),t=i().data?.projectsDir,n=s().data?.homeDir??null,o=a().data,[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(!1),[p,g]=(0,w.useState)(null),_=async()=>{g(null);let t=await e.refetch();t.isError||!t.data||g(N(t.data.checks,new Date))},v=async()=>{if(!(!e.data||d)){f(!0);try{await navigator.clipboard.writeText(JSON.stringify({version:e.data.version,checks:e.data.checks},null,2)),c(`Diagnostics copied`)}catch{c(`Could not copy diagnostics. Please try again.`,{tone:`danger`})}finally{f(!1)}}},y=e.data?.checks.length??4;return(0,T.jsxs)(h,{route:`workspace-tools`,density:e.data?m(y):`full`,bodyClassName:`gap-5`,header:{title:`Workspace tools`,subtitle:`Check local CLI tools, then add projects.`},children:[(0,T.jsx)(M,{health:e,runners:o,copying:d,onCopy:v,recheckStatus:p,onRecheck:_}),(0,T.jsx)(A,{projectsDir:t,home:n,onAction:u}),l===`new`?(0,T.jsx)(x,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`local`?(0,T.jsx)(C,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`clone`?(0,T.jsx)(b,{open:!0,onOpenChange:e=>{e||u(null)}}):null]})}export{P as WorkspaceToolsRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,U as i,bt as a,ht as o,rt as s}from"./queries-CPNrCEon.js";import{a as c}from"./project-scope-context-_6sNMsAf.js";import{n as l}from"./chunk-KS7C4IRE-BdLLx37K.js";import{t as u}from"./chevron-right-BENZ-1ZN.js";import{t as d}from"./external-link-BE6y205O.js";import{t as f}from"./button-BV_AiLj2.js";import{t as p}from"./status-dot-Dvy-rnDJ.js";import{f as m,o as h}from"./page-shell-BdjH5hyc.js";import{t as g}from"./agents-settings-path-7X6_cvUg.js";import{In as _,Rn as v,cn as y,cr as b,or as x,sn as S,ur as C}from"./index-CIyGnGfm.js";var w=e(t(),1),T=n();function E(e){let t=e.replace(/\binstall\b/g,(e,t)=>t===0?`Install`:e),n=t.split(/(`[^`]+`)/g);if(n.length===1){let e=t.split(/(\bgh auth login\b)/g);return e.length===1?t:e.map((e,t)=>e===`gh auth login`?(0,T.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:e},t):(0,T.jsx)(`span`,{children:e},t))}return n.map((e,t)=>e.startsWith("`")&&e.endsWith("`")&&e.length>2?(0,T.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:e.slice(1,-1)},t):e?(0,T.jsx)(`span`,{children:e},t):null)}function D(e,t){let n=o(t,e);return n?{label:n.displayName,isAgent:!0}:{label:e,isAgent:!1}}function O({mode:e,version:t,rawVersion:n}){return e?(0,T.jsx)(`span`,{"data-slot":`tool-dry-run`,title:n,className:`shrink-0 rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:e.label}):t?(0,T.jsxs)(`span`,{className:`min-w-0 break-words`,children:[`· `,t]}):null}var k=`text-xs font-medium`;function A({projectsDir:e,home:t,onAction:n}){return(0,T.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-card-edge bg-card px-6 py-4 shadow-card max-md:px-4`,"aria-labelledby":`projects-heading`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`h2`,{id:`projects-heading`,className:`text-sm font-semibold text-foreground`,children:`Projects`}),(0,T.jsx)(`p`,{className:`mt-0.5 text-[13px] leading-[1.5] text-muted-foreground`,children:`Start a repository, open a local folder, or clone from GitHub.`})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,T.jsx)(f,{variant:`outline`,size:`sm`,className:k,"data-action":`new-project`,onClick:()=>n(`new`),children:`New project`}),(0,T.jsx)(f,{variant:`outline`,size:`sm`,className:k,onClick:()=>n(`local`),children:`Open local folder`}),(0,T.jsx)(f,{variant:`outline`,size:`sm`,className:k,onClick:()=>n(`clone`),children:`Clone from GitHub`})]})]}),e?(0,T.jsxs)(`p`,{"data-slot":`projects-checkout`,className:`flex min-w-0 items-baseline gap-1.5 text-xs text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`shrink-0`,children:`New clones go to`}),(0,T.jsx)(v,{value:e,bases:{home:t,root:null},className:`text-foreground`})]}):null]})}function j({recovery:e}){let t=`${k} ml-auto`;return e.kind===`settings`?(0,T.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,className:t,children:(0,T.jsxs)(l,{to:e.to,"data-slot":`tool-setup`,children:[e.label,(0,T.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})}):(0,T.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,className:t,children:(0,T.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,"data-slot":`tool-setup`,children:[e.label,(0,T.jsx)(d,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,T.jsx)(`span`,{className:`sr-only`,children:` (opens in a new tab)`})]})})}function M({health:e,runners:t,copying:n,onCopy:r,recheckStatus:i,onRecheck:a}){return(0,T.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-card-edge bg-card p-6 shadow-card max-md:p-4`,"aria-labelledby":`tools-heading`,children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{id:`tools-heading`,className:`text-base font-semibold text-foreground`,children:`Tools diagnostics`}),(0,T.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.5] text-muted-foreground`,children:`Check the tools available to this local workspace.`})]}),(0,T.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,className:k,children:(0,T.jsxs)(l,{to:g,"data-slot":`tools-settings`,children:[`Tool settings`,(0,T.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})})]}),e.isError?(0,T.jsx)(`p`,{role:`alert`,className:`text-sm text-semantic-red`,children:`Could not refresh tool diagnostics. Recheck to retry.`}):null,!e.data&&!e.isError?(0,T.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Checking installed tools…`}):null,e.data?(0,T.jsx)(`dl`,{className:`divide-y divide-border border-y border-border text-[13px] leading-[1.5] text-muted-foreground`,children:e.data.checks.map(e=>{let n=S(e),r=D(e.name,t),i=_(e),a=y(e,t);return(0,T.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":e.available,className:`grid grid-cols-1 gap-x-4 gap-y-1 py-3 sm:grid-cols-[160px_minmax(0,1fr)] sm:items-center`,children:[(0,T.jsxs)(`dt`,{className:`flex items-center gap-2.5`,children:[(0,T.jsx)(p,{tone:i.availability.tone,shape:i.availability.shape}),(0,T.jsx)(`span`,{className:r.isAgent?`text-[14px] font-semibold text-foreground`:`font-mono text-[13px] font-semibold text-foreground`,children:r.label})]}),(0,T.jsxs)(`dd`,{className:`flex min-w-0 items-center gap-x-1.5 text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`shrink-0`,children:i.availability.label}),(0,T.jsx)(O,{mode:i.mode,version:i.version,rawVersion:i.rawVersion}),a?(0,T.jsx)(j,{recovery:a}):null]}),n?(0,T.jsx)(`dd`,{"data-slot":`tool-hint`,className:`min-w-0 break-words text-xs leading-relaxed text-muted-foreground sm:col-start-2`,children:E(n)}):null]},e.name)})}):null,e.data?.checks.length===0?(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tool diagnostics reported by this server.`}):null,(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,T.jsx)(f,{variant:`outline`,className:`rounded-lg px-3.5 text-xs font-medium`,disabled:e.isFetching,onClick:()=>void a(),children:e.isFetching?`Checking tools…`:`Recheck tools`}),(0,T.jsx)(f,{variant:`outline`,className:`rounded-lg px-3.5 text-xs font-medium`,disabled:!e.data||n,onClick:()=>void r(),children:n?`Copying…`:`Copy diagnostics`}),(0,T.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`text-xs text-muted-foreground`,children:i?(0,T.jsx)(`span`,{"data-slot":`recheck-status`,children:i}):null})]})]})}function N(e,t){let n=e.filter(e=>e.available).length;return`Rechecked at ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})} — ${n} of ${e.length} ${e.length===1?`tool`:`tools`} available.`}function P(){let e=r(),t=i().data?.projectsDir,n=s().data?.homeDir??null,o=a().data,[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(!1),[p,g]=(0,w.useState)(null),_=async()=>{g(null);let t=await e.refetch();t.isError||!t.data||g(N(t.data.checks,new Date))},v=async()=>{if(!(!e.data||d)){f(!0);try{await navigator.clipboard.writeText(JSON.stringify({version:e.data.version,checks:e.data.checks},null,2)),c(`Diagnostics copied`)}catch{c(`Could not copy diagnostics. Please try again.`,{tone:`danger`})}finally{f(!1)}}},y=e.data?.checks.length??4;return(0,T.jsxs)(h,{route:`workspace-tools`,density:e.data?m(y):`full`,bodyClassName:`gap-5`,header:{title:`Workspace tools`,subtitle:`Check local CLI tools, then add projects.`},children:[(0,T.jsx)(M,{health:e,runners:o,copying:d,onCopy:v,recheckStatus:p,onRecheck:_}),(0,T.jsx)(A,{projectsDir:t,home:n,onAction:u}),l===`new`?(0,T.jsx)(x,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`local`?(0,T.jsx)(C,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`clone`?(0,T.jsx)(b,{open:!0,onOpenChange:e=>{e||u(null)}}):null]})}export{P as WorkspaceToolsRoute};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,g as i,on as a,zn as o}from"./queries-CPNrCEon.js";import{I as s,Xn as c,Zn as l,a as u,ha as d,wn as f}from"./project-scope-context-_6sNMsAf.js";import{d as p}from"./design-icons-QbNMZniQ.js";import{t as m}from"./project-router-l_pJCK5X.js";import{t as h}from"./centered-state-N8vWM_Hw.js";import{_r as g}from"./index-BAXboPqe.js";import{n as _,r as v,t as y}from"./remote-settings-notice-ByPYNQyB.js";import{n as b}from"./settings-field-AyinSFR_.js";import{n as x}from"./project-location-CvZY7aOx.js";import{r as S}from"./settings-save-bar-DzbndGGQ.js";import{n as C}from"./saved-draft-BwzBc-_Y.js";var w=e(t(),1),T=n();function E({copy:e,savedCommandCount:t,settingsAdmin:n,configPath:r,issue:i,invalid:a,children:o}){let s=e.slot;return(0,T.jsxs)(T.Fragment,{children:[t===0&&i===null?(0,T.jsx)(`p`,{"data-slot":`${s}-empty`,className:`text-xs text-muted-foreground`,children:e.empty}):null,o,n===!1?(0,T.jsxs)(`p`,{"data-slot":`${s}-readonly`,className:`text-xs text-foreground`,children:[`Edit `,(0,T.jsxs)(`code`,{children:[e.key,`.commands`]}),` in`,` `,r===null?(0,T.jsxs)(T.Fragment,{children:[`the project’s `,(0,T.jsx)(`code`,{children:`.ai/cezar/config.json`})]}):(0,T.jsx)(`code`,{className:`break-all`,children:r}),` `,`on the machine running Squawk. `,e.fileEditApplies,` No restart is needed. To edit here, the host operator runs `,(0,T.jsx)(`code`,{children:y}),`.`]}):null,i===null?null:(0,T.jsxs)(`p`,{"data-slot":`${s}-issue`,className:`text-xs text-danger`,children:[`config.json has an invalid `,e.key,` (`,i,`) — saving replaces it.`]}),a===null?null:(0,T.jsx)(`p`,{"data-slot":`${s}-invalid`,className:`text-xs text-danger`,children:a})]})}function D(e,t){let n=e.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,g as i,on as a,zn as o}from"./queries-CPNrCEon.js";import{I as s,Xn as c,Zn as l,a as u,ha as d,wn as f}from"./project-scope-context-_6sNMsAf.js";import{d as p}from"./design-icons-QbNMZniQ.js";import{t as m}from"./project-router-l_pJCK5X.js";import{t as h}from"./centered-state-N8vWM_Hw.js";import{_r as g}from"./index-CIyGnGfm.js";import{n as _,r as v,t as y}from"./remote-settings-notice-tNcad9fA.js";import{n as b}from"./settings-field-AyinSFR_.js";import{n as x}from"./project-location-bPiIsStE.js";import{r as S}from"./settings-save-bar-l5vO-fT3.js";import{n as C}from"./saved-draft-BwzBc-_Y.js";var w=e(t(),1),T=n();function E({copy:e,savedCommandCount:t,settingsAdmin:n,configPath:r,issue:i,invalid:a,children:o}){let s=e.slot;return(0,T.jsxs)(T.Fragment,{children:[t===0&&i===null?(0,T.jsx)(`p`,{"data-slot":`${s}-empty`,className:`text-xs text-muted-foreground`,children:e.empty}):null,o,n===!1?(0,T.jsxs)(`p`,{"data-slot":`${s}-readonly`,className:`text-xs text-foreground`,children:[`Edit `,(0,T.jsxs)(`code`,{children:[e.key,`.commands`]}),` in`,` `,r===null?(0,T.jsxs)(T.Fragment,{children:[`the project’s `,(0,T.jsx)(`code`,{children:`.ai/cezar/config.json`})]}):(0,T.jsx)(`code`,{className:`break-all`,children:r}),` `,`on the machine running Squawk. `,e.fileEditApplies,` No restart is needed. To edit here, the host operator runs `,(0,T.jsx)(`code`,{children:y}),`.`]}):null,i===null?null:(0,T.jsxs)(`p`,{"data-slot":`${s}-issue`,className:`text-xs text-danger`,children:[`config.json has an invalid `,e.key,` (`,i,`) — saving replaces it.`]}),a===null?null:(0,T.jsx)(`p`,{"data-slot":`${s}-invalid`,className:`text-xs text-danger`,children:a})]})}function D(e,t){let n=e.split(`
2
2
  `).map(e=>e.trim()).filter(e=>e!==``),r=Number(t);return{commands:n,timeoutSeconds:r,invalid:n.length>20?`Enter at most 20 commands.`:n.some(e=>e.length>4e3)?`Keep each command under ${c.toLocaleString(`en-US`)} characters.`:t.trim()===``||!Number.isInteger(r)||r<1||r>7200?`Enter a whole number of seconds from 1 to ${l}.`:null}}var O={setup:{key:`worktreeSetup`,issueKey:`worktreeSetupIssue`,slot:`worktree-setup`,title:`Prepare new worktrees`,hint:`Runs in order in every new task and worker worktree before the agent starts. The first failure stops setup.`,empty:`No setup commands configured. No commands will run in new worktrees.`,label:`Worktree setup commands, one per line`,example:`npm ci`,fileEditApplies:`Valid file edits apply to new worktrees.`},teardown:{key:`worktreeTeardown`,issueKey:`worktreeTeardownIssue`,slot:`worktree-teardown`,title:`Stop worker services before destroy`,hint:`Runs in order in a worker’s worktree when the worker is destroyed, before its processes stop. The first failure stops teardown; destroy goes on and records it on the worker.`,empty:`No teardown commands configured. Destroy runs no commands in worker worktrees.`,label:`Worktree teardown commands, one per line`,example:`docker compose down`,fileEditApplies:`Valid file edits apply to the next worker destroy.`}};function k(e,t){return t?`One command per line, for example: ${e.example}`:void 0}function A({config:e,copy:t}){let n=d(),i=r(),c=v(),p=x(),m=p===null?null:`${p.replace(/\/$/,``)}/.ai/cezar/config.json`,h=i.data?.capabilities?.settingsAdmin===!0,g=e[t.key],y=e[t.issueKey],O=g?.commands??[],A=g?.timeoutSeconds??900,[j,M]=C(O.join(`
3
3
  `)),[N,P]=C(String(A)),{commands:F,timeoutSeconds:I,invalid:L}=D(j,N),R=F.length===O.length&&F.every((e,t)=>e===O[t])&&(F.length===0||I===A),z=o({mutationFn:e=>s(e),onSuccess:e=>{n.setQueryData(a.config,e),M(F.join(`
4
4
  `))},onError:e=>{u(e.message,{tone:`danger`}),e instanceof f&&e.status===409&&c()}}),B=()=>z.mutateAsync({[t.key]:F.length===0?null:{commands:F,...I===900?{}:{timeoutSeconds:I}}}),[V,H]=(0,w.useState)(null);S({dirty:h&&(y!==null&&y!==V||!R),holdsReload:h&&!R,invalid:L!==null,save:B,discard:()=>{M(O.join(`
@@ -59,7 +59,7 @@
59
59
  }
60
60
  })()
61
61
  </script>
62
- <script type="module" crossorigin src="/assets/index-BAXboPqe.js"></script>
62
+ <script type="module" crossorigin src="/assets/index-CIyGnGfm.js"></script>
63
63
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
64
64
  <link rel="modulepreload" crossorigin href="/assets/react-runtime-CCIEwYL0.js">
65
65
  <link rel="modulepreload" crossorigin href="/assets/host-context-KsSKxKbI.js">
@@ -126,7 +126,7 @@
126
126
  <link rel="modulepreload" crossorigin href="/assets/centered-state-N8vWM_Hw.js">
127
127
  <link rel="modulepreload" crossorigin href="/assets/html-report-BX3msvci.js">
128
128
  <link rel="stylesheet" crossorigin href="/assets/page-shell-CEIoW56O.css">
129
- <link rel="stylesheet" crossorigin href="/assets/index-B5vWsR62.css">
129
+ <link rel="stylesheet" crossorigin href="/assets/index-BToDejlf.css">
130
130
  </head>
131
131
  <body>
132
132
  <div id="root"></div>