@open-mercato/cezar 0.9.0-pr646.708 → 0.9.0-pr647.716

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.
Files changed (28) hide show
  1. package/dist/runs/store.d.ts +6 -0
  2. package/dist/runs/store.js +14 -4
  3. package/dist/runs/store.js.map +1 -1
  4. package/dist/server/server.js +3 -2
  5. package/dist/server/server.js.map +1 -1
  6. package/dist/workflows/run.d.ts +2 -14
  7. package/dist/workflows/run.js +7 -23
  8. package/dist/workflows/run.js.map +1 -1
  9. package/package.json +1 -1
  10. package/web/dist/assets/{compare-variants-B5BlnpUb.js → compare-variants-BR6ZhIbj.js} +1 -1
  11. package/web/dist/assets/{diff-view-CYKPGL2w.js → diff-view-CNqm5bjB.js} +3 -3
  12. package/web/dist/assets/{git-toolbar-CDII-3Uv.js → git-toolbar-A1hGl9ke.js} +1 -1
  13. package/web/dist/assets/github-CNdzanog.js +1 -0
  14. package/web/dist/assets/{index-CcfkF2Ey.js → index-MN3Lxn3t.js} +9 -9
  15. package/web/dist/assets/{repo-git-4l-2tm7d.js → repo-git-BVbeQnIX.js} +1 -1
  16. package/web/dist/assets/{run-diff-Cksr4Dk5.js → run-diff-BGNJAOm7.js} +1 -1
  17. package/web/dist/assets/run-header-fLV2ZvNw.js +1 -0
  18. package/web/dist/assets/{skills-D7hPgl4y.js → skills-DbXoq215.js} +1 -1
  19. package/web/dist/assets/{task-changes-DvIUGL9a.js → task-changes-CVIoIFuR.js} +1 -1
  20. package/web/dist/assets/{task-commits-QD2JI3zj.js → task-commits-DwIx0CP-.js} +1 -1
  21. package/web/dist/assets/{task-files-BE7JDEwK.js → task-files-tHtq2G2M.js} +2 -2
  22. package/web/dist/assets/{task-thread-CRjuPhsl.js → task-thread-D5physox.js} +5 -5
  23. package/web/dist/assets/{use-desktop-4e8LLqMG.js → use-desktop-DDySz-Hn.js} +2 -2
  24. package/web/dist/assets/workflows-mVvkUyVO.js +11 -0
  25. package/web/dist/index.html +1 -1
  26. package/web/dist/assets/github-C7SNDPf3.js +0 -1
  27. package/web/dist/assets/run-header-B3kW2sWC.js +0 -1
  28. package/web/dist/assets/workflows-bPYx0nbO.js +0 -11
