@wujie-shell/core 0.1.4 → 0.1.5

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 +1 @@
1
- const _0x5bf23f=_0x22e2;(function(_0x44b7b0,_0x3f9ea9){const _0x443659=_0x22e2,_0x3b8f31=_0x44b7b0();while(!![]){try{const _0x1ec948=-parseInt(_0x443659(0x13f))/0x1*(-parseInt(_0x443659(0x196))/0x2)+parseInt(_0x443659(0x1bd))/0x3*(-parseInt(_0x443659(0x1c0))/0x4)+-parseInt(_0x443659(0x1dd))/0x5*(parseInt(_0x443659(0x15c))/0x6)+parseInt(_0x443659(0x19f))/0x7+-parseInt(_0x443659(0x18c))/0x8*(-parseInt(_0x443659(0x1c7))/0x9)+-parseInt(_0x443659(0x192))/0xa*(-parseInt(_0x443659(0x161))/0xb)+-parseInt(_0x443659(0x19c))/0xc*(-parseInt(_0x443659(0x16a))/0xd);if(_0x1ec948===_0x3f9ea9)break;else _0x3b8f31['push'](_0x3b8f31['shift']());}catch(_0x545651){_0x3b8f31['push'](_0x3b8f31['shift']());}}}(_0x2ed8,0x81279));import{Buffer}from'node:buffer';import{createHash,createPrivateKey,createPublicKey,generateKeyPairSync,randomUUID,sign}from'node:crypto';import{chmodSync,existsSync,mkdirSync,readFileSync,writeFileSync}from'node:fs';import{dirname}from'node:path';import _0x1fb79a from'ws';const ED25519_SPKI_PREFIX=Buffer['from'](_0x5bf23f(0x1aa)+_0x5bf23f(0x1db)+_0x5bf23f(0x18f),'hex'),BASE64_PADDING_REGEX=/=+$/g,UPPERCASE_ASCII_REGEX=/[A-Z]/g;function isRecord(_0x1fe7ec){const _0x33a861=_0x5bf23f;return Boolean(_0x1fe7ec)&&typeof _0x1fe7ec===_0x33a861(0x17d)&&!Array[_0x33a861(0x151)](_0x1fe7ec);}function formatUnknownError(_0x2b1090){if(_0x2b1090 instanceof Error)return _0x2b1090['message'];return String(_0x2b1090??'');}function isLocalGatewayConnRefused(_0x48a4b0){const _0x28c07b=_0x5bf23f,_0x45d76d=formatUnknownError(_0x48a4b0);return/\bECONNREFUSED\b/i['test'](_0x45d76d)&&/127\.0\.0\.1:\d+/[_0x28c07b(0x159)](_0x45d76d);}function base64UrlEncode(_0x3c96c6){const _0xc20a7f=_0x5bf23f;return _0x3c96c6[_0xc20a7f(0x1ca)](_0xc20a7f(0x13c))[_0xc20a7f(0x149)+'ll']('+','-')[_0xc20a7f(0x149)+'ll']('/','_')[_0xc20a7f(0x1b4)](BASE64_PADDING_REGEX,'');}function derivePublicKeyRaw(_0x35eedb){const _0x1b3bc6=_0x5bf23f,_0x127759=createPublicKey(_0x35eedb)[_0x1b3bc6(0x1ac)]({'type':_0x1b3bc6(0x1a4),'format':_0x1b3bc6(0x195)}),_0x33ad0b=Buffer[_0x1b3bc6(0x1ab)](_0x127759)?_0x127759:Buffer[_0x1b3bc6(0x1dc)](_0x127759),_0x582afa=_0x33ad0b[_0x1b3bc6(0x199)]===ED25519_SPKI_PREFIX[_0x1b3bc6(0x199)]+0x20&&_0x33ad0b['subarray'](0x0,ED25519_SPKI_PREFIX[_0x1b3bc6(0x199)])[_0x1b3bc6(0x15d)](ED25519_SPKI_PREFIX);return _0x582afa?_0x33ad0b[_0x1b3bc6(0x177)](ED25519_SPKI_PREFIX[_0x1b3bc6(0x199)]):_0x33ad0b;}function fingerprintPublicKey(_0x218409){const _0x534f2=_0x5bf23f;return createHash(_0x534f2(0x171))[_0x534f2(0x1a3)](derivePublicKeyRaw(_0x218409))[_0x534f2(0x1f0)](_0x534f2(0x1da));}function publicKeyRawBase64UrlFromPem(_0x2e74ee){return base64UrlEncode(derivePublicKeyRaw(_0x2e74ee));}function _0x22e2(_0x5d3b8f,_0x11e862){_0x5d3b8f=_0x5d3b8f-0x131;const _0x2ed815=_0x2ed8();let _0x22e298=_0x2ed815[_0x5d3b8f];return _0x22e298;}function signDevicePayload(_0x17a41e,_0x55dc99){const _0x120013=_0x5bf23f,_0x17bf43=createPrivateKey(_0x17a41e);return base64UrlEncode(sign(null,Buffer[_0x120013(0x1dc)](_0x55dc99,_0x120013(0x156)),_0x17bf43));}function normalizeDeviceMetadataForAuth(_0x1cc05a){const _0x4bc3d5=_0x5bf23f,_0x77c333=typeof _0x1cc05a===_0x4bc3d5(0x17e)?_0x1cc05a['trim']():'';if(!_0x77c333)return'';return _0x77c333[_0x4bc3d5(0x1b4)](UPPERCASE_ASCII_REGEX,_0x275c52=>String[_0x4bc3d5(0x1cf)+_0x4bc3d5(0x153)](_0x275c52['charCode'+'At'](0x0)+0x20));}function buildDeviceAuthPayloadV3(_0x510e84){const _0x510c29=_0x5bf23f;return['v3',_0x510e84[_0x510c29(0x141)],_0x510e84[_0x510c29(0x1ba)],_0x510e84[_0x510c29(0x1df)+'de'],_0x510e84[_0x510c29(0x186)],_0x510e84[_0x510c29(0x1eb)][_0x510c29(0x1c8)](','),String(_0x510e84[_0x510c29(0x174)+'Ms']),_0x510e84[_0x510c29(0x1a2)]??'',_0x510e84[_0x510c29(0x14c)],normalizeDeviceMetadataForAuth(_0x510e84[_0x510c29(0x1b3)]),normalizeDeviceMetadataForAuth(_0x510e84['deviceFa'+_0x510c29(0x1e1)])]['join']('|');}function writeIdentityFile(_0x5924ad,_0x4d95bf,_0x73ce4a){mkdirSync(dirname(_0x5924ad),{'recursive':!![]}),writeFileSync(_0x5924ad,JSON['stringif'+'y']({'version':0x1,..._0x4d95bf,'createdAtMs':_0x73ce4a},null,0x2)+'\x0a',{'mode':0x180});try{chmodSync(_0x5924ad,0x180);}catch{}}function generateDeviceIdentity(){const _0x267e31=_0x5bf23f,{publicKey:_0x422e40,privateKey:_0x5ab3b3}=generateKeyPairSync('ed25519'),_0x4be4cd=_0x422e40['export']({'type':'spki','format':'pem'})['toString'](),_0x4a6af2=_0x5ab3b3['export']({'type':_0x267e31(0x13d),'format':_0x267e31(0x163)})[_0x267e31(0x1ca)]();return{'deviceId':fingerprintPublicKey(_0x4be4cd),'publicKeyPem':_0x4be4cd,'privateKeyPem':_0x4a6af2};}function loadOrCreateDeviceIdentity(_0x4fc109){const _0x2230e5=_0x5bf23f;if(existsSync(_0x4fc109))try{const _0x255ea8=JSON[_0x2230e5(0x1cc)](readFileSync(_0x4fc109,_0x2230e5(0x156))),_0x5f50e6=typeof _0x255ea8?.[_0x2230e5(0x16d)+_0x2230e5(0x1d3)]===_0x2230e5(0x17e)?_0x255ea8[_0x2230e5(0x16d)+_0x2230e5(0x1d3)]:'',_0x21be11=typeof _0x255ea8?.[_0x2230e5(0x140)+_0x2230e5(0x1b9)]==='string'?_0x255ea8[_0x2230e5(0x140)+_0x2230e5(0x1b9)]:'';if(_0x5f50e6&&_0x21be11){const _0x436f64={'deviceId':fingerprintPublicKey(_0x5f50e6),'publicKeyPem':_0x5f50e6,'privateKeyPem':_0x21be11};return _0x255ea8?.[_0x2230e5(0x141)]!==_0x436f64['deviceId']&&writeIdentityFile(_0x4fc109,_0x436f64,Date[_0x2230e5(0x136)]()),_0x436f64;}}catch{}const _0x2197ef=generateDeviceIdentity();return writeIdentityFile(_0x4fc109,_0x2197ef,Date[_0x2230e5(0x136)]()),_0x2197ef;}function _0x2ed8(){const _0x48e353=['3309467jPvayr','connectC','WS\x20is\x20no','token','update','spki','lReady','connect','yCheck','ell/','sendConn','302a3005','isBuffer','export','WS\x20disco','lListene','connecte','nectChal','Options','way\x20设备身份','platform','replace','timeoutM','splayNam','connectS','resolve','eyPem','clientId','code=','g\x20nonce','3RccNlK','WS\x20hands','adyWaite','3500188MRAFsM','ct\x20faile','clientDe','rejectPe','WS\x20clien','onAgentE','nnected','81783tMftHH','join','\x20yet','toString','failed\x20t','parse','is\x20not\x20l','pending','fromChar','WS\x20conne','min','handleMe','yPem','ers','t\x20restar','wujie-sh','Timer','once','queueCon','hex','06032b65','from','676600NOVfSL','vent','clientMo','trim','mily','delete','tBackoff','status','ent','unavaila','accepted','t\x20connec','ect','method','scopes','d\x20(','hallenge','o\x20load\x20g','rejectRe','digest','viceFami','failed:\x20','clientVe','handleDi','Path','restart','stringif','identity','agent','now','request\x20','.approva','url','tTimer','t\x20stoppe','base64','pkcs8','lengeTim','2670rlloyZ','privateK','deviceId','readyWai','ateway\x20i','config','operator','t:\x20','connectN','hake\x20mis','replaceA','entity','get','nonce','timeout','connect.','ured','device\x20i','isArray','error','Code','.admin','shouldRe','utf8','event','payload','test','equest','.pairing','24KEHjzs','equals','ters','e\x20timeou','DateTime','77dfQuhE','clearTim','pem','resolveR','expectFi','skipRead','onChatEv','waitUnti','request','2322814iMKalR','nected','challeng','publicKe','res','send','istening','sha256','ction\x20ti','.read','signedAt','e\x20missin','ting','subarray','hake\x20tim','message','removeAl','timed\x20ou','sconnect','object','string','ed\x20out','eout','connect\x20','WS\x20error','rsion','readySta','reconnec','role','close','gateway\x20','type','ateway\x20r','nal','608BuPWVd','dentity','sing\x20non','70032100','push','onDiscon','346890EmOnWJ','chat','stop','der','270sLZQly','Format','nding','length','filter','failed','12sMuIRu','OPEN','ted'];_0x2ed8=function(){return _0x48e353;};return _0x2ed8();}export class ClawGatewayWsClient{['ws']=null;[_0x5bf23f(0x144)]=null;[_0x5bf23f(0x1ce)]=new Map();[_0x5bf23f(0x142)+_0x5bf23f(0x15e)]=[];['shouldRe'+_0x5bf23f(0x1a6)]=![];[_0x5bf23f(0x185)+_0x5bf23f(0x13a)]=null;[_0x5bf23f(0x1a0)+_0x5bf23f(0x1ed)+_0x5bf23f(0x1d7)]=null;[_0x5bf23f(0x147)+'once']=null;[_0x5bf23f(0x1b7)+_0x5bf23f(0x1e5)]=![];['connecte'+'d']=![];[_0x5bf23f(0x185)+_0x5bf23f(0x1e3)+'Ms']=0x320;['deviceId'+'entity']=null;['configur'+'e'](_0x40744d){const _0x3234c9=_0x5bf23f;if(!_0x40744d){this[_0x3234c9(0x194)]();return;}const _0xe1eed7=this[_0x3234c9(0x144)];this['config']=_0x40744d,this['shouldRe'+_0x3234c9(0x1a6)]=!![];try{this[_0x3234c9(0x141)+_0x3234c9(0x14a)]=loadOrCreateDeviceIdentity(_0x40744d[_0x3234c9(0x134)+_0x3234c9(0x131)]);}catch(_0x3469bd){const _0x21adaf=_0x3469bd instanceof Error?_0x3469bd[_0x3234c9(0x179)]:'初始化\x20gate'+_0x3234c9(0x1b2)+'失败';this[_0x3234c9(0x194)](),_0x40744d[_0x3234c9(0x191)+'nected'](_0x21adaf);return;}const _0x11940f=!_0xe1eed7||_0xe1eed7[_0x3234c9(0x139)]!==_0x40744d[_0x3234c9(0x139)]||_0xe1eed7[_0x3234c9(0x1a2)]!==_0x40744d['token']||_0xe1eed7['clientId']!==_0x40744d[_0x3234c9(0x1ba)]||_0xe1eed7[_0x3234c9(0x1df)+'de']!==_0x40744d[_0x3234c9(0x1df)+'de']||_0xe1eed7[_0x3234c9(0x1f3)+_0x3234c9(0x183)]!==_0x40744d[_0x3234c9(0x1f3)+'rsion']||_0xe1eed7[_0x3234c9(0x134)+_0x3234c9(0x131)]!==_0x40744d[_0x3234c9(0x134)+_0x3234c9(0x131)];if(_0x11940f){this[_0x3234c9(0x132)]();return;}if(!this['ws'])this[_0x3234c9(0x1a6)]();}[_0x5bf23f(0x194)](){const _0x56a214=_0x5bf23f;this[_0x56a214(0x155)+'connect']=![],this['connecte'+'d']=![],this[_0x56a214(0x147)+'once']=null,this['connectS'+_0x56a214(0x1e5)]=![],this[_0x56a214(0x162)+_0x56a214(0x1d4)](),this['rejectPe'+_0x56a214(0x198)](new Error(_0x56a214(0x188)+_0x56a214(0x1c4)+_0x56a214(0x13b)+'d')),this[_0x56a214(0x1ef)+_0x56a214(0x1bf)+'rs'](new Error(_0x56a214(0x188)+'WS\x20clien'+_0x56a214(0x13b)+'d'));if(this['ws']){try{this['ws']['close']();}catch{}this['ws']=null;}this[_0x56a214(0x141)+_0x56a214(0x14a)]=null,this[_0x56a214(0x144)]=null;}async['request'](_0x11dfcd,_0x24ede0={},_0x195d45={}){const _0x1b8bfa=_0x5bf23f;if(!_0x195d45[_0x1b8bfa(0x166)+_0x1b8bfa(0x1a7)])await this[_0x1b8bfa(0x168)+_0x1b8bfa(0x1a5)]();const _0x450b8e=this['ws'];if(!_0x450b8e||_0x450b8e[_0x1b8bfa(0x184)+'te']!==_0x1fb79a[_0x1b8bfa(0x19d)])throw new Error(_0x1b8bfa(0x188)+_0x1b8bfa(0x1a1)+_0x1b8bfa(0x1e8)+_0x1b8bfa(0x19e));const _0x19d598=randomUUID(),_0x1f60f2=_0x195d45[_0x1b8bfa(0x1b5)+'s']??0x7530;return await new Promise((_0x479729,_0x49dba4)=>{const _0x51e7ec=_0x1b8bfa,_0x1f380f=setTimeout(()=>{const _0x4f3798=_0x22e2;this[_0x4f3798(0x1ce)][_0x4f3798(0x1e2)](_0x19d598),_0x49dba4(new Error(_0x4f3798(0x188)+_0x4f3798(0x137)+_0x4f3798(0x17b)+_0x4f3798(0x146)+_0x11dfcd));},_0x1f60f2);this[_0x51e7ec(0x1ce)]['set'](_0x19d598,{'method':_0x11dfcd,'resolve':_0x371844=>{clearTimeout(_0x1f380f),_0x479729(_0x371844);},'reject':_0x44b2a4=>{clearTimeout(_0x1f380f),_0x49dba4(_0x44b2a4);},'expectFinal':_0x195d45[_0x51e7ec(0x165)+_0x51e7ec(0x18b)]===!![],'timeout':_0x1f380f});try{_0x450b8e[_0x51e7ec(0x16f)](JSON[_0x51e7ec(0x133)+'y']({'type':'req','id':_0x19d598,'method':_0x11dfcd,'params':_0x24ede0}));}catch(_0x17fb21){this[_0x51e7ec(0x1ce)][_0x51e7ec(0x1e2)](_0x19d598),clearTimeout(_0x1f380f),_0x49dba4(_0x17fb21 instanceof Error?_0x17fb21:new Error(_0x51e7ec(0x1cb)+'o\x20send\x20g'+_0x51e7ec(0x18a)+_0x51e7ec(0x15a)));}});}[_0x5bf23f(0x132)](){const _0x508a6c=_0x5bf23f;this[_0x508a6c(0x1af)+'d']=![],this[_0x508a6c(0x147)+'once']=null,this['connectS'+_0x508a6c(0x1e5)]=![],this['clearTim'+'ers'](),this[_0x508a6c(0x1c3)+_0x508a6c(0x198)](new Error('gateway\x20'+_0x508a6c(0x1c4)+_0x508a6c(0x1d5)+_0x508a6c(0x176))),this['rejectRe'+_0x508a6c(0x1bf)+'rs'](new Error(_0x508a6c(0x188)+_0x508a6c(0x1c4)+'t\x20restar'+_0x508a6c(0x176)));if(this['ws']){try{this['ws']['terminat'+'e']();}catch{}this['ws']=null;}this[_0x508a6c(0x1a6)]();}[_0x5bf23f(0x1a6)](){const _0x33bd7d=_0x5bf23f;if(!this['config']||this['ws'])return;const _0x487927=new _0x1fb79a(this[_0x33bd7d(0x144)][_0x33bd7d(0x139)]);this['ws']=_0x487927,_0x487927['on']('open',()=>this[_0x33bd7d(0x1d9)+_0x33bd7d(0x1b0)+_0x33bd7d(0x13e)+_0x33bd7d(0x180)]()),_0x487927['on']('message',_0x28c4d1=>this[_0x33bd7d(0x1d2)+'ssage'](_0x28c4d1[_0x33bd7d(0x1ca)]())),_0x487927['on'](_0x33bd7d(0x187),(_0x1c9d2a,_0x3ffc9b)=>{const _0x369a9a=_0x33bd7d;if(this[_0x369a9a(0x1af)+'d']){const _0x21848c=_0x3ffc9b[_0x369a9a(0x1ca)]()||_0x369a9a(0x1bb)+_0x1c9d2a;this['handleDi'+_0x369a9a(0x17c)](_0x369a9a(0x188)+'WS\x20close'+_0x369a9a(0x1ec)+_0x21848c+')');}else this['handleDi'+_0x369a9a(0x17c)]('');}),_0x487927['on'](_0x33bd7d(0x152),_0x151f17=>{const _0x4e9567=_0x33bd7d;if(isLocalGatewayConnRefused(_0x151f17)){this[_0x4e9567(0x1f4)+'sconnect']('gateway\x20'+_0x4e9567(0x1cd)+_0x4e9567(0x170)+_0x4e9567(0x1c9));return;}const _0xe2454b=formatUnknownError(_0x151f17);this['handleDi'+_0x4e9567(0x17c)](_0xe2454b?_0x4e9567(0x188)+_0x4e9567(0x182)+':\x20'+_0xe2454b:'gateway\x20'+_0x4e9567(0x182));});}['queueCon'+_0x5bf23f(0x1b0)+_0x5bf23f(0x13e)+'eout'](){const _0x5e9d66=_0x5bf23f;this[_0x5e9d66(0x147)+_0x5e9d66(0x1d8)]=null,this['connectS'+_0x5e9d66(0x1e5)]=![];if(this[_0x5e9d66(0x1a0)+'hallenge'+_0x5e9d66(0x1d7)])clearTimeout(this[_0x5e9d66(0x1a0)+_0x5e9d66(0x1ed)+_0x5e9d66(0x1d7)]);this['connectC'+_0x5e9d66(0x1ed)+_0x5e9d66(0x1d7)]=setTimeout(()=>{const _0x45ef04=_0x5e9d66;if(this[_0x45ef04(0x1b7)+_0x45ef04(0x1e5)]||!this['ws']||this['ws'][_0x45ef04(0x184)+'te']!==_0x1fb79a[_0x45ef04(0x19d)])return;this[_0x45ef04(0x1f4)+_0x45ef04(0x17c)](_0x45ef04(0x188)+'WS\x20hands'+_0x45ef04(0x178)+_0x45ef04(0x17f)),this['ws']?.[_0x45ef04(0x187)](0x3f0,_0x45ef04(0x181)+_0x45ef04(0x16c)+_0x45ef04(0x15f)+'t');},0x7d0);}async[_0x5bf23f(0x1a9)+_0x5bf23f(0x1e9)](){const _0x1274e6=_0x5bf23f,_0x101bf9=this[_0x1274e6(0x144)];if(!_0x101bf9||this['connectS'+_0x1274e6(0x1e5)])return;const _0x4b09b6=this[_0x1274e6(0x147)+'once']?.[_0x1274e6(0x1e0)]()??'';if(!_0x4b09b6){this[_0x1274e6(0x1f4)+_0x1274e6(0x17c)](_0x1274e6(0x188)+_0x1274e6(0x1be)+_0x1274e6(0x148)+_0x1274e6(0x18e)+'ce'),this['ws']?.[_0x1274e6(0x187)](0x3f0,'connect\x20'+_0x1274e6(0x16c)+_0x1274e6(0x175)+_0x1274e6(0x1bc));return;}this['connectS'+_0x1274e6(0x1e5)]=!![];this[_0x1274e6(0x1a0)+_0x1274e6(0x1ed)+'Timer']&&(clearTimeout(this[_0x1274e6(0x1a0)+_0x1274e6(0x1ed)+_0x1274e6(0x1d7)]),this[_0x1274e6(0x1a0)+_0x1274e6(0x1ed)+_0x1274e6(0x1d7)]=null);if(!this[_0x1274e6(0x141)+_0x1274e6(0x14a)])try{this[_0x1274e6(0x141)+_0x1274e6(0x14a)]=loadOrCreateDeviceIdentity(_0x101bf9[_0x1274e6(0x134)+_0x1274e6(0x131)]);}catch(_0x164e0e){this[_0x1274e6(0x1f4)+_0x1274e6(0x17c)](_0x164e0e instanceof Error?_0x164e0e[_0x1274e6(0x179)]:_0x1274e6(0x1cb)+_0x1274e6(0x1ee)+_0x1274e6(0x143)+_0x1274e6(0x18d)),this['ws']?.[_0x1274e6(0x187)](0x3f0,_0x1274e6(0x150)+'dentity\x20'+_0x1274e6(0x1e6)+'ble');return;}const _0x865a94=_0x1274e6(0x145),_0x136b85=['operator'+_0x1274e6(0x173),_0x1274e6(0x145)+'.write',_0x1274e6(0x145)+_0x1274e6(0x154),_0x1274e6(0x145)+_0x1274e6(0x138)+'ls',_0x1274e6(0x145)+_0x1274e6(0x15b)],_0x1b75a3=_0x101bf9[_0x1274e6(0x1a2)][_0x1274e6(0x1e0)](),_0x578992=Date[_0x1274e6(0x136)](),_0xe58444=buildDeviceAuthPayloadV3({'deviceId':this['deviceId'+_0x1274e6(0x14a)][_0x1274e6(0x141)],'clientId':_0x101bf9[_0x1274e6(0x1ba)],'clientMode':_0x101bf9[_0x1274e6(0x1df)+'de'],'role':_0x865a94,'scopes':_0x136b85,'signedAtMs':_0x578992,'token':_0x1b75a3||null,'nonce':_0x4b09b6,'platform':process['platform'],'deviceFamily':_0x101bf9[_0x1274e6(0x1c2)+_0x1274e6(0x1f1)+'ly']}),_0x2f0df4={'minProtocol':0x4,'maxProtocol':0x4,'client':{'id':_0x101bf9['clientId'],'displayName':_0x101bf9['clientDi'+_0x1274e6(0x1b6)+'e'],'version':_0x101bf9[_0x1274e6(0x1f3)+'rsion'],'platform':process[_0x1274e6(0x1b3)],'deviceFamily':_0x101bf9[_0x1274e6(0x1c2)+_0x1274e6(0x1f1)+'ly'],'mode':_0x101bf9['clientMo'+'de']},'caps':[],'role':_0x865a94,'scopes':_0x136b85,'auth':_0x1b75a3?{'token':_0x1b75a3}:undefined,'device':{'id':this[_0x1274e6(0x141)+_0x1274e6(0x14a)]['deviceId'],'publicKey':publicKeyRawBase64UrlFromPem(this['deviceId'+_0x1274e6(0x14a)]['publicKe'+'yPem']),'signature':signDevicePayload(this[_0x1274e6(0x141)+_0x1274e6(0x14a)]['privateK'+_0x1274e6(0x1b9)],_0xe58444),'signedAt':_0x578992,'nonce':_0x4b09b6},'locale':Intl[_0x1274e6(0x160)+_0x1274e6(0x197)]()['resolved'+_0x1274e6(0x1b1)]()['locale'],'userAgent':_0x1274e6(0x1d6)+_0x1274e6(0x1a8)+_0x101bf9[_0x1274e6(0x1f3)+_0x1274e6(0x183)]};try{await this[_0x1274e6(0x169)](_0x1274e6(0x1a6),_0x2f0df4,{'timeoutMs':0x2710,'skipReadyCheck':!![]}),this[_0x1274e6(0x1af)+'d']=!![],this[_0x1274e6(0x185)+_0x1274e6(0x1e3)+'Ms']=0x320,this[_0x1274e6(0x164)+'eadyWait'+_0x1274e6(0x1d4)](),this['config']?.['onConnec'+_0x1274e6(0x19e)]?.();}catch(_0x10e282){this[_0x1274e6(0x1f4)+_0x1274e6(0x17c)](_0x10e282 instanceof Error?_0x10e282['message']:_0x1274e6(0x188)+_0x1274e6(0x1d0)+_0x1274e6(0x1c1)+'d'),this['ws']?.[_0x1274e6(0x187)](0x3f0,_0x1274e6(0x181)+_0x1274e6(0x19b));}}[_0x5bf23f(0x1d2)+'ssage'](_0x3be32f){const _0x1ba5c5=_0x5bf23f;let _0x5b8ac8;try{_0x5b8ac8=JSON[_0x1ba5c5(0x1cc)](_0x3be32f);}catch{return;}if(!isRecord(_0x5b8ac8)||typeof _0x5b8ac8[_0x1ba5c5(0x189)]!==_0x1ba5c5(0x17e))return;if(_0x5b8ac8[_0x1ba5c5(0x189)]===_0x1ba5c5(0x157)){const _0x2facc6=typeof _0x5b8ac8['event']===_0x1ba5c5(0x17e)?_0x5b8ac8['event']:'';if(!_0x2facc6)return;const _0x379439=isRecord(_0x5b8ac8[_0x1ba5c5(0x158)])?_0x5b8ac8[_0x1ba5c5(0x158)]:{};if(_0x2facc6===_0x1ba5c5(0x14e)+_0x1ba5c5(0x16c)+'e'){const _0x1acb9a=typeof _0x379439[_0x1ba5c5(0x14c)]===_0x1ba5c5(0x17e)?_0x379439[_0x1ba5c5(0x14c)][_0x1ba5c5(0x1e0)]():'';if(!_0x1acb9a){this['handleDi'+_0x1ba5c5(0x17c)](_0x1ba5c5(0x188)+_0x1ba5c5(0x1be)+_0x1ba5c5(0x148)+'sing\x20non'+'ce'),this['ws']?.['close'](0x3f0,_0x1ba5c5(0x181)+'challeng'+_0x1ba5c5(0x175)+'g\x20nonce');return;}this[_0x1ba5c5(0x147)+_0x1ba5c5(0x1d8)]=_0x1acb9a,void this['sendConn'+_0x1ba5c5(0x1e9)]();return;}if(_0x2facc6===_0x1ba5c5(0x193))this[_0x1ba5c5(0x144)]?.[_0x1ba5c5(0x167)+_0x1ba5c5(0x1e5)]?.(_0x379439);if(_0x2facc6===_0x1ba5c5(0x135))this[_0x1ba5c5(0x144)]?.[_0x1ba5c5(0x1c5)+_0x1ba5c5(0x1de)]?.(_0x379439);return;}if(_0x5b8ac8['type']!==_0x1ba5c5(0x16e))return;const _0x660931=typeof _0x5b8ac8['id']===_0x1ba5c5(0x17e)?_0x5b8ac8['id']:'';if(!_0x660931)return;const _0xcb7364=this[_0x1ba5c5(0x1ce)][_0x1ba5c5(0x14b)](_0x660931);if(!_0xcb7364)return;const _0x203df7=isRecord(_0x5b8ac8[_0x1ba5c5(0x158)])?_0x5b8ac8['payload']:{},_0x4719f8=typeof _0x203df7[_0x1ba5c5(0x1e4)]===_0x1ba5c5(0x17e)?_0x203df7[_0x1ba5c5(0x1e4)]:'';if(_0xcb7364[_0x1ba5c5(0x165)+_0x1ba5c5(0x18b)]&&_0x4719f8===_0x1ba5c5(0x1e7))return;this['pending'][_0x1ba5c5(0x1e2)](_0x660931);_0xcb7364[_0x1ba5c5(0x14d)]&&(clearTimeout(_0xcb7364[_0x1ba5c5(0x14d)]),_0xcb7364[_0x1ba5c5(0x14d)]=null);if(_0x5b8ac8['ok']===!![]){_0xcb7364[_0x1ba5c5(0x1b8)](_0x5b8ac8['payload']);return;}const _0x30803b=isRecord(_0x5b8ac8[_0x1ba5c5(0x152)])?_0x5b8ac8[_0x1ba5c5(0x152)]:{},_0x5e0b08=typeof _0x30803b['message']===_0x1ba5c5(0x17e)?_0x30803b[_0x1ba5c5(0x179)]:_0x1ba5c5(0x188)+_0x1ba5c5(0x137)+_0x1ba5c5(0x1f2)+_0xcb7364[_0x1ba5c5(0x1ea)];_0xcb7364['reject'](new Error(_0x5e0b08));}[_0x5bf23f(0x168)+_0x5bf23f(0x1a5)](_0x4238a8=0x2ee0){const _0x5dd5fc=_0x5bf23f;if(this[_0x5dd5fc(0x1af)+'d'])return Promise[_0x5dd5fc(0x1b8)]();if(!this[_0x5dd5fc(0x144)])return Promise['reject'](new Error(_0x5dd5fc(0x188)+_0x5dd5fc(0x1a1)+'t\x20config'+_0x5dd5fc(0x14f)));if(!this['ws'])this[_0x5dd5fc(0x1a6)]();return new Promise((_0x3acdd1,_0x5b6d84)=>{const _0x139589=_0x5dd5fc,_0x27500e=setTimeout(()=>{const _0x35216e=_0x22e2;this['readyWai'+_0x35216e(0x15e)]=this['readyWai'+_0x35216e(0x15e)][_0x35216e(0x19a)](_0x488b32=>_0x488b32[_0x35216e(0x1b8)]!==_0x3acdd1),_0x5b6d84(new Error(_0x35216e(0x188)+_0x35216e(0x1d0)+_0x35216e(0x172)+'med\x20out'));},_0x4238a8);this[_0x139589(0x142)+_0x139589(0x15e)][_0x139589(0x190)]({'resolve':_0x3acdd1,'reject':_0x5b6d84,'timeout':_0x27500e});});}[_0x5bf23f(0x164)+'eadyWait'+_0x5bf23f(0x1d4)](){const _0xa2521=_0x5bf23f,_0x5da11e=[...this['readyWai'+'ters']];this[_0xa2521(0x142)+_0xa2521(0x15e)]=[];for(const _0x421458 of _0x5da11e){clearTimeout(_0x421458[_0xa2521(0x14d)]),_0x421458[_0xa2521(0x1b8)]();}}[_0x5bf23f(0x1ef)+_0x5bf23f(0x1bf)+'rs'](_0x432d6a){const _0x47522e=_0x5bf23f,_0x28d1ff=[...this['readyWai'+_0x47522e(0x15e)]];this[_0x47522e(0x142)+_0x47522e(0x15e)]=[];for(const _0x258f63 of _0x28d1ff){clearTimeout(_0x258f63[_0x47522e(0x14d)]),_0x258f63['reject'](_0x432d6a);}}[_0x5bf23f(0x1c3)+_0x5bf23f(0x198)](_0x392cbb){const _0x325579=_0x5bf23f;for(const [_0x36d79f,_0xe233a9]of this[_0x325579(0x1ce)]['entries']()){this[_0x325579(0x1ce)][_0x325579(0x1e2)](_0x36d79f),_0xe233a9[_0x325579(0x14d)]&&(clearTimeout(_0xe233a9[_0x325579(0x14d)]),_0xe233a9[_0x325579(0x14d)]=null),_0xe233a9['reject'](_0x392cbb);}}[_0x5bf23f(0x1f4)+_0x5bf23f(0x17c)](_0x2a17da){const _0x3fc5d4=_0x5bf23f;this['ws']&&(this['ws'][_0x3fc5d4(0x17a)+_0x3fc5d4(0x1ae)+'rs'](),this['ws']=null);this[_0x3fc5d4(0x1af)+'d']=![],this['connectN'+_0x3fc5d4(0x1d8)]=null,this[_0x3fc5d4(0x1b7)+_0x3fc5d4(0x1e5)]=![],this[_0x3fc5d4(0x1c3)+_0x3fc5d4(0x198)](new Error(_0x2a17da||_0x3fc5d4(0x188)+_0x3fc5d4(0x1ad)+'nnected')),this['rejectRe'+'adyWaite'+'rs'](new Error(_0x2a17da||_0x3fc5d4(0x188)+_0x3fc5d4(0x1ad)+_0x3fc5d4(0x1c6))),this[_0x3fc5d4(0x162)+_0x3fc5d4(0x1d4)]();if(_0x2a17da)this['config']?.[_0x3fc5d4(0x191)+_0x3fc5d4(0x16b)]?.(_0x2a17da);if(!this[_0x3fc5d4(0x155)+_0x3fc5d4(0x1a6)]||!this[_0x3fc5d4(0x144)])return;const _0xc27d13=this[_0x3fc5d4(0x185)+'tBackoff'+'Ms'];this[_0x3fc5d4(0x185)+_0x3fc5d4(0x1e3)+'Ms']=Math[_0x3fc5d4(0x1d1)](this['reconnec'+'tBackoff'+'Ms']*0x2,0x3a98),this[_0x3fc5d4(0x185)+'tTimer']=setTimeout(()=>{const _0x4fccad=_0x3fc5d4;this['reconnec'+_0x4fccad(0x13a)]=null,this['connect']();},_0xc27d13);}[_0x5bf23f(0x162)+_0x5bf23f(0x1d4)](){const _0x27fd67=_0x5bf23f;this['reconnec'+_0x27fd67(0x13a)]&&(clearTimeout(this[_0x27fd67(0x185)+_0x27fd67(0x13a)]),this[_0x27fd67(0x185)+_0x27fd67(0x13a)]=null),this['connectC'+_0x27fd67(0x1ed)+'Timer']&&(clearTimeout(this[_0x27fd67(0x1a0)+_0x27fd67(0x1ed)+_0x27fd67(0x1d7)]),this[_0x27fd67(0x1a0)+_0x27fd67(0x1ed)+'Timer']=null);}}
1
+ const _0x3f13b4=_0xa634;(function(_0x2e59fc,_0x36bed5){const _0x499516=_0xa634,_0x3ac862=_0x2e59fc();while(!![]){try{const _0x43ca21=-parseInt(_0x499516(0xb1))/0x1+-parseInt(_0x499516(0x146))/0x2*(parseInt(_0x499516(0x13d))/0x3)+-parseInt(_0x499516(0x10c))/0x4+parseInt(_0x499516(0xc4))/0x5*(-parseInt(_0x499516(0x137))/0x6)+-parseInt(_0x499516(0xf4))/0x7+-parseInt(_0x499516(0x12a))/0x8*(parseInt(_0x499516(0x112))/0x9)+parseInt(_0x499516(0x9f))/0xa;if(_0x43ca21===_0x36bed5)break;else _0x3ac862['push'](_0x3ac862['shift']());}catch(_0x11c673){_0x3ac862['push'](_0x3ac862['shift']());}}}(_0x3266,0x779a5));import{Buffer}from'node:buffer';import{createHash,createPrivateKey,createPublicKey,generateKeyPairSync,randomUUID,sign}from'node:crypto';import{chmodSync,existsSync,mkdirSync,readFileSync,writeFileSync}from'node:fs';import{dirname}from'node:path';import _0x2b49cc from'ws';const ED25519_SPKI_PREFIX=Buffer[_0x3f13b4(0x134)](_0x3f13b4(0x9e)+'06032b65'+'70032100',_0x3f13b4(0x10a)),BASE64_PADDING_REGEX=/=+$/g,UPPERCASE_ASCII_REGEX=/[A-Z]/g;function isRecord(_0x1f9b83){const _0x4b7e97=_0x3f13b4;return Boolean(_0x1f9b83)&&typeof _0x1f9b83===_0x4b7e97(0x100)&&!Array['isArray'](_0x1f9b83);}function formatUnknownError(_0x18e01a){const _0x3b38df=_0x3f13b4;if(_0x18e01a instanceof Error)return _0x18e01a[_0x3b38df(0x102)];return String(_0x18e01a??'');}function isLocalGatewayConnRefused(_0x3e7cd7){const _0x1b99b1=_0x3f13b4,_0x168ce2=formatUnknownError(_0x3e7cd7);return/\bECONNREFUSED\b/i[_0x1b99b1(0xba)](_0x168ce2)&&/127\.0\.0\.1:\d+/[_0x1b99b1(0xba)](_0x168ce2);}function base64UrlEncode(_0x42e74d){const _0x580cfd=_0x3f13b4;return _0x42e74d[_0x580cfd(0x124)]('base64')['replaceA'+'ll']('+','-')[_0x580cfd(0xe5)+'ll']('/','_')[_0x580cfd(0x151)](BASE64_PADDING_REGEX,'');}function derivePublicKeyRaw(_0x46ffa9){const _0xee8f5b=_0x3f13b4,_0x4c2ce7=createPublicKey(_0x46ffa9)[_0xee8f5b(0x142)]({'type':_0xee8f5b(0x120),'format':_0xee8f5b(0x14e)}),_0x41db8a=Buffer[_0xee8f5b(0xd8)](_0x4c2ce7)?_0x4c2ce7:Buffer[_0xee8f5b(0x134)](_0x4c2ce7),_0x5ab673=_0x41db8a[_0xee8f5b(0x125)]===ED25519_SPKI_PREFIX[_0xee8f5b(0x125)]+0x20&&_0x41db8a['subarray'](0x0,ED25519_SPKI_PREFIX[_0xee8f5b(0x125)])[_0xee8f5b(0x127)](ED25519_SPKI_PREFIX);return _0x5ab673?_0x41db8a['subarray'](ED25519_SPKI_PREFIX['length']):_0x41db8a;}function fingerprintPublicKey(_0x1481c7){const _0x4dd63d=_0x3f13b4;return createHash(_0x4dd63d(0xa6))[_0x4dd63d(0x10e)](derivePublicKeyRaw(_0x1481c7))['digest']('hex');}function _0xa634(_0x1327be,_0x4b7672){_0x1327be=_0x1327be-0x9b;const _0x32660c=_0x3266();let _0xa6344f=_0x32660c[_0x1327be];return _0xa6344f;}function publicKeyRawBase64UrlFromPem(_0x35a001){return base64UrlEncode(derivePublicKeyRaw(_0x35a001));}function signDevicePayload(_0x9b15d6,_0x5cc826){const _0x106ed5=_0x3f13b4,_0xf9817f=createPrivateKey(_0x9b15d6);return base64UrlEncode(sign(null,Buffer[_0x106ed5(0x134)](_0x5cc826,_0x106ed5(0x11e)),_0xf9817f));}function normalizeDeviceMetadataForAuth(_0x7356c2){const _0x472fdd=_0x3f13b4,_0x2db387=typeof _0x7356c2==='string'?_0x7356c2[_0x472fdd(0xd3)]():'';if(!_0x2db387)return'';return _0x2db387[_0x472fdd(0x151)](UPPERCASE_ASCII_REGEX,_0x589cb4=>String[_0x472fdd(0x13c)+_0x472fdd(0xe1)](_0x589cb4[_0x472fdd(0xf5)+'At'](0x0)+0x20));}function buildDeviceAuthPayloadV3(_0x45f89b){const _0x1cf4df=_0x3f13b4;return['v3',_0x45f89b[_0x1cf4df(0x145)],_0x45f89b[_0x1cf4df(0x108)],_0x45f89b['clientMo'+'de'],_0x45f89b['role'],_0x45f89b['scopes']['join'](','),String(_0x45f89b[_0x1cf4df(0xb6)+'Ms']),_0x45f89b[_0x1cf4df(0x140)]??'',_0x45f89b['nonce'],normalizeDeviceMetadataForAuth(_0x45f89b[_0x1cf4df(0x11b)]),normalizeDeviceMetadataForAuth(_0x45f89b[_0x1cf4df(0x136)+_0x1cf4df(0xc8)])][_0x1cf4df(0x115)]('|');}function writeIdentityFile(_0x2b588b,_0x58eaa3,_0x2fa43){const _0x4545c5=_0x3f13b4;mkdirSync(dirname(_0x2b588b),{'recursive':!![]}),writeFileSync(_0x2b588b,JSON[_0x4545c5(0x116)+'y']({'version':0x1,..._0x58eaa3,'createdAtMs':_0x2fa43},null,0x2)+'\x0a',{'mode':0x180});try{chmodSync(_0x2b588b,0x180);}catch{}}function _0x3266(){const _0x76f74a=['WS\x20conne','ted','identity','entity','rsion','from','entries','deviceFa','6AvrvdM','ect','viceFami','readySta','ateway\x20r','fromChar','6bvrgft','rejectRe','eout','token','pem','export','pending','method','deviceId','416638BvcYCl','connectS','ction\x20ti','ed25519','req','.read','removeAl','timeout','der','send','ent','replace','WS\x20close','pkcs8','nected','t:\x20','connectN','hake\x20tim','handleDi','302a3005','29353600hGorSR','sconnect','dentity','o\x20load\x20g','DateTime','accepted','onChatEv','sha256','payload','med\x20out','ters','WS\x20clien','reject','ssage','Timer','restart','t\x20connec','e\x20timeou','539128SpuSMT','resolve','stop','type','push','signedAt','shouldRe','lengeTim','Path','test','reconnec','ct\x20faile','get','connect','way\x20设备身份','expectFi','eyPem','config','splayNam','4029505BKCASM','delete','close','rejectPe','mily','hallenge','初始化\x20gate','t\x20restar','nal','nonce','res','yCheck','url','.approva','g\x20nonce','trim','operator','\x20yet','eadyWait','dentity\x20','isBuffer','open','hake\x20mis','adyWaite','parse','set','code=','onConnec','yPem','Code','nnected','onAgentE','nding','replaceA','connect\x20','ateway\x20i','vent','e\x20missin','d\x20(','ble','WS\x20is\x20no','request','unavaila','WS\x20error','clientMo','tTimer','istening','onDiscon','709065teyehA','charCode','wujie-sh','ers','.admin','ed\x20out','.pairing','event','failed\x20t','handleMe','t\x20config','publicKe','object','connecte','message','Options','terminat','timed\x20ou','connectC','challeng','clientId','failed','hex','error','1561384HMFZgT','clientVe','update','readyWai','tBackoff','privateK','157221GoMZex','WS\x20hands','WS\x20disco','join','stringif','gateway\x20','OPEN','sing\x20non','lListene','platform','lReady','skipRead','utf8','queueCon','spki','resolveR','clientDe','clearTim','toString','length','string','equals','now','filter','88VCvdZG','once','o\x20send\x20g','ting','sendConn'];_0x3266=function(){return _0x76f74a;};return _0x3266();}function generateDeviceIdentity(){const _0x53e392=_0x3f13b4,{publicKey:_0x3df004,privateKey:_0x1f0dcb}=generateKeyPairSync(_0x53e392(0x149)),_0x575577=_0x3df004[_0x53e392(0x142)]({'type':_0x53e392(0x120),'format':_0x53e392(0x141)})[_0x53e392(0x124)](),_0x2c9378=_0x1f0dcb[_0x53e392(0x142)]({'type':_0x53e392(0x153),'format':_0x53e392(0x141)})[_0x53e392(0x124)]();return{'deviceId':fingerprintPublicKey(_0x575577),'publicKeyPem':_0x575577,'privateKeyPem':_0x2c9378};}function loadOrCreateDeviceIdentity(_0x3eba66){const _0x3b3ef1=_0x3f13b4;if(existsSync(_0x3eba66))try{const _0x1f00c0=JSON['parse'](readFileSync(_0x3eba66,_0x3b3ef1(0x11e))),_0xfad58c=typeof _0x1f00c0?.[_0x3b3ef1(0xff)+_0x3b3ef1(0xe0)]===_0x3b3ef1(0x126)?_0x1f00c0['publicKe'+_0x3b3ef1(0xe0)]:'',_0xb889e8=typeof _0x1f00c0?.[_0x3b3ef1(0x111)+_0x3b3ef1(0xc1)]==='string'?_0x1f00c0[_0x3b3ef1(0x111)+_0x3b3ef1(0xc1)]:'';if(_0xfad58c&&_0xb889e8){const _0x391254={'deviceId':fingerprintPublicKey(_0xfad58c),'publicKeyPem':_0xfad58c,'privateKeyPem':_0xb889e8};return _0x1f00c0?.[_0x3b3ef1(0x145)]!==_0x391254[_0x3b3ef1(0x145)]&&writeIdentityFile(_0x3eba66,_0x391254,Date[_0x3b3ef1(0x128)]()),_0x391254;}}catch{}const _0x412f31=generateDeviceIdentity();return writeIdentityFile(_0x3eba66,_0x412f31,Date['now']()),_0x412f31;}export class ClawGatewayWsClient{['ws']=null;[_0x3f13b4(0xc2)]=null;['pending']=new Map();[_0x3f13b4(0x10f)+_0x3f13b4(0xa9)]=[];[_0x3f13b4(0xb7)+_0x3f13b4(0xbe)]=![];[_0x3f13b4(0xbb)+'tTimer']=null;[_0x3f13b4(0x106)+_0x3f13b4(0xc9)+_0x3f13b4(0xad)]=null;[_0x3f13b4(0x9b)+_0x3f13b4(0x12b)]=null;[_0x3f13b4(0x147)+_0x3f13b4(0x150)]=![];[_0x3f13b4(0x101)+'d']=![];[_0x3f13b4(0xbb)+_0x3f13b4(0x110)+'Ms']=0x320;[_0x3f13b4(0x145)+'entity']=null;['configur'+'e'](_0x29690d){const _0x193124=_0x3f13b4;if(!_0x29690d){this['stop']();return;}const _0x2db6a3=this[_0x193124(0xc2)];this[_0x193124(0xc2)]=_0x29690d,this[_0x193124(0xb7)+_0x193124(0xbe)]=!![];try{this[_0x193124(0x145)+_0x193124(0x132)]=loadOrCreateDeviceIdentity(_0x29690d['identity'+_0x193124(0xb9)]);}catch(_0x1711cb){const _0x4bd590=_0x1711cb instanceof Error?_0x1711cb[_0x193124(0x102)]:_0x193124(0xca)+_0x193124(0xbf)+'失败';this[_0x193124(0xb3)](),_0x29690d['onDiscon'+_0x193124(0x154)](_0x4bd590);return;}const _0x5d59be=!_0x2db6a3||_0x2db6a3[_0x193124(0xd0)]!==_0x29690d[_0x193124(0xd0)]||_0x2db6a3[_0x193124(0x140)]!==_0x29690d[_0x193124(0x140)]||_0x2db6a3[_0x193124(0x108)]!==_0x29690d[_0x193124(0x108)]||_0x2db6a3[_0x193124(0xf0)+'de']!==_0x29690d[_0x193124(0xf0)+'de']||_0x2db6a3[_0x193124(0x10d)+_0x193124(0x133)]!==_0x29690d['clientVe'+_0x193124(0x133)]||_0x2db6a3[_0x193124(0x131)+_0x193124(0xb9)]!==_0x29690d[_0x193124(0x131)+_0x193124(0xb9)];if(_0x5d59be){this[_0x193124(0xae)]();return;}if(!this['ws'])this[_0x193124(0xbe)]();}[_0x3f13b4(0xb3)](){const _0x36aa61=_0x3f13b4;this[_0x36aa61(0xb7)+_0x36aa61(0xbe)]=![],this['connecte'+'d']=![],this[_0x36aa61(0x9b)+'once']=null,this['connectS'+_0x36aa61(0x150)]=![],this[_0x36aa61(0x123)+_0x36aa61(0xf7)](),this[_0x36aa61(0xc7)+'nding'](new Error(_0x36aa61(0x117)+_0x36aa61(0xaa)+'t\x20stoppe'+'d')),this['rejectRe'+'adyWaite'+'rs'](new Error(_0x36aa61(0x117)+_0x36aa61(0xaa)+'t\x20stoppe'+'d'));if(this['ws']){try{this['ws'][_0x36aa61(0xc6)]();}catch{}this['ws']=null;}this['deviceId'+_0x36aa61(0x132)]=null,this[_0x36aa61(0xc2)]=null;}async[_0x3f13b4(0xed)](_0x57d77e,_0x327034={},_0x39df3f={}){const _0x24241a=_0x3f13b4;if(!_0x39df3f[_0x24241a(0x11d)+_0x24241a(0xcf)])await this['waitUnti'+_0x24241a(0x11c)]();const _0x2f6061=this['ws'];if(!_0x2f6061||_0x2f6061['readySta'+'te']!==_0x2b49cc[_0x24241a(0x118)])throw new Error(_0x24241a(0x117)+_0x24241a(0xec)+_0x24241a(0xaf)+_0x24241a(0x130));const _0x2e43f2=randomUUID(),_0x9be46=_0x39df3f['timeoutM'+'s']??0x7530;return await new Promise((_0x2827aa,_0x10e40c)=>{const _0x410ee9=_0x24241a,_0x516684=setTimeout(()=>{const _0x150dcd=_0xa634;this[_0x150dcd(0x143)][_0x150dcd(0xc5)](_0x2e43f2),_0x10e40c(new Error(_0x150dcd(0x117)+'request\x20'+_0x150dcd(0x105)+_0x150dcd(0x155)+_0x57d77e));},_0x9be46);this[_0x410ee9(0x143)][_0x410ee9(0xdd)](_0x2e43f2,{'method':_0x57d77e,'resolve':_0x524189=>{clearTimeout(_0x516684),_0x2827aa(_0x524189);},'reject':_0x413df6=>{clearTimeout(_0x516684),_0x10e40c(_0x413df6);},'expectFinal':_0x39df3f[_0x410ee9(0xc0)+'nal']===!![],'timeout':_0x516684});try{_0x2f6061[_0x410ee9(0x14f)](JSON[_0x410ee9(0x116)+'y']({'type':_0x410ee9(0x14a),'id':_0x2e43f2,'method':_0x57d77e,'params':_0x327034}));}catch(_0x12f791){this[_0x410ee9(0x143)]['delete'](_0x2e43f2),clearTimeout(_0x516684),_0x10e40c(_0x12f791 instanceof Error?_0x12f791:new Error('failed\x20t'+_0x410ee9(0x12c)+_0x410ee9(0x13b)+'equest'));}});}['restart'](){const _0x483055=_0x3f13b4;this[_0x483055(0x101)+'d']=![],this[_0x483055(0x9b)+_0x483055(0x12b)]=null,this['connectS'+'ent']=![],this['clearTim'+_0x483055(0xf7)](),this[_0x483055(0xc7)+_0x483055(0xe4)](new Error(_0x483055(0x117)+_0x483055(0xaa)+_0x483055(0xcb)+_0x483055(0x12d))),this[_0x483055(0x13e)+_0x483055(0xdb)+'rs'](new Error(_0x483055(0x117)+_0x483055(0xaa)+_0x483055(0xcb)+_0x483055(0x12d)));if(this['ws']){try{this['ws'][_0x483055(0x104)+'e']();}catch{}this['ws']=null;}this[_0x483055(0xbe)]();}[_0x3f13b4(0xbe)](){const _0x42b9f6=_0x3f13b4;if(!this[_0x42b9f6(0xc2)]||this['ws'])return;const _0x43cf6b=new _0x2b49cc(this[_0x42b9f6(0xc2)][_0x42b9f6(0xd0)]);this['ws']=_0x43cf6b,_0x43cf6b['on'](_0x42b9f6(0xd9),()=>this['queueCon'+'nectChal'+_0x42b9f6(0xb8)+_0x42b9f6(0x13f)]()),_0x43cf6b['on'](_0x42b9f6(0x102),_0x3d4519=>this[_0x42b9f6(0xfd)+_0x42b9f6(0xac)](_0x3d4519[_0x42b9f6(0x124)]())),_0x43cf6b['on']('close',(_0x1993fc,_0x315171)=>{const _0x5653cb=_0x42b9f6;if(this[_0x5653cb(0x101)+'d']){const _0x4b06a6=_0x315171[_0x5653cb(0x124)]()||_0x5653cb(0xde)+_0x1993fc;this[_0x5653cb(0x9d)+'sconnect'](_0x5653cb(0x117)+_0x5653cb(0x152)+_0x5653cb(0xea)+_0x4b06a6+')');}else this[_0x5653cb(0x9d)+_0x5653cb(0xa0)]('');}),_0x43cf6b['on'](_0x42b9f6(0x10b),_0x41e4e6=>{const _0x56fddf=_0x42b9f6;if(isLocalGatewayConnRefused(_0x41e4e6)){this[_0x56fddf(0x9d)+'sconnect'](_0x56fddf(0x117)+'is\x20not\x20l'+_0x56fddf(0xf2)+_0x56fddf(0xd5));return;}const _0x22ddff=formatUnknownError(_0x41e4e6);this[_0x56fddf(0x9d)+_0x56fddf(0xa0)](_0x22ddff?'gateway\x20'+_0x56fddf(0xef)+':\x20'+_0x22ddff:'gateway\x20'+_0x56fddf(0xef));});}[_0x3f13b4(0x11f)+'nectChal'+_0x3f13b4(0xb8)+_0x3f13b4(0x13f)](){const _0x48d975=_0x3f13b4;this[_0x48d975(0x9b)+'once']=null,this[_0x48d975(0x147)+_0x48d975(0x150)]=![];if(this[_0x48d975(0x106)+'hallenge'+'Timer'])clearTimeout(this[_0x48d975(0x106)+_0x48d975(0xc9)+'Timer']);this['connectC'+'hallenge'+_0x48d975(0xad)]=setTimeout(()=>{const _0x1a3bfe=_0x48d975;if(this['connectS'+'ent']||!this['ws']||this['ws'][_0x1a3bfe(0x13a)+'te']!==_0x2b49cc[_0x1a3bfe(0x118)])return;this['handleDi'+_0x1a3bfe(0xa0)](_0x1a3bfe(0x117)+_0x1a3bfe(0x113)+_0x1a3bfe(0x9c)+_0x1a3bfe(0xf9)),this['ws']?.['close'](0x3f0,'connect\x20'+_0x1a3bfe(0x107)+_0x1a3bfe(0xb0)+'t');},0x7d0);}async[_0x3f13b4(0x12e)+_0x3f13b4(0x138)](){const _0x1d17ce=_0x3f13b4,_0x2aa8af=this[_0x1d17ce(0xc2)];if(!_0x2aa8af||this[_0x1d17ce(0x147)+'ent'])return;const _0x32a7dd=this[_0x1d17ce(0x9b)+_0x1d17ce(0x12b)]?.[_0x1d17ce(0xd3)]()??'';if(!_0x32a7dd){this['handleDi'+_0x1d17ce(0xa0)](_0x1d17ce(0x117)+_0x1d17ce(0x113)+'hake\x20mis'+_0x1d17ce(0x119)+'ce'),this['ws']?.[_0x1d17ce(0xc6)](0x3f0,'connect\x20'+_0x1d17ce(0x107)+_0x1d17ce(0xe9)+_0x1d17ce(0xd2));return;}this['connectS'+_0x1d17ce(0x150)]=!![];this[_0x1d17ce(0x106)+_0x1d17ce(0xc9)+_0x1d17ce(0xad)]&&(clearTimeout(this[_0x1d17ce(0x106)+_0x1d17ce(0xc9)+_0x1d17ce(0xad)]),this[_0x1d17ce(0x106)+_0x1d17ce(0xc9)+'Timer']=null);if(!this['deviceId'+_0x1d17ce(0x132)])try{this[_0x1d17ce(0x145)+'entity']=loadOrCreateDeviceIdentity(_0x2aa8af[_0x1d17ce(0x131)+_0x1d17ce(0xb9)]);}catch(_0x484a78){this[_0x1d17ce(0x9d)+'sconnect'](_0x484a78 instanceof Error?_0x484a78[_0x1d17ce(0x102)]:_0x1d17ce(0xfc)+_0x1d17ce(0xa2)+_0x1d17ce(0xe7)+_0x1d17ce(0xa1)),this['ws']?.['close'](0x3f0,'device\x20i'+_0x1d17ce(0xd7)+_0x1d17ce(0xee)+_0x1d17ce(0xeb));return;}const _0x572a2b=_0x1d17ce(0xd4),_0x3503d8=[_0x1d17ce(0xd4)+_0x1d17ce(0x14b),_0x1d17ce(0xd4)+'.write','operator'+_0x1d17ce(0xf8),_0x1d17ce(0xd4)+_0x1d17ce(0xd1)+'ls','operator'+_0x1d17ce(0xfa)],_0x3a9d90=_0x2aa8af[_0x1d17ce(0x140)][_0x1d17ce(0xd3)](),_0x2e14f1=Date['now'](),_0x26df8f=buildDeviceAuthPayloadV3({'deviceId':this['deviceId'+_0x1d17ce(0x132)][_0x1d17ce(0x145)],'clientId':_0x2aa8af['clientId'],'clientMode':_0x2aa8af[_0x1d17ce(0xf0)+'de'],'role':_0x572a2b,'scopes':_0x3503d8,'signedAtMs':_0x2e14f1,'token':_0x3a9d90||null,'nonce':_0x32a7dd,'platform':process[_0x1d17ce(0x11b)],'deviceFamily':_0x2aa8af[_0x1d17ce(0x122)+_0x1d17ce(0x139)+'ly']}),_0x49def9={'minProtocol':0x4,'maxProtocol':0x4,'client':{'id':_0x2aa8af['clientId'],'displayName':_0x2aa8af['clientDi'+_0x1d17ce(0xc3)+'e'],'version':_0x2aa8af[_0x1d17ce(0x10d)+_0x1d17ce(0x133)],'platform':process[_0x1d17ce(0x11b)],'deviceFamily':_0x2aa8af['clientDe'+_0x1d17ce(0x139)+'ly'],'mode':_0x2aa8af[_0x1d17ce(0xf0)+'de']},'caps':[],'role':_0x572a2b,'scopes':_0x3503d8,'auth':_0x3a9d90?{'token':_0x3a9d90}:undefined,'device':{'id':this['deviceId'+_0x1d17ce(0x132)]['deviceId'],'publicKey':publicKeyRawBase64UrlFromPem(this[_0x1d17ce(0x145)+'entity']['publicKe'+_0x1d17ce(0xe0)]),'signature':signDevicePayload(this[_0x1d17ce(0x145)+_0x1d17ce(0x132)][_0x1d17ce(0x111)+_0x1d17ce(0xc1)],_0x26df8f),'signedAt':_0x2e14f1,'nonce':_0x32a7dd},'locale':Intl[_0x1d17ce(0xa3)+'Format']()['resolved'+_0x1d17ce(0x103)]()['locale'],'userAgent':_0x1d17ce(0xf6)+'ell/'+_0x2aa8af[_0x1d17ce(0x10d)+_0x1d17ce(0x133)]};try{await this[_0x1d17ce(0xed)](_0x1d17ce(0xbe),_0x49def9,{'timeoutMs':0x2710,'skipReadyCheck':!![]}),this['connecte'+'d']=!![],this[_0x1d17ce(0xbb)+_0x1d17ce(0x110)+'Ms']=0x320,this['resolveR'+'eadyWait'+_0x1d17ce(0xf7)](),this[_0x1d17ce(0xc2)]?.[_0x1d17ce(0xdf)+'ted']?.();}catch(_0x4a0f97){this['handleDi'+_0x1d17ce(0xa0)](_0x4a0f97 instanceof Error?_0x4a0f97[_0x1d17ce(0x102)]:_0x1d17ce(0x117)+_0x1d17ce(0x12f)+_0x1d17ce(0xbc)+'d'),this['ws']?.['close'](0x3f0,'connect\x20'+_0x1d17ce(0x109));}}[_0x3f13b4(0xfd)+_0x3f13b4(0xac)](_0x5514ee){const _0x348850=_0x3f13b4;let _0x643c2f;try{_0x643c2f=JSON[_0x348850(0xdc)](_0x5514ee);}catch{return;}if(!isRecord(_0x643c2f)||typeof _0x643c2f['type']!=='string')return;if(_0x643c2f[_0x348850(0xb4)]===_0x348850(0xfb)){const _0x4c2c4b=typeof _0x643c2f[_0x348850(0xfb)]===_0x348850(0x126)?_0x643c2f[_0x348850(0xfb)]:'';if(!_0x4c2c4b)return;const _0x40507f=isRecord(_0x643c2f[_0x348850(0xa7)])?_0x643c2f[_0x348850(0xa7)]:{};if(_0x4c2c4b==='connect.'+_0x348850(0x107)+'e'){const _0x125ec1=typeof _0x40507f[_0x348850(0xcd)]===_0x348850(0x126)?_0x40507f[_0x348850(0xcd)][_0x348850(0xd3)]():'';if(!_0x125ec1){this[_0x348850(0x9d)+_0x348850(0xa0)](_0x348850(0x117)+_0x348850(0x113)+_0x348850(0xda)+'sing\x20non'+'ce'),this['ws']?.[_0x348850(0xc6)](0x3f0,_0x348850(0xe6)+_0x348850(0x107)+_0x348850(0xe9)+'g\x20nonce');return;}this[_0x348850(0x9b)+_0x348850(0x12b)]=_0x125ec1,void this['sendConn'+'ect']();return;}if(_0x4c2c4b==='chat')this[_0x348850(0xc2)]?.[_0x348850(0xa5)+_0x348850(0x150)]?.(_0x40507f);if(_0x4c2c4b==='agent')this[_0x348850(0xc2)]?.[_0x348850(0xe3)+_0x348850(0xe8)]?.(_0x40507f);return;}if(_0x643c2f['type']!==_0x348850(0xce))return;const _0x3211ff=typeof _0x643c2f['id']===_0x348850(0x126)?_0x643c2f['id']:'';if(!_0x3211ff)return;const _0x4b70f9=this[_0x348850(0x143)][_0x348850(0xbd)](_0x3211ff);if(!_0x4b70f9)return;const _0x56f5d8=isRecord(_0x643c2f['payload'])?_0x643c2f[_0x348850(0xa7)]:{},_0x1194df=typeof _0x56f5d8['status']==='string'?_0x56f5d8['status']:'';if(_0x4b70f9[_0x348850(0xc0)+_0x348850(0xcc)]&&_0x1194df===_0x348850(0xa4))return;this[_0x348850(0x143)][_0x348850(0xc5)](_0x3211ff);_0x4b70f9['timeout']&&(clearTimeout(_0x4b70f9[_0x348850(0x14d)]),_0x4b70f9[_0x348850(0x14d)]=null);if(_0x643c2f['ok']===!![]){_0x4b70f9[_0x348850(0xb2)](_0x643c2f['payload']);return;}const _0x318f20=isRecord(_0x643c2f['error'])?_0x643c2f['error']:{},_0x4b7581=typeof _0x318f20[_0x348850(0x102)]===_0x348850(0x126)?_0x318f20['message']:'gateway\x20'+'request\x20'+'failed:\x20'+_0x4b70f9[_0x348850(0x144)];_0x4b70f9['reject'](new Error(_0x4b7581));}['waitUnti'+'lReady'](_0x11a09a=0x2ee0){const _0xec05ca=_0x3f13b4;if(this[_0xec05ca(0x101)+'d'])return Promise[_0xec05ca(0xb2)]();if(!this['config'])return Promise[_0xec05ca(0xab)](new Error('gateway\x20'+'WS\x20is\x20no'+_0xec05ca(0xfe)+'ured'));if(!this['ws'])this[_0xec05ca(0xbe)]();return new Promise((_0x79daa0,_0x10d6bf)=>{const _0x2ac69e=_0xec05ca,_0x35200d=setTimeout(()=>{const _0x1fe0d2=_0xa634;this['readyWai'+'ters']=this[_0x1fe0d2(0x10f)+'ters'][_0x1fe0d2(0x129)](_0x3aefcf=>_0x3aefcf['resolve']!==_0x79daa0),_0x10d6bf(new Error(_0x1fe0d2(0x117)+_0x1fe0d2(0x12f)+_0x1fe0d2(0x148)+_0x1fe0d2(0xa8)));},_0x11a09a);this['readyWai'+_0x2ac69e(0xa9)][_0x2ac69e(0xb5)]({'resolve':_0x79daa0,'reject':_0x10d6bf,'timeout':_0x35200d});});}[_0x3f13b4(0x121)+_0x3f13b4(0xd6)+_0x3f13b4(0xf7)](){const _0x5b621e=_0x3f13b4,_0x342017=[...this['readyWai'+_0x5b621e(0xa9)]];this[_0x5b621e(0x10f)+_0x5b621e(0xa9)]=[];for(const _0x2201fe of _0x342017){clearTimeout(_0x2201fe['timeout']),_0x2201fe['resolve']();}}[_0x3f13b4(0x13e)+'adyWaite'+'rs'](_0x52bc17){const _0x196c7f=_0x3f13b4,_0xa70811=[...this[_0x196c7f(0x10f)+_0x196c7f(0xa9)]];this[_0x196c7f(0x10f)+_0x196c7f(0xa9)]=[];for(const _0x26120e of _0xa70811){clearTimeout(_0x26120e['timeout']),_0x26120e[_0x196c7f(0xab)](_0x52bc17);}}['rejectPe'+'nding'](_0xc7722){const _0x19c4e1=_0x3f13b4;for(const [_0x1084e5,_0x565495]of this[_0x19c4e1(0x143)][_0x19c4e1(0x135)]()){this[_0x19c4e1(0x143)][_0x19c4e1(0xc5)](_0x1084e5),_0x565495[_0x19c4e1(0x14d)]&&(clearTimeout(_0x565495[_0x19c4e1(0x14d)]),_0x565495[_0x19c4e1(0x14d)]=null),_0x565495[_0x19c4e1(0xab)](_0xc7722);}}[_0x3f13b4(0x9d)+_0x3f13b4(0xa0)](_0x45d5b3){const _0x3a5390=_0x3f13b4;this['ws']&&(this['ws'][_0x3a5390(0x14c)+_0x3a5390(0x11a)+'rs'](),this['ws']=null);this[_0x3a5390(0x101)+'d']=![],this[_0x3a5390(0x9b)+_0x3a5390(0x12b)]=null,this[_0x3a5390(0x147)+_0x3a5390(0x150)]=![],this[_0x3a5390(0xc7)+_0x3a5390(0xe4)](new Error(_0x45d5b3||_0x3a5390(0x117)+_0x3a5390(0x114)+_0x3a5390(0xe2))),this['rejectRe'+'adyWaite'+'rs'](new Error(_0x45d5b3||_0x3a5390(0x117)+_0x3a5390(0x114)+'nnected')),this[_0x3a5390(0x123)+'ers']();if(_0x45d5b3)this['config']?.[_0x3a5390(0xf3)+_0x3a5390(0x154)]?.(_0x45d5b3);if(!this[_0x3a5390(0xb7)+_0x3a5390(0xbe)]||!this[_0x3a5390(0xc2)])return;const _0x1675a6=this[_0x3a5390(0xbb)+_0x3a5390(0x110)+'Ms'];this['reconnec'+'tBackoff'+'Ms']=Math['min'](this['reconnec'+_0x3a5390(0x110)+'Ms']*0x2,0x3a98),this['reconnec'+_0x3a5390(0xf1)]=setTimeout(()=>{const _0x38ff6a=_0x3a5390;this[_0x38ff6a(0xbb)+_0x38ff6a(0xf1)]=null,this[_0x38ff6a(0xbe)]();},_0x1675a6);}[_0x3f13b4(0x123)+_0x3f13b4(0xf7)](){const _0x130650=_0x3f13b4;this[_0x130650(0xbb)+_0x130650(0xf1)]&&(clearTimeout(this[_0x130650(0xbb)+_0x130650(0xf1)]),this[_0x130650(0xbb)+_0x130650(0xf1)]=null),this[_0x130650(0x106)+_0x130650(0xc9)+'Timer']&&(clearTimeout(this[_0x130650(0x106)+_0x130650(0xc9)+_0x130650(0xad)]),this[_0x130650(0x106)+'hallenge'+_0x130650(0xad)]=null);}}
@@ -1 +1 @@
1
- (function(_0x40b15d,_0x4249b6){var _0x3366e2=_0x587e,_0x322c36=_0x40b15d();while(!![]){try{var _0x4e876e=-parseInt(_0x3366e2(0x10d))/0x1*(-parseInt(_0x3366e2(0x107))/0x2)+-parseInt(_0x3366e2(0x10c))/0x3*(parseInt(_0x3366e2(0x10f))/0x4)+parseInt(_0x3366e2(0x109))/0x5*(-parseInt(_0x3366e2(0x110))/0x6)+parseInt(_0x3366e2(0x10e))/0x7*(parseInt(_0x3366e2(0x10a))/0x8)+-parseInt(_0x3366e2(0x10b))/0x9+-parseInt(_0x3366e2(0x108))/0xa+parseInt(_0x3366e2(0x106))/0xb;if(_0x4e876e===_0x4249b6)break;else _0x322c36['push'](_0x322c36['shift']());}catch(_0x52c58d){_0x322c36['push'](_0x322c36['shift']());}}}(_0x23d5,0x99fb6));export{ensureOpenClawDoctorFixed,loadRuntimeInfo,prepareRuntime,runClawOnce,spawnClaw}from'./runtime.mjs';function _0x587e(_0x1da05a,_0x2a77e2){_0x1da05a=_0x1da05a-0x106;var _0x23d5c8=_0x23d5();var _0x587ea7=_0x23d5c8[_0x1da05a];return _0x587ea7;}function _0x23d5(){var _0x3ca475=['9870520HWoRBQ','30OvgUQe','160itQXru','9072423vZWRjn','589497Lmyreg','82955ZIhxIb','323827ONBxCY','12hDHAjh','1109466eELhgu','25532507eclDTL','26BfBHTk'];_0x23d5=function(){return _0x3ca475;};return _0x23d5();}export{createConfigController}from'./config-controller.mjs';export{createGatewayController}from'./gateway-controller.mjs';
1
+ (function(_0xd17c36,_0x4788a2){var _0x16fbe9=_0x3bc0,_0x2d0951=_0xd17c36();while(!![]){try{var _0x58792e=parseInt(_0x16fbe9(0x1a8))/0x1*(-parseInt(_0x16fbe9(0x19c))/0x2)+parseInt(_0x16fbe9(0x1a3))/0x3*(parseInt(_0x16fbe9(0x19e))/0x4)+-parseInt(_0x16fbe9(0x1a7))/0x5*(parseInt(_0x16fbe9(0x1a4))/0x6)+parseInt(_0x16fbe9(0x1a6))/0x7*(parseInt(_0x16fbe9(0x1a1))/0x8)+-parseInt(_0x16fbe9(0x1a5))/0x9*(-parseInt(_0x16fbe9(0x1a0))/0xa)+-parseInt(_0x16fbe9(0x19d))/0xb*(-parseInt(_0x16fbe9(0x1a2))/0xc)+parseInt(_0x16fbe9(0x19f))/0xd*(-parseInt(_0x16fbe9(0x1a9))/0xe);if(_0x58792e===_0x4788a2)break;else _0x2d0951['push'](_0x2d0951['shift']());}catch(_0xdc396){_0x2d0951['push'](_0x2d0951['shift']());}}}(_0x5c21,0xe33b0));function _0x5c21(){var _0x2d1379=['975183tEWEKc','33568VwlHoi','13RecZGY','10uspndR','74296pIuyHN','84OYsCTL','486OIwOCp','84KYemvc','7314066TEAUIY','889TgBNZP','535465orfhXo','131vnvcAZ','21034538FwqxPt','606QMyhRh'];_0x5c21=function(){return _0x2d1379;};return _0x5c21();}export{ensureOpenClawDoctorFixed,loadRuntimeInfo,prepareRuntime,runClawOnce,spawnClaw}from'./runtime.mjs';function _0x3bc0(_0x2893b2,_0xcbfd7){_0x2893b2=_0x2893b2-0x19c;var _0x5c217f=_0x5c21();var _0x3bc051=_0x5c217f[_0x2893b2];return _0x3bc051;}export{createConfigController}from'./config-controller.mjs';export{createGatewayController}from'./gateway-controller.mjs';
@@ -1 +1 @@
1
- const _0x39de26=_0x1491;(function(_0x588c57,_0x324036){const _0x16279f=_0x1491,_0x85bb23=_0x588c57();while(!![]){try{const _0x1e69ad=parseInt(_0x16279f(0x15d))/0x1*(-parseInt(_0x16279f(0x160))/0x2)+parseInt(_0x16279f(0x15b))/0x3+-parseInt(_0x16279f(0x164))/0x4+-parseInt(_0x16279f(0x182))/0x5+parseInt(_0x16279f(0x17e))/0x6+-parseInt(_0x16279f(0x15c))/0x7+parseInt(_0x16279f(0x153))/0x8;if(_0x1e69ad===_0x324036)break;else _0x85bb23['push'](_0x85bb23['shift']());}catch(_0x1bf3fb){_0x85bb23['push'](_0x85bb23['shift']());}}}(_0x2bc7,0x5159c));import{createHash}from'node:crypto';import{spawn}from'node:child_process';import{existsSync}from'node:fs';import{cp,mkdir,rm}from'node:fs/promises';import{homedir,tmpdir}from'node:os';import{basename,dirname,isAbsolute,join,relative,resolve}from'node:path';import{createFileLogger,redactLogValue}from'@wujie-shell/logger';const LOG_MAX_BYTES=0x2*0x400*0x400,LOG_KEEP_COUNT=0x5,loggers=new Map(),CONTENT_PREVIEW_LENGTH=0xf0;export function createShellLogger(_0x1eb52b,_0x48319c,_0xc5f90c=_0x48319c){const _0x2afc65=_0x1491,_0x2955ff=_0x1eb52b?.['logsDir'];if(!_0x2955ff||!_0x48319c)return null;const _0x5b70f4=join(_0x2955ff,_0x48319c,_0x48319c+'.log'),_0x886f0c=_0x5b70f4+':'+_0xc5f90c;return!loggers[_0x2afc65(0x185)](_0x886f0c)&&loggers['set'](_0x886f0c,createFileLogger({'filePath':_0x5b70f4,'context':_0xc5f90c,'maxBytes':LOG_MAX_BYTES,'keepCount':LOG_KEEP_COUNT})),loggers['get'](_0x886f0c);}function _0x2bc7(){const _0xefc3c7=['ot\x20found','textPrev','...','Object','name','env','zip','add','object','[Circula','pipe','stack','error','message','wujie-sh','\x20-Destin','pid','join','digest','9132256fZHtCo','dev','win32','entlyCon','nce=\x27Sil','length','ignore','toString','911526BKrehn','1765876HOOLWJ','44322VMFUQE','sPrefere','ectory\x20n','16CuLWWo','maxDepth','powershe','platform','198516fxXfQS','-Archive','includes','ing','with\x20cod','tinue\x27;','\x20failed\x20','map','isArray','.zip','base64','startsWi','Compress','cwd','data','close','-NoProfi','slice','array','ell-logs','string','Command','\x20-Path\x20','replace','from','catch','129618RkkjnE','filter','stringif','logs\x20dir','2386460AVYBRk','Array','trim','has'];_0x2bc7=function(){return _0xefc3c7;};return _0x2bc7();}function _0x1491(_0x31c962,_0x500b2b){_0x31c962=_0x31c962-0x143;const _0x2bc71f=_0x2bc7();let _0x1491fe=_0x2bc71f[_0x31c962];return _0x1491fe;}export function toHomePath(_0x445766){const _0x4ec5c5=_0x1491,_0x6e7fa=typeof _0x445766===_0x4ec5c5(0x178)?_0x445766:'';if(!_0x6e7fa)return'';const _0x1e3bbc=homedir(),_0x58639a=isAbsolute(_0x6e7fa)?_0x6e7fa:resolve(_0x6e7fa),_0x4ab815=relative(_0x1e3bbc,_0x58639a);if(!_0x4ab815||!_0x4ab815[_0x4ec5c5(0x16f)+'th']('..')&&!isAbsolute(_0x4ab815))return _0x4ab815?'~/'+_0x4ab815:'~';return _0x58639a;}export function hashText(_0x56ad6b){const _0x26835a=_0x1491;return createHash('sha256')['update'](String(_0x56ad6b))[_0x26835a(0x152)]('hex')[_0x26835a(0x175)](0x0,0x10);}export function truncateText(_0x2497b1,_0x39dfc7=CONTENT_PREVIEW_LENGTH){const _0x4f0e49=_0x1491,_0x1fbb50=String(_0x2497b1??'')[_0x4f0e49(0x17b)](/\s+/g,'\x20')[_0x4f0e49(0x184)]();if(_0x1fbb50[_0x4f0e49(0x158)]<=_0x39dfc7)return _0x1fbb50;return _0x1fbb50['slice'](0x0,_0x39dfc7)+_0x4f0e49(0x188);}export function summarizeText(_0x33fc77,_0x4e2794=CONTENT_PREVIEW_LENGTH){const _0x6cb0f5=_0x1491,_0x354307=String(_0x33fc77??'');return{'length':_0x354307[_0x6cb0f5(0x158)],'hash':hashText(_0x354307),'preview':truncateText(_0x354307,_0x4e2794),'truncated':_0x354307['length']>_0x4e2794};}export function summarizeError(_0xde5470){const _0x5840a9=_0x1491;if(_0xde5470 instanceof Error)return{'name':_0xde5470[_0x5840a9(0x144)],'message':_0xde5470[_0x5840a9(0x14d)],'stack':_0xde5470[_0x5840a9(0x14b)]};return{'message':String(_0xde5470)};}function summarizePathValue(_0xa01860){const _0x46717d=_0x1491;if(typeof _0xa01860!==_0x46717d(0x178))return _0xa01860;if(_0xa01860[_0x46717d(0x166)]('/')||_0xa01860['includes']('\x5c'))return toHomePath(_0xa01860);return _0xa01860;}export function summarizePayload(_0x1b76a9,_0x4c3b3f={}){const _0x11c50d=_0x1491,_0x48baae=_0x4c3b3f[_0x11c50d(0x161)]??0x4,_0x21b695=new WeakSet();function _0x277c9d(_0x1bd853,_0x220f24,_0x485ac1=''){const _0x1cca67=_0x11c50d;if(_0x1bd853==null)return _0x1bd853;if(typeof _0x1bd853==='string'){if(/message|content|prompt|text|body/i['test'](_0x485ac1))return summarizeText(_0x1bd853,_0x4c3b3f[_0x1cca67(0x187)+'iewLengt'+'h']);return summarizePathValue(_0x1bd853);}if(typeof _0x1bd853!==_0x1cca67(0x148))return _0x1bd853;if(_0x1bd853 instanceof Error)return summarizeError(_0x1bd853);if(_0x21b695[_0x1cca67(0x185)](_0x1bd853))return _0x1cca67(0x149)+'r]';if(_0x220f24>=_0x48baae)return'['+(Array[_0x1cca67(0x16c)](_0x1bd853)?_0x1cca67(0x183):_0x1cca67(0x143))+']';_0x21b695[_0x1cca67(0x147)](_0x1bd853);if(Array['isArray'](_0x1bd853))return{'type':_0x1cca67(0x176),'length':_0x1bd853[_0x1cca67(0x158)],'items':_0x1bd853['slice'](0x0,0x5)[_0x1cca67(0x16b)](_0x1191f3=>_0x277c9d(_0x1191f3,_0x220f24+0x1,_0x485ac1)),'truncated':_0x1bd853[_0x1cca67(0x158)]>0x5};const _0x5a8e16={};for(const [_0x416781,_0x43f47e]of Object['entries'](_0x1bd853)){_0x5a8e16[_0x416781]=_0x277c9d(_0x43f47e,_0x220f24+0x1,_0x416781);}return redactLogValue(_0x5a8e16);}return _0x277c9d(_0x1b76a9,0x0);}export function summarizeFilePaths(_0x387867=[]){const _0x1bef66=_0x1491;return(Array[_0x1bef66(0x16c)](_0x387867)?_0x387867:[])[_0x1bef66(0x16b)](_0x1e6224=>String(_0x1e6224||'')[_0x1bef66(0x184)]())[_0x1bef66(0x17f)](Boolean)[_0x1bef66(0x16b)](_0x579b38=>({'path':toHomePath(_0x579b38),'name':basename(_0x579b38)}));}function run(_0x508292,_0x1b25dc,_0x93c194={}){return new Promise((_0x573e91,_0x4a93f6)=>{const _0x56c36f=_0x1491,_0x1963dc=spawn(_0x508292,_0x1b25dc,{'cwd':_0x93c194[_0x56c36f(0x171)],'env':{...process.env,..._0x93c194[_0x56c36f(0x145)]??{}},'stdio':[_0x56c36f(0x159),_0x56c36f(0x14a),_0x56c36f(0x14a)]});let _0x13d622='';_0x1963dc['stderr']?.['on'](_0x56c36f(0x172),_0x5d5069=>{const _0x42edfa=_0x56c36f;_0x13d622+=_0x5d5069[_0x42edfa(0x15a)]();}),_0x1963dc['on'](_0x56c36f(0x14c),_0x4a93f6),_0x1963dc['on'](_0x56c36f(0x173),_0xedf2ea=>{const _0x84c974=_0x56c36f;if(_0xedf2ea===0x0){_0x573e91();return;}_0x4a93f6(new Error(_0x508292+(_0x84c974(0x16a)+_0x84c974(0x168)+'e=')+_0xedf2ea+':\x20'+_0x13d622));});});}export async function exportLogsArchive({logsDir:_0x529f63,targetDir:_0x124bd8,appVersion:appVersion=_0x39de26(0x154)}){const _0x3d3c67=_0x39de26;if(!_0x529f63||!existsSync(_0x529f63))throw new Error(_0x3d3c67(0x181)+_0x3d3c67(0x15f)+_0x3d3c67(0x186)+':\x20'+(_0x529f63||''));const _0x5da693=String(appVersion||_0x3d3c67(0x154))['replace'](/[^A-Za-z0-9._-]/g,'_'),_0x529109=new Date()['toISOStr'+_0x3d3c67(0x167)]()[_0x3d3c67(0x17b)](/[-:]/g,'')[_0x3d3c67(0x17b)](/\..+$/,''),_0x4a5710=_0x124bd8||tmpdir();await mkdir(_0x4a5710,{'recursive':!![]});const _0x3e0b00=join(_0x4a5710,_0x3d3c67(0x14e)+_0x3d3c67(0x177)+'-'+_0x529109+'-'+_0x5da693+_0x3d3c67(0x16d));if(process[_0x3d3c67(0x163)]===_0x3d3c67(0x155)){const _0x13f7f8=join(tmpdir(),_0x3d3c67(0x14e)+'ell-logs'+'-'+process[_0x3d3c67(0x150)]+'-'+Date['now']());await rm(_0x13f7f8,{'recursive':!![],'force':!![]}),await cp(_0x529f63,_0x13f7f8,{'recursive':!![],'force':!![]});try{const _0x31cfae=['$Progres'+_0x3d3c67(0x15e)+_0x3d3c67(0x157)+_0x3d3c67(0x156)+_0x3d3c67(0x169),_0x3d3c67(0x170)+_0x3d3c67(0x165)+_0x3d3c67(0x17a)+JSON[_0x3d3c67(0x180)+'y'](join(_0x13f7f8,'*'))+(_0x3d3c67(0x14f)+'ationPat'+'h\x20')+JSON[_0x3d3c67(0x180)+'y'](_0x3e0b00)+'\x20-Force'][_0x3d3c67(0x151)]('\x20'),_0x5a9443=Buffer[_0x3d3c67(0x17c)](_0x31cfae,'utf16le')[_0x3d3c67(0x15a)](_0x3d3c67(0x16e));await run(_0x3d3c67(0x162)+'ll.exe',[_0x3d3c67(0x174)+'le','-Encoded'+_0x3d3c67(0x179),_0x5a9443]);}finally{await rm(_0x13f7f8,{'recursive':!![],'force':!![]})[_0x3d3c67(0x17d)](()=>{});}}else await run(_0x3d3c67(0x146),['-r',_0x3e0b00,'.'],{'cwd':_0x529f63});return{'ok':!![],'path':_0x3e0b00};}
1
+ const _0xd1d093=_0x4716;(function(_0x32ee2a,_0x4c545b){const _0xc104fb=_0x4716,_0x4ac7f8=_0x32ee2a();while(!![]){try{const _0x2c8087=parseInt(_0xc104fb(0xb6))/0x1*(parseInt(_0xc104fb(0xa1))/0x2)+-parseInt(_0xc104fb(0xc4))/0x3*(-parseInt(_0xc104fb(0xcc))/0x4)+parseInt(_0xc104fb(0xb0))/0x5+-parseInt(_0xc104fb(0xae))/0x6*(-parseInt(_0xc104fb(0x9e))/0x7)+parseInt(_0xc104fb(0xc5))/0x8+-parseInt(_0xc104fb(0xa7))/0x9+parseInt(_0xc104fb(0x91))/0xa*(-parseInt(_0xc104fb(0xc6))/0xb);if(_0x2c8087===_0x4c545b)break;else _0x4ac7f8['push'](_0x4ac7f8['shift']());}catch(_0x1b794a){_0x4ac7f8['push'](_0x4ac7f8['shift']());}}}(_0x4c13,0xdc80b));import{createHash}from'node:crypto';import{spawn}from'node:child_process';function _0x4c13(){const _0xa505a6=['cwd','Compress','test','3330nuJnjD','error','ationPat','dev','tinue\x27;','with\x20cod','slice','env','stack','array','now','includes','join','1718794sBxYKm','isArray','startsWi','1724rHfQhC','map','ll.exe','ing','\x20-Path\x20','get','13354695fYXpYW','logs\x20dir','$Progres','data','pipe','.log','entries','6htqrkJ','toString','4793290vNaMNf','trim','message','powershe','[Circula','length','1009WMleoE','add','zip','nce=\x27Sil','maxDepth','\x20failed\x20','sha256','wujie-sh','Command','platform','iewLengt','ectory\x20n','entlyCon','\x20-Force','87fpUFjr','6187664hJGUkG','29513sJkECI','stderr','stringif','ignore','Array','update','59732fkdZuD','string','-NoProfi','replace','digest','close','-Archive','has','ot\x20found'];_0x4c13=function(){return _0xa505a6;};return _0x4c13();}import{existsSync}from'node:fs';import{cp,mkdir,rm}from'node:fs/promises';import{homedir,tmpdir}from'node:os';import{basename,dirname,isAbsolute,join,relative,resolve}from'node:path';import{createFileLogger,redactLogValue}from'@wujie-shell/logger';const LOG_MAX_BYTES=0x2*0x400*0x400,LOG_KEEP_COUNT=0x5,loggers=new Map(),CONTENT_PREVIEW_LENGTH=0xf0;export function createShellLogger(_0x4e9e8c,_0x38ff0d,_0x20bb4c=_0x38ff0d){const _0x3789b3=_0x4716,_0x2c4719=_0x4e9e8c?.['logsDir'];if(!_0x2c4719||!_0x38ff0d)return null;const _0x2d1d05=join(_0x2c4719,_0x38ff0d,_0x38ff0d+_0x3789b3(0xac)),_0x30d59c=_0x2d1d05+':'+_0x20bb4c;return!loggers[_0x3789b3(0xd3)](_0x30d59c)&&loggers['set'](_0x30d59c,createFileLogger({'filePath':_0x2d1d05,'context':_0x20bb4c,'maxBytes':LOG_MAX_BYTES,'keepCount':LOG_KEEP_COUNT})),loggers[_0x3789b3(0xa6)](_0x30d59c);}export function toHomePath(_0x83aa1a){const _0x5e4f76=_0x4716,_0x23d6e8=typeof _0x83aa1a==='string'?_0x83aa1a:'';if(!_0x23d6e8)return'';const _0x521719=homedir(),_0x121647=isAbsolute(_0x23d6e8)?_0x23d6e8:resolve(_0x23d6e8),_0x3ef94c=relative(_0x521719,_0x121647);if(!_0x3ef94c||!_0x3ef94c[_0x5e4f76(0xa0)+'th']('..')&&!isAbsolute(_0x3ef94c))return _0x3ef94c?'~/'+_0x3ef94c:'~';return _0x121647;}function _0x4716(_0x27c778,_0x1607bf){_0x27c778=_0x27c778-0x8d;const _0x4c136b=_0x4c13();let _0x4716cf=_0x4c136b[_0x27c778];return _0x4716cf;}export function hashText(_0x4f6531){const _0x1da975=_0x4716;return createHash(_0x1da975(0xbc))[_0x1da975(0xcb)](String(_0x4f6531))[_0x1da975(0xd0)]('hex')[_0x1da975(0x97)](0x0,0x10);}export function truncateText(_0x1967ed,_0xdfdea2=CONTENT_PREVIEW_LENGTH){const _0x571cd4=_0x4716,_0x3a37f8=String(_0x1967ed??'')[_0x571cd4(0xcf)](/\s+/g,'\x20')[_0x571cd4(0xb1)]();if(_0x3a37f8[_0x571cd4(0xb5)]<=_0xdfdea2)return _0x3a37f8;return _0x3a37f8[_0x571cd4(0x97)](0x0,_0xdfdea2)+'...';}export function summarizeText(_0x539d60,_0x25ee65=CONTENT_PREVIEW_LENGTH){const _0x2c9f6c=_0x4716,_0x5ec9b5=String(_0x539d60??'');return{'length':_0x5ec9b5[_0x2c9f6c(0xb5)],'hash':hashText(_0x5ec9b5),'preview':truncateText(_0x5ec9b5,_0x25ee65),'truncated':_0x5ec9b5[_0x2c9f6c(0xb5)]>_0x25ee65};}export function summarizeError(_0x5a6754){const _0x5ba54c=_0x4716;if(_0x5a6754 instanceof Error)return{'name':_0x5a6754['name'],'message':_0x5a6754[_0x5ba54c(0xb2)],'stack':_0x5a6754[_0x5ba54c(0x99)]};return{'message':String(_0x5a6754)};}function summarizePathValue(_0x235ed9){const _0x527111=_0x4716;if(typeof _0x235ed9!==_0x527111(0xcd))return _0x235ed9;if(_0x235ed9[_0x527111(0x9c)]('/')||_0x235ed9['includes']('\x5c'))return toHomePath(_0x235ed9);return _0x235ed9;}export function summarizePayload(_0x25fc45,_0x4bc1a0={}){const _0x3d8307=_0x4716,_0x4adb78=_0x4bc1a0[_0x3d8307(0xba)]??0x4,_0x10802c=new WeakSet();function _0x36d241(_0x575912,_0x87467,_0x3fa11a=''){const _0x26d400=_0x3d8307;if(_0x575912==null)return _0x575912;if(typeof _0x575912===_0x26d400(0xcd)){if(/message|content|prompt|text|body/i[_0x26d400(0x90)](_0x3fa11a))return summarizeText(_0x575912,_0x4bc1a0['textPrev'+_0x26d400(0xc0)+'h']);return summarizePathValue(_0x575912);}if(typeof _0x575912!=='object')return _0x575912;if(_0x575912 instanceof Error)return summarizeError(_0x575912);if(_0x10802c['has'](_0x575912))return _0x26d400(0xb4)+'r]';if(_0x87467>=_0x4adb78)return'['+(Array['isArray'](_0x575912)?_0x26d400(0xca):'Object')+']';_0x10802c[_0x26d400(0xb7)](_0x575912);if(Array[_0x26d400(0x9f)](_0x575912))return{'type':_0x26d400(0x9a),'length':_0x575912[_0x26d400(0xb5)],'items':_0x575912['slice'](0x0,0x5)[_0x26d400(0xa2)](_0x2526ef=>_0x36d241(_0x2526ef,_0x87467+0x1,_0x3fa11a)),'truncated':_0x575912[_0x26d400(0xb5)]>0x5};const _0x475ae5={};for(const [_0x31b2de,_0x4c5ce0]of Object[_0x26d400(0xad)](_0x575912)){_0x475ae5[_0x31b2de]=_0x36d241(_0x4c5ce0,_0x87467+0x1,_0x31b2de);}return redactLogValue(_0x475ae5);}return _0x36d241(_0x25fc45,0x0);}export function summarizeFilePaths(_0x3454b0=[]){const _0x58720f=_0x4716;return(Array['isArray'](_0x3454b0)?_0x3454b0:[])[_0x58720f(0xa2)](_0x3285e9=>String(_0x3285e9||'')[_0x58720f(0xb1)]())['filter'](Boolean)[_0x58720f(0xa2)](_0x3cffc8=>({'path':toHomePath(_0x3cffc8),'name':basename(_0x3cffc8)}));}function run(_0x47044a,_0x157915,_0x57fadf={}){return new Promise((_0x3a2b12,_0xbc1a02)=>{const _0x3b9a0a=_0x4716,_0xe663af=spawn(_0x47044a,_0x157915,{'cwd':_0x57fadf[_0x3b9a0a(0x8e)],'env':{...process.env,..._0x57fadf[_0x3b9a0a(0x98)]??{}},'stdio':[_0x3b9a0a(0xc9),_0x3b9a0a(0xab),_0x3b9a0a(0xab)]});let _0x510713='';_0xe663af[_0x3b9a0a(0xc7)]?.['on'](_0x3b9a0a(0xaa),_0x4fc14a=>{_0x510713+=_0x4fc14a['toString']();}),_0xe663af['on'](_0x3b9a0a(0x92),_0xbc1a02),_0xe663af['on'](_0x3b9a0a(0xd1),_0x2cc29e=>{const _0x2c105d=_0x3b9a0a;if(_0x2cc29e===0x0){_0x3a2b12();return;}_0xbc1a02(new Error(_0x47044a+(_0x2c105d(0xbb)+_0x2c105d(0x96)+'e=')+_0x2cc29e+':\x20'+_0x510713));});});}export async function exportLogsArchive({logsDir:_0x453eea,targetDir:_0x86be85,appVersion:appVersion=_0xd1d093(0x94)}){const _0x240049=_0xd1d093;if(!_0x453eea||!existsSync(_0x453eea))throw new Error(_0x240049(0xa8)+_0x240049(0xc1)+_0x240049(0x8d)+':\x20'+(_0x453eea||''));const _0x497f01=String(appVersion||'dev')[_0x240049(0xcf)](/[^A-Za-z0-9._-]/g,'_'),_0x2a5c66=new Date()['toISOStr'+_0x240049(0xa4)]()[_0x240049(0xcf)](/[-:]/g,'')[_0x240049(0xcf)](/\..+$/,''),_0x42bb6b=_0x86be85||tmpdir();await mkdir(_0x42bb6b,{'recursive':!![]});const _0x3bab53=join(_0x42bb6b,_0x240049(0xbd)+'ell-logs'+'-'+_0x2a5c66+'-'+_0x497f01+'.zip');if(process[_0x240049(0xbf)]==='win32'){const _0x95c6cf=join(tmpdir(),_0x240049(0xbd)+'ell-logs'+'-'+process['pid']+'-'+Date[_0x240049(0x9b)]());await rm(_0x95c6cf,{'recursive':!![],'force':!![]}),await cp(_0x453eea,_0x95c6cf,{'recursive':!![],'force':!![]});try{const _0x4882b2=[_0x240049(0xa9)+'sPrefere'+_0x240049(0xb9)+_0x240049(0xc2)+_0x240049(0x95),_0x240049(0x8f)+_0x240049(0xd2)+_0x240049(0xa5)+JSON[_0x240049(0xc8)+'y'](join(_0x95c6cf,'*'))+('\x20-Destin'+_0x240049(0x93)+'h\x20')+JSON[_0x240049(0xc8)+'y'](_0x3bab53)+_0x240049(0xc3)][_0x240049(0x9d)]('\x20'),_0x3e88f0=Buffer['from'](_0x4882b2,'utf16le')[_0x240049(0xaf)]('base64');await run(_0x240049(0xb3)+_0x240049(0xa3),[_0x240049(0xce)+'le','-Encoded'+_0x240049(0xbe),_0x3e88f0]);}finally{await rm(_0x95c6cf,{'recursive':!![],'force':!![]})['catch'](()=>{});}}else await run(_0x240049(0xb8),['-r',_0x3bab53,'.'],{'cwd':_0x453eea});return{'ok':!![],'path':_0x3bab53};}
@@ -1 +1 @@
1
- (function(_0x14ef7c,_0x250906){const _0x2c95ea=_0xb00c,_0x37aa79=_0x14ef7c();while(!![]){try{const _0x5416e4=parseInt(_0x2c95ea(0x1f6))/0x1+parseInt(_0x2c95ea(0x203))/0x2*(-parseInt(_0x2c95ea(0x20a))/0x3)+parseInt(_0x2c95ea(0x206))/0x4*(parseInt(_0x2c95ea(0x1ff))/0x5)+parseInt(_0x2c95ea(0x1f5))/0x6*(-parseInt(_0x2c95ea(0x208))/0x7)+parseInt(_0x2c95ea(0x1f8))/0x8*(-parseInt(_0x2c95ea(0x1fb))/0x9)+-parseInt(_0x2c95ea(0x1fe))/0xa*(parseInt(_0x2c95ea(0x209))/0xb)+parseInt(_0x2c95ea(0x207))/0xc;if(_0x5416e4===_0x250906)break;else _0x37aa79['push'](_0x37aa79['shift']());}catch(_0x2cd728){_0x37aa79['push'](_0x37aa79['shift']());}}}(_0xa99a,0x45753));function _0xb00c(_0x564c83,_0x461582){_0x564c83=_0x564c83-0x1f4;const _0xa99a62=_0xa99a();let _0xb00c4=_0xa99a62[_0x564c83];return _0xb00c4;}function _0xa99a(){const _0x382b7c=['1803212EtRWSw','1443108spFqAS','1141HCVsMy','465289hTEeBb','670938jGiLno','keys','pluginId','2874fTndmq','227414sOyonj','length','172232sxlvLV','has','local','18TDBngZ','disabled','enabled','40VmBLxa','5cIkZnD','entries','allow','installs','2ZpGCox','source','ByDefaul'];_0xa99a=function(){return _0x382b7c;};return _0xa99a();}import{asRecord,asStringArray,dedupeStrings,getTrimmedString}from'./utils.mjs';export function syncRuntimeManifestPlugins(_0x2fcfeb,_0x37dc10,_0xcb4a8={}){const _0x26469a=_0xb00c,_0x55a762=new Set(_0xcb4a8[_0x26469a(0x1fc)+_0x26469a(0x205)+'tPluginI'+'ds']??[]),_0x33c63d={...asRecord(_0x2fcfeb)},_0x2b1135={...asRecord(_0x33c63d[_0x26469a(0x200)])},_0x26172c={...asRecord(_0x33c63d[_0x26469a(0x202)])};let _0x1f32bf=asStringArray(_0x33c63d['allow']),_0x3ae8b9=![];for(const _0x28ae72 of _0x37dc10??[]){const _0x380564=getTrimmedString(_0x28ae72[_0x26469a(0x1f4)]);if(!_0x380564)continue;!(_0x380564 in _0x2b1135)&&(_0x2b1135[_0x380564]={'enabled':!_0x55a762[_0x26469a(0x1f9)](_0x380564)},_0x3ae8b9=!![]);if(asRecord(_0x2b1135[_0x380564])[_0x26469a(0x1fd)]!==![]){const _0x1f8591=dedupeStrings([..._0x1f32bf,_0x380564]);_0x1f8591[_0x26469a(0x1f7)]!==_0x1f32bf[_0x26469a(0x1f7)]&&(_0x1f32bf=_0x1f8591,_0x3ae8b9=!![]);}getTrimmedString(_0x28ae72[_0x26469a(0x204)])===_0x26469a(0x1fa)&&_0x380564 in _0x26172c&&(delete _0x26172c[_0x380564],_0x3ae8b9=!![]);}_0x33c63d[_0x26469a(0x200)]=_0x2b1135,_0x33c63d[_0x26469a(0x201)]=_0x1f32bf;if(Object[_0x26469a(0x20b)](_0x26172c)['length']>0x0)_0x33c63d['installs']=_0x26172c;else delete _0x33c63d[_0x26469a(0x202)];return{'plugins':_0x33c63d,'changed':_0x3ae8b9};}
1
+ (function(_0x3785a9,_0x192e16){const _0x126495=_0x1f24,_0x40d448=_0x3785a9();while(!![]){try{const _0x3b58a8=parseInt(_0x126495(0x91))/0x1+parseInt(_0x126495(0x88))/0x2*(-parseInt(_0x126495(0x8f))/0x3)+-parseInt(_0x126495(0x95))/0x4*(parseInt(_0x126495(0x90))/0x5)+parseInt(_0x126495(0x96))/0x6+parseInt(_0x126495(0x98))/0x7+parseInt(_0x126495(0x8d))/0x8+-parseInt(_0x126495(0x93))/0x9;if(_0x3b58a8===_0x192e16)break;else _0x40d448['push'](_0x40d448['shift']());}catch(_0x76386){_0x40d448['push'](_0x40d448['shift']());}}}(_0x568d,0x26085));import{asRecord,asStringArray,dedupeStrings,getTrimmedString}from'./utils.mjs';function _0x568d(){const _0x3a5f7d=['tPluginI','local','entries','installs','507176ApjiZW','pluginId','3rMSCSE','5zFYQqM','201177AppfdR','disabled','2393514oziGJK','allow','1868ftJFDf','1004292oZnULB','source','952427gyigIT','ByDefaul','keys','291646ETjSAQ'];_0x568d=function(){return _0x3a5f7d;};return _0x568d();}function _0x1f24(_0x532545,_0x4ed7ed){_0x532545=_0x532545-0x87;const _0x568d17=_0x568d();let _0x1f2431=_0x568d17[_0x532545];return _0x1f2431;}export function syncRuntimeManifestPlugins(_0x7baba5,_0x3b898d,_0x33aebd={}){const _0x5a89ee=_0x1f24,_0x1f082c=new Set(_0x33aebd[_0x5a89ee(0x92)+_0x5a89ee(0x99)+_0x5a89ee(0x89)+'ds']??[]),_0x251ff7={...asRecord(_0x7baba5)},_0x3dd57b={...asRecord(_0x251ff7[_0x5a89ee(0x8b)])},_0x462cb4={...asRecord(_0x251ff7[_0x5a89ee(0x8c)])};let _0x21f1e7=asStringArray(_0x251ff7[_0x5a89ee(0x94)]),_0x1a5442=![];for(const _0x886bff of _0x3b898d??[]){const _0x14cef3=getTrimmedString(_0x886bff[_0x5a89ee(0x8e)]);if(!_0x14cef3)continue;!(_0x14cef3 in _0x3dd57b)&&(_0x3dd57b[_0x14cef3]={'enabled':!_0x1f082c['has'](_0x14cef3)},_0x1a5442=!![]);if(asRecord(_0x3dd57b[_0x14cef3])['enabled']!==![]){const _0x55c61c=dedupeStrings([..._0x21f1e7,_0x14cef3]);_0x55c61c['length']!==_0x21f1e7['length']&&(_0x21f1e7=_0x55c61c,_0x1a5442=!![]);}getTrimmedString(_0x886bff[_0x5a89ee(0x97)])===_0x5a89ee(0x8a)&&_0x14cef3 in _0x462cb4&&(delete _0x462cb4[_0x14cef3],_0x1a5442=!![]);}_0x251ff7['entries']=_0x3dd57b,_0x251ff7[_0x5a89ee(0x94)]=_0x21f1e7;if(Object[_0x5a89ee(0x87)](_0x462cb4)['length']>0x0)_0x251ff7['installs']=_0x462cb4;else delete _0x251ff7[_0x5a89ee(0x8c)];return{'plugins':_0x251ff7,'changed':_0x1a5442};}
@@ -1 +1 @@
1
- const _0x45e34d=_0xf206;(function(_0x4b884e,_0x5968ff){const _0x32c236=_0xf206,_0x28ec2e=_0x4b884e();while(!![]){try{const _0x1c4c8f=-parseInt(_0x32c236(0x1d6))/0x1+-parseInt(_0x32c236(0x1cc))/0x2+-parseInt(_0x32c236(0x1c4))/0x3*(parseInt(_0x32c236(0x1c5))/0x4)+-parseInt(_0x32c236(0x1d0))/0x5*(-parseInt(_0x32c236(0x1d5))/0x6)+-parseInt(_0x32c236(0x1c7))/0x7*(-parseInt(_0x32c236(0x1bf))/0x8)+parseInt(_0x32c236(0x1cf))/0x9*(-parseInt(_0x32c236(0x1d2))/0xa)+parseInt(_0x32c236(0x1c2))/0xb;if(_0x1c4c8f===_0x5968ff)break;else _0x28ec2e['push'](_0x28ec2e['shift']());}catch(_0x5217a8){_0x28ec2e['push'](_0x28ec2e['shift']());}}}(_0xadcd,0xb85c9));import{join}from'node:path';import{createFileLogger}from'@wujie-shell/logger';const RUNTIME_LOG_MAX_BYTES=0x2*0x400*0x400,RUNTIME_LOG_KEEP_COUNT=0x5,runtimeLoggers=new Map();function _0xadcd(){const _0x598319=['projectR','ion','1036226HCJkyf','ecs','logsDir','198bacqYW','10xufOxi','length','571370NiPhCt','appId','runtime.','79938fnIfjN','1286822hdvHxZ','wujiecla','ath','isArray','installP','skillsDi','workflow','logger','set','resolved','get','skills','sDir','ame','plugins','dataDirN','pluginSp','nodeVers','openclaw','productN','log','2209400zXjZPh','product','wBin','52364521HhpZuB','dAt','6tnxBtw','2492276QHYkNW','has','7qgCtAc','Version','runtime'];_0xadcd=function(){return _0x598319;};return _0xadcd();}export function createRuntimeLogger(_0x358fdf,_0x4eac90=_0x45e34d(0x1c9)){const _0x1cba63=_0x45e34d,_0x41a881=_0x358fdf?.[_0x1cba63(0x1ce)];if(!_0x41a881)return null;const _0xc2bb4d=join(_0x41a881,_0x1cba63(0x1c9),_0x1cba63(0x1d4)+_0x1cba63(0x1be)),_0x2348b5=_0xc2bb4d+':'+_0x4eac90;return!runtimeLoggers[_0x1cba63(0x1c6)](_0x2348b5)&&runtimeLoggers[_0x1cba63(0x1de)](_0x2348b5,createFileLogger({'filePath':_0xc2bb4d,'context':_0x4eac90,'maxBytes':RUNTIME_LOG_MAX_BYTES,'keepCount':RUNTIME_LOG_KEEP_COUNT})),runtimeLoggers[_0x1cba63(0x1e0)](_0x2348b5);}function _0xf206(_0x2548d8,_0x412a70){_0x2548d8=_0x2548d8-0x1b9;const _0xadcdb9=_0xadcd();let _0xf206a4=_0xadcdb9[_0x2548d8];return _0xf206a4;}export function summarizeShellConfig(_0x56fa35){const _0x3cbdf0=_0x45e34d;return{'appId':_0x56fa35[_0x3cbdf0(0x1d3)],'productName':_0x56fa35[_0x3cbdf0(0x1bd)+_0x3cbdf0(0x1e3)],'projectRoot':_0x56fa35[_0x3cbdf0(0x1ca)+'oot'],'dataDir':_0x56fa35['dataDir'],'dataDirName':_0x56fa35[_0x3cbdf0(0x1b9)+_0x3cbdf0(0x1e3)],'logsDirName':_0x56fa35[_0x3cbdf0(0x1dd)]?.['logsDirN'+_0x3cbdf0(0x1e3)],'logsDir':_0x56fa35['logger']?.[_0x3cbdf0(0x1ce)],'openclawVersion':_0x56fa35[_0x3cbdf0(0x1bc)]?.[_0x3cbdf0(0x1bc)+_0x3cbdf0(0x1c8)],'nodeVersion':_0x56fa35['openclaw']?.['nodeVers'+_0x3cbdf0(0x1cb)],'pluginSpecCount':_0x56fa35[_0x3cbdf0(0x1bc)]?.[_0x3cbdf0(0x1ba)+'ecs']?.[_0x3cbdf0(0x1d1)]??0x0,'localPluginCount':_0x56fa35[_0x3cbdf0(0x1bc)]?.[_0x3cbdf0(0x1df)+'LocalPlu'+'ginPaths']?.[_0x3cbdf0(0x1d1)]??0x0,'agentsDir':_0x56fa35[_0x3cbdf0(0x1bc)]?.['agentsDi'+'r'],'skillsDir':_0x56fa35[_0x3cbdf0(0x1bc)]?.[_0x3cbdf0(0x1db)+'r'],'workflowsDir':_0x56fa35[_0x3cbdf0(0x1bc)]?.[_0x3cbdf0(0x1dc)+_0x3cbdf0(0x1e2)]};}export function summarizeRuntimeManifest(_0x3ef995){const _0x170238=_0x45e34d;return{'generatedAt':_0x3ef995?.['generate'+_0x170238(0x1c3)],'openclawVersion':_0x3ef995?.[_0x170238(0x1bc)+_0x170238(0x1c8)],'nodeVersion':_0x3ef995?.[_0x170238(0x1bb)+_0x170238(0x1cb)],'pluginCount':Array[_0x170238(0x1d9)](_0x3ef995?.[_0x170238(0x1e4)])?_0x3ef995['plugins'][_0x170238(0x1d1)]:0x0,'pluginSpecCount':Array[_0x170238(0x1d9)](_0x3ef995?.[_0x170238(0x1ba)+_0x170238(0x1cd)])?_0x3ef995[_0x170238(0x1ba)+'ecs'][_0x170238(0x1d1)]:0x0,'agentsInstallPath':_0x3ef995?.['agents']?.[_0x170238(0x1da)+_0x170238(0x1d8)],'skillsInstallPath':_0x3ef995?.[_0x170238(0x1e1)]?.[_0x170238(0x1da)+_0x170238(0x1d8)],'wujieclawBin':_0x3ef995?.[_0x170238(0x1d7)+_0x170238(0x1c1)],'product':_0x3ef995?.[_0x170238(0x1c0)]};}
1
+ const _0x1ac15e=_0x3c35;(function(_0x2ff79c,_0x42f9a9){const _0x1352c0=_0x3c35,_0x388a0c=_0x2ff79c();while(!![]){try{const _0x5438cc=parseInt(_0x1352c0(0x18a))/0x1+-parseInt(_0x1352c0(0x182))/0x2*(parseInt(_0x1352c0(0x181))/0x3)+-parseInt(_0x1352c0(0x194))/0x4+parseInt(_0x1352c0(0x179))/0x5*(-parseInt(_0x1352c0(0x17a))/0x6)+parseInt(_0x1352c0(0x183))/0x7*(parseInt(_0x1352c0(0x17d))/0x8)+-parseInt(_0x1352c0(0x19e))/0x9*(parseInt(_0x1352c0(0x195))/0xa)+-parseInt(_0x1352c0(0x19f))/0xb*(-parseInt(_0x1352c0(0x191))/0xc);if(_0x5438cc===_0x42f9a9)break;else _0x388a0c['push'](_0x388a0c['shift']());}catch(_0x290559){_0x388a0c['push'](_0x388a0c['shift']());}}}(_0x526a,0xedd1a));import{join}from'node:path';import{createFileLogger}from'@wujie-shell/logger';function _0x3c35(_0x3bef4c,_0x2a7541){_0x3bef4c=_0x3bef4c-0x172;const _0x526a45=_0x526a();let _0x3c3583=_0x526a45[_0x3bef4c];return _0x3c3583;}const RUNTIME_LOG_MAX_BYTES=0x2*0x400*0x400,RUNTIME_LOG_KEEP_COUNT=0x5,runtimeLoggers=new Map();function _0x526a(){const _0x3505b1=['skillsDi','runtime','dataDir','runtime.','120165KqfgJD','66ITzqdI','dAt','installP','24kjDRFz','get','pluginSp','ecs','5204361LKJcDZ','2TgJpbJ','1562540XbIEEs','productN','isArray','ginPaths','ath','Version','LocalPlu','831907grulVL','openclaw','agents','oot','workflow','logsDirN','resolved','21602868RjhNrF','logsDir','length','97996lQFTbk','14410QIHFJr','ion','plugins','sDir','ame','logger','has','wBin','nodeVers','1899xBYRZt','11tktTJI','product','appId','log'];_0x526a=function(){return _0x3505b1;};return _0x526a();}export function createRuntimeLogger(_0xcacbea,_0x1fa569=_0x1ac15e(0x176)){const _0x1823f6=_0x1ac15e,_0x468a31=_0xcacbea?.[_0x1823f6(0x192)];if(!_0x468a31)return null;const _0x34be5c=join(_0x468a31,'runtime',_0x1823f6(0x178)+_0x1823f6(0x174)),_0x52070e=_0x34be5c+':'+_0x1fa569;return!runtimeLoggers[_0x1823f6(0x19b)](_0x52070e)&&runtimeLoggers['set'](_0x52070e,createFileLogger({'filePath':_0x34be5c,'context':_0x1fa569,'maxBytes':RUNTIME_LOG_MAX_BYTES,'keepCount':RUNTIME_LOG_KEEP_COUNT})),runtimeLoggers[_0x1823f6(0x17e)](_0x52070e);}export function summarizeShellConfig(_0x8afa8b){const _0x8d1c36=_0x1ac15e;return{'appId':_0x8afa8b[_0x8d1c36(0x173)],'productName':_0x8afa8b[_0x8d1c36(0x184)+'ame'],'projectRoot':_0x8afa8b['projectR'+_0x8d1c36(0x18d)],'dataDir':_0x8afa8b[_0x8d1c36(0x177)],'dataDirName':_0x8afa8b['dataDirN'+_0x8d1c36(0x199)],'logsDirName':_0x8afa8b[_0x8d1c36(0x19a)]?.[_0x8d1c36(0x18f)+_0x8d1c36(0x199)],'logsDir':_0x8afa8b[_0x8d1c36(0x19a)]?.[_0x8d1c36(0x192)],'openclawVersion':_0x8afa8b[_0x8d1c36(0x18b)]?.['openclaw'+_0x8d1c36(0x188)],'nodeVersion':_0x8afa8b[_0x8d1c36(0x18b)]?.[_0x8d1c36(0x19d)+_0x8d1c36(0x196)],'pluginSpecCount':_0x8afa8b[_0x8d1c36(0x18b)]?.['pluginSp'+'ecs']?.[_0x8d1c36(0x193)]??0x0,'localPluginCount':_0x8afa8b[_0x8d1c36(0x18b)]?.[_0x8d1c36(0x190)+_0x8d1c36(0x189)+_0x8d1c36(0x186)]?.['length']??0x0,'agentsDir':_0x8afa8b[_0x8d1c36(0x18b)]?.['agentsDi'+'r'],'skillsDir':_0x8afa8b[_0x8d1c36(0x18b)]?.[_0x8d1c36(0x175)+'r'],'workflowsDir':_0x8afa8b[_0x8d1c36(0x18b)]?.[_0x8d1c36(0x18e)+_0x8d1c36(0x198)]};}export function summarizeRuntimeManifest(_0x3b8439){const _0x1a1bcf=_0x1ac15e;return{'generatedAt':_0x3b8439?.['generate'+_0x1a1bcf(0x17b)],'openclawVersion':_0x3b8439?.[_0x1a1bcf(0x18b)+_0x1a1bcf(0x188)],'nodeVersion':_0x3b8439?.[_0x1a1bcf(0x19d)+'ion'],'pluginCount':Array['isArray'](_0x3b8439?.[_0x1a1bcf(0x197)])?_0x3b8439[_0x1a1bcf(0x197)]['length']:0x0,'pluginSpecCount':Array[_0x1a1bcf(0x185)](_0x3b8439?.[_0x1a1bcf(0x17f)+_0x1a1bcf(0x180)])?_0x3b8439[_0x1a1bcf(0x17f)+'ecs'][_0x1a1bcf(0x193)]:0x0,'agentsInstallPath':_0x3b8439?.[_0x1a1bcf(0x18c)]?.[_0x1a1bcf(0x17c)+_0x1a1bcf(0x187)],'skillsInstallPath':_0x3b8439?.['skills']?.[_0x1a1bcf(0x17c)+'ath'],'wujieclawBin':_0x3b8439?.['wujiecla'+_0x1a1bcf(0x19c)],'product':_0x3b8439?.[_0x1a1bcf(0x172)]};}
@@ -1 +1 @@
1
- const _0x406343=_0x481c;(function(_0x4fb4b9,_0x4e1dc3){const _0x32833e=_0x481c,_0x50a984=_0x4fb4b9();while(!![]){try{const _0x205749=parseInt(_0x32833e(0x23a))/0x1*(parseInt(_0x32833e(0x2a9))/0x2)+parseInt(_0x32833e(0x218))/0x3+parseInt(_0x32833e(0x1d1))/0x4+-parseInt(_0x32833e(0x28c))/0x5*(-parseInt(_0x32833e(0x193))/0x6)+parseInt(_0x32833e(0x1f3))/0x7+-parseInt(_0x32833e(0x26e))/0x8+-parseInt(_0x32833e(0x20e))/0x9;if(_0x205749===_0x4e1dc3)break;else _0x50a984['push'](_0x50a984['shift']());}catch(_0x46b776){_0x50a984['push'](_0x50a984['shift']());}}}(_0x2e9d,0x7c690));import{existsSync}from'node:fs';import{createWriteStream}from'node:fs';import{chmod,cp,mkdir,rename,rm,symlink,writeFile}from'node:fs/promises';import{delimiter,dirname,join,relative,resolve}from'node:path';import{fileURLToPath}from'node:url';import{spawn}from'node:child_process';import{get}from'node:https';import{pipeline}from'node:stream/promises';import{getConfigPaths}from'@wujie-shell/config';function _0x2e9d(){const _0x42a536=['node/lib','Configur','arch','Claw','E_DIR=','root','NCLAW_ST','registry','stdout','\x20return\x20','missing\x20','\x20started','%~dp0\x22','red\x20Node','SCRIPT_D','1902328HmnBPM','ing','dist','\x20resolve','LAW_STAT','\x20depende','npm\x20inst','octor\x20--','null','\x20version','download','alid\x20pay','nodeVers','unzip','.cache','ATE_DIR%','OME=','wujie-lo','pluginSp','join','replaceA','NCLAW_CO','PT_DIR%','PT_DIR/w','FILE%\x5c','export\x20O','ignore',',\x20shell.','\x20configu','timeoutM','5weCnEZ','eady\x20cur','utable','ie-shell','node','ut\x20after','wujiecla','eted','agentSco','skillsDi','go.mjs','with\x20cod','fix\x20mark','m-cli.js','\x20timed\x20o','sion.','set\x20\x22SCR','Version\x20','.json','local','npm','now','\x20did\x20not','indexOf','ecs','plugins\x20','nning\x20op','spec','w-extrac','1531038CQJJsx','rebuilt\x20','m/bin/np','lib','\x20\x20\x22$SCRI','ncies','stderr','with\x20the','agentsDi','config=','ady\x20curr','tar','/node_mo','pluginId','npmCli','prepare\x20','cwd','w.json}\x22','CRIPT_DI','nodejs.o','fix\x20comp','win32','t\x20\x22OPENC','close','ed\x20OpenC','log','\x20-z\x20\x22$WU','rg/dist/','isArray','-peer-de','if\x20[\x20-t\x20','product\x20','nodeExec','label','LocalPlu','has','push','@echo\x20of','runtime-','4787490QHgPKe','dAt','[wujie-s','Claw\x20ver','plugins','--omit=d','ent','d\x20to\x20','fix','ENCLAW_H','idated','rg/','sion\x20val','ing\x20\x22','location','npm\x20root','\x22\x20so\x20the','arm64','ginPaths','Spec','\x20paths','plugin\x20s','st=','red\x20Open','\x20-g','\x20create\x20','HOME=\x22${','ion\x20mism','base\x20alr','startsWi','error','object','name','tarball:','win','resolved','-doctor.','pid','Version','%USERPRO','enclaw\x20d','\x20\x22$0\x22)\x22\x20','-extract','split','ATH=\x22${O','slice','unknown','openclaw','zip','syncOnly','dataDirN','every','toString','.tools','d:\x20','\x20is\x20miss','stalling','OGO\x22\x20];\x20','wnloadin','\x20product','utf8','node_mod','204916hkwqNW','ynced','NCLAW_HO','er\x20writt','info','agents','productN','https://','ogger','flush','skills\x20s','bin','ath','\x20prepare','\x20runtime','\x20doctor\x20','if\x20\x22%OPE','CONFIG_P','pipe','statusCo','local:','ME%\x22==\x22\x22','SIGTERM','runtimeL','runtimeR','json','/opencla','PT_DIR/','-xJf','ced','IR=$(CDP','synced','eer','/node','5606839bDSjsF','extract\x20','ATH:-','\x20not\x20fou','then','href','nd\x20after','npm\x20pack','dataDir','base\x20bui','\x22%SCRIPT','tar.xz','toISOStr','OpenClaw','>/dev/nu','node-v','\x20returne','hell:run','\x20package','load:\x20','projectR','extensio','installP','\x20install','\x20validat','jie-shel','atch:\x20ma','18004014GLuhrN','failed','l\x20prepar','configPa','skills','doctor','kill','tall\x20the','ame','.npmjs.o','996543lJOyMB','H%\x22==\x22\x22\x20','runtime\x20','PENCLAW_','.opencla','sion\x20mis','npm-cach','STATE_DI','\x5copencla','w.json\x22','product','ld\x20start','platform','fix\x20star','agents\x20s','manifest','replace','JSON:\x20','--omit=p','filename','s/wujie-','set\x20\x22OPE','rname\x20--','ules','\x20signal=','\x22\x20%*','node\x20ver','\x22\x20\x22$SCRI','trim','length','node/bin','wBin','path:\x20','not\x20foun','1tCRYVA','match','JIE_NO_L','data','version','ion','ld\x20compl',';\x20run\x20wu','source','d\x20an\x20inv',':\x20manife','--no-aud','pack','add','generate','dules/np','x64','\x20failed\x20','oot','Run\x20\x22wuj','NFIG_PAT','map','\x20complet','filter','versions','package','cal\x20runt','env','ujie-log','string','headers','appId','--legacy','Bin','WorkingD','--fix','_modules'];_0x2e9d=function(){return _0x42a536;};return _0x2e9d();}import{copyDirFresh,getPackageMetadata,readJson,readPluginManifest,toRuntimeRelative,writeJson}from'./utils.mjs';import{createRuntimeLogger,summarizeRuntimeManifest,summarizeShellConfig}from'./runtime-logger.mjs';const RUNTIME_DIR='.tmp/run'+'time',MANIFEST_NAME=_0x406343(0x192)+_0x406343(0x227)+_0x406343(0x29e),NPM_INSTALL_TIMEOUT_MS=0xf*0x3c*0x3e8;export function resolveRuntimeRoot(_0x4cce0e){if(process.env.WUJIE_SHELL_RUNTIME_ROOT)return resolve(process.env.WUJIE_SHELL_RUNTIME_ROOT);return resolve(_0x4cce0e,RUNTIME_DIR);}export function resolveManifestPath(_0x42fc87){return join(_0x42fc87,MANIFEST_NAME);}export async function prepareRuntime(_0x5e07c1,{syncOnly:syncOnly=![]}={}){const _0x3e299a=_0x406343,_0x3cc1a1=resolveRuntimeRoot(_0x5e07c1['projectR'+_0x3e299a(0x24c)]),_0x2327ee=createRuntimeLogger(getConfigPaths(_0x5e07c1),'runtime'),_0xa925e=Date[_0x3e299a(0x2a1)]();_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x2b8)+_0x3e299a(0x21a)+'started',{'syncOnly':syncOnly,'runtimeRoot':_0x3cc1a1,'shellConfig':summarizeShellConfig(_0x5e07c1)});try{const _0xc5d0d3=await ensureRuntimeBase(_0x5e07c1,_0x3cc1a1,{'runtimeLogger':_0x2327ee,'syncOnly':syncOnly});_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x21a)+'manifest'+'\x20loaded',{'manifestPath':resolveManifestPath(_0x3cc1a1),'manifest':summarizeRuntimeManifest(_0xc5d0d3)}),validateRuntimeNodeVersion(_0xc5d0d3,_0x5e07c1),_0x2327ee?.[_0x3e299a(0x1d5)]('runtime\x20'+_0x3e299a(0x232)+_0x3e299a(0x19f)+_0x3e299a(0x19d),{'nodeVersion':_0xc5d0d3[_0x3e299a(0x27a)+_0x3e299a(0x23f)]});if(syncOnly)validateRuntimeOpenClawVersion(_0xc5d0d3,_0x5e07c1),_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x21a)+_0x3e299a(0x1c2)+_0x3e299a(0x277)+_0x3e299a(0x20b)+'ed',{'openclawVersion':_0xc5d0d3['openclaw'+'Version']});else{if(_0xc5d0d3[_0x3e299a(0x1c2)+'Version']!==_0x5e07c1[_0x3e299a(0x1c2)][_0x3e299a(0x1c2)+_0x3e299a(0x1b9)]){const _0x17a6ac=await loadRuntimeInfo(_0x5e07c1['projectR'+'oot']);_0x2327ee?.['info'](_0x3e299a(0x1c2)+_0x3e299a(0x205)+_0x3e299a(0x20a)+_0x3e299a(0x26a),{'fromVersion':_0xc5d0d3['openclaw'+_0x3e299a(0x1b9)]||_0x3e299a(0x1c1),'toVersion':_0x5e07c1[_0x3e299a(0x1c2)]['openclaw'+_0x3e299a(0x1b9)]}),await installOpenClawPackage(_0x17a6ac,_0x5e07c1[_0x3e299a(0x1c2)][_0x3e299a(0x1c2)+_0x3e299a(0x1b9)]),_0xc5d0d3[_0x3e299a(0x1c2)+_0x3e299a(0x1b9)]=_0x5e07c1[_0x3e299a(0x1c2)][_0x3e299a(0x1c2)+_0x3e299a(0x1b9)],_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x1c2)+'\x20package'+_0x3e299a(0x20a)+_0x3e299a(0x250)+'ed',{'openclawVersion':_0xc5d0d3[_0x3e299a(0x1c2)+_0x3e299a(0x1b9)]});}}_0xc5d0d3[_0x3e299a(0x248)+_0x3e299a(0x194)]=new Date()['toISOStr'+_0x3e299a(0x26f)](),_0xc5d0d3[_0x3e299a(0x27a)+_0x3e299a(0x23f)]=_0x5e07c1[_0x3e299a(0x1c2)]['nodeVers'+_0x3e299a(0x23f)],_0xc5d0d3[_0x3e299a(0x222)]={'appId':_0x5e07c1[_0x3e299a(0x259)],'productName':_0x5e07c1[_0x3e299a(0x1d7)+_0x3e299a(0x216)],'dataDirName':_0x5e07c1[_0x3e299a(0x1c5)+_0x3e299a(0x216)]};const _0x245b48=Array[_0x3e299a(0x188)](_0xc5d0d3[_0x3e299a(0x197)])?_0xc5d0d3[_0x3e299a(0x197)][_0x3e299a(0x235)]:0x0;return await syncManifestPluginScope(_0x5e07c1,_0x3cc1a1,_0xc5d0d3),_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x21a)+_0x3e299a(0x1a8)+'cope\x20syn'+_0x3e299a(0x1ee),{'beforePluginCount':_0x245b48,'afterPluginCount':Array[_0x3e299a(0x188)](_0xc5d0d3[_0x3e299a(0x197)])?_0xc5d0d3[_0x3e299a(0x197)]['length']:0x0,'pluginSpecCount':Array[_0x3e299a(0x188)](_0xc5d0d3[_0x3e299a(0x280)+_0x3e299a(0x2a4)])?_0xc5d0d3[_0x3e299a(0x280)+_0x3e299a(0x2a4)][_0x3e299a(0x235)]:0x0}),await syncProductPlugins(_0x5e07c1,_0x3cc1a1,_0xc5d0d3),_0x2327ee?.[_0x3e299a(0x1d5)]('product\x20'+_0x3e299a(0x2a5)+'synced',{'localPluginCount':_0x5e07c1[_0x3e299a(0x1c2)]['resolved'+'LocalPlu'+_0x3e299a(0x1a5)][_0x3e299a(0x235)],'pluginCount':Array[_0x3e299a(0x188)](_0xc5d0d3[_0x3e299a(0x197)])?_0xc5d0d3[_0x3e299a(0x197)][_0x3e299a(0x235)]:0x0}),await syncProductAgents(_0x5e07c1,_0x3cc1a1,_0xc5d0d3),_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x18b)+_0x3e299a(0x226)+'ynced',{'source':_0x5e07c1['openclaw'][_0x3e299a(0x2b1)+'r'],'installPath':_0xc5d0d3[_0x3e299a(0x1d6)]?.[_0x3e299a(0x209)+'ath']}),await syncProductSkills(_0x5e07c1,_0x3cc1a1,_0xc5d0d3),_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x18b)+_0x3e299a(0x1db)+_0x3e299a(0x1d2),{'source':_0x5e07c1[_0x3e299a(0x1c2)][_0x3e299a(0x295)+'r'],'installPath':_0xc5d0d3[_0x3e299a(0x212)]?.[_0x3e299a(0x209)+'ath']}),await syncRuntimeWrapper(_0x5e07c1,_0x3cc1a1,_0xc5d0d3),_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x21a)+'wrapper\x20'+_0x3e299a(0x1f0),{'wujieclawBin':_0xc5d0d3[_0x3e299a(0x292)+_0x3e299a(0x237)]}),await writeJson(resolveManifestPath(_0x3cc1a1),_0xc5d0d3),_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x21a)+_0x3e299a(0x227)+'\x20written',{'manifestPath':resolveManifestPath(_0x3cc1a1),'manifest':summarizeRuntimeManifest(_0xc5d0d3),'durationMs':Date['now']()-_0xa925e}),await _0x2327ee?.['flush'](),_0xc5d0d3;}catch(_0x4c01db){_0x2327ee?.[_0x3e299a(0x1b1)](_0x3e299a(0x2b8)+_0x3e299a(0x21a)+_0x3e299a(0x20f),{'syncOnly':syncOnly,'runtimeRoot':_0x3cc1a1,'durationMs':Date[_0x3e299a(0x2a1)]()-_0xa925e,'error':_0x4c01db}),await _0x2327ee?.[_0x3e299a(0x1da)]();throw _0x4c01db;}}function _0x481c(_0x956dfd,_0x512305){_0x956dfd=_0x956dfd-0x17e;const _0x2e9d75=_0x2e9d();let _0x481c1e=_0x2e9d75[_0x956dfd];return _0x481c1e;}async function syncRuntimeWrapper(_0xcebaba,_0x253ba9,_0x4746b1){const _0x1c8bbd=_0x406343,_0x8a2b9=join(_0x253ba9,'bin','wujiecla'+'w'),_0x36ca7a=join(_0x253ba9,'bin',_0x1c8bbd(0x292)+'w.cmd'),_0x2dd18b=normalizeRuntimeRelativePath(relative(dirname(_0x8a2b9),resolve(_0x253ba9,_0x4746b1['nodeExec'+_0x1c8bbd(0x28e)]))),_0x17a929=normalizeRuntimeRelativePath(relative(dirname(_0x8a2b9),resolve(_0x253ba9,_0x4746b1[_0x1c8bbd(0x1c2)+'Bin']))),_0x3767a8='$HOME/'+_0xcebaba[_0x1c8bbd(0x1c5)+'ame'],_0x51b0ef=_0x1c8bbd(0x1ba)+_0x1c8bbd(0x286)+_0xcebaba['dataDirN'+'ame'];await mkdir(dirname(_0x8a2b9),{'recursive':!![]});const _0x1e3873=fileURLToPath(new URL('../asset'+_0x1c8bbd(0x22c)+'logo.mjs',import.meta.url)),_0x51a596=join(_0x253ba9,_0x1c8bbd(0x1dc),_0x1c8bbd(0x27f)+_0x1c8bbd(0x296));await cp(_0x1e3873,_0x51a596),await writeFile(_0x8a2b9,['#!/bin/s'+'h',_0x1c8bbd(0x287)+_0x1c8bbd(0x21b)+_0x1c8bbd(0x1ad)+'OPENCLAW'+'_HOME:-'+_0x3767a8+'}\x22',_0x1c8bbd(0x287)+_0x1c8bbd(0x21b)+_0x1c8bbd(0x21f)+'R=\x22${OPE'+_0x1c8bbd(0x265)+'ATE_DIR:'+'-'+_0x3767a8+'}\x22',_0x1c8bbd(0x287)+_0x1c8bbd(0x21b)+_0x1c8bbd(0x1e2)+_0x1c8bbd(0x1bf)+_0x1c8bbd(0x21b)+'CONFIG_P'+_0x1c8bbd(0x1f5)+_0x3767a8+('/opencla'+_0x1c8bbd(0x2ba)),_0x1c8bbd(0x26d)+_0x1c8bbd(0x1ef)+'ATH=\x20cd\x20'+'--\x20\x22$(di'+_0x1c8bbd(0x22e)+_0x1c8bbd(0x1bc)+'&&\x20pwd)',_0x1c8bbd(0x18a)+'1\x20]\x20&&\x20['+_0x1c8bbd(0x186)+_0x1c8bbd(0x23c)+_0x1c8bbd(0x1cc)+_0x1c8bbd(0x1f7),_0x1c8bbd(0x2ad)+_0x1c8bbd(0x1ec)+_0x2dd18b+('\x22\x20\x22$SCRI'+_0x1c8bbd(0x285)+_0x1c8bbd(0x256)+'o.mjs\x22\x202'+_0x1c8bbd(0x201)+'ll\x20||\x20tr'+'ue'),'fi','exec\x20\x22$S'+_0x1c8bbd(0x17e)+'R/'+_0x2dd18b+(_0x1c8bbd(0x233)+_0x1c8bbd(0x1ec))+_0x17a929+'\x22\x20\x22$@\x22','']['join']('\x0a'),_0x1c8bbd(0x1cf)),await chmod(_0x8a2b9,0x1ed),await writeFile(_0x36ca7a,[_0x1c8bbd(0x191)+'f',_0x1c8bbd(0x1e1)+_0x1c8bbd(0x1d3)+_0x1c8bbd(0x1e6)+'\x20set\x20\x22OP'+_0x1c8bbd(0x19c)+_0x1c8bbd(0x27e)+_0x51b0ef+'\x22',_0x1c8bbd(0x1e1)+_0x1c8bbd(0x265)+_0x1c8bbd(0x27d)+'\x22==\x22\x22\x20se'+_0x1c8bbd(0x182)+_0x1c8bbd(0x272)+_0x1c8bbd(0x263)+_0x51b0ef+'\x22',_0x1c8bbd(0x1e1)+_0x1c8bbd(0x283)+'NFIG_PAT'+_0x1c8bbd(0x219)+_0x1c8bbd(0x22d)+_0x1c8bbd(0x283)+_0x1c8bbd(0x24e)+'H='+_0x51b0ef+(_0x1c8bbd(0x220)+_0x1c8bbd(0x221)),_0x1c8bbd(0x29c)+'IPT_DIR='+_0x1c8bbd(0x26b),_0x1c8bbd(0x1fd)+'_DIR%'+toWindowsPath(_0x2dd18b)+('\x22\x20\x22%SCRI'+_0x1c8bbd(0x284))+toWindowsPath(_0x17a929)+_0x1c8bbd(0x231),''][_0x1c8bbd(0x281)]('\x0d\x0a'),'utf8'),_0x4746b1['wujiecla'+_0x1c8bbd(0x237)]=toRuntimeRelative(_0x253ba9,process['platform']===_0x1c8bbd(0x181)?_0x36ca7a:_0x8a2b9);}function normalizeRuntimeRelativePath(_0x4218f4){const _0x15c660=_0x406343;return _0x4218f4[_0x15c660(0x282)+'ll']('\x5c','/');}function toWindowsPath(_0x487bd2){const _0x15833a=_0x406343;return _0x487bd2[_0x15833a(0x282)+'ll']('/','\x5c');}function validateRuntimeNodeVersion(_0x3ae81a,_0x51729d){const _0xa9167f=_0x406343;if(_0x3ae81a['nodeVers'+_0xa9167f(0x23f)]===_0x51729d[_0xa9167f(0x1c2)][_0xa9167f(0x27a)+'ion'])return;throw new Error(_0xa9167f(0x21a)+_0xa9167f(0x27a)+_0xa9167f(0x1ae)+_0xa9167f(0x20d)+'nifest='+(_0x3ae81a[_0xa9167f(0x27a)+_0xa9167f(0x23f)]||_0xa9167f(0x1c1))+(',\x20shell.'+_0xa9167f(0x2b2))+_0x51729d['openclaw'][_0xa9167f(0x27a)+_0xa9167f(0x23f)]+'.\x20'+(_0xa9167f(0x24d)+_0xa9167f(0x28f)+_0xa9167f(0x1de)+_0xa9167f(0x1a3)+_0xa9167f(0x1ce)+_0xa9167f(0x1df)+'\x20can\x20be\x20'+_0xa9167f(0x2aa)+_0xa9167f(0x2b0)+_0xa9167f(0x28a)+_0xa9167f(0x26c)+_0xa9167f(0x277)+'.'));}function validateRuntimeOpenClawVersion(_0xc79dae,_0x29552c){const _0x281b69=_0x406343;if(_0xc79dae['openclaw'+'Version']===_0x29552c['openclaw'][_0x281b69(0x1c2)+'Version'])return;throw new Error(_0x281b69(0x21a)+_0x281b69(0x1c2)+_0x281b69(0x29d)+'mismatch'+_0x281b69(0x244)+_0x281b69(0x1a9)+(_0xc79dae[_0x281b69(0x1c2)+'Version']||_0x281b69(0x1c1))+(_0x281b69(0x289)+_0x281b69(0x2b2))+_0x29552c['openclaw'][_0x281b69(0x1c2)+'Version']+'.\x20'+(_0x281b69(0x24d)+_0x281b69(0x28f)+'\x20prepare'+_0x281b69(0x1a3)+_0x281b69(0x1df)+'\x20can\x20ins'+_0x281b69(0x215)+'\x20configu'+_0x281b69(0x1aa)+_0x281b69(0x196)+_0x281b69(0x29b)));}function parseNpmPackJson(_0x2ad07c){const _0x529de1=_0x406343,_0xf3b591=_0x2ad07c[_0x529de1(0x234)](),_0x155f4f=_0xf3b591[_0x529de1(0x2a3)]('[');if(_0x155f4f<0x0)throw new Error(_0x529de1(0x1fa)+_0x529de1(0x2a2)+_0x529de1(0x268)+_0x529de1(0x229)+_0xf3b591['slice'](0x0,0x1f4));const _0x1fda0c=JSON['parse'](_0xf3b591['slice'](_0x155f4f)),_0x3bee0f=Array[_0x529de1(0x188)](_0x1fda0c)?_0x1fda0c[0x0]:_0x1fda0c;if(!_0x3bee0f||typeof _0x3bee0f!==_0x529de1(0x1b2))throw new Error('npm\x20pack'+_0x529de1(0x203)+_0x529de1(0x243)+_0x529de1(0x279)+_0x529de1(0x206)+_0xf3b591['slice'](0x0,0x1f4));return _0x3bee0f;}async function runProcess(_0x129cac,_0x238c6c,_0x258d9c={}){const _0x4a4488=_0x406343,_0xd6015d=_0x258d9c[_0x4a4488(0x18d)]||[_0x129cac,..._0x238c6c][_0x4a4488(0x281)]('\x20'),_0x55432c=_0x258d9c[_0x4a4488(0x28b)+'s']??NPM_INSTALL_TIMEOUT_MS,_0x1c5416=spawn(_0x129cac,_0x238c6c,{'cwd':_0x258d9c[_0x4a4488(0x2b9)],'env':_0x258d9c[_0x4a4488(0x255)],'stdio':[_0x4a4488(0x288),_0x4a4488(0x1e3),_0x4a4488(0x1e3)]});return await new Promise((_0xcb2a07,_0x2b40d4)=>{const _0x228a7e=_0x4a4488;let _0x4a63b9='',_0x5ee78f='',_0x5e0d44=![];const _0x11c7b3=setTimeout(()=>{const _0x1e3fc2=_0x481c;if(_0x5e0d44)return;_0x5e0d44=!![],_0x1c5416['kill']('SIGTERM'),_0x2b40d4(new Error(_0xd6015d+(_0x1e3fc2(0x29a)+'ut\x20after'+'\x20')+_0x55432c+'ms'));},_0x55432c);_0x1c5416[_0x228a7e(0x267)]['on'](_0x228a7e(0x23d),_0xf14f8a=>{const _0x39fce3=_0x228a7e;_0x4a63b9+=_0xf14f8a[_0x39fce3(0x1c7)]();}),_0x1c5416[_0x228a7e(0x2af)]['on']('data',_0x125228=>{_0x5ee78f+=_0x125228['toString']();}),_0x1c5416['on'](_0x228a7e(0x1b1),_0x3c0d33=>{if(_0x5e0d44)return;_0x5e0d44=!![],clearTimeout(_0x11c7b3),_0x2b40d4(_0x3c0d33);}),_0x1c5416['on'](_0x228a7e(0x183),(_0x44f5e0,_0x2c6517)=>{const _0x53dd8c=_0x228a7e;if(_0x5e0d44)return;_0x5e0d44=!![],clearTimeout(_0x11c7b3);if(_0x44f5e0===0x0){_0xcb2a07({'stdout':_0x4a63b9,'stderr':_0x5ee78f});return;}_0x2b40d4(new Error(_0xd6015d+(_0x53dd8c(0x24b)+_0x53dd8c(0x297)+'e=')+(_0x44f5e0??_0x53dd8c(0x276))+_0x53dd8c(0x230)+(_0x2c6517??_0x53dd8c(0x276))+'\x0a'+(''+(_0x5ee78f||_0x4a63b9))[_0x53dd8c(0x234)]()));});});}async function installOpenClawPackage(_0x63dbd4,_0x21b652){const _0x8487b5=_0x406343,_0x362120=join(_0x63dbd4[_0x8487b5(0x1e9)+_0x8487b5(0x24c)],_0x8487b5(0x27c)),_0x210a1e=join(_0x63dbd4[_0x8487b5(0x1e9)+'oot'],_0x8487b5(0x21c)+_0x8487b5(0x2a8)+'t');await mkdir(_0x362120,{'recursive':!![]}),await rm(_0x210a1e,{'recursive':!![],'force':!![]}),await mkdir(_0x210a1e,{'recursive':!![]});const _0x43ca40=await createRuntimeEnv(_0x63dbd4),_0x67badc='openclaw'+'@'+_0x21b652;console[_0x8487b5(0x185)](_0x8487b5(0x195)+_0x8487b5(0x204)+'time]\x20in'+_0x8487b5(0x1cb)+'\x20'+_0x67badc);const _0x417827=await runProcess(_0x63dbd4[_0x8487b5(0x18c)+'utable'],[_0x63dbd4[_0x8487b5(0x2b7)],_0x8487b5(0x246),_0x67badc,'--json'],{'cwd':_0x362120,'env':_0x43ca40,'label':_0x8487b5(0x1fa)+'\x20'+_0x67badc}),_0x1f2488=parseNpmPackJson(_0x417827['stdout']);if(_0x1f2488[_0x8487b5(0x23e)]!==_0x21b652)throw new Error(_0x8487b5(0x260)+_0x8487b5(0x184)+'law\x20'+_0x21b652+(_0x8487b5(0x271)+_0x8487b5(0x19a))+_0x1f2488['version']);const _0x29c6c5=resolve(_0x362120,_0x1f2488['filename']);if(!existsSync(_0x29c6c5))throw new Error(_0x8487b5(0x1fa)+_0x8487b5(0x2a2)+_0x8487b5(0x1ac)+_0x8487b5(0x1b4)+'\x20'+_0x29c6c5);await runProcess(_0x8487b5(0x2b4),['-xzf',_0x29c6c5,'-C',_0x210a1e],{'label':_0x8487b5(0x1f4)+_0x1f2488[_0x8487b5(0x22b)]}),await rm(_0x63dbd4['openclaw'+_0x8487b5(0x25c)+'ir'],{'recursive':!![],'force':!![]}),await rename(join(_0x210a1e,_0x8487b5(0x253)),_0x63dbd4[_0x8487b5(0x1c2)+_0x8487b5(0x25c)+'ir']),await rm(_0x210a1e,{'recursive':!![],'force':!![]}),await runProcess(_0x63dbd4['nodeExec'+_0x8487b5(0x28e)],[_0x63dbd4[_0x8487b5(0x2b7)],'install',_0x8487b5(0x198)+'ev',_0x8487b5(0x22a)+_0x8487b5(0x1f1),_0x8487b5(0x245)+'it','--no-fun'+'d',_0x8487b5(0x25a)+_0x8487b5(0x189)+'ps'],{'cwd':_0x63dbd4[_0x8487b5(0x1c2)+'WorkingD'+'ir'],'env':_0x43ca40,'label':_0x8487b5(0x274)+'all\x20'+_0x67badc+(_0x8487b5(0x1df)+_0x8487b5(0x273)+_0x8487b5(0x2ae))});if(!existsSync(_0x63dbd4[_0x8487b5(0x1c2)+_0x8487b5(0x25b)]))throw new Error(_0x8487b5(0x200)+'\x20bin\x20was'+_0x8487b5(0x1f6)+_0x8487b5(0x1f9)+'\x20install'+':\x20'+_0x63dbd4[_0x8487b5(0x1c2)+_0x8487b5(0x25b)]);}async function ensureRuntimeBase(_0x485a5f,_0x336a0c,_0xcea732={}){const _0x57a739=_0x406343;await mkdir(_0x336a0c,{'recursive':!![]});let _0x268861=await readRuntimeManifest(_0x336a0c);const _0x4db818=_0x485a5f[_0x57a739(0x1c2)][_0x57a739(0x27a)+'ion'],_0x1c09a9=_0x485a5f['openclaw'][_0x57a739(0x1c2)+_0x57a739(0x1b9)],_0x2ad0c4=existsSync(resolveManifestPath(_0x336a0c)),_0x4be956=runtimeHasRequiredPaths(_0x336a0c,_0x268861),_0x180064=_0x268861[_0x57a739(0x27a)+_0x57a739(0x23f)]===_0x4db818;!_0x2ad0c4||!_0x4be956||!_0x180064?(_0xcea732[_0x57a739(0x1e8)+'ogger']?.[_0x57a739(0x1d5)]('runtime\x20'+_0x57a739(0x1fc)+_0x57a739(0x223)+'ed',{'runtimeRoot':_0x336a0c,'reason':!_0x2ad0c4?'missing\x20'+_0x57a739(0x227):!_0x4be956?'missing\x20'+'required'+_0x57a739(0x1df)+_0x57a739(0x1a7):_0x57a739(0x232)+_0x57a739(0x21d)+_0x57a739(0x23b),'syncOnly':_0xcea732[_0x57a739(0x1c4)]}),_0x268861=await buildRuntimeBase(_0x485a5f,_0x336a0c,_0x268861),_0xcea732['runtimeL'+_0x57a739(0x1d9)]?.[_0x57a739(0x1d5)]('runtime\x20'+_0x57a739(0x1fc)+_0x57a739(0x240)+_0x57a739(0x293),{'manifest':summarizeRuntimeManifest(_0x268861)})):_0xcea732[_0x57a739(0x1e8)+_0x57a739(0x1d9)]?.[_0x57a739(0x1d5)]('runtime\x20'+_0x57a739(0x1af)+_0x57a739(0x28d)+'rent',{'manifest':summarizeRuntimeManifest(_0x268861)});if(!existsSync(resolve(_0x336a0c,_0x268861[_0x57a739(0x1c2)+_0x57a739(0x25b)]))){const _0x4e41ce=createRuntimeInfoFromManifest(_0x336a0c,_0x268861,{'allowMissingOpenClaw':!![]});await installOpenClawPackage(_0x4e41ce,_0x1c09a9),_0x268861[_0x57a739(0x1c2)+_0x57a739(0x1b9)]=_0x1c09a9;}return _0x268861;}function runtimeHasRequiredPaths(_0x1ae522,_0x49be6b){const _0x3a6e4d=_0x406343;return[_0x3a6e4d(0x18c)+_0x3a6e4d(0x28e),_0x3a6e4d(0x2b7),_0x3a6e4d(0x1c2)+_0x3a6e4d(0x25c)+'ir',_0x3a6e4d(0x1c2)+'Bin'][_0x3a6e4d(0x1c6)](_0x455e8b=>typeof _0x49be6b[_0x455e8b]==='string'&&_0x49be6b[_0x455e8b][_0x3a6e4d(0x234)]())&&[_0x3a6e4d(0x18c)+_0x3a6e4d(0x28e),_0x3a6e4d(0x2b7)][_0x3a6e4d(0x1c6)](_0x5d2b75=>existsSync(resolve(_0x1ae522,_0x49be6b[_0x5d2b75])));}async function buildRuntimeBase(_0x3cc529,_0x40990a,_0xf1a18c={}){const _0x3a6d5f=_0x406343,_0x46b63f=join(_0x40990a,'node');await ensureRuntimeNode(_0x3cc529,_0x46b63f);const _0x56299f={..._0xf1a18c,'generatedAt':new Date()[_0x3a6d5f(0x1ff)+_0x3a6d5f(0x26f)](),'nodeVersion':_0x3cc529['openclaw']['nodeVers'+_0x3a6d5f(0x23f)],'openclawVersion':_0xf1a18c[_0x3a6d5f(0x1c2)+_0x3a6d5f(0x1b9)]||'','platform':process[_0x3a6d5f(0x224)],'arch':process[_0x3a6d5f(0x261)],'nodeExecutable':_0x3a6d5f(0x236)+_0x3a6d5f(0x1f2),'npmCli':_0x3a6d5f(0x25f)+_0x3a6d5f(0x2b5)+_0x3a6d5f(0x249)+_0x3a6d5f(0x2ab)+_0x3a6d5f(0x299),'openclawWorkingDir':_0x3a6d5f(0x1c2),'openclawBin':_0x3a6d5f(0x1c2)+_0x3a6d5f(0x1eb)+'w.mjs'};return await writeJson(resolveManifestPath(_0x40990a),_0x56299f),_0x56299f;}async function ensureRuntimeNode(_0x4e9ad8,_0x5c7f70){const _0x1b2a95=_0x406343,_0xebee2c=_0x4e9ad8['openclaw']['nodeVers'+'ion'],_0x1e27fb=join(_0x5c7f70,'bin','node'),_0xcc7fcc=join(_0x5c7f70,_0x1b2a95(0x2ac),_0x1b2a95(0x1d0)+_0x1b2a95(0x22f),_0x1b2a95(0x2a0),'bin','npm-cli.'+'js');if(existsSync(_0x1e27fb)&&existsSync(_0xcc7fcc)&&await getNodeVersion(_0x1e27fb)===_0xebee2c)return;await rm(_0x5c7f70,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96});if(process['versions'][_0x1b2a95(0x290)]===_0xebee2c){await linkCurrentNodeRuntime(_0x5c7f70);return;}await downloadNodeRuntime(_0xebee2c,_0x5c7f70);}async function getNodeVersion(_0xcfc2b){const _0x28529d=_0x406343;try{const _0x228698=await runProcess(_0xcfc2b,['-p','process.'+_0x28529d(0x252)+'.node'],{'label':_0xcfc2b+_0x28529d(0x277),'timeoutMs':0x7530});return _0x228698[_0x28529d(0x267)][_0x28529d(0x234)]();}catch{return'';}}async function linkCurrentNodeRuntime(_0xc176f){const _0x2faf78=_0x406343,_0x4eb652=process['execPath'],_0xf86ead=resolve(dirname(_0x4eb652),'..'),_0x230401=resolve(_0xf86ead,'lib/node'+_0x2faf78(0x25e)+'/npm'),_0x2626c7=join(_0xc176f,_0x2faf78(0x1dc),_0x2faf78(0x290)),_0x2c62a1=join(_0xc176f,'lib',_0x2faf78(0x1d0)+_0x2faf78(0x22f),'npm');await mkdir(dirname(_0x2626c7),{'recursive':!![]}),await mkdir(dirname(_0x2c62a1),{'recursive':!![]}),await symlink(_0x4eb652,_0x2626c7),existsSync(_0x230401)?await symlink(_0x230401,_0x2c62a1):await symlink(await resolveNpmRoot(),_0x2c62a1);}async function resolveNpmRoot(){const _0x558f1d=_0x406343,_0x14f7dd=await runProcess(_0x558f1d(0x2a0),[_0x558f1d(0x264),'-g'],{'label':_0x558f1d(0x1a2)+_0x558f1d(0x1ab),'timeoutMs':0x7530}),_0x239ea9=join(_0x14f7dd['stdout'][_0x558f1d(0x234)](),_0x558f1d(0x2a0));if(!existsSync(join(_0x239ea9,_0x558f1d(0x1dc),'npm-cli.'+'js')))throw new Error('npm\x20pack'+'age\x20was\x20'+_0x558f1d(0x239)+'d\x20for\x20lo'+_0x558f1d(0x254)+'ime\x20buil'+_0x558f1d(0x1c9)+_0x239ea9);return _0x239ea9;}async function downloadNodeRuntime(_0x1107a4,_0x43fbad){const _0x366732=_0x406343,_0x412663=process[_0x366732(0x224)]===_0x366732(0x181)?_0x366732(0x1b5):process[_0x366732(0x224)],_0x538f34=process[_0x366732(0x261)]===_0x366732(0x24a)?_0x366732(0x24a):process[_0x366732(0x261)]===_0x366732(0x1a4)?_0x366732(0x1a4):process[_0x366732(0x261)],_0x9f1046=process['platform']===_0x366732(0x181)?_0x366732(0x1c3):_0x366732(0x1fe),_0x22e7ff=_0x366732(0x202)+_0x1107a4+'-'+_0x412663+'-'+_0x538f34,_0x3153ad=_0x22e7ff+'.'+_0x9f1046,_0x22977=join(dirname(_0x43fbad),'.cache'),_0x4a846e=join(_0x22977,_0x3153ad),_0x2df631=join(_0x22977,_0x22e7ff+(_0x366732(0x1bd)+'-')+process[_0x366732(0x1b8)]+'-'+Date[_0x366732(0x2a1)]()),_0x3c53bc=_0x366732(0x1d8)+_0x366732(0x17f)+_0x366732(0x187)+'v'+_0x1107a4+'/'+_0x3153ad;await mkdir(_0x22977,{'recursive':!![]}),!existsSync(_0x4a846e)&&(console[_0x366732(0x185)]('[wujie-s'+_0x366732(0x204)+'time]\x20do'+_0x366732(0x1cd)+'g\x20'+_0x3c53bc),await downloadFile(_0x3c53bc,_0x4a846e)),await rm(_0x2df631,{'recursive':!![],'force':!![]}),await mkdir(_0x2df631,{'recursive':!![]}),process[_0x366732(0x224)]===_0x366732(0x181)?await runProcess(_0x366732(0x27b),['-q',_0x4a846e,'-d',_0x2df631],{'label':_0x366732(0x1f4)+_0x3153ad}):await runProcess(_0x366732(0x2b4),[_0x366732(0x1ed),_0x4a846e,'-C',_0x2df631],{'label':_0x366732(0x1f4)+_0x3153ad}),await rename(join(_0x2df631,_0x22e7ff),_0x43fbad),await rm(_0x2df631,{'recursive':!![],'force':!![]});}async function downloadFile(_0x5cc1df,_0x4e1d20){await mkdir(dirname(_0x4e1d20),{'recursive':!![]});const _0x3d370b=await new Promise((_0x1dbc20,_0x23049c)=>{const _0xed3f15=_0x481c;get(_0x5cc1df,_0x4c6ffc=>{const _0x4050d1=_0x481c;if(_0x4c6ffc['statusCo'+'de']>=0x12c&&_0x4c6ffc[_0x4050d1(0x1e4)+'de']<0x190&&_0x4c6ffc[_0x4050d1(0x258)][_0x4050d1(0x1a1)]){_0x4c6ffc['resume'](),downloadFile(new URL(_0x4c6ffc['headers'][_0x4050d1(0x1a1)],_0x5cc1df)[_0x4050d1(0x1f8)],_0x4e1d20)[_0x4050d1(0x1f7)](()=>_0x1dbc20(null))['catch'](_0x23049c);return;}if(_0x4c6ffc['statusCo'+'de']!==0xc8){_0x4c6ffc['resume'](),_0x23049c(new Error(_0x4050d1(0x278)+_0x4050d1(0x24b)+_0x4c6ffc[_0x4050d1(0x1e4)+'de']+':\x20'+_0x5cc1df));return;}_0x1dbc20(_0x4c6ffc);})['on'](_0xed3f15(0x1b1),_0x23049c);});_0x3d370b&&await pipeline(_0x3d370b,createWriteStream(_0x4e1d20));}export async function ensureOpenClawDoctorFixed(_0x3079b8,_0x2c99e7={}){const _0x4960ea=_0x406343,_0x54897d=await loadRuntimeInfo(_0x3079b8[_0x4960ea(0x207)+_0x4960ea(0x24c)]),_0x2b6881=getConfigPaths(_0x3079b8),_0x4799cf=join(_0x2b6881['runtimeS'+'tateDir'],_0x4960ea(0x1c2)+_0x4960ea(0x1b7)+_0x4960ea(0x1ea)),_0x36e661=await readJson(_0x4799cf,{});if(_0x36e661[_0x4960ea(0x1c2)+'Version']===_0x54897d[_0x4960ea(0x1c2)+_0x4960ea(0x1b9)])return _0x2c99e7[_0x4960ea(0x1e8)+'ogger']?.[_0x4960ea(0x1d5)](_0x4960ea(0x1c2)+_0x4960ea(0x1e0)+'fix\x20alre'+_0x4960ea(0x2b3)+_0x4960ea(0x199),{'openclawVersion':_0x54897d[_0x4960ea(0x1c2)+_0x4960ea(0x1b9)],'markerPath':_0x4799cf}),{'ran':![],'openclawVersion':_0x54897d[_0x4960ea(0x1c2)+'Version'],'markerPath':_0x4799cf};return await runOpenClawDoctorFix(_0x3079b8,_0x54897d,{'fromVersion':_0x36e661[_0x4960ea(0x1c2)+'Version']||_0x4960ea(0x1c1),'toVersion':_0x54897d[_0x4960ea(0x1c2)+_0x4960ea(0x1b9)],'markerPath':_0x4799cf,'runtimeLogger':_0x2c99e7[_0x4960ea(0x1e8)+_0x4960ea(0x1d9)]}),{'ran':!![],'openclawVersion':_0x54897d[_0x4960ea(0x1c2)+_0x4960ea(0x1b9)],'markerPath':_0x4799cf};}async function runOpenClawDoctorFix(_0x33725f,_0x45d7a0,{fromVersion:_0x2109be,toVersion:_0x174811,markerPath:markerPath='',runtimeLogger:_0x35e5cd}={}){const _0x14e76a=_0x406343;_0x35e5cd?.[_0x14e76a(0x1d5)](_0x14e76a(0x1c2)+_0x14e76a(0x1e0)+_0x14e76a(0x225)+'ted',{'fromVersion':_0x2109be,'toVersion':_0x174811});const _0x5b1009=await createRuntimeEnv(_0x45d7a0,{'OPENCLAW_HOME':_0x33725f[_0x14e76a(0x1fb)],'OPENCLAW_STATE_DIR':_0x33725f[_0x14e76a(0x1fb)],'OPENCLAW_CONFIG_PATH':getConfigPaths(_0x33725f)[_0x14e76a(0x211)+'th']});console[_0x14e76a(0x185)]('[wujie-s'+_0x14e76a(0x204)+'time]\x20ru'+_0x14e76a(0x2a6)+_0x14e76a(0x1bb)+_0x14e76a(0x275)+_0x14e76a(0x19b));const _0x212e76=await runProcess(_0x45d7a0[_0x14e76a(0x18c)+'utable'],[_0x45d7a0[_0x14e76a(0x1c2)+_0x14e76a(0x25b)],_0x14e76a(0x213),_0x14e76a(0x25d)],{'cwd':_0x45d7a0['openclaw'+'WorkingD'+'ir'],'env':_0x5b1009,'label':_0x14e76a(0x1c2)+_0x14e76a(0x1e0)+_0x14e76a(0x25d),'timeoutMs':0x1d4c0});_0x35e5cd?.[_0x14e76a(0x1d5)](_0x14e76a(0x1c2)+_0x14e76a(0x1e0)+_0x14e76a(0x180)+'leted',{'fromVersion':_0x2109be,'toVersion':_0x174811,'stdout':_0x212e76['stdout'][_0x14e76a(0x234)]()['slice'](-0xfa0),'stderr':_0x212e76[_0x14e76a(0x2af)][_0x14e76a(0x234)]()[_0x14e76a(0x1c0)](-0xfa0)}),markerPath&&(await writeJson(markerPath,{'openclawVersion':_0x45d7a0[_0x14e76a(0x1c2)+_0x14e76a(0x1b9)],'fixedAt':new Date()[_0x14e76a(0x1ff)+_0x14e76a(0x26f)]()}),_0x35e5cd?.['info'](_0x14e76a(0x1c2)+'\x20doctor\x20'+_0x14e76a(0x298)+_0x14e76a(0x1d4)+'en',{'markerPath':markerPath,'openclawVersion':_0x45d7a0[_0x14e76a(0x1c2)+'Version']}));}export async function readRuntimeManifest(_0x428707){return await readJson(resolveManifestPath(_0x428707),{});}export async function loadRuntimeInfo(_0x4f289b){const _0x4e81a8=resolveRuntimeRoot(_0x4f289b),_0x40beec=await readRuntimeManifest(_0x4e81a8);return createRuntimeInfoFromManifest(_0x4e81a8,_0x40beec);}function createRuntimeInfoFromManifest(_0x35135e,_0x31df19,_0x4ee885={}){const _0x1b81b2=_0x406343;for(const _0x5057b1 of['nodeExec'+'utable',_0x1b81b2(0x2b7),_0x1b81b2(0x1c2)+_0x1b81b2(0x25c)+'ir',_0x1b81b2(0x1c2)+'Bin']){if(typeof _0x31df19[_0x5057b1]!==_0x1b81b2(0x257)||!_0x31df19[_0x5057b1][_0x1b81b2(0x234)]())throw new Error(_0x1b81b2(0x21a)+_0x1b81b2(0x227)+_0x1b81b2(0x1ca)+_0x1b81b2(0x1a0)+_0x5057b1+'\x22\x20at\x20'+resolveManifestPath(_0x35135e)+(_0x1b81b2(0x241)+_0x1b81b2(0x20c)+_0x1b81b2(0x210)+'e'));}const _0x4e3aa0=resolve(_0x35135e,_0x31df19['nodeExec'+'utable']),_0xa615cc=resolve(_0x35135e,_0x31df19[_0x1b81b2(0x2b7)]),_0x2b3909=resolve(_0x35135e,_0x31df19['openclaw'+'WorkingD'+'ir']),_0x221e26=resolve(_0x35135e,_0x31df19[_0x1b81b2(0x1c2)+_0x1b81b2(0x25b)]),_0xcdf769=Array[_0x1b81b2(0x188)](_0x31df19[_0x1b81b2(0x197)])?_0x31df19[_0x1b81b2(0x197)][_0x1b81b2(0x24f)](_0x5e6957=>({..._0x5e6957,'installPath':resolve(_0x35135e,_0x5e6957[_0x1b81b2(0x209)+'ath'])})):[],_0x16eef4=_0x4ee885['allowMis'+'singOpen'+_0x1b81b2(0x262)]?[_0x4e3aa0,_0xa615cc]:[_0x4e3aa0,_0xa615cc,_0x2b3909,_0x221e26];for(const _0x4f586e of _0x16eef4){if(!existsSync(_0x4f586e))throw new Error('runtime\x20'+_0x1b81b2(0x269)+_0x1b81b2(0x238)+_0x4f586e);}return{'runtimeRoot':_0x35135e,'manifest':_0x31df19,'openclawVersion':_0x31df19['openclaw'+_0x1b81b2(0x1b9)]||'unknown','nodeExecutable':_0x4e3aa0,'npmCli':_0xa615cc,'openclawWorkingDir':_0x2b3909,'openclawBin':_0x221e26,'plugins':_0xcdf769};}export async function spawnClaw(_0xf2190e,_0x40a256=[],_0x2ca547={}){const _0x3dd08a=_0x406343,_0x15aa0a=await loadRuntimeInfo(_0xf2190e),_0x2783f0=await createRuntimeEnv(_0x15aa0a,_0x2ca547[_0x3dd08a(0x255)]??{});return spawn(_0x15aa0a['nodeExec'+'utable'],[_0x15aa0a['openclaw'+_0x3dd08a(0x25b)],..._0x40a256],{'cwd':_0x15aa0a[_0x3dd08a(0x1c2)+_0x3dd08a(0x25c)+'ir'],'stdio':_0x3dd08a(0x1e3),..._0x2ca547,'env':_0x2783f0});}export async function runClawOnce(_0x37d722,_0x146716=[],_0x59c232=0x15f90){const _0x47a162=await spawnClaw(_0x37d722,_0x146716);return await new Promise((_0x51c1cd,_0x59d722)=>{const _0x35266f=_0x481c;let _0x43f9b6='',_0x112000='',_0xfade53=![];const _0xeda6=setTimeout(()=>{const _0x5589fc=_0x481c;if(_0xfade53)return;_0xfade53=!![],_0x47a162[_0x5589fc(0x214)](_0x5589fc(0x1e7)),_0x59d722(new Error(_0x5589fc(0x1c2)+_0x5589fc(0x29a)+_0x5589fc(0x291)+'\x20'+_0x59c232+'ms'));},_0x59c232);_0x47a162['stdout']['on']('data',_0x1645ad=>{const _0x3ca055=_0x481c;_0x43f9b6+=_0x1645ad[_0x3ca055(0x1c7)]();}),_0x47a162['stderr']['on'](_0x35266f(0x23d),_0x2b1d73=>{const _0x392750=_0x35266f;_0x112000+=_0x2b1d73[_0x392750(0x1c7)]();}),_0x47a162['on']('error',_0x2272d6=>{if(_0xfade53)return;_0xfade53=!![],clearTimeout(_0xeda6),_0x59d722(_0x2272d6);}),_0x47a162['on'](_0x35266f(0x183),(_0x2c1bb2,_0x1e37ed)=>{if(_0xfade53)return;_0xfade53=!![],clearTimeout(_0xeda6),_0x51c1cd({'code':_0x2c1bb2,'signal':_0x1e37ed,'stdout':_0x43f9b6,'stderr':_0x112000});});});}async function createRuntimeEnv(_0x53ddea,_0x45d8c7={}){const _0x132c51=_0x406343,_0x20e690=process.env.OPENCLAW_STATE_DIR||'',_0x12d0f5=_0x20e690?join(_0x20e690,'claw-run'+'time-too'+'ls'):join(_0x53ddea[_0x132c51(0x1e9)+_0x132c51(0x24c)],_0x132c51(0x1c8)),_0xbf2835=join(_0x12d0f5,'npm-glob'+'al'),_0x51402d=join(_0x12d0f5,_0x132c51(0x21e)+'e'),_0x8803c7=join(_0xbf2835,_0x132c51(0x1dc));await mkdir(_0x8803c7,{'recursive':!![]}),await mkdir(_0x51402d,{'recursive':!![]});const _0x10e32e=[_0x8803c7,dirname(_0x53ddea['nodeExec'+_0x132c51(0x28e)]),process.env.PATH||''];return{...process.env,..._0x45d8c7,'PATH':_0x10e32e[_0x132c51(0x251)](Boolean)[_0x132c51(0x281)](delimiter),'npm_config_prefix':_0xbf2835,'NPM_CONFIG_PREFIX':_0xbf2835,'npm_config_cache':_0x51402d,'NPM_CONFIG_CACHE':_0x51402d,'npm_config_registry':_0x132c51(0x1d8)+_0x132c51(0x266)+_0x132c51(0x217)+'rg/','NPM_CONFIG_REGISTRY':_0x132c51(0x1d8)+_0x132c51(0x266)+_0x132c51(0x217)+'rg/','npm_execpath':_0x53ddea[_0x132c51(0x2b7)],'npm_node_execpath':_0x53ddea[_0x132c51(0x18c)+'utable'],'OPENCLAW_RUNTIME_NPM_PREFIX':_0xbf2835,'OPENCLAW_RUNTIME_NPM_BIN':_0x8803c7,'OPENCLAW_RUNTIME_NPM_REGISTRY':_0x132c51(0x1d8)+_0x132c51(0x266)+_0x132c51(0x217)+_0x132c51(0x19e)};}async function syncProductPlugins(_0x34e4a1,_0x10f5f9,_0x2c02f9){const _0x553b29=_0x406343,_0x33cfdc=join(_0x10f5f9,'openclaw',_0x553b29(0x270),'extensio'+'ns'),_0x2fb4c6=[];for(const _0x127918 of _0x34e4a1[_0x553b29(0x1c2)]['resolved'+_0x553b29(0x18e)+_0x553b29(0x1a5)]){const _0x2b9096=await getPackageMetadata(_0x127918),_0x34a5e3=await readPluginManifest(_0x127918),_0x113d48=join(_0x33cfdc,_0x2b9096['pluginId']);await copyDirFresh(_0x127918,_0x113d48),_0x2fb4c6[_0x553b29(0x190)]({'pluginId':_0x2b9096[_0x553b29(0x2b6)],'source':_0x553b29(0x29f),'spec':_0x553b29(0x1e5)+_0x127918,'installPath':toRuntimeRelative(_0x10f5f9,_0x113d48),'version':_0x2b9096[_0x553b29(0x23e)],'resolvedName':_0x2b9096[_0x553b29(0x1b3)],'resolvedVersion':_0x2b9096[_0x553b29(0x23e)],'resolvedSpec':_0x553b29(0x1e5)+_0x127918,'integrity':'','shasum':'','resolvedAt':new Date()[_0x553b29(0x1ff)+_0x553b29(0x26f)](),'installedAt':new Date()[_0x553b29(0x1ff)+'ing'](),'agentScope':_0x34a5e3[_0x553b29(0x294)+'pe'],'skills':_0x34a5e3[_0x553b29(0x212)]});}const _0x3ce38b=new Set(_0x2fb4c6[_0x553b29(0x24f)](_0x3f020f=>_0x3f020f[_0x553b29(0x2b6)])),_0x4a664f=Array['isArray'](_0x2c02f9['plugins'])?_0x2c02f9[_0x553b29(0x197)]['filter'](_0x3f8808=>!_0x3ce38b[_0x553b29(0x18f)](_0x3f8808[_0x553b29(0x2b6)])):[];_0x2c02f9[_0x553b29(0x197)]=[..._0x4a664f,..._0x2fb4c6];}async function syncManifestPluginScope(_0x53e894,_0x4039d3,_0xa4a173){const _0x353792=_0x406343,_0x4c6660=join(_0x4039d3,'openclaw',_0x353792(0x270),_0x353792(0x208)+'ns'),_0x5d383b=new Set(_0x53e894[_0x353792(0x1c2)][_0x353792(0x280)+'ecs']??[]),_0x1aabd7=new Set([..._0x5d383b][_0x353792(0x24f)](_0x4d0c0d=>_0x4d0c0d[_0x353792(0x228)](/^npm:/,''))[_0x353792(0x24f)](_0x3446e7=>{const _0xf02212=_0x353792;if(_0x3446e7[_0xf02212(0x1b0)+'th']('@')){const _0x581ae3=_0x3446e7['split']('@');return _0x581ae3[_0xf02212(0x235)]>=0x3?'@'+_0x581ae3[0x1]:_0x3446e7;}return _0x3446e7[_0xf02212(0x1be)]('@')[0x0];})['filter'](Boolean)),_0x18b8a0=new Set();for(const _0x577725 of _0x53e894[_0x353792(0x1c2)][_0x353792(0x1b6)+_0x353792(0x18e)+_0x353792(0x1a5)]){const _0x2437a1=await getPackageMetadata(_0x577725);if(_0x2437a1[_0x353792(0x2b6)])_0x18b8a0[_0x353792(0x247)](_0x2437a1[_0x353792(0x2b6)]);}const _0x26a72d=Array[_0x353792(0x188)](_0xa4a173[_0x353792(0x197)])?_0xa4a173[_0x353792(0x197)]:[];_0xa4a173['pluginSp'+_0x353792(0x2a4)]=[..._0x53e894[_0x353792(0x1c2)][_0x353792(0x280)+_0x353792(0x2a4)],..._0x53e894['openclaw'][_0x353792(0x1b6)+_0x353792(0x18e)+_0x353792(0x1a5)][_0x353792(0x24f)](_0x1fb80e=>'local:'+_0x1fb80e)],_0xa4a173[_0x353792(0x197)]=_0x26a72d[_0x353792(0x251)](_0x1a9c1b=>{const _0x1d0c3b=_0x353792;if(!_0x1a9c1b||typeof _0x1a9c1b!=='object')return![];if(_0x1a9c1b[_0x1d0c3b(0x242)]===_0x1d0c3b(0x29f))return _0x18b8a0[_0x1d0c3b(0x18f)](_0x1a9c1b['pluginId']);if(_0x1a9c1b['source']===_0x1d0c3b(0x2a0))return _0x5d383b[_0x1d0c3b(0x18f)](_0x1a9c1b[_0x1d0c3b(0x2a7)])||_0x5d383b[_0x1d0c3b(0x18f)](_0x1a9c1b[_0x1d0c3b(0x1b6)+_0x1d0c3b(0x1a6)])||_0x1aabd7[_0x1d0c3b(0x18f)](_0x1a9c1b[_0x1d0c3b(0x1b6)+'Name']);return![];});const _0x5df8b3=new Set(_0xa4a173[_0x353792(0x197)]['map'](_0x11edde=>_0x11edde[_0x353792(0x2b6)]));for(const _0x390444 of _0x26a72d){if(!_0x390444[_0x353792(0x2b6)]||_0x5df8b3[_0x353792(0x18f)](_0x390444[_0x353792(0x2b6)]))continue;const _0x26e540=typeof _0x390444[_0x353792(0x209)+_0x353792(0x1dd)]===_0x353792(0x257)&&_0x390444[_0x353792(0x209)+_0x353792(0x1dd)]['trim']()?resolve(_0x4039d3,_0x390444['installP'+_0x353792(0x1dd)]):join(_0x4c6660,_0x390444[_0x353792(0x2b6)]),_0x1be864=relative(_0x4c6660,_0x26e540);if(_0x1be864[_0x353792(0x1b0)+'th']('..')||_0x1be864==='')continue;await rm(_0x26e540,{'recursive':!![],'force':!![]});}}async function syncProductAgents(_0x304437,_0x42e0d1,_0x2c4e39){const _0x163a5d=_0x406343,_0x193071=join(_0x42e0d1,_0x163a5d(0x1c2),'agents');await copyDirFresh(_0x304437[_0x163a5d(0x1c2)][_0x163a5d(0x2b1)+'r'],_0x193071),_0x2c4e39['agents']={'source':_0x163a5d(0x222),'installPath':toRuntimeRelative(_0x42e0d1,_0x193071)};}async function syncProductSkills(_0x22c14c,_0x274dcb,_0xf1c5bf){const _0x37d7ab=_0x406343,_0x495911=join(_0x274dcb,_0x37d7ab(0x1c2),'skills');await copyDirFresh(_0x22c14c[_0x37d7ab(0x1c2)][_0x37d7ab(0x295)+'r'],_0x495911),_0xf1c5bf[_0x37d7ab(0x212)]={'source':'product','installPath':toRuntimeRelative(_0x274dcb,_0x495911)};}
1
+ const _0x52cc87=_0x2db8;(function(_0x1901fe,_0x4948c9){const _0x3612ef=_0x2db8,_0x298565=_0x1901fe();while(!![]){try{const _0x2eded6=parseInt(_0x3612ef(0x1f2))/0x1+-parseInt(_0x3612ef(0x259))/0x2+-parseInt(_0x3612ef(0x24d))/0x3+parseInt(_0x3612ef(0x1b6))/0x4*(-parseInt(_0x3612ef(0x175))/0x5)+parseInt(_0x3612ef(0x262))/0x6*(-parseInt(_0x3612ef(0x209))/0x7)+parseInt(_0x3612ef(0x268))/0x8*(-parseInt(_0x3612ef(0x1d8))/0x9)+parseInt(_0x3612ef(0x229))/0xa;if(_0x2eded6===_0x4948c9)break;else _0x298565['push'](_0x298565['shift']());}catch(_0x354e06){_0x298565['push'](_0x298565['shift']());}}}(_0x3e1c,0x9715d));import{existsSync}from'node:fs';import{createWriteStream}from'node:fs';import{chmod,cp,mkdir,rename,rm,symlink,writeFile}from'node:fs/promises';import{delimiter,dirname,join,relative,resolve}from'node:path';import{fileURLToPath}from'node:url';import{spawn}from'node:child_process';import{get}from'node:https';import{pipeline}from'node:stream/promises';import{getConfigPaths}from'@wujie-shell/config';import{copyDirFresh,getPackageMetadata,readJson,readPluginManifest,toRuntimeRelative,writeJson}from'./utils.mjs';import{createRuntimeLogger,summarizeRuntimeManifest,summarizeShellConfig}from'./runtime-logger.mjs';const RUNTIME_DIR=_0x52cc87(0x184)+_0x52cc87(0x23a),MANIFEST_NAME=_0x52cc87(0x28a)+_0x52cc87(0x27e)+_0x52cc87(0x20a),NPM_INSTALL_TIMEOUT_MS=0xf*0x3c*0x3e8;export function resolveRuntimeRoot(_0x468b3f){if(process.env.WUJIE_SHELL_RUNTIME_ROOT)return resolve(process.env.WUJIE_SHELL_RUNTIME_ROOT);return resolve(_0x468b3f,RUNTIME_DIR);}export function resolveManifestPath(_0x44fb77){return join(_0x44fb77,MANIFEST_NAME);}export async function prepareRuntime(_0xce7b59,{syncOnly:syncOnly=![]}={}){const _0x3ac95d=_0x52cc87,_0x4c7ea6=resolveRuntimeRoot(_0xce7b59[_0x3ac95d(0x182)+_0x3ac95d(0x16a)]),_0x1d6b08=createRuntimeLogger(getConfigPaths(_0xce7b59),_0x3ac95d(0x22b)),_0x340d53=Date['now']();_0x1d6b08?.['info'](_0x3ac95d(0x1a6)+_0x3ac95d(0x211)+_0x3ac95d(0x15c),{'syncOnly':syncOnly,'runtimeRoot':_0x4c7ea6,'shellConfig':summarizeShellConfig(_0xce7b59)});try{const _0x4cc128=await ensureRuntimeBase(_0xce7b59,_0x4c7ea6,{'runtimeLogger':_0x1d6b08,'syncOnly':syncOnly});_0x1d6b08?.[_0x3ac95d(0x28e)](_0x3ac95d(0x211)+'manifest'+_0x3ac95d(0x1c0),{'manifestPath':resolveManifestPath(_0x4c7ea6),'manifest':summarizeRuntimeManifest(_0x4cc128)}),validateRuntimeNodeVersion(_0x4cc128,_0xce7b59),_0x1d6b08?.[_0x3ac95d(0x28e)]('runtime\x20'+_0x3ac95d(0x17f)+_0x3ac95d(0x181)+'idated',{'nodeVersion':_0x4cc128['nodeVers'+_0x3ac95d(0x269)]});if(syncOnly)validateRuntimeOpenClawVersion(_0x4cc128,_0xce7b59),_0x1d6b08?.[_0x3ac95d(0x28e)]('runtime\x20'+_0x3ac95d(0x14e)+_0x3ac95d(0x1b8)+_0x3ac95d(0x200)+'ed',{'openclawVersion':_0x4cc128[_0x3ac95d(0x14e)+'Version']});else{if(_0x4cc128[_0x3ac95d(0x14e)+_0x3ac95d(0x221)]!==_0xce7b59[_0x3ac95d(0x14e)][_0x3ac95d(0x14e)+_0x3ac95d(0x221)]){const _0x45f182=await loadRuntimeInfo(_0xce7b59[_0x3ac95d(0x182)+_0x3ac95d(0x16a)]);_0x1d6b08?.[_0x3ac95d(0x28e)](_0x3ac95d(0x14e)+_0x3ac95d(0x1a4)+_0x3ac95d(0x171)+'\x20started',{'fromVersion':_0x4cc128[_0x3ac95d(0x14e)+_0x3ac95d(0x221)]||'unknown','toVersion':_0xce7b59['openclaw'][_0x3ac95d(0x14e)+_0x3ac95d(0x221)]}),await installOpenClawPackage(_0x45f182,_0xce7b59[_0x3ac95d(0x14e)][_0x3ac95d(0x14e)+_0x3ac95d(0x221)]),_0x4cc128[_0x3ac95d(0x14e)+'Version']=_0xce7b59[_0x3ac95d(0x14e)][_0x3ac95d(0x14e)+_0x3ac95d(0x221)],_0x1d6b08?.['info'](_0x3ac95d(0x14e)+_0x3ac95d(0x1a4)+'\x20install'+_0x3ac95d(0x1ca)+'ed',{'openclawVersion':_0x4cc128[_0x3ac95d(0x14e)+'Version']});}}_0x4cc128['generate'+_0x3ac95d(0x213)]=new Date()[_0x3ac95d(0x216)+_0x3ac95d(0x1ff)](),_0x4cc128[_0x3ac95d(0x246)+_0x3ac95d(0x269)]=_0xce7b59[_0x3ac95d(0x14e)][_0x3ac95d(0x246)+_0x3ac95d(0x269)],_0x4cc128[_0x3ac95d(0x163)]={'appId':_0xce7b59[_0x3ac95d(0x24b)],'productName':_0xce7b59['productN'+'ame'],'dataDirName':_0xce7b59[_0x3ac95d(0x159)+'ame']};const _0xe2091c=Array[_0x3ac95d(0x231)](_0x4cc128[_0x3ac95d(0x1e3)])?_0x4cc128[_0x3ac95d(0x1e3)][_0x3ac95d(0x152)]:0x0;return await syncManifestPluginScope(_0xce7b59,_0x4c7ea6,_0x4cc128),_0x1d6b08?.[_0x3ac95d(0x28e)](_0x3ac95d(0x211)+_0x3ac95d(0x193)+'cope\x20syn'+_0x3ac95d(0x250),{'beforePluginCount':_0xe2091c,'afterPluginCount':Array[_0x3ac95d(0x231)](_0x4cc128['plugins'])?_0x4cc128[_0x3ac95d(0x1e3)][_0x3ac95d(0x152)]:0x0,'pluginSpecCount':Array['isArray'](_0x4cc128[_0x3ac95d(0x1e4)+_0x3ac95d(0x1fa)])?_0x4cc128[_0x3ac95d(0x1e4)+_0x3ac95d(0x1fa)][_0x3ac95d(0x152)]:0x0}),await syncProductPlugins(_0xce7b59,_0x4c7ea6,_0x4cc128),_0x1d6b08?.[_0x3ac95d(0x28e)](_0x3ac95d(0x1aa)+_0x3ac95d(0x21f)+_0x3ac95d(0x1a1),{'localPluginCount':_0xce7b59[_0x3ac95d(0x14e)]['resolved'+_0x3ac95d(0x1cb)+'ginPaths'][_0x3ac95d(0x152)],'pluginCount':Array[_0x3ac95d(0x231)](_0x4cc128['plugins'])?_0x4cc128[_0x3ac95d(0x1e3)][_0x3ac95d(0x152)]:0x0}),await syncProductAgents(_0xce7b59,_0x4c7ea6,_0x4cc128),_0x1d6b08?.[_0x3ac95d(0x28e)](_0x3ac95d(0x1aa)+_0x3ac95d(0x241)+'ynced',{'source':_0xce7b59[_0x3ac95d(0x14e)]['agentsDi'+'r'],'installPath':_0x4cc128[_0x3ac95d(0x27c)]?.['installP'+_0x3ac95d(0x151)]}),await syncProductSkills(_0xce7b59,_0x4c7ea6,_0x4cc128),_0x1d6b08?.['info'](_0x3ac95d(0x1aa)+_0x3ac95d(0x274)+'ynced',{'source':_0xce7b59['openclaw']['skillsDi'+'r'],'installPath':_0x4cc128[_0x3ac95d(0x233)]?.[_0x3ac95d(0x20d)+_0x3ac95d(0x151)]}),await syncRuntimeWrapper(_0xce7b59,_0x4c7ea6,_0x4cc128),_0x1d6b08?.[_0x3ac95d(0x28e)]('runtime\x20'+_0x3ac95d(0x26a)+'synced',{'wujieclawBin':_0x4cc128[_0x3ac95d(0x222)+_0x3ac95d(0x249)]}),await writeJson(resolveManifestPath(_0x4c7ea6),_0x4cc128),_0x1d6b08?.[_0x3ac95d(0x28e)](_0x3ac95d(0x211)+'manifest'+_0x3ac95d(0x173),{'manifestPath':resolveManifestPath(_0x4c7ea6),'manifest':summarizeRuntimeManifest(_0x4cc128),'durationMs':Date[_0x3ac95d(0x263)]()-_0x340d53}),await _0x1d6b08?.['flush'](),_0x4cc128;}catch(_0xa57810){_0x1d6b08?.[_0x3ac95d(0x1ee)]('prepare\x20'+_0x3ac95d(0x211)+_0x3ac95d(0x261),{'syncOnly':syncOnly,'runtimeRoot':_0x4c7ea6,'durationMs':Date[_0x3ac95d(0x263)]()-_0x340d53,'error':_0xa57810}),await _0x1d6b08?.[_0x3ac95d(0x204)]();throw _0xa57810;}}function _0x3e1c(){const _0x1a2be4=['time-too','\x20can\x20be\x20','\x20doctor\x20','runtime-','law\x20','ed\x20OpenC','every','info','openclaw','download','\x22==\x22\x22\x20se','ath','length','spec','\x20\x22$0\x22)\x22\x20','--no-aud','arm64','\x20returne','/opencla','dataDirN','config=','time]\x20in','started','\x20product','ut\x20after','m/bin/np','npm\x20pack','s/wujie-','base\x20bui','product','fix\x20alre','IPT_DIR=','../asset','nning\x20op','rname\x20--','d\x20to\x20','oot','ujie-log','npm-glob','npmCli','/node','rg/dist/','w.mjs','\x20install','headers','\x20written','ginPaths','5ynLdEm','env','--no-fun','er\x20writt','arch','log','&&\x20pwd)','nodejs.o','runtimeL','join','node\x20ver','filter','sion\x20val','projectR','utf8','.tmp/run','ATE_DIR%','\x20bin\x20was','base\x20alr','resolved','node','ame','CONFIG_P','NCLAW_ST','npm','HOME=\x22${','dataDir','CRIPT_DI','doctor','kill','plugin\x20s','NCLAW_HO','IR=$(CDP','\x20-z\x20\x22$WU','leted','dules/np','R=\x22${OPE','NCLAW_CO','add','#!/bin/s','PT_DIR/','local','ignore','resume','synced','d:\x20','ogger','\x20package','-peer-de','prepare\x20','set\x20\x22OPE','rg/','STATE_DI','product\x20','required','then','nodeExec','fix\x20comp','\x20not\x20fou','OpenClaw','object','Spec','eer','name','\x20-g','1912728hdLaZx','ules','\x20version','if\x20\x22%OPE','OME=','FILE%\x5c','ie-shell','--omit=d','execPath','PENCLAW_','\x20loaded','.node','atch:\x20ma',',\x20shell.','toString','ll\x20||\x20tr','octor\x20--','_modules','replace','bin','\x20complet','LocalPlu','configPa','stdout','NFIG_PAT','\x20set\x20\x22OP','runtimeS','dist','[wujie-s','Version\x20','extensio','npm\x20root','stderr','replaceA','18EMDJft','\x22%SCRIPT','lib/node','Run\x20\x22wuj','ATE_DIR:','tar','Bin','eady\x20cur','OPENCLAW','allowMis','ME%\x22==\x22\x22','plugins','pluginSp','path:\x20','statusCo','mismatch','%USERPRO','\x20signal=','trim','-xJf','_DIR%','hell:run','error','WorkingD','skillsDi','\x20did\x20not','1131930DyYYZw','agentsDi','\x20\x20\x22$SCRI','/npm','string','.tools','SIGTERM','>/dev/nu','ecs','parse','fix\x20mark','npm-cli.','l\x20prepar','ing','\x20validat','\x20runtime','versions','tateDir','flush','cwd','%~dp0\x22','runtimeR','rent','7fhMDDt','.json','go.mjs','$HOME/','installP','\x20timed\x20o','\x20failed\x20','not\x20foun','runtime\x20','fix\x20star','dAt','npm-cach','d\x20an\x20inv','toISOStr','w.json\x22','map','slice','\x22\x20so\x20the','st=','node_mod','set\x20\x22SCR','OGO\x22\x20];\x20','plugins\x20','Name','Version','wujiecla','ENCLAW_H','\x22\x20at\x20','d\x20for\x20lo','unknown','stalling','https://','22598130MOstBO','tar.xz','runtime','has','--\x20\x22$(di','json','alid\x20pay','1\x20]\x20&&\x20[','isArray','w.cmd','skills','pipe','data','version','\x20paths','missing\x20','platform','time','label','package','.opencla','lib','Claw','zip','agents\x20s','extract\x20','if\x20[\x20-t\x20','export\x20O','ncies','nodeVers','install','\x5copencla','wBin','\x20is\x20miss','appId','SCRIPT_D','616977WtstSm','--fix','node-v','ced','sion\x20mis','win32','ATH=\x20cd\x20','with\x20the','.npmjs.o','\x20depende',':\x20manife','filename','1838870xrnYOx','/node_mo','o.mjs\x22\x202','close','LAW_STAT','ld\x20start','w-extrac','source','failed','6121068PqBiZv','now','m-cli.js','\x20prepare','x64','.cache','597776PBVmoD','ion','wrapper\x20','null','wujie-lo','sion.','ATH:-','H%\x22==\x22\x22\x20',';\x20run\x20wu','local:','-extract','agentSco','skills\x20s','pluginId','\x20create\x20','t\x20\x22OPENC','\x20configu','nd\x20after','JIE_NO_L','rebuilt\x20','agents','catch','manifest','utable','-doctor.','time]\x20do','location','ime\x20buil','ent','--json','registry'];_0x3e1c=function(){return _0x1a2be4;};return _0x3e1c();}async function syncRuntimeWrapper(_0x41b615,_0x11398d,_0x195eaa){const _0xb5180b=_0x52cc87,_0x4f4537=join(_0x11398d,'bin',_0xb5180b(0x222)+'w'),_0x4aa6de=join(_0x11398d,'bin','wujiecla'+_0xb5180b(0x232)),_0x388f5a=normalizeRuntimeRelativePath(relative(dirname(_0x4f4537),resolve(_0x11398d,_0x195eaa[_0xb5180b(0x1ad)+_0xb5180b(0x27f)]))),_0xf62dc7=normalizeRuntimeRelativePath(relative(dirname(_0x4f4537),resolve(_0x11398d,_0x195eaa[_0xb5180b(0x14e)+'Bin']))),_0xc72fc5=_0xb5180b(0x20c)+_0x41b615[_0xb5180b(0x159)+'ame'],_0x548ce0=_0xb5180b(0x1e8)+_0xb5180b(0x1bb)+_0x41b615[_0xb5180b(0x159)+_0xb5180b(0x18a)];await mkdir(dirname(_0x4f4537),{'recursive':!![]});const _0x11d7b6=fileURLToPath(new URL(_0xb5180b(0x166)+_0xb5180b(0x161)+'logo.mjs',import.meta.url)),_0x16159f=join(_0x11398d,_0xb5180b(0x1c9),_0xb5180b(0x26c)+_0xb5180b(0x20b));await cp(_0x11d7b6,_0x16159f),await writeFile(_0x4f4537,[_0xb5180b(0x19c)+'h',_0xb5180b(0x244)+_0xb5180b(0x1bf)+_0xb5180b(0x18e)+_0xb5180b(0x1e0)+'_HOME:-'+_0xc72fc5+'}\x22',_0xb5180b(0x244)+'PENCLAW_'+_0xb5180b(0x1a9)+_0xb5180b(0x199)+'NCLAW_ST'+_0xb5180b(0x1dc)+'-'+_0xc72fc5+'}\x22',_0xb5180b(0x244)+_0xb5180b(0x1bf)+_0xb5180b(0x18b)+'ATH=\x22${O'+_0xb5180b(0x1bf)+'CONFIG_P'+_0xb5180b(0x26e)+_0xc72fc5+(_0xb5180b(0x158)+'w.json}\x22'),_0xb5180b(0x24c)+_0xb5180b(0x195)+_0xb5180b(0x253)+_0xb5180b(0x22d)+_0xb5180b(0x168)+_0xb5180b(0x154)+_0xb5180b(0x17b),_0xb5180b(0x243)+_0xb5180b(0x230)+_0xb5180b(0x196)+_0xb5180b(0x27a)+_0xb5180b(0x21e)+_0xb5180b(0x1ac),_0xb5180b(0x1f4)+'PT_DIR/'+_0x388f5a+('\x22\x20\x22$SCRI'+'PT_DIR/w'+_0xb5180b(0x16b)+_0xb5180b(0x25b)+_0xb5180b(0x1f9)+_0xb5180b(0x1c5)+'ue'),'fi','exec\x20\x22$S'+_0xb5180b(0x190)+'R/'+_0x388f5a+('\x22\x20\x22$SCRI'+_0xb5180b(0x19d))+_0xf62dc7+'\x22\x20\x22$@\x22','']['join']('\x0a'),_0xb5180b(0x183)),await chmod(_0x4f4537,0x1ed),await writeFile(_0x4aa6de,['@echo\x20of'+'f',_0xb5180b(0x1b9)+_0xb5180b(0x194)+_0xb5180b(0x1e2)+_0xb5180b(0x1cf)+_0xb5180b(0x223)+_0xb5180b(0x1ba)+_0x548ce0+'\x22',_0xb5180b(0x1b9)+_0xb5180b(0x18c)+_0xb5180b(0x185)+_0xb5180b(0x150)+_0xb5180b(0x277)+_0xb5180b(0x25d)+'E_DIR='+_0x548ce0+'\x22',_0xb5180b(0x1b9)+_0xb5180b(0x19a)+'NFIG_PAT'+_0xb5180b(0x26f)+_0xb5180b(0x1a7)+'NCLAW_CO'+_0xb5180b(0x1ce)+'H='+_0x548ce0+(_0xb5180b(0x248)+_0xb5180b(0x217)),_0xb5180b(0x21d)+_0xb5180b(0x165)+_0xb5180b(0x206),_0xb5180b(0x1d9)+_0xb5180b(0x1ec)+toWindowsPath(_0x388f5a)+('\x22\x20\x22%SCRI'+'PT_DIR%')+toWindowsPath(_0xf62dc7)+'\x22\x20%*','']['join']('\x0d\x0a'),_0xb5180b(0x183)),_0x195eaa[_0xb5180b(0x222)+'wBin']=toRuntimeRelative(_0x11398d,process[_0xb5180b(0x239)]===_0xb5180b(0x252)?_0x4aa6de:_0x4f4537);}function normalizeRuntimeRelativePath(_0x41f10d){const _0x51d45f=_0x52cc87;return _0x41f10d[_0x51d45f(0x1d7)+'ll']('\x5c','/');}function toWindowsPath(_0x5ebee3){return _0x5ebee3['replaceA'+'ll']('/','\x5c');}function validateRuntimeNodeVersion(_0x3eb7b7,_0x27ae92){const _0x14a2f4=_0x52cc87;if(_0x3eb7b7[_0x14a2f4(0x246)+_0x14a2f4(0x269)]===_0x27ae92['openclaw'][_0x14a2f4(0x246)+_0x14a2f4(0x269)])return;throw new Error(_0x14a2f4(0x211)+_0x14a2f4(0x246)+'ion\x20mism'+_0x14a2f4(0x1c2)+'nifest='+(_0x3eb7b7['nodeVers'+_0x14a2f4(0x269)]||'unknown')+(_0x14a2f4(0x1c3)+_0x14a2f4(0x15a))+_0x27ae92['openclaw'][_0x14a2f4(0x246)+_0x14a2f4(0x269)]+'.\x20'+(_0x14a2f4(0x1db)+_0x14a2f4(0x1bc)+_0x14a2f4(0x265)+'\x22\x20so\x20the'+_0x14a2f4(0x15d)+_0x14a2f4(0x201)+_0x14a2f4(0x288)+_0x14a2f4(0x27b)+_0x14a2f4(0x254)+_0x14a2f4(0x278)+'red\x20Node'+'\x20version'+'.'));}function validateRuntimeOpenClawVersion(_0x20a3c1,_0x333e58){const _0x28c84f=_0x52cc87;if(_0x20a3c1[_0x28c84f(0x14e)+_0x28c84f(0x221)]===_0x333e58[_0x28c84f(0x14e)][_0x28c84f(0x14e)+_0x28c84f(0x221)])return;throw new Error('runtime\x20'+_0x28c84f(0x14e)+_0x28c84f(0x1d3)+_0x28c84f(0x1e7)+_0x28c84f(0x257)+_0x28c84f(0x21b)+(_0x20a3c1[_0x28c84f(0x14e)+_0x28c84f(0x221)]||_0x28c84f(0x226))+(_0x28c84f(0x1c3)+_0x28c84f(0x15a))+_0x333e58[_0x28c84f(0x14e)]['openclaw'+_0x28c84f(0x221)]+'.\x20'+(_0x28c84f(0x1db)+_0x28c84f(0x1bc)+'\x20prepare'+_0x28c84f(0x21a)+_0x28c84f(0x201)+'\x20can\x20ins'+'tall\x20the'+_0x28c84f(0x278)+'red\x20Open'+'Claw\x20ver'+_0x28c84f(0x26d)));}function parseNpmPackJson(_0x424c83){const _0x2c1b3d=_0x52cc87,_0x1c6103=_0x424c83[_0x2c1b3d(0x1ea)](),_0x31c6bc=_0x1c6103['indexOf']('[');if(_0x31c6bc<0x0)throw new Error('npm\x20pack'+_0x2c1b3d(0x1f1)+'\x20return\x20'+'JSON:\x20'+_0x1c6103['slice'](0x0,0x1f4));const _0x1cebc3=JSON[_0x2c1b3d(0x1fb)](_0x1c6103[_0x2c1b3d(0x219)](_0x31c6bc)),_0x388b1a=Array[_0x2c1b3d(0x231)](_0x1cebc3)?_0x1cebc3[0x0]:_0x1cebc3;if(!_0x388b1a||typeof _0x388b1a!==_0x2c1b3d(0x1b1))throw new Error(_0x2c1b3d(0x160)+_0x2c1b3d(0x157)+_0x2c1b3d(0x215)+_0x2c1b3d(0x22f)+'load:\x20'+_0x1c6103[_0x2c1b3d(0x219)](0x0,0x1f4));return _0x388b1a;}async function runProcess(_0x233a2a,_0x5384ff,_0x205022={}){const _0x2cfd6f=_0x52cc87,_0x5993ee=_0x205022[_0x2cfd6f(0x23b)]||[_0x233a2a,..._0x5384ff][_0x2cfd6f(0x17e)]('\x20'),_0x316f24=_0x205022['timeoutM'+'s']??NPM_INSTALL_TIMEOUT_MS,_0x5cae99=spawn(_0x233a2a,_0x5384ff,{'cwd':_0x205022[_0x2cfd6f(0x205)],'env':_0x205022[_0x2cfd6f(0x176)],'stdio':[_0x2cfd6f(0x19f),_0x2cfd6f(0x234),_0x2cfd6f(0x234)]});return await new Promise((_0x193d19,_0x5ce5cf)=>{const _0x2e7ac4=_0x2cfd6f;let _0x14039d='',_0x58276f='',_0x1e534b=![];const _0x325df8=setTimeout(()=>{const _0x361eee=_0x2db8;if(_0x1e534b)return;_0x1e534b=!![],_0x5cae99[_0x361eee(0x192)](_0x361eee(0x1f8)),_0x5ce5cf(new Error(_0x5993ee+('\x20timed\x20o'+_0x361eee(0x15e)+'\x20')+_0x316f24+'ms'));},_0x316f24);_0x5cae99[_0x2e7ac4(0x1cd)]['on'](_0x2e7ac4(0x235),_0x5e7b5c=>{const _0x4784bf=_0x2e7ac4;_0x14039d+=_0x5e7b5c[_0x4784bf(0x1c4)]();}),_0x5cae99[_0x2e7ac4(0x1d6)]['on'](_0x2e7ac4(0x235),_0x2f5688=>{const _0x110d0d=_0x2e7ac4;_0x58276f+=_0x2f5688[_0x110d0d(0x1c4)]();}),_0x5cae99['on']('error',_0x452567=>{if(_0x1e534b)return;_0x1e534b=!![],clearTimeout(_0x325df8),_0x5ce5cf(_0x452567);}),_0x5cae99['on'](_0x2e7ac4(0x25c),(_0xb02c0a,_0x3e285b)=>{const _0x5b0a44=_0x2e7ac4;if(_0x1e534b)return;_0x1e534b=!![],clearTimeout(_0x325df8);if(_0xb02c0a===0x0){_0x193d19({'stdout':_0x14039d,'stderr':_0x58276f});return;}_0x5ce5cf(new Error(_0x5993ee+(_0x5b0a44(0x20f)+'with\x20cod'+'e=')+(_0xb02c0a??'null')+_0x5b0a44(0x1e9)+(_0x3e285b??_0x5b0a44(0x26b))+'\x0a'+(''+(_0x58276f||_0x14039d))[_0x5b0a44(0x1ea)]()));});});}async function installOpenClawPackage(_0x44c894,_0x49ee24){const _0x1bb11a=_0x52cc87,_0x2e0ce0=join(_0x44c894['runtimeR'+_0x1bb11a(0x16a)],_0x1bb11a(0x267)),_0x37c78b=join(_0x44c894[_0x1bb11a(0x207)+'oot'],_0x1bb11a(0x23d)+_0x1bb11a(0x25f)+'t');await mkdir(_0x2e0ce0,{'recursive':!![]}),await rm(_0x37c78b,{'recursive':!![],'force':!![]}),await mkdir(_0x37c78b,{'recursive':!![]});const _0x27b4e3=await createRuntimeEnv(_0x44c894),_0x234d2f=_0x1bb11a(0x14e)+'@'+_0x49ee24;console[_0x1bb11a(0x17a)](_0x1bb11a(0x1d2)+_0x1bb11a(0x1ed)+_0x1bb11a(0x15b)+_0x1bb11a(0x227)+'\x20'+_0x234d2f);const _0x4fa388=await runProcess(_0x44c894['nodeExec'+_0x1bb11a(0x27f)],[_0x44c894[_0x1bb11a(0x16d)],'pack',_0x234d2f,_0x1bb11a(0x285)],{'cwd':_0x2e0ce0,'env':_0x27b4e3,'label':_0x1bb11a(0x160)+'\x20'+_0x234d2f}),_0x506408=parseNpmPackJson(_0x4fa388['stdout']);if(_0x506408[_0x1bb11a(0x236)]!==_0x49ee24)throw new Error('Configur'+_0x1bb11a(0x28c)+_0x1bb11a(0x28b)+_0x49ee24+('\x20resolve'+_0x1bb11a(0x169))+_0x506408[_0x1bb11a(0x236)]);const _0x2c8005=resolve(_0x2e0ce0,_0x506408[_0x1bb11a(0x258)]);if(!existsSync(_0x2c8005))throw new Error(_0x1bb11a(0x160)+_0x1bb11a(0x1f1)+_0x1bb11a(0x276)+'tarball:'+'\x20'+_0x2c8005);await runProcess('tar',['-xzf',_0x2c8005,'-C',_0x37c78b],{'label':'extract\x20'+_0x506408['filename']}),await rm(_0x44c894[_0x1bb11a(0x14e)+'WorkingD'+'ir'],{'recursive':!![],'force':!![]}),await rename(join(_0x37c78b,_0x1bb11a(0x23c)),_0x44c894[_0x1bb11a(0x14e)+'WorkingD'+'ir']),await rm(_0x37c78b,{'recursive':!![],'force':!![]}),await runProcess(_0x44c894[_0x1bb11a(0x1ad)+_0x1bb11a(0x27f)],[_0x44c894[_0x1bb11a(0x16d)],_0x1bb11a(0x247),_0x1bb11a(0x1bd)+'ev','--omit=p'+_0x1bb11a(0x1b3),_0x1bb11a(0x155)+'it',_0x1bb11a(0x177)+'d','--legacy'+_0x1bb11a(0x1a5)+'ps'],{'cwd':_0x44c894[_0x1bb11a(0x14e)+_0x1bb11a(0x1ef)+'ir'],'env':_0x27b4e3,'label':'npm\x20inst'+'all\x20'+_0x234d2f+(_0x1bb11a(0x201)+_0x1bb11a(0x256)+_0x1bb11a(0x245))});if(!existsSync(_0x44c894['openclaw'+'Bin']))throw new Error(_0x1bb11a(0x1b0)+_0x1bb11a(0x186)+_0x1bb11a(0x1af)+_0x1bb11a(0x279)+'\x20install'+':\x20'+_0x44c894['openclaw'+_0x1bb11a(0x1de)]);}async function ensureRuntimeBase(_0x53a3bf,_0x5b6f99,_0x299d75={}){const _0x24ca0b=_0x52cc87;await mkdir(_0x5b6f99,{'recursive':!![]});let _0x247c9a=await readRuntimeManifest(_0x5b6f99);const _0x1d9a4d=_0x53a3bf['openclaw'][_0x24ca0b(0x246)+_0x24ca0b(0x269)],_0x28dbd8=_0x53a3bf[_0x24ca0b(0x14e)]['openclaw'+_0x24ca0b(0x221)],_0x1780eb=existsSync(resolveManifestPath(_0x5b6f99)),_0x41c11c=runtimeHasRequiredPaths(_0x5b6f99,_0x247c9a),_0x11ca96=_0x247c9a[_0x24ca0b(0x246)+_0x24ca0b(0x269)]===_0x1d9a4d;!_0x1780eb||!_0x41c11c||!_0x11ca96?(_0x299d75[_0x24ca0b(0x17d)+'ogger']?.[_0x24ca0b(0x28e)]('runtime\x20'+_0x24ca0b(0x162)+_0x24ca0b(0x25e)+'ed',{'runtimeRoot':_0x5b6f99,'reason':!_0x1780eb?_0x24ca0b(0x238)+_0x24ca0b(0x27e):!_0x41c11c?_0x24ca0b(0x238)+_0x24ca0b(0x1ab)+_0x24ca0b(0x201)+_0x24ca0b(0x237):_0x24ca0b(0x17f)+_0x24ca0b(0x251)+'match','syncOnly':_0x299d75['syncOnly']}),_0x247c9a=await buildRuntimeBase(_0x53a3bf,_0x5b6f99,_0x247c9a),_0x299d75[_0x24ca0b(0x17d)+_0x24ca0b(0x1a3)]?.[_0x24ca0b(0x28e)](_0x24ca0b(0x211)+_0x24ca0b(0x162)+'ld\x20compl'+'eted',{'manifest':summarizeRuntimeManifest(_0x247c9a)})):_0x299d75[_0x24ca0b(0x17d)+_0x24ca0b(0x1a3)]?.[_0x24ca0b(0x28e)](_0x24ca0b(0x211)+_0x24ca0b(0x187)+_0x24ca0b(0x1df)+_0x24ca0b(0x208),{'manifest':summarizeRuntimeManifest(_0x247c9a)});if(!existsSync(resolve(_0x5b6f99,_0x247c9a[_0x24ca0b(0x14e)+_0x24ca0b(0x1de)]))){const _0x2d2d0a=createRuntimeInfoFromManifest(_0x5b6f99,_0x247c9a,{'allowMissingOpenClaw':!![]});await installOpenClawPackage(_0x2d2d0a,_0x28dbd8),_0x247c9a[_0x24ca0b(0x14e)+_0x24ca0b(0x221)]=_0x28dbd8;}return _0x247c9a;}function runtimeHasRequiredPaths(_0x2bccfe,_0x21cdd4){const _0x3f346f=_0x52cc87;return[_0x3f346f(0x1ad)+_0x3f346f(0x27f),'npmCli',_0x3f346f(0x14e)+_0x3f346f(0x1ef)+'ir',_0x3f346f(0x14e)+_0x3f346f(0x1de)][_0x3f346f(0x28d)](_0x222fa4=>typeof _0x21cdd4[_0x222fa4]===_0x3f346f(0x1f6)&&_0x21cdd4[_0x222fa4]['trim']())&&['nodeExec'+_0x3f346f(0x27f),_0x3f346f(0x16d)][_0x3f346f(0x28d)](_0x50425a=>existsSync(resolve(_0x2bccfe,_0x21cdd4[_0x50425a])));}async function buildRuntimeBase(_0x2d1d4a,_0x2d8006,_0x44c8e5={}){const _0x686cab=_0x52cc87,_0x477297=join(_0x2d8006,_0x686cab(0x189));await ensureRuntimeNode(_0x2d1d4a,_0x477297);const _0x2fd614={..._0x44c8e5,'generatedAt':new Date()[_0x686cab(0x216)+'ing'](),'nodeVersion':_0x2d1d4a[_0x686cab(0x14e)][_0x686cab(0x246)+_0x686cab(0x269)],'openclawVersion':_0x44c8e5[_0x686cab(0x14e)+'Version']||'','platform':process['platform'],'arch':process[_0x686cab(0x179)],'nodeExecutable':'node/bin'+_0x686cab(0x16e),'npmCli':'node/lib'+_0x686cab(0x25a)+_0x686cab(0x198)+_0x686cab(0x15f)+_0x686cab(0x264),'openclawWorkingDir':_0x686cab(0x14e),'openclawBin':_0x686cab(0x14e)+_0x686cab(0x158)+_0x686cab(0x170)};return await writeJson(resolveManifestPath(_0x2d8006),_0x2fd614),_0x2fd614;}async function ensureRuntimeNode(_0x1cec61,_0x2f51ec){const _0x2bb09f=_0x52cc87,_0x1b9055=_0x1cec61[_0x2bb09f(0x14e)][_0x2bb09f(0x246)+_0x2bb09f(0x269)],_0x2eebbb=join(_0x2f51ec,_0x2bb09f(0x1c9),_0x2bb09f(0x189)),_0x380cbb=join(_0x2f51ec,_0x2bb09f(0x23e),'node_mod'+_0x2bb09f(0x1b7),_0x2bb09f(0x18d),'bin',_0x2bb09f(0x1fd)+'js');if(existsSync(_0x2eebbb)&&existsSync(_0x380cbb)&&await getNodeVersion(_0x2eebbb)===_0x1b9055)return;await rm(_0x2f51ec,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96});if(process[_0x2bb09f(0x202)][_0x2bb09f(0x189)]===_0x1b9055){await linkCurrentNodeRuntime(_0x2f51ec);return;}await downloadNodeRuntime(_0x1b9055,_0x2f51ec);}async function getNodeVersion(_0xb51c4e){const _0x5a082f=_0x52cc87;try{const _0x2ec5ba=await runProcess(_0xb51c4e,['-p','process.'+'versions'+_0x5a082f(0x1c1)],{'label':_0xb51c4e+'\x20version','timeoutMs':0x7530});return _0x2ec5ba[_0x5a082f(0x1cd)][_0x5a082f(0x1ea)]();}catch{return'';}}async function linkCurrentNodeRuntime(_0x1f1590){const _0x3eafd7=_0x52cc87,_0x5041a3=process[_0x3eafd7(0x1be)],_0x50b302=resolve(dirname(_0x5041a3),'..'),_0x1009a1=resolve(_0x50b302,_0x3eafd7(0x1da)+_0x3eafd7(0x1c7)+_0x3eafd7(0x1f5)),_0x22cf49=join(_0x1f1590,'bin',_0x3eafd7(0x189)),_0x3c95ef=join(_0x1f1590,_0x3eafd7(0x23e),_0x3eafd7(0x21c)+'ules','npm');await mkdir(dirname(_0x22cf49),{'recursive':!![]}),await mkdir(dirname(_0x3c95ef),{'recursive':!![]}),await symlink(_0x5041a3,_0x22cf49),existsSync(_0x1009a1)?await symlink(_0x1009a1,_0x3c95ef):await symlink(await resolveNpmRoot(),_0x3c95ef);}async function resolveNpmRoot(){const _0x58360b=_0x52cc87,_0x3763d8=await runProcess(_0x58360b(0x18d),['root','-g'],{'label':_0x58360b(0x1d5)+_0x58360b(0x1b5),'timeoutMs':0x7530}),_0x41ee2a=join(_0x3763d8['stdout'][_0x58360b(0x1ea)](),_0x58360b(0x18d));if(!existsSync(join(_0x41ee2a,'bin',_0x58360b(0x1fd)+'js')))throw new Error(_0x58360b(0x160)+'age\x20was\x20'+_0x58360b(0x210)+_0x58360b(0x225)+'cal\x20runt'+_0x58360b(0x283)+_0x58360b(0x1a2)+_0x41ee2a);return _0x41ee2a;}async function downloadNodeRuntime(_0x48e32a,_0x4e9bd5){const _0x11bc22=_0x52cc87,_0x173292=process['platform']===_0x11bc22(0x252)?'win':process[_0x11bc22(0x239)],_0x14a4e3=process[_0x11bc22(0x179)]===_0x11bc22(0x266)?_0x11bc22(0x266):process[_0x11bc22(0x179)]===_0x11bc22(0x156)?_0x11bc22(0x156):process['arch'],_0x16dbbb=process[_0x11bc22(0x239)]===_0x11bc22(0x252)?_0x11bc22(0x240):_0x11bc22(0x22a),_0x5c3a12=_0x11bc22(0x24f)+_0x48e32a+'-'+_0x173292+'-'+_0x14a4e3,_0x5eb008=_0x5c3a12+'.'+_0x16dbbb,_0x4b6bde=join(dirname(_0x4e9bd5),_0x11bc22(0x267)),_0x31ff99=join(_0x4b6bde,_0x5eb008),_0x3a0554=join(_0x4b6bde,_0x5c3a12+(_0x11bc22(0x272)+'-')+process['pid']+'-'+Date['now']()),_0x29d6e3=_0x11bc22(0x228)+_0x11bc22(0x17c)+_0x11bc22(0x16f)+'v'+_0x48e32a+'/'+_0x5eb008;await mkdir(_0x4b6bde,{'recursive':!![]}),!existsSync(_0x31ff99)&&(console[_0x11bc22(0x17a)](_0x11bc22(0x1d2)+'hell:run'+_0x11bc22(0x281)+'wnloadin'+'g\x20'+_0x29d6e3),await downloadFile(_0x29d6e3,_0x31ff99)),await rm(_0x3a0554,{'recursive':!![],'force':!![]}),await mkdir(_0x3a0554,{'recursive':!![]}),process[_0x11bc22(0x239)]===_0x11bc22(0x252)?await runProcess('unzip',['-q',_0x31ff99,'-d',_0x3a0554],{'label':_0x11bc22(0x242)+_0x5eb008}):await runProcess(_0x11bc22(0x1dd),[_0x11bc22(0x1eb),_0x31ff99,'-C',_0x3a0554],{'label':_0x11bc22(0x242)+_0x5eb008}),await rename(join(_0x3a0554,_0x5c3a12),_0x4e9bd5),await rm(_0x3a0554,{'recursive':!![],'force':!![]});}async function downloadFile(_0x439450,_0x223654){await mkdir(dirname(_0x223654),{'recursive':!![]});const _0x329ed8=await new Promise((_0x1a13b4,_0x442eb9)=>{const _0x2d6799=_0x2db8;get(_0x439450,_0x541b2d=>{const _0x754375=_0x2db8;if(_0x541b2d['statusCo'+'de']>=0x12c&&_0x541b2d[_0x754375(0x1e6)+'de']<0x190&&_0x541b2d[_0x754375(0x172)][_0x754375(0x282)]){_0x541b2d[_0x754375(0x1a0)](),downloadFile(new URL(_0x541b2d['headers']['location'],_0x439450)['href'],_0x223654)['then'](()=>_0x1a13b4(null))[_0x754375(0x27d)](_0x442eb9);return;}if(_0x541b2d[_0x754375(0x1e6)+'de']!==0xc8){_0x541b2d[_0x754375(0x1a0)](),_0x442eb9(new Error(_0x754375(0x14f)+_0x754375(0x20f)+_0x541b2d[_0x754375(0x1e6)+'de']+':\x20'+_0x439450));return;}_0x1a13b4(_0x541b2d);})['on'](_0x2d6799(0x1ee),_0x442eb9);});_0x329ed8&&await pipeline(_0x329ed8,createWriteStream(_0x223654));}export async function ensureOpenClawDoctorFixed(_0x3008aa,_0x401bbf={}){const _0x5124b6=_0x52cc87,_0x43e6b5=await loadRuntimeInfo(_0x3008aa['projectR'+_0x5124b6(0x16a)]),_0x56a9cc=getConfigPaths(_0x3008aa),_0x417bfa=join(_0x56a9cc[_0x5124b6(0x1d0)+_0x5124b6(0x203)],_0x5124b6(0x14e)+_0x5124b6(0x280)+_0x5124b6(0x22e)),_0x58fe56=await readJson(_0x417bfa,{});if(_0x58fe56['openclaw'+_0x5124b6(0x221)]===_0x43e6b5[_0x5124b6(0x14e)+_0x5124b6(0x221)])return _0x401bbf[_0x5124b6(0x17d)+_0x5124b6(0x1a3)]?.[_0x5124b6(0x28e)]('openclaw'+_0x5124b6(0x289)+_0x5124b6(0x164)+'ady\x20curr'+_0x5124b6(0x284),{'openclawVersion':_0x43e6b5[_0x5124b6(0x14e)+_0x5124b6(0x221)],'markerPath':_0x417bfa}),{'ran':![],'openclawVersion':_0x43e6b5[_0x5124b6(0x14e)+'Version'],'markerPath':_0x417bfa};return await runOpenClawDoctorFix(_0x3008aa,_0x43e6b5,{'fromVersion':_0x58fe56['openclaw'+_0x5124b6(0x221)]||_0x5124b6(0x226),'toVersion':_0x43e6b5[_0x5124b6(0x14e)+_0x5124b6(0x221)],'markerPath':_0x417bfa,'runtimeLogger':_0x401bbf['runtimeL'+_0x5124b6(0x1a3)]}),{'ran':!![],'openclawVersion':_0x43e6b5[_0x5124b6(0x14e)+_0x5124b6(0x221)],'markerPath':_0x417bfa};}async function runOpenClawDoctorFix(_0x517d9d,_0x51b24e,{fromVersion:_0x1d5ebc,toVersion:_0xa19acb,markerPath:markerPath='',runtimeLogger:_0x5911ba}={}){const _0x5e58f3=_0x52cc87;_0x5911ba?.['info'](_0x5e58f3(0x14e)+_0x5e58f3(0x289)+_0x5e58f3(0x212)+'ted',{'fromVersion':_0x1d5ebc,'toVersion':_0xa19acb});const _0x407a61=await createRuntimeEnv(_0x51b24e,{'OPENCLAW_HOME':_0x517d9d[_0x5e58f3(0x18f)],'OPENCLAW_STATE_DIR':_0x517d9d[_0x5e58f3(0x18f)],'OPENCLAW_CONFIG_PATH':getConfigPaths(_0x517d9d)[_0x5e58f3(0x1cc)+'th']});console[_0x5e58f3(0x17a)](_0x5e58f3(0x1d2)+_0x5e58f3(0x1ed)+'time]\x20ru'+_0x5e58f3(0x167)+'enclaw\x20d'+_0x5e58f3(0x1c6)+'fix');const _0x38c201=await runProcess(_0x51b24e[_0x5e58f3(0x1ad)+_0x5e58f3(0x27f)],[_0x51b24e[_0x5e58f3(0x14e)+_0x5e58f3(0x1de)],_0x5e58f3(0x191),_0x5e58f3(0x24e)],{'cwd':_0x51b24e[_0x5e58f3(0x14e)+_0x5e58f3(0x1ef)+'ir'],'env':_0x407a61,'label':_0x5e58f3(0x14e)+_0x5e58f3(0x289)+_0x5e58f3(0x24e),'timeoutMs':0x1d4c0});_0x5911ba?.[_0x5e58f3(0x28e)](_0x5e58f3(0x14e)+_0x5e58f3(0x289)+_0x5e58f3(0x1ae)+_0x5e58f3(0x197),{'fromVersion':_0x1d5ebc,'toVersion':_0xa19acb,'stdout':_0x38c201[_0x5e58f3(0x1cd)][_0x5e58f3(0x1ea)]()[_0x5e58f3(0x219)](-0xfa0),'stderr':_0x38c201[_0x5e58f3(0x1d6)][_0x5e58f3(0x1ea)]()[_0x5e58f3(0x219)](-0xfa0)}),markerPath&&(await writeJson(markerPath,{'openclawVersion':_0x51b24e[_0x5e58f3(0x14e)+'Version'],'fixedAt':new Date()[_0x5e58f3(0x216)+_0x5e58f3(0x1ff)]()}),_0x5911ba?.['info'](_0x5e58f3(0x14e)+_0x5e58f3(0x289)+_0x5e58f3(0x1fc)+_0x5e58f3(0x178)+'en',{'markerPath':markerPath,'openclawVersion':_0x51b24e['openclaw'+_0x5e58f3(0x221)]}));}export async function readRuntimeManifest(_0x136611){return await readJson(resolveManifestPath(_0x136611),{});}export async function loadRuntimeInfo(_0x690016){const _0x270b04=resolveRuntimeRoot(_0x690016),_0x526504=await readRuntimeManifest(_0x270b04);return createRuntimeInfoFromManifest(_0x270b04,_0x526504);}function createRuntimeInfoFromManifest(_0x1e426e,_0x325c19,_0x3a3415={}){const _0x51926b=_0x52cc87;for(const _0x11a71c of[_0x51926b(0x1ad)+_0x51926b(0x27f),_0x51926b(0x16d),'openclaw'+_0x51926b(0x1ef)+'ir',_0x51926b(0x14e)+'Bin']){if(typeof _0x325c19[_0x11a71c]!==_0x51926b(0x1f6)||!_0x325c19[_0x11a71c][_0x51926b(0x1ea)]())throw new Error(_0x51926b(0x211)+_0x51926b(0x27e)+_0x51926b(0x24a)+'ing\x20\x22'+_0x11a71c+_0x51926b(0x224)+resolveManifestPath(_0x1e426e)+(_0x51926b(0x270)+'jie-shel'+_0x51926b(0x1fe)+'e'));}const _0x2c7ec2=resolve(_0x1e426e,_0x325c19[_0x51926b(0x1ad)+_0x51926b(0x27f)]),_0x511d99=resolve(_0x1e426e,_0x325c19[_0x51926b(0x16d)]),_0x35f5f0=resolve(_0x1e426e,_0x325c19['openclaw'+_0x51926b(0x1ef)+'ir']),_0x368ad1=resolve(_0x1e426e,_0x325c19[_0x51926b(0x14e)+'Bin']),_0x241e26=Array[_0x51926b(0x231)](_0x325c19['plugins'])?_0x325c19[_0x51926b(0x1e3)][_0x51926b(0x218)](_0xa9ebca=>({..._0xa9ebca,'installPath':resolve(_0x1e426e,_0xa9ebca['installP'+_0x51926b(0x151)])})):[],_0x33fd25=_0x3a3415[_0x51926b(0x1e1)+'singOpen'+_0x51926b(0x23f)]?[_0x2c7ec2,_0x511d99]:[_0x2c7ec2,_0x511d99,_0x35f5f0,_0x368ad1];for(const _0x1a6086 of _0x33fd25){if(!existsSync(_0x1a6086))throw new Error('runtime\x20'+_0x51926b(0x238)+_0x51926b(0x1e5)+_0x1a6086);}return{'runtimeRoot':_0x1e426e,'manifest':_0x325c19,'openclawVersion':_0x325c19[_0x51926b(0x14e)+_0x51926b(0x221)]||_0x51926b(0x226),'nodeExecutable':_0x2c7ec2,'npmCli':_0x511d99,'openclawWorkingDir':_0x35f5f0,'openclawBin':_0x368ad1,'plugins':_0x241e26};}export async function spawnClaw(_0x287354,_0x1effe4=[],_0x1edd8c={}){const _0x91cab3=_0x52cc87,_0x5eb215=await loadRuntimeInfo(_0x287354),_0x1da4d6=await createRuntimeEnv(_0x5eb215,_0x1edd8c[_0x91cab3(0x176)]??{});return spawn(_0x5eb215[_0x91cab3(0x1ad)+_0x91cab3(0x27f)],[_0x5eb215[_0x91cab3(0x14e)+'Bin'],..._0x1effe4],{'cwd':_0x5eb215[_0x91cab3(0x14e)+_0x91cab3(0x1ef)+'ir'],'stdio':_0x91cab3(0x234),..._0x1edd8c,'env':_0x1da4d6});}export async function runClawOnce(_0x1bfa2d,_0x6c35ce=[],_0x29c99d=0x15f90){const _0x2250ff=await spawnClaw(_0x1bfa2d,_0x6c35ce);return await new Promise((_0x51c318,_0x407936)=>{const _0x22e1b4=_0x2db8;let _0x3698c1='',_0x4cd9d5='',_0x1e038d=![];const _0x82b327=setTimeout(()=>{const _0x4ecaa6=_0x2db8;if(_0x1e038d)return;_0x1e038d=!![],_0x2250ff[_0x4ecaa6(0x192)](_0x4ecaa6(0x1f8)),_0x407936(new Error(_0x4ecaa6(0x14e)+_0x4ecaa6(0x20e)+_0x4ecaa6(0x15e)+'\x20'+_0x29c99d+'ms'));},_0x29c99d);_0x2250ff[_0x22e1b4(0x1cd)]['on'](_0x22e1b4(0x235),_0x4bee29=>{const _0x339ba5=_0x22e1b4;_0x3698c1+=_0x4bee29[_0x339ba5(0x1c4)]();}),_0x2250ff[_0x22e1b4(0x1d6)]['on']('data',_0x1eb2a0=>{const _0x172b7e=_0x22e1b4;_0x4cd9d5+=_0x1eb2a0[_0x172b7e(0x1c4)]();}),_0x2250ff['on']('error',_0x1749cc=>{if(_0x1e038d)return;_0x1e038d=!![],clearTimeout(_0x82b327),_0x407936(_0x1749cc);}),_0x2250ff['on'](_0x22e1b4(0x25c),(_0x21a164,_0x26efc6)=>{if(_0x1e038d)return;_0x1e038d=!![],clearTimeout(_0x82b327),_0x51c318({'code':_0x21a164,'signal':_0x26efc6,'stdout':_0x3698c1,'stderr':_0x4cd9d5});});});}async function createRuntimeEnv(_0x39a27e,_0x2e4f41={}){const _0x1fef14=_0x52cc87,_0x524e7d=process.env.OPENCLAW_STATE_DIR||'',_0x2a8dd1=_0x524e7d?join(_0x524e7d,'claw-run'+_0x1fef14(0x287)+'ls'):join(_0x39a27e[_0x1fef14(0x207)+'oot'],_0x1fef14(0x1f7)),_0x2a145d=join(_0x2a8dd1,_0x1fef14(0x16c)+'al'),_0x55efb3=join(_0x2a8dd1,_0x1fef14(0x214)+'e'),_0x64f66a=join(_0x2a145d,'bin');await mkdir(_0x64f66a,{'recursive':!![]}),await mkdir(_0x55efb3,{'recursive':!![]});const _0x3aad40=[_0x64f66a,dirname(_0x39a27e['nodeExec'+_0x1fef14(0x27f)]),process.env.PATH||''];return{...process.env,..._0x2e4f41,'PATH':_0x3aad40[_0x1fef14(0x180)](Boolean)['join'](delimiter),'npm_config_prefix':_0x2a145d,'NPM_CONFIG_PREFIX':_0x2a145d,'npm_config_cache':_0x55efb3,'NPM_CONFIG_CACHE':_0x55efb3,'npm_config_registry':_0x1fef14(0x228)+_0x1fef14(0x286)+_0x1fef14(0x255)+'rg/','NPM_CONFIG_REGISTRY':_0x1fef14(0x228)+_0x1fef14(0x286)+_0x1fef14(0x255)+_0x1fef14(0x1a8),'npm_execpath':_0x39a27e[_0x1fef14(0x16d)],'npm_node_execpath':_0x39a27e[_0x1fef14(0x1ad)+'utable'],'OPENCLAW_RUNTIME_NPM_PREFIX':_0x2a145d,'OPENCLAW_RUNTIME_NPM_BIN':_0x64f66a,'OPENCLAW_RUNTIME_NPM_REGISTRY':_0x1fef14(0x228)+_0x1fef14(0x286)+'.npmjs.o'+'rg/'};}async function syncProductPlugins(_0x31b212,_0x71c37,_0x25d6da){const _0x46be36=_0x52cc87,_0x107cbe=join(_0x71c37,_0x46be36(0x14e),'dist',_0x46be36(0x1d4)+'ns'),_0x42e2a8=[];for(const _0x5cecb1 of _0x31b212['openclaw']['resolved'+_0x46be36(0x1cb)+_0x46be36(0x174)]){const _0x22c5bd=await getPackageMetadata(_0x5cecb1),_0x3a6246=await readPluginManifest(_0x5cecb1),_0xc8fc19=join(_0x107cbe,_0x22c5bd[_0x46be36(0x275)]);await copyDirFresh(_0x5cecb1,_0xc8fc19),_0x42e2a8['push']({'pluginId':_0x22c5bd[_0x46be36(0x275)],'source':_0x46be36(0x19e),'spec':_0x46be36(0x271)+_0x5cecb1,'installPath':toRuntimeRelative(_0x71c37,_0xc8fc19),'version':_0x22c5bd[_0x46be36(0x236)],'resolvedName':_0x22c5bd[_0x46be36(0x1b4)],'resolvedVersion':_0x22c5bd[_0x46be36(0x236)],'resolvedSpec':_0x46be36(0x271)+_0x5cecb1,'integrity':'','shasum':'','resolvedAt':new Date()[_0x46be36(0x216)+'ing'](),'installedAt':new Date()['toISOStr'+_0x46be36(0x1ff)](),'agentScope':_0x3a6246[_0x46be36(0x273)+'pe'],'skills':_0x3a6246[_0x46be36(0x233)]});}const _0x1b221b=new Set(_0x42e2a8[_0x46be36(0x218)](_0xe1e9cc=>_0xe1e9cc[_0x46be36(0x275)])),_0x25f728=Array[_0x46be36(0x231)](_0x25d6da['plugins'])?_0x25d6da[_0x46be36(0x1e3)]['filter'](_0x5092ec=>!_0x1b221b['has'](_0x5092ec[_0x46be36(0x275)])):[];_0x25d6da[_0x46be36(0x1e3)]=[..._0x25f728,..._0x42e2a8];}async function syncManifestPluginScope(_0x3f9818,_0x1ec191,_0x258a19){const _0x4511f8=_0x52cc87,_0x2b5c6a=join(_0x1ec191,_0x4511f8(0x14e),_0x4511f8(0x1d1),_0x4511f8(0x1d4)+'ns'),_0x11b5fc=new Set(_0x3f9818[_0x4511f8(0x14e)]['pluginSp'+_0x4511f8(0x1fa)]??[]),_0x118866=new Set([..._0x11b5fc][_0x4511f8(0x218)](_0x44c7a3=>_0x44c7a3[_0x4511f8(0x1c8)](/^npm:/,''))[_0x4511f8(0x218)](_0x527718=>{const _0x18e546=_0x4511f8;if(_0x527718['startsWi'+'th']('@')){const _0x3f60b1=_0x527718['split']('@');return _0x3f60b1[_0x18e546(0x152)]>=0x3?'@'+_0x3f60b1[0x1]:_0x527718;}return _0x527718['split']('@')[0x0];})[_0x4511f8(0x180)](Boolean)),_0x7a7419=new Set();for(const _0x45bcb2 of _0x3f9818['openclaw'][_0x4511f8(0x188)+_0x4511f8(0x1cb)+_0x4511f8(0x174)]){const _0x275f28=await getPackageMetadata(_0x45bcb2);if(_0x275f28['pluginId'])_0x7a7419[_0x4511f8(0x19b)](_0x275f28[_0x4511f8(0x275)]);}const _0xd66cfb=Array[_0x4511f8(0x231)](_0x258a19[_0x4511f8(0x1e3)])?_0x258a19['plugins']:[];_0x258a19[_0x4511f8(0x1e4)+'ecs']=[..._0x3f9818[_0x4511f8(0x14e)][_0x4511f8(0x1e4)+_0x4511f8(0x1fa)],..._0x3f9818[_0x4511f8(0x14e)][_0x4511f8(0x188)+'LocalPlu'+_0x4511f8(0x174)][_0x4511f8(0x218)](_0x3577ad=>_0x4511f8(0x271)+_0x3577ad)],_0x258a19[_0x4511f8(0x1e3)]=_0xd66cfb[_0x4511f8(0x180)](_0x145a27=>{const _0x4e2f26=_0x4511f8;if(!_0x145a27||typeof _0x145a27!==_0x4e2f26(0x1b1))return![];if(_0x145a27[_0x4e2f26(0x260)]===_0x4e2f26(0x19e))return _0x7a7419['has'](_0x145a27[_0x4e2f26(0x275)]);if(_0x145a27[_0x4e2f26(0x260)]===_0x4e2f26(0x18d))return _0x11b5fc[_0x4e2f26(0x22c)](_0x145a27[_0x4e2f26(0x153)])||_0x11b5fc[_0x4e2f26(0x22c)](_0x145a27[_0x4e2f26(0x188)+_0x4e2f26(0x1b2)])||_0x118866['has'](_0x145a27[_0x4e2f26(0x188)+_0x4e2f26(0x220)]);return![];});const _0x8ffe07=new Set(_0x258a19[_0x4511f8(0x1e3)]['map'](_0x4bca75=>_0x4bca75[_0x4511f8(0x275)]));for(const _0x3c1298 of _0xd66cfb){if(!_0x3c1298[_0x4511f8(0x275)]||_0x8ffe07[_0x4511f8(0x22c)](_0x3c1298['pluginId']))continue;const _0x4853c6=typeof _0x3c1298['installP'+_0x4511f8(0x151)]===_0x4511f8(0x1f6)&&_0x3c1298[_0x4511f8(0x20d)+_0x4511f8(0x151)][_0x4511f8(0x1ea)]()?resolve(_0x1ec191,_0x3c1298[_0x4511f8(0x20d)+_0x4511f8(0x151)]):join(_0x2b5c6a,_0x3c1298['pluginId']),_0x3af9bc=relative(_0x2b5c6a,_0x4853c6);if(_0x3af9bc['startsWi'+'th']('..')||_0x3af9bc==='')continue;await rm(_0x4853c6,{'recursive':!![],'force':!![]});}}async function syncProductAgents(_0x174a12,_0x55669f,_0x2a2383){const _0x520967=_0x52cc87,_0x16ec61=join(_0x55669f,_0x520967(0x14e),_0x520967(0x27c));await copyDirFresh(_0x174a12[_0x520967(0x14e)][_0x520967(0x1f3)+'r'],_0x16ec61),_0x2a2383['agents']={'source':_0x520967(0x163),'installPath':toRuntimeRelative(_0x55669f,_0x16ec61)};}function _0x2db8(_0x37039b,_0x85e0c7){_0x37039b=_0x37039b-0x14e;const _0x3e1c12=_0x3e1c();let _0x2db8dc=_0x3e1c12[_0x37039b];return _0x2db8dc;}async function syncProductSkills(_0xb957f,_0x239599,_0x42b32f){const _0xcdff3d=_0x52cc87,_0x3ad944=join(_0x239599,_0xcdff3d(0x14e),_0xcdff3d(0x233));await copyDirFresh(_0xb957f['openclaw'][_0xcdff3d(0x1f0)+'r'],_0x3ad944),_0x42b32f['skills']={'source':'product','installPath':toRuntimeRelative(_0x239599,_0x3ad944)};}
@@ -1 +1 @@
1
- function _0x3a65(_0x4bb7f5,_0xab1f35){_0x4bb7f5=_0x4bb7f5-0x163;const _0x586bc6=_0x586b();let _0x3a650d=_0x586bc6[_0x4bb7f5];return _0x3a650d;}(function(_0x3ec189,_0x306e33){const _0x2ea3d8=_0x3a65,_0x118248=_0x3ec189();while(!![]){try{const _0x452b01=parseInt(_0x2ea3d8(0x173))/0x1*(parseInt(_0x2ea3d8(0x16e))/0x2)+parseInt(_0x2ea3d8(0x16d))/0x3*(-parseInt(_0x2ea3d8(0x177))/0x4)+parseInt(_0x2ea3d8(0x165))/0x5+-parseInt(_0x2ea3d8(0x170))/0x6*(-parseInt(_0x2ea3d8(0x17a))/0x7)+parseInt(_0x2ea3d8(0x16a))/0x8+parseInt(_0x2ea3d8(0x17c))/0x9+-parseInt(_0x2ea3d8(0x171))/0xa;if(_0x452b01===_0x306e33)break;else _0x118248['push'](_0x118248['shift']());}catch(_0x58318e){_0x118248['push'](_0x118248['shift']());}}}(_0x586b,0xdef23));import{existsSync}from'node:fs';import{cp,mkdir,readFile,readdir,rm,stat,writeFile}from'node:fs/promises';import{basename,dirname,join,relative}from'node:path';function _0x586b(){const _0x6da628=['isDirect','filter','6794320kcZTeT','isArray','name','4993818CveGJV','1173734bhyOxH','map','140226JpMFnh','17147920sAtLIe','string','1PaIDpZ','package.','utf8','.plugin.','4qPxzeQ','stringif','replaceA','511VlHcoB','ory','5208588mtZcKK','json','openclaw','2858065WpIqHh','trim','object'];_0x586b=function(){return _0x6da628;};return _0x586b();}export function asRecord(_0x1a1fd4){const _0x8e9c87=_0x3a65;return _0x1a1fd4&&typeof _0x1a1fd4===_0x8e9c87(0x167)&&!Array[_0x8e9c87(0x16b)](_0x1a1fd4)?_0x1a1fd4:{};}export function asStringArray(_0x15dbda){const _0x4bf78f=_0x3a65;return Array['isArray'](_0x15dbda)?_0x15dbda['filter'](_0x587225=>typeof _0x587225===_0x4bf78f(0x172)&&_0x587225[_0x4bf78f(0x166)]())[_0x4bf78f(0x16f)](_0x51eb15=>_0x51eb15[_0x4bf78f(0x166)]()):[];}export function dedupeStrings(_0x3878b0){const _0xe4cf86=_0x3a65;return[...new Set(_0x3878b0[_0xe4cf86(0x169)](Boolean))];}export function getTrimmedString(_0x29847e){const _0x141af4=_0x3a65;return typeof _0x29847e===_0x141af4(0x172)?_0x29847e[_0x141af4(0x166)]():'';}export async function readJson(_0xe61177,_0x419c9a={}){const _0x1f7a7c=_0x3a65;try{return JSON['parse'](await readFile(_0xe61177,_0x1f7a7c(0x175)));}catch{return _0x419c9a;}}export async function writeJson(_0x5a9b32,_0x450867){const _0x5897c5=_0x3a65;await mkdir(dirname(_0x5a9b32),{'recursive':!![]}),await writeFile(_0x5a9b32,JSON[_0x5897c5(0x178)+'y'](_0x450867,null,0x2)+'\x0a',_0x5897c5(0x175));}export async function copyDirFresh(_0x1f99a5,_0x3d88f2){await rm(_0x3d88f2,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await mkdir(dirname(_0x3d88f2),{'recursive':!![]}),await cp(_0x1f99a5,_0x3d88f2,{'recursive':!![]});}export async function ensureDir(_0x2ea847){await mkdir(_0x2ea847,{'recursive':!![]});}export function pathExists(_0x51fc0e){return existsSync(_0x51fc0e);}export async function listDirs(_0x9b2681){const _0x42bc91=_0x3a65;try{const _0x1e1fb4=await readdir(_0x9b2681,{'withFileTypes':!![],'encoding':_0x42bc91(0x175)});return _0x1e1fb4['filter'](_0x549c49=>_0x549c49[_0x42bc91(0x168)+_0x42bc91(0x17b)]())[_0x42bc91(0x16f)](_0x21fc29=>_0x21fc29[_0x42bc91(0x16c)]);}catch{return[];}}export async function getPackageMetadata(_0x2317fc){const _0x1a7e9c=_0x3a65,_0x200428=await readJson(join(_0x2317fc,_0x1a7e9c(0x174)+'json'),{}),_0x338cd4=asRecord(_0x200428['openclaw']);return{'name':getTrimmedString(_0x200428[_0x1a7e9c(0x16c)])||basename(_0x2317fc),'version':getTrimmedString(_0x200428['version'])||'0.0.0','pluginId':getTrimmedString(_0x338cd4['id'])||getTrimmedString(_0x200428[_0x1a7e9c(0x164)+'Id'])||basename(_0x2317fc)};}export async function readPluginManifest(_0x5d687e){const _0x375fbe=_0x3a65,_0x56586a=join(_0x5d687e,_0x375fbe(0x164)+_0x375fbe(0x176)+_0x375fbe(0x163)),_0x58d589=await readJson(_0x56586a,{});return asRecord(_0x58d589);}export async function hasFile(_0x222297){try{const _0x1d1c47=await stat(_0x222297);return _0x1d1c47['isFile']();}catch{return![];}}export function toRuntimeRelative(_0x1baba5,_0xa17811){const _0x2ec0d3=_0x3a65;return relative(_0x1baba5,_0xa17811)[_0x2ec0d3(0x179)+'ll']('\x5c','/');}
1
+ function _0x4a16(){const _0x27704a=['parse','1070547NfUxqw','map','ory','filter','1344332DzhHBH','3538476aCQNVf','isArray','isDirect','trim','openclaw','package.','1878738bFFOnN','utf8','stringif','name','object','4856310oWUsAL','5dfbPfT','replaceA','string','3440DQpsQt','50872QPnHeH','18477jxHMkS','.plugin.','203YDCWKH','json'];_0x4a16=function(){return _0x27704a;};return _0x4a16();}(function(_0x5bc940,_0x277b60){const _0x39254a=_0x4c86,_0x41736b=_0x5bc940();while(!![]){try{const _0x52b471=-parseInt(_0x39254a(0x1e2))/0x1+parseInt(_0x39254a(0x1e6))/0x2+parseInt(_0x39254a(0x1ed))/0x3+-parseInt(_0x39254a(0x1e7))/0x4+-parseInt(_0x39254a(0x1f3))/0x5*(-parseInt(_0x39254a(0x1f2))/0x6)+parseInt(_0x39254a(0x1df))/0x7*(-parseInt(_0x39254a(0x1dc))/0x8)+-parseInt(_0x39254a(0x1dd))/0x9*(-parseInt(_0x39254a(0x1db))/0xa);if(_0x52b471===_0x277b60)break;else _0x41736b['push'](_0x41736b['shift']());}catch(_0x4491c5){_0x41736b['push'](_0x41736b['shift']());}}}(_0x4a16,0xa4a94));import{existsSync}from'node:fs';import{cp,mkdir,readFile,readdir,rm,stat,writeFile}from'node:fs/promises';import{basename,dirname,join,relative}from'node:path';export function asRecord(_0xd37e8c){const _0x5908cb=_0x4c86;return _0xd37e8c&&typeof _0xd37e8c===_0x5908cb(0x1f1)&&!Array[_0x5908cb(0x1e8)](_0xd37e8c)?_0xd37e8c:{};}export function asStringArray(_0x10c538){const _0x181702=_0x4c86;return Array[_0x181702(0x1e8)](_0x10c538)?_0x10c538[_0x181702(0x1e5)](_0x28a60b=>typeof _0x28a60b===_0x181702(0x1da)&&_0x28a60b[_0x181702(0x1ea)]())[_0x181702(0x1e3)](_0x180176=>_0x180176['trim']()):[];}export function dedupeStrings(_0x362ffc){const _0x4b7d03=_0x4c86;return[...new Set(_0x362ffc[_0x4b7d03(0x1e5)](Boolean))];}export function getTrimmedString(_0xb6ae92){const _0x16d540=_0x4c86;return typeof _0xb6ae92===_0x16d540(0x1da)?_0xb6ae92['trim']():'';}export async function readJson(_0x7bcdf1,_0x1f67e1={}){const _0x50f7e0=_0x4c86;try{return JSON[_0x50f7e0(0x1e1)](await readFile(_0x7bcdf1,_0x50f7e0(0x1ee)));}catch{return _0x1f67e1;}}export async function writeJson(_0x301e08,_0xc24d43){const _0x10e98e=_0x4c86;await mkdir(dirname(_0x301e08),{'recursive':!![]}),await writeFile(_0x301e08,JSON[_0x10e98e(0x1ef)+'y'](_0xc24d43,null,0x2)+'\x0a',_0x10e98e(0x1ee));}export async function copyDirFresh(_0x396361,_0x29eb6e){await rm(_0x29eb6e,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await mkdir(dirname(_0x29eb6e),{'recursive':!![]}),await cp(_0x396361,_0x29eb6e,{'recursive':!![]});}export async function ensureDir(_0x3e0df2){await mkdir(_0x3e0df2,{'recursive':!![]});}export function pathExists(_0x3642d1){return existsSync(_0x3642d1);}export async function listDirs(_0xfc74a9){const _0x36a727=_0x4c86;try{const _0x4f6f9f=await readdir(_0xfc74a9,{'withFileTypes':!![],'encoding':'utf8'});return _0x4f6f9f['filter'](_0x273568=>_0x273568[_0x36a727(0x1e9)+_0x36a727(0x1e4)]())['map'](_0x259c64=>_0x259c64[_0x36a727(0x1f0)]);}catch{return[];}}export async function getPackageMetadata(_0x510172){const _0x5c4aa3=_0x4c86,_0x562fc5=await readJson(join(_0x510172,_0x5c4aa3(0x1ec)+_0x5c4aa3(0x1e0)),{}),_0x545649=asRecord(_0x562fc5['openclaw']);return{'name':getTrimmedString(_0x562fc5['name'])||basename(_0x510172),'version':getTrimmedString(_0x562fc5['version'])||'0.0.0','pluginId':getTrimmedString(_0x545649['id'])||getTrimmedString(_0x562fc5[_0x5c4aa3(0x1eb)+'Id'])||basename(_0x510172)};}function _0x4c86(_0x427c98,_0x3d3230){_0x427c98=_0x427c98-0x1da;const _0x4a1659=_0x4a16();let _0x4c864d=_0x4a1659[_0x427c98];return _0x4c864d;}export async function readPluginManifest(_0x3efae4){const _0x1a7e06=_0x4c86,_0x3a9ec0=join(_0x3efae4,_0x1a7e06(0x1eb)+_0x1a7e06(0x1de)+'json'),_0x510265=await readJson(_0x3a9ec0,{});return asRecord(_0x510265);}export async function hasFile(_0x10836e){try{const _0x15ce79=await stat(_0x10836e);return _0x15ce79['isFile']();}catch{return![];}}export function toRuntimeRelative(_0x16c48e,_0x5622fe){const _0x124ac2=_0x4c86;return relative(_0x16c48e,_0x5622fe)[_0x124ac2(0x1f4)+'ll']('\x5c','/');}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wujie-shell/core",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "main": "dist/src/index.mjs",
6
6
  "exports": {
@@ -27,8 +27,8 @@
27
27
  "dependencies": {
28
28
  "get-port": "^7.2.0",
29
29
  "ws": "^8.20.0",
30
- "@wujie-shell/config": "0.1.4",
31
- "@wujie-shell/logger": "0.1.4"
30
+ "@wujie-shell/logger": "0.1.5",
31
+ "@wujie-shell/config": "0.1.5"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "node ../../scripts/build-packages.mjs --package @wujie-shell/core"