@wjarka/cezarion 0.18.0-dev.6755 → 0.18.0-dev.6769
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/web/dist/assets/{activity-motion-CjPL-sr2.js → activity-motion-gOopdagH.js} +1 -1
- package/web/dist/assets/{activity-route-C0tIKFED.js → activity-route-D7bDtXpW.js} +1 -1
- package/web/dist/assets/agent-accounts-otlDWnij.js +18 -0
- package/web/dist/assets/{commit-diff-panel-uIMnjowv.js → commit-diff-panel-iQf0Rlcx.js} +1 -1
- package/web/dist/assets/{diff-CUIYkwMG.js → diff-DQfcliZC.js} +2 -2
- package/web/dist/assets/{diff-view-CH27Vgln.js → diff-view-BbM-71Cs.js} +1 -1
- package/web/dist/assets/{file-preview-wrsPzzjz.js → file-preview-DgU8vo8k.js} +1 -1
- package/web/dist/assets/{git-toolbar-C1v8n8nd.js → git-toolbar-C8agvpYS.js} +1 -1
- package/web/dist/assets/{github-0PYN1Ju2.js → github-hXmxAXmA.js} +1 -1
- package/web/dist/assets/{global-activity-route-KDUFNxgb.js → global-activity-route-D_r1ImUh.js} +1 -1
- package/web/dist/assets/index-tN02NX7A.js +17 -0
- package/web/dist/assets/{preview-pane-connected-B1XJVVoo.js → preview-pane-connected-D__9JwyU.js} +1 -1
- package/web/dist/assets/{prompt-template-menu-DC5XoYEs.js → prompt-template-menu-BJfUg1uF.js} +1 -1
- package/web/dist/assets/queries-BJM44umy.js +1 -0
- package/web/dist/assets/{reference-chip-peKR_0El.js → reference-chip-vraIzoEF.js} +1 -1
- package/web/dist/assets/{repo-git-DU5eh5V8.js → repo-git-B4qZq37d.js} +1 -1
- package/web/dist/assets/{report-reader-DsvVau4u.js → report-reader-Djix-ICM.js} +1 -1
- package/web/dist/assets/{reports-Brs9M380.js → reports-Do-dkavq.js} +1 -1
- package/web/dist/assets/run-header-Di9LaKQs.js +2 -0
- package/web/dist/assets/{skills-TJPEPrU2.js → skills-CPnIvFnR.js} +1 -1
- package/web/dist/assets/{task-changes-BMMqKQZQ.js → task-changes-CW7NzgL5.js} +1 -1
- package/web/dist/assets/{task-commits-DzOQ_acm.js → task-commits-Bkwi7o1B.js} +1 -1
- package/web/dist/assets/{task-files-CqBxJ5lZ.js → task-files-geRzIszC.js} +1 -1
- package/web/dist/assets/{task-github-item-DYZGczpf.js → task-github-item-UbCCP2Ud.js} +1 -1
- package/web/dist/assets/task-thread-CkiEiypn.js +9 -0
- package/web/dist/assets/{thread-state-VHo3TMiY.js → thread-state-CajkV5Ft.js} +1 -1
- package/web/dist/assets/{use-desktop-DBpXK7UB.js → use-desktop-Ct4lvA3b.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-DiPruziF.js → use-hand-to-agent-state-Cnxq_2F6.js} +1 -1
- package/web/dist/assets/workflows-Csr2hbks.js +7 -0
- package/web/dist/index.html +6 -6
- package/web/dist/assets/agent-accounts-Bfv01ivB.js +0 -18
- package/web/dist/assets/index-DgeV0f4H.js +0 -17
- package/web/dist/assets/queries-Ce9CPdRy.js +0 -1
- package/web/dist/assets/run-header-BYyz-dXB.js +0 -2
- package/web/dist/assets/task-thread-DYEBHvdF.js +0 -9
- package/web/dist/assets/workflows-DiURHZJ-.js +0 -7
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{A as t,M as n}from"./button-DGwhwRuD.js";import{i as r}from"./react-runtime-CCIEwYL0.js";import{n as i,t as a}from"./live-refetch-CZb2VOyu.js";import{$ as o,At as s,B as c,Br as l,Bt as u,Cn as d,Ct as f,Dt as p,En as m,Er as h,Et as g,F as _,Fr as v,Ft as y,H as ee,I as te,Ir as ne,It as re,J as ie,Jr as ae,Jt as oe,K as se,L as ce,Lr as le,M as ue,Mt as de,Nt as fe,Ot as pe,Pr as me,Pt as he,Q as ge,Qr as _e,Qt as ve,R as ye,Rr as be,St as xe,Tn as Se,U as Ce,Ur as b,V as we,Vr as Te,Vt as Ee,Wr as De,X as x,Y as Oe,Yr as ke,Z as Ae,_ as je,_n as Me,_t as Ne,ai as Pe,at as Fe,b as Ie,bn as Le,br as Re,bt as ze,c as Be,ci as Ve,cn as He,ct as Ue,di as We,dt as Ge,ei as Ke,et as qe,fn as Je,ft as Ye,g as Xe,gn as Ze,gt as Qe,hn as $e,hr as S,ht as et,i as tt,it as nt,j as rt,jt as it,kt as at,ln as ot,lt as st,m as ct,mt as lt,nt as ut,on as dt,ot as ft,pt,qt as mt,r as ht,ri as gt,si as _t,sn as vt,st as yt,tt as bt,un as xt,ut as St,v as Ct,vt as wt,x as Tt,xn as Et,xr as Dt,xt as Ot,yt as kt,z as At,zr as jt}from"./project-scope-context-bgdvGX9z.js";import{F as C,I as Mt,M as Nt,dt as w}from"./live-protocol-aMLJJ0MQ.js";import{t as T}from"./useInfiniteQuery-s3lTx_YX.js";import{t as E}from"./useQuery-C0ee1rw5.js";import{n as Pt,r as D,t as Ft}from"./ws-WW6DrfbT.js";import{n as It}from"./toaster-CoMJoQvk.js";var Lt=class extends ae{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Rt(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=ke({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),w.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Rt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var zt=class extends We{#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),_t(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&_e(t.mutationKey)!==_e(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Rt();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){w.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Bt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Vt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Ht=class extends We{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,w.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!_t(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Bt(e,n).forEach(e=>{e.destroy()}),Bt(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=Pe(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 De(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Vt(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&w.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},O=e(r(),1);function k({queries:e,...t},n){let r=b(n),i=Te(),a=l(),o=O.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{me(e);let t=r.getQueryCache().get(e.queryHash);le(e,a,t)}),jt(a);let[s]=O.useState(()=>new Ht(r,o,t)),[c,u,d]=s.getOptimisticResult(o,t.combine),f=!i&&t.subscribed!==!1;O.useSyncExternalStore(O.useCallback(e=>f?s.subscribe(w.batchCalls(e)):gt,[s,f]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),O.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let p=c.some((e,t)=>ne(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&ne(n,e)?v(n,new De(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=c.find((e,t)=>{let n=o[t];return n&&be({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 A(e,t){let n=b(t),[r]=O.useState(()=>new zt(n,e));O.useEffect(()=>{r.setOptions(e)},[r,e]);let i=O.useSyncExternalStore(O.useCallback(e=>r.subscribe(w.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=O.useCallback((e,t)=>{r.mutate(e,t).catch(gt)},[r]);if(i.error&&Ve(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function j(e={}){let t=e.projectId??n();return{projectId:t,cacheScope:e.cacheScope??(e.boot?`default`:t)}}function M(e,t={}){return{...j(t),runId:e}}var N=[`workspace`,`runs-index`],P=e=>[e.cacheScope,`runs`,`list`],F=e=>[e.cacheScope,`runs`,`detail`,e.runId],I=e=>typeof e==`function`?e():e;function Ut(e){let{seenAt:t,...n}=e;return n}function Wt(e,t){let n=Ut(e);return t.seenAt===void 0?n:{...n,seenAt:t.seenAt}}function L(e,t,n){return t?{...e,seenAt:n}:Ut(e)}function Gt(e){let t=()=>{e.invalidateQueries({queryKey:N})};function r(r,i){if(r===`index`)return t();let a=typeof i==`function`?i():i;if(r===`indexed`){t(),e.invalidateQueries({queryKey:[n(),`runs`]}),e.invalidateQueries({queryKey:[a.projectId,`runs`,`list`]});return}if(r===`runs`)return e.invalidateQueries({queryKey:[a.cacheScope,`runs`]});let o=Dt(),s=[a.projectId,a.cacheScope],c=o!==void 0&&s.some(e=>e===o||e==="default")?[o,`default`]:[],l=new Set([...s,...c,n()]);return Promise.all([...l].map(t=>e.invalidateQueries({queryKey:[t,`runs`]}))).then(()=>void 0)}async function i(n,r){await e.cancelQueries({queryKey:P(I(n))}),await e.cancelQueries({queryKey:F(I(n))});let i=e.getQueryData(P(I(n))),a=e.getQueryData(F(I(n))),o=I(n).runId,s=new Date().toISOString();return e.setQueryData(P(I(n)),e=>e?.map(e=>e.id===o?L(e,r,s):e)),e.setQueryData(F(I(n)),e=>e&&L(e,r,s)),{id:o,prevList:i,prevDetail:a,rollback(){if(!r){i&&e.setQueryData(P(I(n)),i),a&&e.setQueryData(F(I(n)),a);return}let t=i?.find(e=>e.id===o);t&&e.setQueryData(P(I(n)),e=>e?.map(e=>e.id===o?Wt(e,t):e)),a&&e.setQueryData(F(I(n)),e=>e&&Wt(e,a))},settle(i){let a=e=>e.id===(r?o:i.id)?L(e,r,i.seenAt):e;e.setQueryData(P(I(n)),e=>e?.map(a));let s={...I(n),runId:r?o:i.id};e.setQueryData(F(s),e=>e?a(e):i),t()}}}async function a(t,n){await e.cancelQueries({queryKey:N});let i=e.getQueryData(N),a=n();return e.setQueryData(N,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===t.projectId&&e.id===t.runId?a(e):e)}),{previous:i,rollback(){i&&e.setQueryData(N,i)},settle(){r(`indexed`,t)}}}return{patchRead:i,patchIndex:a,invalidateAfter:r}}function R(){let e=b();return(0,O.useMemo)(()=>Gt(e),[e])}function Kt(e){return e.type===`run`?e.run.id:e.id}function z(e,t){return{...e,runs:t}}function qt(e,t){let n=0;for(let r of e)r.projectId===t&&r.archived&&(n+=1);return n}function Jt(e,t){let n=e.findIndex(e=>(e.createdAt??``).localeCompare(t.createdAt)<0),r=[...e];return r.splice(n<0?e.length:n,0,t),r}function Yt(e,t,n){return n?n.has(t):e.runs.some(e=>e.projectId===t)}function Xt(e,t,n){let{project:r}=t,i=Kt(t),a=e.runs.findIndex(e=>e.projectId===r&&e.id===i),o=a>=0?e.runs[a]:void 0,s=e.truncated.includes(r);if(t.type===`deleted`)return o?{index:z(e,e.runs.filter((e,t)=>t!==a)),reconcile:s&&o.archived}:{index:e,reconcile:!1};let{run:c}=t;if(c.delegation?.role===`worker`)return o?{index:z(e,e.runs.filter((e,t)=>t!==a)),reconcile:!1}:{index:e,reconcile:!1};if(!o&&!Yt(e,r,n))return{index:e,reconcile:!0};let l=Pe(o,{projectId:r,...c});if(o){if(l===o)return{index:e,reconcile:!1};let t=[...e.runs];t[a]=l;let n=o.archived!==l.archived&&(s||qt(t,r)>e.perProjectLimit);return{index:z(e,t),reconcile:n}}if(s)return Qt(e,l);let u=Jt(e.runs,l);return{index:z(e,u),reconcile:l.archived&&qt(u,r)>e.perProjectLimit}}function Zt(e,t){let n;for(let r of e)r.projectId===t&&r.archived&&(n===void 0||r.createdAt<n)&&(n=r.createdAt);return n}function Qt(e,t){let n=Zt(e.runs,t.projectId),r=n!==void 0&&t.createdAt>n;return t.archived&&!r?{index:e,reconcile:!1}:{index:z(e,Jt(e.runs,t)),reconcile:t.archived||n===void 0||t.createdAt<n}}function $t(e,t,n){let r=!1,i=e.runs.map(e=>{if(e.projectId!==t)return e;let i=n[e.id];if(i){let t=Pe(e.usage,i);return t===e.usage?e:(r=!0,{...e,usage:t})}if(e.usage===void 0)return e;r=!0;let{usage:a,...o}=e;return o});return r?z(e,i):e}function en(e,t){let n=e.runs.filter(e=>e.projectId!==t),r=e.truncated.filter(e=>e!==t),i=Object.prototype.hasOwnProperty.call(e.referenceStatuses,t);if(n.length===e.runs.length&&r.length===e.truncated.length&&!i)return e;let a={...e.referenceStatuses};return delete a[t],{...e,runs:n,truncated:r,referenceStatuses:a}}function tn(){return{stream:void 0,lastStream:void 0,mismatch:void 0,floor:void 0,changes:new Map}}function nn(e,t,n){if(e.lastStream===t)e.floor=Math.max(e.floor??n,n);else{for(let[n,r]of e.changes)r.generation!==t&&e.changes.delete(n);e.floor=n}e.stream=t,e.lastStream=t,e.mismatch=void 0}function rn(e){e.stream=void 0}function an(e,t,n=!1){let r=e.stream;if(r===void 0)return!1;(e.floor===void 0||n)&&(e.floor=t.seq-1);let i=JSON.stringify([r,t.project,Kt(t)]),a=e.changes.get(i);return(!a||a.seq<t.seq)&&e.changes.set(i,{...t,generation:r}),!0}function on(e,t){for(let[n,r]of e.changes)r.project===t&&e.changes.delete(n)}function sn(e){return typeof e.generation==`string`&&typeof e.eventSeq==`number`}function cn(e,t,n){if(!sn(t))return{index:t,reconcile:!1};let{generation:r,eventSeq:i}=t;if(e.stream!==void 0&&e.stream!==r){let n=e.mismatch!==r;return e.mismatch=r,{index:t,reconcile:n}}let a=e.lastStream===r&&e.floor!==void 0,o=a&&i<e.floor,s=t,c=o,l=[...e.changes.entries()].filter(([,e])=>e.generation===r),u=l.map(([,e])=>e).filter(e=>e.seq>i).sort((e,t)=>e.seq-t.seq);for(let e of u){let t=Xt(s,e,n);s=t.index,c||=t.reconcile}for(let[t,n]of l)n.seq<=i&&e.changes.delete(t);return a&&!o&&(e.floor=i),{index:s,reconcile:c}}var B=[`workspace`,`runs-index`],ln=[`workspace`,`projects`],un=6e4,dn=100,fn=new WeakMap;function V(e){let t=fn.get(e);return t||(t=_n(e),fn.set(e,t)),t}function pn(e,t){return typeof e!=`object`||!e||!Array.isArray(e.runs)?e:V(t).merge(e)}function mn(e){let t=e.getQueryData(ln)?.projects;return t?new Set(t.map(e=>e.id)):void 0}function hn(e,t,n){if(!(!e||typeof e.eventSeq!=`number`||typeof t.eventSeq!=`number`))return e.generation===t.generation?t.eventSeq<e.eventSeq?e:void 0:n!==void 0&&e.generation===n&&t.generation!==n?e:void 0}function gn(e,t){return t.type===`run-summary`?{type:`run`,project:e,seq:t.seq,run:t.summary}:{type:`deleted`,project:e,seq:t.seq,id:t.id}}function _n(e){let t=tn(),n=[],r,i,a,o,s=!1,c=-1/0,l=new Set,u=!1,d,f=!1,p=()=>{if(!u){if(u=!0,d?.()){f=!0;return}_({hold:!0})}},m=t=>{c=Date.now(),e.setQueryData(B,t)},h=()=>e.getQueryData(B),g=()=>{clearTimeout(a),a=void 0;let t=e.getQueryCache().find({queryKey:B,exact:!0}),n=(t!==void 0&&t.state.data===void 0&&t.state.fetchStatus!==`idle`?e.cancelQueries({queryKey:B,exact:!0}).then(()=>e.invalidateQueries({queryKey:B})):e.invalidateQueries({queryKey:B})).catch(()=>void 0).finally(()=>{o===n&&(o=void 0,s&&(s=!1,g()))});return o=n,n},_=(e={})=>o?(s=!0,o):e.hold?(a??=setTimeout(()=>{g()},400),Promise.resolve()):g(),v=()=>{r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0;let t=n;n=[];let a=h();if(!a||t.length===0)return;let o=mn(e),s=a,c=!1;for(let e of t){if(e.generation!==a.generation)continue;if(e.type===`usage`){l.has(e.project)||(s=$t(s,e.project,e.usage));continue}if(l.has(e.change.project)||e.change.seq<=a.eventSeq)continue;let t=Xt(s,e.change,o);s=t.index,c||=t.reconcile}s!==a&&m(s),c&&_({hold:!0})},y=()=>{if(i!==void 0)return;let e=c+250-Date.now();if(e>0){i=setTimeout(v,e);return}i=setTimeout(v,dn),typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(v))};return{ready(e,n){nn(t,e,n),u=!1,f&&(f=!1,_({hold:!0}))},detach(){rn(t)},run(e,r,i=!1){if(l.has(e))return;let a=gn(e,r);if(!an(t,a,i)){p();return}n.push({type:`change`,change:a,generation:t.stream}),y()},usage(e,r){if(!l.has(e)){if(t.stream===void 0){p();return}n.push({type:`usage`,project:e,usage:r,generation:t.stream}),y()}},dropProject(e){l.add(e),on(t,e),n=n.filter(t=>(t.type===`change`?t.change.project:t.project)!==e);let r=h();if(!r)return;let i=en(r,e);i!==r&&m(i)},setUnknownGenerationHandler(e){d=e},restoreProject(e){l.delete(e)},merge(n){let r=h(),i=cn(t,n,mn(e));for(let e of l)i.index=en(i.index,e);return i.reconcile&&queueMicrotask(()=>{_({hold:!0})}),hn(r,n,t.stream)??i.index},reconcile:_,flush:v,stop(){r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0,clearTimeout(a),a=void 0,n=[],s=!1}}}var vn={draft:{label:`Draft`,hint:`the author has not marked it ready for review`,tone:`neutral`},"review-required":{label:`Waiting for review`,hint:`checks are fine, no one has reviewed it yet`,tone:`info`},"changes-requested":{label:`Changes requested`,hint:`a reviewer asked for edits before this can merge`,tone:`danger`},"checks-pending":{label:`Checks running`,hint:`CI has not finished on the latest commit`,tone:`pending`},"checks-failing":{label:`Checks failing`,hint:`CI is red on the latest commit`,tone:`danger`},ready:{label:`Ready to merge`,hint:`open, checks pass, nothing is waiting on a reviewer`,tone:`success`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`merged`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`success`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`accent`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},yn={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function bn(e){return typeof e==`string`&&Object.hasOwn(vn,e)}function xn(e){return e!==void 0&&bn(e)?vn[e]:void 0}var Sn=`cez.reference-statuses.v1`,Cn=`cez.reference-conflicts.v1`,H=new Map(En()),wn=1e3;function U(e,t){if(H.get(e)!==t){for(H.delete(e),H.set(e,t);H.size>wn;){let e=H.keys().next().value;if(e===void 0)break;H.delete(e)}On()}}var W=new Set(Dn());function Tn(e,t){if(W.has(e)!==t){if(t)for(W.add(e);W.size>wn;){let e=W.values().next().value;if(e===void 0)break;W.delete(e)}else W.delete(e);On()}}function En(){try{let e=globalThis.sessionStorage?.getItem(Sn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&bn(e[1])):[]}catch{return[]}}function Dn(){try{let e=globalThis.sessionStorage?.getItem(Cn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var G;function On(){G===void 0&&(G=setTimeout(()=>{G=void 0;try{globalThis.sessionStorage?.setItem(Sn,JSON.stringify([...H])),globalThis.sessionStorage?.setItem(Cn,JSON.stringify([...W]))}catch{}},250))}var K=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function q(e,t){return{...e?{status:e}:{},...t?{conflicting:!0}:{}}}function kn(e){return[...e.prs.map(t=>({projectId:e.projectId,kind:`PR`,number:t})),...e.issues.map(t=>({projectId:e.projectId,kind:`Issue`,number:t}))]}function An(e,t,n,r,i,a){let o=r.prs[n.number]??r.issues[n.number];if(!o){e.set(t,{state:`unknown`,...i?{status:i}:{}});return}let s=r.conflicts?r.conflicts.includes(n.number):void 0;U(t,o),s!==void 0&&Tn(t,s),e.set(t,{state:`ready`,status:o,...s??a?{conflicting:!0}:{}})}function jn(e,t,n){let r=K(t),i=H.get(r),a=W.has(r)?!0:void 0,o=n.data;if(o?.available){An(e,r,t,o,i,a);return}if(o){e.set(r,{state:`unavailable`,reason:o.reason,...q(i,a)});return}if(n.isError){e.set(r,{state:`unavailable`,reason:n.error instanceof Error?n.error.message:void 0,...q(i,a)});return}e.set(r,{state:`loading`,...q(i,a)})}function Mn(e,t){let n=new Map;return t.forEach((t,r)=>{let i=e[r];if(i)for(let e of kn(i))jn(n,e,t)}),n}function Nn(e){if(!e)return;let t=e.trim().replace(/\/+$/,``),n=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(t),r=n?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(t),i=n??r;if(!i)return;let[,a,o]=i;if(!o||a?.toLowerCase()!==`github.com`)return;let s=o.replace(/\.git$/i,``).split(`/`).filter(Boolean),c=s[s.length-2],l=s[s.length-1];return c&&l?`https://github.com/${c}/${l}`:void 0}function Pn(e){let t=new Map;for(let n of e)for(let e of n.tags??[]){let n=e.toLowerCase();t.has(n)||t.set(n,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function Fn(e,t,n,r=8){let i=n.trim().toLowerCase(),a=new Set(t.map(e=>e.toLowerCase())),o=e.filter(e=>{let t=e.toLowerCase();return a.has(t)?!1:i===``||t.includes(i)&&t!==i});return i===``?o.slice(0,r):o.sort((e,t)=>Number(t.toLowerCase().startsWith(i))-Number(e.toLowerCase().startsWith(i))||e.localeCompare(t,void 0,{sensitivity:`base`})).slice(0,r)}function In(e){let t=new Map;for(let n of e){let e=n.trim();if(!e)continue;let r=e.toLowerCase();t.has(r)||t.set(r,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function Ln(e){if(!e.available)return;let t=e.issuesNextCursor,n=e.prsNextCursor;if(!(t===void 0&&n===void 0)&&!(!t&&!n))return{...t?{issuesCursor:t}:{issuesDone:!0},...n?{prsCursor:n}:{prsDone:!0}}}function Rn(e,t){return e?(t===`issues`?e.issuesNextCursor:e.prsNextCursor)==null:!1}function zn(e,t,n){for(let r of e)t.has(r.number)||(t.add(r.number),n.push(r))}function Bn(e){let t=e[0];if(!t)return;let n=e[e.length-1],r=[],i=[],a=new Set,o=new Set,s={};for(let t of e){zn(t.issues,a,r),zn(t.prs,o,i);for(let[e,n]of Object.entries(t.labelColors??{}))s[e]??=n}let c=e.find(e=>e.projects)?.projects,l=e.map(e=>e.projectsState),u=e.find(e=>e.projectsState===`unavailable`),d=l.includes(`refreshing`)?`refreshing`:u?`unavailable`:l.some(e=>e===`ready`)?`ready`:void 0,{projectsGeneration:f,projectsReason:p,...m}=t;return{...m,issues:r,prs:i,...Object.keys(s).length>0?{labelColors:s}:{},...c?{projects:c}:{},...d?{projectsState:d}:{},...d===`unavailable`&&u?.projectsReason?{projectsReason:u.projectsReason}:{},...`issuesNextCursor`in n?{issuesNextCursor:n.issuesNextCursor}:{},...`prsNextCursor`in n?{prsNextCursor:n.prsNextCursor}:{}}}var J=e=>e.map(e=>e.number).join(`,`);function Vn(e,t){let n=e[0];if(e.length>1&&n&&(J(n.issues)!==J(t.issues)||J(n.prs)!==J(t.prs)||n.issuesTotal!==t.issuesTotal||n.prsTotal!==t.prsTotal))return`refetch`;let r=t;if(n&&t.available&&t.projectsState===`refreshing`&&n.repo===t.repo){let e=new Map(n.issues.map(e=>[e.number,e.projectIds]));r={...t,issues:t.issues.map(t=>{let n=e.get(t.number);return t.projectIds===void 0&&n!==void 0?{...t,projectIds:n}:t})}}return[r,...e.slice(1)]}var Y={get health(){return[n(),`health`]},runs:{get all(){return[n(),`runs`]},relationships:e=>[n(),`runs`,`relationships`,e],list:(e=n())=>[e,`runs`,`list`],archived:e=>[n(),`runs`,`archived`,e],detail:(e,t=n())=>[t,`runs`,`detail`,e],diff:e=>[n(),`runs`,`diff`,e],changes:e=>[n(),`runs`,`changes`,e],file:(e,t)=>[n(),`runs`,`files`,e,t],handoff:e=>[n(),`runs`,`handoff`,e],commits:e=>[n(),`runs`,`commits`,e],commit:(e,t)=>[n(),`runs`,`commit`,e,t]},get workflows(){return[n(),`workflows`]},get skills(){return[n(),`skills`]},get skillsReady(){return[n(),`skills`,`ready`]},get importableSkills(){return[n(),`skills`,`importable`]},get importableSkillsReady(){return[n(),`skills`,`importable`,`ready`]},get repo(){return[n(),`repo`]},get repoChanges(){return[n(),`repo`,`changes`]},repoCommit:e=>[n(),`repo`,`commit`,e],get repoBranches(){return[n(),`repo`,`branches`]},get uiState(){return[n(),`ui-state`]},get config(){return[n(),`config`]},get agentConfig(){return[n(),`agent-config`]},agentConfigFile:e=>[n(),`agent-config`,`file`,e],get worktrees(){return[n(),`worktrees`]},github:(e={})=>[n(),`github`,e.limit??null],githubPages:e=>[n(),`github`,`pages`,e],githubPagesHead:e=>[n(),`github`,`pages-head`,e],githubCommentCounts:(e,t)=>[n(),`github`,`comment-counts`,e,[...t].sort((e,t)=>e-t).join(`,`)],githubChecks:e=>[n(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[n(),`github`,`search`,e,t],githubRefStatus:(e,t,n)=>[e,`github`,`ref-status`,[...t].sort((e,t)=>e-t).join(`,`),[...n].sort((e,t)=>e-t).join(`,`)],githubComments:(e,t)=>[n(),`github`,`comments`,e,t],githubItem:(e,t)=>[n(),`github`,`item`,e,t],githubRefStatusOf:e=>[e,`github`,`ref-status`],githubPrChanges:e=>[n(),`github`,`pr-changes`,e],githubMergeState:e=>[n(),`github`,`merge-state`,e],get openTargets(){return[n(),`open-targets`]}},X={models:e=>[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],projects:[`workspace`,`projects`],githubOwners:[`workspace`,`github-owners`],runsIndex:B,runsSearch:e=>[`workspace`,`runs-search`,e],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],agentProfiles:[`workspace`,`agent-profiles`],agentAccountDetails:e=>[`workspace`,`agent-profiles`,`details`,e],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...X.fsBrowseRoot,e,t]};function Z(e,t,n=`active`){return e.invalidateQueries({queryKey:t===void 0?[`workspace`,`models`]:X.models(t),refetchType:n})}function Q(e,t=!0){let n=b();return(0,O.useEffect)(()=>{if(!t||e!==`cursor`)return;let r,i=()=>{let e=n.getQueryData(Y.health)?.capabilities?.localHandoff===!0;e&&!r?r=Ft(`models:cursor`,e=>{let t=Mt.safeParse(e);t.success&&t.data.runner===`cursor`&&(n.cancelQueries({queryKey:X.models(`cursor`)}),n.setQueryData(X.models(`cursor`),t.data))}):!e&&r&&(r(),r=void 0)};i();let a=n.getQueryCache().subscribe(i);return()=>{a(),r?.()}},[t,e,n]),E({queryKey:X.models(e),queryFn:({signal:t})=>C(e)?p(e,{signal:t}):Promise.reject(Error(`${e} has no host model catalog`)),staleTime:300*1e3,enabled:t&&C(e)})}function Hn(e=!0){return{claude:Q(`claude`,e),codex:Q(`codex`,e),opencode:Q(`opencode`,e),pi:Q(`pi`,e),cursor:Q(`cursor`,e),omp:Q(`omp`,e)}}function Un(){let e=b();return E({queryKey:X.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(X.providerStatus),r=await Ye(!1,{signal:t});return S(n,e.getQueryData(X.providerStatus),r)},staleTime:5*6e4,refetchInterval:a(!1),refetchOnWindowFocus:!0})}function Wn(){let e=b();return A({mutationFn:()=>Ye(!0),onMutate:()=>e.getQueryData(X.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(X.providerStatus,e=>S(r,e,t)),Z(e)}})}function Gn(){let e=b();return A({mutationFn:({provider:e,authFailureId:t})=>Je(e,t),onMutate:()=>e.getQueryData(X.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(X.providerStatus,e=>S(r,e,t,n.authFailureId)),C(n.provider)&&Z(e,n.provider)}})}function Kn(e={}){return E({queryKey:X.projects,queryFn:({signal:e})=>Ge({signal:e}),...e})}function qn(e,t=!1){return E({queryKey:X.fsBrowse(e,t),queryFn:({signal:n})=>Be(e??void 0,{signal:n,showHidden:t}),retry:!1})}function Jn(){let e=b();return A({mutationFn:e=>dt(e),onSuccess:()=>e.invalidateQueries({queryKey:X.projects})})}function Yn(){let e=b();return A({mutationFn:e=>He(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:X.projects})}})}function Xn(){let e=b();return A({mutationFn:e=>{let{id:t,...n}=e;return Se(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:X.projects});let r=e.getQueryData(X.projects);return e.setQueryData(X.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?Zn(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(X.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(X.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:X.projects})})}function Zn(e,t){let{maxParallel:n,tags:r,...i}=e,a={...i},o=`maxParallel`in t?t.maxParallel:e.maxParallel;o!=null&&(a.maxParallel=o);let s=`tags`in t&&t.tags!==void 0?t.tags:e.tags,c=s==null?[]:In(s);if(c.length>0&&(a.tags=c),`webhook`in t&&t.webhook!==void 0)if(t.webhook===null)delete a.webhook;else{let n=t.webhook.token===void 0?e.webhook?.tokenSet??!1:t.webhook.token!==``;a.webhook={url:t.webhook.url,tokenSet:n}}return a}function Qn(e){let t=b();return A({mutationFn:e,retry:!1,onSuccess:({project:e})=>{t.setQueryData(X.projects,t=>t===void 0?t:{...t,projects:t.projects.map(t=>t.id===e.id?e:t)})},onSettled:()=>t.invalidateQueries({queryKey:X.projects})})}function $n(){return Qn(e=>{let{projectId:t,...n}=e;return Tt(t,n)})}function er(){return Qn(e=>{let{projectId:t,webhookId:n,...r}=e;return m(t,n,r)})}function tr(){return Qn(({projectId:e,webhookId:t})=>ot(e,t))}function nr(){return A({mutationFn:({projectId:e,webhookId:t})=>Et(e,t),retry:!1})}function rr(e){let t=b();return A({mutationFn:t=>u(e,t),retry:!1,onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function $(e){let t=b();return A({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:X.agentProfiles}),t.invalidateQueries({queryKey:X.projects})])}})}function ir(){return $(e=>Ct(e))}function ar(){return $(e=>{let{id:t,...n}=e;return d(t,n)})}function or(){return $(e=>vt(e))}function sr(){return $(e=>Ze(e))}function cr(e,t){return E({queryKey:X.agentAccountDetails(e),queryFn:({signal:t})=>_(e,{signal:t}),enabled:t,staleTime:0,retry:!1})}function lr(e,t){return E({queryKey:X.agentAccountStatus(e),queryFn:({signal:t})=>te(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function ur(){let e=b();return A({mutationFn:({provider:e,profileId:t})=>Xe(e,t),retry:!1,onSuccess:async(t,{provider:n})=>{await Promise.all([e.invalidateQueries({queryKey:X.agentProfiles}),e.invalidateQueries({queryKey:X.providerStatus}),C(n)?Z(e,n,`none`):Promise.resolve()])}})}function dr(){let e=b();return A({mutationFn:e=>te(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(X.agentAccountStatus(n),t),e.invalidateQueries({queryKey:X.agentProfiles}),C(t.status.provider)&&Z(e,t.status.provider)}})}function fr(){return A({mutationFn:e=>{let{routeId:t,...n}=e;return Ee(t,n)},retry:!1})}function pr(){let e=b();return A({mutationFn:e=>ct(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:X.projects})})}function mr(){let e=b();return A({mutationFn:e=>Ie(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:X.projects})})}function hr({enabled:e}){return E({queryKey:X.githubOwners,queryFn:({signal:e})=>bt({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function gr(){let e=b();(0,O.useEffect)(()=>{let n,r=()=>{let r=e.getQueryData(Y.health),i=r?.capabilities?.localHandoff===!0;r&&Re({local:i,bootProject:r.bootProject??`default`,apiBase:t()}),i&&n===void 0?n=Ft(`health`,t=>{e.setQueryData(Y.health,t)}):!i&&n!==void 0&&(n(),n=void 0)};r();let i=e.getQueryCache().subscribe(r);return()=>{i(),n?.(),h()}},[e])}function _r(){return E({queryKey:Y.health,queryFn:({signal:e})=>yt({signal:e})})}function vr(e,t){let n=_r().data,r=Kn(t).data?.projects,i=ht(),a=e??i.projectId,o=a??n?.bootProject,s=o===void 0?void 0:r?.find(e=>e.id===o);return s?.repoUrl?s.repoUrl:a===null||a===n?.bootProject?Nn(n?.repo?.remote):void 0}function yr(){return E({queryKey:Y.openTargets,queryFn:({signal:e})=>St({signal:e}),staleTime:5*6e4})}function br(){return E({queryKey:Y.runs.list(),queryFn:({signal:e})=>pe(j(),{signal:e})})}function xr(e,t){return T({queryKey:Y.runs.archived(e),enabled:t,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>c({before:t,limit:200,q:e},{signal:n}),getNextPageParam:e=>e.nextCursor??void 0,placeholderData:(e,t)=>t?.queryKey[0]===n()?e:void 0})}function Sr(e){let t=e.trim();return E({queryKey:X.runsSearch(t),queryFn:({signal:e})=>$e(t,{signal:e}),enabled:t.length>=2,placeholderData:Ke,staleTime:1e4})}function Cr(e=!0,t=un){let n=V(b());return D(`/api/v1/workspace/runs-index`,X.runsIndex,a(e?t:!1),pn),E({queryKey:X.runsIndex,queryFn:({signal:e})=>at({signal:e}).then(n.merge),enabled:e,staleTime:3e4,refetchInterval:!1})}function wr(e,t=!0,n=!1){return E({queryKey:[j({projectId:e,boot:n}).cacheScope,`runs`,`list`],queryFn:({signal:t})=>pe(j({projectId:e,boot:n}),{signal:t}),enabled:t,placeholderData:(t,r)=>n&&r?.queryKey[0]===e?t:void 0})}function Tr(e){let t=b();return A({mutationFn:e=>rt(e),onSettled:()=>t.invalidateQueries({queryKey:Y.runs.relationships(e)})})}function Er(e,t={}){return E({queryKey:Y.runs.relationships(e),queryFn:({signal:t})=>g(e,{signal:t}),enabled:t.enabled??!0})}function Dr(e){return E({queryKey:Y.runs.detail(e??``),queryFn:({signal:t})=>Ne(M(e),{signal:t}),enabled:!!e})}function Or(e,t,n=!0){return E({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Ne(M(t,{projectId:e}),{signal:n}),enabled:n&&!!e&&!!t})}function kr(e){return E({queryKey:Y.runs.diff(e??``),queryFn:({signal:t})=>Ot(e,{signal:t}),enabled:!!e})}function Ar(e,t=!1){return D(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/changes`:void 0,Y.runs.changes(e??``),a(t?4e3:!1)),E({queryKey:Y.runs.changes(e??``),queryFn:({signal:t})=>wt(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0})}function jr(e,t){return E({queryKey:Y.runs.file(e??``,t??``),queryFn:({signal:n})=>xe(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function Mr(e,t){return E({queryKey:[n(),`runs`,`file-link`,e,t],queryFn:({signal:n})=>Oe(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Nr(e,t){return E({queryKey:[n(),`runs`,`artifact`,e,t],queryFn:({signal:n})=>we(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Pr(e,t){return E({queryKey:[n(),`runs`,`artifact-metadata`,e,t],queryFn:({signal:n})=>ee(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Fr(e){return E({queryKey:[n(),`runs`,`artifacts`,e],queryFn:({signal:t})=>Ce(e,{signal:t}),retry:!1,staleTime:0,refetchOnWindowFocus:!0})}function Ir(e,t=!1){return D(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/commits`:void 0,Y.runs.commits(e??``),a(t?5e3:!1)),E({queryKey:Y.runs.commits(e??``),queryFn:({signal:t})=>ze(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1})}function Lr(e,t){return E({queryKey:Y.runs.commit(e??``,t??``),queryFn:({signal:n})=>kt(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function Rr(e,t=!0){return E({queryKey:Y.runs.handoff(e??``),queryFn:({signal:t})=>f(M(e),{signal:t}),enabled:!!e&&t})}function zr(e,t,n){return E({queryKey:e===void 0?Y.runs.handoff(t):[e,`runs`,`handoff`,t],queryFn:({signal:n})=>f(M(t,{projectId:e}),{signal:n}),enabled:n,staleTime:15e3})}function Br(e,t){let r=[...new Set(e)],i=k({queries:r.map(e=>({queryKey:[e??n(),`automations`,`names`],queryFn:({signal:t})=>se({signal:t,archived:`include`,...e===void 0?{}:{projectId:e}}),enabled:t,staleTime:6e4,retry:!1}))}),a=i.map(e=>e.data);return(0,O.useMemo)(()=>{let e=new Map;return a.forEach((t,n)=>{if(t?.available)for(let i of t.automations)e.set(JSON.stringify([r[n]??null,i.id]),i.name)}),(t,n)=>e.get(JSON.stringify([t??null,n]))},[JSON.stringify([r,i.map(e=>e.dataUpdatedAt)])])}function Vr(){return E({queryKey:Y.workflows,queryFn:({signal:e})=>fe({signal:e})})}function Hr(e=!0){let t=b(),n=Y.skills,r=n[0],i=E({queryKey:n,queryFn:({signal:e})=>s({signal:e}),enabled:e}),a=E({queryKey:Y.skillsReady,queryFn:({signal:e})=>it({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,O.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`],a.data)},[t,a.data,r]),i}function Ur(e=!0){let t=b(),n=Y.importableSkills,r=n[0],i=E({queryKey:n,queryFn:({signal:e})=>Ue({signal:e}),enabled:e}),a=E({queryKey:Y.importableSkillsReady,queryFn:({signal:e})=>st({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,O.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`,`importable`],a.data)},[t,a.data,r]),i}function Wr(){return E({queryKey:Y.repo,queryFn:({signal:e})=>pt({signal:e})})}function Gr(e){return E({queryKey:[e,`repo`],queryFn:({signal:t})=>pt({signal:t},e)})}function Kr(){return E({queryKey:Y.repoBranches,queryFn:({signal:e})=>lt({signal:e})})}function qr(){return E({queryKey:Y.repoChanges,queryFn:({signal:e})=>et({signal:e}),retry:!1})}function Jr(e){return E({queryKey:Y.repoCommit(e??``),queryFn:({signal:t})=>Qe(e,{signal:t}),enabled:!!e,retry:!1})}function Yr(){return E({queryKey:Y.config,queryFn:({signal:e})=>ie({signal:e})})}function Xr(){return E({queryKey:Y.worktrees,queryFn:({signal:e})=>re({signal:e})})}function Zr(e){return E({queryKey:[e,`worktrees`],queryFn:({signal:t})=>re({signal:t},e),staleTime:0})}function Qr(e,t=!0,n=!1){return E({queryKey:[j({projectId:e,boot:n}).cacheScope,`ui-state`],queryFn:({signal:t})=>de({signal:t},e),select:e=>e.sidebarLimits===void 0?e:{...e,sidebarLimits:Nt(e.sidebarLimits)},enabled:t})}function $r(){return Qr(n())}function ei(){return E({queryKey:Y.agentConfig,queryFn:({signal:e})=>ce({signal:e})})}function ti(e){return E({queryKey:Y.agentConfigFile(e??``),queryFn:({signal:t})=>ye(e,{signal:t}),enabled:e!==null})}function ni(e){let t=b(),n=Y.agentConfig,r=Y.agentConfigFile(e);return A({mutationFn:t=>ve(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}function ri(){return E({queryKey:X.uiState,queryFn:({signal:e})=>y({signal:e})})}function ii(){return E({queryKey:X.config,queryFn:({signal:e})=>he({signal:e})})}function ai(){return E({queryKey:X.agentProfiles,queryFn:({signal:e})=>At({signal:e})})}function oi(e){let t=b();return A({mutationFn:t=>mt(e,t),onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function si(e){let t=R(),n=e?.projectId,r=e?.cacheScope,i=A({mutationFn:e=>Le(e,!0),onMutate:e=>t.patchRead(e,!0),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)}),a=(0,O.useCallback)(e=>({...M(e,{projectId:n,cacheScope:r}),id:e}),[n,r]),o=(0,O.useCallback)(e=>({onSuccess:(t,n,r,i)=>e?.onSuccess?.(t,n.id,r,i),onError:(t,n,r,i)=>e?.onError?.(t,n.id,r,i),onSettled:(t,n,r,i,a)=>e?.onSettled?.(t,n,r.id,i,a)}),[]),{mutate:s,mutateAsync:c}=i,l=(0,O.useCallback)((e,t)=>s(a(e),o(t)),[s,a,o]),u=(0,O.useCallback)((e,t)=>c(a(e),o(t)),[c,a,o]);return{...i,variables:i.variables?.id,mutate:l,mutateAsync:u}}function ci(){let e=R();return A({mutationFn:e=>Le(M(e),!1),onMutate:t=>e.patchRead(()=>M(t),!1),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)})}function li(e){let t=R();return A({mutationFn:({id:t,pinned:n})=>oe(M(t,e),n),onError:e=>It(`Could not update pin. ${e.message} Please retry.`,{tone:`danger`}),onMutate:()=>e??j(),onSuccess:(e,n,r)=>t.invalidateAfter(`runs`,r)})}function ui(e,t){let n=R();return A({mutationFn:n=>Me(M(e,{projectId:t}),n),onMutate:()=>j({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`send`,r),onError:(e,t,r)=>{e instanceof tt&&e.status===409&&r&&n.invalidateAfter(`send`,r)}})}function di(e,t){let n=R();return A({mutationFn:(n={})=>je(M(e,{projectId:t}),n),onMutate:()=>j({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`continue`,r)})}function fi(e){let t=b();return A({mutationFn:({msgId:t,message:n})=>ue(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function pi(e){let t=b();return A({mutationFn:t=>xt(e,t),onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function mi(e={},t=!0){let r=b(),i=Y.github(e);D(`/api/v1/p/${n()}/github${e.limit===void 0?``:`?limit=${e.limit}`}`,i,a(t?6e4:!1));let o=E({queryKey:Y.github(e),queryFn:({signal:t})=>x({limit:e.limit},{signal:t}),enabled:t,staleTime:6e4,refetchInterval:!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0}),s=o.data?.projectsGeneration,c=E({queryKey:[...i,`projects`,s],queryFn:({signal:e})=>nt(s,{signal:e}),enabled:t&&o.data?.projectsState===`refreshing`&&!!s,staleTime:1/0,retry:!1});return(0,O.useEffect)(()=>{!s||!c.data&&!c.error||r.setQueryData(i,e=>{if(!e||e.projectsGeneration!==s||e.projectsState!==`refreshing`)return e;let t=c.data;return t?.generation&&t.generation!==s?e:t?.state===`ready`?{...e,projectsState:`ready`,projects:t.projects,issues:e.issues.map(e=>({...e,projectIds:t.membership?.[e.number]??[]}))}:{...e,projectsState:`unavailable`,projectsReason:t?.reason??`Project boards unavailable. Refresh to try again.`}})},[r,s,c.data,c.error,i]),o}var hi=class extends Error{};function gi(e,t,n){return{queryKey:e,initialPageParam:{},queryFn:async({pageParam:e,signal:r})=>{let i=await x({limit:t,...e,...n?{projectId:n}:{}},{signal:r});if(!i.available&&Object.keys(e).length>0)throw new hi(i.reason??`GitHub is unavailable.`);return i},getNextPageParam:e=>Ln(e),retry:(e,t)=>!(t instanceof hi)&&!(t instanceof tt&&t.status>=400&&t.status<500)&&e<1,staleTime:6e4,refetchOnWindowFocus:!0}}function _i(e=50,t=!0){let r=b(),i=Y.githubPages(e),o=Y.githubPagesHead(e);D(`/api/v1/p/${n()}/github?limit=${e}`,o,a(t?6e4:!1));let s=T({...gi(i,e),enabled:t,refetchInterval:!1,refetchIntervalInBackground:!1}),c=E({queryKey:o,queryFn:({signal:t})=>x({limit:e},{signal:t}),enabled:!1,staleTime:1/0}),{refetch:l}=s;(0,O.useEffect)(()=>{if(!c.data)return;let e=r.getQueryData(i);if(!e||e.pages.length===0)return;let t=Vn(e.pages,c.data);t===`refetch`?l():r.setQueryData(i,{...e,pages:t})},[r,c.dataUpdatedAt,l]);let u=(s.data?.pages??[]).flatMap(e=>e.projectsState===`refreshing`&&e.projectsGeneration?[e.projectsGeneration]:[]),d=k({queries:u.map(e=>({queryKey:[...i,`projects`,e],queryFn:({signal:t})=>nt(e,{signal:t}),enabled:t,staleTime:1/0,retry:!1}))});return(0,O.useEffect)(()=>{d.forEach((e,t)=>{let n=u[t];!n||!e.data&&!e.error||r.setQueryData(i,t=>{if(!t)return t;let r=!1,i=t.pages.map(t=>{if(t.projectsGeneration!==n||t.projectsState!==`refreshing`)return t;let i=e.data;return i?.generation&&i.generation!==n?t:(r=!0,i?.state===`ready`?{...t,projectsState:`ready`,projects:i.projects,issues:t.issues.map(e=>({...e,projectIds:i.membership?.[e.number]??[]}))}:{...t,projectsState:`unavailable`,projectsReason:i?.reason??`Project boards unavailable. Refresh to try again.`})});return r?{...t,pages:i}:t})})},[r,d.map((e,t)=>e.data||e.error?u[t]:``).join(`,`)]),{pages:s,data:(0,O.useMemo)(()=>Bn(s.data?.pages??[]),[s.data])}}function vi(e,t=50,n=!0){let r=T({...gi([e,`github`,`pages`,t],t,e),enabled:n});return{pages:r,data:(0,O.useMemo)(()=>Bn(r.data?.pages??[]),[r.data])}}function yi(e,t,n=!0){let r=k({queries:t.filter(e=>e.length>0).map(t=>({queryKey:Y.githubCommentCounts(e,t),queryFn:({signal:n})=>ge(e,t,{},{signal:n}),enabled:n,staleTime:6e4}))});return(0,O.useMemo)(()=>{let e={};for(let t of r)t.data?.available&&Object.assign(e,t.data.counts);return e},[r.map(e=>e.dataUpdatedAt).join(`,`)])}function bi(e,t,n,r=!0){return E({queryKey:[e,`github`,`search`,t,n],queryFn:({signal:r})=>ft(t,n,{projectId:e},{signal:r}),enabled:r&&n.trim()!==``,staleTime:6e4})}function xi(e,t=!0){return E({queryKey:Y.githubChecks(e),queryFn:({signal:t})=>Ae(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function Si(e,t,n=!0){return E({queryKey:Y.githubSearch(e,t),queryFn:({signal:n})=>ft(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var Ci=100;function wi(e){return[...e].sort((e,t)=>t-e).slice(0,Ci).sort((e,t)=>e-t)}function Ti(){let e=ht(),t=_r();return e.projectId??t.data?.bootProject}function Ei(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))U(K({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))U(K({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var Di=5*6e4;function Oi(e){return e?e.recheckAfterMs:Di}function ki(e,t=!0){let n=(0,O.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{prs:new Set,issues:new Set};e[n.kind===`PR`?`prs`:`issues`].add(n.number),t.set(n.projectId,e)}return[...t.entries()].map(([e,t])=>({projectId:e,prs:wi(t.prs),issues:wi(t.issues)}))},[e.map(K).sort().join(`|`)]),r=k({queries:n.map(e=>({queryKey:Y.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>Fe(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>Oi(e.state.data)??1/0,refetchInterval:!1,refetchOnWindowFocus:!0}))}),a=b(),o=JSON.stringify(n.map((e,t)=>({...e,interval:Oi(r[t]?.data)??!1})));(0,O.useEffect)(()=>{if(!t||i())return;let e=!0,n=JSON.parse(o).filter(e=>e.interval!==!1).map(t=>{let n=new URLSearchParams;t.prs.length&&n.set(`prs`,t.prs.join(`,`)),t.issues.length&&n.set(`issues`,t.issues.join(`,`));let r=Y.githubRefStatus(t.projectId,t.prs,t.issues);return Pt({path:`/api/v1/p/${t.projectId}/github/ref-status?${n}`,intervalMs:t.interval},(t,n)=>{n||a.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&a.setQueryData(r,t)})})});return()=>{e=!1;for(let e of n)e()}},[t,o,a]);let s=(0,O.useMemo)(()=>Mn(n,r),[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,O.useCallback)(e=>{let t=K(e),n=s.get(t);if(n)return n;let r=H.get(t);return{state:`idle`,...r?{status:r}:{},...W.has(t)?{conflicting:!0}:{}}},[s])}function Ai(e,t,n=!0){return E({queryKey:Y.githubComments(e,t),queryFn:({signal:n})=>o(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function ji(e,t,n=!0){return E({queryKey:Y.githubItem(e,t),queryFn:({signal:n})=>qe(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Mi(e){return E({queryKey:Y.githubPrChanges(e??0),queryFn:({signal:t})=>ut(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{Un as $,Lt as $t,hr as A,Hr as At,fr as B,Xr as Bt,Mr as C,Hn as Ct,yi as D,Sr as Dt,xi as E,Cr as Et,gr as F,Xn as Ft,bi as G,Nn as Gt,oi as H,Rn as Ht,Ur as I,er as It,Or as J,V as Jt,Gr as K,yn as Kt,si as L,Vr as Lt,Mi as M,nr as Mt,Si as N,$r as Nt,Ai as O,sr as Ot,_r as P,ar as Pt,Kn as Q,A as Qt,ci as R,ii as Rt,fi as S,Er as St,mi as T,br as Tt,li as U,Pn as Ut,yr as V,X as Vt,vi as W,Fn as Wt,Qr as X,j as Xt,wr as Y,R as Yt,Zr as Z,M as Zt,di as _,Lr as _t,lr as a,Jn as at,$n as b,jr as bt,ai as c,tr as ct,Pr as d,Kr as dt,ni as et,Fr as f,qr as ft,ur as g,Ar as gt,Yr as h,Dr as ht,cr as i,Wn as it,_i as j,zr as jt,ji as k,ui as kt,xr as l,pi as lt,pr as m,Gn as mt,Y as n,Ti as nt,ei as o,or as ot,Br as p,Jr as pt,vr as q,xn as qt,Ei as r,ki as rt,ti as s,Yn as st,Z as t,dr as tt,Nr as u,Wr as ut,ir as v,Ir as vt,qn as w,Q as wt,Tr as x,Rr as xt,mr as y,kr as yt,rr as z,ri as zt};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,L as n,S as r,d as i,t as a,u as o}from"./button-DGwhwRuD.js";import{i as s,t as c}from"./react-runtime-CCIEwYL0.js";import{$n as l,Bn as u,Gt as d,Jn as f,Ln as p,Ur as ee,Vn as m,Wt as h,Yn as g,er as _,i as v,k as y,nr as b,o as te,yr as ne}from"./project-scope-context-bgdvGX9z.js";import{$ as x,H as S,P as re,Q as ie,Qt as C,R as w,St as T,Tt as ae,U as E,V as oe,Xt as se,Yt as ce,Zt as le,ht as ue,n as de,nt as fe,q as pe,x as me,xt as he,z as ge}from"./queries-Ce9CPdRy.js";import{J as _e,L as ve,S as ye,_ as be,a as xe,b as Se,d as Ce,f as we,n as Te,o as Ee,p as De,r as Oe,v as ke,y as Ae,z as D}from"./use-desktop-DBpXK7UB.js";import{n as O}from"./toaster-CoMJoQvk.js";import{I as je,S as Me,Y as Ne,_ as Pe,a as Fe,g as Ie,h as Le,j as Re,m as ze,mt as Be,o as Ve,p as He,st as Ue,t as We,u as Ge,y as k}from"./design-icons-DmYTv2r1.js";import{t as A}from"./createLucideIcon-BHp8sXmF.js";import{t as Ke}from"./app-window-CSHwDX9N.js";import{t as qe}from"./info-DA1x_4bz.js";import{a as Je,t as Ye}from"./format-BNCkW110.js";import{t as Xe}from"./message-square-B-MD-8rD.js";import{i as Ze,n as Qe,t as j}from"./reference-chip-peKR_0El.js";import{a as M,i as N,l as P,n as F,p as I,r as L,t as R}from"./dropdown-menu-DPrTX-zi.js";import{a as z,c as B,i as V,n as H,o as U,r as $e,s as et,t as tt}from"./alert-dialog-CH4SXGfX.js";import{a as nt,i as rt,o as it,r as at,s as ot,t as st}from"./dialog-B7p5oc5r.js";import{c as ct,s as lt,t as W}from"./project-router-WQWd3UUn.js";import"./attention-CVI366xV.js";import{$ as ut,$t as dt,Bt as ft,Jt as pt,Kt as G,L as mt,M as ht,N as gt,Ot as K,Rt as _t,Yt as vt,_ as yt,_n as bt,_t as xt,a as St,bt as Ct,cn as wt,j as Tt,kt as q,nn as Et,o as Dt,qt as Ot,r as kt,t as At,tn as jt,vt as Mt,wt as Nt,xt as Pt,z as Ft,zt as It}from"./index-DgeV0f4H.js";import{t as J}from"./tab-link-DiNYVlpl.js";var Lt=A(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),Rt=A(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),zt=A(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),Y=e(s(),1),X=c();function Bt(e){let t=ce();return C({mutationFn:t=>te(le(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>se()),onError:e=>O(e.message,{tone:`danger`})})}function Vt(e){return e.archived?`Unarchive`:`Archive task`}function Ht({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,X.jsx)(tt,{open:t,onOpenChange:n,children:(0,X.jsxs)(V,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(et,{children:[(0,X.jsx)(B,{children:`Archive task?`}),(0,X.jsxs)(z,{children:[`Move “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:D(e),children:D(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,X.jsxs)(U,{children:[(0,X.jsx)($e,{children:`Cancel`}),(0,X.jsx)(H,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function Z({run:e,className:t,compactOnMobile:n=!1}){let[r,i]=(0,Y.useState)(!1),s=Bt(e.id),c=Vt(e);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(a,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":c,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:s.isPending,className:o(`h-11 gap-[7px] px-3`,n&&`max-md:size-11 max-md:px-0`,t),onClick:()=>e.archived?s.mutate(!1):i(!0),children:[e.archived?(0,X.jsx)(bt,{"aria-hidden":`true`}):(0,X.jsx)(We,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:o(n&&`max-md:sr-only`),children:c})]}),(0,X.jsx)(Ht,{run:e,open:r,onOpenChange:i,onConfirm:()=>{s.mutate(!0),i(!1)}})]})}function Ut({run:e,action:t,prUrl:n,patch:r}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:t.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,t.message||(t.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&i(n)?(0,X.jsx)(a,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,X.jsx)(a,{variant:`outline`,disabled:r.isPending,onClick:()=>r.mutate({autoMergePr:!1},{onError:e=>O(e.message,{tone:`danger`})}),children:r.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function Wt({run:e,blocker:t,flags:n}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,X.jsx)(a,{variant:`outline`,asChild:!0,children:(0,X.jsx)(W,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&i(t.pullRequestUrl)?(0,X.jsx)(a,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,X.jsx)(Z,{run:e}):null]})]})}function Gt({run:e}){let t=S(e.id),n=q(e),r=e.status===`done`?e.completionAction:void 0,i=n.archive?e.archiveBlocker:void 0,a=r&&r.phase!==`complete`?r:void 0;if(!a&&!i)return null;let o=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,X.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-border bg-card p-3 [margin-block:0.75rem]`,children:[a?(0,X.jsx)(Ut,{run:e,action:a,prUrl:o,patch:t}):null,i?(0,X.jsx)(Wt,{run:e,blocker:i,flags:n}):null]})}var Kt=[`running`,`queued`,`waiting`];function qt(e,{queuePosition:t,now:n=new Date}){let r=p(e),i=r.label.charAt(0).toUpperCase()+r.label.slice(1),a=t===void 0?i:`${i} #${t}`,o=Kt.includes(e.status)?Yt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Jt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Yt(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:Ye(n,t)}}async function Q(e,t){try{await navigator.clipboard.writeText(e),O(t)}catch{O(`Run manually: ${e}`)}}function Xt(e){let t=pe(),n=fe(),r=(0,Y.useMemo)(()=>ye(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,Y.useMemo)(()=>n===void 0?[]:r.filter(e=>Ce(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function Zt(e){return C({mutationFn:()=>d(e.id),onError:e=>{if(e instanceof v&&e.command){Q(e.command,`No terminal found — command copied to clipboard.`);return}O(e.message,{tone:`danger`})}})}function $(e,t){let n=oe(),r=x(),i=C({mutationFn:t=>h(e.id,t),onError:e=>O(e.message,{tone:`danger`})}),a=ne(r.data),o=e=>!r.isSuccess||a.includes(e??`claude`);return{canResumeHere:t&&o(Nt(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=pt(e.id);return t===void 0||o(t)}).map(t=>({target:t,...Pt(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:i}}function Qt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:o}=$(e,t),s=K(e);return!r&&i.length===0&&!s?null:(0,X.jsxs)(X.Fragment,{children:[r||i.length>0?(0,X.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,X.jsxs)(a,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,X.jsx)(dt,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=vt(e);return(0,X.jsxs)(a,{variant:`outline`,"data-target":e.id,title:n,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:[(0,X.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,X.jsxs)(a,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>O(`Worktree path copied`)).catch(()=>O(`Path: ${t}`))},children:[(0,X.jsx)(k,{}),`Copy worktree path`]}):null]}):null,s?(0,X.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,X.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,X.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,X.jsxs)(a,{variant:`outline`,onClick:()=>void Q(s,`Command copied to clipboard.`),children:[(0,X.jsx)(k,{}),`Copy resume command`]})]}):null]})}function $t({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:o}=$(e,t),s=K(e),c=e.worktreePath;if(!r&&i.length===0&&!s&&!c)return null;let l=`max-md:min-h-11`;return(0,X.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,X.jsx)(Ot,{choices:i,onPick:e=>o.mutate(e),disabled:o.isPending,triggerVariant:`outline`,className:l,leading:r?(0,X.jsxs)(N,{"data-target":`terminal-resume`,onSelect:n,children:[(0,X.jsx)(dt,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,c?(0,X.jsxs)(a,{variant:`outline`,size:`sm`,className:l,onClick:()=>void Q(c,`Worktree path copied`),children:[(0,X.jsx)(k,{"aria-hidden":`true`}),`Copy worktree path`]}):null,s?(0,X.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:s,className:l,onClick:()=>void Q(s,`Command copied to clipboard.`),children:[(0,X.jsx)(k,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function en({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:o,choices:s}=$(e,t);return!o&&s.length===0?null:r?(0,X.jsx)(N,{onSelect:r,children:`Open in…`}):(0,X.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,X.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,X.jsx)(Be,{})})]}),e.worktreePath?(0,X.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,X.jsx)(`div`,{className:`mt-4`,children:(0,X.jsx)(Qt,{run:e,canResume:t,onResume:n})})]})}function tn({branch:e}){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(null);(0,Y.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{O(`Could not copy branch. Select and copy: ${e}`)}};return(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,X.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium break-all`,children:e}),(0,X.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,X.jsx)(k,{className:`size-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function nn({run:e}){let t=pe(),n=fe(),r=r=>n===void 0?void 0:ke(n,e.id,r,t),a=(0,Y.useMemo)(()=>ye(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,X.jsx)(j,{reference:t,to:r(t),taskTitle:D(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,X.jsx)(Mt,{run:e,prNumber:t.number})},De(t)));let l=Se(e);l&&i(l)&&!c.some(e=>e.url===l)&&o.push((0,X.jsx)(j,{reference:{kind:`PR`,url:l},taskTitle:D(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=a.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,X.jsx)(j,{reference:t,to:r(t),taskTitle:D(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},De(t)));let d=be(e,t);if(d&&i(d)&&!u.some(e=>e.url===d)){let t=we(d);s.push((0,X.jsx)(j,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?r({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:D(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,X.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,X.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function rn(){let e=lt(),t=ie();return Tt(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var an=e=>e.map(e=>`${e.name}: ${ht(e.url)}`).join(`
|
|
2
|
-
`);function on(e){return rn().length>0||e.notify===!0}function sn({run:e}){let t=rn(),n=t.length>0,r=ge(e.id),[i,o]=(0,Y.useState)(null),s=e.notify===!0;return!n&&!s?null:(0,X.jsxs)(X.Fragment,{children:[s?(0,X.jsxs)(R,{children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${gt(t)} — webhook actions`:`Notifying — webhook actions`,title:n?an(t):void 0,children:[(0,X.jsx)(G,{tone:`success`}),(0,X.jsx)(`span`,{children:`Notifying`}),(0,X.jsx)(Ge,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,X.jsxs)(L,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,X.jsx)(M,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-[11px] font-normal text-muted-foreground`,children:t.map(e=>(0,X.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:ht(e.url),children:e.name},e.id))}):null,n?(0,X.jsxs)(N,{className:`min-h-11`,onSelect:()=>o(`note`),children:[(0,X.jsx)(Xe,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,X.jsxs)(N,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>O(`Stopped notifying the webhook`),onError:e=>O(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,X.jsx)(Lt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,X.jsxs)(a,{variant:`outline`,size:`sm`,"data-action":`handoff`,className:`size-11 px-0 md:h-[30px] md:w-auto md:px-2.5`,"aria-label":`Hand off to webhook`,onClick:()=>o(`handoff`),children:[(0,X.jsx)(jt,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,X.jsx)(cn,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&o(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{o(null),O(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>O(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function cn({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let o=(0,Y.useId)(),s=(0,Y.useId)(),[c,l]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{e!==null&&l(``)},[e]);let u=e===`note`,d=gt(t);return(0,X.jsx)(st,{open:e!==null,onOpenChange:e=>{e||l(``),r(e)},children:(0,X.jsx)(at,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,X.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(c.trim())},children:[(0,X.jsxs)(it,{className:`text-left`,children:[(0,X.jsx)(ot,{children:u?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,X.jsx)(rt,{children:(0,X.jsx)(`span`,{"data-webhook-destination":``,title:an(t),children:u?`${d} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${d} will start receiving this task's status updates. Add a note (optional).`})})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(`label`,{htmlFor:o,className:`text-[13px] font-medium`,children:`Note`}),(0,X.jsx)(ut,{id:o,"data-slot":`handoff-note`,"aria-describedby":s,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:c,onChange:e=>l(e.target.value)}),(0,X.jsxs)(`p`,{id:s,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,X.jsx)(qe,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,X.jsxs)(nt,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,X.jsx)(a,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,X.jsxs)(a,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||u&&c.trim()===``,children:[(0,X.jsx)(jt,{"aria-hidden":`true`}),u?`Send note`:`Hand off`]})]})]})})})}function ln({runId:e,children:t}){let n=r(),i=(0,Y.useMemo)(()=>({runId:e}),[e]);return n?(0,X.jsx)(un,{runId:e,children:t}):(0,X.jsx)(Ft.Provider,{value:i,children:t})}function un({runId:e,children:n}){let{projectId:r}=t(),i=(0,Y.useMemo)(()=>({runId:e,...r?{projectId:r}:{}}),[e,r]);return(0,X.jsx)(Ft.Provider,{value:i,children:n})}function dn(e,t,n,r){return n?r===`step`?`Step ${e} of ${t}`:`${e} of ${t} complete`:`${e} / ${t}`}function fn(e){return typeof e==`object`&&!!e&&!(0,Y.isValidElement)(e)&&`keep`in e}function pn({slot:e,icon:t,title:n,meta:r,summary:i,aside:a,open:s,onToggle:c,className:l,children:u}){let d=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`flex size-4 shrink-0 items-center justify-center text-accent-text`,children:t}),(0,X.jsx)(`span`,{className:o(`truncate text-[14px] font-semibold text-foreground`,typeof n==`string`?`shrink-0`:`min-w-0 shrink`),children:n}),i??(fn(r)?(0,X.jsxs)(`span`,{"data-slot":`run-activity-meta`,className:`contents text-[13px] text-muted-foreground tabular-nums`,children:[r.drop===void 0?null:(0,X.jsxs)(`span`,{className:`flex h-[1lh] min-w-0 shrink-[2] flex-wrap overflow-hidden`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-[1lh] w-0`}),(0,X.jsxs)(`span`,{"data-slot":`run-activity-meta-drop`,className:`whitespace-nowrap`,children:[r.drop,(0,X.jsx)(`span`,{className:`text-soft-foreground`,children:` ·`})]})]}),` `,(0,X.jsx)(`span`,{"data-slot":`run-activity-meta-keep`,className:`shrink-0 whitespace-nowrap`,children:r.keep})]}):r===void 0?null:(0,X.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`min-w-0 shrink-[2] truncate text-[13px] text-muted-foreground tabular-nums`,children:r}))]}),f=c!==void 0;return(0,X.jsxs)(`div`,{"data-slot":`run-activity-${e}`,"data-state":f&&s?`open`:`collapsed`,className:o(`min-w-0 border-t border-border first:border-t-0`,l),children:[f?(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:c,className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2 text-start hover:bg-muted/40 active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring`,children:[d,a,(0,X.jsx)(Ge,{"aria-hidden":!0,className:o(`size-4 shrink-0 text-soft-foreground motion-safe:transition-transform motion-reduce:transition-none`,!a&&`ms-auto`,s&&`rotate-180`)})]}):(0,X.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2`,children:[d,a]}),f&&s?(0,X.jsx)(`div`,{"data-slot":`run-activity-body`,className:`min-w-0 border-t border-border/60 bg-muted/30 px-3.5 py-2.5`,children:u}):null]})}function mn(e,t){let n=e?.role===`root`?e.receipts.map(e=>e.workerId).reverse():[];return[...new Set([...n,...(t?.workers??[]).map(e=>e.workerId)])]}function hn(e){let t=e.delegation,n=t?.role===`root`,r=T(e.id,{enabled:n});if(!n||!t)return`complete`;if(!r.isSuccess)return r.isError||r.fetchStatus===`paused`?`unknown`:`pending`;let i=new Map(r.data.workers.map(e=>[e.workerId,e])),a=mn(t,r.data).map(e=>{let t=i.get(e)?.status;return t===`done`||t===`cancelled`?`complete`:t===void 0||t===`failed`?`issue`:`pending`});return a.includes(`pending`)?`pending`:a.includes(`issue`)?`issue`:`complete`}function gn(e){let t=T(e.id,{enabled:e.delegation?.role===`root`});return t.isSuccess&&t.data.workers.some(e=>_e(e.status))}function _n({run:e,open:t,onToggle:n}){let r=T(e.id),i=ae(),s=Te(),c=e.delegation,u=new Map(r.data?.workers.map(e=>[e.workerId,e])),d=mn(c,r.data),f=l(e)??b(e),p=f?vn(e,f):void 0;return(0,X.jsx)(pn,{slot:`workers`,icon:(0,X.jsx)(Re,{className:`size-4`}),title:`Workers`,meta:yn({ids:d,workers:u,desktop:s,query:r}),aside:r.data?.capacity?(0,X.jsx)(En,{capacity:r.data.capacity}):void 0,open:t,onToggle:n,children:(0,X.jsxs)(`div`,{"aria-label":`Task relationships`,className:`min-w-0 text-[13px] text-muted-foreground`,role:`group`,children:[r.data?.capacity&&r.data.capacity.outstanding>=r.data.capacity.limit?(0,X.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`All worker slots are in use. Clean up finished workers to free a slot.`}):null,f?(0,X.jsx)(Cn,{wait:f,dependencyLabel:p}):null,d.length>0?(0,X.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-0.5 overflow-y-auto`,children:d.map(t=>{let n=u.get(t),a=i.data?.find(e=>e.id===t)??r.data?.titles?.find(e=>e.id===t),s=n?xn(n.status):r.isSuccess?`Record unavailable or deleted`:`Status unavailable`;return(0,X.jsxs)(`li`,{"data-slot":`worker-item`,"data-status":n?.status,className:`min-w-0`,children:[(0,X.jsxs)(W,{to:`/tasks/${t}`,"aria-label":`Worker task ${t}`,className:`group flex min-h-11 min-w-0 items-center gap-2.5 rounded-md px-1 text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,X.jsx)(bn,{status:n?.status}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:a?D(a):`Worker ${t.slice(0,8)}`}),(0,X.jsx)(`span`,{className:o(`max-w-[45%] shrink-0 truncate text-xs`,Sn(n?.status)),children:s}),(0,X.jsx)(Ve,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`})]}),n?(0,X.jsx)(On,{parentRunId:e.id,worker:n}):null,n?.destroy?(0,X.jsx)(An,{state:n.destroy}):null]},t)})}):c?.role===`root`&&r.isSuccess?(0,X.jsx)(`p`,{className:`px-1 py-1`,children:`No workers`}):null,r.fetchStatus===`paused`?(0,X.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Offline — relationship details will refresh when connected.`}):r.isPending?(0,X.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Loading relationships…`}):null,r.isError?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-1 py-1`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Could not load relationships. Known task links are retained.`}),(0,X.jsx)(a,{variant:`outline`,className:`min-h-11`,onClick:()=>void r.refetch(),children:`Retry relationships`})]}):null]})})}function vn(e,t){let n=e.delegation;if(!(!n||n.role===`invalid`))return m(e)??u(n.role,t,`requestIds`in t&&_(n,t.requestIds))}function yn({ids:e,workers:t,desktop:n,query:r}){if(e.length===0)return r.isError?`Unavailable`:r.isPending?`Linking…`:`No workers`;let i=`${e.length} linked`;if(!n)return i;let a=new Map;for(let n of e){let e=t.get(n)?.status;e!==void 0&&a.set(e,(a.get(e)??0)+1)}return[i,...[...a.entries()].map(([e,t])=>`${t} ${e}`)].join(` · `)}function bn({status:e}){let t=`size-[15px] shrink-0`;return e===`done`?(0,X.jsx)(He,{"aria-hidden":!0,className:o(t,`text-success`)}):e===`failed`?(0,X.jsx)(Pe,{"aria-hidden":!0,className:o(t,`text-danger`)}):e===`cancelled`?(0,X.jsx)(Ie,{"aria-hidden":!0,className:o(t,`text-soft-foreground`)}):e===`running`||e===`waiting`||e===`review`?(0,X.jsx)(Je,{role:`status`,"aria-label":`Worker running`,className:o(t,`animate-spin stroke-pending motion-reduce:animate-none`)}):(0,X.jsx)(Le,{"aria-hidden":!0,className:o(t,`text-soft-foreground`)})}function xn(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function Sn(e){return e===`done`?`text-success`:e===`failed`?`text-danger`:`text-muted-foreground`}function Cn({wait:e,dependencyLabel:t}){return(0,X.jsxs)(`p`,{className:`px-2 break-words`,children:[e.phase===`parked`&&t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:`requestIds`in e&&e.requestIds?e.phase===`parked`?`Waiting on request replies`:e.phase===`wake-pending`?`Conversation update queued for this task`:`Request wait registered — the agent is finishing its turn`:e.phase===`parked`?`Waiting on workers`:e.phase===`wake-pending`?`Worker update queued for the parent`:`Worker wait registered — the agent is finishing its turn`,`.`,`deadline`in e?(0,X.jsxs)(X.Fragment,{children:[` `,`Deadline: `,(0,X.jsx)(`time`,{dateTime:e.deadline,children:e.deadline})]}):` No deadline: ${n(`Cezar`)} wakes this task when they have all settled.`]})}function wn(e){return e.delegation?.role===`worker`&&b(e)?.phase===`wake-pending`}function Tn({run:e}){let t=b(e);return e.delegation?.role===`worker`&&t?.phase===`wake-pending`?(0,X.jsx)(Cn,{wait:t,dependencyLabel:u(`worker`,t)}):null}function En({capacity:e}){return(0,X.jsxs)(`span`,{"data-slot":`worker-capacity`,role:`status`,"aria-label":`Worker capacity: ${e.outstanding} of ${e.limit} in use`,className:`ms-auto shrink-0 whitespace-nowrap text-[13px] font-normal text-muted-foreground tabular-nums`,children:[e.outstanding,` of `,e.limit,` in use`]})}var Dn=new Set([`review`,`done`,`failed`,`cancelled`]);function On({parentRunId:e,worker:t}){let n=me(e),[r,i]=(0,Y.useState)(!1);if(!Dn.has(t.status)||t.destroy?.phase===`complete`&&t.destroy.remaining.length===0)return null;let o=t.workerId.slice(0,8),s=!!t.destroy&&t.destroy.phase!==`complete`;return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 px-1`,children:[r?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`break-words text-xs`,children:`Removes this worker's worktree and branch. Its result is saved first.`}),(0,X.jsx)(a,{variant:`danger-ghost`,size:`sm`,className:`min-h-11`,"aria-label":`Confirm clean up of worker ${o}`,onClick:()=>{i(!1),n.mutate(t.workerId)},children:`Clean up`}),(0,X.jsx)(a,{variant:`outline`,size:`sm`,className:`min-h-11`,onClick:()=>i(!1),children:`Cancel`})]}):(0,X.jsx)(a,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":s?`Retry clean up of worker ${o}`:`Clean up worker ${o}`,disabled:n.isPending,onClick:()=>i(!0),children:n.isPending?`Cleaning up…`:s?`Retry clean up`:`Clean up`}),n.isError&&!r?(0,X.jsxs)(`span`,{role:`status`,className:`break-words text-xs`,children:[`Cleanup did not finish: `,n.error.message]}):null]})}function kn(e){return e!==void 0&&(e.phase!==`complete`||e.remaining.length>0||e.error!==void 0)}function An({state:e}){if(!kn(e))return null;let t=e.phase===`complete`?void 0:e.retry,n=t&&(0,X.jsx)(jn,{at:t.nextAt});return(0,X.jsxs)(`p`,{className:`px-2 pb-2 break-words`,children:[t?.needsAttention?`Cleanup needs attention`:e.phase===`incomplete`?`Cleanup incomplete`:e.phase===`complete`?`Cleanup complete`:`Cleanup ${e.phase}`,e.remaining.length?` — remaining: ${e.remaining.join(`, `)}`:``,e.error?` — ${t?e.error.replace(/\.$/,``):e.error}`:``,t?.needsAttention?(0,X.jsxs)(X.Fragment,{children:[`. Nothing changed after `,t.attempts,` automatic attempts; checking hourly, next check `,n,`. Retry clean up to try now.`]}):t?(0,X.jsxs)(X.Fragment,{children:[`. Retrying automatically, next attempt `,n,`.`]}):null]})}function jn({at:e}){let t=xt(3e4);return(0,X.jsx)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:At(t,Date.parse(e))})}function Mn({id:e}){return(0,X.jsxs)(W,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,"data-slot":`mobile-parent-task-link`,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm px-2 text-[13px] text-muted-foreground [min-block-size:2.75rem] [min-inline-size:2.75rem] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted active:text-foreground`,children:[(0,X.jsx)(Fe,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function Nn({id:e}){let t=ue(e),n=t.data?D(t.data):e;return(0,X.jsxs)(`div`,{"data-slot":`parent-task`,className:`flex min-w-0 flex-wrap items-center gap-x-2 text-[13px] text-muted-foreground`,children:[(0,X.jsxs)(W,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,title:`Parent · ${n}`,"data-slot":`parent-task-link`,className:`flex min-h-11 min-w-0 max-w-full items-center gap-2 rounded-sm text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:text-foreground`,children:[(0,X.jsx)(Fe,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,X.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,X.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,X.jsx)(a,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var Pn=3,Fn=(e,t)=>e.kind===t.kind&&e.number===t.number;function In(e,t,n=Pn){let r=t?e.findIndex(e=>Fn(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var Ln=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function Rn({tab:e}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(e.kind===`pr`?je:ze,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,X.jsx)(Qe,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function zn(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function Bn({servers:e}){let t=yt();if(t===null)return null;let n=t.agentLive===!0,r=e[0],i=e.length+ +!!n===1?r?{port:r.port}:{agent:!0}:{};return(0,X.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,X.jsx)(Ke,{"aria-hidden":`true`}),zn(e,n),t.live?(0,X.jsx)(G,{tone:`success`,"aria-label":`Preview is live`}):null]})}function Vn(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function Hn({run:e,compact:t=!1}){return e.delegation?.role===`worker`?t?(0,X.jsx)(Mn,{id:e.delegation.parentRunId}):(0,X.jsx)(Nn,{id:e.delegation.parentRunId}):null}function Un(e,t,n,r){return!e.archiveBlocker&&t.archive&&(n!==`session`||!Ct(e,r))?(0,X.jsx)(Z,{run:e}):null}function Wn({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,X.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function Gn({shown:e,run:t,archiveButton:n,previewToggle:r}){let i=on(t);return e&&(n||r||i)?(0,X.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,r,(0,X.jsx)(sn,{run:t})]}):null}function Kn({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:i,phoneBar:a,isDesktop:o}){let s=(0,Y.useRef)(null),c=n?`${n.kind}#${n.number}`:null;return(0,Y.useEffect)(()=>{!c||o||s.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[c,r.map(e=>`${e.kind}#${e.number}`).join(`,`),o]),(0,X.jsxs)(`div`,{ref:s,"data-slot":`run-tabs`,"data-phone-bar":a||void 0,className:`mt-3 flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-3.5 max-md:[&>a]:text-[13.5px]`,children:[(0,X.jsx)(J,{to:`/tasks/${e.id}`,active:t===`session`,replace:a,children:`Session`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:a,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:a,children:`Commits`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:a,children:`Files`}),r.map(t=>(0,X.jsx)(J,{to:Ln(e.id,t),active:n!==null&&Fn(t,n),replace:a,children:(0,X.jsx)(Rn,{tab:t})},`${t.kind}-${t.number}`)),i.length>0?(0,X.jsxs)(R,{children:[(0,X.jsxs)(I,{"data-slot":`run-tabs-more`,"aria-label":`${i.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,i.length]}),(0,X.jsx)(L,{align:`end`,children:i.map(t=>(0,X.jsx)(N,{asChild:!0,children:(0,X.jsx)(W,{to:Ln(e.id,t),replace:a,children:(0,X.jsx)(Rn,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function qn({run:e,tab:t=`session`,onMarkedUnread:n}){let r=p(e),i=q(e),a=gn(e),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1),d=Jn(e,n),f=ae(),ee=re(),m=qt(e,{queuePosition:e.status===`queued`?ve(f.data??[]).get(e.id):void 0}),h=ft(),g=It(),_=h!==null&&!g?h:null,v=_!==null,{referenceProjectId:y,repoBase:b,requests:te}=Xt(e),ne=(0,Y.useMemo)(()=>Ae(e,b),[e,b]),x=typeof t==`object`?t:null,{inline:S,overflow:ie}=In(ne,x),C=ee.data?.capabilities?.preview===!0,w=e.worktreePath&&C?(0,X.jsx)(Bn,{servers:e.previewServers??[]}):null,T=(0,X.jsx)(Qn,{run:e,actions:d,onOpenChooser:()=>u(!0),onToggleNotes:()=>c(e=>!e)}),E=Un(e,i,t,a);return(0,X.jsx)(Ze,{projectId:y,repoBase:b,requests:te,children:(0,X.jsxs)(`header`,{"data-slot":`run-header`,className:o(`relative z-20 bg-background px-[18px] md:px-9 md:pt-7`,v?`pt-0`:`pt-[18px]`,t===`session`&&`md:sticky md:top-0`),children:[(0,X.jsx)(Wn,{run:e}),(0,X.jsx)(Gt,{run:e}),(0,X.jsxs)(`div`,{className:`w-full`,children:[(0,X.jsx)(Hn,{run:e}),_?(0,X.jsxs)(_t,{slot:_,children:[(0,X.jsx)(Zn,{run:e}),(0,X.jsx)(Hn,{run:e,compact:!0}),T]}):(0,X.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,X.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:Vn(e.delegation)}),(0,X.jsx)(Xn,{run:e}),(0,X.jsx)(kt,{dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-md:hidden`,children:Jt(m)}),(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[E,w,(0,X.jsx)(sn,{run:e}),T]})]}),(0,X.jsx)(Gn,{shown:_!==null,run:e,archiveButton:E,previewToggle:w}),(0,X.jsx)(Kn,{run:e,tab:t,activeItem:x,inlineItemTabs:S,overflowItemTabs:ie,phoneBar:v,isDesktop:g}),s?(0,X.jsx)(tr,{runId:e.id,onClose:()=>c(!1)}):null,l?(0,X.jsx)(en,{run:e,canResume:q(e).terminal,onResume:()=>d.terminal.mutate(),onClose:()=>u(!1)}):null]}),(0,X.jsx)(er,{run:e,actions:d})]})})}function Jn(e,t){let n=ee(),r=ct(),[i,a]=(0,Y.useState)(null),o=()=>n.invalidateQueries({queryKey:de.runs.all}),s=e=>O(e.message,{tone:`danger`}),c=E(),l={isPending:c.isPending,mutate:()=>c.mutate({id:e.id,pinned:!e.pinned})},u=w();return{pin:l,markUnread:{isPending:u.isPending,mutate:()=>{t?.(),u.mutate(e.id,{onError:s})}},delete:C({mutationFn:()=>y(e.id),onSuccess:()=>{o(),r(`/`)},onError:s}),terminal:Zt(e),confirming:i,setConfirming:a}}function Yn(e){let t=S(e.id),n=D(e);return{title:n,editor:Dt(n,e=>t.mutate({title:e},{onError:e=>O(e.message,{tone:`danger`})}))}}function Xn({run:e}){let{title:t,editor:n}=Yn(e);return n.editing?(0,X.jsx)(St,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,X.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(Et,{className:`size-3.5`,"aria-hidden":`true`})})]})}function Zn({run:e}){let{title:t,editor:n}=Yn(e);return(0,X.jsxs)(Oe,{open:n.editing,onOpenChange:e=>{e?n.begin():n.commit()},children:[(0,X.jsx)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-px`,children:(0,X.jsx)(`h1`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,title:e.task,children:t})}),(0,X.jsx)(Ee,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,className:`flex size-11 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(Et,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(xe,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),n.cancel()},children:(0,X.jsx)(St,{editor:n,className:`text-[16px] font-semibold`})})]})}function Qn({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=q(e),o=K(e),s=S(e.id),c=(0,Y.useId)();return(0,X.jsxs)(R,{children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(a,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,X.jsx)(Me,{"aria-hidden":`true`})})}),(0,X.jsxs)(L,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,X.jsx)(M,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),(0,X.jsxs)(N,{onSelect:n,children:[(0,X.jsx)(wt,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,X.jsx)(en,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),o?(0,X.jsxs)(N,{onSelect:()=>void Q(o,`Command copied to clipboard.`),children:[(0,X.jsx)(k,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,X.jsxs)(N,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,X.jsx)(Rt,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,X.jsxs)(F,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,X.jsx)(zt,{"aria-hidden":`true`}):(0,X.jsx)(Ne,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,X.jsx)(P,{}),(0,X.jsx)(M,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,X.jsx)(F,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:s.isPending,onCheckedChange:e=>s.mutate({archiveWhenDone:e},{onError:e=>O(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,X.jsx)(F,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:s.isPending,"aria-describedby":c,onCheckedChange:e=>s.mutate({autoMergePr:e},{onError:e=>O(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,X.jsx)(`p`,{id:c,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block:0.5rem]`,children:`After Done, auto-merge can mark a draft PR ready. It waits for current-head CI and GitHub rules. Merge comes before archive.`}),e.delegation?.role===`worker`?null:(0,X.jsx)($n,{run:e,patch:s}),i.deleteRun?(0,X.jsx)(P,{}):null,i.deleteRun?(0,X.jsxs)(N,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,X.jsx)(Ue,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})}function $n({run:e,patch:t}){let r=(0,Y.useId)(),i=(0,Y.useId)(),a=(0,Y.useId)(),o=e=>O(e.message,{tone:`danger`});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(P,{}),(0,X.jsx)(M,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,X.jsxs)(F,{"data-slot":`allow-workers`,className:`min-h-11`,checked:g(e),disabled:t.isPending,"aria-describedby":`${r} ${a}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:o}),children:[`Allow `,n(`cezar`),` workers`]}),(0,X.jsxs)(`p`,{id:r,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:[`Agents in this task can start `,n(`Cezar`),` workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`]}),(0,X.jsx)(F,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:f(e),disabled:t.isPending,"aria-describedby":`${i} ${a}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:o}),children:`Allow task messaging`}),(0,X.jsx)(`p`,{id:i,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can message other tasks in this project.`}),(0,X.jsx)(`p`,{id:a,"data-slot":`task-access-session-note`,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Turning one off applies at once. Turning one on reaches a running agent at its next session.`})]})}function er({run:e,actions:t}){let n=t.confirming;return(0,X.jsx)(tt,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,X.jsxs)(V,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(et,{children:[(0,X.jsx)(B,{className:`text-danger`,children:`Delete task permanently?`}),(0,X.jsx)(z,{children:(0,X.jsxs)(X.Fragment,{children:[`Delete “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:D(e),children:D(e)}),`” and its transcript, worktree and branch. This cannot be undone.`]})})]}),(0,X.jsxs)(U,{children:[(0,X.jsx)($e,{children:`Cancel`}),(0,X.jsx)(H,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function tr({runId:e,onClose:t}){let n=he(e);return(0,X.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,X.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,X.jsx)(Be,{})})]}),n.isPending?(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,X.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,X.jsx)(ln,{runId:e,children:(0,X.jsx)(mt,{children:n.data})}):(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,X.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,X.jsx)(a,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Q(n.data??``,`Notes copied`),children:`Copy notes`}),(0,X.jsx)(a,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{qt as _,kn as a,hn as c,ln as d,tn as f,Xt as g,Zt as h,Tn as i,pn as l,$t as m,An as n,wn as o,nn as p,_n as r,gn as s,qn as t,dn as u,Z as v};
|