@hearsay-tools/squawk 0.19.0-dev.8956 → 0.19.0-dev.8959
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/delegation/routes.d.ts +65 -65
- package/dist/features/automations/automations-routes.d.ts +150 -150
- package/dist/server/models-routes.d.ts +12 -12
- package/dist/server/project-settings-routes.d.ts +107 -107
- package/dist/server/projects-routes.d.ts +45 -45
- package/dist/server/provider-sign-in-routes.d.ts +2 -2
- package/dist/server/reports-api.d.ts +2 -2
- package/dist/server/runners-routes.d.ts +10 -10
- package/dist/server/runs-routes.d.ts +4 -4
- package/dist/server/server.d.ts +1208 -1208
- package/package.json +4 -4
- package/web/dist/assets/{accounts-section-DQNWKGdd.js → accounts-section-Iuso5EHy.js} +1 -1
- package/web/dist/assets/{activity-motion-dg8xQovm.js → activity-motion-CNZbrIKs.js} +1 -1
- package/web/dist/assets/{activity-route-pAplJbQ-.js → activity-route-HjCeTGFh.js} +1 -1
- package/web/dist/assets/{agent-config-section-DXLK8TWx.js → agent-config-section-D3ASkT9C.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-CHo6SV_E.js → agent-defaults-section-B9ooGC8t.js} +1 -1
- package/web/dist/assets/{appearance-BBm_1-0d.js → appearance-OFbvt85o.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-BpxWzA-s.js → archive-on-merge-field-BvtuaspW.js} +1 -1
- package/web/dist/assets/{automations-route-Bgz1q3d_.js → automations-route-C6uMU-W3.js} +2 -2
- package/web/dist/assets/{command-BMMjB5k9.js → command-BiBq24zL.js} +1 -1
- package/web/dist/assets/{commit-list-DsQ8tZV9.js → commit-list-Dg-dPG_J.js} +1 -1
- package/web/dist/assets/{design-icons-BZt8Kqs9.js → design-icons-QbNMZniQ.js} +1 -1
- package/web/dist/assets/{dialog-CB9ZhEk2.js → dialog-DRZuXvul.js} +1 -1
- package/web/dist/assets/{diff-H-hamhtW.js → diff-2NATw62W.js} +2 -2
- package/web/dist/assets/{diff-controls-BvvrHTu_.js → diff-controls-DkJTGyU5.js} +1 -1
- package/web/dist/assets/{diff-view-Deq7mb3J.js → diff-view-CW-GN8t7.js} +1 -1
- package/web/dist/assets/{discard-changes-dialog-C06t2BR5.js → discard-changes-dialog-BXfDdnph.js} +1 -1
- package/web/dist/assets/{dropdown-menu-VFda6KAg.js → dropdown-menu-DjtKUK8F.js} +1 -1
- package/web/dist/assets/{file-preview-D8pCQdne.js → file-preview-BJ6Q-VPN.js} +1 -1
- package/web/dist/assets/{git-toolbar-DvMZegJ7.js → git-toolbar-C68CnIDL.js} +1 -1
- package/web/dist/assets/github-Dqk0cII6.js +1 -0
- package/web/dist/assets/{global-activity-route-Dm_kAVcm.js → global-activity-route-CoxiPpqk.js} +1 -1
- package/web/dist/assets/index-CM_iAvs4.css +1 -0
- package/web/dist/assets/{index-Byw2yW7N.js → index-MCtGGYNa.js} +6 -6
- package/web/dist/assets/{markdown-BQab8jF1.js → markdown-Vws-ZDQC.js} +1 -1
- package/web/dist/assets/{open-in-menu-Uw-sJhbG.js → open-in-menu-BTa2aBQh.js} +1 -1
- package/web/dist/assets/{option-select-JTiDFrqF.js → option-select-C7M2fzIw.js} +1 -1
- package/web/dist/assets/{preferences-section-C-j7m5yZ.js → preferences-section-C_T_KjBg.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-BnuUrbmD.js → preview-pane-connected-CXUd2utJ.js} +1 -1
- package/web/dist/assets/{project-location-Dyn7zI6j.js → project-location-Db8_ITcg.js} +1 -1
- package/web/dist/assets/{projects-section-DzIrNvrh.js → projects-section-CFTrO5BI.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-DtNo6kjG.js → prompt-templates-section-DtlXhJiK.js} +2 -2
- package/web/dist/assets/reference-chip-Br0H2srF.js +1 -0
- package/web/dist/assets/{remote-settings-notice-C7V8JZt9.js → remote-settings-notice-BVvV6edA.js} +1 -1
- package/web/dist/assets/{repo-git-DBnTvj5D.js → repo-git-ymL5_ed2.js} +1 -1
- package/web/dist/assets/{report-reader-C7MtQlUw.js → report-reader-c0AG1n4k.js} +1 -1
- package/web/dist/assets/{report-selection-BH0M_8bk.js → report-selection-dYsm1HEf.js} +1 -1
- package/web/dist/assets/{reports-BfqPAwGI.js → reports-BTVWwMou.js} +1 -1
- package/web/dist/assets/{resources-section-C2Dw4VR6.js → resources-section-BmLG8Lm0.js} +1 -1
- package/web/dist/assets/review-panel-B1Mt1hrO.js +11 -0
- package/web/dist/assets/{run-header-D_xptiSf.js → run-header-DyEbB88q.js} +2 -2
- package/web/dist/assets/{select-1ZfHanpO.js → select-dpKLmgZ_.js} +1 -1
- package/web/dist/assets/{session-context-section-CD_o7uNM.js → session-context-section-CXb8kIYJ.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-CaGxQRTa.js → settings-agent-picker-NGLgXFte.js} +1 -1
- package/web/dist/assets/{settings-list-detail-DcRsGkGy.js → settings-list-detail-Dn5CWzHj.js} +1 -1
- package/web/dist/assets/{settings-save-bar-BA6YnLcP.js → settings-save-bar-CfUNcwW4.js} +1 -1
- package/web/dist/assets/{settings-shell-CG1-kWWp.js → settings-shell-Dcv1oVB4.js} +1 -1
- package/web/dist/assets/{sidebar-section-kWgmwFom.js → sidebar-section-BeXW9JPy.js} +1 -1
- package/web/dist/assets/{skills-D-ZXx_Db.js → skills-BcCvvz3d.js} +1 -1
- package/web/dist/assets/{task-changes-CIrkn5L8.js → task-changes-Bj7JpmR_.js} +1 -1
- package/web/dist/assets/{task-commits-BZj5bFmc.js → task-commits-CgjVHKLR.js} +1 -1
- package/web/dist/assets/{task-file-scope-CkTckRi_.js → task-file-scope-CPI1TQ21.js} +1 -1
- package/web/dist/assets/{task-files-CVija0D3.js → task-files-nBsD7Mvo.js} +1 -1
- package/web/dist/assets/{task-github-item-C_7h7vWI.js → task-github-item-Bybg0bs5.js} +1 -1
- package/web/dist/assets/{task-thread-B5wy_92u.js → task-thread-CIl3Uj6Y.js} +2 -2
- package/web/dist/assets/{thread-state-c_QiK_1p.js → thread-state-DQUYVbcr.js} +1 -1
- package/web/dist/assets/use-hand-to-agent-state-CUDqVWwY.js +1 -0
- package/web/dist/assets/use-path-bases-BbEKGJNh.js +1 -0
- package/web/dist/assets/workflows-aqvasP6w.js +7 -0
- package/web/dist/assets/{workspace-tools-C7-39mKv.js → workspace-tools-BwjfFjb2.js} +1 -1
- package/web/dist/assets/{worktrees-section-B9ifd22S.js → worktrees-section-BcuizqIq.js} +1 -1
- package/web/dist/index.html +9 -9
- package/web/dist/assets/github-BDRo8fXv.js +0 -1
- package/web/dist/assets/index-erIRmS_2.css +0 -1
- package/web/dist/assets/reference-chip-Dk69XD7Q.js +0 -1
- package/web/dist/assets/review-panel--h2qOZ5y.js +0 -11
- package/web/dist/assets/use-hand-to-agent-state-D7BytpdB.js +0 -1
- package/web/dist/assets/use-path-bases-B7RXNQ5t.js +0 -1
- package/web/dist/assets/workflows-DUFAcnv8.js +0 -7
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{m as r,o as i,s as a}from"./dist-C_rn70hE.js";import{$ as o,$t as s,Ct as c,P as l,Wt as u,Xt as d,Yt as f,_ as p,dn as m,lt as h,rn as g,un as _}from"./queries-CIeJg62Y.js";import{Fn as v,ct as y,dr as b,hi as x,n as S,ot as C,pt as w,rr as T}from"./toaster-D0HMoto5.js";import{f as E,n as D,p as ee}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{I as te,V as O,Z as k,c as A,d as j,ft as ne,l as M,ot as re,pt as ie,q as ae,y as oe}from"./design-icons-BZt8Kqs9.js";import{t as N}from"./createLucideIcon-BHp8sXmF.js";import{t as se}from"./check-OP-CVgZG.js";import{t as ce}from"./chevron-right-BENZ-1ZN.js";import{t as le}from"./external-link-BE6y205O.js";import{t as ue}from"./eye-B8okNWXU.js";import{n as de}from"./smartphone-Lr8Ug2z_.js";import{t as fe}from"./loader-circle-CPBhhDbB.js";import{t as pe}from"./message-square-B-MD-8rD.js";import{n as me,t as he}from"./tool-display-B9NN44oU.js";import{t as ge}from"./square-terminal-B6RYYieR.js";import{t as P}from"./button-C8jUIs8Q.js";import{n as F,r as I,t as L}from"./collapsible-Bx2vViFx.js";import{t as R}from"./project-router-BHFXTx5l.js";import{O as _e}from"./task-groups-C9pTQm-2.js";import{a as ve,c as ye,i as be,l as xe,o as Se,s as Ce,t as we}from"./report-selection-BH0M_8bk.js";import{n as Te}from"./centered-state-BgSV4e79.js";import{L as Ee,Q as De,an as Oe,ar as ke,fn as Ae,gn as je,gr as Me,hn as Ne,rn as Pe,tn as Fe,ur as Ie,xn as Le}from"./index-Byw2yW7N.js";import{i as Re,r as ze}from"./highlighter-Cfo7mLVB.js";import{t as Be}from"./zoomable-image-BUTgYpld.js";import{i as Ve,r as He,t as z}from"./markdown-BQab8jF1.js";import{r as Ue}from"./html-report-BX3msvci.js";import{t as B}from"./textarea-vEsJAUAV.js";import{t as We}from"./task-file-scope-CkTckRi_.js";import{t as Ge}from"./report-title-D4Mbu2Er.js";var Ke=N(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),qe=N(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Je=N(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),Ye=N(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Xe=N(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Ze=N(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),V=e(t(),1),H=n();function Qe(e,t){if(e.length===1)return[t.replace(RegExp(`^${$e(e[0].header)}: ?`),``)];let n=t,r=[];for(let[t,i]of e.entries()){let a=`${i.header}: `;if(!n.startsWith(a))return;n=n.slice(a.length);let o=e[t+1],s=o?n.indexOf(`\n${o.header}: `):n.length;if(s<0)return;r.push(n.slice(0,s)),n=n.slice(s+1)}return r}function $e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function et(e,t){if(t===void 0)return[];let n=e.options??[];if(!e.multiSelect)return n.filter(e=>e.label===t).map(e=>e.label);let r=[];function i(e,t){for(let{label:a}of n)t.includes(a)||(e===a?r.push([...t,a]):e.startsWith(`${a}, `)&&i(e.slice(a.length+2),[...t,a]))}return i(t,[]),r.length===1?r[0]:[]}var tt=`
|
|
2
|
-
|
|
3
|
-
Additional comments:
|
|
4
|
-
`;function nt(e){let t=e.indexOf(tt);if(t<0)return{body:e,comment:void 0};let n=e.slice(t+23).trim();return{body:e.slice(0,t),comment:n||void 0}}function rt({ask:e}){let t=e.answer===void 0?void 0:nt(e.answer),n=t===void 0?void 0:Qe(e.questions,t.body);return(0,H.jsxs)(`div`,{"data-slot":`ask-answers`,className:`flex flex-col gap-4 text-sm`,children:[e.questions.map((t,r)=>{let i=n?.[r],a=et(t,i),o=i!==void 0&&a.length===0;return(0,H.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-label":t.question,children:[(0,H.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[t.header,` · Question `,r+1,` of `,e.questions.length]}),(0,H.jsx)(`p`,{className:`break-words font-semibold`,children:t.question}),t.options?(0,H.jsxs)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:[t.options.map(e=>(0,H.jsxs)(`li`,{"data-selected":a.includes(e.label),className:`flex items-start gap-2 rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border data-[selected=true]:bg-message-user-accent/5`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-message-user-accent`,children:a.includes(e.label)?`✓`:`○`}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,H.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description}):null]}),a.includes(e.label)?(0,H.jsx)(`span`,{className:`shrink-0 text-xs text-message-user-accent`,children:`Selected`}):null]},e.label)),(0,H.jsxs)(`li`,{"data-selected":o,className:`rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border`,children:[(0,H.jsxs)(`p`,{className:`flex items-start gap-2 font-medium`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`text-message-user-accent`,children:o?`✓`:`○`}),(0,H.jsx)(`span`,{className:`flex-1`,children:`Other`}),o?(0,H.jsx)(`span`,{className:`text-xs text-message-user-accent`,children:`Selected`}):null]}),o?(0,H.jsx)(U,{text:i}):null]})]}):i===void 0?null:(0,H.jsx)(U,{text:i})]},t.id??r)}),n&&t?.comment?(0,H.jsxs)(`section`,{className:`flex flex-col gap-1`,"aria-label":`Additional comments`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`Additional comments`}),(0,H.jsx)(U,{text:t.comment})]}):null,!n&&e.answer!==void 0?(0,H.jsx)(U,{text:e.answer}):null]})}function U({text:e}){return(0,H.jsx)(`blockquote`,{className:`[margin-block-start:0.5rem] border-s-2 border-message-user-accent ps-3 break-words whitespace-pre-wrap`,children:e})}function W(e,t,n){let r=n[e];return r===void 0?(t[e]?.length??0)>0:r.trim().length>0}function it(e,t,n){let r=n[e]?.trim();if(r)return r;let i=t[e]??[];return i.length>0?i.join(`, `):`Not answered yet`}function at({stepped:e,mode:t,onModeChange:n,showModeSwitch:r,stepLabel:a,hasSheetContext:o,showContextButtonRef:s,onOpenContext:c,onShowOrigin:l}){return(0,H.jsxs)(`div`,{"data-slot":`ask-header`,className:`flex shrink-0 flex-wrap items-center gap-x-2 gap-y-1 border-b border-border/70 px-2.5 py-1.5 md:px-3 md:py-2`,children:[(0,H.jsx)(`span`,{className:`text-xs font-semibold text-link-foreground`,children:`Needs your answer`}),e&&t===`options`?(0,H.jsx)(`span`,{"data-slot":`ask-step-indicator`,className:`rounded-full bg-accent-strong/15 px-2 py-0.5 text-xs font-semibold text-foreground tabular-nums`,children:a}):null,(0,H.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[o?(0,H.jsxs)(P,{ref:s,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,onClick:c,children:[(0,H.jsx)(Ie,{"aria-hidden":`true`,className:`size-3.5`}),`Show context`]}):l?(0,H.jsx)(ft,{onShowOrigin:l}):null,r?(0,H.jsxs)(`div`,{"data-slot":`ask-mode-switch`,role:`group`,"aria-label":`Reply mode`,className:`inline-flex items-center rounded-lg border border-border bg-card p-0.5`,children:[(0,H.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-options`,"aria-pressed":t===`options`,onClick:()=>n(`options`),className:i(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`options`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Options`}),(0,H.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-reply`,"aria-pressed":t===`reply`,onClick:()=>n(`reply`),className:i(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`reply`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Write a reply`})]}):null]})]})}function ot({questions:e,stepIndex:t,selections:n,otherAnswers:r,hasComment:a,onSelectStep:o}){let s=e.length;return(0,H.jsxs)(`div`,{"data-slot":`ask-step-pills`,role:`group`,"aria-label":`Question steps`,className:`hidden shrink-0 flex-wrap items-center gap-1.5 border-b border-border/60 px-3 py-1.5 md:flex`,children:[e.map((e,a)=>{let s=t===a,c=W(a,n,r);return(0,H.jsxs)(`button`,{type:`button`,"aria-current":s?`step`:void 0,onClick:()=>o(a),className:i(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,s?`border-accent-strong bg-accent-strong/15 text-foreground`:c?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,H.jsx)(`span`,{className:`tabular-nums text-xs font-semibold`,children:c?(0,H.jsx)(se,{"aria-hidden":`true`,className:`size-3 text-semantic-green`}):`${a+1}.`}),(0,H.jsx)(`span`,{className:`max-w-[140px] truncate`,children:e.header})]},e.id??a)}),(0,H.jsxs)(`button`,{type:`button`,"aria-current":t===s?`step`:void 0,onClick:()=>o(s),className:i(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,t===s?`border-accent-strong bg-accent-strong/15 text-foreground`:a?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-dashed border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,H.jsx)(Xe,{"aria-hidden":`true`,className:`size-3`}),(0,H.jsx)(`span`,{children:`Comment`})]})]})}function st({questions:e,selections:t,otherAnswers:n,comment:r,disabled:a,onCommentChange:o,onJumpToQuestion:s}){let c=(0,V.useId)();return(0,H.jsxs)(`div`,{"data-slot":`ask-comment-step`,className:`flex flex-col gap-2.5`,children:[(0,H.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-2.5`,children:[(0,H.jsx)(`p`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Selected answers`}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,r)=>{let a=W(r,t,n);return(0,H.jsxs)(`li`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>s(r),className:`min-h-11 text-start font-medium text-link-foreground underline-offset-4 hover:underline md:min-h-6`,children:e.header}),(0,H.jsx)(`span`,{className:i(`min-w-0 truncate text-end`,a?`text-foreground`:`text-semantic-red`),children:it(r,t,n)})]},e.id??r)})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{htmlFor:c,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,H.jsx)(B,{id:c,"data-slot":`ask-additional-comment`,rows:2,value:r,disabled:a,placeholder:`Optional extra notes to send with your selections…`,onChange:e=>o(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}function ct({value:e,onValueChange:t,disabled:n,renderFreeTextReply:r}){let i=(0,V.useId)();return r?(0,H.jsx)(`div`,{"data-slot":`ask-free-text`,children:r({value:e,onValueChange:t,disabled:n})}):(0,H.jsxs)(`div`,{"data-slot":`ask-free-text`,className:`flex flex-col gap-2`,children:[(0,H.jsx)(`label`,{htmlFor:i,className:`text-xs font-medium text-foreground`,children:`Reply to the agent`}),(0,H.jsx)(B,{id:i,rows:2,value:e,disabled:n,placeholder:`Write a free-text reply…`,onChange:e=>t(e.target.value),className:`bg-card text-base md:text-[13px]`})]})}function lt({stepIndex:e,questionCount:t,answeredCount:n,allAnswered:r,hasComment:a,resuming:o,disabled:s,onBack:c,onNext:l,onOpenComment:u,onSend:d,questions:f,selections:p,otherAnswers:m,stopControl:h}){let g=e===t-1,_=e===t,v=o?`Send answer & reopen`:`Send answer`;return(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e>0?(0,H.jsxs)(P,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:c,children:[(0,H.jsx)(Me,{"aria-hidden":`true`,className:`size-4`}),`Back`]}):null,(0,H.jsxs)(`span`,{"data-slot":`ask-progress-dots`,"aria-hidden":`true`,className:`flex items-center gap-1.5 px-1 md:hidden`,children:[f.map((t,n)=>{let r=n===e,a=W(n,p,m);return(0,H.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,r?`bg-accent-strong`:a?`bg-success`:`bg-border`)},t.id??n)}),(0,H.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,_?`bg-accent-strong`:a?`bg-success`:`bg-border/60`)})]}),(0,H.jsxs)(`span`,{"data-slot":`ask-progress-summary`,className:`hidden text-xs text-soft-foreground tabular-nums sm:inline`,children:[n,` of `,t,` answered`]}),o?(0,H.jsx)(`span`,{"data-slot":`ask-resume-hint`,className:`text-xs text-soft-foreground`,children:`Reopens the closed session.`}):null,(0,H.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[h,!g&&!_?(0,H.jsxs)(P,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:l,children:[`Next`,(0,H.jsx)(ce,{"aria-hidden":`true`,className:`size-4`})]}):null,g?(0,H.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:u,children:a?`Edit comment`:`+ Comment`}):null,g||_||r?(0,H.jsx)(P,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:s||!r,onClick:d,children:v}):null]})]})}function ut({oneTap:e,hasOtherAnswer:t,allowComment:n,commentOpen:r,hasComment:i,resuming:a,disabled:o,onToggleComment:s,onSend:c,stopControl:l}){return(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n?(0,H.jsxs)(P,{type:`button`,variant:`ghost`,size:`sm`,className:`min-h-11 min-w-11 px-2 text-xs text-muted-foreground hover:text-foreground md:min-h-8 md:min-w-0`,onClick:s,children:[(0,H.jsx)(Xe,{"aria-hidden":`true`,className:`size-3.5`}),r?`Hide comment`:i?`Edit comment`:`+ Add comment`]}):null,(0,H.jsx)(`span`,{"data-slot":a?`ask-resume-hint`:`ask-hint`,className:`text-xs text-soft-foreground`,children:a?`Reopens the closed session.`:e?`Tap an option to send.`:`Choose an answer, then send.`}),(0,H.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[l,!e||t||r||i?(0,H.jsx)(P,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:o,onClick:c,children:a?`Send answer & reopen`:`Send answer`}):null]})]})}function dt({blockedBy:e,reason:t,error:n}){return(0,H.jsxs)(H.Fragment,{children:[t?(0,H.jsxs)(`p`,{"data-slot":`ask-blocked-reason`,className:`text-xs text-muted-foreground`,children:[t,` `,e===`provider`?(0,H.jsx)(R,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null]}):null,n?(0,H.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:n}):null]})}function ft({onShowOrigin:e,className:t}){return(0,H.jsx)(P,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-origin`,onClick:e,className:i(`min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,t),children:`Show where it was asked`})}function pt({open:e,onOpenChange:t,runId:n,context:r,onShowOrigin:i,returnFocusRef:a}){let o=(0,V.useRef)(!1);return(0,H.jsx)(be,{open:e,onOpenChange:t,children:(0,H.jsxs)(Se,{side:`right`,showCloseButton:!1,"data-slot":`ask-context-sheet`,className:`flex w-full max-w-[540px] flex-col gap-0 p-0 sm:max-w-[540px]`,onCloseAutoFocus:e=>{if(e.preventDefault(),o.current){o.current=!1,i?.();return}a?.current?.focus()},children:[(0,H.jsxs)(ye,{className:`relative shrink-0 border-b border-border px-5 py-4 pr-14`,children:[(0,H.jsx)(xe,{children:`Question context`}),(0,H.jsx)(Ce,{children:`Your selections and drafts stay intact while you read.`}),(0,H.jsx)(ve,{asChild:!0,children:(0,H.jsx)(P,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,className:`absolute inset-bs-2 end-2 size-11 md:size-9`,children:(0,H.jsx)(ie,{"aria-hidden":`true`,className:`size-4`})})})]}),(0,H.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain break-words px-5 py-4 text-sm text-foreground`,children:(0,H.jsx)(We,{runId:n,children:(0,H.jsx)(z,{breaks:!0,children:r})})}),i?(0,H.jsx)(`div`,{className:`flex shrink-0 items-center justify-end border-t border-border px-5 py-3`,children:(0,H.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-show-origin`,className:`min-h-11 md:min-h-8`,onClick:()=>{o.current=!0,t(!1),i()},children:`Show where it was asked`})}):null]})})}function mt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ht=/^[A-Za-z0-9_./:=+,@%-]+$/;function gt(e){return e.replaceAll(`'`,`'\\''`)}function _t(e){return e===``?`''`:ht.test(e)?e:`\u0027${gt(e)}\u0027`}function vt(e){if(!mt(e))return;let t=e.command;if(typeof t==`string`&&t!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.map(_t).join(` `)}}function yt(e){let t="`".repeat(3),n=`~`.repeat(3);return e.split(t).filter((e,t)=>t%2==0).join(` `).split(n).filter((e,t)=>t%2==0).join(` `).split("`").filter((e,t)=>t%2==0).join(` `)}function bt(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function xt(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function G(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function St(e){let t=yt(bt(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))G(e[2])&&n.set(e[1].toLowerCase(),e[2]);let r=t.replace(/^\s*\[[^\]]+\]:\s*\S+.*$/gm,` `),i=[];for(let e of r.matchAll(/(?<!!)\[((?:\\.|[^\]\\])+)\](?:\(((?:[^()\s]|\([^)]*\))+)(?:\s+"[^"]*")?\)|\[([^\]]*)\])|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+)/g)){if(e[2]){G(e[2])&&i.push({label:xt(e[1]),href:e[2]});continue}if(e[1]!==void 0&&e[3]!==void 0){let t=(e[3].length>0?e[3]:e[1]).toLowerCase(),r=n.get(t);r&&i.push({label:xt(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&G(t)&&i.push({label:t,href:t})}return i}var Ct=(0,V.createContext)(void 0),wt=(0,V.createContext)(void 0);function Tt(e,t){let n=new Map;for(let r of St(e)){let e=Ve(r.href,t);if(!e)continue;let i=new URL(e,`https://cockpit.invalid`),a=/^\/p\/([^/]+)\/tasks\/([^/]+)\/report$/.exec(i.pathname),o=/^\/tasks\/([^/]+)\/report$/.exec(i.pathname),s=i.searchParams.get(`artifact`);if(!s||(a?decodeURIComponent(a[1])!==t.projectId:!o))continue;let c=decodeURIComponent(a?a[2]:o[1]),l=`${c}:${s}`;n.has(l)||n.set(l,{runId:c,artifactId:s,label:r.label,href:e})}return[...n.values()]}function Et(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function Dt({text:e,messageKey:t}){let n=(0,V.useContext)(He),r=(0,V.useContext)(wt),i=t??r;if(!n||i===void 0)return null;let a=Tt(e,n);return a.length===0?null:(0,H.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,H.jsx)(Ot,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function Ot({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:a}=e,o=(0,V.useContext)(Ct),s=(0,V.useContext)(we);(0,V.useLayoutEffect)(()=>s?.register(n,r),[s,n,r]);let c=l(r,n),u=E(),d=ee();if(c.isError)return(0,H.jsx)(D,{id:Et(t,n),"data-slot":`report-card-fallback`,to:a,state:{readerFrom:u.pathname+u.search},children:i});let f=c.data?.artifact;if(f&&!Ue(f.name))return null;let p=new URLSearchParams(u.search);p.set(`report`,n),p.set(`card`,t);let m=new URLSearchParams(u.search).has(`report`)?u.state:null,h=new URLSearchParams(u.search);h.delete(`report`),h.delete(`card`);let g=`${u.pathname}${h.size?`?${h}`:``}`,_=window.navigation,v={reportCardEntry:!0,reportReturnTo:m?.reportReturnTo??g,reportReturnKey:m?.reportReturnKey??_?.currentEntry?.key,reportScrollTop:m?.reportScrollTop},y={pathname:u.pathname,search:`?${p}`,hash:new URL(a,`https://cockpit.invalid`).hash};return(0,H.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":c.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,H.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:f?Ge(f):i}),(0,H.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,H.jsx)(D,{id:Et(t,n),to:y,state:v,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),o?.(t);let n=v.reportScrollTop??(document.querySelector(`[data-slot="thread-transcript"]`)??document.querySelector(`[data-slot="main"]`))?.scrollTop;d(y,{state:{...v,reportScrollTop:n}})},className:`inline-flex min-h-11 min-w-11 items-center self-start rounded-md border border-border px-3 text-sm active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${c.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var kt={message:!0,reasoning:!0,tool:!0,hook:!0};function At(e){return Object.hasOwn(kt,e)&&kt[e]}var jt=e=>e.kind===`tool`,Mt=e=>e.kind===`conversation`,Nt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,Pt=(e,t,n)=>`${e} ${e===1?t:n}`;function Ft(e,t){let n=[];return e>0&&n.push(Pt(e,`file`,`files`)),t>0&&n.push(Pt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function It(e){return`${e} earlier tool call${e===1?``:`s`}`}var Lt=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function Rt(e){for(let t of Lt)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}var zt=new WeakMap;function Bt(e){let t=zt.get(e);if(t)return t;let n=Vt(e);return zt.set(e,n),n}function Vt(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!((e.kind===`reasoning`||e.kind===`message`)&&e.text.trim()===``)),n=new Set(t.filter(jt).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=At(e.kind)&&`parentItemId`in e&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:Ft(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of Ht(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(Mt(e)){s(),c.push(e);continue}l(),jt(e)&&Nt(e)&&!r.has(e.id)?o.push(e):(s(),jt(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function Ht(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&e.messages[0].relationship===`peer`==(n.relationship===`peer`)&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var Ut=new Map,Wt=(0,V.createContext)(null);function Gt(){return(0,V.useContext)(Wt)}function Kt({runId:e,children:t}){let n=(0,V.useMemo)(()=>({get:t=>Ut.get(e)?.get(t),set:(t,n)=>{let r=Ut.get(e)??new Map;r.set(t,n),Ut.set(e,r)}}),[e]);return(0,H.jsx)(Wt.Provider,{value:n,children:t})}function qt(e){return e.scrollTop<Math.max(600,e.clientHeight)}function Jt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function Yt(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function Xt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Zt(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Qt=new Map;function $t(e,t){Qt.set(e,t)}function en(e){return Qt.get(e)}var tn=new Map;function nn(e,t){tn.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function rn(e){return tn.get(e)}function an(e,t,n){let r=tn.get(e);if(!r||r.rows!==t)return;let i=r.rowKeys;if(!(n&&i&&(n.length!==t||i.length!==t||!n.every((e,t)=>e===i[t]))))return r.cache}var on=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),sn=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),cn=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),ln=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),un=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function K(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function q(e){let t=K(e);return t===void 0?void 0:on.format(t)}function dn(e){let t=K(e);return t===void 0?void 0:sn.format(t)}var J=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function fn(e){let t=K(e);return t===void 0?void 0:J(t)}function pn(e,t=new Date){let n=K(e);if(n===void 0)return;let r=J(n);return r===J(t)?`Today`:r===J(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?cn:ln).format(n)}function mn(e,t){let n=K(e),r=K(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function hn({ts:e}){let t=q(e);return t===void 0?null:(0,H.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:dn(e),className:`text-xs leading-none text-soft-foreground`,children:t})}function gn({startedAt:e,completedAt:t}){let n=q(t);if(n===void 0)return null;let r=mn(e,t);return(0,H.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-xs leading-none text-soft-foreground`,children:[(0,H.jsx)(`time`,{dateTime:t,title:dn(t),children:n}),r===void 0?null:(0,H.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function _n({ts:e}){let t=pn(e),n=K(e);if(t===void 0||n===void 0)return null;let r=un.format(n);return(0,H.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-xs font-medium text-soft-foreground`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,H.jsx)(`time`,{dateTime:fn(e),title:r,children:t}),(0,H.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var vn={assistant:`Agent message`,error:`Runner error`,"session.error":`Session error`,"step-end":`Step status`,lifecycle:`Run status`};function yn({note:e}){return e.icon===`handoff`?(0,H.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,H.jsx)(ke,{className:`size-3`})}),(0,H.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):e.details&&e.details.length>0?(0,H.jsxs)(L,{"data-slot":`note-line`,"data-tone":e.tone,className:`group/failure min-w-0 px-0.5 text-xs`,children:[(0,H.jsxs)(`div`,{className:i(`flex items-start gap-2`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[(0,H.jsxs)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap wrap-anywhere`,children:[e.tone===`danger`?`✗ `:null,e.text]}),(0,H.jsxs)(I,{"data-slot":`note-details-toggle`,className:`inline-flex shrink-0 items-center gap-1 rounded-sm px-1.5 py-0.5 text-xs font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11 max-md:justify-center pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-center`,children:[(0,H.jsx)(j,{"aria-hidden":`true`,className:`size-3 shrink-0 motion-safe:transition-transform group-data-[state=open]/failure:rotate-90`}),`Details`]})]}),(0,H.jsx)(F,{children:(0,H.jsx)(`ul`,{"data-slot":`note-details`,className:`mbs-1.5 flex flex-col gap-1 border-s border-border ps-3 font-mono text-xs text-muted-foreground`,children:e.details.map((e,t)=>(0,H.jsxs)(`li`,{className:`min-w-0 whitespace-pre-wrap wrap-anywhere`,children:[(0,H.jsxs)(`span`,{className:`font-sans font-medium text-foreground`,children:[vn[e.source],`:`,` `]}),e.text]},`${e.source}:${t}`))})})]}):(0,H.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:i(`px-0.5 text-xs`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:null,e.text]})}var bn={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-user-accent`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-agent-accent`,accent:`text-message-agent-accent`,body:`text-[15px] md:text-[14px]`}};function Y({role:e,children:t,className:n,ts:r,headerActions:a,...o}){let s=bn[e],c=r===void 0?void 0:q(r);return(0,H.jsxs)(`article`,{...o,"data-role":e,"aria-label":s.speaker,className:i(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,s.classes,n),children:[(0,H.jsxs)(`p`,{className:i(`m-0 flex w-full min-w-0 items-start gap-2 text-xs leading-[1.2] font-semibold tracking-[0.6px] uppercase`,s.accent),children:[(0,H.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 normal-case tracking-normal`,children:[(0,H.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,H.jsx)(pe,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),a]}),c===void 0?null:(0,H.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,H.jsx)(hn,{ts:r})})]}),(0,H.jsx)(`div`,{className:i(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,s.body,`leading-[1.6]`),children:t})]})}var xn=[],Sn=(0,V.memo)(function({text:e,imageCount:t=0,images:n=xn,ts:i,onEdit:a,onRemove:o,editLabel:s=`Edit message`,removeLabel:c=`Remove message`,children:l}){let u=t-n.length,[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(e),[h,g]=(0,V.useState)(!1),[_,v]=(0,V.useState)(),y=()=>{m(e),v(void 0),f(!0)},x=async()=>{let t=p.trim();if(!t||t===e){f(!1);return}g(!0),v(void 0);try{await a?.(t),f(!1)}catch(e){v(e instanceof Error?e.message:`Could not save the message`)}finally{g(!1)}},S=async()=>{g(!0),v(void 0);try{await o?.()}catch(e){v(e instanceof Error?e.message:`Could not remove the message`)}finally{g(!1)}};return d?(0,H.jsxs)(Y,{role:`user`,ts:i,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,H.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),f(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),x())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,H.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>f(!1),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:h?(0,H.jsx)(fe,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,H.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,H.jsxs)(Y,{role:`user`,ts:i,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,H.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[a?(0,H.jsx)(`button`,{type:`button`,"aria-label":s,onClick:y,disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,H.jsx)(Ze,{className:`size-3.5`})}):null,o?(0,H.jsx)(`button`,{type:`button`,"aria-label":c,onClick:()=>void S(),disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,H.jsx)(re,{className:`size-3.5`})}):null]}):null,_?(0,H.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,l??(0,H.jsx)(z,{breaks:!0,children:e}),n.length>0?(0,H.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>b(e.split(`/`).pop()??``)?(0,H.jsx)(Be,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,H.jsxs)(`a`,{href:r(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,H.jsx)(ae,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,H.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null]})}),Cn=`inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-sm px-2 text-xs font-medium text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,wn=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function Tn(e,t){let n=e.cloneNode(!0);n.querySelectorAll(wn).forEach(e=>e.remove());let r=St(t);return[...n.querySelectorAll(`button[data-streamdown="link"]`)].forEach(e=>{let t=e.textContent??``,i=r.findIndex(e=>e.label===t);if(i<0)return;let a=r.splice(i,1)[0];if(!a||!G(a.href))return;let o=n.ownerDocument.createElement(`a`);o.setAttribute(`href`,a.href),o.setAttribute(`data-streamdown`,`link`),o.textContent=e.textContent,e.replaceWith(o)}),n.innerHTML}async function En(e,t,n){if(e===`markdown`){if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(t);return}if(!navigator.clipboard?.write||typeof ClipboardItem>`u`||!n)throw Error(`Clipboard unavailable`);let r=Tn(n,t);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})])}var Dn=(0,V.memo)(function({text:e,ts:t,messageKey:n}){let r=(0,V.useRef)(null),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(null),c=(0,V.useRef)(null);(0,V.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await En(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,H.jsxs)(Y,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,H.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,H.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Cn,children:[(0,H.jsx)(oe,{className:`size-3.5`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,H.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Cn,children:[(0,H.jsx)(Ie,{className:`size-3.5`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,H.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,H.jsx)(`div`,{ref:r,children:(0,H.jsx)(z,{breaks:!0,children:e})}),(0,H.jsx)(Dt,{text:e,messageKey:n})]})});function On({incident:e}){let t=g().data;if(!t)return null;let n=d(t,e.provider);return(0,H.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,H.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,H.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,H.jsx)(R,{to:`/settings/agent-defaults#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}var kn=(0,V.memo)(function({text:e}){let t=(0,V.useId)();if(e.trim()===``)return null;let n=e.split(`
|
|
5
|
-
`,1)[0]??``,r=n.length<e.length;return(0,H.jsxs)(L,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,H.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,H.jsx)(j,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,H.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,H.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,H.jsx)(z,{inline:!0,children:n})}),r?(0,H.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,H.jsx)(I,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,H.jsx)(F,{children:(0,H.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,H.jsx)(z,{children:e})})})]})});function An(){return(0,H.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,H.jsx)(fe,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,H.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var jn={read:Ie,edit:Ze,delete:re,move:Ye,search:k,execute:ge,think:qe,fetch:de,task:A,plan:O,other:ne},Mn=e=>e.split(`
|
|
6
|
-
`).length;function Nn({text:e,streaming:t}){let[n,r]=(0,V.useState)(!1),a=(0,V.useRef)(null),o=(0,V.useRef)(!0);(0,V.useEffect)(()=>{let e=a.current;t&&e&&o.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let s=Mn(e),c=!t&&!n&&s>12;return(0,H.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":c?`true`:void 0,children:[(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`div`,{ref:a,onScroll:t?e=>{o.current=Xt(e.currentTarget)}:void 0,className:i(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,c&&`max-h-[216px] overflow-y-hidden`),children:(0,H.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),c?(0,H.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&s>12?(0,H.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-xs font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${s} lines`}):null]})}function Pn({diffs:e}){return(0,H.jsx)(H.Fragment,{children:e.map((e,t)=>(0,H.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-xs wrap-anywhere text-muted-foreground`,children:e.path}),(0,H.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...Fn(e.oldText).map((e,t)=>(0,H.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...Fn(e.newText).map((e,t)=>(0,H.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
|
|
7
|
-
`).map((e,t)=>(0,H.jsx)(In,{text:e},t))})]},`${e.path}:${t}`))})}function Fn(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
|
|
8
|
-
`)}function In({text:e}){return(0,H.jsx)(`span`,{className:i(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function Ln(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function Rn(e){let t=e.status===`running`||e.status===`pending`,n=Rt(e.title),{verb:r,detail:i}=e.toolKind===`execute`&&n.detail===void 0?{verb:`Ran`,detail:e.title}:n;return{busy:t,verb:r,detail:i,expandedCommand:(e.toolKind===`execute`?vt(e.input):me(e.name).toolKind===e.toolKind?he(e.name,e.input):void 0)??i,Icon:jn[e.toolKind]??ne}}function zn(e,t){return e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t>0}function Bn({item:e,busy:t}){return(0,H.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[t?(0,H.jsx)(fe,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,H.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,H.jsx)(`span`,{"data-slot":`tool-exit`,className:i(`rounded-full px-2 py-px font-mono text-xs font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})}function Vn({item:e,command:t,busy:n,nested:r,cacheKey:i,renderNested:a}){return(0,H.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[t===void 0?null:(0,H.jsx)(`pre`,{"data-slot":`tool-command`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:t}),e.error!==void 0&&e.error!==``?(0,H.jsx)(`div`,{"data-slot":`tool-error`,className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre-wrap wrap-anywhere text-signal-word-red`,children:e.error}):null,e.diffs!==void 0&&e.diffs.length>0?(0,H.jsx)(Pn,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,H.jsx)(Nn,{text:e.output,streaming:n}):null,r.length>0?(0,H.jsx)(`div`,{"data-slot":`tool-nested`,className:`flex flex-col gap-2 border-l-2 border-border py-2.5 pr-3 pl-3 ml-4 my-2`,children:a?.(r,i??e.id)}):null]})}function Hn({item:e,nested:t=[],cacheKey:n,renderNested:r}){let a=Gt(),[o,s]=(0,V.useState)(()=>n===void 0?null:a?.get(n)??null),c=e=>{n!==void 0&&a?.set(n,e),s(e)},{busy:l,verb:u,detail:d,expandedCommand:f,Icon:p}=Rn(e),m=zn(e,t.length),h=f!==void 0||m,g=h&&(o??(m&&Ln(e)));return(0,H.jsxs)(L,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:g,onOpenChange:c,className:i(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,H.jsxs)(I,{disabled:!h,className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] enabled:hover:bg-muted`,children:[(0,H.jsx)(j,{"aria-hidden":!0,className:i(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!h&&`invisible`)}),(0,H.jsx)(p,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:i(`shrink-0 font-semibold`,l&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:u}),d===void 0?null:(0,H.jsx)(`code`,{title:d,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:d}),(0,H.jsx)(Bn,{item:e,busy:l})]}),(0,H.jsx)(F,{children:(0,H.jsx)(Vn,{item:e,command:f,busy:l,nested:t,cacheKey:n,renderNested:r})})]})}function Un(e){let t=e.name??e.event,n=t.indexOf(`:`);return n>0?`${t.slice(0,n)} · ${t.slice(n+1)}`:t}function Wn({item:e,cacheKey:t}){let n=Gt(),[r,a]=(0,V.useState)(()=>t===void 0?!1:n?.get(t)??!1),o=e=>{t!==void 0&&n?.set(t,e),a(e)},s=e.status!==`completed`,c=e.entries.some(e=>e.kind===`context`),l=(e.stdout??``)!==``||(e.stderr??``)!==``,u=Un(e);return(0,H.jsxs)(L,{"data-slot":`hook-card`,"data-status":e.status,open:r,onOpenChange:o,className:i(`min-w-0 overflow-hidden rounded-md border bg-card`,s?`border-danger/25`:`border-border`),children:[(0,H.jsxs)(I,{className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] hover:bg-muted`,children:[(0,H.jsx)(j,{"aria-hidden":!0,className:`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),(0,H.jsx)(Ke,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Hook`}),(0,H.jsx)(`code`,{title:u,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:u}),(0,H.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[s?(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.status}):c?(0,H.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`context`}):null,s&&typeof e.exitCode==`number`&&e.exitCode!==0?(0,H.jsx)(`span`,{"data-slot":`hook-exit`,className:`rounded-full bg-danger/10 px-2 py-px font-mono text-xs font-semibold text-danger`,children:e.exitCode}):null]})]}),(0,H.jsx)(F,{children:(0,H.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.entries.map((e,t)=>(0,H.jsx)(`pre`,{"data-slot":`hook-entry`,"data-kind":e.kind,className:i(`px-3 py-2 font-mono text-xs leading-[1.7] whitespace-pre-wrap [overflow-wrap:anywhere]`,(e.kind===`error`||e.kind===`stop`)&&`text-signal-word-red`),children:e.text},t)),e.source===void 0?null:(0,H.jsx)(`p`,{"data-slot":`hook-source`,className:`px-3 pb-2 font-mono text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:e.source}),l?(0,H.jsxs)(L,{className:`border-t border-border`,children:[(0,H.jsxs)(I,{"data-slot":`hook-raw-toggle`,className:`group flex w-full items-center gap-1 px-3 py-1 text-left text-xs text-muted-foreground hover:text-foreground`,children:[(0,H.jsx)(j,{"aria-hidden":!0,className:`size-3 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),`Raw output${typeof e.exitCode==`number`?` · exit ${e.exitCode}`:``}`]}),(0,H.jsxs)(F,{children:[e.stdout?(0,H.jsx)(`pre`,{"data-slot":`hook-stdout`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.stdout}):null,e.stderr?(0,H.jsx)(`pre`,{"data-slot":`hook-stderr`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap text-signal-word-red [overflow-wrap:anywhere]`,children:e.stderr}):null]})]}):null]})})]})}function Gn({group:e,scope:t}){return(0,H.jsxs)(L,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,H.jsxs)(I,{className:`group flex h-[34px] tabular-nums w-full items-center gap-2 rounded-md px-2 -mx-2 text-left text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,H.jsx)(j,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,H.jsx)(F,{children:(0,H.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,H.jsx)(Hn,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function Kn({count:e,children:t}){return(0,H.jsxs)(L,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,H.jsxs)(I,{className:`group flex items-center gap-1.5 rounded-md p-0.5 tabular-nums text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,H.jsx)(j,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),It(e)]}),(0,H.jsx)(F,{children:(0,H.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function qn({image:e}){return(0,H.jsx)(Be,{"data-slot":`thread-image`,src:e.url,alt:e.name??`image from the agent session`,className:`max-h-72 max-w-full self-start rounded-lg border border-border`})}var Jn={finish:`Closed when the task finished`,superseded:`Closed when the worker went on`,"parent-stopped":`Closed when the parent stopped`,"worker-stopped":`Closed when the worker stopped`,undeliverable:`Closed: not delivered`};function Yn(e,t,n){return`${e.header}: ${n?.trim()||t.join(`, `)}`}function Xn(e,t,n,r=``){let i=e.map((e,r)=>Yn(e,t[r]??[],n[r])).join(`
|
|
9
|
-
`),a=r.trim();return a?`${i}\n\nAdditional comments:\n${a}`:i}function Zn({ask:e,run:t,projectId:n,onShowOrigin:r,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s=!1,onFinish:c,finishing:l=!1,mode:u,onModeChange:d,hideReplyBody:f=!1,delivery:p,surface:m=`transcript`}){let h=m===`transcript`&&e.context?(0,H.jsx)(Qn,{text:e.context}):null;if(e.resolved)return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.context?(0,H.jsx)(Qn,{text:e.context}):null,(0,H.jsxs)(Y,{role:`user`,"data-slot":`ask-card`,"data-resolved":`true`,children:[(0,H.jsx)(`span`,{className:`text-soft-foreground`,children:e.closed?Jn[e.closed]:e.answeredBy===`parent`?`Answered by parent`:`Answered`}),(0,H.jsx)(rt,{ask:e})]})]});let g=e.placement===`pinned`&&r?r:void 0;return e.routedToParent?(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,H.jsx)($n,{ask:e,runId:t.id,surface:m,onShowOrigin:g})]}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,H.jsx)(rr,{ask:e,run:t,projectId:n,surface:m,onShowOrigin:g,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s,onFinish:c,finishing:l,controlledMode:u,onModeChange:d,hideReplyBody:f,delivery:p})]})}function Qn({text:e}){return(0,H.jsx)(Y,{role:`agent`,children:(0,H.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`break-words text-sm text-foreground`,children:(0,H.jsx)(z,{breaks:!0,children:e})})})}function $n({ask:e,runId:t,surface:n,onShowOrigin:r}){let[i,a]=(0,V.useState)(!1),o=(0,V.useRef)(null),s=n===`decision-zone`&&!!e.context;return(0,H.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-routed":`parent`,className:`rounded-xl border border-card-edge bg-card shadow-card px-3 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking its parent`}),s?(0,H.jsx)(P,{ref:o,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`ms-auto min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,onClick:()=>a(!0),children:`Show context`}):null]}),(0,H.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-3`,children:e.questions.map((e,t)=>(0,H.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,H.jsx)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:(0,H.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e.header})}),(0,H.jsx)(`p`,{className:`mb-1.5 break-words text-sm font-semibold text-foreground`,children:e.question}),e.options?(0,H.jsx)(`ul`,{className:`flex list-disc flex-col gap-0.5 pl-5 text-[13px] text-muted-foreground`,children:e.options.map(e=>(0,H.jsxs)(`li`,{className:`break-words`,children:[(0,H.jsx)(`span`,{className:`text-foreground`,children:e.label}),e.description?(0,H.jsxs)(`span`,{children:[`: `,e.description]}):null]},e.label))}):(0,H.jsx)(`p`,{"data-slot":`ask-open-routed`,className:`text-[13px] text-muted-foreground`,children:`Open question: answered in words, with no options.`})]},e.id??t))}),(0,H.jsxs)(`div`,{"data-slot":`ask-footer`,className:`mt-2.5 flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(`p`,{"data-slot":`ask-routed-hint`,className:`text-xs text-muted-foreground`,children:[`Routed to parent: answer it in the`,` `,e.parentRunId?(0,H.jsx)(R,{to:`/tasks/${e.parentRunId}`,className:`font-medium text-foreground underline underline-offset-4`,children:`parent task`}):`parent task`,`.`]}),!s&&r?(0,H.jsx)(ft,{onShowOrigin:r,className:`ms-auto`}):null]}),s&&e.context?(0,H.jsx)(pt,{open:i,onOpenChange:a,runId:t,context:e.context,onShowOrigin:r,returnFocusRef:o}):null]})}function er(e,t,n,r,i){let a=t.blockedBy!==void 0,o=e.questions,s=o.length>1,c=o.length,[l,u]=(0,V.useState)(`options`),d=n??l,f=e=>{u(e),r?.(e)},[p,m]=(0,V.useState)(0),[h,g]=(0,V.useState)({}),[_,v]=(0,V.useState)({}),[y,b]=(0,V.useState)(``),[x,S]=(0,V.useState)(!1),[C,w]=(0,V.useState)(``),[T,E]=(0,V.useState)(!1),D=s&&p===c,ee=o.length===1&&o[0]?.options!==void 0&&o[0]?.multiSelect!==!0&&!x&&y.trim()===``;je(Object.values(h).some(e=>e.length>0)||Object.values(_).some(e=>e.trim()!==``)||y.trim()!==``||C.trim()!==``);let te=(e,t)=>g(n=>({...n,[e]:t})),O=e=>v(t=>{if(t[e]===void 0)return t;let n={...t};return delete n[e],n}),k=e=>{te(e,[]),v(t=>({...t,[e]:t[e]??``}))},A=o.some((e,t)=>!e.options||_[t]!==void 0),j=o.filter((e,t)=>W(t,h,_)).length,ne=j===o.length,M=async e=>{let n=await t.send(e);return n===void 0&&i?.(),n};return{delivery:t,blocked:a,questions:o,stepped:s,commentStepIndex:c,mode:d,setMode:f,stepIndex:p,setStepIndex:m,selections:h,otherAnswers:_,setOtherAnswers:v,additionalComment:y,setAdditionalComment:b,singleCommentOpen:x,setSingleCommentOpen:S,freeTextDraft:C,setFreeTextDraft:w,contextOpen:T,setContextOpen:E,onCommentStep:D,oneTap:ee,setQuestion:te,clearOtherAnswer:O,selectOther:k,hasOtherAnswer:A,answeredCount:j,allAnswered:ne,deliver:M,sendAll:()=>void M(Xn(o,h,_,y)),sendFreeText:()=>{let e=C.trim();e&&M(e).then(e=>{e===void 0&&w(``)})}}}function tr({state:e,renderFreeTextReply:t}){let n=(0,V.useId)(),r=e.delivery.isPending||e.blocked;if(e.mode===`reply`)return(0,H.jsx)(ct,{value:e.freeTextDraft,onValueChange:e.setFreeTextDraft,disabled:r,renderFreeTextReply:t});if(e.onCommentStep)return(0,H.jsx)(st,{questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,comment:e.additionalComment,disabled:r,onCommentChange:e.setAdditionalComment,onJumpToQuestion:e.setStepIndex});let i=e.stepped?Math.min(e.stepIndex,e.questions.length-1):0,a=e.questions[i];return a?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(sr,{question:a,disabled:r,selected:e.selections[i]??[],isOther:e.otherAnswers[i]!==void 0,otherAnswer:e.otherAnswers[i]??``,onSelect:t=>{e.blocked||(e.clearOtherAnswer(i),e.oneTap?e.deliver(Yn(a,t)):e.setQuestion(i,t))},onOtherToggle:()=>{e.blocked||(e.otherAnswers[i]===void 0?e.selectOther(i):e.clearOtherAnswer(i))},onOtherChange:t=>e.setOtherAnswers(e=>({...e,[i]:t}))},a.id??i),!e.stepped&&e.singleCommentOpen?(0,H.jsxs)(`div`,{className:`pt-1`,children:[(0,H.jsx)(`label`,{htmlFor:n,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,H.jsx)(B,{id:n,"data-slot":`ask-additional-comment`,rows:2,value:e.additionalComment,disabled:r,placeholder:`Optional extra notes for the agent…`,onChange:t=>e.setAdditionalComment(t.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):null}function nr({onFinish:e,finishing:t,onStop:n,stopping:r,onActionError:i}){if(!e&&!n)return null;let a=e=>{i(void 0),Promise.resolve(e()).catch(e=>{i(e instanceof Error?e.message:String(e))})};return(0,H.jsxs)(H.Fragment,{children:[e?(0,H.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-finish`,disabled:t||r,title:`Close the session and mark this task done`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:()=>a(e),children:t?`Finishing…`:`Finish`}):null,n?(0,H.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,disabled:r||t,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:()=>a(n),children:r?`Stopping…`:`Stop`}):null]})}function rr(e){return e.delivery===void 0?(0,H.jsx)(ir,{...e}):(0,H.jsx)(ar,{...e,delivery:e.delivery})}function ir(e){let t=Fe(e.run,e.projectId);return(0,H.jsx)(ar,{...e,delivery:t})}function ar({ask:e,run:t,surface:n,onShowOrigin:r,onAnswered:a,renderFreeTextReply:o,onStop:s,stopping:c,onFinish:l,finishing:u,controlledMode:d,onModeChange:f,hideReplyBody:p,delivery:m}){let h=er(e,m,d,f,a),[g,_]=(0,V.useState)(void 0),v=(0,V.useRef)(null),y=h.delivery.mode===`resume`,b=n===`decision-zone`||o!==void 0,x=n===`decision-zone`&&!!e.context,S=h.additionalComment.trim()!==``,C=h.mode===`reply`&&p,w=(0,H.jsx)(nr,{onFinish:l,finishing:u,onStop:s,stopping:c,onActionError:_});return(0,H.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-ask-mode":h.mode,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-delivery":h.delivery.mode,className:i(`rounded-xl border border-accent-strong/30 bg-accent-strong/[0.04] [html:not(.light)_&]:bg-card`,C&&`rounded-b-none border-b-0`),children:[(0,H.jsx)(at,{stepped:h.stepped,mode:h.mode,onModeChange:h.setMode,showModeSwitch:b,stepLabel:h.onCommentStep?`Comment (optional)`:`${h.stepIndex+1} of ${h.questions.length}`,hasSheetContext:x,showContextButtonRef:v,onOpenContext:()=>h.setContextOpen(!0),onShowOrigin:x?void 0:r}),h.stepped&&h.mode===`options`?(0,H.jsx)(ot,{questions:h.questions,stepIndex:h.stepIndex,selections:h.selections,otherAnswers:h.otherAnswers,hasComment:S,onSelectStep:h.setStepIndex}):null,C?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-2.5 px-3 py-2.5`,children:(0,H.jsx)(tr,{state:h,renderFreeTextReply:o})}),(0,H.jsxs)(`div`,{"data-slot":`ask-footer`,className:`flex shrink-0 flex-col gap-2 border-t border-border/70 px-3 py-2`,children:[(0,H.jsx)(or,{state:h,hasComment:S,resuming:y,hasCustomReply:o!==void 0,stopControl:w}),(0,H.jsx)(dt,{blockedBy:h.delivery.blockedBy,reason:h.delivery.reason,error:h.delivery.error??g})]})]}),x&&e.context?(0,H.jsx)(pt,{open:h.contextOpen,onOpenChange:h.setContextOpen,runId:t.id,context:e.context,onShowOrigin:r,returnFocusRef:v}):null]})}function or({state:e,hasComment:t,resuming:n,hasCustomReply:r,stopControl:i}){return e.mode===`reply`?r?null:(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[i,(0,H.jsx)(P,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:e.delivery.isPending||e.blocked||e.freeTextDraft.trim()===``,onClick:e.sendFreeText,children:`Send reply`})]}):e.stepped?(0,H.jsx)(lt,{stepIndex:e.stepIndex,questionCount:e.questions.length,answeredCount:e.answeredCount,allAnswered:e.allAnswered,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked,onBack:()=>e.setStepIndex(e=>Math.max(0,e-1)),onNext:()=>e.setStepIndex(t=>Math.min(e.commentStepIndex,t+1)),onOpenComment:()=>e.setStepIndex(e.commentStepIndex),onSend:e.sendAll,questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,stopControl:i}):(0,H.jsx)(ut,{oneTap:e.oneTap,hasOtherAnswer:e.hasOtherAnswer,allowComment:e.questions[0]?.allowFreeText!==!1,commentOpen:e.singleCommentOpen,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked||!e.allAnswered,onToggleComment:()=>e.setSingleCommentOpen(e=>!e),onSend:e.sendAll,stopControl:i})}function sr({question:e,disabled:t,selected:n,isOther:r,otherAnswer:a,onSelect:o,onOtherToggle:s,onOtherChange:c}){let l=(0,V.useId)(),u=(0,V.useRef)(null),d=(0,V.useRef)(r),f=e.options,p=f!==void 0,m=p&&e.multiSelect===!0;(0,V.useEffect)(()=>{let e=r&&!d.current;d.current=r,e&&p&&u.current?.focus()},[r,p]);let h=e=>{if(!m){o([e]);return}o(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,H.jsxs)(`div`,{"data-slot":`ask-question`,role:`group`,"aria-label":e.question,children:[(0,H.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,H.jsx)(`span`,{className:`shrink-0 rounded-md bg-accent-strong px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-accent-strong-foreground`,children:e.header}),(0,H.jsx)(`p`,{className:`min-w-0 flex-1 break-words text-sm font-semibold text-foreground`,children:e.question}),m?(0,H.jsx)(`span`,{className:`ms-auto text-xs text-soft-foreground`,children:`select all that apply`}):null]}),f?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{"data-slot":`ask-options`,className:`grid grid-cols-1 gap-1.5 sm:grid-cols-2 sm:gap-2`,children:[f.map(e=>{let r=n.includes(e.label);return(0,H.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>h(e.label),className:i(`flex min-h-11 w-full flex-col items-start justify-start content-start gap-0.5 rounded-md border px-2.5 py-1.5 text-left transition-colors focus-visible:outline-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50`,r?`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`:`border-border bg-card pointer-hover:border-accent-strong/50 pointer-hover:bg-accent-strong/[0.08]`),children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13px] font-semibold text-foreground`,children:[m?(0,H.jsx)(`span`,{"aria-hidden":`true`,className:i(`flex size-4 shrink-0 items-center justify-center rounded border text-[12px]`,r?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,H.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,H.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)}),e.allowFreeText===!1?null:(0,H.jsx)(P,{type:`button`,variant:`outline`,"aria-pressed":r,"aria-expanded":r,"aria-controls":r?l:void 0,disabled:t,onClick:s,className:i(`h-auto min-h-11 w-full justify-start px-2.5 py-1.5 text-left`,f.length%2==0&&`sm:col-span-2`,r&&`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`),children:`Other`})]}),e.allowFreeText!==!1&&r?(0,H.jsxs)(`div`,{className:`mt-2`,children:[(0,H.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,H.jsx)(B,{ref:u,id:l,rows:2,value:a,disabled:t,placeholder:`Type your custom answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,H.jsx)(B,{id:l,rows:2,value:a,disabled:t,placeholder:`Type your answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}var cr=/^diff --git /;function lr(e){let t=e.replace(cr,``),n=t.lastIndexOf(` b/`);return X(n>=0?t.slice(n+3):t)}function X(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1).replace(/\\(.)/g,`$1`):t}function ur(e){let t=X(e.slice(4));if(t!==`/dev/null`)return t.replace(/^[ab]\//,``)}function dr(e){return{path:lr(e),status:`modified`,binary:!1,additions:0,deletions:0,lines:[]}}function fr(e,t){if(t.startsWith(`rename from `))e.status=`renamed`,e.oldPath=X(t.slice(12));else if(t.startsWith(`rename to `))e.status=`renamed`,e.path=X(t.slice(10));else if(t.startsWith(`new file mode`))e.status=`added`;else if(t.startsWith(`deleted file mode`))e.status=`deleted`;else if(t.startsWith(`Binary files `)||t===`GIT binary patch`)e.binary=!0;else if(t.startsWith(`+++ `)){let n=ur(t);n!==void 0&&(e.path=n)}else if(t.startsWith(`--- `)){let n=ur(t);n!==void 0&&e.status===`deleted`&&(e.path=n)}}function pr(e,t){e.lines.push(t),t.startsWith(`+`)?e.additions+=1:t.startsWith(`-`)&&(e.deletions+=1)}function mr(e){let t=[],n=null,r=!1;for(let i of e.split(`
|
|
10
|
-
`)){if(cr.test(i)){n=dr(i),t.push(n),r=!1;continue}if(n){if(!r){i.startsWith(`@@`)?(r=!0,n.lines.push(i)):fr(n,i);continue}pr(n,i)}}let i=t.at(-1);return i&&i.lines.at(-1)===``&&i.lines.pop(),t}function hr(e){return{files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}}var gr=20,_r=300;function vr({runId:e,projectId:t}){let n=x(),r=o(e,t);(0,V.useEffect)(()=>{let r=t?[t,`runs`,`diff`,e]:u.runs.diff(e);n.invalidateQueries({queryKey:r})},[t,n,e]);let i=(0,V.useMemo)(()=>mr(r.data??``),[r.data]),[a,s]=(0,V.useState)(!1);if(r.isPending)return(0,H.jsx)(`p`,{className:`px-1 text-xs text-soft-foreground`,children:`Loading diff…`});if(r.isError)return(0,H.jsx)(`p`,{className:`px-1 text-xs text-danger`,children:r.error.message});if(i.length===0)return(0,H.jsx)(`p`,{"data-slot":`run-diff-empty`,className:`px-1 font-mono text-xs text-soft-foreground`,children:r.data.trim()||`(no changes)`});let c=hr(i),l=a?i:i.slice(0,gr);return(0,H.jsxs)(`div`,{"data-slot":`run-diff`,className:`flex min-w-0 flex-col gap-2`,children:[(0,H.jsxs)(`p`,{className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`span`,{children:[c.files,` `,c.files===1?`file`:`files`,` changed`]}),(0,H.jsxs)(`span`,{className:`font-mono font-semibold tabular-nums`,children:[(0,H.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,c.additions]}),` `,(0,H.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,c.deletions]})]})]}),l.map(e=>(0,H.jsx)(br,{file:e},`${e.oldPath??``}→${e.path}`)),i.length>l.length?(0,H.jsxs)(P,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>s(!0),children:[`Show `,i.length-l.length,` more files`]}):null]})}var yr={added:`added`,deleted:`deleted`,renamed:`renamed`};function br({file:e}){let[t,n]=(0,V.useState)(!0),r=yr[e.status],a=e.oldPath?`${e.oldPath} → ${e.path}`:e.path;return(0,H.jsxs)(L,{open:t,onOpenChange:n,"data-slot":`diff-file`,className:`min-w-0 overflow-hidden rounded-md border border-card-edge bg-card shadow-card`,children:[(0,H.jsxs)(I,{className:`flex w-full items-start gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,H.jsx)(ce,{className:i(`mbs-[1px] size-3.5 shrink-0 text-soft-foreground motion-safe:transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,H.jsx)(`span`,{"data-slot":`diff-file-path`,title:a,className:`min-w-0 wrap-anywhere font-mono text-xs font-medium`,children:e.oldPath?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),r?(0,H.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:r}):null,e.binary?(0,H.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:`binary`}):null,(0,H.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-xs font-semibold tabular-nums`,children:[(0,H.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,e.additions]}),` `,(0,H.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,e.deletions]})]})]}),(0,H.jsx)(F,{children:(0,H.jsx)(`div`,{className:`border-t border-border/50`,children:e.binary?(0,H.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.lines.length===0?(0,H.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,H.jsx)(xr,{lines:e.lines})})})]})}function xr({lines:e}){let[t,n]=(0,V.useState)(!1),r=t?e:e.slice(0,_r),a=r.join(`
|
|
11
|
-
`),[o,s]=(0,V.useState)(null);(0,V.useEffect)(()=>{let e=!1;return ze(a,`diff`).then(t=>{e||s({text:a,tokens:t.tokens})}),()=>{e=!0}},[a]);let c=o?.text===a?o.tokens:Re(a,`diff`)?.tokens??null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`pre`,{"data-slot":`diff-file-body`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:r.map((e,t)=>(0,H.jsxs)(`span`,{"data-line":e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:void 0,className:i(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[c?.[t]===void 0?e:c[t].map((e,t)=>(0,H.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),e===``?` `:``]},t))}),e.length>_r?(0,H.jsx)(`button`,{type:`button`,"data-slot":`diff-file-toggle`,onClick:()=>n(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-xs font-medium text-soft-foreground hover:text-foreground`,children:t?`Show less`:`Show all ${e.length} lines`}):null]})}function Sr(e,t,n,r){return _e(e,t)?.runner??e.runner??(t||n?r:void 0)??`claude`}function Cr(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 wr(e,t,n,r,i){if(!e)return t!==null||!n||r?i:void 0}function Tr(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 Er(){let e=c(),t=g();return{providers:e,registered:t,providersPending:e.isPending||t.isPending,providersError:e.isError||t.isError,providersReady:e.isSuccess&&t.isSuccess}}function Dr(e,t=null,n){let{registered:r,providersPending:i,providersError:a,providersReady:o}=Er(),c=p(n),l=Oe(e),u=e.removedRunner!==void 0,d=l&&!e.runner||u,m=Le(n),h=e.delegation?.role===`worker`,g=c.data?.defaultRunner,_=Sr(e,l,u,f(g,s(r.data))??g),v=(t,n)=>Ae(e,t,m.repoAccount,{original:_,target:n},l),{runners:y,signedOut:b}=m.runnersOn(e=>v(e,e)),x=h?_:Ee(t,y,_),S=y.includes(_),C=l?T(e.workflowDef,x,s(r.data)):[x],w=l&&h&&e.workflowDef?Cr(e,x,m):C.filter(e=>!m.readyOn(e,v(e,x))),E=o&&(!d||c.isSuccess)&&w.length===0,D=Tr({needsConfig:d,configPending:c.isPending,configError:c.isError,providersPending:i,providersError:a,canContinue:E,untouched:l,missing:w});return{runners:y,signedOut:b,currentRunner:_,runner:x,currentRunnerConnected:S,canContinue:E,providerPending:i||d&&c.isPending,providerError:a,reason:D,runnerOverride:wr(h,t,S,u,x)}}var Or={open:!1,notes:``},Z=new Map,kr=new Set,Q=null;function Ar(){let e=[...Z.values()].some(e=>e.notes.trim()!==``);e&&Q===null&&(Q=Ne()),!e&&Q!==null&&(Q(),Q=null);for(let e of kr)e()}function jr(e){return kr.add(e),()=>{kr.delete(e)}}function $(e){return Z.get(e)??Or}function Mr(e,t){let n={...$(e),...t};!n.open&&n.notes===``?Z.delete(e):Z.set(e,n),Ar()}function Nr(e){Z.delete(e)&&Ar()}function Pr(e){let t=(0,V.useSyncExternalStore)(jr,()=>$(e)),n=(0,V.useCallback)(t=>Mr(e,t),[e]),r=(0,V.useCallback)(()=>Nr(e),[e]);return{...t,update:n,clear:r}}function Fr(e,t){let n=x();return m({mutationFn:()=>w(e,t?.projectId),onSuccess:()=>{n.invalidateQueries({queryKey:u.runs.all}),t?.onSuccess?.()},onError:e=>S(e.message,{tone:`danger`})})}function Ir({run:e,projectId:t,onResolved:n}){return(0,H.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex flex-col gap-2 rounded-xl border border-info/35 bg-info/10 px-3.5 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,H.jsx)(ue,{className:`size-4 shrink-0 text-semantic-info`,"aria-hidden":`true`}),(0,H.jsxs)(`p`,{className:`min-w-0 break-words text-[13px] leading-relaxed`,children:[(0,H.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,H.jsx)(`span`,{className:`block text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,H.jsx)(Rr,{run:e,projectId:t,onResolved:n})]})}function Lr({run:e,projectId:t,onResolved:n,showDiff:r=!0}){return(0,H.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-2.5`,children:[(0,H.jsx)(Ir,{run:e,projectId:t,onResolved:n}),r?(0,H.jsx)(vr,{runId:e.id,projectId:t}):null]})}function Rr({run:e,projectId:t,onResolved:n}){let r=h(),i=x(),o=(0,V.useRef)(null),s=Pr(e.id),{notes:c,open:l,clear:d}=s,f=e=>s.update({notes:e}),[p,g]=(0,V.useState)(null),[b,w]=(0,V.useState)(null),T=Fr(e.id,{projectId:t,onSuccess:()=>{d(),n?.()}}),E=Dr(e,null,t),ee=()=>i.invalidateQueries({queryKey:u.runs.all}),O=m({mutationFn:async n=>E.canContinue?C(_(e.id,{projectId:t}),{text:`Review feedback:\n${n}`,runner:E.runnerOverride}):null,onMutate:()=>_(e.id,{projectId:t}),onSuccess:(t,i,a)=>{t!==null&&($(e.id).notes.trim()===i&&d(),r.invalidateAfter(`continue`,a),n?.())},onError:e=>S(e.message,{tone:`danger`})}),k=m({mutationFn:()=>y(e.id,t),onSuccess:e=>{S(`Draft PR created — ${e.url}`),d(),ee(),n?.()},onError:e=>{e instanceof v&&e.manual!==void 0&&w(e.manual),S(e.message,{tone:`danger`})}}),A=()=>{if(!l){s.update({open:!0}),requestAnimationFrame(()=>o.current?.focus());return}let e=c.trim();if(e.length===0){g(`Write what to change first.`),o.current?.focus();return}g(null),O.mutate(e)};return(0,H.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[E.canContinue?null:(0,H.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:E.reason}),E.providerPending?null:(0,H.jsx)(R,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 [&_button]:min-h-11 [&_a]:min-h-11`,children:[(0,H.jsx)(P,{asChild:!0,variant:`outline`,size:`sm`,children:t?(0,H.jsxs)(D,{to:`/p/${encodeURIComponent(t)}/tasks/${encodeURIComponent(e.id)}/changes`,children:[(0,H.jsx)(ue,{"aria-hidden":`true`}),`Review changes`]}):(0,H.jsxs)(R,{to:`/tasks/${e.id}/changes`,children:[(0,H.jsx)(ue,{"aria-hidden":`true`}),`Review changes`]})}),(0,H.jsxs)(P,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:E.reason??(l?`Send the notes back into the agent's session`:`Write notes for the agent`),"aria-describedby":E.canContinue?void 0:`review-provider-guidance`,"aria-expanded":l,"aria-controls":l?`review-notes`:void 0,disabled:O.isPending||!E.canContinue,onClick:A,children:[(0,H.jsx)(Je,{"aria-hidden":`true`}),l?`Send back with notes`:`Send back`]}),a(e.pullRequestUrl)?(0,H.jsx)(P,{asChild:!0,variant:`outline`,size:`sm`,children:(0,H.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,H.jsx)(le,{"aria-hidden":`true`}),`PR ↗`]})}):(0,H.jsxs)(P,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:k.isPending,onClick:()=>k.mutate(),children:[(0,H.jsx)(te,{"aria-hidden":`true`}),`Draft PR`]}),e.finishBlocked===null?(0,H.jsxs)(P,{"data-slot":`review-accept`,variant:`primary`,size:`sm`,className:`[margin-inline-start:auto]`,title:Pe(`review`),disabled:T.isPending,onClick:()=>T.mutate(),children:[(0,H.jsx)(M,{"aria-hidden":`true`}),`Accept`]}):null]}),l?(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(B,{ref:o,id:`review-notes`,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,"aria-invalid":p!==null||void 0,"aria-describedby":p===null?void 0:`review-notes-error`,placeholder:`Notes for the agent — what should change?`,rows:1,value:c,onChange:e=>{let t=e.target.value;f(t),p!==null&&t.trim().length>0&&g(null)},onKeyDown:e=>{De({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),A())},className:`min-h-11 text-base md:text-[13px]`}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[p===null?(0,H.jsx)(`span`,{}):(0,H.jsx)(`p`,{id:`review-notes-error`,"data-slot":`review-notes-error`,role:`alert`,className:`text-xs font-medium text-semantic-red`,children:p}),(0,H.jsx)(P,{"data-slot":`review-notes-cancel`,variant:`ghost`,size:`sm`,className:`min-h-11`,title:`Fold the notes box and drop the notes`,onClick:()=>{g(null),d()},children:`Cancel`})]})]}):null,b===null?null:(0,H.jsx)(zr,{command:b})]})}function zr({command:e}){return(0,H.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>S(`Command copied to clipboard.`)).catch(()=>S(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-xs text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,H.jsx)(oe,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,H.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function Br(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Vr=1500;function Hr({status:e}){let t=(0,V.useRef)(e),[n,r]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||Br())return;r(!0);let i=setTimeout(()=>r(!1),Vr);return()=>clearTimeout(i)},[e]),n?(0,H.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,H.jsx)(Te,{}),(0,H.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,H.jsx)(`span`,{className:`rounded-full border border-accent-strong/30 bg-accent-strong/15 px-4 py-1.5 text-[13px] font-medium text-accent-text shadow-modal`,children:`✓ Changes accepted`})})]}):null}export{nn as A,Ct as B,fn as C,rn as D,qt as E,Gt as F,Tt as H,Bt as I,Rt as L,Yt as M,Zt as N,an as O,Kt as P,At as R,q as S,Xt as T,rt as U,Et as V,Xe as W,An as _,vr as a,hn as b,Dn as c,qn as d,On as f,Sn as g,Kn as h,Dr as i,$t as j,en as k,Gn as l,Hn as m,Lr as n,Zn as o,kn as p,Fr as r,Qn as s,Hr as t,Wn as u,yn as v,Jt as w,gn as x,_n as y,wt as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r,s as i}from"./dist-C_rn70hE.js";import{A as a,Ct as o,Jt as s,Wt as c,_ as l,a as u,c as d,dn as f,f as p,k as m,rn as h,sn as g}from"./queries-CIeJg62Y.js";import{$ as _,I as v,J as y,Pr as b,Y as x,a as S,hi as C,ii as w,n as T,st as E}from"./toaster-D0HMoto5.js";import{A as D,X as O,_ as k,at as A,b as j,d as M,dt as ee,h as N,l as P,lt as F,nt as I,pt as L,r as te,st as R,u as ne}from"./design-icons-BZt8Kqs9.js";import{t as z}from"./external-link-BE6y205O.js";import{t as re}from"./eye-B8okNWXU.js";import{t as ie}from"./loader-circle-CPBhhDbB.js";import{t as ae}from"./message-square-B-MD-8rD.js";import{t as oe}from"./play-CmVAj_fu.js";import{t as B}from"./button-C8jUIs8Q.js";import{i as se,r as ce,t as le}from"./popover-CvL6hQ5c.js";import{a as ue,i as de,o as fe,r as pe,s as me,t as he}from"./dialog-CB9ZhEk2.js";import{t as V}from"./project-router-BHFXTx5l.js";import{a as ge,i as H,o as U,r as _e,s as ve,t as ye}from"./command-BMMjB5k9.js";import{d as be,f as W,i as xe,o as Se,p as Ce,s as we,t as Te,u as Ee}from"./skills-pM_PouEs.js";import{$ as De,$n as G,Ct as K,F as Oe,Fn as q,G as ke,I as Ae,In as je,J as Me,K as J,L as Ne,Ln as Pe,M as Fe,N as Ie,P as Le,Q as Re,R as ze,W as Be,X as Ve,at as He,gr as Ue,it as We,nt as Ge,ot as Ke,q as qe,tt as Je,vn as Ye,xn as Xe}from"./index-Byw2yW7N.js";import{t as Ze}from"./markdown-BQab8jF1.js";import{t as Qe}from"./textarea-vEsJAUAV.js";import{t as $e}from"./diff-H-hamhtW.js";import{t as Y}from"./change-counts-wqSYI3W8.js";import{t as et}from"./option-select-JTiDFrqF.js";import{t as tt}from"./tab-link-BYYXdpLn.js";var X=e(t(),1),Z=n(),nt={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)(P,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:r(t,`text-semantic-green`)}):e===`failing`?(0,Z.jsx)(k,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:r(t,`text-semantic-red`)}):e===`pending`?(0,Z.jsx)(ie,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:r(t,`animate-spin text-semantic-amber motion-reduce:animate-none`)}):e===`review`?(0,Z.jsx)(N,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-review`,className:r(t,`text-semantic-info`)}):e===`conflict`?(0,Z.jsx)(R,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-conflict`,className:r(t,`text-semantic-conflict`)}):(0,Z.jsx)(N,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:r(t,`text-soft-foreground`)})}function rt(e){return e?.available?e.mergeState:null}function it(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function at(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function ot(e){return e===`approved`||e===`not-required`?`passing`:e===`review-required`?`review`:e===`unknown`?`unknown`:`failing`}function st(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 ct(e){return e===`mergeable`?`passing`:e===`conflicting`?`conflict`:`unknown`}function lt(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function ut(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function dt(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function ft(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function $(e){return e?nt[e]:`Merge`}function pt(e){return e===`conflicting`?`true`:void 0}function mt({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,ut(e.required)]})]}),e.url&&i(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function ht({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 gt({state:e,selectedMethod:t,overrideRules:n,mergeEnabled:i,refreshPending:a,onRefresh:o,onRunAgent:s,onConfirm:c,onMethodChange:l,onOverrideChange:u}){let d=at(e),f=ot(e.reviewDecision),p=ct(e.mergeable);return(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-semantic-green`}):(0,Z.jsx)(R,{size:16,"aria-hidden":`true`,className:r(`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:d}),(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:a,onClick:o,children:[(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,a&&`animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-xs text-soft-foreground`,children:[e.headRef,` (`,Pe(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:f}),(0,Z.jsxs)(`span`,{children:[`Reviews: `,st(e.reviewDecision)]})]}),(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Q,{state:p}),(0,Z.jsxs)(`span`,{children:[`Conflicts: `,lt(e.mergeable)]})]}),e.checks.length===0?(0,Z.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,Z.jsx)(mt,{check:e},e.name)),e.blockers.map(e=>(0,Z.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&s?(0,Z.jsx)(B,{className:`mt-4`,onClick:s,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=>u(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)(et,{"aria-label":`Merge method`,value:t??``,onValueChange:e=>l(e),options:e.methods.map(e=>({value:e,label:nt[e]})),className:`w-full min-w-0 flex-1 bg-background sm:w-auto`}),(0,Z.jsx)(B,{disabled:!i,onClick:c,children:$(t)})]}):null]})]})}function _t({number:e,state:t,selectedMethod:n,confirming:r,overrideRules:i,mergePending:a,mergeError:o,onOpenChange:s,onMerge:c}){return(0,Z.jsx)(he,{open:r,onOpenChange:s,children:(0,Z.jsxs)(pe,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Z.jsxs)(fe,{children:[(0,Z.jsxs)(me,{children:[$(n),` pull request #`,e,`?`]}),(0,Z.jsx)(de,{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)(ue,{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…`:$(n)})]})]})})}function vt({number:e,onRunAgent:t}){let n=C(),r=p(),i=w({queryKey:c.githubMergeState(e),queryFn:({signal:t})=>x(e,{},{signal:t}),retry:!1}),a=rt(i.data),[o,s]=(0,X.useState)(null),[l,u]=(0,X.useState)(!1),[d,m]=(0,X.useState)(!1),h=f({mutationFn:t=>x(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>T(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=it(o,a),v=()=>({mergeState:c.githubMergeState(e),list:c.githubPages(50),comments:c.githubComments(`pr`,e),item:c.githubItem(`pr`,e),refStatus:r===void 0?void 0:c.githubRefStatusOf(r)}),y=f({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return _(e,{method:g,expectedHeadSha:a.headSha,...d&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{u(!1),T(`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)=>{T(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,Z.jsx)(G,{"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":pt(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-card-edge bg-card p-4 shadow-card`,children:[(0,Z.jsx)(gt,{state:a,selectedMethod:g,overrideRules:d,mergeEnabled:ft(g,a,d),refreshPending:h.isPending,onRefresh:()=>h.mutate(c.githubMergeState(e)),onRunAgent:t,onConfirm:()=>u(!0),onMethodChange:s,onOverrideChange:m}),(0,Z.jsx)(_t,{number:e,state:a,selectedMethod:g,confirming:l,overrideRules:d,mergePending:y.isPending,mergeError:y.error,onOpenChange:u,onMerge:()=>y.mutate(v())})]}):(0,Z.jsx)(ht,{reason:dt(i.data)})}function yt(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 bt(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 xt(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 St(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 Ct({label:e,color:t,plain:n=!1}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:St(t),className:n?`text-xs font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function wt(e){return e===`pr`?`pull request`:`issue`}function Tt(e,t,n){return e===`pr`&&!!(t||n)}function Et({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 Dt=r(`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 Ot(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function kt({item:e,kindWord:t,commentCount:n,hasDiffStat:r,additions:a,deletions:o}){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)(q,{iso:e.createdAt,title:Ot(e.createdAt)}),n?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(tn,{count:n})]}):null,r?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(`span`,{"data-slot":`gh-diffstat`,children:(0,Z.jsx)(Y,{adds:a??0,dels:o??0})})]}):null,`·`,i(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 At({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)(tt,{to:K(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,Z.jsx)(tt,{to:K(`prs`,t.filter,e.number,`/changes`),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 jt({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)(Ct,{label:e,color:t[e]},e)),n?(0,Z.jsx)(nn,{checks:n,url:e.url}):null]}):null}function Mt({item:e,colors:t,body:n}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"data-slot":`gh-body`,className:r(`mt-5`,Dt),children:n?(0,Z.jsx)(Ze,{children:n}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no description)`})}),(0,Z.jsx)(It,{item:e,colors:t})]})}function Nt({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=wt(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,_=Tt(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)(Et,{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)(Pt,{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)(Pt,{action:e.kind===`pr`?void 0:c,children:(0,Z.jsx)(kt,{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)(At,{item:e,subNav:a,changes:d}),(0,Z.jsx)(jt,{item:e,colors:t,checks:n}),d&&e.kind===`pr`?(0,Z.jsx)(Ft,{item:e}):(0,Z.jsx)(Mt,{item:e,colors:t,body:m})]}),e.kind===`pr`?(0,Z.jsx)(vt,{number:e.number,onRunAgent:o}):null,l]})}function Pt({action:e,className:t,children:n}){return e?(0,Z.jsxs)(`div`,{"data-slot":`gh-header-row`,className:r(`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 Ft({item:e}){let t=C(),n=d(e.number),[a,o]=(0,X.useState)(``),[s,l]=(0,X.useState)(null),u=n.data,f=e=>u?.available?u.files.filter(t=>t.path.toLowerCase().includes(e.toLowerCase())):[],p=f(a),m=p.some(e=>e.path===s)?s:p[0]?.path??null,h=p.findIndex(e=>e.path===m),g=e=>{o(e);let t=f(e),n=m??s,r=t.some(e=>e.path===n)?n:t[0]?.path??n;r!==s&&l(r)},_=async()=>{let n=u?.available?u.headSha:null,r=c.githubPrChanges(e.number),i=await y(e.number,{refresh:!0});t.setQueryData(r,i),i.available&&n&&n!==i.headSha&&(l(i.files[0]?.path??null),T(`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||!u)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!u.available)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:u.reason});let v=p.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??``})),b=i(e.url)?`${e.url}/files`:null,x=p.find(e=>e.path===m);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:[u.files.length,` changed files`]}),(0,Z.jsx)(Y,{adds:u.additions,dels:u.deletions}),(0,Z.jsx)(je,{sha:u.headSha,variant:`inline`,prefix:`head `,className:`text-muted-foreground`}),(0,Z.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void _(),children:`Refresh`})]}),u.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:[u.reason??`This response is incomplete.`,` `,b?(0,Z.jsx)(`a`,{href:b,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:a,onChange:e=>g(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)(et,{"aria-label":`Select changed file`,value:m??``,onValueChange:l,options:p.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:p.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>l(e.path),className:r(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,m===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`,className:`min-h-11 min-w-11`,disabled:h<=0,onClick:()=>l(p[h-1]?.path??null),children:(0,Z.jsx)(Ue,{})}),(0,Z.jsx)(B,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:h<0||h>=p.length-1,onClick:()=>l(p[h+1]?.path??null),children:(0,Z.jsx)(M,{size:16})})]}),p.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)($e,{files:v.filter(e=>e.path===m),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 It({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(Lt(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)(G,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(G,{className:`h-14 w-full`}),(0,Z.jsx)(G,{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 · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Rt(i).map(e=>e.group===`commits`?(0,Z.jsx)(zt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(Xt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Vt,{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 Lt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Rt(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 zt({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:Bt.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)(Vt,{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:Bt.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)(q,{iso:e[e.length-1].createdAt,className:`shrink-0`})]})})}var Bt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Vt({event:e,colors:t}){return(0,Z.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:r(`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:Bt[e.kind]}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Z.jsx)(qt,{event:e,colors:t}),(0,Z.jsx)(q,{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 Ht({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)(Jt,{checks:e.checks})]})}function Ut({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:St(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 Wt({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Gt({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Kt={committed:e=>(0,Z.jsx)(Ht,{event:e}),labeled:(e,t)=>(0,Z.jsx)(Ut,{event:e,colors:t}),unlabeled:(e,t)=>(0,Z.jsx)(Ut,{event:e,colors:t}),assigned:e=>(0,Z.jsx)(Wt,{event:e}),unassigned:e=>(0,Z.jsx)(Wt,{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)(Gt,{event:e})};function qt({event:e,colors:t}){return Kt[e.kind]?.(e,t)??null}function Jt({checks:e}){return e?(0,Z.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:r(`shrink-0`,$t[e]),children:Qt[e]}):null}var Yt={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 Xt({comment:e}){let t=e.reviewState?Yt[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)(Zt,{url:e.avatarUrl,login:e.author}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Z.jsx)(q,{iso:e.createdAt}),t?(0,Z.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:r(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,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:Dt,children:e.body?(0,Z.jsx)(Ze,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no body)`})})]})}function Zt({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 Qt={passing:`✓`,failing:`✗`,pending:`○`},$t={passing:`text-semantic-green`,failing:`text-semantic-red`,pending:`text-semantic-amber`},en={passing:`Checks passing`,failing:`Checks failing`,pending:`Checks pending`};function tn({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)(ae,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function nn({checks:e,url:t}){let n=r(`text-xs font-medium`,$t[e],t&&`hover:underline`),i=`${Qt[e]} ${en[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:i}):(0,Z.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:i})}function rn({checks:e}){return(0,Z.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:en[e],"aria-label":en[e],className:r(`shrink-0 font-sans text-xs font-semibold`,$t[e]),children:Qt[e]})}function an(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function on(e,t=[]){let n=an(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=sn(t)),n}function sn(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function cn(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 ln(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 un(e,t,n){let r=(n??``).trim();if(!r)return on(e,t);let i=an(e),a=r.startsWith(i)?i+cn(r.slice(i.length),e):cn(r,e),o=ln(a,e)?a:`${i}\n\n${a}`;return t.length?o+sn(t):o}function dn(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 fn(e,t,n,r,i={}){return t?{...i,workflow:t,task:un(e,n.map(e=>e.id),r)}:n.length?{...i,steps:dn(n.map(e=>e.id)).map((e,t)=>({...e,...n[t]?.path===void 0?{}:{skillPath:n[t].path}})),task:un(e,[],r)}:{...i,workflow:`quick-task`,task:un(e,[],r)}}function pn(e){let t=o(),n=l(),r=h(),{runners:i,uninstalled:a,signedOut:s,accounts:c,repoAccount:u,accountFor:d}=Xe(),f=n.data?.defaultRunner,p=Ne(e.runner,i,f??i[0]??`claude`),m=n.data?.modelsLocked===!0,_=d(p,e.account),v=g(p,!0,_??u?.[p]),y=Ae(m?null:e.model,p,r.data,n.data?.defaultModels,v.data),b=Ie(y,v.data);return{runner:p,runnerExplicit:e.runner!==null,model:y,effort:m?``:Oe(e.effort,b),effortOptions:b,runners:i,uninstalled:a,signedOut:s,defaultRunner:f,canRun:t.isSuccess&&i.length>0,modelsLocked:m,providerPending:t.isPending,providerError:t.isError,accounts:c,account:_,repoAccount:u}}function mn(e){return{runner:ze(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 hn(e){return{...mn(e),...e.account?{agentProfile:e.account}:{}}}function gn(e,t){return e.find(e=>e.id===t)?.label??(t===``?`Runner default`:t)}function _n(e,t){let{runners:n,uninstalled:r,signedOut:i}=e;return n.length>1||r.length>0||i.length>0||n.some(e=>Ye(t,e))}function vn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,X.useRef)(null),o=(0,X.useRef)(null),[s,c]=(0,X.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,X.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,X.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let u=pn(e),{runner:d,model:f,effort:p,effortOptions:m,runners:_,canRun:v,modelsLocked:y}=u,b=l(),x=h(),S=g(d,!0,u.account??u.repoAccount?.[d]),C=Le(d,x.data,S.data,[e.model,b.data?.defaultModels?.[d]]),w=n||!v,T=r?u.accounts:[],E=_n(u,T)?(0,Z.jsx)(Me,{icon:(0,Z.jsx)(A,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:_,uninstalled:u.uninstalled,signedOut:u.signedOut,value:d,accounts:T,account:r?u.account:null,repoAccount:r?u.repoAccount:void 0,disabled:w,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===d?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,O=(0,Z.jsx)(J,{icon:(0,Z.jsx)(j,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:gn(C,f),value:f,disabled:w,readOnly:y===!0,disabledHint:y?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Ie(n,S.data);t({...e,model:n,effort:e.effort===null?null:Oe(e.effort,r)})},options:C.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Fe(d,x.data,S)},`model`),k=(0,Z.jsx)(J,{icon:(0,Z.jsx)(D,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:m.find(e=>e.value===p)?.label??`Runner default`,value:p,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:m.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,Z.jsx)(`div`,{ref:a,"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)(qe,{fill:`model-pill`,children:s?[E,k,O]:[E,O,k]})})}):(0,Z.jsxs)(qe,{children:[E,O,k]})}var yn={workflow:null,skills:[]},bn=`cez-followup-selection`;function xn(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 Sn(){try{let e=localStorage.getItem(bn);return e?xn(JSON.parse(e)):{...yn}}catch{return{...yn}}}function Cn(e){try{localStorage.setItem(bn,JSON.stringify(e))}catch{}}var wn=`cez-followup-prompt:`;function Tn(e){try{return localStorage.getItem(wn+e)??``}catch{return``}}function En(e,t){try{t===``?localStorage.removeItem(wn+e):localStorage.setItem(wn+e,t)}catch{}}function Dn({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:a,selectedSkills:o,onSkillsChange:l,engine:u,onEngineChange:d,queuedRunId:p,onQueued:h}){let g=C(),_=m(),y=e.kind===`pr`?`PR`:`issue`,b=pn(u),x=s(b.runner,b.account),S=o.filter(e=>x.unchecked||e.path===void 0||n.some(t=>t.id===e.id&&(e.path===void 0||t.path===e.path))),w=S.length!==o.length,[D]=(0,X.useState)(()=>an(e)),[O,k]=(0,X.useState)(()=>Tn(e.url)||D),A=(0,X.useRef)(null),j=(0,X.useRef)(null);(0,X.useEffect)(()=>{En(e.url,O===D?``:O)},[e.url,O,D]);let M=(0,X.useMemo)(()=>We(_.data?.promptTemplates),[_.data?.promptTemplates]),ee=e=>{let t=A.current,n=Ke({prompt:O,base:D,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:j.current}),r=Ge(O,n,e);k(r.text),j.current=r.caret,requestAnimationFrame(()=>{A.current?.focus(),A.current?.setSelectionRange(r.caret,r.caret)})},N=Je(M,S.map(e=>e.id)),F=(0,X.useRef)(O);F.current=O;let I=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=He(F.current,I.current,N,D);I.current=e.applied,e.text!==F.current&&k(e.text)},[N,D]);let L=f({mutationFn:async()=>!b.canRun||w?null:E(fn(e,r,S,O,hn(b))),onSuccess:t=>{if(t===null)return;let n=t;n&&h(e.url,n.id),T(`Added to the queue — ${y} #${e.number}`),S.length>0&&_.data!==void 0&&v({skillUsage:S.reduce((e,t)=>Te(e,t.id),_.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:c.uiState})).catch(()=>{}),En(e.url,``),k(D),I.current=``,g.invalidateQueries({queryKey:c.runs.all})},onError:e=>T(e.message,{tone:`danger`})}),te=e=>{Re({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!L.isPending&&b.canRun&&L.mutate())},R=e=>l(o.some(t=>W(t)===W(e))?o.filter(t=>W(t)!==W(e)):[...o,we(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)(ke,{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)(kn,{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)(jn,{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)(On,{skill:e,skills:n,unchecked:x.unchecked,onRemove:()=>R(e)},W(e)))}):null,w?(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)(vn,{layout:`row`,pick:u,onChange:d,disabled:L.isPending||!b.canRun,accounts:!0}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Account`}),(0,Z.jsx)(An,{resolved:b,disabled:L.isPending||!b.canRun,onPick:e=>d({...u,account:e})})]}),!b.providerPending&&!b.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:[b.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:[i(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||!b.canRun||w,onClick:()=>L.mutate(),children:[(0,Z.jsx)(oe,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,y]}),(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:De()}),p?(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)(P,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Z.jsx)(V,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function On({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)(L,{size:16,"aria-hidden":`true`,className:`size-3`})]})}function kn({workflows:e,value:t,onChange:n}){let[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),c=(0,X.useRef)(null),l=be(e,o);return(0,Z.jsxs)(le,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(Ve,t&&`border-foreground/60 font-mono text-xs font-semibold text-foreground`),children:[(0,Z.jsx)(ee,{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)(ce,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(ye,{shouldFilter:!1,children:[(0,Z.jsx)(ge,{placeholder:`Search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Z.jsxs)(ve,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,Z.jsx)(_e,{children:`Nothing matches.`}):null,(0,Z.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,Z.jsxs)(U,{value:`workflow ${e.name}`,keywords:Ce(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!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)(P,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function An({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:b,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)(J,{icon:(0,Z.jsx)(F,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function jn({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(null),d=(0,X.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=Ee(e,s,t),g=(e,t)=>{let a=n.some(t=>W(t)===W(e));return(0,Z.jsxs)(U,{value:W(e),keywords:Ce(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.id,"data-selected":a?`true`:void 0,onSelect:()=>i(we(e)),children:[(0,Z.jsx)(`span`,{className:r(`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(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Z.jsx)(re,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,Z.jsx)(P,{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)(Be,{skill:l,onClose:()=>u(null)}),(0,Z.jsxs)(le,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:r(Ve,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Z.jsx)(I,{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)(ce,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(ye,{shouldFilter:!1,children:[(0,Z.jsx)(ge,{placeholder:`Search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,Z.jsxs)(ve,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[s.trim()&&!e.some(e=>e.id===s.trim())?(0,Z.jsx)(H,{children:(0,Z.jsxs)(U,{value:`typed-skill`,onSelect:()=>i({id:s.trim()}),children:[`Use skill id “`,s.trim(),`” (unchecked)`]})}):null,(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,Z.jsx)(_e,{children:`Nothing matches.`}):null,h?h.length>0?(0,Z.jsx)(H,{children:h.map(e=>g(e,xe(e)))}):null:(0,Z.jsxs)(Z.Fragment,{children:[f.length>0?(0,Z.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,xe(e)))}):null,p.length>0?(0,Z.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,Z.jsx)(H,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var Mn=new WeakMap;function Nn(){let e=Sn(),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)&&Cn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function Pn(){let e=C(),{projectId:t}=S(),n=Mn.get(e);n||Mn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=Nn());let{snapshot:i,subscribe:o,update:c}=r,l=(0,X.useSyncExternalStore)(o,i,i),u=a(),d=pn(l.engine),f=s(d.runner,d.account),p=m(),h=u.data?.workflows;(0,X.useEffect)(()=>{h&&l.workflow!==null&&!h.some(e=>e.name===l.workflow)&&c({workflow:null})},[c,h,l.workflow]);let g=(0,X.useMemo)(()=>Se(f.data??[],p.data?.skillUsage),[f.data,p.data?.skillUsage]);return{...l,workflows:u,skillList:g,skillsUnchecked:f.unchecked,setWorkflow:e=>c({workflow:e}),setSelectedSkills:e=>c({selectedSkills:e}),setEngine:e=>c({engine:e}),onQueued:(e,t)=>c({queued:new Map(i().queued).set(e,t)})}}export{rn as a,Nt as c,yt as d,bt as f,nn as i,Ct as l,xt as m,Dn as n,tn as o,St as p,on as r,Et as s,Pn as t,Rt as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{It as e}from"./queries-CIeJg62Y.js";import{n as t}from"./project-location-Dyn7zI6j.js";function n(){return{home:e().data?.homeDir??null,root:t()}}export{n as t};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{A as i,Jt as a,Wt as o,dn as s,k as c}from"./queries-CIeJg62Y.js";import{A as l,Fn as u,hi as d,k as f,n as p,p as ee,u as te}from"./toaster-D0HMoto5.js";import{h as ne}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as m,R as h,Y as re,Z as g,a as ie,ct as ae,l as oe,n as se,nt as _,ot as v,pt as y,st as ce,ut as b,x as le,y as ue}from"./design-icons-BZt8Kqs9.js";import{t as x}from"./button-C8jUIs8Q.js";import{i as S,o as de,r as C,s as fe,t as w}from"./dialog-CB9ZhEk2.js";import{i as pe,l as me,o as he}from"./skills-pM_PouEs.js";import{c as ge,f as _e,u as ve}from"./page-shell-Dky5crRl.js";import{t as ye}from"./centered-state-BgSV4e79.js";import{Gt as T,Jt as E,Kt as D,Wt as O,Xt as k,Yt as A,Zt as j,gn as M,qt as N,tr as P,w as be}from"./index-Byw2yW7N.js";import{_ as xe,a as Se,c as Ce,f as we,g as Te,h as Ee,i as F,m as I,n as De,o as Oe,p as L,r as R,t as z,u as ke}from"./sortable.esm-CAVTYaA3.js";import{t as B}from"./textarea-vEsJAUAV.js";import{t as Ae}from"./option-select-JTiDFrqF.js";import{t as je}from"./discard-changes-dialog-C06t2BR5.js";var V=e(t(),1);function H(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 Me(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function Ne(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function Pe(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 Fe(e,t){return e.filter((e,n)=>n!==t)}function U(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 W(e,t,n){let r=` `.repeat(n);return t.includes(`
|
|
2
|
-
`)?[`${r}${e}: |`,...t.split(`
|
|
3
|
-
`).map(e=>`${r} ${e}`)]:[`${r}${e}: ${U(t)}`]}function G(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${U(e.name)}`),e.skill&&t.push(` skill: ${U(e.skill)}`),t}function Ie(e){let t=[];return e.model&&t.push(` model: ${U(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${U(e.effort)}`),e.runner&&t.push(` runner: ${U(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${U(e.agentProfile)}`),t}function Le(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(U).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(U).join(`, `)}]`),t}function K(e){return e.onFail?[` onFail:`,` retry: ${U(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function q(e){return[` - id: ${U(e.id)}`,...G(e),...e.prompt?W(`prompt`,e.prompt,4):[],...e.kind===`plugin`?[` kind: plugin`,` pluginKind: ${U(e.pluginKind)}`,...e.config===void 0?[]:[` config: ${JSON.stringify(e.config)}`]]:[],...Ie(e),...Le(e),...e.command?W(`command`,e.command,4):[],...K(e)]}function Re(e,t,n){let r=[`name: ${U(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...W(`description`,t.trim(),0));let i=H(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${U(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...q(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 Be(e){let t=H(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Ve(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 He(e,t,n){let r=H(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var J=n();function Ue({workflows:e,draft:t,trimmedName:n,nameRef:r,onDraft:i,onLoadWorkflow:a,renamedFrom:o}){return(0,J.jsxs)(`section`,{"data-slot":`wb-metadata`,"data-reports-dirty":``,className:`grid min-w-0 grid-cols-1 gap-3 @xl:grid-cols-2 @4xl:grid-cols-[minmax(180px,240px)_minmax(200px,280px)_minmax(0,1fr)] @xl:items-start`,children:[(0,J.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex min-w-0 flex-col gap-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs font-medium text-foreground`,children:`Load an existing workflow`}),(0,J.jsx)(Ae,{id:`workflow-load`,"data-slot":`wb-load-picker`,value:e.some(e=>e.name===n)?n:``,placeholder:`Choose a workflow`,onValueChange:t=>{let n=e.find(e=>e.name===t);n&&a(n)},options:e.map(e=>({value:e.name,label:e.name})),className:`w-full min-w-0 rounded-lg border-border bg-card px-3.5 text-xs font-medium text-foreground md:data-[size=default]:h-10`})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-medium text-foreground`,children:`Workflow name`}),(0,J.jsx)(P,{id:`workflow-name`,ref:r,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:t.name,"aria-describedby":o===void 0?void 0:`workflow-rename-note`,onChange:e=>i({...t,name:e.target.value}),className:`h-10 bg-card text-sm max-md:h-11`}),(0,J.jsx)(`p`,{id:`workflow-rename-note`,"aria-live":`polite`,className:`text-xs text-muted-foreground empty:hidden`,children:o===void 0?null:(0,J.jsxs)(`span`,{"data-slot":`wb-rename-note`,children:[`Saving creates a new workflow “`,n,`”. “`,o,`” stays as it is.`]})})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 @xl:col-span-2 @4xl:col-span-1`,children:[(0,J.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-medium text-foreground`,children:`Description`}),(0,J.jsx)(B,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,rows:1,value:t.description,onChange:e=>i({...t,description:e.target.value}),className:`min-h-10 bg-card px-3 py-2 text-sm max-md:min-h-11`})]})]})}function We({savedFile:e,autoOpen:t,onImportToggle:n,onExport:r,onAutoToggle:i,onDeleteRequest:a}){return(0,J.jsxs)(`div`,{"data-slot":`wb-actions`,className:`grid grid-cols-[max-content_max-content] items-center justify-start gap-2 sm:flex sm:flex-wrap [&_button]:min-h-11 [&_button]:border [&_button]:border-border [&_button]:bg-card`,children:[(0,J.jsxs)(x,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:n,children:[(0,J.jsx)(ae,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,J.jsxs)(x,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:r,children:[(0,J.jsx)(le,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,J.jsxs)(x,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":t,"aria-describedby":`wb-auto-hint`,title:`Auto-build: describe the chain in words and an agent drafts its steps for you to review`,onClick:i,children:[(0,J.jsx)(b,{"aria-hidden":`true`,className:`size-3`}),`Auto-build`]}),(0,J.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,J.jsxs)(x,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-delete`,className:`relative text-danger hover:text-danger sm:ms-3 sm:before:absolute sm:before:-start-[13px] sm:before:top-1/2 sm:before:h-5 sm:before:w-px sm:before:-translate-y-1/2 sm:before:bg-border sm:before:content-['']`,title:`Delete the saved workflow file`,onClick:a,children:[(0,J.jsx)(v,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function Ge({text:e,onTextChange:t,pending:n,onRun:r,onCancel:i}){return(0,J.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,J.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,J.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,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,J.jsxs)(x,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:n||e.trim()===``,onClick:r,children:[(0,J.jsx)(b,{"aria-hidden":`true`,className:`size-3`}),n?`Building…`:`Build chain`]}),(0,J.jsxs)(x,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:i,children:[(0,J.jsx)(y,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,J.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function Ke({open:e,onOpenChange:t,text:n,onTextChange:r,error:i,pending:a,onRun:o,onCancel:s}){return(0,J.jsx)(w,{open:e,onOpenChange:t,children:(0,J.jsxs)(C,{showCloseButton:!1,"data-slot":`wb-import-panel`,className:`max-md:translate-x-0 max-md:translate-y-0 sm:max-w-[660px] rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,J.jsx)(fe,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,J.jsx)(S,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,J.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,J.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,J.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:i}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,J.jsx)(x,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:a,onClick:o,children:`Import`}),(0,J.jsx)(x,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:s,children:`Cancel`})]})]})})}function qe({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,J.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,J.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,J.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,J.jsx)(g,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,J.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,J.jsx)(it,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,J.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,J.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,J.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,J.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,J.jsx)(m,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,J.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,J.jsx)(ot,{yaml:o})}),(0,J.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 Y({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,J.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,J.jsx)(_,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,J.jsx)(rt,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function Je({open:e,onOpenChange:t,query:n,onQueryChange:r,matches:i,skillsCount:a,error:o,selectedSkill:s,onSelectSkill:c,stepsCount:l,onCloseAutoFocus:u,onCancel:d,onAdd:f}){return(0,J.jsx)(w,{open:e,onOpenChange:t,children:(0,J.jsxs)(C,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:u,className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button]:min-h-11`,children:[(0,J.jsxs)(de,{children:[(0,J.jsx)(fe,{className:`text-xl font-normal`,children:`Add step`}),(0,J.jsx)(S,{className:`sr-only`,children:`Choose a skill to append to this workflow.`})]}),(0,J.jsx)(P,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:n,onChange:e=>r(e.target.value)}),o===null?(0,J.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[i.map(e=>(0,J.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,J.jsx)(`input`,{type:`radio`,name:`workflow-add-skill`,className:`sr-only`,value:e.id,checked:s===e.id,onChange:()=>c(e.id)}),(0,J.jsxs)(`span`,{className:`min-w-0 break-words text-sm`,children:[(0,J.jsx)(`span`,{className:`block`,children:e.name}),(0,J.jsx)(`span`,{className:`mt-2 block text-xs text-muted-foreground`,children:e.description}),e.path?(0,J.jsx)(`span`,{className:`block break-all text-xs`,children:e.path}):null]})]},JSON.stringify([e.id,e.path]))),i.length===0?(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a===0?`No skills available in this project.`:`No matching skills.`}):null]}):(0,J.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not load skills: `,o]}),n.trim()&&!i.some(e=>e.id===n.trim())?(0,J.jsxs)(x,{onClick:()=>c(n.trim()),children:[`Use skill id “`,n.trim(),`” (unchecked)`]}):null,(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,J.jsx)(x,{variant:`outline`,onClick:d,children:`Cancel`}),(0,J.jsx)(x,{variant:`primary`,disabled:!s||l>=8,onClick:()=>{s&&f(s)},children:`Add selected skill`})]}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the selected skill, then reorder it in the existing canvas.`}),l>=8?(0,J.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 Ye({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(O,{open:n,onOpenChange:e=>!e&&r(),children:(0,J.jsxs)(N,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,J.jsxs)(k,{children:[(0,J.jsxs)(j,{children:[`“`,e,`” already exists`]}),(0,J.jsx)(E,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,J.jsxs)(A,{children:[(0,J.jsx)(D,{children:`Keep the file`}),(0,J.jsx)(T,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,J.jsx)(O,{open:i,onOpenChange:e=>!e&&a(),children:(0,J.jsxs)(N,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,J.jsxs)(k,{children:[(0,J.jsxs)(j,{children:[`Delete workflow “`,e,`”?`]}),(0,J.jsxs)(E,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,J.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,J.jsxs)(A,{children:[(0,J.jsx)(D,{children:`Keep the file`}),(0,J.jsx)(T,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function X(e){return e.name??e.skill??e.id}function Z(e){return e.skill&&e.name&&e.name!==e.skill?e.skill:void 0}function Q(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function Xe(e){let t=e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``;return`$ ${e.command}${t}`}function Ze(e,t){return Q(e)||t?.description||`Not listed by this runner and account. Step open will check the skill id.`}function Qe(e,t){return e.command?Xe(e):e.skill?Ze(e,t):e.prompt??``}function $e(e,t){return e.skill&&!t?`unknown`:null}function et(e){return e.command?`Command step${e.onFail?` · Retry ×${e.onFail.max??2}`:``}`:e.skill?`Skill step`:`Prompt step`}function tt({index:e,title:t,badge:n,onRemove:i,gripProps:a}){return(0,J.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,J.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`,...a,children:[(0,J.jsx)(h,{"aria-hidden":`true`,className:`size-4 opacity-70 transition-opacity group-hover/grip:opacity-100`}),(0,J.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:String(e+1).padStart(2,`0`)})]}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),n?(0,J.jsx)(`span`,{"data-slot":`wb-step-badge`,className:r(`shrink-0 rounded-full border px-2 py-px font-mono text-xs`,n===`unknown`&&`border-danger/35 text-danger`),children:n}):null,i?(0,J.jsxs)(x,{"data-slot":`wb-step-remove`,variant:`ghost`,size:`sm`,className:`shrink-0`,"aria-label":`Remove step ${e+1}: ${t}`,onClick:i,children:[(0,J.jsx)(v,{"aria-hidden":`true`}),` Remove`]}):null]})}function nt({index:e,onMoveUp:t,onMoveDown:n}){return(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 @min-[900px]:hidden`,children:[(0,J.jsxs)(x,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} up`,disabled:!t,onClick:t,children:[(0,J.jsx)(ie,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,J.jsxs)(x,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} down`,disabled:!n,onClick:n,children:[(0,J.jsx)(se,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function rt({step:e,index:t,skills:n,onRemove:i,gripProps:a,onMoveUp:o,onMoveDown:s,overlay:c=!1}){let l=n.find(t=>t.id===e.skill),u=X(e),d=Qe(e,l),f=$e(e,l);return(0,J.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:r(`rounded-lg border border-border bg-background p-4`,c&&`shadow-md`),children:[(0,J.jsx)(tt,{index:t,title:u,badge:f,onRemove:i,gripProps:a}),d?(0,J.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-1.5 break-words text-xs leading-relaxed text-muted-foreground`,children:d}):null,(0,J.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-1.5 text-xs text-link-foreground`,children:et(e)}),Z(e)?(0,J.jsx)(`p`,{"data-slot":`wb-step-skill`,className:`mt-1 font-mono text-xs text-muted-foreground`,children:Z(e)}):null,c?null:(0,J.jsx)(nt,{index:t,onMoveUp:o,onMoveDown:s})]})}function it({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,J.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=me(e,t);return(0,J.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,J.jsx)(at,{skill:e,inFlow:r.has(e.id),onAdd:i},JSON.stringify([e.id,e.path]))):(0,J.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 at({skill:e,inFlow:t,onAdd:n}){let{listeners:i,setNodeRef:a,isDragging:o}=L({id:`palette:${JSON.stringify([e.id,e.path])}`,data:{type:`palette`,skill:e.id}});return(0,J.jsxs)(`div`,{ref:a,"data-slot":`wb-skill`,"data-skill":e.id,"data-in-flow":t||void 0,title:e.description??``,className:r(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,o&&`opacity-40`),...i,children:[(0,J.jsxs)(`span`,{className:r(`min-w-0 flex-1 break-words text-xs`,pe(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:[e.name,e.path?(0,J.jsx)(`span`,{className:`block break-all text-xs text-soft-foreground`,children:e.path}):null]}),(0,J.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,J.jsx)(re,{"aria-hidden":`true`,className:`size-3.5`})})]})}function ot({yaml:e}){let[t,n]=(0,V.useState)(!1),r=(0,V.useRef)(null);return(0,V.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,J.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,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(oe,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ue,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}function st(e,t){return{yaml:Re(e.name,e.description,e.steps),loadedName:t}}function ct(){let[e,t]=(0,V.useState)(null),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),o=(0,V.useRef)(0),s=e!==null&&n!==null&&st(e,void 0).yaml!==n.yaml;M(s);let c=(e,n)=>{o.current+=1,t(e),r(st(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:st(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 lt=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function ut(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function dt(){let{name:e}=ne();return(0,J.jsx)(ft,{routeName:e},e??``)}function ft({routeName:e}){let t=i(),n=a(),r=c(),ne=d(),m=ct(),{draft:h,setDraft:g}=m,[ie,ae]=(0,V.useState)(``),[se,_]=(0,V.useState)(!1),[v,y]=(0,V.useState)(``),[b,le]=(0,V.useState)(null),[ue,S]=(0,V.useState)(!1),[de,C]=(0,V.useState)(``),[fe,w]=(0,V.useState)(``),[pe,T]=(0,V.useState)(!1),[E,D]=(0,V.useState)(``),[O,k]=(0,V.useState)(!1),[A,j]=(0,V.useState)(!1),M=(0,V.useId)(),[N,P]=(0,V.useState)(null),[xe,F]=(0,V.useState)(null),I=(0,V.useRef)(null),L=(0,V.useRef)(null),R=t.data?.workflows??[],z=n.data??[],B=he(z,r.data?.skillUsage),Ae=me(B,v,r.data?.skillUsage);(0,V.useEffect)(()=>{if(h!==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`);m.replace(r?ut(r):$(),r?.name)},[h,t.data,e,m.replace]);let H=e=>g(t=>t===null?t:{...t,steps:e}),U=s({mutationFn:e=>f(e),onSuccess:e=>{g({name:e.name,description:e.description??``,steps:e.steps}),S(!1),C(``),w(``),p(`Imported "${e.name}" — review, then Save.`)},onError:e=>w(e.message)}),W=s({mutationFn:e=>l(e),onSuccess:e=>{g(t=>{let n=t??$(),{name:r,steps:i}=Ve(e,n.name);return{...n,name:r,steps:i}}),T(!1),D(``),p(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??h?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>p(e instanceof Error?e.message:String(e),{tone:`danger`})}),G=s({onMutate:()=>m.sending(),mutationFn:e=>te({...He(h?.name??``,h?.description??``,h?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:(e,t,n)=>{k(!1),m.saved(n),p(`Saved — ${e.path.split(`/`).pop()??e.path}`),ne.invalidateQueries({queryKey:o.workflows})},onError:e=>{e instanceof u&&e.exists===!0?k(!0):p(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Ie=s({mutationFn:e=>ee(e),onSuccess:(e,t)=>{j(!1),p(`Deleted "${t}".`),m.replace($(),void 0),ne.invalidateQueries({queryKey:o.workflows})},onError:e=>{j(!1),p(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Le=Te(Ee(ke,{activationConstraint:{distance:4}}),Ee(Ce,{coordinateGetter:De}));if(t.isError)return(0,J.jsx)(ve,{route:`workflows`,density:`empty`,className:`@container`,children:(0,J.jsx)(ye,{icon:(0,J.jsx)(ce,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(h===null)return(0,J.jsx)(be,{});let K=h.steps,q=h.name.trim(),Y=R.find(e=>e.name===q&&e.source===`file`),X=Re(h.name,h.description,K),Z=Y!==void 0&&Re(Y.name,Y.description??``,Y.steps??[])===X,Q=(e,t=K.length)=>{if(K.length>=8){p(`A workflow holds at most 8 steps.`,{tone:`danger`});return}H(Ne(K,Me(e,K),t))};return(0,J.jsxs)(ve,{route:`workflows`,density:_e(K.length),className:`@container`,header:{title:`Workflows`,subtitle:`Portable skill chains. Steps run from top to bottom.`,status:Z?(0,J.jsx)(`span`,{id:M,"data-slot":`wb-save-cue`,className:`whitespace-nowrap text-xs text-muted-foreground`,children:`No unsaved changes`}):void 0,secondaryActions:(0,J.jsxs)(ge,{type:`button`,variant:`outline`,"data-slot":`wb-new`,onClick:()=>m.guardedReplace($(),void 0),children:[(0,J.jsx)(re,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]}),primaryAction:(0,J.jsxs)(ge,{type:`button`,variant:`primary`,"data-slot":`wb-save`,disabled:G.isPending||Z,"aria-describedby":Z?M:void 0,onClick:()=>{if(q===``){I.current?.focus();return}if(K.length===0){p(`Add at least one step first.`,{tone:`danger`});return}G.mutate(!1)},children:[(0,J.jsx)(oe,{"aria-hidden":`true`,className:`size-4`}),`Save workflow`]})},children:[(0,J.jsxs)(Se,{sensors:Le,collisionDetection:we,onDragStart:e=>{let t=e.active.data.current;P(t??null)},onDragOver:e=>{F(e.over?String(e.over.id):null)},onDragEnd:e=>{P(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===lt?K.length:K.findIndex(e=>e.id===n.id);Q(r.skill,e===-1?K.length:e);return}if(n.id===t.id)return;let i=K.findIndex(e=>e.id===t.id),a=K.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&H(Pe(K,i,a))},onDragCancel:()=>{P(null),F(null)},children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4 pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,J.jsx)(Ue,{workflows:R,draft:h,trimmedName:q,nameRef:I,onDraft:g,onLoadWorkflow:e=>m.guardedReplace(ut(e),e.name),renamedFrom:m.renamedFrom(q)}),(0,J.jsx)(We,{savedFile:Y,autoOpen:pe,onImportToggle:()=>{w(``),T(!1),S(e=>!e)},onExport:()=>{let e=new Blob([X],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${ze(h.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{S(!1),T(e=>!e)},onDeleteRequest:()=>j(!0)}),pe?(0,J.jsx)(Ge,{text:E,onTextChange:D,pending:W.isPending,onRun:()=>{let e=E.trim();e===``||W.isPending||W.mutate(e)},onCancel:()=>{T(!1),D(``)}}):null,(0,J.jsx)(Ke,{open:ue,onOpenChange:S,text:de,onTextChange:C,error:fe,pending:U.isPending,onRun:()=>{let e=de.trim();e!==``&&U.mutate(e)},onCancel:()=>{S(!1),C(``),w(``)}}),(0,J.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,J.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,title:`A workflow holds at most 8 steps`,children:[`Steps · `,K.length,` of `,8,` max`,(0,J.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Be(K)})]}),(0,J.jsx)(pt,{steps:K,skills:z,dragging:N!==null,overId:xe,activeStepId:N?.type===`step`?N.step.id:null,onRemove:e=>H(Fe(K,e)),onMove:(e,t)=>H(Pe(K,e,t))}),(0,J.jsxs)(x,{ref:L,variant:`outline`,className:`mt-4 min-h-11`,onClick:()=>{le(null),y(``),_(!0)},children:[(0,J.jsx)(re,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,J.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,J.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]})]}),(0,J.jsx)(qe,{paletteSkills:B,query:ie,onQueryChange:ae,error:n.isError?n.error.message:null,inFlow:new Set(K.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Q(e),yaml:X})]})]}),(0,J.jsx)(Oe,{children:(0,J.jsx)(ht,{dragging:N,steps:K,skills:z})})]}),(0,J.jsx)(Je,{open:se,onOpenChange:_,query:v,onQueryChange:y,matches:Ae,skillsCount:z.length,error:n.isError?n.error.message:null,selectedSkill:b,onSelectSkill:le,stepsCount:K.length,onCloseAutoFocus:e=>{e.preventDefault(),L.current?.focus()},onCancel:()=>_(!1),onAdd:e=>{Q(e),_(!1)}}),(0,J.jsx)(Ye,{trimmedName:q,savedFile:Y,overwriteOpen:O,onOverwriteDismiss:()=>k(!1),deleteOpen:A,onDeleteDismiss:()=>j(!1),onOverwrite:()=>G.mutate(!0),onDelete:()=>Ie.mutate(q)}),(0,J.jsx)(je,{open:m.discardOpen,subject:q===``?`this workflow`:`“${q}”`,onKeep:m.keepEditing,onDiscard:m.discard})]})}function pt({steps:e,skills:t,dragging:n,overId:i,activeStepId:a,onRemove:o,onMove:s}){let{setNodeRef:c,isOver:l}=I({id:lt}),u=n&&i===lt;return(0,J.jsx)(`div`,{ref:c,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:r(`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,J.jsx)(`p`,{className:r(`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,J.jsxs)(z,{items:e.map(e=>e.id),strategy:F,children:[(0,J.jsx)(`ol`,{className:`flex flex-col gap-2.5`,children:e.map((r,c)=>(0,J.jsx)(mt,{step:r,index:c,skills:t,dragging:n,insertBefore:n&&i===r.id&&a!==r.id,onRemove:()=>o(c),onMoveUp:c>0?()=>s(c,c-1):void 0,onMoveDown:c<e.length-1?()=>s(c,c+1):void 0},r.id))}),(0,J.jsx)(`div`,{"aria-hidden":`true`,className:r(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,u?`bg-accent-strong`:`bg-transparent`)})]})})}function mt({step:e,index:t,insertBefore:n,onRemove:i,onMoveUp:o,onMoveDown:s}){let c=a(e.runner,e.agentProfile),{attributes:l,listeners:u,setNodeRef:d,transform:f,transition:p,isDragging:ee}=R({id:e.id,data:{type:`step`,step:e}});return(0,J.jsxs)(`li`,{ref:d,style:{transform:xe.Transform.toString(f),transition:p},className:r(`relative`,ee&&`opacity-40`),children:[n?(0,J.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[7px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,J.jsx)(rt,{step:e,index:t,skills:c.data??[],onRemove:i,onMoveUp:o,onMoveDown:s,gripProps:{...l,...u}})]})}function ht(e){let t=e.dragging?.type===`step`?e.dragging.step:void 0,n=a(t?.runner,t?.agentProfile,!!t);return(0,J.jsx)(Y,{...e,skills:t?n.data??[]:e.skills})}export{dt as WorkflowsRoute};
|