@wujie-shell/core 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/bin/wujie-shell.mjs +1 -1
- package/dist/src/agents/bundled-agent-skills.mjs +1 -1
- package/dist/src/agents/bundled-agents.mjs +1 -1
- package/dist/src/chat/media-archive.mjs +1 -1
- package/dist/src/chat/queue.mjs +1 -1
- package/dist/src/common/diagnostics.mjs +1 -1
- package/dist/src/common/logging.mjs +1 -1
- package/dist/src/common/runtime-logger.mjs +1 -1
- package/dist/src/common/user-events.mjs +1 -1
- package/dist/src/common/utils.mjs +1 -1
- package/dist/src/config/controller.mjs +1 -1
- package/dist/src/connectors/config-utils.mjs +1 -1
- package/dist/src/connectors/constants.mjs +1 -1
- package/dist/src/connectors/controller.mjs +1 -1
- package/dist/src/connectors/kdocs-cli.mjs +1 -1
- package/dist/src/electron/main.mjs +1 -1
- package/dist/src/electron/preload.mjs +1 -1
- package/dist/src/files/generated-files-store.mjs +1 -1
- package/dist/src/files/handlers.mjs +1 -1
- package/dist/src/gateway/controller.mjs +1 -1
- package/dist/src/gateway/ws-client.mjs +1 -1
- package/dist/src/index.mjs +1 -1
- package/dist/src/log-reporting/handlers.mjs +1 -1
- package/dist/src/log-reporting/report-logs.mjs +1 -1
- package/dist/src/models/handlers.mjs +1 -1
- package/dist/src/preferences/store.mjs +1 -1
- package/dist/src/runtime/index.mjs +1 -1
- package/dist/src/runtime/patch-channel-plugin-runtime.mjs +1 -1
- package/dist/src/runtime/patch-chat-history-mixed-tool-content.mjs +1 -1
- package/dist/src/runtime/plugin-sync.mjs +1 -1
- package/dist/src/sessions/agent-sessions-map-store.mjs +1 -1
- package/dist/src/skills/import.mjs +1 -1
- package/dist/src/skills/market.mjs +1 -1
- package/dist/src/terminal/manager.mjs +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x4369ed=_0x3268;(function(_0x319144,_0x3062ea){const _0x22caf4=_0x3268,_0x560a80=_0x319144();while(!![]){try{const _0x31b960=parseInt(_0x22caf4(0x21e))/0x1*(parseInt(_0x22caf4(0x1ad))/0x2)+parseInt(_0x22caf4(0x1c3))/0x3+parseInt(_0x22caf4(0x1ac))/0x4+-parseInt(_0x22caf4(0x23c))/0x5+parseInt(_0x22caf4(0x1ed))/0x6*(-parseInt(_0x22caf4(0x239))/0x7)+-parseInt(_0x22caf4(0x22a))/0x8+parseInt(_0x22caf4(0x19a))/0x9;if(_0x31b960===_0x3062ea)break;else _0x560a80['push'](_0x560a80['shift']());}catch(_0x2c69f8){_0x560a80['push'](_0x560a80['shift']());}}}(_0x1993,0x87973));import{Buffer}from'node:buffer';import{createHash,createPrivateKey,createPublicKey,generateKeyPairSync,randomUUID,sign}from'node:crypto';function _0x3268(_0x2713e3,_0x2c9aa3){_0x2713e3=_0x2713e3-0x186;const _0x1993e5=_0x1993();let _0x3268c2=_0x1993e5[_0x2713e3];return _0x3268c2;}import{chmodSync,existsSync,mkdirSync,readFileSync,writeFileSync}from'node:fs';import{dirname}from'node:path';import _0x59bbc9 from'ws';const ED25519_SPKI_PREFIX=Buffer['from'](_0x4369ed(0x1f8)+_0x4369ed(0x200)+_0x4369ed(0x189),_0x4369ed(0x207)),BASE64_PADDING_REGEX=/=+$/g,UPPERCASE_ASCII_REGEX=/[A-Z]/g;function _0x1993(){const _0x19d2a1=['handleMe','413660iDFVpM','2qKNUwL','subarray','export','.admin','unavaila','timeoutM','o\x20load\x20g','sing\x20non','failed:\x20','url','resolve','expectFi','entity','.changed','der','eyPem','privateK','join','WS\x20conne','pending','rsion','connectC','3010632IMenkB','stop','tBackoff','send','resolved','WS\x20error','readySta','stringif','ured','clientId','rejectPe','delete','filter','connecte','ent','push','role','error','connectS','.read','OPEN','close','publicKe','req','get','ters','deviceId','request\x20','vent','reconnec','gateway\x20','timed\x20ou','length','dentity\x20','adyWaite','test','Event','equals','ell/','spki','timeout','ateway\x20r','6566718KpcJio','med\x20out','challeng','Path','entries','yCheck','onConnec','.write','Timer','configur','nEvent','302a3005','session.','isBuffer','charCode','WS\x20hands','now','t\x20stoppe','shouldRe','06032b65','clearTim','onSessio','connect.','replace','reject','t\x20connec','hex','ble','nding','DateTime','resolveR','WS\x20clien','WS\x20close','toString','type','string','ting','sessions','lengeTim','Code','t\x20restar','from','pem','hake\x20mis','connectN','nnected','config','deviceFa','mily','292807ZAQjbm','\x20yet','connect','ect','message','yPem','agent','istening','identity','signedAt','chat','open','7719048RTcchK','rejectRe','Format','t:\x20','trim','eout','onAgentE','readyWai','clientMo','nMessage','connect\x20','ers','skipRead','payload','token','7lPiKmm','utf8','WS\x20disco','5363555spZWDp','d\x20(','restart','platform','operator','min','status','nected','failed','clientVe','replaceA','WS\x20is\x20no','digest','Options','code=','event','sendConn','70032100','ateway\x20i','tTimer','g\x20nonce','parse','nal','ssage','update','base64','nonce','onDiscon','sconnect','set','failed\x20t','e\x20missin','once','ed25519','20588922mfdRwI','res','device\x20i','clientDe','fromChar','lReady','queueCon','hallenge','waitUnti','handleDi','clientDi','lListene','nectChal','method','ed\x20out','wujie-sh','isArray'];_0x1993=function(){return _0x19d2a1;};return _0x1993();}function isRecord(_0x575b2b){const _0x51d327=_0x4369ed;return Boolean(_0x575b2b)&&typeof _0x575b2b==='object'&&!Array[_0x51d327(0x1aa)](_0x575b2b);}function formatUnknownError(_0x51adc1){const _0x2e5e63=_0x4369ed;if(_0x51adc1 instanceof Error)return _0x51adc1[_0x2e5e63(0x222)];return String(_0x51adc1??'');}function isLocalGatewayConnRefused(_0x44207a){const _0x29c74a=_0x4369ed,_0x238b91=formatUnknownError(_0x44207a);return/\bECONNREFUSED\b/i[_0x29c74a(0x1e6)](_0x238b91)&&/127\.0\.0\.1:\d+/[_0x29c74a(0x1e6)](_0x238b91);}function base64UrlEncode(_0x4d1b3d){const _0x2369d1=_0x4369ed;return _0x4d1b3d[_0x2369d1(0x20e)](_0x2369d1(0x191))[_0x2369d1(0x246)+'ll']('+','-')[_0x2369d1(0x246)+'ll']('/','_')[_0x2369d1(0x204)](BASE64_PADDING_REGEX,'');}function derivePublicKeyRaw(_0x5560ab){const _0x55cc1e=_0x4369ed,_0x1caf12=createPublicKey(_0x5560ab)[_0x55cc1e(0x1af)]({'type':_0x55cc1e(0x1ea),'format':_0x55cc1e(0x1bb)}),_0x177193=Buffer[_0x55cc1e(0x1fa)](_0x1caf12)?_0x1caf12:Buffer['from'](_0x1caf12),_0x801c77=_0x177193[_0x55cc1e(0x1e3)]===ED25519_SPKI_PREFIX[_0x55cc1e(0x1e3)]+0x20&&_0x177193[_0x55cc1e(0x1ae)](0x0,ED25519_SPKI_PREFIX[_0x55cc1e(0x1e3)])[_0x55cc1e(0x1e8)](ED25519_SPKI_PREFIX);return _0x801c77?_0x177193[_0x55cc1e(0x1ae)](ED25519_SPKI_PREFIX[_0x55cc1e(0x1e3)]):_0x177193;}function fingerprintPublicKey(_0x576761){const _0x4b99c0=_0x4369ed;return createHash('sha256')[_0x4b99c0(0x190)](derivePublicKeyRaw(_0x576761))[_0x4b99c0(0x248)](_0x4b99c0(0x207));}function publicKeyRawBase64UrlFromPem(_0x22994f){return base64UrlEncode(derivePublicKeyRaw(_0x22994f));}function signDevicePayload(_0x21506b,_0x255e01){const _0x419b01=_0x4369ed,_0x3f741d=createPrivateKey(_0x21506b);return base64UrlEncode(sign(null,Buffer[_0x419b01(0x216)](_0x255e01,_0x419b01(0x23a)),_0x3f741d));}function normalizeDeviceMetadataForAuth(_0x264f31){const _0x1801d2=_0x4369ed,_0x252cbf=typeof _0x264f31==='string'?_0x264f31[_0x1801d2(0x22e)]():'';if(!_0x252cbf)return'';return _0x252cbf[_0x1801d2(0x204)](UPPERCASE_ASCII_REGEX,_0x5094bf=>String[_0x1801d2(0x19e)+_0x1801d2(0x214)](_0x5094bf[_0x1801d2(0x1fb)+'At'](0x0)+0x20));}function buildDeviceAuthPayloadV3(_0x1ee613){const _0x466292=_0x4369ed;return['v3',_0x1ee613[_0x466292(0x1dd)],_0x1ee613['clientId'],_0x1ee613[_0x466292(0x232)+'de'],_0x1ee613[_0x466292(0x1d3)],_0x1ee613['scopes'][_0x466292(0x1be)](','),String(_0x1ee613[_0x466292(0x227)+'Ms']),_0x1ee613[_0x466292(0x238)]??'',_0x1ee613[_0x466292(0x192)],normalizeDeviceMetadataForAuth(_0x1ee613[_0x466292(0x23f)]),normalizeDeviceMetadataForAuth(_0x1ee613[_0x466292(0x21c)+_0x466292(0x21d)])][_0x466292(0x1be)]('|');}function writeIdentityFile(_0x1a2fb3,_0x2f00a7,_0x676d02){const _0xe63b6f=_0x4369ed;mkdirSync(dirname(_0x1a2fb3),{'recursive':!![]}),writeFileSync(_0x1a2fb3,JSON[_0xe63b6f(0x1ca)+'y']({'version':0x1,..._0x2f00a7,'createdAtMs':_0x676d02},null,0x2)+'\x0a',{'mode':0x180});try{chmodSync(_0x1a2fb3,0x180);}catch{}}function generateDeviceIdentity(){const _0x3b7051=_0x4369ed,{publicKey:_0x58d3d1,privateKey:_0x4f121b}=generateKeyPairSync(_0x3b7051(0x199)),_0x58d90f=_0x58d3d1[_0x3b7051(0x1af)]({'type':'spki','format':_0x3b7051(0x217)})['toString'](),_0x5c444f=_0x4f121b[_0x3b7051(0x1af)]({'type':'pkcs8','format':_0x3b7051(0x217)})[_0x3b7051(0x20e)]();return{'deviceId':fingerprintPublicKey(_0x58d90f),'publicKeyPem':_0x58d90f,'privateKeyPem':_0x5c444f};}function loadOrCreateDeviceIdentity(_0x3005f4){const _0x55835a=_0x4369ed;if(existsSync(_0x3005f4))try{const _0x2232b0=JSON[_0x55835a(0x18d)](readFileSync(_0x3005f4,_0x55835a(0x23a))),_0x1e5ee3=typeof _0x2232b0?.[_0x55835a(0x1d9)+_0x55835a(0x223)]===_0x55835a(0x210)?_0x2232b0[_0x55835a(0x1d9)+_0x55835a(0x223)]:'',_0x19cee0=typeof _0x2232b0?.[_0x55835a(0x1bd)+_0x55835a(0x1bc)]===_0x55835a(0x210)?_0x2232b0[_0x55835a(0x1bd)+'eyPem']:'';if(_0x1e5ee3&&_0x19cee0){const _0x2bda94={'deviceId':fingerprintPublicKey(_0x1e5ee3),'publicKeyPem':_0x1e5ee3,'privateKeyPem':_0x19cee0};return _0x2232b0?.[_0x55835a(0x1dd)]!==_0x2bda94['deviceId']&&writeIdentityFile(_0x3005f4,_0x2bda94,Date[_0x55835a(0x1fd)]()),_0x2bda94;}}catch{}const _0x2c0e01=generateDeviceIdentity();return writeIdentityFile(_0x3005f4,_0x2c0e01,Date['now']()),_0x2c0e01;}export class ClawGatewayWsClient{['ws']=null;[_0x4369ed(0x21b)]=null;[_0x4369ed(0x1c0)]=new Map();['readyWai'+_0x4369ed(0x1dc)]=[];[_0x4369ed(0x1ff)+_0x4369ed(0x220)]=![];[_0x4369ed(0x1e0)+_0x4369ed(0x18b)]=null;['connectC'+_0x4369ed(0x1a1)+_0x4369ed(0x1f5)]=null;[_0x4369ed(0x219)+_0x4369ed(0x198)]=null;[_0x4369ed(0x1d5)+_0x4369ed(0x1d1)]=![];['connecte'+'d']=![];[_0x4369ed(0x1e0)+_0x4369ed(0x1c5)+'Ms']=0x320;['deviceId'+_0x4369ed(0x1b9)]=null;[_0x4369ed(0x1f6)+'e'](_0x269bc8){const _0x390113=_0x4369ed;if(!_0x269bc8){this[_0x390113(0x1c4)]();return;}const _0x8a60bb=this[_0x390113(0x21b)];this[_0x390113(0x21b)]=_0x269bc8,this[_0x390113(0x1ff)+'connect']=!![];try{this[_0x390113(0x1dd)+'entity']=loadOrCreateDeviceIdentity(_0x269bc8[_0x390113(0x226)+_0x390113(0x1f0)]);}catch(_0x19b89e){const _0x10477c=_0x19b89e instanceof Error?_0x19b89e[_0x390113(0x222)]:'初始化\x20gate'+'way\x20设备身份'+'失败';this['stop'](),_0x269bc8[_0x390113(0x193)+_0x390113(0x243)](_0x10477c);return;}const _0x48552f=!_0x8a60bb||_0x8a60bb['url']!==_0x269bc8[_0x390113(0x1b6)]||_0x8a60bb[_0x390113(0x238)]!==_0x269bc8['token']||_0x8a60bb[_0x390113(0x1cc)]!==_0x269bc8[_0x390113(0x1cc)]||_0x8a60bb['clientMo'+'de']!==_0x269bc8['clientMo'+'de']||_0x8a60bb[_0x390113(0x245)+_0x390113(0x1c1)]!==_0x269bc8[_0x390113(0x245)+_0x390113(0x1c1)]||_0x8a60bb['identity'+_0x390113(0x1f0)]!==_0x269bc8[_0x390113(0x226)+_0x390113(0x1f0)];if(_0x48552f){this[_0x390113(0x23e)]();return;}if(!this['ws'])this[_0x390113(0x220)]();}[_0x4369ed(0x1c4)](){const _0x2145c6=_0x4369ed;this[_0x2145c6(0x1ff)+_0x2145c6(0x220)]=![],this['connecte'+'d']=![],this['connectN'+'once']=null,this[_0x2145c6(0x1d5)+_0x2145c6(0x1d1)]=![],this['clearTim'+'ers'](),this['rejectPe'+_0x2145c6(0x209)](new Error('gateway\x20'+_0x2145c6(0x20c)+_0x2145c6(0x1fe)+'d')),this['rejectRe'+_0x2145c6(0x1e5)+'rs'](new Error('gateway\x20'+_0x2145c6(0x20c)+_0x2145c6(0x1fe)+'d'));if(this['ws']){try{this['ws'][_0x2145c6(0x1d8)]();}catch{}this['ws']=null;}this[_0x2145c6(0x1dd)+_0x2145c6(0x1b9)]=null,this['config']=null;}async['request'](_0x5df1de,_0x3a7355={},_0x1a0c69={}){const _0x393957=_0x4369ed;if(!_0x1a0c69[_0x393957(0x236)+_0x393957(0x1f2)])await this[_0x393957(0x1a2)+_0x393957(0x19f)]();const _0x5a0716=this['ws'];if(!_0x5a0716||_0x5a0716[_0x393957(0x1c9)+'te']!==_0x59bbc9[_0x393957(0x1d7)])throw new Error('gateway\x20'+_0x393957(0x247)+_0x393957(0x206)+'ted');const _0x2cd5a3=randomUUID(),_0x2633fa=_0x1a0c69[_0x393957(0x1b2)+'s']??0x7530;return await new Promise((_0x5afdba,_0x1c96f5)=>{const _0x4c65cb=_0x393957,_0x1be369=setTimeout(()=>{const _0x5798f2=_0x3268;this[_0x5798f2(0x1c0)][_0x5798f2(0x1ce)](_0x2cd5a3),_0x1c96f5(new Error('gateway\x20'+_0x5798f2(0x1de)+_0x5798f2(0x1e2)+_0x5798f2(0x22d)+_0x5df1de));},_0x2633fa);this[_0x4c65cb(0x1c0)][_0x4c65cb(0x195)](_0x2cd5a3,{'method':_0x5df1de,'resolve':_0x30dbb9=>{clearTimeout(_0x1be369),_0x5afdba(_0x30dbb9);},'reject':_0x293737=>{clearTimeout(_0x1be369),_0x1c96f5(_0x293737);},'expectFinal':_0x1a0c69[_0x4c65cb(0x1b8)+_0x4c65cb(0x18e)]===!![],'timeout':_0x1be369});try{_0x5a0716[_0x4c65cb(0x1c6)](JSON['stringif'+'y']({'type':_0x4c65cb(0x1da),'id':_0x2cd5a3,'method':_0x5df1de,'params':_0x3a7355}));}catch(_0x273e0b){this['pending']['delete'](_0x2cd5a3),clearTimeout(_0x1be369),_0x1c96f5(_0x273e0b instanceof Error?_0x273e0b:new Error(_0x4c65cb(0x196)+'o\x20send\x20g'+_0x4c65cb(0x1ec)+'equest'));}});}['restart'](){const _0x168306=_0x4369ed;this[_0x168306(0x1d0)+'d']=![],this[_0x168306(0x219)+_0x168306(0x198)]=null,this[_0x168306(0x1d5)+_0x168306(0x1d1)]=![],this['clearTim'+_0x168306(0x235)](),this[_0x168306(0x1cd)+'nding'](new Error(_0x168306(0x1e1)+_0x168306(0x20c)+_0x168306(0x215)+_0x168306(0x211))),this[_0x168306(0x22b)+_0x168306(0x1e5)+'rs'](new Error(_0x168306(0x1e1)+_0x168306(0x20c)+_0x168306(0x215)+_0x168306(0x211)));if(this['ws']){try{this['ws']['terminat'+'e']();}catch{}this['ws']=null;}this[_0x168306(0x220)]();}[_0x4369ed(0x220)](){const _0x44cef5=_0x4369ed;if(!this[_0x44cef5(0x21b)]||this['ws'])return;const _0x43cd46=new _0x59bbc9(this['config'][_0x44cef5(0x1b6)]);this['ws']=_0x43cd46,_0x43cd46['on'](_0x44cef5(0x229),()=>this[_0x44cef5(0x1a0)+'nectChal'+_0x44cef5(0x213)+'eout']()),_0x43cd46['on'](_0x44cef5(0x222),_0x314f7f=>this['handleMe'+_0x44cef5(0x18f)](_0x314f7f[_0x44cef5(0x20e)]())),_0x43cd46['on'](_0x44cef5(0x1d8),(_0x4589b4,_0x282e9b)=>{const _0x3a86e4=_0x44cef5;if(this['connecte'+'d']){const _0x314996=_0x282e9b[_0x3a86e4(0x20e)]()||_0x3a86e4(0x186)+_0x4589b4;this[_0x3a86e4(0x1a3)+_0x3a86e4(0x194)](_0x3a86e4(0x1e1)+_0x3a86e4(0x20d)+_0x3a86e4(0x23d)+_0x314996+')');}else this['handleDi'+_0x3a86e4(0x194)]('');}),_0x43cd46['on'](_0x44cef5(0x1d4),_0x5684f3=>{const _0x2f7a74=_0x44cef5;if(isLocalGatewayConnRefused(_0x5684f3)){this['handleDi'+_0x2f7a74(0x194)](_0x2f7a74(0x1e1)+'is\x20not\x20l'+_0x2f7a74(0x225)+_0x2f7a74(0x21f));return;}const _0x472645=formatUnknownError(_0x5684f3);this[_0x2f7a74(0x1a3)+_0x2f7a74(0x194)](_0x472645?'gateway\x20'+_0x2f7a74(0x1c8)+':\x20'+_0x472645:_0x2f7a74(0x1e1)+_0x2f7a74(0x1c8));});}[_0x4369ed(0x1a0)+_0x4369ed(0x1a6)+_0x4369ed(0x213)+_0x4369ed(0x22f)](){const _0x151735=_0x4369ed;this['connectN'+_0x151735(0x198)]=null,this['connectS'+_0x151735(0x1d1)]=![];if(this[_0x151735(0x1c2)+_0x151735(0x1a1)+_0x151735(0x1f5)])clearTimeout(this[_0x151735(0x1c2)+_0x151735(0x1a1)+'Timer']);this[_0x151735(0x1c2)+_0x151735(0x1a1)+'Timer']=setTimeout(()=>{const _0x57f5d6=_0x151735;if(this['connectS'+_0x57f5d6(0x1d1)]||!this['ws']||this['ws'][_0x57f5d6(0x1c9)+'te']!==_0x59bbc9['OPEN'])return;this[_0x57f5d6(0x1a3)+'sconnect'](_0x57f5d6(0x1e1)+_0x57f5d6(0x1fc)+'hake\x20tim'+_0x57f5d6(0x1a8)),this['ws']?.[_0x57f5d6(0x1d8)](0x3f0,_0x57f5d6(0x234)+'challeng'+'e\x20timeou'+'t');},0x7d0);}async[_0x4369ed(0x188)+_0x4369ed(0x221)](){const _0x1b5a65=_0x4369ed,_0x230eaf=this[_0x1b5a65(0x21b)];if(!_0x230eaf||this[_0x1b5a65(0x1d5)+_0x1b5a65(0x1d1)])return;const _0x426b4f=this['connectN'+_0x1b5a65(0x198)]?.['trim']()??'';if(!_0x426b4f){this[_0x1b5a65(0x1a3)+_0x1b5a65(0x194)](_0x1b5a65(0x1e1)+_0x1b5a65(0x1fc)+_0x1b5a65(0x218)+'sing\x20non'+'ce'),this['ws']?.['close'](0x3f0,_0x1b5a65(0x234)+_0x1b5a65(0x1ef)+_0x1b5a65(0x197)+_0x1b5a65(0x18c));return;}this[_0x1b5a65(0x1d5)+_0x1b5a65(0x1d1)]=!![];this['connectC'+_0x1b5a65(0x1a1)+_0x1b5a65(0x1f5)]&&(clearTimeout(this[_0x1b5a65(0x1c2)+_0x1b5a65(0x1a1)+_0x1b5a65(0x1f5)]),this[_0x1b5a65(0x1c2)+_0x1b5a65(0x1a1)+_0x1b5a65(0x1f5)]=null);if(!this[_0x1b5a65(0x1dd)+_0x1b5a65(0x1b9)])try{this['deviceId'+_0x1b5a65(0x1b9)]=loadOrCreateDeviceIdentity(_0x230eaf[_0x1b5a65(0x226)+'Path']);}catch(_0xb8c3b7){this['handleDi'+'sconnect'](_0xb8c3b7 instanceof Error?_0xb8c3b7['message']:_0x1b5a65(0x196)+_0x1b5a65(0x1b3)+_0x1b5a65(0x18a)+'dentity'),this['ws']?.['close'](0x3f0,_0x1b5a65(0x19c)+_0x1b5a65(0x1e4)+_0x1b5a65(0x1b1)+_0x1b5a65(0x208));return;}const _0x5663dd=_0x1b5a65(0x240),_0x4c0d31=[_0x1b5a65(0x240)+_0x1b5a65(0x1d6),_0x1b5a65(0x240)+_0x1b5a65(0x1f4),'operator'+_0x1b5a65(0x1b0),_0x1b5a65(0x240)+'.approva'+'ls',_0x1b5a65(0x240)+'.pairing'],_0x4f406e=_0x230eaf['token'][_0x1b5a65(0x22e)](),_0x17bea7=Date['now'](),_0x46f054=buildDeviceAuthPayloadV3({'deviceId':this[_0x1b5a65(0x1dd)+_0x1b5a65(0x1b9)][_0x1b5a65(0x1dd)],'clientId':_0x230eaf['clientId'],'clientMode':_0x230eaf[_0x1b5a65(0x232)+'de'],'role':_0x5663dd,'scopes':_0x4c0d31,'signedAtMs':_0x17bea7,'token':_0x4f406e||null,'nonce':_0x426b4f,'platform':process[_0x1b5a65(0x23f)],'deviceFamily':_0x230eaf[_0x1b5a65(0x19d)+'viceFami'+'ly']}),_0x4da3b3={'minProtocol':0x4,'maxProtocol':0x4,'client':{'id':_0x230eaf[_0x1b5a65(0x1cc)],'displayName':_0x230eaf[_0x1b5a65(0x1a4)+'splayNam'+'e'],'version':_0x230eaf['clientVe'+_0x1b5a65(0x1c1)],'platform':process[_0x1b5a65(0x23f)],'deviceFamily':_0x230eaf[_0x1b5a65(0x19d)+'viceFami'+'ly'],'mode':_0x230eaf[_0x1b5a65(0x232)+'de']},'caps':[],'role':_0x5663dd,'scopes':_0x4c0d31,'auth':_0x4f406e?{'token':_0x4f406e}:undefined,'device':{'id':this[_0x1b5a65(0x1dd)+_0x1b5a65(0x1b9)][_0x1b5a65(0x1dd)],'publicKey':publicKeyRawBase64UrlFromPem(this[_0x1b5a65(0x1dd)+'entity'][_0x1b5a65(0x1d9)+_0x1b5a65(0x223)]),'signature':signDevicePayload(this['deviceId'+'entity']['privateK'+_0x1b5a65(0x1bc)],_0x46f054),'signedAt':_0x17bea7,'nonce':_0x426b4f},'locale':Intl[_0x1b5a65(0x20a)+_0x1b5a65(0x22c)]()[_0x1b5a65(0x1c7)+_0x1b5a65(0x249)]()['locale'],'userAgent':_0x1b5a65(0x1a9)+_0x1b5a65(0x1e9)+_0x230eaf[_0x1b5a65(0x245)+_0x1b5a65(0x1c1)]};try{await this['request'](_0x1b5a65(0x220),_0x4da3b3,{'timeoutMs':0x2710,'skipReadyCheck':!![]}),this[_0x1b5a65(0x1d0)+'d']=!![],this[_0x1b5a65(0x1e0)+'tBackoff'+'Ms']=0x320,this['resolveR'+'eadyWait'+'ers'](),this[_0x1b5a65(0x21b)]?.[_0x1b5a65(0x1f3)+'ted']?.();}catch(_0x2b9555){this[_0x1b5a65(0x1a3)+'sconnect'](_0x2b9555 instanceof Error?_0x2b9555['message']:_0x1b5a65(0x1e1)+'WS\x20conne'+'ct\x20faile'+'d'),this['ws']?.[_0x1b5a65(0x1d8)](0x3f0,_0x1b5a65(0x234)+_0x1b5a65(0x244));}}[_0x4369ed(0x1ab)+_0x4369ed(0x18f)](_0x3ca399){const _0x176d20=_0x4369ed;let _0xa197be;try{_0xa197be=JSON['parse'](_0x3ca399);}catch{return;}if(!isRecord(_0xa197be)||typeof _0xa197be[_0x176d20(0x20f)]!=='string')return;if(_0xa197be[_0x176d20(0x20f)]===_0x176d20(0x187)){const _0x2aac5e=typeof _0xa197be['event']===_0x176d20(0x210)?_0xa197be['event']:'';if(!_0x2aac5e)return;const _0x5943f7=isRecord(_0xa197be['payload'])?_0xa197be['payload']:{};if(_0x2aac5e===_0x176d20(0x203)+_0x176d20(0x1ef)+'e'){const _0x3bb472=typeof _0x5943f7[_0x176d20(0x192)]===_0x176d20(0x210)?_0x5943f7['nonce'][_0x176d20(0x22e)]():'';if(!_0x3bb472){this['handleDi'+_0x176d20(0x194)](_0x176d20(0x1e1)+'WS\x20hands'+'hake\x20mis'+_0x176d20(0x1b4)+'ce'),this['ws']?.[_0x176d20(0x1d8)](0x3f0,_0x176d20(0x234)+_0x176d20(0x1ef)+'e\x20missin'+_0x176d20(0x18c));return;}this['connectN'+_0x176d20(0x198)]=_0x3bb472,void this[_0x176d20(0x188)+_0x176d20(0x221)]();return;}if(_0x2aac5e===_0x176d20(0x228))this[_0x176d20(0x21b)]?.['onChatEv'+_0x176d20(0x1d1)]?.(_0x5943f7);if(_0x2aac5e===_0x176d20(0x224))this[_0x176d20(0x21b)]?.[_0x176d20(0x230)+_0x176d20(0x1df)]?.(_0x5943f7);if(_0x2aac5e===_0x176d20(0x212)+_0x176d20(0x1ba))this[_0x176d20(0x21b)]?.['onSessio'+_0x176d20(0x1f7)]?.(_0x5943f7);if(_0x2aac5e===_0x176d20(0x1f9)+_0x176d20(0x222))this[_0x176d20(0x21b)]?.[_0x176d20(0x202)+_0x176d20(0x233)+_0x176d20(0x1e7)]?.(_0x5943f7);return;}if(_0xa197be[_0x176d20(0x20f)]!==_0x176d20(0x19b))return;const _0x11ad0f=typeof _0xa197be['id']===_0x176d20(0x210)?_0xa197be['id']:'';if(!_0x11ad0f)return;const _0xd32010=this[_0x176d20(0x1c0)][_0x176d20(0x1db)](_0x11ad0f);if(!_0xd32010)return;const _0x319d45=isRecord(_0xa197be[_0x176d20(0x237)])?_0xa197be[_0x176d20(0x237)]:{},_0x35bb28=typeof _0x319d45[_0x176d20(0x242)]===_0x176d20(0x210)?_0x319d45[_0x176d20(0x242)]:'';if(_0xd32010[_0x176d20(0x1b8)+_0x176d20(0x18e)]&&_0x35bb28==='accepted')return;this[_0x176d20(0x1c0)]['delete'](_0x11ad0f);_0xd32010['timeout']&&(clearTimeout(_0xd32010[_0x176d20(0x1eb)]),_0xd32010[_0x176d20(0x1eb)]=null);if(_0xa197be['ok']===!![]){_0xd32010[_0x176d20(0x1b7)](_0xa197be[_0x176d20(0x237)]);return;}const _0x20b338=isRecord(_0xa197be[_0x176d20(0x1d4)])?_0xa197be['error']:{},_0x403017=typeof _0x20b338[_0x176d20(0x222)]===_0x176d20(0x210)?_0x20b338[_0x176d20(0x222)]:'gateway\x20'+_0x176d20(0x1de)+_0x176d20(0x1b5)+_0xd32010[_0x176d20(0x1a7)];_0xd32010[_0x176d20(0x205)](new Error(_0x403017));}['waitUnti'+_0x4369ed(0x19f)](_0x57fbc7=0x2ee0){const _0x297f0a=_0x4369ed;if(this[_0x297f0a(0x1d0)+'d'])return Promise[_0x297f0a(0x1b7)]();if(!this['config'])return Promise[_0x297f0a(0x205)](new Error(_0x297f0a(0x1e1)+'WS\x20is\x20no'+'t\x20config'+_0x297f0a(0x1cb)));if(!this['ws'])this[_0x297f0a(0x220)]();return new Promise((_0x10d23c,_0xbc6c3a)=>{const _0x4db57b=_0x297f0a,_0x306d73=setTimeout(()=>{const _0x3de30d=_0x3268;this[_0x3de30d(0x231)+_0x3de30d(0x1dc)]=this[_0x3de30d(0x231)+_0x3de30d(0x1dc)][_0x3de30d(0x1cf)](_0x16ab4c=>_0x16ab4c[_0x3de30d(0x1b7)]!==_0x10d23c),_0xbc6c3a(new Error('gateway\x20'+_0x3de30d(0x1bf)+'ction\x20ti'+_0x3de30d(0x1ee)));},_0x57fbc7);this[_0x4db57b(0x231)+_0x4db57b(0x1dc)][_0x4db57b(0x1d2)]({'resolve':_0x10d23c,'reject':_0xbc6c3a,'timeout':_0x306d73});});}[_0x4369ed(0x20b)+'eadyWait'+_0x4369ed(0x235)](){const _0x2b0b26=_0x4369ed,_0x3278f4=[...this['readyWai'+_0x2b0b26(0x1dc)]];this['readyWai'+_0x2b0b26(0x1dc)]=[];for(const _0x4eca58 of _0x3278f4){clearTimeout(_0x4eca58['timeout']),_0x4eca58['resolve']();}}['rejectRe'+_0x4369ed(0x1e5)+'rs'](_0xeca991){const _0x3c18e4=_0x4369ed,_0x22e639=[...this[_0x3c18e4(0x231)+_0x3c18e4(0x1dc)]];this[_0x3c18e4(0x231)+_0x3c18e4(0x1dc)]=[];for(const _0x5efa8f of _0x22e639){clearTimeout(_0x5efa8f[_0x3c18e4(0x1eb)]),_0x5efa8f[_0x3c18e4(0x205)](_0xeca991);}}['rejectPe'+'nding'](_0x4daa54){const _0x5dde53=_0x4369ed;for(const [_0x284f64,_0x43178]of this[_0x5dde53(0x1c0)][_0x5dde53(0x1f1)]()){this[_0x5dde53(0x1c0)][_0x5dde53(0x1ce)](_0x284f64),_0x43178[_0x5dde53(0x1eb)]&&(clearTimeout(_0x43178[_0x5dde53(0x1eb)]),_0x43178[_0x5dde53(0x1eb)]=null),_0x43178['reject'](_0x4daa54);}}[_0x4369ed(0x1a3)+_0x4369ed(0x194)](_0x9e6dca){const _0x236b05=_0x4369ed;this['ws']&&(this['ws']['removeAl'+_0x236b05(0x1a5)+'rs'](),this['ws']=null);this[_0x236b05(0x1d0)+'d']=![],this[_0x236b05(0x219)+_0x236b05(0x198)]=null,this['connectS'+_0x236b05(0x1d1)]=![],this[_0x236b05(0x1cd)+_0x236b05(0x209)](new Error(_0x9e6dca||_0x236b05(0x1e1)+_0x236b05(0x23b)+_0x236b05(0x21a))),this[_0x236b05(0x22b)+'adyWaite'+'rs'](new Error(_0x9e6dca||_0x236b05(0x1e1)+_0x236b05(0x23b)+_0x236b05(0x21a))),this[_0x236b05(0x201)+_0x236b05(0x235)]();if(_0x9e6dca)this[_0x236b05(0x21b)]?.[_0x236b05(0x193)+'nected']?.(_0x9e6dca);if(!this[_0x236b05(0x1ff)+_0x236b05(0x220)]||!this[_0x236b05(0x21b)])return;const _0x4b5c69=this[_0x236b05(0x1e0)+_0x236b05(0x1c5)+'Ms'];this[_0x236b05(0x1e0)+_0x236b05(0x1c5)+'Ms']=Math[_0x236b05(0x241)](this['reconnec'+'tBackoff'+'Ms']*0x2,0x3a98),this[_0x236b05(0x1e0)+_0x236b05(0x18b)]=setTimeout(()=>{const _0x2ceb31=_0x236b05;this['reconnec'+_0x2ceb31(0x18b)]=null,this['connect']();},_0x4b5c69);}[_0x4369ed(0x201)+_0x4369ed(0x235)](){const _0x15f30e=_0x4369ed;this[_0x15f30e(0x1e0)+_0x15f30e(0x18b)]&&(clearTimeout(this[_0x15f30e(0x1e0)+_0x15f30e(0x18b)]),this[_0x15f30e(0x1e0)+'tTimer']=null),this[_0x15f30e(0x1c2)+_0x15f30e(0x1a1)+_0x15f30e(0x1f5)]&&(clearTimeout(this[_0x15f30e(0x1c2)+'hallenge'+_0x15f30e(0x1f5)]),this['connectC'+_0x15f30e(0x1a1)+'Timer']=null);}}
|
|
1
|
+
const _0x2d0baa=_0x4559;(function(_0x3f6100,_0x115a24){const _0x2ed6ee=_0x4559,_0x9af0af=_0x3f6100();while(!![]){try{const _0x4319d1=parseInt(_0x2ed6ee(0x153))/0x1*(parseInt(_0x2ed6ee(0x154))/0x2)+-parseInt(_0x2ed6ee(0x89))/0x3*(parseInt(_0x2ed6ee(0x92))/0x4)+parseInt(_0x2ed6ee(0x12e))/0x5*(-parseInt(_0x2ed6ee(0x86))/0x6)+-parseInt(_0x2ed6ee(0x145))/0x7*(-parseInt(_0x2ed6ee(0xa3))/0x8)+parseInt(_0x2ed6ee(0xc4))/0x9+parseInt(_0x2ed6ee(0x88))/0xa+parseInt(_0x2ed6ee(0x14e))/0xb;if(_0x4319d1===_0x115a24)break;else _0x9af0af['push'](_0x9af0af['shift']());}catch(_0x33d8e1){_0x9af0af['push'](_0x9af0af['shift']());}}}(_0x55ab,0xab813));import{Buffer}from'node:buffer';import{createHash,createPrivateKey,createPublicKey,generateKeyPairSync,randomUUID,sign}from'node:crypto';import{chmodSync,existsSync,mkdirSync,readFileSync,writeFileSync}from'node:fs';function _0x4559(_0x23dfe5,_0x3b604e){_0x23dfe5=_0x23dfe5-0x75;const _0x55ab6b=_0x55ab();let _0x455905=_0x55ab6b[_0x23dfe5];return _0x455905;}import{dirname}from'node:path';import _0xe20406 from'ws';function _0x55ab(){const _0x23ee8b=['failed:\x20','yCheck','queueCon','delete','y_schedu','63488irhVqK','fore_rea','nMessage','DateTime','nected','pt_start','clearRec','payload','config','agent','object','.admin','der','pem','eout','ateway\x20i','connect\x20','120LpOApN','t\x20config','publicKe','e\x20missin','fromChar','error','connect','WS\x20error','Event','ssage','connectA','clientVe','gateway\x20','nding','tewayRea','ay_ready','WS\x20disco','locale','resolved','spki','parse','token','istening','operator','nEvent','viceFami','device\x20i','pt_faile','export','onnectTi','lReady','code=','once','6464097ZFvMPF','WS\x20hands','.read','session.','waitUnti','lengeTim','is\x20not\x20l','resolveR','.approva','t\x20restar','vent','terminat','ws_conne','unavaila','06032b65','o\x20load\x20g','connectC','pTiming','splayNam','ct_retry','sconnect','ers','entries','status','yPem','adyWaite','role','_schedul','hex','equest','clientDe','eyPem','70032100','base64','OPEN','nal','tBackoff','trim','send','charCode','connecte','rejectRe','sendConn','clientDi','losed_be','reconnec','rejectPe','timeout','Code','stringif','subarray','ent','mer','nnected','filter','eadyWait','Options','update','nectChal','now','ws_start','failed','failed\x20t','ct_attem','request\x20','med\x20out','req','led','get','hallenge','pkcs8','onSessio','stop','string','o\x20send\x20g','restart','replace','d\x20(','connectN','reject','ting','onChatEv','WS\x20conne','replaceA','ction\x20ti','removeAl','connect.','ws_gatew','clearTim','length','tTimer','t:\x20','sessions','.write','push','WS\x20is\x20no','expectFi','handleMe','wujie-sh','_retry_n','connectS','test','clientId','socket_c','sing\x20non','accepted','35qejPQS','Path','deviceId','ters','shouldRe','challeng','dentity\x20','close','onDiscon','type','WS\x20clien','slice','pending','configur','equals','gateway_','rsion','signedAt','event','nonce','identity','\x20yet','ttempt','290283phyLjy','join','ted','notifyGa','resolve','message','set','way\x20设备身份','.changed','6843496KibgFF','t\x20stoppe','privateK','open','onStartu','7433cfjSsy','212RnKWYy','artedAt','clientMo','utf8','g\x20nonce','platform','ed25519','toString','Timer','handleDi','entity','readyWai','hake\x20mis','request','ateway\x20r','timeoutM','onConnec','from','302a3005','1086960MJRdDf','ttemptSt','1091330IyDqhq','168ArXydl','chat','ble','url'];_0x55ab=function(){return _0x23ee8b;};return _0x55ab();}const ED25519_SPKI_PREFIX=Buffer['from'](_0x2d0baa(0x85)+_0x2d0baa(0xd2)+_0x2d0baa(0xe4),_0x2d0baa(0xe0)),BASE64_PADDING_REGEX=/=+$/g,UPPERCASE_ASCII_REGEX=/[A-Z]/g,INITIAL_RECONNECT_BACKOFF_MS=0x320,MAX_RECONNECT_BACKOFF_MS=0x3a98,GATEWAY_STARTING_RETRY_DELAY_MS=0x12c;function isRecord(_0x29bf74){const _0x5c4eea=_0x2d0baa;return Boolean(_0x29bf74)&&typeof _0x29bf74===_0x5c4eea(0x9c)&&!Array['isArray'](_0x29bf74);}function formatUnknownError(_0x2748f1){const _0x40b0e1=_0x2d0baa;if(_0x2748f1 instanceof Error)return _0x2748f1[_0x40b0e1(0x14a)];return String(_0x2748f1??'');}function isLocalGatewayConnRefused(_0xa4e56){const _0x20be1e=_0x2d0baa,_0x4aaf10=formatUnknownError(_0xa4e56);return/\bECONNREFUSED\b/i['test'](_0x4aaf10)&&/127\.0\.0\.1:\d+/[_0x20be1e(0x129)](_0x4aaf10);}function isGatewayStartingRetryReason(_0x1dc2a0){const _0x2eb0b0=_0x2d0baa;return/\bgateway starting;\s*retry shortly\b/i[_0x2eb0b0(0x129)](_0x1dc2a0);}function base64UrlEncode(_0x445713){const _0x472a97=_0x2d0baa;return _0x445713[_0x472a97(0x7a)](_0x472a97(0xe5))[_0x472a97(0x117)+'ll']('+','-')[_0x472a97(0x117)+'ll']('/','_')[_0x472a97(0x110)](BASE64_PADDING_REGEX,'');}function derivePublicKeyRaw(_0x2362f2){const _0x5f0232=_0x2d0baa,_0x440054=createPublicKey(_0x2362f2)[_0x5f0232(0xbf)]({'type':_0x5f0232(0xb6),'format':_0x5f0232(0x9e)}),_0xfb1f00=Buffer['isBuffer'](_0x440054)?_0x440054:Buffer['from'](_0x440054),_0x269f2f=_0xfb1f00[_0x5f0232(0x11d)]===ED25519_SPKI_PREFIX[_0x5f0232(0x11d)]+0x20&&_0xfb1f00[_0x5f0232(0xf6)](0x0,ED25519_SPKI_PREFIX[_0x5f0232(0x11d)])[_0x5f0232(0x13c)](ED25519_SPKI_PREFIX);return _0x269f2f?_0xfb1f00[_0x5f0232(0xf6)](ED25519_SPKI_PREFIX['length']):_0xfb1f00;}function fingerprintPublicKey(_0x371328){const _0x5372bc=_0x2d0baa;return createHash('sha256')[_0x5372bc(0xfd)](derivePublicKeyRaw(_0x371328))['digest']('hex');}function publicKeyRawBase64UrlFromPem(_0x454bb3){return base64UrlEncode(derivePublicKeyRaw(_0x454bb3));}function signDevicePayload(_0x2796f2,_0x335dd8){const _0x1ad4f9=_0x2d0baa,_0x5d8107=createPrivateKey(_0x2796f2);return base64UrlEncode(sign(null,Buffer[_0x1ad4f9(0x84)](_0x335dd8,_0x1ad4f9(0x76)),_0x5d8107));}function normalizeDeviceMetadataForAuth(_0x2039fb){const _0x3f14ef=_0x2d0baa,_0x4a6a62=typeof _0x2039fb===_0x3f14ef(0x10d)?_0x2039fb['trim']():'';if(!_0x4a6a62)return'';return _0x4a6a62[_0x3f14ef(0x110)](UPPERCASE_ASCII_REGEX,_0x207c89=>String[_0x3f14ef(0xa7)+_0x3f14ef(0xf4)](_0x207c89[_0x3f14ef(0xeb)+'At'](0x0)+0x20));}function buildDeviceAuthPayloadV3(_0x2546f3){const _0x225d46=_0x2d0baa;return['v3',_0x2546f3[_0x225d46(0x130)],_0x2546f3[_0x225d46(0x12a)],_0x2546f3['clientMo'+'de'],_0x2546f3[_0x225d46(0xde)],_0x2546f3['scopes'][_0x225d46(0x146)](','),String(_0x2546f3[_0x225d46(0x13f)+'Ms']),_0x2546f3[_0x225d46(0xb8)]??'',_0x2546f3[_0x225d46(0x141)],normalizeDeviceMetadataForAuth(_0x2546f3['platform']),normalizeDeviceMetadataForAuth(_0x2546f3['deviceFa'+'mily'])]['join']('|');}function writeIdentityFile(_0x24b52a,_0x28f0ec,_0x36d543){const _0x2dcee8=_0x2d0baa;mkdirSync(dirname(_0x24b52a),{'recursive':!![]}),writeFileSync(_0x24b52a,JSON[_0x2dcee8(0xf5)+'y']({'version':0x1,..._0x28f0ec,'createdAtMs':_0x36d543},null,0x2)+'\x0a',{'mode':0x180});try{chmodSync(_0x24b52a,0x180);}catch{}}function generateDeviceIdentity(){const _0x5bc292=_0x2d0baa,{publicKey:_0x7f49d,privateKey:_0x1ec044}=generateKeyPairSync(_0x5bc292(0x79)),_0x2c1e28=_0x7f49d['export']({'type':'spki','format':_0x5bc292(0x9f)})[_0x5bc292(0x7a)](),_0x251cb3=_0x1ec044[_0x5bc292(0xbf)]({'type':_0x5bc292(0x10a),'format':'pem'})['toString']();return{'deviceId':fingerprintPublicKey(_0x2c1e28),'publicKeyPem':_0x2c1e28,'privateKeyPem':_0x251cb3};}function loadOrCreateDeviceIdentity(_0x389e2e){const _0x3e7a62=_0x2d0baa;if(existsSync(_0x389e2e))try{const _0x5bac4d=JSON[_0x3e7a62(0xb7)](readFileSync(_0x389e2e,_0x3e7a62(0x76))),_0x117e5c=typeof _0x5bac4d?.['publicKe'+_0x3e7a62(0xdc)]===_0x3e7a62(0x10d)?_0x5bac4d[_0x3e7a62(0xa5)+'yPem']:'',_0x1118c4=typeof _0x5bac4d?.['privateK'+_0x3e7a62(0xe3)]===_0x3e7a62(0x10d)?_0x5bac4d[_0x3e7a62(0x150)+_0x3e7a62(0xe3)]:'';if(_0x117e5c&&_0x1118c4){const _0x174d73={'deviceId':fingerprintPublicKey(_0x117e5c),'publicKeyPem':_0x117e5c,'privateKeyPem':_0x1118c4};return _0x5bac4d?.['deviceId']!==_0x174d73[_0x3e7a62(0x130)]&&writeIdentityFile(_0x389e2e,_0x174d73,Date[_0x3e7a62(0xff)]()),_0x174d73;}}catch{}const _0x448f5b=generateDeviceIdentity();return writeIdentityFile(_0x389e2e,_0x448f5b,Date[_0x3e7a62(0xff)]()),_0x448f5b;}export class ClawGatewayWsClient{['ws']=null;[_0x2d0baa(0x9a)]=null;[_0x2d0baa(0x13a)]=new Map();[_0x2d0baa(0x7e)+'ters']=[];[_0x2d0baa(0x132)+'connect']=![];[_0x2d0baa(0xf1)+_0x2d0baa(0x11e)]=null;[_0x2d0baa(0xd4)+_0x2d0baa(0x109)+_0x2d0baa(0x7b)]=null;[_0x2d0baa(0x112)+_0x2d0baa(0xc3)]=null;['connectS'+_0x2d0baa(0xf7)]=![];[_0x2d0baa(0xec)+'d']=![];[_0x2d0baa(0xf1)+_0x2d0baa(0xe8)+'Ms']=INITIAL_RECONNECT_BACKOFF_MS;[_0x2d0baa(0x130)+'entity']=null;['connectA'+_0x2d0baa(0x144)]=0x0;[_0x2d0baa(0xad)+_0x2d0baa(0x87)+'artedAt']=0x0;[_0x2d0baa(0x13b)+'e'](_0x59113f){const _0x5726e3=_0x2d0baa;if(!_0x59113f){this[_0x5726e3(0x10c)]();return;}const _0x58b060=this[_0x5726e3(0x9a)];this['config']=_0x59113f,this[_0x5726e3(0x132)+_0x5726e3(0xa9)]=!![];try{this[_0x5726e3(0x130)+_0x5726e3(0x7d)]=loadOrCreateDeviceIdentity(_0x59113f[_0x5726e3(0x142)+_0x5726e3(0x12f)]);}catch(_0x1f0b01){const _0x2df893=_0x1f0b01 instanceof Error?_0x1f0b01[_0x5726e3(0x14a)]:'初始化\x20gate'+_0x5726e3(0x14c)+'失败';this[_0x5726e3(0x10c)](),_0x59113f[_0x5726e3(0x136)+'nected'](_0x2df893);return;}const _0x214872=!_0x58b060||_0x58b060['url']!==_0x59113f[_0x5726e3(0x8c)]||_0x58b060[_0x5726e3(0xb8)]!==_0x59113f[_0x5726e3(0xb8)]||_0x58b060[_0x5726e3(0x12a)]!==_0x59113f[_0x5726e3(0x12a)]||_0x58b060[_0x5726e3(0x75)+'de']!==_0x59113f[_0x5726e3(0x75)+'de']||_0x58b060['clientVe'+_0x5726e3(0x13e)]!==_0x59113f[_0x5726e3(0xae)+_0x5726e3(0x13e)]||_0x58b060[_0x5726e3(0x142)+'Path']!==_0x59113f[_0x5726e3(0x142)+_0x5726e3(0x12f)];if(_0x214872){this['restart']();return;}if(!this['ws'])this['connect']();}[_0x2d0baa(0x10c)](){const _0x266982=_0x2d0baa;this[_0x266982(0x132)+_0x266982(0xa9)]=![],this[_0x266982(0xec)+'d']=![],this[_0x266982(0x112)+'once']=null,this[_0x266982(0x128)+_0x266982(0xf7)]=![],this[_0x266982(0x11c)+_0x266982(0xd9)](),this[_0x266982(0xf2)+_0x266982(0xb0)](new Error(_0x266982(0xaf)+_0x266982(0x138)+'t\x20stoppe'+'d')),this[_0x266982(0xed)+_0x266982(0xdd)+'rs'](new Error(_0x266982(0xaf)+_0x266982(0x138)+_0x266982(0x14f)+'d'));if(this['ws']){try{this['ws'][_0x266982(0x135)]();}catch{}this['ws']=null;}this[_0x266982(0x130)+_0x266982(0x7d)]=null,this[_0x266982(0x9a)]=null;}async[_0x2d0baa(0x80)](_0x373663,_0x5b96e2={},_0x5c0081={}){const _0x44a2c9=_0x2d0baa;if(!_0x5c0081['skipRead'+_0x44a2c9(0x8e)])await this[_0x44a2c9(0xc8)+_0x44a2c9(0xc1)]();const _0x3bc46c=this['ws'];if(!_0x3bc46c||_0x3bc46c['readySta'+'te']!==_0xe20406[_0x44a2c9(0xe6)])throw new Error(_0x44a2c9(0xaf)+_0x44a2c9(0x123)+'t\x20connec'+_0x44a2c9(0x147));const _0x41413a=randomUUID(),_0x5217ab=_0x5c0081[_0x44a2c9(0x82)+'s']??0x7530;return await new Promise((_0x2dc388,_0x1ea018)=>{const _0x397286=_0x44a2c9,_0x557238=setTimeout(()=>{const _0x558b0f=_0x4559;this['pending'][_0x558b0f(0x90)](_0x41413a),_0x1ea018(new Error(_0x558b0f(0xaf)+_0x558b0f(0x104)+'timed\x20ou'+_0x558b0f(0x11f)+_0x373663));},_0x5217ab);this[_0x397286(0x13a)][_0x397286(0x14b)](_0x41413a,{'method':_0x373663,'resolve':_0x388441=>{clearTimeout(_0x557238),_0x2dc388(_0x388441);},'reject':_0x209f2d=>{clearTimeout(_0x557238),_0x1ea018(_0x209f2d);},'expectFinal':_0x5c0081[_0x397286(0x124)+_0x397286(0xe7)]===!![],'timeout':_0x557238});try{_0x3bc46c[_0x397286(0xea)](JSON[_0x397286(0xf5)+'y']({'type':_0x397286(0x106),'id':_0x41413a,'method':_0x373663,'params':_0x5b96e2}));}catch(_0x2fa8af){this['pending']['delete'](_0x41413a),clearTimeout(_0x557238),_0x1ea018(_0x2fa8af instanceof Error?_0x2fa8af:new Error(_0x397286(0x102)+_0x397286(0x10e)+_0x397286(0x81)+_0x397286(0xe1)));}});}[_0x2d0baa(0x10f)](){const _0x409c84=_0x2d0baa;this['connecte'+'d']=![],this[_0x409c84(0x112)+_0x409c84(0xc3)]=null,this[_0x409c84(0x128)+'ent']=![],this[_0x409c84(0x11c)+_0x409c84(0xd9)](),this['rejectPe'+_0x409c84(0xb0)](new Error(_0x409c84(0xaf)+_0x409c84(0x138)+_0x409c84(0xcd)+_0x409c84(0x114))),this[_0x409c84(0xed)+_0x409c84(0xdd)+'rs'](new Error(_0x409c84(0xaf)+'WS\x20clien'+_0x409c84(0xcd)+_0x409c84(0x114)));if(this['ws']){try{this['ws'][_0x409c84(0xcf)+'e']();}catch{}this['ws']=null;}this[_0x409c84(0xa9)]();}[_0x2d0baa(0x148)+_0x2d0baa(0xb1)+'dy'](){const _0x1af219=_0x2d0baa;if(this[_0x1af219(0xec)+'d']||!this[_0x1af219(0x132)+_0x1af219(0xa9)]||!this[_0x1af219(0x9a)])return;if(!this[_0x1af219(0xf1)+'tTimer'])return;this[_0x1af219(0x98)+_0x1af219(0xc0)+_0x1af219(0xf8)](),this['config'][_0x1af219(0x152)+_0x1af219(0xd5)]?.(_0x1af219(0x11b)+_0x1af219(0xb2)+_0x1af219(0x127)+'ow',{'attempt':this[_0x1af219(0xad)+_0x1af219(0x144)],'reason':_0x1af219(0x13d)+'ready'}),this[_0x1af219(0xa9)]();}['connect'](){const _0x775752=_0x2d0baa;if(!this['config']||this['ws'])return;this[_0x775752(0xad)+_0x775752(0x144)]+=0x1,this[_0x775752(0xad)+_0x775752(0x87)+_0x775752(0x155)]=Date[_0x775752(0xff)](),this[_0x775752(0x9a)][_0x775752(0x152)+_0x775752(0xd5)]?.('ws_conne'+_0x775752(0x103)+_0x775752(0x97),{'attempt':this[_0x775752(0xad)+_0x775752(0x144)]});const _0x410df1=new _0xe20406(this[_0x775752(0x9a)][_0x775752(0x8c)]);this['ws']=_0x410df1,_0x410df1['on'](_0x775752(0x151),()=>this[_0x775752(0x8f)+_0x775752(0xfe)+'lengeTim'+'eout']()),_0x410df1['on']('message',_0x2a4c85=>this[_0x775752(0x125)+_0x775752(0xac)](_0x2a4c85[_0x775752(0x7a)]())),_0x410df1['on'](_0x775752(0x135),(_0x294bb9,_0x1304e9)=>{const _0x41a236=_0x775752;if(this[_0x41a236(0xec)+'d']){const _0x3021cb=_0x1304e9[_0x41a236(0x7a)]()||_0x41a236(0xc2)+_0x294bb9;this[_0x41a236(0x7c)+_0x41a236(0xd8)](_0x41a236(0xaf)+'WS\x20close'+_0x41a236(0x111)+_0x3021cb+')');}else this[_0x41a236(0x7c)+_0x41a236(0xd8)]('');}),_0x410df1['on'](_0x775752(0xa8),_0x529632=>{const _0x37a880=_0x775752;if(isLocalGatewayConnRefused(_0x529632)){this[_0x37a880(0x7c)+_0x37a880(0xd8)](_0x37a880(0xaf)+_0x37a880(0xca)+_0x37a880(0xb9)+_0x37a880(0x143));return;}const _0x1a86fd=formatUnknownError(_0x529632);this[_0x37a880(0x7c)+_0x37a880(0xd8)](_0x1a86fd?_0x37a880(0xaf)+_0x37a880(0xaa)+':\x20'+_0x1a86fd:_0x37a880(0xaf)+_0x37a880(0xaa));});}['queueCon'+_0x2d0baa(0xfe)+_0x2d0baa(0xc9)+_0x2d0baa(0xa0)](){const _0x457553=_0x2d0baa;this[_0x457553(0x112)+'once']=null,this[_0x457553(0x128)+_0x457553(0xf7)]=![];if(this[_0x457553(0xd4)+'hallenge'+_0x457553(0x7b)])clearTimeout(this[_0x457553(0xd4)+_0x457553(0x109)+_0x457553(0x7b)]);this[_0x457553(0xd4)+_0x457553(0x109)+_0x457553(0x7b)]=setTimeout(()=>{const _0x2fe237=_0x457553;if(this[_0x2fe237(0x128)+_0x2fe237(0xf7)]||!this['ws']||this['ws']['readySta'+'te']!==_0xe20406['OPEN'])return;this[_0x2fe237(0x7c)+_0x2fe237(0xd8)](_0x2fe237(0xaf)+_0x2fe237(0xc5)+'hake\x20tim'+'ed\x20out'),this['ws']?.[_0x2fe237(0x135)](0x3f0,_0x2fe237(0xa2)+'challeng'+'e\x20timeou'+'t');},0x7d0);}async[_0x2d0baa(0xee)+'ect'](){const _0x3333e0=_0x2d0baa,_0x3b413e=this['config'];if(!_0x3b413e||this[_0x3333e0(0x128)+_0x3333e0(0xf7)])return;const _0x215dc5=this[_0x3333e0(0x112)+_0x3333e0(0xc3)]?.[_0x3333e0(0xe9)]()??'';if(!_0x215dc5){this['handleDi'+_0x3333e0(0xd8)](_0x3333e0(0xaf)+'WS\x20hands'+'hake\x20mis'+_0x3333e0(0x12c)+'ce'),this['ws']?.[_0x3333e0(0x135)](0x3f0,_0x3333e0(0xa2)+_0x3333e0(0x133)+'e\x20missin'+_0x3333e0(0x77));return;}this[_0x3333e0(0x128)+'ent']=!![];this[_0x3333e0(0xd4)+_0x3333e0(0x109)+_0x3333e0(0x7b)]&&(clearTimeout(this[_0x3333e0(0xd4)+_0x3333e0(0x109)+_0x3333e0(0x7b)]),this[_0x3333e0(0xd4)+_0x3333e0(0x109)+_0x3333e0(0x7b)]=null);if(!this[_0x3333e0(0x130)+_0x3333e0(0x7d)])try{this['deviceId'+_0x3333e0(0x7d)]=loadOrCreateDeviceIdentity(_0x3b413e[_0x3333e0(0x142)+_0x3333e0(0x12f)]);}catch(_0x1b3af6){this[_0x3333e0(0x7c)+_0x3333e0(0xd8)](_0x1b3af6 instanceof Error?_0x1b3af6['message']:'failed\x20t'+_0x3333e0(0xd3)+_0x3333e0(0xa1)+'dentity'),this['ws']?.[_0x3333e0(0x135)](0x3f0,_0x3333e0(0xbd)+_0x3333e0(0x134)+_0x3333e0(0xd1)+_0x3333e0(0x8b));return;}const _0x39963f=_0x3333e0(0xba),_0x7a8f17=[_0x3333e0(0xba)+_0x3333e0(0xc6),_0x3333e0(0xba)+_0x3333e0(0x121),_0x3333e0(0xba)+_0x3333e0(0x9d),'operator'+_0x3333e0(0xcc)+'ls',_0x3333e0(0xba)+'.pairing'],_0x5be69f=_0x3b413e['token'][_0x3333e0(0xe9)](),_0x208785=Date['now'](),_0x2a38ee=buildDeviceAuthPayloadV3({'deviceId':this[_0x3333e0(0x130)+'entity'][_0x3333e0(0x130)],'clientId':_0x3b413e[_0x3333e0(0x12a)],'clientMode':_0x3b413e['clientMo'+'de'],'role':_0x39963f,'scopes':_0x7a8f17,'signedAtMs':_0x208785,'token':_0x5be69f||null,'nonce':_0x215dc5,'platform':process[_0x3333e0(0x78)],'deviceFamily':_0x3b413e['clientDe'+_0x3333e0(0xbc)+'ly']}),_0x3b3325={'minProtocol':0x4,'maxProtocol':0x4,'client':{'id':_0x3b413e[_0x3333e0(0x12a)],'displayName':_0x3b413e[_0x3333e0(0xef)+_0x3333e0(0xd6)+'e'],'version':_0x3b413e[_0x3333e0(0xae)+_0x3333e0(0x13e)],'platform':process['platform'],'deviceFamily':_0x3b413e[_0x3333e0(0xe2)+_0x3333e0(0xbc)+'ly'],'mode':_0x3b413e[_0x3333e0(0x75)+'de']},'caps':[],'role':_0x39963f,'scopes':_0x7a8f17,'auth':_0x5be69f?{'token':_0x5be69f}:undefined,'device':{'id':this[_0x3333e0(0x130)+'entity'][_0x3333e0(0x130)],'publicKey':publicKeyRawBase64UrlFromPem(this[_0x3333e0(0x130)+_0x3333e0(0x7d)][_0x3333e0(0xa5)+_0x3333e0(0xdc)]),'signature':signDevicePayload(this[_0x3333e0(0x130)+_0x3333e0(0x7d)][_0x3333e0(0x150)+_0x3333e0(0xe3)],_0x2a38ee),'signedAt':_0x208785,'nonce':_0x215dc5},'locale':Intl[_0x3333e0(0x95)+'Format']()[_0x3333e0(0xb5)+_0x3333e0(0xfc)]()[_0x3333e0(0xb4)],'userAgent':_0x3333e0(0x126)+'ell/'+_0x3b413e[_0x3333e0(0xae)+_0x3333e0(0x13e)]};try{await this[_0x3333e0(0x80)](_0x3333e0(0xa9),_0x3b3325,{'timeoutMs':0x2710,'skipReadyCheck':!![]}),this['connecte'+'d']=!![],this['reconnec'+_0x3333e0(0xe8)+'Ms']=INITIAL_RECONNECT_BACKOFF_MS,this[_0x3333e0(0x9a)]?.[_0x3333e0(0x152)+_0x3333e0(0xd5)]?.(_0x3333e0(0xd0)+'cted',{'attempt':this['connectA'+_0x3333e0(0x144)],'phaseElapsedMs':this[_0x3333e0(0xad)+_0x3333e0(0x87)+_0x3333e0(0x155)]?Date[_0x3333e0(0xff)]()-this[_0x3333e0(0xad)+_0x3333e0(0x87)+_0x3333e0(0x155)]:0x0}),this['resolveR'+_0x3333e0(0xfb)+_0x3333e0(0xd9)](),this[_0x3333e0(0x9a)]?.[_0x3333e0(0x83)+'ted']?.();}catch(_0x38b729){this[_0x3333e0(0x7c)+_0x3333e0(0xd8)](_0x38b729 instanceof Error?_0x38b729[_0x3333e0(0x14a)]:_0x3333e0(0xaf)+_0x3333e0(0x116)+'ct\x20faile'+'d'),this['ws']?.[_0x3333e0(0x135)](0x3f0,_0x3333e0(0xa2)+_0x3333e0(0x101));}}[_0x2d0baa(0x125)+_0x2d0baa(0xac)](_0x242139){const _0x49cc6a=_0x2d0baa;let _0x583678;try{_0x583678=JSON[_0x49cc6a(0xb7)](_0x242139);}catch{return;}if(!isRecord(_0x583678)||typeof _0x583678[_0x49cc6a(0x137)]!==_0x49cc6a(0x10d))return;if(_0x583678[_0x49cc6a(0x137)]===_0x49cc6a(0x140)){const _0x2e672f=typeof _0x583678[_0x49cc6a(0x140)]===_0x49cc6a(0x10d)?_0x583678[_0x49cc6a(0x140)]:'';if(!_0x2e672f)return;const _0x5b5f22=isRecord(_0x583678[_0x49cc6a(0x99)])?_0x583678['payload']:{};if(_0x2e672f===_0x49cc6a(0x11a)+_0x49cc6a(0x133)+'e'){const _0x2063cf=typeof _0x5b5f22['nonce']===_0x49cc6a(0x10d)?_0x5b5f22[_0x49cc6a(0x141)][_0x49cc6a(0xe9)]():'';if(!_0x2063cf){this[_0x49cc6a(0x7c)+_0x49cc6a(0xd8)](_0x49cc6a(0xaf)+_0x49cc6a(0xc5)+_0x49cc6a(0x7f)+_0x49cc6a(0x12c)+'ce'),this['ws']?.['close'](0x3f0,_0x49cc6a(0xa2)+'challeng'+_0x49cc6a(0xa6)+_0x49cc6a(0x77));return;}this[_0x49cc6a(0x112)+_0x49cc6a(0xc3)]=_0x2063cf,void this[_0x49cc6a(0xee)+'ect']();return;}if(_0x2e672f===_0x49cc6a(0x8a))this[_0x49cc6a(0x9a)]?.[_0x49cc6a(0x115)+_0x49cc6a(0xf7)]?.(_0x5b5f22);if(_0x2e672f===_0x49cc6a(0x9b))this['config']?.['onAgentE'+_0x49cc6a(0xce)]?.(_0x5b5f22);if(_0x2e672f===_0x49cc6a(0x120)+_0x49cc6a(0x14d))this[_0x49cc6a(0x9a)]?.[_0x49cc6a(0x10b)+_0x49cc6a(0xbb)]?.(_0x5b5f22);if(_0x2e672f===_0x49cc6a(0xc7)+_0x49cc6a(0x14a))this[_0x49cc6a(0x9a)]?.[_0x49cc6a(0x10b)+_0x49cc6a(0x94)+_0x49cc6a(0xab)]?.(_0x5b5f22);return;}if(_0x583678[_0x49cc6a(0x137)]!=='res')return;const _0x3dc8af=typeof _0x583678['id']===_0x49cc6a(0x10d)?_0x583678['id']:'';if(!_0x3dc8af)return;const _0x37eda4=this['pending'][_0x49cc6a(0x108)](_0x3dc8af);if(!_0x37eda4)return;const _0x4662fd=isRecord(_0x583678['payload'])?_0x583678[_0x49cc6a(0x99)]:{},_0x4277cd=typeof _0x4662fd['status']===_0x49cc6a(0x10d)?_0x4662fd[_0x49cc6a(0xdb)]:'';if(_0x37eda4[_0x49cc6a(0x124)+_0x49cc6a(0xe7)]&&_0x4277cd===_0x49cc6a(0x12d))return;this[_0x49cc6a(0x13a)][_0x49cc6a(0x90)](_0x3dc8af);_0x37eda4[_0x49cc6a(0xf3)]&&(clearTimeout(_0x37eda4[_0x49cc6a(0xf3)]),_0x37eda4['timeout']=null);if(_0x583678['ok']===!![]){_0x37eda4[_0x49cc6a(0x149)](_0x583678['payload']);return;}const _0x399c1c=isRecord(_0x583678[_0x49cc6a(0xa8)])?_0x583678['error']:{},_0x411d5b=typeof _0x399c1c[_0x49cc6a(0x14a)]===_0x49cc6a(0x10d)?_0x399c1c[_0x49cc6a(0x14a)]:_0x49cc6a(0xaf)+_0x49cc6a(0x104)+_0x49cc6a(0x8d)+_0x37eda4['method'];_0x37eda4[_0x49cc6a(0x113)](new Error(_0x411d5b));}['waitUnti'+_0x2d0baa(0xc1)](_0x41069b=0x2ee0){const _0x19e639=_0x2d0baa;if(this[_0x19e639(0xec)+'d'])return Promise[_0x19e639(0x149)]();if(!this[_0x19e639(0x9a)])return Promise[_0x19e639(0x113)](new Error('gateway\x20'+_0x19e639(0x123)+_0x19e639(0xa4)+'ured'));if(!this['ws'])this[_0x19e639(0xa9)]();return new Promise((_0x4f95a9,_0x2b053d)=>{const _0x3ddecf=_0x19e639,_0x4bbebd=setTimeout(()=>{const _0x30b985=_0x4559;this['readyWai'+_0x30b985(0x131)]=this[_0x30b985(0x7e)+_0x30b985(0x131)][_0x30b985(0xfa)](_0x38a6ef=>_0x38a6ef['resolve']!==_0x4f95a9),_0x2b053d(new Error(_0x30b985(0xaf)+'WS\x20conne'+_0x30b985(0x118)+_0x30b985(0x105)));},_0x41069b);this['readyWai'+_0x3ddecf(0x131)][_0x3ddecf(0x122)]({'resolve':_0x4f95a9,'reject':_0x2b053d,'timeout':_0x4bbebd});});}[_0x2d0baa(0xcb)+_0x2d0baa(0xfb)+_0x2d0baa(0xd9)](){const _0x4a922a=_0x2d0baa,_0x5db36f=[...this[_0x4a922a(0x7e)+'ters']];this['readyWai'+_0x4a922a(0x131)]=[];for(const _0x5c3261 of _0x5db36f){clearTimeout(_0x5c3261['timeout']),_0x5c3261[_0x4a922a(0x149)]();}}[_0x2d0baa(0xed)+_0x2d0baa(0xdd)+'rs'](_0x4b89b1){const _0x2fa1ac=_0x2d0baa,_0x52649d=[...this[_0x2fa1ac(0x7e)+_0x2fa1ac(0x131)]];this['readyWai'+_0x2fa1ac(0x131)]=[];for(const _0x3e46ed of _0x52649d){clearTimeout(_0x3e46ed['timeout']),_0x3e46ed[_0x2fa1ac(0x113)](_0x4b89b1);}}[_0x2d0baa(0xf2)+_0x2d0baa(0xb0)](_0x901f5f){const _0x148504=_0x2d0baa;for(const [_0x38d89d,_0x5da82a]of this[_0x148504(0x13a)][_0x148504(0xda)]()){this['pending'][_0x148504(0x90)](_0x38d89d),_0x5da82a[_0x148504(0xf3)]&&(clearTimeout(_0x5da82a['timeout']),_0x5da82a[_0x148504(0xf3)]=null),_0x5da82a[_0x148504(0x113)](_0x901f5f);}}[_0x2d0baa(0x7c)+_0x2d0baa(0xd8)](_0x5518c8){const _0x29a24b=_0x2d0baa,_0x37ec7c=this[_0x29a24b(0xec)+'d'],_0x44eb22=this[_0x29a24b(0xad)+'ttempt'],_0x21ac42=this[_0x29a24b(0xad)+_0x29a24b(0x87)+_0x29a24b(0x155)]?Date[_0x29a24b(0xff)]()-this[_0x29a24b(0xad)+'ttemptSt'+_0x29a24b(0x155)]:0x0;this['ws']&&(this['ws'][_0x29a24b(0x119)+'lListene'+'rs'](),this['ws']=null);this[_0x29a24b(0xec)+'d']=![],this[_0x29a24b(0x112)+_0x29a24b(0xc3)]=null,this[_0x29a24b(0x128)+_0x29a24b(0xf7)]=![],this[_0x29a24b(0xf2)+'nding'](new Error(_0x5518c8||'gateway\x20'+_0x29a24b(0xb3)+_0x29a24b(0xf9))),this['rejectRe'+_0x29a24b(0xdd)+'rs'](new Error(_0x5518c8||_0x29a24b(0xaf)+_0x29a24b(0xb3)+_0x29a24b(0xf9))),this['clearTim'+'ers']();!_0x37ec7c&&this[_0x29a24b(0x9a)]?.['onStartu'+'pTiming']?.(_0x29a24b(0xd0)+_0x29a24b(0x103)+_0x29a24b(0xbe)+'d',{'attempt':_0x44eb22,'phaseElapsedMs':_0x21ac42,'reason':_0x5518c8?_0x5518c8['slice'](0x0,0xa0):_0x29a24b(0x12b)+'losed_be'+_0x29a24b(0x93)+'dy'});if(_0x5518c8)this[_0x29a24b(0x9a)]?.[_0x29a24b(0x136)+_0x29a24b(0x96)]?.(_0x5518c8);if(!this['shouldRe'+_0x29a24b(0xa9)]||!this[_0x29a24b(0x9a)])return;const _0x293514=isGatewayStartingRetryReason(_0x5518c8),_0x5e3fca=_0x293514?GATEWAY_STARTING_RETRY_DELAY_MS:this[_0x29a24b(0xf1)+_0x29a24b(0xe8)+'Ms'];!_0x293514&&(this['reconnec'+_0x29a24b(0xe8)+'Ms']=Math['min'](this[_0x29a24b(0xf1)+_0x29a24b(0xe8)+'Ms']*0x2,MAX_RECONNECT_BACKOFF_MS)),this[_0x29a24b(0x9a)]['onStartu'+'pTiming']?.(_0x293514?_0x29a24b(0x100)+'ing_retr'+_0x29a24b(0x91)+_0x29a24b(0x107):_0x29a24b(0xd0)+_0x29a24b(0xd7)+_0x29a24b(0xdf)+'ed',{'attempt':_0x44eb22,'delayMs':_0x5e3fca,'nextDelayMs':this[_0x29a24b(0xf1)+_0x29a24b(0xe8)+'Ms'],'reason':_0x5518c8?_0x5518c8[_0x29a24b(0x139)](0x0,0xa0):'socket_c'+_0x29a24b(0xf0)+_0x29a24b(0x93)+'dy'}),this[_0x29a24b(0xf1)+'tTimer']=setTimeout(()=>{const _0x1b5152=_0x29a24b;this[_0x1b5152(0xf1)+_0x1b5152(0x11e)]=null,this[_0x1b5152(0xa9)]();},_0x5e3fca);}['clearRec'+_0x2d0baa(0xc0)+_0x2d0baa(0xf8)](){const _0x35d71d=_0x2d0baa;this[_0x35d71d(0xf1)+_0x35d71d(0x11e)]&&(clearTimeout(this['reconnec'+_0x35d71d(0x11e)]),this['reconnec'+_0x35d71d(0x11e)]=null);}['clearTim'+_0x2d0baa(0xd9)](){const _0x4576ef=_0x2d0baa;this['clearRec'+_0x4576ef(0xc0)+_0x4576ef(0xf8)](),this['connectC'+_0x4576ef(0x109)+_0x4576ef(0x7b)]&&(clearTimeout(this[_0x4576ef(0xd4)+_0x4576ef(0x109)+'Timer']),this[_0x4576ef(0xd4)+'hallenge'+_0x4576ef(0x7b)]=null);}}
|
package/dist/src/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x17c268,_0x507946){var _0x29f4af=_0x4709,_0x22fb2b=_0x17c268();while(!![]){try{var _0x57bec3=parseInt(_0x29f4af(0x181))/0x1*(-parseInt(_0x29f4af(0x182))/0x2)+-parseInt(_0x29f4af(0x17a))/0x3+parseInt(_0x29f4af(0x17d))/0x4*(-parseInt(_0x29f4af(0x180))/0x5)+parseInt(_0x29f4af(0x17b))/0x6+parseInt(_0x29f4af(0x17e))/0x7+parseInt(_0x29f4af(0x17f))/0x8*(-parseInt(_0x29f4af(0x183))/0x9)+parseInt(_0x29f4af(0x17c))/0xa;if(_0x57bec3===_0x507946)break;else _0x22fb2b['push'](_0x22fb2b['shift']());}catch(_0x3d4954){_0x22fb2b['push'](_0x22fb2b['shift']());}}}(_0x249b,0xeb947));function _0x4709(_0x31c891,_0x29dbbd){_0x31c891=_0x31c891-0x17a;var _0x249b61=_0x249b();var _0x470982=_0x249b61[_0x31c891];return _0x470982;}export{ensureOpenClawDoctorFixed,getRuntimeSpawnContext,loadRuntimeInfo,prepareRuntime,readRuntimeManifest,resolveManifestPath,resolveRuntimeLarkCliCommand,resolveRuntimeRoot,runClawOnce,spawnClaw}from'./runtime/index.mjs';export{createConfigController}from'./config/controller.mjs';export{createGatewayController,syncBundledAgentRuntimeConfig}from'./gateway/controller.mjs';export{discoverBundledAgentSkills,filterSkillsForAgent,syncBundledAgentSkillsToConfig}from'./agents/bundled-agent-skills.mjs';export{ensureBundledAgents,loadBundledAgents,shouldForceFullSync}from'./agents/bundled-agents.mjs';export{archiveChatAttachmentForHistory}from'./chat/media-archive.mjs';export{createGatewayChatQueue}from'./chat/queue.mjs';export{createDiagnosticsWriter,createIncidentId,diagnosticEventFromError}from'./common/diagnostics.mjs';export{createShellLogger,exportLogsArchive,hashText,shouldIncludeLogArchiveEntry,summarizeError,summarizeFilePaths,summarizePayload,summarizeText,toHomePath,truncateText}from'./common/logging.mjs';export{createRuntimeLogger,summarizeRuntimeManifest,summarizeShellConfig}from'./common/runtime-logger.mjs';export{asRecord,asStringArray,copyDirFresh,dedupeStrings,ensureDir,getPackageMetadata,getTrimmedString,hasFile,listDirs,pathExists,readJson,readPluginManifest,toRuntimeRelative,writeJson}from'./common/utils.mjs';export{applyFeishuChannelConfig,createConnectorPluginEntry,createDingtalkDocMcpServerConfig,normalizeFeishuDmPolicy,normalizeFeishuGroupPolicy,pickPluginConfigFields,readOpenClawMcpServersFromConfig,writeOpenClawMcpServersToConfig}from'./connectors/config-utils.mjs';export*from'./connectors/constants.mjs';export{createConnectorController}from'./connectors/controller.mjs';export{installKdocsCliBinary,resolveRuntimeKdocsCliCommand}from'./connectors/kdocs-cli.mjs';export{createGeneratedFilesStore}from'./files/generated-files-store.mjs';function _0x249b(){var _0x214f9a=['2ldpWoF','3220407sLpvgn','906171rwdaTA','4507452PoXdnz','26682360TatlZZ','32PBiAdD','3780756pDIlOU','8ErXNYq','1168930ihwGhB','464483GtgTMB'];_0x249b=function(){return _0x214f9a;};return _0x249b();}export{registerFileHandlers}from'./files/handlers.mjs';export{registerProductLogHandlers}from'./log-reporting/handlers.mjs';export{reportLogs,resolveWujieApiEndpoint}from'./log-reporting/report-logs.mjs';export{extractModelMessageContent,registerModelHandlers}from'./models/handlers.mjs';export{createPreferencesStore}from'./preferences/store.mjs';export{createAgentSessionsMapStore}from'./sessions/agent-sessions-map-store.mjs';export{deleteManagedSkill,importSkillZip,syncManagedSkillsToConfig,updateManagedSkillConfig}from'./skills/import.mjs';export{createMarketSkillRuntime,deleteMarketSkillRegistryEntry,importMarketSkillZip,mapMarketRegisteredSkills,readSkillMarketRegistry}from'./skills/market.mjs';export{createTerminalManager}from'./terminal/manager.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _0x4a39(_0x19a91b,_0x41109c){_0x19a91b=_0x19a91b-0x138;var _0x4ae608=_0x4ae6();var _0x4a392d=_0x4ae608[_0x19a91b];return _0x4a392d;}(function(_0x4b120f,_0x2c7c01){var _0x37a13=_0x4a39,_0x1ef81d=_0x4b120f();while(!![]){try{var _0xfd9d68=parseInt(_0x37a13(0x149))/0x1*(parseInt(_0x37a13(0x140))/0x2)+parseInt(_0x37a13(0x142))/0x3*(-parseInt(_0x37a13(0x138))/0x4)+parseInt(_0x37a13(0x14f))/0x5*(parseInt(_0x37a13(0x13b))/0x6)+-parseInt(_0x37a13(0x13e))/0x7+parseInt(_0x37a13(0x14c))/0x8*(parseInt(_0x37a13(0x14b))/0x9)+-parseInt(_0x37a13(0x141))/0xa+parseInt(_0x37a13(0x14d))/0xb;if(_0xfd9d68===_0x2c7c01)break;else _0x1ef81d['push'](_0x1ef81d['shift']());}catch(_0x432d0b){_0x1ef81d['push'](_0x1ef81d['shift']());}}}(_0x4ae6,0x2bb5a));import{reportLogs}from'./report-logs.mjs';export function registerProductLogHandlers({app:_0x207acc,configController:_0xeb20c7,diagnosticEventFromError:_0x3f60c5,diagnosticsWriter:_0x26130f,exportLogsArchive:_0x519a93,handle:_0x42c683,mainLogger:_0x36dde6,rendererLogger:_0x52361a,summarizeText:_0x3c00b4,toHomePath:_0x4ed8b8}){var _0x4c5359=_0x4a39;_0x42c683(_0x4c5359(0x13f)+_0x4c5359(0x13d),async(_0x533887,_0x16bb4e)=>{var _0x30ecb2=_0x4c5359;return _0x52361a?.[_0x30ecb2(0x143)](_0x30ecb2(0x139)+_0x30ecb2(0x13a)+'ort\x20requ'+_0x30ecb2(0x147),{'description':_0x3c00b4(String(_0x16bb4e||''),0xa0)}),!![];}),_0x42c683(_0x4c5359(0x145)+_0x4c5359(0x13c),async(_0xa3c314,_0x12ef22={})=>reportLogs({'app':_0x207acc,'configController':_0xeb20c7,'diagnosticsWriter':_0x26130f,'diagnosticEventFromError':_0x3f60c5,'exportLogsArchive':_0x519a93,'mainLogger':_0x36dde6,'summarizeText':_0x3c00b4,'toHomePath':_0x4ed8b8,'description':typeof _0x12ef22[_0x4c5359(0x144)+_0x4c5359(0x14a)]===_0x4c5359(0x148)?_0x12ef22['descript'+_0x4c5359(0x14a)]:'','gateToken':typeof _0x12ef22['gateToke'+'n']===_0x4c5359(0x148)?_0x12ef22[_0x4c5359(0x14e)+'n']:'','endpoint':typeof _0x12ef22['endpoint']===_0x4c5359(0x148)?_0x12ef22[_0x4c5359(0x146)]:''}));}function _0x4ae6(){var _0x4a7362=['615400IrBgYm','347484Plvkuq','info','descript','logs:rep','endpoint','ested','string','1viXqjT','ion','99PIijhy','17776fxKkOC','4689333WlXGwd','gateToke','1015AywWql','8NCbCyB','renderer','\x20log\x20rep','5070XkzVBi','ort','report','2005626XwOdxw','app:log:','272936fsyLBj'];_0x4ae6=function(){return _0x4a7362;};return _0x4ae6();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2d46e4,_0x46106f){const _0x30391c=_0x63cc,_0x34be52=_0x2d46e4();while(!![]){try{const _0x1fd7db=-parseInt(_0x30391c(0x202))/0x1*(-parseInt(_0x30391c(0x1e6))/0x2)+-parseInt(_0x30391c(0x1ec))/0x3*(-parseInt(_0x30391c(0x20d))/0x4)+parseInt(_0x30391c(0x20b))/0x5*(parseInt(_0x30391c(0x209))/0x6)+parseInt(_0x30391c(0x1eb))/0x7+-parseInt(_0x30391c(0x1ea))/0x8*(parseInt(_0x30391c(0x1e4))/0x9)+-parseInt(_0x30391c(0x203))/0xa+-parseInt(_0x30391c(0x1f0))/0xb;if(_0x1fd7db===_0x46106f)break;else _0x34be52['push'](_0x34be52['shift']());}catch(_0x2a1e1c){_0x34be52['push'](_0x34be52['shift']());}}}(_0x3478,0x4b760));import{basename}from'node:path';function _0x3478(){const _0x5e3114=['wujie-ag','text','logs\x20rep','path','ncident','parse','ent-logs','log_repo','append','TTP\x20','ort\x20fail','247795QHbNYR','4979980HKUgjF','logsDir','status','ort_fail','/aipc/ex','/upload','11316eUwJbd','y_name','485sDdden','POST','452228vORtsV','trim','orted','/v2/claw','timeout','file','code','success','8334bjqNhK','ion/zip','2ogFaFe','replace','applicat','temp','2936YpRrHc','1950039IPPffG','15egRzTP','info','stringif','上传日志失败(H','1404381FUJXjF','error','缺少日志上传服务','logs_rep','now','gate-tok','/wj-open'];_0x3478=function(){return _0x5e3114;};return _0x3478();}import{readFile,rm}from'node:fs/promises';export function resolveWujieApiEndpoint(){const _0xf60b6a=_0x63cc;return String(process.env.VITE_WUJIE_API_ENDPOINT||'')[_0xf60b6a(0x20e)]()['replace'](/\/+$/,'');}function _0x63cc(_0xfb8e14,_0x348183){_0xfb8e14=_0xfb8e14-0x1e4;const _0x3478bf=_0x3478();let _0x63ccb1=_0x3478bf[_0xfb8e14];return _0x63ccb1;}export async function reportLogs({app:_0x39a194,configController:_0x5c7912,diagnosticsWriter:_0x59fd40,diagnosticEventFromError:_0x1c76fc,exportLogsArchive:_0xe5ae73,mainLogger:_0x14068c,readFileFn:readFileFn=readFile,rmFn:rmFn=rm,summarizeText:_0x116fbc,toHomePath:_0x5657ac,description:description='',gateToken:gateToken='',endpoint:endpoint=''}={}){const _0x15a391=_0x63cc;let _0x645486='';const _0x6fbf6c=Date[_0x15a391(0x1f4)]();try{const _0x1d7b7d=await _0xe5ae73({'logsDir':_0x5c7912['paths'][_0x15a391(0x204)],'targetDir':_0x39a194['getPath'](_0x15a391(0x1e9)),'appVersion':_0x39a194['getVersi'+'on']()});_0x645486=_0x1d7b7d[_0x15a391(0x1fa)];const _0x200a1d=await readFileFn(_0x645486),_0x83737f=new FormData();_0x83737f[_0x15a391(0x1ff)](_0x15a391(0x212),new Blob([_0x200a1d],{'type':'applicat'+_0x15a391(0x1e5)}),basename(_0x645486)),_0x83737f[_0x15a391(0x1ff)]('director'+_0x15a391(0x20a),_0x15a391(0x1f7)+_0x15a391(0x1fd));const _0x1f12d7={};typeof gateToken==='string'&&gateToken[_0x15a391(0x20e)]()&&(_0x1f12d7[_0x15a391(0x1f5)+'en']=gateToken[_0x15a391(0x20e)]());const _0x14b003=String(endpoint||resolveWujieApiEndpoint())[_0x15a391(0x20e)]()[_0x15a391(0x1e7)](/\/+$/,'');if(!_0x14b003)throw new Error(_0x15a391(0x1f2)+'地址');const _0x4c090e=await fetch(_0x14b003+(_0x15a391(0x1f6)+'/v2/gene'+'ral/file'+_0x15a391(0x208)),{'method':_0x15a391(0x20c),'headers':_0x1f12d7,'body':_0x83737f,'signal':AbortSignal[_0x15a391(0x211)](0x3a98)}),_0x38f72c=await _0x4c090e[_0x15a391(0x1f8)]();let _0x575a97={};try{_0x575a97=JSON[_0x15a391(0x1fc)](_0x38f72c);}catch{throw new Error(_0x15a391(0x1ef)+_0x15a391(0x200)+_0x4c090e['status']+')');}const _0x597fcf=_0x575a97?.[_0x15a391(0x214)]===!![]||String(_0x575a97?.[_0x15a391(0x213)])==='200',_0x534b62=_0x575a97?.['data'];if(!_0x597fcf||!_0x534b62)throw new Error(_0x15a391(0x1ef)+'TTP\x20'+_0x4c090e[_0x15a391(0x205)]+')');const _0x5537d3=await fetch(_0x14b003+(_0x15a391(0x1f6)+_0x15a391(0x210)+_0x15a391(0x207)+'ceptions'),{'method':_0x15a391(0x20c),'headers':{'Content-Type':_0x15a391(0x1e8)+'ion/json',..._0x1f12d7},'body':JSON[_0x15a391(0x1ee)+'y']({'packageUrl':_0x534b62,'description':description}),'signal':AbortSignal[_0x15a391(0x211)](0x3a98)});return _0x14068c?.[_0x15a391(0x1ed)](_0x15a391(0x1f9)+_0x15a391(0x20f),{'durationMs':Date[_0x15a391(0x1f4)]()-_0x6fbf6c,'uploadStatus':_0x4c090e[_0x15a391(0x205)],'reportStatus':_0x5537d3[_0x15a391(0x205)]}),!![];}catch(_0x53aa3e){_0x14068c?.[_0x15a391(0x1f1)](_0x15a391(0x1f9)+_0x15a391(0x201)+'ed',{'durationMs':Date[_0x15a391(0x1f4)]()-_0x6fbf6c,'error':_0x53aa3e}),await _0x59fd40?.['captureI'+_0x15a391(0x1fb)](_0x1c76fc(_0x53aa3e,{'category':_0x15a391(0x1fe)+'rt','event':_0x15a391(0x1f3)+_0x15a391(0x206)+'ed','message':'日志上传上报失败','durationMs':Date[_0x15a391(0x1f4)]()-_0x6fbf6c,'meta':{'description':_0x116fbc(description,0xa0),'archivePath':_0x645486?_0x5657ac(_0x645486):''}}));throw _0x53aa3e;}finally{if(_0x645486)await rmFn(_0x645486,{'force':!![]})['catch'](()=>{});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function _0x332b(_0x57d725,_0x31755b){_0x57d725=_0x57d725-0x15f;const _0xb7fd3e=_0xb7fd();let _0x332b2d=_0xb7fd3e[_0x57d725];return _0x332b2d;}(function(_0x402589,_0x150b74){const _0x48860c=_0x332b,_0x40e70c=_0x402589();while(!![]){try{const _0x2657cb=parseInt(_0x48860c(0x16f))/0x1*(-parseInt(_0x48860c(0x175))/0x2)+-parseInt(_0x48860c(0x179))/0x3+parseInt(_0x48860c(0x183))/0x4+parseInt(_0x48860c(0x16e))/0x5*(parseInt(_0x48860c(0x15f))/0x6)+-parseInt(_0x48860c(0x168))/0x7*(-parseInt(_0x48860c(0x186))/0x8)+parseInt(_0x48860c(0x165))/0x9+parseInt(_0x48860c(0x177))/0xa;if(_0x2657cb===_0x150b74)break;else _0x40e70c['push'](_0x40e70c['shift']());}catch(_0x157a66){_0x40e70c['push'](_0x40e70c['shift']());}}}(_0xb7fd,0x1f31f));export function extractModelMessageContent(_0x577e1c){const _0x9d5415=_0x332b;if(typeof _0x577e1c==='string')return _0x577e1c;if(!Array['isArray'](_0x577e1c))return'';return _0x577e1c[_0x9d5415(0x16c)](_0x43f2ad=>{const _0x555f2a=_0x9d5415;if(typeof _0x43f2ad===_0x555f2a(0x164))return _0x43f2ad;if(!_0x43f2ad||typeof _0x43f2ad!==_0x555f2a(0x185))return'';const _0x517905=typeof _0x43f2ad['type']===_0x555f2a(0x164)?_0x43f2ad[_0x555f2a(0x166)][_0x555f2a(0x17e)+_0x555f2a(0x172)]():'';if(_0x517905&&_0x517905!==_0x555f2a(0x162)&&_0x517905!==_0x555f2a(0x184)+_0x555f2a(0x16a)&&_0x517905!==_0x555f2a(0x180))return'';for(const _0x8263cd of[_0x555f2a(0x162),'message','content',_0x555f2a(0x17f)+'xt',_0x555f2a(0x184)+_0x555f2a(0x16a)]){if(typeof _0x43f2ad[_0x8263cd]===_0x555f2a(0x164))return _0x43f2ad[_0x8263cd];}return'';})[_0x9d5415(0x171)]('');}function normalizeCustomModelPayload(_0x39522a={}){const _0x571740=_0x332b,_0x283849=String(_0x39522a['id']||'')[_0x571740(0x174)]();return{..._0x39522a,'id':_0x283849,'modelName':String(_0x39522a['modelNam'+'e']||'')[_0x571740(0x174)](),'provider':String(_0x39522a['provider']||'custom'),'apiKey':String(_0x39522a['apiKey']||''),'protocol':_0x39522a[_0x571740(0x181)]===_0x571740(0x17a)+'c'?_0x571740(0x17a)+'c':_0x571740(0x17b),'baseUrl':String(_0x39522a[_0x571740(0x187)]||''),..._0x39522a[_0x571740(0x17d)+_0x571740(0x170)]?{'providerName':String(_0x39522a[_0x571740(0x17d)+_0x571740(0x170)])}:{},..._0x39522a[_0x571740(0x167)+_0x571740(0x17c)+'me']?{'customProviderName':String(_0x39522a['customPr'+'oviderNa'+'me'])}:{}};}function _0xb7fd(){const _0x1bba7e=['220401ZvnHFI','type','customPr','567DIKZJo','el\x20handl','ext','models:c','map','ered:\x20','78485kZgeEY','6pyUumb','Name','join','ase','function','trim','17396bPZfsz','omModel','1059640GDgtQO','core\x20mod','760431oVKQkF','anthropi','openai','oviderNa','provider','toLowerC','outputTe','message','protocol','ustom-mo','896508UddDEh','output_t','object','4688eKmCiK','baseUrl','deleteCu','saveCust','12FJAQqt','stomMode','er\x20is\x20no','text','ete','string'];_0xb7fd=function(){return _0x1bba7e;};return _0xb7fd();}export function registerModelHandlers({handle:_0x396553,modelHandlers:modelHandlers={}}){const _0xf3d3c0=_0x332b,_0x2a8996=_0x48bbd4=>{const _0x1fe248=_0x332b,_0x5e760d=modelHandlers[_0x48bbd4];if(typeof _0x5e760d!==_0x1fe248(0x173))throw new Error(_0x1fe248(0x178)+_0x1fe248(0x169)+_0x1fe248(0x161)+'t\x20regist'+_0x1fe248(0x16d)+_0x48bbd4);return _0x5e760d;};_0x396553(_0xf3d3c0(0x16b)+_0xf3d3c0(0x182)+'dels:sav'+'e',async(_0x393c11,_0x1b9df6={})=>_0x2a8996(_0xf3d3c0(0x189)+_0xf3d3c0(0x176))(normalizeCustomModelPayload(_0x1b9df6))),_0x396553('models:c'+_0xf3d3c0(0x182)+'dels:del'+_0xf3d3c0(0x163),async(_0x218cb0,_0x2cca69={})=>_0x2a8996(_0xf3d3c0(0x188)+_0xf3d3c0(0x160)+'l')(_0x2cca69));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function _0x4af0(_0x1cda15,_0x2f56aa){_0x1cda15=_0x1cda15-0xa8;const _0x5467d6=_0x5467();let _0x4af09f=_0x5467d6[_0x1cda15];return _0x4af09f;}const _0x2ef926=_0x4af0;(function(_0x499ea3,_0x45e8db){const _0x4b0491=_0x4af0,_0x5cc2ca=_0x499ea3();while(!![]){try{const _0x3d361f=-parseInt(_0x4b0491(0xb7))/0x1*(parseInt(_0x4b0491(0xab))/0x2)+parseInt(_0x4b0491(0xb1))/0x3*(parseInt(_0x4b0491(0xaa))/0x4)+parseInt(_0x4b0491(0xb2))/0x5*(-parseInt(_0x4b0491(0xb5))/0x6)+parseInt(_0x4b0491(0xb8))/0x7*(-parseInt(_0x4b0491(0xa9))/0x8)+parseInt(_0x4b0491(0xb0))/0x9+-parseInt(_0x4b0491(0xa8))/0xa*(parseInt(_0x4b0491(0xae))/0xb)+parseInt(_0x4b0491(0xb4))/0xc;if(_0x3d361f===_0x45e8db)break;else _0x5cc2ca['push'](_0x5cc2ca['shift']());}catch(_0x2da0b5){_0x5cc2ca['push'](_0x5cc2ca['shift']());}}}(_0x5467,0xdb9fb));import{join}from'node:path';import{readJson,writeJson}from'../common/utils.mjs';const STORE_FILE=_0x2ef926(0xb6)+_0x2ef926(0xad);export function createPreferencesStore({stateDir:_0x3a35ae,storeFile:storeFile=STORE_FILE}={}){async function _0x2a14ee(){return readJson(join(_0x3a35ae,storeFile),{});}async function _0x2a3f80(_0x45906e,_0x3d7f0a=null){const _0x2dff1f=_0x4af0,_0x47d884=await _0x2a14ee();return Object[_0x2dff1f(0xaf)+'e'][_0x2dff1f(0xb3)+_0x2dff1f(0xac)]['call'](_0x47d884,_0x45906e)?_0x47d884[_0x45906e]:_0x3d7f0a;}async function _0x1484dd(_0x446a0a,_0x1eca09){const _0x284fc3=await _0x2a14ee();return _0x284fc3[_0x446a0a]=_0x1eca09,await writeJson(join(_0x3a35ae,storeFile),_0x284fc3),{'ok':!![],'value':_0x1eca09};}return{'read':_0x2a14ee,'get':_0x2a3f80,'set':_0x1484dd};}function _0x5467(){const _0x1b0c84=['345596CAKaaw','14wPYLbF','377770cYHohx','3184872EuOgKJ','4137852rRHypa','2xqUUiZ','operty','ces.json','44VEulBm','prototyp','13661217lXouOp','3vFvErT','937585eUHkeW','hasOwnPr','11432928KuBuFL','42pEVWaw','preferen'];_0x5467=function(){return _0x1b0c84;};return _0x5467();}
|