@wjarka/cezarion 0.18.0-dev.7420 → 0.18.0-dev.7428
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-CQKAazEg.js +2 -0
- package/web/dist/assets/{activity-route-BbwWWjLu.js → activity-route-C6oKznjI.js} +1 -1
- package/web/dist/assets/{agent-accounts-DuPt97Nw.js → agent-accounts-T6Q6vL9r.js} +1 -1
- package/web/dist/assets/attention-KYhxOgNq.js +1 -0
- package/web/dist/assets/{commit-diff-panel-Bnvq61J-.js → commit-diff-panel-DUeb6EUF.js} +1 -1
- package/web/dist/assets/{diff-B8GNyr9F.js → diff-DVALb2F0.js} +2 -2
- package/web/dist/assets/{diff-view-tvmfpdwD.js → diff-view-DxV_tLUt.js} +1 -1
- package/web/dist/assets/{file-preview-DyJ7pa7M.js → file-preview-BFS1UwXr.js} +1 -1
- package/web/dist/assets/{git-toolbar-BEwf9FAg.js → git-toolbar-C89FoROy.js} +1 -1
- package/web/dist/assets/{github-065AS6rF.js → github-B4Meld9S.js} +1 -1
- package/web/dist/assets/{global-activity-route-BTzn2tW0.js → global-activity-route-CuU0bmKz.js} +1 -1
- package/web/dist/assets/{index-B1a7IUEx.js → index-Cwfi9cG9.js} +9 -9
- package/web/dist/assets/{markdown-WEuLU4Vx.js → markdown-DuVt8jbQ.js} +1 -1
- package/web/dist/assets/{picker-pill-S8ZHSbEz.js → picker-pill-CwbEYCjL.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-8L_L03y-.js → preview-pane-connected-CSwZ6Xl5.js} +2 -2
- package/web/dist/assets/{project-router-DghsITyi.js → project-router-B73juPC3.js} +1 -1
- package/web/dist/assets/project-scope-context-B2P3zXB1.js +4 -0
- package/web/dist/assets/{prompt-template-menu-CWB1yVtQ.js → prompt-template-menu-nShN9uXQ.js} +1 -1
- package/web/dist/assets/queries-B6a1W2sa.js +1 -0
- package/web/dist/assets/{reference-chip-BPDNXClC.js → reference-chip-yXXzlbts.js} +1 -1
- package/web/dist/assets/{repo-git-C8f2sO_m.js → repo-git-CDOCx8X4.js} +1 -1
- package/web/dist/assets/{report-reader-DfsQnNMV.js → report-reader-CgYcjz5W.js} +1 -1
- package/web/dist/assets/reports-nt1YPqOJ.js +1 -0
- package/web/dist/assets/run-header-DaqWXi5W.js +2 -0
- package/web/dist/assets/{skills-B06yAjnR.js → skills-D45ND2YB.js} +1 -1
- package/web/dist/assets/{tab-link-CJVHsPcP.js → tab-link-BwGcrAfg.js} +1 -1
- package/web/dist/assets/{task-changes-DwKiWfHR.js → task-changes-NPbEK_pM.js} +1 -1
- package/web/dist/assets/{task-commits-DDh8b5KF.js → task-commits-D_YFcFld.js} +1 -1
- package/web/dist/assets/{task-files--h7-YLZ5.js → task-files-eHbJ4ftX.js} +1 -1
- package/web/dist/assets/{task-github-item-Djf7nc-_.js → task-github-item-D0splQvy.js} +1 -1
- package/web/dist/assets/task-thread-B_pBPheb.js +9 -0
- package/web/dist/assets/{thread-state-C0SrNkfb.js → thread-state-DFXgDkC_.js} +1 -1
- package/web/dist/assets/{use-desktop-DPqRiTb2.js → use-desktop-D3W91YLi.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-BnOqq8ll.js → use-hand-to-agent-state-CVgHwx89.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-DiYIgx71.js → useInfiniteQuery-B6Kx_mBY.js} +1 -1
- package/web/dist/assets/useQuery-D8aTqerT.js +1 -0
- package/web/dist/assets/{workflows-3Sy7hfUX.js → workflows-fidBxppB.js} +1 -1
- package/web/dist/assets/ws-Bb6iWQU5.js +1 -0
- package/web/dist/index.html +13 -13
- package/web/dist/assets/activity-motion-CFD_Hwe7.js +0 -2
- package/web/dist/assets/attention-BmEhfFZ0.js +0 -1
- package/web/dist/assets/project-scope-context-DNKOo_im.js +0 -4
- package/web/dist/assets/queries-bxk8LCaR.js +0 -1
- package/web/dist/assets/reports-DnROeG5A.js +0 -1
- package/web/dist/assets/run-header-HqBmAMyy.js +0 -2
- package/web/dist/assets/task-thread-B_Oe62EY.js +0 -9
- package/web/dist/assets/useQuery-DbMHYDKn.js +0 -1
- package/web/dist/assets/ws-C09Vt-Eu.js +0 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,F as i,M as a,O as o,j as s,k as c,l}from"./button-RJMdCnZw.js";import{A as u,B as d,C as f,D as p,E as m,F as h,G as g,H as _,I as v,J as y,K as b,L as x,M as S,N as C,O as w,P as T,R as ee,S as E,T as D,U as te,V as O,W as ne,a as re,b as k,j as A,k as ie,l as ae,n as oe,p as se,q as ce,r as le,s as ue,v as de,w as fe,x as pe,y as me,z as j}from"./live-protocol-CjfZMf1X.js";var he=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ge=new class extends he{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},_e=typeof window>`u`||`Deno`in globalThis;function ve(){}function ye(e,t){return typeof e==`function`?e(t):e}function be(e){return typeof e==`number`&&e>=0&&e!==1/0}function xe(e,t){return Math.max(e+(t||0)-Date.now(),0)}function M(e,t){return typeof e==`function`?e(t):e}function N(e,t){return typeof e==`function`?e(t):e}function Se(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==we(o,t.options))return!1}else if(!Ee(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Ce(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Te(t.options.mutationKey)!==Te(a))return!1}else if(!Ee(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function we(e,t){return(t?.queryKeyHashFn||Te)(e)}function Te(e){return JSON.stringify(e,(e,t)=>je(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Ee(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Ee(e[n],t[n])):!1}var De=Object.prototype.hasOwnProperty;function Oe(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Ae(e)&&Ae(t);if(!r&&!(je(e)&&je(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:De.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Oe(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ke(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Ae(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function je(e){if(!Me(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Me(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Me(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ne(e){return new Promise(t=>{y.setTimeout(t,e)})}function Pe(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Oe(e,t)}function Fe(e){return e}function Ie(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Le(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Re=Symbol();function ze(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Re?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Be(e,t){return typeof e==`function`?e(...t):!!e}function Ve(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var He=(()=>{let e=()=>_e;return{isServer(){return e()},setIsServer(t){e=t}}})();function Ue(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var We=new class extends he{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Ge(e){return Math.min(1e3*2**e,3e4)}function Ke(e){return(e??`online`)!==`online`||We.isOnline()}var qe=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Je(e){let t=!1,n=0,r,i=Ue(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new qe(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>ge.isFocused()&&(e.networkMode===`always`||We.isOnline())&&e.canRun(),u=()=>Ke(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(He.isServer()?0:3),o=e.retryDelay??Ge,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),Ne(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Ye=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),be(this.gcTime)&&(this.#e=y.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(He.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(y.clearTimeout(this.#e),this.#e=void 0)}};function Xe(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Ve(e,()=>t.signal,()=>n=!0)},u=ze(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Le:Ie;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Qe:Ze,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ze(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Ze(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Qe(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function $e(e,t){return t?Ze(e,t)!=null:!1}function et(e,t){return!t||!e.getPreviousPageParam?!1:Qe(e,t)!=null}var tt=class extends Ye{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=it(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=it(this.options);e.data!==void 0&&(this.setState(rt(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Pe(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(ve).catch(ve):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>N(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Re||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>M(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!xe(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ze(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Xe(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=Je({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof qe&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof qe){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...nt(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...rt(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),ce.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function nt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ke(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function rt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function it(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var at=class extends he{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Ue(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),st(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ct(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ct(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof N(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!ke(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&<(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||N(this.options.enabled,this.#t)!==N(t.enabled,this.#t)||M(this.options.staleTime,this.#t)!==M(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||N(this.options.enabled,this.#t)!==N(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return dt(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ve)),t}#g(){this.#b();let e=M(this.options.staleTime,this.#t);if(He.isServer()||this.#r.isStale||!be(e))return;let t=xe(this.#r.dataUpdatedAt,e)+1;this.#d=y.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(He.isServer()||N(this.options.enabled,this.#t)===!1||!be(this.#p)||this.#p===0)&&(this.#f=y.setInterval(()=>{(this.options.refetchIntervalInBackground||ge.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(y.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(y.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&st(e,t),o=i&<(e,n,t,r);(a||o)&&(l={...l,...nt(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=Pe(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=Pe(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:ut(e,t),refetch:this.refetch,promise:this.#o,isEnabled:N(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{let e=this.#o=x.promise=Ue();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!ke(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){ce.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function ot(e,t){return N(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&N(t.retryOnMount,e)===!1)}function st(e,t){return ot(e,t)||e.state.data!==void 0&&ct(e,t,t.refetchOnMount)}function ct(e,t,n){if(N(t.enabled,e)!==!1&&M(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&ut(e,t)}return!1}function lt(e,t,n,r){return(e!==t||N(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ut(e,n)}function ut(e,t){return N(t.enabled,e)!==!1&&e.isStaleByTime(M(t.staleTime,e))}function dt(e,t){return!ke(e.getCurrentResult(),t)}var P=e(t(),1),ft=n(),pt=P.createContext(void 0),mt=e=>{let t=P.useContext(pt);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},ht=({client:e,children:t})=>(P.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,ft.jsx)(pt.Provider,{value:e,children:t})),gt=P.createContext(!1),_t=()=>P.useContext(gt);gt.Provider;function vt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var yt=P.createContext(vt()),bt=()=>P.useContext(yt),xt=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Be(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},St=e=>{P.useEffect(()=>{e.clearReset()},[e])},Ct=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Be(n,[e.error,r])),wt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Tt=(e,t)=>e.isLoading&&e.isFetching&&!t,Et=(e,t)=>e?.suspense&&t.isPending,Dt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ot(e,t,n){let r=_t(),i=bt(),a=mt(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,wt(o),xt(o,i,s),St(i);let l=!a.getQueryCache().get(o.queryHash),[u]=P.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(P.useSyncExternalStore(P.useCallback(e=>{let t=f?u.subscribe(ce.batchCalls(e)):ve;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),P.useEffect(()=>{u.setOptions(o)},[o,u]),Et(o,d))throw Dt(o,u,i);if(Ct({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!He.isServer()&&Tt(d,r)&&(l?Dt(o,u,i):s?.promise)?.catch(ve).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}var kt={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},At;At||={};var jt=x({root:O(),branch:O(),remote:O().optional()}),F=w([`claude`,`codex`,`opencode`,`pi`,`omp`]);function Mt(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)} (removed)`}function Nt(e){return`The ${e.charAt(0).toUpperCase()+e.slice(1)} runner is no longer supported. Pick another runner to continue this task in a new session.`}var Pt=x({name:w([...F.options,`gh`,`git`]),available:A(),version:O().optional(),hint:O().optional()}),Ft=x({kind:C(`github`),available:A().optional(),reason:O().optional()}),It=x({localHandoff:A(),settingsAdmin:A(),remoteSettingsAdmin:A(),automations:A(),preview:A(),tokenMetrics:A(),tokenUsageMetrics:A(),costMetrics:A()}),Lt=x({version:O(),latestVersion:O().optional(),repoRoot:O(),repo:jt.nullable(),checks:u(Pt),defaultRunner:F,forge:Ft.nullable(),capabilities:It,projects:u(x({id:O(),name:O()})),bootProject:O()}).extend({capabilities:It.partial()}),Rt=Error(`finite cycle deadline`);async function zt(e,t,n,r){let i=(e,t)=>{for(let r of n)r.value(e,t)},a=()=>r.aborted&&r.reason!==Rt,o=await e(t,{credentials:`include`,signal:r}).catch(e=>{throw a()||i(void 0,`HTTP 0`),e});if(!o.ok){let e=await o.json().catch(()=>void 0);throw a()&&r.throwIfAborted(),i(e,`HTTP ${o.status}`),Error(`read HTTP ${o.status}`)}let s=await o.json();r.throwIfAborted();for(let e of n)e.value(s)}function Bt(e,t,n=(...e)=>fetch(...e)){let r,i,a,o=!0,s=0,c=-1/0,l=-1/0,u=new Map,d,f=e=>{let t=new Map;for(let n of e){let{kind:e,...r}=n.demand,i=`${r.projectId}/${r.runId}`;(!t.has(i)||t.get(i).afterSeq>r.afterSeq)&&t.set(i,r)}return[...t.values()]},p=async(e,t,r)=>{l=Date.now();for(let i=0;i<e.length;i+=32){let a=e.slice(i,i+32),o=await n(`/api/v1/workspace/run-event-batches`,{method:`POST`,credentials:`include`,signal:t,headers:{"content-type":`application/json`},body:JSON.stringify({runs:f(a)})});if(!o.ok)throw Error(`task batch HTTP ${o.status}`);let s=ae.parse(await o.json());t.throwIfAborted();let c=d!==void 0&&d!==s.generation;if(d=s.generation,c){await Promise.all(a.map(e=>e.reset(`server restarted`,t)));continue}for(let e of s.results)for(let n of a){let i=n.demand;if(!(e.runId!==i.runId||e.projectId!==i.projectId)){if(e.type!==`batch`){await n.reset(e.error,t),t.throwIfAborted();continue}for(let t of e.events)t.seq>i.afterSeq&&(n.frame({type:`event`,projectId:i.projectId,runId:i.runId,name:t.type.includes(`.`)?`ui-event`:`run-event`,event:t}),i.afterSeq=t.seq);i.cursor=e.cursor,i.afterSeq=Math.max(i.afterSeq,e.afterSeq),r.drain||=e.hasMore}}}},m=t=>{t&&(l=-1/0);let n=e().flatMap(e=>e.demand.kind===`run`?[l+2e3]:e.demand.kind===`workspace`?[c+5e3]:e.demand.kind===`read`?[(u.get(e.demand.path)??Date.now())+e.demand.intervalMs]:[]);n.length&&(i=setTimeout(()=>{i=void 0,h()},s?Math.min(3e4,1e3*2**s):t?50:Math.max(50,Math.min(...n)-Date.now())+(e().some(e=>e.demand.kind===`run`)?Math.random()*100:0)))},h=async()=>{if(o||r)return;r=new AbortController;let i=r;a=setTimeout(()=>i.abort(Rt),1e4);let d={drain:!1};try{let r=e(),a=new Set(r.flatMap(e=>e.demand.kind===`read`?[e.demand.path]:[]));for(let e of u.keys())a.has(e)||u.delete(e);let o=r.filter(e=>e.demand.kind===`run`);o.length&&Date.now()-l>=2e3&&await p(o,i.signal,d),r.some(e=>e.demand.kind===`workspace`)&&Date.now()-c>=5e3&&(c=Date.now(),await t(i.signal));for(let e of r){if(e.demand.kind!==`read`)continue;let{path:t,intervalMs:a}=e.demand;if(!u.has(t)){u.set(t,Date.now());continue}Date.now()-u.get(t)<a||(u.set(t,Date.now()),await zt(n,t,r.filter(e=>e.demand.kind===`read`&&e.demand.path===t),i.signal))}s=0}catch{o||(s=Math.min(s+1,5))}finally{clearTimeout(a),a=void 0,r===i&&(r=void 0),!o&&e().length&&m(d.drain)}};return{start(e=!1){if(!o){r||(clearTimeout(i),i=void 0,h());return}o=!1,c=e?Date.now():-1/0,l=-1/0,h()},refresh(){c=l=-1/0;for(let e of u.keys())u.set(e,-1/0);!r&&!o&&(clearTimeout(i),i=void 0,h())},stop(){o=!0,u.clear(),clearTimeout(i),i=void 0,clearTimeout(a),a=void 0,r?.abort()}}}var Vt=!1,Ht=new Set,Ut=()=>typeof document<`u`&&document.visibilityState===`visible`&&!Vt,Wt=()=>{let e=Ut();for(let t of[...Ht])t(e)},Gt=()=>{Vt=!0,Wt()},Kt=()=>{Vt=!1,Wt()};function qt(e){return Ht.size===0&&typeof window<`u`&&(Vt=!1,document.addEventListener(`visibilitychange`,Wt),document.addEventListener(`freeze`,Gt),document.addEventListener(`resume`,Kt),window.addEventListener(`pagehide`,Gt),window.addEventListener(`pageshow`,Kt)),Ht.add(e),()=>{Ht.delete(e),!Ht.size&&typeof window<`u`&&(document.removeEventListener(`visibilitychange`,Wt),document.removeEventListener(`freeze`,Gt),document.removeEventListener(`resume`,Kt),window.removeEventListener(`pagehide`,Gt),window.removeEventListener(`pageshow`,Kt))}}function Jt(){return(0,P.useSyncExternalStore)(qt,Ut,()=>!1)}var Yt=new Set;function Xt(e){return Yt.add(e),()=>{Yt.delete(e)}}async function Zt(e,t=!1){e.throwIfAborted(),await Qt(Promise.all([...Yt].map(async n=>n(e,t))),e)}function Qt(e,t){return new Promise((n,r)=>{let i=()=>r(t.reason);t.addEventListener(`abort`,i,{once:!0}),t.aborted&&i(),e.then(n,r).finally(()=>t.removeEventListener(`abort`,i))})}function $t(e,t){let n=new URL(e.apiBase||`/`,location.href);return!e.local||n.origin!==location.origin||n.pathname!==`/`||t||typeof SharedWorker!=`function`}function en(){return new URL(`/live-worker.js`,location.href)}function tn(e){for(let t of e)t.handlers.ready?.()}function nn(){let e=new Map,t=globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random()}`,n,r,i,a,o=0,s=0,c=0,l=!1,u=!1,d=!1,f,p,m=0,h,g=new Set,_=e=>{h!==e&&(h=e,queueMicrotask(()=>{for(let e of[...g])e()}))},v=()=>[...e.values()].filter(e=>!e.recovering&&!e.released),y,b=()=>{y?.abort();let e=y=new AbortController,t=setTimeout(()=>e.abort(),1e4);Zt(e.signal).catch(()=>{}).finally(()=>clearTimeout(t))},x=Bt(v,e=>Zt(e,!0),(e,t)=>fetch(`${n?.apiBase??``}${String(e)}`,t)),S=e=>e.kind===`run`&&e.projectId==="default"&&n?{...e,projectId:n.bootProject}:e,C=e=>{if(r)try{r.port.postMessage({version:3,documentId:t,epoch:o,...e})}catch{E()}},w=!1,T=()=>{if(!l||f)return;let e=v().map(e=>({id:e.id,demand:e.demand}));if(!e.length){ee();return}C({type:`sync`,entries:e,...w?{workspaceReady:!0}:{}})},ee=()=>{if(clearInterval(i),i=void 0,r){let e=r;r=void 0;try{e.port.postMessage({type:`sync`,version:3,documentId:t,epoch:++o,entries:[]})}catch{}e.port.onmessage=null,e.port.onmessageerror=null,e.port.close()}};function E(){if(!(!l||d)){u=!0,ee(),_(`finite`);for(let e of v())e.handlers.ready?.();x.start(),b()}}let D=async(e,t,n)=>{if(e.recovering||e.released)return;let r=new AbortController,i=()=>r.abort(n?.reason);n?.addEventListener(`abort`,i,{once:!0}),n?.aborted&&i();let a=setTimeout(()=>r.abort(),1e4);e.recovery=r,e.recovering=!0,++o,T();try{let n=await Qt(Promise.resolve(e.handlers.reset?.(t,r.signal)),r.signal);if(r.signal.throwIfAborted(),e.released||!l)return;n&&e.demand.kind===`run`&&Object.assign(e.demand,n)}catch(e){if(n)throw e;l&&!f&&E()}finally{clearTimeout(a),n?.removeEventListener(`abort`,i),e.recovery=void 0,e.recovering=!1,!e.released&&l&&!n&&(++o,te())}},te=(t=!1)=>{if(!(d||f||!n||!e.size||!Ut())){if(l=!0,$t(n,u)){_(`finite`),tn(v()),x.start(t);return}if(r){_(`topics`),tn(v()),T();return}try{let t=new SharedWorker(en(),{type:`module`,name:oe});r=t,c=Date.now(),_(`topics`),t.addEventListener(`error`,()=>{r===t&&E()}),t.port.onmessageerror=()=>{r===t&&E()},t.port.onmessage=({data:n})=>{if(r!==t||!l)return;let i=ue.safeParse(n);if(!i.success){E();return}let a=i.data;if(a.type===`hello`){c=Date.now(),T();return}if(a.epoch!==o||(c=Date.now(),a.type===`alive`))return;if(a.type===`unavailable`){E();return}let s=e.get(a.id);if(!(!s||s.recovering)){if(a.type===`reset`){if(a.reason===`shared task capacity reached`)E();else if(a.reason===`server restarted`)for(let e of v())D(e,a.reason);else D(s,a.reason);return}if(a.type===`value`){s.handlers.value?.(a.value,a.error);return}s.frame(a.frame)}},t.port.start(),tn(v()),T(),i=setInterval(()=>{if(Date.now()-c>=15e3){E();return}T()},le)}catch{E()}}},O=()=>{l=!1,ee(),x.stop(),y?.abort(),f?.abort(),f=void 0,clearTimeout(p),p=void 0;for(let t of e.values())t.recovery?.abort()},ne=t=>{if(!t){O();return}if(l||d||!n||!e.size)return;u=!1,l=!0;let r=f=new AbortController,i=setTimeout(()=>r.abort(),1e4);(async()=>{let t=await fetch(`${n.apiBase}/api/v1/health`,{credentials:`include`,signal:r.signal,cache:`no-store`});if(!t.ok)throw Error(`bootstrap HTTP ${t.status}`);let i=Lt.pick({capabilities:!0,bootProject:!0}).parse(await t.json());r.signal.throwIfAborted(),n={...n,local:i.capabilities.localHandoff===!0,bootProject:i.bootProject};for(let t of e.values())t.bootAlias&&t.demand.kind===`run`&&(t.demand.projectId=i.bootProject);await Zt(r.signal),await Promise.all(v().filter(e=>e.demand.kind===`run`).map(e=>D(e,`document resumed`,r.signal))),r.signal.throwIfAborted(),f===r&&(f=void 0,m=0,te(!0))})().catch(()=>{f!==r||d||!Ut()||(l=!1,m=Math.min(m+1,5),p=setTimeout(()=>{p=void 0,ne(!0)},Math.min(3e4,1e3*2**m)))}).finally(()=>clearTimeout(i))},k=()=>{Ut()&&(O(),ne(!0))},A=()=>{a||typeof window>`u`||(a=qt(ne),window.addEventListener(`online`,k))};return{resetSession(){O(),n=void 0,u=!1,w=!1,_(void 0)},requestWorkspaceReady(){return!r||h!==`topics`?!1:(w=!0,T(),!0)},workspaceReadyReceived(){w=!1},transport:()=>h,onTransport(e){return g.add(e),()=>{g.delete(e)}},bootProject:()=>n?.bootProject,configure(t){if(!f&&!(n&&n.local===t.local&&n.apiBase===t.apiBase&&n.bootProject===t.bootProject)){O(),n=t,u=!1;for(let n of e.values())n.bootAlias&&n.demand.kind===`run`&&(n.demand.projectId=t.bootProject);++o,te()}},subscribe(t,n){let r=S(re.parse(t)),i=String(++s),c={id:i,demand:r,handlers:n,bootAlias:t.kind===`run`&&t.projectId==="default",recovering:!1,released:!1,frame(e){if(!(c.released||c.recovering||!l||f))if(`type`in e&&e.type===`event`&&c.demand.kind===`run`){if(e.projectId!==c.demand.projectId||e.runId!==c.demand.runId||e.event.seq<=c.demand.afterSeq)return;n.frame?.(e),c.demand.afterSeq=e.event.seq,C({type:`ack`,id:i,seq:e.event.seq})}else`type`in e&&(e.type===`reset`||e.type===`error`)?D(c,e.error):n.frame?.(e)},value:(e,t)=>{!c.released&&l&&!f&&n.value?.(e,t)},reset:(e,t)=>D(c,e,t)};return e.set(i,c),++o,A(),te(),()=>{if(!c.released){if(c.released=!0,c.recovery?.abort(),e.delete(i),++o,e.size){T();return}O(),a?.(),a=void 0,window.removeEventListener(`online`,k)}}},invalidateReads(){for(let e of v())e.demand.kind===`read`&&C({type:`refresh`,id:e.id});x.refresh()},dispose(){d=!0,O(),e.clear(),a?.(),a=void 0,typeof window<`u`&&window.removeEventListener(`online`,k)}}}var I=nn(),rn=I.configure,an=I.subscribe,on=I.invalidateReads,sn=I.bootProject,cn=I.transport,ln=I.onTransport,un=I.resetSession,dn=I.requestWorkspaceReady,fn=I.workspaceReadyReceived,pn=F.options,mn=new Set([`connected`,`disconnected`,`not-installed`,`unknown`]);function hn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function gn(e,t){return typeof e==`boolean`||!t&&e===void 0}function _n(e,t){return e===void 0||typeof e==`string`&&e.length>=1&&e.length<=128&&t===`disconnected`}function vn(e,t,n,r,i,a){return typeof e==`string`&&pn.includes(e)&&typeof t==`string`&&mn.has(t)&&gn(n,a)&&(r===void 0||typeof r==`string`)&&_n(i,t)}function yn(e,t){if(!hn(e))return null;let{provider:n,status:r,enabled:i,hint:a,authFailureId:o}=e;return vn(n,r,i,a,o,t)?{provider:n,status:r,...typeof i==`boolean`?{enabled:i}:{},...typeof a==`string`?{hint:a}:{},...typeof o==`string`?{authFailureId:o}:{}}:null}function bn(e){return yn(e,!1)}function xn(e,t){if(!hn(e)||!Array.isArray(e.providers))return null;let n=[],r=new Set;for(let i of e.providers){let e=yn(i,t);if(e===null||r.has(e.provider))return null;r.add(e.provider),n.push(e)}return n}function L(e){let t=xn(e,!0);if(t===null||t.length===0)return null;let n=new Map(t.map(e=>[e.provider,e]));return pn.flatMap(e=>{let t=n.get(e);return t?[t]:[]})}function Sn(e){let t=L(e);if(t===null)throw Error(`Invalid provider status response`);return{providers:t}}function Cn(e,t){let n=L(e);if(n!==null)return{providers:n.map(e=>e.provider===t.provider?{provider:t.provider,status:t.status,enabled:t.enabled??e.enabled,...t.hint===void 0?{}:{hint:t.hint},...t.authFailureId===void 0?{}:{authFailureId:t.authFailureId}}:e)}}function wn(e,t,n,r){let i=L(e),a=L(t),o=L(n);if(o===null||a===null)return n;if(i===null)return{providers:a};let s=new Map(i.map(e=>[e.provider,e])),c=new Map(a.map(e=>[e.provider,e]));return{providers:o.map(e=>{let t=s.get(e.provider),n=c.get(e.provider);if(t===void 0||n===void 0)return n??e;let i=r!==void 0&&n.authFailureId===r&&e.authFailureId===void 0;return r!==void 0&&n.authFailureId!==void 0&&n.authFailureId!==r&&e.authFailureId===void 0?n:Tn(t,n)?e:i?{...e,enabled:n.enabled}:n})}}function Tn(e,t){return e.provider===t.provider&&e.status===t.status&&e.enabled===t.enabled&&e.hint===t.hint&&e.authFailureId===t.authFailureId}function En(e){let t=L(e);if(t===null)return[];let n=new Set(t.filter(e=>e.enabled&&e.status===`connected`).map(e=>e.provider));return pn.filter(e=>n.has(e))}function Dn(e,t){return L(e)?.find(e=>e.provider===t)}var On=w([`low`,`medium`,`high`,`xhigh`,`max`]),kn=O().max(32).optional(),R=w([`queued`,`running`,`waiting`,`review`,`done`,`failed`,`cancelled`]),An=w([`pending`,`running`,`waiting`,`review`,`done`,`failed`,`cancelled`,`skipped`]),jn=w([`agent`,`check`]);function Mn(){return x({claude:O().optional(),codex:O().optional(),opencode:O().optional(),pi:O().optional(),omp:O().optional()})}x({browseRoot:O(),projectsDir:O(),archiveOnMerge:A().nullable(),effectiveArchiveOnMerge:A(),archiveOnMergeSource:w([`global`,`environment`,`default`]),composerDefaults:x({autonomous:A().nullable(),worktree:A().nullable(),inheritedAutonomous:_([A(),C(`source-dependent`)]),inheritedWorktree:A()}),resources:x({maxParallel:v(),maxMonitoringSessions:v(),monitoringWakeIntervalMinutes:v().nullable(),autoResumeOnUsageLimit:A(),memoryLimitMb:v().nullable(),worktreeRetentionDefault:v()}),agentDefaults:x({runner:F.optional(),models:Mn().optional()})}),x({browseRoot:O().trim().min(1).max(4096).optional(),projectsDir:O().trim().min(1).max(4096).optional(),archiveOnMerge:A().nullable().optional(),composerDefaults:x({autonomous:A().nullable().optional(),worktree:A().nullable().optional()}).optional(),agentDefaults:x({runner:F.nullable().optional(),models:x({claude:O().trim().min(1).max(200).nullable().optional(),codex:O().trim().min(1).max(200).nullable().optional(),opencode:O().trim().min(1).max(200).nullable().optional(),pi:O().trim().min(1).max(200).nullable().optional(),omp:O().trim().min(1).max(200).nullable().optional()}).optional()}).optional(),resources:x({maxParallel:v().int().min(1).max(16).optional(),maxMonitoringSessions:v().int().min(0).max(16).optional(),monitoringWakeIntervalMinutes:v().int().min(1).max(60).nullable().optional(),autoResumeOnUsageLimit:A().optional(),memoryLimitMb:v().int().min(0).max(1048576).nullable().optional(),worktreeRetentionDefault:v().int().min(0).max(1e3).optional()}).optional()});var Nn=x({accent:w([`cezarion`,`lime`,`violet`]).optional(),density:w([`comfortable`,`compact`,`ultra`]).optional(),width:w([`narrow`,`wide`]).optional()}),Pn=T({expandedColumns:j(O(),A()).optional()}),Fn=x({overall:v().int().positive().nullable().optional(),needsYou:v().int().positive().nullable().optional(),finished:v().int().positive().nullable().optional(),working:v().int().positive().nullable().optional()});function In(e){let t={overall:10,needsYou:null,finished:null,working:null},n=typeof e==`object`&&e&&!Array.isArray(e)?e:{};for(let e of Object.keys(t)){let r=Fn.shape[e].safeParse(n[e]);r.success&&r.data!==void 0&&(t[e]=r.data)}return t}T({sidebarLimits:Fn.optional(),lastTask:x({source:w([`workflow`,`skill`]),ref:O()}).nullable().optional(),recentSources:u(x({source:w([`workflow`,`skill`]),ref:O()})).optional(),lastWorktree:A().optional(),lastAutonomous:A().optional(),skillUsage:j(O(),v()).optional(),runsView:w([`list`,`table`]).optional(),githubView:w([`issues`,`prs`]).optional(),appearance:Nn.optional(),promptTemplates:u(x({id:O(),label:O(),text:O(),skills:u(O()).optional()})).optional()});var Ln=d({projectId:O().min(1).max(64),pathname:O().min(1).max(2048).startsWith(`/p/`),search:O().max(4096).startsWith(`?`).optional(),hash:O().max(2048).startsWith(`#`).optional()}),Rn=T({sidebar:T({collapsed:j(O(),A()).optional(),projectOrder:u(O()).optional()}).optional(),dismissedProviderAuthFailures:Mn().optional(),appearance:Nn.optional(),notifications:T({enabled:A().optional()}).optional(),taskTable:Pn.optional(),lastLocation:Ln.optional()}),zn=200,Bn=50;T({...Rn.shape,sidebar:T({collapsed:j(O().min(1).max(64),A()).refine(e=>Object.keys(e).length<=zn,{message:`sidebar.collapsed must have at most ${zn} entries`}).optional(),projectOrder:u(O().min(1).max(64)).max(zn).optional()}).optional(),dismissedProviderAuthFailures:d({claude:O().min(1).max(128).optional(),codex:O().min(1).max(128).optional(),opencode:O().min(1).max(128).optional(),pi:O().min(1).max(128).optional(),cursor:O().min(1).max(128).optional(),omp:O().min(1).max(128).optional()}).optional(),taskTable:Pn.extend({expandedColumns:j(O().min(1).max(64),A()).refine(e=>Object.keys(e).length<=Bn,{message:`taskTable.expandedColumns must have at most ${Bn} entries`}).optional()}).optional()}).superRefine((e,t)=>{Object.keys(e).length>zn&&t.addIssue({code:`custom`,message:`ui-state has too many keys (max ${zn})`})});var Vn=Mn(),Hn=4e3,Un=7200,Wn=x({commands:u(O().trim().min(1).max(Hn)).max(20),timeoutSeconds:v().int().min(1).max(Un).optional()}).strict();x({archiveOnMerge:A().nullable(),effectiveArchiveOnMerge:A(),archiveOnMergeSource:w([`project`,`global`,`environment`,`default`]),baseBranch:O().nullable(),defaultRunner:F,systemPrompt:O().nullable(),defaultModels:Vn,modelsLocked:A(),maxParallel:v(),memoryLimitMb:v().nullable(),worktreeRetention:v(),liveTitleUpdates:A().nullable(),reviewGate:A().nullable(),worktreeSetup:x({commands:u(O()),timeoutSeconds:v()}).nullable(),worktreeSetupIssue:O().nullable(),worktreeTeardown:x({commands:u(O()),timeoutSeconds:v()}).nullable(),worktreeTeardownIssue:O().nullable()}),x({archiveOnMerge:A().nullable().optional(),baseBranch:O().trim().min(1).max(200).nullable().optional(),defaultRunner:F.optional(),systemPrompt:O().trim().max(2e4).nullable().optional(),defaultModels:x({claude:O().trim().max(200).nullable().optional(),codex:O().trim().max(200).nullable().optional(),opencode:O().trim().max(200).nullable().optional(),pi:O().trim().max(200).nullable().optional(),omp:O().trim().max(200).nullable().optional()}).optional(),maxParallel:v().int().min(1).max(16).optional(),memoryLimitMb:v().int().min(0).max(1048576).nullable().optional(),worktreeRetention:v().int().min(0).max(1e3).nullable().optional(),liveTitleUpdates:A().nullable().optional(),reviewGate:A().nullable().optional(),worktreeSetup:Wn.nullable().optional(),worktreeTeardown:Wn.nullable().optional()});var Gn=F,Kn=x({provider:Gn,status:w([`connected`,`disconnected`,`not-installed`,`unknown`]),enabled:A().optional(),hint:O().optional(),authFailureId:O().optional(),profileId:O().optional()});x({providers:u(Kn)}),S(`opened`,[x({opened:C(!0),command:O()}),x({opened:C(!1),connected:C(!0),command:O()})]);var qn=F,Jn=qn.options;function Yn(e){return Jn.includes(e)}var Xn=x({id:O(),label:O(),description:O(),effortLevels:u(On).optional()});x({runner:F,models:u(Xn),source:w([`live`,`cache`,`unavailable`]),stale:A(),reason:O().optional()});var Zn=x({runner:qn,requestedModel:O(),availableModels:u(Xn),otherRunners:u(qn)});x({targets:u(x({id:O(),label:O(),icon:O().optional()}))}),x({target:O().trim().min(1,`target required`).max(200)}),x({opened:C(!0),path:O()});var Qn=w([`spawn`,`inspect`,`steer`,`stop`,`destroy`,`diff`,`wait`]),z=O().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),$n=O().regex(/^[0-9a-f]{64}$/),B=u(g()).min(1).max(32).refine(e=>new Set(e).size===e.length),er=u(Qn).max(7).refine(e=>new Set(e).size===e.length),tr=u(w([`process`,`worktree`,`branch`])).max(3).refine(e=>new Set(e).size===e.length),nr=O().max(2e3),rr=x({ownerRunId:g(),resourceId:g(),kind:C(`owned-isolated`),path:O().min(1),branch:O().min(1),baselineSha:z}).strict(),ir=x({ownerRunId:g(),resourceId:g(),kind:C(`shared`),path:O().min(1),hostRunId:g(),baselineSha:z}).strict(),ar=S(`kind`,[rr,ir]),or={"owned-isolated":!0,shared:!1};function sr(e){return or[e.kind]}var cr=d({kinds:u(w([`owned-isolated`,`shared`])).max(2).refine(e=>new Set(e).size===e.length),live:v().int().min(0).max(32),get children(){return cr.optional()}}),V=x({id:g(),workerIds:u(g()).max(32).refine(e=>new Set(e).size===e.length),requestIds:u(g()).min(1).max(32).optional(),requestOutcomes:u(fe).max(32).optional(),deadline:b(),mode:pe.optional(),revisions:u(x({workerId:g(),revision:v().int().nonnegative()}).strict()).max(32).optional(),reason:w([`outcome`,`timeout`,`cancelled`,`message`]).optional(),phase:w([`registered`,`parked`,`wake-pending`]),outcomes:u(k).max(32),wakeId:g().optional()}).strict(),lr=V.omit({deadline:!0,requestIds:!0,requestOutcomes:!0}).extend({via:C(`completion`)}).strict(),ur=x({attempts:v().int().positive(),nextAt:b(),needsAttention:C(!0).optional()}).strict(),dr=x({requestedAt:b(),phase:w([`requested`,`terminating`,`cleaning`,`complete`,`incomplete`]),remaining:tr,error:nr.optional()}).strict(),fr=dr.extend({retry:ur.optional()}).strict(),pr=x({requestId:g(),workerId:g(),requestHash:$n,supervisorRunId:g().optional(),deletion:x({phase:w([`pending`,`complete`]),revision:v().int().nonnegative(),resourceId:g(),generation:g()}).strict().optional()}).strict(),mr=w(F.options),hr=O().min(1).max(4096).refine(e=>!/[\\\u0000-\u001f\u007f:]/.test(e)&&!e.startsWith(`/`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e.toLowerCase()!==`.git`));function gr(e){return e.split(`/`).at(-1)?.toLowerCase()===`.gitignore`?`--attach cannot attach a .gitignore: ${e}; ignore rules must come from the baseline`:void 0}var _r=S(`kind`,[x({kind:C(`baseline-file`),path:hr}).strict(),x({kind:C(`parent-attachment`),id:O().min(1).max(255).regex(/^[A-Za-z0-9_-][A-Za-z0-9._-]*$/).refine(e=>!e.includes(`..`))}).strict(),x({kind:C(`parent-file`),path:hr}).strict().superRefine(({path:e},t)=>{let n=gr(e);n&&t.addIssue({code:`custom`,path:[`path`],message:n})})]),vr=x({text:O().max(1e5).optional(),artifacts:u(_r).max(32).optional()}).strict().superRefine(({artifacts:e=[]},t)=>{let n=new Set;for(let[r,i]of e.entries())i.kind===`parent-file`&&(n.has(i.path)&&t.addIssue({code:kt.custom,path:[`artifacts`,r,`path`],message:`duplicate --attach path: ${i.path}`}),n.add(i.path))}),yr=x({source:_r,path:O().min(1).max(8192),sha256:$n,bytes:v().int().min(0).max(2**53-1)}).strict(),br=x({text:O().max(1e5).optional(),inputs:u(yr).max(32)}).strict(),xr=x({state:C(`unavailable`),reason:w([`no-assistant-output`,`missing`,`unreadable`,`unverified`,`unsupported`]),detail:nr.optional()}).strict(),Sr=x({state:C(`deleted`),reason:C(`missing`)}).strict(),Cr=w([`running`,`review-ready`,`completed`,`failed`,`cancelled`]),wr=S(`state`,[x({state:C(`available`),id:O().max(255),path:O().max(8192)}).strict(),xr.extend({id:O().max(255),path:O().max(8192)}),Sr.extend({id:O().max(255),path:O().max(8192)})]),Tr=w([`available`,`unavailable`,`deleted`]),Er=S(`state`,[x({state:C(`unchanged`)}).strict(),x({state:C(`changed`),paths:u(O().max(8192)).max(100),truncated:A(),headMoved:A(),branchMoved:A(),indexMoved:A()}).strict(),x({state:C(`unavailable`),reason:nr}).strict()]);x({result:x({workerId:g(),parentRunId:g(),revision:v().int().nonnegative(),observedAt:b(),status:R,outcome:w([`running`,`review-ready`,`completed`,`failed`,`cancelled`,`destroyed`]),lastExecutionOutcome:Cr,partial:A(),settled:A(),error:nr.optional(),backend:mr.optional(),model:O().max(512).optional(),baselineSha:z,workspace:S(`kind`,[rr.extend({state:Tr.optional()}),ir.extend({state:Tr.optional()})]),cleanup:w([`retained`,`requested`,`terminating`,`cleaning`,`complete`,`incomplete`]),summary:S(`state`,[x({state:C(`available`),text:O().min(1).max(4e3),source:w([`assistant`,`failure`]),seq:v().int().nonnegative(),truncated:A()}).strict(),xr,Sr]),head:S(`state`,[x({state:C(`available`),sha:z}).strict(),xr.extend({sha:z.optional()}),Sr.extend({sha:z.optional()})]),diff:S(`state`,[x({state:C(`available`),snapshotId:g(),path:O().min(1).max(8192),truncated:A()}).strict(),xr,Sr]),changes:Er.optional(),artifacts:S(`state`,[x({state:C(`available`),items:u(wr).max(32),truncated:A()}).strict(),xr,Sr])}).strict(),diffSnapshot:O().max(4e5).optional()}).strict();var Dr=x({workerId:g(),revision:v().int().nonnegative(),snapshotId:g(),observedAt:b(),lastExecutionOutcome:Cr,previous:x({revision:v().int().nonnegative(),observedAt:b(),lastExecutionOutcome:Cr}).strict().optional()}).strict(),Or=S(`role`,[x({role:C(`root`),conversation:f.optional(),permissions:er,spawnGrant:cr.optional(),receipts:u(pr).max(1024).refine(e=>new Set(e.map(e=>`${e.supervisorRunId??``} ${e.requestId}`)).size===e.length&&new Set(e.map(e=>e.workerId)).size===e.length),wait:V.optional(),lastWait:V.optional(),results:u(Dr).max(1024).refine(e=>new Set(e.map(e=>e.workerId)).size===e.length).optional(),finishRequestedAt:b().optional(),historyDeletion:C(`pending`).optional(),completion:x({phase:w([`waiting`,`attention`]),waitId:g().optional()}).strict().optional()}).strict(),x({role:C(`worker`),wait:V.optional(),lastWait:V.optional(),permissions:er,spawnGrant:cr.optional(),parentRunId:g(),supervisorRunId:g().optional(),workspace:ar,destroy:dr.optional(),context:br.optional(),executionRevision:v().int().nonnegative().optional(),executionStartSeq:v().int().nonnegative().optional()}).strict(),x({role:C(`invalid`)}).strict()]);function kr(e){return e?.role===`root`||e?.role===`worker`&&!!e.spawnGrant?.kinds.length}var Ar=S(`role`,[Or.options[0].pick({role:!0}).strip().extend({wait:V.pick({phase:!0,requestIds:!0,workerIds:!0}).partial({workerIds:!0}).strip().extend({outcomes:u(k.pick({workerId:!0}).strip()).max(32).optional()}).optional()}),Or.options[1].pick({role:!0,parentRunId:!0,supervisorRunId:!0}).strip().extend({wait:V.pick({phase:!0,requestIds:!0}).strip().optional()}),Or.options[2].strip()]),jr=w([`isolated`,`shared`]);x({task:O().min(1).max(1e5),baseline:O().min(1).max(1024).optional(),workspace:jr.optional(),requestId:g(),context:vr.optional(),backend:mr.optional(),model:O().trim().min(1).max(512).optional(),effort:kn,workflow:O().trim().min(1).max(200).optional(),skill:O().trim().min(1).max(200).optional()}).strict().refine(e=>e.skill===void 0||e.workflow===void 0,{message:`--skill and --workflow cannot be used together`}).refine(e=>e.task.length+(e.context?.text?.length??0)<=1e5,{message:`Combined task and context exceed 100000 characters`}),x({text:O().max(1e5).refine(e=>e.trim().length>0)}).strict(),x({workerIds:B,timeoutSeconds:v().int().min(1).max(7200).default(600),mode:pe.optional()}).strict().refine(e=>e.mode!==`one`||e.workerIds.length===1,{message:`one mode requires exactly one worker`});var Mr=x({workerId:g(),settled:A(),parentRunId:g(),supervisorRunId:g().optional(),status:w([`queued`,`running`,`waiting`,...k.shape.status.options]),currentStepId:O().optional(),workspace:ar,backend:mr.optional(),model:O().max(512).optional(),inputs:u(yr).max(32).optional(),wait:V.optional(),completionWait:lr.optional(),destroy:fr.optional(),outcome:k.optional(),scope:x({backend:w([`cgroup`,`job`,`groups`]),guarantee:w([`contained`,`scoped`])}).strict().optional()}),Nr=Mr.pick({workerId:!0,parentRunId:!0,supervisorRunId:!0,status:!0,workspace:!0,destroy:!0}).extend({revision:v().int().nonnegative(),settled:A(),destroyed:A()}).strict(),Pr=x({workers:u(Nr).max(1024)}).strict();x({offset:O().regex(/^\d{1,4}$/).refine(e=>Number(e)<=1024).optional()}).strict(),Pr.extend({workers:u(Nr).max(32),nextOffset:v().int().min(1).max(1024).optional()}).strict(),x({workerId:g(),baselineSha:z,diff:O().max(4e5),truncated:A()}),x({workerId:g(),state:w([`stopping`,`terminated`])}),x({workerId:g(),state:w([`complete`,`incomplete`]),deleted:u(S(`kind`,[x({kind:C(`worktree`),path:O().max(8192)}).strict(),x({kind:C(`branch`),ref:O().max(1024)}).strict()])).max(2).optional(),remaining:tr,error:nr.optional()});var Fr=x({outstanding:v().int().nonnegative(),limit:v().int().nonnegative(),created:v().int().nonnegative(),creationLimit:v().int().nonnegative()}).strict(),Ir=x({id:O(),title:O(),titleSummary:O().optional(),titleOrigin:w([`user`,`auto`,`marker`]).optional()}),Lr=x({parentRunId:g().optional(),supervisorRunId:g().optional(),workers:u(Mr).max(1024),titles:u(Ir).max(1025).optional(),capacity:Fr.optional()});x({code:w([`unavailable_transport`,`unauthenticated`,`denied_scope`,`invalid_input`,`invalid_baseline`,`incompatible_state`,`capacity_limit`,`unavailable_diff`,`incomplete_cleanup`]),error:nr,modelChoices:Zn.optional()}),x({workerId:g()}).strict(),x({workerId:g(),baselineSha:z}).strict(),x({workerId:g(),state:w([`queued`,`delivered`])}).strict();var Rr=x({wait:V,instruction:O().min(1).max(1e3)}).strict();x({}).strict(),x({waitId:g()}).strict();var zr=x({wait:V}).strict();x({peerIds:B,timeoutSeconds:v().int().min(1).max(7200).default(600)}).strict();var Br=S(`reason`,[x({reason:C(`message`),peerRunId:g(),messageId:g()}).strict(),x({reason:C(`settled`),peerRunId:g()}).strict(),x({reason:C(`timeout`)}).strict()]);function Vr(e,t){(e.phase===`resolved`||e.phase===`delivered`)&&!e.result&&t.addIssue({code:`custom`,message:`a ${e.phase} peer wait has a result`,path:[`result`]}),e.phase===`open`&&e.result&&t.addIssue({code:`custom`,message:`an open peer wait has no result`,path:[`result`]})}var Hr=x({id:g(),peerIds:B,deadline:b(),phase:w([`open`,`resolved`,`delivered`,`cancelled`]),result:Br.optional()}).strict().superRefine(Vr),Ur=x({wait:Hr,instruction:O().min(1).max(1e3)}).strict(),Wr=x({wait:Hr}).strict();_([Rr,Ur]),_([zr,Wr]);var Gr=w([`passing`,`failing`,`pending`]).nullable(),Kr=x({kind:w([`issue`,`pr`]),number:v(),title:O(),author:O(),createdAt:O(),labels:u(O()),body:O().optional(),url:O(),comments:v(),assignees:u(O()).optional(),projectIds:u(O()).optional(),isDraft:A().optional(),additions:v().optional(),deletions:v().optional(),checks:Gr.optional()});S(`available`,[x({available:C(!0),item:Kr.nullable(),labelColors:j(O(),O()).optional()}),x({available:C(!1),reason:O()})]),x({kind:w([`issue`,`pr`]),number:p().int().positive().safe()});var qr=x({id:O(),title:O(),url:O()});x({available:A(),reason:O().optional(),repo:O().optional(),syncedAt:O().optional(),issues:u(Kr),prs:u(Kr),labelColors:j(O(),O()).optional(),viewerLogin:O().optional(),projects:u(qr).optional(),projectsReason:O().optional(),projectsState:w([`refreshing`,`ready`,`unavailable`]).optional(),projectsGeneration:O().optional(),issuesTotal:v().int().nonnegative().optional(),prsTotal:v().int().nonnegative().optional(),issuesNextCursor:O().nullable().optional(),prsNextCursor:O().nullable().optional(),commentsDeferred:C(!0).optional()});var Jr=O().min(1).max(2e3).optional();x({limit:O().optional(),refresh:O().optional(),issuesCursor:Jr,prsCursor:Jr,issuesDone:C(`1`).optional(),prsDone:C(`1`).optional()}).superRefine((e,t)=>{e.issuesDone&&e.issuesCursor&&t.addIssue({code:`custom`,message:`issuesDone and issuesCursor are exclusive`}),e.prsDone&&e.prsCursor&&t.addIssue({code:`custom`,message:`prsDone and prsCursor are exclusive`}),e.issuesDone&&e.prsDone&&t.addIssue({code:`custom`,message:`both sides are done; there is no page to ask for`})}),x({kind:w([`issue`,`pr`]),numbers:O().regex(/^[1-9]\d{0,15}(,[1-9]\d{0,15})*$/).refine(e=>{let t=e.split(`,`);return t.length<=100&&t.every(e=>Number.isSafeInteger(Number(e)))},{message:`at most 100 safe positive integers`}),refresh:C(`1`).optional()}),S(`available`,[x({available:C(!0),counts:j(v(),v().int().nonnegative())}),x({available:C(!1),reason:O()})]),S(`available`,[x({available:C(!0),checks:j(v(),Gr)}),x({available:C(!1),reason:O()})]),x({kind:w([`issue`,`pr`]),q:O().trim().min(1).max(256),limit:p().int().positive().max(50).optional()}),x({available:A(),projectsReason:O().optional(),reason:O().optional(),items:u(Kr),truncated:A().optional(),labelColors:j(O(),O()).optional()});var Yr=w([`draft`,`review-required`,`changes-requested`,`checks-pending`,`checks-failing`,`ready`,`merged`,`closed`,`open`,`completed`,`not-planned`]),Xr=v().nullable();S(`available`,[x({available:C(!0),prs:j(v(),Yr),issues:j(v(),Yr),conflicts:u(v()).optional(),recheckAfterMs:Xr}),x({available:C(!1),reason:O(),recheckAfterMs:Xr})]);var Zr=x({id:v(),author:O(),avatarUrl:O().optional(),createdAt:O(),body:O(),kind:w([`comment`,`review`]),reviewState:w([`approved`,`changes_requested`,`commented`,`dismissed`]).optional(),url:O()}),Qr=w([`committed`,`labeled`,`unlabeled`,`assigned`,`unassigned`,`merged`,`closed`,`reopened`,`head_ref_force_pushed`,`cross-referenced`,`renamed`]),$r=x({id:O(),kind:Qr,actor:O(),avatarUrl:O().optional(),createdAt:O(),url:O().optional(),sha:O().optional(),message:O().optional(),checks:Gr.optional(),label:x({name:O(),color:O().optional()}).optional(),subject:O().optional(),refNumber:v().optional(),refTitle:O().optional(),refIsPr:A().optional()});x({available:A(),reason:O().optional(),comments:u(Zr),truncated:A().optional(),events:u($r).optional(),detail:x({body:O(),additions:v().int().nonnegative().optional(),deletions:v().int().nonnegative().optional()}).optional()});var ei=w([`merge`,`squash`,`rebase`]),ti=x({name:O(),state:w([`passing`,`failing`,`pending`,`unknown`]),required:A().nullable(),url:O().optional()}),ni=x({number:v(),title:O(),url:O(),state:w([`open`,`closed`,`merged`]),isDraft:A(),headRef:O(),baseRef:O(),headSha:O(),mergeable:w([`mergeable`,`conflicting`,`unknown`]),reviewDecision:w([`approved`,`changes-requested`,`review-required`,`not-required`,`unknown`]),checks:u(ti),methods:u(ei),defaultMethod:ei.nullable(),eligibility:w([`ready`,`blocked`,`pending`,`unauthorized`,`terminal`,`unknown`]),blockers:u(x({code:O(),message:O()})),canMerge:A(),canOverride:A()});S(`available`,[x({available:C(!0),mergeState:ni}),x({available:C(!1),reason:O()})]),x({merged:C(!0),number:v(),url:O(),method:ei,mergeCommitSha:O().optional()});var ri=x({path:O(),previousPath:O().optional(),status:w([`added`,`modified`,`removed`,`renamed`,`copied`,`changed`]),additions:v(),deletions:v(),patch:O().optional(),patchUnavailableReason:w([`binary`,`too-large`,`not-provided`]).optional(),truncated:A().optional()});S(`available`,[x({available:C(!0),number:v(),headSha:O(),files:u(ri),additions:v(),deletions:v(),truncated:A(),reason:O().optional()}),x({available:C(!1),reason:O()})]),x({generation:O().uuid()}),S(`state`,[x({generation:O().uuid(),state:C(`ready`),projects:u(qr),membership:j(O(),u(O()))}),x({generation:O().uuid(),state:C(`unavailable`),reason:O()})]),x({command:O().min(1).max(1024),port:v().int().min(1).max(65535),cwd:O().optional(),label:O().min(1).max(48).optional(),path:O().startsWith(`/`).optional()});var ii=w([`registered`,`replaced`,`invalid_input`,`cwd_outside_worktree`,`cezar_port`,`port_held`,`too_many`,`preview_disabled`,`headless`,`worktree_missing`,`unavailable`]);x({ok:A(),code:ii,message:O(),hint:O()}),x({port:v().int().min(1).max(65535),restart:A().optional()}).strict(),x({ok:A(),code:w([`stopped`,`restarted`,`approval_required`,`adopted`,`not_registered`,`port_held`,`port_in_use`,`invalid_input`,`preview_disabled`,`headless`,`worktree_missing`,`unavailable`]),message:O(),hint:O()});var H=x({port:v().int().min(1).max(65535),command:O(),cwd:O().optional(),label:O(),path:O().optional(),registeredAt:b(),answeredAtRegistration:A()}),ai=w([`registered`,`starting`,`up`,`stalled`,`exited`,`stopped`,`adopted`,`unavailable`]),oi=x({type:C(`preview.agent-browser`),state:w([`connected`,`disconnected`])}),si=v().int().min(1).max(65535),ci=e=>Math.min(4e3,Math.max(100,Math.round(e))),li=e=>Math.min(2,Math.max(1,e)),ui=w([`normal`,`high`,`ultra`]),di=w([`mousePressed`,`mouseReleased`,`mouseMoved`,`mouseWheel`]),fi=w([`left`,`middle`,`right`,`none`]),pi=w([`keyDown`,`rawKeyDown`,`keyUp`]);S(`t`,[x({t:C(`open`),viewerId:O().min(1).max(128).optional(),resume:A().optional(),target:_([x({port:si}),x({url:O().min(1).max(2048)}),x({agent:C(!0)})]),quality:ui.optional(),dpr:v().finite().transform(li).optional()}),x({t:C(`quality`),quality:ui}),x({t:C(`run`),port:si}),x({t:C(`stop`),port:si}),x({t:C(`keepWaiting`),port:si}),x({t:C(`resize`),w:v().finite().transform(ci),h:v().finite().transform(ci),dpr:v().finite().transform(li).optional()}),x({t:C(`mouse`),type:di,x:v().finite(),y:v().finite(),button:fi.optional(),buttons:v().optional(),clickCount:v().optional(),deltaX:v().optional(),deltaY:v().optional(),modifiers:v().optional()}),x({t:C(`key`),type:pi,key:O().optional(),code:O().optional(),text:O().optional(),modifiers:v().optional(),vk:v().optional(),commands:u(O()).optional()}),x({t:C(`insertText`),text:O()}),x({t:C(`nav`),url:O().min(1).max(2048)}),x({t:C(`back`)}),x({t:C(`forward`)}),x({t:C(`reload`),ignoreCache:A().optional()}),x({t:C(`dialogResult`),accept:A(),text:O().optional()}),x({t:C(`ack`)}),x({t:C(`ping`),ts:v()}),x({t:C(`download`)}),x({t:C(`cancelDownload`)}),x({t:C(`retryBrowser`)})]);var mi=S(`t`,[S(`stage`,[x({t:C(`state`),stage:C(`chromium-missing`),installCommand:O(),canDownload:A()}),x({t:C(`state`),stage:C(`downloading`),received:v(),total:v()}),x({t:C(`state`),stage:C(`download-failed`),error:O(),installCommand:O()}),x({t:C(`state`),stage:C(`sandbox-failed`),stderrTail:O()}),x({t:C(`state`),stage:C(`browser-exited`),reason:w([`timeout`,`exited`]).optional(),signal:O().optional(),exitCode:v().int().optional(),stderrTail:O(),serverUp:A()}),x({t:C(`state`),stage:C(`needs-approval`),server:H,wasRunning:A()}),x({t:C(`state`),stage:C(`port-held`),server:H,ownerTitle:O()}),x({t:C(`state`),stage:C(`server-starting`),server:H,attempt:v().int(),startedAt:b(),logTail:u(O())}),x({t:C(`state`),stage:C(`server-stalled`),server:H,logTail:O()}),x({t:C(`state`),stage:C(`server-exited`),server:H,exitCode:v().int().nullable(),logTail:O()}),x({t:C(`state`),stage:C(`server-stopped`),server:H,reason:w([`user`,`idle`]),lastUrl:O()}),x({t:C(`state`),stage:C(`worktree-removed`),server:H.optional()}),x({t:C(`state`),stage:C(`loading`),step:w([`browser`,`page`,`frame`])}),x({t:C(`state`),stage:C(`streaming`),adopted:A()}),x({t:C(`state`),stage:C(`agent-idle`)})]),x({t:C(`url`),url:O()}),x({t:C(`cursor`),cursor:O()}),x({t:C(`dialog`),type:w([`alert`,`confirm`,`prompt`,`beforeunload`]),message:O(),defaultPrompt:O().optional(),origin:O()}),x({t:C(`replaced`),by:O()}),x({t:C(`pong`),ts:v()}),x({t:C(`downloadProgress`),received:v(),total:v()})]),hi=[`text/plain`,`text/markdown`,`text/x-markdown`,`application/pdf`];function gi(e){return e.startsWith(`image/`)}function _i(e){return gi(e)||hi.includes(e)}function vi(e){return/png/.test(e)?`png`:/jpe?g/.test(e)?`jpg`:/webp/.test(e)?`webp`:/gif/.test(e)?`gif`:e===`application/pdf`?`pdf`:e===`text/plain`?`txt`:e===`text/markdown`||e===`text/x-markdown`?`md`:`img`}var yi=new Set([`png`,`jpg`,`jpeg`,`webp`,`gif`,`img`]);function bi(e){let t=e.split(`.`).pop()?.toLowerCase();return t!==void 0&&yi.has(t)}var xi=x({replayAfterOpen:C(!0).optional(),id:O(),text:O(),images:u(O()).optional(),createdAt:O()}),Si=xi.extend({origin:w([`human`,`lifecycle`]).optional(),agentInputId:g().optional(),task:O().optional(),resumeContext:x({failure:x({stepId:O().optional(),error:O()}).optional(),restarted:C(!0).optional(),cutOff:x({tools:u(O()).max(6).optional(),subagents:u(O()).max(6).optional()}).optional()}).optional()}),Ci=x({id:O().min(1),name:O().optional(),prompt:O().optional(),skill:O().optional(),model:O().optional(),effort:O().max(32).optional(),timeoutMs:v().int().min(0).max(2147483647).optional(),runner:F.optional(),agentProfile:O().min(1).max(64).optional(),allowedTools:u(O()).optional(),bashAllowlist:u(O()).optional(),command:O().optional(),onFail:x({retry:O().min(1),max:v().int().positive().default(2)}).optional()}).refine(e=>!!e.command!=!!(e.prompt??e.skill),{message:`a step is either an agent step (prompt/skill) or a check step (command), not both`}).refine(e=>!e.command||e.timeoutMs===void 0,{message:`timeoutMs applies only to agent steps`,path:[`timeoutMs`]}),wi=x({name:O(),description:O().optional(),steps:u(Ci),source:w([`built-in`,`file`]),path:O().optional()});function Ti(e,t){let n=new Set;for(let r of e.steps)r.command||n.add(r.runner??t);return F.options.filter(e=>n.has(e))}var Ei=x({path:O(),message:O()});x({workflows:u(wi),issues:u(Ei)}),x({name:O().trim().min(1).max(80),description:O().max(2e3,`must be at most 2000 characters`).optional(),steps:u(Ci).min(1).max(8).optional(),skills:u(O().trim().min(1)).min(1).max(8).optional(),overwrite:A().optional()}).refine(e=>!!e.steps!=!!e.skills,{message:`provide either "steps" or "skills", not both`}),x({path:O(),name:O()}),x({name:O(),description:O().optional(),steps:u(Ci)}),x({ok:C(!0),path:O()}),x({name:O().optional(),steps:u(Ci),rationale:O(),fallback:A()});var Di=/^https:\/\/([a-zA-Z0-9](?:[a-zA-Z0-9.-]*[a-zA-Z0-9])?)\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+)\/pull\/([1-9][0-9]*)$/,Oi=O().max(2048).regex(Di).refine(e=>{let t=Di.exec(e);return!!t&&Number.isSafeInteger(Number(t[4]))&&t[3]!==`.`&&t[3]!==`..`},`Expected an HTTPS GitHub PR URL with a positive integer PR number`),ki=w([`checks`,`merge`,`merge_or_blocked`]),Ai=x({pr:Oi,until:ki.default(`checks`),wake_on_conflict:A().default(!0),timeout_seconds:v().int().min(1).max(7200).default(1800)}).strict(),ji=O().regex(/^[0-9a-f]{40}$/i),Mi=x({prUrl:Oi,repository:O().max(2048).regex(/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_.-]+$/),prNumber:v().int().positive().max(2**53-1),headSha:ji}).strict(),Ni=w([`passed`,`failed`,`cancelled`,`skipped`,`no_checks`,`stuck`,`head_changed`,`conflicting`,`deadline`,`error`,`merged`,`closed`,`blocked`]),Pi=w(`invalid_request.unsupported_host.gh_missing.authentication.inaccessible_pr.malformed_data.output_limit.query_timeout.command_failed.wait_conflict.capacity.unavailable.unauthorized.persistence.manager_disposed.capability_revoked.run_missing.run_not_running.run_stopping.session_replaced.session_closed.run_cancelled.finish_requested.generation_mismatch.worker_wait_pending.worker_execution_stopped.root_finish_pending.registration_aborted.turn_changed`.split(`.`));x({code:Pi,message:O().max(4096)}).strict();function Fi(e){let t=0;for(let n of e){let e=n.codePointAt(0);t+=e<=127?1:e<=2047?2:e<=65535?3:4}return t}var Ii=x({reason:w([`conflict`,`no_pending_merge`]),isInMergeQueue:A(),autoMergeEnabled:A(),event:x({kind:w([`queue_removal`,`auto_merge_disabled`]),createdAt:b({offset:!0}),reason:O().max(256).optional(),reasonCode:O().max(256).optional()}).strict().optional()}).strict(),Li=x({outcome:Ni,headSha:ji,observedHeadSha:ji.optional(),mergeable:w([`MERGEABLE`,`CONFLICTING`,`UNKNOWN`]).optional(),mergeStateStatus:O().max(64).optional(),mergedAt:b({offset:!0}).optional(),mergeCommitSha:ji.optional(),mergeBlock:Ii.optional(),observedAt:b(),checks:u(x({name:O().max(256),state:O().max(256),link:O().max(2048)}).strict()).max(100),totalChecks:v().int().nonnegative(),truncated:A(),diagnostic:O().max(4096).refine(e=>Fi(e)<=4096).optional()}).strict().refine(e=>e.outcome===`blocked`==(e.mergeBlock!==void 0),`Only blocked outcomes require mergeBlock`).refine(e=>Fi(JSON.stringify(e))<=32*1024,`CI result exceeds 32 KiB`),Ri=Mi.extend({id:g(),generation:O().min(1).max(256),turnId:O().min(1).max(256),timeoutSeconds:v().int().min(1).max(7200),until:ki.default(`checks`),wakeOnConflict:A().default(!0),registeredAt:b(),deadline:b(),phase:w([`registered`,`parked`,`wake-pending`,`delivered`,`withdrawn`]),result:Li.optional(),wakeId:O().min(1).max(256).optional(),deliveredAt:b().optional()}).strict();Mi.extend({waitId:g(),registeredAt:b(),deadline:b(),phase:Ri.shape.phase}).strict();function zi(e){return e.status===`waiting`&&e.autoResumeAt!==void 0}var Bi=7200,Vi=1800,Hi=7200,Ui=4096,Wi=7200,Gi=4096;function Ki(e){let t=e?.role===`root`&&`conversation`in e?e.conversation:void 0,n=Array.isArray(t?.messages)?t.messages:[];return new Set(n.flatMap(e=>{let t=e&&typeof e==`object`?e:void 0;return t?.relationship===`peer`&&t.kind===`request`&&typeof t.id==`string`?[t.id]:[]}))}function qi(e,t){let n=Ki(e);return!!t?.some(e=>n.has(e))}function Ji(e){if(e.requestIds){let t=new Set(e.requestOutcomes?.map(e=>e.requestId));return e.requestIds.map(e=>({key:`request:${e}`,settled:t.has(e)}))}let t=new Set(e.outcomes?.map(e=>e.workerId));return(e.workerIds??[]).map(e=>({key:`worker:${e}`,settled:t.has(e)}))}function Yi(e){let t=e.filter(e=>e.kind===`worker`);if(t.length)return new Set(t.flatMap(e=>Ji(e).filter(e=>!e.settled).map(e=>e.key))).size}function Xi(e){let t;for(let n of e)(!t||Date.parse(n.deadline)<Date.parse(t.deadline))&&(t=n);return t}function Zi(e){let t=(Array.isArray(e.waits)?e.waits:[]).filter(e=>e?.phase===`open`),n=t.filter(e=>e.kind===`human`);if(n.length)return n.some(e=>e.askSeq!==void 0)?{kind:`human`,shown:!0}:{kind:`human`};if(zi(e))return{kind:`usage-limit`,at:e.autoResumeAt};let r=Yi(t);if(r!==void 0){let n=t.filter(e=>e.kind===`worker`),i=n.every(e=>e.requestIds!==void 0),a=i&&n.some(t=>qi(e.delegation,t.requestIds));return{kind:`workers`,count:r,...i?{replies:!0}:{},...a?{peers:!0}:{}}}let i=t.filter(e=>e.kind===`peer`);if(i.length)return{kind:`peers`,count:new Set(i.flatMap(e=>e.peerIds)).size};let a=t.filter(e=>e.kind===`subagent`);if(a.length)return{kind:`subagents`,count:new Set(a.flatMap(e=>e.children.filter(e=>e.status===`running`).map(e=>e.id))).size};let o=Xi(t.filter(e=>e.kind===`pr`));if(o)return{kind:`pr`,until:o.until,waitId:o.id,prUrl:o.prUrl,repository:o.repository,prNumber:o.prNumber,deadline:o.deadline};let s=Xi(t.filter(e=>e.kind===`process`));if(s)return{kind:`process`,waitId:s.id,pid:s.pid,deadline:s.deadline,...s.note===void 0?{}:{note:s.note}};let c=Xi(t.filter(e=>e.kind===`timer`));if(c)return{kind:`timer`,waitId:c.id,at:c.deadline,...c.note===void 0?{}:{note:c.note}}}function Qi(e){return Array.isArray(e.waits)&&e.waits.some(e=>e?.kind===`human`&&e.phase===`open`)}function $i(e){return Array.isArray(e.waits)&&e.waits.some(e=>e?.kind===`human`&&e.phase===`open`&&(e.source===`agent`||!!e.questions?.length))}function ea(e){return e.waitWakePending?!0:Array.isArray(e.waits)&&e.waits.some(e=>e?.phase===`resolved`)}function ta(e){return e.waitingOn??Zi(e)}var na=512,ra=v().int().min(2),ia=w([`open`,`resolved`,`delivered`,`cancelled`]),aa=w([`cezar_wait`,`cezar_wait_for_ci`,`cezar_ask`,`monitoring-line`,`schedule-wakeup`,`ask-line`,`native-ask`,`no-wait`,`budget`,`cez-worker-wait`,`completion`,`cez-message-wait`,`native-subagents`]),U={id:g(),source:w([`agent`,`cezar`]),via:aa,registeredAt:b(),phase:ia,resolvedAt:b().optional(),deliveredAt:b().optional(),cancelledAt:b().optional(),turnId:O().min(1).max(256)},oa=x({...U,kind:C(`pr`),deadline:b(),...Mi.shape,generation:O().min(1).max(256),timeoutSeconds:v().int().min(1).max(7200),until:ki,wakeOnConflict:A(),result:Li.optional()}).strict(),sa=x({...U,kind:C(`timer`),deadline:b(),seconds:v().int().min(60).max(Bi),note:O().max(na).optional()}).strict(),ca=x({outcome:w([`exit_file`,`exited`,`deadline`,`error`]),observedAt:b(),exitCode:v().int().min(-2147483648).max(2147483647).optional(),exitFileNote:C(`not-an-exit-code`).optional(),diagnostic:O().max(512).optional()}).strict(),la=x({...U,kind:C(`process`),deadline:b(),timeoutSeconds:v().int().min(1).max(Hi),pid:ra,startToken:O().min(1).max(256).optional(),exitFile:O().min(1).max(Ui).optional(),note:O().max(na).optional(),result:ca.optional()}).strict(),ua=x({...U,kind:C(`human`),questions:m.shape.questions.optional(),context:D.optional(),askSeq:v().int().nonnegative().optional()}).strict(),da=x({...U,kind:C(`worker`),deadline:b().optional(),timeoutSeconds:v().int().min(1).max(Wi).optional(),mode:pe.optional(),workerIds:B.optional(),revisions:u(x({workerId:g(),revision:v().int().nonnegative()}).strict()).max(32).optional(),outcomes:u(k).max(32).optional(),requestIds:B.optional(),requestOutcomes:u(fe).max(32).optional(),result:x({reason:w([`outcome`,`timeout`])}).strict().optional(),wakeInputId:g().optional()}).strict().superRefine((e,t)=>{let n=e.deadline!==void 0,r=e.timeoutSeconds!==void 0;e.source===`agent`?(n||t.addIssue({code:`custom`,message:`an agent worker wait requires a deadline`,path:[`deadline`]}),r||t.addIssue({code:`custom`,message:`an agent worker wait requires timeoutSeconds`,path:[`timeoutSeconds`]})):n!==r&&t.addIssue({code:`custom`,message:`a cezar worker wait takes deadline and timeoutSeconds together or neither`,path:[n?`timeoutSeconds`:`deadline`]});let i=e.workerIds!==void 0;if(i===(e.requestIds!==void 0)){t.addIssue({code:`custom`,message:`a worker wait names workerIds or requestIds, exactly one`,path:[i?`requestIds`:`workerIds`]});return}e.mode===`one`&&(e.workerIds??e.requestIds)?.length!==1&&t.addIssue({code:`custom`,message:`one mode requires exactly one id`,path:[`mode`]});let a=i?[`revisions`,`outcomes`]:[`requestOutcomes`],o=i?[`requestOutcomes`]:[`revisions`,`outcomes`];for(let n of a)e[n]===void 0&&t.addIssue({code:`custom`,message:`${n} is required with ${i?`workerIds`:`requestIds`}`,path:[n]});for(let n of o)e[n]!==void 0&&t.addIssue({code:`custom`,message:`${n} does not go with ${i?`workerIds`:`requestIds`}`,path:[n]})}),fa=e=>e.deadline!==void 0,pa=x({...U,kind:C(`peer`),deadline:b(),timeoutSeconds:v().int().min(1).max(Wi),peerIds:B,result:Br.optional()}).strict().superRefine(Vr),ma=x({id:O().min(1).max(256),status:w([`running`,`completed`,`failed`,`cancelled`])}).strict(),ha=x({reason:w([`settled`,`timeout`,`interrupted`,`superseded`])}).strict(),ga=S(`kind`,[oa,sa,ua,da,la,pa,x({...U,kind:C(`subagent`),source:C(`cezar`),via:C(`native-subagents`),deadline:b(),children:u(ma).min(1).max(32),result:ha.optional()}).strict()]),_a=(e,t,n)=>{t===`one`&&e.length!==1&&n.addIssue({code:`custom`,message:`one mode requires exactly one id`,path:[`mode`]})},va=v().int().min(1).max(Wi).default(600),ya={operation_id:g().optional()};S(`kind`,[Ai.extend({kind:C(`pr`),...ya}).strict(),x({kind:C(`worker`),...ya,worker_ids:B,mode:pe.optional(),timeout_seconds:va}).strict().superRefine((e,t)=>_a(e.worker_ids,e.mode,t)),x({kind:C(`request`),...ya,request_ids:B,mode:pe.optional(),timeout_seconds:va}).strict().superRefine((e,t)=>_a(e.request_ids,e.mode,t)),x({kind:C(`peer`),...ya,peer_ids:B,timeout_seconds:va}).strict(),x({kind:C(`timer`),...ya,seconds:v().int().min(60).max(Bi),note:O().max(na).optional()}).strict(),x({kind:C(`process`),...ya,pid:ra,exit_file:O().min(1).max(Ui).optional(),timeout_seconds:v().int().min(1).max(Hi).default(Vi),note:O().max(na).optional()}).strict()]),x({wait_id:g()}).strict();var ba={wait_id:g(),summary:O().max(256)},W=S(`kind`,[x({...ba,kind:w([`pr`,`timer`,`worker`,`process`,`peer`,`subagent`]),deadline:b()}).strict(),x({...ba,kind:C(`human`)}).strict()]),xa=w([...Pi.options,`timers_disabled`,`wake_budget_spent`,`denied_scope`,`exit_file_outside`,`process_not_allowed`,`process_not_owned`,`duplicate_deadline`,`operation_conflict`,`outcome_unknown`,`messaging_off`]),Sa=O().max(Gi),Ca=x({operationId:g(),requestHash:O().regex(/^[0-9a-f]{64}$/),wait:ga,deduplicated:A()}).strict(),wa={operation_id:g().optional()};S(`ok`,[x({ok:C(!0),...wa,effect:w([`applied`,`unchanged`]).optional(),deduplicated:A().optional(),replayed:A().optional(),wait_phase:w([...ia.options,`unavailable`]).optional(),wait_id:g(),kind:w([`pr`,`timer`,`worker`,`request`,`process`,`peer`]),deadline:b(),open_waits:u(W).max(16)}).strict(),x({ok:C(!1),...wa,effect:w([`refused`,`unknown`]).optional(),retained_wait:W.optional(),code:xa,message:Sa,open_waits:u(W).max(16).optional()}).strict()]),m.extend({context:D});var Ta=w([`invalid_request`,`capacity`,`persistence`,`unavailable`,`unauthorized`,`autonomous_run`,`manager_disposed`,`capability_revoked`,`run_missing`,`run_not_running`,`run_stopping`,`session_replaced`,`session_closed`,`run_cancelled`,`finish_requested`,`generation_mismatch`,`worker_wait_pending`,`worker_execution_stopped`,`root_finish_pending`,`supervisor_is_worker`]);S(`ok`,[x({ok:C(!0),wait_id:g(),open_waits:u(W).max(16)}).strict(),x({ok:C(!1),code:Ta,message:Sa,open_waits:u(W).max(16).optional()}).strict()]),S(`cancelled`,[x({cancelled:C(!0),wait_id:g(),open_waits:u(W).max(16)}).strict(),x({cancelled:C(!1),code:w([`not_found`,`already_resolved`,`human_question`,`invalid_request`,`unavailable`]),message:Sa,open_waits:u(W).max(16).optional()}).strict()]),x({summary:O().max(2e3).optional()}).strict();var Ea=w([`workers_outstanding`,`workers_uncollected`,`worker_questions`,`requests_outstanding`,`requests_unanswered`,`human_question_pending`,`worker_wait_pending`,`root_finish_pending`,`not_final_step`,`manager_disposed`,`capability_revoked`,`run_missing`,`run_not_running`,`run_stopping`,`session_replaced`,`session_closed`,`run_cancelled`,`finish_requested`,`generation_mismatch`,`invalid_request`,`unavailable`,`input_pending`]),Da=S(`kind`,[x({kind:C(`wait_result`),wait_id:O(),wait_kind:O()}).strict(),x({kind:C(`queued`),input_id:O().optional(),source:O()}).strict(),x({kind:C(`in_flight`),input_id:O()}).strict(),x({kind:C(`unread`),input_id:O()}).strict()]),Oa={ok:C(!0),finishes:C(`at_turn_end`),open_waits:u(W).max(16)};S(`ok`,[S(`completes`,[x({...Oa,completes:C(`task`)}).strict(),x({...Oa,completes:C(`step`),next_step:O().min(1)}).strict()]),x({ok:C(!1),code:Ea,message:Sa,workers:u(x({worker_id:O(),reason:w([`outstanding`,`uncollected`,`question`])}).strict()).max(64).optional(),open_waits:u(W).max(16).optional(),owed:u(Da).max(64).optional()}).strict()]);var ka=ee(e=>e&&typeof e==`object`&&e.kind===`ci`?{...e,kind:`pr`,until:`checks`}:e,S(`kind`,[x({kind:C(`human`),shown:C(!0).optional()}),x({kind:C(`usage-limit`),at:O()}),x({kind:C(`workers`),count:v().int().nonnegative(),replies:C(!0).optional(),peers:C(!0).optional()}),x({kind:C(`peers`),count:v().int().nonnegative()}),x({kind:C(`subagents`),count:v().int().nonnegative()}),x({kind:C(`pr`),until:ki,waitId:g(),prUrl:Mi.shape.prUrl,repository:Mi.shape.repository,prNumber:Mi.shape.prNumber,deadline:b()}),x({kind:C(`process`),waitId:g(),pid:ra,deadline:b(),note:O().max(na).optional()}),x({kind:C(`timer`),waitId:g(),at:b(),note:O().max(na).optional()})]));function Aa(e){let t=e.delegation;if(!t||t.role===`invalid`)return;let n=(e.waits??[]).filter(e=>e.kind===`worker`&&fa(e)&&(e.phase===`open`||e.phase===`resolved`)).at(-1);if(!n)return;let r=Pa(n);return n.phase===`open`&&e.status===`waiting`&&!Qi(e)?{...r,phase:`parked`}:r}function ja(e,t){return(e??[]).filter(e=>e.kind===`worker`&&e.via===`completion`&&!fa(e)&&(e.phase===`open`||e.phase===`resolved`)&&(t===void 0||!!e.workerIds?.includes(t))).at(-1)}function Ma(e,t){let n=e.phase===`cancelled`?`cancelled`:e.phase===`open`?void 0:e.result?.reason,r=e.phase===`open`&&t.status===`waiting`&&!Qi(t);return{id:e.id,via:`completion`,workerIds:e.workerIds??[],...e.mode===void 0?{}:{mode:e.mode},...e.revisions?.length?{revisions:e.revisions}:{},...n===void 0?{}:{reason:n},phase:r?`parked`:e.phase===`open`?`registered`:`wake-pending`,outcomes:e.outcomes??[],wakeId:e.wakeInputId??e.id}}function Na(e){if(!kr(e.delegation))return;let t=ja(e.waits);return t?Ma(t,e):void 0}function Pa(e){let t=e.phase===`cancelled`?`cancelled`:e.phase===`open`?void 0:e.result?.reason;return{id:e.id,workerIds:e.workerIds??[],...e.requestIds===void 0?{}:{requestIds:e.requestIds},...e.requestOutcomes===void 0?{}:{requestOutcomes:e.requestOutcomes},deadline:e.deadline,...e.mode===void 0?{}:{mode:e.mode},...e.revisions?.length?{revisions:e.revisions}:{},...t===void 0?{}:{reason:t},phase:e.phase===`open`?`registered`:`wake-pending`,outcomes:e.outcomes??[],wakeId:e.wakeInputId??e.id}}var Fa=x({autosave:u(x({at:O(),note:O(),periodic:x({branch:O().nullable(),count:v().int().positive(),first:O().nullable(),latest:O().nullable()}).optional()}))});function Ia(e,t){let n=`\n${e}\n`;for(let e=n.indexOf(`\n${t}`);e>=0;e=n.indexOf(`\n${t}`,e+1)){let r=e+1+t.length;if(n[r]===`
|
|
2
|
+
`||n.startsWith(`\r
|
|
3
|
+
`,r))return e}return-1}function La(e,t){let n=e.indexOf(`
|
|
4
|
+
`,t);return n<0?e.length:n+1}var Ra={archiveWhenDone:A().optional(),autoMergePr:A().optional()},za={allowWorkers:A().optional(),allowMessaging:A().optional()},Ba=e=>e.allowWorkers!==!1,Va=e=>e.allowMessaging!==!1,Ha=x({owner:O().min(1),repo:O().min(1),number:v().int().positive()}).extend({mergedAt:O().datetime()}),Ua=x({reason:C(`pull-requests-merged`),archivedAt:O().datetime(),fingerprint:O(),pullRequests:u(Ha)}),Wa=x({id:O().uuid(),phase:w([`pending`,`blocked`,`complete`]),message:O().optional()}),G=v().finite().nonnegative(),Ga=x({id:O(),name:O(),kind:jn,status:An,iterations:v(),retriesUsed:v().int().nonnegative().optional(),tokensUsed:v(),inputTokens:G.optional(),outputTokens:G.optional(),usageInvocationsStarted:G.optional(),usageInvocationsObserved:G.optional(),usageTurnsStarted:G.optional(),usageTurnsRecorded:G.optional(),usageInvocationEpoch:G.optional(),startedAt:O().optional(),finishedAt:O().optional(),error:O().optional(),sessionId:O().optional(),backend:F.optional(),removedBackend:O().optional(),profileId:O().optional(),skillPath:O().min(1).optional(),costUsd:v().optional(),synthetic:C(`continuation`).optional(),continuesStepId:O().optional()}),Ka=x({adds:v(),dels:v(),files:v(),repointed:A().optional()}),qa=x({cpuPct:v(),rssBytes:v(),procCount:v()}),Ja=x({lastDeliveredAt:O().optional(),lastError:O().max(1024).optional(),lastErrorWebhookId:O().optional()}),Ya=x({status:w([`running`,`done`,`failed`]),startedAt:O(),finishedAt:O().optional(),durationMs:v().optional(),error:O().optional()}),Xa=x({number:v().int().positive().lt(1e7),url:O().regex(/^https?:\/\/github\.com\/[a-z0-9_.-]+\/[a-z0-9_.-]+\/pull\/\d+\/?(?:[?#][^\s]*)?$/i).optional(),source:w([`declared`,`created`])}).refine(e=>e.url===void 0||Number(/\/pull\/(\d+)/i.exec(e.url)?.[1])===e.number,{message:`PR URL and number must agree`}),Za=x({stepId:O(),mode:w([`resume`,`start`])}),Qa=x({session:O(),at:O(),seq:v().int().nonnegative(),openWaits:u(O()).max(32),settledWaits:u(O()).max(32),lastInput:O().optional(),summary:O().optional(),freeTurn:C(!0).optional()}),K=x({id:O(),title:O(),titleSummary:O().optional(),diffStat:Ka.optional(),workflow:O(),task:O(),queuedMessages:u(xi).optional(),stopping:A().optional(),continuationMessage:Si.optional(),workflowCursor:Za.optional(),doneAccepted:Qa.optional(),invalidAsk:A().optional(),delegation:Or.optional(),agentInputs:u(E).optional(),waits:u(ga).optional(),waitRegistrations:u(Ca).optional(),lastWaits:u(ga).optional(),lastWaitsError:O().max(256).optional(),automaticWakes:v().int().nonnegative().optional(),waitDeliveryFailures:v().int().nonnegative().optional(),previewServers:u(H).optional(),taskImages:u(O()).optional(),model:O().optional(),effort:O().max(32).optional(),modelIdentity:O().optional(),runner:F.optional(),removedRunner:O().optional(),agentProfile:O().optional(),systemPrompt:O().optional(),generateFollowups:A().optional(),autonomous:A().optional(),...Ra,...za,completionAction:Wa.optional(),archiveBlocker:x({message:O(),runId:O().optional(),pullRequestUrl:O().optional()}).optional(),automation:x({automationId:O(),automationRevision:v(),receiptId:O(),event:O(),githubUrl:O()}).optional(),automationTrigger:x({automationId:O(),automationRevision:v(),receiptId:O(),trigger:w([`schedule`,`catch-up`,`manual`]),occurrenceAt:O()}).optional(),destroyRetry:ur.optional(),notify:A().optional(),webhook:Ja.optional(),status:R,hasPendingPermission:A().optional(),autoResumeAt:O().optional(),autoResumeAttempts:v().optional(),autoResumeReason:w([`usage-limit`,`provider-error`]).optional(),parkReason:w([`turn`,`hold`,`closing-wakes`]).optional(),createdAt:O(),startedAt:O().optional(),finishedAt:O().optional(),tokensUsed:v(),inputTokens:G.optional(),outputTokens:G.optional(),costUsd:v().optional(),pullRequestUrl:O().optional(),pullRequests:u(Xa).optional(),referencedPullRequestUrl:O().optional(),prNumber:v().optional(),issueNumber:v().optional(),referencedIssueNumberSeeded:A().optional(),titleOrigin:w([`user`,`auto`,`marker`]).optional(),markerRefs:x({pr:v().optional(),issue:v().optional()}).optional(),referencedPrCandidates:u(O()).optional(),referencedIssueUrl:O().optional(),referencedIssueCandidates:u(O()).optional(),worktree:C(!1).optional(),worktreePath:O().optional(),branch:O().optional(),baseBranch:O().optional(),worktreeReclaimedAt:O().optional(),worktreeSetup:Ya.optional(),groupId:O().optional(),variant:O().optional(),clientRequestId:O().optional(),clientRequestHash:O().optional(),peakRssBytes:v().optional(),peakProcCount:v().optional(),archived:A(),archivedAt:O().optional(),autoArchive:Ua.optional(),manualUnarchivedAt:O().datetime().optional(),pinned:A().optional(),pinnedAt:O().optional(),seenAt:O().optional(),currentStepId:O().optional(),error:O().optional(),steps:u(Ga),workflowDef:wi.optional(),handoffRecords:Fa.optional()});K.extend({finishBlocked:O().nullable().optional(),cliResumeCommand:O().optional(),usage:qa.optional()});var $a=x({id:O(),title:O(),titleSummary:O().optional(),titleOrigin:w([`user`,`auto`,`marker`]).optional(),status:R,hasPendingPermission:K.shape.hasPendingPermission,waitingOn:ka.optional(),waitWakePending:C(!0).optional(),delegation:Ar.optional(),createdAt:O(),finishedAt:O().optional(),seenAt:O().optional(),archived:A(),autoResumeAt:O().optional(),autoResumeReason:K.shape.autoResumeReason,workflow:O(),branch:O().optional(),startedAt:O().optional(),pullRequestUrl:O().optional(),pullRequests:u(Xa).optional(),referencedPullRequestUrl:O().optional(),prNumber:v().optional(),issueNumber:v().optional(),referencedIssueUrl:O().optional(),markerRefs:x({pr:v().optional(),issue:v().optional()}).optional(),costUsd:v().optional(),peakRssBytes:v().optional(),peakProcCount:v().optional(),usage:qa.optional(),workflowLabel:O(),groupId:O().optional(),variant:O().optional(),pinned:A().optional(),automationId:O().optional(),runner:K.shape.runner,removedRunner:K.shape.removedRunner,model:O().optional(),notify:A().optional(),diffStat:Ka.optional(),tokensUsed:v(),inputTokens:K.shape.inputTokens,outputTokens:K.shape.outputTokens,currentStepId:O().optional(),currentStepBackend:F.optional(),error:O().optional(),worktreePath:O().optional()}),eo=$a.extend({projectId:O()});function to(e){return e.automationId!==void 0}var no=j(O(),x({prs:j(v(),Yr),issues:j(v(),Yr)}));x({archived:w([`recent`,`all`]).optional()}),x({before:O().optional(),limit:p().int().min(1).max(200).optional(),q:O().optional()});var ro=x({runs:u($a),nextCursor:O().nullable(),total:v().int().nonnegative()});x({q:O().trim().min(2),limit:p().int().min(1).max(50).optional()});var io=x({runs:u(eo),truncated:u(O())});x({cancelled:A()}),x({cancelled:C(!0)}),x({scope:w([`unpinned`,`pinned`]).optional(),automation:A().optional()}),x({archived:v(),ids:u(O()),pinnedIds:u(O())}),x({automation:A().optional()}),x({read:v()}),x({deleted:C(!0)}),x({finished:C(!0)}),x({continued:C(!0)}),x({url:O(),dryRun:A()}),_([x({delivered:C(!0)}),x({queued:C(!0),message:xi}),x({deferred:C(!0)})]),x({message:xi}),x({removed:C(!0)}),x({opened:C(!0),command:O()}),x({removed:C(!0)}),x({committed:C(!0),sha:O()}),x({pushed:C(!0),branch:O(),remote:O(),upstreamSet:A()}),x({commits:u(x({sha:O(),subject:O(),author:O(),when:O()}))}),x({id:O().min(1),file:O().regex(/^[A-Za-z0-9_-][A-Za-z0-9._-]*$/).refine(e=>!e.includes(`..`))});var ao=x({mediaType:O().refine(_i,{message:`unsupported attachment type — images, plain text, markdown and PDF only`}),data:O().min(1).max(7e6)}),oo=x({workflow:O().min(1).optional(),steps:u(Ci).min(1).max(8).optional(),task:O().min(1).max(1e5,`must be at most 100000 characters`),model:O().optional(),effort:O().max(32).optional(),runner:F.optional(),agentProfile:O().max(64).optional(),worktree:A().optional(),autonomous:A().optional(),...Ra,...za,systemPrompt:O().trim().max(2e4,`must be at most 20000 characters`).optional().transform(e=>e||void 0),images:u(ao).max(4).optional()});oo.extend({steps:u(Ci.safeExtend({skillPath:O().min(1).optional()})).min(1).max(8).optional(),clientRequestId:O().uuid().optional(),notify:A().optional()}).refine(e=>!!e.workflow!=!!e.steps,{message:`provide either "workflow" or "steps", not both`}),x({text:O().max(1e5).default(``),images:u(ao).max(4).default([])}).refine(e=>e.text.trim().length>0||e.images.length>0,{message:`message needs text or at least one attachment`}),x({title:O().trim().min(1).max(300).optional(),task:O().trim().min(1).max(1e5).optional(),...Ra,...za}),x({pinned:A().optional()}),x({notify:A(),message:O().trim().max(1e5).optional().transform(e=>e||void 0)});var so=/^[\w!#$%&'*.^`|~+-]+$/,co=(e,t,n={})=>{if(!so.test(e))throw Error(`Invalid cookie name`);let r=`${e}=${t}`;if(e.startsWith(`__Secure-`)&&!n.secure)throw Error(`__Secure- Cookie must have Secure attributes`);if(e.startsWith(`__Host-`)){if(!n.secure)throw Error(`__Host- Cookie must have Secure attributes`);if(n.path!==`/`)throw Error(`__Host- Cookie must have Path attributes with "/"`);if(n.domain)throw Error(`__Host- Cookie must not have Domain attributes`)}for(let e of[`domain`,`path`,`sameSite`,`priority`])if(n[e]&&/[;\r\n]/.test(n[e]))throw Error(`${e} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge==`number`&&n.maxAge>=0){if(n.maxAge>3456e4)throw Error(`Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.`);r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!==`host`&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw Error(`Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw Error(`Partitioned Cookie must have Secure attributes`);r+=`; Partitioned`}return r},lo=(e,t,n)=>(t=encodeURIComponent(t),co(e,t,n)),uo=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),fo=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??`);e=e.replace(t,r?`/${r}`:``)}return e},po=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.set(n,r);return t},mo=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},ho=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function go(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _o(e,t){if(!go(e)&&!go(t))return t;let n={...e};for(let e in t){let r=t[e];go(n[e])&&go(r)?n[e]=_o(n[e],r):n[e]=r}return n}var vo=(e,t)=>new Proxy(()=>{},{get(n,r){if(!(typeof r!=`string`||r===`then`))return vo(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),yo=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(e,t,n){this.url=e,this.method=t,this.buildSearchParams=n.buildSearchParams}fetch=async(e,t)=>{if(e){if(e.query&&(this.queryParams=this.buildSearchParams(e.query)),e.form){let t=new FormData;for(let[n,r]of Object.entries(e.form))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.append(n,r);this.rBody=t}e.json&&(this.rBody=JSON.stringify(e.json),this.cType=`application/json`),e.param&&(this.pathParams=e.param)}let n=this.method.toUpperCase(),r={...e?.header,...typeof t?.headers==`function`?await t.headers():t?.headers};if(e?.cookie){let t=[];for(let[n,r]of Object.entries(e.cookie))t.push(lo(n,r,{path:`/`}));r.Cookie=t.join(`,`)}this.cType&&(r[`Content-Type`]=this.cType);let i=new Headers(r??void 0),a=this.url;a=ho(a),a=fo(a,this.pathParams),this.queryParams&&(a=a+`?`+this.queryParams.toString()),n=this.method.toUpperCase();let o=!(n===`GET`||n===`HEAD`);return(t?.fetch||fetch)(a,{body:o?this.rBody:void 0,method:n,headers:i,...t?.init})}},bo=(e,t)=>vo(function n(r){let i=t?.buildSearchParams??po,a=[...r.path],o=a.slice(-3).reverse();if(o[0]===`toString`)return o[1]===`name`?o[2]||``:n.toString();if(o[0]===`valueOf`)return o[1]===`name`?o[2]||``:n;let s=``;if(/^\$/.test(o[0])){let e=a.pop();e&&(s=e.replace(/^\$/,``))}let c=uo(e,a.join(`/`));if(s===`url`||s===`path`){let t=c;return r.args[0]&&(r.args[0].param&&(t=fo(c,r.args[0].param)),r.args[0].query&&(t=t+`?`+i(r.args[0].query).toString())),t=ho(t),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=mo(r.args[0]&&r.args[0].param?fo(c,r.args[0].param):c,`ws`),n=new URL(e),i=r.args[0]?.query;return i&&Object.entries(i).forEach(([e,t])=>{Array.isArray(t)?t.forEach(t=>n.searchParams.append(e,t)):n.searchParams.set(e,t)}),((...e)=>t?.webSocket!==void 0&&typeof t.webSocket==`function`?t.webSocket(...e):new WebSocket(...e))(n.toString())}let l=new yo(c,s,{buildSearchParams:i});if(s){t??={};let e={...r.args[1]},n=t.headers,i=e.headers;n&&i&&(e.headers=async()=>({...typeof n==`function`?await n():n,...typeof i==`function`?await i():i}));let a=_o(t,e);return l.fetch(r.args[0],a)}return l},[]);function xo(e={}){let{baseUrl:t=``,token:n,headers:r,fetch:i}=e;return bo(t,{headers:{...n?{Authorization:`Bearer ${n}`}:{},...r},...i?{fetch:i}:{}})}var So={permission:0,error:1,waiting:2,running:3,unseen:4,none:5},Co=[`needs-permission`,`failed`,`needs-you`,`needs-review`,`running`,`usage-limit`,`waiting-on-workers`,`waiting-on-subagents`,`waiting-for-ci`,`waiting-for-merge`,`waiting-for-command`,`monitoring`,`waiting-for-capacity`,`queued`,`done`,`cancelled`,`unseen`];function wo(e){return e.hasPendingPermission===!0&&(e.status===`waiting`||e.status===`running`)}function To(e){return!1}function Eo(e,t,n=!1){if(t.requestIds?.length)return e===`worker`?`waiting on parent reply`:n?`waiting on replies`:`waiting on worker replies`;let r=new Set(t.outcomes?.map(e=>e.workerId)),i=t.workerIds?.filter(e=>!r.has(e)).length;return i?`waiting on ${i} worker${i===1?``:`s`}`:`waiting on workers`}var Do={"needs-permission":{bucket:`permission`,tone:`info`,shape:`filled`,pulse:!0,label:`needs permission`},failed:{bucket:`error`,tone:`danger`,shape:`filled`,pulse:!1,label:`failed`},"needs-you":{bucket:`waiting`,tone:`pending`,shape:`filled`,pulse:!0,label:`needs you`},"needs-review":{bucket:`waiting`,tone:`info`,shape:`filled`,pulse:!0,label:`needs review`},running:{bucket:`running`,tone:`running`,shape:`filled`,pulse:!0,label:`running`},"usage-limit":{bucket:`none`,tone:`neutral`,shape:`ring`,pulse:!1,label:`usage limit`},"waiting-on-workers":{bucket:`none`,tone:`running`,shape:`workers`,pulse:!1,label:`waiting on workers`},"waiting-on-subagents":{bucket:`none`,tone:`running`,shape:`workers`,pulse:!1,label:`waiting for subagents`},"waiting-for-ci":{bucket:`running`,tone:`running`,shape:`ring`,pulse:!0,label:`waiting for CI`},"waiting-for-merge":{bucket:`running`,tone:`running`,shape:`ring`,pulse:!0,label:`waiting for merge`},"waiting-for-command":{bucket:`running`,tone:`running`,shape:`ring`,pulse:!0,label:`waiting for a command`},monitoring:{bucket:`running`,tone:`running`,shape:`ring`,pulse:!0,label:`monitoring`},"waiting-for-capacity":{bucket:`none`,tone:`running`,shape:`ring`,pulse:!1,label:`waiting for capacity`},queued:{bucket:`none`,tone:`neutral`,shape:`ring`,pulse:!1,label:`queued`},done:{bucket:`none`,tone:`success`,shape:`filled`,pulse:!1,label:`done`},cancelled:{bucket:`none`,tone:`neutral`,shape:`filled`,pulse:!1,label:`cancelled`},unseen:{bucket:`unseen`,tone:`accent`,shape:`filled`,pulse:!1,label:`unseen`}},Oo={rung:`waiting-for-capacity`,...Do[`waiting-for-capacity`]};function q(e){return e===`waiting-for-capacity`?Oo:{rung:e,...Do[e]}}function ko(e){return Array.isArray(e.waits)&&e.waits.some(e=>e?.kind===`worker`&&e.phase===`resolved`)}function Ao(e,t){let n=q(`waiting-on-workers`),r=kr(e.delegation)&&!t.replies&&!!t.count;if(e.delegation?.role===`worker`&&!r)return{...n,shape:`ring`,label:`waiting on parent reply`};if(t.replies)return{...n,label:t.peers?`waiting on replies`:`waiting on worker replies`};let i=t.count;return{...n,label:i?`waiting on ${i} worker${i===1?``:`s`}`:n.label}}function jo(e){let t=ta(e);return t?.kind===`workers`?Ao(e,t).label:void 0}function Mo(e){let t=e.count;return{...q(`waiting-on-workers`),shape:`ring`,label:t?`waiting on ${t} task${t===1?``:`s`}`:`waiting on tasks`}}function No(e){let t=e.count,n=q(`waiting-on-subagents`);return{...n,label:t?`waiting for ${t} subagent${t===1?``:`s`}`:n.label}}function Po(e,t){if(!(e.status!==`waiting`&&e.status!==`queued`)){if(t?.kind===`usage-limit`)return`usage-limit`;if(e.delegation?.role!==`invalid`&&ko(e))return`waiting-for-capacity`;if(e.status===`waiting`){switch(t?.kind){case`workers`:case`peers`:return`waiting-on-workers`;case`subagents`:return`waiting-on-subagents`;case`pr`:return t.until===`checks`?`waiting-for-ci`:`waiting-for-merge`;case`process`:return`waiting-for-command`;case`timer`:return`monitoring`}return t===void 0&&ea(e)?`waiting-for-capacity`:`needs-you`}}}var Fo=[(e,t)=>t?.kind===`human`&&(t.shown||e.status===`waiting`)?`needs-you`:void 0,e=>e.status===`review`?`needs-review`:void 0,e=>e.status===`running`?`running`:void 0,Po,e=>To(e)?`unseen`:void 0,e=>e.status===`queued`?`queued`:void 0,e=>e.status===`done`?`done`:void 0];function Io(e,t){for(let n of Fo){let r=n(e,t);if(r!==void 0)return r}return`cancelled`}function Lo(e){if(wo(e))return q(`needs-permission`);if(e.status===`failed`)return q(`failed`);let t=e.status===`waiting`||e.status===`queued`||e.status===`running`?ta(e):void 0,n=Io(e,t);return n===`waiting-on-workers`&&t?.kind===`workers`?Ao(e,t):n===`waiting-on-workers`&&t?.kind===`peers`?Mo(t):n===`waiting-on-subagents`&&t?.kind===`subagents`?No(t):q(n)}var Ro=new Set([`waiting`,`permission`]);function zo(e){return Ro.has(Do[e].bucket)}function Bo(e){return e.archived!==!0&&zo(Lo(e).rung)}var Vo=[`needs-you`,`failed`,`done`,`cancelled`,`running`,`waiting-workers`,`waiting-ci`,`waiting-timer`,`waiting-other`],Ho=[`needs-you`,`failed`,`done`,`cancelled`],Uo=2048,Wo=1024,Go=/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/,Ko=/^[a-z0-9][a-z0-9-]{0,63}$/,qo=1e3,Jo=/^[A-Za-z0-9_-]{1,64}$/,Yo=64*1024,Xo=w(Vo),Zo=x({id:O(),name:O(),description:O().optional(),url:O(),tokenSet:A(),tasks:A(),triggers:u(Xo).optional(),agent:A()}),Qo=x({id:O(),name:O(),root:O(),addedAt:O(),lastOpenedAt:O(),source:w([`local`,`checkout`]),status:w([`ok`,`missing`,`not-git`]),branch:O().optional(),forge:C(`github`).optional(),repoUrl:O().optional(),maxParallel:v().optional(),tags:u(O()).optional(),webhook:x({url:O(),tokenSet:A(),triggers:u(Xo).optional()}).optional(),webhooks:u(Zo).optional()});x({projects:u(Qo),bootProject:O(),projectsDir:O()});var $o=x({project:Qo,error:O().optional()});x({removed:C(!0),id:O()}),x({project:Qo});var es=O().trim().max(Uo).pipe(ne({protocol:/^https?$/,error:`webhook url must be an http(s) URL`})).refine(e=>!/^https?:\/\/[^/?#]*@/i.test(e),`webhook url must not contain credentials; put the secret in the token`),ts=x({url:es,token:O().trim().max(Wo).optional(),triggers:u(Xo).refine(e=>new Set(e).size===e.length,`webhook triggers must not repeat`).optional()}),ns=u(Xo).refine(e=>new Set(e).size===e.length,`webhook triggers must not repeat`),rs=O().trim().min(1,`webhook name is required`).max(80),is=O().trim().max(qo),as=O().trim().max(Wo);x({name:rs,description:is.optional(),url:es,token:as.optional(),tasks:A().optional(),triggers:ns.optional(),agent:A().optional()}),x({name:rs.optional(),description:is.optional(),url:es.optional(),token:as.optional(),tasks:A().optional(),triggers:ns.optional(),agent:A().optional()}).refine(e=>Object.values(e).some(e=>e!==void 0),`specify at least one webhook field`),x({projectId:O(),webhookId:O().regex(Jo,`unknown webhook`)}),x({project:Qo,webhook:Zo});var os=x({id:O(),name:O(),description:O().optional()});x({webhooks:u(os)}),x({projectId:O(),webhook:O().min(1).max(80)}),x({runId:O().min(1).max(128).optional(),title:O().trim().min(1).max(200).optional(),message:O().trim().min(1,`message is required`).max(Yo),data:j(O(),te()).optional()}),x({ok:A(),webhook:os.pick({id:!0,name:!0}),deliveryId:O(),attempts:v(),status:v().optional(),error:O().optional(),dryRun:A().optional()}),x({ok:A(),status:v().optional(),error:O().optional(),dryRun:A().optional()}),x({maxParallel:v().int().min(1).max(16).nullable().optional(),tags:u(O().trim().min(1).max(32)).max(20).nullable().optional(),webhook:ts.nullable().optional()}).refine(e=>e.maxParallel!==void 0||e.tags!==void 0||e.webhook!==void 0,`specify maxParallel, tags or webhook`),x({url:O().trim().min(1).max(512),name:O().trim().max(128).optional(),checkoutId:O().trim().max(128).optional()}),x({name:O().trim().regex(Go),github:x({owner:O().trim().min(1).max(64),template:O().trim().max(512).optional()}).optional(),checkoutId:O().trim().max(128).optional()}),$o.extend({warning:O().optional()});var ss=x({login:O(),personal:A(),avatarUrl:O().optional(),description:O().optional()}),cs=S(`available`,[x({available:C(!0),owners:u(ss)}),x({available:C(!1),reason:O()})]),ls=x({name:O(),path:O(),isRepo:A()});x({path:O(),parent:O().nullable(),dirs:u(ls),truncated:A()}),x({checkoutId:O().min(1).max(128)}),x({progress:se.nullable()}),x({root:O().trim().min(1).max(4096)});var us=x({status:O(),path:O()}),ds=x({runId:O(),title:O(),prNumber:v().nullable()}),fs=x({hash:O(),subject:O(),author:O(),when:O(),at:O(),source:ds.optional()}),ps=x({ref:O(),ahead:v(),behind:v(),fetchedAt:O().nullable()});_([x({info:ie(),status:u(h()),log:u(h()),branches:u(h()),baseBranch:ie(),tracking:ie()}),x({info:jt,status:u(us),log:u(fs),branches:u(O()),baseBranch:O().nullable(),tracking:ps.nullable()})]),x({branch:O(),created:A()});var ms=w([`active`,`not-landed`,`orphan`,`merged`,`empty`,`other`]),hs=w([`open`,`draft`,`merged`,`closed`]),gs=x({name:O(),class:ms,runId:O().nullable(),title:O().nullable(),runStatus:R.nullable(),ahead:v(),lastCommit:x({sha:O(),subject:O(),at:O()}),diffStat:x({additions:v(),deletions:v()}).nullable(),pr:x({number:v(),url:O(),state:hs}).nullable(),keptReason:O().optional(),parentRunId:O().optional()});x({base:O(),prStateKnown:A(),branches:u(gs),counts:x({notLanded:v(),cleanup:v()})}).pick({base:!0,prStateKnown:!0,counts:!0}).extend({allBranches:v()}),x({names:u(O().trim().min(1).max(250)).min(1).max(500),confirm:O().optional()});var _s=x({name:O(),reason:O()});x({deleted:u(O()),refused:u(_s),dropped:u(x({sha:O(),subject:O()})).optional()}),x({error:O(),refused:u(_s)}),x({branches:u(O())}),x({branch:O().trim().min(1).max(200).optional(),confirm:A().optional()});var vs=x({branch:O(),pulled:C(!0),summary:O()}),ys=x({error:O(),branch:O(),risks:u(w([`active_runs`,`dirty_tree`]))});_([ys,x({error:O()})]);var bs=x({adds:v(),dels:v(),files:v()}),xs=x({path:O(),oldPath:O().optional(),status:w([`added`,`modified`,`deleted`,`renamed`,`copied`]),adds:v(),dels:v(),binary:A(),image:A().optional(),patch:O()});x({files:u(xs),stat:bs,repointedHead:x({headBranch:O(),taskBranch:O()}).optional()}),x({sha:O(),subject:O(),author:O(),when:O(),files:u(xs),stat:bs});var Ss=x({name:O(),type:w([`dir`,`file`]),size:v().optional()});S(`type`,[x({type:C(`dir`),path:O(),entries:u(Ss)}),x({type:C(`file`),path:O(),size:v(),binary:A(),tooLarge:A(),content:O().optional()})]),x({worktrees:u(x({runId:O(),title:O(),status:R,branch:O().nullable(),sizeBytes:v().nullable(),finishedAt:O().nullable(),reclaimable:A(),pastKeep:A()})),totalBytes:v().nullable(),keep:v()}),x({runId:O(),worktreeReclaimedAt:O()}),x({reclaimed:u(O())});var J=class extends Error{status;manual;command;exists;constructor(e,t,n={}){super(t,n.cause===void 0?void 0:{cause:n.cause}),this.name=`ApiError`,this.status=e,this.manual=n.manual,this.command=n.command,this.exists=n.exists}};function Cs(e){try{return JSON.parse(e)}catch{return}}function ws(e){return typeof e==`string`?e:void 0}function Y(e,t,n){let r=Cs(n),i=r&&typeof r==`object`?r:{};return new J(e,ws(i.error)??`${e} ${t||`request failed`}`.trim(),{manual:ws(i.manual),command:ws(i.command),exists:typeof i.exists==`boolean`?i.exists:void 0})}var X=xo({fetch:(e,t)=>ks(Ts(String(e)),t)});function Ts(e){let t=Ds(e.endsWith(`?`)?e.slice(0,-1):e);return t.startsWith(`/`)?`${r()}${t}`:t}var Es=`${o}/p/default`;function Ds(e){if(s()!==null||!e.startsWith(Es))return e;let t=e.slice(Es.length);return t===``||t.startsWith(`/`)||t.startsWith(`?`)?`${o}${t}`:e}var Z=e=>({init:{...l({signal:e?.signal})}});async function Q(e,t){let n=await e.text();if(!e.ok)throw Y(e.status,e.statusText,n);let r=Cs(n);if(r===void 0)throw new J(e.status,`the Squawk server answered ${t} with a non-JSON body`);return r}async function Os(e,t,n){let r=e.status,i=await Q(e,t),a=n.safeParse(i);if(!a.success)throw new J(r,`the Squawk server answered ${t} with an unexpected body`);return a.data}async function ks(e,t){try{let n=await fetch(e,{...t,credentials:`include`});return n.ok&&t?.method&&![`GET`,`HEAD`].includes(t.method.toUpperCase())&&on(),n}catch(t){throw t instanceof DOMException&&t.name===`AbortError`?t:new J(0,`cannot reach the Squawk server (${e})`,{cause:t})}}async function As(e,t){return ks(c(e),t)}async function js(e,t={}){let n=new Headers(t.headers);n.set(`accept`,`text/plain`);let r=await As(e,{...t,headers:n}),i=await r.text();if(!r.ok)throw Y(r.status,r.statusText,i);return i}var $=(e,t=``)=>`/runs/${encodeURIComponent(e)}${t}`;async function Ms(e){return Q(await X.api.v1.health.$get({},Z(e)),`/health`)}async function Ns(e,t){return Q(await X.api.v1.models.$get({query:{runner:e}},Z(t)),`/models`)}async function Ps(e=!1,t){return Sn(await Q(await X.api.v1.providers.status.$get({query:e?{refresh:`1`}:{}},Z(t)),`/providers/status`))}async function Fs(e){return Q(await X.api.v1.projects.$get({},Z(e)),`/projects`)}async function Is(e,t){return Q(await X.api.v1.fs.browse.$get({query:{path:e===``?void 0:e,...t?.showHidden?{showHidden:`1`}:{}}},Z(t)),`/fs/browse`)}async function Ls(e,t){return Q(await X.api.v1.p[`:projectId`][`run-summaries`].$get({param:{projectId:e.projectId},query:{archived:`recent`}},Z(t)),`/run-summaries`)}async function Rs(e,t){let n={...e.before===void 0?{}:{before:e.before},...e.limit===void 0?{}:{limit:e.limit},...e.q?{q:e.q}:{}};return Os(await X.api.v1.p[`:projectId`][`run-summaries`].archived.$get({param:{projectId:a()},query:n},Z(t)),`/run-summaries/archived`,ro)}async function zs(e){return Q(await X.api.v1.workspace[`runs-index`].$get({},Z(e)),`/workspace/runs-index`)}async function Bs(e,t){return Os(await X.api.v1.workspace[`runs-search`].$get({query:{q:e}},Z(t)),`/workspace/runs-search`,io)}async function Vs(e,t){return Os(await X.api.v1.p[`:projectId`].runs[`:id`].relationships.$get({param:{projectId:a(),id:encodeURIComponent(e)},query:{}},Z(t)),`${$(e)}/relationships`,Lr)}async function Hs({projectId:e,runId:t},n){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:e,id:encodeURIComponent(t)}},Z(n)),$(t))}async function Us(e,t,n){return Os(await X.api.v1.p[`:projectId`].runs[`:id`].history.$get({param:{projectId:a(),id:encodeURIComponent(e)},query:{...t===void 0?{}:{cursor:t}}},Z(n)),`${$(e)}/history`,me)}async function Ws(e,t){return Os(await X.api.v1.p[`:projectId`].runs[`:id`][`history-context`].$get({param:{projectId:a(),id:encodeURIComponent(e)}},Z(t)),`${$(e)}/history-context`,de)}async function Gs(e,t=a()){return Q(await X.api.v1.p[`:projectId`][`ui-state`].$get({param:{projectId:t}},Z(e)),`/ui-state`)}async function Ks(e){return Q(await X.api.v1.p[`:projectId`].workflows.$get({param:{projectId:e?.projectId??a()}},Z(e)),`/workflows`)}async function qs(e,t,n){return Q(await X.api.v1.p[`:projectId`][`runner-skills`].$get({param:{projectId:n?.projectId??a()},query:{runner:e,...t?{account:t}:{},...n?.refresh?{refresh:`1`}:{}}},Z(n)),`/runner-skills`)}async function Js(e,t){return Q(await X.api.v1.p[`:projectId`].repo.$get({param:{projectId:t??a()}},Z(e)),`/repo`)}async function Ys(e,t){return Q(await X.api.v1.p[`:projectId`].repo.branches.$get({param:{projectId:t??a()}},Z(e)),`/repo/branches`)}async function Xs(e){return Q(await X.api.v1.p[`:projectId`].repo.branches.delete.$post({param:{projectId:a()},json:e}),`/repo/branches/delete`)}async function Zs(e,t){let n=await X.api.v1.p[`:projectId`].repo.pull.$post({param:{projectId:t??a()},json:e}),r=await n.text(),i=Cs(r);if(n.status===409){let e=ys.safeParse(i);if(e.success)return e.data;throw Y(n.status,n.statusText,r)}if(!n.ok)throw Y(n.status,n.statusText,r);if(i===void 0)throw new J(n.status,`the Squawk server answered /repo/pull with a non-JSON body`);let o=vs.safeParse(i);if(!o.success)throw new J(n.status,`the Squawk server answered /repo/pull with an unexpected body`);return o.data}async function Qs(e){return Q(await X.api.v1.p[`:projectId`].config.$get({param:{projectId:a()}},Z(e)),`/config`)}async function $s(e={}){return Q(await X.api.v1.p[`:projectId`][`agent-config`].$get({param:{projectId:a()}},Z(e)),`/agent-config`)}async function ec(e,t={}){return Q(await X.api.v1.p[`:projectId`][`agent-config`][`:id`].$get({param:{projectId:a(),id:encodeURIComponent(e)}},Z(t)),`/agent-config/${encodeURIComponent(e)}`)}async function tc(e,t){return Q(await X.api.v1.p[`:projectId`][`agent-config`][`:id`].$put({param:{projectId:a(),id:encodeURIComponent(e)},json:t}),`/agent-config/${encodeURIComponent(e)}`)}async function nc(e){return Q(await X.api.v1.p[`:projectId`].repo.changes.$get({param:{projectId:a()}},Z(e)),`/repo/changes`)}async function rc(e,t){return Q(await X.api.v1.p[`:projectId`].repo.commit[`:sha`].$get({param:{projectId:t?.projectId??a(),sha:encodeURIComponent(e)},query:{structured:`1`}},Z(t)),`/repo/commit/:sha`)}async function ic(e,t){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].commits.$get({param:{projectId:a(),id:encodeURIComponent(e)}},Z(t)),$(e,`/commits`))}async function ac(e,t,n){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].commit[`:sha`].$get({param:{projectId:n?.projectId??a(),id:encodeURIComponent(e),sha:encodeURIComponent(t)}},Z(n)),$(e,`/commit/${encodeURIComponent(t)}`))}async function oc(e={},t){return Q(await X.api.v1.p[`:projectId`].github.$get({param:{projectId:e.projectId??a()},query:{limit:e.limit===void 0?void 0:String(e.limit),refresh:e.refresh?`1`:void 0,issuesCursor:e.issuesCursor,prsCursor:e.prsCursor,issuesDone:e.issuesDone?`1`:void 0,prsDone:e.prsDone?`1`:void 0}},Z(t)),`/github`)}async function sc(e,t,n={},r){return Q(await X.api.v1.p[`:projectId`].github[`comment-counts`].$get({param:{projectId:a()},query:{kind:e,numbers:t.join(`,`),refresh:n.refresh?`1`:void 0}},Z(r)),`/github/comment-counts`)}async function cc(e,t){return Q(await X.api.v1.p[`:projectId`].github.projects.$get({param:{projectId:a()},query:{generation:e}},Z(t)),`/github/projects`)}async function lc(e,t){return Q(await X.api.v1.p[`:projectId`].github.checks.$get({param:{projectId:a()},query:{prs:e.join(`,`)}},Z(t)),`/github/checks`)}async function uc(e,t,n={},r){return Q(await X.api.v1.p[`:projectId`].github.search.$get({param:{projectId:n.projectId??a()},query:{kind:e,q:t,limit:n.limit}},Z(r)),`/github/search`)}async function dc(e,t,n){return Q(await X.api.v1.p[`:projectId`].github[`ref-status`].$get({param:{projectId:e},query:{...t.prs?.length?{prs:t.prs.join(`,`)}:{},...t.issues?.length?{issues:t.issues.join(`,`)}:{}}},Z(n)),`/github/ref-status`)}async function fc(e,t,n={},r){return Q(await X.api.v1.p[`:projectId`].github.comments[`:kind`][`:number`].$get({param:{projectId:a(),kind:e,number:String(t)},query:{refresh:n.refresh?`1`:void 0}},Z(r)),`/github/comments/${e}/${t}`)}async function pc(e,t,n={},r){return Q(await X.api.v1.p[`:projectId`].github.items[`:kind`][`:number`].$get({param:{projectId:r?.projectId??a(),kind:e,number:String(t)},query:{refresh:n.refresh?`1`:void 0}},Z(r)),`/github/items/${e}/${t}`)}async function mc(e,t={},n){return Q(await X.api.v1.p[`:projectId`].github.prs[`:number`][`merge-state`].$get({param:{projectId:a(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},Z(n)),`/github/prs/${e}/merge-state`)}async function hc(e,t){return Q(await X.api.v1.p[`:projectId`].github.prs[`:number`].merge.$post({param:{projectId:a(),number:String(e)},json:t}),`/github/prs/:number/merge`)}async function gc(e,t={},n){return Q(await X.api.v1.p[`:projectId`].github.prs[`:number`].changes.$get({param:{projectId:a(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},Z(n)),`/github/prs/${e}/changes`)}function _c(e,t){return js($(e,`/diff`),{method:`GET`,...l({signal:t?.signal})})}async function vc({projectId:e,runId:t},n){let r=await X.api.v1.p[`:projectId`].runs[`:id`].handoff.$get({param:{projectId:e,id:encodeURIComponent(t)}},{init:{...l({signal:n?.signal})},headers:{accept:`text/plain`}}),i=await r.text();if(!r.ok)throw Y(r.status,r.statusText,i);return i}async function yc(e,t){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].changes.$get({param:{projectId:a(),id:encodeURIComponent(e)}},Z(t)),$(e,`/changes`))}async function bc(e,t,n){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].files.$get({param:{projectId:a(),id:encodeURIComponent(e)},query:{path:t}},Z(n)),`/runs/:id/files`)}async function xc(e,t,n){return Q(await X.api.v1.p[`:projectId`].runs[`:id`][`file-link`].$get({param:{projectId:a(),id:e},query:{path:t}},Z(n)),`/runs/:id/file-link`)}async function Sc(e,t){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].artifacts.$get({param:{projectId:a(),id:e}},Z(t)),`/runs/:id/artifacts`)}async function Cc(e,t,n){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].artifacts[`:artifactId`].$get({param:{projectId:a(),id:e,artifactId:t}},Z(n)),`/runs/:id/artifacts/:artifactId`)}async function wc(e,t,n){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].artifacts[`:artifactId`].metadata.$get({param:{projectId:a(),id:e,artifactId:t}},Z(n)),`/runs/:id/artifacts/:artifactId/metadata`)}function Tc(e,t,n){return c($(e,`/artifacts/${encodeURIComponent(t)}/${n}`))}function Ec(e,t){return c($(e,`/file-link?path=${encodeURIComponent(t)}&raw=1`))}function Dc(e,t){return c($(e,`/files?path=${encodeURIComponent(t)}&raw=1`))}async function Oc(e,t){return Q(await X.api.v1.providers.connect.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/connect`)}async function kc(e,t){return Sn(await Q(await X.api.v1.providers[`:provider`].enabled.$put({param:{provider:e},json:{enabled:t}}),`/providers/${encodeURIComponent(e)}/enabled`))}async function Ac(e,t){return Sn(await Q(await X.api.v1.providers[`:provider`].retry.$post({param:{provider:e},json:{authFailureId:t}}),`/providers/${encodeURIComponent(e)}/retry`))}async function jc(e){let t=`/projects`,n=await As(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({root:e})}),r=await n.text(),i=Cs(r),a=i?.project;if((n.ok||n.status===409)&&a!=null)return i;throw n.ok?new J(n.status,`the Squawk server answered ${t} without a project`):Y(n.status,n.statusText,r)}async function Mc(e){return Q(await X.api.v1.projects.checkout.$post({json:e}),`/projects/checkout`)}async function Nc(e){return Q(await X.api.v1.projects.create.$post({json:e}),`/projects/create`)}async function Pc(e){return Os(await X.api.v1.projects[`github-owners`].$get({},Z(e)),`/projects/github-owners`,cs)}async function Fc(e){return Q(await X.api.v1.projects[`:projectId`].$delete({param:{projectId:encodeURIComponent(e)}}),`/projects/${encodeURIComponent(e)}`)}async function Ic(e,t){return Q(await X.api.v1.projects[`:projectId`].$patch({param:{projectId:encodeURIComponent(e)},json:t}),`/projects/${encodeURIComponent(e)}`)}async function Lc(e,t){return Q(await X.api.v1.projects[`:projectId`].webhooks.$post({param:{projectId:encodeURIComponent(e)},json:t}),`/projects/${encodeURIComponent(e)}/webhooks`)}async function Rc(e,t,n){return Q(await X.api.v1.projects[`:projectId`].webhooks[`:webhookId`].$patch({param:{projectId:encodeURIComponent(e),webhookId:encodeURIComponent(t)},json:n}),`/projects/${encodeURIComponent(e)}/webhooks/${encodeURIComponent(t)}`)}async function zc(e,t){return Q(await X.api.v1.projects[`:projectId`].webhooks[`:webhookId`].$delete({param:{projectId:encodeURIComponent(e),webhookId:encodeURIComponent(t)}}),`/projects/${encodeURIComponent(e)}/webhooks/${encodeURIComponent(t)}`)}async function Bc(e,t){return Q(await X.api.v1.projects[`:projectId`].webhooks[`:webhookId`].test.$post({param:{projectId:encodeURIComponent(e),webhookId:encodeURIComponent(t)}}),`/projects/${encodeURIComponent(e)}/webhooks/${encodeURIComponent(t)}/test`)}async function Vc(e,t){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].notify.$post({param:{projectId:a(),id:encodeURIComponent(e)},json:t}),$(e,`/notify`))}async function Hc(e){return Q(await X.api.v1.p[`:projectId`].runs.$post({param:{projectId:a()},json:e}),`/runs`)}async function Uc(e){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].cancel.$post({param:{projectId:a(),id:encodeURIComponent(e)}}),$(e,`/cancel`))}async function Wc(e){return Q(await X.api.v1.p[`:projectId`].runs[`:id`][`worker-destroy`].$post({param:{projectId:a(),id:encodeURIComponent(e)},query:{},json:{}}),$(e,`/worker-destroy`))}async function Gc({projectId:e,runId:t},n=!0){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{archived:n}}),$(t,`/archive`))}async function Kc({projectId:e,runId:t},n=!0){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{pinned:n}}),$(t,`/pin`))}async function qc({projectId:e,runId:t},n){let r=n?`read`:`unread`;return Q(await(n?X.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:e,id:encodeURIComponent(t)}}):X.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:e,id:encodeURIComponent(t)}})),$(t,`/${r}`))}async function Jc(e){return Q(await X.api.v1.p[`:projectId`].runs[`:id`][`auto-resume`].$delete({param:{projectId:a(),id:encodeURIComponent(e)}}),$(e,`/auto-resume`))}async function Yc({projectId:e},t,n){return Q(await X.api.v1.p[`:projectId`].runs[`archive-finished`].$post({param:{projectId:e},json:{...t?{scope:t}:{},...n===void 0?{}:{automation:n}}}),`/runs/archive-finished`)}async function Xc(e){return Q(await X.api.v1.p[`:projectId`].runs[`read-all`].$post({param:{projectId:a()},json:e===void 0?{}:{automation:e}}),`/runs/read-all`)}async function Zc(e){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].finish.$post({param:{projectId:a(),id:encodeURIComponent(e)}}),$(e,`/finish`))}async function Qc({projectId:e,runId:t},n={}){let r={...n.text===void 0?{}:{text:n.text},...n.images===void 0?{}:{images:n.images},...n.runner===void 0?{}:{runner:n.runner},...n.model===void 0?{}:{model:n.model},...n.effort===void 0?{}:{effort:n.effort},...n.agentProfile===void 0?{}:{agentProfile:n.agentProfile}};return Q(await X.api.v1.p[`:projectId`].runs[`:id`].continue.$post({param:{projectId:e,id:encodeURIComponent(t)},json:r}),$(t,`/continue`))}async function $c(e){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].pr.$post({param:{projectId:a(),id:encodeURIComponent(e)}}),$(e,`/pr`))}async function el(e,t){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].$patch({param:{projectId:a(),id:encodeURIComponent(e)},json:t}),$(e))}async function tl(e){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].$delete({param:{projectId:a(),id:encodeURIComponent(e)}}),$(e))}async function nl(e){return Q(await X.api.v1.p[`:projectId`].runs[`:id`][`open-in-cli`].$post({param:{projectId:a(),id:encodeURIComponent(e)}}),$(e,`/open-in-cli`))}async function rl(e){return Q(await X.api.v1.p[`:projectId`][`open-targets`].$get({param:{projectId:a()}},Z(e)),`/open-targets`)}async function il(e,t=a()){return Q(await X.api.v1.p[`:projectId`][`open-in`].$post({param:{projectId:t},json:{target:e}}),`/open-in`)}async function al(e,t){return Q(await X.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:a(),id:encodeURIComponent(e)},json:{target:t}}),$(e,`/open-in`))}async function ol(e,t){return Q(await X.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:a(),id:encodeURIComponent(e)},json:{target:`default`,path:t}}),$(e,`/open-in`))}async function sl(e,t){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].git.commit.$post({param:{projectId:a(),id:encodeURIComponent(e)},json:{message:t}}),$(e,`/git/commit`))}async function cl(e){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].git.push.$post({param:{projectId:a(),id:encodeURIComponent(e)}}),$(e,`/git/push`))}async function ll(e,t){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].permissions.$post({param:{projectId:a(),id:encodeURIComponent(e)},json:t}),$(e,`/permissions`))}async function ul({projectId:e,runId:t},n){return Q(await X.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{text:n.text??``,images:n.images??[]}}),$(t,`/messages`))}async function dl(e,t,n){return Q(await X.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$patch({param:{projectId:a(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)},json:n}),$(e,`/queued-messages/${encodeURIComponent(t)}`))}async function fl(e,t){return Q(await X.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$delete({param:{projectId:a(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)}}),$(e,`/queued-messages/${encodeURIComponent(t)}`))}async function pl(e,t){return Q(await X.api.v1.p[`:projectId`].repo.branch.$post({param:{projectId:t??a()},json:e}),`/repo/branch`)}async function ml(e){return Q(await X.api.v1.p[`:projectId`].plan.$post({param:{projectId:a()},json:{task:e}}),`/plan`)}async function hl(e){return Q(await X.api.v1.p[`:projectId`].automations.$get({param:{projectId:e?.projectId??a()},query:e?.archived?{archived:e.archived}:{}},Z(e)),`/automations`)}async function gl(e){return Q(await X.api.v1.p[`:projectId`].automations.$post({param:{projectId:a()},json:e}),`/automations`)}async function _l(e,t){return Q(await X.api.v1.p[`:projectId`].automations[`:id`].$put({param:{projectId:a(),id:encodeURIComponent(e)},json:t}),`/automations/${encodeURIComponent(e)}`)}async function vl(e,t){let n={projectId:a(),id:encodeURIComponent(e)},r=`/automations/${encodeURIComponent(e)}/${t?`enable`:`pause`}`;return Q(t?await X.api.v1.p[`:projectId`].automations[`:id`].enable.$post({param:n}):await X.api.v1.p[`:projectId`].automations[`:id`].pause.$post({param:n}),r)}async function yl(e,t){return Q(await X.api.v1.p[`:projectId`].automations[`:id`].check.$post({param:{projectId:a(),id:encodeURIComponent(e)},json:{mode:t}}),`/automations/${encodeURIComponent(e)}/check`)}async function bl(e){return Q(await X.api.v1.p[`:projectId`].automations[`:id`].cancel.$post({param:{projectId:a(),id:encodeURIComponent(e)}}),`/automations/${encodeURIComponent(e)}/cancel`)}async function xl(e){let t=await X.api.v1.p[`:projectId`].automations[`:id`].$delete({param:{projectId:a(),id:encodeURIComponent(e)}});if(!t.ok)throw Y(t.status,t.statusText,await t.text())}async function Sl(e){return Q(await X.api.v1.p[`:projectId`].automations[`:id`].run.$post({param:{projectId:a(),id:encodeURIComponent(e)}}),`/automations/${encodeURIComponent(e)}/run`)}async function Cl(e){return Q(await X.api.v1.p[`:projectId`][`automation-log`][`:receiptId`].retry.$post({param:{projectId:a(),receiptId:encodeURIComponent(e)}}),`/automation-log/${encodeURIComponent(e)}/retry`)}async function wl(e,t){return Q(await X.api.v1[`automation-checks`][`:checkId`].$get({param:{checkId:encodeURIComponent(e)}},Z(t)),`/automation-checks/${encodeURIComponent(e)}`)}async function Tl(e,t){return Q(await X.api.v1.p[`:projectId`][`automation-log`].$get({param:{projectId:a()},query:{automationId:e}},Z(t)),`/automation-log?automationId=${encodeURIComponent(e)}`)}async function El(e){return Q(await X.api.v1.p[`:projectId`].workflows.$post({param:{projectId:a()},json:e}),`/workflows`)}async function Dl(e){return Q(await X.api.v1.p[`:projectId`].workflows.parse.$post({param:{projectId:a()},json:{yaml:e}}),`/workflows/parse`)}async function Ol(e){return Q(await X.api.v1.p[`:projectId`].workflows[`:name`].$delete({param:{projectId:a(),name:encodeURIComponent(e)}}),`/workflows/${encodeURIComponent(e)}`)}async function kl(e,t=a()){return Q(await X.api.v1.p[`:projectId`][`ui-state`].$put({param:{projectId:t},json:e}),`/ui-state`)}async function Al(e){return Q(await X.api.v1.workspace[`ui-state`].$get({},Z(e)),`/workspace/ui-state`)}async function jl(e,t={}){return Q(await X.api.v1.workspace[`ui-state`].$put({json:e},{init:{...l({keepalive:t.keepalive})}}),`/workspace/ui-state`)}async function Ml(e){let t=await Q(await X.api.v1.workspace.config.$get({},Z(e)),`/workspace/config`);return{...t,agentDefaults:t.agentDefaults??{}}}async function Nl(e){let t=await Q(await X.api.v1.workspace[`agent-profiles`].$get({},Z(e)),`/workspace/agent-profiles`);return{...t,profileCapableProviders:t.profileCapableProviders??[],selections:t.selections??{},profiles:t.profiles??[]}}async function Pl(e){return Q(await X.api.v1.workspace[`agent-profiles`].$post({json:e}),`/workspace/agent-profiles`)}async function Fl(e,t){return Q(await X.api.v1.workspace[`agent-profiles`][`:id`].status.$get({param:{id:encodeURIComponent(e)},query:t?.refresh?{refresh:`1`}:{}},Z(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/status`)}async function Il(e){return Q(await X.api.v1.workspace[`agent-profiles`].selection.$put({json:e}),`/workspace/agent-profiles/selection`)}async function Ll(e,t){return Q(await X.api.v1.workspace[`agent-profiles`][`:id`].$patch({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function Rl(e){return Q(await X.api.v1.workspace[`agent-profiles`][`:id`].$delete({param:{id:encodeURIComponent(e)}}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function zl(e){return Q(await X.api.v1.workspace.config.$put({json:e}),`/workspace/config`)}async function Bl(e,t){return Q(await X.api.v1.p[`:projectId`].config.$put({param:{projectId:t??a()},json:e}),`/config`)}async function Vl(e,t){return Q(await X.api.v1.p[`:projectId`].worktrees.$get({param:{projectId:t??a()}},Z(e)),`/worktrees`)}async function Hl(){return Q(await X.api.v1.p[`:projectId`].worktrees.reclaim.$post({param:{projectId:a()},json:{}}),`/worktrees/reclaim`)}async function Ul(e){return Q(await X.api.v1.p[`:projectId`].worktrees[`:runId`].reclaim.$post({param:{projectId:a(),runId:encodeURIComponent(e)}}),`/worktrees/${encodeURIComponent(e)}/reclaim`)}async function Wl(e,t){return Q(await X.api.v1.projects.checkout[`:checkoutId`].progress.$get({param:{checkoutId:e}},Z(t)),`/projects/checkout/progress`)}var Gl={projectId:null,apiBase:o},Kl=(0,P.createContext)(Gl);function ql(){return(0,P.useContext)(Kl)}function Jl({projectId:e,children:t}){s()!==e&&i(e),(0,P.useLayoutEffect)(()=>{i(e)},[e]),(0,P.useLayoutEffect)(()=>()=>i(null),[]);let n=(0,P.useMemo)(()=>e===null?Gl:{projectId:e,apiBase:`${o}/p/${encodeURIComponent(e)}`},[e]);return(0,ft.jsx)(Kl.Provider,{value:n,children:t})}export{pc as $,Ti as $n,tt as $r,Hl as $t,Ol as A,q as An,dn as Ar,Ml as At,Cc as B,eo as Bn,F as Br,nl as Bt,Hc as C,qo as Cn,Dn as Cr,Vs as Ct,xl as D,Co as Dn,cn as Dr,zs as Dt,ll as E,So as En,sn as Er,Ls as Et,Fl as F,jo as Fn,qt as Fr,hc as Ft,hl as G,La as Gn,xt as Gr,Zs as Gt,Sc as H,Va as Hn,wt as Hr,el as Ht,$s as I,oo as In,Jt as Ir,Vc as It,xc as J,$i as Jn,bt as Jr,Bl as Jt,Wl as K,Na as Kn,Ct as Kr,cl as Kt,ec as L,to as Ln,Lt as Lr,il as Lt,dl as M,Bo as Mn,an as Mr,Vl as Mt,Ec as N,zo as Nn,fn as Nr,Z as Nt,Xs as O,Ho as On,Xt as Or,Gs as Ot,Zc as P,Eo as Pn,Ut as Pr,Xc as Pt,fc as Q,ki as Qn,at as Qr,Ul as Qt,Nl as R,qa as Rn,Mt as Rr,ol as Rt,pl as S,Go as Sn,Sn as Sr,Ws as St,El as T,Uo as Tn,rn as Tr,qs as Tt,wl as U,Ba as Un,Dt as Ur,Kc as Ut,wc as V,$a as Vn,Ot as Vr,Dl as Vt,Tl as W,Ia as Wn,Et as Wr,ml as Wt,lc as X,ta as Xn,ht as Xr,zl as Xt,oc as Y,qi as Yn,_t as Yr,kl as Yt,sc as Z,zi as Zn,mt as Zr,jl as Zt,Qc as _,Re as _i,Ll as _n,Mn as _r,ic as _t,Yc as a,ye as ai,Cl as an,mi as ar,uc as at,Nc as b,Rc as bn,wn as br,vc as bt,Is as c,Fe as ci,Dc as cn,kr as cr,Fs as ct,Uc as d,ve as di,ul as dn,Un as dr,Ys as dt,$e as ei,jc as en,vi as er,Pc as et,X as f,Ee as fi,vl as fn,In as fr,nc as ft,Oc as g,Be as gi,Q as gn,Fn as gr,ac as gt,sl as h,ke as hi,Bc as hn,Yn as hr,yc as ht,J as i,We as ii,fl as in,oi as ir,dc as it,Wc as j,Lo as jn,un as jr,Al as jt,tl as k,Vo as kn,ln as kr,Ks as kt,Jc as l,Ce as li,Bs as ln,sr as lr,Ps as lt,Mc as m,M as mi,qc as mn,Kn as mr,Hs as mt,Jl as n,Ye as ni,Fc as nn,bi as nr,mc as nt,Gc as o,Te as oi,Ac as on,H as or,Ms as ot,yl as p,Oe as pi,kc as pn,Gn as pr,rc as pt,Qs as q,Aa as qn,St as qr,tc as qt,ql as r,Je as ri,zc as rn,gi as rr,cc as rt,Tc as s,we as si,Sl as sn,ai as sr,rl as st,Kl as t,et as ti,Rl as tn,_i as tr,gc as tt,bl as u,Se as ui,Il as un,Hn as ur,Js as ut,Pl as v,ge as vi,_l as vn,R as vr,_c as vt,$c as w,Wo as wn,En as wr,Ns as wt,Lc as x,Ko as xn,bn as xr,Us as xt,gl as y,he as yi,Ic as yn,Cn as yr,bc as yt,Rs as z,no as zn,Nt as zr,al as zt};
|
package/web/dist/assets/{prompt-template-menu-CWB1yVtQ.js → prompt-template-menu-nShN9uXQ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{u as r}from"./button-RJMdCnZw.js";import{zt as i}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{u as r}from"./button-RJMdCnZw.js";import{zt as i}from"./queries-B6a1W2sa.js";import{N as a,S as o,a as s,o as c,r as l}from"./use-desktop-D3W91YLi.js";import{W as u,l as d,tt as f}from"./design-icons-B6-0w7Aw.js";import{c as p}from"./project-router-B73juPC3.js";import{S as m,_ as h,b as g,h as _,v,x as y,y as b}from"./picker-pill-CwbEYCjL.js";import{a as x}from"./skills-pM_PouEs.js";var S=n();function C({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`skeleton`,className:r(`animate-pulse rounded-md bg-accent`,e),...t})}var w=[`assigned`,`no-task`,`has-task`,`all`],T=[`review`,`mine`,`failing`,`all`],E=50,D=`is:open review-requested:@me`,O=`is:open status:failure`;function k(e,t){return e===`prs`&&(t===`review`||t===`failing`)}function A(e){return e===`review`?D:e===`failing`?O:null}function j(e,t){return t===null?null:(e===`issues`?w:T).includes(t)?t:`all`}function M(e,t,n,r=``){let i=`${n===void 0?e===`issues`?`/github`:`/github/prs`:`${e===`issues`?`/github/issues`:`/github/prs`}/${n}`}${r}`;return t===null?i:`${i}?filter=${encodeURIComponent(t)}`}function N(e,t){let n=t??`all`;return n===`all`?e===`issues`?`all`:`all-prs`:n}function P(e){return e===`all`?{view:`issues`,filter:`all`}:e===`all-prs`?{view:`prs`,filter:`all`}:{view:e===`review`||e===`mine`||e===`failing`?`prs`:`issues`,filter:e}}var F=[{id:`assigned`,label:`Assigned to me`},{id:`no-task`,label:`No task yet`},{id:`has-task`,label:`Has a task`},{id:`all`,label:`All open`}],I=[{id:`review`,label:`Review requested`},{id:`mine`,label:`Mine`},{id:`failing`,label:`Checks failing`},{id:`all-prs`,label:`All open`}],L=Object.fromEntries([...F,...I].map(e=>[e.id,e.label]));function R(e){return e===null?``:`${e.value}${e.bound===`atLeast`?`+`:``}`}function z(e,t){if(t?.bound===`atLeast`)return e===`review`||e===`failing`?`At least ${t.value}: GitHub search returns at most ${E} results.`:`At least ${t.value}: only the loaded pages are counted. Scroll to load more.`}var B=(e,t)=>e!==void 0&&t!==void 0&&e.toLowerCase()===t.toLowerCase();function V(e){try{let t=new URL(e).pathname.split(`/`).filter(Boolean);return t.length>=2?`${t[0]}/${t[1]}`.toLowerCase():null}catch{return null}}function H(e,t,n){return new Set(e.filter(e=>!e.archived).flatMap(e=>U(e,t,n)))}function U(e,t,n){let r=t?.toLowerCase();return o(e,void 0,n).filter(e=>e.kind===`Issue`&&(!e.url||r!==void 0&&V(e.url)===r)).map(e=>e.number)}function W(e,t,n,r){let i=new Map;for(let o of e)!a(o)&&U(o,n,r).includes(t)&&i.set(o.id,o);return[...i.values()].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt)||e.id.localeCompare(t.id))}function G(e,t){let n=new Map(t.map(e=>[e.number,e]));return e.map(e=>n.get(e.number)??e)}function K(e){return e?.available?{value:e.items.length,bound:e.truncated?`atLeast`:`exact`}:null}function q({gh:e,tasks:t,review:n,failing:r}){let a={assigned:null,"no-task":null,"has-task":null,all:null,review:K(n),mine:null,failing:K(r),"all-prs":null};if(!e?.available)return a;let o=!i(e,`issues`),s=!i(e,`prs`),c=(e,t)=>({value:e,bound:t?`atLeast`:`exact`}),l=t?e.issues.filter(e=>t.has(e.number)).length:null;return{...a,all:c(e.issuesTotal??e.issues.length,!1),"all-prs":c(e.prsTotal??e.prs.length,!1),assigned:e.viewerLogin?c(e.issues.filter(t=>t.assignees?.some(t=>B(t,e.viewerLogin))).length,o):null,mine:e.viewerLogin?c(e.prs.filter(t=>B(t.author,e.viewerLogin)).length,s):null,"has-task":l===null?null:c(l,o),"no-task":l===null?null:c(e.issues.length-l,o)}}var J=e(t(),1);function Y({templates:e,onInsert:t,triggerClassName:n,disabled:i,iconOnly:a=!1,label:o=`Template`}){let[C,w]=(0,J.useState)(!1),T=(0,J.useRef)(null),E=p();return e.length===0?null:(0,S.jsxs)(l,{open:C,onOpenChange:w,children:[(0,S.jsx)(c,{asChild:!0,children:(0,S.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:i,className:r(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,a?`w-[26px] justify-center px-0`:`h-11 gap-2 rounded-lg px-3 text-foreground`,n),children:[(0,S.jsx)(u,{"aria-hidden":`true`,className:a?`size-3 shrink-0 text-accent-icon`:`size-[18px] shrink-0 text-muted-foreground`}),a?null:(0,S.jsxs)(S.Fragment,{children:[o,(0,S.jsx)(d,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-soft-foreground`})]})]})}),(0,S.jsx)(s,{align:`start`,sideOffset:8,"data-slot":`prompt-template-menu`,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,onCloseAutoFocus:e=>e.preventDefault(),children:(0,S.jsxs)(_,{filter:x,children:[(0,S.jsx)(b,{placeholder:`search templates…`,onInput:()=>T.current?.scrollTo(0,0)}),(0,S.jsxs)(y,{ref:T,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,S.jsx)(h,{children:`Nothing matches.`}),(0,S.jsx)(v,{heading:`Insert a template`,children:e.map(e=>(0,S.jsxs)(g,{value:`template ${e.label} ${e.id}`,keywords:[e.text,...e.skills??[]],"data-slot":`prompt-template-option`,"data-template":e.id,title:e.text,className:`flex-col items-start gap-0.5`,onSelect:()=>{t(e.text),w(!1)},children:[(0,S.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium text-foreground`,children:e.label}),e.skills&&e.skills.length>0?(0,S.jsxs)(`span`,{"data-slot":`prompt-template-assigned`,title:`Applied automatically with: ${e.skills.join(`, `)}`,className:`inline-flex shrink-0 items-center gap-0.5 text-[12px] font-medium text-accent-text`,children:[(0,S.jsx)(f,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,S.jsx)(`span`,{className:`line-clamp-1 text-[11px] text-soft-foreground`,children:e.text})]},e.id))}),(0,S.jsx)(m,{}),(0,S.jsx)(v,{children:(0,S.jsx)(g,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-[12px] text-muted-foreground`,onSelect:()=>{w(!1),E(`/settings/prompt-templates`)},children:`Edit templates…`})})]})]})})]})}export{G as _,I as a,q as c,M as d,k as f,N as g,j as h,F as i,P as l,W as m,L as n,D as o,H as p,O as r,z as s,Y as t,R as u,A as v,C as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{A as n,M as r}from"./button-RJMdCnZw.js";import{n as i,t as a}from"./live-refetch-CZb2VOyu.js";import{$ as o,At as s,B as c,Ct as l,Dt as u,Er as d,Et as f,F as p,G as m,Gr as h,H as g,Hr as _,Ht as v,I as y,It as ee,J as te,Jr as ne,Kr as re,L as ie,M as ae,Mt as oe,Ot as se,Q as ce,Qr as le,R as ue,Tr as de,Tt as fe,Ur as pe,Ut as me,V as he,Wr as ge,X as _e,Y as b,Yr as ve,Z as ye,Zr as x,_ as be,_n as xe,_t as Se,at as Ce,b as we,bn as Te,br as S,bt as Ee,c as De,ci as Oe,ct as ke,di as Ae,dn as je,dt as Me,en as Ne,et as Pe,fr as Fe,ft as Ie,g as Le,gi as Re,gt as ze,hi as Be,hn as Ve,hr as C,ht as He,i as Ue,in as We,it as Ge,j as Ke,jr as qe,jt as Je,kt as Ye,ln as Xe,lt as Ze,m as Qe,mn as $e,mt as et,ni as tt,nn as nt,oi as rt,on as it,ot as at,pi as w,pt as ot,q as st,qr as ct,qt as lt,r as ut,ri as dt,rn as ft,rt as pt,st as mt,tn as ht,tt as gt,un as _t,ut as vt,v as yt,vt as bt,wt as xt,x as St,yi as Ct,yn as wt,yt as Tt,z as Et}from"./project-scope-context-B2P3zXB1.js";import{q as T}from"./live-protocol-CjfZMf1X.js";import{t as E}from"./useInfiniteQuery-B6Kx_mBY.js";import{t as D}from"./useQuery-D8aTqerT.js";import{n as Dt,r as O,t as Ot}from"./ws-Bb6iWQU5.js";import{n as kt}from"./toaster-BWMQArHJ.js";var At=class extends tt{#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||jt(),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=dt({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),T.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function jt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Mt=class extends Ct{#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),Be(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&rt(t.mutationKey)!==rt(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??jt();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){T.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 Nt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Pt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Ft=class extends Ct{#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,T.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||!Be(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Nt(e,n).forEach(e=>{e.destroy()}),Nt(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=w(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 le(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Pt(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)&&T.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},k=e(t(),1);function A({queries:e,...t},n){let r=x(n),i=ve(),a=ne(),o=k.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{_(e);let t=r.getQueryCache().get(e.queryHash);h(e,a,t)}),ct(a);let[s]=k.useState(()=>new Ft(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;k.useSyncExternalStore(k.useCallback(e=>d?s.subscribe(T.batchCalls(e)):Ae,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),k.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>ge(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&ge(n,e)?pe(n,new le(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&re({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function j(e,t){let n=x(t),[r]=k.useState(()=>new Mt(n,e));k.useEffect(()=>{r.setOptions(e)},[r,e]);let i=k.useSyncExternalStore(k.useCallback(e=>r.subscribe(T.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=k.useCallback((e,t)=>{r.mutate(e,t).catch(Ae)},[r]);if(i.error&&Re(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function M(e={}){let t=e.projectId??r();return{projectId:t,cacheScope:e.cacheScope??(e.boot?`default`:t)}}function N(e,t={}){return{...M(t),runId:e}}var P=[`workspace`,`runs-index`],F=e=>[e.cacheScope,`runs`,`list`],I=e=>[e.cacheScope,`runs`,`detail`,e.runId],L=e=>typeof e==`function`?e():e;function It(e){let{seenAt:t,...n}=e;return n}function Lt(e,t){let n=It(e);return t.seenAt===void 0?n:{...n,seenAt:t.seenAt}}function R(e,t,n){return t?{...e,seenAt:n}:It(e)}function Rt(e){let t=()=>{e.invalidateQueries({queryKey:P})};function n(n,i){if(n===`index`)return t();let a=typeof i==`function`?i():i;if(n===`indexed`){t(),e.invalidateQueries({queryKey:[r(),`runs`]}),e.invalidateQueries({queryKey:[a.projectId,`runs`,`list`]});return}if(n===`runs`)return e.invalidateQueries({queryKey:[a.cacheScope,`runs`]});let o=d(),s=[a.projectId,a.cacheScope],c=o!==void 0&&s.some(e=>e===o||e==="default")?[o,`default`]:[],l=new Set([...s,...c,r()]);return Promise.all([...l].map(t=>e.invalidateQueries({queryKey:[t,`runs`]}))).then(()=>void 0)}async function i(n,r){await e.cancelQueries({queryKey:F(L(n))}),await e.cancelQueries({queryKey:I(L(n))});let i=e.getQueryData(F(L(n))),a=e.getQueryData(I(L(n))),o=L(n).runId,s=new Date().toISOString();return e.setQueryData(F(L(n)),e=>e?.map(e=>e.id===o?R(e,r,s):e)),e.setQueryData(I(L(n)),e=>e&&R(e,r,s)),{id:o,prevList:i,prevDetail:a,rollback(){if(!r){i&&e.setQueryData(F(L(n)),i),a&&e.setQueryData(I(L(n)),a);return}let t=i?.find(e=>e.id===o);t&&e.setQueryData(F(L(n)),e=>e?.map(e=>e.id===o?Lt(e,t):e)),a&&e.setQueryData(I(L(n)),e=>e&&Lt(e,a))},settle(i){let a=e=>e.id===(r?o:i.id)?R(e,r,i.seenAt):e;e.setQueryData(F(L(n)),e=>e?.map(a));let s={...L(n),runId:r?o:i.id};e.setQueryData(I(s),e=>e?a(e):i),t()}}}async function a(t,r){await e.cancelQueries({queryKey:P});let i=e.getQueryData(P),a=r();return e.setQueryData(P,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(P,i)},settle(){n(`indexed`,t)}}}return{patchRead:i,patchIndex:a,invalidateAfter:n}}function z(){let e=x();return(0,k.useMemo)(()=>Rt(e),[e])}function zt(e){return e.type===`run`?e.run.id:e.id}function B(e,t){return{...e,runs:t}}function Bt(e,t){let n=0;for(let r of e)r.projectId===t&&r.archived&&(n+=1);return n}function Vt(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 Ht(e,t,n){return n?n.has(t):e.runs.some(e=>e.projectId===t)}function Ut(e,t,n){let{project:r}=t,i=zt(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:B(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:B(e,e.runs.filter((e,t)=>t!==a)),reconcile:!1}:{index:e,reconcile:!1};if(!o&&!Ht(e,r,n))return{index:e,reconcile:!0};let l=w(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||Bt(t,r)>e.perProjectLimit);return{index:B(e,t),reconcile:n}}if(s)return Gt(e,l);let u=Vt(e.runs,l);return{index:B(e,u),reconcile:l.archived&&Bt(u,r)>e.perProjectLimit}}function Wt(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 Gt(e,t){let n=Wt(e.runs,t.projectId),r=n!==void 0&&t.createdAt>n;return t.archived&&!r?{index:e,reconcile:!1}:{index:B(e,Vt(e.runs,t)),reconcile:t.archived||n===void 0||t.createdAt<n}}function Kt(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=w(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?B(e,i):e}function qt(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 Jt(){return{stream:void 0,lastStream:void 0,mismatch:void 0,floor:void 0,changes:new Map}}function Yt(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 Xt(e){e.stream=void 0}function Zt(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,zt(t)]),a=e.changes.get(i);return(!a||a.seq<t.seq)&&e.changes.set(i,{...t,generation:r}),!0}function Qt(e,t){for(let[n,r]of e.changes)r.project===t&&e.changes.delete(n)}function $t(e){return typeof e.generation==`string`&&typeof e.eventSeq==`number`}function en(e,t,n){if(!$t(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=Ut(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 V=[`workspace`,`runs-index`],tn=[`workspace`,`projects`],nn=6e4,rn=100,an=new WeakMap;function H(e){let t=an.get(e);return t||(t=un(e),an.set(e,t)),t}function on(e,t){return typeof e!=`object`||!e||!Array.isArray(e.runs)?e:H(t).merge(e)}function sn(e){let t=e.getQueryData(tn)?.projects;return t?new Set(t.map(e=>e.id)):void 0}function cn(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 ln(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 un(e){let t=Jt(),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(V,t)},h=()=>e.getQueryData(V),g=()=>{clearTimeout(a),a=void 0;let t=e.getQueryCache().find({queryKey:V,exact:!0}),n=(t!==void 0&&t.state.data===void 0&&t.state.fetchStatus!==`idle`?e.cancelQueries({queryKey:V,exact:!0}).then(()=>e.invalidateQueries({queryKey:V})):e.invalidateQueries({queryKey:V})).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=sn(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=Kt(s,e.project,e.usage));continue}if(l.has(e.change.project)||e.change.seq<=a.eventSeq)continue;let t=Ut(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,rn),typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(v))};return{ready(e,n){Yt(t,e,n),u=!1,f&&(f=!1,_({hold:!0}))},detach(){Xt(t)},run(e,r,i=!1){if(l.has(e))return;let a=ln(e,r);if(!Zt(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),Qt(t,e),n=n.filter(t=>(t.type===`change`?t.change.project:t.project)!==e);let r=h();if(!r)return;let i=qt(r,e);i!==r&&m(i)},setUnknownGenerationHandler(e){d=e},restoreProject(e){l.delete(e)},merge(n){let r=h(),i=en(t,n,sn(e));for(let e of l)i.index=qt(i.index,e);return i.reconcile&&queueMicrotask(()=>{_({hold:!0})}),cn(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 dn={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`}},fn={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function pn(e){return typeof e==`string`&&Object.hasOwn(dn,e)}function mn(e){return e!==void 0&&pn(e)?dn[e]:void 0}var hn=`cez.reference-statuses.v1`,gn=`cez.reference-conflicts.v1`,U=new Map(yn()),_n=1e3;function W(e,t){if(U.get(e)!==t){for(U.delete(e),U.set(e,t);U.size>_n;){let e=U.keys().next().value;if(e===void 0)break;U.delete(e)}Sn()}}var G=new Set(bn());function vn(e,t){if(G.has(e)!==t){if(t)for(G.add(e);G.size>_n;){let e=G.values().next().value;if(e===void 0)break;G.delete(e)}else G.delete(e);Sn()}}function yn(){try{let e=globalThis.sessionStorage?.getItem(hn);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`&&pn(e[1])):[]}catch{return[]}}function bn(){try{let e=globalThis.sessionStorage?.getItem(gn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var xn;function Sn(){xn===void 0&&(xn=setTimeout(()=>{xn=void 0;try{globalThis.sessionStorage?.setItem(hn,JSON.stringify([...U])),globalThis.sessionStorage?.setItem(gn,JSON.stringify([...G]))}catch{}},250))}var K=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function Cn(e,t){return{...e?{status:e}:{},...t?{conflicting:!0}:{}}}function wn(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 Tn(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;W(t,o),s!==void 0&&vn(t,s),e.set(t,{state:`ready`,status:o,...s??a?{conflicting:!0}:{}})}function En(e,t,n){let r=K(t),i=U.get(r),a=G.has(r)?!0:void 0,o=n.data;if(o?.available){Tn(e,r,t,o,i,a);return}if(o){e.set(r,{state:`unavailable`,reason:o.reason,...Cn(i,a)});return}if(n.isError){e.set(r,{state:`unavailable`,reason:n.error instanceof Error?n.error.message:void 0,...Cn(i,a)});return}e.set(r,{state:`loading`,...Cn(i,a)})}function Dn(e,t){let n=new Map;return t.forEach((t,r)=>{let i=e[r];if(i)for(let e of wn(i))En(n,e,t)}),n}function On(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 kn(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 An(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 jn(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 Mn(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 Nn(e,t){return e?(t===`issues`?e.issuesNextCursor:e.prsNextCursor)==null:!1}function Pn(e,t,n){for(let r of e)t.has(r.number)||(t.add(r.number),n.push(r))}function Fn(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){Pn(t.issues,a,r),Pn(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 q=e=>e.map(e=>e.number).join(`,`);function In(e,t){let n=e[0];if(e.length>1&&n&&(q(n.issues)!==q(t.issues)||q(n.prs)!==q(t.prs)||n.issuesTotal!==t.issuesTotal||n.prsTotal!==t.prsTotal))return`refetch`;let r=t;if(n&&t.available&&t.projectsState===`refreshing`&&n.repo===t.repo){let e=new Map(n.issues.map(e=>[e.number,e.projectIds]));r={...t,issues:t.issues.map(t=>{let n=e.get(t.number);return t.projectIds===void 0&&n!==void 0?{...t,projectIds:n}:t})}}return[r,...e.slice(1)]}function Ln(e,t,n=!0){let i=Br(),a=$(),o=e??i.data?.defaultRunner??`claude`,s=a.data?.capabilities?.localHandoff===!1?null:t,c=r(),l=D({queryKey:J.runnerSkills(o,s),queryFn:({signal:e})=>fe(o,s,{signal:e,projectId:c}),enabled:n&&(e!==void 0||!i.isPending)&&(!t||!a.isPending),retry:!1});return{...l,runner:o,account:s,data:l.data?.skills,list:l.data,unchecked:l.isError||!l.data||l.data.source===`unavailable`}}var J={get health(){return[r(),`health`]},runs:{get all(){return[r(),`runs`]},relationships:e=>[r(),`runs`,`relationships`,e],list:(e=r())=>[e,`runs`,`list`],archived:e=>[r(),`runs`,`archived`,e],detail:(e,t=r())=>[t,`runs`,`detail`,e],diff:e=>[r(),`runs`,`diff`,e],changes:e=>[r(),`runs`,`changes`,e],file:(e,t)=>[r(),`runs`,`files`,e,t],handoff:e=>[r(),`runs`,`handoff`,e],commits:e=>[r(),`runs`,`commits`,e],commit:(e,t)=>[r(),`runs`,`commit`,e,t]},get workflows(){return[r(),`workflows`]},runnerSkills:(e,t)=>[r(),`runner-skills`,e,t??null],get repo(){return[r(),`repo`]},get repoChanges(){return[r(),`repo`,`changes`]},repoCommit:e=>[r(),`repo`,`commit`,e],get repoBranches(){return[r(),`repo`,`branches`]},get uiState(){return[r(),`ui-state`]},get config(){return[r(),`config`]},get agentConfig(){return[r(),`agent-config`]},agentConfigFile:e=>[r(),`agent-config`,`file`,e],get worktrees(){return[r(),`worktrees`]},github:(e={})=>[r(),`github`,e.limit??null],githubPages:e=>[r(),`github`,`pages`,e],githubPagesHead:e=>[r(),`github`,`pages-head`,e],githubCommentCounts:(e,t)=>[r(),`github`,`comment-counts`,e,[...t].sort((e,t)=>e-t).join(`,`)],githubChecks:e=>[r(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[r(),`github`,`search`,e,t],githubRefStatus:(e,t,n)=>[e,`github`,`ref-status`,[...t].sort((e,t)=>e-t).join(`,`),[...n].sort((e,t)=>e-t).join(`,`)],githubComments:(e,t)=>[r(),`github`,`comments`,e,t],githubItem:(e,t)=>[r(),`github`,`item`,e,t],githubRefStatusOf:e=>[e,`github`,`ref-status`],githubPrChanges:e=>[r(),`github`,`pr-changes`,e],githubMergeState:e=>[r(),`github`,`merge-state`,e],get openTargets(){return[r(),`open-targets`]}},Y={models:e=>[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],projects:[`workspace`,`projects`],githubOwners:[`workspace`,`github-owners`],runsIndex:V,runsSearch:e=>[`workspace`,`runs-search`,e],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],agentProfiles:[`workspace`,`agent-profiles`],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...Y.fsBrowseRoot,e,t]};function X(e,t,n=`active`){return e.invalidateQueries({queryKey:t===void 0?[`workspace`,`models`]:Y.models(t),refetchType:n})}function Z(e,t=!0){return D({queryKey:Y.models(e),queryFn:({signal:t})=>C(e)?xt(e,{signal:t}):Promise.reject(Error(`${e} has no host model catalog`)),staleTime:300*1e3,enabled:t&&C(e)})}function Rn(e=!0){return{claude:Z(`claude`,e),codex:Z(`codex`,e),opencode:Z(`opencode`,e),pi:Z(`pi`,e),omp:Z(`omp`,e)}}function zn(){let e=x();return D({queryKey:Y.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(Y.providerStatus),r=await Ze(!1,{signal:t});return S(n,e.getQueryData(Y.providerStatus),r)},staleTime:5*6e4,refetchInterval:a(!1),refetchOnWindowFocus:!0})}function Bn(){let e=x();return j({mutationFn:()=>Ze(!0),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(Y.providerStatus,e=>S(r,e,t)),X(e)}})}function Vn(){let e=x();return j({mutationFn:({provider:e,authFailureId:t})=>it(e,t),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(Y.providerStatus,e=>S(r,e,t,n.authFailureId)),C(n.provider)&&X(e,n.provider)}})}function Hn(e={}){return D({queryKey:Y.projects,queryFn:({signal:e})=>ke({signal:e}),...e})}function Un(e,t=!1){return D({queryKey:Y.fsBrowse(e,t),queryFn:({signal:n})=>De(e??void 0,{signal:n,showHidden:t}),retry:!1})}function Wn(){let e=x();return j({mutationFn:e=>Ne(e),onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function Gn(){let e=x();return j({mutationFn:e=>nt(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:Y.projects})}})}function Kn(){let e=x();return j({mutationFn:e=>{let{id:t,...n}=e;return wt(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:Y.projects});let r=e.getQueryData(Y.projects);return e.setQueryData(Y.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?qn(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(Y.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(Y.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:Y.projects})})}function qn(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?[]:jn(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 Jn(e){let t=x();return j({mutationFn:e,retry:!1,onSuccess:({project:e})=>{t.setQueryData(Y.projects,t=>t===void 0?t:{...t,projects:t.projects.map(t=>t.id===e.id?e:t)})},onSettled:()=>t.invalidateQueries({queryKey:Y.projects})})}function Yn(){return Jn(e=>{let{projectId:t,...n}=e;return St(t,n)})}function Xn(){return Jn(e=>{let{projectId:t,webhookId:n,...r}=e;return Te(t,n,r)})}function Zn(){return Jn(({projectId:e,webhookId:t})=>ft(e,t))}function Qn(){return j({mutationFn:({projectId:e,webhookId:t})=>Ve(e,t),retry:!1})}function $n(e){let t=x();return j({mutationFn:t=>ee(e,t),retry:!1,onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function Q(e){let t=x();return j({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:Y.agentProfiles}),t.invalidateQueries({queryKey:Y.projects}),t.invalidateQueries({predicate:({queryKey:e})=>e[1]===`runner-skills`})])}})}function er(){return Q(e=>yt(e))}function tr(){return Q(e=>{let{id:t,...n}=e;return xe(t,n)})}function nr(){return Q(e=>ht(e))}function rr(){return Q(e=>_t(e))}function ir(e,t){return D({queryKey:Y.agentAccountStatus(e),queryFn:({signal:t})=>p(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function ar(){let e=x();return j({mutationFn:({provider:e,profileId:t})=>Le(e,t),retry:!1,onSuccess:async(t,{provider:n})=>{await Promise.all([e.invalidateQueries({queryKey:Y.agentProfiles}),e.invalidateQueries({queryKey:Y.providerStatus}),C(n)?X(e,n,`none`):Promise.resolve()])}})}function or(){let e=x();return j({mutationFn:e=>p(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(Y.agentAccountStatus(n),t),e.invalidateQueries({queryKey:Y.agentProfiles}),C(t.status.provider)&&X(e,t.status.provider)}})}function sr(){let e=x();return j({mutationFn:e=>Qe(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function cr(){let e=x();return j({mutationFn:e=>we(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function lr({enabled:e}){return D({queryKey:Y.githubOwners,queryFn:({signal:e})=>Pe({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function ur(){let e=x();(0,k.useEffect)(()=>{let t,r=()=>{let r=e.getQueryData(J.health),i=r?.capabilities?.localHandoff===!0;r&&de({local:i,bootProject:r.bootProject??`default`,apiBase:n()}),i&&t===void 0?t=Ot(`health`,t=>{e.setQueryData(J.health,t)}):!i&&t!==void 0&&(t(),t=void 0)};r();let i=e.getQueryCache().subscribe(r);return()=>{i(),t?.(),qe()}},[e])}function $(){return D({queryKey:J.health,queryFn:({signal:e})=>at({signal:e})})}function dr(e,t){let n=$().data,r=Hn(t).data?.projects,i=ut(),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?On(n?.repo?.remote):void 0}function fr(){return D({queryKey:J.openTargets,queryFn:({signal:e})=>mt({signal:e}),staleTime:5*6e4})}function pr(){return D({queryKey:J.runs.list(),queryFn:({signal:e})=>f(M(),{signal:e})})}function mr(e,t){return E({queryKey:J.runs.archived(e),enabled:t,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>Et({before:t,limit:200,q:e},{signal:n}),getNextPageParam:e=>e.nextCursor??void 0,placeholderData:(e,t)=>t?.queryKey[0]===r()?e:void 0})}function hr(e){let t=e.trim();return D({queryKey:Y.runsSearch(t),queryFn:({signal:e})=>Xe(t,{signal:e}),enabled:t.length>=2,placeholderData:Oe,staleTime:1e4})}function gr(e=!0,t=nn){let n=H(x());return O(`/api/v1/workspace/runs-index`,Y.runsIndex,a(e?t:!1),on),D({queryKey:Y.runsIndex,queryFn:({signal:e})=>u({signal:e}).then(n.merge),enabled:e,staleTime:3e4,refetchInterval:!1})}function _r(e,t=!0,n=!1){return D({queryKey:[M({projectId:e,boot:n}).cacheScope,`runs`,`list`],queryFn:({signal:t})=>f(M({projectId:e,boot:n}),{signal:t}),enabled:t,placeholderData:(t,r)=>n&&r?.queryKey[0]===e?t:void 0})}function vr(e){let t=x();return j({mutationFn:e=>Ke(e),onSettled:()=>t.invalidateQueries({queryKey:J.runs.relationships(e)})})}function yr(e,t={}){return D({queryKey:J.runs.relationships(e),queryFn:({signal:t})=>l(e,{signal:t}),enabled:t.enabled??!0})}function br(e){return D({queryKey:J.runs.detail(e??``),queryFn:({signal:t})=>et(N(e),{signal:t}),enabled:!!e})}function xr(e,t,n=!0){return D({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>et(N(t,{projectId:e}),{signal:n}),enabled:n&&!!e&&!!t})}function Sr(e){return D({queryKey:J.runs.diff(e??``),queryFn:({signal:t})=>bt(e,{signal:t}),enabled:!!e})}function Cr(e,t=!1){return O(e?`/api/v1/p/${r()}/runs/${encodeURIComponent(e)}/changes`:void 0,J.runs.changes(e??``),a(t?4e3:!1)),D({queryKey:J.runs.changes(e??``),queryFn:({signal:t})=>He(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0})}function wr(e,t){return D({queryKey:J.runs.file(e??``,t??``),queryFn:({signal:n})=>Tt(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function Tr(e,t){return D({queryKey:[r(),`runs`,`file-link`,e,t],queryFn:({signal:n})=>te(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Er(e,t){return D({queryKey:[r(),`runs`,`artifact`,e,t],queryFn:({signal:n})=>c(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Dr(e,t){return D({queryKey:[r(),`runs`,`artifact-metadata`,e,t],queryFn:({signal:n})=>he(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Or(e){return D({queryKey:[r(),`runs`,`artifacts`,e],queryFn:({signal:t})=>g(e,{signal:t}),retry:!1,staleTime:0,refetchOnWindowFocus:!0})}function kr(e,t=!1){return O(e?`/api/v1/p/${r()}/runs/${encodeURIComponent(e)}/commits`:void 0,J.runs.commits(e??``),a(t?5e3:!1)),D({queryKey:J.runs.commits(e??``),queryFn:({signal:t})=>Se(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1})}function Ar(e,t){return D({queryKey:J.runs.commit(e??``,t??``),queryFn:({signal:n})=>ze(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function jr(e,t=!0){return D({queryKey:J.runs.handoff(e??``),queryFn:({signal:t})=>Ee(N(e),{signal:t}),enabled:!!e&&t})}function Mr(e,t,n){return D({queryKey:e===void 0?J.runs.handoff(t):[e,`runs`,`handoff`,t],queryFn:({signal:n})=>Ee(N(t,{projectId:e}),{signal:n}),enabled:n,staleTime:15e3})}function Nr(e,t){let n=[...new Set(e)],i=A({queries:n.map(e=>({queryKey:[e??r(),`automations`,`names`],queryFn:({signal:t})=>m({signal:t,archived:`include`,...e===void 0?{}:{projectId:e}}),enabled:t,staleTime:6e4,retry:!1}))}),a=i.map(e=>e.data);return(0,k.useMemo)(()=>{let e=new Map;return a.forEach((t,r)=>{if(t?.available)for(let i of t.automations)e.set(JSON.stringify([n[r]??null,i.id]),i.name)}),(t,n)=>e.get(JSON.stringify([t??null,n]))},[JSON.stringify([n,i.map(e=>e.dataUpdatedAt)])])}function Pr(){return D({queryKey:J.workflows,queryFn:({signal:e})=>Ye({signal:e})})}function Fr(){return D({queryKey:J.repo,queryFn:({signal:e})=>vt({signal:e})})}function Ir(e){return D({queryKey:[e,`repo`],queryFn:({signal:t})=>vt({signal:t},e)})}function Lr(){return D({queryKey:J.repoBranches,queryFn:({signal:e})=>Me({signal:e})})}function Rr(){return D({queryKey:J.repoChanges,queryFn:({signal:e})=>Ie({signal:e}),retry:!1})}function zr(e){return D({queryKey:J.repoCommit(e??``),queryFn:({signal:t})=>ot(e,{signal:t}),enabled:!!e,retry:!1})}function Br(){return D({queryKey:J.config,queryFn:({signal:e})=>st({signal:e})})}function Vr(){return D({queryKey:J.worktrees,queryFn:({signal:e})=>oe({signal:e})})}function Hr(e){return D({queryKey:[e,`worktrees`],queryFn:({signal:t})=>oe({signal:t},e),staleTime:0})}function Ur(e,t=!0,n=!1){return D({queryKey:[M({projectId:e,boot:n}).cacheScope,`ui-state`],queryFn:({signal:t})=>se({signal:t},e),select:e=>e.sidebarLimits===void 0?e:{...e,sidebarLimits:Fe(e.sidebarLimits)},enabled:t})}function Wr(){return Ur(r())}function Gr(){return D({queryKey:J.agentConfig,queryFn:({signal:e})=>y({signal:e})})}function Kr(e){return D({queryKey:J.agentConfigFile(e??``),queryFn:({signal:t})=>ie(e,{signal:t}),enabled:e!==null})}function qr(e){let t=x(),n=J.agentConfig,r=J.agentConfigFile(e);return j({mutationFn:t=>lt(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}function Jr(){return D({queryKey:Y.uiState,queryFn:({signal:e})=>Je({signal:e})})}function Yr(){return D({queryKey:Y.config,queryFn:({signal:e})=>s({signal:e})})}function Xr(){return D({queryKey:Y.agentProfiles,queryFn:({signal:e})=>ue({signal:e})})}function Zr(e){let t=x();return j({mutationFn:t=>v(e,t),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function Qr(e){let t=z(),n=e?.projectId,r=e?.cacheScope,i=j({mutationFn:e=>$e(e,!0),onMutate:e=>t.patchRead(e,!0),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)}),a=(0,k.useCallback)(e=>({...N(e,{projectId:n,cacheScope:r}),id:e}),[n,r]),o=(0,k.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,k.useCallback)((e,t)=>s(a(e),o(t)),[s,a,o]),u=(0,k.useCallback)((e,t)=>c(a(e),o(t)),[c,a,o]);return{...i,variables:i.variables?.id,mutate:l,mutateAsync:u}}function $r(){let e=z();return j({mutationFn:e=>$e(N(e),!1),onMutate:t=>e.patchRead(()=>N(t),!1),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)})}function ei(e){let t=z();return j({mutationFn:({id:t,pinned:n})=>me(N(t,e),n),onError:e=>kt(`Could not update pin. ${e.message} Please retry.`,{tone:`danger`}),onMutate:()=>e??M(),onSuccess:(e,n,r)=>t.invalidateAfter(`runs`,r)})}function ti(e,t){let n=z();return j({mutationFn:n=>je(N(e,{projectId:t}),n),onMutate:()=>M({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`send`,r),onError:(e,t,r)=>{e instanceof Ue&&e.status===409&&r&&n.invalidateAfter(`send`,r)}})}function ni(e,t){let n=z();return j({mutationFn:(n={})=>be(N(e,{projectId:t}),n),onMutate:()=>M({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`continue`,r)})}function ri(e){let t=x();return j({mutationFn:({msgId:t,message:n})=>ae(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function ii(e){let t=x();return j({mutationFn:t=>We(e,t),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function ai(e={},t=!0){let n=x(),i=J.github(e);O(`/api/v1/p/${r()}/github${e.limit===void 0?``:`?limit=${e.limit}`}`,i,a(t?6e4:!1));let o=D({queryKey:J.github(e),queryFn:({signal:t})=>b({limit:e.limit},{signal:t}),enabled:t,staleTime:6e4,refetchInterval:!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0}),s=o.data?.projectsGeneration,c=D({queryKey:[...i,`projects`,s],queryFn:({signal:e})=>pt(s,{signal:e}),enabled:t&&o.data?.projectsState===`refreshing`&&!!s,staleTime:1/0,retry:!1});return(0,k.useEffect)(()=>{!s||!c.data&&!c.error||n.setQueryData(i,e=>{if(!e||e.projectsGeneration!==s||e.projectsState!==`refreshing`)return e;let t=c.data;return t?.generation&&t.generation!==s?e:t?.state===`ready`?{...e,projectsState:`ready`,projects:t.projects,issues:e.issues.map(e=>({...e,projectIds:t.membership?.[e.number]??[]}))}:{...e,projectsState:`unavailable`,projectsReason:t?.reason??`Project boards unavailable. Refresh to try again.`}})},[n,s,c.data,c.error,i]),o}var oi=class extends Error{};function si(e,t,n){return{queryKey:e,initialPageParam:{},queryFn:async({pageParam:e,signal:r})=>{let i=await b({limit:t,...e,...n?{projectId:n}:{}},{signal:r});if(!i.available&&Object.keys(e).length>0)throw new oi(i.reason??`GitHub is unavailable.`);return i},getNextPageParam:e=>Mn(e),retry:(e,t)=>!(t instanceof oi)&&!(t instanceof Ue&&t.status>=400&&t.status<500)&&e<1,staleTime:6e4,refetchOnWindowFocus:!0}}function ci(e=50,t=!0){let n=x(),i=J.githubPages(e),o=J.githubPagesHead(e);O(`/api/v1/p/${r()}/github?limit=${e}`,o,a(t?6e4:!1));let s=E({...si(i,e),enabled:t,refetchInterval:!1,refetchIntervalInBackground:!1}),c=D({queryKey:o,queryFn:({signal:t})=>b({limit:e},{signal:t}),enabled:!1,staleTime:1/0}),{refetch:l}=s;(0,k.useEffect)(()=>{if(!c.data)return;let e=n.getQueryData(i);if(!e||e.pages.length===0)return;let t=In(e.pages,c.data);t===`refetch`?l():n.setQueryData(i,{...e,pages:t})},[n,c.dataUpdatedAt,l]);let u=(s.data?.pages??[]).flatMap(e=>e.projectsState===`refreshing`&&e.projectsGeneration?[e.projectsGeneration]:[]),d=A({queries:u.map(e=>({queryKey:[...i,`projects`,e],queryFn:({signal:t})=>pt(e,{signal:t}),enabled:t,staleTime:1/0,retry:!1}))});return(0,k.useEffect)(()=>{d.forEach((e,t)=>{let r=u[t];!r||!e.data&&!e.error||n.setQueryData(i,t=>{if(!t)return t;let n=!1,i=t.pages.map(t=>{if(t.projectsGeneration!==r||t.projectsState!==`refreshing`)return t;let i=e.data;return i?.generation&&i.generation!==r?t:(n=!0,i?.state===`ready`?{...t,projectsState:`ready`,projects:i.projects,issues:t.issues.map(e=>({...e,projectIds:i.membership?.[e.number]??[]}))}:{...t,projectsState:`unavailable`,projectsReason:i?.reason??`Project boards unavailable. Refresh to try again.`})});return n?{...t,pages:i}:t})})},[n,d.map((e,t)=>e.data||e.error?u[t]:``).join(`,`)]),{pages:s,data:(0,k.useMemo)(()=>Fn(s.data?.pages??[]),[s.data])}}function li(e,t=50,n=!0){let r=E({...si([e,`github`,`pages`,t],t,e),enabled:n});return{pages:r,data:(0,k.useMemo)(()=>Fn(r.data?.pages??[]),[r.data])}}function ui(e,t,n=!0){let r=A({queries:t.filter(e=>e.length>0).map(t=>({queryKey:J.githubCommentCounts(e,t),queryFn:({signal:n})=>ye(e,t,{},{signal:n}),enabled:n,staleTime:6e4}))});return(0,k.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 di(e,t,n,r=!0){return D({queryKey:[e,`github`,`search`,t,n],queryFn:({signal:r})=>Ce(t,n,{projectId:e},{signal:r}),enabled:r&&n.trim()!==``,staleTime:6e4})}function fi(e,t=!0){return D({queryKey:J.githubChecks(e),queryFn:({signal:t})=>_e(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function pi(e,t,n=!0){return D({queryKey:J.githubSearch(e,t),queryFn:({signal:n})=>Ce(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var mi=100;function hi(e){return[...e].sort((e,t)=>t-e).slice(0,mi).sort((e,t)=>e-t)}function gi(){let e=ut(),t=$();return e.projectId??t.data?.bootProject}function _i(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))W(K({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))W(K({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var vi=5*6e4;function yi(e){return e?e.recheckAfterMs:vi}function bi(e,t=!0){let n=(0,k.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:hi(t.prs),issues:hi(t.issues)}))},[e.map(K).sort().join(`|`)]),r=A({queries:n.map(e=>({queryKey:J.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>Ge(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>yi(e.state.data)??1/0,refetchInterval:!1,refetchOnWindowFocus:!0}))}),a=x(),o=JSON.stringify(n.map((e,t)=>({...e,interval:yi(r[t]?.data)??!1})));(0,k.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=J.githubRefStatus(t.projectId,t.prs,t.issues);return Dt({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,k.useMemo)(()=>Dn(n,r),[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,k.useCallback)(e=>{let t=K(e),n=s.get(t);if(n)return n;let r=U.get(t);return{state:`idle`,...r?{status:r}:{},...G.has(t)?{conflicting:!0}:{}}},[s])}function xi(e,t,n=!0){return D({queryKey:J.githubComments(e,t),queryFn:({signal:n})=>ce(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Si(e,t,n=!0){return D({queryKey:J.githubItem(e,t),queryFn:({signal:n})=>o(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Ci(e){return D({queryKey:J.githubPrChanges(e??0),queryFn:({signal:t})=>gt(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{gi as $,ci as A,tr as At,ei as B,kn as Bt,Un as C,gr as Ct,xi as D,Mr as Dt,ui as E,ti as Et,Qr as F,Jr as Ft,xr as G,H as Gt,di as H,On as Ht,$r as I,Vr as It,Hr as J,N as Jt,_r as K,z as Kt,$n as L,Y as Lt,pi as M,Xn as Mt,$ as N,Pr as Nt,Si as O,Qn as Ot,ur as P,Yr as Pt,or as Q,fr as R,Ln as Rt,Tr as S,pr as St,fi as T,rr as Tt,Ir as U,fn as Ut,li as V,An as Vt,dr as W,mn as Wt,zn as X,At as Xt,Hn as Y,j as Yt,qr as Z,er as _,wr as _t,Gr as a,Zn as at,vr as b,Rn as bt,mr as c,Lr as ct,Or as d,Vn as dt,bi as et,Nr as f,br as ft,ni as g,Sr as gt,ar as h,kr as ht,ir as i,Gn as it,Ci as j,Kn as jt,lr as k,Wr as kt,Er as l,Rr as lt,Br as m,Ar as mt,J as n,Wn as nt,Kr as o,ii as ot,sr as p,Cr as pt,Ur as q,M as qt,_i as r,nr as rt,Xr as s,Fr as st,X as t,Bn as tt,Dr as u,zr as ut,cr as v,jr as vt,ai as w,hr as wt,ri as x,Z as xt,Yn as y,yr as yt,Zr as z,Nn as zt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{d as r,p as i,u as a}from"./button-RJMdCnZw.js";import{Ut as o,Wt as s,et as c}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{d as r,p as i,u as a}from"./button-RJMdCnZw.js";import{Ut as o,Wt as s,et as c}from"./queries-B6a1W2sa.js";import{a as l,d as u,i as d,r as f}from"./use-desktop-D3W91YLi.js";import{F as p,H as m,M as h,N as g,P as _,f as v,g as y,h as b,m as x,ot as S,p as C}from"./design-icons-B6-0w7Aw.js";import{t as w}from"./createLucideIcon-BHp8sXmF.js";var T=w(`search-x`,[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),E={general:[`Settings`,`General`],webhooks:[`Settings`,`General`,`Webhooks`],providers:[`Settings`,`Agents`,`Providers`],projects:[`Settings`,`Projects`],worktrees:[`Settings`,`Worktrees`],sidebar:[`Settings`,`Sidebar`]};function D(e,t=` → `){return E[e].join(t)}var O=e(t(),1),k=n(),A=(0,O.createContext)(null);function j({children:e}){let[t,n]=(0,O.useState)(()=>new Map),r=(0,O.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,O.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=c((0,O.useMemo)(()=>[...t.values()].flat(),[t])),o=(0,O.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,k.jsx)(A.Provider,{value:o,children:e})}var M=(0,O.createContext)(null);function ee({projectId:e,repoBase:t,requests:n,children:r}){let i=(0,O.useContext)(A),a=(0,O.useContext)(M),o=(0,O.useId)();(0,O.useEffect)(()=>{if(i)return i.publish(o,n),()=>i.retract(o)},[i,o,n.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`)]);let s=c(i?N:n),l=i?.lookup??s,u=t??(a&&a.projectId===e?a.repoBase:void 0),d=(0,O.useMemo)(()=>({lookup:l,projectId:e,repoBase:u}),[l,e,u]);return(0,k.jsx)(M.Provider,{value:d,children:r})}var N=[];function P(e,t,n){let r=(0,O.useContext)(M),i=n??r?.projectId;return!r||!i||t===void 0?te:r.lookup({projectId:i,kind:e,number:t})}function F(e,t){let n=(0,O.useContext)(M),r=t??n?.projectId;return!n||!r?[]:e.filter(e=>n.lookup({projectId:r,kind:`PR`,number:e}).conflicting===!0)}function I(){let e=(0,O.useContext)(M);return{projectId:e?.projectId,repoBase:e?.repoBase}}var te=Object.freeze({state:`idle`}),ne={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,accent:`border-accent-strong/35 text-accent-text`,merged:`border-merged-strong/35 text-merged-text`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},L={success:`text-success`,danger:`text-danger`,accent:`text-merged-text`,merged:`text-merged-text`,info:`text-info`,neutral:`text-soft-foreground`,pending:`text-pending-strong`,conflict:`text-conflict`},re={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,accent:`hover:bg-accent-strong/10`,merged:`hover:bg-merged-strong/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},R={draft:_,"review-required":p,"changes-requested":m,"checks-pending":null,"checks-failing":y,ready:v,merged:h,closed:g,open:C,completed:v,"not-planned":b};function z(e){return e===`PR`?`pr-chip`:`issue-chip`}function B(e){return e?{"data-conflicting":`true`}:{}}function V(e,t,n,r){return!n||r!==void 0&&u({kind:e,number:t??0,url:n},r)}function H(e,t,n){return e===`PR`&&(t??n)===!0}function U({plain:e,inert:t,conflicting:n,className:r,tone:i}){return e?a(`inline-flex items-center gap-1 rounded-[2px] text-inherit`,n&&`text-conflict font-medium`,!t&&`group/reference focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground`,r):a(`inline-flex h-[22px] items-center gap-1 rounded-md border px-1.5 font-mono text-[12px] font-normal`,ne[i],r)}function W(e,t,n,r){return n&&!r?t?`${e===`PR`?`PR `:``}#${t}`:e:t?`${!r&&e===`Issue`?`Issue `:``}#${t}`:e}function G(e){return e===`PR`?`pull request`:`issue`}function K(e,t,n,r){return`Open the ${e}${t?` #${t}`:``} for ${n}${r?` — ${r.label}`:``}`}function q(e,t){return e&&t?L[t.tone]:void 0}function J(e,t){return!e&&(!t||!r(t))}function Y({conflicting:e,presentation:t,status:n,plain:r,compact:i,inert:o,kind:s,label:c,glyphClass:l}){return(0,k.jsxs)(k.Fragment,{children:[e?(0,k.jsx)(S,{className:a(`size-2.5 shrink-0`,l),"aria-hidden":`true`}):(0,k.jsx)($,{status:t?n:void 0,className:r?a(`size-2.5`,l):void 0}),r&&i?s===`PR`?(0,k.jsx)(p,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,k.jsx)(C,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null,r?(0,k.jsx)(`span`,{className:o?void 0:`underline-offset-2 group-hover/reference:underline group-focus-visible/reference:underline`,children:c}):c]})}function ie({kind:e,status:t,conflicting:n,chipClass:r,body:i}){return(0,k.jsx)(`span`,{"data-slot":z(e),"data-status":t,"data-inert":`true`,...B(n),className:r,children:i})}function ae({kind:e,number:t,tooltip:n,url:i}){return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`span`,{className:`block font-medium`,children:[e===`PR`?`Pull request`:`Issue`,t?` #${t}`:``,` · `,n.headline]}),(0,k.jsx)(`span`,{className:`block`,children:n.detail}),n.also?(0,k.jsx)(`span`,{className:`block opacity-70`,children:n.also}):null,i&&r(i)?(0,k.jsx)(`span`,{className:`block opacity-70`,children:i.replace(/^https?:\/\//,``)}):null]})}function oe({reference:e,taskTitle:t,status:n,conflicting:r,conflictAction:i,projectId:c,repoBase:l,to:u,className:d,compact:f=!1,plain:p=!1,inert:m=!1}){let{kind:h,number:g,url:_}=e,v=I(),y=P(h,V(h,g,_,l??v.repoBase)?g:void 0,c),b=n??y.status,x=s(b),S=H(h,r,y.conflicting),C=S?o:x,w=C?.tone??`accent`,T=U({plain:p,inert:m,conflicting:S,className:d,tone:w}),E=ue(y,C,S?x:void 0),D=W(h,g,p,f),O=G(h),A=K(O,g,t,C),j=(0,k.jsx)(Y,{conflicting:S,presentation:C,status:b,plain:p,compact:f,inert:m,kind:h,label:D,glyphClass:q(p,C)});if(m)return(0,k.jsx)(ie,{kind:h,status:b,conflicting:S,chipClass:T,body:j});let M=J(u,_)?(0,k.jsx)(`span`,{"data-slot":z(h),"data-status":b,...B(S),"aria-label":C?`${O} ${D} — ${C.label}`:void 0,className:T,children:j}):(0,k.jsx)(se,{to:u,url:_,"data-slot":z(h),"data-status":b,...B(S),title:E?void 0:_,"aria-label":A,className:p?T:a(T,re[w]),children:j});return E?(0,k.jsx)(le,{chip:M,action:S?i:void 0,state:y.state,children:(0,k.jsx)(ae,{kind:h,number:g,tooltip:E,url:_})}):M}function se({to:e,url:t,children:n,...r}){return e?(0,k.jsx)(i,{to:e,...r,children:n}):(0,k.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,...r,children:n})}var X=(0,O.createContext)(()=>{});function ce(){return(0,O.useContext)(X)}var Z=150,Q=120;function le({chip:e,action:t,state:n,children:r}){let[i,a]=(0,O.useState)(!1),o=(0,O.useRef)(null),s=(0,O.useRef)(null),c=(0,O.useRef)(void 0),u=(0,O.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),p=(0,O.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,O.useEffect)(()=>()=>clearTimeout(c.current),[]);let m=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,k.jsxs)(f,{open:i,onOpenChange:e=>e?a(!0):p(),children:[(0,k.jsx)(d,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&u(!0,Z)},onPointerLeave:e=>{e.pointerType!==`touch`&&u(!1,Q)},onFocus:()=>a(!0),onBlur:e=>{m(e.relatedTarget)||p()},onKeyDown:e=>{if(e.key===`Escape`)return p();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,k.jsxs)(l,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),m(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&u(!1,Q)},children:[(0,k.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,k.jsx)(X.Provider,{value:p,children:t}):null]})]})}function ue(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${de(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function de(e){return e.charAt(0).toLowerCase()+e.slice(1)}function fe({kind:e,number:t,className:n}){let r=P(e,t),i=s(r.status),c=e===`PR`&&r.conflicting===!0,l=c?o:i;if(!l)return null;let u=a(`size-2.5`,L[l.tone]);return(0,k.jsx)(`span`,{"data-slot":`reference-status-glyph`,"data-status":r.status,...c?{"data-conflicting":`true`}:{},"aria-hidden":`true`,className:a(`inline-flex items-center`,n),children:c?(0,k.jsx)(S,{className:a(`shrink-0`,u),"aria-hidden":`true`}):(0,k.jsx)($,{status:r.status,className:u})})}function $({status:e,className:t}){if(!e)return null;if(e===`checks-pending`)return(0,k.jsx)(x,{"data-slot":`status-dot`,"data-tone":`pending`,className:a(`size-3 animate-pulse motion-reduce:animate-none`,t),"aria-hidden":`true`});let n=R[e];return n?(0,k.jsx)(n,{className:a(`size-2.5 shrink-0`,t),"aria-hidden":`true`}):null}export{j as a,P as c,ee as i,D as l,fe as n,F as o,ce as r,I as s,oe as t,T as u};
|