@whalent/agent 0.3.44 → 0.3.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';const a0_0x301846=a0_0xc6ed;(function(_0x5d94db,_0x4b5662){const _0x4f7612=a0_0xc6ed,_0x131dee=_0x5d94db();while(!![]){try{const _0x8a7ff9=parseInt(_0x4f7612(0x149))/0x1*(-parseInt(_0x4f7612(0x139))/0x2)+parseInt(_0x4f7612(0x160))/0x3*(-parseInt(_0x4f7612(0x177))/0x4)+parseInt(_0x4f7612(0x163))/0x5*(-parseInt(_0x4f7612(0x15d))/0x6)+-parseInt(_0x4f7612(0x196))/0x7*(parseInt(_0x4f7612(0x168))/0x8)+-parseInt(_0x4f7612(0x19d))/0x9+parseInt(_0x4f7612(0x1a6))/0xa*(-parseInt(_0x4f7612(0x179))/0xb)+parseInt(_0x4f7612(0x19b))/0xc*(parseInt(_0x4f7612(0x13d))/0xd);if(_0x8a7ff9===_0x4b5662)break;else _0x131dee['push'](_0x131dee['shift']());}catch(_0x413f4d){_0x131dee['push'](_0x131dee['shift']());}}}(a0_0x14e9,0x211bd));var __create=Object['create'],__defProp=Object[a0_0x301846(0x13a)],__getOwnPropDesc=Object[a0_0x301846(0x140)+'ptor'],__getOwnPropNames=Object['getOwnPropertyNames'],__getProtoOf=Object[a0_0x301846(0x16a)],__hasOwnProp=Object['prototype'][a0_0x301846(0x161)],__copyProps=(_0x5e693c,_0x17bbc6,_0x229be0,_0x43f583)=>{const _0xd53c26=a0_0x301846;if(_0x17bbc6&&typeof _0x17bbc6==='object'||typeof _0x17bbc6===_0xd53c26(0x151)){for(let _0x221fda of __getOwnPropNames(_0x17bbc6))if(!__hasOwnProp['call'](_0x5e693c,_0x221fda)&&_0x221fda!==_0x229be0)__defProp(_0x5e693c,_0x221fda,{'get':()=>_0x17bbc6[_0x221fda],'enumerable':!(_0x43f583=__getOwnPropDesc(_0x17bbc6,_0x221fda))||_0x43f583['enumerable']});}return _0x5e693c;},__toESM=(_0x4a15a3,_0x5ebb0a,_0x24225d)=>(_0x24225d=_0x4a15a3!=null?__create(__getProtoOf(_0x4a15a3)):{},__copyProps(_0x5ebb0a||!_0x4a15a3||!_0x4a15a3['__esModule']?__defProp(_0x24225d,'default',{'value':_0x4a15a3,'enumerable':!![]}):_0x24225d,_0x4a15a3)),import_child_process=require('child_process'),fs=__toESM(require('fs'),0x1),import_module=require(a0_0x301846(0x186)),os=__toESM(require('os'),0x1),path=__toESM(require('path'),0x1),WRAPPER_PKG_NAME=a0_0x301846(0x16c),CORE_PKG_NAME=a0_0x301846(0x193),NPM_REGISTRY=a0_0x301846(0x18f)+'js.org',SUPERVISED_RESTART_CODE=0x4b,NPM_VIEW_TIMEOUT_MS=0x3a98,HEALTH_TIMEOUT_MS=0xafc8,RESTART_DELAY_MS=0x3e8,NPM_INSTALL_TIMEOUT_MS=0xa*0x3c*0x3e8,NPM_INSTALL_MAX_BUFFER=0x20*0x400*0x400,WRAPPER_VERSION=readWrapperVersion(),CHECKED_PTY_HELPERS=new Set();function wrapperBaseDir(){return __dirname;}function configDir(){const _0x2c8c57=a0_0x301846;return path[_0x2c8c57(0x1a0)](os['homedir'](),'.whalent-agent');}function a0_0xc6ed(_0x2d521b,_0x348416){_0x2d521b=_0x2d521b-0x137;const _0x14e933=a0_0x14e9();let _0xc6ed13=_0x14e933[_0x2d521b];if(a0_0xc6ed['kNFaqG']===undefined){var _0x309cb3=function(_0x138375){const _0x2746db='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x5e693c='',_0x17bbc6='';for(let _0x229be0=0x0,_0x43f583,_0x221fda,_0x4a15a3=0x0;_0x221fda=_0x138375['charAt'](_0x4a15a3++);~_0x221fda&&(_0x43f583=_0x229be0%0x4?_0x43f583*0x40+_0x221fda:_0x221fda,_0x229be0++%0x4)?_0x5e693c+=String['fromCharCode'](0xff&_0x43f583>>(-0x2*_0x229be0&0x6)):0x0){_0x221fda=_0x2746db['indexOf'](_0x221fda);}for(let _0x5ebb0a=0x0,_0x24225d=_0x5e693c['length'];_0x5ebb0a<_0x24225d;_0x5ebb0a++){_0x17bbc6+='%'+('00'+_0x5e693c['charCodeAt'](_0x5ebb0a)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x17bbc6);};a0_0xc6ed['lgfzDo']=_0x309cb3,a0_0xc6ed['anEMDi']={},a0_0xc6ed['kNFaqG']=!![];}const _0x48004d=_0x14e933[0x0],_0x2d08fe=_0x2d521b+_0x48004d,_0x301736=a0_0xc6ed['anEMDi'][_0x2d08fe];return!_0x301736?(_0xc6ed13=a0_0xc6ed['lgfzDo'](_0xc6ed13),a0_0xc6ed['anEMDi'][_0x2d08fe]=_0xc6ed13):_0xc6ed13=_0x301736,_0xc6ed13;}function upgradeStatePath(){const _0x261aab=a0_0x301846;return path[_0x261aab(0x1a0)](configDir(),'core-upgrade.json');}function readWrapperVersion(){const _0x156a95=a0_0x301846;try{const _0x225880=JSON['parse'](fs[_0x156a95(0x15b)](path['join'](wrapperBaseDir(),'..',_0x156a95(0x17f)),_0x156a95(0x184)));return String(_0x225880['version']||'0.0.0');}catch{return _0x156a95(0x189);}}function readUpgradeState(){const _0x4284e8=a0_0x301846;try{return JSON['parse'](fs[_0x4284e8(0x15b)](upgradeStatePath(),_0x4284e8(0x184)));}catch{return null;}}function writeUpgradeState(_0x29b8cd){const _0x44076f=a0_0x301846;try{fs[_0x44076f(0x155)](configDir(),{'recursive':!![]}),fs[_0x44076f(0x19f)](upgradeStatePath(),JSON[_0x44076f(0x16d)]({..._0x29b8cd,'updated_at':Date[_0x44076f(0x195)]()},null,0x2),_0x44076f(0x184));}catch{}}function run(_0x597446,_0x599cc7,_0x519b70=process.env){const _0x3c4892=a0_0x301846;return(0x0,import_child_process[_0x3c4892(0x142)])(_0x597446,_0x599cc7,{'encoding':_0x3c4892(0x188),'timeout':NPM_INSTALL_TIMEOUT_MS,'maxBuffer':NPM_INSTALL_MAX_BUFFER,'env':_0x519b70,'shell':![]});}function runNpmView(_0x172cef){const _0x131fff=a0_0x301846,_0x4dea2c=resolveExecutable(_0x131fff(0x183));if(!_0x4dea2c)return{'status':0x7f,'stdout':'','stderr':'npm\x20not\x20found','error':new Error(_0x131fff(0x144))};return(0x0,import_child_process[_0x131fff(0x142)])(_0x4dea2c,_0x172cef,{'encoding':'utf8','timeout':NPM_VIEW_TIMEOUT_MS,'maxBuffer':0x400*0x400,'env':process.env,'shell':![]});}function npmRootGlobal(){const _0x2e69e9=a0_0x301846,_0x3aed1f=resolveExecutable(_0x2e69e9(0x183));if(!_0x3aed1f)return'';const _0x552b5d=run(_0x3aed1f,['root','-g']);if(_0x552b5d[_0x2e69e9(0x167)]!==0x0)return'';return String(_0x552b5d['stdout']||'')[_0x2e69e9(0x137)]();}function compareSemver(_0x1f2a29,_0x367f74){const _0x1e754d=a0_0x301846,_0x491f61=String(_0x1f2a29||'')['replace'](/^v/,'')[_0x1e754d(0x169)](/[.-]/)['map'](_0x4b23e1=>Number['parseInt'](_0x4b23e1,0xa)||0x0),_0x4cf303=String(_0x367f74||'')['replace'](/^v/,'')[_0x1e754d(0x169)](/[.-]/)[_0x1e754d(0x1a3)](_0x11b45e=>Number[_0x1e754d(0x14f)](_0x11b45e,0xa)||0x0);for(let _0x42e0a6=0x0;_0x42e0a6<Math['max'](_0x491f61['length'],_0x4cf303[_0x1e754d(0x13b)],0x3);_0x42e0a6++){const _0x11dbab=_0x491f61[_0x42e0a6]||0x0,_0x7c42ec=_0x4cf303[_0x42e0a6]||0x0;if(_0x11dbab>_0x7c42ec)return 0x1;if(_0x11dbab<_0x7c42ec)return-0x1;}return 0x0;}function resolveExecutable(_0x3a26b2){const _0x5ebe9f=a0_0x301846,_0x3a4491=process[_0x5ebe9f(0x152)]==='win32'?_0x5ebe9f(0x178):'which';try{const _0xffb490=(0x0,import_child_process[_0x5ebe9f(0x142)])(_0x3a4491,[_0x3a26b2],{'encoding':'utf8','timeout':0xbb8,'shell':![]});if(_0xffb490['status']!==0x0)return'';return String(_0xffb490['stdout']||'')['split'](/\r?\n/)[_0x5ebe9f(0x1a3)](_0xeccc5f=>_0xeccc5f['trim']())[_0x5ebe9f(0x180)](Boolean)[0x0]||'';}catch{return'';}}function skipWrapperUpdateCheck(){const _0x4bba0c=a0_0x301846,_0x525585=String(process.env.WHALENT_SKIP_UPDATE_CHECK||process.env.WHALENT_NO_UPDATE_CHECK||process.env.WHALENT_SKIP_WRAPPER_UPDATE||'')[_0x4bba0c(0x137)]()[_0x4bba0c(0x185)]();return _0x525585==='1'||_0x525585==='true'||_0x525585==='yes'||_0x525585==='on';}function latestWrapperVersion(){const _0x3645ec=a0_0x301846,_0x294131=runNpmView(['view',WRAPPER_PKG_NAME+_0x3645ec(0x150),_0x3645ec(0x192),_0x3645ec(0x159)+NPM_REGISTRY]);if(_0x294131['status']!==0x0)return'';return String(_0x294131['stdout']||'')['trim']()[_0x3645ec(0x169)](/\r?\n/)[_0x3645ec(0x180)](Boolean)['pop']()||'';}function installWrapperVersion(_0x2ac220){const _0x51b7da=a0_0x301846,_0x31aaca=resolveExecutable(_0x51b7da(0x183));if(!_0x31aaca)return{'ok':![],'output':_0x51b7da(0x17a)+'H'};const _0x4dff73=run(_0x31aaca,[_0x51b7da(0x187),'-g',WRAPPER_PKG_NAME+'@'+_0x2ac220,'--registry='+NPM_REGISTRY]),_0xf16c76=((_0x4dff73[_0x51b7da(0x14b)]||'')+'\x0a'+(_0x4dff73['stderr']||''))[_0x51b7da(0x137)]();return{'ok':_0x4dff73[_0x51b7da(0x167)]===0x0,'output':_0xf16c76};}function maybeUpdateWrapper(_0x552558){const _0xf0d86b=a0_0x301846;if(skipWrapperUpdateCheck())return![];if(process.env.WHALENT_WRAPPER_UPDATE_ATTEMPTED)return![];const _0x2d5843=latestWrapperVersion();if(!_0x2d5843||compareSemver(_0x2d5843,WRAPPER_VERSION)<=0x0)return![];console[_0xf0d86b(0x1a2)](_0xf0d86b(0x154)+_0xf0d86b(0x181)+WRAPPER_VERSION+'\x20->\x20'+_0x2d5843),console[_0xf0d86b(0x1a2)](_0xf0d86b(0x153)+'\x20'+WRAPPER_PKG_NAME+'@'+_0x2d5843+('\x20from\x20npm\x20before\x20sta'+'rting\x20core...'));const _0x1b898d=installWrapperVersion(_0x2d5843);if(!_0x1b898d['ok']){console[_0xf0d86b(0x1a2)](_0xf0d86b(0x156)+_0xf0d86b(0x18a)+_0xf0d86b(0x14c)+WRAPPER_VERSION);if(_0x1b898d['output'])console['warn'](_0x1b898d[_0xf0d86b(0x162)]['split'](/\r?\n/)[_0xf0d86b(0x174)](-0xc)[_0xf0d86b(0x1a0)]('\x0a'));return console[_0xf0d86b(0x1a2)]('[wrapper]\x20Manual\x20upd'+_0xf0d86b(0x17d)+WRAPPER_PKG_NAME+'@'+_0x2d5843+_0xf0d86b(0x14e)+NPM_REGISTRY),![];}console['warn'](_0xf0d86b(0x156)+_0xf0d86b(0x18e)+_0x2d5843+_0xf0d86b(0x138));const _0x22bd34=process[_0xf0d86b(0x18b)][0x1],_0x515d50=(0x0,import_child_process['spawnSync'])(process[_0xf0d86b(0x17c)],[_0x22bd34,..._0x552558],{'stdio':_0xf0d86b(0x15e),'env':{...process.env,'WHALENT_WRAPPER_UPDATE_ATTEMPTED':_0x2d5843},'shell':![]});process['exit'](_0x515d50['status']??0x0);}function findCoreScript(){const _0xbf2476=a0_0x301846,_0xbc55bd=String(process.env.WHALENT_CORE_ENTRY||'')['trim']();if(_0xbc55bd&&fs['existsSync'](_0xbc55bd))return _0xbc55bd;const _0x50552d=npmRootGlobal();if(_0x50552d){const _0x781298=path[_0xbf2476(0x1a0)](_0x50552d,'@whalent',_0xbf2476(0x18d),_0xbf2476(0x147),'index.cjs');if(fs[_0xbf2476(0x166)](_0x781298))return _0x781298;}const _0x1bd78a=path['join'](wrapperBaseDir(),'core.cjs');if(fs['existsSync'](_0x1bd78a))return _0x1bd78a;const _0x3d5a5e=path[_0xbf2476(0x1a0)](wrapperBaseDir(),'..','packages',_0xbf2476(0x194),'dist','index.cjs');if(fs['existsSync'](_0x3d5a5e))return _0x3d5a5e;throw new Error('whalent\x20core\x20runtime'+_0xbf2476(0x182)+'@whalent/agent-core\x20'+_0xbf2476(0x19a)+_0xbf2476(0x171));}function coreVersion(_0x404a48=findCoreScript()){const _0x381c63=a0_0x301846,_0x1b92ac=(0x0,import_child_process['spawnSync'])(process['execPath'],[_0x404a48,_0x381c63(0x17b)],{'encoding':_0x381c63(0x188),'timeout':0x3a98,'env':{...process.env,'WHALENT_SKIP_UPDATE_CHECK':'1'},'shell':![]}),_0x4a555c=(_0x1b92ac[_0x381c63(0x14b)]||'')+'\x0a'+(_0x1b92ac['stderr']||'');return _0x4a555c['match'](/(\d+\.\d+\.\d+(?:[-\w.]+)?)/)?.[0x1]||'';}function isExecutable(_0x48f3d7){const _0x5675ce=a0_0x301846;try{return fs[_0x5675ce(0x157)](_0x48f3d7,fs['constants']['X_OK']),!![];}catch{return![];}}function shellQuote(_0x5e62e6){return'\x27'+_0x5e62e6['replace'](/'/g,'\x27\x5c\x27\x27')+'\x27';}function a0_0x14e9(){const _0x44f4b7=['y29Yzq','BM93','ntC1nJm4vMvlvw90','w3DYyxbWzxjDihjVBgXPBMCGyMe','CgvUzgLUzW','r2f0zxDHEtOGy29UBMvJDgvK','B3iGCMvIDwLSzcbaD2HHBgvUDc8','nJqXmtG2ne9ovxLyuq','y29Kzq','nJGXndK4AhLsB1fc','ywrK','D3jPDgvgAwXLu3LUyW','AM9PBG','u0Lhsu5u','D2fYBG','BwfW','CMvZB2X2zq','y2HTB2rtEw5J','mtC1ndKYmfbNBfbQrq','DhjPBq','oYbYzxn0yxj0Aw5NihDYyxbWzxi','mJy3otu4A3r1ufjM','zgvMAw5LuhjVCgvYDhK','BgvUz3rO','C3rKzxjY','mJzfA0LPBKe','Bg9N','u0Lhvevstq','z2v0t3DUuhjVCgvYDhLezxnJCMK','ls1QC29U','C3bHD25tEw5J','icbiruXqrvi9','BNbTig5VDcbMB3vUza','CJOG','w3DYyxbWzxjDignVCMuGzxHPDgu','zgLZDa','ls1Hz2vUDc1Pza','mvHAv1fxAq','zgf0yq','C3rKB3v0','Aw5NihDPDgGG','y2f0y2G','ic0TCMvNAxn0CNK9','CgfYC2vjBNq','qgXHDgvZDa','zNvUy3rPB24','CgXHDgzVCM0','w3DYyxbWzxjDigLUC3rHBgXPBMC','w3DYyxbWzxjDihvWzgf0zsbHDMe','BwTKAxjtEw5J','w3DYyxbWzxjDihDYyxbWzxiGDxa','ywnJzxnZu3LUyW','Aw5JBhvKzxm','ls1YzwDPC3rYEt0','AgfZ','CMvHzezPBgvtEw5J','zxHPDa','odiZndiYtg1mwM1d','Aw5OzxjPDa','zxjYB3i','nZm4mZK5rNrvrvnh','AgfZt3DUuhjVCgvYDhK','B3v0Chv0','nwTPtKr0CG','BIb1BMTUB3DU','D2HHBgvUDc1Hz2vUDca','zxHPC3rZu3LUyW','C3rHDhvZ','mtzYvMPeq2W','C3bSAxq','z2v0uhjVDg90ExbLt2y','DgfYz2v0x3zLCNnPB24','qhDOywXLBNqVywDLBNq','C3rYAw5NAwz5','Bw9Kzq','CgvYigv4zwn1DgfIBguGyML0oIa','zcbJB2rLpq','ywDLBNq','EsbPBIb0Aw1LoYbYB2XSAw5Nigi','lxb0EsbZCgf3BI1OzwXWzxiGBM8','C2XPy2u','B3jLoIa','zgfYD2LU','neXbCgjcwq','D2HLCMuUzxHL','mtf3wxPMtuC','BNbTig5VDcbMB3vUzcbVBIbqqvq','ls12zxjZAw9U','zxHLy1bHDgG','yxrLoIbUCg0GAw5ZDgfSBcaTzYa','ywnOAw5L','CgfJA2fNzs5QC29U','zMLSDgvY','AwXHyMXLoIa','ig5VDcbMB3vUzdSGAw5ZDgfSBca','BNbT','DxrMltG','Dg9mB3DLCKnHC2u','Bw9KDwXL','Aw5ZDgfSBa','DxrMoa','mc4WlJa','zgf0zsbMywLSzwq7ignVBNrPBNu','yxjNDG','CgLWzq','ywDLBNqTy29Yzq','zgf0zwqGDg8G','Ahr0Chm6lY9YzwDPC3rYEs5UCg0','w3DYyxbWzxjDifj1BIb0AgLZig8','w3DYyxbWzxjDigzPEgvKig1Hy08','DMvYC2LVBG','qhDOywXLBNqVywDLBNqTy29Yzq'];a0_0x14e9=function(){return _0x44f4b7;};return a0_0x14e9();}function coreNodePtySpawnHelperPath(_0x4097ee){const _0x10fa07=a0_0x301846;if(process[_0x10fa07(0x152)]!==_0x10fa07(0x176))return'';try{const _0x47f301=(0x0,import_module['createRequire'])(_0x4097ee),_0x35fcfd=_0x47f301[_0x10fa07(0x1a4)]('node-pty'),_0x5ba885=path['resolve'](path['dirname'](_0x35fcfd),'..');return path['join'](_0x5ba885,'prebuilds','darwin-'+process['arch'],'spawn-helper');}catch{return'';}}function checkMacNodePtySpawnHelper(_0x2334d9){const _0x2f7f3a=a0_0x301846,_0x25a503=coreNodePtySpawnHelperPath(_0x2334d9);if(!_0x25a503||CHECKED_PTY_HELPERS[_0x2f7f3a(0x15a)](_0x25a503))return;CHECKED_PTY_HELPERS[_0x2f7f3a(0x19e)](_0x25a503);if(!fs[_0x2f7f3a(0x166)](_0x25a503)){console[_0x2f7f3a(0x1a2)]('[wrapper]\x20macOS\x20node'+_0x2f7f3a(0x173)+'t\x20found:\x20'+_0x25a503);return;}if(isExecutable(_0x25a503))return;try{const _0x3cfad7=fs['statSync'](_0x25a503)[_0x2f7f3a(0x16e)];fs[_0x2f7f3a(0x1a5)](_0x25a503,_0x3cfad7|0x1ed);}catch{}if(isExecutable(_0x25a503)){console[_0x2f7f3a(0x1a2)](_0x2f7f3a(0x191)+'S\x20node-pty\x20spawn-hel'+_0x2f7f3a(0x16f)+_0x25a503);return;}console[_0x2f7f3a(0x1a2)]('[wrapper]\x20macOS\x20node'+'-pty\x20spawn-helper\x20is'+'\x20not\x20executable:\x20'+_0x25a503),console['warn'](_0x2f7f3a(0x190)+'nce\x20to\x20fix\x20terminal/'+'PTY\x20startup:'),console['warn'](_0x2f7f3a(0x143)+shellQuote(_0x25a503)),console['warn']('\x20\x20ls\x20-l\x20\x22$HELPER\x22'),console['warn']('\x20\x20chmod\x20+x\x20\x22$HELPER\x22');}function printVersion(){const _0x28a55d=a0_0x301846;let _0x572e0e='';try{_0x572e0e=coreVersion();}catch{}console[_0x28a55d(0x13e)](_0x28a55d(0x165)+WRAPPER_VERSION),console['log']('wrapper\x20'+WRAPPER_VERSION),console['log']('core\x20'+(_0x572e0e||'not\x20installed'));}function directCore(_0x1f5ff6){const _0x40a9e5=a0_0x301846,_0x26931c=findCoreScript();checkMacNodePtySpawnHelper(_0x26931c);const _0x3998d2=(0x0,import_child_process[_0x40a9e5(0x142)])(process['execPath'],[_0x26931c,..._0x1f5ff6],{'stdio':'inherit','env':{...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_CORE_ENTRY':_0x26931c},'shell':![]});process[_0x40a9e5(0x15c)](_0x3998d2[_0x40a9e5(0x167)]??0x0);}function shouldSupervise(_0x44c73b){const _0x1d4ff8=a0_0x301846;if(_0x44c73b[_0x1d4ff8(0x158)](_0x1d4ff8(0x148)))return![];const _0x3d61c4=_0x44c73b[0x0]||'';if(_0x3d61c4==='ls'||_0x3d61c4==='status'||_0x3d61c4==='ps')return![];if(_0x3d61c4==='mcp'||_0x3d61c4==='daemon-mcp')return![];if(_0x44c73b[_0x1d4ff8(0x158)]('--help')||_0x44c73b['includes']('-h'))return![];return!![];}function installCoreVersion(_0xfec9ef){const _0x4b1668=a0_0x301846,_0x3008d5=resolveExecutable(_0x4b1668(0x183));if(!_0x3008d5)return{'ok':![],'output':'npm\x20not\x20found\x20on\x20PAT'+'H'};const _0x305c7e=CORE_PKG_NAME+'@'+_0xfec9ef,_0x4ba43d=run(_0x3008d5,['install','-g',_0x305c7e,'--registry='+NPM_REGISTRY]),_0x1f9c13=((_0x4ba43d[_0x4b1668(0x14b)]||'')+'\x0a'+(_0x4ba43d['stderr']||''))['trim']();return{'ok':_0x4ba43d['status']===0x0,'output':_0x1f9c13};}async function superviseCore(_0x33e0cc){const _0x299322=a0_0x301846;let _0x331628=![],_0x237f05=null;const _0x4f6c0b=()=>{const _0x4d4a40=a0_0xc6ed;_0x331628=!![];if(_0x237f05&&!_0x237f05['killed'])try{_0x237f05['kill'](_0x4d4a40(0x13f));}catch{}else process['exit'](0x0);};process['on'](_0x299322(0x1a1),_0x4f6c0b),process['on'](_0x299322(0x13f),_0x4f6c0b);while(!![]){const _0x46085c=findCoreScript();checkMacNodePtySpawnHelper(_0x46085c);const _0x56d653={...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_WRAPPER_MANAGED':'1','WHALENT_CORE_ENTRY':_0x46085c},_0x336b88=readUpgradeState(),_0x1f6807=!!_0x336b88?.['pending'];let _0xa00763=![],_0x36f9e6=null;console[_0x299322(0x13e)]('[wrapper]\x20starting\x20c'+_0x299322(0x175)+_0x46085c),_0x237f05=(0x0,import_child_process['spawn'])(process[_0x299322(0x17c)],[_0x46085c,..._0x33e0cc],{'env':_0x56d653,'stdio':['inherit',_0x299322(0x18c),'pipe']});const _0x12bada=()=>{const _0x1347f4=_0x299322;if(_0xa00763)return;_0xa00763=!![];if(_0x36f9e6)clearTimeout(_0x36f9e6);const _0x2d059c=readUpgradeState();_0x2d059c?.[_0x1347f4(0x198)]&&(writeUpgradeState({..._0x2d059c,'pending':![],'rollback':![],'health_status':'healthy'}),console[_0x1347f4(0x13e)]('[wrapper]\x20core\x20upgra'+'de\x20healthy:\x20'+(_0x2d059c['installed_version']||_0x2d059c[_0x1347f4(0x16b)]||'')));},_0x17f124=(_0x35208f,_0x3ce0ef=![])=>{const _0x58bddb=_0x299322,_0x55e35a=_0x35208f['toString']();(_0x3ce0ef?process[_0x58bddb(0x13c)]:process[_0x58bddb(0x14b)])['write'](_0x55e35a),(_0x55e35a['includes']('[gateway]\x20Connected')||_0x55e35a[_0x58bddb(0x158)]('Gateway\x20registered\x20m'+_0x58bddb(0x17e))||_0x55e35a['includes'](_0x58bddb(0x199)))&&_0x12bada();};_0x237f05[_0x299322(0x14b)]?.['on'](_0x299322(0x14a),_0x3db1b5=>_0x17f124(_0x3db1b5,![])),_0x237f05['stderr']?.['on'](_0x299322(0x14a),_0x4da47c=>_0x17f124(_0x4da47c,!![]));_0x1f6807&&(_0x36f9e6=setTimeout(()=>{const _0x5b0f30=_0x299322;if(_0xa00763||!_0x237f05||_0x237f05['killed'])return;console['error']('[wrapper]\x20new\x20core\x20d'+'id\x20not\x20become\x20health'+_0x5b0f30(0x172)+'ack');try{_0x237f05['kill'](_0x5b0f30(0x13f));}catch{}},HEALTH_TIMEOUT_MS));const _0x1a08f1=await new Promise(_0x1b6032=>{_0x237f05['once']('exit',(_0xe3e949,_0x1c4e10)=>_0x1b6032({'code':_0xe3e949,'signal':_0x1c4e10}));});if(_0x36f9e6)clearTimeout(_0x36f9e6);_0x237f05=null;if(_0x331628)process[_0x299322(0x15c)](_0x1a08f1['code']??0x0);const _0x52abca=readUpgradeState();if(_0x52abca?.['pending']&&!_0xa00763){const _0x36a1df=String(_0x52abca['previous_core_versio'+'n']||'')['trim']();if(_0x36a1df){console[_0x299322(0x15f)](_0x299322(0x197)+'ck\x20core\x20to\x20'+_0x36a1df);const _0x7bb400=installCoreVersion(_0x36a1df);writeUpgradeState({..._0x52abca,'pending':![],'rollback':!![],'health_status':_0x7bb400['ok']?'rolled_back':'rollback_failed','error':_0x7bb400['ok']?'':_0x7bb400['output']});}else writeUpgradeState({..._0x52abca,'pending':![],'rollback':!![],'health_status':'rollback_unavailable','error':'previous\x20core\x20versio'+_0x299322(0x164)});}const _0x47bca1=_0x1a08f1[_0x299322(0x19c)]===SUPERVISED_RESTART_CODE||_0x52abca?.[_0x299322(0x198)];if(!_0x47bca1&&_0x1a08f1[_0x299322(0x19c)]===0x0)process['exit'](0x0);console[_0x299322(0x13e)](_0x299322(0x146)+_0x299322(0x170)+(_0x1a08f1['code']??'')+(_0x1a08f1['signal']?'\x20signal='+_0x1a08f1['signal']:'')+';\x20restarting\x20in\x20'+RESTART_DELAY_MS+'ms'),await new Promise(_0x16a3ea=>setTimeout(_0x16a3ea,RESTART_DELAY_MS));}}async function main(){const _0xc5eaca=a0_0x301846,_0x3a10ed=process['argv']['slice'](0x2);if(_0x3a10ed[0x0]===_0xc5eaca(0x17b)||_0x3a10ed[0x0]==='-v'||_0x3a10ed[0x0]==='version'){printVersion();return;}if((_0x3a10ed[0x0]==='status'||_0x3a10ed[0x0]==='ls'||_0x3a10ed[0x0]==='ps')&&!_0x3a10ed['includes'](_0xc5eaca(0x141))){console[_0xc5eaca(0x13e)]('wrapper\x20'+WRAPPER_VERSION);try{console[_0xc5eaca(0x13e)]('core\x20'+(coreVersion()||'not\x20installed'));}catch{console['log']('core\x20not\x20installed');}}maybeUpdateWrapper(_0x3a10ed);if(!shouldSupervise(_0x3a10ed))directCore(_0x3a10ed);await superviseCore(_0x3a10ed);}main()[a0_0x301846(0x14d)](_0x58eddb=>{const _0x123c50=a0_0x301846;console[_0x123c50(0x15f)]('[wrapper]\x20Fatal\x20erro'+_0x123c50(0x145)+(_0x58eddb?.['message']||String(_0x58eddb))),process['exit'](0x1);});
2
+ 'use strict';const a0_0x454959=a0_0x4500;(function(_0x2816f1,_0x23176d){const _0x21d996=a0_0x4500,_0x4b9aef=_0x2816f1();while(!![]){try{const _0x2d6a9e=parseInt(_0x21d996(0x23a))/0x1*(parseInt(_0x21d996(0x22b))/0x2)+-parseInt(_0x21d996(0x217))/0x3+-parseInt(_0x21d996(0x1c1))/0x4*(-parseInt(_0x21d996(0x1f3))/0x5)+-parseInt(_0x21d996(0x1ea))/0x6+parseInt(_0x21d996(0x22d))/0x7+-parseInt(_0x21d996(0x204))/0x8+-parseInt(_0x21d996(0x1dc))/0x9*(-parseInt(_0x21d996(0x1da))/0xa);if(_0x2d6a9e===_0x23176d)break;else _0x4b9aef['push'](_0x4b9aef['shift']());}catch(_0x5c0178){_0x4b9aef['push'](_0x4b9aef['shift']());}}}(a0_0x1950,0x5a426));var __create=Object['create'],__defProp=Object['defineProperty'],__getOwnPropDesc=Object['getOwnPropertyDescri'+a0_0x454959(0x21c)],__getOwnPropNames=Object[a0_0x454959(0x1d2)],__getProtoOf=Object[a0_0x454959(0x231)],__hasOwnProp=Object['prototype'][a0_0x454959(0x1d3)],__copyProps=(_0x3df28c,_0x357a64,_0x27ce09,_0x56fcf2)=>{const _0x458af2=a0_0x454959;if(_0x357a64&&typeof _0x357a64==='object'||typeof _0x357a64===_0x458af2(0x201)){for(let _0x22df06 of __getOwnPropNames(_0x357a64))if(!__hasOwnProp['call'](_0x3df28c,_0x22df06)&&_0x22df06!==_0x27ce09)__defProp(_0x3df28c,_0x22df06,{'get':()=>_0x357a64[_0x22df06],'enumerable':!(_0x56fcf2=__getOwnPropDesc(_0x357a64,_0x22df06))||_0x56fcf2['enumerable']});}return _0x3df28c;},__toESM=(_0x4a0f88,_0x3dbc42,_0x19c068)=>(_0x19c068=_0x4a0f88!=null?__create(__getProtoOf(_0x4a0f88)):{},__copyProps(_0x3dbc42||!_0x4a0f88||!_0x4a0f88[a0_0x454959(0x238)]?__defProp(_0x19c068,'default',{'value':_0x4a0f88,'enumerable':!![]}):_0x19c068,_0x4a0f88)),import_child_process=require('child_process'),fs=__toESM(require('fs'),0x1),import_module=require('module'),os=__toESM(require('os'),0x1),path=__toESM(require(a0_0x454959(0x1e6)),0x1),WRAPPER_PKG_NAME='@whalent/agent',CORE_PKG_NAME='@whalent/agent-core',NPM_REGISTRY=a0_0x454959(0x218)+'js.org',SUPERVISED_RESTART_CODE=0x4b,NPM_VIEW_TIMEOUT_MS=0x3a98,HEALTH_TIMEOUT_MS=0xafc8,RESTART_DELAY_MS=0x3e8,NPM_INSTALL_TIMEOUT_MS=0xa*0x3c*0x3e8,NPM_INSTALL_MAX_BUFFER=0x20*0x400*0x400,WRAPPER_VERSION=readWrapperVersion(),CHECKED_PTY_HELPERS=new Set();function wrapperBaseDir(){return __dirname;}function configDir(){const _0x3d09c4=a0_0x454959;return path['join'](os[_0x3d09c4(0x226)](),'.whalent-agent');}function upgradeStatePath(){const _0x5a67f9=a0_0x454959;return path[_0x5a67f9(0x213)](configDir(),'core-upgrade.json');}function readWrapperVersion(){const _0x1fd583=a0_0x454959;try{const _0x5e3797=JSON[_0x1fd583(0x200)](fs['readFileSync'](path['join'](wrapperBaseDir(),'..',_0x1fd583(0x216)),'utf-8'));return String(_0x5e3797[_0x1fd583(0x1f9)]||'0.0.0');}catch{return _0x1fd583(0x1e2);}}function readUpgradeState(){const _0x5338c5=a0_0x454959;try{return JSON[_0x5338c5(0x200)](fs[_0x5338c5(0x210)](upgradeStatePath(),'utf-8'));}catch{return null;}}function writeUpgradeState(_0x293c9a){const _0xa651d8=a0_0x454959;try{fs[_0xa651d8(0x21b)](configDir(),{'recursive':!![]}),fs['writeFileSync'](upgradeStatePath(),JSON['stringify']({..._0x293c9a,'updated_at':Date['now']()},null,0x2),_0xa651d8(0x1c6));}catch{}}function run(_0x582114,_0x17e4ae,_0x33a354=process.env){const _0x2e0634=a0_0x454959;return(0x0,import_child_process['spawnSync'])(_0x582114,_0x17e4ae,{'encoding':_0x2e0634(0x205),'timeout':NPM_INSTALL_TIMEOUT_MS,'maxBuffer':NPM_INSTALL_MAX_BUFFER,'env':_0x33a354,'shell':![]});}function runNpmView(_0x1f191c){const _0xf3a7f6=a0_0x454959,_0x174a5d=resolveExecutable(_0xf3a7f6(0x1ed));if(!_0x174a5d)return{'status':0x7f,'stdout':'','stderr':'npm\x20not\x20found','error':new Error(_0xf3a7f6(0x1fe))};return(0x0,import_child_process[_0xf3a7f6(0x23b)])(_0x174a5d,_0x1f191c,{'encoding':'utf8','timeout':NPM_VIEW_TIMEOUT_MS,'maxBuffer':0x400*0x400,'env':process.env,'shell':![]});}function npmRootGlobal(){const _0x5d9a8d=a0_0x454959,_0x5b0a13=resolveExecutable('npm');if(!_0x5b0a13)return'';const _0x3aa430=run(_0x5b0a13,['root','-g']);if(_0x3aa430['status']!==0x0)return'';return String(_0x3aa430[_0x5d9a8d(0x203)]||'')['trim']();}function compareSemver(_0x3cf3ab,_0x1e0c08){const _0x5d1683=a0_0x454959,_0x74391f=String(_0x3cf3ab||'')['replace'](/^v/,'')['split'](/[.-]/)['map'](_0x236136=>Number['parseInt'](_0x236136,0xa)||0x0),_0x57ca30=String(_0x1e0c08||'')[_0x5d1683(0x1c2)](/^v/,'')['split'](/[.-]/)['map'](_0x87aea0=>Number['parseInt'](_0x87aea0,0xa)||0x0);for(let _0x41595a=0x0;_0x41595a<Math[_0x5d1683(0x1d4)](_0x74391f[_0x5d1683(0x1c5)],_0x57ca30['length'],0x3);_0x41595a++){const _0x4b349a=_0x74391f[_0x41595a]||0x0,_0x55f89e=_0x57ca30[_0x41595a]||0x0;if(_0x4b349a>_0x55f89e)return 0x1;if(_0x4b349a<_0x55f89e)return-0x1;}return 0x0;}function resolveExecutable(_0x7fa1bc){const _0x60f166=a0_0x454959,_0x21bd70=process[_0x60f166(0x1d1)]==='win32'?'where.exe':_0x60f166(0x215);try{const _0x5bc85a=(0x0,import_child_process[_0x60f166(0x23b)])(_0x21bd70,[_0x7fa1bc],{'encoding':_0x60f166(0x205),'timeout':0xbb8,'shell':![]});if(_0x5bc85a[_0x60f166(0x236)]!==0x0)return'';return String(_0x5bc85a[_0x60f166(0x203)]||'')['split'](/\r?\n/)['map'](_0x4b0ab0=>_0x4b0ab0[_0x60f166(0x212)]())['filter'](Boolean)[0x0]||'';}catch{return'';}}function skipWrapperUpdateCheck(){const _0x444648=a0_0x454959,_0x8f5676=String(process.env.WHALENT_SKIP_UPDATE_CHECK||process.env.WHALENT_NO_UPDATE_CHECK||process.env.WHALENT_SKIP_WRAPPER_UPDATE||'')['trim']()[_0x444648(0x1db)]();return _0x8f5676==='1'||_0x8f5676==='true'||_0x8f5676===_0x444648(0x21d)||_0x8f5676==='on';}function latestWrapperVersion(){const _0x409510=a0_0x454959,_0xf7c70a=runNpmView(['view',WRAPPER_PKG_NAME+_0x409510(0x22f),'version','--registry='+NPM_REGISTRY]);if(_0xf7c70a['status']!==0x0)return'';return String(_0xf7c70a['stdout']||'')[_0x409510(0x212)]()[_0x409510(0x224)](/\r?\n/)[_0x409510(0x1ec)](Boolean)['pop']()||'';}function installWrapperVersion(_0x56e864){const _0x546cb2=a0_0x454959,_0x130189=resolveExecutable('npm');if(!_0x130189)return{'ok':![],'output':'npm\x20not\x20found\x20on\x20PAT'+'H'};const _0x3e2725=run(_0x130189,[_0x546cb2(0x1d0),'-g',WRAPPER_PKG_NAME+'@'+_0x56e864,'--registry='+NPM_REGISTRY]),_0x4ea3bb=((_0x3e2725['stdout']||'')+'\x0a'+(_0x3e2725['stderr']||''))[_0x546cb2(0x212)]();return{'ok':_0x3e2725['status']===0x0,'output':_0x4ea3bb};}function maybeUpdateWrapper(_0x296611){const _0x545817=a0_0x454959;if(skipWrapperUpdateCheck())return![];if(process.env.WHALENT_WRAPPER_UPDATE_ATTEMPTED)return![];const _0x52c003=latestWrapperVersion();if(!_0x52c003||compareSemver(_0x52c003,WRAPPER_VERSION)<=0x0)return![];console['warn'](_0x545817(0x1eb)+'ilable:\x20'+WRAPPER_VERSION+_0x545817(0x1f0)+_0x52c003),console[_0x545817(0x1c4)](_0x545817(0x1f4)+'\x20'+WRAPPER_PKG_NAME+'@'+_0x52c003+('\x20from\x20npm\x20before\x20sta'+_0x545817(0x1e8)));const _0x586840=installWrapperVersion(_0x52c003);if(!_0x586840['ok']){console['warn']('[wrapper]\x20wrapper\x20up'+_0x545817(0x1e3)+'ing\x20with\x20'+WRAPPER_VERSION);if(_0x586840['output'])console[_0x545817(0x1c4)](_0x586840[_0x545817(0x1d8)]['split'](/\r?\n/)[_0x545817(0x1ca)](-0xc)[_0x545817(0x213)]('\x0a'));return console[_0x545817(0x1c4)]('[wrapper]\x20Manual\x20upd'+'ate:\x20npm\x20install\x20-g\x20'+WRAPPER_PKG_NAME+'@'+_0x52c003+_0x545817(0x1e5)+NPM_REGISTRY),![];}console[_0x545817(0x1c4)]('[wrapper]\x20wrapper\x20up'+'dated\x20to\x20'+_0x52c003+_0x545817(0x1c3));const _0x434ba4=process[_0x545817(0x1cc)][0x1],_0xc48678=(0x0,import_child_process['spawnSync'])(process['execPath'],[_0x434ba4,..._0x296611],{'stdio':_0x545817(0x1e7),'env':{...process.env,'WHALENT_WRAPPER_UPDATE_ATTEMPTED':_0x52c003},'shell':![]});process['exit'](_0xc48678['status']??0x0);}function findCoreScript(){const _0x4c40a1=a0_0x454959,_0x530c99=String(process.env.WHALENT_CORE_ENTRY||'')['trim']();if(_0x530c99&&fs[_0x4c40a1(0x1d9)](_0x530c99))return _0x530c99;const _0x4447f1=npmRootGlobal();if(_0x4447f1){const _0x3d2d0b=path[_0x4c40a1(0x213)](_0x4447f1,_0x4c40a1(0x1ee),_0x4c40a1(0x202),'dist','index.cjs');if(fs[_0x4c40a1(0x1d9)](_0x3d2d0b))return _0x3d2d0b;}const _0x583add=path['join'](wrapperBaseDir(),_0x4c40a1(0x208));if(fs[_0x4c40a1(0x1d9)](_0x583add))return _0x583add;const _0x23f9aa=path['join'](wrapperBaseDir(),'..','packages','core','dist','index.cjs');if(fs['existsSync'](_0x23f9aa))return _0x23f9aa;throw new Error('whalent\x20core\x20runtime'+'\x20not\x20found;\x20install\x20'+'@whalent/agent-core\x20'+'or\x20rebuild\x20@whalent/'+'agent');}function coreVersion(_0x4c5622=findCoreScript()){const _0x4bc721=a0_0x454959,_0x5993cf=(0x0,import_child_process[_0x4bc721(0x23b)])(process[_0x4bc721(0x22a)],[_0x4c5622,_0x4bc721(0x237)],{'encoding':'utf8','timeout':0x3a98,'env':{...process.env,'WHALENT_SKIP_UPDATE_CHECK':'1'},'shell':![]}),_0x10e212=(_0x5993cf['stdout']||'')+'\x0a'+(_0x5993cf['stderr']||'');return _0x10e212[_0x4bc721(0x222)](/(\d+\.\d+\.\d+(?:[-\w.]+)?)/)?.[0x1]||'';}function isExecutable(_0x63d8ea){const _0x4105e2=a0_0x454959;try{return fs[_0x4105e2(0x20c)](_0x63d8ea,fs['constants']['X_OK']),!![];}catch{return![];}}function shellQuote(_0x331954){const _0x2a1379=a0_0x454959;return'\x27'+_0x331954[_0x2a1379(0x1c2)](/'/g,'\x27\x5c\x27\x27')+'\x27';}function coreNodePtySpawnHelperPath(_0x4abc4f){const _0x5cf982=a0_0x454959;if(process['platform']!==_0x5cf982(0x1ce))return'';try{const _0x17ec0c=(0x0,import_module['createRequire'])(_0x4abc4f),_0x15a563=_0x17ec0c['resolve']('node-pty'),_0x384ba7=path[_0x5cf982(0x229)](path[_0x5cf982(0x1fa)](_0x15a563),'..');return path[_0x5cf982(0x213)](_0x384ba7,_0x5cf982(0x219),'darwin-'+process[_0x5cf982(0x1f5)],'spawn-helper');}catch{return'';}}function checkMacNodePtySpawnHelper(_0xa9bb82){const _0xd03c7a=a0_0x454959,_0x5514c2=coreNodePtySpawnHelperPath(_0xa9bb82);if(!_0x5514c2||CHECKED_PTY_HELPERS[_0xd03c7a(0x225)](_0x5514c2))return;CHECKED_PTY_HELPERS[_0xd03c7a(0x221)](_0x5514c2);if(!fs['existsSync'](_0x5514c2)){console['warn'](_0xd03c7a(0x234)+'-pty\x20spawn-helper\x20no'+'t\x20found:\x20'+_0x5514c2);return;}if(isExecutable(_0x5514c2))return;try{const _0x436cfd=fs[_0xd03c7a(0x209)](_0x5514c2)['mode'];fs['chmodSync'](_0x5514c2,_0x436cfd|0x1ed);}catch{}if(isExecutable(_0x5514c2)){console['warn'](_0xd03c7a(0x22c)+_0xd03c7a(0x207)+_0xd03c7a(0x214)+_0x5514c2);return;}console['warn']('[wrapper]\x20macOS\x20node'+_0xd03c7a(0x1e1)+_0xd03c7a(0x1d6)+_0x5514c2),console['warn'](_0xd03c7a(0x211)+'nce\x20to\x20fix\x20terminal/'+_0xd03c7a(0x22e)),console[_0xd03c7a(0x1c4)]('\x20\x20HELPER='+shellQuote(_0x5514c2)),console['warn']('\x20\x20ls\x20-l\x20\x22$HELPER\x22'),console[_0xd03c7a(0x1c4)](_0xd03c7a(0x1cb));}function printVersion(){const _0x2af000=a0_0x454959;let _0x2694ae='';try{_0x2694ae=coreVersion();}catch{}console[_0x2af000(0x20a)](_0x2af000(0x1d7)+WRAPPER_VERSION),console[_0x2af000(0x20a)](_0x2af000(0x1fd)+WRAPPER_VERSION),console[_0x2af000(0x20a)](_0x2af000(0x21a)+(_0x2694ae||_0x2af000(0x1c7)));}function a0_0x4500(_0x536442,_0x559c6b){_0x536442=_0x536442-0x1c1;const _0x1950eb=a0_0x1950();let _0x45003e=_0x1950eb[_0x536442];if(a0_0x4500['juVbmP']===undefined){var _0x5730c1=function(_0x41c3e9){const _0x17cf6d='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3df28c='',_0x357a64='';for(let _0x27ce09=0x0,_0x56fcf2,_0x22df06,_0x4a0f88=0x0;_0x22df06=_0x41c3e9['charAt'](_0x4a0f88++);~_0x22df06&&(_0x56fcf2=_0x27ce09%0x4?_0x56fcf2*0x40+_0x22df06:_0x22df06,_0x27ce09++%0x4)?_0x3df28c+=String['fromCharCode'](0xff&_0x56fcf2>>(-0x2*_0x27ce09&0x6)):0x0){_0x22df06=_0x17cf6d['indexOf'](_0x22df06);}for(let _0x3dbc42=0x0,_0x19c068=_0x3df28c['length'];_0x3dbc42<_0x19c068;_0x3dbc42++){_0x357a64+='%'+('00'+_0x3df28c['charCodeAt'](_0x3dbc42)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x357a64);};a0_0x4500['OkeSeS']=_0x5730c1,a0_0x4500['zPTDUy']={},a0_0x4500['juVbmP']=!![];}const _0x582d60=_0x1950eb[0x0],_0x3fe6f6=_0x536442+_0x582d60,_0x5f348b=a0_0x4500['zPTDUy'][_0x3fe6f6];return!_0x5f348b?(_0x45003e=a0_0x4500['OkeSeS'](_0x45003e),a0_0x4500['zPTDUy'][_0x3fe6f6]=_0x45003e):_0x45003e=_0x5f348b,_0x45003e;}function directCore(_0x5e4dd8){const _0x4e0e89=a0_0x454959,_0x27d002=findCoreScript();checkMacNodePtySpawnHelper(_0x27d002);const _0x1dff3f=(0x0,import_child_process[_0x4e0e89(0x23b)])(process['execPath'],[_0x27d002,..._0x5e4dd8],{'stdio':_0x4e0e89(0x1e7),'env':{...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_CORE_ENTRY':_0x27d002},'shell':![]});process[_0x4e0e89(0x223)](_0x1dff3f[_0x4e0e89(0x236)]??0x0);}function shouldSupervise(_0x1ab8d5){const _0x24f00c=a0_0x454959;if(_0x1ab8d5['includes'](_0x24f00c(0x1f1)))return![];const _0x166413=_0x1ab8d5[0x0]||'';if(_0x166413==='ls'||_0x166413===_0x24f00c(0x236)||_0x166413==='ps')return![];if(_0x166413===_0x24f00c(0x20e)||_0x166413==='daemon-mcp')return![];if(_0x1ab8d5['includes'](_0x24f00c(0x1f2))||_0x1ab8d5['includes']('-h'))return![];return!![];}function installCoreVersion(_0x1043ba){const _0x3b37f6=a0_0x454959,_0x5cdbf5=resolveExecutable('npm');if(!_0x5cdbf5)return{'ok':![],'output':'npm\x20not\x20found\x20on\x20PAT'+'H'};const _0xd11008=CORE_PKG_NAME+'@'+_0x1043ba,_0x8b8267=run(_0x5cdbf5,['install','-g',_0xd11008,'--registry='+NPM_REGISTRY]),_0x455d94=((_0x8b8267[_0x3b37f6(0x203)]||'')+'\x0a'+(_0x8b8267[_0x3b37f6(0x20d)]||''))['trim']();return{'ok':_0x8b8267[_0x3b37f6(0x236)]===0x0,'output':_0x455d94};}async function superviseCore(_0x159896){const _0x41b40f=a0_0x454959;let _0x191587=![],_0xfbf973=null;const _0x32991f=()=>{const _0x4c2f35=a0_0x4500;_0x191587=!![];if(_0xfbf973&&!_0xfbf973[_0x4c2f35(0x1de)])try{_0xfbf973['kill']('SIGTERM');}catch{}else process['exit'](0x0);};process['on'](_0x41b40f(0x220),_0x32991f),process['on']('SIGTERM',_0x32991f);while(!![]){const _0x10bed7=findCoreScript();checkMacNodePtySpawnHelper(_0x10bed7);const _0x2d0693={...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_WRAPPER_MANAGED':'1','WHALENT_CORE_ENTRY':_0x10bed7},_0x283b5d=readUpgradeState(),_0x18e059=!!_0x283b5d?.['pending'];let _0x2800d0=![],_0x35cc44=null;console[_0x41b40f(0x20a)](_0x41b40f(0x1f7)+'ore:\x20'+_0x10bed7),_0xfbf973=(0x0,import_child_process[_0x41b40f(0x1c9)])(process[_0x41b40f(0x22a)],[_0x10bed7,..._0x159896],{'env':_0x2d0693,'stdio':['inherit','pipe',_0x41b40f(0x21f)]});const _0x3ae79e=()=>{const _0x33ee8f=_0x41b40f;if(_0x2800d0)return;_0x2800d0=!![];if(_0x35cc44)clearTimeout(_0x35cc44);const _0x20f0b5=readUpgradeState();_0x20f0b5?.['pending']&&(writeUpgradeState({..._0x20f0b5,'pending':![],'rollback':![],'health_status':'healthy'}),console[_0x33ee8f(0x20a)](_0x33ee8f(0x227)+_0x33ee8f(0x235)+(_0x20f0b5[_0x33ee8f(0x239)]||_0x20f0b5[_0x33ee8f(0x232)]||'')));},_0x31b1c1=(_0x19527e,_0x275599=![])=>{const _0x3c0f54=_0x41b40f,_0x5f5ddc=_0x19527e['toString']();(_0x275599?process['stderr']:process['stdout'])[_0x3c0f54(0x1fc)](_0x5f5ddc),(_0x5f5ddc[_0x3c0f54(0x20f)](_0x3c0f54(0x1dd))||_0x5f5ddc['includes']('Gateway\x20registered\x20m'+_0x3c0f54(0x21e))||_0x5f5ddc['includes'](_0x3c0f54(0x1cf)))&&_0x3ae79e();};_0xfbf973['stdout']?.['on']('data',_0x17b0c4=>_0x31b1c1(_0x17b0c4,![])),_0xfbf973['stderr']?.['on']('data',_0x4f7fdb=>_0x31b1c1(_0x4f7fdb,!![]));_0x18e059&&(_0x35cc44=setTimeout(()=>{const _0x4eb113=_0x41b40f;if(_0x2800d0||!_0xfbf973||_0xfbf973[_0x4eb113(0x1de)])return;console['error']('[wrapper]\x20new\x20core\x20d'+_0x4eb113(0x23c)+_0x4eb113(0x1fb)+_0x4eb113(0x1c8));try{_0xfbf973['kill'](_0x4eb113(0x1e9));}catch{}},HEALTH_TIMEOUT_MS));const _0x28a163=await new Promise(_0x2fd061=>{const _0x47745a=_0x41b40f;_0xfbf973[_0x47745a(0x1e4)]('exit',(_0x34bdeb,_0x4ae996)=>_0x2fd061({'code':_0x34bdeb,'signal':_0x4ae996}));});if(_0x35cc44)clearTimeout(_0x35cc44);_0xfbf973=null;if(_0x191587)process['exit'](_0x28a163[_0x41b40f(0x1cd)]??0x0);const _0x1773b2=readUpgradeState();if(_0x1773b2?.[_0x41b40f(0x233)]&&!_0x2800d0){const _0x2c3c2e=String(_0x1773b2['previous_core_versio'+'n']||'')['trim']();if(_0x2c3c2e){console['error']('[wrapper]\x20rolling\x20ba'+'ck\x20core\x20to\x20'+_0x2c3c2e);const _0x36fa7d=installCoreVersion(_0x2c3c2e);writeUpgradeState({..._0x1773b2,'pending':![],'rollback':!![],'health_status':_0x36fa7d['ok']?_0x41b40f(0x206):_0x41b40f(0x1f8),'error':_0x36fa7d['ok']?'':_0x36fa7d[_0x41b40f(0x1d8)]});}else writeUpgradeState({..._0x1773b2,'pending':![],'rollback':!![],'health_status':_0x41b40f(0x1d5),'error':_0x41b40f(0x1e0)+'n\x20unknown'});}const _0xc3fcfc=_0x28a163['code']===SUPERVISED_RESTART_CODE||_0x1773b2?.[_0x41b40f(0x233)];if(!_0xc3fcfc&&_0x28a163['code']===0x0)process[_0x41b40f(0x223)](0x0);console['log']('[wrapper]\x20core\x20exite'+'d\x20code='+(_0x28a163['code']??'')+(_0x28a163[_0x41b40f(0x1df)]?'\x20signal='+_0x28a163[_0x41b40f(0x1df)]:'')+';\x20restarting\x20in\x20'+RESTART_DELAY_MS+'ms'),await new Promise(_0x8f4ec0=>setTimeout(_0x8f4ec0,RESTART_DELAY_MS));}}async function main(){const _0x2baccd=a0_0x454959,_0x4e7922=process['argv'][_0x2baccd(0x1ca)](0x2);if(_0x4e7922[0x0]==='--version'||_0x4e7922[0x0]==='-v'||_0x4e7922[0x0]===_0x2baccd(0x1f9)){printVersion();return;}if((_0x4e7922[0x0]===_0x2baccd(0x236)||_0x4e7922[0x0]==='ls'||_0x4e7922[0x0]==='ps')&&!_0x4e7922[_0x2baccd(0x20f)](_0x2baccd(0x1ef))){console[_0x2baccd(0x20a)](_0x2baccd(0x1fd)+WRAPPER_VERSION);try{console[_0x2baccd(0x20a)](_0x2baccd(0x21a)+(coreVersion()||'not\x20installed'));}catch{console['log'](_0x2baccd(0x1ff));}}maybeUpdateWrapper(_0x4e7922);if(!shouldSupervise(_0x4e7922))directCore(_0x4e7922);await superviseCore(_0x4e7922);}main()[a0_0x454959(0x20b)](_0x140174=>{const _0x9d7374=a0_0x454959;console[_0x9d7374(0x230)](_0x9d7374(0x228)+_0x9d7374(0x1f6)+(_0x140174?.['message']||String(_0x140174))),process['exit'](0x1);});function a0_0x1950(){const _0x59b873=['ig5VDcbLEgvJDxrHyMXLoIa','D2HHBgvUDc1Hz2vUDca','B3v0Chv0','zxHPC3rZu3LUyW','mZa3nZKWt3H2CKXI','Dg9mB3DLCKnHC2u','mte3t2rltM9L','w2DHDgv3yxLDienVBM5Ly3rLza','A2LSBgvK','C2LNBMfS','ChjLDMLVDxmGy29Yzsb2zxjZAw8','lxb0EsbZCgf3BI1OzwXWzxiGAxm','mc4WlJa','zgf0zsbMywLSzwq7ignVBNrPBNu','B25Jzq','ic0TCMvNAxn0CNK9','Cgf0Aa','Aw5OzxjPDa','CNrPBMCGy29Yzs4UlG','u0Lhvevstq','mZC3mJy5mNHfBvHxza','w3DYyxbWzxjDihvWzgf0zsbHDMe','zMLSDgvY','BNbT','qhDOywXLBNq','ls1QC29U','ic0+ia','ls1Hz2vUDc1Pza','ls1OzwXW','mtK4nJuXnuDzq2rTyG','w3DYyxbWzxjDigLUC3rHBgXPBMC','yxjJAa','CJOG','w3DYyxbWzxjDihn0yxj0Aw5Nigm','CM9SBgjHy2TFzMfPBgvK','DMvYC2LVBG','zgLYBMfTzq','EsbPBIb0Aw1LoYbYB2XSAw5Nigi','D3jPDgu','D3jHChbLCIa','BNbTig5VDcbMB3vUza','y29YzsbUB3qGAw5ZDgfSBgvK','CgfYC2u','zNvUy3rPB24','ywDLBNqTy29Yzq','C3rKB3v0','mZK3mZa4mhPfA0TSqG','DxrMoa','CM9SBgvKx2jHy2S','uYbUB2rLlxb0EsbZCgf3BI1OzwW','y29Yzs5JANm','C3rHDfn5BMm','Bg9N','y2f0y2G','ywnJzxnZu3LUyW','C3rKzxjY','BwnW','Aw5JBhvKzxm','CMvHzezPBgvtEw5J','w3DYyxbWzxjDifj1BIb0AgLZig8','DhjPBq','AM9PBG','CgvYigv4zwn1DgfIBguGyML0oIa','D2HPy2G','CgfJA2fNzs5QC29U','nZy3mZi4uNrjCffX','Ahr0Chm6lY9YzwDPC3rYEs5UCg0','ChjLyNvPBgrZ','y29Yzsa','BwTKAxjtEw5J','ChrVCG','EwvZ','ywnOAw5L','CgLWzq','u0Lhsu5u','ywrK','Bwf0y2G','zxHPDa','C3bSAxq','AgfZ','Ag9TzwrPCG','w3DYyxbWzxjDignVCMuGDxbNCMe','w3DYyxbWzxjDiezHDgfSigvYCM8','CMvZB2X2zq','zxHLy1bHDgG','ndC4nZa0CLLOzuL4','w3DYyxbWzxjDigzPEgvKig1Hy08','ndK5odC5mw5Wq2rerG','ufrzihn0yxj0Dxa6','qgXHDgvZDa','zxjYB3i','z2v0uhjVDg90ExbLt2y','DgfYz2v0x3zLCNnPB24','CgvUzgLUzW','w3DYyxbWzxjDig1Hy09tig5Vzgu','zguGAgvHBhrOEtOG','C3rHDhvZ','ls12zxjZAw9U','x19LC01VzhvSzq','Aw5ZDgfSBgvKx3zLCNnPB24','mvzQDgDgva','C3bHD25tEw5J','AwqGBM90igjLy29TzsbOzwfSDgG','nhntAgjgsW','CMvWBgfJzq','oYbYzxn0yxj0Aw5NihDYyxbWzxi','D2fYBG','BgvUz3rO','DxrMltG','BM90igLUC3rHBgXLza','ywnR','C3bHD24','C2XPy2u','icbJAg1VzcaREcaIjeHftfbfuIi','yxjNDG','y29Kzq','zgfYD2LU','r2f0zxDHEtOGy29UBMvJDgvK','Aw5ZDgfSBa','CgXHDgzVCM0','z2v0t3DUuhjVCgvYDhLoyw1LCW','AgfZt3DUuhjVCgvYDhK','Bwf4','CM9SBgjHy2TFDw5HDMfPBgfIBgu'];a0_0x1950=function(){return _0x59b873;};return a0_0x1950();}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whalent/agent",
3
- "version": "0.3.44",
3
+ "version": "0.3.46",
4
4
  "description": "Stable wrapper for Whalent Agent core runtime",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -38,7 +38,7 @@
38
38
  "yaml": "^2.4.0"
39
39
  },
40
40
  "optionalDependencies": {
41
- "@whalent/agent-core": "0.3.44"
41
+ "@whalent/agent-core": "0.3.46"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/node": "^20.0.0",