@wjarka/cezarion 0.18.0-dev.8137 → 0.18.0-dev.8145
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/web/dist/assets/accounts-section-CZzEOP8R.js +1 -0
- package/web/dist/assets/{activity-motion-D80Uv4-Z.js → activity-motion-Jmq2_2yL.js} +1 -1
- package/web/dist/assets/{activity-route-DVT8IWTR.js → activity-route-SFwjSBCp.js} +1 -1
- package/web/dist/assets/{agent-config-section-BbwkJunW.js → agent-config-section-BumcXk5K.js} +2 -2
- package/web/dist/assets/agent-defaults-section-VUhgYmuN.js +1 -0
- package/web/dist/assets/{appearance-B6YBsmTo.js → appearance-CpDAS_Ul.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-Bx1bEmI8.js → archive-on-merge-field-DlkEGuaI.js} +1 -1
- package/web/dist/assets/automations-route-BwDLBy9v.js +1 -0
- package/web/dist/assets/{commit-diff-panel-DKUnniap.js → commit-diff-panel-DE6af9SI.js} +1 -1
- package/web/dist/assets/diff-DKigJrIK.js +3 -0
- package/web/dist/assets/{diff-view-D_bjQyDl.js → diff-view-BV41OEIW.js} +1 -1
- package/web/dist/assets/{file-preview-glEH09z8.js → file-preview-CXXKcpBz.js} +1 -1
- package/web/dist/assets/{folder-browser-G_9ZgDjg.js → folder-browser-zsT1W215.js} +1 -1
- package/web/dist/assets/{git-toolbar-CTsmGICA.js → git-toolbar-DM1Z5LRO.js} +1 -1
- package/web/dist/assets/github-Z2_nA6EI.js +1 -0
- package/web/dist/assets/{global-activity-route-BP_Z7HNc.js → global-activity-route-DcQEMY2A.js} +1 -1
- package/web/dist/assets/index-jtycbyRq.js +21 -0
- package/web/dist/assets/{label-BWld23ke.js → label-9ElpAxAO.js} +1 -1
- package/web/dist/assets/{markdown-CT65TA_B.js → markdown-BDx7WnW8.js} +1 -1
- package/web/dist/assets/{notifications-section-DuSzYLwP.js → notifications-section-CjgS2_uZ.js} +1 -1
- package/web/dist/assets/open-in-menu-jthe8d7_.js +1 -0
- package/web/dist/assets/{preview-pane-connected-DHmgDHId.js → preview-pane-connected-BdpApHW4.js} +1 -1
- package/web/dist/assets/{project-location-BM-6wMI3.js → project-location-Do0zCjuE.js} +1 -1
- package/web/dist/assets/{projects-section-Dr0xJWTm.js → projects-section-B94Rc_Ig.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-COKMgKMw.js → prompt-templates-section-Bm4SvXEV.js} +1 -1
- package/web/dist/assets/queries-DfxoqDBz.js +1 -0
- package/web/dist/assets/{reference-chip-DTKtEtWv.js → reference-chip-B9Cnr6jR.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-BV_sPAXc.js → remote-settings-notice-DXgS_yXZ.js} +1 -1
- package/web/dist/assets/{repo-git-BgXC4opq.js → repo-git-C99FduHG.js} +1 -1
- package/web/dist/assets/{report-reader-CtHvvSln.js → report-reader-BjVZrGCz.js} +1 -1
- package/web/dist/assets/{reports-CdbDUzkK.js → reports-DnQPedky.js} +1 -1
- package/web/dist/assets/{resources-section-C8KZ4hre.js → resources-section-DVi14Dy4.js} +1 -1
- package/web/dist/assets/run-header-CCO4OIcD.js +2 -0
- package/web/dist/assets/settings-agent-picker-DjvmMcxd.js +1 -0
- package/web/dist/assets/{settings-shell-DnYRfclU.js → settings-shell-BGvilCiB.js} +1 -1
- package/web/dist/assets/{sidebar-section-CCg4QGtg.js → sidebar-section-BR6GFKTd.js} +1 -1
- package/web/dist/assets/skills-BjtkIMxL.js +1 -0
- package/web/dist/assets/{task-changes-DWPWp6ZV.js → task-changes-B8siIdj_.js} +1 -1
- package/web/dist/assets/{task-commits-D576LERH.js → task-commits-CGYaXoYl.js} +1 -1
- package/web/dist/assets/{task-files-1EjplVVb.js → task-files-HaulqF8i.js} +1 -1
- package/web/dist/assets/{task-github-item-BubKlTej.js → task-github-item-DumSw4lZ.js} +1 -1
- package/web/dist/assets/{task-groups-D4RYW5I_.js → task-groups-BWeTwWTP.js} +1 -1
- package/web/dist/assets/task-thread-CeJ8GbmR.js +9 -0
- package/web/dist/assets/{tasks-table-DTNcYbbN.js → tasks-table-DS9DShj0.js} +1 -1
- package/web/dist/assets/{thread-state-BiS8rKQ-.js → thread-state-BeRGkUTA.js} +1 -1
- package/web/dist/assets/use-hand-to-agent-state-DAmqctoU.js +1 -0
- package/web/dist/assets/{workflows-DbuTPPz7.js → workflows-bPgltsoh.js} +1 -1
- package/web/dist/assets/{workspace-tools-DPnEZoDL.js → workspace-tools-Clb89tgJ.js} +1 -1
- package/web/dist/assets/{worktrees-section-Vr8s9cio.js → worktrees-section-DdChlr21.js} +1 -1
- package/web/dist/index.html +8 -9
- package/web/dist/assets/accounts-section-BkKQ8sVH.js +0 -1
- package/web/dist/assets/agent-defaults-section-BLNTIZT_.js +0 -1
- package/web/dist/assets/automations-route-BOcGwfd4.js +0 -1
- package/web/dist/assets/diff-DUbLBjbg.js +0 -3
- package/web/dist/assets/github-BqW9PaQO.js +0 -1
- package/web/dist/assets/index-DXIRYobS.js +0 -21
- package/web/dist/assets/open-in-menu-D03osLGE.js +0 -1
- package/web/dist/assets/queries-yuG-mM6_.js +0 -1
- package/web/dist/assets/run-header-RQYKdIMw.js +0 -2
- package/web/dist/assets/runners-CDw7wLfd.js +0 -1
- package/web/dist/assets/settings-agent-picker-3uuSf9LK.js +0 -1
- package/web/dist/assets/skills-L01dfEnP.js +0 -1
- package/web/dist/assets/task-thread-yWACZZAo.js +0 -9
- package/web/dist/assets/use-hand-to-agent-state-BFx3SZia.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,t as i}from"./utils-DSMR_WLb.js";import{C as a,Nt as o,ci as s,et as c,kr as l,qt as u,r as d,tt as f}from"./project-scope-context-Dgq8_2JZ.js";import{A as p,E as m,J as h,Pt as g,Tt as _,Ut as v,Z as y,en as b,in as x,kt as S,p as C,t as w}from"./queries-DfxoqDBz.js";import{t as T}from"./useQuery-BUslvRIM.js";import{n as E}from"./toaster-Bo5vCbz-.js";import{Y as D,c as O,ct as k,ft as A,g as j,it as M,k as N,l as ee,m as te,ot as P,r as F,tt as I,u as ne,ut as L,y as re}from"./design-icons-CzEoMH9c.js";import{t as R}from"./external-link-BE6y205O.js";import{t as ie}from"./eye-B8okNWXU.js";import{a as ae,i as z}from"./format-BNCkW110.js";import{t as oe}from"./message-square-B-MD-8rD.js";import{t as se}from"./play-CmVAj_fu.js";import{t as B}from"./button-BQ2y4XRB.js";import{i as ce,r as le,t as ue}from"./popover-BPgUYFyu.js";import{a as de,i as fe,o as pe,r as me,s as he,t as ge}from"./dialog-BVF6dIeS.js";import{t as V}from"./project-router-DtTvMbeA.js";import{a as _e,i as H,o as U,r as ve,s as ye,t as be}from"./command-CDt1BsZy.js";import{d as xe,f as W,i as Se,o as Ce,p as we,s as Te,t as Ee,u as De}from"./skills-pM_PouEs.js";import{$ as Oe,Bn as G,F as ke,G as Ae,H as je,I as Me,J as Ne,K as Pe,L as Fe,M as Ie,N as Le,P as Re,U as ze,W as K,X as Be,Z as Ve,_n as He,er as Ue,et as We,it as Ge,j as Ke,nt as qe,rt as Je,xt as q,yn as Ye}from"./index-jtycbyRq.js";import{t as Xe}from"./markdown-BDx7WnW8.js";import{t as Ze}from"./textarea-vJt9undk.js";import{t as Qe}from"./diff-DKigJrIK.js";import{t as $e}from"./tab-link-Dl5Mmavw.js";var J=e(t(),1),Y=n(),et={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function X({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Y.jsx)(O,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:i(t,`text-success`)}):e===`failing`?(0,Y.jsx)(j,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:i(t,`text-danger`)}):e===`pending`?(0,Y.jsx)(ae,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:i(t,`animate-spin text-warning`)}):(0,Y.jsx)(te,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:i(t,`text-soft-foreground`)})}function tt(e){return e?.available?e.mergeState:null}function nt(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function rt(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function it(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function at(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function ot(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function st(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function ct(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function lt(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function Z(e){return e?et[e]:`Merge`}function ut(e){return e===`conflicting`?`true`:void 0}function dt({check:e}){return(0,Y.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(X,{state:e.state}),(0,Y.jsxs)(`span`,{children:[e.name,` · `,e.state,st(e.required)]})]}),e.url&&r(e.url)?(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function ft({reason:e}){return(0,Y.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function pt({state:e,selectedMethod:t,overrideRules:n,mergeEnabled:r,refreshPending:a,onRefresh:o,onRunAgent:s,onConfirm:c,onMethodChange:l,onOverrideChange:u}){let d=rt(e),f=it(e.reviewDecision),p=at(e.mergeable);return(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,Y.jsx)(O,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Y.jsx)(P,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold`,children:d}),(0,Y.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:a,onClick:o,children:[(0,Y.jsx)(D,{size:16,"aria-hidden":`true`,className:i(`size-3.5`,a&&`animate-spin`)}),`Refresh`]})]}),(0,Y.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,Y.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Y.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(X,{state:f}),(0,Y.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Y.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(X,{state:p}),(0,Y.jsxs)(`span`,{children:[`Conflicts: `,ot(e.mergeable)]})]}),e.checks.length===0?(0,Y.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,Y.jsx)(dt,{check:e},e.name)),e.blockers.map(e=>(0,Y.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&s?(0,Y.jsx)(B,{className:`mt-4`,onClick:s,children:`Run agent on this PR`}):null,e.canOverride?(0,Y.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>u(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Y.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,Y.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,Y.jsx)(`select`,{"aria-label":`Merge method`,value:t??``,onChange:e=>l(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:e.methods.map(e=>(0,Y.jsx)(`option`,{value:e,children:et[e]},e))}),(0,Y.jsx)(B,{disabled:!r,onClick:c,children:Z(t)})]}):null]})]})}function mt({number:e,state:t,selectedMethod:n,confirming:r,overrideRules:i,mergePending:a,mergeError:o,onOpenChange:s,onMerge:c}){return(0,Y.jsx)(ge,{open:r,onOpenChange:s,children:(0,Y.jsxs)(me,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Y.jsxs)(pe,{children:[(0,Y.jsxs)(he,{children:[Z(n),` pull request #`,e,`?`]}),(0,Y.jsx)(fe,{asChild:!0,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),i&&t.canOverride?(0,Y.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),o?(0,Y.jsx)(`p`,{className:`text-sm text-danger`,children:o.message}):null,(0,Y.jsxs)(de,{children:[(0,Y.jsx)(B,{variant:`outline`,disabled:a,onClick:()=>s(!1),children:`Cancel`}),(0,Y.jsx)(B,{disabled:a,onClick:c,children:a?`Merging…`:Z(n)})]})]})})}function ht({number:e,onRunAgent:t}){let n=s(),r=y(),i=T({queryKey:w.githubMergeState(e),queryFn:({signal:t})=>f(e,{},{signal:t}),retry:!1}),a=tt(i.data),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(!1),[p,m]=(0,J.useState)(!1),h=x({mutationFn:t=>f(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>E(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=nt(c,a),_=()=>({mergeState:w.githubMergeState(e),list:w.githubPages(50),comments:w.githubComments(`pr`,e),item:w.githubItem(`pr`,e),refStatus:r===void 0?void 0:w.githubRefStatusOf(r)}),v=x({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return o(e,{method:g,expectedHeadSha:a.headSha,...p&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{d(!1),E(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{E(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,Y.jsx)(G,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,Y.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":ut(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsx)(pt,{state:a,selectedMethod:g,overrideRules:p,mergeEnabled:lt(g,a,p),refreshPending:h.isPending,onRefresh:()=>h.mutate(w.githubMergeState(e)),onRunAgent:t,onConfirm:()=>d(!0),onMethodChange:l,onOverrideChange:m}),(0,Y.jsx)(mt,{number:e,state:a,selectedMethod:g,confirming:u,overrideRules:p,mergePending:v.isPending,mergeError:v.error,onOpenChange:d,onMerge:()=>v.mutate(_())})]}):(0,Y.jsx)(ft,{reason:ct(i.data)})}function gt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function _t(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function vt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function Q(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function yt({label:e,color:t,plain:n=!1}){return(0,Y.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:Q(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function bt(e){return e===`pr`?`pull request`:`issue`}function xt(e,t,n){return e===`pr`&&!!(t||n)}function St({backLink:e}){return e?(0,Y.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Y.jsx)(F,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}function Ct({item:e,kindWord:t,commentCount:n,hasDiffStat:i,additions:a,deletions:o}){return(0,Y.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Y.jsx)(`span`,{children:t}),`·`,(0,Y.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Y.jsxs)(`span`,{children:[z(e.createdAt),` ago`]}),n?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsx)(Kt,{count:n})]}):null,i?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,a??0]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,o??0]})]})]}):null,`·`,r(e.url)?(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Y.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function wt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,Y.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Y.jsx)($e,{to:q(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,Y.jsx)($e,{to:q(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,Y.jsx)(V,{to:q(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function Tt({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Y.jsx)(yt,{label:e,color:t[e]},e)),n?(0,Y.jsx)(qt,{checks:n,url:e.url}):null]}):null}function Et({item:e,colors:t,body:n}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:n?(0,Y.jsx)(Xe,{children:n}):(0,Y.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Y.jsx)(kt,{item:e,colors:t})]})}function Dt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,children:c}){let l=a?.changes??!1,u=bt(e.kind),d=m(e.kind,e.number,!l).data?.detail,f=d?.body??e.body,p=d?.additions??e.additions,h=d?.deletions??e.deletions,g=xt(e.kind,p,h),_=r??e.comments;return(0,Y.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Y.jsx)(St,{backLink:i}),(0,Y.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,Y.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,Y.jsx)(Ct,{item:e,kindWord:u,commentCount:_,hasDiffStat:g,additions:p,deletions:h}),e.kind===`pr`?null:(0,Y.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),s,(0,Y.jsx)(wt,{item:e,subNav:a,changes:l}),(0,Y.jsx)(Tt,{item:e,colors:t,checks:n}),l&&e.kind===`pr`?(0,Y.jsx)(Ot,{item:e}):(0,Y.jsx)(Et,{item:e,colors:t,body:f})]}),e.kind===`pr`?(0,Y.jsx)(ht,{number:e.number,onRunAgent:o}):null,c]})}function Ot({item:e}){let t=s(),n=p(e.number),[a,o]=(0,J.useState)(``),[l,u]=(0,J.useState)(null),d=n.data,f=d?.available?d.files.filter(e=>e.path.toLowerCase().includes(a.toLowerCase())):[],m=f.findIndex(e=>e.path===l);(0,J.useEffect)(()=>{f.length>0&&!f.some(e=>e.path===l)&&u(f[0].path)},[d?.available?d.headSha:``,a]);let h=async()=>{let n=d?.available?d.headSha:null,r=w.githubPrChanges(e.number),i=await c(e.number,{refresh:!0});t.setQueryData(r,i),i.available&&n&&n!==i.headSha&&(u(i.files[0]?.path??null),E(`The reviewed revision changed.`))};if(n.isPending)return(0,Y.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!d)return(0,Y.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!d.available)return(0,Y.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:d.reason});let g=f.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),_=r(e.url)?`${e.url}/files`:null,v=f.find(e=>e.path===l);return(0,Y.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Y.jsxs)(`strong`,{children:[d.files.length,` changed files`]}),(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,d.additions]}),(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,d.deletions]}),(0,Y.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:d.headSha,children:[`head `,d.headSha.slice(0,8)]}),(0,Y.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void h(),children:`Refresh`})]}),d.truncated?(0,Y.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[d.reason??`This response is incomplete.`,` `,_?(0,Y.jsx)(`a`,{href:_,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Y.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Y.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Y.jsx)(`input`,{"aria-label":`Filter changed files`,value:a,onChange:e=>o(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,Y.jsx)(`select`,{"aria-label":`Select changed file`,value:l??``,onChange:e=>u(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:f.map(e=>(0,Y.jsx)(`option`,{children:e.path},e.path))}),(0,Y.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:f.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>u(e.path),className:i(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,l===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Y.jsx)(B,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<=0,onClick:()=>u(f[m-1]?.path??null),children:(0,Y.jsx)(Ue,{})}),(0,Y.jsx)(B,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<0||m>=f.length-1,onClick:()=>u(f[m+1]?.path??null),children:(0,Y.jsx)(ne,{size:16})})]}),f.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Qe,{files:g.filter(e=>e.path===l),wrap:!0,className:`min-w-0`}),v&&!v.patch?(0,Y.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,v.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function kt({item:e,colors:t}){let n=m(e.kind,e.number),r=n.data,i=(0,J.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(At(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,Y.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Y.jsx)(G,{className:`mb-3 h-3 w-24`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(G,{className:`h-14 w-full`}),(0,Y.jsx)(G,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Y.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Y.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Y.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Y.jsx)(`ul`,{className:`flex flex-col gap-5`,children:jt(i).map(e=>e.group===`commits`?(0,Y.jsx)(Mt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Y.jsx)(Ht,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Y.jsx)(Nt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var At=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function jt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function Mt({commits:e,colors:t}){let[n,r]=(0,J.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:$.committed}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Y.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Y.jsx)(Nt,{event:e,colors:t},e.id))]}):(0,Y.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:$.committed}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Y.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:z(e[e.length-1].createdAt)})]})})}var $={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Nt({event:e,colors:t}){return(0,Y.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:i(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:$[e.kind]}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Y.jsx)(zt,{event:e,colors:t}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:z(e.createdAt)}),e.url?(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Pt({event:e}){return(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Y.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Y.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Y.jsx)(Bt,{checks:e.checks})]})}function Ft({event:e,colors:t}){return(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Y.jsx)(`span`,{"data-slot":`gh-event-label`,style:Q(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,Y.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function It({event:e}){return(0,Y.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Lt({event:e}){return(0,Y.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Rt={committed:e=>(0,Y.jsx)(Pt,{event:e}),labeled:(e,t)=>(0,Y.jsx)(Ft,{event:e,colors:t}),unlabeled:(e,t)=>(0,Y.jsx)(Ft,{event:e,colors:t}),assigned:e=>(0,Y.jsx)(It,{event:e}),unassigned:e=>(0,Y.jsx)(It,{event:e}),merged:()=>(0,Y.jsx)(`span`,{children:`merged this`}),closed:()=>(0,Y.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,Y.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,Y.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,Y.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,Y.jsx)(Lt,{event:e})};function zt({event:e,colors:t}){return Rt[e.kind]?.(e,t)??null}function Bt({checks:e}){return e?(0,Y.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:i(`shrink-0`,Gt[e]),children:Wt[e]}):null}var Vt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Ht({comment:e}){let t=e.reviewState?Vt[e.reviewState]:null;return(0,Y.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Y.jsx)(Ut,{url:e.avatarUrl,login:e.author}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Y.jsx)(`span`,{children:z(e.createdAt)}),t?(0,Y.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:i(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Y.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Y.jsx)(Xe,{children:e.body}):(0,Y.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Ut({url:e,login:t}){let[n,r]=(0,J.useState)(!1);return e&&!n?(0,Y.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,Y.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Wt={passing:`✓`,failing:`✗`,pending:`○`},Gt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Kt({count:e}){return e?(0,Y.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,Y.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function qt({checks:e,url:t}){let n=i(`text-[11px] font-medium`,Gt[e],t&&`hover:underline`),r=`${Wt[e]} checks ${e}`;return t?(0,Y.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Y.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function Jt({checks:e}){return(0,Y.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:i(`shrink-0 font-sans text-[11px] font-semibold`,Gt[e]),children:Wt[e]})}function Yt(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Xt(e,t=[]){let n=Yt(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Zt(t)),n}function Zt(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function Qt(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function $t(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function en(e,t,n){let r=(n??``).trim();if(!r)return Xt(e,t);let i=Yt(e),a=r.startsWith(i)?i+Qt(r.slice(i.length),e):Qt(r,e),o=$t(a,e)?a:`${i}\n\n${a}`;return t.length?o+Zt(t):o}function tn(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function nn(e,t,n,r,i={}){return t?{...i,workflow:t,task:en(e,n.map(e=>e.id),r)}:n.length?{...i,steps:tn(n.map(e=>e.id)).map((e,t)=>({...e,...n[t]?.path===void 0?{}:{skillPath:n[t].path}})),task:en(e,[],r)}:{...i,workflow:`quick-task`,task:en(e,[],r)}}function rn(e){let t=h(),n=C(),r=v(),{runners:i,uninstalled:a,signedOut:o,accounts:s,repoAccount:c,accountFor:l}=Ye(),u=n.data?.defaultRunner,d=Me(e.runner,i,u??i[0]??`claude`),f=n.data?.modelsLocked===!0,p=l(d,e.account),m=b(d,!0,p??c?.[d]),g=ke(f?null:e.model,d,r.data,n.data?.defaultModels,m.data),_=Ie(g,m.data);return{runner:d,runnerExplicit:e.runner!==null,model:g,effort:f?``:Re(e.effort,_),effortOptions:_,runners:i,uninstalled:a,signedOut:o,defaultRunner:u,canRun:t.isSuccess&&i.length>0,modelsLocked:f,providerPending:t.isPending,providerError:t.isError,accounts:s,account:p,repoAccount:c}}function an(e){return{runner:Fe(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function on(e){return{...an(e),...e.account?{agentProfile:e.account}:{}}}function sn(e,t){let{runners:n,uninstalled:r,signedOut:i}=e;return n.length>1||r.length>0||i.length>0||n.some(e=>He(t,e))}function cn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,J.useRef)(null),o=(0,J.useRef)(null),[s,c]=(0,J.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,J.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,J.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let l=rn(e),{runner:u,model:d,effort:f,effortOptions:p,runners:m,canRun:h,modelsLocked:g}=l,_=C(),y=v(),x=b(u,!0,l.account??l.repoAccount?.[u]),S=Le(u,y.data,x.data,[e.model,_.data?.defaultModels?.[u]]),w=n||!h,T=r?l.accounts:[],E=sn(l,T)?(0,Y.jsx)(Pe,{icon:(0,Y.jsx)(M,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:m,uninstalled:l.uninstalled,signedOut:l.signedOut,value:u,accounts:T,account:r?l.account:null,repoAccount:r?l.repoAccount:void 0,disabled:w,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===u?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,D=(0,Y.jsx)(K,{icon:(0,Y.jsx)(re,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:d===``?`Default`:S.find(e=>e.id===d).label,value:d,disabled:w,readOnly:g===!0,disabledHint:g?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Ie(n,x.data);t({...e,model:n,effort:e.effort===null?null:Re(e.effort,r)})},options:S.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Ke(u,y.data,x)},`model`),O=(0,Y.jsx)(K,{icon:(0,Y.jsx)(N,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:p.find(e=>e.value===f)?.label??`auto`,value:f,disabled:w,readOnly:g===!0,disabledHint:g?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:p.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,Y.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,Y.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,Y.jsx)(Ae,{children:s?[E,O,D]:[E,D,O]})})}):(0,Y.jsxs)(Ae,{children:[E,D,O]})}var ln={workflow:null,skills:[]},un=`cez-followup-selection`;function dn(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.flatMap(e=>typeof e==`string`?[{id:e}]:!e||typeof e!=`object`||typeof e.id!=`string`?[]:[{id:e.id,...typeof e.path==`string`?{path:e.path}:{}}]):[]}}function fn(){try{let e=localStorage.getItem(un);return e?dn(JSON.parse(e)):{...ln}}catch{return{...ln}}}function pn(e){try{localStorage.setItem(un,JSON.stringify(e))}catch{}}var mn=`cez-followup-prompt:`;function hn(e){try{return localStorage.getItem(mn+e)??``}catch{return``}}function gn(e,t){try{t===``?localStorage.removeItem(mn+e):localStorage.setItem(mn+e,t)}catch{}}function _n({item:e,workflows:t,skills:n,workflow:i,onWorkflowChange:o,selectedSkills:c,onSkillsChange:l,engine:d,onEngineChange:f,queuedRunId:p,onQueued:m}){let h=s(),v=_(),y=e.kind===`pr`?`PR`:`issue`,b=rn(d),S=g(b.runner,b.account),C=c.filter(e=>S.unchecked||e.path===void 0||n.some(t=>t.id===e.id&&(e.path===void 0||t.path===e.path))),T=C.length!==c.length,[D]=(0,J.useState)(()=>Yt(e)),[k,A]=(0,J.useState)(()=>hn(e.url)||D),j=(0,J.useRef)(null),M=(0,J.useRef)(null);(0,J.useEffect)(()=>{gn(e.url,k===D?``:k)},[e.url,k,D]);let N=(0,J.useMemo)(()=>qe(v.data?.promptTemplates),[v.data?.promptTemplates]),ee=e=>{let t=j.current,n=Ge({prompt:k,base:D,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:M.current}),r=We(k,n,e);A(r.text),M.current=r.caret,requestAnimationFrame(()=>{j.current?.focus(),j.current?.setSelectionRange(r.caret,r.caret)})},te=Oe(N,C.map(e=>e.id)),P=(0,J.useRef)(k);P.current=k;let F=(0,J.useRef)(``);(0,J.useEffect)(()=>{let e=Je(P.current,F.current,te,D);F.current=e.applied,e.text!==P.current&&A(e.text)},[te,D]);let I=x({mutationFn:async()=>!b.canRun||T?null:a(nn(e,i,C,k,on(b))),onSuccess:t=>{if(t===null)return;let n=t;n&&m(e.url,n.id),E(`Added to the queue — ${y} #${e.number}`),C.length>0&&v.data!==void 0&&u({skillUsage:C.reduce((e,t)=>Ee(e,t.id),v.data.skillUsage)}).then(()=>h.invalidateQueries({queryKey:w.uiState})).catch(()=>{}),gn(e.url,``),A(D),F.current=``,h.invalidateQueries({queryKey:w.runs.all})},onError:e=>E(e.message,{tone:`danger`})}),ne=e=>{Be({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(),!I.isPending&&b.canRun&&I.mutate())},L=e=>l(c.some(t=>W(t)===W(e))?c.filter(t=>W(t)!==W(e)):[...c,Te(e)]);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Y.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Y.jsx)(`span`,{children:`Instructions for the agent`}),(0,Y.jsx)(Ze,{ref:j,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:k,onChange:e=>A(e.target.value),onSelect:e=>{M.current=e.currentTarget.selectionStart},onKeyDown:ne,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Y.jsx)(ze,{templates:N,onInsert:ee}),(0,Y.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Y.jsxs)(`div`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Workflow`}),(0,Y.jsx)(yn,{workflows:t,value:i,onChange:o})]}),(0,Y.jsxs)(`div`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Skills · select one or more`}),(0,Y.jsx)(xn,{skills:n,skillUsage:v.data?.skillUsage,selected:c,onToggle:L})]}),c.length>0?(0,Y.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:c.map(e=>(0,Y.jsx)(vn,{skill:e,skills:n,unchecked:S.unchecked,onRemove:()=>L(e)},W(e)))}):null,T?(0,Y.jsx)(`p`,{role:`alert`,children:`A selected skill path is unavailable. Remove it or choose a current copy before starting.`}):null,(0,Y.jsx)(cn,{layout:`row`,pick:d,onChange:f,disabled:I.isPending||!b.canRun,accounts:!0}),(0,Y.jsxs)(`div`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Account`}),(0,Y.jsx)(bn,{resolved:b,disabled:I.isPending||!b.canRun,onPick:e=>f({...d,account:e})})]}),!b.providerPending&&!b.canRun?(0,Y.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[b.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Y.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Y.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,Y.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[r(e.url)?(0,Y.jsx)(B,{asChild:!0,variant:`outline`,children:(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Y.jsxs)(B,{variant:`primary`,"data-action":`gh-run`,disabled:I.isPending||!b.canRun||T,onClick:()=>I.mutate(),children:[(0,Y.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,y]}),(0,Y.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground`,children:Ve()}),p?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Y.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Y.jsx)(V,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function vn({skill:e,skills:t,unchecked:n,onRemove:r}){let i=t.find(t=>t.id===e.id&&(e.path===void 0||t.path===e.path)),a=[i?.name??e.id,e.path].filter(Boolean).join(` · `),o=!n&&e.path!==void 0&&!i?` (unavailable)`:n||!i?` (unchecked)`:``;return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e.id,onClick:r,title:`Remove skill ${a}`,"aria-label":`Remove skill ${a}`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[a,o,(0,Y.jsx)(A,{size:16,"aria-hidden":`true`,className:`size-3`})]})}function yn({workflows:e,value:t,onChange:n}){let[r,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(``),c=(0,J.useRef)(null),l=xe(e,o);return(0,Y.jsxs)(ue,{open:r,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Y.jsx)(ce,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:i(Ne,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,Y.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Y.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Y.jsx)(ee,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(le,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(be,{shouldFilter:!1,children:[(0,Y.jsx)(_e,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Y.jsxs)(ye,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,Y.jsx)(ve,{children:`Nothing matches.`}):null,(0,Y.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,Y.jsxs)(U,{value:`workflow ${e.name}`,keywords:we(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Y.jsx)(O,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function bn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:l,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Y.jsx)(K,{icon:(0,Y.jsx)(k,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function xn({skills:e,skillUsage:t,selected:n,onToggle:r}){let[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(null),d=(0,J.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=De(e,s,t),g=(e,t)=>{let a=n.some(t=>W(t)===W(e));return(0,Y.jsxs)(U,{value:W(e),keywords:we(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.id,"data-selected":a?`true`:void 0,onSelect:()=>r(Te(e)),children:[(0,Y.jsx)(`span`,{className:i(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.path?(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Y.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,Y.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},W(e))};return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(je,{skill:l,onClose:()=>u(null)}),(0,Y.jsxs)(ue,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Y.jsx)(ce,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:i(Ne,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Y.jsx)(I,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Y.jsx)(ee,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(le,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(be,{shouldFilter:!1,children:[(0,Y.jsx)(_e,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,Y.jsxs)(ye,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[s.trim()&&!e.some(e=>e.id===s.trim())?(0,Y.jsx)(H,{children:(0,Y.jsxs)(U,{value:`typed-skill`,onSelect:()=>r({id:s.trim()}),children:[`Use skill id “`,s.trim(),`” (unchecked)`]})}):null,(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,Y.jsx)(ve,{children:`Nothing matches.`}):null,h?h.length>0?(0,Y.jsx)(H,{children:h.map(e=>g(e,Se(e)))}):null:(0,Y.jsxs)(Y.Fragment,{children:[f.length>0?(0,Y.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,Se(e)))}):null,p.length>0?(0,Y.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,Y.jsx)(H,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var Sn=new WeakMap;function Cn(){let e=fn(),t={workflow:e.workflow,selectedSkills:e.skills,engine:{runner:null,model:null,effort:null,account:null},queued:new Map},n=new Set;return{snapshot:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)}),update:e=>{t={...t,...e},(e.workflow!==void 0||e.selectedSkills!==void 0)&&pn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function wn(){let e=s(),{projectId:t}=d(),n=Sn.get(e);n||Sn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=Cn());let{snapshot:i,subscribe:a,update:o}=r,c=(0,J.useSyncExternalStore)(a,i,i),l=S(),u=rn(c.engine),f=g(u.runner,u.account),p=_(),m=l.data?.workflows;(0,J.useEffect)(()=>{m&&c.workflow!==null&&!m.some(e=>e.name===c.workflow)&&o({workflow:null})},[o,m,c.workflow]);let h=(0,J.useMemo)(()=>Ce(f.data??[],p.data?.skillUsage),[f.data,p.data?.skillUsage]);return{...c,workflows:l,skillList:h,skillsUnchecked:f.unchecked,setWorkflow:e=>o({workflow:e}),setSelectedSkills:e=>o({selectedSkills:e}),setEngine:e=>o({engine:e}),onQueued:(e,t)=>o({queued:new Map(i().queued).set(e,t)})}}export{Kt as a,jt as c,Q as d,vt as f,Jt as i,gt as l,_n as n,Dt as o,Xt as r,yt as s,wn as t,_t as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{A as i,Ht as a,T as o,ci as s,i as c,zt as l}from"./project-scope-context-Dgq8_2JZ.js";import{Pt as u,Tt as d,
|
|
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{A as i,Ht as a,T as o,ci as s,i as c,zt as l}from"./project-scope-context-Dgq8_2JZ.js";import{Pt as u,Tt as d,in as f,kt as ee,t as p}from"./queries-DfxoqDBz.js";import{h as m}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as h}from"./toaster-Bo5vCbz-.js";import{J as g,S as _,X as v,at as y,b as te,c as ne,ft as re,i as b,l as x,lt as S,n as ie,ot as ae,st as C,tt as oe,v as w,x as T}from"./design-icons-CzEoMH9c.js";import{t as E}from"./button-BQ2y4XRB.js";import{i as D,p as se,r as O,t as ce}from"./dropdown-menu-4e2iKSMT.js";import{i as k,o as le,r as A,s as ue,t as j}from"./dialog-BVF6dIeS.js";import{i as de,l as fe,o as pe}from"./skills-pM_PouEs.js";import{t as me}from"./centered-state-V15AR_qo.js";import{Bt as M,Gt as N,Hn as P,Ht as F,Kt as I,T as he,Ut as L,Vt as R,Wt as z,qt as B}from"./index-jtycbyRq.js";import{_ as V,a as ge,c as _e,f as ve,g as ye,h as be,i as xe,m as H,n as Se,o as Ce,p as U,r as W,t as G,u as we}from"./sortable.esm-CAVTYaA3.js";import{t as K}from"./textarea-vJt9undk.js";var q=e(t(),1);function J(e){let t=[];for(let n of e){if(n.kind===`plugin`||n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.timeoutMs!==void 0||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Te(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function Ee(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function De(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function Oe(e,t){return e.filter((e,n)=>n!==t)}function Y(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function X(e,t,n){let r=` `.repeat(n);return t.includes(`
|
|
2
2
|
`)?[`${r}${e}: |`,...t.split(`
|
|
3
3
|
`).map(e=>`${r} ${e}`)]:[`${r}${e}: ${Y(t)}`]}function ke(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${Y(e.name)}`),e.skill&&t.push(` skill: ${Y(e.skill)}`),t}function Ae(e){let t=[];return e.model&&t.push(` model: ${Y(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${Y(e.effort)}`),e.runner&&t.push(` runner: ${Y(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${Y(e.agentProfile)}`),t}function Z(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(Y).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(Y).join(`, `)}]`),t}function je(e){return e.onFail?[` onFail:`,` retry: ${Y(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function Me(e){return[` - id: ${Y(e.id)}`,...ke(e),...e.prompt?X(`prompt`,e.prompt,4):[],...e.kind===`plugin`?[` kind: plugin`,` pluginKind: ${Y(e.pluginKind)}`,...e.config===void 0?[]:[` config: ${JSON.stringify(e.config)}`]]:[],...Ae(e),...Z(e),...e.command?X(`command`,e.command,4):[],...je(e)]}function Ne(e,t,n){let r=[`name: ${Y(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...X(`description`,t.trim(),0));let i=J(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${Y(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...Me(e))}else r.push(`skills: []`);return`${r.join(`
|
|
4
4
|
`)}\n`}function Pe(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function Fe(e){let t=J(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Ie(e,t){let n=new Set,r=[];for(let t of e.steps.slice(0,8)){let e=t.id||`step`,i=e;for(let t=2;n.has(i);t++)i=`${e}-${t}`;n.add(i),r.push({...t,id:i})}return{name:e.name?.trim()||t,steps:r}}function Le(e,t,n){let r=J(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var Q=n();function Re({workflows:e,draft:t,trimmedName:n,nameRef:r,onDraft:i,onLoadWorkflow:a}){return(0,Q.jsxs)(`section`,{"data-slot":`wb-metadata`,className:`flex min-w-0 flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex flex-col items-start gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs text-muted-foreground`,children:`Load an existing workflow`}),(0,Q.jsxs)(`div`,{className:`relative max-w-full`,children:[(0,Q.jsx)(x,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsxs)(`select`,{id:`workflow-load`,value:e.some(e=>e.name===n)?n:``,onChange:t=>{let n=e.find(e=>e.name===t.target.value);n&&a(n)},className:`h-11 max-w-full rounded-lg border border-border bg-card pl-9 pr-3 text-xs font-medium appearance-none focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(`option`,{value:``,disabled:!0,children:`Choose a workflow`}),e.map(e=>(0,Q.jsx)(`option`,{value:e.name,"data-slot":`wb-load-option`,"data-name":e.name,children:e.name},e.name))]})]})]}),(0,Q.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-semibold`,children:`Workflow name`}),(0,Q.jsx)(P,{id:`workflow-name`,ref:r,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:t.name,onChange:e=>i({...t,name:e.target.value}),className:`h-12 bg-card text-sm`}),(0,Q.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-semibold`,children:`Description`}),(0,Q.jsx)(K,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,value:t.description,onChange:e=>i({...t,description:e.target.value}),className:`min-h-[72px] bg-card p-3.5 text-sm`})]})}function ze({savedFile:e,autoOpen:t,onImportToggle:n,onExport:r,onAutoToggle:i,onDeleteRequest:a}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-actions`,className:`grid grid-cols-[max-content_max-content] items-center justify-start gap-2 sm:flex sm:flex-wrap [&_button]:min-h-11 [&_button]:border [&_button]:border-border [&_button]:bg-card`,children:[(0,Q.jsxs)(E,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:n,children:[(0,Q.jsx)(C,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,Q.jsxs)(E,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:r,children:[(0,Q.jsx)(te,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,Q.jsxs)(E,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":t,title:`Describe a chain — the agent builds it`,onClick:i,children:[(0,Q.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),`Auto`]}),e?(0,Q.jsxs)(E,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-delete`,className:`text-danger hover:text-danger`,title:`Delete the saved workflow file`,onClick:a,children:[(0,Q.jsx)(y,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function Be({text:e,onTextChange:t,pending:n,onRun:r,onCancel:i}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] leading-relaxed text-muted-foreground`,children:`Describe the outcome. An agent proposes a title and ordered skill/check steps. Review the result, edit it, then Save.`}),(0,Q.jsx)(K,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),r())},className:`mt-4 min-h-[108px] bg-background p-4 text-sm`}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsxs)(E,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:n||e.trim()===``,onClick:r,children:[(0,Q.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),n?`Building…`:`Build chain`]}),(0,Q.jsxs)(E,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:i,children:[(0,Q.jsx)(re,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,Q.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function Ve({open:e,onOpenChange:t,text:n,onTextChange:r,error:i,pending:a,onRun:o,onCancel:s}){return(0,Q.jsx)(j,{open:e,onOpenChange:t,children:(0,Q.jsxs)(A,{showCloseButton:!1,"data-slot":`wb-import-panel`,className:`max-md:translate-x-0 max-md:translate-y-0 sm:max-w-[660px] rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(ue,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,Q.jsx)(k,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,Q.jsx)(K,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{M as r,
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{M as r,q as i,qt as a}from"./queries-DfxoqDBz.js";import{n as o}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import"./tasks-table-DS9DShj0.js";import{n as s}from"./toaster-Bo5vCbz-.js";import{t as c}from"./button-BQ2y4XRB.js";import{t as l}from"./status-dot-DtAOFiIi.js";import{r as u,t as d}from"./agents-settings-path-7X6_cvUg.js";import{Jt as f,Un as p,Vn as m,Xt as h,Yt as g,Zt as _,zn as v}from"./index-jtycbyRq.js";var y=e(t(),1),b=n();function x({health:e,projects:t,repository:n,onAction:r}){return(0,b.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-6 max-md:p-4`,"aria-labelledby":`add-project-heading`,children:[(0,b.jsx)(`h2`,{id:`add-project-heading`,className:`text-lg font-normal leading-[1.5]`,children:`Add project`}),(0,b.jsx)(`p`,{className:`text-[13px] leading-[1.5] text-muted-foreground`,children:`Start a new repository, open an existing local folder, or clone a GitHub repository.`}),(0,b.jsxs)(`dl`,{className:`space-y-4 text-[13px] leading-[1.5] text-muted-foreground`,children:[e.data?.repoRoot?(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,b.jsx)(`dt`,{children:`Local folder`}),(0,b.jsx)(`dd`,{className:`min-w-0 break-all`,children:e.data.repo?.root??e.data.repoRoot})]}):null,n?(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,b.jsx)(`dt`,{children:`Repository`}),(0,b.jsx)(`dd`,{className:`min-w-0 break-all`,children:n.replace(/^https:\/\//,``)})]}):null,t.data?.projectsDir?(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,b.jsx)(`dt`,{children:`Checkout folder`}),(0,b.jsx)(`dd`,{className:`min-w-0 break-all`,children:t.data.projectsDir})]}):null]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,b.jsx)(c,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,"data-action":`new-project`,onClick:()=>r(`new`),children:`New project`}),(0,b.jsx)(c,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,onClick:()=>r(`local`),children:`Open local folder`}),(0,b.jsx)(c,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,onClick:()=>r(`clone`),children:`Clone from GitHub`})]})]})}function S({health:e,copying:t,onCopy:n}){return(0,b.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-6 max-md:p-4`,"aria-labelledby":`tools-heading`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,b.jsx)(`h2`,{id:`tools-heading`,className:`text-lg font-normal leading-[1.5]`,children:`Tools diagnostics`}),(0,b.jsx)(o,{to:d,"data-slot":`tools-settings`,className:f,children:`Tool settings ›`})]}),(0,b.jsx)(`p`,{className:`text-[13px] leading-[1.5] text-muted-foreground`,children:`Check the tools available to this local workspace.`}),e.isError?(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Could not refresh tool diagnostics. Recheck to retry.`}):null,!e.data&&!e.isError?(0,b.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Checking installed tools…`}):null,e.data?(0,b.jsx)(`dl`,{className:`space-y-4 text-[13px] leading-[1.5] text-muted-foreground`,children:e.data.checks.map(e=>{let t=g(e);return(0,b.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":e.available,className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,b.jsxs)(`dt`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(l,{tone:_(e)}),(0,b.jsx)(`span`,{className:`font-mono text-[13px] font-medium text-foreground`,children:e.name})]}),(0,b.jsxs)(`dd`,{className:`flex min-w-0 flex-1 items-center gap-x-3 text-muted-foreground`,children:[(0,b.jsxs)(`span`,{className:`min-w-0 break-words`,children:[h(e),e.version?` · ${e.version}`:``]}),e.available?null:(0,b.jsx)(o,{to:u(e.name),"data-slot":`tool-setup`,className:`${f} ml-auto`,children:`Set up ›`})]}),t?(0,b.jsx)(`dd`,{"data-slot":`tool-hint`,className:`basis-full min-w-0 break-words pl-[15px] text-xs leading-snug text-muted-foreground`,children:t}):null]},e.name)})}):null,e.data?.checks.length===0?(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tool diagnostics reported by this server.`}):null,(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,b.jsx)(c,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:e.isFetching?`Checking tools…`:`Recheck tools`}),(0,b.jsx)(c,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,disabled:!e.data||t,onClick:()=>void n(),children:t?`Copying…`:`Copy diagnostics`})]})]})}function C(){let e=r(),t=i(),n=a(e.data?.repo?.remote),[o,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(!1);return(0,b.jsxs)(`div`,{"data-route":`workspace-tools`,className:`w-full space-y-[22px] px-9 py-9 max-md:px-[18px] max-md:py-6`,children:[(0,b.jsx)(`h1`,{className:`text-[28px] font-normal leading-[1.5] max-md:text-[24px]`,children:`Workspace tools`}),(0,b.jsx)(x,{health:e,projects:t,repository:n,onAction:c}),(0,b.jsx)(S,{health:e,copying:l,onCopy:async()=>{if(!(!e.data||l)){u(!0);try{await navigator.clipboard.writeText(JSON.stringify({version:e.data.version,checks:e.data.checks},null,2)),s(`Diagnostics copied`)}catch{s(`Could not copy diagnostics. Please try again.`,{tone:`danger`})}finally{u(!1)}}}}),o===`new`?(0,b.jsx)(v,{open:!0,onOpenChange:e=>{e||c(null)}}):null,o===`local`?(0,b.jsx)(p,{open:!0,onOpenChange:e=>{e||c(null)}}):null,o===`clone`?(0,b.jsx)(m,{open:!0,onOpenChange:e=>{e||c(null)}}):null]})}export{C as WorkspaceToolsRoute};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Kt as r,Mr as i,ci as a,i as o,jr as s}from"./project-scope-context-Dgq8_2JZ.js";import{M as c,
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Kt as r,Mr as i,ci as a,i as o,jr as s}from"./project-scope-context-Dgq8_2JZ.js";import{M as c,in as l,p as u,t as d}from"./queries-DfxoqDBz.js";import{n as f}from"./toaster-Bo5vCbz-.js";import{u as p}from"./design-icons-CzEoMH9c.js";import{t as m}from"./button-BQ2y4XRB.js";import{t as h}from"./project-router-DtTvMbeA.js";import{t as g}from"./centered-state-V15AR_qo.js";import{Yn as _}from"./index-jtycbyRq.js";import{n as v,r as y,t as b}from"./remote-settings-notice-DXgS_yXZ.js";import{t as x}from"./settings-field-Bl6WuvGX.js";import{n as S}from"./project-location-Do0zCjuE.js";var C=e(t(),1),w=n();function T({copy:e,savedCommandCount:t,settingsAdmin:n,configPath:r,issue:i,invalid:a,children:o}){let s=e.slot;return(0,w.jsxs)(w.Fragment,{children:[t===0&&i===null?(0,w.jsx)(`p`,{"data-slot":`${s}-empty`,className:`text-sm text-foreground`,children:e.empty}):null,o,n===!1?(0,w.jsxs)(`p`,{"data-slot":`${s}-readonly`,className:`text-xs text-foreground`,children:[`Edit `,(0,w.jsxs)(`code`,{children:[e.key,`.commands`]}),` in`,` `,r===null?(0,w.jsxs)(w.Fragment,{children:[`the project’s `,(0,w.jsx)(`code`,{children:`.ai/cezar/config.json`})]}):(0,w.jsx)(`code`,{className:`break-all`,children:r}),` `,`on the machine running Squawk. `,e.fileEditApplies,` No restart is needed. To edit here, the host operator runs `,(0,w.jsx)(`code`,{children:b}),`.`]}):null,i===null?null:(0,w.jsxs)(`p`,{"data-slot":`${s}-issue`,className:`text-[11px] text-danger`,children:[`config.json has an invalid `,e.key,` (`,i,`) — saving replaces it.`]}),a===null?null:(0,w.jsx)(`p`,{"data-slot":`${s}-invalid`,className:`text-[11px] text-danger`,children:a})]})}function E(e,t){let n=e.split(`
|
|
2
2
|
`).map(e=>e.trim()).filter(e=>e!==``),r=Number(t);return{commands:n,timeoutSeconds:r,invalid:n.length>20?`Enter at most 20 commands.`:n.some(e=>e.length>4e3)?`Keep each command under ${s.toLocaleString(`en-US`)} characters.`:t.trim()===``||!Number.isInteger(r)||r<1||r>7200?`Enter a whole number of seconds from 1 to ${i}.`:null}}var D={setup:{key:`worktreeSetup`,issueKey:`worktreeSetupIssue`,slot:`worktree-setup`,title:`Prepare new worktrees`,hint:`Runs in every new task and worker worktree before the agent starts, in order, stopping at the first failure. Leave commands empty to skip setup.`,empty:`No setup commands configured. No commands will run in new worktrees.`,label:`Worktree setup commands, one per line`,example:`npm ci`,fileEditApplies:`Valid file edits apply to new worktrees.`,saved:`Worktree setup saved`,cleared:`Worktree setup cleared`,save:`Save setup`},teardown:{key:`worktreeTeardown`,issueKey:`worktreeTeardownIssue`,slot:`worktree-teardown`,title:`Stop worker services before destroy`,hint:`Runs in a worker’s worktree when the worker is destroyed, before destroy stops the worker’s processes, in order, stopping at the first failure. A failure is recorded on the worker and destroy goes on. Leave commands empty to skip teardown.`,empty:`No teardown commands configured. Destroy runs no commands in worker worktrees.`,label:`Worktree teardown commands, one per line`,example:`docker compose down`,fileEditApplies:`Valid file edits apply to the next worker destroy.`,saved:`Worktree teardown saved`,cleared:`Worktree teardown cleared`,save:`Save teardown`}};function O({config:e,copy:t}){let n=a(),s=c(),u=y(),p=S(),h=p===null?null:`${p.replace(/\/$/,``)}/.ai/cezar/config.json`,g=s.data?.capabilities?.settingsAdmin===!0,_=e[t.key],b=e[t.issueKey],D=_?.commands??[],O=_?.timeoutSeconds??900,[k,A]=(0,C.useState)(D.join(`
|
|
3
3
|
`)),[j,M]=(0,C.useState)(String(O)),{commands:N,timeoutSeconds:P,invalid:F}=E(k,j),I=b===null&&N.length===D.length&&N.every((e,t)=>e===D[t])&&(N.length===0||P===O),L=l({mutationFn:e=>r(e),onSuccess:e=>{n.setQueryData(d.config,e),A(N.join(`
|
|
4
4
|
`)),f(N.length===0?t.cleared:t.saved)},onError:e=>{f(e.message,{tone:`danger`}),e instanceof o&&e.status===409&&u()}}),R=()=>L.mutate({[t.key]:N.length===0?null:{commands:N,...P===900?{}:{timeoutSeconds:P}}}),z=`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50 read-only:bg-muted read-only:text-muted-foreground`;return(0,w.jsxs)(x,{title:t.title,hint:t.hint,children:[(0,w.jsx)(v,{risk:`These commands run on the machine running Squawk`}),(0,w.jsxs)(T,{copy:t,savedCommandCount:D.length,settingsAdmin:s.data?.capabilities?.settingsAdmin,configPath:h,issue:b,invalid:F,children:[(0,w.jsx)(`textarea`,{"data-slot":`${t.slot}-commands`,"aria-label":t.label,rows:4,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,value:k,readOnly:!g,disabled:L.isPending,onChange:e=>A(e.target.value),className:`${z} min-h-24 w-full resize-y font-mono text-[13px] leading-relaxed`}),(0,w.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`Example only: `,(0,w.jsx)(`code`,{children:t.example}),`. Commands run only after they are saved.`]}),(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-soft-foreground`,children:[(0,w.jsx)(`span`,{children:`Timeout per command`}),(0,w.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:1,max:i,step:1,"data-slot":`${t.slot}-timeout`,value:j,readOnly:!g,disabled:L.isPending,onChange:e=>M(e.target.value),className:`${z} min-h-11 w-28 md:min-h-0`}),(0,w.jsx)(`span`,{children:`seconds`})]}),(0,w.jsx)(m,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 self-start md:min-h-0`,"data-action":`${t.slot}-save`,disabled:!g||I||F!==null||L.isPending,onClick:R,children:t.save})]})]})]})}var k=0,A=1e3;function j(){let e=u();return e.isPending?(0,w.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,w.jsx)(g,{icon:(0,w.jsx)(_,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,w.jsx)(M,{config:e.data})}function M({config:e}){let t=a(),n=l({mutationFn:e=>r(e),onSuccess:e=>t.setQueryData(d.config,e),onError:e=>f(e.message,{tone:`danger`})}),[i,o]=(0,C.useState)(String(e.worktreeRetention)),s=Number(i),c=i.trim()===``||!Number.isInteger(s)||s<k||s>A,u=e.worktreeRetention===(c?-1:s);return(0,w.jsxs)(`div`,{"data-slot":`worktrees-section`,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,w.jsxs)(x,{title:`Keep N finished worktrees`,hint:`Older finished worktrees are reclaimed to free disk; their branch is kept so the work stays recoverable. 0 = unlimited. In-review and running tasks are never reclaimed, so the count on disk can exceed this.`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:k,max:A,step:1,"aria-label":`Keep last N finished worktrees`,"data-slot":`resources-worktree-retention`,value:i,disabled:n.isPending,onChange:e=>o(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,w.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`worktrees`}),(0,w.jsx)(m,{type:`button`,variant:`primary`,size:`sm`,className:`self-start`,"data-action":`resources-save-retention`,disabled:u||c||n.isPending,onClick:()=>n.mutate({worktreeRetention:s},{onSuccess:()=>{t.invalidateQueries({queryKey:d.worktrees}),f(s===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${s} finished worktree${s===1?``:`s`}`)}}),children:`Save retention`})]}),c?(0,w.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,k,` to `,A,` (0 = unlimited).`]}):(0,w.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:s===0?`Keeping every finished worktree.`:`Keeping the last ${s} finished worktree${s===1?``:`s`} on disk.`})]}),(0,w.jsx)(O,{config:e,copy:D.setup}),(0,w.jsx)(O,{config:e,copy:D.teardown}),(0,w.jsxs)(h,{to:`/git/cleanup`,"data-slot":`worktrees-manage-link`,className:`inline-flex min-h-11 items-center gap-1 self-start text-[13px] font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring md:min-h-0`,children:[`Manage worktrees on Git`,(0,w.jsx)(p,{"aria-hidden":`true`,className:`size-[14px]`})]})]})}export{j as WorktreesSection};
|
package/web/dist/index.html
CHANGED
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
}
|
|
60
60
|
})()
|
|
61
61
|
</script>
|
|
62
|
-
<script type="module" crossorigin src="/assets/index-
|
|
62
|
+
<script type="module" crossorigin src="/assets/index-jtycbyRq.js"></script>
|
|
63
63
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
|
|
64
64
|
<link rel="modulepreload" crossorigin href="/assets/react-runtime-CCIEwYL0.js">
|
|
65
65
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-rHxsej31.js">
|
|
@@ -71,17 +71,16 @@
|
|
|
71
71
|
<link rel="modulepreload" crossorigin href="/assets/useQuery-BUslvRIM.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="/assets/ws-Bal5BUy2.js">
|
|
73
73
|
<link rel="modulepreload" crossorigin href="/assets/toaster-Bo5vCbz-.js">
|
|
74
|
-
<link rel="modulepreload" crossorigin href="/assets/queries-
|
|
74
|
+
<link rel="modulepreload" crossorigin href="/assets/queries-DfxoqDBz.js">
|
|
75
75
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
|
|
76
76
|
<link rel="modulepreload" crossorigin href="/assets/chunk-KS7C4IRE-Cg8l-LDN.js">
|
|
77
77
|
<link rel="modulepreload" crossorigin href="/assets/cez-idle-Crszm9Ts.js">
|
|
78
78
|
<link rel="modulepreload" crossorigin href="/assets/dist-BW234Kg5.js">
|
|
79
79
|
<link rel="modulepreload" crossorigin href="/assets/dist-C5mlVBmd.js">
|
|
80
|
-
<link rel="modulepreload" crossorigin href="/assets/label-
|
|
80
|
+
<link rel="modulepreload" crossorigin href="/assets/label-9ElpAxAO.js">
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/attention-otQlgfRj.js">
|
|
82
|
-
<link rel="modulepreload" crossorigin href="/assets/task-groups-
|
|
83
|
-
<link rel="modulepreload" crossorigin href="/assets/tasks-table-
|
|
84
|
-
<link rel="modulepreload" crossorigin href="/assets/runners-CDw7wLfd.js">
|
|
82
|
+
<link rel="modulepreload" crossorigin href="/assets/task-groups-BWeTwWTP.js">
|
|
83
|
+
<link rel="modulepreload" crossorigin href="/assets/tasks-table-DS9DShj0.js">
|
|
85
84
|
<link rel="modulepreload" crossorigin href="/assets/design-icons-CzEoMH9c.js">
|
|
86
85
|
<link rel="modulepreload" crossorigin href="/assets/createLucideIcon-BHp8sXmF.js">
|
|
87
86
|
<link rel="modulepreload" crossorigin href="/assets/bot-TkDIw4y-.js">
|
|
@@ -95,17 +94,17 @@
|
|
|
95
94
|
<link rel="modulepreload" crossorigin href="/assets/dist-BAoXdNsT.js">
|
|
96
95
|
<link rel="modulepreload" crossorigin href="/assets/dropdown-menu-4e2iKSMT.js">
|
|
97
96
|
<link rel="modulepreload" crossorigin href="/assets/own-lookup-DS54wXvD.js">
|
|
98
|
-
<link rel="modulepreload" crossorigin href="/assets/open-in-menu-
|
|
97
|
+
<link rel="modulepreload" crossorigin href="/assets/open-in-menu-jthe8d7_.js">
|
|
99
98
|
<link rel="modulepreload" crossorigin href="/assets/dist-C28wFbz0.js">
|
|
100
99
|
<link rel="modulepreload" crossorigin href="/assets/chevron-down-CHGyCDBH.js">
|
|
101
100
|
<link rel="modulepreload" crossorigin href="/assets/nav-row-styles-DqKjMToI.js">
|
|
102
101
|
<link rel="modulepreload" crossorigin href="/assets/chevron-right-BENZ-1ZN.js">
|
|
103
|
-
<link rel="modulepreload" crossorigin href="/assets/folder-browser-
|
|
102
|
+
<link rel="modulepreload" crossorigin href="/assets/folder-browser-zsT1W215.js">
|
|
104
103
|
<link rel="modulepreload" crossorigin href="/assets/eye-B8okNWXU.js">
|
|
105
104
|
<link rel="modulepreload" crossorigin href="/assets/format-BNCkW110.js">
|
|
106
105
|
<link rel="modulepreload" crossorigin href="/assets/play-CmVAj_fu.js">
|
|
107
106
|
<link rel="modulepreload" crossorigin href="/assets/popover-BPgUYFyu.js">
|
|
108
|
-
<link rel="modulepreload" crossorigin href="/assets/reference-chip-
|
|
107
|
+
<link rel="modulepreload" crossorigin href="/assets/reference-chip-B9Cnr6jR.js">
|
|
109
108
|
<link rel="modulepreload" crossorigin href="/assets/dist-Da4ckcJG.js">
|
|
110
109
|
<link rel="modulepreload" crossorigin href="/assets/switch-Bv2Zf1uU.js">
|
|
111
110
|
<link rel="modulepreload" crossorigin href="/assets/badge-D9JrXe0o.js">
|
|
@@ -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{Ar as r,Jt as i,ci as a,f as o,hn as s,i as c}from"./project-scope-context-Dgq8_2JZ.js";import{At as l,Et as u,J as d,M as f,Nt as p,Wt as m,X as h,Yt as g,g as _,m as v,o as y,r as b,tt as ee}from"./queries-yuG-mM6_.js";import{t as te}from"./useQuery-BUslvRIM.js";import{f as x}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as S}from"./toaster-Bo5vCbz-.js";import{i as ne,r as C,s as w,t as re}from"./runners-CDw7wLfd.js";import{y as T}from"./design-icons-CzEoMH9c.js";import{t as E}from"./createLucideIcon-BHp8sXmF.js";import{t as D}from"./folder-browser-G_9ZgDjg.js";import{t as O}from"./button-BQ2y4XRB.js";import{t as k}from"./badge-D9JrXe0o.js";import{a as A,i as j,o as M,r as N,s as P,t as F}from"./dialog-BVF6dIeS.js";import{t as I}from"./status-dot-DtAOFiIi.js";import{n as L}from"./agents-settings-path-7X6_cvUg.js";import{t as R}from"./centered-state-V15AR_qo.js";import{Bt as z,Gt as B,Ht as V,Kt as H,N as U,Ut as W,Vt as G,Wt as K,j as q,qt as J}from"./index-DXIRYobS.js";import{n as Y,r as X,t as ie}from"./settings-agent-picker-3uuSf9LK.js";var ae=E(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Z=e(t(),1),Q=n(),oe=`~/.claude-second`;function se({open:e,onOpenChange:t,providers:n,initialProvider:r}){let i=w().data,[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)(r??n[0]??`claude`),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(!1),v=_(),y=p.trim();return(0,Q.jsx)(F,{open:e,onOpenChange:t,children:(0,Q.jsxs)(N,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,Q.jsxs)(M,{children:[(0,Q.jsx)(P,{children:`Add agent account`}),(0,Q.jsx)(j,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,Q.jsx)(`select`,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:l,onChange:e=>u(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`,children:n.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,Q.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:d,placeholder:`Work`,onChange:e=>f(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,Q.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:p,placeholder:C(i,l)?.accountFolderExample??oe,onChange:e=>{m(e.target.value),c(null),v.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,Q.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":h,onClick:()=>g(e=>!e),children:h?`Hide folders`:`Browse…`})]}),(0,Q.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`A `,(0,Q.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),h?(0,Q.jsx)(D,{path:a,selected:s,onSelect:e=>{c(e),m(e.path),v.reset()},onEnter:e=>{o(e),c(null),v.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,v.isError?(0,Q.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:v.error instanceof Error?v.error.message:`could not add that folder`}):null,(0,Q.jsxs)(A,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,Q.jsx)(O,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(O,{"data-slot":`add-account-confirm`,disabled:y===``||v.isPending,onClick:()=>{y===``||v.isPending||v.mutate({provider:l,configDir:y,...d.trim()?{label:d.trim()}:{}},{onSuccess:()=>{t(!1),f(``),m(``),c(null),g(!1),S(`Account added — use Connect to sign in`)}})},children:v.isPending?`Adding…`:`Add account`})]})]})})}async function ce(e){return s(await o.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function le(e,t){return s(await o.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var ue={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function de(e){let t=f().data?.capabilities?.settingsAdmin===!0,n=a(),r=[`runner-install`,e],i=te({queryKey:r,queryFn:()=>ce(e),enabled:t,retry:!1,refetchInterval:e=>{if(e.state.error)return!1;let t=e.state.data?.phase;return t&&t!==`idle`&&t!==`failed`?1e3:6e4}}),o=g({mutationFn:t=>le(e,t),retry:!1,onSuccess:e=>{n.setQueryData(r,e)}}),s=i.data;return{allowed:t,data:s,busy:o.isPending||!!s&&s.phase!==`idle`&&s.phase!==`failed`,error:o.error?.message??i.error?.message??s?.error,action:o,status:i}}function fe({state:e}){let{data:t,busy:n,action:r,status:i}=e;if(t?.supported===!1)return(0,Q.jsx)(`p`,{children:`This host is not supported by the CLI installer.`});let a=!!t?.installedVersion;return(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(O,{className:`min-h-11 active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,Q.jsx)(O,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,Q.jsx)(O,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function pe({runner:e}){let t=de(e),{allowed:n,data:r,busy:i,error:a}=t;return n?(0,Q.jsxs)(`section`,{"aria-label":`CLI installation`,className:`grid gap-3`,children:[(0,Q.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[r?.installedVersion?`Installed CLI ${r.installedVersion}`:`CLI not installed`,r?.latestVersion?` · Latest ${r.latestVersion}`:``,i&&r?` · ${ue[r.phase]}`:``]}),a?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,Q.jsx)(fe,{state:t}),r?.installedVersion?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removing the CLI keeps account data and lets running tasks finish.`}):null]}):null}var $={connected:{label:`Connected`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function me(){let e=y(),t=w();if(e.isPending||t.isPending)return(0,Q.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agents…`});let n=e.error??t.error;return n?(0,Q.jsx)(R,{icon:(0,Q.jsx)(ae,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,Q.jsx)(ge,{data:e.data,runners:t.data})}function he(){let{hash:e}=x();(0,Z.useEffect)(()=>{if(!e)return;let t=document.getElementById(decodeURIComponent(e.slice(1)));t&&(t.scrollIntoView?.({block:`start`}),t.focus({preventScroll:!0}))},[e])}function ge({data:e,runners:t}){let n=f(),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(null),s=ee();return he(),(0,Q.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Install, update and sign in to each agent, and set what a project runs when it has not chosen.`}),e.editable?null:(0,Q.jsx)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-soft-foreground`,children:`Agent accounts are managed from the machine that owns the checkout — this cockpit runs in hosted mode.`}),(0,Q.jsx)(`div`,{"data-slot":`agent-cards`,className:`flex flex-col gap-4`,children:t.runners.map(r=>(0,Q.jsx)(ve,{entry:r,check:n.data?.checks?.find(e=>e.name===r.id),settingsAdmin:n.data?.capabilities?.settingsAdmin===!0,runners:t,editable:e.editable,accounts:e.profiles.filter(e=>e.provider===r.id),canCarryAccounts:e.profileCapableProviders.includes(r.id),onAdd:()=>i(r.id),onRemove:o},r.id))}),(0,Q.jsx)(ye,{runners:t}),r===null?null:(0,Q.jsx)(se,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,Q.jsx)(z,{open:a!==null,onOpenChange:e=>!e&&o(null),children:(0,Q.jsxs)(W,{"data-slot":`accounts-remove-confirm`,children:[(0,Q.jsxs)(H,{children:[(0,Q.jsxs)(J,{children:[`Remove “`,a?.label,`”?`]}),(0,Q.jsxs)(K,{children:[`This only forgets the account. Nothing in `,a?.configDir,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(V,{children:`Cancel`}),(0,Q.jsx)(G,{"data-action":`accounts-remove-confirm`,disabled:s.isPending,onClick:()=>{let e=a;e&&s.mutate(e.id,{onSuccess:()=>{o(null),S(`Removed ${e.label}`)},onError:e=>S(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]})}function _e({entry:e,check:t}){return t===void 0?(0,Q.jsx)(`span`,{"data-slot":`agent-installed`,children:`Checking…`}):t.available?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"data-slot":`agent-installed`,children:`Installed`}),t.version?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,Q.jsx)(`span`,{"data-slot":`agent-version`,children:t.version})]}):null]}):(0,Q.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`Not installed`,e.installHint?(0,Q.jsxs)(Q.Fragment,{children:[` — `,(0,Q.jsx)(`code`,{className:`break-all`,children:e.installHint})]}):null]})}function ve({entry:e,check:t,settingsAdmin:n,runners:r,editable:i,accounts:a,canCarryAccounts:o,onAdd:s,onRemove:c}){let l=e.id,u=e.managedInstall===!0&&n,d=a.filter(e=>e.isDefault).length,f=`${L(l)}-title`;return(0,Q.jsxs)(`section`,{id:L(l),tabIndex:-1,"aria-labelledby":f,"data-slot":`accounts-provider`,"data-provider":l,className:`settings-agent-card flex flex-col gap-4 rounded-lg border border-border bg-card p-4`,children:[(0,Q.jsx)(`h3`,{id:f,className:`settings-account-provider-title`,children:e.displayName}),u?(0,Q.jsx)(pe,{runner:l}):null,(0,Q.jsxs)(`div`,{className:`settings-account-installation settings-readout`,children:[u?null:(0,Q.jsx)(_e,{entry:e,check:t}),i?(0,Q.jsxs)(`span`,{className:`settings-account-count`,children:[a.length,` `,a.length===1?`account`:`accounts`,` (`,d,` discovered, `,a.length-d,` added)`]}):null]}),i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`ul`,{children:a.map(e=>(0,Q.jsx)(Se,{account:e,runners:r,onRemove:()=>c(e)},e.id))}),o?(0,Q.jsx)(`div`,{className:`settings-account-add-row`,children:(0,Q.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`})}):(0,Q.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`text-[11px] text-soft-foreground`,children:[e.displayName,` can only hold one account here: it keeps its credentials outside its config folder, so a second folder would change settings without changing the login — which would say “work account” while billing the other one.`]})]}):e.browserLogin?(0,Q.jsxs)(`div`,{"data-slot":`hosted-sign-in`,className:`flex flex-wrap items-center gap-3`,children:[(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Discovered account`}),(0,Q.jsx)(Y,{provider:l,label:e.displayName})]}):null]})}function ye({runners:e}){let[t,n]=(0,Z.useState)(null),r=a(),o=l(),s=d(),c=m(ne(e)),u=g({mutationFn:e=>i(e),onSuccess:e=>r.setQueryData(p.config,e),onError:e=>S(e.message,{tone:`danger`})});if(o.data===void 0)return null;let f=X([],e),h=o.data.agentDefaults.runner??`claude`,_=o.data.agentDefaults.models??{};return(0,Q.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own.`})]}),(0,Q.jsx)(ie,{rows:f,runner:h,accountFor:()=>null,providerStatus:s,disabled:u.isPending,onPick:e=>{e!==h&&u.mutate({agentDefaults:{runner:e}})}}),(0,Q.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,Q.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,Q.jsx)(`span`,{children:`Default model for`}),(0,Q.jsx)(`select`,{"aria-label":`Model agent`,value:t??h,onChange:e=>n(e.target.value),children:e.runners.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.displayName},e.id))})]}),e.runners.filter(e=>e.id===(t??h)).map(t=>(0,Q.jsxs)(`label`,{className:`settings-account-model flex items-center gap-3`,children:[(0,Q.jsx)(T,{className:`size-4 text-accent-icon shrink-0`}),(0,Q.jsx)(`span`,{className:`w-24 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,Q.jsxs)(`select`,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:_[t.id]??``,disabled:u.isPending,onChange:e=>u.mutate({agentDefaults:{models:{[t.id]:e.target.value||null}}}),className:`block w-full max-w-xs rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[U(t.id,e,c[t.id]?.data,[_[t.id]]).map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.id===``?`Native default`:e.label},e.id)),(0,Q.jsx)(be,{runner:t.id,runners:e,catalog:c[t.id]})]})]},t.id))]})]})}function be({runner:e,runners:t,catalog:n}){let r=q(e,t,n);return r?(0,Q.jsx)(`option`,{disabled:!0,children:r}):null}function xe({account:e,runners:t,status:n}){let r=v();return(0,Q.jsxs)(Q.Fragment,{children:[n&&n.status!==`connected`&&C(t,e.provider)?.browserLogin?(0,Q.jsx)(Y,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,n&&n.status!==`connected`&&C(t,e.provider)?.terminalLogin!==!1?(0,Q.jsx)(O,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:r.isPending,onClick:()=>r.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>S(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>S(e instanceof c&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function Se({account:e,runners:t,onRemove:n}){let i=r(e),a=h(),o=b(i,e.status===void 0),s=e.status??o.data?.status,c=s?$[s.status]:void 0;return(0,Q.jsx)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`flex flex-col gap-2 px-3.5 py-3`,children:(0,Q.jsxs)(`div`,{className:`settings-account-card`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-foreground`,children:e.label}),e.isDefault?(0,Q.jsx)(k,{variant:`ghost`,className:`shrink-0 text-[12px] text-muted-foreground`,children:`discovered`}):null]}),(0,Q.jsxs)(`div`,{className:`settings-account-readout settings-readout`,children:[(0,Q.jsx)(`p`,{"data-slot":`account-path`,className:`mt-0.5 truncate font-mono text-[11px] text-soft-foreground`,title:e.path,children:e.configDir}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(I,{tone:c?.tone??`neutral`,pulse:c===void 0}),(0,Q.jsx)(`span`,{"data-slot":`account-status`,children:c?.label??`Checking…`}),!s||s.requiresAccountHome===!1?null:e.exists?e.looksValid?null:(0,Q.jsxs)(`span`,{"data-slot":`account-unrecognised`,children:[`— this folder does not look like `,re(t,e.provider),` config yet`]}):(0,Q.jsx)(`span`,{"data-slot":`account-missing`,children:`— folder not created yet; Connect will make it`})]}),s?.hint?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s.hint}):null]})]}),(0,Q.jsxs)(`div`,{className:`settings-account-actions`,children:[(0,Q.jsx)(xe,{account:e,runners:t,status:s}),(0,Q.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:a.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>a.mutate(i,{onError:e=>S(e.message,{tone:`danger`})}),children:`Check again`}),(0,Q.jsx)(Ce,{account:e,onRemove:n})]})]})})}function Ce({account:e,onRemove:t}){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(e.label),o=u();return(0,Q.jsx)(Q.Fragment,{children:e.isDefault?null:(0,Q.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,Q.jsx)(O,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>S(e.message,{tone:`danger`})}),children:`Save`}),(0,Q.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,Q.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{me as GlobalAgentsSection};
|
|
@@ -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{Kt as r,br as i,ci as a,fn as o,g as s,i as c,r as l}from"./project-scope-context-Dgq8_2JZ.js";import{$ as u,J as d,Nt as f,Ut as p,Wt as m,Yt as h,at as g,lt as _,o as v,p as y,q as b,t as x,xt as S}from"./queries-yuG-mM6_.js";import{n as C}from"./toaster-Bo5vCbz-.js";import{i as w,n as T,s as E,t as D}from"./runners-CDw7wLfd.js";import{s as O}from"./design-icons-CzEoMH9c.js";import{t as k}from"./button-BQ2y4XRB.js";import{t as A}from"./switch-Bv2Zf1uU.js";import{t as ee}from"./status-dot-DtAOFiIi.js";import{t as j}from"./centered-state-V15AR_qo.js";import{N as M,j as N}from"./index-DXIRYobS.js";import{t as P}from"./textarea-vJt9undk.js";import{a as F,i as I,n as L,r as R,t as z}from"./settings-agent-picker-3uuSf9LK.js";var B=e(t(),1),V=n(),H={connected:{label:`Credentials found`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function U(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function W(e,t){return e?H[e]:t?{label:`Checking…`,tone:`neutral`}:H.unknown}function G(e,t){return e===`unknown`||t&&!e}function K({provider:e,state:t,current:n,statusIsError:r}){return t===`not-installed`?(0,V.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,e.displayName,`, then run `,(0,V.jsx)(`code`,{children:e.loginCommand}),`.`]}):G(t,r)?(0,V.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):n?.hint?(0,V.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:n.hint}):null}function q({provider:e,state:t,current:n,isConnecting:r,incidentId:i,refresh:a,connect:o,retry:s,queueToggle:c}){let l=t===`disconnected`||t===`unknown`;return(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t===`not-installed`?null:(0,V.jsx)(A,{checked:n?.enabled??!0,"aria-label":`Use ${e.displayName}`,onCheckedChange:t=>c(e.id,t)}),l?(0,V.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(void 0,{onError:e=>C(e.message,{tone:`danger`})}),children:`Check again`}):null,t===`disconnected`&&e.browserLogin?(0,V.jsx)(L,{provider:e.id,label:e.displayName}):null,t===`disconnected`&&e.terminalLogin!==!1?(0,V.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:r?`Opening…`:`Connect`}):null,i===void 0?null:(0,V.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({provider:e.id,authFailureId:i},{onSuccess:()=>C(`${e.displayName} can be tried again.`),onError:e=>C(e.message,{tone:`danger`})}),children:`Try again`})]})}function J({manual:e,provider:t,connected:n,onCopy:r}){return e===null||e.provider!==t||n?null:(0,V.jsxs)(`div`,{role:`region`,"aria-label":`${e.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,V.jsx)(`p`,{className:`text-[13px] text-foreground`,children:e.message}),(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:e.command}),(0,V.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r(e.command),children:`Copy command`})]})]})}function Y(){let e=E(),t=d(),n=u(),r=_(),l=a(),[m,g]=(0,B.useState)(null),v=(0,B.useRef)(Promise.resolve()),y=(0,B.useRef)({}),b=(0,B.useRef)({}),x=(0,B.useRef)(t.data);(0,B.useEffect)(()=>{m&&i(t.data,m.provider)?.status===`connected`&&g(null)},[m,t.data]),(0,B.useEffect)(()=>{if(t.data){if(Object.values(b.current).every(e=>e===0)||!x.current){x.current=t.data;return}x.current={providers:t.data.providers.map(e=>({...e,enabled:(b.current[e.provider]??0)>0?i(x.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[t.data]);let S=(0,B.useCallback)((e,t)=>{let n=f.providerStatus,r=l.getQueryData(n);if(!r)return;x.current||=r;let a=U(r,e,t);b.current[e]=(b.current[e]??0)+1,l.setQueryData(n,a);let s=(y.current[e]??0)+1;y.current[e]=s,v.current=v.current.then(async()=>{try{let r=await o(e,t),a=i(r,e)?.enabled;if(a===void 0)return;if(x.current=U(x.current??r,e,a),s===y.current[e]){let t=l.getQueryData(n);l.setQueryData(n,t?U(t,e,a):r)}}catch(t){if(s===y.current[e]){let r=i(x.current,e)?.enabled,a=l.getQueryData(n);a&&r!==void 0?l.setQueryData(n,U(a,e,r)):x.current?l.setQueryData(n,x.current):l.removeQueries({queryKey:n,exact:!0}),C(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{b.current[e]=(b.current[e]??0)-1}})},[l]),w=h({mutationFn:e=>s(e),onSuccess:async(e,t)=>{g(null),C(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await l.invalidateQueries({queryKey:f.providerStatus}),await p(l,t,`none`)},onError:(t,n)=>{if(t instanceof c&&t.command){let r=D(e.data,n);g({provider:n,label:r,message:t.message,command:t.command});return}C(t.message,{tone:`danger`})}}),O=async e=>{try{await navigator.clipboard.writeText(e),C(`Command copied`)}catch{C(`Could not copy the command`,{tone:`danger`})}};return(0,V.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,V.jsxs)(`div`,{className:`mb-2`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,V.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),t.isError?(0,V.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.error.message})]}),(0,V.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:`Retry`})]}):null,(0,V.jsx)(`div`,{className:`flex flex-col gap-2`,children:T(e.data).map(e=>{let a=i(t.data,e.id),o=a?.status,s=W(o,t.isPending),c=w.isPending&&w.variables===e.id,l=a?.authFailureId;return(0,V.jsxs)(B.Fragment,{children:[(0,V.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":e.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:e.displayName}),(0,V.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,V.jsx)(ee,{tone:s.tone,pulse:t.isPending}),(0,V.jsx)(`span`,{children:s.label}),a?.enabled===!1?(0,V.jsx)(`span`,{children:`Disabled`}):null]}),(0,V.jsx)(K,{provider:e,state:o,current:a,statusIsError:t.isError})]}),(0,V.jsx)(q,{provider:e,state:o,current:a,isConnecting:c,incidentId:l,refresh:n,connect:w,retry:r,queueToggle:S})]}),l===void 0?null:(0,V.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. Squawk cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),(0,V.jsx)(J,{manual:m,provider:e.id,connected:o===`connected`,onCopy:O})]},e.id)})})]})}var X=2e4;function Z(){let e=y(),t=E(),n=m(w(t.data)),r=d();return e.isPending?(0,V.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,V.jsx)(j,{icon:(0,V.jsx)(O,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,V.jsx)(te,{config:e.data,catalogs:n,providerStatus:r,runners:t.data})}function te({config:e,catalogs:t,providerStatus:n,runners:i}){let o=g(),s=a(),c=h({mutationFn:e=>r(e),onSuccess:e=>{s.setQueryData(x.config,e),s.invalidateQueries({queryKey:x.health}),s.invalidateQueries({queryKey:x.repo})},onError:e=>C(e.message,{tone:`danger`})}),[l,u]=(0,B.useState)(e.systemPrompt??``),d=l.trim(),f=d===(e.systemPrompt??``),p=d.length>X;return(0,V.jsxs)(`div`,{"data-slot":`agent-defaults-section`,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,V.jsx)(ne,{defaultRunner:e.defaultRunner,providerStatus:n,saving:c.isPending,onPick:e=>c.mutate({defaultRunner:e})}),(0,V.jsx)(Q,{title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,V.jsx)(`div`,{className:`flex flex-col gap-4`,children:T(i).map(r=>{let{providerConnected:a,providerReason:o}=F(n,r.id),s=t[r.id],l=N(r.id,i,s),u=M(r.id,i,s?.data,[e.defaultModels[r.id]]),d=e.defaultModels[r.id]??``,f=u.find(e=>e.id===d)?.label??d??`auto (default)`;return(0,V.jsxs)(`label`,{className:`settings-option-row`,children:[(0,V.jsx)(`div`,{children:(0,V.jsx)(`h3`,{children:r.pickerLabel})}),e.modelsLocked?(0,V.jsx)(`output`,{"aria-label":`Default model for ${r.pickerLabel}`,"data-slot":`agents-model`,"data-runner":r.id,title:`Model selection is locked to native coding-agent settings.`,className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,V.jsxs)(`select`,{"aria-label":`Default model for ${r.pickerLabel}`,"data-slot":`agents-model`,"data-runner":r.id,value:d,title:o??r.pickerDescription,disabled:c.isPending||!a,onChange:e=>c.mutate({defaultModels:{[r.id]:e.target.value||null}}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[u.map(e=>(0,V.jsx)(`option`,{value:e.id,children:e.id===``?`Native agent default`:e.label},e.id)),l?(0,V.jsx)(`option`,{disabled:!0,children:l}):null]})]},r.id)})})}),(0,V.jsxs)(Q,{title:`System prompt`,hint:`Extra instructions for every run in this project.`,children:[(0,V.jsx)(P,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:l,onChange:e=>u(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,V.jsxs)(`div`,{className:`settings-form-actions`,children:[(0,V.jsx)(k,{type:`button`,variant:`primary`,size:`sm`,"data-action":`agents-save-prompt`,disabled:f||p||c.isPending,onClick:()=>c.mutate({systemPrompt:d===``?null:d},{onSuccess:()=>C(d===``?`System prompt cleared`:`System prompt saved`)}),children:`Save prompt`}),p?(0,V.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-[11px] text-danger`,children:[d.length.toLocaleString(),` characters — the limit is`,` `,X.toLocaleString(),`.`]}):(0,V.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]}),(0,V.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,V.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,children:(0,V.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,V.jsx)(A,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:c.isPending,onCheckedChange:e=>c.mutate({liveTitleUpdates:e},{onSuccess:()=>C(e?`Live title updates on`:`Live title updates off`)})}),(0,V.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,V.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,children:(0,V.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,V.jsx)(A,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:c.isPending,onCheckedChange:e=>c.mutate({reviewGate:e},{onSuccess:()=>C(e?`Review gate on`:`Review gate off`)})}),(0,V.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,V.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:o.data?.info?(0,V.jsxs)(`select`,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:c.isPending,onChange:e=>c.mutate({baseBranch:e.target.value||null}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,V.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),o.data.branches.map(e=>(0,V.jsx)(`option`,{value:e,children:e},e))]}):(0,V.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:o.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]}),(0,V.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,V.jsx)(`summary`,{children:`Provider connections`}),(0,V.jsx)(Y,{})]})]})}function ne({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let a=v(),o=b(),s=l(),c=g(),u=S(),d=s.projectId??`default`,f=c.data?.info?.root,p=f?a.data?.selections[f]:void 0,m=E().data,h=R(a.data?.profiles??[],m),_=I(h,m);return(0,V.jsxs)(Q,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,children:[(0,V.jsx)(z,{rows:h,runner:e,accountFor:e=>p?.[e]??null,providerStatus:t,disabled:n,accountDisabled:u.isPending||o.data===void 0,onPick:(t,n,i)=>{t!==e&&r(t),i&&u.mutate({projectId:d,provider:t,profileId:n},{onError:e=>C(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&i(t.data,e)?.enabled===!1?(0,V.jsx)(`p`,{"data-slot":`agents-runner-disabled`,className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,_?(0,V.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function Q({title:e,hint:t,children:n}){return(0,V.jsxs)(`section`,{className:`settings-field flex flex-col gap-2`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,V.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function $({title:e,hint:t,children:n}){return(0,V.jsxs)(`section`,{className:`settings-option-row`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{children:e}),(0,V.jsx)(`p`,{children:t})]}),n]})}export{Z as AgentDefaultsSection};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./utils-DSMR_WLb.js";import{$n as a,D as o,H as s,Rr as c,U as l,W as u,Xr as d,Zn as f,Zr as p,an as m,dn as h,er as g,i as _,nr as v,p as y,rn as b,u as x,vn as ee,y as te}from"./project-scope-context-Dgq8_2JZ.js";import{B as S,G as ne,H as C,I as w,K as T,N as E,P as D,V as O,W as k,j as A,z as j}from"./live-protocol-BXzu6cSE.js";import{Gt as M,kt as re,p as ie}from"./queries-yuG-mM6_.js";import{h as ae}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as oe,t as N}from"./label-BWld23ke.js";import{o as se,s as ce}from"./runners-CDw7wLfd.js";import{I as le,Y as ue,c as de,d as fe,it as pe,l as me,pt as he,ut as ge,y as _e}from"./design-icons-CzEoMH9c.js";import{n as ve,r as ye}from"./dist-C28wFbz0.js";import{t as P}from"./button-BQ2y4XRB.js";import{a as F,n as be}from"./dist-BW234Kg5.js";import{a as I,i as xe,n as L,r as R,t as Se}from"./dist-C5mlVBmd.js";import{h as Ce,m as we}from"./dropdown-menu-4e2iKSMT.js";import{a as Te,c as Ee,i as De,l as Oe,n as ke,o as Ae,r as je,t as Me,u as Ne}from"./es2015-CQth82uv.js";import{n as Pe,r as Fe,t as Ie}from"./collapsible-BEV4FO-1.js";import{n as Le,t as Re}from"./switch-Bv2Zf1uU.js";import{a as ze,i as Be,n as Ve,r as He,t as Ue}from"./dist-BAoXdNsT.js";import{c as We,s as Ge,t as z}from"./project-router-DtTvMbeA.js";import{t as Ke}from"./centered-state-V15AR_qo.js";import{$n as qe,Cn as Je,G as Ye,Hn as B,J as Xe,N as Ze,O as Qe,Sn as $e,W as et,gn as tt,k as nt,q as rt,r as it,t as at,yn as ot}from"./index-DXIRYobS.js";import{_ as st,a as ct,c as lt,d as ut,f as dt,g as ft,h as pt,i as mt,l as ht,m as gt,n as _t,o as vt,p as yt,r as bt,s as xt,t as St,u as Ct,v as wt}from"./automation-format-BsnXeUET.js";import{t as Tt}from"./textarea-vJt9undk.js";function Et(e,[t,n]){return Math.min(n,Math.max(t,e))}var V=e(t(),1),Dt=e(n(),1),H=r(),Ot=[` `,`Enter`,`ArrowUp`,`ArrowDown`],kt=[` `,`Enter`],U=`Select`,[At,jt,Mt]=Ce(U),[W,Nt]=xe(U,[Mt,ze]),Pt=ze(),[Ft,G]=W(U),[It,Lt]=W(U),Rt=`SelectProvider`;function zt(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=Pt(t),[_,v]=V.useState(null),[y,b]=V.useState(null),[x,ee]=V.useState(!1),te=we(l),[S,ne]=Se({prop:r,defaultProp:i??!1,onChange:a,caller:U}),[C,w]=Se({prop:o,defaultProp:s,onChange:c,caller:U}),T=V.useRef(null),E=V.useRef(C);V.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=()=>w(E.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,w]);let D=!_||!!m||!!_.closest(`form`),[O,k]=V.useState(new Set),A=Oe(),j=Array.from(O).map(e=>e.props.value).join(`;`),M=V.useCallback(e=>{k(t=>new Set(t).add(e))},[]),re=V.useCallback(e=>{k(t=>{let n=new Set(t);return n.delete(e),n})},[]),ie={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:ee,contentId:A,value:C,onValueChange:w,open:S,onOpenChange:ne,dir:te,triggerPointerDownPosRef:T,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:O,nativeSelectKey:j,isFormControl:D};return(0,H.jsx)(Be,{...g,children:(0,H.jsx)(Ft,{scope:t,...ie,children:(0,H.jsx)(At.Provider,{scope:t,children:(0,H.jsx)(It,{scope:t,onNativeOptionAdd:M,onNativeOptionRemove:re,children:Ln(h)?h(ie):n})})})})}zt.displayName=Rt;var Bt=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,H.jsx)(zt,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,H.jsxs)(H.Fragment,{children:[n,e?(0,H.jsx)(In,{__scopeSelect:t}):null]})})};Bt.displayName=U;var Vt=`SelectTrigger`,Ht=V.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Pt(n),o=G(Vt,n),s=o.disabled||r,c=F(t,o.onTriggerChange),l=jt(n),u=V.useRef(`touch`),[d,f,p]=zn(e=>{let t=l().filter(e=>!e.disabled),n=Bn(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,H.jsx)(Ue,{asChild:!0,...a,children:(0,H.jsx)(I.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Rn(o.value)?``:void 0,...i,ref:c,onClick:R(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:R(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:R(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Ot.includes(e.key)&&(m(),e.preventDefault())})})})});Ht.displayName=Vt;var Ut=`SelectValue`,Wt=V.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=G(Ut,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=F(t,c.onValueNodeChange);L(()=>{l(u)},[l,u]);let f=Rn(c.value);return(0,H.jsx)(I.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,H.jsx)(V.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});Wt.displayName=Ut;var Gt=`SelectIcon`,Kt=V.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,H.jsx)(I.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Kt.displayName=Gt;var qt=`SelectPortal`,[Jt,Yt]=W(qt,{forceMount:void 0}),Xt=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,H.jsx)(Jt,{scope:e.__scopeSelect,forceMount:n,children:(0,H.jsx)(De,{asChild:!0,...r})})};Xt.displayName=qt;var K=`SelectContent`,Zt=V.forwardRef((e,t)=>{let n=Yt(K,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=G(K,e.__scopeSelect),[o,s]=V.useState();return L(()=>{s(new DocumentFragment)},[]),(0,H.jsx)(Ne,{present:r||a.open,children:({present:e})=>e?(0,H.jsx)(nn,{...i,ref:t}):(0,H.jsx)(Qt,{...i,fragment:o})})});Zt.displayName=K;var Qt=V.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?Dt.createPortal((0,H.jsx)($t,{scope:n,children:(0,H.jsx)(At.Slot,{scope:n,children:(0,H.jsx)(`div`,{ref:t,children:r})})}),i):null});Qt.displayName=`SelectContentFragment`;var q=10,[$t,J]=W(K),en=`SelectContentImpl`,tn=be(`SelectContent.RemoveScroll`),nn=V.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=G(K,n),[y,b]=V.useState(null),[x,ee]=V.useState(null),te=F(t,b),[S,ne]=V.useState(null),[C,w]=V.useState(null),T=jt(n),[E,D]=V.useState(!1),O=V.useRef(!1);V.useEffect(()=>{if(y)return Me(y)},[y]),je();let k=V.useCallback(e=>{let[t,...n]=T().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[T,x]),A=V.useCallback(()=>k([S,y]),[k,S,y]);V.useEffect(()=>{E&&A()},[E,A]);let{onOpenChange:j,triggerPointerDownPosRef:M}=v;V.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(M.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(M.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||j(!1),document.removeEventListener(`pointermove`,t),M.current=null};return M.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,j,M]),V.useEffect(()=>{let e=()=>j(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[j]);let[re,ie]=zn(e=>{let t=T().filter(e=>!e.disabled),n=Bn(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ae=V.useCallback((e,t,n)=>{let r=!O.current&&!n;(v.value!==void 0&&v.value===t||r)&&(ne(e),r&&(O.current=!0))},[v.value]),oe=V.useCallback(()=>y?.focus(),[y]),N=V.useCallback((e,t,n)=>{let r=!O.current&&!n;(v.value!==void 0&&v.value===t||r)&&w(e)},[v.value]),se=r===`popper`?sn:an,ce=se===sn?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,H.jsx)($t,{scope:n,content:y,viewport:x,onViewportChange:ee,itemRefCallback:ae,selectedItem:S,onItemLeave:oe,itemTextRefCallback:N,focusSelectedItem:A,selectedItemText:C,position:r,isPositioned:E,searchRef:re,children:(0,H.jsx)(ke,{as:tn,allowPinchZoom:!0,children:(0,H.jsx)(Te,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:R(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,H.jsx)(Ae,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,H.jsx)(se,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...ce,onPlaced:()=>D(!0),ref:te,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:R(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ie(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=T().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>k(t)),e.preventDefault()}})})})})})})});nn.displayName=en;var rn=`SelectItemAlignedPosition`,an=V.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=G(K,n),o=J(K,n),[s,c]=V.useState(null),[l,u]=V.useState(null),d=F(t,u),f=jt(n),p=V.useRef(!1),m=V.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=V.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-q,d=Et(a,[q,Math.max(q,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-q,d=Et(a,[q,Math.max(q,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-q*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,ee=Math.min(g.offsetHeight*5,x),te=window.getComputedStyle(h),S=parseInt(te.paddingTop,10),ne=parseInt(te.paddingBottom,10),C=e.top+e.height/2-q,w=c-C,T=g.offsetHeight/2,E=g.offsetTop+T,D=m+v+E,O=x-D;if(D<=C){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=D+Math.max(w,T+(e?ne:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(C,m+h.offsetTop+(e?S:0)+T)+O;s.style.height=t+`px`,h.scrollTop=D-C+h.offsetTop}s.style.margin=`${q}px 0`,s.style.minHeight=ee+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);L(()=>y(),[y]);let[b,x]=V.useState();return L(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,H.jsx)(cn,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:V.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,H.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,H.jsx)(I.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});an.displayName=rn;var on=`SelectPopperPosition`,sn=V.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=q,...a}=e,o=Pt(n);return(0,H.jsx)(He,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});sn.displayName=on;var[cn,ln]=W(K,{}),un=`SelectViewport`,dn=V.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=J(un,n),o=ln(un,n),s=F(t,a.onViewportChange),c=V.useRef(0);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,H.jsx)(At.Slot,{scope:n,children:(0,H.jsx)(I.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:R(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-q*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});dn.displayName=un;var fn=`SelectGroup`,[pn,mn]=W(fn),hn=V.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Oe();return(0,H.jsx)(pn,{scope:n,id:i,children:(0,H.jsx)(I.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});hn.displayName=fn;var gn=`SelectLabel`,_n=V.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=mn(gn,n);return(0,H.jsx)(I.div,{id:i.id,...r,ref:t})});_n.displayName=gn;var vn=`SelectItem`,[yn,bn]=W(vn),xn=V.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=G(vn,n),c=J(vn,n),l=s.value===r,[u,d]=V.useState(a??``),[f,p]=V.useState(!1),m=F(t,Ee(e=>c.itemRefCallback?.(e,r,i))),h=Oe(),g=V.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,H.jsx)(yn,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:V.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,H.jsx)(At.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,H.jsx)(I.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:R(o.onFocus,()=>p(!0)),onBlur:R(o.onBlur,()=>p(!1)),onClick:R(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:R(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:R(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:R(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:R(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:R(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(kt.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});xn.displayName=vn;var Sn=`SelectItemText`,Cn=V.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=G(Sn,n),s=J(Sn,n),c=bn(Sn,n),l=Lt(Sn,n),[u,d]=V.useState(null),f=Ee(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=F(t,d,c.onItemTextChange,f),m=u?.textContent,h=V.useMemo(()=>(0,H.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return L(()=>(g(h),()=>_(h)),[g,_,h]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(I.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Rn(o.value)?Dt.createPortal(a.children,o.valueNode):null]})});Cn.displayName=Sn;var wn=`SelectItemIndicator`,Tn=V.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return bn(wn,n).isSelected?(0,H.jsx)(I.span,{"aria-hidden":!0,...r,ref:t}):null});Tn.displayName=wn;var En=`SelectScrollUpButton`,Dn=V.forwardRef((e,t)=>{let n=J(En,e.__scopeSelect),r=ln(En,e.__scopeSelect),[i,a]=V.useState(!1),o=F(t,r.onScrollButtonChange);return L(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(An,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Dn.displayName=En;var On=`SelectScrollDownButton`,kn=V.forwardRef((e,t)=>{let n=J(On,e.__scopeSelect),r=ln(On,e.__scopeSelect),[i,a]=V.useState(!1),o=F(t,r.onScrollButtonChange);return L(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(An,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});kn.displayName=On;var An=V.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=J(`SelectScrollButton`,n),o=V.useRef(null),s=jt(n),c=V.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return V.useEffect(()=>()=>c(),[c]),L(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,H.jsx)(I.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:R(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:R(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:R(i.onPointerLeave,()=>{c()})})}),jn=`SelectSeparator`,Mn=V.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,H.jsx)(I.div,{"aria-hidden":!0,...r,ref:t})});Mn.displayName=jn;var Nn=`SelectArrow`,Pn=V.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Pt(n);return J(Nn,n).position===`popper`?(0,H.jsx)(Ve,{...i,...r,ref:t}):null});Pn.displayName=Nn;var Fn=`SelectBubbleInput`,In=V.forwardRef(({__scopeSelect:e,...t},n)=>{let r=G(Fn,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=V.useRef(null),m=F(n,p),h=i??``,g=Le(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return V.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,H.jsxs)(I.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...ve,...t.style},ref:m,defaultValue:h,children:[Rn(i)&&!_?(0,H.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});In.displayName=Fn;function Ln(e){return typeof e==`function`}function Rn(e){return e===``||e===void 0}function zn(e){let t=Ee(e),n=V.useRef(``),r=V.useRef(0),i=V.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=V.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return V.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Bn(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Vn(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Vn(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Hn=A([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),Un=S({includeExisting:D().optional(),authors:E(k()).optional(),assignees:E(k()).optional(),requireCurrentLabels:D().optional(),allLabels:E(k()).optional(),anyLabels:E(k()).optional(),excludeLabels:E(k()).optional(),changedLabels:E(k()).optional(),lookbackDays:j(),maxRecords:j()}),Wn=A([`github`,`schedule`]),Gn=f.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:k(),variants:ne([w(1),w(2),w(3)]).optional(),systemPrompt:k().optional()}),Kn=S({at:k(),outcome:A([`launched`,`cancelled`]),runId:k().optional(),receiptId:k().optional(),trigger:A([`schedule`,`late`,`manual`,`retry`]).optional()}),qn=S({id:k(),revision:j(),name:k(),description:k().optional(),enabled:D(),kind:Wn,events:E(Hn).optional(),intervalSeconds:j().optional(),filters:Un.optional(),schedule:lt.optional(),task:Gn,archived:Kn.optional(),createdAt:k(),updatedAt:k()}),Jn=S({timestamp:k(),tieBreaker:k().optional()}),Yn=S({since:k().datetime(),until:k().datetime(),source:j().int().min(0).max(2),page:j().int().min(1).max(10),item:j().int().min(0).max(100),event:j().int().min(0).max(1e3),cursor:Jn.optional()}),Xn={lastError:k().max(1e3).optional(),lastErrorAt:k().datetime().optional()},Zn=S({revision:j().optional(),baselineAt:k().optional(),armedAt:k().optional(),historyScan:Yn.optional(),cursor:Jn.optional(),frozenHighWatermark:Jn.extend({tieBreaker:k()}).optional(),backlogAfter:Jn.extend({tieBreaker:k()}).optional(),nextCheckAt:k().optional(),lastSuccessAt:k().optional(),nextRunAt:k().optional(),lastRunAt:k().optional(),etags:C(k(),k()).optional(),backoffUntil:k().optional(),consecutiveFailures:j().optional(),...Xn,onceOutcome:A([`failed`,`missed`]).optional()});function Qn(e){let t=e?.consecutiveFailures??0;if(!(t<3||!e?.lastError))return{consecutiveFailures:t,lastError:e.lastError,...e.lastErrorAt?{lastErrorAt:e.lastErrorAt}:{},...e.backoffUntil?{retryAt:e.backoffUntil}:{}}}var $n=A([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),er=S({seq:j(),ts:k(),automationId:k(),revision:j(),event:Hn.optional(),result:$n,reason:k().optional(),durationMs:j().optional(),receiptId:k().optional(),runId:k().optional(),githubNumber:j().optional(),githubTitle:k().optional(),githubUrl:k().optional(),rateLimit:S({bucket:A([`core`,`search`]),remaining:j().optional(),resetAt:k().optional()}).optional()}),tr=S({matches:j(),launched:j(),duplicates:j(),errors:j()}),nr=qn.extend({state:Zn.optional(),latestLog:er.optional(),counts:tr,nextRunAt:k().optional(),onceStatus:yt.optional()});S({available:D(),reason:k().optional(),timeZone:k(),scheduler:S({state:A([`scheduled`,`idle`]),nextDue:k().optional()}),automations:E(nr)}),S({automation:qn}).extend({once:S({dueAt:k(),timeZone:k(),resolvedInstant:k(),note:k()}).optional()}),S({automation:qn,state:Zn.optional(),latestLog:er.optional(),onceStatus:yt.optional()}),S({id:k(),automationId:k(),mode:A([`preview`,`execute`]),status:A([`queued`,`running`,`complete`,`error`]),createdAt:k(),completedAt:k().optional(),matches:j().optional(),truncated:D().optional(),error:k().optional()}),S({checkId:k()}),S({records:E(er)}),S({receiptId:k(),runId:k()}),S({runId:k()}),qn.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:Wn.optional(),task:Gn.omit({variants:!0}).strict(),enable:D().optional()}).omit({enable:!0}).extend({enabled:D().optional(),expectedRevision:j()}),S({archived:A([`include`,`only`]).optional()}),S({mode:A([`preview`,`execute`])});function rr({...e}){return(0,H.jsx)(Bt,{"data-slot":`select`,...e})}function ir({...e}){return(0,H.jsx)(Wt,{"data-slot":`select-value`,...e})}function ar({className:e,size:t=`default`,children:n,...r}){return(0,H.jsxs)(Ht,{"data-slot":`select-trigger`,"data-size":t,className:i(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 pointer-hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,H.jsx)(Kt,{asChild:!0,children:(0,H.jsx)(me,{className:`size-4 opacity-50`})})]})}function or({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,H.jsx)(Xt,{children:(0,H.jsxs)(Zt,{"data-slot":`select-content`,className:i(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...a,children:[(0,H.jsx)(cr,{}),(0,H.jsx)(dn,{className:i(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,H.jsx)(lr,{})]})})}function sr({className:e,children:t,...n}){return(0,H.jsxs)(xn,{"data-slot":`select-item`,className:i(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,H.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,H.jsx)(Tn,{children:(0,H.jsx)(de,{className:`size-4`})})}),(0,H.jsx)(Cn,{children:t})]})}function cr({className:e,...t}){return(0,H.jsx)(Dn,{"data-slot":`select-scroll-up-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,H.jsx)(fe,{className:`size-4`})})}function lr({className:e,...t}){return(0,H.jsx)(kn,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,H.jsx)(me,{className:`size-4`})})}function Y({title:e,subtitle:t,action:n,children:r}){return(0,H.jsxs)(`main`,{"data-route":`automations`,className:`task-flow-page w-full max-w-full min-w-0 max-md:p-4!`,children:[(0,H.jsxs)(`header`,{className:`mb-6 flex flex-col items-start gap-5 max-md:mb-4 max-md:gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h1`,{className:`mb-2 text-[28px] font-medium max-md:text-[22px]`,children:e}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),n]}),r]})}function X({text:e}){return(0,H.jsx)(`div`,{role:`status`,className:`rounded-xl border bg-card p-6 text-sm text-muted-foreground`,children:e})}var ur={launched:`success`,manual:`success`,"catch-up":`success`,skipped:`neutral`,missed:`neutral`,"no-match":`neutral`,preview:`neutral`,baseline:`neutral`,duplicate:`neutral`,failed:`danger`,error:`danger`,"rate-limited":`danger`},dr={launched:`Launched`,manual:`Manual`,"catch-up":`Catch up`,skipped:`Skipped`,missed:`Missed`,"no-match":`No match`,preview:`Preview`,baseline:`Baseline`,duplicate:`Duplicate`,failed:`Failed`,error:`Error`,"rate-limited":`Rate limited`};function fr(e){let[t,n]=(0,V.useState)(),[r,i]=(0,V.useState)(``),a=(0,V.useCallback)(t=>l(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,V.useEffect)(()=>{a()},[a]),(0,V.useEffect)(()=>c(a),[a]),(0,V.useEffect)(()=>oe((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function pr(e,t){return e.result!==`failed`&&e.result!==`error`||!e.receiptId||e.runId?!1:!t.some(t=>t.receiptId===e.receiptId&&(t.runId||t.seq>e.seq))}function mr({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&pr(e,t),[o,s]=(0,V.useState)(),[c,l]=(0,V.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await b(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,H.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(it,{dot:ur[e.result],children:dr[e.result]}),(0,H.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:_t(e.ts,n,u)})]}),e.reason?(0,H.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,H.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,H.jsx)(`a`,{className:`inline-flex min-h-11 items-center underline underline-offset-4 break-all`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}):null,e.runId?(0,H.jsx)(z,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,H.jsx)(P,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,H.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var Z=`all`;function hr({label:e,value:t,onChange:n,options:r}){return(0,H.jsxs)(rr,{value:t,onValueChange:n,children:[(0,H.jsx)(ar,{"aria-label":e,className:`w-full sm:w-52`,children:(0,H.jsx)(ir,{})}),(0,H.jsx)(or,{children:r.map(e=>(0,H.jsx)(sr,{value:e.value,children:e.label},e.value))})]})}function gr({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=fr(e),[s,c]=(0,V.useState)(Z),[l,u]=(0,V.useState)(Z),d=(0,V.useMemo)(()=>(i??[]).filter(e=>(s===Z||e.result===s)&&(l===Z||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,H.jsx)(Y,{title:`Execution log`,subtitle:t??`Automation activity`,action:(0,H.jsx)(P,{variant:`outline`,asChild:!0,children:(0,H.jsx)(z,{to:`/automations`,children:`Back to automations`})}),children:a&&!i?(0,H.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,H.jsx)(X,{text:a}),(0,H.jsx)(P,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,H.jsx)(X,{text:`Nothing has run yet.`}):(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(hr,{label:`Result`,value:s,onChange:c,options:[{value:Z,label:`All results`},...$n.options.map(e=>({value:e,label:dr[e]}))]}),f?(0,H.jsx)(hr,{label:`Event`,value:l,onChange:u,options:[{value:Z,label:`All events`},...Hn.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,H.jsx)(X,{text:`No rows match these filters.`}):(0,H.jsx)(mr,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,H.jsx)(X,{text:`Loading execution log…`})})}function _r({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=fr(e);return(0,H.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`mt-4 min-w-0 border-t pt-4`,children:[(0,H.jsxs)(`h3`,{className:`mb-3 text-sm font-medium`,children:[`Recent activity`,r&&t?` · ${t}`:``]}),o&&!a?(0,H.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,H.jsx)(X,{text:o}),(0,H.jsx)(P,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?a.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing has run yet.`}):(0,H.jsx)(mr,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading activity…`})]})}function vr({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?bt(i):null,[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(``),p=(0,V.useRef)(null),m=(0,V.useRef)(null),h=(0,V.useRef)(null);(0,V.useEffect)(()=>{let e=h.current===`keep`?m.current:h.current===`delete`?p.current:null;h.current=null,e?.focus()},[s]);let g=async()=>{u(!0);try{await o(e.id),n()}catch(e){f(e instanceof Error?e.message:String(e)),u(!1)}},_=[[`Workflow`,e.task.workflow],[`Runner`,e.task.runner],[`Model`,e.task.model],[`Effort`,e.task.effort]];return(0,H.jsx)(Y,{title:e.name,subtitle:`Archived one-time schedule. It cannot change; delete it when you no longer need the record.`,children:(0,H.jsxs)(`div`,{className:`grid min-w-0 max-w-3xl gap-5`,children:[(0,H.jsxs)(`section`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,H.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,H.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsx)(z,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${St(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,H.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,H.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,H.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,H.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),_.filter(([,e])=>e).map(([e,t])=>(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,H.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,H.jsxs)(`section`,{className:`min-w-0`,children:[(0,H.jsx)(_r,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,H.jsx)(P,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,H.jsx)(z,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,H.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[s?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(P,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:l,onClick:()=>void g(),children:`Delete schedule`}),(0,H.jsx)(P,{ref:m,variant:`outline`,disabled:l,onClick:()=>{h.current=`delete`,c(!1)},children:`Keep`})]})]}):(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(P,{ref:p,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{h.current=`keep`,c(!0)},children:`Delete`}),(0,H.jsx)(P,{variant:`outline`,asChild:!0,children:(0,H.jsx)(z,{to:`/automations`,children:`Back to automations`})})]}),d?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:d}):null]})]})})}var yr=A([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),br=E(k().trim().min(1).max(200)).max(100).optional(),xr=S({includeExisting:D().optional(),requireCurrentLabels:D().optional(),authors:br,assignees:br,allLabels:br,anyLabels:br,excludeLabels:br,changedLabels:br,lookbackDays:j().int().min(1).max(90).default(7),maxRecords:j().int().min(1).max(100).default(25)}).passthrough(),Sr=S({prompt:k().min(1).max(1e5),workflow:k().trim().min(1).max(200).optional(),steps:E(a).min(1).max(100).optional(),runner:d.optional(),model:k().trim().min(1).max(200).optional(),effort:k().trim().min(1).max(32).optional(),variants:ne([w(1),w(2),w(3)]).optional(),worktree:D().optional(),autonomous:D().optional(),...g,...v,systemPrompt:k().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),Cr=new Set(Object.keys(Sr.shape).filter(e=>e!==`variants`));function wr(e){return Object.fromEntries(Object.entries(e).filter(([e])=>Cr.has(e)))}O(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e;return t.kind===`schedule`?e:{...t,intervalSeconds:t.intervalSeconds??300,filters:t.filters??{}}},S({id:k().min(1).max(100),revision:j().int().positive(),name:k().trim().min(1).max(200),description:k().max(2e3).optional(),enabled:D().default(!1),kind:Wn.default(`github`),events:E(yr).min(1).max(4).optional(),intervalSeconds:j().int().min(60).max(86400).optional(),filters:xr.optional(),schedule:lt.passthrough().optional(),task:Sr,archived:S({at:k().datetime(),outcome:A([`launched`,`cancelled`]),runId:k().optional(),receiptId:k().optional(),trigger:A([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:k().datetime(),updatedAt:k().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:p.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:p.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:p.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:p.custom,path:[`filters`],message:`a GitHub automation needs its bounded filter`}),e.events?.some(e=>e===`issue.labeled`||e===`issue.unlabeled`)&&!e.filters?.changedLabels?.length&&t.addIssue({code:p.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),S({version:w(1).default(1),automations:E(T()).default([]),tombstones:C(k(),k().datetime()).optional()}).passthrough();var Tr=S({timestamp:k().datetime(),tieBreaker:k().optional()}).passthrough(),Er=Yn.extend({cursor:Tr.optional()}),Dr=S({revision:j().int().positive().optional(),baselineAt:k().datetime().optional(),armedAt:k().datetime().optional(),historyScan:Er.optional(),cursor:Tr.optional(),frozenHighWatermark:Tr.extend({tieBreaker:k()}).optional(),backlogAfter:Tr.extend({tieBreaker:k()}).optional(),nextCheckAt:k().datetime().optional(),lastSuccessAt:k().datetime().optional(),nextRunAt:k().datetime().optional(),lastRunAt:k().datetime().optional(),etags:C(k(),k()).optional(),backoffUntil:k().datetime().optional(),consecutiveFailures:j().int().nonnegative().optional(),...Xn,onceOutcome:A([`failed`,`missed`]).optional()}).passthrough();S({version:w(1).default(1),states:C(k(),Dr).default({})}).passthrough(),S({receiptId:k().min(1),receiptKey:k().min(1),eventId:k().min(1),automationId:k().min(1),revision:j().int().positive(),status:A([`reserved`,`launched`,`launch-error`,`released`]),runId:k().optional(),observedAt:k().datetime(),updatedAt:k().datetime(),error:k().max(2e3).optional(),occurrenceAt:k().datetime().optional(),candidate:S({eventId:k(),event:yr,timestamp:k().datetime(),tieBreaker:k(),repo:k(),nodeId:k(),number:j().int().positive(),title:k().max(500),url:k().url(),author:k().max(200),assignees:E(k().max(200)).max(100),labels:E(k().max(200)).max(100),changedLabel:k().max(200).optional()}).passthrough().optional()}).passthrough();var Or=A([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);S({seq:j().int().positive(),ts:k().datetime(),automationId:k().min(1),revision:j().int().positive(),event:yr.optional(),result:Or,reason:k().max(2e3).optional(),durationMs:j().int().nonnegative().optional(),receiptId:k().optional(),runId:k().optional(),githubNumber:j().int().positive().optional(),githubTitle:k().max(500).optional(),githubUrl:k().url().optional(),rateLimit:S({bucket:A([`core`,`search`]),remaining:j().int().nonnegative().optional(),resetAt:k().datetime().optional()}).passthrough().optional()}).passthrough();var kr=`quick-task`;function Ar(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=wr(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:Ct(e.schedule??{type:`daily`}),events:e.events??[`issue.opened`],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?d?{workflow:kr}:{}:{workflow:n},...r===void 0?{}:{runner:r},...i===void 0?{}:{model:i},autonomous:a??!0,archiveWhenDone:o??!1,autoMergePr:s??!1,allowWorkers:c!==!1,allowMessaging:l!==!1,enabled:e.enabled??e.enable??!1,taskExtra:u}}function jr(e){switch(e.type){case`daily`:case`weekdays`:return{type:e.type,hour:e.hour,minute:e.minute};case`weekly`:return{type:`weekly`,hour:e.hour,minute:e.minute,day:e.day};case`hours`:return{type:`hours`,every:e.every};case`once`:return{type:`once`,at:e.at??``,timeZone:e.timeZone??``,...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}}function Mr(e){return{...e.taskExtra,prompt:e.prompt,...e.workflow?{workflow:e.workflow}:{},...e.runner?{runner:e.runner}:{},...e.model?{model:e.model}:{},autonomous:e.autonomous,...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers?{}:{allowWorkers:!1},...e.allowMessaging?{}:{allowMessaging:!1}}}function Nr(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:jr(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:Mr(e)}}function Pr(e){return{...Nr(e),enable:e.enabled}}function Fr(e,t){return{...Nr(e),task:{...Mr(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function Q(e){return`'${e.replace(/'/g,`'\\''`)}'`}var Ir=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),Lr=new Set([`anyLabels`,`authors`,`changedLabels`]);function Rr(e){if(e.description!==void 0||!e.name.trim()||!e.task.prompt.trim())return!1;let t=e.task;if(Object.keys(t).some(e=>!Ir.has(e))||t.archiveWhenDone===!1||t.autoMergePr===!1||t.allowWorkers===!0||t.allowMessaging===!0||t.worktree!==!0)return!1;if(e.kind===`schedule`)return e.schedule!==void 0;let{events:n,filters:r}=e;return!n?.length||n.some(e=>e.includes(`,`))||!r||r.lookbackDays!==7||r.maxRecords!==25?!1:Object.entries(r).every(([e,t])=>e===`lookbackDays`||e===`maxRecords`||e===`includeExisting`&&t===!0||Lr.has(e)&&Array.isArray(t)&&t.length>0)}function zr(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function Br(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function $(e,t){return t.startsWith(`-`)?`--${e}=${Q(t)}`:`--${e} ${Q(t)}`}function Vr(e){let t=[`${tt()} automation add`,$(`name`,e.name)];if(e.schedule?.type===`once`)t.push($(`at`,e.schedule.at),$(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push($(`latest-start`,Br(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push($(`cron`,ht(e.schedule)));else{t.push($(`on`,e.events.join(`,`)),`--every ${zr(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push($(`label`,n));for(let n of e.filters?.authors??[])t.push($(`author`,n));for(let n of e.filters?.changedLabels??[])t.push($(`changed-label`,n))}return t.push(...Hr(e.task)),e.enable===!0&&t.push(`--enable`),t.push($(`prompt`,e.task.prompt)),t.join(` `)}function Hr(e){let t=[];return e.workflow&&t.push($(`workflow`,e.workflow)),e.runner&&t.push($(`runner`,e.runner)),e.model&&t.push($(`model`,e.model)),e.autonomous===!1&&t.push(`--no-autonomous`),e.archiveWhenDone&&t.push(`--archive-when-done`),e.autoMergePr&&t.push(`--auto-merge-pr`),e.allowWorkers===!1&&t.push(`--no-workers`),e.allowMessaging===!1&&t.push(`--no-messaging`),t}function Ur(e,t){let n=Pr(e),r=Rr(n)?Vr(n):`${tt()} automation create --json ${Q(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${Q(t.origin)} CEZ_PROJECT_ID=${Q(t.projectId)} HSQ_COCKPIT_URL=${Q(t.origin)} HSQ_PROJECT_ID=${Q(t.projectId)} ${r}`:r}function Wr({draft:e}){let t=Ge(),n=window.location.origin,r=(0,V.useMemo)(()=>Ur(e,t?{origin:n,projectId:t}:void 0),[e,n,t]),[i,a]=(0,V.useState)(`idle`),o=(0,V.useRef)(void 0);(0,V.useEffect)(()=>()=>clearTimeout(o.current),[]),(0,V.useEffect)(()=>a(`idle`),[r]);let s=async()=>{clearTimeout(o.current);try{await navigator.clipboard.writeText(r),a(`copied`),o.current=setTimeout(()=>a(`idle`),1600)}catch{a(`failed`)}};return(0,H.jsxs)(`section`,{"aria-labelledby":`copy-as-cli-heading`,"data-slot":`copy-as-cli`,className:`mbs-4 rounded-xl border bg-card p-4`,children:[(0,H.jsxs)(`div`,{className:`mbe-2 flex items-center gap-2`,children:[(0,H.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`text-[15px] font-medium`,children:`Copy as CLI`}),(0,H.jsxs)(P,{type:`button`,variant:`ghost`,size:`sm`,className:`ms-auto`,onClick:()=>void s(),children:[i===`copied`?(0,H.jsx)(ye,{"aria-hidden":`true`}):(0,H.jsx)(qe,{"aria-hidden":`true`}),i===`copied`?`Copied`:`Copy`]})]}),(0,H.jsx)(`pre`,{className:`m-0 rounded-lg border bg-muted px-2.5 py-2 font-mono text-xs/relaxed break-words whitespace-pre-wrap text-muted-foreground`,children:r}),(0,H.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:i===`failed`?`Could not copy — select the line and copy it by hand.`:(0,H.jsxs)(H.Fragment,{children:[`The definition Save would create. `,(0,H.jsxs)(`code`,{children:[tt(),` automation schema`]}),` prints its shape.`]})})]})}function Gr({pressed:e,onClick:t,disabled:n,children:r}){return(0,H.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:i(Xe,`h-11 px-4 text-[13px]`,e&&`border-transparent bg-accent-strong text-accent-strong-foreground hover:bg-accent-strong hover:text-accent-strong-foreground`),children:r})}var Kr=Hn.options,qr=[{seconds:60,label:`1 minute`},{seconds:300,label:`5 minutes`},{seconds:900,label:`15 minutes`},{seconds:1800,label:`30 minutes`},{seconds:3600,label:`1 hour`}],Jr=[{key:`authors`,label:`Authors`},{key:`assignees`,label:`Assignees`},{key:`allLabels`,label:`Has all labels`},{key:`anyLabels`,label:`Has any label`},{key:`excludeLabels`,label:`Excludes labels`},{key:`changedLabels`,label:`Changed labels`,hint:`Required for the two label events.`}],Yr=e=>(e??[]).join(`, `),Xr=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function Zr(e){return e?`Existing matches within the lookback are eligible on the next check. Previously processed matches will not run again.`:`Enabling starts from a current-time baseline. Existing matches will not launch tasks.`}function Qr(e){let t=Math.max(1,Math.round(e.intervalSeconds/60));return`Polls GitHub every ${t} minute${t===1?``:`s`} for ${e.events.join(`, `)||`no events`}. ${Zr(e.filters.includeExisting)}`}function $r({draft:e,onChange:t,disabledReason:n}){let r=n=>{t({events:e.events.includes(n)?e.events.filter(e=>e!==n):[...e.events,n]})},i=n=>t({filters:{...e.filters,...n}}),a=(n,r)=>{let i=Xr(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=qr.some(t=>t.seconds===e.intervalSeconds)?qr:[...qr,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,H.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,H.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`flex flex-wrap gap-2`,children:Kr.map(t=>(0,H.jsx)(Gr,{pressed:e.events.includes(t),onClick:()=>r(t),children:t},t))}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-interval`,children:`Check every`}),(0,H.jsxs)(rr,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,H.jsx)(ar,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,H.jsx)(ir,{})}),(0,H.jsx)(or,{children:o.map(e=>(0,H.jsx)(sr,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,H.jsx)(Re,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,H.jsx)(`span`,{children:`Include existing items`})]}),(0,H.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:Zr(e.filters.includeExisting)})]}),(0,H.jsxs)(Ie,{children:[(0,H.jsxs)(Fe,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,H.jsx)(me,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,H.jsx)(Pe,{children:(0,H.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[Jr.map(t=>(0,H.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,H.jsx)(B,{id:`automation-filter-${t.key}`,placeholder:`comma separated`,value:Yr(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,H.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,H.jsx)(B,{id:`automation-filter-lookback`,type:`number`,min:1,value:e.filters.lookbackDays,onChange:e=>i({lookbackDays:Math.max(1,Number(e.target.value)||1)})})]}),(0,H.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,H.jsx)(B,{id:`automation-filter-max`,type:`number`,min:1,value:e.filters.maxRecords,onChange:e=>i({maxRecords:Math.max(1,Number(e.target.value)||1)})})]})]})})]})]})}var ei=e=>String(e).padStart(2,`0`);function ti({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,V.useState)(ei(t)),o=(0,V.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${ei(n)}.`,l=(0,V.useId)();return(0,V.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(B,{ref:o,"aria-label":e,"aria-invalid":s||void 0,"aria-describedby":s?l:void 0,inputMode:`numeric`,maxLength:2,className:`w-20 text-center tabular-nums`,value:i,onChange:e=>{a(e.target.value),/^\d{1,2}$/.test(e.target.value)&&Number(e.target.value)<=n&&r(Number(e.target.value))},onBlur:()=>a(ei(t))}),s?(0,H.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}var ni=[{minutes:void 0,label:`No limit`},{minutes:30,label:`30 minutes`},{minutes:120,label:`2 hours`},{minutes:360,label:`6 hours`},{minutes:1440,label:`1 day`},{minutes:10080,label:`7 days`}],ri=`none`,ii=e=>String(e).padStart(2,`0`);function ai(e,t=Date.now()){let n=wt(t,e)??wt(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${ii(r.getUTCMonth()+1)}-${ii(r.getUTCDate())}T09:00`}function oi(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function si({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?gt(e.at):null,a=e.at?.slice(0,10)??``,o=i?.hour??9,s=i?.minute??0,c=(e,t,n)=>r({at:`${e}T${ii(t)}:${ii(n)}`}),l=(0,V.useRef)(null),u=(0,V.useId)(),d=dt(e),f=!(t?.type===`once`&&t.at===e.at&&t.timeZone===e.timeZone)&&d!==null&&d<=Date.now();(0,V.useEffect)(()=>{l.current?.setCustomValidity(f?ct:``)},[f]);let p=bt(e);return(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-once-date`,children:`Date`}),(0,H.jsx)(B,{ref:l,id:`automation-once-date`,type:`date`,className:`w-44 max-w-full`,value:a,"aria-invalid":f||void 0,"aria-describedby":f?u:void 0,onChange:e=>{/^\d{4}-\d{2}-\d{2}$/.test(e.target.value)&&c(e.target.value,o,s)},required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,H.jsx)(ti,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,H.jsx)(ti,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,H.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:ct}):null,(0,H.jsx)(li,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,H.jsx)(ui,{value:e.latestStartMinutes,onChange:t=>n(ci(e,t))}),p?(0,H.jsx)(`p`,{className:`text-sm break-words`,children:`Runs once at ${p.time} on ${p.date} (${e.timeZone}). ${p.note?`${p.note} `:``}Squawk must be running then.`}):null]})}function ci(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function li({value:e,onCommit:t}){let[n,r]=(0,V.useState)(e),i=(0,V.useRef)(null),a=(0,V.useId)(),o=(0,V.useId)(),[s]=(0,V.useState)(oi),c=n!==e||!st(n),l=ft(n);return(0,V.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,H.jsx)(B,{ref:i,id:`automation-once-zone`,list:a,autoComplete:`off`,spellCheck:!1,className:`w-full sm:w-72`,value:n,"aria-invalid":c||void 0,"aria-describedby":c?o:void 0,onChange:e=>{r(e.target.value),st(e.target.value)&&t(e.target.value)}}),(0,H.jsx)(`datalist`,{id:a,children:s.map(e=>(0,H.jsx)(`option`,{value:e},e))}),c?(0,H.jsx)(`p`,{id:o,className:`text-xs break-words text-destructive`,children:l}):null]})}function ui({value:e,onChange:t}){let n=ni.some(t=>t.minutes===e)||e===void 0?ni:[...ni,{minutes:e,label:`${e} minutes`}];return(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,H.jsxs)(rr,{value:e===void 0?ri:String(e),onValueChange:e=>t(e===ri?void 0:Number(e)),children:[(0,H.jsx)(ar,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,H.jsx)(ir,{})}),(0,H.jsx)(or,{children:n.map(e=>(0,H.jsx)(sr,{value:e.minutes===void 0?ri:String(e.minutes),children:e.label},e.label))})]}),(0,H.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`If Squawk was not running at the time, it still starts the task this long afterwards; later, the schedule is marked missed.`})]})}var di=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}];function fi({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??ai(r),timeZone:e.timeZone??r}:{type:t});return(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`flex flex-wrap gap-2`,children:di.map(t=>(0,H.jsx)(Gr,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,H.jsx)(si,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,H.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`flex flex-wrap gap-2`,children:xt.map((t,n)=>(0,H.jsx)(Gr,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-every`,children:`Run every`}),(0,H.jsxs)(rr,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,H.jsx)(ar,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,H.jsx)(ir,{})}),(0,H.jsx)(or,{children:vt.map(e=>(0,H.jsx)(sr,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Counted from midnight, so “every 6 hours” runs at 00:00, 06:00, 12:00 and 18:00.`})]}):(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,H.jsx)(ti,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,H.jsx)(ti,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,H.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,H.jsx)(`code`,{className:`font-mono text-foreground`,children:ht(e)})]})]})}var pi=40*864e5,mi=5;function hi({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,H.jsx)(gi,{schedule:e,now:n});let r=ut(e,n+1,n+pi,t,mi);return(0,H.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,H.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Next 5 runs`}),r.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,H.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid gap-1.5 text-sm`,children:r.map(e=>(0,H.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3`,children:[(0,H.jsx)(`span`,{className:`font-medium tabular-nums`,children:St(new Date(e).toISOString(),t)}),(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:mt(n,e)})]},e))}),(0,H.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this Squawk runs in.`]})]})}function gi({schedule:e,now:t}){let n=dt(e),r=bt(e);return(0,H.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,H.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Runs once`}),n===null||!r?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,H.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,H.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:mt(t,n)}):null]}),r?.note?(0,H.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,H.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,H.jsx)(`p`,{className:`mt-3 text-xs break-words text-muted-foreground`,children:`Times are in ${e.timeZone??`UTC`}. Squawk must be running then; afterwards the schedule is archived with its task.`})]})}var _i={schedule:`On a schedule`,github:`When GitHub changes`};function vi(e){return/time zone|due time/i.test(e)?`when`:/placeholder|prompt|workflow|runner|model|task|autonomous/i.test(e)?`run`:/\bname\b/i.test(e)?`name`:/schedule|github|event|filter|label|interval|remote|forge|lookback|records?|hour|minute|poll|kind|archived/i.test(e)?`when`:`form`}function yi({title:e,failure:t,section:n,children:r}){return(0,H.jsxs)(`fieldset`,{className:`grid min-w-0 gap-4 rounded-xl border p-5 max-md:p-4!`,children:[(0,H.jsx)(`legend`,{className:`px-0`,children:e}),r,t?.section===n&&!t.conflict?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:t.message}):null]})}function bi({draft:e,patch:t,forge:n,automation:r}){return(0,H.jsx)(H.Fragment,{children:r?(0,H.jsxs)(`p`,{className:`text-sm`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),_i[e.kind]]}):(0,H.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,H.jsx)(at,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:e.kind,onChange:e=>t({kind:e}),options:[{value:`schedule`,label:_i.schedule},{value:`github`,label:_i.github,disabled:!n.available,...n.available?{}:{title:n.reason??`GitHub is unavailable`}}]}),n.available?null:(0,H.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${n.reason??`no GitHub access`}`})]})})}function xi({draft:e,patch:t,forge:n,timeZone:r,automation:i}){return e.kind===`schedule`?(0,H.jsx)(fi,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,H.jsx)($r,{draft:e,onChange:t,...n.available?{}:{disabledReason:n.reason??`no GitHub access`}})}function Si({draft:e,patch:t,saving:n,automation:r}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,H.jsx)(Tt,{id:`automation-prompt`,value:e.prompt,onChange:e=>t({prompt:e.target.value}),rows:4,required:!0}),(0,H.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,H.jsxs)(H.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,H.jsxs)(H.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),(0,H.jsx)(Ti,{draft:e,patch:t}),(0,H.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,H.jsx)(Re,{"aria-label":`Autonomous`,checked:e.autonomous,onCheckedChange:e=>t({autonomous:e})}),(0,H.jsxs)(`span`,{children:[`Autonomous `,(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`· runs without waiting for answers`})]})]}),(0,H.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`Each run is an ordinary task in its own worktree, queued behind the parallel cap.`}),(0,H.jsx)(nt,{archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,H.jsx)(Qe,{allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),r?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]})}function Ci({draft:e,patch:t,automation:n}){let r=e.kind===`schedule`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,H.jsx)(Re,{"aria-label":n?`Enabled`:`Enable after saving`,checked:e.enabled,onCheckedChange:e=>t({enabled:e})}),(0,H.jsx)(`span`,{children:n?`Enabled`:`Enable after saving`})]}),(0,H.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:r&&e.schedule.type===`once`?`It runs once at the time set above, then moves to Archived with its task.`:r?`The first run is the next occurrence shown beside the schedule.`:Zr(e.filters.includeExisting)})]})}function wi({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,s]=(0,V.useState)(()=>Ar(e)),[c,l]=(0,V.useState)(e?.revision),[u,d]=(0,V.useState)(),[f,p]=(0,V.useState)(!1),[m,g]=(0,V.useState)(!1),[v,y]=(0,V.useState)(!1),[b,x]=(0,V.useState)(``),S=e=>s(t=>({...t,...e})),ne=async t=>{if(t.preventDefault(),f)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}p(!0),d(void 0);let i=`save`;try{if(e&&c!==void 0){let{automation:t}=await ee(e.id,Fr({...a,enabled:e.enabled},c));l(t.revision),a.enabled!==e.enabled&&(i=`enable`,await h(e.id,a.enabled))}else await te(Pr(a));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof _&&t.status===409&&/revision conflict/i.test(n)?d({section:`form`,message:`Edited elsewhere — reload to see the latest version`,conflict:!0}):d({section:i===`enable`?`enable`:vi(n),message:n})}finally{p(!1)}},C=async()=>{if(!(!e||v)){y(!0),x(``);try{await o(e.id),r()}catch(e){x(e instanceof Error?e.message:String(e))}finally{y(!1)}}},w=e?`Save changes`:a.enabled?`Save and enable`:`Save paused`,T=a.kind===`schedule`;return(0,H.jsx)(Y,{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,children:(0,H.jsxs)(`form`,{className:`automation-editor grid min-w-0 gap-5 md:grid-cols-[minmax(0,1fr)_320px] md:items-start`,onSubmit:ne,children:[(0,H.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,H.jsx)(yi,{title:`Name`,section:`name`,failure:u,children:(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-name`,children:`Name`}),(0,H.jsx)(B,{id:`automation-name`,value:a.name,onChange:e=>S({name:e.target.value}),required:!0})]})}),(0,H.jsxs)(yi,{title:`When`,section:`when`,failure:u,children:[(0,H.jsx)(bi,{draft:a,patch:S,forge:t,automation:e}),(0,H.jsx)(xi,{draft:a,patch:S,forge:t,timeZone:n,automation:e})]}),(0,H.jsx)(yi,{title:`What to run`,section:`run`,failure:u,children:(0,H.jsx)(Si,{draft:a,patch:S,saving:f,automation:e})}),(0,H.jsx)(yi,{title:`Enable`,section:`enable`,failure:u,children:(0,H.jsx)(Ci,{draft:a,patch:S,automation:e})}),u?.section===`form`?(0,H.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,H.jsx)(`span`,{className:`break-words`,children:u.message}),u.conflict&&i?(0,H.jsx)(P,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(P,{type:`submit`,disabled:f,children:f?`Saving…`:w}),(0,H.jsx)(P,{type:`button`,variant:`outline`,asChild:!0,children:(0,H.jsx)(z,{to:`/automations`,children:`Cancel`})})]}),e?(0,H.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[m?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(P,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:v,onClick:()=>void C(),children:`Delete automation`}),(0,H.jsx)(P,{type:`button`,variant:`outline`,disabled:v,onClick:()=>{g(!1),x(``)},children:`Keep`})]})]}):(0,H.jsx)(P,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>g(!0),children:`Delete`}),b?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:b}):null]}):null]}),(0,H.jsxs)(`aside`,{className:`min-w-0 md:sticky md:top-4`,children:[T?(0,H.jsx)(hi,{schedule:a.schedule,timeZone:n}):(0,H.jsxs)(`section`,{className:`rounded-xl border bg-card p-4`,children:[(0,H.jsx)(`h2`,{className:`mb-2 text-[15px] font-medium`,children:`How it polls`}),(0,H.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:Qr(a)})]}),(0,H.jsx)(Wr,{draft:a})]})]})})}function Ti({draft:e,patch:t}){let n=re(),r=ot(),{runners:i,signedOut:a}=r.runnersOn(e=>r.repoAccount?.[e]),o=ie(),s=ce(),c=e.runner??o.data?.defaultRunner??`claude`,l=M(c,!0,r.repoAccount?.[c]),u=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],d=[...new Set([...i,...e.runner?[e.runner]:[]])],f=Ze(c,s.data,l.data,[e.model]),p=f.find(t=>t.id===(e.model??``))?.label??e.model??`auto`,m=e=>(0,H.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,H.jsx)(Ye,{children:(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(et,{slot:`automation-workflow-pill`,icon:m(ge),fieldLabel:!0,ariaLabel:`Workflow`,label:e.workflow??`inline steps`,value:e.workflow??``,disabled:e.workflow===void 0,disabledHint:`This automation carries its own steps.`,options:u.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,H.jsx)(et,{slot:`automation-runner-pill`,icon:m(pe),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner??`default`,value:e.runner??``,disabled:!s.data,options:[{value:``,label:`default`,desc:`The project’s default runner`},...d.map(e=>({value:e,label:se(s.data,e)}))],footer:(0,H.jsx)(rt,{uninstalled:r.uninstalled,signedOut:a.filter(t=>t!==e.runner)}),onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,H.jsx)(et,{slot:`automation-model-pill`,icon:m(_e),fieldLabel:!0,ariaLabel:`Model`,label:p,value:e.model??``,options:f.map(e=>({value:e.id,label:e.label,desc:e.desc})),onPick:e=>t({model:e||void 0})})]})})}function Ei({data:e,error:t,refresh:n,archived:r=!1,onArchivedChange:i}){let[a,o]=(0,V.useState)({}),[c,l]=(0,V.useState)({}),u=(e,t)=>o(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),d=async(e,t)=>{l(t=>({...t,[e]:!0}));try{await t()}catch(t){u(e,{text:t instanceof Error?t.message:String(t),tone:`error`})}finally{l(t=>({...t,[e]:!1}))}},f=e=>d(e.id,async()=>{u(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await m(e.id);u(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),p=e=>d(e.id,async()=>{u(e.id,void 0),await h(e.id,!e.enabled),await n()}),g=e=>d(e.id,async()=>{u(e.id,void 0),await x(e.id),await n()}),_=e=>d(e.id,async()=>{u(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await y(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await s(t);if(r.status===`complete`){u(e.id,{text:`${r.matches??0} filter match${r.matches===1?``:`es`} found; no tasks launched. Counts can include closed items and previously processed events.`,tone:`info`}),n();return}if(r.status===`error`)throw Error(r.error??`Preview failed`);await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)});return(0,H.jsx)(Y,{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,action:(0,H.jsx)(P,{asChild:!0,children:(0,H.jsx)(z,{to:`/automations/new`,children:`New automation`})}),children:t&&!e?(0,H.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,H.jsx)(X,{text:t}),(0,H.jsx)(P,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Di,{data:e}),i?(0,H.jsx)(`div`,{className:`mb-4 flex flex-wrap gap-2`,children:(0,H.jsx)(Gr,{pressed:r,onClick:()=>i(!r),children:`Archived`})}):null,r&&e.automations.length===0?(0,H.jsx)(X,{text:`No archived one-time schedules.`}):e.automations.length===0?(0,H.jsx)(Ke,{icon:(0,H.jsx)(he,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,H.jsx)(P,{asChild:!0,children:(0,H.jsx)(z,{to:`/automations/new`,children:`New automation`})})}):(0,H.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:e.automations.map(t=>(0,H.jsx)(Ri,{automation:t,timeZone:e.timeZone,note:a[t.id],busy:c[t.id]===!0,onRun:()=>void f(t),onToggle:()=>void p(t),onPreview:()=>void _(t),onCancel:()=>void g(t)},t.id))})]}):(0,H.jsx)(X,{text:`Loading automations…`})})}function Di({data:e}){return(0,H.jsx)(`p`,{"data-slot":`automation-scheduler`,className:i(`mb-4 text-xs break-words`,e.scheduler.state===`scheduled`?`text-success`:`text-muted-foreground`),children:`Scheduler ${e.scheduler.state===`scheduled`?`running`:`idle`} · GitHub ${e.available?`available`:`unavailable`}${e.reason?` · ${e.reason}`:``} · ${e.timeZone}`})}function Oi(e){return e.kind===`schedule`&&e.schedule?pt(e.schedule):`on ${(e.events??[]).join(`, `)} · every ${Math.round((e.intervalSeconds??300)/60)} min`}var ki={waiting:{label:`Waiting`,dot:`success`},paused:{label:`Paused`,dot:`neutral`},failed:{label:`Failed`,dot:`danger`},missed:{label:`Missed`,dot:`pending`},archived:{label:`Archived`,dot:`neutral`}};function Ai(e){if(e.schedule?.type===`once`)return ki[e.onceStatus??(e.enabled?`waiting`:`paused`)]}function ji({automation:e,badge:t}){return(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,H.jsx)(e.kind===`schedule`?ue:le,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,H.jsx)(`p`,{className:`mt-1.5 text-[13px] break-words text-muted-foreground`,children:Oi(e)})]}),t?(0,H.jsx)(it,{dot:t.dot,children:t.label}):(0,H.jsx)(it,{dot:e.enabled?`success`:`neutral`,children:e.enabled?`Enabled`:`Paused`})]})}function Mi({automation:e,archive:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`p`,{className:`mt-3 text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsx)(z,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,H.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:(0,H.jsx)(P,{variant:`outline`,asChild:!0,children:(0,H.jsx)(z,{to:`/automations/${e.id}`,children:`Details`})})})]})}function Ni({automation:e,timeZone:t}){let n=e.kind===`schedule`,r=e.enabled&&n?e.nextRunAt:void 0;return(0,H.jsx)(`p`,{className:`mt-3 text-sm`,children:!n&&e.enabled?(0,H.jsx)(`span`,{children:`continuous`}):r?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:`Next run: ${St(r,t)}`}),(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:` · ${mt(Date.now(),Date.parse(r))}`})]}):(0,H.jsx)(`span`,{children:`Next run: —`})})}function Pi({automation:e,timeZone:t}){let n=e.enabled?Qn(e.state):void 0;return n?(0,H.jsxs)(`p`,{role:`alert`,"data-slot":`automation-failing`,className:`mt-3 text-sm break-words text-destructive`,children:[`The last ${n.consecutiveFailures} checks failed: ${n.lastError}`,n.retryAt?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${St(n.retryAt,t)}`}):null]}):null}function Fi({automation:e,busy:t,confirmingCancel:n,cancelRef:r,onToggle:i,onRun:a,onPreview:o,onOpenCancel:s}){let c=e.kind===`schedule`,l=e.schedule?.type===`once`;return(0,H.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,H.jsx)(P,{variant:`outline`,asChild:!0,children:(0,H.jsx)(z,{to:`/automations/${e.id}`,children:`Edit`})}),(0,H.jsx)(P,{variant:`outline`,asChild:!0,children:(0,H.jsx)(z,{to:`/automations/${e.id}/log`,children:`Execution log`})}),(0,H.jsx)(P,{variant:`outline`,"data-action":`automation-toggle`,disabled:t,onClick:i,children:e.enabled?`Pause`:`Enable`}),c?(0,H.jsx)(P,{variant:`outline`,"data-action":`automation-run`,disabled:t,onClick:a,children:`Run now`}):(0,H.jsx)(P,{variant:`outline`,"data-action":`automation-preview`,disabled:t,onClick:o,children:`Test filter`}),l&&!n?(0,H.jsx)(P,{variant:`outline`,ref:r,"data-action":`automation-cancel`,disabled:t,onClick:s,children:`Cancel`}):null]})}function Ii({automation:e,busy:t,keepRef:n,onConfirm:r,onKeep:i}){return(0,H.jsxs)(`div`,{className:`mt-3 grid justify-items-start gap-2`,children:[(0,H.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(P,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,H.jsx)(P,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function Li({note:e}){return(0,H.jsxs)(`p`,{role:e.tone===`error`?`alert`:`status`,className:i(`mt-3 text-sm break-words`,e.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[e.text,e.runId?(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsx)(z,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`})]}):null]})}function Ri({automation:e,timeZone:t,note:n,busy:r,onRun:i,onToggle:a,onPreview:o,onCancel:s}){let[c,l]=(0,V.useState)(!1),u=(0,V.useRef)(null),d=(0,V.useRef)(null),f=(0,V.useRef)(null);(0,V.useEffect)(()=>{let e=f.current===`keep`?d.current:f.current===`cancel`?u.current:null;f.current=null,e?.focus()},[c]);let p=()=>{f.current=`keep`,l(!0)},m=()=>{f.current=`cancel`,l(!1)},h=e.archived;return(0,H.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,H.jsx)(ji,{automation:e,badge:Ai(e)}),h?(0,H.jsx)(Mi,{automation:e,archive:h}):null,h?null:(0,H.jsx)(Ni,{automation:e,timeZone:t}),h?null:(0,H.jsx)(Pi,{automation:e,timeZone:t}),h?null:(0,H.jsx)(Fi,{automation:e,busy:r,confirmingCancel:c,cancelRef:u,onToggle:a,onRun:i,onPreview:o,onOpenCancel:p}),e.schedule?.type===`once`&&!h&&c?(0,H.jsx)(Ii,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,H.jsx)(Li,{note:n}):null,(0,H.jsx)(_r,{automationId:e.id,automationName:e.name,timeZone:t})]})}function zi(e){let t=Ge(),n=Je(),[r,i]=(0,V.useState)(),[a,o]=(0,V.useState)(``),s=(0,V.useCallback)(t=>u({signal:t,...e?{archived:e}:{}}).then(e=>{t?.aborted||(i(e),o(``))}).catch(e=>{t?.aborted||o(String(e))}),[e]);return(0,V.useEffect)(()=>{n&&s()},[n,s]),(0,V.useEffect)(()=>c(async e=>{n&&await s(e)}),[n,s]),(0,V.useEffect)(()=>oe((e,n)=>{if(e!==`automation-change`)return;let r=n;typeof r.project==`string`&&(t===null||r.project===t)&&s()}),[t,s]),{data:r,error:a,refresh:s}}function Bi({mode:e=`list`}){let{automationId:t}=ae(),n=We(),[r,i]=(0,V.useState)(!1),{data:a,error:o,refresh:s}=zi(e===`list`?r?`only`:void 0:`include`),[c,l]=(0,V.useState)(0),u=$e();if(u===`unknown`)return(0,H.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,H.jsx)(X,{text:`Loading automations…`})});if(u===`unavailable`)return(0,H.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,H.jsx)(Ke,{icon:(0,H.jsx)(he,{}),tone:`neutral`,title:`Automations are off`,subtitle:`This server does not run schedules, poll GitHub or launch tasks from them. Unset CEZ_AUTOMATIONS or set it to 1 and restart Squawk to turn automations on.`,heading:`h2`})});let d=()=>{n(`/automations`),s()},f=a?.automations.find(e=>e.id===t);if(e===`list`)return(0,H.jsx)(Ei,{data:a,error:o,refresh:s,archived:r,onArchivedChange:i});if(!a)return o?(0,H.jsx)(Y,{title:`Automations`,subtitle:`Could not load automations.`,children:(0,H.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,H.jsx)(X,{text:o}),(0,H.jsx)(P,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]})}):(0,H.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,H.jsx)(X,{text:`Loading automations…`})});let p={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,H.jsx)(wi,{forge:p,timeZone:a.timeZone,onSaved:d}):e===`edit`?f?f.archived?(0,H.jsx)(vr,{automation:f,timeZone:a.timeZone,onDeleted:d}):(0,H.jsx)(wi,{automation:f,forge:p,timeZone:a.timeZone,onSaved:d,onReload:()=>void s().then(()=>l(e=>e+1))},`${f.id}:${c}`):(0,H.jsx)(Y,{title:`Automation not found`,subtitle:`This automation may have been removed.`,children:(0,H.jsx)(P,{asChild:!0,variant:`outline`,children:(0,H.jsx)(z,{to:`/automations`,children:`Back to automations`})})}):t?(0,H.jsx)(gr,{automationId:t,automationName:f?.name,timeZone:a.timeZone,readOnly:!!f?.archived}):(0,H.jsx)(X,{text:`Automation not found.`})}export{Bi as AutomationsRoute};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-D_bjQyDl.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/utils-DSMR_WLb.js","assets/bundle-mjs-rHxsej31.js","assets/chevron-right-BENZ-1ZN.js","assets/createLucideIcon-BHp8sXmF.js","assets/eye-B8okNWXU.js","assets/index-DXIRYobS.js","assets/live-refetch-CZb2VOyu.js","assets/project-scope-context-Dgq8_2JZ.js","assets/live-protocol-BXzu6cSE.js","assets/useInfiniteQuery-BnyaEFle.js","assets/queries-yuG-mM6_.js","assets/useQuery-BUslvRIM.js","assets/ws-Bal5BUy2.js","assets/toaster-Bo5vCbz-.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-Cg8l-LDN.js","assets/label-BWld23ke.js","assets/cez-idle-Crszm9Ts.js","assets/dist-C5mlVBmd.js","assets/dist-BW234Kg5.js","assets/tasks-table-DTNcYbbN.js","assets/task-groups-D4RYW5I_.js","assets/attention-otQlgfRj.js","assets/runners-CDw7wLfd.js","assets/design-icons-CzEoMH9c.js","assets/open-in-menu-D03osLGE.js","assets/bot-TkDIw4y-.js","assets/external-link-BE6y205O.js","assets/folder-o-AvL3y3.js","assets/smartphone-Lr8Ug2z_.js","assets/square-terminal-B6RYYieR.js","assets/button-BQ2y4XRB.js","assets/dropdown-menu-4e2iKSMT.js","assets/es2015-CQth82uv.js","assets/dist-BAoXdNsT.js","assets/dist-DXO3xwbC.js","assets/own-lookup-DS54wXvD.js","assets/dist-C28wFbz0.js","assets/chevron-down-CHGyCDBH.js","assets/nav-row-styles-DqKjMToI.js","assets/folder-browser-G_9ZgDjg.js","assets/format-BNCkW110.js","assets/play-CmVAj_fu.js","assets/reference-chip-DTKtEtWv.js","assets/popover-BPgUYFyu.js","assets/dist-Da4ckcJG.js","assets/switch-Bv2Zf1uU.js","assets/badge-D9JrXe0o.js","assets/dialog-BVF6dIeS.js","assets/project-router-DtTvMbeA.js","assets/status-dot-DtAOFiIi.js","assets/command-CDt1BsZy.js","assets/project-order-AcHI4Dcl.js","assets/skills-pM_PouEs.js","assets/agents-settings-path-7X6_cvUg.js","assets/centered-state-V15AR_qo.js","assets/index-F-X4qZSv.css","assets/highlighter-DvLzHjjY.js","assets/image-preview-CNBuRrK5.js","assets/zoomable-image-CIQl1Wpe.js","assets/markdown-BBDDg-4t.js","assets/markdown-CT65TA_B.js","assets/chunk-BO2N2NFS-DQrpGzb-.js","assets/lib-DrPFkMXk.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
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{t as i}from"./preload-helper-Czpn1I53.js";import{hn as a}from"./index-DXIRYobS.js";import{n as o,t as s}from"./image-preview-CNBuRrK5.js";var c=e(t(),1),l=n();function u(e){let[t,n]=(0,c.useState)(null);return(0,c.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-D_bjQyDl.js`).then(t=>{e||n({View:t.DiffView})},()=>{e||n(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66])),()=>{e=!0}},[]),e.files.length===0?(0,l.jsx)(`p`,{"data-slot":`diff-empty`,className:r(`px-1 text-xs text-soft-foreground`,e.className),children:`No changes.`}):t===`failed`?(0,l.jsx)(d,{...e}):t===null?(0,l.jsx)(`p`,{"data-slot":`diff-loading`,className:r(`px-1 text-xs text-soft-foreground`,e.className),children:`Loading diff…`}):(0,l.jsx)(t.View,{...e})}function d({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:i,viewRef:o,className:s}){let u={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(o,()=>({scrollToPath:e=>{for(let t of d.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,l.jsxs)(`div`,{ref:d,"data-slot":`diff`,"data-fallback":`true`,className:r(`flex min-w-0 flex-col gap-3`,s),children:[(0,l.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,l.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,l.jsx)(a,{stat:u})]}),e.map(e=>(0,l.jsx)(f,{file:e,wrap:t,imageSrc:n,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function f({file:e,wrap:t,imageSrc:n,onOpenInApp:i}){return(0,l.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,l.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,l.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),(0,l.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,l.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),o(e)?(0,l.jsx)(s,{file:e,imageSrc:n,onOpenInApp:i}):e.binary?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,l.jsx)(`pre`,{className:r(`py-2 font-mono text-xs leading-[1.7]`,t?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
|
|
3
|
-
`).map((e,t)=>(0,l.jsxs)(`span`,{className:r(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[e,e===``?` `:``]},t))})]})}export{u as t};
|