@whalent/agent 0.3.94 → 0.3.95

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/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';const a0_0x5141f2=a0_0x41c2;(function(_0x29a8eb,_0x1ebfd1){const _0x1fee5b=a0_0x41c2,_0x466faf=_0x29a8eb();while(!![]){try{const _0x45bd7e=-parseInt(_0x1fee5b(0x253))/0x1+parseInt(_0x1fee5b(0x1ed))/0x2*(parseInt(_0x1fee5b(0x1fc))/0x3)+-parseInt(_0x1fee5b(0x244))/0x4+parseInt(_0x1fee5b(0x1d6))/0x5+parseInt(_0x1fee5b(0x21f))/0x6*(-parseInt(_0x1fee5b(0x202))/0x7)+parseInt(_0x1fee5b(0x232))/0x8*(parseInt(_0x1fee5b(0x1cb))/0x9)+-parseInt(_0x1fee5b(0x1ea))/0xa;if(_0x45bd7e===_0x1ebfd1)break;else _0x466faf['push'](_0x466faf['shift']());}catch(_0x156067){_0x466faf['push'](_0x466faf['shift']());}}}(a0_0x4480,0x5269e));var __create=Object[a0_0x5141f2(0x245)],__defProp=Object[a0_0x5141f2(0x20c)],__getOwnPropDesc=Object[a0_0x5141f2(0x20f)+a0_0x5141f2(0x1db)],__getOwnPropNames=Object[a0_0x5141f2(0x1dc)],__getProtoOf=Object[a0_0x5141f2(0x24c)],__hasOwnProp=Object['prototype']['hasOwnProperty'],__copyProps=(_0x7a2112,_0x1db379,_0x15df90,_0x2db4dc)=>{const _0x5c2fab=a0_0x5141f2;if(_0x1db379&&typeof _0x1db379===_0x5c2fab(0x1da)||typeof _0x1db379===_0x5c2fab(0x25b)){for(let _0x3ab7eb of __getOwnPropNames(_0x1db379))if(!__hasOwnProp['call'](_0x7a2112,_0x3ab7eb)&&_0x3ab7eb!==_0x15df90)__defProp(_0x7a2112,_0x3ab7eb,{'get':()=>_0x1db379[_0x3ab7eb],'enumerable':!(_0x2db4dc=__getOwnPropDesc(_0x1db379,_0x3ab7eb))||_0x2db4dc['enumerable']});}return _0x7a2112;},__toESM=(_0x55b0de,_0x158804,_0x2d1024)=>(_0x2d1024=_0x55b0de!=null?__create(__getProtoOf(_0x55b0de)):{},__copyProps(_0x158804||!_0x55b0de||!_0x55b0de[a0_0x5141f2(0x1df)]?__defProp(_0x2d1024,'default',{'value':_0x55b0de,'enumerable':!![]}):_0x2d1024,_0x55b0de)),import_child_process=require(a0_0x5141f2(0x1c8)),fs=__toESM(require('fs'),0x1),import_module=require('module'),os=__toESM(require('os'),0x1),path=__toESM(require(a0_0x5141f2(0x224)),0x1),WRAPPER_PKG_NAME='@whalent/agent',CORE_PKG_NAME='@whalent/agent-core',NPM_REGISTRY=a0_0x5141f2(0x1ec)+'js.org',SUPERVISED_RESTART_CODE=0x4b,NPM_VIEW_TIMEOUT_MS=0x3a98,HEALTH_TIMEOUT_MS=0xafc8,MIN_RESTART_DELAY_MS=0x3e8,MAX_RESTART_DELAY_MS=0xea60,MAX_CRASHES_IN_WINDOW=0x3,CRASH_WINDOW_MS=0x3*0x3c*0x3e8,NPM_INSTALL_TIMEOUT_MS=0xa*0x3c*0x3e8,NPM_INSTALL_MAX_BUFFER=0x20*0x400*0x400,FATAL_PATTERN=/\[(?:agent|daemon|wrapper)\][^\n]*\bFatal error:[^\n]+|\[daemon\] Failed to start:[^\n]+|Error:[^\n]+/,WRAPPER_VERSION=readWrapperVersion(),CHECKED_PTY_HELPERS=new Set(),CHECKED_NODE_PTY_RUNTIMES=new Set();function wrapperBaseDir(){return __dirname;}function configDir(){const _0x1d13cb=a0_0x5141f2;return path['join'](os[_0x1d13cb(0x227)](),'.whalent-agent');}function upgradeStatePath(){return path['join'](configDir(),'core-upgrade.json');}function lastCrashFilePath(){const _0x18ec86=a0_0x5141f2;return path[_0x18ec86(0x1ff)](configDir(),'last-crash.json');}function writeLastCrash(_0x465ac7){const _0x1a1906=a0_0x5141f2;try{fs[_0x1a1906(0x230)](configDir(),{'recursive':!![]});const _0x435faa={..._0x465ac7,'reported':![]};fs['writeFileSync'](lastCrashFilePath(),JSON[_0x1a1906(0x217)](_0x435faa,null,0x2),_0x1a1906(0x24e));}catch{}}function readWrapperVersion(){const _0x33dbc5=a0_0x5141f2;try{const _0x2df68d=JSON['parse'](fs[_0x33dbc5(0x258)](path[_0x33dbc5(0x1ff)](wrapperBaseDir(),'..',_0x33dbc5(0x1c9)),'utf-8'));return String(_0x2df68d[_0x33dbc5(0x22e)]||_0x33dbc5(0x243));}catch{return'0.0.0';}}function readUpgradeState(){try{return JSON['parse'](fs['readFileSync'](upgradeStatePath(),'utf-8'));}catch{return null;}}function a0_0x4480(){const _0x21b56d=['nti4yw5HDujp','igLUia','zguGAgvHBhrOEtOG','CM9SBgjHy2TFDw5HDMfPBgfIBgu','BwLU','DgfYDa','ls1Hz2vUDc1Pza','AgvHBhrOEq','w3DYyxbWzxjDihjLC3rHCNrPBMC','CgLWzq','zxjSEwLUzYbPC3n1zsbPCYbMAxG','w3DYyxbWzxjDignVCMuGDxbNCMe','BM90igLUC3rHBgXLza','CgvYigv4zwn1DgfIBguGyML0oIa','w3DYyxbWzxjDihn0yxj0Aw5Nigm','CZSGz2L2Aw5NihvWlIbdCMfZAca','BNbT','mc4WlJa','ntqWntq4s1vfChj0','y3jLyxrL','Dw5KoYbJyw5UB3qGCMvIDwLSzca','u0Lhsu5u','r2f0zxDHEsbYzwDPC3rLCMvKig0','Bg9N','BMfTzq','ywDLBNq','z2v0uhjVDg90ExbLt2y','y3jLyxrLuMvXDwLYzq','DxrMltG','CM91BMq','w3DYyxbWzxjDigLUC3rHBgXPBMC','u0Lhvevstq','yNvPBgq','mJqYowvnwMjKyq','D2HLCMuUzxHL','ls1OzwXW','BgvUz3rO','C3rHDhvZ','CMvHzezPBgvtEw5J','A2LSBa','yxjJAa','zNvUy3rPB24','CMvWBgfJzq','yxjNDG','BMnLihrVigzPEcb0zxjTAw5HBc8','D3jPDgvgAwXLu3LUyW','D2HPy2G','EsbPBIb0Aw1LoYbYB2XSAw5Nigi','yxrPDMuGBw9KDwXLigLZig1PC3m','y2f0y2G','Chr5lM5Vzgu','y2HPBgrFChjVy2vZCW','CgfJA2fNzs5QC29U','Aw5KzxGUy2PZ','ndCWnJfAuKfJt1C','C3rKB3v0','zgf0yq','C2LNBMfS','CM9SBgvKx2jHy2S','zxjYB3i','y29Yzq','lIbszxn0yxj0ihDYyxbWzxiGBwe','w3DYyxbWzxjDig5WBsbUB3qGzM8','Bwf4','C2XPy2u','mtGZmZm3nxD5zvfItW','lxb0EsbZCgf3BI1OzwXWzxiGAxm','w3DYyxbWzxjDigzPEgvKig1Hy08','zxHPC3rZu3LUyW','B2jQzwn0','ChrVCG','z2v0t3DUuhjVCgvYDhLoyw1LCW','CgfJA2fNzxm','ig5VDcbMB3vUzdSGAw5ZDgfSBca','x19LC01VzhvSzq','DhjPBq','zxHPDa','C3bHD25tEw5J','AwXHyMXLoIa','zgfYD2LUlq','CM9SBgjHy2TFzMfPBgvK','y29Yzsa','Dg9mB3DLCKnHC2u','ChjLDMLVDxmGy29Yzsb2zxjZAw8','Aw5OzxjPDa','mJiXmtq0mgXKDwX1tW','A2LSBgvK','Ahr0Chm6lY9YzwDPC3rYEs5UCg0','mKzlqKvyEa','y29Yzs5JANm','w3DYyxbWzxjDigXHC3qGzMf0ywW','BM9Kzs1WDhK','zxbLBMrLBMn5ig5VDcbYzxnVBhy','D2LUmZi','zgLYBMfTzq','D2fYBG','B3v0Chv0','ic0+ia','CMvHBhbHDgHtEw5J','ls12zxjZAw9U','CNrPBMCGy29Yzs4UlG','C3rKzxjY','w3DYyxbWzxjDignVCMuGzxHPDgu','mtu4otGYmhbRDurksG','Dhj1zq','ig5VDcbLEgvJDxrHyMXLoIa','AM9PBG','BwfW','w3DYyxbWzxjDig1Hy09tig5Vzgu','mtyZmwnxqvDruW','icbJAg1VzcaREcaIjeHftfbfuIi','y2SGy29Yzsb0BYa','zgfLBw9Ulw1JCa','CgfYC2vjBNq','B3jLoIa','w3DYyxbWzxjDig5VzguTChr5igq','w3DYyxbWzxjDig5VzguTChr5ihi','ihrPBwvZihDPDgHPBIa','CgvUzgLUzW','zgvMAw5LuhjVCgvYDhK','ChjLDMLVDxnFy29Yzv92zxjZAw8','CMvZB2X2zq','z2v0t3DUuhjVCgvYDhLezxnJCMK','ywrK','D3jHChbLCIa','ihnPz25HBd0','CgXHDgzVCM0','Aw5JBhvKzxm','Cg9W','y29UC3rHBNrZ','C3rYAw5NAwz5','BwvZC2fNzq','r2f0zxDHEtOGy29UBMvJDgvK','ywnR','DxrMoa','AgfZ','lxb0EsbZCgf3BI1OzwXWzxiGBM8','w3DYyxbWzxjDihDYyxbWzxiGDxa','mtqWndz3zxD0z0i','w3DYyxbWzxjDignVCMuGzMfPBgu','ChvZAa','y29YzsbUB3qGAw5ZDgfSBgvK','oYbJB3jLig1HEsbMywLSihrVihm','Cgf0Aa','zgf0zwqGDg8G','w3DYyxbWzxjDifj1BIb0AgLZig8','Ag9TzwrPCG','Aw5NihvUzgvYia','y29Kzq','zMLSDgvY','C29Tzq','igLUigXHC3qG','C3bSAxq','DMvYC2LVBG','C2HPzNq','BwTKAxjtEw5J','zgLZDa'];a0_0x4480=function(){return _0x21b56d;};return a0_0x4480();}function writeUpgradeState(_0x162209){const _0x4e30e8=a0_0x5141f2;try{fs[_0x4e30e8(0x230)](configDir(),{'recursive':!![]}),fs[_0x4e30e8(0x1c2)](upgradeStatePath(),JSON['stringify']({..._0x162209,'updated_at':Date['now']()},null,0x2),_0x4e30e8(0x24e));}catch{}}function run(_0x5b7780,_0x39fa19,_0x3b0352=process.env){const _0xfda870=a0_0x5141f2;return(0x0,import_child_process[_0xfda870(0x1e2)])(_0x5b7780,_0x39fa19,{'encoding':'utf8','timeout':NPM_INSTALL_TIMEOUT_MS,'maxBuffer':NPM_INSTALL_MAX_BUFFER,'env':_0x3b0352,'shell':![]});}function runNpmView(_0x2a1520){const _0x237415=resolveExecutable('npm');if(!_0x237415)return{'status':0x7f,'stdout':'','stderr':'npm\x20not\x20found','error':new Error('npm\x20not\x20found')};return(0x0,import_child_process['spawnSync'])(_0x237415,_0x2a1520,{'encoding':'utf8','timeout':NPM_VIEW_TIMEOUT_MS,'maxBuffer':0x400*0x400,'env':process.env,'shell':![]});}function npmRootGlobal(){const _0x4adaac=a0_0x5141f2,_0x26c852=resolveExecutable(_0x4adaac(0x242));if(!_0x26c852)return'';const _0x185050=run(_0x26c852,['root','-g']);if(_0x185050['status']!==0x0)return'';return String(_0x185050[_0x4adaac(0x1cc)]||'')[_0x4adaac(0x1e0)]();}function compareSemver(_0x13d4bc,_0x207e48){const _0x458f51=a0_0x5141f2,_0x2b7859=String(_0x13d4bc||'')[_0x458f51(0x25c)](/^v/,'')['split'](/[.-]/)['map'](_0x4387dc=>Number['parseInt'](_0x4387dc,0xa)||0x0),_0x313eb7=String(_0x207e48||'')['replace'](/^v/,'')[_0x458f51(0x22d)](/[.-]/)['map'](_0x26891b=>Number[_0x458f51(0x206)](_0x26891b,0xa)||0x0);for(let _0x5ad5c6=0x0;_0x5ad5c6<Math[_0x458f51(0x1d4)](_0x2b7859[_0x458f51(0x256)],_0x313eb7['length'],0x3);_0x5ad5c6++){const _0x59ebd7=_0x2b7859[_0x5ad5c6]||0x0,_0x596774=_0x313eb7[_0x5ad5c6]||0x0;if(_0x59ebd7>_0x596774)return 0x1;if(_0x59ebd7<_0x596774)return-0x1;}return 0x0;}function resolveExecutable(_0x2c8799){const _0x21096e=a0_0x5141f2,_0x4649cb=process[_0x21096e(0x213)]==='win32'?_0x21096e(0x254):_0x21096e(0x1c3);try{const _0x3465db=(0x0,import_child_process['spawnSync'])(_0x4649cb,[_0x2c8799],{'encoding':'utf8','timeout':0xbb8,'shell':![]});if(_0x3465db['status']!==0x0)return'';return String(_0x3465db['stdout']||'')[_0x21096e(0x22d)](/\r?\n/)[_0x21096e(0x200)](_0x271c1d=>_0x271c1d[_0x21096e(0x1e0)]())[_0x21096e(0x22a)](Boolean)[0x0]||'';}catch{return'';}}function skipWrapperUpdateCheck(){const _0x54164c=a0_0x5141f2,_0x3d0a27=String(process.env.WHALENT_SKIP_UPDATE_CHECK||process.env.WHALENT_NO_UPDATE_CHECK||process.env.WHALENT_SKIP_WRAPPER_UPDATE||'')['trim']()[_0x54164c(0x1e7)]();return _0x3d0a27==='1'||_0x3d0a27===_0x54164c(0x1fd)||_0x3d0a27==='yes'||_0x3d0a27==='on';}function latestWrapperVersion(){const _0x3a2282=a0_0x5141f2,_0x3d0f20=runNpmView(['view',WRAPPER_PKG_NAME+'@latest',_0x3a2282(0x22e),'--registry='+NPM_REGISTRY]);if(_0x3d0f20[_0x3a2282(0x257)]!==0x0)return'';return String(_0x3d0f20['stdout']||'')['trim']()[_0x3a2282(0x22d)](/\r?\n/)['filter'](Boolean)[_0x3a2282(0x215)]()||'';}function installWrapperVersion(_0x57c2b6){const _0x804b2b=a0_0x5141f2,_0x18005e=resolveExecutable(_0x804b2b(0x242));if(!_0x18005e)return{'ok':![],'output':'npm\x20not\x20found\x20on\x20PAT'+'H'};const _0x1c1159=run(_0x18005e,['install','-g',WRAPPER_PKG_NAME+'@'+_0x57c2b6,'--registry='+NPM_REGISTRY]),_0x5ceb6d=((_0x1c1159['stdout']||'')+'\x0a'+(_0x1c1159[_0x804b2b(0x1fa)]||''))[_0x804b2b(0x1e0)]();return{'ok':_0x1c1159['status']===0x0,'output':_0x5ceb6d};}function maybeUpdateWrapper(_0x13e828){const _0x356380=a0_0x5141f2;if(skipWrapperUpdateCheck())return![];if(process.env.WHALENT_WRAPPER_UPDATE_ATTEMPTED)return![];const _0x119724=latestWrapperVersion();if(!_0x119724||compareSemver(_0x119724,WRAPPER_VERSION)<=0x0)return![];console[_0x356380(0x1f4)]('[wrapper]\x20update\x20ava'+_0x356380(0x1e3)+WRAPPER_VERSION+_0x356380(0x1f6)+_0x119724),console['warn'](_0x356380(0x250)+'\x20'+WRAPPER_PKG_NAME+'@'+_0x119724+('\x20from\x20npm\x20before\x20sta'+_0x356380(0x1f9)));const _0x5ab6b7=installWrapperVersion(_0x119724);if(!_0x5ab6b7['ok']){console['warn'](_0x356380(0x21e)+'date\x20failed;\x20continu'+'ing\x20with\x20'+WRAPPER_VERSION);if(_0x5ab6b7[_0x356380(0x1f5)])console['warn'](_0x5ab6b7[_0x356380(0x1f5)]['split'](/\r?\n/)[_0x356380(0x1d5)](-0xc)[_0x356380(0x1ff)]('\x0a'));return console['warn']('[wrapper]\x20Manual\x20upd'+'ate:\x20npm\x20install\x20-g\x20'+WRAPPER_PKG_NAME+'@'+_0x119724+'\x20--registry='+NPM_REGISTRY),![];}console[_0x356380(0x1f4)](_0x356380(0x21e)+_0x356380(0x225)+_0x119724+';\x20restarting\x20wrapper');const _0x36f1a9=process[_0x356380(0x25d)][0x1],_0x171520=(0x0,import_child_process['spawnSync'])(process['execPath'],[_0x36f1a9,..._0x13e828],{'stdio':'inherit','env':{...process.env,'WHALENT_WRAPPER_UPDATE_ATTEMPTED':_0x119724},'shell':![]});process['exit'](_0x171520[_0x356380(0x257)]??0x0);}function findCoreScript(){const _0x185352=a0_0x5141f2,_0x32956a=String(process.env.WHALENT_CORE_ENTRY||'')['trim'](),_0xeb549c=['1','true','yes','on']['includes'](String(process.env.WHALENT_FORCE_CORE_ENTRY||'')['trim']()[_0x185352(0x1e7)]());if(_0x32956a&&_0xeb549c&&fs[_0x185352(0x1d9)](_0x32956a))return _0x32956a;const _0x191776=[],_0x3bd165=_0x2736a8=>{if(fs['existsSync'](_0x2736a8)&&!_0x191776['includes'](_0x2736a8))_0x191776['push'](_0x2736a8);};if(_0x32956a)_0x3bd165(_0x32956a);const _0x593691=npmRootGlobal();if(_0x593691){const _0x4dd0ea=path[_0x185352(0x1ff)](_0x593691,'@whalent','agent-core','dist','index.cjs');_0x3bd165(_0x4dd0ea);}const _0x24ded1=path['join'](wrapperBaseDir(),_0x185352(0x1ee));_0x3bd165(_0x24ded1);const _0x2d9237=path['join'](wrapperBaseDir(),'..',_0x185352(0x1dd),_0x185352(0x1d1),_0x185352(0x231),_0x185352(0x1ca));_0x3bd165(_0x2d9237);if(_0x191776['length']>0x0)return _0x191776['map']((_0x1de545,_0x35b7ff)=>({'candidate':_0x1de545,'index':_0x35b7ff,'version':coreVersion(_0x1de545)}))['sort']((_0x11efe1,_0x5720d5)=>{const _0x4a6329=_0x185352,_0x168045=compareSemver(_0x5720d5[_0x4a6329(0x22e)],_0x11efe1[_0x4a6329(0x22e)]);if(_0x168045!==0x0)return _0x168045;return _0x5720d5['index']-_0x11efe1['index'];})[0x0]['candidate'];throw new Error('whalent\x20core\x20runtime'+_0x185352(0x1de)+'@whalent/agent-core\x20'+'or\x20rebuild\x20@whalent/'+_0x185352(0x24b));}function coreVersion(_0x5d1857=findCoreScript()){const _0x2c707c=a0_0x5141f2;ensureNodePtyNativeModule(_0x5d1857);const _0x52c9e9=(0x0,import_child_process['spawnSync'])(process['execPath'],[_0x5d1857,_0x2c707c(0x1f8)],{'encoding':_0x2c707c(0x21b),'timeout':0x3a98,'env':{...process.env,'WHALENT_SKIP_UPDATE_CHECK':'1'},'shell':![]}),_0x10c88d=(_0x52c9e9['stdout']||'')+'\x0a'+(_0x52c9e9[_0x2c707c(0x1fa)]||'');return _0x10c88d['match'](/(\d+\.\d+\.\d+(?:[-\w.]+)?)/)?.[0x1]||'';}function isExecutable(_0x12782e){const _0x16550c=a0_0x5141f2;try{return fs['accessSync'](_0x12782e,fs[_0x16550c(0x216)]['X_OK']),!![];}catch{return![];}}function shellQuote(_0x1a9697){return'\x27'+_0x1a9697['replace'](/'/g,'\x27\x5c\x27\x27')+'\x27';}function corePackageRoot(_0x1b6cfa){const _0x274153=a0_0x5141f2;return path[_0x274153(0x20e)](path['dirname'](_0x1b6cfa),'..');}function nodePtyPackageRoot(_0x4f853f){const _0x3ed9f1=a0_0x5141f2,_0x5d3902=(0x0,import_module[_0x3ed9f1(0x24d)])(_0x4f853f),_0x2fa6ad=_0x5d3902[_0x3ed9f1(0x20e)]('node-pty');let _0x551430=path['dirname'](_0x2fa6ad);for(let _0x2afee2=0x0;_0x2afee2<0x5;_0x2afee2++){const _0x571f48=path[_0x3ed9f1(0x1ff)](_0x551430,'package.json');try{const _0x2010f3=JSON['parse'](fs[_0x3ed9f1(0x258)](_0x571f48,'utf-8'));if(_0x2010f3[_0x3ed9f1(0x24a)]==='node-pty')return _0x551430;}catch{}const _0x486b4d=path[_0x3ed9f1(0x1f3)](_0x551430);if(_0x486b4d===_0x551430)break;_0x551430=_0x486b4d;}return path['resolve'](path[_0x3ed9f1(0x1f3)](_0x2fa6ad),'..');}function nodePtyNativeCandidates(_0x3c2822){const _0x14bca6=a0_0x5141f2;return[path['join'](_0x3c2822,_0x14bca6(0x252),'Release','pty.node'),path[_0x14bca6(0x1ff)](_0x3c2822,'prebuilds',process['platform']+'-'+process[_0x14bca6(0x25a)],_0x14bca6(0x1c7))];}function hasNodePtyNativeModule(_0x2d7069){const _0x2c0aff=a0_0x5141f2;return nodePtyNativeCandidates(_0x2d7069)[_0x2c0aff(0x22b)](_0x56be39=>fs['existsSync'](_0x56be39));}function printNodePtyRebuildHint(_0x2c1fbe){const _0x48d651=a0_0x5141f2,_0x3f6c35=corePackageRoot(_0x2c1fbe);console['warn']('[wrapper]\x20Manual\x20fix'+':'),console[_0x48d651(0x1f4)]('\x20\x20cd\x20'+shellQuote(_0x3f6c35)),console[_0x48d651(0x1f4)]('\x20\x20npm\x20rebuild\x20node-p'+'ty\x20--verbose');}function ensureNodePtyNativeModule(_0xf0827d){const _0x5e4a60=a0_0x5141f2;if(process[_0x5e4a60(0x213)]===_0x5e4a60(0x1f2))return;let _0x32429e='';try{_0x32429e=nodePtyPackageRoot(_0xf0827d);}catch(_0x581cd3){console[_0x5e4a60(0x1f4)](_0x5e4a60(0x208)+_0x5e4a60(0x1f1)+'able\x20for\x20core:\x20'+_0x581cd3[_0x5e4a60(0x218)]),printNodePtyRebuildHint(_0xf0827d);return;}const _0x6351ad=((()=>{const _0x66a8b2=_0x5e4a60;try{return fs[_0x66a8b2(0x1f7)](_0x32429e);}catch{return _0x32429e;}})());if(CHECKED_NODE_PTY_RUNTIMES['has'](_0x6351ad))return;CHECKED_NODE_PTY_RUNTIMES[_0x5e4a60(0x210)](_0x6351ad);if(hasNodePtyNativeModule(_0x32429e))return;const _0x39c0b6=resolveExecutable(_0x5e4a60(0x242));console['warn']('[wrapper]\x20node-pty\x20n'+_0x5e4a60(0x1c5)+_0x5e4a60(0x228)+_0x32429e),console['warn']('[wrapper]\x20rebuilding'+'\x20node-pty\x20before\x20sta'+'rting\x20core...');if(!_0x39c0b6){console['warn'](_0x5e4a60(0x1d3)+_0x5e4a60(0x246)+'node-pty\x20automatical'+'ly'),printNodePtyRebuildHint(_0xf0827d);return;}const _0x259a35=corePackageRoot(_0xf0827d),_0x379ccc=(0x0,import_child_process[_0x5e4a60(0x1e2)])(_0x39c0b6,['rebuild',_0x5e4a60(0x1f0),'--verbose'],{'cwd':_0x259a35,'stdio':'inherit','timeout':NPM_INSTALL_TIMEOUT_MS,'env':process.env,'shell':![]});if(_0x379ccc[_0x5e4a60(0x257)]===0x0&&hasNodePtyNativeModule(_0x32429e)){console[_0x5e4a60(0x1f4)](_0x5e4a60(0x209)+'ebuild\x20completed');return;}console['warn'](_0x5e4a60(0x209)+'ebuild\x20failed'+(_0x379ccc[_0x5e4a60(0x257)]!==null?'\x20(exit='+_0x379ccc['status']+')':'')+(_0x5e4a60(0x223)+_0x5e4a60(0x237))),printNodePtyRebuildHint(_0xf0827d);}function coreNodePtySpawnHelperPath(_0x59d2fb){const _0x27ae82=a0_0x5141f2;if(process[_0x27ae82(0x213)]!=='darwin')return'';try{const _0x3afbc3=(0x0,import_module[_0x27ae82(0x24d)])(_0x59d2fb),_0x3aaa1e=_0x3afbc3['resolve']('node-pty'),_0xceeafa=path[_0x27ae82(0x20e)](path['dirname'](_0x3aaa1e),'..');return path['join'](_0xceeafa,'prebuilds',_0x27ae82(0x1e4)+process[_0x27ae82(0x25a)],'spawn-helper');}catch{return'';}}function checkMacNodePtySpawnHelper(_0x7604){const _0x332611=a0_0x5141f2,_0x2acd60=coreNodePtySpawnHelperPath(_0x7604);if(!_0x2acd60||CHECKED_PTY_HELPERS[_0x332611(0x21c)](_0x2acd60))return;CHECKED_PTY_HELPERS['add'](_0x2acd60);if(!fs[_0x332611(0x1d9)](_0x2acd60)){console['warn'](_0x332611(0x201)+_0x332611(0x21d)+'t\x20found:\x20'+_0x2acd60);return;}if(isExecutable(_0x2acd60))return;try{const _0x2b91c2=fs['statSync'](_0x2acd60)['mode'];fs['chmodSync'](_0x2acd60,_0x2b91c2|0x1ed);}catch{}if(isExecutable(_0x2acd60)){console[_0x332611(0x1f4)](_0x332611(0x1d8)+'S\x20node-pty\x20spawn-hel'+_0x332611(0x23f)+_0x2acd60);return;}console[_0x332611(0x1f4)](_0x332611(0x201)+_0x332611(0x1d7)+_0x332611(0x1fe)+_0x2acd60),console[_0x332611(0x1f4)](_0x332611(0x226)+_0x332611(0x25e)+'PTY\x20startup:'),console[_0x332611(0x1f4)]('\x20\x20HELPER='+shellQuote(_0x2acd60)),console[_0x332611(0x1f4)]('\x20\x20ls\x20-l\x20\x22$HELPER\x22'),console['warn'](_0x332611(0x203));}function printVersion(){const _0x45c1f5=a0_0x5141f2;let _0x268a93='';try{_0x268a93=coreVersion();}catch{}console['log']('whalent-agent\x20'+WRAPPER_VERSION),console[_0x45c1f5(0x249)](_0x45c1f5(0x211)+WRAPPER_VERSION),console['log']('core\x20'+(_0x268a93||_0x45c1f5(0x23e)));}function directCore(_0x5d8981){const _0x43362a=a0_0x5141f2,_0x47d45d=findCoreScript();ensureNodePtyNativeModule(_0x47d45d),checkMacNodePtySpawnHelper(_0x47d45d);const _0x2f0ef7=(0x0,import_child_process[_0x43362a(0x1e2)])(process['execPath'],[_0x47d45d,..._0x5d8981],{'stdio':_0x43362a(0x1e9),'env':{...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_CORE_ENTRY':_0x47d45d},'shell':![]});process['exit'](_0x2f0ef7[_0x43362a(0x257)]??0x0);}function shouldSupervise(_0x2d4c66){const _0x46ebf8=a0_0x5141f2;if(_0x2d4c66['includes'](_0x46ebf8(0x238)))return![];if(_0x2d4c66['includes']('--resume')||_0x2d4c66[0x0]==='resume')return![];const _0x49f9c1=_0x2d4c66[0x0]||'';if(_0x49f9c1==='ls'||_0x49f9c1==='status'||_0x49f9c1==='ps')return![];if(_0x49f9c1==='mcp'||_0x49f9c1===_0x46ebf8(0x205))return![];if(_0x2d4c66['includes'](_0x46ebf8(0x255))||_0x2d4c66[_0x46ebf8(0x214)]('-h'))return![];return!![];}function installCoreVersion(_0x3b4f20){const _0x32e567=a0_0x5141f2,_0xb113c3=resolveExecutable('npm');if(!_0xb113c3)return{'ok':![],'output':'npm\x20not\x20found\x20on\x20PAT'+'H'};const _0x3e6a93=CORE_PKG_NAME+'@'+_0x3b4f20,_0x22d6ff=run(_0xb113c3,['install','-g',_0x3e6a93,'--registry='+NPM_REGISTRY]),_0xd86eef=((_0x22d6ff['stdout']||'')+'\x0a'+(_0x22d6ff[_0x32e567(0x1fa)]||''))['trim']();return{'ok':_0x22d6ff[_0x32e567(0x257)]===0x0,'output':_0xd86eef};}function a0_0x41c2(_0x449b6a,_0xe17be2){_0x449b6a=_0x449b6a-0x1c2;const _0x4480df=a0_0x4480();let _0x41c2d3=_0x4480df[_0x449b6a];if(a0_0x41c2['jgYKyU']===undefined){var _0x37d5b6=function(_0x58ec4e){const _0x1cde3b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x7a2112='',_0x1db379='';for(let _0x15df90=0x0,_0x2db4dc,_0x3ab7eb,_0x55b0de=0x0;_0x3ab7eb=_0x58ec4e['charAt'](_0x55b0de++);~_0x3ab7eb&&(_0x2db4dc=_0x15df90%0x4?_0x2db4dc*0x40+_0x3ab7eb:_0x3ab7eb,_0x15df90++%0x4)?_0x7a2112+=String['fromCharCode'](0xff&_0x2db4dc>>(-0x2*_0x15df90&0x6)):0x0){_0x3ab7eb=_0x1cde3b['indexOf'](_0x3ab7eb);}for(let _0x158804=0x0,_0x2d1024=_0x7a2112['length'];_0x158804<_0x2d1024;_0x158804++){_0x1db379+='%'+('00'+_0x7a2112['charCodeAt'](_0x158804)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1db379);};a0_0x41c2['mRUuBv']=_0x37d5b6,a0_0x41c2['cqCQiV']={},a0_0x41c2['jgYKyU']=!![];}const _0x55212e=_0x4480df[0x0],_0x4ee048=_0x449b6a+_0x55212e,_0x2b6e6e=a0_0x41c2['cqCQiV'][_0x4ee048];return!_0x2b6e6e?(_0x41c2d3=a0_0x41c2['mRUuBv'](_0x41c2d3),a0_0x41c2['cqCQiV'][_0x4ee048]=_0x41c2d3):_0x41c2d3=_0x2b6e6e,_0x41c2d3;}async function superviseCore(_0x53c6fa){const _0x268794=a0_0x5141f2;let _0x271aa6=![],_0x19134b=null;const _0x26e11b=[];let _0xdcc511=MIN_RESTART_DELAY_MS;const _0x15a15b=()=>{const _0xa05513=a0_0x41c2;_0x271aa6=!![];if(_0x19134b&&!_0x19134b['killed'])try{_0x19134b[_0xa05513(0x259)](_0xa05513(0x251));}catch{}else process[_0xa05513(0x1e1)](0x0);};process['on'](_0x268794(0x247),_0x15a15b),process['on']('SIGTERM',_0x15a15b);while(!![]){const _0xafe8d=findCoreScript();ensureNodePtyNativeModule(_0xafe8d),checkMacNodePtySpawnHelper(_0xafe8d);const _0x5d3d73={...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_WRAPPER_MANAGED':'1','WHALENT_CORE_ENTRY':_0xafe8d},_0x17a949=readUpgradeState(),_0x2d5c4f=!!_0x17a949?.[_0x268794(0x20b)];let _0x18ee92=![],_0x59e693=null,_0x5adf83='';const _0x33344f=[],_0x3745f9=0xc;console[_0x268794(0x249)](_0x268794(0x240)+_0x268794(0x207)+_0xafe8d),_0x19134b=(0x0,import_child_process['spawn'])(process['execPath'],[_0xafe8d,..._0x53c6fa],{'env':_0x5d3d73,'stdio':['inherit',_0x268794(0x23b),_0x268794(0x23b)]});const _0x1da1c2=()=>{const _0x4e1fe6=_0x268794;if(_0x18ee92)return;_0x18ee92=!![];if(_0x59e693)clearTimeout(_0x59e693);_0x26e11b['length']=0x0,_0xdcc511=MIN_RESTART_DELAY_MS;const _0x1554ea=readUpgradeState();_0x1554ea?.['pending']&&(writeUpgradeState({..._0x1554ea,'pending':![],'rollback':![],'health_status':_0x4e1fe6(0x239)}),console['log'](_0x4e1fe6(0x23d)+_0x4e1fe6(0x234)+(_0x1554ea['installed_version']||_0x1554ea['target_version']||'')));},_0x1b234e=(_0x588898,_0x1ff551=![])=>{const _0x138e24=_0x268794,_0x532b98=_0x588898['toString']();(_0x1ff551?process['stderr']:process[_0x138e24(0x1cc)])['write'](_0x532b98);if(_0x1ff551)for(const _0x10570d of _0x532b98[_0x138e24(0x22d)](/\r?\n/)){if(!_0x10570d['trim']())continue;_0x33344f['push'](_0x10570d);if(_0x33344f['length']>_0x3745f9)_0x33344f[_0x138e24(0x22f)]();const _0x496ffe=_0x10570d['match'](FATAL_PATTERN);if(_0x496ffe)_0x5adf83=_0x496ffe[0x0];}(_0x532b98[_0x138e24(0x214)]('[gateway]\x20Connected')||_0x532b98[_0x138e24(0x214)](_0x138e24(0x248)+'achine')||_0x532b98['includes'](_0x138e24(0x219)))&&_0x1da1c2();};_0x19134b[_0x268794(0x1cc)]?.['on']('data',_0x562b7f=>_0x1b234e(_0x562b7f,![])),_0x19134b[_0x268794(0x1fa)]?.['on'](_0x268794(0x1cd),_0xc3403f=>_0x1b234e(_0xc3403f,!![]));_0x2d5c4f&&(_0x59e693=setTimeout(()=>{const _0x1cdcc0=_0x268794;if(_0x18ee92||!_0x19134b||_0x19134b[_0x1cdcc0(0x1eb)])return;console['error']('[wrapper]\x20new\x20core\x20d'+'id\x20not\x20become\x20health'+_0x1cdcc0(0x1c4)+_0x1cdcc0(0x21a));try{_0x19134b[_0x1cdcc0(0x259)](_0x1cdcc0(0x251));}catch{}},HEALTH_TIMEOUT_MS));const _0x588314=await new Promise(_0x1cc324=>{const _0x415b11=_0x268794;_0x19134b['once'](_0x415b11(0x1e1),(_0x1db52a,_0x1c4e67)=>_0x1cc324({'code':_0x1db52a,'signal':_0x1c4e67}));});if(_0x59e693)clearTimeout(_0x59e693);_0x19134b=null;if(_0x271aa6)process['exit'](_0x588314[_0x268794(0x229)]??0x0);const _0x4c076b=readUpgradeState();if(_0x4c076b?.['pending']&&!_0x18ee92){const _0x4a3b80=String(_0x4c076b[_0x268794(0x20d)+'n']||'')[_0x268794(0x1e0)]();if(_0x4a3b80){console['error']('[wrapper]\x20rolling\x20ba'+_0x268794(0x204)+_0x4a3b80);const _0x129f4d=installCoreVersion(_0x4a3b80);writeUpgradeState({..._0x4c076b,'pending':![],'rollback':!![],'health_status':_0x129f4d['ok']?_0x268794(0x1cf):_0x268794(0x1e5),'error':_0x129f4d['ok']?'':_0x129f4d[_0x268794(0x1f5)]});}else writeUpgradeState({..._0x4c076b,'pending':![],'rollback':!![],'health_status':_0x268794(0x235),'error':_0x268794(0x1e8)+'n\x20unknown'});}const _0x392804=_0x588314['code']===SUPERVISED_RESTART_CODE||_0x4c076b?.['pending'];if(!_0x392804&&_0x588314[_0x268794(0x229)]===0x0)process['exit'](0x0);const _0x24dd9f=Date['now']();_0x26e11b[_0x268794(0x221)](_0x24dd9f);while(_0x26e11b['length']>0x0&&_0x24dd9f-_0x26e11b[0x0]>CRASH_WINDOW_MS){_0x26e11b[_0x268794(0x22f)]();}const _0x450dbd=_0x26e11b['length'];writeLastCrash({'timestamp':_0x24dd9f,'exit_code':_0x588314['code'],'exit_signal':_0x588314['signal']||null,'fatal_line':_0x5adf83,'raw_tail':_0x33344f[_0x268794(0x1ff)]('\x0a'),'consecutive_crashes':_0x450dbd}),console[_0x268794(0x249)](_0x268794(0x1fb)+'d\x20code='+(_0x588314[_0x268794(0x229)]??'')+(_0x588314[_0x268794(0x1ce)]?_0x268794(0x212)+_0x588314['signal']:'')+'\x20('+_0x450dbd+'/'+MAX_CRASHES_IN_WINDOW+_0x268794(0x22c)+Math['round'](CRASH_WINDOW_MS/0x3e8)+'s)');if(_0x5adf83)console[_0x268794(0x249)](_0x268794(0x1ef)+':\x20'+_0x5adf83);_0x450dbd>=MAX_CRASHES_IN_WINDOW&&(console[_0x268794(0x1d0)](_0x268794(0x220)+'d\x20'+_0x450dbd+_0x268794(0x20a)+Math[_0x268794(0x24f)](CRASH_WINDOW_MS/0x3e8)+(_0x268794(0x241)+'record:\x20')+lastCrashFilePath()+(_0x268794(0x1d2)+'nually\x20after\x20the\x20und'+_0x268794(0x23c)+'ed.')),process[_0x268794(0x1e1)](0x1)),console['log'](_0x268794(0x23a)+_0x268794(0x233)+_0xdcc511+'ms'),await new Promise(_0x8a91bf=>setTimeout(_0x8a91bf,_0xdcc511)),_0xdcc511=Math[_0x268794(0x236)](_0xdcc511*0x2,MAX_RESTART_DELAY_MS);}}async function main(){const _0x3c0b0c=a0_0x5141f2,_0x5bb2a8=process['argv'][_0x3c0b0c(0x1d5)](0x2);if(_0x5bb2a8[0x0]==='--version'||_0x5bb2a8[0x0]==='-v'||_0x5bb2a8[0x0]===_0x3c0b0c(0x22e)){printVersion();return;}if((_0x5bb2a8[0x0]==='status'||_0x5bb2a8[0x0]==='ls'||_0x5bb2a8[0x0]==='ps')&&!_0x5bb2a8['includes']('--json')){console['log'](_0x3c0b0c(0x211)+WRAPPER_VERSION);try{console[_0x3c0b0c(0x249)](_0x3c0b0c(0x1e6)+(coreVersion()||'not\x20installed'));}catch{console['log'](_0x3c0b0c(0x222));}}maybeUpdateWrapper(_0x5bb2a8);if(!shouldSupervise(_0x5bb2a8))directCore(_0x5bb2a8);await superviseCore(_0x5bb2a8);}main()[a0_0x5141f2(0x1c6)](_0x4fee31=>{const _0x1783dc=a0_0x5141f2;console['error']('[wrapper]\x20Fatal\x20erro'+'r:\x20'+(_0x4fee31?.[_0x1783dc(0x218)]||String(_0x4fee31))),process[_0x1783dc(0x1e1)](0x1);});
2
+ 'use strict';const a0_0x6a9c70=a0_0x1f90;(function(_0x185401,_0x69af23){const _0x4257da=a0_0x1f90,_0xb3c77e=_0x185401();while(!![]){try{const _0x59f9b8=-parseInt(_0x4257da(0x1e3))/0x1+parseInt(_0x4257da(0x1a1))/0x2*(parseInt(_0x4257da(0x1d9))/0x3)+parseInt(_0x4257da(0x1a3))/0x4+-parseInt(_0x4257da(0x21c))/0x5*(-parseInt(_0x4257da(0x203))/0x6)+parseInt(_0x4257da(0x190))/0x7*(parseInt(_0x4257da(0x211))/0x8)+parseInt(_0x4257da(0x1ec))/0x9+-parseInt(_0x4257da(0x1bb))/0xa;if(_0x59f9b8===_0x69af23)break;else _0xb3c77e['push'](_0xb3c77e['shift']());}catch(_0x5c92b1){_0xb3c77e['push'](_0xb3c77e['shift']());}}}(a0_0x1bcd,0x1f3dd));var __create=Object[a0_0x6a9c70(0x222)],__defProp=Object[a0_0x6a9c70(0x1fd)],__getOwnPropDesc=Object['getOwnPropertyDescri'+'ptor'],__getOwnPropNames=Object['getOwnPropertyNames'],__getProtoOf=Object[a0_0x6a9c70(0x1e1)],__hasOwnProp=Object[a0_0x6a9c70(0x1ca)]['hasOwnProperty'],__copyProps=(_0x4b08f4,_0x3ce9c9,_0x5d5cef,_0x40a656)=>{if(_0x3ce9c9&&typeof _0x3ce9c9==='object'||typeof _0x3ce9c9==='function'){for(let _0x4e166c of __getOwnPropNames(_0x3ce9c9))if(!__hasOwnProp['call'](_0x4b08f4,_0x4e166c)&&_0x4e166c!==_0x5d5cef)__defProp(_0x4b08f4,_0x4e166c,{'get':()=>_0x3ce9c9[_0x4e166c],'enumerable':!(_0x40a656=__getOwnPropDesc(_0x3ce9c9,_0x4e166c))||_0x40a656['enumerable']});}return _0x4b08f4;},__toESM=(_0x540739,_0x157552,_0xba082b)=>(_0xba082b=_0x540739!=null?__create(__getProtoOf(_0x540739)):{},__copyProps(_0x157552||!_0x540739||!_0x540739['__esModule']?__defProp(_0xba082b,'default',{'value':_0x540739,'enumerable':!![]}):_0xba082b,_0x540739)),import_child_process=require('child_process'),fs=__toESM(require('fs'),0x1),import_module=require(a0_0x6a9c70(0x181)),os=__toESM(require('os'),0x1),path=__toESM(require(a0_0x6a9c70(0x180)),0x1),WRAPPER_PKG_NAME=a0_0x6a9c70(0x1d3),CORE_PKG_NAME='@whalent/agent-core',NPM_REGISTRY='https://registry.npm'+'js.org',SUPERVISED_RESTART_CODE=0x4b,NPM_VIEW_TIMEOUT_MS=0x3a98,HEALTH_TIMEOUT_MS=0xafc8,MIN_RESTART_DELAY_MS=0x3e8,MAX_RESTART_DELAY_MS=0xea60,MAX_CRASHES_IN_WINDOW=0x3,CRASH_WINDOW_MS=0x3*0x3c*0x3e8,NPM_INSTALL_TIMEOUT_MS=0xa*0x3c*0x3e8,NPM_INSTALL_MAX_BUFFER=0x20*0x400*0x400,FATAL_PATTERN=/\[(?:agent|daemon|wrapper)\][^\n]*\bFatal error:[^\n]+|\[daemon\] Failed to start:[^\n]+|Error:[^\n]+/,WRAPPER_VERSION=readWrapperVersion(),CHECKED_PTY_HELPERS=new Set(),CHECKED_NODE_PTY_RUNTIMES=new Set();function wrapperBaseDir(){return __dirname;}function configDir(){const _0x748abc=a0_0x6a9c70;return path[_0x748abc(0x1e2)](os[_0x748abc(0x202)](),_0x748abc(0x1f2));}function upgradeStatePath(){const _0x4e4abc=a0_0x6a9c70;return path[_0x4e4abc(0x1e2)](configDir(),_0x4e4abc(0x1b7));}function lastCrashFilePath(){const _0x177ac6=a0_0x6a9c70;return path['join'](configDir(),_0x177ac6(0x1fb));}function writeLastCrash(_0x178553){const _0x14d9af=a0_0x6a9c70;try{fs[_0x14d9af(0x221)](configDir(),{'recursive':!![]});const _0x2fdd77={..._0x178553,'reported':![]};fs[_0x14d9af(0x218)](lastCrashFilePath(),JSON[_0x14d9af(0x19b)](_0x2fdd77,null,0x2),_0x14d9af(0x1b2));}catch{}}function readWrapperVersion(){const _0xc0b5f5=a0_0x6a9c70;try{const _0x48be40=JSON[_0xc0b5f5(0x198)](fs[_0xc0b5f5(0x183)](path['join'](wrapperBaseDir(),'..','package.json'),'utf-8'));return String(_0x48be40[_0xc0b5f5(0x210)]||'0.0.0');}catch{return'0.0.0';}}function readUpgradeState(){try{return JSON['parse'](fs['readFileSync'](upgradeStatePath(),'utf-8'));}catch{return null;}}function writeUpgradeState(_0x4e2bc6){const _0x315c2b=a0_0x6a9c70;try{fs['mkdirSync'](configDir(),{'recursive':!![]}),fs[_0x315c2b(0x218)](upgradeStatePath(),JSON[_0x315c2b(0x19b)]({..._0x4e2bc6,'updated_at':Date[_0x315c2b(0x1b1)]()},null,0x2),'utf-8');}catch{}}function run(_0x418164,_0x109727,_0x379bad=process.env){const _0x58b038=a0_0x6a9c70;return(0x0,import_child_process[_0x58b038(0x199)])(_0x418164,_0x109727,{'encoding':'utf8','timeout':NPM_INSTALL_TIMEOUT_MS,'maxBuffer':NPM_INSTALL_MAX_BUFFER,'env':_0x379bad,'shell':![]});}function runNpmView(_0x4719f5){const _0x570aaa=a0_0x6a9c70,_0x4d2db2=resolveExecutable('npm');if(!_0x4d2db2)return{'status':0x7f,'stdout':'','stderr':'npm\x20not\x20found','error':new Error('npm\x20not\x20found')};return(0x0,import_child_process[_0x570aaa(0x199)])(_0x4d2db2,_0x4719f5,{'encoding':_0x570aaa(0x207),'timeout':NPM_VIEW_TIMEOUT_MS,'maxBuffer':0x400*0x400,'env':process.env,'shell':![]});}function npmRootGlobal(){const _0x4f7f5b=a0_0x6a9c70,_0x4e1c9a=resolveExecutable('npm');if(!_0x4e1c9a)return'';const _0xb9efcc=run(_0x4e1c9a,[_0x4f7f5b(0x1a0),'-g']);if(_0xb9efcc['status']!==0x0)return'';return String(_0xb9efcc['stdout']||'')[_0x4f7f5b(0x208)]();}function compareSemver(_0x429904,_0x21c55f){const _0x5c3d55=a0_0x6a9c70,_0x58f828=String(_0x429904||'')[_0x5c3d55(0x1f1)](/^v/,'')[_0x5c3d55(0x1b3)](/[.-]/)['map'](_0x5da452=>Number['parseInt'](_0x5da452,0xa)||0x0),_0x48e73d=String(_0x21c55f||'')['replace'](/^v/,'')[_0x5c3d55(0x1b3)](/[.-]/)['map'](_0x193a5b=>Number[_0x5c3d55(0x1f8)](_0x193a5b,0xa)||0x0);for(let _0x5cec42=0x0;_0x5cec42<Math[_0x5c3d55(0x17e)](_0x58f828['length'],_0x48e73d[_0x5c3d55(0x1bd)],0x3);_0x5cec42++){const _0x4cfe2e=_0x58f828[_0x5cec42]||0x0,_0x23a89c=_0x48e73d[_0x5cec42]||0x0;if(_0x4cfe2e>_0x23a89c)return 0x1;if(_0x4cfe2e<_0x23a89c)return-0x1;}return 0x0;}function resolveExecutable(_0x58cfc2){const _0x25eb8d=a0_0x6a9c70,_0x304919=process[_0x25eb8d(0x191)]===_0x25eb8d(0x21a)?_0x25eb8d(0x184):_0x25eb8d(0x1ff);try{const _0x53f676=(0x0,import_child_process['spawnSync'])(_0x304919,[_0x58cfc2],{'encoding':'utf8','timeout':0xbb8,'shell':![]});if(_0x53f676[_0x25eb8d(0x1db)]!==0x0)return'';return String(_0x53f676['stdout']||'')[_0x25eb8d(0x1b3)](/\r?\n/)[_0x25eb8d(0x1f3)](_0x5a3b3f=>_0x5a3b3f['trim']())['filter'](Boolean)[0x0]||'';}catch{return'';}}function skipWrapperUpdateCheck(){const _0x253c14=a0_0x6a9c70,_0x4b56bb=String(process.env.WHALENT_SKIP_UPDATE_CHECK||process.env.WHALENT_NO_UPDATE_CHECK||process.env.WHALENT_SKIP_WRAPPER_UPDATE||'')[_0x253c14(0x208)]()[_0x253c14(0x1f5)]();return _0x4b56bb==='1'||_0x4b56bb===_0x253c14(0x223)||_0x4b56bb==='yes'||_0x4b56bb==='on';}function latestWrapperVersion(){const _0x3f111b=a0_0x6a9c70,_0x24de46=runNpmView(['view',WRAPPER_PKG_NAME+'@latest','version','--registry='+NPM_REGISTRY]);if(_0x24de46['status']!==0x0)return'';return String(_0x24de46['stdout']||'')[_0x3f111b(0x208)]()[_0x3f111b(0x1b3)](/\r?\n/)['filter'](Boolean)['pop']()||'';}function installWrapperVersion(_0x711d40){const _0x1a825=a0_0x6a9c70,_0x3748ae=resolveExecutable('npm');if(!_0x3748ae)return{'ok':![],'output':_0x1a825(0x1ef)+'H'};const _0x2b8130=run(_0x3748ae,[_0x1a825(0x1d6),'-g',WRAPPER_PKG_NAME+'@'+_0x711d40,'--registry='+NPM_REGISTRY]),_0x5b0a62=((_0x2b8130['stdout']||'')+'\x0a'+(_0x2b8130[_0x1a825(0x20a)]||''))[_0x1a825(0x208)]();return{'ok':_0x2b8130[_0x1a825(0x1db)]===0x0,'output':_0x5b0a62};}function maybeUpdateWrapper(_0x339c8a){const _0x3535bc=a0_0x6a9c70;if(skipWrapperUpdateCheck())return![];if(process.env.WHALENT_WRAPPER_UPDATE_ATTEMPTED)return![];const _0xbc177a=latestWrapperVersion();if(!_0xbc177a||compareSemver(_0xbc177a,WRAPPER_VERSION)<=0x0)return![];console[_0x3535bc(0x1cd)](_0x3535bc(0x18d)+_0x3535bc(0x18b)+WRAPPER_VERSION+_0x3535bc(0x1fa)+_0xbc177a),console[_0x3535bc(0x1cd)](_0x3535bc(0x192)+'\x20'+WRAPPER_PKG_NAME+'@'+_0xbc177a+('\x20from\x20npm\x20before\x20sta'+'rting\x20core...'));const _0x229f59=installWrapperVersion(_0xbc177a);if(!_0x229f59['ok']){console[_0x3535bc(0x1cd)](_0x3535bc(0x1e0)+_0x3535bc(0x189)+'ing\x20with\x20'+WRAPPER_VERSION);if(_0x229f59[_0x3535bc(0x1d5)])console[_0x3535bc(0x1cd)](_0x229f59['output'][_0x3535bc(0x1b3)](/\r?\n/)[_0x3535bc(0x1ba)](-0xc)['join']('\x0a'));return console[_0x3535bc(0x1cd)]('[wrapper]\x20Manual\x20upd'+'ate:\x20npm\x20install\x20-g\x20'+WRAPPER_PKG_NAME+'@'+_0xbc177a+'\x20--registry='+NPM_REGISTRY),![];}console[_0x3535bc(0x1cd)](_0x3535bc(0x1e0)+_0x3535bc(0x1ea)+_0xbc177a+_0x3535bc(0x185));const _0x105335=process[_0x3535bc(0x1c5)][0x1],_0x1735f4=(0x0,import_child_process[_0x3535bc(0x199)])(process['execPath'],[_0x105335,..._0x339c8a],{'stdio':_0x3535bc(0x19d),'env':{...process.env,'WHALENT_WRAPPER_UPDATE_ATTEMPTED':_0xbc177a},'shell':![]});process['exit'](_0x1735f4[_0x3535bc(0x1db)]??0x0);}function findCoreScript(){const _0xc38188=a0_0x6a9c70,_0x2213b9=String(process.env.WHALENT_CORE_ENTRY||'')['trim'](),_0x17093e=['1',_0xc38188(0x223),_0xc38188(0x1ee),'on'][_0xc38188(0x1de)](String(process.env.WHALENT_FORCE_CORE_ENTRY||'')['trim']()[_0xc38188(0x1f5)]());if(_0x2213b9&&_0x17093e&&fs['existsSync'](_0x2213b9))return _0x2213b9;const _0x5963ee=[],_0x3df1fc=_0x115296=>{const _0x484d33=_0xc38188;if(fs[_0x484d33(0x1ce)](_0x115296)&&!_0x5963ee[_0x484d33(0x1de)](_0x115296))_0x5963ee[_0x484d33(0x187)](_0x115296);};if(_0x2213b9)_0x3df1fc(_0x2213b9);const _0x5a29e7=npmRootGlobal();if(_0x5a29e7){const _0xafce57=path[_0xc38188(0x1e2)](_0x5a29e7,'@whalent',_0xc38188(0x19e),_0xc38188(0x1e7),_0xc38188(0x1eb));_0x3df1fc(_0xafce57);}const _0x1c2818=path['join'](wrapperBaseDir(),_0xc38188(0x1c6));_0x3df1fc(_0x1c2818);const _0x5c37d9=path[_0xc38188(0x1e2)](wrapperBaseDir(),'..',_0xc38188(0x212),'core',_0xc38188(0x1e7),_0xc38188(0x1eb));_0x3df1fc(_0x5c37d9);if(_0x5963ee[_0xc38188(0x1bd)]>0x0)return _0x5963ee['map']((_0xa6829f,_0xf2a0a2)=>({'candidate':_0xa6829f,'index':_0xf2a0a2,'version':coreVersion(_0xa6829f)}))[_0xc38188(0x19f)]((_0x372271,_0xadaa6c)=>{const _0x14cba1=_0xc38188,_0x21b6d4=compareSemver(_0xadaa6c[_0x14cba1(0x210)],_0x372271[_0x14cba1(0x210)]);if(_0x21b6d4!==0x0)return _0x21b6d4;return _0xadaa6c['index']-_0x372271[_0x14cba1(0x1c3)];})[0x0][_0xc38188(0x1b8)];throw new Error(_0xc38188(0x1d0)+_0xc38188(0x1ae)+_0xc38188(0x1ac)+'or\x20rebuild\x20@whalent/'+_0xc38188(0x1b0));}function coreVersion(_0x1e3500=findCoreScript()){const _0xc1b5a5=a0_0x6a9c70;ensureNodePtyNativeModule(_0x1e3500);const _0x4b38b0=(0x0,import_child_process['spawnSync'])(process[_0xc1b5a5(0x1da)],[_0x1e3500,_0xc1b5a5(0x1e4)],{'encoding':_0xc1b5a5(0x207),'timeout':0x3a98,'env':{...process.env,'WHALENT_SKIP_UPDATE_CHECK':'1'},'shell':![]}),_0x24bc3f=(_0x4b38b0['stdout']||'')+'\x0a'+(_0x4b38b0['stderr']||'');return _0x24bc3f['match'](/(\d+\.\d+\.\d+(?:[-\w.]+)?)/)?.[0x1]||'';}function isExecutable(_0x47214b){const _0x29de87=a0_0x6a9c70;try{return fs['accessSync'](_0x47214b,fs[_0x29de87(0x1c9)]['X_OK']),!![];}catch{return![];}}function shellQuote(_0x10631b){const _0x3f181e=a0_0x6a9c70;return'\x27'+_0x10631b['replace'](/'/g,_0x3f181e(0x206))+'\x27';}function corePackageRoot(_0xe8820e){const _0xac33b8=a0_0x6a9c70;return path['resolve'](path[_0xac33b8(0x1b4)](_0xe8820e),'..');}function nodePtyPackageRoot(_0xdaa6fa){const _0x258137=a0_0x6a9c70,_0x4224d4=(0x0,import_module[_0x258137(0x1d1)])(_0xdaa6fa),_0x4ce1ed=_0x4224d4['resolve']('node-pty');let _0x59b152=path[_0x258137(0x1b4)](_0x4ce1ed);for(let _0x11783c=0x0;_0x11783c<0x5;_0x11783c++){const _0x429db1=path['join'](_0x59b152,_0x258137(0x224));try{const _0x3f4e20=JSON[_0x258137(0x198)](fs['readFileSync'](_0x429db1,_0x258137(0x1b2)));if(_0x3f4e20['name']===_0x258137(0x196))return _0x59b152;}catch{}const _0x2f2d1c=path[_0x258137(0x1b4)](_0x59b152);if(_0x2f2d1c===_0x59b152)break;_0x59b152=_0x2f2d1c;}return path['resolve'](path[_0x258137(0x1b4)](_0x4ce1ed),'..');}function nodePtyNativeCandidates(_0x5ec470){const _0x16204d=a0_0x6a9c70;return[path[_0x16204d(0x1e2)](_0x5ec470,_0x16204d(0x1f6),'Release','pty.node'),path[_0x16204d(0x1e2)](_0x5ec470,_0x16204d(0x215),process[_0x16204d(0x191)]+'-'+process[_0x16204d(0x200)],_0x16204d(0x1d4))];}function hasNodePtyNativeModule(_0x159279){const _0x2278ec=a0_0x6a9c70;return nodePtyNativeCandidates(_0x159279)['some'](_0x304a02=>fs[_0x2278ec(0x1ce)](_0x304a02));}function printNodePtyRebuildHint(_0x2c3bcc){const _0x7e8649=a0_0x6a9c70,_0x5f0758=corePackageRoot(_0x2c3bcc);console['warn'](_0x7e8649(0x20d)+':'),console['warn'](_0x7e8649(0x193)+shellQuote(_0x5f0758)),console[_0x7e8649(0x1cd)](_0x7e8649(0x216)+_0x7e8649(0x1fe));}function ensureNodePtyNativeModule(_0x152cbc){const _0x5040f1=a0_0x6a9c70;if(process['platform']==='win32')return;let _0x259bd9='';try{_0x259bd9=nodePtyPackageRoot(_0x152cbc);}catch(_0x27f09e){console[_0x5040f1(0x1cd)](_0x5040f1(0x21d)+_0x5040f1(0x1dc)+_0x5040f1(0x1c0)+_0x27f09e['message']),printNodePtyRebuildHint(_0x152cbc);return;}const _0x1498ab=((()=>{try{return fs['realpathSync'](_0x259bd9);}catch{return _0x259bd9;}})());if(CHECKED_NODE_PTY_RUNTIMES[_0x5040f1(0x19a)](_0x1498ab))return;CHECKED_NODE_PTY_RUNTIMES[_0x5040f1(0x217)](_0x1498ab);if(hasNodePtyNativeModule(_0x259bd9))return;const _0x4c8a90=resolveExecutable('npm');console['warn']('[wrapper]\x20node-pty\x20n'+_0x5040f1(0x1df)+_0x5040f1(0x1c7)+_0x259bd9),console['warn']('[wrapper]\x20rebuilding'+'\x20node-pty\x20before\x20sta'+'rting\x20core...');if(!_0x4c8a90){console[_0x5040f1(0x1cd)]('[wrapper]\x20npm\x20not\x20fo'+_0x5040f1(0x205)+'node-pty\x20automatical'+'ly'),printNodePtyRebuildHint(_0x152cbc);return;}const _0x455b52=corePackageRoot(_0x152cbc),_0x33b7d0=(0x0,import_child_process['spawnSync'])(_0x4c8a90,[_0x5040f1(0x1c4),'node-pty','--verbose'],{'cwd':_0x455b52,'stdio':'inherit','timeout':NPM_INSTALL_TIMEOUT_MS,'env':process.env,'shell':![]});if(_0x33b7d0['status']===0x0&&hasNodePtyNativeModule(_0x259bd9)){console['warn']('[wrapper]\x20node-pty\x20r'+'ebuild\x20completed');return;}console[_0x5040f1(0x1cd)]('[wrapper]\x20node-pty\x20r'+'ebuild\x20failed'+(_0x33b7d0[_0x5040f1(0x1db)]!==null?_0x5040f1(0x186)+_0x33b7d0['status']+')':'')+(';\x20core\x20may\x20fail\x20to\x20s'+'tart')),printNodePtyRebuildHint(_0x152cbc);}function coreNodePtySpawnHelperPath(_0x52a8e8){const _0x171d2c=a0_0x6a9c70;if(process['platform']!==_0x171d2c(0x1a2))return'';try{const _0x133560=(0x0,import_module[_0x171d2c(0x1d1)])(_0x52a8e8),_0x5067c6=_0x133560[_0x171d2c(0x188)]('node-pty'),_0x39f976=path[_0x171d2c(0x188)](path[_0x171d2c(0x1b4)](_0x5067c6),'..');return path[_0x171d2c(0x1e2)](_0x39f976,'prebuilds',_0x171d2c(0x214)+process['arch'],_0x171d2c(0x1e9));}catch{return'';}}function checkMacNodePtySpawnHelper(_0x26d2fd){const _0x55357b=a0_0x6a9c70,_0x348e58=coreNodePtySpawnHelperPath(_0x26d2fd);if(!_0x348e58||CHECKED_PTY_HELPERS['has'](_0x348e58))return;CHECKED_PTY_HELPERS['add'](_0x348e58);if(!fs[_0x55357b(0x1ce)](_0x348e58)){console['warn'](_0x55357b(0x1aa)+_0x55357b(0x18a)+'t\x20found:\x20'+_0x348e58);return;}if(isExecutable(_0x348e58))return;try{const _0xc82369=fs['statSync'](_0x348e58)['mode'];fs[_0x55357b(0x1d2)](_0x348e58,_0xc82369|0x1ed);}catch{}if(isExecutable(_0x348e58)){console[_0x55357b(0x1cd)]('[wrapper]\x20fixed\x20macO'+_0x55357b(0x1e6)+'per\x20executable\x20bit:\x20'+_0x348e58);return;}console['warn']('[wrapper]\x20macOS\x20node'+'-pty\x20spawn-helper\x20is'+_0x55357b(0x1ab)+_0x348e58),console[_0x55357b(0x1cd)](_0x55357b(0x213)+'nce\x20to\x20fix\x20terminal/'+'PTY\x20startup:'),console['warn']('\x20\x20HELPER='+shellQuote(_0x348e58)),console['warn']('\x20\x20ls\x20-l\x20\x22$HELPER\x22'),console[_0x55357b(0x1cd)]('\x20\x20chmod\x20+x\x20\x22$HELPER\x22');}function printVersion(){const _0x58cdff=a0_0x6a9c70;let _0x3f70d9='';try{_0x3f70d9=coreVersion();}catch{}console[_0x58cdff(0x1cb)]('whalent-agent\x20'+WRAPPER_VERSION),console[_0x58cdff(0x1cb)](_0x58cdff(0x1ad)+WRAPPER_VERSION),console[_0x58cdff(0x1cb)](_0x58cdff(0x1a6)+(_0x3f70d9||_0x58cdff(0x1af)));}function directCore(_0x405e5c){const _0x4778f8=a0_0x6a9c70,_0x53fd84=findCoreScript();ensureNodePtyNativeModule(_0x53fd84),checkMacNodePtySpawnHelper(_0x53fd84);const _0xf7aa46=(0x0,import_child_process['spawnSync'])(process['execPath'],[_0x53fd84,..._0x405e5c],{'stdio':_0x4778f8(0x19d),'env':{...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_CORE_ENTRY':_0x53fd84},'shell':![]});process[_0x4778f8(0x1b5)](_0xf7aa46[_0x4778f8(0x1db)]??0x0);}function shouldSupervise(_0x36087c){const _0x37fa2c=a0_0x6a9c70;if(_0x36087c['includes']('--agent-id'))return![];if(_0x36087c[_0x37fa2c(0x1de)]('--resume')||_0x36087c[0x0]===_0x37fa2c(0x18e))return![];const _0x5f12cd=_0x36087c[0x0]||'';if(_0x5f12cd==='ls'||_0x5f12cd===_0x37fa2c(0x1db)||_0x5f12cd==='ps')return![];if(_0x5f12cd===_0x37fa2c(0x1c2)||_0x5f12cd===_0x37fa2c(0x1cf))return![];if(_0x36087c[_0x37fa2c(0x1de)]('--help')||_0x36087c['includes']('-h'))return![];return!![];}function a0_0x1f90(_0x1cdee9,_0x4b99ba){_0x1cdee9=_0x1cdee9-0x17e;const _0x1bcdee=a0_0x1bcd();let _0x1f90df=_0x1bcdee[_0x1cdee9];if(a0_0x1f90['JvigOZ']===undefined){var _0x49fedb=function(_0x21f654){const _0x5cdb7a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4b08f4='',_0x3ce9c9='';for(let _0x5d5cef=0x0,_0x40a656,_0x4e166c,_0x540739=0x0;_0x4e166c=_0x21f654['charAt'](_0x540739++);~_0x4e166c&&(_0x40a656=_0x5d5cef%0x4?_0x40a656*0x40+_0x4e166c:_0x4e166c,_0x5d5cef++%0x4)?_0x4b08f4+=String['fromCharCode'](0xff&_0x40a656>>(-0x2*_0x5d5cef&0x6)):0x0){_0x4e166c=_0x5cdb7a['indexOf'](_0x4e166c);}for(let _0x157552=0x0,_0xba082b=_0x4b08f4['length'];_0x157552<_0xba082b;_0x157552++){_0x3ce9c9+='%'+('00'+_0x4b08f4['charCodeAt'](_0x157552)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3ce9c9);};a0_0x1f90['OVUKBY']=_0x49fedb,a0_0x1f90['VwlQDY']={},a0_0x1f90['JvigOZ']=!![];}const _0x52b953=_0x1bcdee[0x0],_0x1a3555=_0x1cdee9+_0x52b953,_0xcd1e61=a0_0x1f90['VwlQDY'][_0x1a3555];return!_0xcd1e61?(_0x1f90df=a0_0x1f90['OVUKBY'](_0x1f90df),a0_0x1f90['VwlQDY'][_0x1a3555]=_0x1f90df):_0x1f90df=_0xcd1e61,_0x1f90df;}function installCoreVersion(_0x2687d7){const _0xbb2285=a0_0x6a9c70,_0x36fd6a=resolveExecutable('npm');if(!_0x36fd6a)return{'ok':![],'output':'npm\x20not\x20found\x20on\x20PAT'+'H'};const _0x196039=CORE_PKG_NAME+'@'+_0x2687d7,_0x31e65a=run(_0x36fd6a,['install','-g',_0x196039,_0xbb2285(0x1c8)+NPM_REGISTRY]),_0x254d95=((_0x31e65a['stdout']||'')+'\x0a'+(_0x31e65a['stderr']||''))[_0xbb2285(0x208)]();return{'ok':_0x31e65a['status']===0x0,'output':_0x254d95};}async function superviseCore(_0x4770f0){const _0x36dd63=a0_0x6a9c70;let _0x206bcb=![],_0x39049e=null;const _0x19f846=[];let _0x49e5fa=MIN_RESTART_DELAY_MS;const _0x5e045f=()=>{const _0x443114=a0_0x1f90;_0x206bcb=!![];if(_0x39049e&&!_0x39049e[_0x443114(0x21e)])try{_0x39049e[_0x443114(0x1e8)](_0x443114(0x1be));}catch{}else process[_0x443114(0x1b5)](0x0);};process['on'](_0x36dd63(0x1f9),_0x5e045f),process['on'](_0x36dd63(0x1be),_0x5e045f);while(!![]){const _0x245f94=findCoreScript();ensureNodePtyNativeModule(_0x245f94),checkMacNodePtySpawnHelper(_0x245f94);const _0x2ab3b1={...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_WRAPPER_MANAGED':'1','WHALENT_CORE_ENTRY':_0x245f94},_0x1d9f91=readUpgradeState(),_0x3a4f5c=!!_0x1d9f91?.['pending'];let _0x34b8ac=![],_0x5ab605=null,_0x4f535b='';const _0x2990d7=[],_0x4a2dd0=0xc;console[_0x36dd63(0x1cb)]('[wrapper]\x20starting\x20c'+'ore:\x20'+_0x245f94),_0x39049e=(0x0,import_child_process['spawn'])(process[_0x36dd63(0x1da)],[_0x245f94,..._0x4770f0],{'env':_0x2ab3b1,'stdio':[_0x36dd63(0x19d),_0x36dd63(0x1a7),'pipe']});const _0x248e11=()=>{const _0x13a3b9=_0x36dd63;if(_0x34b8ac)return;_0x34b8ac=!![];if(_0x5ab605)clearTimeout(_0x5ab605);_0x19f846['length']=0x0,_0x49e5fa=MIN_RESTART_DELAY_MS;const _0x418c27=readUpgradeState();_0x418c27?.[_0x13a3b9(0x194)]&&(writeUpgradeState({..._0x418c27,'pending':![],'rollback':![],'health_status':_0x13a3b9(0x1b6)}),console[_0x13a3b9(0x1cb)](_0x13a3b9(0x1a4)+_0x13a3b9(0x1bf)+(_0x418c27['installed_version']||_0x418c27[_0x13a3b9(0x1e5)]||'')));},_0xf6d322=(_0x88961f,_0x5b068b=![])=>{const _0x1708dd=_0x36dd63,_0x58c61f=_0x88961f['toString']();(_0x5b068b?process['stderr']:process[_0x1708dd(0x197)])['write'](_0x58c61f);if(_0x5b068b)for(const _0xad825 of _0x58c61f['split'](/\r?\n/)){if(!_0xad825['trim']())continue;_0x2990d7[_0x1708dd(0x187)](_0xad825);if(_0x2990d7[_0x1708dd(0x1bd)]>_0x4a2dd0)_0x2990d7[_0x1708dd(0x182)]();const _0x5c17b3=_0xad825['match'](FATAL_PATTERN);if(_0x5c17b3)_0x4f535b=_0x5c17b3[0x0];}(_0x58c61f[_0x1708dd(0x1de)]('[gateway]\x20Connected')||_0x58c61f['includes'](_0x1708dd(0x1fc)+_0x1708dd(0x18c))||_0x58c61f[_0x1708dd(0x1de)]('Gateway:\x20connected'))&&_0x248e11();};_0x39049e['stdout']?.['on'](_0x36dd63(0x195),_0x2f7af=>_0xf6d322(_0x2f7af,![])),_0x39049e['stderr']?.['on']('data',_0x494d93=>_0xf6d322(_0x494d93,!![]));_0x3a4f5c&&(_0x5ab605=setTimeout(()=>{const _0x4cee99=_0x36dd63;if(_0x34b8ac||!_0x39049e||_0x39049e[_0x4cee99(0x21e)])return;console['error'](_0x4cee99(0x219)+_0x4cee99(0x1c1)+_0x4cee99(0x1ed)+_0x4cee99(0x20b));try{_0x39049e['kill']('SIGTERM');}catch{}},HEALTH_TIMEOUT_MS));const _0x7206d0=await new Promise(_0xdbb4f4=>{const _0x4bd322=_0x36dd63;_0x39049e[_0x4bd322(0x1dd)]('exit',(_0x5668f0,_0x33b0b3)=>_0xdbb4f4({'code':_0x5668f0,'signal':_0x33b0b3}));});if(_0x5ab605)clearTimeout(_0x5ab605);_0x39049e=null;if(_0x206bcb)process[_0x36dd63(0x1b5)](_0x7206d0['code']??0x0);const _0x4b1fc3=readUpgradeState();if(_0x4b1fc3?.['pending']&&!_0x34b8ac){const _0xa9e002=String(_0x4b1fc3[_0x36dd63(0x21b)+'n']||'')['trim']();if(_0xa9e002){console['error'](_0x36dd63(0x209)+_0x36dd63(0x1d8)+_0xa9e002);const _0xbf7f47=installCoreVersion(_0xa9e002);writeUpgradeState({..._0x4b1fc3,'pending':![],'rollback':!![],'health_status':_0xbf7f47['ok']?_0x36dd63(0x1f0):_0x36dd63(0x18f),'error':_0xbf7f47['ok']?'':_0xbf7f47['output']});}else writeUpgradeState({..._0x4b1fc3,'pending':![],'rollback':!![],'health_status':'rollback_unavailable','error':'previous\x20core\x20versio'+_0x36dd63(0x20c)});}const _0x568e8f=_0x7206d0[_0x36dd63(0x1a5)]===SUPERVISED_RESTART_CODE||_0x4b1fc3?.['pending'];if(!_0x568e8f&&_0x7206d0[_0x36dd63(0x1a5)]===0x0)process[_0x36dd63(0x1b5)](0x0);const _0x2642c6=Date[_0x36dd63(0x1b1)]();_0x19f846['push'](_0x2642c6);while(_0x19f846['length']>0x0&&_0x2642c6-_0x19f846[0x0]>CRASH_WINDOW_MS){_0x19f846[_0x36dd63(0x182)]();}const _0x33124b=_0x19f846[_0x36dd63(0x1bd)];writeLastCrash({'timestamp':_0x2642c6,'exit_code':_0x7206d0['code'],'exit_signal':_0x7206d0['signal']||null,'fatal_line':_0x4f535b,'raw_tail':_0x2990d7['join']('\x0a'),'consecutive_crashes':_0x33124b}),console['log'](_0x36dd63(0x1a8)+_0x36dd63(0x1a9)+(_0x7206d0[_0x36dd63(0x1a5)]??'')+(_0x7206d0['signal']?'\x20signal='+_0x7206d0['signal']:'')+'\x20('+_0x33124b+'/'+MAX_CRASHES_IN_WINDOW+'\x20in\x20last\x20'+Math[_0x36dd63(0x1f7)](CRASH_WINDOW_MS/0x3e8)+'s)');if(_0x4f535b)console['log']('[wrapper]\x20last\x20fatal'+':\x20'+_0x4f535b);_0x33124b>=MAX_CRASHES_IN_WINDOW&&(console[_0x36dd63(0x201)](_0x36dd63(0x1d7)+'d\x20'+_0x33124b+_0x36dd63(0x21f)+Math['round'](CRASH_WINDOW_MS/0x3e8)+(_0x36dd63(0x1f4)+_0x36dd63(0x220))+lastCrashFilePath()+('.\x20Restart\x20wrapper\x20ma'+_0x36dd63(0x17f)+'erlying\x20issue\x20is\x20fix'+'ed.')),process['exit'](0x1)),console['log'](_0x36dd63(0x1cc)+_0x36dd63(0x20f)+_0x49e5fa+'ms'),await new Promise(_0x3b6af6=>setTimeout(_0x3b6af6,_0x49e5fa)),_0x49e5fa=Math[_0x36dd63(0x20e)](_0x49e5fa*0x2,MAX_RESTART_DELAY_MS);}}async function main(){const _0x235cba=a0_0x6a9c70,_0x26161a=process[_0x235cba(0x1c5)]['slice'](0x2);if(_0x26161a[0x0]===_0x235cba(0x1e4)||_0x26161a[0x0]==='-v'||_0x26161a[0x0]===_0x235cba(0x210)){printVersion();return;}if((_0x26161a[0x0]===_0x235cba(0x1db)||_0x26161a[0x0]==='ls'||_0x26161a[0x0]==='ps')&&!_0x26161a[_0x235cba(0x1de)]('--json')){console['log'](_0x235cba(0x1ad)+WRAPPER_VERSION);try{console[_0x235cba(0x1cb)]('core\x20'+(coreVersion()||_0x235cba(0x1af)));}catch{console[_0x235cba(0x1cb)](_0x235cba(0x19c));}}maybeUpdateWrapper(_0x26161a);if(!shouldSupervise(_0x26161a))directCore(_0x26161a);await superviseCore(_0x26161a);}main()[a0_0x6a9c70(0x204)](_0x39c2ff=>{const _0x2e2e1c=a0_0x6a9c70;console['error'](_0x2e2e1c(0x1b9)+'r:\x20'+(_0x39c2ff?.[_0x2e2e1c(0x1bc)]||String(_0x39c2ff))),process['exit'](0x1);});function a0_0x1bcd(){const _0x59d694=['BwvZC2fNzq','BgvUz3rO','u0Lhvevstq','zguGAgvHBhrOEtOG','ywjSzsbMB3iGy29YztOG','AwqGBM90igjLy29TzsbOzwfSDgG','BwnW','Aw5KzxG','CMvIDwLSza','yxjNDG','y29Yzs5JANm','Aw5NihvUzgvYia','ls1YzwDPC3rYEt0','y29UC3rHBNrZ','ChjVDg90ExbL','Bg9N','w3DYyxbWzxjDihjLC3rHCNrPBMC','D2fYBG','zxHPC3rZu3LUyW','zgfLBw9Ulw1JCa','D2HHBgvUDcbJB3jLihj1BNrPBwu','y3jLyxrLuMvXDwLYzq','y2HTB2rtEw5J','qhDOywXLBNqVywDLBNq','Chr5lM5Vzgu','B3v0Chv0','Aw5ZDgfSBa','w3DYyxbWzxjDignVCMuGzMfPBgu','y2SGy29Yzsb0BYa','mJeYnti5ChnfCeLN','zxHLy1bHDgG','C3rHDhvZ','zxbLBMrLBMn5ig5VDcbYzxnVBhy','B25Jzq','Aw5JBhvKzxm','yxrPDMuGBw9KDwXLigLZig1PC3m','w3DYyxbWzxjDihDYyxbWzxiGDxa','z2v0uhjVDg90ExbLt2y','AM9PBG','nZe0odnVvvz2qLq','ls12zxjZAw9U','DgfYz2v0x3zLCNnPB24','uYbUB2rLlxb0EsbZCgf3BI1OzwW','zgLZDa','A2LSBa','C3bHD24TAgvSCgvY','zgf0zwqGDg8G','Aw5KzxGUy2PZ','mtyYnda4nMHYAgjWrq','EsbPBIb0Aw1LoYbYB2XSAw5Nigi','EwvZ','BNbTig5VDcbMB3vUzcbVBIbqqvq','CM9SBgvKx2jHy2S','CMvWBgfJzq','lNDOywXLBNqTywDLBNq','BwfW','CZSGz2L2Aw5NihvWlIbdCMfZAca','Dg9mB3DLCKnHC2u','yNvPBgq','CM91BMq','CgfYC2vjBNq','u0Lhsu5u','ic0+ia','BgfZDc1JCMfZAc5QC29U','r2f0zxDHEsbYzwDPC3rLCMvKig0','zgvMAw5LuhjVCgvYDhK','DhKGls12zxjIB3nL','D2HPy2G','yxjJAa','zxjYB3i','Ag9TzwrPCG','mtiZmtyZoej3EhnpyG','y2f0y2G','Dw5KoYbJyw5UB3qGCMvIDwLSzca','j1WNjW','DxrMoa','DhjPBq','w3DYyxbWzxjDihjVBgXPBMCGyMe','C3rKzxjY','ywnR','BIb1BMTUB3DU','w3DYyxbWzxjDie1HBNvHBcbMAxG','BwLU','igLUia','DMvYC2LVBG','mtm2mdbJuhH2qu0','CgfJA2fNzxm','w3DYyxbWzxjDifj1BIb0AgLZig8','zgfYD2LUlq','ChjLyNvPBgrZ','icbUCg0GCMvIDwLSzcbUB2rLlxa','ywrK','D3jPDgvgAwXLu3LUyW','w3DYyxbWzxjDig5LDYbJB3jLigq','D2LUmZi','ChjLDMLVDxnFy29Yzv92zxjZAw8','nwjuENr6AW','w3DYyxbWzxjDig5VzguTChr5igq','A2LSBgvK','ihrPBwvZihDPDgHPBIa','CMvJB3jKoIa','BwTKAxjtEw5J','y3jLyxrL','Dhj1zq','CgfJA2fNzs5QC29U','Bwf4','BNvHBgX5igfMDgvYihrOzsb1BMq','Cgf0Aa','Bw9KDwXL','C2HPzNq','CMvHzezPBgvtEw5J','D2HLCMuUzxHL','oYbYzxn0yxj0Aw5NihDYyxbWzxi','icHLEgL0pq','ChvZAa','CMvZB2X2zq','zgf0zsbMywLSzwq7ignVBNrPBNu','lxb0EsbZCgf3BI1OzwXWzxiGBM8','AwXHyMXLoIa','ywnOAw5L','w3DYyxbWzxjDihvWzgf0zsbHDMe','CMvZDw1L','CM9SBgjHy2TFzMfPBgvK','mZu3wvvAvuPN','CgXHDgzVCM0','w3DYyxbWzxjDigLUC3rHBgXPBMC','icbJzca','CgvUzgLUzW','zgf0yq','BM9Kzs1WDhK','C3rKB3v0','CgfYC2u','C3bHD25tEw5J','AgfZ','C3rYAw5NAwz5','y29YzsbUB3qGAw5ZDgfSBgvK','Aw5OzxjPDa','ywDLBNqTy29Yzq','C29YDa','CM9VDa','mNDtvM5mrG','zgfYD2LU','nZa2ntKYCvLtt1Ps','w3DYyxbWzxjDignVCMuGDxbNCMe','y29Kzq','y29Yzsa','CgLWzq','w3DYyxbWzxjDignVCMuGzxHPDgu','zcbJB2rLpq','w3DYyxbWzxjDig1Hy09tig5Vzgu','ig5VDcbLEgvJDxrHyMXLoIa','qhDOywXLBNqVywDLBNqTy29Yzsa','D3jHChbLCIa','ig5VDcbMB3vUzdSGAw5ZDgfSBca','BM90igLUC3rHBgXLza','ywDLBNq','BM93','DxrMltG','C3bSAxq','zgLYBMfTzq','zxHPDa','AgvHBhrOEq','y29Yzs11CgDYywrLlMPZB24','y2fUzgLKyxrL','w3DYyxbWzxjDiezHDgfSigvYCM8','C2XPy2u','ntiWndCWmeLnv2rOyG'];a0_0x1bcd=function(){return _0x59d694;};return a0_0x1bcd();}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whalent/agent",
3
- "version": "0.3.94",
3
+ "version": "0.3.95",
4
4
  "description": "Stable wrapper for Whalent Agent core runtime",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -42,7 +42,7 @@
42
42
  "yaml": "^2.4.0"
43
43
  },
44
44
  "optionalDependencies": {
45
- "@whalent/agent-core": "0.3.94"
45
+ "@whalent/agent-core": "0.3.95"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/node": "^20.0.0",