@@ -0,0 +1 @@
1
+ import{a as e,s as t,u as n}from"./bundle-mjs-BegPhL5c.js";import{A as r,Et as i,Gt as a,L as o,Mt as s,Nt as c,R as l,a as u,bn as d,fn as f,ft as p,i as m,k as h,mn as ee,mt as te,t as g,un as ne,ut as _}from"./centered-state-CLmJ67EV.js";import{n as v,r as y,t as b}from"./utils-B8s5qIcK.js";import{t as x}from"./arrow-left-CnSdp92h.js";import{n as S,t as C}from"./tab-link-vtgjgL_M.js";import{t as w}from"./git-pull-request-DnR8Xh4_.js";import{t as T}from"./refresh-cw-BT8E96Tm.js";import{t as re}from"./triangle-alert-Uy8rokUh.js";import{n as E,t as ie}from"./textarea-Bj_LCreg.js";import{r as D,t as O}from"./project-router-BaWVyqc8.js";import{A as k,Ct as A,D as ae,E as oe,Et as j,F as M,Ft as N,H as P,It as F,J as se,Jt as I,Kt as ce,L,M as le,Mt as R,N as z,Nt as B,O as V,P as H,Pt as U,Qt as ue,R as W,Rt as de,St as fe,Tt as G,Yt as pe,bt as me,j as he,jt as K,k as ge,kt as q,on as _e,qt as ve,rn as ye,vt as be,wt as xe,x as Se,y as Ce,z as we}from"./index-MN3Lxn3t.js";var Te=y(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),Ee=y(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),De=y(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),J=n(t(),1),Y=e();function X({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`skeleton`,className:b(`animate-pulse rounded-md bg-accent`,e),...t})}function Z(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Oe(e,t=[]){let n=Z(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=ke(t)),n}function ke(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function Ae(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 je(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 Q(e,t,n){let r=(n??``).trim();if(!r)return Oe(e,t);let i=Z(e),a=r.startsWith(i)?i+Ae(r.slice(i.length),e):Ae(r,e),o=je(a,e)?a:`${i}\n\n${a}`;return t.length?o+ke(t):o}function Me(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 Ne(e,t,n,r,i={}){return t?{...i,workflow:t,task:Q(e,n,r)}:n.length?{...i,steps:Me(n),task:Q(e,[],r)}:{...i,workflow:`quick-task`,task:Q(e,[],r)}}function Pe(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 Fe(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))?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body}`.toLowerCase().includes(n))}function $(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))`}}var Ie={workflow:null,skills:[]},Le=`cez-followup-selection`;function Re(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function ze(){try{let e=localStorage.getItem(Le);return e?Re(JSON.parse(e)):{...Ie}}catch{return{...Ie}}}function Be(e){try{localStorage.setItem(Le,JSON.stringify(e))}catch{}}var Ve=`cez-followup-prompt:`;function He(e){try{return localStorage.getItem(Ve+e)??``}catch{return``}}function Ue(e,t){try{t===``?localStorage.removeItem(Ve+e):localStorage.setItem(Ve+e,t)}catch{}}function We({item:e,workflows:t,skills:n,workflow:o,onWorkflowChange:s,selectedSkills:c,onSkillsChange:l,engine:d,onEngineChange:te,queuedRunId:g,onQueued:ne}){let _=ee(),v=p(),y=c.filter(e=>n.some(t=>t.name===e)),[b]=(0,J.useState)(()=>Z(e)),[x,S]=(0,J.useState)(()=>He(e.url)||b),C=we(d),w=(0,J.useRef)(null);(0,J.useEffect)(()=>{Ue(e.url,x===b?``:x)},[e.url,x,b]);let T=(0,J.useMemo)(()=>k(v.data?.promptTemplates),[v.data?.promptTemplates]),re=e=>{let t=w.current,n=x===b?x.length:t?.selectionStart??x.length,r=ge(x,n,e);S(r.text),requestAnimationFrame(()=>{w.current?.focus(),w.current?.setSelectionRange(r.caret,r.caret)})},D=V(T,y),A=(0,J.useRef)(x);A.current=x;let j=(0,J.useRef)(``);(0,J.useEffect)(()=>{let e=he(A.current,j.current,D,b);j.current=e.applied,e.text!==A.current&&S(e.text)},[D,b]);let M=f({mutationFn:()=>i(Ne(e,o,y,x,W(C))),onSuccess:t=>{let n=`runs`in t?t.runs[0]:t;n&&ne(e.url,n.id),y.length>0&&v.data!==void 0&&a({skillUsage:y.reduce((e,t)=>be(e,t),v.data.skillUsage)}).then(()=>_.invalidateQueries({queryKey:r.uiState})).catch(()=>{}),Ue(e.url,``),S(b),j.current=``,_.invalidateQueries({queryKey:r.runs.all})},onError:e=>m(e.message,{tone:`danger`})}),N=e=>{oe({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(),M.isPending||M.mutate())},P=e=>l(c.includes(e)?c.filter(t=>t!==e):[...c,e]);return(0,Y.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:[(0,Y.jsx)(ce,{"aria-hidden":`true`,className:`size-3.5 text-violet`}),`Hand this to the agent`]}),(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(Ge,{workflows:t,value:o,onChange:s}),(0,Y.jsx)(Ke,{skills:n,skillUsage:v.data?.skillUsage,selected:y,onToggle:P}),(0,Y.jsx)(L,{pick:d,onChange:te,disabled:M.isPending}),(0,Y.jsx)(le,{templates:T,onInsert:re})]}),y.length>0?(0,Y.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:y.map(e=>(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>P(e),title:`Remove this skill`,className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,Y.jsx)(E,{"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,Y.jsx)(ie,{ref:w,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:x,onChange:e=>S(e.target.value),onKeyDown:N,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`}),(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2.5`,children:[(0,Y.jsxs)(u,{variant:`contrast`,"data-action":`gh-run`,disabled:M.isPending,onClick:()=>M.mutate(),children:[(0,Y.jsx)(ue,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,e.kind===`pr`?`PR`:`issue`]}),(0,Y.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:ae()}),g?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Y.jsx)(h,{"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Y.jsx)(O,{to:`/tasks/${g}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-violet hover:underline`,children:`View task →`})]}):null]})]})}function Ge({workflows:e,value:t,onChange:n}){let[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(``),s=(0,J.useRef)(null),c=G(e,a);return(0,Y.jsxs)(z,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,Y.jsx)(M,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:b(P,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,Y.jsx)(ve,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,Y.jsx)(`span`,{className:`max-w-44 truncate`,children:t??`workflow`}),(0,Y.jsx)(_e,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(H,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(K,{shouldFilter:!1,children:[(0,Y.jsx)(U,{placeholder:`search workflows…`,value:a,onValueChange:o,onInput:()=>s.current?.scrollTo(0,0)}),(0,Y.jsxs)(F,{ref:s,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,Y.jsx)(R,{children:`Nothing matches.`}):null,(0,Y.jsx)(B,{children:c.map(e=>{let r=t===e.name;return(0,Y.jsxs)(N,{value:`workflow ${e.name}`,keywords:j(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),i(!1)},children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Y.jsx)(h,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.name)})})]})]})})]})}function Ke({skills:e,skillUsage:t,selected:n,onToggle:r}){let[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(null),u=(0,J.useRef)(null),{mostUsed:d,project:f,global:p}=A(xe(e,o,t),t),m=(e,t)=>{let i=n.includes(e.name);return(0,Y.jsxs)(N,{value:`skill ${e.name} ${e.path}`,keywords:j(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":i?`true`:void 0,onSelect:()=>r(e.name),children:[(0,Y.jsx)(`span`,{className:b(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),l(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Y.jsx)(ye,{"aria-hidden":`true`,className:`size-3.5`})}),i?(0,Y.jsx)(h,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.path)};return e.length===0?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ce,{skill:c,onClose:()=>l(null)}),(0,Y.jsxs)(z,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Y.jsx)(M,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:b(P,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Y.jsx)(I,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Y.jsx)(_e,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(H,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(K,{shouldFilter:!1,children:[(0,Y.jsx)(U,{placeholder:`search skills…`,value:o,onValueChange:s,onInput:()=>u.current?.scrollTo(0,0)}),(0,Y.jsxs)(F,{ref:u,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[d.length===0&&f.length===0&&p.length===0?(0,Y.jsx)(R,{children:`Nothing matches.`}):null,d.length>0?(0,Y.jsx)(B,{heading:`Most used`,children:d.map(e=>m(e,me(e)))}):null,f.length>0?(0,Y.jsx)(B,{heading:`Project skills`,children:f.map(e=>m(e,!0))}):null,p.length>0?(0,Y.jsx)(B,{heading:`Global`,children:p.map(e=>m(e,!1))}):null]})]})})]})]})}var qe=30,Je=1e3;function Ye(){return p().data?.githubView===`prs`?(0,Y.jsx)(D,{to:`/github/prs`,replace:!0}):(0,Y.jsx)(Xe,{view:`issues`})}function Xe({view:e}){let{n:t}=ne(),n=o(),i=o({limit:Je},n.data?.available===!0),l=i.data?.available?i.data:n.data,h=i.data?.available===!0,v=ee(),y=e=>{v.setQueryData(r.uiState,t=>({...t,githubView:e})),a({githubView:e}).then(e=>v.setQueryData(r.uiState,e)).catch(e=>{m(e instanceof Error?e.message:String(e),{tone:`danger`}),v.invalidateQueries({queryKey:r.uiState})})},x=(0,J.useRef)(null),S=f({mutationFn:()=>s({refresh:!0}),onSuccess:e=>{v.setQueryData(r.github({}),e),v.invalidateQueries({queryKey:r.github({limit:Je})});let t=x.current;if(!t){v.removeQueries({queryKey:[`github`,`comments`]});return}let n=r.githubComments(t.kind,t.number);c(t.kind,t.number,{refresh:!0}).then(e=>v.setQueryData(n,e)).catch(()=>{}),v.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==d(n)})},onError:e=>m(e.message,{tone:`danger`})}),E=te(),ie=_(),D=p(),[O,k]=(0,J.useState)(()=>ze().workflow),[A,ae]=(0,J.useState)(()=>ze().skills),[oe,j]=(0,J.useState)({runner:null,model:null});(0,J.useEffect)(()=>{Be({workflow:O,skills:[...A]})},[O,A]);let M=E.data?.workflows;(0,J.useEffect)(()=>{M&&O!==null&&!M.some(e=>e.name===O)&&k(null)},[M,O]);let N=ie.data,P=D.data?.skillUsage,F=(0,J.useMemo)(()=>fe(N??[],P),[N,P]),[I,ce]=(0,J.useState)(new Map),[L,le]=(0,J.useState)(``),[R,z]=(0,J.useState)([]);if(!l)return n.isError?(0,Y.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(g,{icon:(0,Y.jsx)(re,{}),tone:`danger`,title:`Could not load GitHub`,subtitle:n.error.message})}):(0,Y.jsx)(se,{});if(x.current=null,!l.available)return(0,Y.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(g,{icon:(0,Y.jsx)(de,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:l.reason??`unknown reason`,actions:(0,Y.jsx)(u,{variant:`outline`,"data-action":`gh-retry`,disabled:S.isPending,onClick:()=>S.mutate(),children:`Try again`}),children:(0,Y.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,Y.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Y.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in cezar works without it.`]})})});let B=e===`issues`?l.issues:l.prs,V=l.labelColors??{},H=Pe(B),U=Fe(B,{query:L,labels:R}),ue=L.trim()!==``||R.length>0,W=t===void 0?null:Number.parseInt(t,10),G=W===null?U[0]??null:B.find(e=>e.number===W)??null;x.current=G?{kind:G.kind,number:G.number}:null;let me=e===`issues`?`/github`:`/github/prs`;return(0,Y.jsxs)(`div`,{"data-route":`github`,className:`flex h-full min-h-0 items-stretch`,children:[(0,Y.jsxs)(`section`,{"data-slot":`gh-list`,className:b(`w-full min-h-0 flex-col overflow-y-auto overscroll-contain border-border md:flex md:w-[360px] md:shrink-0 md:border-r`,t===void 0?`flex`:`hidden`),children:[(0,Y.jsxs)(`header`,{"data-slot":`gh-header`,className:`sticky top-0 z-10 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Y.jsx)(`h1`,{className:`text-lg font-semibold`,children:`GitHub`}),l.repo?(0,Y.jsx)(`span`,{"data-slot":`gh-repo`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,children:l.repo}):null,(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:S.isPending,onClick:()=>S.mutate(),className:`ml-auto flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px text-[10px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,Y.jsx)(T,{"aria-hidden":`true`,className:b(`size-[9px]`,S.isPending&&`motion-safe:animate-spin`)}),l.syncedAt?`synced ${q(l.syncedAt)} ago`:`refresh`]})]}),(0,Y.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,Y.jsxs)(C,{to:`/github`,active:e===`issues`,onClick:()=>y(`issues`),children:[`Issues · `,Ze(l.issues.length,h)]}),(0,Y.jsxs)(C,{to:`/github/prs`,active:e===`prs`,onClick:()=>y(`prs`),children:[`Pull requests · `,Ze(l.prs.length,h)]})]}),(0,Y.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 pb-3`,children:[(0,Y.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,Y.jsx)(pe,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,Y.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:L,onChange:e=>le(e.target.value),className:`w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,Y.jsx)($e,{options:H,colors:V,selected:R,onChange:z})]})]}),U.length===0?(0,Y.jsx)(`p`,{className:`px-4 py-4 text-sm text-soft-foreground`,children:ue?`No ${e===`issues`?`issues`:`pull requests`} match your filter.`:`No open ${e===`issues`?`issues`:`pull requests`}.`}):(0,Y.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-0.5 px-2 py-2`,children:U.map(t=>(0,Y.jsx)(Qe,{item:t,view:e,colors:V,active:G?.url===t.url,queued:I.has(t.url)},t.url))})]}),(0,Y.jsx)(`section`,{"data-slot":`gh-detail`,className:b(`min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,t===void 0?`hidden md:flex`:`flex`),children:G?(0,Y.jsx)(tt,{item:G,listPath:me,colors:V,children:(0,Y.jsx)(We,{item:G,workflows:E.data?.workflows??[],skills:F,workflow:O,onWorkflowChange:k,selectedSkills:A,onSkillsChange:ae,engine:oe,onEngineChange:j,queuedRunId:I.get(G.url)??null,onQueued:(e,t)=>ce(n=>new Map(n).set(e,t))},G.url)}):(0,Y.jsx)(g,{icon:e===`issues`?(0,Y.jsx)(Te,{}):(0,Y.jsx)(w,{}),tone:`neutral`,heading:`h2`,title:W===null?`Nothing selected`:`Not in the open list`,subtitle:W===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${W} is not among the open ${e===`issues`?`issues`:`pull requests`} — it may be closed, or still outside the fetched batch.`})})]})}function Ze(e,t){return`${e}${!t&&e>=qe?`+`:``}`}function Qe({item:e,view:t,colors:n,active:r,queued:i}){let a=e.kind===`issue`?Te:w;return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(O,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Oe(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},"data-slot":`gh-row`,"data-number":e.number,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:b(`flex flex-col gap-1 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,r&&`bg-muted`),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(a,{"aria-hidden":`true`,className:b(`size-3.5 shrink-0`,e.kind===`issue`?`text-success`:`text-violet`)}),(0,Y.jsx)(`span`,{className:b(`min-w-0 truncate text-[13px] font-medium`,r&&`font-semibold`),children:e.title})]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 pl-[22px] font-mono text-[10.5px] text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`#`,e.number]}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:e.author}),(0,Y.jsx)(`span`,{children:q(e.createdAt)}),(0,Y.jsx)(ht,{count:e.comments}),e.checks?(0,Y.jsx)(_t,{checks:e.checks}):null,i?(0,Y.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-violet`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,Y.jsx)(`span`,{className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Y.jsx)(et,{label:e,color:n[e]},e))}):null]})})}function $e({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,J.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Y.jsxs)(z,{open:i,onOpenChange:a,children:[(0,Y.jsx)(M,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:b(`flex shrink-0 items-center gap-1 rounded-md border border-input bg-card px-2 py-1 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-primary/60 text-foreground`),children:[(0,Y.jsx)(De,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,Y.jsx)(H,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Y.jsxs)(K,{children:[(0,Y.jsx)(U,{placeholder:`Filter labels…`}),(0,Y.jsxs)(F,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Y.jsx)(R,{children:`No labels.`}),n.length>0?(0,Y.jsxs)(N,{value:`__clear__`,onSelect:()=>r([]),className:`text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,Y.jsxs)(N,{value:e,onSelect:()=>o(e),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:$(t[e])}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Y.jsx)(h,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e)})]})]})})]})}function et({label:e,color:t}){return(0,Y.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:$(t),className:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function tt({item:e,listPath:t,colors:n,children:r}){let i=e.kind===`pr`?`pull request`:`issue`,a=e.kind===`pr`&&!!(e.additions||e.deletions);return(0,Y.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Y.jsxs)(O,{to:t,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Y.jsx)(x,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,Y.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[10.5px] text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Y.jsx)(`span`,{children:i}),`·`,(0,Y.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Y.jsxs)(`span`,{children:[q(e.createdAt),` ago`]}),e.comments?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsx)(ht,{count:e.comments})]}):null,a?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,v(e.url)?(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Y.jsx)(S,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Y.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),(0,Y.jsx)(`h2`,{className:`mt-2 text-xl leading-snug font-semibold`,children:e.title}),e.labels.length>0||e.checks?(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Y.jsx)(et,{label:e,color:n[e]},e)),e.checks?(0,Y.jsx)(gt,{checks:e.checks,url:e.url}):null]}):null,(0,Y.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,Y.jsx)(Se,{children:e.body}):(0,Y.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Y.jsx)(nt,{item:e,colors:n}),r]})}function nt({item:e,colors:t}){let n=l(e.kind,e.number),r=n.data,i=(0,J.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(rt(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,Y.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Y.jsx)(X,{className:`mb-3 h-3 w-24`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(X,{className:`h-14 w-full`}),(0,Y.jsx)(X,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Y.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Y.jsx)(S,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Y.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Y.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Y.jsx)(`ul`,{className:`flex flex-col gap-5`,children:it(i).map(e=>e.group===`commits`?(0,Y.jsx)(at,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Y.jsx)(dt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Y.jsx)(st,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Y.jsx)(S,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var rt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function it(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 at({commits:e,colors:t}){let[n,r]=(0,J.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:ot.committed}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Y.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Y.jsx)(st,{event:e,colors:t},e.id))]}):(0,Y.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:ot.committed}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Y.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:q(e[e.length-1].createdAt)})]})})}var ot={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function st({event:e,colors:t}){return(0,Y.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:b(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:ot[e.kind]}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Y.jsx)(ct,{event:e,colors:t}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:q(e.createdAt)}),e.url?(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(S,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function ct({event:e,colors:t}){switch(e.kind){case`committed`:return(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Y.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Y.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Y.jsx)(lt,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Y.jsx)(`span`,{"data-slot":`gh-event-label`,style:$(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[10px]`,children:e.label.name}):null,(0,Y.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,Y.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,Y.jsx)(`span`,{children:`merged this`});case`closed`:return(0,Y.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,Y.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,Y.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,Y.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,Y.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function lt({checks:e}){return e?(0,Y.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:b(`shrink-0`,mt[e]),children:pt[e]}):null}var ut={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function dt({comment:e}){let t=e.reviewState?ut[e.reviewState]:null;return(0,Y.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Y.jsx)(ft,{url:e.avatarUrl,login:e.author}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Y.jsx)(`span`,{children:q(e.createdAt)}),t?(0,Y.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:b(`rounded-full border px-1.5 py-px font-sans text-[10px] font-medium`,t.tone),children:t.label}):null,(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(S,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Y.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Y.jsx)(Se,{children:e.body}):(0,Y.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function ft({url:e,login:t}){let[n,r]=(0,J.useState)(!1);return e&&!n?(0,Y.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,Y.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var pt={passing:`✓`,failing:`✗`,pending:`○`},mt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function ht({count:e}){return e?(0,Y.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,Y.jsx)(Ee,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function gt({checks:e,url:t}){let n=b(`text-[11px] font-medium`,mt[e],t&&`hover:underline`),r=`${pt[e]} checks ${e}`;return t?(0,Y.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Y.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function _t({checks:e}){return(0,Y.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:b(`shrink-0 font-sans text-[11px] font-semibold`,mt[e]),children:pt[e]})}export{Ye as GithubIndexRoute,Xe as GithubRoute};