easycode-ai 1.1.84 → 1.1.85
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/bundle/build-info.json +5 -5
- package/bundle/easycode-tui.js +73 -73
- package/bundle/easycode.js +5 -5
- package/bundle/package.json +1 -1
- package/package.json +1 -1
package/bundle/easycode.js
CHANGED
|
@@ -229,7 +229,7 @@ ${h}`)}return t}),E1e=Rwn(cBt);M1e=class extends U1e{create(e,r){var a;let{api_v
|
|
|
229
229
|
`):[]}};pU.NEWLINE_CHARS=new Set([`
|
|
230
230
|
`,"\r"]);pU.NEWLINE_REGEXP=/\r\n|[\n\r]/g;_1e={off:0,error:200,warn:300,info:400,debug:500},tBt=(n,e,r)=>{if(n){if(cwn(_1e,n))return n;Gg(r).warn(`${e} was set to ${JSON.stringify(n)}, expected one of ${JSON.stringify(Object.keys(_1e))}`)}};Cwn={error:Sne,warn:Sne,info:Sne,debug:Sne},rBt=new WeakMap;$9=n=>(n.options&&(n.options=Object.assign({},n.options),delete n.options.headers),n.headers&&(n.headers=Object.fromEntries((n.headers instanceof Headers?[...n.headers]:Object.entries(n.headers)).map(([e,r])=>[e,e.toLowerCase()==="x-goog-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in n&&(n.retryOfRequestLogID&&(n.retryOf=n.retryOfRequestLogID),delete n.retryOfRequestLogID),n);yUe=class n{constructor(e,r,a){this.iterator=e,this.controller=r,this.client=a}static fromSSEResponse(e,r,a){let i=!1,s=a?Gg(a):console;function t(){return IU(this,arguments,function*(){var d,I,u,h;if(i)throw new j2("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var m=!0,v=eS(Ywn(e,r)),f;f=yield Du(v.next()),d=f.done,!d;m=!0){h=f.value,m=!1;let Z=h;if(!c)if(Z.data.startsWith("[DONE]")){c=!0;continue}else try{yield yield Du(JSON.parse(Z.data))}catch(y){throw s.error("Could not parse message into JSON:",Z.data),s.error("From chunk:",Z.raw),y}}}catch(Z){I={error:Z}}finally{try{!m&&!d&&(u=v.return)&&(yield Du(u.call(v)))}finally{if(I)throw I.error}}c=!0}catch(Z){if(bUe(Z))return yield Du(void 0);throw Z}finally{c||r.abort()}})}return new n(t,r,a)}static fromReadableStream(e,r,a){let i=!1;function s(){return IU(this,arguments,function*(){var d,I,u,h;let c=new pU,m=sBt(e);try{for(var v=!0,f=eS(m),Z;Z=yield Du(f.next()),d=Z.done,!d;v=!0){h=Z.value,v=!1;let y=h;for(let A of c.decode(y))yield yield Du(A)}}catch(y){I={error:y}}finally{try{!v&&!d&&(u=f.return)&&(yield Du(u.call(f)))}finally{if(I)throw I.error}}for(let y of c.flush())yield yield Du(y)})}function t(){return IU(this,arguments,function*(){var d,I,u,h;if(i)throw new j2("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var m=!0,v=eS(s()),f;f=yield Du(v.next()),d=f.done,!d;m=!0){h=f.value,m=!1;let Z=h;c||Z&&(yield yield Du(JSON.parse(Z)))}}catch(Z){I={error:Z}}finally{try{!m&&!d&&(u=v.return)&&(yield Du(u.call(v)))}finally{if(I)throw I.error}}c=!0}catch(Z){if(bUe(Z))return yield Du(void 0);throw Z}finally{c||r.abort()}})}return new n(t,r,a)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],a=this.iterator(),i=s=>({next:()=>{if(s.length===0){let t=a.next();e.push(t),r.push(t)}return s.shift()}});return[new n(()=>i(e),this.controller,this.client),new n(()=>i(r),this.controller,this.client)]}toReadableStream(){let e=this,r;return iBt({async start(){r=e[Symbol.asyncIterator]()},async pull(a){try{let{value:i,done:s}=await r.next();if(s)return a.close();let t=FUe(JSON.stringify(i)+`
|
|
231
231
|
`);a.enqueue(t)}catch(i){a.error(i)}},async cancel(){var a;await((a=r.return)===null||a===void 0?void 0:a.call(r))}})}};ZUe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let s={event:this.event,data:this.data.join(`
|
|
232
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],s}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,a,i]=kwn(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};NUe=class n extends Promise{constructor(e,r,a=Qwn){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=a,this.client=e}_thenUnwrap(e){return new n(this.client,this.responsePromise,async(r,a)=>e(await this.parseResponse(r,a),a))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(this.client,e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};uBt=Symbol("brand.privateNullableHeaders");Xne=n=>{let e=new Headers,r=new Set;for(let a of n){let i=new Set;for(let[s,t]of Hwn(a)){let o=s.toLowerCase();i.has(o)||(e.delete(s),i.add(o)),t===null?(e.delete(s),r.add(o)):(e.append(s,t),r.delete(o))}}return{[uBt]:!0,values:e,nulls:r}};fUe=n=>{var e,r,a,i,s,t;if(typeof globalThis.process<"u")return(a=(r=(e=globalThis.process.env)===null||e===void 0?void 0:e[n])===null||r===void 0?void 0:r.trim())!==null&&a!==void 0?a:void 0;if(typeof globalThis.Deno<"u")return(t=(s=(i=globalThis.Deno.env)===null||i===void 0?void 0:i.get)===null||s===void 0?void 0:s.call(i,n))===null||t===void 0?void 0:t.trim()};P1e=class n{constructor(e){var r,a,i,s,t,o,d,{baseURL:I=fUe("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:u=(r=fUe("GEMINI_API_KEY"))!==null&&r!==void 0?r:null,apiVersion:h="v1beta"}=e,c=k1e(e,["baseURL","apiKey","apiVersion"]);let m=Object.assign(Object.assign({apiKey:u,apiVersion:h},c),{baseURL:I||"https://generativelanguage.googleapis.com"});this.baseURL=m.baseURL,this.timeout=(a=m.timeout)!==null&&a!==void 0?a:n.DEFAULT_TIMEOUT,this.logger=(i=m.logger)!==null&&i!==void 0?i:console;let v="warn";this.logLevel=v,this.logLevel=(t=(s=tBt(m.logLevel,"ClientOptions.logLevel",this))!==null&&s!==void 0?s:tBt(fUe("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&t!==void 0?t:v,this.fetchOptions=m.fetchOptions,this.maxRetries=(o=m.maxRetries)!==null&&o!==void 0?o:2,this.fetch=(d=m.fetch)!==null&&d!==void 0?d:bwn(),this.encoder=vwn,this._options=m,this.apiKey=u,this.apiVersion=h,this.clientAdapter=m.clientAdapter}withOptions(e){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),e))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){if(!(e.has("authorization")||e.has("x-goog-api-key"))&&!(this.apiKey&&e.get("x-goog-api-key"))&&!r.has("x-goog-api-key"))throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(e){let r=Xne([e.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return Xne([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return Xne([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(e){return Object.entries(e).filter(([r,a])=>typeof a<"u").map(([r,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(r)}=`;throw new j2(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${dU}`}defaultIdempotencyKey(){return`stainless-node-retry-${nwn()}`}makeStatusError(e,r,a,i){return q2.generate(e,r,a,i)}buildURL(e,r,a){let i=!this.baseURLOverridden()&&a||this.baseURL,s=iwn(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),t=this.defaultQuery();return lwn(t)||(r=Object.assign(Object.assign({},t),r)),typeof r=="object"&&r&&!Array.isArray(r)&&(s.search=this.stringifyQuery(r)),s.toString()}async prepareOptions(e){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!e.path.startsWith(`/${this.apiVersion}/projects/`)){let r=e.path.slice(this.apiVersion.length+1);e.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${r}`}}async prepareRequest(e,{url:r,options:a}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,a){return this.request(Promise.resolve(a).then(i=>Object.assign({method:e,path:r},i)))}request(e,r=null){return new NUe(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,a){var i,s,t;let o=await e,d=(i=o.maxRetries)!==null&&i!==void 0?i:this.maxRetries;r==null&&(r=d),await this.prepareOptions(o);let{req:I,url:u,timeout:h}=await this.buildRequest(o,{retryCount:d-r});await this.prepareRequest(I,{url:u,options:o});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),m=a===void 0?"":`, retryOf: ${a}`,v=Date.now();if(Gg(this).debug(`[${c}] sending request`,$9({retryOfRequestLogID:a,method:o.method,url:u,options:o,headers:I.headers})),!((s=o.signal)===null||s===void 0)&&s.aborted)throw new Lne;let f=new AbortController,Z=await this.fetchWithTimeout(u,I,h,f).catch(gUe),y=Date.now();if(Z instanceof globalThis.Error){let w=`retrying, ${r} attempts remaining`;if(!((t=o.signal)===null||t===void 0)&&t.aborted)throw new Lne;let R=bUe(Z)||/timed? ?out/i.test(String(Z)+("cause"in Z?String(Z.cause):""));if(r)return Gg(this).info(`[${c}] connection ${R?"timed out":"failed"} - ${w}`),Gg(this).debug(`[${c}] connection ${R?"timed out":"failed"} (${w})`,$9({retryOfRequestLogID:a,url:u,durationMs:y-v,message:Z.message})),this.retryRequest(o,r,a??c);throw Gg(this).info(`[${c}] connection ${R?"timed out":"failed"} - error; no more retries left`),Gg(this).debug(`[${c}] connection ${R?"timed out":"failed"} (error; no more retries left)`,$9({retryOfRequestLogID:a,url:u,durationMs:y-v,message:Z.message})),R?new H1e:new mU({cause:Z})}let A=`[${c}${m}] ${I.method} ${u} ${Z.ok?"succeeded":"failed"} with status ${Z.status} in ${y-v}ms`;if(!Z.ok){let w=await this.shouldRetry(Z);if(r&&w){let p=`retrying, ${r} attempts remaining`;return await Gwn(Z.body),Gg(this).info(`${A} - ${p}`),Gg(this).debug(`[${c}] response error (${p})`,$9({retryOfRequestLogID:a,url:Z.url,status:Z.status,headers:Z.headers,durationMs:y-v})),this.retryRequest(o,r,a??c,Z.headers)}let R=w?"error; no more retries left":"error; not retryable";Gg(this).info(`${A} - ${R}`);let b=await Z.text().catch(p=>gUe(p).message),N=dwn(b),F=N?void 0:b;throw Gg(this).debug(`[${c}] response error (${R})`,$9({retryOfRequestLogID:a,url:Z.url,status:Z.status,headers:Z.headers,message:F,durationMs:Date.now()-v})),this.makeStatusError(Z.status,N,F,Z.headers)}return Gg(this).info(A),Gg(this).debug(`[${c}] response start`,$9({retryOfRequestLogID:a,url:Z.url,status:Z.status,headers:Z.headers,durationMs:y-v})),{response:Z,options:o,controller:f,requestLogID:c,retryOfRequestLogID:a,startTime:v}}async fetchWithTimeout(e,r,a,i){let s=r||{},{signal:t,method:o}=s,d=k1e(s,["signal","method"]);t&&t.addEventListener("abort",()=>i.abort());let I=setTimeout(()=>i.abort(),a),u=globalThis.ReadableStream&&d.body instanceof globalThis.ReadableStream||typeof d.body=="object"&&d.body!==null&&Symbol.asyncIterator in d.body,h=Object.assign(Object.assign(Object.assign({signal:i.signal},u?{duplex:"half"}:{}),{method:"GET"}),d);o&&(h.method=o.toUpperCase());try{return await this.fetch.call(void 0,e,h)}finally{clearTimeout(I)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,a,i){var s;let t,o=i?.get("retry-after-ms");if(o){let I=parseFloat(o);Number.isNaN(I)||(t=I)}let d=i?.get("retry-after");if(d&&!t){let I=parseFloat(d);Number.isNaN(I)?t=Date.parse(d)-Date.now():t=I*1e3}if(!(t&&0<=t&&t<60*1e3)){let I=(s=e.maxRetries)!==null&&s!==void 0?s:this.maxRetries;t=this.calculateDefaultRetryTimeoutMillis(r,I)}return await Iwn(t),this.makeRequest(e,r-1,a)}calculateDefaultRetryTimeoutMillis(e,r){let s=r-e,t=Math.min(.5*Math.pow(2,s),8),o=1-Math.random()*.25;return t*o*1e3}async buildRequest(e,{retryCount:r=0}={}){var a,i,s;let t=Object.assign({},e),{method:o,path:d,query:I,defaultBaseURL:u}=t,h=this.buildURL(d,I,u);"timeout"in t&&uwn("timeout",t.timeout),t.timeout=(a=t.timeout)!==null&&a!==void 0?a:this.timeout;let{bodyHeaders:c,body:m}=this.buildBody({options:t}),v=await this.buildHeaders({options:e,method:o,bodyHeaders:c,retryCount:r});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:o,headers:v},t.signal&&{signal:t.signal}),globalThis.ReadableStream&&m instanceof globalThis.ReadableStream&&{duplex:"half"}),m&&{body:m}),(i=this.fetchOptions)!==null&&i!==void 0?i:{}),(s=t.fetchOptions)!==null&&s!==void 0?s:{}),url:h,timeout:t.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:a,retryCount:i}){let s={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=e.idempotencyKey);let t=await this.authHeaders(e),o=Xne([s,Object.assign(Object.assign({Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i)},e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{}),fwn()),this._options.defaultHeaders,a,e.headers,t]);return this.validateHeaders(o),o.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let a=Xne([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&a.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:gwn(e)}:this.encoder({body:e,headers:a})}};P1e.DEFAULT_TIMEOUT=6e4;Cm=class extends P1e{constructor(){super(...arguments),this.interactions=new z1e(this)}};dBt=Cm;Cm.GeminiNextGenAPIClient=dBt;Cm.GeminiNextGenAPIClientError=j2;Cm.APIError=q2;Cm.APIConnectionError=mU;Cm.APIConnectionTimeoutError=H1e;Cm.APIUserAbortError=Lne;Cm.NotFoundError=J1e;Cm.ConflictError=T1e;Cm.RateLimitError=D1e;Cm.BadRequestError=X1e;Cm.AuthenticationError=S1e;Cm.InternalServerError=O1e;Cm.PermissionDeniedError=L1e;Cm.UnprocessableEntityError=B1e;Cm.toFile=Fwn;Cm.Interactions=z1e;Nxi=1024*1024*8;});function Xwn(n,e){return{...n,...e}}function IBt(n){let{prompt_id:e,...r}=n;return r}function tS(n){return Array.isArray(n)?n.map(e=>IBt(e)):n}var j1e=He(()=>{"use strict";Bn();});var hBt={};Ss(hBt,{DEFAULT_PROXY_CONFIG:()=>Jwn,getActiveProxyServerUrl:()=>NR,getAvailableProxyServers:()=>Swn,getProxyServerInfo:()=>Lwn,getProxyServers:()=>Jne,hasAvailableProxyServer:()=>wUe});function Jne(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function NR(){let e=Jne().find(r=>r.status==="active");if(!e)throw new Error("No active proxy server available. Please contact support.");return e.url}function Swn(){return Jne().filter(e=>e.status==="active")}function wUe(){return Jne().some(e=>e.status==="active")}function Lwn(n){return Jne().find(r=>r.url===n)}var Jwn,fU=He(()=>{"use strict";Jwn={serverUrl:NR(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import{randomUUID as Twn}from"crypto";function tv(){return Tne||(Tne=Twn()),Tne}function mBt(n){Tne=n}function pBt(){Tne=void 0}var Tne,fBt,q1e=He(()=>{"use strict";fBt=tv()});function Nd(n){let e=n??"1.1.84"??"unknown",r=process.platform,a=process.arch,i=process.env[bBt];if(i)return`${Bne}/${i}/${e} (${r}; ${a})`;if(e.startsWith("VSCode-")){let s=e.slice(7)||"unknown";return`${Bne}/VSCode/${s} (${r}; ${a})`}if(e.startsWith("Desktop-")){let s=e.slice(8)||"unknown";return`${Bne}/Desktop/${s} (${r}; ${a})`}return`${Bne}/CLI/${e} (${r}; ${a})`}var Bne,bBt,eV=He(()=>{"use strict";Bne="EasyCode",bBt="EASYCODE_UA_CLIENT"});import*as Dc from"fs";import*as mF from"path";import*as rS from"os";function Bwn(n){ho.configure(n)}function Dwn(n){ho.setUserInfo(n)}function Own(n){ho.setCliVersion(n)}async function Uwn(){return await ho.getUserHeaders()}function Mwn(){return ho.getStatus()}var RUe,es,ho,pF=He(()=>{"use strict";fU();q1e();eV();RUe=259200,es=class n{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){return Nd(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),a=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),s=Math.floor(r%3600/60),t=r%60;return a>0?`${a}\u5929${i}\u5C0F\u65F6${s}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${s}\u5206\u949F${t}\u79D2`:s>0?`${s}\u5206\u949F${t}\u79D2`:`${t}\u79D2`}formatAbsoluteTime(e){return new Date(e).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}constructor(){"https://api-code.deepvlab.ai"?.includes("localhost")?(this.userInfoFilePath=mF.join(rS.homedir(),".easycode-user","user-info-dev.json"),this.jwtTokenFilePath=mF.join(rS.homedir(),".easycode-user","jwt-token-dev.json"),this.usageStatsFilePath=mF.join(rS.homedir(),".easycode-user","usage-stats-dev.json")):(this.userInfoFilePath=mF.join(rS.homedir(),".easycode-user","user-info.json"),this.jwtTokenFilePath=mF.join(rS.homedir(),".easycode-user","jwt-token.json"),this.usageStatsFilePath=mF.join(rS.homedir(),".easycode-user","usage-stats.json")),this.cliVersion="1.1.84",this.config={proxyServerUrl:NR()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId===null&&(this.periodicStatusCheckIntervalId=setInterval(()=>{this.runPeriodicTokenCheck()},600*1e3))}async runPeriodicTokenCheck(){if(!this.userInfo&&!this.jwtTokenData)return;(!this.jwtTokenData||this.isTokenExpired())&&this.reloadFromDisk();let e=!!this.jwtTokenData&&!this.isTokenExpired();if(this.userInfo&&!e){if(this.jwtTokenData?.refreshToken)try{await this.refreshAccessToken(),console.log("[Login Check] \u2705 Periodic status check - expired access credential renewed via refresh credential");return}catch(r){if(this.jwtTokenData?.refreshToken){console.warn("[Login Check] \u26A0\uFE0F Periodic status check - credential refresh failed transiently, keeping session and retrying next cycle:",r instanceof Error?r.message:String(r));return}}console.log("[Login Check] \u26A0\uFE0F Periodic status check - Credential expired and cannot be renewed, signing out to return to login"),this.clear(),this.triggerLoginSuccessCallbacks();return}}static getInstance(){return n.instance||(n.instance=new n),n.instance}chmodOwnerOnly(e){if(process.platform!=="win32")try{Dc.chmodSync(e,384)}catch(r){console.warn("[Login Check] Failed to chmod credential file:",r)}}loadUserInfo(){try{if(Dc.existsSync(this.userInfoFilePath)){this.chmodOwnerOnly(this.userInfoFilePath);let e=Dc.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e)}else this.userInfo=null}catch(e){console.warn("[Login Check] Failed to load user info from local file:",e),this.userInfo=null}}saveUserInfo(){try{let e=mF.dirname(this.userInfoFilePath);Dc.existsSync(e)||Dc.mkdirSync(e,{recursive:!0,mode:448}),Dc.writeFileSync(this.userInfoFilePath,JSON.stringify(this.userInfo,null,2)),this.chmodOwnerOnly(this.userInfoFilePath),console.log("[Login Check] User info saved to local file")}catch(e){console.error("[Login Check] Failed to save user info:",e)}}loadJwtToken(){try{if(Dc.existsSync(this.jwtTokenFilePath)){this.chmodOwnerOnly(this.jwtTokenFilePath);let e=Dc.readFileSync(this.jwtTokenFilePath,"utf8");this.jwtTokenData=JSON.parse(e),this.isTokenExpired()?this.jwtTokenData?.refreshToken||(this.jwtTokenData=null):this.isTokenNearExpiry(300)&&console.log("\u26A0\uFE0F Access credential expiring soon, auto-renewal in progress")}else console.log("[Login Check] No stored access credential found, authentication required"),this.jwtTokenData=null}catch(e){console.warn("[Login Check] Failed to load access credential from local file:",e),this.jwtTokenData=null}}saveJwtToken(){try{if(!this.jwtTokenData)return;let e=mF.dirname(this.jwtTokenFilePath);Dc.existsSync(e)||Dc.mkdirSync(e,{recursive:!0,mode:448}),Dc.writeFileSync(this.jwtTokenFilePath,JSON.stringify(this.jwtTokenData,null,2)),this.chmodOwnerOnly(this.jwtTokenFilePath),console.log("[Login Check] Access credential data saved to local file")}catch(e){console.error("[Login Check] Failed to save access credential:",e)}}loadUsageStats(){try{if(Dc.existsSync(this.usageStatsFilePath)){let e=Dc.readFileSync(this.usageStatsFilePath,"utf8");this.usageStats=JSON.parse(e)}}catch(e){console.warn("[Login Check] Failed to load usage stats from local file:",e),this.usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()}}}saveUsageStats(){try{let e=mF.dirname(this.usageStatsFilePath);Dc.existsSync(e)||Dc.mkdirSync(e,{recursive:!0,mode:448}),Dc.writeFileSync(this.usageStatsFilePath,JSON.stringify(this.usageStats,null,2)),this.chmodOwnerOnly(this.usageStatsFilePath),console.log("[Login Check] Usage stats saved to local file")}catch(e){console.error("[Login Check] Failed to save usage stats:",e)}}updateUsageStats(e){e<=0||(this.usageStats.totalCreditsConsumed+=e,this.usageStats.lastUpdated=new Date().toISOString(),this.saveUsageStats(),console.log(`[Usage Stats] Updated total credits consumed: ${this.usageStats.totalCreditsConsumed} (+${e})`))}getUsageStats(){return{...this.usageStats}}checkStartupTokenStatus(){return this.jwtTokenData?{hasToken:!0,isExpired:Date.now()>=this.jwtTokenData.expiresAt,expiresAt:this.jwtTokenData.expiresAt,hasRefreshToken:!!this.jwtTokenData.refreshToken}:{hasToken:!1,isExpired:!0,expiresAt:null,hasRefreshToken:!1}}configure(e){this.config={...this.config,...e},e.userInfo&&(this.userInfo=e.userInfo,this.saveUserInfo(),console.log(`[Login Check] User info configured: ${e.userInfo.name}`)),e.proxyServerUrl&&console.log(`[Login Check] Proxy server URL: ${e.proxyServerUrl}`),e.cliVersion&&(this.cliVersion=e.cliVersion,console.log(`[Login Check] CLI version set: ${e.cliVersion}`))}setUserInfo(e){this.userInfo=e,this.saveUserInfo(),console.log(`[Login Check] User info updated: ${e.name} (${e.email||e.openId||"N/A"})`),this.startPeriodicStatusCheck(),this.triggerLoginSuccessCallbacks()}onLoginSuccess(e){this.onLoginSuccessCallbacks.push(e)}triggerLoginSuccessCallbacks(){this.onLoginSuccessCallbacks.forEach(e=>{try{e()}catch(r){console.error("[ProxyAuthManager] Error in login success callback:",r)}})}setCliVersion(e){this.cliVersion=e,console.log(`[Login Check] CLI version updated: ${e}`)}setJwtToken(e){let r=Date.now();this.jwtTokenData={accessToken:e,expiresIn:900,expiresAt:r+900*1e3,savedAt:new Date().toISOString()},this.saveJwtToken(),console.log("[Login Check] Access credential updated")}setJwtTokenData(e){let a=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:a,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),s=this.formatAbsoluteTime(a),t=this.formatAbsoluteTime(a-RUe*1e3),d=!!e.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${s}), next renewal: ${t}${d}`)}reloadFromDisk(){this.loadUserInfo(),this.loadJwtToken()}async getAccessToken(){if(this.jwtTokenData||this.reloadFromDisk(),!this.jwtTokenData)return console.log("[Login Check] No access credential available, authentication required"),null;let e=Date.now(),r=this.jwtTokenData.expiresAt-e,a=this.formatTimeRemaining(r);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${a}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(i){return console.error("[Login Check] Credential renewal failed:",i),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(e=RUe){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),a=r<=e*1e3;if(a){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${a}`)}return a}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let e=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":this.getUserAgent()},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!e.ok){if(e.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let d=await e.text();throw new Error(`Credential refresh failed (${e.status}): ${d}`)}let r=await e.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let a=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:a+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let s=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-RUe*1e3);return console.log(`[Login Check] \u2705 Credential renewed successfully - valid for: ${s} (until ${t}), next renewal: ${o}${i?" (refresh credential updated)":" (reusing existing refresh credential)"}`),this.jwtTokenData.accessToken}catch(e){throw console.error("[Login Check] Credential refresh error:",e),e}}clearTokens(){this.jwtTokenData=null;try{Dc.existsSync(this.jwtTokenFilePath)&&Dc.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}}getProxyServerUrl(){return this.config.proxyServerUrl}async getUserHeaders(e){let r=await this.getAccessToken(),a=this.getCliVersion(),i=this.getUserAgent(),s={"Content-Type":"application/json","X-Client-Version":a,"User-Agent":i,"X-Session-ID":tv()};return r&&(s.Authorization=`Bearer ${r}`),e&&(s["X-DVCode-Scene"]=e),s}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent(),a={"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":tv()};return this.jwtTokenData?.accessToken&&(a.Authorization=`Bearer ${this.jwtTokenData.accessToken}`),a}getUserInfo(){return this.userInfo}getCachedJwtTokenData(){return this.jwtTokenData}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}stopPeriodicStatusCheck(){this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null)}clear(){this.userInfo=null,this.jwtTokenData=null,this.stopPeriodicStatusCheck();try{Dc.existsSync(this.userInfoFilePath)&&Dc.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{Dc.existsSync(this.jwtTokenFilePath)&&Dc.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},ho=es.getInstance()});import{promises as nS}from"node:fs";import Dne from"node:path";import zwn from"os";var rv,K1e,Kr,K2=He(()=>{"use strict";(function(n){n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR"})(rv||(rv={}));K1e=class{config;logBuffer=[];constructor(e={}){if(this.config={level:rv.INFO,enableConsole:!0,enableFile:!1,maxFileSize:10,maxFiles:5,...e},this.config.enableFile&&!this.config.filePath){let r=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-");this.config.filePath=Dne.join(zwn.homedir(),".easycode-user","logs",`deepv-${r}.log`)}}formatMessage(e,r,...a){let i=new Date().toISOString(),s=a.map(t=>typeof t=="object"?JSON.stringify(t,null,2):String(t)).join(" ");return`[${i}] [${e}] ${r} ${s}`.trim()}async writeToFile(e){if(!(!this.config.enableFile||!this.config.filePath))try{await nS.mkdir(Dne.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await nS.appendFile(this.config.filePath,e+`
|
|
232
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],s}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,a,i]=kwn(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};NUe=class n extends Promise{constructor(e,r,a=Qwn){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=a,this.client=e}_thenUnwrap(e){return new n(this.client,this.responsePromise,async(r,a)=>e(await this.parseResponse(r,a),a))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(this.client,e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};uBt=Symbol("brand.privateNullableHeaders");Xne=n=>{let e=new Headers,r=new Set;for(let a of n){let i=new Set;for(let[s,t]of Hwn(a)){let o=s.toLowerCase();i.has(o)||(e.delete(s),i.add(o)),t===null?(e.delete(s),r.add(o)):(e.append(s,t),r.delete(o))}}return{[uBt]:!0,values:e,nulls:r}};fUe=n=>{var e,r,a,i,s,t;if(typeof globalThis.process<"u")return(a=(r=(e=globalThis.process.env)===null||e===void 0?void 0:e[n])===null||r===void 0?void 0:r.trim())!==null&&a!==void 0?a:void 0;if(typeof globalThis.Deno<"u")return(t=(s=(i=globalThis.Deno.env)===null||i===void 0?void 0:i.get)===null||s===void 0?void 0:s.call(i,n))===null||t===void 0?void 0:t.trim()};P1e=class n{constructor(e){var r,a,i,s,t,o,d,{baseURL:I=fUe("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:u=(r=fUe("GEMINI_API_KEY"))!==null&&r!==void 0?r:null,apiVersion:h="v1beta"}=e,c=k1e(e,["baseURL","apiKey","apiVersion"]);let m=Object.assign(Object.assign({apiKey:u,apiVersion:h},c),{baseURL:I||"https://generativelanguage.googleapis.com"});this.baseURL=m.baseURL,this.timeout=(a=m.timeout)!==null&&a!==void 0?a:n.DEFAULT_TIMEOUT,this.logger=(i=m.logger)!==null&&i!==void 0?i:console;let v="warn";this.logLevel=v,this.logLevel=(t=(s=tBt(m.logLevel,"ClientOptions.logLevel",this))!==null&&s!==void 0?s:tBt(fUe("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&t!==void 0?t:v,this.fetchOptions=m.fetchOptions,this.maxRetries=(o=m.maxRetries)!==null&&o!==void 0?o:2,this.fetch=(d=m.fetch)!==null&&d!==void 0?d:bwn(),this.encoder=vwn,this._options=m,this.apiKey=u,this.apiVersion=h,this.clientAdapter=m.clientAdapter}withOptions(e){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),e))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){if(!(e.has("authorization")||e.has("x-goog-api-key"))&&!(this.apiKey&&e.get("x-goog-api-key"))&&!r.has("x-goog-api-key"))throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(e){let r=Xne([e.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return Xne([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return Xne([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(e){return Object.entries(e).filter(([r,a])=>typeof a<"u").map(([r,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(r)}=`;throw new j2(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${dU}`}defaultIdempotencyKey(){return`stainless-node-retry-${nwn()}`}makeStatusError(e,r,a,i){return q2.generate(e,r,a,i)}buildURL(e,r,a){let i=!this.baseURLOverridden()&&a||this.baseURL,s=iwn(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),t=this.defaultQuery();return lwn(t)||(r=Object.assign(Object.assign({},t),r)),typeof r=="object"&&r&&!Array.isArray(r)&&(s.search=this.stringifyQuery(r)),s.toString()}async prepareOptions(e){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!e.path.startsWith(`/${this.apiVersion}/projects/`)){let r=e.path.slice(this.apiVersion.length+1);e.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${r}`}}async prepareRequest(e,{url:r,options:a}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,a){return this.request(Promise.resolve(a).then(i=>Object.assign({method:e,path:r},i)))}request(e,r=null){return new NUe(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,a){var i,s,t;let o=await e,d=(i=o.maxRetries)!==null&&i!==void 0?i:this.maxRetries;r==null&&(r=d),await this.prepareOptions(o);let{req:I,url:u,timeout:h}=await this.buildRequest(o,{retryCount:d-r});await this.prepareRequest(I,{url:u,options:o});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),m=a===void 0?"":`, retryOf: ${a}`,v=Date.now();if(Gg(this).debug(`[${c}] sending request`,$9({retryOfRequestLogID:a,method:o.method,url:u,options:o,headers:I.headers})),!((s=o.signal)===null||s===void 0)&&s.aborted)throw new Lne;let f=new AbortController,Z=await this.fetchWithTimeout(u,I,h,f).catch(gUe),y=Date.now();if(Z instanceof globalThis.Error){let w=`retrying, ${r} attempts remaining`;if(!((t=o.signal)===null||t===void 0)&&t.aborted)throw new Lne;let R=bUe(Z)||/timed? ?out/i.test(String(Z)+("cause"in Z?String(Z.cause):""));if(r)return Gg(this).info(`[${c}] connection ${R?"timed out":"failed"} - ${w}`),Gg(this).debug(`[${c}] connection ${R?"timed out":"failed"} (${w})`,$9({retryOfRequestLogID:a,url:u,durationMs:y-v,message:Z.message})),this.retryRequest(o,r,a??c);throw Gg(this).info(`[${c}] connection ${R?"timed out":"failed"} - error; no more retries left`),Gg(this).debug(`[${c}] connection ${R?"timed out":"failed"} (error; no more retries left)`,$9({retryOfRequestLogID:a,url:u,durationMs:y-v,message:Z.message})),R?new H1e:new mU({cause:Z})}let A=`[${c}${m}] ${I.method} ${u} ${Z.ok?"succeeded":"failed"} with status ${Z.status} in ${y-v}ms`;if(!Z.ok){let w=await this.shouldRetry(Z);if(r&&w){let p=`retrying, ${r} attempts remaining`;return await Gwn(Z.body),Gg(this).info(`${A} - ${p}`),Gg(this).debug(`[${c}] response error (${p})`,$9({retryOfRequestLogID:a,url:Z.url,status:Z.status,headers:Z.headers,durationMs:y-v})),this.retryRequest(o,r,a??c,Z.headers)}let R=w?"error; no more retries left":"error; not retryable";Gg(this).info(`${A} - ${R}`);let b=await Z.text().catch(p=>gUe(p).message),N=dwn(b),F=N?void 0:b;throw Gg(this).debug(`[${c}] response error (${R})`,$9({retryOfRequestLogID:a,url:Z.url,status:Z.status,headers:Z.headers,message:F,durationMs:Date.now()-v})),this.makeStatusError(Z.status,N,F,Z.headers)}return Gg(this).info(A),Gg(this).debug(`[${c}] response start`,$9({retryOfRequestLogID:a,url:Z.url,status:Z.status,headers:Z.headers,durationMs:y-v})),{response:Z,options:o,controller:f,requestLogID:c,retryOfRequestLogID:a,startTime:v}}async fetchWithTimeout(e,r,a,i){let s=r||{},{signal:t,method:o}=s,d=k1e(s,["signal","method"]);t&&t.addEventListener("abort",()=>i.abort());let I=setTimeout(()=>i.abort(),a),u=globalThis.ReadableStream&&d.body instanceof globalThis.ReadableStream||typeof d.body=="object"&&d.body!==null&&Symbol.asyncIterator in d.body,h=Object.assign(Object.assign(Object.assign({signal:i.signal},u?{duplex:"half"}:{}),{method:"GET"}),d);o&&(h.method=o.toUpperCase());try{return await this.fetch.call(void 0,e,h)}finally{clearTimeout(I)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,a,i){var s;let t,o=i?.get("retry-after-ms");if(o){let I=parseFloat(o);Number.isNaN(I)||(t=I)}let d=i?.get("retry-after");if(d&&!t){let I=parseFloat(d);Number.isNaN(I)?t=Date.parse(d)-Date.now():t=I*1e3}if(!(t&&0<=t&&t<60*1e3)){let I=(s=e.maxRetries)!==null&&s!==void 0?s:this.maxRetries;t=this.calculateDefaultRetryTimeoutMillis(r,I)}return await Iwn(t),this.makeRequest(e,r-1,a)}calculateDefaultRetryTimeoutMillis(e,r){let s=r-e,t=Math.min(.5*Math.pow(2,s),8),o=1-Math.random()*.25;return t*o*1e3}async buildRequest(e,{retryCount:r=0}={}){var a,i,s;let t=Object.assign({},e),{method:o,path:d,query:I,defaultBaseURL:u}=t,h=this.buildURL(d,I,u);"timeout"in t&&uwn("timeout",t.timeout),t.timeout=(a=t.timeout)!==null&&a!==void 0?a:this.timeout;let{bodyHeaders:c,body:m}=this.buildBody({options:t}),v=await this.buildHeaders({options:e,method:o,bodyHeaders:c,retryCount:r});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:o,headers:v},t.signal&&{signal:t.signal}),globalThis.ReadableStream&&m instanceof globalThis.ReadableStream&&{duplex:"half"}),m&&{body:m}),(i=this.fetchOptions)!==null&&i!==void 0?i:{}),(s=t.fetchOptions)!==null&&s!==void 0?s:{}),url:h,timeout:t.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:a,retryCount:i}){let s={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=e.idempotencyKey);let t=await this.authHeaders(e),o=Xne([s,Object.assign(Object.assign({Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i)},e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{}),fwn()),this._options.defaultHeaders,a,e.headers,t]);return this.validateHeaders(o),o.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let a=Xne([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&a.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:gwn(e)}:this.encoder({body:e,headers:a})}};P1e.DEFAULT_TIMEOUT=6e4;Cm=class extends P1e{constructor(){super(...arguments),this.interactions=new z1e(this)}};dBt=Cm;Cm.GeminiNextGenAPIClient=dBt;Cm.GeminiNextGenAPIClientError=j2;Cm.APIError=q2;Cm.APIConnectionError=mU;Cm.APIConnectionTimeoutError=H1e;Cm.APIUserAbortError=Lne;Cm.NotFoundError=J1e;Cm.ConflictError=T1e;Cm.RateLimitError=D1e;Cm.BadRequestError=X1e;Cm.AuthenticationError=S1e;Cm.InternalServerError=O1e;Cm.PermissionDeniedError=L1e;Cm.UnprocessableEntityError=B1e;Cm.toFile=Fwn;Cm.Interactions=z1e;Nxi=1024*1024*8;});function Xwn(n,e){return{...n,...e}}function IBt(n){let{prompt_id:e,...r}=n;return r}function tS(n){return Array.isArray(n)?n.map(e=>IBt(e)):n}var j1e=He(()=>{"use strict";Bn();});var hBt={};Ss(hBt,{DEFAULT_PROXY_CONFIG:()=>Jwn,getActiveProxyServerUrl:()=>NR,getAvailableProxyServers:()=>Swn,getProxyServerInfo:()=>Lwn,getProxyServers:()=>Jne,hasAvailableProxyServer:()=>wUe});function Jne(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function NR(){let e=Jne().find(r=>r.status==="active");if(!e)throw new Error("No active proxy server available. Please contact support.");return e.url}function Swn(){return Jne().filter(e=>e.status==="active")}function wUe(){return Jne().some(e=>e.status==="active")}function Lwn(n){return Jne().find(r=>r.url===n)}var Jwn,fU=He(()=>{"use strict";Jwn={serverUrl:NR(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import{randomUUID as Twn}from"crypto";function tv(){return Tne||(Tne=Twn()),Tne}function mBt(n){Tne=n}function pBt(){Tne=void 0}var Tne,fBt,q1e=He(()=>{"use strict";fBt=tv()});function Nd(n){let e=n??"1.1.85"??"unknown",r=process.platform,a=process.arch,i=process.env[bBt];if(i)return`${Bne}/${i}/${e} (${r}; ${a})`;if(e.startsWith("VSCode-")){let s=e.slice(7)||"unknown";return`${Bne}/VSCode/${s} (${r}; ${a})`}if(e.startsWith("Desktop-")){let s=e.slice(8)||"unknown";return`${Bne}/Desktop/${s} (${r}; ${a})`}return`${Bne}/CLI/${e} (${r}; ${a})`}var Bne,bBt,eV=He(()=>{"use strict";Bne="EasyCode",bBt="EASYCODE_UA_CLIENT"});import*as Dc from"fs";import*as mF from"path";import*as rS from"os";function Bwn(n){ho.configure(n)}function Dwn(n){ho.setUserInfo(n)}function Own(n){ho.setCliVersion(n)}async function Uwn(){return await ho.getUserHeaders()}function Mwn(){return ho.getStatus()}var RUe,es,ho,pF=He(()=>{"use strict";fU();q1e();eV();RUe=259200,es=class n{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){return Nd(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),a=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),s=Math.floor(r%3600/60),t=r%60;return a>0?`${a}\u5929${i}\u5C0F\u65F6${s}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${s}\u5206\u949F${t}\u79D2`:s>0?`${s}\u5206\u949F${t}\u79D2`:`${t}\u79D2`}formatAbsoluteTime(e){return new Date(e).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}constructor(){"https://api-code.deepvlab.ai"?.includes("localhost")?(this.userInfoFilePath=mF.join(rS.homedir(),".easycode-user","user-info-dev.json"),this.jwtTokenFilePath=mF.join(rS.homedir(),".easycode-user","jwt-token-dev.json"),this.usageStatsFilePath=mF.join(rS.homedir(),".easycode-user","usage-stats-dev.json")):(this.userInfoFilePath=mF.join(rS.homedir(),".easycode-user","user-info.json"),this.jwtTokenFilePath=mF.join(rS.homedir(),".easycode-user","jwt-token.json"),this.usageStatsFilePath=mF.join(rS.homedir(),".easycode-user","usage-stats.json")),this.cliVersion="1.1.85",this.config={proxyServerUrl:NR()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId===null&&(this.periodicStatusCheckIntervalId=setInterval(()=>{this.runPeriodicTokenCheck()},600*1e3))}async runPeriodicTokenCheck(){if(!this.userInfo&&!this.jwtTokenData)return;(!this.jwtTokenData||this.isTokenExpired())&&this.reloadFromDisk();let e=!!this.jwtTokenData&&!this.isTokenExpired();if(this.userInfo&&!e){if(this.jwtTokenData?.refreshToken)try{await this.refreshAccessToken(),console.log("[Login Check] \u2705 Periodic status check - expired access credential renewed via refresh credential");return}catch(r){if(this.jwtTokenData?.refreshToken){console.warn("[Login Check] \u26A0\uFE0F Periodic status check - credential refresh failed transiently, keeping session and retrying next cycle:",r instanceof Error?r.message:String(r));return}}console.log("[Login Check] \u26A0\uFE0F Periodic status check - Credential expired and cannot be renewed, signing out to return to login"),this.clear(),this.triggerLoginSuccessCallbacks();return}}static getInstance(){return n.instance||(n.instance=new n),n.instance}chmodOwnerOnly(e){if(process.platform!=="win32")try{Dc.chmodSync(e,384)}catch(r){console.warn("[Login Check] Failed to chmod credential file:",r)}}loadUserInfo(){try{if(Dc.existsSync(this.userInfoFilePath)){this.chmodOwnerOnly(this.userInfoFilePath);let e=Dc.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e)}else this.userInfo=null}catch(e){console.warn("[Login Check] Failed to load user info from local file:",e),this.userInfo=null}}saveUserInfo(){try{let e=mF.dirname(this.userInfoFilePath);Dc.existsSync(e)||Dc.mkdirSync(e,{recursive:!0,mode:448}),Dc.writeFileSync(this.userInfoFilePath,JSON.stringify(this.userInfo,null,2)),this.chmodOwnerOnly(this.userInfoFilePath),console.log("[Login Check] User info saved to local file")}catch(e){console.error("[Login Check] Failed to save user info:",e)}}loadJwtToken(){try{if(Dc.existsSync(this.jwtTokenFilePath)){this.chmodOwnerOnly(this.jwtTokenFilePath);let e=Dc.readFileSync(this.jwtTokenFilePath,"utf8");this.jwtTokenData=JSON.parse(e),this.isTokenExpired()?this.jwtTokenData?.refreshToken||(this.jwtTokenData=null):this.isTokenNearExpiry(300)&&console.log("\u26A0\uFE0F Access credential expiring soon, auto-renewal in progress")}else console.log("[Login Check] No stored access credential found, authentication required"),this.jwtTokenData=null}catch(e){console.warn("[Login Check] Failed to load access credential from local file:",e),this.jwtTokenData=null}}saveJwtToken(){try{if(!this.jwtTokenData)return;let e=mF.dirname(this.jwtTokenFilePath);Dc.existsSync(e)||Dc.mkdirSync(e,{recursive:!0,mode:448}),Dc.writeFileSync(this.jwtTokenFilePath,JSON.stringify(this.jwtTokenData,null,2)),this.chmodOwnerOnly(this.jwtTokenFilePath),console.log("[Login Check] Access credential data saved to local file")}catch(e){console.error("[Login Check] Failed to save access credential:",e)}}loadUsageStats(){try{if(Dc.existsSync(this.usageStatsFilePath)){let e=Dc.readFileSync(this.usageStatsFilePath,"utf8");this.usageStats=JSON.parse(e)}}catch(e){console.warn("[Login Check] Failed to load usage stats from local file:",e),this.usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()}}}saveUsageStats(){try{let e=mF.dirname(this.usageStatsFilePath);Dc.existsSync(e)||Dc.mkdirSync(e,{recursive:!0,mode:448}),Dc.writeFileSync(this.usageStatsFilePath,JSON.stringify(this.usageStats,null,2)),this.chmodOwnerOnly(this.usageStatsFilePath),console.log("[Login Check] Usage stats saved to local file")}catch(e){console.error("[Login Check] Failed to save usage stats:",e)}}updateUsageStats(e){e<=0||(this.usageStats.totalCreditsConsumed+=e,this.usageStats.lastUpdated=new Date().toISOString(),this.saveUsageStats(),console.log(`[Usage Stats] Updated total credits consumed: ${this.usageStats.totalCreditsConsumed} (+${e})`))}getUsageStats(){return{...this.usageStats}}checkStartupTokenStatus(){return this.jwtTokenData?{hasToken:!0,isExpired:Date.now()>=this.jwtTokenData.expiresAt,expiresAt:this.jwtTokenData.expiresAt,hasRefreshToken:!!this.jwtTokenData.refreshToken}:{hasToken:!1,isExpired:!0,expiresAt:null,hasRefreshToken:!1}}configure(e){this.config={...this.config,...e},e.userInfo&&(this.userInfo=e.userInfo,this.saveUserInfo(),console.log(`[Login Check] User info configured: ${e.userInfo.name}`)),e.proxyServerUrl&&console.log(`[Login Check] Proxy server URL: ${e.proxyServerUrl}`),e.cliVersion&&(this.cliVersion=e.cliVersion,console.log(`[Login Check] CLI version set: ${e.cliVersion}`))}setUserInfo(e){this.userInfo=e,this.saveUserInfo(),console.log(`[Login Check] User info updated: ${e.name} (${e.email||e.openId||"N/A"})`),this.startPeriodicStatusCheck(),this.triggerLoginSuccessCallbacks()}onLoginSuccess(e){this.onLoginSuccessCallbacks.push(e)}triggerLoginSuccessCallbacks(){this.onLoginSuccessCallbacks.forEach(e=>{try{e()}catch(r){console.error("[ProxyAuthManager] Error in login success callback:",r)}})}setCliVersion(e){this.cliVersion=e,console.log(`[Login Check] CLI version updated: ${e}`)}setJwtToken(e){let r=Date.now();this.jwtTokenData={accessToken:e,expiresIn:900,expiresAt:r+900*1e3,savedAt:new Date().toISOString()},this.saveJwtToken(),console.log("[Login Check] Access credential updated")}setJwtTokenData(e){let a=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:a,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),s=this.formatAbsoluteTime(a),t=this.formatAbsoluteTime(a-RUe*1e3),d=!!e.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${s}), next renewal: ${t}${d}`)}reloadFromDisk(){this.loadUserInfo(),this.loadJwtToken()}async getAccessToken(){if(this.jwtTokenData||this.reloadFromDisk(),!this.jwtTokenData)return console.log("[Login Check] No access credential available, authentication required"),null;let e=Date.now(),r=this.jwtTokenData.expiresAt-e,a=this.formatTimeRemaining(r);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${a}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(i){return console.error("[Login Check] Credential renewal failed:",i),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(e=RUe){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),a=r<=e*1e3;if(a){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${a}`)}return a}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let e=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":this.getUserAgent()},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!e.ok){if(e.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let d=await e.text();throw new Error(`Credential refresh failed (${e.status}): ${d}`)}let r=await e.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let a=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:a+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let s=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-RUe*1e3);return console.log(`[Login Check] \u2705 Credential renewed successfully - valid for: ${s} (until ${t}), next renewal: ${o}${i?" (refresh credential updated)":" (reusing existing refresh credential)"}`),this.jwtTokenData.accessToken}catch(e){throw console.error("[Login Check] Credential refresh error:",e),e}}clearTokens(){this.jwtTokenData=null;try{Dc.existsSync(this.jwtTokenFilePath)&&Dc.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}}getProxyServerUrl(){return this.config.proxyServerUrl}async getUserHeaders(e){let r=await this.getAccessToken(),a=this.getCliVersion(),i=this.getUserAgent(),s={"Content-Type":"application/json","X-Client-Version":a,"User-Agent":i,"X-Session-ID":tv()};return r&&(s.Authorization=`Bearer ${r}`),e&&(s["X-DVCode-Scene"]=e),s}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent(),a={"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":tv()};return this.jwtTokenData?.accessToken&&(a.Authorization=`Bearer ${this.jwtTokenData.accessToken}`),a}getUserInfo(){return this.userInfo}getCachedJwtTokenData(){return this.jwtTokenData}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}stopPeriodicStatusCheck(){this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null)}clear(){this.userInfo=null,this.jwtTokenData=null,this.stopPeriodicStatusCheck();try{Dc.existsSync(this.userInfoFilePath)&&Dc.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{Dc.existsSync(this.jwtTokenFilePath)&&Dc.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},ho=es.getInstance()});import{promises as nS}from"node:fs";import Dne from"node:path";import zwn from"os";var rv,K1e,Kr,K2=He(()=>{"use strict";(function(n){n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR"})(rv||(rv={}));K1e=class{config;logBuffer=[];constructor(e={}){if(this.config={level:rv.INFO,enableConsole:!0,enableFile:!1,maxFileSize:10,maxFiles:5,...e},this.config.enableFile&&!this.config.filePath){let r=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-");this.config.filePath=Dne.join(zwn.homedir(),".easycode-user","logs",`deepv-${r}.log`)}}formatMessage(e,r,...a){let i=new Date().toISOString(),s=a.map(t=>typeof t=="object"?JSON.stringify(t,null,2):String(t)).join(" ");return`[${i}] [${e}] ${r} ${s}`.trim()}async writeToFile(e){if(!(!this.config.enableFile||!this.config.filePath))try{await nS.mkdir(Dne.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await nS.appendFile(this.config.filePath,e+`
|
|
233
233
|
`,"utf-8")}catch(r){console.error("\u5199\u5165\u65E5\u5FD7\u6587\u4EF6\u5931\u8D25:",r)}}async rotateLogIfNeeded(){if(this.config.filePath)try{if((await nS.stat(this.config.filePath)).size/(1024*1024)>(this.config.maxFileSize||10)){let a=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-"),i=this.config.filePath.replace(".log",`-${a}.log`);await nS.rename(this.config.filePath,i),await this.cleanOldLogs()}}catch(e){e.code!=="ENOENT"&&console.error("\u65E5\u5FD7\u8F6E\u8F6C\u5931\u8D25:",e)}}async cleanOldLogs(){if(this.config.filePath)try{let e=Dne.dirname(this.config.filePath),a=(await nS.readdir(e)).filter(t=>t.startsWith("deepv-")&&t.endsWith(".log")).map(t=>({name:t,path:Dne.join(e,t),time:nS.stat(Dne.join(e,t)).then(o=>o.mtime)})),i=await Promise.all(a.map(async t=>({...t,time:await t.time})));i.sort((t,o)=>o.time.getTime()-t.time.getTime());let s=i.slice(this.config.maxFiles||5);for(let t of s)await nS.unlink(t.path)}catch(e){console.error("\u6E05\u7406\u65E7\u65E5\u5FD7\u5931\u8D25:",e)}}log(e,r,a,...i){if(e<this.config.level)return;let s=this.formatMessage(r,a,...i);this.config.enableConsole&&(e>=rv.ERROR?console.error:e>=rv.WARN?console.warn:e>=rv.INFO?console.log:console.debug)(s),this.config.enableFile&&this.writeToFile(s)}debug(e,...r){this.log(rv.DEBUG,"DEBUG",e,...r)}info(e,...r){this.log(rv.INFO,"INFO",e,...r)}warn(e,...r){this.log(rv.WARN,"WARN",e,...r)}error(e,...r){this.log(rv.ERROR,"ERROR",e,...r)}logApiRequest(e,r){this.debug("API\u8BF7\u6C42",{endpoint:e,timestamp:new Date().toISOString(),requestSize:JSON.stringify(r).length,...process.env.FILE_DEBUG==="1"?{requestData:r}:{}})}logApiResponse(e,r){this.debug("API\u54CD\u5E94",{endpoint:e,timestamp:new Date().toISOString(),responseSize:JSON.stringify(r).length,...process.env.FILE_DEBUG==="1"?{responseData:r}:{}})}},Kr=new K1e({level:process.env.FILE_DEBUG==="1"?rv.DEBUG:rv.INFO,enableConsole:!0,enableFile:process.env.LOG_TO_FILE==="true",filePath:process.env.LOG_FILE_PATH})});function yc(n){return n instanceof Error&&"code"in n}function kr(n){if(n instanceof Error)return n.message;try{return String(n)}catch{return"Failed to get error details"}}function One(n){return!!n&&typeof n=="object"&&n.isCustomModelError===!0}function EUe(n){if(n&&typeof n=="object"&&"response"in n){let r=_wn(n);if(r?.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new eve(r.error.message);case 401:return new Wd(r.error.message);case 403:return new $1e(r.error.message);default:}}return n}function _wn(n){let e=n.response?.data;if(typeof e=="string")try{e=JSON.parse(e)}catch{return}if(!(!e||typeof e!="object"))return e}function aS(n){if(!n)return!1;try{let e=JSON.parse(n);return e&&e.error==="Unauthorized"&&e.errorCode==="AUTHENTICATION_FAILED"}catch{return!1}}var $1e,Wd,eve,Yl=He(()=>{"use strict";$1e=class extends Error{},Wd=class extends Error{},eve=class extends Error{}});function tve(n){return n?n===mI||gBt.includes(n):!1}function fF(n){return(n??[]).find(e=>{if(e.enabled===!1)return!1;let r=(e.modelId??"").toLowerCase(),a=(e.displayName??"").toLowerCase();return r.includes("gemini")&&r.includes("flash")||a.includes("gemini")&&a.includes("flash")})}var Une,tV,bU,Pf,mI,gBt,nv=He(()=>{"use strict";Une="auto",tV="auto",bU="auto",Pf="deepseek-flash",mI="gemini-3.1-flash-lite",gBt=["gemini-2.5-flash","gemini-2.5-flash-lite"]});var ra,GBt,Fd,$2=He(()=>{"use strict";nv();(function(n){n.CHAT_CONVERSATION="chat_conversation",n.WEB_FETCH="web_fetch",n.WEB_SEARCH="web_search",n.CONTENT_SUMMARY="content_summary",n.JSON_GENERATION="json_generation",n.COMPRESSION="compression",n.SUB_AGENT="sub_agent",n.CODE_ASSIST="code_assist",n.EDIT_CORRECTION="edit_correction",n.IMAGE_READER="image_reader",n.GOAL_EVALUATION="goal_evaluation"})(ra||(ra={}));GBt={[ra.CHAT_CONVERSATION]:"auto",[ra.WEB_FETCH]:mI,[ra.WEB_SEARCH]:mI,[ra.CODE_ASSIST]:"auto",[ra.CONTENT_SUMMARY]:Pf,[ra.EDIT_CORRECTION]:Pf,[ra.JSON_GENERATION]:mI,[ra.COMPRESSION]:Pf,[ra.SUB_AGENT]:"auto",[ra.IMAGE_READER]:mI,[ra.GOAL_EVALUATION]:Pf},Fd=class{static getModelForScene(e){if(e)return GBt[e]}static isClaudeModel(e){return e.includes("claude")||e.includes("anthropic")}static isGeminiModel(e){return e.includes("gemini")&&!this.isClaudeModel(e)}static getSceneDisplayName(e){return{[ra.CHAT_CONVERSATION]:"\u804A\u5929\u5BF9\u8BDD",[ra.WEB_FETCH]:"Web\u5185\u5BB9\u83B7\u53D6",[ra.WEB_SEARCH]:"Web\u641C\u7D22",[ra.CODE_ASSIST]:"\u4EE3\u7801\u52A9\u624B",[ra.CONTENT_SUMMARY]:"\u5185\u5BB9\u6458\u8981",[ra.EDIT_CORRECTION]:"\u7F16\u8F91\u6821\u6B63",[ra.JSON_GENERATION]:"JSON\u751F\u6210",[ra.COMPRESSION]:"\u5BF9\u8BDD\u538B\u7F29",[ra.SUB_AGENT]:"SubAgent\u5B50\u4EE3\u7406",[ra.IMAGE_READER]:"\u56FE\u7247\u8BC6\u522B",[ra.GOAL_EVALUATION]:"\u76EE\u6807\u8FBE\u6210\u8BC4\u4F30"}[e]||e}}});function eG(n){return typeof n=="object"&&n!==null&&"error"in n&&typeof n.error=="object"&&"message"in n.error}function jf(n){return typeof n=="object"&&n!==null&&"message"in n&&typeof n.message=="string"}function Mne(n){let e=r=>r.includes("Quota exceeded for quota metric 'Gemini")&&r.includes("Pro Requests'");if(typeof n=="string")return e(n);if(jf(n))return e(n.message);if(eG(n))return e(n.error.message);if(n&&typeof n=="object"&&"response"in n){let r=n;if(r.response&&r.response.data){if(typeof r.response.data=="string")return e(r.response.data);if(typeof r.response.data=="object"&&r.response.data!==null&&"error"in r.response.data){let a=r.response.data;return e(a.error?.message||"")}}}return!1}function zne(n){return typeof n=="string"?n.includes("Quota exceeded for quota metric"):jf(n)?n.message.includes("Quota exceeded for quota metric"):eG(n)?n.error.message.includes("Quota exceeded for quota metric"):!1}function _ne(n){let e=(i,s)=>{if(!i||typeof i!="object")return null;let t=i.error;if(!t||typeof t!="object")return null;let o=t,d=typeof o.code=="string"&&o.code.includes("quota_limit_exceeded"),I=o.type==="rate_limit_error"&&s===400;return(d||I)&&typeof o.message=="string"&&o.message.trim()?o.message:null};if(n&&typeof n=="object"&&"response"in n){let i=n.response;if(i){let s=e(i.data,i.status);if(s)return s}}let r=n instanceof Error||n&&typeof n=="object"&&typeof n.message=="string"?n.message:typeof n=="string"?n:"",a=r.match(/\((\d{3})\):/);if(a&&(r.includes("rate_limit_error")||r.includes("quota_limit_exceeded"))){let i=r.match(/\{[\s\S]*\}$/);if(i)try{let s=e(JSON.parse(i[0]),Number(a[1]));if(s)return s}catch{}}return e(n)}function av(n){if(_ne(n))return!0;if(n&&typeof n=="object"&&"response"in n){let e=n;if(e.response?.status===402&&e.response.data){let r=e.response.data;if(r&&typeof r.error=="string"&&(r.error==="Quota limit exceeded"||r.error==="No quota configuration")&&typeof r.message=="string")return!0}if(e.response?.status===500&&e.response.data){let r=e.response.data;if(r&&typeof r.message=="string"&&r.message.includes("quota exceeded"))return!0}}if(n instanceof Error&&n.message&&(n.message.includes("API request failed (402):")&&(n.message.includes('"error":"Quota limit exceeded"')||n.message.includes('"error":"No quota configuration"'))||n.message.includes("API request failed (500):")&&n.message.includes("quota exceeded")||n.message.includes("Stream API error (500):")&&n.message.includes("quota exceeded")))return!0;if(typeof n=="object"&&n!==null){let e=n;if(e.message&&typeof e.message=="string"&&(e.message.includes("API request failed (402):")&&(e.message.includes('"error":"Quota limit exceeded"')||e.message.includes('"error":"No quota configuration"'))||e.message.includes("API error (402):")&&(e.message.includes('"error":"Quota limit exceeded"')||e.message.includes('"error":"No quota configuration"'))||(e.message.includes("API request failed (500):")||e.message.includes("Stream API error (500):"))&&e.message.includes("quota exceeded"))||(e.error==="Quota limit exceeded"||e.error==="No quota configuration")&&typeof e.message=="string"||e.status===500&&typeof e.message=="string"&&e.message.includes("quota exceeded"))return!0}return typeof n=="string"?n.includes("Quota limit exceeded")||n.includes("No quota configuration")||n.includes("Daily token limit would be exceeded")||n.includes("Daily request limit exceeded")||n.includes("Daily cost limit would be exceeded")||n.includes("500")&&n.includes("quota exceeded"):!1}function AUe(n){let e=_ne(n);if(e)return e;let r=null;if(n&&typeof n=="object"&&"response"in n){let a=n;if(a.response?.status===402&&a.response.data)r=a.response.data;else if(a.response?.status===500&&a.response.data){let i=a.response.data;i&&typeof i.message=="string"&&i.message.includes("quota exceeded")&&(r=i)}}else if(typeof n=="object"&&n!==null){let a=n;if(a.message&&typeof a.message=="string"&&(a.message.includes("API request failed (402):")||a.message.includes("API request failed (500):")||a.message.includes("Stream API error (500):"))&&(a.message.includes('"error":"Quota limit exceeded"')||a.message.includes('"error":"No quota configuration"')||a.message.includes("quota exceeded")))try{let i=a.message.match(/\{.*\}$/);i&&(r=JSON.parse(i[0]))}catch{}r||(r=n)}if(!r&&n instanceof Error&&n.message&&(n.message.includes("API request failed (402):")||n.message.includes("API request failed (500):")||n.message.includes("Stream API error (500):"))&&(n.message.includes('"error":"Quota limit exceeded"')||n.message.includes('"error":"No quota configuration"')||n.message.includes("quota exceeded")))try{let a=n.message.match(/\{.*\}$/);a&&(r=JSON.parse(a[0]))}catch{}return r?r.message&&r.message.includes("quota exceeded")?Pwn(r):jwn(r):null}function Pwn(n){let r=(()=>{try{let c=process.env,m=c.LC_ALL||c.LC_CTYPE||c.LANG||"";return m.toLowerCase().includes("zh")||m.toLowerCase().includes("chinese")}catch{return!1}})(),a="",i="",s="",t="",o=n.message||"",d=o.match(/Role:\s*([^,]+)/);d&&(a=d[1].trim());let I=o.match(/Limit:\s*([^,]+)/);I&&(i=I[1].trim());let u=o.match(/Used:\s*([^,]+)/);u&&(s=u[1].trim());let h=o.match(/Cycle:\s*([^,]+)/);if(h&&(t=h[1].trim()),r){let c=`\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
234
234
|
`;return c+=`\u{1F6AB} \u5F53\u524D\u6A21\u578B\u7684\u5FAA\u73AF\u914D\u989D\u5DF2\u7528\u5C3D (Cycle Quota Exceeded)
|
|
235
235
|
`,a&&(c+=`\u{1F464} \u89D2\u8272\u4FE1\u606F: ${a}
|
|
@@ -486,7 +486,7 @@ Authorization code received, exchanging for tokens...`);let c=await this.exchang
|
|
|
486
486
|
`);super(e,r,`${a} Set "tool" to one of the names below and pass its arguments in "args". Only summaries are listed here \u2014 use action="describe" with a tool name to get that tool's full JSON schema before building a complex call, or action="list" to re-read this catalog. All ${i.length} tools are reachable through here; nothing is hidden.
|
|
487
487
|
|
|
488
488
|
Available tools:
|
|
489
|
-
${t}`,s,{type:It.OBJECT,properties:{action:{type:It.STRING,enum:["call","list","describe"],description:`What to do: "call" (default) invokes a tool, "describe" returns a tool's JSON schema, "list" re-lists the catalog.`},tool:{type:It.STRING,description:'Target tool name. Required for "call" and "describe".'},args:{type:It.OBJECT,description:"Arguments object forwarded verbatim to the target tool."}},required:[]},!0,!1);for(let o of i)this.byName.set(o.toolName,o)}toolNames(){return[...this.byName.keys()]}get size(){return this.byName.size}member(e){return this.byName.get(e)}validateToolParams(e){let r=e?.action??"call";if(r!=="call"&&r!=="list"&&r!=="describe")return`Unknown action "${String(r)}". Use "call", "describe" or "list".`;if(r!=="list"){if(!e?.tool||typeof e.tool!="string")return`Parameter "tool" is required for action "${r}".`;if(!this.byName.has(e.tool))return`Unknown tool "${e.tool}" in "${this.name}". Available: ${this.toolNames().join(", ")}`}return null}getDescription(e){let r=e?.action??"call";return r==="list"?`List tools of ${this.name}`:r==="describe"?`Describe ${e?.tool}`:`${e?.tool??"?"}`}async shouldConfirmExecute(e,r){if((e?.action??"call")!=="call")return!1;let i=e?.tool?this.byName.get(e.tool):void 0;return i?i.shouldConfirmExecute(e.args??{},r):!1}async execute(e,r,a){let i=this.validateToolParams(e);if(i)return{llmContent:`Error: ${i}`,returnDisplay:i};let s=e.action??"call";if(s==="list"){let o=[...this.byName.values()].map(d=>({tool:d.toolName,summary:Hir(d.description)}));return{llmContent:JSON.stringify({namespace:this.name,tools:o}),returnDisplay:`${this.name}: ${o.length} tools`,summary:`${o.length} tools`}}let t=this.byName.get(e.tool);return s==="describe"?{llmContent:JSON.stringify({namespace:this.name,tool:t.toolName,description:t.description,parameters:t.parameterSchema??{type:"object",properties:{}}}),returnDisplay:`Schema of ${t.toolName}`,summary:t.toolName}:t.execute(e.args??{},r,a)}}});function rat(n){return`mcp__${n.replace(/[^A-Za-z0-9_.-]/g,"_").replace(/^_+|_+$/g,"")||"server"}`}function Fqn(n){return{toolName:n.serverToolName,description:n.description,parameterSchema:n.parameterSchemaJson,execute:(e,r,a)=>n.execute(e,r,a),shouldConfirmExecute:(e,r)=>n.shouldConfirmExecute(e,r)}}var oFe,Xir=He(()=>{"use strict";foe();oFe=class extends jL{serverName;constructor(e,r){super(rat(e),`${e} (MCP)`,`Gateway to the ${r.length} tools of the "${e}" MCP server.`,r.map(Fqn)),this.serverName=e}}});function wqn(n=process.env){let e=n.EASYCODE_MCP_NAMESPACE_THRESHOLD;if(e===void 0)return 8;let r=Number.parseInt(e,10);return!Number.isFinite(r)||r<0?8:r}function Sir(n,e,r=process.env){return n<=1||e==="direct"?!1:e==="namespace"?!0:n>wqn(r)}var Lir=He(()=>{"use strict";});async function Rqn(n,e,r){let a,i=new Promise((s,t)=>{a=setTimeout(()=>{t(new Error(`Connection to '${r}' timed out after ${e}ms`))},e)});try{let s=await Promise.race([n,i]);return a&&clearTimeout(a),s}catch(s){throw a&&clearTimeout(a),s}}function goe(){return Dir}function iat(){Dir=!0}function Oir(n,e,r){IFe.set(n,e),r&&hFe.set(n,r)}function Eqn(n){return IFe.get(n)??0}function Aqn(){return new Map(IFe)}function xqn(n){return hFe.get(n)??[]}function Cqn(){return new Map(hFe)}function lat(n,e,r,a){if(r.length===0)return 0;if(Sir(r.length,a))return n.registerTool(new oFe(e,r)),console.log(`[MCP] Server '${e}': ${r.length} tools exposed via namespace tool '${rat(e)}' (1 declaration instead of ${r.length})`),1;for(let i of r)n.registerTool(i);return r.length}function Uir(n,e,r){mFe.set(n,e),sat.set(n,r)}function Mir(n){mFe.delete(n),sat.delete(n)}function pFe(n){let e=0;for(let[r,a]of mFe.entries()){let i=a.map(s=>s.clone());e+=lat(n,r,i,sat.get(r))}return e}function fFe(n){let e=0;for(let[r,a]of oat.entries())n.setResourcesForServer(r,a),e+=a.length;return e}async function Goe(n,e,r,a){let i=boe.get(n);if(i){try{await i.close()}catch(s){console.warn(`Error closing MCP client '${n}':`,s)}boe.delete(n)}e.removeMcpToolsByServer(n),r.removePromptsByServer(n),a.removeResourcesByServer(n),Mir(n),oat.delete(n),uFe.delete(n),IFe.delete(n),hFe.delete(n),console.log(`[MCP] Successfully unloaded server: ${n}`)}function bFe(){return mFe.size>0}async function voe(n=3e4){if(Vg()===gI.COMPLETED)return!0;if(Vg()===gI.NOT_STARTED)return!1;let e=100,r=0;for(;r<n;)if(await new Promise(a=>setTimeout(a,e)),r+=e,Vg()===gI.COMPLETED)return!0;return console.warn(`[MCP] waitForMCPDiscoveryComplete timed out after ${n}ms`),!1}function cat(n){cFe.push(n)}function uat(n){let e=cFe.indexOf(n);e!==-1&&cFe.splice(e,1)}function lFe(n,e){uFe.set(n,e);for(let r of cFe)r(n,e)}function D7(n){return uFe.get(n)||Ad.DISCONNECTED}function dat(){return new Map(uFe)}function Vg(){return aat}function Yqn(n){let e=[/www-authenticate:\s*([^\n\r]+)/i,/WWW-Authenticate:\s*([^\n\r]+)/i,/"www-authenticate":\s*"([^"]+)"/i,/'www-authenticate':\s*'([^']+)'/i];for(let r of e){let a=n.match(r);if(a)return a[1].trim()}return null}async function Vqn(n,e,r){try{console.log(`\u{1F510} '${n}' requires OAuth authentication`);let a,i=Hm.parseWWWAuthenticateHeader(r);if(i)a=await Hm.discoverOAuthConfig(i);else if(e.url){let t=new URL(e.url),o=`${t.protocol}//${t.host}`;a=await Hm.discoverOAuthConfig(o)}else if(e.httpUrl){let t=new URL(e.httpUrl),o=`${t.protocol}//${t.host}`;a=await Hm.discoverOAuthConfig(o)}if(!a)return console.error(`\u274C Could not configure OAuth for '${n}' - please authenticate manually with /mcp auth ${n}`),!1;let s={enabled:!0,authorizationUrl:a.authorizationUrl,tokenUrl:a.tokenUrl,scopes:a.scopes||[]};return console.log(`Starting OAuth authentication for server '${n}'...`),await Gv.authenticate(n,s),console.log(`OAuth authentication successful for server '${n}'`),!0}catch(a){return console.error(`Failed to handle automatic OAuth for server '${n}': ${kr(a)}`),!1}}async function Jir(n,e,r){try{if(e.httpUrl){let a={requestInit:{headers:{...e.headers,Authorization:`Bearer ${r}`}}};return new zL(new URL(e.httpUrl),a)}else if(e.url)return new hoe(new URL(e.url),{requestInit:{headers:{...e.headers,Authorization:`Bearer ${r}`}}});return null}catch(a){return console.error(`Failed to create OAuth transport for server '${n}': ${kr(a)}`),null}}async function yoe(n,e,r,a,i,s){aat=gI.IN_PROGRESS;try{n=zir(n,e);for(let[t,o]of Object.entries(n))await new Promise(d=>setImmediate(d)),await _ir(t,o,r,a,i,s)}finally{aat=gI.COMPLETED}}function zir(n,e){if(e){let r=e,a=(0,Tir.parse)(r,process.env);if(a.some(i=>typeof i!="string"))throw new Error("failed to parse mcpServerCommand: "+r);n.mcp={command:a[0],args:a.slice(1)}}return n}async function _ir(n,e,r,a,i,s){lFe(n,Ad.CONNECTING);try{let t=await $ir(n,e,s);try{t.onerror=u=>{console.error(`MCP ERROR (${n}):`,u.toString()),lFe(n,Ad.DISCONNECTED)},await qir(n,t,a);let o=await Pir(n,t);i.setResourcesForServer(n,o),oat.set(n,o);let d=await jir(n,e,t);lat(r,n,d,e.toolExposure),boe.set(n,t),Uir(n,d,e.toolExposure);let I=d.map(u=>u.name);Oir(n,d.length,I),lFe(n,Ad.CONNECTED)}catch(o){throw t.close(),o}}catch(t){aFe()||console.error(`Error connecting to MCP server '${n}': ${kr(t)}`),lFe(n,Ad.DISCONNECTED)}}async function Pir(n,e){try{return e.getServerCapabilities()?.resources==null?[]:await kqn(n,e)}catch(r){return r instanceof Error&&!r.message?.includes("Method not found")&&console.error(`Error discovering resources from ${n}: ${kr(r)}`),[]}}async function kqn(n,e){let r=[],a;try{do{let i=await e.request({method:"resources/list",params:a?{cursor:a}:{}},fse);r.push(...i.resources??[]),a=i.nextCursor??void 0}while(a)}catch(i){if(i instanceof Error&&i.message?.includes("Method not found"))return[];throw console.error(`Error listing resources from ${n}: ${kr(i)}`),i}return r}async function Qqn(n,e){return n.request({method:"resources/read",params:{uri:e}},bse)}async function jir(n,e,r){try{if(r.getServerCapabilities()?.tools==null)return[];let a=nBt(r),i=await a.tool();if(!Array.isArray(i.functionDeclarations))throw new Error("Server did not return valid function declarations.");let s=[];for(let t of i.functionDeclarations)tsr(t,n,e)&&s.push(new ZG(a,n,t.name,t.description??"",t.parametersJsonSchema??{type:"object",properties:{}},e.timeout??B7,e.trust));return s}catch(a){return a instanceof Error&&!a.message?.includes("Method not found")&&console.error(`Error discovering tools from ${n}: ${kr(a)}`),[]}}async function qir(n,e,r){try{let a=await e.request({method:"prompts/list",params:{}},gse);for(let i of a.prompts)r.registerPrompt({...i,serverName:n,invoke:s=>Kir(n,e,i.name,s)})}catch(a){a instanceof Error&&!a.message?.includes("Method not found")&&console.error(`Error discovering prompts from ${n}: ${kr(a)}`)}}async function Kir(n,e,r,a){boe.has(n);try{return await e.request({method:"prompts/get",params:{name:r,arguments:a}},Gse)}catch(i){throw i instanceof Error&&!i.message?.includes("Method not found")&&console.error(`Error invoking prompt '${r}' from ${n} ${a}: ${kr(i)}`),i}}function Hqn(n){return boe.get(n)}async function $ir(n,e,r,a=Bir){return await Rqn(Xqn(n,e,r),a,n)}async function Xqn(n,e,r){let a=new E7({name:"dvcode-cli-mcp-client",version:"1.0.0"},{jsonSchemaValidator:new nat});if("callTool"in a){let i=a.callTool.bind(a);a.callTool=function(s,t,o){return i(s,t,{...o,timeout:e.timeout??B7})}}try{let i=await esr(n,e,r);try{r&&console.log(`MCP Client: Connecting to ${n}...`);try{return await a.connect(i,{timeout:e.timeout??B7}),r&&console.log(`MCP Client: Connected to ${n} \u2713`),a}catch(s){throw r&&console.log(`MCP Client: Failed to connect to ${n} \u2717`),s}}catch(s){throw await i.close(),s}}catch(i){let s=String(i);if(s.includes("401")&&(e.httpUrl||e.url)){if(dFe.set(n,!0),!(e.httpUrl||e.oauth?.enabled)){let d=await L0.getToken(n);if(d){let I=await Gv.getValidToken(n,{clientId:d.clientId});console.log(I?`Stored OAuth token for SSE server '${n}' was rejected. Please re-authenticate using: /mcp auth ${n}`:`401 error received for SSE server '${n}' without OAuth configuration. Please authenticate using: /mcp auth ${n}`)}throw new Error(`401 error received for SSE server '${n}' without OAuth configuration. Please authenticate using: /mcp auth ${n}`)}let o=Yqn(s);if(!o&&e.url){console.log("No www-authenticate header in error, trying to fetch it from server...");try{let d=await fetch(e.url,{method:"HEAD",headers:{Accept:"text/event-stream"},signal:AbortSignal.timeout(5e3)});d.status===401&&(o=d.headers.get("www-authenticate"),o&&console.log(`Found www-authenticate header from server: ${o}`))}catch(d){console.debug(`Failed to fetch www-authenticate header: ${kr(d)}`)}}if(o)if(console.log(`Received 401 with www-authenticate header: ${o}`),await Vqn(n,e,o)){console.log(`Retrying connection to '${n}' with OAuth token...`);let I=await L0.getToken(n);if(I){let u=await Gv.getValidToken(n,{clientId:I.clientId});if(u){let h=await Jir(n,e,u);if(h)try{return await a.connect(h,{timeout:e.timeout??B7}),a}catch(c){throw console.error(`Failed to connect with OAuth token: ${kr(c)}`),c}else throw console.error(`Failed to create OAuth transport for server '${n}'`),new Error(`Failed to create OAuth transport for server '${n}'`)}else throw console.error(`Failed to get OAuth token for server '${n}'`),new Error(`Failed to get OAuth token for server '${n}'`)}else throw console.error(`Failed to get credentials for server '${n}' after successful OAuth authentication`),new Error(`Failed to get credentials for server '${n}' after successful OAuth authentication`)}else throw console.error(`Failed to handle automatic OAuth for server '${n}'`),new Error(`Failed to handle automatic OAuth for server '${n}'`);else{if(!(e.httpUrl||e.oauth?.enabled)){let I=await L0.getToken(n);if(I){let u=await Gv.getValidToken(n,{clientId:I.clientId});console.log(u?`Stored OAuth token for SSE server '${n}' was rejected. Please re-authenticate using: /mcp auth ${n}`:`401 error received for SSE server '${n}' without OAuth configuration. Please authenticate using: /mcp auth ${n}`)}throw new Error(`401 error received for SSE server '${n}' without OAuth configuration. Please authenticate using: /mcp auth ${n}`)}if(console.log(`\u{1F50D} Attempting OAuth discovery for '${n}'...`),e.url){let I=new URL(e.url),u=`${I.protocol}//${I.host}`;try{let h=await Hm.discoverOAuthConfig(u);if(h){console.log(`Discovered OAuth configuration from base URL for server '${n}'`);let c={enabled:!0,authorizationUrl:h.authorizationUrl,tokenUrl:h.tokenUrl,scopes:h.scopes||[]};console.log(`Starting OAuth authentication for server '${n}'...`),await Gv.authenticate(n,c);let m=await L0.getToken(n);if(m){let v=await Gv.getValidToken(n,{clientId:m.clientId});if(v){let f=await Jir(n,e,v);if(f)try{return await a.connect(f,{timeout:e.timeout??B7}),a}catch(Z){throw console.error(`Failed to connect with OAuth token: ${kr(Z)}`),Z}else throw console.error(`Failed to create OAuth transport for server '${n}'`),new Error(`Failed to create OAuth transport for server '${n}'`)}else throw console.error(`Failed to get OAuth token for server '${n}'`),new Error(`Failed to get OAuth token for server '${n}'`)}else throw console.error(`Failed to get stored credentials for server '${n}'`),new Error(`Failed to get stored credentials for server '${n}'`)}else throw console.error(`\u274C Could not configure OAuth for '${n}' - please authenticate manually with /mcp auth ${n}`),new Error(`OAuth configuration failed for '${n}'. Please authenticate manually with /mcp auth ${n}`)}catch(h){throw console.error(`\u274C OAuth discovery failed for '${n}' - please authenticate manually with /mcp auth ${n}`),h}}else throw console.error(`\u274C '${n}' requires authentication but no OAuth configuration found`),new Error(`MCP server '${n}' requires authentication. Please configure OAuth or check server settings.`)}}else{let t=i.message||String(i),o=t.includes("ENOTFOUND")||t.includes("ECONNREFUSED"),d;throw o?d=`Cannot connect to '${n}' - server may be down or URL incorrect`:d=`Connection failed for '${n}': ${t}`,process.env.SANDBOX&&(d+=" (check sandbox availability)"),new Error(d)}}}async function esr(n,e,r){if(e.authProviderType===Zoe.GOOGLE_CREDENTIALS)throw new Error("Google credentials authentication is no longer supported. Use Cheeth OA authentication.");let a=null,i=e.oauth?.enabled;if(i&&e.oauth){if(a=await Gv.getValidToken(n,e.oauth),!a)throw console.error(`MCP server '${n}' requires OAuth authentication. Please authenticate using the /mcp auth command.`),new Error(`MCP server '${n}' requires OAuth authentication. Please authenticate using the /mcp auth command.`)}else{let s=await L0.getToken(n);s&&(a=await Gv.getValidToken(n,{clientId:s.clientId}),a&&(i=!0,console.log(`Found stored OAuth token for server '${n}'`)))}if(e.httpUrl){let s={};return i&&a?s.requestInit={headers:{...e.headers,Authorization:`Bearer ${a}`}}:e.headers&&(s.requestInit={headers:e.headers}),new zL(new URL(e.httpUrl),s)}if(e.url){let s={};return i&&a?s.requestInit={headers:{...e.headers,Authorization:`Bearer ${a}`}}:e.headers&&(s.requestInit={headers:e.headers}),new hoe(new URL(e.url),s)}if(e.command){let s=new BWe({command:e.command,args:e.args||[],env:{...process.env,...e.env||{}},cwd:e.cwd,stderr:"pipe"});return r&&s.stderr.on("data",t=>{let o=t.toString().trim();console.debug(`[DEBUG] [MCP STDERR (${n})]: `,o)}),s}throw new Error("Invalid configuration: missing httpUrl (for Streamable HTTP), url (for SSE), and command (for stdio).")}function tsr(n,e,r){if(!n.name)return console.warn(`Discovered a function declaration without a name from MCP server '${e}'. Skipping.`),!1;let{includeTools:a,excludeTools:i}=r;return i&&i.includes(n.name)?!1:!a||a.some(s=>s===n.name||s.startsWith(`${n.name}(`))}var Tir,B7,Bir,Ad,gI,nat,uFe,aat,Dir,dFe,IFe,hFe,sat,mFe,boe,oat,cFe,gFe=He(()=>{"use strict";nnt();rnt();war();_ar();Xnt();fx();Tir=kt(S7(),1);$I();jWe();Bn();eat();rFe();tFe();Yl();iFe();Xir();Lir();B7=600*1e3,Bir=30*1e3;(function(n){n.DISCONNECTED="disconnected",n.CONNECTING="connecting",n.CONNECTED="connected"})(Ad||(Ad={}));(function(n){n.NOT_STARTED="not_started",n.IN_PROGRESS="in_progress",n.COMPLETED="completed"})(gI||(gI={}));nat=class{ajvValidator=new R7;getValidator(e){try{let r=this.ajvValidator.getValidator(e);return a=>{let i=r(a);return i.valid?i:(console.warn(`MCP validation warning: ${i.errorMessage}. Proceeding anyway. Schema: ${JSON.stringify(e).slice(0,100)}...`),{valid:!0,data:a,errorMessage:void 0})}}catch(r){return console.warn(`Failed to compile MCP tool output schema (${e?.$id??"<no $id>"}): ${r instanceof Error?r.message:String(r)}. Skipping output validation for this tool.`),a=>({valid:!0,data:a,errorMessage:void 0})}}},uFe=new Map,aat=gI.NOT_STARTED,Dir=!1;dFe=new Map,IFe=new Map,hFe=new Map,sat=new Map,mFe=new Map,boe=new Map,oat=new Map;cFe=[]});function rE(n){if(vv[n])return vv[n];let e=n.toLowerCase();return e.includes("gemini-3")&&e.includes("flash")?vv["gemini-3.1-flash-lite"]:e.includes("gemini-3")&&e.includes("pro")?vv["gemini-3-pro-preview"]:e.includes("gemini")&&e.includes("2.5")&&e.includes("flash")?vv["gemini-2.5-flash"]:e.includes("gemini")&&e.includes("2.5")&&e.includes("pro")?vv["gemini-2.5-pro"]:e.includes("flash")?e.includes("8b")?vv["gemini-1.5-flash-8b"]:vv["gemini-1.5-flash"]:e.includes("gemini")&&e.includes("pro")?vv["gemini-1.5-pro"]:e.includes("claude")&&e.includes("opus")?vv["claude-opus-4@20250514"]:e.includes("claude")&&e.includes("haiku")?vv["claude-haiku-4-5@20251001"]:e.includes("claude")?vv["claude-3-5-sonnet-20241022"]:rsr}function Sqn(n){let e=rE(n);return e.toolCallReliability==="low"||e.needsFormatTolerance===!0}function GFe(n){return rE(n).needsFormatTolerance}var rsr,vv,Noe=He(()=>{"use strict";rsr={toolCallReliability:"medium",requiresStrictValidation:!0,maxConcurrentTools:3,needsFormatTolerance:!1,proneToIncompleteStream:!1,enableMalformedRetry:!1,functionCallTimeout:3e4,enableProgressiveDegradation:!1},vv={"claude-opus-4@20250514":{toolCallReliability:"high",requiresStrictValidation:!0,maxConcurrentTools:6,needsFormatTolerance:!1,proneToIncompleteStream:!1,enableMalformedRetry:!1,functionCallTimeout:3e4,enableProgressiveDegradation:!1},"claude-sonnet-4@20250514":{toolCallReliability:"high",requiresStrictValidation:!0,maxConcurrentTools:5,needsFormatTolerance:!1,proneToIncompleteStream:!1,enableMalformedRetry:!1,functionCallTimeout:3e4,enableProgressiveDegradation:!1},"claude-3-5-sonnet-20241022":{toolCallReliability:"high",requiresStrictValidation:!0,maxConcurrentTools:5,needsFormatTolerance:!1,proneToIncompleteStream:!1,enableMalformedRetry:!1,functionCallTimeout:3e4,enableProgressiveDegradation:!1},"claude-haiku-4-5@20251001":{toolCallReliability:"high",requiresStrictValidation:!0,maxConcurrentTools:4,needsFormatTolerance:!1,proneToIncompleteStream:!1,enableMalformedRetry:!1,functionCallTimeout:3e4,enableProgressiveDegradation:!1},"gemini-3-pro-preview":{toolCallReliability:"high",requiresStrictValidation:!0,maxConcurrentTools:5,needsFormatTolerance:!1,proneToIncompleteStream:!1,enableMalformedRetry:!1,functionCallTimeout:3e4,enableProgressiveDegradation:!1},"gemini-3.1-flash-lite":{toolCallReliability:"medium",requiresStrictValidation:!1,maxConcurrentTools:3,needsFormatTolerance:!0,proneToIncompleteStream:!1,enableMalformedRetry:!0,functionCallTimeout:45e3,enableProgressiveDegradation:!0},"gemini-2.5-pro":{toolCallReliability:"high",requiresStrictValidation:!0,maxConcurrentTools:4,needsFormatTolerance:!1,proneToIncompleteStream:!1,enableMalformedRetry:!1,functionCallTimeout:3e4,enableProgressiveDegradation:!1},"gemini-1.5-pro":{toolCallReliability:"high",requiresStrictValidation:!0,maxConcurrentTools:4,needsFormatTolerance:!1,proneToIncompleteStream:!1,enableMalformedRetry:!1,functionCallTimeout:3e4,enableProgressiveDegradation:!1},"gemini-2.5-flash":{toolCallReliability:"medium",requiresStrictValidation:!1,maxConcurrentTools:3,needsFormatTolerance:!0,proneToIncompleteStream:!1,enableMalformedRetry:!0,functionCallTimeout:45e3,enableProgressiveDegradation:!0},"gemini-1.5-flash":{toolCallReliability:"medium",requiresStrictValidation:!1,maxConcurrentTools:2,needsFormatTolerance:!0,proneToIncompleteStream:!0,enableMalformedRetry:!0,functionCallTimeout:45e3,enableProgressiveDegradation:!0},"gemini-flash":{toolCallReliability:"medium",requiresStrictValidation:!1,maxConcurrentTools:1,needsFormatTolerance:!0,proneToIncompleteStream:!0,enableMalformedRetry:!0,functionCallTimeout:6e4,enableProgressiveDegradation:!0},"gemini-1.5-flash-8b":{toolCallReliability:"low",requiresStrictValidation:!1,maxConcurrentTools:1,needsFormatTolerance:!0,proneToIncompleteStream:!0,enableMalformedRetry:!0,functionCallTimeout:6e4,enableProgressiveDegradation:!0},auto:{toolCallReliability:"medium",requiresStrictValidation:!1,maxConcurrentTools:2,needsFormatTolerance:!0,proneToIncompleteStream:!0,enableMalformedRetry:!0,functionCallTimeout:45e3,enableProgressiveDegradation:!0}}});import{spawn as isr}from"node:child_process";import{StringDecoder as nsr}from"node:string_decoder";import{createHash as asr}from"node:crypto";function lsr(n){if(!n||n.length===0)return{name:"",wasModified:!1,usedHash:!1};if(osr.test(n))return{name:n,wasModified:!1,usedHash:!1};if(/[^\x00-\x7F]/.test(n))return{name:`tool_${asr("md5").update(n).digest("hex").substring(0,16)}`,wasModified:!0,usedHash:!0};let r=n.replace(/[^a-zA-Z0-9_-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"");return r.length===0?{name:`tool_${asr("md5").update(n).digest("hex").substring(0,16)}`,wasModified:!0,usedHash:!0}:(r.length>128&&(r=r.substring(0,128)),{name:r,wasModified:!0,usedHash:!1})}function Iat(n,e=!1){vFe(n,new Set,e)}function vFe(n,e,r=!1){if(!(!n||e.has(n))){if(e.add(n),n.anyOf){n.default=void 0;for(let a of n.anyOf)typeof a!="boolean"&&vFe(a,e,r)}if(n.items&&typeof n.items!="boolean"&&vFe(n.items,e,r),n.properties)for(let a of Object.values(n.properties))typeof a!="boolean"&&vFe(a,e,r);if(r&&(n.required&&Array.isArray(n.required)&&(n.required=n.required.filter(a=>["name","id","path","pattern","content"].includes(a))),n.type&&n.properties)){let a=n;a.additionalProperties===!1&&(a.additionalProperties=!0)}n.enum&&Array.isArray(n.enum)&&(n.type!==It.STRING&&(n.type=It.STRING),n.enum=n.enum.filter(a=>a!=null).map(a=>String(a)),r&&n.enum.length===0&&(n.enum=void 0)),n.type===It.STRING&&n.format&&n.format!=="enum"&&n.format!=="date-time"&&(n.format=void 0),r&&(n.type===It.STRING&&!n.default&&n.enum,n.type===It.BOOLEAN&&n.default===void 0&&(n.default=!1),n.type===It.NUMBER&&n.default===void 0&&(n.default=0))}}var ssr,osr,O7,QF,U7=He(()=>{"use strict";Bn();na();gFe();jWe();ssr=kt(S7(),1);Noe();osr=/^[a-zA-Z0-9_-]{1,128}$/;O7=class extends Ar{config;description;parameterSchema;constructor(e,r,a,i){let s=e.getToolDiscoveryCommand(),t=e.getToolCallCommand();a+=`
|
|
489
|
+
${t}`,s,{type:It.OBJECT,properties:{action:{type:It.STRING,enum:["call","list","describe"],description:`What to do: "call" (default) invokes a tool, "describe" returns a tool's JSON schema, "list" re-lists the catalog.`},tool:{type:It.STRING,description:'Target tool name. Required for "call" and "describe".'},args:{type:It.OBJECT,description:"Arguments object forwarded verbatim to the target tool."}},required:[]},!0,!1);for(let o of i)this.byName.set(o.toolName,o)}toolNames(){return[...this.byName.keys()]}get size(){return this.byName.size}member(e){return this.byName.get(e)}validateToolParams(e){let r=e?.action??"call";if(r!=="call"&&r!=="list"&&r!=="describe")return`Unknown action "${String(r)}". Use "call", "describe" or "list".`;if(r!=="list"){if(!e?.tool||typeof e.tool!="string")return`Parameter "tool" is required for action "${r}".`;if(!this.byName.has(e.tool))return`Unknown tool "${e.tool}" in "${this.name}". Available: ${this.toolNames().join(", ")}`}return null}getDescription(e){let r=e?.action??"call";return r==="list"?`List tools of ${this.name}`:r==="describe"?`Describe ${e?.tool}`:`${e?.tool??"?"}`}async shouldConfirmExecute(e,r){if((e?.action??"call")!=="call")return!1;let i=e?.tool?this.byName.get(e.tool):void 0;return i?i.shouldConfirmExecute(e.args??{},r):!1}async execute(e,r,a){let i=this.validateToolParams(e);if(i)return{llmContent:`Error: ${i}`,returnDisplay:i};let s=e.action??"call";if(s==="list"){let o=[...this.byName.values()].map(d=>({tool:d.toolName,summary:Hir(d.description)}));return{llmContent:JSON.stringify({namespace:this.name,tools:o}),returnDisplay:`${this.name}: ${o.length} tools`,summary:`${o.length} tools`}}let t=this.byName.get(e.tool);return s==="describe"?{llmContent:JSON.stringify({namespace:this.name,tool:t.toolName,description:t.description,parameters:t.parameterSchema??{type:"object",properties:{}}}),returnDisplay:`Schema of ${t.toolName}`,summary:t.toolName}:t.execute(e.args??{},r,a)}}});function rat(n){return`mcp__${n.replace(/[^A-Za-z0-9_.-]/g,"_").replace(/^_+|_+$/g,"")||"server"}`}function Fqn(n){return{toolName:n.serverToolName,description:n.description,parameterSchema:n.parameterSchemaJson,execute:(e,r,a)=>n.execute(e,r,a),shouldConfirmExecute:(e,r)=>n.shouldConfirmExecute(e,r)}}var oFe,Xir=He(()=>{"use strict";foe();oFe=class extends jL{serverName;constructor(e,r){super(rat(e),`${e} (MCP)`,`Gateway to the ${r.length} tools of the "${e}" MCP server.`,r.map(Fqn)),this.serverName=e}}});function wqn(n=process.env){let e=n.EASYCODE_MCP_NAMESPACE_THRESHOLD;if(e===void 0)return 8;let r=Number.parseInt(e,10);return!Number.isFinite(r)||r<0?8:r}function Sir(n,e,r=process.env){return n<=1||e==="direct"?!1:e==="namespace"?!0:n>wqn(r)}var Lir=He(()=>{"use strict";});async function Rqn(n,e,r){let a,i=new Promise((s,t)=>{a=setTimeout(()=>{t(new Error(`Connection to '${r}' timed out after ${e}ms`))},e)});try{let s=await Promise.race([n,i]);return a&&clearTimeout(a),s}catch(s){throw a&&clearTimeout(a),s}}function goe(){return Dir}function iat(){Dir=!0}function Oir(n,e,r){IFe.set(n,e),r&&hFe.set(n,r)}function Eqn(n){return IFe.get(n)??0}function Aqn(){return new Map(IFe)}function xqn(n){return hFe.get(n)??[]}function Cqn(){return new Map(hFe)}function lat(n,e,r,a){if(r.length===0)return 0;if(Sir(r.length,a))return n.registerTool(new oFe(e,r)),console.log(`[MCP] Server '${e}': ${r.length} tools exposed via namespace tool '${rat(e)}' (1 declaration instead of ${r.length})`),1;for(let i of r)n.registerTool(i);return r.length}function Uir(n,e,r){mFe.set(n,e),sat.set(n,r)}function Mir(n){mFe.delete(n),sat.delete(n)}function pFe(n){let e=0;for(let[r,a]of mFe.entries()){let i=a.map(s=>s.clone());e+=lat(n,r,i,sat.get(r))}return e}function fFe(n){let e=0;for(let[r,a]of oat.entries())n.setResourcesForServer(r,a),e+=a.length;return e}async function Goe(n,e,r,a){let i=boe.get(n);if(i){try{await i.close()}catch(s){console.warn(`Error closing MCP client '${n}':`,s)}boe.delete(n)}e.removeMcpToolsByServer(n),r.removePromptsByServer(n),a.removeResourcesByServer(n),Mir(n),oat.delete(n),uFe.delete(n),IFe.delete(n),hFe.delete(n),console.log(`[MCP] Successfully unloaded server: ${n}`)}function bFe(){return mFe.size>0}async function voe(n=3e4){if(Vg()===gI.COMPLETED)return!0;if(Vg()===gI.NOT_STARTED)return!1;let e=100,r=0;for(;r<n;)if(await new Promise(a=>setTimeout(a,e)),r+=e,Vg()===gI.COMPLETED)return!0;return console.warn(`[MCP] waitForMCPDiscoveryComplete timed out after ${n}ms`),!1}function cat(n){cFe.push(n)}function uat(n){let e=cFe.indexOf(n);e!==-1&&cFe.splice(e,1)}function lFe(n,e){uFe.set(n,e);for(let r of cFe)r(n,e)}function D7(n){return uFe.get(n)||Ad.DISCONNECTED}function dat(){return new Map(uFe)}function Vg(){return aat}function Yqn(n){let e=[/www-authenticate:\s*([^\n\r]+)/i,/WWW-Authenticate:\s*([^\n\r]+)/i,/"www-authenticate":\s*"([^"]+)"/i,/'www-authenticate':\s*'([^']+)'/i];for(let r of e){let a=n.match(r);if(a)return a[1].trim()}return null}async function Vqn(n,e,r){try{console.log(`\u{1F510} '${n}' requires OAuth authentication`);let a,i=Hm.parseWWWAuthenticateHeader(r);if(i)a=await Hm.discoverOAuthConfig(i);else if(e.url){let t=new URL(e.url),o=`${t.protocol}//${t.host}`;a=await Hm.discoverOAuthConfig(o)}else if(e.httpUrl){let t=new URL(e.httpUrl),o=`${t.protocol}//${t.host}`;a=await Hm.discoverOAuthConfig(o)}if(!a)return console.error(`\u274C Could not configure OAuth for '${n}' - please authenticate manually with /mcp auth ${n}`),!1;let s={enabled:!0,authorizationUrl:a.authorizationUrl,tokenUrl:a.tokenUrl,scopes:a.scopes||[]};return console.log(`Starting OAuth authentication for server '${n}'...`),await Gv.authenticate(n,s),console.log(`OAuth authentication successful for server '${n}'`),!0}catch(a){return console.error(`Failed to handle automatic OAuth for server '${n}': ${kr(a)}`),!1}}async function Jir(n,e,r){try{if(e.httpUrl){let a={requestInit:{headers:{...e.headers,Authorization:`Bearer ${r}`}}};return new zL(new URL(e.httpUrl),a)}else if(e.url)return new hoe(new URL(e.url),{requestInit:{headers:{...e.headers,Authorization:`Bearer ${r}`}}});return null}catch(a){return console.error(`Failed to create OAuth transport for server '${n}': ${kr(a)}`),null}}async function yoe(n,e,r,a,i,s){aat=gI.IN_PROGRESS;try{n=zir(n,e);for(let[t,o]of Object.entries(n))await new Promise(d=>setImmediate(d)),await _ir(t,o,r,a,i,s)}finally{aat=gI.COMPLETED}}function zir(n,e){if(e){let r=e,a=(0,Tir.parse)(r,process.env);if(a.some(i=>typeof i!="string"))throw new Error("failed to parse mcpServerCommand: "+r);n.mcp={command:a[0],args:a.slice(1)}}return n}async function _ir(n,e,r,a,i,s){lFe(n,Ad.CONNECTING);try{let t=await $ir(n,e,s);try{t.onerror=u=>{console.error(`MCP ERROR (${n}):`,u.toString()),lFe(n,Ad.DISCONNECTED)},await qir(n,t,a);let o=await Pir(n,t);i.setResourcesForServer(n,o),oat.set(n,o);let d=await jir(n,e,t);lat(r,n,d,e.toolExposure),boe.set(n,t),Uir(n,d,e.toolExposure);let I=d.map(u=>u.name);Oir(n,d.length,I),lFe(n,Ad.CONNECTED)}catch(o){throw t.close(),o}}catch(t){aFe()||console.error(`Error connecting to MCP server '${n}': ${kr(t)}`),lFe(n,Ad.DISCONNECTED)}}async function Pir(n,e){try{return e.getServerCapabilities()?.resources==null?[]:await kqn(n,e)}catch(r){return r instanceof Error&&!r.message?.includes("Method not found")&&console.error(`Error discovering resources from ${n}: ${kr(r)}`),[]}}async function kqn(n,e){let r=[],a;try{do{let i=await e.request({method:"resources/list",params:a?{cursor:a}:{}},fse);r.push(...i.resources??[]),a=i.nextCursor??void 0}while(a)}catch(i){if(i instanceof Error&&i.message?.includes("Method not found"))return[];throw console.error(`Error listing resources from ${n}: ${kr(i)}`),i}return r}async function Qqn(n,e){return n.request({method:"resources/read",params:{uri:e}},bse)}async function jir(n,e,r){try{if(r.getServerCapabilities()?.tools==null)return[];let a=nBt(r),i=await a.tool();if(!Array.isArray(i.functionDeclarations))throw new Error("Server did not return valid function declarations.");let s=[];for(let t of i.functionDeclarations)tsr(t,n,e)&&s.push(new ZG(a,n,t.name,t.description??"",t.parametersJsonSchema??{type:"object",properties:{}},e.timeout??B7,e.trust));return s}catch(a){return a instanceof Error&&!a.message?.includes("Method not found")&&console.error(`Error discovering tools from ${n}: ${kr(a)}`),[]}}async function qir(n,e,r){try{let a=await e.request({method:"prompts/list",params:{}},gse);for(let i of a.prompts)r.registerPrompt({...i,serverName:n,invoke:s=>Kir(n,e,i.name,s)})}catch(a){a instanceof Error&&!a.message?.includes("Method not found")&&console.error(`Error discovering prompts from ${n}: ${kr(a)}`)}}async function Kir(n,e,r,a){boe.has(n);try{return await e.request({method:"prompts/get",params:{name:r,arguments:a}},Gse)}catch(i){throw i instanceof Error&&!i.message?.includes("Method not found")&&console.error(`Error invoking prompt '${r}' from ${n} ${a}: ${kr(i)}`),i}}function Hqn(n){return boe.get(n)}async function $ir(n,e,r,a=Bir){return await Rqn(Xqn(n,e,r),a,n)}async function Xqn(n,e,r){let a=new E7({name:"dvcode-cli-mcp-client",version:"1.0.0"},{jsonSchemaValidator:new nat});if("callTool"in a){let i=a.callTool.bind(a);a.callTool=function(s,t,o){return i(s,t,{...o,timeout:e.timeout??B7})}}try{let i=await esr(n,e,r);try{r&&console.log(`MCP Client: Connecting to ${n}...`);try{return await a.connect(i,{timeout:e.timeout??B7}),r&&console.log(`MCP Client: Connected to ${n} \u2713`),a}catch(s){throw r&&console.log(`MCP Client: Failed to connect to ${n} \u2717`),s}}catch(s){throw await i.close(),s}}catch(i){let s=String(i);if(s.includes("401")&&(e.httpUrl||e.url)){if(dFe.set(n,!0),!(e.httpUrl||e.oauth?.enabled)){let d=await L0.getToken(n);if(d){let I=await Gv.getValidToken(n,{clientId:d.clientId});console.log(I?`Stored OAuth token for SSE server '${n}' was rejected. Please re-authenticate using: /mcp auth ${n}`:`401 error received for SSE server '${n}' without OAuth configuration. Please authenticate using: /mcp auth ${n}`)}throw new Error(`401 error received for SSE server '${n}' without OAuth configuration. Please authenticate using: /mcp auth ${n}`)}let o=Yqn(s);if(!o&&e.url){console.log("No www-authenticate header in error, trying to fetch it from server...");try{let d=await fetch(e.url,{method:"HEAD",headers:{Accept:"text/event-stream"},signal:AbortSignal.timeout(5e3)});d.status===401&&(o=d.headers.get("www-authenticate"),o&&console.log(`Found www-authenticate header from server: ${o}`))}catch(d){console.debug(`Failed to fetch www-authenticate header: ${kr(d)}`)}}if(o)if(console.log(`Received 401 with www-authenticate header: ${o}`),await Vqn(n,e,o)){console.log(`Retrying connection to '${n}' with OAuth token...`);let I=await L0.getToken(n);if(I){let u=await Gv.getValidToken(n,{clientId:I.clientId});if(u){let h=await Jir(n,e,u);if(h)try{return await a.connect(h,{timeout:e.timeout??B7}),a}catch(c){throw console.error(`Failed to connect with OAuth token: ${kr(c)}`),c}else throw console.error(`Failed to create OAuth transport for server '${n}'`),new Error(`Failed to create OAuth transport for server '${n}'`)}else throw console.error(`Failed to get OAuth token for server '${n}'`),new Error(`Failed to get OAuth token for server '${n}'`)}else throw console.error(`Failed to get credentials for server '${n}' after successful OAuth authentication`),new Error(`Failed to get credentials for server '${n}' after successful OAuth authentication`)}else throw console.error(`Failed to handle automatic OAuth for server '${n}'`),new Error(`Failed to handle automatic OAuth for server '${n}'`);else{if(!(e.httpUrl||e.oauth?.enabled)){let I=await L0.getToken(n);if(I){let u=await Gv.getValidToken(n,{clientId:I.clientId});console.log(u?`Stored OAuth token for SSE server '${n}' was rejected. Please re-authenticate using: /mcp auth ${n}`:`401 error received for SSE server '${n}' without OAuth configuration. Please authenticate using: /mcp auth ${n}`)}throw new Error(`401 error received for SSE server '${n}' without OAuth configuration. Please authenticate using: /mcp auth ${n}`)}if(console.log(`\u{1F50D} Attempting OAuth discovery for '${n}'...`),e.url){let I=new URL(e.url),u=`${I.protocol}//${I.host}`;try{let h=await Hm.discoverOAuthConfig(u);if(h){console.log(`Discovered OAuth configuration from base URL for server '${n}'`);let c={enabled:!0,authorizationUrl:h.authorizationUrl,tokenUrl:h.tokenUrl,scopes:h.scopes||[]};console.log(`Starting OAuth authentication for server '${n}'...`),await Gv.authenticate(n,c);let m=await L0.getToken(n);if(m){let v=await Gv.getValidToken(n,{clientId:m.clientId});if(v){let f=await Jir(n,e,v);if(f)try{return await a.connect(f,{timeout:e.timeout??B7}),a}catch(Z){throw console.error(`Failed to connect with OAuth token: ${kr(Z)}`),Z}else throw console.error(`Failed to create OAuth transport for server '${n}'`),new Error(`Failed to create OAuth transport for server '${n}'`)}else throw console.error(`Failed to get OAuth token for server '${n}'`),new Error(`Failed to get OAuth token for server '${n}'`)}else throw console.error(`Failed to get stored credentials for server '${n}'`),new Error(`Failed to get stored credentials for server '${n}'`)}else throw console.error(`\u274C Could not configure OAuth for '${n}' - please authenticate manually with /mcp auth ${n}`),new Error(`OAuth configuration failed for '${n}'. Please authenticate manually with /mcp auth ${n}`)}catch(h){throw console.error(`\u274C OAuth discovery failed for '${n}' - please authenticate manually with /mcp auth ${n}`),h}}else throw console.error(`\u274C '${n}' requires authentication but no OAuth configuration found`),new Error(`MCP server '${n}' requires authentication. Please configure OAuth or check server settings.`)}}else{let t=i.message||String(i),o=t.includes("ENOTFOUND")||t.includes("ECONNREFUSED"),d;throw o?d=`Cannot connect to '${n}' - server may be down or URL incorrect`:d=`Connection failed for '${n}': ${t}`,process.env.SANDBOX&&(d+=" (check sandbox availability)"),new Error(d)}}}async function esr(n,e,r){if(e.authProviderType===Zoe.GOOGLE_CREDENTIALS)throw new Error("Google credentials authentication is no longer supported. Use Cheeth OA authentication.");let a=null,i=e.oauth?.enabled;if(i&&e.oauth){if(a=await Gv.getValidToken(n,e.oauth),!a)throw console.error(`MCP server '${n}' requires OAuth authentication. Please authenticate using the /mcp auth command.`),new Error(`MCP server '${n}' requires OAuth authentication. Please authenticate using the /mcp auth command.`)}else{let s=await L0.getToken(n);s&&(a=await Gv.getValidToken(n,{clientId:s.clientId}),a&&(i=!0,console.log(`Found stored OAuth token for server '${n}'`)))}if(e.httpUrl){let s={};return i&&a?s.requestInit={headers:{...e.headers,Authorization:`Bearer ${a}`}}:e.headers&&(s.requestInit={headers:e.headers}),new zL(new URL(e.httpUrl),s)}if(e.url){let s={};return i&&a?s.requestInit={headers:{...e.headers,Authorization:`Bearer ${a}`}}:e.headers&&(s.requestInit={headers:e.headers}),new hoe(new URL(e.url),s)}if(e.command){let s=new BWe({command:e.command,args:e.args||[],env:{...process.env,...e.env||{}},cwd:e.cwd,stderr:"pipe"});return r&&s.stderr.on("data",t=>{let o=t.toString().trim();console.debug(`[DEBUG] [MCP STDERR (${n})]: `,o)}),s}throw new Error("Invalid configuration: missing httpUrl (for Streamable HTTP), url (for SSE), and command (for stdio).")}function tsr(n,e,r){if(!n.name)return console.warn(`Discovered a function declaration without a name from MCP server '${e}'. Skipping.`),!1;let{includeTools:a,excludeTools:i}=r;return i&&i.includes(n.name)?!1:!a||a.some(s=>s===n.name||s.startsWith(`${n.name}(`))}var Tir,B7,Bir,Ad,gI,nat,uFe,aat,Dir,dFe,IFe,hFe,sat,mFe,boe,oat,cFe,gFe=He(()=>{"use strict";nnt();rnt();war();_ar();Xnt();fx();Tir=kt(S7(),1);$I();jWe();Bn();eat();rFe();tFe();Yl();iFe();Xir();Lir();B7=600*1e3,Bir=30*1e3;(function(n){n.DISCONNECTED="disconnected",n.CONNECTING="connecting",n.CONNECTED="connected"})(Ad||(Ad={}));(function(n){n.NOT_STARTED="not_started",n.IN_PROGRESS="in_progress",n.COMPLETED="completed"})(gI||(gI={}));nat=class{ajvValidator=new R7;getValidator(e){try{let r=this.ajvValidator.getValidator(e);return a=>{let i=r(a);return i.valid?i:(console.warn(`MCP validation warning: ${i.errorMessage}. Proceeding anyway. Schema: ${JSON.stringify(e).slice(0,100)}...`),{valid:!0,data:a,errorMessage:void 0})}}catch(r){return console.warn(`Failed to compile MCP tool output schema (${e?.$id??"<no $id>"}): ${r instanceof Error?r.message:String(r)}. Skipping output validation for this tool.`),a=>({valid:!0,data:a,errorMessage:void 0})}}},uFe=new Map,aat=gI.NOT_STARTED,Dir=!1;dFe=new Map,IFe=new Map,hFe=new Map,sat=new Map,mFe=new Map,boe=new Map,oat=new Map;cFe=[]});function rE(n){if(vv[n])return vv[n];let e=n.toLowerCase();return e.includes("gemini-3")&&e.includes("flash")?vv["gemini-3.1-flash-lite"]:e.includes("gemini-3")&&e.includes("pro")?vv["gemini-3-pro-preview"]:e.includes("gemini")&&e.includes("2.5")&&e.includes("flash")?vv["gemini-2.5-flash"]:e.includes("gemini")&&e.includes("2.5")&&e.includes("pro")?vv["gemini-2.5-pro"]:e.includes("gemini")&&e.includes("flash")?e.includes("8b")?vv["gemini-1.5-flash-8b"]:vv["gemini-1.5-flash"]:e.includes("gemini")&&e.includes("pro")?vv["gemini-1.5-pro"]:e.includes("claude")&&e.includes("opus")?vv["claude-opus-4@20250514"]:e.includes("claude")&&e.includes("haiku")?vv["claude-haiku-4-5@20251001"]:e.includes("claude")?vv["claude-3-5-sonnet-20241022"]:rsr}function Sqn(n){let e=rE(n);return e.toolCallReliability==="low"||e.needsFormatTolerance===!0}function GFe(n){return rE(n).needsFormatTolerance}var rsr,vv,Noe=He(()=>{"use strict";rsr={toolCallReliability:"medium",requiresStrictValidation:!0,maxConcurrentTools:3,needsFormatTolerance:!1,proneToIncompleteStream:!1,enableMalformedRetry:!1,functionCallTimeout:3e4,enableProgressiveDegradation:!1},vv={"claude-opus-4@20250514":{toolCallReliability:"high",requiresStrictValidation:!0,maxConcurrentTools:6,needsFormatTolerance:!1,proneToIncompleteStream:!1,enableMalformedRetry:!1,functionCallTimeout:3e4,enableProgressiveDegradation:!1},"claude-sonnet-4@20250514":{toolCallReliability:"high",requiresStrictValidation:!0,maxConcurrentTools:5,needsFormatTolerance:!1,proneToIncompleteStream:!1,enableMalformedRetry:!1,functionCallTimeout:3e4,enableProgressiveDegradation:!1},"claude-3-5-sonnet-20241022":{toolCallReliability:"high",requiresStrictValidation:!0,maxConcurrentTools:5,needsFormatTolerance:!1,proneToIncompleteStream:!1,enableMalformedRetry:!1,functionCallTimeout:3e4,enableProgressiveDegradation:!1},"claude-haiku-4-5@20251001":{toolCallReliability:"high",requiresStrictValidation:!0,maxConcurrentTools:4,needsFormatTolerance:!1,proneToIncompleteStream:!1,enableMalformedRetry:!1,functionCallTimeout:3e4,enableProgressiveDegradation:!1},"gemini-3-pro-preview":{toolCallReliability:"high",requiresStrictValidation:!0,maxConcurrentTools:5,needsFormatTolerance:!1,proneToIncompleteStream:!1,enableMalformedRetry:!1,functionCallTimeout:3e4,enableProgressiveDegradation:!1},"gemini-3.1-flash-lite":{toolCallReliability:"medium",requiresStrictValidation:!1,maxConcurrentTools:3,needsFormatTolerance:!0,proneToIncompleteStream:!1,enableMalformedRetry:!0,functionCallTimeout:45e3,enableProgressiveDegradation:!0},"gemini-2.5-pro":{toolCallReliability:"high",requiresStrictValidation:!0,maxConcurrentTools:4,needsFormatTolerance:!1,proneToIncompleteStream:!1,enableMalformedRetry:!1,functionCallTimeout:3e4,enableProgressiveDegradation:!1},"gemini-1.5-pro":{toolCallReliability:"high",requiresStrictValidation:!0,maxConcurrentTools:4,needsFormatTolerance:!1,proneToIncompleteStream:!1,enableMalformedRetry:!1,functionCallTimeout:3e4,enableProgressiveDegradation:!1},"gemini-2.5-flash":{toolCallReliability:"medium",requiresStrictValidation:!1,maxConcurrentTools:3,needsFormatTolerance:!0,proneToIncompleteStream:!1,enableMalformedRetry:!0,functionCallTimeout:45e3,enableProgressiveDegradation:!0},"gemini-1.5-flash":{toolCallReliability:"medium",requiresStrictValidation:!1,maxConcurrentTools:2,needsFormatTolerance:!0,proneToIncompleteStream:!0,enableMalformedRetry:!0,functionCallTimeout:45e3,enableProgressiveDegradation:!0},"gemini-flash":{toolCallReliability:"medium",requiresStrictValidation:!1,maxConcurrentTools:1,needsFormatTolerance:!0,proneToIncompleteStream:!0,enableMalformedRetry:!0,functionCallTimeout:6e4,enableProgressiveDegradation:!0},"gemini-1.5-flash-8b":{toolCallReliability:"low",requiresStrictValidation:!1,maxConcurrentTools:1,needsFormatTolerance:!0,proneToIncompleteStream:!0,enableMalformedRetry:!0,functionCallTimeout:6e4,enableProgressiveDegradation:!0},auto:{toolCallReliability:"medium",requiresStrictValidation:!1,maxConcurrentTools:2,needsFormatTolerance:!0,proneToIncompleteStream:!0,enableMalformedRetry:!0,functionCallTimeout:45e3,enableProgressiveDegradation:!0}}});import{spawn as isr}from"node:child_process";import{StringDecoder as nsr}from"node:string_decoder";import{createHash as asr}from"node:crypto";function lsr(n){if(!n||n.length===0)return{name:"",wasModified:!1,usedHash:!1};if(osr.test(n))return{name:n,wasModified:!1,usedHash:!1};if(/[^\x00-\x7F]/.test(n))return{name:`tool_${asr("md5").update(n).digest("hex").substring(0,16)}`,wasModified:!0,usedHash:!0};let r=n.replace(/[^a-zA-Z0-9_-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"");return r.length===0?{name:`tool_${asr("md5").update(n).digest("hex").substring(0,16)}`,wasModified:!0,usedHash:!0}:(r.length>128&&(r=r.substring(0,128)),{name:r,wasModified:!0,usedHash:!1})}function Iat(n,e=!1){vFe(n,new Set,e)}function vFe(n,e,r=!1){if(!(!n||e.has(n))){if(e.add(n),n.anyOf){n.default=void 0;for(let a of n.anyOf)typeof a!="boolean"&&vFe(a,e,r)}if(n.items&&typeof n.items!="boolean"&&vFe(n.items,e,r),n.properties)for(let a of Object.values(n.properties))typeof a!="boolean"&&vFe(a,e,r);if(r&&(n.required&&Array.isArray(n.required)&&(n.required=n.required.filter(a=>["name","id","path","pattern","content"].includes(a))),n.type&&n.properties)){let a=n;a.additionalProperties===!1&&(a.additionalProperties=!0)}n.enum&&Array.isArray(n.enum)&&(n.type!==It.STRING&&(n.type=It.STRING),n.enum=n.enum.filter(a=>a!=null).map(a=>String(a)),r&&n.enum.length===0&&(n.enum=void 0)),n.type===It.STRING&&n.format&&n.format!=="enum"&&n.format!=="date-time"&&(n.format=void 0),r&&(n.type===It.STRING&&!n.default&&n.enum,n.type===It.BOOLEAN&&n.default===void 0&&(n.default=!1),n.type===It.NUMBER&&n.default===void 0&&(n.default=0))}}var ssr,osr,O7,QF,U7=He(()=>{"use strict";Bn();na();gFe();jWe();ssr=kt(S7(),1);Noe();osr=/^[a-zA-Z0-9_-]{1,128}$/;O7=class extends Ar{config;description;parameterSchema;constructor(e,r,a,i){let s=e.getToolDiscoveryCommand(),t=e.getToolCallCommand();a+=`
|
|
490
490
|
|
|
491
491
|
This tool was discovered from the project by executing the command \`${s}\` on project root.
|
|
492
492
|
When called, this tool will execute the command \`${t} ${r}\` on project root.
|
|
@@ -4253,7 +4253,7 @@ If you extracted the public API surface of the code, pass public_exports and doc
|
|
|
4253
4253
|
|
|
4254
4254
|
Call this before telling the user the document is finished, and whenever you need to decide what to work on next.
|
|
4255
4255
|
|
|
4256
|
-
The counts come from the ledger, not from your own impression of the work. If it reports unconfirmed assumptions, the document is not done, regardless of how complete the prose looks.`,QT=class n extends Ar{config;static Name="docgov_status";constructor(e){super(n.Name,"DocGovStatus",LVa,Fr.FileSearch,{type:It.OBJECT,properties:{},required:[]}),this.config=e}validateToolParams(e){return Wn.validate(this.schema.parameters,e,n.Name)}getDescription(){return"Reading documentation governance status"}async execute(e,r){let a=this.validateToolParams(e);if(a)return{llmContent:`Error: Invalid parameters provided. Reason: ${a}`,returnDisplay:`Parameter validation failed: ${a}`};let i=Ql(this.config);if(!i)return{llmContent:"Error: this directory has no unfinished knowledge commission before running status."+pu,returnDisplay:"No unfinished docgov commission."};let s=i.state,{ledger:t,instance:o,projectDir:d}=s,I=t.stats(),u=t.getAssumptions(),h=t.pendingQuestions(),c=t.getClaimsByTrust("unknown"),m=[`Project: ${o.projectName} (schema: ${o.schemaId})`,`Audience: ${o.goal.audience}`,"Agent build:
|
|
4256
|
+
The counts come from the ledger, not from your own impression of the work. If it reports unconfirmed assumptions, the document is not done, regardless of how complete the prose looks.`,QT=class n extends Ar{config;static Name="docgov_status";constructor(e){super(n.Name,"DocGovStatus",LVa,Fr.FileSearch,{type:It.OBJECT,properties:{},required:[]}),this.config=e}validateToolParams(e){return Wn.validate(this.schema.parameters,e,n.Name)}getDescription(){return"Reading documentation governance status"}async execute(e,r){let a=this.validateToolParams(e);if(a)return{llmContent:`Error: Invalid parameters provided. Reason: ${a}`,returnDisplay:`Parameter validation failed: ${a}`};let i=Ql(this.config);if(!i)return{llmContent:"Error: this directory has no unfinished knowledge commission before running status."+pu,returnDisplay:"No unfinished docgov commission."};let s=i.state,{ledger:t,instance:o,projectDir:d}=s,I=t.stats(),u=t.getAssumptions(),h=t.pendingQuestions(),c=t.getClaimsByTrust("unknown"),m=[`Project: ${o.projectName} (schema: ${o.schemaId})`,`Audience: ${o.goal.audience}`,"Agent build: a0f9cbcc-dirty HEAD 2026-10-12T09:20:35.207Z",""],v=ga(d);if(v?.scenario){let N=PC(v),F=Co(v.stageChain??[]),E=F[F.length-1];m.push(`\u573A\u666F / Scenario: ${N.name}\uFF08${v.scenario}\uFF09`,E?`\u5DF2\u5F00\u9636\u6BB5 / Stages opened: ${F.map(p=>`${iGt[p.stage]}(${p.approvalRef})`).join(" \u2192 ")}`:"\u5C1A\u672A\u5F00\u542F\u4EFB\u4F55\u9636\u6BB5\u2014\u2014\u4E0B\u4E00\u6B65 docgov_level stage=compilation\uFF0Capproval_ref \u5F15\u7528\u7528\u6237\u7684\u5F00\u5DE5\u786E\u8BA4\u3002"),v.materiality&&m.push(`\u505C\u6B62\u7EBF\uFF1A${v.materiality}`),E&&m.push((E.completedAt?`\u5F53\u524D\u9636\u6BB5\u3010${iGt[E.stage]}\u3011\u5DF2\u901A\u8FC7\uFF08${E.approvalRef}\uFF0C${E.completedAt}\uFF09\u3002`:`\u5F53\u524D\u9636\u6BB5\u3010${iGt[E.stage]}\u3011\u7684\u5B8C\u6210\u7531 goal \u88C1\u5224\u5224\u5B9A\uFF1A\u6536\u5C3E\u65F6\u8C03 goal_achieved\uFF0C\u5B83\u4F1A\u8BFB\u8FD9\u6BB5\u5BF9\u8BDD\u5386\u53F2\u9010\u6761\u6838\u4F60\u7684\u8FBE\u6807\u7279\u5F81\u3002`)+"\u505A\u5B8C\u672C\u7EA7\u5C31\u505C\uFF0C\u662F\u5426\u52A0\u6DF1\u7531\u7528\u6237\u51B3\u5B9A\u3002"),m.push("")}m.push("Trust breakdown:",` verified ${I.verified}${JVa(I.verifiedBy)}`,` confirmed ${I.confirmed} (answered by the user)`,` assumed ${I.assumed} (unconfirmed guesses, block release)`,` recheck ${I.unknown} (provenance went stale)`);let f=o.requirements.filter(N=>t.getClaimsByRequirement(N.id).length===0);if(f.length>0&&m.push("","Requirements with no claims yet:",...f.map(N=>` ${N.id} ${N.what}`)),u.length>0){m.push("","Unconfirmed assumptions:");for(let N of u.slice(0,20)){let F=N.evidence[0]?.note?` (${N.evidence[0].note})`:"";m.push(` ${N.id} ${N.text}${F}`)}u.length>20&&m.push(` ... and ${u.length-20} more`)}let Z=t.getClaimsByTrust("confirmed").map(N=>({claim:N,attribution:t.getClaimAttribution(N.id).filter(F=>F.answeredBy)})).filter(N=>N.attribution.length>0);if(Z.length>0){m.push("","Confirmation attribution:");for(let{claim:N,attribution:F}of Z.slice(0,10)){let E=F.map(G=>`${G.ref} by ${G.answeredBy}${G.answeredAt?` @ ${G.answeredAt.slice(0,10)}`:""}`).join(", "),p=N.asOf?` [as of ${N.asOf}]`:"";m.push(` ${N.id} ${N.text}${p} \u2190 ${E}`);let g=o.requirements.find(G=>G.id===N.requirementId)?.owner;g&&!F.some(G=>G.answeredBy?.toLowerCase().includes(g.toLowerCase()))&&m.push(` \u26A0 \u786E\u8BA4\u4EBA\u4E0E\u8BE5\u8981\u6C42\u58F0\u660E\u7684 owner\uFF08${g}\uFF09\u4E0D\u7B26\uFF0C\u5EFA\u8BAE\u7531 owner \u590D\u6838`)}Z.length>10&&m.push(` ... and ${Z.length-10} more`)}if(c.length>0&&m.push("","Claims needing recheck (their source changed or was superseded):",...c.slice(0,10).map(N=>` ${N.id} ${N.text}`)),h.length>0){m.push("","Questions still waiting for the user:");for(let N of h.slice(0,10))m.push(` ${N.id} ${N.question??""}`)}let y=t.openConflicts();y.length>0&&m.push("","Open conflicts (\u4E92\u65A5\u4E3B\u5F20\uFF0C\u963B\u585E\u5B9A\u7A3F\uFF1B\u786E\u8BA4\u4E00\u8FB9\u5373\u53EF\u81EA\u52A8\u88C1\u51B3):",...y.slice(0,10).map(N=>` ${N.id} ${N.detail}`));let A=kd(this.config);A&&m.push("",A);let w=d4e(this.config);if(!A&&w.pending.length>0){m.push("","Mid-turn interruptions still queued:");for(let N of w.pending.slice(0,10))m.push(` [${N.kind}] ${N.text}`)}if(!A&&w.absorbed.length>0){m.push("","Soft guidance already absorbed:");for(let N of w.absorbed.slice(-5))m.push(` \xB7 ${N}`)}let R=Qb({requirements:o.rigor?.load_bearing,criteria:(ga(d)?.criteria??[]).map(N=>N.id)});if(u.length>0||c.length>0){let N=[...u,...c],F=N.filter(g=>Hb(g,R)),E=N.filter(g=>!Hb(g,R)&&tY(g)),p=N.length-E.length-F.length;m.push("","\u507F\u8FD8\u8DEF\u5F84 / Path to publish:",` ${F.length} \u627F\u91CD\u4E3B\u5F20\uFF08\u89C4\u5B9A\u6027/\u627F\u8BFA\u6027/\u627F\u91CD\u8981\u6C42\uFF09\u2192 \u987B\u7528\u6237\u62CD\u677F\uFF0C\u8FD9\u662F\u552F\u4E00\u76F4\u63A5\u95EE\u4EBA\u7684\u7C7B\u522B`,` ${E.length} \u63CF\u8FF0\u6027\u4E14\u6709\u53EF\u6838\u67E5\u51FA\u5904 \u2192 \u8DD1 docgov_validate \u81EA\u52A8\u5B9A\u6848\uFF0C\u65E0\u9700\u63D0\u95EE`,` ${p} \u65E0\u53EF\u6838\u67E5\u51FA\u5904 \u2192 \u8865\u51FA\u5904\u91CD\u5F55\uFF0C\u6216\u4F5C\u4E3A\u6B8B\u4F59\u98CE\u9669\u968F\u9644\u4EA4\u4ED8`)}m.push("");let b=Cw(t,Qb({requirements:o.rigor?.load_bearing}));return b.allowed?m.push(`\u53EF\u53D1\u5E03 / PUBLISHABLE: ${b.note}`):m.push(`\u4E0D\u53EF\u53D1\u5E03 / NOT publishable: ${b.note}`,"Describe the document as a draft with the blockers above; non-load-bearing assumptions ship as a residual-risk appendix and do not block."),{llmContent:m.join(`
|
|
4257
4257
|
`),returnDisplay:`verified ${I.verified} \xB7 confirmed ${I.confirmed} \xB7 assumed ${I.assumed}`,summary:`docgov status: ${I.assumed} assumed, ${h.length} open questions`}}}});import*as am from"node:fs";import*as $d from"node:path";var TVa,BVa,DVa,DVr,HT,rVe=He(()=>{"use strict";_E();Bn();na();Qi();Vd();rm();kb();Yw();Nl();TVa=`Export the governed knowledge base together with per-claim trust metadata for downstream retrieval (RAG) systems. Produces manifest.json, claims.jsonl (one claim per line with trust, provenance, authority, attribution and validity anchor) and copies of the canonical sections.
|
|
4258
4258
|
|
|
4259
4259
|
Draft mode exports everything including unconfirmed assumptions, each row carrying its trust level so downstream indexes can filter. Release mode is gated: it refuses to export while any assumption, stale claim or open conflict remains.
|
|
@@ -4865,7 +4865,7 @@ ${a}
|
|
|
4865
4865
|
\u{1F50D} Model Diagnostics: ${n}`),console.log(`\u{1F4CA} Reliability: ${r.capabilities.toolCallReliability}`),console.log(`\u{1F527} Format Tolerance: ${r.capabilities.needsFormatTolerance?"Yes":"No"}`),console.log(`\u{1F504} Max Concurrent Tools: ${r.capabilities.maxConcurrentTools}`),r.warnings.length>0&&(console.log(`
|
|
4866
4866
|
\u26A0\uFE0F Warnings:`),r.warnings.forEach(a=>console.log(` \u2022 ${a}`))),e&&r.recommendations.length>0&&(console.log(`
|
|
4867
4867
|
\u{1F4A1} Recommendations:`),r.recommendations.forEach(a=>console.log(` \u2022 ${a}`))),e&&(console.log(`
|
|
4868
|
-
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function gTa(n){let e=eQe(n);return e.isSmallModel||e.needsSpecialHandling}function GTa(n){let e=eQe(n);return e.capabilities.toolCallReliability==="high"?"\u2705 Excellent tool calling compatibility":e.capabilities.toolCallReliability==="medium"?"\u{1F7E1} Good compatibility with enhanced error handling":"\u{1F7E0} Limited compatibility - enhanced robustness features active"}var BLr=He(()=>{"use strict";Noe();});function OLr(...n){return vTa(...n)}function ULr(...n){return yTa(...n)}function DLr(n,e){return n in e}function Lyt(){let n={get(i,s){if(s==="write")return OLr;if(DLr(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,n),r={get(i,s){if(s==="write")return ULr;if(DLr(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},a=new Proxy(process.stderr,r);return{stdout:e,stderr:a}}var vTa,yTa,MLr=He(()=>{"use strict";vTa=process.stdout.write.bind(process.stdout),yTa=process.stderr.write.bind(process.stderr)});import{readFile as ZTa}from"node:fs/promises";import{fileURLToPath as NTa}from"node:url";import Jyt from"node:path";function WTa(){let n=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return Jyt.dirname(NTa(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function Dw(){return Xme||(Xme=(async()=>"1.1.
|
|
4868
|
+
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function gTa(n){let e=eQe(n);return e.isSmallModel||e.needsSpecialHandling}function GTa(n){let e=eQe(n);return e.capabilities.toolCallReliability==="high"?"\u2705 Excellent tool calling compatibility":e.capabilities.toolCallReliability==="medium"?"\u{1F7E1} Good compatibility with enhanced error handling":"\u{1F7E0} Limited compatibility - enhanced robustness features active"}var BLr=He(()=>{"use strict";Noe();});function OLr(...n){return vTa(...n)}function ULr(...n){return yTa(...n)}function DLr(n,e){return n in e}function Lyt(){let n={get(i,s){if(s==="write")return OLr;if(DLr(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,n),r={get(i,s){if(s==="write")return ULr;if(DLr(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},a=new Proxy(process.stderr,r);return{stdout:e,stderr:a}}var vTa,yTa,MLr=He(()=>{"use strict";vTa=process.stdout.write.bind(process.stdout),yTa=process.stderr.write.bind(process.stderr)});import{readFile as ZTa}from"node:fs/promises";import{fileURLToPath as NTa}from"node:url";import Jyt from"node:path";function WTa(){let n=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return Jyt.dirname(NTa(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function Dw(){return Xme||(Xme=(async()=>"1.1.85")(),Xme)}function FTa(){Xme=void 0}var Xme,Tyt=He(()=>{"use strict";});import{EventEmitter as wTa}from"node:events";var Sme,Byt,Dyt,zLr=He(()=>{"use strict";(function(n){n.ApprovalModeChanged="approval_mode_changed"})(Sme||(Sme={}));Byt=class{emitter=new wTa;on(e,r){return this.emitter.on(e,r),()=>this.emitter.off(e,r)}off(e,r){this.emitter.off(e,r)}emit(e,r){this.emitter.emit(e,r)}removeAllListeners(e){e?this.emitter.removeAllListeners(e):this.emitter.removeAllListeners()}},Dyt=new Byt});function tQe(n){return Array.isArray(n)?n.map(e=>typeof e=="string"?{text:e}:e):typeof n=="string"?[{text:n}]:[n]}function RTa(n){return n.map(e=>typeof e.text=="string"?e.text:"").join("")}function Oyt(n){if(!n||n.length===0)return[];let e=[];for(let r of n){if(r.role&&(r.parts||r.content!==void 0)){let a=r.parts??tQe(r.content);e.push({role:r.role,parts:a});continue}if(!(r.type==="info"||r.type==="error"||r.type==="warning")){if(r.type==="user"){let a=r.content!==void 0?tQe(r.content):[],i=RTa(a).trim();if(i.startsWith("/")||i.startsWith("?")||a.length===0)continue;e.push({role:"user",parts:a});continue}if(r.type==="gemini"){let a=[];if(r.thoughts&&r.thoughts.length>0)for(let s of r.thoughts){let t=s.subject?`**${s.subject}** ${s.description}`:s.description;a.push({text:t,thought:!0})}let i=!!r.toolCalls&&r.toolCalls.length>0;if(r.content!==void 0&&a.push(...tQe(r.content)),i)for(let s of r.toolCalls)a.push({functionCall:{name:s.name,args:s.args,...s.id?{id:s.id}:{}}});if(a.length>0&&e.push({role:"model",parts:a}),i){let s=[];for(let t of r.toolCalls)t.result!==void 0&&(typeof t.result=="string"?s.push({functionResponse:{id:t.id,name:t.name,response:{output:t.result}}}):Array.isArray(t.result)?s.push(...tQe(t.result)):s.push(t.result));s.length>0&&e.push({role:"user",parts:s})}}}}return e}var _Lr=He(()=>{"use strict";});var IB,PLr,Lme,jLr=He(()=>{"use strict";IB=class n extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new n("No persisted sessions found.")}static invalidSessionIdentifier(e,r){return new n(`Session '${e}' was not found under ${r}.`)}},PLr="latest",Lme=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(a=>a.sessionId===e)}async listSessions(){return this.toSortedInfos(await this.listHostMetadata())}async findSession(e){let r=e.trim(),a=(await this.listAllMetadata()).find(t=>t.sessionId===r);if(a)return this.toInfo(a);let i=await this.listSessions();if(i.length===0)throw IB.noSessionsFound();let s=Number.parseInt(r,10);if(Number.isInteger(s)&&s.toString()===r&&s>0&&s<=i.length)return i[s-1];throw IB.invalidSessionIdentifier(r,"sessions/")}toInfo(e){return{id:e.sessionId,startTime:e.createdAt,title:e.title,messageCount:e.messageCount}}toSortedInfos(e){return e.map(r=>this.toInfo(r)).sort((r,a)=>new Date(r.startTime).getTime()-new Date(a.startTime).getTime())}async resolveSession(e){let r=e.trim(),a;if(r===PLr){let s=await this.listSessions();if(s.length===0)throw IB.noSessionsFound();a=s[s.length-1]}else a=await this.findSession(r);let i=await this.manager.loadSession(a.id);if(!i)throw new IB(`Session '${a.id}' exists in index but could not be loaded.`);return{session:a,data:i}}async listHostMetadata(){let e=this.manager;return typeof e.listSessions=="function"?await e.listSessions():this.listAllMetadata()}async listAllMetadata(){let e=this.manager;return typeof e.listAllSessions=="function"?await e.listAllSessions():typeof e.listSessions=="function"?await e.listSessions():typeof e.getSessionIndex=="function"?(await e.getSessionIndex())?.sessions??[]:[]}}});function nQe(n){let r={authUrl:"https://accounts.deepvlab.ai/login",redirectUri:`http://localhost:${n||7863}/callback?plat=deepvlab`};return new rQe(r)}var rQe,Uyt=He(()=>{"use strict";rQe=class{config;constructor(e){this.config=e}buildAuthUrl(){let e=`${this.config.authUrl}?redirect_to=${encodeURIComponent(this.config.redirectUri)}&redirect_mode=same_window`;return console.log("\u{1F517} DeepVlab\u8BA4\u8BC1URL:",e),e}handleCallback(e){console.log("\u{1F504} [DeepVlab Auth] \u5904\u7406DeepVlab\u8BA4\u8BC1\u56DE\u8C03"),console.log("\u{1F504} [DeepVlab Auth] \u56DE\u8C03URL:",e.toString());let r=Object.fromEntries(e.searchParams.entries());console.log("\u{1F504} [DeepVlab Auth] \u56DE\u8C03\u53C2\u6570:",r);let a=e.searchParams.get("token"),i=e.searchParams.get("user_id"),s=e.searchParams.get("error");return s?(console.error("\u274C [DeepVlab Auth] \u8BA4\u8BC1\u9519\u8BEF:",s),{success:!1,error:`DeepVlab\u8BA4\u8BC1\u5931\u8D25: ${s}`}):a?i?(console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230JWT Token:",a),console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230User ID:",i),console.log("\u2705 [DeepVlab Auth] DeepVlab\u8BA4\u8BC1\u6210\u529F"),{success:!0,token:a,user_id:i}):(console.error("\u274C [DeepVlab Auth] \u7F3A\u5C11user_id\u53C2\u6570"),{success:!1,error:"DeepVlab\u8BA4\u8BC1\u56DE\u8C03\u4E2D\u7F3A\u5C11user_id\u53C2\u6570"}):(console.error("\u274C [DeepVlab Auth] \u7F3A\u5C11token\u53C2\u6570"),{success:!1,error:"DeepVlab\u8BA4\u8BC1\u56DE\u8C03\u4E2D\u7F3A\u5C11token\u53C2\u6570"})}}});import*as aQe from"fs";import*as p2 from"path";function ETa(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var Jme,ATa,xTa,vH,Myt=He(()=>{"use strict";Jme=ETa(),ATa={titleI18nKey:"auth.feishu.success.title",documentTitle:"Feishu Authentication Successful",heading:"Feishu Login Successful",displayName:"Feishu"},xTa={titleI18nKey:"auth.deepvlab.success.title",documentTitle:"DeepVlab Authentication Successful",heading:"DeepVlab Login Successful",displayName:"DeepVlab"},vH=class{static cache=new Map;static customBasePath=null;static setBasePath(e){this.customBasePath=e,console.log(`\u{1F4C1} [AuthTemplates] Custom base path set: ${e}`)}static getAuthSelectPage(){return this.loadTemplate("authSelectPage.html")}static getFeishuSuccessPage(){return this.generateSuccessTemplate(ATa)}static getDeepvlabSuccessPage(){return this.generateSuccessTemplate(xTa)}static getErrorPage(e){return this.generateErrorTemplate(e)}static loadTemplate(e){if(this.cache.has(e))return this.cache.get(e);try{let r=[];if(this.customBasePath&&(r.push(p2.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(p2.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(p2.join(this.customBasePath,"auth","login","templates",e))),Jme&&r.push(p2.join(Jme,e)),Jme){let s=Jme;for(let t=0;t<10;t++)r.push(p2.join(s,"bundled","auth","login","templates",e)),r.push(p2.join(s,"bundled",e)),r.push(p2.join(s,"bundle","login","templates",e)),r.push(p2.join(s,"auth","login","templates",e)),s=p2.dirname(s)}if(typeof process<"u"&&process.cwd)try{let s=process.cwd();r.push(p2.join(s,"bundle","login","templates",e)),r.push(p2.join(s,"dist","bundled","auth","login","templates",e)),r.push(p2.join(s,"bundled","auth","login","templates",e)),r.push(p2.join(s,"auth","login","templates",e))}catch{}let a=null;for(let s of r)try{if(aQe.existsSync(s)){a=s,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${s}`);break}}catch{continue}if(!a){if(console.warn(`\u26A0\uFE0F [AuthTemplates] Template ${e} not found in any location.`),console.warn(` Tried ${r.length} paths. First 5:`),r.slice(0,5).forEach((s,t)=>console.warn(` ${t+1}. ${s}`)),console.warn(` Current dirname: ${Jme||"(unavailable - cross-platform build)"}`),console.warn(` Custom base path: ${this.customBasePath||"(not set)"}`),typeof process<"u"&&process.cwd)try{console.warn(` Process cwd: ${process.cwd()}`)}catch{console.warn(" Process cwd: unavailable")}return console.log(`\u2139\uFE0F [AuthTemplates] Using fallback template for ${e}`),this.generateBasicAuthSelectTemplate()}let i=aQe.readFileSync(a,"utf-8");return this.cache.set(e,i),i}catch(r){return console.error(`\u274C [AuthTemplates] Failed to load template ${e}:`,r),this.generateBasicAuthSelectTemplate()}}static generateBasicAuthSelectTemplate(){return`
|
|
4869
4869
|
<!DOCTYPE html>
|
|
4870
4870
|
<html>
|
|
4871
4871
|
<head>
|
|
@@ -6604,7 +6604,7 @@ ${c}`),a?i.reset(c):c}function I7a(n,e,r,a={}){if(!a8r){a8r=!0;let s="Passing li
|
|
|
6604
6604
|
|
|
6605
6605
|
${e}
|
|
6606
6606
|
`:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,a=f7a(r,this.#t.message);if(a)return(0,h8r.codeFrameColumns)(r,{start:a},{highlightCode:e})}get codeFrame(){return this.#n??=this.#i(!0),this.#n}get rawCodeFrame(){return this.#a??=this.#i(!1),this.#a}},f7a=(n,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:a,line:i,column:s}=r.groups;return i&&s?{line:Number(i),column:Number(s)}:cWt(n,Number(a),{oneBased:!0})},b7a=n=>n.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,a)=>`"${a}"(${p7a(a)})`)});var Q0e=Oe((VDs,p8r)=>{"use strict";var g7a=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...n)=>console.error("SEMVER",...n):()=>{};p8r.exports=g7a});var H0e=Oe((kDs,f8r)=>{"use strict";var G7a="2.0.0",v7a=Number.MAX_SAFE_INTEGER||9007199254740991,y7a=16,Z7a=250,N7a=["major","premajor","minor","preminor","patch","prepatch","prerelease"];f8r.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:y7a,MAX_SAFE_BUILD_LENGTH:Z7a,MAX_SAFE_INTEGER:v7a,RELEASE_TYPES:N7a,SEMVER_SPEC_VERSION:G7a,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var O$=Oe((WA,b8r)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:IWt,MAX_SAFE_BUILD_LENGTH:W7a,MAX_LENGTH:F7a}=H0e(),w7a=Q0e();WA=b8r.exports={};var R7a=WA.re=[],E7a=WA.safeRe=[],Ca=WA.src=[],A7a=WA.safeSrc=[],Ya=WA.t={},x7a=0,hWt="[a-zA-Z0-9-]",C7a=[["\\s",1],["\\d",F7a],[hWt,W7a]],Y7a=n=>{for(let[e,r]of C7a)n=n.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return n},vs=(n,e,r)=>{let a=Y7a(e),i=x7a++;w7a(n,i,e),Ya[n]=i,Ca[i]=e,A7a[i]=a,R7a[i]=new RegExp(e,r?"g":void 0),E7a[i]=new RegExp(a,r?"g":void 0)};vs("NUMERICIDENTIFIER","0|[1-9]\\d*");vs("NUMERICIDENTIFIERLOOSE","\\d+");vs("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${hWt}*`);vs("MAINVERSION",`(${Ca[Ya.NUMERICIDENTIFIER]})\\.(${Ca[Ya.NUMERICIDENTIFIER]})\\.(${Ca[Ya.NUMERICIDENTIFIER]})`);vs("MAINVERSIONLOOSE",`(${Ca[Ya.NUMERICIDENTIFIERLOOSE]})\\.(${Ca[Ya.NUMERICIDENTIFIERLOOSE]})\\.(${Ca[Ya.NUMERICIDENTIFIERLOOSE]})`);vs("PRERELEASEIDENTIFIER",`(?:${Ca[Ya.NONNUMERICIDENTIFIER]}|${Ca[Ya.NUMERICIDENTIFIER]})`);vs("PRERELEASEIDENTIFIERLOOSE",`(?:${Ca[Ya.NONNUMERICIDENTIFIER]}|${Ca[Ya.NUMERICIDENTIFIERLOOSE]})`);vs("PRERELEASE",`(?:-(${Ca[Ya.PRERELEASEIDENTIFIER]}(?:\\.${Ca[Ya.PRERELEASEIDENTIFIER]})*))`);vs("PRERELEASELOOSE",`(?:-?(${Ca[Ya.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Ca[Ya.PRERELEASEIDENTIFIERLOOSE]})*))`);vs("BUILDIDENTIFIER",`${hWt}+`);vs("BUILD",`(?:\\+(${Ca[Ya.BUILDIDENTIFIER]}(?:\\.${Ca[Ya.BUILDIDENTIFIER]})*))`);vs("FULLPLAIN",`v?${Ca[Ya.MAINVERSION]}${Ca[Ya.PRERELEASE]}?${Ca[Ya.BUILD]}?`);vs("FULL",`^${Ca[Ya.FULLPLAIN]}$`);vs("LOOSEPLAIN",`[v=\\s]*${Ca[Ya.MAINVERSIONLOOSE]}${Ca[Ya.PRERELEASELOOSE]}?${Ca[Ya.BUILD]}?`);vs("LOOSE",`^${Ca[Ya.LOOSEPLAIN]}$`);vs("GTLT","((?:<|>)?=?)");vs("XRANGEIDENTIFIERLOOSE",`${Ca[Ya.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);vs("XRANGEIDENTIFIER",`${Ca[Ya.NUMERICIDENTIFIER]}|x|X|\\*`);vs("XRANGEPLAIN",`[v=\\s]*(${Ca[Ya.XRANGEIDENTIFIER]})(?:\\.(${Ca[Ya.XRANGEIDENTIFIER]})(?:\\.(${Ca[Ya.XRANGEIDENTIFIER]})(?:${Ca[Ya.PRERELEASE]})?${Ca[Ya.BUILD]}?)?)?`);vs("XRANGEPLAINLOOSE",`[v=\\s]*(${Ca[Ya.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Ca[Ya.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Ca[Ya.XRANGEIDENTIFIERLOOSE]})(?:${Ca[Ya.PRERELEASELOOSE]})?${Ca[Ya.BUILD]}?)?)?`);vs("XRANGE",`^${Ca[Ya.GTLT]}\\s*${Ca[Ya.XRANGEPLAIN]}$`);vs("XRANGELOOSE",`^${Ca[Ya.GTLT]}\\s*${Ca[Ya.XRANGEPLAINLOOSE]}$`);vs("COERCEPLAIN",`(^|[^\\d])(\\d{1,${IWt}})(?:\\.(\\d{1,${IWt}}))?(?:\\.(\\d{1,${IWt}}))?`);vs("COERCE",`${Ca[Ya.COERCEPLAIN]}(?:$|[^\\d])`);vs("COERCEFULL",Ca[Ya.COERCEPLAIN]+`(?:${Ca[Ya.PRERELEASE]})?(?:${Ca[Ya.BUILD]})?(?:$|[^\\d])`);vs("COERCERTL",Ca[Ya.COERCE],!0);vs("COERCERTLFULL",Ca[Ya.COERCEFULL],!0);vs("LONETILDE","(?:~>?)");vs("TILDETRIM",`(\\s*)${Ca[Ya.LONETILDE]}\\s+`,!0);WA.tildeTrimReplace="$1~";vs("TILDE",`^${Ca[Ya.LONETILDE]}${Ca[Ya.XRANGEPLAIN]}$`);vs("TILDELOOSE",`^${Ca[Ya.LONETILDE]}${Ca[Ya.XRANGEPLAINLOOSE]}$`);vs("LONECARET","(?:\\^)");vs("CARETTRIM",`(\\s*)${Ca[Ya.LONECARET]}\\s+`,!0);WA.caretTrimReplace="$1^";vs("CARET",`^${Ca[Ya.LONECARET]}${Ca[Ya.XRANGEPLAIN]}$`);vs("CARETLOOSE",`^${Ca[Ya.LONECARET]}${Ca[Ya.XRANGEPLAINLOOSE]}$`);vs("COMPARATORLOOSE",`^${Ca[Ya.GTLT]}\\s*(${Ca[Ya.LOOSEPLAIN]})$|^$`);vs("COMPARATOR",`^${Ca[Ya.GTLT]}\\s*(${Ca[Ya.FULLPLAIN]})$|^$`);vs("COMPARATORTRIM",`(\\s*)${Ca[Ya.GTLT]}\\s*(${Ca[Ya.LOOSEPLAIN]}|${Ca[Ya.XRANGEPLAIN]})`,!0);WA.comparatorTrimReplace="$1$2$3";vs("HYPHENRANGE",`^\\s*(${Ca[Ya.XRANGEPLAIN]})\\s+-\\s+(${Ca[Ya.XRANGEPLAIN]})\\s*$`);vs("HYPHENRANGELOOSE",`^\\s*(${Ca[Ya.XRANGEPLAINLOOSE]})\\s+-\\s+(${Ca[Ya.XRANGEPLAINLOOSE]})\\s*$`);vs("STAR","(<|>)?=?\\s*\\*");vs("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");vs("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var jHe=Oe((QDs,g8r)=>{"use strict";var V7a=Object.freeze({loose:!0}),k7a=Object.freeze({}),Q7a=n=>n?typeof n!="object"?V7a:n:k7a;g8r.exports=Q7a});var mWt=Oe((HDs,y8r)=>{"use strict";var G8r=/^[0-9]+$/,v8r=(n,e)=>{if(typeof n=="number"&&typeof e=="number")return n===e?0:n<e?-1:1;let r=G8r.test(n),a=G8r.test(e);return r&&a&&(n=+n,e=+e),n===e?0:r&&!a?-1:a&&!r?1:n<e?-1:1},H7a=(n,e)=>v8r(e,n);y8r.exports={compareIdentifiers:v8r,rcompareIdentifiers:H7a}});var Mb=Oe((XDs,N8r)=>{"use strict";var qHe=Q0e(),{MAX_LENGTH:Z8r,MAX_SAFE_INTEGER:KHe}=H0e(),{safeRe:$He,t:eXe}=O$(),X7a=jHe(),{compareIdentifiers:pWt}=mWt(),fWt=class n{constructor(e,r){if(r=X7a(r),e instanceof n){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Z8r)throw new TypeError(`version is longer than ${Z8r} characters`);qHe("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let a=e.trim().match(r.loose?$He[eXe.LOOSE]:$He[eXe.FULL]);if(!a)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+a[1],this.minor=+a[2],this.patch=+a[3],this.major>KHe||this.major<0)throw new TypeError("Invalid major version");if(this.minor>KHe||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>KHe||this.patch<0)throw new TypeError("Invalid patch version");a[4]?this.prerelease=a[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&s<KHe)return s}return i}):this.prerelease=[],this.build=a[5]?a[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(qHe("SemVer.compare",this.version,this.options,e),!(e instanceof n)){if(typeof e=="string"&&e===this.version)return 0;e=new n(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof n||(e=new n(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof n||(e=new n(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let a=this.prerelease[r],i=e.prerelease[r];if(qHe("prerelease compare",r,a,i),a===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(a===void 0)return-1;if(a===i)continue;return pWt(a,i)}while(++r)}compareBuild(e){e instanceof n||(e=new n(e,this.options));let r=0;do{let a=this.build[r],i=e.build[r];if(qHe("build compare",r,a,i),a===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(a===void 0)return-1;if(a===i)continue;return pWt(a,i)}while(++r)}inc(e,r,a){if(e.startsWith("pre")){if(!r&&a===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?$He[eXe.PRERELEASELOOSE]:$He[eXe.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,a);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,a);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,a),this.inc("pre",r,a);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,a),this.inc("pre",r,a);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(a)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&a===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];a===!1&&(s=[r]),pWt(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};N8r.exports=fWt});var YB=Oe((SDs,F8r)=>{"use strict";var W8r=Mb(),S7a=(n,e,r=!1)=>{if(n instanceof W8r)return n;try{return new W8r(n,e)}catch(a){if(!r)return null;throw a}};F8r.exports=S7a});var bWt=Oe((LDs,w8r)=>{"use strict";var L7a=YB(),J7a=(n,e)=>{let r=L7a(n,e);return r?r.version:null};w8r.exports=J7a});var gWt=Oe((JDs,R8r)=>{"use strict";var T7a=YB(),B7a=(n,e)=>{let r=T7a(n.trim().replace(/^[=v]+/,""),e);return r?r.version:null};R8r.exports=B7a});var GWt=Oe((TDs,D7a)=>{D7a.exports=["0BSD","3D-Slicer-1.0","AAL","ADSL","AFL-1.1","AFL-1.2","AFL-2.0","AFL-2.1","AFL-3.0","AGPL-1.0-only","AGPL-1.0-or-later","AGPL-3.0-only","AGPL-3.0-or-later","AMD-newlib","AMDPLPA","AML","AML-glslang","AMPAS","ANTLR-PD","ANTLR-PD-fallback","APAFML","APL-1.0","APSL-1.0","APSL-1.1","APSL-1.2","APSL-2.0","ASWF-Digital-Assets-1.0","ASWF-Digital-Assets-1.1","Abstyles","AdaCore-doc","Adobe-2006","Adobe-Display-PostScript","Adobe-Glyph","Adobe-Utopia","Afmparse","Aladdin","Apache-1.0","Apache-1.1","Apache-2.0","App-s2p","Arphic-1999","Artistic-1.0","Artistic-1.0-Perl","Artistic-1.0-cl8","Artistic-2.0","Artistic-dist","Aspell-RU","BSD-1-Clause","BSD-2-Clause","BSD-2-Clause-Darwin","BSD-2-Clause-Patent","BSD-2-Clause-Views","BSD-2-Clause-first-lines","BSD-2-Clause-pkgconf-disclaimer","BSD-3-Clause","BSD-3-Clause-Attribution","BSD-3-Clause-Clear","BSD-3-Clause-HP","BSD-3-Clause-LBNL","BSD-3-Clause-Modification","BSD-3-Clause-No-Military-License","BSD-3-Clause-No-Nuclear-License","BSD-3-Clause-No-Nuclear-License-2014","BSD-3-Clause-No-Nuclear-Warranty","BSD-3-Clause-Open-MPI","BSD-3-Clause-Sun","BSD-3-Clause-acpica","BSD-3-Clause-flex","BSD-4-Clause","BSD-4-Clause-Shortened","BSD-4-Clause-UC","BSD-4.3RENO","BSD-4.3TAHOE","BSD-Advertising-Acknowledgement","BSD-Attribution-HPND-disclaimer","BSD-Inferno-Nettverk","BSD-Protection","BSD-Source-Code","BSD-Source-beginning-file","BSD-Systemics","BSD-Systemics-W3Works","BSL-1.0","BUSL-1.1","Baekmuk","Bahyph","Barr","Beerware","BitTorrent-1.0","BitTorrent-1.1","Bitstream-Charter","Bitstream-Vera","BlueOak-1.0.0","Boehm-GC","Boehm-GC-without-fee","Borceux","Brian-Gladman-2-Clause","Brian-Gladman-3-Clause","C-UDA-1.0","CAL-1.0","CAL-1.0-Combined-Work-Exception","CATOSL-1.1","CC-BY-1.0","CC-BY-2.0","CC-BY-2.5","CC-BY-2.5-AU","CC-BY-3.0","CC-BY-3.0-AT","CC-BY-3.0-AU","CC-BY-3.0-DE","CC-BY-3.0-IGO","CC-BY-3.0-NL","CC-BY-3.0-US","CC-BY-4.0","CC-BY-NC-1.0","CC-BY-NC-2.0","CC-BY-NC-2.5","CC-BY-NC-3.0","CC-BY-NC-3.0-DE","CC-BY-NC-4.0","CC-BY-NC-ND-1.0","CC-BY-NC-ND-2.0","CC-BY-NC-ND-2.5","CC-BY-NC-ND-3.0","CC-BY-NC-ND-3.0-DE","CC-BY-NC-ND-3.0-IGO","CC-BY-NC-ND-4.0","CC-BY-NC-SA-1.0","CC-BY-NC-SA-2.0","CC-BY-NC-SA-2.0-DE","CC-BY-NC-SA-2.0-FR","CC-BY-NC-SA-2.0-UK","CC-BY-NC-SA-2.5","CC-BY-NC-SA-3.0","CC-BY-NC-SA-3.0-DE","CC-BY-NC-SA-3.0-IGO","CC-BY-NC-SA-4.0","CC-BY-ND-1.0","CC-BY-ND-2.0","CC-BY-ND-2.5","CC-BY-ND-3.0","CC-BY-ND-3.0-DE","CC-BY-ND-4.0","CC-BY-SA-1.0","CC-BY-SA-2.0","CC-BY-SA-2.0-UK","CC-BY-SA-2.1-JP","CC-BY-SA-2.5","CC-BY-SA-3.0","CC-BY-SA-3.0-AT","CC-BY-SA-3.0-DE","CC-BY-SA-3.0-IGO","CC-BY-SA-4.0","CC-PDDC","CC-PDM-1.0","CC-SA-1.0","CC0-1.0","CDDL-1.0","CDDL-1.1","CDL-1.0","CDLA-Permissive-1.0","CDLA-Permissive-2.0","CDLA-Sharing-1.0","CECILL-1.0","CECILL-1.1","CECILL-2.0","CECILL-2.1","CECILL-B","CECILL-C","CERN-OHL-1.1","CERN-OHL-1.2","CERN-OHL-P-2.0","CERN-OHL-S-2.0","CERN-OHL-W-2.0","CFITSIO","CMU-Mach","CMU-Mach-nodoc","CNRI-Jython","CNRI-Python","CNRI-Python-GPL-Compatible","COIL-1.0","CPAL-1.0","CPL-1.0","CPOL-1.02","CUA-OPL-1.0","Caldera","Caldera-no-preamble","Catharon","ClArtistic","Clips","Community-Spec-1.0","Condor-1.1","Cornell-Lossless-JPEG","Cronyx","Crossword","CryptoSwift","CrystalStacker","Cube","D-FSL-1.0","DEC-3-Clause","DL-DE-BY-2.0","DL-DE-ZERO-2.0","DOC","DRL-1.0","DRL-1.1","DSDP","DocBook-DTD","DocBook-Schema","DocBook-Stylesheet","DocBook-XML","Dotseqn","ECL-1.0","ECL-2.0","EFL-1.0","EFL-2.0","EPICS","EPL-1.0","EPL-2.0","EUDatagrid","EUPL-1.0","EUPL-1.1","EUPL-1.2","Elastic-2.0","Entessa","ErlPL-1.1","Eurosym","FBM","FDK-AAC","FSFAP","FSFAP-no-warranty-disclaimer","FSFUL","FSFULLR","FSFULLRSD","FSFULLRWD","FSL-1.1-ALv2","FSL-1.1-MIT","FTL","Fair","Ferguson-Twofish","Frameworx-1.0","FreeBSD-DOC","FreeImage","Furuseth","GCR-docs","GD","GFDL-1.1-invariants-only","GFDL-1.1-invariants-or-later","GFDL-1.1-no-invariants-only","GFDL-1.1-no-invariants-or-later","GFDL-1.1-only","GFDL-1.1-or-later","GFDL-1.2-invariants-only","GFDL-1.2-invariants-or-later","GFDL-1.2-no-invariants-only","GFDL-1.2-no-invariants-or-later","GFDL-1.2-only","GFDL-1.2-or-later","GFDL-1.3-invariants-only","GFDL-1.3-invariants-or-later","GFDL-1.3-no-invariants-only","GFDL-1.3-no-invariants-or-later","GFDL-1.3-only","GFDL-1.3-or-later","GL2PS","GLWTPL","GPL-1.0-only","GPL-1.0-or-later","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","Game-Programming-Gems","Giftware","Glide","Glulxe","Graphics-Gems","Gutmann","HDF5","HIDAPI","HP-1986","HP-1989","HPND","HPND-DEC","HPND-Fenneberg-Livingston","HPND-INRIA-IMAG","HPND-Intel","HPND-Kevlin-Henney","HPND-MIT-disclaimer","HPND-Markus-Kuhn","HPND-Netrek","HPND-Pbmplus","HPND-UC","HPND-UC-export-US","HPND-doc","HPND-doc-sell","HPND-export-US","HPND-export-US-acknowledgement","HPND-export-US-modify","HPND-export2-US","HPND-merchantability-variant","HPND-sell-MIT-disclaimer-xserver","HPND-sell-regexpr","HPND-sell-variant","HPND-sell-variant-MIT-disclaimer","HPND-sell-variant-MIT-disclaimer-rev","HTMLTIDY","HaskellReport","Hippocratic-2.1","IBM-pibs","ICU","IEC-Code-Components-EULA","IJG","IJG-short","IPA","IPL-1.0","ISC","ISC-Veillard","ImageMagick","Imlib2","Info-ZIP","Inner-Net-2.0","InnoSetup","Intel","Intel-ACPI","Interbase-1.0","JPL-image","JPNIC","JSON","Jam","JasPer-2.0","Kastrup","Kazlib","Knuth-CTAN","LAL-1.2","LAL-1.3","LGPL-2.0-only","LGPL-2.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","LGPLLR","LOOP","LPD-document","LPL-1.0","LPL-1.02","LPPL-1.0","LPPL-1.1","LPPL-1.2","LPPL-1.3a","LPPL-1.3c","LZMA-SDK-9.11-to-9.20","LZMA-SDK-9.22","Latex2e","Latex2e-translated-notice","Leptonica","LiLiQ-P-1.1","LiLiQ-R-1.1","LiLiQ-Rplus-1.1","Libpng","Linux-OpenIB","Linux-man-pages-1-para","Linux-man-pages-copyleft","Linux-man-pages-copyleft-2-para","Linux-man-pages-copyleft-var","Lucida-Bitmap-Fonts","MIPS","MIT","MIT-0","MIT-CMU","MIT-Click","MIT-Festival","MIT-Khronos-old","MIT-Modern-Variant","MIT-Wu","MIT-advertising","MIT-enna","MIT-feh","MIT-open-group","MIT-testregex","MITNFA","MMIXware","MPEG-SSG","MPL-1.0","MPL-1.1","MPL-2.0","MPL-2.0-no-copyleft-exception","MS-LPL","MS-PL","MS-RL","MTLL","Mackerras-3-Clause","Mackerras-3-Clause-acknowledgment","MakeIndex","Martin-Birgmeier","McPhee-slideshow","Minpack","MirOS","Motosoto","MulanPSL-1.0","MulanPSL-2.0","Multics","Mup","NAIST-2003","NASA-1.3","NBPL-1.0","NCBI-PD","NCGL-UK-2.0","NCL","NCSA","NGPL","NICTA-1.0","NIST-PD","NIST-PD-fallback","NIST-Software","NLOD-1.0","NLOD-2.0","NLPL","NOSL","NPL-1.0","NPL-1.1","NPOSL-3.0","NRL","NTIA-PD","NTP","NTP-0","Naumen","NetCDF","Newsletr","Nokia","Noweb","O-UDA-1.0","OAR","OCCT-PL","OCLC-2.0","ODC-By-1.0","ODbL-1.0","OFFIS","OFL-1.0","OFL-1.0-RFN","OFL-1.0-no-RFN","OFL-1.1","OFL-1.1-RFN","OFL-1.1-no-RFN","OGC-1.0","OGDL-Taiwan-1.0","OGL-Canada-2.0","OGL-UK-1.0","OGL-UK-2.0","OGL-UK-3.0","OGTSL","OLDAP-1.1","OLDAP-1.2","OLDAP-1.3","OLDAP-1.4","OLDAP-2.0","OLDAP-2.0.1","OLDAP-2.1","OLDAP-2.2","OLDAP-2.2.1","OLDAP-2.2.2","OLDAP-2.3","OLDAP-2.4","OLDAP-2.5","OLDAP-2.6","OLDAP-2.7","OLDAP-2.8","OLFL-1.3","OML","OPL-1.0","OPL-UK-3.0","OPUBL-1.0","OSET-PL-2.1","OSL-1.0","OSL-1.1","OSL-2.0","OSL-2.1","OSL-3.0","OpenPBS-2.3","OpenSSL","OpenSSL-standalone","OpenVision","PADL","PDDL-1.0","PHP-3.0","PHP-3.01","PPL","PSF-2.0","Parity-6.0.0","Parity-7.0.0","Pixar","Plexus","PolyForm-Noncommercial-1.0.0","PolyForm-Small-Business-1.0.0","PostgreSQL","Python-2.0","Python-2.0.1","QPL-1.0","QPL-1.0-INRIA-2004","Qhull","RHeCos-1.1","RPL-1.1","RPL-1.5","RPSL-1.0","RSA-MD","RSCPL","Rdisc","Ruby","Ruby-pty","SAX-PD","SAX-PD-2.0","SCEA","SGI-B-1.0","SGI-B-1.1","SGI-B-2.0","SGI-OpenGL","SGP4","SHL-0.5","SHL-0.51","SISSL","SISSL-1.2","SL","SMAIL-GPL","SMLNJ","SMPPL","SNIA","SOFA","SPL-1.0","SSH-OpenSSH","SSH-short","SSLeay-standalone","SSPL-1.0","SUL-1.0","SWL","Saxpath","SchemeReport","Sendmail","Sendmail-8.23","Sendmail-Open-Source-1.1","SimPL-2.0","Sleepycat","Soundex","Spencer-86","Spencer-94","Spencer-99","SugarCRM-1.1.3","Sun-PPP","Sun-PPP-2000","SunPro","Symlinks","TAPR-OHL-1.0","TCL","TCP-wrappers","TGPPL-1.0","TMate","TORQUE-1.1","TOSL","TPDL","TPL-1.0","TTWL","TTYP0","TU-Berlin-1.0","TU-Berlin-2.0","TermReadKey","ThirdEye","TrustedQSL","UCAR","UCL-1.0","UMich-Merit","UPL-1.0","URT-RLE","Ubuntu-font-1.0","Unicode-3.0","Unicode-DFS-2015","Unicode-DFS-2016","Unicode-TOU","UnixCrypt","Unlicense","Unlicense-libtelnet","Unlicense-libwhirlpool","VOSTROM","VSL-1.0","Vim","W3C","W3C-19980720","W3C-20150513","WTFPL","Watcom-1.0","Widget-Workshop","Wsuipa","X11","X11-distribute-modifications-variant","X11-swapped","XFree86-1.1","XSkat","Xdebug-1.03","Xerox","Xfig","Xnet","YPL-1.0","YPL-1.1","ZPL-1.1","ZPL-2.0","ZPL-2.1","Zed","Zeeff","Zend-2.0","Zimbra-1.3","Zimbra-1.4","Zlib","any-OSI","any-OSI-perl-modules","bcrypt-Solar-Designer","blessing","bzip2-1.0.6","check-cvs","checkmk","copyleft-next-0.3.0","copyleft-next-0.3.1","curl","cve-tou","diffmark","dtoa","dvipdfm","eGenix","etalab-2.0","fwlw","gSOAP-1.3b","generic-xts","gnuplot","gtkbook","hdparm","iMatix","jove","libpng-1.6.35","libpng-2.0","libselinux-1.0","libtiff","libutil-David-Nugent","lsof","magaz","mailprio","man2html","metamail","mpi-permissive","mpich2","mplus","ngrep","pkgconf","pnmstitch","psfrag","psutils","python-ldap","radvd","snprintf","softSurfer","ssh-keyscan","swrule","threeparttable","ulem","w3m","wwl","xinetd","xkeyboard-config-Zinoviev","xlock","xpp","xzoom","zlib-acknowledgement"]});var E8r=Oe((BDs,O7a)=>{O7a.exports=["AGPL-1.0","AGPL-3.0","BSD-2-Clause-FreeBSD","BSD-2-Clause-NetBSD","GFDL-1.1","GFDL-1.2","GFDL-1.3","GPL-1.0","GPL-2.0","GPL-2.0-with-GCC-exception","GPL-2.0-with-autoconf-exception","GPL-2.0-with-bison-exception","GPL-2.0-with-classpath-exception","GPL-2.0-with-font-exception","GPL-3.0","GPL-3.0-with-GCC-exception","GPL-3.0-with-autoconf-exception","LGPL-2.0","LGPL-2.1","LGPL-3.0","Net-SNMP","Nunit","StandardML-NJ","bzip2-1.0.5","eCos-2.0","wxWindows"]});var A8r=Oe((DDs,U7a)=>{U7a.exports=["389-exception","Asterisk-exception","Autoconf-exception-2.0","Autoconf-exception-3.0","Autoconf-exception-generic","Autoconf-exception-generic-3.0","Autoconf-exception-macro","Bison-exception-1.24","Bison-exception-2.2","Bootloader-exception","Classpath-exception-2.0","CLISP-exception-2.0","cryptsetup-OpenSSL-exception","DigiRule-FOSS-exception","eCos-exception-2.0","Fawkes-Runtime-exception","FLTK-exception","fmt-exception","Font-exception-2.0","freertos-exception-2.0","GCC-exception-2.0","GCC-exception-2.0-note","GCC-exception-3.1","Gmsh-exception","GNAT-exception","GNOME-examples-exception","GNU-compiler-exception","gnu-javamail-exception","GPL-3.0-interface-exception","GPL-3.0-linking-exception","GPL-3.0-linking-source-exception","GPL-CC-1.0","GStreamer-exception-2005","GStreamer-exception-2008","i2p-gpl-java-exception","KiCad-libraries-exception","LGPL-3.0-linking-exception","libpri-OpenH323-exception","Libtool-exception","Linux-syscall-note","LLGPL","LLVM-exception","LZMA-exception","mif-exception","OCaml-LGPL-linking-exception","OCCT-exception-1.0","OpenJDK-assembly-exception-1.0","openvpn-openssl-exception","PS-or-PDF-font-exception-20170817","QPL-1.0-INRIA-2004-exception","Qt-GPL-exception-1.0","Qt-LGPL-exception-1.1","Qwt-exception-1.0","SANE-exception","SHL-2.0","SHL-2.1","stunnel-exception","SWI-exception","Swift-exception","Texinfo-exception","u-boot-exception-2.0","UBDL-exception","Universal-FOSS-exception-1.0","vsftpd-openssl-exception","WxWindows-exception-3.1","x11vnc-openssl-exception"]});var C8r=Oe((ODs,x8r)=>{"use strict";var M7a=[].concat(GWt()).concat(E8r()),z7a=A8r();x8r.exports=function(n){var e=0;function r(){return e<n.length}function a(v){if(v instanceof RegExp){var f=n.slice(e),Z=f.match(v);if(Z)return e+=Z[0].length,Z[0]}else if(n.indexOf(v,e)===e)return e+=v.length,v}function i(){a(/[ ]*/)}function s(){for(var v,f=["WITH","AND","OR","(",")",":","+"],Z=0;Z<f.length&&(v=a(f[Z]),!v);Z++);if(v==="+"&&e>1&&n[e-2]===" ")throw new Error("Space before `+`");return v&&{type:"OPERATOR",string:v}}function t(){return a(/[A-Za-z0-9-.]+/)}function o(){var v=t();if(!v)throw new Error("Expected idstring at offset "+e);return v}function d(){if(a("DocumentRef-")){var v=o();return{type:"DOCUMENTREF",string:v}}}function I(){if(a("LicenseRef-")){var v=o();return{type:"LICENSEREF",string:v}}}function u(){var v=e,f=t();if(M7a.indexOf(f)!==-1)return{type:"LICENSE",string:f};if(z7a.indexOf(f)!==-1)return{type:"EXCEPTION",string:f};e=v}function h(){return s()||d()||I()||u()}for(var c=[];r()&&(i(),!!r());){var m=h();if(!m)throw new Error("Unexpected `"+n[e]+"` at offset "+e);c.push(m)}return c}});var V8r=Oe((UDs,Y8r)=>{"use strict";Y8r.exports=function(n){var e=0;function r(){return e<n.length}function a(){return r()?n[e]:null}function i(){if(!r())throw new Error;e++}function s(f){var Z=a();if(Z&&Z.type==="OPERATOR"&&f===Z.string)return i(),Z.string}function t(){if(s("WITH")){var f=a();if(f&&f.type==="EXCEPTION")return i(),f.string;throw new Error("Expected exception after `WITH`")}}function o(){var f=e,Z="",y=a();if(y.type==="DOCUMENTREF"&&(i(),Z+="DocumentRef-"+y.string+":",!s(":")))throw new Error("Expected `:` after `DocumentRef-...`");if(y=a(),y.type==="LICENSEREF")return i(),Z+="LicenseRef-"+y.string,{license:Z};e=f}function d(){var f=a();if(f&&f.type==="LICENSE"){i();var Z={license:f.string};s("+")&&(Z.plus=!0);var y=t();return y&&(Z.exception=y),Z}}function I(){var f=s("(");if(f){var Z=m();if(!s(")"))throw new Error("Expected `)`");return Z}}function u(){return I()||o()||d()}function h(f,Z){return function y(){var A=Z();if(A){if(!s(f))return A;var w=y();if(!w)throw new Error("Expected expression");return{left:A,conjunction:f.toLowerCase(),right:w}}}}var c=h("AND",u),m=h("OR",c),v=m();if(!v||r())throw new Error("Syntax error");return v}});var vWt=Oe((MDs,k8r)=>{"use strict";var _7a=C8r(),P7a=V8r();k8r.exports=function(n){return P7a(_7a(n))}});var D8r=Oe((zDs,B8r)=>{var j7a=vWt(),q7a=GWt();function tXe(n){try{return j7a(n),!0}catch{return!1}}function T8r(n,e){var r=e[0].length-n[0].length;return r!==0?r:n[0].toUpperCase().localeCompare(e[0].toUpperCase())}var Q8r=[["APGL","AGPL"],["Gpl","GPL"],["GLP","GPL"],["APL","Apache"],["ISD","ISC"],["GLP","GPL"],["IST","ISC"],["Claude","Clause"],[" or later","+"],[" International",""],["GNU","GPL"],["GUN","GPL"],["+",""],["GNU GPL","GPL"],["GNU LGPL","LGPL"],["GNU/GPL","GPL"],["GNU GLP","GPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL"],["GNU Lesser General Public License","LGPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["GNU Lesser General Public License","LGPL-2.1"],["LESSER GENERAL PUBLIC LICENSE","LGPL"],["Lesser General Public License","LGPL"],["LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["Lesser General Public License","LGPL-2.1"],["GNU General Public License","GPL"],["Gnu public license","GPL"],["GNU Public License","GPL"],["GNU GENERAL PUBLIC LICENSE","GPL"],["MTI","MIT"],["Mozilla Public License","MPL"],["Universal Permissive License","UPL"],["WTH","WTF"],["WTFGPL","WTFPL"],["-License",""]].sort(T8r),K7a=0,$7a=1,H8r=[function(n){return n.toUpperCase()},function(n){return n.trim()},function(n){return n.replace(/\./g,"")},function(n){return n.replace(/\s+/g,"")},function(n){return n.replace(/\s+/g,"-")},function(n){return n.replace("v","-")},function(n){return n.replace(/,?\s*(\d)/,"-$1")},function(n){return n.replace(/,?\s*(\d)/,"-$1.0")},function(n){return n.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(n){return n.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(n){return n[0].toUpperCase()+n.slice(1)},function(n){return n.replace("/","-")},function(n){return n.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(n){return n.indexOf("3.0")!==-1?n+"-or-later":n+"-only"},function(n){return n+"only"},function(n){return n.replace(/(\d)$/,"-$1.0")},function(n){return n.replace(/(-| )?(\d)$/,"-$2-Clause")},function(n){return n.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(n){return n.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(n){return n.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(n){return n.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(n){return n.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(n){return n.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(n){return"CC-"+n},function(n){return"CC-"+n+"-4.0"},function(n){return n.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(n){return"CC-"+n.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],yWt=q7a.map(function(n){var e=/^(.*)-\d+\.\d+$/.exec(n);return e?[e[0],e[1]]:[n,null]}).reduce(function(n,e){var r=e[1];return n[r]=n[r]||[],n[r].push(e[0]),n},{}),eza=Object.keys(yWt).map(function(e){return[e,yWt[e]]}).filter(function(e){return e[1].length===1&&e[0]!==null&&e[0]!=="APL"}).map(function(e){return[e[0],e[1][0]]});yWt=void 0;var X8r=[["UNLI","Unlicense"],["WTF","WTFPL"],["2 CLAUSE","BSD-2-Clause"],["2-CLAUSE","BSD-2-Clause"],["3 CLAUSE","BSD-3-Clause"],["3-CLAUSE","BSD-3-Clause"],["AFFERO","AGPL-3.0-or-later"],["AGPL","AGPL-3.0-or-later"],["APACHE","Apache-2.0"],["ARTISTIC","Artistic-2.0"],["Affero","AGPL-3.0-or-later"],["BEER","Beerware"],["BOOST","BSL-1.0"],["BSD","BSD-2-Clause"],["CDDL","CDDL-1.1"],["ECLIPSE","EPL-1.0"],["FUCK","WTFPL"],["GNU","GPL-3.0-or-later"],["LGPL","LGPL-3.0-or-later"],["GPLV1","GPL-1.0-only"],["GPL-1","GPL-1.0-only"],["GPLV2","GPL-2.0-only"],["GPL-2","GPL-2.0-only"],["GPL","GPL-3.0-or-later"],["MIT +NO-FALSE-ATTRIBS","MITNFA"],["MIT","MIT"],["MPL","MPL-2.0"],["X11","X11"],["ZLIB","Zlib"]].concat(eza).sort(T8r),tza=0,rza=1,S8r=function(n){for(var e=0;e<H8r.length;e++){var r=H8r[e](n).trim();if(r!==n&&tXe(r))return r}return null},L8r=function(n){for(var e=n.toUpperCase(),r=0;r<X8r.length;r++){var a=X8r[r];if(e.indexOf(a[tza])>-1)return a[rza]}return null},J8r=function(n,e){for(var r=0;r<Q8r.length;r++){var a=Q8r[r],i=a[K7a];if(n.indexOf(i)>-1){var s=n.replace(i,a[$7a]),t=e(s);if(t!==null)return t}}return null};B8r.exports=function(n,e){e=e||{};var r=e.upgrade===void 0?!0:!!e.upgrade;function a(o){return r?nza(o):o}var i=typeof n=="string"&&n.trim().length!==0;if(!i)throw Error("Invalid argument. Expected non-empty string.");if(n=n.trim(),tXe(n))return a(n);var s=n.replace(/\+$/,"").trim();if(tXe(s))return a(s);var t=S8r(n);return t!==null||(t=J8r(n,function(o){return tXe(o)?o:S8r(o)}),t!==null)||(t=L8r(n),t!==null)||(t=J8r(n,L8r),t!==null)?a(t):null};function nza(n){return["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(n)!==-1?n+"-only":["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(n)!==-1?n.replace(/\+$/,"-or-later"):["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(n)!==-1?n+"-or-later":n}});var z8r=Oe((_Ds,M8r)=>{var aza=vWt(),iza=D8r(),O8r='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',sza=/^SEE LICEN[CS]E IN (.+)$/;function U8r(n,e){return e.slice(0,n.length)===n}function ZWt(n){if(n.hasOwnProperty("license")){var e=n.license;return U8r("LicenseRef",e)||U8r("DocumentRef",e)}else return ZWt(n.left)||ZWt(n.right)}M8r.exports=function(n){var e;try{e=aza(n)}catch{var r;if(n==="UNLICENSED"||n==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(r=sza.exec(n))return{validForOldPackages:!0,validForNewPackages:!0,inFile:r[1]};var a={validForOldPackages:!1,validForNewPackages:!1,warnings:[O8r]};if(n.trim().length!==0){var i=iza(n);i&&a.warnings.push('license is similar to the valid expression "'+i+'"')}return a}return ZWt(e)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[O8r]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}});var K8r=Oe(nXe=>{"use strict";Object.defineProperty(nXe,"__esModule",{value:!0});nXe.LRUCache=void 0;var U$=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,P8r=new Set,NWt=typeof process=="object"&&process?process:{},j8r=(n,e,r,a)=>{typeof NWt.emitWarning=="function"?NWt.emitWarning(n,e,r,a):console.error(`[${r}] ${e}: ${n}`)},rXe=globalThis.AbortController,_8r=globalThis.AbortSignal;if(typeof rXe>"u"){_8r=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(a,i){this._onabort.push(i)}},rXe=class{constructor(){e()}signal=new _8r;abort(a){if(!this.signal.aborted){this.signal.reason=a,this.signal.aborted=!0;for(let i of this.signal._onabort)i(a);this.signal.onabort?.(a)}}};let n=NWt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{n&&(n=!1,j8r("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var oza=n=>!P8r.has(n),qDs=Symbol("type"),MH=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),q8r=n=>MH(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?M$:null:null,M$=class extends Array{constructor(e){super(e),this.fill(0)}},WWt=class n{heap;length;static#e=!1;static create(e){let r=q8r(e);if(!r)return[];n.#e=!0;let a=new n(e,r);return n.#e=!1,a}constructor(e,r){if(!n.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},FWt=class n{#e;#t;#r;#n;#a;#i;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#o;#s;#I;#d;#h;#l;#m;#f;#g;#p;#N;#y;#W;#F;#v;#G;static unsafeExposeInternals(e){return{starts:e.#y,ttls:e.#W,sizes:e.#N,keyMap:e.#s,keyList:e.#I,valList:e.#d,next:e.#h,prev:e.#l,get head(){return e.#m},get tail(){return e.#f},free:e.#g,isBackgroundFetch:r=>e.#Z(r),backgroundFetch:(r,a,i,s)=>e.#C(r,a,i,s),moveToTail:r=>e.#D(r),indexes:r=>e.#L(r),rindexes:r=>e.#V(r),isStale:r=>e.#A(r)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#o}get size(){return this.#c}get fetchMethod(){return this.#a}get memoMethod(){return this.#i}get dispose(){return this.#r}get disposeAfter(){return this.#n}constructor(e){let{max:r=0,ttl:a,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:t,updateAgeOnHas:o,allowStale:d,dispose:I,disposeAfter:u,noDisposeOnSet:h,noUpdateTTL:c,maxSize:m=0,maxEntrySize:v=0,sizeCalculation:f,fetchMethod:Z,memoMethod:y,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:w,allowStaleOnFetchRejection:R,allowStaleOnFetchAbort:b,ignoreFetchAbort:N}=e;if(r!==0&&!MH(r))throw new TypeError("max option must be a nonnegative integer");let F=r?q8r(r):Array;if(!F)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=m,this.maxEntrySize=v||this.#t,this.sizeCalculation=f,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#i=y,Z!==void 0&&typeof Z!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#a=Z,this.#v=!!Z,this.#s=new Map,this.#I=new Array(r).fill(void 0),this.#d=new Array(r).fill(void 0),this.#h=new F(r),this.#l=new F(r),this.#m=0,this.#f=0,this.#g=WWt.create(r),this.#c=0,this.#o=0,typeof I=="function"&&(this.#r=I),typeof u=="function"?(this.#n=u,this.#p=[]):(this.#n=void 0,this.#p=void 0),this.#F=!!this.#r,this.#G=!!this.#n,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!c,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!R,this.allowStaleOnFetchAbort=!!b,this.ignoreFetchAbort=!!N,this.maxEntrySize!==0){if(this.#t!==0&&!MH(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!MH(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#x()}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!w,this.updateAgeOnGet=!!t,this.updateAgeOnHas=!!o,this.ttlResolution=MH(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=a||0,this.ttl){if(!MH(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#w()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let E="LRU_CACHE_UNBOUNDED";oza(E)&&(P8r.add(E),j8r("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",E,n))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#w(){let e=new M$(this.#e),r=new M$(this.#e);this.#W=e,this.#y=r,this.#Q=(s,t,o=U$.now())=>{if(r[s]=t!==0?o:0,e[s]=t,t!==0&&this.ttlAutopurge){let d=setTimeout(()=>{this.#A(s)&&this.#X(this.#I[s],"expire")},t+1);d.unref&&d.unref()}},this.#E=s=>{r[s]=e[s]!==0?U$.now():0},this.#u=(s,t)=>{if(e[t]){let o=e[t],d=r[t];if(!o||!d)return;s.ttl=o,s.start=d,s.now=a||i();let I=s.now-d;s.remainingTTL=o-I}};let a=0,i=()=>{let s=U$.now();if(this.ttlResolution>0){a=s;let t=setTimeout(()=>a=0,this.ttlResolution);t.unref&&t.unref()}return s};this.getRemainingTTL=s=>{let t=this.#s.get(s);if(t===void 0)return 0;let o=e[t],d=r[t];if(!o||!d)return 1/0;let I=(a||i())-d;return o-I},this.#A=s=>{let t=r[s],o=e[s];return!!o&&!!t&&(a||i())-t>o}}#E=()=>{};#u=()=>{};#Q=()=>{};#A=()=>!1;#x(){let e=new M$(this.#e);this.#o=0,this.#N=e,this.#Y=r=>{this.#o-=e[r],e[r]=0},this.#R=(r,a,i,s)=>{if(this.#Z(a))return 0;if(!MH(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(a,r),!MH(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#S=(r,a,i)=>{if(e[r]=a,this.#t){let s=this.#t-e[r];for(;this.#o>s;)this.#J(!0)}this.#o+=e[r],i&&(i.entrySize=a,i.totalCalculatedSize=this.#o)}}#Y=e=>{};#S=(e,r,a)=>{};#R=(e,r,a,i)=>{if(a||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#L({allowStale:e=this.allowStale}={}){if(this.#c)for(let r=this.#f;!(!this.#H(r)||((e||!this.#A(r))&&(yield r),r===this.#m));)r=this.#l[r]}*#V({allowStale:e=this.allowStale}={}){if(this.#c)for(let r=this.#m;!(!this.#H(r)||((e||!this.#A(r))&&(yield r),r===this.#f));)r=this.#h[r]}#H(e){return e!==void 0&&this.#s.get(this.#I[e])===e}*entries(){for(let e of this.#L())this.#d[e]!==void 0&&this.#I[e]!==void 0&&!this.#Z(this.#d[e])&&(yield[this.#I[e],this.#d[e]])}*rentries(){for(let e of this.#V())this.#d[e]!==void 0&&this.#I[e]!==void 0&&!this.#Z(this.#d[e])&&(yield[this.#I[e],this.#d[e]])}*keys(){for(let e of this.#L()){let r=this.#I[e];r!==void 0&&!this.#Z(this.#d[e])&&(yield r)}}*rkeys(){for(let e of this.#V()){let r=this.#I[e];r!==void 0&&!this.#Z(this.#d[e])&&(yield r)}}*values(){for(let e of this.#L())this.#d[e]!==void 0&&!this.#Z(this.#d[e])&&(yield this.#d[e])}*rvalues(){for(let e of this.#V())this.#d[e]!==void 0&&!this.#Z(this.#d[e])&&(yield this.#d[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let a of this.#L()){let i=this.#d[a],s=this.#Z(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#I[a],this))return this.get(this.#I[a],r)}}forEach(e,r=this){for(let a of this.#L()){let i=this.#d[a],s=this.#Z(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#I[a],this)}}rforEach(e,r=this){for(let a of this.#V()){let i=this.#d[a],s=this.#Z(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#I[a],this)}}purgeStale(){let e=!1;for(let r of this.#V({allowStale:!0}))this.#A(r)&&(this.#X(this.#I[r],"expire"),e=!0);return e}info(e){let r=this.#s.get(e);if(r===void 0)return;let a=this.#d[r],i=this.#Z(a)?a.__staleWhileFetching:a;if(i===void 0)return;let s={value:i};if(this.#W&&this.#y){let t=this.#W[r],o=this.#y[r];if(t&&o){let d=t-(U$.now()-o);s.ttl=d,s.start=Date.now()}}return this.#N&&(s.size=this.#N[r]),s}dump(){let e=[];for(let r of this.#L({allowStale:!0})){let a=this.#I[r],i=this.#d[r],s=this.#Z(i)?i.__staleWhileFetching:i;if(s===void 0||a===void 0)continue;let t={value:s};if(this.#W&&this.#y){t.ttl=this.#W[r];let o=U$.now()-this.#y[r];t.start=Math.floor(Date.now()-o)}this.#N&&(t.size=this.#N[r]),e.unshift([a,t])}return e}load(e){this.clear();for(let[r,a]of e){if(a.start){let i=Date.now()-a.start;a.start=U$.now()-i}this.set(r,a.value,a)}}set(e,r,a={}){if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:t=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:d}=a,{noUpdateTTL:I=this.noUpdateTTL}=a,u=this.#R(e,r,a.size||0,o);if(this.maxEntrySize&&u>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=!0),this.#X(e,"set"),this;let h=this.#c===0?void 0:this.#s.get(e);if(h===void 0)h=this.#c===0?this.#f:this.#g.length!==0?this.#g.pop():this.#c===this.#e?this.#J(!1):this.#c,this.#I[h]=e,this.#d[h]=r,this.#s.set(e,h),this.#h[this.#f]=h,this.#l[h]=this.#f,this.#f=h,this.#c++,this.#S(h,u,d),d&&(d.set="add"),I=!1;else{this.#D(h);let c=this.#d[h];if(r!==c){if(this.#v&&this.#Z(c)){c.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=c;m!==void 0&&!t&&(this.#F&&this.#r?.(m,e,"set"),this.#G&&this.#p?.push([m,e,"set"]))}else t||(this.#F&&this.#r?.(c,e,"set"),this.#G&&this.#p?.push([c,e,"set"]));if(this.#Y(h),this.#S(h,u,d),this.#d[h]=r,d){d.set="replace";let m=c&&this.#Z(c)?c.__staleWhileFetching:c;m!==void 0&&(d.oldValue=m)}}else d&&(d.set="update")}if(i!==0&&!this.#W&&this.#w(),this.#W&&(I||this.#Q(h,i,s),d&&this.#u(d,h)),!t&&this.#G&&this.#p){let c=this.#p,m;for(;m=c?.shift();)this.#n?.(...m)}return this}pop(){try{for(;this.#c;){let e=this.#d[this.#m];if(this.#J(!0),this.#Z(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#G&&this.#p){let e=this.#p,r;for(;r=e?.shift();)this.#n?.(...r)}}}#J(e){let r=this.#m,a=this.#I[r],i=this.#d[r];return this.#v&&this.#Z(i)?i.__abortController.abort(new Error("evicted")):(this.#F||this.#G)&&(this.#F&&this.#r?.(i,a,"evict"),this.#G&&this.#p?.push([i,a,"evict"])),this.#Y(r),e&&(this.#I[r]=void 0,this.#d[r]=void 0,this.#g.push(r)),this.#c===1?(this.#m=this.#f=0,this.#g.length=0):this.#m=this.#h[r],this.#s.delete(a),this.#c--,r}has(e,r={}){let{updateAgeOnHas:a=this.updateAgeOnHas,status:i}=r,s=this.#s.get(e);if(s!==void 0){let t=this.#d[s];if(this.#Z(t)&&t.__staleWhileFetching===void 0)return!1;if(this.#A(s))i&&(i.has="stale",this.#u(i,s));else return a&&this.#E(s),i&&(i.has="hit",this.#u(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:a=this.allowStale}=r,i=this.#s.get(e);if(i===void 0||!a&&this.#A(i))return;let s=this.#d[i];return this.#Z(s)?s.__staleWhileFetching:s}#C(e,r,a,i){let s=r===void 0?void 0:this.#d[r];if(this.#Z(s))return s;let t=new rXe,{signal:o}=a;o?.addEventListener("abort",()=>t.abort(o.reason),{signal:t.signal});let d={signal:t.signal,options:a,context:i},I=(f,Z=!1)=>{let{aborted:y}=t.signal,A=a.ignoreFetchAbort&&f!==void 0;if(a.status&&(y&&!Z?(a.status.fetchAborted=!0,a.status.fetchError=t.signal.reason,A&&(a.status.fetchAbortIgnored=!0)):a.status.fetchResolved=!0),y&&!A&&!Z)return h(t.signal.reason);let w=m;return this.#d[r]===m&&(f===void 0?w.__staleWhileFetching?this.#d[r]=w.__staleWhileFetching:this.#X(e,"fetch"):(a.status&&(a.status.fetchUpdated=!0),this.set(e,f,d.options))),f},u=f=>(a.status&&(a.status.fetchRejected=!0,a.status.fetchError=f),h(f)),h=f=>{let{aborted:Z}=t.signal,y=Z&&a.allowStaleOnFetchAbort,A=y||a.allowStaleOnFetchRejection,w=A||a.noDeleteOnFetchRejection,R=m;if(this.#d[r]===m&&(!w||R.__staleWhileFetching===void 0?this.#X(e,"fetch"):y||(this.#d[r]=R.__staleWhileFetching)),A)return a.status&&R.__staleWhileFetching!==void 0&&(a.status.returnedStale=!0),R.__staleWhileFetching;if(R.__returned===R)throw f},c=(f,Z)=>{let y=this.#a?.(e,s,d);y&&y instanceof Promise&&y.then(A=>f(A===void 0?void 0:A),Z),t.signal.addEventListener("abort",()=>{(!a.ignoreFetchAbort||a.allowStaleOnFetchAbort)&&(f(void 0),a.allowStaleOnFetchAbort&&(f=A=>I(A,!0)))})};a.status&&(a.status.fetchDispatched=!0);let m=new Promise(c).then(I,u),v=Object.assign(m,{__abortController:t,__staleWhileFetching:s,__returned:void 0});return r===void 0?(this.set(e,v,{...d.options,status:void 0}),r=this.#s.get(e)):this.#d[r]=v,v}#Z(e){if(!this.#v)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof rXe}async fetch(e,r={}){let{allowStale:a=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:t=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:d=0,sizeCalculation:I=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:c=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:v=this.allowStaleOnFetchAbort,context:f,forceRefresh:Z=!1,status:y,signal:A}=r;if(!this.#v)return y&&(y.fetch="get"),this.get(e,{allowStale:a,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:y});let w={allowStale:a,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:t,noDisposeOnSet:o,size:d,sizeCalculation:I,noUpdateTTL:u,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:v,ignoreFetchAbort:m,status:y,signal:A},R=this.#s.get(e);if(R===void 0){y&&(y.fetch="miss");let b=this.#C(e,R,w,f);return b.__returned=b}else{let b=this.#d[R];if(this.#Z(b)){let g=a&&b.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",g&&(y.returnedStale=!0)),g?b.__staleWhileFetching:b.__returned=b}let N=this.#A(R);if(!Z&&!N)return y&&(y.fetch="hit"),this.#D(R),i&&this.#E(R),y&&this.#u(y,R),b;let F=this.#C(e,R,w,f),p=F.__staleWhileFetching!==void 0&&a;return y&&(y.fetch=N?"stale":"refresh",p&&N&&(y.returnedStale=!0)),p?F.__staleWhileFetching:F.__returned=F}}async forceFetch(e,r={}){let a=await this.fetch(e,r);if(a===void 0)throw new Error("fetch() returned undefined");return a}memo(e,r={}){let a=this.#i;if(!a)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...t}=r,o=this.get(e,t);if(!s&&o!==void 0)return o;let d=a(e,o,{options:t,context:i});return this.set(e,d,t),d}get(e,r={}){let{allowStale:a=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:t}=r,o=this.#s.get(e);if(o!==void 0){let d=this.#d[o],I=this.#Z(d);return t&&this.#u(t,o),this.#A(o)?(t&&(t.get="stale"),I?(t&&a&&d.__staleWhileFetching!==void 0&&(t.returnedStale=!0),a?d.__staleWhileFetching:void 0):(s||this.#X(e,"expire"),t&&a&&(t.returnedStale=!0),a?d:void 0)):(t&&(t.get="hit"),I?d.__staleWhileFetching:(this.#D(o),i&&this.#E(o),d))}else t&&(t.get="miss")}#B(e,r){this.#l[r]=e,this.#h[e]=r}#D(e){e!==this.#f&&(e===this.#m?this.#m=this.#h[e]:this.#B(this.#l[e],this.#h[e]),this.#B(this.#f,e),this.#f=e)}delete(e){return this.#X(e,"delete")}#X(e,r){let a=!1;if(this.#c!==0){let i=this.#s.get(e);if(i!==void 0)if(a=!0,this.#c===1)this.#b(r);else{this.#Y(i);let s=this.#d[i];if(this.#Z(s)?s.__abortController.abort(new Error("deleted")):(this.#F||this.#G)&&(this.#F&&this.#r?.(s,e,r),this.#G&&this.#p?.push([s,e,r])),this.#s.delete(e),this.#I[i]=void 0,this.#d[i]=void 0,i===this.#f)this.#f=this.#l[i];else if(i===this.#m)this.#m=this.#h[i];else{let t=this.#l[i];this.#h[t]=this.#h[i];let o=this.#h[i];this.#l[o]=this.#l[i]}this.#c--,this.#g.push(i)}}if(this.#G&&this.#p?.length){let i=this.#p,s;for(;s=i?.shift();)this.#n?.(...s)}return a}clear(){return this.#b("delete")}#b(e){for(let r of this.#V({allowStale:!0})){let a=this.#d[r];if(this.#Z(a))a.__abortController.abort(new Error("deleted"));else{let i=this.#I[r];this.#F&&this.#r?.(a,i,e),this.#G&&this.#p?.push([a,i,e])}}if(this.#s.clear(),this.#d.fill(void 0),this.#I.fill(void 0),this.#W&&this.#y&&(this.#W.fill(0),this.#y.fill(0)),this.#N&&this.#N.fill(0),this.#m=0,this.#f=0,this.#g.length=0,this.#o=0,this.#c=0,this.#G&&this.#p){let r=this.#p,a;for(;a=r?.shift();)this.#n?.(...a)}}};nXe.LRUCache=FWt});var tUr=Oe(($Ds,eUr)=>{"use strict";var Tl=(...n)=>n.every(e=>e)?n.join(""):"",um=n=>n?encodeURIComponent(n):"",$8r=n=>n.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-"),lza={sshtemplate:({domain:n,user:e,project:r,committish:a})=>`git@${n}:${e}/${r}.git${Tl("#",a)}`,sshurltemplate:({domain:n,user:e,project:r,committish:a})=>`git+ssh://git@${n}/${e}/${r}.git${Tl("#",a)}`,edittemplate:({domain:n,user:e,project:r,committish:a,editpath:i,path:s})=>`https://${n}/${e}/${r}${Tl("/",i,"/",um(a||"HEAD"),"/",s)}`,browsetemplate:({domain:n,user:e,project:r,committish:a,treepath:i})=>`https://${n}/${e}/${r}${Tl("/",i,"/",um(a))}`,browsetreetemplate:({domain:n,user:e,project:r,committish:a,treepath:i,path:s,fragment:t,hashformat:o})=>`https://${n}/${e}/${r}/${i}/${um(a||"HEAD")}/${s}${Tl("#",o(t||""))}`,browseblobtemplate:({domain:n,user:e,project:r,committish:a,blobpath:i,path:s,fragment:t,hashformat:o})=>`https://${n}/${e}/${r}/${i}/${um(a||"HEAD")}/${s}${Tl("#",o(t||""))}`,docstemplate:({domain:n,user:e,project:r,treepath:a,committish:i})=>`https://${n}/${e}/${r}${Tl("/",a,"/",um(i))}#readme`,httpstemplate:({auth:n,domain:e,user:r,project:a,committish:i})=>`git+https://${Tl(n,"@")}${e}/${r}/${a}.git${Tl("#",i)}`,filetemplate:({domain:n,user:e,project:r,committish:a,path:i})=>`https://${n}/${e}/${r}/raw/${um(a||"HEAD")}/${i}`,shortcuttemplate:({type:n,user:e,project:r,committish:a})=>`${n}:${e}/${r}${Tl("#",a)}`,pathtemplate:({user:n,project:e,committish:r})=>`${n}/${e}${Tl("#",r)}`,bugstemplate:({domain:n,user:e,project:r})=>`https://${n}/${e}/${r}/issues`,hashformat:$8r},zH={};zH.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:n,user:e,project:r,committish:a,path:i})=>`https://${Tl(n,"@")}raw.githubusercontent.com/${e}/${r}/${um(a||"HEAD")}/${i}`,gittemplate:({auth:n,domain:e,user:r,project:a,committish:i})=>`git://${Tl(n,"@")}${e}/${r}/${a}.git${Tl("#",i)}`,tarballtemplate:({domain:n,user:e,project:r,committish:a})=>`https://codeload.${n}/${e}/${r}/tar.gz/${um(a||"HEAD")}`,extract:n=>{let[,e,r,a,i]=n.pathname.split("/",5);if(!(a&&a!=="tree")&&(a||(i=n.hash.slice(1)),r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:i}}};zH.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:n,user:e,project:r,committish:a,treepath:i,path:s,editpath:t})=>`https://${n}/${e}/${r}${Tl("/",i,"/",um(a||"HEAD"),"/",s,t)}`,tarballtemplate:({domain:n,user:e,project:r,committish:a})=>`https://${n}/${e}/${r}/get/${um(a||"HEAD")}.tar.gz`,extract:n=>{let[,e,r,a]=n.pathname.split("/",4);if(!["get"].includes(a)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:n.hash.slice(1)}}};zH.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",httpstemplate:({auth:n,domain:e,user:r,project:a,committish:i})=>`git+https://${Tl(n,"@")}${e}/${r}/${a}.git${Tl("#",i)}`,tarballtemplate:({domain:n,user:e,project:r,committish:a})=>`https://${n}/${e}/${r}/repository/archive.tar.gz?ref=${um(a||"HEAD")}`,extract:n=>{let e=n.pathname.slice(1);if(e.includes("/-/")||e.includes("/archive.tar.gz"))return;let r=e.split("/"),a=r.pop();a.endsWith(".git")&&(a=a.slice(0,-4));let i=r.join("/");if(!(!i||!a))return{user:i,project:a,committish:n.hash.slice(1)}}};zH.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:n,project:e,committish:r})=>`git@${n}:${e}.git${Tl("#",r)}`,sshurltemplate:({domain:n,project:e,committish:r})=>`git+ssh://git@${n}/${e}.git${Tl("#",r)}`,edittemplate:({domain:n,user:e,project:r,committish:a,editpath:i})=>`https://${n}/${e}/${r}${Tl("/",um(a))}/${i}`,browsetemplate:({domain:n,project:e,committish:r})=>`https://${n}/${e}${Tl("/",um(r))}`,browsetreetemplate:({domain:n,project:e,committish:r,path:a,hashformat:i})=>`https://${n}/${e}${Tl("/",um(r))}${Tl("#",i(a))}`,browseblobtemplate:({domain:n,project:e,committish:r,path:a,hashformat:i})=>`https://${n}/${e}${Tl("/",um(r))}${Tl("#",i(a))}`,docstemplate:({domain:n,project:e,committish:r})=>`https://${n}/${e}${Tl("/",um(r))}`,httpstemplate:({domain:n,project:e,committish:r})=>`git+https://${n}/${e}.git${Tl("#",r)}`,filetemplate:({user:n,project:e,committish:r,path:a})=>`https://gist.githubusercontent.com/${n}/${e}/raw${Tl("/",um(r))}/${a}`,shortcuttemplate:({type:n,project:e,committish:r})=>`${n}:${e}${Tl("#",r)}`,pathtemplate:({project:n,committish:e})=>`${n}${Tl("#",e)}`,bugstemplate:({domain:n,project:e})=>`https://${n}/${e}`,gittemplate:({domain:n,project:e,committish:r})=>`git://${n}/${e}.git${Tl("#",r)}`,tarballtemplate:({project:n,committish:e})=>`https://codeload.github.com/gist/${n}/tar.gz/${um(e||"HEAD")}`,extract:n=>{let[,e,r,a]=n.pathname.split("/",4);if(a!=="raw"){if(!r){if(!e)return;r=e,e=null}return r.endsWith(".git")&&(r=r.slice(0,-4)),{user:e,project:r,committish:n.hash.slice(1)}}},hashformat:function(n){return n&&"file-"+$8r(n)}};zH.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:n,user:e,project:r,committish:a,path:i})=>`https://${n}/${e}/${r}/blob/${um(a)||"HEAD"}/${i}`,httpstemplate:({domain:n,user:e,project:r,committish:a})=>`https://${n}/${e}/${r}.git${Tl("#",a)}`,tarballtemplate:({domain:n,user:e,project:r,committish:a})=>`https://${n}/${e}/${r}/archive/${um(a)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:n=>{let[,e,r,a]=n.pathname.split("/",4);if(!["archive"].includes(a)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:n.hash.slice(1)}}};for(let[n,e]of Object.entries(zH))zH[n]=Object.assign({},lza,e);eUr.exports=zH});var RWt=Oe((eOs,nUr)=>{var cza=Qt("url"),wWt=(n,e,r)=>{let a=n.indexOf(r);return n.lastIndexOf(e,a>-1?a:1/0)},rUr=n=>{try{return new cza.URL(n)}catch{}},uza=(n,e)=>{let r=n.indexOf(":"),a=n.slice(0,r+1);if(Object.prototype.hasOwnProperty.call(e,a))return n;let i=n.indexOf("@");return i>-1?i>r?`git+ssh://${n}`:n:n.indexOf("//")===r+1?n:`${n.slice(0,r+1)}//${n.slice(r+1)}`},dza=n=>{let e=wWt(n,"@","#"),r=wWt(n,":","#");return r>e&&(n=n.slice(0,r)+"/"+n.slice(r+1)),wWt(n,":","#")===-1&&n.indexOf("//")===-1&&(n=`git+ssh://${n}`),n};nUr.exports=(n,e)=>{let r=e?uza(n,e):n;return rUr(r)||rUr(dza(r))}});var iUr=Oe((tOs,aUr)=>{"use strict";var Iza=RWt(),hza=n=>{let e=n.indexOf("#"),r=n.indexOf("/"),a=n.indexOf("/",r+1),i=n.indexOf(":"),s=/\s/.exec(n),t=n.indexOf("@"),o=!s||e>-1&&s.index>e,d=t===-1||e>-1&&t>e,I=i===-1||e>-1&&i>e,u=a===-1||e>-1&&a>e,h=r>0,c=e>-1?n[e-1]!=="/":!n.endsWith("/"),m=!n.startsWith(".");return o&&h&&c&&m&&d&&I&&u};aUr.exports=(n,e,{gitHosts:r,protocols:a})=>{if(!n)return;let i=hza(n)?`github:${n}`:n,s=Iza(i,a);if(!s)return;let t=r.byShortcut[s.protocol],o=r.byDomain[s.hostname.startsWith("www.")?s.hostname.slice(4):s.hostname],d=t||o;if(!d)return;let I=r[t||o],u=null;a[s.protocol]?.auth&&(s.username||s.password)&&(u=`${s.username}${s.password?":"+s.password:""}`);let h=null,c=null,m=null,v=null;try{if(t){let f=s.pathname.startsWith("/")?s.pathname.slice(1):s.pathname,Z=f.indexOf("@");Z>-1&&(f=f.slice(Z+1));let y=f.lastIndexOf("/");y>-1?(c=decodeURIComponent(f.slice(0,y)),c||(c=null),m=decodeURIComponent(f.slice(y+1))):m=decodeURIComponent(f),m.endsWith(".git")&&(m=m.slice(0,-4)),s.hash&&(h=decodeURIComponent(s.hash.slice(1))),v="shortcut"}else{if(!I.protocols.includes(s.protocol))return;let f=I.extract(s);if(!f)return;c=f.user&&decodeURIComponent(f.user),m=decodeURIComponent(f.project),h=decodeURIComponent(f.committish),v=a[s.protocol]?.name||s.protocol.slice(0,-1)}}catch(f){if(f instanceof URIError)return;throw f}return[d,c,u,m,h,v,e]}});var oUr=Oe((rOs,sUr)=>{"use strict";var{LRUCache:mza}=K8r(),pza=tUr(),fza=iUr(),bza=RWt(),EWt=new mza({max:1e3}),aXe=class n{constructor(e,r,a,i,s,t,o={}){Object.assign(this,n.#e[e],{type:e,user:r,auth:a,project:i,committish:s,default:t,opts:o})}static#e={byShortcut:{},byDomain:{}};static#t={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(e,r){n.#e[e]=r,n.#e.byDomain[r.domain]=e,n.#e.byShortcut[`${e}:`]=e,n.#t[`${e}:`]={name:e}}static fromUrl(e,r){if(typeof e!="string")return;let a=e+JSON.stringify(r||{});if(!EWt.has(a)){let i=fza(e,r,{gitHosts:n.#e,protocols:n.#t});EWt.set(a,i?new n(...i):void 0)}return EWt.get(a)}static parseUrl(e){return bza(e)}#r(e,r){if(typeof e!="function")return null;let a={...this,...this.opts,...r};a.path||(a.path=""),a.path.startsWith("/")&&(a.path=a.path.slice(1)),a.noCommittish&&(a.committish=null);let i=e(a);return a.noGitPlus&&i.startsWith("git+")?i.slice(4):i}hash(){return this.committish?`#${this.committish}`:""}ssh(e){return this.#r(this.sshtemplate,e)}sshurl(e){return this.#r(this.sshurltemplate,e)}browse(e,...r){return typeof e!="string"?this.#r(this.browsetemplate,e):typeof r[0]!="string"?this.#r(this.browsetreetemplate,{...r[0],path:e}):this.#r(this.browsetreetemplate,{...r[1],fragment:r[0],path:e})}browseFile(e,...r){return typeof r[0]!="string"?this.#r(this.browseblobtemplate,{...r[0],path:e}):this.#r(this.browseblobtemplate,{...r[1],fragment:r[0],path:e})}docs(e){return this.#r(this.docstemplate,e)}bugs(e){return this.#r(this.bugstemplate,e)}https(e){return this.#r(this.httpstemplate,e)}git(e){return this.#r(this.gittemplate,e)}shortcut(e){return this.#r(this.shortcuttemplate,e)}path(e){return this.#r(this.pathtemplate,e)}tarball(e){return this.#r(this.tarballtemplate,{...e,noCommittish:!1})}file(e,r){return this.#r(this.filetemplate,{...r,path:e})}edit(e,r){return this.#r(this.edittemplate,{...r,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&typeof this[this.default]=="function"?this[this.default](e):this.sshurl(e)}};for(let[n,e]of Object.entries(pza))aXe.addHost(n,e);sUr.exports=aXe});var cUr=Oe((nOs,lUr)=>{lUr.exports=gza;function gza(n){if(!n||n==="ERROR: No README data found!")return;n=n.trim().split(`
|
|
6607
|
-
`);let e=0;for(;n[e]&&n[e].trim().match(/^(#|$)/);)e++;let r=n.length,a=e+1;for(;a<r&&n[a].trim();)a++;return n.slice(e,a).join(" ").trim()}});var uUr=Oe((aOs,Gza)=>{Gza.exports={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}}});var mUr=Oe((iOs,hUr)=>{var vza=bWt(),yza=gWt(),Zza=z8r(),iXe=oUr(),Nza=Qt("node:module"),Wza=["dependencies","devDependencies","optionalDependencies"],Fza=cUr(),AWt=Qt("url"),_H=uUr(),dUr=n=>n.includes("@")&&n.indexOf("@")<n.lastIndexOf(".");hUr.exports={warn:function(){},fixRepositoryField:function(n){if(n.repositories&&(this.warn("repositories"),n.repository=n.repositories[0]),!n.repository)return this.warn("missingRepository");typeof n.repository=="string"&&(n.repository={type:"git",url:n.repository});var e=n.repository.url||"";if(e){var r=iXe.fromUrl(e);r&&(e=n.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(n){Object.keys(_H.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(n,e)&&this.warn("typo",e,_H.topLevel[e])},this)},fixScriptsField:function(n){if(n.scripts){if(typeof n.scripts!="object"){this.warn("nonObjectScripts"),delete n.scripts;return}Object.keys(n.scripts).forEach(function(e){typeof n.scripts[e]!="string"?(this.warn("nonStringScript"),delete n.scripts[e]):_H.script[e]&&!n.scripts[_H.script[e]]&&this.warn("typo",e,_H.script[e],"scripts")},this)}},fixFilesField:function(n){var e=n.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete n.files):n.files&&(n.files=n.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(n){if(n.bin&&typeof n.bin=="string"){var e={},r;(r=n.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=n.bin:e[n.name]=n.bin,n.bin=e}},fixManField:function(n){n.man&&typeof n.man=="string"&&(n.man=[n.man])},fixBundleDependenciesField:function(n){var e="bundledDependencies",r="bundleDependencies";n[e]&&!n[r]&&(n[r]=n[e],delete n[e]),n[r]&&!Array.isArray(n[r])?(this.warn("nonArrayBundleDependencies"),delete n[r]):n[r]&&(n[r]=n[r].filter(function(a){return!a||typeof a!="string"?(this.warn("nonStringBundleDependency",a),!1):(n.dependencies||(n.dependencies={}),Object.prototype.hasOwnProperty.call(n.dependencies,a)||(this.warn("nonDependencyBundleDependency",a),n.dependencies[a]="*"),!0)},this))},fixDependencies:function(n){Vza(n,this.warn),Cza(n,this.warn),this.fixBundleDependenciesField(n),["dependencies","devDependencies"].forEach(function(e){if(e in n){if(!n[e]||typeof n[e]!="object"){this.warn("nonObjectDependencies",e),delete n[e];return}Object.keys(n[e]).forEach(function(r){var a=n[e][r];typeof a!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(a)),delete n[e][r]);var i=iXe.fromUrl(n[e][r]);i&&(n[e][r]=i.toString())},this)}},this)},fixModulesField:function(n){n.modules&&(this.warn("deprecatedModules"),delete n.modules)},fixKeywordsField:function(n){typeof n.keywords=="string"&&(n.keywords=n.keywords.split(/,\s+/)),n.keywords&&!Array.isArray(n.keywords)?(delete n.keywords,this.warn("nonArrayKeywords")):n.keywords&&(n.keywords=n.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(n,e){var r=!e;if(!n.version)return n.version="",!0;if(!vza(n.version,r))throw new Error('Invalid version: "'+n.version+'"');return n.version=yza(n.version,r),!0},fixPeople:function(n){IUr(n,Aza),IUr(n,xza)},fixNameField:function(n,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!n.name&&!r){n.name="";return}if(typeof n.name!="string")throw new Error("name field must be a string.");r||(n.name=n.name.trim()),Eza(n.name,r,e.allowLegacyCase),Nza.builtinModules.includes(n.name)&&this.warn("conflictingName",n.name)},fixDescriptionField:function(n){n.description&&typeof n.description!="string"&&(this.warn("nonStringDescription"),delete n.description),n.readme&&!n.description&&(n.description=Fza(n.readme)),n.description===void 0&&delete n.description,n.description||this.warn("missingDescription")},fixReadmeField:function(n){n.readme||(this.warn("missingReadme"),n.readme="ERROR: No README data found!")},fixBugsField:function(n){if(!n.bugs&&n.repository&&n.repository.url){var e=iXe.fromUrl(n.repository.url);e&&e.bugs()&&(n.bugs={url:e.bugs()})}else if(n.bugs){if(typeof n.bugs=="string")dUr(n.bugs)?n.bugs={email:n.bugs}:AWt.parse(n.bugs).protocol?n.bugs={url:n.bugs}:this.warn("nonEmailUrlBugsString");else{kza(n.bugs,this.warn);var r=n.bugs;n.bugs={},r.url&&(typeof r.url=="string"&&AWt.parse(r.url).protocol?n.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&dUr(r.email)?n.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!n.bugs.email&&!n.bugs.url&&(delete n.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(n){if(!n.homepage&&n.repository&&n.repository.url){var e=iXe.fromUrl(n.repository.url);e&&e.docs()&&(n.homepage=e.docs())}if(n.homepage){if(typeof n.homepage!="string")return this.warn("nonUrlHomepage"),delete n.homepage;AWt.parse(n.homepage).protocol||(n.homepage="http://"+n.homepage)}},fixLicenseField:function(n){let e=n.license||n.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Zza(e).validForNewPackages)return this.warn("invalidLicense")}};function wza(n){if(n.charAt(0)!=="@")return!1;var e=n.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function Rza(n){return!n.match(/[/@\s+%:]/)&&n===encodeURIComponent(n)}function Eza(n,e,r){if(n.charAt(0)==="."||!(wza(n)||Rza(n))||e&&!r&&n!==n.toLowerCase()||n.toLowerCase()==="node_modules"||n.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(n))}function IUr(n,e){return n.author&&(n.author=e(n.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(n[r])&&(n[r]=n[r].map(e))}),n}function Aza(n){if(typeof n=="string")return n;var e=n.name||"",r=n.url||n.web,a=r?" ("+r+")":"",i=n.email||n.mail,s=i?" <"+i+">":"";return e+s+a}function xza(n){if(typeof n!="string")return n;var e=n.match(/^([^(<]+)/),r=n.match(/\(([^()]+)\)/),a=n.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),a&&(i.email=a[1]),r&&(i.url=r[1]),i}function Cza(n){var e=n.optionalDependencies;if(e){var r=n.dependencies||{};Object.keys(e).forEach(function(a){r[a]=e[a]}),n.dependencies=r}}function Yza(n,e,r){if(!n)return{};if(typeof n=="string"&&(n=n.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(n))return n;r("deprecatedArrayDependencies",e);var a={};return n.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var s=i.shift(),t=i.join("");t=t.trim(),t=t.replace(/^@/,""),a[s]=t}),a}function Vza(n,e){Wza.forEach(function(r){n[r]&&(n[r]=Yza(n[r],r,e))})}function kza(n,e){n&&Object.keys(n).forEach(function(r){_H.bugs[r]&&(e("typo",r,_H.bugs[r],"bugs"),n[_H.bugs[r]]=n[r],delete n[r])})}});var pUr=Oe((sOs,Qza)=>{Qza.exports={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."}});var gUr=Oe((oOs,bUr)=>{var fUr=Qt("util"),xWt=pUr();bUr.exports=function(){var n=Array.prototype.slice.call(arguments,0),e=n.shift();if(e==="typo")return Hza.apply(null,n);var r=xWt[e]?xWt[e]:e+": '%s'";return n.unshift(r),fUr.format.apply(null,n)};function Hza(n,e,r){return r&&(n=r+"['"+n+"']",e=r+"['"+e+"']"),fUr.format(xWt.typo,n,e)}});var ZUr=Oe((lOs,yUr)=>{yUr.exports=GUr;var CWt=mUr();GUr.fixer=CWt;var Xza=gUr(),Sza=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],Lza=["dependencies","people","typos"],YWt=Sza.map(function(n){return vUr(n)+"Field"});YWt=YWt.concat(Lza);function GUr(n,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||n.private)&&(e=function(){}),n.scripts&&n.scripts.install==="node-gyp rebuild"&&!n.scripts.preinstall&&(n.gypfile=!0),CWt.warn=function(){e(Xza.apply(null,arguments))},YWt.forEach(function(a){CWt["fix"+vUr(a)](n,r)}),n._id=n.name+"@"+n.version}function vUr(n){return n.charAt(0).toUpperCase()+n.slice(1)}});var NUr=He(()=>{});import{fileURLToPath as Jza}from"node:url";function WUr(n){return n instanceof URL?Jza(n):n}var FUr=He(()=>{NUr()});import Tza from"node:fs/promises";import Bza from"node:path";async function RUr({cwd:n,normalize:e=!0}={}){let r=await Tza.readFile(Dza(n),"utf8");return Oza(r,e)}var wUr,Dza,Oza,EUr=He(()=>{m8r();wUr=kt(ZUr(),1);FUr();Dza=n=>Bza.resolve(WUr(n)??".","package.json"),Oza=(n,e)=>{let r=typeof n=="string"?dWt(n):n;return e&&(0,wUr.default)(r),r}});import Uza from"node:path";async function AUr(n){let e=await JOr("package.json",n);if(e)return{packageJson:await RUr({...n,cwd:Uza.dirname(e)}),path:e}}var xUr=He(()=>{TOr();EUr()});import{fileURLToPath as Mza}from"url";import zza from"path";async function sXe(){if(z$)return z$;let n=await AUr({cwd:Pza});if(!n){let e="easycode-cli",r="1.1.84";return e&&r?(z$={name:e,version:r},z$):void 0}return z$=n.packageJson,z$}var _za,Pza,z$,VWt=He(()=>{"use strict";xUr();_za=Mza(import.meta.url),Pza=zza.dirname(_za)});var CUr={};Ss(CUr,{getCliVersion:()=>RY});async function RY(){let n=await sXe();return"1.1.84"}var _$=He(()=>{"use strict";VWt();});import VB from"node:process";var YUr,VUr=He(()=>{"use strict";_$();mi();Fs();un();YUr={name:"about",description:We("command.about.description"),kind:"built-in",action:async n=>{let e=VB.platform,r="no sandbox";VB.env.SANDBOX&&VB.env.SANDBOX!=="sandbox-exec"?r=VB.env.SANDBOX:VB.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${VB.env.SEATBELT_PROFILE||"unknown"})`);let a=n.services.config?.getModel()||"Unknown",i=await RY(),s=n.services.settings.merged.selectedAuthType||"",t=VB.env.GOOGLE_CLOUD_PROJECT||"",o={type:"about",cliVersion:i,osVersion:e,sandboxEnv:r,modelVersion:a,selectedAuthType:s,gcpProject:t};n.ui.addItem(o,Date.now())}}});var kUr,QUr=He(()=>{"use strict";mi();un();kUr={name:"auth",altNames:["login"],description:We("command.auth.description"),kind:"built-in",action:(n,e)=>({type:"dialog",dialog:"auth"})}});var HUr,XUr=He(()=>{"use strict";mi();jr();un();HUr={name:"logout",description:We("command.logout.description"),kind:"built-in",action:(n,e)=>{let r=es.getInstance();return r.isConfigured()?(r.clear(),{type:"message",messageType:"info",content:We("command.logout.success")}):{type:"message",messageType:"info",content:We("command.logout.not_logged_in")}}}});var SUr,LUr=He(()=>{"use strict";mi();un();SUr={name:"clear",description:We("command.clear.description"),kind:"built-in",action:async(n,e)=>{n.ui.setDebugMessage("Clearing terminal screen."),n.ui.clear()}}});var JUr,TUr=He(()=>{"use strict";Fs();mi();un();JUr={name:"compress",altNames:["summarize","compact"],description:We("command.compress.description"),kind:"built-in",action:async n=>{let{ui:e}=n,r=n.services.config?.getGeminiClient();if(e.pendingItem){e.addItem({type:"error",text:"Already compressing, wait for previous request to complete"},Date.now());return}if(r?.isCompressionInProgress()){e.addItem({type:"error",text:"Compression already in progress at client level, please wait"},Date.now());return}e.addItem({type:"info",text:We("command.compress.starting")},Date.now());let a={type:"compression",compression:{isPending:!0,originalTokenCount:null,newTokenCount:null}};try{e.setPendingItem(a);let i=`compress-${Date.now()}`,s=await r?.tryCompressChat(i,new AbortController().signal,!0);s?e.addItem({type:"compression",compression:{isPending:!1,originalTokenCount:s.originalTokenCount,newTokenCount:s.newTokenCount}},Date.now()):e.addItem({type:"error",text:"Failed to compress chat history."},Date.now())}catch(i){e.addItem({type:"error",text:`Failed to compress chat history: ${i instanceof Error?i.message:String(i)}`},Date.now())}finally{e.setPendingItem(null)}}}});async function jza(n){let{config:e,settings:r}=n.services;if(!e||!r)return{type:"message",messageType:"error",content:We("error.config.not.loaded")};let a=r.merged.vimMode||!1,i=e.getApprovalMode(),s=r.merged.preferredLanguage||We("config.value.default");return{type:"message",messageType:"info",content:`\u2699\uFE0F ${We("command.config.description")}
|
|
6607
|
+
`);let e=0;for(;n[e]&&n[e].trim().match(/^(#|$)/);)e++;let r=n.length,a=e+1;for(;a<r&&n[a].trim();)a++;return n.slice(e,a).join(" ").trim()}});var uUr=Oe((aOs,Gza)=>{Gza.exports={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}}});var mUr=Oe((iOs,hUr)=>{var vza=bWt(),yza=gWt(),Zza=z8r(),iXe=oUr(),Nza=Qt("node:module"),Wza=["dependencies","devDependencies","optionalDependencies"],Fza=cUr(),AWt=Qt("url"),_H=uUr(),dUr=n=>n.includes("@")&&n.indexOf("@")<n.lastIndexOf(".");hUr.exports={warn:function(){},fixRepositoryField:function(n){if(n.repositories&&(this.warn("repositories"),n.repository=n.repositories[0]),!n.repository)return this.warn("missingRepository");typeof n.repository=="string"&&(n.repository={type:"git",url:n.repository});var e=n.repository.url||"";if(e){var r=iXe.fromUrl(e);r&&(e=n.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(n){Object.keys(_H.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(n,e)&&this.warn("typo",e,_H.topLevel[e])},this)},fixScriptsField:function(n){if(n.scripts){if(typeof n.scripts!="object"){this.warn("nonObjectScripts"),delete n.scripts;return}Object.keys(n.scripts).forEach(function(e){typeof n.scripts[e]!="string"?(this.warn("nonStringScript"),delete n.scripts[e]):_H.script[e]&&!n.scripts[_H.script[e]]&&this.warn("typo",e,_H.script[e],"scripts")},this)}},fixFilesField:function(n){var e=n.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete n.files):n.files&&(n.files=n.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(n){if(n.bin&&typeof n.bin=="string"){var e={},r;(r=n.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=n.bin:e[n.name]=n.bin,n.bin=e}},fixManField:function(n){n.man&&typeof n.man=="string"&&(n.man=[n.man])},fixBundleDependenciesField:function(n){var e="bundledDependencies",r="bundleDependencies";n[e]&&!n[r]&&(n[r]=n[e],delete n[e]),n[r]&&!Array.isArray(n[r])?(this.warn("nonArrayBundleDependencies"),delete n[r]):n[r]&&(n[r]=n[r].filter(function(a){return!a||typeof a!="string"?(this.warn("nonStringBundleDependency",a),!1):(n.dependencies||(n.dependencies={}),Object.prototype.hasOwnProperty.call(n.dependencies,a)||(this.warn("nonDependencyBundleDependency",a),n.dependencies[a]="*"),!0)},this))},fixDependencies:function(n){Vza(n,this.warn),Cza(n,this.warn),this.fixBundleDependenciesField(n),["dependencies","devDependencies"].forEach(function(e){if(e in n){if(!n[e]||typeof n[e]!="object"){this.warn("nonObjectDependencies",e),delete n[e];return}Object.keys(n[e]).forEach(function(r){var a=n[e][r];typeof a!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(a)),delete n[e][r]);var i=iXe.fromUrl(n[e][r]);i&&(n[e][r]=i.toString())},this)}},this)},fixModulesField:function(n){n.modules&&(this.warn("deprecatedModules"),delete n.modules)},fixKeywordsField:function(n){typeof n.keywords=="string"&&(n.keywords=n.keywords.split(/,\s+/)),n.keywords&&!Array.isArray(n.keywords)?(delete n.keywords,this.warn("nonArrayKeywords")):n.keywords&&(n.keywords=n.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(n,e){var r=!e;if(!n.version)return n.version="",!0;if(!vza(n.version,r))throw new Error('Invalid version: "'+n.version+'"');return n.version=yza(n.version,r),!0},fixPeople:function(n){IUr(n,Aza),IUr(n,xza)},fixNameField:function(n,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!n.name&&!r){n.name="";return}if(typeof n.name!="string")throw new Error("name field must be a string.");r||(n.name=n.name.trim()),Eza(n.name,r,e.allowLegacyCase),Nza.builtinModules.includes(n.name)&&this.warn("conflictingName",n.name)},fixDescriptionField:function(n){n.description&&typeof n.description!="string"&&(this.warn("nonStringDescription"),delete n.description),n.readme&&!n.description&&(n.description=Fza(n.readme)),n.description===void 0&&delete n.description,n.description||this.warn("missingDescription")},fixReadmeField:function(n){n.readme||(this.warn("missingReadme"),n.readme="ERROR: No README data found!")},fixBugsField:function(n){if(!n.bugs&&n.repository&&n.repository.url){var e=iXe.fromUrl(n.repository.url);e&&e.bugs()&&(n.bugs={url:e.bugs()})}else if(n.bugs){if(typeof n.bugs=="string")dUr(n.bugs)?n.bugs={email:n.bugs}:AWt.parse(n.bugs).protocol?n.bugs={url:n.bugs}:this.warn("nonEmailUrlBugsString");else{kza(n.bugs,this.warn);var r=n.bugs;n.bugs={},r.url&&(typeof r.url=="string"&&AWt.parse(r.url).protocol?n.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&dUr(r.email)?n.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!n.bugs.email&&!n.bugs.url&&(delete n.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(n){if(!n.homepage&&n.repository&&n.repository.url){var e=iXe.fromUrl(n.repository.url);e&&e.docs()&&(n.homepage=e.docs())}if(n.homepage){if(typeof n.homepage!="string")return this.warn("nonUrlHomepage"),delete n.homepage;AWt.parse(n.homepage).protocol||(n.homepage="http://"+n.homepage)}},fixLicenseField:function(n){let e=n.license||n.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Zza(e).validForNewPackages)return this.warn("invalidLicense")}};function wza(n){if(n.charAt(0)!=="@")return!1;var e=n.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function Rza(n){return!n.match(/[/@\s+%:]/)&&n===encodeURIComponent(n)}function Eza(n,e,r){if(n.charAt(0)==="."||!(wza(n)||Rza(n))||e&&!r&&n!==n.toLowerCase()||n.toLowerCase()==="node_modules"||n.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(n))}function IUr(n,e){return n.author&&(n.author=e(n.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(n[r])&&(n[r]=n[r].map(e))}),n}function Aza(n){if(typeof n=="string")return n;var e=n.name||"",r=n.url||n.web,a=r?" ("+r+")":"",i=n.email||n.mail,s=i?" <"+i+">":"";return e+s+a}function xza(n){if(typeof n!="string")return n;var e=n.match(/^([^(<]+)/),r=n.match(/\(([^()]+)\)/),a=n.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),a&&(i.email=a[1]),r&&(i.url=r[1]),i}function Cza(n){var e=n.optionalDependencies;if(e){var r=n.dependencies||{};Object.keys(e).forEach(function(a){r[a]=e[a]}),n.dependencies=r}}function Yza(n,e,r){if(!n)return{};if(typeof n=="string"&&(n=n.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(n))return n;r("deprecatedArrayDependencies",e);var a={};return n.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var s=i.shift(),t=i.join("");t=t.trim(),t=t.replace(/^@/,""),a[s]=t}),a}function Vza(n,e){Wza.forEach(function(r){n[r]&&(n[r]=Yza(n[r],r,e))})}function kza(n,e){n&&Object.keys(n).forEach(function(r){_H.bugs[r]&&(e("typo",r,_H.bugs[r],"bugs"),n[_H.bugs[r]]=n[r],delete n[r])})}});var pUr=Oe((sOs,Qza)=>{Qza.exports={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."}});var gUr=Oe((oOs,bUr)=>{var fUr=Qt("util"),xWt=pUr();bUr.exports=function(){var n=Array.prototype.slice.call(arguments,0),e=n.shift();if(e==="typo")return Hza.apply(null,n);var r=xWt[e]?xWt[e]:e+": '%s'";return n.unshift(r),fUr.format.apply(null,n)};function Hza(n,e,r){return r&&(n=r+"['"+n+"']",e=r+"['"+e+"']"),fUr.format(xWt.typo,n,e)}});var ZUr=Oe((lOs,yUr)=>{yUr.exports=GUr;var CWt=mUr();GUr.fixer=CWt;var Xza=gUr(),Sza=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],Lza=["dependencies","people","typos"],YWt=Sza.map(function(n){return vUr(n)+"Field"});YWt=YWt.concat(Lza);function GUr(n,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||n.private)&&(e=function(){}),n.scripts&&n.scripts.install==="node-gyp rebuild"&&!n.scripts.preinstall&&(n.gypfile=!0),CWt.warn=function(){e(Xza.apply(null,arguments))},YWt.forEach(function(a){CWt["fix"+vUr(a)](n,r)}),n._id=n.name+"@"+n.version}function vUr(n){return n.charAt(0).toUpperCase()+n.slice(1)}});var NUr=He(()=>{});import{fileURLToPath as Jza}from"node:url";function WUr(n){return n instanceof URL?Jza(n):n}var FUr=He(()=>{NUr()});import Tza from"node:fs/promises";import Bza from"node:path";async function RUr({cwd:n,normalize:e=!0}={}){let r=await Tza.readFile(Dza(n),"utf8");return Oza(r,e)}var wUr,Dza,Oza,EUr=He(()=>{m8r();wUr=kt(ZUr(),1);FUr();Dza=n=>Bza.resolve(WUr(n)??".","package.json"),Oza=(n,e)=>{let r=typeof n=="string"?dWt(n):n;return e&&(0,wUr.default)(r),r}});import Uza from"node:path";async function AUr(n){let e=await JOr("package.json",n);if(e)return{packageJson:await RUr({...n,cwd:Uza.dirname(e)}),path:e}}var xUr=He(()=>{TOr();EUr()});import{fileURLToPath as Mza}from"url";import zza from"path";async function sXe(){if(z$)return z$;let n=await AUr({cwd:Pza});if(!n){let e="easycode-cli",r="1.1.85";return e&&r?(z$={name:e,version:r},z$):void 0}return z$=n.packageJson,z$}var _za,Pza,z$,VWt=He(()=>{"use strict";xUr();_za=Mza(import.meta.url),Pza=zza.dirname(_za)});var CUr={};Ss(CUr,{getCliVersion:()=>RY});async function RY(){let n=await sXe();return"1.1.85"}var _$=He(()=>{"use strict";VWt();});import VB from"node:process";var YUr,VUr=He(()=>{"use strict";_$();mi();Fs();un();YUr={name:"about",description:We("command.about.description"),kind:"built-in",action:async n=>{let e=VB.platform,r="no sandbox";VB.env.SANDBOX&&VB.env.SANDBOX!=="sandbox-exec"?r=VB.env.SANDBOX:VB.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${VB.env.SEATBELT_PROFILE||"unknown"})`);let a=n.services.config?.getModel()||"Unknown",i=await RY(),s=n.services.settings.merged.selectedAuthType||"",t=VB.env.GOOGLE_CLOUD_PROJECT||"",o={type:"about",cliVersion:i,osVersion:e,sandboxEnv:r,modelVersion:a,selectedAuthType:s,gcpProject:t};n.ui.addItem(o,Date.now())}}});var kUr,QUr=He(()=>{"use strict";mi();un();kUr={name:"auth",altNames:["login"],description:We("command.auth.description"),kind:"built-in",action:(n,e)=>({type:"dialog",dialog:"auth"})}});var HUr,XUr=He(()=>{"use strict";mi();jr();un();HUr={name:"logout",description:We("command.logout.description"),kind:"built-in",action:(n,e)=>{let r=es.getInstance();return r.isConfigured()?(r.clear(),{type:"message",messageType:"info",content:We("command.logout.success")}):{type:"message",messageType:"info",content:We("command.logout.not_logged_in")}}}});var SUr,LUr=He(()=>{"use strict";mi();un();SUr={name:"clear",description:We("command.clear.description"),kind:"built-in",action:async(n,e)=>{n.ui.setDebugMessage("Clearing terminal screen."),n.ui.clear()}}});var JUr,TUr=He(()=>{"use strict";Fs();mi();un();JUr={name:"compress",altNames:["summarize","compact"],description:We("command.compress.description"),kind:"built-in",action:async n=>{let{ui:e}=n,r=n.services.config?.getGeminiClient();if(e.pendingItem){e.addItem({type:"error",text:"Already compressing, wait for previous request to complete"},Date.now());return}if(r?.isCompressionInProgress()){e.addItem({type:"error",text:"Compression already in progress at client level, please wait"},Date.now());return}e.addItem({type:"info",text:We("command.compress.starting")},Date.now());let a={type:"compression",compression:{isPending:!0,originalTokenCount:null,newTokenCount:null}};try{e.setPendingItem(a);let i=`compress-${Date.now()}`,s=await r?.tryCompressChat(i,new AbortController().signal,!0);s?e.addItem({type:"compression",compression:{isPending:!1,originalTokenCount:s.originalTokenCount,newTokenCount:s.newTokenCount}},Date.now()):e.addItem({type:"error",text:"Failed to compress chat history."},Date.now())}catch(i){e.addItem({type:"error",text:`Failed to compress chat history: ${i instanceof Error?i.message:String(i)}`},Date.now())}finally{e.setPendingItem(null)}}}});async function jza(n){let{config:e,settings:r}=n.services;if(!e||!r)return{type:"message",messageType:"error",content:We("error.config.not.loaded")};let a=r.merged.vimMode||!1,i=e.getApprovalMode(),s=r.merged.preferredLanguage||We("config.value.default");return{type:"message",messageType:"info",content:`\u2699\uFE0F ${We("command.config.description")}
|
|
6608
6608
|
|
|
6609
6609
|
${We("command.config.available.options")}:
|
|
6610
6610
|
|