@whalent/agent 0.3.52 → 0.3.53
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_0x11b559=a0_0x21e3;(function(_0xc1a60,_0xde4ae7){const _0x579953=a0_0x21e3,_0x124533=_0xc1a60();while(!![]){try{const _0xe20c3e=-parseInt(_0x579953(0xcc))/0x1*(parseInt(_0x579953(0xc9))/0x2)+-parseInt(_0x579953(0x110))/0x3+-parseInt(_0x579953(0xd4))/0x4*(parseInt(_0x579953(0xe9))/0x5)+-parseInt(_0x579953(0xdb))/0x6+parseInt(_0x579953(0x13e))/0x7+parseInt(_0x579953(0xf4))/0x8+parseInt(_0x579953(0x138))/0x9*(parseInt(_0x579953(0xd0))/0xa);if(_0xe20c3e===_0xde4ae7)break;else _0x124533['push'](_0x124533['shift']());}catch(_0x5ed736){_0x124533['push'](_0x124533['shift']());}}}(a0_0x3ad5,0x81236));var __create=Object[a0_0x11b559(0x11a)],__defProp=Object['defineProperty'],__getOwnPropDesc=Object['getOwnPropertyDescri'+a0_0x11b559(0x128)],__getOwnPropNames=Object['getOwnPropertyNames'],__getProtoOf=Object[a0_0x11b559(0x132)],__hasOwnProp=Object['prototype']['hasOwnProperty'],__copyProps=(_0xd66e6,_0xac4c23,_0x5ae352,_0x229e8b)=>{const _0x1ed969=a0_0x11b559;if(_0xac4c23&&typeof _0xac4c23===_0x1ed969(0x12c)||typeof _0xac4c23==='function'){for(let _0x5a4b30 of __getOwnPropNames(_0xac4c23))if(!__hasOwnProp[_0x1ed969(0x13b)](_0xd66e6,_0x5a4b30)&&_0x5a4b30!==_0x5ae352)__defProp(_0xd66e6,_0x5a4b30,{'get':()=>_0xac4c23[_0x5a4b30],'enumerable':!(_0x229e8b=__getOwnPropDesc(_0xac4c23,_0x5a4b30))||_0x229e8b['enumerable']});}return _0xd66e6;},__toESM=(_0x2f1abb,_0x190699,_0xe5d249)=>(_0xe5d249=_0x2f1abb!=null?__create(__getProtoOf(_0x2f1abb)):{},__copyProps(_0x190699||!_0x2f1abb||!_0x2f1abb[a0_0x11b559(0xf1)]?__defProp(_0xe5d249,a0_0x11b559(0x115),{'value':_0x2f1abb,'enumerable':!![]}):_0xe5d249,_0x2f1abb)),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_0x11b559(0x102),CORE_PKG_NAME=a0_0x11b559(0x119),NPM_REGISTRY='https://registry.npm'+a0_0x11b559(0xf2),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 _0xb8650c=a0_0x11b559;return path[_0xb8650c(0xe6)](os['homedir'](),'.whalent-agent');}function upgradeStatePath(){const _0x17a78c=a0_0x11b559;return path[_0x17a78c(0xe6)](configDir(),'core-upgrade.json');}function readWrapperVersion(){const _0x1368c5=a0_0x11b559;try{const _0x3e72ff=JSON[_0x1368c5(0xe7)](fs[_0x1368c5(0x133)](path['join'](wrapperBaseDir(),'..','package.json'),_0x1368c5(0x106)));return String(_0x3e72ff[_0x1368c5(0xd8)]||_0x1368c5(0xeb));}catch{return _0x1368c5(0xeb);}}function readUpgradeState(){try{return JSON['parse'](fs['readFileSync'](upgradeStatePath(),'utf-8'));}catch{return null;}}function a0_0x21e3(_0x1f430d,_0x2f9df2){_0x1f430d=_0x1f430d-0xc8;const _0x3ad542=a0_0x3ad5();let _0x21e38f=_0x3ad542[_0x1f430d];if(a0_0x21e3['GfGULp']===undefined){var _0x31b96d=function(_0x2f0097){const _0x17f55a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0xd66e6='',_0xac4c23='';for(let _0x5ae352=0x0,_0x229e8b,_0x5a4b30,_0x2f1abb=0x0;_0x5a4b30=_0x2f0097['charAt'](_0x2f1abb++);~_0x5a4b30&&(_0x229e8b=_0x5ae352%0x4?_0x229e8b*0x40+_0x5a4b30:_0x5a4b30,_0x5ae352++%0x4)?_0xd66e6+=String['fromCharCode'](0xff&_0x229e8b>>(-0x2*_0x5ae352&0x6)):0x0){_0x5a4b30=_0x17f55a['indexOf'](_0x5a4b30);}for(let _0x190699=0x0,_0xe5d249=_0xd66e6['length'];_0x190699<_0xe5d249;_0x190699++){_0xac4c23+='%'+('00'+_0xd66e6['charCodeAt'](_0x190699)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xac4c23);};a0_0x21e3['ujEgrB']=_0x31b96d,a0_0x21e3['NSfbcb']={},a0_0x21e3['GfGULp']=!![];}const _0x2518f7=_0x3ad542[0x0],_0x2fc59b=_0x1f430d+_0x2518f7,_0x461e75=a0_0x21e3['NSfbcb'][_0x2fc59b];return!_0x461e75?(_0x21e38f=a0_0x21e3['ujEgrB'](_0x21e38f),a0_0x21e3['NSfbcb'][_0x2fc59b]=_0x21e38f):_0x21e38f=_0x461e75,_0x21e38f;}function writeUpgradeState(_0x5b092a){const _0x4ff7b2=a0_0x11b559;try{fs[_0x4ff7b2(0x144)](configDir(),{'recursive':!![]}),fs['writeFileSync'](upgradeStatePath(),JSON['stringify']({..._0x5b092a,'updated_at':Date['now']()},null,0x2),'utf-8');}catch{}}function run(_0x2f987b,_0x30ee45,_0x2e3a06=process.env){const _0xabfe35=a0_0x11b559;return(0x0,import_child_process[_0xabfe35(0x113)])(_0x2f987b,_0x30ee45,{'encoding':'utf8','timeout':NPM_INSTALL_TIMEOUT_MS,'maxBuffer':NPM_INSTALL_MAX_BUFFER,'env':_0x2e3a06,'shell':![]});}function runNpmView(_0x51b3a9){const _0x50be92=a0_0x11b559,_0x2d7edf=resolveExecutable(_0x50be92(0x12a));if(!_0x2d7edf)return{'status':0x7f,'stdout':'','stderr':_0x50be92(0x13f),'error':new Error(_0x50be92(0x13f))};return(0x0,import_child_process[_0x50be92(0x113)])(_0x2d7edf,_0x51b3a9,{'encoding':'utf8','timeout':NPM_VIEW_TIMEOUT_MS,'maxBuffer':0x400*0x400,'env':process.env,'shell':![]});}function npmRootGlobal(){const _0x36e465=a0_0x11b559,_0x38df14=resolveExecutable(_0x36e465(0x12a));if(!_0x38df14)return'';const _0x244057=run(_0x38df14,[_0x36e465(0xe5),'-g']);if(_0x244057[_0x36e465(0xe8)]!==0x0)return'';return String(_0x244057[_0x36e465(0xf5)]||'')[_0x36e465(0x135)]();}function compareSemver(_0x387918,_0x26c421){const _0x1251a7=a0_0x11b559,_0x400ffc=String(_0x387918||'')[_0x1251a7(0x117)](/^v/,'')['split'](/[.-]/)['map'](_0x431365=>Number['parseInt'](_0x431365,0xa)||0x0),_0x5aec6d=String(_0x26c421||'')[_0x1251a7(0x117)](/^v/,'')['split'](/[.-]/)['map'](_0x4325d7=>Number['parseInt'](_0x4325d7,0xa)||0x0);for(let _0x1c0b03=0x0;_0x1c0b03<Math['max'](_0x400ffc['length'],_0x5aec6d[_0x1251a7(0xc8)],0x3);_0x1c0b03++){const _0x618dba=_0x400ffc[_0x1c0b03]||0x0,_0x408915=_0x5aec6d[_0x1c0b03]||0x0;if(_0x618dba>_0x408915)return 0x1;if(_0x618dba<_0x408915)return-0x1;}return 0x0;}function resolveExecutable(_0x314323){const _0x50a5f5=a0_0x11b559,_0x4342de=process['platform']==='win32'?_0x50a5f5(0xf8):'which';try{const _0x5212f6=(0x0,import_child_process['spawnSync'])(_0x4342de,[_0x314323],{'encoding':_0x50a5f5(0x10f),'timeout':0xbb8,'shell':![]});if(_0x5212f6[_0x50a5f5(0xe8)]!==0x0)return'';return String(_0x5212f6['stdout']||'')['split'](/\r?\n/)[_0x50a5f5(0x139)](_0x4bbc3a=>_0x4bbc3a['trim']())['filter'](Boolean)[0x0]||'';}catch{return'';}}function skipWrapperUpdateCheck(){const _0x3b1aee=a0_0x11b559,_0x5c6c05=String(process.env.WHALENT_SKIP_UPDATE_CHECK||process.env.WHALENT_NO_UPDATE_CHECK||process.env.WHALENT_SKIP_WRAPPER_UPDATE||'')[_0x3b1aee(0x135)]()[_0x3b1aee(0xef)]();return _0x5c6c05==='1'||_0x5c6c05==='true'||_0x5c6c05==='yes'||_0x5c6c05==='on';}function a0_0x3ad5(){const _0x39685a=['zMLSDgvY','w3DYyxbWzxjDig5LDYbJB3jLigq','ls1YzwDPC3rYEt0','C2LNBMfS','w3DYyxbWzxjDigLUC3rHBgXPBMC','CM9VDa','AM9PBG','CgfYC2u','C3rHDhvZ','ndeZnurqsvL2Ba','ywnOAw5L','mc4WlJa','BMnLihrVigzPEcb0zxjTAw5HBc8','w3DYyxbWzxjDihjVBgXPBMCGyMe','w2DHDgv3yxLDienVBM5Ly3rLza','Dg9mB3DLCKnHC2u','CgfJA2fNzxm','x19LC01VzhvSzq','ANmUB3jN','ywnR','mJG4mJGWDMHfwwD5','C3rKB3v0','zxHPC3rZu3LUyW','ChjLDMLVDxmGy29Yzsb2zxjZAw8','D2HLCMuUzxHL','Dg9tDhjPBMC','ls12zxjZAw9U','CgLWzq','Dhj1zq','ChvZAa','y29Yzs5JANm','y29Kzq','qgXHDgvZDa','Aw5JBhvKzxm','qhDOywXLBNqVywDLBNq','zgfYD2LU','zguGAgvHBhrOEtOG','B25Jzq','DxrMltG','BwnW','ChjLDMLVDxnFy29Yzv92zxjZAw8','B3v0Chv0','BM90igLUC3rHBgXLza','C3bSAxq','Cg9W','wf9psW','ls1QC29U','DxrMoa','nJm5mJCWA3zfugDM','y29UC3rHBNrZ','Aw5OzxjPDa','C3bHD25tEw5J','AgvHBhrOEq','zgvMyxvSDa','C2XPy2u','CMvWBgfJzq','CM9SBgjHy2TFDw5HDMfPBgfIBgu','qhDOywXLBNqVywDLBNqTy29Yzq','y3jLyxrL','D3jHChbLCIa','AwqGBM90igjLy29TzsbOzwfSDgG','DMLLDW','ihnPz25HBd0','zgf0yq','CgXHDgzVCM0','icbJAg1VzcaREcaIjeHftfbfuIi','w3DYyxbWzxjDignVCMuGDxbNCMe','y29Yzq','C3rKzxjY','w3DYyxbWzxjDihn0yxj0Aw5Nigm','zxHLy1bHDgG','Aw5ZDgfSBa','ChrVCG','CNrPBMCGy29Yzs4UlG','BNbT','ufrzihn0yxj0Dxa6','B2jQzwn0','y2fUzgLKyxrL','EwvZ','ywDLBNqTy29Yzq','D2fYBG','zcbJB2rLpq','z2v0uhjVDg90ExbLt2y','CMvHzezPBgvtEw5J','CgvUzgLUzW','DhjPBq','BIb1BMTUB3DU','zxHPDa','otLVC21LB2K','BwfW','zgfYD2LUlq','y2fSBa','D2HHBgvUDc1Hz2vUDca','ChjLyNvPBgrZ','ntG2nty4nvzttevLDa','BNbTig5VDcbMB3vUza','w3DYyxbWzxjDifj1BIb0AgLZig8','u0Lhvevstq','y2HTB2rtEw5J','lxb0EsbZCgf3BI1OzwXWzxiGAxm','BwTKAxjtEw5J','BNbTig5VDcbMB3vUzcbVBIbqqvq','BgvUz3rO','nZzxDg9gv3O','qhDOywXLBNq','icbiruXqrvi9','odG2m3D6rgrwuW','y29Yzsa','ig5VDcbMB3vUzdSGAw5ZDgfSBca','w3DYyxbWzxjDie1HBNvHBcb1Cgq','nZm3ndeWyKnhtgLe','B3jLoIa','Bwf0y2G','BM9Kzs1WDhK','ndbHwuLyAg0','w3DYyxbWzxjDihDYyxbWzxiGDxa','zxjYB3i','ls1OzwXW','DMvYC2LVBG','ic0TCMvNAxn0CNK9','Bg9N','mZu4odiYmLzlBuP1Ba','qhDOywXLBNqVywDLBNqTy29Yzsa','r2f0zxDHEsbYzwDPC3rLCMvKig0','yxjNDG','yxjJAa'];a0_0x3ad5=function(){return _0x39685a;};return a0_0x3ad5();}function latestWrapperVersion(){const _0x2edafb=a0_0x11b559,_0x3b222c=runNpmView([_0x2edafb(0x11d),WRAPPER_PKG_NAME+_0x2edafb(0x100),_0x2edafb(0xd8),_0x2edafb(0xe2)+NPM_REGISTRY]);if(_0x3b222c[_0x2edafb(0xe8)]!==0x0)return'';return String(_0x3b222c['stdout']||'')['trim']()[_0x2edafb(0x10b)](/\r?\n/)[_0x2edafb(0xe0)](Boolean)[_0x2edafb(0x10c)]()||'';}function installWrapperVersion(_0x1c3eba){const _0x3b0bdf=a0_0x11b559,_0x4a58f0=resolveExecutable(_0x3b0bdf(0x12a));if(!_0x4a58f0)return{'ok':![],'output':_0x3b0bdf(0x145)+'H'};const _0x1cd796=run(_0x4a58f0,[_0x3b0bdf(0x127),'-g',WRAPPER_PKG_NAME+'@'+_0x1c3eba,_0x3b0bdf(0xe2)+NPM_REGISTRY]),_0x28537d=((_0x1cd796['stdout']||'')+'\x0a'+(_0x1cd796[_0x3b0bdf(0x124)]||''))[_0x3b0bdf(0x135)]();return{'ok':_0x1cd796[_0x3b0bdf(0xe8)]===0x0,'output':_0x28537d};}function maybeUpdateWrapper(_0x2c0c41){const _0x47d182=a0_0x11b559;if(skipWrapperUpdateCheck())return![];if(process.env.WHALENT_WRAPPER_UPDATE_ATTEMPTED)return![];const _0x5196c4=latestWrapperVersion();if(!_0x5196c4||compareSemver(_0x5196c4,WRAPPER_VERSION)<=0x0)return![];console[_0x47d182(0x130)]('[wrapper]\x20update\x20ava'+'ilable:\x20'+WRAPPER_VERSION+'\x20->\x20'+_0x5196c4),console[_0x47d182(0x130)](_0x47d182(0xe4)+'\x20'+WRAPPER_PKG_NAME+'@'+_0x5196c4+('\x20from\x20npm\x20before\x20sta'+_0x47d182(0x129)));const _0x439bbb=installWrapperVersion(_0x5196c4);if(!_0x439bbb['ok']){console['warn']('[wrapper]\x20wrapper\x20up'+'date\x20failed;\x20continu'+'ing\x20with\x20'+WRAPPER_VERSION);if(_0x439bbb[_0x47d182(0x109)])console['warn'](_0x439bbb['output']['split'](/\r?\n/)[_0x47d182(0x116)](-0xc)[_0x47d182(0xe6)]('\x0a'));return console[_0x47d182(0x130)](_0x47d182(0xcf)+'ate:\x20npm\x20install\x20-g\x20'+WRAPPER_PKG_NAME+'@'+_0x5196c4+_0x47d182(0xd9)+NPM_REGISTRY),![];}console[_0x47d182(0x130)](_0x47d182(0xd5)+'dated\x20to\x20'+_0x5196c4+';\x20restarting\x20wrapper');const _0x3a1b91=process['argv'][0x1],_0x275c31=(0x0,import_child_process['spawnSync'])(process[_0x47d182(0x126)],[_0x3a1b91,..._0x2c0c41],{'stdio':'inherit','env':{...process.env,'WHALENT_WRAPPER_UPDATE_ATTEMPTED':_0x5196c4},'shell':![]});process[_0x47d182(0x137)](_0x275c31['status']??0x0);}function findCoreScript(){const _0x3195f1=a0_0x11b559,_0x1e7fa8=String(process.env.WHALENT_CORE_ENTRY||'')[_0x3195f1(0x135)](),_0x5d8ae2=['1',_0x3195f1(0xfc),_0x3195f1(0x12e),'on']['includes'](String(process.env.WHALENT_FORCE_CORE_ENTRY||'')[_0x3195f1(0x135)]()['toLowerCase']());if(_0x1e7fa8&&_0x5d8ae2&&fs['existsSync'](_0x1e7fa8))return _0x1e7fa8;const _0x5a0740=[],_0xd786a5=_0x3ceeae=>{const _0x34281b=_0x3195f1;if(fs[_0x34281b(0xf6)](_0x3ceeae)&&!_0x5a0740[_0x34281b(0x101)](_0x3ceeae))_0x5a0740[_0x34281b(0xfd)](_0x3ceeae);};if(_0x1e7fa8)_0xd786a5(_0x1e7fa8);const _0x2a1706=npmRootGlobal();if(_0x2a1706){const _0xc90df5=path[_0x3195f1(0xe6)](_0x2a1706,_0x3195f1(0xca),_0x3195f1(0x12f),'dist','index.cjs');_0xd786a5(_0xc90df5);}const _0x33d0db=path['join'](wrapperBaseDir(),_0x3195f1(0xfe));_0xd786a5(_0x33d0db);const _0x2d9156=path['join'](wrapperBaseDir(),'..',_0x3195f1(0xf0),_0x3195f1(0x123),'dist','index.cjs');_0xd786a5(_0x2d9156);if(_0x5a0740[_0x3195f1(0xc8)]>0x0)return _0x5a0740[_0x3195f1(0x139)]((_0x35890c,_0x51a795)=>({'candidate':_0x35890c,'index':_0x51a795,'version':coreVersion(_0x35890c)}))['sort']((_0x42859f,_0x502e2c)=>{const _0x8183e4=compareSemver(_0x502e2c['version'],_0x42859f['version']);if(_0x8183e4!==0x0)return _0x8183e4;return _0x502e2c['index']-_0x42859f['index'];})[0x0][_0x3195f1(0x12d)];throw new Error('whalent\x20core\x20runtime'+_0x3195f1(0xce)+_0x3195f1(0xdc)+'or\x20rebuild\x20@whalent/'+'agent');}function coreVersion(_0x438467=findCoreScript()){const _0x440b89=a0_0x11b559,_0x1e2c22=(0x0,import_child_process[_0x440b89(0x113)])(process['execPath'],[_0x438467,'--version'],{'encoding':_0x440b89(0x10f),'timeout':0x3a98,'env':{...process.env,'WHALENT_SKIP_UPDATE_CHECK':'1'},'shell':![]}),_0x974a57=(_0x1e2c22[_0x440b89(0xf5)]||'')+'\x0a'+(_0x1e2c22[_0x440b89(0x124)]||'');return _0x974a57[_0x440b89(0xd2)](/(\d+\.\d+\.\d+(?:[-\w.]+)?)/)?.[0x1]||'';}function isExecutable(_0x4f76fd){const _0x57a5ee=a0_0x11b559;try{return fs['accessSync'](_0x4f76fd,fs[_0x57a5ee(0x111)][_0x57a5ee(0x10d)]),!![];}catch{return![];}}function shellQuote(_0x4a4d3a){return'\x27'+_0x4a4d3a['replace'](/'/g,'\x27\x5c\x27\x27')+'\x27';}function coreNodePtySpawnHelperPath(_0x541e78){const _0x564c32=a0_0x11b559;if(process[_0x564c32(0x120)]!==_0x564c32(0x103))return'';try{const _0x42dcaf=(0x0,import_module['createRequire'])(_0x541e78),_0x4d7085=_0x42dcaf['resolve'](_0x564c32(0xd3)),_0x147979=path['resolve'](path['dirname'](_0x4d7085),'..');return path['join'](_0x147979,_0x564c32(0x13d),_0x564c32(0x13a)+process[_0x564c32(0xdf)],'spawn-helper');}catch{return'';}}function checkMacNodePtySpawnHelper(_0x435f7e){const _0x39bc55=a0_0x11b559,_0x14dd0e=coreNodePtySpawnHelperPath(_0x435f7e);if(!_0x14dd0e||CHECKED_PTY_HELPERS['has'](_0x14dd0e))return;CHECKED_PTY_HELPERS['add'](_0x14dd0e);if(!fs['existsSync'](_0x14dd0e)){console['warn']('[wrapper]\x20macOS\x20node'+'-pty\x20spawn-helper\x20no'+'t\x20found:\x20'+_0x14dd0e);return;}if(isExecutable(_0x14dd0e))return;try{const _0x488092=fs['statSync'](_0x14dd0e)['mode'];fs[_0x39bc55(0x142)](_0x14dd0e,_0x488092|0x1ed);}catch{}if(isExecutable(_0x14dd0e)){console[_0x39bc55(0x130)]('[wrapper]\x20fixed\x20macO'+'S\x20node-pty\x20spawn-hel'+'per\x20executable\x20bit:\x20'+_0x14dd0e);return;}console['warn']('[wrapper]\x20macOS\x20node'+_0x39bc55(0x143)+'\x20not\x20executable:\x20'+_0x14dd0e),console['warn'](_0x39bc55(0x140)+_0x39bc55(0xec)+_0x39bc55(0x12b)),console['warn'](_0x39bc55(0xcb)+shellQuote(_0x14dd0e)),console[_0x39bc55(0x130)]('\x20\x20ls\x20-l\x20\x22$HELPER\x22'),console[_0x39bc55(0x130)](_0x39bc55(0x121));}function printVersion(){const _0x571f8a=a0_0x11b559;let _0xfa27fe='';try{_0xfa27fe=coreVersion();}catch{}console[_0x571f8a(0xda)](_0x571f8a(0x13c)+WRAPPER_VERSION),console[_0x571f8a(0xda)](_0x571f8a(0x11b)+WRAPPER_VERSION),console[_0x571f8a(0xda)](_0x571f8a(0xcd)+(_0xfa27fe||_0x571f8a(0x10a)));}function directCore(_0x5a47f7){const _0x3e2af4=a0_0x11b559,_0x77a4eb=findCoreScript();checkMacNodePtySpawnHelper(_0x77a4eb);const _0x37adbd=(0x0,import_child_process[_0x3e2af4(0x113)])(process['execPath'],[_0x77a4eb,..._0x5a47f7],{'stdio':_0x3e2af4(0x112),'env':{...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_CORE_ENTRY':_0x77a4eb},'shell':![]});process[_0x3e2af4(0x137)](_0x37adbd['status']??0x0);}function shouldSupervise(_0x17292b){const _0x3e98c8=a0_0x11b559;if(_0x17292b[_0x3e98c8(0x101)]('--agent-id'))return![];const _0xbcc25=_0x17292b[0x0]||'';if(_0xbcc25==='ls'||_0xbcc25===_0x3e98c8(0xe8)||_0xbcc25==='ps')return![];if(_0xbcc25===_0x3e98c8(0x107)||_0xbcc25==='daemon-mcp')return![];if(_0x17292b['includes'](_0x3e98c8(0xd7))||_0x17292b[_0x3e98c8(0x101)]('-h'))return![];return!![];}function installCoreVersion(_0x28433a){const _0x59bfa2=a0_0x11b559,_0x4fc735=resolveExecutable(_0x59bfa2(0x12a));if(!_0x4fc735)return{'ok':![],'output':_0x59bfa2(0x145)+'H'};const _0x694bbe=CORE_PKG_NAME+'@'+_0x28433a,_0x5ebb49=run(_0x4fc735,[_0x59bfa2(0x127),'-g',_0x694bbe,_0x59bfa2(0xe2)+NPM_REGISTRY]),_0x1ea273=((_0x5ebb49[_0x59bfa2(0xf5)]||'')+'\x0a'+(_0x5ebb49[_0x59bfa2(0x124)]||''))['trim']();return{'ok':_0x5ebb49[_0x59bfa2(0xe8)]===0x0,'output':_0x1ea273};}async function superviseCore(_0x26f31e){const _0x4af9f0=a0_0x11b559;let _0x256760=![],_0x3f9c3b=null;const _0x5b478a=()=>{_0x256760=!![];if(_0x3f9c3b&&!_0x3f9c3b['killed'])try{_0x3f9c3b['kill']('SIGTERM');}catch{}else process['exit'](0x0);};process['on']('SIGINT',_0x5b478a),process['on'](_0x4af9f0(0x141),_0x5b478a);while(!![]){const _0x312d56=findCoreScript();checkMacNodePtySpawnHelper(_0x312d56);const _0x12cb3d={...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_WRAPPER_MANAGED':'1','WHALENT_CORE_ENTRY':_0x312d56},_0x4cc444=readUpgradeState(),_0x4f57c8=!!_0x4cc444?.[_0x4af9f0(0x134)];let _0x2fed78=![],_0x42732f=null;console[_0x4af9f0(0xda)](_0x4af9f0(0x125)+_0x4af9f0(0xd1)+_0x312d56),_0x3f9c3b=(0x0,import_child_process['spawn'])(process['execPath'],[_0x312d56,..._0x26f31e],{'env':_0x12cb3d,'stdio':['inherit','pipe',_0x4af9f0(0xfb)]});const _0x155745=()=>{const _0x537ee2=_0x4af9f0;if(_0x2fed78)return;_0x2fed78=!![];if(_0x42732f)clearTimeout(_0x42732f);const _0x503da7=readUpgradeState();_0x503da7?.[_0x537ee2(0x134)]&&(writeUpgradeState({..._0x503da7,'pending':![],'rollback':![],'health_status':_0x537ee2(0x114)}),console['log'](_0x537ee2(0x122)+_0x537ee2(0x104)+(_0x503da7['installed_version']||_0x503da7['target_version']||'')));},_0x28e496=(_0x3c34ab,_0x4fb13a=![])=>{const _0x270fde=_0x4af9f0,_0x5434ad=_0x3c34ab[_0x270fde(0xf9)]();(_0x4fb13a?process[_0x270fde(0x124)]:process[_0x270fde(0xf5)])['write'](_0x5434ad),(_0x5434ad['includes'](_0x270fde(0xee))||_0x5434ad[_0x270fde(0x101)](_0x270fde(0xdd)+_0x270fde(0xea))||_0x5434ad['includes']('Gateway:\x20connected'))&&_0x155745();};_0x3f9c3b[_0x4af9f0(0xf5)]?.['on'](_0x4af9f0(0x11f),_0x59ba6c=>_0x28e496(_0x59ba6c,![])),_0x3f9c3b[_0x4af9f0(0x124)]?.['on']('data',_0x5ea1f6=>_0x28e496(_0x5ea1f6,!![]));_0x4f57c8&&(_0x42732f=setTimeout(()=>{const _0x47af6a=_0x4af9f0;if(_0x2fed78||!_0x3f9c3b||_0x3f9c3b['killed'])return;console[_0x47af6a(0xd6)](_0x47af6a(0xe1)+_0x47af6a(0x11c)+'y\x20in\x20time;\x20rolling\x20b'+_0x47af6a(0xf3));try{_0x3f9c3b['kill']('SIGTERM');}catch{}},HEALTH_TIMEOUT_MS));const _0x59f82d=await new Promise(_0x4bcbdb=>{const _0x3134a4=_0x4af9f0;_0x3f9c3b[_0x3134a4(0x105)](_0x3134a4(0x137),(_0x53faeb,_0x592f78)=>_0x4bcbdb({'code':_0x53faeb,'signal':_0x592f78}));});if(_0x42732f)clearTimeout(_0x42732f);_0x3f9c3b=null;if(_0x256760)process[_0x4af9f0(0x137)](_0x59f82d[_0x4af9f0(0xff)]??0x0);const _0x2f0a50=readUpgradeState();if(_0x2f0a50?.[_0x4af9f0(0x134)]&&!_0x2fed78){const _0x4d720a=String(_0x2f0a50[_0x4af9f0(0x108)+'n']||'')[_0x4af9f0(0x135)]();if(_0x4d720a){console[_0x4af9f0(0xd6)](_0x4af9f0(0xed)+'ck\x20core\x20to\x20'+_0x4d720a);const _0xf85309=installCoreVersion(_0x4d720a);writeUpgradeState({..._0x2f0a50,'pending':![],'rollback':!![],'health_status':_0xf85309['ok']?'rolled_back':'rollback_failed','error':_0xf85309['ok']?'':_0xf85309[_0x4af9f0(0x109)]});}else writeUpgradeState({..._0x2f0a50,'pending':![],'rollback':!![],'health_status':_0x4af9f0(0x118),'error':_0x4af9f0(0xf7)+_0x4af9f0(0x136)});}const _0x103151=_0x59f82d['code']===SUPERVISED_RESTART_CODE||_0x2f0a50?.['pending'];if(!_0x103151&&_0x59f82d['code']===0x0)process[_0x4af9f0(0x137)](0x0);console[_0x4af9f0(0xda)]('[wrapper]\x20core\x20exite'+_0x4af9f0(0x131)+(_0x59f82d['code']??'')+(_0x59f82d[_0x4af9f0(0xe3)]?_0x4af9f0(0x11e)+_0x59f82d[_0x4af9f0(0xe3)]:'')+';\x20restarting\x20in\x20'+RESTART_DELAY_MS+'ms'),await new Promise(_0x35646a=>setTimeout(_0x35646a,RESTART_DELAY_MS));}}async function main(){const _0x1ef9df=a0_0x11b559,_0x45d52f=process[_0x1ef9df(0xde)][_0x1ef9df(0x116)](0x2);if(_0x45d52f[0x0]===_0x1ef9df(0xfa)||_0x45d52f[0x0]==='-v'||_0x45d52f[0x0]===_0x1ef9df(0xd8)){printVersion();return;}if((_0x45d52f[0x0]===_0x1ef9df(0xe8)||_0x45d52f[0x0]==='ls'||_0x45d52f[0x0]==='ps')&&!_0x45d52f[_0x1ef9df(0x101)](_0x1ef9df(0x10e))){console[_0x1ef9df(0xda)]('wrapper\x20'+WRAPPER_VERSION);try{console[_0x1ef9df(0xda)]('core\x20'+(coreVersion()||'not\x20installed'));}catch{console[_0x1ef9df(0xda)]('core\x20not\x20installed');}}maybeUpdateWrapper(_0x45d52f);if(!shouldSupervise(_0x45d52f))directCore(_0x45d52f);await superviseCore(_0x45d52f);}main()['catch'](_0x1196b8=>{console['error']('[wrapper]\x20Fatal\x20erro'+'r:\x20'+(_0x1196b8?.['message']||String(_0x1196b8))),process['exit'](0x1);});
|
|
2
|
+
'use strict';const a0_0x4eccd1=a0_0x88de;(function(_0x113190,_0x5a2ad8){const _0x56af71=a0_0x88de,_0x4f8fef=_0x113190();while(!![]){try{const _0x12d083=-parseInt(_0x56af71(0x209))/0x1*(-parseInt(_0x56af71(0x208))/0x2)+parseInt(_0x56af71(0x212))/0x3+-parseInt(_0x56af71(0x22f))/0x4*(parseInt(_0x56af71(0x210))/0x5)+-parseInt(_0x56af71(0x1f0))/0x6+-parseInt(_0x56af71(0x1e8))/0x7+parseInt(_0x56af71(0x1d8))/0x8*(parseInt(_0x56af71(0x1d1))/0x9)+parseInt(_0x56af71(0x1f5))/0xa;if(_0x12d083===_0x5a2ad8)break;else _0x4f8fef['push'](_0x4f8fef['shift']());}catch(_0x1962ce){_0x4f8fef['push'](_0x4f8fef['shift']());}}}(a0_0x18f0,0x25d8c));function a0_0x18f0(){const _0x327024=['Aw5KzxGUy2PZ','D3jHChbLCIa','D2HHBgvUDc1Hz2vUDca','B3iGCMvIDwLSzcbaD2HHBgvUDc8','mtHZA3PnuNK','y29YzsbUB3qGAw5ZDgfSBgvK','B25Jzq','zNvUy3rPB24','A2LSBgvK','C3bHD24','C3rHDfn5BMm','mtyZnJG4uNH1Cxnp','B3v0Chv0','w3DYyxbWzxjDigLUC3rHBgXPBMC','ls1Hz2vUDc1Pza','BwvZC2fNzq','D3jPDgvgAwXLu3LUyW','BNbTig5VDcbMB3vUzcbVBIbqqvq','Cgf0Aa','AwqGBM90igjLy29TzsbOzwfSDgG','CgfYC2vjBNq','qgXHDgvZDa','CM9SBgjHy2TFDw5HDMfPBgfIBgu','A2LSBa','w2DHDgv3yxLDienVBM5Ly3rLza','C3bSAxq','w3DYyxbWzxjDihjVBgXPBMCGyMe','nJaWnda0AvfUwfHw','DxrMltG','zgvMyxvSDa','C3rKB3v0','lxb0EsbZCgf3BI1OzwXWzxiGAxm','zxjYB3i','ChjLyNvPBgrZ','ls1YzwDPC3rYEt0','mtiYmZGYmhvtu0v0sW','AgvHBhrOEq','ls1OzwXW','AgfZ','BgvUz3rO','nti4ntK4mfrIBNfcAa','lNDOywXLBNqTywDLBNq','D3jPDgu','DhjPBq','mc4WlJa','AM9PBG','AgfZt3DUuhjVCgvYDhK','D2fYBG','y29Yzs5JANm','ic0TCMvNAxn0CNK9','ls12zxjZAw9U','D2HHBgvUDcbJB3jLihj1BNrPBwu','w3DYyxbWzxjDie1HBNvHBcb1Cgq','C3bHD25tEw5J','ig5VDcbLEgvJDxrHyMXLoIa','zgf0yq','DMvYC2LVBG','ywnJzxnZu3LUyW','CM9SBgvKx2jHy2S','mtGZmZjztMHjvei','mtDUqwvVr2y','BNbTig5VDcbMB3vUza','CgXHDgzVCM0','ig5VDcbMB3vUzdSGAw5ZDgfSBca','Aw5ZDgfSBgvKx3zLCNnPB24','qhDOywXLBNqVywDLBNqTy29Yzq','BM9Kzs1WDhK','nJiWzxDoy2jK','icbSCYaTBcaIjeHftfbfuIi','mZy1ntj1qNnxuuu','zgfYD2LU','Aw5JBhvKzxm','CM9VDa','C3rHDhvZ','Dhj1zq','w3DYyxbWzxjDihDYyxbWzxiGDxa','CMvWBgfJzq','lxb0EsbZCgf3BI1OzwXWzxiGBM8','D2HPy2G','uYbUB2rLlxb0EsbZCgf3BI1OzwW','u0Lhvevstq','zxHPDa','y2fUzgLKyxrL','ANmUB3jN','w3DYyxbWzxjDihn0yxj0Aw5Nigm','BwnW','Bg9N','C3rKzxjY','w3DYyxbWzxjDig1Hy09tig5Vzgu','u0Lhsu5u','ChvZAa','zMLSDgvY','zgLYBMfTzq','zgLZDa','BwfW','ChjLDMLVDxmGy29Yzsb2zxjZAw8','C2XPy2u','w3DYyxbWzxjDigzPEgvKig1Hy08','otq0nhz0rKDWEq','DxrMoa','CMvZB2X2zq','BMnLihrVigzPEcb0zxjTAw5HBc8','CgfYC2u','zgfYD2LUlq','Dg9tDhjPBMC','zw51BwvYywjSzq','Aw5KzxG','BM90igLUC3rHBgXLza','zcbJB2rLpq','y29Kzq','w3DYyxbWzxjDiezHDgfSigvYCM8','C29YDa','zxHPC3rZu3LUyW','y29Yzsa','zgf0zwqGDg8G','icbJAg1VzcaREcaIjeHftfbfuIi','y29Yzq','Ahr0Chm6lY9YzwDPC3rYEs5UCg0','yxjJAa','CgvUzgLUzW','zxHLy1bHDgG','EwvZ','BNbT','CMvHzezPBgvtEw5J','CgLWzq','y3jLyxrLuMvXDwLYzq','w3DYyxbWzxjDig5LDYbJB3jLigq'];a0_0x18f0=function(){return _0x327024;};return a0_0x18f0();}var __create=Object['create'],__defProp=Object['defineProperty'],__getOwnPropDesc=Object['getOwnPropertyDescri'+'ptor'],__getOwnPropNames=Object['getOwnPropertyNames'],__getProtoOf=Object['getPrototypeOf'],__hasOwnProp=Object['prototype'][a0_0x4eccd1(0x1fb)],__copyProps=(_0x360f41,_0x20fcd4,_0x1cc645,_0x57f3ff)=>{const _0x1f1481=a0_0x4eccd1;if(_0x20fcd4&&typeof _0x20fcd4==='object'||typeof _0x20fcd4===_0x1f1481(0x1d4)){for(let _0x26bc0 of __getOwnPropNames(_0x20fcd4))if(!__hasOwnProp['call'](_0x360f41,_0x26bc0)&&_0x26bc0!==_0x1cc645)__defProp(_0x360f41,_0x26bc0,{'get':()=>_0x20fcd4[_0x26bc0],'enumerable':!(_0x57f3ff=__getOwnPropDesc(_0x20fcd4,_0x26bc0))||_0x57f3ff[_0x1f1481(0x236)]});}return _0x360f41;},__toESM=(_0x869e9c,_0xe286ab,_0x2372f4)=>(_0x2372f4=_0x869e9c!=null?__create(__getProtoOf(_0x869e9c)):{},__copyProps(_0xe286ab||!_0x869e9c||!_0x869e9c['__esModule']?__defProp(_0x2372f4,a0_0x4eccd1(0x1ea),{'value':_0x869e9c,'enumerable':!![]}):_0x2372f4,_0x869e9c)),import_child_process=require('child_process'),fs=__toESM(require('fs'),0x1),import_module=require('module'),os=__toESM(require('os'),0x1),path=__toESM(require(a0_0x4eccd1(0x1df)),0x1),WRAPPER_PKG_NAME='@whalent/agent',CORE_PKG_NAME=a0_0x4eccd1(0x20e),NPM_REGISTRY=a0_0x4eccd1(0x1c3)+a0_0x4eccd1(0x220),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 _0x225055=a0_0x4eccd1;return path['join'](os['homedir'](),_0x225055(0x1f6));}function upgradeStatePath(){return path['join'](configDir(),'core-upgrade.json');}function readWrapperVersion(){const _0xe3bc5f=a0_0x4eccd1;try{const _0x13d606=JSON['parse'](fs[_0xe3bc5f(0x1c9)](path[_0xe3bc5f(0x1fa)](wrapperBaseDir(),'..','package.json'),_0xe3bc5f(0x1e9)));return String(_0x13d606[_0xe3bc5f(0x205)]||'0.0.0');}catch{return _0xe3bc5f(0x1f9);}}function readUpgradeState(){const _0x4bf358=a0_0x4eccd1;try{return JSON[_0x4bf358(0x233)](fs['readFileSync'](upgradeStatePath(),_0x4bf358(0x1e9)));}catch{return null;}}function writeUpgradeState(_0x1e8a16){const _0x87464=a0_0x4eccd1;try{fs['mkdirSync'](configDir(),{'recursive':!![]}),fs[_0x87464(0x1dd)](upgradeStatePath(),JSON['stringify']({..._0x1e8a16,'updated_at':Date['now']()},null,0x2),'utf-8');}catch{}}function run(_0x4aa2f3,_0x58e21f,_0x4e16de=process.env){const _0x125547=a0_0x4eccd1;return(0x0,import_child_process[_0x125547(0x202)])(_0x4aa2f3,_0x58e21f,{'encoding':_0x125547(0x230),'timeout':NPM_INSTALL_TIMEOUT_MS,'maxBuffer':NPM_INSTALL_MAX_BUFFER,'env':_0x4e16de,'shell':![]});}function runNpmView(_0x522ea8){const _0x3a81ea=a0_0x4eccd1,_0x42dd09=resolveExecutable('npm');if(!_0x42dd09)return{'status':0x7f,'stdout':'','stderr':_0x3a81ea(0x20a),'error':new Error(_0x3a81ea(0x20a))};return(0x0,import_child_process[_0x3a81ea(0x202)])(_0x42dd09,_0x522ea8,{'encoding':_0x3a81ea(0x230),'timeout':NPM_VIEW_TIMEOUT_MS,'maxBuffer':0x400*0x400,'env':process.env,'shell':![]});}function npmRootGlobal(){const _0x5a6914=a0_0x4eccd1,_0x53e46d=resolveExecutable(_0x5a6914(0x1c8));if(!_0x53e46d)return'';const _0x21c90e=run(_0x53e46d,[_0x5a6914(0x215),'-g']);if(_0x21c90e[_0x5a6914(0x216)]!==0x0)return'';return String(_0x21c90e['stdout']||'')[_0x5a6914(0x1f8)]();}function compareSemver(_0x130522,_0x130834){const _0x124c77=a0_0x4eccd1,_0x38f2d6=String(_0x130522||'')['replace'](/^v/,'')['split'](/[.-]/)[_0x124c77(0x22b)](_0x9659fc=>Number[_0x124c77(0x1e1)](_0x9659fc,0xa)||0x0),_0x3a4bac=String(_0x130834||'')[_0x124c77(0x219)](/^v/,'')[_0x124c77(0x1e6)](/[.-]/)['map'](_0x4b3b02=>Number[_0x124c77(0x1e1)](_0x4b3b02,0xa)||0x0);for(let _0x29778c=0x0;_0x29778c<Math['max'](_0x38f2d6['length'],_0x3a4bac['length'],0x3);_0x29778c++){const _0xc2dc9d=_0x38f2d6[_0x29778c]||0x0,_0x773c0a=_0x3a4bac[_0x29778c]||0x0;if(_0xc2dc9d>_0x773c0a)return 0x1;if(_0xc2dc9d<_0x773c0a)return-0x1;}return 0x0;}function resolveExecutable(_0x903bc4){const _0x206893=a0_0x4eccd1,_0x37bee4=process['platform']==='win32'?'where.exe':_0x206893(0x21b);try{const _0x8e7925=(0x0,import_child_process['spawnSync'])(_0x37bee4,[_0x903bc4],{'encoding':'utf8','timeout':0xbb8,'shell':![]});if(_0x8e7925[_0x206893(0x216)]!==0x0)return'';return String(_0x8e7925['stdout']||'')[_0x206893(0x1e6)](/\r?\n/)[_0x206893(0x22b)](_0x2778fb=>_0x2778fb['trim']())[_0x206893(0x228)](Boolean)[0x0]||'';}catch{return'';}}function skipWrapperUpdateCheck(){const _0xef378=a0_0x4eccd1,_0x426025=String(process.env.WHALENT_SKIP_UPDATE_CHECK||process.env.WHALENT_NO_UPDATE_CHECK||process.env.WHALENT_SKIP_WRAPPER_UPDATE||'')['trim']()['toLowerCase']();return _0x426025==='1'||_0x426025===_0xef378(0x217)||_0x426025==='yes'||_0x426025==='on';}function latestWrapperVersion(){const _0xb4bb95=a0_0x4eccd1,_0x2cc689=runNpmView(['view',WRAPPER_PKG_NAME+_0xb4bb95(0x1e2),'version',_0xb4bb95(0x1ef)+NPM_REGISTRY]);if(_0x2cc689[_0xb4bb95(0x216)]!==0x0)return'';return String(_0x2cc689[_0xb4bb95(0x1eb)]||'')['trim']()[_0xb4bb95(0x1e6)](/\r?\n/)[_0xb4bb95(0x228)](Boolean)['pop']()||'';}function installWrapperVersion(_0x223b7d){const _0x38abf8=a0_0x4eccd1,_0x25e1fd=resolveExecutable(_0x38abf8(0x1c8));if(!_0x25e1fd)return{'ok':![],'output':_0x38abf8(0x1de)+'H'};const _0x3884f6=run(_0x25e1fd,['install','-g',WRAPPER_PKG_NAME+'@'+_0x223b7d,_0x38abf8(0x1ef)+NPM_REGISTRY]),_0x3f2818=((_0x3884f6['stdout']||'')+'\x0a'+(_0x3884f6[_0x38abf8(0x224)]||''))['trim']();return{'ok':_0x3884f6['status']===0x0,'output':_0x3f2818};}function maybeUpdateWrapper(_0x1ea14e){const _0x203908=a0_0x4eccd1;if(skipWrapperUpdateCheck())return![];if(process.env.WHALENT_WRAPPER_UPDATE_ATTEMPTED)return![];const _0x258896=latestWrapperVersion();if(!_0x258896||compareSemver(_0x258896,WRAPPER_VERSION)<=0x0)return![];console[_0x203908(0x1fc)]('[wrapper]\x20update\x20ava'+'ilable:\x20'+WRAPPER_VERSION+'\x20->\x20'+_0x258896),console[_0x203908(0x1fc)](_0x203908(0x1da)+'\x20'+WRAPPER_PKG_NAME+'@'+_0x258896+('\x20from\x20npm\x20before\x20sta'+'rting\x20core...'));const _0x5d92f5=installWrapperVersion(_0x258896);if(!_0x5d92f5['ok']){console[_0x203908(0x1fc)](_0x203908(0x218)+'date\x20failed;\x20continu'+'ing\x20with\x20'+WRAPPER_VERSION);if(_0x5d92f5['output'])console[_0x203908(0x1fc)](_0x5d92f5['output'][_0x203908(0x1e6)](/\r?\n/)[_0x203908(0x22d)](-0xc)['join']('\x0a'));return console[_0x203908(0x1fc)](_0x203908(0x201)+'ate:\x20npm\x20install\x20-g\x20'+WRAPPER_PKG_NAME+'@'+_0x258896+_0x203908(0x1fe)+NPM_REGISTRY),![];}console[_0x203908(0x1fc)]('[wrapper]\x20wrapper\x20up'+_0x203908(0x23f)+_0x258896+';\x20restarting\x20wrapper');const _0xe52c1=process['argv'][0x1],_0x4ba0e1=(0x0,import_child_process[_0x203908(0x202)])(process['execPath'],[_0xe52c1,..._0x1ea14e],{'stdio':'inherit','env':{...process.env,'WHALENT_WRAPPER_UPDATE_ATTEMPTED':_0x258896},'shell':![]});process[_0x203908(0x21e)](_0x4ba0e1[_0x203908(0x216)]??0x0);}function findCoreScript(){const _0x43e7a5=a0_0x4eccd1,_0x59558d=String(process.env.WHALENT_CORE_ENTRY||'')[_0x43e7a5(0x1f8)](),_0x265fbe=['1','true',_0x43e7a5(0x1c7),'on']['includes'](String(process.env.WHALENT_FORCE_CORE_ENTRY||'')['trim']()['toLowerCase']());if(_0x59558d&&_0x265fbe&&fs[_0x43e7a5(0x23d)](_0x59558d))return _0x59558d;const _0x25c4f6=[],_0x67641f=_0x40ca77=>{const _0x54022e=_0x43e7a5;if(fs[_0x54022e(0x23d)](_0x40ca77)&&!_0x25c4f6['includes'](_0x40ca77))_0x25c4f6[_0x54022e(0x227)](_0x40ca77);};if(_0x59558d)_0x67641f(_0x59558d);const _0x506513=npmRootGlobal();if(_0x506513){const _0x37f0e9=path['join'](_0x506513,'@whalent','agent-core','dist','index.cjs');_0x67641f(_0x37f0e9);}const _0x236c52=path['join'](wrapperBaseDir(),_0x43e7a5(0x1fd));_0x67641f(_0x236c52);const _0x412d95=path[_0x43e7a5(0x1fa)](wrapperBaseDir(),'..','packages',_0x43e7a5(0x1c2),_0x43e7a5(0x22a),_0x43e7a5(0x1cd));_0x67641f(_0x412d95);if(_0x25c4f6[_0x43e7a5(0x1f4)]>0x0)return _0x25c4f6[_0x43e7a5(0x22b)]((_0x302204,_0x42b1b2)=>({'candidate':_0x302204,'index':_0x42b1b2,'version':coreVersion(_0x302204)}))[_0x43e7a5(0x23c)]((_0x5bd7b1,_0x102dd1)=>{const _0x405126=_0x43e7a5,_0xc4adfc=compareSemver(_0x102dd1['version'],_0x5bd7b1[_0x405126(0x205)]);if(_0xc4adfc!==0x0)return _0xc4adfc;return _0x102dd1[_0x405126(0x237)]-_0x5bd7b1[_0x405126(0x237)];})[0x0][_0x43e7a5(0x21f)];throw new Error(_0x43e7a5(0x200)+_0x43e7a5(0x20c)+'@whalent/agent-core\x20'+_0x43e7a5(0x1d0)+'agent');}function coreVersion(_0x1a3afe=findCoreScript()){const _0x44311e=a0_0x4eccd1,_0x4ab414=(0x0,import_child_process['spawnSync'])(process[_0x44311e(0x1c6)],[_0x1a3afe,_0x44311e(0x1ff)],{'encoding':'utf8','timeout':0x3a98,'env':{...process.env,'WHALENT_SKIP_UPDATE_CHECK':'1'},'shell':![]}),_0x57397e=(_0x4ab414[_0x44311e(0x1eb)]||'')+'\x0a'+(_0x4ab414[_0x44311e(0x224)]||'');return _0x57397e['match'](/(\d+\.\d+\.\d+(?:[-\w.]+)?)/)?.[0x1]||'';}function isExecutable(_0x607371){const _0x5e397c=a0_0x4eccd1;try{return fs[_0x5e397c(0x206)](_0x607371,fs['constants']['X_OK']),!![];}catch{return![];}}function shellQuote(_0x1ba48c){return'\x27'+_0x1ba48c['replace'](/'/g,'\x27\x5c\x27\x27')+'\x27';}function a0_0x88de(_0x1fe68c,_0x3fac73){_0x1fe68c=_0x1fe68c-0x1c1;const _0x18f0a1=a0_0x18f0();let _0x88de52=_0x18f0a1[_0x1fe68c];if(a0_0x88de['zIeZTr']===undefined){var _0x2f7de8=function(_0x4121f8){const _0xd84afe='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x360f41='',_0x20fcd4='';for(let _0x1cc645=0x0,_0x57f3ff,_0x26bc0,_0x869e9c=0x0;_0x26bc0=_0x4121f8['charAt'](_0x869e9c++);~_0x26bc0&&(_0x57f3ff=_0x1cc645%0x4?_0x57f3ff*0x40+_0x26bc0:_0x26bc0,_0x1cc645++%0x4)?_0x360f41+=String['fromCharCode'](0xff&_0x57f3ff>>(-0x2*_0x1cc645&0x6)):0x0){_0x26bc0=_0xd84afe['indexOf'](_0x26bc0);}for(let _0xe286ab=0x0,_0x2372f4=_0x360f41['length'];_0xe286ab<_0x2372f4;_0xe286ab++){_0x20fcd4+='%'+('00'+_0x360f41['charCodeAt'](_0xe286ab)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x20fcd4);};a0_0x88de['JtXBNR']=_0x2f7de8,a0_0x88de['ZFgxwk']={},a0_0x88de['zIeZTr']=!![];}const _0x1dfe7b=_0x18f0a1[0x0],_0x209150=_0x1fe68c+_0x1dfe7b,_0x44a7e4=a0_0x88de['ZFgxwk'][_0x209150];return!_0x44a7e4?(_0x88de52=a0_0x88de['JtXBNR'](_0x88de52),a0_0x88de['ZFgxwk'][_0x209150]=_0x88de52):_0x88de52=_0x44a7e4,_0x88de52;}function coreNodePtySpawnHelperPath(_0x1f4e51){const _0x33d891=a0_0x4eccd1;if(process[_0x33d891(0x20b)]!==_0x33d891(0x213))return'';try{const _0x14d54c=(0x0,import_module[_0x33d891(0x1cb)])(_0x1f4e51),_0x4b9de8=_0x14d54c[_0x33d891(0x231)](_0x33d891(0x20f)),_0x23d842=path['resolve'](path[_0x33d891(0x229)](_0x4b9de8),'..');return path['join'](_0x23d842,_0x33d891(0x1ee),_0x33d891(0x234)+process[_0x33d891(0x1c4)],'spawn-helper');}catch{return'';}}function checkMacNodePtySpawnHelper(_0x374c40){const _0x3ce117=a0_0x4eccd1,_0x1974cf=coreNodePtySpawnHelperPath(_0x374c40);if(!_0x1974cf||CHECKED_PTY_HELPERS[_0x3ce117(0x1f3)](_0x1974cf))return;CHECKED_PTY_HELPERS['add'](_0x1974cf);if(!fs[_0x3ce117(0x23d)](_0x1974cf)){console[_0x3ce117(0x1fc)]('[wrapper]\x20macOS\x20node'+_0x3ce117(0x21a)+'t\x20found:\x20'+_0x1974cf);return;}if(isExecutable(_0x1974cf))return;try{const _0x5061b8=fs[_0x3ce117(0x1d7)](_0x1974cf)['mode'];fs['chmodSync'](_0x1974cf,_0x5061b8|0x1ed);}catch{}if(isExecutable(_0x1974cf)){console['warn'](_0x3ce117(0x22e)+_0x3ce117(0x21c)+'per\x20executable\x20bit:\x20'+_0x1974cf);return;}console[_0x3ce117(0x1fc)](_0x3ce117(0x225)+_0x3ce117(0x1ec)+_0x3ce117(0x203)+_0x1974cf),console['warn']('[wrapper]\x20Run\x20this\x20o'+_0x3ce117(0x232)+'PTY\x20startup:'),console[_0x3ce117(0x1fc)]('\x20\x20HELPER='+shellQuote(_0x1974cf)),console['warn'](_0x3ce117(0x211)),console[_0x3ce117(0x1fc)](_0x3ce117(0x1c1));}function printVersion(){const _0x2a06bb=a0_0x4eccd1;let _0x31e4a8='';try{_0x31e4a8=coreVersion();}catch{}console[_0x2a06bb(0x223)](_0x2a06bb(0x1cf)+WRAPPER_VERSION),console['log'](_0x2a06bb(0x1ce)+WRAPPER_VERSION),console[_0x2a06bb(0x223)]('core\x20'+(_0x31e4a8||_0x2a06bb(0x238)));}function directCore(_0x37867e){const _0x3f6ec8=a0_0x4eccd1,_0x3a8778=findCoreScript();checkMacNodePtySpawnHelper(_0x3a8778);const _0x1bda02=(0x0,import_child_process[_0x3f6ec8(0x202)])(process[_0x3f6ec8(0x1c6)],[_0x3a8778,..._0x37867e],{'stdio':'inherit','env':{...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_CORE_ENTRY':_0x3a8778},'shell':![]});process[_0x3f6ec8(0x21e)](_0x1bda02[_0x3f6ec8(0x216)]??0x0);}function shouldSupervise(_0x24ef3c){const _0x314363=a0_0x4eccd1;if(_0x24ef3c['includes'](_0x314363(0x1db)))return![];const _0x8acf3a=_0x24ef3c[0x0]||'';if(_0x8acf3a==='ls'||_0x8acf3a===_0x314363(0x216)||_0x8acf3a==='ps')return![];if(_0x8acf3a===_0x314363(0x222)||_0x8acf3a==='daemon-mcp')return![];if(_0x24ef3c['includes'](_0x314363(0x1f2))||_0x24ef3c['includes']('-h'))return![];return!![];}function installCoreVersion(_0x54506a){const _0x50eb85=a0_0x4eccd1,_0x504901=resolveExecutable('npm');if(!_0x504901)return{'ok':![],'output':'npm\x20not\x20found\x20on\x20PAT'+'H'};const _0x39a8db=CORE_PKG_NAME+'@'+_0x54506a,_0x4033f3=run(_0x504901,['install','-g',_0x39a8db,'--registry='+NPM_REGISTRY]),_0x4c0589=((_0x4033f3[_0x50eb85(0x1eb)]||'')+'\x0a'+(_0x4033f3['stderr']||''))[_0x50eb85(0x1f8)]();return{'ok':_0x4033f3['status']===0x0,'output':_0x4c0589};}async function superviseCore(_0x3f6bd1){const _0x4d2a9b=a0_0x4eccd1;let _0x288515=![],_0x19ab86=null;const _0x1073f9=()=>{const _0x1aea0e=a0_0x88de;_0x288515=!![];if(_0x19ab86&&!_0x19ab86[_0x1aea0e(0x1d5)])try{_0x19ab86[_0x1aea0e(0x1e4)]('SIGTERM');}catch{}else process[_0x1aea0e(0x21e)](0x0);};process['on'](_0x4d2a9b(0x226),_0x1073f9),process['on'](_0x4d2a9b(0x21d),_0x1073f9);while(!![]){const _0x445724=findCoreScript();checkMacNodePtySpawnHelper(_0x445724);const _0xcaf5e7={...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_WRAPPER_MANAGED':'1','WHALENT_CORE_ENTRY':_0x445724},_0x20b8a5=readUpgradeState(),_0x19d49d=!!_0x20b8a5?.[_0x4d2a9b(0x1c5)];let _0x337ad6=![],_0x3f256f=null;console['log'](_0x4d2a9b(0x221)+'ore:\x20'+_0x445724),_0x19ab86=(0x0,import_child_process[_0x4d2a9b(0x1d6)])(process[_0x4d2a9b(0x1c6)],[_0x445724,..._0x3f6bd1],{'env':_0xcaf5e7,'stdio':['inherit',_0x4d2a9b(0x1ca),_0x4d2a9b(0x1ca)]});const _0x38e282=()=>{const _0x39efe8=_0x4d2a9b;if(_0x337ad6)return;_0x337ad6=!![];if(_0x3f256f)clearTimeout(_0x3f256f);const _0x135cc2=readUpgradeState();_0x135cc2?.['pending']&&(writeUpgradeState({..._0x135cc2,'pending':![],'rollback':![],'health_status':_0x39efe8(0x1f1)}),console['log']('[wrapper]\x20core\x20upgra'+'de\x20healthy:\x20'+(_0x135cc2[_0x39efe8(0x20d)]||_0x135cc2['target_version']||'')));},_0x4dc0c7=(_0x566136,_0x19c5b8=![])=>{const _0x114ee9=_0x4d2a9b,_0x3e10f7=_0x566136[_0x114ee9(0x235)]();(_0x19c5b8?process[_0x114ee9(0x224)]:process[_0x114ee9(0x1eb)])[_0x114ee9(0x1f7)](_0x3e10f7),(_0x3e10f7[_0x114ee9(0x214)](_0x114ee9(0x1e5))||_0x3e10f7['includes']('Gateway\x20registered\x20m'+'achine')||_0x3e10f7['includes']('Gateway:\x20connected'))&&_0x38e282();};_0x19ab86['stdout']?.['on'](_0x4d2a9b(0x204),_0x1945de=>_0x4dc0c7(_0x1945de,![])),_0x19ab86['stderr']?.['on']('data',_0x49faff=>_0x4dc0c7(_0x49faff,!![]));_0x19d49d&&(_0x3f256f=setTimeout(()=>{const _0x1b326b=_0x4d2a9b;if(_0x337ad6||!_0x19ab86||_0x19ab86['killed'])return;console[_0x1b326b(0x1ed)](_0x1b326b(0x1cc)+_0x1b326b(0x1e0)+'y\x20in\x20time;\x20rolling\x20b'+'ack');try{_0x19ab86[_0x1b326b(0x1e4)](_0x1b326b(0x21d));}catch{}},HEALTH_TIMEOUT_MS));const _0x1671d9=await new Promise(_0x4e0af4=>{const _0x41a58c=_0x4d2a9b;_0x19ab86[_0x41a58c(0x1d3)](_0x41a58c(0x21e),(_0x4819b0,_0x149b0a)=>_0x4e0af4({'code':_0x4819b0,'signal':_0x149b0a}));});if(_0x3f256f)clearTimeout(_0x3f256f);_0x19ab86=null;if(_0x288515)process['exit'](_0x1671d9[_0x4d2a9b(0x23a)]??0x0);const _0xfb46c0=readUpgradeState();if(_0xfb46c0?.['pending']&&!_0x337ad6){const _0xe99418=String(_0xfb46c0['previous_core_versio'+'n']||'')['trim']();if(_0xe99418){console['error'](_0x4d2a9b(0x1e7)+'ck\x20core\x20to\x20'+_0xe99418);const _0x543a77=installCoreVersion(_0xe99418);writeUpgradeState({..._0xfb46c0,'pending':![],'rollback':!![],'health_status':_0x543a77['ok']?_0x4d2a9b(0x207):'rollback_failed','error':_0x543a77['ok']?'':_0x543a77[_0x4d2a9b(0x1d9)]});}else writeUpgradeState({..._0xfb46c0,'pending':![],'rollback':!![],'health_status':_0x4d2a9b(0x1e3),'error':_0x4d2a9b(0x22c)+'n\x20unknown'});}const _0x3f7180=_0x1671d9[_0x4d2a9b(0x23a)]===SUPERVISED_RESTART_CODE||_0xfb46c0?.['pending'];if(!_0x3f7180&&_0x1671d9[_0x4d2a9b(0x23a)]===0x0)process[_0x4d2a9b(0x21e)](0x0);console[_0x4d2a9b(0x223)]('[wrapper]\x20core\x20exite'+_0x4d2a9b(0x239)+(_0x1671d9['code']??'')+(_0x1671d9['signal']?'\x20signal='+_0x1671d9['signal']:'')+';\x20restarting\x20in\x20'+RESTART_DELAY_MS+'ms'),await new Promise(_0x5cb113=>setTimeout(_0x5cb113,RESTART_DELAY_MS));}}async function main(){const _0x1b1a40=a0_0x4eccd1,_0x5588e7=process['argv'][_0x1b1a40(0x22d)](0x2);if(_0x5588e7[0x0]==='--version'||_0x5588e7[0x0]==='-v'||_0x5588e7[0x0]==='version'){printVersion();return;}if((_0x5588e7[0x0]===_0x1b1a40(0x216)||_0x5588e7[0x0]==='ls'||_0x5588e7[0x0]==='ps')&&!_0x5588e7['includes']('--json')){console[_0x1b1a40(0x223)]('wrapper\x20'+WRAPPER_VERSION);try{console[_0x1b1a40(0x223)](_0x1b1a40(0x23e)+(coreVersion()||'not\x20installed'));}catch{console[_0x1b1a40(0x223)](_0x1b1a40(0x1d2));}}maybeUpdateWrapper(_0x5588e7);if(!shouldSupervise(_0x5588e7))directCore(_0x5588e7);await superviseCore(_0x5588e7);}main()['catch'](_0x2f25a6=>{const _0x56025c=a0_0x4eccd1;console['error'](_0x56025c(0x23b)+'r:\x20'+(_0x2f25a6?.[_0x56025c(0x1dc)]||String(_0x2f25a6))),process['exit'](0x1);});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whalent/agent",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.53",
|
|
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.53"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^20.0.0",
|