cezarion 0.19.0-dev.8754 → 0.19.0-dev.8762
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-CqJiDoKE.js → accounts-section-DhS7blSK.js} +1 -1
- package/web/dist/assets/activity-motion-aJkLHTxc.js +1 -0
- package/web/dist/assets/{activity-route-DOcAtf9i.js → activity-route-D2sff_BA.js} +1 -1
- package/web/dist/assets/{agent-config-section-B6lCNWlM.js → agent-config-section-C7SMwOgZ.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-DHwkBXuz.js → agent-defaults-section-CvMgsSLY.js} +1 -1
- package/web/dist/assets/{appearance-DEK8ezEQ.js → appearance-44RH8bum.js} +1 -1
- package/web/dist/assets/{automations-route-BXoyFkhx.js → automations-route-CygHw9Ni.js} +1 -1
- package/web/dist/assets/{commit-list-DjhAXNOu.js → commit-list-Djmz3j1l.js} +1 -1
- package/web/dist/assets/{diff-eQ6oM_Ti.js → diff-ByLut7n4.js} +2 -2
- package/web/dist/assets/{diff-controls-CYiGOTLb.js → diff-controls-BEVRwCau.js} +1 -1
- package/web/dist/assets/{diff-view-kgRbXZ06.js → diff-view-kvjafBI7.js} +1 -1
- package/web/dist/assets/{file-preview-D5Mc18GN.js → file-preview-Ce0Jsxbm.js} +1 -1
- package/web/dist/assets/{git-toolbar-BYCPpYE3.js → git-toolbar-Cn1ASnMZ.js} +1 -1
- package/web/dist/assets/{github-B0s8RT3R.js → github-CxYmUkO9.js} +1 -1
- package/web/dist/assets/{global-activity-route-DTNGyGoC.js → global-activity-route-ALFcEqug.js} +2 -2
- package/web/dist/assets/{index-DwDvloUQ.js → index-BZr8Y74X.js} +4 -4
- package/web/dist/assets/{markdown-jbBslIIT.js → markdown-BRNtAZkY.js} +1 -1
- package/web/dist/assets/{notifications-section-C1aUjb3n.js → notifications-section-C_IsaiyD.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-ChoZcfZF.js → preview-pane-connected-DzajVDzR.js} +1 -1
- package/web/dist/assets/{projects-section-Dlz2V18-.js → projects-section-Cme2qWcF.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-KYeZJ5it.js → prompt-templates-section-DVr3aKc-.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-CXNs2m11.js → remote-settings-notice-BFeWL9QB.js} +1 -1
- package/web/dist/assets/{repo-git-xHDvySA0.js → repo-git-C3YNr0yL.js} +1 -1
- package/web/dist/assets/{report-reader-pkkocX-w.js → report-reader-Bm0J3ujk.js} +1 -1
- package/web/dist/assets/{reports-DE76L7r9.js → reports-CNL2zChD.js} +1 -1
- package/web/dist/assets/{resources-section-CsyiFux8.js → resources-section-BymE7-3T.js} +1 -1
- package/web/dist/assets/{review-panel-CLsVpcPr.js → review-panel-3oSwii0J.js} +1 -1
- package/web/dist/assets/{run-header-kGdJVGJm.js → run-header-CI49Lba9.js} +1 -1
- package/web/dist/assets/{select-BH4KzC9I.js → select-DEqrvCmQ.js} +1 -1
- package/web/dist/assets/{session-context-section-CQaaWpJ6.js → session-context-section-oK9zU15I.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-Cv_4wnFI.js → settings-agent-picker-BqRDs5nQ.js} +1 -1
- package/web/dist/assets/{settings-shell-CG6eFmsm.js → settings-shell-11SRBczO.js} +1 -1
- package/web/dist/assets/{sidebar-section-CcO5Q0as.js → sidebar-section-DujeUKJ0.js} +1 -1
- package/web/dist/assets/{skills-C2TtFkX0.js → skills-B6vquPg1.js} +1 -1
- package/web/dist/assets/{task-changes-CS7sYCut.js → task-changes-t473lMAF.js} +1 -1
- package/web/dist/assets/{task-commits-B0HDJ95C.js → task-commits-CuXxfPY6.js} +1 -1
- package/web/dist/assets/{task-file-scope-vwEp2s7o.js → task-file-scope-DK1biohR.js} +1 -1
- package/web/dist/assets/{task-files-kehKktnF.js → task-files-C0zhDxod.js} +1 -1
- package/web/dist/assets/{task-github-item-BNc2Oyvq.js → task-github-item-CFU1Rbv0.js} +1 -1
- package/web/dist/assets/{task-thread-BRpUqs1N.js → task-thread-1BQ5lWbM.js} +1 -1
- package/web/dist/assets/{thread-state-B_UW2DqR.js → thread-state-BHI3Jijs.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-DzPA14Gk.js → use-hand-to-agent-state-BHAhGcZe.js} +1 -1
- package/web/dist/assets/{workflows-CKtzm8xW.js → workflows-BMlXKiaH.js} +1 -1
- package/web/dist/assets/{workspace-tools-Br4fSGhx.js → workspace-tools-CsrBXG_p.js} +1 -1
- package/web/dist/assets/{worktrees-section-TGAZ2n-T.js → worktrees-section-DvFx6o_A.js} +1 -1
- package/web/dist/index.html +1 -1
- package/web/dist/assets/activity-motion-BrtMWCAJ.js +0 -1
package/web/dist/assets/{use-hand-to-agent-state-DzPA14Gk.js → use-hand-to-agent-state-BHAhGcZe.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-CYWRnyM5.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-B0kvcFif.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-BvBqllk2.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,A as ke,F as Ae,G as je,H as Me,I as Ne,Jn as G,M as Pe,Mn as Fe,N as Ie,Nn as Le,P as Re,Q as ze,U as K,V as Be,W as Ve,X as He,Y as Ue,_n as We,bt as q,dr as Ge,j as Ke,jn as J,mn as qe,nt as Je,q as Ye,rt as Xe,tt as Ze}from"./index-DwDvloUQ.js";import{t as Qe}from"./markdown-jbBslIIT.js";import{t as $e}from"./textarea-vJt9undk.js";import{t as et}from"./diff-eQ6oM_Ti.js";import{t as Y}from"./change-counts-npLATh-3.js";import{t as tt}from"./tab-link-B0pNjKxZ.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,` (`,Le(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)(G,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":pt(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-card-edge bg-card p-4 shadow-card`,children:[(0,Z.jsx)(gt,{state:a,selectedMethod:g,overrideRules:d,mergeEnabled:ft(g,a,d),refreshPending:h.isPending,onRefresh:()=>h.mutate(c.githubMergeState(e)),onRunAgent:t,onConfirm:()=>u(!0),onMethodChange:s,onOverrideChange:m}),(0,Z.jsx)(_t,{number:e,state:a,selectedMethod:g,confirming:l,overrideRules:d,mergePending:y.isPending,mergeError:y.error,onOpenChange:u,onMerge:()=>y.mutate(v())})]}):(0,Z.jsx)(ht,{reason:dt(i.data)})}function yt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function bt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function xt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function St(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function Ct({label:e,color:t,plain:n=!1}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:St(t),className:n?`text-xs font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function wt(e){return e===`pr`?`pull request`:`issue`}function Tt(e,t,n){return e===`pr`&&!!(t||n)}function Et({backLink:e}){return e?(0,Z.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex 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)(J,{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:q(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,Z.jsx)(tt,{to:q(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,Z.jsx)(V,{to:q(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function 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)(Fe,{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)(G,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(G,{className:`h-14 w-full`}),(0,Z.jsx)(G,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-xs font-semibold tracking-wide text-muted-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Rt(i).map(e=>e.group===`commits`?(0,Z.jsx)(zt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(Xt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Vt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-muted-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Lt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Rt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function zt({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Bt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(Vt,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Bt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(J,{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)(J,{iso:e.createdAt,className:`shrink-0`}),e.url?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function 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)(Fe,{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)(J,{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}=We(),f=n.data?.defaultRunner,p=Ae(e.runner,i,f??i[0]??`claude`),m=n.data?.modelsLocked===!0,_=d(p,e.account),v=g(p,!0,_??u?.[p]),y=Re(m?null:e.model,p,r.data,n.data?.defaultModels,v.data),b=Ke(y,v.data);return{runner:p,runnerExplicit:e.runner!==null,model:y,effort:m?``:Ie(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:Ne(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=>qe(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=Pe(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)(je,{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=Ke(n,S.data);t({...e,model:n,effort:e.effort===null?null:Ie(e.effort,r)})},options:C.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:ke(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)(Ve,{fill:`model-pill`,children:s?[E,O,D]:[E,D,O]})})}):(0,Z.jsxs)(Ve,{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)(()=>Ze(_.data?.promptTemplates),[_.data?.promptTemplates]),ee=e=>{let t=j.current,n=Xe({prompt:k,base:D,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:M.current}),r=Oe(k,n,e);A(r.text),M.current=r.caret,requestAnimationFrame(()=>{j.current?.focus(),j.current?.setSelectionRange(r.caret,r.caret)})},P=ze(N,S.map(e=>e.id)),F=(0,X.useRef)(k);F.current=k;let I=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=Je(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=>{Ue({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)(Me,{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:He()}),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(Ye,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)(Be,{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(Ye,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-CYWRnyM5.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-B0kvcFif.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-BvBqllk2.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,A as ke,F as Ae,G as je,H as Me,I as Ne,Jn as G,M as Pe,Mn as Fe,N as Ie,Nn as Le,P as Re,Q as ze,U as K,V as Be,W as Ve,X as He,Y as Ue,_n as We,bt as q,dr as Ge,j as Ke,jn as J,mn as qe,nt as Je,q as Ye,rt as Xe,tt as Ze}from"./index-BZr8Y74X.js";import{t as Qe}from"./markdown-BRNtAZkY.js";import{t as $e}from"./textarea-vJt9undk.js";import{t as et}from"./diff-ByLut7n4.js";import{t as Y}from"./change-counts-npLATh-3.js";import{t as tt}from"./tab-link-B0pNjKxZ.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,` (`,Le(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)(G,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":pt(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-card-edge bg-card p-4 shadow-card`,children:[(0,Z.jsx)(gt,{state:a,selectedMethod:g,overrideRules:d,mergeEnabled:ft(g,a,d),refreshPending:h.isPending,onRefresh:()=>h.mutate(c.githubMergeState(e)),onRunAgent:t,onConfirm:()=>u(!0),onMethodChange:s,onOverrideChange:m}),(0,Z.jsx)(_t,{number:e,state:a,selectedMethod:g,confirming:l,overrideRules:d,mergePending:y.isPending,mergeError:y.error,onOpenChange:u,onMerge:()=>y.mutate(v())})]}):(0,Z.jsx)(ht,{reason:dt(i.data)})}function yt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function bt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function xt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function St(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function Ct({label:e,color:t,plain:n=!1}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:St(t),className:n?`text-xs font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function wt(e){return e===`pr`?`pull request`:`issue`}function Tt(e,t,n){return e===`pr`&&!!(t||n)}function Et({backLink:e}){return e?(0,Z.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex 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)(J,{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:q(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,Z.jsx)(tt,{to:q(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,Z.jsx)(V,{to:q(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function 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)(Fe,{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)(G,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(G,{className:`h-14 w-full`}),(0,Z.jsx)(G,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-xs font-semibold tracking-wide text-muted-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Rt(i).map(e=>e.group===`commits`?(0,Z.jsx)(zt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(Xt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Vt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-muted-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Lt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Rt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function zt({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Bt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(Vt,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Bt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(J,{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)(J,{iso:e.createdAt,className:`shrink-0`}),e.url?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function 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)(Fe,{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)(J,{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}=We(),f=n.data?.defaultRunner,p=Ae(e.runner,i,f??i[0]??`claude`),m=n.data?.modelsLocked===!0,_=d(p,e.account),v=g(p,!0,_??u?.[p]),y=Re(m?null:e.model,p,r.data,n.data?.defaultModels,v.data),b=Ke(y,v.data);return{runner:p,runnerExplicit:e.runner!==null,model:y,effort:m?``:Ie(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:Ne(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=>qe(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=Pe(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)(je,{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=Ke(n,S.data);t({...e,model:n,effort:e.effort===null?null:Ie(e.effort,r)})},options:C.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:ke(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)(Ve,{fill:`model-pill`,children:s?[E,O,D]:[E,D,O]})})}):(0,Z.jsxs)(Ve,{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)(()=>Ze(_.data?.promptTemplates),[_.data?.promptTemplates]),ee=e=>{let t=j.current,n=Xe({prompt:k,base:D,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:M.current}),r=Oe(k,n,e);A(r.text),M.current=r.caret,requestAnimationFrame(()=>{j.current?.focus(),j.current?.setSelectionRange(r.caret,r.caret)})},P=ze(N,S.map(e=>e.id)),F=(0,X.useRef)(k);F.current=k;let I=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=Je(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=>{Ue({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)(Me,{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:He()}),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(Ye,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)(Be,{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(Ye,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-CYWRnyM5.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-B0kvcFif.js";import{h as ne}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{J as re,L as m,S as h,X as ie,at as g,b as ae,c as oe,ft as _,i as se,l as v,lt as y,n as ce,ot as le,st as ue,tt as b,v as de,x}from"./design-icons-CzEoMH9c.js";import{t as S}from"./button-B7MKxYjT.js";import{i as fe,p as C,r as w,t as T}from"./dropdown-menu-4e2iKSMT.js";import{i as E,o as D,r as pe,s as O,t as k}from"./dialog-B531GGAo.js";import{i as A,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 j,Ht as M,Jt as N,Kt as be,Ut as P,Vt as F,Wt as I,Xn as L,qt as R,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-CYWRnyM5.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-B0kvcFif.js";import{h as ne}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{J as re,L as m,S as h,X as ie,at as g,b as ae,c as oe,ft as _,i as se,l as v,lt as y,n as ce,ot as le,st as ue,tt as b,v as de,x}from"./design-icons-CzEoMH9c.js";import{t as S}from"./button-B7MKxYjT.js";import{i as fe,p as C,r as w,t as T}from"./dropdown-menu-4e2iKSMT.js";import{i as E,o as D,r as pe,s as O,t as k}from"./dialog-B531GGAo.js";import{i as A,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 j,Ht as M,Jt as N,Kt as be,Ut as P,Vt as F,Wt as I,Xn as L,qt as R,w as xe}from"./index-BZr8Y74X.js";import{_ as z,a as Se,c as Ce,f as we,g as Te,h as Ee,i as De,m as B,n as Oe,o as ke,p as Ae,r as V,t as H,u as je}from"./sortable.esm-CAVTYaA3.js";import{t as U}from"./textarea-vJt9undk.js";var W=e(t(),1);function G(e){let t=[];for(let n of e){if(n.kind===`plugin`||n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.timeoutMs!==void 0||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Me(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function Ne(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function Pe(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function Fe(e,t){return e.filter((e,n)=>n!==t)}function K(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 q(e,t,n){let r=` `.repeat(n);return t.includes(`
|
|
2
2
|
`)?[`${r}${e}: |`,...t.split(`
|
|
3
3
|
`).map(e=>`${r} ${e}`)]:[`${r}${e}: ${K(t)}`]}function J(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${K(e.name)}`),e.skill&&t.push(` skill: ${K(e.skill)}`),t}function Y(e){let t=[];return e.model&&t.push(` model: ${K(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${K(e.effort)}`),e.runner&&t.push(` runner: ${K(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${K(e.agentProfile)}`),t}function X(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(K).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(K).join(`, `)}]`),t}function Z(e){return e.onFail?[` onFail:`,` retry: ${K(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function Ie(e){return[` - id: ${K(e.id)}`,...J(e),...e.prompt?q(`prompt`,e.prompt,4):[],...e.kind===`plugin`?[` kind: plugin`,` pluginKind: ${K(e.pluginKind)}`,...e.config===void 0?[]:[` config: ${JSON.stringify(e.config)}`]]:[],...Y(e),...X(e),...e.command?q(`command`,e.command,4):[],...Z(e)]}function Le(e,t,n){let r=[`name: ${K(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...q(`description`,t.trim(),0));let i=G(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${K(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...Ie(e))}else r.push(`skills: []`);return`${r.join(`
|
|
4
4
|
`)}\n`}function Re(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function ze(e){let t=G(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Be(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 Ve(e,t,n){let r=G(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var Q=n();function He({workflows:e,draft:t,trimmedName:n,nameRef:r,onDraft:i,onLoadWorkflow:a}){return(0,Q.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,Q.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex min-w-0 flex-col gap-1.5`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs font-medium text-foreground`,children:`Load an existing workflow`}),(0,Q.jsxs)(`div`,{className:`relative flex min-w-0 items-center`,children:[(0,Q.jsxs)(`select`,{id:`workflow-load`,value:e.some(e=>e.name===n)?n:``,onChange:t=>{let n=e.find(e=>e.name===t.target.value);n&&a(n)},className:`h-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,Q.jsx)(`option`,{value:``,disabled:!0,children:`Choose a workflow`}),e.map(e=>(0,Q.jsx)(`option`,{value:e.name,"data-slot":`wb-load-option`,"data-name":e.name,children:e.name},e.name))]}),(0,Q.jsx)(v,{"aria-hidden":`true`,className:`pointer-events-none absolute right-3 size-4 text-muted-foreground`})]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-medium text-foreground`,children:`Workflow name`}),(0,Q.jsx)(L,{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,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 @xl:col-span-2 @4xl:col-span-1`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-medium text-foreground`,children:`Description`}),(0,Q.jsx)(U,{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 Ue({savedFile:e,autoOpen:t,onImportToggle:n,onExport:r,onAutoToggle:i,onDeleteRequest:a}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-actions`,className:`grid grid-cols-[max-content_max-content] items-center justify-start gap-2 sm:flex sm:flex-wrap [&_button]:min-h-11 [&_button]:border [&_button]:border-border [&_button]:bg-card`,children:[(0,Q.jsxs)(S,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:n,children:[(0,Q.jsx)(ue,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,Q.jsxs)(S,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:r,children:[(0,Q.jsx)(ae,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,Q.jsxs)(S,{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,Q.jsx)(y,{"aria-hidden":`true`,className:`size-3`}),`Auto-build`]}),(0,Q.jsx)(`span`,{id:`wb-auto-hint`,className:`sr-only`,children:`Describe the chain in words and an agent drafts its steps for you to review.`}),e?(0,Q.jsxs)(S,{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,Q.jsx)(g,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function We({text:e,onTextChange:t,pending:n,onRun:r,onCancel:i}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] leading-relaxed text-muted-foreground`,children:`Describe the outcome. An agent proposes a title and ordered skill/check steps. Review the result, edit it, then Save.`}),(0,Q.jsx)(U,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),r())},className:`mt-4 min-h-[108px] bg-background p-4 text-sm`}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsxs)(S,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:n||e.trim()===``,onClick:r,children:[(0,Q.jsx)(y,{"aria-hidden":`true`,className:`size-3`}),n?`Building…`:`Build chain`]}),(0,Q.jsxs)(S,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:i,children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,Q.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function Ge({open:e,onOpenChange:t,text:n,onTextChange:r,error:i,pending:a,onRun:o,onCancel:s}){return(0,Q.jsx)(k,{open:e,onOpenChange:t,children:(0,Q.jsxs)(pe,{showCloseButton:!1,"data-slot":`wb-import-panel`,className:`max-md:translate-x-0 max-md:translate-y-0 sm:max-w-[660px] rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(O,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,Q.jsx)(E,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,Q.jsx)(U,{"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-CYWRnyM5.js";import{n as c}from"./toaster-B0kvcFif.js";import{n as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import"./tasks-table-k18AuMR5.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{On as _,Yn as v,Yt as y,Zn as b,qn 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-CYWRnyM5.js";import{n as c}from"./toaster-B0kvcFif.js";import{n as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import"./tasks-table-k18AuMR5.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{On as _,Yn as v,Yt as y,Zn as b,qn as x}from"./index-BZr8Y74X.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=y(e),r=T(e.name,t),i=_(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)(x,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`local`?(0,C.jsx)(b,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`clone`?(0,C.jsx)(v,{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-CYWRnyM5.js";import{Fn as a,Ir as o,Lr as s,P as c,hi as l,n as u}from"./toaster-B0kvcFif.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-BvBqllk2.js";import{t as m}from"./centered-state-V15AR_qo.js";import{fn as h,ir 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-CYWRnyM5.js";import{Fn as a,Ir as o,Lr as s,P as c,hi as l,n as u}from"./toaster-B0kvcFif.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-BvBqllk2.js";import{t as m}from"./centered-state-V15AR_qo.js";import{fn as h,ir as g}from"./index-BZr8Y74X.js";import{n as _,r as v,t as y}from"./remote-settings-notice-BFeWL9QB.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-CZNz3wYW.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(),g=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;h(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:g,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)(g,{}),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,g=e.worktreeRetention===(m?-1:s);return h(!g),(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:g&&!m&&!i.isPending,children:(0,w.jsx)(f,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-retention`,disabled:g||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-BZr8Y74X.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">
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Ht as i,Rt as a,Wt as o,Xt as s,ct as c,dn as l,q as u,rn as d,un as f}from"./queries-CYWRnyM5.js";import{En as p,Fn as m,Hr as h,In as g,Ln as _,Mn as v,Ot as ee,Ur as te,Wr as y,Zr as b,bn as x,br as S,er as ne,hi as C,ii as re,kn as w,n as T,ti as ie,tt as ae,zn as oe}from"./toaster-B0kvcFif.js";import{B as E,F as D,G as se,I as O,J as ce,N as k,P as le,S as ue,T as de,W as A,Y as fe,j,z as pe}from"./live-protocol-DMhTnCmf.js";import{n as M}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as me}from"./run-detail-refresh-BNI7eMgG.js";import{ft as he,t as ge}from"./design-icons-CzEoMH9c.js";import{t as _e}from"./createLucideIcon-BHp8sXmF.js";import{n as ve,o as ye,r as be}from"./review-panel-CLsVpcPr.js";import{t as xe}from"./arrow-right-Dh_Lx3um.js";import{t as Se}from"./arrow-up-right-DKGzsMqY.js";import{t as Ce}from"./bot-TkDIw4y-.js";import{t as we}from"./external-link-BE6y205O.js";import{t as Te}from"./info-DA1x_4bz.js";import{t as Ee}from"./message-square-B-MD-8rD.js";import{a as De,o as Oe,r as ke}from"./tool-display-B9NN44oU.js";import{t as N}from"./button-B7MKxYjT.js";import{i as Ae,r as je,t as Me}from"./popover-CZV6tz9i.js";import{t as P}from"./project-router-BvBqllk2.js";import"./attention-CGsbqL2t.js";import{t as F}from"./status-dot-BRzVlF2X.js";import{c as Ne,i as Pe,l as Fe,o as Ie,r as Le,s as Re}from"./report-selection-D2RvkiGX.js";import"./page-shell-7pLJMOgh.js";import{Qt as ze,Sn as Be}from"./index-DwDvloUQ.js";import{t as Ve}from"./textarea-vJt9undk.js";var He=_e(`folder-kanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),I=e(t(),1),L=n(),R=fe(),z=pe().int().nonnegative(),B=A().min(1),Ue=E({title:A().max(160),toolKind:j([`read`,`edit`,`delete`,`move`,`search`,`execute`,`think`,`fetch`,`task`,`plan`,`other`]),status:j([`pending`,`running`,`completed`,`failed`,`declined`]),startedAt:R,endedAt:R.optional()}).strict(),We=j([`pass`,`fail`,`pending`,`skipping`,`cancel`]),Ge=E({checks:k(E({name:A().max(100),bucket:We}).strict()).max(100),counts:E({pass:z,fail:z,pending:z,skipping:z,cancel:z}).strict(),truncated:O(!0).optional()}).strict(),Ke=D(`kind`,[E({kind:O(`human`),since:R,detail:E({question:A().max(500).optional(),reason:j([`question`,`turn-end`,`budget`,`completion`]),queuedMessages:pe().int().positive().optional()}).strict()}).strict(),E({kind:O(`usage-limit`),detail:E({resumeAt:A()}).strict()}).strict(),E({kind:O(`workers`),since:R,deadline:R.optional(),detail:E({owed:z,total:z,settled:z,replies:O(!0).optional(),mode:ue.optional(),recipientRunIds:k(B)}).strict()}).strict(),E({kind:O(`peers`),since:R,deadline:R,detail:E({peerRunIds:k(B)}).strict()}).strict(),E({kind:O(`subagents`),since:R,deadline:R,detail:E({running:z}).strict()}).strict(),E({kind:O(`pr`),since:R,deadline:R,detail:E({number:pe().int().positive(),target:ne,checks:Ge.shape.checks.optional(),counts:Ge.shape.counts.optional(),truncated:O(!0).optional()}).strict()}).strict(),E({kind:O(`process`),since:R,deadline:R,detail:E({pid:pe().int(),note:A().optional()}).strict()}).strict(),E({kind:O(`plugin`),since:R,deadline:R.optional(),detail:E({pluginKind:A().min(1).max(64),summary:A().max(256)}).strict()}).strict(),E({kind:O(`timer`),since:R,deadline:R,detail:E({wakeAt:R,note:A().optional()}).strict()}).strict()]),qe={runId:B,title:A(),status:S,rung:j(p),runner:ie.optional(),model:A().optional(),currentStepId:A().optional(),createdAt:A().optional(),startedAt:A().optional(),finishedAt:A().optional(),wait:Ke.optional(),tool:Ue.optional(),rate:k(z).length(30),error:A().max(200).optional()},Je=E({...qe,revision:z,collected:le()}).strict(),Ye=E({...qe,workers:k(Je)}).strict(),Xe=E({requestId:ce(),relationship:j([`family`,`peer`]),senderRunId:B,recipientRunId:B,text:A().max(500),senderTitle:A().optional(),recipientTitle:A().optional(),createdAt:R,deadline:R.optional()}).strict(),Ze=E({requestId:ce(),senderRunId:B,recipientRunId:B,status:de.shape.status,observedAt:R}).strict(),Qe=E({generatedAt:R,projects:k(E({projectId:A(),name:A(),loaded:le(),unavailable:E({status:se([O(404),O(409),O(503)]),error:A()}).strict().optional(),inReview:z,tasks:k(Ye),requests:k(Xe),closed:k(Ze)}).strict())}).strict();E({project:se([O(`default`),A().regex(x)]).optional()});var $e=5e3,et=e=>[`workspace`,`activity`,e.kind===`project`?e.projectId:null],tt=e=>e.kind===`project`?`activity:project:${e.projectId}`:`activity:workspace`,nt=e=>e.kind===`project`?`/api/v1/workspace/activity?project=${encodeURIComponent(e.projectId)}`:`/api/v1/workspace/activity`,rt=`the Squawk server answered /workspace/activity with an unexpected body`;function it(e){let t=Qe.safeParse(e);if(!t.success)throw new m(200,rt);return t.data}async function at(e,t){let n=e.kind===`project`?{project:e.projectId}:{};return it(await oe(await g.api.v1.workspace.activity.$get({query:n},_(t)),`/workspace/activity`))}function ot(e,t){return e!==void 0&&Date.parse(t.generatedAt)<Date.parse(e.generatedAt)?e:t}var st=new Date(0).toISOString();function ct(e){return e!==void 0&&e!==st&&!Number.isNaN(Date.parse(e))}var lt=new Set([404,409,503]);function ut(e,t,n,r){let i=e?.projects.find(e=>e.projectId===t)?.name??t;return{generatedAt:e?.generatedAt??st,projects:[{projectId:t,name:i,loaded:!0,unavailable:{status:n,error:r},inReview:0,tasks:[],requests:[],closed:[]}]}}function dt(e,t){return new m(Number(/^HTTP (\d+)$/.exec(t)?.[1]??0),e&&typeof e==`object`&&typeof e.error==`string`?e.error:t)}var ft=(e,t)=>e.kind===`project`&<.has(t.status)?t.status:void 0;function pt(e){let t=e.kind===`project`?e.projectId:void 0,n=(0,I.useMemo)(()=>t===void 0?{kind:`workspace`}:{kind:`project`,projectId:t},[t]),r=(0,I.useMemo)(()=>et(n),[n]),o=C(),s=re({queryKey:r,queryFn:async({signal:e})=>{let t=o.getQueryData(r);try{return ot(t,await at(n,{signal:e}))}catch(e){let r=e instanceof m?ft(n,e):void 0;if(r===void 0||n.kind!==`project`)throw e;return ut(t,n.projectId,r,e.message)}},staleTime:1/0});return(0,I.useEffect)(()=>{let e=!0,t=t=>{o.cancelQueries({queryKey:r,exact:!0}).then(()=>{if(!e)return;let i=ft(n,t);if(i!==void 0&&n.kind===`project`){o.setQueryData(r,e=>ut(e,n.projectId,i,t.message));return}let a=o.getQueryCache().find({queryKey:r,exact:!0});a?.setState({status:`error`,error:t,errorUpdatedAt:Date.now(),errorUpdateCount:a.state.errorUpdateCount+1,fetchStatus:`idle`})})},s=n=>{let i;try{i=it(n)}catch(e){t(e);return}o.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&o.setQueryData(r,e=>ot(e,i))})},l=a(tt(n),s),u=i($e),d,f=()=>{let e=h()===`finite`&&u!==!1;e&&!d?d=c({path:nt(n),intervalMs:u},(e,n)=>{n===void 0?s(e):t(dt(e,n))}):!e&&d&&(d(),d=void 0)};f();let p=y(f);return()=>{e=!1,p(),d?.(),l()}},[o,r,n]),s}var mt=e=>String(e).padStart(2,`0`);function V(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t/60)%60,i=t%60;return n>0?`${n}:${mt(r)}:${mt(i)}`:`${r}:${mt(i)}`}function H(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);if(r>=24)return`${Math.floor(r/24)}d`;let i=n%60;return r<6&&i>0?`${r}h ${i}m`:`${r}h`}function U(e,t){let n=e===void 0?NaN:Date.parse(e);return Number.isNaN(n)?0:t-n}var ht=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function W(e){let t=Date.parse(e);return Number.isNaN(t)?e:ht.format(t)}var gt=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`}),_t=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`});function G(e){let t=typeof e==`number`?e:Date.parse(e);return Number.isNaN(t)?String(e):`${gt.format(t)}, ${_t.format(t)} ${yt()}`}function vt(e){let t=Math.max(0,Math.floor(e/1e3));return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function yt(){return Intl.DateTimeFormat().resolvedOptions().timeZone}var bt=new Set([`queued`,`running`,`waiting`]),xt={review:`Needs review`,failed:`Failed`,done:`Done`,cancelled:`Cancelled`},St={review:`review`,failed:`failed`,done:`done`,cancelled:`cancelled`},K=e=>bt.has(e),Ct=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,q=e=>w(e.rung).tone,wt=(e,t=`Deadline`)=>e?`${t} ${W(e)}`:void 0;function Tt(e,t,n){return t.length===1&&t[0]!==void 0?`${e} ${n.titleOf(t[0])}`:`${e} ${Ct(t.length,`task`)}`}function Et(e,t){let n=e.tool,r={verb:`Running`,tone:q(e),icon:`tool`},i=n?.endedAt!==void 0&&U(n.endedAt,t.now)>1e4;if(n===void 0)return{...r,main:`Thinking`,...e.startedAt?{since:e.startedAt}:{}};let a=`Last tool ${H(U(n.endedAt??n.startedAt,t.now))} ago`;return i?{...r,main:`Thinking`,detail:a,since:n.endedAt??n.startedAt}:{...r,main:n.title,mono:!0,detail:a,since:n.startedAt}}function Dt(e,t){let n={verb:`Needs you`,tone:q(e),icon:`user`,...t?{since:t.since}:{}};if(t?.detail.reason===`question`)return t.detail.question?{...n,main:t.detail.question,action:`answer`}:{...n,main:`Your turn`,action:`answer`};if(t?.detail.reason===`budget`){let e=t.detail.queuedMessages;return{...n,main:e?`Automatic wakes used up · ${Ct(e,`message`)} queued`:`Automatic wakes used up`,action:`open`}}return{...n,main:`Your turn`,action:`open`}}function Ot(e){return{verb:`Needs permission`,tone:q(e),icon:`user`,main:`Approval required`,action:`open`}}function kt(e,t,n){let{owed:r,total:i,settled:a,replies:o,mode:s,recipientRunIds:c}=t.detail,l=i>0?a/i:0,u={tone:q(e),since:t.since};if(o){let e=c.length>0?Tt(`From`,c,n):`Waiting for replies`;return{...u,verb:`Waiting for reply`,icon:`reply`,main:e,...J(`detail`,wt(t.deadline,`Reply due`))}}let d=c.length>0?`${r} owed · ${a} settled`:s?`${At[s]} of ${i} · ${a} settled`:`${r} owed`;return{...u,verb:`Waiting for workers`,icon:`workers`,main:d,bar:l,...J(`detail`,wt(t.deadline))}}var At={one:`One`,any:`Any`,all:`All`};function jt(e){let t=e.detail.counts;if(t===void 0)return`PR ${e.detail.number} checks`;let n=t.pass+t.fail+t.pending;return`PR ${e.detail.number} checks · ${t.pass} of ${n} passed`}var Mt=[`fail`,`pending`,`pass`,`skipping`,`cancel`];function Nt(e){let{counts:t,checks:n=[],truncated:r}=e.detail;if(!r||t===void 0)return;let i=e=>Math.max(0,t[e]-n.filter(t=>t.bucket===e).length),a=Mt.reduce((e,t)=>e+i(t),0),o=Mt.find(e=>i(e)>0);return a>0&&o?{count:a,bucket:o}:void 0}var Pt=[[`pass`,`passed`],[`fail`,`failed`],[`pending`,`pending`],[`skipping`,`skipped`],[`cancel`,`cancelled`]];function Ft(e){let{counts:t,checks:n}=e.detail,r=e=>t?t[e]:(n??[]).filter(t=>t.bucket===e).length,i=Pt.filter(([e])=>r(e)>0).map(([e,t])=>`${r(e)} ${t}`),a=Nt(e);return a&&i.push(`+${a.count} more not listed`),i.length>0?i.join(`, `):void 0}function It(e,t){let n={tone:q(e),since:t.since,...J(`detail`,wt(t.deadline))};if(t.detail.target!==`checks`)return{...n,verb:`Waiting for merge`,icon:`merge`,main:`PR ${t.detail.number}`};let r=t.detail.checks?[...t.detail.checks].sort((e,t)=>e.name.localeCompare(t.name)):void 0;return{...n,verb:`Waiting for CI`,icon:`ci`,main:jt(t),...J(`checks`,r),...J(`overflow`,Nt(t)),...J(`checkSummary`,Ft(t))}}function J(e,t){return t===void 0?{}:{[e]:t}}function Lt(e,t,n){let r=q(e);switch(t.kind){case`workers`:return kt(e,t,n);case`peers`:return{verb:`Waiting for a peer`,tone:r,icon:`peer`,since:t.since,main:Tt(`For`,t.detail.peerRunIds,n),detail:`Deadline ${W(t.deadline)}`};case`subagents`:return{verb:`Waiting for subagents`,tone:r,icon:`subagents`,since:t.since,main:Ct(t.detail.running,`native subagent`),detail:`Deadline ${W(t.deadline)}`};case`pr`:return It(e,t);case`process`:return{verb:`Waiting for command`,tone:r,icon:`command`,since:t.since,main:t.detail.note??`Process ${t.detail.pid}`,detail:`Running ${V(U(t.since,n.now))} · deadline ${W(t.deadline)}`};case`plugin`:return{verb:`Waiting`,tone:r,icon:`timer`,since:t.since,main:t.detail.summary,...J(`detail`,wt(t.deadline))};case`timer`:return{verb:`Monitoring`,tone:r,icon:`timer`,since:t.since,main:t.detail.note??`Timer`,detail:`Wakes ${W(t.detail.wakeAt)} · in ${V(-U(t.detail.wakeAt,n.now))}`};case`usage-limit`:return Rt(e,t.detail.resumeAt,n);case`human`:return}}function Rt(e,t,n){let r=Date.parse(t),i=Number.isNaN(r)?`Resumes ${t}`:`Resumes ${W(t)} · in ${V(r-n.now)}`;return{verb:`Usage limit`,tone:q(e),icon:`pause`,main:`Paused until reset`,detail:i}}function zt(e,t){let n=e.wait&&`since`in e.wait?e.wait.since:e.startedAt;return{verb:`Queued`,tone:q(e),icon:`queued`,main:`Waiting for a free slot`,...n?{since:n,detail:`Waiting ${H(U(n,t.now))}`}:{}}}function Bt(e,t){return{verb:xt[e.status]??e.status,tone:q(e),icon:St[e.status]??`done`,main:t}}function Vt(e,t){return K(e.status)?Ht(e,t):Bt(e,Ct(e.workers.filter(e=>K(e.status)).length,`live worker`))}function Ht(e,t){let n=e.wait;switch(e.rung){case`running`:return Et(e,t);case`needs-permission`:return Ot(e);case`needs-you`:return Dt(e,n?.kind===`human`?n:void 0);case`usage-limit`:return n?.kind===`usage-limit`?Rt(e,n.detail.resumeAt,t):{verb:`Usage limit`,tone:q(e),icon:`pause`,main:`Paused until reset`};case`queued`:case`waiting-for-capacity`:return zt(e,t);default:return(n&&Lt(e,n,t))??zt(e,t)}}function Ut(e,t,n){if(n!==void 0&&K(e.status))return{verb:`Asks parent`,tone:q(e),main:`“${n}”`,asks:!0};let r=Wt(e,t);return{verb:r.verb,tone:r.tone,main:r.main,...r.mono?{mono:!0}:{}}}function Wt(e,t){switch(e.status){case`done`:return Bt(e,e.collected?`Collected`:`Ready to collect`);case`review`:return Bt(e,`Waiting for the parent’s review`);case`failed`:case`cancelled`:return Bt(e,e.error??xt[e.status]??e.status);default:return Ht({...e,workers:[]},t)}}var Gt={success:`text-semantic-green`,pending:`text-semantic-amber`,danger:`text-semantic-red`,accent:`text-accent-text`,info:`text-semantic-info`,running:`text-semantic-violet`,neutral:`text-muted-foreground`};function Kt({tone:e,className:t,children:n,...i}){return(0,L.jsx)(`span`,{...i,className:r(`bg-card-2`,{"text-semantic-green":e===`success`,"text-semantic-amber":e===`pending`,"text-semantic-red":e===`danger`,"text-accent-text":e===`accent`,"text-semantic-info":e===`info`,"text-semantic-violet":e===`running`,"text-muted-foreground":e===`neutral`},t),children:n})}var qt={success:`border-success`,pending:`border-pending-strong`,danger:`border-danger`,accent:`border-accent-strong`,info:`border-info`,running:`border-status-running`,neutral:`border-soft-foreground`},Jt={success:`bg-success`,pending:`bg-pending-strong`,danger:`bg-danger`,accent:`bg-accent-strong`,info:`bg-info`,running:`bg-status-running`,neutral:`bg-soft-foreground`};function Yt(e,t){let n=w(e.rung),r=e.rung===`waiting-on-workers`&&(t===`worker`||e.wait?.kind===`peers`);return{tone:n.tone,shape:r?`ring`:n.shape,label:Qt(e,t)??Be(e.rung,n.label)}}var Xt=(e,t,n)=>`${e} ${t} ${n}${t===1?``:`s`}`;function Zt(e){return e?.kind===`workers`&&!e.detail.replies&&e.detail.owed>0}function Qt(e,t){let n=e.wait;if(e.rung===`waiting-on-workers`){if(t===`worker`&&!Zt(n))return`Waiting for parent reply`;if(n?.kind===`peers`&&n.detail.peerRunIds.length>0)return Xt(`Waiting for`,n.detail.peerRunIds.length,`task`);if(n?.kind===`workers`&&n.detail.replies)return`Waiting for replies`;if(n?.kind===`workers`&&n.detail.owed>0)return Xt(`Waiting for`,n.detail.owed,`worker`)}if(e.rung===`waiting-on-subagents`&&n?.kind===`subagents`&&n.detail.running>0)return Xt(`Waiting for`,n.detail.running,`subagent`)}function $t(e,t){if(K(e.status))return e.rung===`running`&&t===`filled`?`activity-pulse`:t===`filled`?void 0:`activity-breathe`}function en({run:e,role:t}){let{tone:n,shape:i,label:a}=Yt(e,t);return(0,L.jsx)(`span`,{"data-activity-anchor":e.runId,className:r(`inline-flex size-[12px] shrink-0 items-center justify-center`,$t(e,i)),children:(0,L.jsx)(F,{tone:n,shape:i,role:`img`,"aria-label":a})})}var tn={pass:`bg-success`,fail:`bg-danger`,pending:`bg-pending`,skipping:`border border-soft-foreground`,cancel:`border border-soft-foreground`},nn=(e,t)=>t?`activity-check-pass`:e===`pending`?`activity-breathe-fast`:void 0;function rn({checks:e,overflow:t,passed:n,className:i}){return(0,L.jsxs)(`span`,{"data-slot":`activity-checks`,"aria-hidden":`true`,className:i??r(`col-start-2 mt-[5px] flex items-center`,e.length>40?`gap-px`:`gap-[3px]`),children:[e.map(e=>(0,L.jsx)(`i`,{"data-bucket":e.bucket,"data-passed":n.has(e.name)?`true`:void 0,title:e.name,className:r(`h-[5px] min-w-px flex-1 rounded-[2px]`,tn[e.bucket],nn(e.bucket,n.has(e.name)))},e.name)),t?(0,L.jsxs)(`span`,{"data-slot":`activity-checks-overflow`,"data-bucket":t.bucket,className:`ml-1 flex shrink-0 items-center gap-1 text-xs leading-none text-muted-foreground tabular-nums`,children:[(0,L.jsx)(`i`,{className:r(`h-[5px] w-2 rounded-[2px]`,tn[t.bucket])}),`+`,t.count]}):null]})}function an({rate:e,className:t}){let n=e.reduce((e,t)=>e+t,0),i=Math.max(4,...e);return(0,L.jsxs)(`svg`,{"data-slot":`activity-heartbeat`,role:`img`,"aria-label":`${n} tool call${n===1?``:`s`} in the last ${e.length} s`,viewBox:`0 0 62 16`,className:r(`block h-4 w-[62px] shrink-0`,t),children:[n>0?(0,L.jsx)(`path`,{d:`M0 15.5h62`,className:`stroke-border`}):null,e.map((e,t)=>{if(e<=0)return null;let n=Math.max(1.5,e/i*14);return(0,L.jsx)(`rect`,{x:t*2.07,y:15-n,width:1.4,height:n,className:`fill-status-running`},t)})]})}var on=`inline-flex min-w-0 items-center rounded-md border px-3 py-1 text-[12px] font-medium focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring max-md:min-h-11`;function sn({scope:e,projectId:t,projectName:n}){let i=e=>r(on,e?`border-border bg-card text-foreground shadow-xs`:`border-transparent text-muted-foreground hover:text-foreground`);return(0,L.jsxs)(`nav`,{"aria-label":`Activity scope`,"data-slot":`activity-scope`,className:`inline-flex max-w-full rounded-lg border border-border bg-muted/60 p-1`,children:[t===null?null:(0,L.jsx)(M,{to:`/p/${encodeURIComponent(t)}/activity`,"aria-current":e===`project`?`page`:void 0,className:i(e===`project`),children:(0,L.jsx)(`span`,{className:`max-w-40 truncate`,title:n??t,children:n??t})}),(0,L.jsx)(M,{to:`/activity`,state:{activityProjectId:t},"aria-current":e===`all`?`page`:void 0,className:i(e===`all`),children:`All projects`})]})}function cn({grouped:e,onToggle:t}){return(0,L.jsxs)(`button`,{type:`button`,"data-slot":`activity-group-toggle`,"aria-pressed":e,onClick:t,className:r(`inline-flex h-9 items-center gap-1.5 rounded-lg border px-2.5 text-[12px] font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 pointer-coarse:min-h-11`,e?`border-accent-text/60 bg-accent-strong/10 text-foreground`:`border-border bg-card text-muted-foreground hover:text-foreground`),children:[(0,L.jsx)(He,{"aria-hidden":`true`,className:`size-3.5`}),(0,L.jsx)(`span`,{children:`Group by project`})]})}function ln(){let e=`flex items-center gap-2`;return(0,L.jsxs)(Me,{children:[(0,L.jsx)(Ae,{asChild:!0,children:(0,L.jsxs)(`button`,{type:`button`,"data-slot":`activity-legend`,"aria-label":`Activity legend`,className:`inline-flex h-9 items-center gap-1.5 rounded-lg border border-border bg-card px-2.5 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 pointer-coarse:min-h-11`,children:[(0,L.jsx)(Te,{"aria-hidden":`true`,className:`size-3.5`}),(0,L.jsx)(`span`,{children:`Legend`})]})}),(0,L.jsx)(je,{align:`end`,className:`w-80 text-[12px] text-muted-foreground`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(`p`,{className:`text-xs font-semibold tracking-[0.05em] text-foreground uppercase`,children:`Activity legend`}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsx)(F,{tone:`pending`,"aria-hidden":`true`}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`strong`,{className:`text-foreground`,children:`Needs answer`}),` — waiting for your reply`]})]}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsx)(F,{tone:`info`,"aria-hidden":`true`}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`strong`,{className:`text-foreground`,children:`Needs review`}),` — ready for diff review or PR`]})]}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsx)(F,{tone:`danger`,"aria-hidden":`true`}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`strong`,{className:`text-foreground`,children:`Failed`}),` — stopped with an error`]})]}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsx)(F,{tone:`running`,"aria-hidden":`true`}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`strong`,{className:`text-foreground`,children:`Working`}),` — running tools right now`]})]}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsx)(F,{tone:`info`,shape:`ring`,"aria-hidden":`true`}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`strong`,{className:`text-foreground`,children:`Ring`}),` — waiting on CI, peer, or timer`]})]}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsx)(F,{tone:`running`,shape:`workers`,"aria-hidden":`true`}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`strong`,{className:`text-foreground`,children:`Robot`}),` — waiting on its own workers`]})]}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsx)(an,{rate:[0,2,5,1,3,0,4,2],className:`w-[34px]`}),(0,L.jsx)(`span`,{children:`Heartbeat: tool calls, last 30 s`})]}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,L.jsx)(`path`,{d:`M2 5h30`,strokeWidth:2,strokeDasharray:`6 4`,className:`stroke-message-peer-accent`})}),(0,L.jsx)(`span`,{children:`Open peer request (task → task)`})]}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:[(0,L.jsx)(`path`,{d:`M2 5h24`,strokeWidth:2.2,strokeLinecap:`round`,strokeDasharray:`0 6`,className:`stroke-message-peer-accent opacity-80`}),(0,L.jsx)(`circle`,{cx:`29.5`,cy:`5`,r:`3`,strokeWidth:1.6,className:`fill-card stroke-message-peer-accent`})]}),(0,L.jsx)(`span`,{children:`Waiting for a peer to write`})]})]})})]})}function un({scope:e,projectId:t,projectName:n,grouped:r,onToggleGroup:i}){return(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(ln,{}),i?(0,L.jsx)(cn,{grouped:!!r,onToggle:i}):null,(0,L.jsx)(sn,{scope:e,projectId:t,projectName:n})]})}function dn({now:e,updatedAt:t,stale:n}){let i=t!==void 0&&!Number.isNaN(Date.parse(t));return(0,L.jsxs)(`span`,{"data-slot":`activity-clock`,"data-stale":n?`true`:void 0,title:G(e),className:`inline-flex items-center gap-1.5 text-[13px] text-muted-foreground tabular-nums`,children:[(0,L.jsx)(`span`,{"data-tone":`success`,className:r(`inline-flex size-[12px] items-center justify-center`,!n&&`activity-pulse`),children:(0,L.jsx)(F,{tone:n?`neutral`:`success`,"aria-hidden":`true`})}),(0,L.jsx)(`b`,{className:r(`font-semibold`,n?`text-muted-foreground`:`text-success`),children:n?`Not updating`:`Live`}),i?(0,L.jsxs)(`span`,{children:[`· updated `,vt(U(t,e))]}):null]})}function fn({name:e,now:t,updatedAt:n,stale:r=!1,scopeSwitch:i}){return{title:`Activity`,scope:e,subtitle:t===void 0?void 0:(0,L.jsx)(dn,{now:t,updatedAt:n,stale:r}),secondaryActions:i}}function pn({primary:e=!1}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(N,{variant:e?`primary`:`outline`,size:`sm`,asChild:!0,className:`h-auto min-h-8 py-1.5 max-md:min-h-11`,children:(0,L.jsx)(P,{to:`/new`,children:`New task`})}),(0,L.jsx)(N,{variant:`outline`,size:`sm`,asChild:!0,className:`h-auto min-h-8 py-1.5 max-md:min-h-11`,children:(0,L.jsx)(P,{to:`/`,children:`View tasks`})})]})}function mn({value:e,bump:t}){return(0,L.jsx)(`strong`,{"data-bump":t===void 0?void 0:`true`,className:r(`font-semibold text-foreground tabular-nums`,t!==void 0&&`activity-bump`),children:e},t??`still`)}function Y({icon:e,count:t,label:n,bump:r}){return(0,L.jsxs)(`li`,{"data-slot":`activity-chip`,"data-chip":n,className:`inline-flex items-center gap-[7px] rounded-full border border-card-edge bg-card px-[11px] py-[5px] text-xs text-muted-foreground shadow-card`,children:[e,(0,L.jsx)(mn,{value:t,bump:r}),` `,n]})}function hn({summary:e,tasksTo:t,bumps:n={}}){let r=e=>n[e]?.key;return(0,L.jsxs)(`ul`,{"data-slot":`activity-summary`,"aria-live":`polite`,"aria-label":`Summary`,className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(Y,{icon:(0,L.jsx)(F,{tone:`pending`,"aria-hidden":`true`}),count:e.needsYou,label:`Needs you`,bump:r(`needsYou`)}),(0,L.jsx)(Y,{icon:(0,L.jsx)(F,{tone:`running`,"aria-hidden":`true`}),count:e.working,label:`Working`,bump:r(`working`)}),(0,L.jsx)(Y,{icon:(0,L.jsx)(F,{tone:`running`,shape:`ring`,"aria-hidden":`true`}),count:e.waiting,label:`Waiting`,bump:r(`waiting`)}),(0,L.jsx)(Y,{icon:(0,L.jsx)(F,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),count:e.queued,label:`Queued`,bump:r(`queued`)}),(0,L.jsx)(Y,{icon:(0,L.jsx)(Ce,{"aria-hidden":`true`,className:`size-3.5`}),count:e.activeWorkers,label:`Active workers`,bump:r(`activeWorkers`)}),(0,L.jsx)(Y,{icon:(0,L.jsx)(Ee,{"aria-hidden":`true`,className:`size-3.5 text-message-peer-accent`}),count:e.openRequests,label:`Open requests`,bump:r(`openRequests`)}),(0,L.jsx)(`li`,{"data-slot":`activity-chip`,"data-chip":`Needs review`,children:(0,L.jsxs)(P,{to:t,className:`inline-flex items-center gap-[7px] rounded-full border border-card-edge bg-card px-[11px] py-[5px] text-xs text-muted-foreground shadow-card transition-colors hover:border-accent-text/40 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`,children:[(0,L.jsx)(F,{tone:`info`,"aria-hidden":`true`}),(0,L.jsx)(mn,{value:e.inReview,bump:r(`inReview`)}),` Needs review`,(0,L.jsx)(Se,{"aria-hidden":`true`,className:`size-3 text-soft-foreground`})]})})]})}function gn(e){if(e.unavailable)return e.unavailable.error;if(!e.loaded)return`Not loaded in this cockpit`}function _n(e){let t=new Map;for(let n of e.tasks){t.set(n.runId,{title:n.title,cardId:n.runId,role:`root`});for(let e of n.workers)t.set(e.runId,{title:e.title,cardId:n.runId,role:`worker`})}return t}function X(e,t,n){return e.get(t)?.title??n??`Unreadable task`}var vn=(e,t)=>X(e,t.senderRunId,t.senderTitle),yn=(e,t)=>X(e,t.recipientRunId,t.recipientTitle),bn=(e,t)=>`wait:${e}:${t}`;function Z(e){let t=[];for(let n of e){let e=n.wait;if(!(!K(n.status)||e?.kind!==`peers`))for(let r of new Set(e.detail.peerRunIds))r!==n.runId&&t.push({id:bn(n.runId,r),waiterRunId:n.runId,peerRunId:r,since:e.since,deadline:e.deadline})}return t}function xn(e,t){let n=new Set;for(let r of t)r.waiterRunId===e&&n.add(r.peerRunId),r.peerRunId===e&&n.add(r.waiterRunId);return n}function Sn(e,t){return t.filter(t=>t.waiterRunId===e)}function Cn(e,t,n,r=[]){let i=[];for(let r of t)r.senderRunId===e&&i.push(`Waiting for a reply from ${yn(n,r)}`),r.recipientRunId===e&&i.push(`${vn(n,r)} waits for your reply`);for(let t of r)t.waiterRunId===e&&i.push(`Waiting for a message from ${X(n,t.peerRunId)}`),t.peerRunId===e&&i.push(`${X(n,t.waiterRunId)} waits for you to write`);return i}function wn(e,t,n){return n.find(n=>n.relationship===`family`&&n.senderRunId===e&&n.recipientRunId===t)}function Tn(e,t){let n=-U(e,t);return n>=1e3?`reply due in ${V(n)}`:`reply overdue`}function En(e,t){return t.filter(t=>t.relationship===`peer`&&t.senderRunId===e)}function Dn(e,t){return e.relationship===`peer`?{kind:`Request`,relation:`Peer`}:{kind:`Question`,relation:On[kn(e,t)]}}var On={worker:`Worker → parent`,parent:`Parent → worker`,unknown:`Family`};function kn(e,t){let n=t.get(e.senderRunId)?.role;if(n)return n===`worker`?`worker`:`parent`;let r=t.get(e.recipientRunId)?.role;return r?r===`root`?`worker`:`parent`:`unknown`}var An=new Set([`queued`,`waiting-for-capacity`]);function jn(e){if(K(e.status))return v(e.rung)?`needsYou`:e.rung===`running`?`working`:An.has(e.rung)?`queued`:`waiting`}function Mn(e){let t={needsYou:0,working:0,waiting:0,queued:0,activeWorkers:0,openRequests:0,inReview:0};for(let n of e){t.inReview+=n.inReview,t.openRequests+=n.requests.length;for(let e of n.tasks){let n=jn(e);n&&(t[n]+=1),t.activeWorkers+=e.workers.filter(e=>K(e.status)).length}}return t}function Nn(e,t=()=>!1){let n=0,r=0;for(let i of e.workers)t(i.runId)||((i.status===`done`||i.status===`cancelled`)&&(n+=1),i.status===`failed`&&(n+=1,r+=1));return{finished:n,failed:r}}function Pn({finished:e,failed:t}){if(e!==0)return t>0?`✓ ${e} finished · ${t} failed`:`✓ ${e} worker${e===1?``:`s`} finished`}var Q={flash:1300,cardEnter:700,cardLeave:500,workerEnter:700,workerHold:3e3,workerFold:500,comet:1100,replied:900,fade:800,bump:500,slide:450,check:800},$={flash:{},entering:{},leaving:{},workerEnter:{},workerHold:{},opening:{},closing:{},waitsClosing:{},comets:{},bumps:{},slides:{},checks:{}},Fn=(e,t)=>`${e}\n${t}`;function In(e,t){let n=Fn(t,``);return new Set(Object.keys(e.checks).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length)))}var Ln=class{key;changes=[];timers=[];constructor(e){this.key=e}timed(e,t,n,r){this.changes.push({field:e,id:t,value:{...n,key:this.key}}),this.timers.push({after:r,change:{field:e,id:t,ifKey:this.key}})}later(e,t,n,r){this.timers.push({after:r,change:{field:e,id:t,value:{...n,key:this.key},ifKey:this.key}})}drop(e,t){this.changes.push({field:e,id:t})}},Rn={done:`success`,review:`success`,failed:`danger`,cancelled:`neutral`};function zn(e,t){let n=Rn[t.status]??`success`;if(t.status===`review`){e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},Q.flash);return}e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},Q.workerHold+Q.workerFold),e.later(`workerHold`,t.runId,{tone:n,phase:`fold`},Q.workerHold)}function Bn(e,t){e.drop(`closing`,t.requestId),e.timed(`opening`,t.requestId,{},Q.fade),e.timed(`comets`,`${t.requestId}:open:${e.key}`,{requestId:t.requestId,reverse:!1,tone:t.relationship},Q.comet)}function Vn(e,t,n,r){let i=n.requestId;if(e.drop(`opening`,i),!r){e.timed(`closing`,i,{projectId:t,request:n,replied:!1,phase:`fade`},Q.fade);return}let a=Q.comet+Q.replied+Q.fade;e.timed(`closing`,i,{projectId:t,request:n,replied:!0,phase:`reply`},a),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`replied`},Q.comet),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`fade`},Q.comet+Q.replied),e.timed(`comets`,`${i}:reply:${e.key}`,{requestId:i,reverse:!0,tone:`success`},Q.comet)}function Hn(e,t){switch(t.kind){case`rung-changed`:return e.timed(`flash`,t.task.runId,{tone:w(t.task.rung).tone},Q.flash);case`tool-started`:return e.timed(`slides`,t.runId,{},Q.slide);case`worker-started`:return e.timed(`workerEnter`,t.worker.runId,{},Q.workerEnter);case`worker-settled`:return zn(e,t.worker);case`card-entered`:return e.drop(`leaving`,t.task.runId),e.timed(`entering`,t.task.runId,{},Q.cardEnter);case`card-left`:return e.timed(`leaving`,t.task.runId,{projectId:t.projectId,task:t.task},Q.cardLeave);case`check-passed`:return e.timed(`checks`,Fn(t.runId,t.name),{},Q.check);case`request-opened`:return Bn(e,t.request);case`request-closed`:return Vn(e,t.projectId,t.request,t.status===`replied`);case`chip-changed`:return e.timed(`bumps`,t.chip,{},Q.bump);case`wait-opened`:return e.drop(`waitsClosing`,t.wait.id),e.timed(`opening`,t.wait.id,{},Q.fade);case`wait-closed`:return e.drop(`opening`,t.wait.id),e.timed(`waitsClosing`,t.wait.id,{projectId:t.projectId,wait:t.wait},Q.fade)}}function Un(e,t,n){let r=new Ln(t);if(!n)for(let t of e)Hn(r,t);return{changes:r.changes,timers:r.timers}}function Wn(e,t){let n=e[t.field];if(t.ifKey!==void 0&&n[t.id]?.key!==t.ifKey||t.value===void 0&&!(t.id in n))return e;let r={...n};return t.value===void 0?delete r[t.id]:r[t.id]=t.value,{...e,[t.field]:r}}function Gn(e,t){return t.reduce(Wn,e)}function Kn(e,t,n){let r=new Set(t.map(e=>e.id));return Object.values(n.waitsClosing).filter(t=>t.projectId===e&&!r.has(t.wait.id)).map(e=>e.wait)}function qn({runId:e,requests:t,waits:n,index:r,link:i,pathOf:a,className:o,linkClassName:s}){let c=En(e,t),l=Sn(e,n);return c.length===0&&l.length===0?null:(0,L.jsxs)(`ul`,{"data-slot":`activity-peer-links`,className:o,children:[c.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(i,{to:a(e.recipientRunId),className:s,children:[`→ `,yn(r,e)]})},e.requestId)),l.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(i,{to:a(e.peerRunId),className:s,children:[`⋯ waits on `,X(r,e.peerRunId)]})},e.id))]})}var Jn=e=>`/tasks/${encodeURIComponent(e)}`;function Yn({texts:e}){return e.length===0?null:(0,L.jsx)(`ul`,{"data-slot":`activity-line-text`,className:`sr-only`,children:e.map((e,t)=>(0,L.jsx)(`li`,{children:e},t))})}var Xn={compact:{base:`relative flex flex-wrap items-center gap-x-2 gap-y-0.5 rounded-md px-2 py-1 text-[12px] text-muted-foreground`,asks:`border-l-2 border-dashed border-message-inbound-accent bg-message-inbound-bg`,shape:void 0,title:`min-w-0 truncate text-[12px] font-medium text-foreground`,line:`truncate text-xs text-muted-foreground tabular-nums`,main:`text-foreground`},card:{base:`relative grid grid-cols-[14px_minmax(0,1fr)] items-start gap-x-2 rounded-lg py-[5px] before:absolute before:top-[13px] before:-left-3.5 before:w-2.5 before:border-t before:border-border`,asks:`-mx-1.5 bg-message-inbound-bg px-1.5`,shape:`mt-[3px]`,title:`min-w-0 truncate text-[12.5px] font-medium text-foreground`,line:`col-start-2 truncate text-xs text-muted-foreground tabular-nums`,main:void 0}};function Zn({to:e,title:t,global:n}){let r=`relative z-[1] hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`;return n?(0,L.jsx)(M,{to:e,className:r,children:t}):(0,L.jsx)(P,{to:e,className:r,children:t})}function Qn({worker:e,parentId:t,requests:n,index:i,ctx:a,motion:o,href:c,global:l=!1,compact:u=!1}){let f=Ut(e,a,wn(e.runId,t,n)?.text),p=o.workerHold[e.runId],m=d().data,h=u?Xn.compact:Xn.card,g=[e.runner?s(m,e.runner):void 0,e.model].filter(Boolean).join(` · `);return(0,L.jsxs)(`li`,{"data-slot":`activity-worker`,"data-run":e.runId,"data-asks":f.asks?`true`:void 0,"data-hold":p?.phase,className:r(h.base,f.asks&&h.asks,e.runId in o.workerEnter&&`activity-row-enter`,p?.phase===`fold`&&`activity-row-fold`),children:[p?(0,L.jsx)(`span`,{"aria-hidden":`true`,className:r(`activity-row-flash`,Jt[p.tone])},p.key):null,(0,L.jsx)(`span`,{className:h.shape,children:(0,L.jsx)(en,{run:e,role:`worker`})}),(0,L.jsxs)(`span`,{className:h.title,children:[(0,L.jsx)(Zn,{to:c??Jn(e.runId),title:e.title,global:l}),g?(0,L.jsx)(`span`,{className:`ml-1.5 text-xs font-normal text-muted-foreground`,children:g}):null]}),(0,L.jsxs)(`span`,{"data-slot":`activity-worker-line`,className:h.line,children:[(0,L.jsx)(`b`,{className:r(`font-semibold`,Gt[f.tone]),children:f.verb}),` · `,(0,L.jsx)(`span`,{className:r(h.main,f.mono&&`font-mono`),children:f.main})]}),(0,L.jsx)(Yn,{texts:Cn(e.runId,n,i)})]})}function $n({workers:e}){return(0,L.jsxs)(`div`,{"data-slot":`activity-worker-dots`,className:`mt-2 ml-[18px] flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[e.map(e=>(0,L.jsx)(en,{run:e,role:`worker`},e.runId)),(0,L.jsxs)(`span`,{className:`ml-1`,children:[e.length,` worker`,e.length===1?``:`s`]})]})}function er({task:e,requests:t,index:n,ctx:r,dense:i=!1,motion:a,projectId:o,global:s=!1,compact:c=!1}){let l=e=>e in a.workerHold,u=e.workers.filter(e=>K(e.status)||e.status===`review`||l(e.runId)),d=Pn(Nn(e,l));if(u.length===0&&!d)return null;let f=e=>s&&o?`/p/${encodeURIComponent(o)}/tasks/${encodeURIComponent(e)}`:Jn(e);return c?(0,L.jsxs)(`div`,{className:`ml-4 border-l border-border pl-3`,children:[u.length>0?(0,L.jsx)(`ul`,{"data-slot":`activity-workers`,className:`flex flex-col gap-0.5`,children:u.map(i=>(0,L.jsx)(Qn,{worker:i,parentId:e.runId,requests:t,index:n,ctx:r,motion:a,href:f(i.runId),global:s,compact:!0},i.runId))}):null,d?(0,L.jsx)(`p`,{"data-slot":`activity-finished`,className:`mt-1 px-2 text-xs text-muted-foreground`,children:d}):null]}):(0,L.jsxs)(L.Fragment,{children:[u.length>0&&i?(0,L.jsx)($n,{workers:u}):null,u.length>0&&!i?(0,L.jsx)(`ul`,{"data-slot":`activity-workers`,className:`mt-2 ml-1 border-l border-border pl-3.5`,children:u.map(i=>(0,L.jsx)(Qn,{worker:i,parentId:e.runId,requests:t,index:n,ctx:r,motion:a},i.runId))}):null,d?(0,L.jsx)(`p`,{"data-slot":`activity-finished`,className:`mt-1.5 ml-[18px] text-xs text-muted-foreground`,children:d}):null]})}function tr(e,t){return t?{onPointerEnter:()=>t(`pointer`,e),onPointerLeave:()=>t(`pointer`,void 0),onFocus:()=>t(`focus`,e),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t(`focus`,void 0)}}:{}}function nr({task:e,motion:t,glow:n}){let i=t.flash[e.runId];return(0,L.jsxs)(L.Fragment,{children:[n?(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`activity-glow`}):null,i?(0,L.jsx)(`span`,{"data-slot":`activity-flash`,"data-tone":i.tone,"aria-hidden":`true`,className:r(`activity-flash`,qt[i.tone])},i.key):null]})}var rr=e=>/(auto|scroll|hidden|clip)/.test(getComputedStyle(e).overflowY);function ir(e){let t=[];for(let n=e.parentElement;n&&n!==document.body&&n!==document.documentElement;n=n.parentElement)rr(n)&&t.push(n);return t}var ar=e=>({requestId:e.id,senderRunId:e.peerRunId,recipientRunId:e.waiterRunId});function or({frame:e,cancel:t,draw:n}){let r=[],i,a=t=>{i=void 0,r=r.map(e=>({...e,start:e.start??t})).filter(e=>t<e.start+e.duration),n(r,t),r.length>0&&(i=e(a))};return{launch(t){r.some(e=>e.id===t.id)||(r.push(t),i===void 0&&(i=e(a)))},stop(){i!==void 0&&t(i),i=void 0,r=[],n([],0)},running:()=>i!==void 0}}var sr=e=>e<.5?2*e*e:1-(-2*e+2)**2/2;function cr(e,t,n=0){let r=Math.min(1,Math.max(0,(t-e.start)/e.duration)),i=Math.max(0,sr(r)-n);return e.reverse?1-i:i}var lr=`http://www.w3.org/2000/svg`,ur=[0,.03,.06,.09,.12],dr=[4.5,3.5,3,2.5,2],fr={peer:`fill-message-peer-accent`,family:`fill-message-inbound-accent`,success:`fill-success`};function pr(e,t){let n=e.querySelector(`g[data-comet="${CSS.escape(t.id)}"]`);if(n)return n;let r=document.createElementNS(lr,`g`);r.setAttribute(`data-comet`,t.id);let i=document.createElementNS(lr,`circle`);return i.setAttribute(`r`,`9`),i.setAttribute(`class`,`${fr[t.tone]} opacity-35`),r.append(i),ur.forEach((e,n)=>{let i=document.createElementNS(lr,`circle`);i.setAttribute(`r`,String(dr[n])),i.setAttribute(`class`,n===0?`fill-foreground`:fr[t.tone]),i.setAttribute(`opacity`,String(1-n*.15)),r.append(i)}),e.append(r),r}function mr(e,t,n){let r=new Set(t.map(e=>e.id));for(let t of e.querySelectorAll(`g[data-comet]`))r.has(t.getAttribute(`data-comet`)??``)||t.remove();let i=e.ownerSVGElement;for(let r of t){let t=i?.querySelector(`path[data-request="${CSS.escape(r.requestId)}"]`);if(!t||typeof t.getTotalLength!=`function`)continue;let a=t.getTotalLength();pr(e,r).querySelectorAll(`circle`).forEach((e,i)=>{let o=t.getPointAtLength(cr(r,n,ur[Math.max(0,i-1)])*a);e.setAttribute(`transform`,`translate(${o.x} ${o.y})`)})}}var hr=e=>typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(()=>e(performance.now()),16),gr=e=>typeof cancelAnimationFrame==`function`?cancelAnimationFrame(e):clearTimeout(e);function _r(e,t,n){let r=I.useRef(null),i=I.useRef(void 0),a=I.useRef(new Set);return I.useEffect(()=>{let e=r.current;if(!e)return;let t=or({frame:hr,cancel:gr,draw:(t,n)=>mr(e,t,n)});return i.current=t,()=>{t.stop(),i.current=void 0}},[]),I.useEffect(()=>{if(n){i.current?.stop();return}for(let t of a.current)t in e||a.current.delete(t);for(let[n,r]of Object.entries(e))a.current.has(n)||!t.has(r.requestId)||(a.current.add(n),i.current?.launch({id:n,requestId:r.requestId,reverse:r.reverse,tone:r.tone,duration:Q.comet}))},[e,t,n]),r}var vr=`activity-layout-settled`;function yr(e,t,n,r,i,a=!1){let[o,s]=I.useState([]);return I.useLayoutEffect(()=>{let i=e.current?.parentElement;if(!i)return;let o=()=>{let e=t(i);s(t=>n(t,e)?t:e)};o();let c=a?br(i,o):void 0;i.addEventListener(vr,o);let l=typeof ResizeObserver>`u`?void 0:new ResizeObserver(o);l?.observe(i);for(let e of i.querySelectorAll(r))l?.observe(e);return()=>{l?.disconnect(),i.removeEventListener(vr,o),c?.()}},[e,t,n,r,i,a]),o}function br(e,t){let n,r=()=>{n===void 0&&(n=requestAnimationFrame(()=>{n=void 0,t()}))},i=[...ir(e),window];for(let e of i)e.addEventListener(`scroll`,r,{passive:!0});return window.addEventListener(`resize`,r),()=>{for(let e of i)e.removeEventListener(`scroll`,r);window.removeEventListener(`resize`,r),n!==void 0&&cancelAnimationFrame(n)}}function xr(e,t){if(e.deadline!==void 0)return Sr(e.createdAt,e.deadline,t)}function Sr(e,t,n){let r=Date.parse(e),i=Date.parse(t);return Number.isNaN(r)||Number.isNaN(i)||i<=r?1:Math.min(1,Math.max(0,(n-r)/(i-r)))}function Cr(e,t){if(e===`fade`)return`activity-line-out`;if(e!==`replied`)return r(`activity-march`,t&&`activity-line-in`)}function wr(e,t){return t in e.waitsClosing?`activity-line-out`:r(`activity-drift`,t in e.opening&&`activity-line-in`)}var Tr=(e,t)=>e.closing[t]?.phase??`open`;function Er(e,t){let n=e.closing[t];return n!==void 0&&n.replied&&n.phase!==`reply`}function Dr({id:e}){return(0,L.jsx)(`marker`,{id:e,viewBox:`0 0 12 12`,refX:`10`,refY:`6`,markerWidth:`5`,markerHeight:`5`,markerUnits:`strokeWidth`,orient:`auto`,children:(0,L.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4`,strokeWidth:`2.4`,className:`fill-background stroke-message-peer-accent`})})}function Or(e,t){let n=new Map;for(let r of[...e?.projects??[],...t.projects])for(let[e,t]of _n(r))n.set(e,t);return n}var kr={"timed-out":`timed out`,cancelled:`was cancelled`,destroyed:`closed: the recipient was destroyed`,failed:`closed: the recipient failed`,"completed-without-reply":`closed without a reply`,"sender-closed":`was closed by its sender`,"human-fallback":`went to a human`,deleted:`closed: the recipient was deleted`};function Ar(e,t,n){let r=n(e.senderRunId,e.senderTitle),i=n(e.recipientRunId,e.recipientTitle);return t===`replied`?`${i} replied to ${r}`:`${r}’s request to ${i} ${kr[t??``]??`closed`}`}var jr={done:{tone:`success`,word:`finished`},failed:{tone:`danger`,word:`failed`},cancelled:{tone:`neutral`,word:`was cancelled`},review:{tone:`info`,word:`waits for review`}},Mr=e=>e.relationship===`peer`?`peer`:`family`;function Nr(e,t,n){let r=(e,n)=>X(t,e,n);switch(e.kind){case`request-opened`:return{tone:Mr(e.request),text:`${r(e.request.senderRunId,e.request.senderTitle)} asked ${r(e.request.recipientRunId,e.request.recipientTitle)}`};case`request-closed`:return{tone:e.status===`replied`?`success`:`neutral`,text:Ar(e.request,e.status,r)};case`rung-changed`:return{tone:w(e.task.rung).tone,text:`${e.task.title}: ${Vt(e.task,{now:n,titleOf:e=>r(e)}).verb}`};case`worker-started`:return{tone:`running`,text:`${e.worker.title} started`};case`worker-settled`:{let t=jr[e.worker.status]??{tone:`neutral`,word:`settled`};return{tone:t.tone,text:`${e.worker.title} ${t.word}`}}case`card-entered`:return{tone:w(e.task.rung).tone,text:`${e.task.title} started`};case`card-left`:return{tone:`neutral`,text:`${e.task.title} left active work`};case`check-passed`:return{tone:`success`,text:`PR ${e.pr}: check “${e.name}” passed`};default:return}}function Pr(e,t,n,r){return[...t.map((e,t)=>({...e,id:r+t,at:n})),...e].slice(0,6)}function Fr(e){return Math.max(0,Math.floor(e/1e3))<5?`now`:H(e)}var Ir=`rounded-xl border border-card-edge bg-card px-3.5 py-3 shadow-card`,Lr=`mb-2 flex gap-2 text-xs font-semibold tracking-[0.06em] text-muted-foreground uppercase`;function Rr({request:e,index:t,now:n,motion:i}){let{kind:a,relation:o}=Dn(e,t),s=xr(e,n),c=e.relationship===`peer`?`text-message-peer-accent`:`text-message-inbound-accent`;return(0,L.jsxs)(`li`,{"data-slot":i===`fold`?`activity-request-closing`:`activity-request`,"data-request":e.requestId,"aria-hidden":i===`fold`||void 0,className:r(`border-t border-border py-2.5 first:border-t-0 first:pt-0`,i===`enter`&&`activity-row-enter`,i===`fold`&&`activity-row-fold`),children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12px] font-medium`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:vn(t,e)}),(0,L.jsx)(xe,{"aria-label":`to`,className:`size-3 shrink-0 text-muted-foreground`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:yn(t,e)}),(0,L.jsx)(`span`,{className:r(`ml-auto shrink-0 text-xs font-semibold tracking-[0.05em] uppercase`,c),children:a})]}),(0,L.jsxs)(`p`,{className:`my-1 line-clamp-3 text-[12px] text-muted-foreground`,children:[`“`,e.text,`”`]}),(0,L.jsxs)(`div`,{className:`flex gap-1.5 text-xs text-muted-foreground tabular-nums`,children:[(0,L.jsxs)(`span`,{children:[o,` · open `,V(U(e.createdAt,n))]}),e.deadline?(0,L.jsx)(`span`,{className:`ml-auto`,children:Tn(e.deadline,n)}):null]}),s===void 0?null:(0,L.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1.5 h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,L.jsx)(`span`,{className:r(`block h-full bg-current`,c),style:{width:`${Math.round(s*100)}%`}})})]})}var zr={...Jt,peer:`bg-message-peer-accent`,family:`bg-message-inbound-accent`};function Br({feed:e,now:t}){return(0,L.jsxs)(`section`,{"data-slot":`activity-just-now`,className:Ir,children:[(0,L.jsx)(`h2`,{className:Lr,children:`Just now`}),(0,L.jsx)(`ul`,{"data-slot":`activity-feed`,children:e.map((e,n)=>(0,L.jsxs)(`li`,{"data-slot":`activity-feed-entry`,className:r(`grid grid-cols-[10px_minmax(0,1fr)_auto] items-baseline gap-2 py-1 text-[12px] text-muted-foreground`,n===0&&`activity-feed-enter`),children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:r(`size-[7px] -translate-y-px rounded-full`,zr[e.tone])}),(0,L.jsx)(`span`,{className:`min-w-0`,children:e.text}),(0,L.jsx)(`span`,{"data-slot":`activity-feed-age`,className:`text-xs tabular-nums`,children:Fr(t-e.at)})]},e.id))})]})}function Vr({requests:e,closing:t=[],index:n,now:i,feed:a=[],motion:o=$,columnGap:s}){let c=e.length>0||t.length>0,l=a.length>0;return!c&&!l?null:(0,L.jsxs)(`aside`,{"data-slot":`activity-rail`,"aria-label":`Activity details`,style:s===void 0?void 0:{columnGap:s},className:r(`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start items-start gap-4`,c&&l&&`md:grid-cols-2`),children:[c?(0,L.jsxs)(`section`,{"data-slot":`activity-open-requests`,className:Ir,children:[(0,L.jsxs)(`h2`,{className:Lr,children:[`Open requests `,(0,L.jsx)(`b`,{className:`text-foreground`,children:e.length})]}),(0,L.jsxs)(`ul`,{children:[e.map(e=>(0,L.jsx)(Rr,{request:e,index:n,now:i,motion:e.requestId in o.opening?`enter`:void 0},e.requestId)),t.map(e=>(0,L.jsx)(Rr,{request:e,index:n,now:i,motion:`fold`},e.requestId))]})]}):null,l?(0,L.jsx)(Br,{feed:a,now:i}):null]})}var Hr=new Set;function Ur(e){let[t,n]=I.useState({}),r=t.pointer??t.focus,i=I.useCallback((e,t)=>n(n=>n[e]===t?n:{...n,[e]:t}),[]);return{linked:I.useMemo(()=>r===void 0?Hr:xn(r,e),[r,e]),active:I.useMemo(()=>r===void 0?Hr:new Set(e.filter(e=>e.waiterRunId===r||e.peerRunId===r).map(e=>e.id)),[r,e]),onHover:i}}function Wr(e,t,n=Z(e.tasks)){let r=new Set(e.tasks.map(e=>e.runId)),i=new Set(e.requests.map(e=>e.requestId)),a=Object.values(t.closing).filter(t=>t.projectId===e.projectId&&!i.has(t.request.requestId));return{cards:Object.values(t.leaving).filter(t=>t.projectId===e.projectId&&!r.has(t.task.runId)).map(e=>e.task),requests:a.map(e=>e.request),waits:Kn(e.projectId,n,t),folding:a.filter(e=>e.phase===`reply`||!e.replied).map(e=>e.request)}}var Gr=36,Kr=22,qr=4,Jr=10;function Yr(e,t,n,r=$){let i=[],a=(e,t)=>{let r=n.get(e);return r!==void 0&&r===n.get(t)};for(let t of e){if(t.relationship!==`peer`||!a(t.senderRunId,t.recipientRunId))continue;let e=r.closing[t.requestId];i.push({kind:`request`,id:t.requestId,from:t.senderRunId,to:t.recipientRunId,createdAt:t.createdAt,...e?{closing:!0,replied:e.replied}:{}})}for(let e of t)a(e.peerRunId,e.waiterRunId)&&i.push({kind:`wait`,id:e.id,from:e.peerRunId,to:e.waiterRunId,since:e.since,...e.id in r.waitsClosing?{closing:!0}:{}});if(i.length===0)return{edges:i,gutterWidth:0};let o=Math.min(qr,i.length);return{edges:i,gutterWidth:Math.min(132,64+(o-1)*Kr)}}function Xr(e,t,n){let r=new Set;if(!e)return r;for(let n of t)n.relationship===`peer`&&(n.senderRunId===e||n.recipientRunId===e)&&(r.add(n.senderRunId),r.add(n.recipientRunId));for(let t of n)(t.peerRunId===e||t.waiterRunId===e)&&(r.add(t.peerRunId),r.add(t.waiterRunId));return r}function Zr(e,t){return e.map(e=>{let n=t.get(e.from),r=t.get(e.to);if(!(!n||!r))return{edge:e,start:n,end:r,span:Math.abs(r.y-n.y)}}).filter(e=>e!==void 0).sort((e,t)=>e.span-t.span).map(({edge:e,start:t,end:n},r)=>{let i=r%qr,a=Math.max(10,Math.min(t.x,n.x)-Gr-i*Kr),o=n.y-t.y,s=o>=0?1:-1,c=Math.min(Jr,Math.abs(o)/2,Math.max(2,t.x-a-2)),l=e.kind===`request`?n.x-2:n.x-6;return{edge:e,path:[`M ${t.x} ${t.y}`,`L ${a+c} ${t.y}`,`Q ${a} ${t.y} ${a} ${t.y+s*c}`,`L ${a} ${n.y-s*c}`,`Q ${a} ${n.y} ${a+c} ${n.y}`,`L ${l} ${n.y}`].join(` `),laneX:a,labelY:t.y+o*(.5+(r%2==0?-.06:.08)),endX:n.x-4,endY:n.y}})}function Qr(e){let t=new Map,n=e.getBoundingClientRect();for(let r of e.querySelectorAll(`[data-activity-row]`)){let e=r.getAttribute(`data-activity-row`);if(!e)continue;let i=r.getBoundingClientRect();t.set(e,{x:i.left-n.left,y:i.top-n.top+Math.min(i.height/2,24)})}return t}function $r({stage:e,edges:t,active:n,now:i,layoutKey:a,motion:o=$,paused:s=!1}){let c=I.useId(),[l,u]=I.useState([]);I.useLayoutEffect(()=>{if(!e||t.length===0){u([]);return}let n=()=>u(Zr(t,Qr(e)));if(n(),typeof ResizeObserver>`u`)return;let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[e,t,a]);let d=I.useMemo(()=>new Set(l.filter(e=>e.edge.kind===`request`).map(e=>e.edge.id)),[l]),f=_r(o.comets,d,s);return(0,L.jsxs)(`div`,{"data-slot":`activity-margin-arcs`,"aria-hidden":`true`,className:r(`pointer-events-none absolute inset-0 z-[5] hidden overflow-visible`,t.length>0&&`md:block`),children:[(0,L.jsxs)(`svg`,{className:`size-full overflow-visible`,children:[(0,L.jsx)(`defs`,{children:(0,L.jsx)(`marker`,{id:c,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,L.jsx)(`path`,{d:`M0 1 L7 4 L0 7 z`,className:`fill-message-peer-accent`})})}),l.map(e=>{let{edge:t}=e,i=n!==void 0&&(t.from===n||t.to===n),a=n!==void 0&&!i,o=t.kind===`request`?r(`fill-none stroke-message-peer-accent transition-opacity`,!t.closing&&`activity-march`,t.closing&&`activity-line-out`):r(`fill-none stroke-message-peer-accent transition-opacity`,!t.closing&&`activity-drift`,t.closing&&`activity-line-out`);return(0,L.jsxs)(`g`,{opacity:a?.22:i?1:.82,children:[(0,L.jsx)(`path`,{d:e.path,"data-request":t.kind===`request`?t.id:void 0,"data-wait":t.kind===`wait`?t.id:void 0,strokeWidth:i?2.4:1.8,strokeDasharray:t.kind===`request`?t.replied?void 0:`6 4`:`0 7`,strokeLinecap:t.kind===`wait`?`round`:void 0,markerEnd:t.kind===`request`?`url(#${c})`:void 0,className:o}),t.kind===`wait`?(0,L.jsx)(`circle`,{cx:e.endX,cy:e.endY,r:`3.2`,strokeWidth:`1.7`,className:`fill-card stroke-message-peer-accent`}):null]},`${t.kind}:${t.id}`)}),(0,L.jsx)(`g`,{ref:f})]}),l.map(e=>{let{edge:t}=e,a=n!==void 0&&(t.from===n||t.to===n),o=n!==void 0&&!a,s=V(U(t.kind===`request`?t.createdAt:t.since,i));return(0,L.jsx)(`span`,{style:{left:e.laneX,top:e.labelY},className:r(`absolute -translate-x-1/2 -translate-y-1/2 rounded-full border border-message-peer-accent/60 bg-card px-1.5 py-0.5 text-xs font-semibold whitespace-nowrap text-message-peer-accent tabular-nums shadow-xs transition-opacity`,t.kind===`wait`&&`border-dashed`,o&&`opacity-25`),children:t.kind===`request`?`Req · ${s}`:`Wait · ${s}`},`label:${t.kind}:${t.id}`)})]})}var ei={permission:0,answer:1,respond:2,review:3,failed:4},ti={running:0,waiting:1,queued:2,retained:3},ni=new Set([`queued`,`waiting-for-capacity`]);function ri(e){return e.status===`review`||e.status===`failed`||e.rung===`failed`||K(e.status)&&v(e.rung)}function ii(e){let{task:t}=e,n=t.wait?.kind===`human`?t.wait:void 0;if(n?.detail.reason===`question`)return{...e,kind:`answer`,stateLabel:`Needs answer`,tone:`pending`,blockingReason:n.detail.question??`The agent asked a question and is waiting for your answer.`,ageSince:n.since,actionLabel:`Answer`};if(n?.detail.reason===`budget`){let t=n.detail.queuedMessages;return{...e,kind:`respond`,stateLabel:`Needs you`,tone:`pending`,blockingReason:t?`Automatic wakes used up · ${t} queued ${t===1?`message`:`messages`} waiting.`:`Automatic wakes used up.`,ageSince:n.since,actionLabel:`Respond`}}return{...e,kind:`respond`,stateLabel:`Needs you`,tone:`pending`,blockingReason:`Your turn to reply or finish the task.`,ageSince:n?.since??t.startedAt??t.createdAt,actionLabel:`Respond`}}function ai(e,t){let n={runId:t.runId,projectId:e.projectId,projectName:e.name,task:t},r=t.finishedAt??t.startedAt??t.createdAt;if(t.rung===`needs-permission`){let e=t.wait&&`since`in t.wait?t.wait.since:void 0;return{...n,kind:`permission`,stateLabel:`Needs permission`,tone:`pending`,blockingReason:`Waiting for permission approval before continuing.`,ageSince:e??t.startedAt??t.createdAt,actionLabel:`Open task`}}return t.status===`review`||t.rung===`needs-review`?{...n,kind:`review`,stateLabel:`Needs review`,tone:`info`,blockingReason:`Changes are ready for review before anything lands.`,ageSince:r,actionLabel:`Review`}:t.status===`failed`||t.rung===`failed`?{...n,kind:`failed`,stateLabel:`Failed`,tone:`danger`,blockingReason:t.error??`Task stopped with an error.`,ageSince:r,actionLabel:`Inspect`}:ii(n)}function oi(e){return K(e.status)?e.rung===`running`?`running`:ni.has(e.rung)?`queued`:`waiting`:`retained`}var si=e=>{if(!e)return 1/0;let t=Date.parse(e);return Number.isNaN(t)?1/0:t};function ci(e){let t=[],n=[];for(let r of e)for(let e of r.tasks)ri(e)?t.push(ai(r,e)):n.push({runId:e.runId,projectId:r.projectId,projectName:r.name,task:e,tier:oi(e)});return t.sort((e,t)=>ei[e.kind]-ei[t.kind]||si(e.ageSince)-si(t.ageSince)||e.runId.localeCompare(t.runId)),n.sort((e,t)=>ti[e.tier]-ti[t.tier]),{attention:t,working:n}}function li(e,t){let n=new Map;for(let t of e){let e=n.get(t.projectId);e?e.items.push(t):n.set(t.projectId,{projectId:t.projectId,projectName:t.projectName,items:[t]})}let r=new Map(t.map((e,t)=>[e,t]));return[...n.values()].sort((e,t)=>(r.get(e.projectId)??2**53-1)-(r.get(t.projectId)??2**53-1)||e.projectName.localeCompare(t.projectName))}function ui(e,t,n,r){let i=new Map;for(let n of t)n.relationship===`peer`&&n.recipientRunId===e&&i.set(n.senderRunId,X(r,n.senderRunId,n.senderTitle));for(let t of n)t.peerRunId===e&&i.set(t.waiterRunId,X(r,t.waiterRunId));let a=[...i.values()];if(a.length!==0)return a.length===1?`Unblocks ${a[0]}`:a.length===2?`Unblocks ${a[0]} + ${a[1]}`:`Unblocks ${a[0]} + ${a.length-1} more`}function di(e,t){if(e===void 0)return;let n=t.filter(t=>!e.has(t.runId));if(n.length!==0)return n.length===1?`New item needs your decision: ${n[0].task.title}`:`${n.length} new items need your decision`}var fi={permission:`border-l-pending`,answer:`border-l-pending`,respond:`border-l-pending`,review:`border-l-info`,failed:`border-l-danger`},pi=`relative z-[1] text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,mi=[],hi=[],gi=new Map;function _i(e,t,n){return n?`/p/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}`:`/tasks/${encodeURIComponent(t)}`}function vi({items:e,grouped:t,projectOrder:n,countSuffix:r,renderItems:i}){return t?(0,L.jsx)(`div`,{className:`flex flex-col gap-3`,children:li(e,n).map(e=>(0,L.jsxs)(`div`,{"data-slot":`activity-project-group`,"data-project":e.projectId,className:`flex flex-col gap-2`,children:[(0,L.jsxs)(`h3`,{className:`flex items-center gap-2 text-[12.5px] font-semibold text-foreground`,children:[(0,L.jsx)(`span`,{children:e.projectName}),(0,L.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground tabular-nums`,children:[e.items.length,` `,r]})]}),i(e.items)]},e.projectId))}):(0,L.jsx)(L.Fragment,{children:i(e)})}var yi={permission:`text-foreground`,answer:`text-foreground`,respond:`text-foreground`,review:`text-muted-foreground`,failed:`font-mono text-[12px] text-signal-word-red`};function bi({href:e,title:t,global:n}){let r=`hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:min-w-11 max-md:items-center pointer-coarse:inline-flex pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:items-center`;return n?(0,L.jsx)(M,{to:e,className:r,children:t}):(0,L.jsx)(P,{to:e,className:r,children:t})}function xi({record:e,href:t,global:n,selected:r,onTriage:i}){return e.kind===`permission`?(0,L.jsx)(N,{asChild:!0,size:`sm`,variant:`primary`,className:`min-h-9 max-md:min-h-11 max-md:flex-1`,children:n?(0,L.jsx)(M,{to:t,children:e.actionLabel}):(0,L.jsx)(P,{to:t,children:e.actionLabel})}):(0,L.jsx)(N,{type:`button`,size:`sm`,variant:e.kind===`answer`||e.kind===`respond`?`primary`:`outline`,"data-slot":`activity-triage-trigger`,"aria-expanded":r,className:`min-h-9 max-md:min-h-11 max-md:flex-1`,onClick:t=>i(e,t.currentTarget),children:e.actionLabel})}function Si({record:e,requests:t,waits:n,index:i,now:a,global:o,selected:c,linked:l,motion:u,onHover:f,onTriage:p}){let m=d().data,{task:h}=e,g=[h.runner?s(m,h.runner):void 0,h.model,h.currentStepId?`step ${h.currentStepId}`:void 0].filter(Boolean).join(` · `),_=ui(e.runId,t,n,i),v=_i(e.projectId,e.runId,o),ee={now:a,titleOf:e=>i.get(e)?.title??`Unreadable task`},te=h.workers.length>0;return(0,L.jsxs)(`article`,{"data-activity-row":e.runId,"data-activity-card":e.runId,"data-slot":`activity-decision`,"data-decision-kind":e.kind,"data-rung":h.rung,"data-selected":c?`true`:void 0,"data-linked":l?`true`:void 0,...tr(e.runId,f),className:r(`relative grid min-w-0 grid-cols-1 items-center gap-3 rounded-xl border border-card-edge border-l-[3px] bg-card px-4 py-3 shadow-card transition-colors md:grid-cols-[minmax(0,1fr)_auto] md:gap-x-4`,fi[e.kind],c&&`border-accent-text bg-accent-strong/[0.06]`,l&&`outline-2 outline-offset-1 outline-message-peer-accent`,e.runId in u.entering&&`activity-card-enter`),children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,L.jsxs)(`span`,{className:r(`inline-flex items-center gap-1.5 text-[12px] font-semibold`,Gt[e.tone]),children:[(0,L.jsx)(en,{run:h,role:`root`}),(0,L.jsx)(`span`,{"data-slot":`activity-verb`,children:e.stateLabel})]}),(0,L.jsx)(`h3`,{className:`min-w-0 truncate text-[14px] font-semibold text-foreground`,children:(0,L.jsx)(bi,{href:v,title:h.title,global:o})}),(0,L.jsx)(`span`,{"data-slot":`activity-project-badge`,className:`inline-flex shrink-0 items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground`,children:e.projectName}),e.ageSince?(0,L.jsx)(`span`,{"data-slot":`activity-age`,title:G(e.ageSince),className:`text-[12px] text-muted-foreground tabular-nums`,children:H(U(e.ageSince,a))}):null]}),(0,L.jsx)(`p`,{"data-slot":`activity-main`,className:r(`break-words text-[13px] leading-relaxed`,yi[e.kind]),children:e.blockingReason}),g||_?(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[g?(0,L.jsx)(`span`,{children:g}):null,_?(0,L.jsxs)(`span`,{"data-slot":`activity-unblocks`,className:`font-medium text-message-peer-accent`,children:[`· `,_]}):null]}):null,(0,L.jsx)(qn,{runId:e.runId,requests:t,waits:n,index:i,link:o?M:P,pathOf:t=>o?`/p/${encodeURIComponent(e.projectId)}/tasks/${encodeURIComponent(t)}`:`/tasks/${encodeURIComponent(t)}`,className:`mt-1 flex flex-col gap-0.5 md:hidden`,linkClassName:pi})]}),(0,L.jsx)(`div`,{className:`flex items-center gap-2 max-md:w-full`,children:(0,L.jsx)(xi,{record:e,href:v,global:o,selected:c,onTriage:p})}),te?(0,L.jsx)(`div`,{className:`min-w-0 md:col-span-2`,children:(0,L.jsx)(er,{task:h,requests:t,index:i,ctx:ee,motion:u,projectId:e.projectId,global:o,compact:!0})}):null,(0,L.jsx)(Yn,{texts:Cn(e.runId,t,i,n)})]})}function Ci({items:e,requestsByProject:t,waitsByProject:n,indexByProject:r,now:i,global:a,grouped:o,projectOrder:s,selectedRunId:c,linkedIds:l,motion:u=$,onHover:d,onTriage:f}){return e.length===0?null:(0,L.jsxs)(`section`,{"data-slot":`activity-attention`,"aria-label":`Needs your decision`,className:`flex min-w-0 flex-col gap-2.5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`h2`,{className:`text-[12px] font-semibold tracking-[0.06em] text-muted-foreground uppercase`,children:`Needs your decision`}),(0,L.jsx)(`span`,{"data-slot":`activity-attention-count`,className:`inline-flex items-center rounded-full bg-inbox-count px-2 py-0.5 text-xs font-semibold text-inbox-count-foreground tabular-nums`,children:e.length}),(0,L.jsx)(`span`,{className:`ml-auto hidden text-[12px] text-muted-foreground sm:inline`,children:`Resolve inline without leaving the queue`})]}),(0,L.jsx)(vi,{items:e,grouped:o,projectOrder:s,countSuffix:`waiting`,renderItems:e=>(0,L.jsx)(`div`,{className:`flex flex-col gap-2.5`,children:e.map(e=>(0,L.jsx)(Si,{record:e,requests:t.get(e.projectId)??mi,waits:n.get(e.projectId)??hi,index:r.get(e.projectId)??gi,now:i,global:a,selected:c===e.runId,linked:l.has(e.runId),motion:u,onHover:d,onTriage:f},e.runId))})})]})}function wi(e){return`/p/${encodeURIComponent(e.projectId)}/tasks/${encodeURIComponent(e.runId)}`}function Ti(e){return{...e.id===void 0?{}:{id:e.id},header:e.header,question:e.question,...e.options===void 0?{}:{options:e.options.map(e=>({label:e.label,...e.description===void 0?{}:{description:e.description}}))},...e.multiSelect===void 0?{}:{multiSelect:e.multiSelect},...e.allowFreeText===void 0?{}:{allowFreeText:e.allowFreeText}}}function Ei(e,t){let n=De(t);if(!n)return;let r=ke(n);if(r)return{kind:`ask`,id:r.id,questions:r.questions.map(Ti),...r.context===void 0?{}:{context:r.context},resolved:!1,...e.delegation?.role===`worker`?{parentRunId:e.delegation.parentRunId}:{}}}function Di({run:e,projectId:t,prompt:n,onResolved:r}){let i=ze(e,t),a=be(e.id,{projectId:t,onSuccess:r}),[o,s]=(0,I.useState)(``),c=async()=>{let e=o.trim();e&&await i.send(e)===void 0&&(s(``),r())};return(0,L.jsxs)(`div`,{"data-slot":`activity-quick-reply`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card p-3.5`,children:[(0,L.jsx)(`p`,{className:`text-[13px] text-foreground`,children:n}),(0,L.jsx)(Ve,{"aria-label":`Reply to task`,placeholder:`Write your reply…`,rows:3,value:o,disabled:i.isPending||i.blockedBy!==void 0,onChange:e=>s(e.target.value),className:`bg-background text-base md:text-[13px]`}),i.reason?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i.reason}):null,i.error?(0,L.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:i.error}):null,(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(N,{type:`button`,size:`sm`,variant:`primary`,className:`min-h-11`,disabled:i.isPending||i.blockedBy!==void 0||o.trim().length===0,onClick:()=>void c(),children:`Send reply`}),e.finishBlocked===null?(0,L.jsx)(N,{type:`button`,size:`sm`,variant:`outline`,className:`min-h-11`,disabled:a.isPending,onClick:()=>a.mutate(),children:`Finish task`}):null]})]})}function Oi({record:e,run:t,onResolved:n}){let r=re({queryKey:[`activity-triage`,`history-context`,e.projectId,e.runId,e.ageSince??``,e.blockingReason],queryFn:({signal:t})=>ee(e.runId,{projectId:e.projectId,signal:t}),staleTime:0,gcTime:0,refetchOnMount:`always`});if(r.isPending)return(0,L.jsx)(`p`,{"data-slot":`triage-loading`,className:`text-xs text-muted-foreground`,children:`Loading question…`});let i=r.data?Ei(t,r.data.contextEvents):void 0;return i?(0,L.jsx)(ye,{ask:i,run:t,projectId:e.projectId,onAnswered:n}):(0,L.jsx)(Di,{run:t,projectId:e.projectId,prompt:e.blockingReason,onResolved:n})}function ki({record:e,run:t,onResolved:n}){let r=C(),i=ze(t,e.projectId),[a,s]=(0,I.useState)(``),c=l({mutationFn:()=>ae(f(e.runId,{projectId:e.projectId}),!0),onSuccess:()=>{T(`Failed task archived.`),r.invalidateQueries({queryKey:o.runs.all}),n()},onError:e=>T(e.message,{tone:`danger`})}),u=async()=>{let e=a.trim()||`Continue and resolve the failure.`;await i.send(e)===void 0&&(T(`Task resumed.`),n())},d=t.error??e.blockingReason;return(0,L.jsxs)(`div`,{"data-slot":`activity-failed-triage`,className:`flex flex-col gap-3`,children:[(0,L.jsxs)(`div`,{className:`rounded-lg border border-danger/40 bg-card-2 p-3.5`,children:[(0,L.jsx)(`p`,{className:`text-xs font-semibold text-signal-word-red`,children:`Failure details`}),(0,L.jsx)(`pre`,{className:`mt-2 overflow-x-auto font-mono text-xs whitespace-pre-wrap text-foreground`,children:d})]}),i.mode===`unavailable`?null:(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(`label`,{htmlFor:`activity-retry-note`,className:`text-xs font-medium text-foreground`,children:`Retry instruction (optional)`}),(0,L.jsx)(Ve,{id:`activity-retry-note`,rows:2,placeholder:`Leave blank to continue and resolve the failure…`,value:a,disabled:i.isPending||i.blockedBy!==void 0,onChange:e=>s(e.target.value),className:`bg-card text-base md:text-[13px]`}),i.reason?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i.reason}):null,i.error?(0,L.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:i.error}):null]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[i.mode===`unavailable`?null:(0,L.jsxs)(N,{type:`button`,size:`sm`,variant:`primary`,className:`min-h-11`,disabled:i.isPending||i.blockedBy!==void 0,onClick:()=>void u(),children:[(0,L.jsx)(Oe,{"aria-hidden":`true`,className:`size-3.5`}),`Retry task`]}),(0,L.jsxs)(N,{type:`button`,size:`sm`,variant:`outline`,className:`min-h-11`,disabled:c.isPending,onClick:()=>c.mutate(),children:[(0,L.jsx)(ge,{"aria-hidden":`true`,className:`size-3.5`}),`Archive`]})]})]})}function Ai(e){let{task:t}=e,n=t.workers.map(e=>`${e.runId}:${e.status}`).join(`,`);return`${t.status}|${t.rung}|${t.finishedAt??``}|${t.error??``}|${e.ageSince??``}|${n}`}function ji({record:e,onResolved:t}){let n=C(),r=u(e.projectId,e.runId,!0,{staleTime:0,refetchOnMount:`always`}),i=Ai(e),a=(0,I.useRef)(i);if((0,I.useEffect)(()=>{if(a.current===i)return;a.current=i;let t=!1,r=[e.projectId,`runs`,`detail`,e.runId];return me(n,r),n.cancelQueries({queryKey:r,exact:!0}).then(()=>{t||n.refetchQueries({queryKey:r,exact:!0,type:`active`})}),e.kind===`review`&&n.invalidateQueries({queryKey:[e.projectId,`runs`,`diff`,e.runId],exact:!0}),()=>{t=!0}},[i,n,e.kind,e.projectId,e.runId]),(0,I.useEffect)(()=>{let t=[e.projectId,`runs`,`detail`,e.runId];return te(()=>(me(n,t),n.cancelQueries({queryKey:t,exact:!0}).then(()=>n.refetchQueries({queryKey:t,exact:!0,type:`active`}))))},[n,e.projectId,e.runId]),r.isPending)return(0,L.jsx)(`p`,{"data-slot":`triage-loading`,className:`text-xs text-muted-foreground`,children:`Loading task details…`});if(r.isError||!r.data)return(0,L.jsxs)(`div`,{role:`alert`,className:`flex flex-col gap-2 text-xs text-semantic-red`,children:[(0,L.jsxs)(`p`,{children:[`Could not load task details: `,r.error?.message??`task unavailable`,`.`]}),(0,L.jsx)(N,{type:`button`,size:`sm`,variant:`outline`,className:`min-h-11 self-start`,onClick:()=>void r.refetch(),children:`Retry`})]});let o=r.isFetching&&r.data.finishBlocked!==void 0?{...r.data,finishBlocked:void 0}:r.data;return e.kind===`answer`?(0,L.jsx)(Oi,{record:e,run:o,onResolved:t}):e.kind===`review`?(0,L.jsx)(ve,{run:o,projectId:e.projectId,onResolved:t}):e.kind===`failed`?(0,L.jsx)(ki,{record:e,run:o,onResolved:t}):(0,L.jsx)(Di,{run:o,projectId:e.projectId,prompt:e.blockingReason,onResolved:t})}function Mi({record:e,selectionToken:t,resolved:n=!1,now:i,onClose:a,onResolved:o,onRestoreFocus:s}){let c=C();return(0,L.jsx)(Pe,{open:e!==null,onOpenChange:e=>{e||a()},children:(0,L.jsx)(Ie,{side:`right`,showCloseButton:!1,"data-slot":`activity-triage-drawer`,onCloseAutoFocus:e=>{s&&(e.preventDefault(),s())},className:`flex h-full w-full flex-col gap-0 p-0 data-[state=closed]:duration-150 data-[state=open]:duration-200 sm:max-w-lg`,children:e?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Ne,{className:`flex-row items-start justify-between gap-3 border-b border-border bg-card px-4 py-3.5`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`span`,{className:r(`text-xs font-semibold`,Gt[e.tone]),children:e.stateLabel}),(0,L.jsx)(`span`,{className:`inline-flex items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground`,children:e.projectName}),e.ageSince?(0,L.jsx)(`span`,{title:G(e.ageSince),className:`text-xs text-muted-foreground tabular-nums`,children:H(U(e.ageSince,i))}):null]}),(0,L.jsx)(Fe,{className:`mt-1 truncate text-[16px] leading-snug`,children:e.task.title}),(0,L.jsxs)(Re,{className:`sr-only`,children:[`Resolve `,e.stateLabel.toLowerCase(),` for `,e.task.title,` without leaving Live Activity.`]})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,L.jsx)(N,{asChild:!0,size:`sm`,variant:`ghost`,className:`min-h-11 px-2.5 text-xs`,children:(0,L.jsxs)(M,{to:wi(e),children:[`Open task`,(0,L.jsx)(we,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,L.jsx)(N,{type:`button`,size:`icon`,variant:`ghost`,"aria-label":`Close triage drawer`,className:`size-11`,onClick:a,children:(0,L.jsx)(he,{"aria-hidden":`true`,className:`size-4`})})]})]}),(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:n?(0,L.jsxs)(`div`,{"data-slot":`activity-triage-resolved`,role:`status`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card p-4 text-[13px] text-muted-foreground`,children:[(0,L.jsx)(`p`,{className:`text-foreground`,children:`This task no longer needs your decision.`}),(0,L.jsx)(N,{type:`button`,size:`sm`,variant:`outline`,className:`min-h-11 self-start`,onClick:a,children:`Close`})]}):(0,L.jsx)(ji,{record:e,onResolved:((e,t)=>()=>{c.invalidateQueries({queryKey:[`workspace`,`activity`]}),c.invalidateQueries({queryKey:[`activity-triage`,`history-context`,e.projectId,e.runId]}),c.invalidateQueries({queryKey:[e.projectId,`runs`,`detail`,e.runId],exact:!0}),o(e.runId,t)})(e,t)},`${e.projectId}:${e.runId}:${e.kind}:${t??0}`)})]}):null})})}var Ni=12,Pi={fail:4,pending:3,pass:2,skipping:1,cancel:0};function Fi(e,t){let n=e.slice(Ni);if(n.length===0)return t;let r=n.length+(t?.count??0),i=t?.bucket??n[0].bucket;for(let e of n)Pi[e.bucket]>Pi[i]&&(i=e.bucket);return{count:r,bucket:i}}function Ii({record:e,requests:t,waits:n,index:i,ctx:a,global:o,linked:s,motion:c,onHover:l}){let{task:u}=e,d=Vt(u,a),f=_i(e.projectId,e.runId,o),p=u.startedAt??d.since??u.createdAt,m=c.slides[u.runId]?.key,h=In(c,u.runId);return(0,L.jsxs)(`article`,{"data-activity-row":e.runId,"data-activity-card":e.runId,"data-slot":`activity-working-row`,"data-rung":u.rung,"data-linked":s?`true`:void 0,...tr(e.runId,l),className:r(`relative flex min-w-0 flex-col gap-1.5 px-3.5 py-2.5 transition-colors first:rounded-t-xl last:rounded-b-xl`,s&&`bg-message-peer-bg outline-2 outline-offset-1 outline-message-peer-accent`,e.runId in c.entering&&`activity-card-enter`),children:[(0,L.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[14px_minmax(0,1fr)_auto] items-center gap-x-2.5 gap-y-1 md:grid-cols-[14px_minmax(0,1.25fr)_minmax(0,1.45fr)_auto_auto]`,children:[(0,L.jsx)(en,{run:u,role:`root`}),(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`h3`,{className:`min-w-0 truncate text-[13px] font-semibold text-foreground`,children:o?(0,L.jsx)(M,{to:f,className:`hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:u.title}):(0,L.jsx)(P,{to:f,className:`hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:u.title})}),(0,L.jsx)(`span`,{"data-slot":`activity-project-badge`,className:`inline-flex shrink-0 items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground`,children:e.projectName}),u.currentStepId?(0,L.jsxs)(`span`,{"data-slot":`activity-step`,className:`hidden shrink-0 text-xs text-muted-foreground sm:inline`,children:[`step `,u.currentStepId]}):null]}),(0,L.jsxs)(`div`,{className:`col-span-2 col-start-2 flex min-w-0 items-center gap-2 text-[12px] text-muted-foreground md:col-span-1 md:col-start-3`,children:[(0,L.jsx)(`span`,{"data-slot":`activity-verb`,className:r(`shrink-0 font-semibold`,Gt[d.tone]),children:d.verb}),(0,L.jsx)(`span`,{"data-slot":`activity-main`,className:r(`min-w-0 truncate text-foreground`,d.mono&&`font-mono text-xs`,m!==void 0&&`activity-slide`),children:d.main},m??`still`),d.checks&&d.checks.length>0?(0,L.jsx)(rn,{checks:d.checks.slice(0,Ni),overflow:Fi(d.checks,d.overflow),passed:h,className:`hidden w-20 shrink-0 items-center gap-[2px] sm:inline-flex`}):null,d.checkSummary?(0,L.jsx)(`span`,{"data-slot":`activity-checks-summary`,className:`sr-only`,children:d.checkSummary}):null]}),(0,L.jsx)(an,{rate:u.rate,className:`hidden h-3.5 w-[52px] md:block`}),p?(0,L.jsx)(`span`,{"data-slot":`activity-elapsed`,title:G(p),className:`col-start-3 row-start-1 justify-self-end text-[12px] text-muted-foreground tabular-nums md:col-start-5`,children:H(U(p,a.now))}):(0,L.jsx)(`span`,{className:`col-start-3 row-start-1 md:col-start-5`})]}),(0,L.jsx)(Yn,{texts:Cn(e.runId,t,i,n)}),(0,L.jsx)(qn,{runId:e.runId,requests:t,waits:n,index:i,link:o?M:P,pathOf:t=>_i(e.projectId,t,o),className:`ml-6 flex flex-col gap-0.5 md:hidden`,linkClassName:pi}),(0,L.jsx)(er,{task:e.task,requests:t,index:i,ctx:a,motion:c,projectId:e.projectId,global:o,compact:!0})]})}function Li({items:e,requestsByProject:t,waitsByProject:n,indexByProject:r,now:i,global:a,grouped:o,projectOrder:s,linkedIds:c,motion:l=$,onHover:u}){return e.length===0?null:(0,L.jsxs)(`section`,{"data-slot":`activity-working`,"aria-label":`Working and active tasks`,className:`flex min-w-0 flex-col gap-2.5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`h2`,{className:`text-[12px] font-semibold tracking-[0.06em] text-muted-foreground uppercase`,children:`Working & active`}),(0,L.jsx)(`span`,{"data-slot":`activity-working-count`,className:`inline-flex items-center rounded-full bg-muted px-2 py-0.5 text-xs font-semibold text-foreground tabular-nums`,children:e.length}),(0,L.jsx)(`span`,{className:`ml-auto hidden text-[12px] text-muted-foreground sm:inline`,children:`Live tool activity, waits, and worker trees`})]}),(0,L.jsx)(vi,{items:e,grouped:o,projectOrder:s,countSuffix:`active`,renderItems:e=>(0,L.jsx)(`div`,{className:`divide-y divide-border rounded-xl border border-card-edge bg-card shadow-card`,children:e.map(e=>{let o=r.get(e.projectId)??gi,s={now:i,titleOf:e=>o.get(e)?.title??`Unreadable task`};return(0,L.jsx)(Ii,{record:e,requests:t.get(e.projectId)??mi,waits:n.get(e.projectId)??hi,index:o,ctx:s,global:a,linked:c.has(e.runId),motion:l,onHover:u},e.runId)})})})]})}function Ri(e){let t=new Map;for(let n of e)for(let[e,r]of _n(n))t.set(e,r);return t}function zi(e,t){let n=[],r=[],i=[];for(let a of e){let e=Wr(a,t);n.push(...e.requests),r.push(...e.folding),i.push(...Kn(a.projectId,Z(a.tasks),t))}return{requests:n,folding:r,waits:i}}function Bi(e,t){if(!e)return{activeDecision:null,resolvedExternally:!1};let n=t.find(t=>t.runId===e.runId&&t.projectId===e.projectId)??null;return{activeDecision:n??e.snapshot,resolvedExternally:n===null}}function Vi(e){return e<=0?{"data-has-arcs":void 0,style:void 0,className:`relative flex min-w-0 flex-col gap-6`}:{"data-has-arcs":`true`,style:{"--activity-arc-gutter":`${e}px`},className:`relative flex min-w-0 flex-col gap-6 md:pl-(--activity-arc-gutter)`}}function Hi(e){let[t,n]=I.useState(void 0),r=I.useRef(void 0),i=I.useRef(void 0),a=I.useRef(void 0);return I.useEffect(()=>{let t=di(r.current,e);if(r.current=new Set(e.map(e=>e.runId)),t){if(a.current!==void 0&&(window.clearTimeout(a.current),a.current=void 0),i.current!==t){i.current=t,n(t);return}n(``),a.current=window.setTimeout(()=>{a.current=void 0,i.current=t,n(t)},0)}},[e]),I.useEffect(()=>()=>{a.current!==void 0&&window.clearTimeout(a.current)},[]),t}function Ui(e,t,n){if(e&&e.isConnected){e.focus({preventScroll:!0});return}(t?.querySelector(`[data-slot="activity-triage-trigger"]`)??n)?.focus({preventScroll:!0})}function Wi({projects:e,now:t,global:n,grouped:r,projectOrder:i,motion:a=$,feed:o=[],still:s=!1,paused:c=!1,emptyMessage:l}){let u=I.useRef(null),[d,f]=I.useState(null),p=I.useRef(0),[m,h]=I.useState(null),g=I.useRef(null),[_,v]=I.useState({}),ee=I.useMemo(()=>Ri(e),[e]),te=I.useMemo(()=>new Map(e.map(e=>[e.projectId,_n(e)])),[e]),y=I.useMemo(()=>new Map(e.map(e=>[e.projectId,e.requests])),[e]),b=I.useMemo(()=>new Map(e.map(e=>[e.projectId,Z(e.tasks)])),[e]),{attention:x,working:S}=I.useMemo(()=>ci(e),[e]),ne=Hi(x),C=I.useMemo(()=>e.flatMap(e=>e.requests),[e]),re=I.useMemo(()=>e.flatMap(e=>Z(e.tasks)),[e]),w=I.useMemo(()=>zi(e,a),[e,a]),T=I.useMemo(()=>[...C,...w.requests],[C,w.requests]),ie=I.useMemo(()=>[...re,...w.waits],[re,w.waits]),ae=I.useMemo(()=>new Map([...x.map(e=>[e.runId,e.projectId]),...S.map(e=>[e.runId,e.projectId])]),[x,S]),{edges:oe,gutterWidth:E}=I.useMemo(()=>Yr(T,ie,ae,a),[T,ie,ae,a]),D=_.pointer??_.focus,se=I.useMemo(()=>{let e=D?ae.get(D):void 0;return e&&D?Xr(D,y.get(e)??[],b.get(e)??[]):new Set},[D,y,ae,b]),O=I.useCallback((e,t)=>{v(n=>{if(n[e]===t)return n;let r={...n};return t===void 0?delete r[e]:r[e]=t,r})},[]),{activeDecision:ce,resolvedExternally:k}=I.useMemo(()=>Bi(m,x),[x,m]),le=I.useCallback((e,t)=>{g.current=t,h({token:++p.current,projectId:e.projectId,runId:e.runId,snapshot:e})},[]),ue=I.useCallback(()=>Ui(g.current,d,u.current),[d]),de=I.useCallback(()=>h(null),[]),A=I.useCallback((e,t)=>{h(e=>e&&(t===void 0||e.token===t)?null:e)},[]),fe=`${r}:${x.map(e=>e.runId).join(`,`)}:${S.map(e=>e.runId).join(`,`)}:${oe.map(e=>e.id).join(`,`)}`,j=x.length===0&&S.length===0;return(0,L.jsxs)(`div`,{ref:u,tabIndex:-1,className:`flex min-w-0 flex-col gap-5 outline-none`,children:[(0,L.jsx)(`p`,{"data-slot":`activity-announcement`,role:`status`,"aria-live":`polite`,className:`sr-only`,children:ne??``}),j&&l?(0,L.jsx)(`p`,{"data-slot":`activity-empty`,className:`py-6 text-[13px] text-muted-foreground`,children:l}):null,j?null:(0,L.jsxs)(`div`,{ref:f,"data-slot":`activity-stage`,...Vi(E),children:[(0,L.jsx)($r,{stage:d,edges:oe,active:D,now:t,layoutKey:fe,motion:a,paused:c||s}),(0,L.jsx)(Ci,{items:x,requestsByProject:y,waitsByProject:b,indexByProject:te,now:t,global:n,grouped:r,projectOrder:i,selectedRunId:ce?.runId,linkedIds:se,motion:a,onHover:O,onTriage:le}),(0,L.jsx)(Li,{items:S,requestsByProject:y,waitsByProject:b,indexByProject:te,now:t,global:n,grouped:r,projectOrder:i,linkedIds:se,motion:a,onHover:O})]}),(0,L.jsx)(Vr,{requests:C,closing:w.folding,index:ee,now:t,feed:o,motion:a}),(0,L.jsx)(Mi,{record:ce,selectionToken:m?.token,resolved:k,now:t,onClose:de,onResolved:A,onRestoreFocus:ue})]})}var Gi=e=>new Map(e.map(e=>[e.runId,e])),Ki=e=>e!==void 0&&gn(e)===void 0;function qi(e,t,n,r){let i=Gi(t.workers);for(let t of n.workers){let a=i.get(t.runId);!a&&K(t.status)&&r({kind:`worker-started`,projectId:e,parentId:n.runId,worker:t}),a&&K(a.status)&&!K(t.status)&&r({kind:`worker-settled`,projectId:e,parentId:n.runId,worker:t})}}function Ji(e,t,n,r){if(t.wait?.kind!==`pr`||n.wait?.kind!==`pr`||t.wait.detail.number!==n.wait.detail.number)return;let i=new Set((t.wait.detail.checks??[]).filter(e=>e.bucket===`pending`).map(e=>e.name));for(let t of n.wait.detail.checks??[])t.bucket===`pass`&&i.has(t.name)&&r({kind:`check-passed`,projectId:e,runId:n.runId,pr:n.wait.detail.number,name:t.name})}var Yi=(e,t)=>t.tool!==void 0&&(t.tool.startedAt!==e.tool?.startedAt||t.tool.title!==e.tool?.title);function Xi(e,t,n,r){t.rung!==n.rung&&r({kind:`rung-changed`,projectId:e,task:n,from:t.rung}),Yi(t,n)&&r({kind:`tool-started`,projectId:e,runId:n.runId}),qi(e,t,n,r),Ji(e,t,n,r)}function Zi(e,t,n){let r=Gi(e.tasks),i=Gi(t.tasks);for(let e of t.tasks){let i=r.get(e.runId);i?Xi(t.projectId,i,e,n):n({kind:`card-entered`,projectId:t.projectId,task:e})}for(let r of e.tasks)i.has(r.runId)||n({kind:`card-left`,projectId:t.projectId,task:r})}function Qi(e,t,n){let r=new Set(e.requests.map(e=>e.requestId)),i=new Set(t.requests.map(e=>e.requestId)),a=new Map(t.closed.map(e=>[e.requestId,e.status]));for(let e of t.requests)r.has(e.requestId)||n({kind:`request-opened`,projectId:t.projectId,request:e});for(let r of e.requests){if(i.has(r.requestId))continue;let e=a.get(r.requestId);n({kind:`request-closed`,projectId:t.projectId,request:r,...e?{status:e}:{}})}}function $i(e,t,n){let r=Z(e.tasks),i=Z(t.tasks),a=new Set(r.map(e=>e.id)),o=new Set(i.map(e=>e.id));for(let e of i)a.has(e.id)||n({kind:`wait-opened`,projectId:t.projectId,wait:e});for(let e of r)o.has(e.id)||n({kind:`wait-closed`,projectId:t.projectId,wait:e})}var ea=[`needsYou`,`working`,`waiting`,`queued`,`activeWorkers`,`openRequests`,`inReview`];function ta(e,t,n){let r=Mn(e),i=Mn(t);for(let e of ea)r[e]!==i[e]&&n({kind:`chip-changed`,chip:e,from:r[e],to:i[e]})}function na(e,t){if(e===void 0)return[];let n=[],r=e=>n.push(e),i=new Map(e.projects.map(e=>[e.projectId,e]));for(let e of t.projects){let t=i.get(e.projectId);!Ki(t)||!Ki(e)||(Zi(t,e,r),Qi(t,e,r),$i(t,e,r))}return ta(e.projects,t.projects,r),n}function ra(e){return{input:e,reconcile:!1,seq:0,motion:$,feed:[],epoch:0,...e.snapshot?{seen:e.snapshot}:{}}}function ia(e){let{plan:t,...n}=e;return{...n,motion:$,epoch:e.epoch+1}}function aa(e,t,n){let r=na(t,n);if(r.length===0)return e;let i=Date.parse(n.generatedAt),a=Or(t,n),o=r.flatMap(e=>Nr(e,a,i)??[]),s=e.seq+o.length+1,c=Un(r,s,e.input.reduced);return{...e,seq:s,feed:o.length>0?Pr(e.feed,o,i,e.seq+1):e.feed,motion:Gn(e.motion,c.changes),...c.timers.length>0?{plan:{key:s,timers:c.timers}}:{}}}function oa(e,t){let n=e.seen;if(!t||t===n)return e;let r={...e,seen:t};return!n||!e.input.active?r:e.reconcile?{...r,reconcile:!1}:aa(r,n,t)}function sa(e,t){let n=e.input;if(t.scope!==n.scope)return{...ra(t),seq:e.seq,epoch:e.epoch+1};if(t.snapshot===n.snapshot&&t.active===n.active&&t.reduced===n.reduced)return e;let r={...e,input:t};return n.active&&!t.active&&(r={...ia(r),reconcile:!0}),!n.reduced&&t.reduced&&(r=ia(r)),oa(r,t.snapshot)}var ca=`(prefers-reduced-motion: reduce)`,la=()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(ca):void 0;function ua(e){let t=la();return t?.addEventListener?.(`change`,e),()=>t?.removeEventListener?.(`change`,e)}function da(){return la()?.matches??!1}function fa(){return(0,I.useSyncExternalStore)(ua,da,()=>!1)}function pa(e,t){let n=I.useRef(new Set);I.useEffect(()=>{let e=n.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[e.epoch]),I.useEffect(()=>{for(let{after:r,change:i}of e.plan?.timers??[]){let e=setTimeout(()=>{n.current.delete(e),t(e=>({...e,motion:Gn(e.motion,[i])}))},r);n.current.add(e)}},[e.plan?.key])}function ma(e,t){let n=fa(),r=b(),i={snapshot:e,scope:t,active:r,reduced:n},[a,o]=I.useState(()=>ra(i)),s=sa(a,i);return s!==a&&o(s),pa(s,o),{motion:s.motion,feed:s.feed,reduced:n,paused:!r}}function ha(e,t){let n=Le(1e3),[r,i]=I.useState({offset:0}),a=r.offset;return ct(e)&&e!==r.generatedAt&&t!==0&&(a=Date.parse(e)-t,i({generatedAt:e,offset:a})),n+a}export{en as A,_n as C,hn as D,pn as E,G as F,U as I,H as L,K as M,Vt as N,fn as O,V as P,pt as R,gn as S,un as T,$ as _,Dr as a,X as b,Er as c,_r as d,ar as f,qn as g,tr as h,Ur as i,Kt as j,an as k,wr as l,Yn as m,ma as n,Cr as o,nr as p,Wi as r,Tr as s,ha as t,yr as u,Kn as v,Mn as w,Z as x,Cn as y};
|