clavue 9.0.0 → 9.0.2

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.
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __createRequire } from "node:module";
2
2
  const require = __createRequire(import.meta.url);
3
- // clavue v9.0.0 mao-command (built from source)
3
+ // clavue v9.0.2 mao-command (built from source)
4
4
  var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0}),__require=(x=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(x,{get:(a,b)=>(typeof require<"u"?require:a)[b]}):x)(function(x){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+x+'" is not supported')});var __commonJS=(cb,mod)=>function(){return mod||(0,cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod));var require_polyfills=__commonJS({"../../node_modules/graceful-fs/polyfills.js"(exports,module){var constants=__require("constants"),origCwd=process.cwd,cwd=null,platform=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return cwd||(cwd=origCwd.call(process)),cwd};try{process.cwd()}catch{}typeof process.chdir=="function"&&(chdir=process.chdir,process.chdir=function(d){cwd=null,chdir.call(process,d)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,chdir));var chdir;module.exports=patch;function patch(fs6){constants.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&patchLchmod(fs6),fs6.lutimes||patchLutimes(fs6),fs6.chown=chownFix(fs6.chown),fs6.fchown=chownFix(fs6.fchown),fs6.lchown=chownFix(fs6.lchown),fs6.chmod=chmodFix(fs6.chmod),fs6.fchmod=chmodFix(fs6.fchmod),fs6.lchmod=chmodFix(fs6.lchmod),fs6.chownSync=chownFixSync(fs6.chownSync),fs6.fchownSync=chownFixSync(fs6.fchownSync),fs6.lchownSync=chownFixSync(fs6.lchownSync),fs6.chmodSync=chmodFixSync(fs6.chmodSync),fs6.fchmodSync=chmodFixSync(fs6.fchmodSync),fs6.lchmodSync=chmodFixSync(fs6.lchmodSync),fs6.stat=statFix(fs6.stat),fs6.fstat=statFix(fs6.fstat),fs6.lstat=statFix(fs6.lstat),fs6.statSync=statFixSync(fs6.statSync),fs6.fstatSync=statFixSync(fs6.fstatSync),fs6.lstatSync=statFixSync(fs6.lstatSync),fs6.chmod&&!fs6.lchmod&&(fs6.lchmod=function(path6,mode,cb){cb&&process.nextTick(cb)},fs6.lchmodSync=function(){}),fs6.chown&&!fs6.lchown&&(fs6.lchown=function(path6,uid,gid,cb){cb&&process.nextTick(cb)},fs6.lchownSync=function(){}),platform==="win32"&&(fs6.rename=typeof fs6.rename!="function"?fs6.rename:(function(fs$rename){function rename(from,to,cb){var start=Date.now(),backoff=0;fs$rename(from,to,__name(function CB(er){if(er&&(er.code==="EACCES"||er.code==="EPERM"||er.code==="EBUSY")&&Date.now()-start<6e4){setTimeout(function(){fs6.stat(to,function(stater,st){stater&&stater.code==="ENOENT"?fs$rename(from,to,CB):cb(er)})},backoff),backoff<100&&(backoff+=10);return}cb&&cb(er)},"CB"))}return __name(rename,"rename"),Object.setPrototypeOf&&Object.setPrototypeOf(rename,fs$rename),rename})(fs6.rename)),fs6.read=typeof fs6.read!="function"?fs6.read:(function(fs$read){function read(fd,buffer,offset,length,position,callback_){var callback;if(callback_&&typeof callback_=="function"){var eagCounter=0;callback=__name(function(er,_,__){if(er&&er.code==="EAGAIN"&&eagCounter<10)return eagCounter++,fs$read.call(fs6,fd,buffer,offset,length,position,callback);callback_.apply(this,arguments)},"callback")}return fs$read.call(fs6,fd,buffer,offset,length,position,callback)}return __name(read,"read"),Object.setPrototypeOf&&Object.setPrototypeOf(read,fs$read),read})(fs6.read),fs6.readSync=typeof fs6.readSync!="function"?fs6.readSync:(function(fs$readSync){return function(fd,buffer,offset,length,position){for(var eagCounter=0;;)try{return fs$readSync.call(fs6,fd,buffer,offset,length,position)}catch(er){if(er.code==="EAGAIN"&&eagCounter<10){eagCounter++;continue}throw er}}})(fs6.readSync);function patchLchmod(fs7){fs7.lchmod=function(path6,mode,callback){fs7.open(path6,constants.O_WRONLY|constants.O_SYMLINK,mode,function(err,fd){if(err){callback&&callback(err);return}fs7.fchmod(fd,mode,function(err2){fs7.close(fd,function(err22){callback&&callback(err2||err22)})})})},fs7.lchmodSync=function(path6,mode){var fd=fs7.openSync(path6,constants.O_WRONLY|constants.O_SYMLINK,mode),threw=!0,ret;try{ret=fs7.fchmodSync(fd,mode),threw=!1}finally{if(threw)try{fs7.closeSync(fd)}catch{}else fs7.closeSync(fd)}return ret}}__name(patchLchmod,"patchLchmod");function patchLutimes(fs7){constants.hasOwnProperty("O_SYMLINK")&&fs7.futimes?(fs7.lutimes=function(path6,at,mt,cb){fs7.open(path6,constants.O_SYMLINK,function(er,fd){if(er){cb&&cb(er);return}fs7.futimes(fd,at,mt,function(er2){fs7.close(fd,function(er22){cb&&cb(er2||er22)})})})},fs7.lutimesSync=function(path6,at,mt){var fd=fs7.openSync(path6,constants.O_SYMLINK),ret,threw=!0;try{ret=fs7.futimesSync(fd,at,mt),threw=!1}finally{if(threw)try{fs7.closeSync(fd)}catch{}else fs7.closeSync(fd)}return ret}):fs7.futimes&&(fs7.lutimes=function(_a,_b,_c,cb){cb&&process.nextTick(cb)},fs7.lutimesSync=function(){})}__name(patchLutimes,"patchLutimes");function chmodFix(orig){return orig&&function(target,mode,cb){return orig.call(fs6,target,mode,function(er){chownErOk(er)&&(er=null),cb&&cb.apply(this,arguments)})}}__name(chmodFix,"chmodFix");function chmodFixSync(orig){return orig&&function(target,mode){try{return orig.call(fs6,target,mode)}catch(er){if(!chownErOk(er))throw er}}}__name(chmodFixSync,"chmodFixSync");function chownFix(orig){return orig&&function(target,uid,gid,cb){return orig.call(fs6,target,uid,gid,function(er){chownErOk(er)&&(er=null),cb&&cb.apply(this,arguments)})}}__name(chownFix,"chownFix");function chownFixSync(orig){return orig&&function(target,uid,gid){try{return orig.call(fs6,target,uid,gid)}catch(er){if(!chownErOk(er))throw er}}}__name(chownFixSync,"chownFixSync");function statFix(orig){return orig&&function(target,options,cb){typeof options=="function"&&(cb=options,options=null);function callback(er,stats){stats&&(stats.uid<0&&(stats.uid+=4294967296),stats.gid<0&&(stats.gid+=4294967296)),cb&&cb.apply(this,arguments)}return __name(callback,"callback"),options?orig.call(fs6,target,options,callback):orig.call(fs6,target,callback)}}__name(statFix,"statFix");function statFixSync(orig){return orig&&function(target,options){var stats=options?orig.call(fs6,target,options):orig.call(fs6,target);return stats&&(stats.uid<0&&(stats.uid+=4294967296),stats.gid<0&&(stats.gid+=4294967296)),stats}}__name(statFixSync,"statFixSync");function chownErOk(er){if(!er||er.code==="ENOSYS")return!0;var nonroot=!process.getuid||process.getuid()!==0;return!!(nonroot&&(er.code==="EINVAL"||er.code==="EPERM"))}__name(chownErOk,"chownErOk")}__name(patch,"patch")}});var require_legacy_streams=__commonJS({"../../node_modules/graceful-fs/legacy-streams.js"(exports,module){var Stream=__require("stream").Stream;module.exports=legacy;function legacy(fs6){return{ReadStream,WriteStream};function ReadStream(path6,options){if(!(this instanceof ReadStream))return new ReadStream(path6,options);Stream.call(this);var self=this;this.path=path6,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,options=options||{};for(var keys=Object.keys(options),index=0,length=keys.length;index<length;index++){var key=keys[index];this[key]=options[key]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){self._read()});return}fs6.open(this.path,this.flags,this.mode,function(err,fd){if(err){self.emit("error",err),self.readable=!1;return}self.fd=fd,self.emit("open",fd),self._read()})}function WriteStream(path6,options){if(!(this instanceof WriteStream))return new WriteStream(path6,options);Stream.call(this),this.path=path6,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,options=options||{};for(var keys=Object.keys(options),index=0,length=keys.length;index<length;index++){var key=keys[index];this[key]=options[key]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=fs6.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}__name(legacy,"legacy")}});var require_clone=__commonJS({"../../node_modules/graceful-fs/clone.js"(exports,module){"use strict";module.exports=clone;var getPrototypeOf=Object.getPrototypeOf||function(obj){return obj.__proto__};function clone(obj){if(obj===null||typeof obj!="object")return obj;if(obj instanceof Object)var copy={__proto__:getPrototypeOf(obj)};else var copy=Object.create(null);return Object.getOwnPropertyNames(obj).forEach(function(key){Object.defineProperty(copy,key,Object.getOwnPropertyDescriptor(obj,key))}),copy}__name(clone,"clone")}});var require_graceful_fs=__commonJS({"../../node_modules/graceful-fs/graceful-fs.js"(exports,module){var fs6=__require("fs"),polyfills=require_polyfills(),legacy=require_legacy_streams(),clone=require_clone(),util=__require("util"),gracefulQueue,previousSymbol;typeof Symbol=="function"&&typeof Symbol.for=="function"?(gracefulQueue=Symbol.for("graceful-fs.queue"),previousSymbol=Symbol.for("graceful-fs.previous")):(gracefulQueue="___graceful-fs.queue",previousSymbol="___graceful-fs.previous");function noop(){}__name(noop,"noop");function publishQueue(context,queue2){Object.defineProperty(context,gracefulQueue,{get:__name(function(){return queue2},"get")})}__name(publishQueue,"publishQueue");var debug=noop;util.debuglog?debug=util.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(debug=__name(function(){var m=util.format.apply(util,arguments);m="GFS4: "+m.split(/\n/).join(`
5
5
  GFS4: `),console.error(m)},"debug"));fs6[gracefulQueue]||(queue=global[gracefulQueue]||[],publishQueue(fs6,queue),fs6.close=(function(fs$close){function close(fd,cb){return fs$close.call(fs6,fd,function(err){err||resetQueue(),typeof cb=="function"&&cb.apply(this,arguments)})}return __name(close,"close"),Object.defineProperty(close,previousSymbol,{value:fs$close}),close})(fs6.close),fs6.closeSync=(function(fs$closeSync){function closeSync(fd){fs$closeSync.apply(fs6,arguments),resetQueue()}return __name(closeSync,"closeSync"),Object.defineProperty(closeSync,previousSymbol,{value:fs$closeSync}),closeSync})(fs6.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){debug(fs6[gracefulQueue]),__require("assert").equal(fs6[gracefulQueue].length,0)}));var queue;global[gracefulQueue]||publishQueue(global,fs6[gracefulQueue]);module.exports=patch(clone(fs6));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!fs6.__patched&&(module.exports=patch(fs6),fs6.__patched=!0);function patch(fs7){polyfills(fs7),fs7.gracefulify=patch,fs7.createReadStream=createReadStream,fs7.createWriteStream=createWriteStream;var fs$readFile=fs7.readFile;fs7.readFile=readFile;function readFile(path6,options,cb){return typeof options=="function"&&(cb=options,options=null),go$readFile(path6,options,cb);function go$readFile(path7,options2,cb2,startTime){return fs$readFile(path7,options2,function(err){err&&(err.code==="EMFILE"||err.code==="ENFILE")?enqueue([go$readFile,[path7,options2,cb2],err,startTime||Date.now(),Date.now()]):typeof cb2=="function"&&cb2.apply(this,arguments)})}__name(go$readFile,"go$readFile")}__name(readFile,"readFile");var fs$writeFile=fs7.writeFile;fs7.writeFile=writeFile;function writeFile(path6,data,options,cb){return typeof options=="function"&&(cb=options,options=null),go$writeFile(path6,data,options,cb);function go$writeFile(path7,data2,options2,cb2,startTime){return fs$writeFile(path7,data2,options2,function(err){err&&(err.code==="EMFILE"||err.code==="ENFILE")?enqueue([go$writeFile,[path7,data2,options2,cb2],err,startTime||Date.now(),Date.now()]):typeof cb2=="function"&&cb2.apply(this,arguments)})}__name(go$writeFile,"go$writeFile")}__name(writeFile,"writeFile");var fs$appendFile=fs7.appendFile;fs$appendFile&&(fs7.appendFile=appendFile);function appendFile(path6,data,options,cb){return typeof options=="function"&&(cb=options,options=null),go$appendFile(path6,data,options,cb);function go$appendFile(path7,data2,options2,cb2,startTime){return fs$appendFile(path7,data2,options2,function(err){err&&(err.code==="EMFILE"||err.code==="ENFILE")?enqueue([go$appendFile,[path7,data2,options2,cb2],err,startTime||Date.now(),Date.now()]):typeof cb2=="function"&&cb2.apply(this,arguments)})}__name(go$appendFile,"go$appendFile")}__name(appendFile,"appendFile");var fs$copyFile=fs7.copyFile;fs$copyFile&&(fs7.copyFile=copyFile);function copyFile(src,dest,flags,cb){return typeof flags=="function"&&(cb=flags,flags=0),go$copyFile(src,dest,flags,cb);function go$copyFile(src2,dest2,flags2,cb2,startTime){return fs$copyFile(src2,dest2,flags2,function(err){err&&(err.code==="EMFILE"||err.code==="ENFILE")?enqueue([go$copyFile,[src2,dest2,flags2,cb2],err,startTime||Date.now(),Date.now()]):typeof cb2=="function"&&cb2.apply(this,arguments)})}__name(go$copyFile,"go$copyFile")}__name(copyFile,"copyFile");var fs$readdir=fs7.readdir;fs7.readdir=readdir;var noReaddirOptionVersions=/^v[0-5]\./;function readdir(path6,options,cb){typeof options=="function"&&(cb=options,options=null);var go$readdir=noReaddirOptionVersions.test(process.version)?__name(function(path7,options2,cb2,startTime){return fs$readdir(path7,fs$readdirCallback(path7,options2,cb2,startTime))},"go$readdir"):__name(function(path7,options2,cb2,startTime){return fs$readdir(path7,options2,fs$readdirCallback(path7,options2,cb2,startTime))},"go$readdir");return go$readdir(path6,options,cb);function fs$readdirCallback(path7,options2,cb2,startTime){return function(err,files){err&&(err.code==="EMFILE"||err.code==="ENFILE")?enqueue([go$readdir,[path7,options2,cb2],err,startTime||Date.now(),Date.now()]):(files&&files.sort&&files.sort(),typeof cb2=="function"&&cb2.call(this,err,files))}}}if(__name(readdir,"readdir"),process.version.substr(0,4)==="v0.8"){var legStreams=legacy(fs7);ReadStream=legStreams.ReadStream,WriteStream=legStreams.WriteStream}var fs$ReadStream=fs7.ReadStream;fs$ReadStream&&(ReadStream.prototype=Object.create(fs$ReadStream.prototype),ReadStream.prototype.open=ReadStream$open);var fs$WriteStream=fs7.WriteStream;fs$WriteStream&&(WriteStream.prototype=Object.create(fs$WriteStream.prototype),WriteStream.prototype.open=WriteStream$open),Object.defineProperty(fs7,"ReadStream",{get:__name(function(){return ReadStream},"get"),set:__name(function(val){ReadStream=val},"set"),enumerable:!0,configurable:!0}),Object.defineProperty(fs7,"WriteStream",{get:__name(function(){return WriteStream},"get"),set:__name(function(val){WriteStream=val},"set"),enumerable:!0,configurable:!0});var FileReadStream=ReadStream;Object.defineProperty(fs7,"FileReadStream",{get:__name(function(){return FileReadStream},"get"),set:__name(function(val){FileReadStream=val},"set"),enumerable:!0,configurable:!0});var FileWriteStream=WriteStream;Object.defineProperty(fs7,"FileWriteStream",{get:__name(function(){return FileWriteStream},"get"),set:__name(function(val){FileWriteStream=val},"set"),enumerable:!0,configurable:!0});function ReadStream(path6,options){return this instanceof ReadStream?(fs$ReadStream.apply(this,arguments),this):ReadStream.apply(Object.create(ReadStream.prototype),arguments)}__name(ReadStream,"ReadStream");function ReadStream$open(){var that=this;open(that.path,that.flags,that.mode,function(err,fd){err?(that.autoClose&&that.destroy(),that.emit("error",err)):(that.fd=fd,that.emit("open",fd),that.read())})}__name(ReadStream$open,"ReadStream$open");function WriteStream(path6,options){return this instanceof WriteStream?(fs$WriteStream.apply(this,arguments),this):WriteStream.apply(Object.create(WriteStream.prototype),arguments)}__name(WriteStream,"WriteStream");function WriteStream$open(){var that=this;open(that.path,that.flags,that.mode,function(err,fd){err?(that.destroy(),that.emit("error",err)):(that.fd=fd,that.emit("open",fd))})}__name(WriteStream$open,"WriteStream$open");function createReadStream(path6,options){return new fs7.ReadStream(path6,options)}__name(createReadStream,"createReadStream");function createWriteStream(path6,options){return new fs7.WriteStream(path6,options)}__name(createWriteStream,"createWriteStream");var fs$open=fs7.open;fs7.open=open;function open(path6,flags,mode,cb){return typeof mode=="function"&&(cb=mode,mode=null),go$open(path6,flags,mode,cb);function go$open(path7,flags2,mode2,cb2,startTime){return fs$open(path7,flags2,mode2,function(err,fd){err&&(err.code==="EMFILE"||err.code==="ENFILE")?enqueue([go$open,[path7,flags2,mode2,cb2],err,startTime||Date.now(),Date.now()]):typeof cb2=="function"&&cb2.apply(this,arguments)})}__name(go$open,"go$open")}return __name(open,"open"),fs7}__name(patch,"patch");function enqueue(elem){debug("ENQUEUE",elem[0].name,elem[1]),fs6[gracefulQueue].push(elem),retry()}__name(enqueue,"enqueue");var retryTimer;function resetQueue(){for(var now=Date.now(),i=0;i<fs6[gracefulQueue].length;++i)fs6[gracefulQueue][i].length>2&&(fs6[gracefulQueue][i][3]=now,fs6[gracefulQueue][i][4]=now);retry()}__name(resetQueue,"resetQueue");function retry(){if(clearTimeout(retryTimer),retryTimer=void 0,fs6[gracefulQueue].length!==0){var elem=fs6[gracefulQueue].shift(),fn=elem[0],args=elem[1],err=elem[2],startTime=elem[3],lastTime=elem[4];if(startTime===void 0)debug("RETRY",fn.name,args),fn.apply(null,args);else if(Date.now()-startTime>=6e4){debug("TIMEOUT",fn.name,args);var cb=args.pop();typeof cb=="function"&&cb.call(null,err)}else{var sinceAttempt=Date.now()-lastTime,sinceStart=Math.max(lastTime-startTime,1),desiredDelay=Math.min(sinceStart*1.2,100);sinceAttempt>=desiredDelay?(debug("RETRY",fn.name,args),fn.apply(null,args.concat([startTime]))):fs6[gracefulQueue].push(elem)}retryTimer===void 0&&(retryTimer=setTimeout(retry,0))}}__name(retry,"retry")}});var require_retry_operation=__commonJS({"../../node_modules/retry/lib/retry_operation.js"(exports,module){function RetryOperation(timeouts,options){typeof options=="boolean"&&(options={forever:options}),this._originalTimeouts=JSON.parse(JSON.stringify(timeouts)),this._timeouts=timeouts,this._options=options||{},this._maxRetryTime=options&&options.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}__name(RetryOperation,"RetryOperation");module.exports=RetryOperation;RetryOperation.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};RetryOperation.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};RetryOperation.prototype.retry=function(err){if(this._timeout&&clearTimeout(this._timeout),!err)return!1;var currentTime=new Date().getTime();if(err&&currentTime-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(err);var timeout=this._timeouts.shift();if(timeout===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),timeout=this._timeouts.shift();else return!1;var self=this,timer=setTimeout(function(){self._attempts++,self._operationTimeoutCb&&(self._timeout=setTimeout(function(){self._operationTimeoutCb(self._attempts)},self._operationTimeout),self._options.unref&&self._timeout.unref()),self._fn(self._attempts)},timeout);return this._options.unref&&timer.unref(),!0};RetryOperation.prototype.attempt=function(fn,timeoutOps){this._fn=fn,timeoutOps&&(timeoutOps.timeout&&(this._operationTimeout=timeoutOps.timeout),timeoutOps.cb&&(this._operationTimeoutCb=timeoutOps.cb));var self=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){self._operationTimeoutCb()},self._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};RetryOperation.prototype.try=function(fn){console.log("Using RetryOperation.try() is deprecated"),this.attempt(fn)};RetryOperation.prototype.start=function(fn){console.log("Using RetryOperation.start() is deprecated"),this.attempt(fn)};RetryOperation.prototype.start=RetryOperation.prototype.try;RetryOperation.prototype.errors=function(){return this._errors};RetryOperation.prototype.attempts=function(){return this._attempts};RetryOperation.prototype.mainError=function(){if(this._errors.length===0)return null;for(var counts={},mainError=null,mainErrorCount=0,i=0;i<this._errors.length;i++){var error=this._errors[i],message=error.message,count=(counts[message]||0)+1;counts[message]=count,count>=mainErrorCount&&(mainError=error,mainErrorCount=count)}return mainError}}});var require_retry=__commonJS({"../../node_modules/retry/lib/retry.js"(exports){var RetryOperation=require_retry_operation();exports.operation=function(options){var timeouts=exports.timeouts(options);return new RetryOperation(timeouts,{forever:options&&options.forever,unref:options&&options.unref,maxRetryTime:options&&options.maxRetryTime})};exports.timeouts=function(options){if(options instanceof Array)return[].concat(options);var opts={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var key in options)opts[key]=options[key];if(opts.minTimeout>opts.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var timeouts=[],i=0;i<opts.retries;i++)timeouts.push(this.createTimeout(i,opts));return options&&options.forever&&!timeouts.length&&timeouts.push(this.createTimeout(i,opts)),timeouts.sort(function(a,b){return a-b}),timeouts};exports.createTimeout=function(attempt,opts){var random=opts.randomize?Math.random()+1:1,timeout=Math.round(random*opts.minTimeout*Math.pow(opts.factor,attempt));return timeout=Math.min(timeout,opts.maxTimeout),timeout};exports.wrap=function(obj,options,methods){if(options instanceof Array&&(methods=options,options=null),!methods){methods=[];for(var key in obj)typeof obj[key]=="function"&&methods.push(key)}for(var i=0;i<methods.length;i++){var method=methods[i],original=obj[method];obj[method]=__name(function(original2){var op=exports.operation(options),args=Array.prototype.slice.call(arguments,1),callback=args.pop();args.push(function(err){op.retry(err)||(err&&(arguments[0]=op.mainError()),callback.apply(this,arguments))}),op.attempt(function(){original2.apply(obj,args)})},"retryWrapper").bind(obj,original),obj[method].options=options}}}});var require_retry2=__commonJS({"../../node_modules/retry/index.js"(exports,module){module.exports=require_retry()}});var require_signals=__commonJS({"../../node_modules/proper-lockfile/node_modules/signal-exit/signals.js"(exports,module){module.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&module.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&module.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}});var require_signal_exit=__commonJS({"../../node_modules/proper-lockfile/node_modules/signal-exit/index.js"(exports,module){var process8=global.process,processOk=__name(function(process9){return process9&&typeof process9=="object"&&typeof process9.removeListener=="function"&&typeof process9.emit=="function"&&typeof process9.reallyExit=="function"&&typeof process9.listeners=="function"&&typeof process9.kill=="function"&&typeof process9.pid=="number"&&typeof process9.on=="function"},"processOk");processOk(process8)?(assert=__require("assert"),signals=require_signals(),isWin=/^win/i.test(process8.platform),EE=__require("events"),typeof EE!="function"&&(EE=EE.EventEmitter),process8.__signal_exit_emitter__?emitter=process8.__signal_exit_emitter__:(emitter=process8.__signal_exit_emitter__=new EE,emitter.count=0,emitter.emitted={}),emitter.infinite||(emitter.setMaxListeners(1/0),emitter.infinite=!0),module.exports=function(cb,opts){if(!processOk(global.process))return function(){};assert.equal(typeof cb,"function","a callback must be provided for exit handler"),loaded===!1&&load();var ev="exit";opts&&opts.alwaysLast&&(ev="afterexit");var remove=__name(function(){emitter.removeListener(ev,cb),emitter.listeners("exit").length===0&&emitter.listeners("afterexit").length===0&&unload()},"remove");return emitter.on(ev,cb),remove},unload=__name(function(){!loaded||!processOk(global.process)||(loaded=!1,signals.forEach(function(sig){try{process8.removeListener(sig,sigListeners[sig])}catch{}}),process8.emit=originalProcessEmit,process8.reallyExit=originalProcessReallyExit,emitter.count-=1)},"unload"),module.exports.unload=unload,emit=__name(function(event,code,signal){emitter.emitted[event]||(emitter.emitted[event]=!0,emitter.emit(event,code,signal))},"emit"),sigListeners={},signals.forEach(function(sig){sigListeners[sig]=__name(function(){if(processOk(global.process)){var listeners=process8.listeners(sig);listeners.length===emitter.count&&(unload(),emit("exit",null,sig),emit("afterexit",null,sig),isWin&&sig==="SIGHUP"&&(sig="SIGINT"),process8.kill(process8.pid,sig))}},"listener")}),module.exports.signals=function(){return signals},loaded=!1,load=__name(function(){loaded||!processOk(global.process)||(loaded=!0,emitter.count+=1,signals=signals.filter(function(sig){try{return process8.on(sig,sigListeners[sig]),!0}catch{return!1}}),process8.emit=processEmit,process8.reallyExit=processReallyExit)},"load"),module.exports.load=load,originalProcessReallyExit=process8.reallyExit,processReallyExit=__name(function(code){processOk(global.process)&&(process8.exitCode=code||0,emit("exit",process8.exitCode,null),emit("afterexit",process8.exitCode,null),originalProcessReallyExit.call(process8,process8.exitCode))},"processReallyExit"),originalProcessEmit=process8.emit,processEmit=__name(function(ev,arg){if(ev==="exit"&&processOk(global.process)){arg!==void 0&&(process8.exitCode=arg);var ret=originalProcessEmit.apply(this,arguments);return emit("exit",process8.exitCode,null),emit("afterexit",process8.exitCode,null),ret}else return originalProcessEmit.apply(this,arguments)},"processEmit")):module.exports=function(){return function(){}};var assert,signals,isWin,EE,emitter,unload,emit,sigListeners,loaded,load,originalProcessReallyExit,processReallyExit,originalProcessEmit,processEmit}});var require_mtime_precision=__commonJS({"../../node_modules/proper-lockfile/lib/mtime-precision.js"(exports,module){"use strict";var cacheSymbol=Symbol();function probe(file,fs6,callback){let cachedPrecision=fs6[cacheSymbol];if(cachedPrecision)return fs6.stat(file,(err,stat)=>{if(err)return callback(err);callback(null,stat.mtime,cachedPrecision)});let mtime=new Date(Math.ceil(Date.now()/1e3)*1e3+5);fs6.utimes(file,mtime,mtime,err=>{if(err)return callback(err);fs6.stat(file,(err2,stat)=>{if(err2)return callback(err2);let precision=stat.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(fs6,cacheSymbol,{value:precision}),callback(null,stat.mtime,precision)})})}__name(probe,"probe");function getMtime(precision){let now=Date.now();return precision==="s"&&(now=Math.ceil(now/1e3)*1e3),new Date(now)}__name(getMtime,"getMtime");module.exports.probe=probe;module.exports.getMtime=getMtime}});var require_lockfile=__commonJS({"../../node_modules/proper-lockfile/lib/lockfile.js"(exports,module){"use strict";var path6=__require("path"),fs6=require_graceful_fs(),retry=require_retry2(),onExit=require_signal_exit(),mtimePrecision=require_mtime_precision(),locks={};function getLockFile(file,options){return options.lockfilePath||`${file}.lock`}__name(getLockFile,"getLockFile");function resolveCanonicalPath(file,options,callback){if(!options.realpath)return callback(null,path6.resolve(file));options.fs.realpath(file,callback)}__name(resolveCanonicalPath,"resolveCanonicalPath");function acquireLock(file,options,callback){let lockfilePath=getLockFile(file,options);options.fs.mkdir(lockfilePath,err=>{if(!err)return mtimePrecision.probe(lockfilePath,options.fs,(err2,mtime,mtimePrecision2)=>{if(err2)return options.fs.rmdir(lockfilePath,()=>{}),callback(err2);callback(null,mtime,mtimePrecision2)});if(err.code!=="EEXIST")return callback(err);if(options.stale<=0)return callback(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file}));options.fs.stat(lockfilePath,(err2,stat)=>{if(err2)return err2.code==="ENOENT"?acquireLock(file,{...options,stale:0},callback):callback(err2);if(!isLockStale(stat,options))return callback(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file}));removeLock(file,options,err3=>{if(err3)return callback(err3);acquireLock(file,{...options,stale:0},callback)})})})}__name(acquireLock,"acquireLock");function isLockStale(stat,options){return stat.mtime.getTime()<Date.now()-options.stale}__name(isLockStale,"isLockStale");function removeLock(file,options,callback){options.fs.rmdir(getLockFile(file,options),err=>{if(err&&err.code!=="ENOENT")return callback(err);callback()})}__name(removeLock,"removeLock");function updateLock(file,options){let lock2=locks[file];lock2.updateTimeout||(lock2.updateDelay=lock2.updateDelay||options.update,lock2.updateTimeout=setTimeout(()=>{lock2.updateTimeout=null,options.fs.stat(lock2.lockfilePath,(err,stat)=>{let isOverThreshold=lock2.lastUpdate+options.stale<Date.now();if(err)return err.code==="ENOENT"||isOverThreshold?setLockAsCompromised(file,lock2,Object.assign(err,{code:"ECOMPROMISED"})):(lock2.updateDelay=1e3,updateLock(file,options));if(!(lock2.mtime.getTime()===stat.mtime.getTime()))return setLockAsCompromised(file,lock2,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let mtime=mtimePrecision.getMtime(lock2.mtimePrecision);options.fs.utimes(lock2.lockfilePath,mtime,mtime,err2=>{let isOverThreshold2=lock2.lastUpdate+options.stale<Date.now();if(!lock2.released){if(err2)return err2.code==="ENOENT"||isOverThreshold2?setLockAsCompromised(file,lock2,Object.assign(err2,{code:"ECOMPROMISED"})):(lock2.updateDelay=1e3,updateLock(file,options));lock2.mtime=mtime,lock2.lastUpdate=Date.now(),lock2.updateDelay=null,updateLock(file,options)}})})},lock2.updateDelay),lock2.updateTimeout.unref&&lock2.updateTimeout.unref())}__name(updateLock,"updateLock");function setLockAsCompromised(file,lock2,err){lock2.released=!0,lock2.updateTimeout&&clearTimeout(lock2.updateTimeout),locks[file]===lock2&&delete locks[file],lock2.options.onCompromised(err)}__name(setLockAsCompromised,"setLockAsCompromised");function lock(file,options,callback){options={stale:1e4,update:null,realpath:!0,retries:0,fs:fs6,onCompromised:__name(err=>{throw err},"onCompromised"),...options},options.retries=options.retries||0,options.retries=typeof options.retries=="number"?{retries:options.retries}:options.retries,options.stale=Math.max(options.stale||0,2e3),options.update=options.update==null?options.stale/2:options.update||0,options.update=Math.max(Math.min(options.update,options.stale/2),1e3),resolveCanonicalPath(file,options,(err,file2)=>{if(err)return callback(err);let operation=retry.operation(options.retries);operation.attempt(()=>{acquireLock(file2,options,(err2,mtime,mtimePrecision2)=>{if(operation.retry(err2))return;if(err2)return callback(operation.mainError());let lock2=locks[file2]={lockfilePath:getLockFile(file2,options),mtime,mtimePrecision:mtimePrecision2,options,lastUpdate:Date.now()};updateLock(file2,options),callback(null,releasedCallback=>{if(lock2.released)return releasedCallback&&releasedCallback(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));unlock(file2,{...options,realpath:!1},releasedCallback)})})})})}__name(lock,"lock");function unlock(file,options,callback){options={fs:fs6,realpath:!0,...options},resolveCanonicalPath(file,options,(err,file2)=>{if(err)return callback(err);let lock2=locks[file2];if(!lock2)return callback(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));lock2.updateTimeout&&clearTimeout(lock2.updateTimeout),lock2.released=!0,delete locks[file2],removeLock(file2,options,callback)})}__name(unlock,"unlock");function check(file,options,callback){options={stale:1e4,realpath:!0,fs:fs6,...options},options.stale=Math.max(options.stale||0,2e3),resolveCanonicalPath(file,options,(err,file2)=>{if(err)return callback(err);options.fs.stat(getLockFile(file2,options),(err2,stat)=>err2?err2.code==="ENOENT"?callback(null,!1):callback(err2):callback(null,!isLockStale(stat,options)))})}__name(check,"check");function getLocks(){return locks}__name(getLocks,"getLocks");onExit(()=>{for(let file in locks){let options=locks[file].options;try{options.fs.rmdirSync(getLockFile(file,options))}catch{}}});module.exports.lock=lock;module.exports.unlock=unlock;module.exports.check=check;module.exports.getLocks=getLocks}});var require_adapter=__commonJS({"../../node_modules/proper-lockfile/lib/adapter.js"(exports,module){"use strict";var fs6=require_graceful_fs();function createSyncFs(fs7){let methods=["mkdir","realpath","stat","rmdir","utimes"],newFs={...fs7};return methods.forEach(method=>{newFs[method]=(...args)=>{let callback=args.pop(),ret;try{ret=fs7[`${method}Sync`](...args)}catch(err){return callback(err)}callback(null,ret)}}),newFs}__name(createSyncFs,"createSyncFs");function toPromise(method){return(...args)=>new Promise((resolve,reject)=>{args.push((err,result)=>{err?reject(err):resolve(result)}),method(...args)})}__name(toPromise,"toPromise");function toSync(method){return(...args)=>{let err,result;if(args.push((_err,_result)=>{err=_err,result=_result}),method(...args),err)throw err;return result}}__name(toSync,"toSync");function toSyncOptions(options){if(options={...options},options.fs=createSyncFs(options.fs||fs6),typeof options.retries=="number"&&options.retries>0||options.retries&&typeof options.retries.retries=="number"&&options.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return options}__name(toSyncOptions,"toSyncOptions");module.exports={toPromise,toSync,toSyncOptions}}});var require_proper_lockfile=__commonJS({"../../node_modules/proper-lockfile/index.js"(exports,module){"use strict";var lockfile=require_lockfile(),{toPromise,toSync,toSyncOptions}=require_adapter();async function lock(file,options){let release=await toPromise(lockfile.lock)(file,options);return toPromise(release)}__name(lock,"lock");function lockSync(file,options){let release=toSync(lockfile.lock)(file,toSyncOptions(options));return toSync(release)}__name(lockSync,"lockSync");function unlock(file,options){return toPromise(lockfile.unlock)(file,options)}__name(unlock,"unlock");function unlockSync(file,options){return toSync(lockfile.unlock)(file,toSyncOptions(options))}__name(unlockSync,"unlockSync");function check(file,options){return toPromise(lockfile.check)(file,options)}__name(check,"check");function checkSync(file,options){return toSync(lockfile.check)(file,toSyncOptions(options))}__name(checkSync,"checkSync");module.exports=lock;module.exports.lock=lock;module.exports.unlock=unlock;module.exports.lockSync=lockSync;module.exports.unlockSync=unlockSync;module.exports.check=check;module.exports.checkSync=checkSync}});import{spawnSync as spawnSync2}from"node:child_process";import fs5 from"node:fs";import os3 from"node:os";import path5 from"node:path";import process7 from"node:process";import os from"node:os";import path from"node:path";import process2 from"node:process";var CURRENT_PROVIDER_PROFILE_ID="__current_provider__";function normalizeProviderBaseUrl(value){let trimmedValue=String(value??"").trim();return trimmedValue?trimmedValue.replace(/\/v1(?:\/messages|\/responses)?\/?$/i,"").replace(/\/+$/,""):""}__name(normalizeProviderBaseUrl,"normalizeProviderBaseUrl");var PLACEHOLDER_PROVIDER_CREDENTIAL_EXACT_VALUES=new Set(["your_api_key","your-api-key","your_api_key_here","your-api-key-here","your_key","your-key","your_key_here","your-key-here","your api key","your api key here","your key","your key here","your_token","your-token","your_token_here","your-token-here","your auth token","your auth token here","api_key","api-key","api_key_here","api-key-here","auth_token","auth-token","auth_token_here","auth-token-here","token_here","token-here","placeholder","<api_key>","<api-key>","<your_api_key>","<your-api-key>","<token>","<your_token>","<your-token>"]);function isPlaceholderProviderCredential(value){let normalizedValue=String(value??"").trim().toLowerCase();return normalizedValue?PLACEHOLDER_PROVIDER_CREDENTIAL_EXACT_VALUES.has(normalizedValue)?!0:/^your[-_\s]?[a-z0-9_-]*(api[-_\s]?key|auth[-_\s]?token|key|token)[a-z0-9_-]*$/iu.test(normalizedValue)||/^(sk|sk-ant|sk-proj|sk-or|sk-[a-z0-9_-]+)[-_]?your[-_a-z0-9]*here$/iu.test(normalizedValue)||/^(sk|sk-ant|sk-proj|sk-or|sk-[a-z0-9_-]+)[-_]?(test|example|placeholder|dummy|fake)$/iu.test(normalizedValue)||/^(test|example|placeholder|dummy|fake)[-_]?(api[-_]?key|auth[-_]?token|token)$/iu.test(normalizedValue):!1}__name(isPlaceholderProviderCredential,"isPlaceholderProviderCredential");function normalizeProviderModelRouting(value){let source=value&&typeof value=="object"?value:{};return{primaryModel:String(source.primaryModel??"").trim(),subagentModel:String(source.subagentModel??"").trim(),smallFastModel:String(source.smallFastModel??"").trim()}}__name(normalizeProviderModelRouting,"normalizeProviderModelRouting");function normalizeProviderRuntimeProfile(value){if(!value||typeof value!="object")return null;let baseUrl=normalizeProviderBaseUrl(value.baseUrl),credential=String(value.credential??"").trim();if(!baseUrl||!credential||isPlaceholderProviderCredential(credential))return null;let name=String(value.name??value.id??"provider").trim()||"provider";return{id:String(value.id??name).trim()||name,name,baseUrl,authType:value.authType==="auth_token"?"auth_token":"api_key",credential,modelRouting:normalizeProviderModelRouting(value.modelRouting)}}__name(normalizeProviderRuntimeProfile,"normalizeProviderRuntimeProfile");function getCurrentEnvProviderRuntimeProfile(env=process2.env){let baseUrl=normalizeProviderBaseUrl(env.ANTHROPIC_BASE_URL),credential=String(env.ANTHROPIC_AUTH_TOKEN??env.ANTHROPIC_API_KEY??"").trim();return!baseUrl||!credential||isPlaceholderProviderCredential(credential)?null:{id:CURRENT_PROVIDER_PROFILE_ID,name:"current-session",baseUrl,authType:env.ANTHROPIC_AUTH_TOKEN?"auth_token":"api_key",credential,modelRouting:{primaryModel:String(env.ANTHROPIC_MODEL??env.ANTHROPIC_CUSTOM_MODEL_OPTION??"").trim(),subagentModel:String(env.CLAUDE_CODE_SUBAGENT_MODEL??"").trim(),smallFastModel:String(env.ANTHROPIC_SMALL_FAST_MODEL??"").trim()}}}__name(getCurrentEnvProviderRuntimeProfile,"getCurrentEnvProviderRuntimeProfile");function getSavedActiveProviderRuntimeProfile(config={}){let activeProfileId=String(config.clavueActiveProviderProfileId??config.myclaudeActiveProviderProfileId??"").trim(),profiles=(Array.isArray(config.clavueProviderProfiles)?config.clavueProviderProfiles:Array.isArray(config.myclaudeProviderProfiles)?config.myclaudeProviderProfiles:[]).map(normalizeProviderRuntimeProfile).filter(Boolean);return activeProfileId?profiles.find(profile=>profile.id===activeProfileId)??null:profiles[0]??null}__name(getSavedActiveProviderRuntimeProfile,"getSavedActiveProviderRuntimeProfile");function resolveActiveProviderRuntimeProfile(options={}){let sessionProfile=getCurrentEnvProviderRuntimeProfile(options.env);if(sessionProfile)return{...sessionProfile,source:options.sessionSource??"session-env"};let savedProfile=getSavedActiveProviderRuntimeProfile(options.config);return savedProfile?{...savedProfile,source:options.savedSource??"saved-profile"}:null}__name(resolveActiveProviderRuntimeProfile,"resolveActiveProviderRuntimeProfile");function getCredentialLabel(authType){return authType==="auth_token"?"Auth token":"API key"}__name(getCredentialLabel,"getCredentialLabel");function maskCredential(value){let trimmed=String(value??"").trim();return trimmed?trimmed.length<=8?`${trimmed.slice(0,2)}...${trimmed.slice(-2)}`:`${trimmed.slice(0,6)}...${trimmed.slice(-4)}`:"(missing)"}__name(maskCredential,"maskCredential");function getClavueConfigHomeDir(env=process2.env){return(env.CLAVUE_CONFIG_DIR??path.join(os.homedir(),".clavue")).normalize("NFC")}__name(getClavueConfigHomeDir,"getClavueConfigHomeDir");var getClaudeConfigHomeDir=getClavueConfigHomeDir;import process3 from"node:process";var MAO_PROVIDER_ID="clavue_mao",MAO_PROVIDER_ENV_KEY="CLAVUE_MAO_CREDENTIAL",MODEL_ALIASES=new Map([["spark","gpt-5.3-codex-spark"]]);function normalizeRequestedMaoModel(model){if(model==null)return null;let normalized=String(model).trim();return normalized?MODEL_ALIASES.get(normalized.toLowerCase())??normalized:null}__name(normalizeRequestedMaoModel,"normalizeRequestedMaoModel");function resolveActiveMaoProvider(options={}){return resolveActiveProviderRuntimeProfile({env:options.env,config:options.config,sessionSource:options.sessionSource??"session-env",savedSource:options.savedSource??"saved-profile"})}__name(resolveActiveMaoProvider,"resolveActiveMaoProvider");function pickDefaultMaoModel(profile,requestedModel=null){return normalizeRequestedMaoModel(requestedModel)??normalizeRequestedMaoModel(profile?.modelRouting?.primaryModel)??normalizeRequestedMaoModel(profile?.modelRouting?.subagentModel)??normalizeRequestedMaoModel(profile?.modelRouting?.smallFastModel)??"gpt-5.4"}__name(pickDefaultMaoModel,"pickDefaultMaoModel");function tomlString(value){return JSON.stringify(String(value))}__name(tomlString,"tomlString");function buildMaoCodexProviderOverrides(profile,model,effort=null){let overrides=[["model_provider",MAO_PROVIDER_ID],[`model_providers.${MAO_PROVIDER_ID}.name`,"clavue"],[`model_providers.${MAO_PROVIDER_ID}.base_url`,`${profile.baseUrl}/v1`],[`model_providers.${MAO_PROVIDER_ID}.wire_api`,"responses"],[`model_providers.${MAO_PROVIDER_ID}.env_key`,MAO_PROVIDER_ENV_KEY],[`model_providers.${MAO_PROVIDER_ID}.requires_openai_auth`,!1]];return profile.authType==="auth_token"&&overrides.push([`model_providers.${MAO_PROVIDER_ID}.experimental_bearer_token`,!0]),model&&overrides.push(["model",model]),effort&&overrides.push(["model_reasoning_effort",effort]),overrides.flatMap(([key,value])=>["-c",`${key}=${typeof value=="string"?tomlString(value):String(value)}`])}__name(buildMaoCodexProviderOverrides,"buildMaoCodexProviderOverrides");function buildMaoCodexProviderEnv(profile,env=process3.env){return{...env,[MAO_PROVIDER_ENV_KEY]:profile.credential}}__name(buildMaoCodexProviderEnv,"buildMaoCodexProviderEnv");function createMaoResponsesProbeHeaders(profile){let headers={"content-type":"application/json"};return profile.authType==="auth_token"?headers.authorization=`Bearer ${profile.credential}`:headers["x-api-key"]=profile.credential,headers}__name(createMaoResponsesProbeHeaders,"createMaoResponsesProbeHeaders");function extractResponsesProbeErrorMessage(raw){try{let parsed=JSON.parse(raw);if(typeof parsed?.error?.message=="string")return parsed.error.message;if(typeof parsed?.message=="string")return parsed.message}catch{}return String(raw||"").trim()}__name(extractResponsesProbeErrorMessage,"extractResponsesProbeErrorMessage");async function probeMaoResponsesRoute(profile,model,options={}){let fetchImpl=options.fetchImpl??fetch,timeoutMs=options.timeoutMs??15e3,controller=new AbortController,timeout=setTimeout(()=>controller.abort(),timeoutMs);try{let response=await fetchImpl(`${profile.baseUrl}/v1/responses`,{method:"POST",headers:createMaoResponsesProbeHeaders(profile),body:JSON.stringify({model,input:[{role:"user",content:[{type:"input_text",text:'Reply with "ok" and nothing else.'}]}],max_output_tokens:8,store:!1}),signal:controller.signal}),raw=await response.text();return{ok:response.ok,status:response.status,message:response.ok?"Responses route reachable.":extractResponsesProbeErrorMessage(raw)||`HTTP ${response.status}`}}catch(error){return{ok:!1,status:0,message:error instanceof Error?error.message:String(error)}}finally{clearTimeout(timeout)}}__name(probeMaoResponsesRoute,"probeMaoResponsesRoute");import{createHash}from"node:crypto";import fs from"node:fs";import os2 from"node:os";import path2 from"node:path";import process4 from"node:process";function defaultNowIso(){return new Date().toISOString()}__name(defaultNowIso,"defaultNowIso");function defaultReadJsonFile(filePath){try{let raw=fs.readFileSync(filePath,"utf8").trim();if(!raw)return{};let parsed=JSON.parse(raw);return parsed&&typeof parsed=="object"?parsed:{}}catch{return{}}}__name(defaultReadJsonFile,"defaultReadJsonFile");function defaultWriteJsonFile(filePath,value){if(fs.mkdirSync(path2.dirname(filePath),{recursive:!0,...process4.platform!=="win32"?{mode:448}:{}}),process4.platform!=="win32")try{fs.chmodSync(path2.dirname(filePath),448)}catch{}if(fs.writeFileSync(filePath,`${JSON.stringify(value,null,2)}
6
6
  `,"utf8"),process4.platform!=="win32")try{fs.chmodSync(filePath,384)}catch{}}__name(defaultWriteJsonFile,"defaultWriteJsonFile");function defaultSafeReadFile(filePath){try{return fs.existsSync(filePath)?fs.readFileSync(filePath,"utf8"):""}catch{return""}}__name(defaultSafeReadFile,"defaultSafeReadFile");function firstMeaningfulLine(text,fallback=""){return String(text??"").split(/\r?\n/).map(value=>value.trim()).find(Boolean)??fallback}__name(firstMeaningfulLine,"firstMeaningfulLine");function createMaoJobStore(options={}){let stateVersion=options.stateVersion??1,nowIso2=options.nowIso??defaultNowIso,readJsonFile2=options.readJsonFile??defaultReadJsonFile,writeJsonFile2=options.writeJsonFile??defaultWriteJsonFile,safeReadFile2=options.safeReadFile??defaultSafeReadFile,resolveWorkspaceRoot2=options.resolveWorkspaceRoot??(cwd=>cwd),getStateRootDir=options.getStateRootDir??(()=>path2.join(process4.env.CLAVUE_CONFIG_DIR??path2.join(os2.homedir(),".clavue"),"mao")),killImpl=options.killImpl??process4.kill.bind(process4);function resolveStateDir(cwd){let workspaceRoot=resolveWorkspaceRoot2(cwd),canonicalWorkspaceRoot=workspaceRoot;try{canonicalWorkspaceRoot=fs.realpathSync.native(workspaceRoot)}catch{}let slug=(path2.basename(workspaceRoot)||"workspace").replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||"workspace",hash=createHash("sha256").update(canonicalWorkspaceRoot).digest("hex").slice(0,16);return path2.join(getStateRootDir(),"state",`${slug}-${hash}`)}__name(resolveStateDir,"resolveStateDir");function resolveStateFile(cwd){return path2.join(resolveStateDir(cwd),"state.json")}__name(resolveStateFile,"resolveStateFile");function resolveJobsDir(cwd){return path2.join(resolveStateDir(cwd),"jobs")}__name(resolveJobsDir,"resolveJobsDir");function ensureStateDir(cwd){fs.mkdirSync(resolveJobsDir(cwd),{recursive:!0})}__name(ensureStateDir,"ensureStateDir");function defaultState(){return{version:stateVersion,jobs:[]}}__name(defaultState,"defaultState");function loadState(cwd){let stateFile=resolveStateFile(cwd);if(!fs.existsSync(stateFile))return defaultState();try{let parsed=JSON.parse(fs.readFileSync(stateFile,"utf8"));return{...defaultState(),...parsed,jobs:Array.isArray(parsed.jobs)?parsed.jobs:[]}}catch{return defaultState()}}__name(loadState,"loadState");function pruneJobs(jobs){return[...jobs].sort((left,right)=>String(right.updatedAt??"").localeCompare(String(left.updatedAt??""))).slice(0,50)}__name(pruneJobs,"pruneJobs");function saveState(cwd,state){ensureStateDir(cwd);let nextState={version:stateVersion,jobs:pruneJobs(state.jobs??[])};return fs.writeFileSync(resolveStateFile(cwd),`${JSON.stringify(nextState,null,2)}