@wjarka/cezarion 0.18.0-dev.7864 → 0.18.0-dev.7871

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 (54) hide show
  1. package/package.json +2 -2
  2. package/web/dist/assets/activity-motion-BNen0Yj8.js +2 -0
  3. package/web/dist/assets/{activity-route-CLmY_b61.js → activity-route-BGQMI1Yu.js} +1 -1
  4. package/web/dist/assets/attention-B0IBc2_D.js +1 -0
  5. package/web/dist/assets/{cez-idle-BZ4uUtP5.js → cez-idle-BY3rjM_y.js} +1 -1
  6. package/web/dist/assets/commit-diff-panel-Cr-XVbz_.js +1 -0
  7. package/web/dist/assets/{diff-B24jjrQd.js → diff-DqLaONaB.js} +2 -2
  8. package/web/dist/assets/{diff-view-Bm2zScMG.js → diff-view-CHj5zMlT.js} +1 -1
  9. package/web/dist/assets/{file-preview-BfjbLW39.js → file-preview-C9yv3267.js} +1 -1
  10. package/web/dist/assets/{git-toolbar-BrYOg59q.js → git-toolbar-uHPKACQa.js} +1 -1
  11. package/web/dist/assets/github-Fy6-Zf4b.js +1 -0
  12. package/web/dist/assets/{global-activity-route-BafNHfLS.js → global-activity-route-CpAGVfbb.js} +1 -1
  13. package/web/dist/assets/index-Dn02NPUV.js +14 -0
  14. package/web/dist/assets/live-protocol-D9ji1YCl.js +64 -0
  15. package/web/dist/assets/{markdown-twEr0qCN.js → markdown-9j2EqN9q.js} +1 -1
  16. package/web/dist/assets/{picker-pill-B8HQMHMO.js → picker-pill-D8SyrTxD.js} +1 -1
  17. package/web/dist/assets/{preview-pane-connected-Bo8pHl2j.js → preview-pane-connected-CBKK0crt.js} +1 -1
  18. package/web/dist/assets/{project-router-CFmb6NlX.js → project-router-CcyPWtFH.js} +1 -1
  19. package/web/dist/assets/project-scope-context-CX36ze1Q.js +4 -0
  20. package/web/dist/assets/{prompt-template-menu-DBFmXFq5.js → prompt-template-menu-DT_0Pyd5.js} +1 -1
  21. package/web/dist/assets/queries-Cb76PEoL.js +1 -0
  22. package/web/dist/assets/{reference-chip-6RyUrDc6.js → reference-chip-DwiE3MIR.js} +1 -1
  23. package/web/dist/assets/{repo-git-DQWv--Qn.js → repo-git-CjKFvYdb.js} +1 -1
  24. package/web/dist/assets/{report-reader-4oGG3Se7.js → report-reader--BXJs1DJ.js} +1 -1
  25. package/web/dist/assets/{reports-DNerAT8g.js → reports-CZw5ztdC.js} +1 -1
  26. package/web/dist/assets/run-header-BOEjnB1z.js +2 -0
  27. package/web/dist/assets/{runners-M0-6Uumh.js → runners-CKrq5tR_.js} +1 -1
  28. package/web/dist/assets/{skills-C8MBWEQN.js → skills-aBp_7vVU.js} +1 -1
  29. package/web/dist/assets/{tab-link-B8m0q2sJ.js → tab-link-Dn7KFNYr.js} +1 -1
  30. package/web/dist/assets/{task-changes-CQRx1eKQ.js → task-changes-B0u392zf.js} +1 -1
  31. package/web/dist/assets/task-commits-DzWFfo43.js +1 -0
  32. package/web/dist/assets/{task-files-DFbWrnO0.js → task-files-DTWfdMRi.js} +1 -1
  33. package/web/dist/assets/{task-github-item-DX0X2N_q.js → task-github-item-CFWE3MpX.js} +1 -1
  34. package/web/dist/assets/{task-thread-B7dKPXaT.js → task-thread-vYwAvLtU.js} +6 -6
  35. package/web/dist/assets/{thread-state-Cq_aBDjM.js → thread-state-zGEm4Ym4.js} +1 -1
  36. package/web/dist/assets/{use-desktop-NTwdvSZg.js → use-desktop-DN7wbSS7.js} +1 -1
  37. package/web/dist/assets/{use-hand-to-agent-state-DHEEAr6b.js → use-hand-to-agent-state-C9YTgLEG.js} +1 -1
  38. package/web/dist/assets/{useInfiniteQuery-g210uX4t.js → useInfiniteQuery-BdIIhzMI.js} +1 -1
  39. package/web/dist/assets/useQuery-Dg1rzYtR.js +1 -0
  40. package/web/dist/assets/{workflows-DmJXA1-k.js → workflows-C8EnR0NU.js} +2 -2
  41. package/web/dist/assets/{ws-DBXUJ3K4.js → ws-DiWUfn_t.js} +1 -1
  42. package/web/dist/index.html +15 -15
  43. package/web/dist/live-worker.js +1 -1
  44. package/web/dist/assets/activity-motion-Djgfr4BR.js +0 -2
  45. package/web/dist/assets/attention-BbVNVmrP.js +0 -1
  46. package/web/dist/assets/commit-diff-panel-D-oVsbVi.js +0 -1
  47. package/web/dist/assets/github-Bz9XYDMM.js +0 -1
  48. package/web/dist/assets/index-WeSdteYZ.js +0 -14
  49. package/web/dist/assets/live-protocol-60uiPDg6.js +0 -64
  50. package/web/dist/assets/project-scope-context-Dlbq88xo.js +0 -4
  51. package/web/dist/assets/queries-BtkCvBtK.js +0 -1
  52. package/web/dist/assets/run-header-DeyjkCoC.js +0 -2
  53. package/web/dist/assets/task-commits-B4ZCZUoh.js +0 -1
  54. package/web/dist/assets/useQuery-D89BPQpm.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{A as n,M as r}from"./button-C1fD-ZFr.js";import{n as i,t as a}from"./live-refetch-CZb2VOyu.js";import{$ as o,$r as s,$t as c,At as l,B as u,Ci as d,Ct as f,Dt as p,Et as m,F as h,Ft as g,G as _,H as v,Ht as y,I as ee,J as te,Jr as ne,Kr as re,Kt as ie,L as ae,M as oe,Or as se,Ot as ce,Pr as le,Q as ue,Qr as de,R as fe,S as pe,Sr as me,Tt as he,V as ge,Vt as _e,X as ve,Xr as ye,Y as b,Yr as be,Z as xe,Zr as Se,_ as Ce,_i as x,_t as we,a as Te,an as Ee,at as De,bi as Oe,bn as ke,bt as Ae,cn as je,ct as Me,dn as Ne,dt as Pe,en as Fe,et as Ie,fi as Le,ft as Re,gn as ze,gt as Be,h as Ve,hi as He,hn as Ue,ht as We,i as Ge,it as Ke,jt as qe,kr as Je,kt as Ye,l as Xe,ln as Ze,lt as Qe,mn as $e,mt as et,ni as tt,nn as nt,oi as rt,ot as it,p as at,pt as ot,q as st,qr as ct,r as lt,rn as ut,rt as dt,si as ft,st as pt,ti as S,tn as mt,tt as ht,ui as gt,un as _t,ut as vt,v as yt,vn as bt,vr as xt,vt as St,wt as Ct,x as wt,xn as Tt,y as Et,yi as Dt,yt as Ot,z as kt}from"./project-scope-context-Dlbq88xo.js";import{J as C}from"./live-protocol-60uiPDg6.js";import{t as w}from"./useInfiniteQuery-g210uX4t.js";import{t as T}from"./useQuery-D89BPQpm.js";import{n as At,r as E,t as jt}from"./ws-DBXUJ3K4.js";import{n as Mt}from"./toaster-Cxgzn9ip.js";var Nt=class extends rt{#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||Pt(),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),C.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Pt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ft=class extends d{#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),Dt(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&gt(t.mutationKey)!==gt(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??Pt();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){C.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 It(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Lt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Rt=class extends d{#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,C.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||!Dt(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(It(e,n).forEach(e=>{e.destroy()}),It(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=x(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 tt(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Lt(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)&&C.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},D=e(t(),1);function O({queries:e,...t},n){let r=S(n),i=s(),a=de(),o=D.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{re(e);let t=r.getQueryCache().get(e.queryHash);be(e,a,t)}),Se(a);let[c]=D.useState(()=>new Rt(r,o,t)),[l,u,d]=c.getOptimisticResult(o,t.combine),f=!i&&t.subscribed!==!1;D.useSyncExternalStore(D.useCallback(e=>f?c.subscribe(C.batchCalls(e)):He,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),D.useEffect(()=>{c.setQueries(o,t)},[o,t,c]);let p=l.some((e,t)=>ne(o[t],e))?l.flatMap((e,t)=>{let n=o[t];return n&&ne(n,e)?ct(n,new tt(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=o[t];return n&&ye({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m?.error)throw m.error;return u(d())}function k(e,t){let n=S(t),[r]=D.useState(()=>new Ft(n,e));D.useEffect(()=>{r.setOptions(e)},[r,e]);let i=D.useSyncExternalStore(D.useCallback(e=>r.subscribe(C.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=D.useCallback((e,t)=>{r.mutate(e,t).catch(He)},[r]);if(i.error&&Oe(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function A(e={}){let t=e.projectId??r();return{projectId:t,cacheScope:e.cacheScope??(e.boot?`default`:t)}}function j(e,t={}){return{...A(t),runId:e}}function M(e,t,n=`active`){return e.invalidateQueries({queryKey:t===void 0?[`workspace`,`models`]:X.models(t),refetchType:n})}function zt(e,t=!0,n){return T({...Bt(e,n),enabled:t})}var Bt=(e,t)=>({queryKey:X.models(e,t),queryFn:({signal:n})=>Ge(e,{signal:n},t),staleTime:300*1e3});function Vt(e,t=!0){let n=O({queries:e.map(e=>({...Bt(e),enabled:t}))});return Object.fromEntries(e.map((e,t)=>[e,n[t]]))}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 Ht(e){let{seenAt:t,...n}=e;return n}function Ut(e,t){let n=Ht(e);return t.seenAt===void 0?n:{...n,seenAt:t.seenAt}}function L(e,t,n){return t?{...e,seenAt:n}:Ht(e)}function Wt(e){let t=()=>{e.invalidateQueries({queryKey:N})};function n(n,i){if(n===`index`)return t();let a=typeof i==`function`?i():i;if(n===`indexed`){t(),e.invalidateQueries({queryKey:[r(),`runs`]}),e.invalidateQueries({queryKey:[a.projectId,`runs`,`list`]});return}if(n===`runs`)return e.invalidateQueries({queryKey:[a.cacheScope,`runs`]});let o=Je(),s=[a.projectId,a.cacheScope],c=o!==void 0&&s.some(e=>e===o||e==="default")?[o,`default`]:[],l=new Set([...s,...c,r()]);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?Ut(e,t):e)),a&&e.setQueryData(F(I(n)),e=>e&&Ut(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,r){await e.cancelQueries({queryKey:N});let i=e.getQueryData(N),a=r();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(){n(`indexed`,t)}}}return{patchRead:i,patchIndex:a,invalidateAfter:n}}function R(){let e=S();return(0,D.useMemo)(()=>Wt(e),[e])}function Gt(e){return e.type===`run`?e.run.id:e.id}function z(e,t){return{...e,runs:t}}function Kt(e,t){let n=0;for(let r of e)r.projectId===t&&r.archived&&(n+=1);return n}function qt(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 Jt(e,t,n){return n?n.has(t):e.runs.some(e=>e.projectId===t)}function Yt(e,t,n){let{project:r}=t,i=Gt(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&&!Jt(e,r,n))return{index:e,reconcile:!0};let l=x(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||Kt(t,r)>e.perProjectLimit);return{index:z(e,t),reconcile:n}}if(s)return Zt(e,l);let u=qt(e.runs,l);return{index:z(e,u),reconcile:l.archived&&Kt(u,r)>e.perProjectLimit}}function Xt(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 Zt(e,t){let n=Xt(e.runs,t.projectId),r=n!==void 0&&t.createdAt>n;return t.archived&&!r?{index:e,reconcile:!1}:{index:z(e,qt(e.runs,t)),reconcile:t.archived||n===void 0||t.createdAt<n}}function Qt(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=x(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 $t(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 en(){return{stream:void 0,lastStream:void 0,mismatch:void 0,floor:void 0,changes:new Map}}function tn(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 nn(e){e.stream=void 0}function rn(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,Gt(t)]),a=e.changes.get(i);return(!a||a.seq<t.seq)&&e.changes.set(i,{...t,generation:r}),!0}function an(e,t){for(let[n,r]of e.changes)r.project===t&&e.changes.delete(n)}function on(e){return typeof e.generation==`string`&&typeof e.eventSeq==`number`}function sn(e,t,n){if(!on(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=Yt(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`],cn=[`workspace`,`projects`],ln=6e4,un=100,dn=new WeakMap;function V(e){let t=dn.get(e);return t||(t=gn(e),dn.set(e,t)),t}function fn(e,t){return typeof e!=`object`||!e||!Array.isArray(e.runs)?e:V(t).merge(e)}function pn(e){let t=e.getQueryData(cn)?.projects;return t?new Set(t.map(e=>e.id)):void 0}function mn(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 hn(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 gn(e){let t=en(),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=pn(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=Qt(s,e.project,e.usage));continue}if(l.has(e.change.project)||e.change.seq<=a.eventSeq)continue;let t=Yt(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,un),typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(v))};return{ready(e,n){tn(t,e,n),u=!1,f&&(f=!1,_({hold:!0}))},detach(){nn(t)},run(e,r,i=!1){if(l.has(e))return;let a=hn(e,r);if(!rn(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),an(t,e),n=n.filter(t=>(t.type===`change`?t.change.project:t.project)!==e);let r=h();if(!r)return;let i=$t(r,e);i!==r&&m(i)},setUnknownGenerationHandler(e){d=e},restoreProject(e){l.delete(e)},merge(n){let r=h(),i=sn(t,n,pn(e));for(let e of l)i.index=$t(i.index,e);return i.reconcile&&queueMicrotask(()=>{_({hold:!0})}),mn(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 _n={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`}},vn={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function yn(e){return typeof e==`string`&&Object.hasOwn(_n,e)}function bn(e){return e!==void 0&&yn(e)?_n[e]:void 0}var xn=`cez.reference-statuses.v1`,Sn=`cez.reference-conflicts.v1`,H=new Map(Tn()),Cn=1e3;function U(e,t){if(H.get(e)!==t){for(H.delete(e),H.set(e,t);H.size>Cn;){let e=H.keys().next().value;if(e===void 0)break;H.delete(e)}Dn()}}var W=new Set(En());function wn(e,t){if(W.has(e)!==t){if(t)for(W.add(e);W.size>Cn;){let e=W.values().next().value;if(e===void 0)break;W.delete(e)}else W.delete(e);Dn()}}function Tn(){try{let e=globalThis.sessionStorage?.getItem(xn);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`&&yn(e[1])):[]}catch{return[]}}function En(){try{let e=globalThis.sessionStorage?.getItem(Sn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var G;function Dn(){G===void 0&&(G=setTimeout(()=>{G=void 0;try{globalThis.sessionStorage?.setItem(xn,JSON.stringify([...H])),globalThis.sessionStorage?.setItem(Sn,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 On(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 kn(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&&wn(t,s),e.set(t,{state:`ready`,status:o,...s??a?{conflicting:!0}:{}})}function An(e,t,n){let r=K(t),i=H.get(r),a=W.has(r)?!0:void 0,o=n.data;if(o?.available){kn(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 jn(e,t){let n=new Map;return t.forEach((t,r)=>{let i=e[r];if(i)for(let e of On(i))An(n,e,t)}),n}async function Mn(e,t=!1){return ze(await at.api.v1.p[`:projectId`].runs[`:id`][`worker-destroy`].$post({param:{projectId:r(),id:encodeURIComponent(e)},query:{},json:t?{discardWork:!0}:{}}),je(e,`/worker-destroy`))}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)]}function Hn(e,t,n=!0){let i=Ur(),a=$(),o=e??i.data?.defaultRunner??`claude`,s=a.data?.capabilities?.localHandoff===!1?null:t,c=r(),l=T({queryKey:Y.runnerSkills(o,s),queryFn:({signal:e})=>Ct(o,s,{signal:e,projectId:c}),enabled:n&&(e!==void 0||!i.isPending)&&(!t||!a.isPending),retry:!1});return{...l,runner:o,account:s,data:l.data?.skills,list:l.data,unchecked:l.isError||!l.data||l.data.source===`unavailable`}}var Y={get health(){return[r(),`health`]},runs:{get all(){return[r(),`runs`]},relationships:e=>[r(),`runs`,`relationships`,e],list:(e=r())=>[e,`runs`,`list`],archived:e=>[r(),`runs`,`archived`,e],detail:(e,t=r())=>[t,`runs`,`detail`,e],diff:e=>[r(),`runs`,`diff`,e],changes:e=>[r(),`runs`,`changes`,e],file:(e,t)=>[r(),`runs`,`files`,e,t],handoff:e=>[r(),`runs`,`handoff`,e],commits:e=>[r(),`runs`,`commits`,e],commit:(e,t)=>[r(),`runs`,`commit`,e,t]},get workflows(){return[r(),`workflows`]},runnerSkills:(e,t)=>[r(),`runner-skills`,e,t??null],get repo(){return[r(),`repo`]},get repoChanges(){return[r(),`repo`,`changes`]},repoCommit:e=>[r(),`repo`,`commit`,e],get repoBranches(){return[r(),`repo`,`branches`]},get uiState(){return[r(),`ui-state`]},get config(){return[r(),`config`]},get agentConfig(){return[r(),`agent-config`]},agentConfigFile:e=>[r(),`agent-config`,`file`,e],get worktrees(){return[r(),`worktrees`]},github:(e={})=>[r(),`github`,e.limit??null],githubPages:e=>[r(),`github`,`pages`,e],githubPagesHead:e=>[r(),`github`,`pages-head`,e],githubCommentCounts:(e,t)=>[r(),`github`,`comment-counts`,e,[...t].sort((e,t)=>e-t).join(`,`)],githubChecks:e=>[r(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[r(),`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)=>[r(),`github`,`comments`,e,t],githubItem:(e,t)=>[r(),`github`,`item`,e,t],githubRefStatusOf:e=>[e,`github`,`ref-status`],githubPrChanges:e=>[r(),`github`,`pr-changes`,e],githubMergeState:e=>[r(),`github`,`merge-state`,e],get openTargets(){return[r(),`open-targets`]}},X={models:(e,t)=>t&&t!=="default"?[`workspace`,`models`,e,t]:[`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`],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...X.fsBrowseRoot,e,t]};function Un(){let e=S();return T({queryKey:X.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(X.providerStatus),r=await Qe(!1,{signal:t});return me(n,e.getQueryData(X.providerStatus),r)},staleTime:5*6e4,refetchInterval:a(!1),refetchOnWindowFocus:!0})}function Wn(){let e=S();return k({mutationFn:()=>Qe(!0),onMutate:()=>e.getQueryData(X.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(X.providerStatus,e=>me(r,e,t)),M(e)}})}function Gn(){let e=S();return k({mutationFn:({provider:e,authFailureId:t})=>Ee(e,t),onMutate:()=>e.getQueryData(X.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(X.providerStatus,e=>me(r,e,t,n.authFailureId)),M(e,n.provider)}})}function Kn(e={}){return T({queryKey:X.projects,queryFn:({signal:e})=>Me({signal:e}),...e})}function qn(e,t=!1){return T({queryKey:X.fsBrowse(e,t),queryFn:({signal:n})=>Xe(e??void 0,{signal:n,showHidden:t}),retry:!1})}function Jn(){let e=S();return k({mutationFn:e=>c(e),onSuccess:()=>e.invalidateQueries({queryKey:X.projects})})}function Yn(){let e=S();return k({mutationFn:e=>mt(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:X.projects})}})}function Xn(){let e=S();return k({mutationFn:e=>{let{id:t,...n}=e;return ke(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 Z(e){let t=S();return k({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 Qn(){return Z(e=>{let{projectId:t,...n}=e;return pe(t,n)})}function $n(){return Z(e=>{let{projectId:t,webhookId:n,...r}=e;return Tt(t,n,r)})}function er(){return Z(({projectId:e,webhookId:t})=>nt(e,t))}function tr(){return k({mutationFn:({projectId:e,webhookId:t})=>Ue(e,t),retry:!1})}function nr(e){let t=S();return k({mutationFn:t=>g(e,t),retry:!1,onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function Q(e){let t=S();return k({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:X.agentProfiles}),t.invalidateQueries({queryKey:X.projects}),t.invalidateQueries({predicate:({queryKey:e})=>e[1]===`runner-skills`}),M(t)])}})}function rr(){return Q(e=>Et(e))}function ir(){return Q(e=>{let{id:t,...n}=e;return bt(t,n)})}function ar(){return Q(e=>Fe(e))}function or(){return Q(e=>_t(e))}function sr(e,t){return T({queryKey:X.agentAccountStatus(e),queryFn:({signal:t})=>h(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function cr(){let e=S();return k({mutationFn:({provider:e,profileId:t})=>Ce(e,t),retry:!1,onSuccess:async(t,{provider:n})=>{await Promise.all([e.invalidateQueries({queryKey:X.agentProfiles}),e.invalidateQueries({queryKey:X.providerStatus}),M(e,n,`none`)])}})}function lr(){let e=S();return k({mutationFn:e=>h(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(X.agentAccountStatus(n),t),e.invalidateQueries({queryKey:X.agentProfiles}),M(e,t.status.provider)}})}function ur(){let e=S();return k({mutationFn:e=>Ve(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:X.projects})})}function dr(){let e=S();return k({mutationFn:e=>wt(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:X.projects})})}function fr({enabled:e}){return T({queryKey:X.githubOwners,queryFn:({signal:e})=>Ie({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function pr(){let e=S();(0,D.useEffect)(()=>{let t,r=()=>{let r=e.getQueryData(Y.health);r&&(se({bootProject:r.bootProject??`default`,apiBase:n()}),t??=jt(`health`,t=>{e.setQueryData(Y.health,t)}))};r();let i=e.getQueryCache().subscribe(r);return()=>{i(),t?.(),le()}},[e])}function $(){return T({queryKey:Y.health,queryFn:({signal:e})=>it({signal:e})})}function mr(e,t){let n=$().data,r=Kn(t).data?.projects,i=lt(),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 hr(){return T({queryKey:Y.openTargets,queryFn:({signal:e})=>pt({signal:e}),staleTime:5*6e4})}function gr(){return T({queryKey:Y.runs.list(),queryFn:({signal:e})=>he(A(),{signal:e})})}function _r(e,t){return w({queryKey:Y.runs.archived(e),enabled:t,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>kt({before:t,limit:200,q:e},{signal:n}),getNextPageParam:e=>e.nextCursor??void 0,placeholderData:(e,t)=>t?.queryKey[0]===r()?e:void 0})}function vr(e){let t=e.trim();return T({queryKey:X.runsSearch(t),queryFn:({signal:e})=>Ze(t,{signal:e}),enabled:t.length>=2,placeholderData:Le,staleTime:1e4})}function yr(e=!0,t=ln){let n=V(S());return E(`/api/v1/workspace/runs-index`,X.runsIndex,a(e?t:!1),fn),T({queryKey:X.runsIndex,queryFn:({signal:e})=>m({signal:e}).then(n.merge),enabled:e,staleTime:3e4,refetchInterval:!1})}function br(e,t=!0,n=!1){return T({queryKey:[A({projectId:e,boot:n}).cacheScope,`runs`,`list`],queryFn:({signal:t})=>he(A({projectId:e,boot:n}),{signal:t}),enabled:t,placeholderData:(t,r)=>n&&r?.queryKey[0]===e?t:void 0})}function xr(e){let t=S();return k({mutationFn:({workerId:e,discardWork:t=!1})=>Mn(e,t),onSettled:()=>t.invalidateQueries({queryKey:Y.runs.relationships(e)})})}function Sr(e,t={}){return T({queryKey:Y.runs.relationships(e),queryFn:({signal:t})=>f(e,{signal:t}),enabled:t.enabled??!0})}function Cr(e){return T({queryKey:Y.runs.detail(e??``),queryFn:({signal:t})=>et(j(e),{signal:t}),enabled:!!e})}function wr(e,t,n=!0){return T({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>et(j(t,{projectId:e}),{signal:n}),enabled:n&&!!e&&!!t})}function Tr(e){return T({queryKey:Y.runs.diff(e??``),queryFn:({signal:t})=>St(e,{signal:t}),enabled:!!e})}function Er(e,t=!1){return E(e?`/api/v1/p/${r()}/runs/${encodeURIComponent(e)}/changes`:void 0,Y.runs.changes(e??``),a(t?4e3:!1)),T({queryKey:Y.runs.changes(e??``),queryFn:({signal:t})=>We(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0})}function Dr(e,t){return T({queryKey:Y.runs.file(e??``,t??``),queryFn:({signal:n})=>Ot(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function Or(e,t){return T({queryKey:[r(),`runs`,`file-link`,e,t],queryFn:({signal:n})=>te(e,t,{signal:n}),enabled:t!==null,retry:!1})}function kr(e,t){return T({queryKey:[r(),`runs`,`artifact`,e,t],queryFn:({signal:n})=>u(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Ar(e,t){return T({queryKey:[r(),`runs`,`artifact-metadata`,e,t],queryFn:({signal:n})=>ge(e,t,{signal:n}),enabled:t!==null,retry:!1})}function jr(e){return T({queryKey:[r(),`runs`,`artifacts`,e],queryFn:({signal:t})=>v(e,{signal:t}),retry:!1,staleTime:0,refetchOnWindowFocus:!0})}function Mr(e,t=!1){return E(e?`/api/v1/p/${r()}/runs/${encodeURIComponent(e)}/commits`:void 0,Y.runs.commits(e??``),a(t?5e3:!1)),T({queryKey:Y.runs.commits(e??``),queryFn:({signal:t})=>we(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1})}function Nr(e,t){return T({queryKey:Y.runs.commit(e??``,t??``),queryFn:({signal:n})=>Be(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function Pr(e,t=!0){return T({queryKey:Y.runs.handoff(e??``),queryFn:({signal:t})=>Ae(j(e),{signal:t}),enabled:!!e&&t})}function Fr(e,t,n){return T({queryKey:e===void 0?Y.runs.handoff(t):[e,`runs`,`handoff`,t],queryFn:({signal:n})=>Ae(j(t,{projectId:e}),{signal:n}),enabled:n,staleTime:15e3})}function Ir(e,t){let n=[...new Set(e)],i=O({queries:n.map(e=>({queryKey:[e??r(),`automations`,`names`],queryFn:({signal:t})=>_({signal:t,archived:`include`,...e===void 0?{}:{projectId:e}}),enabled:t,staleTime:6e4,retry:!1}))}),a=i.map(e=>e.data);return(0,D.useMemo)(()=>{let e=new Map;return a.forEach((t,r)=>{if(t?.available)for(let i of t.automations)e.set(JSON.stringify([n[r]??null,i.id]),i.name)}),(t,n)=>e.get(JSON.stringify([t??null,n]))},[JSON.stringify([n,i.map(e=>e.dataUpdatedAt)])])}function Lr(){return T({queryKey:Y.workflows,queryFn:({signal:e})=>ce({signal:e})})}function Rr(){return T({queryKey:Y.repo,queryFn:({signal:e})=>vt({signal:e})})}function zr(e){return T({queryKey:[e,`repo`],queryFn:({signal:t})=>vt({signal:t},e)})}function Br(){return T({queryKey:Y.repoBranches,queryFn:({signal:e})=>Pe({signal:e})})}function Vr(){return T({queryKey:Y.repoChanges,queryFn:({signal:e})=>Re({signal:e}),retry:!1})}function Hr(e){return T({queryKey:Y.repoCommit(e??``),queryFn:({signal:t})=>ot(e,{signal:t}),enabled:!!e,retry:!1})}function Ur(){return T({queryKey:Y.config,queryFn:({signal:e})=>st({signal:e})})}function Wr(){return T({queryKey:Y.worktrees,queryFn:({signal:e})=>qe({signal:e})})}function Gr(e){return T({queryKey:[e,`worktrees`],queryFn:({signal:t})=>qe({signal:t},e),staleTime:0})}function Kr(e,t=!0,n=!1){return T({queryKey:[A({projectId:e,boot:n}).cacheScope,`ui-state`],queryFn:({signal:t})=>p({signal:t},e),select:e=>e.sidebarLimits===void 0?e:{...e,sidebarLimits:xt(e.sidebarLimits)},enabled:t})}function qr(){return Kr(r())}function Jr(){return T({queryKey:Y.agentConfig,queryFn:({signal:e})=>ee({signal:e})})}function Yr(e){return T({queryKey:Y.agentConfigFile(e??``),queryFn:({signal:t})=>ae(e,{signal:t}),enabled:e!==null})}function Xr(e){let t=S(),n=Y.agentConfig,r=Y.agentConfigFile(e);return k({mutationFn:t=>ie(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}function Zr(){return T({queryKey:X.uiState,queryFn:({signal:e})=>l({signal:e})})}function Qr(){return T({queryKey:X.config,queryFn:({signal:e})=>Ye({signal:e})})}function $r(){return T({queryKey:X.agentProfiles,queryFn:({signal:e})=>fe({signal:e})})}function ei(e){let t=S();return k({mutationFn:t=>_e(e,t),onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function ti(e){let t=R(),n=e?.projectId,r=e?.cacheScope,i=k({mutationFn:e=>$e(e,!0),onMutate:e=>t.patchRead(e,!0),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)}),a=(0,D.useCallback)(e=>({...j(e,{projectId:n,cacheScope:r}),id:e}),[n,r]),o=(0,D.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,D.useCallback)((e,t)=>s(a(e),o(t)),[s,a,o]),u=(0,D.useCallback)((e,t)=>c(a(e),o(t)),[c,a,o]);return{...i,variables:i.variables?.id,mutate:l,mutateAsync:u}}function ni(){let e=R();return k({mutationFn:e=>$e(j(e),!1),onMutate:t=>e.patchRead(()=>j(t),!1),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)})}function ri(e){let t=R();return k({mutationFn:({id:t,pinned:n})=>y(j(t,e),n),onError:e=>Mt(`Could not update pin. ${e.message} Please retry.`,{tone:`danger`}),onMutate:()=>e??A(),onSuccess:(e,n,r)=>t.invalidateAfter(`runs`,r)})}function ii(e,t){let n=R();return k({mutationFn:n=>Ne(j(e,{projectId:t}),n),onMutate:()=>A({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`send`,r),onError:(e,t,r)=>{e instanceof Te&&e.status===409&&r&&n.invalidateAfter(`send`,r)}})}function ai(e,t){let n=R();return k({mutationFn:(n={})=>yt(j(e,{projectId:t}),n),onMutate:()=>A({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`continue`,r)})}function oi(e){let t=S();return k({mutationFn:({msgId:t,message:n})=>oe(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function si(e){let t=S();return k({mutationFn:t=>ut(e,t),onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function ci(e={},t=!0){let n=S(),i=Y.github(e);E(`/api/v1/p/${r()}/github${e.limit===void 0?``:`?limit=${e.limit}`}`,i,a(t?6e4:!1));let o=T({queryKey:Y.github(e),queryFn:({signal:t})=>b({limit:e.limit},{signal:t}),enabled:t,staleTime:6e4,refetchInterval:!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0}),s=o.data?.projectsGeneration,c=T({queryKey:[...i,`projects`,s],queryFn:({signal:e})=>dt(s,{signal:e}),enabled:t&&o.data?.projectsState===`refreshing`&&!!s,staleTime:1/0,retry:!1});return(0,D.useEffect)(()=>{!s||!c.data&&!c.error||n.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.`}})},[n,s,c.data,c.error,i]),o}var li=class extends Error{};function ui(e,t,n){return{queryKey:e,initialPageParam:{},queryFn:async({pageParam:e,signal:r})=>{let i=await b({limit:t,...e,...n?{projectId:n}:{}},{signal:r});if(!i.available&&Object.keys(e).length>0)throw new li(i.reason??`GitHub is unavailable.`);return i},getNextPageParam:e=>Ln(e),retry:(e,t)=>!(t instanceof li)&&!(t instanceof Te&&t.status>=400&&t.status<500)&&e<1,staleTime:6e4,refetchOnWindowFocus:!0}}function di(e=50,t=!0){let n=S(),i=Y.githubPages(e),o=Y.githubPagesHead(e);E(`/api/v1/p/${r()}/github?limit=${e}`,o,a(t?6e4:!1));let s=w({...ui(i,e),enabled:t,refetchInterval:!1,refetchIntervalInBackground:!1}),c=T({queryKey:o,queryFn:({signal:t})=>b({limit:e},{signal:t}),enabled:!1,staleTime:1/0}),{refetch:l}=s;(0,D.useEffect)(()=>{if(!c.data)return;let e=n.getQueryData(i);if(!e||e.pages.length===0)return;let t=Vn(e.pages,c.data);t===`refetch`?l():n.setQueryData(i,{...e,pages:t})},[n,c.dataUpdatedAt,l]);let u=(s.data?.pages??[]).flatMap(e=>e.projectsState===`refreshing`&&e.projectsGeneration?[e.projectsGeneration]:[]),d=O({queries:u.map(e=>({queryKey:[...i,`projects`,e],queryFn:({signal:t})=>dt(e,{signal:t}),enabled:t,staleTime:1/0,retry:!1}))});return(0,D.useEffect)(()=>{d.forEach((e,t)=>{let r=u[t];!r||!e.data&&!e.error||n.setQueryData(i,t=>{if(!t)return t;let n=!1,i=t.pages.map(t=>{if(t.projectsGeneration!==r||t.projectsState!==`refreshing`)return t;let i=e.data;return i?.generation&&i.generation!==r?t:(n=!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 n?{...t,pages:i}:t})})},[n,d.map((e,t)=>e.data||e.error?u[t]:``).join(`,`)]),{pages:s,data:(0,D.useMemo)(()=>Bn(s.data?.pages??[]),[s.data])}}function fi(e,t=50,n=!0){let r=w({...ui([e,`github`,`pages`,t],t,e),enabled:n});return{pages:r,data:(0,D.useMemo)(()=>Bn(r.data?.pages??[]),[r.data])}}function pi(e,t,n=!0){let r=O({queries:t.filter(e=>e.length>0).map(t=>({queryKey:Y.githubCommentCounts(e,t),queryFn:({signal:n})=>xe(e,t,{},{signal:n}),enabled:n,staleTime:6e4}))});return(0,D.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 mi(e,t,n,r=!0){return T({queryKey:[e,`github`,`search`,t,n],queryFn:({signal:r})=>De(t,n,{projectId:e},{signal:r}),enabled:r&&n.trim()!==``,staleTime:6e4})}function hi(e,t=!0){return T({queryKey:Y.githubChecks(e),queryFn:({signal:t})=>ve(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function gi(e,t,n=!0){return T({queryKey:Y.githubSearch(e,t),queryFn:({signal:n})=>De(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var _i=100;function vi(e){return[...e].sort((e,t)=>t-e).slice(0,_i).sort((e,t)=>e-t)}function yi(){let e=lt(),t=$();return e.projectId??t.data?.bootProject}function bi(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 xi=5*6e4;function Si(e){return e?e.recheckAfterMs:xi}function Ci(e,t=!0){let n=(0,D.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:vi(t.prs),issues:vi(t.issues)}))},[e.map(K).sort().join(`|`)]),r=O({queries:n.map(e=>({queryKey:Y.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>Ke(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>Si(e.state.data)??1/0,refetchInterval:!1,refetchOnWindowFocus:!0}))}),a=S(),o=JSON.stringify(n.map((e,t)=>({...e,interval:Si(r[t]?.data)??!1})));(0,D.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 At({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,D.useMemo)(()=>jn(n,r),[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,D.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 wi(e,t,n=!0){return T({queryKey:Y.githubComments(e,t),queryFn:({signal:n})=>ue(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Ti(e,t,n=!0){return T({queryKey:Y.githubItem(e,t),queryFn:({signal:n})=>o(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Ei(e){return T({queryKey:Y.githubPrChanges(e??0),queryFn:({signal:t})=>ht(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{Ci as $,Ei as A,Lr as At,fi as B,vn as Bt,ci as C,ii as Ct,Ti as D,ir as Dt,wi as E,qr as Et,ni as F,Hn as Ft,br as G,Vt as Gt,zr as H,V as Ht,nr as I,Rn as It,Kn as J,j as Jt,Kr as K,zt as Kt,hr as L,Pn as Lt,$ as M,Zr as Mt,pr as N,Wr as Nt,fr as O,Xn as Ot,ti as P,X as Pt,yi as Q,ei as R,Fn as Rt,qn as S,or as St,pi as T,tr as Tt,mr as U,R as Ut,mi as V,bn as Vt,wr as W,M as Wt,Xr as X,Nt as Xt,Un as Y,k as Yt,lr as Z,dr as _,Pr as _t,Yr as a,si as at,oi as b,yr as bt,kr as c,Vr as ct,Ir as d,Cr as dt,Wn as et,ur as f,Er as ft,rr as g,Dr as gt,ai as h,Tr as ht,Jr as i,er as it,gi as j,Qr as jt,di as k,$n as kt,Ar as l,Hr as lt,cr as m,Mr as mt,bi as n,ar as nt,$r as o,Rr as ot,Ur as p,Nr as pt,Gr as q,A as qt,sr as r,Yn as rt,_r as s,Br as st,Y as t,Jn as tt,jr as u,Gn as ut,Qn as v,Sr as vt,hi as w,Fr as wt,Or as x,vr as xt,xr as y,gr as yt,ri as z,Nn as zt};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{E as r,S as i,l as a,t as o,u as s}from"./button-C1fD-ZFr.js";import{A as c,Dr as l,Fn as u,In as d,Jn as f,Kn as p,Mn as m,Qn as h,Rt as g,Zn as _,a as v,er as y,hr as b,mr as x,s as ee,ti as te,zt as S}from"./project-scope-context-Dlbq88xo.js";import{F as ne,I as re,J as C,Jt as w,L as T,M as ie,Q as E,R as D,U as ae,Ut as oe,Y as se,Yt as O,_t as ce,dt as le,qt as ue,t as de,vt as k,y as fe,yt as pe,z as me}from"./queries-BtkCvBtK.js";import{J as he,L as ge,S as A,_ as _e,a as ve,b as ye,d as be,f as xe,n as Se,o as Ce,p as we,r as Te,v as Ee,y as De,z as j}from"./use-desktop-NTwdvSZg.js";import{n as M}from"./toaster-Cxgzn9ip.js";import{s as Oe}from"./runners-M0-6Uumh.js";import{A as ke,F as Ae,a as je,at as Me,f as Ne,ft as Pe,g as Fe,h as Ie,i as Le,l as Re,m as ze,p as Be,q as Ve,t as He,v as N,x as Ue}from"./design-icons-B6-0w7Aw.js";import{t as P}from"./createLucideIcon-BHp8sXmF.js";import{t as We}from"./app-window-CSHwDX9N.js";import{t as Ge}from"./info-DA1x_4bz.js";import{a as Ke,t as qe}from"./format-BNCkW110.js";import{t as Je}from"./message-square-B-MD-8rD.js";import{i as Ye,n as Xe,t as F}from"./reference-chip-6RyUrDc6.js";import{a as I,i as L,l as R,n as z,p as B,r as V,t as H}from"./dropdown-menu-D4zMgwkC.js";import{a as Ze,i as Qe,o as $e,r as et,s as tt,t as nt}from"./dialog-DSwzMeY3.js";import{c as rt,s as it,t as U}from"./project-router-CFmb6NlX.js";import"./attention-BbVNVmrP.js";import{$t as at,At as W,Gt as ot,M as st,N as ct,Qt as lt,Tt as ut,U as dt,Ut as ft,Wt as pt,Zt as mt,_ as ht,_t as gt,a as _t,an as vt,bt as yt,dt as bt,en as xt,fn as St,ft as Ct,gt as wt,ht as Tt,j as Et,kt as G,lt as Dt,mt as Ot,o as kt,on as At,pt as jt,r as Mt,rn as Nt,t as Pt,ut as Ft,vt as It,xn as Lt,xt as Rt}from"./index-WeSdteYZ.js";import{r as zt,t as Bt}from"./markdown-twEr0qCN.js";import{t as K}from"./tab-link-B8m0q2sJ.js";var Vt=P(`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`}]]),Ht=P(`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`}]]),Ut=P(`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`}]]),q=e(t(),1),J=n();function Wt(e){let t=oe();return O({mutationFn:t=>ee(w(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>ue()),onError:e=>M(e.message,{tone:`danger`})})}function Gt(e){return e.archived?`Unarchive`:`Archive task`}function Kt({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,J.jsx)(Dt,{open:t,onOpenChange:n,children:(0,J.jsxs)(Ct,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,J.jsxs)(Tt,{children:[(0,J.jsx)(wt,{children:`Archive task?`}),(0,J.jsxs)(jt,{children:[`Move “`,(0,J.jsx)(`span`,{className:`font-medium text-foreground`,title:j(e),children:j(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,J.jsxs)(Ot,{children:[(0,J.jsx)(bt,{children:`Cancel`}),(0,J.jsx)(Ft,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function Y({run:e,className:t,compactOnMobile:n=!1}){let[r,i]=(0,q.useState)(!1),s=Wt(e.id),c=Gt(e);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(o,{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:a(`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,J.jsx)(Lt,{"aria-hidden":`true`}):(0,J.jsx)(He,{"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:a(n&&`max-md:sr-only`),children:c})]}),(0,J.jsx)(Kt,{run:e,open:r,onOpenChange:i,onConfirm:()=>{s.mutate(!0),i(!1)}})]})}function qt({run:e,action:t,prUrl:n,patch:r}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,J.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,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&s(n)?(0,J.jsx)(o,{variant:`outline`,asChild:!0,children:(0,J.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,J.jsx)(o,{variant:`outline`,disabled:r.isPending,onClick:()=>r.mutate({autoMergePr:!1},{onError:e=>M(e.message,{tone:`danger`})}),children:r.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function Jt({run:e,blocker:t,flags:n}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,J.jsx)(o,{variant:`outline`,asChild:!0,children:(0,J.jsx)(U,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&s(t.pullRequestUrl)?(0,J.jsx)(o,{variant:`outline`,asChild:!0,children:(0,J.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,J.jsx)(Y,{run:e}):null]})]})}function Yt({run:e}){let t=D(e.id),n=W(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,J.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,J.jsx)(qt,{run:e,action:a,prUrl:o,patch:t}):null,i?(0,J.jsx)(Jt,{run:e,blocker:i,flags:n}):null]})}var Xt=[`running`,`queued`,`waiting`];function Zt(e,{queuePosition:t,now:n=new Date}){let r=m(e),i=r.label.charAt(0).toUpperCase()+r.label.slice(1),a=t===void 0?i:`${i} #${t}`,o=Xt.includes(e.status)?$t(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Qt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function $t(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:qe(n,t)}}async function X(e,t){try{await navigator.clipboard.writeText(e),M(t)}catch{M(`Run manually: ${e}`)}}function en(e){let t=ae(),n=E(),r=(0,q.useMemo)(()=>A(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,q.useMemo)(()=>n===void 0?[]:r.filter(e=>be(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function tn(e){return O({mutationFn:()=>S(e.id),onError:e=>{if(e instanceof v&&e.command){X(e.command,`No terminal found — command copied to clipboard.`);return}M(e.message,{tone:`danger`})}})}function Z(e,t){let n=T(),r=se(),i=Oe(),a=O({mutationFn:t=>g(e.id,t),onError:e=>M(e.message,{tone:`danger`})}),o=l(r.data,i.data),s=e=>!r.isSuccess||!i.isSuccess||o.includes(e??`claude`);return{canResumeHere:t&&s(ut(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=at(e.id);return t===void 0||i.isSuccess&&s(t)}).map(t=>({target:t,...Rt(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:a}}function nn({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Z(e,t),s=Oe().data,c=G(e);return!r&&i.length===0&&!c?null:(0,J.jsxs)(J.Fragment,{children:[r||i.length>0?(0,J.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,J.jsxs)(o,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,J.jsx)(Nt,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=xt(e,s);return(0,J.jsxs)(o,{variant:`outline`,"data-target":e.id,title:n,disabled:a.isPending,onClick:()=>a.mutate(e.id),children:[(0,J.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,J.jsxs)(o,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>M(`Worktree path copied`)).catch(()=>M(`Path: ${t}`))},children:[(0,J.jsx)(N,{}),`Copy worktree path`]}):null]}):null,c?(0,J.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,J.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,J.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:c}),(0,J.jsxs)(o,{variant:`outline`,onClick:()=>void X(c,`Command copied to clipboard.`),children:[(0,J.jsx)(N,{}),`Copy resume command`]})]}):null]})}function rn({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Z(e,t),s=G(e),c=e.worktreePath;if(!r&&i.length===0&&!s&&!c)return null;let l=`max-md:min-h-11`;return(0,J.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,J.jsx)(lt,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,className:l,leading:r?(0,J.jsxs)(L,{"data-target":`terminal-resume`,onSelect:n,children:[(0,J.jsx)(Nt,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,c?(0,J.jsxs)(o,{variant:`outline`,size:`sm`,className:l,onClick:()=>void X(c,`Worktree path copied`),children:[(0,J.jsx)(N,{"aria-hidden":`true`}),`Copy worktree path`]}):null,s?(0,J.jsxs)(o,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:s,className:l,onClick:()=>void X(s,`Command copied to clipboard.`),children:[(0,J.jsx)(N,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function an({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:a,choices:s}=Z(e,t);return!a&&s.length===0?null:r?(0,J.jsx)(L,{onSelect:r,children:`Open in…`}):(0,J.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,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,J.jsx)(o,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,J.jsx)(Pe,{})})]}),e.worktreePath?(0,J.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,J.jsx)(`div`,{className:`mt-4`,children:(0,J.jsx)(nn,{run:e,canResume:t,onResume:n})})]})}function on({branch:e}){let[t,n]=(0,q.useState)(null),r=(0,q.useRef)(null);(0,q.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{M(`Could not copy branch. Select and copy: ${e}`)}};return(0,J.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,J.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,J.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,J.jsx)(N,{className:`size-3.5`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function sn({run:e}){let t=ae(),n=E(),r=r=>n===void 0?void 0:Ee(n,e.id,r,t),i=(0,q.useMemo)(()=>A(e,t),[e,t]),a=[],o=[],c=i.filter(e=>e.kind===`PR`);for(let t of c)a.push((0,J.jsx)(F,{reference:t,to:r(t),taskTitle:j(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,J.jsx)(It,{run:e,prNumber:t.number})},we(t)));let l=ye(e);l&&s(l)&&!c.some(e=>e.url===l)&&a.push((0,J.jsx)(F,{reference:{kind:`PR`,url:l},taskTitle:j(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=i.filter(e=>e.kind===`Issue`);for(let t of u)o.push((0,J.jsx)(F,{reference:t,to:r(t),taskTitle:j(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},we(t)));let d=_e(e,t);if(d&&s(d)&&!u.some(e=>e.url===d)){let t=xe(d);o.push((0,J.jsx)(F,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?r({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:j(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return a.length===0&&o.length===0?null:(0,J.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,a],[`Issue`,`Issues`,o]].map(([e,t,n])=>n.length>0?(0,J.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,J.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,J.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function cn(){let e=it(),t=C();return Et(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var ln=e=>e.map(e=>`${e.name}: ${st(e.url)}`).join(`
2
- `);function un(e){return cn().length>0||e.notify===!0}function dn({run:e}){let t=cn(),n=t.length>0,r=re(e.id),[i,a]=(0,q.useState)(null),s=e.notify===!0;return!n&&!s?null:(0,J.jsxs)(J.Fragment,{children:[s?(0,J.jsxs)(H,{children:[(0,J.jsx)(B,{asChild:!0,children:(0,J.jsxs)(o,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${ct(t)} — webhook actions`:`Notifying — webhook actions`,title:n?ln(t):void 0,children:[(0,J.jsx)(mt,{tone:`success`}),(0,J.jsx)(`span`,{children:`Notifying`}),(0,J.jsx)(Re,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,J.jsxs)(V,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,J.jsx)(I,{"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,J.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:st(e.url),children:e.name},e.id))}):null,n?(0,J.jsxs)(L,{className:`min-h-11`,onSelect:()=>a(`note`),children:[(0,J.jsx)(Je,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,J.jsxs)(L,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>M(`Stopped notifying the webhook`),onError:e=>M(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,J.jsx)(Vt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,J.jsxs)(o,{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:()=>a(`handoff`),children:[(0,J.jsx)(vt,{"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,J.jsx)(fn,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&a(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{a(null),M(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>M(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function fn({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let a=(0,q.useId)(),s=(0,q.useId)(),[c,l]=(0,q.useState)(``);(0,q.useEffect)(()=>{e!==null&&l(``)},[e]);let u=e===`note`,d=ct(t);return(0,J.jsx)(nt,{open:e!==null,onOpenChange:e=>{e||l(``),r(e)},children:(0,J.jsx)(et,{"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,J.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(c.trim())},children:[(0,J.jsxs)($e,{className:`text-left`,children:[(0,J.jsx)(tt,{children:u?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,J.jsx)(Qe,{children:(0,J.jsx)(`span`,{"data-webhook-destination":``,title:ln(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,J.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:a,className:`text-[13px] font-medium`,children:`Note`}),(0,J.jsx)(dt,{id:a,"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,J.jsxs)(`p`,{id:s,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,J.jsx)(Ge,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,J.jsxs)(Ze,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,J.jsx)(o,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,J.jsxs)(o,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||u&&c.trim()===``,children:[(0,J.jsx)(vt,{"aria-hidden":`true`}),u?`Send note`:`Hand off`]})]})]})})})}function pn({runId:e,children:t}){let n=i(),r=(0,q.useMemo)(()=>({runId:e}),[e]);return n?(0,J.jsx)(mn,{runId:e,children:t}):(0,J.jsx)(zt.Provider,{value:r,children:t})}function mn({runId:e,children:t}){let{projectId:n}=r(),i=(0,q.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,J.jsx)(zt.Provider,{value:i,children:t})}function hn(e,t,n,r){return n?r===`step`?`Step ${e} of ${t}`:`${e} of ${t} complete`:`${e} / ${t}`}function gn(e){return typeof e==`object`&&!!e&&!(0,q.isValidElement)(e)&&`keep`in e}function _n({slot:e,icon:t,title:n,meta:r,summary:i,aside:o,open:s,onToggle:c,className:l,children:u}){let d=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`flex size-4 shrink-0 items-center justify-center text-accent-text`,children:t}),(0,J.jsx)(`span`,{className:a(`truncate text-[14px] font-semibold text-foreground`,typeof n==`string`?`shrink-0`:`min-w-0 shrink`),children:n}),i??(gn(r)?(0,J.jsxs)(`span`,{"data-slot":`run-activity-meta`,className:`contents text-[13px] text-muted-foreground tabular-nums`,children:[r.drop===void 0?null:(0,J.jsxs)(`span`,{className:`flex h-[1lh] min-w-0 shrink-[2] flex-wrap overflow-hidden`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`h-[1lh] w-0`}),(0,J.jsxs)(`span`,{"data-slot":`run-activity-meta-drop`,className:`whitespace-nowrap`,children:[r.drop,(0,J.jsx)(`span`,{className:`text-soft-foreground`,children:` ·`})]})]}),` `,(0,J.jsx)(`span`,{"data-slot":`run-activity-meta-keep`,className:`shrink-0 whitespace-nowrap`,children:r.keep})]}):r===void 0?null:(0,J.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,J.jsxs)(`div`,{"data-slot":`run-activity-${e}`,"data-state":f&&s?`open`:`collapsed`,className:a(`min-w-0 border-t border-border first:border-t-0`,l),children:[f?(0,J.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,o,(0,J.jsx)(Re,{"aria-hidden":!0,className:a(`size-4 shrink-0 text-soft-foreground motion-safe:transition-transform motion-reduce:transition-none`,!o&&`ms-auto`,s&&`rotate-180`)})]}):(0,J.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2`,children:[d,o]}),f&&s?(0,J.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 Q(e){return x(e.delegation)}function vn(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 yn(e){let t=e.delegation,n=Q(e),r=k(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=vn(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 bn(e){let t=k(e.id,{enabled:e.delegation?.role===`root`});return t.isSuccess&&t.data.workers.some(e=>he(e.status))}function xn({run:e,open:t,onToggle:n}){let r=k(e.id),i=pe(),s=Se(),c=e.delegation,l=new Map(r.data?.workers.map(e=>[e.workerId,e])),u=vn(c,r.data),d=_(e)??h(e),f=d?Sn(e,d):void 0,p=e=>i.data?.find(t=>t.id===e)??r.data?.titles?.find(t=>t.id===e),m=e=>{let t=p(e);return t?j(t):`worker ${e.slice(0,8)}`};return(0,J.jsx)(_n,{slot:`workers`,icon:(0,J.jsx)(ke,{className:`size-4`}),title:`Workers`,meta:Cn({ids:u,workers:l,desktop:s,query:r}),aside:r.data?.capacity?(0,J.jsx)(An,{capacity:r.data.capacity}):void 0,open:t,onToggle:n,children:(0,J.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,J.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,J.jsx)(Dn,{wait:d,dependencyLabel:f}):null,u.length>0?(0,J.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),i=p(t),o=n?Tn(n.status):r.isSuccess?`Record unavailable or deleted`:`Status unavailable`;return(0,J.jsxs)(`li`,{"data-slot":`worker-item`,"data-status":n?.status,className:`min-w-0`,children:[(0,J.jsxs)(U,{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,J.jsx)(wn,{status:n?.status}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`block truncate`,children:i?j(i):`Worker ${t.slice(0,8)}`}),n?.supervisorRunId&&n.supervisorRunId!==e.id?(0,J.jsxs)(`span`,{"data-slot":`worker-supervisor`,className:`block truncate text-xs text-muted-foreground`,children:[`Started by `,m(n.supervisorRunId)]}):null]}),(0,J.jsx)(`span`,{className:a(`max-w-[45%] shrink-0 truncate text-xs`,En(n?.status)),children:o}),(0,J.jsx)(je,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`})]}),n?(0,J.jsx)(Mn,{parentRunId:e.id,worker:n}):null,n?.destroy?(0,J.jsx)($,{state:n.destroy}):null]},t)})}):Q(e)&&r.isSuccess?(0,J.jsx)(`p`,{className:`px-1 py-1`,children:`No workers`}):null,r.fetchStatus===`paused`?(0,J.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Offline — relationship details will refresh when connected.`}):r.isPending?(0,J.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Loading relationships…`}):null,r.isError?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-1 py-1`,children:[(0,J.jsx)(`p`,{role:`status`,children:`Could not load relationships. Known task links are retained.`}),(0,J.jsx)(o,{variant:`outline`,className:`min-h-11`,onClick:()=>void r.refetch(),children:`Retry relationships`})]}):null]})})}function Sn(e,t){let n=e.delegation;if(!(!n||n.role===`invalid`))return d(e)??u(n.role,t,`requestIds`in t&&y(n,t.requestIds))}function Cn({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 wn({status:e}){let t=`size-[15px] shrink-0`;return e===`done`?(0,J.jsx)(Ne,{"aria-hidden":!0,className:a(t,`text-success`)}):e===`failed`?(0,J.jsx)(Fe,{"aria-hidden":!0,className:a(t,`text-danger`)}):e===`cancelled`?(0,J.jsx)(Ie,{"aria-hidden":!0,className:a(t,`text-soft-foreground`)}):e===`running`||e===`waiting`||e===`review`?(0,J.jsx)(Ke,{role:`status`,"aria-label":`Worker running`,className:a(t,`animate-spin stroke-pending motion-reduce:animate-none`)}):(0,J.jsx)(ze,{"aria-hidden":!0,className:a(t,`text-soft-foreground`)})}function Tn(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function En(e){return e===`done`?`text-success`:e===`failed`?`text-danger`:`text-muted-foreground`}function Dn({wait:e,dependencyLabel:t}){return(0,J.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,J.jsxs)(J.Fragment,{children:[` `,`Deadline: `,(0,J.jsx)(`time`,{dateTime:e.deadline,children:e.deadline})]}):` No deadline: Squawk wakes this task when they have all settled.`]})}function On(e){return e.delegation?.role===`worker`&&h(e)?.phase===`wake-pending`}function kn({run:e}){let t=h(e);return e.delegation?.role===`worker`&&t?.phase===`wake-pending`?(0,J.jsx)(Dn,{wait:t,dependencyLabel:u(`worker`,t)}):null}function An({capacity:e}){return(0,J.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 jn=new Set([`review`,`done`,`failed`,`cancelled`]);function Mn({parentRunId:e,worker:t}){let n=fe(e),[r,i]=(0,q.useState)(!1);if(!jn.has(t.status)||t.destroy?.phase===`complete`&&t.destroy.remaining.length===0)return null;let a=t.workerId.slice(0,8),s=!!t.destroy&&t.destroy.phase!==`complete`,c=n.error instanceof v?n.error.work:void 0;return(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 px-1`,children:[r?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`break-words text-xs`,children:b(t.workspace)?`Removes this worker's worktree and branch. Its result is saved first.`:`Stops this worker and frees its slot. It runs in this task's worktree, so no worktree or branch is removed. Its result is saved first.`}),(0,J.jsx)(o,{variant:`danger-ghost`,size:`sm`,className:`min-h-11`,"aria-label":`Confirm clean up of worker ${a}`,onClick:()=>{i(!1),n.mutate({workerId:t.workerId})},children:`Clean up`}),(0,J.jsx)(o,{variant:`outline`,size:`sm`,className:`min-h-11`,onClick:()=>i(!1),children:`Cancel`})]}):(0,J.jsx)(o,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":s?`Retry clean up of worker ${a}`:`Clean up worker ${a}`,disabled:n.isPending,onClick:()=>i(!0),children:n.isPending?`Cleaning up…`:s?`Retry clean up`:`Clean up`}),n.isError&&!r?(0,J.jsx)(`span`,{role:`status`,className:`break-words text-xs`,children:c?`Cleanup stopped: this worker holds ${Pn(c)}. Land or commit what you need first, or discard it.`:`Cleanup did not finish: ${n.error.message}`}):null,c&&!r&&!n.isPending?(0,J.jsx)(o,{variant:`danger-ghost`,size:`sm`,className:`min-h-11`,"aria-label":`Discard work and clean up worker ${a}`,onClick:()=>n.mutate({workerId:t.workerId,discardWork:!0}),children:`Discard work and clean up`}):null]})}var Nn=(e,t,n)=>`${e} ${e===1?t:n}`;function Pn(e){return[...e.uncommittedFiles?[Nn(e.uncommittedFiles,`uncommitted file`,`uncommitted files`)]:[],...e.commits?[`${Nn(e.commits,`commit`,`commits`)} no other branch reaches`]:[]].join(` and `)}function Fn(e){return e!==void 0&&(e.phase!==`complete`||e.remaining.length>0||e.error!==void 0)}function $({state:e}){if(!Fn(e))return null;let t=e.phase===`complete`?void 0:e.retry,n=t&&(0,J.jsx)(In,{at:t.nextAt});return(0,J.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,J.jsxs)(J.Fragment,{children:[`. Nothing changed after `,t.attempts,` automatic attempts; checking hourly, next check `,n,`. Retry clean up to try now.`]}):t?(0,J.jsxs)(J.Fragment,{children:[`. Retrying automatically, next attempt `,n,`.`]}):null]})}function In({at:e}){let t=gt(3e4);return(0,J.jsx)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:Pt(t,Date.parse(e))})}function Ln({id:e}){return(0,J.jsxs)(U,{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,J.jsx)(Le,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function Rn({id:e}){let t=le(e),n=t.data?j(t.data):e;return(0,J.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,J.jsxs)(U,{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,J.jsx)(Le,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,J.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,J.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,J.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,J.jsx)(o,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var zn=3,Bn=(e,t)=>e.kind===t.kind&&e.number===t.number;function Vn(e,t,n=zn){let r=t?e.findIndex(e=>Bn(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 Hn=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function Un({tab:e}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(e.kind===`pr`?Ae:Be,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,J.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,J.jsx)(Xe,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function Wn(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function Gn({servers:e}){let t=ht();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,J.jsxs)(o,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,J.jsx)(We,{"aria-hidden":`true`}),Wn(e,n),t.live?(0,J.jsx)(mt,{tone:`success`,"aria-label":`Preview is live`}):null]})}function Kn(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function qn({run:e,compact:t=!1}){if(e.delegation?.role!==`worker`)return null;let n=e.delegation.supervisorRunId??e.delegation.parentRunId;return t?(0,J.jsx)(Ln,{id:n}):(0,J.jsx)(Rn,{id:n})}function Jn(e,t,n,r){return!e.archiveBlocker&&t.archive&&(n!==`session`||!yt(e,r))?(0,J.jsx)(Y,{run:e}):null}function Yn({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,J.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function Xn({shown:e,run:t,archiveButton:n,previewToggle:r}){let i=un(t);return e&&(n||r||i)?(0,J.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,r,(0,J.jsx)(dn,{run:t})]}):null}function Zn({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:i,phoneBar:a,isDesktop:o}){let s=(0,q.useRef)(null),c=n?`${n.kind}#${n.number}`:null;return(0,q.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,J.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,J.jsx)(K,{to:`/tasks/${e.id}`,active:t===`session`,replace:a,children:`Session`}),(0,J.jsx)(K,{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,J.jsx)(K,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:a,children:`Commits`}),(0,J.jsx)(K,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:a,children:`Files`}),r.map(t=>(0,J.jsx)(K,{to:Hn(e.id,t),active:n!==null&&Bn(t,n),replace:a,children:(0,J.jsx)(Un,{tab:t})},`${t.kind}-${t.number}`)),i.length>0?(0,J.jsxs)(H,{children:[(0,J.jsxs)(B,{"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,J.jsx)(V,{align:`end`,children:i.map(t=>(0,J.jsx)(L,{asChild:!0,children:(0,J.jsx)(U,{to:Hn(e.id,t),replace:a,children:(0,J.jsx)(Un,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function Qn({run:e,tab:t=`session`,onMarkedUnread:n}){let r=m(e),i=W(e),o=bn(e),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(!1),d=$n(e,n),f=pe(),p=ie(),h=Zt(e,{queuePosition:e.status===`queued`?ge(f.data??[]).get(e.id):void 0}),g=ot(),_=pt(),v=g!==null&&!_?g:null,y=v!==null,{referenceProjectId:b,repoBase:x,requests:ee}=en(e),te=(0,q.useMemo)(()=>De(e,x),[e,x]),S=typeof t==`object`?t:null,{inline:ne,overflow:re}=Vn(te,S),C=p.data?.capabilities?.preview===!0,w=e.worktreePath&&C?(0,J.jsx)(Gn,{servers:e.previewServers??[]}):null,T=(0,J.jsx)(rr,{run:e,actions:d,onOpenChooser:()=>u(!0),onToggleNotes:()=>c(e=>!e)}),E=Jn(e,i,t,o);return(0,J.jsx)(Ye,{projectId:b,repoBase:x,requests:ee,children:(0,J.jsxs)(`header`,{"data-slot":`run-header`,className:a(`relative z-20 bg-background px-[18px] md:px-9 md:pt-7`,y?`pt-0`:`pt-[18px]`,t===`session`&&`md:sticky md:top-0`),children:[(0,J.jsx)(Yn,{run:e}),(0,J.jsx)(Yt,{run:e}),(0,J.jsxs)(`div`,{className:`w-full`,children:[(0,J.jsx)(qn,{run:e}),v?(0,J.jsxs)(ft,{slot:v,children:[(0,J.jsx)(nr,{run:e}),(0,J.jsx)(qn,{run:e,compact:!0}),T]}):(0,J.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,J.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:Kn(e.delegation)}),(0,J.jsx)(tr,{run:e}),(0,J.jsx)(Mt,{dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-md:hidden`,children:Qt(h)}),(0,J.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[E,w,(0,J.jsx)(dn,{run:e}),T]})]}),(0,J.jsx)(Xn,{shown:v!==null,run:e,archiveButton:E,previewToggle:w}),(0,J.jsx)(Zn,{run:e,tab:t,activeItem:S,inlineItemTabs:ne,overflowItemTabs:re,phoneBar:y,isDesktop:_}),s?(0,J.jsx)(or,{runId:e.id,onClose:()=>c(!1)}):null,l?(0,J.jsx)(an,{run:e,canResume:W(e).terminal,onResume:()=>d.terminal.mutate(),onClose:()=>u(!1)}):null]}),(0,J.jsx)(ar,{run:e,actions:d})]})})}function $n(e,t){let n=te(),r=rt(),[i,a]=(0,q.useState)(null),o=()=>n.invalidateQueries({queryKey:de.runs.all}),s=e=>M(e.message,{tone:`danger`}),l=me(),u={isPending:l.isPending,mutate:()=>l.mutate({id:e.id,pinned:!e.pinned})},d=ne();return{pin:u,markUnread:{isPending:d.isPending,mutate:()=>{t?.(),d.mutate(e.id,{onError:s})}},delete:O({mutationFn:()=>c(e.id),onSuccess:()=>{o(),r(`/`)},onError:s}),terminal:tn(e),confirming:i,setConfirming:a}}function er(e){let t=D(e.id),n=j(e);return{title:n,editor:kt(n,e=>t.mutate({title:e},{onError:e=>M(e.message,{tone:`danger`})}))}}function tr({run:e}){let{title:t,editor:n}=er(e);return n.editing?(0,J.jsx)(_t,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,J.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,J.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,J.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,J.jsx)(At,{className:`size-3.5`,"aria-hidden":`true`})})]})}function nr({run:e}){let{title:t,editor:n}=er(e);return(0,J.jsxs)(Te,{open:n.editing,onOpenChange:e=>{e?n.begin():n.commit()},children:[(0,J.jsx)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-px`,children:(0,J.jsx)(`h1`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,title:e.task,children:t})}),(0,J.jsx)(Ce,{asChild:!0,children:(0,J.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,J.jsx)(At,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,J.jsx)(ve,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),n.cancel()},children:(0,J.jsx)(_t,{editor:n,className:`text-[16px] font-semibold`})})]})}function rr({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=W(e),a=G(e),s=D(e.id),c=(0,q.useId)();return(0,J.jsxs)(H,{children:[(0,J.jsx)(B,{asChild:!0,children:(0,J.jsx)(o,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,J.jsx)(Ue,{"aria-hidden":`true`})})}),(0,J.jsxs)(V,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,J.jsx)(I,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),(0,J.jsxs)(L,{onSelect:n,children:[(0,J.jsx)(St,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,J.jsx)(an,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),a?(0,J.jsxs)(L,{onSelect:()=>void X(a,`Command copied to clipboard.`),children:[(0,J.jsx)(N,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,J.jsxs)(L,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,J.jsx)(Ht,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,J.jsxs)(z,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,J.jsx)(Ut,{"aria-hidden":`true`}):(0,J.jsx)(Ve,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,J.jsx)(R,{}),(0,J.jsx)(I,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,J.jsx)(z,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:s.isPending,onCheckedChange:e=>s.mutate({archiveWhenDone:e},{onError:e=>M(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,J.jsx)(z,{"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=>M(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,J.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,J.jsx)(ir,{run:e,patch:s}),i.deleteRun?(0,J.jsx)(R,{}):null,i.deleteRun?(0,J.jsxs)(L,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,J.jsx)(Me,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})}function ir({run:e,patch:t}){let n=(0,q.useId)(),r=(0,q.useId)(),i=(0,q.useId)(),a=e=>M(e.message,{tone:`danger`});return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(R,{}),(0,J.jsx)(I,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,J.jsx)(z,{"data-slot":`allow-workers`,className:`min-h-11`,checked:f(e),disabled:t.isPending,"aria-describedby":`${n} ${i}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:a}),children:`Allow Squawk workers`}),(0,J.jsx)(`p`,{id:n,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`}),(0,J.jsx)(z,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:p(e),disabled:t.isPending,"aria-describedby":`${r} ${i}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:a}),children:`Allow task messaging`}),(0,J.jsx)(`p`,{id:r,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,J.jsx)(`p`,{id:i,"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 ar({run:e,actions:t}){let n=t.confirming;return(0,J.jsx)(Dt,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,J.jsxs)(Ct,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,J.jsxs)(Tt,{children:[(0,J.jsx)(wt,{className:`text-danger`,children:`Delete task permanently?`}),(0,J.jsx)(jt,{children:(0,J.jsxs)(J.Fragment,{children:[`Delete “`,(0,J.jsx)(`span`,{className:`font-medium text-foreground`,title:j(e),children:j(e)}),`” and its transcript`,e.delegation?.role===`worker`&&!b(e.delegation.workspace)?``:`, worktree and branch`,`. This cannot be undone.`]})})]}),(0,J.jsxs)(Ot,{children:[(0,J.jsx)(bt,{children:`Cancel`}),(0,J.jsx)(Ft,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function or({runId:e,onClose:t}){let n=ce(e);return(0,J.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,J.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,J.jsx)(o,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,J.jsx)(Pe,{})})]}),n.isPending?(0,J.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,J.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,J.jsx)(pn,{runId:e,children:(0,J.jsx)(Bt,{children:n.data})}):(0,J.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,J.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,J.jsx)(o,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void X(n.data??``,`Notes copied`),children:`Copy notes`}),(0,J.jsx)(o,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{en as _,Fn as a,bn as c,hn as d,pn as f,tn as g,rn as h,kn as i,yn as l,sn as m,$ as n,On as o,on as p,xn as r,Q as s,Qn as t,_n as u,Zt as v,Y as y};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{E as r,l as i}from"./button-C1fD-ZFr.js";import{a}from"./project-scope-context-Dlbq88xo.js";import{dt as o,ft as s,mt as c,pt as l}from"./queries-BtkCvBtK.js";import{q as u}from"./use-desktop-NTwdvSZg.js";import{C as d,S as f,X as p,j as m}from"./design-icons-B6-0w7Aw.js";import{t as h}from"./run-header-DeyjkCoC.js";import{t as g}from"./project-router-CFmb6NlX.js";import{t as _}from"./centered-state-CiiA8Vgw.js";import{D as v,E as y,s as b,tn as x}from"./index-WeSdteYZ.js";import{t as S}from"./commit-diff-panel-D-oVsbVi.js";var C=e(t(),1),w=n(),T=77;function E({slot:e,commits:t,className:n,heading:r}){let[a,o]=(0,C.useState)(``),s=a.trim().toLowerCase(),c=s?t.filter(e=>e.subject.toLowerCase().includes(s)):t,l=c.length>150,u=(0,C.useRef)(null),d=(0,C.useRef)(null),[f,m]=(0,C.useState)(0);(0,C.useLayoutEffect)(()=>{if(!l)return;let e=()=>{let e=u.current,t=d.current;!e||!t||m(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[l]);let h=c.map(n=>(0,w.jsx)(D,{commit:n,detailed:e===`task-commits`&&t.length===1},n.sha));return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{className:`relative mb-[22px] block`,children:[(0,w.jsx)(p,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3.5 left-3 size-4 text-muted-foreground`}),(0,w.jsx)(x,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:a,onChange:e=>o(e.target.value),className:`h-11 bg-card pl-10`})]}),(0,w.jsxs)(`div`,{ref:e=>{u.current=e,e&&(d.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":l,className:i(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-4 py-1 md:px-5`,n),children:[r?(0,w.jsx)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 py-4`,children:r}):null,c.length===0?(0,w.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,l?(0,w.jsx)(b,{scrollRef:d,startMargin:f,itemSize:T,children:h}):h]})]})}function D({commit:e,detailed:t}){return(0,w.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_77px] [content-visibility:auto]`,children:(0,w.jsxs)(g,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:i(`flex min-h-[76px] min-w-0 flex-col items-start gap-3 rounded-sm py-4 hover:bg-muted`,!t&&`md:flex-row md:items-center md:py-3`),children:[(0,w.jsx)(m,{size:16,"aria-hidden":`true`,className:i(`shrink-0 text-accent-text`,t?`size-[22px]`:`size-4`)}),(0,w.jsxs)(`span`,{className:i(`min-w-0 w-full`,!t&&`md:w-auto md:flex-1`),children:[(0,w.jsx)(`span`,{className:i(`block font-normal`,t?`text-[22px] leading-snug`:`text-[13px] md:truncate`),children:e.subject}),(0,w.jsxs)(`span`,{className:`mt-1 block truncate text-[11px] text-soft-foreground`,children:[e.author,` · `,e.when]})]}),(0,w.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),t?(0,w.jsxs)(`span`,{className:`inline-flex min-h-11 items-center gap-2 rounded-lg bg-action px-3 text-xs font-medium text-action-foreground`,children:[(0,w.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-4`}),`View changes`]}):null]})})}function O(){let{id:e}=r(),t=o(e);return t.isPending?(0,w.jsx)(v,{tab:`changes`}):t.isError?(0,w.jsx)(y,{tab:`changes`,error:t.error}):(0,w.jsx)(k,{run:t.data})}function k({run:e}){let{sha:t}=r(),n=c(e.id,u(e));return(0,w.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,w.jsx)(h,{run:e,tab:`commits`}),t?(0,w.jsx)(A,{runId:e.id,sha:t}):n.isPending?(0,w.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):n.isError?(0,w.jsx)(_,{icon:(0,w.jsx)(m,{size:16}),tone:n.error instanceof a&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof a&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,w.jsx)(_,{icon:(0,w.jsx)(m,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,w.jsxs)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:[(0,w.jsx)(E,{slot:`task-commits`,heading:(0,w.jsxs)(`h2`,{className:`text-base font-semibold`,children:[n.data.commits.length,` `,n.data.commits.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:n.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))}),(0,w.jsx)(j,{run:e})]})]})}function A({runId:e,sha:t}){return(0,w.jsx)(S,{commit:l(e,t),sha:t,backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-6`})}function j({run:e}){let t=s(e.id,u(e));return t.isPending?(0,w.jsx)(`p`,{className:`mt-[22px] text-xs text-muted-foreground`,children:`Loading changed files…`}):t.isError?(0,w.jsxs)(`p`,{role:`status`,className:`mt-[22px] text-xs text-danger`,children:[`Could not load changed files: `,t.error.message]}):t.data.files.length===0?null:(0,w.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-[22px] rounded-[10px] border border-border bg-card p-5`,children:[(0,w.jsxs)(`h2`,{className:`mb-4 text-[16px] font-semibold`,children:[t.data.files.length,` changed files`]}),(0,w.jsx)(`ul`,{className:`space-y-4`,children:t.data.files.map(t=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(g,{to:`/tasks/${e.id}/changes`,className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,w.jsx)(f,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,w.jsx)(`span`,{className:`break-all`,children:t.path})]})},t.path))})]})}export{O as TaskCommitsRoute};
@@ -1 +0,0 @@
1
- import{Gr as e,ni as t}from"./project-scope-context-Dlbq88xo.js";function n(n,r){return e(n,t,r)}export{n as t};