@minimax-ai/code 0.6.11 → 0.6.12

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/CHANGELOG.zh-CN.md +23 -0
  3. package/README.md +1 -1
  4. package/README.zh-CN.md +11 -1
  5. package/assets/agents/_default/prompt-base-windows.md +1 -1
  6. package/assets/agents/_default/prompt-base-windows.md.hbs +1 -1
  7. package/assets/agents/desktop-task/checkpoint/system.md +6 -2
  8. package/assets/agents/managed-prompts.json +1 -0
  9. package/assets/agents/memory-v2-consolidation.md +2 -2
  10. package/assets/agents/workflow/goal/budget-limit.md +4 -1
  11. package/assets/agents/workflow/goal/completion-summary.md +2 -0
  12. package/assets/agents/workflow/goal/recovery-terminal-audit.md +3 -2
  13. package/assets/agents/workflow/goal/recovery.md +2 -2
  14. package/chunks/{clipboard-image-Q5NH3BUQ.js → application-FYXBCFKS.js} +1 -1
  15. package/chunks/{auth-command-YIBIYLYL.js → auth-command-UUTBKVM2.js} +3 -3
  16. package/chunks/chunk-25R53L7J.js +23 -0
  17. package/chunks/chunk-334CV6RF.js +2 -0
  18. package/chunks/{chunk-7FUBWI5L.js → chunk-47KWM23C.js} +906 -856
  19. package/chunks/{chunk-FNHS672G.js → chunk-5ADYFF2U.js} +3367 -2383
  20. package/chunks/{chunk-NXXFMBAV.js → chunk-AMLNR7IO.js} +1 -1
  21. package/chunks/{chunk-3MHUE4DM.js → chunk-DCFP5ZHZ.js} +6 -6
  22. package/chunks/{chunk-X4N2MWNJ.js → chunk-G3BYCHZS.js} +1 -1
  23. package/chunks/{chunk-3FETZOUF.js → chunk-I2T4QMR7.js} +3 -3
  24. package/chunks/{chunk-FPCUX6KP.js → chunk-I5CQQ3J6.js} +1 -1
  25. package/chunks/{chunk-VUXFNHQE.js → chunk-I7MLO7YD.js} +1 -1
  26. package/chunks/{chunk-CRTW4JM6.js → chunk-IO46JRII.js} +1 -1
  27. package/chunks/chunk-KGAIRLNO.js +3 -0
  28. package/chunks/chunk-L43V3NKW.js +2 -0
  29. package/chunks/chunk-NJVLEZ3I.js +2 -0
  30. package/chunks/{chunk-YPMJNO4T.js → chunk-OHWTK4KK.js} +1 -1
  31. package/chunks/{chunk-2LP3AAE5.js → chunk-QJ2FEPC2.js} +4 -4
  32. package/chunks/{chunk-UQ2YIDWV.js → chunk-QXUSWEWV.js} +1 -1
  33. package/chunks/{application-ZJ5NM3DF.js → chunk-SLFKHVQC.js} +1 -1
  34. package/chunks/chunk-VAVHH4XP.js +16 -0
  35. package/chunks/chunk-X3PES5WL.js +193 -0
  36. package/chunks/chunk-X7FQ5SBJ.js +40 -0
  37. package/chunks/{chunk-S6GSNWAM.js → chunk-ZPSMBMGA.js} +119 -119
  38. package/chunks/clipboard-image-SRYRNKLQ.js +2 -0
  39. package/chunks/{data-dir-AVW455BT.js → data-dir-C6MQE6W2.js} +1 -1
  40. package/chunks/dist-K652HFOW.js +2 -0
  41. package/chunks/{google-W4KKPJIU.js → google-ZWZWHJZZ.js} +1 -1
  42. package/chunks/{google-vertex-K2VBU5YX.js → google-vertex-C3BYAM6A.js} +1 -1
  43. package/chunks/{install-source-REWTEDE3.js → install-source-FIUDUO7G.js} +1 -1
  44. package/chunks/launcher-AVQRYDKB.js +275 -0
  45. package/chunks/{lifecycle-7W6GXLEL.js → lifecycle-VXPE5MII.js} +1 -1
  46. package/chunks/main-JXKRTY5N.js +11 -0
  47. package/chunks/{plugin-command-QSDS4V7E.js → plugin-command-ZZLA7IRM.js} +1 -1
  48. package/chunks/{provider-command-ZE4ODVR3.js → provider-command-PVOKX3IV.js} +1 -1
  49. package/chunks/{run-acp-command-LM4IFM5B.js → run-acp-command-MV4O4NBX.js} +32 -32
  50. package/chunks/run-app-server-command-DEX4FRZJ.js +24 -0
  51. package/chunks/{run-exec-command-B7H55F5B.js → run-exec-command-EJMP5IF3.js} +1 -1
  52. package/chunks/{tools-L7RFN554.js → tools-VTXR5JSH.js} +1 -1
  53. package/chunks/{update-HOQ5YQFF.js → update-4XVOPCYB.js} +1 -1
  54. package/cli.js +2 -2
  55. package/package.json +1 -1
  56. package/chunks/chunk-5JU6ZMXS.js +0 -23
  57. package/chunks/chunk-G7FSWJID.js +0 -193
  58. package/chunks/chunk-LQIEYG3O.js +0 -39
  59. package/chunks/chunk-MESLFKP6.js +0 -3
  60. package/chunks/chunk-NICEDCLM.js +0 -2
  61. package/chunks/chunk-NP5G53PV.js +0 -16
  62. package/chunks/chunk-RDUENEEQ.js +0 -2
  63. package/chunks/dist-B52TV5OC.js +0 -2
  64. package/chunks/launcher-BADSPVA5.js +0 -274
  65. package/chunks/main-LWOWUP76.js +0 -9
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __mavis_cR } from "module"; import { basename as __mavis_basename, dirname as __mavis_dirname, join as __mavis_join } from "path"; import { fileURLToPath as __mavis_fileURLToPath, pathToFileURL as __mavis_pathToFileURL } from "url"; const __mavis_tuiCurrentModuleDir = __mavis_dirname(__mavis_fileURLToPath(import.meta.url)); const __mavis_tuiPackageRoot = __mavis_basename(__mavis_tuiCurrentModuleDir) === "chunks" ? __mavis_dirname(__mavis_tuiCurrentModuleDir) : __mavis_tuiCurrentModuleDir; const __mavis_tuiPackageEntryUrl = __mavis_pathToFileURL(__mavis_join(__mavis_tuiPackageRoot, "cli.js")).href; const require = __mavis_cR(__mavis_tuiPackageEntryUrl); const __dirname = __mavis_tuiPackageRoot;
2
- import{a as Oa}from"./chunk-X4N2MWNJ.js";import{l as Fa}from"./chunk-UOE7W4PK.js";import{a as mt}from"./chunk-WFWSBUYD.js";import{a as nn}from"./chunk-CWWDVX6C.js";import{a as K,b as It,c as F,d as Ga,e as tn,f as oe}from"./chunk-D76SO2ME.js";var qa=F((oS,ba)=>{function ve(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}ba.exports=ve;ve.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};ve.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};ve.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var i=this;return this._timer=setTimeout(function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts)},i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts)},n),this._options.unref&&this._timer.unref(),!0};ve.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};ve.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};ve.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};ve.prototype.start=ve.prototype.try;ve.prototype.errors=function(){return this._errors};ve.prototype.attempts=function(){return this._attempts};ve.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,n=0,i=0;i<this._errors.length;i++){var r=this._errors[i],o=r.message,l=(t[o]||0)+1;t[o]=l,l>=n&&(e=r,n=l)}return e}});var Ha=F(gt=>{var Kf=qa();gt.operation=function(t){var e=gt.timeouts(t);return new Kf(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};gt.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in t)e[n]=t[n];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],r=0;r<e.retries;r++)i.push(this.createTimeout(r,e));return t&&t.forever&&!i.length&&i.push(this.createTimeout(r,e)),i.sort(function(o,l){return o-l}),i};gt.createTimeout=function(t,e){var n=e.randomize?Math.random()+1:1,i=Math.round(n*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return i=Math.min(i,e.maxTimeout),i};gt.wrap=function(t,e,n){if(e instanceof Array&&(n=e,e=null),!n){n=[];for(var i in t)typeof t[i]=="function"&&n.push(i)}for(var r=0;r<n.length;r++){var o=n[r],l=t[o];t[o]=function(d){var c=gt.operation(e),f=Array.prototype.slice.call(arguments,1),p=f.pop();f.push(function(h){c.retry(h)||(h&&(arguments[0]=c.mainError()),p.apply(this,arguments))}),c.attempt(function(){d.apply(t,f)})}.bind(t,l),t[o].options=e}}});var Ba=F((aS,Va)=>{Va.exports=Ha()});var Ja=F((lS,Pn)=>{"use strict";var Wf=Ba(),Yf=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],Rn=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},zf=(t,e,n)=>{let i=n.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=i,t},Xf=t=>Yf.includes(t),$a=(t,e)=>new Promise((n,i)=>{e={onFailedAttempt:()=>{},retries:10,...e};let r=Wf.operation(e);r.attempt(async o=>{try{n(await t(o))}catch(l){if(!(l instanceof Error)){i(new TypeError(`Non-error was thrown: "${l}". You should only throw errors.`));return}if(l instanceof Rn)r.stop(),i(l.originalError);else if(l instanceof TypeError&&!Xf(l.message))r.stop(),i(l);else{zf(l,o,e);try{await e.onFailedAttempt(l)}catch(u){i(u);return}r.retry(l)||i(r.mainError())}}})});Pn.exports=$a;Pn.exports.default=$a;Pn.exports.AbortError=Rn});var hr=F((uS,ja)=>{"use strict";var Nn=Object.prototype.hasOwnProperty,Za=Object.prototype.toString,Ka=Object.defineProperty,Wa=Object.getOwnPropertyDescriptor,Ya=function(e){return typeof Array.isArray=="function"?Array.isArray(e):Za.call(e)==="[object Array]"},za=function(e){if(!e||Za.call(e)!=="[object Object]")return!1;var n=Nn.call(e,"constructor"),i=e.constructor&&e.constructor.prototype&&Nn.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!i)return!1;var r;for(r in e);return typeof r>"u"||Nn.call(e,r)},Xa=function(e,n){Ka&&n.name==="__proto__"?Ka(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},Qa=function(e,n){if(n==="__proto__")if(Nn.call(e,n)){if(Wa)return Wa(e,n).value}else return;return e[n]};ja.exports=function t(){var e,n,i,r,o,l,u=arguments[0],d=1,c=arguments.length,f=!1;for(typeof u=="boolean"&&(f=u,u=arguments[1]||{},d=2),(u==null||typeof u!="object"&&typeof u!="function")&&(u={});d<c;++d)if(e=arguments[d],e!=null)for(n in e)i=Qa(u,n),r=Qa(e,n),u!==r&&(f&&r&&(za(r)||(o=Ya(r)))?(o?(o=!1,l=i&&Ya(i)?i:[]):l=i&&za(i)?i:{},Xa(u,{name:n,newValue:t(f,l,r)})):typeof r<"u"&&Xa(u,{name:n,newValue:r}));return u}});var el=F((cS,Qf)=>{Qf.exports={name:"gaxios",version:"7.1.4",description:"A simple common HTTP client specifically for Google APIs and services.",main:"build/cjs/src/index.js",types:"build/cjs/src/index.d.ts",files:["build/"],exports:{".":{import:{types:"./build/esm/src/index.d.ts",default:"./build/esm/src/index.js"},require:{types:"./build/cjs/src/index.d.ts",default:"./build/cjs/src/index.js"}}},scripts:{lint:"gts check --no-inline-config",test:"c8 mocha build/esm/test","presystem-test":"npm run compile","system-test":"mocha build/esm/system-test --timeout 80000",compile:"tsc -b ./tsconfig.json ./tsconfig.cjs.json && node utils/enable-esm.mjs",fix:"gts fix",prepare:"npm run compile",pretest:"npm run compile",webpack:"webpack","prebrowser-test":"npm run compile","browser-test":"node build/browser-test/browser-test-runner.js",docs:"jsdoc -c .jsdoc.js","docs-test":"linkinator docs","predocs-test":"npm run docs","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean"},repository:{type:"git",directory:"packages/gaxios",url:"https://github.com/googleapis/google-cloud-node-core.git"},keywords:["google"],engines:{node:">=18"},author:"Google, LLC",license:"Apache-2.0",devDependencies:{"@babel/plugin-proposal-private-methods":"^7.18.6","@types/cors":"^2.8.6","@types/express":"^5.0.0","@types/extend":"^3.0.1","@types/mocha":"^10.0.10","@types/multiparty":"4.2.1","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^22.13.1","@types/sinon":"^17.0.3","@types/tmp":"^0.2.6",assert:"^2.0.0",browserify:"^17.0.0",c8:"^10.1.3",cors:"^2.8.5",express:"^5.0.0",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-remap-coverage":"^0.1.5","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",linkinator:"^6.1.2",mocha:"^11.1.0",multiparty:"^4.2.1",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.5","null-loader":"^4.0.1","pack-n-play":"^4.0.0",puppeteer:"^24.0.0",sinon:"^21.0.0","stream-browserify":"^3.0.0",tmp:"0.2.5","ts-loader":"^9.5.2",typescript:"5.8.3",webpack:"^5.97.1","webpack-cli":"^6.0.1"},dependencies:{extend:"^3.0.2","https-proxy-agent":"^7.0.1","node-fetch":"^3.3.2"},homepage:"https://github.com/googleapis/google-cloud-node-core/tree/main/packages/gaxios"}});var nl=F((dS,tl)=>{var Zf=el();tl.exports={pkg:Zf}});function jf(t,e){switch(t){case"stream":return e;case"json":return JSON.parse(JSON.stringify(e));case"arraybuffer":return JSON.parse(Buffer.from(e).toString("utf8"));case"blob":return JSON.parse(e.text());default:return e}}function Er(t){let e="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";function n(o){o&&o.forEach((l,u)=>{(/^authentication$/i.test(u)||/^authorization$/i.test(u)||/secret/i.test(u))&&o.set(u,e)})}function i(o,l){if(typeof o=="object"&&o!==null&&typeof o[l]=="string"){let u=o[l];(/grant_type=/i.test(u)||/assertion=/i.test(u)||/secret/i.test(u))&&(o[l]=e)}}function r(o){!o||typeof o!="object"||(o instanceof FormData||o instanceof URLSearchParams||"forEach"in o&&"set"in o?o.forEach((l,u)=>{(["grant_type","assertion"].includes(u)||/secret/.test(u))&&o.set(u,e)}):("grant_type"in o&&(o.grant_type=e),"assertion"in o&&(o.assertion=e),"client_secret"in o&&(o.client_secret=e)))}return t.config&&(n(t.config.headers),i(t.config,"data"),r(t.config.data),i(t.config,"body"),r(t.config.body),t.config.url.searchParams.has("token")&&t.config.url.searchParams.set("token",e),t.config.url.searchParams.has("client_secret")&&t.config.url.searchParams.set("client_secret",e)),t.response&&(Er({config:t.response.config}),n(t.response.headers),t.response.bodyUsed&&(i(t.response,"data"),r(t.response.data))),t}var gr,il,yr,mr,xe,_r=It(()=>{gr=tn(hr(),1),il=tn(nl(),1),yr=il.default.pkg,mr=Symbol.for(`${yr.name}-gaxios-error`),xe=class t extends Error{config;response;code;status;error;[mr]=yr.version;static[Symbol.hasInstance](e){return e&&typeof e=="object"&&mr in e&&e[mr]===yr.version?!0:Function.prototype[Symbol.hasInstance].call(t,e)}constructor(e,n,i,r){if(super(e,{cause:r}),this.config=n,this.response=i,this.error=r instanceof Error?r:void 0,this.config=(0,gr.default)(!0,{},n),this.response&&(this.response.config=(0,gr.default)(!0,{},this.response.config)),this.response){try{this.response.data=jf(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}r instanceof DOMException?this.code=r.name:r&&typeof r=="object"&&"code"in r&&(typeof r.code=="string"||typeof r.code=="number")&&(this.code=r.code)}static extractAPIErrorFromResponse(e,n="The request failed"){let i=n;if(typeof e.data=="string"&&(i=e.data),e.data&&typeof e.data=="object"&&"error"in e.data&&e.data.error&&!e.ok){if(typeof e.data.error=="string")return{message:e.data.error,code:e.status,status:e.statusText};if(typeof e.data.error=="object"){i="message"in e.data.error&&typeof e.data.error.message=="string"?e.data.error.message:i;let r="status"in e.data.error&&typeof e.data.error.status=="string"?e.data.error.status:e.statusText,o="code"in e.data.error&&typeof e.data.error.code=="number"?e.data.error.code:e.status;if("errors"in e.data.error&&Array.isArray(e.data.error.errors)){let l=[];for(let u of e.data.error.errors)typeof u=="object"&&"message"in u&&typeof u.message=="string"&&l.push(u.message);return Object.assign({message:l.join(`
2
+ import{a as Oa}from"./chunk-G3BYCHZS.js";import{l as Fa}from"./chunk-UOE7W4PK.js";import{a as mt}from"./chunk-WFWSBUYD.js";import{a as nn}from"./chunk-CWWDVX6C.js";import{a as K,b as It,c as F,d as Ga,e as tn,f as oe}from"./chunk-D76SO2ME.js";var qa=F((oS,ba)=>{function ve(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}ba.exports=ve;ve.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};ve.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};ve.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var i=this;return this._timer=setTimeout(function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts)},i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts)},n),this._options.unref&&this._timer.unref(),!0};ve.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};ve.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};ve.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};ve.prototype.start=ve.prototype.try;ve.prototype.errors=function(){return this._errors};ve.prototype.attempts=function(){return this._attempts};ve.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,n=0,i=0;i<this._errors.length;i++){var r=this._errors[i],o=r.message,l=(t[o]||0)+1;t[o]=l,l>=n&&(e=r,n=l)}return e}});var Ha=F(gt=>{var Kf=qa();gt.operation=function(t){var e=gt.timeouts(t);return new Kf(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};gt.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in t)e[n]=t[n];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],r=0;r<e.retries;r++)i.push(this.createTimeout(r,e));return t&&t.forever&&!i.length&&i.push(this.createTimeout(r,e)),i.sort(function(o,l){return o-l}),i};gt.createTimeout=function(t,e){var n=e.randomize?Math.random()+1:1,i=Math.round(n*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return i=Math.min(i,e.maxTimeout),i};gt.wrap=function(t,e,n){if(e instanceof Array&&(n=e,e=null),!n){n=[];for(var i in t)typeof t[i]=="function"&&n.push(i)}for(var r=0;r<n.length;r++){var o=n[r],l=t[o];t[o]=function(d){var c=gt.operation(e),f=Array.prototype.slice.call(arguments,1),p=f.pop();f.push(function(h){c.retry(h)||(h&&(arguments[0]=c.mainError()),p.apply(this,arguments))}),c.attempt(function(){d.apply(t,f)})}.bind(t,l),t[o].options=e}}});var Ba=F((aS,Va)=>{Va.exports=Ha()});var Ja=F((lS,Pn)=>{"use strict";var Wf=Ba(),Yf=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],Rn=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},zf=(t,e,n)=>{let i=n.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=i,t},Xf=t=>Yf.includes(t),$a=(t,e)=>new Promise((n,i)=>{e={onFailedAttempt:()=>{},retries:10,...e};let r=Wf.operation(e);r.attempt(async o=>{try{n(await t(o))}catch(l){if(!(l instanceof Error)){i(new TypeError(`Non-error was thrown: "${l}". You should only throw errors.`));return}if(l instanceof Rn)r.stop(),i(l.originalError);else if(l instanceof TypeError&&!Xf(l.message))r.stop(),i(l);else{zf(l,o,e);try{await e.onFailedAttempt(l)}catch(u){i(u);return}r.retry(l)||i(r.mainError())}}})});Pn.exports=$a;Pn.exports.default=$a;Pn.exports.AbortError=Rn});var hr=F((uS,ja)=>{"use strict";var Nn=Object.prototype.hasOwnProperty,Za=Object.prototype.toString,Ka=Object.defineProperty,Wa=Object.getOwnPropertyDescriptor,Ya=function(e){return typeof Array.isArray=="function"?Array.isArray(e):Za.call(e)==="[object Array]"},za=function(e){if(!e||Za.call(e)!=="[object Object]")return!1;var n=Nn.call(e,"constructor"),i=e.constructor&&e.constructor.prototype&&Nn.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!i)return!1;var r;for(r in e);return typeof r>"u"||Nn.call(e,r)},Xa=function(e,n){Ka&&n.name==="__proto__"?Ka(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},Qa=function(e,n){if(n==="__proto__")if(Nn.call(e,n)){if(Wa)return Wa(e,n).value}else return;return e[n]};ja.exports=function t(){var e,n,i,r,o,l,u=arguments[0],d=1,c=arguments.length,f=!1;for(typeof u=="boolean"&&(f=u,u=arguments[1]||{},d=2),(u==null||typeof u!="object"&&typeof u!="function")&&(u={});d<c;++d)if(e=arguments[d],e!=null)for(n in e)i=Qa(u,n),r=Qa(e,n),u!==r&&(f&&r&&(za(r)||(o=Ya(r)))?(o?(o=!1,l=i&&Ya(i)?i:[]):l=i&&za(i)?i:{},Xa(u,{name:n,newValue:t(f,l,r)})):typeof r<"u"&&Xa(u,{name:n,newValue:r}));return u}});var el=F((cS,Qf)=>{Qf.exports={name:"gaxios",version:"7.1.4",description:"A simple common HTTP client specifically for Google APIs and services.",main:"build/cjs/src/index.js",types:"build/cjs/src/index.d.ts",files:["build/"],exports:{".":{import:{types:"./build/esm/src/index.d.ts",default:"./build/esm/src/index.js"},require:{types:"./build/cjs/src/index.d.ts",default:"./build/cjs/src/index.js"}}},scripts:{lint:"gts check --no-inline-config",test:"c8 mocha build/esm/test","presystem-test":"npm run compile","system-test":"mocha build/esm/system-test --timeout 80000",compile:"tsc -b ./tsconfig.json ./tsconfig.cjs.json && node utils/enable-esm.mjs",fix:"gts fix",prepare:"npm run compile",pretest:"npm run compile",webpack:"webpack","prebrowser-test":"npm run compile","browser-test":"node build/browser-test/browser-test-runner.js",docs:"jsdoc -c .jsdoc.js","docs-test":"linkinator docs","predocs-test":"npm run docs","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean"},repository:{type:"git",directory:"packages/gaxios",url:"https://github.com/googleapis/google-cloud-node-core.git"},keywords:["google"],engines:{node:">=18"},author:"Google, LLC",license:"Apache-2.0",devDependencies:{"@babel/plugin-proposal-private-methods":"^7.18.6","@types/cors":"^2.8.6","@types/express":"^5.0.0","@types/extend":"^3.0.1","@types/mocha":"^10.0.10","@types/multiparty":"4.2.1","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^22.13.1","@types/sinon":"^17.0.3","@types/tmp":"^0.2.6",assert:"^2.0.0",browserify:"^17.0.0",c8:"^10.1.3",cors:"^2.8.5",express:"^5.0.0",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-remap-coverage":"^0.1.5","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",linkinator:"^6.1.2",mocha:"^11.1.0",multiparty:"^4.2.1",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.5","null-loader":"^4.0.1","pack-n-play":"^4.0.0",puppeteer:"^24.0.0",sinon:"^21.0.0","stream-browserify":"^3.0.0",tmp:"0.2.5","ts-loader":"^9.5.2",typescript:"5.8.3",webpack:"^5.97.1","webpack-cli":"^6.0.1"},dependencies:{extend:"^3.0.2","https-proxy-agent":"^7.0.1","node-fetch":"^3.3.2"},homepage:"https://github.com/googleapis/google-cloud-node-core/tree/main/packages/gaxios"}});var nl=F((dS,tl)=>{var Zf=el();tl.exports={pkg:Zf}});function jf(t,e){switch(t){case"stream":return e;case"json":return JSON.parse(JSON.stringify(e));case"arraybuffer":return JSON.parse(Buffer.from(e).toString("utf8"));case"blob":return JSON.parse(e.text());default:return e}}function Er(t){let e="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";function n(o){o&&o.forEach((l,u)=>{(/^authentication$/i.test(u)||/^authorization$/i.test(u)||/secret/i.test(u))&&o.set(u,e)})}function i(o,l){if(typeof o=="object"&&o!==null&&typeof o[l]=="string"){let u=o[l];(/grant_type=/i.test(u)||/assertion=/i.test(u)||/secret/i.test(u))&&(o[l]=e)}}function r(o){!o||typeof o!="object"||(o instanceof FormData||o instanceof URLSearchParams||"forEach"in o&&"set"in o?o.forEach((l,u)=>{(["grant_type","assertion"].includes(u)||/secret/.test(u))&&o.set(u,e)}):("grant_type"in o&&(o.grant_type=e),"assertion"in o&&(o.assertion=e),"client_secret"in o&&(o.client_secret=e)))}return t.config&&(n(t.config.headers),i(t.config,"data"),r(t.config.data),i(t.config,"body"),r(t.config.body),t.config.url.searchParams.has("token")&&t.config.url.searchParams.set("token",e),t.config.url.searchParams.has("client_secret")&&t.config.url.searchParams.set("client_secret",e)),t.response&&(Er({config:t.response.config}),n(t.response.headers),t.response.bodyUsed&&(i(t.response,"data"),r(t.response.data))),t}var gr,il,yr,mr,xe,_r=It(()=>{gr=tn(hr(),1),il=tn(nl(),1),yr=il.default.pkg,mr=Symbol.for(`${yr.name}-gaxios-error`),xe=class t extends Error{config;response;code;status;error;[mr]=yr.version;static[Symbol.hasInstance](e){return e&&typeof e=="object"&&mr in e&&e[mr]===yr.version?!0:Function.prototype[Symbol.hasInstance].call(t,e)}constructor(e,n,i,r){if(super(e,{cause:r}),this.config=n,this.response=i,this.error=r instanceof Error?r:void 0,this.config=(0,gr.default)(!0,{},n),this.response&&(this.response.config=(0,gr.default)(!0,{},this.response.config)),this.response){try{this.response.data=jf(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}r instanceof DOMException?this.code=r.name:r&&typeof r=="object"&&"code"in r&&(typeof r.code=="string"||typeof r.code=="number")&&(this.code=r.code)}static extractAPIErrorFromResponse(e,n="The request failed"){let i=n;if(typeof e.data=="string"&&(i=e.data),e.data&&typeof e.data=="object"&&"error"in e.data&&e.data.error&&!e.ok){if(typeof e.data.error=="string")return{message:e.data.error,code:e.status,status:e.statusText};if(typeof e.data.error=="object"){i="message"in e.data.error&&typeof e.data.error.message=="string"?e.data.error.message:i;let r="status"in e.data.error&&typeof e.data.error.status=="string"?e.data.error.status:e.statusText,o="code"in e.data.error&&typeof e.data.error.code=="number"?e.data.error.code:e.status;if("errors"in e.data.error&&Array.isArray(e.data.error.errors)){let l=[];for(let u of e.data.error.errors)typeof u=="object"&&"message"in u&&typeof u.message=="string"&&l.push(u.message);return Object.assign({message:l.join(`
3
3
  `)||i,code:o,status:r},e.data.error)}return Object.assign({message:i,code:o,status:r},e.data.error)}}return{message:i,code:e.status,status:e.statusText}}}});async function rl(t){let e=ol(t);if(!t||!t.config||!e&&!t.config.retry)return{shouldRetry:!1};e=e||{},e.currentRetryAttempt=e.currentRetryAttempt||0,e.retry=e.retry===void 0||e.retry===null?3:e.retry,e.httpMethodsToRetry=e.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"],e.noResponseRetries=e.noResponseRetries===void 0||e.noResponseRetries===null?2:e.noResponseRetries,e.retryDelayMultiplier=e.retryDelayMultiplier?e.retryDelayMultiplier:2,e.timeOfFirstRequest=e.timeOfFirstRequest?e.timeOfFirstRequest:Date.now(),e.totalTimeout=e.totalTimeout?e.totalTimeout:Number.MAX_SAFE_INTEGER,e.maxRetryDelay=e.maxRetryDelay?e.maxRetryDelay:Number.MAX_SAFE_INTEGER;let n=[[100,199],[408,408],[429,429],[500,599]];if(e.statusCodesToRetry=e.statusCodesToRetry||n,t.config.retryConfig=e,!await(e.shouldRetry||ep)(t))return{shouldRetry:!1,config:t.config};let r=tp(e);t.config.retryConfig.currentRetryAttempt+=1;let o=e.retryBackoff?e.retryBackoff(t,r):new Promise(l=>{setTimeout(l,r)});return e.onRetryAttempt&&await e.onRetryAttempt(t),await o,{shouldRetry:!0,config:t.config}}function ep(t){let e=ol(t);if(t.config.signal?.aborted&&t.code!=="TimeoutError"||t.code==="AbortError"||!e||e.retry===0||!t.response&&(e.currentRetryAttempt||0)>=e.noResponseRetries||!e.httpMethodsToRetry||!e.httpMethodsToRetry.includes(t.config.method?.toUpperCase()||"GET"))return!1;if(t.response&&t.response.status){let n=!1;for(let[i,r]of e.statusCodesToRetry){let o=t.response.status;if(o>=i&&o<=r){n=!0;break}}if(!n)return!1}return e.currentRetryAttempt=e.currentRetryAttempt||0,!(e.currentRetryAttempt>=e.retry)}function ol(t){if(t&&t.config&&t.config.retryConfig)return t.config.retryConfig}function tp(t){let n=(t.currentRetryAttempt?0:t.retryDelay??100)+(Math.pow(t.retryDelayMultiplier,t.currentRetryAttempt)-1)/2*1e3,i=t.totalTimeout-(Date.now()-t.timeOfFirstRequest);return Math.min(n,i,t.maxRetryDelay)}var sl=It(()=>{});var wt,Tr=It(()=>{wt=class extends Set{}});import{Agent as np}from"https";import{Readable as al}from"stream";var ll,Rt,ip,rp,Pt,ul=It(()=>{ll=tn(hr(),1);_r();sl();Tr();ip=async()=>globalThis.crypto?.randomUUID()||(await import("crypto")).randomUUID(),rp=204,Pt=class{agentCache=new Map;defaults;interceptors;constructor(e){this.defaults=e||{},this.interceptors={request:new wt,response:new wt}}fetch(...e){let n=e[0],i=e[1],r,o=new Headers;return typeof n=="string"?r=new URL(n):n instanceof URL?r=n:n&&n.url&&(r=new URL(n.url)),n&&typeof n=="object"&&"headers"in n&&Rt.mergeHeaders(o,n.headers),i&&Rt.mergeHeaders(o,new Headers(i.headers)),typeof n=="object"&&!(n instanceof URL)?this.request({...i,...n,headers:o,url:r}):this.request({...i,headers:o,url:r})}async request(e={}){let n=await this.#i(e);return n=await this.#t(n),this.#n(this._request(n))}async _defaultAdapter(e){let n=e.fetchImplementation||this.defaults.fetchImplementation||await Rt.#l(),i={...e};delete i.data;let r=await n(e.url,i),o=await this.getResponseData(e,r);return Object.getOwnPropertyDescriptor(r,"data")?.configurable||Object.defineProperties(r,{data:{configurable:!0,writable:!0,enumerable:!0,value:o}}),Object.assign(r,{config:e,data:o})}async _request(e){try{let n;if(e.adapter?n=await e.adapter(e,this._defaultAdapter.bind(this)):n=await this._defaultAdapter(e),!e.validateStatus(n.status)){if(e.responseType==="stream"){let r=[];for await(let o of n.data)r.push(o);n.data=r.toString()}let i=xe.extractAPIErrorFromResponse(n,`Request failed with status code ${n.status}`);throw new xe(i?.message,e,n,i)}return n}catch(n){let i;n instanceof xe?i=n:n instanceof Error?i=new xe(n.message,e,void 0,n):i=new xe("Unexpected Gaxios Error",e,void 0,n);let{shouldRetry:r,config:o}=await rl(i);if(r&&o)return i.config.retryConfig.currentRetryAttempt=o.retryConfig.currentRetryAttempt,e.retryConfig=i.config?.retryConfig,this.#r(e),this._request(e);throw e.errorRedactor&&e.errorRedactor(i),i}}async getResponseData(e,n){if(n.status===rp)return"";if(e.maxContentLength&&n.headers.has("content-length")&&e.maxContentLength<Number.parseInt(n.headers?.get("content-length")||""))throw new xe("Response's `Content-Length` is over the limit.",e,Object.assign(n,{config:e}));switch(e.responseType){case"stream":return n.body;case"json":{let i=await n.text();try{return JSON.parse(i)}catch{return i}}case"arraybuffer":return n.arrayBuffer();case"blob":return n.blob();case"text":return n.text();default:return this.getResponseDataFromContentType(n)}}#e(e,n=[]){let i=new URL(e),r=[...n],o=(process.env.NO_PROXY??process.env.no_proxy)?.split(",")||[];for(let l of o)r.push(l.trim());for(let l of r)if(l instanceof RegExp){if(l.test(i.toString()))return!1}else if(l instanceof URL){if(l.origin===i.origin)return!1}else if(l.startsWith("*.")||l.startsWith(".")){let u=l.replace(/^\*\./,".");if(i.hostname.endsWith(u))return!1}else if(l===i.origin||l===i.hostname||l===i.href)return!1;return!0}async#t(e){let n=Promise.resolve(e);for(let i of this.interceptors.request.values())i&&(n=n.then(i.resolved,i.rejected));return n}async#n(e){let n=Promise.resolve(e);for(let i of this.interceptors.response.values())i&&(n=n.then(i.resolved,i.rejected));return n}async#i(e){let n=new Headers(this.defaults.headers);Rt.mergeHeaders(n,e.headers);let i=(0,ll.default)(!0,{},this.defaults,e);if(!i.url)throw new Error("URL is required.");if(i.baseURL&&(i.url=new URL(i.url,i.baseURL)),i.url=new URL(i.url),i.params)if(i.paramsSerializer){let l=i.paramsSerializer(i.params);l.startsWith("?")&&(l=l.slice(1));let u=i.url.toString().includes("?")?"&":"?";i.url=i.url+u+l}else{let l=i.url instanceof URL?i.url:new URL(i.url);for(let[u,d]of new URLSearchParams(i.params))l.searchParams.append(u,d);i.url=l}typeof e.maxContentLength=="number"&&(i.size=e.maxContentLength),typeof e.maxRedirects=="number"&&(i.follow=e.maxRedirects);let r=typeof i.data=="string"||i.data instanceof ArrayBuffer||i.data instanceof Blob||globalThis.File&&i.data instanceof File||i.data instanceof FormData||i.data instanceof al||i.data instanceof ReadableStream||i.data instanceof String||i.data instanceof URLSearchParams||ArrayBuffer.isView(i.data)||["Blob","File","FormData"].includes(i.data?.constructor?.name||"");if(i.multipart?.length){let l=await ip();n.set("content-type",`multipart/related; boundary=${l}`),i.body=al.from(this.getMultipartRequest(i.multipart,l))}else r?i.body=i.data:typeof i.data=="object"?n.get("Content-Type")==="application/x-www-form-urlencoded"?i.body=i.paramsSerializer?i.paramsSerializer(i.data):new URLSearchParams(i.data):(n.has("content-type")||n.set("content-type","application/json"),i.body=JSON.stringify(i.data)):i.data&&(i.body=i.data);i.validateStatus=i.validateStatus||this.validateStatus,i.responseType=i.responseType||"unknown",!n.has("accept")&&i.responseType==="json"&&n.set("accept","application/json");let o=i.proxy||process?.env?.HTTPS_PROXY||process?.env?.https_proxy||process?.env?.HTTP_PROXY||process?.env?.http_proxy;if(!i.agent)if(o&&this.#e(i.url,i.noProxy)){let l=await Rt.#a();this.agentCache.has(o)?i.agent=this.agentCache.get(o):(i.agent=new l(o,{cert:i.cert,key:i.key}),this.agentCache.set(o,i.agent))}else i.cert&&i.key&&(this.agentCache.has(i.key)?i.agent=this.agentCache.get(i.key):(i.agent=new np({cert:i.cert,key:i.key}),this.agentCache.set(i.key,i.agent)));return typeof i.errorRedactor!="function"&&i.errorRedactor!==!1&&(i.errorRedactor=Er),i.body&&!("duplex"in i)&&(i.duplex="half"),this.#r(i),Object.assign(i,{headers:n,url:i.url instanceof URL?i.url:new URL(i.url)})}#r(e){if(e.timeout){let n=AbortSignal.timeout(e.timeout);e.signal&&!e.signal.aborted?e.signal=AbortSignal.any([e.signal,n]):e.signal=n}}validateStatus(e){return e>=200&&e<300}async getResponseDataFromContentType(e){let n=e.headers.get("Content-Type");if(n===null)return e.text();if(n=n.toLowerCase(),n.includes("application/json")){let i=await e.text();try{i=JSON.parse(i)}catch{}return i}else return n.match(/^text\//)?e.text():e.blob()}async*getMultipartRequest(e,n){let i=`--${n}--`;for(let r of e){let o=r.headers.get("Content-Type")||"application/octet-stream";yield`--${n}\r
4
4
  Content-Type: ${o}\r
5
5
  \r
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __mavis_cR } from "module"; import { basename as __mavis_basename, dirname as __mavis_dirname, join as __mavis_join } from "path"; import { fileURLToPath as __mavis_fileURLToPath, pathToFileURL as __mavis_pathToFileURL } from "url"; const __mavis_tuiCurrentModuleDir = __mavis_dirname(__mavis_fileURLToPath(import.meta.url)); const __mavis_tuiPackageRoot = __mavis_basename(__mavis_tuiCurrentModuleDir) === "chunks" ? __mavis_dirname(__mavis_tuiCurrentModuleDir) : __mavis_tuiCurrentModuleDir; const __mavis_tuiPackageEntryUrl = __mavis_pathToFileURL(__mavis_join(__mavis_tuiPackageRoot, "cli.js")).href; const require = __mavis_cR(__mavis_tuiPackageEntryUrl); const __dirname = __mavis_tuiPackageRoot;
2
- import{x as A}from"./chunk-RDUENEEQ.js";import{a as U}from"./chunk-HQ2U4QVQ.js";import{e as _}from"./chunk-D76SO2ME.js";var k=_(U(),1);import{createHash as $,randomUUID as O}from"node:crypto";import{cpSync as se,existsSync as u,mkdirSync as V,readdirSync as J,readFileSync as P,renameSync as L,rmSync as g,writeFileSync as M}from"node:fs";import s from"node:path";var v=".mcode-update-pending.json",I=".mcode-active",q=".mcode-update-activator.json",B=".mcode-update-activation-status.json",H=1,T=1,W=1,G=3e4,Q="MCODE_UPDATE_PARENT_PID";function w(e,r=process.platform){let t=N(r);return r==="win32"?t.join(e,"node_modules"):t.join(e,"lib","node_modules")}function K(e,r,t=process.platform){return N(t).join(w(e,t),...r.split("/"))}function z(e,r,t=process.platform){let n=N(t),o=t==="win32"?["mcode.cmd","mcode.ps1"]:["mcode"],i=t==="win32"?"":"bin";return o.map(c=>{let a=n.join(e,i,c);return{activePath:a,stagedPath:n.join(r,i,c),backupPath:`${a}.mcode-update-backup`}})}function ue(e,r,t=process.platform){let n=K(e,r,t),o=s.join(n,"package.json"),i=JSON.parse(P(o,"utf8")),c=F(i.bin,"mcode"),a=F(i.bin,"mcode-tools");if(i.name!==r||typeof i.version!="string"||!c||!a)throw new Error(`MCode package metadata is invalid at ${o}.`);return{packageRoot:n,version:i.version,binEntry:c,mcodeToolsBinEntry:a}}async function fe(e,r,t,n){await S(e,t,[s.join(r.packageRoot,...r.binEntry.split("/")),"--version"],"MCode",o=>o===n),await S(e,t,[s.join(r.packageRoot,...r.mcodeToolsBinEntry.split("/")),"--version"],"mcode-tools",o=>o.length>0),await S(e,t,["--input-type=module","--eval",`
2
+ import{D as F,g as j,i as C}from"./chunk-334CV6RF.js";import{a as V}from"./chunk-HQ2U4QVQ.js";import{e as O}from"./chunk-D76SO2ME.js";var k=O(V(),1);import{createHash as J,randomUUID as L}from"node:crypto";import{cpSync as ue,existsSync as p,mkdirSync as q,readdirSync as B,readFileSync as P,renameSync as H,rmSync as l,writeFileSync as M}from"node:fs";import s from"node:path";var v=".mcode-update-pending.json",U=".mcode-active",W=".mcode-update-activator.json",G=".mcode-update-activation-status.json",Q=1,_=1,K=1,z=3e4,X="MCODE_UPDATE_PARENT_PID";function w(e,r=process.platform){let t=A(r);return r==="win32"?t.join(e,"node_modules"):t.join(e,"lib","node_modules")}function Y(e,r,t=process.platform){return A(t).join(w(e,t),...r.split("/"))}function Z(e,r,t=process.platform){let n=A(t),o=t==="win32"?["mcode.cmd","mcode.ps1"]:["mcode"],i=t==="win32"?"":"bin";return o.map(c=>{let a=n.join(e,i,c);return{activePath:a,stagedPath:n.join(r,i,c),backupPath:`${a}.mcode-update-backup`}})}function ge(e,r,t=process.platform){let n=Y(e,r,t),o=s.join(n,"package.json"),i=JSON.parse(P(o,"utf8")),c=D(i.bin,"mcode"),a=D(i.bin,"mcode-tools");if(i.name!==r||typeof i.version!="string"||!c||!a)throw new Error(`MCode package metadata is invalid at ${o}.`);return{packageRoot:n,version:i.version,binEntry:c,mcodeToolsBinEntry:a}}async function he(e,r,t,n,o){await S(e,t,[s.join(r.packageRoot,...r.binEntry.split("/")),"--version"],"MCode",i=>i===n,o),await S(e,t,[s.join(r.packageRoot,...r.mcodeToolsBinEntry.split("/")),"--version"],"mcode-tools",i=>i.length>0,o),await S(e,t,["--input-type=module","--eval",`
3
3
  import { createRequire } from 'node:module';
4
4
  const require = createRequire(process.argv[1]);
5
5
  const Database = require('better-sqlite3');
@@ -9,10 +9,10 @@ import{x as A}from"./chunk-RDUENEEQ.js";import{a as U}from"./chunk-HQ2U4QVQ.js";
9
9
  throw new Error('SQLite validation returned an unexpected result.');
10
10
  }
11
11
  } finally { database.close(); }
12
- `,s.join(r.packageRoot,"package.json")],"SQLite",()=>!0)}function S(e,r,t,n,o){return new Promise((i,c)=>{let a=(0,k.default)(r,[...t],{cwd:e,env:process.env,stdio:["ignore","pipe","pipe"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"}),d=[],f=[];a.stdout?.on("data",p=>d.push(p)),a.stderr?.on("data",p=>f.push(p)),a.once("error",c),a.once("close",(p,l)=>{let y=Buffer.concat(d).toString("utf8").trim();if(p===0&&o(y))return i();let x=Buffer.concat(f).toString("utf8").trim()||y;c(new Error(`Staged ${n} validation failed (${l?`signal ${l}`:`exit ${String(p)}`})${x?`: ${x}`:""}`))})})}async function X(e,r=process.execPath,t=process.pid,n=[],o=process.env,i=process.cwd()){let{contents:c,pending:a}=R(e);if(s.resolve(e)!==s.resolve(a.activePrefix,v))throw new Error(`MCode pending update file is outside its active prefix: ${e}`);let d=$("sha256").update(c).digest("hex"),f=s.join(a.activePrefix,q);if(!ee(f,d))return;let p=s.join(a.activePrefix,".mcode-update-activator.cjs");try{C(a.activePrefix,d,"scheduled"),M(p,oe(),{mode:448});let l=(0,k.default)(r,[p,e,d,String(t),i,...n],{cwd:a.activePrefix,env:o,detached:!0,stdio:n.length>0?"inherit":"ignore",windowsHide:!0});await new Promise((y,x)=>{l.once("error",x),l.once("spawn",y)}),l.unref()}catch(l){try{C(a.activePrefix,d,"failed",l)}catch{}throw te(f,d,process.pid),l}}async function pe(e=process.argv[1],r=process.execPath,t=process.pid,n=[],o=process.env){let i=E(e);if(!i)return!1;let c=s.join(i,v);return u(c)?(await X(c,r,t,n,o),!0):!1}function le(e){g(e,{recursive:!0,force:!0,maxRetries:4,retryDelay:50})}function ge(e=process.argv[1]){let r=E(e);if(!r)return;let t=s.join(r,v);if(!u(t))return;let{pending:n}=R(t);if(s.resolve(t)!==s.resolve(n.activePrefix,v))throw new Error(`MCode pending update file is outside its active prefix: ${t}`);let o=Y(n);if(!o)throw new Error(`MCode pending update artifacts are incomplete at ${t}.`);return{pendingFile:t,activation:n,state:o}}function Y(e){if(e.launchers.length===0)return;if(j(e.activeModulesRoot,e.packageName,e.expectedVersion)&&e.launchers.every(o=>u(o.activePath)||u(o.stagedPath)))return"activated";if(!j(e.stagedModulesRoot,e.packageName,e.expectedVersion))return;let n=u(e.backupModulesRoot);return e.launchers.every(o=>u(o.stagedPath)||n&&u(o.activePath)&&u(o.backupPath))?"staged":void 0}function j(e,r,t){try{let n=JSON.parse(P(s.join(e,...r.split("/"),"package.json"),"utf8"));return n.name===r&&n.version===t}catch{return!1}}async function he(e=process.argv[1],r=process.env){let t=Number(r[Q]);return Number.isSafeInteger(t)&&t>0&&await Z(t),{remove:re(e)??(()=>{})}}async function Z(e){let r=Date.now()+G;for(;b(e);){if(Date.now()>=r)throw new Error(`MCode restart waited too long for parent process ${e} to exit.`);await new Promise(t=>setTimeout(t,100))}}function b(e){try{return process.kill(e,0),!0}catch(r){return r.code==="EPERM"}}function ee(e,r){for(let t=0;t<3;t+=1){let n={schemaVersion:T,journalDigest:r,pid:process.pid,startedAtMs:Date.now()};try{return M(e,`${JSON.stringify(n)}
13
- `,{flag:"wx",mode:384}),!0}catch(i){if(i.code!=="EEXIST")throw i}let o=D(e);if(o&&b(o.pid)){if(o.journalDigest===r)return!1;throw new Error("Another MCode prefix activator is running for a different journal.")}g(e,{force:!0})}throw new Error(`MCode prefix activator lease could not be acquired at ${e}.`)}function D(e){try{let r=JSON.parse(P(e,"utf8"));return r.schemaVersion!==T||typeof r.journalDigest!="string"||!Number.isSafeInteger(r.pid)||(r.pid??0)<=0||typeof r.startedAtMs!="number"?void 0:r}catch{return}}function te(e,r,t){let n=D(e);n?.journalDigest!==r||n.pid!==t||g(e,{force:!0})}function C(e,r,t,n){let o=s.join(e,B),i=`${o}.tmp-${process.pid}-${O()}`,c=n instanceof Error?n.message:n===void 0?void 0:String(n),a={schemaVersion:W,journalDigest:r,state:t,updatedAtMs:Date.now(),...c?{error:c.slice(0,2e3)}:{}};try{M(i,`${JSON.stringify(a)}
14
- `,{mode:384}),g(o,{force:!0}),L(i,o)}catch(d){throw g(i,{force:!0}),d}}function re(e=process.argv[1]){let r=E(e);if(!r)return;let t=s.join(r,I);V(t,{recursive:!0,mode:448});let n=s.join(t,`${process.pid}.json`),o=!1,i=()=>g(n,{force:!0}),c=()=>{o||(o=!0,process.off("exit",i),g(n,{force:!0}))};return M(n,`${JSON.stringify({pid:process.pid,startedAtMs:Date.now()})}
15
- `,{mode:384}),process.once("exit",i),c}function me(e,r=process.pid){let t=s.join(e,I);if(!u(t))return 0;let n;try{n=J(t)}catch{return}let o=0;for(let i of n){if(!i.endsWith(".json"))continue;let c=Number(i.slice(0,-5));if(!(!Number.isSafeInteger(c)||c<=0||c===r)){if(b(c)){o+=1;continue}try{g(s.join(t,i),{force:!0})}catch{}}}return o}function E(e){if(!e)return;try{let t=A(e);if(t)return t.prefix}catch{}let r=s.dirname(e);for(;;){let t=s.join(r,"install.json");if(u(t))try{let i=JSON.parse(P(t,"utf8"));if(i.updateOwner==="npm-prefix"&&typeof i.prefix=="string")return i.prefix}catch{return}let n=s.join(r,v);if(u(n))try{let i=ne(n);return s.resolve(i.activePrefix)===s.resolve(r)?i.activePrefix:void 0}catch{return}let o=s.dirname(r);if(o===r)return;r=o}}function ne(e){return R(e).pending}function R(e){let r=P(e,"utf8"),t=JSON.parse(r);if(t.schemaVersion!==H||typeof t.activePrefix!="string"||typeof t.stagingPrefix!="string"||typeof t.activeModulesRoot!="string"||typeof t.stagedModulesRoot!="string"||typeof t.backupModulesRoot!="string"||t.packageName!=="@minimax-ai/code"&&t.packageName!=="@minimax-ai/code"||typeof t.expectedVersion!="string"||!Array.isArray(t.launchers)||!t.launchers.every(a=>a!==null&&typeof a=="object"&&"activePath"in a&&typeof a.activePath=="string"&&"stagedPath"in a&&typeof a.stagedPath=="string"&&"backupPath"in a&&typeof a.backupPath=="string"))throw new Error(`MCode pending update metadata is invalid at ${e}.`);let n=t,o=w(n.activePrefix,process.platform),i=w(n.stagingPrefix,process.platform),c=z(n.activePrefix,n.stagingPrefix,process.platform);if(s.resolve(n.activePrefix)===s.resolve(n.stagingPrefix)||!m(n.activeModulesRoot,o)||!m(n.stagedModulesRoot,i)||!m(n.backupModulesRoot,`${o}.mcode-update-backup`)||n.launchers.length!==c.length||n.launchers.some((a,d)=>{let f=c[d];return!f||!m(a.activePath,f.activePath)||!m(a.stagedPath,f.stagedPath)||!m(a.backupPath,f.backupPath)})||!h(n.activePrefix,n.activeModulesRoot)||!h(n.activePrefix,n.backupModulesRoot)||!h(n.stagingPrefix,n.stagedModulesRoot)||n.launchers.some(a=>!h(n.activePrefix,a.activePath)||!h(n.activePrefix,a.backupPath)||!h(n.stagingPrefix,a.stagedPath)))throw new Error(`MCode pending update paths are invalid at ${e}.`);return{contents:r,pending:n}}function h(e,r){let t=s.relative(s.resolve(e),s.resolve(r));return t!==""&&!t.startsWith("..")&&!s.isAbsolute(t)}function m(e,r){return s.resolve(e)===s.resolve(r)}function N(e){return e==="win32"?s.win32:s.posix}function F(e,r){let t=typeof e=="string"&&r==="mcode"?e:e&&typeof e=="object"&&r in e?e[r]:void 0;if(typeof t!="string"||!t.trim())return;let n=t.replaceAll("\\","/").replace(/^\.\//u,"");if(!(n.startsWith("/")||n.split("/").some(o=>o==="..")))return n}function oe(){return String.raw`'use strict';
12
+ `,s.join(r.packageRoot,"package.json")],"SQLite",()=>!0,o)}function S(e,r,t,n,o,i){return new Promise((c,a)=>{C(i);let u=(0,k.default)(r,[...t],{cwd:e,env:process.env,stdio:["ignore","pipe","pipe"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL",signal:i}),f=[],m=[];u.stdout?.on("data",d=>f.push(d)),u.stderr?.on("data",d=>m.push(d)),u.once("error",d=>{d.name!=="AbortError"&&a(d)}),u.once("close",(d,y)=>{if(i?.aborted)return a(new j);let x=Buffer.concat(f).toString("utf8").trim();if(d===0&&o(x))return c();let N=Buffer.concat(m).toString("utf8").trim()||x;a(new Error(`Staged ${n} validation failed (${y?`signal ${y}`:`exit ${String(d)}`})${N?`: ${N}`:""}`))})})}async function ee(e,r=process.execPath,t=process.pid,n=[],o=process.env,i=process.cwd()){let{contents:c,pending:a}=R(e);if(s.resolve(e)!==s.resolve(a.activePrefix,v))throw new Error(`MCode pending update file is outside its active prefix: ${e}`);let u=J("sha256").update(c).digest("hex"),f=s.join(a.activePrefix,W);if(!ne(f,u))return;let m=s.join(a.activePrefix,".mcode-update-activator.cjs");try{T(a.activePrefix,u,"scheduled"),M(m,se(),{mode:448});let d=(0,k.default)(r,[m,e,u,String(t),i,...n],{cwd:a.activePrefix,env:o,detached:!0,stdio:n.length>0?"inherit":"ignore",windowsHide:!0});await new Promise((y,x)=>{d.once("error",x),d.once("spawn",y)}),d.unref()}catch(d){try{T(a.activePrefix,u,"failed",d)}catch{}throw oe(f,u,process.pid),d}}async function me(e=process.argv[1],r=process.execPath,t=process.pid,n=[],o=process.env){let i=E(e);if(!i)return!1;let c=s.join(i,v);return p(c)?(await ee(c,r,t,n,o),!0):!1}function ve(e){l(e,{recursive:!0,force:!0,maxRetries:4,retryDelay:50})}function Pe(e=process.argv[1]){let r=E(e);if(!r)return;let t=s.join(r,v);if(!p(t))return;let{pending:n}=R(t);if(s.resolve(t)!==s.resolve(n.activePrefix,v))throw new Error(`MCode pending update file is outside its active prefix: ${t}`);let o=te(n);if(!o)throw new Error(`MCode pending update artifacts are incomplete at ${t}.`);return{pendingFile:t,activation:n,state:o}}function te(e){if(e.launchers.length===0)return;if(I(e.activeModulesRoot,e.packageName,e.expectedVersion)&&e.launchers.every(o=>p(o.activePath)||p(o.stagedPath)))return"activated";if(!I(e.stagedModulesRoot,e.packageName,e.expectedVersion))return;let n=p(e.backupModulesRoot);return e.launchers.every(o=>p(o.stagedPath)||n&&p(o.activePath)&&p(o.backupPath))?"staged":void 0}function I(e,r,t){try{let n=JSON.parse(P(s.join(e,...r.split("/"),"package.json"),"utf8"));return n.name===r&&n.version===t}catch{return!1}}async function ye(e=process.argv[1],r=process.env){let t=Number(r[X]);return Number.isSafeInteger(t)&&t>0&&await re(t),{remove:ie(e)??(()=>{})}}async function re(e){let r=Date.now()+z;for(;b(e);){if(Date.now()>=r)throw new Error(`MCode restart waited too long for parent process ${e} to exit.`);await new Promise(t=>setTimeout(t,100))}}function b(e){try{return process.kill(e,0),!0}catch(r){return r.code==="EPERM"}}function ne(e,r){for(let t=0;t<3;t+=1){let n={schemaVersion:_,journalDigest:r,pid:process.pid,startedAtMs:Date.now()};try{return M(e,`${JSON.stringify(n)}
13
+ `,{flag:"wx",mode:384}),!0}catch(i){if(i.code!=="EEXIST")throw i}let o=$(e);if(o&&b(o.pid)){if(o.journalDigest===r)return!1;throw new Error("Another MCode prefix activator is running for a different journal.")}l(e,{force:!0})}throw new Error(`MCode prefix activator lease could not be acquired at ${e}.`)}function $(e){try{let r=JSON.parse(P(e,"utf8"));return r.schemaVersion!==_||typeof r.journalDigest!="string"||!Number.isSafeInteger(r.pid)||(r.pid??0)<=0||typeof r.startedAtMs!="number"?void 0:r}catch{return}}function oe(e,r,t){let n=$(e);n?.journalDigest!==r||n.pid!==t||l(e,{force:!0})}function T(e,r,t,n){let o=s.join(e,G),i=`${o}.tmp-${process.pid}-${L()}`,c=n instanceof Error?n.message:n===void 0?void 0:String(n),a={schemaVersion:K,journalDigest:r,state:t,updatedAtMs:Date.now(),...c?{error:c.slice(0,2e3)}:{}};try{M(i,`${JSON.stringify(a)}
14
+ `,{mode:384}),l(o,{force:!0}),H(i,o)}catch(u){throw l(i,{force:!0}),u}}function ie(e=process.argv[1]){let r=E(e);if(!r)return;let t=s.join(r,U);q(t,{recursive:!0,mode:448});let n=s.join(t,`${process.pid}.json`),o=!1,i=()=>l(n,{force:!0}),c=()=>{o||(o=!0,process.off("exit",i),l(n,{force:!0}))};return M(n,`${JSON.stringify({pid:process.pid,startedAtMs:Date.now()})}
15
+ `,{mode:384}),process.once("exit",i),c}function xe(e,r=process.pid){let t=s.join(e,U);if(!p(t))return 0;let n;try{n=B(t)}catch{return}let o=0;for(let i of n){if(!i.endsWith(".json"))continue;let c=Number(i.slice(0,-5));if(!(!Number.isSafeInteger(c)||c<=0||c===r)){if(b(c)){o+=1;continue}try{l(s.join(t,i),{force:!0})}catch{}}}return o}function E(e){if(!e)return;try{let t=F(e);if(t)return t.prefix}catch{}let r=s.dirname(e);for(;;){let t=s.join(r,"install.json");if(p(t))try{let i=JSON.parse(P(t,"utf8"));if(i.updateOwner==="npm-prefix"&&typeof i.prefix=="string")return i.prefix}catch{return}let n=s.join(r,v);if(p(n))try{let i=ae(n);return s.resolve(i.activePrefix)===s.resolve(r)?i.activePrefix:void 0}catch{return}let o=s.dirname(r);if(o===r)return;r=o}}function ae(e){return R(e).pending}function R(e){let r=P(e,"utf8"),t=JSON.parse(r);if(t.schemaVersion!==Q||typeof t.activePrefix!="string"||typeof t.stagingPrefix!="string"||typeof t.activeModulesRoot!="string"||typeof t.stagedModulesRoot!="string"||typeof t.backupModulesRoot!="string"||t.packageName!=="@minimax-ai/code"&&t.packageName!=="@minimax-ai/code"||typeof t.expectedVersion!="string"||!Array.isArray(t.launchers)||!t.launchers.every(a=>a!==null&&typeof a=="object"&&"activePath"in a&&typeof a.activePath=="string"&&"stagedPath"in a&&typeof a.stagedPath=="string"&&"backupPath"in a&&typeof a.backupPath=="string"))throw new Error(`MCode pending update metadata is invalid at ${e}.`);let n=t,o=w(n.activePrefix,process.platform),i=w(n.stagingPrefix,process.platform),c=Z(n.activePrefix,n.stagingPrefix,process.platform);if(s.resolve(n.activePrefix)===s.resolve(n.stagingPrefix)||!h(n.activeModulesRoot,o)||!h(n.stagedModulesRoot,i)||!h(n.backupModulesRoot,`${o}.mcode-update-backup`)||n.launchers.length!==c.length||n.launchers.some((a,u)=>{let f=c[u];return!f||!h(a.activePath,f.activePath)||!h(a.stagedPath,f.stagedPath)||!h(a.backupPath,f.backupPath)})||!g(n.activePrefix,n.activeModulesRoot)||!g(n.activePrefix,n.backupModulesRoot)||!g(n.stagingPrefix,n.stagedModulesRoot)||n.launchers.some(a=>!g(n.activePrefix,a.activePath)||!g(n.activePrefix,a.backupPath)||!g(n.stagingPrefix,a.stagedPath)))throw new Error(`MCode pending update paths are invalid at ${e}.`);return{contents:r,pending:n}}function g(e,r){let t=s.relative(s.resolve(e),s.resolve(r));return t!==""&&!t.startsWith("..")&&!s.isAbsolute(t)}function h(e,r){return s.resolve(e)===s.resolve(r)}function A(e){return e==="win32"?s.win32:s.posix}function D(e,r){let t=typeof e=="string"&&r==="mcode"?e:e&&typeof e=="object"&&r in e?e[r]:void 0;if(typeof t!="string"||!t.trim())return;let n=t.replaceAll("\\","/").replace(/^\.\//u,"");if(!(n.startsWith("/")||n.split("/").some(o=>o==="..")))return n}function se(){return String.raw`'use strict';
16
16
  const fs = require('node:fs');
17
17
  const path = require('node:path');
18
18
  const cp = require('node:child_process');
@@ -161,4 +161,4 @@ async function activate() {
161
161
  writeStatus('activating');
162
162
  await activate();
163
163
  })().catch((error) => { writeStatus('failed', error); process.stderr.write(String(error && error.stack || error) + '\n'); process.exitCode = 1; });
164
- `}export{K as a,ue as b,fe as c,pe as d,le as e,ge as f,he as g,me as h,F as i};
164
+ `}export{Y as a,ge as b,he as c,S as d,me as e,ve as f,Pe as g,ye as h,xe as i,D as j};
@@ -5,4 +5,4 @@ import{a as m,c as x,e as N}from"./chunk-D76SO2ME.js";var T=x((xr,Ve)=>{"use str
5
5
  `+Object.keys(r).map(i=>`${i}: ${r[i]}`).join(`\r
6
6
  `)+`\r
7
7
  \r
8
- `+s)}function M(t,e,s,r,i,n){if(t.listenerCount("wsClientError")){let o=new Error(i);Error.captureStackTrace(o,M),t.emit("wsClientError",o,s,e)}else se(s,r,i,n)}});var dr=N(Mt(),1),_r=N(ce(),1),pr=N(G(),1),mr=N(Le(),1),gr=N(Be(),1),yr=N(Ae(),1),zt=N(pe(),1),Sr=N(Vt(),1);var Ar=zt.default;export{zt as a,Ar as b};
8
+ `+s)}function M(t,e,s,r,i,n){if(t.listenerCount("wsClientError")){let o=new Error(i);Error.captureStackTrace(o,M),t.emit("wsClientError",o,s,e)}else se(s,r,i,n)}});var dr=N(Mt(),1),_r=N(ce(),1),pr=N(G(),1),mr=N(Le(),1),gr=N(Be(),1),yr=N(Ae(),1),zt=N(pe(),1),Sr=N(Vt(),1);var Ar=zt.default;export{zt as a,Sr as b,Ar as c};