@whalent/agent 0.3.45 → 0.3.46
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/dist/core.cjs +7 -7
- package/dist/index.cjs +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
'use strict';const a0_0x1dc5f2=a0_0x4960;(function(_0x2e2345,_0x4c8e51){const _0x8ed925=a0_0x4960,_0x23e952=_0x2e2345();while(!![]){try{const _0x3e65e3=parseInt(_0x8ed925(0x1cd))/0x1+parseInt(_0x8ed925(0x18a))/0x2*(parseInt(_0x8ed925(0x1aa))/0x3)+parseInt(_0x8ed925(0x1ae))/0x4+-parseInt(_0x8ed925(0x180))/0x5*(-parseInt(_0x8ed925(0x1e4))/0x6)+parseInt(_0x8ed925(0x1e5))/0x7+parseInt(_0x8ed925(0x186))/0x8*(parseInt(_0x8ed925(0x1ee))/0x9)+-parseInt(_0x8ed925(0x1cf))/0xa*(parseInt(_0x8ed925(0x1fc))/0xb);if(_0x3e65e3===_0x4c8e51)break;else _0x23e952['push'](_0x23e952['shift']());}catch(_0x1ef2b0){_0x23e952['push'](_0x23e952['shift']());}}}(a0_0x1544,0x997e7));var __create=Object['create'],__defProp=Object['defineProperty'],__getOwnPropDesc=Object['getOwnPropertyDescri'+a0_0x1dc5f2(0x1f4)],__getOwnPropNames=Object[a0_0x1dc5f2(0x183)],__getProtoOf=Object['getPrototypeOf'],__hasOwnProp=Object['prototype'][a0_0x1dc5f2(0x1dc)],__copyProps=(_0x4673f1,_0x1ef57a,_0x2ce9f2,_0x53c5f8)=>{const _0x43a249=a0_0x1dc5f2;if(_0x1ef57a&&typeof _0x1ef57a===_0x43a249(0x1d6)||typeof _0x1ef57a===_0x43a249(0x1e8)){for(let _0x5cd5a2 of __getOwnPropNames(_0x1ef57a))if(!__hasOwnProp['call'](_0x4673f1,_0x5cd5a2)&&_0x5cd5a2!==_0x2ce9f2)__defProp(_0x4673f1,_0x5cd5a2,{'get':()=>_0x1ef57a[_0x5cd5a2],'enumerable':!(_0x53c5f8=__getOwnPropDesc(_0x1ef57a,_0x5cd5a2))||_0x53c5f8[_0x43a249(0x1a2)]});}return _0x4673f1;},__toESM=(_0x7e5b1a,_0x14deb4,_0x163624)=>(_0x163624=_0x7e5b1a!=null?__create(__getProtoOf(_0x7e5b1a)):{},__copyProps(_0x14deb4||!_0x7e5b1a||!_0x7e5b1a[a0_0x1dc5f2(0x188)]?__defProp(_0x163624,a0_0x1dc5f2(0x1c9),{'value':_0x7e5b1a,'enumerable':!![]}):_0x163624,_0x7e5b1a)),import_child_process=require('child_process'),fs=__toESM(require('fs'),0x1),import_module=require('module'),os=__toESM(require('os'),0x1),path=__toESM(require('path'),0x1),WRAPPER_PKG_NAME=a0_0x1dc5f2(0x1d1),CORE_PKG_NAME='@whalent/agent-core',NPM_REGISTRY='https://registry.npm'+a0_0x1dc5f2(0x194),SUPERVISED_RESTART_CODE=0x4b,NPM_VIEW_TIMEOUT_MS=0x3a98,HEALTH_TIMEOUT_MS=0xafc8,RESTART_DELAY_MS=0x3e8,NPM_INSTALL_TIMEOUT_MS=0xa*0x3c*0x3e8,NPM_INSTALL_MAX_BUFFER=0x20*0x400*0x400,WRAPPER_VERSION=readWrapperVersion(),CHECKED_PTY_HELPERS=new Set();function wrapperBaseDir(){return __dirname;}function configDir(){const _0x56a8d1=a0_0x1dc5f2;return path[_0x56a8d1(0x1f3)](os[_0x56a8d1(0x1c8)](),'.whalent-agent');}function upgradeStatePath(){const _0x346e58=a0_0x1dc5f2;return path[_0x346e58(0x1f3)](configDir(),'core-upgrade.json');}function readWrapperVersion(){const _0x1bfb63=a0_0x1dc5f2;try{const _0x4845c1=JSON['parse'](fs[_0x1bfb63(0x190)](path[_0x1bfb63(0x1f3)](wrapperBaseDir(),'..',_0x1bfb63(0x17e)),'utf-8'));return String(_0x4845c1[_0x1bfb63(0x1b0)]||_0x1bfb63(0x1e7));}catch{return'0.0.0';}}function readUpgradeState(){const _0x30b8a1=a0_0x1dc5f2;try{return JSON['parse'](fs['readFileSync'](upgradeStatePath(),_0x30b8a1(0x1c4)));}catch{return null;}}function a0_0x4960(_0x3b3f0f,_0x28d4d8){_0x3b3f0f=_0x3b3f0f-0x179;const _0x154463=a0_0x1544();let _0x4960b8=_0x154463[_0x3b3f0f];if(a0_0x4960['IAdBgi']===undefined){var _0x213c65=function(_0x5f0608){const _0x5dc98d='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4673f1='',_0x1ef57a='';for(let _0x2ce9f2=0x0,_0x53c5f8,_0x5cd5a2,_0x7e5b1a=0x0;_0x5cd5a2=_0x5f0608['charAt'](_0x7e5b1a++);~_0x5cd5a2&&(_0x53c5f8=_0x2ce9f2%0x4?_0x53c5f8*0x40+_0x5cd5a2:_0x5cd5a2,_0x2ce9f2++%0x4)?_0x4673f1+=String['fromCharCode'](0xff&_0x53c5f8>>(-0x2*_0x2ce9f2&0x6)):0x0){_0x5cd5a2=_0x5dc98d['indexOf'](_0x5cd5a2);}for(let _0x14deb4=0x0,_0x163624=_0x4673f1['length'];_0x14deb4<_0x163624;_0x14deb4++){_0x1ef57a+='%'+('00'+_0x4673f1['charCodeAt'](_0x14deb4)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1ef57a);};a0_0x4960['QjmMUG']=_0x213c65,a0_0x4960['inniEv']={},a0_0x4960['IAdBgi']=!![];}const _0x1a97df=_0x154463[0x0],_0x27e93c=_0x3b3f0f+_0x1a97df,_0x306e6b=a0_0x4960['inniEv'][_0x27e93c];return!_0x306e6b?(_0x4960b8=a0_0x4960['QjmMUG'](_0x4960b8),a0_0x4960['inniEv'][_0x27e93c]=_0x4960b8):_0x4960b8=_0x306e6b,_0x4960b8;}function writeUpgradeState(_0x179a04){const _0x107b40=a0_0x1dc5f2;try{fs['mkdirSync'](configDir(),{'recursive':!![]}),fs[_0x107b40(0x1e2)](upgradeStatePath(),JSON['stringify']({..._0x179a04,'updated_at':Date['now']()},null,0x2),_0x107b40(0x1c4));}catch{}}function run(_0x5e4171,_0x43f6b8,_0x3d4568=process.env){const _0xe51b29=a0_0x1dc5f2;return(0x0,import_child_process[_0xe51b29(0x19f)])(_0x5e4171,_0x43f6b8,{'encoding':_0xe51b29(0x18d),'timeout':NPM_INSTALL_TIMEOUT_MS,'maxBuffer':NPM_INSTALL_MAX_BUFFER,'env':_0x3d4568,'shell':![]});}function runNpmView(_0x21236c){const _0x90d4d6=a0_0x1dc5f2,_0x462926=resolveExecutable(_0x90d4d6(0x1ed));if(!_0x462926)return{'status':0x7f,'stdout':'','stderr':_0x90d4d6(0x1a4),'error':new Error(_0x90d4d6(0x1a4))};return(0x0,import_child_process['spawnSync'])(_0x462926,_0x21236c,{'encoding':_0x90d4d6(0x18d),'timeout':NPM_VIEW_TIMEOUT_MS,'maxBuffer':0x400*0x400,'env':process.env,'shell':![]});}function npmRootGlobal(){const _0x1c8c3f=resolveExecutable('npm');if(!_0x1c8c3f)return'';const _0x2b8aaf=run(_0x1c8c3f,['root','-g']);if(_0x2b8aaf['status']!==0x0)return'';return String(_0x2b8aaf['stdout']||'')['trim']();}function compareSemver(_0xb03d50,_0x15f1f7){const _0xeac80c=a0_0x1dc5f2,_0x5bae69=String(_0xb03d50||'')['replace'](/^v/,'')['split'](/[.-]/)[_0xeac80c(0x1c7)](_0x3cf647=>Number['parseInt'](_0x3cf647,0xa)||0x0),_0x5140c4=String(_0x15f1f7||'')['replace'](/^v/,'')['split'](/[.-]/)[_0xeac80c(0x1c7)](_0x450e29=>Number['parseInt'](_0x450e29,0xa)||0x0);for(let _0x475cd4=0x0;_0x475cd4<Math['max'](_0x5bae69[_0xeac80c(0x1d8)],_0x5140c4['length'],0x3);_0x475cd4++){const _0x57a28e=_0x5bae69[_0x475cd4]||0x0,_0x38a9ce=_0x5140c4[_0x475cd4]||0x0;if(_0x57a28e>_0x38a9ce)return 0x1;if(_0x57a28e<_0x38a9ce)return-0x1;}return 0x0;}function resolveExecutable(_0x27284e){const _0x302f07=a0_0x1dc5f2,_0x1a151d=process['platform']==='win32'?'where.exe':'which';try{const _0x49cbe1=(0x0,import_child_process[_0x302f07(0x19f)])(_0x1a151d,[_0x27284e],{'encoding':_0x302f07(0x18d),'timeout':0xbb8,'shell':![]});if(_0x49cbe1[_0x302f07(0x1a6)]!==0x0)return'';return String(_0x49cbe1[_0x302f07(0x1d7)]||'')[_0x302f07(0x1f6)](/\r?\n/)['map'](_0x2b7ddf=>_0x2b7ddf[_0x302f07(0x1c5)]())['filter'](Boolean)[0x0]||'';}catch{return'';}}function skipWrapperUpdateCheck(){const _0x33e56d=a0_0x1dc5f2,_0x530ac6=String(process.env.WHALENT_SKIP_UPDATE_CHECK||process.env.WHALENT_NO_UPDATE_CHECK||process.env.WHALENT_SKIP_WRAPPER_UPDATE||'')[_0x33e56d(0x1c5)]()[_0x33e56d(0x1a7)]();return _0x530ac6==='1'||_0x530ac6===_0x33e56d(0x1eb)||_0x530ac6==='yes'||_0x530ac6==='on';}function latestWrapperVersion(){const _0x501af0=a0_0x1dc5f2,_0x50307b=runNpmView(['view',WRAPPER_PKG_NAME+_0x501af0(0x1b2),'version','--registry='+NPM_REGISTRY]);if(_0x50307b['status']!==0x0)return'';return String(_0x50307b[_0x501af0(0x1d7)]||'')[_0x501af0(0x1c5)]()[_0x501af0(0x1f6)](/\r?\n/)[_0x501af0(0x17a)](Boolean)['pop']()||'';}function installWrapperVersion(_0x394396){const _0x4e061e=a0_0x1dc5f2,_0x44e87e=resolveExecutable(_0x4e061e(0x1ed));if(!_0x44e87e)return{'ok':![],'output':_0x4e061e(0x1a8)+'H'};const _0x3a0c09=run(_0x44e87e,[_0x4e061e(0x19c),'-g',WRAPPER_PKG_NAME+'@'+_0x394396,_0x4e061e(0x1c0)+NPM_REGISTRY]),_0x287434=((_0x3a0c09['stdout']||'')+'\x0a'+(_0x3a0c09[_0x4e061e(0x19b)]||''))[_0x4e061e(0x1c5)]();return{'ok':_0x3a0c09[_0x4e061e(0x1a6)]===0x0,'output':_0x287434};}function maybeUpdateWrapper(_0x613801){const _0x1e589f=a0_0x1dc5f2;if(skipWrapperUpdateCheck())return![];if(process.env.WHALENT_WRAPPER_UPDATE_ATTEMPTED)return![];const _0x449e42=latestWrapperVersion();if(!_0x449e42||compareSemver(_0x449e42,WRAPPER_VERSION)<=0x0)return![];console[_0x1e589f(0x1bb)](_0x1e589f(0x1db)+'ilable:\x20'+WRAPPER_VERSION+'\x20->\x20'+_0x449e42),console[_0x1e589f(0x1bb)](_0x1e589f(0x1f8)+'\x20'+WRAPPER_PKG_NAME+'@'+_0x449e42+(_0x1e589f(0x1c6)+_0x1e589f(0x1b5)));const _0x884d5d=installWrapperVersion(_0x449e42);if(!_0x884d5d['ok']){console['warn'](_0x1e589f(0x191)+'date\x20failed;\x20continu'+_0x1e589f(0x1d3)+WRAPPER_VERSION);if(_0x884d5d['output'])console['warn'](_0x884d5d[_0x1e589f(0x1f1)][_0x1e589f(0x1f6)](/\r?\n/)['slice'](-0xc)[_0x1e589f(0x1f3)]('\x0a'));return console[_0x1e589f(0x1bb)](_0x1e589f(0x1ef)+_0x1e589f(0x1ca)+WRAPPER_PKG_NAME+'@'+_0x449e42+_0x1e589f(0x1e6)+NPM_REGISTRY),![];}console[_0x1e589f(0x1bb)](_0x1e589f(0x191)+_0x1e589f(0x1b7)+_0x449e42+';\x20restarting\x20wrapper');const _0x1097db=process['argv'][0x1],_0x167a1f=(0x0,import_child_process['spawnSync'])(process[_0x1e589f(0x17f)],[_0x1097db,..._0x613801],{'stdio':_0x1e589f(0x1d5),'env':{...process.env,'WHALENT_WRAPPER_UPDATE_ATTEMPTED':_0x449e42},'shell':![]});process['exit'](_0x167a1f['status']??0x0);}function findCoreScript(){const _0x585776=a0_0x1dc5f2,_0x4f5cf2=String(process.env.WHALENT_CORE_ENTRY||'')['trim']();if(_0x4f5cf2&&fs['existsSync'](_0x4f5cf2))return _0x4f5cf2;const _0x3b5925=npmRootGlobal();if(_0x3b5925){const _0x152cee=path[_0x585776(0x1f3)](_0x3b5925,'@whalent',_0x585776(0x19e),_0x585776(0x1b4),'index.cjs');if(fs['existsSync'](_0x152cee))return _0x152cee;}const _0x3ab45a=path[_0x585776(0x1f3)](wrapperBaseDir(),_0x585776(0x181));if(fs[_0x585776(0x182)](_0x3ab45a))return _0x3ab45a;const _0x57ba2b=path['join'](wrapperBaseDir(),'..','packages','core','dist','index.cjs');if(fs['existsSync'](_0x57ba2b))return _0x57ba2b;throw new Error(_0x585776(0x1da)+_0x585776(0x1be)+'@whalent/agent-core\x20'+'or\x20rebuild\x20@whalent/'+_0x585776(0x19d));}function coreVersion(_0x1ef328=findCoreScript()){const _0x892f28=a0_0x1dc5f2,_0x56e90f=(0x0,import_child_process[_0x892f28(0x19f)])(process['execPath'],[_0x1ef328,_0x892f28(0x1bc)],{'encoding':_0x892f28(0x18d),'timeout':0x3a98,'env':{...process.env,'WHALENT_SKIP_UPDATE_CHECK':'1'},'shell':![]}),_0x3c4b55=(_0x56e90f[_0x892f28(0x1d7)]||'')+'\x0a'+(_0x56e90f[_0x892f28(0x19b)]||'');return _0x3c4b55[_0x892f28(0x1af)](/(\d+\.\d+\.\d+(?:[-\w.]+)?)/)?.[0x1]||'';}function isExecutable(_0x427982){const _0x3e4993=a0_0x1dc5f2;try{return fs[_0x3e4993(0x1f5)](_0x427982,fs[_0x3e4993(0x1a0)]['X_OK']),!![];}catch{return![];}}function shellQuote(_0x164f7f){const _0x5f45f6=a0_0x1dc5f2;return'\x27'+_0x164f7f['replace'](/'/g,_0x5f45f6(0x1c2))+'\x27';}function a0_0x1544(){const _0x3cae65=['y29Yzsa','Aw5NihDPDgGG','icbJAg1VzcaREcaIjeHftfbfuIi','Aw5OzxjPDa','B2jQzwn0','C3rKB3v0','BgvUz3rO','B3jLoIa','D2HHBgvUDcbJB3jLihj1BNrPBwu','w3DYyxbWzxjDihvWzgf0zsbHDMe','AgfZt3DUuhjVCgvYDhK','BM90igLUC3rHBgXLza','CMvZB2X2zq','w3DYyxbWzxjDignVCMuGzxHPDgu','ls1Hz2vUDc1Pza','y2HTB2rtEw5J','D3jPDgvgAwXLu3LUyW','uYbUB2rLlxb0EsbZCgf3BI1OzwW','nZC2mdCWtufRyMfe','mZeZmdaYouPTt2z0zW','ic0TCMvNAxn0CNK9','mc4WlJa','zNvUy3rPB24','icbiruXqrvi9','lxb0EsbZCgf3BI1OzwXWzxiGBM8','Dhj1zq','zgLYBMfTzq','BNbT','mtGWota5yuL3tgPu','w3DYyxbWzxjDie1HBNvHBcb1Cgq','Dg9tDhjPBMC','B3v0Chv0','ywrK','AM9PBG','ChrVCG','ywnJzxnZu3LUyW','C3bSAxq','CM9SBgjHy2TFzMfPBgvK','w3DYyxbWzxjDigLUC3rHBgXPBMC','BwnW','D2HHBgvUDc1Hz2vUDca','zguGAgvHBhrOEtOG','ndrwEgnSDhy','ywnR','zMLSDgvY','zxHPDa','ChjLyNvPBgrZ','A2LSBa','CgfJA2fNzs5QC29U','zxHLy1bHDgG','mtbQyK9htee','y29Yzs5JANm','zxHPC3rZu3LUyW','z2v0t3DUuhjVCgvYDhLoyw1LCW','DgfYz2v0x3zLCNnPB24','C2XPy2u','mZC2vw1Rr0rk','w2DHDgv3yxLDienVBM5Ly3rLza','x19LC01VzhvSzq','CgLWzq','ntK0ohnsseHkuW','D3jHChbLCIa','w3DYyxbWzxjDignVCMuGDxbNCMe','DxrMoa','zxjYB3i','ihnPz25HBd0','CMvHzezPBgvtEw5J','w3DYyxbWzxjDihDYyxbWzxiGDxa','ywnOAw5L','EsbPBIb0Aw1LoYbYB2XSAw5Nigi','ANmUB3jN','C3rHDfn5BMm','ChjLDMLVDxmGy29Yzsb2zxjZAw8','CM9SBgjHy2TFDw5HDMfPBgfIBgu','r2f0zxDHEtOGy29UBMvJDgvK','AwqGBM90igjLy29TzsbOzwfSDgG','DcbMB3vUzdOG','C3rKzxjY','Aw5ZDgfSBa','ywDLBNq','ywDLBNqTy29Yzq','C3bHD25tEw5J','y29UC3rHBNrZ','zgfYD2LUlq','zw51BwvYywjSzq','BMnLihrVigzPEcb0zxjTAw5HBc8','BNbTig5VDcbMB3vUza','ls1OzwXW','C3rHDhvZ','Dg9mB3DLCKnHC2u','BNbTig5VDcbMB3vUzcbVBIbqqvq','Bg9N','mZi3twjZEwTh','ufrzihn0yxj0Dxa6','CJOG','w3DYyxbWzxjDig5LDYbJB3jLigq','mte0mtuYog9JvK1hCG','Bwf0y2G','DMvYC2LVBG','zgf0yq','qgXHDgvZDa','Aw5JBhvKzxm','zgLZDa','CNrPBMCGy29Yzs4UlG','w3DYyxbWzxjDihn0yxj0Aw5Nigm','zgf0zwqGDg8G','ChjLDMLVDxnFy29Yzv92zxjZAw8','u0Lhsu5u','yxjNDG','D2fYBG','ls12zxjZAw9U','oYbYzxn0yxj0Aw5NigLUia','ig5VDcbMB3vUzdSGAw5ZDgfSBca','w3DYyxbWzxjDifj1BIb0AgLZig8','ls1YzwDPC3rYEt0','AgvHBhrOEq','j1WNjW','r2f0zxDHEsbYzwDPC3rLCMvKig0','DxrMltG','DhjPBq','igzYB20GBNbTigjLzM9YzsbZDge','BwfW','Ag9TzwrPCG','zgvMyxvSDa','yxrLoIbUCg0GAw5ZDgfSBcaTzYa','u0Lhvevstq','y29Kzq','odaYmde1Be9XzuPP','y2f0y2G','nJa4mZu5meDnthnNwa','C3bHD24','qhDOywXLBNqVywDLBNq'];a0_0x1544=function(){return _0x3cae65;};return a0_0x1544();}function coreNodePtySpawnHelperPath(_0x14aa1a){const _0x5101ba=a0_0x1dc5f2;if(process['platform']!=='darwin')return'';try{const _0x430f7a=(0x0,import_module['createRequire'])(_0x14aa1a),_0x2e0530=_0x430f7a[_0x5101ba(0x1de)]('node-pty'),_0x13c3a9=path['resolve'](path[_0x5101ba(0x1ec)](_0x2e0530),'..');return path['join'](_0x13c3a9,_0x5101ba(0x17c),_0x5101ba(0x1a1)+process['arch'],'spawn-helper');}catch{return'';}}function checkMacNodePtySpawnHelper(_0x9fb111){const _0x16bb70=a0_0x1dc5f2,_0x280d82=coreNodePtySpawnHelperPath(_0x9fb111);if(!_0x280d82||CHECKED_PTY_HELPERS['has'](_0x280d82))return;CHECKED_PTY_HELPERS[_0x16bb70(0x1f2)](_0x280d82);if(!fs[_0x16bb70(0x182)](_0x280d82)){console['warn']('[wrapper]\x20macOS\x20node'+_0x16bb70(0x1ea)+_0x16bb70(0x19a)+_0x280d82);return;}if(isExecutable(_0x280d82))return;try{const _0x48add5=fs[_0x16bb70(0x195)](_0x280d82)['mode'];fs[_0x16bb70(0x1e1)](_0x280d82,_0x48add5|0x1ed);}catch{}if(isExecutable(_0x280d82)){console['warn']('[wrapper]\x20fixed\x20macO'+_0x16bb70(0x1e3)+'per\x20executable\x20bit:\x20'+_0x280d82);return;}console[_0x16bb70(0x1bb)]('[wrapper]\x20macOS\x20node'+'-pty\x20spawn-helper\x20is'+'\x20not\x20executable:\x20'+_0x280d82),console[_0x16bb70(0x1bb)](_0x16bb70(0x1bf)+_0x16bb70(0x1a3)+_0x16bb70(0x1ab)),console[_0x16bb70(0x1bb)](_0x16bb70(0x1e9)+shellQuote(_0x280d82)),console['warn']('\x20\x20ls\x20-l\x20\x22$HELPER\x22'),console['warn'](_0x16bb70(0x1d4));}function printVersion(){const _0x5239b0=a0_0x1dc5f2;let _0x4a8e78='';try{_0x4a8e78=coreVersion();}catch{}console['log'](_0x5239b0(0x1fa)+WRAPPER_VERSION),console['log'](_0x5239b0(0x18b)+WRAPPER_VERSION),console[_0x5239b0(0x1a9)]('core\x20'+(_0x4a8e78||_0x5239b0(0x1dd)));}function directCore(_0x1c6e3c){const _0x3ef98c=a0_0x1dc5f2,_0x101e9e=findCoreScript();checkMacNodePtySpawnHelper(_0x101e9e);const _0x18746a=(0x0,import_child_process[_0x3ef98c(0x19f)])(process[_0x3ef98c(0x17f)],[_0x101e9e,..._0x1c6e3c],{'stdio':_0x3ef98c(0x1d5),'env':{...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_CORE_ENTRY':_0x101e9e},'shell':![]});process[_0x3ef98c(0x17b)](_0x18746a[_0x3ef98c(0x1a6)]??0x0);}function shouldSupervise(_0x35bc50){const _0x5bbcb9=a0_0x1dc5f2;if(_0x35bc50['includes'](_0x5bbcb9(0x1e0)))return![];const _0x15b639=_0x35bc50[0x0]||'';if(_0x15b639==='ls'||_0x15b639===_0x5bbcb9(0x1a6)||_0x15b639==='ps')return![];if(_0x15b639===_0x5bbcb9(0x1f9)||_0x15b639==='daemon-mcp')return![];if(_0x35bc50[_0x5bbcb9(0x1b3)](_0x5bbcb9(0x1a5))||_0x35bc50[_0x5bbcb9(0x1b3)]('-h'))return![];return!![];}function installCoreVersion(_0x4f0d13){const _0x5bf8d6=a0_0x1dc5f2,_0x1819db=resolveExecutable('npm');if(!_0x1819db)return{'ok':![],'output':_0x5bf8d6(0x1a8)+'H'};const _0x1e0e59=CORE_PKG_NAME+'@'+_0x4f0d13,_0x32245d=run(_0x1819db,['install','-g',_0x1e0e59,'--registry='+NPM_REGISTRY]),_0x15fe01=((_0x32245d[_0x5bf8d6(0x1d7)]||'')+'\x0a'+(_0x32245d['stderr']||''))['trim']();return{'ok':_0x32245d[_0x5bf8d6(0x1a6)]===0x0,'output':_0x15fe01};}async function superviseCore(_0x27bcc0){const _0x1edee5=a0_0x1dc5f2;let _0x30ebf2=![],_0x408b7b=null;const _0x3c9c31=()=>{const _0x22cb68=a0_0x4960;_0x30ebf2=!![];if(_0x408b7b&&!_0x408b7b['killed'])try{_0x408b7b[_0x22cb68(0x17d)]('SIGTERM');}catch{}else process['exit'](0x0);};process['on'](_0x1edee5(0x1b9),_0x3c9c31),process['on'](_0x1edee5(0x1cb),_0x3c9c31);while(!![]){const _0x38a945=findCoreScript();checkMacNodePtySpawnHelper(_0x38a945);const _0x8f6e8e={...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_WRAPPER_MANAGED':'1','WHALENT_CORE_ENTRY':_0x38a945},_0x330aed=readUpgradeState(),_0x450a7f=!!_0x330aed?.['pending'];let _0xc81dd9=![],_0x160f97=null;console['log'](_0x1edee5(0x1b6)+_0x1edee5(0x1d9)+_0x38a945),_0x408b7b=(0x0,import_child_process[_0x1edee5(0x1d0)])(process[_0x1edee5(0x17f)],[_0x38a945,..._0x27bcc0],{'env':_0x8f6e8e,'stdio':['inherit',_0x1edee5(0x189),_0x1edee5(0x189)]});const _0x4b4a55=()=>{const _0x5b61d7=_0x1edee5;if(_0xc81dd9)return;_0xc81dd9=!![];if(_0x160f97)clearTimeout(_0x160f97);const _0x4e04dc=readUpgradeState();_0x4e04dc?.['pending']&&(writeUpgradeState({..._0x4e04dc,'pending':![],'rollback':![],'health_status':_0x5b61d7(0x1c1)}),console['log'](_0x5b61d7(0x18c)+_0x5b61d7(0x1fb)+(_0x4e04dc['installed_version']||_0x4e04dc[_0x5b61d7(0x184)]||'')));},_0x18266f=(_0x15b379,_0x360c91=![])=>{const _0x533608=_0x1edee5,_0x37045f=_0x15b379[_0x533608(0x1f0)]();(_0x360c91?process[_0x533608(0x19b)]:process[_0x533608(0x1d7)])['write'](_0x37045f),(_0x37045f['includes'](_0x533608(0x187))||_0x37045f[_0x533608(0x1b3)](_0x533608(0x1c3)+_0x533608(0x192))||_0x37045f['includes'](_0x533608(0x198)))&&_0x4b4a55();};_0x408b7b[_0x1edee5(0x1d7)]?.['on']('data',_0x556704=>_0x18266f(_0x556704,![])),_0x408b7b['stderr']?.['on'](_0x1edee5(0x1b1),_0x55bf4f=>_0x18266f(_0x55bf4f,!![]));_0x450a7f&&(_0x160f97=setTimeout(()=>{const _0x2dd41a=_0x1edee5;if(_0xc81dd9||!_0x408b7b||_0x408b7b['killed'])return;console[_0x2dd41a(0x18e)](_0x2dd41a(0x1ad)+_0x2dd41a(0x199)+_0x2dd41a(0x193)+_0x2dd41a(0x179));try{_0x408b7b['kill']('SIGTERM');}catch{}},HEALTH_TIMEOUT_MS));const _0x20d465=await new Promise(_0x47fffb=>{const _0x23825d=_0x1edee5;_0x408b7b['once'](_0x23825d(0x17b),(_0x2b4af3,_0x18ce8d)=>_0x47fffb({'code':_0x2b4af3,'signal':_0x18ce8d}));});if(_0x160f97)clearTimeout(_0x160f97);_0x408b7b=null;if(_0x30ebf2)process[_0x1edee5(0x17b)](_0x20d465[_0x1edee5(0x1cc)]??0x0);const _0x145f3f=readUpgradeState();if(_0x145f3f?.['pending']&&!_0xc81dd9){const _0x3f8490=String(_0x145f3f[_0x1edee5(0x1b8)+'n']||'')[_0x1edee5(0x1c5)]();if(_0x3f8490){console[_0x1edee5(0x18e)]('[wrapper]\x20rolling\x20ba'+'ck\x20core\x20to\x20'+_0x3f8490);const _0x31f142=installCoreVersion(_0x3f8490);writeUpgradeState({..._0x145f3f,'pending':![],'rollback':!![],'health_status':_0x31f142['ok']?'rolled_back':_0x1edee5(0x1f7),'error':_0x31f142['ok']?'':_0x31f142['output']});}else writeUpgradeState({..._0x145f3f,'pending':![],'rollback':!![],'health_status':_0x1edee5(0x197),'error':_0x1edee5(0x196)+'n\x20unknown'});}const _0x516f6a=_0x20d465[_0x1edee5(0x1cc)]===SUPERVISED_RESTART_CODE||_0x145f3f?.['pending'];if(!_0x516f6a&&_0x20d465[_0x1edee5(0x1cc)]===0x0)process['exit'](0x0);console['log'](_0x1edee5(0x1df)+'d\x20code='+(_0x20d465['code']??'')+(_0x20d465['signal']?_0x1edee5(0x18f)+_0x20d465['signal']:'')+_0x1edee5(0x1bd)+RESTART_DELAY_MS+'ms'),await new Promise(_0xe4fe7d=>setTimeout(_0xe4fe7d,RESTART_DELAY_MS));}}async function main(){const _0x365304=a0_0x1dc5f2,_0x5b384f=process[_0x365304(0x1ba)][_0x365304(0x185)](0x2);if(_0x5b384f[0x0]===_0x365304(0x1bc)||_0x5b384f[0x0]==='-v'||_0x5b384f[0x0]===_0x365304(0x1b0)){printVersion();return;}if((_0x5b384f[0x0]==='status'||_0x5b384f[0x0]==='ls'||_0x5b384f[0x0]==='ps')&&!_0x5b384f[_0x365304(0x1b3)]('--json')){console[_0x365304(0x1a9)](_0x365304(0x18b)+WRAPPER_VERSION);try{console['log'](_0x365304(0x1d2)+(coreVersion()||_0x365304(0x1dd)));}catch{console['log']('core\x20not\x20installed');}}maybeUpdateWrapper(_0x5b384f);if(!shouldSupervise(_0x5b384f))directCore(_0x5b384f);await superviseCore(_0x5b384f);}main()[a0_0x1dc5f2(0x1ce)](_0x1c2206=>{const _0x176f26=a0_0x1dc5f2;console['error']('[wrapper]\x20Fatal\x20erro'+_0x176f26(0x1ac)+(_0x1c2206?.['message']||String(_0x1c2206))),process['exit'](0x1);});
|
|
2
|
+
'use strict';const a0_0x454959=a0_0x4500;(function(_0x2816f1,_0x23176d){const _0x21d996=a0_0x4500,_0x4b9aef=_0x2816f1();while(!![]){try{const _0x2d6a9e=parseInt(_0x21d996(0x23a))/0x1*(parseInt(_0x21d996(0x22b))/0x2)+-parseInt(_0x21d996(0x217))/0x3+-parseInt(_0x21d996(0x1c1))/0x4*(-parseInt(_0x21d996(0x1f3))/0x5)+-parseInt(_0x21d996(0x1ea))/0x6+parseInt(_0x21d996(0x22d))/0x7+-parseInt(_0x21d996(0x204))/0x8+-parseInt(_0x21d996(0x1dc))/0x9*(-parseInt(_0x21d996(0x1da))/0xa);if(_0x2d6a9e===_0x23176d)break;else _0x4b9aef['push'](_0x4b9aef['shift']());}catch(_0x5c0178){_0x4b9aef['push'](_0x4b9aef['shift']());}}}(a0_0x1950,0x5a426));var __create=Object['create'],__defProp=Object['defineProperty'],__getOwnPropDesc=Object['getOwnPropertyDescri'+a0_0x454959(0x21c)],__getOwnPropNames=Object[a0_0x454959(0x1d2)],__getProtoOf=Object[a0_0x454959(0x231)],__hasOwnProp=Object['prototype'][a0_0x454959(0x1d3)],__copyProps=(_0x3df28c,_0x357a64,_0x27ce09,_0x56fcf2)=>{const _0x458af2=a0_0x454959;if(_0x357a64&&typeof _0x357a64==='object'||typeof _0x357a64===_0x458af2(0x201)){for(let _0x22df06 of __getOwnPropNames(_0x357a64))if(!__hasOwnProp['call'](_0x3df28c,_0x22df06)&&_0x22df06!==_0x27ce09)__defProp(_0x3df28c,_0x22df06,{'get':()=>_0x357a64[_0x22df06],'enumerable':!(_0x56fcf2=__getOwnPropDesc(_0x357a64,_0x22df06))||_0x56fcf2['enumerable']});}return _0x3df28c;},__toESM=(_0x4a0f88,_0x3dbc42,_0x19c068)=>(_0x19c068=_0x4a0f88!=null?__create(__getProtoOf(_0x4a0f88)):{},__copyProps(_0x3dbc42||!_0x4a0f88||!_0x4a0f88[a0_0x454959(0x238)]?__defProp(_0x19c068,'default',{'value':_0x4a0f88,'enumerable':!![]}):_0x19c068,_0x4a0f88)),import_child_process=require('child_process'),fs=__toESM(require('fs'),0x1),import_module=require('module'),os=__toESM(require('os'),0x1),path=__toESM(require(a0_0x454959(0x1e6)),0x1),WRAPPER_PKG_NAME='@whalent/agent',CORE_PKG_NAME='@whalent/agent-core',NPM_REGISTRY=a0_0x454959(0x218)+'js.org',SUPERVISED_RESTART_CODE=0x4b,NPM_VIEW_TIMEOUT_MS=0x3a98,HEALTH_TIMEOUT_MS=0xafc8,RESTART_DELAY_MS=0x3e8,NPM_INSTALL_TIMEOUT_MS=0xa*0x3c*0x3e8,NPM_INSTALL_MAX_BUFFER=0x20*0x400*0x400,WRAPPER_VERSION=readWrapperVersion(),CHECKED_PTY_HELPERS=new Set();function wrapperBaseDir(){return __dirname;}function configDir(){const _0x3d09c4=a0_0x454959;return path['join'](os[_0x3d09c4(0x226)](),'.whalent-agent');}function upgradeStatePath(){const _0x5a67f9=a0_0x454959;return path[_0x5a67f9(0x213)](configDir(),'core-upgrade.json');}function readWrapperVersion(){const _0x1fd583=a0_0x454959;try{const _0x5e3797=JSON[_0x1fd583(0x200)](fs['readFileSync'](path['join'](wrapperBaseDir(),'..',_0x1fd583(0x216)),'utf-8'));return String(_0x5e3797[_0x1fd583(0x1f9)]||'0.0.0');}catch{return _0x1fd583(0x1e2);}}function readUpgradeState(){const _0x5338c5=a0_0x454959;try{return JSON[_0x5338c5(0x200)](fs[_0x5338c5(0x210)](upgradeStatePath(),'utf-8'));}catch{return null;}}function writeUpgradeState(_0x293c9a){const _0xa651d8=a0_0x454959;try{fs[_0xa651d8(0x21b)](configDir(),{'recursive':!![]}),fs['writeFileSync'](upgradeStatePath(),JSON['stringify']({..._0x293c9a,'updated_at':Date['now']()},null,0x2),_0xa651d8(0x1c6));}catch{}}function run(_0x582114,_0x17e4ae,_0x33a354=process.env){const _0x2e0634=a0_0x454959;return(0x0,import_child_process['spawnSync'])(_0x582114,_0x17e4ae,{'encoding':_0x2e0634(0x205),'timeout':NPM_INSTALL_TIMEOUT_MS,'maxBuffer':NPM_INSTALL_MAX_BUFFER,'env':_0x33a354,'shell':![]});}function runNpmView(_0x1f191c){const _0xf3a7f6=a0_0x454959,_0x174a5d=resolveExecutable(_0xf3a7f6(0x1ed));if(!_0x174a5d)return{'status':0x7f,'stdout':'','stderr':'npm\x20not\x20found','error':new Error(_0xf3a7f6(0x1fe))};return(0x0,import_child_process[_0xf3a7f6(0x23b)])(_0x174a5d,_0x1f191c,{'encoding':'utf8','timeout':NPM_VIEW_TIMEOUT_MS,'maxBuffer':0x400*0x400,'env':process.env,'shell':![]});}function npmRootGlobal(){const _0x5d9a8d=a0_0x454959,_0x5b0a13=resolveExecutable('npm');if(!_0x5b0a13)return'';const _0x3aa430=run(_0x5b0a13,['root','-g']);if(_0x3aa430['status']!==0x0)return'';return String(_0x3aa430[_0x5d9a8d(0x203)]||'')['trim']();}function compareSemver(_0x3cf3ab,_0x1e0c08){const _0x5d1683=a0_0x454959,_0x74391f=String(_0x3cf3ab||'')['replace'](/^v/,'')['split'](/[.-]/)['map'](_0x236136=>Number['parseInt'](_0x236136,0xa)||0x0),_0x57ca30=String(_0x1e0c08||'')[_0x5d1683(0x1c2)](/^v/,'')['split'](/[.-]/)['map'](_0x87aea0=>Number['parseInt'](_0x87aea0,0xa)||0x0);for(let _0x41595a=0x0;_0x41595a<Math[_0x5d1683(0x1d4)](_0x74391f[_0x5d1683(0x1c5)],_0x57ca30['length'],0x3);_0x41595a++){const _0x4b349a=_0x74391f[_0x41595a]||0x0,_0x55f89e=_0x57ca30[_0x41595a]||0x0;if(_0x4b349a>_0x55f89e)return 0x1;if(_0x4b349a<_0x55f89e)return-0x1;}return 0x0;}function resolveExecutable(_0x7fa1bc){const _0x60f166=a0_0x454959,_0x21bd70=process[_0x60f166(0x1d1)]==='win32'?'where.exe':_0x60f166(0x215);try{const _0x5bc85a=(0x0,import_child_process[_0x60f166(0x23b)])(_0x21bd70,[_0x7fa1bc],{'encoding':_0x60f166(0x205),'timeout':0xbb8,'shell':![]});if(_0x5bc85a[_0x60f166(0x236)]!==0x0)return'';return String(_0x5bc85a[_0x60f166(0x203)]||'')['split'](/\r?\n/)['map'](_0x4b0ab0=>_0x4b0ab0[_0x60f166(0x212)]())['filter'](Boolean)[0x0]||'';}catch{return'';}}function skipWrapperUpdateCheck(){const _0x444648=a0_0x454959,_0x8f5676=String(process.env.WHALENT_SKIP_UPDATE_CHECK||process.env.WHALENT_NO_UPDATE_CHECK||process.env.WHALENT_SKIP_WRAPPER_UPDATE||'')['trim']()[_0x444648(0x1db)]();return _0x8f5676==='1'||_0x8f5676==='true'||_0x8f5676===_0x444648(0x21d)||_0x8f5676==='on';}function latestWrapperVersion(){const _0x409510=a0_0x454959,_0xf7c70a=runNpmView(['view',WRAPPER_PKG_NAME+_0x409510(0x22f),'version','--registry='+NPM_REGISTRY]);if(_0xf7c70a['status']!==0x0)return'';return String(_0xf7c70a['stdout']||'')[_0x409510(0x212)]()[_0x409510(0x224)](/\r?\n/)[_0x409510(0x1ec)](Boolean)['pop']()||'';}function installWrapperVersion(_0x56e864){const _0x546cb2=a0_0x454959,_0x130189=resolveExecutable('npm');if(!_0x130189)return{'ok':![],'output':'npm\x20not\x20found\x20on\x20PAT'+'H'};const _0x3e2725=run(_0x130189,[_0x546cb2(0x1d0),'-g',WRAPPER_PKG_NAME+'@'+_0x56e864,'--registry='+NPM_REGISTRY]),_0x4ea3bb=((_0x3e2725['stdout']||'')+'\x0a'+(_0x3e2725['stderr']||''))[_0x546cb2(0x212)]();return{'ok':_0x3e2725['status']===0x0,'output':_0x4ea3bb};}function maybeUpdateWrapper(_0x296611){const _0x545817=a0_0x454959;if(skipWrapperUpdateCheck())return![];if(process.env.WHALENT_WRAPPER_UPDATE_ATTEMPTED)return![];const _0x52c003=latestWrapperVersion();if(!_0x52c003||compareSemver(_0x52c003,WRAPPER_VERSION)<=0x0)return![];console['warn'](_0x545817(0x1eb)+'ilable:\x20'+WRAPPER_VERSION+_0x545817(0x1f0)+_0x52c003),console[_0x545817(0x1c4)](_0x545817(0x1f4)+'\x20'+WRAPPER_PKG_NAME+'@'+_0x52c003+('\x20from\x20npm\x20before\x20sta'+_0x545817(0x1e8)));const _0x586840=installWrapperVersion(_0x52c003);if(!_0x586840['ok']){console['warn']('[wrapper]\x20wrapper\x20up'+_0x545817(0x1e3)+'ing\x20with\x20'+WRAPPER_VERSION);if(_0x586840['output'])console[_0x545817(0x1c4)](_0x586840[_0x545817(0x1d8)]['split'](/\r?\n/)[_0x545817(0x1ca)](-0xc)[_0x545817(0x213)]('\x0a'));return console[_0x545817(0x1c4)]('[wrapper]\x20Manual\x20upd'+'ate:\x20npm\x20install\x20-g\x20'+WRAPPER_PKG_NAME+'@'+_0x52c003+_0x545817(0x1e5)+NPM_REGISTRY),![];}console[_0x545817(0x1c4)]('[wrapper]\x20wrapper\x20up'+'dated\x20to\x20'+_0x52c003+_0x545817(0x1c3));const _0x434ba4=process[_0x545817(0x1cc)][0x1],_0xc48678=(0x0,import_child_process['spawnSync'])(process['execPath'],[_0x434ba4,..._0x296611],{'stdio':_0x545817(0x1e7),'env':{...process.env,'WHALENT_WRAPPER_UPDATE_ATTEMPTED':_0x52c003},'shell':![]});process['exit'](_0xc48678['status']??0x0);}function findCoreScript(){const _0x4c40a1=a0_0x454959,_0x530c99=String(process.env.WHALENT_CORE_ENTRY||'')['trim']();if(_0x530c99&&fs[_0x4c40a1(0x1d9)](_0x530c99))return _0x530c99;const _0x4447f1=npmRootGlobal();if(_0x4447f1){const _0x3d2d0b=path[_0x4c40a1(0x213)](_0x4447f1,_0x4c40a1(0x1ee),_0x4c40a1(0x202),'dist','index.cjs');if(fs[_0x4c40a1(0x1d9)](_0x3d2d0b))return _0x3d2d0b;}const _0x583add=path['join'](wrapperBaseDir(),_0x4c40a1(0x208));if(fs[_0x4c40a1(0x1d9)](_0x583add))return _0x583add;const _0x23f9aa=path['join'](wrapperBaseDir(),'..','packages','core','dist','index.cjs');if(fs['existsSync'](_0x23f9aa))return _0x23f9aa;throw new Error('whalent\x20core\x20runtime'+'\x20not\x20found;\x20install\x20'+'@whalent/agent-core\x20'+'or\x20rebuild\x20@whalent/'+'agent');}function coreVersion(_0x4c5622=findCoreScript()){const _0x4bc721=a0_0x454959,_0x5993cf=(0x0,import_child_process[_0x4bc721(0x23b)])(process[_0x4bc721(0x22a)],[_0x4c5622,_0x4bc721(0x237)],{'encoding':'utf8','timeout':0x3a98,'env':{...process.env,'WHALENT_SKIP_UPDATE_CHECK':'1'},'shell':![]}),_0x10e212=(_0x5993cf['stdout']||'')+'\x0a'+(_0x5993cf['stderr']||'');return _0x10e212[_0x4bc721(0x222)](/(\d+\.\d+\.\d+(?:[-\w.]+)?)/)?.[0x1]||'';}function isExecutable(_0x63d8ea){const _0x4105e2=a0_0x454959;try{return fs[_0x4105e2(0x20c)](_0x63d8ea,fs['constants']['X_OK']),!![];}catch{return![];}}function shellQuote(_0x331954){const _0x2a1379=a0_0x454959;return'\x27'+_0x331954[_0x2a1379(0x1c2)](/'/g,'\x27\x5c\x27\x27')+'\x27';}function coreNodePtySpawnHelperPath(_0x4abc4f){const _0x5cf982=a0_0x454959;if(process['platform']!==_0x5cf982(0x1ce))return'';try{const _0x17ec0c=(0x0,import_module['createRequire'])(_0x4abc4f),_0x15a563=_0x17ec0c['resolve']('node-pty'),_0x384ba7=path[_0x5cf982(0x229)](path[_0x5cf982(0x1fa)](_0x15a563),'..');return path[_0x5cf982(0x213)](_0x384ba7,_0x5cf982(0x219),'darwin-'+process[_0x5cf982(0x1f5)],'spawn-helper');}catch{return'';}}function checkMacNodePtySpawnHelper(_0xa9bb82){const _0xd03c7a=a0_0x454959,_0x5514c2=coreNodePtySpawnHelperPath(_0xa9bb82);if(!_0x5514c2||CHECKED_PTY_HELPERS[_0xd03c7a(0x225)](_0x5514c2))return;CHECKED_PTY_HELPERS[_0xd03c7a(0x221)](_0x5514c2);if(!fs['existsSync'](_0x5514c2)){console['warn'](_0xd03c7a(0x234)+'-pty\x20spawn-helper\x20no'+'t\x20found:\x20'+_0x5514c2);return;}if(isExecutable(_0x5514c2))return;try{const _0x436cfd=fs[_0xd03c7a(0x209)](_0x5514c2)['mode'];fs['chmodSync'](_0x5514c2,_0x436cfd|0x1ed);}catch{}if(isExecutable(_0x5514c2)){console['warn'](_0xd03c7a(0x22c)+_0xd03c7a(0x207)+_0xd03c7a(0x214)+_0x5514c2);return;}console['warn']('[wrapper]\x20macOS\x20node'+_0xd03c7a(0x1e1)+_0xd03c7a(0x1d6)+_0x5514c2),console['warn'](_0xd03c7a(0x211)+'nce\x20to\x20fix\x20terminal/'+_0xd03c7a(0x22e)),console[_0xd03c7a(0x1c4)]('\x20\x20HELPER='+shellQuote(_0x5514c2)),console['warn']('\x20\x20ls\x20-l\x20\x22$HELPER\x22'),console[_0xd03c7a(0x1c4)](_0xd03c7a(0x1cb));}function printVersion(){const _0x2af000=a0_0x454959;let _0x2694ae='';try{_0x2694ae=coreVersion();}catch{}console[_0x2af000(0x20a)](_0x2af000(0x1d7)+WRAPPER_VERSION),console[_0x2af000(0x20a)](_0x2af000(0x1fd)+WRAPPER_VERSION),console[_0x2af000(0x20a)](_0x2af000(0x21a)+(_0x2694ae||_0x2af000(0x1c7)));}function a0_0x4500(_0x536442,_0x559c6b){_0x536442=_0x536442-0x1c1;const _0x1950eb=a0_0x1950();let _0x45003e=_0x1950eb[_0x536442];if(a0_0x4500['juVbmP']===undefined){var _0x5730c1=function(_0x41c3e9){const _0x17cf6d='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3df28c='',_0x357a64='';for(let _0x27ce09=0x0,_0x56fcf2,_0x22df06,_0x4a0f88=0x0;_0x22df06=_0x41c3e9['charAt'](_0x4a0f88++);~_0x22df06&&(_0x56fcf2=_0x27ce09%0x4?_0x56fcf2*0x40+_0x22df06:_0x22df06,_0x27ce09++%0x4)?_0x3df28c+=String['fromCharCode'](0xff&_0x56fcf2>>(-0x2*_0x27ce09&0x6)):0x0){_0x22df06=_0x17cf6d['indexOf'](_0x22df06);}for(let _0x3dbc42=0x0,_0x19c068=_0x3df28c['length'];_0x3dbc42<_0x19c068;_0x3dbc42++){_0x357a64+='%'+('00'+_0x3df28c['charCodeAt'](_0x3dbc42)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x357a64);};a0_0x4500['OkeSeS']=_0x5730c1,a0_0x4500['zPTDUy']={},a0_0x4500['juVbmP']=!![];}const _0x582d60=_0x1950eb[0x0],_0x3fe6f6=_0x536442+_0x582d60,_0x5f348b=a0_0x4500['zPTDUy'][_0x3fe6f6];return!_0x5f348b?(_0x45003e=a0_0x4500['OkeSeS'](_0x45003e),a0_0x4500['zPTDUy'][_0x3fe6f6]=_0x45003e):_0x45003e=_0x5f348b,_0x45003e;}function directCore(_0x5e4dd8){const _0x4e0e89=a0_0x454959,_0x27d002=findCoreScript();checkMacNodePtySpawnHelper(_0x27d002);const _0x1dff3f=(0x0,import_child_process[_0x4e0e89(0x23b)])(process['execPath'],[_0x27d002,..._0x5e4dd8],{'stdio':_0x4e0e89(0x1e7),'env':{...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_CORE_ENTRY':_0x27d002},'shell':![]});process[_0x4e0e89(0x223)](_0x1dff3f[_0x4e0e89(0x236)]??0x0);}function shouldSupervise(_0x1ab8d5){const _0x24f00c=a0_0x454959;if(_0x1ab8d5['includes'](_0x24f00c(0x1f1)))return![];const _0x166413=_0x1ab8d5[0x0]||'';if(_0x166413==='ls'||_0x166413===_0x24f00c(0x236)||_0x166413==='ps')return![];if(_0x166413===_0x24f00c(0x20e)||_0x166413==='daemon-mcp')return![];if(_0x1ab8d5['includes'](_0x24f00c(0x1f2))||_0x1ab8d5['includes']('-h'))return![];return!![];}function installCoreVersion(_0x1043ba){const _0x3b37f6=a0_0x454959,_0x5cdbf5=resolveExecutable('npm');if(!_0x5cdbf5)return{'ok':![],'output':'npm\x20not\x20found\x20on\x20PAT'+'H'};const _0xd11008=CORE_PKG_NAME+'@'+_0x1043ba,_0x8b8267=run(_0x5cdbf5,['install','-g',_0xd11008,'--registry='+NPM_REGISTRY]),_0x455d94=((_0x8b8267[_0x3b37f6(0x203)]||'')+'\x0a'+(_0x8b8267[_0x3b37f6(0x20d)]||''))['trim']();return{'ok':_0x8b8267[_0x3b37f6(0x236)]===0x0,'output':_0x455d94};}async function superviseCore(_0x159896){const _0x41b40f=a0_0x454959;let _0x191587=![],_0xfbf973=null;const _0x32991f=()=>{const _0x4c2f35=a0_0x4500;_0x191587=!![];if(_0xfbf973&&!_0xfbf973[_0x4c2f35(0x1de)])try{_0xfbf973['kill']('SIGTERM');}catch{}else process['exit'](0x0);};process['on'](_0x41b40f(0x220),_0x32991f),process['on']('SIGTERM',_0x32991f);while(!![]){const _0x10bed7=findCoreScript();checkMacNodePtySpawnHelper(_0x10bed7);const _0x2d0693={...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_WRAPPER_MANAGED':'1','WHALENT_CORE_ENTRY':_0x10bed7},_0x283b5d=readUpgradeState(),_0x18e059=!!_0x283b5d?.['pending'];let _0x2800d0=![],_0x35cc44=null;console[_0x41b40f(0x20a)](_0x41b40f(0x1f7)+'ore:\x20'+_0x10bed7),_0xfbf973=(0x0,import_child_process[_0x41b40f(0x1c9)])(process[_0x41b40f(0x22a)],[_0x10bed7,..._0x159896],{'env':_0x2d0693,'stdio':['inherit','pipe',_0x41b40f(0x21f)]});const _0x3ae79e=()=>{const _0x33ee8f=_0x41b40f;if(_0x2800d0)return;_0x2800d0=!![];if(_0x35cc44)clearTimeout(_0x35cc44);const _0x20f0b5=readUpgradeState();_0x20f0b5?.['pending']&&(writeUpgradeState({..._0x20f0b5,'pending':![],'rollback':![],'health_status':'healthy'}),console[_0x33ee8f(0x20a)](_0x33ee8f(0x227)+_0x33ee8f(0x235)+(_0x20f0b5[_0x33ee8f(0x239)]||_0x20f0b5[_0x33ee8f(0x232)]||'')));},_0x31b1c1=(_0x19527e,_0x275599=![])=>{const _0x3c0f54=_0x41b40f,_0x5f5ddc=_0x19527e['toString']();(_0x275599?process['stderr']:process['stdout'])[_0x3c0f54(0x1fc)](_0x5f5ddc),(_0x5f5ddc[_0x3c0f54(0x20f)](_0x3c0f54(0x1dd))||_0x5f5ddc['includes']('Gateway\x20registered\x20m'+_0x3c0f54(0x21e))||_0x5f5ddc['includes'](_0x3c0f54(0x1cf)))&&_0x3ae79e();};_0xfbf973['stdout']?.['on']('data',_0x17b0c4=>_0x31b1c1(_0x17b0c4,![])),_0xfbf973['stderr']?.['on']('data',_0x4f7fdb=>_0x31b1c1(_0x4f7fdb,!![]));_0x18e059&&(_0x35cc44=setTimeout(()=>{const _0x4eb113=_0x41b40f;if(_0x2800d0||!_0xfbf973||_0xfbf973[_0x4eb113(0x1de)])return;console['error']('[wrapper]\x20new\x20core\x20d'+_0x4eb113(0x23c)+_0x4eb113(0x1fb)+_0x4eb113(0x1c8));try{_0xfbf973['kill'](_0x4eb113(0x1e9));}catch{}},HEALTH_TIMEOUT_MS));const _0x28a163=await new Promise(_0x2fd061=>{const _0x47745a=_0x41b40f;_0xfbf973[_0x47745a(0x1e4)]('exit',(_0x34bdeb,_0x4ae996)=>_0x2fd061({'code':_0x34bdeb,'signal':_0x4ae996}));});if(_0x35cc44)clearTimeout(_0x35cc44);_0xfbf973=null;if(_0x191587)process['exit'](_0x28a163[_0x41b40f(0x1cd)]??0x0);const _0x1773b2=readUpgradeState();if(_0x1773b2?.[_0x41b40f(0x233)]&&!_0x2800d0){const _0x2c3c2e=String(_0x1773b2['previous_core_versio'+'n']||'')['trim']();if(_0x2c3c2e){console['error']('[wrapper]\x20rolling\x20ba'+'ck\x20core\x20to\x20'+_0x2c3c2e);const _0x36fa7d=installCoreVersion(_0x2c3c2e);writeUpgradeState({..._0x1773b2,'pending':![],'rollback':!![],'health_status':_0x36fa7d['ok']?_0x41b40f(0x206):_0x41b40f(0x1f8),'error':_0x36fa7d['ok']?'':_0x36fa7d[_0x41b40f(0x1d8)]});}else writeUpgradeState({..._0x1773b2,'pending':![],'rollback':!![],'health_status':_0x41b40f(0x1d5),'error':_0x41b40f(0x1e0)+'n\x20unknown'});}const _0xc3fcfc=_0x28a163['code']===SUPERVISED_RESTART_CODE||_0x1773b2?.[_0x41b40f(0x233)];if(!_0xc3fcfc&&_0x28a163['code']===0x0)process[_0x41b40f(0x223)](0x0);console['log']('[wrapper]\x20core\x20exite'+'d\x20code='+(_0x28a163['code']??'')+(_0x28a163[_0x41b40f(0x1df)]?'\x20signal='+_0x28a163[_0x41b40f(0x1df)]:'')+';\x20restarting\x20in\x20'+RESTART_DELAY_MS+'ms'),await new Promise(_0x8f4ec0=>setTimeout(_0x8f4ec0,RESTART_DELAY_MS));}}async function main(){const _0x2baccd=a0_0x454959,_0x4e7922=process['argv'][_0x2baccd(0x1ca)](0x2);if(_0x4e7922[0x0]==='--version'||_0x4e7922[0x0]==='-v'||_0x4e7922[0x0]===_0x2baccd(0x1f9)){printVersion();return;}if((_0x4e7922[0x0]===_0x2baccd(0x236)||_0x4e7922[0x0]==='ls'||_0x4e7922[0x0]==='ps')&&!_0x4e7922[_0x2baccd(0x20f)](_0x2baccd(0x1ef))){console[_0x2baccd(0x20a)](_0x2baccd(0x1fd)+WRAPPER_VERSION);try{console[_0x2baccd(0x20a)](_0x2baccd(0x21a)+(coreVersion()||'not\x20installed'));}catch{console['log'](_0x2baccd(0x1ff));}}maybeUpdateWrapper(_0x4e7922);if(!shouldSupervise(_0x4e7922))directCore(_0x4e7922);await superviseCore(_0x4e7922);}main()[a0_0x454959(0x20b)](_0x140174=>{const _0x9d7374=a0_0x454959;console[_0x9d7374(0x230)](_0x9d7374(0x228)+_0x9d7374(0x1f6)+(_0x140174?.['message']||String(_0x140174))),process['exit'](0x1);});function a0_0x1950(){const _0x59b873=['ig5VDcbLEgvJDxrHyMXLoIa','D2HHBgvUDc1Hz2vUDca','B3v0Chv0','zxHPC3rZu3LUyW','mZa3nZKWt3H2CKXI','Dg9mB3DLCKnHC2u','mte3t2rltM9L','w2DHDgv3yxLDienVBM5Ly3rLza','A2LSBgvK','C2LNBMfS','ChjLDMLVDxmGy29Yzsb2zxjZAw8','lxb0EsbZCgf3BI1OzwXWzxiGAxm','mc4WlJa','zgf0zsbMywLSzwq7ignVBNrPBNu','B25Jzq','ic0TCMvNAxn0CNK9','Cgf0Aa','Aw5OzxjPDa','CNrPBMCGy29Yzs4UlG','u0Lhvevstq','mZC3mJy5mNHfBvHxza','w3DYyxbWzxjDihvWzgf0zsbHDMe','zMLSDgvY','BNbT','qhDOywXLBNq','ls1QC29U','ic0+ia','ls1Hz2vUDc1Pza','ls1OzwXW','mtK4nJuXnuDzq2rTyG','w3DYyxbWzxjDigLUC3rHBgXPBMC','yxjJAa','CJOG','w3DYyxbWzxjDihn0yxj0Aw5Nigm','CM9SBgjHy2TFzMfPBgvK','DMvYC2LVBG','zgLYBMfTzq','EsbPBIb0Aw1LoYbYB2XSAw5Nigi','D3jPDgu','D3jHChbLCIa','BNbTig5VDcbMB3vUza','y29YzsbUB3qGAw5ZDgfSBgvK','CgfYC2u','zNvUy3rPB24','ywDLBNqTy29Yzq','C3rKB3v0','mZK3mZa4mhPfA0TSqG','DxrMoa','CM9SBgvKx2jHy2S','uYbUB2rLlxb0EsbZCgf3BI1OzwW','y29Yzs5JANm','C3rHDfn5BMm','Bg9N','y2f0y2G','ywnJzxnZu3LUyW','C3rKzxjY','BwnW','Aw5JBhvKzxm','CMvHzezPBgvtEw5J','w3DYyxbWzxjDifj1BIb0AgLZig8','DhjPBq','AM9PBG','CgvYigv4zwn1DgfIBguGyML0oIa','D2HPy2G','CgfJA2fNzs5QC29U','nZy3mZi4uNrjCffX','Ahr0Chm6lY9YzwDPC3rYEs5UCg0','ChjLyNvPBgrZ','y29Yzsa','BwTKAxjtEw5J','ChrVCG','EwvZ','ywnOAw5L','CgLWzq','u0Lhsu5u','ywrK','Bwf0y2G','zxHPDa','C3bSAxq','AgfZ','Ag9TzwrPCG','w3DYyxbWzxjDignVCMuGDxbNCMe','w3DYyxbWzxjDiezHDgfSigvYCM8','CMvZB2X2zq','zxHLy1bHDgG','ndC4nZa0CLLOzuL4','w3DYyxbWzxjDigzPEgvKig1Hy08','ndK5odC5mw5Wq2rerG','ufrzihn0yxj0Dxa6','qgXHDgvZDa','zxjYB3i','z2v0uhjVDg90ExbLt2y','DgfYz2v0x3zLCNnPB24','CgvUzgLUzW','w3DYyxbWzxjDig1Hy09tig5Vzgu','zguGAgvHBhrOEtOG','C3rHDhvZ','ls12zxjZAw9U','x19LC01VzhvSzq','Aw5ZDgfSBgvKx3zLCNnPB24','mvzQDgDgva','C3bHD25tEw5J','AwqGBM90igjLy29TzsbOzwfSDgG','nhntAgjgsW','CMvWBgfJzq','oYbYzxn0yxj0Aw5NihDYyxbWzxi','D2fYBG','BgvUz3rO','DxrMltG','BM90igLUC3rHBgXLza','ywnR','C3bHD24','C2XPy2u','icbJAg1VzcaREcaIjeHftfbfuIi','yxjNDG','y29Kzq','zgfYD2LU','r2f0zxDHEtOGy29UBMvJDgvK','Aw5ZDgfSBa','CgXHDgzVCM0','z2v0t3DUuhjVCgvYDhLoyw1LCW','AgfZt3DUuhjVCgvYDhK','Bwf4','CM9SBgjHy2TFDw5HDMfPBgfIBgu'];a0_0x1950=function(){return _0x59b873;};return a0_0x1950();}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whalent/agent",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.46",
|
|
4
4
|
"description": "Stable wrapper for Whalent Agent core runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"yaml": "^2.4.0"
|
|
39
39
|
},
|
|
40
40
|
"optionalDependencies": {
|
|
41
|
-
"@whalent/agent-core": "0.3.
|
|
41
|
+
"@whalent/agent-core": "0.3.46"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^20.0.0",
|