diff --git a/packages/cli-rs/crates/plugin/src/pipe/compat.js b/packages/cli-rs/crates/plugin/src/pipe/compat.js index beb16d85124..7e0bf769832 100644 --- a/packages/cli-rs/crates/plugin/src/pipe/compat.js +++ b/packages/cli-rs/crates/plugin/src/pipe/compat.js @@ -1,7 +1,7 @@ // Generated by script/gen/js-host.ts from crates/plugin/src/pipe/compat; do not edit. // @bun -var Ms=Object.defineProperty;var Ls=(e)=>e;function Fs(e,n){this[e]=Ls.bind(null,n)}var at=(e,n)=>{for(var o in n)Ms(e,o,{get:n[o],enumerable:!0,configurable:!0,set:Fs.bind(n,o)})};var dt={};at(dt,{Rpc:()=>dt,define:()=>qs});var sn={};at(sn,{$DEVCOMP:()=>zs,$PROXY:()=>oe,$TRACK:()=>je,DEV:()=>Pi,ErrorBoundary:()=>Di,For:()=>hi,Index:()=>Si,Match:()=>Ei,Show:()=>Ii,Suspense:()=>Ci,SuspenseList:()=>Oi,Switch:()=>bi,batch:()=>Ue,cancelCallback:()=>js,catchError:()=>on,children:()=>so,createComponent:()=>pe,createComputed:()=>Et,createContext:()=>Ve,createDeferred:()=>Xs,createEffect:()=>Dt,createMemo:()=>Z,createReaction:()=>Hs,createRenderEffect:()=>De,createResource:()=>hr,createRoot:()=>se,createSelector:()=>Ys,createSignal:()=>Q,createUniqueId:()=>xi,enableExternalSource:()=>si,enableHydration:()=>yi,enableScheduling:()=>ei,equalFn:()=>oo,from:()=>ci,getListener:()=>$e,getOwner:()=>nt,indexArray:()=>Rr,lazy:()=>gi,mapArray:()=>Dr,mergeProps:()=>rn,observable:()=>pi,on:()=>Qs,onCleanup:()=>ue,onError:()=>ui,onMount:()=>Zs,requestCallback:()=>no,resetErrorBoundaries:()=>vi,runWithOwner:()=>pt,sharedConfig:()=>U,splitProps:()=>io,startTransition:()=>ro,untrack:()=>Y,useContext:()=>Re,useTransition:()=>ni});var po={};at(po,{$RAW:()=>ot,DEV:()=>qi,createMutable:()=>Li,createStore:()=>Ct,modifyMutable:()=>Fi,produce:()=>uo,reconcile:()=>Pt,unwrap:()=>Te});var fo={};at(fo,{MouseButton:()=>Ni,RGBA:()=>Se,StyledText:()=>un,TextAttributes:()=>ce,basenameToFiletype:()=>dn,bg:()=>Ki,blink:()=>zi,bold:()=>Gi,createTextAttributes:()=>ln,dim:()=>Bi,extToFiletype:()=>mo,extensionToFiletype:()=>jr,fg:()=>Hi,hexToRgb:()=>wt,infoStringToFiletype:()=>go,isStyledText:()=>yo,italic:()=>Ji,link:()=>Xi,parseColor:()=>Gr,pathToFiletype:()=>Br,reverse:()=>Wi,rgbToHex:()=>Ui,strikethrough:()=>$i,stringToStyledText:()=>Vi,t:()=>Yi,underline:()=>ji});var ft={};at(ft,{Fragment:()=>_a,jsx:()=>Co,jsxDEV:()=>Va,jsxs:()=>Ua});var Oo={};at(Oo,{ScreenContext:()=>Tt,VNode:()=>ye,claimTree:()=>Do,color:()=>Ye,createComponent:()=>pe,createElement:()=>gt,createTextNode:()=>ca,effect:()=>ua,idOf:()=>he,insert:()=>bo,insertNode:()=>mn,memo:()=>pa,mergeProps:()=>fn,missing:()=>Qe,mount:()=>Eo,onAnimationTick:()=>ba,onBlur:()=>Sa,onFocus:()=>ha,onResize:()=>ga,render:()=>la,rootOf:()=>le,serialize:()=>vo,setProp:()=>At,spread:()=>kt,use:()=>ya,useKeyHandler:()=>fa,useKeyboard:()=>es,usePaste:()=>xa,useRenderer:()=>ma,useSelectionHandler:()=>Ia,useTerminalDimensions:()=>Zr,useTimeline:()=>Ea});function qs(e){let n=Object.values(e.methods).flatMap((o)=>Object.keys(o.errors??{})).find((o)=>o.startsWith("rpc."));if(n)throw Error(`RPC error names starting with "rpc." are reserved: ${n}`);return e}var Ns=1,Hn=!1,Kn=!1,lt=[],qe=null,Xn=null,Us=5,Bn=0,Vs=300,lr=0,Yn=null,Xt=null,_s=1073741823;function Gs(){let e=new MessageChannel,{port1:n,port2:o}=e;if(typeof n.unref==="function")n.unref();if(typeof o.unref==="function")o.unref();if(Yn=()=>o.postMessage(null),n.onmessage=()=>{if(Xt!==null){let a=performance.now();Bn=a+Us,lr=a+Vs;try{if(!Xt(a))Xt=null;else o.postMessage(null)}catch(d){throw o.postMessage(null),d}}},navigator&&navigator.scheduling&&navigator.scheduling.isInputPending){let a=navigator.scheduling;Xn=()=>{let d=performance.now();if(d>=Bn){if(a.isInputPending())return!0;return d>=lr}else return!1}}else Xn=()=>performance.now()>=Bn}function Js(e,n){function o(){let a=0,d=e.length-1;while(a<=d){let r=d+a>>1,p=n.expirationTime-e[r].expirationTime;if(p>0)a=r+1;else if(p<0)d=r-1;else return r}return a}e.splice(o(),0,n)}function no(e,n){if(!Yn)Gs();let o=performance.now(),a=_s;if(n&&n.timeout)a=n.timeout;let d={id:Ns++,fn:e,startTime:o,expirationTime:o+a};if(Js(lt,d),!Hn&&!Kn)Hn=!0,Xt=$s,Yn();return d}function js(e){e.fn=null}function $s(e){Hn=!1,Kn=!0;try{return Bs(e)}finally{qe=null,Kn=!1}}function Bs(e){let n=e;qe=lt[0]||null;while(qe!==null){if(qe.expirationTime>n&&Xn())break;let o=qe.fn;if(o!==null){qe.fn=null;let a=qe.expirationTime<=n;if(o(a),n=performance.now(),qe===lt[0])lt.shift()}else lt.shift();qe=lt[0]||null}return qe!==null}var U={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return ur(this.context.count)},getNextContextId(){return ur(this.context.count++)}};function ur(e){let n=String(e),o=n.length-1;return U.context.id+(o?String.fromCharCode(96+o):"")+n}function ve(e){U.context=e}function Ws(){return{...U.context,id:U.getNextContextId(),count:0}}var mr=!1,oo=(e,n)=>e===n,oe=Symbol("solid-proxy"),gr=typeof Proxy==="function",je=Symbol("solid-track"),zs=Symbol("solid-dev-component"),Zt={equals:oo},we=null,fr=br,ge=1,bt=2,xr={owned:null,cleanups:null,context:null,owner:null},Wn={},L=null,S=null,tt=null,Ne=null,K=null,ne=null,de=null,nn=0;function se(e,n){let o=K,a=L,d=e.length===0,r=n===void 0?a:n,p=d?xr:{owned:null,cleanups:null,context:r?r.context:null,owner:r},c=d?e:()=>e(()=>Y(()=>ze(p)));L=p,K=null;try{return be(c,!0)}finally{K=o,L=a}}function Q(e,n){n=n?Object.assign({},Zt,n):Zt;let o={value:e,observers:null,observerSlots:null,comparator:n.equals||void 0},a=(d)=>{if(typeof d==="function")if(S&&S.running&&S.sources.has(o))d=d(o.tValue);else d=d(o.value);return Ir(o,d)};return[Sr.bind(o),a]}function Et(e,n,o){let a=He(e,n,!0,ge);if(tt&&S&&S.running)ne.push(a);else Be(a)}function De(e,n,o){let a=He(e,n,!1,ge);if(tt&&S&&S.running)ne.push(a);else Be(a)}function Dt(e,n,o){fr=di;let a=He(e,n,!1,ge),d=Je&&Re(Je);if(d)a.suspense=d;if(!o||!o.render)a.user=!0;de?de.push(a):Be(a)}function Hs(e,n){let o,a=He(()=>{o?o():Y(e),o=void 0},void 0,!1,0),d=Je&&Re(Je);if(d)a.suspense=d;return a.user=!0,(r)=>{o=r,Be(a)}}function Z(e,n,o){o=o?Object.assign({},Zt,o):Zt;let a=He(e,n,!0,0);if(a.observers=null,a.observerSlots=null,a.comparator=o.equals||void 0,tt&&S&&S.running)a.tState=ge,ne.push(a);else Be(a);return Sr.bind(a)}function Ks(e){return e&&typeof e==="object"&&"then"in e}function hr(e,n,o){let a,d,r;if(typeof n==="function")a=e,d=n,r=o||{};else a=!0,d=e,r=n||{};let p=null,c=Wn,t=null,s=!1,u=!1,x="initialValue"in r,R=typeof a==="function"&&Z(a),v=new Set,[k,V]=(r.storage||Q)(r.initialValue),[J,j]=Q(void 0),[f,I]=Q(void 0,{equals:!1}),[h,M]=Q(x?"ready":"unresolved");if(L)ue(()=>{for(let W of v.keys())W.decrement();if(v.clear(),S&&p)S.promises.delete(p);p=null});if(U.context){if(t=U.getNextContextId(),r.ssrLoadFrom==="initial")c=r.initialValue;else if(U.load&&U.has(t))c=U.load(t)}function F(W,z,ee,te){if(p===W){if(p=null,te!==void 0&&(x=!0),(W===c||z===c)&&r.onHydrated)queueMicrotask(()=>r.onHydrated(te,{value:z}));if(c=Wn,S&&W&&s)S.promises.delete(W),s=!1,be(()=>{S.running=!0,_(z,ee)},!1);else _(z,ee)}return z}function _(W,z){be(()=>{if(z===void 0)V(()=>W);M(z!==void 0?"errored":x?"ready":"unresolved"),j(z);for(let ee of v.keys())ee.decrement();v.clear()},!1)}function q(){let W=Je&&Re(Je),z=k(),ee=J();if(ee!==void 0&&!p)throw ee;if(K&&!K.user&&W)Et(()=>{if(f(),p){if(W.resolved&&S&&s)S.promises.add(p);else if(!v.has(W))W.increment(),v.add(W)}});return z}function A(W=!0){if(W!==!1&&u)return;u=!1;let z=R?R():a;if(s=S&&S.running,z==null||z===!1){F(p,Y(k));return}if(S&&p)S.promises.delete(p);let ee,te=c!==Wn?c:Y(()=>{try{return d(z,{value:k(),refetching:W})}catch(Me){ee=Me}});if(ee!==void 0){F(p,void 0,Yt(ee),z);return}else if(!Ks(te))return F(p,te,void 0,z),te;if(p=te,"v"in te){if(te.s===1)F(p,te.v,void 0,z);else F(p,void 0,Yt(te.v),z);return te}return u=!0,queueMicrotask(()=>u=!1),be(()=>{M(x?"refreshing":"pending"),I()},!1),te.then((Me)=>F(te,Me,void 0,z),(Me)=>F(te,void 0,Yt(Me),z))}Object.defineProperties(q,{state:{get:()=>h()},error:{get:()=>J()},loading:{get(){let W=h();return W==="pending"||W==="refreshing"}},latest:{get(){if(!x)return q();let W=J();if(W&&!p)throw W;return k()}}});let Ce=L;if(R)Et(()=>(Ce=L,A(!1)));else A(!1);return[q,{refetch:(W)=>pt(Ce,()=>A(W)),mutate:V}]}function Xs(e,n){let o,a=n?n.timeoutMs:void 0,d=He(()=>{if(!o||!o.fn)o=no(()=>p(()=>d.value),a!==void 0?{timeout:a}:void 0);return e()},void 0,!0),[r,p]=Q(S&&S.running&&S.sources.has(d)?d.tValue:d.value,n);return Be(d),p(()=>S&&S.running&&S.sources.has(d)?d.tValue:d.value),r}function Ys(e,n=oo,o){let a=new Map,d=He((r)=>{let p=e();for(let[c,t]of a.entries())if(n(c,p)!==n(c,r))for(let s of t.values()){if(S&&S.running)s.tState=ge;else s.state=ge;if(s.pure)ne.push(s);else de.push(s)}return p},void 0,!0,ge);return Be(d),(r)=>{let p=K;if(p){let c;if(c=a.get(r))c.add(p);else a.set(r,c=new Set([p]));ue(()=>{c.delete(p),!c.size&&a.delete(r)})}return n(r,S&&S.running&&S.sources.has(d)?d.tValue:d.value)}}function Ue(e){return be(e,!1)}function Y(e){if(!Ne&&K===null)return e();let n=K;K=null;try{if(Ne)return Ne.untrack(e);return e()}finally{K=n}}function Qs(e,n,o){let a=Array.isArray(e),d,r=o&&o.defer;return(p)=>{let c;if(a){c=Array(e.length);for(let s=0;sn(c,d,p));return d=c,t}}function Zs(e){Dt(()=>Y(e))}function ue(e){if(L===null);else if(L.cleanups===null)L.cleanups=[e];else L.cleanups.push(e);return e}function on(e,n){if(we||(we=Symbol("error")),L=He(void 0,void 0,!0),L.context={...L.context,[we]:[n]},S&&S.running)S.sources.add(L);try{return e()}catch(o){Rt(o)}finally{L=L.owner}}function $e(){return K}function nt(){return L}function pt(e,n){let o=L,a=K;L=e,K=null;try{return be(n,!0)}catch(d){Rt(d)}finally{L=o,K=a}}function ei(e=no){tt=e}function ro(e){if(S&&S.running)return e(),S.done;let n=K,o=L;return Promise.resolve().then(()=>{K=n,L=o;let a;if(tt||Je)a=S||(S={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),a.done||(a.done=new Promise((d)=>a.resolve=d)),a.running=!0;return be(e,!1),K=L=null,a?a.done:void 0})}var[ti,pr]=Q(!1);function ni(){return[ti,ro]}function oi(e){de.push.apply(de,e),e.length=0}function Ve(e,n){let o=Symbol("context");return{id:o,Provider:li(o),defaultValue:e}}function Re(e){let n;return L&&L.context&&(n=L.context[e.id])!==void 0?n:e.defaultValue}function so(e){let n=Z(e),o=Z(()=>Qn(n()));return o.toArray=()=>{let a=o();return Array.isArray(a)?a:a!=null?[a]:[]},o}var Je;function ri(){return Je||(Je=Ve())}function si(e,n=(o)=>o()){if(Ne){let{factory:o,untrack:a}=Ne;Ne={factory:(d,r)=>{let p=o(d,r),c=e((t)=>p.track(t),r);return{track:(t)=>c.track(t),dispose(){c.dispose(),p.dispose()}}},untrack:(d)=>a(()=>n(d))}}else Ne={factory:e,untrack:n}}function Sr(){let e=S&&S.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===ge)Be(this);else{let n=ne;ne=null,be(()=>en(this),!1),ne=n}if(K){let n=this.observers;if(!n||n[n.length-1]!==K){let o=n?n.length:0;if(!K.sources)K.sources=[this],K.sourceSlots=[o];else K.sources.push(this),K.sourceSlots.push(o);if(!n)this.observers=[K],this.observerSlots=[K.sources.length-1];else n.push(K),this.observerSlots.push(K.sources.length-1)}}if(e&&S.sources.has(this))return this.tValue;return this.value}function Ir(e,n,o){let a=S&&S.running&&S.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(a,n)){if(S){let d=S.running;if(d||!o&&S.sources.has(e))S.sources.add(e),e.tValue=n;if(!d)e.value=n}else e.value=n;if(e.observers&&e.observers.length)be(()=>{for(let d=0;d1e6)throw ne=[],Error()},!1)}return n}function Be(e){if(!e.fn)return;ze(e);let n=nn;if(cr(e,S&&S.running&&S.sources.has(e)?e.tValue:e.value,n),S&&!S.running&&S.sources.has(e))queueMicrotask(()=>{be(()=>{S&&(S.running=!0),K=L=e,cr(e,e.tValue,n),K=L=null},!1)})}function cr(e,n,o){let a,d=L,r=K;K=L=e;try{a=e.fn(n)}catch(p){if(e.pure)if(S&&S.running)e.tState=ge,e.tOwned&&e.tOwned.forEach(ze),e.tOwned=void 0;else e.state=ge,e.owned&&e.owned.forEach(ze),e.owned=null;return e.updatedAt=o+1,Rt(p)}finally{K=r,L=d}if(!e.updatedAt||e.updatedAt<=o){if(e.updatedAt!=null&&"observers"in e)Ir(e,a,!0);else if(S&&S.running&&e.pure){if(!S.sources.has(e))e.value=a;S.sources.add(e),e.tValue=a}else e.value=a;e.updatedAt=o}}function He(e,n,o,a=ge,d){let r={fn:e,state:a,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:n,owner:L,context:L?L.context:null,pure:o};if(S&&S.running)r.state=0,r.tState=a;if(L===null);else if(L!==xr)if(S&&S.running&&L.pure)if(!L.tOwned)L.tOwned=[r];else L.tOwned.push(r);else if(!L.owned)L.owned=[r];else L.owned.push(r);if(Ne&&r.fn){let p=r.fn,[c,t]=Q(void 0,{equals:!1}),s=Ne.factory(p,t);ue(()=>s.dispose());let u,x=!1,R=()=>ro(t).then(()=>{if(u){if(u.dispose(),u=void 0,!x)t()}});r.fn=(v)=>{if(c(),S&&S.running){if(!u)u=Ne.factory(p,R);return u.track(v)}return x=!0,s.track(v)}}return r}function vt(e){let n=S&&S.running;if((n?e.tState:e.state)===0)return;if((n?e.tState:e.state)===bt)return en(e);if(e.suspense&&Y(e.suspense.inFallback))return e.suspense.effects.push(e);let o=[e];while((e=e.owner)&&(!e.updatedAt||e.updatedAt=0;a--){if(e=o[a],n){let d=e,r=o[a+1];while((d=d.owner)&&d!==r)if(S.disposed.has(d))return}if((n?e.tState:e.state)===ge)Be(e);else if((n?e.tState:e.state)===bt){let d=ne;ne=null,be(()=>en(e,o[0]),!1),ne=d}}}function be(e,n){if(ne)return e();let o=!1;if(!n)ne=[];if(de)o=!0;else de=[];nn++;try{let a=e();return ii(o),a}catch(a){if(!o)de=null;ne=null,Rt(a)}}function ii(e){if(ne){if(tt&&S&&S.running)ai(ne);else br(ne);ne=null}if(e)return;let n;if(S){if(!S.promises.size&&!S.queue.size){let a=S.sources,d=S.disposed;de.push.apply(de,S.effects),n=S.resolve;for(let r of de)"tState"in r&&(r.state=r.tState),delete r.tState;S=null,be(()=>{for(let r of d)ze(r);for(let r of a){if(r.value=r.tValue,r.owned)for(let p=0,c=r.owned.length;pfr(o),!1);if(n)n()}function br(e){for(let n=0;n{a.delete(o),be(()=>{S.running=!0,vt(o)},!1),S&&(S.running=!1)})}}function di(e){let n,o=0;for(n=0;n=0;n--)ze(o[n])}if(S&&S.running&&e.pure)vr(e,!0);else if(e.owned){let o=e.owned;e.owned=null;for(n=o.length-1;n>=0;n--)ze(o[n])}if(e.cleanups){let o=e.cleanups;e.cleanups=null;for(n=o.length-1;n>=0;n--)o[n]()}if(S&&S.running)e.tState=0;else e.state=0}function vr(e,n){if(!n)e.tState=0,S.disposed.add(e);if(e.owned)for(let o=0;od=Y(()=>(L.context={...L.context,[e]:a.value},so(()=>a.children))),void 0),d}}function ui(e){if(we||(we=Symbol("error")),L===null);else if(L.context===null||!L.context[we])L.context={...L.context,[we]:[e]},Qt(L,we,[e]);else L.context[we].push(e)}function Qt(e,n,o){if(e.owned)for(let a=0;a(Dt(()=>{let r=e();Y(()=>o(r))}),d));if(nt())ue(a);return{unsubscribe(){a()}}},[Symbol.observable||"@@observable"](){return this}}}function ci(e,n=void 0){let[o,a]=Q(n,{equals:!1});if("subscribe"in e){let d=e.subscribe((r)=>a(()=>r));ue(()=>("unsubscribe"in d)?d.unsubscribe():d())}else{let d=e(a);ue(d)}return o}var Zn=Symbol("fallback");function tn(e){for(let n=0;n1?[]:null;return ue(()=>tn(r)),()=>{let t=e()||[],s=t.length,u,x;return t[je],Y(()=>{let v,k,V,J,j,f,I,h,M;if(s===0){if(p!==0)tn(r),r=[],a=[],d=[],p=0,c&&(c=[]);if(o.fallback)a=[Zn],d[0]=se((F)=>(r[0]=F,o.fallback())),p=1}else if(p===0){d=Array(s);for(x=0;x=f&&h>=f&&a[I]===t[h];I--,h--)V[h]=d[I],J[h]=r[I],c&&(j[h]=c[I]);v=new Map,k=Array(h+1);for(x=h;x>=f;x--)M=t[x],u=v.get(M),k[x]=u===void 0?-1:u,v.set(M,x);for(u=f;u<=I;u++)if(M=a[u],x=v.get(M),x!==void 0&&x!==-1)V[x]=d[u],J[x]=r[u],c&&(j[x]=c[u]),x=k[x],v.set(M,x);else r[u]();for(x=f;xtn(r)),()=>{let s=e()||[],u=s.length;return s[je],Y(()=>{if(u===0){if(c!==0)tn(r),r=[],a=[],d=[],c=0,p=[];if(o.fallback)a=[Zn],d[0]=se((R)=>(r[0]=R,o.fallback())),c=1;return d}if(a[0]===Zn)r[0](),r=[],a=[],d=[],c=0;for(t=0;ts[t]);else if(t>=a.length)d[t]=se(x);for(;te(n||{}));return ve(o),a}}return Y(()=>e(n||{}))}function Kt(){return!0}var eo={get(e,n,o){if(n===oe)return o;return e.get(n)},has(e,n){if(n===oe)return!0;return e.has(n)},set:Kt,deleteProperty:Kt,getOwnPropertyDescriptor(e,n){return{configurable:!0,enumerable:!0,get(){return e.get(n)},set:Kt,deleteProperty:Kt}},ownKeys(e){return e.keys()}};function zn(e){return!(e=typeof e==="function"?e():e)?{}:e}function mi(){for(let e=0,n=this.length;e=0;c--){let t=zn(e[c])[p];if(t!==void 0)return t}},has(p){for(let c=e.length-1;c>=0;c--)if(p in zn(e[c]))return!0;return!1},keys(){let p=[];for(let c=0;c=0;p--){let c=e[p];if(!c)continue;let t=Object.getOwnPropertyNames(c);for(let s=t.length-1;s>=0;s--){let u=t[s];if(u==="__proto__"||u==="constructor")continue;let x=Object.getOwnPropertyDescriptor(c,u);if(!a[u])a[u]=x.get?{enumerable:!0,configurable:!0,get:mi.bind(o[u]=[x.get.bind(c)])}:x.value!==void 0?x:void 0;else{let R=o[u];if(R){if(x.get)R.push(x.get.bind(c));else if(x.value!==void 0)R.push(()=>x.value)}}}}let d={},r=Object.keys(a);for(let p=r.length-1;p>=0;p--){let c=r[p],t=a[c];if(t&&t.get)Object.defineProperty(d,c,t);else d[c]=t?t.value:void 0}return d}function io(e,...n){let o=n.length;if(gr&&oe in e){let d=o>1?n.flat():n[0],r=new Set,p=n.map((c)=>{let t=c.filter((s)=>!r.has(s)&&(r.add(s),!0));return new Proxy({get(s){return t.includes(s)?e[s]:void 0},has(s){return t.includes(s)&&s in e},keys(){return t.filter((s)=>(s in e))}},eo)});return p.push(new Proxy({get(c){return d.includes(c)?void 0:e[c]},has(c){return d.includes(c)?!1:(c in e)},keys(){return Object.keys(e).filter((c)=>!d.includes(c))}},eo)),p}let a=[];for(let d=0;d<=o;d++)a[d]={};for(let d of Object.getOwnPropertyNames(e)){let r=o;for(let t=0;t{if(!o){let r=o=e();r.then((p)=>{n=()=>p.default},()=>{if(o===r)o=void 0})}return o},d=(r)=>{let p=U.context;if(p){let[t,s]=Q();U.count||(U.count=0),U.count++,a().then((u)=>{!U.done&&ve(p),U.count--,s(()=>u.default),ve()},(u)=>{!U.done&&ve(p),U.count--,s(()=>()=>{throw u}),ve()}),n=t}else if(!n){let[t]=hr(()=>a().then((s)=>s.default));n=t,ue(()=>n=void 0)}let c;return Z(()=>(c=n?.())?Y(()=>{if(!p||U.done)return c(r);let t=U.context;ve(p);let s=c(r);return ve(t),s}):"")};return d.preload=()=>a(),d}var fi=0;function xi(){return U.context?U.getNextContextId():`cl-${fi++}`}var Cr=(e)=>`Stale read from <${e}>.`;function hi(e){let n="fallback"in e&&{fallback:()=>e.fallback};return Z(Dr(()=>e.each,e.children,n||void 0))}function Si(e){let n="fallback"in e&&{fallback:()=>e.fallback};return Z(Rr(()=>e.each,e.children,n||void 0))}function Ii(e){let n=e.keyed,o=Z(()=>e.when,void 0,void 0),a=n?o:Z(o,void 0,{equals:(d,r)=>!d===!r});return Z(()=>{let d=a();if(d){let r=e.children;return typeof r==="function"&&r.length>0?Y(()=>r(n?d:()=>{if(!Y(a))throw Cr("Show");return o()})):r}return e.fallback},void 0,void 0)}function bi(e){let n=so(()=>e.children),o=Z(()=>{let a=n(),d=Array.isArray(a)?a:[a],r=()=>{return};for(let p=0;ps()?void 0:t.when,void 0,void 0),x=t.keyed?u:Z(u,void 0,{equals:(R,v)=>!R===!v});r=()=>s()||(x()?[c,u,t]:void 0)}return r});return Z(()=>{let a=o()();if(!a)return e.fallback;let[d,r,p]=a,c=p.children;return typeof c==="function"&&c.length>0?Y(()=>c(p.keyed?r():()=>{if(Y(o)()?.[0]!==d)throw Cr("Match");return r()})):c},void 0,void 0)}function Ei(e){return e}var ut;function vi(){ut&&[...ut].forEach((e)=>e())}function Di(e){let n;if(U.context&&U.load)n=U.load(U.getContextId());let[o,a]=Q(n,void 0);return ut||(ut=new Set),ut.add(a),ue(()=>ut.delete(a)),Z(()=>{let d;if(d=o()){let r=e.fallback;return typeof r==="function"&&r.length?Y(()=>r(d,()=>a())):r}return on(()=>e.children,a)},void 0,void 0)}var Ri=(e,n)=>e.showContent===n.showContent&&e.showFallback===n.showFallback,to=Ve();function Oi(e){let[n,o]=Q(()=>({inFallback:!1})),a,d=Re(to),[r,p]=Q([]);if(d)a=d.register(Z(()=>n()().inFallback));let c=Z((t)=>{let{revealOrder:s,tail:u}=e,{showContent:x=!0,showFallback:R=!0}=a?a():{},v=r(),k=s==="backwards";if(s==="together"){let f=v.every((h)=>!h()),I=v.map(()=>({showContent:f&&x,showFallback:R}));return I.inFallback=!f,I}let V=!1,J=t.inFallback,j=[];for(let f=0,I=v.length;fc),pe(to.Provider,{value:{register:(t)=>{let s;return p((u)=>(s=u.length,[...u,t])),Z(()=>c()[s],void 0,{equals:Ri})}},get children(){return e.children}})}function Ci(e){let n=0,o,a,d,r,p,[c,t]=Q(!1),s=ri(),u={increment:()=>{if(++n===1)t(!0)},decrement:()=>{if(--n===0)t(!1)},inFallback:c,effects:[],resolved:!1},x=nt();if(U.context&&U.load){let k=U.getContextId(),V=U.load(k);if(V)if(typeof V!=="object"||V.s!==1)d=V;else U.gather(k);if(d&&d!=="$$f"){let[J,j]=Q(void 0,{equals:!1});r=J,d.then(()=>{if(U.done)return j();U.gather(k),ve(a),j(),ve()},(f)=>{p=f,j()})}}let R=Re(to);if(R)o=R.register(u.inFallback);let v;return ue(()=>v&&v()),pe(s.Provider,{value:u,get children(){return Z(()=>{if(p)throw p;if(a=U.context,r)return r(),r=void 0;if(a&&d==="$$f")ve();let k=Z(()=>e.children);return Z((V)=>{let J=u.inFallback(),{showContent:j=!0,showFallback:f=!0}=o?o():{};if((!J||d&&d!=="$$f")&&j)return u.resolved=!0,v&&v(),v=a=d=void 0,oi(u.effects),k();if(!f)return;if(v)return V;return se((I)=>{if(v=I,a)ve({id:a.id+"F",count:0}),a=void 0;return e.fallback},x)})})}})}var Pi=void 0;var ot=Symbol("store-raw"),ke=Symbol("store-node"),Oe=Symbol("store-has"),wr=Symbol("store-self");function kr(e){let n=e[oe];if(!n){if(Object.defineProperty(e,oe,{value:n=new Proxy(e,ki)}),!Array.isArray(e)){let o=Object.keys(e),a=Object.getOwnPropertyDescriptors(e),d=Object.getPrototypeOf(e),r=d!==null&&e!==null&&typeof e==="object"&&!Array.isArray(e)&&d!==Object.prototype;if(r){let p=Object.getOwnPropertyDescriptors(d);o.push(...Object.keys(p)),Object.assign(a,p)}for(let p=0,c=o.length;pe[oe][n],o}function lo(e){$e()&&rt(yt(e,ke),wr)()}function Ar(e){return lo(e),Reflect.ownKeys(e)}var ki={get(e,n,o){if(n===ot)return e;if(n===oe)return o;if(n===je)return lo(e),o;let a=yt(e,ke),d=a[n],r=d?d():e[n];if(n===ke||n===Oe||n==="__proto__")return r;if(!d){let p=Object.getOwnPropertyDescriptor(e,n);if($e()&&(typeof r!=="function"||Object.prototype.hasOwnProperty.call(e,n))&&!(p&&p.get))r=rt(a,n,r)()}return Ae(r)?kr(r):r},has(e,n){if(n===ot||n===oe||n===je||n===ke||n===Oe||n==="__proto__")return!0;return $e()&&rt(yt(e,Oe),n)(),n in e},set(){return!0},deleteProperty(){return!0},ownKeys:Ar,getOwnPropertyDescriptor:wi};function fe(e,n,o,a=!1){if(n==="__proto__")return;if(!a&&e[n]===o)return;let d=e[n],r=e.length;if(o===void 0){if(delete e[n],e[Oe]&&e[Oe][n]&&d!==void 0)e[Oe][n].$()}else if(e[n]=o,e[Oe]&&e[Oe][n]&&d===void 0)e[Oe][n].$();let p=yt(e,ke),c;if(c=rt(p,n,d))c.$(()=>o);if(Array.isArray(e)&&e.length!==r){for(let t=e.length;t1){a=n.shift();let p=typeof a,c=Array.isArray(e);if(p==="string"&&(a==="__proto__"||n.length>1&&Mr(a)))return;if(Array.isArray(a)){for(let t=0;t1){Ot(e[a],n,[a].concat(o));return}d=e[a],o=[a].concat(o)}let r=n[0];if(typeof r==="function"){if(r=r(d,o),r===d)return}if(a===void 0&&r==null)return;if(r=Te(r),a===void 0||Ae(d)&&Ae(r)&&!Array.isArray(r))Tr(d,r);else fe(e,a,r)}function Ct(...[e,n]){let o=Te(e||{}),a=Array.isArray(o),d=kr(o);function r(...p){Ue(()=>{a&&p.length===1?Ai(o,p[0]):Ot(o,p)})}return[d,r]}function Ti(e,n){let o=Reflect.getOwnPropertyDescriptor(e,n);if(!o||o.get||o.set||!o.configurable||n===oe||n===ke)return o;return delete o.value,delete o.writable,o.get=()=>e[oe][n],o.set=(a)=>e[oe][n]=a,o}var Mi={get(e,n,o){if(n===ot)return e;if(n===oe)return o;if(n===je)return lo(e),o;let a=yt(e,ke),d=a[n],r=d?d():e[n];if(n===ke||n===Oe||n==="__proto__")return r;if(!d){let p=Object.getOwnPropertyDescriptor(e,n),c=typeof r==="function";if($e()&&(!c||Object.prototype.hasOwnProperty.call(e,n))&&!(p&&p.get))r=rt(a,n,r)();else if(r!=null&&c&&r===Array.prototype[n])return(...t)=>Ue(()=>Array.prototype[n].apply(o,t))}return Ae(r)?Lr(r):r},has(e,n){if(n===ot||n===oe||n===je||n===ke||n===Oe||n==="__proto__")return!0;return $e()&&rt(yt(e,Oe),n)(),n in e},set(e,n,o){return Ue(()=>fe(e,n,Te(o))),!0},deleteProperty(e,n){return Ue(()=>fe(e,n,void 0,!0)),!0},ownKeys:Ar,getOwnPropertyDescriptor:Ti};function Lr(e){let n=e[oe];if(!n){Object.defineProperty(e,oe,{value:n=new Proxy(e,Mi)});let o=Object.keys(e),a=Object.getOwnPropertyDescriptors(e),d=Object.getPrototypeOf(e),r=d!==null&&e!==null&&typeof e==="object"&&!Array.isArray(e)&&d!==Object.prototype;if(r){let p=d;while(p!=null){let c=Object.getOwnPropertyDescriptors(p);o.push(...Object.keys(c)),Object.assign(a,c),p=Object.getPrototypeOf(p)}}for(let p=0,c=o.length;pUe(()=>s.call(n,x)),configurable:!0})}}}return n}function Li(e,n){let o=Te(e||{});return Lr(o)}function Fi(e,n){Ue(()=>n(Te(e)))}var ao=Symbol("store-root");function Pr(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function ct(e,n,o,a,d){if(Pr(o))return;let r=n[o];if(e===r)return;let p=Array.isArray(e);if(o!==ao&&(!Ae(e)||!Ae(r)||p!==Array.isArray(r)||d&&e[d]!==r[d])){fe(n,o,e);return}if(p){if(e.length&&r.length&&(!a||d&&e[0]&&e[0][d]!=null)){let s,u,x,R,v,k,V,J;for(x=0,R=Math.min(r.length,e.length);x=x&&v>=x&&(r[R]===e[v]||d&&r[R]&&e[v]&&r[R][d]&&r[R][d]===e[v][d]);R--,v--)j[v]=r[R];if(x>v||x>R){for(u=x;u<=v;u++)fe(r,u,e[u]);for(;ue.length)fe(r,"length",e.length);return}V=Array(v+1);for(u=v;u>=x;u--)k=e[u],J=d&&k?k[d]:k,s=f.get(J),V[u]=s===void 0?-1:s,f.set(J,u);for(s=x;s<=R;s++)if(k=r[s],J=d&&k?k[d]:k,u=f.get(J),u!==void 0&&u!==-1)j[u]=r[s],u=V[u],f.set(J,u);for(u=x;ue.length)fe(r,"length",e.length);return}let c=Object.keys(e);for(let s=0,u=c.length;s{if(!Ae(r)||!Ae(d))return d;let p=ct(d,{[ao]:r},ao,o,a);return p===void 0?r:p}}var an=new WeakMap,Fr={get(e,n){if(n===ot)return e;let o=e[n];if(n===oe||n===je||n===ke||n===Oe||n==="__proto__")return o;let a;return Ae(o)?an.get(o)||(an.set(o,a=new Proxy(o,Fr)),a):o},set(e,n,o){return fe(e,n,Te(o)),!0},deleteProperty(e,n){return fe(e,n,void 0,!0),!0}};function uo(e){return(n)=>{if(Ae(n)){let o;if(!(o=an.get(n)))an.set(n,o=new Proxy(n,Fr));e(o)}return n}}var qi=void 0;var qr={names:["ACHROMATOPSIA_MATRIX","ASCIIFont","ASCIIFontRenderable","ASCIIFontSelectionHelper","ArrowRenderable","Audio","AudioCaptureStream","AudioCaptureStreamError","AudioInitializationError","AudioRecorder","AudioRecorderError","AudioStream","AudioStreamError","BaseRenderable","BloomEffect","BorderCharArrays","Box","BoxRenderable","CRTRollingBarEffect","CliRenderer","CloudsEffect","Code","CodeRenderable","DEUTERANOPIA_COMP_MATRIX","DEUTERANOPIA_SIM_MATRIX","DataPathsManager","DiffRenderable","DistortionEffect","EditBuffer","EditBufferRenderable","EditorView","EmbeddedTerminalRenderable","ExtmarksController","FFIRenderLib","FlamesEffect","FrameBuffer","FrameBufferRenderable","GRAYSCALE_MATRIX","GREENSCALE_MATRIX","Generic","INVERT_MATRIX","ImageError","ImageLoadError","ImageRenderable","Input","InputRenderable","InternalKeyHandler","KeyEvent","KeyHandler","LineNumberRenderable","LinearScrollAccel","MacOSScrollAccel","MarkdownRenderable","MouseEvent","MouseParser","NativeError","NativeImage","NativeImagePool","NativeSession","NativeSpanFeed","OptimizedBuffer","PROTANOPIA_COMP_MATRIX","PROTANOPIA_SIM_MATRIX","PasteEvent","RGBA","RainbowTextEffect","Renderable","ResourceContext","RootRenderable","RootTextNodeRenderable","SEPIA_MATRIX","SOLARIZATION_MATRIX","SYNTHWAVE_MATRIX","ScrollBarRenderable","ScrollBox","ScrollBoxBar","ScrollBoxContent","ScrollBoxRenderable","ScrollBoxViewport","ScrollBoxWrapper","Select","SelectRenderable","Selection","SliderRenderable","SlotRegistry","SlotRenderable","StdinParser","StyledText","SyntaxStyle","SystemClock","TECHNICOLOR_MATRIX","TRITANOPIA_COMP_MATRIX","TRITANOPIA_SIM_MATRIX","TabSelect","TabSelectRenderable","TerminalConsole","TerminalPalette","Text","TextBuffer","TextBufferRenderable","TextBufferView","TextNodeRenderable","TextRenderable","TextTableRenderable","TextareaRenderable","TimeToFirstDrawRenderable","Timeline","TreeSitterClient","VRenderable","VideoRenderable","VignetteEffect","Yoga","acquireSessionBufferLease","addDefaultParsers","ansi256IndexToRgb","applyAsciiArt","applyBrightness","applyChromaticAberration","applyGain","applyInvert","applyNoise","applySaturation","applyScanlines","attributesWithLink","basenameToFiletype","bg","bgBlack","bgBlue","bgCyan","bgGreen","bgMagenta","bgRed","bgWhite","bgYellow","black","blink","blue","bold","borderCharsToArray","brightBlack","brightBlue","brightCyan","brightGreen","brightMagenta","brightRed","brightWhite","brightYellow","buildKittyKeyboardFlags","buildTerminalPaletteSignature","capture","checkCrop","clearEnvCache","convertGlobalToLocalSelection","convertThemeToStyles","coordinateToCharacterIndex","createCliRenderer","createClipboard","createCoreSlotRegistry","createExtmarksController","createHostClipboard","createIcyStreamDemuxer","createMarkdownCodeBlockRenderer","createRendererClipboardAdapter","createSlotRegistry","createTerminalPalette","createTextAttributes","createTimeline","cyan","decodePasteBytes","defaultTextareaKeyBindings","delegate","destroyTreeSitterClient","detectLinks","dim","engine","env","envRegistry","extToFiletype","extensionToFiletype","fg","fonts","generateEnvColored","generateEnvMarkdown","getBaseAttributes","getBorderFromSides","getBorderSides","getCharacterPositions","getDataPaths","getLinkId","getTimelineEngine","getTreeSitterClient","green","h","hastToStyledText","hexToRgb","hsvToRgb","imageInfo","infoStringToFiletype","instantiate","isEditBufferRenderable","isRenderable","isStyledText","isTextNodeRenderable","isVNode","isValidBorderStyle","italic","link","magenta","maybeMakeRenderable","measureEditText","measureText","normalizeColorValue","normalizeIndexedColorIndex","normalizeTerminalPalette","parseAlign","parseAlignItems","parseBorderStyle","parseBoxSizing","parseColor","parseDimension","parseDirection","parseDisplay","parseEdge","parseFlexDirection","parseGutter","parseJustify","parseKeypress","parseLogLevel","parseMeasureMode","parseOverflow","parsePositionType","parseUnit","parseWrap","pathToFiletype","red","registerCorePlugin","registerEnvVar","renderFontToFrameBuffer","resolveBundledFilePath","resolveCoreSlot","resolveImageRenderProtocol","resolveRenderLib","reverse","rgbToHex","sameCrop","scrollUnitSize","setRenderLibPath","setupAudio","strikethrough","stringToStyledText","stripAnsiSequences","t","treeSitterToStyledText","treeSitterToTextChunks","underline","visualizeRenderableTree","vstyles","white","wrapWithDelegates","yellow"],values:{ATTRIBUTE_BASE_BITS:8,ATTRIBUTE_BASE_MASK:255,BorderChars:{single:{topLeft:"\u250C",topRight:"\u2510",bottomLeft:"\u2514",bottomRight:"\u2518",horizontal:"\u2500",vertical:"\u2502",topT:"\u252C",bottomT:"\u2534",leftT:"\u251C",rightT:"\u2524",cross:"\u253C"},double:{topLeft:"\u2554",topRight:"\u2557",bottomLeft:"\u255A",bottomRight:"\u255D",horizontal:"\u2550",vertical:"\u2551",topT:"\u2566",bottomT:"\u2569",leftT:"\u2560",rightT:"\u2563",cross:"\u256C"},rounded:{topLeft:"\u256D",topRight:"\u256E",bottomLeft:"\u2570",bottomRight:"\u256F",horizontal:"\u2500",vertical:"\u2502",topT:"\u252C",bottomT:"\u2534",leftT:"\u251C",rightT:"\u2524",cross:"\u253C"},heavy:{topLeft:"\u250F",topRight:"\u2513",bottomLeft:"\u2517",bottomRight:"\u251B",horizontal:"\u2501",vertical:"\u2503",topT:"\u2533",bottomT:"\u253B",leftT:"\u2523",rightT:"\u252B",cross:"\u254B"}},CliRenderEvents:{RESIZE:"resize",FRAME:"frame",RENDER_ERROR:"render:error",FRAME_DROPPED:"frame:dropped",HANDLER_ERROR:"handler:error",EXTERNAL_OUTPUT:"external_output",FOCUS:"focus",BLUR:"blur",FOCUSED_RENDERABLE:"focused_renderable",FOCUSED_EDITOR:"focused_editor",THEME_MODE:"theme_mode",PALETTE:"palette",CAPABILITIES:"capabilities",SELECTION:"selection",DEBUG_OVERLAY_TOGGLE:"debugOverlay:toggle",DESTROY:"destroy",MEMORY_SNAPSHOT:"memory:snapshot"},ClipboardTarget:{"0":"Clipboard","1":"Primary","2":"Select","3":"Secondary",Clipboard:0,Primary:1,Select:2,Secondary:3},ConsolePosition:{TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right"},DEFAULT_BACKGROUND_RGB:[0,0,0],DEFAULT_FOREGROUND_RGB:[255,255,255],DebugOverlayCorner:{"0":"topLeft","1":"topRight","2":"bottomLeft","3":"bottomRight",topLeft:0,topRight:1,bottomLeft:2,bottomRight:3},EditBufferRenderableEvents:{TRAITS_CHANGED:"traits-changed"},InputRenderableEvents:{INPUT:"input",CHANGE:"change",ENTER:"enter"},LayoutEvents:{LAYOUT_CHANGED:"layout-changed",RESIZED:"resized"},LogLevel:{"0":"Error","1":"Warn","2":"Info","3":"Debug",Error:0,Warn:1,Info:2,Debug:3},MAX_LINK_URL_BYTES:512,MouseButton:{"0":"LEFT","1":"MIDDLE","2":"RIGHT","4":"WHEEL_UP","5":"WHEEL_DOWN",LEFT:0,MIDDLE:1,RIGHT:2,WHEEL_UP:4,WHEEL_DOWN:5},NATIVE_BUFFER_TEXT_BYTES_MAX:65536,NATIVE_EDGE_NONE:0,NATIVE_SESSION_CONTROL_PACKET_BYTES:4096,NativeAudioStreamCloseReason:{PreserveNativeTerminal:0,TransportError:1,Disposed:2},NativeAudioStreamFormat:{Mp3:1,Flac:2,Pcm:3},NativeAudioStreamState:{Initializing:0,Buffering:1,Playing:2,Ended:3,Failed:4,Cancelled:5,Reconnecting:6},NativeBorder:{"0":"None","1":"Left","2":"Bottom","4":"Right","8":"Top","15":"All",None:0,Left:1,Bottom:2,Right:4,Top:8,All:15},NativeClipboardCancelStatus:{"0":"Requested","1":"AlreadyTerminal","2":"InvalidHandle",Requested:0,AlreadyTerminal:1,InvalidHandle:2},NativeClipboardCopyStatus:{"0":"Ok","1":"BufferTooSmall","2":"InvalidHandle","3":"InvalidState","4":"InvalidArgument",Ok:0,BufferTooSmall:1,InvalidHandle:2,InvalidState:3,InvalidArgument:4},NativeClipboardDestroyStatus:{"0":"Destroyed","1":"NotReady","2":"InvalidHandle",Destroyed:0,NotReady:1,InvalidHandle:2},NativeClipboardOperationStatus:{"0":"Pending","1":"Read","2":"Empty","3":"Written","4":"Cleared","5":"Unsupported","6":"Cancelled","7":"TimedOut","8":"LimitExceeded","9":"Failed","10":"InvalidHandle",Pending:0,Read:1,Empty:2,Written:3,Cleared:4,Unsupported:5,Cancelled:6,TimedOut:7,LimitExceeded:8,Failed:9,InvalidHandle:10},NativeClipboardShutdownStatus:{"0":"Pending","1":"Ready","2":"InvalidHandle",Pending:0,Ready:1,InvalidHandle:2},NativeClipboardStartStatus:{"0":"Ok","1":"InvalidService","2":"ShuttingDown","3":"LimitExceeded","4":"InvalidArgument","5":"OutOfMemory",Ok:0,InvalidService:1,ShuttingDown:2,LimitExceeded:3,InvalidArgument:4,OutOfMemory:5},NativeEditCommand:{"0":"DeleteForward","1":"Backspace","2":"NewLine","3":"DeleteLine","4":"MoveLeft","5":"MoveRight","6":"MoveUp","7":"MoveDown","8":"GotoLine","9":"CursorOffset","10":"Clear","11":"ClearHistory","12":"DebugRope",DeleteForward:0,Backspace:1,NewLine:2,DeleteLine:3,MoveLeft:4,MoveRight:5,MoveUp:6,MoveDown:7,GotoLine:8,CursorOffset:9,Clear:10,ClearHistory:11,DebugRope:12},NativeEditEvent:{"1":"CursorChanged","2":"ContentChanged","4":"HistoryCursorChanged",CursorChanged:1,ContentChanged:2,HistoryCursorChanged:4},NativeEditHighlightOperation:{"0":"AddLine","1":"AddRange","2":"RemoveRef","3":"ClearLine","4":"ClearAll",AddLine:0,AddRange:1,RemoveRef:2,ClearLine:3,ClearAll:4},NativeEditPositionQuery:{"0":"Cursor","1":"NextWord","2":"PrevWord","3":"Eol","4":"Offset","5":"Coords","6":"LineStart","7":"End","8":"PrevChar",Cursor:0,NextWord:1,PrevWord:2,Eol:3,Offset:4,Coords:5,LineStart:6,End:7,PrevChar:8},NativeEditorCommand:{"0":"MoveUp","1":"MoveDown","2":"GotoLineEnd","3":"DeleteSelection","4":"CursorOffset","5":"WrapMode","6":"TabIndicator",MoveUp:0,MoveDown:1,GotoLineEnd:2,DeleteSelection:3,CursorOffset:4,WrapMode:5,TabIndicator:6},NativeEditorPositionQuery:{"0":"Cursor","1":"NextWord","2":"PrevWord","3":"Eol","4":"VisualSol","5":"VisualEol",Cursor:0,NextWord:1,PrevWord:2,Eol:3,VisualSol:4,VisualEol:5},NativeEditorSelectionOperation:{"0":"Set","1":"Update","2":"Reset","3":"Local","4":"LocalUpdate","5":"LocalReset","6":"Cell","7":"Occupancy","8":"Inclusive","9":"Colors",Set:0,Update:1,Reset:2,Local:3,LocalUpdate:4,LocalReset:5,Cell:6,Occupancy:7,Inclusive:8,Colors:9},NativeEditorStyleMask:{"1":"Foreground","2":"Background","4":"Attributes","7":"All",Foreground:1,Background:2,Attributes:4,All:7},NativeSceneFrame:{"0":"Done","1":"Update","2":"Resize","3":"LayoutChanged","4":"Record","5":"Scroll",Done:0,Update:1,Resize:2,LayoutChanged:3,Record:4,Scroll:5},NativeSceneHook:{"1":"Update","2":"Resize","4":"LayoutChanged","8":"RenderBefore","16":"RenderAfter","32":"RenderSelf","64":"IdleUpdate","128":"Scroll",Update:1,Resize:2,LayoutChanged:4,RenderBefore:8,RenderAfter:16,RenderSelf:32,IdleUpdate:64,Scroll:128},NativeScenePaintPhase:{"0":"Before","1":"Self","2":"After",Before:0,Self:1,After:2},NativeSessionPumpStatus:{"0":"Idle","1":"Again","2":"OutputPending","3":"WaitUntil","4":"Closed",Idle:0,Again:1,OutputPending:2,WaitUntil:3,Closed:4},NativeSessionRenderStatus:{"0":"Presented","1":"Pending","2":"Skipped","3":"Failed",Presented:0,Pending:1,Skipped:2,Failed:3},NativeSessionState:{"0":"Open","1":"Closing","2":"Closed","3":"Failed","4":"Cancelled",Open:0,Closing:1,Closed:2,Failed:3,Cancelled:4},NativeSessionTerminalPhase:{"0":"Uninitialized","1":"SettingUp","2":"Active","3":"Suspending","4":"Suspended","5":"Resuming","6":"Closing","7":"Restored","8":"Failed","9":"Cancelled",Uninitialized:0,SettingUp:1,Active:2,Suspending:3,Suspended:4,Resuming:5,Closing:6,Restored:7,Failed:8,Cancelled:9},NativeStatus:{"0":"Ok",Ok:0,InvalidArgument:-1,"-1":"InvalidArgument",UnsupportedVersion:-2,"-2":"UnsupportedVersion",OutOfMemory:-3,"-3":"OutOfMemory",WrongThread:-4,"-4":"WrongThread",InternalError:-5,"-5":"InternalError",ContextBusy:-6,"-6":"ContextBusy",WrongContext:-7,"-7":"WrongContext",WrongKind:-8,"-8":"WrongKind",StaleHandle:-9,"-9":"StaleHandle",WrongSession:-10,"-10":"WrongSession",OutputBackpressure:-11,"-11":"OutputBackpressure",SessionClosed:-12,"-12":"SessionClosed",OutputBusy:-13,"-13":"OutputBusy",StaleOutput:-14,"-14":"StaleOutput",OutputFailed:-15,"-15":"OutputFailed",ObjectLimit:-16,"-16":"ObjectLimit",RendererAttached:-17,"-17":"RendererAttached",RendererNotAttached:-18,"-18":"RendererNotAttached",InvalidPhase:-19,"-19":"InvalidPhase",ControlPacketLimit:-20,"-20":"ControlPacketLimit",LeaseLimit:-21,"-21":"LeaseLimit",LeaseBytesLimit:-22,"-22":"LeaseBytesLimit",StaleLease:-23,"-23":"StaleLease",UnsupportedResource:-24,"-24":"UnsupportedResource",StaleFrame:-25,"-25":"StaleFrame",LayoutLimit:-26,"-26":"LayoutLimit",FrameBusy:-27,"-27":"FrameBusy",FrameRequestLimit:-28,"-28":"FrameRequestLimit",VideoFailed:-60,"-60":"VideoFailed"},NativeTextViewCommand:{"0":"WrapWidth","1":"WrapMode","2":"FirstLineOffset","3":"TabIndicator","4":"Truncate","5":"TextAlign",WrapWidth:0,WrapMode:1,FirstLineOffset:2,TabIndicator:3,Truncate:4,TextAlign:5},RenderableEvents:{FOCUSED:"focused",BLURRED:"blurred",DESTROYED:"destroyed"},RendererControlState:{IDLE:"idle",AUTO_STARTED:"auto_started",EXPLICIT_STARTED:"explicit_started",EXPLICIT_PAUSED:"explicit_paused",EXPLICIT_SUSPENDED:"explicit_suspended",EXPLICIT_STOPPED:"explicit_stopped"},SelectRenderableEvents:{SELECTION_CHANGED:"selectionChanged",ITEM_SELECTED:"itemSelected"},TabSelectRenderableEvents:{SELECTION_CHANGED:"selectionChanged",ITEM_SELECTED:"itemSelected"},TargetChannel:{"1":"FG","2":"BG","3":"Both",FG:1,BG:2,Both:3},TextAttributes:{NONE:0,BOLD:1,DIM:2,ITALIC:4,UNDERLINE:8,BLINK:16,INVERSE:32,HIDDEN:64,STRIKETHROUGH:128},nonAlphanumericKeys:["f1","f2","f3","f4","f1","f2","f3","f4","f1","f2","f3","f4","f5","f5","f6","f7","f8","f9","f10","f11","f12","menu","clear","up","down","right","left","clear","end","home","f1","f2","f4","up","down","right","left","clear","end","home","return","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9","=","home","insert","delete","end","pageup","pagedown","pageup","pagedown","home","end","up","down","right","left","clear","right","left","up","down","insert","delete","pageup","pagedown","home","end","up","down","right","left","clear","insert","delete","pageup","pagedown","home","end","tab","backspace"],terminalNamedSingleStrokeKeys:["return","linefeed","tab","escape","space","f1","f2","f3","f4","f5","f6","f7","f8","f9","f10","f11","f12","menu","clear","up","down","right","left","end","home","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9","=","insert","delete","pageup","pagedown","backspace","capslock","scrolllock","numlock","printscreen","pause","f13","f14","f15","f16","f17","f18","f19","f20","f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31","f32","f33","f34","f35","kp0","kp1","kp2","kp3","kp4","kp5","kp6","kp7","kp8","kp9","kpdecimal","kpdivide","kpmultiply","kpminus","kpplus","kpenter","kpequal","kpseparator","kpleft","kpright","kpup","kpdown","kppageup","kppagedown","kphome","kpend","kpinsert","kpdelete","mediaplay","mediapause","mediaplaypause","mediareverse","mediastop","mediafastforward","mediarewind","medianext","mediaprev","mediarecord","volumedown","volumeup","mute","leftshift","leftctrl","leftalt","leftsuper","lefthyper","leftmeta","rightshift","rightctrl","rightalt","rightsuper","righthyper","rightmeta","iso_level3_shift","iso_level5_shift"]}},Nr={names:["BoldSpanRenderable","Dynamic","ItalicSpanRenderable","LayoutSlotRenderable","LineBreakRenderable","LinkRenderable","Portal","RenderableContext","RendererContext","Slot","SlotRenderable","TextSlotRenderable","TimeToFirstDraw","UnderlineSpanRenderable","_render","baseComponents","componentCatalogue","createComponent","createDynamic","createElement","createScrollbackWriter","createSlot","createSlotNode","createSolidSlotRegistry","createTextNode","effect","extend","getComponentCatalogue","insert","insertNode","memo","mergeProps","onAnimationTick","onBlur","onFocus","onResize","removeNode","render","setProp","spread","testRender","use","useKeyHandler","useKeyboard","usePaste","useRenderer","useSelectionHandler","useTerminalDimensions","useTimeline","writeSolidToScrollback"],values:{textNodeKeys:["span","b","strong","i","em","u","a"]}},Ur=["abortSplitStartupCursorSeed","addExitListeners","addInputHandler","addListener","addPostProcessFn","admitReplyBatch","advanceSplitTailColumn","afterExternalOutputModeChanged","applyExternalOutputMode","applyPendingExternalOutputModeIfReady","applyPendingNativeMode","applyPendingNativeModeReported","applyPendingNativeResize","applyScreenMode","applySplitFooterReplayReset","armReplyBackstop","auto","blurRenderable","cancelAnimationFrame","cancelKittyImageTransport","changeFocus","cleanupBeforeDestroy","clearClipboardOSC52","clearFrameCallbacks","clearFrameTimer","clearPaletteCache","clearPendingSplitFooterTransition","clearPostProcessFns","clearSelection","clearSelectionState","clearSplitStartupCursorSeed","collectStatSample","completeNativeSplitCommits","configureDebugOverlay","copyToClipboardOSC52","createDroppedRowCommit","createScrollbackSurface","createStdoutSnapshotCommits","deferResize","destroy","disableKittyKeyboard","disableMouse","dispatchMouseEvent","dispatchSequenceHandlers","drainStdinParser","drainStdinShadow","dropLive","dumpHitGrid","dumpOutputCache","emit","emitExternalOutput","emitPaletteChange","enableKittyKeyboard","enableMouse","endReplyBatch","enqueueRenderedScrollbackCommit","enqueueSplitCommits","ensurePaletteDetector","eventNames","finalizeDestroy","finishResume","finishSelection","flushNativeSplitOutput","flushStdoutDecoder","focusRenderable","getCachedPaletteBySize","getCursorState","getDebugInputs","getElapsedMs","getLifecyclePasses","getLinkAt","getLinkIdAt","getMaxListeners","getNativeStats","getPalette","getPendingSplitTailColumn","getSchedulerState","getSelection","getSelectionContainer","getSnapshotDimension","getSplitCursorSeedRows","getSplitOutputOffset","getSplitPinnedRenderOffset","getSplitTailColumnAfterCommit","getStaleSplitSurfaceClear","getStats","halt","handleDroppedFrame","handleStdinEvent","handleStdinParserFailure","hasFrameCallback","hasScheduledWork","hitTest","idle","intermediateRender","internalStart","isIdleNow","isOsc52Supported","isSplitCursorSeedFrameBlocked","isWithinContainer","leaveRawMode","legacyStdinParsers","listenerCount","listeners","logNativeDiagnostics","loop","nextClickBehavior","nextFrameDelay","normalizeClockTime","notifySelectablesOfSelectionChange","off","on","onAnimationTick","once","pause","pauseStdinParsers","prependInputHandler","prependListener","prependOnceListener","presentNativeScene","processCapabilitySequence","processResize","processSingleMouseEvent","queryPixelResolution","queueFrame","rawListeners","recheckHoverState","recordSplitCommit","refreshPalette","registerLifecyclePass","releaseStreamLease","removeAllListeners","removeCleanupListener","removeExitListeners","removeFrameCallback","removeInputHandler","removeListener","removePostProcessFn","requestAnimationFrame","requestLive","requestRender","requestResize","requestSelectionUpdate","resetSplitFooterForReplay","resetSplitScrollback","resetStats","resetTerminalBgColor","resize","resolveIdleIfNeeded","resolveXtVersionWaiters","resume","runAnimationTicks","scheduleAnimationTick","scheduleFrame","scheduleRenderAfterOutputIdle","scheduleRenderTimer","sendMouseEvent","setBackgroundColor","setCursorColor","setCursorPosition","setCursorStyle","setFrameCallback","setGatherStats","setMaxListeners","setMemorySnapshotInterval","setMousePointer","setPendingSplitFooterTransition","setProgramStatus","setRenderOffset","setTerminalTitle","setupInput","setupTerminal","shouldSyncNativePaletteState","splitStdoutRows","start","startKittyTransportPolling","startMemorySnapshotTimer","startRenderLoop","startSelection","startTerminalKeepAlive","stop","stopMemorySnapshotTimer","stopTerminalKeepAlive","subscribeOsc","suspend","syncNativePaletteState","syncReplyContext","syncSplitFooterState","syncSplitScrollback","takeMemorySnapshot","toggleDebugOverlay","trackNativeTerminalTransition","triggerNotification","unregisterLifecyclePass","updateSelection","updateStdinParserProtocolContext","waitForTerminalTransition","waitForThemeMode","waitForXtVersion","walkSelectableRenderables","writeToScrollback","yieldFrame"],Vr=["getPalette","idle","resume","setupTerminal","suspend","waitForThemeMode"],_r=["clear","clearCache","close","connect","createBuffer","destroy","detect","detectOSCSupport","dispose","getPalette","getPerformance","highlightOnce","idle","initialize","loadSoundFile","openCapture","playStreamUrl","preloadParser","read","recordToFile","release","removeBuffer","resetBuffer","resume","setDataPath","settle","setupTerminal","suspend","toBe","toBeNull","toBeUndefined","toContain","toEqual","toHaveBeenCalled","toHaveBeenCalledTimes","toHaveBeenCalledWith","toHaveProperty","toMatchInlineSnapshot","toMatchSnapshot","toThrow","updateBuffer","waitForThemeMode","whenPresented","writeText"],co={extensions:[["astro","astro"],["bash","bash"],["c","c"],["cc","cpp"],["cjs","javascript"],["clj","clojure"],["cljs","clojure"],["cljc","clojure"],["cpp","cpp"],["cxx","cpp"],["cs","csharp"],["cts","typescript"],["ctsx","typescriptreact"],["dart","dart"],["diff","diff"],["edn","clojure"],["go","go"],["gemspec","ruby"],["groovy","groovy"],["h","c"],["handlebars","handlebars"],["hbs","handlebars"],["hpp","cpp"],["hxx","cpp"],["h++","cpp"],["hh","cpp"],["hrl","erlang"],["hs","haskell"],["htm","html"],["html","html"],["ini","ini"],["js","javascript"],["jsx","javascriptreact"],["jl","julia"],["json","json"],["ksh","bash"],["kt","kotlin"],["kts","kotlin"],["latex","latex"],["less","less"],["lua","lua"],["markdown","markdown"],["md","markdown"],["mdown","markdown"],["mkd","markdown"],["mjs","javascript"],["ml","ocaml"],["mli","ocaml"],["mts","typescript"],["mtsx","typescriptreact"],["patch","diff"],["php","php"],["pl","perl"],["pm","perl"],["ps1","powershell"],["psm1","powershell"],["py","python"],["pyi","python"],["r","r"],["rb","ruby"],["rake","ruby"],["rs","rust"],["ru","ruby"],["sass","sass"],["sc","scala"],["scala","scala"],["scss","scss"],["sh","bash"],["sql","sql"],["svelte","svelte"],["swift","swift"],["ts","typescript"],["tsx","typescriptreact"],["tex","latex"],["toml","toml"],["vue","vue"],["vim","vim"],["xml","xml"],["xsl","xsl"],["yaml","yaml"],["yml","yaml"],["zig","zig"],["zon","zig"],["zsh","bash"],["c++","cpp"],["erl","erlang"],["exs","elixir"],["ex","elixir"],["elm","elm"],["fsharp","fsharp"],["fs","fsharp"],["fsx","fsharp"],["fsscript","fsharp"],["fsi","fsharp"],["java","java"],["css","css"]],basenames:[[".bash_aliases","bash"],[".bash_logout","bash"],[".bash_profile","bash"],[".bashrc","bash"],[".kshrc","bash"],[".profile","bash"],[".vimrc","vim"],[".zlogin","bash"],[".zlogout","bash"],[".zprofile","bash"],[".zshenv","bash"],[".zshrc","bash"],["appfile","ruby"],["berksfile","ruby"],["brewfile","ruby"],["cheffile","ruby"],["containerfile","dockerfile"],["dockerfile","dockerfile"],["fastfile","ruby"],["gemfile","ruby"],["gnumakefile","make"],["gvimrc","vim"],["guardfile","ruby"],["makefile","make"],["podfile","ruby"],["rakefile","ruby"],["thorfile","ruby"],["vagrantfile","ruby"]]};var ce={NONE:0,BOLD:1,DIM:2,ITALIC:4,UNDERLINE:8,BLINK:16,INVERSE:32,HIDDEN:64,STRIKETHROUGH:128},Ni={LEFT:0,MIDDLE:1,RIGHT:2,WHEEL_UP:4,WHEEL_DOWN:5};class Se{r;g;b;a;token;constructor(e,n,o,a,d){this.r=e;this.g=n;this.b=o;this.a=a;this.token=d}static fromValues(e,n,o,a=1){return new Se(e,n,o,a)}static fromInts(e,n,o,a=255){return new Se(e/255,n/255,o/255,a/255)}static fromHex(e){return wt(e)}toInts(){return[this.r,this.g,this.b,this.a].map((e)=>Math.round(e*255))}toString(){return`rgba(${this.r.toFixed(2)}, ${this.g.toFixed(2)}, ${this.b.toFixed(2)}, ${this.a.toFixed(2)})`}equals(e){return!!e&&this.toInts().every((n,o)=>n===e.toInts()[o])}}function wt(e){let n=e.replace(/^#/,""),o=n.length===3||n.length===4?[...n].map((d)=>d+d).join(""):n,a=(d)=>parseInt(o.slice(d,d+2),16);if(!/^[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(o))return Se.fromValues(1,0,1,1);return Se.fromInts(a(0),a(2),a(4),o.length===8?a(6):255)}function Ui(e){return"#"+e.toInts().slice(0,3).map((n)=>n.toString(16).padStart(2,"0")).join("")}function Gr(e){if(e instanceof Se)return e;if(e==="transparent")return Se.fromValues(0,0,0,0);return e.startsWith("#")?wt(e):Se.fromValues(1,1,1,1)}function ln(e={}){return(e.bold?ce.BOLD:0)|(e.italic?ce.ITALIC:0)|(e.underline?ce.UNDERLINE:0)|(e.dim?ce.DIM:0)|(e.blink?ce.BLINK:0)|(e.inverse||e.reverse?ce.INVERSE:0)|(e.hidden?ce.HIDDEN:0)|(e.strikethrough?ce.STRIKETHROUGH:0)}var Jr=Symbol.for("@opentui/core/StyledText");class un{chunks;[Jr]=!0;constructor(e){this.chunks=e}}function yo(e){return!!e&&typeof e==="object"&&Jr in e}function Vi(e){return new un([{__isChunk:!0,text:e}])}function _i(e,n){let o=ln(n),a=(d)=>d?Gr(d):void 0;if(typeof e==="object"&&"__isChunk"in e)return{__isChunk:!0,text:e.text,fg:a(n.fg)??e.fg,bg:a(n.bg)??e.bg,attributes:(e.attributes??0)|o,link:e.link};return{__isChunk:!0,text:String(e),fg:a(n.fg),bg:a(n.bg),attributes:o}}var We=(e)=>(n)=>_i(n,e),Gi=We({bold:!0}),Ji=We({italic:!0}),ji=We({underline:!0}),$i=We({strikethrough:!0}),Bi=We({dim:!0}),Wi=We({reverse:!0}),zi=We({blink:!0}),Hi=(e)=>We({fg:e}),Ki=(e)=>We({bg:e}),Xi=(e)=>(n)=>({...typeof n==="object"&&"__isChunk"in n?n:{__isChunk:!0,text:String(n)},link:{url:e}});function Yi(e,...n){let o=[];return e.forEach((a,d)=>{if(a)o.push({__isChunk:!0,text:a,attributes:0});let r=n[d];if(typeof r==="object"&&"__isChunk"in r)o.push(r);else if(r!==void 0)o.push({__isChunk:!0,text:String(r),attributes:0})}),new un(o)}var jr=new Map(co.extensions),dn=new Map(co.basenames);function $r(e){return e.trim().replace(/^\./,"").toLowerCase()||void 0}function Qi(e){let n=e.trim().replaceAll("\\","/");if(!n)return;return n.replace(/\/+$/,"").split("/").at(-1)?.toLowerCase()||void 0}function mo(e){let n=$r(e);return n?jr.get(n):void 0}function Br(e){if(typeof e!=="string")return;let n=Qi(e);if(!n)return;let o=dn.get(n);if(o)return o;let a=n.lastIndexOf(".");if(a===-1||a===n.length-1)return;return mo(n.substring(a+1))}function go(e){if(typeof e!=="string")return;let n=e.trim().split(/\s+/,1)[0]??"",o=dn.get(n.toLowerCase());if(o)return o;let a=$r(n);if(!a)return;return dn.get(a)??Br(a)??mo(a)??a}var Wr=new Set,Zi=new Set(_r);function zr(e){if(Wr.has(e))return;Wr.add(e),console.warn(`${e} from @opentui is not supported by opencode-native yet; it does nothing`)}var Hr=new Proxy({},{get(e,n){if(typeof n==="symbol"||n in e)return Reflect.get(e,n);return()=>{return}}});function xo(e){let n=function(){};return n.prototype=Hr,new Proxy(n,{get(o,a){if(a==="prototype")return Hr;if(a===Symbol.toPrimitive)return()=>"";if(a===Symbol.iterator)return function*(){};if(typeof a==="symbol"||a==="then")return;return xo(`${e}.${a}`)},apply(){zr(e);let o=xo(`${e}()`);return Zi.has(e.slice(e.lastIndexOf(".")+1))?Promise.resolve(o):o},construct(o,a,d){return zr(e),Object.create(d.prototype)}})}function ho(e,n){let o={core:qr,solid:Nr}[e];return{...Object.fromEntries(o.names.map((a)=>[a,xo(a)])),...o.values,...n}}var ea=(e)=>Z(()=>e());function ta({createElement:e,createTextNode:n,isTextNode:o,replaceText:a,insertNode:d,removeNode:r,setProperty:p,getParentNode:c,getFirstChild:t,getNextSibling:s}){function u(f,I,h,M){if(h!==void 0&&!M)M=[];if(typeof I!=="function")return x(f,I,M,h);De((F)=>x(f,I(),F,h),M)}function x(f,I,h,M,F){while(typeof h==="function")h=h();if(I===h)return h;let _=typeof I,q=M!==void 0;if(_==="string"||_==="number"){if(_==="number")I=I.toString();if(q){let A=h[0];if(A&&o(A))a(A,I);else A=n(I);h=k(f,h,M,A)}else if(h!==""&&typeof h==="string")a(t(f),h=I);else k(f,h,M,n(I)),h=I}else if(I==null||_==="boolean")h=k(f,h,M);else if(_==="function")return De(()=>{let A=I();while(typeof A==="function")A=A();h=x(f,A,h,M)}),()=>h;else if(Array.isArray(I)){let A=[];if(R(A,I,F))return De(()=>h=x(f,A,h,M,!0)),()=>h;if(A.length===0){let Ce=k(f,h,M);if(q)return h=Ce}else if(Array.isArray(h))if(h.length===0)V(f,A,M);else v(f,h,A);else if(h==null||!t(f))V(f,A);else v(f,q&&h||[t(f)],A);h=A}else{if(Array.isArray(h)){if(q)return h=k(f,h,M,I);k(f,h,null,I)}else if(h==null||!t(f))d(f,I);else J(f,I,t(f));h=I}return h}function R(f,I,h){let M=!1;for(let F=0,_=I.length;F<_;F++){let q=I[F],A;if(q==null||q===!0||q===!1);else if(Array.isArray(q))M=R(f,q)||M;else if((A=typeof q)==="string"||A==="number")f.push(n(q));else if(A==="function")if(h){while(typeof q==="function")q=q();M=R(f,Array.isArray(q)?q:[q])||M}else f.push(q),M=!0;else f.push(q)}return M}function v(f,I,h){let M=h.length,F=I.length,_=M,q=0,A=0,Ce=s(I[F-1]),W=null;while(qz-A){let bn=I[q];while(A=0;q--){let A=I[q];if(F!==A){let Ce=c(A)===f;if(!_&&!q)Ce?J(f,F,A):d(f,F,h);else Ce&&r(f,A)}else _=!0}}else d(f,F,h);return[F]}function V(f,I,h){for(let M=0,F=I.length;Mh.children=x(f,I.children,h.children));return De(()=>I.ref&&I.ref(f)),De(()=>{for(let F in I){if(F==="children"||F==="ref")continue;let _=I[F];if(_===h[F])continue;p(f,F,_,h[F]),h[F]=_}}),h}return{render(f,I){let h;return se((M)=>{h=M,u(I,f())}),h},insert:u,spread(f,I,h){if(typeof I==="function")De((M)=>j(f,I(),M,h));else j(f,I,void 0,h)},createElement:e,createTextNode:n,insertNode:d,setProp(f,I,h,M){return p(f,I,h,M),h},mergeProps:rn,effect:De,memo:ea,createComponent:pe,use(f,I,h){return Y(()=>f(I,h))}}}function Kr(e){let n=ta(e);return n.mergeProps=rn,n}var gn=new Set(["span","b","strong","i","em","u","a","br"]),na=new Set(["box","text","scrollbox","markdown","code","input","textarea","spinner","select",...gn]),oa=new Set(["tab_select","ascii_font","diff","line_number","image","video"]),ra=new Set(["borderStyle","borderColor","focusedBorderColor","customBorderChars"]),sa=new Set(["input","textarea","scrollbox"]),ia=new Set(["onInput","onChange","onSubmit","onKeyDown"]);class ye{tag;parent;children=[];props={};text;owner;made;#e=Q(!1);get focused(){return this.#e[0]()}set focused(e){this.#e[1](e)}typed;seen;measured=!1;room;listeners=new Map;constructor(e){this.tag=e}requestRender(){Ke(this)}on(e,n){return this.listeners.set(e,[...this.listeners.get(e)??[],n]),this}addListener(e,n){return this.on(e,n)}prependListener(e,n){return this.listeners.set(e,[n,...this.listeners.get(e)??[]]),this}once(e,n){let o=(...a)=>(this.off(e,o),n(...a));return this.on(e,o)}off(e,n){let o=this.listeners.get(e)??[],a=o.indexOf(n);if(a!==-1)this.listeners.set(e,o.toSpliced(a,1));return this}removeListener(e,n){return this.off(e,n)}removeAllListeners(e){if(e===void 0)this.listeners.clear();else this.listeners.delete(e);return this}listenerCount(e){return this.listeners.get(e)?.length??0}emit(e,...n){let o=this.listeners.get(e)??[];for(let a of o)a(...n);return o.length>0}focus(){let e=le(this);if(e.owner)return e.owner.focus?.focus(this);let n=this.made&&pt(this.made,()=>Re(Qr));if(aa.has(this.tag))n?.(`focus() of an <${this.tag}> in no mount`)}blur(){le(this).owner?.focus?.blur(this)}get scrollTop(){return le(this).owner?.scrolls?.state(this)?.offset??0}get scrollHeight(){return le(this).owner?.scrolls?.state(this)?.extent??0}get viewport(){let e=le(this).owner?.scrolls?.state(this);return{width:Number(this.props.width)||0,height:e?.viewport??1/0}}scrollTo(e){let n=typeof e==="number"?e:e?.y??0;le(this).owner?.scrolls?.to(this,Math.round(n))}scrollBy(e){this.scrollTo(this.scrollTop+(typeof e==="number"?e:e?.y??0))}scrollChildIntoView(e){le(this).owner?.scrolls?.into?.(this,e)}get value(){return this.typed??String(this.props.value??this.props.initialValue??"")}set value(e){this.typed=void 0,this.props.value=e,Ke(this)}measure(){if(!this.measured)this.measured=!0,Ke(this);let e=le(this).owner?.scrolls?.rect?.(this);if(!e||e.width===0&&e.height===0)return this.ahead();let n=(o,a)=>typeof o==="number"?o:a;return{...e,width:n(this.props.width,e.width),height:n(this.props.height,e.height)}}ahead(){let e=this.parent?.room;if(!e||this.parent?.parent)return;let n=this.props.width==="100%"?e.width:typeof this.props.width==="number"?this.props.width:void 0,o=typeof this.props.height==="number"?this.props.height:0;return n===void 0?void 0:{x:0,y:0,width:n,height:o}}getLayout(){let e=this.measure(),n=this,[o,a,d,r]=[e?.x??0,e?.y??0,e?.width??0,e?.height??0],p=()=>n.parent?.parent?n.parent.measure():void 0;return{x:o,y:a,width:d,height:r,get left(){return o-(p()?.x??0)},get top(){return a-(p()?.y??0)},get right(){return o-(p()?.x??0)+d},get bottom(){return a-(p()?.y??0)+r}}}focusChanged(e){if(this.#e[0]()===e)return;this.#e[1](e),this.emit(e?"focused":"blurred")}getChildren(){return[...this.children]}add(e,n){if(!(e instanceof ye))return le(this).owner?.report?.("a renderable built with new");mn(this,e,n===void 0?void 0:this.children[n])}insertBefore(e,n){if(!(e instanceof ye))return le(this).owner?.report?.("a renderable built with new");mn(this,e,n instanceof ye?n:void 0)}remove(e){let n=this.children.find((o)=>o.props.id===e);if(n)Io(this,n)}}for(let e of["fg","bg","backgroundColor","content","visible","width","height","attributes","borderColor","title","titleAlignment","bottomTitle","bottomTitleAlignment","wrapMode","truncate","flexDirection","flexGrow","flexShrink","alignItems","justifyContent","gap","padding","paddingX","paddingY","paddingLeft","paddingRight","paddingTop","paddingBottom","margin","marginLeft","marginRight","marginTop","marginBottom","border","borderStyle","filetype","placeholder"])Object.defineProperty(ye.prototype,e,{get(){if(e!=="width"&&e!=="height")return this.props[e];return this.measure()?.[e]??0},set(n){if(this.props[e]===n)return;this.props[e]=n,Ke(this)}});var aa=new Set(["input","textarea","scrollbox"]);function le(e){let n=e;while(n.parent)n=n.parent;return n}function Ke(e){le(e).owner?.invalidate()}function da(e){return e.tag==="#text"||gn.has(e.tag)}function mn(e,n,o){if(da(n)&&!(n.tag==="#text"&&n.text==="")&&!(e.tag==="text"||gn.has(e.tag)))throw Error(`Orphan text error: "${Xr(n)}" must have a as a parent`);for(let d=e;d;d=d.parent)if(d===n)throw Error(`a <${n.tag}> cannot be added inside itself`);if(n.parent)Io(n.parent,n);let a=o?e.children.indexOf(o):-1;if(a===-1)e.children.push(n);else e.children.splice(a,0,n);n.parent=e,Ke(e)}function Io(e,n){let o=e.children.indexOf(n);if(o!==-1)e.children.splice(o,1);n.parent=void 0,Ke(e)}function Xr(e){return e.tag==="#text"?e.text??"":e.children.map(Xr).join("")}var Yr=Kr({createElement(e){if(oa.has(e))throw Error(`<${e}> is not supported by opencode-native's JS host`);if(!na.has(e))throw Error(`[Reconciler] Unknown component type: ${e}`);let n=new ye(e);return n.made=nt(),n},createTextNode(e){let n=new ye("#text");return n.text=String(e),n},replaceText(e,n){e.text=n,Ke(e)},isTextNode(e){return e.tag==="#text"},setProperty(e,n,o){let a=e.props.focused;if(!gn.has(e.tag)&&n==="style")Object.assign(e.props,o??{});else e.props[n==="text"?"content":n]=o;if(Ke(e),n==="focused"&&sa.has(e.tag)&&!!o!==!!a)queueMicrotask(()=>o?e.focus():e.blur())},insertNode(e,n,o){if(!(n instanceof ye))return le(e).owner?.report?.("a renderable built with new");mn(e,n,o instanceof ye?o:void 0)},removeNode(e,n){if(!(n instanceof ye))return;le(e).owner?.focus?.detached?.(n),Io(e,n)},getParentNode(e){return e.parent},getFirstChild(e){return e.children[0]},getNextSibling(e){let n=e.parent?.children??[];return n[n.indexOf(e)+1]}}),{render:la,effect:ua,memo:pa,createElement:gt,createTextNode:ca,insert:bo,spread:kt,setProp:At,mergeProps:fn,use:ya}=Yr;var Tt=Ve(),Qr=Ve();function ma(){return Re(Tt)?.renderer??{}}function Zr(){let e=Re(Tt);return Z(()=>({width:e?.width()??0,height:e?.height()??0}))}function ga(e){let n=Zr();De(()=>e(n().width,n().height))}var Qe=new Set;function Mt(e){return()=>{Qe.add(e)}}function es(e,n){let o=Re(Tt)?.renderer.keyInput;if(!o){Qe.add("useKeyboard");return}if(o.on("keypress",e),n?.release)o.on("keyrelease",e);ue(()=>{o.off("keypress",e),o.off("keyrelease",e)})}var fa=es,xa=Mt("usePaste"),ha=Mt("onFocus"),Sa=Mt("onBlur"),Ia=Mt("useSelectionHandler"),ba=Mt("onAnimationTick"),Ea=()=>(Qe.add("useTimeline"),{add(){},play(){},pause(){}});function Eo(e,n,o,a,d,r,p){let c=new ye("box");c.owner={invalidate:o,focus:d,scrolls:r,report:p};let t=()=>{},s={root:c,dispose:()=>t(),keys:new Set},u=(x)=>{if(s.crashed!==void 0)return;s.crashed=x instanceof Error?x.message:String(x),c.children=[],queueMicrotask(()=>{t(),c.children=[],o()}),a(x)};try{t=Yr.render(()=>pe(Tt.Provider,{value:n,get children(){return pe(Qr.Provider,{value:p,get children(){return on(e,u)}})}}),c)}catch(x){u(x)}return s}function vo(e,n){let o=Ro(e.children,n),a=o.length>0&&o.every((d)=>d.layout?.absolute);return xe({type:"box",layout:a?{absolute:{top:0,right:0,bottom:0,left:0}}:void 0,children:o})}function Do(e,n){return e.props.visible===!1?xe({type:"box",children:[]}):ts(e,n)}var va=new Set(["width","height","minWidth","maxWidth","minHeight","maxHeight","flexGrow","flexShrink","margin","marginX","marginY","marginLeft","marginRight","marginTop","marginBottom","position","top","right","bottom","left","zIndex"]);function Ro(e,n){return e.flatMap((o)=>{if(o.tag==="#text"){if(o.text)throw Error("rendered bare text; wrap it in ");return[]}if(o.props.visible===!1)return[];return[ts(o,n)]})}function ts(e,n){let o=e.props,a=Ta(o,n),d=Aa(e,n);switch(e.tag){case"text":{let r=wa(e,n);return xe({type:"text",spans:r,fg:Ye(o.fg),wrap:o.wrapMode==="none"?"none":o.wrapMode==="char"?"char":void 0,truncate:o.truncate?!0:void 0,selectable:o.selectable===!1?!1:void 0,layout:a,on_click:d})}case"scrollbox":return xe({type:"scroll",id:he(e),follow:o.stickyScroll?!0:void 0,scrollbar:o.scrollbarOptions?.visible===!1||o.verticalScrollbarOptions?.visible===!1?void 0:!0,layout:a,children:Ro(Ca(e),n)});case"markdown":return xe({type:"markdown",source:{text:String(o.content??"")}});case"fence":for(let r of Object.keys(o).filter((p)=>p!=="bg"&&!va.has(p)))n.dropped.add(`a code block's default render ${r}`);return xe({type:"fence",bg:Ye(o.bg),layout:a});case"spinner":for(let r of["frames","interval","color","backgroundColor","autoplay"])if(o[r]!==void 0)n.dropped.add(` ${r}`);return{type:"spinner",label:""};case"select":return Ra(e,a,d,n);case"code":return xe({type:"code",content:{text:String(o.content??"")},filetype:o.filetype,layout:a});case"input":case"textarea":for(let r of Object.keys(o).filter((p)=>/^on[A-Z]/.test(p)&&!ia.has(p)))if(typeof o[r]==="function")n.dropped.add(`<${e.tag}> ${r}`);return xe({type:"input",id:he(e),value:String(o.value??o.initialValue??""),placeholder:o.placeholder,lines:e.tag==="textarea"?Xe(Number(o.height)||3,1,65535):void 0,layout:a,seen:le(e).seen?.get(he(e))});default:return Pa(e,a,d,n)}}var Da={backgroundColor:"transparent",textColor:"#FFFFFF",selectedBackgroundColor:"#334455",selectedTextColor:"#FFFF00",descriptionColor:"#888888",selectedDescriptionColor:"#CCCCCC"};function Ra(e,n,o,a){let d=e.props,r=Array.isArray(d.options)?d.options:[],p=(V)=>Ye(d[V]??Da[V]),c=d.showDescription!==!1,t=d.showSelectionIndicator!==!1,s=(c?2:1)+(Number(d.itemSpacing)||0),u=typeof d.height==="number"?Math.floor(d.height/s):r.length,x=Xe(Number(d.selectedIndex)||0,0,Math.max(0,r.length-1)),R=Xe(x-u+1,0,Math.max(0,r.length-u));for(let V of["onChange","keyBindings","font","showScrollIndicator"])if(d[V]!==void 0)a.dropped.add(` ${V}`);let v=(V,J,j)=>fe({type:"text",spans:[{text:V}],fg:J,wrap:"none",layout:{margin:{left:j,right:0,top:0,bottom:0}}}),k=r.slice(R,R+u).map((V,J)=>{let j=R+J===x,f=t?j?"\u25B6 ":" ":"";return fe({type:"box",bg:j?p("selectedBackgroundColor"):void 0,children:[v(`${f}${String(V?.name??"")}`,p(j?"selectedTextColor":"textColor"),1),...c?[v(String(V?.description??""),p(j?"selectedDescriptionColor":"descriptionColor"),1+(t?2:0))]:[]]})});return fe({type:"box",id:xe(e),bg:p("backgroundColor"),layout:n,on_click:o,children:k})}var So=new WeakMap,Oa=0;function xe(e){if(typeof e.props.id==="string"&&e.props.id)return e.props.id;if(!So.has(e))So.set(e,`opentui-${e.tag}-${++Oa}`);return So.get(e)}function Ca(e){return e.children}function Pa(e,n,o,a){let d=e.props,r=ns(d,"padding"),p=r&&r.left===r.right&&r.top===r.bottom&&r.left>=0&&r.top>=0;if(typeof(d.onSizeChange??e.onSizeChange)==="function")e.measure();return fe({type:"box",id:e.measured?xe(e):void 0,row:String(d.flexDirection??"column").startsWith("row")?!0:void 0,gap:qa(d.gap??(String(d.flexDirection??"").startsWith("row")?d.columnGap:d.rowGap)),padding:r&&p?[r.left,r.top]:void 0,padding_sides:r&&!p?r:void 0,justify:La(d.justifyContent),align:Fa(d.alignItems),bg:Ye(d.backgroundColor),layout:n,on_click:o,children:Ro(e.children,a),border:Ma(d),wrap:d.flexWrap==="wrap"?!0:void 0,overflow:d.overflow==="hidden"||d.overflow==="scroll"?"hidden":void 0})}function wa(e,n){let o=typeof e.props.attributes==="number"?e.props.attributes:0,a=[],d=(p,c)=>{if(p.tag==="#text"){if(p.text)a.push(pn(p.text,c));return}if(p.tag==="br"){a.push(pn(` +`,c));return}for(let t of p.children)d(t,p===e?c:ka(p,c))};d(e,{attributes:o,bg:e.props.bg});let r=e.props.content;if(r===void 0||e.children.length>0)return a;if(yo(r))for(let p of r.chunks){let c={attributes:o|(p.attributes??0),fg:p.fg,bg:p.bg??e.props.bg,link:p.link?.url};if(p.text)a.push(pn(p.text,c))}else a.push(pn(String(r),{attributes:o,bg:e.props.bg}));return a}function ka(e,n){let o=e.props.style??{},a=ln(o)|(e.tag==="b"||e.tag==="strong"?ce.BOLD:0)|(e.tag==="i"||e.tag==="em"?ce.ITALIC:0)|(e.tag==="u"?ce.UNDERLINE:0);return{attributes:n.attributes|a|(typeof o.attributes==="number"?o.attributes:0),fg:o.fg??n.fg,bg:o.bg??n.bg,link:e.tag==="a"?String(e.props.href??""):n.link}}function pn(e,n){let o=(a)=>(n.attributes&a)!==0?!0:void 0;return fe({text:e,fg:Ye(n.fg),bg:Ye(n.bg),bold:o(ce.BOLD),italic:o(ce.ITALIC),underline:o(ce.UNDERLINE),dim:o(ce.DIM),strikethrough:o(ce.STRIKETHROUGH),link:n.link||void 0})}function Aa(e,n){let o=e.props.onMouseDown,a=e.props.onMouseUp??e.props.onClick,d=o??a;if(typeof d!=="function")return;if(o&&a)n.dropped.add("onMouseUp beside onMouseDown");let r=n.press(e,d,o?"down":"up");return r===void 0?void 0:{action:r,on:o?"down":"up"}}function Ta(e,n){let o=ns(e,"margin"),a=e.position==="absolute";for(let r of["alignSelf","flexBasis"])if(e[r]!==void 0)n.dropped.add(r);let d=fe({width:mt(e.width),grow:Number(e.flexGrow)>0?!0:void 0,shrink:e.flexShrink!==void 0?Number(e.flexShrink)>0:typeof e.width==="number"||typeof e.height==="number"?!1:void 0,min_width:mt(e.minWidth),max_width:mt(e.maxWidth),height:mt(e.height),min_height:mt(e.minHeight),max_height:mt(e.maxHeight),margin:o,absolute:a?fe({top:cn(e.top),right:cn(e.right),bottom:cn(e.bottom),left:cn(e.left),z:Number.isFinite(Number(e.zIndex))?Xe(Number(e.zIndex),-2147483648,2147483647)||void 0:void 0}):void 0});return Object.keys(d).length?d:void 0}function ns(e,n){let o=yn(e[n])??0,a=yn(e[`${n}X`]),d=yn(e[`${n}Y`]),r=(c,t)=>yn(e[`${n}${c}`])??t??o,p={top:r("Top",d),right:r("Right",a),bottom:r("Bottom",d),left:r("Left",a)};return p.top||p.right||p.bottom||p.left?p:void 0}function Ma(e){let n=!1;for(let a of Object.keys(e))if(a==="border")n=e.border;else if(ra.has(a)&&n===!1)n=!0;if(n!==!0&&!Array.isArray(n))return;let o=Array.isArray(n)?{top:n.includes("top"),right:n.includes("right"),bottom:n.includes("bottom"),left:n.includes("left")}:void 0;return fe({sides:o,style:["double","rounded","heavy"].includes(e.borderStyle)?e.borderStyle:void 0,color:Ye(e.borderColor),title:e.title===void 0?void 0:String(e.title),title_align:["center","right"].includes(e.titleAlignment)?e.titleAlignment:void 0,bottom_title:e.bottomTitle===void 0?void 0:String(e.bottomTitle),bottom_title_align:["center","right"].includes(e.bottomTitleAlignment)?e.bottomTitleAlignment:void 0})}function La(e){return{"flex-end":"end",center:"center","space-between":"space-between","space-around":"space-around"}[String(e)]}function Fa(e){return{"flex-start":"start",center:"center","flex-end":"end"}[String(e)]}var Xe=(e,n,o)=>Math.min(o,Math.max(n,Math.round(e)));function mt(e){if(typeof e==="number"&&Number.isFinite(e))return{cells:Xe(e,0,65535)};if(typeof e!=="string"||!e.endsWith("%"))return;let n=Number(e.slice(0,-1));return Number.isFinite(n)?{percent:Math.min(100,Math.max(0,n))}:void 0}function cn(e){return typeof e==="number"&&Number.isFinite(e)?Xe(e,-32768,32767):void 0}function yn(e){return typeof e==="number"&&Number.isFinite(e)?Xe(e,-32768,32767):void 0}function qa(e){return typeof e==="number"&&Number.isFinite(e)?Xe(e,0,65535):void 0}function Ye(e){if(e===void 0||e===null||e==="")return;if(e instanceof he||typeof e==="object"&&"r"in e){let o=e;if(o.token)return o.token;let[a,d,r,p]=[o.r,o.g,o.b,o.a??1].map((c)=>Math.round(Math.min(1,Math.max(0,c))*255).toString(16).padStart(2,"0"));return`#${a}${d}${r}${p}`}let n=String(e);if(n==="transparent")return"#00000000";return n}function fe(e){return Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))}function Na(e){if(!e)return{};if(!("key"in e))return e;let{key:n,...o}=e;return o}function Co(e,n={}){let o=Na(n);if(typeof e==="function")return pe(e,o);let a=gt(e);return kt(a,o),a}var Ua=Co;function Va(e,n={}){return Co(e,n)}function _a(e){return e.children??null}class st extends ye{constructor(e,n){super(e);for(let[o,a]of Object.entries(n??{}))At(this,o,a)}destroy(){}destroyRecursively(){}}class Po extends st{constructor(e,n){super("box",n)}}class wo extends st{constructor(e,n){super("text",n)}}class ko extends st{constructor(e,n){super("markdown",n)}}class Ao extends st{constructor(e,n){super("code",n)}}class To extends st{constructor(e,n){super("scrollbox",n)}}class Mo extends st{constructor(e,n){super("input",n)}}class Lo extends ye{constructor(){super("fence")}}import{EventEmitter as $a}from"events";import{homedir as Ba}from"os";class be extends Error{reason;name="ClientError";constructor(e,n){let o=n?.detail??(n?.cause instanceof Error?n.cause.message:void 0);super(o?`${e}: ${o}`:e,n);this.reason=e}}var Ga=16777216;function Ja(e){let n=e.fetch??globalThis.fetch,o=(t,s)=>{let u=new URL(e.baseUrl);if(!u.pathname.endsWith("/"))u.pathname+="/";let x=new URL(t.path.slice(1),u);for(let[v,k]of Object.entries(t.query??{}))Fo(x.searchParams,v,k);let R=new Headers(e.headers);for(let[v,k]of Object.entries(t.headers??{}))if(k!==void 0&&k!==null)R.set(v,String(k));for(let[v,k]of new Headers(s?.headers))R.set(v,k);if(t.body!==void 0&&!R.has("content-type"))R.set("content-type",t.binaryBody?"application/octet-stream":"application/json");return{url:x,init:{method:t.method,signal:s?.signal,headers:R,body:t.body===void 0?void 0:t.binaryBody?t.body:JSON.stringify(t.body)}}},a=async(t,s)=>{try{let u=o(t,s);return await n(u.url,u.init)}catch(u){throw new be("Transport",{cause:u})}},d=async(t,s)=>{if(s.declaredStatuses.includes(t.status))throw ja(await rs(t));try{await t.body?.cancel()}catch{}throw new be("UnexpectedStatus",{cause:{status:t.status},detail:String(t.status)})},r=async(t,s)=>{let u=await a(t,s);if(u.status!==t.successStatus)return d(u,t);if(t.binary)return new Uint8Array(await u.arrayBuffer());if(t.empty){try{await u.body?.cancel()}catch{}return}return await rs(u)},p=(t,s)=>({async*[Symbol.asyncIterator](){let u=await a(t,s);if(u.status!==t.successStatus)await d(u,t);if(!ss(u,"text/event-stream")){try{await u.body?.cancel()}catch{}throw new be("UnsupportedContentType",{detail:u.headers.get("content-type")})}if(u.body===null)throw new be("MalformedResponse");let x=u.body.getReader(),R=new TextDecoder,v="";try{while(!0){let k;try{k=await x.read()}catch(j){throw new be("Transport",{cause:j})}if(!k.done)s?.onActivity?.();if(v+=R.decode(k.value,{stream:!k.done}),v.length>Ga)throw new be("SseEventTooLarge");let V=!k.done&&v.endsWith("\r");if(V)v=v.slice(0,-1);if(v=v.replaceAll(`\r `,` `).replaceAll("\r",` `),V)v+="\r";if(k.done&&v!=="")v+=` @@ -10,7 +10,7 @@ var Ms=Object.defineProperty;var Ls=(e)=>e;function Fs(e,n){this[e]=Ls.bind(null `);while(J>=0){let j=v.slice(0,J);v=v.slice(J+2);let f=j.split(` `).flatMap((I)=>I.startsWith("data:")?[I.slice(5).trimStart()]:[]).join(` -`);if(f!=="")try{yield JSON.parse(f)}catch(I){throw new Ee("MalformedResponse",{cause:I})}J=v.indexOf(` +`);if(f!=="")try{yield JSON.parse(f)}catch(I){throw new be("MalformedResponse",{cause:I})}J=v.indexOf(` -`)}if(k.done)return}}finally{try{await x.cancel()}catch{}x.releaseLock()}}}),c={server:{info:(t)=>r({method:"GET",path:"/api/info",successStatus:200,declaredStatuses:[400,401],empty:!1},t),pair:(t)=>r({method:"POST",path:"/api/pair",successStatus:200,declaredStatuses:[400,401],empty:!1},t),connect:(t,s)=>r({method:"GET",path:`/auth/connect/${encodeURIComponent(t.code)}`,successStatus:200,declaredStatuses:[400,401],empty:!1},s)},location:{get:(t,s)=>r({method:"GET",path:"/api/location",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),reload:(t)=>r({method:"POST",path:"/api/location/reload",successStatus:204,declaredStatuses:[400,401,503],empty:!0},t)},agent:{list:(t,s)=>r({method:"GET",path:"/api/agent",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),get:(t,s)=>r({method:"GET",path:`/api/agent/${encodeURIComponent(t.agentID)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},plugin:{list:(t,s)=>r({method:"GET",path:"/api/plugin",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),gui:(t,s)=>r({method:"GET",path:"/api/plugin/gui",query:{location:t.location,id:t.id},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),check:(t,s)=>r({method:"POST",path:"/api/plugin/check",query:{location:t?.location},body:{target:t?.target},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),update:(t,s)=>r({method:"POST",path:"/api/plugin/update",query:{location:t.location},body:{targets:t.targets},successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},s)},session:{list:(t,s)=>r({method:"GET",path:"/api/session",query:{limit:t?.limit,order:t?.order,search:t?.search,parentID:t?.parentID,archived:t?.archived,directory:t?.directory,project:t?.project,subpath:t?.subpath,cursor:t?.cursor},successStatus:200,declaredStatuses:[400,401],empty:!1},s),create:(t,s)=>r({method:"POST",path:"/api/session",body:{id:t?.id,parentID:t?.parentID,title:t?.title,agent:t?.agent,model:t?.model,location:t?.location,metadata:t?.metadata,permissions:t?.permissions},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),active:(t)=>r({method:"GET",path:"/api/session/active",successStatus:200,declaredStatuses:[400,401],empty:!1},t).then((s)=>s.data),get:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),remove:(t,s)=>r({method:"DELETE",path:`/api/session/${encodeURIComponent(t.sessionID)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),fork:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/fork`,body:{before:t.before},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),switchAgent:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/agent`,body:{agent:t.agent},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),switchModel:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/model`,body:{model:t.model},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),update:(t,s)=>r({method:"PATCH",path:`/api/session/${encodeURIComponent(t.sessionID)}`,body:{title:t.title,metadata:t.metadata,permissions:t.permissions,archived:t.archived},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),move:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/move`,body:{directory:t.directory,delivery:t.delivery},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),prompt:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/prompt`,body:{id:t.id,text:t.text,files:t.files,agents:t.agents,skills:t.skills,metadata:t.metadata,delivery:t.delivery,resume:t.resume},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},s).then((u)=>u.data),command:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/command`,body:{name:t.name,text:t.text,files:t.files,agents:t.agents,skills:t.skills,delivery:t.delivery},successStatus:204,declaredStatuses:[400,401,404,500],empty:!0},s),synthetic:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/synthetic`,body:{id:t.id,text:t.text,description:t.description,metadata:t.metadata,delivery:t.delivery,resume:t.resume},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},s).then((u)=>u.data),shell:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/shell`,body:{id:t.id,command:t.command},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),compact:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/compact`,body:{id:t.id,delivery:t.delivery},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},s).then((u)=>u.data),revert:{stage:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/revert/stage`,body:{messageID:t.messageID,files:t.files},successStatus:200,declaredStatuses:[400,401,404,409,500],empty:!1},s).then((u)=>u.data),clear:(t,s)=>r({method:"DELETE",path:`/api/session/${encodeURIComponent(t.sessionID)}/revert`,successStatus:204,declaredStatuses:[400,401,404,409,500],empty:!0},s),commit:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/revert/commit`,successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},s)},context:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/context`,successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},s).then((u)=>u.data),diff:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/diff`,query:{from:t.from,to:t.to,context:t.context},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},s).then((u)=>u.data),inbox:{list:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/inbox`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),cancel:(t,s)=>r({method:"DELETE",path:`/api/session/${encodeURIComponent(t.sessionID)}/inbox/${encodeURIComponent(t.inboxID)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),update:(t,s)=>r({method:"PATCH",path:`/api/session/${encodeURIComponent(t.sessionID)}/inbox/${encodeURIComponent(t.inboxID)}`,body:{delivery:t.delivery},successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},s)},generate:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/generate`,body:{prompt:t.prompt},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s).then((u)=>u.data),interrupt:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/interrupt`,query:{resume:t.resume},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),background:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/background`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),message:{get:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/message/${encodeURIComponent(t.messageID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data)},form:{list:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/form`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),create:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/form`,body:{id:t.id,title:t.title,metadata:t.metadata,fields:t.fields},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},s).then((u)=>u.data),get:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/form/${encodeURIComponent(t.formID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),reply:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/form/${encodeURIComponent(t.formID)}/reply`,body:{answer:t.answer},successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},s),cancel:(t,s)=>r({method:"DELETE",path:`/api/session/${encodeURIComponent(t.sessionID)}/form/${encodeURIComponent(t.formID)}`,query:{message:t.message},successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},s)},environment:(t,s)=>r({method:"PUT",path:`/api/session/${encodeURIComponent(t.sessionID)}/environment`,body:{variables:t.variables},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),view:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/view`,body:{idle:t.idle},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)},experimental:{session:{stats:(t,s)=>r({method:"GET",path:"/api/experimental/session/stats",query:{from:t?.from,to:t?.to,project:t?.project,timezone:t?.timezone,tools:t?.tools},successStatus:200,declaredStatuses:[400,401],empty:!1},s).then((u)=>u.data),import:(t,s)=>r({method:"POST",path:"/api/experimental/session/import",body:{info:t.info,messages:t.messages,location:t.location},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},s).then((u)=>u.data),export:(t,s)=>r({method:"GET",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/export`,query:{sanitize:t.sanitize},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},s).then((u)=>u.data),skill:(t,s)=>r({method:"POST",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/skill`,body:{id:t.id,resume:t.resume},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),wait:(t,s)=>r({method:"POST",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/wait`,successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},s),instructions:{entry:{list:(t,s)=>r({method:"GET",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/instructions/entries`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),put:(t,s)=>r({method:"PUT",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/instructions/entries/${encodeURIComponent(t.key)}`,body:{value:t.value},successStatus:204,declaredStatuses:[400,401,404,413],empty:!0},s),remove:(t,s)=>r({method:"DELETE",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/instructions/entries/${encodeURIComponent(t.key)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)}},log:(t,s)=>p({method:"GET",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/log`,query:{after:t.after,follow:t.follow},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},generate:{text:(t,s)=>r({method:"POST",path:"/api/experimental/generate/text",body:{prompt:t.prompt,model:t.model},successStatus:200,declaredStatuses:[400,401,404,422,502,503],empty:!1},s).then((u)=>u.data),image:(t,s)=>r({method:"POST",path:"/api/experimental/generate/image",body:{model:t.model,prompt:t.prompt,images:t.images,n:t.n,aspect:t.aspect,resolution:t.resolution},successStatus:200,declaredStatuses:[400,401,404,422,502,503],empty:!1},s).then((u)=>u.data),video:{create:(t,s)=>r({method:"POST",path:"/api/experimental/generate/video",body:{model:t.model,prompt:t.prompt,start:t.start,end:t.end,references:t.references,duration:t.duration,aspect:t.aspect,resolution:t.resolution,sound:t.sound},successStatus:200,declaredStatuses:[400,401,403,404,422,502,503],empty:!1},s).then((u)=>u.data),get:(t,s)=>r({method:"GET",path:`/api/experimental/generate/video/${encodeURIComponent(t.id)}`,successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},s).then((u)=>u.data)},decisions:(t,s)=>r({method:"POST",path:"/api/experimental/generate/decisions",body:{model:t.model,input:t.input,questions:t.questions},successStatus:200,declaredStatuses:[400,401,404,422,502,503],empty:!1},s).then((u)=>u.data)},voice:{models:(t)=>r({method:"GET",path:"/api/experimental/voice/models",successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t).then((s)=>s.data),session:(t,s)=>r({method:"POST",path:"/api/experimental/voice/session",body:{model:t.model,session:t.session,transport:t.transport},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s).then((u)=>u.data)},integration:{wellknown:{add:(t,s)=>r({method:"POST",path:"/api/experimental/integration/wellknown",query:{location:t.location},body:{url:t.url},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)}},mcp:{add:(t,s)=>r({method:"PUT",path:`/api/experimental/mcp/${encodeURIComponent(t.server)}`,query:{location:t.location},body:{config:t.config},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),remove:(t,s)=>r({method:"DELETE",path:`/api/experimental/mcp/${encodeURIComponent(t.server)}`,query:{location:t.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),connect:(t,s)=>r({method:"POST",path:`/api/experimental/mcp/${encodeURIComponent(t.server)}/connect`,query:{location:t.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),disconnect:(t,s)=>r({method:"POST",path:`/api/experimental/mcp/${encodeURIComponent(t.server)}/disconnect`,query:{location:t.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),client:{token:(t,s)=>r({method:"POST",path:"/api/experimental/client-mcp/token",query:{location:t.location,name:t.name},headers:{"x-opencode-ticket":t["x-opencode-ticket"]},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},s)}},file:{write:(t,s)=>r({method:"POST",path:"/api/experimental/fs/write",query:{location:t.location,path:t.path},body:t.payload,successStatus:200,declaredStatuses:[400,401,404],empty:!1,binaryBody:!0},s),watch:(t,s)=>r({method:"POST",path:"/api/experimental/fs/watch",query:{location:t.location},body:{path:t.path},successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},s),unwatch:(t,s)=>r({method:"DELETE",path:"/api/experimental/fs/watch",query:{location:t.location},body:{path:t.path},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)},persistentPty:{read:(t,s)=>r({method:"GET",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/terminal/read`,query:{lines:t.lines},successStatus:200,declaredStatuses:[400,401,503],empty:!1},s).then((u)=>u.data),list:(t,s)=>r({method:"GET",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/terminal`,successStatus:200,declaredStatuses:[400,401,503],empty:!1},s).then((u)=>u.data),create:(t,s)=>r({method:"POST",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/terminal`,body:{command:t.command,args:t.args,cwd:t.cwd,title:t.title,env:t.env,size:t.size},successStatus:200,declaredStatuses:[400,401,503],empty:!1},s).then((u)=>u.data),shutdown:(t)=>r({method:"POST",path:"/api/experimental/persistent-pty/shutdown",successStatus:204,declaredStatuses:[400,401,503],empty:!0},t),handoff:(t)=>r({method:"POST",path:"/api/experimental/persistent-pty/handoff",successStatus:200,declaredStatuses:[400,401,503],empty:!1},t),get:(t,s)=>r({method:"GET",path:`/api/experimental/persistent-pty/${encodeURIComponent(t.ptyID)}`,successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s).then((u)=>u.data),update:(t,s)=>r({method:"PUT",path:`/api/experimental/persistent-pty/${encodeURIComponent(t.ptyID)}`,body:{attachmentID:t.attachmentID,size:t.size,title:t.title},successStatus:200,declaredStatuses:[400,401,404,501,503],empty:!1},s).then((u)=>u.data),snapshot:(t,s)=>r({method:"GET",path:`/api/experimental/persistent-pty/${encodeURIComponent(t.ptyID)}/snapshot`,successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s).then((u)=>u.data),remove:(t,s)=>r({method:"DELETE",path:`/api/experimental/persistent-pty/${encodeURIComponent(t.ptyID)}`,successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},s),connectToken:(t,s)=>r({method:"POST",path:`/api/experimental/persistent-pty/${encodeURIComponent(t.ptyID)}/connect-token`,headers:{"x-opencode-ticket":t["x-opencode-ticket"]},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},s).then((u)=>u.data)},media:{get:(t,s)=>r({method:"GET",path:`/api/experimental/media/${encodeURIComponent(t.hash)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1,binary:!0},s)},blob:{get:(t,s)=>r({method:"GET",path:`/api/experimental/blob/${encodeURIComponent(t.id)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1,binary:!0},s)},automation:{create:(t,s)=>r({method:"POST",path:"/api/experimental/automation",body:{sessionID:t.sessionID,directory:t.directory,name:t.name,trigger:t.trigger,action:t.action,expires:t.expires},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},s).then((u)=>u.data),list:(t,s)=>r({method:"GET",path:"/api/experimental/automation",query:{sessionID:t?.sessionID,directory:t?.directory},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},s).then((u)=>u.data),get:(t,s)=>r({method:"GET",path:`/api/experimental/automation/${encodeURIComponent(t.automationID)}`,successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},s).then((u)=>u.data),pause:(t,s)=>r({method:"POST",path:`/api/experimental/automation/${encodeURIComponent(t.automationID)}/pause`,successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},s).then((u)=>u.data),resume:(t,s)=>r({method:"POST",path:`/api/experimental/automation/${encodeURIComponent(t.automationID)}/resume`,successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},s).then((u)=>u.data),delete:(t,s)=>r({method:"DELETE",path:`/api/experimental/automation/${encodeURIComponent(t.automationID)}`,successStatus:204,declaredStatuses:[400,401,403,404],empty:!0},s)},artifacts:{providers:(t,s)=>r({method:"GET",path:"/api/experimental/artifacts/providers",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},s),list:(t,s)=>r({method:"GET",path:"/api/experimental/artifacts",query:{location:t?.location,sessionID:t?.sessionID,provider:t?.provider},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},s),create:(t,s)=>r({method:"POST",path:"/api/experimental/artifacts",query:{location:t.location},body:{title:t.title,files:t.files,entry:t.entry,provider:t.provider,sessionID:t.sessionID},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},s),get:(t,s)=>r({method:"GET",path:`/api/experimental/artifacts/${encodeURIComponent(t.artifactID)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},s),update:(t,s)=>r({method:"PATCH",path:`/api/experimental/artifacts/${encodeURIComponent(t.artifactID)}`,query:{location:t.location},body:{title:t.title,files:t.files,entry:t.entry,sessionID:t.sessionID},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},s),delete:(t,s)=>r({method:"DELETE",path:`/api/experimental/artifacts/${encodeURIComponent(t.artifactID)}`,query:{location:t.location},successStatus:204,declaredStatuses:[400,401,403,404,503],empty:!0},s),view:(t,s)=>r({method:"GET",path:`/api/experimental/artifacts/${encodeURIComponent(t.artifactID)}/view/${os(t.path)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1,binary:!0},s)},job:{list:(t,s)=>r({method:"GET",path:"/api/experimental/job",query:{sessionID:t?.sessionID,kind:t?.kind,status:t?.status,descendants:t?.descendants},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data)},migration:{v1:{status:(t)=>r({method:"GET",path:"/api/experimental/migration/v1",successStatus:200,declaredStatuses:[400,401],empty:!1},t)}},usage:{limits:(t,s)=>r({method:"GET",path:"/api/experimental/usage/limits",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s)},config:{update:(t,s)=>r({method:"PATCH",path:"/api/experimental/config",body:{shell:t.shell},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)}},message:{list:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/message`,query:{limit:t.limit,order:t.order,cursor:t.cursor,type:t.type},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},s)},model:{list:(t,s)=>r({method:"GET",path:"/api/model",query:{location:t?.location,types:t?.types},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s),default:(t,s)=>r({method:"GET",path:"/api/model/default",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s)},provider:{list:(t,s)=>r({method:"GET",path:"/api/provider",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s),get:(t,s)=>r({method:"GET",path:`/api/provider/${encodeURIComponent(t.providerID)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s)},integration:{list:(t,s)=>r({method:"GET",path:"/api/integration",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),get:(t,s)=>r({method:"GET",path:`/api/integration/${encodeURIComponent(t.integrationID)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),connect:{key:(t,s)=>r({method:"POST",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/key`,query:{location:t.location},body:{key:t.key,answer:t.answer,label:t.label},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),external:(t,s)=>r({method:"POST",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/external`,query:{location:t.location},body:{methodID:t.methodID,answer:t.answer,label:t.label},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)},oauth:{connect:(t,s)=>r({method:"POST",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/oauth`,query:{location:t.location},body:{methodID:t.methodID,answer:t.answer,label:t.label},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),status:(t,s)=>r({method:"GET",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/oauth/${encodeURIComponent(t.attemptID)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),complete:(t,s)=>r({method:"POST",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/oauth/${encodeURIComponent(t.attemptID)}/complete`,query:{location:t.location},body:{code:t.code},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),cancel:(t,s)=>r({method:"DELETE",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/oauth/${encodeURIComponent(t.attemptID)}`,query:{location:t.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)},command:{connect:(t,s)=>r({method:"POST",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/command`,query:{location:t.location},body:{methodID:t.methodID,label:t.label},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),status:(t,s)=>r({method:"GET",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/command/${encodeURIComponent(t.attemptID)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),cancel:(t,s)=>r({method:"DELETE",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/command/${encodeURIComponent(t.attemptID)}`,query:{location:t.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)}},mcp:{list:(t,s)=>r({method:"GET",path:"/api/mcp",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),resource:{catalog:(t,s)=>r({method:"GET",path:"/api/mcp/resource",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)}},credential:{list:(t)=>r({method:"GET",path:"/api/credential",successStatus:200,declaredStatuses:[400,401],empty:!1},t).then((s)=>s.data),create:(t,s)=>r({method:"POST",path:"/api/credential",body:{id:t.id,integrationID:t.integrationID,label:t.label,value:t.value,activate:t.activate},successStatus:200,declaredStatuses:[400,401,409],empty:!1},s).then((u)=>u.data),update:(t,s)=>r({method:"PATCH",path:`/api/credential/${encodeURIComponent(t.credentialID)}`,body:{label:t.label},successStatus:204,declaredStatuses:[400,401],empty:!0},s),activate:(t,s)=>r({method:"POST",path:`/api/credential/${encodeURIComponent(t.credentialID)}/activate`,successStatus:204,declaredStatuses:[400,401],empty:!0},s),remove:(t,s)=>r({method:"DELETE",path:`/api/credential/${encodeURIComponent(t.credentialID)}`,successStatus:204,declaredStatuses:[400,401],empty:!0},s)},project:{list:(t,s)=>r({method:"GET",path:"/api/project",query:{archived:t?.archived},successStatus:200,declaredStatuses:[400,401],empty:!1},s),update:(t,s)=>r({method:"PATCH",path:`/api/project/${encodeURIComponent(t.projectID)}`,body:{canonical:t.canonical,name:t.name,icon:t.icon,commands:t.commands},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},form:{list:(t,s)=>r({method:"GET",path:"/api/form",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},permission:{request:{list:(t,s)=>r({method:"GET",path:"/api/permission/request",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},saved:{list:(t,s)=>r({method:"GET",path:"/api/permission/saved",query:{projectID:t?.projectID},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),update:(t,s)=>r({method:"PATCH",path:`/api/permission/saved/${encodeURIComponent(t.id)}`,body:{action:t.action,resource:t.resource},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},s).then((u)=>u.data),remove:(t,s)=>r({method:"DELETE",path:`/api/permission/saved/${encodeURIComponent(t.id)}`,successStatus:204,declaredStatuses:[400,401],empty:!0},s)},create:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/permission`,body:{id:t.id,action:t.action,resources:t.resources,save:t.save,metadata:t.metadata,source:t.source,agent:t.agent},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),list:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/permission`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),get:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/permission/${encodeURIComponent(t.requestID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),reply:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/permission/${encodeURIComponent(t.requestID)}/reply`,body:{decision:t.decision,message:t.message},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)},file:{read:(t,s)=>r({method:"GET",path:`/api/fs/read/${os(t.path)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1,binary:!0},s),list:(t,s)=>r({method:"GET",path:"/api/fs/list",query:{location:t?.location,path:t?.path},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),find:(t,s)=>r({method:"GET",path:"/api/fs/find",query:{location:t.location,query:t.query,type:t.type,limit:t.limit},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},command:{list:(t,s)=>r({method:"GET",path:"/api/command",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},skill:{list:(t,s)=>r({method:"GET",path:"/api/skill",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},rpc:{call:(t,s)=>r({method:"POST",path:`/api/rpc/${encodeURIComponent(t.rpcID)}/${encodeURIComponent(t.method)}`,query:{location:t.location},body:{input:t.input},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},s)},event:{subscribe:(t,s)=>p({method:"GET",path:"/api/event",query:{types:t?.types},successStatus:200,declaredStatuses:[400,401],empty:!1},s)},pty:{list:(t,s)=>r({method:"GET",path:"/api/pty",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),create:(t,s)=>r({method:"POST",path:"/api/pty",query:{location:t?.location},body:{command:t?.command,args:t?.args,cwd:t?.cwd,title:t?.title,env:t?.env},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),get:(t,s)=>r({method:"GET",path:`/api/pty/${encodeURIComponent(t.ptyID)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),update:(t,s)=>r({method:"PUT",path:`/api/pty/${encodeURIComponent(t.ptyID)}`,query:{location:t.location},body:{title:t.title,size:t.size},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),remove:(t,s)=>r({method:"DELETE",path:`/api/pty/${encodeURIComponent(t.ptyID)}`,query:{location:t.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),connect:{token:(t,s)=>r({method:"POST",path:`/api/pty/${encodeURIComponent(t.ptyID)}/connect-token`,query:{location:t.location},headers:{"x-opencode-ticket":t["x-opencode-ticket"]},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},s)}},shell:{list:(t,s)=>r({method:"GET",path:"/api/shell",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),create:(t,s)=>r({method:"POST",path:"/api/shell",query:{location:t.location},body:{command:t.command,cwd:t.cwd,timeout:t.timeout,metadata:t.metadata},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),get:(t,s)=>r({method:"GET",path:`/api/shell/${encodeURIComponent(t.id)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),output:(t,s)=>r({method:"GET",path:`/api/shell/${encodeURIComponent(t.id)}/output`,query:{location:t.location,cursor:t.cursor,limit:t.limit},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),remove:(t,s)=>r({method:"DELETE",path:`/api/shell/${encodeURIComponent(t.id)}`,query:{location:t.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)},reference:{list:(t,s)=>r({method:"GET",path:"/api/reference",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},worktree:{list:(t,s)=>r({method:"GET",path:"/api/worktree",query:{projectID:t.projectID},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),create:(t,s)=>r({method:"POST",path:"/api/worktree",body:{projectID:t.projectID,from:t.from,branch:t.branch,directory:t.directory,name:t.name},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),remove:(t,s)=>r({method:"DELETE",path:"/api/worktree",body:{projectID:t.projectID,directory:t.directory,force:t.force},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),refresh:(t,s)=>r({method:"POST",path:"/api/worktree/refresh",body:{projectID:t.projectID},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)},vcs:{init:(t,s)=>r({method:"POST",path:"/api/vcs/init",query:{location:t?.location,provider:t?.provider},successStatus:204,declaredStatuses:[400,401,404,409,501,503],empty:!0},s),get:(t,s)=>r({method:"GET",path:"/api/vcs",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),base:(t,s)=>r({method:"GET",path:"/api/vcs/base",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s),status:(t,s)=>r({method:"GET",path:"/api/vcs/status",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),branch:{list:(t,s)=>r({method:"GET",path:"/api/vcs/branch",query:{location:t?.location,search:t?.search,limit:t?.limit},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},diff:(t,s)=>r({method:"GET",path:"/api/vcs/diff",query:{location:t.location,mode:t.mode,base:t.base,context:t.context,untracked:t.untracked},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s)},debug:{heapDump:(t,s)=>r({method:"POST",path:"/api/debug/heap-dump",query:{directory:t?.directory},successStatus:200,declaredStatuses:[400,401,500],empty:!1},s),location:{list:(t)=>r({method:"GET",path:"/api/debug/location",successStatus:200,declaredStatuses:[400,401],empty:!1},t),evict:(t,s)=>r({method:"DELETE",path:"/api/debug/location",query:{location:t?.location},successStatus:204,declaredStatuses:[400,401],empty:!0},s)}},websearch:{providers:(t,s)=>r({method:"GET",path:"/api/websearch/provider",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s),query:(t,s)=>r({method:"POST",path:"/api/websearch",query:{location:t.location},body:{query:t.query,providerID:t.providerID},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s)},config:{get:(t,s)=>r({method:"GET",path:"/api/config",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),shells:(t)=>r({method:"GET",path:"/api/config/shell",successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)}};return{...c,session:{...c.session,stats:c.experimental.session.stats,import:c.experimental.session.import,export:c.experimental.session.export,skill:c.experimental.session.skill,wait:c.experimental.session.wait,instructions:{entry:{list:c.experimental.session.instructions.entry.list,put:c.experimental.session.instructions.entry.put,remove:c.experimental.session.instructions.entry.remove}},log:c.experimental.session.log},generate:{text:c.experimental.generate.text,image:c.experimental.generate.image,decisions:c.experimental.generate.decisions},voice:{models:c.experimental.voice.models,session:c.experimental.voice.session},integration:{...c.integration,wellknown:{add:c.experimental.integration.wellknown.add}},mcp:{...c.mcp,add:c.experimental.mcp.add,remove:c.experimental.mcp.remove,connect:c.experimental.mcp.connect,disconnect:c.experimental.mcp.disconnect,client:{token:c.experimental.mcp.client.token}},file:{...c.file,write:c.experimental.file.write,watch:c.experimental.file.watch,unwatch:c.experimental.file.unwatch},migration:{v1:{status:c.experimental.migration.v1.status}},usage:{limits:c.experimental.usage.limits},config:{...c.config,update:c.experimental.config.update}}}function os(e){return e.split("/").map(encodeURIComponent).join("/")}function Fo(e,n,o){if(o===void 0)return;if(o===null){e.append(n,"null");return}if(Array.isArray(o)){for(let a of o)Fo(e,n,a);return}if(typeof o==="object"){for(let[a,d]of Object.entries(o))Fo(e,`${n}[${a}]`,d);return}e.append(n,String(o))}async function rs(e){if(!ss(e,"application/json")&&!e.headers.get("content-type")?.includes("+json")){try{await e.body?.cancel()}catch{}throw new Ee("UnsupportedContentType",{detail:e.headers.get("content-type")})}let n;try{n=await e.text()}catch(o){throw new Ee("Transport",{cause:o})}if(n==="")throw new Ee("MalformedResponse");try{return JSON.parse(n)}catch(o){throw new Ee("MalformedResponse",{cause:o})}}function ja(e){let n=Object.assign(Error(e.message??e.data?.message),e);if(e._tag)n.name=e._tag;return n}function ss(e,n){return e.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase()===n}var as=["location.shutdown","models-dev.refreshed","credential.updated","credential.switched","integration.updated","provider.updated","model.updated","agent.updated","session.created","session.agent.selected","session.model.selected","session.moved","session.renamed","session.metadata.updated","session.permissions","session.viewed","session.archived","session.unarchived","session.usage.updated","session.deleted","session.forked","session.inbox.delivered","session.inbox.enqueued","session.inbox.cancelled","session.inbox.delivery.changed","session.execution.started","session.execution.succeeded","session.execution.failed","session.execution.interrupted","session.instructions.updated","session.synthetic","session.skill.activated","session.shell.started","session.shell.ended","session.step.started","session.step.first-token","session.step.streamed","session.step.ended","session.step.failed","session.text.started","session.text.delta","session.text.ended","session.reasoning.started","session.reasoning.delta","session.reasoning.ended","session.tool.input.started","session.tool.input.delta","session.tool.input.ended","session.tool.called","session.tool.progress","session.tool.success","session.tool.failed","session.retry.scheduled","session.compaction.started","session.compaction.delta","session.compaction.ended","session.compaction.failed","session.revert.staged","session.revert.cleared","session.revert.committed","filesystem.changed","reference.updated","permission.asked","permission.replied","plugin.updated","project.updated","worktree.updated","worktree.resolved","command.updated","config.updated","skill.updated","pty.created","pty.updated","pty.exited","pty.deleted","persistent-pty.added","persistent-pty.removed","persistent-pty.updated","shell.created","shell.exited","shell.deleted","form.created","form.replied","form.cancelled","websearch.updated","artifact.updated","session.status","session.idle","tui.prompt.append","tui.command.execute","tui.toast.show","tui.session.select","installation.updated","installation.update-available","vcs.branch.updated","mcp.status.changed","mcp.resources.changed","experimental.mcp.event"];var Wa=new Set(["on","off","once","addListener","removeListener","prependListener","prependOnceListener","removeAllListeners","setMaxListeners"]),xn=[100,200,300,400,500,600,700,800,900],za=["disabled","pressed","focused","selected","hovered"],Ha=new Set(["input","textarea"]),Ka={return:"\r",escape:"\x1B",tab:"\t",backspace:"\x7F",space:" "},Xa=250,hn=4;function qo(e,n){for(let o=n;o;o=o.parent)if(o===e)return!0;return!1}var No=new Map,Sn=Ve();function Ya(e,n){let o=e.id,a=(i,l=`${o}: ${i} is not supported by opencode-native yet`)=>{let m=No.get(o)??new Set;if(No.set(o,m),m.has(i))return;m.add(i),n.effect({type:"log",level:"warn",message:l})},d=new Set,r=(i,l,m)=>{let g=String(m.info??""),b={type:"code",raw:"```"+g+` -`+String(m.code??"")+(m.closed?"\n```":""),lang:g.trim()||void 0,text:String(m.code??"")},E={conceal:!0,concealCode:!1,defaultRender:()=>new Lo},C;try{C=l(b,E)}catch(T){let N=T instanceof Error?T.message:String(T);throw queueMicrotask(()=>{n.effect({type:"toast",variant:"error",title:"Plugin",message:`${o} crashed in code block ${i}: ${N}`})}),T}if(C===void 0||C===null)return null;if(!(C instanceof ye))return queueMicrotask(()=>a("a code block's renderable built outside @opentui/core's classes")),null;let X=new Set,P=Do(C,{press:()=>{X.add("a click in a code block");return},dropped:X});if(X.size)queueMicrotask(()=>X.forEach((T)=>a(T)));return P},p=128,c=16,t=new Map,s=new Map,u=new Set,x=new Map,R,v=new Set,k=(i)=>n.readError?.(i),V=se(()=>Q(0));n.listen((i)=>{if(i==="theme")return V[1]((g)=>g+1);u.add(i),t.get(i)?.[1]((g)=>g+1);let m=k(i);if(m)a(`read ${m}`,`${o}: a read failed: ${m}`);for(let g of x.get(i)?.splice(0)??[])if(m)g.reject(Error(`${i}: ${m}`));else g.resolve()});let J=()=>{let i=new Set([...Pe.values(),...v].flatMap((l)=>[...l.keys]));return[...s.keys()].filter((l)=>!i.has(l)&&!l.startsWith("storage:")&&!x.get(l)?.length)},j=(i)=>{s.delete(i),u.delete(i),n.unwatch(i)},f=(i,l)=>{let m=t.get(i);if(!m)m=se(()=>Q(0)),t.set(i,m);if(m[0](),R?.keys.add(i),s.has(i))s.delete(i),s.set(i,l);else{let g=J();if(s.size>=128&&g.length)j(g[0]);s.set(i,l),n.watch(i,l);for(let y of J().slice(0,Math.max(0,J().length-16)))j(y)}if(!u.has(i)&&R)R.pending=!0;return n.read(i)},I=(i,l)=>new Promise((m,g)=>{Y(()=>f(i,l));let y=k(i);if(u.has(i)&&y)return g(Error(`${i}: ${y}`));if(u.has(i))return m();x.set(i,[...x.get(i)??[],{resolve:m,reject:g}])}),h=()=>f("sessions",{type:"sessions"})??[],M,F=(i)=>{let l=h();if(M?.list!==l)M={list:l,byID:new Map(l.map((g)=>[g.info.id,g]))};let m=`session:${i}`;return M.byID.get(i)??(s.has(m)?f(m,{type:"session",id:i}):n.read(m))??void 0},_=()=>f("info",{type:"info"}),q=(i)=>i?{directory:i.directory,workspace:i.workspaceID??void 0}:null,A=(i)=>JSON.stringify(q(i)),Ce=(i)=>i&&{directory:i.directory,...i.workspace?{workspaceID:i.workspace}:{}},W=(i)=>({list:(l)=>f(`${i}:${A(l)}`,{type:i,location:q(l)})??void 0,sync:(l)=>I(`${i}:${A(l)}`,{type:i,location:q(l)}),invalidate(){}}),z=(i)=>({list:()=>(a(`data.${i}`),[]),sync:async()=>a(`data.${i}`),invalidate(){}}),ee=()=>{let i=f("route",{type:"route"});if(i?.type==="session")return{type:"session",sessionID:i.id};if(i?.type==="plugin")return{type:"plugin",id:i.id,name:i.name,data:te.get(i.name)};return{type:"home"}},te=new Map,Me=4,bn=256,Lt=(i,l,m=(...y)=>JSON.stringify(y),g=(y,b)=>!0)=>{let y=new Map,b=[],E=0,C=!1,X=(D)=>{let G=m(...D),B=y.get(G);if(B)return B;let re={args:D,version:se(()=>Q(0)),state:"idle",again:!1,settled:[]};return y.set(G,re),re},P=(D)=>{D.state="idle";for(let G of D.settled.splice(0))G()},T=()=>{while(E{D.state="loading",D.again=!1,E++,l(...D.args).then((G)=>{if(D.again)return;D.value=G,D.version[1]((B)=>B+1),Gt()},(G)=>console.warn(`plugin ${o}: a load of data failed: ${G instanceof Error?G.message:G}`)).finally(()=>{if(E--,D.again)H(D);else P(D);T()})},H=(D)=>{if(D.state="waiting",b.push(D),b.length>bn)P(b.shift());T()},w=(D)=>{if(!C){C=!0;for(let B of i)e.data.on(B,(re)=>y.forEach((O)=>{if(g(re,O.args))w(O)}))}let G=new Promise((B)=>D.settled.push(B));if(D.state==="loading")D.again=!0;else if(D.state==="idle")H(D);return G};return{list(...D){let G=X(D);if(G.version[0](),G.value===void 0&&G.state==="idle")w(G);return G.value},sync:(...D)=>w(X(D)),invalidate:(...D)=>void w(X(D))}},Vo=(i)=>i?.directory?{directory:i.directory}:void 0,xt=(i,l)=>Lt(l,(m)=>Ge[i].list({location:Vo(m)}).then((g)=>g.data),(m)=>A(m)),En=Lt(["form.created","form.replied","form.cancelled"],(i)=>Ge.form.list({location:Vo(i)}).then((l)=>l.data),(i)=>A(i)),_o=new Map,vn={list(i,l){let m=En.list(l);if(m===void 0)return;let g=A(l),y=_o.get(g);if(y?.of!==m){let b=new Map;for(let E of m)b.set(E.sessionID,[...b.get(E.sessionID)??[],E]);y={of:m,bySession:b,none:[]},_o.set(g,y)}return y.bySession.get(i)??y.none},sync:(i,l)=>En.sync(l),invalidate:(i,l)=>En.invalidate(l)},Dn=xt("shell",["shell.created","shell.exited","shell.deleted"]),Rn=Lt(["project.updated"],()=>Ge.project.list()),On=new Set,Go=!1,ls={on:e.data.on,listen(i){if(On.add(i),!Go)Go=!0,n.on(as,(l)=>{for(let m of[...On])m({details:l})}),n.changed();return()=>void On.delete(i)},session:{list:()=>h().map((i)=>i.info),get:(i)=>F(i)?.info,root(i){let l=i;for(let m=0;m<64;m++){let g=F(l)?.info?.parentID;if(!g)return l;l=g}return l},family:(i)=>(f(`family:${i}`,{type:"family",id:i})?.members??[]).map((l)=>l.id),cost:(i)=>f(`family:${i}`,{type:"family",id:i})?.cost??0,status:(i)=>F(i)?.status==="running"?"running":"idle",pending:{list:(i)=>f(`pending:${i}`,{type:"pending",id:i})??[],sync:(i)=>I(`pending:${i}`,{type:"pending",id:i}),invalidate(){}},sync:(i)=>I(`session:${i}`,{type:"session",id:i}),invalidate(){},message:{list:(i)=>f(`messages:${i}`,{type:"messages",id:i})??[],get:(i,l)=>(f(`messages:${i}`,{type:"messages",id:i})??[]).find((m)=>m.id===l),sync:(i)=>I(`messages:${i}`,{type:"messages",id:i}),invalidate(){}},permission:Lt(["permission.asked","permission.replied"],(i)=>Ge.permission.list({sessionID:i}),void 0,(i,[l])=>i?.data?.sessionID===void 0||i.data.sessionID===l),form:{...vn,reply:async(i,l)=>{await Ge.session.form.reply(i),vn.invalidate(i.sessionID,l)},cancel:async(i,l)=>{await Ge.session.form.cancel(i),vn.invalidate(i.sessionID,l)}}},project:{...Rn,list:()=>Rn.list()??[],get:(i)=>(Rn.list()??[]).find((l)=>l.id===i),permission:z("project.permission")},shell:{...Dn,list:(i)=>Dn.list(i)??[],get:(i)=>(Dn.list()??[]).find((l)=>l.id===i)},location:{default:()=>Ce(_()?.location)??{directory:process.env.OPENCODE_DIRECTORY??process.cwd()},sync:async()=>{},invalidate(){},vcs:{info:(i)=>f(`vcs:${A(i)}`,{type:"vcs",location:q(i)})??void 0,sync:(i)=>I(`vcs:${A(i)}`,{type:"vcs",location:q(i)}),invalidate(){}},agent:xt("agent",["agent.updated"]),command:xt("command",["command.updated"]),integration:W("integrations"),mcp:{server:W("mcp-servers"),resource:z("location.mcp.resource")},model:W("models"),provider:{list:()=>f("providers",{type:"providers"})??void 0,sync:()=>I("providers",{type:"providers"}),invalidate(){}},reference:xt("reference",["reference.updated"]),skill:xt("skill",["skill.updated"])}},Jo=(i)=>{let l=n.palette(),m={},g=[];for(let[P,T]of Object.entries(l.colors)){let N=P.startsWith("@dialog.footer.")?"dialog.footer":P.startsWith("@dialog.")?"dialog":void 0;if(N)(m[N]??={})[P.slice(N.length+2)]=T;else g.push([P,T])}let y={};for(let[P,T]of g.sort(([N],[H])=>N.length-H.length)){let N=P.split("."),H=y;for(let O of N.slice(0,-1)){if(!(O in H))H[O]={};H=H[O]}let w=N[N.length-1],D=i===void 0?void 0:m[i]?.[P],G=wt(D??T),B=D!==void 0?void 0:N[0]==="hue"?N.slice(1).join("."):P,re=new Se(G.r,G.g,G.b,G.a,B);H[w]=Object.assign(re,typeof H[w]==="object"?H[w]:{})}y.hue??={},y.categorical=Object.entries(y.categorical??{}).sort(([P],[T])=>Number(P)-Number(T)).map(([,P])=>P);let b=(P)=>{if(!P||typeof P!=="object")return;if("base"in P&&"hovered"in P)P.state=(T)=>P[za.find((N)=>T?.[N])??"base"];else for(let T of Object.values(P))if(!(T instanceof Se))b(T)};for(let P of[y.text,y.background])b(P?.action),b(P?.formfield);let E=Object.entries(y.hue),C=(P)=>{if(!(P instanceof Se))return;for(let[T,N]of E)for(let H of xn){let w=N[H];if(w&&(w.token===P.token||w.r===P.r&&w.g===P.g&&w.b===P.b&&w.a===P.a))return{hue:T,step:H}}return},X=(P,T)=>{let N=C(P);if(!N)return P;let H=Number.isFinite(T)?Math.trunc(T):0,w=Math.max(0,Math.min(xn.length-1,xn.indexOf(N.step)+H));return y.hue[N.hue][xn[w]]};return y.source=C,y.increase=(P,T=1)=>X(P,T),y.decrease=(P,T=1)=>X(P,-T),y.surface=(P)=>{if(P==="dialog"||P==="dialog.footer")return Jo(P);if(!jo.has(P))console.warn(`plugin ${o}: theme.surface("${P}") is the page theme`);return jo.add(P),y},y},jo=new Set,Cn=new Map,Le,_e=0,Pn=`${o}.compat.press`,Ft=`${o}.compat.answer`,wn=`${o}.compat.dismiss`,kn=`${o}.compat.query`,qt;n.command({name:Pn,title:Pn},(i)=>{let[l,m]=(i??"").split("\x01"),g=Cn.get(l??"")?.get(m??""),y={type:g?.kind,button:0,modifiers:{shift:!1,alt:!1,ctrl:!1}};g?.handler({...y,stopPropagation(){},preventDefault(){}})}),n.command({name:kn,title:kn},(i)=>qt?.(i??""));let Nt=[],$o=Array.from({length:hn},(i,l)=>`${o}.compat.action.${l}`);$o.forEach((i,l)=>n.command({name:i,title:i},(m)=>Nt[l]?.(m))),n.command({name:Ft,title:Ft},(i)=>{let l=Le;Le=void 0,l?.(i??"")}),n.command({name:wn,title:wn},(i)=>{if(i===String(_e))ht()});let ht=()=>{let i=Le;Le=void 0,i?.(void 0)},Ut=(i)=>new Promise((l)=>{ht(),it(),Le=l,_e++;let m={type:"command",name:wn,input:String(_e)},g=_e,y=()=>{if(_e!==g||Le!==l)return;Bo=g;let b={...typeof i==="function"?i():i,action:{type:"command",name:Ft}};n.effect({type:"dialog",dialog:{type:"dismissable",dialog:b,dismissed:m}})};if(typeof i==="function")queueMicrotask(y);else y()}),An="compat.dialog",us=0,me,Tn=new Map,Ie={size:"medium",centered:!1},Bo=0,Vt=()=>({...["large","xlarge"].includes(Ie.size)?{size:Ie.size}:{},...Ie.centered?{centered:!0}:{}}),it=()=>{let i=me;if(me=void 0,!i)return;Tn.delete(i.key),i.onClose?.()},Wo=()=>{if(!me)return;me.sent=!0,n.effect({type:"dialog",dialog:{type:"surface",surface:An,key:me.key,...Vt()}})};n.cleanup?.(()=>{ht(),it()}),n.listen((i)=>{if(!me||i!==`dialog-open:${me.key}`)return;if(n.read(i)===!0)me.opened=!0;else if(me.opened)it()});let Pe=new Map,St=se(()=>Q({width:0,height:0})),zo={width:()=>_()?.size?.[0]||St[0]().width,height:()=>_()?.size?.[1]||St[0]().height,renderer:{}},ps=0,_t,Mn=!1,Gt=(i)=>{if(i!==void 0&&i===_t||Mn)return;Mn=!0,queueMicrotask(()=>{Mn=!1,n.invalidate()})},ie,Jt=new Set(["input","textarea","scrollbox"]),Ln=new WeakSet,Ho=(i)=>typeof i==="function"&&(Ln.has(i)||Function.prototype.toString.call(i).includes("preventDefault")),Ko,Xo=(i)=>{if(typeof i!=="function"||Ln.has(i))return;Ln.add(i),Ze(),Ko?.()},Yo=new Map,Ze=()=>{for(let[i,l]of Yo){let m=[...Pe.entries()].filter(([y])=>y.startsWith(`${i}\x00`)).map(([,y])=>y.root),g=Ho(ie?.props.onKeyDown)&&m.some((y)=>qo(y,ie));n.taking?.({surface:l},g)}},Qo=(i)=>{let l=le(i);for(let[m,g]of Pe){if(g.root!==l)continue;let[y,b,E]=m.split("\x00");return{surface:y,key:b,generation:Number(E)}}return},Zo={focus(i){if(ie!==i)ie?.focusChanged(!1);if(ie=i,i.focusChanged(!0),Ze(),!Jt.has(i.tag))return;let l=Qo(i);if(l)n.effect({type:"focus",node:he(i)},l);else a(`focus() of an <${i.tag}> in no mount`)},blur(i){if(ie!==i)return;ie=void 0,i.focusChanged(!1),Ze();let l=Jt.has(i.tag)?Qo(i):void 0;if(l)n.effect({type:"blur"},l)},detached(i){if(!ie||!qo(i,ie))return;let l=ie;ie=void 0,l.focusChanged(!1),Ze()}},cs=(i,l)=>{let m=[...Pe.entries()].filter(([b])=>b.startsWith(`${i}\x00`)).map(([,b])=>b.root),g=(b)=>{let E=(C)=>he(C)===b&&Ha.has(C.tag)?C:C.children.reduce((X,P)=>X??E(P),void 0);return m.reduce((C,X)=>C??E(X),void 0)};if(l.type==="key"){let b=ie&&g(he(ie));if(b!==ie||!b?.props.onKeyDown)return"pass";let E=er(l),C=b.props.onKeyDown;if(C(E),!E.defaultPrevented)return"pass";return Xo(C),"consume"}let y=(l.type==="change"||l.type==="submit")&&g(l.node);if(!y)return;if(ie!==y)ie?.focusChanged(!1),ie=y,y.focusChanged(!0),Ze();if(y.typed=l.text,l.type==="change"){let b=le(y),E=y.props.onInput?.(l.text);return(b.seen??=new Map).set(l.node,l.seq),E}y.props.onChange?.(l.text),y.props.onSubmit?.(l.text)},er=(i)=>{let l=String(i.key??""),m={ctrl:!1,shift:!1,meta:!1,super:!1,hyper:!1};for(let C=/^(ctrl|shift|meta|super|hyper)\+(.+)$/.exec(l);C;C=/^(ctrl|shift|meta|super|hyper)\+(.+)$/.exec(l))m[C[1]]=!0,l=C[2];let g=l==="enter"?"return":l,y=i.text??Ka[g]??"",b=!1,E=!1;return{name:g,...m,option:m.meta,sequence:y,raw:y,number:/^[0-9]$/.test(g),eventType:"press",source:"raw",get defaultPrevented(){return b},get propagationStopped(){return E},preventDefault(){b=!0},stopPropagation(){E=!0}}},et=new $a,tr=!1;et.on("newListener",(i,l)=>{if(i!=="keypress"||tr||!n.layer)return;tr=!0;let m=n.layer({scope:"global",any:!0},(y)=>{if(y.type!=="key")return"pass";let b=er(y),E=et.listeners("keypress");if(et.emit("keypress",b),!b.defaultPrevented)return"pass";return E.forEach(Xo),"consume"});if(n.changed(),typeof m!=="number")return;let g=(y)=>{let b=[...et.listeners("keypress"),y].some(Ho);n.taking?.({layer:m},b)};Ko=()=>g(),g(l),et.on("removeListener",(y)=>{if(y==="keypress")g()}),et.on("newListener",(y,b)=>{if(y==="keypress")g(b)})});let ys=(i)=>{let l=(m)=>({type:"node",surface:i,id:he(m)});return{state:(m)=>f(`scroll:${i}:${he(m)}`,{type:"scroll-state",target:l(m)})??void 0,to:(m,g)=>void n.effect({type:"scroll",target:l(m),verb:{type:"offset",offset:g}}),into:(m,g)=>void n.effect({type:"scroll",target:l(m),verb:{type:"to",node:g,align:{type:"nearest"}}}),rect(m){let g=`rect:${i}:${he(m)}`;return Fn.set(g,m),f(g,{type:"rect",node:he(m)})??void 0}}},Fn=new Map,nr=new WeakMap;n.listen((i)=>{let l=Fn.get(i);if(!l)return;if(!l.parent)return void Fn.delete(i);let m=l.measure(),g=m&&`${m.width}x${m.height}`;if(!g||nr.get(l)===g)return;nr.set(l,g);let y=l.props.onSizeChange??l.onSizeChange;if(typeof y==="function")y.call(l)});let jt=(i,l,m,g,y)=>{let b=!1,E=(w)=>`${w.mount.surface}\x00${w.mount.key}\x00${w.mount.generation}`,C=new Map,X=(w)=>{let D=`${w.mount.surface}\x00${w.mount.key}`,G=C.get(D);if(!G)return;clearTimeout(G.timer),C.delete(D),Pe.set(E(w),G.entry);let B=ie;if(B&&G.focused===he(B)&&Jt.has(B.tag)&&le(B)===G.entry.root)n.effect({type:"focus",node:he(B)},w.mount);return G.entry},P=(w)=>{let D=w instanceof Error?w.message:String(w);n.effect({type:"toast",variant:"error",title:"Plugin",message:`${o} crashed in ${y}: ${D}`})},T=(w)=>{if(b)return{type:"box"};let D=_t;_t=E(w);try{return N(w)}finally{if(_t=D,l.type==="dialog"&&Pe.get(E(w))?.crashed!==void 0)xs(w.mount.key)}},N=(w)=>{if(w.input.width||w.input.height)St[1]({width:w.input.width,height:w.input.height});Qe.clear();let D=Pe.get(E(w))??X(w);if(D&&D.crashed===void 0&&JSON.stringify(D.input)!==JSON.stringify(m(w))){D.input=m(w);let O=R;R={pending:!1,keys:D.keys};try{D.setInput(D.input)}finally{R=O}}let G=(O)=>!!O&&O.pending>0&&O.pending<4&&O.crashed===void 0;if(!D||G(D)&&[...D.keys].every((O)=>u.has(O))){D?.dispose();let O=D?D.pending:0,ae=m(w),[Fe,ws]=Ct(Bt(ae)),Jn={pending:!1,keys:new Set},ks=R;R=Jn;let jn;try{let $n=()=>pe(Sn.Provider,{value:dr,get children(){return g(Fe)}}),As=E(w);jn=Eo($n,zo,()=>Gt(As),P,Zo,ys(i),(Ts)=>a(Ts))}finally{R=ks}jn.keys=Jn.keys,D=Object.assign(jn,{pending:Jn.pending?O+1:0,input:ae,setInput:($n)=>ws(Pt(Bt($n)))}),Pe.set(E(w),D)}if(G(D))return;D.root.room={width:w.input?.width??0,height:w.input?.height??0};let B=fs(E(w)),re=R;R={pending:!1,keys:D.keys};try{let O=vo(D.root,B);for(let ae of[...B.dropped,...Qe])a(ae);if(Qe.clear(),l.type==="route")O.layout={...O.layout,grow:!0};return Ze(),O}catch(O){return P(O),D.crashed=String(O),D.dispose(),D.root.children=[],{type:"box"}}finally{R=re}},H=n.surface(i,l,T,{unmount(w,D,G){if(l.type==="panel"&&!D)rr("");let B=`${w.surface}\x00${w.key}\x00${w.generation}`,re=Pe.get(B);Pe.delete(B),Cn.delete(B),Ze();let O=`${w.surface}\x00${w.key}`;if(!D&&It.get(O)?.mount.generation===w.generation)It.delete(O);if(!re||re.crashed!==void 0||!D)return re?.dispose();let ae=C.get(O);if(ae)clearTimeout(ae.timer),ae.entry.dispose();let Fe=setTimeout(()=>{if(C.get(O)?.entry!==re)return;C.delete(O),re.dispose()},Xa);C.set(O,{entry:re,timer:Fe,focused:G})},on:(w)=>cs(i,w),...["route","panel","dialog"].includes(l.type)?{layers:[{scope:"surface",any:!0}]}:{}});if(["route","panel","dialog"].includes(l.type)&&typeof H==="number")Yo.set(i,H);return()=>{b=!0,n.invalidate()}},qn=new WeakMap,ms=0,gs=(i)=>{if(!qn.has(i))qn.set(i,++ms);return qn.get(i)},fs=(i)=>{let l=new Map;return Cn.set(i,l),{dropped:new Set,press(m,g,y){let b=String(gs(m));return l.set(b,{handler:g,kind:y}),{type:"command",name:Pn,input:`${i}\x01${b}`}}}},xs=(i)=>{if(me?.key!==i)return;n.effect({type:"dialog",dialog:{type:"close",key:i}}),it()};jt(An,{type:"dialog",name:An},(i)=>({key:i.mount.key}),(i)=>Tn.get(i.key)?.(),"dialog");let or=(i,l="")=>(m)=>{let g=m.input.slot??{};if(i.startsWith("prompt.footer"))return{...g.session_id?{sessionID:g.session_id}:{},mode:g.prompt?.shell?"shell":"normal",showDetails:!!g.prompt?.show_details};if(i==="session.panel"){let y=m.input.panel??{};return{name:Nn(),sessionID:g.session_id??"",width:y.width??m.input.width,presentation:y.fullscreen?"fullscreen":"panel",focused:!!y.focused,...hs(l,m.mount,!!y.fullscreen).methods}}if(i.startsWith("sidebar.")||i==="session.composer.top")return{sessionID:g.session_id??""};return{}},[Nn,rr]=se(()=>Q("")),$t=[],It=new Map,hs=(i,l,m)=>{let g=`${l.surface}\x00${l.key}`,y=It.get(g);if(!y){let b=()=>{let E=It.get(g),C=E&&`${E.mount.surface}\x00${E.mount.key}\x00${E.mount.generation}`;return C&&Pe.has(C)?E:void 0};y={mount:l,fullscreen:m,methods:{focus(){let E=b(),C=E&&Pe.get(`${E.mount.surface}\x00${E.mount.key}\x00${E.mount.generation}`)?.root;if(!C)return;let X=(T)=>T.props.visible===!1?void 0:Jt.has(T.tag)?T:T.children.reduce((N,H)=>N??X(H),void 0),P=X(C);if(P)Zo.focus(P);else a("panel.focus() of a panel with no field or scroll")},close(){let E=b();if(E)n.effect({type:"close-panel",surface:i},E.mount)},toggleFullscreen(){let E=b();if(!E)return;E.fullscreen=!E.fullscreen,n.effect({type:"open-panel",surface:i,...E.fullscreen?{fullscreen:!0}:{}},E.mount)}}},It.set(g,y)}return y.mount=l,y.fullscreen=m,y},Bt=(i)=>typeof i==="function"||i===null||typeof i!=="object"?i:Array.isArray(i)?i.map(Bt):Object.fromEntries(Object.entries(i).map(([l,m])=>[l,Bt(m)])),Ge=Ja({baseUrl:"http://opencode.internal/",fetch:async(i,l)=>{let m=typeof l?.body==="string"?JSON.parse(l.body):void 0,g=await n.fetch({method:l?.method??"GET",path:i.pathname,query:[...i.searchParams],...m===void 0?{}:{body:m}});if(g&&"Ok"in g)return g.Ok===null?new Response(null,{status:204}):new Response(JSON.stringify(g.Ok),{status:200,headers:{"content-type":"application/json"}});let y=String(g?.Err??"Transport"),b=/^UnexpectedStatus: (\d+)/.exec(y)?.[1];if(y.startsWith("Transport"))throw Error(y);return new Response(JSON.stringify({_tag:"Error",message:y}),{status:b?Number(b):500,headers:{"content-type":"application/json"}})}}),Ss=Object.assign((i)=>{let l=(y,b,E)=>{if(!Object.hasOwn(i.events??{},y))throw Error(`Unknown RPC event: ${i.id}.${y}`);let C=e.data.on(`rpc.${i.id}.${y}`,b);return E?.signal?.addEventListener("abort",C),C},m=(y,b)=>({[Symbol.asyncIterator](){let E=[],C,X=l(y,(N)=>{E.push(N),C?.()}),P=!1,T=()=>{P=!0,X(),C?.()};return b?.signal?.addEventListener("abort",T),{async next(){while(!E.length&&!P)await new Promise((N)=>C=N);if(E.length)return{value:E.shift(),done:!1};return{value:void 0,done:!0}},async return(){return T(),{value:void 0,done:!0}}}}}),g=Object.keys(i.methods??{}).map((y)=>[y,async(b,E)=>(await Ge.rpc.call({rpcID:i.id,method:y,input:b,location:E?.location},{signal:E?.signal,headers:E?.headers})).output]);return{...Object.fromEntries(g),events:{on:l,subscribe:m}}},Ge.rpc),Is={...Ge,rpc:Ss},Un=new Map,Wt=[],sr=(i)=>(Un.get(i)??[]).filter((l)=>!l.retired&&l.commands.has(i)),bs=(i,l)=>{let m=sr(i);for(let g=m.length-1;g>=0;g--){let y=m[g],b=y.commands.get(i);if(!ar(y.enabled))continue;if(y.target&&!qo(y.target(),ie))continue;let E=y.mode,C=()=>f("input-mode",{type:"input-mode"})??"base";if(E!==void 0&&Wt.at(-1)!==E&&C()!==E)continue;if(!Ds(b))continue;return b.run(l)}return!1},Vn=new Map,_n=(i)=>{let l=sr(i).some((m)=>m.states.get(i)!==!1);if(Vn.get(i)===l)return;Vn.set(i,l),n.enable?.(i,l)},[Es,ir]=se(()=>Q(0));n.afterCall?.(()=>{ir((i)=>i+1),queueMicrotask(()=>ir((i)=>i+1))});let vs=(i,l,m)=>Et(()=>{Es();let g={keys:new Set};v.add(g),ue(()=>v.delete(g));let y=[i.enabled,m.enabled].filter((E)=>typeof E==="function"),b=i.enabled!==!1&&m.enabled!==!1;if(y.length){let E=R;R={pending:!1,keys:g.keys};try{let C=y.every((X)=>!!X());b=($e()?.sources?.length??0)>1?C&&b:!0}catch{b=!0}finally{R=E}}i.states.set(l,b),_n(l)}),ar=(i)=>{if(typeof i!=="function")return i!==!1;try{return!!i()}catch{return!0}},Ds=(i)=>ar(i.enabled),Rs=(i,l)=>{let m=[...i.commands.keys()];for(let g of m){let y=Un.get(g)??[];if(!y.includes(i))Un.set(g,[...y.filter((b)=>!b.retired),i])}for(let[g,y]of i.commands)vs(i,g,y);for(let[g,y]of i.commands)n.command({name:g,enabled:Vn.get(g)??!0,title:y.title??g,group:y.group,slash:y.slash?.name,...Array.isArray(y.slash?.aliases)&&y.slash.aliases.length?{aliases:y.slash.aliases.map(String)}:{},keybind:typeof y.bind==="string"?y.bind:void 0,palette:!!y.palette,description:y.description,arguments:!!(y.slash?.arguments||y.arguments),...y.hold?{hold:!0}:{},...y.scope??l?{scope:y.scope??l}:{}},(b)=>bs(g,b));return m},Os=(i,l)=>{let m=new Map;return i.map((g)=>{if(g.id)return[g.id,g];let y=[g.scope??l,g.bind,g.title,g.slash?.name,g.slash?.aliases];y.push(g.group,g.description,!!g.palette,!!g.hold,!!(g.slash?.arguments||g.arguments));let b=JSON.stringify(y.map((C)=>C??null)),E=(m.get(b)??0)+1;return m.set(b,E),[`${o}.inline-${Bun.hash(`${b}${E}`).toString(36)}`,g]})},Cs=(i)=>({type:"toast",variant:i.variant??"info",message:i.message,...i.title?{title:i.title}:{},...i.sessionID?{session:i.sessionID}:{}}),Ps={add(){},remove(){},insertBefore(){},getChildren:()=>[],requestRender:()=>Gt()},Gn=new Proxy({requestRender:()=>Gt(),keyInput:et,get root(){return a("renderer.root"),Ps},get currentFocusedEditor(){a("renderer.currentFocusedEditor");return},get currentFocusedRenderable(){a("renderer.currentFocusedRenderable");return},get width(){return _()?.size?.[0]||St[0]().width||0},get height(){return _()?.size?.[1]||St[0]().height||0}},{get(i,l){if(l in i||typeof l==="symbol")return i[l];if(a(`renderer.${String(l)}`),!Ur.includes(String(l)))return;if(Wa.has(l))return()=>Gn;return Vr.includes(String(l))?async()=>{return}:()=>{return}}});zo.renderer=Gn;let zt=new Map,dr={options:e.options??{},get location(){return Ce(_()?.location)},app:e.app,renderer:Gn,client:Is,data:ls,attention:{async notify(i){let l=typeof i.notification==="object"?i.notification:{},m=typeof i.sound==="object"?i.sound:{};return await n.effect({type:"attention",...i.title?{title:i.title}:{},message:i.message,...i.notification===!1?{}:{notify:l.when??"blurred"},...i.sound===!1?{}:{sound:{name:m.name??"default",when:m.when??"always",...m.volume===void 0?{}:{volume:m.volume}}}}),{ok:!0,notification:!!i.notification,sound:!!i.sound}}},get theme(){return Jo()},get themeMode(){return V[0](),e.themeMode},markdown:{registerCodeBlockRenderer(i,l){let m=go(i);if(!m)throw Error("Markdown code-block language is required");if(d.has(m))throw Error(`Markdown code-block renderer already registered: ${m}`);if(!n.claim)return a("markdown.registerCodeBlockRenderer"),()=>{};d.add(m);let g=n.claim({type:"fence",name:m},(y)=>r(m,l,y));return()=>{if(d.delete(m))g()}}},keymap:{layer(i){let l={retired:!1,commands:new Map,states:new Map},m=[],g=()=>{let b={keys:new Set};v.add(b),ue(()=>v.delete(b));let E=R;R={pending:!1,keys:b.keys};let C;try{C=i()}finally{R=E}l.enabled=C?.enabled;let X=typeof C?.mode==="string"&&C.mode!=="global"&&C.mode!=="base",P=C?.mode==="global"||X?void 0:"base";l.mode=X?C.mode:void 0,l.target=typeof C?.target==="function"?C.target:void 0,l.commands=new Map(Os(C?.commands??[],P));for(let N of[...l.states.keys()])if(!l.commands.has(N))l.states.delete(N);let T=Rs(l,P);for(let N of m)if(!l.commands.has(N))_n(N);m.forEach((N)=>n.uncommand(N)),m=T,n.changed()},y=nt();se((b)=>{if(Dt(g),y)pt(y,()=>ue(()=>{l.retired=!0,b(),m.forEach(_n),m.forEach((E)=>n.uncommand(E)),m=[],n.changed()}))})},dispatch(i,l){n.effect({type:"dispatch",name:i,...l===void 0?{}:{input:l}})},shortcuts:(i)=>f(`shortcuts:${i}`,{type:"shortcuts",name:i})??[],commands:()=>(f("keymap-commands",{type:"keymap-commands"})??[]).filter((i)=>!String(i.name??i.id??"").includes(".compat.")).map((i)=>({...i,slash:i.slash,run:()=>void n.effect({type:"dispatch",name:i.name??i.id})})),pending:()=>f("keymap-pending",{type:"keymap-pending"})??[],active:()=>f("keymap-active",{type:"keymap-active"})??[],mode:{current:()=>f("input-mode",{type:"input-mode"})??"base",push(i){return Wt.push(i),n.effect({type:"set-mode",mode:i}),()=>{let l=Wt.lastIndexOf(i);if(l>=0)Wt.splice(l,1);n.effect({type:"set-mode"})}}}},storage:{store(i,l){let m=zt.get(i);if(m)return m;n.effect({type:"storage-key",key:i}),n.storage([i]),n.changed();let g=()=>{let T=f(`storage:${i}`,{type:"storage-get",key:i});if(T!==null&&typeof T==="object")return T;try{return typeof T==="string"?JSON.parse(T):void 0}catch{return}},[y,b]=se(()=>Ct(structuredClone(g()??l.initial)));n.listen((T)=>{if(T!==`storage:${i}`)return;let N=k(T);if(N)return a(`store ${i}`,`${o}: the store ${i} keeps its last value: ${N}`);let H=Y(g);if(H!==void 0)b(Pt(H))});let E=Promise.resolve(),C=async(T)=>{let N=await n.effect({type:"storage-get",key:i});if(N===void 0)throw Error(`the stored value of ${i} did not come`);let H;try{H=typeof N==="string"?JSON.parse(N):structuredClone(l.initial)}catch{H=structuredClone(l.initial)}let w=(B)=>{if(B!==!0)throw Error(`${i} was not stored: ${B?.error??"no answer"}`)},D=structuredClone(H);T(D);let G=(B)=>!!B&&typeof B==="object"&&!Array.isArray(B);if(G(H)&&G(D)&&Object.keys(H).every((B)=>(B in D))){let B=Object.fromEntries(Object.entries(D).filter(([re,O])=>JSON.stringify(O)!==JSON.stringify(H[re])));if(Object.keys(B).length)w(await n.effect({type:"storage-merge",key:i,fields:B}))}else w(await n.effect({type:"storage-set",key:i,value:JSON.stringify(D)}));Ue(()=>b(Pt(D)))},P=[y,(T)=>{let N=E.then(()=>C(T));return E=N.catch(()=>{}),N}];return zt.set(i,P),P},memory(i,l){let m=zt.get(`memory:${i}`);if(m)return m;let[g,y]=se(()=>Ct(structuredClone(l.initial))),b=[g,(E)=>y(uo(E))];return zt.set(`memory:${i}`,b),b}},ui:{dialog:{show(i,l){let m=!!Le;if(ht(),it(),m)n.effect({type:"dialog",dialog:{type:"close",key:""}});Ie={size:"medium",centered:!1};let g=`compat.dialog.${++us}`;Tn.set(g,i),me={key:g,onClose:l,opened:!1,sent:!1},Y(()=>f(`dialog-open:${g}`,{type:"dialog-open",key:g})),queueMicrotask(()=>{if(me?.key===g)Wo()})},set(i){if(Ie={size:i?.size??"medium",centered:!!i?.centered},me){if(me.sent)Wo()}else if(Le&&Bo===_e&&(Ie.size!=="medium"||Ie.centered))a("dialog.set after its dialog showed")},clear(){let i=!!Le;if(ht(),Ie={size:"medium",centered:!1},i)n.effect({type:"dialog",dialog:{type:"close",key:""}});if(!me)return;n.effect({type:"dialog",dialog:{type:"close",key:me.key}}),it()},alert:(i)=>(Ie={size:"medium",centered:!1},Ut(()=>({type:"alert",title:i.title,message:i.message,...Vt()})).then(()=>{return})),confirm:(i)=>(Ie={size:"medium",centered:!1},Ut(()=>({type:"confirm",title:i.title,message:i.message,label:{confirm:i.label?.confirm,cancel:i.label?.cancel},...Vt()})).then((l)=>l===void 0?void 0:l==="true")),prompt:(i)=>(Ie={size:"medium",centered:!1},Ut(()=>{if(Ie.size!=="medium"||Ie.centered)a("ui.dialog.set of a prompt");return{type:"prompt",title:i.title,placeholder:i.placeholder,...i.value===void 0||i.value===null?{}:{value:String(i.value)},...i.description===void 0||i.description===null?{}:{description:String(i.description)}}})),async select(i){if((i.actions?.length??0)>hn)a(`ui.dialog.select over ${hn} actions`);let l=i.search,m=i.options.filter((O)=>!O.disabled),g=l?(l("",m)??[]).filter((O)=>!O.disabled):i.options,y=_e+1,b=new Map,E=[],C=(O)=>{if(!b.has(O))b.set(O,`${y}.${E.push(O)-1}`);return b.get(O)},X=(O)=>{let[ae,Fe]=(O??"").split(".");return ae===String(y)?E[Number(Fe)]:void 0},P=()=>g.map((O)=>({title:O.title,value:C(O),description:O.description,footer:l?O.category??O.footer:O.footer,category:l?void 0:O.category,disabled:!!O.disabled})),T=()=>{let O=g.find((ae)=>ae.value===i.current);return O===void 0?{}:{current:C(O)}},N=`search.${_e+1}`;Ie={size:"medium",centered:!1};let H=(i.actions??[]).slice(0,hn),w=H.map((O)=>(ae)=>{if(_e!==y||!Le)return;if(O.selection==="none")return ae===String(y)?O.onTrigger():void 0;let Fe=X(ae);if(Fe)O.onTrigger(Fe.value)});Nt=w;let D=H.map((O,ae)=>({title:String(O.title),key:String(O.bind),action:{type:"command",name:$o[ae],...O.selection==="none"?{input:String(y)}:{}},...O.side==="left"?{primary:!0}:O.side==="right"?{primary:!1}:{},...O.selection==="none"?{rowless:!0}:{}})),G=()=>({type:"select",title:i.title,placeholder:i.placeholder,options:P(),...T(),...l?{key:N,query:{type:"command",name:kn}}:{},...D.length?{actions:D}:{},...Vt()}),B=l?(O)=>{g=(l(O,m)??[]).filter((Fe)=>!Fe.disabled);let ae={...G(),action:{type:"command",name:Ft}};n.effect({type:"dialog",dialog:ae})}:void 0;qt=B;let re=await Ut(G);if(qt===B)qt=void 0;if(Nt===w)Nt=[];if(l&&re!==void 0)n.effect({type:"dialog",dialog:{type:"close",key:N}});return X(re)?.value}},toast:{show(i){n.effect(Cs(i))}},format:{path:(i)=>{let l=Ba();return l&&(i===l||i.startsWith(l+"/"))?"~"+i.slice(l.length):i}},router:{register(i){return jt(i.name,{type:"route",name:i.name},()=>({data:te.get(i.name)}),i.render,"route")},navigate(i){let l=i.type==="session"?{type:"session",id:i.sessionID}:i.type==="plugin"?{type:"plugin",id:i.id??o,name:i.name}:{type:"home"};if(i.type==="plugin")te.set(i.name,i.data);n.effect({type:"navigate",route:l})},current:()=>ee()},panel:{open(i,l){if(ee().type!=="session"||!$t.length)return!1;return rr(i),n.effect({type:"open-panel",surface:$t[0],...l?.presentation==="fullscreen"?{fullscreen:!0}:{}}),!0},close(){for(let i of $t)n.effect({type:"close-panel",surface:i})},current:()=>Nn()?{name:Nn(),sessionID:ee().sessionID??""}:void 0},tabs:{enabled:()=>!!f("tabs-enabled",{type:"tabs-enabled"}),list:()=>(f("tabs",{type:"tabs"})??[]).map((i)=>({sessionID:i.session_id,title:i.title,active:!!i.active,busy:!!i.busy,attention:!!i.attention,...i.unread?{unread:i.unread}:{}})),open:(i)=>Ht({type:"open",session:i}),focus:(i)=>Ht({type:"focus",session:i}),move:(i,l)=>Ht({type:"move",session:i,index:l}),close:(i)=>Ht({type:"close",...i?{session:i}:{}})},model:{current(){let i=f("model",{type:"model"});return i?{providerID:i.providerID,modelID:i.id??i.modelID,variant:i.variant}:void 0},variant:{list:()=>f("variants",{type:"variants"})??[],set(i){let l=f("variants",{type:"variants"})??[];if(!f("model",{type:"model"}))return!1;if(i!==void 0&&!l.includes(i))return!1;return n.effect({type:"set-variant",...i===void 0?{}:{variant:i}}),!0}}},slot(i){let l=["prepend","append","before","after","replace"].filter((b)=>i[b]!==void 0);if(l.length!==1)throw Error("Slot claim requires exactly one placement key");let m=l[0],g=String(i[m]),y=`slot#${ps++}`;if(g==="session.panel")return $t.push(y),jt(y,{type:"panel",name:y},or(g,y),i.render,`slot ${g}`);return jt(y,{type:"slot",kind:m,path:g},or(g),i.render,`slot ${g}`)}}},Ht=(i)=>{if(!f("tabs-enabled",{type:"tabs-enabled"}))return!1;return n.effect({type:"tab",edit:i}),!0};return dr}import Uo from"path";import{realpathSync as Qa}from"fs";function Za(e,n=Uo){let o=In(e,n);try{return In(Qa.native(o),n)}catch{return n.resolve(o)}}function In(e,n=Uo){if(n.sep!=="\\")return e;if(/^\\\\\?\\UNC\\/i.test(e))return`\\\\${e.slice(8)}`;if(/^\\\\\?\\[a-z]:/i.test(e))return e.slice(4);return e}function ed(e,n,o=Uo){let a=o.relative(In(e,o),In(n,o));return a===""||!o.isAbsolute(a)&&a!==".."&&!a.startsWith(`..${o.sep}`)}function ds(e){let[n,o]=io(e,["component"]);return Z(()=>{let a=n.component;if(typeof a==="function")return Y(()=>pe(a,o));if(typeof a!=="string")return;return Y(()=>{let d=gt(a);return kt(d,o),d})})}function td(e){let n=gt("box");for(let[o,a]of Object.entries({position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:1}))At(n,o,a);return e.ref?.(n),bo(n,()=>e.children),n}var nd=ho("solid",{...Oo,...sn,createComponent:pe,mergeProps:fn,Dynamic:ds,createDynamic:(e,n)=>ds(fn(n,{get component(){return e()}})),Portal:td,RendererContext:Ve(),extend(){throw Error("extend is not supported by opencode-native's JS host")}}),od={Plugin:{define:(e)=>e},PluginContextProvider:(e)=>pe(Sn.Provider,{value:e.value,get children(){return e.children}}),usePlugin(){let e=Re(Sn);if(!e)throw Error("PluginContextProvider is missing");return e}},Bd={"solid-js":sn,"solid-js/store":po,"@opentui/solid":nd,"@opentui/solid/jsx-runtime":ft,"@opentui/solid/jsx-dev-runtime":ft,"react/jsx-runtime":ft,"react/jsx-dev-runtime":ft,"@opentui/core":ho("core",{...fo,BoxRenderable:Po,TextRenderable:wo,MarkdownRenderable:ko,CodeRenderable:Ao,ScrollBoxRenderable:To,InputRenderable:Mo}),"@opencode/plugin/tui":od,"@opencode/plugin/rpc":{Rpc:dt},"@opencode/plugin/effect":{Rpc:dt,...Object.fromEntries(["Plugin","Agent","Artifact","Command","Connection","Credential","Integration","Location","Mcp","Model","PersistentPty","Provider","Reference","Skill","Tool","Vcs","WebSearch","Worktree"].map((e)=>[e,void 0]))}};export{Ya as context,ed as inside,Bd as modules,Za as real,No as reported}; +`)}if(k.done)return}}finally{try{await x.cancel()}catch{}x.releaseLock()}}}),c={server:{info:(t)=>r({method:"GET",path:"/api/info",successStatus:200,declaredStatuses:[400,401],empty:!1},t),pair:(t)=>r({method:"POST",path:"/api/pair",successStatus:200,declaredStatuses:[400,401],empty:!1},t),connect:(t,s)=>r({method:"GET",path:`/auth/connect/${encodeURIComponent(t.code)}`,successStatus:200,declaredStatuses:[400,401],empty:!1},s)},location:{get:(t,s)=>r({method:"GET",path:"/api/location",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),reload:(t)=>r({method:"POST",path:"/api/location/reload",successStatus:204,declaredStatuses:[400,401,503],empty:!0},t)},agent:{list:(t,s)=>r({method:"GET",path:"/api/agent",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),get:(t,s)=>r({method:"GET",path:`/api/agent/${encodeURIComponent(t.agentID)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},plugin:{list:(t,s)=>r({method:"GET",path:"/api/plugin",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),gui:(t,s)=>r({method:"GET",path:"/api/plugin/gui",query:{location:t.location,id:t.id},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),check:(t,s)=>r({method:"POST",path:"/api/plugin/check",query:{location:t?.location},body:{target:t?.target},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),update:(t,s)=>r({method:"POST",path:"/api/plugin/update",query:{location:t.location},body:{targets:t.targets},successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},s)},session:{list:(t,s)=>r({method:"GET",path:"/api/session",query:{limit:t?.limit,order:t?.order,search:t?.search,parentID:t?.parentID,archived:t?.archived,directory:t?.directory,project:t?.project,subpath:t?.subpath,cursor:t?.cursor},successStatus:200,declaredStatuses:[400,401],empty:!1},s),create:(t,s)=>r({method:"POST",path:"/api/session",body:{id:t?.id,parentID:t?.parentID,title:t?.title,agent:t?.agent,model:t?.model,location:t?.location,metadata:t?.metadata,permissions:t?.permissions},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),active:(t)=>r({method:"GET",path:"/api/session/active",successStatus:200,declaredStatuses:[400,401],empty:!1},t).then((s)=>s.data),get:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),remove:(t,s)=>r({method:"DELETE",path:`/api/session/${encodeURIComponent(t.sessionID)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),fork:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/fork`,body:{before:t.before},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),switchAgent:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/agent`,body:{agent:t.agent},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),switchModel:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/model`,body:{model:t.model},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),update:(t,s)=>r({method:"PATCH",path:`/api/session/${encodeURIComponent(t.sessionID)}`,body:{title:t.title,metadata:t.metadata,permissions:t.permissions,archived:t.archived},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),move:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/move`,body:{directory:t.directory,delivery:t.delivery},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),prompt:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/prompt`,body:{id:t.id,text:t.text,files:t.files,agents:t.agents,skills:t.skills,metadata:t.metadata,delivery:t.delivery,resume:t.resume},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},s).then((u)=>u.data),command:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/command`,body:{name:t.name,text:t.text,files:t.files,agents:t.agents,skills:t.skills,delivery:t.delivery},successStatus:204,declaredStatuses:[400,401,404,500],empty:!0},s),synthetic:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/synthetic`,body:{id:t.id,text:t.text,description:t.description,metadata:t.metadata,delivery:t.delivery,resume:t.resume},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},s).then((u)=>u.data),shell:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/shell`,body:{id:t.id,command:t.command},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),compact:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/compact`,body:{id:t.id,delivery:t.delivery},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},s).then((u)=>u.data),revert:{stage:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/revert/stage`,body:{messageID:t.messageID,files:t.files},successStatus:200,declaredStatuses:[400,401,404,409,500],empty:!1},s).then((u)=>u.data),clear:(t,s)=>r({method:"DELETE",path:`/api/session/${encodeURIComponent(t.sessionID)}/revert`,successStatus:204,declaredStatuses:[400,401,404,409,500],empty:!0},s),commit:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/revert/commit`,successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},s)},context:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/context`,successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},s).then((u)=>u.data),diff:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/diff`,query:{from:t.from,to:t.to,context:t.context},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},s).then((u)=>u.data),inbox:{list:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/inbox`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),cancel:(t,s)=>r({method:"DELETE",path:`/api/session/${encodeURIComponent(t.sessionID)}/inbox/${encodeURIComponent(t.inboxID)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),update:(t,s)=>r({method:"PATCH",path:`/api/session/${encodeURIComponent(t.sessionID)}/inbox/${encodeURIComponent(t.inboxID)}`,body:{delivery:t.delivery},successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},s)},generate:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/generate`,body:{prompt:t.prompt},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s).then((u)=>u.data),interrupt:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/interrupt`,query:{resume:t.resume},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),background:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/background`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),message:{get:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/message/${encodeURIComponent(t.messageID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data)},form:{list:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/form`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),create:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/form`,body:{id:t.id,title:t.title,metadata:t.metadata,fields:t.fields},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},s).then((u)=>u.data),get:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/form/${encodeURIComponent(t.formID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),reply:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/form/${encodeURIComponent(t.formID)}/reply`,body:{answer:t.answer},successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},s),cancel:(t,s)=>r({method:"DELETE",path:`/api/session/${encodeURIComponent(t.sessionID)}/form/${encodeURIComponent(t.formID)}`,query:{message:t.message},successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},s)},environment:(t,s)=>r({method:"PUT",path:`/api/session/${encodeURIComponent(t.sessionID)}/environment`,body:{variables:t.variables},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),view:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/view`,body:{idle:t.idle},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)},experimental:{session:{stats:(t,s)=>r({method:"GET",path:"/api/experimental/session/stats",query:{from:t?.from,to:t?.to,project:t?.project,timezone:t?.timezone,tools:t?.tools},successStatus:200,declaredStatuses:[400,401],empty:!1},s).then((u)=>u.data),import:(t,s)=>r({method:"POST",path:"/api/experimental/session/import",body:{info:t.info,messages:t.messages,location:t.location},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},s).then((u)=>u.data),export:(t,s)=>r({method:"GET",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/export`,query:{sanitize:t.sanitize},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},s).then((u)=>u.data),skill:(t,s)=>r({method:"POST",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/skill`,body:{id:t.id,resume:t.resume},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),wait:(t,s)=>r({method:"POST",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/wait`,successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},s),instructions:{entry:{list:(t,s)=>r({method:"GET",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/instructions/entries`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),put:(t,s)=>r({method:"PUT",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/instructions/entries/${encodeURIComponent(t.key)}`,body:{value:t.value},successStatus:204,declaredStatuses:[400,401,404,413],empty:!0},s),remove:(t,s)=>r({method:"DELETE",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/instructions/entries/${encodeURIComponent(t.key)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)}},log:(t,s)=>p({method:"GET",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/log`,query:{after:t.after,follow:t.follow},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},generate:{text:(t,s)=>r({method:"POST",path:"/api/experimental/generate/text",body:{prompt:t.prompt,model:t.model},successStatus:200,declaredStatuses:[400,401,404,422,502,503],empty:!1},s).then((u)=>u.data),image:(t,s)=>r({method:"POST",path:"/api/experimental/generate/image",body:{model:t.model,prompt:t.prompt,images:t.images,n:t.n,aspect:t.aspect,resolution:t.resolution},successStatus:200,declaredStatuses:[400,401,404,422,502,503],empty:!1},s).then((u)=>u.data),video:{create:(t,s)=>r({method:"POST",path:"/api/experimental/generate/video",body:{model:t.model,prompt:t.prompt,start:t.start,end:t.end,references:t.references,duration:t.duration,aspect:t.aspect,resolution:t.resolution,sound:t.sound},successStatus:200,declaredStatuses:[400,401,403,404,422,502,503],empty:!1},s).then((u)=>u.data),get:(t,s)=>r({method:"GET",path:`/api/experimental/generate/video/${encodeURIComponent(t.id)}`,successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},s).then((u)=>u.data)},decisions:(t,s)=>r({method:"POST",path:"/api/experimental/generate/decisions",body:{model:t.model,input:t.input,questions:t.questions},successStatus:200,declaredStatuses:[400,401,404,422,502,503],empty:!1},s).then((u)=>u.data)},voice:{models:(t)=>r({method:"GET",path:"/api/experimental/voice/models",successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t).then((s)=>s.data),session:(t,s)=>r({method:"POST",path:"/api/experimental/voice/session",body:{model:t.model,session:t.session,transport:t.transport},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s).then((u)=>u.data)},integration:{wellknown:{add:(t,s)=>r({method:"POST",path:"/api/experimental/integration/wellknown",query:{location:t.location},body:{url:t.url},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)}},mcp:{add:(t,s)=>r({method:"PUT",path:`/api/experimental/mcp/${encodeURIComponent(t.server)}`,query:{location:t.location},body:{config:t.config},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),remove:(t,s)=>r({method:"DELETE",path:`/api/experimental/mcp/${encodeURIComponent(t.server)}`,query:{location:t.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),connect:(t,s)=>r({method:"POST",path:`/api/experimental/mcp/${encodeURIComponent(t.server)}/connect`,query:{location:t.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),disconnect:(t,s)=>r({method:"POST",path:`/api/experimental/mcp/${encodeURIComponent(t.server)}/disconnect`,query:{location:t.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),client:{token:(t,s)=>r({method:"POST",path:"/api/experimental/client-mcp/token",query:{location:t.location,name:t.name},headers:{"x-opencode-ticket":t["x-opencode-ticket"]},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},s)}},file:{write:(t,s)=>r({method:"POST",path:"/api/experimental/fs/write",query:{location:t.location,path:t.path},body:t.payload,successStatus:200,declaredStatuses:[400,401,404],empty:!1,binaryBody:!0},s),watch:(t,s)=>r({method:"POST",path:"/api/experimental/fs/watch",query:{location:t.location},body:{path:t.path},successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},s),unwatch:(t,s)=>r({method:"DELETE",path:"/api/experimental/fs/watch",query:{location:t.location},body:{path:t.path},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)},persistentPty:{read:(t,s)=>r({method:"GET",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/terminal/read`,query:{lines:t.lines},successStatus:200,declaredStatuses:[400,401,503],empty:!1},s).then((u)=>u.data),list:(t,s)=>r({method:"GET",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/terminal`,successStatus:200,declaredStatuses:[400,401,503],empty:!1},s).then((u)=>u.data),create:(t,s)=>r({method:"POST",path:`/api/experimental/session/${encodeURIComponent(t.sessionID)}/terminal`,body:{command:t.command,args:t.args,cwd:t.cwd,title:t.title,env:t.env,size:t.size},successStatus:200,declaredStatuses:[400,401,503],empty:!1},s).then((u)=>u.data),shutdown:(t)=>r({method:"POST",path:"/api/experimental/persistent-pty/shutdown",successStatus:204,declaredStatuses:[400,401,503],empty:!0},t),handoff:(t)=>r({method:"POST",path:"/api/experimental/persistent-pty/handoff",successStatus:200,declaredStatuses:[400,401,503],empty:!1},t),get:(t,s)=>r({method:"GET",path:`/api/experimental/persistent-pty/${encodeURIComponent(t.ptyID)}`,successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s).then((u)=>u.data),update:(t,s)=>r({method:"PUT",path:`/api/experimental/persistent-pty/${encodeURIComponent(t.ptyID)}`,body:{attachmentID:t.attachmentID,size:t.size,title:t.title},successStatus:200,declaredStatuses:[400,401,404,501,503],empty:!1},s).then((u)=>u.data),snapshot:(t,s)=>r({method:"GET",path:`/api/experimental/persistent-pty/${encodeURIComponent(t.ptyID)}/snapshot`,successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s).then((u)=>u.data),remove:(t,s)=>r({method:"DELETE",path:`/api/experimental/persistent-pty/${encodeURIComponent(t.ptyID)}`,successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},s),connectToken:(t,s)=>r({method:"POST",path:`/api/experimental/persistent-pty/${encodeURIComponent(t.ptyID)}/connect-token`,headers:{"x-opencode-ticket":t["x-opencode-ticket"]},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},s).then((u)=>u.data)},media:{get:(t,s)=>r({method:"GET",path:`/api/experimental/media/${encodeURIComponent(t.hash)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1,binary:!0},s)},blob:{get:(t,s)=>r({method:"GET",path:`/api/experimental/blob/${encodeURIComponent(t.id)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1,binary:!0},s)},automation:{create:(t,s)=>r({method:"POST",path:"/api/experimental/automation",body:{sessionID:t.sessionID,directory:t.directory,name:t.name,trigger:t.trigger,action:t.action,expires:t.expires},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},s).then((u)=>u.data),list:(t,s)=>r({method:"GET",path:"/api/experimental/automation",query:{sessionID:t?.sessionID,directory:t?.directory},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},s).then((u)=>u.data),get:(t,s)=>r({method:"GET",path:`/api/experimental/automation/${encodeURIComponent(t.automationID)}`,successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},s).then((u)=>u.data),pause:(t,s)=>r({method:"POST",path:`/api/experimental/automation/${encodeURIComponent(t.automationID)}/pause`,successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},s).then((u)=>u.data),resume:(t,s)=>r({method:"POST",path:`/api/experimental/automation/${encodeURIComponent(t.automationID)}/resume`,successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},s).then((u)=>u.data),delete:(t,s)=>r({method:"DELETE",path:`/api/experimental/automation/${encodeURIComponent(t.automationID)}`,successStatus:204,declaredStatuses:[400,401,403,404],empty:!0},s)},artifacts:{providers:(t,s)=>r({method:"GET",path:"/api/experimental/artifacts/providers",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},s),list:(t,s)=>r({method:"GET",path:"/api/experimental/artifacts",query:{location:t?.location,sessionID:t?.sessionID,provider:t?.provider},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},s),create:(t,s)=>r({method:"POST",path:"/api/experimental/artifacts",query:{location:t.location},body:{title:t.title,files:t.files,entry:t.entry,provider:t.provider,sessionID:t.sessionID},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},s),get:(t,s)=>r({method:"GET",path:`/api/experimental/artifacts/${encodeURIComponent(t.artifactID)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},s),update:(t,s)=>r({method:"PATCH",path:`/api/experimental/artifacts/${encodeURIComponent(t.artifactID)}`,query:{location:t.location},body:{title:t.title,files:t.files,entry:t.entry,sessionID:t.sessionID},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},s),delete:(t,s)=>r({method:"DELETE",path:`/api/experimental/artifacts/${encodeURIComponent(t.artifactID)}`,query:{location:t.location},successStatus:204,declaredStatuses:[400,401,403,404,503],empty:!0},s),view:(t,s)=>r({method:"GET",path:`/api/experimental/artifacts/${encodeURIComponent(t.artifactID)}/view/${os(t.path)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1,binary:!0},s)},job:{list:(t,s)=>r({method:"GET",path:"/api/experimental/job",query:{sessionID:t?.sessionID,kind:t?.kind,status:t?.status,descendants:t?.descendants},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data)},migration:{v1:{status:(t)=>r({method:"GET",path:"/api/experimental/migration/v1",successStatus:200,declaredStatuses:[400,401],empty:!1},t)}},usage:{limits:(t,s)=>r({method:"GET",path:"/api/experimental/usage/limits",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s)},config:{update:(t,s)=>r({method:"PATCH",path:"/api/experimental/config",body:{shell:t.shell},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)}},message:{list:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/message`,query:{limit:t.limit,order:t.order,cursor:t.cursor,type:t.type},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},s)},model:{list:(t,s)=>r({method:"GET",path:"/api/model",query:{location:t?.location,types:t?.types},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s),default:(t,s)=>r({method:"GET",path:"/api/model/default",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s)},provider:{list:(t,s)=>r({method:"GET",path:"/api/provider",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s),get:(t,s)=>r({method:"GET",path:`/api/provider/${encodeURIComponent(t.providerID)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s)},integration:{list:(t,s)=>r({method:"GET",path:"/api/integration",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),get:(t,s)=>r({method:"GET",path:`/api/integration/${encodeURIComponent(t.integrationID)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),connect:{key:(t,s)=>r({method:"POST",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/key`,query:{location:t.location},body:{key:t.key,answer:t.answer,label:t.label},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),external:(t,s)=>r({method:"POST",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/external`,query:{location:t.location},body:{methodID:t.methodID,answer:t.answer,label:t.label},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)},oauth:{connect:(t,s)=>r({method:"POST",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/oauth`,query:{location:t.location},body:{methodID:t.methodID,answer:t.answer,label:t.label},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),status:(t,s)=>r({method:"GET",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/oauth/${encodeURIComponent(t.attemptID)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),complete:(t,s)=>r({method:"POST",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/oauth/${encodeURIComponent(t.attemptID)}/complete`,query:{location:t.location},body:{code:t.code},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),cancel:(t,s)=>r({method:"DELETE",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/oauth/${encodeURIComponent(t.attemptID)}`,query:{location:t.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)},command:{connect:(t,s)=>r({method:"POST",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/command`,query:{location:t.location},body:{methodID:t.methodID,label:t.label},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),status:(t,s)=>r({method:"GET",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/command/${encodeURIComponent(t.attemptID)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),cancel:(t,s)=>r({method:"DELETE",path:`/api/integration/${encodeURIComponent(t.integrationID)}/connect/command/${encodeURIComponent(t.attemptID)}`,query:{location:t.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)}},mcp:{list:(t,s)=>r({method:"GET",path:"/api/mcp",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),resource:{catalog:(t,s)=>r({method:"GET",path:"/api/mcp/resource",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)}},credential:{list:(t)=>r({method:"GET",path:"/api/credential",successStatus:200,declaredStatuses:[400,401],empty:!1},t).then((s)=>s.data),create:(t,s)=>r({method:"POST",path:"/api/credential",body:{id:t.id,integrationID:t.integrationID,label:t.label,value:t.value,activate:t.activate},successStatus:200,declaredStatuses:[400,401,409],empty:!1},s).then((u)=>u.data),update:(t,s)=>r({method:"PATCH",path:`/api/credential/${encodeURIComponent(t.credentialID)}`,body:{label:t.label},successStatus:204,declaredStatuses:[400,401],empty:!0},s),activate:(t,s)=>r({method:"POST",path:`/api/credential/${encodeURIComponent(t.credentialID)}/activate`,successStatus:204,declaredStatuses:[400,401],empty:!0},s),remove:(t,s)=>r({method:"DELETE",path:`/api/credential/${encodeURIComponent(t.credentialID)}`,successStatus:204,declaredStatuses:[400,401],empty:!0},s)},project:{list:(t,s)=>r({method:"GET",path:"/api/project",query:{archived:t?.archived},successStatus:200,declaredStatuses:[400,401],empty:!1},s),update:(t,s)=>r({method:"PATCH",path:`/api/project/${encodeURIComponent(t.projectID)}`,body:{canonical:t.canonical,name:t.name,icon:t.icon,commands:t.commands},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},form:{list:(t,s)=>r({method:"GET",path:"/api/form",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},permission:{request:{list:(t,s)=>r({method:"GET",path:"/api/permission/request",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},saved:{list:(t,s)=>r({method:"GET",path:"/api/permission/saved",query:{projectID:t?.projectID},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),update:(t,s)=>r({method:"PATCH",path:`/api/permission/saved/${encodeURIComponent(t.id)}`,body:{action:t.action,resource:t.resource},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},s).then((u)=>u.data),remove:(t,s)=>r({method:"DELETE",path:`/api/permission/saved/${encodeURIComponent(t.id)}`,successStatus:204,declaredStatuses:[400,401],empty:!0},s)},create:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/permission`,body:{id:t.id,action:t.action,resources:t.resources,save:t.save,metadata:t.metadata,source:t.source,agent:t.agent},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),list:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/permission`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),get:(t,s)=>r({method:"GET",path:`/api/session/${encodeURIComponent(t.sessionID)}/permission/${encodeURIComponent(t.requestID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},s).then((u)=>u.data),reply:(t,s)=>r({method:"POST",path:`/api/session/${encodeURIComponent(t.sessionID)}/permission/${encodeURIComponent(t.requestID)}/reply`,body:{decision:t.decision,message:t.message},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)},file:{read:(t,s)=>r({method:"GET",path:`/api/fs/read/${os(t.path)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1,binary:!0},s),list:(t,s)=>r({method:"GET",path:"/api/fs/list",query:{location:t?.location,path:t?.path},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),find:(t,s)=>r({method:"GET",path:"/api/fs/find",query:{location:t.location,query:t.query,type:t.type,limit:t.limit},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},command:{list:(t,s)=>r({method:"GET",path:"/api/command",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},skill:{list:(t,s)=>r({method:"GET",path:"/api/skill",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},rpc:{call:(t,s)=>r({method:"POST",path:`/api/rpc/${encodeURIComponent(t.rpcID)}/${encodeURIComponent(t.method)}`,query:{location:t.location},body:{input:t.input},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},s)},event:{subscribe:(t,s)=>p({method:"GET",path:"/api/event",query:{types:t?.types},successStatus:200,declaredStatuses:[400,401],empty:!1},s)},pty:{list:(t,s)=>r({method:"GET",path:"/api/pty",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),create:(t,s)=>r({method:"POST",path:"/api/pty",query:{location:t?.location},body:{command:t?.command,args:t?.args,cwd:t?.cwd,title:t?.title,env:t?.env},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),get:(t,s)=>r({method:"GET",path:`/api/pty/${encodeURIComponent(t.ptyID)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),update:(t,s)=>r({method:"PUT",path:`/api/pty/${encodeURIComponent(t.ptyID)}`,query:{location:t.location},body:{title:t.title,size:t.size},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),remove:(t,s)=>r({method:"DELETE",path:`/api/pty/${encodeURIComponent(t.ptyID)}`,query:{location:t.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),connect:{token:(t,s)=>r({method:"POST",path:`/api/pty/${encodeURIComponent(t.ptyID)}/connect-token`,query:{location:t.location},headers:{"x-opencode-ticket":t["x-opencode-ticket"]},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},s)}},shell:{list:(t,s)=>r({method:"GET",path:"/api/shell",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),create:(t,s)=>r({method:"POST",path:"/api/shell",query:{location:t.location},body:{command:t.command,cwd:t.cwd,timeout:t.timeout,metadata:t.metadata},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),get:(t,s)=>r({method:"GET",path:`/api/shell/${encodeURIComponent(t.id)}`,query:{location:t.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),output:(t,s)=>r({method:"GET",path:`/api/shell/${encodeURIComponent(t.id)}/output`,query:{location:t.location,cursor:t.cursor,limit:t.limit},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),remove:(t,s)=>r({method:"DELETE",path:`/api/shell/${encodeURIComponent(t.id)}`,query:{location:t.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)},reference:{list:(t,s)=>r({method:"GET",path:"/api/reference",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},worktree:{list:(t,s)=>r({method:"GET",path:"/api/worktree",query:{projectID:t.projectID},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),create:(t,s)=>r({method:"POST",path:"/api/worktree",body:{projectID:t.projectID,from:t.from,branch:t.branch,directory:t.directory,name:t.name},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),remove:(t,s)=>r({method:"DELETE",path:"/api/worktree",body:{projectID:t.projectID,directory:t.directory,force:t.force},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s),refresh:(t,s)=>r({method:"POST",path:"/api/worktree/refresh",body:{projectID:t.projectID},successStatus:204,declaredStatuses:[400,401,404],empty:!0},s)},vcs:{init:(t,s)=>r({method:"POST",path:"/api/vcs/init",query:{location:t?.location,provider:t?.provider},successStatus:204,declaredStatuses:[400,401,404,409,501,503],empty:!0},s),get:(t,s)=>r({method:"GET",path:"/api/vcs",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),base:(t,s)=>r({method:"GET",path:"/api/vcs/base",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s),status:(t,s)=>r({method:"GET",path:"/api/vcs/status",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),branch:{list:(t,s)=>r({method:"GET",path:"/api/vcs/branch",query:{location:t?.location,search:t?.search,limit:t?.limit},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s)},diff:(t,s)=>r({method:"GET",path:"/api/vcs/diff",query:{location:t.location,mode:t.mode,base:t.base,context:t.context,untracked:t.untracked},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s)},debug:{heapDump:(t,s)=>r({method:"POST",path:"/api/debug/heap-dump",query:{directory:t?.directory},successStatus:200,declaredStatuses:[400,401,500],empty:!1},s),location:{list:(t)=>r({method:"GET",path:"/api/debug/location",successStatus:200,declaredStatuses:[400,401],empty:!1},t),evict:(t,s)=>r({method:"DELETE",path:"/api/debug/location",query:{location:t?.location},successStatus:204,declaredStatuses:[400,401],empty:!0},s)}},websearch:{providers:(t,s)=>r({method:"GET",path:"/api/websearch/provider",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s),query:(t,s)=>r({method:"POST",path:"/api/websearch",query:{location:t.location},body:{query:t.query,providerID:t.providerID},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},s)},config:{get:(t,s)=>r({method:"GET",path:"/api/config",query:{location:t?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},s),shells:(t)=>r({method:"GET",path:"/api/config/shell",successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)}};return{...c,session:{...c.session,stats:c.experimental.session.stats,import:c.experimental.session.import,export:c.experimental.session.export,skill:c.experimental.session.skill,wait:c.experimental.session.wait,instructions:{entry:{list:c.experimental.session.instructions.entry.list,put:c.experimental.session.instructions.entry.put,remove:c.experimental.session.instructions.entry.remove}},log:c.experimental.session.log},generate:{text:c.experimental.generate.text,image:c.experimental.generate.image,decisions:c.experimental.generate.decisions},voice:{models:c.experimental.voice.models,session:c.experimental.voice.session},integration:{...c.integration,wellknown:{add:c.experimental.integration.wellknown.add}},mcp:{...c.mcp,add:c.experimental.mcp.add,remove:c.experimental.mcp.remove,connect:c.experimental.mcp.connect,disconnect:c.experimental.mcp.disconnect,client:{token:c.experimental.mcp.client.token}},file:{...c.file,write:c.experimental.file.write,watch:c.experimental.file.watch,unwatch:c.experimental.file.unwatch},migration:{v1:{status:c.experimental.migration.v1.status}},usage:{limits:c.experimental.usage.limits},config:{...c.config,update:c.experimental.config.update}}}function os(e){return e.split("/").map(encodeURIComponent).join("/")}function Fo(e,n,o){if(o===void 0)return;if(o===null){e.append(n,"null");return}if(Array.isArray(o)){for(let a of o)Fo(e,n,a);return}if(typeof o==="object"){for(let[a,d]of Object.entries(o))Fo(e,`${n}[${a}]`,d);return}e.append(n,String(o))}async function rs(e){if(!ss(e,"application/json")&&!e.headers.get("content-type")?.includes("+json")){try{await e.body?.cancel()}catch{}throw new be("UnsupportedContentType",{detail:e.headers.get("content-type")})}let n;try{n=await e.text()}catch(o){throw new be("Transport",{cause:o})}if(n==="")throw new be("MalformedResponse");try{return JSON.parse(n)}catch(o){throw new be("MalformedResponse",{cause:o})}}function ja(e){let n=Object.assign(Error(e.message??e.data?.message),e);if(e._tag)n.name=e._tag;return n}function ss(e,n){return e.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase()===n}var as=["location.shutdown","models-dev.refreshed","credential.updated","credential.switched","integration.updated","provider.updated","model.updated","agent.updated","session.created","session.agent.selected","session.model.selected","session.moved","session.renamed","session.metadata.updated","session.permissions","session.viewed","session.archived","session.unarchived","session.usage.updated","session.deleted","session.forked","session.inbox.delivered","session.inbox.enqueued","session.inbox.cancelled","session.inbox.delivery.changed","session.execution.started","session.execution.succeeded","session.execution.failed","session.execution.interrupted","session.instructions.updated","session.synthetic","session.skill.activated","session.shell.started","session.shell.ended","session.step.started","session.step.first-token","session.step.streamed","session.step.ended","session.step.failed","session.text.started","session.text.delta","session.text.ended","session.reasoning.started","session.reasoning.delta","session.reasoning.ended","session.tool.input.started","session.tool.input.delta","session.tool.input.ended","session.tool.called","session.tool.progress","session.tool.success","session.tool.failed","session.retry.scheduled","session.compaction.started","session.compaction.delta","session.compaction.ended","session.compaction.failed","session.revert.staged","session.revert.cleared","session.revert.committed","filesystem.changed","reference.updated","permission.asked","permission.replied","plugin.updated","project.updated","worktree.updated","worktree.resolved","command.updated","config.updated","skill.updated","pty.created","pty.updated","pty.exited","pty.deleted","persistent-pty.added","persistent-pty.removed","persistent-pty.updated","shell.created","shell.exited","shell.deleted","form.created","form.replied","form.cancelled","websearch.updated","artifact.updated","session.status","session.idle","tui.prompt.append","tui.command.execute","tui.toast.show","tui.session.select","installation.updated","installation.update-available","vcs.branch.updated","mcp.status.changed","mcp.resources.changed","experimental.mcp.event"];var Wa=new Set(["on","off","once","addListener","removeListener","prependListener","prependOnceListener","removeAllListeners","setMaxListeners"]),xn=[100,200,300,400,500,600,700,800,900],za=["disabled","pressed","focused","selected","hovered"],Ha=new Set(["input","textarea"]),Ka={return:"\r",escape:"\x1B",tab:"\t",backspace:"\x7F",space:" "},Xa=250,hn=4;function qo(e,n){for(let o=n;o;o=o.parent)if(o===e)return!0;return!1}var No=new Map,Sn=Ve();function Ya(e,n){let o=e.id,a=(i,l=`${o}: ${i} is not supported by opencode-native yet`)=>{let m=No.get(o)??new Set;if(No.set(o,m),m.has(i))return;m.add(i),n.effect({type:"log",level:"warn",message:l})},d=new Set,r=(i,l,m)=>{let g=String(m.info??""),b={type:"code",raw:"```"+g+` +`+String(m.code??"")+(m.closed?"\n```":""),lang:g.trim()||void 0,text:String(m.code??"")},E={conceal:!0,concealCode:!1,defaultRender:()=>new Lo},C;try{C=l(b,E)}catch(T){let N=T instanceof Error?T.message:String(T);throw queueMicrotask(()=>{n.effect({type:"toast",variant:"error",title:"Plugin",message:`${o} crashed in code block ${i}: ${N}`})}),T}if(C===void 0||C===null)return null;if(!(C instanceof ye))return queueMicrotask(()=>a("a code block's renderable built outside @opentui/core's classes")),null;let X=new Set,P=Do(C,{press:()=>{X.add("a click in a code block");return},dropped:X});if(X.size)queueMicrotask(()=>X.forEach((T)=>a(T)));return P},p=128,c=16,t=new Map,s=new Map,u=new Set,x=new Map,R,v=new Set,k=(i)=>n.readError?.(i),V=se(()=>Q(0));n.listen((i)=>{if(i==="theme")return V[1]((g)=>g+1);u.add(i),t.get(i)?.[1]((g)=>g+1);let m=k(i);if(m)a(`read ${m}`,`${o}: a read failed: ${m}`);for(let g of x.get(i)?.splice(0)??[])if(m)g.reject(Error(`${i}: ${m}`));else g.resolve()});let J=()=>{let i=new Set([...Pe.values(),...v].flatMap((l)=>[...l.keys]));return[...s.keys()].filter((l)=>!i.has(l)&&!l.startsWith("storage:")&&!x.get(l)?.length)},j=(i)=>{s.delete(i),u.delete(i),n.unwatch(i)},f=(i,l)=>{let m=t.get(i);if(!m)m=se(()=>Q(0)),t.set(i,m);if(m[0](),R?.keys.add(i),s.has(i))s.delete(i),s.set(i,l);else{let g=J();if(s.size>=128&&g.length)j(g[0]);s.set(i,l),n.watch(i,l);for(let y of J().slice(0,Math.max(0,J().length-16)))j(y)}if(!u.has(i)&&R)R.pending=!0;return n.read(i)},I=(i,l)=>new Promise((m,g)=>{Y(()=>f(i,l));let y=k(i);if(u.has(i)&&y)return g(Error(`${i}: ${y}`));if(u.has(i))return m();x.set(i,[...x.get(i)??[],{resolve:m,reject:g}])}),h=()=>f("sessions",{type:"sessions"})??[],M,F=(i)=>{let l=h();if(M?.list!==l)M={list:l,byID:new Map(l.map((g)=>[g.info.id,g]))};let m=`session:${i}`;return M.byID.get(i)??(s.has(m)?f(m,{type:"session",id:i}):n.read(m))??void 0},_=()=>f("info",{type:"info"}),q=(i)=>i?{directory:i.directory,workspace:i.workspaceID??void 0}:null,A=(i)=>JSON.stringify(q(i)),Ce=(i)=>i&&{directory:i.directory,...i.workspace?{workspaceID:i.workspace}:{}},W=(i)=>({list:(l)=>f(`${i}:${A(l)}`,{type:i,location:q(l)})??void 0,sync:(l)=>I(`${i}:${A(l)}`,{type:i,location:q(l)}),invalidate(){}}),z=(i)=>({list:()=>(a(`data.${i}`),[]),sync:async()=>a(`data.${i}`),invalidate(){}}),ee=()=>{let i=f("route",{type:"route"});if(i?.type==="session")return{type:"session",sessionID:i.id};if(i?.type==="plugin")return{type:"plugin",id:i.id,name:i.name,data:te.get(i.name)};return{type:"home"}},te=new Map,Me=4,bn=256,Lt=(i,l,m=(...y)=>JSON.stringify(y),g=(y,b)=>!0)=>{let y=new Map,b=[],E=0,C=!1,X=(D)=>{let G=m(...D),B=y.get(G);if(B)return B;let re={args:D,version:se(()=>Q(0)),state:"idle",again:!1,settled:[]};return y.set(G,re),re},P=(D)=>{D.state="idle";for(let G of D.settled.splice(0))G()},T=()=>{while(E{D.state="loading",D.again=!1,E++,l(...D.args).then((G)=>{if(D.again)return;D.value=G,D.version[1]((B)=>B+1),Gt()},(G)=>console.warn(`plugin ${o}: a load of data failed: ${G instanceof Error?G.message:G}`)).finally(()=>{if(E--,D.again)H(D);else P(D);T()})},H=(D)=>{if(D.state="waiting",b.push(D),b.length>bn)P(b.shift());T()},w=(D)=>{if(!C){C=!0;for(let B of i)e.data.on(B,(re)=>y.forEach((O)=>{if(g(re,O.args))w(O)}))}let G=new Promise((B)=>D.settled.push(B));if(D.state==="loading")D.again=!0;else if(D.state==="idle")H(D);return G};return{list(...D){let G=X(D);if(G.version[0](),G.value===void 0&&G.state==="idle")w(G);return G.value},sync:(...D)=>w(X(D)),invalidate:(...D)=>void w(X(D))}},Vo=(i)=>i?.directory?{directory:i.directory}:void 0,xt=(i,l)=>Lt(l,(m)=>Ge[i].list({location:Vo(m)}).then((g)=>g.data),(m)=>A(m)),En=Lt(["form.created","form.replied","form.cancelled"],(i)=>Ge.form.list({location:Vo(i)}).then((l)=>l.data),(i)=>A(i)),_o=new Map,vn={list(i,l){let m=En.list(l);if(m===void 0)return;let g=A(l),y=_o.get(g);if(y?.of!==m){let b=new Map;for(let E of m)b.set(E.sessionID,[...b.get(E.sessionID)??[],E]);y={of:m,bySession:b,none:[]},_o.set(g,y)}return y.bySession.get(i)??y.none},sync:(i,l)=>En.sync(l),invalidate:(i,l)=>En.invalidate(l)},Dn=xt("shell",["shell.created","shell.exited","shell.deleted"]),Rn=Lt(["project.updated"],()=>Ge.project.list()),On=new Set,Go=!1,ls={on:e.data.on,listen(i){if(On.add(i),!Go)Go=!0,n.on(as,(l)=>{for(let m of[...On])m({details:l})}),n.changed();return()=>void On.delete(i)},session:{list:()=>h().map((i)=>i.info),get:(i)=>F(i)?.info,root(i){let l=i;for(let m=0;m<64;m++){let g=F(l)?.info?.parentID;if(!g)return l;l=g}return l},family:(i)=>(f(`family:${i}`,{type:"family",id:i})?.members??[]).map((l)=>l.id),cost:(i)=>f(`family:${i}`,{type:"family",id:i})?.cost??0,status:(i)=>F(i)?.status==="running"?"running":"idle",pending:{list:(i)=>f(`pending:${i}`,{type:"pending",id:i})??[],sync:(i)=>I(`pending:${i}`,{type:"pending",id:i}),invalidate(){}},sync:(i)=>I(`session:${i}`,{type:"session",id:i}),invalidate(){},message:{list:(i)=>f(`messages:${i}`,{type:"messages",id:i})??[],get:(i,l)=>(f(`messages:${i}`,{type:"messages",id:i})??[]).find((m)=>m.id===l),sync:(i)=>I(`messages:${i}`,{type:"messages",id:i}),invalidate(){}},permission:Lt(["permission.asked","permission.replied"],(i)=>Ge.permission.list({sessionID:i}),void 0,(i,[l])=>i?.data?.sessionID===void 0||i.data.sessionID===l),form:{...vn,reply:async(i,l)=>{await Ge.session.form.reply(i),vn.invalidate(i.sessionID,l)},cancel:async(i,l)=>{await Ge.session.form.cancel(i),vn.invalidate(i.sessionID,l)}}},project:{...Rn,list:()=>Rn.list()??[],get:(i)=>(Rn.list()??[]).find((l)=>l.id===i),permission:z("project.permission")},shell:{...Dn,list:(i)=>Dn.list(i)??[],get:(i)=>(Dn.list()??[]).find((l)=>l.id===i)},location:{default:()=>Ce(_()?.location)??{directory:process.env.OPENCODE_DIRECTORY??process.cwd()},sync:async()=>{},invalidate(){},vcs:{info:(i)=>f(`vcs:${A(i)}`,{type:"vcs",location:q(i)})??void 0,sync:(i)=>I(`vcs:${A(i)}`,{type:"vcs",location:q(i)}),invalidate(){}},agent:xt("agent",["agent.updated"]),command:xt("command",["command.updated"]),integration:W("integrations"),mcp:{server:W("mcp-servers"),resource:z("location.mcp.resource")},model:W("models"),provider:{list:()=>f("providers",{type:"providers"})??void 0,sync:()=>I("providers",{type:"providers"}),invalidate(){}},reference:xt("reference",["reference.updated"]),skill:xt("skill",["skill.updated"])}},Jo=(i)=>{let l=n.palette(),m={},g=[];for(let[P,T]of Object.entries(l.colors)){let N=P.startsWith("@dialog.footer.")?"dialog.footer":P.startsWith("@dialog.")?"dialog":void 0;if(N)(m[N]??={})[P.slice(N.length+2)]=T;else g.push([P,T])}let y={};for(let[P,T]of g.sort(([N],[H])=>N.length-H.length)){let N=P.split("."),H=y;for(let O of N.slice(0,-1)){if(!(O in H))H[O]={};H=H[O]}let w=N[N.length-1],D=i===void 0?void 0:m[i]?.[P],G=wt(D??T),B=D!==void 0?void 0:N[0]==="hue"?N.slice(1).join("."):P,re=new he(G.r,G.g,G.b,G.a,B);H[w]=Object.assign(re,typeof H[w]==="object"?H[w]:{})}y.hue??={},y.categorical=Object.entries(y.categorical??{}).sort(([P],[T])=>Number(P)-Number(T)).map(([,P])=>P);let b=(P)=>{if(!P||typeof P!=="object")return;if("base"in P&&"hovered"in P)P.state=(T)=>P[za.find((N)=>T?.[N])??"base"];else for(let T of Object.values(P))if(!(T instanceof he))b(T)};for(let P of[y.text,y.background])b(P?.action),b(P?.formfield);let E=Object.entries(y.hue),C=(P)=>{if(!(P instanceof he))return;for(let[T,N]of E)for(let H of xn){let w=N[H];if(w&&(w.token===P.token||w.r===P.r&&w.g===P.g&&w.b===P.b&&w.a===P.a))return{hue:T,step:H}}return},X=(P,T)=>{let N=C(P);if(!N)return P;let H=Number.isFinite(T)?Math.trunc(T):0,w=Math.max(0,Math.min(xn.length-1,xn.indexOf(N.step)+H));return y.hue[N.hue][xn[w]]};return y.source=C,y.increase=(P,T=1)=>X(P,T),y.decrease=(P,T=1)=>X(P,-T),y.surface=(P)=>{if(P==="dialog"||P==="dialog.footer")return Jo(P);if(!jo.has(P))console.warn(`plugin ${o}: theme.surface("${P}") is the page theme`);return jo.add(P),y},y},jo=new Set,Cn=new Map,Le,_e=0,Pn=`${o}.compat.press`,Ft=`${o}.compat.answer`,wn=`${o}.compat.dismiss`,kn=`${o}.compat.query`,qt;n.command({name:Pn,title:Pn},(i)=>{let[l,m]=(i??"").split("\x01"),g=Cn.get(l??"")?.get(m??""),y={type:g?.kind,button:0,modifiers:{shift:!1,alt:!1,ctrl:!1}};g?.handler({...y,stopPropagation(){},preventDefault(){}})}),n.command({name:kn,title:kn},(i)=>qt?.(i??""));let Nt=[],$o=Array.from({length:hn},(i,l)=>`${o}.compat.action.${l}`);$o.forEach((i,l)=>n.command({name:i,title:i},(m)=>Nt[l]?.(m))),n.command({name:Ft,title:Ft},(i)=>{let l=Le;Le=void 0,l?.(i??"")}),n.command({name:wn,title:wn},(i)=>{if(i===String(_e))ht()});let ht=()=>{let i=Le;Le=void 0,i?.(void 0)},Ut=(i)=>new Promise((l)=>{ht(),it(),Le=l,_e++;let m={type:"command",name:wn,input:String(_e)},g=_e,y=()=>{if(_e!==g||Le!==l)return;Bo=g;let b={...typeof i==="function"?i():i,action:{type:"command",name:Ft}};n.effect({type:"dialog",dialog:{type:"dismissable",dialog:b,dismissed:m}})};if(typeof i==="function")queueMicrotask(y);else y()}),An="compat.dialog",us=0,Ee,Tn=new Map,Se={size:"medium",centered:!1},Bo=0,Vt=()=>({...["large","xlarge"].includes(Se.size)?{size:Se.size}:{},...Se.centered?{centered:!0}:{}}),it=()=>{let i=Ee;if(Ee=void 0,!i)return;Tn.delete(i.key),i.onClose?.()},Wo=()=>{if(!Ee)return;n.effect({type:"dialog",dialog:{type:"surface",surface:An,key:Ee.key,...Vt()}})};n.cleanup?.(()=>{ht(),it()}),n.listen((i)=>{if(!Ee||i!==`dialog-open:${Ee.key}`)return;if(n.read(i)===!0)Ee.opened=!0;else if(Ee.opened)it()});let Pe=new Map,St=se(()=>Q({width:0,height:0})),zo={width:()=>_()?.size?.[0]||St[0]().width,height:()=>_()?.size?.[1]||St[0]().height,renderer:{}},ps=0,_t,Mn=!1,Gt=(i)=>{if(i!==void 0&&i===_t||Mn)return;Mn=!0,queueMicrotask(()=>{Mn=!1,n.invalidate()})},ie,Jt=new Set(["input","textarea","scrollbox"]),Ln=new WeakSet,Ho=(i)=>typeof i==="function"&&(Ln.has(i)||Function.prototype.toString.call(i).includes("preventDefault")),Ko,Xo=(i)=>{if(typeof i!=="function"||Ln.has(i))return;Ln.add(i),Ze(),Ko?.()},Yo=new Map,Ze=()=>{for(let[i,l]of Yo){let m=[...Pe.entries()].filter(([y])=>y.startsWith(`${i}\x00`)).map(([,y])=>y.root),g=Ho(ie?.props.onKeyDown)&&m.some((y)=>qo(y,ie));n.taking?.({surface:l},g)}},Qo=(i)=>{let l=le(i);for(let[m,g]of Pe){if(g.root!==l)continue;let[y,b,E]=m.split("\x00");return{surface:y,key:b,generation:Number(E)}}return},Zo={focus(i){if(ie!==i)ie?.focusChanged(!1);if(ie=i,i.focusChanged(!0),Ze(),!Jt.has(i.tag))return;let l=Qo(i);if(l)n.effect({type:"focus",node:xe(i)},l);else a(`focus() of an <${i.tag}> in no mount`)},blur(i){if(ie!==i)return;ie=void 0,i.focusChanged(!1),Ze();let l=Jt.has(i.tag)?Qo(i):void 0;if(l)n.effect({type:"blur"},l)},detached(i){if(!ie||!qo(i,ie))return;let l=ie;ie=void 0,l.focusChanged(!1),Ze()}},cs=(i,l)=>{let m=[...Pe.entries()].filter(([b])=>b.startsWith(`${i}\x00`)).map(([,b])=>b.root),g=(b)=>{let E=(C)=>xe(C)===b&&Ha.has(C.tag)?C:C.children.reduce((X,P)=>X??E(P),void 0);return m.reduce((C,X)=>C??E(X),void 0)};if(l.type==="key"){let b=ie&&g(xe(ie));if(b!==ie||!b?.props.onKeyDown)return"pass";let E=er(l),C=b.props.onKeyDown;if(C(E),!E.defaultPrevented)return"pass";return Xo(C),"consume"}let y=(l.type==="change"||l.type==="submit")&&g(l.node);if(!y)return;if(ie!==y)ie?.focusChanged(!1),ie=y,y.focusChanged(!0),Ze();if(y.typed=l.text,l.type==="change"){let b=le(y),E=y.props.onInput?.(l.text);return(b.seen??=new Map).set(l.node,l.seq),E}y.props.onChange?.(l.text),y.props.onSubmit?.(l.text)},er=(i)=>{let l=String(i.key??""),m={ctrl:!1,shift:!1,meta:!1,super:!1,hyper:!1};for(let C=/^(ctrl|shift|meta|super|hyper)\+(.+)$/.exec(l);C;C=/^(ctrl|shift|meta|super|hyper)\+(.+)$/.exec(l))m[C[1]]=!0,l=C[2];let g=l==="enter"?"return":l,y=i.text??Ka[g]??"",b=!1,E=!1;return{name:g,...m,option:m.meta,sequence:y,raw:y,number:/^[0-9]$/.test(g),eventType:"press",source:"raw",get defaultPrevented(){return b},get propagationStopped(){return E},preventDefault(){b=!0},stopPropagation(){E=!0}}},et=new $a,tr=!1;et.on("newListener",(i,l)=>{if(i!=="keypress"||tr||!n.layer)return;tr=!0;let m=n.layer({scope:"global",any:!0},(y)=>{if(y.type!=="key")return"pass";let b=er(y),E=et.listeners("keypress");if(et.emit("keypress",b),!b.defaultPrevented)return"pass";return E.forEach(Xo),"consume"});if(n.changed(),typeof m!=="number")return;let g=(y)=>{let b=[...et.listeners("keypress"),y].some(Ho);n.taking?.({layer:m},b)};Ko=()=>g(),g(l),et.on("removeListener",(y)=>{if(y==="keypress")g()}),et.on("newListener",(y,b)=>{if(y==="keypress")g(b)})});let ys=(i)=>{let l=(m)=>({type:"node",surface:i,id:xe(m)});return{state:(m)=>f(`scroll:${i}:${xe(m)}`,{type:"scroll-state",target:l(m)})??void 0,to:(m,g)=>void n.effect({type:"scroll",target:l(m),verb:{type:"offset",offset:g}}),into:(m,g)=>void n.effect({type:"scroll",target:l(m),verb:{type:"to",node:g,align:{type:"nearest"}}}),rect(m){let g=`rect:${i}:${xe(m)}`;return Fn.set(g,m),f(g,{type:"rect",node:xe(m)})??void 0}}},Fn=new Map,nr=new WeakMap;n.listen((i)=>{let l=Fn.get(i);if(!l)return;if(!l.parent)return void Fn.delete(i);let m=l.measure(),g=m&&`${m.width}x${m.height}`;if(!g||nr.get(l)===g)return;nr.set(l,g);let y=l.props.onSizeChange??l.onSizeChange;if(typeof y==="function")y.call(l)});let jt=(i,l,m,g,y)=>{let b=!1,E=(w)=>`${w.mount.surface}\x00${w.mount.key}\x00${w.mount.generation}`,C=new Map,X=(w)=>{let D=`${w.mount.surface}\x00${w.mount.key}`,G=C.get(D);if(!G)return;clearTimeout(G.timer),C.delete(D),Pe.set(E(w),G.entry);let B=ie;if(B&&G.focused===xe(B)&&Jt.has(B.tag)&&le(B)===G.entry.root)n.effect({type:"focus",node:xe(B)},w.mount);return G.entry},P=(w)=>{let D=w instanceof Error?w.message:String(w);n.effect({type:"toast",variant:"error",title:"Plugin",message:`${o} crashed in ${y}: ${D}`})},T=(w)=>{if(b)return{type:"box"};let D=_t;_t=E(w);try{return N(w)}finally{if(_t=D,l.type==="dialog"&&Pe.get(E(w))?.crashed!==void 0)xs(w.mount.key)}},N=(w)=>{if(w.input.width||w.input.height)St[1]({width:w.input.width,height:w.input.height});Qe.clear();let D=Pe.get(E(w))??X(w);if(D&&D.crashed===void 0&&JSON.stringify(D.input)!==JSON.stringify(m(w))){D.input=m(w);let O=R;R={pending:!1,keys:D.keys};try{D.setInput(D.input)}finally{R=O}}let G=(O)=>!!O&&O.pending>0&&O.pending<4&&O.crashed===void 0;if(!D||G(D)&&[...D.keys].every((O)=>u.has(O))){D?.dispose();let O=D?D.pending:0,ae=m(w),[Fe,ws]=Ct(Bt(ae)),Jn={pending:!1,keys:new Set},ks=R;R=Jn;let jn;try{let $n=()=>pe(Sn.Provider,{value:dr,get children(){return g(Fe)}}),As=E(w);jn=Eo($n,zo,()=>Gt(As),P,Zo,ys(i),(Ts)=>a(Ts))}finally{R=ks}jn.keys=Jn.keys,D=Object.assign(jn,{pending:Jn.pending?O+1:0,input:ae,setInput:($n)=>ws(Pt(Bt($n)))}),Pe.set(E(w),D)}if(G(D))return;D.root.room={width:w.input?.width??0,height:w.input?.height??0};let B=fs(E(w)),re=R;R={pending:!1,keys:D.keys};try{let O=vo(D.root,B);for(let ae of[...B.dropped,...Qe])a(ae);if(Qe.clear(),l.type==="route")O.layout={...O.layout,grow:!0};return Ze(),O}catch(O){return P(O),D.crashed=String(O),D.dispose(),D.root.children=[],{type:"box"}}finally{R=re}},H=n.surface(i,l,T,{unmount(w,D,G){if(l.type==="panel"&&!D)rr("");let B=`${w.surface}\x00${w.key}\x00${w.generation}`,re=Pe.get(B);Pe.delete(B),Cn.delete(B),Ze();let O=`${w.surface}\x00${w.key}`;if(!D&&It.get(O)?.mount.generation===w.generation)It.delete(O);if(!re||re.crashed!==void 0||!D)return re?.dispose();let ae=C.get(O);if(ae)clearTimeout(ae.timer),ae.entry.dispose();let Fe=setTimeout(()=>{if(C.get(O)?.entry!==re)return;C.delete(O),re.dispose()},Xa);C.set(O,{entry:re,timer:Fe,focused:G})},on:(w)=>cs(i,w),...["route","panel","dialog"].includes(l.type)?{layers:[{scope:"surface",any:!0}]}:{}});if(["route","panel","dialog"].includes(l.type)&&typeof H==="number")Yo.set(i,H);return()=>{b=!0,n.invalidate()}},qn=new WeakMap,ms=0,gs=(i)=>{if(!qn.has(i))qn.set(i,++ms);return qn.get(i)},fs=(i)=>{let l=new Map;return Cn.set(i,l),{dropped:new Set,press(m,g,y){let b=String(gs(m));return l.set(b,{handler:g,kind:y}),{type:"command",name:Pn,input:`${i}\x01${b}`}}}},xs=(i)=>{if(Ee?.key!==i)return;n.effect({type:"dialog",dialog:{type:"close",key:i}}),it()};jt(An,{type:"dialog",name:An},(i)=>({key:i.mount.key}),(i)=>Tn.get(i.key)?.(),"dialog");let or=(i,l="")=>(m)=>{let g=m.input.slot??{};if(i.startsWith("prompt.footer"))return{...g.session_id?{sessionID:g.session_id}:{},mode:g.prompt?.shell?"shell":"normal",showDetails:!!g.prompt?.show_details};if(i==="session.panel"){let y=m.input.panel??{};return{name:Nn(),sessionID:g.session_id??"",width:y.width??m.input.width,presentation:y.fullscreen?"fullscreen":"panel",focused:!!y.focused,...hs(l,m.mount,!!y.fullscreen).methods}}if(i.startsWith("sidebar.")||i==="session.composer.top")return{sessionID:g.session_id??""};return{}},[Nn,rr]=se(()=>Q("")),$t=[],It=new Map,hs=(i,l,m)=>{let g=`${l.surface}\x00${l.key}`,y=It.get(g);if(!y){let b=()=>{let E=It.get(g),C=E&&`${E.mount.surface}\x00${E.mount.key}\x00${E.mount.generation}`;return C&&Pe.has(C)?E:void 0};y={mount:l,fullscreen:m,methods:{focus(){let E=b(),C=E&&Pe.get(`${E.mount.surface}\x00${E.mount.key}\x00${E.mount.generation}`)?.root;if(!C)return;let X=(T)=>T.props.visible===!1?void 0:Jt.has(T.tag)?T:T.children.reduce((N,H)=>N??X(H),void 0),P=X(C);if(P)Zo.focus(P);else a("panel.focus() of a panel with no field or scroll")},close(){let E=b();if(E)n.effect({type:"close-panel",surface:i},E.mount)},toggleFullscreen(){let E=b();if(!E)return;E.fullscreen=!E.fullscreen,n.effect({type:"open-panel",surface:i,...E.fullscreen?{fullscreen:!0}:{}},E.mount)}}},It.set(g,y)}return y.mount=l,y.fullscreen=m,y},Bt=(i)=>typeof i==="function"||i===null||typeof i!=="object"?i:Array.isArray(i)?i.map(Bt):Object.fromEntries(Object.entries(i).map(([l,m])=>[l,Bt(m)])),Ge=Ja({baseUrl:"http://opencode.internal/",fetch:async(i,l)=>{let m=typeof l?.body==="string"?JSON.parse(l.body):void 0,g=await n.fetch({method:l?.method??"GET",path:i.pathname,query:[...i.searchParams],...m===void 0?{}:{body:m}});if(g&&"Ok"in g)return g.Ok===null?new Response(null,{status:204}):new Response(JSON.stringify(g.Ok),{status:200,headers:{"content-type":"application/json"}});let y=String(g?.Err??"Transport"),b=/^UnexpectedStatus: (\d+)/.exec(y)?.[1];if(y.startsWith("Transport"))throw Error(y);return new Response(JSON.stringify({_tag:"Error",message:y}),{status:b?Number(b):500,headers:{"content-type":"application/json"}})}}),Ss=Object.assign((i)=>{let l=(y,b,E)=>{if(!Object.hasOwn(i.events??{},y))throw Error(`Unknown RPC event: ${i.id}.${y}`);let C=e.data.on(`rpc.${i.id}.${y}`,b);return E?.signal?.addEventListener("abort",C),C},m=(y,b)=>({[Symbol.asyncIterator](){let E=[],C,X=l(y,(N)=>{E.push(N),C?.()}),P=!1,T=()=>{P=!0,X(),C?.()};return b?.signal?.addEventListener("abort",T),{async next(){while(!E.length&&!P)await new Promise((N)=>C=N);if(E.length)return{value:E.shift(),done:!1};return{value:void 0,done:!0}},async return(){return T(),{value:void 0,done:!0}}}}}),g=Object.keys(i.methods??{}).map((y)=>[y,async(b,E)=>(await Ge.rpc.call({rpcID:i.id,method:y,input:b,location:E?.location},{signal:E?.signal,headers:E?.headers})).output]);return{...Object.fromEntries(g),events:{on:l,subscribe:m}}},Ge.rpc),Is={...Ge,rpc:Ss},Un=new Map,Wt=[],sr=(i)=>(Un.get(i)??[]).filter((l)=>!l.retired&&l.commands.has(i)),bs=(i,l)=>{let m=sr(i);for(let g=m.length-1;g>=0;g--){let y=m[g],b=y.commands.get(i);if(!ar(y.enabled))continue;if(y.target&&!qo(y.target(),ie))continue;let E=y.mode,C=()=>f("input-mode",{type:"input-mode"})??"base";if(E!==void 0&&Wt.at(-1)!==E&&C()!==E)continue;if(!Ds(b))continue;return b.run(l)}return!1},Vn=new Map,_n=(i)=>{let l=sr(i).some((m)=>m.states.get(i)!==!1);if(Vn.get(i)===l)return;Vn.set(i,l),n.enable?.(i,l)},[Es,ir]=se(()=>Q(0));n.afterCall?.(()=>{ir((i)=>i+1),queueMicrotask(()=>ir((i)=>i+1))});let vs=(i,l,m)=>Et(()=>{Es();let g={keys:new Set};v.add(g),ue(()=>v.delete(g));let y=[i.enabled,m.enabled].filter((E)=>typeof E==="function"),b=i.enabled!==!1&&m.enabled!==!1;if(y.length){let E=R;R={pending:!1,keys:g.keys};try{let C=y.every((X)=>!!X());b=($e()?.sources?.length??0)>1?C&&b:!0}catch{b=!0}finally{R=E}}i.states.set(l,b),_n(l)}),ar=(i)=>{if(typeof i!=="function")return i!==!1;try{return!!i()}catch{return!0}},Ds=(i)=>ar(i.enabled),Rs=(i,l)=>{let m=[...i.commands.keys()];for(let g of m){let y=Un.get(g)??[];if(!y.includes(i))Un.set(g,[...y.filter((b)=>!b.retired),i])}for(let[g,y]of i.commands)vs(i,g,y);for(let[g,y]of i.commands)n.command({name:g,enabled:Vn.get(g)??!0,title:y.title??g,group:y.group,slash:y.slash?.name,...Array.isArray(y.slash?.aliases)&&y.slash.aliases.length?{aliases:y.slash.aliases.map(String)}:{},keybind:typeof y.bind==="string"?y.bind:void 0,palette:!!y.palette,description:y.description,arguments:!!(y.slash?.arguments||y.arguments),...y.hold?{hold:!0}:{},...y.scope??l?{scope:y.scope??l}:{}},(b)=>bs(g,b));return m},Os=(i,l)=>{let m=new Map;return i.map((g)=>{if(g.id)return[g.id,g];let y=[g.scope??l,g.bind,g.title,g.slash?.name,g.slash?.aliases];y.push(g.group,g.description,!!g.palette,!!g.hold,!!(g.slash?.arguments||g.arguments));let b=JSON.stringify(y.map((C)=>C??null)),E=(m.get(b)??0)+1;return m.set(b,E),[`${o}.inline-${Bun.hash(`${b}${E}`).toString(36)}`,g]})},Cs=(i)=>({type:"toast",variant:i.variant??"info",message:i.message,...i.title?{title:i.title}:{},...i.sessionID?{session:i.sessionID}:{}}),Ps={add(){},remove(){},insertBefore(){},getChildren:()=>[],requestRender:()=>Gt()},Gn=new Proxy({requestRender:()=>Gt(),keyInput:et,get root(){return a("renderer.root"),Ps},get currentFocusedEditor(){a("renderer.currentFocusedEditor");return},get currentFocusedRenderable(){a("renderer.currentFocusedRenderable");return},get width(){return _()?.size?.[0]||St[0]().width||0},get height(){return _()?.size?.[1]||St[0]().height||0}},{get(i,l){if(l in i||typeof l==="symbol")return i[l];if(a(`renderer.${String(l)}`),!Ur.includes(String(l)))return;if(Wa.has(l))return()=>Gn;return Vr.includes(String(l))?async()=>{return}:()=>{return}}});zo.renderer=Gn;let zt=new Map,dr={options:e.options??{},get location(){return Ce(_()?.location)},app:e.app,renderer:Gn,client:Is,data:ls,attention:{async notify(i){let l=typeof i.notification==="object"?i.notification:{},m=typeof i.sound==="object"?i.sound:{};return await n.effect({type:"attention",...i.title?{title:i.title}:{},message:i.message,...i.notification===!1?{}:{notify:l.when??"blurred"},...i.sound===!1?{}:{sound:{name:m.name??"default",when:m.when??"always",...m.volume===void 0?{}:{volume:m.volume}}}}),{ok:!0,notification:!!i.notification,sound:!!i.sound}}},get theme(){return Jo()},get themeMode(){return V[0](),e.themeMode},markdown:{registerCodeBlockRenderer(i,l){let m=go(i);if(!m)throw Error("Markdown code-block language is required");if(d.has(m))throw Error(`Markdown code-block renderer already registered: ${m}`);if(!n.claim)return a("markdown.registerCodeBlockRenderer"),()=>{};d.add(m);let g=n.claim({type:"fence",name:m},(y)=>r(m,l,y));return()=>{if(d.delete(m))g()}}},keymap:{layer(i){let l={retired:!1,commands:new Map,states:new Map},m=[],g=()=>{let b={keys:new Set};v.add(b),ue(()=>v.delete(b));let E=R;R={pending:!1,keys:b.keys};let C;try{C=i()}finally{R=E}l.enabled=C?.enabled;let X=typeof C?.mode==="string"&&C.mode!=="global"&&C.mode!=="base",P=C?.mode==="global"||X?void 0:"base";l.mode=X?C.mode:void 0,l.target=typeof C?.target==="function"?C.target:void 0,l.commands=new Map(Os(C?.commands??[],P));for(let N of[...l.states.keys()])if(!l.commands.has(N))l.states.delete(N);let T=Rs(l,P);for(let N of m)if(!l.commands.has(N))_n(N);m.forEach((N)=>n.uncommand(N)),m=T,n.changed()},y=nt();se((b)=>{if(Dt(g),y)pt(y,()=>ue(()=>{l.retired=!0,b(),m.forEach(_n),m.forEach((E)=>n.uncommand(E)),m=[],n.changed()}))})},dispatch(i,l){n.effect({type:"dispatch",name:i,...l===void 0?{}:{input:l}})},shortcuts:(i)=>f(`shortcuts:${i}`,{type:"shortcuts",name:i})??[],commands:()=>(f("keymap-commands",{type:"keymap-commands"})??[]).filter((i)=>!String(i.name??i.id??"").includes(".compat.")).map((i)=>({...i,slash:i.slash,run:()=>void n.effect({type:"dispatch",name:i.name??i.id})})),pending:()=>f("keymap-pending",{type:"keymap-pending"})??[],active:()=>f("keymap-active",{type:"keymap-active"})??[],mode:{current:()=>f("input-mode",{type:"input-mode"})??"base",push(i){return Wt.push(i),n.effect({type:"set-mode",mode:i}),()=>{let l=Wt.lastIndexOf(i);if(l>=0)Wt.splice(l,1);n.effect({type:"set-mode"})}}}},storage:{store(i,l){let m=zt.get(i);if(m)return m;n.effect({type:"storage-key",key:i}),n.storage([i]),n.changed();let g=()=>{let T=f(`storage:${i}`,{type:"storage-get",key:i});if(T!==null&&typeof T==="object")return T;try{return typeof T==="string"?JSON.parse(T):void 0}catch{return}},[y,b]=se(()=>Ct(structuredClone(g()??l.initial)));n.listen((T)=>{if(T!==`storage:${i}`)return;let N=k(T);if(N)return a(`store ${i}`,`${o}: the store ${i} keeps its last value: ${N}`);let H=Y(g);if(H!==void 0)b(Pt(H))});let E=Promise.resolve(),C=async(T)=>{let N=await n.effect({type:"storage-get",key:i});if(N===void 0)throw Error(`the stored value of ${i} did not come`);let H;try{H=typeof N==="string"?JSON.parse(N):structuredClone(l.initial)}catch{H=structuredClone(l.initial)}let w=(B)=>{if(B!==!0)throw Error(`${i} was not stored: ${B?.error??"no answer"}`)},D=structuredClone(H);T(D);let G=(B)=>!!B&&typeof B==="object"&&!Array.isArray(B);if(G(H)&&G(D)&&Object.keys(H).every((B)=>(B in D))){let B=Object.fromEntries(Object.entries(D).filter(([re,O])=>JSON.stringify(O)!==JSON.stringify(H[re])));if(Object.keys(B).length)w(await n.effect({type:"storage-merge",key:i,fields:B}))}else w(await n.effect({type:"storage-set",key:i,value:JSON.stringify(D)}));Ue(()=>b(Pt(D)))},P=[y,(T)=>{let N=E.then(()=>C(T));return E=N.catch(()=>{}),N}];return zt.set(i,P),P},memory(i,l){let m=zt.get(`memory:${i}`);if(m)return m;let[g,y]=se(()=>Ct(structuredClone(l.initial))),b=[g,(E)=>y(uo(E))];return zt.set(`memory:${i}`,b),b}},ui:{dialog:{show(i,l){let m=!!Le;if(ht(),it(),m)n.effect({type:"dialog",dialog:{type:"close",key:""}});Se={size:"medium",centered:!1};let g=`compat.dialog.${++us}`;Tn.set(g,i),Ee={key:g,onClose:l,opened:!1},Y(()=>f(`dialog-open:${g}`,{type:"dialog-open",key:g})),Wo()},set(i){if(Se={size:i?.size??"medium",centered:!!i?.centered},Ee)Wo();else if(Le&&Bo===_e&&(Se.size!=="medium"||Se.centered))a("dialog.set after its dialog showed")},clear(){let i=!!Le;if(ht(),Se={size:"medium",centered:!1},i)n.effect({type:"dialog",dialog:{type:"close",key:""}});if(!Ee)return;n.effect({type:"dialog",dialog:{type:"close",key:Ee.key}}),it()},alert:(i)=>(Se={size:"medium",centered:!1},Ut(()=>({type:"alert",title:i.title,message:i.message,...Vt()})).then(()=>{return})),confirm:(i)=>(Se={size:"medium",centered:!1},Ut(()=>({type:"confirm",title:i.title,message:i.message,label:{confirm:i.label?.confirm,cancel:i.label?.cancel},...Vt()})).then((l)=>l===void 0?void 0:l==="true")),prompt:(i)=>(Se={size:"medium",centered:!1},Ut(()=>{if(Se.size!=="medium"||Se.centered)a("ui.dialog.set of a prompt");return{type:"prompt",title:i.title,placeholder:i.placeholder,...i.value===void 0||i.value===null?{}:{value:String(i.value)},...i.description===void 0||i.description===null?{}:{description:String(i.description)}}})),async select(i){if((i.actions?.length??0)>hn)a(`ui.dialog.select over ${hn} actions`);let l=i.search,m=i.options.filter((O)=>!O.disabled),g=l?(l("",m)??[]).filter((O)=>!O.disabled):i.options,y=_e+1,b=new Map,E=[],C=(O)=>{if(!b.has(O))b.set(O,`${y}.${E.push(O)-1}`);return b.get(O)},X=(O)=>{let[ae,Fe]=(O??"").split(".");return ae===String(y)?E[Number(Fe)]:void 0},P=()=>g.map((O)=>({title:O.title,value:C(O),description:O.description,footer:l?O.category??O.footer:O.footer,category:l?void 0:O.category,disabled:!!O.disabled})),T=()=>{let O=g.find((ae)=>ae.value===i.current);return O===void 0?{}:{current:C(O)}},N=`search.${_e+1}`;Se={size:"medium",centered:!1};let H=(i.actions??[]).slice(0,hn),w=H.map((O)=>(ae)=>{if(_e!==y||!Le)return;if(O.selection==="none")return ae===String(y)?O.onTrigger():void 0;let Fe=X(ae);if(Fe)O.onTrigger(Fe.value)});Nt=w;let D=H.map((O,ae)=>({title:String(O.title),key:String(O.bind),action:{type:"command",name:$o[ae],...O.selection==="none"?{input:String(y)}:{}},...O.side==="left"?{primary:!0}:O.side==="right"?{primary:!1}:{},...O.selection==="none"?{rowless:!0}:{}})),G=()=>({type:"select",title:i.title,placeholder:i.placeholder,options:P(),...T(),...l?{key:N,query:{type:"command",name:kn}}:{},...D.length?{actions:D}:{},...Vt()}),B=l?(O)=>{g=(l(O,m)??[]).filter((Fe)=>!Fe.disabled);let ae={...G(),action:{type:"command",name:Ft}};n.effect({type:"dialog",dialog:ae})}:void 0;qt=B;let re=await Ut(G);if(qt===B)qt=void 0;if(Nt===w)Nt=[];if(l&&re!==void 0)n.effect({type:"dialog",dialog:{type:"close",key:N}});return X(re)?.value}},toast:{show(i){n.effect(Cs(i))}},format:{path:(i)=>{let l=Ba();return l&&(i===l||i.startsWith(l+"/"))?"~"+i.slice(l.length):i}},router:{register(i){return jt(i.name,{type:"route",name:i.name},()=>({data:te.get(i.name)}),i.render,"route")},navigate(i){let l=i.type==="session"?{type:"session",id:i.sessionID}:i.type==="plugin"?{type:"plugin",id:i.id??o,name:i.name}:{type:"home"};if(i.type==="plugin")te.set(i.name,i.data);n.effect({type:"navigate",route:l})},current:()=>ee()},panel:{open(i,l){if(ee().type!=="session"||!$t.length)return!1;return rr(i),n.effect({type:"open-panel",surface:$t[0],...l?.presentation==="fullscreen"?{fullscreen:!0}:{}}),!0},close(){for(let i of $t)n.effect({type:"close-panel",surface:i})},current:()=>Nn()?{name:Nn(),sessionID:ee().sessionID??""}:void 0},tabs:{enabled:()=>!!f("tabs-enabled",{type:"tabs-enabled"}),list:()=>(f("tabs",{type:"tabs"})??[]).map((i)=>({sessionID:i.session_id,title:i.title,active:!!i.active,busy:!!i.busy,attention:!!i.attention,...i.unread?{unread:i.unread}:{}})),open:(i)=>Ht({type:"open",session:i}),focus:(i)=>Ht({type:"focus",session:i}),move:(i,l)=>Ht({type:"move",session:i,index:l}),close:(i)=>Ht({type:"close",...i?{session:i}:{}})},model:{current(){let i=f("model",{type:"model"});return i?{providerID:i.providerID,modelID:i.id??i.modelID,variant:i.variant}:void 0},variant:{list:()=>f("variants",{type:"variants"})??[],set(i){let l=f("variants",{type:"variants"})??[];if(!f("model",{type:"model"}))return!1;if(i!==void 0&&!l.includes(i))return!1;return n.effect({type:"set-variant",...i===void 0?{}:{variant:i}}),!0}}},slot(i){let l=["prepend","append","before","after","replace"].filter((b)=>i[b]!==void 0);if(l.length!==1)throw Error("Slot claim requires exactly one placement key");let m=l[0],g=String(i[m]),y=`slot#${ps++}`;if(g==="session.panel")return $t.push(y),jt(y,{type:"panel",name:y},or(g,y),i.render,`slot ${g}`);return jt(y,{type:"slot",kind:m,path:g},or(g),i.render,`slot ${g}`)}}},Ht=(i)=>{if(!f("tabs-enabled",{type:"tabs-enabled"}))return!1;return n.effect({type:"tab",edit:i}),!0};return dr}import Uo from"path";import{realpathSync as Qa}from"fs";function Za(e,n=Uo){let o=In(e,n);try{return In(Qa.native(o),n)}catch{return n.resolve(o)}}function In(e,n=Uo){if(n.sep!=="\\")return e;if(/^\\\\\?\\UNC\\/i.test(e))return`\\\\${e.slice(8)}`;if(/^\\\\\?\\[a-z]:/i.test(e))return e.slice(4);return e}function ed(e,n,o=Uo){let a=o.relative(In(e,o),In(n,o));return a===""||!o.isAbsolute(a)&&a!==".."&&!a.startsWith(`..${o.sep}`)}function ds(e){let[n,o]=io(e,["component"]);return Z(()=>{let a=n.component;if(typeof a==="function")return Y(()=>pe(a,o));if(typeof a!=="string")return;return Y(()=>{let d=gt(a);return kt(d,o),d})})}function td(e){let n=gt("box");for(let[o,a]of Object.entries({position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:1}))At(n,o,a);return e.ref?.(n),bo(n,()=>e.children),n}var nd=ho("solid",{...Oo,...sn,createComponent:pe,mergeProps:fn,Dynamic:ds,createDynamic:(e,n)=>ds(fn(n,{get component(){return e()}})),Portal:td,RendererContext:Ve(),extend(){throw Error("extend is not supported by opencode-native's JS host")}}),od={Plugin:{define:(e)=>e},PluginContextProvider:(e)=>pe(Sn.Provider,{value:e.value,get children(){return e.children}}),usePlugin(){let e=Re(Sn);if(!e)throw Error("PluginContextProvider is missing");return e}},Bd={"solid-js":sn,"solid-js/store":po,"@opentui/solid":nd,"@opentui/solid/jsx-runtime":ft,"@opentui/solid/jsx-dev-runtime":ft,"react/jsx-runtime":ft,"react/jsx-dev-runtime":ft,"@opentui/core":ho("core",{...fo,BoxRenderable:Po,TextRenderable:wo,MarkdownRenderable:ko,CodeRenderable:Ao,ScrollBoxRenderable:To,InputRenderable:Mo}),"@opencode/plugin/tui":od,"@opencode/plugin/rpc":{Rpc:dt},"@opencode/plugin/effect":{Rpc:dt,...Object.fromEntries(["Plugin","Agent","Artifact","Command","Connection","Credential","Integration","Location","Mcp","Model","PersistentPty","Provider","Reference","Skill","Tool","Vcs","WebSearch","Worktree"].map((e)=>[e,void 0]))}};export{Ya as context,ed as inside,Bd as modules,Za as real,No as reported}; diff --git a/packages/cli-rs/crates/plugin/src/pipe/compat.test.ts b/packages/cli-rs/crates/plugin/src/pipe/compat.test.ts index 4126135d2d6..35e69108f5b 100644 --- a/packages/cli-rs/crates/plugin/src/pipe/compat.test.ts +++ b/packages/cli-rs/crates/plugin/src/pipe/compat.test.ts @@ -1673,8 +1673,12 @@ test("each dialog settles once, and clear closes it", async () => { ctx.ui.dialog.show(() => h("text", { children: "small" })) await turn() const dialogs = fake.effects.filter((effect) => effect.dialog?.type === "surface").map((effect) => effect.dialog) - // The first opened large and centered, with the `set` right after it; the next is the host's own size. - expect(dialogs.map((dialog) => [dialog.size, dialog.centered])).toEqual([["large", true], [undefined, undefined]]) + // The first opened, then the `set` right after it sized it under its key; the next is the host's own size. + expect(dialogs.map((dialog) => [dialog.key, dialog.size, dialog.centered])).toEqual([ + ["compat.dialog.1", undefined, undefined], + ["compat.dialog.1", "large", true], + ["compat.dialog.2", undefined, undefined], + ]) }) // A select's footer actions are the contract's (session-time's "Close ctrl+a"): each with its key, side and selection, diff --git a/packages/cli-rs/crates/plugin/src/pipe/compat/v2.ts b/packages/cli-rs/crates/plugin/src/pipe/compat/v2.ts index e6248d45a23..912f5360bc4 100644 --- a/packages/cli-rs/crates/plugin/src/pipe/compat/v2.ts +++ b/packages/cli-rs/crates/plugin/src/pipe/compat/v2.ts @@ -702,7 +702,7 @@ export function context(base: Base, carrier: Carrier) { // apart from the one it replaced, and the mount renders that show's JSX; a `dialog.set` changes its frame in place. const DIALOG = "compat.dialog" let shows = 0 - let shown: { key: string; onClose?: () => void; opened: boolean; sent: boolean } | undefined + let shown: { key: string; onClose?: () => void; opened: boolean } | undefined // The renders of the shows, by their key, until each closes. const dialogs = new Map unknown>() let presentation = { size: "medium", centered: false } @@ -722,7 +722,6 @@ export function context(base: Base, carrier: Carrier) { } const sendShown = () => { if (!shown) return - shown.sent = true void carrier.effect({ type: "dialog", dialog: { type: "surface", surface: DIALOG, key: shown.key, ...presented() } }) } // A dialog of the plugin's own ends with its activation, and a dialog it asked answers nothing (carbon-5). @@ -1750,20 +1749,16 @@ export function context(base: Base, carrier: Carrier) { presentation = { size: "medium", centered: false } const key = `compat.dialog.${++shows}` dialogs.set(key, render) - shown = { key, onClose, opened: false, sent: false } + shown = { key, onClose, opened: false } untrack(() => read(`dialog-open:${key}`, { type: "dialog-open", key })) - // Sent a microtask later, so a `dialog.set` right after sizes the dialog as it opens, as TS's sizes the - // dialog shown; a `show` or a `clear` before then sends nothing of this one. - queueMicrotask(() => { - if (shown?.key === key) sendShown() - }) + // Sent at once, also from a plugin's code after an `await`, which runs in no call of the host's; a `dialog.set` + // right after sends it again under its key, which the host changes in place. + sendShown() }, set(options: Json) { presentation = { size: options?.size ?? "medium", centered: !!options?.centered } - // A dialog of the plugin's own shown already changes its frame in place; one not sent yet opens so. - if (shown) { - if (shown.sent) sendShown() - } + // A dialog of the plugin's own changes its frame in place. + if (shown) sendShown() // A select's, an alert's and a confirm's size and centering are the contract's (contract 2.x, addition 4): a // `dialog.set` right after them sizes the dialog, which is built a microtask later. One after the host showed // it is not carried: the contract's dialogs are whole values, and sent again it would answer nothing. diff --git a/packages/cli-rs/crates/tui/src/plugins/host.rs b/packages/cli-rs/crates/tui/src/plugins/host.rs index 9ca148be95c..9662fe87d8f 100644 --- a/packages/cli-rs/crates/tui/src/plugins/host.rs +++ b/packages/cli-rs/crates/tui/src/plugins/host.rs @@ -201,6 +201,9 @@ impl Host for Tui { fn revoked(&self, id: &str) { super::panel::close(self, id); + // A dialog surface on screen mounts again from the registration that replaced the one that ended. + let reloaded = id.to_owned(); + self.app.defer(bind!(self, |tui, _| super::panel::remount(&tui, &reloaded))); // A reload of the plugin's registrations replaced the one that ended, which has the panel too: the panel stays // open and mounts again from the new one, as TS takes a registration without closing it (CT-29). A plugin that // failed or ended loses it. diff --git a/packages/cli-rs/crates/tui/src/plugins/panel.rs b/packages/cli-rs/crates/tui/src/plugins/panel.rs index 7c1350a0a7c..721c1010c9f 100644 --- a/packages/cli-rs/crates/tui/src/plugins/panel.rs +++ b/packages/cli-rs/crates/tui/src/plugins/panel.rs @@ -892,6 +892,21 @@ fn surface(tui: &Tui, owner: Owner, shown: abi::DialogSurface) { tui.dialogs.set_centered(centered); } +/// A reload of plugin `id`'s registrations ended the mount of its dialog surface on screen: the dialog stays and mounts +/// again from the registration that replaced it, under the same key, so the JS host adopts what it rendered, as a +/// panel does (CT-29). Its handler hears no close. +pub fn remount(tui: &Rc, id: &str) { + let Some(body) = tui.reads.surface.borrow().clone() else { return }; + if body.owner.borrow().0 != id || !open(tui, id, &body.named) || !tui.plugins.has_dialog(id, &body.surface) { + return; + } + let old = body.mount.borrow_mut().take(); + body.body.clear(); + drop(old); + let host = super::host::host(tui); + *body.mount.borrow_mut() = tui.plugins.dialog(&*host, id, &body.surface, &body.named, &body.body); +} + impl Body { /// The frame in the build `cx`: the mount the first time, the same mount in the new theme after. fn build(self: &Rc, tui: &Rc, cx: &Rc) -> View { diff --git a/packages/cli-rs/parity/deviations/F16-v2-compat-layer.md b/packages/cli-rs/parity/deviations/F16-v2-compat-layer.md index c48c08146eb..0c59146ec8e 100644 --- a/packages/cli-rs/parity/deviations/F16-v2-compat-layer.md +++ b/packages/cli-rs/parity/deviations/F16-v2-compat-layer.md @@ -124,15 +124,19 @@ four published packages P8 runs draw cell for cell as TS draws them at the check `focus-input`), as the request of the mount whose render holds it, whichever call runs: what the user types goes into it, as in TS (`P.8/file-browser`'s `typed`). A field the mount's tree does not hold yet takes the focus if the mount's next revision shows it, and the focus is dropped if that revision does not (nor does a later one apply it); - a mount that closed takes nothing. A field in no mount (in a dialog of the plugin's own, removed from its mount, or - never added) has no focus on the host, which is reported once. While the plugin's focused - field sits in a route or a panel, + a mount that closed takes nothing. A field in a dialog of the plugin's own is in that dialog's mount and takes the + focus as in TS (CT-37, `P.8/sensitive-encrypt`'s `typed`); a field in no mount (removed from its mount, or never + added) has no focus on the host, which is reported once. While the plugin's focused + field sits in a route, a panel or its dialog, each key there is its `onKeyDown`, through a listener layer of the surface, which takes it with `preventDefault` (contract gaps 2); one it does not take goes on to the host's field and keys once the JS host answered, as below. Only an `onKeyDown` that can take a key holds one for the JS host's answer (below); a field without one, or with one that only hears keys, holds none, and its typing goes to the host's field at once (cg2-1). A key it declines goes past - the plugin's own commands, which TS's keymap ran before the field's `onKeyDown`, in the state before it ran. TS's `` draws a scrollbar beside its content - and a field its placeholder in OpenTUI's color; the contract's scroll and field draw the host's (`P.8/file-browser`). + the plugin's own commands, which TS's keymap ran before the field's `onKeyDown`, in the state before it ran. A + `` draws its scrollbar while its content overflows, in OpenTUI's colors, as TS's does + (`P.8/sidebar-prompt`), and its `focused` prop gives it the host's focus, so the arrows scroll it. A field draws its + placeholder and its colors as the host's (`P.8/file-browser`), and the plugin's text without a color is the host's + white-ish text, where TS's is white (`P.8/sensitive-encrypt`'s panel). Other field events (`onPaste`, `onKeyUp` and the rest) are reported once. - **Keys** (CT-11): `renderer.keyInput` is an emitter whose `keypress` listeners hear each key as an OpenTUI key event, through one global listener layer the plugin registers with its first listener (a listener after setup reloads its @@ -157,9 +161,10 @@ four published packages P8 runs draw cell for cell as TS draws them at the check contract's (`P.8/session-manager` `rename`). A select's `actions` are the contract's footer actions, with their keys, side and selection, and the select stays open as one runs (`P.8/session-time`'s timeline); past 4 the rest are reported. `ui.dialog.show` shows the plugin's JSX - in the host's panel dialog, bare (only the dialog's frame, as TS's), in the size and place `ui.dialog.set` gives, and - a render that throws closes it. A panel's body is a render tree (`RenderNode`): a `` in it is a box that does not - scroll (the scroll keys say so, once), an `` in it is its text, and its colors take the dialog's surface. + as the body of the host's dialog (contract ergonomics 2.7): a mount of the plugin's dialog surface, with only the + dialog's frame around it, as TS's, in the size and place `ui.dialog.set` gives, which changes it in place. Its + `` scrolls and its `` is a field (`P.8/sidebar-prompt`, `P.8/sensitive-encrypt`); a reload of the + plugin's registrations mounts it again and keeps it open, and a render that throws closes it. - **Pointer**: `onMouseDown`, `onMouseUp` and `onClick` on a box or a text run as a click of the node, with an event that has its kind and the left button but no position; a node with both a press and a release handler keeps the press (reported). `onMouseOver`, `onMouseOut`, `onMouseScroll` and `onMouseDrag` are not mapped. diff --git a/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt.app.json b/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt.app.json new file mode 100644 index 00000000000..5c7e8b1b4f8 --- /dev/null +++ b/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt.app.json @@ -0,0 +1,72 @@ +{ + "scenario": "P.8/sensitive-encrypt", + "width": 140, + "height": 34, + "directory": "/tmp/opencode/packages/tui", + "config": { + "experimental": {"new-designs":true}, + "plugins": ["./out/npm/node_modules/@max10240/opencode-plugin-sensitive-encrypt"], + "animations": false + }, + "args": { + "sessionID": "ses_e" + }, + "env": { + "OPENCODE_PARITY_PLUGIN": "npm" + }, + "routes": [ + {"path":"/api/session/ses_e","json":{"data":{"id":"ses_e","title":"Secrets","projectID":"proj_test","cost":0,"tokens":{"input":0,"output":0,"reasoning":0,"cache":{"read":0,"write":0}},"time":{"created":2,"updated":2},"location":{"directory":"/tmp/opencode/packages/tui"}}}}, + {"path":"/api/session","json":{"data":[{"id":"ses_e","title":"Secrets","projectID":"proj_test","cost":0,"tokens":{"input":0,"output":0,"reasoning":0,"cache":{"read":0,"write":0}},"time":{"created":2,"updated":2},"location":{"directory":"/tmp/opencode/packages/tui"}}],"cursor":{}}}, + {"path":"/api/session/ses_e/message","json":{"data":[{"id":"msg_2","type":"assistant","agent":"build","model":{"providerID":"provider","id":"model"},"content":[{"type":"text","text":"Done."}],"finish":"stop","time":{"created":2000,"completed":2001}},{"id":"msg_1","type":"user","text":"Hide it","time":{"created":1000}}],"cursor":{}}}, + {"path":"/api/session/ses_e/inbox","json":{"data":[]}}, + {"method":"POST","path":"/api/rpc/max10240.sensitive-encrypt/keys","json":{"output":{"keys":[{"role":"encrypt","keyID":"key-0001"}],"defaultRole":"encrypt"}}} + ], + "steps": [ + {"checkpoint":"session","until":"Hide it","fixture":"P.8/sensitive-encrypt/session"}, + {"type":"/encrypt-sensitive"}, + {"checkpoint":"slash","until":"configured public key","fixture":"P.8/sensitive-encrypt/slash"}, + {"keys":["enter"]}, + {"checkpoint":"panel","until":"ctrl+t switch","deviation":[{"file":"F16-v2-compat-layer","cells":900,"styleOnly":true}],"fixture":"P.8/sensitive-encrypt/panel"}, + {"wait":300}, + {"type":"hunter2"}, + {"checkpoint":"typed","until":"hunter2","deviation":[{"file":"F16-v2-compat-layer","cells":900,"styleOnly":true}],"fixture":"P.8/sensitive-encrypt/typed"}, + {"keys":["escape"]}, + {"checkpoint":"closed","until":"Hide it","fixture":"P.8/sensitive-encrypt/closed"} + ], + "deviation": "F16-v2-compat-layer", + "requests": { + "writes": [ + {"method":"POST","path":"/api/rpc/max10240.sensitive-encrypt/keys","query":{"location[directory]":["/tmp/opencode/packages/tui"],"location[project][canonical]":["/tmp/opencode"],"location[project][directory]":["/tmp/opencode"],"location[project][id]":["proj_test"]},"body":{"input":{}},"status":200,"json":{"output":{"keys":[{"role":"encrypt","keyID":"key-0001"}],"defaultRole":"encrypt"}}} + ], + "reads": [ + {"method":"GET","path":"/api/agent","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}}, + {"method":"GET","path":"/api/command","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}}, + {"method":"GET","path":"/api/config","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":[]}, + {"method":"GET","path":"/api/experimental/migration/v1","query":{},"status":200,"json":{"status":"completed"}}, + {"method":"GET","path":"/api/experimental/session/ses_e/terminal","query":{},"status":200,"json":{"data":[]}}, + {"method":"GET","path":"/api/form","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode"}},"data":[]}}, + {"method":"GET","path":"/api/fs/list","query":{"location[directory]":[""]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}}, + {"method":"GET","path":"/api/info","query":{},"status":200,"json":{"version":"test","pid":0,"urls":[],"paths":{"tmp":"/tmp"},"capabilities":{"persistentPty":true}}}, + {"method":"GET","path":"/api/integration","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}}, + {"method":"GET","path":"/api/location","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}}}, + {"method":"GET","path":"/api/mcp","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}}, + {"method":"GET","path":"/api/mcp/resource","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":{"resources":[],"templates":[]}}}, + {"method":"GET","path":"/api/model","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}}, + {"method":"GET","path":"/api/plugin","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}}, + {"method":"GET","path":"/api/project","query":{},"status":200,"json":[]}, + {"method":"GET","path":"/api/provider","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}}, + {"method":"GET","path":"/api/reference","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode/packages/tui","canonical":"/tmp/opencode/packages/tui"}},"data":[]}}, + {"method":"GET","path":"/api/session","query":{"limit":["200"],"order":["desc"],"parentID":["ses_e"]},"status":200,"json":{"data":[{"id":"ses_e","title":"Secrets","projectID":"proj_test","cost":0,"tokens":{"input":0,"output":0,"reasoning":0,"cache":{"read":0,"write":0}},"time":{"created":2,"updated":2},"location":{"directory":"/tmp/opencode/packages/tui"}}],"cursor":{}}}, + {"method":"GET","path":"/api/session/active","query":{},"status":200,"json":{"data":{}}}, + {"method":"GET","path":"/api/session/ses_e","query":{},"status":200,"json":{"data":{"id":"ses_e","title":"Secrets","projectID":"proj_test","cost":0,"tokens":{"input":0,"output":0,"reasoning":0,"cache":{"read":0,"write":0}},"time":{"created":2,"updated":2},"location":{"directory":"/tmp/opencode/packages/tui"}}}}, + {"method":"GET","path":"/api/session/ses_e/form","query":{},"status":200,"json":{"data":[]}}, + {"method":"GET","path":"/api/session/ses_e/inbox","query":{},"status":200,"json":{"data":[]}}, + {"method":"GET","path":"/api/session/ses_e/message","query":{"limit":["20"],"order":["desc"]},"status":200,"json":{"data":[{"id":"msg_2","type":"assistant","agent":"build","model":{"providerID":"provider","id":"model"},"content":[{"type":"text","text":"Done."}],"finish":"stop","time":{"created":2000,"completed":2001}},{"id":"msg_1","type":"user","text":"Hide it","time":{"created":1000}}],"cursor":{}}}, + {"method":"GET","path":"/api/session/ses_e/permission","query":{},"status":200,"json":{"data":[]}}, + {"method":"GET","path":"/api/shell","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}}, + {"method":"GET","path":"/api/skill","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}}, + {"method":"GET","path":"/api/vcs","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":{"branch":{"current":"main","default":"main"}}}}, + {"method":"POST","path":"/api/rpc/opencode.goal/get","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"body":{"input":{"sessionID":"ses_e"}},"status":200,"json":{"output":null}} + ] + } +} diff --git a/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt/closed.json b/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt/closed.json new file mode 100644 index 00000000000..042c48d67a9 --- /dev/null +++ b/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt/closed.json @@ -0,0 +1,36 @@ +{"width":140,"height":34,"styles":["#ffffffff #1e1e1eff 0","#eeeeeeff #1e1e1eff 1","#808080ff #0a0a0aff 0","#ffffffff #0a0a0aff 0","#ffffffff #141414ff 0","#3c70b8ff #141414ff 0","#eeeeeeff #141414ff 1","#eeeeeeff #141414ff 0","#eeeeeeff #0a0a0aff 0","#3c70b8ff #0a0a0aff 0","#eeeeeeff #1e1e1eff 0","#808080ff #1e1e1eff 0","#484848ff #0a0a0aff 0","#1e1e1eff #0a0a0aff 0","#808080ff #141414ff 0"],"lines":[ +[" Secrets + ",[[0,3],[1,7],[0,22],[2,3],[3,105]]], +[" ",[[3,98],[4,42]]], +[" ┃ Secrets ",[[3,2],[5,1],[4,93],[3,2],[4,2],[6,7],[4,33]]], +[" ┃ Hide it ",[[3,2],[5,1],[4,2],[7,7],[4,84],[3,2],[4,42]]], +[" ┃ ",[[3,2],[5,1],[4,93],[3,2],[4,42]]], +[" ",[[3,98],[4,42]]], +[" Done. ",[[3,5],[8,5],[3,88],[4,42]]], +[" ",[[3,98],[4,42]]], +[" Build · provider/model · 1.0s ",[[3,5],[9,5],[2,24],[3,64],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,2],[0,38],[4,2]]], +[" ⬖ Getting started ✕ ",[[3,98],[4,2],[0,2],[10,1],[0,1],[1,15],[0,16],[11,1],[0,2],[4,2]]], +[" ",[[3,98],[4,2],[0,38],[4,2]]], +[" OpenCode includes free models so ",[[3,98],[4,2],[0,4],[11,32],[0,2],[4,2]]], +[" you can start immediately. ",[[3,98],[4,2],[0,4],[11,26],[0,8],[4,2]]], +[" ",[[3,98],[4,2],[0,38],[4,2]]], +[" Connect from 75+ providers to ",[[3,98],[4,2],[0,4],[11,30],[0,4],[4,2]]], +[" use other models, including ",[[3,98],[4,2],[0,4],[11,28],[0,6],[4,2]]], +[" ┃ Claude, GPT, Gemini etc ",[[3,2],[12,1],[0,93],[3,2],[4,2],[0,4],[11,23],[0,11],[4,2]]], +[" ┃ ",[[3,2],[12,1],[0,93],[3,2],[4,2],[0,38],[4,2]]], +[" ┃ Connect provider /connect ",[[3,2],[12,1],[0,93],[3,2],[4,2],[0,4],[10,16],[0,8],[11,8],[0,2],[4,2]]], +[" ┃ ",[[3,2],[12,1],[0,93],[3,2],[4,2],[0,38],[4,2]]], +[" ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ",[[3,2],[12,1],[13,93],[3,2],[4,42]]], +[" /tmp/opencode/packages/tui:main shift+tab agents ctrl+p commands /tmp/opencode/packages/tui:main ",[[3,2],[2,31],[3,30],[8,10],[2,6],[3,2],[8,7],[2,8],[3,2],[4,2],[14,31],[4,9]]], +[" ",[[3,98],[4,42]]] +]} diff --git a/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt/panel.json b/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt/panel.json new file mode 100644 index 00000000000..df841e4f865 --- /dev/null +++ b/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt/panel.json @@ -0,0 +1,36 @@ +{"width":140,"height":34,"styles":["#ffffffff #0c0c0cff 0","#626262ff #0c0c0cff 1","#ffffffff #040404ff 0","#353535ff #040404ff 0","#ffffffff #080808ff 0","#192e4cff #080808ff 0","#626262ff #080808ff 1","#626262ff #080808ff 0","#626262ff #040404ff 0","#192e4cff #040404ff 0","#ffffffff #141414ff 0","#ffffffff #141414ff 1","#666666ff #141414ff 0","#353535ff #0c0c0cff 0","#1e1e1eff #040404ff 0","#626262ff #0c0c0cff 0","#0c0c0cff #040404ff 0","#353535ff #080808ff 0"],"lines":[ +[" Secrets + ",[[0,3],[1,7],[0,22],[2,1],[3,1],[2,106]]], +[" ",[[2,98],[4,42]]], +[" ┃ Secrets ",[[2,2],[5,1],[4,93],[2,2],[4,2],[6,7],[4,33]]], +[" ┃ Hide it ",[[2,2],[5,1],[4,2],[7,4],[4,1],[7,2],[4,84],[2,2],[4,42]]], +[" ┃ ",[[2,2],[5,1],[4,93],[2,2],[4,42]]], +[" ",[[2,98],[4,42]]], +[" Done. ",[[2,5],[8,5],[2,88],[4,42]]], +[" ",[[2,98],[4,42]]], +[" Build · provider/mode ",[[2,5],[9,5],[2,1],[3,1],[2,1],[3,13],[10,88],[4,26]]], +[" Encrypt sensitive data esc close ",[[2,26],[10,2],[11,22],[10,64],[4,26]]], +[" ",[[2,26],[10,88],[4,26]]], +[" [Text] File ctrl+t switch ",[[2,26],[10,88],[4,26]]], +[" ",[[2,26],[10,88],[4,26]]], +[" Type any text to encrypt… ",[[2,26],[10,2],[12,25],[10,61],[4,26]]], +[" ",[[2,26],[10,88],[4,26]]], +[" ",[[2,26],[10,88],[4,26]]], +[" ",[[2,26],[10,88],[4,26]]], +[" ",[[2,26],[10,88],[4,26]]], +[" ",[[2,26],[10,88],[4,26]]], +[" ",[[2,26],[10,88],[0,24],[4,2]]], +[" arted ✕ ",[[2,26],[10,88],[1,5],[0,16],[13,1],[0,2],[4,2]]], +[" ",[[2,26],[10,88],[0,24],[4,2]]], +[" Ciphertext output (optional, under $TMPDIR) ncludes free models so ",[[2,26],[10,2],[12,43],[10,43],[13,7],[0,1],[13,4],[0,1],[13,6],[0,1],[13,2],[0,2],[4,2]]], +[" art immediately. ",[[2,26],[10,88],[13,3],[0,1],[13,12],[0,8],[4,2]]], +[" Key: Encrypt (key-0001…) ",[[2,26],[10,88],[0,24],[4,2]]], +[" om 75+ providers to ",[[2,26],[10,88],[13,2],[0,1],[13,3],[0,1],[13,9],[0,1],[13,2],[0,5],[4,2]]], +[" f2 encrypt · ctrl+t text/file · tab output/key · esc close models, including ",[[2,26],[10,88],[13,7],[0,1],[13,9],[0,7],[4,2]]], +[" ┃ Claude, GPT, Gemini etc ",[[2,2],[14,1],[0,93],[2,2],[4,2],[0,4],[13,7],[0,1],[13,4],[0,1],[13,6],[0,1],[13,3],[0,11],[4,2]]], +[" ┃ ",[[2,2],[14,1],[0,93],[2,2],[4,2],[0,38],[4,2]]], +[" ┃ Connect provider /connect ",[[2,2],[14,1],[0,93],[2,2],[4,2],[0,4],[15,7],[0,1],[15,8],[0,8],[13,8],[0,2],[4,2]]], +[" ┃ ",[[2,2],[14,1],[0,93],[2,2],[4,2],[0,38],[4,2]]], +[" ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ",[[2,2],[14,1],[16,93],[2,2],[4,42]]], +[" /tmp/opencode/packages/tui:main shift+tab agents ctrl+p commands /tmp/opencode/packages/tui:main ",[[2,2],[3,31],[2,30],[8,9],[2,1],[3,6],[2,2],[8,6],[2,1],[3,8],[2,2],[4,2],[17,31],[4,9]]], +[" ",[[2,98],[4,42]]] +]} diff --git a/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt/session.json b/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt/session.json new file mode 100644 index 00000000000..042c48d67a9 --- /dev/null +++ b/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt/session.json @@ -0,0 +1,36 @@ +{"width":140,"height":34,"styles":["#ffffffff #1e1e1eff 0","#eeeeeeff #1e1e1eff 1","#808080ff #0a0a0aff 0","#ffffffff #0a0a0aff 0","#ffffffff #141414ff 0","#3c70b8ff #141414ff 0","#eeeeeeff #141414ff 1","#eeeeeeff #141414ff 0","#eeeeeeff #0a0a0aff 0","#3c70b8ff #0a0a0aff 0","#eeeeeeff #1e1e1eff 0","#808080ff #1e1e1eff 0","#484848ff #0a0a0aff 0","#1e1e1eff #0a0a0aff 0","#808080ff #141414ff 0"],"lines":[ +[" Secrets + ",[[0,3],[1,7],[0,22],[2,3],[3,105]]], +[" ",[[3,98],[4,42]]], +[" ┃ Secrets ",[[3,2],[5,1],[4,93],[3,2],[4,2],[6,7],[4,33]]], +[" ┃ Hide it ",[[3,2],[5,1],[4,2],[7,7],[4,84],[3,2],[4,42]]], +[" ┃ ",[[3,2],[5,1],[4,93],[3,2],[4,42]]], +[" ",[[3,98],[4,42]]], +[" Done. ",[[3,5],[8,5],[3,88],[4,42]]], +[" ",[[3,98],[4,42]]], +[" Build · provider/model · 1.0s ",[[3,5],[9,5],[2,24],[3,64],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,2],[0,38],[4,2]]], +[" ⬖ Getting started ✕ ",[[3,98],[4,2],[0,2],[10,1],[0,1],[1,15],[0,16],[11,1],[0,2],[4,2]]], +[" ",[[3,98],[4,2],[0,38],[4,2]]], +[" OpenCode includes free models so ",[[3,98],[4,2],[0,4],[11,32],[0,2],[4,2]]], +[" you can start immediately. ",[[3,98],[4,2],[0,4],[11,26],[0,8],[4,2]]], +[" ",[[3,98],[4,2],[0,38],[4,2]]], +[" Connect from 75+ providers to ",[[3,98],[4,2],[0,4],[11,30],[0,4],[4,2]]], +[" use other models, including ",[[3,98],[4,2],[0,4],[11,28],[0,6],[4,2]]], +[" ┃ Claude, GPT, Gemini etc ",[[3,2],[12,1],[0,93],[3,2],[4,2],[0,4],[11,23],[0,11],[4,2]]], +[" ┃ ",[[3,2],[12,1],[0,93],[3,2],[4,2],[0,38],[4,2]]], +[" ┃ Connect provider /connect ",[[3,2],[12,1],[0,93],[3,2],[4,2],[0,4],[10,16],[0,8],[11,8],[0,2],[4,2]]], +[" ┃ ",[[3,2],[12,1],[0,93],[3,2],[4,2],[0,38],[4,2]]], +[" ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ",[[3,2],[12,1],[13,93],[3,2],[4,42]]], +[" /tmp/opencode/packages/tui:main shift+tab agents ctrl+p commands /tmp/opencode/packages/tui:main ",[[3,2],[2,31],[3,30],[8,10],[2,6],[3,2],[8,7],[2,8],[3,2],[4,2],[14,31],[4,9]]], +[" ",[[3,98],[4,42]]] +]} diff --git a/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt/slash.json b/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt/slash.json new file mode 100644 index 00000000000..8fd4b166b7a --- /dev/null +++ b/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt/slash.json @@ -0,0 +1,36 @@ +{"width":140,"height":34,"styles":["#ffffffff #1e1e1eff 0","#eeeeeeff #1e1e1eff 1","#808080ff #0a0a0aff 0","#ffffffff #0a0a0aff 0","#ffffffff #141414ff 0","#3c70b8ff #141414ff 0","#eeeeeeff #141414ff 1","#eeeeeeff #141414ff 0","#eeeeeeff #0a0a0aff 0","#3c70b8ff #0a0a0aff 0","#eeeeeeff #1e1e1eff 0","#808080ff #1e1e1eff 0","#fab283ff #0a0a0aff 0","#ffffffff #fab283ff 0","#0a0a0aff #fab283ff 0","#484848ff #0a0a0aff 0","#1e1e1eff #0a0a0aff 0","#808080ff #141414ff 0"],"lines":[ +[" Secrets + ",[[0,3],[1,7],[0,22],[2,3],[3,105]]], +[" ",[[3,98],[4,42]]], +[" ┃ Secrets ",[[3,2],[5,1],[4,93],[3,2],[4,2],[6,7],[4,33]]], +[" ┃ Hide it ",[[3,2],[5,1],[4,2],[7,7],[4,84],[3,2],[4,42]]], +[" ┃ ",[[3,2],[5,1],[4,93],[3,2],[4,42]]], +[" ",[[3,98],[4,42]]], +[" Done. ",[[3,5],[8,5],[3,88],[4,42]]], +[" ",[[3,98],[4,42]]], +[" Build · provider/model · 1.0s ",[[3,5],[9,5],[2,24],[3,64],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,42]]], +[" ",[[3,98],[4,2],[0,38],[4,2]]], +[" ⬖ Getting started ✕ ",[[3,98],[4,2],[0,2],[10,1],[0,1],[1,15],[0,16],[11,1],[0,2],[4,2]]], +[" ",[[3,98],[4,2],[0,38],[4,2]]], +[" OpenCode includes free models so ",[[3,98],[4,2],[0,4],[11,32],[0,2],[4,2]]], +[" you can start immediately. ",[[3,98],[4,2],[0,4],[11,26],[0,8],[4,2]]], +[" ",[[3,98],[4,2],[0,38],[4,2]]], +[" Connect from 75+ providers to ",[[3,98],[4,2],[0,4],[11,30],[0,4],[4,2]]], +[" ┃ /encrypt-sensitive Encrypt in-memory text or a file with the configured public key ┃ use other models, including ",[[3,2],[12,1],[13,1],[14,84],[13,7],[15,1],[3,2],[4,2],[0,4],[11,28],[0,6],[4,2]]], +[" ┃ Claude, GPT, Gemini etc ",[[3,2],[15,1],[0,93],[3,2],[4,2],[0,4],[11,23],[0,11],[4,2]]], +[" ┃ /encrypt-sensitive ",[[3,2],[15,1],[0,2],[10,18],[0,73],[3,2],[4,2],[0,38],[4,2]]], +[" ┃ Connect provider /connect ",[[3,2],[15,1],[0,93],[3,2],[4,2],[0,4],[10,16],[0,8],[11,8],[0,2],[4,2]]], +[" ┃ ",[[3,2],[15,1],[0,93],[3,2],[4,2],[0,38],[4,2]]], +[" ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ",[[3,2],[15,1],[16,93],[3,2],[4,42]]], +[" /tmp/opencode/packages/tui:main shift+tab agents ctrl+p commands /tmp/opencode/packages/tui:main ",[[3,2],[2,31],[3,30],[8,10],[2,6],[3,2],[8,7],[2,8],[3,2],[4,2],[17,31],[4,9]]], +[" ",[[3,98],[4,42]]] +]} diff --git a/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt/typed.json b/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt/typed.json new file mode 100644 index 00000000000..ecf213e6100 --- /dev/null +++ b/packages/cli-rs/parity/fixtures/P.8/sensitive-encrypt/typed.json @@ -0,0 +1,36 @@ +{"width":140,"height":34,"styles":["#ffffffff #0c0c0cff 0","#626262ff #0c0c0cff 1","#ffffffff #040404ff 0","#353535ff #040404ff 0","#ffffffff #080808ff 0","#192e4cff #080808ff 0","#626262ff #080808ff 1","#626262ff #080808ff 0","#626262ff #040404ff 0","#192e4cff #040404ff 0","#ffffffff #141414ff 0","#ffffffff #141414ff 1","#353535ff #0c0c0cff 0","#666666ff #141414ff 0","#1e1e1eff #040404ff 0","#626262ff #0c0c0cff 0","#0c0c0cff #040404ff 0","#353535ff #080808ff 0"],"lines":[ +[" Secrets + ",[[0,3],[1,7],[0,22],[2,1],[3,1],[2,106]]], +[" ",[[2,98],[4,42]]], +[" ┃ Secrets ",[[2,2],[5,1],[4,93],[2,2],[4,2],[6,7],[4,33]]], +[" ┃ Hide it ",[[2,2],[5,1],[4,2],[7,4],[4,1],[7,2],[4,84],[2,2],[4,42]]], +[" ┃ ",[[2,2],[5,1],[4,93],[2,2],[4,42]]], +[" ",[[2,98],[4,42]]], +[" Done. ",[[2,5],[8,5],[2,88],[4,42]]], +[" ",[[2,98],[4,42]]], +[" Build · provider/mode ",[[2,5],[9,5],[2,1],[3,1],[2,1],[3,13],[10,88],[4,26]]], +[" Encrypt sensitive data esc close ",[[2,26],[10,2],[11,22],[10,64],[4,26]]], +[" ",[[2,26],[10,88],[4,26]]], +[" [Text] File ctrl+t switch ",[[2,26],[10,88],[4,26]]], +[" ",[[2,26],[10,88],[4,26]]], +[" hunter2 ",[[2,26],[10,88],[4,26]]], +[" ",[[2,26],[10,88],[4,26]]], +[" ",[[2,26],[10,88],[4,26]]], +[" ",[[2,26],[10,88],[4,26]]], +[" ",[[2,26],[10,88],[4,26]]], +[" ",[[2,26],[10,88],[4,26]]], +[" ",[[2,26],[10,88],[0,24],[4,2]]], +[" arted ✕ ",[[2,26],[10,88],[1,5],[0,16],[12,1],[0,2],[4,2]]], +[" ",[[2,26],[10,88],[0,24],[4,2]]], +[" Ciphertext output (optional, under $TMPDIR) ncludes free models so ",[[2,26],[10,2],[13,43],[10,43],[12,7],[0,1],[12,4],[0,1],[12,6],[0,1],[12,2],[0,2],[4,2]]], +[" art immediately. ",[[2,26],[10,88],[12,3],[0,1],[12,12],[0,8],[4,2]]], +[" Key: Encrypt (key-0001…) ",[[2,26],[10,88],[0,24],[4,2]]], +[" om 75+ providers to ",[[2,26],[10,88],[12,2],[0,1],[12,3],[0,1],[12,9],[0,1],[12,2],[0,5],[4,2]]], +[" f2 encrypt · ctrl+t text/file · tab output/key · esc close models, including ",[[2,26],[10,88],[12,7],[0,1],[12,9],[0,7],[4,2]]], +[" ┃ Claude, GPT, Gemini etc ",[[2,2],[14,1],[0,93],[2,2],[4,2],[0,4],[12,7],[0,1],[12,4],[0,1],[12,6],[0,1],[12,3],[0,11],[4,2]]], +[" ┃ ",[[2,2],[14,1],[0,93],[2,2],[4,2],[0,38],[4,2]]], +[" ┃ Connect provider /connect ",[[2,2],[14,1],[0,93],[2,2],[4,2],[0,4],[15,7],[0,1],[15,8],[0,8],[12,8],[0,2],[4,2]]], +[" ┃ ",[[2,2],[14,1],[0,93],[2,2],[4,2],[0,38],[4,2]]], +[" ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ",[[2,2],[14,1],[16,93],[2,2],[4,42]]], +[" /tmp/opencode/packages/tui:main shift+tab agents ctrl+p commands /tmp/opencode/packages/tui:main ",[[2,2],[3,31],[2,30],[8,9],[2,1],[3,6],[2,2],[8,6],[2,1],[3,8],[2,2],[4,2],[17,31],[4,9]]], +[" ",[[2,98],[4,42]]] +]} diff --git a/packages/cli-rs/parity/plugins/npm/@max10240__opencode-plugin-sensitive-encrypt.tgz b/packages/cli-rs/parity/plugins/npm/@max10240__opencode-plugin-sensitive-encrypt.tgz new file mode 100644 index 00000000000..3970c1249ad Binary files /dev/null and b/packages/cli-rs/parity/plugins/npm/@max10240__opencode-plugin-sensitive-encrypt.tgz differ diff --git a/packages/cli-rs/parity/plugins/npm/README.md b/packages/cli-rs/parity/plugins/npm/README.md index b11df47e061..d27f0c83e42 100644 --- a/packages/cli-rs/parity/plugins/npm/README.md +++ b/packages/cli-rs/parity/plugins/npm/README.md @@ -36,6 +36,7 @@ host through the V2 compatibility layer. Before a scenario runs, each side unpac | `@prevalentware__opencode-goal-plugin.tgz` | `@prevalentware/opencode-goal-plugin@0.1.98` (ports-trio) | `sha512-XjpdkZYOo4RHYgLOC6OW6mod4j5BtO6I0YATgpwDJATx+p9+Dvj/Mam6/DS/X1SjNPYt8Sk5/9lQG/EFCHmFgQ==` | | `opencode-session-time.tgz` | `opencode-session-time@0.4.0` (contract 2.x, addition 4) | `sha512-3dqk6Ok8TkvyMkN1qh8MMsw47v+XsNv20cdbaMtzc1OMZHKi5sMHp5NQuAGRviKU5pULEKz3iqCYXYX5U8bP2w==` | | `opencode-good-fences.tgz` | `opencode-good-fences@0.1.0` (contract 2.x, addition 3) | `sha512-JgzWS0Fsx3WeFvQQC8v7ohjvkgB0T2U35yx96HoihfECEozv79ROjPZdhSWzWC5qaqoplXk5/lI1/kIsLQDvZA==` | +| `@max10240__opencode-plugin-sensitive-encrypt.tgz` | `@max10240/opencode-plugin-sensitive-encrypt@1.0.31` (catalog CT-37) | `sha512-mPYwVvaZ7aBpzjkcr4BZ9KNCcLJr6gkB267UOUqtDZNaPSKtjLQKmC9UGfp9Lvq8/kGebcmolE+xow1SbF8WWA==` | `integrity.json` pins the same digests; TS's recorder (`parity/app/scenarios.test.tsx`) and the Rust rows (`crates/tui/tests/all/{app,plugin_published}.rs`) refuse a tarball whose SHA-512 is not its pin before they unpack it. diff --git a/packages/cli-rs/parity/plugins/npm/integrity.json b/packages/cli-rs/parity/plugins/npm/integrity.json index 45741685119..ab18a10a855 100644 --- a/packages/cli-rs/parity/plugins/npm/integrity.json +++ b/packages/cli-rs/parity/plugins/npm/integrity.json @@ -26,5 +26,6 @@ "@bybrawe__opencode-queue-manager.tgz": "sha512-rrRhrULk2R35EU4hpklzLfXxC0TA6SPPWGVfmDAcftjVF2TIsqpEswgEaW051+Z3X0n+9zzUYWsATbT6Lijj4w==", "@prevalentware__opencode-goal-plugin.tgz": "sha512-XjpdkZYOo4RHYgLOC6OW6mod4j5BtO6I0YATgpwDJATx+p9+Dvj/Mam6/DS/X1SjNPYt8Sk5/9lQG/EFCHmFgQ==", "opencode-session-time.tgz": "sha512-3dqk6Ok8TkvyMkN1qh8MMsw47v+XsNv20cdbaMtzc1OMZHKi5sMHp5NQuAGRviKU5pULEKz3iqCYXYX5U8bP2w==", - "opencode-good-fences.tgz": "sha512-JgzWS0Fsx3WeFvQQC8v7ohjvkgB0T2U35yx96HoihfECEozv79ROjPZdhSWzWC5qaqoplXk5/lI1/kIsLQDvZA==" + "opencode-good-fences.tgz": "sha512-JgzWS0Fsx3WeFvQQC8v7ohjvkgB0T2U35yx96HoihfECEozv79ROjPZdhSWzWC5qaqoplXk5/lI1/kIsLQDvZA==", + "@max10240__opencode-plugin-sensitive-encrypt.tgz": "sha512-mPYwVvaZ7aBpzjkcr4BZ9KNCcLJr6gkB267UOUqtDZNaPSKtjLQKmC9UGfp9Lvq8/kGebcmolE+xow1SbF8WWA==" } diff --git a/packages/cli-rs/parity/scenarios/P.8/sensitive-encrypt.app.ts b/packages/cli-rs/parity/scenarios/P.8/sensitive-encrypt.app.ts new file mode 100644 index 00000000000..aaf98ae712a --- /dev/null +++ b/packages/cli-rs/parity/scenarios/P.8/sensitive-encrypt.app.ts @@ -0,0 +1,52 @@ +// CT-37: `@max10240/opencode-plugin-sensitive-encrypt@1.0.31`, unmodified from npm: `/encrypt-sensitive` asks its +// server part for the keys, then shows a panel of its own (`ui.dialog.show`) whose text field takes the focus, so what +// the user types is the field's. The field was in no mount, so it took no focus and the typing was lost; the dialog's +// body is now a mount (contract ergonomics 2.7). TS loads the package from node_modules; the Rust client runs the +// same files on the JS host through the V2 compatibility layer. Its server part is not running: the scenario answers +// its `keys`. +import { assistant, defineApp, session, user } from "../../lib/app" + +const id = "ses_e" +const colors = [{ file: "F16-v2-compat-layer", cells: 900, styleOnly: true }] + +export default defineApp({ + width: 140, + height: 34, + config: { + experimental: { "new-designs": true }, + plugins: ["./out/npm/node_modules/@max10240/opencode-plugin-sensitive-encrypt"], + }, + env: { OPENCODE_PARITY_PLUGIN: "npm" }, + args: { sessionID: id }, + routes: [ + { path: `/api/session/${id}`, json: { data: session(id, "Secrets", { updated: 2 }) } }, + { path: "/api/session", json: { data: [session(id, "Secrets", { updated: 2 })], cursor: {} } }, + { + path: `/api/session/${id}/message`, + json: { data: [assistant("msg_2", "Done.", 2000), user("msg_1", "Hide it", 1000)], cursor: {} }, + }, + { path: `/api/session/${id}/inbox`, json: { data: [] } }, + { + method: "POST", + path: "/api/rpc/max10240.sensitive-encrypt/keys", + json: { output: { keys: [{ role: "encrypt", keyID: "key-0001" }], defaultRole: "encrypt" } }, + }, + ], + // The context's location sends its directory alone in the RPC's query (F16-v2-compat-layer). + requests: { deviation: "F16-v2-compat-layer" }, + steps: [ + { checkpoint: "session", until: "Hide it" }, + { type: "/encrypt-sensitive" }, + // The completion lists the plugin's command before Enter (file-browser-flake). + { checkpoint: "slash", until: "configured public key" }, + { keys: ["enter"] }, + // The plugin's text without a color, and its fields, draw in the host's colors (F16-v2-compat-layer). + { checkpoint: "panel", until: "ctrl+t switch", deviation: colors }, + // The field takes the focus a moment after the panel mounts (the plugin's own 50 ms timer). + { wait: 300 }, + { type: "hunter2" }, + { checkpoint: "typed", until: "hunter2", deviation: colors }, + { keys: ["escape"] }, + { checkpoint: "closed", until: "Hide it" }, + ], +})