opencode-teammate 0.2.0-next.6 → 0.2.0-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/mate
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var H1=Object.defineProperty;var P=(w,$)=>{for(var O in $)H1(w,O,{get:$[O],enumerable:!0,configurable:!0,set:(f)=>$[O]=()=>f})};var Y=(w,$)=>()=>(w&&($=w(w=0)),$);var Xw=(w,$,O)=>{if($!=null){if(typeof $!=="object"&&typeof $!=="function")throw TypeError('Object expected to be assigned to "using" declaration');let f;if(O)f=$[Symbol.asyncDispose];if(f===void 0)f=$[Symbol.dispose];if(typeof f!=="function")throw TypeError("Object not disposable");w.push([O,f,$])}else if(O)w.push([O]);return $},Qw=(w,$,O)=>{let f=(G)=>$=O?new SuppressedError(G,$,"An error was suppressed during disposal"):(O=!0,G),B=(G)=>{while(G=w.pop())try{var
|
|
3
|
+
var H1=Object.defineProperty;var P=(w,$)=>{for(var O in $)H1(w,O,{get:$[O],enumerable:!0,configurable:!0,set:(f)=>$[O]=()=>f})};var Y=(w,$)=>()=>(w&&($=w(w=0)),$);var Xw=(w,$,O)=>{if($!=null){if(typeof $!=="object"&&typeof $!=="function")throw TypeError('Object expected to be assigned to "using" declaration');let f;if(O)f=$[Symbol.asyncDispose];if(f===void 0)f=$[Symbol.dispose];if(typeof f!=="function")throw TypeError("Object not disposable");w.push([O,f,$])}else if(O)w.push([O]);return $},Qw=(w,$,O)=>{let f=(G)=>$=O?new SuppressedError(G,$,"An error was suppressed during disposal"):(O=!0,G),B=(G)=>{while(G=w.pop())try{var N=G[1]&&G[1].call(G[2]);if(G[0])return Promise.resolve(N).then(B,(E)=>(f(E),B()))}catch(E){f(E)}if(O)throw $};return B()};var Dw=()=>{};var _w=({onRequest:w,onSseError:$,onSseEvent:O,responseTransformer:f,responseValidator:B,sseDefaultRetryDelay:G,sseMaxRetryAttempts:N,sseMaxRetryDelay:E,sseSleepFn:U,url:Z,...J})=>{let L,z=U??((X)=>new Promise((S)=>setTimeout(S,X)));return{stream:async function*(){let X=G??3000,S=0,b=J.signal??new AbortController().signal;while(!0){if(b.aborted)break;S++;let $$=J.headers instanceof Headers?J.headers:new Headers(J.headers);if(L!==void 0)$$.set("Last-Event-ID",L);try{let g={redirect:"follow",...J,body:J.serializedBody,headers:$$,signal:b},A=new Request(Z,g);if(w)A=await w(Z,g);let R=await(J.fetch??globalThis.fetch)(A);if(!R.ok)throw Error(`SSE failed: ${R.status} ${R.statusText}`);if(!R.body)throw Error("No body in SSE response");let K=R.body.pipeThrough(new TextDecoderStream).getReader(),w$="",Ww=()=>{try{K.cancel()}catch{}};b.addEventListener("abort",Ww);try{while(!0){let{done:z1,value:K1}=await K.read();if(z1)break;w$+=K1,w$=w$.replace(/\r\n/g,`
|
|
4
4
|
`).replace(/\r/g,`
|
|
5
5
|
`);let Jw=w$.split(`
|
|
6
6
|
|
|
7
7
|
`);w$=Jw.pop()??"";for(let q1 of Jw){let F1=q1.split(`
|
|
8
|
-
`),
|
|
9
|
-
`);try{c=JSON.parse(h),Lw=!0}catch{c=h}}if(Lw){if(B)await B(c);if(f)c=await f(c)}if(O?.({data:c,event:Zw,id:L,retry:X}),N$.length)yield c}}}finally{b.removeEventListener("abort",Ww),K.releaseLock()}break}catch(g){if($?.(g),E!==void 0&&T>=E)break;let A=Math.min(X*2**(T-1),N??30000);await z(A)}}}()}};var I1=(w)=>{switch(w){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},h1=(w)=>{switch(w){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},j1=(w)=>{switch(w){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},U$=({allowReserved:w,explode:$,name:O,style:f,value:B})=>{if(!$){let N=(w?B:B.map((U)=>encodeURIComponent(U))).join(h1(f));switch(f){case"label":return`.${N}`;case"matrix":return`;${O}=${N}`;case"simple":return N;default:return`${O}=${N}`}}let G=I1(f),E=B.map((N)=>{if(f==="label"||f==="simple")return w?N:encodeURIComponent(N);return v({allowReserved:w,name:O,value:N})}).join(G);return f==="label"||f==="matrix"?G+E:E},v=({allowReserved:w,name:$,value:O})=>{if(O===void 0||O===null)return"";if(typeof O==="object")throw Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${$}=${w?O:encodeURIComponent(O)}`},W$=({allowReserved:w,explode:$,name:O,style:f,value:B,valueOnly:G})=>{if(B instanceof Date)return G?B.toISOString():`${O}=${B.toISOString()}`;if(f!=="deepObject"&&!$){let U=[];Object.entries(B).forEach(([J,L])=>{U=[...U,J,w?L:encodeURIComponent(L)]});let Z=U.join(",");switch(f){case"form":return`${O}=${Z}`;case"label":return`.${Z}`;case"matrix":return`;${O}=${Z}`;default:return Z}}let E=j1(f),N=Object.entries(B).map(([U,Z])=>v({allowReserved:w,name:f==="deepObject"?`${O}[${U}]`:U,value:Z})).join(E);return f==="label"||f==="matrix"?E+N:N};function j$(w){let $=w.body!==void 0;if($&&w.bodySerializer){if("serializedBody"in w)return w.serializedBody!==void 0&&w.serializedBody!==""?w.serializedBody:null;return w.body!==""?w.body:null}if($)return w.body;return}var A1,P1=({path:w,url:$})=>{let O=$,f=$.match(A1);if(f)for(let B of f){let G=!1,E=B.substring(1,B.length-1),N="simple";if(E.endsWith("*"))G=!0,E=E.substring(0,E.length-1);if(E.startsWith("."))E=E.substring(1),N="label";else if(E.startsWith(";"))E=E.substring(1),N="matrix";let U=w[E];if(U===void 0||U===null)continue;if(Array.isArray(U)){O=O.replace(B,U$({explode:G,name:E,style:N,value:U}));continue}if(typeof U==="object"){O=O.replace(B,W$({explode:G,name:E,style:N,value:U,valueOnly:!0}));continue}if(N==="matrix"){O=O.replace(B,`;${v({name:E,value:U})}`);continue}let Z=encodeURIComponent(N==="label"?`.${U}`:U);O=O.replace(B,Z)}return O},Sw=({baseUrl:w,path:$,query:O,querySerializer:f,url:B})=>{let G=B.startsWith("/")?B:`/${B}`,E=(w??"")+G;if($)E=P1({path:$,url:E});let N=O?f(O):"";if(N.startsWith("?"))N=N.substring(1);if(N)E+=`?${N}`;return E};var A$=Y(()=>{A1=/\{[^{}]+\}/g});var Tw=async(w,$)=>{let O=typeof $==="function"?await $(w):$;if(!O)return;if(w.scheme==="bearer")return`Bearer ${O}`;if(w.scheme==="basic")return`Basic ${btoa(O)}`;return O};var P$;var x$=Y(()=>{P$={bodySerializer:(w)=>JSON.stringify(w,($,O)=>typeof O==="bigint"?O.toString():O)}});class J${fns=[];clear(){this.fns=[]}eject(w){let $=this.getInterceptorIndex(w);if(this.fns[$])this.fns[$]=null}exists(w){let $=this.getInterceptorIndex(w);return Boolean(this.fns[$])}getInterceptorIndex(w){if(typeof w==="number")return this.fns[w]?w:-1;return this.fns.indexOf(w)}update(w,$){let O=this.getInterceptorIndex(w);if(this.fns[O])return this.fns[O]=$,w;return!1}use(w){return this.fns.push(w),this.fns.length-1}}var Mw=({parameters:w={},...$}={})=>{return(f)=>{let B=[];if(f&&typeof f==="object")for(let G in f){let E=f[G];if(E===void 0||E===null)continue;let N=w[G]||$;if(Array.isArray(E)){let U=U$({allowReserved:N.allowReserved,explode:!0,name:G,style:"form",value:E,...N.array});if(U)B.push(U)}else if(typeof E==="object"){let U=W$({allowReserved:N.allowReserved,explode:!0,name:G,style:"deepObject",value:E,...N.object});if(U)B.push(U)}else{let U=v({allowReserved:N.allowReserved,name:G,value:E});if(U)B.push(U)}}return B.join("&")}},Rw=(w)=>{if(!w)return"stream";let $=w.split(";")[0]?.trim();if(!$)return;if($.startsWith("application/json")||$.endsWith("+json"))return"json";if($==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some((O)=>$.startsWith(O)))return"blob";if($.startsWith("text/"))return"text";return},x1=(w,$)=>{if(!$)return!1;if(w.headers.has($)||w.query?.[$]||w.headers.get("Cookie")?.includes(`${$}=`))return!0;return!1},Vw=async({security:w,...$})=>{for(let O of w){if(x1($,O.name))continue;let f=await Tw(O,$.auth);if(!f)continue;let B=O.name??"Authorization";switch(O.in){case"query":if(!$.query)$.query={};$.query[B]=f;break;case"cookie":$.headers.append("Cookie",`${B}=${f}`);break;case"header":default:$.headers.set(B,f);break}}},C$=(w)=>Sw({baseUrl:w.baseUrl,path:w.path,query:w.query,querySerializer:typeof w.querySerializer==="function"?w.querySerializer:Mw(w.querySerializer),url:w.url}),k$=(w,$)=>{let O={...w,...$};if(O.baseUrl?.endsWith("/"))O.baseUrl=O.baseUrl.substring(0,O.baseUrl.length-1);return O.headers=Z$(w.headers,$.headers),O},C1=(w)=>{let $=[];return w.forEach((O,f)=>{$.push([f,O])}),$},Z$=(...w)=>{let $=new Headers;for(let O of w){if(!O)continue;let f=O instanceof Headers?C1(O):Object.entries(O);for(let[B,G]of f)if(G===null)$.delete(B);else if(Array.isArray(G))for(let E of G)$.append(B,E);else if(G!==void 0)$.set(B,typeof G==="object"?JSON.stringify(G):G)}return $},zw=()=>({error:new J$,request:new J$,response:new J$}),k1,b1,O$=(w={})=>({...P$,headers:b1,parseAs:"auto",querySerializer:k1,...w});var b$=Y(()=>{x$();A$();k1=Mw({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),b1={"Content-Type":"application/json"}});var f$=(w={})=>{let $=k$(O$(),w),O=()=>({...$}),f=(Z)=>{return $=k$($,Z),O()},B=zw(),G=async(Z)=>{let J={...$,...Z,fetch:Z.fetch??$.fetch??globalThis.fetch,headers:Z$($.headers,Z.headers),serializedBody:void 0};if(J.security)await Vw({...J,security:J.security});if(J.requestValidator)await J.requestValidator(J);if(J.body!==void 0&&J.bodySerializer)J.serializedBody=J.bodySerializer(J.body);if(J.body===void 0||J.serializedBody==="")J.headers.delete("Content-Type");let L=C$(J);return{opts:J,url:L}},E=async(Z)=>{let{opts:J,url:L}=await G(Z),z={redirect:"follow",...J,body:j$(J)},M=new Request(L,z);for(let V of B.request.fns)if(V)M=await V(M,J);let F=J.fetch,X;try{X=await F(M)}catch(V){let R=V;for(let K of B.error.fns)if(K)R=await K(V,void 0,M,J);if(R=R||{},J.throwOnError)throw R;return J.responseStyle==="data"?void 0:{error:R,request:M,response:void 0}}for(let V of B.response.fns)if(V)X=await V(X,M,J);let T={request:M,response:X};if(X.ok){let V=(J.parseAs==="auto"?Rw(X.headers.get("Content-Type")):J.parseAs)??"json";if(X.status===204||X.headers.get("Content-Length")==="0"){let K;switch(V){case"arrayBuffer":case"blob":case"text":K=await X[V]();break;case"formData":K=new FormData;break;case"stream":K=X.body;break;case"json":default:K={};break}return J.responseStyle==="data"?K:{data:K,...T}}let R;switch(V){case"arrayBuffer":case"blob":case"formData":case"text":R=await X[V]();break;case"json":{let K=await X.text();R=K?JSON.parse(K):{};break}case"stream":return J.responseStyle==="data"?X.body:{data:X.body,...T}}if(V==="json"){if(J.responseValidator)await J.responseValidator(R);if(J.responseTransformer)R=await J.responseTransformer(R)}return J.responseStyle==="data"?R:{data:R,...T}}let b=await X.text(),$$;try{$$=JSON.parse(b)}catch{}let g=$$??b,A=g;for(let V of B.error.fns)if(V)A=await V(g,X,M,J);if(A=A||{},J.throwOnError)throw A;return J.responseStyle==="data"?void 0:{error:A,...T}},N=(Z)=>(J)=>E({...J,method:Z}),U=(Z)=>async(J)=>{let{opts:L,url:z}=await G(J);return _w({...L,body:L.body,headers:L.headers,method:Z,onRequest:async(M,F)=>{let X=new Request(M,F);for(let T of B.request.fns)if(T)X=await T(X,L);return X},serializedBody:j$(L),url:z})};return{buildUrl:C$,connect:N("CONNECT"),delete:N("DELETE"),get:N("GET"),getConfig:O,head:N("HEAD"),interceptors:B,options:N("OPTIONS"),patch:N("PATCH"),post:N("POST"),put:N("PUT"),request:E,setConfig:f,sse:{connect:U("CONNECT"),delete:U("DELETE"),get:U("GET"),head:U("HEAD"),options:U("OPTIONS"),patch:U("PATCH"),post:U("POST"),put:U("PUT"),trace:U("TRACE")},trace:N("TRACE")}};var g$=Y(()=>{A$();b$()});var g1,c1,Kw=(w,$)=>{if(!$)$=new Map;for(let O of w)if("in"in O){if(O.key)$.set(O.key,{in:O.in,map:O.map})}else if("key"in O)$.set(O.key,{map:O.map});else if(O.args)Kw(O.args,$);return $},d1=(w)=>{for(let[$,O]of Object.entries(w))if(O&&typeof O==="object"&&!Object.keys(O).length)delete w[$]},W=(w,$)=>{let O={body:{},headers:{},path:{},query:{}},f=Kw($),B;for(let[G,E]of w.entries()){if($[G])B=$[G];if(!B)continue;if("in"in B)if(B.key){let N=f.get(B.key),U=N.map||B.key;if(N.in)O[N.in][U]=E}else O.body=E;else for(let[N,U]of Object.entries(E??{})){let Z=f.get(N);if(Z)if(Z.in){let J=Z.map||N;O[Z.in][J]=U}else O[Z.map]=U;else{let J=c1.find(([L])=>N.startsWith(L));if(J){let[L,z]=J;O[z][N.slice(L.length)]=U}else if("allowExtra"in B&&B.allowExtra){for(let[L,z]of Object.entries(B.allowExtra))if(z){O[L][N]=U;break}}}}}return d1(O),O};var qw=Y(()=>{g1={$body_:"body",$headers_:"headers",$path_:"path",$query_:"query"},c1=Object.entries(g1)});var c$=Y(()=>{x$();qw();g$();b$()});var Fw;var Hw=Y(()=>{c$();Fw=f$(O$({baseUrl:"http://localhost:4096"}))});class Q{client;constructor(w){this.client=w?.client??Fw}}class Iw{defaultKey="default";instances=new Map;get(w){let $=this.instances.get(w??this.defaultKey);if(!$)throw Error('No SDK client found. Create one with "new OpencodeClient()" to fix this error.');return $}set(w,$){this.instances.set($??this.defaultKey,w)}}var hw,jw,Aw,Pw,xw,Cw,kw,bw,gw,cw,dw,vw,yw,mw,uw,lw,pw,nw,iw,rw,ow,sw,tw,aw,ew,$0,w0,O0,f0,B0,L$;var G0=Y(()=>{Hw();c$();hw=class hw extends Q{get(w){return(w?.client??this.client).get({url:"/global/config",...w})}update(w,$){let O=W([w],[{args:[{key:"config",map:"body"}]}]);return($?.client??this.client).patch({url:"/global/config",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}};jw=class jw extends Q{health(w){return(w?.client??this.client).get({url:"/global/health",...w})}event(w){return(w?.client??this.client).sse.get({url:"/global/event",...w})}dispose(w){return(w?.client??this.client).post({url:"/global/dispose",...w})}_config;get config(){return this._config??=new hw({client:this.client})}};Aw=class Aw extends Q{remove(w,$){let O=W([w],[{args:[{in:"path",key:"providerID"}]}]);return($?.client??this.client).delete({url:"/auth/{providerID}",...$,...O})}set(w,$){let O=W([w],[{args:[{in:"path",key:"providerID"},{key:"auth",map:"body"}]}]);return($?.client??this.client).put({url:"/auth/{providerID}",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}};Pw=class Pw extends Q{list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/project",...$,...O})}current(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/project/current",...$,...O})}update(w,$){let O=W([w],[{args:[{in:"path",key:"projectID"},{in:"query",key:"directory"},{in:"body",key:"name"},{in:"body",key:"icon"},{in:"body",key:"commands"}]}]);return($?.client??this.client).patch({url:"/project/{projectID}",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}};xw=class xw extends Q{list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/pty",...$,...O})}create(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"body",key:"command"},{in:"body",key:"args"},{in:"body",key:"cwd"},{in:"body",key:"title"},{in:"body",key:"env"}]}]);return($?.client??this.client).post({url:"/pty",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}remove(w,$){let O=W([w],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).delete({url:"/pty/{ptyID}",...$,...O})}get(w,$){let O=W([w],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/pty/{ptyID}",...$,...O})}update(w,$){let O=W([w],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"},{in:"body",key:"title"},{in:"body",key:"size"}]}]);return($?.client??this.client).put({url:"/pty/{ptyID}",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}connect(w,$){let O=W([w],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/pty/{ptyID}/connect",...$,...O})}};Cw=class Cw extends Q{get(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/config",...$,...O})}update(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{key:"config",map:"body"}]}]);return($?.client??this.client).patch({url:"/config",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}providers(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/config/providers",...$,...O})}};kw=class kw extends Q{ids(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/experimental/tool/ids",...$,...O})}list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"query",key:"provider"},{in:"query",key:"model"}]}]);return($?.client??this.client).get({url:"/experimental/tool",...$,...O})}};bw=class bw extends Q{remove(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{key:"worktreeRemoveInput",map:"body"}]}]);return($?.client??this.client).delete({url:"/experimental/worktree",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/experimental/worktree",...$,...O})}create(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{key:"worktreeCreateInput",map:"body"}]}]);return($?.client??this.client).post({url:"/experimental/worktree",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}reset(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{key:"worktreeResetInput",map:"body"}]}]);return($?.client??this.client).post({url:"/experimental/worktree/reset",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}};gw=class gw extends Q{list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/experimental/resource",...$,...O})}};cw=class cw extends Q{_resource;get resource(){return this._resource??=new gw({client:this.client})}};dw=class dw extends Q{list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"query",key:"roots"},{in:"query",key:"start"},{in:"query",key:"search"},{in:"query",key:"limit"}]}]);return($?.client??this.client).get({url:"/session",...$,...O})}create(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"body",key:"parentID"},{in:"body",key:"title"},{in:"body",key:"permission"}]}]);return($?.client??this.client).post({url:"/session",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}status(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/session/status",...$,...O})}delete(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).delete({url:"/session/{sessionID}",...$,...O})}get(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}",...$,...O})}update(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"title"},{in:"body",key:"time"}]}]);return($?.client??this.client).patch({url:"/session/{sessionID}",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}children(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}/children",...$,...O})}todo(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}/todo",...$,...O})}init(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"modelID"},{in:"body",key:"providerID"},{in:"body",key:"messageID"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/init",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}fork(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"messageID"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/fork",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}abort(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/abort",...$,...O})}unshare(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).delete({url:"/session/{sessionID}/share",...$,...O})}share(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/share",...$,...O})}diff(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"messageID"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}/diff",...$,...O})}summarize(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"providerID"},{in:"body",key:"modelID"},{in:"body",key:"auto"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/summarize",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}messages(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"limit"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}/message",...$,...O})}prompt(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"messageID"},{in:"body",key:"model"},{in:"body",key:"agent"},{in:"body",key:"noReply"},{in:"body",key:"tools"},{in:"body",key:"system"},{in:"body",key:"variant"},{in:"body",key:"parts"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/message",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}message(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}/message/{messageID}",...$,...O})}promptAsync(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"messageID"},{in:"body",key:"model"},{in:"body",key:"agent"},{in:"body",key:"noReply"},{in:"body",key:"tools"},{in:"body",key:"system"},{in:"body",key:"variant"},{in:"body",key:"parts"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/prompt_async",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}command(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"messageID"},{in:"body",key:"agent"},{in:"body",key:"model"},{in:"body",key:"arguments"},{in:"body",key:"command"},{in:"body",key:"variant"},{in:"body",key:"parts"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/command",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}shell(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"agent"},{in:"body",key:"model"},{in:"body",key:"command"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/shell",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}revert(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"messageID"},{in:"body",key:"partID"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/revert",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}unrevert(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/unrevert",...$,...O})}};vw=class vw extends Q{delete(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"path",key:"partID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).delete({url:"/session/{sessionID}/message/{messageID}/part/{partID}",...$,...O})}update(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"path",key:"partID"},{in:"query",key:"directory"},{key:"part",map:"body"}]}]);return($?.client??this.client).patch({url:"/session/{sessionID}/message/{messageID}/part/{partID}",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}};yw=class yw extends Q{respond(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"permissionID"},{in:"query",key:"directory"},{in:"body",key:"response"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/permissions/{permissionID}",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}reply(w,$){let O=W([w],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"body",key:"reply"},{in:"body",key:"message"}]}]);return($?.client??this.client).post({url:"/permission/{requestID}/reply",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/permission",...$,...O})}};mw=class mw extends Q{list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/question",...$,...O})}reply(w,$){let O=W([w],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"body",key:"answers"}]}]);return($?.client??this.client).post({url:"/question/{requestID}/reply",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}reject(w,$){let O=W([w],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/question/{requestID}/reject",...$,...O})}};uw=class uw extends Q{authorize(w,$){let O=W([w],[{args:[{in:"path",key:"providerID"},{in:"query",key:"directory"},{in:"body",key:"method"}]}]);return($?.client??this.client).post({url:"/provider/{providerID}/oauth/authorize",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}callback(w,$){let O=W([w],[{args:[{in:"path",key:"providerID"},{in:"query",key:"directory"},{in:"body",key:"method"},{in:"body",key:"code"}]}]);return($?.client??this.client).post({url:"/provider/{providerID}/oauth/callback",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}};lw=class lw extends Q{list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/provider",...$,...O})}auth(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/provider/auth",...$,...O})}_oauth;get oauth(){return this._oauth??=new uw({client:this.client})}};pw=class pw extends Q{text(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"query",key:"pattern"}]}]);return($?.client??this.client).get({url:"/find",...$,...O})}files(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"query",key:"query"},{in:"query",key:"dirs"},{in:"query",key:"type"},{in:"query",key:"limit"}]}]);return($?.client??this.client).get({url:"/find/file",...$,...O})}symbols(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"query",key:"query"}]}]);return($?.client??this.client).get({url:"/find/symbol",...$,...O})}};nw=class nw extends Q{list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"query",key:"path"}]}]);return($?.client??this.client).get({url:"/file",...$,...O})}read(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"query",key:"path"}]}]);return($?.client??this.client).get({url:"/file/content",...$,...O})}status(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/file/status",...$,...O})}};iw=class iw extends Q{remove(w,$){let O=W([w],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"}]}]);return($?.client??this.client).delete({url:"/mcp/{name}/auth",...$,...O})}start(w,$){let O=W([w],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/mcp/{name}/auth",...$,...O})}callback(w,$){let O=W([w],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"body",key:"code"}]}]);return($?.client??this.client).post({url:"/mcp/{name}/auth/callback",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}authenticate(w,$){let O=W([w],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/mcp/{name}/auth/authenticate",...$,...O})}};rw=class rw extends Q{status(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/mcp",...$,...O})}add(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"body",key:"name"},{in:"body",key:"config"}]}]);return($?.client??this.client).post({url:"/mcp",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}connect(w,$){let O=W([w],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/mcp/{name}/connect",...$,...O})}disconnect(w,$){let O=W([w],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/mcp/{name}/disconnect",...$,...O})}_auth;get auth(){return this._auth??=new iw({client:this.client})}};ow=class ow extends Q{next(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/tui/control/next",...$,...O})}response(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{key:"body",map:"body"}]}]);return($?.client??this.client).post({url:"/tui/control/response",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}};sw=class sw extends Q{appendPrompt(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"body",key:"text"}]}]);return($?.client??this.client).post({url:"/tui/append-prompt",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}openHelp(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/tui/open-help",...$,...O})}openSessions(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/tui/open-sessions",...$,...O})}openThemes(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/tui/open-themes",...$,...O})}openModels(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/tui/open-models",...$,...O})}submitPrompt(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/tui/submit-prompt",...$,...O})}clearPrompt(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/tui/clear-prompt",...$,...O})}executeCommand(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"body",key:"command"}]}]);return($?.client??this.client).post({url:"/tui/execute-command",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}showToast(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"body",key:"title"},{in:"body",key:"message"},{in:"body",key:"variant"},{in:"body",key:"duration"}]}]);return($?.client??this.client).post({url:"/tui/show-toast",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}publish(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{key:"body",map:"body"}]}]);return($?.client??this.client).post({url:"/tui/publish",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}selectSession(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"body",key:"sessionID"}]}]);return($?.client??this.client).post({url:"/tui/select-session",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}_control;get control(){return this._control??=new ow({client:this.client})}};tw=class tw extends Q{dispose(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/instance/dispose",...$,...O})}};aw=class aw extends Q{get(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/path",...$,...O})}};ew=class ew extends Q{get(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/vcs",...$,...O})}};$0=class $0 extends Q{list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/command",...$,...O})}};w0=class w0 extends Q{log(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"body",key:"service"},{in:"body",key:"level"},{in:"body",key:"message"},{in:"body",key:"extra"}]}]);return($?.client??this.client).post({url:"/log",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}agents(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/agent",...$,...O})}skills(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/skill",...$,...O})}};O0=class O0 extends Q{status(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/lsp",...$,...O})}};f0=class f0 extends Q{status(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/formatter",...$,...O})}};B0=class B0 extends Q{subscribe(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).sse.get({url:"/event",...$,...O})}};L$=class L$ extends Q{static __registry=new Iw;constructor(w){super(w);L$.__registry.set(this,w?.key)}_global;get global(){return this._global??=new jw({client:this.client})}_auth;get auth(){return this._auth??=new Aw({client:this.client})}_project;get project(){return this._project??=new Pw({client:this.client})}_pty;get pty(){return this._pty??=new xw({client:this.client})}_config;get config(){return this._config??=new Cw({client:this.client})}_tool;get tool(){return this._tool??=new kw({client:this.client})}_worktree;get worktree(){return this._worktree??=new bw({client:this.client})}_experimental;get experimental(){return this._experimental??=new cw({client:this.client})}_session;get session(){return this._session??=new dw({client:this.client})}_part;get part(){return this._part??=new vw({client:this.client})}_permission;get permission(){return this._permission??=new yw({client:this.client})}_question;get question(){return this._question??=new mw({client:this.client})}_provider;get provider(){return this._provider??=new lw({client:this.client})}_find;get find(){return this._find??=new pw({client:this.client})}_file;get file(){return this._file??=new nw({client:this.client})}_mcp;get mcp(){return this._mcp??=new rw({client:this.client})}_tui;get tui(){return this._tui??=new sw({client:this.client})}_instance;get instance(){return this._instance??=new tw({client:this.client})}_path;get path(){return this._path??=new aw({client:this.client})}_vcs;get vcs(){return this._vcs??=new ew({client:this.client})}_command;get command(){return this._command??=new $0({client:this.client})}_app;get app(){return this._app??=new w0({client:this.client})}_lsp;get lsp(){return this._lsp??=new O0({client:this.client})}_formatter;get formatter(){return this._formatter??=new f0({client:this.client})}_event;get event(){return this._event??=new B0({client:this.client})}}});function E0(w){if(!w?.fetch)w={...w,fetch:(f)=>{return f.timeout=!1,fetch(f)}};if(w?.directory){let f=/[^\x00-\x7F]/.test(w.directory)?encodeURIComponent(w.directory):w.directory;w.headers={...w.headers,"x-opencode-directory":f}}let $=f$(w);return new L$({client:$})}var N0=Y(()=>{g$();G0();Dw()});async function U0(w){let $=await J0(w.db),O={...$[w.key],...w.state};return await Bun.write(w.db,JSON.stringify({...$,[w.key]:O})),O}async function W0(w){return(await J0(w.db))[w.key]}async function J0(w){let $=Bun.file(w);if(!await $.exists())return{};return await $.json()}var y={};P(y,{use:()=>m1,register:()=>y1});async function y1(w){if(Bun.env.OPENCODE_CLIENT)await U0({db:Z0,key:Bun.env.OPENCODE_CLIENT,state:{hostname:w.serverUrl.hostname,port:w.serverUrl.port,seenAt:new Date().toISOString(),password:Bun.env.OPENCODE_SERVER_PASSWORD,username:Bun.env.OPENCODE_SERVER_USERNAME}});return d$({url:String(w.serverUrl),password:Bun.env.OPENCODE_SERVER_PASSWORD,username:Bun.env.OPENCODE_SERVER_USERNAME,directory:w.directory})}async function m1(w){let $={desktop:async()=>{let f=await W0({db:Z0,key:"desktop"});if(!f)return;return d$({url:`http://${f.hostname??"127.0.0.1"}:${f.port}`,username:f.username,password:f.password,directory:w.project})},config:async()=>{let f=w?.opencode?.server;if(!f?.url)return;return d$({directory:w.project,...f})}},O=w?.opencode?.lookup??["desktop","config"];for(let f of O){let B=await $[f]?.();if(!B)continue;let G=await B.global.health();if(!G.data?.healthy){console.warn(`${f} server is not healthy: ${JSON.stringify(G.error)}`);continue}return console.debug(`Using ${f}: ${G.data.version}`),B}throw Error(`Opencode server not found using strategies: ${O.join(", ")}`)}function d$(w){return E0({directory:w.directory,baseUrl:w.url,headers:w.username&&w.password?{Authorization:`Basic ${btoa(`${w.username}:${w.password}`)}`}:void 0})}var Z0;var L0=Y(()=>{N0();Z0=`${Bun.env.HOME}/Library/Application Support/ai.opencode.desktop/store.json`});function X0(w){return Array.isArray(w)?w.slice():[w]}function Q0(w,$){if(!w)return{};return w.reduce((O,f)=>{let B=$(f);return O[B]=(O[B]??0)+1,O},{})}function v$(w,$){return(w==null?void 0:w.length)>0?w[0]:$}function Y$(w){return(w==null?void 0:w.filter(($)=>!!$))??[]}function D0(w){return new Promise(($)=>setTimeout($,w))}function _0(w){return(...$)=>{try{let O=w(...$);return a1(O)?O.then((f)=>[void 0,f],(f)=>[f,void 0]):[void 0,O]}catch(O){return[O,void 0]}}}function y$(){let w,$,O=new Promise((f,B)=>{w=f,$=B});return{resolve:w,reject:$,promise:O}}function B$(...w){return(...$)=>{return w.slice(1).reduce((O,f)=>f(O),w[0](...$))}}function u1(){}function S0(w,$){return new i1($).parse(w)}function m(w,$){if(!w)return[];let O=Object.entries(w);if(O.length===0)return[];return O.reduce((f,B)=>{return f.push($(B[0],B[1])),f},[])}function T0(w,$=(O)=>O===void 0){if(!w)return{};return Object.keys(w).reduce((O,f)=>{if(!$(w[f]))O[f]=w[f];return O},{})}function o1(w){if(!w||w.length===0)return"";let $=w.toLowerCase();return $.substring(0,1).toUpperCase()+$.substring(1,$.length)}function u(w,...$){var O;if(d(w)){if($.length>0)return u(w.reduce((G,E,N)=>{var U;let Z=String($[N]??""),J=Z.includes(`
|
|
10
|
-
`)&&((U=
|
|
11
|
-
`+J);return G+
|
|
12
|
-
`){
|
|
13
|
-
`)if(B(),$.schema){let
|
|
14
|
-
`),B=-1,G=-1;for(let J=0;J<f.length;J++)if(f[J]?.trim()===O){B=J;break}if(B===-1)return{metadata:{},content:w};for(let J=B+1;J<f.length;J++)if(f[J]?.trim()===O){G=J;break}if(G===-1)return{metadata:{},content:w};let
|
|
15
|
-
`),U=hO(
|
|
8
|
+
`),E$=[],Zw;for(let h of F1)if(h.startsWith("data:"))E$.push(h.replace(/^data:\s*/,""));else if(h.startsWith("event:"))Zw=h.replace(/^event:\s*/,"");else if(h.startsWith("id:"))L=h.replace(/^id:\s*/,"");else if(h.startsWith("retry:")){let Yw=Number.parseInt(h.replace(/^retry:\s*/,""),10);if(!Number.isNaN(Yw))X=Yw}let c,Lw=!1;if(E$.length){let h=E$.join(`
|
|
9
|
+
`);try{c=JSON.parse(h),Lw=!0}catch{c=h}}if(Lw){if(B)await B(c);if(f)c=await f(c)}if(O?.({data:c,event:Zw,id:L,retry:X}),E$.length)yield c}}}finally{b.removeEventListener("abort",Ww),K.releaseLock()}break}catch(g){if($?.(g),N!==void 0&&S>=N)break;let A=Math.min(X*2**(S-1),E??30000);await z(A)}}}()}};var I1=(w)=>{switch(w){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},h1=(w)=>{switch(w){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},j1=(w)=>{switch(w){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},U$=({allowReserved:w,explode:$,name:O,style:f,value:B})=>{if(!$){let E=(w?B:B.map((U)=>encodeURIComponent(U))).join(h1(f));switch(f){case"label":return`.${E}`;case"matrix":return`;${O}=${E}`;case"simple":return E;default:return`${O}=${E}`}}let G=I1(f),N=B.map((E)=>{if(f==="label"||f==="simple")return w?E:encodeURIComponent(E);return v({allowReserved:w,name:O,value:E})}).join(G);return f==="label"||f==="matrix"?G+N:N},v=({allowReserved:w,name:$,value:O})=>{if(O===void 0||O===null)return"";if(typeof O==="object")throw Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${$}=${w?O:encodeURIComponent(O)}`},W$=({allowReserved:w,explode:$,name:O,style:f,value:B,valueOnly:G})=>{if(B instanceof Date)return G?B.toISOString():`${O}=${B.toISOString()}`;if(f!=="deepObject"&&!$){let U=[];Object.entries(B).forEach(([J,L])=>{U=[...U,J,w?L:encodeURIComponent(L)]});let Z=U.join(",");switch(f){case"form":return`${O}=${Z}`;case"label":return`.${Z}`;case"matrix":return`;${O}=${Z}`;default:return Z}}let N=j1(f),E=Object.entries(B).map(([U,Z])=>v({allowReserved:w,name:f==="deepObject"?`${O}[${U}]`:U,value:Z})).join(N);return f==="label"||f==="matrix"?N+E:E};function j$(w){let $=w.body!==void 0;if($&&w.bodySerializer){if("serializedBody"in w)return w.serializedBody!==void 0&&w.serializedBody!==""?w.serializedBody:null;return w.body!==""?w.body:null}if($)return w.body;return}var A1,P1=({path:w,url:$})=>{let O=$,f=$.match(A1);if(f)for(let B of f){let G=!1,N=B.substring(1,B.length-1),E="simple";if(N.endsWith("*"))G=!0,N=N.substring(0,N.length-1);if(N.startsWith("."))N=N.substring(1),E="label";else if(N.startsWith(";"))N=N.substring(1),E="matrix";let U=w[N];if(U===void 0||U===null)continue;if(Array.isArray(U)){O=O.replace(B,U$({explode:G,name:N,style:E,value:U}));continue}if(typeof U==="object"){O=O.replace(B,W$({explode:G,name:N,style:E,value:U,valueOnly:!0}));continue}if(E==="matrix"){O=O.replace(B,`;${v({name:N,value:U})}`);continue}let Z=encodeURIComponent(E==="label"?`.${U}`:U);O=O.replace(B,Z)}return O},Tw=({baseUrl:w,path:$,query:O,querySerializer:f,url:B})=>{let G=B.startsWith("/")?B:`/${B}`,N=(w??"")+G;if($)N=P1({path:$,url:N});let E=O?f(O):"";if(E.startsWith("?"))E=E.substring(1);if(E)N+=`?${E}`;return N};var A$=Y(()=>{A1=/\{[^{}]+\}/g});var Sw=async(w,$)=>{let O=typeof $==="function"?await $(w):$;if(!O)return;if(w.scheme==="bearer")return`Bearer ${O}`;if(w.scheme==="basic")return`Basic ${btoa(O)}`;return O};var P$;var x$=Y(()=>{P$={bodySerializer:(w)=>JSON.stringify(w,($,O)=>typeof O==="bigint"?O.toString():O)}});class J${fns=[];clear(){this.fns=[]}eject(w){let $=this.getInterceptorIndex(w);if(this.fns[$])this.fns[$]=null}exists(w){let $=this.getInterceptorIndex(w);return Boolean(this.fns[$])}getInterceptorIndex(w){if(typeof w==="number")return this.fns[w]?w:-1;return this.fns.indexOf(w)}update(w,$){let O=this.getInterceptorIndex(w);if(this.fns[O])return this.fns[O]=$,w;return!1}use(w){return this.fns.push(w),this.fns.length-1}}var Mw=({parameters:w={},...$}={})=>{return(f)=>{let B=[];if(f&&typeof f==="object")for(let G in f){let N=f[G];if(N===void 0||N===null)continue;let E=w[G]||$;if(Array.isArray(N)){let U=U$({allowReserved:E.allowReserved,explode:!0,name:G,style:"form",value:N,...E.array});if(U)B.push(U)}else if(typeof N==="object"){let U=W$({allowReserved:E.allowReserved,explode:!0,name:G,style:"deepObject",value:N,...E.object});if(U)B.push(U)}else{let U=v({allowReserved:E.allowReserved,name:G,value:N});if(U)B.push(U)}}return B.join("&")}},Rw=(w)=>{if(!w)return"stream";let $=w.split(";")[0]?.trim();if(!$)return;if($.startsWith("application/json")||$.endsWith("+json"))return"json";if($==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some((O)=>$.startsWith(O)))return"blob";if($.startsWith("text/"))return"text";return},x1=(w,$)=>{if(!$)return!1;if(w.headers.has($)||w.query?.[$]||w.headers.get("Cookie")?.includes(`${$}=`))return!0;return!1},Vw=async({security:w,...$})=>{for(let O of w){if(x1($,O.name))continue;let f=await Sw(O,$.auth);if(!f)continue;let B=O.name??"Authorization";switch(O.in){case"query":if(!$.query)$.query={};$.query[B]=f;break;case"cookie":$.headers.append("Cookie",`${B}=${f}`);break;case"header":default:$.headers.set(B,f);break}}},C$=(w)=>Tw({baseUrl:w.baseUrl,path:w.path,query:w.query,querySerializer:typeof w.querySerializer==="function"?w.querySerializer:Mw(w.querySerializer),url:w.url}),k$=(w,$)=>{let O={...w,...$};if(O.baseUrl?.endsWith("/"))O.baseUrl=O.baseUrl.substring(0,O.baseUrl.length-1);return O.headers=Z$(w.headers,$.headers),O},C1=(w)=>{let $=[];return w.forEach((O,f)=>{$.push([f,O])}),$},Z$=(...w)=>{let $=new Headers;for(let O of w){if(!O)continue;let f=O instanceof Headers?C1(O):Object.entries(O);for(let[B,G]of f)if(G===null)$.delete(B);else if(Array.isArray(G))for(let N of G)$.append(B,N);else if(G!==void 0)$.set(B,typeof G==="object"?JSON.stringify(G):G)}return $},zw=()=>({error:new J$,request:new J$,response:new J$}),k1,b1,O$=(w={})=>({...P$,headers:b1,parseAs:"auto",querySerializer:k1,...w});var b$=Y(()=>{x$();A$();k1=Mw({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),b1={"Content-Type":"application/json"}});var f$=(w={})=>{let $=k$(O$(),w),O=()=>({...$}),f=(Z)=>{return $=k$($,Z),O()},B=zw(),G=async(Z)=>{let J={...$,...Z,fetch:Z.fetch??$.fetch??globalThis.fetch,headers:Z$($.headers,Z.headers),serializedBody:void 0};if(J.security)await Vw({...J,security:J.security});if(J.requestValidator)await J.requestValidator(J);if(J.body!==void 0&&J.bodySerializer)J.serializedBody=J.bodySerializer(J.body);if(J.body===void 0||J.serializedBody==="")J.headers.delete("Content-Type");let L=C$(J);return{opts:J,url:L}},N=async(Z)=>{let{opts:J,url:L}=await G(Z),z={redirect:"follow",...J,body:j$(J)},M=new Request(L,z);for(let V of B.request.fns)if(V)M=await V(M,J);let F=J.fetch,X;try{X=await F(M)}catch(V){let R=V;for(let K of B.error.fns)if(K)R=await K(V,void 0,M,J);if(R=R||{},J.throwOnError)throw R;return J.responseStyle==="data"?void 0:{error:R,request:M,response:void 0}}for(let V of B.response.fns)if(V)X=await V(X,M,J);let S={request:M,response:X};if(X.ok){let V=(J.parseAs==="auto"?Rw(X.headers.get("Content-Type")):J.parseAs)??"json";if(X.status===204||X.headers.get("Content-Length")==="0"){let K;switch(V){case"arrayBuffer":case"blob":case"text":K=await X[V]();break;case"formData":K=new FormData;break;case"stream":K=X.body;break;case"json":default:K={};break}return J.responseStyle==="data"?K:{data:K,...S}}let R;switch(V){case"arrayBuffer":case"blob":case"formData":case"text":R=await X[V]();break;case"json":{let K=await X.text();R=K?JSON.parse(K):{};break}case"stream":return J.responseStyle==="data"?X.body:{data:X.body,...S}}if(V==="json"){if(J.responseValidator)await J.responseValidator(R);if(J.responseTransformer)R=await J.responseTransformer(R)}return J.responseStyle==="data"?R:{data:R,...S}}let b=await X.text(),$$;try{$$=JSON.parse(b)}catch{}let g=$$??b,A=g;for(let V of B.error.fns)if(V)A=await V(g,X,M,J);if(A=A||{},J.throwOnError)throw A;return J.responseStyle==="data"?void 0:{error:A,...S}},E=(Z)=>(J)=>N({...J,method:Z}),U=(Z)=>async(J)=>{let{opts:L,url:z}=await G(J);return _w({...L,body:L.body,headers:L.headers,method:Z,onRequest:async(M,F)=>{let X=new Request(M,F);for(let S of B.request.fns)if(S)X=await S(X,L);return X},serializedBody:j$(L),url:z})};return{buildUrl:C$,connect:E("CONNECT"),delete:E("DELETE"),get:E("GET"),getConfig:O,head:E("HEAD"),interceptors:B,options:E("OPTIONS"),patch:E("PATCH"),post:E("POST"),put:E("PUT"),request:N,setConfig:f,sse:{connect:U("CONNECT"),delete:U("DELETE"),get:U("GET"),head:U("HEAD"),options:U("OPTIONS"),patch:U("PATCH"),post:U("POST"),put:U("PUT"),trace:U("TRACE")},trace:E("TRACE")}};var g$=Y(()=>{A$();b$()});var g1,c1,Kw=(w,$)=>{if(!$)$=new Map;for(let O of w)if("in"in O){if(O.key)$.set(O.key,{in:O.in,map:O.map})}else if("key"in O)$.set(O.key,{map:O.map});else if(O.args)Kw(O.args,$);return $},d1=(w)=>{for(let[$,O]of Object.entries(w))if(O&&typeof O==="object"&&!Object.keys(O).length)delete w[$]},W=(w,$)=>{let O={body:{},headers:{},path:{},query:{}},f=Kw($),B;for(let[G,N]of w.entries()){if($[G])B=$[G];if(!B)continue;if("in"in B)if(B.key){let E=f.get(B.key),U=E.map||B.key;if(E.in)O[E.in][U]=N}else O.body=N;else for(let[E,U]of Object.entries(N??{})){let Z=f.get(E);if(Z)if(Z.in){let J=Z.map||E;O[Z.in][J]=U}else O[Z.map]=U;else{let J=c1.find(([L])=>E.startsWith(L));if(J){let[L,z]=J;O[z][E.slice(L.length)]=U}else if("allowExtra"in B&&B.allowExtra){for(let[L,z]of Object.entries(B.allowExtra))if(z){O[L][E]=U;break}}}}}return d1(O),O};var qw=Y(()=>{g1={$body_:"body",$headers_:"headers",$path_:"path",$query_:"query"},c1=Object.entries(g1)});var c$=Y(()=>{x$();qw();g$();b$()});var Fw;var Hw=Y(()=>{c$();Fw=f$(O$({baseUrl:"http://localhost:4096"}))});class Q{client;constructor(w){this.client=w?.client??Fw}}class Iw{defaultKey="default";instances=new Map;get(w){let $=this.instances.get(w??this.defaultKey);if(!$)throw Error('No SDK client found. Create one with "new OpencodeClient()" to fix this error.');return $}set(w,$){this.instances.set($??this.defaultKey,w)}}var hw,jw,Aw,Pw,xw,Cw,kw,bw,gw,cw,dw,vw,yw,mw,uw,lw,pw,nw,iw,rw,ow,sw,tw,aw,ew,$0,w0,O0,f0,B0,L$;var G0=Y(()=>{Hw();c$();hw=class hw extends Q{get(w){return(w?.client??this.client).get({url:"/global/config",...w})}update(w,$){let O=W([w],[{args:[{key:"config",map:"body"}]}]);return($?.client??this.client).patch({url:"/global/config",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}};jw=class jw extends Q{health(w){return(w?.client??this.client).get({url:"/global/health",...w})}event(w){return(w?.client??this.client).sse.get({url:"/global/event",...w})}dispose(w){return(w?.client??this.client).post({url:"/global/dispose",...w})}_config;get config(){return this._config??=new hw({client:this.client})}};Aw=class Aw extends Q{remove(w,$){let O=W([w],[{args:[{in:"path",key:"providerID"}]}]);return($?.client??this.client).delete({url:"/auth/{providerID}",...$,...O})}set(w,$){let O=W([w],[{args:[{in:"path",key:"providerID"},{key:"auth",map:"body"}]}]);return($?.client??this.client).put({url:"/auth/{providerID}",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}};Pw=class Pw extends Q{list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/project",...$,...O})}current(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/project/current",...$,...O})}update(w,$){let O=W([w],[{args:[{in:"path",key:"projectID"},{in:"query",key:"directory"},{in:"body",key:"name"},{in:"body",key:"icon"},{in:"body",key:"commands"}]}]);return($?.client??this.client).patch({url:"/project/{projectID}",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}};xw=class xw extends Q{list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/pty",...$,...O})}create(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"body",key:"command"},{in:"body",key:"args"},{in:"body",key:"cwd"},{in:"body",key:"title"},{in:"body",key:"env"}]}]);return($?.client??this.client).post({url:"/pty",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}remove(w,$){let O=W([w],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).delete({url:"/pty/{ptyID}",...$,...O})}get(w,$){let O=W([w],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/pty/{ptyID}",...$,...O})}update(w,$){let O=W([w],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"},{in:"body",key:"title"},{in:"body",key:"size"}]}]);return($?.client??this.client).put({url:"/pty/{ptyID}",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}connect(w,$){let O=W([w],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/pty/{ptyID}/connect",...$,...O})}};Cw=class Cw extends Q{get(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/config",...$,...O})}update(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{key:"config",map:"body"}]}]);return($?.client??this.client).patch({url:"/config",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}providers(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/config/providers",...$,...O})}};kw=class kw extends Q{ids(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/experimental/tool/ids",...$,...O})}list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"query",key:"provider"},{in:"query",key:"model"}]}]);return($?.client??this.client).get({url:"/experimental/tool",...$,...O})}};bw=class bw extends Q{remove(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{key:"worktreeRemoveInput",map:"body"}]}]);return($?.client??this.client).delete({url:"/experimental/worktree",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/experimental/worktree",...$,...O})}create(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{key:"worktreeCreateInput",map:"body"}]}]);return($?.client??this.client).post({url:"/experimental/worktree",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}reset(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{key:"worktreeResetInput",map:"body"}]}]);return($?.client??this.client).post({url:"/experimental/worktree/reset",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}};gw=class gw extends Q{list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/experimental/resource",...$,...O})}};cw=class cw extends Q{_resource;get resource(){return this._resource??=new gw({client:this.client})}};dw=class dw extends Q{list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"query",key:"roots"},{in:"query",key:"start"},{in:"query",key:"search"},{in:"query",key:"limit"}]}]);return($?.client??this.client).get({url:"/session",...$,...O})}create(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"body",key:"parentID"},{in:"body",key:"title"},{in:"body",key:"permission"}]}]);return($?.client??this.client).post({url:"/session",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}status(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/session/status",...$,...O})}delete(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).delete({url:"/session/{sessionID}",...$,...O})}get(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}",...$,...O})}update(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"title"},{in:"body",key:"time"}]}]);return($?.client??this.client).patch({url:"/session/{sessionID}",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}children(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}/children",...$,...O})}todo(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}/todo",...$,...O})}init(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"modelID"},{in:"body",key:"providerID"},{in:"body",key:"messageID"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/init",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}fork(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"messageID"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/fork",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}abort(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/abort",...$,...O})}unshare(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).delete({url:"/session/{sessionID}/share",...$,...O})}share(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/share",...$,...O})}diff(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"messageID"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}/diff",...$,...O})}summarize(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"providerID"},{in:"body",key:"modelID"},{in:"body",key:"auto"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/summarize",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}messages(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"limit"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}/message",...$,...O})}prompt(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"messageID"},{in:"body",key:"model"},{in:"body",key:"agent"},{in:"body",key:"noReply"},{in:"body",key:"tools"},{in:"body",key:"system"},{in:"body",key:"variant"},{in:"body",key:"parts"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/message",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}message(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}/message/{messageID}",...$,...O})}promptAsync(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"messageID"},{in:"body",key:"model"},{in:"body",key:"agent"},{in:"body",key:"noReply"},{in:"body",key:"tools"},{in:"body",key:"system"},{in:"body",key:"variant"},{in:"body",key:"parts"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/prompt_async",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}command(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"messageID"},{in:"body",key:"agent"},{in:"body",key:"model"},{in:"body",key:"arguments"},{in:"body",key:"command"},{in:"body",key:"variant"},{in:"body",key:"parts"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/command",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}shell(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"agent"},{in:"body",key:"model"},{in:"body",key:"command"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/shell",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}revert(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"body",key:"messageID"},{in:"body",key:"partID"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/revert",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}unrevert(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/unrevert",...$,...O})}};vw=class vw extends Q{delete(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"path",key:"partID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).delete({url:"/session/{sessionID}/message/{messageID}/part/{partID}",...$,...O})}update(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"path",key:"partID"},{in:"query",key:"directory"},{key:"part",map:"body"}]}]);return($?.client??this.client).patch({url:"/session/{sessionID}/message/{messageID}/part/{partID}",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}};yw=class yw extends Q{respond(w,$){let O=W([w],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"permissionID"},{in:"query",key:"directory"},{in:"body",key:"response"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/permissions/{permissionID}",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}reply(w,$){let O=W([w],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"body",key:"reply"},{in:"body",key:"message"}]}]);return($?.client??this.client).post({url:"/permission/{requestID}/reply",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/permission",...$,...O})}};mw=class mw extends Q{list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/question",...$,...O})}reply(w,$){let O=W([w],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"body",key:"answers"}]}]);return($?.client??this.client).post({url:"/question/{requestID}/reply",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}reject(w,$){let O=W([w],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/question/{requestID}/reject",...$,...O})}};uw=class uw extends Q{authorize(w,$){let O=W([w],[{args:[{in:"path",key:"providerID"},{in:"query",key:"directory"},{in:"body",key:"method"}]}]);return($?.client??this.client).post({url:"/provider/{providerID}/oauth/authorize",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}callback(w,$){let O=W([w],[{args:[{in:"path",key:"providerID"},{in:"query",key:"directory"},{in:"body",key:"method"},{in:"body",key:"code"}]}]);return($?.client??this.client).post({url:"/provider/{providerID}/oauth/callback",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}};lw=class lw extends Q{list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/provider",...$,...O})}auth(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/provider/auth",...$,...O})}_oauth;get oauth(){return this._oauth??=new uw({client:this.client})}};pw=class pw extends Q{text(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"query",key:"pattern"}]}]);return($?.client??this.client).get({url:"/find",...$,...O})}files(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"query",key:"query"},{in:"query",key:"dirs"},{in:"query",key:"type"},{in:"query",key:"limit"}]}]);return($?.client??this.client).get({url:"/find/file",...$,...O})}symbols(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"query",key:"query"}]}]);return($?.client??this.client).get({url:"/find/symbol",...$,...O})}};nw=class nw extends Q{list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"query",key:"path"}]}]);return($?.client??this.client).get({url:"/file",...$,...O})}read(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"query",key:"path"}]}]);return($?.client??this.client).get({url:"/file/content",...$,...O})}status(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/file/status",...$,...O})}};iw=class iw extends Q{remove(w,$){let O=W([w],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"}]}]);return($?.client??this.client).delete({url:"/mcp/{name}/auth",...$,...O})}start(w,$){let O=W([w],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/mcp/{name}/auth",...$,...O})}callback(w,$){let O=W([w],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"body",key:"code"}]}]);return($?.client??this.client).post({url:"/mcp/{name}/auth/callback",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}authenticate(w,$){let O=W([w],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/mcp/{name}/auth/authenticate",...$,...O})}};rw=class rw extends Q{status(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/mcp",...$,...O})}add(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"body",key:"name"},{in:"body",key:"config"}]}]);return($?.client??this.client).post({url:"/mcp",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}connect(w,$){let O=W([w],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/mcp/{name}/connect",...$,...O})}disconnect(w,$){let O=W([w],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/mcp/{name}/disconnect",...$,...O})}_auth;get auth(){return this._auth??=new iw({client:this.client})}};ow=class ow extends Q{next(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/tui/control/next",...$,...O})}response(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{key:"body",map:"body"}]}]);return($?.client??this.client).post({url:"/tui/control/response",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}};sw=class sw extends Q{appendPrompt(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"body",key:"text"}]}]);return($?.client??this.client).post({url:"/tui/append-prompt",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}openHelp(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/tui/open-help",...$,...O})}openSessions(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/tui/open-sessions",...$,...O})}openThemes(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/tui/open-themes",...$,...O})}openModels(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/tui/open-models",...$,...O})}submitPrompt(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/tui/submit-prompt",...$,...O})}clearPrompt(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/tui/clear-prompt",...$,...O})}executeCommand(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"body",key:"command"}]}]);return($?.client??this.client).post({url:"/tui/execute-command",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}showToast(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"body",key:"title"},{in:"body",key:"message"},{in:"body",key:"variant"},{in:"body",key:"duration"}]}]);return($?.client??this.client).post({url:"/tui/show-toast",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}publish(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{key:"body",map:"body"}]}]);return($?.client??this.client).post({url:"/tui/publish",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}selectSession(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"body",key:"sessionID"}]}]);return($?.client??this.client).post({url:"/tui/select-session",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}_control;get control(){return this._control??=new ow({client:this.client})}};tw=class tw extends Q{dispose(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).post({url:"/instance/dispose",...$,...O})}};aw=class aw extends Q{get(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/path",...$,...O})}};ew=class ew extends Q{get(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/vcs",...$,...O})}};$0=class $0 extends Q{list(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/command",...$,...O})}};w0=class w0 extends Q{log(w,$){let O=W([w],[{args:[{in:"query",key:"directory"},{in:"body",key:"service"},{in:"body",key:"level"},{in:"body",key:"message"},{in:"body",key:"extra"}]}]);return($?.client??this.client).post({url:"/log",...$,...O,headers:{"Content-Type":"application/json",...$?.headers,...O.headers}})}agents(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/agent",...$,...O})}skills(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/skill",...$,...O})}};O0=class O0 extends Q{status(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/lsp",...$,...O})}};f0=class f0 extends Q{status(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).get({url:"/formatter",...$,...O})}};B0=class B0 extends Q{subscribe(w,$){let O=W([w],[{args:[{in:"query",key:"directory"}]}]);return($?.client??this.client).sse.get({url:"/event",...$,...O})}};L$=class L$ extends Q{static __registry=new Iw;constructor(w){super(w);L$.__registry.set(this,w?.key)}_global;get global(){return this._global??=new jw({client:this.client})}_auth;get auth(){return this._auth??=new Aw({client:this.client})}_project;get project(){return this._project??=new Pw({client:this.client})}_pty;get pty(){return this._pty??=new xw({client:this.client})}_config;get config(){return this._config??=new Cw({client:this.client})}_tool;get tool(){return this._tool??=new kw({client:this.client})}_worktree;get worktree(){return this._worktree??=new bw({client:this.client})}_experimental;get experimental(){return this._experimental??=new cw({client:this.client})}_session;get session(){return this._session??=new dw({client:this.client})}_part;get part(){return this._part??=new vw({client:this.client})}_permission;get permission(){return this._permission??=new yw({client:this.client})}_question;get question(){return this._question??=new mw({client:this.client})}_provider;get provider(){return this._provider??=new lw({client:this.client})}_find;get find(){return this._find??=new pw({client:this.client})}_file;get file(){return this._file??=new nw({client:this.client})}_mcp;get mcp(){return this._mcp??=new rw({client:this.client})}_tui;get tui(){return this._tui??=new sw({client:this.client})}_instance;get instance(){return this._instance??=new tw({client:this.client})}_path;get path(){return this._path??=new aw({client:this.client})}_vcs;get vcs(){return this._vcs??=new ew({client:this.client})}_command;get command(){return this._command??=new $0({client:this.client})}_app;get app(){return this._app??=new w0({client:this.client})}_lsp;get lsp(){return this._lsp??=new O0({client:this.client})}_formatter;get formatter(){return this._formatter??=new f0({client:this.client})}_event;get event(){return this._event??=new B0({client:this.client})}}});function N0(w){if(!w?.fetch)w={...w,fetch:(f)=>{return f.timeout=!1,fetch(f)}};if(w?.directory){let f=/[^\x00-\x7F]/.test(w.directory)?encodeURIComponent(w.directory):w.directory;w.headers={...w.headers,"x-opencode-directory":f}}let $=f$(w);return new L$({client:$})}var E0=Y(()=>{g$();G0();Dw()});async function U0(w){let $=await J0(w.db),O={...$[w.key],...w.state};return await Bun.write(w.db,JSON.stringify({...$,[w.key]:O})),O}async function W0(w){return(await J0(w.db))[w.key]}async function J0(w){let $=Bun.file(w);if(!await $.exists())return{};return await $.json()}var y={};P(y,{use:()=>m1,register:()=>y1});async function y1(w){if(Bun.env.OPENCODE_CLIENT)await U0({db:Z0,key:Bun.env.OPENCODE_CLIENT,state:{hostname:w.serverUrl.hostname,port:w.serverUrl.port,seenAt:new Date().toISOString(),password:Bun.env.OPENCODE_SERVER_PASSWORD,username:Bun.env.OPENCODE_SERVER_USERNAME}});return d$({url:String(w.serverUrl),password:Bun.env.OPENCODE_SERVER_PASSWORD,username:Bun.env.OPENCODE_SERVER_USERNAME,directory:w.directory})}async function m1(w){let $={desktop:async()=>{let f=await W0({db:Z0,key:"desktop"});if(!f)return;return d$({url:`http://${f.hostname??"127.0.0.1"}:${f.port}`,username:f.username,password:f.password,directory:w.project})},config:async()=>{let f=w?.opencode?.server;if(!f?.url)return;return d$({directory:w.project,...f})}},O=w?.opencode?.lookup??["desktop","config"];for(let f of O){let B=await $[f]?.();if(!B)continue;let G=await B.global.health();if(!G.data?.healthy){console.warn(`${f} server is not healthy: ${JSON.stringify(G.error)}`);continue}return console.debug(`Using ${f}: ${G.data.version}`),B}throw Error(`Opencode server not found using strategies: ${O.join(", ")}`)}function d$(w){return N0({directory:w.directory,baseUrl:w.url,headers:w.username&&w.password?{Authorization:`Basic ${btoa(`${w.username}:${w.password}`)}`}:void 0})}var Z0;var L0=Y(()=>{E0();Z0=`${Bun.env.HOME}/Library/Application Support/ai.opencode.desktop/store.json`});function X0(w){return Array.isArray(w)?w.slice():[w]}function Q0(w,$){if(!w)return{};return w.reduce((O,f)=>{let B=$(f);return O[B]=(O[B]??0)+1,O},{})}function v$(w,$){return(w==null?void 0:w.length)>0?w[0]:$}function Y$(w){return(w==null?void 0:w.filter(($)=>!!$))??[]}function D0(w){return new Promise(($)=>setTimeout($,w))}function _0(w){return(...$)=>{try{let O=w(...$);return a1(O)?O.then((f)=>[void 0,f],(f)=>[f,void 0]):[void 0,O]}catch(O){return[O,void 0]}}}function y$(){let w,$,O=new Promise((f,B)=>{w=f,$=B});return{resolve:w,reject:$,promise:O}}function B$(...w){return(...$)=>{return w.slice(1).reduce((O,f)=>f(O),w[0](...$))}}function u1(){}function T0(w,$){return new i1($).parse(w)}function m(w,$){if(!w)return[];let O=Object.entries(w);if(O.length===0)return[];return O.reduce((f,B)=>{return f.push($(B[0],B[1])),f},[])}function S0(w,$=(O)=>O===void 0){if(!w)return{};return Object.keys(w).reduce((O,f)=>{if(!$(w[f]))O[f]=w[f];return O},{})}function o1(w){if(!w||w.length===0)return"";let $=w.toLowerCase();return $.substring(0,1).toUpperCase()+$.substring(1,$.length)}function u(w,...$){var O;if(d(w)){if($.length>0)return u(w.reduce((G,N,E)=>{var U;let Z=String($[E]??""),J=Z.includes(`
|
|
10
|
+
`)&&((U=N.match(/[ \t]*(?=[^\n]*$)/))==null?void 0:U[0]);if(J)Z=Z.replace(/\n(?=[^\n]*?\S)/g,`
|
|
11
|
+
`+J);return G+N+Z},""));w=w[0]}let f=$[0]??((O=w.match(/^[ \t]*(?=\S)/m))==null?void 0:O[0]);return(f?w.replace(new RegExp(`^${f}`,"gm"),""):w).replace(/^[ \t]*\n|\n[ \t]*$/g,"")}function M0(w){if(!w)return"";return w.split(/(?=[A-Z])|[\.\-\s_]/).map(($)=>$.trim()).filter(($)=>!!$).map(($)=>o1($.toLowerCase())).join(" ")}function T(w,$){if(!w)throw $ instanceof Error?$:Error($??"Assertion failed")}function R0(w){return typeof w==="boolean"}function s1(w){return K0(w,"[object Date]")}function x(w){if(typeof w!=="object"||w===null)return!w||w===!0;if(s1(w))return Number.isNaN(w.getTime());let $=w.length;if(Y0($))return $===0;let O=w.size;if(Y0(O))return O===0;return Object.keys(w).length===0}function t1(w){return typeof w==="function"}function V0(w){return w===null||w===void 0}function Y0(w){return typeof w==="number"&&!Number.isNaN(w)}function G$(w){return K0(w,"[object Object]")}function a1(w){return!!w&&t1(w.then)}function z0(w){return typeof w==="string"}function K0(w,$){return Object.prototype.toString.call(w)===$}var l1=class{constructor({units:w,short:$}){this.units=w,this.short=$}parse(w){var $;let O=w.match(/^(-?\d+(?:\.\d+)?) ?(\w+)?s?$/);if(!O)throw Error(`Invalid quantity, cannot parse: ${w}`);let f=O[2];f=(($=this.short)==null?void 0:$[f])||f;let B=Number.parseFloat(O[1]);if(Math.abs(B)>1&&f.endsWith("s"))f=f.substring(0,f.length-1);if(!this.units[f])throw Error(`Invalid unit: ${f}, makes sure it is one of: ${Object.keys(this.units).join(", ")}`);return B*this.units[f]}},p1,n1,i1,r1=class{constructor(w,$,O){this.semaphore=w,this.request=$,this.weight=O}release(){this.semaphore.release(this),this.release=u1}},X$=class{constructor(w){if(this.maxCapacity=w,this.queue=[],w<=0)throw Error("maxCapacity must be > 0");this.capacity=w}get queueLength(){return this.queue.length}async acquire({signal:w,weight:$=1}={}){if($<=0)throw Error("weight must be > 0");if($>this.maxCapacity)throw Error("weight must be \u2264 maxCapacity");let O=y$(),f=new r1(this,O,$);if(w){let B=()=>{let N=this.queue.indexOf(f);if(N>=0)this.queue.splice(N,1),O.reject(w.reason)};w.addEventListener("abort",B);let G=()=>{w.removeEventListener("abort",B)};O.promise.then(G,G)}if(this.capacity<$)this.queue.push(f),await O.promise;else this.capacity-=$;return f}reject(w){this.acquire=()=>Promise.reject(w),this.queue.forEach(($)=>$.request.reject(w)),this.queue=[]}release(w){this.capacity+=w.weight;let $=this.queue[0];if($&&this.capacity>=$.weight)this.capacity-=$.weight,this.queue.shift(),$.request.resolve()}},d;var H=Y(()=>{p1={week:604800000,day:86400000,hour:3600000,minute:60000,second:1000,millisecond:1},n1={w:"week",d:"day",h:"hour",m:"minute",s:"second",ms:"millisecond"},i1=class w extends l1{constructor($){super({units:{...w.units,...$==null?void 0:$.units},short:{...w.shortUnits,...$==null?void 0:$.short}})}static get units(){return p1}static get shortUnits(){return n1}};d=(()=>Array.isArray)()});var Q$={};P(Q$,{use:()=>e1,getProjectLabel:()=>$O,getProjectHint:()=>wO});async function e1(w,$){let{data:O,error:f}=await w.project.current({directory:$??process.cwd()});T(O,`Cannot use project: ${JSON.stringify(f)}`);let B=O.id.slice(0,5);return{...O,label:O.name??O.worktree,hint:O.name?`${O.worktree} - ${B}`:B}}function $O(w){return w.name??w.worktree}function wO(w){let $=w.id.slice(0,5);return w.name?`${w.worktree} - ${$}`:$}var q0=Y(()=>{H()});var m$=Y(()=>{L0();q0()});import{loadConfig as OO}from"c12";async function l(w){let{config:$,_configFile:O}=await OO({name:"teammate",cwd:w.cwd,configFile:w.configFile,overrides:w.overries,packageJson:!1});return console.debug(`Config loaded from: ${O}`),$}var D$=()=>{};var H0={};P(H0,{default:()=>NO});import{defineCommand as fO,option as BO}from"@bunli/core";import{z as GO}from"zod";var NO;var I0=Y(()=>{m$();D$();NO=fO({name:"health",description:"Check opencode server health",options:{config:BO(GO.string().optional(),{description:"Teammate config file to use",short:"c"})},handler:async({flags:w})=>{let $=await l({configFile:w.config}),O=await y.use($),f=await Q$.use(O,$.project);console.log({project:f})}})});function _(w){return($)=>{if(!process.stdout.isTTY||process.env.NO_COLOR)return $;return`\x1B[${w}m${$}\x1B[0m`}}function EO(w){return w.replace(/\x1b\[[0-9;]*m/g,"")}async function P0(w){process.stdout.write(w);for await(let $ of console)return $;return""}async function _$(w,$={}){let O=$.default?` (${$.default})`:"",f=`${w}${O} `;while(!0){let G=(await P0(f)).trim()||$.default||"";if($.schema){let N=await $.schema["~standard"].validate(G);if(N.issues){console.error(q.red("Invalid input:"));for(let E of N.issues)console.error(q.dim(` \u2022 ${E.message}`));console.error();continue}return N.value}if($.validate){let N=$.validate(G);if(N===!0)return G;else if(typeof N==="string"){console.error(`\u2717 ${N}`);continue}else{console.error("\u2717 Invalid input");continue}}return G}}async function T$(w,$={}){let O=$.default===!0?"Y/n":$.default===!1?"y/N":"y/n",f=`${w} (${O}) `;while(!0){let G=(await P0(f)).trim().toLowerCase();if(!G&&$.default!==void 0)return $.default;if(G==="y"||G==="yes")return!0;if(G==="n"||G==="no")return!1;console.error("\u2717 Please answer with y/yes or n/no")}}async function x0(w,$){let{options:O,default:f}=$,B=f?O.findIndex((G)=>G.value===f):0;if(B===-1)B=0;return console.log(w),process.stdout.write(JO),l$(O,B),new Promise((G)=>{process.stdin.setRawMode(!0),process.stdin.resume();let N=()=>{process.stdin.setRawMode(!1),process.stdin.pause(),process.stdout.write(ZO)};process.stdin.on("data",(E)=>{let U=E.toString();if(U==="\x1B[A")B=Math.max(0,B-1),l$(O,B);else if(U==="\x1B[B")B=Math.min(O.length-1,B+1),l$(O,B);else if(U==="\r"||U===`
|
|
12
|
+
`){N();for(let J=0;J<O.length;J++)process.stdout.write(`${p}1A${A0}`);let Z=O[B];if(Z)console.log(`\u2713 ${Z.label}`),G(Z.value)}else if(U==="\x03"||U==="\x1B")N(),process.exit(0)})})}function l$(w,$){for(let O=0;O<w.length;O++)process.stdout.write(`${p}1A`);w.forEach((O,f)=>{process.stdout.write(A0+WO);let B=f===$?"\u276F ":" ",G=O.hint?` (${O.hint})`:"";console.log(`${B}${O.label}${G}`)})}async function S$(w,$={}){return process.stdout.write(w+" "),new Promise((O)=>{let f="";process.stdin.setRawMode(!0),process.stdin.resume();let B=()=>{process.stdin.setRawMode(!1),process.stdin.pause(),console.log()};process.stdin.on("data",async(G)=>{let N=G.toString();if(N==="\r"||N===`
|
|
13
|
+
`)if(B(),$.schema){let E=await $.schema["~standard"].validate(f);if(E.issues){console.error(q.red("Invalid input:"));for(let U of E.issues)console.error(q.dim(` \u2022 ${U.message}`));console.error(),S$(w,$).then(O);return}O(E.value)}else if($.validate){let E=$.validate(f);if(E===!0)O(f);else console.error(`\u2717 ${typeof E==="string"?E:"Invalid input"}`),S$(w,$).then(O)}else O(f);else if(N==="\x03")B(),process.exit(0);else if(N==="\x7F"||N==="\b"){if(f.length>0)f=f.slice(0,-1),process.stdout.write("\b \b")}else if(N.length===1&&N>=" ")f+=N,process.stdout.write("*")})})}function LO(w){let $=typeof w==="string"?{text:w}:w||{},O=!1,f=0,B=null,G=$.text||"",N=(U,Z)=>{process.stdout.write(`${h0}${j0}${U} ${Z}`)},E={start(U){if(O)return;if(O=!0,U!==void 0)G=U;process.stdout.write("\x1B[?25l"),B=setInterval(()=>{let Z=p$[f];N(Z,G),f=(f+1)%p$.length},80)},stop(U){if(!O)return;if(O=!1,B)clearInterval(B),B=null;if(process.stdout.write(h0+j0),process.stdout.write("\x1B[?25h"),U)console.log(U)},succeed(U){this.stop(),console.log(`\u2705 ${U||G}`)},fail(U){this.stop(),console.log(`\u274C ${U||G}`)},warn(U){this.stop(),console.log(`\u26A0\uFE0F ${U||G}`)},info(U){this.stop(),console.log(`\u2139\uFE0F ${U||G}`)},update(U){if(G=U,O)N(p$[f],G)}};return process.on("exit",()=>E.stop()),process.on("SIGINT",()=>{E.stop(),process.exit(0)}),E}var D,q,UO="\x1B",p,A0,WO,JO,ZO,p$,h0="\x1B[2K",j0="\x1B[G",gf,M$;var R$=Y(()=>{D={black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37,gray:90,brightRed:91,brightGreen:92,brightYellow:93,brightBlue:94,brightMagenta:95,brightCyan:96,brightWhite:97,bgRed:41,bgGreen:42,bgYellow:43,bgBlue:44,bgMagenta:45,bgCyan:46,bgWhite:47,bold:1,dim:2,italic:3,underline:4,strikethrough:9,reset:0};q={black:_(D.black),red:_(D.red),green:_(D.green),yellow:_(D.yellow),blue:_(D.blue),magenta:_(D.magenta),cyan:_(D.cyan),white:_(D.white),gray:_(D.gray),brightRed:_(D.brightRed),brightGreen:_(D.brightGreen),brightYellow:_(D.brightYellow),brightBlue:_(D.brightBlue),brightMagenta:_(D.brightMagenta),brightCyan:_(D.brightCyan),brightWhite:_(D.brightWhite),bgRed:_(D.bgRed),bgGreen:_(D.bgGreen),bgYellow:_(D.bgYellow),bgBlue:_(D.bgBlue),bgMagenta:_(D.bgMagenta),bgCyan:_(D.bgCyan),bgWhite:_(D.bgWhite),bold:_(D.bold),dim:_(D.dim),italic:_(D.italic),underline:_(D.underline),strikethrough:_(D.strikethrough),reset:_(D.reset),strip:EO},p=`${UO}[`,A0=`${p}2K`,WO=`${p}G`,JO=`${p}?25l`,ZO=`${p}?25h`;p$=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];gf={prompt:Object.assign(_$,{confirm:T$,select:x0,password:S$,text:(w,$)=>_$(w,$),multiselect:async(w,$)=>{let{options:O}=$,f=[];console.log(w);for(let B of O)if(await T$(`Select ${B.label}?`,{default:!1}))f.push(B.value);return f}}),spinner:LO,colors:q},M$=Object.assign(_$,{confirm:T$,select:x0,password:S$,text:(w,$)=>_$(w,$),multiselect:async(w,$)=>{let{options:O}=$,f=[];console.log(w);for(let B of O)if(await T$(`Select ${B.label}?`,{default:!1}))f.push(B.value);return f}})});async function*n$(w,$){let O=T0($?.interval??"1s");while(!0){let f=await w();if(Array.isArray(f)){if(x(f)&&$?.exitOnEmpty)break;yield*f}else if(f===void 0&&$?.exitOnEmpty)break;else yield f;await D0(O)}}async function n(w,$){for await(let O of n$(w,$))if(O)return O;throw Error("Timeout: waiting for condition")}var V$=Y(()=>{H()});async function k0(w,$){let{data:O}=await w.project.current({directory:$??process.cwd()});if(O&&O.id!=="global")return O.worktree;let{data:f,error:B}=await w.project.list();return T(B===void 0,`Failed to list projects: ${B}`),T(f,"No projects found"),T(f.length>0,`No projects found: ${f.length}`),M$.select("Select a project",{options:f.map((G)=>({label:G.name??G.worktree,value:G.worktree,hint:G.name?`${G.worktree} - ${G.id.slice(0,5)}`:G.id.slice(0,5)}))})}function b0(w){return w.name??w.worktree}var i$=Y(()=>{R$();H()});var N$,r$;var o$=Y(()=>{N$=class N$ extends Error{output;constructor(w,$){let O=w.stdout.toString().trim()||void 0,B=(w.stderr.toString().trim()||void 0)??O??"Unknown shell error";super(B,{cause:$.cause});this.output=w}};r$=class r$ extends Error{exitCode;constructor(w){let $=w.exitCode;super(`Exited with code '${$}'`);this.exitCode=$}}});var I={};P(I,{use:()=>YO,create:()=>c0});function YO(w){if(w instanceof Bun.$.Shell)return c0(w);if(d0 in w)return w;throw Error("Invalid client input")}function c0(w){let $=w,f=Object.assign((B,...G)=>{let N=0,E=[...B],U=G.flatMap((L,z)=>{if(!G$(L))return[L];let M=m(S0(L),(X,S)=>{if(R0(S))return`--${X}`;if(d(S))return`--${X}=${Y$(S).join(",")}`;return`--${X}='${String(S)}'`});if(x(M))return[""];let F=M.length-1;return E.splice(z+1+N,0,...Array(F).fill(" ")),N+=F,M}),Z=Object.assign(E,{raw:[...E]}),J=$(Z,...U);return XO(J)},{[d0]:!0,cwd(B){return $=$.cwd(B),f},env(B){return $=$.env(B),f}});return f}function XO(w){return{json:async($)=>{let O=await w.quiet($?.quiet).nothrow(),[f,B]=await _0(()=>O.json())();if(B)return B;throw new N$(O,{cause:f})},text:async($)=>{let O=await w.quiet($?.quiet).nothrow(),f=O.stdout.toString().trim()||void 0;if(O.exitCode!==0)return[new N$(O,{cause:new r$(O)}),f];return[void 0,f]}}}var d0;var v0=Y(()=>{H();o$();d0=Symbol("shell_client")});var z$=Y(()=>{v0();o$()});var j={};P(j,{use:()=>QO,update:()=>i,show:()=>TO,list:()=>t$,find:()=>K$,create:()=>a$,close:()=>_O,claim:()=>DO});async function QO(w,$,O){if("status"in $&&!O?.force)return $;return v$(await t$(w,{...O,ids:[$.id]}))}async function i(w,$,O={}){let B=await I.use(w)`bd update ${$.id} ${O} --json`.json(),[G]=B;return T(G,`Issue '${$.id}' not found`),G}async function a$(w,$){return await I.use(w)`bd create ${$} --json`.json()}async function DO(w,$,O={}){let B=await I.use(w)`bd update ${$.id} ${O} --claim --json`.json(),[G]=B;return T(G,`Issue '${$.id}' not found`),G}async function _O(w,$,O={}){let B=await I.use(w)`bd close ${$.id} ${O} --json`.json(),[G]=B;return T(G,`Issue '${$.id}' not found`),G}async function TO(w,$){return I.use(w)`bd show ${$.id}`.text()}var t$,K$;var q$=Y(()=>{H();z$();t$=Object.assign(async(w,$={})=>{if(x($.ids))return[];return await I.use(w)`bd list ${$} --json`.json()},{ready:async(w,$={})=>{return await I.use(w)`bd ready ${$} --json`.json()}});((rf)=>{async function w($,O,f){return(await t$($,f)).find((G)=>G.external_ref===O)}rf.byExternalRef=w})(K$||={})});var r={};P(r,{use:()=>RO,stuck:()=>SO,state:()=>e$,done:()=>MO});async function SO(w,$,O){let f=await e$(w,$,"stuck");return await i(w,{id:f.agent},{"add-label":y0(O.context),description:O.reason}),f}async function MO(w,$,O={}){let f=await e$(w,$,"done");return await i(w,{id:f.agent},{"add-label":y0(O.context),description:""}),f}async function e$(w,$,O){return await I.use(w)`bd agent state gram-${$} ${O} --json`.json()}async function RO(w,$){let O=I.use(w),f="slug"in $?`gram-${$.slug}`:$.id;return await O`bd agent show ${f} --json`.json()}function y0(w){if(!w)return;let $=Y$(m(w,(O,f)=>f&&`${O}:${f}`));return x($)?void 0:$}var m0=Y(()=>{H();z$();q$()});var l0=Y(()=>{z$()});var F$=Y(()=>{m0();q$();l0()});var o={};P(o,{update:()=>KO,find:()=>n0,create:()=>zO,SpecificationInput:()=>VO,Specification:()=>p0});import{z as k}from"zod";async function zO(w,$){let O=await a$(w,{type:"epic",title:$.title,description:$.description,"external-ref":$.file});return ww(O)}async function KO(w,$,O){let f=await i(w,{id:$.issueId},{type:"epic",title:O.title,description:O.description,"external-ref":O.file});return ww(f)}function ww(w){return p0.parse({issueId:w.id,file:w.external_ref,title:w.title,description:w.description})}var p0,VO,n0;var i0=Y(()=>{q$();p0=k.object({issueId:k.string(),file:k.string(),title:k.string(),description:k.string().optional()}),VO=k.object({file:k.string(),title:k.string(),description:k.string().optional()});((tf)=>{async function w($,O){let f=await K$.byExternalRef($,O,{type:"epic"});return f&&ww(f)}tf.byFile=w})(n0||={})});var s={};P(s,{watch:()=>s0,use:()=>HO,scan:()=>t0,Frontmatter:()=>FO});import*as o0 from"fs";import*as H$ from"path";import{z as r0}from"zod";function HO(w){if(w.watch)return s0(w);else return t0(w)}async function*s0(w){let $=a0(w.targets),O=new Map,f=[],B,G=o0.watch(w.cwd,async(N,E)=>{if(N==="change"&&E){if(!$.match(E))return;let U=Ow(w.cwd,E),Z=Bun.hash(await U.file.text());if(O.get(E)===Z)return;if(O.set(E,Z),f.push(Ow(w.cwd,E)),B)B.resolve(E),B=void 0}});try{while(!0){let N=f.shift();if(N)yield N;else B=y$(),await B.promise}}finally{G.close()}}async function*t0(w){let{targets:$,isIgnored:O}=a0(w.targets);for(let f of $)for await(let B of f.scan({cwd:w.cwd})){if(O(B))continue;yield Ow(w.cwd,B)}}function a0(w){let $=[],O=[];for(let B of X0(w))if(B.startsWith("!"))O.push(new Bun.Glob(B));else $.push(new Bun.Glob(B));T(!x($),"At least one target is required");function f(B){return!qO.match(B)||O.every((G)=>!G.match(B))}return{targets:$,isIgnored:f,match:(B)=>!f(B)&&$.some((G)=>G.match(B))}}function Ow(w,$){let O=H$.join(w,$);return{filename:$,filepath:H$.parse(O),file:Bun.file(O)}}var qO,FO;var e0=Y(()=>{H();qO=new Bun.Glob("**/*.md"),FO=r0.object({issue:r0.string().optional()})});var fw=Y(()=>{i0();e0()});function w1(w,$){let O=$?.delimiter??"---";if(!w.trimStart().startsWith(O))return{metadata:{},content:w};let f=w.split(`
|
|
14
|
+
`),B=-1,G=-1;for(let J=0;J<f.length;J++)if(f[J]?.trim()===O){B=J;break}if(B===-1)return{metadata:{},content:w};for(let J=B+1;J<f.length;J++)if(f[J]?.trim()===O){G=J;break}if(G===-1)return{metadata:{},content:w};let E=f.slice(B+1,G).join(`
|
|
15
|
+
`),U=hO(E),Z=f.slice(G+1).join(`
|
|
16
16
|
`).replace(/^\n+/,"");return{metadata:U,content:Z}}function IO(w,$){let O=$?.delimiter??"---",f=Bw(w);return`${O}
|
|
17
17
|
${f}${O}
|
|
18
18
|
`}function O1(w,$,O){return`${IO($,O)}
|
|
19
19
|
${w}`}function hO(w){let $={},O=w.split(`
|
|
20
|
-
`),f=[{obj:$,indent:-1}];for(let B of O){if(!B.trim()||B.trim().startsWith("#"))continue;let G=B.length-(B.trimStart()?.length??0),
|
|
20
|
+
`),f=[{obj:$,indent:-1}];for(let B of O){if(!B.trim()||B.trim().startsWith("#"))continue;let G=B.length-(B.trimStart()?.length??0),N=B.trim();while(f.length>1){let L=f[f.length-1];if(!L||G>L.indent)break;f.pop()}let E=N.indexOf(":");if(E===-1)continue;let U=N.substring(0,E).trim(),Z=N.substring(E+1).trim(),J=f[f.length-1]?.obj;if(!J)continue;if(Z===""){let L={};J[U]=L,f.push({obj:L,indent:G})}else if(J)J[U]=jO(Z)}return $}function jO(w){if(w.startsWith('"')&&w.endsWith('"')||w.startsWith("'")&&w.endsWith("'"))return w.slice(1,-1);if(w==="true")return!0;if(w==="false")return!1;if(w==="null"||w==="~")return null;let $=Number(w);if(!Number.isNaN($)&&w!=="")return $;return w}function Bw(w,$=0){let O=" ".repeat($),f="";for(let[B,G]of Object.entries(w))if(V0(G))f+=`${O}${B}: null
|
|
21
21
|
`;else if(G$(G)&&!d(G))f+=`${O}${B}:
|
|
22
|
-
`,f+=Bw(G,$+1);else if(z0(G)){let
|
|
23
|
-
`);f+=`${O}${B}: ${
|
|
22
|
+
`,f+=Bw(G,$+1);else if(z0(G)){let N=G.includes(":")||G.includes("#")||G.includes(`
|
|
23
|
+
`);f+=`${O}${B}: ${N?`"${G}"`:G}
|
|
24
24
|
`}else if(d(G)){f+=`${O}${B}:
|
|
25
|
-
`;for(let
|
|
26
|
-
${Bw(
|
|
25
|
+
`;for(let N of G)if(G$(N)&&!d(N))f+=`${O}-
|
|
26
|
+
${Bw(N,$+2)}`;else f+=`${O} - ${N}
|
|
27
27
|
`}else f+=`${O}${B}: ${G}
|
|
28
|
-
`;return f}var f1=Y(()=>{H()});import*as I$ from"path";async function*B1(w){let $=Bun.$.cwd(w.project);for await(let O of w.source){let{file:f,filepath:B}=O,{metadata:G,content:
|
|
29
|
-
Spec: ${
|
|
30
|
-
`},Z=s.Frontmatter.safeParse(G),J=Z.success&&Z.data.issue?{issueId:Z.data.issue}:await o.find.byFile($,U.file),L=J?await o.update($,J,U):await o.create($,U),z=Object.assign({},G,{issue:L.issueId});await Bun.write(f,O1(
|
|
28
|
+
`;return f}var f1=Y(()=>{H()});import*as I$ from"path";async function*B1(w){let $=Bun.$.cwd(w.project);for await(let O of w.source){let{file:f,filepath:B}=O,{metadata:G,content:N}=w1(await f.text()),E=I$.relative(w.project,I$.format(B)),U={file:E,title:M0(B.name),description:u`
|
|
29
|
+
Spec: ${E}
|
|
30
|
+
`},Z=s.Frontmatter.safeParse(G),J=Z.success&&Z.data.issue?{issueId:Z.data.issue}:await o.find.byFile($,U.file),L=J?await o.update($,J,U):await o.create($,U),z=Object.assign({},G,{issue:L.issueId});await Bun.write(f,O1(N,z)),yield{asset:O,spec:L}}}var G1=Y(()=>{H();fw();f1()});import*as Gw from"fs/promises";async function N1(w){let{client:$,directory:O}=w,f=await PO.acquire();try{let B=await $.project.current({directory:O});T(B.data,`Failed to initialize environment: ${B.error}`);let G=b0(B.data);if(!B.data.commands?.start){let E=await M$.confirm(`Opencode project ${G} does not have a start command. Do you want to continue?`,{default:!1});T(E,"Failed to initialize environment: user asked to stop")}let N=await $.worktree.create({directory:O,worktreeCreateInput:{name:w.name}});return T(N.data,`Failed to initialize worktree: ${JSON.stringify(N.error)}`),N.data}finally{f.release()}}async function E1(w){let{client:$,directory:O}=w,f=await $.worktree.remove({directory:O,worktreeRemoveInput:{directory:w.worktreeDirectory}});return T(f.data,`Failed to remove worktree: ${JSON.stringify(f.error)}`),console.log("Worktree removed"),f.data}async function U1(w){return(await Promise.all([Gw.exists(`${w.directory}/.opencode`),Gw.exists(`${w.directory}/.git`)])).every((O)=>O)}var PO;var W1=Y(()=>{R$();H();i$();PO=new X$(1)});var{$:CO}=globalThis.Bun;var h$;var J1=Y(()=>{V$();W1();h$=class h${client;directory;worktree;ready;constructor(w,$,O){this.client=w;this.directory=$;this.worktree=O;this.ready=n(()=>U1(O),{interval:"100ms"})}get $(){return CO.cwd(this.worktree.directory)}static async init(w){let $=await N1(w),O=new h$(w.client,w.directory,$);return await O.ready,O}async[Symbol.asyncDispose](){await E1({client:this.client,directory:this.directory,worktreeDirectory:this.worktree.directory}).catch((w)=>console.error(w))}}});async function Z1(w){let U=[];try{let $=gO(w.issue.id);$(`Start working on ${w.issue.id}...`);const O=Xw(U,await h$.init({client:w.client,directory:w.directory,name:w.issue.id}),1);$(`Environment ready: ${O.worktree.directory}`);let f=await j.claim(O.$,w.issue);$(`Issue claimed: ${f.id}`);let B=await w.client.session.create({directory:O.worktree.directory,title:`${f.id}: ${f.title}`});T(B.data,`Failed to start the session: ${JSON.stringify(B.error)}`);$(`Session: ${B.data.id}`);let G=await w.client.session.command({sessionID:B.data.id,directory:O.worktree.directory,command:"fake_work",arguments:`${f.id}`});T(G.data,`Failed to send the /work command: ${JSON.stringify(G.error)}`);let N=await r.use(O.$,B.data);while(N.agent_state!=="done"){if(N.agent_state==="stuck")$(`Agent is stuck: ${N.title}`),await n(async()=>{return N=await r.use(O.$,B.data),N.agent_state!=="stuck"},{interval:"1s"}),$(`Agent is ready to continue: ${N.agent_state}`);else{$(`Agent needs follow up, '${N.agent_state}'...`);let M=await w.client.session.prompt({sessionID:B.data.id,directory:O.worktree.directory,parts:[bO(N.agent_state)]});T(M.data,`Failed to follow up: ${JSON.stringify(M.error)}`)}N=await r.use(O.$,B.data)}$("Agent work is done");let E=await w.client.session.messages({sessionID:B.data.id,directory:O.worktree.directory});T(E.data,`Failed to fetch session messages: ${E.error}`);$(`Session messages: ${E.data.length}`);f=await j.close(O.$,w.issue,{reason:"Completed"});T(f,"Failed to close the issue");return f}catch(Z){var J=Z,L=1}finally{var z=Qw(U,J,L);z&&await z}}function bO(w){return{type:"text",text:u`
|
|
31
31
|
You are currently registered as '${w}'.
|
|
32
32
|
- If you are done with the task please notify via the i_am_done tool.
|
|
33
33
|
- If you are stuck and need human help, please notify via the i_am_stuck tool.
|
|
34
34
|
- If you need more time to work on the task, please continue working and update your status when needed.
|
|
35
|
-
`}}function gO(w){return($)=>{console.log(`[work:${w}] ${$}`)}}var L1=Y(()=>{H();F$();J1();V$()});var Y1=()=>{};var X1=Y(()=>{H();F$();Y1()});var
|
|
36
|
-
`)}}})});import{createCLI as pO}from"@bunli/core";var M1={health:()=>Promise.resolve().then(() => (I0(),H0)),work:()=>Promise.resolve().then(() => (_1(),D1)),spec:{sync:()=>Promise.resolve().then(() => (
|
|
35
|
+
`}}function gO(w){return($)=>{console.log(`[work:${w}] ${$}`)}}var L1=Y(()=>{H();F$();J1();V$()});var Y1=()=>{};var X1=Y(()=>{H();F$();Y1()});var Nw=Y(()=>{G1();L1();X1()});var D1={};P(D1,{default:()=>vO});import{defineCommand as dO,option as t}from"@bunli/core";import{z as a}from"zod";var vO,yO;var _1=Y(()=>{R$();H();V$();m$();i$();F$();Nw();D$();vO=dO({name:"work",alias:["ralph"],description:"Starts RALPH loop on opened tasks",options:{concurrency:t(a.coerce.number().min(1).default(1),{description:"How many workers can be spawned at the same time",short:"c"}),task:t(a.string().optional(),{description:"Task (including subtasks) to work on. When not provided, workers can be spawned for any ready tasks.",short:"t"}),"wait-on-idle":t(a.boolean().default(!1),{description:"If no task is available, wait for one to become available."}),"max-dispatches":t(a.coerce.number().min(1).default(1/0),{description:"Limit the number of tasks that can be dispatched to workers.",short:"n"}),project:t(a.string().optional(),{description:"Project to work on. When not provided, workers can be spawned for any ready tasks.",short:"p"}),config:t(a.string().optional(),{description:"Teammate config file to use",short:"c"})},handler:async({flags:w,colors:$})=>{let O=await l({configFile:w.config,overries:{project:w.project}}),f=await y.use(O),B=await k0(f,O.project),G=Bun.$.cwd(B),N=new Set,{"wait-on-idle":E,"max-dispatches":U}=w,Z=n$(()=>j.list.ready(G,{parent:w.task}),{interval:"1 second",exitOnEmpty:!E}),J=new X$(w.concurrency);for await(let F of Z){let X=await J.acquire();if(N.add(F.id),Z1({client:f,directory:B,issue:F}).catch((S)=>console.error(S)).finally(()=>X.release()),N.size>=U)break}await n(async()=>J.queueLength===0&&J.maxCapacity===J.capacity,{interval:"1 second"});let L=await j.list(G,{all:!0,ids:Array.from(N.values())}),z=Q0(L,(F)=>F.status),M=m(z,(F,X)=>{return(yO[F]??$.reset)(`${X} ${F}`)});console.log($.gray(`Dispatched: ${$.italic(Array.from(N.values()).join(", "))}`)),console.log(`Tasks: ${M.join(", ")}`)}}),yO={open:B$(q.yellow,q.italic),in_progress:B$(q.yellow,q.italic),blocked:B$(q.red,q.bold,q.underline),deferred:q.red,closed:B$(q.green,q.bold)}});var T1={};P(T1,{default:()=>uO});import{defineCommand as mO,option as Ew}from"@bunli/core";import{z as Uw}from"zod";import*as e from"path";var uO;var S1=Y(()=>{D$();Nw();fw();uO=mO({name:"sync",description:"Syncs the specifications with beads epics",options:{target:Ew(Uw.string().transform((w)=>e.resolve(w)).optional(),{description:"Specification file or directory to sync"}),watch:Ew(Uw.boolean().default(!1),{description:"Watch target for changes",short:"w"}),config:Ew(Uw.string().optional(),{description:"Teammate config file to use",short:"c"})},handler:async({flags:w,colors:$,spinner:O})=>{let{specifications:f,project:B}=await l({configFile:w.config,overries:{specifications:w.target}}),G=B1({project:B,source:s.use({cwd:B,targets:f,watch:w.watch})});if(w.watch)O("Watching for changes...").start();for await(let N of G){let{asset:E,spec:U}=N,Z=e.relative(B,e.format(E.filepath));process.stdout.write(`\r\x1B[K${$.bold(Z)}: ${U.issueId}
|
|
36
|
+
`)}}})});import{createCLI as pO}from"@bunli/core";var M1={health:()=>Promise.resolve().then(() => (I0(),H0)),work:()=>Promise.resolve().then(() => (_1(),D1)),spec:{sync:()=>Promise.resolve().then(() => (S1(),T1))}};var R1="0.2.0-next.7";var V1=await pO({name:"mate",version:R1,commands:{directory:`${import.meta.dir}/commands`}});await V1.load(M1);await V1.run();
|
|
@@ -4,19 +4,24 @@ import {
|
|
|
4
4
|
__export,
|
|
5
5
|
all,
|
|
6
6
|
assert,
|
|
7
|
+
castArray,
|
|
7
8
|
dedent,
|
|
8
9
|
first,
|
|
9
10
|
isArray,
|
|
10
11
|
isBoolean,
|
|
11
12
|
isEmpty,
|
|
13
|
+
isNullish,
|
|
12
14
|
isObject,
|
|
15
|
+
isString,
|
|
13
16
|
listify,
|
|
14
17
|
objectify,
|
|
15
18
|
shake,
|
|
16
19
|
sift,
|
|
20
|
+
title,
|
|
17
21
|
toResult,
|
|
18
|
-
tryit
|
|
19
|
-
|
|
22
|
+
tryit,
|
|
23
|
+
withResolvers
|
|
24
|
+
} from "../shared/plugin-21m0st9a.js";
|
|
20
25
|
|
|
21
26
|
// src/assets/index.ts
|
|
22
27
|
var {Glob, $ } = globalThis.Bun;
|
|
@@ -2741,7 +2746,31 @@ class ChainError extends Error {
|
|
|
2741
2746
|
}
|
|
2742
2747
|
}
|
|
2743
2748
|
|
|
2749
|
+
// src/utils/config/loader.ts
|
|
2750
|
+
import { loadConfig } from "c12";
|
|
2751
|
+
async function load(options) {
|
|
2752
|
+
const { config, _configFile } = await loadConfig({
|
|
2753
|
+
name: "teammate",
|
|
2754
|
+
cwd: options.cwd,
|
|
2755
|
+
configFile: options.configFile,
|
|
2756
|
+
overrides: options.overries,
|
|
2757
|
+
packageJson: false
|
|
2758
|
+
});
|
|
2759
|
+
return config;
|
|
2760
|
+
}
|
|
2761
|
+
|
|
2762
|
+
// src/use-cases/sync-specifications.ts
|
|
2763
|
+
import * as path3 from "path";
|
|
2764
|
+
|
|
2744
2765
|
// src/adapters/specifications/issues.ts
|
|
2766
|
+
var exports_issues2 = {};
|
|
2767
|
+
__export(exports_issues2, {
|
|
2768
|
+
update: () => update2,
|
|
2769
|
+
find: () => find2,
|
|
2770
|
+
create: () => create3,
|
|
2771
|
+
SpecificationInput: () => SpecificationInput,
|
|
2772
|
+
Specification: () => Specification
|
|
2773
|
+
});
|
|
2745
2774
|
import { z } from "zod";
|
|
2746
2775
|
|
|
2747
2776
|
// src/adapters/beads/issues.ts
|
|
@@ -2926,6 +2955,24 @@ var SpecificationInput = z.object({
|
|
|
2926
2955
|
title: z.string(),
|
|
2927
2956
|
description: z.string().optional()
|
|
2928
2957
|
});
|
|
2958
|
+
async function create3(client2, data) {
|
|
2959
|
+
const issue = await create2(client2, {
|
|
2960
|
+
type: "epic",
|
|
2961
|
+
title: data.title,
|
|
2962
|
+
description: data.description,
|
|
2963
|
+
"external-ref": data.file
|
|
2964
|
+
});
|
|
2965
|
+
return createFromIssue(issue);
|
|
2966
|
+
}
|
|
2967
|
+
async function update2(client2, input, data) {
|
|
2968
|
+
const issue = await update(client2, { id: input.issueId }, {
|
|
2969
|
+
type: "epic",
|
|
2970
|
+
title: data.title,
|
|
2971
|
+
description: data.description,
|
|
2972
|
+
"external-ref": data.file
|
|
2973
|
+
});
|
|
2974
|
+
return createFromIssue(issue);
|
|
2975
|
+
}
|
|
2929
2976
|
var find2;
|
|
2930
2977
|
((find) => {
|
|
2931
2978
|
async function byFile(client2, ref) {
|
|
@@ -2943,15 +2990,264 @@ function createFromIssue(issue) {
|
|
|
2943
2990
|
});
|
|
2944
2991
|
}
|
|
2945
2992
|
// src/adapters/specifications/assets.ts
|
|
2993
|
+
var exports_assets = {};
|
|
2994
|
+
__export(exports_assets, {
|
|
2995
|
+
watch: () => watch2,
|
|
2996
|
+
use: () => use4,
|
|
2997
|
+
scan: () => scan,
|
|
2998
|
+
Frontmatter: () => Frontmatter
|
|
2999
|
+
});
|
|
3000
|
+
import * as fs from "fs";
|
|
3001
|
+
import * as path2 from "path";
|
|
2946
3002
|
import { z as z2 } from "zod";
|
|
2947
3003
|
var MARKDOWN = new Bun.Glob("**/*.md");
|
|
2948
3004
|
var Frontmatter = z2.object({
|
|
2949
3005
|
issue: z2.string().optional()
|
|
2950
3006
|
});
|
|
3007
|
+
function use4(options) {
|
|
3008
|
+
if (options.watch)
|
|
3009
|
+
return watch2(options);
|
|
3010
|
+
else
|
|
3011
|
+
return scan(options);
|
|
3012
|
+
}
|
|
3013
|
+
async function* watch2(options) {
|
|
3014
|
+
const targets = resolveTargets(options.targets);
|
|
3015
|
+
const touched = new Map;
|
|
3016
|
+
const queue = [];
|
|
3017
|
+
let resolver;
|
|
3018
|
+
const watcher = fs.watch(options.cwd, async (event, filename) => {
|
|
3019
|
+
if (event === "change" && filename) {
|
|
3020
|
+
if (!targets.match(filename))
|
|
3021
|
+
return;
|
|
3022
|
+
const item = createItem(options.cwd, filename);
|
|
3023
|
+
const hash = Bun.hash(await item.file.text());
|
|
3024
|
+
if (touched.get(filename) === hash)
|
|
3025
|
+
return;
|
|
3026
|
+
touched.set(filename, hash);
|
|
3027
|
+
queue.push(createItem(options.cwd, filename));
|
|
3028
|
+
if (resolver) {
|
|
3029
|
+
resolver.resolve(filename);
|
|
3030
|
+
resolver = undefined;
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
});
|
|
3034
|
+
try {
|
|
3035
|
+
while (true) {
|
|
3036
|
+
const item = queue.shift();
|
|
3037
|
+
if (item)
|
|
3038
|
+
yield item;
|
|
3039
|
+
else {
|
|
3040
|
+
resolver = withResolvers();
|
|
3041
|
+
await resolver.promise;
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3044
|
+
} finally {
|
|
3045
|
+
watcher.close();
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
async function* scan(options) {
|
|
3049
|
+
const { targets, isIgnored } = resolveTargets(options.targets);
|
|
3050
|
+
for (const target of targets) {
|
|
3051
|
+
for await (const filename of target.scan({ cwd: options.cwd })) {
|
|
3052
|
+
if (isIgnored(filename))
|
|
3053
|
+
continue;
|
|
3054
|
+
yield createItem(options.cwd, filename);
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
3058
|
+
function resolveTargets(query) {
|
|
3059
|
+
const targets = [];
|
|
3060
|
+
const ignores = [];
|
|
3061
|
+
for (const q of castArray(query)) {
|
|
3062
|
+
if (q.startsWith("!"))
|
|
3063
|
+
ignores.push(new Bun.Glob(q));
|
|
3064
|
+
else
|
|
3065
|
+
targets.push(new Bun.Glob(q));
|
|
3066
|
+
}
|
|
3067
|
+
assert(!isEmpty(targets), "At least one target is required");
|
|
3068
|
+
function isIgnored(filename) {
|
|
3069
|
+
return !MARKDOWN.match(filename) || ignores.every((ignore) => !ignore.match(filename));
|
|
3070
|
+
}
|
|
3071
|
+
return {
|
|
3072
|
+
targets,
|
|
3073
|
+
isIgnored,
|
|
3074
|
+
match: (filename) => !isIgnored(filename) && targets.some((target) => target.match(filename))
|
|
3075
|
+
};
|
|
3076
|
+
}
|
|
3077
|
+
function createItem(target, filename) {
|
|
3078
|
+
const filepath = path2.join(target, filename);
|
|
3079
|
+
return { filename, filepath: path2.parse(filepath), file: Bun.file(filepath) };
|
|
3080
|
+
}
|
|
3081
|
+
// src/utils/frontmatter.ts
|
|
3082
|
+
function extract(content, options) {
|
|
3083
|
+
const delimiter = options?.delimiter ?? "---";
|
|
3084
|
+
if (!content.trimStart().startsWith(delimiter)) {
|
|
3085
|
+
return { metadata: {}, content };
|
|
3086
|
+
}
|
|
3087
|
+
const lines = content.split(`
|
|
3088
|
+
`);
|
|
3089
|
+
let startIndex = -1;
|
|
3090
|
+
let endIndex = -1;
|
|
3091
|
+
for (let i = 0;i < lines.length; i++) {
|
|
3092
|
+
if (lines[i]?.trim() === delimiter) {
|
|
3093
|
+
startIndex = i;
|
|
3094
|
+
break;
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
if (startIndex === -1) {
|
|
3098
|
+
return { metadata: {}, content };
|
|
3099
|
+
}
|
|
3100
|
+
for (let i = startIndex + 1;i < lines.length; i++) {
|
|
3101
|
+
if (lines[i]?.trim() === delimiter) {
|
|
3102
|
+
endIndex = i;
|
|
3103
|
+
break;
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
if (endIndex === -1) {
|
|
3107
|
+
return { metadata: {}, content };
|
|
3108
|
+
}
|
|
3109
|
+
const frontmatterLines = lines.slice(startIndex + 1, endIndex);
|
|
3110
|
+
const yamlContent = frontmatterLines.join(`
|
|
3111
|
+
`);
|
|
3112
|
+
const metadata = parseYAML(yamlContent);
|
|
3113
|
+
const remainingContent = lines.slice(endIndex + 1).join(`
|
|
3114
|
+
`).replace(/^\n+/, "");
|
|
3115
|
+
return { metadata, content: remainingContent };
|
|
3116
|
+
}
|
|
3117
|
+
function stringify(data, options) {
|
|
3118
|
+
const delimiter = options?.delimiter ?? "---";
|
|
3119
|
+
const yamlContent = stringifyYAML(data);
|
|
3120
|
+
return `${delimiter}
|
|
3121
|
+
${yamlContent}${delimiter}
|
|
3122
|
+
`;
|
|
3123
|
+
}
|
|
3124
|
+
function apply(content, data, options) {
|
|
3125
|
+
const frontmatter = stringify(data, options);
|
|
3126
|
+
return `${frontmatter}
|
|
3127
|
+
${content}`;
|
|
3128
|
+
}
|
|
3129
|
+
function parseYAML(yaml) {
|
|
3130
|
+
const result = {};
|
|
3131
|
+
const lines = yaml.split(`
|
|
3132
|
+
`);
|
|
3133
|
+
const stack = [{ obj: result, indent: -1 }];
|
|
3134
|
+
for (const line of lines) {
|
|
3135
|
+
if (!line.trim() || line.trim().startsWith("#")) {
|
|
3136
|
+
continue;
|
|
3137
|
+
}
|
|
3138
|
+
const indent = line.length - (line.trimStart()?.length ?? 0);
|
|
3139
|
+
const trimmed = line.trim();
|
|
3140
|
+
while (stack.length > 1) {
|
|
3141
|
+
const top = stack[stack.length - 1];
|
|
3142
|
+
if (!top || indent > top.indent) {
|
|
3143
|
+
break;
|
|
3144
|
+
}
|
|
3145
|
+
stack.pop();
|
|
3146
|
+
}
|
|
3147
|
+
const colonIndex = trimmed.indexOf(":");
|
|
3148
|
+
if (colonIndex === -1) {
|
|
3149
|
+
continue;
|
|
3150
|
+
}
|
|
3151
|
+
const key = trimmed.substring(0, colonIndex).trim();
|
|
3152
|
+
const valueStr = trimmed.substring(colonIndex + 1).trim();
|
|
3153
|
+
const currentObj = stack[stack.length - 1]?.obj;
|
|
3154
|
+
if (!currentObj)
|
|
3155
|
+
continue;
|
|
3156
|
+
if (valueStr === "") {
|
|
3157
|
+
const nestedObj = {};
|
|
3158
|
+
currentObj[key] = nestedObj;
|
|
3159
|
+
stack.push({ obj: nestedObj, indent });
|
|
3160
|
+
} else {
|
|
3161
|
+
if (currentObj) {
|
|
3162
|
+
currentObj[key] = parseYAMLValue(valueStr);
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
return result;
|
|
3167
|
+
}
|
|
3168
|
+
function parseYAMLValue(value) {
|
|
3169
|
+
if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
|
|
3170
|
+
return value.slice(1, -1);
|
|
3171
|
+
}
|
|
3172
|
+
if (value === "true")
|
|
3173
|
+
return true;
|
|
3174
|
+
if (value === "false")
|
|
3175
|
+
return false;
|
|
3176
|
+
if (value === "null" || value === "~")
|
|
3177
|
+
return null;
|
|
3178
|
+
const num = Number(value);
|
|
3179
|
+
if (!Number.isNaN(num) && value !== "") {
|
|
3180
|
+
return num;
|
|
3181
|
+
}
|
|
3182
|
+
return value;
|
|
3183
|
+
}
|
|
3184
|
+
function stringifyYAML(data, indent = 0) {
|
|
3185
|
+
const indentStr = " ".repeat(indent);
|
|
3186
|
+
let result = "";
|
|
3187
|
+
for (const [key, value] of Object.entries(data)) {
|
|
3188
|
+
if (isNullish(value)) {
|
|
3189
|
+
result += `${indentStr}${key}: null
|
|
3190
|
+
`;
|
|
3191
|
+
} else if (isObject(value) && !isArray(value)) {
|
|
3192
|
+
result += `${indentStr}${key}:
|
|
3193
|
+
`;
|
|
3194
|
+
result += stringifyYAML(value, indent + 1);
|
|
3195
|
+
} else if (isString(value)) {
|
|
3196
|
+
const needsQuotes = value.includes(":") || value.includes("#") || value.includes(`
|
|
3197
|
+
`);
|
|
3198
|
+
result += `${indentStr}${key}: ${needsQuotes ? `"${value}"` : value}
|
|
3199
|
+
`;
|
|
3200
|
+
} else if (isArray(value)) {
|
|
3201
|
+
result += `${indentStr}${key}:
|
|
3202
|
+
`;
|
|
3203
|
+
for (const item of value) {
|
|
3204
|
+
if (isObject(item) && !isArray(item)) {
|
|
3205
|
+
result += `${indentStr}-
|
|
3206
|
+
${stringifyYAML(item, indent + 2)}`;
|
|
3207
|
+
} else {
|
|
3208
|
+
result += `${indentStr} - ${item}
|
|
3209
|
+
`;
|
|
3210
|
+
}
|
|
3211
|
+
}
|
|
3212
|
+
} else {
|
|
3213
|
+
result += `${indentStr}${key}: ${value}
|
|
3214
|
+
`;
|
|
3215
|
+
}
|
|
3216
|
+
}
|
|
3217
|
+
return result;
|
|
3218
|
+
}
|
|
3219
|
+
|
|
3220
|
+
// src/use-cases/sync-specifications.ts
|
|
3221
|
+
async function* syncSpecifications(options) {
|
|
3222
|
+
const shell = Bun.$.cwd(options.project);
|
|
3223
|
+
for await (const asset of options.source) {
|
|
3224
|
+
const { file, filepath } = asset;
|
|
3225
|
+
const { metadata, content } = extract(await file.text());
|
|
3226
|
+
const relative2 = path3.relative(options.project, path3.format(filepath));
|
|
3227
|
+
const input = {
|
|
3228
|
+
file: relative2,
|
|
3229
|
+
title: title(filepath.name),
|
|
3230
|
+
description: dedent`
|
|
3231
|
+
Spec: ${relative2}
|
|
3232
|
+
`
|
|
3233
|
+
};
|
|
3234
|
+
const result = exports_assets.Frontmatter.safeParse(metadata);
|
|
3235
|
+
const existing = result.success && result.data.issue ? { issueId: result.data.issue } : await exports_issues2.find.byFile(shell, input.file);
|
|
3236
|
+
const spec = existing ? await exports_issues2.update(shell, existing, input) : await exports_issues2.create(shell, input);
|
|
3237
|
+
const frontmatter = Object.assign({}, metadata, {
|
|
3238
|
+
issue: spec.issueId
|
|
3239
|
+
});
|
|
3240
|
+
await Bun.write(file, apply(content, frontmatter));
|
|
3241
|
+
yield {
|
|
3242
|
+
asset,
|
|
3243
|
+
spec
|
|
3244
|
+
};
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
2951
3247
|
// src/adapters/beads/agents.ts
|
|
2952
3248
|
var exports_agents = {};
|
|
2953
3249
|
__export(exports_agents, {
|
|
2954
|
-
use: () =>
|
|
3250
|
+
use: () => use5,
|
|
2955
3251
|
stuck: () => stuck,
|
|
2956
3252
|
state: () => state,
|
|
2957
3253
|
done: () => done
|
|
@@ -2977,7 +3273,7 @@ async function state(client2, slug, state2) {
|
|
|
2977
3273
|
const agent = await $2`bd agent state gram-${slug} ${state2} --json`.json();
|
|
2978
3274
|
return agent;
|
|
2979
3275
|
}
|
|
2980
|
-
async function
|
|
3276
|
+
async function use5(client2, input) {
|
|
2981
3277
|
const $2 = exports_client2.use(client2);
|
|
2982
3278
|
const id = "slug" in input ? `gram-${input.slug}` : input.id;
|
|
2983
3279
|
const agent = await $2`bd agent show ${id} --json`.json();
|
|
@@ -3460,11 +3756,33 @@ var createIAmDone = (client2) => tool({
|
|
|
3460
3756
|
`;
|
|
3461
3757
|
}
|
|
3462
3758
|
});
|
|
3463
|
-
// src/plugin.ts
|
|
3759
|
+
// src/plugin/sync-specifications.ts
|
|
3760
|
+
async function startSyncingSpecifications(options) {
|
|
3761
|
+
const syncs = syncSpecifications({
|
|
3762
|
+
project: options.project,
|
|
3763
|
+
source: exports_assets.use({
|
|
3764
|
+
cwd: options.project,
|
|
3765
|
+
targets: options.specifications,
|
|
3766
|
+
watch: true
|
|
3767
|
+
})
|
|
3768
|
+
});
|
|
3769
|
+
let result;
|
|
3770
|
+
do {
|
|
3771
|
+
result = await syncs.next();
|
|
3772
|
+
if (result.value)
|
|
3773
|
+
;
|
|
3774
|
+
} while (!result.done);
|
|
3775
|
+
}
|
|
3776
|
+
|
|
3777
|
+
// src/plugin/index.ts
|
|
3464
3778
|
var TeammatePlugin = async (options) => {
|
|
3465
3779
|
const { directory } = options;
|
|
3780
|
+
const config = await load({
|
|
3781
|
+
cwd: directory
|
|
3782
|
+
});
|
|
3466
3783
|
const client2 = await exports_client.register(options);
|
|
3467
3784
|
await install(directory);
|
|
3785
|
+
startSyncingSpecifications(config).catch((error) => {});
|
|
3468
3786
|
return {
|
|
3469
3787
|
"command.execute.before": async (input, output) => {
|
|
3470
3788
|
await chain({ stopOnFatal: true }, () => injectBeadsIssue({
|
|
@@ -11,6 +11,9 @@ var __export = (target, all) => {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
// node_modules/radashi/dist/radashi.js
|
|
14
|
+
function castArray(value) {
|
|
15
|
+
return Array.isArray(value) ? value.slice() : [value];
|
|
16
|
+
}
|
|
14
17
|
function castArrayIfExists(value) {
|
|
15
18
|
return Array.isArray(value) ? value.slice() : value != null ? [value] : value;
|
|
16
19
|
}
|
|
@@ -183,6 +186,13 @@ var Semaphore = class {
|
|
|
183
186
|
}
|
|
184
187
|
}
|
|
185
188
|
};
|
|
189
|
+
function capitalize(str) {
|
|
190
|
+
if (!str || str.length === 0) {
|
|
191
|
+
return "";
|
|
192
|
+
}
|
|
193
|
+
const lower = str.toLowerCase();
|
|
194
|
+
return lower.substring(0, 1).toUpperCase() + lower.substring(1, lower.length);
|
|
195
|
+
}
|
|
186
196
|
function dedent(text, ...values) {
|
|
187
197
|
var _a;
|
|
188
198
|
if (isArray(text)) {
|
|
@@ -205,6 +215,12 @@ function dedent(text, ...values) {
|
|
|
205
215
|
const output = indent ? text.replace(new RegExp(`^${indent}`, "gm"), "") : text;
|
|
206
216
|
return output.replace(/^[ \t]*\n|\n[ \t]*$/g, "");
|
|
207
217
|
}
|
|
218
|
+
function title(str) {
|
|
219
|
+
if (!str) {
|
|
220
|
+
return "";
|
|
221
|
+
}
|
|
222
|
+
return str.split(/(?=[A-Z])|[\.\-\s_]/).map((s) => s.trim()).filter((s) => !!s).map((s) => capitalize(s.toLowerCase())).join(" ");
|
|
223
|
+
}
|
|
208
224
|
function assert(condition, message) {
|
|
209
225
|
if (!condition) {
|
|
210
226
|
throw message instanceof Error ? message : new Error(message ?? "Assertion failed");
|
|
@@ -241,6 +257,9 @@ function isError(value) {
|
|
|
241
257
|
function isFunction(value) {
|
|
242
258
|
return typeof value === "function";
|
|
243
259
|
}
|
|
260
|
+
function isNullish(value) {
|
|
261
|
+
return value === null || value === undefined;
|
|
262
|
+
}
|
|
244
263
|
function isNumber(value) {
|
|
245
264
|
return typeof value === "number" && !Number.isNaN(value);
|
|
246
265
|
}
|
|
@@ -250,8 +269,11 @@ function isObject(value) {
|
|
|
250
269
|
function isPromise(value) {
|
|
251
270
|
return !!value && isFunction(value.then);
|
|
252
271
|
}
|
|
272
|
+
function isString(value) {
|
|
273
|
+
return typeof value === "string";
|
|
274
|
+
}
|
|
253
275
|
function isTagged(value, tag) {
|
|
254
276
|
return Object.prototype.toString.call(value) === tag;
|
|
255
277
|
}
|
|
256
278
|
|
|
257
|
-
export { __export, castArrayIfExists, first, objectify, sift, all, toResult, tryit, listify, shake, Semaphore, dedent, assert, isArray, isBoolean, isEmpty, isObject };
|
|
279
|
+
export { __export, castArray, castArrayIfExists, first, objectify, sift, all, toResult, tryit, withResolvers, listify, shake, Semaphore, dedent, title, assert, isArray, isBoolean, isEmpty, isNullish, isObject, isString };
|
package/package.json
CHANGED
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-teammate",
|
|
3
|
-
"version": "0.2.0-next.
|
|
3
|
+
"version": "0.2.0-next.7",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"private": false,
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"exports": {
|
|
10
|
+
"./plugin": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/plugin/index.d.ts",
|
|
13
|
+
"default": "./dist/plugin/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"./utils/config/define": {
|
|
17
|
+
"import": {
|
|
18
|
+
"types": "./dist/utils/config/define.d.ts",
|
|
19
|
+
"default": "./dist/utils/config/define.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"./package.json": "./package.json"
|
|
23
|
+
},
|
|
5
24
|
"license": "MIT",
|
|
6
25
|
"author": "Hugo Fqt",
|
|
7
26
|
"repository": {
|
|
8
27
|
"type": "git",
|
|
9
28
|
"url": "git+https://github.com/hugo082/opencode-teammate.git",
|
|
10
|
-
"sha": "
|
|
29
|
+
"sha": "36d9276"
|
|
11
30
|
},
|
|
12
31
|
"bin": {
|
|
13
32
|
"mate": "./dist/bin/mate"
|
|
14
33
|
},
|
|
15
|
-
"files": [
|
|
16
|
-
"dist",
|
|
17
|
-
"README.md",
|
|
18
|
-
"LICENSE"
|
|
19
|
-
],
|
|
20
|
-
"type": "module",
|
|
21
|
-
"main": "./dist/plugin.js",
|
|
22
|
-
"module": "./dist/plugin.js",
|
|
23
|
-
"types": "./dist/plugin.d.ts",
|
|
24
|
-
"exports": {
|
|
25
|
-
"./config": "./dist/utils/config/define.js"
|
|
26
|
-
},
|
|
27
34
|
"dependencies": {
|
|
28
35
|
"@bunli/core": "^0.5.4",
|
|
29
36
|
"bunli": "^0.5.3",
|
|
File without changes
|