@wjarka/cezarion 0.18.0-dev.6646 → 0.18.0-dev.6703

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 (46) hide show
  1. package/package.json +2 -2
  2. package/web/dist/assets/activity-motion-DhLXb8Pt.js +2 -0
  3. package/web/dist/assets/{activity-route--Qj4NT9h.js → activity-route-CpwAMYLn.js} +1 -1
  4. package/web/dist/assets/{agent-accounts-BxpWcFS3.js → agent-accounts-Bc0LJ4SB.js} +1 -1
  5. package/web/dist/assets/attention-BF8NA1XM.js +1 -0
  6. package/web/dist/assets/{commit-diff-panel-DOgakNKv.js → commit-diff-panel-B1KZl0GP.js} +1 -1
  7. package/web/dist/assets/{diff-MoyKcT8Q.js → diff-Ci-qd1lU.js} +2 -2
  8. package/web/dist/assets/{diff-view-BFQcOCEf.js → diff-view-CWZElKoD.js} +1 -1
  9. package/web/dist/assets/{file-preview-BancpZHA.js → file-preview-CoWRr13R.js} +1 -1
  10. package/web/dist/assets/{git-toolbar-ClMasBRM.js → git-toolbar-BYIni94R.js} +1 -1
  11. package/web/dist/assets/{github-BVZ01nJq.js → github-CAPNq5vY.js} +1 -1
  12. package/web/dist/assets/{global-activity-route-DTgywy--.js → global-activity-route-DLEwsMA7.js} +1 -1
  13. package/web/dist/assets/index-CpwAOct4.js +17 -0
  14. package/web/dist/assets/{preview-pane-connected-B5PCWA9a.js → preview-pane-connected-CGw_9VuF.js} +2 -2
  15. package/web/dist/assets/{project-router-CiB1O_5A.js → project-router-oKsNlPN6.js} +1 -1
  16. package/web/dist/assets/{project-scope-context-CSPQyWoO.js → project-scope-context-BBVJVcJp.js} +1 -1
  17. package/web/dist/assets/{prompt-template-menu-VwBcsbqE.js → prompt-template-menu-BZTz2mIG.js} +1 -1
  18. package/web/dist/assets/queries-Be8VyHam.js +1 -0
  19. package/web/dist/assets/{reference-chip-DT-_ninM.js → reference-chip-Ht4xX9-k.js} +1 -1
  20. package/web/dist/assets/{repo-git-7KuJaDRk.js → repo-git-CzVLCWig.js} +1 -1
  21. package/web/dist/assets/{report-reader-CgY75QM2.js → report-reader-iTBkUgg-.js} +1 -1
  22. package/web/dist/assets/reports-BJF1Cl3C.js +1 -0
  23. package/web/dist/assets/run-header-BxB6gyt1.js +2 -0
  24. package/web/dist/assets/{skills-Dnrta_-m.js → skills-DvgHKWgK.js} +1 -1
  25. package/web/dist/assets/{tab-link-BPBiho7-.js → tab-link-Buy1fRFO.js} +1 -1
  26. package/web/dist/assets/{task-changes-C6sDd3Le.js → task-changes-CStxhLFG.js} +1 -1
  27. package/web/dist/assets/{task-commits-CQHxnFJ5.js → task-commits-DhpOAdOf.js} +1 -1
  28. package/web/dist/assets/{task-files-DK8Demuc.js → task-files-COmKUUfN.js} +1 -1
  29. package/web/dist/assets/{task-github-item-DgmmFFtN.js → task-github-item-BNLeAz58.js} +1 -1
  30. package/web/dist/assets/{task-thread-Dg9VWJq6.js → task-thread-DjSFvEQe.js} +6 -6
  31. package/web/dist/assets/{thread-state-DIMUAyFk.js → thread-state-B5tTsVNm.js} +1 -1
  32. package/web/dist/assets/use-desktop-BPWIJ0Kw.js +1 -0
  33. package/web/dist/assets/{use-hand-to-agent-state-D-yaVRRx.js → use-hand-to-agent-state-Ce6QW2j_.js} +1 -1
  34. package/web/dist/assets/{useInfiniteQuery-Q8eFXz-L.js → useInfiniteQuery-Yn58_Fkn.js} +1 -1
  35. package/web/dist/assets/useQuery-C1xFF0nd.js +1 -0
  36. package/web/dist/assets/{workflows-W_uriBcj.js → workflows-CN8uKYnY.js} +1 -1
  37. package/web/dist/assets/{ws-B-tB133E.js → ws-DbXGHAke.js} +1 -1
  38. package/web/dist/index.html +12 -12
  39. package/web/dist/assets/activity-motion-CEnf2rDh.js +0 -2
  40. package/web/dist/assets/attention-BDa7opY9.js +0 -1
  41. package/web/dist/assets/index-CsOa03VW.js +0 -17
  42. package/web/dist/assets/queries-pj368bmB.js +0 -1
  43. package/web/dist/assets/reports-CxTUchWh.js +0 -1
  44. package/web/dist/assets/run-header-BcX23gw7.js +0 -2
  45. package/web/dist/assets/use-desktop-Bq_Qh5ur.js +0 -1
  46. package/web/dist/assets/useQuery-BoLjCS2U.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{A as t,M as n}from"./button-DGwhwRuD.js";import{i as r}from"./react-runtime-CCIEwYL0.js";import{n as i,t as a}from"./live-refetch-CZb2VOyu.js";import{$ as o,At as s,B as c,Bt as l,Cn as u,Ct as d,Dt as f,En as p,Et as m,F as h,Fr as g,Ft as _,H as v,Hr as y,I as ee,Ir as te,It as ne,J as re,Jt as ie,K as ae,Kr as oe,L as se,Lr as ce,M as le,Mr as ue,Mt as de,Nr as fe,Nt as pe,Ot as me,Pr as he,Pt as ge,Q as _e,Qr as ve,Qt as ye,R as be,Rr as xe,St as Se,Tn as Ce,U as we,V as Te,Vr as b,Vt as Ee,X as x,Xr as De,Y as Oe,Z as ke,_ as Ae,_n as je,_t as Me,ai as Ne,at as Pe,b as Fe,bn as Ie,bt as Le,c as Re,cn as ze,ct as Be,dt as Ve,et as He,fn as Ue,ft as We,g as Ge,gn as Ke,gt as qe,hn as Je,ht as Ye,i as Xe,it as Ze,j as Qe,jt as $e,kt as et,li as tt,ln as nt,lt as rt,m as it,mt as at,nt as ot,oi as st,on as ct,ot as lt,pr as ut,pt as dt,qr as ft,qt as pt,r as mt,ri as S,sn as ht,st as gt,ti as _t,tt as vt,un as yt,ut as bt,v as xt,vr as St,vt as Ct,wr as wt,x as Tt,xn as Et,xt as Dt,yr as Ot,yt as kt,z as At,zr as jt}from"./project-scope-context-CSPQyWoO.js";import{F as C,I as Mt,M as Nt,dt as w}from"./live-protocol-aMLJJ0MQ.js";import{t as T}from"./useInfiniteQuery-Q8eFXz-L.js";import{t as E}from"./useQuery-BoLjCS2U.js";import{n as Pt,r as D,t as Ft}from"./ws-B-tB133E.js";import{n as It}from"./toaster-CoMJoQvk.js";var Lt=class extends oe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Rt(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=ft({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),w.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Rt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var zt=class extends tt{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),Ne(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&De(t.mutationKey)!==De(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Rt();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){w.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Bt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Vt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Ht=class extends tt{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,w.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!Ne(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Bt(e,n).forEach(e=>{e.destroy()}),Bt(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=S(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new y(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Vt(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&w.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},O=e(r(),1);function k({queries:e,...t},n){let r=b(n),i=jt(),a=xe(),o=O.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{ue(e);let t=r.getQueryCache().get(e.queryHash);g(e,a,t)}),ce(a);let[s]=O.useState(()=>new Ht(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;O.useSyncExternalStore(O.useCallback(e=>d?s.subscribe(w.batchCalls(e)):_t,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),O.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>he(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&he(n,e)?fe(n,new y(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&te({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function A(e,t){let n=b(t),[r]=O.useState(()=>new zt(n,e));O.useEffect(()=>{r.setOptions(e)},[r,e]);let i=O.useSyncExternalStore(O.useCallback(e=>r.subscribe(w.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=O.useCallback((e,t)=>{r.mutate(e,t).catch(_t)},[r]);if(i.error&&st(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function j(e={}){let t=e.projectId??n();return{projectId:t,cacheScope:e.cacheScope??(e.boot?`default`:t)}}function M(e,t={}){return{...j(t),runId:e}}var N=[`workspace`,`runs-index`],P=e=>[e.cacheScope,`runs`,`list`],F=e=>[e.cacheScope,`runs`,`detail`,e.runId],I=e=>typeof e==`function`?e():e;function Ut(e){let{seenAt:t,...n}=e;return n}function Wt(e,t){let n=Ut(e);return t.seenAt===void 0?n:{...n,seenAt:t.seenAt}}function L(e,t,n){return t?{...e,seenAt:n}:Ut(e)}function Gt(e){let t=()=>{e.invalidateQueries({queryKey:N})};function r(r,i){if(r===`index`)return t();let a=typeof i==`function`?i():i;if(r===`indexed`){t(),e.invalidateQueries({queryKey:[n(),`runs`]}),e.invalidateQueries({queryKey:[a.projectId,`runs`,`list`]});return}if(r===`runs`)return e.invalidateQueries({queryKey:[a.cacheScope,`runs`]});let o=Ot(),s=[a.projectId,a.cacheScope],c=o!==void 0&&s.some(e=>e===o||e==="default")?[o,`default`]:[],l=new Set([...s,...c,n()]);return Promise.all([...l].map(t=>e.invalidateQueries({queryKey:[t,`runs`]}))).then(()=>void 0)}async function i(n,r){await e.cancelQueries({queryKey:P(I(n))}),await e.cancelQueries({queryKey:F(I(n))});let i=e.getQueryData(P(I(n))),a=e.getQueryData(F(I(n))),o=I(n).runId,s=new Date().toISOString();return e.setQueryData(P(I(n)),e=>e?.map(e=>e.id===o?L(e,r,s):e)),e.setQueryData(F(I(n)),e=>e&&L(e,r,s)),{id:o,prevList:i,prevDetail:a,rollback(){if(!r){i&&e.setQueryData(P(I(n)),i),a&&e.setQueryData(F(I(n)),a);return}let t=i?.find(e=>e.id===o);t&&e.setQueryData(P(I(n)),e=>e?.map(e=>e.id===o?Wt(e,t):e)),a&&e.setQueryData(F(I(n)),e=>e&&Wt(e,a))},settle(i){let a=e=>e.id===(r?o:i.id)?L(e,r,i.seenAt):e;e.setQueryData(P(I(n)),e=>e?.map(a));let s={...I(n),runId:r?o:i.id};e.setQueryData(F(s),e=>e?a(e):i),t()}}}async function a(t,n){await e.cancelQueries({queryKey:N});let i=e.getQueryData(N),a=n();return e.setQueryData(N,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===t.projectId&&e.id===t.runId?a(e):e)}),{previous:i,rollback(){i&&e.setQueryData(N,i)},settle(){r(`indexed`,t)}}}return{patchRead:i,patchIndex:a,invalidateAfter:r}}function R(){let e=b();return(0,O.useMemo)(()=>Gt(e),[e])}function Kt(e){return e.type===`run`?e.run.id:e.id}function z(e,t){return{...e,runs:t}}function qt(e,t){let n=0;for(let r of e)r.projectId===t&&r.archived&&(n+=1);return n}function Jt(e,t){let n=e.findIndex(e=>(e.createdAt??``).localeCompare(t.createdAt)<0),r=[...e];return r.splice(n<0?e.length:n,0,t),r}function Yt(e,t,n){return n?n.has(t):e.runs.some(e=>e.projectId===t)}function Xt(e,t,n){let{project:r}=t,i=Kt(t),a=e.runs.findIndex(e=>e.projectId===r&&e.id===i),o=a>=0?e.runs[a]:void 0,s=e.truncated.includes(r);if(t.type===`deleted`)return o?{index:z(e,e.runs.filter((e,t)=>t!==a)),reconcile:s&&o.archived}:{index:e,reconcile:!1};let{run:c}=t;if(c.delegation?.role===`worker`)return o?{index:z(e,e.runs.filter((e,t)=>t!==a)),reconcile:!1}:{index:e,reconcile:!1};if(!o&&!Yt(e,r,n))return{index:e,reconcile:!0};let l=S(o,{projectId:r,...c});if(o){if(l===o)return{index:e,reconcile:!1};let t=[...e.runs];t[a]=l;let n=o.archived!==l.archived&&(s||qt(t,r)>e.perProjectLimit);return{index:z(e,t),reconcile:n}}if(s)return Qt(e,l);let u=Jt(e.runs,l);return{index:z(e,u),reconcile:l.archived&&qt(u,r)>e.perProjectLimit}}function Zt(e,t){let n;for(let r of e)r.projectId===t&&r.archived&&(n===void 0||r.createdAt<n)&&(n=r.createdAt);return n}function Qt(e,t){let n=Zt(e.runs,t.projectId),r=n!==void 0&&t.createdAt>n;return t.archived&&!r?{index:e,reconcile:!1}:{index:z(e,Jt(e.runs,t)),reconcile:t.archived||n===void 0||t.createdAt<n}}function $t(e,t,n){let r=!1,i=e.runs.map(e=>{if(e.projectId!==t)return e;let i=n[e.id];if(i){let t=S(e.usage,i);return t===e.usage?e:(r=!0,{...e,usage:t})}if(e.usage===void 0)return e;r=!0;let{usage:a,...o}=e;return o});return r?z(e,i):e}function en(e,t){let n=e.runs.filter(e=>e.projectId!==t),r=e.truncated.filter(e=>e!==t),i=Object.prototype.hasOwnProperty.call(e.referenceStatuses,t);if(n.length===e.runs.length&&r.length===e.truncated.length&&!i)return e;let a={...e.referenceStatuses};return delete a[t],{...e,runs:n,truncated:r,referenceStatuses:a}}function tn(){return{stream:void 0,lastStream:void 0,mismatch:void 0,floor:void 0,changes:new Map}}function nn(e,t,n){if(e.lastStream===t)e.floor=Math.max(e.floor??n,n);else{for(let[n,r]of e.changes)r.generation!==t&&e.changes.delete(n);e.floor=n}e.stream=t,e.lastStream=t,e.mismatch=void 0}function rn(e){e.stream=void 0}function an(e,t,n=!1){let r=e.stream;if(r===void 0)return!1;(e.floor===void 0||n)&&(e.floor=t.seq-1);let i=JSON.stringify([r,t.project,Kt(t)]),a=e.changes.get(i);return(!a||a.seq<t.seq)&&e.changes.set(i,{...t,generation:r}),!0}function on(e,t){for(let[n,r]of e.changes)r.project===t&&e.changes.delete(n)}function sn(e){return typeof e.generation==`string`&&typeof e.eventSeq==`number`}function cn(e,t,n){if(!sn(t))return{index:t,reconcile:!1};let{generation:r,eventSeq:i}=t;if(e.stream!==void 0&&e.stream!==r){let n=e.mismatch!==r;return e.mismatch=r,{index:t,reconcile:n}}let a=e.lastStream===r&&e.floor!==void 0,o=a&&i<e.floor,s=t,c=o,l=[...e.changes.entries()].filter(([,e])=>e.generation===r),u=l.map(([,e])=>e).filter(e=>e.seq>i).sort((e,t)=>e.seq-t.seq);for(let e of u){let t=Xt(s,e,n);s=t.index,c||=t.reconcile}for(let[t,n]of l)n.seq<=i&&e.changes.delete(t);return a&&!o&&(e.floor=i),{index:s,reconcile:c}}var B=[`workspace`,`runs-index`],ln=[`workspace`,`projects`],un=6e4,dn=100,fn=new WeakMap;function V(e){let t=fn.get(e);return t||(t=_n(e),fn.set(e,t)),t}function pn(e,t){return typeof e!=`object`||!e||!Array.isArray(e.runs)?e:V(t).merge(e)}function mn(e){let t=e.getQueryData(ln)?.projects;return t?new Set(t.map(e=>e.id)):void 0}function hn(e,t,n){if(!(!e||typeof e.eventSeq!=`number`||typeof t.eventSeq!=`number`))return e.generation===t.generation?t.eventSeq<e.eventSeq?e:void 0:n!==void 0&&e.generation===n&&t.generation!==n?e:void 0}function gn(e,t){return t.type===`run-summary`?{type:`run`,project:e,seq:t.seq,run:t.summary}:{type:`deleted`,project:e,seq:t.seq,id:t.id}}function _n(e){let t=tn(),n=[],r,i,a,o,s=!1,c=-1/0,l=new Set,u=!1,d,f=!1,p=()=>{if(!u){if(u=!0,d?.()){f=!0;return}_({hold:!0})}},m=t=>{c=Date.now(),e.setQueryData(B,t)},h=()=>e.getQueryData(B),g=()=>{clearTimeout(a),a=void 0;let t=e.getQueryCache().find({queryKey:B,exact:!0}),n=(t!==void 0&&t.state.data===void 0&&t.state.fetchStatus!==`idle`?e.cancelQueries({queryKey:B,exact:!0}).then(()=>e.invalidateQueries({queryKey:B})):e.invalidateQueries({queryKey:B})).catch(()=>void 0).finally(()=>{o===n&&(o=void 0,s&&(s=!1,g()))});return o=n,n},_=(e={})=>o?(s=!0,o):e.hold?(a??=setTimeout(()=>{g()},400),Promise.resolve()):g(),v=()=>{r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0;let t=n;n=[];let a=h();if(!a||t.length===0)return;let o=mn(e),s=a,c=!1;for(let e of t){if(e.generation!==a.generation)continue;if(e.type===`usage`){l.has(e.project)||(s=$t(s,e.project,e.usage));continue}if(l.has(e.change.project)||e.change.seq<=a.eventSeq)continue;let t=Xt(s,e.change,o);s=t.index,c||=t.reconcile}s!==a&&m(s),c&&_({hold:!0})},y=()=>{if(i!==void 0)return;let e=c+250-Date.now();if(e>0){i=setTimeout(v,e);return}i=setTimeout(v,dn),typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(v))};return{ready(e,n){nn(t,e,n),u=!1,f&&(f=!1,_({hold:!0}))},detach(){rn(t)},run(e,r,i=!1){if(l.has(e))return;let a=gn(e,r);if(!an(t,a,i)){p();return}n.push({type:`change`,change:a,generation:t.stream}),y()},usage(e,r){if(!l.has(e)){if(t.stream===void 0){p();return}n.push({type:`usage`,project:e,usage:r,generation:t.stream}),y()}},dropProject(e){l.add(e),on(t,e),n=n.filter(t=>(t.type===`change`?t.change.project:t.project)!==e);let r=h();if(!r)return;let i=en(r,e);i!==r&&m(i)},setUnknownGenerationHandler(e){d=e},restoreProject(e){l.delete(e)},merge(n){let r=h(),i=cn(t,n,mn(e));for(let e of l)i.index=en(i.index,e);return i.reconcile&&queueMicrotask(()=>{_({hold:!0})}),hn(r,n,t.stream)??i.index},reconcile:_,flush:v,stop(){r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0,clearTimeout(a),a=void 0,n=[],s=!1}}}var vn={draft:{label:`Draft`,hint:`the author has not marked it ready for review`,tone:`neutral`},"review-required":{label:`Waiting for review`,hint:`checks are fine, no one has reviewed it yet`,tone:`info`},"changes-requested":{label:`Changes requested`,hint:`a reviewer asked for edits before this can merge`,tone:`danger`},"checks-pending":{label:`Checks running`,hint:`CI has not finished on the latest commit`,tone:`pending`},"checks-failing":{label:`Checks failing`,hint:`CI is red on the latest commit`,tone:`danger`},ready:{label:`Ready to merge`,hint:`open, checks pass, nothing is waiting on a reviewer`,tone:`success`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`merged`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`success`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`accent`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},yn={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function bn(e){return typeof e==`string`&&Object.hasOwn(vn,e)}function xn(e){return e!==void 0&&bn(e)?vn[e]:void 0}var Sn=`cez.reference-statuses.v1`,Cn=`cez.reference-conflicts.v1`,H=new Map(En()),wn=1e3;function U(e,t){if(H.get(e)!==t){for(H.delete(e),H.set(e,t);H.size>wn;){let e=H.keys().next().value;if(e===void 0)break;H.delete(e)}On()}}var W=new Set(Dn());function Tn(e,t){if(W.has(e)!==t){if(t)for(W.add(e);W.size>wn;){let e=W.values().next().value;if(e===void 0)break;W.delete(e)}else W.delete(e);On()}}function En(){try{let e=globalThis.sessionStorage?.getItem(Sn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&bn(e[1])):[]}catch{return[]}}function Dn(){try{let e=globalThis.sessionStorage?.getItem(Cn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var G;function On(){G===void 0&&(G=setTimeout(()=>{G=void 0;try{globalThis.sessionStorage?.setItem(Sn,JSON.stringify([...H])),globalThis.sessionStorage?.setItem(Cn,JSON.stringify([...W]))}catch{}},250))}var K=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function q(e,t){return{...e?{status:e}:{},...t?{conflicting:!0}:{}}}function kn(e){return[...e.prs.map(t=>({projectId:e.projectId,kind:`PR`,number:t})),...e.issues.map(t=>({projectId:e.projectId,kind:`Issue`,number:t}))]}function An(e,t,n,r,i,a){let o=r.prs[n.number]??r.issues[n.number];if(!o){e.set(t,{state:`unknown`,...i?{status:i}:{}});return}let s=r.conflicts?r.conflicts.includes(n.number):void 0;U(t,o),s!==void 0&&Tn(t,s),e.set(t,{state:`ready`,status:o,...s??a?{conflicting:!0}:{}})}function jn(e,t,n){let r=K(t),i=H.get(r),a=W.has(r)?!0:void 0,o=n.data;if(o?.available){An(e,r,t,o,i,a);return}if(o){e.set(r,{state:`unavailable`,reason:o.reason,...q(i,a)});return}if(n.isError){e.set(r,{state:`unavailable`,reason:n.error instanceof Error?n.error.message:void 0,...q(i,a)});return}e.set(r,{state:`loading`,...q(i,a)})}function Mn(e,t){let n=new Map;return t.forEach((t,r)=>{let i=e[r];if(i)for(let e of kn(i))jn(n,e,t)}),n}function Nn(e){if(!e)return;let t=e.trim().replace(/\/+$/,``),n=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(t),r=n?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(t),i=n??r;if(!i)return;let[,a,o]=i;if(!o||a?.toLowerCase()!==`github.com`)return;let s=o.replace(/\.git$/i,``).split(`/`).filter(Boolean),c=s[s.length-2],l=s[s.length-1];return c&&l?`https://github.com/${c}/${l}`:void 0}function Pn(e){let t=new Map;for(let n of e)for(let e of n.tags??[]){let n=e.toLowerCase();t.has(n)||t.set(n,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function Fn(e,t,n,r=8){let i=n.trim().toLowerCase(),a=new Set(t.map(e=>e.toLowerCase())),o=e.filter(e=>{let t=e.toLowerCase();return a.has(t)?!1:i===``||t.includes(i)&&t!==i});return i===``?o.slice(0,r):o.sort((e,t)=>Number(t.toLowerCase().startsWith(i))-Number(e.toLowerCase().startsWith(i))||e.localeCompare(t,void 0,{sensitivity:`base`})).slice(0,r)}function In(e){let t=new Map;for(let n of e){let e=n.trim();if(!e)continue;let r=e.toLowerCase();t.has(r)||t.set(r,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function Ln(e){if(!e.available)return;let t=e.issuesNextCursor,n=e.prsNextCursor;if(!(t===void 0&&n===void 0)&&!(!t&&!n))return{...t?{issuesCursor:t}:{issuesDone:!0},...n?{prsCursor:n}:{prsDone:!0}}}function Rn(e,t){return e?(t===`issues`?e.issuesNextCursor:e.prsNextCursor)==null:!1}function zn(e,t,n){for(let r of e)t.has(r.number)||(t.add(r.number),n.push(r))}function Bn(e){let t=e[0];if(!t)return;let n=e[e.length-1],r=[],i=[],a=new Set,o=new Set,s={};for(let t of e){zn(t.issues,a,r),zn(t.prs,o,i);for(let[e,n]of Object.entries(t.labelColors??{}))s[e]??=n}let c=e.find(e=>e.projects)?.projects,l=e.map(e=>e.projectsState),u=e.find(e=>e.projectsState===`unavailable`),d=l.includes(`refreshing`)?`refreshing`:u?`unavailable`:l.some(e=>e===`ready`)?`ready`:void 0,{projectsGeneration:f,projectsReason:p,...m}=t;return{...m,issues:r,prs:i,...Object.keys(s).length>0?{labelColors:s}:{},...c?{projects:c}:{},...d?{projectsState:d}:{},...d===`unavailable`&&u?.projectsReason?{projectsReason:u.projectsReason}:{},...`issuesNextCursor`in n?{issuesNextCursor:n.issuesNextCursor}:{},...`prsNextCursor`in n?{prsNextCursor:n.prsNextCursor}:{}}}var J=e=>e.map(e=>e.number).join(`,`);function Vn(e,t){let n=e[0];if(e.length>1&&n&&(J(n.issues)!==J(t.issues)||J(n.prs)!==J(t.prs)||n.issuesTotal!==t.issuesTotal||n.prsTotal!==t.prsTotal))return`refetch`;let r=t;if(n&&t.available&&t.projectsState===`refreshing`&&n.repo===t.repo){let e=new Map(n.issues.map(e=>[e.number,e.projectIds]));r={...t,issues:t.issues.map(t=>{let n=e.get(t.number);return t.projectIds===void 0&&n!==void 0?{...t,projectIds:n}:t})}}return[r,...e.slice(1)]}var Y={get health(){return[n(),`health`]},runs:{get all(){return[n(),`runs`]},relationships:e=>[n(),`runs`,`relationships`,e],list:(e=n())=>[e,`runs`,`list`],archived:e=>[n(),`runs`,`archived`,e],detail:(e,t=n())=>[t,`runs`,`detail`,e],diff:e=>[n(),`runs`,`diff`,e],changes:e=>[n(),`runs`,`changes`,e],file:(e,t)=>[n(),`runs`,`files`,e,t],handoff:e=>[n(),`runs`,`handoff`,e],commits:e=>[n(),`runs`,`commits`,e],commit:(e,t)=>[n(),`runs`,`commit`,e,t]},get workflows(){return[n(),`workflows`]},get skills(){return[n(),`skills`]},get skillsReady(){return[n(),`skills`,`ready`]},get importableSkills(){return[n(),`skills`,`importable`]},get importableSkillsReady(){return[n(),`skills`,`importable`,`ready`]},get repo(){return[n(),`repo`]},get repoChanges(){return[n(),`repo`,`changes`]},repoCommit:e=>[n(),`repo`,`commit`,e],get repoBranches(){return[n(),`repo`,`branches`]},get uiState(){return[n(),`ui-state`]},get config(){return[n(),`config`]},get agentConfig(){return[n(),`agent-config`]},agentConfigFile:e=>[n(),`agent-config`,`file`,e],get worktrees(){return[n(),`worktrees`]},github:(e={})=>[n(),`github`,e.limit??null],githubPages:e=>[n(),`github`,`pages`,e],githubPagesHead:e=>[n(),`github`,`pages-head`,e],githubCommentCounts:(e,t)=>[n(),`github`,`comment-counts`,e,[...t].sort((e,t)=>e-t).join(`,`)],githubChecks:e=>[n(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[n(),`github`,`search`,e,t],githubRefStatus:(e,t,n)=>[e,`github`,`ref-status`,[...t].sort((e,t)=>e-t).join(`,`),[...n].sort((e,t)=>e-t).join(`,`)],githubComments:(e,t)=>[n(),`github`,`comments`,e,t],githubItem:(e,t)=>[n(),`github`,`item`,e,t],githubRefStatusOf:e=>[e,`github`,`ref-status`],githubPrChanges:e=>[n(),`github`,`pr-changes`,e],githubMergeState:e=>[n(),`github`,`merge-state`,e],get openTargets(){return[n(),`open-targets`]}},X={models:e=>[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],projects:[`workspace`,`projects`],githubOwners:[`workspace`,`github-owners`],runsIndex:B,runsSearch:e=>[`workspace`,`runs-search`,e],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],agentProfiles:[`workspace`,`agent-profiles`],agentAccountDetails:e=>[`workspace`,`agent-profiles`,`details`,e],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...X.fsBrowseRoot,e,t]};function Z(e,t,n=`active`){return e.invalidateQueries({queryKey:t===void 0?[`workspace`,`models`]:X.models(t),refetchType:n})}function Q(e,t=!0){let n=b();return(0,O.useEffect)(()=>{if(!t||e!==`cursor`)return;let r,i=()=>{let e=n.getQueryData(Y.health)?.capabilities?.localHandoff===!0;e&&!r?r=Ft(`models:cursor`,e=>{let t=Mt.safeParse(e);t.success&&t.data.runner===`cursor`&&(n.cancelQueries({queryKey:X.models(`cursor`)}),n.setQueryData(X.models(`cursor`),t.data))}):!e&&r&&(r(),r=void 0)};i();let a=n.getQueryCache().subscribe(i);return()=>{a(),r?.()}},[t,e,n]),E({queryKey:X.models(e),queryFn:({signal:t})=>C(e)?f(e,{signal:t}):Promise.reject(Error(`${e} has no host model catalog`)),staleTime:300*1e3,enabled:t&&C(e)})}function Hn(e=!0){return{claude:Q(`claude`,e),codex:Q(`codex`,e),opencode:Q(`opencode`,e),pi:Q(`pi`,e),cursor:Q(`cursor`,e),omp:Q(`omp`,e)}}function Un(){let e=b();return E({queryKey:X.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(X.providerStatus),r=await We(!1,{signal:t});return ut(n,e.getQueryData(X.providerStatus),r)},staleTime:5*6e4,refetchInterval:a(!1),refetchOnWindowFocus:!0})}function Wn(){let e=b();return A({mutationFn:()=>We(!0),onMutate:()=>e.getQueryData(X.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(X.providerStatus,e=>ut(r,e,t)),Z(e)}})}function Gn(){let e=b();return A({mutationFn:({provider:e,authFailureId:t})=>Ue(e,t),onMutate:()=>e.getQueryData(X.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(X.providerStatus,e=>ut(r,e,t,n.authFailureId)),C(n.provider)&&Z(e,n.provider)}})}function Kn(e={}){return E({queryKey:X.projects,queryFn:({signal:e})=>Ve({signal:e}),...e})}function qn(e,t=!1){return E({queryKey:X.fsBrowse(e,t),queryFn:({signal:n})=>Re(e??void 0,{signal:n,showHidden:t}),retry:!1})}function Jn(){let e=b();return A({mutationFn:e=>ct(e),onSuccess:()=>e.invalidateQueries({queryKey:X.projects})})}function Yn(){let e=b();return A({mutationFn:e=>ze(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:X.projects})}})}function Xn(){let e=b();return A({mutationFn:e=>{let{id:t,...n}=e;return Ce(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:X.projects});let r=e.getQueryData(X.projects);return e.setQueryData(X.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?Zn(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(X.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(X.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:X.projects})})}function Zn(e,t){let{maxParallel:n,tags:r,...i}=e,a={...i},o=`maxParallel`in t?t.maxParallel:e.maxParallel;o!=null&&(a.maxParallel=o);let s=`tags`in t&&t.tags!==void 0?t.tags:e.tags,c=s==null?[]:In(s);if(c.length>0&&(a.tags=c),`webhook`in t&&t.webhook!==void 0)if(t.webhook===null)delete a.webhook;else{let n=t.webhook.token===void 0?e.webhook?.tokenSet??!1:t.webhook.token!==``;a.webhook={url:t.webhook.url,tokenSet:n}}return a}function Qn(e){let t=b();return A({mutationFn:e,retry:!1,onSuccess:({project:e})=>{t.setQueryData(X.projects,t=>t===void 0?t:{...t,projects:t.projects.map(t=>t.id===e.id?e:t)})},onSettled:()=>t.invalidateQueries({queryKey:X.projects})})}function $n(){return Qn(e=>{let{projectId:t,...n}=e;return Tt(t,n)})}function er(){return Qn(e=>{let{projectId:t,webhookId:n,...r}=e;return p(t,n,r)})}function tr(){return Qn(({projectId:e,webhookId:t})=>nt(e,t))}function nr(){return A({mutationFn:({projectId:e,webhookId:t})=>Et(e,t),retry:!1})}function rr(e){let t=b();return A({mutationFn:t=>l(e,t),retry:!1,onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function $(e){let t=b();return A({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:X.agentProfiles}),t.invalidateQueries({queryKey:X.projects})])}})}function ir(){return $(e=>xt(e))}function ar(){return $(e=>{let{id:t,...n}=e;return u(t,n)})}function or(){return $(e=>ht(e))}function sr(){return $(e=>Ke(e))}function cr(e,t){return E({queryKey:X.agentAccountDetails(e),queryFn:({signal:t})=>h(e,{signal:t}),enabled:t,staleTime:0,retry:!1})}function lr(e,t){return E({queryKey:X.agentAccountStatus(e),queryFn:({signal:t})=>ee(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function ur(){let e=b();return A({mutationFn:({provider:e,profileId:t})=>Ge(e,t),retry:!1,onSuccess:async(t,{provider:n})=>{await Promise.all([e.invalidateQueries({queryKey:X.agentProfiles}),e.invalidateQueries({queryKey:X.providerStatus}),C(n)?Z(e,n,`none`):Promise.resolve()])}})}function dr(){let e=b();return A({mutationFn:e=>ee(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(X.agentAccountStatus(n),t),e.invalidateQueries({queryKey:X.agentProfiles}),C(t.status.provider)&&Z(e,t.status.provider)}})}function fr(){return A({mutationFn:e=>{let{routeId:t,...n}=e;return Ee(t,n)},retry:!1})}function pr(){let e=b();return A({mutationFn:e=>it(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:X.projects})})}function mr(){let e=b();return A({mutationFn:e=>Fe(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:X.projects})})}function hr({enabled:e}){return E({queryKey:X.githubOwners,queryFn:({signal:e})=>vt({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function gr(){let e=b();(0,O.useEffect)(()=>{let n,r=()=>{let r=e.getQueryData(Y.health),i=r?.capabilities?.localHandoff===!0;r&&St({local:i,bootProject:r.bootProject??`default`,apiBase:t()}),i&&n===void 0?n=Ft(`health`,t=>{e.setQueryData(Y.health,t)}):!i&&n!==void 0&&(n(),n=void 0)};r();let i=e.getQueryCache().subscribe(r);return()=>{i(),n?.(),wt()}},[e])}function _r(){return E({queryKey:Y.health,queryFn:({signal:e})=>gt({signal:e})})}function vr(e,t){let n=_r().data,r=Kn(t).data?.projects,i=mt(),a=e??i.projectId,o=a??n?.bootProject,s=o===void 0?void 0:r?.find(e=>e.id===o);return s?.repoUrl?s.repoUrl:a===null||a===n?.bootProject?Nn(n?.repo?.remote):void 0}function yr(){return E({queryKey:Y.openTargets,queryFn:({signal:e})=>bt({signal:e}),staleTime:5*6e4})}function br(){return E({queryKey:Y.runs.list(),queryFn:({signal:e})=>me(j(),{signal:e})})}function xr(e,t){return T({queryKey:Y.runs.archived(e),enabled:t,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>c({before:t,limit:200,q:e},{signal:n}),getNextPageParam:e=>e.nextCursor??void 0,placeholderData:(e,t)=>t?.queryKey[0]===n()?e:void 0})}function Sr(e){let t=e.trim();return E({queryKey:X.runsSearch(t),queryFn:({signal:e})=>Je(t,{signal:e}),enabled:t.length>=2,placeholderData:ve,staleTime:1e4})}function Cr(e=!0,t=un){let n=V(b());return D(`/api/v1/workspace/runs-index`,X.runsIndex,a(e?t:!1),pn),E({queryKey:X.runsIndex,queryFn:({signal:e})=>et({signal:e}).then(n.merge),enabled:e,staleTime:3e4,refetchInterval:!1})}function wr(e,t=!0,n=!1){return E({queryKey:[j({projectId:e,boot:n}).cacheScope,`runs`,`list`],queryFn:({signal:t})=>me(j({projectId:e,boot:n}),{signal:t}),enabled:t,placeholderData:(t,r)=>n&&r?.queryKey[0]===e?t:void 0})}function Tr(e){let t=b();return A({mutationFn:e=>Qe(e),onSettled:()=>t.invalidateQueries({queryKey:Y.runs.relationships(e)})})}function Er(e,t={}){return E({queryKey:Y.runs.relationships(e),queryFn:({signal:t})=>m(e,{signal:t}),enabled:t.enabled??!0})}function Dr(e){return E({queryKey:Y.runs.detail(e??``),queryFn:({signal:t})=>Me(M(e),{signal:t}),enabled:!!e})}function Or(e,t,n=!0){return E({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Me(M(t,{projectId:e}),{signal:n}),enabled:n&&!!e&&!!t})}function kr(e){return E({queryKey:Y.runs.diff(e??``),queryFn:({signal:t})=>Dt(e,{signal:t}),enabled:!!e})}function Ar(e,t=!1){return D(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/changes`:void 0,Y.runs.changes(e??``),a(t?4e3:!1)),E({queryKey:Y.runs.changes(e??``),queryFn:({signal:t})=>Ct(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0})}function jr(e,t){return E({queryKey:Y.runs.file(e??``,t??``),queryFn:({signal:n})=>Se(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function Mr(e,t){return E({queryKey:[n(),`runs`,`file-link`,e,t],queryFn:({signal:n})=>Oe(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Nr(e,t){return E({queryKey:[n(),`runs`,`artifact`,e,t],queryFn:({signal:n})=>Te(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Pr(e,t){return E({queryKey:[n(),`runs`,`artifact-metadata`,e,t],queryFn:({signal:n})=>v(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Fr(e){return E({queryKey:[n(),`runs`,`artifacts`,e],queryFn:({signal:t})=>we(e,{signal:t}),retry:!1,staleTime:0,refetchOnWindowFocus:!0})}function Ir(e,t=!1){return D(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/commits`:void 0,Y.runs.commits(e??``),a(t?5e3:!1)),E({queryKey:Y.runs.commits(e??``),queryFn:({signal:t})=>Le(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1})}function Lr(e,t){return E({queryKey:Y.runs.commit(e??``,t??``),queryFn:({signal:n})=>kt(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function Rr(e,t=!0){return E({queryKey:Y.runs.handoff(e??``),queryFn:({signal:t})=>d(M(e),{signal:t}),enabled:!!e&&t})}function zr(e,t,n){return E({queryKey:e===void 0?Y.runs.handoff(t):[e,`runs`,`handoff`,t],queryFn:({signal:n})=>d(M(t,{projectId:e}),{signal:n}),enabled:n,staleTime:15e3})}function Br(e,t){let r=[...new Set(e)],i=k({queries:r.map(e=>({queryKey:[e??n(),`automations`,`names`],queryFn:({signal:t})=>ae({signal:t,archived:`include`,...e===void 0?{}:{projectId:e}}),enabled:t,staleTime:6e4,retry:!1}))}),a=i.map(e=>e.data);return(0,O.useMemo)(()=>{let e=new Map;return a.forEach((t,n)=>{if(t?.available)for(let i of t.automations)e.set(JSON.stringify([r[n]??null,i.id]),i.name)}),(t,n)=>e.get(JSON.stringify([t??null,n]))},[JSON.stringify([r,i.map(e=>e.dataUpdatedAt)])])}function Vr(){return E({queryKey:Y.workflows,queryFn:({signal:e})=>pe({signal:e})})}function Hr(e=!0){let t=b(),n=Y.skills,r=n[0],i=E({queryKey:n,queryFn:({signal:e})=>s({signal:e}),enabled:e}),a=E({queryKey:Y.skillsReady,queryFn:({signal:e})=>$e({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,O.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`],a.data)},[t,a.data,r]),i}function Ur(e=!0){let t=b(),n=Y.importableSkills,r=n[0],i=E({queryKey:n,queryFn:({signal:e})=>Be({signal:e}),enabled:e}),a=E({queryKey:Y.importableSkillsReady,queryFn:({signal:e})=>rt({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,O.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`,`importable`],a.data)},[t,a.data,r]),i}function Wr(){return E({queryKey:Y.repo,queryFn:({signal:e})=>dt({signal:e})})}function Gr(e){return E({queryKey:[e,`repo`],queryFn:({signal:t})=>dt({signal:t},e)})}function Kr(){return E({queryKey:Y.repoBranches,queryFn:({signal:e})=>at({signal:e})})}function qr(){return E({queryKey:Y.repoChanges,queryFn:({signal:e})=>Ye({signal:e}),retry:!1})}function Jr(e){return E({queryKey:Y.repoCommit(e??``),queryFn:({signal:t})=>qe(e,{signal:t}),enabled:!!e,retry:!1})}function Yr(){return E({queryKey:Y.config,queryFn:({signal:e})=>re({signal:e})})}function Xr(){return E({queryKey:Y.worktrees,queryFn:({signal:e})=>ne({signal:e})})}function Zr(e){return E({queryKey:[e,`worktrees`],queryFn:({signal:t})=>ne({signal:t},e),staleTime:0})}function Qr(e,t=!0,n=!1){return E({queryKey:[j({projectId:e,boot:n}).cacheScope,`ui-state`],queryFn:({signal:t})=>de({signal:t},e),select:e=>e.sidebarLimits===void 0?e:{...e,sidebarLimits:Nt(e.sidebarLimits)},enabled:t})}function $r(){return Qr(n())}function ei(){return E({queryKey:Y.agentConfig,queryFn:({signal:e})=>se({signal:e})})}function ti(e){return E({queryKey:Y.agentConfigFile(e??``),queryFn:({signal:t})=>be(e,{signal:t}),enabled:e!==null})}function ni(e){let t=b(),n=Y.agentConfig,r=Y.agentConfigFile(e);return A({mutationFn:t=>ye(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}function ri(){return E({queryKey:X.uiState,queryFn:({signal:e})=>_({signal:e})})}function ii(){return E({queryKey:X.config,queryFn:({signal:e})=>ge({signal:e})})}function ai(){return E({queryKey:X.agentProfiles,queryFn:({signal:e})=>At({signal:e})})}function oi(e){let t=b();return A({mutationFn:t=>pt(e,t),onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function si(e){let t=R(),n=e?.projectId,r=e?.cacheScope,i=A({mutationFn:e=>Ie(e,!0),onMutate:e=>t.patchRead(e,!0),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)}),a=(0,O.useCallback)(e=>({...M(e,{projectId:n,cacheScope:r}),id:e}),[n,r]),o=(0,O.useCallback)(e=>({onSuccess:(t,n,r,i)=>e?.onSuccess?.(t,n.id,r,i),onError:(t,n,r,i)=>e?.onError?.(t,n.id,r,i),onSettled:(t,n,r,i,a)=>e?.onSettled?.(t,n,r.id,i,a)}),[]),{mutate:s,mutateAsync:c}=i,l=(0,O.useCallback)((e,t)=>s(a(e),o(t)),[s,a,o]),u=(0,O.useCallback)((e,t)=>c(a(e),o(t)),[c,a,o]);return{...i,variables:i.variables?.id,mutate:l,mutateAsync:u}}function ci(){let e=R();return A({mutationFn:e=>Ie(M(e),!1),onMutate:t=>e.patchRead(()=>M(t),!1),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)})}function li(e){let t=R();return A({mutationFn:({id:t,pinned:n})=>ie(M(t,e),n),onError:e=>It(`Could not update pin. ${e.message} Please retry.`,{tone:`danger`}),onMutate:()=>e??j(),onSuccess:(e,n,r)=>t.invalidateAfter(`runs`,r)})}function ui(e,t){let n=R();return A({mutationFn:n=>je(M(e,{projectId:t}),n),onMutate:()=>j({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`send`,r),onError:(e,t,r)=>{e instanceof Xe&&e.status===409&&r&&n.invalidateAfter(`send`,r)}})}function di(e,t){let n=R();return A({mutationFn:(n={})=>Ae(M(e,{projectId:t}),n),onMutate:()=>j({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`continue`,r)})}function fi(e){let t=b();return A({mutationFn:({msgId:t,message:n})=>le(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function pi(e){let t=b();return A({mutationFn:t=>yt(e,t),onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function mi(e={},t=!0){let r=b(),i=Y.github(e);D(`/api/v1/p/${n()}/github${e.limit===void 0?``:`?limit=${e.limit}`}`,i,a(t?6e4:!1));let o=E({queryKey:Y.github(e),queryFn:({signal:t})=>x({limit:e.limit},{signal:t}),enabled:t,staleTime:6e4,refetchInterval:!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0}),s=o.data?.projectsGeneration,c=E({queryKey:[...i,`projects`,s],queryFn:({signal:e})=>Ze(s,{signal:e}),enabled:t&&o.data?.projectsState===`refreshing`&&!!s,staleTime:1/0,retry:!1});return(0,O.useEffect)(()=>{!s||!c.data&&!c.error||r.setQueryData(i,e=>{if(!e||e.projectsGeneration!==s||e.projectsState!==`refreshing`)return e;let t=c.data;return t?.generation&&t.generation!==s?e:t?.state===`ready`?{...e,projectsState:`ready`,projects:t.projects,issues:e.issues.map(e=>({...e,projectIds:t.membership?.[e.number]??[]}))}:{...e,projectsState:`unavailable`,projectsReason:t?.reason??`Project boards unavailable. Refresh to try again.`}})},[r,s,c.data,c.error,i]),o}var hi=class extends Error{};function gi(e,t,n){return{queryKey:e,initialPageParam:{},queryFn:async({pageParam:e,signal:r})=>{let i=await x({limit:t,...e,...n?{projectId:n}:{}},{signal:r});if(!i.available&&Object.keys(e).length>0)throw new hi(i.reason??`GitHub is unavailable.`);return i},getNextPageParam:e=>Ln(e),retry:(e,t)=>!(t instanceof hi)&&!(t instanceof Xe&&t.status>=400&&t.status<500)&&e<1,staleTime:6e4,refetchOnWindowFocus:!0}}function _i(e=50,t=!0){let r=b(),i=Y.githubPages(e),o=Y.githubPagesHead(e);D(`/api/v1/p/${n()}/github?limit=${e}`,o,a(t?6e4:!1));let s=T({...gi(i,e),enabled:t,refetchInterval:!1,refetchIntervalInBackground:!1}),c=E({queryKey:o,queryFn:({signal:t})=>x({limit:e},{signal:t}),enabled:!1,staleTime:1/0}),{refetch:l}=s;(0,O.useEffect)(()=>{if(!c.data)return;let e=r.getQueryData(i);if(!e||e.pages.length===0)return;let t=Vn(e.pages,c.data);t===`refetch`?l():r.setQueryData(i,{...e,pages:t})},[r,c.dataUpdatedAt,l]);let u=(s.data?.pages??[]).flatMap(e=>e.projectsState===`refreshing`&&e.projectsGeneration?[e.projectsGeneration]:[]),d=k({queries:u.map(e=>({queryKey:[...i,`projects`,e],queryFn:({signal:t})=>Ze(e,{signal:t}),enabled:t,staleTime:1/0,retry:!1}))});return(0,O.useEffect)(()=>{d.forEach((e,t)=>{let n=u[t];!n||!e.data&&!e.error||r.setQueryData(i,t=>{if(!t)return t;let r=!1,i=t.pages.map(t=>{if(t.projectsGeneration!==n||t.projectsState!==`refreshing`)return t;let i=e.data;return i?.generation&&i.generation!==n?t:(r=!0,i?.state===`ready`?{...t,projectsState:`ready`,projects:i.projects,issues:t.issues.map(e=>({...e,projectIds:i.membership?.[e.number]??[]}))}:{...t,projectsState:`unavailable`,projectsReason:i?.reason??`Project boards unavailable. Refresh to try again.`})});return r?{...t,pages:i}:t})})},[r,d.map((e,t)=>e.data||e.error?u[t]:``).join(`,`)]),{pages:s,data:(0,O.useMemo)(()=>Bn(s.data?.pages??[]),[s.data])}}function vi(e,t=50,n=!0){let r=T({...gi([e,`github`,`pages`,t],t,e),enabled:n});return{pages:r,data:(0,O.useMemo)(()=>Bn(r.data?.pages??[]),[r.data])}}function yi(e,t,n=!0){let r=k({queries:t.filter(e=>e.length>0).map(t=>({queryKey:Y.githubCommentCounts(e,t),queryFn:({signal:n})=>_e(e,t,{},{signal:n}),enabled:n,staleTime:6e4}))});return(0,O.useMemo)(()=>{let e={};for(let t of r)t.data?.available&&Object.assign(e,t.data.counts);return e},[r.map(e=>e.dataUpdatedAt).join(`,`)])}function bi(e,t,n,r=!0){return E({queryKey:[e,`github`,`search`,t,n],queryFn:({signal:r})=>lt(t,n,{projectId:e},{signal:r}),enabled:r&&n.trim()!==``,staleTime:6e4})}function xi(e,t=!0){return E({queryKey:Y.githubChecks(e),queryFn:({signal:t})=>ke(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function Si(e,t,n=!0){return E({queryKey:Y.githubSearch(e,t),queryFn:({signal:n})=>lt(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var Ci=100;function wi(e){return[...e].sort((e,t)=>t-e).slice(0,Ci).sort((e,t)=>e-t)}function Ti(){let e=mt(),t=_r();return e.projectId??t.data?.bootProject}function Ei(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))U(K({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))U(K({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var Di=5*6e4;function Oi(e){return e?e.recheckAfterMs:Di}function ki(e,t=!0){let n=(0,O.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{prs:new Set,issues:new Set};e[n.kind===`PR`?`prs`:`issues`].add(n.number),t.set(n.projectId,e)}return[...t.entries()].map(([e,t])=>({projectId:e,prs:wi(t.prs),issues:wi(t.issues)}))},[e.map(K).sort().join(`|`)]),r=k({queries:n.map(e=>({queryKey:Y.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>Pe(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>Oi(e.state.data)??1/0,refetchInterval:!1,refetchOnWindowFocus:!0}))}),a=b(),o=JSON.stringify(n.map((e,t)=>({...e,interval:Oi(r[t]?.data)??!1})));(0,O.useEffect)(()=>{if(!t||i())return;let e=!0,n=JSON.parse(o).filter(e=>e.interval!==!1).map(t=>{let n=new URLSearchParams;t.prs.length&&n.set(`prs`,t.prs.join(`,`)),t.issues.length&&n.set(`issues`,t.issues.join(`,`));let r=Y.githubRefStatus(t.projectId,t.prs,t.issues);return Pt({path:`/api/v1/p/${t.projectId}/github/ref-status?${n}`,intervalMs:t.interval},(t,n)=>{n||a.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&a.setQueryData(r,t)})})});return()=>{e=!1;for(let e of n)e()}},[t,o,a]);let s=(0,O.useMemo)(()=>Mn(n,r),[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,O.useCallback)(e=>{let t=K(e),n=s.get(t);if(n)return n;let r=H.get(t);return{state:`idle`,...r?{status:r}:{},...W.has(t)?{conflicting:!0}:{}}},[s])}function Ai(e,t,n=!0){return E({queryKey:Y.githubComments(e,t),queryFn:({signal:n})=>o(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function ji(e,t,n=!0){return E({queryKey:Y.githubItem(e,t),queryFn:({signal:n})=>He(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Mi(e){return E({queryKey:Y.githubPrChanges(e??0),queryFn:({signal:t})=>ot(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{Un as $,Lt as $t,hr as A,Hr as At,fr as B,Xr as Bt,Mr as C,Hn as Ct,yi as D,Sr as Dt,xi as E,Cr as Et,gr as F,Xn as Ft,bi as G,Nn as Gt,oi as H,Rn as Ht,Ur as I,er as It,Or as J,V as Jt,Gr as K,yn as Kt,si as L,Vr as Lt,Mi as M,nr as Mt,Si as N,$r as Nt,Ai as O,sr as Ot,_r as P,ar as Pt,Kn as Q,A as Qt,ci as R,ii as Rt,fi as S,Er as St,mi as T,br as Tt,li as U,Pn as Ut,yr as V,X as Vt,vi as W,Fn as Wt,Qr as X,j as Xt,wr as Y,R as Yt,Zr as Z,M as Zt,di as _,Lr as _t,lr as a,Jn as at,$n as b,jr as bt,ai as c,tr as ct,Pr as d,Kr as dt,ni as et,Fr as f,qr as ft,ur as g,Ar as gt,Yr as h,Dr as ht,cr as i,Wn as it,_i as j,zr as jt,ji as k,ui as kt,xr as l,pi as lt,pr as m,Gn as mt,Y as n,Ti as nt,ei as o,or as ot,Br as p,Jr as pt,vr as q,xn as qt,Ei as r,ki as rt,ti as s,Yn as st,Z as t,dr as tt,Nr as u,Wr as ut,ir as v,Ir as vt,qn as w,Q as wt,Tr as x,Rr as xt,mr as y,kr as yt,rr as z,ri as zt};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,I as n,M as r,T as i,t as a}from"./button-DGwhwRuD.js";import{i as o,t as s}from"./react-runtime-CCIEwYL0.js";import{Lt as c,Sn as l,Sr as u,Vr as d,br as f,f as p}from"./project-scope-context-CSPQyWoO.js";import{$ as m,B as h,Q as g,X as _,at as v,lt as y,nt as b,tt as x,ut as S}from"./live-protocol-aMLJJ0MQ.js";import{t as C}from"./useInfiniteQuery-Q8eFXz-L.js";import{n as w,t as T}from"./ws-B-tB133E.js";import{t as E}from"./project-router-CiB1O_5A.js";import{C as D,Zt as O}from"./index-CsOa03VW.js";import{t as k}from"./report-title-D4Mbu2Er.js";var A=e(o(),1),j=1e3,M=v().min(1).max(1024);b({q:v().max(j).optional(),before:M.optional(),limit:v().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var N=b({reports:_(b({id:y(),runId:y(),name:v(),title:v(),createdAt:S(),size:x().int().nonnegative(),taskTitle:v(),taskStatus:h}).strict()),nextCursor:M.nullable(),total:x().int().nonnegative()}).strict(),P=b({epoch:y(),generation:x().int().nonnegative(),metadataGeneration:x().int().nonnegative()}).strict(),F=b({runId:y(),taskTitle:v(),taskStatus:h}).strict(),I=g(`type`,[P.extend({type:m(`snapshot`)}),P.extend({type:m(`content`)}),P.extend({type:m(`metadata`),runs:_(F)})]),L=new WeakMap;function R(e,t){if(!e)return{content:t.type===`content`,metadata:t.type===`metadata`,reset:!1};if(e.epoch!==t.epoch)return{content:!0,metadata:!0,reset:!0};if(!(t.generation<e.generation||t.metadataGeneration<e.metadataGeneration)&&!(e.generation===t.generation&&e.metadataGeneration===t.metadataGeneration))return{content:t.generation!==e.generation,metadata:t.metadataGeneration!==e.metadataGeneration,reset:!1}}var z=class{client;project;state;content=0;metadata=0;patches=new Map;trailing=new Set;flights=new Map;constructor(e,t){this.client=e,this.project=t,e.getQueryCache().subscribe(n=>{if(n.type===`removed`){this.trailing.delete(n.query),this.flights.delete(n.query);return}if(!(n.query.queryKey[0]!==t||n.query.queryKey[1]!==`reports`)){if(n.type===`updated`&&n.action.type===`fetch`&&this.flights.set(n.query,this.metadata),n.query.state.fetchStatus===`idle`&&this.flights.has(n.query)){let e=this.flights.get(n.query);this.flights.delete(n.query),e!==this.metadata&&String(n.query.queryKey[2]??``).trim()===``&&this.client.setQueryData(n.query.queryKey,t=>t&&{...t,pages:t.pages.map(t=>this.patch(t,e))})}!this.trailing.has(n.query)||n.query.state.fetchStatus!==`idle`||(this.trailing.delete(n.query),queueMicrotask(()=>{e.invalidateQueries({queryKey:n.query.queryKey,exact:!0,refetchType:`active`},{cancelRefetch:!1})}))}})}patch(e,t=-1){return{...e,reports:e.reports.map(e=>{let n=this.patches.get(e.runId);return n&&n.version>t?{...e,taskTitle:n.value.taskTitle,taskStatus:n.value.taskStatus}:e})}}async read(e,t){for(;;){let n=this.content,r=this.metadata,i=await t();if(!(n!==this.content||e.trim()!==``&&r!==this.metadata))return e.trim()===``?this.patch(i,r):i}}receive(e,t=!1){let n=this.state;if(!n&&e.type===`snapshot`){this.state=e,this.content++,this.client.getQueryCache().findAll({queryKey:[this.project,`reports`]}).some(e=>e.state.data!==void 0)&&this.invalidate(!0);return}let r=R(n,e);if(!r){t&&e.type===`snapshot`&&(this.content++,this.invalidate(!0));return}let{metadata:i,reset:a}=r,o=r.content||t&&e.type===`snapshot`;this.state=e,a&&this.patches.clear(),i&&this.metadata++,o&&this.content++,e.type===`metadata`&&!a&&this.patchCaches(e);let s=o||i&&e.type!==`metadata`;(s||i)&&this.invalidate(s)}patchCaches(e){for(let t of e.runs)this.patches.set(t.runId,{value:t,version:this.metadata});this.client.setQueriesData({queryKey:[this.project,`reports`],predicate:e=>String(e.queryKey[2]??``).trim()===``},e=>e&&{...e,pages:e.pages.map(e=>this.patch(e,this.metadata-1))})}invalidate(e){let t={queryKey:[this.project,`reports`],refetchType:`active`,...e?{}:{predicate:e=>String(e.queryKey[2]??``).trim()!==``}};for(let e of this.client.getQueryCache().findAll(t))e.state.fetchStatus===`fetching`&&this.trailing.add(e);this.client.invalidateQueries(t,{cancelRefetch:!1})}};function B(e,t){let n=L.get(e);n||(n=new Map,L.set(e,n));let r=n.get(t);return r||(r=new z(e,t),n.set(t,r)),r}async function V(e,t){let n=await p.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},c({signal:t}));return P.parse(await l(n,`/reports/state`))}function H(e){let t=B(d(),e);return(0,A.useEffect)(()=>{let n=T(`reports:project:${e}`,e=>{let n=I.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),r,i,a=()=>{if(f()===`finite`&&!r){i=new AbortController;let n=i.signal;V(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),r=w({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=P.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else f()!==`finite`&&(i?.abort(),r?.(),r=void 0)};a();let o=u(a);return()=>{o(),i?.abort(),r?.(),n()}},[t,e]),t}async function U(e,t,n,r){let i=await p.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,j),...n?{before:n}:{}}},c(r?{signal:r}:void 0));return N.parse(await l(i,`/reports`))}function W(e){let t=r(),n=H(t);return C({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>U(t,e,r,i)),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var G=s(),K=new Map;function q(){let e=t(),r=i(),[o,s]=D(),c=(o.get(`q`)??``).slice(0,j),l=W(c),u=(0,A.useRef)(null),d=(0,A.useRef)(``),f=e.pathname+e.search,p=l.data?.pages.flatMap(e=>e.reports)??[];(0,A.useLayoutEffect)(()=>{if(!l.data||d.current===f)return;let t=K.get(f),n=e.state?.filesRestoreKey===f;if(!t||!u.current||r!==`POP`&&!n){d.current=f;return}let i=u.current.querySelector(`[data-report-id="${t.row}"]`);if(l.isFetchNextPageError){d.current=f,u.current.scrollTop=0;return}if((!i||l.data.pages.length<t.pages)&&l.hasNextPage){l.isFetchingNextPage||l.fetchNextPage();return}d.current=f,u.current.scrollTop=i?t.scroll:0,i?.focus({preventScroll:!0})},[f,l.data,l.hasNextPage,l.isFetchingNextPage,l.isFetchNextPageError,l.fetchNextPage,e.state,r]);let m=t=>s(n=>(t?n.set(`q`,t.slice(0,j)):n.delete(`q`),K.delete(e.pathname+`?`+n.toString()),n));return(0,G.jsxs)(`section`,{"data-route":`reports`,className:`flex h-full min-h-0 flex-col`,children:[(0,G.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b border-border p-4`,children:[(0,G.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Reports`}),(0,G.jsx)(O,{maxLength:j,"aria-label":`Search reports`,placeholder:`Search reports or source tasks`,value:c,onChange:e=>m(e.target.value),className:`min-h-11`})]}),(0,G.jsxs)(`div`,{ref:u,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4 [scrollbar-gutter:stable]`,children:[l.isPending?(0,G.jsx)(`p`,{role:`status`,children:`Loading reports…`}):l.isError?(0,G.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3`,children:[(0,G.jsx)(`p`,{children:`Could not load reports`}),(0,G.jsx)(`p`,{className:`text-sm text-soft-foreground`,children:l.error.message}),(0,G.jsx)(a,{className:`min-h-11`,onClick:()=>void l.refetch(),children:`Retry`})]}):p.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,G.jsx)(`h2`,{className:`font-medium`,children:c?`No matching reports`:`No published reports yet`}),c?(0,G.jsx)(a,{"data-slot":`reports-clear-search`,variant:`outline`,className:`min-h-11`,onClick:()=>m(``),children:`Clear search`}):(0,G.jsxs)(`p`,{className:`text-sm text-soft-foreground`,children:[`Publish an HTML snapshot with `,(0,G.jsxs)(`code`,{children:[n(),` artifact publish`]}),` to list it here.`]})]}):(0,G.jsx)(`ul`,{className:`flex flex-col gap-3`,children:p.map(e=>(0,G.jsxs)(`li`,{"data-slot":`report-row`,className:`reports-row rounded-lg border border-border bg-card p-3`,children:[(0,G.jsx)(`h2`,{className:`min-w-0 font-medium [overflow-wrap:anywhere]`,children:(0,G.jsx)(E,{"data-report-id":e.id,className:`reports-open`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:f,filesRestoreKey:f},onClick:()=>K.set(f,{scroll:u.current?.scrollTop??0,row:e.id,pages:l.data?.pages.length??1}),children:k(e)})}),(0,G.jsx)(E,{className:`reports-task text-sm text-accent-text underline [overflow-wrap:anywhere]`,to:`/tasks/${e.runId}`,children:e.taskTitle}),(0,G.jsx)(`time`,{className:`block text-xs text-soft-foreground`,dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleString()})]},e.id))}),l.hasNextPage?(0,G.jsx)(a,{variant:`outline`,className:`min-h-11`,disabled:l.isFetchingNextPage,onClick:()=>void l.fetchNextPage(),children:`Load more reports`}):null]})]})}export{q as ReportsRoute};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,L as n,S as r,d as i,t as a,u as o}from"./button-DGwhwRuD.js";import{i as s,t as c}from"./react-runtime-CCIEwYL0.js";import{Gt as l,Kn as u,Ln as d,Qn as f,Rn as p,Vr as ee,Wt as m,Zn as h,_r as g,er as _,i as v,k as y,o as b,qn as te,zn as ne}from"./project-scope-context-CSPQyWoO.js";import{$ as x,H as S,P as re,Q as ie,Qt as C,R as w,St as T,Tt as ae,U as E,V as oe,Xt as se,Yt as ce,Zt as le,ht as ue,n as de,nt as fe,q as pe,x as me,xt as he,z as ge}from"./queries-pj368bmB.js";import{J as _e,L as ve,S as ye,_ as be,a as xe,b as Se,d as Ce,f as we,n as Te,o as Ee,p as De,r as Oe,v as ke,y as Ae,z as D}from"./use-desktop-Bq_Qh5ur.js";import{n as O}from"./toaster-CoMJoQvk.js";import{I as je,S as Me,Y as Ne,_ as Pe,a as Fe,g as Ie,h as Le,j as Re,m as ze,mt as Be,o as Ve,p as He,st as Ue,t as We,u as Ge,y as k}from"./design-icons-DmYTv2r1.js";import{t as A}from"./createLucideIcon-BHp8sXmF.js";import{t as Ke}from"./app-window-CSHwDX9N.js";import{t as qe}from"./info-DA1x_4bz.js";import{a as Je,t as Ye}from"./format-BNCkW110.js";import{t as Xe}from"./message-square-B-MD-8rD.js";import{i as Ze,n as Qe,t as j}from"./reference-chip-DT-_ninM.js";import{a as M,i as N,l as P,n as F,p as I,r as L,t as R}from"./dropdown-menu-DPrTX-zi.js";import{a as z,c as B,i as V,n as H,o as U,r as $e,s as et,t as tt}from"./alert-dialog-CH4SXGfX.js";import{a as nt,i as rt,o as it,r as at,s as ot,t as st}from"./dialog-B7p5oc5r.js";import{c as ct,s as lt,t as W}from"./project-router-CiB1O_5A.js";import"./attention-BDa7opY9.js";import{$ as ut,$t as dt,Bt as ft,Jt as pt,Kt as G,L as mt,M as ht,N as gt,Ot as K,Rt as _t,Yt as vt,_ as yt,_n as bt,_t as xt,a as St,bt as Ct,cn as wt,j as Tt,kt as q,nn as Et,o as Dt,qt as Ot,r as kt,t as At,tn as jt,vt as Mt,wt as Nt,xt as Pt,z as Ft,zt as It}from"./index-CsOa03VW.js";import{t as J}from"./tab-link-BPBiho7-.js";var Lt=A(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),Rt=A(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),zt=A(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),Y=e(s(),1),X=c();function Bt(e){let t=ce();return C({mutationFn:t=>b(le(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>se()),onError:e=>O(e.message,{tone:`danger`})})}function Vt(e){return e.archived?`Unarchive`:`Archive task`}function Ht({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,X.jsx)(tt,{open:t,onOpenChange:n,children:(0,X.jsxs)(V,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(et,{children:[(0,X.jsx)(B,{children:`Archive task?`}),(0,X.jsxs)(z,{children:[`Move “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:D(e),children:D(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,X.jsxs)(U,{children:[(0,X.jsx)($e,{children:`Cancel`}),(0,X.jsx)(H,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function Z({run:e,className:t,compactOnMobile:n=!1}){let[r,i]=(0,Y.useState)(!1),s=Bt(e.id),c=Vt(e);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(a,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":c,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:s.isPending,className:o(`h-11 gap-[7px] px-3`,n&&`max-md:size-11 max-md:px-0`,t),onClick:()=>e.archived?s.mutate(!1):i(!0),children:[e.archived?(0,X.jsx)(bt,{"aria-hidden":`true`}):(0,X.jsx)(We,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:o(n&&`max-md:sr-only`),children:c})]}),(0,X.jsx)(Ht,{run:e,open:r,onOpenChange:i,onConfirm:()=>{s.mutate(!0),i(!1)}})]})}function Ut({run:e,action:t,prUrl:n,patch:r}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:t.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,t.message||(t.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&i(n)?(0,X.jsx)(a,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,X.jsx)(a,{variant:`outline`,disabled:r.isPending,onClick:()=>r.mutate({autoMergePr:!1},{onError:e=>O(e.message,{tone:`danger`})}),children:r.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function Wt({run:e,blocker:t,flags:n}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,X.jsx)(a,{variant:`outline`,asChild:!0,children:(0,X.jsx)(W,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&i(t.pullRequestUrl)?(0,X.jsx)(a,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,X.jsx)(Z,{run:e}):null]})]})}function Gt({run:e}){let t=S(e.id),n=q(e),r=e.status===`done`?e.completionAction:void 0,i=n.archive?e.archiveBlocker:void 0,a=r&&r.phase!==`complete`?r:void 0;if(!a&&!i)return null;let o=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,X.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-border bg-card p-3 [margin-block:0.75rem]`,children:[a?(0,X.jsx)(Ut,{run:e,action:a,prUrl:o,patch:t}):null,i?(0,X.jsx)(Wt,{run:e,blocker:i,flags:n}):null]})}var Kt=[`running`,`queued`,`waiting`];function qt(e,{queuePosition:t,now:n=new Date}){let r=d(e),i=r.label.charAt(0).toUpperCase()+r.label.slice(1),a=t===void 0?i:`${i} #${t}`,o=Kt.includes(e.status)?Yt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Jt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Yt(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:Ye(n,t)}}async function Q(e,t){try{await navigator.clipboard.writeText(e),O(t)}catch{O(`Run manually: ${e}`)}}function Xt(e){let t=pe(),n=fe(),r=(0,Y.useMemo)(()=>ye(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,Y.useMemo)(()=>n===void 0?[]:r.filter(e=>Ce(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function Zt(e){return C({mutationFn:()=>l(e.id),onError:e=>{if(e instanceof v&&e.command){Q(e.command,`No terminal found — command copied to clipboard.`);return}O(e.message,{tone:`danger`})}})}function $(e,t){let n=oe(),r=x(),i=C({mutationFn:t=>m(e.id,t),onError:e=>O(e.message,{tone:`danger`})}),a=g(r.data),o=e=>!r.isSuccess||a.includes(e??`claude`);return{canResumeHere:t&&o(Nt(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=pt(e.id);return t===void 0||o(t)}).map(t=>({target:t,...Pt(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:i}}function Qt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:o}=$(e,t),s=K(e);return!r&&i.length===0&&!s?null:(0,X.jsxs)(X.Fragment,{children:[r||i.length>0?(0,X.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,X.jsxs)(a,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,X.jsx)(dt,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=vt(e);return(0,X.jsxs)(a,{variant:`outline`,"data-target":e.id,title:n,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:[(0,X.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,X.jsxs)(a,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>O(`Worktree path copied`)).catch(()=>O(`Path: ${t}`))},children:[(0,X.jsx)(k,{}),`Copy worktree path`]}):null]}):null,s?(0,X.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,X.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,X.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,X.jsxs)(a,{variant:`outline`,onClick:()=>void Q(s,`Command copied to clipboard.`),children:[(0,X.jsx)(k,{}),`Copy resume command`]})]}):null]})}function $t({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:o}=$(e,t),s=K(e),c=e.worktreePath;if(!r&&i.length===0&&!s&&!c)return null;let l=`max-md:min-h-11`;return(0,X.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,X.jsx)(Ot,{choices:i,onPick:e=>o.mutate(e),disabled:o.isPending,triggerVariant:`outline`,className:l,leading:r?(0,X.jsxs)(N,{"data-target":`terminal-resume`,onSelect:n,children:[(0,X.jsx)(dt,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,c?(0,X.jsxs)(a,{variant:`outline`,size:`sm`,className:l,onClick:()=>void Q(c,`Worktree path copied`),children:[(0,X.jsx)(k,{"aria-hidden":`true`}),`Copy worktree path`]}):null,s?(0,X.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:s,className:l,onClick:()=>void Q(s,`Command copied to clipboard.`),children:[(0,X.jsx)(k,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function en({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:o,choices:s}=$(e,t);return!o&&s.length===0?null:r?(0,X.jsx)(N,{onSelect:r,children:`Open in…`}):(0,X.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,X.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,X.jsx)(Be,{})})]}),e.worktreePath?(0,X.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,X.jsx)(`div`,{className:`mt-4`,children:(0,X.jsx)(Qt,{run:e,canResume:t,onResume:n})})]})}function tn({branch:e}){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(null);(0,Y.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{O(`Could not copy branch. Select and copy: ${e}`)}};return(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,X.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium break-all`,children:e}),(0,X.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,X.jsx)(k,{className:`size-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function nn({run:e}){let t=pe(),n=fe(),r=r=>n===void 0?void 0:ke(n,e.id,r,t),a=(0,Y.useMemo)(()=>ye(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,X.jsx)(j,{reference:t,to:r(t),taskTitle:D(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,X.jsx)(Mt,{run:e,prNumber:t.number})},De(t)));let l=Se(e);l&&i(l)&&!c.some(e=>e.url===l)&&o.push((0,X.jsx)(j,{reference:{kind:`PR`,url:l},taskTitle:D(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=a.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,X.jsx)(j,{reference:t,to:r(t),taskTitle:D(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},De(t)));let d=be(e,t);if(d&&i(d)&&!u.some(e=>e.url===d)){let t=we(d);s.push((0,X.jsx)(j,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?r({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:D(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,X.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,X.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function rn(){let e=lt(),t=ie();return Tt(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var an=e=>e.map(e=>`${e.name}: ${ht(e.url)}`).join(`
2
- `);function on(e){return rn().length>0||e.notify===!0}function sn({run:e}){let t=rn(),n=t.length>0,r=ge(e.id),[i,o]=(0,Y.useState)(null),s=e.notify===!0;return!n&&!s?null:(0,X.jsxs)(X.Fragment,{children:[s?(0,X.jsxs)(R,{children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${gt(t)} — webhook actions`:`Notifying — webhook actions`,title:n?an(t):void 0,children:[(0,X.jsx)(G,{tone:`success`}),(0,X.jsx)(`span`,{children:`Notifying`}),(0,X.jsx)(Ge,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,X.jsxs)(L,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,X.jsx)(M,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-[11px] font-normal text-muted-foreground`,children:t.map(e=>(0,X.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:ht(e.url),children:e.name},e.id))}):null,n?(0,X.jsxs)(N,{className:`min-h-11`,onSelect:()=>o(`note`),children:[(0,X.jsx)(Xe,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,X.jsxs)(N,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>O(`Stopped notifying the webhook`),onError:e=>O(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,X.jsx)(Lt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,X.jsxs)(a,{variant:`outline`,size:`sm`,"data-action":`handoff`,className:`size-11 px-0 md:h-[30px] md:w-auto md:px-2.5`,"aria-label":`Hand off to webhook`,onClick:()=>o(`handoff`),children:[(0,X.jsx)(jt,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,X.jsx)(cn,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&o(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{o(null),O(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>O(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function cn({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let o=(0,Y.useId)(),s=(0,Y.useId)(),[c,l]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{e!==null&&l(``)},[e]);let u=e===`note`,d=gt(t);return(0,X.jsx)(st,{open:e!==null,onOpenChange:e=>{e||l(``),r(e)},children:(0,X.jsx)(at,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,X.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(c.trim())},children:[(0,X.jsxs)(it,{className:`text-left`,children:[(0,X.jsx)(ot,{children:u?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,X.jsx)(rt,{children:(0,X.jsx)(`span`,{"data-webhook-destination":``,title:an(t),children:u?`${d} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${d} will start receiving this task's status updates. Add a note (optional).`})})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(`label`,{htmlFor:o,className:`text-[13px] font-medium`,children:`Note`}),(0,X.jsx)(ut,{id:o,"data-slot":`handoff-note`,"aria-describedby":s,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:c,onChange:e=>l(e.target.value)}),(0,X.jsxs)(`p`,{id:s,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,X.jsx)(qe,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,X.jsxs)(nt,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,X.jsx)(a,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,X.jsxs)(a,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||u&&c.trim()===``,children:[(0,X.jsx)(jt,{"aria-hidden":`true`}),u?`Send note`:`Hand off`]})]})]})})})}function ln({runId:e,children:t}){let n=r(),i=(0,Y.useMemo)(()=>({runId:e}),[e]);return n?(0,X.jsx)(un,{runId:e,children:t}):(0,X.jsx)(Ft.Provider,{value:i,children:t})}function un({runId:e,children:n}){let{projectId:r}=t(),i=(0,Y.useMemo)(()=>({runId:e,...r?{projectId:r}:{}}),[e,r]);return(0,X.jsx)(Ft.Provider,{value:i,children:n})}function dn(e,t,n,r){return n?r===`step`?`Step ${e} of ${t}`:`${e} of ${t} complete`:`${e} / ${t}`}function fn(e){return typeof e==`object`&&!!e&&!(0,Y.isValidElement)(e)&&`keep`in e}function pn({slot:e,icon:t,title:n,meta:r,summary:i,aside:a,open:s,onToggle:c,className:l,children:u}){let d=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`flex size-4 shrink-0 items-center justify-center text-accent-text`,children:t}),(0,X.jsx)(`span`,{className:o(`truncate text-[14px] font-semibold text-foreground`,typeof n==`string`?`shrink-0`:`min-w-0 shrink`),children:n}),i??(fn(r)?(0,X.jsxs)(`span`,{"data-slot":`run-activity-meta`,className:`contents text-[13px] text-muted-foreground tabular-nums`,children:[r.drop===void 0?null:(0,X.jsxs)(`span`,{className:`flex h-[1lh] min-w-0 shrink-[2] flex-wrap overflow-hidden`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-[1lh] w-0`}),(0,X.jsxs)(`span`,{"data-slot":`run-activity-meta-drop`,className:`whitespace-nowrap`,children:[r.drop,(0,X.jsx)(`span`,{className:`text-soft-foreground`,children:` ·`})]})]}),` `,(0,X.jsx)(`span`,{"data-slot":`run-activity-meta-keep`,className:`shrink-0 whitespace-nowrap`,children:r.keep})]}):r===void 0?null:(0,X.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`min-w-0 shrink-[2] truncate text-[13px] text-muted-foreground tabular-nums`,children:r}))]}),f=c!==void 0;return(0,X.jsxs)(`div`,{"data-slot":`run-activity-${e}`,"data-state":f&&s?`open`:`collapsed`,className:o(`min-w-0 border-t border-border first:border-t-0`,l),children:[f?(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:c,className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2 text-start hover:bg-muted/40 active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring`,children:[d,a,(0,X.jsx)(Ge,{"aria-hidden":!0,className:o(`size-4 shrink-0 text-soft-foreground motion-safe:transition-transform motion-reduce:transition-none`,!a&&`ms-auto`,s&&`rotate-180`)})]}):(0,X.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2`,children:[d,a]}),f&&s?(0,X.jsx)(`div`,{"data-slot":`run-activity-body`,className:`min-w-0 border-t border-border/60 bg-muted/30 px-3.5 py-2.5`,children:u}):null]})}function mn(e,t){let n=e?.role===`root`?e.receipts.map(e=>e.workerId).reverse():[];return[...new Set([...n,...(t?.workers??[]).map(e=>e.workerId)])]}function hn(e){let t=e.delegation,n=t?.role===`root`,r=T(e.id,{enabled:n});if(!n||!t)return`complete`;if(!r.isSuccess)return r.isError||r.fetchStatus===`paused`?`unknown`:`pending`;let i=new Map(r.data.workers.map(e=>[e.workerId,e])),a=mn(t,r.data).map(e=>{let t=i.get(e)?.status;return t===`done`||t===`cancelled`?`complete`:t===void 0||t===`failed`?`issue`:`pending`});return a.includes(`pending`)?`pending`:a.includes(`issue`)?`issue`:`complete`}function gn(e){let t=T(e.id,{enabled:e.delegation?.role===`root`});return t.isSuccess&&t.data.workers.some(e=>_e(e.status))}function _n({run:e,open:t,onToggle:n}){let r=T(e.id),i=ae(),s=Te(),c=e.delegation,l=new Map(r.data?.workers.map(e=>[e.workerId,e])),u=mn(c,r.data),d=h(e)??_(e),f=d?vn(e,d):void 0;return(0,X.jsx)(pn,{slot:`workers`,icon:(0,X.jsx)(Re,{className:`size-4`}),title:`Workers`,meta:yn({ids:u,workers:l,desktop:s,query:r}),aside:r.data?.capacity?(0,X.jsx)(En,{capacity:r.data.capacity}):void 0,open:t,onToggle:n,children:(0,X.jsxs)(`div`,{"aria-label":`Task relationships`,className:`min-w-0 text-[13px] text-muted-foreground`,role:`group`,children:[r.data?.capacity&&r.data.capacity.outstanding>=r.data.capacity.limit?(0,X.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`All worker slots are in use. Clean up finished workers to free a slot.`}):null,d?(0,X.jsx)(Cn,{wait:d,dependencyLabel:f}):null,u.length>0?(0,X.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-0.5 overflow-y-auto`,children:u.map(t=>{let n=l.get(t),a=i.data?.find(e=>e.id===t)??r.data?.titles?.find(e=>e.id===t),s=n?xn(n.status):r.isSuccess?`Record unavailable or deleted`:`Status unavailable`;return(0,X.jsxs)(`li`,{"data-slot":`worker-item`,"data-status":n?.status,className:`min-w-0`,children:[(0,X.jsxs)(W,{to:`/tasks/${t}`,"aria-label":`Worker task ${t}`,className:`group flex min-h-11 min-w-0 items-center gap-2.5 rounded-md px-1 text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,X.jsx)(bn,{status:n?.status}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:a?D(a):`Worker ${t.slice(0,8)}`}),(0,X.jsx)(`span`,{className:o(`max-w-[45%] shrink-0 truncate text-xs`,Sn(n?.status)),children:s}),(0,X.jsx)(Ve,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`})]}),n?(0,X.jsx)(On,{parentRunId:e.id,worker:n}):null,n?.destroy?(0,X.jsx)(An,{state:n.destroy}):null]},t)})}):c?.role===`root`&&r.isSuccess?(0,X.jsx)(`p`,{className:`px-1 py-1`,children:`No workers`}):null,r.fetchStatus===`paused`?(0,X.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Offline — relationship details will refresh when connected.`}):r.isPending?(0,X.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Loading relationships…`}):null,r.isError?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-1 py-1`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Could not load relationships. Known task links are retained.`}),(0,X.jsx)(a,{variant:`outline`,className:`min-h-11`,onClick:()=>void r.refetch(),children:`Retry relationships`})]}):null]})})}function vn(e,t){let n=e.delegation;if(!(!n||n.role===`invalid`))return ne(e)??p(n.role,t,`requestIds`in t&&f(n,t.requestIds))}function yn({ids:e,workers:t,desktop:n,query:r}){if(e.length===0)return r.isError?`Unavailable`:r.isPending?`Linking…`:`No workers`;let i=`${e.length} linked`;if(!n)return i;let a=new Map;for(let n of e){let e=t.get(n)?.status;e!==void 0&&a.set(e,(a.get(e)??0)+1)}return[i,...[...a.entries()].map(([e,t])=>`${t} ${e}`)].join(` · `)}function bn({status:e}){let t=`size-[15px] shrink-0`;return e===`done`?(0,X.jsx)(He,{"aria-hidden":!0,className:o(t,`text-success`)}):e===`failed`?(0,X.jsx)(Pe,{"aria-hidden":!0,className:o(t,`text-danger`)}):e===`cancelled`?(0,X.jsx)(Ie,{"aria-hidden":!0,className:o(t,`text-soft-foreground`)}):e===`running`||e===`waiting`||e===`review`?(0,X.jsx)(Je,{role:`status`,"aria-label":`Worker running`,className:o(t,`animate-spin stroke-pending motion-reduce:animate-none`)}):(0,X.jsx)(Le,{"aria-hidden":!0,className:o(t,`text-soft-foreground`)})}function xn(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function Sn(e){return e===`done`?`text-success`:e===`failed`?`text-danger`:`text-muted-foreground`}function Cn({wait:e,dependencyLabel:t}){return(0,X.jsxs)(`p`,{className:`px-2 break-words`,children:[e.phase===`parked`&&t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:`requestIds`in e&&e.requestIds?e.phase===`parked`?`Waiting on request replies`:e.phase===`wake-pending`?`Conversation update queued for this task`:`Request wait registered — the agent is finishing its turn`:e.phase===`parked`?`Waiting on workers`:e.phase===`wake-pending`?`Worker update queued for the parent`:`Worker wait registered — the agent is finishing its turn`,`.`,`deadline`in e?(0,X.jsxs)(X.Fragment,{children:[` `,`Deadline: `,(0,X.jsx)(`time`,{dateTime:e.deadline,children:e.deadline})]}):` No deadline: ${n(`Cezar`)} wakes this task when they have all settled.`]})}function wn(e){return e.delegation?.role===`worker`&&_(e)?.phase===`wake-pending`}function Tn({run:e}){let t=_(e);return e.delegation?.role===`worker`&&t?.phase===`wake-pending`?(0,X.jsx)(Cn,{wait:t,dependencyLabel:p(`worker`,t)}):null}function En({capacity:e}){return(0,X.jsxs)(`span`,{"data-slot":`worker-capacity`,role:`status`,"aria-label":`Worker capacity: ${e.outstanding} of ${e.limit} in use`,className:`ms-auto shrink-0 whitespace-nowrap text-[13px] font-normal text-muted-foreground tabular-nums`,children:[e.outstanding,` of `,e.limit,` in use`]})}var Dn=new Set([`review`,`done`,`failed`,`cancelled`]);function On({parentRunId:e,worker:t}){let n=me(e),[r,i]=(0,Y.useState)(!1);if(!Dn.has(t.status)||t.destroy?.phase===`complete`&&t.destroy.remaining.length===0)return null;let o=t.workerId.slice(0,8),s=!!t.destroy&&t.destroy.phase!==`complete`;return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 px-1`,children:[r?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`break-words text-xs`,children:`Removes this worker's worktree and branch. Its result is saved first.`}),(0,X.jsx)(a,{variant:`danger-ghost`,size:`sm`,className:`min-h-11`,"aria-label":`Confirm clean up of worker ${o}`,onClick:()=>{i(!1),n.mutate(t.workerId)},children:`Clean up`}),(0,X.jsx)(a,{variant:`outline`,size:`sm`,className:`min-h-11`,onClick:()=>i(!1),children:`Cancel`})]}):(0,X.jsx)(a,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":s?`Retry clean up of worker ${o}`:`Clean up worker ${o}`,disabled:n.isPending,onClick:()=>i(!0),children:n.isPending?`Cleaning up…`:s?`Retry clean up`:`Clean up`}),n.isError&&!r?(0,X.jsxs)(`span`,{role:`status`,className:`break-words text-xs`,children:[`Cleanup did not finish: `,n.error.message]}):null]})}function kn(e){return e!==void 0&&(e.phase!==`complete`||e.remaining.length>0||e.error!==void 0)}function An({state:e}){if(!kn(e))return null;let t=e.phase===`complete`?void 0:e.retry,n=t&&(0,X.jsx)(jn,{at:t.nextAt});return(0,X.jsxs)(`p`,{className:`px-2 pb-2 break-words`,children:[t?.needsAttention?`Cleanup needs attention`:e.phase===`incomplete`?`Cleanup incomplete`:e.phase===`complete`?`Cleanup complete`:`Cleanup ${e.phase}`,e.remaining.length?` — remaining: ${e.remaining.join(`, `)}`:``,e.error?` — ${t?e.error.replace(/\.$/,``):e.error}`:``,t?.needsAttention?(0,X.jsxs)(X.Fragment,{children:[`. Nothing changed after `,t.attempts,` automatic attempts; checking hourly, next check `,n,`. Retry clean up to try now.`]}):t?(0,X.jsxs)(X.Fragment,{children:[`. Retrying automatically, next attempt `,n,`.`]}):null]})}function jn({at:e}){let t=xt(3e4);return(0,X.jsx)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:At(t,Date.parse(e))})}function Mn({id:e}){return(0,X.jsxs)(W,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,"data-slot":`mobile-parent-task-link`,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm px-2 text-[13px] text-muted-foreground [min-block-size:2.75rem] [min-inline-size:2.75rem] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted active:text-foreground`,children:[(0,X.jsx)(Fe,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function Nn({id:e}){let t=ue(e),n=t.data?D(t.data):e;return(0,X.jsxs)(`div`,{"data-slot":`parent-task`,className:`flex min-w-0 flex-wrap items-center gap-x-2 text-[13px] text-muted-foreground`,children:[(0,X.jsxs)(W,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,title:`Parent · ${n}`,"data-slot":`parent-task-link`,className:`flex min-h-11 min-w-0 max-w-full items-center gap-2 rounded-sm text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:text-foreground`,children:[(0,X.jsx)(Fe,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,X.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,X.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,X.jsx)(a,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var Pn=3,Fn=(e,t)=>e.kind===t.kind&&e.number===t.number;function In(e,t,n=Pn){let r=t?e.findIndex(e=>Fn(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var Ln=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function Rn({tab:e}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(e.kind===`pr`?je:ze,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,X.jsx)(Qe,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function zn(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function Bn({servers:e}){let t=yt();if(t===null)return null;let n=t.agentLive===!0,r=e[0],i=e.length+ +!!n===1?r?{port:r.port}:{agent:!0}:{};return(0,X.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,X.jsx)(Ke,{"aria-hidden":`true`}),zn(e,n),t.live?(0,X.jsx)(G,{tone:`success`,"aria-label":`Preview is live`}):null]})}function Vn(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function Hn({run:e,compact:t=!1}){return e.delegation?.role===`worker`?t?(0,X.jsx)(Mn,{id:e.delegation.parentRunId}):(0,X.jsx)(Nn,{id:e.delegation.parentRunId}):null}function Un(e,t,n,r){return!e.archiveBlocker&&t.archive&&(n!==`session`||!Ct(e,r))?(0,X.jsx)(Z,{run:e}):null}function Wn({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,X.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function Gn({shown:e,run:t,archiveButton:n,previewToggle:r}){let i=on(t);return e&&(n||r||i)?(0,X.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,r,(0,X.jsx)(sn,{run:t})]}):null}function Kn({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:i,phoneBar:a,isDesktop:o}){let s=(0,Y.useRef)(null),c=n?`${n.kind}#${n.number}`:null;return(0,Y.useEffect)(()=>{!c||o||s.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[c,r.map(e=>`${e.kind}#${e.number}`).join(`,`),o]),(0,X.jsxs)(`div`,{ref:s,"data-slot":`run-tabs`,"data-phone-bar":a||void 0,className:`mt-3 flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-3.5 max-md:[&>a]:text-[13.5px]`,children:[(0,X.jsx)(J,{to:`/tasks/${e.id}`,active:t===`session`,replace:a,children:`Session`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:a,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:a,children:`Commits`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:a,children:`Files`}),r.map(t=>(0,X.jsx)(J,{to:Ln(e.id,t),active:n!==null&&Fn(t,n),replace:a,children:(0,X.jsx)(Rn,{tab:t})},`${t.kind}-${t.number}`)),i.length>0?(0,X.jsxs)(R,{children:[(0,X.jsxs)(I,{"data-slot":`run-tabs-more`,"aria-label":`${i.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,i.length]}),(0,X.jsx)(L,{align:`end`,children:i.map(t=>(0,X.jsx)(N,{asChild:!0,children:(0,X.jsx)(W,{to:Ln(e.id,t),replace:a,children:(0,X.jsx)(Rn,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function qn({run:e,tab:t=`session`,onMarkedUnread:n}){let r=d(e),i=q(e),a=gn(e),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1),f=Jn(e,n),p=ae(),ee=re(),m=qt(e,{queuePosition:e.status===`queued`?ve(p.data??[]).get(e.id):void 0}),h=ft(),g=It(),_=h!==null&&!g?h:null,v=_!==null,{referenceProjectId:y,repoBase:b,requests:te}=Xt(e),ne=(0,Y.useMemo)(()=>Ae(e,b),[e,b]),x=typeof t==`object`?t:null,{inline:S,overflow:ie}=In(ne,x),C=ee.data?.capabilities?.preview===!0,w=e.worktreePath&&C?(0,X.jsx)(Bn,{servers:e.previewServers??[]}):null,T=(0,X.jsx)(Qn,{run:e,actions:f,onOpenChooser:()=>u(!0),onToggleNotes:()=>c(e=>!e)}),E=Un(e,i,t,a);return(0,X.jsx)(Ze,{projectId:y,repoBase:b,requests:te,children:(0,X.jsxs)(`header`,{"data-slot":`run-header`,className:o(`relative z-20 bg-background px-[18px] md:px-9 md:pt-7`,v?`pt-0`:`pt-[18px]`,t===`session`&&`md:sticky md:top-0`),children:[(0,X.jsx)(Wn,{run:e}),(0,X.jsx)(Gt,{run:e}),(0,X.jsxs)(`div`,{className:`w-full`,children:[(0,X.jsx)(Hn,{run:e}),_?(0,X.jsxs)(_t,{slot:_,children:[(0,X.jsx)(Zn,{run:e}),(0,X.jsx)(Hn,{run:e,compact:!0}),T]}):(0,X.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,X.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:Vn(e.delegation)}),(0,X.jsx)(Xn,{run:e}),(0,X.jsx)(kt,{dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-md:hidden`,children:Jt(m)}),(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[E,w,(0,X.jsx)(sn,{run:e}),T]})]}),(0,X.jsx)(Gn,{shown:_!==null,run:e,archiveButton:E,previewToggle:w}),(0,X.jsx)(Kn,{run:e,tab:t,activeItem:x,inlineItemTabs:S,overflowItemTabs:ie,phoneBar:v,isDesktop:g}),s?(0,X.jsx)(tr,{runId:e.id,onClose:()=>c(!1)}):null,l?(0,X.jsx)(en,{run:e,canResume:q(e).terminal,onResume:()=>f.terminal.mutate(),onClose:()=>u(!1)}):null]}),(0,X.jsx)(er,{run:e,actions:f})]})})}function Jn(e,t){let n=ee(),r=ct(),[i,a]=(0,Y.useState)(null),o=()=>n.invalidateQueries({queryKey:de.runs.all}),s=e=>O(e.message,{tone:`danger`}),c=E(),l={isPending:c.isPending,mutate:()=>c.mutate({id:e.id,pinned:!e.pinned})},u=w();return{pin:l,markUnread:{isPending:u.isPending,mutate:()=>{t?.(),u.mutate(e.id,{onError:s})}},delete:C({mutationFn:()=>y(e.id),onSuccess:()=>{o(),r(`/`)},onError:s}),terminal:Zt(e),confirming:i,setConfirming:a}}function Yn(e){let t=S(e.id),n=D(e);return{title:n,editor:Dt(n,e=>t.mutate({title:e},{onError:e=>O(e.message,{tone:`danger`})}))}}function Xn({run:e}){let{title:t,editor:n}=Yn(e);return n.editing?(0,X.jsx)(St,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,X.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(Et,{className:`size-3.5`,"aria-hidden":`true`})})]})}function Zn({run:e}){let{title:t,editor:n}=Yn(e);return(0,X.jsxs)(Oe,{open:n.editing,onOpenChange:e=>{e?n.begin():n.commit()},children:[(0,X.jsx)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-px`,children:(0,X.jsx)(`h1`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,title:e.task,children:t})}),(0,X.jsx)(Ee,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,className:`flex size-11 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(Et,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(xe,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),n.cancel()},children:(0,X.jsx)(St,{editor:n,className:`text-[16px] font-semibold`})})]})}function Qn({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=q(e),o=K(e),s=S(e.id),c=(0,Y.useId)();return(0,X.jsxs)(R,{children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(a,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,X.jsx)(Me,{"aria-hidden":`true`})})}),(0,X.jsxs)(L,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,X.jsx)(M,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),(0,X.jsxs)(N,{onSelect:n,children:[(0,X.jsx)(wt,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,X.jsx)(en,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),o?(0,X.jsxs)(N,{onSelect:()=>void Q(o,`Command copied to clipboard.`),children:[(0,X.jsx)(k,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,X.jsxs)(N,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,X.jsx)(Rt,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,X.jsxs)(F,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,X.jsx)(zt,{"aria-hidden":`true`}):(0,X.jsx)(Ne,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,X.jsx)(P,{}),(0,X.jsx)(M,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,X.jsx)(F,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:s.isPending,onCheckedChange:e=>s.mutate({archiveWhenDone:e},{onError:e=>O(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,X.jsx)(F,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:s.isPending,"aria-describedby":c,onCheckedChange:e=>s.mutate({autoMergePr:e},{onError:e=>O(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,X.jsx)(`p`,{id:c,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block:0.5rem]`,children:`After Done, auto-merge can mark a draft PR ready. It waits for current-head CI and GitHub rules. Merge comes before archive.`}),e.delegation?.role===`worker`?null:(0,X.jsx)($n,{run:e,patch:s}),i.deleteRun?(0,X.jsx)(P,{}):null,i.deleteRun?(0,X.jsxs)(N,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,X.jsx)(Ue,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})}function $n({run:e,patch:t}){let r=(0,Y.useId)(),i=(0,Y.useId)(),a=(0,Y.useId)(),o=e=>O(e.message,{tone:`danger`});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(P,{}),(0,X.jsx)(M,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,X.jsxs)(F,{"data-slot":`allow-workers`,className:`min-h-11`,checked:te(e),disabled:t.isPending,"aria-describedby":`${r} ${a}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:o}),children:[`Allow `,n(`cezar`),` workers`]}),(0,X.jsxs)(`p`,{id:r,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:[`Agents in this task can start `,n(`Cezar`),` workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`]}),(0,X.jsx)(F,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:u(e),disabled:t.isPending,"aria-describedby":`${i} ${a}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:o}),children:`Allow task messaging`}),(0,X.jsx)(`p`,{id:i,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can message other tasks in this project.`}),(0,X.jsx)(`p`,{id:a,"data-slot":`task-access-session-note`,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Turning one off applies at once. Turning one on reaches a running agent at its next session.`})]})}function er({run:e,actions:t}){let n=t.confirming;return(0,X.jsx)(tt,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,X.jsxs)(V,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(et,{children:[(0,X.jsx)(B,{className:`text-danger`,children:`Delete task permanently?`}),(0,X.jsx)(z,{children:(0,X.jsxs)(X.Fragment,{children:[`Delete “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:D(e),children:D(e)}),`” and its transcript, worktree and branch. This cannot be undone.`]})})]}),(0,X.jsxs)(U,{children:[(0,X.jsx)($e,{children:`Cancel`}),(0,X.jsx)(H,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function tr({runId:e,onClose:t}){let n=he(e);return(0,X.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,X.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,X.jsx)(Be,{})})]}),n.isPending?(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,X.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,X.jsx)(ln,{runId:e,children:(0,X.jsx)(mt,{children:n.data})}):(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,X.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,X.jsx)(a,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Q(n.data??``,`Notes copied`),children:`Copy notes`}),(0,X.jsx)(a,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{qt as _,kn as a,hn as c,ln as d,tn as f,Xt as g,Zt as h,Tn as i,pn as l,$t as m,An as n,wn as o,nn as p,_n as r,gn as s,qn as t,dn as u,Z as v};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,s as n,u as r}from"./button-DGwhwRuD.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{Ln as o,Mn as s,Vn as c,tr as l}from"./project-scope-context-CSPQyWoO.js";import{M as u}from"./live-protocol-aMLJJ0MQ.js";import"./queries-pj368bmB.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{a as f,d as p,h as m,i as ee,l as te,m as ne,n as re,o as ie,p as h,r as ae,t as oe,u as g}from"./es2015-DTn4s5Lh.js";import{_,b as se,v as ce,x as le,y as ue}from"./dropdown-menu-DPrTX-zi.js";import"./attention-BDa7opY9.js";function de(e){if(e.workflow===`(planned)`||e.workflow===`(inbox)`){let t=(e.steps??[]).find(e=>e.kind===`agent`);if(t?.name)return t.name}return e.workflow}var fe=d(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),v=e(i(),1),y=a(),b=`Popover`,[pe,me]=ne(b,[le]),x=le(),[he,S]=pe(b),C=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=x(t),c=v.useRef(null),[l,u]=v.useState(!1),[d,f]=p({prop:r,defaultProp:i??!1,onChange:a,caller:b});return(0,y.jsx)(se,{...s,children:(0,y.jsx)(he,{scope:t,contentId:te(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:v.useCallback(()=>u(!0),[]),onCustomAnchorRemove:v.useCallback(()=>u(!1),[]),modal:o,children:n})})};C.displayName=b;var w=`PopoverAnchor`,T=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=S(w,n),a=x(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return v.useEffect(()=>(o(),()=>s()),[o,s]),(0,y.jsx)(_,{...a,...r,ref:t})});T.displayName=w;var ge=`PopoverTrigger`,_e=v.forwardRef((e,t)=>{let{__scopePopover:r,...i}=e,a=S(ge,r),o=x(r),s=n(t,a.triggerRef),c=(0,y.jsx)(m.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":A(a.open),...i,ref:s,onClick:h(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:(0,y.jsx)(_,{asChild:!0,...o,children:c})});_e.displayName=ge;var E=`PopoverPortal`,[ve,ye]=pe(E,{forceMount:void 0}),be=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=S(E,t);return(0,y.jsx)(ve,{scope:t,forceMount:n,children:(0,y.jsx)(g,{present:n||a.open,children:(0,y.jsx)(ee,{asChild:!0,container:i,children:r})})})};be.displayName=E;var D=`PopoverContent`,xe=v.forwardRef((e,t)=>{let n=ye(D,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=S(D,e.__scopePopover);return(0,y.jsx)(g,{present:r||a.open,children:a.modal?(0,y.jsx)(Ce,{...i,ref:t}):(0,y.jsx)(we,{...i,ref:t})})});xe.displayName=D;var Se=t(`PopoverContent.RemoveScroll`),Ce=v.forwardRef((e,t)=>{let r=S(D,e.__scopePopover),i=v.useRef(null),a=n(t,i),o=v.useRef(!1);return v.useEffect(()=>{let e=i.current;if(e)return oe(e)},[]),(0,y.jsx)(re,{as:Se,allowPinchZoom:!0,children:(0,y.jsx)(O,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:h(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||r.triggerRef.current?.focus()}),onPointerDownOutside:h(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;o.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:h(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),we=v.forwardRef((e,t)=>{let n=S(D,e.__scopePopover),r=v.useRef(!1),i=v.useRef(!1);return(0,y.jsx)(O,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),O=v.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,p=S(D,n),m=x(n);return ae(),(0,y.jsx)(f,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,y.jsx)(ie,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>p.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,y.jsx)(ue,{"data-state":A(p.open),role:`dialog`,id:p.contentId,...m,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),k=`PopoverClose`,Te=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=S(k,n);return(0,y.jsx)(m.button,{type:`button`,...r,ref:t,onClick:h(e.onClick,()=>i.onOpenChange(!1))})});Te.displayName=k;var Ee=`PopoverArrow`,De=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=x(n);return(0,y.jsx)(ce,{...i,...r,ref:t})});De.displayName=Ee;function A(e){return e?`open`:`closed`}var Oe=C,ke=T,Ae=_e,je=be,Me=xe,Ne=new Set([`queued`,`running`,`waiting`]);function Pe(e){return Ne.has(e)}function j(e){return l(e)?!1:e.status===`queued`||e.status===`running`||e.status===`waiting`}function Fe(e){return j(e)&&e.status!==`queued`}function M(e,t,n){return e.archived||!(e.status===`done`||e.status===`failed`||e.status===`cancelled`)||e.delegation?.role===`worker`||n!==void 0&&c(e)!==n?!1:t===`unpinned`?!e.pinned:t!==`pinned`||e.pinned===!0}var Ie=[`done`,`failed`];function N(e){return e.archived||l(e)||!Ie.includes(e.status)?!1:e.finishedAt!==void 0}function Le(e){let t=e.finishedAt;return t===void 0||!N(e)?!1:e.seenAt===void 0||e.seenAt<t}var P=[`Needs you`,`Finished`,`Working`,`Archived`],Re={waiting:0,review:1,running:2,queued:4,done:5,failed:6,cancelled:7},ze=3,F=e=>l(e)?ze:Re[e.status]??9;function Be(e){let t=e=>s[o(e).bucket];return[...e].sort((e,n)=>t(e)-t(n)||F(e)-F(n))[0]}function Ve(e,t){return t===`archived`?`Archived`:o(e).bucket===`waiting`?`Needs you`:e.status===`waiting`||e.status===`running`||e.status===`queued`?`Working`:`Finished`}function I(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function L(e){let t=/^(\d{1,9}): (.+)$/.exec(e),n=t?.[1],r=t?.[2];return n===void 0||r===void 0?{ref:null,rest:e}:{ref:Number(n),rest:r}}function He(e,t){return t!==void 0&&L(e).ref===t}function R(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));return new Map(t.map((e,t)=>[e.id,t+1]))}function Ue(e,t){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,n)=>{if(t!==`archived`){let t=Number(!!n.pinned)-Number(!!e.pinned);if(t!==0)return t}let r=F(e)-F(n);if(r!==0)return r;if(l(e)&&l(n)){let t=e.autoResumeAt.localeCompare(n.autoResumeAt);if(t!==0)return t}return e.status===`queued`&&n.status===`queued`?e.createdAt.localeCompare(n.createdAt):n.createdAt.localeCompare(e.createdAt)})}function z(e){return e.delegation?.role===`worker`}function We(e,t){if(e==null)return null;let n=t.find(t=>t.id===e);return!n||!z(n)?e:n.delegation?.parentRunId??e}function Ge(e,t,n=R(e)){let r=Ue(e,t).filter(e=>!z(e)),i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])};for(let e of r)a(Ve(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null});return P.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function Ke(e,t={}){let n=typeof t==`number`?{overall:t}:u(t),r={"Needs you":`needsYou`,Finished:`finished`,Working:`working`},i=[],a=n.overall===void 0?10:n.overall??1/0;for(let t of e){let e=t.label===`Archived`?1/0:n[r[t.label]]??1/0,o=t.rows.filter(n=>{let r=n.run.pinned;return t.label!==`Archived`&&r?!0:a<=0||e<=0?!1:(--a,--e,!0)});o.length&&i.push({label:t.label,rows:o})}return i}function qe(e,t){if(t.length===0)return[...e];let n=new Set(e.map(e=>e.id)),r=new Set,i=t.filter(e=>n.has(e.id)||r.has(e.id)?!1:(r.add(e.id),!0));return[...e,...i]}function Je(e){let t=0,n=0,r=0;for(let i of e)if(!z(i)){if(i.archived){n+=1;continue}t+=1,o(i).bucket===`waiting`&&(r+=1)}return{active:t,archived:n,waiting:r}}function Ye(e,t){let n=t===`automations`;return e.filter(e=>!e.archived&&c(e)===n)}var B={"Needs you":`needs-you`,Finished:`finished`,Working:`working`},V=Object.keys(B),H=`section`;function Xe(e,t){return`/?origin=${t===`automations`?`automations`:`direct`}&${H}=${B[e]}`}function Ze(e){return V.find(t=>B[t]===e)??null}function Qe(e){let t={active:0,automations:0,activeWaiting:0,automationsWaiting:0};for(let n of e){if(z(n)||n.archived)continue;let e=+(o(n).bucket===`waiting`);c(n)?(t.automations+=1,t.automationsWaiting+=e):(t.active+=1,t.activeWaiting+=e)}return t}function U(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function $e(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=U(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t(U(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function et(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:U(e)}:{top:0,bottom:0}}function tt(e,t=0){let n=typeof t==`number`?{top:t,right:t,bottom:t,left:t}:t;return{top:(n.top??0)+e.top,right:n.right??0,bottom:(n.bottom??0)+e.bottom,left:n.left??0}}function nt(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(et(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function rt(){let[e,t]=(0,v.useState)({top:0,bottom:0});return(0,v.useEffect)(()=>nt(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function it(e){let t=(0,v.useRef)(e);t.current=e,(0,v.useEffect)(()=>{let e=document.documentElement;return $e(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}var at=new Set([``,`text`,`search`,`email`,`url`,`tel`,`password`,`number`]);function ot(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t.tagName?.toUpperCase();return n===`TEXTAREA`?!0:n===`INPUT`?at.has((t.type??``).toLowerCase()):t.isContentEditable===!0}var W=new WeakMap;function st(e){let t=W.get(e),n=t&&t.width===e.innerWidth?Math.max(t.height,e.innerHeight):e.innerHeight;return W.set(e,{width:e.innerWidth,height:n}),n-e.innerHeight}function ct(e){let t=st(e),n=e.visualViewport?.scale??1;return Math.abs(n-1)<.05&&U(e)>80||t>80&&ot(e.document?.activeElement)}function lt(){let[e,t]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let e=window,n=()=>t(ct(e));n();let r=e.visualViewport;return r?.addEventListener(`resize`,n),r?.addEventListener(`scroll`,n),window.addEventListener(`resize`,n),document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,n),()=>{r?.removeEventListener(`resize`,n),r?.removeEventListener(`scroll`,n),window.removeEventListener(`resize`,n),document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,n)}},[]),e}function ut(e){let t=/\/(\d+)\/?$/.exec(e.trim()),n=t?Number(t[1]):NaN;return Number.isInteger(n)&&n>0?n:null}function dt(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?ut(n):null;e!==null&&t.add(e)}for(let n of[e.prNumber,e.issueNumber,e.markerRefs?.pr,e.markerRefs?.issue])typeof n==`number`&&Number.isInteger(n)&&n>0&&t.add(n);for(let n of e.pullRequests??[])t.add(n.number);return[...t]}var ft=[{id:`title`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.title]},{id:`titleSummary`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.titleSummary]},{id:`displayTitle`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.displayTitle]},{id:`branch`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.branch]},{id:`workflow`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflow]},{id:`workflowLabel`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflowLabel]},{id:`automation`,kind:`text`,scopes:[`stored`,`shown`],source:`reader`,texts:(e,t)=>[t.automation],universe:e=>[...e.automationNames?.values()??[]]},{id:`projectName`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.projectName]},{id:`tags`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>t.tags??[]},{id:`id`,kind:`identifier`,scopes:[`stored`],source:`summary`,texts:e=>[e.id]},{id:`urls`,kind:`link`,scopes:[`stored`],source:`summary`,texts:e=>[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl,...(e.pullRequests??[]).map(e=>e.url)]},{id:`heldReferences`,kind:`reference`,scopes:[`stored`],source:`summary`,numbers:dt},{id:`shownReferences`,kind:`reference`,scopes:[`shown`],source:`reader`,numbers:(e,t)=>t.references?.()??[]}];function pt(e){return e.trim().toLowerCase().split(/\s+/).filter(e=>e!==``)}function mt(e,t){return t&&e.automationId!==void 0?t.get(e.automationId)??e.automationId:void 0}function ht(e,t){let n=t.scope??`stored`,r=t.scope===`shown`?t.extras:{automation:mt(e,t.automationNames)},i=[],a=[],o=[],s={text:i,identifier:a,link:o},c=[];for(let t of ft)if(t.scopes.includes(n)){if(t.kind===`reference`){c.push(()=>t.numbers(e,r));continue}for(let n of t.texts(e,r))typeof n==`string`&&s[t.kind].push(n.toLowerCase())}let l;return{prose:i,ids:a,links:o,references:()=>l??=new Set(c.flatMap(e=>e().map(String)))}}function G(e,t,n={}){let r=pt(t);if(r.length===0)return!1;let{prose:i,ids:a,links:o,references:s}=ht(e,n);return r.every(e=>{if(i.some(t=>t.includes(e)))return!0;let t=e.replace(/^#/,``);return/^\d+$/.test(t)?s().has(String(Number(t)))||a.some(e=>e.startsWith(t)):a.some(t=>t.includes(e))||o.some(t=>t.includes(e))})}var gt=new Set([`running`,`waiting`]);function K(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function _t(e){return e===void 0?``:`$${e>=10?e.toFixed(0):e.toFixed(2)}`}function vt(e,t=new Date){if(!l(e))return;let n=new Date(e.autoResumeAt);if(!Number.isFinite(n.getTime()))return;let r=n.toDateString()===t.toDateString(),i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);return{label:r?i:`${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(n)} ${i}`,title:`Resumes automatically at ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n)}`}}function yt(e){return e.steps?de({workflow:e.workflow,steps:e.steps}):e.workflowLabel??e.workflow}function bt(e,t,n=()=>``){let r=e.filter(e=>!z(e));return t.trim()?r.filter(e=>G(e,t,{scope:`shown`,extras:{displayTitle:I(e),automation:n(e),references:()=>q(e)}})):[...r]}function q(e){return Y(e).map(e=>e.number)}function J(e,t){return e.filter(e=>M(e,t)).length}function xt(e){return J(e)}function St(e){return Ct(e)[0]??e.pullRequests?.find(e=>e.url)?.url}function Ct(e){let t=[];return e.pullRequestUrl&&t.push(e.pullRequestUrl),!(e.markerRefs?.issue!==void 0&&e.markerRefs?.pr===void 0)&&e.referencedPullRequestUrl&&t.push(e.referencedPullRequestUrl),t}function wt(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.issueNumber??e.markerRefs?.issue;if(!(!n||!t))return`${t}/issues/${n}`}function Tt(e){let t=`${e.kind}#${e.number}`;if(!e.url)return`${t}@project:${e.projectId??`default`}`;try{let n=new URL(e.url),r=n.pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`);return`${t}@${n.host.toLowerCase()}/${r.toLowerCase()}`}catch{return`${t}@${e.url}`}}function Y(e,t,n=e.projectId){let r=Ct(e),i=e.markerRefs?.pr,a=[...i===void 0||[...r,...(e.pullRequests??[]).flatMap(e=>e.url?[e.url]:[])].some(e=>Z(e)===String(i))?[]:[{kind:`PR`,number:i}],...r.map(e=>({kind:`PR`,url:e})),{kind:`PR`,number:e.prNumber},...(e.pullRequests??[]).map(e=>({kind:`PR`,number:e.number,...e.url?{url:e.url}:{},authoritative:!0})),{kind:`Issue`,url:wt(e,t)},{kind:`Issue`,number:e.issueNumber}],o=new Set,s=[];for(let e of a){let r=e.url?Number(Z(e.url)):e.number;if(!r||!Number.isInteger(r)||!e.url&&!e.authoritative&&s.some(t=>t.url&&t.kind===e.kind&&t.number===r))continue;let i=e.url??Et(e.kind,r,t),a={kind:e.kind,number:r,...i?{url:i}:n===void 0?{}:{projectId:n}},c=Tt(a);o.has(c)||(o.add(c),s.push(a))}return s}function Et(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function Dt(e){return Y(e)[0]}function X(e,t){if(!e.url)return!0;if(!t)return!1;let n=Ot(t);return n!==void 0&&Ot(e.url)===n}function Ot(e){try{let t=new URL(e),[n,r]=t.pathname.split(`/`).filter(Boolean);return n&&r?`${t.host}/${n}/${r}`.toLowerCase():void 0}catch{return}}function kt(e,t){let n=[];for(let r of Y(e,t)){if(!X(r,t))continue;let e=r.kind===`PR`?`pr`:`issue`;n.some(t=>t.kind===e&&t.number===r.number)||n.push({kind:e,number:r.number})}return n}function At(e,t,n,r){if(X(n,r))return`/p/${e}/tasks/${t}/${n.kind===`PR`?`pr`:`issue`}/${n.number}`}function Z(e){return/\/(\d+)\/?(?:[?#].*)?$/.exec(e)?.[1]??null}function jt(e,t){let n=gt.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:K(n.rssBytes),kind:`live`}};let r=K(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}var Q=v.createContext(null);function Mt({...e}){let t=v.useRef(!1);return(0,y.jsx)(Q,{value:t,children:(0,y.jsx)(Oe,{"data-slot":`popover`,...e})})}function Nt({onPointerDownCapture:e,onKeyDownCapture:t,...n}){let r=v.useContext(Q);return(0,y.jsx)(Ae,{"data-slot":`popover-trigger`,...n,onPointerDownCapture:t=>{r&&(r.current=t.pointerType===`touch`),e?.(t)},onKeyDownCapture:e=>{r&&(r.current=!1),t?.(e)}})}function Pt({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:i,onOpenAutoFocus:a,...o}){let s=rt(),c=v.useContext(Q);return(0,y.jsx)(je,{children:(0,y.jsx)(Me,{"data-slot":`popover-content`,align:t,sideOffset:n,onOpenAutoFocus:e=>{let t=c?.current;if(c&&(c.current=!1),a?.(e),e.defaultPrevented||!t)return;let n=e.target;n instanceof HTMLElement&&n.querySelector(`[cmdk-input]`)&&(e.preventDefault(),n.focus({preventScroll:!0}))},collisionPadding:tt(s,i),className:r(`z-50 w-72 max-w-(--radix-popover-content-available-width) [overflow-wrap:anywhere] origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,e),...o})})}function Ft({...e}){return(0,y.jsx)(ke,{"data-slot":`popover-anchor`,...e})}var $=`(min-width: 48rem)`;function It(){let[e,t]=(0,v.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 48rem)`).matches);return(0,v.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia($),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}export{V as A,Xe as B,jt as C,lt as D,it as E,Be as F,qe as G,Qe as H,Ze as I,Pe as J,N as K,R as L,Ge as M,z as N,P as O,Je as P,fe as Q,He as R,Y as S,G as T,Ye as U,We as V,L as W,M as X,Fe as Y,Le as Z,wt as _,Pt as a,St as b,xt as c,X as d,Z as f,J as g,q as h,Ft as i,Ke as j,H as k,_t as l,vt as m,It as n,Nt as o,Tt as p,j as q,Mt as r,bt as s,$ as t,K as u,At as v,yt as w,Dt as x,kt as y,I as z};
@@ -1 +0,0 @@
1
- import{Hr as e,jr as t}from"./project-scope-context-CSPQyWoO.js";function n(n,r){return t(n,e,r)}export{n as t};