diff --git a/dist/main.js b/dist/main.js index fab9a994..d66ffee8 100644 --- a/dist/main.js +++ b/dist/main.js @@ -127,7 +127,7 @@ import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J a `);for(let e of n)if(e.startsWith(`opencode server listening`)){let n=e.match(/on\s+(https?:\/\/[^\s]+)/);if(!n)throw Error(`Failed to parse server url from output: ${e}`);clearTimeout(i),t(n[1]);return}}),n.stderr?.on(`data`,e=>{a+=e.toString()}),n.on(`exit`,e=>{clearTimeout(i);let t=`Server exited with code ${e}`;a.trim()&&(t+=`\nServer output: ${a}`),r(Error(t))}),n.on(`error`,e=>{clearTimeout(i),r(e)}),e.signal&&e.signal.addEventListener(`abort`,()=>{clearTimeout(i),r(Error(`Aborted`))})}),close(){n.kill()}}}async function $t(e){let t=await Qt({...e});return{client:Zt({baseUrl:t.url}),server:t}}async function en(e){if(e<0||!Number.isFinite(e))throw Error(`Invalid sleep duration: ${e}`);return new Promise(t=>setTimeout(t,e))}const tn={todowrite:[`Todo`,`\x1B[33m\x1B[1m`],todoread:[`Todo`,`\x1B[33m\x1B[1m`],bash:[`Bash`,`\x1B[31m\x1B[1m`],edit:[`Edit`,`\x1B[32m\x1B[1m`],glob:[`Glob`,`\x1B[34m\x1B[1m`],grep:[`Grep`,`\x1B[34m\x1B[1m`],list:[`List`,`\x1B[34m\x1B[1m`],read:[`Read`,`\x1B[35m\x1B[1m`],write:[`Write`,`\x1B[32m\x1B[1m`],websearch:[`Search`,`\x1B[2m\x1B[1m`]},nn=`\x1B[0m`;function rn(){return H.env.NO_COLOR==null}function an(e,t){let[n,r]=tn[e.toLowerCase()]??[e,`\x1B[36m\x1B[1m`],i=n.padEnd(10,` `);rn()?H.stdout.write(`\n${r}|${nn} ${i} ${nn}${t}\n`):H.stdout.write(`\n| ${i} ${t}\n`)}function on(e){H.stdout.write(`\n${e}\n`)}const sn={api_error:`API Error`,configuration:`Configuration Error`,internal:`Internal Error`,llm_fetch_error:`LLM Fetch Error`,llm_timeout:`LLM Timeout`,permission:`Permission Error`,rate_limit:`Rate Limit`,validation:`Validation Error`};function cn(e){return e.type===`rate_limit`?`:warning:`:e.type===`llm_timeout`?`:hourglass:`:e.type===`llm_fetch_error`||e.retryable?`:warning:`:`:x:`}function ln(e){let t=cn(e),n=sn[e.type],r=[];return r.push(`${t} **${n}**`),r.push(``),r.push(e.message),e.details!=null&&(r.push(``),r.push(`> ${e.details}`)),e.suggestedAction!=null&&(r.push(``),r.push(`**Suggested action:** ${e.suggestedAction}`)),e.retryable&&(r.push(``),r.push(`_This error is retryable._`)),e.resetTime!=null&&(r.push(``),r.push(`_Rate limit resets at: ${e.resetTime.toISOString()}_`)),r.join(` `)}function un(e,t,n,r){return{type:e,message:t,retryable:n,details:r?.details,suggestedAction:r?.suggestedAction,resetTime:r?.resetTime}}const dn=[/fetch failed/i,/connect\s*timeout/i,/connecttimeouterror/i,/timed?\s*out/i,/econnrefused/i,/econnreset/i,/etimedout/i,/network error/i];function fn(e){if(e==null)return!1;let t=``;if(typeof e==`string`)t=e;else if(e instanceof Error)t=e.message,`cause`in e&&typeof e.cause==`string`&&(t+=` ${e.cause}`);else if(typeof e==`object`){let n=e;typeof n.message==`string`&&(t=n.message),typeof n.cause==`string`&&(t+=` ${n.cause}`)}return dn.some(e=>e.test(t))}function pn(e,t){return un(`llm_fetch_error`,`LLM request failed: ${e}`,!0,{details:t==null?void 0:`Model: ${t}`,suggestedAction:`This is a transient network error. The request may succeed on retry, or try a different model.`})}function mn(e,t){return un(`configuration`,`Agent error: ${e}`,!1,{details:t==null?void 0:`Requested agent: ${t}`,suggestedAction:`Verify the agent name is correct and the required plugins (e.g., oMo) are installed.`})}function hn(e){try{let t=new URL(e);return t.hostname===`github.com`||t.hostname===`api.github.com`}catch{return!1}}function gn(e){try{let t=new URL(e);return t.hostname===`github.com`&&(t.pathname.startsWith(`/user-attachments/assets/`)||t.pathname.startsWith(`/user-attachments/files/`))}catch{return!1}}function _n(e){let t=e.match(/https:\/\/github\.com\/[a-zA-Z0-9-]+\/[\w.-]+\/(?:pull|issues)\/\d+(?:#issuecomment-\d+)?/g)??[];return[...new Set(t)].filter(hn)}function vn(e){let t=/\[[\w-]+\s+([a-f0-9]{7,40})\]/g,n=[];for(let r of e.matchAll(t))r[1]!=null&&n.push(r[1]);return[...new Set(n)]}var yn=class{constructor(){if(this.payload={},process.env.GITHUB_EVENT_PATH)if(ge(process.env.GITHUB_EVENT_PATH))this.payload=JSON.parse(_e(process.env.GITHUB_EVENT_PATH,{encoding:`utf8`}));else{let e=process.env.GITHUB_EVENT_PATH;process.stdout.write(`GITHUB_EVENT_PATH ${e} does not exist${me}`)}this.eventName=process.env.GITHUB_EVENT_NAME,this.sha=process.env.GITHUB_SHA,this.ref=process.env.GITHUB_REF,this.workflow=process.env.GITHUB_WORKFLOW,this.action=process.env.GITHUB_ACTION,this.actor=process.env.GITHUB_ACTOR,this.job=process.env.GITHUB_JOB,this.runAttempt=parseInt(process.env.GITHUB_RUN_ATTEMPT,10),this.runNumber=parseInt(process.env.GITHUB_RUN_NUMBER,10),this.runId=parseInt(process.env.GITHUB_RUN_ID,10),this.apiUrl=process.env.GITHUB_API_URL??`https://api.github.com`,this.serverUrl=process.env.GITHUB_SERVER_URL??`https://github.com`,this.graphqlUrl=process.env.GITHUB_GRAPHQL_URL??`https://api.github.com/graphql`}get issue(){let e=this.payload;return Object.assign(Object.assign({},this.repo),{number:(e.issue||e.pull_request||e).number})}get repo(){if(process.env.GITHUB_REPOSITORY){let[e,t]=process.env.GITHUB_REPOSITORY.split(`/`);return{owner:e,repo:t}}if(this.payload.repository)return{owner:this.payload.repository.owner.login,repo:this.payload.repository.name};throw Error(`context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'`)}},bn=T((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getProxyUrl=t,e.checkBypass=n;function t(e){let t=e.protocol===`https:`;if(n(e))return;let r=t?process.env.https_proxy||process.env.HTTPS_PROXY:process.env.http_proxy||process.env.HTTP_PROXY;if(r)try{return new i(r)}catch{if(!r.startsWith(`http://`)&&!r.startsWith(`https://`))return new i(`http://${r}`)}else return}function n(e){if(!e.hostname)return!1;let t=e.hostname;if(r(t))return!0;let n=process.env.no_proxy||process.env.NO_PROXY||``;if(!n)return!1;let i;e.port?i=Number(e.port):e.protocol===`http:`?i=80:e.protocol===`https:`&&(i=443);let a=[e.hostname.toUpperCase()];typeof i==`number`&&a.push(`${a[0]}:${i}`);for(let e of n.split(`,`).map(e=>e.trim().toUpperCase()).filter(e=>e))if(e===`*`||a.some(t=>t===e||t.endsWith(`.${e}`)||e.startsWith(`.`)&&t.endsWith(`${e}`)))return!0;return!1}function r(e){let t=e.toLowerCase();return t===`localhost`||t.startsWith(`127.`)||t.startsWith(`[::1]`)||t.startsWith(`[0:0:0:0:0:0:0:1]`)}var i=class extends URL{constructor(e,t){super(e,t),this._decodedUsername=decodeURIComponent(super.username),this._decodedPassword=decodeURIComponent(super.password)}get username(){return this._decodedUsername}get password(){return this._decodedPassword}}})),xn=e(T((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=e(r),o=0;oi(this,void 0,void 0,function*(){let t=Buffer.alloc(0);this.message.on(`data`,e=>{t=Buffer.concat([t,e])}),this.message.on(`end`,()=>{e(t.toString())})}))})}readBodyBuffer(){return i(this,void 0,void 0,function*(){return new Promise(e=>i(this,void 0,void 0,function*(){let t=[];this.message.on(`data`,e=>{t.push(e)}),this.message.on(`end`,()=>{e(Buffer.concat(t))})}))})}};e.HttpClientResponse=y;function b(e){return new URL(e).protocol===`https:`}e.HttpClient=class{constructor(e,t,n){this._ignoreSslError=!1,this._allowRedirects=!0,this._allowRedirectDowngrade=!1,this._maxRedirects=50,this._allowRetries=!1,this._maxRetries=1,this._keepAlive=!1,this._disposed=!1,this.userAgent=this._getUserAgentWithOrchestrationId(e),this.handlers=t||[],this.requestOptions=n,n&&(n.ignoreSslError!=null&&(this._ignoreSslError=n.ignoreSslError),this._socketTimeout=n.socketTimeout,n.allowRedirects!=null&&(this._allowRedirects=n.allowRedirects),n.allowRedirectDowngrade!=null&&(this._allowRedirectDowngrade=n.allowRedirectDowngrade),n.maxRedirects!=null&&(this._maxRedirects=Math.max(n.maxRedirects,0)),n.keepAlive!=null&&(this._keepAlive=n.keepAlive),n.allowRetries!=null&&(this._allowRetries=n.allowRetries),n.maxRetries!=null&&(this._maxRetries=n.maxRetries))}options(e,t){return i(this,void 0,void 0,function*(){return this.request(`OPTIONS`,e,null,t||{})})}get(e,t){return i(this,void 0,void 0,function*(){return this.request(`GET`,e,null,t||{})})}del(e,t){return i(this,void 0,void 0,function*(){return this.request(`DELETE`,e,null,t||{})})}post(e,t,n){return i(this,void 0,void 0,function*(){return this.request(`POST`,e,t,n||{})})}patch(e,t,n){return i(this,void 0,void 0,function*(){return this.request(`PATCH`,e,t,n||{})})}put(e,t,n){return i(this,void 0,void 0,function*(){return this.request(`PUT`,e,t,n||{})})}head(e,t){return i(this,void 0,void 0,function*(){return this.request(`HEAD`,e,null,t||{})})}sendStream(e,t,n,r){return i(this,void 0,void 0,function*(){return this.request(e,t,n,r)})}getJson(e){return i(this,arguments,void 0,function*(e,t={}){t[d.Accept]=this._getExistingOrDefaultHeader(t,d.Accept,f.ApplicationJson);let n=yield this.get(e,t);return this._processResponse(n,this.requestOptions)})}postJson(e,t){return i(this,arguments,void 0,function*(e,t,n={}){let r=JSON.stringify(t,null,2);n[d.Accept]=this._getExistingOrDefaultHeader(n,d.Accept,f.ApplicationJson),n[d.ContentType]=this._getExistingOrDefaultContentTypeHeader(n,f.ApplicationJson);let i=yield this.post(e,r,n);return this._processResponse(i,this.requestOptions)})}putJson(e,t){return i(this,arguments,void 0,function*(e,t,n={}){let r=JSON.stringify(t,null,2);n[d.Accept]=this._getExistingOrDefaultHeader(n,d.Accept,f.ApplicationJson),n[d.ContentType]=this._getExistingOrDefaultContentTypeHeader(n,f.ApplicationJson);let i=yield this.put(e,r,n);return this._processResponse(i,this.requestOptions)})}patchJson(e,t){return i(this,arguments,void 0,function*(e,t,n={}){let r=JSON.stringify(t,null,2);n[d.Accept]=this._getExistingOrDefaultHeader(n,d.Accept,f.ApplicationJson),n[d.ContentType]=this._getExistingOrDefaultContentTypeHeader(n,f.ApplicationJson);let i=yield this.patch(e,r,n);return this._processResponse(i,this.requestOptions)})}request(e,t,n,r){return i(this,void 0,void 0,function*(){if(this._disposed)throw Error(`Client has already been disposed.`);let i=new URL(t),a=this._prepareRequest(e,i,r),o=this._allowRetries&&_.includes(e)?this._maxRetries+1:1,s=0,c;do{if(c=yield this.requestRaw(a,n),c&&c.message&&c.message.statusCode===u.Unauthorized){let e;for(let t of this.handlers)if(t.canHandleAuthentication(c)){e=t;break}return e?e.handleAuthentication(this,a,n):c}let t=this._maxRedirects;for(;c.message.statusCode&&m.includes(c.message.statusCode)&&this._allowRedirects&&t>0;){let o=c.message.headers.location;if(!o)break;let s=new URL(o);if(i.protocol===`https:`&&i.protocol!==s.protocol&&!this._allowRedirectDowngrade)throw Error(`Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.`);if(yield c.readBody(),s.hostname!==i.hostname)for(let e in r)e.toLowerCase()===`authorization`&&delete r[e];a=this._prepareRequest(e,s,r),c=yield this.requestRaw(a,n),t--}if(!c.message.statusCode||!h.includes(c.message.statusCode))return c;s+=1,s{function i(e,t){e?r(e):t?n(t):r(Error(`Unknown error`))}this.requestRawWithCallback(e,t,i)})})}requestRawWithCallback(e,t,n){typeof t==`string`&&(e.options.headers||(e.options.headers={}),e.options.headers[`Content-Length`]=Buffer.byteLength(t,`utf8`));let r=!1;function i(e,t){r||(r=!0,n(e,t))}let a=e.httpModule.request(e.options,e=>{i(void 0,new y(e))}),o;a.on(`socket`,e=>{o=e}),a.setTimeout(this._socketTimeout||3*6e4,()=>{o&&o.end(),i(Error(`Request timeout: ${e.options.path}`))}),a.on(`error`,function(e){i(e)}),t&&typeof t==`string`&&a.write(t,`utf8`),t&&typeof t!=`string`?(t.on(`close`,function(){a.end()}),t.pipe(a)):a.end()}getAgent(e){let t=new URL(e);return this._getAgent(t)}getAgentDispatcher(e){let t=new URL(e),n=s.getProxyUrl(t);if(n&&n.hostname)return this._getProxyAgentDispatcher(t,n)}_prepareRequest(e,t,n){let r={};r.parsedUrl=t;let i=r.parsedUrl.protocol===`https:`;r.httpModule=i?o:a;let s=i?443:80;if(r.options={},r.options.host=r.parsedUrl.hostname,r.options.port=r.parsedUrl.port?parseInt(r.parsedUrl.port):s,r.options.path=(r.parsedUrl.pathname||``)+(r.parsedUrl.search||``),r.options.method=e,r.options.headers=this._mergeHeaders(n),this.userAgent!=null&&(r.options.headers[`user-agent`]=this.userAgent),r.options.agent=this._getAgent(r.parsedUrl),this.handlers)for(let e of this.handlers)e.prepareRequest(r.options);return r}_mergeHeaders(e){return this.requestOptions&&this.requestOptions.headers?Object.assign({},x(this.requestOptions.headers),x(e||{})):x(e||{})}_getExistingOrDefaultHeader(e,t,n){let r;if(this.requestOptions&&this.requestOptions.headers){let e=x(this.requestOptions.headers)[t];e&&(r=typeof e==`number`?e.toString():e)}let i=e[t];return i===void 0?r===void 0?n:r:typeof i==`number`?i.toString():i}_getExistingOrDefaultContentTypeHeader(e,t){let n;if(this.requestOptions&&this.requestOptions.headers){let e=x(this.requestOptions.headers)[d.ContentType];e&&(n=typeof e==`number`?String(e):Array.isArray(e)?e.join(`, `):e)}let r=e[d.ContentType];return r===void 0?n===void 0?t:n:typeof r==`number`?String(r):Array.isArray(r)?r.join(`, `):r}_getAgent(e){let t,n=s.getProxyUrl(e),r=n&&n.hostname;if(this._keepAlive&&r&&(t=this._proxyAgent),r||(t=this._agent),t)return t;let i=e.protocol===`https:`,l=100;if(this.requestOptions&&(l=this.requestOptions.maxSockets||a.globalAgent.maxSockets),n&&n.hostname){let e={maxSockets:l,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(n.username||n.password)&&{proxyAuth:`${n.username}:${n.password}`}),{host:n.hostname,port:n.port})},r,a=n.protocol===`https:`;r=i?a?c.httpsOverHttps:c.httpsOverHttp:a?c.httpOverHttps:c.httpOverHttp,t=r(e),this._proxyAgent=t}if(!t){let e={keepAlive:this._keepAlive,maxSockets:l};t=i?new o.Agent(e):new a.Agent(e),this._agent=t}return i&&this._ignoreSslError&&(t.options=Object.assign(t.options||{},{rejectUnauthorized:!1})),t}_getProxyAgentDispatcher(e,t){let n;if(this._keepAlive&&(n=this._proxyAgentDispatcher),n)return n;let r=e.protocol===`https:`;return n=new l.ProxyAgent(Object.assign({uri:t.href,pipelining:this._keepAlive?1:0},(t.username||t.password)&&{token:`Basic ${Buffer.from(`${t.username}:${t.password}`).toString(`base64`)}`})),this._proxyAgentDispatcher=n,r&&this._ignoreSslError&&(n.options=Object.assign(n.options.requestTls||{},{rejectUnauthorized:!1})),n}_getUserAgentWithOrchestrationId(e){let t=e||`actions/http-client`,n=process.env.ACTIONS_ORCHESTRATION_ID;return n?`${t} actions_orchestration_id/${n.replace(/[^a-z0-9_.-]/gi,`_`)}`:t}_performExponentialBackoff(e){return i(this,void 0,void 0,function*(){e=Math.min(10,e);let t=5*2**e;return new Promise(e=>setTimeout(()=>e(),t))})}_processResponse(e,t){return i(this,void 0,void 0,function*(){return new Promise((n,r)=>i(this,void 0,void 0,function*(){let i=e.message.statusCode||0,a={statusCode:i,result:null,headers:{}};i===u.NotFound&&n(a);function o(e,t){if(typeof t==`string`){let e=new Date(t);if(!isNaN(e.valueOf()))return e}return t}let s,c;try{c=yield e.readBody(),c&&c.length>0&&(s=t&&t.deserializeDates?JSON.parse(c,o):JSON.parse(c),a.result=s),a.headers=e.message.headers}catch{}if(i>299){let e;e=s&&s.message?s.message:c&&c.length>0?c:`Failed request: (${i})`;let t=new v(e,i);t.result=a.result,r(t)}else n(a)}))})}};let x=e=>Object.keys(e).reduce((t,n)=>(t[n.toLowerCase()]=e[n],t),{})}))(),1),Sn=w(),Cn=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};function wn(e,t){if(!e&&!t.auth)throw Error(`Parameter token or opts.auth is required`);if(e&&t.auth)throw Error(`Parameters token and opts.auth may not both be specified`);return typeof t.auth==`string`?t.auth:`token ${e}`}function Tn(e){return new xn.HttpClient().getAgent(e)}function En(e){return new xn.HttpClient().getAgentDispatcher(e)}function Dn(e){let t=En(e);return(e,n)=>Cn(this,void 0,void 0,function*(){return(0,Sn.fetch)(e,Object.assign(Object.assign({},n),{dispatcher:t}))})}function On(){return process.env.GITHUB_API_URL||`https://api.github.com`}function kn(){return typeof navigator==`object`&&`userAgent`in navigator?navigator.userAgent:typeof process==`object`&&process.version!==void 0?`Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`:``}function An(e,t,n,r){if(typeof n!=`function`)throw Error(`method for before hook must be a function`);return r||={},Array.isArray(t)?t.reverse().reduce((t,n)=>An.bind(null,e,n,t,r),n)():Promise.resolve().then(()=>e.registry[t]?e.registry[t].reduce((e,t)=>t.hook.bind(null,e,r),n)():n(r))}function jn(e,t,n,r){let i=r;e.registry[n]||(e.registry[n]=[]),t===`before`&&(r=(e,t)=>Promise.resolve().then(i.bind(null,t)).then(e.bind(null,t))),t===`after`&&(r=(e,t)=>{let n;return Promise.resolve().then(e.bind(null,t)).then(e=>(n=e,i(n,t))).then(()=>n)}),t===`error`&&(r=(e,t)=>Promise.resolve().then(e.bind(null,t)).catch(e=>i(e,t))),e.registry[n].push({hook:r,orig:i})}function Mn(e,t,n){if(!e.registry[t])return;let r=e.registry[t].map(e=>e.orig).indexOf(n);r!==-1&&e.registry[t].splice(r,1)}const Nn=Function.bind,Pn=Nn.bind(Nn);function Fn(e,t,n){let r=Pn(Mn,null).apply(null,n?[t,n]:[t]);e.api={remove:r},e.remove=r,[`before`,`error`,`after`,`wrap`].forEach(r=>{let i=n?[t,r,n]:[t,r];e[r]=e.api[r]=Pn(jn,null).apply(null,i)})}function In(){let e=Symbol(`Singular`),t={registry:{}},n=An.bind(null,t,e);return Fn(n,t,e),n}function Ln(){let e={registry:{}},t=An.bind(null,e);return Fn(t,e),t}var Rn={Singular:In,Collection:Ln},zn=`octokit-endpoint.js/0.0.0-development ${kn()}`,Bn={method:`GET`,baseUrl:`https://api.github.com`,headers:{accept:`application/vnd.github.v3+json`,"user-agent":zn},mediaType:{format:``}};function Vn(e){return e?Object.keys(e).reduce((t,n)=>(t[n.toLowerCase()]=e[n],t),{}):{}}function Hn(e){if(typeof e!=`object`||!e||Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let n=Object.prototype.hasOwnProperty.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Function.prototype.call(n)===Function.prototype.call(e)}function Un(e,t){let n=Object.assign({},e);return Object.keys(t).forEach(r=>{Hn(t[r])&&r in e?n[r]=Un(e[r],t[r]):Object.assign(n,{[r]:t[r]})}),n}function Wn(e){for(let t in e)e[t]===void 0&&delete e[t];return e}function Gn(e,t,n){if(typeof t==`string`){let[e,r]=t.split(` `);n=Object.assign(r?{method:e,url:r}:{url:e},n)}else n=Object.assign({},t);n.headers=Vn(n.headers),Wn(n),Wn(n.headers);let r=Un(e||{},n);return n.url===`/graphql`&&(e&&e.mediaType.previews?.length&&(r.mediaType.previews=e.mediaType.previews.filter(e=>!r.mediaType.previews.includes(e)).concat(r.mediaType.previews)),r.mediaType.previews=(r.mediaType.previews||[]).map(e=>e.replace(/-preview/,``))),r}function Kn(e,t){let n=/\?/.test(e)?`&`:`?`,r=Object.keys(t);return r.length===0?e:e+n+r.map(e=>e===`q`?`q=`+t.q.split(`+`).map(encodeURIComponent).join(`+`):`${e}=${encodeURIComponent(t[e])}`).join(`&`)}var qn=/\{[^{}}]+\}/g;function Jn(e){return e.replace(/(?:^\W+)|(?:(?e.concat(t),[]):[]}function Xn(e,t){let n={__proto__:null};for(let r of Object.keys(e))t.indexOf(r)===-1&&(n[r]=e[r]);return n}function Zn(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(e){return/%[0-9A-Fa-f]/.test(e)||(e=encodeURI(e).replace(/%5B/g,`[`).replace(/%5D/g,`]`)),e}).join(``)}function Qn(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return`%`+e.charCodeAt(0).toString(16).toUpperCase()})}function $n(e,t,n){return t=e===`+`||e===`#`?Zn(t):Qn(t),n?Qn(n)+`=`+t:t}function er(e){return e!=null}function tr(e){return e===`;`||e===`&`||e===`?`}function nr(e,t,n,r){var i=e[n],a=[];if(er(i)&&i!==``)if(typeof i==`string`||typeof i==`number`||typeof i==`boolean`)i=i.toString(),r&&r!==`*`&&(i=i.substring(0,parseInt(r,10))),a.push($n(t,i,tr(t)?n:``));else if(r===`*`)Array.isArray(i)?i.filter(er).forEach(function(e){a.push($n(t,e,tr(t)?n:``))}):Object.keys(i).forEach(function(e){er(i[e])&&a.push($n(t,i[e],e))});else{let e=[];Array.isArray(i)?i.filter(er).forEach(function(n){e.push($n(t,n))}):Object.keys(i).forEach(function(n){er(i[n])&&(e.push(Qn(n)),e.push($n(t,i[n].toString())))}),tr(t)?a.push(Qn(n)+`=`+e.join(`,`)):e.length!==0&&a.push(e.join(`,`))}else t===`;`?er(i)&&a.push(Qn(n)):i===``&&(t===`&`||t===`?`)?a.push(Qn(n)+`=`):i===``&&a.push(``);return a}function rr(e){return{expand:ir.bind(null,e)}}function ir(e,t){var n=[`+`,`#`,`.`,`/`,`;`,`?`,`&`];return e=e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(e,r,i){if(r){let e=``,i=[];if(n.indexOf(r.charAt(0))!==-1&&(e=r.charAt(0),r=r.substr(1)),r.split(/,/g).forEach(function(n){var r=/([^:\*]*)(?::(\d+)|(\*))?/.exec(n);i.push(nr(t,e,r[1],r[2]||r[3]))}),e&&e!==`+`){var a=`,`;return e===`?`?a=`&`:e!==`#`&&(a=e),(i.length===0?``:e)+i.join(a)}else return i.join(`,`)}else return Zn(i)}),e===`/`?e:e.replace(/\/$/,``)}function ar(e){let t=e.method.toUpperCase(),n=(e.url||`/`).replace(/:([a-z]\w+)/g,`{$1}`),r=Object.assign({},e.headers),i,a=Xn(e,[`method`,`baseUrl`,`url`,`headers`,`request`,`mediaType`]),o=Yn(n);n=rr(n).expand(a),/^http/.test(n)||(n=e.baseUrl+n);let s=Xn(a,Object.keys(e).filter(e=>o.includes(e)).concat(`baseUrl`));return/application\/octet-stream/i.test(r.accept)||(e.mediaType.format&&(r.accept=r.accept.split(/,/).map(t=>t.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,`application/vnd$1$2.${e.mediaType.format}`)).join(`,`)),n.endsWith(`/graphql`)&&e.mediaType.previews?.length&&(r.accept=(r.accept.match(/(?`application/vnd.github.${t}-preview${e.mediaType.format?`.${e.mediaType.format}`:`+json`}`).join(`,`))),[`GET`,`HEAD`].includes(t)?n=Kn(n,s):`data`in s?i=s.data:Object.keys(s).length&&(i=s),!r[`content-type`]&&i!==void 0&&(r[`content-type`]=`application/json; charset=utf-8`),[`PATCH`,`PUT`].includes(t)&&i===void 0&&(i=``),Object.assign({method:t,url:n,headers:r},i===void 0?null:{body:i},e.request?{request:e.request}:null)}function or(e,t,n){return ar(Gn(e,t,n))}function sr(e,t){let n=Gn(e,t),r=or.bind(null,n);return Object.assign(r,{DEFAULTS:n,defaults:sr.bind(null,n),merge:Gn.bind(null,n),parse:ar})}var cr=sr(null,Bn),lr=T(((e,t)=>{let n=function(){};n.prototype=Object.create(null);let r=/; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu,i=/\\([\v\u0020-\u00ff])/gu,a=/^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u,o={type:``,parameters:new n};Object.freeze(o.parameters),Object.freeze(o);function s(e){if(typeof e!=`string`)throw TypeError(`argument header is required and must be a string`);let t=e.indexOf(`;`),o=t===-1?e.trim():e.slice(0,t).trim();if(a.test(o)===!1)throw TypeError(`invalid media type`);let s={type:o.toLowerCase(),parameters:new n};if(t===-1)return s;let c,l,u;for(r.lastIndex=t;l=r.exec(e);){if(l.index!==t)throw TypeError(`invalid parameter format`);t+=l[0].length,c=l[1].toLowerCase(),u=l[2],u[0]===`"`&&(u=u.slice(1,u.length-1),i.test(u)&&(u=u.replace(i,`$1`))),s.parameters[c]=u}if(t!==e.length)throw TypeError(`invalid parameter format`);return s}function c(e){if(typeof e!=`string`)return o;let t=e.indexOf(`;`),s=t===-1?e.trim():e.slice(0,t).trim();if(a.test(s)===!1)return o;let c={type:s.toLowerCase(),parameters:new n};if(t===-1)return c;let l,u,d;for(r.lastIndex=t;u=r.exec(e);){if(u.index!==t)return o;t+=u[0].length,l=u[1].toLowerCase(),d=u[2],d[0]===`"`&&(d=d.slice(1,d.length-1),i.test(d)&&(d=d.replace(i,`$1`))),c.parameters[l]=d}return t===e.length?c:o}t.exports.default={parse:s,safeParse:c},t.exports.parse=s,t.exports.safeParse=c,t.exports.defaultContentType=o}))(),ur=class extends Error{name;status;request;response;constructor(e,t,n){super(e,{cause:n.cause}),this.name=`HttpError`,this.status=Number.parseInt(t),Number.isNaN(this.status)&&(this.status=0),`response`in n&&(this.response=n.response);let r=Object.assign({},n.request);n.request.headers.authorization&&(r.headers=Object.assign({},n.request.headers,{authorization:n.request.headers.authorization.replace(/(?``;async function hr(e){let t=e.request?.fetch||globalThis.fetch;if(!t)throw Error(`fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing`);let n=e.request?.log||console,r=e.request?.parseSuccessResponseBody!==!1,i=pr(e.body)||Array.isArray(e.body)?JSON.stringify(e.body):e.body,a=Object.fromEntries(Object.entries(e.headers).map(([e,t])=>[e,String(t)])),o;try{o=await t(e.url,{method:e.method,body:i,redirect:e.request?.redirect,headers:a,signal:e.request?.signal,...e.body&&{duplex:`half`}})}catch(t){let n=`Unknown Error`;if(t instanceof Error){if(t.name===`AbortError`)throw t.status=500,t;n=t.message,t.name===`TypeError`&&`cause`in t&&(t.cause instanceof Error?n=t.cause.message:typeof t.cause==`string`&&(n=t.cause))}let r=new ur(n,500,{request:e});throw r.cause=t,r}let s=o.status,c=o.url,l={};for(let[e,t]of o.headers)l[e]=t;let u={url:c,status:s,headers:l,data:``};if(`deprecation`in l){let t=l.link&&l.link.match(/<([^<>]+)>; rel="deprecation"/),r=t&&t.pop();n.warn(`[@octokit/request] "${e.method} ${e.url}" is deprecated. It is scheduled to be removed on ${l.sunset}${r?`. See ${r}`:``}`)}if(s===204||s===205)return u;if(e.method===`HEAD`){if(s<400)return u;throw new ur(o.statusText,s,{response:u,request:e})}if(s===304)throw u.data=await gr(o),new ur(`Not modified`,s,{response:u,request:e});if(s>=400)throw u.data=await gr(o),new ur(vr(u.data),s,{response:u,request:e});return u.data=r?await gr(o):o.body,u}async function gr(e){let t=e.headers.get(`content-type`);if(!t)return e.text().catch(mr);let n=(0,lr.safeParse)(t);if(_r(n)){let t=``;try{return t=await e.text(),JSON.parse(t)}catch{return t}}else if(n.type.startsWith(`text/`)||n.parameters.charset?.toLowerCase()===`utf-8`)return e.text().catch(mr);else return e.arrayBuffer().catch(()=>new ArrayBuffer(0))}function _r(e){return e.type===`application/json`||e.type===`application/scim+json`}function vr(e){if(typeof e==`string`)return e;if(e instanceof ArrayBuffer)return`Unknown error`;if(`message`in e){let t=`documentation_url`in e?` - ${e.documentation_url}`:``;return Array.isArray(e.errors)?`${e.message}: ${e.errors.map(e=>JSON.stringify(e)).join(`, `)}${t}`:`${e.message}${t}`}return`Unknown error: ${JSON.stringify(e)}`}function yr(e,t){let n=e.defaults(t);return Object.assign(function(e,t){let r=n.merge(e,t);if(!r.request||!r.request.hook)return hr(n.parse(r));let i=(e,t)=>hr(n.parse(n.merge(e,t)));return Object.assign(i,{endpoint:n,defaults:yr.bind(null,n)}),r.request.hook(i,r)},{endpoint:n,defaults:yr.bind(null,n)})}var br=yr(cr,fr),xr=`0.0.0-development`;function Sr(e){return`Request failed due to following response errors: `+e.errors.map(e=>` - ${e.message}`).join(` -`)}var Cr=class extends Error{constructor(e,t,n){super(Sr(n)),this.request=e,this.headers=t,this.response=n,this.errors=n.errors,this.data=n.data,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}name=`GraphqlResponseError`;errors;data},wr=[`method`,`baseUrl`,`url`,`headers`,`request`,`query`,`mediaType`,`operationName`],Tr=[`query`,`method`,`url`],Er=/\/api\/v3\/?$/;function Dr(e,t,n){if(n){if(typeof t==`string`&&`query`in n)return Promise.reject(Error(`[@octokit/graphql] "query" cannot be used as variable name`));for(let e in n)if(Tr.includes(e))return Promise.reject(Error(`[@octokit/graphql] "${e}" cannot be used as variable name`))}let r=typeof t==`string`?Object.assign({query:t},n):t,i=Object.keys(r).reduce((e,t)=>wr.includes(t)?(e[t]=r[t],e):(e.variables||={},e.variables[t]=r[t],e),{}),a=r.baseUrl||e.endpoint.DEFAULTS.baseUrl;return Er.test(a)&&(i.url=a.replace(Er,`/api/graphql`)),e(i).then(e=>{if(e.data.errors){let t={};for(let n of Object.keys(e.headers))t[n]=e.headers[n];throw new Cr(i,t,e.data)}return e.data.data})}function Or(e,t){let n=e.defaults(t);return Object.assign((e,t)=>Dr(n,e,t),{defaults:Or.bind(null,n),endpoint:n.endpoint})}Or(br,{headers:{"user-agent":`octokit-graphql.js/${xr} ${kn()}`},method:`POST`,url:`/graphql`});function kr(e){return Or(e,{method:`POST`,url:`/graphql`})}var Ar=`(?:[a-zA-Z0-9_-]+)`,jr=`\\.`,Mr=RegExp(`^${Ar}${jr}${Ar}${jr}${Ar}$`),Nr=Mr.test.bind(Mr);async function Pr(e){let t=Nr(e),n=e.startsWith(`v1.`)||e.startsWith(`ghs_`),r=e.startsWith(`ghu_`);return{type:`token`,token:e,tokenType:t?`app`:n?`installation`:r?`user-to-server`:`oauth`}}function Fr(e){return e.split(/\./).length===3?`bearer ${e}`:`token ${e}`}async function Ir(e,t,n,r){let i=t.endpoint.merge(n,r);return i.headers.authorization=Fr(e),t(i)}var Lr=function(e){if(!e)throw Error(`[@octokit/auth-token] No token passed to createTokenAuth`);if(typeof e!=`string`)throw Error(`[@octokit/auth-token] Token passed to createTokenAuth is not a string`);return e=e.replace(/^(token|bearer) +/i,``),Object.assign(Pr.bind(null,e),{hook:Ir.bind(null,e)})};const Rr=`7.0.6`,zr=()=>{},Br=console.warn.bind(console),Vr=console.error.bind(console);function Hr(e={}){return typeof e.debug!=`function`&&(e.debug=zr),typeof e.info!=`function`&&(e.info=zr),typeof e.warn!=`function`&&(e.warn=Br),typeof e.error!=`function`&&(e.error=Vr),e}const Ur=`octokit-core.js/${Rr} ${kn()}`;var Wr=class{static VERSION=Rr;static defaults(e){return class extends this{constructor(...t){let n=t[0]||{};if(typeof e==`function`){super(e(n));return}super(Object.assign({},e,n,n.userAgent&&e.userAgent?{userAgent:`${n.userAgent} ${e.userAgent}`}:null))}}}static plugins=[];static plugin(...e){let t=this.plugins;return class extends this{static plugins=t.concat(e.filter(e=>!t.includes(e)))}}constructor(e={}){let t=new Rn.Collection,n={baseUrl:br.endpoint.DEFAULTS.baseUrl,headers:{},request:Object.assign({},e.request,{hook:t.bind(null,`request`)}),mediaType:{previews:[],format:``}};if(n.headers[`user-agent`]=e.userAgent?`${e.userAgent} ${Ur}`:Ur,e.baseUrl&&(n.baseUrl=e.baseUrl),e.previews&&(n.mediaType.previews=e.previews),e.timeZone&&(n.headers[`time-zone`]=e.timeZone),this.request=br.defaults(n),this.graphql=kr(this.request).defaults(n),this.log=Hr(e.log),this.hook=t,e.authStrategy){let{authStrategy:n,...r}=e,i=n(Object.assign({request:this.request,log:this.log,octokit:this,octokitOptions:r},e.auth));t.wrap(`request`,i.hook),this.auth=i}else if(!e.auth)this.auth=async()=>({type:`unauthenticated`});else{let n=Lr(e.auth);t.wrap(`request`,n.hook),this.auth=n}let r=this.constructor;for(let t=0;t({async next(){if(!s)return{done:!0};try{let e=$r(await i({method:a,url:s,headers:o}));if(s=((e.headers.link||``).match(/<([^<>]+)>;\s*rel="next"/)||[])[1],!s&&`total_commits`in e.data){let t=new URL(e.url),n=t.searchParams,r=parseInt(n.get(`page`)||`1`,10);r*parseInt(n.get(`per_page`)||`250`,10){if(i.done)return t;let a=!1;function o(){a=!0}return t=t.concat(r?r(i.value,o):i.value.data),a?t:ni(e,t,n,r)})}Object.assign(ti,{iterator:ei});function ri(e){return{paginate:Object.assign(ti.bind(null,e),{iterator:ei.bind(null,e)})}}ri.VERSION=Qr,new yn;const ii=On(),ai={baseUrl:ii,request:{agent:Tn(ii),fetch:Dn(ii)}},oi=Wr.plugin(Xr,ri).defaults(ai);function si(e,t){let n=Object.assign({},t||{}),r=wn(e,n);return r&&(n.auth=r),n}const ci=new yn;function li(e,t,...n){return new(oi.plugin(...n))(si(e,t))}var Y=e(ie(),1),ui=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},di=class{constructor(e,t,n){if(e<1)throw Error(`max attempts should be greater than or equal to 1`);if(this.maxAttempts=e,this.minSeconds=Math.floor(t),this.maxSeconds=Math.floor(n),this.minSeconds>this.maxSeconds)throw Error(`min seconds should be less than or equal to max seconds`)}execute(e,t){return ui(this,void 0,void 0,function*(){let n=1;for(;nsetTimeout(t,e*1e3))})}},X=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},fi=class extends Error{constructor(e){super(`Unexpected HTTP response: ${e}`),this.httpStatusCode=e,Object.setPrototypeOf(this,new.target.prototype)}};const pi=process.platform===`win32`;process.platform;function mi(e,t,n,r){return X(this,void 0,void 0,function*(){return t||=W.join(ki(),he.randomUUID()),yield S(W.dirname(t)),j(`Downloading ${e}`),j(`Destination ${t}`),yield new di(3,Ai(`TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS`,10),Ai(`TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS`,20)).execute(()=>X(this,void 0,void 0,function*(){return yield hi(e,t||``,n,r)}),e=>!(e instanceof fi&&e.httpStatusCode&&e.httpStatusCode<500&&e.httpStatusCode!==408&&e.httpStatusCode!==429))})}function hi(e,t,n,r){return X(this,void 0,void 0,function*(){if(U.existsSync(t))throw Error(`Destination file path ${t} already exists`);let i=new u(`actions/tool-cache`,[],{allowRetries:!1});n&&(j(`set auth`),r===void 0&&(r={}),r.authorization=n);let a=yield i.get(e,r);if(a.message.statusCode!==200){let t=new fi(a.message.statusCode);throw j(`Failed to download from "${e}". Code(${a.message.statusCode}) Message(${a.message.statusMessage})`),t}let o=ye.promisify(Oe.pipeline),c=Ai(`TEST_DOWNLOAD_TOOL_RESPONSE_MESSAGE_FACTORY`,()=>a.message)(),l=!1;try{return yield o(c,U.createWriteStream(t)),j(`download complete`),l=!0,t}finally{if(!l){j(`download failed`);try{yield s(t)}catch(e){j(`Failed to delete '${t}'. ${e.message}`)}}}})}function gi(e,t){return X(this,arguments,void 0,function*(e,t,n=`xz`){if(!e)throw Error(`parameter 'file' is required`);t=yield Ci(t),j(`Checking tar --version`);let r=``;yield x(`tar --version`,[],{ignoreReturnCode:!0,silent:!0,listeners:{stdout:e=>r+=e.toString(),stderr:e=>r+=e.toString()}}),j(r.trim());let i=r.toUpperCase().includes(`GNU TAR`),a;a=n instanceof Array?n:[n],l()&&!n.includes(`v`)&&a.push(`-v`);let o=t,s=e;return pi&&i&&(a.push(`--force-local`),o=t.replace(/\\/g,`/`),s=e.replace(/\\/g,`/`)),i&&(a.push(`--warning=no-unknown-keyword`),a.push(`--overwrite`)),a.push(`-C`,o,`-f`,s),yield x(`tar`,a),t})}function _i(e,t){return X(this,void 0,void 0,function*(){if(!e)throw Error(`parameter 'file' is required`);return t=yield Ci(t),pi?yield vi(e,t):yield yi(e,t),t})}function vi(e,t){return X(this,void 0,void 0,function*(){let n=e.replace(/'/g,`''`).replace(/"|\n|\r/g,``),r=t.replace(/'/g,`''`).replace(/"|\n|\r/g,``),i=yield d(`pwsh`,!1);if(i){let e=[`-NoLogo`,`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Unrestricted`,`-Command`,[`$ErrorActionPreference = 'Stop' ;`,`try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ;`,`try { [System.IO.Compression.ZipFile]::ExtractToDirectory('${n}', '${r}', $true) }`,`catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath '${n}' -DestinationPath '${r}' -Force } else { throw $_ } } ;`].join(` `)];j(`Using pwsh at path: ${i}`),yield x(`"${i}"`,e)}else{let e=[`-NoLogo`,`-Sta`,`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Unrestricted`,`-Command`,[`$ErrorActionPreference = 'Stop' ;`,`try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ;`,`if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath '${n}' -DestinationPath '${r}' -Force }`,`else {[System.IO.Compression.ZipFile]::ExtractToDirectory('${n}', '${r}', $true) }`].join(` `)],t=yield d(`powershell`,!0);j(`Using powershell at path: ${t}`),yield x(`"${t}"`,e)}})}function yi(e,t){return X(this,void 0,void 0,function*(){let n=yield d(`unzip`,!0),r=[e];l()||r.unshift(`-q`),r.unshift(`-o`),yield x(`"${n}"`,r,{cwd:t})})}function bi(e,t,n,r){return X(this,void 0,void 0,function*(){if(n=Y.clean(n)||n,r||=pe.arch(),j(`Caching tool ${t} ${n} ${r}`),j(`source dir: ${e}`),!U.statSync(e).isDirectory())throw Error(`sourceDir is not a directory`);let i=yield wi(t,n,r);for(let t of U.readdirSync(e))yield b(W.join(e,t),i,{recursive:!0});return Ti(t,n,r),i})}function xi(e,t,n){if(!e)throw Error(`toolName parameter is required`);if(!t)throw Error(`versionSpec parameter is required`);n||=pe.arch(),Ei(t)||(t=Di(Si(e,n),t));let r=``;if(t){t=Y.clean(t)||``;let i=W.join(Oi(),e,t,n);j(`checking cache: ${i}`),U.existsSync(i)&&U.existsSync(`${i}.complete`)?(j(`Found tool in cache ${e} ${t} ${n}`),r=i):j(`not found`)}return r}function Si(e,t){let n=[];t||=pe.arch();let r=W.join(Oi(),e);if(U.existsSync(r)){let e=U.readdirSync(r);for(let i of e)if(Ei(i)){let e=W.join(r,i,t||``);U.existsSync(e)&&U.existsSync(`${e}.complete`)&&n.push(i)}}return n}function Ci(e){return X(this,void 0,void 0,function*(){return e||=W.join(ki(),he.randomUUID()),yield S(e),e})}function wi(e,t,n){return X(this,void 0,void 0,function*(){let r=W.join(Oi(),e,Y.clean(t)||t,n||``);j(`destination ${r}`);let i=`${r}.complete`;return yield s(r),yield s(i),yield S(r),r})}function Ti(e,t,n){let r=`${W.join(Oi(),e,Y.clean(t)||t,n||``)}.complete`;U.writeFileSync(r,``),j(`finished caching tool`)}function Ei(e){let t=Y.clean(e)||``;j(`isExplicit: ${t}`);let n=Y.valid(t)!=null;return j(`explicit? ${n}`),n}function Di(e,t){let n=``;j(`evaluating ${e.length} versions`),e=e.sort((e,t)=>Y.gt(e,t)?1:-1);for(let r=e.length-1;r>=0;r--){let i=e[r];if(Y.satisfies(i,t)){n=i;break}}return j(n?`matched: ${n}`:`match not found`),n}function Oi(){let e=process.env.RUNNER_TOOL_CACHE||``;return ve(e,`Expected RUNNER_TOOL_CACHE to be defined`),e}function ki(){let e=process.env.RUNNER_TEMP||``;return ve(e,`Expected RUNNER_TEMP to be defined`),e}function Ai(e,t){let n=global[e];return n===void 0?t:n}function ji(e){let t;try{t=JSON.parse(e)}catch(e){throw e instanceof SyntaxError?Error(`Invalid auth-json format: ${e.message}`):e}if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`auth-json must be a JSON object`);return t}async function Mi(e,t,n){let r=B.join(t,`auth.json`);await G.mkdir(t,{recursive:!0});let i=JSON.stringify(e,null,2);return await G.writeFile(r,i,{mode:384}),n.info(`Populated auth.json`,{path:r,providers:Object.keys(e).length}),r}function Ni(){let e=H.platform,t=H.arch;return{os:{darwin:`darwin`,linux:`linux`,win32:`windows`}[e]??`linux`,arch:{arm64:`aarch64`,x64:`x64`}[t]??`x64`,ext:`.zip`}}function Pi(e,t){return`https://github.com/oven-sh/bun/releases/download/bun-${e.startsWith(`v`)?e:`v${e}`}/${`bun-${t.os}-${t.arch}${t.ext}`}`}async function Fi(e,t,n,r,i=ne){let a=Ni(),o=t.find(`bun`,i,a.arch);if(o.length>0)return e.info(`Bun found in cache`,{version:i,path:o}),r(o),await Li(o),{path:o,version:i,cached:!0};e.info(`Downloading Bun`,{version:i});let s=Pi(i,a);try{let o=await t.downloadTool(s);if(H.platform!==`win32`&&!await Ri(o,e,n))throw Error(`Downloaded Bun archive appears corrupted`);e.info(`Extracting Bun`);let c=await Ii(await t.extractZip(o),t),l=fe.dirname(c);e.info(`Caching Bun`);let u=await t.cacheDir(l,`bun`,i,a.arch);return r(u),await Li(u),e.info(`Bun installed`,{version:i,path:u}),{path:u,version:i,cached:!1}}catch(e){let t=M(e);throw Error(`Failed to install Bun ${i}: ${t}`)}}async function Ii(e,t){for(let n of await Ce.readdir(e,{withFileTypes:!0})){let{name:r}=n,i=fe.join(e,r);if(n.isFile()){if(r===`bun`||r===`bun.exe`)return i;if(/^bun.*\.zip/.test(r))return Ii(await t.extractZip(i),t)}if(r.startsWith(`bun`)&&n.isDirectory())return Ii(i,t)}throw Error(`Could not find executable: bun`)}async function Li(e){let t=e=>H.platform===`win32`?`${e}.exe`:e,n=fe.join(e,t(`bun`));try{await Ce.symlink(n,fe.join(e,t(`bunx`)))}catch(e){let t=typeof e==`object`?e.code:void 0;if(t!==`EEXIST`&&t!==`EPERM`&&t!==`EACCES`)throw e}}async function Ri(e,t,n){try{let{stdout:r}=await n.getExecOutput(`file`,[e],{silent:!0}),i=r.includes(`Zip archive`)||r.includes(`ZIP`);return i||t.warning(`Bun download validation failed`,{output:r.trim()}),i}catch{return t.debug(`Could not validate Bun download (file command unavailable)`),!0}}function zi(e){return{debug:t=>e.debug(t),info:t=>e.info(t),warn:t=>e.warning(t),error:t=>e.error(t)}}function Bi(e){let{token:t,logger:n}=e;return n.debug(`Creating GitHub client with token`),li(t,{log:zi(n)})}async function Vi(e,t){try{let{data:n}=await e.rest.users.getAuthenticated();return t.debug(`Authenticated as`,{login:n.login,type:n.type}),n.login}catch{return t.debug(`Failed to get authenticated user, may be app token`),`fro-bot[bot]`}}async function Hi(e,t,n,r){let i=t??n,a=t==null?n.length>0?`github-token`:`none`:`app-token`;if(i.length===0)return r.warning(`No GitHub token available`),{authenticated:!1,method:`none`,botLogin:null};H.env.GH_TOKEN=i,r.info(`Configured authentication`,{method:a});let o=null;return e!=null&&(o=await Vi(e,r)),{authenticated:!0,method:a,botLogin:o}}async function Ui(e,t){let n=await t.getExecOutput(`git`,[`config`,e],{ignoreReturnCode:!0,silent:!0});return n.exitCode===0&&n.stdout.trim().length>0?n.stdout.trim():null}async function Wi(e,t,n,r){let i=await Ui(`user.name`,r),a=await Ui(`user.email`,r);if(i!=null&&a!=null){n.info(`Git identity already configured`,{name:i,email:a});return}if(t==null)throw Error(`Cannot configure Git identity: no authenticated GitHub user`);let o=null;if(a==null){let r=await Xe(e,t,n);if(r==null)throw Error(`Cannot configure Git identity: failed to look up user ID for '${t}'`);o=String(r.id)}i??await r.exec(`git`,[`config`,`--global`,`user.name`,t],void 0);let s=`${o}+${t}@users.noreply.github.com`;a??await r.exec(`git`,[`config`,`--global`,`user.email`,s],void 0),n.info(`Configured git identity`,{name:i??t,email:a??s})}async function Gi(e,t,n={}){let{logger:r,execAdapter:i}=t,{claude:a=`no`,copilot:o=`no`,gemini:s=`no`,openai:c=`no`,opencodeZen:l=`no`,zaiCodingPlan:u=`no`}=n;r.info(`Installing Oh My OpenCode plugin`,{version:e,claude:a,copilot:o,gemini:s,openai:c,opencodeZen:l,zaiCodingPlan:u});let d=``,f=[`oh-my-opencode@${e}`,`install`,`--no-tui`,`--claude=${a}`,`--copilot=${o}`,`--gemini=${s}`,`--openai=${c}`,`--opencode-zen=${l}`,`--zai-coding-plan=${u}`];try{let t=await i.exec(`bunx`,f,{listeners:{stdout:e=>{d+=e.toString()},stderr:e=>{d+=e.toString()}},ignoreReturnCode:!0});if(t!==0){let e=`bunx oh-my-opencode install returned exit code ${t}`;return r.error(e,{output:d.slice(0,1e3)}),{installed:!1,version:null,error:`${e}\n${d.slice(0,500)}`}}let n=/oh-my-opencode@(\d+\.\d+\.\d+)/i.exec(d),a=n!=null&&n[1]!=null?n[1]:e;return r.info(`oMo plugin installed`,{version:a}),{installed:!0,version:a,error:null}}catch(e){let t=M(e),n=d.length>0?`${t}\nOutput: ${d.slice(0,500)}`:t;return r.error(`Failed to run oMo installer`,{error:t,output:d.slice(0,500)}),{installed:!1,version:null,error:`bunx oh-my-opencode install failed: ${n}`}}}const Ki=`opencode`,qi=`1.2.9`;function Ji(){let e=Ee.platform(),t=Ee.arch(),n={darwin:`darwin`,linux:`linux`,win32:`windows`},r={x64:`x64`,arm64:`arm64`},i=e===`win32`||e===`darwin`?`.zip`:`.tar.gz`;return{os:n[e]??`linux`,arch:r[t]??`x64`,ext:i}}function Yi(e,t){return`https://github.com/anomalyco/opencode/releases/download/${e.startsWith(`v`)?e:`v${e}`}/${`opencode-${t.os}-${t.arch}${t.ext}`}`}async function Xi(e,t,n,r){if(H.platform===`win32`)return!0;try{let{stdout:i}=await r.getExecOutput(`file`,[e],{silent:!0}),a=(t===`.zip`?[`Zip archive`,`ZIP`]:[`gzip`,`tar`,`compressed`]).some(e=>i.includes(e));return a||n.warning(`Download validation failed`,{output:i.trim()}),a}catch{return n.debug(`Could not validate download (file command unavailable)`),!0}}async function Zi(e,t,n,r,i=qi){let a=Ji(),o=n.find(Ki,e,a.arch);if(o.length>0)return t.info(`OpenCode found in cache`,{version:e,path:o}),{path:o,version:e,cached:!0};try{return await Qi(e,a,t,n,r)}catch(n){t.warning(`Primary version install failed, trying fallback`,{requestedVersion:e,fallbackVersion:i,error:M(n)})}if(e!==i)try{let e=await Qi(i,a,t,n,r);return t.info(`Installed fallback version`,{version:i}),e}catch(t){throw Error(`Failed to install OpenCode (tried ${e} and ${i}): ${M(t)}`)}throw Error(`Failed to install OpenCode version ${e}`)}async function Qi(e,t,n,r,i){n.info(`Downloading OpenCode`,{version:e});let a=Yi(e,t),o=await r.downloadTool(a);if(!await Xi(o,t.ext,n,i))throw Error(`Downloaded archive appears corrupted`);n.info(`Extracting OpenCode`);let s=t.ext===`.zip`?await r.extractZip(o):await r.extractTar(o);n.info(`Caching OpenCode`);let c=await r.cacheDir(s,Ki,e,t.arch);return n.info(`OpenCode installed`,{version:e,path:c}),{path:c,version:e,cached:!1}}async function $i(e){let t=await fetch(`https://api.github.com/repos/anomalyco/opencode/releases/latest`);if(!t.ok)throw Error(`Failed to fetch latest OpenCode version: ${t.statusText}`);let n=(await t.json()).tag_name.replace(/^v/,``);return e.info(`Latest OpenCode version`,{version:n}),n}const ea={restoreCache:async(e,t,n)=>I(e,t,n),saveCache:async(e,t)=>D(e,t)};function ta(e){let{os:t,opencodeVersion:n,omoVersion:r}=e;return`${ce}-${t}-oc-${n}-omo-${r}`}function na(e){let{os:t,opencodeVersion:n,omoVersion:r}=e;return[`${ce}-${t}-oc-${n}-omo-${r}-`]}async function ra(e){let{logger:t,os:n,opencodeVersion:r,omoVersion:i,toolCachePath:a,bunCachePath:o,omoConfigPath:s,cacheAdapter:c=ea}=e,l=ta({os:n,opencodeVersion:r,omoVersion:i}),u=na({os:n,opencodeVersion:r,omoVersion:i}),d=[a,o,s];t.info(`Restoring tools cache`,{primaryKey:l,restoreKeys:[...u],paths:d});try{let e=await c.restoreCache(d,l,[...u]);return e==null?(t.info(`Tools cache miss - will install tools`),{hit:!1,restoredKey:null}):(t.info(`Tools cache restored`,{restoredKey:e}),{hit:!0,restoredKey:e})}catch(e){return t.warning(`Tools cache restore failed`,{error:M(e)}),{hit:!1,restoredKey:null}}}async function ia(e){let{logger:t,os:n,opencodeVersion:r,omoVersion:i,toolCachePath:a,bunCachePath:o,omoConfigPath:s,cacheAdapter:c=ea}=e,l=ta({os:n,opencodeVersion:r,omoVersion:i}),u=[a,o,s];t.info(`Saving tools cache`,{saveKey:l,paths:u});try{return await c.saveCache(u,l),t.info(`Tools cache saved`,{saveKey:l}),!0}catch(e){return e instanceof Error&&e.message.includes(`already exists`)?(t.info(`Tools cache key already exists, skipping save`),!0):(t.warning(`Tools cache save failed`,{error:M(e)}),!1)}}const aa=[`claude`,`claude-max20`,`copilot`,`gemini`,`openai`,`opencode-zen`,`zai-coding-plan`];function oa(e){let t=e.split(`,`).map(e=>e.trim().toLowerCase()).filter(e=>e.length>0),n=`no`,r=`no`,i=`no`,a=`no`,o=`no`,s=`no`;for(let e of t)if(aa.includes(e))switch(e){case`claude`:n=`yes`;break;case`claude-max20`:n=`max20`;break;case`copilot`:r=`yes`;break;case`gemini`:i=`yes`;break;case`openai`:a=`yes`;break;case`opencode-zen`:o=`yes`;break;case`zai-coding-plan`:s=`yes`;break}return{claude:n,copilot:r,gemini:i,openai:a,opencodeZen:o,zaiCodingPlan:s}}function sa(){return{find:xi,downloadTool:mi,extractTar:gi,extractZip:_i,cacheDir:bi}}function ca(){return{exec:x,getExecOutput:c}}function la(){return{opencodeVersion:m(`opencode-version`)||`latest`,authJson:m(`auth-json`,{required:!0}),appId:m(`app-id`)||null,privateKey:m(`private-key`)||null,opencodeConfig:m(`opencode-config`)||null}}async function ua(){let e=Date.now(),n=A({component:`setup`}),r=sa(),o=ca();try{let s=la(),c=m(`github-token`,{required:!0});n.info(`Starting setup`,{version:s.opencodeVersion});let l;try{l=ji(s.authJson)}catch(e){return _(`Invalid auth-json: ${M(e)}`),null}let u=s.opencodeVersion;if(u===`latest`)try{u=await $i(n)}catch(e){n.warning(`Failed to get latest version, using fallback`,{error:M(e)}),u=qi}let d=m(`omo-version`).trim(),f=d.length>0?d:N,h=H.env.RUNNER_TOOL_CACHE??`/opt/hostedtoolcache`,g=V(h,`opencode`),v=V(h,`bun`),y=V(De(),`.config`,`opencode`),b=a(),x=await ra({logger:n,os:b,opencodeVersion:u,omoVersion:f,toolCachePath:g,bunCachePath:v,omoConfigPath:y}),S=x.hit?`hit`:`miss`,C,w=!1,T=null;if(x.hit){let e=r.find(`opencode`,u);e.length>0?(C={path:e,version:u,cached:!0},n.info(`Tools cache hit, using cached OpenCode CLI`,{version:u,omoVersion:f})):n.warning(`Tools cache hit but binary not found in tool-cache, falling through to install`,{requestedVersion:u,restoredKey:x.restoredKey})}if(C==null)try{C=await Zi(u,n,r,o)}catch(e){return _(`Failed to install OpenCode: ${M(e)}`),null}let E=!1;try{await Fi(n,r,o,t,ne),E=!0}catch(e){n.warning(`Bun installation failed, oMo will be unavailable`,{error:M(e)})}if(E){let e=m(`omo-providers`).trim(),t=oa(e.length>0?e:se),r=await Gi(f,{logger:n,execAdapter:o},t);r.installed?(n.info(`oMo installed`,{version:r.version}),w=!0):n.warning(`oMo installation failed, continuing without oMo`,{error:r.error??`unknown error`}),T=r.error}let te={autoupdate:!1};if(s.opencodeConfig!=null){let e=JSON.parse(s.opencodeConfig);if(typeof e!=`object`||!e||Array.isArray(e))return _(`opencode-config must be a JSON object`),null;Object.assign(te,e)}p(`OPENCODE_CONFIG_CONTENT`,JSON.stringify(te)),x.hit||await ia({logger:n,os:b,opencodeVersion:u,omoVersion:f,toolCachePath:g,bunCachePath:v,omoConfigPath:y}),t(C.path),z(`opencode-path`,C.path),z(`opencode-version`,C.version),n.info(`OpenCode ready`,{version:C.version,cached:C.cached});let D=li(c),re=await Hi(D,null,c,n);p(`GH_TOKEN`,c),n.info(`GitHub CLI configured`),await Wi(D,re.botLogin,n,o);let O=V(i(),`opencode`),k=await Mi(l,O,n);z(`auth-json-path`,k),n.info(`auth.json populated`,{path:k});let A=H.env.GITHUB_REPOSITORY??`unknown/unknown`,j=H.env.GITHUB_REF_NAME??`main`,ie=a(),ae=ee({agentIdentity:`github`,repo:A,ref:j,os:ie}),P=oe({agentIdentity:`github`,repo:A,ref:j,os:ie}),F=`miss`;try{let e=await I([O],ae,[...P]);e==null?n.info(`No cache found`):(F=`hit`,n.info(`Cache restored`,{key:e}))}catch(e){F=`corrupted`,n.warning(`Cache restore failed`,{error:M(e)})}z(`cache-status`,F),z(`storage-path`,O);let L=Date.now()-e,R={opencodePath:C.path,opencodeVersion:C.version,ghAuthenticated:re.authenticated,omoInstalled:w,omoError:T,cacheStatus:F,toolsCacheStatus:S,duration:L};return n.info(`Setup complete`,{duration:L}),R}catch(e){let t=M(e);return n.error(`Setup failed`,{error:t}),_(t),null}}function da(e){return{success:!0,data:e}}function fa(e){return{success:!1,error:e}}const pa=[`OWNER`,`MEMBER`,`COLLABORATOR`];function ma(e,t){switch(e.eventType){case`issue_comment`:return{directive:`Respond to the comment above. Post your response as a single comment on this thread.`,appendMode:!0};case`discussion_comment`:return{directive:`Respond to the discussion comment above. Post your response as a single comment.`,appendMode:!0};case`issues`:return e.action===`opened`?{directive:`Triage this issue: summarize, reproduce if possible, propose next steps. Post your response as a single comment.`,appendMode:!0}:{directive:`Respond to the mention in this issue. Post your response as a single comment.`,appendMode:!0};case`pull_request`:return{directive:[`Review this pull request for code quality, potential bugs, and improvements.`,"If you are a requested reviewer, submit a review via `gh pr review` with your full response (including Run Summary) in the --body.",`Include the Run Summary in the review body. Do not post a separate comment.`,`If the author is a collaborator, prioritize actionable feedback over style nits.`].join(` +`)}var Cr=class extends Error{constructor(e,t,n){super(Sr(n)),this.request=e,this.headers=t,this.response=n,this.errors=n.errors,this.data=n.data,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}name=`GraphqlResponseError`;errors;data},wr=[`method`,`baseUrl`,`url`,`headers`,`request`,`query`,`mediaType`,`operationName`],Tr=[`query`,`method`,`url`],Er=/\/api\/v3\/?$/;function Dr(e,t,n){if(n){if(typeof t==`string`&&`query`in n)return Promise.reject(Error(`[@octokit/graphql] "query" cannot be used as variable name`));for(let e in n)if(Tr.includes(e))return Promise.reject(Error(`[@octokit/graphql] "${e}" cannot be used as variable name`))}let r=typeof t==`string`?Object.assign({query:t},n):t,i=Object.keys(r).reduce((e,t)=>wr.includes(t)?(e[t]=r[t],e):(e.variables||={},e.variables[t]=r[t],e),{}),a=r.baseUrl||e.endpoint.DEFAULTS.baseUrl;return Er.test(a)&&(i.url=a.replace(Er,`/api/graphql`)),e(i).then(e=>{if(e.data.errors){let t={};for(let n of Object.keys(e.headers))t[n]=e.headers[n];throw new Cr(i,t,e.data)}return e.data.data})}function Or(e,t){let n=e.defaults(t);return Object.assign((e,t)=>Dr(n,e,t),{defaults:Or.bind(null,n),endpoint:n.endpoint})}Or(br,{headers:{"user-agent":`octokit-graphql.js/${xr} ${kn()}`},method:`POST`,url:`/graphql`});function kr(e){return Or(e,{method:`POST`,url:`/graphql`})}var Ar=`(?:[a-zA-Z0-9_-]+)`,jr=`\\.`,Mr=RegExp(`^${Ar}${jr}${Ar}${jr}${Ar}$`),Nr=Mr.test.bind(Mr);async function Pr(e){let t=Nr(e),n=e.startsWith(`v1.`)||e.startsWith(`ghs_`),r=e.startsWith(`ghu_`);return{type:`token`,token:e,tokenType:t?`app`:n?`installation`:r?`user-to-server`:`oauth`}}function Fr(e){return e.split(/\./).length===3?`bearer ${e}`:`token ${e}`}async function Ir(e,t,n,r){let i=t.endpoint.merge(n,r);return i.headers.authorization=Fr(e),t(i)}var Lr=function(e){if(!e)throw Error(`[@octokit/auth-token] No token passed to createTokenAuth`);if(typeof e!=`string`)throw Error(`[@octokit/auth-token] Token passed to createTokenAuth is not a string`);return e=e.replace(/^(token|bearer) +/i,``),Object.assign(Pr.bind(null,e),{hook:Ir.bind(null,e)})};const Rr=`7.0.6`,zr=()=>{},Br=console.warn.bind(console),Vr=console.error.bind(console);function Hr(e={}){return typeof e.debug!=`function`&&(e.debug=zr),typeof e.info!=`function`&&(e.info=zr),typeof e.warn!=`function`&&(e.warn=Br),typeof e.error!=`function`&&(e.error=Vr),e}const Ur=`octokit-core.js/${Rr} ${kn()}`;var Wr=class{static VERSION=Rr;static defaults(e){return class extends this{constructor(...t){let n=t[0]||{};if(typeof e==`function`){super(e(n));return}super(Object.assign({},e,n,n.userAgent&&e.userAgent?{userAgent:`${n.userAgent} ${e.userAgent}`}:null))}}}static plugins=[];static plugin(...e){let t=this.plugins;return class extends this{static plugins=t.concat(e.filter(e=>!t.includes(e)))}}constructor(e={}){let t=new Rn.Collection,n={baseUrl:br.endpoint.DEFAULTS.baseUrl,headers:{},request:Object.assign({},e.request,{hook:t.bind(null,`request`)}),mediaType:{previews:[],format:``}};if(n.headers[`user-agent`]=e.userAgent?`${e.userAgent} ${Ur}`:Ur,e.baseUrl&&(n.baseUrl=e.baseUrl),e.previews&&(n.mediaType.previews=e.previews),e.timeZone&&(n.headers[`time-zone`]=e.timeZone),this.request=br.defaults(n),this.graphql=kr(this.request).defaults(n),this.log=Hr(e.log),this.hook=t,e.authStrategy){let{authStrategy:n,...r}=e,i=n(Object.assign({request:this.request,log:this.log,octokit:this,octokitOptions:r},e.auth));t.wrap(`request`,i.hook),this.auth=i}else if(!e.auth)this.auth=async()=>({type:`unauthenticated`});else{let n=Lr(e.auth);t.wrap(`request`,n.hook),this.auth=n}let r=this.constructor;for(let t=0;t({async next(){if(!s)return{done:!0};try{let e=$r(await i({method:a,url:s,headers:o}));if(s=((e.headers.link||``).match(/<([^<>]+)>;\s*rel="next"/)||[])[1],!s&&`total_commits`in e.data){let t=new URL(e.url),n=t.searchParams,r=parseInt(n.get(`page`)||`1`,10);r*parseInt(n.get(`per_page`)||`250`,10){if(i.done)return t;let a=!1;function o(){a=!0}return t=t.concat(r?r(i.value,o):i.value.data),a?t:ni(e,t,n,r)})}Object.assign(ti,{iterator:ei});function ri(e){return{paginate:Object.assign(ti.bind(null,e),{iterator:ei.bind(null,e)})}}ri.VERSION=Qr,new yn;const ii=On(),ai={baseUrl:ii,request:{agent:Tn(ii),fetch:Dn(ii)}},oi=Wr.plugin(Xr,ri).defaults(ai);function si(e,t){let n=Object.assign({},t||{}),r=wn(e,n);return r&&(n.auth=r),n}const ci=new yn;function li(e,t,...n){return new(oi.plugin(...n))(si(e,t))}var Y=e(ie(),1),ui=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},di=class{constructor(e,t,n){if(e<1)throw Error(`max attempts should be greater than or equal to 1`);if(this.maxAttempts=e,this.minSeconds=Math.floor(t),this.maxSeconds=Math.floor(n),this.minSeconds>this.maxSeconds)throw Error(`min seconds should be less than or equal to max seconds`)}execute(e,t){return ui(this,void 0,void 0,function*(){let n=1;for(;nsetTimeout(t,e*1e3))})}},X=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},fi=class extends Error{constructor(e){super(`Unexpected HTTP response: ${e}`),this.httpStatusCode=e,Object.setPrototypeOf(this,new.target.prototype)}};const pi=process.platform===`win32`;process.platform;function mi(e,t,n,r){return X(this,void 0,void 0,function*(){return t||=W.join(ki(),he.randomUUID()),yield S(W.dirname(t)),j(`Downloading ${e}`),j(`Destination ${t}`),yield new di(3,Ai(`TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS`,10),Ai(`TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS`,20)).execute(()=>X(this,void 0,void 0,function*(){return yield hi(e,t||``,n,r)}),e=>!(e instanceof fi&&e.httpStatusCode&&e.httpStatusCode<500&&e.httpStatusCode!==408&&e.httpStatusCode!==429))})}function hi(e,t,n,r){return X(this,void 0,void 0,function*(){if(U.existsSync(t))throw Error(`Destination file path ${t} already exists`);let i=new u(`actions/tool-cache`,[],{allowRetries:!1});n&&(j(`set auth`),r===void 0&&(r={}),r.authorization=n);let a=yield i.get(e,r);if(a.message.statusCode!==200){let t=new fi(a.message.statusCode);throw j(`Failed to download from "${e}". Code(${a.message.statusCode}) Message(${a.message.statusMessage})`),t}let o=ye.promisify(Oe.pipeline),c=Ai(`TEST_DOWNLOAD_TOOL_RESPONSE_MESSAGE_FACTORY`,()=>a.message)(),l=!1;try{return yield o(c,U.createWriteStream(t)),j(`download complete`),l=!0,t}finally{if(!l){j(`download failed`);try{yield s(t)}catch(e){j(`Failed to delete '${t}'. ${e.message}`)}}}})}function gi(e,t){return X(this,arguments,void 0,function*(e,t,n=`xz`){if(!e)throw Error(`parameter 'file' is required`);t=yield Ci(t),j(`Checking tar --version`);let r=``;yield x(`tar --version`,[],{ignoreReturnCode:!0,silent:!0,listeners:{stdout:e=>r+=e.toString(),stderr:e=>r+=e.toString()}}),j(r.trim());let i=r.toUpperCase().includes(`GNU TAR`),a;a=n instanceof Array?n:[n],l()&&!n.includes(`v`)&&a.push(`-v`);let o=t,s=e;return pi&&i&&(a.push(`--force-local`),o=t.replace(/\\/g,`/`),s=e.replace(/\\/g,`/`)),i&&(a.push(`--warning=no-unknown-keyword`),a.push(`--overwrite`)),a.push(`-C`,o,`-f`,s),yield x(`tar`,a),t})}function _i(e,t){return X(this,void 0,void 0,function*(){if(!e)throw Error(`parameter 'file' is required`);return t=yield Ci(t),pi?yield vi(e,t):yield yi(e,t),t})}function vi(e,t){return X(this,void 0,void 0,function*(){let n=e.replace(/'/g,`''`).replace(/"|\n|\r/g,``),r=t.replace(/'/g,`''`).replace(/"|\n|\r/g,``),i=yield d(`pwsh`,!1);if(i){let e=[`-NoLogo`,`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Unrestricted`,`-Command`,[`$ErrorActionPreference = 'Stop' ;`,`try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ;`,`try { [System.IO.Compression.ZipFile]::ExtractToDirectory('${n}', '${r}', $true) }`,`catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath '${n}' -DestinationPath '${r}' -Force } else { throw $_ } } ;`].join(` `)];j(`Using pwsh at path: ${i}`),yield x(`"${i}"`,e)}else{let e=[`-NoLogo`,`-Sta`,`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Unrestricted`,`-Command`,[`$ErrorActionPreference = 'Stop' ;`,`try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ;`,`if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath '${n}' -DestinationPath '${r}' -Force }`,`else {[System.IO.Compression.ZipFile]::ExtractToDirectory('${n}', '${r}', $true) }`].join(` `)],t=yield d(`powershell`,!0);j(`Using powershell at path: ${t}`),yield x(`"${t}"`,e)}})}function yi(e,t){return X(this,void 0,void 0,function*(){let n=yield d(`unzip`,!0),r=[e];l()||r.unshift(`-q`),r.unshift(`-o`),yield x(`"${n}"`,r,{cwd:t})})}function bi(e,t,n,r){return X(this,void 0,void 0,function*(){if(n=Y.clean(n)||n,r||=pe.arch(),j(`Caching tool ${t} ${n} ${r}`),j(`source dir: ${e}`),!U.statSync(e).isDirectory())throw Error(`sourceDir is not a directory`);let i=yield wi(t,n,r);for(let t of U.readdirSync(e))yield b(W.join(e,t),i,{recursive:!0});return Ti(t,n,r),i})}function xi(e,t,n){if(!e)throw Error(`toolName parameter is required`);if(!t)throw Error(`versionSpec parameter is required`);n||=pe.arch(),Ei(t)||(t=Di(Si(e,n),t));let r=``;if(t){t=Y.clean(t)||``;let i=W.join(Oi(),e,t,n);j(`checking cache: ${i}`),U.existsSync(i)&&U.existsSync(`${i}.complete`)?(j(`Found tool in cache ${e} ${t} ${n}`),r=i):j(`not found`)}return r}function Si(e,t){let n=[];t||=pe.arch();let r=W.join(Oi(),e);if(U.existsSync(r)){let e=U.readdirSync(r);for(let i of e)if(Ei(i)){let e=W.join(r,i,t||``);U.existsSync(e)&&U.existsSync(`${e}.complete`)&&n.push(i)}}return n}function Ci(e){return X(this,void 0,void 0,function*(){return e||=W.join(ki(),he.randomUUID()),yield S(e),e})}function wi(e,t,n){return X(this,void 0,void 0,function*(){let r=W.join(Oi(),e,Y.clean(t)||t,n||``);j(`destination ${r}`);let i=`${r}.complete`;return yield s(r),yield s(i),yield S(r),r})}function Ti(e,t,n){let r=`${W.join(Oi(),e,Y.clean(t)||t,n||``)}.complete`;U.writeFileSync(r,``),j(`finished caching tool`)}function Ei(e){let t=Y.clean(e)||``;j(`isExplicit: ${t}`);let n=Y.valid(t)!=null;return j(`explicit? ${n}`),n}function Di(e,t){let n=``;j(`evaluating ${e.length} versions`),e=e.sort((e,t)=>Y.gt(e,t)?1:-1);for(let r=e.length-1;r>=0;r--){let i=e[r];if(Y.satisfies(i,t)){n=i;break}}return j(n?`matched: ${n}`:`match not found`),n}function Oi(){let e=process.env.RUNNER_TOOL_CACHE||``;return ve(e,`Expected RUNNER_TOOL_CACHE to be defined`),e}function ki(){let e=process.env.RUNNER_TEMP||``;return ve(e,`Expected RUNNER_TEMP to be defined`),e}function Ai(e,t){let n=global[e];return n===void 0?t:n}function ji(e){let t;try{t=JSON.parse(e)}catch(e){throw e instanceof SyntaxError?Error(`Invalid auth-json format: ${e.message}`):e}if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`auth-json must be a JSON object`);return t}async function Mi(e,t,n){let r=B.join(t,`auth.json`);await G.mkdir(t,{recursive:!0});let i=JSON.stringify(e,null,2);return await G.writeFile(r,i,{mode:384}),n.info(`Populated auth.json`,{path:r,providers:Object.keys(e).length}),r}function Ni(){let e=H.platform,t=H.arch;return{os:{darwin:`darwin`,linux:`linux`,win32:`windows`}[e]??`linux`,arch:{arm64:`aarch64`,x64:`x64`}[t]??`x64`,ext:`.zip`}}function Pi(e,t){return`https://github.com/oven-sh/bun/releases/download/bun-${e.startsWith(`v`)?e:`v${e}`}/${`bun-${t.os}-${t.arch}${t.ext}`}`}async function Fi(e,t,n,r,i=ne){let a=Ni(),o=t.find(`bun`,i,a.arch);if(o.length>0)return e.info(`Bun found in cache`,{version:i,path:o}),r(o),await Li(o),{path:o,version:i,cached:!0};e.info(`Downloading Bun`,{version:i});let s=Pi(i,a);try{let o=await t.downloadTool(s);if(H.platform!==`win32`&&!await Ri(o,e,n))throw Error(`Downloaded Bun archive appears corrupted`);e.info(`Extracting Bun`);let c=await Ii(await t.extractZip(o),t),l=fe.dirname(c);e.info(`Caching Bun`);let u=await t.cacheDir(l,`bun`,i,a.arch);return r(u),await Li(u),e.info(`Bun installed`,{version:i,path:u}),{path:u,version:i,cached:!1}}catch(e){let t=M(e);throw Error(`Failed to install Bun ${i}: ${t}`)}}async function Ii(e,t){for(let n of await Ce.readdir(e,{withFileTypes:!0})){let{name:r}=n,i=fe.join(e,r);if(n.isFile()){if(r===`bun`||r===`bun.exe`)return i;if(/^bun.*\.zip/.test(r))return Ii(await t.extractZip(i),t)}if(r.startsWith(`bun`)&&n.isDirectory())return Ii(i,t)}throw Error(`Could not find executable: bun`)}async function Li(e){let t=e=>H.platform===`win32`?`${e}.exe`:e,n=fe.join(e,t(`bun`));try{await Ce.symlink(n,fe.join(e,t(`bunx`)))}catch(e){let t=typeof e==`object`?e.code:void 0;if(t!==`EEXIST`&&t!==`EPERM`&&t!==`EACCES`)throw e}}async function Ri(e,t,n){try{let{stdout:r}=await n.getExecOutput(`file`,[e],{silent:!0}),i=r.includes(`Zip archive`)||r.includes(`ZIP`);return i||t.warning(`Bun download validation failed`,{output:r.trim()}),i}catch{return t.debug(`Could not validate Bun download (file command unavailable)`),!0}}function zi(e){return{debug:t=>e.debug(t),info:t=>e.info(t),warn:t=>e.warning(t),error:t=>e.error(t)}}function Bi(e){let{token:t,logger:n}=e;return n.debug(`Creating GitHub client with token`),li(t,{log:zi(n)})}async function Vi(e,t){try{let{data:n}=await e.rest.users.getAuthenticated();return t.debug(`Authenticated as`,{login:n.login,type:n.type}),n.login}catch{return t.debug(`Failed to get authenticated user, may be app token`),`fro-bot[bot]`}}async function Hi(e,t,n,r){let i=t??n,a=t==null?n.length>0?`github-token`:`none`:`app-token`;if(i.length===0)return r.warning(`No GitHub token available`),{authenticated:!1,method:`none`,botLogin:null};H.env.GH_TOKEN=i,r.info(`Configured authentication`,{method:a});let o=null;return e!=null&&(o=await Vi(e,r)),{authenticated:!0,method:a,botLogin:o}}async function Ui(e,t){let n=await t.getExecOutput(`git`,[`config`,e],{ignoreReturnCode:!0,silent:!0});return n.exitCode===0&&n.stdout.trim().length>0?n.stdout.trim():null}async function Wi(e,t,n,r){let i=await Ui(`user.name`,r),a=await Ui(`user.email`,r);if(i!=null&&a!=null){n.info(`Git identity already configured`,{name:i,email:a});return}if(t==null)throw Error(`Cannot configure Git identity: no authenticated GitHub user`);let o=null;if(a==null){let r=await Xe(e,t,n);if(r==null)throw Error(`Cannot configure Git identity: failed to look up user ID for '${t}'`);o=String(r.id)}i??await r.exec(`git`,[`config`,`--global`,`user.name`,t],void 0);let s=`${o}+${t}@users.noreply.github.com`;a??await r.exec(`git`,[`config`,`--global`,`user.email`,s],void 0),n.info(`Configured git identity`,{name:i??t,email:a??s})}async function Gi(e,t,n={}){let{logger:r,execAdapter:i}=t,{claude:a=`no`,copilot:o=`no`,gemini:s=`no`,openai:c=`no`,opencodeZen:l=`no`,zaiCodingPlan:u=`no`}=n;r.info(`Installing Oh My OpenCode plugin`,{version:e,claude:a,copilot:o,gemini:s,openai:c,opencodeZen:l,zaiCodingPlan:u});let d=``,f=[`oh-my-opencode@${e}`,`install`,`--no-tui`,`--skip-auth`,`--claude=${a}`,`--copilot=${o}`,`--gemini=${s}`,`--openai=${c}`,`--opencode-zen=${l}`,`--zai-coding-plan=${u}`];try{let t=await i.exec(`bunx`,f,{listeners:{stdout:e=>{d+=e.toString()},stderr:e=>{d+=e.toString()}},ignoreReturnCode:!0});if(t!==0){let e=`bunx oh-my-opencode install returned exit code ${t}`;return r.error(e,{output:d.slice(0,1e3)}),{installed:!1,version:null,error:`${e}\n${d.slice(0,500)}`}}let n=/oh-my-opencode@(\d+\.\d+\.\d+)/i.exec(d),a=n!=null&&n[1]!=null?n[1]:e;return r.info(`oMo plugin installed`,{version:a}),{installed:!0,version:a,error:null}}catch(e){let t=M(e),n=d.length>0?`${t}\nOutput: ${d.slice(0,500)}`:t;return r.error(`Failed to run oMo installer`,{error:t,output:d.slice(0,500)}),{installed:!1,version:null,error:`bunx oh-my-opencode install failed: ${n}`}}}const Ki=`opencode`,qi=`1.2.9`;function Ji(){let e=Ee.platform(),t=Ee.arch(),n={darwin:`darwin`,linux:`linux`,win32:`windows`},r={x64:`x64`,arm64:`arm64`},i=e===`win32`||e===`darwin`?`.zip`:`.tar.gz`;return{os:n[e]??`linux`,arch:r[t]??`x64`,ext:i}}function Yi(e,t){return`https://github.com/anomalyco/opencode/releases/download/${e.startsWith(`v`)?e:`v${e}`}/${`opencode-${t.os}-${t.arch}${t.ext}`}`}async function Xi(e,t,n,r){if(H.platform===`win32`)return!0;try{let{stdout:i}=await r.getExecOutput(`file`,[e],{silent:!0}),a=(t===`.zip`?[`Zip archive`,`ZIP`]:[`gzip`,`tar`,`compressed`]).some(e=>i.includes(e));return a||n.warning(`Download validation failed`,{output:i.trim()}),a}catch{return n.debug(`Could not validate download (file command unavailable)`),!0}}async function Zi(e,t,n,r,i=qi){let a=Ji(),o=n.find(Ki,e,a.arch);if(o.length>0)return t.info(`OpenCode found in cache`,{version:e,path:o}),{path:o,version:e,cached:!0};try{return await Qi(e,a,t,n,r)}catch(n){t.warning(`Primary version install failed, trying fallback`,{requestedVersion:e,fallbackVersion:i,error:M(n)})}if(e!==i)try{let e=await Qi(i,a,t,n,r);return t.info(`Installed fallback version`,{version:i}),e}catch(t){throw Error(`Failed to install OpenCode (tried ${e} and ${i}): ${M(t)}`)}throw Error(`Failed to install OpenCode version ${e}`)}async function Qi(e,t,n,r,i){n.info(`Downloading OpenCode`,{version:e});let a=Yi(e,t),o=await r.downloadTool(a);if(!await Xi(o,t.ext,n,i))throw Error(`Downloaded archive appears corrupted`);n.info(`Extracting OpenCode`);let s=t.ext===`.zip`?await r.extractZip(o):await r.extractTar(o);n.info(`Caching OpenCode`);let c=await r.cacheDir(s,Ki,e,t.arch);return n.info(`OpenCode installed`,{version:e,path:c}),{path:c,version:e,cached:!1}}async function $i(e){let t=await fetch(`https://api.github.com/repos/anomalyco/opencode/releases/latest`);if(!t.ok)throw Error(`Failed to fetch latest OpenCode version: ${t.statusText}`);let n=(await t.json()).tag_name.replace(/^v/,``);return e.info(`Latest OpenCode version`,{version:n}),n}const ea={restoreCache:async(e,t,n)=>I(e,t,n),saveCache:async(e,t)=>D(e,t)};function ta(e){let{os:t,opencodeVersion:n,omoVersion:r}=e;return`${ce}-${t}-oc-${n}-omo-${r}`}function na(e){let{os:t,opencodeVersion:n,omoVersion:r}=e;return[`${ce}-${t}-oc-${n}-omo-${r}-`]}async function ra(e){let{logger:t,os:n,opencodeVersion:r,omoVersion:i,toolCachePath:a,bunCachePath:o,omoConfigPath:s,cacheAdapter:c=ea}=e,l=ta({os:n,opencodeVersion:r,omoVersion:i}),u=na({os:n,opencodeVersion:r,omoVersion:i}),d=[a,o,s];t.info(`Restoring tools cache`,{primaryKey:l,restoreKeys:[...u],paths:d});try{let e=await c.restoreCache(d,l,[...u]);return e==null?(t.info(`Tools cache miss - will install tools`),{hit:!1,restoredKey:null}):(t.info(`Tools cache restored`,{restoredKey:e}),{hit:!0,restoredKey:e})}catch(e){return t.warning(`Tools cache restore failed`,{error:M(e)}),{hit:!1,restoredKey:null}}}async function ia(e){let{logger:t,os:n,opencodeVersion:r,omoVersion:i,toolCachePath:a,bunCachePath:o,omoConfigPath:s,cacheAdapter:c=ea}=e,l=ta({os:n,opencodeVersion:r,omoVersion:i}),u=[a,o,s];t.info(`Saving tools cache`,{saveKey:l,paths:u});try{return await c.saveCache(u,l),t.info(`Tools cache saved`,{saveKey:l}),!0}catch(e){return e instanceof Error&&e.message.includes(`already exists`)?(t.info(`Tools cache key already exists, skipping save`),!0):(t.warning(`Tools cache save failed`,{error:M(e)}),!1)}}const aa=[`claude`,`claude-max20`,`copilot`,`gemini`,`openai`,`opencode-zen`,`zai-coding-plan`];function oa(e){let t=e.split(`,`).map(e=>e.trim().toLowerCase()).filter(e=>e.length>0),n=`no`,r=`no`,i=`no`,a=`no`,o=`no`,s=`no`;for(let e of t)if(aa.includes(e))switch(e){case`claude`:n=`yes`;break;case`claude-max20`:n=`max20`;break;case`copilot`:r=`yes`;break;case`gemini`:i=`yes`;break;case`openai`:a=`yes`;break;case`opencode-zen`:o=`yes`;break;case`zai-coding-plan`:s=`yes`;break}return{claude:n,copilot:r,gemini:i,openai:a,opencodeZen:o,zaiCodingPlan:s}}function sa(){return{find:xi,downloadTool:mi,extractTar:gi,extractZip:_i,cacheDir:bi}}function ca(){return{exec:x,getExecOutput:c}}function la(){return{opencodeVersion:m(`opencode-version`)||`latest`,authJson:m(`auth-json`,{required:!0}),appId:m(`app-id`)||null,privateKey:m(`private-key`)||null,opencodeConfig:m(`opencode-config`)||null}}async function ua(){let e=Date.now(),n=A({component:`setup`}),r=sa(),o=ca();try{let s=la(),c=m(`github-token`,{required:!0});n.info(`Starting setup`,{version:s.opencodeVersion});let l;try{l=ji(s.authJson)}catch(e){return _(`Invalid auth-json: ${M(e)}`),null}let u=s.opencodeVersion;if(u===`latest`)try{u=await $i(n)}catch(e){n.warning(`Failed to get latest version, using fallback`,{error:M(e)}),u=qi}let d=m(`omo-version`).trim(),f=d.length>0?d:N,h=H.env.RUNNER_TOOL_CACHE??`/opt/hostedtoolcache`,g=V(h,`opencode`),v=V(h,`bun`),y=V(De(),`.config`,`opencode`),b=a(),x=await ra({logger:n,os:b,opencodeVersion:u,omoVersion:f,toolCachePath:g,bunCachePath:v,omoConfigPath:y}),S=x.hit?`hit`:`miss`,C,w=!1,T=null;if(x.hit){let e=r.find(`opencode`,u);e.length>0?(C={path:e,version:u,cached:!0},n.info(`Tools cache hit, using cached OpenCode CLI`,{version:u,omoVersion:f})):n.warning(`Tools cache hit but binary not found in tool-cache, falling through to install`,{requestedVersion:u,restoredKey:x.restoredKey})}if(C==null)try{C=await Zi(u,n,r,o)}catch(e){return _(`Failed to install OpenCode: ${M(e)}`),null}let E=!1;try{await Fi(n,r,o,t,ne),E=!0}catch(e){n.warning(`Bun installation failed, oMo will be unavailable`,{error:M(e)})}if(E){let e=m(`omo-providers`).trim(),t=oa(e.length>0?e:se),r=await Gi(f,{logger:n,execAdapter:o},t);r.installed?(n.info(`oMo installed`,{version:r.version}),w=!0):n.warning(`oMo installation failed, continuing without oMo`,{error:r.error??`unknown error`}),T=r.error}let te={autoupdate:!1};if(s.opencodeConfig!=null){let e=JSON.parse(s.opencodeConfig);if(typeof e!=`object`||!e||Array.isArray(e))return _(`opencode-config must be a JSON object`),null;Object.assign(te,e)}p(`OPENCODE_CONFIG_CONTENT`,JSON.stringify(te)),x.hit||await ia({logger:n,os:b,opencodeVersion:u,omoVersion:f,toolCachePath:g,bunCachePath:v,omoConfigPath:y}),t(C.path),z(`opencode-path`,C.path),z(`opencode-version`,C.version),n.info(`OpenCode ready`,{version:C.version,cached:C.cached});let D=li(c),re=await Hi(D,null,c,n);p(`GH_TOKEN`,c),n.info(`GitHub CLI configured`),await Wi(D,re.botLogin,n,o);let O=V(i(),`opencode`),k=await Mi(l,O,n);z(`auth-json-path`,k),n.info(`auth.json populated`,{path:k});let A=H.env.GITHUB_REPOSITORY??`unknown/unknown`,j=H.env.GITHUB_REF_NAME??`main`,ie=a(),ae=ee({agentIdentity:`github`,repo:A,ref:j,os:ie}),P=oe({agentIdentity:`github`,repo:A,ref:j,os:ie}),F=`miss`;try{let e=await I([O],ae,[...P]);e==null?n.info(`No cache found`):(F=`hit`,n.info(`Cache restored`,{key:e}))}catch(e){F=`corrupted`,n.warning(`Cache restore failed`,{error:M(e)})}z(`cache-status`,F),z(`storage-path`,O);let L=Date.now()-e,R={opencodePath:C.path,opencodeVersion:C.version,ghAuthenticated:re.authenticated,omoInstalled:w,omoError:T,cacheStatus:F,toolsCacheStatus:S,duration:L};return n.info(`Setup complete`,{duration:L}),R}catch(e){let t=M(e);return n.error(`Setup failed`,{error:t}),_(t),null}}function da(e){return{success:!0,data:e}}function fa(e){return{success:!1,error:e}}const pa=[`OWNER`,`MEMBER`,`COLLABORATOR`];function ma(e,t){switch(e.eventType){case`issue_comment`:return{directive:`Respond to the comment above. Post your response as a single comment on this thread.`,appendMode:!0};case`discussion_comment`:return{directive:`Respond to the discussion comment above. Post your response as a single comment.`,appendMode:!0};case`issues`:return e.action===`opened`?{directive:`Triage this issue: summarize, reproduce if possible, propose next steps. Post your response as a single comment.`,appendMode:!0}:{directive:`Respond to the mention in this issue. Post your response as a single comment.`,appendMode:!0};case`pull_request`:return{directive:[`Review this pull request for code quality, potential bugs, and improvements.`,"If you are a requested reviewer, submit a review via `gh pr review` with your full response (including Run Summary) in the --body.",`Include the Run Summary in the review body. Do not post a separate comment.`,`If the author is a collaborator, prioritize actionable feedback over style nits.`].join(` `),appendMode:!0};case`pull_request_review_comment`:return{directive:ha(e),appendMode:!0};case`schedule`:case`workflow_dispatch`:return{directive:t??``,appendMode:!1};default:return{directive:`Execute the requested operation.`,appendMode:!0}}}function ha(e){let t=e.target,n=[`Respond to the review comment.`,``];return t?.path!=null&&n.push(`**File:** \`${t.path}\``),t?.line!=null&&n.push(`**Line:** ${t.line}`),t?.commitId!=null&&n.push(`**Commit:** \`${t.commitId}\``),t?.diffHunk!=null&&t.diffHunk.length>0&&n.push(``,`**Diff Context:**`,"```diff",t.diffHunk,"```"),n.join(` `)}function ga(e,t){let{directive:n,appendMode:r}=ma(e,t),i=[`## Task`,``];return r?(i.push(n),t!=null&&t.trim().length>0&&i.push(``,`**Additional Instructions:**`,t.trim())):i.push(n),i.push(``),i.join(` `)}function _a(e,t){let{context:n,customPrompt:r,cacheStatus:i,sessionContext:a}=e,o=[];if(o.push(`# Agent Context diff --git a/src/lib/setup/omo.test.ts b/src/lib/setup/omo.test.ts index 9689492d..32168569 100644 --- a/src/lib/setup/omo.test.ts +++ b/src/lib/setup/omo.test.ts @@ -62,6 +62,7 @@ describe('omo', () => { 'oh-my-opencode@1.2.3', 'install', '--no-tui', + '--skip-auth', '--claude=no', '--copilot=no', '--gemini=no', @@ -183,6 +184,7 @@ describe('omo', () => { 'oh-my-opencode@3.5.5', 'install', '--no-tui', + '--skip-auth', '--claude=no', '--copilot=no', '--gemini=no', @@ -218,6 +220,7 @@ describe('omo', () => { 'oh-my-opencode@3.5.5', 'install', '--no-tui', + '--skip-auth', '--claude=yes', '--copilot=yes', '--gemini=yes', @@ -229,6 +232,24 @@ describe('omo', () => { ) }) + it('includes --skip-auth flag for CI reliability', async () => { + // #given - a standard install invocation + const execMock = vi.fn().mockResolvedValue(0) + const mockDeps = createMockDeps({ + execAdapter: createMockExecAdapter({exec: execMock}), + }) + + // #when + await installOmo('3.5.5', mockDeps) + + // #then - --skip-auth must appear after --no-tui in the args + const calledArgs: string[] = (execMock.mock.calls[0] as [string, string[], unknown])[1] + const noTuiIndex = calledArgs.indexOf('--no-tui') + const skipAuthIndex = calledArgs.indexOf('--skip-auth') + expect(skipAuthIndex).toBeGreaterThan(-1) + expect(skipAuthIndex).toBe(noTuiIndex + 1) + }) + it('captures both stdout and stderr', async () => { // #given const mockLogger = createMockLogger() diff --git a/src/lib/setup/omo.ts b/src/lib/setup/omo.ts index 14795d85..fff7d04c 100644 --- a/src/lib/setup/omo.ts +++ b/src/lib/setup/omo.ts @@ -60,6 +60,7 @@ export async function installOmo( `oh-my-opencode@${version}`, 'install', '--no-tui', + '--skip-auth', `--claude=${claude}`, `--copilot=${copilot}`, `--gemini=${gemini}`,