@wujie-shell/core 0.1.3 → 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 _0x27d58d=_0x2c58;(function(_0x39228e,_0x13a89d){const _0x2f02f3=_0x2c58,_0x4e1de3=_0x39228e();while(!![]){try{const _0x245575=parseInt(_0x2f02f3(0x1d6))/0x1*(-parseInt(_0x2f02f3(0x1f6))/0x2)+-parseInt(_0x2f02f3(0x1c0))/0x3+-parseInt(_0x2f02f3(0x1b2))/0x4+parseInt(_0x2f02f3(0x1b6))/0x5+parseInt(_0x2f02f3(0x19a))/0x6*(parseInt(_0x2f02f3(0x185))/0x7)+parseInt(_0x2f02f3(0x1eb))/0x8+-parseInt(_0x2f02f3(0x1e0))/0x9;if(_0x245575===_0x13a89d)break;else _0x4e1de3['push'](_0x4e1de3['shift']());}catch(_0x3377cd){_0x4e1de3['push'](_0x4e1de3['shift']());}}}(_0x6a36,0xc7804));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 _0x1cc090 from'ws';const ED25519_SPKI_PREFIX=Buffer[_0x27d58d(0x1cc)](_0x27d58d(0x18a)+_0x27d58d(0x169)+_0x27d58d(0x1e9),_0x27d58d(0x1a3)),BASE64_PADDING_REGEX=/=+$/g,UPPERCASE_ASCII_REGEX=/[A-Z]/g;function isRecord(_0x951c40){const _0x152aad=_0x27d58d;return Boolean(_0x951c40)&&typeof _0x951c40===_0x152aad(0x19c)&&!Array[_0x152aad(0x16f)](_0x951c40);}function formatUnknownError(_0x5195fe){if(_0x5195fe instanceof Error)return _0x5195fe['message'];return String(_0x5195fe??'');}function isLocalGatewayConnRefused(_0x15768f){const _0x1542bd=_0x27d58d,_0x5032a0=formatUnknownError(_0x15768f);return/\bECONNREFUSED\b/i[_0x1542bd(0x190)](_0x5032a0)&&/127\.0\.0\.1:\d+/['test'](_0x5032a0);}function base64UrlEncode(_0x44e6a0){const _0xff3d99=_0x27d58d;return _0x44e6a0[_0xff3d99(0x1c4)](_0xff3d99(0x1f1))['replaceA'+'ll']('+','-')[_0xff3d99(0x202)+'ll']('/','_')['replace'](BASE64_PADDING_REGEX,'');}function derivePublicKeyRaw(_0x3b0773){const _0x377020=_0x27d58d,_0xbd6514=createPublicKey(_0x3b0773)[_0x377020(0x1d1)]({'type':'spki','format':_0x377020(0x151)}),_0x3f9f84=Buffer['isBuffer'](_0xbd6514)?_0xbd6514:Buffer[_0x377020(0x1cc)](_0xbd6514),_0x4d0b1f=_0x3f9f84[_0x377020(0x14c)]===ED25519_SPKI_PREFIX['length']+0x20&&_0x3f9f84[_0x377020(0x1c5)](0x0,ED25519_SPKI_PREFIX[_0x377020(0x14c)])['equals'](ED25519_SPKI_PREFIX);return _0x4d0b1f?_0x3f9f84[_0x377020(0x1c5)](ED25519_SPKI_PREFIX[_0x377020(0x14c)]):_0x3f9f84;}function fingerprintPublicKey(_0x584bc2){const _0x1dea05=_0x27d58d;return createHash(_0x1dea05(0x1c2))[_0x1dea05(0x1e5)](derivePublicKeyRaw(_0x584bc2))[_0x1dea05(0x1ab)]('hex');}function publicKeyRawBase64UrlFromPem(_0x1da6f1){return base64UrlEncode(derivePublicKeyRaw(_0x1da6f1));}function signDevicePayload(_0x27da24,_0x2d69d7){const _0x358813=_0x27d58d,_0x4e5f94=createPrivateKey(_0x27da24);return base64UrlEncode(sign(null,Buffer[_0x358813(0x1cc)](_0x2d69d7,'utf8'),_0x4e5f94));}function normalizeDeviceMetadataForAuth(_0x2dd631){const _0x12a6f8=_0x27d58d,_0x18e26c=typeof _0x2dd631==='string'?_0x2dd631[_0x12a6f8(0x17a)]():'';if(!_0x18e26c)return'';return _0x18e26c['replace'](UPPERCASE_ASCII_REGEX,_0x252f11=>String[_0x12a6f8(0x1fc)+'Code'](_0x252f11[_0x12a6f8(0x1e8)+'At'](0x0)+0x20));}function buildDeviceAuthPayloadV3(_0x68b8db){const _0x451943=_0x27d58d;return['v3',_0x68b8db[_0x451943(0x1dc)],_0x68b8db[_0x451943(0x1f3)],_0x68b8db[_0x451943(0x175)+'de'],_0x68b8db['role'],_0x68b8db[_0x451943(0x154)]['join'](','),String(_0x68b8db[_0x451943(0x168)+'Ms']),_0x68b8db[_0x451943(0x1de)]??'',_0x68b8db[_0x451943(0x152)],normalizeDeviceMetadataForAuth(_0x68b8db[_0x451943(0x1a5)]),normalizeDeviceMetadataForAuth(_0x68b8db[_0x451943(0x159)+_0x451943(0x18c)])][_0x451943(0x1bf)]('|');}function writeIdentityFile(_0x4a8e79,_0x199e89,_0x3f7294){mkdirSync(dirname(_0x4a8e79),{'recursive':!![]}),writeFileSync(_0x4a8e79,JSON['stringif'+'y']({'version':0x1,..._0x199e89,'createdAtMs':_0x3f7294},null,0x2)+'\x0a',{'mode':0x180});try{chmodSync(_0x4a8e79,0x180);}catch{}}function generateDeviceIdentity(){const _0xee9bbe=_0x27d58d,{publicKey:_0xd77365,privateKey:_0x433ce8}=generateKeyPairSync(_0xee9bbe(0x1b1)),_0x68b636=_0xd77365[_0xee9bbe(0x1d1)]({'type':'spki','format':_0xee9bbe(0x160)})[_0xee9bbe(0x1c4)](),_0x14f372=_0x433ce8[_0xee9bbe(0x1d1)]({'type':'pkcs8','format':_0xee9bbe(0x160)})[_0xee9bbe(0x1c4)]();return{'deviceId':fingerprintPublicKey(_0x68b636),'publicKeyPem':_0x68b636,'privateKeyPem':_0x14f372};}function loadOrCreateDeviceIdentity(_0x1aa680){const _0x260fbe=_0x27d58d;if(existsSync(_0x1aa680))try{const _0x67a4a7=JSON[_0x260fbe(0x17f)](readFileSync(_0x1aa680,'utf8')),_0x52c468=typeof _0x67a4a7?.[_0x260fbe(0x16b)+_0x260fbe(0x18e)]==='string'?_0x67a4a7[_0x260fbe(0x16b)+'yPem']:'',_0x7ae7e=typeof _0x67a4a7?.['privateK'+_0x260fbe(0x182)]===_0x260fbe(0x153)?_0x67a4a7['privateK'+_0x260fbe(0x182)]:'';if(_0x52c468&&_0x7ae7e){const _0x46b62d={'deviceId':fingerprintPublicKey(_0x52c468),'publicKeyPem':_0x52c468,'privateKeyPem':_0x7ae7e};return _0x67a4a7?.[_0x260fbe(0x1dc)]!==_0x46b62d[_0x260fbe(0x1dc)]&&writeIdentityFile(_0x1aa680,_0x46b62d,Date['now']()),_0x46b62d;}}catch{}const _0x25f0f8=generateDeviceIdentity();return writeIdentityFile(_0x1aa680,_0x25f0f8,Date['now']()),_0x25f0f8;}function _0x6a36(){const _0x5768aa=['set','export','get','gateway\x20','ect','readyWai','408489ilUfwi','ell/','ters','nectChal','hake\x20tim','chat','deviceId','timed\x20ou','token','rsion','6124995HsqamF','sendConn','waitUnti','t\x20restar','ent','update','lListene','clientDi','charCode','70032100','WS\x20error','9342976NPYBds','tTimer','handleDi','reject','sing\x20non','timeoutM','base64','sconnect','clientId','.write','DateTime','2tFqfIf','WS\x20disco','WS\x20close','nected','初始化\x20gate','clearTim','fromChar','entity','failed:\x20','type','ting','OPEN','replaceA','request','WS\x20hands','ssage','length','send','handleMe','Options','hallenge','der','nonce','string','scopes','way\x20设备身份','t:\x20','connect','connect\x20','deviceFa','WS\x20is\x20no','clientVe','restart','.read','privateK','agent','pem','operator','t\x20config','wujie-sh','onConnec','splayNam','expectFi','pending','signedAt','06032b65','status','publicKe','stringif','delete','close','isArray','payload','Format','ction\x20ti','url','removeAl','clientMo','connectC','med\x20out','event','lReady','trim','failed','d\x20(','ble','skipRead','parse','res','\x20yet','eyPem','eadyWait','challeng','5278rWRLwW','resolve','stop','WS\x20conne','clientDe','302a3005','yCheck','mily','onAgentE','yPem','error','test','viceFami','request\x20','rejectRe','timeout','dentity\x20','reconnec','config','g\x20nonce','adyWaite','2514IvUWAL','.approva','object','ed\x20out','ted','connecte','queueCon','shouldRe','connectN','hex','Timer','platform','e\x20missin','device\x20i','tBackoff','failed\x20t','vent','digest','resolveR','rejectPe','accepted','now','nding','ed25519','93160CtiaQu','method','lengeTim','ured','4791060zfNTmC','ers','configur','WS\x20clien','ateway\x20r','Path','o\x20send\x20g','push','equest','join','1537560jiKJTN','o\x20load\x20g','sha256','t\x20stoppe','toString','subarray','identity','hake\x20mis','code=','once','message','readySta','from','onDiscon','connectS','nnected'];_0x6a36=function(){return _0x5768aa;};return _0x6a36();}function _0x2c58(_0xd8cb2f,_0x585e85){_0xd8cb2f=_0xd8cb2f-0x14b;const _0x6a36e1=_0x6a36();let _0x2c58ec=_0x6a36e1[_0xd8cb2f];return _0x2c58ec;}export class ClawGatewayWsClient{['ws']=null;['config']=null;[_0x27d58d(0x167)]=new Map();[_0x27d58d(0x1d5)+'ters']=[];[_0x27d58d(0x1a1)+_0x27d58d(0x157)]=![];[_0x27d58d(0x196)+_0x27d58d(0x1ec)]=null;[_0x27d58d(0x176)+_0x27d58d(0x150)+_0x27d58d(0x1a4)]=null;[_0x27d58d(0x1a2)+'once']=null;[_0x27d58d(0x1ce)+'ent']=![];['connecte'+'d']=![];[_0x27d58d(0x196)+_0x27d58d(0x1a8)+'Ms']=0x320;[_0x27d58d(0x1dc)+_0x27d58d(0x1fd)]=null;[_0x27d58d(0x1b8)+'e'](_0x186103){const _0x7b055b=_0x27d58d;if(!_0x186103){this[_0x7b055b(0x187)]();return;}const _0x53e41a=this[_0x7b055b(0x197)];this[_0x7b055b(0x197)]=_0x186103,this['shouldRe'+_0x7b055b(0x157)]=!![];try{this['deviceId'+'entity']=loadOrCreateDeviceIdentity(_0x186103[_0x7b055b(0x1c6)+'Path']);}catch(_0x1d2d22){const _0x45d28d=_0x1d2d22 instanceof Error?_0x1d2d22['message']:_0x7b055b(0x1fa)+_0x7b055b(0x155)+'失败';this[_0x7b055b(0x187)](),_0x186103[_0x7b055b(0x1cd)+_0x7b055b(0x1f9)](_0x45d28d);return;}const _0x2bdada=!_0x53e41a||_0x53e41a['url']!==_0x186103[_0x7b055b(0x173)]||_0x53e41a[_0x7b055b(0x1de)]!==_0x186103['token']||_0x53e41a[_0x7b055b(0x1f3)]!==_0x186103['clientId']||_0x53e41a[_0x7b055b(0x175)+'de']!==_0x186103[_0x7b055b(0x175)+'de']||_0x53e41a[_0x7b055b(0x15b)+'rsion']!==_0x186103[_0x7b055b(0x15b)+_0x7b055b(0x1df)]||_0x53e41a[_0x7b055b(0x1c6)+_0x7b055b(0x1bb)]!==_0x186103[_0x7b055b(0x1c6)+_0x7b055b(0x1bb)];if(_0x2bdada){this['restart']();return;}if(!this['ws'])this['connect']();}[_0x27d58d(0x187)](){const _0x419eac=_0x27d58d;this[_0x419eac(0x1a1)+_0x419eac(0x157)]=![],this[_0x419eac(0x19f)+'d']=![],this[_0x419eac(0x1a2)+_0x419eac(0x1c9)]=null,this[_0x419eac(0x1ce)+_0x419eac(0x1e4)]=![],this['clearTim'+_0x419eac(0x1b7)](),this[_0x419eac(0x1ad)+_0x419eac(0x1b0)](new Error(_0x419eac(0x1d3)+_0x419eac(0x1b9)+_0x419eac(0x1c3)+'d')),this[_0x419eac(0x193)+'adyWaite'+'rs'](new Error(_0x419eac(0x1d3)+_0x419eac(0x1b9)+'t\x20stoppe'+'d'));if(this['ws']){try{this['ws'][_0x419eac(0x16e)]();}catch{}this['ws']=null;}this[_0x419eac(0x1dc)+_0x419eac(0x1fd)]=null,this[_0x419eac(0x197)]=null;}async['request'](_0x271e84,_0x4a76f0={},_0x4c8298={}){const _0x220c2a=_0x27d58d;if(!_0x4c8298[_0x220c2a(0x17e)+_0x220c2a(0x18b)])await this['waitUnti'+_0x220c2a(0x179)]();const _0xbf7711=this['ws'];if(!_0xbf7711||_0xbf7711['readySta'+'te']!==_0x1cc090['OPEN'])throw new Error(_0x220c2a(0x1d3)+'WS\x20is\x20no'+'t\x20connec'+_0x220c2a(0x19e));const _0x2e7f94=randomUUID(),_0x2aa5e2=_0x4c8298[_0x220c2a(0x1f0)+'s']??0x7530;return await new Promise((_0x4e50b3,_0x3dd612)=>{const _0x32afed=_0x220c2a,_0x372a98=setTimeout(()=>{const _0x5e8151=_0x2c58;this[_0x5e8151(0x167)][_0x5e8151(0x16d)](_0x2e7f94),_0x3dd612(new Error(_0x5e8151(0x1d3)+_0x5e8151(0x192)+_0x5e8151(0x1dd)+_0x5e8151(0x156)+_0x271e84));},_0x2aa5e2);this['pending'][_0x32afed(0x1d0)](_0x2e7f94,{'method':_0x271e84,'resolve':_0x4bee13=>{clearTimeout(_0x372a98),_0x4e50b3(_0x4bee13);},'reject':_0x198f3d=>{clearTimeout(_0x372a98),_0x3dd612(_0x198f3d);},'expectFinal':_0x4c8298[_0x32afed(0x166)+'nal']===!![],'timeout':_0x372a98});try{_0xbf7711[_0x32afed(0x14d)](JSON[_0x32afed(0x16c)+'y']({'type':'req','id':_0x2e7f94,'method':_0x271e84,'params':_0x4a76f0}));}catch(_0x33cb70){this[_0x32afed(0x167)][_0x32afed(0x16d)](_0x2e7f94),clearTimeout(_0x372a98),_0x3dd612(_0x33cb70 instanceof Error?_0x33cb70:new Error('failed\x20t'+_0x32afed(0x1bc)+_0x32afed(0x1ba)+_0x32afed(0x1be)));}});}[_0x27d58d(0x15c)](){const _0xcb3515=_0x27d58d;this[_0xcb3515(0x19f)+'d']=![],this[_0xcb3515(0x1a2)+_0xcb3515(0x1c9)]=null,this[_0xcb3515(0x1ce)+_0xcb3515(0x1e4)]=![],this[_0xcb3515(0x1fb)+_0xcb3515(0x1b7)](),this[_0xcb3515(0x1ad)+_0xcb3515(0x1b0)](new Error(_0xcb3515(0x1d3)+_0xcb3515(0x1b9)+_0xcb3515(0x1e3)+_0xcb3515(0x200))),this[_0xcb3515(0x193)+_0xcb3515(0x199)+'rs'](new Error(_0xcb3515(0x1d3)+_0xcb3515(0x1b9)+_0xcb3515(0x1e3)+_0xcb3515(0x200)));if(this['ws']){try{this['ws']['terminat'+'e']();}catch{}this['ws']=null;}this[_0xcb3515(0x157)]();}[_0x27d58d(0x157)](){const _0x355089=_0x27d58d;if(!this['config']||this['ws'])return;const _0x2237ce=new _0x1cc090(this[_0x355089(0x197)][_0x355089(0x173)]);this['ws']=_0x2237ce,_0x2237ce['on']('open',()=>this[_0x355089(0x1a0)+_0x355089(0x1d9)+_0x355089(0x1b4)+'eout']()),_0x2237ce['on']('message',_0x5a4bce=>this[_0x355089(0x14e)+_0x355089(0x14b)](_0x5a4bce[_0x355089(0x1c4)]())),_0x2237ce['on'](_0x355089(0x16e),(_0x412824,_0x3cd11a)=>{const _0x2c7a19=_0x355089;if(this[_0x2c7a19(0x19f)+'d']){const _0x18f4f3=_0x3cd11a['toString']()||_0x2c7a19(0x1c8)+_0x412824;this[_0x2c7a19(0x1ed)+'sconnect']('gateway\x20'+_0x2c7a19(0x1f8)+_0x2c7a19(0x17c)+_0x18f4f3+')');}else this[_0x2c7a19(0x1ed)+_0x2c7a19(0x1f2)]('');}),_0x2237ce['on'](_0x355089(0x18f),_0x379a37=>{const _0x5d5e5e=_0x355089;if(isLocalGatewayConnRefused(_0x379a37)){this[_0x5d5e5e(0x1ed)+_0x5d5e5e(0x1f2)](_0x5d5e5e(0x1d3)+'is\x20not\x20l'+'istening'+_0x5d5e5e(0x181));return;}const _0x51315e=formatUnknownError(_0x379a37);this['handleDi'+_0x5d5e5e(0x1f2)](_0x51315e?_0x5d5e5e(0x1d3)+_0x5d5e5e(0x1ea)+':\x20'+_0x51315e:_0x5d5e5e(0x1d3)+_0x5d5e5e(0x1ea));});}[_0x27d58d(0x1a0)+_0x27d58d(0x1d9)+'lengeTim'+'eout'](){const _0x3cefdf=_0x27d58d;this[_0x3cefdf(0x1a2)+'once']=null,this[_0x3cefdf(0x1ce)+_0x3cefdf(0x1e4)]=![];if(this[_0x3cefdf(0x176)+_0x3cefdf(0x150)+_0x3cefdf(0x1a4)])clearTimeout(this[_0x3cefdf(0x176)+_0x3cefdf(0x150)+_0x3cefdf(0x1a4)]);this[_0x3cefdf(0x176)+_0x3cefdf(0x150)+_0x3cefdf(0x1a4)]=setTimeout(()=>{const _0x15ef51=_0x3cefdf;if(this['connectS'+_0x15ef51(0x1e4)]||!this['ws']||this['ws'][_0x15ef51(0x1cb)+'te']!==_0x1cc090[_0x15ef51(0x201)])return;this[_0x15ef51(0x1ed)+_0x15ef51(0x1f2)](_0x15ef51(0x1d3)+_0x15ef51(0x204)+_0x15ef51(0x1da)+_0x15ef51(0x19d)),this['ws']?.[_0x15ef51(0x16e)](0x3f0,'connect\x20'+_0x15ef51(0x184)+'e\x20timeou'+'t');},0x7d0);}async['sendConn'+_0x27d58d(0x1d4)](){const _0xc54dc4=_0x27d58d,_0x3c9b68=this['config'];if(!_0x3c9b68||this[_0xc54dc4(0x1ce)+_0xc54dc4(0x1e4)])return;const _0x5a27a1=this[_0xc54dc4(0x1a2)+'once']?.[_0xc54dc4(0x17a)]()??'';if(!_0x5a27a1){this[_0xc54dc4(0x1ed)+_0xc54dc4(0x1f2)]('gateway\x20'+_0xc54dc4(0x204)+_0xc54dc4(0x1c7)+'sing\x20non'+'ce'),this['ws']?.['close'](0x3f0,_0xc54dc4(0x158)+_0xc54dc4(0x184)+_0xc54dc4(0x1a6)+_0xc54dc4(0x198));return;}this[_0xc54dc4(0x1ce)+'ent']=!![];this[_0xc54dc4(0x176)+'hallenge'+_0xc54dc4(0x1a4)]&&(clearTimeout(this[_0xc54dc4(0x176)+_0xc54dc4(0x150)+_0xc54dc4(0x1a4)]),this[_0xc54dc4(0x176)+_0xc54dc4(0x150)+_0xc54dc4(0x1a4)]=null);if(!this[_0xc54dc4(0x1dc)+_0xc54dc4(0x1fd)])try{this[_0xc54dc4(0x1dc)+_0xc54dc4(0x1fd)]=loadOrCreateDeviceIdentity(_0x3c9b68[_0xc54dc4(0x1c6)+_0xc54dc4(0x1bb)]);}catch(_0x399a23){this['handleDi'+'sconnect'](_0x399a23 instanceof Error?_0x399a23[_0xc54dc4(0x1ca)]:_0xc54dc4(0x1a9)+_0xc54dc4(0x1c1)+'ateway\x20i'+'dentity'),this['ws']?.[_0xc54dc4(0x16e)](0x3f0,_0xc54dc4(0x1a7)+_0xc54dc4(0x195)+'unavaila'+_0xc54dc4(0x17d));return;}const _0x66dd6e='operator',_0x1568be=[_0xc54dc4(0x161)+_0xc54dc4(0x15d),_0xc54dc4(0x161)+_0xc54dc4(0x1f4),_0xc54dc4(0x161)+'.admin',_0xc54dc4(0x161)+_0xc54dc4(0x19b)+'ls',_0xc54dc4(0x161)+'.pairing'],_0x44e2ed=_0x3c9b68['token'][_0xc54dc4(0x17a)](),_0x1aa347=Date[_0xc54dc4(0x1af)](),_0x4862c9=buildDeviceAuthPayloadV3({'deviceId':this[_0xc54dc4(0x1dc)+_0xc54dc4(0x1fd)]['deviceId'],'clientId':_0x3c9b68[_0xc54dc4(0x1f3)],'clientMode':_0x3c9b68[_0xc54dc4(0x175)+'de'],'role':_0x66dd6e,'scopes':_0x1568be,'signedAtMs':_0x1aa347,'token':_0x44e2ed||null,'nonce':_0x5a27a1,'platform':process[_0xc54dc4(0x1a5)],'deviceFamily':_0x3c9b68[_0xc54dc4(0x189)+_0xc54dc4(0x191)+'ly']}),_0xc153f7={'minProtocol':0x4,'maxProtocol':0x4,'client':{'id':_0x3c9b68[_0xc54dc4(0x1f3)],'displayName':_0x3c9b68[_0xc54dc4(0x1e7)+_0xc54dc4(0x165)+'e'],'version':_0x3c9b68[_0xc54dc4(0x15b)+_0xc54dc4(0x1df)],'platform':process[_0xc54dc4(0x1a5)],'deviceFamily':_0x3c9b68[_0xc54dc4(0x189)+'viceFami'+'ly'],'mode':_0x3c9b68[_0xc54dc4(0x175)+'de']},'caps':[],'role':_0x66dd6e,'scopes':_0x1568be,'auth':_0x44e2ed?{'token':_0x44e2ed}:undefined,'device':{'id':this[_0xc54dc4(0x1dc)+'entity'][_0xc54dc4(0x1dc)],'publicKey':publicKeyRawBase64UrlFromPem(this[_0xc54dc4(0x1dc)+'entity']['publicKe'+_0xc54dc4(0x18e)]),'signature':signDevicePayload(this[_0xc54dc4(0x1dc)+'entity'][_0xc54dc4(0x15e)+_0xc54dc4(0x182)],_0x4862c9),'signedAt':_0x1aa347,'nonce':_0x5a27a1},'locale':Intl[_0xc54dc4(0x1f5)+_0xc54dc4(0x171)]()['resolved'+_0xc54dc4(0x14f)]()['locale'],'userAgent':_0xc54dc4(0x163)+_0xc54dc4(0x1d7)+_0x3c9b68['clientVe'+_0xc54dc4(0x1df)]};try{await this[_0xc54dc4(0x203)](_0xc54dc4(0x157),_0xc153f7,{'timeoutMs':0x2710,'skipReadyCheck':!![]}),this[_0xc54dc4(0x19f)+'d']=!![],this['reconnec'+_0xc54dc4(0x1a8)+'Ms']=0x320,this[_0xc54dc4(0x1ac)+'eadyWait'+'ers'](),this[_0xc54dc4(0x197)]?.[_0xc54dc4(0x164)+_0xc54dc4(0x19e)]?.();}catch(_0x2c3f9e){this['handleDi'+_0xc54dc4(0x1f2)](_0x2c3f9e instanceof Error?_0x2c3f9e[_0xc54dc4(0x1ca)]:_0xc54dc4(0x1d3)+_0xc54dc4(0x188)+'ct\x20faile'+'d'),this['ws']?.['close'](0x3f0,_0xc54dc4(0x158)+_0xc54dc4(0x17b));}}['handleMe'+_0x27d58d(0x14b)](_0x25db3a){const _0x54d025=_0x27d58d;let _0x4f98bc;try{_0x4f98bc=JSON['parse'](_0x25db3a);}catch{return;}if(!isRecord(_0x4f98bc)||typeof _0x4f98bc[_0x54d025(0x1ff)]!==_0x54d025(0x153))return;if(_0x4f98bc['type']===_0x54d025(0x178)){const _0x514b7e=typeof _0x4f98bc[_0x54d025(0x178)]==='string'?_0x4f98bc['event']:'';if(!_0x514b7e)return;const _0x4597d6=isRecord(_0x4f98bc['payload'])?_0x4f98bc['payload']:{};if(_0x514b7e==='connect.'+_0x54d025(0x184)+'e'){const _0x1413d0=typeof _0x4597d6[_0x54d025(0x152)]===_0x54d025(0x153)?_0x4597d6[_0x54d025(0x152)]['trim']():'';if(!_0x1413d0){this[_0x54d025(0x1ed)+_0x54d025(0x1f2)]('gateway\x20'+'WS\x20hands'+_0x54d025(0x1c7)+_0x54d025(0x1ef)+'ce'),this['ws']?.[_0x54d025(0x16e)](0x3f0,'connect\x20'+_0x54d025(0x184)+_0x54d025(0x1a6)+'g\x20nonce');return;}this[_0x54d025(0x1a2)+'once']=_0x1413d0,void this[_0x54d025(0x1e1)+_0x54d025(0x1d4)]();return;}if(_0x514b7e===_0x54d025(0x1db))this[_0x54d025(0x197)]?.['onChatEv'+_0x54d025(0x1e4)]?.(_0x4597d6);if(_0x514b7e===_0x54d025(0x15f))this[_0x54d025(0x197)]?.[_0x54d025(0x18d)+_0x54d025(0x1aa)]?.(_0x4597d6);return;}if(_0x4f98bc[_0x54d025(0x1ff)]!==_0x54d025(0x180))return;const _0x153576=typeof _0x4f98bc['id']===_0x54d025(0x153)?_0x4f98bc['id']:'';if(!_0x153576)return;const _0x5862a2=this['pending'][_0x54d025(0x1d2)](_0x153576);if(!_0x5862a2)return;const _0x1a9b0b=isRecord(_0x4f98bc[_0x54d025(0x170)])?_0x4f98bc[_0x54d025(0x170)]:{},_0x2f4936=typeof _0x1a9b0b[_0x54d025(0x16a)]==='string'?_0x1a9b0b[_0x54d025(0x16a)]:'';if(_0x5862a2[_0x54d025(0x166)+'nal']&&_0x2f4936===_0x54d025(0x1ae))return;this[_0x54d025(0x167)]['delete'](_0x153576);_0x5862a2[_0x54d025(0x194)]&&(clearTimeout(_0x5862a2['timeout']),_0x5862a2[_0x54d025(0x194)]=null);if(_0x4f98bc['ok']===!![]){_0x5862a2[_0x54d025(0x186)](_0x4f98bc['payload']);return;}const _0x1367fb=isRecord(_0x4f98bc[_0x54d025(0x18f)])?_0x4f98bc[_0x54d025(0x18f)]:{},_0x19f6c7=typeof _0x1367fb[_0x54d025(0x1ca)]===_0x54d025(0x153)?_0x1367fb[_0x54d025(0x1ca)]:_0x54d025(0x1d3)+_0x54d025(0x192)+_0x54d025(0x1fe)+_0x5862a2[_0x54d025(0x1b3)];_0x5862a2['reject'](new Error(_0x19f6c7));}[_0x27d58d(0x1e2)+'lReady'](_0x43649f=0x2ee0){const _0x3f9899=_0x27d58d;if(this[_0x3f9899(0x19f)+'d'])return Promise[_0x3f9899(0x186)]();if(!this['config'])return Promise['reject'](new Error('gateway\x20'+_0x3f9899(0x15a)+_0x3f9899(0x162)+_0x3f9899(0x1b5)));if(!this['ws'])this[_0x3f9899(0x157)]();return new Promise((_0x12adcb,_0x14eeb2)=>{const _0x14a27b=_0x3f9899,_0x3fae40=setTimeout(()=>{const _0x596d5f=_0x2c58;this[_0x596d5f(0x1d5)+_0x596d5f(0x1d8)]=this[_0x596d5f(0x1d5)+_0x596d5f(0x1d8)]['filter'](_0x39f7de=>_0x39f7de[_0x596d5f(0x186)]!==_0x12adcb),_0x14eeb2(new Error(_0x596d5f(0x1d3)+'WS\x20conne'+_0x596d5f(0x172)+_0x596d5f(0x177)));},_0x43649f);this[_0x14a27b(0x1d5)+_0x14a27b(0x1d8)][_0x14a27b(0x1bd)]({'resolve':_0x12adcb,'reject':_0x14eeb2,'timeout':_0x3fae40});});}[_0x27d58d(0x1ac)+_0x27d58d(0x183)+'ers'](){const _0x478c78=_0x27d58d,_0x25ba7b=[...this['readyWai'+_0x478c78(0x1d8)]];this[_0x478c78(0x1d5)+_0x478c78(0x1d8)]=[];for(const _0x16b72e of _0x25ba7b){clearTimeout(_0x16b72e[_0x478c78(0x194)]),_0x16b72e[_0x478c78(0x186)]();}}[_0x27d58d(0x193)+_0x27d58d(0x199)+'rs'](_0x568d44){const _0x1ab20b=_0x27d58d,_0x36533a=[...this[_0x1ab20b(0x1d5)+'ters']];this[_0x1ab20b(0x1d5)+_0x1ab20b(0x1d8)]=[];for(const _0x69c004 of _0x36533a){clearTimeout(_0x69c004[_0x1ab20b(0x194)]),_0x69c004['reject'](_0x568d44);}}[_0x27d58d(0x1ad)+_0x27d58d(0x1b0)](_0x779510){const _0x332f12=_0x27d58d;for(const [_0x21862e,_0x187929]of this[_0x332f12(0x167)]['entries']()){this[_0x332f12(0x167)][_0x332f12(0x16d)](_0x21862e),_0x187929[_0x332f12(0x194)]&&(clearTimeout(_0x187929[_0x332f12(0x194)]),_0x187929[_0x332f12(0x194)]=null),_0x187929[_0x332f12(0x1ee)](_0x779510);}}[_0x27d58d(0x1ed)+_0x27d58d(0x1f2)](_0x375370){const _0x1cf9d0=_0x27d58d;this['ws']&&(this['ws'][_0x1cf9d0(0x174)+_0x1cf9d0(0x1e6)+'rs'](),this['ws']=null);this[_0x1cf9d0(0x19f)+'d']=![],this['connectN'+_0x1cf9d0(0x1c9)]=null,this[_0x1cf9d0(0x1ce)+_0x1cf9d0(0x1e4)]=![],this[_0x1cf9d0(0x1ad)+_0x1cf9d0(0x1b0)](new Error(_0x375370||_0x1cf9d0(0x1d3)+_0x1cf9d0(0x1f7)+_0x1cf9d0(0x1cf))),this[_0x1cf9d0(0x193)+_0x1cf9d0(0x199)+'rs'](new Error(_0x375370||'gateway\x20'+_0x1cf9d0(0x1f7)+'nnected')),this['clearTim'+_0x1cf9d0(0x1b7)]();if(_0x375370)this[_0x1cf9d0(0x197)]?.[_0x1cf9d0(0x1cd)+_0x1cf9d0(0x1f9)]?.(_0x375370);if(!this[_0x1cf9d0(0x1a1)+_0x1cf9d0(0x157)]||!this[_0x1cf9d0(0x197)])return;const _0x421506=this[_0x1cf9d0(0x196)+_0x1cf9d0(0x1a8)+'Ms'];this[_0x1cf9d0(0x196)+_0x1cf9d0(0x1a8)+'Ms']=Math['min'](this[_0x1cf9d0(0x196)+'tBackoff'+'Ms']*0x2,0x3a98),this['reconnec'+'tTimer']=setTimeout(()=>{const _0x2f345d=_0x1cf9d0;this[_0x2f345d(0x196)+_0x2f345d(0x1ec)]=null,this[_0x2f345d(0x157)]();},_0x421506);}[_0x27d58d(0x1fb)+_0x27d58d(0x1b7)](){const _0x1acc65=_0x27d58d;this[_0x1acc65(0x196)+_0x1acc65(0x1ec)]&&(clearTimeout(this[_0x1acc65(0x196)+'tTimer']),this['reconnec'+'tTimer']=null),this[_0x1acc65(0x176)+_0x1acc65(0x150)+_0x1acc65(0x1a4)]&&(clearTimeout(this[_0x1acc65(0x176)+_0x1acc65(0x150)+_0x1acc65(0x1a4)]),this['connectC'+_0x1acc65(0x150)+_0x1acc65(0x1a4)]=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(_0x3b6d3a,_0x4a8ad3){var _0xcd6321=_0x20a9,_0x307f64=_0x3b6d3a();while(!![]){try{var _0x119f86=parseInt(_0xcd6321(0x1b5))/0x1*(-parseInt(_0xcd6321(0x1b7))/0x2)+-parseInt(_0xcd6321(0x1b1))/0x3+-parseInt(_0xcd6321(0x1b4))/0x4*(parseInt(_0xcd6321(0x1b9))/0x5)+-parseInt(_0xcd6321(0x1b3))/0x6*(-parseInt(_0xcd6321(0x1b2))/0x7)+-parseInt(_0xcd6321(0x1ba))/0x8+parseInt(_0xcd6321(0x1b0))/0x9+-parseInt(_0xcd6321(0x1b6))/0xa*(-parseInt(_0xcd6321(0x1b8))/0xb);if(_0x119f86===_0x4a8ad3)break;else _0x307f64['push'](_0x307f64['shift']());}catch(_0x54c923){_0x307f64['push'](_0x307f64['shift']());}}}(_0x2262,0xb68c6));function _0x20a9(_0x42d69b,_0x2e9cad){_0x42d69b=_0x42d69b-0x1b0;var _0x226279=_0x2262();var _0x20a974=_0x226279[_0x42d69b];return _0x20a974;}function _0x2262(){var _0x3e4e35=['6450rtVJsi','6fkjRzw','13343htyFnj','445HzUecK','8387944IeoUyV','10503126XjtgCt','254148EnFwgt','7VUubRH','4618122nJeUlV','19772mjxQmk','132744pjLnES'];_0x2262=function(){return _0x3e4e35;};return _0x2262();}export{ensureOpenClawDoctorFixed,loadRuntimeInfo,prepareRuntime,runClawOnce,spawnClaw}from'./runtime.mjs';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
- function _0x6efc(_0x39870b,_0x20d1b){_0x39870b=_0x39870b-0xe3;const _0x50ba46=_0x50ba();let _0x6efcee=_0x50ba46[_0x39870b];return _0x6efcee;}(function(_0x344cb4,_0x4ddb96){const _0x378c56=_0x6efc,_0x2fac7e=_0x344cb4();while(!![]){try{const _0x41ac3f=parseInt(_0x378c56(0x110))/0x1+-parseInt(_0x378c56(0x10a))/0x2*(-parseInt(_0x378c56(0xfc))/0x3)+-parseInt(_0x378c56(0x12b))/0x4+parseInt(_0x378c56(0x12d))/0x5*(parseInt(_0x378c56(0x10e))/0x6)+parseInt(_0x378c56(0x104))/0x7*(parseInt(_0x378c56(0x12c))/0x8)+parseInt(_0x378c56(0xe9))/0x9*(-parseInt(_0x378c56(0xf6))/0xa)+parseInt(_0x378c56(0x103))/0xb*(parseInt(_0x378c56(0x113))/0xc);if(_0x41ac3f===_0x4ddb96)break;else _0x2fac7e['push'](_0x2fac7e['shift']());}catch(_0x2b368b){_0x2fac7e['push'](_0x2fac7e['shift']());}}}(_0x50ba,0xcbfcd));function _0x50ba(){const _0x48707f=['ll.exe','wujie-sh','sha256','length','$Progres','6631784PuuaLM','5360pJtyPj','462460TEknMX','textPrev','-Archive','has','utf16le','pipe','.zip','9skEgkt','Compress','toISOStr','logs\x20dir','trim','ing','digest','powershe','logsDir','map','message','join','dev','12558500sUEawO','from','env','update','ignore','ot\x20found','189wiOXuA','string','zip','\x20-Destin','.log','sPrefere','error','8123511yFcmLB','10528oZKmbs','startsWi','platform','catch','stack','nce=\x27Sil','29922ezKXKb','data','now','entries','12ZFJvFj','slice','137120qazOWx','isArray','hex','24vJaXEE','ell-logs','...','array','base64','Command','object','pid','name','stringif','get','stderr','toString','ationPat','replace','-Encoded','close','maxDepth','win32'];_0x50ba=function(){return _0x48707f;};return _0x50ba();}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(_0x37228c,_0x262d60,_0x4d9dc2=_0x262d60){const _0x1e9a0a=_0x6efc,_0x23fa8e=_0x37228c?.[_0x1e9a0a(0xf1)];if(!_0x23fa8e||!_0x262d60)return null;const _0xfda889=join(_0x23fa8e,_0x262d60,_0x262d60+_0x1e9a0a(0x100)),_0x6ffa28=_0xfda889+':'+_0x4d9dc2;return!loggers[_0x1e9a0a(0xe5)](_0x6ffa28)&&loggers['set'](_0x6ffa28,createFileLogger({'filePath':_0xfda889,'context':_0x4d9dc2,'maxBytes':LOG_MAX_BYTES,'keepCount':LOG_KEEP_COUNT})),loggers[_0x1e9a0a(0x11d)](_0x6ffa28);}export function toHomePath(_0x2a38a3){const _0x1144af=_0x6efc,_0x52ebe1=typeof _0x2a38a3===_0x1144af(0xfd)?_0x2a38a3:'';if(!_0x52ebe1)return'';const _0xc4d9da=homedir(),_0x44f05e=isAbsolute(_0x52ebe1)?_0x52ebe1:resolve(_0x52ebe1),_0x4ca5b3=relative(_0xc4d9da,_0x44f05e);if(!_0x4ca5b3||!_0x4ca5b3[_0x1144af(0x105)+'th']('..')&&!isAbsolute(_0x4ca5b3))return _0x4ca5b3?'~/'+_0x4ca5b3:'~';return _0x44f05e;}export function hashText(_0x1cc37c){const _0x54ed87=_0x6efc;return createHash(_0x54ed87(0x128))[_0x54ed87(0xf9)](String(_0x1cc37c))[_0x54ed87(0xef)](_0x54ed87(0x112))[_0x54ed87(0x10f)](0x0,0x10);}export function truncateText(_0x22d3c8,_0x25b947=CONTENT_PREVIEW_LENGTH){const _0x280ff0=_0x6efc,_0x284e90=String(_0x22d3c8??'')[_0x280ff0(0x121)](/\s+/g,'\x20')['trim']();if(_0x284e90[_0x280ff0(0x129)]<=_0x25b947)return _0x284e90;return _0x284e90[_0x280ff0(0x10f)](0x0,_0x25b947)+_0x280ff0(0x115);}export function summarizeText(_0x5d89c8,_0x3a2bae=CONTENT_PREVIEW_LENGTH){const _0x2e1bb5=_0x6efc,_0x4fbebf=String(_0x5d89c8??'');return{'length':_0x4fbebf[_0x2e1bb5(0x129)],'hash':hashText(_0x4fbebf),'preview':truncateText(_0x4fbebf,_0x3a2bae),'truncated':_0x4fbebf[_0x2e1bb5(0x129)]>_0x3a2bae};}export function summarizeError(_0x238c27){const _0x89532a=_0x6efc;if(_0x238c27 instanceof Error)return{'name':_0x238c27[_0x89532a(0x11b)],'message':_0x238c27[_0x89532a(0xf3)],'stack':_0x238c27[_0x89532a(0x108)]};return{'message':String(_0x238c27)};}function summarizePathValue(_0x1467f0){if(typeof _0x1467f0!=='string')return _0x1467f0;if(_0x1467f0['includes']('/')||_0x1467f0['includes']('\x5c'))return toHomePath(_0x1467f0);return _0x1467f0;}export function summarizePayload(_0x3d5da4,_0x4ee179={}){const _0x6af0fa=_0x6efc,_0x5a98ea=_0x4ee179[_0x6af0fa(0x124)]??0x4,_0x256da4=new WeakSet();function _0x173cae(_0x1cb908,_0x501f53,_0x14cb5a=''){const _0x51baf1=_0x6af0fa;if(_0x1cb908==null)return _0x1cb908;if(typeof _0x1cb908===_0x51baf1(0xfd)){if(/message|content|prompt|text|body/i['test'](_0x14cb5a))return summarizeText(_0x1cb908,_0x4ee179[_0x51baf1(0xe3)+'iewLengt'+'h']);return summarizePathValue(_0x1cb908);}if(typeof _0x1cb908!==_0x51baf1(0x119))return _0x1cb908;if(_0x1cb908 instanceof Error)return summarizeError(_0x1cb908);if(_0x256da4[_0x51baf1(0xe5)](_0x1cb908))return'[Circula'+'r]';if(_0x501f53>=_0x5a98ea)return'['+(Array[_0x51baf1(0x111)](_0x1cb908)?'Array':'Object')+']';_0x256da4['add'](_0x1cb908);if(Array[_0x51baf1(0x111)](_0x1cb908))return{'type':_0x51baf1(0x116),'length':_0x1cb908['length'],'items':_0x1cb908[_0x51baf1(0x10f)](0x0,0x5)[_0x51baf1(0xf2)](_0x3c1bd5=>_0x173cae(_0x3c1bd5,_0x501f53+0x1,_0x14cb5a)),'truncated':_0x1cb908['length']>0x5};const _0x4c6567={};for(const [_0x586941,_0x196342]of Object[_0x51baf1(0x10d)](_0x1cb908)){_0x4c6567[_0x586941]=_0x173cae(_0x196342,_0x501f53+0x1,_0x586941);}return redactLogValue(_0x4c6567);}return _0x173cae(_0x3d5da4,0x0);}export function summarizeFilePaths(_0x4296b0=[]){const _0x245bee=_0x6efc;return(Array['isArray'](_0x4296b0)?_0x4296b0:[])[_0x245bee(0xf2)](_0x15c4d3=>String(_0x15c4d3||'')[_0x245bee(0xed)]())['filter'](Boolean)[_0x245bee(0xf2)](_0x4e237f=>({'path':toHomePath(_0x4e237f),'name':basename(_0x4e237f)}));}function run(_0xe61eab,_0x130fbb,_0x4f0486={}){return new Promise((_0x5320e7,_0x3f9058)=>{const _0x4d5ac9=_0x6efc,_0x18d128=spawn(_0xe61eab,_0x130fbb,{'cwd':_0x4f0486['cwd'],'env':{...process.env,..._0x4f0486[_0x4d5ac9(0xf8)]??{}},'stdio':[_0x4d5ac9(0xfa),'pipe',_0x4d5ac9(0xe7)]});let _0x5614e7='';_0x18d128[_0x4d5ac9(0x11e)]?.['on'](_0x4d5ac9(0x10b),_0x1d1b0e=>{_0x5614e7+=_0x1d1b0e['toString']();}),_0x18d128['on'](_0x4d5ac9(0x102),_0x3f9058),_0x18d128['on'](_0x4d5ac9(0x123),_0x48152f=>{if(_0x48152f===0x0){_0x5320e7();return;}_0x3f9058(new Error(_0xe61eab+('\x20failed\x20'+'with\x20cod'+'e=')+_0x48152f+':\x20'+_0x5614e7));});});}export async function exportLogsArchive({logsDir:_0x3a4442,targetDir:_0x31d095,appVersion:appVersion='dev'}){const _0x2eeb98=_0x6efc;if(!_0x3a4442||!existsSync(_0x3a4442))throw new Error(_0x2eeb98(0xec)+'ectory\x20n'+_0x2eeb98(0xfb)+':\x20'+(_0x3a4442||''));const _0x14d3b6=String(appVersion||_0x2eeb98(0xf5))[_0x2eeb98(0x121)](/[^A-Za-z0-9._-]/g,'_'),_0x41316d=new Date()[_0x2eeb98(0xeb)+_0x2eeb98(0xee)]()[_0x2eeb98(0x121)](/[-:]/g,'')[_0x2eeb98(0x121)](/\..+$/,''),_0x33cfe6=_0x31d095||tmpdir();await mkdir(_0x33cfe6,{'recursive':!![]});const _0x3bfa19=join(_0x33cfe6,_0x2eeb98(0x127)+_0x2eeb98(0x114)+'-'+_0x41316d+'-'+_0x14d3b6+_0x2eeb98(0xe8));if(process[_0x2eeb98(0x106)]===_0x2eeb98(0x125)){const _0x5eda82=join(tmpdir(),_0x2eeb98(0x127)+_0x2eeb98(0x114)+'-'+process[_0x2eeb98(0x11a)]+'-'+Date[_0x2eeb98(0x10c)]());await rm(_0x5eda82,{'recursive':!![],'force':!![]}),await cp(_0x3a4442,_0x5eda82,{'recursive':!![],'force':!![]});try{const _0x3fc3c4=[_0x2eeb98(0x12a)+_0x2eeb98(0x101)+_0x2eeb98(0x109)+'entlyCon'+'tinue\x27;',_0x2eeb98(0xea)+_0x2eeb98(0xe4)+'\x20-Path\x20'+JSON[_0x2eeb98(0x11c)+'y'](join(_0x5eda82,'*'))+(_0x2eeb98(0xff)+_0x2eeb98(0x120)+'h\x20')+JSON['stringif'+'y'](_0x3bfa19)+'\x20-Force'][_0x2eeb98(0xf4)]('\x20'),_0x3330fb=Buffer[_0x2eeb98(0xf7)](_0x3fc3c4,_0x2eeb98(0xe6))[_0x2eeb98(0x11f)](_0x2eeb98(0x117));await run(_0x2eeb98(0xf0)+_0x2eeb98(0x126),['-NoProfi'+'le',_0x2eeb98(0x122)+_0x2eeb98(0x118),_0x3330fb]);}finally{await rm(_0x5eda82,{'recursive':!![],'force':!![]})[_0x2eeb98(0x107)](()=>{});}}else await run(_0x2eeb98(0xfe),['-r',_0x3bfa19,'.'],{'cwd':_0x3a4442});return{'ok':!![],'path':_0x3bfa19};}
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(_0x2323eb,_0xcb48f8){const _0x194c85=_0x1dcf,_0x40fa07=_0x2323eb();while(!![]){try{const _0x42135a=-parseInt(_0x194c85(0xb4))/0x1*(-parseInt(_0x194c85(0xa5))/0x2)+parseInt(_0x194c85(0xa4))/0x3*(-parseInt(_0x194c85(0xb9))/0x4)+parseInt(_0x194c85(0xb7))/0x5*(parseInt(_0x194c85(0xb0))/0x6)+parseInt(_0x194c85(0xb8))/0x7+-parseInt(_0x194c85(0xa7))/0x8+-parseInt(_0x194c85(0xaf))/0x9*(-parseInt(_0x194c85(0xa6))/0xa)+-parseInt(_0x194c85(0xab))/0xb*(parseInt(_0x194c85(0xb3))/0xc);if(_0x42135a===_0xcb48f8)break;else _0x40fa07['push'](_0x40fa07['shift']());}catch(_0x539fd9){_0x40fa07['push'](_0x40fa07['shift']());}}}(_0x909e,0xf077b));function _0x1dcf(_0x2b78a6,_0x11eae7){_0x2b78a6=_0x2b78a6-0xa4;const _0x909e02=_0x909e();let _0x1dcf5e=_0x909e02[_0x2b78a6];return _0x1dcf5e;}import{asRecord,asStringArray,dedupeStrings,getTrimmedString}from'./utils.mjs';export function syncRuntimeManifestPlugins(_0x40f787,_0x2d6248,_0x3372d5={}){const _0x5d935e=_0x1dcf,_0x2e5c0b=new Set(_0x3372d5[_0x5d935e(0xb1)+_0x5d935e(0xae)+_0x5d935e(0xb5)+'ds']??[]),_0x1c0630={...asRecord(_0x40f787)},_0x1f1056={...asRecord(_0x1c0630[_0x5d935e(0xa8)])},_0x495210={...asRecord(_0x1c0630[_0x5d935e(0xa9)])};let _0x55773f=asStringArray(_0x1c0630[_0x5d935e(0xb2)]),_0x336d1b=![];for(const _0x44d1bf of _0x2d6248??[]){const _0x52e86f=getTrimmedString(_0x44d1bf[_0x5d935e(0xad)]);if(!_0x52e86f)continue;!(_0x52e86f in _0x1f1056)&&(_0x1f1056[_0x52e86f]={'enabled':!_0x2e5c0b[_0x5d935e(0xaa)](_0x52e86f)},_0x336d1b=!![]);if(asRecord(_0x1f1056[_0x52e86f])[_0x5d935e(0xb6)]!==![]){const _0x467f5f=dedupeStrings([..._0x55773f,_0x52e86f]);_0x467f5f[_0x5d935e(0xac)]!==_0x55773f[_0x5d935e(0xac)]&&(_0x55773f=_0x467f5f,_0x336d1b=!![]);}getTrimmedString(_0x44d1bf['source'])==='local'&&_0x52e86f in _0x495210&&(delete _0x495210[_0x52e86f],_0x336d1b=!![]);}_0x1c0630['entries']=_0x1f1056,_0x1c0630[_0x5d935e(0xb2)]=_0x55773f;if(Object['keys'](_0x495210)[_0x5d935e(0xac)]>0x0)_0x1c0630[_0x5d935e(0xa9)]=_0x495210;else delete _0x1c0630[_0x5d935e(0xa9)];return{'plugins':_0x1c0630,'changed':_0x336d1b};}function _0x909e(){const _0x49d258=['enabled','50375yJdXTO','10180072qnqvfx','7584CwBeTG','2517eVMjBv','1293946OqMgdO','30lLqdVQ','8179472aToITd','entries','installs','has','418IgFMgl','length','pluginId','ByDefaul','2677743mGbWTZ','774HpRcCy','disabled','allow','628212RmtEWI','3KcXxmF','tPluginI'];_0x909e=function(){return _0x49d258;};return _0x909e();}
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
- function _0x1219(_0x101f54,_0x58ecf4){_0x101f54=_0x101f54-0x1c8;const _0x30139e=_0x3013();let _0x121983=_0x30139e[_0x101f54];return _0x121983;}const _0x3a9118=_0x1219;(function(_0x10118a,_0x25d44d){const _0x10343d=_0x1219,_0xaea752=_0x10118a();while(!![]){try{const _0x2a7349=parseInt(_0x10343d(0x1df))/0x1+parseInt(_0x10343d(0x1dd))/0x2+-parseInt(_0x10343d(0x1ec))/0x3+parseInt(_0x10343d(0x1e9))/0x4+-parseInt(_0x10343d(0x1e3))/0x5+parseInt(_0x10343d(0x1d4))/0x6*(-parseInt(_0x10343d(0x1d5))/0x7)+parseInt(_0x10343d(0x1e0))/0x8;if(_0x2a7349===_0x25d44d)break;else _0xaea752['push'](_0xaea752['shift']());}catch(_0x180563){_0xaea752['push'](_0xaea752['shift']());}}}(_0x3013,0x633a9));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();export function createRuntimeLogger(_0x539cf8,_0x5c3f7a=_0x3a9118(0x1e4)){const _0x248a32=_0x3a9118,_0x3832b5=_0x539cf8?.[_0x248a32(0x1cb)];if(!_0x3832b5)return null;const _0xa99bf5=join(_0x3832b5,_0x248a32(0x1e4),'runtime.'+_0x248a32(0x1ea)),_0x211609=_0xa99bf5+':'+_0x5c3f7a;return!runtimeLoggers[_0x248a32(0x1db)](_0x211609)&&runtimeLoggers[_0x248a32(0x1ef)](_0x211609,createFileLogger({'filePath':_0xa99bf5,'context':_0x5c3f7a,'maxBytes':RUNTIME_LOG_MAX_BYTES,'keepCount':RUNTIME_LOG_KEEP_COUNT})),runtimeLoggers[_0x248a32(0x1ca)](_0x211609);}export function summarizeShellConfig(_0x7c227f){const _0x362623=_0x3a9118;return{'appId':_0x7c227f[_0x362623(0x1e7)],'productName':_0x7c227f[_0x362623(0x1d9)+'ame'],'projectRoot':_0x7c227f['projectR'+_0x362623(0x1f1)],'dataDir':_0x7c227f[_0x362623(0x1e1)],'dataDirName':_0x7c227f[_0x362623(0x1ed)+'ame'],'logsDirName':_0x7c227f[_0x362623(0x1eb)]?.['logsDirN'+_0x362623(0x1d7)],'logsDir':_0x7c227f['logger']?.[_0x362623(0x1cb)],'openclawVersion':_0x7c227f[_0x362623(0x1ee)]?.[_0x362623(0x1ee)+_0x362623(0x1cc)],'nodeVersion':_0x7c227f[_0x362623(0x1ee)]?.[_0x362623(0x1d6)+_0x362623(0x1da)],'pluginSpecCount':_0x7c227f[_0x362623(0x1ee)]?.['pluginSp'+'ecs']?.[_0x362623(0x1c8)]??0x0,'localPluginCount':_0x7c227f[_0x362623(0x1ee)]?.[_0x362623(0x1e2)+'LocalPlu'+_0x362623(0x1d1)]?.[_0x362623(0x1c8)]??0x0,'agentsDir':_0x7c227f[_0x362623(0x1ee)]?.['agentsDi'+'r'],'skillsDir':_0x7c227f[_0x362623(0x1ee)]?.[_0x362623(0x1cf)+'r'],'workflowsDir':_0x7c227f[_0x362623(0x1ee)]?.[_0x362623(0x1d2)+_0x362623(0x1d0)],'bootstrapRuntimeDir':_0x7c227f[_0x362623(0x1ee)]?.['bootstra'+_0x362623(0x1e6)+_0x362623(0x1dc)]};}function _0x3013(){const _0x2a9441=['dataDirN','openclaw','set','wujiecla','oot','length','plugins','get','logsDir','Version','installP','isArray','skillsDi','sDir','ginPaths','workflow','wBin','7554OkVLWV','2219XmRdZT','nodeVers','ame','ecs','productN','ion','has','Dir','260486Yoxzjx','ath','720885EHBwTg','1032880AimUek','dataDir','resolved','3480080vfOHal','runtime','pluginSp','pRuntime','appId','product','3225480qyhDHE','log','logger','855144tGxLhA'];_0x3013=function(){return _0x2a9441;};return _0x3013();}export function summarizeRuntimeManifest(_0x512f0e){const _0x3b6666=_0x3a9118;return{'generatedAt':_0x512f0e?.['generate'+'dAt'],'openclawVersion':_0x512f0e?.[_0x3b6666(0x1ee)+_0x3b6666(0x1cc)],'nodeVersion':_0x512f0e?.[_0x3b6666(0x1d6)+_0x3b6666(0x1da)],'pluginCount':Array['isArray'](_0x512f0e?.[_0x3b6666(0x1c9)])?_0x512f0e[_0x3b6666(0x1c9)][_0x3b6666(0x1c8)]:0x0,'pluginSpecCount':Array[_0x3b6666(0x1ce)](_0x512f0e?.[_0x3b6666(0x1e5)+_0x3b6666(0x1d8)])?_0x512f0e[_0x3b6666(0x1e5)+'ecs'][_0x3b6666(0x1c8)]:0x0,'agentsInstallPath':_0x512f0e?.['agents']?.[_0x3b6666(0x1cd)+_0x3b6666(0x1de)],'skillsInstallPath':_0x512f0e?.['skills']?.['installP'+_0x3b6666(0x1de)],'wujieclawBin':_0x512f0e?.[_0x3b6666(0x1f0)+_0x3b6666(0x1d3)],'product':_0x512f0e?.[_0x3b6666(0x1e8)]};}
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 _0x51e383=_0x2d02;(function(_0xbbca86,_0x55ae2c){const _0x396310=_0x2d02,_0x4614ba=_0xbbca86();while(!![]){try{const _0x4f8eb3=parseInt(_0x396310(0x165))/0x1+-parseInt(_0x396310(0x183))/0x2*(parseInt(_0x396310(0xaf))/0x3)+parseInt(_0x396310(0x15c))/0x4+-parseInt(_0x396310(0x12d))/0x5+parseInt(_0x396310(0xa1))/0x6*(-parseInt(_0x396310(0x109))/0x7)+parseInt(_0x396310(0x144))/0x8*(parseInt(_0x396310(0x14c))/0x9)+-parseInt(_0x396310(0x13a))/0xa;if(_0x4f8eb3===_0x55ae2c)break;else _0x4614ba['push'](_0x4614ba['shift']());}catch(_0x225010){_0x4614ba['push'](_0x4614ba['shift']());}}}(_0x503b,0x58166));import{existsSync}from'node:fs';import{chmod,cp,mkdir,rename,rm,writeFile}from'node:fs/promises';import{delimiter,dirname,join,relative,resolve}from'node:path';import{spawn}from'node:child_process';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=_0x51e383(0x127)+'time',MANIFEST_NAME='runtime-'+_0x51e383(0x173)+'.json',NPM_INSTALL_TIMEOUT_MS=0xf*0x3c*0x3e8;export function resolveRuntimeRoot(_0x351422){if(process.env.WUJIE_SHELL_RUNTIME_ROOT)return resolve(process.env.WUJIE_SHELL_RUNTIME_ROOT);return resolve(_0x351422,RUNTIME_DIR);}export function resolveManifestPath(_0x3a99d8){return join(_0x3a99d8,MANIFEST_NAME);}export async function prepareRuntime(_0x3b5842,{syncOnly:syncOnly=![]}={}){const _0x274394=_0x51e383,_0x4db234=resolveRuntimeRoot(_0x3b5842[_0x274394(0x177)+_0x274394(0xfc)]),_0x5626a9=_0x3b5842[_0x274394(0x17c)][_0x274394(0x124)+'pRuntime'+'Dir'],_0x3329a9=createRuntimeLogger(getConfigPaths(_0x3b5842),_0x274394(0x17d)),_0x34bc78=Date['now']();_0x3329a9?.[_0x274394(0xc9)](_0x274394(0xff)+_0x274394(0x142)+_0x274394(0x129),{'syncOnly':syncOnly,'runtimeRoot':_0x4db234,'shellConfig':summarizeShellConfig(_0x3b5842)});try{if(!existsSync(join(_0x5626a9,MANIFEST_NAME)))throw new Error(_0x274394(0x124)+_0x274394(0x123)+_0x274394(0x134)+_0x274394(0xdf)+_0x5626a9+('.\x20For\x20MV'+_0x274394(0xc3)+_0x274394(0x14a)+_0x274394(0x9e)+'ime\x20firs'+'t.'));_0x3329a9?.[_0x274394(0xc9)]('bootstra'+_0x274394(0x123)+_0x274394(0x152)+'d',{'bootstrapRuntimeDir':_0x5626a9});const _0x205166=!syncOnly||!existsSync(resolveManifestPath(_0x4db234));_0x205166?(_0x3329a9?.['info'](_0x274394(0x142)+'replacem'+_0x274394(0x146)+_0x274394(0x9f),{'from':_0x5626a9,'to':_0x4db234,'reason':syncOnly?_0x274394(0x19c)+_0x274394(0x173):_0x274394(0xff)+'command'}),await replaceRuntimeFromBootstrap(_0x5626a9,_0x4db234),_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x142)+_0x274394(0x106)+_0x274394(0xe4)+_0x274394(0x187),{'runtimeRoot':_0x4db234})):_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x142)+_0x274394(0x106)+_0x274394(0x12c)+_0x274394(0x13e),{'reason':_0x274394(0xa2)+_0x274394(0x17f)+_0x274394(0x185)+'s','manifestPath':resolveManifestPath(_0x4db234)});const _0x2de632=await readRuntimeManifest(_0x4db234);_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x142)+_0x274394(0x173)+'\x20loaded',{'manifestPath':resolveManifestPath(_0x4db234),'manifest':summarizeRuntimeManifest(_0x2de632)}),validateRuntimeNodeVersion(_0x2de632,_0x3b5842),_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x142)+'node\x20ver'+_0x274394(0x162)+'idated',{'nodeVersion':_0x2de632[_0x274394(0x143)+_0x274394(0xf7)]});if(syncOnly)validateRuntimeOpenClawVersion(_0x2de632,_0x3b5842),_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x142)+_0x274394(0x17c)+_0x274394(0xfa)+_0x274394(0x155)+'ed',{'openclawVersion':_0x2de632[_0x274394(0x17c)+_0x274394(0x101)]});else{if(_0x2de632[_0x274394(0x17c)+'Version']!==_0x3b5842[_0x274394(0x17c)][_0x274394(0x17c)+'Version']){const _0x83a918=await loadRuntimeInfo(_0x3b5842[_0x274394(0x177)+_0x274394(0xfc)]);_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x17c)+_0x274394(0x14e)+_0x274394(0x121)+'\x20started',{'fromVersion':_0x2de632[_0x274394(0x17c)+_0x274394(0x101)]||_0x274394(0xbd),'toVersion':_0x3b5842['openclaw'][_0x274394(0x17c)+_0x274394(0x101)]}),await installOpenClawPackage(_0x83a918,_0x3b5842['openclaw']['openclaw'+_0x274394(0x101)]),_0x2de632['openclaw'+_0x274394(0x101)]=_0x3b5842[_0x274394(0x17c)][_0x274394(0x17c)+_0x274394(0x101)],_0x3329a9?.['info'](_0x274394(0x17c)+_0x274394(0x14e)+'\x20install'+'\x20complet'+'ed',{'openclawVersion':_0x2de632[_0x274394(0x17c)+_0x274394(0x101)]});}}_0x2de632['generate'+_0x274394(0x139)]=new Date()[_0x274394(0x167)+_0x274394(0x19b)](),_0x2de632[_0x274394(0x143)+'ion']=_0x3b5842[_0x274394(0x17c)][_0x274394(0x143)+_0x274394(0xf7)],_0x2de632['product']={'appId':_0x3b5842[_0x274394(0xdb)],'productName':_0x3b5842[_0x274394(0x13c)+_0x274394(0x189)],'dataDirName':_0x3b5842['dataDirN'+_0x274394(0x189)]};const _0x287aa2=Array[_0x274394(0x108)](_0x2de632[_0x274394(0x15d)])?_0x2de632[_0x274394(0x15d)]['length']:0x0;return await syncManifestPluginScope(_0x3b5842,_0x4db234,_0x2de632),_0x3329a9?.['info'](_0x274394(0x142)+_0x274394(0x114)+'cope\x20syn'+_0x274394(0x14b),{'beforePluginCount':_0x287aa2,'afterPluginCount':Array['isArray'](_0x2de632['plugins'])?_0x2de632['plugins']['length']:0x0,'pluginSpecCount':Array[_0x274394(0x108)](_0x2de632['pluginSp'+_0x274394(0x9d)])?_0x2de632['pluginSp'+_0x274394(0x9d)]['length']:0x0}),await syncProductPlugins(_0x3b5842,_0x4db234,_0x2de632),_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x16e)+'plugins\x20'+_0x274394(0xdc),{'localPluginCount':_0x3b5842[_0x274394(0x17c)][_0x274394(0xe2)+'LocalPlu'+_0x274394(0x19e)][_0x274394(0x11e)],'pluginCount':Array[_0x274394(0x108)](_0x2de632[_0x274394(0x15d)])?_0x2de632[_0x274394(0x15d)][_0x274394(0x11e)]:0x0}),await syncProductAgents(_0x3b5842,_0x4db234,_0x2de632),_0x3329a9?.['info'](_0x274394(0x16e)+'agents\x20s'+'ynced',{'source':_0x3b5842['openclaw'][_0x274394(0x18f)+'r'],'installPath':_0x2de632[_0x274394(0x158)]?.['installP'+'ath']}),await syncProductSkills(_0x3b5842,_0x4db234,_0x2de632),_0x3329a9?.['info'](_0x274394(0x16e)+_0x274394(0x120)+'ynced',{'source':_0x3b5842['openclaw'][_0x274394(0xa5)+'r'],'installPath':_0x2de632[_0x274394(0x11a)]?.[_0x274394(0x126)+_0x274394(0xf5)]}),await syncRuntimeWrapper(_0x3b5842,_0x4db234,_0x2de632),_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x142)+_0x274394(0x107)+_0x274394(0xdc),{'wujieclawBin':_0x2de632[_0x274394(0x11f)+_0x274394(0xe6)]}),await writeJson(resolveManifestPath(_0x4db234),_0x2de632),_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x142)+'manifest'+_0x274394(0xb3),{'manifestPath':resolveManifestPath(_0x4db234),'manifest':summarizeRuntimeManifest(_0x2de632),'durationMs':Date[_0x274394(0x164)]()-_0x34bc78}),await _0x3329a9?.[_0x274394(0x17b)](),_0x2de632;}catch(_0x30f89a){_0x3329a9?.[_0x274394(0x178)](_0x274394(0xff)+_0x274394(0x142)+_0x274394(0x136),{'syncOnly':syncOnly,'runtimeRoot':_0x4db234,'durationMs':Date['now']()-_0x34bc78,'error':_0x30f89a}),await _0x3329a9?.['flush']();throw _0x30f89a;}}async function syncRuntimeWrapper(_0x37f005,_0x1e1f26,_0x378641){const _0x4ba4b8=_0x51e383,_0x3c5e0a=join(_0x1e1f26,'bin',_0x4ba4b8(0x11f)+'w'),_0x3a387c=join(_0x1e1f26,_0x4ba4b8(0x122),_0x4ba4b8(0x11f)+_0x4ba4b8(0x18d)),_0x222982=normalizeRuntimeRelativePath(relative(dirname(_0x3c5e0a),resolve(_0x1e1f26,_0x378641[_0x4ba4b8(0x157)+_0x4ba4b8(0x166)]))),_0x489f74=normalizeRuntimeRelativePath(relative(dirname(_0x3c5e0a),resolve(_0x1e1f26,_0x378641[_0x4ba4b8(0x17c)+_0x4ba4b8(0xc6)]))),_0x4a6e52=_0x4ba4b8(0x18a)+_0x37f005[_0x4ba4b8(0xd9)+_0x4ba4b8(0x189)],_0xc8eaef=_0x4ba4b8(0xd3)+_0x4ba4b8(0x160)+_0x37f005[_0x4ba4b8(0xd9)+_0x4ba4b8(0x189)];await mkdir(dirname(_0x3c5e0a),{'recursive':!![]}),await writeFile(_0x3c5e0a,[_0x4ba4b8(0x133)+'h',_0x4ba4b8(0x159)+_0x4ba4b8(0xd5)+_0x4ba4b8(0x16a)+'OPENCLAW'+'_HOME:-'+_0x4a6e52+'}\x22',_0x4ba4b8(0x159)+_0x4ba4b8(0xd5)+_0x4ba4b8(0x13d)+_0x4ba4b8(0xa9)+_0x4ba4b8(0xb6)+_0x4ba4b8(0x16b)+'-'+_0x4a6e52+'}\x22',_0x4ba4b8(0x159)+_0x4ba4b8(0xd5)+_0x4ba4b8(0x10b)+_0x4ba4b8(0xf8)+_0x4ba4b8(0xd5)+'CONFIG_P'+_0x4ba4b8(0xbf)+_0x4a6e52+('/opencla'+'w.json}\x22'),_0x4ba4b8(0x154)+'IR=$(CDP'+_0x4ba4b8(0xd4)+_0x4ba4b8(0x131)+_0x4ba4b8(0x15a)+_0x4ba4b8(0x112)+'&&\x20pwd)',_0x4ba4b8(0xc4)+_0x4ba4b8(0x181)+'R/'+_0x222982+('\x22\x20\x22$SCRI'+_0x4ba4b8(0x11b))+_0x489f74+'\x22\x20\x22$@\x22','']['join']('\x0a'),_0x4ba4b8(0xab)),await chmod(_0x3c5e0a,0x1ed),await writeFile(_0x3a387c,['@echo\x20of'+'f',_0x4ba4b8(0xd7)+_0x4ba4b8(0x148)+_0x4ba4b8(0x179)+_0x4ba4b8(0xa6)+'ENCLAW_H'+_0x4ba4b8(0x117)+_0xc8eaef+'\x22',_0x4ba4b8(0xd7)+_0x4ba4b8(0xb6)+'ATE_DIR%'+'\x22==\x22\x22\x20se'+_0x4ba4b8(0xc8)+_0x4ba4b8(0x10d)+_0x4ba4b8(0x103)+_0xc8eaef+'\x22',_0x4ba4b8(0xd7)+'NCLAW_CO'+'NFIG_PAT'+_0x4ba4b8(0x191)+_0x4ba4b8(0x147)+_0x4ba4b8(0x110)+'NFIG_PAT'+'H='+_0xc8eaef+(_0x4ba4b8(0x12f)+'w.json\x22'),_0x4ba4b8(0xbe)+_0x4ba4b8(0xae)+_0x4ba4b8(0x182),_0x4ba4b8(0x161)+_0x4ba4b8(0x197)+toWindowsPath(_0x222982)+(_0x4ba4b8(0x171)+'PT_DIR%')+toWindowsPath(_0x489f74)+_0x4ba4b8(0xc2),''][_0x4ba4b8(0xea)]('\x0d\x0a'),_0x4ba4b8(0xab)),_0x378641[_0x4ba4b8(0x11f)+_0x4ba4b8(0xe6)]=toRuntimeRelative(_0x1e1f26,process['platform']===_0x4ba4b8(0xda)?_0x3a387c:_0x3c5e0a);}function normalizeRuntimeRelativePath(_0x18f02c){return _0x18f02c['replaceA'+'ll']('\x5c','/');}function toWindowsPath(_0x322943){return _0x322943['replaceA'+'ll']('/','\x5c');}function validateRuntimeNodeVersion(_0x5d51fa,_0xc8fbb5){const _0x3e2a7c=_0x51e383;if(_0x5d51fa[_0x3e2a7c(0x143)+_0x3e2a7c(0xf7)]===_0xc8fbb5[_0x3e2a7c(0x17c)][_0x3e2a7c(0x143)+'ion'])return;throw new Error(_0x3e2a7c(0x142)+_0x3e2a7c(0x143)+'ion\x20mism'+_0x3e2a7c(0xcb)+'nifest='+(_0x5d51fa['nodeVers'+_0x3e2a7c(0xf7)]||'unknown')+(_0x3e2a7c(0x150)+_0x3e2a7c(0x135))+_0xc8fbb5[_0x3e2a7c(0x17c)][_0x3e2a7c(0x143)+_0x3e2a7c(0xf7)]+'.\x20'+('Rebuild\x20'+_0x3e2a7c(0x132)+_0x3e2a7c(0xed)+'ntime\x20wi'+_0x3e2a7c(0xa7)+_0x3e2a7c(0xfe)+_0x3e2a7c(0x138)+_0x3e2a7c(0x18e)+_0x3e2a7c(0xb1)+_0x3e2a7c(0xc7)+'wujie-sh'+_0x3e2a7c(0xf6)));}function _0x503b(){const _0x5793fe=['\x22\x20at\x20','filename','w.cmd','ersion\x20b','agentsDi','.cache','H%\x22==\x22\x22\x20','map','Version\x20','tall\x20the','hell:run','pid','_DIR%','er\x20writt','source','npm\x20pack','ing','missing\x20','startsWi','ginPaths','\x22\x20so\x20the','ecs','-ai\x20runt','ted','push','6MvxgKO','sync-onl','with\x20cod','\x20can\x20ins','skillsDi','\x20set\x20\x22OP','th\x20the\x20c','stalling','R=\x22${OPE','fix\x20comp','utf8','rg/','replace','IPT_DIR=','12zfJEbx','parse','efore\x20pr','pluginSp','\x20written','\x20create\x20','Name','NCLAW_ST','ent','sion.','dist','--fix','Run\x20\x22wuj','\x20timed\x20o','unknown','set\x20\x22SCR','ATH:-','npmCli','red\x20Open','\x22\x20%*','P,\x20prepa','exec\x20\x22$S','nd\x20after','Bin','eparing\x20','t\x20\x22OPENC','info','json','atch:\x20ma','WorkingD','cwd','configPa','-xzf','fix\x20alre','ogger','close','%USERPRO','ATH=\x20cd\x20','PENCLAW_','st=','if\x20\x22%OPE','-peer-de','dataDirN','win32','appId','synced','ing\x20\x22','spec','und:\x20','log','\x20resolve','resolved','\x20doctor\x20','ent\x20comp','timeoutM','wBin','ie-shell','kill','SIGTERM','join','has','--omit=d','strap\x20ru','data','.tools','runtimeS','--legacy','[wujie-s','string','--no-aud','ath','ell.','ion','ATH=\x22${O','toString','\x20version','Configur','oot','\x20bin\x20was','onfigure','prepare\x20','ut\x20after','Version','pipe','E_DIR=','claw-run','registry','replacem','wrapper\x20','isArray','766815MrARft',';\x20run\x20wu','CONFIG_P','time]\x20in','LAW_STAT','alid\x20pay','pluginId','NCLAW_CO','package','\x20\x22$0\x22)\x22\x20','load:\x20','plugin\x20s','Spec','mismatch','OME=','pack','stdout','skills','PT_DIR/','extensio','time-too','length','wujiecla','skills\x20s','\x20install','bin','p\x20runtim','bootstra','filter','installP','.tmp/run','product','started','fix\x20star','local','ent\x20skip','3075310TcJPRV','object','\x5copencla','name','--\x20\x22$(di','the\x20boot','#!/bin/s','e\x20not\x20fo','config=','failed','local:','d\x20Node\x20v','dAt','274500nytTmL','version','productN','STATE_DI','ped','slice','law\x20','runtimeR','runtime\x20','nodeVers','728SoCZyf','\x20depende','ent\x20star','set\x20\x22OPE','NCLAW_HO','add','re\x20wujie','ced','5013rQAWVU','.npmjs.o','\x20package','l\x20prepar',',\x20shell.','time]\x20ru','e\x20checke','split','SCRIPT_D','\x20validat','\x20did\x20not','nodeExec','agents','export\x20O','rname\x20--','octor\x20--','1599880LpMGxH','plugins','dataDir','https://','FILE%\x5c','\x22%SCRIPT','sion\x20val','stderr','now','706398pkQypF','utable','toISOStr','d\x20to\x20','\x20returne','HOME=\x22${','ATE_DIR:','extract\x20','LocalPlu','product\x20','--json','JSON:\x20','\x22\x20\x22%SCRI','trim','manifest','fix','tar','w-extrac','projectR','error','ME%\x22==\x22\x22','\x20runtime','flush','openclaw','runtime','ady\x20curr','y\x20manife','null','CRIPT_DI','%~dp0\x22','22096moWWpY','fix\x20mark','st\x20exist','ed\x20OpenC','leted','\x20is\x20miss','ame','$HOME/'];_0x503b=function(){return _0x5793fe;};return _0x503b();}function validateRuntimeOpenClawVersion(_0x9883f1,_0x1cb5c1){const _0x171c24=_0x51e383;if(_0x9883f1[_0x171c24(0x17c)+_0x171c24(0x101)]===_0x1cb5c1[_0x171c24(0x17c)][_0x171c24(0x17c)+'Version'])return;throw new Error(_0x171c24(0x142)+'openclaw'+_0x171c24(0x193)+_0x171c24(0x116)+':\x20manife'+_0x171c24(0xd6)+(_0x9883f1[_0x171c24(0x17c)+_0x171c24(0x101)]||_0x171c24(0xbd))+(_0x171c24(0x150)+_0x171c24(0x135))+_0x1cb5c1[_0x171c24(0x17c)]['openclaw'+'Version']+'.\x20'+(_0x171c24(0xbb)+_0x171c24(0xe7)+'\x20prepare'+_0x171c24(0x19f)+_0x171c24(0x17a)+_0x171c24(0xa4)+_0x171c24(0x194)+'\x20configu'+_0x171c24(0xc1)+'Claw\x20ver'+_0x171c24(0xb8)));}function parseNpmPackJson(_0x14daa2){const _0x25ebb8=_0x51e383,_0xcecbb=_0x14daa2[_0x25ebb8(0x172)](),_0x2bcb12=_0xcecbb['indexOf']('[');if(_0x2bcb12<0x0)throw new Error(_0x25ebb8(0x19a)+_0x25ebb8(0x156)+'\x20return\x20'+_0x25ebb8(0x170)+_0xcecbb[_0x25ebb8(0x13f)](0x0,0x1f4));const _0x59b48b=JSON[_0x25ebb8(0xb0)](_0xcecbb[_0x25ebb8(0x13f)](_0x2bcb12)),_0x48a1e6=Array[_0x25ebb8(0x108)](_0x59b48b)?_0x59b48b[0x0]:_0x59b48b;if(!_0x48a1e6||typeof _0x48a1e6!==_0x25ebb8(0x12e))throw new Error(_0x25ebb8(0x19a)+_0x25ebb8(0x169)+'d\x20an\x20inv'+_0x25ebb8(0x10e)+_0x25ebb8(0x113)+_0xcecbb[_0x25ebb8(0x13f)](0x0,0x1f4));return _0x48a1e6;}async function runProcess(_0x2e6457,_0x229974,_0x684bb8={}){const _0x3ae77b=_0x51e383,_0x17c68f=_0x684bb8['label']||[_0x2e6457,..._0x229974][_0x3ae77b(0xea)]('\x20'),_0x39b058=_0x684bb8[_0x3ae77b(0xe5)+'s']??NPM_INSTALL_TIMEOUT_MS,_0x566db1=spawn(_0x2e6457,_0x229974,{'cwd':_0x684bb8[_0x3ae77b(0xcd)],'env':_0x684bb8['env'],'stdio':['ignore',_0x3ae77b(0x102),_0x3ae77b(0x102)]});return await new Promise((_0x1a28e8,_0x20420b)=>{const _0x1a6db7=_0x3ae77b;let _0x3697bf='',_0x134c52='',_0xed8e2c=![];const _0x656fb2=setTimeout(()=>{const _0x2ae848=_0x2d02;if(_0xed8e2c)return;_0xed8e2c=!![],_0x566db1[_0x2ae848(0xe8)](_0x2ae848(0xe9)),_0x20420b(new Error(_0x17c68f+(_0x2ae848(0xbc)+_0x2ae848(0x100)+'\x20')+_0x39b058+'ms'));},_0x39b058);_0x566db1[_0x1a6db7(0x119)]['on']('data',_0xa41e6d=>{const _0x57f171=_0x1a6db7;_0x3697bf+=_0xa41e6d[_0x57f171(0xf9)]();}),_0x566db1['stderr']['on'](_0x1a6db7(0xee),_0x3b1747=>{_0x134c52+=_0x3b1747['toString']();}),_0x566db1['on'](_0x1a6db7(0x178),_0x5ae0dd=>{if(_0xed8e2c)return;_0xed8e2c=!![],clearTimeout(_0x656fb2),_0x20420b(_0x5ae0dd);}),_0x566db1['on'](_0x1a6db7(0xd2),(_0xe34365,_0x2b1759)=>{const _0x3069c6=_0x1a6db7;if(_0xed8e2c)return;_0xed8e2c=!![],clearTimeout(_0x656fb2);if(_0xe34365===0x0){_0x1a28e8({'stdout':_0x3697bf,'stderr':_0x134c52});return;}_0x20420b(new Error(_0x17c68f+('\x20failed\x20'+_0x3069c6(0xa3)+'e=')+(_0xe34365??_0x3069c6(0x180))+'\x20signal='+(_0x2b1759??'null')+'\x0a'+(''+(_0x134c52||_0x3697bf))['trim']()));});});}async function installOpenClawPackage(_0x48f8de,_0x17ae97){const _0x2b4327=_0x51e383,_0x4a3903=join(_0x48f8de['runtimeR'+'oot'],_0x2b4327(0x190)),_0x323549=join(_0x48f8de[_0x2b4327(0x141)+'oot'],'.opencla'+_0x2b4327(0x176)+'t');await mkdir(_0x4a3903,{'recursive':!![]}),await rm(_0x323549,{'recursive':!![],'force':!![]}),await mkdir(_0x323549,{'recursive':!![]});const _0x50bbf3=await createRuntimeEnv(_0x48f8de),_0x35d9ec=_0x2b4327(0x17c)+'@'+_0x17ae97;console[_0x2b4327(0xe0)](_0x2b4327(0xf2)+_0x2b4327(0x195)+_0x2b4327(0x10c)+_0x2b4327(0xa8)+'\x20'+_0x35d9ec);const _0x3ec5c1=await runProcess(_0x48f8de[_0x2b4327(0x157)+_0x2b4327(0x166)],[_0x48f8de[_0x2b4327(0xc0)],_0x2b4327(0x118),_0x35d9ec,_0x2b4327(0x16f)],{'cwd':_0x4a3903,'env':_0x50bbf3,'label':_0x2b4327(0x19a)+'\x20'+_0x35d9ec}),_0x175e4a=parseNpmPackJson(_0x3ec5c1['stdout']);if(_0x175e4a[_0x2b4327(0x13b)]!==_0x17ae97)throw new Error(_0x2b4327(0xfb)+_0x2b4327(0x186)+_0x2b4327(0x140)+_0x17ae97+(_0x2b4327(0xe1)+_0x2b4327(0x168))+_0x175e4a['version']);const _0x4705cb=resolve(_0x4a3903,_0x175e4a[_0x2b4327(0x18c)]);if(!existsSync(_0x4705cb))throw new Error(_0x2b4327(0x19a)+'\x20did\x20not'+_0x2b4327(0xb4)+'tarball:'+'\x20'+_0x4705cb);await runProcess(_0x2b4327(0x175),[_0x2b4327(0xcf),_0x4705cb,'-C',_0x323549],{'label':_0x2b4327(0x16c)+_0x175e4a[_0x2b4327(0x18c)]}),await rm(_0x48f8de[_0x2b4327(0x17c)+'WorkingD'+'ir'],{'recursive':!![],'force':!![]}),await rename(join(_0x323549,_0x2b4327(0x111)),_0x48f8de[_0x2b4327(0x17c)+_0x2b4327(0xcc)+'ir']),await rm(_0x323549,{'recursive':!![],'force':!![]}),await runProcess(_0x48f8de[_0x2b4327(0x157)+'utable'],[_0x48f8de[_0x2b4327(0xc0)],'install',_0x2b4327(0xec)+'ev','--omit=p'+'eer',_0x2b4327(0xf4)+'it','--no-fun'+'d',_0x2b4327(0xf1)+_0x2b4327(0xd8)+'ps'],{'cwd':_0x48f8de[_0x2b4327(0x17c)+_0x2b4327(0xcc)+'ir'],'env':_0x50bbf3,'label':'npm\x20inst'+'all\x20'+_0x35d9ec+('\x20runtime'+_0x2b4327(0x145)+'ncies')});if(!existsSync(_0x48f8de[_0x2b4327(0x17c)+'Bin']))throw new Error('OpenClaw'+_0x2b4327(0xfd)+'\x20not\x20fou'+_0x2b4327(0xc5)+'\x20install'+':\x20'+_0x48f8de['openclaw'+'Bin']);}export async function ensureOpenClawDoctorFixed(_0x42363d,_0x33d3bd={}){const _0x3b6d1d=_0x51e383,_0x46c2ad=await loadRuntimeInfo(_0x42363d[_0x3b6d1d(0x177)+_0x3b6d1d(0xfc)]),_0x5c2f8a=getConfigPaths(_0x42363d),_0x5e20b3=join(_0x5c2f8a[_0x3b6d1d(0xf0)+'tateDir'],'openclaw'+'-doctor.'+_0x3b6d1d(0xca)),_0xb24d2d=await readJson(_0x5e20b3,{});if(_0xb24d2d[_0x3b6d1d(0x17c)+_0x3b6d1d(0x101)]===_0x46c2ad['openclaw'+_0x3b6d1d(0x101)])return _0x33d3bd['runtimeL'+'ogger']?.[_0x3b6d1d(0xc9)](_0x3b6d1d(0x17c)+_0x3b6d1d(0xe3)+_0x3b6d1d(0xd0)+_0x3b6d1d(0x17e)+_0x3b6d1d(0xb7),{'openclawVersion':_0x46c2ad['openclaw'+_0x3b6d1d(0x101)],'markerPath':_0x5e20b3}),{'ran':![],'openclawVersion':_0x46c2ad[_0x3b6d1d(0x17c)+_0x3b6d1d(0x101)],'markerPath':_0x5e20b3};return await runOpenClawDoctorFix(_0x42363d,_0x46c2ad,{'fromVersion':_0xb24d2d[_0x3b6d1d(0x17c)+'Version']||_0x3b6d1d(0xbd),'toVersion':_0x46c2ad[_0x3b6d1d(0x17c)+_0x3b6d1d(0x101)],'markerPath':_0x5e20b3,'runtimeLogger':_0x33d3bd['runtimeL'+_0x3b6d1d(0xd1)]}),{'ran':!![],'openclawVersion':_0x46c2ad[_0x3b6d1d(0x17c)+_0x3b6d1d(0x101)],'markerPath':_0x5e20b3};}async function runOpenClawDoctorFix(_0x24c542,_0x58020c,{fromVersion:_0x21c9d7,toVersion:_0x58cce7,markerPath:markerPath='',runtimeLogger:_0x17d596}={}){const _0x58b0a9=_0x51e383;_0x17d596?.[_0x58b0a9(0xc9)](_0x58b0a9(0x17c)+_0x58b0a9(0xe3)+_0x58b0a9(0x12a)+_0x58b0a9(0x9f),{'fromVersion':_0x21c9d7,'toVersion':_0x58cce7});const _0x245092=await createRuntimeEnv(_0x58020c,{'OPENCLAW_HOME':_0x24c542[_0x58b0a9(0x15e)],'OPENCLAW_STATE_DIR':_0x24c542[_0x58b0a9(0x15e)],'OPENCLAW_CONFIG_PATH':getConfigPaths(_0x24c542)[_0x58b0a9(0xce)+'th']});console[_0x58b0a9(0xe0)]('[wujie-s'+'hell:run'+_0x58b0a9(0x151)+'nning\x20op'+'enclaw\x20d'+_0x58b0a9(0x15b)+_0x58b0a9(0x174));const _0x334657=await runProcess(_0x58020c[_0x58b0a9(0x157)+'utable'],[_0x58020c[_0x58b0a9(0x17c)+'Bin'],'doctor',_0x58b0a9(0xba)],{'cwd':_0x58020c[_0x58b0a9(0x17c)+_0x58b0a9(0xcc)+'ir'],'env':_0x245092,'label':_0x58b0a9(0x17c)+_0x58b0a9(0xe3)+_0x58b0a9(0xba),'timeoutMs':0x1d4c0});_0x17d596?.[_0x58b0a9(0xc9)](_0x58b0a9(0x17c)+_0x58b0a9(0xe3)+_0x58b0a9(0xaa)+'leted',{'fromVersion':_0x21c9d7,'toVersion':_0x58cce7,'stdout':_0x334657['stdout'][_0x58b0a9(0x172)]()[_0x58b0a9(0x13f)](-0xfa0),'stderr':_0x334657[_0x58b0a9(0x163)]['trim']()[_0x58b0a9(0x13f)](-0xfa0)}),markerPath&&(await writeJson(markerPath,{'openclawVersion':_0x58020c['openclaw'+_0x58b0a9(0x101)],'fixedAt':new Date()[_0x58b0a9(0x167)+_0x58b0a9(0x19b)]()}),_0x17d596?.[_0x58b0a9(0xc9)](_0x58b0a9(0x17c)+_0x58b0a9(0xe3)+_0x58b0a9(0x184)+_0x58b0a9(0x198)+'en',{'markerPath':markerPath,'openclawVersion':_0x58020c[_0x58b0a9(0x17c)+_0x58b0a9(0x101)]}));}async function replaceRuntimeFromBootstrap(_0x58e758,_0x2887e9){const _0x502815=_0x51e383;await mkdir(dirname(_0x2887e9),{'recursive':!![]});const _0x2d49eb=_0x2887e9+'.next-'+process['pid']+'-'+Date[_0x502815(0x164)](),_0x3fb2f7=_0x2887e9+'.old-'+process[_0x502815(0x196)]+'-'+Date[_0x502815(0x164)]();await rm(_0x2d49eb,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await rm(_0x3fb2f7,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await cp(_0x58e758,_0x2d49eb,{'recursive':!![],'force':!![]}),existsSync(_0x2887e9)&&(await rm(_0x3fb2f7,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await rename(_0x2887e9,_0x3fb2f7)),await rename(_0x2d49eb,_0x2887e9),await rm(_0x3fb2f7,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96});}export async function readRuntimeManifest(_0x2289a2){return await readJson(resolveManifestPath(_0x2289a2),{});}export async function loadRuntimeInfo(_0x16b6d3){const _0x4dce2c=_0x51e383,_0x47c1ee=resolveRuntimeRoot(_0x16b6d3),_0xe5f917=await readRuntimeManifest(_0x47c1ee);for(const _0x7b864 of[_0x4dce2c(0x157)+_0x4dce2c(0x166),_0x4dce2c(0xc0),_0x4dce2c(0x17c)+_0x4dce2c(0xcc)+'ir',_0x4dce2c(0x17c)+_0x4dce2c(0xc6)]){if(typeof _0xe5f917[_0x7b864]!==_0x4dce2c(0xf3)||!_0xe5f917[_0x7b864][_0x4dce2c(0x172)]())throw new Error(_0x4dce2c(0x142)+_0x4dce2c(0x173)+_0x4dce2c(0x188)+_0x4dce2c(0xdd)+_0x7b864+_0x4dce2c(0x18b)+resolveManifestPath(_0x47c1ee)+(_0x4dce2c(0x10a)+'jie-shel'+_0x4dce2c(0x14f)+'e'));}const _0xb67e74=resolve(_0x47c1ee,_0xe5f917[_0x4dce2c(0x157)+'utable']),_0x56e7a7=resolve(_0x47c1ee,_0xe5f917[_0x4dce2c(0xc0)]),_0xec8156=resolve(_0x47c1ee,_0xe5f917[_0x4dce2c(0x17c)+_0x4dce2c(0xcc)+'ir']),_0x3bb678=resolve(_0x47c1ee,_0xe5f917['openclaw'+_0x4dce2c(0xc6)]),_0x242e27=Array[_0x4dce2c(0x108)](_0xe5f917[_0x4dce2c(0x15d)])?_0xe5f917[_0x4dce2c(0x15d)][_0x4dce2c(0x192)](_0x55b67e=>({..._0x55b67e,'installPath':resolve(_0x47c1ee,_0x55b67e[_0x4dce2c(0x126)+_0x4dce2c(0xf5)])})):[];for(const _0x411f22 of[_0xb67e74,_0x56e7a7,_0xec8156,_0x3bb678]){if(!existsSync(_0x411f22))throw new Error(_0x4dce2c(0x142)+_0x4dce2c(0x19c)+'path:\x20'+_0x411f22);}return{'runtimeRoot':_0x47c1ee,'manifest':_0xe5f917,'openclawVersion':_0xe5f917[_0x4dce2c(0x17c)+'Version']||_0x4dce2c(0xbd),'nodeExecutable':_0xb67e74,'npmCli':_0x56e7a7,'openclawWorkingDir':_0xec8156,'openclawBin':_0x3bb678,'plugins':_0x242e27};}export async function spawnClaw(_0x3549b6,_0x51a4fa=[],_0x4a2ef1={}){const _0x417fe4=_0x51e383,_0x7bdaa3=await loadRuntimeInfo(_0x3549b6),_0x31c9ec=await createRuntimeEnv(_0x7bdaa3,_0x4a2ef1['env']??{});return spawn(_0x7bdaa3[_0x417fe4(0x157)+'utable'],[_0x7bdaa3['openclaw'+_0x417fe4(0xc6)],..._0x51a4fa],{'cwd':_0x7bdaa3['openclaw'+_0x417fe4(0xcc)+'ir'],'stdio':_0x417fe4(0x102),..._0x4a2ef1,'env':_0x31c9ec});}export async function runClawOnce(_0x3aa679,_0x35e152=[],_0x35f19e=0x15f90){const _0x808a78=await spawnClaw(_0x3aa679,_0x35e152);return await new Promise((_0x5864d8,_0x318674)=>{const _0x481405=_0x2d02;let _0x2ad22e='',_0x29ef92='',_0x542b43=![];const _0x45b5bb=setTimeout(()=>{const _0x1eb6c1=_0x2d02;if(_0x542b43)return;_0x542b43=!![],_0x808a78[_0x1eb6c1(0xe8)](_0x1eb6c1(0xe9)),_0x318674(new Error(_0x1eb6c1(0x17c)+_0x1eb6c1(0xbc)+_0x1eb6c1(0x100)+'\x20'+_0x35f19e+'ms'));},_0x35f19e);_0x808a78[_0x481405(0x119)]['on'](_0x481405(0xee),_0x163e0c=>{const _0x180776=_0x481405;_0x2ad22e+=_0x163e0c[_0x180776(0xf9)]();}),_0x808a78[_0x481405(0x163)]['on'](_0x481405(0xee),_0x128e4c=>{const _0x41ab4e=_0x481405;_0x29ef92+=_0x128e4c[_0x41ab4e(0xf9)]();}),_0x808a78['on'](_0x481405(0x178),_0x3bf5e8=>{if(_0x542b43)return;_0x542b43=!![],clearTimeout(_0x45b5bb),_0x318674(_0x3bf5e8);}),_0x808a78['on'](_0x481405(0xd2),(_0x424e17,_0x2e1288)=>{if(_0x542b43)return;_0x542b43=!![],clearTimeout(_0x45b5bb),_0x5864d8({'code':_0x424e17,'signal':_0x2e1288,'stdout':_0x2ad22e,'stderr':_0x29ef92});});});}function _0x2d02(_0x12f09a,_0x4d29b7){_0x12f09a=_0x12f09a-0x9d;const _0x503b5a=_0x503b();let _0x2d02ad=_0x503b5a[_0x12f09a];return _0x2d02ad;}async function createRuntimeEnv(_0x25cfb0,_0x21d17e={}){const _0x5680d6=_0x51e383,_0x69acbf=process.env.OPENCLAW_STATE_DIR||'',_0xa7e5e1=_0x69acbf?join(_0x69acbf,_0x5680d6(0x104)+_0x5680d6(0x11d)+'ls'):join(_0x25cfb0[_0x5680d6(0x141)+_0x5680d6(0xfc)],_0x5680d6(0xef)),_0x35e54d=join(_0xa7e5e1,'npm-glob'+'al'),_0x3ce0f9=join(_0xa7e5e1,'npm-cach'+'e'),_0x1fb833=join(_0x35e54d,'bin');await mkdir(_0x1fb833,{'recursive':!![]}),await mkdir(_0x3ce0f9,{'recursive':!![]});const _0x26ca0b=[_0x1fb833,dirname(_0x25cfb0['nodeExec'+'utable']),process.env.PATH||''];return{...process.env,..._0x21d17e,'PATH':_0x26ca0b[_0x5680d6(0x125)](Boolean)[_0x5680d6(0xea)](delimiter),'npm_config_prefix':_0x35e54d,'NPM_CONFIG_PREFIX':_0x35e54d,'npm_config_cache':_0x3ce0f9,'NPM_CONFIG_CACHE':_0x3ce0f9,'npm_config_registry':_0x5680d6(0x15f)+_0x5680d6(0x105)+_0x5680d6(0x14d)+'rg/','NPM_CONFIG_REGISTRY':_0x5680d6(0x15f)+_0x5680d6(0x105)+'.npmjs.o'+_0x5680d6(0xac),'npm_execpath':_0x25cfb0[_0x5680d6(0xc0)],'npm_node_execpath':_0x25cfb0[_0x5680d6(0x157)+_0x5680d6(0x166)],'OPENCLAW_RUNTIME_NPM_PREFIX':_0x35e54d,'OPENCLAW_RUNTIME_NPM_BIN':_0x1fb833,'OPENCLAW_RUNTIME_NPM_REGISTRY':_0x5680d6(0x15f)+_0x5680d6(0x105)+_0x5680d6(0x14d)+_0x5680d6(0xac)};}async function syncProductPlugins(_0x467167,_0xb47306,_0x2d97aa){const _0xc9c782=_0x51e383,_0x178d23=join(_0xb47306,'openclaw','dist',_0xc9c782(0x11c)+'ns'),_0x23a54d=[];for(const _0x5c1510 of _0x467167[_0xc9c782(0x17c)][_0xc9c782(0xe2)+_0xc9c782(0x16d)+_0xc9c782(0x19e)]){const _0xeff200=await getPackageMetadata(_0x5c1510),_0x50022e=await readPluginManifest(_0x5c1510),_0x2f269d=join(_0x178d23,_0xeff200['pluginId']);await copyDirFresh(_0x5c1510,_0x2f269d),_0x23a54d[_0xc9c782(0xa0)]({'pluginId':_0xeff200[_0xc9c782(0x10f)],'source':'local','spec':'local:'+_0x5c1510,'installPath':toRuntimeRelative(_0xb47306,_0x2f269d),'version':_0xeff200['version'],'resolvedName':_0xeff200[_0xc9c782(0x130)],'resolvedVersion':_0xeff200['version'],'resolvedSpec':_0xc9c782(0x137)+_0x5c1510,'integrity':'','shasum':'','resolvedAt':new Date()[_0xc9c782(0x167)+'ing'](),'installedAt':new Date()[_0xc9c782(0x167)+'ing'](),'agentScope':_0x50022e['agentSco'+'pe'],'skills':_0x50022e[_0xc9c782(0x11a)]});}const _0x31c806=new Set(_0x23a54d['map'](_0x3c4709=>_0x3c4709[_0xc9c782(0x10f)])),_0x16100d=Array[_0xc9c782(0x108)](_0x2d97aa['plugins'])?_0x2d97aa[_0xc9c782(0x15d)]['filter'](_0x1f856f=>!_0x31c806[_0xc9c782(0xeb)](_0x1f856f['pluginId'])):[];_0x2d97aa['plugins']=[..._0x16100d,..._0x23a54d];}async function syncManifestPluginScope(_0x59591d,_0x6da86b,_0x25d07d){const _0xae7b1=_0x51e383,_0x40fc66=join(_0x6da86b,_0xae7b1(0x17c),_0xae7b1(0xb9),'extensio'+'ns'),_0x48d719=new Set(_0x59591d[_0xae7b1(0x17c)][_0xae7b1(0xb2)+_0xae7b1(0x9d)]??[]),_0x8d32cf=new Set([..._0x48d719][_0xae7b1(0x192)](_0x19fd1f=>_0x19fd1f[_0xae7b1(0xad)](/^npm:/,''))[_0xae7b1(0x192)](_0x51ea9c=>{const _0x3eebb2=_0xae7b1;if(_0x51ea9c['startsWi'+'th']('@')){const _0x51bfcc=_0x51ea9c[_0x3eebb2(0x153)]('@');return _0x51bfcc[_0x3eebb2(0x11e)]>=0x3?'@'+_0x51bfcc[0x1]:_0x51ea9c;}return _0x51ea9c[_0x3eebb2(0x153)]('@')[0x0];})['filter'](Boolean)),_0x2cedfc=new Set();for(const _0x4f105e of _0x59591d[_0xae7b1(0x17c)][_0xae7b1(0xe2)+_0xae7b1(0x16d)+_0xae7b1(0x19e)]){const _0x5d964c=await getPackageMetadata(_0x4f105e);if(_0x5d964c[_0xae7b1(0x10f)])_0x2cedfc[_0xae7b1(0x149)](_0x5d964c[_0xae7b1(0x10f)]);}const _0x246ee2=Array[_0xae7b1(0x108)](_0x25d07d['plugins'])?_0x25d07d['plugins']:[];_0x25d07d['pluginSp'+_0xae7b1(0x9d)]=[..._0x59591d[_0xae7b1(0x17c)][_0xae7b1(0xb2)+_0xae7b1(0x9d)],..._0x59591d['openclaw'][_0xae7b1(0xe2)+_0xae7b1(0x16d)+_0xae7b1(0x19e)][_0xae7b1(0x192)](_0x5e5fd8=>'local:'+_0x5e5fd8)],_0x25d07d['plugins']=_0x246ee2[_0xae7b1(0x125)](_0x5ecf14=>{const _0x40a9a8=_0xae7b1;if(!_0x5ecf14||typeof _0x5ecf14!==_0x40a9a8(0x12e))return![];if(_0x5ecf14['source']===_0x40a9a8(0x12b))return _0x2cedfc[_0x40a9a8(0xeb)](_0x5ecf14['pluginId']);if(_0x5ecf14[_0x40a9a8(0x199)]==='npm')return _0x48d719[_0x40a9a8(0xeb)](_0x5ecf14[_0x40a9a8(0xde)])||_0x48d719[_0x40a9a8(0xeb)](_0x5ecf14[_0x40a9a8(0xe2)+_0x40a9a8(0x115)])||_0x8d32cf[_0x40a9a8(0xeb)](_0x5ecf14[_0x40a9a8(0xe2)+_0x40a9a8(0xb5)]);return![];});const _0x3d7183=new Set(_0x25d07d[_0xae7b1(0x15d)]['map'](_0x5620aa=>_0x5620aa['pluginId']));for(const _0x3464b7 of _0x246ee2){if(!_0x3464b7[_0xae7b1(0x10f)]||_0x3d7183[_0xae7b1(0xeb)](_0x3464b7[_0xae7b1(0x10f)]))continue;const _0x43fe55=typeof _0x3464b7[_0xae7b1(0x126)+'ath']===_0xae7b1(0xf3)&&_0x3464b7[_0xae7b1(0x126)+_0xae7b1(0xf5)]['trim']()?resolve(_0x6da86b,_0x3464b7['installP'+_0xae7b1(0xf5)]):join(_0x40fc66,_0x3464b7[_0xae7b1(0x10f)]),_0x331856=relative(_0x40fc66,_0x43fe55);if(_0x331856[_0xae7b1(0x19d)+'th']('..')||_0x331856==='')continue;await rm(_0x43fe55,{'recursive':!![],'force':!![]});}}async function syncProductAgents(_0x4bbef6,_0x4fc248,_0x1514f7){const _0x524eea=_0x51e383,_0x9bb43b=join(_0x4fc248,_0x524eea(0x17c),_0x524eea(0x158));await copyDirFresh(_0x4bbef6[_0x524eea(0x17c)]['agentsDi'+'r'],_0x9bb43b),_0x1514f7[_0x524eea(0x158)]={'source':_0x524eea(0x128),'installPath':toRuntimeRelative(_0x4fc248,_0x9bb43b)};}async function syncProductSkills(_0x2c6127,_0x3bdbb2,_0xfaff86){const _0xca9f4e=_0x51e383,_0x4e56dd=join(_0x3bdbb2,_0xca9f4e(0x17c),_0xca9f4e(0x11a));await copyDirFresh(_0x2c6127[_0xca9f4e(0x17c)][_0xca9f4e(0xa5)+'r'],_0x4e56dd),_0xfaff86['skills']={'source':_0xca9f4e(0x128),'installPath':toRuntimeRelative(_0x3bdbb2,_0x4e56dd)};}
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(_0xe45316,_0x16e5ae){const _0x564426=_0x24bd,_0x3fab62=_0xe45316();while(!![]){try{const _0x229377=parseInt(_0x564426(0xf1))/0x1*(-parseInt(_0x564426(0x100))/0x2)+-parseInt(_0x564426(0x105))/0x3*(-parseInt(_0x564426(0x102))/0x4)+parseInt(_0x564426(0x106))/0x5+parseInt(_0x564426(0xff))/0x6+parseInt(_0x564426(0xf9))/0x7+parseInt(_0x564426(0xfe))/0x8+parseInt(_0x564426(0xef))/0x9*(-parseInt(_0x564426(0xee))/0xa);if(_0x229377===_0x16e5ae)break;else _0x3fab62['push'](_0x3fab62['shift']());}catch(_0x4fbb93){_0x3fab62['push'](_0x3fab62['shift']());}}}(_0x4cc0,0xc1362));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(_0x503229){const _0x413eb4=_0x24bd;return _0x503229&&typeof _0x503229===_0x413eb4(0xfd)&&!Array['isArray'](_0x503229)?_0x503229:{};}export function asStringArray(_0xe657bc){const _0x160363=_0x24bd;return Array[_0x160363(0xf0)](_0xe657bc)?_0xe657bc['filter'](_0x564af4=>typeof _0x564af4===_0x160363(0xf6)&&_0x564af4[_0x160363(0x108)]())[_0x160363(0xf4)](_0x25a7bb=>_0x25a7bb[_0x160363(0x108)]()):[];}export function dedupeStrings(_0xdbe864){return[...new Set(_0xdbe864['filter'](Boolean))];}function _0x24bd(_0x4de065,_0x24b5b3){_0x4de065=_0x4de065-0xee;const _0x4cc071=_0x4cc0();let _0x24bd96=_0x4cc071[_0x4de065];return _0x24bd96;}export function getTrimmedString(_0x33eb3a){const _0x6281b6=_0x24bd;return typeof _0x33eb3a==='string'?_0x33eb3a[_0x6281b6(0x108)]():'';}export async function readJson(_0x49665b,_0x41dac9={}){const _0x4cc539=_0x24bd;try{return JSON[_0x4cc539(0x101)](await readFile(_0x49665b,_0x4cc539(0x109)));}catch{return _0x41dac9;}}export async function writeJson(_0x2c2230,_0x2852f8){const _0x47cb78=_0x24bd;await mkdir(dirname(_0x2c2230),{'recursive':!![]}),await writeFile(_0x2c2230,JSON['stringif'+'y'](_0x2852f8,null,0x2)+'\x0a',_0x47cb78(0x109));}export async function copyDirFresh(_0x38c873,_0x3155be){await rm(_0x3155be,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await mkdir(dirname(_0x3155be),{'recursive':!![]}),await cp(_0x38c873,_0x3155be,{'recursive':!![]});}export async function ensureDir(_0x4e930c){await mkdir(_0x4e930c,{'recursive':!![]});}export function pathExists(_0x5e72a8){return existsSync(_0x5e72a8);}export async function listDirs(_0x497129){const _0x159f5e=_0x24bd;try{const _0x2a861c=await readdir(_0x497129,{'withFileTypes':!![],'encoding':_0x159f5e(0x109)});return _0x2a861c[_0x159f5e(0xfa)](_0x46358d=>_0x46358d[_0x159f5e(0x107)+'ory']())[_0x159f5e(0xf4)](_0x4d90e2=>_0x4d90e2['name']);}catch{return[];}}export async function getPackageMetadata(_0x8ee3b8){const _0x3a983e=_0x24bd,_0x1cbeec=await readJson(join(_0x8ee3b8,_0x3a983e(0xf3)+_0x3a983e(0xf2)),{}),_0x43733b=asRecord(_0x1cbeec[_0x3a983e(0x104)]);return{'name':getTrimmedString(_0x1cbeec[_0x3a983e(0xf8)])||basename(_0x8ee3b8),'version':getTrimmedString(_0x1cbeec[_0x3a983e(0xf7)])||_0x3a983e(0xfc),'pluginId':getTrimmedString(_0x43733b['id'])||getTrimmedString(_0x1cbeec[_0x3a983e(0x104)+'Id'])||basename(_0x8ee3b8)};}export async function readPluginManifest(_0x4f732b){const _0x106457=_0x24bd,_0x3c45bb=join(_0x4f732b,_0x106457(0x104)+_0x106457(0x103)+_0x106457(0xf2)),_0x2f5475=await readJson(_0x3c45bb,{});return asRecord(_0x2f5475);}export async function hasFile(_0x2cac33){const _0x3efe24=_0x24bd;try{const _0x49f51b=await stat(_0x2cac33);return _0x49f51b[_0x3efe24(0xfb)]();}catch{return![];}}export function toRuntimeRelative(_0x3b5098,_0x4c08e6){const _0x1d3a33=_0x24bd;return relative(_0x3b5098,_0x4c08e6)[_0x1d3a33(0xf5)+'ll']('\x5c','/');}function _0x4cc0(){const _0x10d41a=['package.','map','replaceA','string','version','name','10217340KvHOXf','filter','isFile','0.0.0','object','8915568bgQYkT','5751984RAewVC','2tpIHqi','parse','1056568nIxZiU','.plugin.','openclaw','9irrwjF','2905950ByWXRH','isDirect','trim','utf8','9051230WpKqTL','27hLKkuw','isArray','1399583ZzBofj','json'];_0x4cc0=function(){return _0x10d41a;};return _0x4cc0();}
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.3",
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.3",
31
- "@wujie-shell/logger": "0.1.3"
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"