cezarion 0.19.0-dev.8721 → 0.19.0-dev.8731
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/web/dist/assets/accounts-section-DVJon113.js +1 -0
- package/web/dist/assets/{activity-motion-C8V7jGPP.js → activity-motion-D_Mig_D4.js} +1 -1
- package/web/dist/assets/{activity-route-CCOvPI4k.js → activity-route-BvYIEdOs.js} +1 -1
- package/web/dist/assets/{agent-config-section-DkJsuQeu.js → agent-config-section-BImy20b0.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-BqGJuaw_.js → agent-defaults-section-D30dOTKu.js} +1 -1
- package/web/dist/assets/{appearance-BnvyVZZH.js → appearance-CHsrT2VO.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-D7-FuLiL.js → archive-on-merge-field-BT4e_k9f.js} +1 -1
- package/web/dist/assets/attention-CGsbqL2t.js +1 -0
- package/web/dist/assets/{automations-route-C9Gcx3ov.js → automations-route-BEhmjeVF.js} +2 -2
- package/web/dist/assets/{commit-list-DNiFNJqd.js → commit-list-02HM16KN.js} +1 -1
- package/web/dist/assets/{diff-B60FGSvK.js → diff-BmDcJsHL.js} +2 -2
- package/web/dist/assets/{diff-controls-D6LIYMhn.js → diff-controls-HmgYRhy7.js} +1 -1
- package/web/dist/assets/{diff-view-Blyp1vQ3.js → diff-view-CRx2ZNOd.js} +1 -1
- package/web/dist/assets/{file-preview-C0EtwJYH.js → file-preview-B361k1Oo.js} +1 -1
- package/web/dist/assets/{folder-browser-6stmlyVQ.js → folder-browser-BJ3aXo9k.js} +1 -1
- package/web/dist/assets/{git-toolbar-CRj5dZa2.js → git-toolbar-DsNQUL5f.js} +1 -1
- package/web/dist/assets/github-DP2REdU5.js +1 -0
- package/web/dist/assets/{global-activity-route-Db2_yTAR.js → global-activity-route-Iv0uN7Wy.js} +1 -1
- package/web/dist/assets/index-CVz-Ls8s.css +1 -0
- package/web/dist/assets/{index-BX94wp6m.js → index-mCjln54E.js} +6 -6
- package/web/dist/assets/{label-BKUl84DF.js → label-CH-a6Jyv.js} +1 -1
- package/web/dist/assets/{markdown-DK1FZN4x.js → markdown-DiMerfHU.js} +1 -1
- package/web/dist/assets/{notifications-section-dI7sOt8i.js → notifications-section-DGH8tp1N.js} +1 -1
- package/web/dist/assets/{open-in-menu-N8rXgYSG.js → open-in-menu-CML2QKil.js} +1 -1
- package/web/dist/assets/{popover-BPgUYFyu.js → popover-CZV6tz9i.js} +1 -1
- package/web/dist/assets/preview-pane-connected-Cl_6DHNm.js +3 -0
- package/web/dist/assets/{project-location-CcmuGA5W.js → project-location-CZNz3wYW.js} +1 -1
- package/web/dist/assets/{project-router-CT6gVIcC.js → project-router-BvBqllk2.js} +1 -1
- package/web/dist/assets/{projects-section-B-eMkZf3.js → projects-section-D3h_nr6-.js} +1 -1
- package/web/dist/assets/prompt-templates-section-DelsVm7I.js +1 -0
- package/web/dist/assets/{queries-ClkIgWFx.js → queries-CYWRnyM5.js} +1 -1
- package/web/dist/assets/{reference-chip-B8bfD56G.js → reference-chip-BdikRjql.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-BxFlEKfC.js → remote-settings-notice-D2x0qeKt.js} +1 -1
- package/web/dist/assets/repo-git-DKkOxBOJ.js +1 -0
- package/web/dist/assets/{report-reader-DT6V1PE1.js → report-reader-D2b9baRm.js} +1 -1
- package/web/dist/assets/{report-selection-D9xJZoKb.js → report-selection-D2RvkiGX.js} +1 -1
- package/web/dist/assets/{reports-pCaOIoVC.js → reports-CBP54u9k.js} +1 -1
- package/web/dist/assets/{resources-section-Dr0YbhlY.js → resources-section-D86nQvrk.js} +1 -1
- package/web/dist/assets/review-panel-BcuyfiuF.js +11 -0
- package/web/dist/assets/{run-detail-refresh-Bo51TspT.js → run-detail-refresh-BNI7eMgG.js} +1 -1
- package/web/dist/assets/run-header-B2AfxeyZ.js +2 -0
- package/web/dist/assets/{select-DzxGxxTm.js → select-KMLdkF0Y.js} +1 -1
- package/web/dist/assets/{session-context-section-BxrtJ6og.js → session-context-section-Do5bNw8y.js} +2 -2
- package/web/dist/assets/{settings-agent-picker-CDt7Ns8e.js → settings-agent-picker-Dtqb26Hz.js} +1 -1
- package/web/dist/assets/{settings-shell-B9ladcQ_.js → settings-shell-CWPwhUDh.js} +1 -1
- package/web/dist/assets/{sidebar-section-CRUJRrAR.js → sidebar-section-pLjtUKHT.js} +1 -1
- package/web/dist/assets/{skills-Co7HupH_.js → skills-CaXsJiUU.js} +1 -1
- package/web/dist/assets/{tab-link-BMblA2WK.js → tab-link-B0pNjKxZ.js} +1 -1
- package/web/dist/assets/task-changes-oogngDub.js +1 -0
- package/web/dist/assets/{task-commits-ISUoukSa.js → task-commits-_Aa8bkJq.js} +1 -1
- package/web/dist/assets/task-file-scope-DY0ozMDn.js +1 -0
- package/web/dist/assets/task-files-DxFFK3zI.js +1 -0
- package/web/dist/assets/{task-github-item-Cg8gVOKX.js → task-github-item-LSzJuoiu.js} +1 -1
- package/web/dist/assets/{task-groups-aquji1Kv.js → task-groups-lh9gz7TP.js} +1 -1
- package/web/dist/assets/task-thread-BlThx_dR.js +2 -0
- package/web/dist/assets/task-thread-PDeU-fL6.css +1 -0
- package/web/dist/assets/{tasks-table-BkjZYg2J.js → tasks-table-k18AuMR5.js} +1 -1
- package/web/dist/assets/thread-state-DA2aAkKF.js +4 -0
- package/web/dist/assets/{toaster-C-xqAWVX.js → toaster-B0kvcFif.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-ibAi0h18.js → use-hand-to-agent-state-dgiJEULj.js} +1 -1
- package/web/dist/assets/workflows-DNs9e08u.js +7 -0
- package/web/dist/assets/{workspace-tools-HU7VkLIs.js → workspace-tools-DHek4GFd.js} +1 -1
- package/web/dist/assets/{worktrees-section-uDWkAqqs.js → worktrees-section-fLfqff8U.js} +1 -1
- package/web/dist/index.html +15 -15
- package/web/dist/assets/accounts-section-BObx1Wc5.js +0 -1
- package/web/dist/assets/attention--Y0CyzCN.js +0 -1
- package/web/dist/assets/github-DjD-J1Cb.js +0 -1
- package/web/dist/assets/index-BtmQDC_G.css +0 -1
- package/web/dist/assets/preview-pane-connected-B37RWFUW.js +0 -3
- package/web/dist/assets/prompt-templates-section-BNbYFE3y.js +0 -1
- package/web/dist/assets/repo-git-CEYHupW1.js +0 -1
- package/web/dist/assets/review-panel-wprTeofI.js +0 -8
- package/web/dist/assets/run-header-GiajAH1E.js +0 -2
- package/web/dist/assets/task-changes-Dwcer1B-.js +0 -1
- package/web/dist/assets/task-files-Bek9A4TF.js +0 -1
- package/web/dist/assets/task-thread-DbBtpcw3.js +0 -2
- package/web/dist/assets/task-thread-DzADOhZd.css +0 -1
- package/web/dist/assets/thread-state-CEVwXFWy.js +0 -4
- package/web/dist/assets/workflows-Dy_qXVKT.js +0 -7
|
@@ -1,3 +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{t as r}from"./utils-DSMR_WLb.js";import{Xr as i,Yr as a,Zr as o,mr as s,n as c}from"./toaster-C-xqAWVX.js";import{t as l}from"./createLucideIcon-BHp8sXmF.js";import{t as u}from"./arrow-right-Dh_Lx3um.js";import{t as d}from"./check-OP-CVgZG.js";import{t as f}from"./chevron-down-CHGyCDBH.js";import{n as p,t as m}from"./circle-x-7nTlobAF.js";import{n as h,t as g}from"./smartphone-Lr8Ug2z_.js";import{t as _}from"./info-DA1x_4bz.js";import{t as v}from"./loader-circle-CPBhhDbB.js";import{n as y,t as ee}from"./moon-CRE9nU5R.js";import{t as b}from"./play-CmVAj_fu.js";import{o as x}from"./tool-display-B9NN44oU.js";import{n as te,o as S,s as C}from"./thread-state-CEVwXFWy.js";import{t as ne}from"./square-terminal-B6RYYieR.js";import{t as w}from"./button-B7MKxYjT.js";import{a as T,c as re,i as E,l as D,p as O,r as k,s as ie,t as ae}from"./dropdown-menu-4e2iKSMT.js";import{s as oe}from"./project-router-CT6gVIcC.js";import{t as A}from"./status-dot-BRzVlF2X.js";import{Bn as se,Ln as ce,Qn as le,Rn as ue,_ as de,c as fe,cr as j,d as pe,f as M,g as me,l as he,p as ge,sr as _e,tr as ve,u as ye,ur as be,v as xe,zn as Se}from"./index-BX94wp6m.js";var Ce=l(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),N=l(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),we=l(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),P=l(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),F=l(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),I=l(`folder-x`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),Te=l(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),L=l(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),R=l(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),Ee=l(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),De=l(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),z=l(`monitor-smartphone`,[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]),B=l(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),V=l(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),H=l(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),U=l(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),W=l(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),G=l(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),K=l(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),Oe=l(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),q=e(t(),1),ke=1e3,Ae=[500,1e3,2e3,4e3,8e3],je=1;function Me(e,t){let n=`/api/v1/p/${encodeURIComponent(e.projectId)}/runs/${encodeURIComponent(e.runId)}/preview/ws`,r=()=>`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${n}`,o=null,c,l=!1,u=!1,d=0,f=0,p=()=>typeof document>`u`||a(),m=()=>{if(l||!p())return;let e=globalThis.WebSocket;if(typeof e!=`function`)return;let n=new e(r());n.binaryType=`blob`,o=n,n.addEventListener(`open`,()=>{n===o&&(u=!0,t.onTransport(`open`))}),n.addEventListener(`message`,e=>{if(n!==o)return;let r=e.data;if(typeof r==`string`){let e;try{e=JSON.parse(r)}catch{return}let n=s.safeParse(e);n.success&&t.onMessage(n.data);return}r instanceof Blob&&(f=0,t.onFrame(r))}),n.addEventListener(`error`,()=>void 0),n.addEventListener(`close`,()=>{if(n!==o||l)return;if(o=null,!u){if(d+=1,d>=2){l=!0,t.onTransport(`blocked`);return}t.onTransport(`reconnecting`,d),c=setTimeout(m,ke);return}if(f>=5){l=!0,t.onTransport(`closed`);return}let e=Ae[Math.min(f,Ae.length-1)];f+=1,t.onTransport(`reconnecting`,f),c=setTimeout(m,e)})},h=i(e=>{if(!l)if(e)o||m();else{clearTimeout(c),c=void 0;let e=o;o=null,e?.close(),t.onTransport(`connecting`)}});return t.onTransport(`connecting`),m(),{send(e){o?.readyState===je&&o.send(JSON.stringify(e))},close(){l=!0,h(),clearTimeout(c),c=void 0;let e=o;o=null,e?.close()}}}var J=n();function Ne({iconOnly:e=!1,responsive:t=!1,className:n}){return t?(0,J.jsx)(Se,{children:(0,J.jsxs)(ce,{children:[(0,J.jsx)(se,{asChild:!0,children:(0,J.jsxs)(`span`,{role:`img`,"aria-label":`Experimental`,tabIndex:0,"data-slot":`preview-experimental`,className:r(`inline-flex h-7 min-w-7 shrink-0 items-center justify-center gap-0 rounded-full bg-muted px-0 text-xs font-semibold text-muted-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none @min-[640px]:gap-1.5 @min-[640px]:px-2.5`,n),children:[(0,J.jsx)(F,{className:`size-3.5`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`hidden @min-[640px]:inline`,children:`Experimental`})]})}),(0,J.jsx)(ue,{children:`Experimental`})]})}):e?(0,J.jsx)(Se,{children:(0,J.jsxs)(ce,{children:[(0,J.jsx)(se,{asChild:!0,children:(0,J.jsx)(`span`,{role:`img`,"aria-label":`Experimental`,tabIndex:0,"data-slot":`preview-experimental`,className:r(`inline-flex size-7 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,n),children:(0,J.jsx)(F,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,J.jsx)(ue,{children:`Experimental`})]})}):(0,J.jsxs)(`span`,{"data-slot":`preview-experimental`,className:r(`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-full bg-muted px-2.5 text-xs font-semibold text-muted-foreground`,n),children:[(0,J.jsx)(F,{className:`size-3.5`,"aria-hidden":`true`}),`Experimental`]})}function Y({text:e,source:t,onCopy:n,className:i}){let a=e.replace(/\s+$/,``).split(`
|
|
2
|
-
`);return(0,J.jsxs)(`div`,{"data-slot":`preview-log-tail`,className:r(`min-w-0 rounded-lg bg-muted px-3.5 py-3 font-mono text-xs`,i),children:[(0,J.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3 font-sans text-xs text-soft-foreground`,children:[(0,J.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,J.jsx)(`span`,{className:`font-semibold tracking-wide uppercase`,children:`Log tail`}),` last ${a.length} ${a.length===1?`line`:`lines`} · ${t}`]}),(0,J.jsxs)(`button`,{type:`button`,className:`-m-2 inline-flex min-h-11 items-center gap-1.5 rounded-sm p-2 text-muted-foreground hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none md:m-0 md:min-h-0 md:p-0`,onClick:()=>n(e),children:[(0,J.jsx)(j,{className:`size-3.5`,"aria-hidden":`true`}),`Copy`]})]}),(0,J.jsx)(`pre`,{className:`max-h-48 overflow-auto break-words whitespace-pre-wrap text-foreground`,children:e.replace(/\s+$/,``)})]})}var Pe=/^([a-z][a-z0-9+.-]*):/i;function Fe(e,t){let n=e.trim();if(n===``)return{kind:`error`,message:`Type a URL or a port.`};if(/^\d{1,5}$/.test(n)){let e=Number(n);return e<1||e>65535?{kind:`error`,message:`A port is a number from 1 to 65535.`}:t.some(t=>t.port===e)?{kind:`server`,port:e}:{kind:`url`,url:`http://localhost:${e}`}}let r=Pe.exec(n)?.[1]?.toLowerCase();return r&&!/^[a-z0-9.-]+:\d/i.test(n)?r!==`http`&&r!==`https`?{kind:`error`,message:`Only http and https addresses open here.`}:Ie(n):Ie(`http://${n}`)}function Ie(e){let t={kind:`error`,message:`That is not a valid address.`};if(/\s/.test(e))return t;try{new URL(e)}catch{return t}return{kind:`url`,url:e}}function Le(e){return e.replace(/^https?:\/\//i,``)}var Re=`https://github.com/hearsay-tools/squawk#environment-variables`;function ze({state:e,actions:t,url:n,worktree:r}){switch(e.stage){case`chromium-missing`:return(0,J.jsx)(Ue,{state:e,actions:t});case`downloading`:return(0,J.jsx)(Ge,{state:e,actions:t});case`download-failed`:return(0,J.jsx)(Ke,{state:e,actions:t});case`sandbox-failed`:return(0,J.jsx)(qe,{state:e,actions:t});case`browser-exited`:return(0,J.jsx)(Je,{state:e,actions:t});case`needs-approval`:return(0,J.jsx)(Ze,{state:e,actions:t});case`port-held`:return(0,J.jsx)(Qe,{state:e,actions:t});case`server-starting`:return(0,J.jsx)($e,{state:e,actions:t});case`server-stalled`:return(0,J.jsx)(et,{state:e,actions:t});case`server-exited`:return(0,J.jsx)(tt,{state:e,actions:t});case`server-stopped`:return(0,J.jsx)(nt,{state:e,actions:t});case`loading`:return(0,J.jsx)(it,{step:e.step,url:n});case`worktree-removed`:return(0,J.jsx)(at,{state:e,actions:t,worktree:r});case`proxy-blocked`:return(0,J.jsx)(ot,{actions:t});case`taken-over`:return(0,J.jsx)(ct,{state:e,actions:t})}}function X({icon:e,title:t,children:n,state:r}){return(0,J.jsxs)(`div`,{"data-slot":`preview-state`,"data-state":r,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center gap-4 px-6 py-8`,children:[(0,J.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-9 items-center justify-center rounded-lg bg-muted text-foreground [&_svg]:size-[18px]`,children:e}),(0,J.jsx)(`h2`,{className:`text-xl leading-tight font-semibold text-foreground`,children:t}),n]})}var Z=({children:e})=>(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e}),Q=({children:e})=>(0,J.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e});function Be({server:e}){return(0,J.jsxs)(`p`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(ne,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:`Runs ${M(e.command)} in this task's worktree, on the host.`})]})}function Ve({copy:e,command:t,label:n}){return(0,J.jsxs)(`div`,{"data-slot":`preview-install-command`,className:`min-w-0 rounded-lg bg-muted px-3.5 py-3`,children:[(0,J.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between gap-3 text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:[(0,J.jsx)(`span`,{children:n}),(0,J.jsx)(`button`,{type:`button`,"aria-label":`Copy command`,className:`-m-2 inline-flex size-11 items-center justify-center rounded-sm text-muted-foreground hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none md:m-0 md:size-6`,onClick:()=>e(t),children:(0,J.jsx)(j,{className:`size-4`,"aria-hidden":`true`})})]}),(0,J.jsx)(`code`,{className:`block font-mono text-sm break-words whitespace-pre-wrap text-foreground`,children:t})]})}function He({server:e,status:t}){return(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-border bg-card px-3.5 py-3 text-sm`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,J.jsx)(A,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.label}),(0,J.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,e.port]}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:t})]}),(0,J.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,J.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:e.command}),e.cwd?(0,J.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,J.jsx)(`span`,{children:`cwd`}),(0,J.jsx)(`span`,{className:`break-all`,children:e.cwd})]}):null]}),(0,J.jsx)(`div`,{className:`mt-2.5`,children:(0,J.jsx)(Be,{server:e})})]})}function Ue({state:e,actions:t}){return(0,J.jsxs)(X,{state:e.stage,icon:(0,J.jsx)(P,{}),title:`This host has no browser yet`,children:[(0,J.jsx)(Z,{children:e.canDownload?`Preview runs Chromium on the machine Squawk runs on. Squawk can download it into ~/.cache/cez/ (about 150 MB). Nothing else on the host changes.`:`Preview runs Chromium on the machine Squawk runs on. Squawk has no download for this platform, so install it with the system package manager.`}),e.canDownload?(0,J.jsx)(Q,{children:(0,J.jsxs)(w,{variant:`contrast`,onClick:t.download,children:[(0,J.jsx)(P,{"aria-hidden":`true`}),`Download Chromium`]})}):null,(0,J.jsx)(Ve,{command:e.installCommand,copy:t.copy,label:e.canDownload?`Or install it yourself`:`Install it yourself`})]})}function We(e){return Math.round(e/1e6)}function Ge({state:e,actions:t}){let n=(0,q.useRef)(null);n.current??={at:Date.now(),received:e.received};let r=e.total>0?Math.min(100,Math.floor(e.received/e.total*100)):0,i=(Date.now()-n.current.at)/1e3,a=i>=1?(e.received-n.current.received)/i:0,o=a>0?Math.ceil((e.total-e.received)/a):void 0;return(0,J.jsxs)(X,{state:e.stage,icon:(0,J.jsx)(P,{}),title:`Downloading Chromium`,children:[(0,J.jsx)(Z,{children:`Into ~/.cache/cez/, no root needed. Nothing else on the host changes.`}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsx)(`div`,{role:`progressbar`,"aria-label":`Chromium download`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r,className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,J.jsx)(`div`,{className:`h-full rounded-full bg-success`,style:{width:`${r}%`}})}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`font-mono`,children:`${We(e.received)} of ${We(e.total)} MB · ${r}%`}),o===void 0?null:(0,J.jsx)(`span`,{children:`about ${o} s left`})]})]}),(0,J.jsx)(Q,{children:(0,J.jsx)(w,{variant:`outline`,onClick:t.cancelDownload,children:`Cancel`})})]})}function Ke({state:e,actions:t}){return(0,J.jsxs)(X,{state:e.stage,icon:(0,J.jsx)(G,{className:`text-danger`}),title:`Couldn't download Chromium`,children:[(0,J.jsx)(Z,{children:`${e.error.replace(/\.$/,``)}. Install Chromium with the system package manager, then retry.`}),(0,J.jsx)(Ve,{command:e.installCommand,copy:t.copy,label:`Install it yourself`}),(0,J.jsxs)(Q,{children:[(0,J.jsxs)(w,{variant:`contrast`,onClick:t.download,children:[(0,J.jsx)(x,{"aria-hidden":`true`}),`Retry download`]}),(0,J.jsxs)(w,{variant:`outline`,onClick:()=>t.copy(`Chromium download failed\n${e.error}\nInstall: ${e.installCommand}`),children:[(0,J.jsx)(j,{"aria-hidden":`true`}),`Copy diagnostics`]})]})]})}function qe({state:e,actions:t}){return(0,J.jsxs)(X,{state:e.stage,icon:(0,J.jsx)(U,{className:`text-danger`}),title:`Chromium couldn't start its sandbox`,children:[(0,J.jsx)(Z,{children:`The host blocks the sandbox Chromium needs. This usually means Squawk runs as root, or inside a container without user namespaces.`}),(0,J.jsx)(Y,{text:e.stderrTail,source:`chromium`,onCopy:t.copy}),(0,J.jsxs)(Q,{children:[(0,J.jsxs)(w,{variant:`contrast`,onClick:t.retryBrowser,children:[(0,J.jsx)(x,{"aria-hidden":`true`}),`Retry`]}),(0,J.jsxs)(w,{variant:`outline`,onClick:()=>t.copy(`Chromium failed to start its sandbox\n${e.stderrTail}`),children:[(0,J.jsx)(j,{"aria-hidden":`true`}),`Copy diagnostics`]})]}),(0,J.jsx)(`a`,{className:`text-sm font-medium text-accent-text underline-offset-2 hover:underline`,href:Re,target:`_blank`,rel:`noopener noreferrer`,children:`Docs: running without the sandbox (CEZ_PREVIEW_NO_SANDBOX=1)`})]})}function Je({state:e,actions:t}){let n=e.reason===`timeout`,r=e.signal?` (${e.signal})`:e.exitCode===void 0?``:` (code ${e.exitCode})`,i=e.serverUp?`The dev server is still up; only the browser needs a restart.`:`The browser needs a restart.`,a=n?`Chromium did not start in time`:`Chromium exited${r}`;return(0,J.jsxs)(X,{state:e.stage,icon:(0,J.jsx)(m,{className:`text-danger`}),title:n?`The browser did not start`:`The browser stopped`,children:[(0,J.jsx)(Z,{children:n?`Chromium did not open its DevTools port in time. ${i}`:`Chromium exited unexpectedly${r}. ${i}`}),(0,J.jsx)(Y,{text:e.stderrTail,source:`chromium`,onCopy:t.copy}),(0,J.jsxs)(Q,{children:[(0,J.jsxs)(w,{variant:`contrast`,onClick:t.retryBrowser,children:[(0,J.jsx)(x,{"aria-hidden":`true`}),`Retry`]}),(0,J.jsxs)(w,{variant:`outline`,onClick:()=>t.copy(`${a}\n${e.stderrTail}`),children:[(0,J.jsx)(j,{"aria-hidden":`true`}),`Copy diagnostics`]})]})]})}var Ye=2;function Xe(e){let[t,n]=(0,q.useState)(()=>Date.now());return(0,q.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function Ze({state:e,actions:t}){let{server:n,wasRunning:r}=e;return(0,J.jsxs)(X,{state:e.stage,icon:r?(0,J.jsx)(K,{className:`text-pending-strong`}):(0,J.jsx)(b,{}),title:r?`Nothing answers on :${n.port} anymore`:`${n.label} isn't running yet`,children:[(0,J.jsx)(Z,{children:r?`${n.label} was running when the agent registered it, likely inside the agent's own session, which has ended. Squawk can start it with the registered command.`:`The agent registered this server. Nothing runs until you approve it here.`}),(0,J.jsx)(He,{server:n,status:r?`was running when registered · silent now`:`registered · not started`}),(0,J.jsx)(Q,{children:(0,J.jsxs)(w,{variant:`contrast`,onClick:()=>t.run(n.port),children:[(0,J.jsx)(b,{"aria-hidden":`true`}),`Run and open`]})})]})}function Qe({state:e,actions:t}){let{server:n,ownerTitle:r}=e;return(0,J.jsxs)(X,{state:e.stage,icon:(0,J.jsx)(G,{className:`text-pending-strong`}),title:`${n.label} :${n.port} is in use by another task`,children:[(0,J.jsx)(Z,{children:`Task "${r}" is running its own server on :${n.port}. Register a different port for this task, or stop that task's server.`}),(0,J.jsx)(Q,{children:(0,J.jsx)(w,{variant:`contrast`,onClick:t.close,children:`Close preview`})})]})}function $e({state:e,actions:t}){let{server:n}=e,r=Xe(1e3),i=Math.max(0,Math.floor((r-Date.parse(e.startedAt))/1e3)),[a,o]=(0,q.useState)(()=>Date.now());(0,q.useEffect)(()=>o(Date.now()),[e.attempt]);let s=Math.max(0,Math.ceil(Ye-(r-a)/1e3));return(0,J.jsxs)(X,{state:e.stage,icon:(0,J.jsx)(b,{}),title:`Starting ${n.label}`,children:[(0,J.jsx)(Z,{children:`Squawk ran ${M(n.command)} in the worktree. The page opens as soon as :${n.port} answers.`}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border px-3.5 py-3 text-sm`,children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-2.5 font-semibold text-foreground`,children:[(0,J.jsx)(v,{className:`size-4 animate-spin text-success motion-reduce:animate-none`,"aria-hidden":`true`}),s>0?`Attempt ${e.attempt} · next try in ${s} s`:`Attempt ${e.attempt}`]}),(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`started ${i} s ago`})]}),e.logTail.length>0?(0,J.jsx)(Y,{text:e.logTail.join(`
|
|
3
|
-
`),source:M(n.command),onCopy:t.copy}):null,(0,J.jsx)(Q,{children:(0,J.jsx)(w,{variant:`outline`,onClick:()=>t.stop(n.port),children:`Stop server`})})]})}function et({state:e,actions:t}){let{server:n}=e;return(0,J.jsxs)(X,{state:e.stage,icon:(0,J.jsx)(L,{className:`text-pending-strong`}),title:`${n.label} is running, but :${n.port} is silent`,children:[(0,J.jsx)(Z,{children:`The process has run for 2 min without opening the port. It may be waiting on another service, or listening somewhere else.`}),(0,J.jsx)(Y,{text:e.logTail,source:M(n.command),onCopy:t.copy}),(0,J.jsxs)(Q,{children:[(0,J.jsx)(w,{variant:`contrast`,onClick:()=>t.keepWaiting(n.port),children:`Keep waiting`}),(0,J.jsx)(w,{variant:`outline`,onClick:()=>t.stop(n.port),children:`Stop server`})]})]})}function tt({state:e,actions:t}){let{server:n}=e;return(0,J.jsxs)(X,{state:e.stage,icon:(0,J.jsx)(m,{className:`text-danger`}),title:e.exitCode===null?`${n.label} was stopped by a signal`:`${n.label} exited with code ${e.exitCode}`,children:[(0,J.jsx)(Z,{children:`${M(n.command)} stopped.`}),(0,J.jsx)(Y,{text:e.logTail,source:M(n.command),onCopy:t.copy}),(0,J.jsx)(Q,{children:(0,J.jsxs)(w,{variant:`contrast`,onClick:()=>t.run(n.port),children:[(0,J.jsx)(x,{"aria-hidden":`true`}),`Start again`]})}),(0,J.jsx)(Be,{server:n})]})}function nt({state:e,actions:t}){let{server:n}=e,r=e.reason===`idle`;return(0,J.jsxs)(X,{state:e.stage,icon:(0,J.jsx)(ee,{}),title:r?`Stopped after 15 min idle`:`${n.label} stopped`,children:[(0,J.jsx)(Z,{children:r?`Nobody had this pane open for 15 min, so Squawk stopped ${n.label} :${n.port} and the browser to free memory. Start again reopens ${Le(e.lastUrl)}.`:`You stopped ${n.label} :${n.port}. Start again reopens ${Le(e.lastUrl)}.`}),(0,J.jsx)(Q,{children:(0,J.jsxs)(w,{variant:`contrast`,onClick:()=>t.run(n.port),children:[(0,J.jsx)(x,{"aria-hidden":`true`}),`Start again`]})}),(0,J.jsx)(Be,{server:n})]})}var rt=[`browser`,`page`,`frame`];function it({step:e,url:t}){let n=rt.indexOf(e),i=t?Le(t):`the page`;return(0,J.jsx)(`div`,{"data-slot":`preview-state`,"data-state":`loading`,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center px-6 py-8`,children:(0,J.jsx)(`ol`,{"aria-label":`Opening the page`,className:`mx-auto flex flex-col gap-4 text-sm`,children:[{done:`Browser started`,active:`Starting the browser`},{done:`Opened ${i}`,active:`Opening ${i}`},{done:`First frame`,active:`First frame`}].map((e,t)=>{let i=t<n,a=t===n;return(0,J.jsxs)(`li`,{"aria-current":a?`step`:void 0,className:r(`flex items-center gap-3`,a?`font-semibold text-foreground`:i?`text-foreground`:`text-soft-foreground`),children:[i?(0,J.jsx)(p,{className:`size-5 text-success`,"aria-hidden":`true`}):a?(0,J.jsx)(v,{className:`size-5 animate-spin text-success motion-reduce:animate-none`,"aria-hidden":`true`}):(0,J.jsx)(we,{className:`size-5 text-border`,"aria-hidden":`true`}),i?e.done:a?e.active:e.done]},t)})})})}function at({state:e,actions:t,worktree:n}){let r=n?/\.ai\/(?:cezar|squawk)\/worktrees\/[^/]+/.exec(n)?.[0]:void 0,i=e.server?.label;return(0,J.jsxs)(X,{state:e.stage,icon:(0,J.jsx)(I,{}),title:`This task's worktree is gone`,children:[(0,J.jsx)(Z,{children:`${i??`The server`} ran in ${r??`this task's worktree`}, which has been removed. There is nothing left to start.`}),e.server?(0,J.jsx)(S,{entry:{kind:`preview-server`,id:`preview-server:${e.server.port}`,server:e.server,state:`unavailable`},inPreview:!1}):null,(0,J.jsx)(Q,{children:(0,J.jsx)(w,{variant:`outline`,onClick:t.close,children:`Close preview`})})]})}function ot({actions:e}){return(0,J.jsxs)(`div`,{"data-slot":`preview-state`,"data-state":`proxy-blocked`,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center gap-4 px-6 py-8`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(Ne,{})}),(0,J.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-9 items-center justify-center rounded-lg bg-muted text-foreground [&_svg]:size-[18px]`,children:(0,J.jsx)(B,{})}),(0,J.jsx)(`h2`,{className:`text-xl leading-tight font-semibold text-foreground`,children:`Preview doesn't work behind this proxy yet`}),(0,J.jsx)(Z,{children:`The proxy in front of Squawk didn't let the preview's WebSocket through. This is a known gap behind Basic Auth. Everything else in Squawk keeps working.`}),(0,J.jsxs)(Q,{children:[(0,J.jsx)(w,{variant:`outline`,onClick:e.close,children:`Close preview`}),(0,J.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-sm font-medium text-accent-text underline-offset-2 hover:underline`,href:Re,target:`_blank`,rel:`noopener noreferrer`,children:`Which setups work`})]})]})}function st(e){let t=/iPhone/.test(e)?`iPhone`:/iPad/.test(e)?`iPad`:/Android/.test(e)?`Android`:/Windows/.test(e)?`Windows`:/Mac OS X|Macintosh/.test(e)?`Mac`:/Linux|X11/.test(e)?`Linux`:``,n=/Edg\//.test(e)?`Edge`:/Firefox\/|FxiOS/.test(e)?`Firefox`:/Chrome\/|CriOS/.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:``;return n&&t?`${n} on ${t}`:n||t}function ct({state:e,actions:t}){let n=st(e.by);return(0,J.jsxs)(X,{state:e.stage,icon:(0,J.jsx)(z,{}),title:`Preview is open somewhere else`,children:[(0,J.jsx)(Z,{children:`Another tab took this browser${n?` (${n})`:``}. Only one tab can view and drive it at a time.`}),(0,J.jsxs)(Q,{children:[(0,J.jsxs)(w,{variant:`contrast`,onClick:t.useHere,children:[(0,J.jsx)(P,{"aria-hidden":`true`}),`Use it here`]}),(0,J.jsx)(w,{variant:`outline`,onClick:t.close,children:`Close preview`})]})]})}function lt({attempt:e,exhausted:t,onReconnect:n}){return(0,J.jsxs)(`div`,{"data-slot":`preview-connection-banner`,role:`status`,className:`absolute inset-x-3 top-3 z-10 flex flex-wrap items-center justify-between gap-x-3 gap-y-2 rounded-lg border border-border bg-card px-3.5 py-2.5 text-sm shadow-sm`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,J.jsx)(Oe,{className:`size-4 shrink-0 text-danger`,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`strong`,{className:`font-semibold text-foreground`,children:`Lost the connection to the host`}),t?null:(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:` · reconnecting (attempt ${e} of 5)`})]})]}),(0,J.jsx)(w,{variant:`outline`,onClick:n,children:t?`Reconnect`:`Reconnect now`})]})}function ut({servers:e,states:t,onOpen:n,agentLive:r=!1,agentIdle:i=!1,onOpenAgent:a}){return(0,J.jsxs)(`div`,{"data-slot":`preview-state`,"data-state":i?`agent-idle`:`empty`,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center gap-4 px-6 py-8`,children:[(0,J.jsx)(`h2`,{className:`text-xl leading-tight font-semibold text-foreground`,children:`Open a page in this task's browser`}),(0,J.jsx)(Z,{children:`The browser runs on the host, next to the worktree. Type a URL, a bare port such as 3000, or open a server the agent registered.`}),i?(0,J.jsxs)(`p`,{role:`status`,className:`flex items-start gap-2 text-sm text-foreground`,children:[(0,J.jsx)(K,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:`The agent is not driving the browser now.`})]}):null,r&&a!==void 0?(0,J.jsxs)(`section`,{"aria-labelledby":`preview-agent`,className:`overflow-hidden rounded-lg border border-border bg-card`,children:[(0,J.jsx)(`h3`,{id:`preview-agent`,className:`border-b border-border px-3.5 py-2.5 text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Driven by the agent`}),(0,J.jsxs)(`div`,{"data-slot":`preview-agent-entry`,className:`flex items-center justify-between gap-3 px-3.5 py-2 text-sm`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-0.5`,children:[(0,J.jsx)(A,{tone:`success`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`font-semibold text-foreground`,children:`Agent's page`}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`The agent drives this page through agent-browser.`})]}),(0,J.jsx)(w,{variant:`outline`,size:`sm`,className:`max-md:h-11`,"aria-label":`Open the agent's page`,onClick:a,children:`Open`})]})]}):null,e.length>0?(0,J.jsxs)(`section`,{"aria-labelledby":`preview-registered`,className:`overflow-hidden rounded-lg border border-border bg-card`,children:[(0,J.jsx)(`h3`,{id:`preview-registered`,className:`border-b border-border px-3.5 py-2.5 text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Registered in this task`}),(0,J.jsx)(`ul`,{children:e.map(e=>{let r=ye(e,t),i=ge(r);return(0,J.jsxs)(`li`,{className:`flex items-center justify-between gap-3 border-b border-border px-3.5 py-2 text-sm last:border-b-0`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-0.5`,children:[(0,J.jsx)(A,{tone:i.tone,shape:i.ring?`ring`:`filled`,pulse:i.pulse,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.label}),(0,J.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,e.port]}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:i.text})]}),(0,J.jsx)(w,{variant:`outline`,size:`sm`,className:`max-md:h-11`,onClick:()=>n(e.port),children:pe(r)?`Open`:`Review`})]},e.port)})})]}):null,(0,J.jsxs)(`p`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(_,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:`Review opens a server's approval in this pane: its command, cwd and Run and open. Nothing runs from this list. Paste works; copying text out, file pickers and downloads don't yet.`})]})]})}function dt({dialog:e,onResult:t}){let[n,r]=(0,q.useState)(e.defaultPrompt??``),i=e.type===`beforeunload`,a=(0,q.useRef)(null),o=(0,q.useRef)(null);(0,q.useEffect)(()=>{(e.type===`prompt`?o.current:a.current)?.focus()},[e.type]);let s=(0,q.useRef)(t);s.current=t,(0,q.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`||e.defaultPrevented)return;let t=e.target instanceof Element?e.target:null;t&&t!==document.body&&!t.closest(`[data-slot="preview-pane-body"], [data-slot="preview-page-dialog"]`)||(e.stopPropagation(),s.current({accept:!1}))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]);let c=()=>t(e.type===`prompt`?{accept:!0,text:n}:{accept:!0});return(0,J.jsx)(`div`,{"data-slot":`preview-page-dialog`,className:`absolute inset-0 z-20 flex items-center justify-center bg-foreground/30 p-4`,children:(0,J.jsxs)(`div`,{role:`alertdialog`,"aria-modal":`true`,"aria-label":`${e.origin} says`,className:`w-full max-w-[380px] rounded-xl border border-card-edge bg-card p-4 shadow-modal`,children:[(0,J.jsx)(`p`,{className:`mb-3 truncate font-mono text-xs text-muted-foreground`,children:`${e.origin} says`}),(0,J.jsx)(`p`,{className:`mb-4 text-sm break-words whitespace-pre-wrap text-foreground`,children:e.message||(i?`Changes you made may not be saved.`:``)}),e.type===`prompt`?(0,J.jsx)(`input`,{ref:o,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&c()},className:`mb-4 h-11 w-full rounded-md border border-border bg-background px-3 text-sm outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[e.type===`alert`?null:(0,J.jsx)(w,{variant:`outline`,onClick:()=>t({accept:!1}),children:i?`Stay`:`Cancel`}),(0,J.jsx)(w,{ref:a,variant:`contrast`,onClick:c,children:i?`Leave`:`OK`})]})]})})}var ft=10,pt=500,mt=500,ht=4,gt=16,_t=e=>!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0);function vt(e,t,n,r){return{x:Math.round((e-n.left)/r),y:Math.round((t-n.top)/r)}}function yt(e,t){return{rect:e,scale:t,touches:new Map,multiTouch:!1,click:{at:-1/0,x:0,y:0,button:-1,count:1}}}var bt=[`left`,`middle`,`right`];function $(e,t,n,r){let i=vt(n.clientX,n.clientY,t.rect,t.scale);return{t:`mouse`,type:e,x:i.x,y:i.y,button:bt[n.button]??`none`,buttons:n.buttons,clickCount:1,modifiers:_t(n),...r}}var xt=e=>e===0?0:-e;function St(e,t,n,r,i){let a=vt(t,n,e.rect,e.scale);return{t:`mouse`,type:`mouseWheel`,x:a.x,y:a.y,button:`none`,buttons:0,deltaX:xt(r/e.scale),deltaY:xt(i/e.scale),modifiers:0}}function Ct(e,t){let{touches:n}=t,r=n.get(e.pointerId),i=()=>{n.delete(e.pointerId),n.size===0&&(t.multiTouch=!1)};switch(e.type){case`pointerdown`:return n.set(e.pointerId,{startX:e.clientX,startY:e.clientY,startAt:e.timeStamp,lastX:e.clientX,lastY:e.clientY,scrolling:!1}),n.size>1&&(t.multiTouch=!0),[];case`pointermove`:{if(!r)return[];if(t.multiTouch)return r.lastX=e.clientX,r.lastY=e.clientY,[];if(!r.scrolling){if(Math.hypot(e.clientX-r.startX,e.clientY-r.startY)<=ft)return[];r.scrolling=!0}let n=e.clientX-r.lastX,i=e.clientY-r.lastY;return r.lastX=e.clientX,r.lastY=e.clientY,n===0&&i===0?[]:[St(t,e.clientX,e.clientY,n,i)]}case`pointerup`:{let n=r!==void 0&&!t.multiTouch&&!r.scrolling&&e.timeStamp-r.startAt<=pt;if(i(),!n||!r)return[];let a={...e,clientX:r.startX,clientY:r.startY};return[$(`mouseMoved`,t,a,{button:`none`,buttons:0}),$(`mousePressed`,t,a,{button:`left`,buttons:1}),$(`mouseReleased`,t,a,{button:`left`,buttons:0})]}case`pointercancel`:return i(),[]}}function wt(e,t){if(e.pointerType===`touch`)return Ct(e,t);switch(e.type){case`pointerdown`:{let n=t.click,r=n.button===e.button&&e.timeStamp-n.at<=mt&&Math.hypot(e.clientX-n.x,e.clientY-n.y)<=ht;return t.click={at:e.timeStamp,x:e.clientX,y:e.clientY,button:e.button,count:r?n.count+1:1},[$(`mousePressed`,t,e,{clickCount:t.click.count})]}case`pointermove`:return[$(`mouseMoved`,t,e,{button:e.buttons&1?`left`:`none`})];case`pointerup`:return[$(`mouseReleased`,t,e,{clickCount:t.click.count})];case`pointercancel`:return[]}}function Tt(e,t,n){let r=vt(e.clientX,e.clientY,t,n),i=e.deltaMode===1?gt:1;return{t:`mouse`,type:`mouseWheel`,x:r.x,y:r.y,button:`none`,buttons:e.buttons??0,deltaX:e.deltaX*i/n,deltaY:e.deltaY*i/n,modifiers:_t(e)}}var Et={a:`selectAll`,c:`copy`,x:`cut`,z:`undo`,y:`redo`};function Dt(e){let t=e.key.toLowerCase(),n=(e.ctrlKey||e.metaKey)&&!e.getModifierState?.(`AltGraph`);if(n&&(t===`v`||t===`k`))return;let r={t:`key`,key:e.key,code:e.code,modifiers:_t(e),vk:e.keyCode};if(e.type===`keyup`)return{...r,type:`keyUp`};let i=n?``:e.key.length===1?e.key:e.key===`Enter`?`\r`:e.key===`Tab`?` `:``,a=n?t===`z`&&e.shiftKey?`redo`:Et[t]:void 0,o={t:`key`,type:i?`keyDown`:`rawKeyDown`,key:e.key,code:e.code,text:i,modifiers:_t(e),vk:e.keyCode};return a?{...o,commands:[a]}:o}function Ot(e){return e?{t:`insertText`,text:e}:void 0}var kt=e=>e,At=e=>e.key===`Escape`&&e.shiftKey&&!e.ctrlKey&&!e.metaKey&&!e.altKey;function jt({scale:e,send:t,onLeave:n}){let r=(0,q.useRef)(null),i=(0,q.useRef)(yt({left:0,top:0},e)),a=(0,q.useRef)(e);a.current=e;let o=(0,q.useRef)(t);o.current=t;let s=(0,q.useRef)(void 0),c=()=>{let e=r.current;e&&(i.current.rect=e.getBoundingClientRect()),i.current.scale=a.current},l=e=>{c();for(let t of wt(kt(e),i.current))o.current(t)},u=()=>{let e=s.current;e&&(s.current=void 0,cancelAnimationFrame(e.frame),l(e.event))};(0,q.useEffect)(()=>()=>{s.current&&cancelAnimationFrame(s.current.frame)},[]),(0,q.useEffect)(()=>{document.activeElement===document.body&&r.current?.focus({preventScroll:!0})},[]),(0,q.useEffect)(()=>{let e=r.current;if(!e)return;let t=e=>{e.preventDefault(),c(),o.current(Tt(e,i.current.rect,i.current.scale))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]),(0,q.useEffect)(()=>{let e=e=>{if(document.activeElement!==r.current)return;let t=Ot(e.clipboardData?.getData(`text`)??``);t&&(e.preventDefault(),o.current(t))};return document.addEventListener(`paste`,e),()=>document.removeEventListener(`paste`,e)},[]);let d=e=>{u(),r.current?.focus({preventScroll:!0});try{r.current?.setPointerCapture(e.pointerId)}catch{}l(e.nativeEvent)},f=e=>{let t=e.nativeEvent;if(t.pointerType===`touch`)return l(t);let n=s.current;if(n){n.event=t;return}s.current={event:t,frame:requestAnimationFrame(()=>{let e=s.current;s.current=void 0,e&&l(e.event)})}},p=e=>{u(),l(e.nativeEvent)},m=e=>{if(At(e)){e.preventDefault(),e.stopPropagation(),e.type===`keydown`&&(n?n():r.current?.blur());return}let i=Dt(e.nativeEvent);i&&(e.preventDefault(),e.stopPropagation(),t(i))};return(0,J.jsx)(`div`,{ref:r,"data-slot":`preview-input`,role:`application`,"aria-label":`Page preview, interactive`,"aria-description":`Keys go to the page, Tab included. Press Shift+Escape to return to the cockpit.`,tabIndex:0,onPointerDown:d,onPointerMove:f,onPointerUp:p,onPointerCancel:p,onContextMenu:e=>e.preventDefault(),onKeyDown:m,onKeyUp:m,className:`absolute inset-0 touch-none select-none outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-inset`})}async function Mt(e){if(typeof createImageBitmap==`function`){let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,release:()=>t.close()}}let t=URL.createObjectURL(e),n=new Image;return n.src=t,await n.decode(),{source:n,width:n.naturalWidth,height:n.naturalHeight,release:()=>URL.revokeObjectURL(t)}}function Nt({ref:e,viewport:t,dimmed:n=!1,cursor:i,onSize:o,renderInput:s,children:c}){let l=(0,q.useRef)(0),u=(0,q.useRef)(null),d=(0,q.useRef)(null),[f,p]=(0,q.useState)(null),m=(0,q.useRef)(o);m.current=o,(0,q.useImperativeHandle)(e,()=>({async draw(e){let t=++l.current,n=d.current,r=n?.getContext(`2d`);if(!(!n||!r||!a()))try{let i=await Mt(e);try{if(t!==l.current||!a()||d.current!==n)return;n.width!==i.width&&(n.width=i.width),n.height!==i.height&&(n.height=i.height),r.drawImage(i.source,0,0)}finally{i.release()}}catch{}}}),[]),(0,q.useEffect)(()=>{let e=u.current;if(!e)return;let t=()=>{let t=Math.round(e.clientWidth),n=Math.round(e.clientHeight);t===0||n===0||(p(e=>e&&e.w===t&&e.h===n?e:{w:t,h:n}),m.current?.({w:t,h:n}))};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let h=t===`fit`?f:t,g=t===`fit`||!f?1:Math.min(1,(f.w-24)/t.w,(f.h-24)/t.h),_=h?{width:Math.floor(h.w*g),height:Math.floor(h.h*g)}:void 0;return(0,J.jsxs)(`div`,{ref:u,"data-slot":`preview-stage`,"data-viewport":t===`fit`?`fit`:`${t.w}x${t.h}`,className:r(`relative min-h-0 flex-1 overflow-hidden bg-muted`,t!==`fit`&&`flex items-start justify-center overflow-auto p-3`),children:[h?(0,J.jsxs)(`div`,{"data-slot":`preview-surface`,"data-scale":g,style:{..._,cursor:i},className:r(`relative shrink-0 bg-card`,t!==`fit`&&`shadow-md`,n&&`opacity-60 saturate-50`),children:[(0,J.jsx)(`canvas`,{ref:d,"aria-label":`Page preview`,role:`img`,style:_,className:`block touch-none select-none`}),s?.({canvas:d.current,scale:g,viewport:h})]}):null,c]})}var Pt=`cez-preview-quality`,Ft=[{value:`normal`,label:`Normal`,detail:`The default. Lighter on CPU and network.`},{value:`high`,label:`High`,detail:`Sharper text and fine detail. Uses more CPU and network.`},{value:`ultra`,label:`Ultra`,detail:`High at your screen's pixel density, up to 2×. Uses the most CPU and network.`}];function It(e){return Ft.find(t=>t.value===e)?.value??`normal`}var Lt=e=>Ft.find(t=>t.value===e)?.label??`Normal`;function Rt(){try{return It(localStorage.getItem(Pt))}catch{return`normal`}}function zt(e){try{localStorage.setItem(Pt,e)}catch{}}var Bt=[{w:390,h:844,icon:g},{w:820,h:1180,icon:W},{w:1440,h:900,icon:y}],Vt=`size-8 shrink-0 max-md:size-11`,Ht=e=>e===`fit`?`Fit`:`${e.w} × ${e.h}`;function Ut(e){let[t,n]=(0,q.useState)(()=>Date.now());return(0,q.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var Wt=e=>`${e.fps} fps · ${e.kbps} KB/s${e.rttMs===void 0?``:` · ${e.rttMs} ms`}`;function Gt({stats:e,shrunk:t}){let n=Ut(250),r=e.lastFrameAt===void 0||n-e.lastFrameAt>=1e3;return t?(0,J.jsx)(A,{"data-slot":`preview-stats`,tone:r?`neutral`:`success`,"aria-label":`Preview is live`,role:`img`}):(0,J.jsxs)(`span`,{"data-slot":`preview-stats`,role:`img`,"aria-label":r?`idle`:Wt(e),className:`flex shrink-0 items-center gap-1.5 font-mono text-xs whitespace-nowrap text-muted-foreground`,children:[(0,J.jsx)(A,{tone:r?`neutral`:`success`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`hidden @min-[640px]:inline-block w-[28ch] overflow-hidden text-ellipsis`,children:r?`idle`:Wt(e)})]})}function Kt({current:e,agentShown:t,...n}){let r=e?e.label:t?`Agent's page`:`Server`;return(0,J.jsxs)(w,{variant:`outline`,size:`sm`,className:`max-w-[11rem] min-w-0 gap-1.5 max-md:h-11`,"aria-label":e?`Server: ${e.label} :${e.port}`:t?`Server: ${r}`:`Server`,...n,children:[e||t?(0,J.jsx)(A,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}):(0,J.jsx)(C,{"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`truncate`,children:r}),e?(0,J.jsxs)(`span`,{className:`font-mono font-normal text-muted-foreground`,children:[`:`,e.port]}):null,(0,J.jsx)(f,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]})}function qt({shown:e,live:t,onSelect:n}){return(0,J.jsxs)(E,{className:`min-h-11 gap-2.5 md:min-h-0`,"aria-current":e||void 0,onSelect:n,children:[(0,J.jsx)(A,{tone:t?`success`:`neutral`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`font-semibold`,children:`Agent's page`}),(0,J.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`agent-browser`}),e?(0,J.jsx)(d,{className:`size-4`,"aria-hidden":`true`}):null]})}function Jt(e,t){return e?`${e.label} :${e.port}`:t?`Agent's page`:`Preview`}function Yt(e){let t=e.onPickAgent!==void 0,n=e.agentLive===!0&&t,r=e.agentShown===!0;return{agentLive:n,agentShown:r,agentListed:n||r&&t}}function Xt(e){let{compact:t=!1,navEnabled:n,loading:r=!1}=e,i=(0,q.useRef)(null),a=e.urlInputRef??i,o=(0,q.useRef)(!1),[s,c]=(0,q.useState)(null),[l,d]=(0,q.useState)(!1),f=(0,J.jsx)(w,{variant:`ghost`,size:`icon-sm`,className:Vt,"aria-label":`Back`,disabled:!n,onClick:e.onBack,children:(0,J.jsx)(Ce,{"aria-hidden":`true`})}),p=(0,J.jsx)(w,{variant:`ghost`,size:`icon-sm`,className:Vt,"aria-label":`Forward`,disabled:!n,onClick:e.onForward,children:(0,J.jsx)(u,{"aria-hidden":`true`})}),m=(0,J.jsx)(w,{variant:`ghost`,size:`icon-sm`,className:Vt,"aria-label":`Reload`,"aria-busy":r||void 0,disabled:!n||r,onClick:()=>e.onReload(!1),children:(0,J.jsx)(H,{"aria-hidden":`true`})}),h=e.onSession?(0,J.jsxs)(w,{variant:`outline`,size:`sm`,className:`shrink-0 gap-1 max-md:h-11`,onClick:e.onSession,children:[(0,J.jsx)(be,{"aria-hidden":`true`}),`Session`]}):null,g=r?(0,J.jsx)(`div`,{role:`progressbar`,"aria-label":`Loading the page`,className:`absolute inset-x-0 bottom-0 h-0.5 overflow-hidden bg-transparent`,children:(0,J.jsx)(`div`,{className:`preview-progress h-full w-2/5 bg-success`})}):null,_=(0,J.jsx)(Qt,{props:e,input:a,draft:s,setDraft:c,focused:l,setFocused:d}),{agentListed:v}=Yt(e),y=e.servers.length+ +!!v>=2,ee=y||e.adopted,b={back:f,forward:p,reload:m,address:_,more:(0,J.jsx)(rn,{props:e,compact:t,crowded:ee}),session:h,progress:g};return t?(0,J.jsx)(an,{props:e,elements:b}):(0,J.jsx)(on,{props:e,elements:b,switcher:y,crowded:ee,input:a,focusUrlAfterMenu:o})}function Zt({props:e,input:t,focusUrlAfterMenu:n}){let{servers:r,current:i}=e,{agentLive:a,agentShown:o,agentListed:s}=Yt(e);return(0,J.jsxs)(ae,{children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsx)(Kt,{current:i,agentShown:o})}),(0,J.jsxs)(k,{align:`start`,className:`min-w-64`,onCloseAutoFocus:e=>{n.current&&(n.current=!1,e.preventDefault(),t.current?.focus())},children:[s?(0,J.jsx)(qt,{shown:o,live:a,onSelect:()=>e.onPickAgent?.()}):null,r.map(t=>{let n=ge(ye(t,e.serverStates));return(0,J.jsxs)(E,{className:`min-h-11 gap-2.5 md:min-h-0`,"aria-current":i?.port===t.port||void 0,onSelect:()=>e.onPickServer(t.port),children:[(0,J.jsx)(A,{tone:n.tone,shape:n.ring?`ring`:`filled`,pulse:n.pulse,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`font-semibold`,children:t.label}),(0,J.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,t.port]}),(0,J.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:n.text}),i?.port===t.port?(0,J.jsx)(d,{className:`size-4`,"aria-hidden":`true`}):null]},t.port)}),(0,J.jsx)(D,{}),(0,J.jsxs)(E,{className:`min-h-11 gap-2.5 md:min-h-0`,onSelect:()=>{n.current=!0},children:[(0,J.jsx)(h,{"aria-hidden":`true`}),`Type a URL instead`]})]})]})}function Qt({props:e,input:t,draft:n,setDraft:i,focused:a,setFocused:o}){let{url:s,adopted:c}=e;return(0,J.jsxs)(`div`,{className:`relative flex min-w-[9rem] flex-1 items-center`,children:[(0,J.jsx)(h,{className:`pointer-events-none absolute left-2.5 size-4 text-muted-foreground`,"aria-hidden":`true`}),(0,J.jsx)(`input`,{ref:t,type:`text`,"aria-label":`Page address`,placeholder:`Type a URL or a port`,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,value:n??(a?s:Le(s)),title:s||void 0,className:r(`h-8 w-full min-w-0 truncate rounded-md border border-transparent bg-muted pl-8 font-mono text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:bg-background focus-visible:ring-[3px] focus-visible:ring-ring/30 max-md:h-11`,c?`pr-40`:`pr-2.5`),onFocus:e=>{let t=e.currentTarget;o(!0),requestAnimationFrame(()=>{document.activeElement===t&&t.select()})},onBlur:()=>{o(!1),i(null)},onChange:e=>i(e.target.value),onKeyDown:t=>{t.key===`Enter`?(e.onNavigate(n??s),t.currentTarget.blur()):t.key===`Escape`&&t.currentTarget.blur()}}),c&&!a?(0,J.jsxs)(`span`,{className:`pointer-events-none absolute right-2 inline-flex h-6 items-center gap-1 rounded-full border border-border bg-card px-2 text-xs font-semibold text-muted-foreground`,children:[(0,J.jsx)(R,{className:`size-3`,"aria-hidden":`true`}),`Not started by Squawk`]}):null]})}function $t({props:e}){let{viewport:t}=e;return(0,J.jsxs)(ae,{children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsxs)(w,{variant:`outline`,size:`sm`,className:`shrink-0 gap-1.5`,"aria-label":`Viewport size: ${Ht(t)}`,children:[t===`fit`?(0,J.jsx)(De,{"aria-hidden":`true`}):(0,J.jsx)(y,{"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:r(`hidden @min-[500px]:inline`,t!==`fit`&&`font-mono font-normal`),children:Ht(t)}),(0,J.jsx)(f,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]})}),(0,J.jsxs)(k,{align:`start`,className:`min-w-56`,children:[(0,J.jsxs)(E,{className:`gap-2.5`,"aria-current":t===`fit`||void 0,onSelect:()=>e.onViewport(`fit`),children:[(0,J.jsx)(De,{"aria-hidden":`true`}),`Fit`,(0,J.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`pane size`}),t===`fit`?(0,J.jsx)(d,{className:`size-4`,"aria-hidden":`true`}):null]}),Bt.map(({w:n,h:r,icon:i})=>(0,J.jsxs)(E,{className:`gap-2.5 font-mono`,"aria-current":t!==`fit`&&t.w===n&&t.h===r||void 0,onSelect:()=>e.onViewport({w:n,h:r}),children:[(0,J.jsx)(i,{"aria-hidden":`true`}),n,` × `,r,t!==`fit`&&t.w===n&&t.h===r?(0,J.jsx)(d,{className:`ml-auto size-4`,"aria-hidden":`true`}):null]},`${n}x${r}`))]})]})}function en({quality:e,onQuality:t,compact:n}){return(0,J.jsx)(ie,{value:e,onValueChange:e=>t(It(e)),children:Ft.map(e=>(0,J.jsx)(re,{value:e.value,"data-quality":e.value,className:r(`items-start`,n&&`min-h-11`),children:(0,J.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{children:e.label}),(0,J.jsx)(`span`,{className:`text-xs whitespace-normal text-muted-foreground`,children:e.detail})]})},e.value))})}function tn({props:e}){let{quality:t}=e;return(0,J.jsxs)(ae,{children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsxs)(w,{variant:`outline`,size:`sm`,className:`shrink-0 gap-1.5`,"aria-label":`Stream quality: ${Lt(t)}`,children:[(0,J.jsx)(Te,{"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`hidden @min-[560px]:inline`,children:Lt(t)}),(0,J.jsx)(f,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]})}),(0,J.jsxs)(k,{align:`start`,className:`w-64`,children:[(0,J.jsx)(T,{className:`text-xs font-normal text-muted-foreground`,children:`Stream quality`}),(0,J.jsx)(en,{quality:t,onQuality:e.onQuality,compact:!1})]})]})}function nn({stats:e,status:t,crowded:n}){return e?(0,J.jsx)(Gt,{stats:e,shrunk:n}):t?(0,J.jsxs)(`span`,{"data-slot":`preview-status`,className:`flex shrink-0 items-center gap-1.5 font-mono text-xs whitespace-nowrap text-muted-foreground`,children:[(0,J.jsx)(A,{tone:t.tone,"aria-hidden":`true`}),t.label]}):null}function rn({props:e,compact:t,crowded:n}){let{stats:r,navEnabled:i,url:a,current:o,adopted:s}=e;return(0,J.jsxs)(ae,{children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsx)(w,{variant:`ghost`,size:`icon-sm`,className:Vt,"aria-label":`More`,children:(0,J.jsx)(_e,{"aria-hidden":`true`})})}),(0,J.jsxs)(k,{align:`end`,className:`min-w-64`,children:[n&&r&&!t?(0,J.jsx)(T,{className:`font-mono text-xs font-normal text-muted-foreground`,children:Wt(r)}):null,(0,J.jsxs)(E,{className:`min-h-11 gap-2.5 md:min-h-0`,disabled:!i,onSelect:()=>e.onReload(!0),children:[(0,J.jsx)(V,{"aria-hidden":`true`}),`Reload without cache`]}),(0,J.jsxs)(E,{className:`min-h-11 gap-2.5 md:min-h-0`,disabled:a===``,onSelect:e.onCopyUrl,children:[(0,J.jsx)(ve,{"aria-hidden":`true`}),`Copy page URL`]}),o?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(D,{}),s?(0,J.jsxs)(E,{disabled:!0,className:`items-start gap-2.5 opacity-100 data-[disabled]:opacity-100`,children:[(0,J.jsx)(Ee,{className:`mt-0.5 text-muted-foreground`,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`Stop server · ${o.label} :${o.port}`}),(0,J.jsx)(`span`,{className:`text-xs whitespace-normal text-muted-foreground`,children:`Squawk didn't start this server, so it won't stop it. Stop it where it was started.`})]})]}):(0,J.jsxs)(E,{variant:`destructive`,className:`min-h-11 gap-2.5 md:min-h-0`,onSelect:()=>e.onStop(o.port),children:[(0,J.jsx)(N,{"aria-hidden":`true`}),`Stop server · ${o.label} :${o.port}`]})]}):null,t?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(D,{}),(0,J.jsx)(T,{className:`text-xs font-normal text-muted-foreground`,children:`Stream quality`}),(0,J.jsx)(en,{quality:e.quality,onQuality:e.onQuality,compact:!0}),(0,J.jsx)(D,{}),(0,J.jsxs)(E,{className:`min-h-11 gap-2.5`,onSelect:e.onClose,children:[(0,J.jsx)(le,{"aria-hidden":`true`}),`Close preview`]})]}):null]})]})}function an({props:e,elements:t}){let{stats:n,current:r,badge:i=!0}=e,{agentShown:a}=Yt(e),{back:o,forward:s,reload:c,address:l,more:u,session:d,progress:f}=t;return(0,J.jsxs)(`div`,{"data-slot":`preview-toolbar`,"data-compact":``,className:`relative flex shrink-0 flex-col border-b border-border bg-background`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 px-2 pt-[max(0.25rem,env(safe-area-inset-top))]`,children:[d,(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-center leading-tight`,children:[(0,J.jsxs)(`span`,{className:`flex max-w-full items-center gap-1.5 text-sm font-semibold text-foreground`,children:[n?(0,J.jsx)(A,{tone:`success`,"aria-hidden":`true`}):null,(0,J.jsx)(`span`,{className:`truncate`,children:Jt(r,a)})]}),i?(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Experimental`}):null]}),u]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1`,children:[o,s,c,l]}),f]})}function on({props:e,elements:t,switcher:n,crowded:r,input:i,focusUrlAfterMenu:a}){let{badge:o=!0,stats:s,status:c}=e,{back:l,forward:u,reload:d,address:f,more:p,session:m,progress:h}=t;return(0,J.jsxs)(`div`,{"data-slot":`preview-toolbar`,className:`@container relative flex shrink-0 items-center gap-1.5 border-b border-border bg-background px-2.5 py-2`,children:[m,l,u,d,n?(0,J.jsx)(Zt,{props:e,input:i,focusUrlAfterMenu:a}):null,f,(0,J.jsx)($t,{props:e}),(0,J.jsx)(tn,{props:e}),(0,J.jsx)(nn,{stats:s,status:c,crowded:r}),o?(0,J.jsx)(Ne,{iconOnly:r,responsive:!r}):null,(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`mx-0.5 h-5 w-px shrink-0 bg-border`}),p,(0,J.jsx)(w,{variant:`ghost`,size:`icon-sm`,className:Vt,"aria-label":`Close preview`,onClick:e.onClose,children:(0,J.jsx)(le,{"aria-hidden":`true`})}),h]})}function sn({transport:e,takenOver:t,empty:n,stage:r,hasFrame:i,lost:a,url:o,worktree:s}){let c=a||e!==`blocked`&&t!==void 0;return e===`blocked`?{content:{kind:`state`,state:{stage:`proxy-blocked`}},dim:c}:t===void 0?n||r?.stage===`agent-idle`?{content:{kind:`empty`,agentIdle:!n&&r?.stage===`agent-idle`},dim:c}:r?.stage===`streaming`||r?.stage===`loading`&&i?{content:{kind:`none`},dim:c}:r?{content:{kind:`state`,state:r,url:o,worktree:s},dim:c}:a?{content:{kind:`none`},dim:c}:{content:{kind:`state`,state:{t:`state`,stage:`loading`,step:`browser`},url:o},dim:c}:{content:{kind:`state`,state:{stage:`taken-over`,by:t}},dim:c}}function cn(e,{servers:t,serverStates:n,agentLive:r,openServer:i,openAgent:a,actions:o}){switch(e.kind){case`none`:return null;case`state`:{let{kind:t,...n}=e;return(0,J.jsx)(ze,{...n,actions:o})}case`empty`:return(0,J.jsx)(ut,{servers:t,states:n,onOpen:e=>i(e),agentLive:r===!0,agentIdle:e.agentIdle,onOpenAgent:a})}}function ln(){let e=typeof window>`u`?void 0:window.devicePixelRatio;return typeof e==`number`&&e>0?e:1}function un(){let[e,t]=(0,q.useState)(ln);return(0,q.useEffect)(()=>{let n=window.matchMedia?.(`(resolution: ${e}dppx)`);if(!n)return;let r=()=>t(ln());return n.addEventListener(`change`,r),()=>n.removeEventListener(`change`,r)},[e]),e}var dn=2e3,fn=500,pn=1e3;function mn(e,t){switch(e.stage){case`needs-approval`:case`port-held`:case`server-starting`:case`server-stalled`:case`server-exited`:case`server-stopped`:return e.server.port===t;case`loading`:case`streaming`:return!0;default:return!1}}function hn(e){navigator.clipboard?.writeText(e).then(()=>c(`Copied`),()=>c(`Couldn't copy to the clipboard`,{tone:`danger`}))}var gn=e=>`http://localhost:${e.port}${e.path&&e.path!==`/`?e.path:``}`;function _n(e,t){return e?.port===void 0?e?.agent===!0||e?.url!==void 0:e.restored!==!0||t.some(t=>t.port===e.port)}function vn(e){return`port`in e?{port:e.port}:`agent`in e?{agent:!0}:{url:e.url}}function yn({run:e,servers:t,request:n,onTarget:r,onLive:i,onClose:s}){let l=un(),u=(0,q.useRef)(l);u.current=l;let d=o(),f=(0,q.useRef)(crypto.randomUUID()),p=(0,q.useRef)(!1),m=oe(),h=de(me,!1),[g,_]=(0,q.useState)(0),[v,y]=(0,q.useState)({state:`connecting`,attempt:0}),[ee,b]=(0,q.useState)(!1),[x,te]=(0,q.useState)(void 0),[S,C]=(0,q.useState)(void 0),[ne,w]=(0,q.useState)(``),[T,re]=(0,q.useState)(void 0),[E,D]=(0,q.useState)(!1),[O,k]=(0,q.useState)(void 0),[ie,ae]=(0,q.useState)(!1),[A,se]=(0,q.useState)(!1),[ce,le]=(0,q.useState)(void 0),[ue,fe]=(0,q.useState)(void 0),[j,pe]=(0,q.useState)(void 0),[M,he]=(0,q.useState)(`fit`),[ge,_e]=(0,q.useState)(Rt),[ve,ye]=(0,q.useState)(null),[be,xe]=(0,q.useState)(void 0),[Se,Ce]=(0,q.useState)(0),N=(0,q.useRef)(void 0),we=(0,q.useRef)(null),P=(0,q.useRef)(null),F=(0,q.useRef)(void 0),I=(0,q.useRef)(void 0),Te=(0,q.useRef)(ge);Te.current=ge;let L=(0,q.useRef)({port:T,stage:S,agent:E});L.current={port:T,stage:S,agent:E};let R=(0,q.useRef)([]),Ee=(0,q.useRef)(void 0),De=(0,q.useRef)(!1),z=(0,q.useRef)(!1),B=(0,q.useCallback)(e=>{z.current&&N.current?.send(e)},[]),V=(0,q.useRef)([]),H=(0,q.useCallback)(e=>{z.current?N.current?.send(e):V.current.push(e)},[]);(0,q.useEffect)(()=>{let t;return t=Me({projectId:m??`default`,runId:e.id},{onFrame(e){if(!a())return;let n=Date.now();R.current.push({at:n,bytes:e.size}),De.current||(De.current=!0,se(!0)),(we.current?.draw(e)??Promise.resolve()).finally(()=>t?.send({t:`ack`}))},onMessage(e){switch(e.t){case`state`:if(C(e),(e.stage===`streaming`||e.stage===`loading`)&&Ce(e=>e+1),I.current!==void 0&&mn(e,I.current)){let n=I.current;I.current=void 0,(e.stage===`needs-approval`||e.stage===`server-exited`||e.stage===`server-stopped`)&&t?.send({t:`run`,port:n})}return;case`url`:return w(e.url);case`cursor`:return le(e.cursor);case`dialog`:return fe(e);case`pong`:Ee.current=Math.max(0,Date.now()-e.ts);return;case`downloadProgress`:C(t=>t?.stage===`downloading`?{...t,received:e.received,total:e.total}:t);return;case`replaced`:te(e.by),z.current=!1,V.current=[],t?.close();return}},onTransport(e,n){if(z.current=e===`open`,y({state:e,attempt:n??0}),(e===`blocked`||e===`closed`)&&(V.current=[]),e===`open`){b(!0),F.current&&(t?.send({t:`open`,target:F.current,viewerId:f.current,resume:p.current,quality:Te.current,dpr:u.current}),p.current=!0);for(let e of V.current.splice(0))t?.send(e)}}}),N.current=t,()=>{z.current=!1,V.current=[],t?.close(),N.current===t&&(N.current=void 0)}},[m,e.id,g]);let U=d&&v.state===`open`&&x===void 0,W=h||M===`fit`?ve:M;(0,q.useEffect)(()=>{W&&U&&(S?.stage===`streaming`||S?.stage===`loading`)&&B({t:`resize`,w:W.w,h:W.h,...l===1?{}:{dpr:l}})},[W?.w,W?.h,l,U,S?.stage,Se,B]),(0,q.useEffect)(()=>{if(!U)return;let e=setInterval(()=>B({t:`ping`,ts:Date.now()}),dn);return()=>clearInterval(e)},[U,B]);let G=U&&S?.stage===`streaming`;(0,q.useEffect)(()=>{if(!G){pe(void 0);return}let e=setInterval(()=>{let e=Date.now();R.current=R.current.filter(t=>e-t.at<=pn);let t={fps:R.current.length,kbps:Math.round(R.current.reduce((e,t)=>e+t.bytes,0)/1024),...Ee.current===void 0?{}:{rttMs:Ee.current},...R.current.length>0?{lastFrameAt:R.current.at(-1).at}:{}};pe(e=>{let n=t.lastFrameAt??e?.lastFrameAt,r={...t,...n===void 0?{}:{lastFrameAt:n}};return e&&e.fps===r.fps&&e.kbps===r.kbps&&e.rttMs===r.rttMs&&e.lastFrameAt===r.lastFrameAt?e:r})},fn);return()=>clearInterval(e)},[G]),(0,q.useEffect)(()=>(i?.(G),()=>i?.(!1)),[G,i]),(0,q.useEffect)(()=>{O&&r?.(O)},[O,r]);let K=(0,q.useCallback)((e,t,n=!1)=>{F.current=e,I.current=n&&`port`in e?e.port:void 0,ae(!0),C(void 0),te(void 0),xe(void 0),w(t),re(`port`in e?e.port:void 0),D(`agent`in e),k(vn(e)),B({t:`open`,target:e,viewerId:f.current,quality:Te.current,dpr:u.current}),p.current=z.current},[B]),Oe=(0,q.useCallback)((e,n=!1)=>{let r=t.find(t=>t.port===e);K({port:e},r?gn(r):`http://localhost:${e}`,n)},[t,K]),ke=(0,q.useCallback)(()=>K({agent:!0},``),[K]);(0,q.useEffect)(()=>{if(n?.agent){if(L.current.agent&&L.current.stage?.stage===`streaming`)return;ke();return}if(n?.url!==void 0){let e=Fe(n.url,t);e.kind===`server`?Oe(e.port):e.kind===`url`&&K({url:e.url},e.url);return}n?.port!==void 0&&(n.restored&&!t.some(e=>e.port===n.port)||L.current.port===n.port&&L.current.stage?.stage===`streaming`&&n.run!==!0||Oe(n.port,n.run===!0))},[n]);let Ae=!ie&&!x&&v.state!==`blocked`,je=_n(n,t);(0,q.useEffect)(()=>{Ae&&!je&&P.current?.focus()},[Ae,je]);let J=e=>{let n=Fe(e,t);if(n.kind===`error`)return xe(n.message);if(n.kind===`server`)return Oe(n.port);if(L.current.stage?.stage===`streaming`&&!L.current.agent)return F.current={url:n.url},I.current=void 0,re(void 0),k({url:n.url}),xe(void 0),w(n.url),B({t:`nav`,url:n.url});K({url:n.url},n.url)},Ne=(0,q.useCallback)(e=>{Te.current=e,_e(e),zt(e),B({t:`quality`,quality:e})},[B]),Y=()=>{p.current=!1,te(void 0),y({state:`connecting`,attempt:0}),De.current=!1,_(e=>e+1)};return{compact:h,transport:v,everOpened:ee,takenOver:x,stage:S,url:ne,port:T,agent:E,hasFrame:A,cursor:ce,dialog:ue,setDialog:fe,stats:j,viewport:M,setViewport:he,quality:ge,chooseQuality:Ne,setStageSize:ye,addressError:be,stageHandle:we,urlInput:P,send:B,connected:U,streaming:G,openServer:Oe,openAgent:ke,empty:Ae,navigate:J,reconnect:Y,actions:(0,q.useMemo)(()=>({download:()=>H({t:`download`}),cancelDownload:()=>H({t:`cancelDownload`}),retryBrowser:()=>H({t:`retryBrowser`}),run:e=>{z.current?B({t:`run`,port:e}):c(`The preview is reconnecting. Run the server again once it is back.`,{tone:`danger`})},stop:e=>H({t:`stop`,port:e}),keepWaiting:e=>H({t:`keepWaiting`,port:e}),close:s,useHere:Y,copy:hn}),[B,H,s])}}function bn(e){return(0,J.jsx)(xe,{onClose:e.onClose,children:(0,J.jsx)(Cn,{...e})})}function xn(e,t,n,r){return e.state===`blocked`?{tone:`neutral`,label:`not supported`}:n?{tone:`neutral`,label:`paused`}:t&&(e.state===`reconnecting`||e.state===`closed`)?{tone:`danger`,label:`offline`}:e.state===`open`?r?Sn(r):void 0:{tone:`neutral`,label:`connecting…`}}function Sn(e){switch(e.stage){case`downloading`:return{tone:`pending`,label:`downloading`};case`download-failed`:return{tone:`danger`,label:`download failed`};case`sandbox-failed`:return{tone:`danger`,label:`browser failed`};case`browser-exited`:return{tone:`danger`,label:e.reason===`timeout`?`browser timed out`:`browser exited`};case`needs-approval`:return{tone:`neutral`,label:`not started`};case`port-held`:return{tone:`danger`,label:`port in use`};case`server-starting`:return{tone:`pending`,label:`waiting for :${e.server.port}`};case`server-stalled`:return{tone:`pending`,label:`waiting · 2 min`};case`server-exited`:return{tone:`danger`,label:`server exited`};case`server-stopped`:return{tone:`neutral`,label:`stopped`};case`agent-idle`:return{tone:`neutral`,label:`agent idle`};case`loading`:return{tone:`neutral`,label:`connecting…`};default:return}}function Cn(e){let{run:t,servers:n,serverStates:r,agentLive:i,onSession:a,onClose:o}=e,s=yn(e),{compact:c,transport:l,everOpened:u,takenOver:d,stage:f,url:p,port:m,agent:h,hasFrame:g,stats:_,viewport:v,setViewport:y,quality:ee,chooseQuality:b,addressError:x,urlInput:te,send:S,streaming:C,openServer:ne,openAgent:w,empty:T,navigate:re,actions:E}=s,D=n.find(e=>e.port===m),O=f?.stage===`streaming`&&f.adopted,k=u&&(l.state===`reconnecting`||l.state===`closed`),{content:ie,dim:ae}=sn({transport:l.state,takenOver:d,empty:T,stage:f,hasFrame:g,lost:k,url:p,worktree:t.worktreePath}),oe=cn(ie,{servers:n,serverStates:r,agentLive:i,openServer:ne,openAgent:w,actions:E});return(0,J.jsxs)(`section`,{"data-slot":`preview-pane-body`,"aria-label":`Live preview`,className:`flex h-full min-h-0 flex-col bg-background text-foreground`,children:[(0,J.jsx)(Xt,{url:p,servers:n,serverStates:r,badge:l.state!==`blocked`,current:D,agentLive:i===!0,agentShown:h,adopted:O,viewport:c?`fit`:v,quality:ee,compact:c,navEnabled:C,loading:f?.stage===`loading`,stats:C?_??{fps:0,kbps:0}:void 0,status:C?void 0:xn(l,u,d!==void 0,f),urlInputRef:te,onSession:a,onNavigate:re,onBack:()=>S({t:`back`}),onForward:()=>S({t:`forward`}),onReload:e=>S({t:`reload`,...e?{ignoreCache:!0}:{}}),onPickServer:e=>ne(e),onPickAgent:w,onViewport:y,onQuality:b,onCopyUrl:()=>hn(p),onStop:E.stop,onClose:o}),x?(0,J.jsx)(`p`,{role:`alert`,className:`border-b border-border bg-card px-3 py-1.5 text-xs text-danger`,children:x}):null,(0,J.jsx)(wn,{transportState:s,overlay:oe,dim:ae,lost:k})]})}function wn({transportState:e,overlay:t,dim:n,lost:r}){let{connected:i,dialog:a,hasFrame:o,stage:s,stageHandle:c,compact:l,viewport:u,cursor:d,setStageSize:f,send:p,urlInput:m,transport:h,reconnect:g,setDialog:_}=e,v=s?.stage,y=i&&t===null&&!a;return(0,J.jsxs)(Nt,{ref:c,viewport:l?`fit`:u,dimmed:n&&o&&(v===`streaming`||v===`loading`||n),cursor:d,onSize:f,renderInput:e=>y?(0,J.jsx)(jt,{scale:e.scale,send:p,onLeave:()=>m.current?.focus()}):null,children:[r?(0,J.jsx)(lt,{attempt:h.attempt,exhausted:h.state===`closed`,onReconnect:g}):null,t?(0,J.jsx)(`div`,{"data-slot":`preview-overlay`,className:n&&o?`absolute inset-0 overflow-auto bg-background/85`:`absolute inset-0 overflow-auto bg-background`,children:t}):null,a?(0,J.jsx)(dt,{dialog:a,onResult:e=>{_(void 0),p({t:`dialogResult`,...e})}}):null]})}function Tn(e){let{visibleEvents:t}=he(e);return(0,q.useMemo)(()=>{let e=new Map;for(let n of te(t,{activeTurn:!1}).turns)for(let t of n.items)t.kind===`preview-server`&&e.set(t.server.port,t);return e},[t])}function En(e){let t=Tn(e.run.id),n=fe(e.run.id);return(0,J.jsx)(bn,{...e,serverStates:t,agentLive:n})}export{En as ConnectedPreviewPane};
|
|
@@ -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{t as r}from"./utils-DSMR_WLb.js";import{Jt as i,Wt as a,dn as o,k as s}from"./queries-ClkIgWFx.js";import{I as c,hi as l,n as u}from"./toaster-C-xqAWVX.js";import{J as d,W as f,at as p,c as m,ft as h,l as g,tt as _}from"./design-icons-CzEoMH9c.js";import{t as v}from"./button-B7MKxYjT.js";import{i as y,r as b,t as x}from"./popover-BPgUYFyu.js";import{a as S,i as C,o as w,r as T,s as E,t as D}from"./command-KdW7aO0N.js";import{f as O,i as k,p as A,u as j}from"./skills-pM_PouEs.js";import{t as M}from"./centered-state-V15AR_qo.js";import{$ as N,X as P,Yn as F,dn as I,et as L,rt as R}from"./index-BX94wp6m.js";import{t as z}from"./textarea-vJt9undk.js";import{n as B,t as V}from"./saved-draft-BwzBc-_Y.js";import{t as H}from"./save-cue-Cd3ZAPBS.js";import{t as U}from"./settings-field-DP9sYv5a.js";var W=e(t(),1),G=n();function K(){let e=s();return e.isPending?(0,G.jsx)(`p`,{"data-slot":`prompt-templates-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading prompt templates…`}):e.isError?(0,G.jsx)(M,{icon:(0,G.jsx)(f,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:e.error.message,heading:`h2`}):(0,G.jsx)(q,{initial:L(e.data.promptTemplates)})}function q({initial:e}){let t=l(),n=i(),r=s(),[f,m]=B(e,V),[g,_]=(0,W.useState)(``),[y,b]=(0,W.useState)(``),x=o({mutationFn:e=>c({promptTemplates:e}),onSuccess:(e,n)=>{t.setQueryData(a.uiState,e),m(t=>V(t,n)?L(e.promptTemplates):t),u(`Prompt templates saved`)},onError:e=>u(e.message,{tone:`danger`})}),S=JSON.stringify(f)!==JSON.stringify(e),C=g.trim()!==``||y.trim()!==``;I(S||C);let w=f.some(e=>e.label.trim()===``||e.text.trim()===``),T=(e,t)=>m(n=>n.map(n=>n.id===e?{...n,...t}:n)),E=(e,t)=>m(n=>n.map(n=>{if(n.id!==e)return n;let r=n.skills??[],i=r.includes(t)?r.filter(e=>e!==t):[...r,t],{skills:a,...o}=n;return i.length>0?{...o,skills:i}:o})),D=e=>m(t=>t.filter(t=>t.id!==e));return(0,G.jsx)(`div`,{"data-slot":`prompt-templates-section`,"data-reports-dirty":``,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,G.jsxs)(Y,{title:`Reusable instructions`,hint:`Insert templates from task composers, or apply them automatically with selected skills when the prompt is empty.`,children:[(0,G.jsx)(`div`,{"data-slot":`prompt-template-list`,className:`flex flex-col gap-3`,children:f.length===0?(0,G.jsx)(`p`,{"data-slot":`prompt-templates-empty`,className:`text-[13px] text-soft-foreground`,children:`No templates. Add one below, or reset to the built-ins.`}):f.map(e=>(0,G.jsxs)(`div`,{"data-slot":`prompt-template-row`,"data-template":e.id,className:`flex flex-col gap-1.5 rounded-md border border-border bg-card p-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`label`,{htmlFor:`template-label-${e.id}`,className:U,children:`Template label`}),(0,G.jsx)(F,{id:`template-label-${e.id}`,"aria-label":`Label for ${e.label||`this template`}`,"data-slot":`prompt-template-label-input`,value:e.label,maxLength:80,onChange:t=>T(e.id,{label:t.target.value}),className:`flex-1 border-border bg-background`})]}),(0,G.jsx)(`label`,{htmlFor:`template-text-${e.id}`,className:U,children:`Instructions`}),(0,G.jsx)(z,{id:`template-text-${e.id}`,"aria-label":`Text for ${e.label||`this template`}`,"data-slot":`prompt-template-text-input`,value:e.text,maxLength:2e3,onChange:t=>T(e.id,{text:t.target.value}),className:`min-h-14 rounded-md border border-border bg-background text-[13px]`}),(0,G.jsx)(`p`,{className:U,children:`Apply automatically with skills`}),(0,G.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,G.jsx)(J,{label:e.label,skills:n.data??[],skillUsage:r.data?.skillUsage,selected:e.skills??[],onToggle:t=>E(e.id,t)}),(e.skills??[]).map(t=>(0,G.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skill-chip`,"data-skill":t,title:`Stop applying “${e.label}” automatically with ${t}`,onClick:()=>E(e.id,t),className:`inline-flex items-center gap-1 rounded-md border border-border bg-muted px-2 py-0.5 font-mono text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[t,(0,G.jsx)(h,{"aria-hidden":`true`,className:`size-3`})]},t))]}),(0,G.jsxs)(v,{type:`button`,className:`self-start`,variant:`danger-ghost`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>D(e.id),children:[(0,G.jsx)(p,{"aria-hidden":`true`,className:`size-3`}),`Delete template`]})]},e.id))}),(0,G.jsxs)(`div`,{"data-slot":`prompt-template-new`,className:`flex flex-col gap-1.5 rounded-md border border-dashed border-border p-3`,children:[(0,G.jsx)(`h3`,{className:`text-lg`,children:`New template`}),(0,G.jsx)(`label`,{htmlFor:`new-template-label`,className:U,children:`Label`}),(0,G.jsx)(F,{id:`new-template-label`,"aria-label":`New template label`,"data-slot":`prompt-template-new-label`,placeholder:`e.g. Review security`,value:g,maxLength:80,onChange:e=>_(e.target.value),className:`border-border bg-background`}),(0,G.jsx)(`label`,{htmlFor:`new-template-text`,className:U,children:`Instructions to insert`}),(0,G.jsx)(z,{id:`new-template-text`,"aria-label":`New template text`,"data-slot":`prompt-template-new-text`,placeholder:`Enter reusable instructions…`,value:y,maxLength:2e3,onChange:e=>b(e.target.value),className:`min-h-14 rounded-md border border-border bg-background text-[13px]`}),(0,G.jsxs)(v,{type:`button`,variant:`outline`,size:`sm`,"data-action":`prompt-template-add`,disabled:!g.trim()||!y.trim(),onClick:()=>{let e=g.trim(),t=y.trim();!e||!t||(m(n=>[...n,{id:N(),label:e,text:t}]),_(``),b(``))},className:`self-start`,children:[(0,G.jsx)(d,{"aria-hidden":`true`,className:`size-3.5`}),`Add template`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(H,{show:!S&&!w&&!x.isPending,children:(0,G.jsx)(v,{type:`button`,variant:`primary`,size:`sm`,"data-action":`prompt-templates-save`,disabled:!S||w||x.isPending,onClick:()=>x.mutate(f),children:`Save`})}),(0,G.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:x.isPending,onClick:()=>m(P.map(e=>({...e}))),children:`Reset to defaults`}),w?(0,G.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-xs text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function J({label:e,skills:t,skillUsage:n,selected:i,onToggle:a}){let[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(``),u=(0,W.useRef)(null),{mostUsed:d,project:f,global:p,ranked:h}=j(t,c,n),v=(e,t)=>{let n=i.includes(e.id);return(0,G.jsxs)(w,{value:O(e),keywords:A(e.name,e.description),"data-slot":`prompt-template-skill-option`,"data-skill":e.id,"data-selected":n?`true`:void 0,onSelect:()=>a(e.id),children:[(0,G.jsx)(R,{skill:e,emphasized:t}),n?(0,G.jsx)(m,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},O(e))};return(0,G.jsxs)(x,{open:o,onOpenChange:e=>{s(e),e||l(``)},children:[(0,G.jsx)(y,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skills-trigger`,"aria-label":`Apply ${e||`this template`} automatically with a skill`,title:`Pick the skills this template applies itself to`,className:r(`inline-flex h-[26px] shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,i.length>0&&`text-foreground`),children:[(0,G.jsx)(_,{"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`Add skill`,(0,G.jsx)(g,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,G.jsx)(b,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,G.jsxs)(D,{shouldFilter:!1,children:[(0,G.jsx)(S,{placeholder:`search skills…`,value:c,onValueChange:l,onInput:()=>u.current?.scrollTo(0,0)}),(0,G.jsxs)(E,{ref:u,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.trim()&&!t.some(e=>e.id===c.trim())?(0,G.jsx)(C,{children:(0,G.jsxs)(w,{value:`typed-skill`,onSelect:()=>a(c.trim()),children:[`Use skill id “`,c.trim(),`” (unchecked)`]})}):null,(h?h.length===0:d.length===0&&f.length===0&&p.length===0)?(0,G.jsx)(T,{children:`Nothing matches.`}):null,h?h.length>0?(0,G.jsx)(C,{children:h.map(e=>v(e,k(e)))}):null:(0,G.jsxs)(G.Fragment,{children:[d.length>0?(0,G.jsx)(C,{heading:`Most used`,children:d.map(e=>v(e,k(e)))}):null,f.length>0?(0,G.jsx)(C,{heading:`Project skills`,children:f.map(e=>v(e,!0))}):null,p.length>0?(0,G.jsx)(C,{heading:`Global`,children:p.map(e=>v(e,!1))}):null]})]})]})})]})}function Y({title:e,hint:t,children:n}){return(0,G.jsxs)(`section`,{className:`settings-field flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,G.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}export{K as PromptTemplatesSection};
|
|
@@ -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{c as r,n as i,t as a}from"./utils-DSMR_WLb.js";import{C as o,E as s,T as c,W as l,Wt as u,dn as d,j as f,n as p,qt as m,rt as h,w as g,xt as _,yt as v}from"./queries-ClkIgWFx.js";import{Fn as y,It as b,L as x,R as ee,ct as S,f as C,hi as w,l as te,n as T}from"./toaster-C-xqAWVX.js";import{Z as ne}from"./live-protocol-DMhTnCmf.js";import{g as re,h as ie}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{i as E}from"./tasks-table-BkjZYg2J.js";import{A as D,C as O,E as ae,F as oe,J as se,M as ce,X as le,Y as ue,at as de,j as fe,n as pe,ot as k,s as me,u as he,v as ge,x as _e}from"./design-icons-CzEoMH9c.js";import{t as ve}from"./createLucideIcon-BHp8sXmF.js";import{n as ye,t as be}from"./circle-x-7nTlobAF.js";import{_ as xe}from"./nav-row-styles-D5HpOmDZ.js";import{i as Se,r as Ce,t as we}from"./git-toolbar-CRj5dZa2.js";import{t as A}from"./info-DA1x_4bz.js";import{t as Te}from"./loader-circle-CPBhhDbB.js";import{n as Ee,r as De}from"./diff-controls-D6LIYMhn.js";import{c as Oe,i as ke,t as Ae}from"./reference-chip-B8bfD56G.js";import{t as j}from"./button-B7MKxYjT.js";import{i as M,l as je,p as Me,r as Ne,t as Pe}from"./dropdown-menu-4e2iKSMT.js";import{t as N}from"./project-router-CT6gVIcC.js";import{t as Fe}from"./status-dot-BRzVlF2X.js";import{a as P,o as Ie}from"./format-BU7D3IfE.js";import{d as Le,n as Re,o as F,s as ze,t as Be,u as Ve}from"./page-shell-7pLJMOgh.js";import{t as I}from"./centered-state-V15AR_qo.js";import{An as He,At as Ue,Bt as L,Dt as We,Et as Ge,Ft as Ke,Gt as R,Ht as z,It as qe,Kt as B,Lt as Je,Mt as Ye,Nt as Xe,Ot as Ze,Pt as V,Rt as Qe,T as H,Tn as $e,Ut as U,Vt as W,Wt as G,Yn as K,Yt as q,dr as J,jn as et,jt as tt,kn as nt,kt as rt,lr as it,nr as at,qt as Y,un as ot,w as st,zt as ct}from"./index-BX94wp6m.js";import{t as lt}from"./markdown-BBDDg-4t.js";import{t as ut}from"./diff-B60FGSvK.js";import{t as dt}from"./change-counts-npLATh-3.js";import{n as ft,r as pt}from"./commit-list-DNiFNJqd.js";var X=e(t(),1);function mt(e,t){let n=w(t),r=n.getQueryCache();return X.useSyncExternalStore(X.useCallback(e=>r.subscribe(ne.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}var ht=ve(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),gt=ve(`git-pull-request-create`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v3`,key:`1jb6z3`}],[`path`,{d:`M18 15v6`,key:`9wciyi`}],[`path`,{d:`M21 18h-6`,key:`139f0c`}]]),Z=n();function _t(){let e=r(),t=o(),n=w(),i=mt({queryKey:u.repo})>0,s=t.data?.info?t.data:null,c=Ge(e,s,`screen`);return(0,Z.jsx)(Ve,{route:`repo-git`,density:s?.info?`full`:`empty`,headerSpacing:`compact`,header:{title:`Git`,secondaryActions:(0,Z.jsx)(ze,{type:`button`,variant:`ghost`,"data-slot":`git-screen-refresh`,"aria-label":`Refresh the repository`,title:`Refresh the repository`,disabled:i,onClick:()=>{n.invalidateQueries({queryKey:u.repo}),n.invalidateQueries({queryKey:u.worktrees})},children:(0,Z.jsx)(ue,{size:17,"aria-hidden":`true`,className:a(`size-[17px]`,i&&`motion-safe:animate-spin`)})})},children:(0,Z.jsxs)(`div`,{"data-slot":`git-screen`,children:[s?.info?(0,Z.jsx)(`div`,{className:`mb-[16px]`,children:(0,Z.jsx)(rt,{scope:e,repo:s,info:s.info,variant:`screen`},e)}):t.isPending?(0,Z.jsx)(`p`,{"data-slot":`git-screen-loading`,role:`status`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Loading the checkout…`}):t.isError?(0,Z.jsxs)(`p`,{"data-slot":`git-screen-error`,role:`alert`,className:`mb-[16px] px-[10px] text-[13px] text-danger`,children:[`Could not load the repository: `,t.error.message]}):(0,Z.jsx)(`p`,{"data-slot":`git-screen-not-git`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Not a git repository.`}),t.isPending?null:(0,Z.jsx)(We,{branch:s?.info?.branch??null,counts:c,variant:`screen`})]})})}function vt({entry:e}){return e.keptReason?(0,Z.jsx)(`span`,{"data-slot":`branch-kept-reason`,className:`min-w-0 text-xs text-muted-foreground`,children:e.keptReason}):null}function yt({repo:e,info:t}){let n=r(),i=[n,`repo`],o=[n,`health`],s=v(),c=g(),l=new Map((c.data?.branches??[]).map(e=>[e.name,e])),u=w(),f=d({mutationFn:e=>te({name:e},n),onSuccess:async e=>{T(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([u.invalidateQueries({queryKey:i}),u.invalidateQueries({queryKey:o})]),u.setQueryData(i,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),u.setQueryData(o,t=>tt(t,n,e.branch))},onError:e=>T(e.message,{tone:`danger`})}),[p,m]=(0,X.useState)(``),[h,_]=(0,X.useState)(``),y=h.trim().toLowerCase(),b=Q(e,c.data?.branches),x=y?b.filter(e=>e.toLowerCase().includes(y)):b;return(0,Z.jsxs)(`section`,{"data-slot":`repo-branches`,className:`grid min-w-0 grid-cols-1 gap-5 md:grid-cols-[minmax(0,1fr)_290px]`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,Z.jsxs)(`label`,{className:`relative block`,children:[(0,Z.jsx)(le,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3 size-4 text-muted-foreground`}),(0,Z.jsx)(K,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:h,onChange:e=>_(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-10`})]}),(0,Z.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-3.5 flex min-w-0 flex-col divide-y divide-border border-t border-border md:max-h-[40rem] md:overflow-y-auto md:overscroll-contain`,children:[x.map(e=>{let n=e===t.branch,r=l.get(e);return(0,Z.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,"data-branch-class":r?.class,className:`flex min-h-[60px] flex-col items-start justify-center gap-1.5 py-2 md:flex-row md:items-center md:justify-start md:gap-2.5`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[8px]`,children:[r?.runId?(0,Z.jsx)(N,{to:`/tasks/${r.runId}`,"data-slot":`branch-task-link`,title:r.title?`Open the task ${r.title}`:`Open the task`,className:`min-w-0 truncate rounded-[2px] font-mono text-[12px] underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:e}):(0,Z.jsx)(`span`,{className:a(`min-w-0 truncate font-mono text-[12px]`,n&&`font-medium`),children:e}),r&&!(n&&r.class===`active`)?(0,Z.jsx)(wt,{entry:r}):null]}),r?(0,Z.jsx)(vt,{entry:r}):null,e.startsWith(`cez/`)&&!n?null:n?(0,Z.jsx)(`span`,{"data-slot":`branch-current`,className:`flex h-8 shrink-0 items-center rounded-md bg-accent-strong/10 px-2.5 text-[12px] font-medium text-accent-text md:ml-auto`,children:`Current`}):(0,Z.jsxs)(j,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`h-8 max-md:h-11 no-hover:h-11 md:ml-auto`,disabled:f.isPending,onClick:()=>f.mutate(e),children:[(0,Z.jsx)(D,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),x.length===0?(0,Z.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-muted-foreground`,children:[`No branches match “`,h.trim(),`”.`]}):null]})]}),(0,Z.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,Z.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-5 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=p.trim();t&&f.mutate(t,{onSuccess:()=>m(``)})},children:[(0,Z.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,Z.jsxs)(`p`,{"data-slot":`branch-create-base`,className:`-mt-1 text-xs text-muted-foreground`,children:[`Create from `,(0,Z.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:t.branch}),`.`]}),(0,Z.jsx)(K,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background placeholder:text-soft-foreground`,value:p,onChange:e=>m(e.target.value)}),(0,Z.jsxs)(j,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!p.trim()||f.isPending,children:[(0,Z.jsx)(se,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,Z.jsx)(`p`,{"data-slot":`branch-create-note`,className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:`Switching branches changes your working tree. Review uncommitted changes first.`})]}),s.data?.forge?.available?(0,Z.jsx)(bt,{}):null]})}function bt(){let e=p({limit:20});return(0,Z.jsxs)(`div`,{"data-slot":`repo-prs`,className:`min-w-0 rounded-xl border border-border bg-card p-5 md:col-span-2`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold`,children:`Open pull requests`}),e.isPending?(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Loading pull requests…`}):e.isError?(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`No open pull requests.`}):(0,Z.jsx)(`ul`,{className:`mt-3 flex flex-col divide-y divide-border border-t border-border`,children:e.data.prs.map(e=>(0,Z.jsx)(xt,{pr:e},e.number))}):(0,Z.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-3 text-xs text-muted-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function xt({pr:e}){let t=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[`#`,e.number]}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,Z.jsx)(St,{checks:e.checks}):null]}),n=`flex min-h-11 min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,Z.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:i(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:a(n,`hover:bg-muted`),children:t}):(0,Z.jsx)(`span`,{className:n,children:t})})}function St({checks:e}){let t=e===`passing`?ye:e===`failing`?be:it;return(0,Z.jsxs)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:a(`inline-flex shrink-0 items-center gap-1 text-[12px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:[(0,Z.jsx)(t,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e]})}var Ct={active:`in use`,"not-landed":`not landed`,orphan:`not landed`,merged:`merged`,empty:`empty`,other:`yours`};function wt({entry:e}){return(0,Z.jsx)(`span`,{"data-slot":`branch-class`,className:a(`shrink-0 rounded-[4px] border px-1.5 py-px text-xs leading-4 font-medium`,e.class===`active`?`border-status-running/40 text-status-running`:e.class===`not-landed`||e.class===`orphan`?`border-inbox-count-foreground/40 text-inbox-count-foreground`:`border-border text-soft-foreground`),children:Ct[e.class]})}function Q(e,t){let n=new Set(e.branches);for(let e of t??[])n.add(e.name);return[...n].sort((e,t)=>e.localeCompare(t))}function Tt(){let e=c(),t=q(),[n,r]=(0,X.useState)(`unified`),[i,a]=(0,X.useState)(!0),[o,s]=(0,X.useState)(!1),[l,u]=(0,X.useState)(null),d=(0,X.useRef)(null),f=e.isError&&e.error instanceof y&&e.error.status===409,p=e.data?.files??[],m=(0,X.useMemo)(()=>Ce(p),[p]),h=(0,X.useMemo)(()=>p.some(lt),[p]),g=t?n:`unified`;return(0,Z.jsx)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:e.isPending?(0,Z.jsx)(`p`,{"data-slot":`changes-loading`,className:`py-6 text-center text-xs text-muted-foreground`,children:`Loading changes…`}):e.isError?(0,Z.jsx)(I,{icon:f?(0,Z.jsx)(O,{size:16}):(0,Z.jsx)(k,{size:16}),tone:f?`neutral`:`danger`,heading:`h2`,title:f?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):p.length===0?(0,Z.jsx)(I,{icon:(0,Z.jsx)(O,{size:16}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 pb-4 [&_button]:min-h-11`,children:[e.data?(0,Z.jsx)(we,{stat:e.data.stat}):null,(0,Z.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[h?(0,Z.jsx)(De,{preview:o,onPreviewChange:s}):null,(0,Z.jsx)(`span`,{className:`flex items-center gap-1.5`,children:(0,Z.jsx)(Ee,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})})]})]}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 [--diff-sticky-top:1rem] md:flex-row md:items-start`,children:[(0,Z.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 lg:w-[288px]`,children:[(0,Z.jsx)(`h2`,{"data-slot":`changes-tree-heading`,className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Z.jsx)(Se,{root:m,selected:l,onSelect:e=>{u(e),d.current?.scrollToPath(e)}})]}),(0,Z.jsx)(ut,{files:p,viewRef:d,mode:g,wrap:i,preview:o,totals:!1,className:`min-w-0 flex-1`})]})]})})}function Et({repo:e,info:t}){let{sha:n}=ie(),r=e.log,i=(0,X.useMemo)(()=>ct(r),[r]);if(n)return(0,Z.jsx)(kt,{sha:n});let a=Ke(e,t),o=a&&a.behind>0?(0,Z.jsx)(Ot,{info:t,tracking:a}):null;return r.length===0?(0,Z.jsxs)(Z.Fragment,{children:[o?(0,Z.jsx)(`div`,{children:o}):null,(0,Z.jsx)(I,{icon:(0,Z.jsx)(fe,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`})]}):(0,Z.jsxs)(`div`,{"data-slot":`repo-commits`,className:`flex flex-col gap-4`,children:[o,i.map(e=>(0,Z.jsxs)(`section`,{"data-slot":`repo-commit-day`,"aria-label":e.label,className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground`,children:e.label}),(0,Z.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.commits.map(e=>(0,Z.jsxs)(`li`,{className:`flex min-h-[52px] items-center gap-3.5 first:rounded-t-xl last:rounded-b-xl hover:bg-sidebar-row-hover`,children:[(0,Z.jsxs)(N,{to:`/git/commits/${e.hash}`,"data-slot":`commit-row`,"data-sha":e.hash,className:`flex min-h-[52px] min-w-0 flex-1 flex-col justify-center gap-0.5 px-4 py-2 focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Z.jsx)(`span`,{"data-slot":`commit-row-subject`,className:`truncate text-[13px] font-medium text-foreground`,children:e.subject}),(0,Z.jsxs)(`span`,{"data-slot":`commit-row-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(ft,{sha:e.hash}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.author,` · `,(0,Z.jsx)(`span`,{title:Qe(e.when,e.at),children:Je(e.when,e.at)})]})]})]}),(0,Z.jsx)(Dt,{source:e.source})]},e.hash))})]},e.label))]})}function Dt({source:e}){let t=`hidden max-w-[45%] shrink-0 items-center gap-[5px] pr-4 text-xs text-muted-foreground md:flex`;return e?(0,Z.jsxs)(N,{to:`/tasks/${e.runId}`,"data-slot":`commit-source`,"data-source":`task`,"aria-label":`From the task ${e.title}${e.prNumber===null?``:`, pull request #${e.prNumber}`}`,className:a(t,`rounded-[4px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`),children:[e.prNumber===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ce,{"aria-hidden":`true`,className:`size-[11px] shrink-0 text-merged-text`}),(0,Z.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`PR #`,e.prNumber]})]}),(0,Z.jsx)(me,{"aria-hidden":`true`,className:`size-[12px] shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}):(0,Z.jsx)(`span`,{"data-slot":`commit-source`,"data-source":`unknown`,className:t,children:`no task found`})}function Ot({info:e,tracking:t}){let n=Ye(r(),e),i=(0,X.useRef)(null);return(0,Z.jsxs)(`div`,{"data-slot":`git-incoming`,className:`flex min-h-[44px] items-center gap-2.5 rounded-xl border border-border bg-card px-4 py-2`,children:[(0,Z.jsx)(ht,{"aria-hidden":`true`,className:`size-[14px] shrink-0 text-inbox-count-foreground`}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 text-[12.5px] text-muted-foreground`,children:[t.behind,` commit`,t.behind===1?``:`s`,` on `,t.ref,` `,t.behind===1?`is`:`are`,` not in your checkout yet`]}),(0,Z.jsxs)(`button`,{ref:i,type:`button`,"data-action":`repo-pull-incoming`,disabled:!n.hasRemote||n.pulling,onClick:()=>void n.pull(),className:`inline-flex h-[28px] shrink-0 items-center gap-[4px] rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:h-11 [&>svg]:size-[12px]`,children:[n.pulling?(0,Z.jsx)(Te,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Z.jsx)(pe,{"aria-hidden":`true`}),`Pull`]}),(0,Z.jsx)(Ue,{checkout:n,returnFocus:i})]})}function kt({sha:e}){return(0,Z.jsx)(pt,{commit:s(e),sha:e,backTo:q()?`/git`:Xe,backLabel:`All recent commits`,slot:`repo-commit`,className:`flex min-h-0 flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:1rem] md:px-9`})}var At=`Squash-merged branches may show as not landed without GitHub`;function jt(e){let t=[],n=[],r=[];for(let i of e)if(i.class===`orphan`)r.push(i);else if(i.class!==`not-landed`)continue;else i.pr&&(i.pr.state===`open`||i.pr.state===`draft`)?n.push(i):t.push(i);return[{key:`no-pr`,title:`No pull request`,note:`nobody sees this work until you act`,rows:t},{key:`pr-open`,title:`Pull request open`,rows:n},{key:`deleted`,title:`Task deleted`,note:`this branch is the only copy of the work`,rows:r}].filter(e=>e.rows.length>0)}function Mt(e){return e.filter(e=>e.class===`active`&&e.runId!==null&&e.ahead>0&&(e.runStatus===`done`||e.runStatus===`failed`||e.runStatus===`cancelled`)).length}function Nt(){let e=g(),t=h(),n=r(),i=_(),[a,o]=(0,X.useState)(null);if(e.isPending)return(0,Z.jsx)(`p`,{"data-slot":`not-landed-loading`,role:`status`,className:`py-5 text-[13px] text-muted-foreground`,children:`Loading branches…`});if(e.isError)return(0,Z.jsx)(I,{icon:(0,Z.jsx)(k,{size:16}),tone:`danger`,heading:`h2`,title:`Could not classify the branches`,subtitle:e.error.message});let s=jt(e.data.branches),c=s.reduce((e,t)=>e+t.rows.length,0),l=Mt(e.data.branches),u=l>0?(0,Z.jsxs)(`p`,{"data-slot":`not-landed-retained`,className:`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,children:[(0,Z.jsx)(A,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,Z.jsxs)(`span`,{children:[l,` finished task`,l===1?` still has its`:`s still have their`,` worktree and commits not on the base, so `,l===1?`it is`:`they are`,` not listed here.`,` `,`They show here once the worktree is reclaimed in `,(0,Z.jsx)(N,{to:V.cleanup,className:`underline underline-offset-2 hover:text-foreground`,children:`Cleanup`}),`.`]})]}):null,d=new Map((t.data??[]).map(e=>[e.id,e.finishedAt]));return(0,Z.jsxs)(ke,{projectId:n,repoBase:i,requests:s.flatMap(e=>e.rows).flatMap(e=>e.pr?[{projectId:n,kind:`PR`,number:e.pr.number}]:[]),children:[(0,Z.jsxs)(`div`,{"data-slot":`repo-not-landed`,className:`flex flex-col gap-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-0`,children:[e.data.prStateKnown?null:(0,Z.jsx)(Pt,{}),u,s.length===0?(0,Z.jsx)(Be,{icon:(0,Z.jsx)(at,{size:16}),title:l>0?`Nothing else waiting to land`:`Everything landed`,description:l>0?`Every other finished task's commits are on the base branch, or it made none.`:`Every finished task's commits are on the base branch, or it made none.`,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Z.jsx)(N,{to:V.cleanup,children:`Check cleanup`})}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Z.jsx)(N,{to:`/`,children:`View tasks`})})]})}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-5`,children:s.map(e=>(0,Z.jsxs)(`section`,{"data-slot":`not-landed-group`,"data-group":e.key,"aria-label":e.title,className:`flex flex-col gap-1.5`,children:[(0,Z.jsxs)(`h2`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.title}),(0,Z.jsx)(`span`,{className:`tabular-nums`,children:e.rows.length}),e.note?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{}),(0,Z.jsx)(`span`,{children:e.note})]}):null]}),(0,Z.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.rows.map(e=>(0,Z.jsx)(Ft,{entry:e,finishedAt:e.runId?d.get(e.runId):void 0,onDelete:()=>o(e)},e.name))})]},e.key))}),(0,Z.jsxs)(`p`,{"data-slot":`not-landed-note`,className:`flex items-start gap-1.5 px-1 text-xs leading-snug text-muted-foreground`,children:[(0,Z.jsx)(A,{"aria-hidden":`true`,className:`mt-px size-3 shrink-0`}),`Delete a branch from its row's … menu. It confirms and names the commits it drops; nothing here is bulk-deleted.`]}),c<=3?(0,Z.jsx)(Re,{summary:`${c} ${c===1?`branch`:`branches`} waiting to land. Open a draft PR or inspect worktrees in Cleanup.`,actions:(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Z.jsx)(N,{to:V.cleanup,children:`Open cleanup`})})}):null]})]}),(0,Z.jsx)(Bt,{entry:a,onClose:()=>o(null)})]})}function Pt({className:e}){return(0,Z.jsxs)(`p`,{"data-slot":`git-no-forge`,className:a(`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,e),children:[(0,Z.jsx)(A,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),At,`.`]})}function Ft({entry:e,finishedAt:t,onDelete:n}){return(0,Z.jsxs)(`li`,{"data-slot":`not-landed-row`,"data-branch":e.name,"data-branch-class":e.class,className:`flex min-h-[60px] items-center gap-3 px-4 py-3 first:rounded-t-xl last:rounded-b-xl hover:bg-sidebar-row-hover`,children:[(0,Z.jsx)(Rt,{entry:e,finishedAt:t}),(0,Z.jsx)(It,{entry:e}),(0,Z.jsx)(Lt,{entry:e,onDelete:n})]})}function It({entry:e}){return(0,Z.jsx)(Z.Fragment,{children:e.pr?(0,Z.jsxs)(`span`,{"data-slot":`not-landed-pr`,className:`hidden shrink-0 items-center gap-1.5 text-xs text-muted-foreground md:flex`,children:[(0,Z.jsx)(Ae,{plain:!0,reference:{kind:`PR`,number:e.pr.number,url:e.pr.url},taskTitle:e.title??e.name,status:e.pr.state===`draft`?`draft`:e.pr.state===`closed`?`closed`:void 0}),(0,Z.jsx)(zt,{entry:e})]}):null})}function Lt({entry:e,onDelete:t}){let n=w(),r=e.class===`orphan`,i=e.pr&&(e.pr.state===`open`||e.pr.state===`draft`)?e.pr:null,o=!r&&e.runId!==null&&!i,s=d({mutationFn:()=>S(e.runId),onSuccess:e=>{T(`Draft PR created — ${e.url}`),n.invalidateQueries({queryKey:u.repoBranches}),n.invalidateQueries({queryKey:u.runs.all})},onError:e=>T(e instanceof y&&e.manual?`${e.message} — ${e.manual}`:e.message,{tone:`danger`})}),c=()=>void navigator.clipboard.writeText(e.name).then(()=>T(`Copied ${e.name}`),()=>T(`Could not copy the branch name`,{tone:`danger`})),l=`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-sm px-2.5 text-[12.5px] font-medium text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 [&>svg]:size-[12px]`;return(0,Z.jsxs)(Z.Fragment,{children:[e.runId?(0,Z.jsx)(N,{to:`/tasks/${e.runId}`,"data-action":`not-landed-open`,className:a(l,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:`Open task`}):null,o?(0,Z.jsxs)(`button`,{type:`button`,"data-action":`not-landed-create-pr`,disabled:s.isPending,onClick:()=>s.mutate(),className:a(l,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[(0,Z.jsx)(gt,{"aria-hidden":`true`}),s.isPending?`Creating…`:`Draft PR`]}):null,r?(0,Z.jsxs)(`button`,{type:`button`,"data-action":`not-landed-copy`,onClick:c,className:a(l,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[(0,Z.jsx)(ge,{"aria-hidden":`true`}),`Copy branch`]}):null,(0,Z.jsxs)(Pe,{children:[(0,Z.jsx)(Me,{"data-action":`not-landed-more`,"aria-label":`More actions for ${e.name}`,className:`flex size-8 shrink-0 items-center justify-center rounded-sm text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:size-11`,children:(0,Z.jsx)(_e,{"aria-hidden":`true`,className:`size-[14px]`})}),(0,Z.jsxs)(Ne,{align:`end`,className:`w-52`,children:[e.runId?(0,Z.jsx)(M,{asChild:!0,className:`md:hidden`,children:(0,Z.jsx)(N,{to:`/tasks/${e.runId}`,children:`Open task`})}):null,o?(0,Z.jsx)(M,{className:`md:hidden`,disabled:s.isPending,onSelect:()=>s.mutate(),children:`Draft PR`}):null,(0,Z.jsx)(M,{className:a(!r&&`md:hidden`),onSelect:c,children:`Copy branch`}),(0,Z.jsx)(je,{className:`md:hidden`}),(0,Z.jsx)(M,{"data-action":`not-landed-delete`,variant:`destructive`,onSelect:t,children:`Delete branch…`})]})]})]})}function Rt({entry:e,finishedAt:t}){let n=e.class===`orphan`,r=n?`No task · last commit “${e.lastCommit.subject}”`:e.title??e.name,i=t??e.lastCommit.at,a=P(i),o=e.runStatus?$e(e.runStatus):void 0,s=n||!o?a:`${o.label}${a?` ${a}`:``}`,c=Number.isFinite(Date.parse(i))?new Date(i).toLocaleString():void 0;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`flex size-[12px] shrink-0 items-center justify-center`,children:n?(0,Z.jsx)(xe,{"aria-label":`Task deleted`,className:`size-[12px] text-muted-foreground`}):(0,Z.jsx)(Fe,{tone:o?.tone??`neutral`,shape:o?.shape??`filled`,"aria-label":o?.label})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[e.runId?(0,Z.jsx)(N,{to:`/tasks/${e.runId}`,"data-slot":`not-landed-title`,className:`min-w-0 truncate rounded-[2px] text-[13px] font-medium text-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:r}):(0,Z.jsx)(`span`,{"data-slot":`not-landed-title`,className:`min-w-0 truncate text-[13px] font-medium text-foreground`,title:r,children:r}),(0,Z.jsxs)(`span`,{"data-slot":`not-landed-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),(0,Z.jsx)($,{}),(0,Z.jsxs)(`span`,{className:`shrink-0`,children:[e.ahead,` commit`,e.ahead===1?``:`s`]}),e.diffStat?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{}),(0,Z.jsx)(dt,{adds:e.diffStat.additions,dels:e.diffStat.deletions})]}):null,s?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{}),(0,Z.jsx)(`span`,{className:`truncate`,title:c,children:s})]}):null]}),e.parentRunId?(0,Z.jsx)(N,{to:`/tasks/${e.parentRunId}`,"data-slot":`not-landed-parent`,className:`w-fit rounded-[2px] text-xs text-muted-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:`Worker of its parent task`}):null,(0,Z.jsx)(vt,{entry:e})]})]})}function $(){return(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`})}function zt({entry:e}){let t=m(Oe(`PR`,e.pr?.number).status),n=e.pr?.state,r=n===`draft`||n===`closed`?n:t?t.label.toLowerCase():`open`;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{}),(0,Z.jsx)(`span`,{"data-slot":`not-landed-pr-state`,children:r})]})}function Bt({entry:e,onClose:t}){let n=w(),[r,i]=(0,X.useState)(``),a=(0,X.useId)(),o=d({mutationFn:e=>C({names:[e],confirm:e}),onSuccess:e=>{let t=e.dropped?.length??0;T(e.deleted.length>0?`Deleted ${e.deleted[0]}${t?` and ${t} commit${t===1?``:`s`} with it`:``}`:e.refused[0]?.reason??`Nothing was deleted`),n.invalidateQueries({queryKey:u.repo}),s()},onError:e=>T(e.message,{tone:`danger`})}),s=()=>{i(``),t()},c=e!==null&&r.trim()===e.name,l=e&&`${e.ahead} commit${e.ahead===1?``:`s`}`;return(0,Z.jsx)(L,{open:e!==null,onOpenChange:e=>!e&&!o.isPending&&s(),children:(0,Z.jsxs)(U,{"data-slot":`delete-branch-dialog`,children:[(0,Z.jsxs)(B,{children:[(0,Z.jsxs)(Y,{children:[`Delete `,e?.name,`?`]}),(0,Z.jsx)(G,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{children:e?.class===`orphan`?`Its task was deleted, so this branch is the only copy of the work.`:(0,Z.jsxs)(Z.Fragment,{children:[`This drops the work of `,(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:e?.title??e?.name}),`. It is not on the base branch`,e?.pr?``:` and no pull request carries it`,`.`]})}),(0,Z.jsxs)(`p`,{"data-slot":`delete-branch-dropped`,children:[l,` will be dropped`,e?.diffStat?` (+${e.diffStat.additions} −${e.diffStat.deletions})`:``,`, the latest “`,e?.lastCommit.subject,`”`,e?.lastCommit.sha?(0,Z.jsxs)(Z.Fragment,{children:[` (`,(0,Z.jsx)(et,{sha:e.lastCommit.sha,variant:`inline`}),`)`]}):null,`.`]})]})})]}),(0,Z.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),c&&e&&!o.isPending&&o.mutate(e.name)},className:`flex flex-col gap-[6px]`,children:[(0,Z.jsxs)(`label`,{htmlFor:a,className:`text-[12.5px] text-muted-foreground`,children:[`Type `,(0,Z.jsx)(`span`,{className:`font-mono text-foreground`,children:e?.name}),` to confirm`]}),(0,Z.jsx)(K,{id:a,"data-slot":`delete-branch-confirm`,autoComplete:`off`,spellCheck:!1,value:r,onChange:e=>i(e.target.value),className:`h-11 font-mono`})]}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(z,{className:`h-11`,disabled:o.isPending,children:`Keep it`}),(0,Z.jsx)(W,{"data-action":`delete-branch-confirm`,className:`h-11 bg-danger text-danger-foreground hover:brightness-[0.96]`,disabled:!c||o.isPending,onClick:t=>{t.preventDefault(),e&&o.mutate(e.name)},children:o.isPending?`Deleting…`:`Delete branch`})]})]})})}function Vt({base:e}){let t=g(),n=w(),[r,i]=(0,X.useState)({merged:!1,empty:!1}),[a,o]=(0,X.useState)(!1),s=(t.data?.branches??[]).filter(e=>e.class===`merged`),c=(t.data?.branches??[]).filter(e=>e.class===`empty`),l=[...s,...c],f=d({mutationFn:e=>C({names:e}),onSuccess:e=>{let t=e.refused.length;T(`Deleted ${e.deleted.length} branch${e.deleted.length===1?``:`es`}${t?`; kept ${t} that ${t===1?`is`:`are`} no longer safe to delete`:``}`),n.invalidateQueries({queryKey:u.repo})},onError:e=>{n.invalidateQueries({queryKey:u.repo}),T(e.message,{tone:`danger`})}});if(t.isPending)return(0,Z.jsx)(`p`,{"data-slot":`cleanup-branches-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading branches…`});if(t.isError)return(0,Z.jsxs)(`p`,{"data-slot":`cleanup-branches-error`,className:`text-[13px] text-danger`,children:[`Branches did not load: `,t.error.message]});let p=l.length,m=`branch${p===1?``:`es`}`;return(0,Z.jsxs)(`section`,{"data-slot":`cleanup-branches`,"aria-labelledby":`cleanup-branches-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Z.jsxs)(`h2`,{id:`cleanup-branches-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Branches safe to delete · `,p]}),(0,Z.jsxs)(`p`,{className:`text-xs leading-[17px] text-soft-foreground`,children:[`Their work is already on `,e,`, or they have none. Deleting loses nothing.`]})]}),(0,Z.jsxs)(`button`,{type:`button`,"data-action":`cleanup-branches-delete`,disabled:p===0||f.isPending,onClick:()=>o(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,Z.jsx)(de,{"aria-hidden":`true`,className:`size-[12px]`}),f.isPending?`Deleting…`:`Delete ${p} ${m}`]})]}),(0,Z.jsx)(Ht,{kind:`merged`,title:`Merged into ${e}`,hint:t.data.prStateKnown?`including squash-merged PRs, read from the PR state`:At.toLowerCase(),rows:s,open:r.merged,onToggle:()=>i(e=>({...e,merged:!e.merged}))}),(0,Z.jsx)(Ht,{kind:`empty`,title:`Empty`,hint:`no commits beyond the fork point`,rows:c,open:r.empty,onToggle:()=>i(e=>({...e,empty:!e.empty}))}),(0,Z.jsx)(L,{open:a,onOpenChange:o,children:(0,Z.jsxs)(U,{children:[(0,Z.jsxs)(B,{children:[(0,Z.jsxs)(Y,{children:[`Delete `,p,` `,m,`?`]}),(0,Z.jsxs)(G,{children:[s.length,` merged into `,e,` and `,c.length,` empty. Their work is already on `,e,`, or they have none. Anything that stopped being safe since this list loaded is kept.`]})]}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(z,{children:`Keep them`}),(0,Z.jsxs)(W,{"data-action":`cleanup-branches-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{f.mutate(l.map(e=>e.name)),o(!1)},children:[`Delete `,p,` `,m]})]})]})})]})}function Ht({kind:e,title:t,hint:n,rows:r,open:i,onToggle:o}){let s=`cleanup-branches-${e}`;return(0,Z.jsxs)(`div`,{"data-slot":`cleanup-branch-group`,"data-group":e,className:`border-b border-border last:border-0`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":i,"aria-controls":s,disabled:r.length===0,onClick:o,className:`flex min-h-[44px] w-full items-center gap-[12px] px-[14px] py-[4px] text-left hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:hover:bg-transparent`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Z.jsxs)(`span`,{className:`truncate text-[12.5px] text-foreground`,children:[t,` · `,r.length]}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-soft-foreground`,children:n})]}),r.length>0?(0,Z.jsx)(he,{"aria-hidden":`true`,className:a(`size-[13px] shrink-0 text-soft-foreground transition-transform motion-reduce:transition-none`,i&&`rotate-90`)}):null]}),i?(0,Z.jsx)(`ul`,{id:s,"aria-label":t,className:`flex flex-col pb-[6px]`,children:r.map(e=>(0,Z.jsxs)(`li`,{"data-slot":`cleanup-branch-row`,"data-branch":e.name,className:`flex min-h-[32px] items-center gap-[10px] px-[14px] pl-[26px] text-xs`,children:[(0,Z.jsx)(nt,{value:e.name,className:`shrink-0 text-muted-foreground`}),e.runId?(0,Z.jsx)(N,{to:`/tasks/${e.runId}`,className:`min-w-0 flex-1 truncate text-soft-foreground underline-offset-2 hover:text-foreground hover:underline`,children:e.title??`Open the task`}):(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-soft-foreground`,children:e.lastCommit.subject}),e.pr?(0,Z.jsxs)(`span`,{className:`shrink-0 text-soft-foreground`,children:[`PR #`,e.pr.number]}):null,(0,Z.jsx)(He,{iso:e.lastCommit.at,className:`shrink-0 text-soft-foreground`})]},e.name))}):null]})}function Ut(){let e=f(),t=l().data?.targets.find(e=>e.id===`finder`),n=d({mutationFn:e=>b(e,t.id),onError:e=>T(e.message,{tone:`danger`})}),r=w(),[i,a]=(0,X.useState)(!1),o=()=>Promise.all([r.invalidateQueries({queryKey:u.worktrees}),r.invalidateQueries({queryKey:u.repoBranches})]),s=d({mutationFn:e=>ee(),onSuccess:(e,t)=>{o();let n=e.reclaimed.length,r=Math.max(0,t-n);T(n===0?r>0?`Nothing was reclaimed — the worktrees past the keep limit have uncommitted work or are in use`:`Nothing to reclaim — no finished worktrees exceed the keep limit`:`Reclaimed ${n} worktree${n===1?``:`s`} (branch kept)${r>0?` · ${r} kept: uncommitted work or in use`:``}`)},onError:e=>T(e.message,{tone:`danger`})}),c=d({mutationFn:e=>x(e.runId),onSuccess:(e,t)=>{o(),T(`Reclaimed the worktree of ${t.title} (branch kept)`)},onError:e=>{o(),T(e.message,{tone:`danger`})}});if(e.isPending)return(0,Z.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,Z.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:p,totalBytes:m,keep:h}=e.data,g=s.isPending||c.isPending,_=p.filter(e=>e.pastKeep),v=_.length>0,y=_.some(e=>e.sizeBytes===null)?null:_.reduce((e,t)=>e+(t.sizeBytes??0),0),S=v?y?`Reclaim ${E(y)} now`:`Reclaim ${_.length} now`:`Reclaim now`,C=m?E(m):null;return(0,Z.jsxs)(`section`,{"data-slot":`worktrees-panel`,"aria-labelledby":`worktrees-panel-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Z.jsxs)(`h2`,{id:`worktrees-panel-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Worktrees on disk`,C?` · ${C}`:``]}),(0,Z.jsxs)(`p`,{"data-slot":`worktrees-retention`,className:`text-xs leading-[17px] text-soft-foreground`,children:[h===0?`Retention is unlimited (`:`Retention keeps the newest ${h} finished checkout${h===1?``:`s`} (`,(0,Z.jsx)(N,{to:`/settings/worktrees`,"data-slot":`worktrees-retention-link`,className:`underline-offset-2 hover:text-foreground hover:underline`,children:ot(`worktrees`,` › `)}),h===0?`), so nothing is reclaimed on its own.`:`) and reclaims the rest.`,` `,`Reclaim removes the directory only; the branch stays, so its work stays recoverable.`]})]}),(0,Z.jsxs)(`button`,{type:`button`,"data-action":`worktrees-reclaim-now`,disabled:g||!v,title:v?void 0:`Nothing past the keep limit to reclaim`,onClick:()=>a(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,Z.jsx)(J,{"aria-hidden":`true`,className:`size-[12px]`}),S]})]}),p.length===0?(0,Z.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`px-[14px] py-[12px] text-[12.5px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,Z.jsx)(`ul`,{"aria-label":`Task worktrees on disk`,className:`flex flex-col`,children:p.map(e=>(0,Z.jsx)(Kt,{worktree:e,keep:h,disabled:g,onOpen:t?()=>n.mutate(e.runId):void 0,opening:n.isPending,onReclaim:()=>c.mutate(e)},e.runId))}),(0,Z.jsx)(L,{open:i,onOpenChange:a,children:(0,Z.jsxs)(U,{children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(Y,{children:`Reclaim old worktrees?`}),(0,Z.jsxs)(G,{children:[_.length,` finished worktree`,_.length===1?``:`s`,` beyond the keep limit`,y?` (${E(y)})`:``,` `,_.length===1?`is`:`are`,` reclaimed now, directory only. Their branches are kept, so the work stays recoverable.`]})]}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(z,{children:`Keep them`}),(0,Z.jsx)(W,{"data-action":`worktrees-confirm`,onClick:()=>{s.mutate(_.length),a(!1)},children:S})]})]})})]})}var Wt=new Set([`queued`,`running`,`waiting`,`review`]);function Gt(e,t){return Wt.has(e.status)||!e.reclaimable?{label:`in use`,tone:`in-use`}:e.pastKeep?{label:`reclaimable`,tone:`plain`}:{label:t>0?`kept · newest ${t}`:`kept`,tone:`plain`}}function Kt({worktree:e,keep:t,disabled:n,onOpen:r,opening:i,onReclaim:o}){let s=Gt(e,t),c=P(e.finishedAt??void 0),l=e.status===`review`?`at review`:c?`${e.status} ${Ie(c)}`:e.status,u=(0,Z.jsx)(`span`,{"data-slot":`worktree-state`,"data-state":s.tone===`in-use`?`in-use`:e.pastKeep?`reclaimable`:`kept`,className:a(`text-xs`,s.tone===`in-use`?`text-status-running`:`text-soft-foreground`),children:s.label}),d=`flex size-[28px] shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:size-11`;return(0,Z.jsxs)(`li`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`flex min-h-[44px] items-center gap-[12px] border-b border-border px-[14px] py-[4px] last:border-0`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Z.jsx)(`span`,{className:`truncate text-[12.5px] text-foreground`,title:e.title,children:e.title}),(0,Z.jsxs)(`span`,{className:`truncate font-mono text-xs text-soft-foreground`,children:[e.branch??e.runId.slice(0,8),` · `,l,(0,Z.jsxs)(`span`,{className:`md:hidden`,children:[` · `,s.label]})]})]}),(0,Z.jsx)(`span`,{"data-slot":`worktree-size`,className:`shrink-0 text-xs tabular-nums text-muted-foreground`,children:e.sizeBytes===null?`—`:E(e.sizeBytes)||`0 kB`}),(0,Z.jsx)(`span`,{className:`hidden shrink-0 md:inline`,children:u}),r?(0,Z.jsx)(`button`,{type:`button`,className:d,"aria-label":`Open folder for ${e.title}`,title:`Open folder`,disabled:i,onClick:r,children:(0,Z.jsx)(ae,{"aria-hidden":`true`,className:`size-[13px]`})}):null,s.tone===`in-use`?null:(0,Z.jsx)(`button`,{type:`button`,"data-action":`worktree-reclaim`,"aria-label":`Reclaim the worktree of ${e.title} (branch kept)`,title:`Reclaim the directory (branch kept)`,disabled:n,onClick:o,className:d,children:(0,Z.jsx)(J,{"aria-hidden":`true`,className:`size-[13px]`})})]})}function qt(e){return e===`main`||e===`changes`?`Split`:`Table`}function Jt({section:e,index:t=!1}){let n=o(),r=q(),[i]=re(),a=qt(e);if(t&&!r&&i.get(`view`)!==`repo`)return(0,Z.jsx)(_t,{});if(n.isPending)return(0,Z.jsx)(st,{});if(n.isError)return(0,Z.jsx)(F,{template:a,route:`repo-git`,density:`empty`,beforeHeader:(0,Z.jsx)(H,{}),children:(0,Z.jsx)(I,{icon:(0,Z.jsx)(k,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:n.error.message})});let s=n.data.info;return s?(0,Z.jsx)(Yt,{repo:n.data,info:s,section:e}):(0,Z.jsx)(F,{template:a,route:`repo-git`,density:`empty`,beforeHeader:(0,Z.jsx)(H,{}),children:(0,Z.jsx)(I,{icon:(0,Z.jsx)(D,{size:16}),tone:`neutral`,title:`Not a git repository`,subtitle:`Squawk is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function Yt({repo:e,info:t,section:n}){let r=qt(n),i=g(),a=n===`main`?e.log.length:n===`changes`?e.status.length:n===`branches`?Q(e,i.data?.branches).length:n===`not-landed`?i.data?.branches.filter(e=>e.class===`not-landed`||e.class===`orphan`).length??0:4;return(0,Z.jsx)(F,{template:r,route:`repo-git`,density:n===`not-landed`&&i.isPending?`full`:Le(a),rootProps:{"data-git-section":n},beforeHeader:(0,Z.jsx)(H,{}),header:{title:Ze(n,t.branch),headerSlot:`repo-header`,subtitle:(0,Z.jsx)(Xt,{repo:e,info:t,section:n}),subtitleSlot:`repo-meta`},children:n===`main`?(0,Z.jsx)(Et,{repo:e,info:t}):n===`not-landed`?(0,Z.jsx)(Nt,{}):n===`cleanup`?(0,Z.jsxs)(`div`,{"data-slot":`repo-cleanup`,className:`flex flex-col gap-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-0`,children:[(0,Z.jsx)(Ut,{}),(0,Z.jsx)(Vt,{base:e.baseBranch??t.branch})]}):n===`branches`?(0,Z.jsx)(yt,{repo:e,info:t}):(0,Z.jsx)(Tt,{})})}function Xt({repo:e,info:t,section:n}){let r=e.baseBranch??t.branch;switch(n){case`main`:return(0,Z.jsxs)(Z.Fragment,{children:[e.log.length===0?`No commits yet`:`Latest ${e.log.length} commit${e.log.length===1?``:`s`} in the main checkout`,e.tracking?` · ${qe(e.tracking)}`:``]});case`not-landed`:return(0,Z.jsxs)(Z.Fragment,{children:[`Finished tasks whose commits are not on `,r]});case`branches`:return(0,Z.jsx)(Zt,{repo:e,info:t});case`changes`:return(0,Z.jsxs)(Z.Fragment,{children:[e.status.length,` uncommitted file`,e.status.length===1?``:`s`,` in the main checkout`]});case`cleanup`:return(0,Z.jsxs)(Z.Fragment,{children:[`Nothing here can delete work that is not on `,r]})}}function Zt({repo:e,info:t}){let n=Q(e,g().data?.branches).length;return(0,Z.jsxs)(Z.Fragment,{children:[n,` branch`,n===1?``:`es`,` · on `,t.branch]})}export{Jt as RepoGitRoute};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{l as r,n as i,t as a}from"./utils-DSMR_WLb.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-ClkIgWFx.js";import{Fn as v,ct as y,dr as b,hi as x,n as S,ot as ee,pt as C,rr as w}from"./toaster-C-xqAWVX.js";import{f as T,n as E,p as D}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{B as te,F as ne,K as re,X as ie,at as ae,c as oe,dt as se,s as ce,u as O,v as le}from"./design-icons-CzEoMH9c.js";import{t as k}from"./createLucideIcon-BHp8sXmF.js";import{t as ue}from"./chevron-right-BENZ-1ZN.js";import{t as de}from"./external-link-BE6y205O.js";import{t as A}from"./eye-B8okNWXU.js";import{n as fe}from"./smartphone-Lr8Ug2z_.js";import{t as j}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 M}from"./button-B7MKxYjT.js";import{n as N,r as P,t as F}from"./collapsible-BEV4FO-1.js";import{t as I}from"./project-router-CT6gVIcC.js";import{O as _e}from"./task-groups-aquji1Kv.js";import{t as ve}from"./report-selection-D9xJZoKb.js";import{n as ye}from"./centered-state-V15AR_qo.js";import{$n as be,$t as xe,J as Se,P as Ce,Zt as we,cn as Te,gn as Ee,ir as De,tn as Oe}from"./index-BX94wp6m.js";import{i as ke,r as Ae}from"./highlighter-DvLzHjjY.js";import{t as je}from"./zoomable-image-6RTKhLGE.js";import{i as Me,r as Ne,t as L}from"./markdown-DK1FZN4x.js";import{r as Pe}from"./html-report-BX3msvci.js";import{t as R}from"./textarea-vJt9undk.js";import{t as Fe}from"./report-title-D4Mbu2Er.js";var Ie=k(`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`}]]),Le=k(`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`}]]),Re=k(`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`}]]),ze=k(`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`}]]),Be=k(`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`}]]),z=e(t(),1),B=n();function Ve(e,t){if(e.length===1)return[t.replace(RegExp(`^${He(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 He(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ue(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]:[]}function We({ask:e}){let t=e.answer===void 0?void 0:Ve(e.questions,e.answer);return(0,B.jsxs)(`div`,{"data-slot":`ask-answers`,className:`flex flex-col gap-4 text-sm`,children:[e.questions.map((n,r)=>{let i=t?.[r],a=Ue(n,i),o=i!==void 0&&a.length===0;return(0,B.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-label":n.question,children:[(0,B.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[n.header,` · Question `,r+1,` of `,e.questions.length]}),(0,B.jsx)(`p`,{className:`break-words font-semibold`,children:n.question}),n.options?(0,B.jsxs)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:[n.options.map(e=>(0,B.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,B.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-message-user-accent`,children:a.includes(e.label)?`✓`:`○`}),(0,B.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,B.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description}):null]}),a.includes(e.label)?(0,B.jsx)(`span`,{className:`shrink-0 text-xs text-message-user-accent`,children:`Selected`}):null]},e.label)),(0,B.jsxs)(`li`,{"data-selected":o,className:`rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border`,children:[(0,B.jsxs)(`p`,{className:`flex items-start gap-2 font-medium`,children:[(0,B.jsx)(`span`,{"aria-hidden":!0,className:`text-message-user-accent`,children:o?`✓`:`○`}),(0,B.jsx)(`span`,{className:`flex-1`,children:`Other`}),o?(0,B.jsx)(`span`,{className:`text-xs text-message-user-accent`,children:`Selected`}):null]}),o?(0,B.jsx)(V,{text:i}):null]})]}):i===void 0?null:(0,B.jsx)(V,{text:i})]},n.id??r)}),!t&&e.answer!==void 0?(0,B.jsx)(V,{text:e.answer}):null]})}function V({text:e}){return(0,B.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 Ge(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Ke=/^[A-Za-z0-9_./:=+,@%-]+$/;function qe(e){return e.replaceAll(`'`,`'\\''`)}function Je(e){return e===``?`''`:Ke.test(e)?e:`\u0027${qe(e)}\u0027`}function Ye(e){if(!Ge(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(Je).join(` `)}}function Xe(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 Ze(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function Qe(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function H(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function $e(e){let t=Xe(Ze(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))H(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]){H(e[2])&&i.push({label:Qe(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:Qe(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&H(t)&&i.push({label:t,href:t})}return i}var et=(0,z.createContext)(void 0),tt=(0,z.createContext)(void 0);function nt(e,t){let n=new Map;for(let r of $e(e)){let e=Me(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 U(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function rt({text:e,messageKey:t}){let n=(0,z.useContext)(Ne),r=(0,z.useContext)(tt),i=t??r;if(!n||i===void 0)return null;let a=nt(e,n);return a.length===0?null:(0,B.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,B.jsx)(it,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function it({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:a}=e,o=(0,z.useContext)(et),s=(0,z.useContext)(ve);(0,z.useLayoutEffect)(()=>s?.register(n,r),[s,n,r]);let c=l(r,n),u=T(),d=D();if(c.isError)return(0,B.jsx)(E,{id:U(t,n),"data-slot":`report-card-fallback`,to:a,state:{readerFrom:u.pathname+u.search},children:i});let f=c.data?.artifact;if(f&&!Pe(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,B.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,B.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:f?Fe(f):i}),(0,B.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,B.jsx)(E,{id:U(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="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 at={message:!0,reasoning:!0,tool:!0,hook:!0};function ot(e){return Object.hasOwn(at,e)&&at[e]}var W=e=>e.kind===`tool`,st=e=>e.kind===`conversation`,ct=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,G=(e,t,n)=>`${e} ${e===1?t:n}`;function lt(e,t){let n=[];return e>0&&n.push(G(e,`file`,`files`)),t>0&&n.push(G(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function ut(e){return`${e} earlier tool call${e===1?``:`s`}`}var dt=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function ft(e){for(let t of dt)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 pt=new WeakMap;function mt(e){let t=pt.get(e);if(t)return t;let n=ht(e);return pt.set(e,n),n}function ht(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(W).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=ot(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:lt(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 gt(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(st(e)){s(),c.push(e);continue}l(),W(e)&&ct(e)&&!r.has(e.id)?o.push(e):(s(),W(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 gt(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 K=new Map,_t=(0,z.createContext)(null);function q(){return(0,z.useContext)(_t)}function vt({runId:e,children:t}){let n=(0,z.useMemo)(()=>({get:t=>K.get(e)?.get(t),set:(t,n)=>{let r=K.get(e)??new Map;r.set(t,n),K.set(e,r)}}),[e]);return(0,B.jsx)(_t.Provider,{value:n,children:t})}function yt(e){return e.scrollTop<Math.max(600,e.clientHeight)}function bt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function xt(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 St(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Ct(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var wt=new Map;function Tt(e,t){wt.set(e,t)}function Et(e){return wt.get(e)}var J=new Map;function Dt(e,t){J.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function Ot(e){return J.get(e)}function kt(e,t,n){let r=J.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 At=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),jt=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),Mt=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),Nt=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Pt=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function Y(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function X(e){let t=Y(e);return t===void 0?void 0:At.format(t)}function Ft(e){let t=Y(e);return t===void 0?void 0:jt.format(t)}var Z=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function It(e){let t=Y(e);return t===void 0?void 0:Z(t)}function Lt(e,t=new Date){let n=Y(e);if(n===void 0)return;let r=Z(n);return r===Z(t)?`Today`:r===Z(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?Mt:Nt).format(n)}function Rt(e,t){let n=Y(e),r=Y(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 zt({ts:e}){let t=X(e);return t===void 0?null:(0,B.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:Ft(e),className:`text-xs leading-none text-soft-foreground`,children:t})}function Bt({startedAt:e,completedAt:t}){let n=X(t);if(n===void 0)return null;let r=Rt(e,t);return(0,B.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,B.jsx)(`time`,{dateTime:t,title:Ft(t),children:n}),r===void 0?null:(0,B.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function Vt({ts:e}){let t=Lt(e),n=Y(e);if(t===void 0||n===void 0)return null;let r=Pt.format(n);return(0,B.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,B.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,B.jsx)(`time`,{dateTime:It(e),title:r,children:t}),(0,B.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var Ht={assistant:`Agent message`,error:`Runner error`,"session.error":`Session error`,"step-end":`Step status`,lifecycle:`Run status`};function Ut({note:e}){return e.icon===`handoff`?(0,B.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,B.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,B.jsx)(be,{className:`size-3`})}),(0,B.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):e.details&&e.details.length>0?(0,B.jsxs)(F,{"data-slot":`note-line`,"data-tone":e.tone,className:`group/failure min-w-0 px-0.5 text-xs`,children:[(0,B.jsxs)(`div`,{className:a(`flex items-start gap-2`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[(0,B.jsxs)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap wrap-anywhere`,children:[e.tone===`danger`?`✗ `:null,e.text]}),(0,B.jsxs)(P,{"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,B.jsx)(O,{"aria-hidden":`true`,className:`size-3 shrink-0 motion-safe:transition-transform group-data-[state=open]/failure:rotate-90`}),`Details`]})]}),(0,B.jsx)(N,{children:(0,B.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,B.jsxs)(`li`,{className:`min-w-0 whitespace-pre-wrap wrap-anywhere`,children:[(0,B.jsxs)(`span`,{className:`font-sans font-medium text-foreground`,children:[Ht[e.source],`:`,` `]}),e.text]},`${e.source}:${t}`))})})]}):(0,B.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:a(`px-0.5 text-xs`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:null,e.text]})}var Wt={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 Q({role:e,children:t,className:n,ts:r,headerActions:i,...o}){let s=Wt[e],c=r===void 0?void 0:X(r);return(0,B.jsxs)(`article`,{...o,"data-role":e,"aria-label":s.speaker,className:a(`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,B.jsxs)(`p`,{className:a(`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,B.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,B.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,B.jsx)(pe,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),i]}),c===void 0?null:(0,B.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,B.jsx)(zt,{ts:r})})]}),(0,B.jsx)(`div`,{className:a(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,s.body,`leading-[1.6]`),children:t})]})}var Gt=[],Kt=(0,z.memo)(function({text:e,imageCount:t=0,images:n=Gt,ts:i,onEdit:a,onRemove:o,editLabel:s=`Edit message`,removeLabel:c=`Remove message`,children:l}){let u=t-n.length,[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(e),[h,g]=(0,z.useState)(!1),[_,v]=(0,z.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,B.jsxs)(Q,{role:`user`,ts:i,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,B.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,B.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,B.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,B.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,B.jsx)(j,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,B.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,B.jsxs)(Q,{role:`user`,ts:i,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,B.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,B.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,B.jsx)(Be,{className:`size-3.5`})}):null,o?(0,B.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,B.jsx)(ae,{className:`size-3.5`})}):null]}):null,_?(0,B.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,l??(0,B.jsx)(L,{breaks:!0,children:e}),n.length>0?(0,B.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,B.jsx)(je,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,B.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,B.jsx)(re,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,B.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,B.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null]})}),qt=`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`,Jt=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function Yt(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Jt).forEach(e=>e.remove());let r=$e(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||!H(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 Xt(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=Yt(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 Zt=(0,z.memo)(function({text:e,ts:t,messageKey:n}){let r=(0,z.useRef)(null),[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(null),c=(0,z.useRef)(null);(0,z.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await Xt(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,B.jsxs)(Q,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,B.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,B.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:qt,children:[(0,B.jsx)(le,{className:`size-3.5`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,B.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:qt,children:[(0,B.jsx)(De,{className:`size-3.5`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,B.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,B.jsx)(`div`,{ref:r,children:(0,B.jsx)(L,{breaks:!0,children:e})}),(0,B.jsx)(rt,{text:e,messageKey:n})]})});function Qt({incident:e}){let t=g().data;if(!t)return null;let n=d(t,e.provider);return(0,B.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,B.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,B.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,B.jsx)(I,{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 $t=(0,z.memo)(function({text:e}){let t=(0,z.useId)();if(e.trim()===``)return null;let n=e.split(`
|
|
2
|
-
`,1)[0]??``,r=n.length<e.length;return(0,B.jsxs)(F,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,B.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,B.jsx)(O,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,B.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,B.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,B.jsx)(L,{inline:!0,children:n})}),r?(0,B.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,B.jsx)(P,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,B.jsx)(N,{children:(0,B.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,B.jsx)(L,{children:e})})})]})});function en(){return(0,B.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,B.jsx)(j,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,B.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var tn={read:De,edit:Be,delete:ae,move:ze,search:ie,execute:ge,think:Le,fetch:fe,task:ce,plan:te,other:se},nn=e=>e.split(`
|
|
3
|
-
`).length;function rn({text:e,streaming:t}){let[n,r]=(0,z.useState)(!1),i=(0,z.useRef)(null),o=(0,z.useRef)(!0);(0,z.useEffect)(()=>{let e=i.current;t&&e&&o.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let s=nn(e),c=!t&&!n&&s>12;return(0,B.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":c?`true`:void 0,children:[(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(`div`,{ref:i,onScroll:t?e=>{o.current=St(e.currentTarget)}:void 0,className:a(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,c&&`max-h-[216px] overflow-y-hidden`),children:(0,B.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),c?(0,B.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,B.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 an({diffs:e}){return(0,B.jsx)(B.Fragment,{children:e.map((e,t)=>(0,B.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,B.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,B.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...on(e.oldText).map((e,t)=>(0,B.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...on(e.newText).map((e,t)=>(0,B.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
|
|
4
|
-
`).map((e,t)=>(0,B.jsx)(sn,{text:e},t))})]},`${e.path}:${t}`))})}function on(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
|
|
5
|
-
`)}function sn({text:e}){return(0,B.jsx)(`span`,{className:a(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function cn(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function ln(e){let t=e.status===`running`||e.status===`pending`,n=ft(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`?Ye(e.input):me(e.name).toolKind===e.toolKind?he(e.name,e.input):void 0)??i,Icon:tn[e.toolKind]??se}}function un(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 dn({item:e,busy:t}){return(0,B.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[t?(0,B.jsx)(j,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,B.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,B.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,B.jsx)(`span`,{"data-slot":`tool-exit`,className:a(`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 fn({item:e,command:t,busy:n,nested:r,cacheKey:i,renderNested:a}){return(0,B.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[t===void 0?null:(0,B.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,B.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,B.jsx)(an,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,B.jsx)(rn,{text:e.output,streaming:n}):null,r.length>0?(0,B.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 pn({item:e,nested:t=[],cacheKey:n,renderNested:r}){let i=q(),[o,s]=(0,z.useState)(()=>n===void 0?null:i?.get(n)??null),c=e=>{n!==void 0&&i?.set(n,e),s(e)},{busy:l,verb:u,detail:d,expandedCommand:f,Icon:p}=ln(e),m=un(e,t.length),h=f!==void 0||m,g=h&&(o??(m&&cn(e)));return(0,B.jsxs)(F,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:g,onOpenChange:c,className:a(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,B.jsxs)(P,{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,B.jsx)(O,{"aria-hidden":!0,className:a(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!h&&`invisible`)}),(0,B.jsx)(p,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,B.jsx)(`span`,{className:a(`shrink-0 font-semibold`,l&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:u}),d===void 0?null:(0,B.jsx)(`code`,{title:d,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:d}),(0,B.jsx)(dn,{item:e,busy:l})]}),(0,B.jsx)(N,{children:(0,B.jsx)(fn,{item:e,command:f,busy:l,nested:t,cacheKey:n,renderNested:r})})]})}function mn(e){let t=e.name??e.event,n=t.indexOf(`:`);return n>0?`${t.slice(0,n)} · ${t.slice(n+1)}`:t}function hn({item:e,cacheKey:t}){let n=q(),[r,i]=(0,z.useState)(()=>t===void 0?!1:n?.get(t)??!1),o=e=>{t!==void 0&&n?.set(t,e),i(e)},s=e.status!==`completed`,c=e.entries.some(e=>e.kind===`context`),l=(e.stdout??``)!==``||(e.stderr??``)!==``,u=mn(e);return(0,B.jsxs)(F,{"data-slot":`hook-card`,"data-status":e.status,open:r,onOpenChange:o,className:a(`min-w-0 overflow-hidden rounded-md border bg-card`,s?`border-danger/25`:`border-border`),children:[(0,B.jsxs)(P,{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,B.jsx)(O,{"aria-hidden":!0,className:`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),(0,B.jsx)(Ie,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Hook`}),(0,B.jsx)(`code`,{title:u,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:u}),(0,B.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[s?(0,B.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.status}):c?(0,B.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`context`}):null,s&&typeof e.exitCode==`number`&&e.exitCode!==0?(0,B.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,B.jsx)(N,{children:(0,B.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.entries.map((e,t)=>(0,B.jsx)(`pre`,{"data-slot":`hook-entry`,"data-kind":e.kind,className:a(`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,B.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,B.jsxs)(F,{className:`border-t border-border`,children:[(0,B.jsxs)(P,{"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,B.jsx)(O,{"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,B.jsxs)(N,{children:[e.stdout?(0,B.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,B.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,B.jsxs)(F,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,B.jsxs)(P,{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,B.jsx)(O,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,B.jsx)(N,{children:(0,B.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,B.jsx)(pn,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function _n({count:e,children:t}){return(0,B.jsxs)(F,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,B.jsxs)(P,{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,B.jsx)(O,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),ut(e)]}),(0,B.jsx)(N,{children:(0,B.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function vn({image:e}){return(0,B.jsx)(je,{"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 yn={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 bn(e,t,n){return`${e.header}: ${n?.trim()||t.join(`, `)}`}function xn({ask:e,run:t,projectId:n,onShowOrigin:r,onAnswered:i}){let a=e.context?(0,B.jsx)(Cn,{text:e.context}):null;if(e.resolved)return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[a,(0,B.jsxs)(Q,{role:`user`,"data-slot":`ask-card`,"data-resolved":`true`,children:[(0,B.jsx)(`span`,{className:`text-soft-foreground`,children:e.closed?yn[e.closed]:e.answeredBy===`parent`?`Answered by parent`:`Answered`}),(0,B.jsx)(We,{ask:e})]})]});let o=e.placement===`pinned`&&r?r:void 0;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[a,e.routedToParent?(0,B.jsx)(wn,{ask:e,onShowOrigin:o}):(0,B.jsx)(Tn,{ask:e,run:t,projectId:n,onShowOrigin:o,onAnswered:i})]})}function Sn({onShowOrigin:e,className:t}){return(0,B.jsx)(M,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-origin`,className:a(`mbs-2 min-h-11 min-w-11 px-2 text-xs font-medium text-muted-foreground underline underline-offset-4`,t),onClick:e,children:`Show where it was asked`})}function Cn({text:e}){return(0,B.jsx)(Q,{role:`agent`,children:(0,B.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`break-words text-sm text-foreground`,children:(0,B.jsx)(L,{breaks:!0,children:e})})})}function wn({ask:e,onShowOrigin:t}){return(0,B.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-routed":`parent`,className:`rounded-lg border border-card-edge bg-card shadow-card px-3 py-2`,children:[(0,B.jsx)(`div`,{className:`mb-2.5 flex items-center gap-2`,children:(0,B.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking its parent`})}),(0,B.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.questions.map((e,t)=>(0,B.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,B.jsx)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:(0,B.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,B.jsx)(`p`,{className:`mb-1.5 break-words text-sm font-semibold text-foreground`,children:e.question}),e.options?(0,B.jsx)(`ul`,{className:`flex list-disc flex-col gap-0.5 pl-5 text-[13px] text-muted-foreground`,children:e.options.map(e=>(0,B.jsxs)(`li`,{className:`break-words`,children:[(0,B.jsx)(`span`,{className:`text-foreground`,children:e.label}),e.description?(0,B.jsxs)(`span`,{children:[`: `,e.description]}):null]},e.label))}):(0,B.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,B.jsxs)(`p`,{"data-slot":`ask-routed-hint`,className:`mt-3 text-xs text-muted-foreground`,children:[`Routed to parent: answer it in the`,` `,e.parentRunId?(0,B.jsx)(I,{to:`/tasks/${e.parentRunId}`,className:`font-medium text-foreground underline underline-offset-4`,children:`parent task`}):`parent task`,`.`]}),t?(0,B.jsx)(Sn,{onShowOrigin:t}):null]})}function Tn({ask:e,run:t,projectId:n,onShowOrigin:r,onAnswered:i}){let o=we(t,n),s=o.blockedBy!==void 0,c=e.questions,l=c.length===1&&c[0]?.options!==void 0&&c[0]?.multiSelect!==!0,[u,d]=(0,z.useState)({}),[f,p]=(0,z.useState)({}),m=(e,t)=>d(n=>({...n,[e]:t})),h=e=>p(t=>{if(t[e]===void 0)return t;let n={...t};return delete n[e],n}),g=e=>{m(e,[]),p(t=>({...t,[e]:t[e]??``}))},_=c.some((e,t)=>!e.options||f[t]!==void 0),v=c.every((e,t)=>(u[t]?.length??0)>0||!!f[t]?.trim()),y=async e=>{await o.send(e)===void 0&&i?.()},b=()=>void y(c.map((e,t)=>bn(e,u[t]??[],f[t])).join(`
|
|
6
|
-
`)),x=o.mode===`resume`;return(0,B.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-delivery":o.mode,className:`rounded-lg border border-accent-strong/25 bg-accent-strong/[0.04] [html:not(.light)_&]:bg-card px-3 pt-4 pb-2.5 max-sm:pt-3 max-sm:pb-1`,children:[(0,B.jsx)(`div`,{className:`mb-1.5 flex items-center gap-2`,children:(0,B.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking`})}),(0,B.jsx)(`div`,{className:`flex flex-col gap-2`,children:c.map((e,t)=>(0,B.jsx)(An,{question:e,disabled:o.isPending||s,selected:u[t]??[],isOther:f[t]!==void 0,otherAnswer:f[t]??``,onSelect:n=>{s||(h(t),l?y(bn(e,n)):m(t,n))},onOtherToggle:()=>{s||(f[t]===void 0?g(t):h(t))},onOtherChange:e=>p(n=>({...n,[t]:e}))},e.id??t))}),(0,B.jsxs)(`div`,{"data-slot":`ask-footer`,className:`max-sm:mbs-2 max-sm:flex max-sm:flex-wrap max-sm:items-center max-sm:gap-x-2.5`,children:[(0,B.jsx)(Dn,{oneTap:l,hasOtherAnswer:_,resuming:x,disabled:o.isPending||s||!v,questionCount:c.length,onSend:b}),o.blockedBy===`provider`?(0,B.jsxs)(`div`,{"data-slot":`ask-provider-gate`,className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground max-sm:order-4 max-sm:basis-full`,children:[(0,B.jsx)(`span`,{children:o.reason}),(0,B.jsx)(I,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,o.blockedBy===`no-session`?(0,B.jsx)(`p`,{"data-slot":`ask-no-session`,className:`mt-3 text-xs text-muted-foreground max-sm:order-4 max-sm:basis-full`,children:o.reason}):null,o.error?(0,B.jsx)(`p`,{"data-slot":`ask-error`,role:`alert`,className:`mt-3 text-xs text-danger max-sm:order-4 max-sm:basis-full`,children:o.error}):null,r?(0,B.jsx)(Sn,{onShowOrigin:r,className:a(`max-sm:order-2 max-sm:mbs-0`,En(l,_)&&`max-sm:ms-auto`)}):null]})]})}var En=(e,t)=>!e||t;function Dn({oneTap:e,hasOtherAnswer:t,resuming:n,disabled:r,questionCount:i,onSend:a}){return En(e,t)?(0,B.jsxs)(`div`,{className:`mbs-2 flex flex-wrap items-center gap-x-2.5 max-sm:contents`,children:[(0,B.jsx)(M,{size:`sm`,className:`min-h-11 max-sm:order-1`,disabled:r,onClick:a,children:n?`Send answer & reopen`:`Send answer`}),n?(0,B.jsx)(`span`,{"data-slot":`ask-resume-hint`,className:`text-xs text-soft-foreground max-sm:order-3 max-sm:basis-full`,children:`the session has ended — sending reopens it`}):(0,B.jsxs)(`span`,{"data-slot":`ask-hint`,className:`inline-flex flex-wrap items-center gap-x-1 text-xs text-soft-foreground max-sm:order-3 max-sm:basis-full`,children:[(0,B.jsx)(`span`,{children:t?`${i>1?`answer each question above`:`enter your answer above`} — or`:`${i>1?`answer each question`:`pick one or more`} — or`}),(0,B.jsx)(kn,{})]})]}):n?(0,B.jsx)(`p`,{"data-slot":`ask-resume-hint`,className:`mbs-3 text-xs text-soft-foreground max-sm:order-3 max-sm:basis-full`,children:`The session has ended — your answer reopens it and goes to the agent.`}):null}function On(e){return(e.closest(`[data-route="task-thread"]`)??document).querySelector(`[data-slot="thread-dock"] [data-slot="composer-editor"] textarea`)}function kn(){return(0,B.jsx)(`button`,{type:`button`,"data-slot":`ask-reply-jump`,className:`min-h-11 rounded-sm font-medium text-foreground underline underline-offset-4 hover:text-link-foreground focus-visible:outline-2 focus-visible:outline-ring`,onClick:e=>{let t=On(e.currentTarget);if(!t)return;let n=typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;t.scrollIntoView?.({behavior:n?`auto`:`smooth`,block:`center`}),t.focus({preventScroll:!0})},children:`type a reply below`})}function An({question:e,disabled:t,selected:n,isOther:r,otherAnswer:i,onSelect:o,onOtherToggle:s,onOtherChange:c}){let l=(0,z.useId)(),u=e.options,d=u!==void 0&&e.multiSelect===!0,f=e=>{if(!d){o([e]);return}o(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,B.jsxs)(`div`,{"data-slot":`ask-question`,role:`group`,"aria-label":e.question,children:[(0,B.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,B.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,B.jsx)(`p`,{className:`min-w-0 flex-1 break-words text-sm font-semibold text-foreground`,children:e.question}),d?(0,B.jsx)(`span`,{className:`ml-auto text-xs text-soft-foreground`,children:`select all that apply`}):null]}),u?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{"data-slot":`ask-options`,className:`grid grid-cols-1 gap-1 sm:grid-cols-2 sm:gap-2`,children:[u.map(e=>{let r=n.includes(e.label);return(0,B.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>f(e.label),className:a(`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 text-left transition-colors sm:py-1.5`,`hover:border-accent-strong/50 hover:bg-accent-strong/[0.06] [html:not(.light)_&]:hover:bg-card disabled:pointer-events-none disabled:opacity-50`,r?`border-accent-strong/60 bg-accent-strong/[0.06] [html:not(.light)_&]:bg-card`:`border-border bg-card`),children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13px] font-semibold text-foreground`,children:[d?(0,B.jsx)(`span`,{"aria-hidden":!0,className:a(`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,B.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,B.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)}),e.allowFreeText===!1?null:(0,B.jsx)(M,{type:`button`,variant:`outline`,"aria-pressed":r,"aria-expanded":r,"aria-controls":r?l:void 0,disabled:t,onClick:s,className:a(`h-auto min-h-11 w-full justify-start px-2.5 py-1 text-left sm:py-1.5`,u.length%2==0&&`sm:col-span-2`,r&&`border-accent-strong/60 bg-accent-strong/[0.06] [html:not(.light)_&]:bg-card`),children:`Other`})]}),e.allowFreeText!==!1&&r?(0,B.jsxs)(`div`,{className:`mt-2`,children:[(0,B.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,B.jsx)(R,{id:l,rows:2,value:i,disabled:t,onChange:e=>c(e.target.value),className:`bg-card`})]}):null]}):(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,B.jsx)(R,{id:l,rows:2,value:i,disabled:t,onChange:e=>c(e.target.value),className:`bg-card`})]})]})}var jn=/^diff --git /;function Mn(e){let t=e.replace(jn,``),n=t.lastIndexOf(` b/`);return $(n>=0?t.slice(n+3):t)}function $(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1).replace(/\\(.)/g,`$1`):t}function Nn(e){let t=$(e.slice(4));if(t!==`/dev/null`)return t.replace(/^[ab]\//,``)}function Pn(e){return{path:Mn(e),status:`modified`,binary:!1,additions:0,deletions:0,lines:[]}}function Fn(e,t){if(t.startsWith(`rename from `))e.status=`renamed`,e.oldPath=$(t.slice(12));else if(t.startsWith(`rename to `))e.status=`renamed`,e.path=$(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=Nn(t);n!==void 0&&(e.path=n)}else if(t.startsWith(`--- `)){let n=Nn(t);n!==void 0&&e.status===`deleted`&&(e.path=n)}}function In(e,t){e.lines.push(t),t.startsWith(`+`)?e.additions+=1:t.startsWith(`-`)&&(e.deletions+=1)}function Ln(e){let t=[],n=null,r=!1;for(let i of e.split(`
|
|
7
|
-
`)){if(jn.test(i)){n=Pn(i),t.push(n),r=!1;continue}if(n){if(!r){i.startsWith(`@@`)?(r=!0,n.lines.push(i)):Fn(n,i);continue}In(n,i)}}let i=t.at(-1);return i&&i.lines.at(-1)===``&&i.lines.pop(),t}function Rn(e){return{files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}}var zn=20,Bn=300;function Vn({runId:e,projectId:t}){let n=x(),r=o(e,t);(0,z.useEffect)(()=>{let r=t?[t,`runs`,`diff`,e]:u.runs.diff(e);n.invalidateQueries({queryKey:r})},[t,n,e]);let i=(0,z.useMemo)(()=>Ln(r.data??``),[r.data]),[a,s]=(0,z.useState)(!1);if(r.isPending)return(0,B.jsx)(`p`,{className:`px-1 text-xs text-soft-foreground`,children:`Loading diff…`});if(r.isError)return(0,B.jsx)(`p`,{className:`px-1 text-xs text-danger`,children:r.error.message});if(i.length===0)return(0,B.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=Rn(i),l=a?i:i.slice(0,zn);return(0,B.jsxs)(`div`,{"data-slot":`run-diff`,className:`flex min-w-0 flex-col gap-2`,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,B.jsxs)(`span`,{children:[c.files,` `,c.files===1?`file`:`files`,` changed`]}),(0,B.jsxs)(`span`,{className:`font-mono font-semibold tabular-nums`,children:[(0,B.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,c.additions]}),` `,(0,B.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,c.deletions]})]})]}),l.map(e=>(0,B.jsx)(Un,{file:e},`${e.oldPath??``}→${e.path}`)),i.length>l.length?(0,B.jsxs)(M,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>s(!0),children:[`Show `,i.length-l.length,` more files`]}):null]})}var Hn={added:`added`,deleted:`deleted`,renamed:`renamed`};function Un({file:e}){let[t,n]=(0,z.useState)(!0),r=Hn[e.status],i=e.oldPath?`${e.oldPath} → ${e.path}`:e.path;return(0,B.jsxs)(F,{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,B.jsxs)(P,{className:`flex w-full items-start gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,B.jsx)(ue,{className:a(`mbs-[1px] size-3.5 shrink-0 text-soft-foreground motion-safe:transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,B.jsx)(`span`,{"data-slot":`diff-file-path`,title:i,className:`min-w-0 wrap-anywhere font-mono text-xs font-medium`,children:e.oldPath?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),r?(0,B.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,B.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,B.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-xs font-semibold tabular-nums`,children:[(0,B.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,e.additions]}),` `,(0,B.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,e.deletions]})]})]}),(0,B.jsx)(N,{children:(0,B.jsx)(`div`,{className:`border-t border-border/50`,children:e.binary?(0,B.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.lines.length===0?(0,B.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,B.jsx)(Wn,{lines:e.lines})})})]})}function Wn({lines:e}){let[t,n]=(0,z.useState)(!1),r=t?e:e.slice(0,Bn),i=r.join(`
|
|
8
|
-
`),[o,s]=(0,z.useState)(null);(0,z.useEffect)(()=>{let e=!1;return Ae(i,`diff`).then(t=>{e||s({text:i,tokens:t.tokens})}),()=>{e=!0}},[i]);let c=o?.text===i?o.tokens:ke(i,`diff`)?.tokens??null;return(0,B.jsxs)(B.Fragment,{children:[(0,B.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,B.jsxs)(`span`,{"data-line":e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:void 0,className:a(`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,B.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),e===``?` `:``]},t))}),e.length>Bn?(0,B.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 Gn(e,t,n,r){return _e(e,t)?.runner??e.runner??(t||n?r:void 0)??`claude`}function Kn(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 qn(e,t,n,r,i){if(!e)return t!==null||!n||r?i:void 0}function Jn(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 Yn(){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 Xn(e,t=null,n){let{registered:r,providersPending:i,providersError:a,providersReady:o}=Yn(),c=p(n),l=Oe(e),u=e.removedRunner!==void 0,d=l&&!e.runner||u,m=Ee(n),h=e.delegation?.role===`worker`,g=c.data?.defaultRunner,_=Gn(e,l,u,f(g,s(r.data))??g),v=(t,n)=>Te(e,t,m.repoAccount,{original:_,target:n},l),{runners:y,signedOut:b}=m.runnersOn(e=>v(e,e)),x=h?_:Ce(t,y,_),S=y.includes(_),ee=l?w(e.workflowDef,x,s(r.data)):[x],C=l&&h&&e.workflowDef?Kn(e,x,m):ee.filter(e=>!m.readyOn(e,v(e,x))),T=o&&(!d||c.isSuccess)&&C.length===0,E=Jn({needsConfig:d,configPending:c.isPending,configError:c.isError,providersPending:i,providersError:a,canContinue:T,untouched:l,missing:C});return{runners:y,signedOut:b,currentRunner:_,runner:x,currentRunnerConnected:S,canContinue:T,providerPending:i||d&&c.isPending,providerError:a,reason:E,runnerOverride:qn(h,t,S,u,x)}}function Zn(e,t){let n=x();return m({mutationFn:()=>C(e,t?.projectId),onSuccess:()=>{n.invalidateQueries({queryKey:u.runs.all}),t?.onSuccess?.()},onError:e=>S(e.message,{tone:`danger`})})}function Qn({run:e,projectId:t,onResolved:n}){return(0,B.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-2.5`,children:[(0,B.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex flex-col gap-2 rounded-md border border-info/35 bg-info/10 px-3.5 py-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,B.jsx)(A,{className:`size-4 shrink-0 text-semantic-info`,"aria-hidden":`true`}),(0,B.jsxs)(`p`,{className:`min-w-0 break-words text-[13px] leading-relaxed`,children:[(0,B.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,B.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,B.jsx)($n,{run:e,projectId:t,onResolved:n})]}),(0,B.jsx)(Vn,{runId:e.id,projectId:t})]})}function $n({run:e,projectId:t,onResolved:n}){let r=h(),a=x(),o=(0,z.useRef)(null),[s,c]=(0,z.useState)(``),[l,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(null),g=Zn(e.id,{projectId:t,onSuccess:n}),b=Xn(e,null,t),C=()=>a.invalidateQueries({queryKey:u.runs.all}),w=m({mutationFn:async n=>b.canContinue?ee(_(e.id,{projectId:t}),{text:`Review feedback:\n${n}`,runner:b.runnerOverride}):null,onMutate:()=>_(e.id,{projectId:t}),onSuccess:(e,t,i)=>{e!==null&&(c(``),r.invalidateAfter(`continue`,i),n?.())},onError:e=>S(e.message,{tone:`danger`})}),T=m({mutationFn:()=>y(e.id,t),onSuccess:e=>{S(`Draft PR created — ${e.url}`),C(),n?.()},onError:e=>{e instanceof v&&e.manual!==void 0&&p(e.manual),S(e.message,{tone:`danger`})}});(0,z.useEffect)(()=>{l&&o.current?.focus()},[l]);let D=()=>{if(!l){d(!0);return}let e=s.trim();if(e.length===0){S(`Write what to change first.`),o.current?.focus();return}w.mutate(e)};return(0,B.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[b.canContinue?null:(0,B.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,B.jsx)(`span`,{children:b.reason}),b.providerPending?null:(0,B.jsx)(I,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 [&_button]:min-h-11 [&_a]:min-h-11`,children:[(0,B.jsx)(M,{asChild:!0,variant:`outline`,size:`sm`,children:t?(0,B.jsxs)(E,{to:`/p/${encodeURIComponent(t)}/tasks/${encodeURIComponent(e.id)}/changes`,children:[(0,B.jsx)(A,{"aria-hidden":`true`}),`Review changes`]}):(0,B.jsxs)(I,{to:`/tasks/${e.id}/changes`,children:[(0,B.jsx)(A,{"aria-hidden":`true`}),`Review changes`]})}),(0,B.jsxs)(M,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:b.reason??(l?`Send the notes back into the agent's session`:`Write notes for the agent`),"aria-describedby":b.canContinue?void 0:`review-provider-guidance`,"aria-expanded":l,"aria-controls":l?`review-notes`:void 0,disabled:w.isPending||!b.canContinue,onClick:D,children:[(0,B.jsx)(Re,{"aria-hidden":`true`}),l?`Send back with notes`:`Send back`]}),i(e.pullRequestUrl)?(0,B.jsx)(M,{asChild:!0,variant:`outline`,size:`sm`,children:(0,B.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,B.jsx)(de,{"aria-hidden":`true`}),`PR ↗`]})}):(0,B.jsxs)(M,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:T.isPending,onClick:()=>T.mutate(),children:[(0,B.jsx)(ne,{"aria-hidden":`true`}),`Draft PR`]}),e.finishBlocked===null?(0,B.jsxs)(M,{"data-slot":`review-accept`,variant:`primary`,size:`sm`,className:`[margin-inline-start:auto]`,title:xe(`review`),disabled:g.isPending,onClick:()=>g.mutate(),children:[(0,B.jsx)(oe,{"aria-hidden":`true`}),`Accept`]}):null]}),l?(0,B.jsx)(R,{ref:o,id:`review-notes`,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,placeholder:`Notes for the agent — what should change?`,rows:1,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{Se({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(),D())},className:`min-h-11 text-base md:text-[13px]`}):null,f===null?null:(0,B.jsx)(er,{command:f})]})}function er({command:e}){return(0,B.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,B.jsx)(le,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,B.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function tr(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var nr=1500;function rr({status:e}){let t=(0,z.useRef)(e),[n,r]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||tr())return;r(!0);let i=setTimeout(()=>r(!1),nr);return()=>clearTimeout(i)},[e]),n?(0,B.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,B.jsx)(ye,{}),(0,B.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,B.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{Tt as A,U as B,bt as C,kt as D,Ot as E,mt as F,We as H,ft as I,ot as L,Ct as M,vt as N,Et as O,q as P,tt as R,It as S,yt as T,nt as V,Ut as _,xn as a,Bt as b,gn as c,Qt as d,$t as f,en as g,Kt as h,Xn as i,xt as j,Dt as k,hn as l,_n as m,Qn as n,Cn as o,pn as p,Zn as r,Zt as s,rr as t,vn as u,Vt as v,St as w,X as x,zt as y,et as z};
|
|
@@ -1,2 +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{n as r,t as i}from"./utils-DSMR_WLb.js";import{Ct as a,G as o,H as s,K as c,St as l,U as u,W as d,Wt as f,Y as p,dn as m,f as h,ln as g,lt as _,rn as v,rt as ee,tt as y,un as te,xt as b,yt as ne}from"./queries-ClkIgWFx.js";import{An as re,Fn as x,It as ie,Lt as ae,cr as oe,hi as S,n as C,or as se,tt as ce,ut as le,yr as ue}from"./toaster-C-xqAWVX.js";import{d as de,h as fe}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{a as pe,d as me,f as he,g as ge,m as _e,o as ve,p as ye,s as be}from"./tasks-table-BkjZYg2J.js";import{F as xe,at as Se,ft as Ce,i as we,l as Te,p as Ee,q as De,t as Oe,v as w,x as ke}from"./design-icons-CzEoMH9c.js";import{t as T}from"./createLucideIcon-BHp8sXmF.js";import{t as Ae}from"./app-window-CSHwDX9N.js";import{n as je,r as Me,t as Ne}from"./open-in-menu-N8rXgYSG.js";import{t as Pe}from"./info-DA1x_4bz.js";import{t as Fe}from"./message-square-B-MD-8rD.js";import{i as Ie,n as Le,t as E}from"./reference-chip-B8bfD56G.js";import{t as Re}from"./square-terminal-B6RYYieR.js";import{t as D}from"./button-B7MKxYjT.js";import{a as O,i as k,l as A,n as j,p as M,r as N,t as P}from"./dropdown-menu-4e2iKSMT.js";import{i as ze,r as Be,t as Ve}from"./popover-BPgUYFyu.js";import{a as He,i as Ue,o as We,r as Ge,s as Ke,t as qe}from"./dialog-B531GGAo.js";import{c as Je,s as Ye,t as F}from"./project-router-CT6gVIcC.js";import"./attention--Y0CyzCN.js";import{T as Xe,f as I,u as Ze}from"./task-groups-aquji1Kv.js";import{t as Qe}from"./status-dot-BRzVlF2X.js";import{t as $e}from"./format-BU7D3IfE.js";import{$n as L,Bt as R,En as et,Gt as z,Hn as B,Ht as V,I as tt,Kt as H,L as U,Qt as nt,R as rt,Un as it,Ut as at,Vn as ot,Vt as st,Wt as ct,Xt as lt,a as ut,er as dt,fr as ft,gn as pt,ir as mt,m as ht,nn as gt,o as _t,on as W,qt as vt,r as G,sn as K,vn as q}from"./index-BX94wp6m.js";import{r as yt,t as bt}from"./markdown-DK1FZN4x.js";import{t as xt}from"./textarea-vJt9undk.js";import{t as J}from"./tab-link-BMblA2WK.js";var St=T(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),Ct=T(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),wt=T(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),Y=e(t(),1),X=n();function Tt(e){let t=_();return m({mutationFn:t=>ce(te(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>g()),onError:e=>C(e.message,{tone:`danger`})})}function Et(e){return e.archived?`Unarchive`:`Archive task`}function Dt({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,X.jsx)(R,{open:t,onOpenChange:n,children:(0,X.jsxs)(at,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(H,{children:[(0,X.jsx)(vt,{children:`Archive task?`}),(0,X.jsxs)(ct,{children:[`Move “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:I(e),children:I(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,X.jsxs)(z,{children:[(0,X.jsx)(V,{children:`Cancel`}),(0,X.jsx)(st,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function Ot({run:e,className:t}){let[n,r]=(0,Y.useState)(!1),a=Tt(e.id),o=Et(e);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(D,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":o,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:a.isPending,className:i(`h-11 gap-[7px] px-3`,t),onClick:()=>e.archived?a.mutate(!1):r(!0),children:[e.archived?(0,X.jsx)(ft,{"aria-hidden":`true`}):(0,X.jsx)(Oe,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:o})]}),(0,X.jsx)(Dt,{run:e,open:n,onOpenChange:r,onConfirm:()=>{a.mutate(!0),r(!1)}})]})}function kt({run:e,action:t,prUrl:n,patch:i}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:t.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,t.message||(t.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&r(n)?(0,X.jsx)(D,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,X.jsx)(D,{variant:`outline`,disabled:i.isPending,onClick:()=>i.mutate({autoMergePr:!1},{onError:e=>C(e.message,{tone:`danger`})}),children:i.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function At({run:e,blocker:t,flags:n}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,X.jsx)(D,{variant:`outline`,asChild:!0,children:(0,X.jsx)(F,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&r(t.pullRequestUrl)?(0,X.jsx)(D,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,X.jsx)(Ot,{run:e}):null]})]})}function jt({run:e}){let t=o(e.id),n=K(e),r=e.status===`done`?e.completionAction:void 0,i=n.archive?e.archiveBlocker:void 0,a=r&&r.phase!==`complete`?r:void 0;if(!a&&!i)return null;let s=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,X.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-card-edge bg-card p-3 shadow-card [margin-block:0.75rem]`,children:[a?(0,X.jsx)(kt,{run:e,action:a,prUrl:s,patch:t}):null,i?(0,X.jsx)(At,{run:e,blocker:i,flags:n}):null]})}var Mt=[`running`,`queued`,`waiting`];function Nt(e,{queuePosition:t,now:n=new Date}){let r=re(e),i=et(e,r).label,a=t===void 0?i:`${i} #${t}`,o=Mt.includes(e.status)?Ft(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Pt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Ft(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:$e(n,t)}}async function Z(e,t){try{await navigator.clipboard.writeText(e),C(t)}catch{C(`Run manually: ${e}`)}}function It(e){let t=b(),n=h(),r=(0,Y.useMemo)(()=>ge(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,Y.useMemo)(()=>n===void 0?[]:r.filter(e=>pe(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function Lt(e){return m({mutationFn:()=>ae(e.id),onError:e=>{if(e instanceof x&&e.command){Z(e.command,`No terminal found — command copied to clipboard.`);return}C(e.message,{tone:`danger`})}})}function Q(e,t){let n=d(),r=a(),i=v(),o=m({mutationFn:t=>ie(e.id,t),onError:e=>C(e.message,{tone:`danger`})}),s=pt(),c=Xe(e),l=s.runnersOn(e=>t&&c.sessionId!==void 0&&e===c.backend?c.profileId??`default`:s.repoAccount?.[e]).runners,u=e=>!r.isSuccess||!i.isSuccess||l.includes(e??`claude`);return{canResumeHere:t&&u(gt(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=je(e.id);return t===void 0||i.isSuccess&&u(t)}).map(t=>({target:t,...nt(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:o}}function Rt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),o=v().data,s=W(e);return!r&&i.length===0&&!s?null:(0,X.jsxs)(X.Fragment,{children:[r||i.length>0?(0,X.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,X.jsxs)(D,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,X.jsx)(Re,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=Me(e,o);return(0,X.jsxs)(D,{variant:`outline`,"data-target":e.id,title:n,disabled:a.isPending,onClick:()=>a.mutate(e.id),children:[(0,X.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,X.jsxs)(D,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>C(`Worktree path copied`)).catch(()=>C(`Path: ${t}`))},children:[(0,X.jsx)(w,{}),`Copy worktree path`]}):null]}):null,s?(0,X.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,X.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,X.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,X.jsxs)(D,{variant:`outline`,onClick:()=>void Z(s,`Command copied to clipboard.`),children:[(0,X.jsx)(w,{}),`Copy resume command`]})]}):null]})}function zt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),o=W(e),s=e.worktreePath;if(!r&&i.length===0&&!o&&!s)return null;let c=`max-md:min-h-11`;return(0,X.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,X.jsx)(Ne,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,className:c,leading:r?(0,X.jsxs)(k,{"data-target":`terminal-resume`,onSelect:n,children:[(0,X.jsx)(Re,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,s?(0,X.jsxs)(D,{variant:`outline`,size:`sm`,className:c,onClick:()=>void Z(s,`Worktree path copied`),children:[(0,X.jsx)(w,{"aria-hidden":`true`}),`Copy worktree path`]}):null,o?(0,X.jsxs)(D,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:o,className:c,onClick:()=>void Z(o,`Command copied to clipboard.`),children:[(0,X.jsx)(w,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function Bt({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:a,choices:o}=Q(e,t);return!a&&o.length===0?null:r?(0,X.jsx)(k,{onSelect:r,children:`Open in…`}):(0,X.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,X.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,X.jsx)(Ce,{})})]}),e.worktreePath?(0,X.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,X.jsx)(`div`,{className:`mt-4`,children:(0,X.jsx)(Rt,{run:e,canResume:t,onResume:n})})]})}function Vt({branch:e}){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(null);(0,Y.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{C(`Could not copy branch. Select and copy: ${e}`)}};return(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,X.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-xs font-medium break-all`,children:e}),(0,X.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,X.jsx)(w,{className:`size-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function Ht({run:e}){let t=b(),n=h(),i=r=>n===void 0?void 0:he(n,e.id,r,t),a=(0,Y.useMemo)(()=>ge(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,X.jsx)(E,{reference:t,to:i(t),taskTitle:I(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,X.jsx)(lt,{run:e,prNumber:t.number})},be(t)));let l=_e(e);l&&r(l)&&!c.some(e=>e.url===l)&&o.push((0,X.jsx)(E,{reference:{kind:`PR`,url:l},taskTitle:I(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=a.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,X.jsx)(E,{reference:t,to:i(t),taskTitle:I(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},be(t)));let d=me(e,t);if(d&&r(d)&&!u.some(e=>e.url===d)){let t=ve(d);s.push((0,X.jsx)(E,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?i({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:I(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,X.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,X.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function Ut(){let e=Ye(),t=l();return tt(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var $=e=>e.map(e=>`${e.name}: ${U(e.url)}`).join(`
|
|
2
|
-
`);function Wt(e){return Ut().length>0||e.notify===!0}function Gt({run:e}){let t=Ut(),n=t.length>0,r=u(e.id),[i,a]=(0,Y.useState)(null),o=e.notify===!0;return!n&&!o?null:(0,X.jsxs)(X.Fragment,{children:[o?(0,X.jsxs)(P,{children:[(0,X.jsx)(M,{asChild:!0,children:(0,X.jsxs)(D,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${rt(t)} — webhook actions`:`Notifying — webhook actions`,title:n?$(t):void 0,children:[(0,X.jsx)(Qe,{tone:`success`}),(0,X.jsx)(`span`,{children:`Notifying`}),(0,X.jsx)(Te,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,X.jsxs)(N,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,X.jsx)(O,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-xs font-normal text-muted-foreground`,children:t.map(e=>(0,X.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:U(e.url),children:e.name},e.id))}):null,n?(0,X.jsxs)(k,{className:`min-h-11`,onSelect:()=>a(`note`),children:[(0,X.jsx)(Fe,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,X.jsxs)(k,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>C(`Stopped notifying the webhook`),onError:e=>C(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,X.jsx)(St,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,X.jsxs)(D,{variant:`outline`,size:`sm`,"data-action":`handoff`,className:`size-11 px-0 md:h-[30px] md:w-auto md:px-2.5`,"aria-label":`Hand off to webhook`,onClick:()=>a(`handoff`),children:[(0,X.jsx)(L,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,X.jsx)(Kt,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&a(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{a(null),C(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>C(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function Kt({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let a=(0,Y.useId)(),o=(0,Y.useId)(),[s,c]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{e!==null&&c(``)},[e]);let l=e===`note`,u=rt(t);return(0,X.jsx)(qe,{open:e!==null,onOpenChange:e=>{e||c(``),r(e)},children:(0,X.jsx)(Ge,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,X.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(s.trim())},children:[(0,X.jsxs)(We,{className:`text-left`,children:[(0,X.jsx)(Ke,{children:l?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,X.jsx)(Ue,{children:(0,X.jsx)(`span`,{"data-webhook-destination":``,title:$(t),children:l?`${u} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${u} will start receiving this task's status updates. Add a note (optional).`})})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(`label`,{htmlFor:a,className:`text-[13px] font-medium`,children:`Note`}),(0,X.jsx)(xt,{id:a,"data-slot":`handoff-note`,"aria-describedby":o,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:s,onChange:e=>c(e.target.value)}),(0,X.jsxs)(`p`,{id:o,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,X.jsx)(Pe,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,X.jsxs)(He,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,X.jsxs)(D,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||l&&s.trim()===``,children:[(0,X.jsx)(L,{"aria-hidden":`true`}),l?`Send note`:`Hand off`]})]})]})})})}function qt({runId:e,children:t}){let n=de(),r=(0,Y.useMemo)(()=>({runId:e}),[e]);return n?(0,X.jsx)(Jt,{runId:e,children:t}):(0,X.jsx)(yt.Provider,{value:r,children:t})}function Jt({runId:e,children:t}){let{projectId:n}=fe(),r=(0,Y.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,X.jsx)(yt.Provider,{value:r,children:t})}function Yt({id:e}){return(0,X.jsxs)(F,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,"data-slot":`mobile-parent-task-link`,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm px-2 text-[13px] text-muted-foreground [min-block-size:2.75rem] [min-inline-size:2.75rem] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted active:text-foreground`,children:[(0,X.jsx)(we,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function Xt({id:e}){let t=p(e),n=t.data?I(t.data):e;return(0,X.jsxs)(`div`,{"data-slot":`parent-task`,className:`flex min-w-0 flex-wrap items-center gap-x-2 text-[13px] text-muted-foreground`,children:[(0,X.jsxs)(F,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,title:`Parent · ${n}`,"data-slot":`parent-task-link`,className:`flex min-h-11 min-w-0 max-w-full items-center gap-2 rounded-sm text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:text-foreground`,children:[(0,X.jsx)(we,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,X.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,X.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,X.jsx)(D,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var Zt=3,Qt=(e,t)=>e.kind===t.kind&&e.number===t.number;function $t(e,t,n=Zt){let r=t?e.findIndex(e=>Qt(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var en=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function tn({tab:e}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(e.kind===`pr`?xe:Ee,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,X.jsx)(Le,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function nn(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function rn({servers:e}){let t=ht();if(t===null)return null;let n=t.agentLive===!0,r=e[0],i=e.length+ +!!n===1?r?{port:r.port}:{agent:!0}:{};return(0,X.jsxs)(D,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,X.jsx)(Ae,{"aria-hidden":`true`}),nn(e,n),t.live?(0,X.jsx)(Qe,{tone:`success`,"aria-label":`Preview is live`}):null]})}function an(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function on({run:e,compact:t=!1}){if(e.delegation?.role!==`worker`)return null;let n=e.delegation.supervisorRunId??e.delegation.parentRunId;return t?(0,X.jsx)(Yt,{id:n}):(0,X.jsx)(Xt,{id:n})}function sn(e,t){return!e.archiveBlocker&&t.archive?(0,X.jsx)(Ot,{run:e}):null}function cn({archived:e,className:t}){return e?(0,X.jsx)(G,{"data-slot":`run-archived-pill`,dot:q.tone,shape:q.shape,className:t,children:q.label}):null}function ln({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,X.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function un({shown:e,run:t,previewToggle:n}){let r=Wt(t);return e&&(n||r)?(0,X.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,(0,X.jsx)(Gt,{run:t})]}):null}function dn({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:i,phoneBar:a,isDesktop:o}){let s=(0,Y.useRef)(null),c=n?`${n.kind}#${n.number}`:null;return(0,Y.useEffect)(()=>{!c||o||s.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[c,r.map(e=>`${e.kind}#${e.number}`).join(`,`),o]),(0,X.jsxs)(`div`,{ref:s,"data-slot":`run-tabs`,"data-phone-bar":a||void 0,className:`mt-3 flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-3.5 max-md:[&>a]:text-[13.5px]`,children:[(0,X.jsx)(J,{to:`/tasks/${e.id}`,active:t===`session`,replace:a,children:`Session`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:a,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:a,children:`Commits`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:a,children:`Files`}),r.map(t=>(0,X.jsx)(J,{to:en(e.id,t),active:n!==null&&Qt(t,n),replace:a,children:(0,X.jsx)(tn,{tab:t})},`${t.kind}-${t.number}`)),i.length>0?(0,X.jsxs)(P,{children:[(0,X.jsxs)(M,{"data-slot":`run-tabs-more`,"aria-label":`${i.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,i.length]}),(0,X.jsx)(N,{align:`end`,children:i.map(t=>(0,X.jsx)(k,{asChild:!0,children:(0,X.jsx)(F,{to:en(e.id,t),replace:a,children:(0,X.jsx)(tn,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function fn({run:e,tab:t=`session`,onMarkedUnread:n}){let r=re(e),a=K(e),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(!1),u=pn(e,n),d=ee(),f=ne(),p=Nt(e,{queuePosition:e.status===`queued`?Ze(d.data??[]).get(e.id):void 0}),m=it(),h=B(),g=m!==null&&!h?m:null,_=g!==null,{referenceProjectId:v,repoBase:y,requests:te}=It(e),b=(0,Y.useMemo)(()=>ye(e,y),[e,y]),x=typeof t==`object`?t:null,{inline:ie,overflow:ae}=$t(b,x),oe=f.data?.capabilities?.preview===!0,S=e.worktreePath&&oe?(0,X.jsx)(rn,{servers:e.previewServers??[]}):null,C=(0,X.jsx)(_n,{run:e,actions:u,onOpenChooser:()=>l(!0),onToggleNotes:()=>s(e=>!e)}),se=sn(e,a);return(0,X.jsx)(Ie,{projectId:v,repoBase:y,requests:te,children:(0,X.jsxs)(`header`,{"data-slot":`run-header`,"data-sticky":t===`session`||void 0,className:i(`relative z-20 bg-background px-4 md:px-9 md:pt-7`,_?`pt-0`:`pt-[18px]`,t===`session`&&`sticky [inset-block-start:0]`),children:[(0,X.jsx)(ln,{run:e}),(0,X.jsx)(jt,{run:e}),(0,X.jsxs)(`div`,{className:`w-full`,children:[(0,X.jsx)(on,{run:e}),g?(0,X.jsxs)(ot,{slot:g,children:[(0,X.jsx)(gn,{run:e,status:(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(G,{"data-slot":`mobile-run-status`,dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-w-full self-start truncate px-2 py-px text-xs leading-4`,children:p.label}),(0,X.jsx)(cn,{archived:e.archived,className:`px-2 py-px text-xs leading-4`})]})}),(0,X.jsx)(on,{run:e,compact:!0}),C]}):(0,X.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,X.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:an(e.delegation)}),(0,X.jsx)(hn,{run:e}),(0,X.jsx)(G,{dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-md:hidden`,children:Pt(p)}),(0,X.jsx)(cn,{archived:e.archived,className:`max-md:hidden`}),(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[h?se:null,S,(0,X.jsx)(Gt,{run:e}),C]})]}),(0,X.jsx)(un,{shown:g!==null,run:e,previewToggle:S}),(0,X.jsx)(dn,{run:e,tab:t,activeItem:x,inlineItemTabs:ie,overflowItemTabs:ae,phoneBar:_,isDesktop:h}),o?(0,X.jsx)(bn,{runId:e.id,onClose:()=>s(!1)}):null,c?(0,X.jsx)(Bt,{run:e,canResume:K(e).terminal,onResume:()=>u.terminal.mutate(),onClose:()=>l(!1)}):null]}),(0,X.jsx)(yn,{run:e,actions:u})]})})}function pn(e,t){let n=S(),r=Je(),[i,a]=(0,Y.useState)(null),o=()=>n.invalidateQueries({queryKey:f.runs.all}),l=e=>C(e.message,{tone:`danger`}),u=c(),d={isPending:u.isPending,mutate:()=>u.mutate({id:e.id,pinned:!e.pinned})},p=s();return{pin:d,markUnread:{isPending:p.isPending,mutate:()=>{t?.(),p.mutate(e.id,{onError:l})}},delete:m({mutationFn:()=>le(e.id),onSuccess:()=>{o(),r(`/`)},onError:l}),terminal:Lt(e),confirming:i,setConfirming:a}}function mn(e){let t=o(e.id),n=I(e);return{title:n,editor:_t(n,e=>t.mutate({title:e},{onError:e=>C(e.message,{tone:`danger`})}))}}function hn({run:e}){let{title:t,editor:n}=mn(e);return n.editing?(0,X.jsx)(ut,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,X.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(dt,{className:`size-3.5`,"aria-hidden":`true`})})]})}function gn({run:e,status:t}){let{title:n,editor:r}=mn(e);return(0,X.jsxs)(Ve,{open:r.editing,onOpenChange:e=>{e?r.begin():r.commit()},children:[(0,X.jsxs)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsx)(`h1`,{className:`line-clamp-2 break-words text-[15px] leading-[18px] font-semibold text-foreground`,title:e.task,children:n}),t]}),(0,X.jsx)(ze,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,className:`flex size-11 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(dt,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(Be,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),r.cancel()},children:(0,X.jsx)(ut,{editor:r,className:`text-[16px] font-semibold`})})]})}function _n({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=K(e),a=W(e),s=B(),c=Tt(e.id),[l,u]=(0,Y.useState)(!1),d=o(e.id),f=(0,Y.useId)();return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Dt,{run:e,open:l,onOpenChange:u,onConfirm:()=>{c.mutate(!0),u(!1)}}),(0,X.jsxs)(P,{children:[(0,X.jsx)(M,{asChild:!0,children:(0,X.jsx)(D,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,X.jsx)(ke,{"aria-hidden":`true`})})}),(0,X.jsxs)(N,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,X.jsx)(O,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),!s&&i.archive&&!e.archiveBlocker?(0,X.jsx)(k,{disabled:c.isPending,onSelect:()=>e.archived?c.mutate(!1):u(!0),children:Et(e)}):null,(0,X.jsxs)(k,{onSelect:n,children:[(0,X.jsx)(mt,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,X.jsx)(Bt,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),a?(0,X.jsxs)(k,{onSelect:()=>void Z(a,`Command copied to clipboard.`),children:[(0,X.jsx)(w,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,X.jsxs)(k,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,X.jsx)(Ct,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,X.jsxs)(j,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,X.jsx)(wt,{"aria-hidden":`true`}):(0,X.jsx)(De,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,X.jsx)(A,{}),(0,X.jsx)(O,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,X.jsx)(j,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:d.isPending,onCheckedChange:e=>d.mutate({archiveWhenDone:e},{onError:e=>C(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,X.jsx)(j,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:d.isPending,"aria-describedby":f,onCheckedChange:e=>d.mutate({autoMergePr:e},{onError:e=>C(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,X.jsx)(`p`,{id:f,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block:0.5rem]`,children:`After Done, auto-merge can mark a draft PR ready. It waits for current-head CI and GitHub rules. Merge comes before archive.`}),e.delegation?.role===`worker`?null:(0,X.jsx)(vn,{run:e,patch:d}),i.deleteRun?(0,X.jsx)(A,{}):null,i.deleteRun?(0,X.jsxs)(k,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,X.jsx)(Se,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})]})}function vn({run:e,patch:t}){let n=(0,Y.useId)(),r=(0,Y.useId)(),i=(0,Y.useId)(),a=e=>C(e.message,{tone:`danger`});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{}),(0,X.jsx)(O,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,X.jsx)(j,{"data-slot":`allow-workers`,className:`min-h-11`,checked:oe(e),disabled:t.isPending,"aria-describedby":`${n} ${i}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:a}),children:`Allow Squawk workers`}),(0,X.jsx)(`p`,{id:n,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`}),(0,X.jsx)(j,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:se(e),disabled:t.isPending,"aria-describedby":`${r} ${i}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:a}),children:`Allow task messaging`}),(0,X.jsx)(`p`,{id:r,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can message other tasks in this project.`}),(0,X.jsx)(`p`,{id:i,"data-slot":`task-access-session-note`,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Turning one off applies at once. Turning one on reaches a running agent at its next session.`})]})}function yn({run:e,actions:t}){let n=t.confirming;return(0,X.jsx)(R,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,X.jsxs)(at,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(H,{children:[(0,X.jsx)(vt,{className:`text-danger`,children:`Delete task permanently?`}),(0,X.jsx)(ct,{children:(0,X.jsxs)(X.Fragment,{children:[`Delete “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:I(e),children:I(e)}),`” and its transcript`,e.delegation?.role===`worker`&&!ue(e.delegation.workspace)?``:`, worktree and branch`,`. This cannot be undone.`]})})]}),(0,X.jsxs)(z,{children:[(0,X.jsx)(V,{children:`Cancel`}),(0,X.jsx)(st,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function bn({runId:e,onClose:t}){let n=y(e);return(0,X.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,X.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,X.jsx)(Ce,{})})]}),n.isPending?(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,X.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,X.jsx)(qt,{runId:e,children:(0,X.jsx)(bt,{children:n.data})}):(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,X.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,X.jsx)(D,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Z(n.data??``,`Notes copied`),children:`Copy notes`}),(0,X.jsx)(D,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{zt as a,Nt as c,Ht as i,qt as n,Lt as o,Vt as r,It as s,fn as t};
|
|
@@ -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{t as r}from"./utils-DSMR_WLb.js";import{C as i,Wt as a,X as o,Y as s,dn as c,yt as l}from"./queries-ClkIgWFx.js";import{Bt as u,Fn as d,Ft as f,Ht as p,Lt as m,Tt as h,at as g,ct as _,hi as v,n as y,tr as b}from"./toaster-C-xqAWVX.js";import{h as x}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as S,j as C,l as w}from"./design-icons-CzEoMH9c.js";import{t as T}from"./run-header-GiajAH1E.js";import{i as E,n as D,r as ee}from"./git-toolbar-CRj5dZa2.js";import{t as O}from"./button-B7MKxYjT.js";import{a as k,i as A,o as j,r as M,s as N,t as P}from"./dialog-B531GGAo.js";import{b as F,f as I}from"./task-groups-aquji1Kv.js";import{c as te,d as L}from"./page-shell-7pLJMOgh.js";import{t as R}from"./centered-state-V15AR_qo.js";import{J as z,Mn as B,S as V,Yt as H,rn as U,x as W}from"./index-BX94wp6m.js";import{t as G}from"./markdown-BBDDg-4t.js";import{t as K}from"./textarea-vJt9undk.js";import{t as q}from"./diff-B60FGSvK.js";var J=e(t(),1),Y=`no worktree — this task ran directly in the repo working tree`;function X(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.run.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${Y}`)}function Z(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.run.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${Y}`)}function ne(e){let t=e=>({id:`create-pr`,label:`Draft PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Draft PR unavailable — ${Y}`):e.forge===null?t(`Draft PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?b(e.run)?t(`Draft PR unavailable — the run is waiting on a usage-limit hold; choose Don’t resume first`):F(e.run)?t(`Draft PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Draft PR`,enabled:!0}:t(`Draft PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function re(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:X(e),n=e.prUrl?[X(e),Z(e)]:[Z(e),ne(e)],r=[];if(e.localHandoff&&e.cliHandoff!==!1){let t=e.hasSession?F(e.run)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var Q=n();function $({run:e,open:t,onOpenChange:n}){let r=v(),[i,o]=(0,J.useState)(``),s=I(e),l=(0,J.useRef)(s);l.current=s,(0,J.useEffect)(()=>{t&&o(l.current)},[t]);let u=c({mutationFn:t=>g(e.id,t),onSuccess:t=>{y(`Committed ${B(t.sha)}`),n(!1),r.invalidateQueries({queryKey:a.runs.changes(e.id)}),r.invalidateQueries({queryKey:a.runs.all})},onError:e=>y(e.message,{tone:`danger`})}),d=()=>{let e=i.trim();e.length===0||u.isPending||u.mutate(e)};return(0,Q.jsx)(P,{open:t,onOpenChange:n,children:(0,Q.jsxs)(M,{"data-slot":`commit-dialog`,children:[(0,Q.jsxs)(j,{children:[(0,Q.jsx)(N,{children:`Commit changes`}),(0,Q.jsxs)(A,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,Q.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,Q.jsx)(K,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{z({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(),d())}}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(O,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Q.jsx)(O,{"data-slot":`commit-confirm`,disabled:i.trim().length===0||u.isPending,onClick:d,children:u.isPending?`Committing…`:`Commit`})]})]})})}function ie(){let{id:e}=x(),t=s(e);return t.isPending?(0,Q.jsx)(V,{tab:`changes`}):t.isError?(0,Q.jsx)(W,{tab:`changes`,error:t.error}):(0,Q.jsx)(ae,{run:t.data})}function ae({run:e}){let t=l(),n=i(),r=o(e.id,F(e)),s=H(),[p,h]=(0,J.useState)(`unified`),[g,b]=(0,J.useState)(!0),[x,S]=(0,J.useState)(!1),[C,w]=(0,J.useState)(null),[E,O]=(0,J.useState)(!1),k=(0,J.useRef)(null),A=v(),j=()=>A.invalidateQueries({queryKey:a.runs.all}),M=e=>y(e.message,{tone:`danger`}),N=c({mutationFn:()=>u(e.id),onSuccess:e=>y(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:M}),P=c({mutationFn:()=>_(e.id),onSuccess:e=>{y(`Draft PR created — ${e.url}`),j()},onError:M}),I=c({mutationFn:()=>m(e.id),onError:e=>{if(e instanceof d&&e.command){navigator.clipboard.writeText(e.command).then(()=>y(`No terminal found — command copied to clipboard.`)).catch(()=>y(`Run manually: ${e.command}`));return}M(e)}}),R=c({mutationFn:t=>f(e.id,t),onError:M}),z=r.isError&&r.error instanceof d&&r.error.status===409,B=re({run:e,cliHandoff:e.cliHandoff,hasWorktree:!!e.worktreePath&&!z,branch:e.branch,changedFiles:r.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:U(e)!==void 0,prUrl:e.pullRequestUrl}),V=e=>{switch(e){case`commit`:O(!0);break;case`push`:N.mutate();break;case`create-pr`:P.mutate();break;case`open-terminal`:I.mutate();break;case`view-pr`:break}},W=r.data?.files??[],K=(0,J.useMemo)(()=>ee(W),[W]),q=(0,J.useMemo)(()=>W.some(G),[W]),Y=s?p:`unified`;return(0,Q.jsxs)(te,{route:`task-changes`,density:L(W.length),flushPadding:!0,children:[(0,Q.jsx)(T,{run:e,tab:`changes`}),(0,Q.jsx)(D,{bar:B,healthReady:t.data!==void 0,branch:e.branch,stat:r.data?.stat,mode:Y,wrap:g,preview:x,onModeChange:h,onWrapChange:b,onPreviewChange:q?S:void 0,onAction:V}),r.data?.repointedHead?(0,Q.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-9`,children:[`HEAD is on `,(0,Q.jsx)(`code`,{children:r.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,Q.jsx)(`code`,{children:r.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,(0,Q.jsx)(oe,{changes:r,changesRefused:z,fileCount:W.length,children:(0,Q.jsx)(se,{runId:e.id,files:W,tree:K,selected:C,selectFile:e=>{w(e),k.current?.scrollToPath(e)},diffRef:k,effectiveMode:Y,effectiveWrap:g,preview:x,localHandoff:t.data?.capabilities.localHandoff,onOpenInApp:R.mutate})}),(0,Q.jsx)($,{run:e,open:E,onOpenChange:O})]})}function oe({changes:e,changesRefused:t,fileCount:n,children:r}){return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,Q.jsx)(R,{icon:t?(0,Q.jsx)(S,{size:16}):(0,Q.jsx)(C,{size:16}),tone:t?`neutral`:`danger`,heading:`h2`,title:t?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):n===0?(0,Q.jsx)(R,{icon:(0,Q.jsx)(S,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):r}function se({runId:e,files:t,tree:n,selected:i,selectFile:a,diffRef:o,effectiveMode:s,effectiveWrap:c,preview:l,localHandoff:u,onOpenInApp:d}){let[f,m]=(0,J.useState)(!1);return(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-4 px-4 pb-9 pt-0 [--diff-sticky-top:0px] md:flex-row md:items-start md:gap-5 md:px-9 md:[--diff-sticky-top:1rem]`,children:[(0,Q.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain md:p-3.5 lg:w-[288px]`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`changes-tree-toggle`,"aria-expanded":f,onClick:()=>m(e=>!e),className:`flex min-h-11 w-full items-center justify-between gap-2 px-3.5 py-2 text-left text-xs font-semibold text-foreground md:hidden`,children:[(0,Q.jsxs)(`span`,{children:[`Changed files`,` `,(0,Q.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,t.length,`)`]})]}),(0,Q.jsx)(w,{size:16,"aria-hidden":`true`,className:r(`size-4 shrink-0 text-muted-foreground motion-safe:transition-transform`,f&&`rotate-180`)})]}),(0,Q.jsx)(`h2`,{className:`mb-3 hidden border-b border-border pb-3 text-xs font-semibold md:block`,children:`Changed files`}),(0,Q.jsx)(`div`,{className:r(f?`border-t border-border px-3.5 py-3 md:border-t-0 md:p-0`:`hidden md:block`),children:(0,Q.jsx)(E,{root:n,selected:i,onSelect:e=>{a(e),m(!1)}})})]}),(0,Q.jsx)(q,{files:t,viewRef:o,mode:s,wrap:c,preview:l,loadFileText:t=>ce(e,t),imageSrc:t=>p(e,t),onOpenInApp:u?e=>d(e):void 0,totals:!1,className:`min-w-0 flex-1`})]})}async function ce(e,t){try{let n=await h(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{ie as TaskChangesRoute};
|