@whalent/agent 0.3.39 → 0.3.41
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_0x444de4=a0_0x419c;(function(_0x4a259f,_0x1c5dd5){const _0x50f751=a0_0x419c,_0x580f57=_0x4a259f();while(!![]){try{const _0x2b85f3=parseInt(_0x50f751(0x1b4))/0x1+parseInt(_0x50f751(0x1b0))/0x2+parseInt(_0x50f751(0x1a6))/0x3*(parseInt(_0x50f751(0x185))/0x4)+-parseInt(_0x50f751(0x1be))/0x5*(-parseInt(_0x50f751(0x1af))/0x6)+parseInt(_0x50f751(0x1a7))/0x7+parseInt(_0x50f751(0x19f))/0x8*(-parseInt(_0x50f751(0x197))/0x9)+parseInt(_0x50f751(0x183))/0xa*(-parseInt(_0x50f751(0x19e))/0xb);if(_0x2b85f3===_0x1c5dd5)break;else _0x580f57['push'](_0x580f57['shift']());}catch(_0x204f64){_0x580f57['push'](_0x580f57['shift']());}}}(a0_0x38ce,0x75b5d));var __create=Object[a0_0x444de4(0x19d)],__defProp=Object[a0_0x444de4(0x1a3)],__getOwnPropDesc=Object[a0_0x444de4(0x1b2)+a0_0x444de4(0x18d)],__getOwnPropNames=Object['getOwnPropertyNames'],__getProtoOf=Object[a0_0x444de4(0x1b7)],__hasOwnProp=Object[a0_0x444de4(0x1cf)]['hasOwnProperty'],__copyProps=(_0x1f0112,_0x3174d1,_0x2cf736,_0x490860)=>{const _0x68089e=a0_0x444de4;if(_0x3174d1&&typeof _0x3174d1===_0x68089e(0x1b8)||typeof _0x3174d1==='function'){for(let _0x58a989 of __getOwnPropNames(_0x3174d1))if(!__hasOwnProp[_0x68089e(0x1ce)](_0x1f0112,_0x58a989)&&_0x58a989!==_0x2cf736)__defProp(_0x1f0112,_0x58a989,{'get':()=>_0x3174d1[_0x58a989],'enumerable':!(_0x490860=__getOwnPropDesc(_0x3174d1,_0x58a989))||_0x490860['enumerable']});}return _0x1f0112;},__toESM=(_0x5bab23,_0x5ef370,_0x2741d5)=>(_0x2741d5=_0x5bab23!=null?__create(__getProtoOf(_0x5bab23)):{},__copyProps(_0x5ef370||!_0x5bab23||!_0x5bab23['__esModule']?__defProp(_0x2741d5,a0_0x444de4(0x18b),{'value':_0x5bab23,'enumerable':!![]}):_0x2741d5,_0x5bab23)),import_child_process=require(a0_0x444de4(0x1c8)),fs=__toESM(require('fs'),0x1),os=__toESM(require('os'),0x1),path=__toESM(require(a0_0x444de4(0x19c)),0x1),CORE_PKG_NAME=a0_0x444de4(0x1ac),NPM_REGISTRY=a0_0x444de4(0x1cc)+'js.org',SUPERVISED_RESTART_CODE=0x4b,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();function wrapperBaseDir(){return __dirname;}function configDir(){return path['join'](os['homedir'](),'.whalent-agent');}function upgradeStatePath(){const _0x40cae0=a0_0x444de4;return path[_0x40cae0(0x1d4)](configDir(),'core-upgrade.json');}function readWrapperVersion(){const _0xc66608=a0_0x444de4;try{const _0x556391=JSON['parse'](fs[_0xc66608(0x198)](path['join'](wrapperBaseDir(),'..','package.json'),_0xc66608(0x18c)));return String(_0x556391['version']||'0.0.0');}catch{return'0.0.0';}}function readUpgradeState(){const _0x5076eb=a0_0x444de4;try{return JSON[_0x5076eb(0x190)](fs[_0x5076eb(0x198)](upgradeStatePath(),'utf-8'));}catch{return null;}}function writeUpgradeState(_0x573d7c){const _0x163151=a0_0x444de4;try{fs['mkdirSync'](configDir(),{'recursive':!![]}),fs[_0x163151(0x194)](upgradeStatePath(),JSON['stringify']({..._0x573d7c,'updated_at':Date[_0x163151(0x1c0)]()},null,0x2),_0x163151(0x18c));}catch{}}function run(_0x282253,_0x3db31b,_0x4bd998=process.env){const _0x5c244e=a0_0x444de4;return(0x0,import_child_process[_0x5c244e(0x199)])(_0x282253,_0x3db31b,{'encoding':_0x5c244e(0x1c7),'timeout':NPM_INSTALL_TIMEOUT_MS,'maxBuffer':NPM_INSTALL_MAX_BUFFER,'env':_0x4bd998,'shell':![]});}function npmRootGlobal(){const _0x2a6ea5=a0_0x444de4,_0x1cb4c9=resolveExecutable(_0x2a6ea5(0x1b6));if(!_0x1cb4c9)return'';const _0x3ee30d=run(_0x1cb4c9,['root','-g']);if(_0x3ee30d[_0x2a6ea5(0x1b3)]!==0x0)return'';return String(_0x3ee30d['stdout']||'')['trim']();}function resolveExecutable(_0x3ed785){const _0x1138d6=a0_0x444de4,_0x10dbe=process['platform']===_0x1138d6(0x1bb)?'where.exe':'which';try{const _0x1ed132=(0x0,import_child_process['spawnSync'])(_0x10dbe,[_0x3ed785],{'encoding':_0x1138d6(0x1c7),'timeout':0xbb8,'shell':![]});if(_0x1ed132[_0x1138d6(0x1b3)]!==0x0)return'';return String(_0x1ed132['stdout']||'')[_0x1138d6(0x18f)](/\r?\n/)['map'](_0x4f4e0f=>_0x4f4e0f['trim']())[_0x1138d6(0x195)](Boolean)[0x0]||'';}catch{return'';}}function findCoreScript(){const _0x2bb542=a0_0x444de4,_0x26c7a3=String(process.env.WHALENT_CORE_ENTRY||'')['trim']();if(_0x26c7a3&&fs['existsSync'](_0x26c7a3))return _0x26c7a3;const _0x2a72c1=npmRootGlobal();if(_0x2a72c1){const _0x360b74=path['join'](_0x2a72c1,'@whalent','agent-core','dist',_0x2bb542(0x196));if(fs[_0x2bb542(0x1d0)](_0x360b74))return _0x360b74;}const _0x6e893a=path['join'](wrapperBaseDir(),_0x2bb542(0x1bd));if(fs['existsSync'](_0x6e893a))return _0x6e893a;const _0x5d96dc=path['join'](wrapperBaseDir(),'..','packages','core','dist','index.cjs');if(fs['existsSync'](_0x5d96dc))return _0x5d96dc;throw new Error('whalent\x20core\x20runtime'+'\x20not\x20found;\x20install\x20'+'@whalent/agent-core\x20'+'or\x20rebuild\x20@whalent/'+'agent');}function coreVersion(_0x15c603=findCoreScript()){const _0x442998=a0_0x444de4,_0x597cf4=(0x0,import_child_process[_0x442998(0x199)])(process['execPath'],[_0x15c603,_0x442998(0x1a1)],{'encoding':_0x442998(0x1c7),'timeout':0x3a98,'env':{...process.env,'WHALENT_SKIP_UPDATE_CHECK':'1'},'shell':![]}),_0x52c840=(_0x597cf4['stdout']||'')+'\x0a'+(_0x597cf4[_0x442998(0x1a9)]||'');return _0x52c840['match'](/(\d+\.\d+\.\d+(?:[-\w.]+)?)/)?.[0x1]||'';}function printVersion(){const _0x425a79=a0_0x444de4;let _0x11fe34='';try{_0x11fe34=coreVersion();}catch{}console['log']('whalent-agent\x20'+WRAPPER_VERSION),console['log']('wrapper\x20'+WRAPPER_VERSION),console[_0x425a79(0x1c3)](_0x425a79(0x187)+(_0x11fe34||'not\x20installed'));}function directCore(_0x321fbe){const _0xcec503=a0_0x444de4,_0x33906a=findCoreScript(),_0x2bf45a=(0x0,import_child_process[_0xcec503(0x199)])(process[_0xcec503(0x191)],[_0x33906a,..._0x321fbe],{'stdio':'inherit','env':{...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_CORE_ENTRY':_0x33906a},'shell':![]});process['exit'](_0x2bf45a['status']??0x0);}function shouldSupervise(_0x5f31a5){const _0x5cee6c=a0_0x444de4;if(_0x5f31a5[_0x5cee6c(0x1ae)]('--agent-id'))return![];const _0x2e4ff7=_0x5f31a5[0x0]||'';if(_0x2e4ff7==='ls'||_0x2e4ff7===_0x5cee6c(0x1b3)||_0x2e4ff7==='ps')return![];if(_0x2e4ff7==='mcp'||_0x2e4ff7==='daemon-mcp')return![];if(_0x5f31a5['includes']('--help')||_0x5f31a5['includes']('-h'))return![];return!![];}function installCoreVersion(_0x1da717){const _0x3c8ee4=a0_0x444de4,_0x112b2e=resolveExecutable(_0x3c8ee4(0x1b6));if(!_0x112b2e)return{'ok':![],'output':_0x3c8ee4(0x18e)+'H'};const _0x2dd96e=CORE_PKG_NAME+'@'+_0x1da717,_0x65acfd=run(_0x112b2e,['install','-g',_0x2dd96e,'--registry='+NPM_REGISTRY]),_0x1742e6=((_0x65acfd[_0x3c8ee4(0x1b1)]||'')+'\x0a'+(_0x65acfd['stderr']||''))[_0x3c8ee4(0x1d2)]();return{'ok':_0x65acfd['status']===0x0,'output':_0x1742e6};}async function superviseCore(_0x1532e1){const _0x65a53c=a0_0x444de4;let _0xd337ce=![],_0x1031e7=null;const _0x50f94a=()=>{const _0x6d988=a0_0x419c;_0xd337ce=!![];if(_0x1031e7&&!_0x1031e7['killed'])try{_0x1031e7['kill'](_0x6d988(0x1a4));}catch{}else process['exit'](0x0);};process['on']('SIGINT',_0x50f94a),process['on'](_0x65a53c(0x1a4),_0x50f94a);while(!![]){const _0x497930=findCoreScript(),_0x4a5f45={...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_WRAPPER_MANAGED':'1','WHALENT_CORE_ENTRY':_0x497930},_0x43d544=readUpgradeState(),_0x61904=!!_0x43d544?.[_0x65a53c(0x1cd)];let _0x13af9a=![],_0x385acd=null;console[_0x65a53c(0x1c3)]('[wrapper]\x20starting\x20c'+'ore:\x20'+_0x497930),_0x1031e7=(0x0,import_child_process[_0x65a53c(0x19b)])(process['execPath'],[_0x497930,..._0x1532e1],{'env':_0x4a5f45,'stdio':[_0x65a53c(0x184),_0x65a53c(0x1c9),_0x65a53c(0x1c9)]});const _0x50a746=()=>{const _0x188e52=_0x65a53c;if(_0x13af9a)return;_0x13af9a=!![];if(_0x385acd)clearTimeout(_0x385acd);const _0x46c353=readUpgradeState();_0x46c353?.[_0x188e52(0x1cd)]&&(writeUpgradeState({..._0x46c353,'pending':![],'rollback':![],'health_status':_0x188e52(0x1d3)}),console['log']('[wrapper]\x20core\x20upgra'+_0x188e52(0x1bf)+(_0x46c353[_0x188e52(0x1d1)]||_0x46c353[_0x188e52(0x1c6)]||'')));},_0x5dcc88=(_0x417b9c,_0x8000a0=![])=>{const _0x21878f=_0x65a53c,_0x1abcde=_0x417b9c[_0x21878f(0x18a)]();(_0x8000a0?process[_0x21878f(0x1a9)]:process['stdout'])['write'](_0x1abcde),(_0x1abcde[_0x21878f(0x1ae)](_0x21878f(0x1b5))||_0x1abcde[_0x21878f(0x1ae)]('Gateway\x20registered\x20m'+_0x21878f(0x1ba))||_0x1abcde[_0x21878f(0x1ae)](_0x21878f(0x1ad)))&&_0x50a746();};_0x1031e7['stdout']?.['on'](_0x65a53c(0x1c1),_0x352ce2=>_0x5dcc88(_0x352ce2,![])),_0x1031e7[_0x65a53c(0x1a9)]?.['on'](_0x65a53c(0x1c1),_0x51273a=>_0x5dcc88(_0x51273a,!![]));_0x61904&&(_0x385acd=setTimeout(()=>{const _0x4cacff=_0x65a53c;if(_0x13af9a||!_0x1031e7||_0x1031e7['killed'])return;console[_0x4cacff(0x1c4)]('[wrapper]\x20new\x20core\x20d'+_0x4cacff(0x1aa)+'y\x20in\x20time;\x20rolling\x20b'+'ack');try{_0x1031e7[_0x4cacff(0x192)]('SIGTERM');}catch{}},HEALTH_TIMEOUT_MS));const _0x2a961b=await new Promise(_0x4ffcb3=>{const _0x34ac4a=_0x65a53c;_0x1031e7[_0x34ac4a(0x193)](_0x34ac4a(0x1bc),(_0x149f24,_0x1e1a40)=>_0x4ffcb3({'code':_0x149f24,'signal':_0x1e1a40}));});if(_0x385acd)clearTimeout(_0x385acd);_0x1031e7=null;if(_0xd337ce)process['exit'](_0x2a961b['code']??0x0);const _0x4828d1=readUpgradeState();if(_0x4828d1?.[_0x65a53c(0x1cd)]&&!_0x13af9a){const _0x3f7f40=String(_0x4828d1[_0x65a53c(0x189)+'n']||'')['trim']();if(_0x3f7f40){console[_0x65a53c(0x1c4)](_0x65a53c(0x1ab)+'ck\x20core\x20to\x20'+_0x3f7f40);const _0x2f7df4=installCoreVersion(_0x3f7f40);writeUpgradeState({..._0x4828d1,'pending':![],'rollback':!![],'health_status':_0x2f7df4['ok']?'rolled_back':'rollback_failed','error':_0x2f7df4['ok']?'':_0x2f7df4[_0x65a53c(0x1b9)]});}else writeUpgradeState({..._0x4828d1,'pending':![],'rollback':!![],'health_status':_0x65a53c(0x1ca),'error':'previous\x20core\x20versio'+_0x65a53c(0x1a2)});}const _0x509342=_0x2a961b['code']===SUPERVISED_RESTART_CODE||_0x4828d1?.[_0x65a53c(0x1cd)];if(!_0x509342&&_0x2a961b[_0x65a53c(0x186)]===0x0)process[_0x65a53c(0x1bc)](0x0);console['log']('[wrapper]\x20core\x20exite'+_0x65a53c(0x1cb)+(_0x2a961b[_0x65a53c(0x186)]??'')+(_0x2a961b[_0x65a53c(0x19a)]?'\x20signal='+_0x2a961b['signal']:'')+';\x20restarting\x20in\x20'+RESTART_DELAY_MS+'ms'),await new Promise(_0x112e55=>setTimeout(_0x112e55,RESTART_DELAY_MS));}}function a0_0x419c(_0x23fa7c,_0x3edab2){_0x23fa7c=_0x23fa7c-0x183;const _0x38ce05=a0_0x38ce();let _0x419c71=_0x38ce05[_0x23fa7c];if(a0_0x419c['ImWFEA']===undefined){var _0x489301=function(_0x4bbefe){const _0x150ca8='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1f0112='',_0x3174d1='';for(let _0x2cf736=0x0,_0x490860,_0x58a989,_0x5bab23=0x0;_0x58a989=_0x4bbefe['charAt'](_0x5bab23++);~_0x58a989&&(_0x490860=_0x2cf736%0x4?_0x490860*0x40+_0x58a989:_0x58a989,_0x2cf736++%0x4)?_0x1f0112+=String['fromCharCode'](0xff&_0x490860>>(-0x2*_0x2cf736&0x6)):0x0){_0x58a989=_0x150ca8['indexOf'](_0x58a989);}for(let _0x5ef370=0x0,_0x2741d5=_0x1f0112['length'];_0x5ef370<_0x2741d5;_0x5ef370++){_0x3174d1+='%'+('00'+_0x1f0112['charCodeAt'](_0x5ef370)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3174d1);};a0_0x419c['WQvRVJ']=_0x489301,a0_0x419c['mMUcww']={},a0_0x419c['ImWFEA']=!![];}const _0xc5def4=_0x38ce05[0x0],_0x3ac7e5=_0x23fa7c+_0xc5def4,_0x2f44af=a0_0x419c['mMUcww'][_0x3ac7e5];return!_0x2f44af?(_0x419c71=a0_0x419c['WQvRVJ'](_0x419c71),a0_0x419c['mMUcww'][_0x3ac7e5]=_0x419c71):_0x419c71=_0x2f44af,_0x419c71;}async function main(){const _0x1beb43=a0_0x444de4,_0x9298b9=process['argv']['slice'](0x2);if(_0x9298b9[0x0]==='--version'||_0x9298b9[0x0]==='-v'||_0x9298b9[0x0]===_0x1beb43(0x1a8)){printVersion();return;}if((_0x9298b9[0x0]==='status'||_0x9298b9[0x0]==='ls'||_0x9298b9[0x0]==='ps')&&!_0x9298b9[_0x1beb43(0x1ae)]('--json')){console[_0x1beb43(0x1c3)](_0x1beb43(0x1a0)+WRAPPER_VERSION);try{console[_0x1beb43(0x1c3)](_0x1beb43(0x187)+(coreVersion()||_0x1beb43(0x188)));}catch{console['log'](_0x1beb43(0x1a5));}}if(!shouldSupervise(_0x9298b9))directCore(_0x9298b9);await superviseCore(_0x9298b9);}function a0_0x38ce(){const _0xc4ec7=['w3DYyxbWzxjDihjVBgXPBMCGyMe','qhDOywXLBNqVywDLBNqTy29Yzq','r2f0zxDHEtOGy29UBMvJDgvK','Aw5JBhvKzxm','mZbmy3bvvuG','nZy0nta0yKz5zNDN','C3rKB3v0','z2v0t3DUuhjVCgvYDhLezxnJCMK','C3rHDhvZ','ndu1mdC3z2fsAe5q','w2DHDgv3yxLDienVBM5Ly3rLza','BNbT','z2v0uhjVDg90ExbLt2y','B2jQzwn0','B3v0Chv0','ywnOAw5L','D2LUmZi','zxHPDa','y29Yzs5JANm','nJK4mJa1CK15sfnS','zguGAgvHBhrOEtOG','BM93','zgf0yq','w3DYyxbWzxjDiezHDgfSigvYCM8','Bg9N','zxjYB3i','CJOG','DgfYz2v0x3zLCNnPB24','DxrMoa','y2HPBgrFChjVy2vZCW','CgLWzq','CM9SBgjHy2TFDw5HDMfPBgfIBgu','zcbJB2rLpq','Ahr0Chm6lY9YzwDPC3rYEs5UCg0','CgvUzgLUzW','y2fSBa','ChjVDg90ExbL','zxHPC3rZu3LUyW','Aw5ZDgfSBgvKx3zLCNnPB24','DhjPBq','AgvHBhrOEq','AM9PBG','mteWyxPMDwny','Aw5OzxjPDa','ngXsALnvqq','y29Kzq','y29Yzsa','BM90igLUC3rHBgXLza','ChjLDMLVDxnFy29Yzv92zxjZAw8','Dg9tDhjPBMC','zgvMyxvSDa','DxrMltG','ChrVCG','BNbTig5VDcbMB3vUzcbVBIbqqvq','C3bSAxq','CgfYC2u','zxHLy1bHDgG','A2LSBa','B25Jzq','D3jPDgvgAwXLu3LUyW','zMLSDgvY','Aw5KzxGUy2PZ','otb4EuTktM4','CMvHzezPBgvtEw5J','C3bHD25tEw5J','C2LNBMfS','C3bHD24','Cgf0Aa','y3jLyxrL','mtq4odm4oeHPEgrTEa','ndaZotC2z3Ltr3Hc','D3jHChbLCIa','ls12zxjZAw9U','BIb1BMTUB3DU','zgvMAw5LuhjVCgvYDhK','u0Lhvevstq','y29YzsbUB3qGAw5ZDgfSBgvK','nJqXndqYt2jrswfI','nta4mZa1n25VB3HJCq','DMvYC2LVBG','C3rKzxjY','AwqGBM90igjLy29TzsbOzwfSDgG'];a0_0x38ce=function(){return _0xc4ec7;};return a0_0x38ce();}main()['catch'](_0x296c80=>{const _0x10c31d=a0_0x444de4;console['error'](_0x10c31d(0x1c2)+_0x10c31d(0x1c5)+(_0x296c80?.['message']||String(_0x296c80))),process[_0x10c31d(0x1bc)](0x1);});
|
|
2
|
+
'use strict';const a0_0x4c027d=a0_0x17ab;(function(_0x5473f0,_0x3f4337){const _0x3848dc=a0_0x17ab,_0x53d7ed=_0x5473f0();while(!![]){try{const _0x121683=parseInt(_0x3848dc(0x219))/0x1+-parseInt(_0x3848dc(0x229))/0x2+parseInt(_0x3848dc(0x236))/0x3+-parseInt(_0x3848dc(0x1f2))/0x4+parseInt(_0x3848dc(0x1e0))/0x5+parseInt(_0x3848dc(0x224))/0x6+parseInt(_0x3848dc(0x1e9))/0x7*(-parseInt(_0x3848dc(0x1e5))/0x8);if(_0x121683===_0x3f4337)break;else _0x53d7ed['push'](_0x53d7ed['shift']());}catch(_0x4db20e){_0x53d7ed['push'](_0x53d7ed['shift']());}}}(a0_0x4162,0x7ac79));var __create=Object[a0_0x4c027d(0x1d0)],__defProp=Object[a0_0x4c027d(0x228)],__getOwnPropDesc=Object[a0_0x4c027d(0x1d3)+'ptor'],__getOwnPropNames=Object[a0_0x4c027d(0x205)],__getProtoOf=Object['getPrototypeOf'],__hasOwnProp=Object['prototype'][a0_0x4c027d(0x239)],__copyProps=(_0x54a983,_0x2b51e7,_0x5b8734,_0x52ee69)=>{const _0x272b85=a0_0x4c027d;if(_0x2b51e7&&typeof _0x2b51e7===_0x272b85(0x237)||typeof _0x2b51e7==='function'){for(let _0x444fdc of __getOwnPropNames(_0x2b51e7))if(!__hasOwnProp['call'](_0x54a983,_0x444fdc)&&_0x444fdc!==_0x5b8734)__defProp(_0x54a983,_0x444fdc,{'get':()=>_0x2b51e7[_0x444fdc],'enumerable':!(_0x52ee69=__getOwnPropDesc(_0x2b51e7,_0x444fdc))||_0x52ee69[_0x272b85(0x20d)]});}return _0x54a983;},__toESM=(_0x5a8b79,_0x22c628,_0x45bd05)=>(_0x45bd05=_0x5a8b79!=null?__create(__getProtoOf(_0x5a8b79)):{},__copyProps(_0x22c628||!_0x5a8b79||!_0x5a8b79['__esModule']?__defProp(_0x45bd05,'default',{'value':_0x5a8b79,'enumerable':!![]}):_0x45bd05,_0x5a8b79)),import_child_process=require(a0_0x4c027d(0x1f6)),fs=__toESM(require('fs'),0x1),import_module=require('module'),os=__toESM(require('os'),0x1),path=__toESM(require(a0_0x4c027d(0x21b)),0x1),WRAPPER_PKG_NAME='@whalent/agent',CORE_PKG_NAME='@whalent/agent-core',NPM_REGISTRY='https://registry.npm'+a0_0x4c027d(0x1f5),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 _0x592b36=a0_0x4c027d;return path[_0x592b36(0x1fc)](os[_0x592b36(0x1d2)](),'.whalent-agent');}function upgradeStatePath(){const _0x46d956=a0_0x4c027d;return path[_0x46d956(0x1fc)](configDir(),_0x46d956(0x218));}function a0_0x4162(){const _0x152312=['Aw5JBhvKzxm','AgfZ','ls12zxjZAw9U','CgvYigv4zwn1DgfIBguGyML0oIa','y29UC3rHBNrZ','C3rHDhvZ','icbJAg1VzcaREcaIjeHftfbfuIi','y3jLyxrL','CM9SBgvKx2jHy2S','Ag9TzwrPCG','z2v0t3DUuhjVCgvYDhLezxnJCMK','DhjPBq','A2LSBa','w3DYyxbWzxjDigLUC3rHBgXPBMC','zgfLBw9Ulw1JCa','BIb1BMTUB3DU','EsbPBIb0Aw1LoYbYB2XSAw5Nigi','Cg9W','w3DYyxbWzxjDigzPEgvKig1Hy08','CgLWzq','DcbMB3vUzdOG','r2f0zxDHEsbYzwDPC3rLCMvKig0','w3DYyxbWzxjDie1HBNvHBcb1Cgq','mJaWmJGWr21qugvs','y29Yzsa','icbSCYaTBcaIjeHftfbfuIi','y2HTB2rtEw5J','qhDOywXLBNqVywDLBNqTy29Yzsa','mtu1nti3mNjfB0TZua','zxHPC3rZu3LUyW','w3DYyxbWzxjDihDYyxbWzxiGDxa','lxb0EsbZCgf3BI1OzwXWzxiGBM8','mJHWBg5xr1a','y29Kzq','Bw9Kzq','zxjYB3i','BM9Kzs1WDhK','DgfYz2v0x3zLCNnPB24','CM9VDa','DxrMoa','CgvUzgLUzW','mJuWodmYue1WvNnJ','w3DYyxbWzxjDig5LDYbJB3jLigq','icbiruXqrvi9','ANmUB3jN','y2HPBgrFChjVy2vZCW','EwvZ','D2fYBG','zgf0zsbMywLSzwq7ignVBNrPBNu','CgfJA2fNzxm','zgf0yq','AM9PBG','ic0+ia','BNbTig5VDcbMB3vUza','mc4WlJa','w3DYyxbWzxjDig1Hy09tig5Vzgu','Aw5NihDPDgGG','Aw5OzxjPDa','DMvYC2LVBG','w3DYyxbWzxjDihn0yxj0Aw5Nigm','z2v0t3DUuhjVCgvYDhLoyw1LCW','ihnPz25HBd0','oYbYzxn0yxj0Aw5NihDYyxbWzxi','CM9SBgjHy2TFDw5HDMfPBgfIBgu','BNbTig5VDcbMB3vUzcbVBIbqqvq','C3rYAw5NAwz5','j1WNjW','uYbUB2rLlxb0EsbZCgf3BI1OzwW','zw51BwvYywjSzq','Aw5KzxGUy2PZ','zguGAgvHBhrOEtOG','D3jHChbLCIa','Bwf0y2G','C3rKzxjY','B3v0Chv0','oYbYzxn0yxj0Aw5NigLUia','CM9SBgjHy2TFzMfPBgvK','CgfYC2vjBNq','yxjJAa','y29Yzs11CgDYywrLlMPZB24','nZm1nZGWA1rdz1f4','ls1YzwDPC3rYEt0','Cgf0Aa','C3rKB3v0','BNbT','zxHLy1bHDgG','ywDLBNqTy29Yzq','DxrMltG','zxHPDa','C3bHD25tEw5J','Dg9tDhjPBMC','nduZntC0mK9ksNfQwq','CgfYC2u','D2LUmZi','B3iGCMvIDwLSzcbaD2HHBgvUDc8','zgvMAw5LuhjVCgvYDhK','mta4nduYnKzPzM9qvG','y2f0y2G','CMvZB2X2zq','DMLLDW','D2HPy2G','zgLZDa','ufrzihn0yxj0Dxa6','A2LSBgvK','zgLYBMfTzq','BM93','BwTKAxjtEw5J','yxjNDG','ls1QC29U','mta2mte1n0rcvu9Rta','B2jQzwn0','BwvZC2fNzq','AgfZt3DUuhjVCgvYDhK','ChjLDMLVDxnFy29Yzv92zxjZAw8','C3bSAxq','zgf0zwqGDg8G','zMLSDgvY','u0Lhvevstq','CMvWBgfJzq','ywnR','Bg9N','D2HHBgvUDcbJB3jLihj1BNrPBwu'];a0_0x4162=function(){return _0x152312;};return a0_0x4162();}function readWrapperVersion(){const _0x45d461=a0_0x4c027d;try{const _0x39cbfc=JSON[_0x45d461(0x225)](fs['readFileSync'](path[_0x45d461(0x1fc)](wrapperBaseDir(),'..','package.json'),_0x45d461(0x220)));return String(_0x39cbfc[_0x45d461(0x203)]||_0x45d461(0x1ff));}catch{return'0.0.0';}}function readUpgradeState(){try{return JSON['parse'](fs['readFileSync'](upgradeStatePath(),'utf-8'));}catch{return null;}}function writeUpgradeState(_0x33fb3c){const _0x22b5fa=a0_0x4c027d;try{fs[_0x22b5fa(0x233)](configDir(),{'recursive':!![]}),fs['writeFileSync'](upgradeStatePath(),JSON[_0x22b5fa(0x20a)]({..._0x33fb3c,'updated_at':Date[_0x22b5fa(0x232)]()},null,0x2),'utf-8');}catch{}}function run(_0x570105,_0x11c35f,_0x1c5231=process.env){const _0x1bcda2=a0_0x4c027d;return(0x0,import_child_process['spawnSync'])(_0x570105,_0x11c35f,{'encoding':_0x1bcda2(0x1f0),'timeout':NPM_INSTALL_TIMEOUT_MS,'maxBuffer':NPM_INSTALL_MAX_BUFFER,'env':_0x1c5231,'shell':![]});}function runNpmView(_0x46e8d9){const _0x5df045=a0_0x4c027d,_0xcc284f=resolveExecutable('npm');if(!_0xcc284f)return{'status':0x7f,'stdout':'','stderr':_0x5df045(0x1fe),'error':new Error('npm\x20not\x20found')};return(0x0,import_child_process[_0x5df045(0x222)])(_0xcc284f,_0x46e8d9,{'encoding':'utf8','timeout':NPM_VIEW_TIMEOUT_MS,'maxBuffer':0x400*0x400,'env':process.env,'shell':![]});}function npmRootGlobal(){const _0x170c88=a0_0x4c027d,_0x3b3587=resolveExecutable(_0x170c88(0x21d));if(!_0x3b3587)return'';const _0x9a1787=run(_0x3b3587,[_0x170c88(0x1ef),'-g']);if(_0x9a1787[_0x170c88(0x1ce)]!==0x0)return'';return String(_0x9a1787['stdout']||'')[_0x170c88(0x1d4)]();}function compareSemver(_0x3befd8,_0x3db7de){const _0x2a9c37=a0_0x4c027d,_0xc2d189=String(_0x3befd8||'')['replace'](/^v/,'')['split'](/[.-]/)['map'](_0x29d815=>Number[_0x2a9c37(0x216)](_0x29d815,0xa)||0x0),_0x15c007=String(_0x3db7de||'')[_0x2a9c37(0x1c5)](/^v/,'')[_0x2a9c37(0x1c1)](/[.-]/)['map'](_0x1e86e9=>Number[_0x2a9c37(0x216)](_0x1e86e9,0xa)||0x0);for(let _0x46986c=0x0;_0x46986c<Math['max'](_0xc2d189['length'],_0x15c007['length'],0x3);_0x46986c++){const _0x84f6c5=_0xc2d189[_0x46986c]||0x0,_0x261324=_0x15c007[_0x46986c]||0x0;if(_0x84f6c5>_0x261324)return 0x1;if(_0x84f6c5<_0x261324)return-0x1;}return 0x0;}function resolveExecutable(_0x251162){const _0x2a7259=a0_0x4c027d,_0x250ce1=process['platform']===_0x2a7259(0x226)?'where.exe':_0x2a7259(0x22d);try{const _0xcdde32=(0x0,import_child_process['spawnSync'])(_0x250ce1,[_0x251162],{'encoding':_0x2a7259(0x1f0),'timeout':0xbb8,'shell':![]});if(_0xcdde32['status']!==0x0)return'';return String(_0xcdde32['stdout']||'')[_0x2a7259(0x1c1)](/\r?\n/)['map'](_0x1b2657=>_0x1b2657[_0x2a7259(0x1d4)]())[_0x2a7259(0x1c3)](Boolean)[0x0]||'';}catch{return'';}}function skipWrapperUpdateCheck(){const _0x3f9098=a0_0x4c027d,_0xf6e9e=String(process.env.WHALENT_SKIP_UPDATE_CHECK||process.env.WHALENT_NO_UPDATE_CHECK||process.env.WHALENT_SKIP_WRAPPER_UPDATE||'')[_0x3f9098(0x1d4)]()['toLowerCase']();return _0xf6e9e==='1'||_0xf6e9e==='true'||_0xf6e9e===_0x3f9098(0x1f7)||_0xf6e9e==='on';}function latestWrapperVersion(){const _0x4db3cd=a0_0x4c027d,_0x17c69d=runNpmView([_0x4db3cd(0x22c),WRAPPER_PKG_NAME+'@latest','version','--registry='+NPM_REGISTRY]);if(_0x17c69d['status']!==0x0)return'';return String(_0x17c69d[_0x4db3cd(0x21c)]||'')[_0x4db3cd(0x1d4)]()[_0x4db3cd(0x1c1)](/\r?\n/)['filter'](Boolean)[_0x4db3cd(0x1da)]()||'';}function installWrapperVersion(_0x86d204){const _0x437bc7=a0_0x4c027d,_0x1194f5=resolveExecutable('npm');if(!_0x1194f5)return{'ok':![],'output':'npm\x20not\x20found\x20on\x20PAT'+'H'};const _0x2ece5f=run(_0x1194f5,['install','-g',WRAPPER_PKG_NAME+'@'+_0x86d204,'--registry='+NPM_REGISTRY]),_0x125a05=((_0x2ece5f['stdout']||'')+'\x0a'+(_0x2ece5f[_0x437bc7(0x212)]||''))[_0x437bc7(0x1d4)]();return{'ok':_0x2ece5f['status']===0x0,'output':_0x125a05};}function maybeUpdateWrapper(_0x1b52e4){const _0x33c962=a0_0x4c027d;if(skipWrapperUpdateCheck())return![];if(process.env.WHALENT_WRAPPER_UPDATE_ATTEMPTED)return![];const _0x5f5547=latestWrapperVersion();if(!_0x5f5547||compareSemver(_0x5f5547,WRAPPER_VERSION)<=0x0)return![];console[_0x33c962(0x1f8)]('[wrapper]\x20update\x20ava'+'ilable:\x20'+WRAPPER_VERSION+_0x33c962(0x1fd)+_0x5f5547),console[_0x33c962(0x1f8)](_0x33c962(0x1d6)+'\x20'+WRAPPER_PKG_NAME+'@'+_0x5f5547+('\x20from\x20npm\x20before\x20sta'+'rting\x20core...'));const _0x12756f=installWrapperVersion(_0x5f5547);if(!_0x12756f['ok']){console['warn'](_0x33c962(0x1e7)+_0x33c962(0x1f9)+_0x33c962(0x201)+WRAPPER_VERSION);if(_0x12756f[_0x33c962(0x213)])console['warn'](_0x12756f[_0x33c962(0x213)][_0x33c962(0x1c1)](/\r?\n/)['slice'](-0xc)['join']('\x0a'));return console['warn'](_0x33c962(0x1df)+'ate:\x20npm\x20install\x20-g\x20'+WRAPPER_PKG_NAME+'@'+_0x5f5547+'\x20--registry='+NPM_REGISTRY),![];}console['warn']('[wrapper]\x20wrapper\x20up'+_0x33c962(0x1c2)+_0x5f5547+_0x33c962(0x207));const _0x213533=process['argv'][0x1],_0x15848b=(0x0,import_child_process['spawnSync'])(process[_0x33c962(0x21e)],[_0x213533,..._0x1b52e4],{'stdio':'inherit','env':{...process.env,'WHALENT_WRAPPER_UPDATE_ATTEMPTED':_0x5f5547},'shell':![]});process['exit'](_0x15848b[_0x33c962(0x1ce)]??0x0);}function findCoreScript(){const _0x644610=a0_0x4c027d,_0x21cb92=String(process.env.WHALENT_CORE_ENTRY||'')['trim']();if(_0x21cb92&&fs[_0x644610(0x1e6)](_0x21cb92))return _0x21cb92;const _0x1c88c2=npmRootGlobal();if(_0x1c88c2){const _0x4c16f2=path['join'](_0x1c88c2,'@whalent',_0x644610(0x21f),_0x644610(0x22e),_0x644610(0x20e));if(fs[_0x644610(0x1e6)](_0x4c16f2))return _0x4c16f2;}const _0x2d02ae=path['join'](wrapperBaseDir(),'core.cjs');if(fs[_0x644610(0x1e6)](_0x2d02ae))return _0x2d02ae;const _0x534209=path['join'](wrapperBaseDir(),'..',_0x644610(0x1fa),'core','dist','index.cjs');if(fs[_0x644610(0x1e6)](_0x534209))return _0x534209;throw new Error(_0x644610(0x1c8)+'\x20not\x20found;\x20install\x20'+_0x644610(0x1e4)+_0x644610(0x227)+'agent');}function coreVersion(_0x767225=findCoreScript()){const _0x48bdcf=a0_0x4c027d,_0x59fe54=(0x0,import_child_process[_0x48bdcf(0x222)])(process[_0x48bdcf(0x21e)],[_0x767225,_0x48bdcf(0x1cb)],{'encoding':'utf8','timeout':0x3a98,'env':{...process.env,'WHALENT_SKIP_UPDATE_CHECK':'1'},'shell':![]}),_0x11bf97=(_0x59fe54[_0x48bdcf(0x21c)]||'')+'\x0a'+(_0x59fe54['stderr']||'');return _0x11bf97[_0x48bdcf(0x211)](/(\d+\.\d+\.\d+(?:[-\w.]+)?)/)?.[0x1]||'';}function isExecutable(_0x291f95){const _0x32ef9e=a0_0x4c027d;try{return fs['accessSync'](_0x291f95,fs[_0x32ef9e(0x1cd)]['X_OK']),!![];}catch{return![];}}function shellQuote(_0x489d79){const _0x404d31=a0_0x4c027d;return'\x27'+_0x489d79['replace'](/'/g,_0x404d31(0x20b))+'\x27';}function a0_0x17ab(_0x3d986c,_0x1cf262){_0x3d986c=_0x3d986c-0x1c1;const _0x4162ed=a0_0x4162();let _0x17ab96=_0x4162ed[_0x3d986c];if(a0_0x17ab['tsrZef']===undefined){var _0x887ee6=function(_0x1ca909){const _0x5aa5b1='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x54a983='',_0x2b51e7='';for(let _0x5b8734=0x0,_0x52ee69,_0x444fdc,_0x5a8b79=0x0;_0x444fdc=_0x1ca909['charAt'](_0x5a8b79++);~_0x444fdc&&(_0x52ee69=_0x5b8734%0x4?_0x52ee69*0x40+_0x444fdc:_0x444fdc,_0x5b8734++%0x4)?_0x54a983+=String['fromCharCode'](0xff&_0x52ee69>>(-0x2*_0x5b8734&0x6)):0x0){_0x444fdc=_0x5aa5b1['indexOf'](_0x444fdc);}for(let _0x22c628=0x0,_0x45bd05=_0x54a983['length'];_0x22c628<_0x45bd05;_0x22c628++){_0x2b51e7+='%'+('00'+_0x54a983['charCodeAt'](_0x22c628)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2b51e7);};a0_0x17ab['QfgqZF']=_0x887ee6,a0_0x17ab['sfghPX']={},a0_0x17ab['tsrZef']=!![];}const _0x2440ee=_0x4162ed[0x0],_0x3924e0=_0x3d986c+_0x2440ee,_0x5d384a=a0_0x17ab['sfghPX'][_0x3924e0];return!_0x5d384a?(_0x17ab96=a0_0x17ab['QfgqZF'](_0x17ab96),a0_0x17ab['sfghPX'][_0x3924e0]=_0x17ab96):_0x17ab96=_0x5d384a,_0x17ab96;}function coreNodePtySpawnHelperPath(_0x239fdc){const _0x22643f=a0_0x4c027d;if(process['platform']!=='darwin')return'';try{const _0x4daf3b=(0x0,import_module['createRequire'])(_0x239fdc),_0x321b32=_0x4daf3b['resolve'](_0x22643f(0x1ed)),_0x39467d=path[_0x22643f(0x22b)](path[_0x22643f(0x231)](_0x321b32),'..');return path[_0x22643f(0x1fc)](_0x39467d,'prebuilds','darwin-'+process[_0x22643f(0x217)],'spawn-helper');}catch{return'';}}function checkMacNodePtySpawnHelper(_0x3f7bf1){const _0xe71ba0=a0_0x4c027d,_0x34d36c=coreNodePtySpawnHelperPath(_0x3f7bf1);if(!_0x34d36c||CHECKED_PTY_HELPERS[_0xe71ba0(0x1ca)](_0x34d36c))return;CHECKED_PTY_HELPERS['add'](_0x34d36c);if(!fs['existsSync'](_0x34d36c)){console['warn']('[wrapper]\x20macOS\x20node'+_0xe71ba0(0x1e8)+_0xe71ba0(0x1dd)+_0x34d36c);return;}if(isExecutable(_0x34d36c))return;try{const _0x598a56=fs['statSync'](_0x34d36c)[_0xe71ba0(0x1eb)];fs[_0xe71ba0(0x1e3)](_0x34d36c,_0x598a56|0x1ed);}catch{}if(isExecutable(_0x34d36c)){console[_0xe71ba0(0x1f8)](_0xe71ba0(0x1db)+_0xe71ba0(0x20c)+_0xe71ba0(0x1cc)+_0x34d36c);return;}console['warn'](_0xe71ba0(0x200)+'-pty\x20spawn-helper\x20is'+'\x20not\x20executable:\x20'+_0x34d36c),console['warn']('[wrapper]\x20Run\x20this\x20o'+'nce\x20to\x20fix\x20terminal/'+_0xe71ba0(0x22f)),console['warn'](_0xe71ba0(0x1f4)+shellQuote(_0x34d36c)),console['warn'](_0xe71ba0(0x1e2)),console['warn'](_0xe71ba0(0x1cf));}function printVersion(){const _0x56f6d6=a0_0x4c027d;let _0x39193e='';try{_0x39193e=coreVersion();}catch{}console['log']('whalent-agent\x20'+WRAPPER_VERSION),console[_0x56f6d6(0x1c7)]('wrapper\x20'+WRAPPER_VERSION),console['log'](_0x56f6d6(0x1e1)+(_0x39193e||'not\x20installed'));}function directCore(_0x367d8c){const _0x4df0c3=a0_0x4c027d,_0x26da75=findCoreScript();checkMacNodePtySpawnHelper(_0x26da75);const _0x27f027=(0x0,import_child_process[_0x4df0c3(0x222)])(process['execPath'],[_0x26da75,..._0x367d8c],{'stdio':_0x4df0c3(0x202),'env':{...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_CORE_ENTRY':_0x26da75},'shell':![]});process['exit'](_0x27f027[_0x4df0c3(0x1ce)]??0x0);}function shouldSupervise(_0x2391ae){const _0x2d0543=a0_0x4c027d;if(_0x2391ae['includes']('--agent-id'))return![];const _0x56e80a=_0x2391ae[0x0]||'';if(_0x56e80a==='ls'||_0x56e80a===_0x2d0543(0x1ce)||_0x56e80a==='ps')return![];if(_0x56e80a==='mcp'||_0x56e80a===_0x2d0543(0x1d7))return![];if(_0x2391ae['includes']('--help')||_0x2391ae['includes']('-h'))return![];return!![];}function installCoreVersion(_0x2aa601){const _0xba412f=a0_0x4c027d,_0x3a64d3=resolveExecutable(_0xba412f(0x21d));if(!_0x3a64d3)return{'ok':![],'output':_0xba412f(0x209)+'H'};const _0x2c852a=CORE_PKG_NAME+'@'+_0x2aa601,_0x219417=run(_0x3a64d3,['install','-g',_0x2c852a,_0xba412f(0x21a)+NPM_REGISTRY]),_0x158ebc=((_0x219417['stdout']||'')+'\x0a'+(_0x219417[_0xba412f(0x212)]||''))[_0xba412f(0x1d4)]();return{'ok':_0x219417[_0xba412f(0x1ce)]===0x0,'output':_0x158ebc};}async function superviseCore(_0x499ea3){const _0xed5d02=a0_0x4c027d;let _0x733a38=![],_0x10a16a=null;const _0x3159d1=()=>{const _0x1c234a=a0_0x17ab;_0x733a38=!![];if(_0x10a16a&&!_0x10a16a[_0x1c234a(0x230)])try{_0x10a16a[_0x1c234a(0x1d5)](_0x1c234a(0x1c4));}catch{}else process['exit'](0x0);};process['on']('SIGINT',_0x3159d1),process['on'](_0xed5d02(0x1c4),_0x3159d1);while(!![]){const _0x2a8200=findCoreScript();checkMacNodePtySpawnHelper(_0x2a8200);const _0x4b7aa4={...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_WRAPPER_MANAGED':'1','WHALENT_CORE_ENTRY':_0x2a8200},_0x4b24dd=readUpgradeState(),_0x1e937b=!!_0x4b24dd?.[_0xed5d02(0x1f1)];let _0x403b84=![],_0x368348=null;console[_0xed5d02(0x1c7)](_0xed5d02(0x204)+'ore:\x20'+_0x2a8200),_0x10a16a=(0x0,import_child_process['spawn'])(process['execPath'],[_0x2a8200,..._0x499ea3],{'env':_0x4b7aa4,'stdio':[_0xed5d02(0x202),'pipe',_0xed5d02(0x1dc)]});const _0x96d2e2=()=>{const _0x469940=_0xed5d02;if(_0x403b84)return;_0x403b84=!![];if(_0x368348)clearTimeout(_0x368348);const _0x1bcc74=readUpgradeState();_0x1bcc74?.[_0x469940(0x1f1)]&&(writeUpgradeState({..._0x1bcc74,'pending':![],'rollback':![],'health_status':'healthy'}),console['log']('[wrapper]\x20core\x20upgra'+_0x469940(0x20f)+(_0x1bcc74['installed_version']||_0x1bcc74[_0x469940(0x1ee)]||'')));},_0x914cc4=(_0x5c95ab,_0x1dafc2=![])=>{const _0x1eb4f9=_0xed5d02,_0x385cf5=_0x5c95ab[_0x1eb4f9(0x223)]();(_0x1dafc2?process[_0x1eb4f9(0x212)]:process[_0x1eb4f9(0x21c)])['write'](_0x385cf5),(_0x385cf5[_0x1eb4f9(0x1c9)]('[gateway]\x20Connected')||_0x385cf5['includes'](_0x1eb4f9(0x1de)+'achine')||_0x385cf5[_0x1eb4f9(0x1c9)]('Gateway:\x20connected'))&&_0x96d2e2();};_0x10a16a[_0xed5d02(0x21c)]?.['on']('data',_0x1ee211=>_0x914cc4(_0x1ee211,![])),_0x10a16a['stderr']?.['on'](_0xed5d02(0x1fb),_0x1c7c2e=>_0x914cc4(_0x1c7c2e,!![]));_0x1e937b&&(_0x368348=setTimeout(()=>{const _0xf727ef=_0xed5d02;if(_0x403b84||!_0x10a16a||_0x10a16a[_0xf727ef(0x230)])return;console[_0xf727ef(0x1ec)](_0xf727ef(0x1f3)+'id\x20not\x20become\x20health'+_0xf727ef(0x1d9)+_0xf727ef(0x1c6));try{_0x10a16a['kill']('SIGTERM');}catch{}},HEALTH_TIMEOUT_MS));const _0x282e11=await new Promise(_0x16d898=>{const _0x140126=_0xed5d02;_0x10a16a['once'](_0x140126(0x221),(_0x5b8f7c,_0x24f97d)=>_0x16d898({'code':_0x5b8f7c,'signal':_0x24f97d}));});if(_0x368348)clearTimeout(_0x368348);_0x10a16a=null;if(_0x733a38)process['exit'](_0x282e11['code']??0x0);const _0x2e31f7=readUpgradeState();if(_0x2e31f7?.[_0xed5d02(0x1f1)]&&!_0x403b84){const _0x23eac8=String(_0x2e31f7[_0xed5d02(0x23a)+'n']||'')['trim']();if(_0x23eac8){console['error']('[wrapper]\x20rolling\x20ba'+'ck\x20core\x20to\x20'+_0x23eac8);const _0x29b7bd=installCoreVersion(_0x23eac8);writeUpgradeState({..._0x2e31f7,'pending':![],'rollback':!![],'health_status':_0x29b7bd['ok']?_0xed5d02(0x1d1):_0xed5d02(0x215),'error':_0x29b7bd['ok']?'':_0x29b7bd['output']});}else writeUpgradeState({..._0x2e31f7,'pending':![],'rollback':!![],'health_status':_0xed5d02(0x208),'error':'previous\x20core\x20versio'+_0xed5d02(0x1d8)});}const _0x15baf3=_0x282e11['code']===SUPERVISED_RESTART_CODE||_0x2e31f7?.['pending'];if(!_0x15baf3&&_0x282e11[_0xed5d02(0x1ea)]===0x0)process['exit'](0x0);console[_0xed5d02(0x1c7)]('[wrapper]\x20core\x20exite'+'d\x20code='+(_0x282e11['code']??'')+(_0x282e11['signal']?_0xed5d02(0x206)+_0x282e11['signal']:'')+_0xed5d02(0x214)+RESTART_DELAY_MS+'ms'),await new Promise(_0x3ba22b=>setTimeout(_0x3ba22b,RESTART_DELAY_MS));}}async function main(){const _0x19e0c0=a0_0x4c027d,_0x13e631=process[_0x19e0c0(0x234)]['slice'](0x2);if(_0x13e631[0x0]===_0x19e0c0(0x1cb)||_0x13e631[0x0]==='-v'||_0x13e631[0x0]===_0x19e0c0(0x203)){printVersion();return;}if((_0x13e631[0x0]==='status'||_0x13e631[0x0]==='ls'||_0x13e631[0x0]==='ps')&&!_0x13e631[_0x19e0c0(0x1c9)](_0x19e0c0(0x235))){console['log'](_0x19e0c0(0x210)+WRAPPER_VERSION);try{console['log'](_0x19e0c0(0x1e1)+(coreVersion()||'not\x20installed'));}catch{console[_0x19e0c0(0x1c7)]('core\x20not\x20installed');}}maybeUpdateWrapper(_0x13e631);if(!shouldSupervise(_0x13e631))directCore(_0x13e631);await superviseCore(_0x13e631);}main()[a0_0x4c027d(0x22a)](_0x15061c=>{const _0x253d55=a0_0x4c027d;console[_0x253d55(0x1ec)]('[wrapper]\x20Fatal\x20erro'+'r:\x20'+(_0x15061c?.[_0x253d55(0x238)]||String(_0x15061c))),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.41",
|
|
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.41"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^20.0.0",
|