cezarion 0.19.0-dev.8823 → 0.19.0-dev.8839
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/web/dist/assets/{accounts-section-CnQrgrlx.js → accounts-section-Bb5BYebY.js} +1 -1
- package/web/dist/assets/{activity-motion-SZyZ3Vcd.js → activity-motion-CA5BGeJu.js} +1 -1
- package/web/dist/assets/{activity-route-kA927mMd.js → activity-route-DD4PBjfn.js} +1 -1
- package/web/dist/assets/{agent-config-section-DZ9lz-oU.js → agent-config-section-95nZ2oyM.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-CAyM93lD.js → agent-defaults-section-DEN23fw4.js} +1 -1
- package/web/dist/assets/{appearance-jU-y46Hc.js → appearance-B1Iykzeh.js} +1 -1
- package/web/dist/assets/automations-route-AUvP1Ssm.js +2 -0
- package/web/dist/assets/{commit-list-JK2MEtR0.js → commit-list-DDiXRZp-.js} +1 -1
- package/web/dist/assets/{diff-CC-HnvfR.js → diff-BCDjpdWy.js} +2 -2
- package/web/dist/assets/{diff-controls-CnrIcRRG.js → diff-controls-e4A8aqiA.js} +1 -1
- package/web/dist/assets/{diff-view-Dzl9i4zr.js → diff-view-ChmtoShm.js} +1 -1
- package/web/dist/assets/{file-preview-C1Nd5SH3.js → file-preview-B70cmj6I.js} +1 -1
- package/web/dist/assets/{git-toolbar-q-HOZgdL.js → git-toolbar-DjXTgNSk.js} +1 -1
- package/web/dist/assets/{github-RqiwU49D.js → github-gvOaefmM.js} +1 -1
- package/web/dist/assets/{global-activity-route-DTuWu-5a.js → global-activity-route-CyXDQDJJ.js} +1 -1
- package/web/dist/assets/{index-6yHpyOyH.js → index-01bdo9g3.js} +4 -4
- package/web/dist/assets/index-Dnupmo-Y.css +1 -0
- package/web/dist/assets/{markdown-NDbXgnqb.js → markdown-0A4VVYvY.js} +1 -1
- package/web/dist/assets/{notifications-section-CQ4HSyLK.js → notifications-section-DDL2APZA.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-Dm-Ga2KN.js → preview-pane-connected-C-SuSKu7.js} +1 -1
- package/web/dist/assets/{projects-section-CKPqFZP7.js → projects-section-CZcR4qW7.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-D9Tsgav9.js → prompt-templates-section-BbzMKGio.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-40uqklAG.js → remote-settings-notice-B6hTxIYs.js} +1 -1
- package/web/dist/assets/{repo-git-BBalirax.js → repo-git-Cmjvi7od.js} +1 -1
- package/web/dist/assets/{report-reader-D3Heszz3.js → report-reader-DF5GJ0Oy.js} +1 -1
- package/web/dist/assets/{reports-CEaxAigM.js → reports-UKabUE0O.js} +1 -1
- package/web/dist/assets/{resources-section-ohdWkreq.js → resources-section-C78q0b21.js} +1 -1
- package/web/dist/assets/{review-panel-CthaDvZO.js → review-panel-Bp-R8WNC.js} +1 -1
- package/web/dist/assets/{run-header-9NNASXmJ.js → run-header-BdTKi8uh.js} +1 -1
- package/web/dist/assets/{select-Bh7vwx79.js → select-XO8RqFp0.js} +1 -1
- package/web/dist/assets/{session-context-section-B5Ee7GbQ.js → session-context-section-DrMvcM5c.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-DeczgUDV.js → settings-agent-picker-BwpdE0xN.js} +1 -1
- package/web/dist/assets/{settings-shell-BvRwl06q.js → settings-shell-DJnHvj8U.js} +1 -1
- package/web/dist/assets/{sidebar-section-Bn1Uv9AQ.js → sidebar-section-yArRGW70.js} +1 -1
- package/web/dist/assets/{skills-DMyaR3WX.js → skills-BkWTRxwo.js} +1 -1
- package/web/dist/assets/{task-changes-ChM901cL.js → task-changes-CrAzob8D.js} +1 -1
- package/web/dist/assets/{task-commits-DOP65FDx.js → task-commits-DPoXXQps.js} +1 -1
- package/web/dist/assets/{task-file-scope-emNQrzps.js → task-file-scope-CacffK2K.js} +1 -1
- package/web/dist/assets/{task-files-BYPCvDCO.js → task-files-DgY-RwOe.js} +1 -1
- package/web/dist/assets/{task-github-item-CHGyiC4k.js → task-github-item-CwnXC2qm.js} +1 -1
- package/web/dist/assets/{task-thread-BI2pi8dZ.js → task-thread-HnpjNSqn.js} +1 -1
- package/web/dist/assets/{thread-state-CdKvrn7R.js → thread-state-CS4XvjJ-.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-stc7Vzni.js → use-hand-to-agent-state-Bl0ROgTv.js} +1 -1
- package/web/dist/assets/{workflows-DagjPw_m.js → workflows-C9WB0sEl.js} +1 -1
- package/web/dist/assets/{workspace-tools-BaLORh9B.js → workspace-tools-BBBmc9hT.js} +1 -1
- package/web/dist/assets/{worktrees-section-CSERluzw.js → worktrees-section-BpgeQfSs.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/dist/assets/automations-route-DzIrboEQ.js +0 -2
- package/web/dist/assets/index-DNgBNd8o.css +0 -1
package/web/dist/assets/{use-hand-to-agent-state-stc7Vzni.js → use-hand-to-agent-state-Bl0ROgTv.js}
RENAMED
|
@@ -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{n as r,t as i}from"./utils-DSMR_WLb.js";import{A as a,Ct as o,Jt as s,Wt as c,_ as l,a as u,c as d,dn as f,f as p,k as m,rn as h,sn as g}from"./queries-D0v1z40Y.js";import{$ as _,I as v,J as y,Pr as b,Y as x,a as S,hi as C,ii as w,n as T,st as E}from"./toaster-DMfiAEnw.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 P,ot as F,r as I,tt as L,u as te,ut as R,y as ne}from"./design-icons-CzEoMH9c.js";import{t as re}from"./chevron-down-CHGyCDBH.js";import{t as z}from"./external-link-BE6y205O.js";import{t as ie}from"./eye-B8okNWXU.js";import{t as ae}from"./loader-circle-CPBhhDbB.js";import{t as oe}from"./message-square-B-MD-8rD.js";import{t as se}from"./play-CmVAj_fu.js";import{t as B}from"./button-B7MKxYjT.js";import{i as ce,r as le,t as ue}from"./popover-CZV6tz9i.js";import{a as de,i as fe,o as pe,r as me,s as he,t as ge}from"./dialog-B531GGAo.js";import{t as V}from"./project-router-BifLGgRR.js";import{a as _e,i as H,o as U,r as ve,s as ye,t as be}from"./command-KdW7aO0N.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,F as ke,G as Ae,H as je,I as Me,J as Ne,K as Pe,L as Fe,M as Ie,Mn as G,N as Le,Nn as Re,P as ze,Pn as Be,U as Ve,W as K,X as He,Yn as q,Z as Ue,et as We,fr as Ge,hn as Ke,it as qe,j as Je,nt as Ye,rt as Xe,vn as Ze,xt as J}from"./index-6yHpyOyH.js";import{t as Qe}from"./markdown-NDbXgnqb.js";import{t as $e}from"./textarea-vJt9undk.js";import{t as et}from"./diff-CC-HnvfR.js";import{t as Y}from"./change-counts-npLATh-3.js";import{t as tt}from"./tab-link-DAxoMsUp.js";var X=e(t(),1),Z=n(),nt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Q({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:i(t,`text-semantic-green`)}):e===`failing`?(0,Z.jsx)(j,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:i(t,`text-semantic-red`)}):e===`pending`?(0,Z.jsx)(ae,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:i(t,`animate-spin text-semantic-amber motion-reduce:animate-none`)}):e===`review`?(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-review`,className:i(t,`text-semantic-info`)}):e===`conflict`?(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-conflict`,className:i(t,`text-semantic-conflict`)}):(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:i(t,`text-soft-foreground`)})}function rt(e){return e?.available?e.mergeState:null}function it(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function at(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function ot(e){return e===`approved`||e===`not-required`?`passing`:e===`review-required`?`review`:e===`unknown`?`unknown`:`failing`}function st(e){switch(e){case`approved`:return`Approved`;case`not-required`:return`Not required`;case`review-required`:return`Waiting for review`;case`changes-requested`:return`Changes requested`;case`unknown`:return`Unknown`}}function ct(e){return e===`mergeable`?`passing`:e===`conflicting`?`conflict`:`unknown`}function lt(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function ut(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function dt(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function ft(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function $(e){return e?nt[e]:`Merge`}function pt(e){return e===`conflicting`?`true`:void 0}function mt({check:e}){return(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(Q,{state:e.state}),(0,Z.jsxs)(`span`,{children:[e.name,` · `,e.state,ut(e.required)]})]}),e.url&&r(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function ht({reason:e}){return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function gt({state:e,selectedMethod:t,overrideRules:n,mergeEnabled:r,refreshPending:a,onRefresh:o,onRunAgent:s,onConfirm:c,onMethodChange:l,onOverrideChange:u}){let d=at(e),f=ot(e.reviewDecision),p=ct(e.mergeable);return(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-semantic-green`}):(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,className:i(`mt-0.5 size-5 shrink-0`,e.mergeable===`conflicting`?`text-semantic-conflict`:`text-semantic-amber`)}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold`,children:d}),(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:a,onClick:o,children:[(0,Z.jsx)(D,{size:16,"aria-hidden":`true`,className:i(`size-3.5`,a&&`animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-xs text-soft-foreground`,children:[e.headRef,` (`,Be(e.headSha),`) → `,e.baseRef]}),(0,Z.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Q,{state:f}),(0,Z.jsxs)(`span`,{children:[`Reviews: `,st(e.reviewDecision)]})]}),(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Q,{state:p}),(0,Z.jsxs)(`span`,{children:[`Conflicts: `,lt(e.mergeable)]})]}),e.checks.length===0?(0,Z.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,Z.jsx)(mt,{check:e},e.name)),e.blockers.map(e=>(0,Z.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&s?(0,Z.jsx)(B,{className:`mt-4`,onClick:s,children:`Run agent on this PR`}):null,e.canOverride?(0,Z.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-pending-strong/40 bg-pending/10 p-3 text-xs`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>u(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Z.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,Z.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,Z.jsx)(`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,Z.jsx)(`option`,{value:e,children:nt[e]},e))}),(0,Z.jsx)(B,{disabled:!r,onClick:c,children:$(t)})]}):null]})]})}function _t({number:e,state:t,selectedMethod:n,confirming:r,overrideRules:i,mergePending:a,mergeError:o,onOpenChange:s,onMerge:c}){return(0,Z.jsx)(ge,{open:r,onOpenChange:s,children:(0,Z.jsxs)(me,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Z.jsxs)(pe,{children:[(0,Z.jsxs)(he,{children:[$(n),` pull request #`,e,`?`]}),(0,Z.jsx)(fe,{asChild:!0,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),i&&t.canOverride?(0,Z.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-semantic-amber`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),o?(0,Z.jsx)(`p`,{className:`text-sm text-danger`,children:o.message}):null,(0,Z.jsxs)(de,{children:[(0,Z.jsx)(B,{variant:`outline`,disabled:a,onClick:()=>s(!1),children:`Cancel`}),(0,Z.jsx)(B,{disabled:a,onClick:c,children:a?`Merging…`:$(n)})]})]})})}function vt({number:e,onRunAgent:t}){let n=C(),r=p(),i=w({queryKey:c.githubMergeState(e),queryFn:({signal:t})=>x(e,{},{signal:t}),retry:!1}),a=rt(i.data),[o,s]=(0,X.useState)(null),[l,u]=(0,X.useState)(!1),[d,m]=(0,X.useState)(!1),h=f({mutationFn:t=>x(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>T(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=it(o,a),v=()=>({mergeState:c.githubMergeState(e),list:c.githubPages(50),comments:c.githubComments(`pr`,e),item:c.githubItem(`pr`,e),refStatus:r===void 0?void 0:c.githubRefStatusOf(r)}),y=f({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return _(e,{method:g,expectedHeadSha:a.headSha,...d&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{u(!1),T(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{T(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,Z.jsx)(q,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":pt(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-card-edge bg-card p-4 shadow-card`,children:[(0,Z.jsx)(gt,{state:a,selectedMethod:g,overrideRules:d,mergeEnabled:ft(g,a,d),refreshPending:h.isPending,onRefresh:()=>h.mutate(c.githubMergeState(e)),onRunAgent:t,onConfirm:()=>u(!0),onMethodChange:s,onOverrideChange:m}),(0,Z.jsx)(_t,{number:e,state:a,selectedMethod:g,confirming:l,overrideRules:d,mergePending:y.isPending,mergeError:y.error,onOpenChange:u,onMerge:()=>y.mutate(v())})]}):(0,Z.jsx)(ht,{reason:dt(i.data)})}function yt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function bt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function xt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function St(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function Ct({label:e,color:t,plain:n=!1}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:St(t),className:n?`text-xs font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function wt(e){return e===`pr`?`pull request`:`issue`}function Tt(e,t,n){return e===`pr`&&!!(t||n)}function Et({backLink:e}){return e?(0,Z.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Z.jsx)(I,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}var Dt=i(`text-sm`,`[&_[data-streamdown="code-block"]]:relative [&_[data-streamdown="code-block"]]:my-2.5 [&_[data-streamdown="code-block"]]:gap-0 [&_[data-streamdown="code-block"]]:overflow-hidden [&_[data-streamdown="code-block"]]:rounded-lg [&_[data-streamdown="code-block"]]:border [&_[data-streamdown="code-block"]]:border-border [&_[data-streamdown="code-block"]]:bg-background [&_[data-streamdown="code-block"]]:p-0 [&_[data-streamdown="code-block"]]:![content-visibility:visible] [&_[data-streamdown="code-block"]]:![contain-intrinsic-size:auto]`,`[&_[data-streamdown="code-block-header"]]:h-7 [&_[data-streamdown="code-block-header"]]:border-b [&_[data-streamdown="code-block-header"]]:border-border [&_[data-streamdown="code-block-header"]]:bg-muted/40 [&_[data-streamdown="code-block-header"]]:px-3 [&_[data-streamdown="code-block-header"]]:text-xs`,`[&_[data-streamdown="code-block-header"][data-language=""]]:hidden [&_[data-streamdown="code-block-header"]:not([data-language])]:hidden [&_[data-streamdown="code-block-header"]:has(>span:empty)]:hidden`,`[&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:absolute [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:top-1 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:right-1.5 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:mt-0 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:h-auto`,`[&_[data-streamdown="code-block-actions"]]:border-0 [&_[data-streamdown="code-block-actions"]]:bg-transparent [&_[data-streamdown="code-block-actions"]]:p-0 [&_[data-streamdown="code-block-actions"]]:backdrop-blur-none`,`[&_[data-streamdown="image-fallback"]]:inline-flex [&_[data-streamdown="image-fallback"]]:rounded-md [&_[data-streamdown="image-fallback"]]:border [&_[data-streamdown="image-fallback"]]:border-dashed [&_[data-streamdown="image-fallback"]]:border-border [&_[data-streamdown="image-fallback"]]:bg-muted/40 [&_[data-streamdown="image-fallback"]]:px-3 [&_[data-streamdown="image-fallback"]]:py-2 [&_[data-streamdown="image-fallback"]]:not-italic [&_[data-streamdown="image-fallback"]]:after:content-["_—_open_on_GitHub_to_view"]`,`[&_[data-streamdown="code-block-body"]]:rounded-none [&_[data-streamdown="code-block-body"]]:border-0 [&_[data-streamdown="code-block-body"]]:bg-transparent [&_[data-streamdown="code-block-body"]]:px-3.5 [&_[data-streamdown="code-block-body"]]:py-2.5 [&_[data-streamdown="code-block-body"]]:pr-10`);function Ot(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function kt({item:e,kindWord:t,commentCount:n,hasDiffStat:i,additions:a,deletions:o}){return(0,Z.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[`#`,e.number]}),`·`,(0,Z.jsx)(`span`,{children:t}),`·`,(0,Z.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Z.jsx)(G,{iso:e.createdAt,title:Ot(e.createdAt)}),n?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(tn,{count:n})]}):null,i?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(`span`,{"data-slot":`gh-diffstat`,children:(0,Z.jsx)(Y,{adds:a??0,dels:o??0})})]}):null,`·`,r(e.url)?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Z.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function At({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,Z.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Z.jsx)(tt,{to:J(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,Z.jsx)(tt,{to:J(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,Z.jsx)(V,{to:J(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function jt({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Z.jsx)(Ct,{label:e,color:t[e]},e)),n?(0,Z.jsx)(nn,{checks:n,url:e.url}):null]}):null}function Mt({item:e,colors:t,body:n}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"data-slot":`gh-body`,className:i(`mt-5`,Dt),children:n?(0,Z.jsx)(Qe,{children:n}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no description)`})}),(0,Z.jsx)(It,{item:e,colors:t})]})}function Nt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,headerAction:c,children:l}){let d=a?.changes??!1,f=wt(e.kind),p=u(e.kind,e.number,!d).data?.detail,m=p?.body??e.body,h=p?.additions??e.additions,g=p?.deletions??e.deletions,_=Tt(e.kind,h,g),v=r??e.comments;return(0,Z.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Z.jsx)(Et,{backLink:i}),(0,Z.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,Z.jsx)(Pt,{action:c,className:`mb-4`,children:(0,Z.jsxs)(`h2`,{className:`min-w-0 text-[22px] leading-snug font-semibold tracking-tight`,children:[`#`,e.number,` `,e.title]})}):null,(0,Z.jsx)(Pt,{action:e.kind===`pr`?void 0:c,children:(0,Z.jsx)(kt,{item:e,kindWord:f,commentCount:v,hasDiffStat:_,additions:h,deletions:g})}),e.kind===`pr`?null:(0,Z.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-semibold tracking-tight`,children:e.title}),s,(0,Z.jsx)(At,{item:e,subNav:a,changes:d}),(0,Z.jsx)(jt,{item:e,colors:t,checks:n}),d&&e.kind===`pr`?(0,Z.jsx)(Ft,{item:e}):(0,Z.jsx)(Mt,{item:e,colors:t,body:m})]}),e.kind===`pr`?(0,Z.jsx)(vt,{number:e.number,onRunAgent:o}):null,l]})}function Pt({action:e,className:t,children:n}){return e?(0,Z.jsxs)(`div`,{"data-slot":`gh-header-row`,className:i(`flex flex-wrap items-center gap-x-3 gap-y-2`,t),children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:n}),(0,Z.jsx)(`div`,{"data-slot":`gh-header-action`,className:`flex shrink-0 items-center gap-2`,children:e})]}):t?(0,Z.jsx)(`div`,{className:t,children:n}):(0,Z.jsx)(Z.Fragment,{children:n})}function Ft({item:e}){let t=C(),n=d(e.number),[a,o]=(0,X.useState)(``),[s,l]=(0,X.useState)(null),u=n.data,f=e=>u?.available?u.files.filter(t=>t.path.toLowerCase().includes(e.toLowerCase())):[],p=f(a),m=p.some(e=>e.path===s)?s:p[0]?.path??null,h=p.findIndex(e=>e.path===m),g=e=>{o(e);let t=f(e),n=m??s,r=t.some(e=>e.path===n)?n:t[0]?.path??n;r!==s&&l(r)},_=async()=>{let n=u?.available?u.headSha:null,r=c.githubPrChanges(e.number),i=await y(e.number,{refresh:!0});t.setQueryData(r,i),i.available&&n&&n!==i.headSha&&(l(i.files[0]?.path??null),T(`The reviewed revision changed.`))};if(n.isPending)return(0,Z.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!u)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!u.available)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:u.reason});let v=p.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),b=r(e.url)?`${e.url}/files`:null,x=p.find(e=>e.path===m);return(0,Z.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Z.jsxs)(`strong`,{children:[u.files.length,` changed files`]}),(0,Z.jsx)(Y,{adds:u.additions,dels:u.deletions}),(0,Z.jsx)(Re,{sha:u.headSha,variant:`inline`,prefix:`head `,className:`text-muted-foreground`}),(0,Z.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void _(),children:`Refresh`})]}),u.truncated?(0,Z.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-pending-strong/40 bg-pending/10 p-3 text-xs`,children:[u.reason??`This response is incomplete.`,` `,b?(0,Z.jsx)(`a`,{href:b,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Z.jsx)(`input`,{"aria-label":`Filter changed files`,value:a,onChange:e=>g(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,Z.jsxs)(`div`,{className:`relative mt-2 lg:hidden`,children:[(0,Z.jsx)(`select`,{"aria-label":`Select changed file`,value:m??``,onChange:e=>l(e.target.value),className:`min-h-11 w-full appearance-none rounded-md border border-input bg-background py-2 pr-8 pl-3 text-sm`,children:p.map(e=>(0,Z.jsx)(`option`,{children:e.path},e.path))}),(0,Z.jsx)(re,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground`})]}),(0,Z.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>l(e.path),className:i(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,m===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Z.jsx)(Y,{adds:e.additions,dels:e.deletions})]})},e.path))})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Z.jsx)(B,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:h<=0,onClick:()=>l(p[h-1]?.path??null),children:(0,Z.jsx)(Ge,{})}),(0,Z.jsx)(B,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:h<0||h>=p.length-1,onClick:()=>l(p[h+1]?.path??null),children:(0,Z.jsx)(te,{size:16})})]}),p.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(et,{files:v.filter(e=>e.path===m),wrap:!0,className:`min-w-0`}),x&&!x.patch?(0,Z.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,x.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function It({item:e,colors:t}){let n=u(e.kind,e.number),r=n.data,i=(0,X.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(Lt(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsx)(q,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(q,{className:`h-14 w-full`}),(0,Z.jsx)(q,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-xs font-semibold tracking-wide text-muted-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Rt(i).map(e=>e.group===`commits`?(0,Z.jsx)(zt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(Xt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Vt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-muted-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Lt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Rt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function zt({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Bt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(Vt,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Bt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(G,{iso:e[e.length-1].createdAt,className:`shrink-0`})]})})}var Bt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Vt({event:e,colors:t}){return(0,Z.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:i(`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Bt[e.kind]}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Z.jsx)(qt,{event:e,colors:t}),(0,Z.jsx)(G,{iso:e.createdAt,className:`shrink-0`}),e.url?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Ht({event:e}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Z.jsx)(Re,{sha:e.sha,variant:`inline`,className:`shrink-0 text-xs text-muted-foreground`}):null,e.message?(0,Z.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Z.jsx)(Jt,{checks:e.checks})]})}function Ut({event:e,colors:t}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Z.jsx)(`span`,{"data-slot":`gh-event-label`,style:St(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,Z.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Wt({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Gt({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Kt={committed:e=>(0,Z.jsx)(Ht,{event:e}),labeled:(e,t)=>(0,Z.jsx)(Ut,{event:e,colors:t}),unlabeled:(e,t)=>(0,Z.jsx)(Ut,{event:e,colors:t}),assigned:e=>(0,Z.jsx)(Wt,{event:e}),unassigned:e=>(0,Z.jsx)(Wt,{event:e}),merged:()=>(0,Z.jsx)(`span`,{children:`merged this`}),closed:()=>(0,Z.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,Z.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,Z.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,Z.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,Z.jsx)(Gt,{event:e})};function qt({event:e,colors:t}){return Kt[e.kind]?.(e,t)??null}function Jt({checks:e}){return e?(0,Z.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:i(`shrink-0`,$t[e]),children:Qt[e]}):null}var Yt={approved:{label:`Approved`,tone:`border-success/40 text-semantic-green`},changes_requested:{label:`Changes requested`,tone:`border-danger/40 text-semantic-red`},commented:{label:`Commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`Dismissed`,tone:`border-border text-muted-foreground`}};function Xt({comment:e}){let t=e.reviewState?Yt[e.reviewState]:null;return(0,Z.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Zt,{url:e.avatarUrl,login:e.author}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Z.jsx)(G,{iso:e.createdAt}),t?(0,Z.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,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Z.jsx)(`div`,{"data-slot":`gh-thread-body`,className:Dt,children:e.body?(0,Z.jsx)(Qe,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no body)`})})]})}function Zt({url:e,login:t}){let[n,r]=(0,X.useState)(!1);return e&&!n?(0,Z.jsx)(`img`,{src:e,alt:``,width:20,height:20,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-5 shrink-0 rounded-full`}):(0,Z.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Qt={passing:`✓`,failing:`✗`,pending:`○`},$t={passing:`text-semantic-green`,failing:`text-semantic-red`,pending:`text-semantic-amber`},en={passing:`Checks passing`,failing:`Checks failing`,pending:`Checks pending`};function tn({count:e}){return e?(0,Z.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,Z.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function nn({checks:e,url:t}){let n=i(`text-xs font-medium`,$t[e],t&&`hover:underline`),r=`${Qt[e]} ${en[e]}`;return t?(0,Z.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Z.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function rn({checks:e}){return(0,Z.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:en[e],"aria-label":en[e],className:i(`shrink-0 font-sans text-xs font-semibold`,$t[e]),children:Qt[e]})}function an(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function on(e,t=[]){let n=an(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=sn(t)),n}function sn(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function cn(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function ln(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function un(e,t,n){let r=(n??``).trim();if(!r)return on(e,t);let i=an(e),a=r.startsWith(i)?i+cn(r.slice(i.length),e):cn(r,e),o=ln(a,e)?a:`${i}\n\n${a}`;return t.length?o+sn(t):o}function dn(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function fn(e,t,n,r,i={}){return t?{...i,workflow:t,task:un(e,n.map(e=>e.id),r)}:n.length?{...i,steps:dn(n.map(e=>e.id)).map((e,t)=>({...e,...n[t]?.path===void 0?{}:{skillPath:n[t].path}})),task:un(e,[],r)}:{...i,workflow:`quick-task`,task:un(e,[],r)}}function pn(e){let t=o(),n=l(),r=h(),{runners:i,uninstalled:a,signedOut:s,accounts:c,repoAccount:u,accountFor:d}=Ze(),f=n.data?.defaultRunner,p=Me(e.runner,i,f??i[0]??`claude`),m=n.data?.modelsLocked===!0,_=d(p,e.account),v=g(p,!0,_??u?.[p]),y=ke(m?null:e.model,p,r.data,n.data?.defaultModels,v.data),b=Ie(y,v.data);return{runner:p,runnerExplicit:e.runner!==null,model:y,effort:m?``:ze(e.effort,b),effortOptions:b,runners:i,uninstalled:a,signedOut:s,defaultRunner:f,canRun:t.isSuccess&&i.length>0,modelsLocked:m,providerPending:t.isPending,providerError:t.isError,accounts:c,account:_,repoAccount:u}}function mn(e){return{runner: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 hn(e){return{...mn(e),...e.account?{agentProfile:e.account}:{}}}function gn(e,t){let{runners:n,uninstalled:r,signedOut:i}=e;return n.length>1||r.length>0||i.length>0||n.some(e=>Ke(t,e))}function _n({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,X.useRef)(null),o=(0,X.useRef)(null),[s,c]=(0,X.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,X.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,X.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let u=pn(e),{runner:d,model:f,effort:p,effortOptions:m,runners:_,canRun:v,modelsLocked:y}=u,b=l(),x=h(),S=g(d,!0,u.account??u.repoAccount?.[d]),C=Le(d,x.data,S.data,[e.model,b.data?.defaultModels?.[d]]),w=n||!v,T=r?u.accounts:[],E=gn(u,T)?(0,Z.jsx)(Pe,{icon:(0,Z.jsx)(M,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:_,uninstalled:u.uninstalled,signedOut:u.signedOut,value:d,accounts:T,account:r?u.account:null,repoAccount:r?u.repoAccount:void 0,disabled:w,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===d?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,D=(0,Z.jsx)(K,{icon:(0,Z.jsx)(ne,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:f===``?`Default`:C.find(e=>e.id===f).label,value:f,disabled:w,readOnly:y===!0,disabledHint:y?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Ie(n,S.data);t({...e,model:n,effort:e.effort===null?null:ze(e.effort,r)})},options:C.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Je(d,x.data,S)},`model`),O=(0,Z.jsx)(K,{icon:(0,Z.jsx)(N,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:m.find(e=>e.value===p)?.label??`auto`,value:p,disabled:w,readOnly:y===!0,disabledHint:y?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:m.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,Z.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,Z.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,Z.jsx)(Ae,{fill:`model-pill`,children:s?[E,O,D]:[E,D,O]})})}):(0,Z.jsxs)(Ae,{children:[E,D,O]})}var vn={workflow:null,skills:[]},yn=`cez-followup-selection`;function bn(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 xn(){try{let e=localStorage.getItem(yn);return e?bn(JSON.parse(e)):{...vn}}catch{return{...vn}}}function Sn(e){try{localStorage.setItem(yn,JSON.stringify(e))}catch{}}var Cn=`cez-followup-prompt:`;function wn(e){try{return localStorage.getItem(Cn+e)??``}catch{return``}}function Tn(e,t){try{t===``?localStorage.removeItem(Cn+e):localStorage.setItem(Cn+e,t)}catch{}}function En({item:e,workflows:t,skills:n,workflow:i,onWorkflowChange:a,selectedSkills:o,onSkillsChange:l,engine:u,onEngineChange:d,queuedRunId:p,onQueued:h}){let g=C(),_=m(),y=e.kind===`pr`?`PR`:`issue`,b=pn(u),x=s(b.runner,b.account),S=o.filter(e=>x.unchecked||e.path===void 0||n.some(t=>t.id===e.id&&(e.path===void 0||t.path===e.path))),w=S.length!==o.length,[D]=(0,X.useState)(()=>an(e)),[k,A]=(0,X.useState)(()=>wn(e.url)||D),j=(0,X.useRef)(null),M=(0,X.useRef)(null);(0,X.useEffect)(()=>{Tn(e.url,k===D?``:k)},[e.url,k,D]);let N=(0,X.useMemo)(()=>Ye(_.data?.promptTemplates),[_.data?.promptTemplates]),ee=e=>{let t=j.current,n=qe({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)})},P=Oe(N,S.map(e=>e.id)),F=(0,X.useRef)(k);F.current=k;let I=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=Xe(F.current,I.current,P,D);I.current=e.applied,e.text!==F.current&&A(e.text)},[P,D]);let L=f({mutationFn:async()=>!b.canRun||w?null:E(fn(e,i,S,k,hn(b))),onSuccess:t=>{if(t===null)return;let n=t;n&&h(e.url,n.id),T(`Added to the queue — ${y} #${e.number}`),S.length>0&&_.data!==void 0&&v({skillUsage:S.reduce((e,t)=>Ee(e,t.id),_.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:c.uiState})).catch(()=>{}),Tn(e.url,``),A(D),I.current=``,g.invalidateQueries({queryKey:c.runs.all})},onError:e=>T(e.message,{tone:`danger`})}),te=e=>{He({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!L.isPending&&b.canRun&&L.mutate())},R=e=>l(o.some(t=>W(t)===W(e))?o.filter(t=>W(t)!==W(e)):[...o,Te(e)]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Z.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Z.jsx)(`span`,{children:`Instructions for the agent`}),(0,Z.jsx)($e,{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:te,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Z.jsx)(Ve,{templates:N,onInsert:ee}),(0,Z.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Workflow`}),(0,Z.jsx)(On,{workflows:t,value:i,onChange:a})]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Skills · select one or more`}),(0,Z.jsx)(An,{skills:n,skillUsage:_.data?.skillUsage,selected:o,onToggle:R})]}),o.length>0?(0,Z.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:o.map(e=>(0,Z.jsx)(Dn,{skill:e,skills:n,unchecked:x.unchecked,onRemove:()=>R(e)},W(e)))}):null,w?(0,Z.jsx)(`p`,{role:`alert`,children:`A selected skill path is unavailable. Remove it or choose a current copy before starting.`}):null,(0,Z.jsx)(_n,{layout:`row`,pick:u,onChange:d,disabled:L.isPending||!b.canRun,accounts:!0}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Account`}),(0,Z.jsx)(kn,{resolved:b,disabled:L.isPending||!b.canRun,onPick:e=>d({...u,account:e})})]}),!b.providerPending&&!b.canRun?(0,Z.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[b.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Z.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Z.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[r(e.url)?(0,Z.jsx)(B,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Z.jsxs)(B,{variant:`primary`,"data-action":`gh-run`,disabled:L.isPending||!b.canRun||w,onClick:()=>L.mutate(),children:[(0,Z.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,y]}),(0,Z.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-xs font-medium text-muted-foreground`,children:Ue()}),p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Z.jsx)(V,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function Dn({skill:e,skills:t,unchecked:n,onRemove:r}){let i=t.find(t=>t.id===e.id&&(e.path===void 0||t.path===e.path)),a=[i?.name??e.id,e.path].filter(Boolean).join(` · `),o=!n&&e.path!==void 0&&!i?` (unavailable)`:n||!i?` (unchecked)`:``;return(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e.id,onClick:r,title:`Remove skill ${a}`,"aria-label":`Remove skill ${a}`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[a,o,(0,Z.jsx)(A,{size:16,"aria-hidden":`true`,className:`size-3`})]})}function On({workflows:e,value:t,onChange:n}){let[r,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),c=(0,X.useRef)(null),l=xe(e,o);return(0,Z.jsxs)(ue,{open:r,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:i(Ne,t&&`border-foreground/60 font-mono text-xs font-semibold text-foreground`),children:[(0,Z.jsx)(R,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Z.jsx)(ee,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(le,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(be,{shouldFilter:!1,children:[(0,Z.jsx)(_e,{placeholder:`Search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Z.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,Z.jsx)(ve,{children:`Nothing matches.`}):null,(0,Z.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,Z.jsxs)(U,{value:`workflow ${e.name}`,keywords:we(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function kn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:b,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,...e.configDir?{desc:e.configDir}:{}}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Z.jsx)(K,{icon:(0,Z.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 An({skills:e,skillUsage:t,selected:n,onToggle:r}){let[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(null),d=(0,X.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=De(e,s,t),g=(e,t)=>{let a=n.some(t=>W(t)===W(e));return(0,Z.jsxs)(U,{value:W(e),keywords:we(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.id,"data-selected":a?`true`:void 0,onSelect:()=>r(Te(e)),children:[(0,Z.jsx)(`span`,{className:i(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.path?(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Z.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Z.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},W(e))};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(je,{skill:l,onClose:()=>u(null)}),(0,Z.jsxs)(ue,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.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,Z.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Z.jsx)(ee,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(le,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(be,{shouldFilter:!1,children:[(0,Z.jsx)(_e,{placeholder:`Search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,Z.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,Z.jsx)(H,{children:(0,Z.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,Z.jsx)(ve,{children:`Nothing matches.`}):null,h?h.length>0?(0,Z.jsx)(H,{children:h.map(e=>g(e,Se(e)))}):null:(0,Z.jsxs)(Z.Fragment,{children:[f.length>0?(0,Z.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,Se(e)))}):null,p.length>0?(0,Z.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,Z.jsx)(H,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var jn=new WeakMap;function Mn(){let e=xn(),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)&&Sn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function Nn(){let e=C(),{projectId:t}=S(),n=jn.get(e);n||jn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=Mn());let{snapshot:i,subscribe:o,update:c}=r,l=(0,X.useSyncExternalStore)(o,i,i),u=a(),d=pn(l.engine),f=s(d.runner,d.account),p=m(),h=u.data?.workflows;(0,X.useEffect)(()=>{h&&l.workflow!==null&&!h.some(e=>e.name===l.workflow)&&c({workflow:null})},[c,h,l.workflow]);let g=(0,X.useMemo)(()=>Ce(f.data??[],p.data?.skillUsage),[f.data,p.data?.skillUsage]);return{...l,workflows:u,skillList:g,skillsUnchecked:f.unchecked,setWorkflow:e=>c({workflow:e}),setSelectedSkills:e=>c({selectedSkills:e}),setEngine:e=>c({engine:e}),onQueued:(e,t)=>c({queued:new Map(i().queued).set(e,t)})}}export{tn as a,Rt as c,St as d,xt as f,rn as i,yt as l,En as n,Nt as o,on as r,Ct as s,Nn as t,bt as u};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,t as i}from"./utils-DSMR_WLb.js";import{A as a,Ct as o,Jt as s,Wt as c,_ as l,a as u,c as d,dn as f,f as p,k as m,rn as h,sn as g}from"./queries-D0v1z40Y.js";import{$ as _,I as v,J as y,Pr as b,Y as x,a as S,hi as C,ii as w,n as T,st as E}from"./toaster-DMfiAEnw.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 P,ot as F,r as I,tt as L,u as te,ut as R,y as ne}from"./design-icons-CzEoMH9c.js";import{t as re}from"./chevron-down-CHGyCDBH.js";import{t as z}from"./external-link-BE6y205O.js";import{t as ie}from"./eye-B8okNWXU.js";import{t as ae}from"./loader-circle-CPBhhDbB.js";import{t as oe}from"./message-square-B-MD-8rD.js";import{t as se}from"./play-CmVAj_fu.js";import{t as B}from"./button-B7MKxYjT.js";import{i as ce,r as le,t as ue}from"./popover-CZV6tz9i.js";import{a as de,i as fe,o as pe,r as me,s as he,t as ge}from"./dialog-B531GGAo.js";import{t as V}from"./project-router-BifLGgRR.js";import{a as _e,i as H,o as U,r as ve,s as ye,t as be}from"./command-KdW7aO0N.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,F as ke,G as Ae,H as je,I as Me,J as Ne,K as Pe,L as Fe,M as Ie,Mn as G,N as Le,Nn as Re,P as ze,Pn as Be,U as Ve,W as K,X as He,Yn as q,Z as Ue,et as We,fr as Ge,hn as Ke,it as qe,j as Je,nt as Ye,rt as Xe,vn as Ze,xt as J}from"./index-01bdo9g3.js";import{t as Qe}from"./markdown-0A4VVYvY.js";import{t as $e}from"./textarea-vJt9undk.js";import{t as et}from"./diff-BCDjpdWy.js";import{t as Y}from"./change-counts-npLATh-3.js";import{t as tt}from"./tab-link-DAxoMsUp.js";var X=e(t(),1),Z=n(),nt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Q({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:i(t,`text-semantic-green`)}):e===`failing`?(0,Z.jsx)(j,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:i(t,`text-semantic-red`)}):e===`pending`?(0,Z.jsx)(ae,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:i(t,`animate-spin text-semantic-amber motion-reduce:animate-none`)}):e===`review`?(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-review`,className:i(t,`text-semantic-info`)}):e===`conflict`?(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-conflict`,className:i(t,`text-semantic-conflict`)}):(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:i(t,`text-soft-foreground`)})}function rt(e){return e?.available?e.mergeState:null}function it(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function at(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function ot(e){return e===`approved`||e===`not-required`?`passing`:e===`review-required`?`review`:e===`unknown`?`unknown`:`failing`}function st(e){switch(e){case`approved`:return`Approved`;case`not-required`:return`Not required`;case`review-required`:return`Waiting for review`;case`changes-requested`:return`Changes requested`;case`unknown`:return`Unknown`}}function ct(e){return e===`mergeable`?`passing`:e===`conflicting`?`conflict`:`unknown`}function lt(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function ut(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function dt(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function ft(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function $(e){return e?nt[e]:`Merge`}function pt(e){return e===`conflicting`?`true`:void 0}function mt({check:e}){return(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(Q,{state:e.state}),(0,Z.jsxs)(`span`,{children:[e.name,` · `,e.state,ut(e.required)]})]}),e.url&&r(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function ht({reason:e}){return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function gt({state:e,selectedMethod:t,overrideRules:n,mergeEnabled:r,refreshPending:a,onRefresh:o,onRunAgent:s,onConfirm:c,onMethodChange:l,onOverrideChange:u}){let d=at(e),f=ot(e.reviewDecision),p=ct(e.mergeable);return(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-semantic-green`}):(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,className:i(`mt-0.5 size-5 shrink-0`,e.mergeable===`conflicting`?`text-semantic-conflict`:`text-semantic-amber`)}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold`,children:d}),(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:a,onClick:o,children:[(0,Z.jsx)(D,{size:16,"aria-hidden":`true`,className:i(`size-3.5`,a&&`animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-xs text-soft-foreground`,children:[e.headRef,` (`,Be(e.headSha),`) → `,e.baseRef]}),(0,Z.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Q,{state:f}),(0,Z.jsxs)(`span`,{children:[`Reviews: `,st(e.reviewDecision)]})]}),(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Q,{state:p}),(0,Z.jsxs)(`span`,{children:[`Conflicts: `,lt(e.mergeable)]})]}),e.checks.length===0?(0,Z.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,Z.jsx)(mt,{check:e},e.name)),e.blockers.map(e=>(0,Z.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&s?(0,Z.jsx)(B,{className:`mt-4`,onClick:s,children:`Run agent on this PR`}):null,e.canOverride?(0,Z.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-pending-strong/40 bg-pending/10 p-3 text-xs`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>u(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Z.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,Z.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,Z.jsx)(`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,Z.jsx)(`option`,{value:e,children:nt[e]},e))}),(0,Z.jsx)(B,{disabled:!r,onClick:c,children:$(t)})]}):null]})]})}function _t({number:e,state:t,selectedMethod:n,confirming:r,overrideRules:i,mergePending:a,mergeError:o,onOpenChange:s,onMerge:c}){return(0,Z.jsx)(ge,{open:r,onOpenChange:s,children:(0,Z.jsxs)(me,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Z.jsxs)(pe,{children:[(0,Z.jsxs)(he,{children:[$(n),` pull request #`,e,`?`]}),(0,Z.jsx)(fe,{asChild:!0,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),i&&t.canOverride?(0,Z.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-semantic-amber`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),o?(0,Z.jsx)(`p`,{className:`text-sm text-danger`,children:o.message}):null,(0,Z.jsxs)(de,{children:[(0,Z.jsx)(B,{variant:`outline`,disabled:a,onClick:()=>s(!1),children:`Cancel`}),(0,Z.jsx)(B,{disabled:a,onClick:c,children:a?`Merging…`:$(n)})]})]})})}function vt({number:e,onRunAgent:t}){let n=C(),r=p(),i=w({queryKey:c.githubMergeState(e),queryFn:({signal:t})=>x(e,{},{signal:t}),retry:!1}),a=rt(i.data),[o,s]=(0,X.useState)(null),[l,u]=(0,X.useState)(!1),[d,m]=(0,X.useState)(!1),h=f({mutationFn:t=>x(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>T(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=it(o,a),v=()=>({mergeState:c.githubMergeState(e),list:c.githubPages(50),comments:c.githubComments(`pr`,e),item:c.githubItem(`pr`,e),refStatus:r===void 0?void 0:c.githubRefStatusOf(r)}),y=f({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return _(e,{method:g,expectedHeadSha:a.headSha,...d&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{u(!1),T(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{T(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,Z.jsx)(q,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":pt(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-card-edge bg-card p-4 shadow-card`,children:[(0,Z.jsx)(gt,{state:a,selectedMethod:g,overrideRules:d,mergeEnabled:ft(g,a,d),refreshPending:h.isPending,onRefresh:()=>h.mutate(c.githubMergeState(e)),onRunAgent:t,onConfirm:()=>u(!0),onMethodChange:s,onOverrideChange:m}),(0,Z.jsx)(_t,{number:e,state:a,selectedMethod:g,confirming:l,overrideRules:d,mergePending:y.isPending,mergeError:y.error,onOpenChange:u,onMerge:()=>y.mutate(v())})]}):(0,Z.jsx)(ht,{reason:dt(i.data)})}function yt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function bt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function xt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function St(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function Ct({label:e,color:t,plain:n=!1}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:St(t),className:n?`text-xs font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function wt(e){return e===`pr`?`pull request`:`issue`}function Tt(e,t,n){return e===`pr`&&!!(t||n)}function Et({backLink:e}){return e?(0,Z.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Z.jsx)(I,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}var Dt=i(`text-sm`,`[&_[data-streamdown="code-block"]]:relative [&_[data-streamdown="code-block"]]:my-2.5 [&_[data-streamdown="code-block"]]:gap-0 [&_[data-streamdown="code-block"]]:overflow-hidden [&_[data-streamdown="code-block"]]:rounded-lg [&_[data-streamdown="code-block"]]:border [&_[data-streamdown="code-block"]]:border-border [&_[data-streamdown="code-block"]]:bg-background [&_[data-streamdown="code-block"]]:p-0 [&_[data-streamdown="code-block"]]:![content-visibility:visible] [&_[data-streamdown="code-block"]]:![contain-intrinsic-size:auto]`,`[&_[data-streamdown="code-block-header"]]:h-7 [&_[data-streamdown="code-block-header"]]:border-b [&_[data-streamdown="code-block-header"]]:border-border [&_[data-streamdown="code-block-header"]]:bg-muted/40 [&_[data-streamdown="code-block-header"]]:px-3 [&_[data-streamdown="code-block-header"]]:text-xs`,`[&_[data-streamdown="code-block-header"][data-language=""]]:hidden [&_[data-streamdown="code-block-header"]:not([data-language])]:hidden [&_[data-streamdown="code-block-header"]:has(>span:empty)]:hidden`,`[&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:absolute [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:top-1 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:right-1.5 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:mt-0 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:h-auto`,`[&_[data-streamdown="code-block-actions"]]:border-0 [&_[data-streamdown="code-block-actions"]]:bg-transparent [&_[data-streamdown="code-block-actions"]]:p-0 [&_[data-streamdown="code-block-actions"]]:backdrop-blur-none`,`[&_[data-streamdown="image-fallback"]]:inline-flex [&_[data-streamdown="image-fallback"]]:rounded-md [&_[data-streamdown="image-fallback"]]:border [&_[data-streamdown="image-fallback"]]:border-dashed [&_[data-streamdown="image-fallback"]]:border-border [&_[data-streamdown="image-fallback"]]:bg-muted/40 [&_[data-streamdown="image-fallback"]]:px-3 [&_[data-streamdown="image-fallback"]]:py-2 [&_[data-streamdown="image-fallback"]]:not-italic [&_[data-streamdown="image-fallback"]]:after:content-["_—_open_on_GitHub_to_view"]`,`[&_[data-streamdown="code-block-body"]]:rounded-none [&_[data-streamdown="code-block-body"]]:border-0 [&_[data-streamdown="code-block-body"]]:bg-transparent [&_[data-streamdown="code-block-body"]]:px-3.5 [&_[data-streamdown="code-block-body"]]:py-2.5 [&_[data-streamdown="code-block-body"]]:pr-10`);function Ot(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function kt({item:e,kindWord:t,commentCount:n,hasDiffStat:i,additions:a,deletions:o}){return(0,Z.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[`#`,e.number]}),`·`,(0,Z.jsx)(`span`,{children:t}),`·`,(0,Z.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Z.jsx)(G,{iso:e.createdAt,title:Ot(e.createdAt)}),n?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(tn,{count:n})]}):null,i?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(`span`,{"data-slot":`gh-diffstat`,children:(0,Z.jsx)(Y,{adds:a??0,dels:o??0})})]}):null,`·`,r(e.url)?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Z.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function At({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,Z.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Z.jsx)(tt,{to:J(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,Z.jsx)(tt,{to:J(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,Z.jsx)(V,{to:J(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function jt({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Z.jsx)(Ct,{label:e,color:t[e]},e)),n?(0,Z.jsx)(nn,{checks:n,url:e.url}):null]}):null}function Mt({item:e,colors:t,body:n}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"data-slot":`gh-body`,className:i(`mt-5`,Dt),children:n?(0,Z.jsx)(Qe,{children:n}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no description)`})}),(0,Z.jsx)(It,{item:e,colors:t})]})}function Nt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,headerAction:c,children:l}){let d=a?.changes??!1,f=wt(e.kind),p=u(e.kind,e.number,!d).data?.detail,m=p?.body??e.body,h=p?.additions??e.additions,g=p?.deletions??e.deletions,_=Tt(e.kind,h,g),v=r??e.comments;return(0,Z.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Z.jsx)(Et,{backLink:i}),(0,Z.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,Z.jsx)(Pt,{action:c,className:`mb-4`,children:(0,Z.jsxs)(`h2`,{className:`min-w-0 text-[22px] leading-snug font-semibold tracking-tight`,children:[`#`,e.number,` `,e.title]})}):null,(0,Z.jsx)(Pt,{action:e.kind===`pr`?void 0:c,children:(0,Z.jsx)(kt,{item:e,kindWord:f,commentCount:v,hasDiffStat:_,additions:h,deletions:g})}),e.kind===`pr`?null:(0,Z.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-semibold tracking-tight`,children:e.title}),s,(0,Z.jsx)(At,{item:e,subNav:a,changes:d}),(0,Z.jsx)(jt,{item:e,colors:t,checks:n}),d&&e.kind===`pr`?(0,Z.jsx)(Ft,{item:e}):(0,Z.jsx)(Mt,{item:e,colors:t,body:m})]}),e.kind===`pr`?(0,Z.jsx)(vt,{number:e.number,onRunAgent:o}):null,l]})}function Pt({action:e,className:t,children:n}){return e?(0,Z.jsxs)(`div`,{"data-slot":`gh-header-row`,className:i(`flex flex-wrap items-center gap-x-3 gap-y-2`,t),children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:n}),(0,Z.jsx)(`div`,{"data-slot":`gh-header-action`,className:`flex shrink-0 items-center gap-2`,children:e})]}):t?(0,Z.jsx)(`div`,{className:t,children:n}):(0,Z.jsx)(Z.Fragment,{children:n})}function Ft({item:e}){let t=C(),n=d(e.number),[a,o]=(0,X.useState)(``),[s,l]=(0,X.useState)(null),u=n.data,f=e=>u?.available?u.files.filter(t=>t.path.toLowerCase().includes(e.toLowerCase())):[],p=f(a),m=p.some(e=>e.path===s)?s:p[0]?.path??null,h=p.findIndex(e=>e.path===m),g=e=>{o(e);let t=f(e),n=m??s,r=t.some(e=>e.path===n)?n:t[0]?.path??n;r!==s&&l(r)},_=async()=>{let n=u?.available?u.headSha:null,r=c.githubPrChanges(e.number),i=await y(e.number,{refresh:!0});t.setQueryData(r,i),i.available&&n&&n!==i.headSha&&(l(i.files[0]?.path??null),T(`The reviewed revision changed.`))};if(n.isPending)return(0,Z.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!u)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!u.available)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:u.reason});let v=p.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),b=r(e.url)?`${e.url}/files`:null,x=p.find(e=>e.path===m);return(0,Z.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Z.jsxs)(`strong`,{children:[u.files.length,` changed files`]}),(0,Z.jsx)(Y,{adds:u.additions,dels:u.deletions}),(0,Z.jsx)(Re,{sha:u.headSha,variant:`inline`,prefix:`head `,className:`text-muted-foreground`}),(0,Z.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void _(),children:`Refresh`})]}),u.truncated?(0,Z.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-pending-strong/40 bg-pending/10 p-3 text-xs`,children:[u.reason??`This response is incomplete.`,` `,b?(0,Z.jsx)(`a`,{href:b,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Z.jsx)(`input`,{"aria-label":`Filter changed files`,value:a,onChange:e=>g(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,Z.jsxs)(`div`,{className:`relative mt-2 lg:hidden`,children:[(0,Z.jsx)(`select`,{"aria-label":`Select changed file`,value:m??``,onChange:e=>l(e.target.value),className:`min-h-11 w-full appearance-none rounded-md border border-input bg-background py-2 pr-8 pl-3 text-sm`,children:p.map(e=>(0,Z.jsx)(`option`,{children:e.path},e.path))}),(0,Z.jsx)(re,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground`})]}),(0,Z.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>l(e.path),className:i(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,m===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Z.jsx)(Y,{adds:e.additions,dels:e.deletions})]})},e.path))})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Z.jsx)(B,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:h<=0,onClick:()=>l(p[h-1]?.path??null),children:(0,Z.jsx)(Ge,{})}),(0,Z.jsx)(B,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:h<0||h>=p.length-1,onClick:()=>l(p[h+1]?.path??null),children:(0,Z.jsx)(te,{size:16})})]}),p.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(et,{files:v.filter(e=>e.path===m),wrap:!0,className:`min-w-0`}),x&&!x.patch?(0,Z.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,x.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function It({item:e,colors:t}){let n=u(e.kind,e.number),r=n.data,i=(0,X.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(Lt(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsx)(q,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(q,{className:`h-14 w-full`}),(0,Z.jsx)(q,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-xs font-semibold tracking-wide text-muted-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Rt(i).map(e=>e.group===`commits`?(0,Z.jsx)(zt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(Xt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Vt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-muted-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Lt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Rt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function zt({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Bt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(Vt,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Bt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(G,{iso:e[e.length-1].createdAt,className:`shrink-0`})]})})}var Bt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Vt({event:e,colors:t}){return(0,Z.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:i(`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Bt[e.kind]}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Z.jsx)(qt,{event:e,colors:t}),(0,Z.jsx)(G,{iso:e.createdAt,className:`shrink-0`}),e.url?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Ht({event:e}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Z.jsx)(Re,{sha:e.sha,variant:`inline`,className:`shrink-0 text-xs text-muted-foreground`}):null,e.message?(0,Z.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Z.jsx)(Jt,{checks:e.checks})]})}function Ut({event:e,colors:t}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Z.jsx)(`span`,{"data-slot":`gh-event-label`,style:St(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,Z.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Wt({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Gt({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Kt={committed:e=>(0,Z.jsx)(Ht,{event:e}),labeled:(e,t)=>(0,Z.jsx)(Ut,{event:e,colors:t}),unlabeled:(e,t)=>(0,Z.jsx)(Ut,{event:e,colors:t}),assigned:e=>(0,Z.jsx)(Wt,{event:e}),unassigned:e=>(0,Z.jsx)(Wt,{event:e}),merged:()=>(0,Z.jsx)(`span`,{children:`merged this`}),closed:()=>(0,Z.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,Z.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,Z.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,Z.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,Z.jsx)(Gt,{event:e})};function qt({event:e,colors:t}){return Kt[e.kind]?.(e,t)??null}function Jt({checks:e}){return e?(0,Z.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:i(`shrink-0`,$t[e]),children:Qt[e]}):null}var Yt={approved:{label:`Approved`,tone:`border-success/40 text-semantic-green`},changes_requested:{label:`Changes requested`,tone:`border-danger/40 text-semantic-red`},commented:{label:`Commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`Dismissed`,tone:`border-border text-muted-foreground`}};function Xt({comment:e}){let t=e.reviewState?Yt[e.reviewState]:null;return(0,Z.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Zt,{url:e.avatarUrl,login:e.author}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Z.jsx)(G,{iso:e.createdAt}),t?(0,Z.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,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Z.jsx)(`div`,{"data-slot":`gh-thread-body`,className:Dt,children:e.body?(0,Z.jsx)(Qe,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no body)`})})]})}function Zt({url:e,login:t}){let[n,r]=(0,X.useState)(!1);return e&&!n?(0,Z.jsx)(`img`,{src:e,alt:``,width:20,height:20,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-5 shrink-0 rounded-full`}):(0,Z.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Qt={passing:`✓`,failing:`✗`,pending:`○`},$t={passing:`text-semantic-green`,failing:`text-semantic-red`,pending:`text-semantic-amber`},en={passing:`Checks passing`,failing:`Checks failing`,pending:`Checks pending`};function tn({count:e}){return e?(0,Z.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,Z.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function nn({checks:e,url:t}){let n=i(`text-xs font-medium`,$t[e],t&&`hover:underline`),r=`${Qt[e]} ${en[e]}`;return t?(0,Z.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Z.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function rn({checks:e}){return(0,Z.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:en[e],"aria-label":en[e],className:i(`shrink-0 font-sans text-xs font-semibold`,$t[e]),children:Qt[e]})}function an(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function on(e,t=[]){let n=an(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=sn(t)),n}function sn(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function cn(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function ln(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function un(e,t,n){let r=(n??``).trim();if(!r)return on(e,t);let i=an(e),a=r.startsWith(i)?i+cn(r.slice(i.length),e):cn(r,e),o=ln(a,e)?a:`${i}\n\n${a}`;return t.length?o+sn(t):o}function dn(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function fn(e,t,n,r,i={}){return t?{...i,workflow:t,task:un(e,n.map(e=>e.id),r)}:n.length?{...i,steps:dn(n.map(e=>e.id)).map((e,t)=>({...e,...n[t]?.path===void 0?{}:{skillPath:n[t].path}})),task:un(e,[],r)}:{...i,workflow:`quick-task`,task:un(e,[],r)}}function pn(e){let t=o(),n=l(),r=h(),{runners:i,uninstalled:a,signedOut:s,accounts:c,repoAccount:u,accountFor:d}=Ze(),f=n.data?.defaultRunner,p=Me(e.runner,i,f??i[0]??`claude`),m=n.data?.modelsLocked===!0,_=d(p,e.account),v=g(p,!0,_??u?.[p]),y=ke(m?null:e.model,p,r.data,n.data?.defaultModels,v.data),b=Ie(y,v.data);return{runner:p,runnerExplicit:e.runner!==null,model:y,effort:m?``:ze(e.effort,b),effortOptions:b,runners:i,uninstalled:a,signedOut:s,defaultRunner:f,canRun:t.isSuccess&&i.length>0,modelsLocked:m,providerPending:t.isPending,providerError:t.isError,accounts:c,account:_,repoAccount:u}}function mn(e){return{runner: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 hn(e){return{...mn(e),...e.account?{agentProfile:e.account}:{}}}function gn(e,t){let{runners:n,uninstalled:r,signedOut:i}=e;return n.length>1||r.length>0||i.length>0||n.some(e=>Ke(t,e))}function _n({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,X.useRef)(null),o=(0,X.useRef)(null),[s,c]=(0,X.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,X.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,X.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let u=pn(e),{runner:d,model:f,effort:p,effortOptions:m,runners:_,canRun:v,modelsLocked:y}=u,b=l(),x=h(),S=g(d,!0,u.account??u.repoAccount?.[d]),C=Le(d,x.data,S.data,[e.model,b.data?.defaultModels?.[d]]),w=n||!v,T=r?u.accounts:[],E=gn(u,T)?(0,Z.jsx)(Pe,{icon:(0,Z.jsx)(M,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:_,uninstalled:u.uninstalled,signedOut:u.signedOut,value:d,accounts:T,account:r?u.account:null,repoAccount:r?u.repoAccount:void 0,disabled:w,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===d?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,D=(0,Z.jsx)(K,{icon:(0,Z.jsx)(ne,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:f===``?`Default`:C.find(e=>e.id===f).label,value:f,disabled:w,readOnly:y===!0,disabledHint:y?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Ie(n,S.data);t({...e,model:n,effort:e.effort===null?null:ze(e.effort,r)})},options:C.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Je(d,x.data,S)},`model`),O=(0,Z.jsx)(K,{icon:(0,Z.jsx)(N,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:m.find(e=>e.value===p)?.label??`auto`,value:p,disabled:w,readOnly:y===!0,disabledHint:y?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:m.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,Z.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,Z.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,Z.jsx)(Ae,{fill:`model-pill`,children:s?[E,O,D]:[E,D,O]})})}):(0,Z.jsxs)(Ae,{children:[E,D,O]})}var vn={workflow:null,skills:[]},yn=`cez-followup-selection`;function bn(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 xn(){try{let e=localStorage.getItem(yn);return e?bn(JSON.parse(e)):{...vn}}catch{return{...vn}}}function Sn(e){try{localStorage.setItem(yn,JSON.stringify(e))}catch{}}var Cn=`cez-followup-prompt:`;function wn(e){try{return localStorage.getItem(Cn+e)??``}catch{return``}}function Tn(e,t){try{t===``?localStorage.removeItem(Cn+e):localStorage.setItem(Cn+e,t)}catch{}}function En({item:e,workflows:t,skills:n,workflow:i,onWorkflowChange:a,selectedSkills:o,onSkillsChange:l,engine:u,onEngineChange:d,queuedRunId:p,onQueued:h}){let g=C(),_=m(),y=e.kind===`pr`?`PR`:`issue`,b=pn(u),x=s(b.runner,b.account),S=o.filter(e=>x.unchecked||e.path===void 0||n.some(t=>t.id===e.id&&(e.path===void 0||t.path===e.path))),w=S.length!==o.length,[D]=(0,X.useState)(()=>an(e)),[k,A]=(0,X.useState)(()=>wn(e.url)||D),j=(0,X.useRef)(null),M=(0,X.useRef)(null);(0,X.useEffect)(()=>{Tn(e.url,k===D?``:k)},[e.url,k,D]);let N=(0,X.useMemo)(()=>Ye(_.data?.promptTemplates),[_.data?.promptTemplates]),ee=e=>{let t=j.current,n=qe({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)})},P=Oe(N,S.map(e=>e.id)),F=(0,X.useRef)(k);F.current=k;let I=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=Xe(F.current,I.current,P,D);I.current=e.applied,e.text!==F.current&&A(e.text)},[P,D]);let L=f({mutationFn:async()=>!b.canRun||w?null:E(fn(e,i,S,k,hn(b))),onSuccess:t=>{if(t===null)return;let n=t;n&&h(e.url,n.id),T(`Added to the queue — ${y} #${e.number}`),S.length>0&&_.data!==void 0&&v({skillUsage:S.reduce((e,t)=>Ee(e,t.id),_.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:c.uiState})).catch(()=>{}),Tn(e.url,``),A(D),I.current=``,g.invalidateQueries({queryKey:c.runs.all})},onError:e=>T(e.message,{tone:`danger`})}),te=e=>{He({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!L.isPending&&b.canRun&&L.mutate())},R=e=>l(o.some(t=>W(t)===W(e))?o.filter(t=>W(t)!==W(e)):[...o,Te(e)]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Z.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Z.jsx)(`span`,{children:`Instructions for the agent`}),(0,Z.jsx)($e,{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:te,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Z.jsx)(Ve,{templates:N,onInsert:ee}),(0,Z.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Workflow`}),(0,Z.jsx)(On,{workflows:t,value:i,onChange:a})]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Skills · select one or more`}),(0,Z.jsx)(An,{skills:n,skillUsage:_.data?.skillUsage,selected:o,onToggle:R})]}),o.length>0?(0,Z.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:o.map(e=>(0,Z.jsx)(Dn,{skill:e,skills:n,unchecked:x.unchecked,onRemove:()=>R(e)},W(e)))}):null,w?(0,Z.jsx)(`p`,{role:`alert`,children:`A selected skill path is unavailable. Remove it or choose a current copy before starting.`}):null,(0,Z.jsx)(_n,{layout:`row`,pick:u,onChange:d,disabled:L.isPending||!b.canRun,accounts:!0}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Account`}),(0,Z.jsx)(kn,{resolved:b,disabled:L.isPending||!b.canRun,onPick:e=>d({...u,account:e})})]}),!b.providerPending&&!b.canRun?(0,Z.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[b.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Z.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Z.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[r(e.url)?(0,Z.jsx)(B,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Z.jsxs)(B,{variant:`primary`,"data-action":`gh-run`,disabled:L.isPending||!b.canRun||w,onClick:()=>L.mutate(),children:[(0,Z.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,y]}),(0,Z.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-xs font-medium text-muted-foreground`,children:Ue()}),p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Z.jsx)(V,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function Dn({skill:e,skills:t,unchecked:n,onRemove:r}){let i=t.find(t=>t.id===e.id&&(e.path===void 0||t.path===e.path)),a=[i?.name??e.id,e.path].filter(Boolean).join(` · `),o=!n&&e.path!==void 0&&!i?` (unavailable)`:n||!i?` (unchecked)`:``;return(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e.id,onClick:r,title:`Remove skill ${a}`,"aria-label":`Remove skill ${a}`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[a,o,(0,Z.jsx)(A,{size:16,"aria-hidden":`true`,className:`size-3`})]})}function On({workflows:e,value:t,onChange:n}){let[r,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),c=(0,X.useRef)(null),l=xe(e,o);return(0,Z.jsxs)(ue,{open:r,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:i(Ne,t&&`border-foreground/60 font-mono text-xs font-semibold text-foreground`),children:[(0,Z.jsx)(R,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Z.jsx)(ee,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(le,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(be,{shouldFilter:!1,children:[(0,Z.jsx)(_e,{placeholder:`Search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Z.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,Z.jsx)(ve,{children:`Nothing matches.`}):null,(0,Z.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,Z.jsxs)(U,{value:`workflow ${e.name}`,keywords:we(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function kn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:b,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,...e.configDir?{desc:e.configDir}:{}}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Z.jsx)(K,{icon:(0,Z.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 An({skills:e,skillUsage:t,selected:n,onToggle:r}){let[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(null),d=(0,X.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=De(e,s,t),g=(e,t)=>{let a=n.some(t=>W(t)===W(e));return(0,Z.jsxs)(U,{value:W(e),keywords:we(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.id,"data-selected":a?`true`:void 0,onSelect:()=>r(Te(e)),children:[(0,Z.jsx)(`span`,{className:i(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.path?(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Z.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Z.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},W(e))};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(je,{skill:l,onClose:()=>u(null)}),(0,Z.jsxs)(ue,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.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,Z.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Z.jsx)(ee,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(le,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(be,{shouldFilter:!1,children:[(0,Z.jsx)(_e,{placeholder:`Search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,Z.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,Z.jsx)(H,{children:(0,Z.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,Z.jsx)(ve,{children:`Nothing matches.`}):null,h?h.length>0?(0,Z.jsx)(H,{children:h.map(e=>g(e,Se(e)))}):null:(0,Z.jsxs)(Z.Fragment,{children:[f.length>0?(0,Z.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,Se(e)))}):null,p.length>0?(0,Z.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,Z.jsx)(H,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var jn=new WeakMap;function Mn(){let e=xn(),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)&&Sn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function Nn(){let e=C(),{projectId:t}=S(),n=jn.get(e);n||jn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=Mn());let{snapshot:i,subscribe:o,update:c}=r,l=(0,X.useSyncExternalStore)(o,i,i),u=a(),d=pn(l.engine),f=s(d.runner,d.account),p=m(),h=u.data?.workflows;(0,X.useEffect)(()=>{h&&l.workflow!==null&&!h.some(e=>e.name===l.workflow)&&c({workflow:null})},[c,h,l.workflow]);let g=(0,X.useMemo)(()=>Ce(f.data??[],p.data?.skillUsage),[f.data,p.data?.skillUsage]);return{...l,workflows:u,skillList:g,skillsUnchecked:f.unchecked,setWorkflow:e=>c({workflow:e}),setSelectedSkills:e=>c({selectedSkills:e}),setEngine:e=>c({engine:e}),onQueued:(e,t)=>c({queued:new Map(i().queued).set(e,t)})}}export{tn as a,Rt as c,St as d,xt as f,rn as i,yt as l,En as n,Nt as o,on as r,Ct as s,Nn as t,bt 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,Jt as a,Wt as o,dn as s,k as c}from"./queries-D0v1z40Y.js";import{A as l,Fn as u,hi as d,k as f,n as p,p as ee,u as te}from"./toaster-DMfiAEnw.js";import{h as m}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{J as ne,L as h,S as g,X as re,at as _,b as ie,c as ae,ft as v,i as oe,l as se,lt as ce,n as le,ot as ue,st as de,tt as y,v as b}from"./design-icons-CzEoMH9c.js";import{t as x}from"./button-B7MKxYjT.js";import{i as S,o as fe,r as C,s as w,t as T}from"./dialog-B531GGAo.js";import{i as pe,l as me,o as he}from"./skills-pM_PouEs.js";import{d as ge,l as _e,s as ve}from"./page-shell-7pLJMOgh.js";import{t as ye}from"./centered-state-V15AR_qo.js";import{Gt as E,Ht as be,Jt as D,Kt as O,Ut as k,Wt as A,Yt as j,Zn as M,qt as N,w as xe}from"./index-
|
|
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,Jt as a,Wt as o,dn as s,k as c}from"./queries-D0v1z40Y.js";import{A as l,Fn as u,hi as d,k as f,n as p,p as ee,u as te}from"./toaster-DMfiAEnw.js";import{h as m}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{J as ne,L as h,S as g,X as re,at as _,b as ie,c as ae,ft as v,i as oe,l as se,lt as ce,n as le,ot as ue,st as de,tt as y,v as b}from"./design-icons-CzEoMH9c.js";import{t as x}from"./button-B7MKxYjT.js";import{i as S,o as fe,r as C,s as w,t as T}from"./dialog-B531GGAo.js";import{i as pe,l as me,o as he}from"./skills-pM_PouEs.js";import{d as ge,l as _e,s as ve}from"./page-shell-7pLJMOgh.js";import{t as ye}from"./centered-state-V15AR_qo.js";import{Gt as E,Ht as be,Jt as D,Kt as O,Ut as k,Wt as A,Yt as j,Zn as M,qt as N,w as xe}from"./index-01bdo9g3.js";import{_ as P,a as Se,c as Ce,f as we,g as Te,h as Ee,i as F,m as I,n as De,o as Oe,p as L,r as R,t as z,u as ke}from"./sortable.esm-CAVTYaA3.js";import{t as B}from"./textarea-vJt9undk.js";var V=e(t(),1);function H(e){let t=[];for(let n of e){if(n.kind===`plugin`||n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.timeoutMs!==void 0||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Ae(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 je(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function Me(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 Ne(e,t){return e.filter((e,n)=>n!==t)}function U(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function W(e,t,n){let r=` `.repeat(n);return t.includes(`
|
|
2
2
|
`)?[`${r}${e}: |`,...t.split(`
|
|
3
3
|
`).map(e=>`${r} ${e}`)]:[`${r}${e}: ${U(t)}`]}function G(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${U(e.name)}`),e.skill&&t.push(` skill: ${U(e.skill)}`),t}function Pe(e){let t=[];return e.model&&t.push(` model: ${U(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${U(e.effort)}`),e.runner&&t.push(` runner: ${U(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${U(e.agentProfile)}`),t}function Fe(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(U).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(U).join(`, `)}]`),t}function K(e){return e.onFail?[` onFail:`,` retry: ${U(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function q(e){return[` - id: ${U(e.id)}`,...G(e),...e.prompt?W(`prompt`,e.prompt,4):[],...e.kind===`plugin`?[` kind: plugin`,` pluginKind: ${U(e.pluginKind)}`,...e.config===void 0?[]:[` config: ${JSON.stringify(e.config)}`]]:[],...Pe(e),...Fe(e),...e.command?W(`command`,e.command,4):[],...K(e)]}function Ie(e,t,n){let r=[`name: ${U(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...W(`description`,t.trim(),0));let i=H(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${U(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...q(e))}else r.push(`skills: []`);return`${r.join(`
|
|
4
4
|
`)}\n`}function Le(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function Re(e){let t=H(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function ze(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 Be(e,t,n){let r=H(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var J=n();function Ve({workflows:e,draft:t,trimmedName:n,nameRef:r,onDraft:i,onLoadWorkflow:a}){return(0,J.jsxs)(`section`,{"data-slot":`wb-metadata`,className:`grid min-w-0 grid-cols-1 gap-3 @xl:grid-cols-2 @4xl:grid-cols-[minmax(180px,240px)_minmax(200px,280px)_minmax(0,1fr)] @xl:items-start`,children:[(0,J.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex min-w-0 flex-col gap-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs font-medium text-foreground`,children:`Load an existing workflow`}),(0,J.jsxs)(`div`,{className:`relative flex min-w-0 items-center`,children:[(0,J.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-10 w-full min-w-0 appearance-none rounded-lg border border-border bg-card pr-9 pl-3.5 text-xs font-medium text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:h-11`,children:[(0,J.jsx)(`option`,{value:``,disabled:!0,children:`Choose a workflow`}),e.map(e=>(0,J.jsx)(`option`,{value:e.name,"data-slot":`wb-load-option`,"data-name":e.name,children:e.name},e.name))]}),(0,J.jsx)(se,{"aria-hidden":`true`,className:`pointer-events-none absolute right-3 size-4 text-muted-foreground`})]})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-medium text-foreground`,children:`Workflow name`}),(0,J.jsx)(M,{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-10 bg-card text-sm max-md:h-11`})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 @xl:col-span-2 @4xl:col-span-1`,children:[(0,J.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-medium text-foreground`,children:`Description`}),(0,J.jsx)(B,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,rows:1,value:t.description,onChange:e=>i({...t,description:e.target.value}),className:`min-h-10 bg-card px-3 py-2 text-sm max-md:min-h-11`})]})]})}function He({savedFile:e,autoOpen:t,onImportToggle:n,onExport:r,onAutoToggle:i,onDeleteRequest:a}){return(0,J.jsxs)(`div`,{"data-slot":`wb-actions`,className:`grid grid-cols-[max-content_max-content] items-center justify-start gap-2 sm:flex sm:flex-wrap [&_button]:min-h-11 [&_button]:border [&_button]:border-border [&_button]:bg-card`,children:[(0,J.jsxs)(x,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:n,children:[(0,J.jsx)(de,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,J.jsxs)(x,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:r,children:[(0,J.jsx)(ie,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,J.jsxs)(x,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":t,"aria-describedby":`wb-auto-hint`,title:`Auto-build: describe the chain in words and an agent drafts its steps for you to review`,onClick:i,children:[(0,J.jsx)(ce,{"aria-hidden":`true`,className:`size-3`}),`Auto-build`]}),(0,J.jsx)(`span`,{id:`wb-auto-hint`,className:`sr-only`,children:`Describe the chain in words and an agent drafts its steps for you to review.`}),e?(0,J.jsxs)(x,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-delete`,className:`relative text-danger hover:text-danger sm:ms-3 sm:before:absolute sm:before:-start-[13px] sm:before:top-1/2 sm:before:h-5 sm:before:w-px sm:before:-translate-y-1/2 sm:before:bg-border sm:before:content-['']`,title:`Delete the saved workflow file`,onClick:a,children:[(0,J.jsx)(_,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function Ue({text:e,onTextChange:t,pending:n,onRun:r,onCancel:i}){return(0,J.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,J.jsx)(`p`,{className:`mt-4 text-[13px] leading-relaxed text-muted-foreground`,children:`Describe the outcome. An agent proposes a title and ordered skill/check steps. Review the result, edit it, then Save.`}),(0,J.jsx)(B,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),r())},className:`mt-4 min-h-[108px] bg-background p-4 text-sm`}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,J.jsxs)(x,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:n||e.trim()===``,onClick:r,children:[(0,J.jsx)(ce,{"aria-hidden":`true`,className:`size-3`}),n?`Building…`:`Build chain`]}),(0,J.jsxs)(x,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:i,children:[(0,J.jsx)(v,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,J.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function We({open:e,onOpenChange:t,text:n,onTextChange:r,error:i,pending:a,onRun:o,onCancel:s}){return(0,J.jsx)(T,{open:e,onOpenChange:t,children:(0,J.jsxs)(C,{showCloseButton:!1,"data-slot":`wb-import-panel`,className:`max-md:translate-x-0 max-md:translate-y-0 sm:max-w-[660px] rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,J.jsx)(w,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,J.jsx)(S,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,J.jsx)(B,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
|
|
@@ -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{Qt as r,St as i,Vt as a,rn as o,yt as s}from"./queries-D0v1z40Y.js";import{n as c}from"./toaster-DMfiAEnw.js";import{n as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import"./tasks-table-BY5niMlY.js";import{t as u}from"./chevron-right-BENZ-1ZN.js";import{t as d}from"./button-B7MKxYjT.js";import{t as f}from"./status-dot-BRzVlF2X.js";import{r as p,t as m}from"./agents-settings-path-7X6_cvUg.js";import{a as h,d as g}from"./page-shell-7pLJMOgh.js";import{Jn as _,Qn as v,Xn as y,Xt as b,kn as x}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Qt as r,St as i,Vt as a,rn as o,yt as s}from"./queries-D0v1z40Y.js";import{n as c}from"./toaster-DMfiAEnw.js";import{n as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import"./tasks-table-BY5niMlY.js";import{t as u}from"./chevron-right-BENZ-1ZN.js";import{t as d}from"./button-B7MKxYjT.js";import{t as f}from"./status-dot-BRzVlF2X.js";import{r as p,t as m}from"./agents-settings-path-7X6_cvUg.js";import{a as h,d as g}from"./page-shell-7pLJMOgh.js";import{Jn as _,Qn as v,Xn as y,Xt as b,kn as x}from"./index-01bdo9g3.js";var S=e(t(),1),C=n();function w(e){let t=e.replace(/\binstall\b/g,(e,t)=>t===0?`Install`:e),n=t.split(/(`[^`]+`)/g);if(n.length===1){let e=t.split(/(\bgh auth login\b)/g);return e.length===1?t:e.map((e,t)=>e===`gh auth login`?(0,C.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:e},t):(0,C.jsx)(`span`,{children:e},t))}return n.map((e,t)=>e.startsWith("`")&&e.endsWith("`")&&e.length>2?(0,C.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:e.slice(1,-1)},t):e?(0,C.jsx)(`span`,{children:e},t):null)}function T(e,t){let n=r(t,e);return n?{label:n.displayName,isAgent:!0}:{label:e,isAgent:!1}}function E({mode:e,version:t,rawVersion:n}){return e?(0,C.jsx)(`span`,{"data-slot":`tool-dry-run`,title:n,className:`shrink-0 rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:e.label}):t?(0,C.jsxs)(`span`,{className:`min-w-0 break-words`,children:[`· `,t]}):null}var D=`h-8 text-xs font-medium max-md:h-11 no-hover:h-11`;function O({health:e,projects:t,repository:n,onAction:r}){let i=!!(e.data?.repoRoot||n||t.data?.projectsDir);return(0,C.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-card-edge bg-card p-6 shadow-card max-md:p-4`,"aria-labelledby":`add-project-heading`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{id:`add-project-heading`,className:`text-base font-semibold text-foreground`,children:`Add project`}),(0,C.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.5] text-muted-foreground`,children:`Start a new repository, open an existing local folder, or clone a GitHub repository.`})]}),i?(0,C.jsxs)(`div`,{className:`border-y border-border py-3.5`,children:[(0,C.jsx)(`h3`,{className:`mb-2.5 text-xs font-semibold tracking-wide text-muted-foreground uppercase`,children:`Active project`}),(0,C.jsxs)(`dl`,{className:`space-y-2 text-[13px] leading-[1.5] text-muted-foreground`,children:[e.data?.repoRoot?(0,C.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,C.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Local folder`}),(0,C.jsx)(`dd`,{className:`min-w-0 font-mono text-xs break-all`,children:e.data.repo?.root??e.data.repoRoot})]}):null,n?(0,C.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,C.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Repository`}),(0,C.jsx)(`dd`,{className:`min-w-0 font-mono text-xs break-all`,children:n.replace(/^https:\/\//,``)})]}):null,t.data?.projectsDir?(0,C.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,C.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Checkout folder`}),(0,C.jsx)(`dd`,{className:`min-w-0 font-mono text-xs break-all`,children:t.data.projectsDir})]}):null]})]}):null,(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,C.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,"data-action":`new-project`,onClick:()=>r(`new`),children:`New project`}),(0,C.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,onClick:()=>r(`local`),children:`Open local folder`}),(0,C.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,onClick:()=>r(`clone`),children:`Clone from GitHub`})]})]})}function k({health:e,runners:t,copying:n,onCopy:r}){return(0,C.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-card-edge bg-card p-6 shadow-card max-md:p-4`,"aria-labelledby":`tools-heading`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{id:`tools-heading`,className:`text-base font-semibold text-foreground`,children:`Tools diagnostics`}),(0,C.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.5] text-muted-foreground`,children:`Check the tools available to this local workspace.`})]}),(0,C.jsx)(d,{asChild:!0,variant:`outline`,size:`sm`,className:D,children:(0,C.jsxs)(l,{to:m,"data-slot":`tools-settings`,children:[`Tool settings`,(0,C.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})})]}),e.isError?(0,C.jsx)(`p`,{role:`alert`,className:`text-sm text-semantic-red`,children:`Could not refresh tool diagnostics. Recheck to retry.`}):null,!e.data&&!e.isError?(0,C.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Checking installed tools…`}):null,e.data?(0,C.jsx)(`dl`,{className:`divide-y divide-border border-y border-border text-[13px] leading-[1.5] text-muted-foreground`,children:e.data.checks.map(e=>{let n=b(e),r=T(e.name,t),i=x(e);return(0,C.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":e.available,className:`grid grid-cols-1 gap-x-4 gap-y-1 py-3 sm:grid-cols-[160px_minmax(0,1fr)] sm:items-center`,children:[(0,C.jsxs)(`dt`,{className:`flex items-center gap-2.5`,children:[(0,C.jsx)(f,{tone:i.availability.tone,shape:i.availability.shape}),(0,C.jsx)(`span`,{className:r.isAgent?`text-[14px] font-semibold text-foreground`:`font-mono text-[13px] font-semibold text-foreground`,children:r.label})]}),(0,C.jsxs)(`dd`,{className:`flex min-w-0 items-center gap-x-1.5 text-muted-foreground`,children:[(0,C.jsx)(`span`,{className:`shrink-0`,children:i.availability.label}),(0,C.jsx)(E,{mode:i.mode,version:i.version,rawVersion:i.rawVersion}),e.available?null:(0,C.jsx)(d,{asChild:!0,variant:`outline`,size:`sm`,className:`${D} ml-auto`,children:(0,C.jsxs)(l,{to:p(e.name),"data-slot":`tool-setup`,children:[`Set up`,(0,C.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})})]}),n?(0,C.jsx)(`dd`,{"data-slot":`tool-hint`,className:`min-w-0 break-words text-xs leading-relaxed text-muted-foreground sm:col-start-2`,children:w(n)}):null]},e.name)})}):null,e.data?.checks.length===0?(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tool diagnostics reported by this server.`}):null,(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,C.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:e.isFetching?`Checking tools…`:`Recheck tools`}),(0,C.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,disabled:!e.data||n,onClick:()=>void r(),children:n?`Copying…`:`Copy diagnostics`})]})]})}function A(){let e=s(),t=i(),n=o().data,r=a(e.data?.repo?.remote),[l,u]=(0,S.useState)(null),[d,f]=(0,S.useState)(!1),p=async()=>{if(!(!e.data||d)){f(!0);try{await navigator.clipboard.writeText(JSON.stringify({version:e.data.version,checks:e.data.checks},null,2)),c(`Diagnostics copied`)}catch{c(`Could not copy diagnostics. Please try again.`,{tone:`danger`})}finally{f(!1)}}},m=e.data?.checks.length??4;return(0,C.jsxs)(h,{route:`workspace-tools`,density:e.data?g(m):`full`,bodyClassName:`gap-5`,header:{title:`Workspace tools`,subtitle:`Add projects and inspect local workspace CLI diagnostics.`},children:[(0,C.jsx)(O,{health:e,projects:t,repository:r,onAction:u}),(0,C.jsx)(k,{health:e,runners:n,copying:d,onCopy:p}),l===`new`?(0,C.jsx)(_,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`local`?(0,C.jsx)(v,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`clone`?(0,C.jsx)(y,{open:!0,onOpenChange:e=>{e||u(null)}}):null]})}export{A as WorkspaceToolsRoute};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{Wt as t,_ as n,dn as r,yt as i}from"./queries-D0v1z40Y.js";import{Fn as a,Ir as o,Lr as s,P as c,hi as l,n as u}from"./toaster-DMfiAEnw.js";import{u as d}from"./design-icons-CzEoMH9c.js";import{t as f}from"./button-B7MKxYjT.js";import{t as p}from"./project-router-BifLGgRR.js";import{t as m}from"./centered-state-V15AR_qo.js";import{ar as h,pn as g}from"./index-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{Wt as t,_ as n,dn as r,yt as i}from"./queries-D0v1z40Y.js";import{Fn as a,Ir as o,Lr as s,P as c,hi as l,n as u}from"./toaster-DMfiAEnw.js";import{u as d}from"./design-icons-CzEoMH9c.js";import{t as f}from"./button-B7MKxYjT.js";import{t as p}from"./project-router-BifLGgRR.js";import{t as m}from"./centered-state-V15AR_qo.js";import{ar as h,pn as g}from"./index-01bdo9g3.js";import{n as _,r as v,t as y}from"./remote-settings-notice-B6hTxIYs.js";import{n as b}from"./saved-draft-BwzBc-_Y.js";import{t as x}from"./save-cue-Cd3ZAPBS.js";import{n as S}from"./settings-field-DP9sYv5a.js";import{n as C}from"./project-location-CspXXtNm.js";var w=e();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-xs text-muted-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:y}),`.`]}):null,i===null?null:(0,w.jsxs)(`p`,{"data-slot":`${s}-issue`,className:`text-xs text-danger`,children:[`config.json has an invalid `,e.key,` (`,i,`) — saving replaces it.`]}),a===null?null:(0,w.jsx)(`p`,{"data-slot":`${s}-invalid`,className:`text-xs 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 ${o.toLocaleString(`en-US`)} characters.`:t.trim()===``||!Number.isInteger(r)||r<1||r>7200?`Enter a whole number of seconds from 1 to ${s}.`:null}}var D={setup:{key:`worktreeSetup`,issueKey:`worktreeSetupIssue`,slot:`worktree-setup`,title:`Prepare new worktrees`,hint:`Runs in order in every new task and worker worktree before the agent starts. The first failure stops setup.`,empty:`No setup commands configured. No commands will run in new worktrees.`,label:`Worktree setup commands, one per line`,example:`npm ci`,fileEditApplies:`Valid file edits apply to new worktrees.`,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 order in a worker’s worktree when the worker is destroyed, before its processes stop. The first failure stops teardown; destroy goes on and records it on the worker.`,empty:`No teardown commands configured. Destroy runs no commands in worker worktrees.`,label:`Worktree teardown commands, one per line`,example:`docker compose down`,fileEditApplies:`Valid file edits apply to the next worker destroy.`,saved:`Worktree teardown saved`,cleared:`Worktree teardown cleared`,save:`Save teardown`}};function O(e,t){return t?`One command per line, for example: ${e.example}`:void 0}function k({config:e,copy:n}){let o=l(),d=i(),p=v(),m=C(),h=m===null?null:`${m.replace(/\/$/,``)}/.ai/cezar/config.json`,y=d.data?.capabilities?.settingsAdmin===!0,D=e[n.key],k=e[n.issueKey],A=D?.commands??[],j=D?.timeoutSeconds??900,[M,N]=b(A.join(`
|
|
3
3
|
`)),[P,F]=b(String(j)),{commands:I,timeoutSeconds:L,invalid:R}=E(M,P),z=I.length===A.length&&I.every((e,t)=>e===A[t])&&(I.length===0||L===j),B=k===null&&z;g(y&&!z);let V=r({mutationFn:e=>c(e),onSuccess:e=>{o.setQueryData(t.config,e),N(I.join(`
|
|
4
4
|
`)),u(I.length===0?n.cleared:n.saved)},onError:e=>{u(e.message,{tone:`danger`}),e instanceof a&&e.status===409&&p()}}),H=()=>V.mutate({[n.key]:I.length===0?null:{commands:I,...L===900?{}:{timeoutSeconds:L}}}),U=`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)(S,{title:n.title,hint:n.hint,children:[(0,w.jsx)(_,{risk:`These commands run on the machine running Squawk`}),(0,w.jsxs)(T,{copy:n,savedCommandCount:A.length,settingsAdmin:d.data?.capabilities?.settingsAdmin,configPath:h,issue:k,invalid:R,children:[(0,w.jsx)(`textarea`,{"data-slot":`${n.slot}-commands`,"data-reports-dirty":``,"aria-label":n.label,rows:4,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,value:M,placeholder:O(n,y),readOnly:!y,disabled:V.isPending,onChange:e=>N(e.target.value),className:`${U} field-sizing-content min-h-24 max-h-[min(24rem,60dvh)] w-full resize-none overflow-y-auto font-mono text-[13px] leading-relaxed`}),(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-muted-foreground`,children:[(0,w.jsx)(`span`,{children:`Timeout per command`}),(0,w.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:1,max:s,step:1,"data-slot":`${n.slot}-timeout`,"data-reports-dirty":``,value:P,readOnly:!y,disabled:V.isPending,onChange:e=>F(e.target.value),className:`${U} min-h-11 w-28 md:min-h-0`}),(0,w.jsx)(`span`,{children:`seconds`})]}),(0,w.jsx)(x,{show:y&&B&&!V.isPending,children:(0,w.jsx)(f,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 md:min-h-0`,"data-action":`${n.slot}-save`,disabled:!y||B||R!==null||V.isPending,onClick:H,children:n.save})})]})]})]})}var A=0,j=1e3;function M(){let e=n();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)(m,{icon:(0,w.jsx)(h,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,w.jsx)(N,{config:e.data})}function N({config:e}){let n=l(),i=r({mutationFn:e=>c(e),onSuccess:e=>n.setQueryData(t.config,e),onError:e=>u(e.message,{tone:`danger`})}),[a,o]=b(String(e.worktreeRetention)),s=Number(a),m=a.trim()===``||!Number.isInteger(s)||s<A||s>j,h=e.worktreeRetention===(m?-1:s);return g(!h),(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)(S,{title:`Keep N finished worktrees`,hint:`Older finished worktrees are removed to free disk; their branch stays, so the work is recoverable. 0 keeps all. Running and in-review tasks are never removed.`,children:[(0,w.jsxs)(`div`,{"data-reports-dirty":``,className:`flex items-center gap-2`,children:[(0,w.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:A,max:j,step:1,"aria-label":`Keep last N finished worktrees`,"data-slot":`resources-worktree-retention`,value:a,disabled:i.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-muted-foreground`,children:`worktrees`}),(0,w.jsx)(x,{show:h&&!m&&!i.isPending,children:(0,w.jsx)(f,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-retention`,disabled:h||m||i.isPending,onClick:()=>i.mutate({worktreeRetention:s},{onSuccess:()=>{n.invalidateQueries({queryKey:t.worktrees}),u(s===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${s} finished worktree${s===1?``:`s`}`)}}),children:`Save retention`})})]}),m?(0,w.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number from `,A,` to `,j,` (0 = unlimited).`]}):(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s===0?`Keeping every finished worktree.`:`Keeping the last ${s} finished worktree${s===1?``:`s`} on disk.`})]}),(0,w.jsx)(k,{config:e,copy:D.setup}),(0,w.jsx)(k,{config:e,copy:D.teardown}),(0,w.jsxs)(p,{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)(d,{"aria-hidden":`true`,className:`size-[14px]`})]})]})}export{M 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-01bdo9g3.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">
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
<link rel="modulepreload" crossorigin href="/assets/page-shell-7pLJMOgh.js">
|
|
120
120
|
<link rel="modulepreload" crossorigin href="/assets/centered-state-V15AR_qo.js">
|
|
121
121
|
<link rel="stylesheet" crossorigin href="/assets/page-shell-DQPYcKyL.css">
|
|
122
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
122
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Dnupmo-Y.css">
|
|
123
123
|
</head>
|
|
124
124
|
<body>
|
|
125
125
|
<div id="root"></div>
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{A as i,_ as a,nn as o,rn as s,sn as c,tn as l}from"./queries-D0v1z40Y.js";import{B as u,Fn as d,H as f,Ur as p,V as m,_ as h,ar as g,c as ee,d as _,g as v,ir as y,ni as b,nr as x,o as te,s as S,sr as ne,ti as re,v as ie,z as ae}from"./toaster-DMfiAEnw.js";import{B as C,G as oe,H as w,I as T,K as se,N as E,P as D,V as ce,W as O,j as k,z as A}from"./live-protocol-DMhTnCmf.js";import{h as le}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as ue,t as j}from"./label-D91E4F0a.js";import{I as de,J as fe,Y as pe,it as me,l as he,pt as ge,ut as _e,y as ve}from"./design-icons-CzEoMH9c.js";import{t as ye}from"./check-OP-CVgZG.js";import{t as M}from"./button-B7MKxYjT.js";import{n as be,r as xe,t as Se}from"./collapsible-BEV4FO-1.js";import{a as N,i as P,n as F,r as I,t as L}from"./select-Bh7vwx79.js";import{t as Ce}from"./switch-DKqVf8-p.js";import{c as we,s as Te,t as R}from"./project-router-BifLGgRR.js";import{a as Ee,c as De,d as Oe,n as ke,s as z,u as B}from"./page-shell-7pLJMOgh.js";import{t as Ae}from"./centered-state-V15AR_qo.js";import{D as je,G as Me,In as Ne,Ln as Pe,N as Fe,O as Ie,Sn as Le,W as Re,Zn as V,k as ze,mn as Be,q as Ve,r as He,t as Ue,ur as We,vn as Ge}from"./index-6yHpyOyH.js";import{t as Ke}from"./textarea-vJt9undk.js";import{_ as qe,a as Je,c as Ye,d as Xe,f as Ze,g as Qe,h as $e,i as et,l as tt,m as nt,n as rt,o as it,p as at,r as ot,s as st,t as H,u as ct,v as lt}from"./automation-format-DB34jUyF.js";var U=e(t(),1),W=k([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),ut=C({includeExisting:D().optional(),authors:E(O()).optional(),assignees:E(O()).optional(),requireCurrentLabels:D().optional(),allLabels:E(O()).optional(),anyLabels:E(O()).optional(),excludeLabels:E(O()).optional(),changedLabels:E(O()).optional(),lookbackDays:A(),maxRecords:A()}),dt=k([`github`,`schedule`]),ft=x.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:O(),variants:oe([T(1),T(2),T(3)]).optional(),systemPrompt:O().optional()}),pt=C({at:O(),outcome:k([`launched`,`cancelled`]),runId:O().optional(),receiptId:O().optional(),trigger:k([`schedule`,`late`,`manual`,`retry`]).optional()}),G=C({id:O(),revision:A(),name:O(),description:O().optional(),enabled:D(),kind:dt,events:E(W).optional(),intervalSeconds:A().optional(),filters:ut.optional(),schedule:Ye.optional(),task:ft,archived:pt.optional(),createdAt:O(),updatedAt:O()}),K=C({timestamp:O(),tieBreaker:O().optional()}),mt=C({since:O().datetime(),until:O().datetime(),source:A().int().min(0).max(2),page:A().int().min(1).max(10),item:A().int().min(0).max(100),event:A().int().min(0).max(1e3),cursor:K.optional()}),ht={lastError:O().max(1e3).optional(),lastErrorAt:O().datetime().optional()},gt=C({revision:A().optional(),baselineAt:O().optional(),armedAt:O().optional(),historyScan:mt.optional(),cursor:K.optional(),frozenHighWatermark:K.extend({tieBreaker:O()}).optional(),backlogAfter:K.extend({tieBreaker:O()}).optional(),nextCheckAt:O().optional(),lastSuccessAt:O().optional(),nextRunAt:O().optional(),lastRunAt:O().optional(),etags:w(O(),O()).optional(),backoffUntil:O().optional(),consecutiveFailures:A().optional(),...ht,onceOutcome:k([`failed`,`missed`]).optional()});function _t(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 vt=k([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),yt=C({seq:A(),ts:O(),automationId:O(),revision:A(),event:W.optional(),result:vt,reason:O().optional(),durationMs:A().optional(),receiptId:O().optional(),runId:O().optional(),githubNumber:A().optional(),githubTitle:O().optional(),githubUrl:O().optional(),rateLimit:C({bucket:k([`core`,`search`]),remaining:A().optional(),resetAt:O().optional()}).optional()}),bt=C({matches:A(),launched:A(),duplicates:A(),errors:A()}),xt=G.extend({state:gt.optional(),latestLog:yt.optional(),counts:bt,nextRunAt:O().optional(),onceStatus:at.optional()});C({available:D(),reason:O().optional(),timeZone:O(),scheduler:C({state:k([`scheduled`,`idle`]),nextDue:O().optional()}),automations:E(xt)}),C({automation:G}).extend({once:C({dueAt:O(),timeZone:O(),resolvedInstant:O(),note:O()}).optional()}),C({automation:G,state:gt.optional(),latestLog:yt.optional(),onceStatus:at.optional()}),C({id:O(),automationId:O(),mode:k([`preview`,`execute`]),status:k([`queued`,`running`,`complete`,`error`]),createdAt:O(),completedAt:O().optional(),matches:A().optional(),truncated:D().optional(),error:O().optional()}),C({checkId:O()}),C({records:E(yt)}),C({receiptId:O(),runId:O()}),C({runId:O()}),G.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:dt.optional(),task:ft.omit({variants:!0}).strict(),enable:D().optional()}).omit({enable:!0}).extend({enabled:D().optional(),expectedRevision:A()}),C({archived:k([`include`,`only`]).optional()}),C({mode:k([`preview`,`execute`])});var q=n();function J({text:e}){return(0,q.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:e})}var St={launched:`success`,manual:`success`,"catch-up":`success`,skipped:`neutral`,missed:`pending`,"no-match":`neutral`,preview:`neutral`,baseline:`neutral`,duplicate:`neutral`,failed:`danger`,error:`danger`,"rate-limited":`danger`},Ct={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 wt(e){let[t,n]=(0,U.useState)(),[r,i]=(0,U.useState)(``),a=(0,U.useCallback)(t=>h(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,U.useEffect)(()=>{a()},[a]),(0,U.useEffect)(()=>p(a),[a]),(0,U.useEffect)(()=>ue((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function Tt(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 Et({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&Tt(e,t),[o,s]=(0,U.useState)(),[c,l]=(0,U.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await ae(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,q.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,q.jsxs)(`li`,{className:`min-w-0 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,q.jsx)(He,{dot:St[e.result],children:Ct[e.result]}),(0,q.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:rt(e.ts,n,u)})]}),e.reason?(0,q.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,q.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,q.jsx)(R,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,q.jsx)(M,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,q.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var Y=`all`;function Dt({label:e,value:t,onChange:n,options:r}){return(0,q.jsxs)(L,{value:t,onValueChange:n,children:[(0,q.jsx)(P,{"aria-label":e,className:`w-full sm:w-52`,children:(0,q.jsx)(N,{})}),(0,q.jsx)(F,{children:r.map(e=>(0,q.jsx)(I,{value:e.value,children:e.label},e.value))})]})}function Ot({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=wt(e),[s,c]=(0,U.useState)(Y),[l,u]=(0,U.useState)(Y),d=(0,U.useMemo)(()=>(i??[]).filter(e=>(s===Y||e.result===s)&&(l===Y||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,q.jsx)(De,{route:`automations`,density:i?Oe(d.length):`full`,header:{title:`Execution log`,subtitle:t??`Automation activity`,secondaryActions:(0,q.jsx)(z,{variant:`outline`,asChild:!0,children:(0,q.jsx)(R,{to:`/automations`,children:`Back to automations`})})},children:a&&!i?(0,q.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,q.jsx)(J,{text:a}),(0,q.jsx)(M,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,q.jsx)(J,{text:`Nothing has run yet.`}):(0,q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(Dt,{label:`Result`,value:s,onChange:c,options:[{value:Y,label:`All results`},...vt.options.map(e=>({value:e,label:Ct[e]}))]}),f?(0,q.jsx)(Dt,{label:`Event`,value:l,onChange:u,options:[{value:Y,label:`All events`},...W.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,q.jsx)(J,{text:`No rows match these filters.`}):(0,q.jsx)(Et,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,q.jsx)(J,{text:`Loading execution log…`})})}function kt({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=wt(e),c=`Recent activity${r&&t?` · ${t}`:``}`;return!o&&a&&a.length===0?(0,q.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`flex flex-wrap items-center gap-x-2 border-t border-border pt-2.5 text-xs text-muted-foreground`,children:[(0,q.jsx)(`h3`,{className:`font-medium text-foreground`,children:c}),(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,q.jsx)(`p`,{children:`Nothing has run yet.`})]}):(0,q.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`min-w-0 border-t border-border pt-2.5`,children:[(0,q.jsx)(`h3`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:c}),o&&!a?(0,q.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,q.jsx)(J,{text:o}),(0,q.jsx)(M,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?(0,q.jsx)(Et,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading activity…`})]})}function At({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?ot(i):null,[o,s]=(0,U.useState)(!1),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(``),f=(0,U.useRef)(null),p=(0,U.useRef)(null),m=(0,U.useRef)(null);(0,U.useEffect)(()=>{let e=m.current===`keep`?p.current:m.current===`delete`?f.current:null;m.current=null,e?.focus()},[o]);let h=async()=>{l(!0);try{await _(e.id),n()}catch(e){d(e instanceof Error?e.message:String(e)),l(!1)}},g=[[`Workflow`,e.task.workflow],[`Runner`,e.task.runner],[`Model`,e.task.model],[`Effort`,e.task.effort]];return(0,q.jsx)(De,{route:`automations`,density:`sparse`,header:{title:e.name,subtitle:`Archived one-time schedule. It cannot change; delete it when you no longer need the record.`},children:(0,q.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,q.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,q.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,q.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,q.jsxs)(q.Fragment,{children:[` · `,(0,q.jsx)(R,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${H(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,q.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,q.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,q.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,q.jsxs)(`div`,{className:`grid gap-1`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,q.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),g.filter(([,e])=>e).map(([e,t])=>(0,q.jsxs)(`div`,{className:`grid gap-1`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,q.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,q.jsxs)(`section`,{className:`min-w-0`,children:[(0,q.jsx)(kt,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,q.jsx)(M,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,q.jsx)(R,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,q.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[o?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(M,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:c,onClick:()=>void h(),children:`Delete schedule`}),(0,q.jsx)(M,{ref:p,variant:`outline`,disabled:c,onClick:()=>{m.current=`delete`,s(!1)},children:`Keep`})]})]}):(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(M,{ref:f,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{m.current=`keep`,s(!0)},children:`Delete`}),(0,q.jsx)(M,{variant:`outline`,asChild:!0,children:(0,q.jsx)(R,{to:`/automations`,children:`Back to automations`})})]}),u?(0,q.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:u}):null]})]})})}var jt=k([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),X=E(O().trim().min(1).max(200)).max(100).optional(),Mt=C({includeExisting:D().optional(),requireCurrentLabels:D().optional(),authors:X,assignees:X,allLabels:X,anyLabels:X,excludeLabels:X,changedLabels:X,lookbackDays:A().int().min(1).max(90).default(7),maxRecords:A().int().min(1).max(100).default(25)}).passthrough(),Nt=C({prompt:O().min(1).max(1e5),workflow:O().trim().min(1).max(200).optional(),steps:E(y).min(1).max(100).optional(),runner:re.optional(),model:O().trim().min(1).max(200).optional(),effort:O().trim().min(1).max(32).optional(),variants:oe([T(1),T(2),T(3)]).optional(),worktree:D().optional(),autonomous:D().optional(),...g,...ne,systemPrompt:O().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),Pt=new Set(Object.keys(Nt.shape).filter(e=>e!==`variants`));function Ft(e){return Object.fromEntries(Object.entries(e).filter(([e])=>Pt.has(e)))}ce(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??{}}},C({id:O().min(1).max(100),revision:A().int().positive(),name:O().trim().min(1).max(200),description:O().max(2e3).optional(),enabled:D().default(!1),kind:dt.default(`github`),events:E(jt).min(1).max(4).optional(),intervalSeconds:A().int().min(60).max(86400).optional(),filters:Mt.optional(),schedule:Ye.passthrough().optional(),task:Nt,archived:C({at:O().datetime(),outcome:k([`launched`,`cancelled`]),runId:O().optional(),receiptId:O().optional(),trigger:k([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:O().datetime(),updatedAt:O().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:b.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:b.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:b.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:b.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:b.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),C({version:T(1).default(1),automations:E(se()).default([]),tombstones:w(O(),O().datetime()).optional()}).passthrough();var It=C({timestamp:O().datetime(),tieBreaker:O().optional()}).passthrough(),Lt=mt.extend({cursor:It.optional()}),Rt=C({revision:A().int().positive().optional(),baselineAt:O().datetime().optional(),armedAt:O().datetime().optional(),historyScan:Lt.optional(),cursor:It.optional(),frozenHighWatermark:It.extend({tieBreaker:O()}).optional(),backlogAfter:It.extend({tieBreaker:O()}).optional(),nextCheckAt:O().datetime().optional(),lastSuccessAt:O().datetime().optional(),nextRunAt:O().datetime().optional(),lastRunAt:O().datetime().optional(),etags:w(O(),O()).optional(),backoffUntil:O().datetime().optional(),consecutiveFailures:A().int().nonnegative().optional(),...ht,onceOutcome:k([`failed`,`missed`]).optional()}).passthrough();C({version:T(1).default(1),states:w(O(),Rt).default({})}).passthrough(),C({receiptId:O().min(1),receiptKey:O().min(1),eventId:O().min(1),automationId:O().min(1),revision:A().int().positive(),status:k([`reserved`,`launched`,`launch-error`,`released`]),runId:O().optional(),observedAt:O().datetime(),updatedAt:O().datetime(),error:O().max(2e3).optional(),occurrenceAt:O().datetime().optional(),candidate:C({eventId:O(),event:jt,timestamp:O().datetime(),tieBreaker:O(),repo:O(),nodeId:O(),number:A().int().positive(),title:O().max(500),url:O().url(),author:O().max(200),assignees:E(O().max(200)).max(100),labels:E(O().max(200)).max(100),changedLabel:O().max(200).optional()}).passthrough().optional()}).passthrough();var zt=k([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);C({seq:A().int().positive(),ts:O().datetime(),automationId:O().min(1),revision:A().int().positive(),event:jt.optional(),result:zt,reason:O().max(2e3).optional(),durationMs:A().int().nonnegative().optional(),receiptId:O().optional(),runId:O().optional(),githubNumber:A().int().positive().optional(),githubTitle:O().max(500).optional(),githubUrl:O().url().optional(),rateLimit:C({bucket:k([`core`,`search`]),remaining:A().int().nonnegative().optional(),resetAt:O().datetime().optional()}).passthrough().optional()}).passthrough();var Bt=`quick-task`;function Vt(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=Ft(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:Bt}:{}:{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 Ht(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 Ut(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 Wt(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:Ht(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:Ut(e)}}function Gt(e){return{...Wt(e),enable:e.enabled}}function Kt(e,t){return{...Wt(e),task:{...Ut(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function Z(e){return`'${e.replace(/'/g,`'\\''`)}'`}var qt=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),Jt=new Set([`anyLabels`,`authors`,`changedLabels`]);function Yt(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=>!qt.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||Jt.has(e)&&Array.isArray(t)&&t.length>0)}function Xt(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function Zt(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function Q(e,t){return t.startsWith(`-`)?`--${e}=${Z(t)}`:`--${e} ${Z(t)}`}function Qt(e){let t=[`${Be()} automation add`,Q(`name`,e.name)];if(e.schedule?.type===`once`)t.push(Q(`at`,e.schedule.at),Q(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push(Q(`latest-start`,Zt(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push(Q(`cron`,tt(e.schedule)));else{t.push(Q(`on`,e.events.join(`,`)),`--every ${Xt(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push(Q(`label`,n));for(let n of e.filters?.authors??[])t.push(Q(`author`,n));for(let n of e.filters?.changedLabels??[])t.push(Q(`changed-label`,n))}return t.push(...$t(e.task)),e.enable===!0&&t.push(`--enable`),t.push(Q(`prompt`,e.task.prompt)),t.join(` `)}function $t(e){let t=[];return e.workflow&&t.push(Q(`workflow`,e.workflow)),e.runner&&t.push(Q(`runner`,e.runner)),e.model&&t.push(Q(`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 en(e,t){let n=Gt(e),r=Yt(n)?Qt(n):`${Be()} automation create --json ${Z(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${Z(t.origin)} CEZ_PROJECT_ID=${Z(t.projectId)} HSQ_COCKPIT_URL=${Z(t.origin)} HSQ_PROJECT_ID=${Z(t.projectId)} ${r}`:r}function tn(e){let t=[],n=!1;for(let r of nn(e)){let e=t.length-1;!n&&/^[A-Z_][A-Z0-9_]*=/.test(r)?t.push(r):r.startsWith(`--`)||!n?(t.push(r),n=!0):t[e]=`${t[e]} ${r}`}return t.map((e,t)=>t===0?e:` ${e}`).join(` \\
|
|
2
|
-
`)}function nn(e){let t=[],n=``,r=!1;for(let i=0;i<e.length;i+=1){let a=e[i];!r&&a===`\\`&&i+1<e.length?(n+=a+e[i+1],i+=1):a===`'`?(r=!r,n+=a):a===` `&&!r?(n&&t.push(n),n=``):n+=a}return n&&t.push(n),t}function rn({draft:e}){let t=Te(),n=window.location.origin,i=(0,U.useMemo)(()=>{let r=en(e);return t?`HSQ_COCKPIT_URL=${Z(n)} HSQ_PROJECT_ID=${Z(t)} ${r}`:r},[e,n,t]),a=(0,U.useMemo)(()=>tn(i),[i]),[o,s]=(0,U.useState)(`idle`),[c,l]=(0,U.useState)(!1),u=(0,U.useId)(),d=(0,U.useRef)(void 0);(0,U.useEffect)(()=>()=>clearTimeout(d.current),[]),(0,U.useEffect)(()=>s(`idle`),[i]);let f=async()=>{clearTimeout(d.current);try{await navigator.clipboard.writeText(a),s(`copied`),d.current=setTimeout(()=>s(`idle`),1600)}catch{s(`failed`)}};return(0,q.jsxs)(`section`,{"aria-labelledby":`copy-as-cli-heading`,"data-slot":`copy-as-cli`,className:`min-w-0 max-w-full overflow-hidden rounded-xl border border-card-edge bg-card shadow-card px-4 py-3.5`,children:[(0,q.jsxs)(`div`,{className:`flex min-h-8 min-w-0 flex-nowrap items-center justify-between gap-x-2`,children:[(0,q.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`shrink-0 text-[13px] font-medium text-muted-foreground`,children:`Copy as CLI`}),(0,q.jsxs)(M,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`copy-as-cli-toggle`,"aria-expanded":c,"aria-controls":u,"aria-label":c?`Hide command`:`Show command`,className:`min-w-0 shrink gap-1 px-1.5 text-[12px] font-medium max-md:h-11 no-hover:h-11`,onClick:()=>l(e=>!e),children:[(0,q.jsx)(`span`,{className:`truncate`,children:c?`Hide`:`Show`}),(0,q.jsx)(he,{"aria-hidden":`true`,className:r(`size-3.5 transition-transform`,c&&`rotate-180`)})]}),(0,q.jsxs)(M,{type:`button`,variant:`outline`,size:`sm`,className:`ms-auto gap-1.5 px-2 text-[12px] font-medium max-md:h-11 no-hover:h-11`,onClick:()=>void f(),children:[o===`copied`?(0,q.jsx)(ye,{"aria-hidden":`true`,className:`size-3.5`}):(0,q.jsx)(We,{"aria-hidden":`true`,className:`size-3.5`}),o===`copied`?`Copied`:`Copy`]})]}),(0,q.jsx)(`div`,{id:u,hidden:!c,className:`mbs-2 max-w-full rounded-lg border border-border bg-muted has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-ring`,children:(0,q.jsx)(`pre`,{"data-slot":`copy-as-cli-line`,tabIndex:0,"aria-label":`Command line`,className:`m-0 max-w-full px-3 pt-2.5 pb-3 font-mono text-xs leading-5 break-all whitespace-pre-wrap text-muted-foreground outline-none`,children:a})}),(0,q.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:o===`failed`?`Could not copy — select the line and copy it by hand.`:(0,q.jsxs)(q.Fragment,{children:[`The definition Save paused would create. `,(0,q.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-px font-mono text-xs whitespace-nowrap text-foreground [word-spacing:-0.2em]`,children:`${Be()} automation schema`}),` prints its shape.`]})})]})}function an({pressed:e,onClick:t,disabled:n,children:i}){return(0,q.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:r(`inline-flex min-h-11 items-center justify-center rounded-md border px-3.5 text-[13px] font-medium transition-colors outline-hidden focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50`,e?`border-border bg-card font-semibold text-foreground shadow-xs`:`border-transparent bg-transparent text-muted-foreground hover:text-foreground`),children:i})}var on={"pull_request.opened":`a pull request opens`,"issue.opened":`an issue opens`,"issue.labeled":`an issue is labeled`,"issue.unlabeled":`an issue is unlabeled`},sn={"pull_request.opened":`Pull request opened`,"issue.opened":`Issue opened`,"issue.labeled":`Issue labeled`,"issue.unlabeled":`Issue unlabeled`};function cn(e){let t=e.map(e=>on[e]);if(t.length===0)return`When GitHub changes`;let n=t.slice(0,-1),r=t[t.length-1];return`When ${n.length>0?`${n.join(`, `)} or ${r}`:r}`}var ln=W.options,un=[{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`}],dn=[{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.`}],fn=e=>(e??[]).join(`, `),pn=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function mn(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 hn(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`}. ${mn(e.filters.includeExisting)}`}function gn({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=pn(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=un.some(t=>t.seconds===e.intervalSeconds)?un:[...un,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,q.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,q.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,q.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:ln.map(t=>(0,q.jsx)(an,{pressed:e.events.includes(t),onClick:()=>r(t),children:sn[t]},t))}),(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(j,{htmlFor:`automation-interval`,children:`Check every`}),(0,q.jsxs)(L,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,q.jsx)(P,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,q.jsx)(N,{})}),(0,q.jsx)(F,{children:o.map(e=>(0,q.jsx)(I,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,q.jsx)(Ce,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,q.jsx)(`span`,{children:`Include existing items`})]}),(0,q.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:mn(e.filters.includeExisting)})]}),(0,q.jsxs)(Se,{children:[(0,q.jsxs)(xe,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,q.jsx)(he,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,q.jsx)(be,{children:(0,q.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[dn.map(t=>(0,q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,q.jsx)(j,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,q.jsx)(V,{id:`automation-filter-${t.key}`,className:`border-border`,placeholder:`comma separated`,value:fn(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,q.jsx)(j,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,q.jsx)(V,{id:`automation-filter-lookback`,className:`border-border`,type:`number`,min:1,value:e.filters.lookbackDays,onChange:e=>i({lookbackDays:Math.max(1,Number(e.target.value)||1)})})]}),(0,q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,q.jsx)(j,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,q.jsx)(V,{id:`automation-filter-max`,className:`border-border`,type:`number`,min:1,value:e.filters.maxRecords,onChange:e=>i({maxRecords:Math.max(1,Number(e.target.value)||1)})})]})]})})]})]})}var _n=e=>String(e).padStart(2,`0`);function vn({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,U.useState)(_n(t)),o=(0,U.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${_n(n)}.`,l=(0,U.useId)();return(0,U.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(V,{ref:o,"aria-label":e,"aria-invalid":s||void 0,"aria-describedby":s?l:void 0,inputMode:`numeric`,maxLength:2,className:`w-20 border-border 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(_n(t))}),s?(0,q.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}var yn=[{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`}],bn=`none`,xn=e=>String(e).padStart(2,`0`);function Sn(e,t=Date.now()){let n=lt(t,e)??lt(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${xn(r.getUTCMonth()+1)}-${xn(r.getUTCDate())}T09:00`}function Cn(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function wn({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?nt(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${xn(t)}:${xn(n)}`}),l=(0,U.useRef)(null),u=(0,U.useId)(),d=Ze(e),f=!(t?.type===`once`&&t.at===e.at&&t.timeZone===e.timeZone)&&d!==null&&d<=Date.now();(0,U.useEffect)(()=>{l.current?.setCustomValidity(f?Je:``)},[f]);let p=ot(e);return(0,q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(j,{htmlFor:`automation-once-date`,children:`Date`}),(0,q.jsx)(V,{ref:l,id:`automation-once-date`,type:`date`,className:`w-44 max-w-full border-border`,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,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,q.jsx)(vn,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,q.jsx)(vn,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,q.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:Je}):null,(0,q.jsx)(En,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,q.jsx)(Dn,{value:e.latestStartMinutes,onChange:t=>n(Tn(e,t))}),p?(0,q.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 Tn(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function En({value:e,onCommit:t}){let[n,r]=(0,U.useState)(e),i=(0,U.useRef)(null),a=(0,U.useId)(),o=(0,U.useId)(),[s]=(0,U.useState)(Cn),c=n!==e||!qe(n),l=Qe(n);return(0,U.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(j,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,q.jsx)(V,{ref:i,id:`automation-once-zone`,list:a,autoComplete:`off`,spellCheck:!1,className:`w-full border-border sm:w-72`,value:n,"aria-invalid":c||void 0,"aria-describedby":c?o:void 0,onChange:e=>{r(e.target.value),qe(e.target.value)&&t(e.target.value)}}),(0,q.jsx)(`datalist`,{id:a,children:s.map(e=>(0,q.jsx)(`option`,{value:e},e))}),c?(0,q.jsx)(`p`,{id:o,className:`text-xs break-words text-destructive`,children:l}):null]})}function Dn({value:e,onChange:t}){let n=yn.some(t=>t.minutes===e)||e===void 0?yn:[...yn,{minutes:e,label:`${e} minutes`}];return(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(j,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,q.jsxs)(L,{value:e===void 0?bn:String(e),onValueChange:e=>t(e===bn?void 0:Number(e)),children:[(0,q.jsx)(P,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,q.jsx)(N,{})}),(0,q.jsx)(F,{children:n.map(e=>(0,q.jsx)(I,{value:e.minutes===void 0?bn:String(e.minutes),children:e.label},e.label))})]}),(0,q.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 On=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}];function kn({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??Sn(r),timeZone:e.timeZone??r}:{type:t});return(0,q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,q.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:On.map(t=>(0,q.jsx)(an,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,q.jsx)(wn,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,q.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:st.map((t,n)=>(0,q.jsx)(an,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(j,{htmlFor:`automation-every`,children:`Run every`}),(0,q.jsxs)(L,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,q.jsx)(P,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,q.jsx)(N,{})}),(0,q.jsx)(F,{children:it.map(e=>(0,q.jsx)(I,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,q.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,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,q.jsx)(vn,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,q.jsx)(vn,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,q.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,q.jsx)(`code`,{className:`font-mono text-foreground`,children:tt(e)})]})]})}var An=40*864e5,jn=5;function Mn({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,q.jsx)(Nn,{schedule:e,now:n});let r=Xe(e,n+1,n+An,t,jn);return(0,q.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,q.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-2 text-base font-semibold`,children:`Next 5 runs`}),r.length===0?(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,q.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid divide-y divide-border text-sm`,children:r.map((e,r)=>(0,q.jsxs)(`li`,{className:`flex min-h-10 items-center justify-between gap-3 py-1.5`,children:[(0,q.jsx)(`span`,{className:r===0?`font-semibold tabular-nums text-foreground`:`font-medium tabular-nums`,children:H(new Date(e).toISOString(),t)}),(0,q.jsx)(`span`,{className:r===0?`font-medium text-accent-text`:`text-muted-foreground`,children:et(n,e)})]},e))}),(0,q.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this Squawk runs in.`]})]})}function Nn({schedule:e,now:t}){let n=Ze(e),r=ot(e);return(0,q.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,q.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-base font-semibold`,children:`Runs once`}),n===null||!r?(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,q.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,q.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:et(t,n)}):null]}),r?.note?(0,q.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,q.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,q.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 Pn={schedule:`On a schedule`,github:`When GitHub changes`};function Fn(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 In({title:e,hideLegend:t=!1,failure:n,section:r,children:i}){let a=(0,U.useId)();return(0,q.jsxs)(`section`,{role:t?void 0:`group`,"aria-labelledby":t?void 0:a,className:`grid min-w-0 gap-3.5 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[t?null:(0,q.jsx)(`h2`,{id:a,className:`text-sm font-semibold text-foreground`,children:e}),i,n?.section===r&&!n.conflict?(0,q.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:n.message}):null]})}function Ln({draft:e,patch:t,forge:n,automation:r}){return(0,q.jsx)(q.Fragment,{children:r?(0,q.jsxs)(`p`,{className:`text-sm`,children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),Pn[e.kind]]}):(0,q.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,q.jsx)(Ue,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:e.kind,onChange:e=>t({kind:e}),options:[{value:`schedule`,label:Pn.schedule},{value:`github`,label:Pn.github,disabled:!n.available,...n.available?{}:{title:n.reason??`GitHub is unavailable`}}]}),n.available?null:(0,q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${n.reason??`no GitHub access`}`})]})})}function Rn({draft:e,patch:t,forge:n,timeZone:r,automation:i}){return e.kind===`schedule`?(0,q.jsx)(kn,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,q.jsx)(gn,{draft:e,onChange:t,...n.available?{}:{disabledReason:n.reason??`no GitHub access`}})}function zn({draft:e,patch:t,saving:n,automation:r}){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,q.jsx)(j,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,q.jsx)(Ke,{id:`automation-prompt`,value:e.prompt,onChange:e=>t({prompt:e.target.value}),rows:3,className:`[field-sizing:fixed] min-h-[88px] resize-none border-border bg-background`,required:!0}),(0,q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,q.jsxs)(q.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,q.jsxs)(q.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),(0,q.jsx)(Wn,{draft:e,patch:t}),(0,q.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,q.jsx)(Ce,{"aria-label":`Autonomous`,checked:e.autonomous,onCheckedChange:e=>t({autonomous:e})}),(0,q.jsxs)(`span`,{children:[`Autonomous `,(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`· runs without waiting for answers`})]})]}),(0,q.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,q.jsx)(ze,{archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,q.jsx)(Ie,{allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),r?(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]})}function Bn({draft:e,patch:t,automation:n}){let r=e.kind===`schedule`;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,q.jsx)(Ce,{"aria-label":n?`Enabled`:`Enable after saving`,checked:e.enabled,onCheckedChange:e=>t({enabled:e})}),(0,q.jsx)(`span`,{children:n?`Enabled`:`Enable after saving`})]}),(0,q.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.`:mn(e.filters.includeExisting)})]})}function Vn({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,o]=(0,U.useState)(()=>Vt(e)),[s,c]=(0,U.useState)(e?.revision),[l,u]=(0,U.useState)(),[p,h]=(0,U.useState)(!1),[g,v]=(0,U.useState)(!1),[y,b]=(0,U.useState)(!1),[x,te]=(0,U.useState)(``),S=e=>o(t=>({...t,...e})),ne=async t=>{if(t.preventDefault(),p)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}h(!0),u(void 0);let i=`save`;try{if(e&&s!==void 0){let{automation:t}=await f(e.id,Kt({...a,enabled:e.enabled},s));c(t.revision),a.enabled!==e.enabled&&(i=`enable`,await m(e.id,a.enabled))}else await ee(Gt(a));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof d&&t.status===409&&/revision conflict/i.test(n)?u({section:`form`,message:`Edited elsewhere — reload to see the latest version`,conflict:!0}):u({section:i===`enable`?`enable`:Fn(n),message:n})}finally{h(!1)}},re=async()=>{if(!(!e||y)){b(!0),te(``);try{await _(e.id),r()}catch(e){te(e instanceof Error?e.message:String(e))}finally{b(!1)}}},ie=(0,U.useId)(),ae=(0,U.useId)(),C=a.kind===`schedule`;return(0,q.jsx)(Ee,{route:`automations`,density:a.name.trim()===``&&a.prompt.trim()===``?`sparse`:`full`,header:Un({automation:e,draft:a,formId:ie,saveHintId:ae,saving:p}),children:(0,q.jsxs)(`form`,{id:ie,className:`automation-editor grid min-w-0 gap-4 md:grid-cols-[minmax(0,1fr)_320px] md:items-start`,onSubmit:ne,children:[(0,q.jsxs)(`div`,{className:`grid min-w-0 gap-3.5`,children:[(0,q.jsx)(In,{title:`Name`,hideLegend:!0,section:`name`,failure:l,children:(0,q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,q.jsx)(j,{htmlFor:`automation-name`,className:`text-sm font-semibold text-foreground`,children:`Name`}),(0,q.jsx)(V,{id:`automation-name`,className:`border-border`,value:a.name,placeholder:`Daily dependency audit`,onChange:e=>S({name:e.target.value}),required:!0})]})}),(0,q.jsxs)(In,{title:`When`,section:`when`,failure:l,children:[(0,q.jsx)(Ln,{draft:a,patch:S,forge:t,automation:e}),(0,q.jsx)(Rn,{draft:a,patch:S,forge:t,timeZone:n,automation:e})]}),(0,q.jsx)(In,{title:`What to run`,section:`run`,failure:l,children:(0,q.jsx)(zn,{draft:a,patch:S,saving:p,automation:e})}),(0,q.jsx)(In,{title:`Enable`,section:`enable`,failure:l,children:(0,q.jsx)(Bn,{draft:a,patch:S,automation:e})}),l?.section===`form`?(0,q.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,q.jsx)(`span`,{className:`break-words`,children:l.message}),l.conflict&&i?(0,q.jsx)(M,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,e?(0,q.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[g?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(M,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:y,onClick:()=>void re(),children:`Delete automation`}),(0,q.jsx)(M,{type:`button`,variant:`outline`,disabled:y,onClick:()=>{v(!1),te(``)},children:`Keep`})]})]}):(0,q.jsx)(M,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>v(!0),children:`Delete`}),x?(0,q.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:x}):null]}):null]}),(0,q.jsxs)(`aside`,{className:`grid min-w-0 max-w-full grid-cols-[minmax(0,1fr)] gap-4 md:sticky md:top-4`,children:[C?(0,q.jsx)(Mn,{schedule:a.schedule,timeZone:n}):(0,q.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[(0,q.jsx)(`h2`,{className:`mb-2 text-base font-semibold`,children:`How it polls`}),(0,q.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:hn(a)})]}),(0,q.jsx)(rn,{draft:a})]})]})})}function Hn(e){let t=[!e.name.trim()&&`a name`,!e.prompt.trim()&&`a prompt`].filter(Boolean);return t.length?`Add ${t.join(` and `)} to save.`:``}function Un({automation:e,draft:t,formId:n,saveHintId:r,saving:i}){let a=t.name.trim()?t.prompt.trim()?``:`Prompt`:`Name`,o=Hn(t),s=e?`Save changes`:t.enabled?`Save and enable`:`Save paused`;return{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,status:o?(0,q.jsx)(`p`,{id:r,"data-slot":`automation-save-hint`,className:`text-xs text-muted-foreground`,children:o}):void 0,secondaryActions:(0,q.jsx)(z,{type:`button`,variant:`outline`,asChild:!0,children:(0,q.jsx)(R,{to:`/automations`,children:`Cancel`})}),primaryAction:(0,q.jsx)(z,{type:`submit`,form:n,variant:`primary`,disabled:i||a!==``,title:a?`${a} is required`:void 0,"aria-describedby":o?r:void 0,children:i?`Saving…`:s})}}function Wn({draft:e,patch:t}){let n=i(),r=Ge(),{runners:u,signedOut:d}=r.runnersOn(e=>r.repoAccount?.[e]),f=a(),p=s(),{runner:m,ready:h}=o(e.runner??f.data?.defaultRunner??`claude`),g=c(m,h,r.repoAccount?.[m]),ee=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],_=[...new Set([...u,...e.runner?[e.runner]:[]])],v=Fe(m,p.data,g.data,[e.model]),y=v.find(t=>t.id===(e.model??``))?.label??e.model??`auto`,b=e=>(0,q.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,q.jsx)(Me,{children:(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(Re,{slot:`automation-workflow-pill`,icon:b(_e),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:ee.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,q.jsx)(Re,{slot:`automation-runner-pill`,icon:b(me),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner?l(p.data,e.runner):`default`,value:e.runner??``,disabled:!p.data,options:[{value:``,label:`default`,desc:`The project’s default runner`},..._.map(e=>({value:e,label:l(p.data,e)}))],footer:(0,q.jsx)(Ve,{uninstalled:r.uninstalled,signedOut:d.filter(t=>t!==e.runner)}),onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,q.jsx)(Re,{slot:`automation-model-pill`,icon:b(ve),fieldLabel:!0,ariaLabel:`Model`,label:y,value:e.model??``,options:v.map(e=>({value:e.id,label:e.label,desc:e.desc})),onPick:e=>t({model:e||void 0})})]})})}function Gn({data:e,error:t,refresh:n,archived:i=!1,onArchivedChange:a}){let[o,s]=(0,U.useState)({}),[c,l]=(0,U.useState)({}),d=(e,t)=>s(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),f=async(e,t)=>{l(t=>({...t,[e]:!0}));try{await t()}catch(t){d(e,{text:t instanceof Error?t.message:String(t),tone:`error`})}finally{l(t=>({...t,[e]:!1}))}},p=e=>f(e.id,async()=>{d(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await u(e.id);d(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),h=e=>f(e.id,async()=>{d(e.id,void 0),await m(e.id,!e.enabled),await n()}),g=e=>f(e.id,async()=>{d(e.id,void 0),await te(e.id),await n()}),ee=e=>f(e.id,async()=>{d(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await S(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await v(t);if(r.status===`complete`){d(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`)}),_=e?.automations??[],y=_.filter(e=>!e.archived),b=_.filter(e=>!!e.archived),x=i?b:y;return(0,q.jsx)(B,{route:`automations`,density:e?Oe(x.length):`full`,headerSpacing:`compact`,header:{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,primaryAction:(0,q.jsx)(z,{variant:`primary`,asChild:!0,children:(0,q.jsxs)(R,{to:`/automations/new`,children:[(0,q.jsx)(fe,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})},sparseFooter:e&&x.length>0&&!i?(0,q.jsx)(ke,{summary:`${x.length} active ${x.length===1?`automation`:`automations`} configured. New automations start paused so you can test filters before enabling them.`,actions:(0,q.jsx)(M,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,q.jsx)(R,{to:`/automations/new`,children:`Add another`})})}):void 0,children:t&&!e?(0,q.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,q.jsx)(J,{text:t}),(0,q.jsx)(M,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-3 border-b border-border`,children:[a?(0,q.jsxs)(`div`,{className:`flex gap-6`,role:`group`,"aria-label":`Filter automations`,children:[(0,q.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`active`,"aria-pressed":!i,onClick:()=>a(!1),className:r(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,!i&&`border-accent-text text-foreground`),children:[`Current`,(0,q.jsx)(Kn,{count:y.length})]}),(0,q.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`archived`,"aria-pressed":i,onClick:()=>a(!0),className:r(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,i&&`border-accent-text text-foreground`),children:[`Archived`,(0,q.jsx)(Kn,{count:b.length})]})]}):(0,q.jsx)(`span`,{}),(0,q.jsx)(`div`,{className:`pb-2.5`,children:(0,q.jsx)(qn,{data:e})})]}),i&&x.length===0?(0,q.jsx)(J,{text:`No archived one-time schedules.`}):x.length===0?(0,q.jsx)(Ae,{icon:(0,q.jsx)(ge,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,q.jsx)(M,{variant:`primary`,asChild:!0,children:(0,q.jsxs)(R,{to:`/automations/new`,children:[(0,q.jsx)(fe,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})}):(0,q.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:x.map(t=>(0,q.jsx)(nr,{automation:t,timeZone:e.timeZone,note:o[t.id],busy:c[t.id]===!0,onRun:()=>void p(t),onToggle:()=>void h(t),onPreview:()=>void ee(t),onCancel:()=>void g(t)},t.id))})]}):(0,q.jsx)(J,{text:`Loading automations…`})})}function Kn({count:e}){return e===0?null:(0,q.jsx)(`span`,{"data-slot":`automations-tab-count`,className:`tabular-nums text-muted-foreground`,children:`· ${e}`})}function qn({data:e}){return(0,q.jsx)(`p`,{"data-slot":`automation-scheduler`,className:r(`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 Jn(e){return e.kind===`schedule`&&e.schedule?$e(e.schedule):`${cn(e.events??[])} · every ${Math.round((e.intervalSeconds??300)/60)} min`}function Yn({automation:e,nextRun:t}){let n=e.kind===`schedule`?pe:de,r=Le(e);return(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,q.jsx)(n,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,q.jsxs)(`p`,{"data-slot":`automation-meta`,className:`mt-1 flex flex-wrap items-baseline gap-x-1.5 ps-6 text-xs break-words text-muted-foreground`,children:[(0,q.jsx)(`span`,{children:Jn(e)}),t?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t]}):null]})]}),(0,q.jsx)(He,{dot:r.tone,shape:r.shape,pulse:r.pulse,children:r.label})]})}function Xn({automation:e,archive:t}){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,q.jsxs)(q.Fragment,{children:[` · `,(0,q.jsx)(R,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,q.jsx)(M,{variant:`outline`,asChild:!0,children:(0,q.jsx)(R,{to:`/automations/${e.id}`,children:`Details`})})})]})}function Zn({automation:e,timeZone:t}){let n=e.kind===`schedule`,r=e.enabled&&n?e.nextRunAt:void 0;return!n&&e.enabled?(0,q.jsx)(`span`,{children:`continuous`}):r?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`text-foreground`,children:`Next run: ${H(r,t)}`}),(0,q.jsx)(`span`,{children:`· ${et(Date.now(),Date.parse(r))}`})]}):(0,q.jsx)(`span`,{children:`Next run: —`})}function Qn({automation:e,timeZone:t}){let n=e.enabled?_t(e.state):void 0;return n?(0,q.jsxs)(`p`,{role:`alert`,"data-slot":`automation-failing`,className:`text-sm break-words text-destructive`,children:[`The last ${n.consecutiveFailures} checks failed: ${n.lastError}`,n.retryAt?(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${H(n.retryAt,t)}`}):null]}):null}var $=`h-8 px-3 max-md:h-11 no-hover:h-11`;function $n({automation:e,busy:t,confirmingCancel:n,cancelRef:i,onToggle:a,onRun:o,onPreview:s,onOpenCancel:c}){let l=e.kind===`schedule`,u=e.schedule?.type===`once`;return(0,q.jsxs)(`div`,{"data-slot":`automation-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(M,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-toggle`,disabled:t,onClick:a,children:e.enabled?`Pause`:`Enable`}),l?(0,q.jsx)(M,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-run`,disabled:t,onClick:o,children:`Run now`}):(0,q.jsx)(M,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-preview`,disabled:t,onClick:s,children:`Test filter`}),(0,q.jsx)(M,{variant:`outline`,size:`sm`,className:$,asChild:!0,children:(0,q.jsx)(R,{to:`/automations/${e.id}`,children:`Edit`})}),u&&!n?(0,q.jsx)(M,{variant:`outline`,size:`sm`,className:r($,`text-destructive`),ref:i,"data-action":`automation-cancel`,disabled:t,onClick:c,children:`Cancel`}):null,(0,q.jsx)(M,{variant:`outline`,size:`sm`,className:r($,`sm:ms-auto`),asChild:!0,children:(0,q.jsx)(R,{to:`/automations/${e.id}/log`,children:`Execution log`})})]})}function er({automation:e,busy:t,keepRef:n,onConfirm:r,onKeep:i}){return(0,q.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,q.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(M,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,q.jsx)(M,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function tr({note:e}){return(0,q.jsxs)(`p`,{role:e.tone===`error`?`alert`:`status`,className:r(`text-sm break-words`,e.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[e.text,e.runId?(0,q.jsxs)(q.Fragment,{children:[` · `,(0,q.jsx)(R,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`})]}):null]})}function nr({automation:e,timeZone:t,note:n,busy:r,onRun:i,onToggle:a,onPreview:o,onCancel:s}){let[c,l]=(0,U.useState)(!1),u=(0,U.useRef)(null),d=(0,U.useRef)(null),f=(0,U.useRef)(null);(0,U.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,q.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`flex min-w-0 flex-col gap-2.5 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,q.jsx)(Yn,{automation:e,nextRun:h?void 0:(0,q.jsx)(Zn,{automation:e,timeZone:t})}),h?(0,q.jsx)(Xn,{automation:e,archive:h}):null,h?null:(0,q.jsx)(Qn,{automation:e,timeZone:t}),h?null:(0,q.jsx)($n,{automation:e,busy:r,confirmingCancel:c,cancelRef:u,onToggle:a,onRun:i,onPreview:o,onOpenCancel:p}),e.schedule?.type===`once`&&!h&&c?(0,q.jsx)(er,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,q.jsx)(tr,{note:n}):null,(0,q.jsx)(kt,{automationId:e.id,automationName:e.name,timeZone:t})]})}function rr(e){let t=Te(),n=Pe(),[r,i]=(0,U.useState)(),[a,o]=(0,U.useState)(``),s=(0,U.useCallback)(t=>ie({signal:t,...e?{archived:e}:{}}).then(e=>{t?.aborted||(i(e),o(``))}).catch(e=>{t?.aborted||o(String(e))}),[e]);return(0,U.useEffect)(()=>{n&&s()},[n,s]),(0,U.useEffect)(()=>p(async e=>{n&&await s(e)}),[n,s]),(0,U.useEffect)(()=>ue((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 ir({mode:e=`list`}){let{automationId:t}=le(),n=we(),[r,i]=(0,U.useState)(!1),{data:a,error:o,refresh:s}=rr(`include`),[c,l]=(0,U.useState)(0),u=Ne();if(u===`unknown`)return(0,q.jsx)(B,{route:`automations`,density:`empty`,children:(0,q.jsx)(J,{text:`Loading automations…`})});if(u===`absent`)return(0,q.jsx)(je,{});if(u===`disabled`)return(0,q.jsx)(B,{route:`automations`,density:`empty`,children:(0,q.jsx)(Ae,{icon:(0,q.jsx)(ge,{}),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,q.jsx)(Gn,{data:a,error:o,refresh:s,archived:r,onArchivedChange:i});if(!a)return o?(0,q.jsx)(B,{route:`automations`,density:`empty`,header:{title:`Automations`,subtitle:`Could not load automations.`},children:(0,q.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,q.jsx)(J,{text:o}),(0,q.jsx)(M,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]})}):(0,q.jsx)(B,{route:`automations`,density:`empty`,children:(0,q.jsx)(J,{text:`Loading automations…`})});let p={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,q.jsx)(Vn,{forge:p,timeZone:a.timeZone,onSaved:d}):e===`edit`?f?f.archived?(0,q.jsx)(At,{automation:f,timeZone:a.timeZone,onDeleted:d}):(0,q.jsx)(Vn,{automation:f,forge:p,timeZone:a.timeZone,onSaved:d,onReload:()=>void s().then(()=>l(e=>e+1))},`${f.id}:${c}`):(0,q.jsx)(B,{route:`automations`,density:`empty`,header:{title:`Automation not found`,subtitle:`This automation may have been removed.`},children:(0,q.jsx)(M,{asChild:!0,variant:`outline`,children:(0,q.jsx)(R,{to:`/automations`,children:`Back to automations`})})}):t?(0,q.jsx)(Ot,{automationId:t,automationName:f?.name,timeZone:a.timeZone,readOnly:!!f?.archived}):(0,q.jsx)(J,{text:`Automation not found.`})}export{ir as AutomationsRoute};
|