@whalent/agent 0.3.93 → 0.3.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +7 -7
- package/dist/index.cjs +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
'use strict';const a0_0x782f9d=a0_0x5e2b;(function(_0x32dd2a,_0x141329){const _0xa208ae=a0_0x5e2b,_0x2600e8=_0x32dd2a();while(!![]){try{const _0x2cb983=-parseInt(_0xa208ae(0x1df))/0x1*(parseInt(_0xa208ae(0x222))/0x2)+-parseInt(_0xa208ae(0x22c))/0x3+parseInt(_0xa208ae(0x22f))/0x4+parseInt(_0xa208ae(0x1fa))/0x5+parseInt(_0xa208ae(0x1bf))/0x6+-parseInt(_0xa208ae(0x21e))/0x7+-parseInt(_0xa208ae(0x1d7))/0x8*(parseInt(_0xa208ae(0x1cf))/0x9);if(_0x2cb983===_0x141329)break;else _0x2600e8['push'](_0x2600e8['shift']());}catch(_0x5d5055){_0x2600e8['push'](_0x2600e8['shift']());}}}(a0_0x46ca,0x1cbf2));var __create=Object[a0_0x782f9d(0x235)],__defProp=Object[a0_0x782f9d(0x1e7)],__getOwnPropDesc=Object[a0_0x782f9d(0x21c)+a0_0x782f9d(0x226)],__getOwnPropNames=Object['getOwnPropertyNames'],__getProtoOf=Object[a0_0x782f9d(0x1db)],__hasOwnProp=Object['prototype'][a0_0x782f9d(0x1f0)],__copyProps=(_0x2b7a39,_0xed8bb2,_0x34dd68,_0x2ebc92)=>{const _0x320509=a0_0x782f9d;if(_0xed8bb2&&typeof _0xed8bb2==='object'||typeof _0xed8bb2===_0x320509(0x1d4)){for(let _0x390f81 of __getOwnPropNames(_0xed8bb2))if(!__hasOwnProp[_0x320509(0x20b)](_0x2b7a39,_0x390f81)&&_0x390f81!==_0x34dd68)__defProp(_0x2b7a39,_0x390f81,{'get':()=>_0xed8bb2[_0x390f81],'enumerable':!(_0x2ebc92=__getOwnPropDesc(_0xed8bb2,_0x390f81))||_0x2ebc92['enumerable']});}return _0x2b7a39;},__toESM=(_0xe3e50,_0x541a4e,_0x33d6df)=>(_0x33d6df=_0xe3e50!=null?__create(__getProtoOf(_0xe3e50)):{},__copyProps(_0x541a4e||!_0xe3e50||!_0xe3e50[a0_0x782f9d(0x1c3)]?__defProp(_0x33d6df,a0_0x782f9d(0x20e),{'value':_0xe3e50,'enumerable':!![]}):_0x33d6df,_0xe3e50)),import_child_process=require(a0_0x782f9d(0x1f9)),fs=__toESM(require('fs'),0x1),import_module=require(a0_0x782f9d(0x1e6)),os=__toESM(require('os'),0x1),path=__toESM(require('path'),0x1),WRAPPER_PKG_NAME=a0_0x782f9d(0x21b),CORE_PKG_NAME=a0_0x782f9d(0x203),NPM_REGISTRY=a0_0x782f9d(0x1e1)+'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();function wrapperBaseDir(){return __dirname;}function configDir(){const _0x22df52=a0_0x782f9d;return path['join'](os[_0x22df52(0x207)](),'.whalent-agent');}function upgradeStatePath(){return path['join'](configDir(),'core-upgrade.json');}function lastCrashFilePath(){const _0x2c6070=a0_0x782f9d;return path['join'](configDir(),_0x2c6070(0x1bb));}function writeLastCrash(_0x8973b4){const _0x5106bf=a0_0x782f9d;try{fs['mkdirSync'](configDir(),{'recursive':!![]});const _0x398159={..._0x8973b4,'reported':![]};fs[_0x5106bf(0x1c6)](lastCrashFilePath(),JSON[_0x5106bf(0x1ba)](_0x398159,null,0x2),'utf-8');}catch{}}function readWrapperVersion(){const _0x4f7373=a0_0x782f9d;try{const _0x111479=JSON['parse'](fs[_0x4f7373(0x211)](path['join'](wrapperBaseDir(),'..','package.json'),'utf-8'));return String(_0x111479[_0x4f7373(0x238)]||_0x4f7373(0x1de));}catch{return _0x4f7373(0x1de);}}function readUpgradeState(){const _0x1c1eac=a0_0x782f9d;try{return JSON['parse'](fs[_0x1c1eac(0x211)](upgradeStatePath(),'utf-8'));}catch{return null;}}function writeUpgradeState(_0x55d404){const _0x1541bb=a0_0x782f9d;try{fs['mkdirSync'](configDir(),{'recursive':!![]}),fs[_0x1541bb(0x1c6)](upgradeStatePath(),JSON['stringify']({..._0x55d404,'updated_at':Date['now']()},null,0x2),_0x1541bb(0x204));}catch{}}function a0_0x5e2b(_0xb5ad1f,_0x5e0198){_0xb5ad1f=_0xb5ad1f-0x1ac;const _0x46ca2a=a0_0x46ca();let _0x5e2bf2=_0x46ca2a[_0xb5ad1f];if(a0_0x5e2b['cZmini']===undefined){var _0x4eac47=function(_0x4a2e1e){const _0x354ae8='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2b7a39='',_0xed8bb2='';for(let _0x34dd68=0x0,_0x2ebc92,_0x390f81,_0xe3e50=0x0;_0x390f81=_0x4a2e1e['charAt'](_0xe3e50++);~_0x390f81&&(_0x2ebc92=_0x34dd68%0x4?_0x2ebc92*0x40+_0x390f81:_0x390f81,_0x34dd68++%0x4)?_0x2b7a39+=String['fromCharCode'](0xff&_0x2ebc92>>(-0x2*_0x34dd68&0x6)):0x0){_0x390f81=_0x354ae8['indexOf'](_0x390f81);}for(let _0x541a4e=0x0,_0x33d6df=_0x2b7a39['length'];_0x541a4e<_0x33d6df;_0x541a4e++){_0xed8bb2+='%'+('00'+_0x2b7a39['charCodeAt'](_0x541a4e)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xed8bb2);};a0_0x5e2b['FdyZOa']=_0x4eac47,a0_0x5e2b['GthUmJ']={},a0_0x5e2b['cZmini']=!![];}const _0x20b758=_0x46ca2a[0x0],_0x127aae=_0xb5ad1f+_0x20b758,_0x318b62=a0_0x5e2b['GthUmJ'][_0x127aae];return!_0x318b62?(_0x5e2bf2=a0_0x5e2b['FdyZOa'](_0x5e2bf2),a0_0x5e2b['GthUmJ'][_0x127aae]=_0x5e2bf2):_0x5e2bf2=_0x318b62,_0x5e2bf2;}function run(_0x4ce36d,_0x5a8ac7,_0x49b0c9=process.env){const _0x449404=a0_0x782f9d;return(0x0,import_child_process['spawnSync'])(_0x4ce36d,_0x5a8ac7,{'encoding':_0x449404(0x1b6),'timeout':NPM_INSTALL_TIMEOUT_MS,'maxBuffer':NPM_INSTALL_MAX_BUFFER,'env':_0x49b0c9,'shell':![]});}function runNpmView(_0x1ffa42){const _0x5d7641=a0_0x782f9d,_0x28d979=resolveExecutable('npm');if(!_0x28d979)return{'status':0x7f,'stdout':'','stderr':_0x5d7641(0x236),'error':new Error(_0x5d7641(0x236))};return(0x0,import_child_process['spawnSync'])(_0x28d979,_0x1ffa42,{'encoding':_0x5d7641(0x1b6),'timeout':NPM_VIEW_TIMEOUT_MS,'maxBuffer':0x400*0x400,'env':process.env,'shell':![]});}function npmRootGlobal(){const _0x4e2999=a0_0x782f9d,_0x29ae1f=resolveExecutable('npm');if(!_0x29ae1f)return'';const _0x45429b=run(_0x29ae1f,[_0x4e2999(0x1ec),'-g']);if(_0x45429b[_0x4e2999(0x1ea)]!==0x0)return'';return String(_0x45429b['stdout']||'')[_0x4e2999(0x221)]();}function compareSemver(_0x33f2e0,_0x4a32e6){const _0x2b48e3=a0_0x782f9d,_0x1bb39a=String(_0x33f2e0||'')[_0x2b48e3(0x1ae)](/^v/,'')[_0x2b48e3(0x1ad)](/[.-]/)['map'](_0x42956c=>Number['parseInt'](_0x42956c,0xa)||0x0),_0xd39f80=String(_0x4a32e6||'')[_0x2b48e3(0x1ae)](/^v/,'')['split'](/[.-]/)['map'](_0x5d67d2=>Number['parseInt'](_0x5d67d2,0xa)||0x0);for(let _0x1e3431=0x0;_0x1e3431<Math[_0x2b48e3(0x1f3)](_0x1bb39a[_0x2b48e3(0x1d2)],_0xd39f80[_0x2b48e3(0x1d2)],0x3);_0x1e3431++){const _0x2ea391=_0x1bb39a[_0x1e3431]||0x0,_0x1d57ea=_0xd39f80[_0x1e3431]||0x0;if(_0x2ea391>_0x1d57ea)return 0x1;if(_0x2ea391<_0x1d57ea)return-0x1;}return 0x0;}function resolveExecutable(_0x36c08d){const _0x469c01=a0_0x782f9d,_0x2e1ec1=process[_0x469c01(0x1c2)]===_0x469c01(0x1e5)?'where.exe':_0x469c01(0x228);try{const _0x3f1901=(0x0,import_child_process[_0x469c01(0x210)])(_0x2e1ec1,[_0x36c08d],{'encoding':_0x469c01(0x1b6),'timeout':0xbb8,'shell':![]});if(_0x3f1901['status']!==0x0)return'';return String(_0x3f1901[_0x469c01(0x1c0)]||'')['split'](/\r?\n/)['map'](_0x34c8cc=>_0x34c8cc[_0x469c01(0x221)]())[_0x469c01(0x202)](Boolean)[0x0]||'';}catch{return'';}}function skipWrapperUpdateCheck(){const _0x43c004=a0_0x782f9d,_0x5ef0b8=String(process.env.WHALENT_SKIP_UPDATE_CHECK||process.env.WHALENT_NO_UPDATE_CHECK||process.env.WHALENT_SKIP_WRAPPER_UPDATE||'')['trim']()['toLowerCase']();return _0x5ef0b8==='1'||_0x5ef0b8===_0x43c004(0x1cd)||_0x5ef0b8===_0x43c004(0x225)||_0x5ef0b8==='on';}function latestWrapperVersion(){const _0xa8bcc6=a0_0x782f9d,_0x1fcd6f=runNpmView(['view',WRAPPER_PKG_NAME+'@latest',_0xa8bcc6(0x238),_0xa8bcc6(0x1b7)+NPM_REGISTRY]);if(_0x1fcd6f[_0xa8bcc6(0x1ea)]!==0x0)return'';return String(_0x1fcd6f['stdout']||'')[_0xa8bcc6(0x221)]()['split'](/\r?\n/)[_0xa8bcc6(0x202)](Boolean)[_0xa8bcc6(0x1e0)]()||'';}function installWrapperVersion(_0x5ecbea){const _0x28bff6=a0_0x782f9d,_0x4195ca=resolveExecutable(_0x28bff6(0x1ef));if(!_0x4195ca)return{'ok':![],'output':'npm\x20not\x20found\x20on\x20PAT'+'H'};const _0x4362fd=run(_0x4195ca,['install','-g',WRAPPER_PKG_NAME+'@'+_0x5ecbea,_0x28bff6(0x1b7)+NPM_REGISTRY]),_0xc7d83c=((_0x4362fd[_0x28bff6(0x1c0)]||'')+'\x0a'+(_0x4362fd[_0x28bff6(0x1d0)]||''))['trim']();return{'ok':_0x4362fd['status']===0x0,'output':_0xc7d83c};}function maybeUpdateWrapper(_0x17b793){const _0x2ae1d6=a0_0x782f9d;if(skipWrapperUpdateCheck())return![];if(process.env.WHALENT_WRAPPER_UPDATE_ATTEMPTED)return![];const _0x77d385=latestWrapperVersion();if(!_0x77d385||compareSemver(_0x77d385,WRAPPER_VERSION)<=0x0)return![];console[_0x2ae1d6(0x1bd)]('[wrapper]\x20update\x20ava'+_0x2ae1d6(0x1e9)+WRAPPER_VERSION+'\x20->\x20'+_0x77d385),console['warn'](_0x2ae1d6(0x218)+'\x20'+WRAPPER_PKG_NAME+'@'+_0x77d385+('\x20from\x20npm\x20before\x20sta'+'rting\x20core...'));const _0x129c99=installWrapperVersion(_0x77d385);if(!_0x129c99['ok']){console['warn'](_0x2ae1d6(0x1d6)+_0x2ae1d6(0x231)+_0x2ae1d6(0x1dd)+WRAPPER_VERSION);if(_0x129c99[_0x2ae1d6(0x223)])console['warn'](_0x129c99[_0x2ae1d6(0x223)][_0x2ae1d6(0x1ad)](/\r?\n/)['slice'](-0xc)['join']('\x0a'));return console[_0x2ae1d6(0x1bd)]('[wrapper]\x20Manual\x20upd'+_0x2ae1d6(0x21f)+WRAPPER_PKG_NAME+'@'+_0x77d385+'\x20--registry='+NPM_REGISTRY),![];}console['warn']('[wrapper]\x20wrapper\x20up'+'dated\x20to\x20'+_0x77d385+_0x2ae1d6(0x216));const _0x2bd08a=process['argv'][0x1],_0xc7e6af=(0x0,import_child_process['spawnSync'])(process['execPath'],[_0x2bd08a,..._0x17b793],{'stdio':_0x2ae1d6(0x1e3),'env':{...process.env,'WHALENT_WRAPPER_UPDATE_ATTEMPTED':_0x77d385},'shell':![]});process[_0x2ae1d6(0x1cc)](_0xc7e6af['status']??0x0);}function findCoreScript(){const _0x262a28=a0_0x782f9d,_0x49a852=String(process.env.WHALENT_CORE_ENTRY||'')['trim'](),_0x4de993=['1',_0x262a28(0x1cd),_0x262a28(0x225),'on'][_0x262a28(0x213)](String(process.env.WHALENT_FORCE_CORE_ENTRY||'')[_0x262a28(0x221)]()[_0x262a28(0x1c8)]());if(_0x49a852&&_0x4de993&&fs['existsSync'](_0x49a852))return _0x49a852;const _0x125e49=[],_0x589ac8=_0x38c17f=>{const _0xf21328=_0x262a28;if(fs['existsSync'](_0x38c17f)&&!_0x125e49[_0xf21328(0x213)](_0x38c17f))_0x125e49[_0xf21328(0x212)](_0x38c17f);};if(_0x49a852)_0x589ac8(_0x49a852);const _0x443ce0=npmRootGlobal();if(_0x443ce0){const _0x4cb5a5=path['join'](_0x443ce0,_0x262a28(0x1ac),'agent-core','dist','index.cjs');_0x589ac8(_0x4cb5a5);}const _0x185653=path[_0x262a28(0x1f4)](wrapperBaseDir(),'core.cjs');_0x589ac8(_0x185653);const _0x363694=path['join'](wrapperBaseDir(),'..','packages','core','dist',_0x262a28(0x205));_0x589ac8(_0x363694);if(_0x125e49[_0x262a28(0x1d2)]>0x0)return _0x125e49[_0x262a28(0x1c5)]((_0x57eef1,_0x170a3a)=>({'candidate':_0x57eef1,'index':_0x170a3a,'version':coreVersion(_0x57eef1)}))[_0x262a28(0x1ed)]((_0x4401a5,_0x3bc24a)=>{const _0x13ed8c=_0x262a28,_0x57361e=compareSemver(_0x3bc24a['version'],_0x4401a5[_0x13ed8c(0x238)]);if(_0x57361e!==0x0)return _0x57361e;return _0x3bc24a[_0x13ed8c(0x1f5)]-_0x4401a5['index'];})[0x0][_0x262a28(0x1f7)];throw new Error(_0x262a28(0x1d8)+_0x262a28(0x1ce)+'@whalent/agent-core\x20'+'or\x20rebuild\x20@whalent/'+_0x262a28(0x1cb));}function coreVersion(_0x3f2cbe=findCoreScript()){const _0x2b5afc=a0_0x782f9d,_0x5e4428=(0x0,import_child_process['spawnSync'])(process[_0x2b5afc(0x1e2)],[_0x3f2cbe,'--version'],{'encoding':'utf8','timeout':0x3a98,'env':{...process.env,'WHALENT_SKIP_UPDATE_CHECK':'1'},'shell':![]}),_0x58f66b=(_0x5e4428['stdout']||'')+'\x0a'+(_0x5e4428[_0x2b5afc(0x1d0)]||'');return _0x58f66b['match'](/(\d+\.\d+\.\d+(?:[-\w.]+)?)/)?.[0x1]||'';}function isExecutable(_0x218bc4){const _0x521fae=a0_0x782f9d;try{return fs['accessSync'](_0x218bc4,fs[_0x521fae(0x230)]['X_OK']),!![];}catch{return![];}}function shellQuote(_0x13c18a){const _0x59ea80=a0_0x782f9d;return'\x27'+_0x13c18a[_0x59ea80(0x1ae)](/'/g,_0x59ea80(0x21d))+'\x27';}function coreNodePtySpawnHelperPath(_0x45c82d){const _0x625a70=a0_0x782f9d;if(process[_0x625a70(0x1c2)]!=='darwin')return'';try{const _0x3232d8=(0x0,import_module['createRequire'])(_0x45c82d),_0x2017a4=_0x3232d8['resolve'](_0x625a70(0x1ee)),_0x40fe47=path[_0x625a70(0x234)](path[_0x625a70(0x1b3)](_0x2017a4),'..');return path['join'](_0x40fe47,_0x625a70(0x21a),'darwin-'+process['arch'],_0x625a70(0x1eb));}catch{return'';}}function checkMacNodePtySpawnHelper(_0x278e93){const _0x47157d=a0_0x782f9d,_0xa46feb=coreNodePtySpawnHelperPath(_0x278e93);if(!_0xa46feb||CHECKED_PTY_HELPERS[_0x47157d(0x20c)](_0xa46feb))return;CHECKED_PTY_HELPERS['add'](_0xa46feb);if(!fs['existsSync'](_0xa46feb)){console[_0x47157d(0x1bd)]('[wrapper]\x20macOS\x20node'+'-pty\x20spawn-helper\x20no'+'t\x20found:\x20'+_0xa46feb);return;}if(isExecutable(_0xa46feb))return;try{const _0x293f14=fs['statSync'](_0xa46feb)[_0x47157d(0x1b8)];fs[_0x47157d(0x1f6)](_0xa46feb,_0x293f14|0x1ed);}catch{}if(isExecutable(_0xa46feb)){console['warn'](_0x47157d(0x220)+'S\x20node-pty\x20spawn-hel'+'per\x20executable\x20bit:\x20'+_0xa46feb);return;}console['warn'](_0x47157d(0x1b9)+_0x47157d(0x206)+'\x20not\x20executable:\x20'+_0xa46feb),console[_0x47157d(0x1bd)](_0x47157d(0x1c4)+_0x47157d(0x233)+_0x47157d(0x1c1)),console[_0x47157d(0x1bd)](_0x47157d(0x1d9)+shellQuote(_0xa46feb)),console['warn'](_0x47157d(0x1d5)),console['warn'](_0x47157d(0x1d3));}function printVersion(){const _0x1fea93=a0_0x782f9d;let _0xb14e15='';try{_0xb14e15=coreVersion();}catch{}console[_0x1fea93(0x1c7)](_0x1fea93(0x200)+WRAPPER_VERSION),console[_0x1fea93(0x1c7)]('wrapper\x20'+WRAPPER_VERSION),console[_0x1fea93(0x1c7)](_0x1fea93(0x224)+(_0xb14e15||_0x1fea93(0x1f8)));}function a0_0x46ca(){const _0x289b7b=['Bwf4','AM9PBG','Aw5KzxG','y2HTB2rtEw5J','y2fUzgLKyxrL','BM90igLUC3rHBgXLza','y2HPBgrFChjVy2vZCW','nZmYmJqWEM1kvwnc','zxjSEwLUzYbPC3n1zsbPCYbMAxG','C2HPzNq','w3DYyxbWzxjDiezHDgfSigvYCM8','CgvUzgLUzW','ls1Yzxn1Bwu','D2HHBgvUDc1Hz2vUDca','BIb1BMTUB3DU','zMLSDgvY','qhDOywXLBNqVywDLBNqTy29Yzq','DxrMltG','Aw5KzxGUy2PZ','lxb0EsbZCgf3BI1OzwXWzxiGAxm','Ag9TzwrPCG','r2f0zxDHEtOGy29UBMvJDgvK','D3jHChbLCIa','y2f0y2G','y2fSBa','AgfZ','yxjNDG','zgvMyxvSDa','y29Kzq','C3bHD25tEw5J','CMvHzezPBgvtEw5J','ChvZAa','Aw5JBhvKzxm','zcbJB2rLpq','A2LSBa','oYbYzxn0yxj0Aw5NihDYyxbWzxi','CM9SBgvKx2jHy2S','w3DYyxbWzxjDigLUC3rHBgXPBMC','CZSGz2L2Aw5NihvWlIbdCMfZAca','ChjLyNvPBgrZ','qhDOywXLBNqVywDLBNq','z2v0t3DUuhjVCgvYDhLezxnJCMK','j1WNjW','mtuWnZeWmejby1LgtW','yxrLoIbUCg0GAw5ZDgfSBcaTzYa','w3DYyxbWzxjDigzPEgvKig1Hy08','DhjPBq','otm0nNnlsg5mqq','B3v0Chv0','y29Yzsa','EwvZ','ChrVCG','zxjYB3i','D2HPy2G','ChjLDMLVDxnFy29Yzv92zxjZAw8','Aw5ZDgfSBa','w3DYyxbWzxjDigXHC3qGzMf0ywW','mti0nte4AuvgD1fO','D3jPDgu','r2f0zxDHEsbYzwDPC3rLCMvKig0','odqZmJm2uMzdsKDk','y29UC3rHBNrZ','zgf0zsbMywLSzwq7ignVBNrPBNu','zgf0yq','BMnLihrVigzPEcb0zxjTAw5HBc8','CMvZB2X2zq','y3jLyxrL','BNbTig5VDcbMB3vUza','CM9SBgjHy2TFzMfPBgvK','DMvYC2LVBG','qhDOywXLBNq','C3bSAxq','CMvWBgfJzq','w3DYyxbWzxjDignVCMuGzxHPDgu','CM91BMq','BwnW','ihrPBwvZihDPDgHPBIa','zgLYBMfTzq','Aw5ZDgfSBgvKx3zLCNnPB24','w3DYyxbWzxjDignVCMuGzMfPBgu','DxrMoa','ls1YzwDPC3rYEt0','Bw9Kzq','w3DYyxbWzxjDig1Hy09tig5Vzgu','C3rYAw5NAwz5','BgfZDc1JCMfZAc5QC29U','DgfYz2v0x3zLCNnPB24','D2fYBG','C3bHD24','mte0ote1mezAsev3zW','C3rKB3v0','ufrzihn0yxj0Dxa6','CgXHDgzVCM0','x19LC01VzhvSzq','w3DYyxbWzxjDifj1BIb0AgLZig8','BwfW','D3jPDgvgAwXLu3LUyW','Bg9N','Dg9mB3DLCKnHC2u','A2LSBgvK','B25Jzq','ywDLBNq','zxHPDa','Dhj1zq','ig5VDcbMB3vUzdSGAw5ZDgfSBca','mteXmtiZDLzrA3H0','C3rKzxjY','zgfLBw9Ulw1JCa','BgvUz3rO','icbJAg1VzcaREcaIjeHftfbfuIi','zNvUy3rPB24','icbSCYaTBcaIjeHftfbfuIi','w3DYyxbWzxjDihDYyxbWzxiGDxa','mtzMww1Ltxm','D2HHBgvUDcbJB3jLihj1BNrPBwu','icbiruXqrvi9','w3DYyxbWzxjDig5LDYbJB3jLigq','z2v0uhjVDg90ExbLt2y','BM93','Aw5NihDPDgGG','mc4WlJa','mZjWyLvYqMm','Cg9W','Ahr0Chm6lY9YzwDPC3rYEs5UCg0','zxHLy1bHDgG','Aw5OzxjPDa','y2SGy29Yzsb0BYa','D2LUmZi','Bw9KDwXL','zgvMAw5LuhjVCgvYDhK','BwvZC2fNzq','AwXHyMXLoIa','C3rHDhvZ','C3bHD24TAgvSCgvY','CM9VDa','C29YDa','BM9Kzs1WDhK','BNbT','AgfZt3DUuhjVCgvYDhK','u0Lhvevstq','BwLU'];a0_0x46ca=function(){return _0x289b7b;};return a0_0x46ca();}function directCore(_0x53443e){const _0x55f064=a0_0x782f9d,_0x1337e6=findCoreScript();checkMacNodePtySpawnHelper(_0x1337e6);const _0x599841=(0x0,import_child_process[_0x55f064(0x210)])(process[_0x55f064(0x1e2)],[_0x1337e6,..._0x53443e],{'stdio':_0x55f064(0x1e3),'env':{...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_CORE_ENTRY':_0x1337e6},'shell':![]});process[_0x55f064(0x1cc)](_0x599841['status']??0x0);}function shouldSupervise(_0x5d4115){const _0x25b95b=a0_0x782f9d;if(_0x5d4115['includes']('--agent-id'))return![];if(_0x5d4115['includes'](_0x25b95b(0x1ff))||_0x5d4115[0x0]==='resume')return![];const _0x1c890d=_0x5d4115[0x0]||'';if(_0x1c890d==='ls'||_0x1c890d===_0x25b95b(0x1ea)||_0x1c890d==='ps')return![];if(_0x1c890d===_0x25b95b(0x1b1)||_0x1c890d===_0x25b95b(0x1d1))return![];if(_0x5d4115[_0x25b95b(0x213)]('--help')||_0x5d4115['includes']('-h'))return![];return!![];}function installCoreVersion(_0x59c2de){const _0x50c8eb=a0_0x782f9d,_0x11c0c9=resolveExecutable(_0x50c8eb(0x1ef));if(!_0x11c0c9)return{'ok':![],'output':'npm\x20not\x20found\x20on\x20PAT'+'H'};const _0x1a4c14=CORE_PKG_NAME+'@'+_0x59c2de,_0x65f88a=run(_0x11c0c9,[_0x50c8eb(0x22a),'-g',_0x1a4c14,_0x50c8eb(0x1b7)+NPM_REGISTRY]),_0x101f23=((_0x65f88a[_0x50c8eb(0x1c0)]||'')+'\x0a'+(_0x65f88a['stderr']||''))[_0x50c8eb(0x221)]();return{'ok':_0x65f88a[_0x50c8eb(0x1ea)]===0x0,'output':_0x101f23};}async function superviseCore(_0x495278){const _0x92becd=a0_0x782f9d;let _0x1d1f76=![],_0x286adc=null;const _0x3a69af=[];let _0x31bfdd=MIN_RESTART_DELAY_MS;const _0xb82b02=()=>{const _0x235499=a0_0x5e2b;_0x1d1f76=!![];if(_0x286adc&&!_0x286adc[_0x235499(0x1c9)])try{_0x286adc[_0x235499(0x215)](_0x235499(0x1f1));}catch{}else process[_0x235499(0x1cc)](0x0);};process['on']('SIGINT',_0xb82b02),process['on'](_0x92becd(0x1f1),_0xb82b02);while(!![]){const _0x315ce7=findCoreScript();checkMacNodePtySpawnHelper(_0x315ce7);const _0x2df926={...process.env,'WHALENT_WRAPPER_VERSION':WRAPPER_VERSION,'WHALENT_WRAPPER_MANAGED':'1','WHALENT_CORE_ENTRY':_0x315ce7},_0x33e927=readUpgradeState(),_0x11b82d=!!_0x33e927?.[_0x92becd(0x1fe)];let _0x561405=![],_0x1dda67=null,_0x33efc0='';const _0x1809a2=[],_0x2c8275=0xc;console[_0x92becd(0x1c7)]('[wrapper]\x20starting\x20c'+'ore:\x20'+_0x315ce7),_0x286adc=(0x0,import_child_process[_0x92becd(0x1be)])(process[_0x92becd(0x1e2)],[_0x315ce7,..._0x495278],{'env':_0x2df926,'stdio':[_0x92becd(0x1e3),'pipe','pipe']});const _0x21ab81=()=>{const _0x1cf994=_0x92becd;if(_0x561405)return;_0x561405=!![];if(_0x1dda67)clearTimeout(_0x1dda67);_0x3a69af['length']=0x0,_0x31bfdd=MIN_RESTART_DELAY_MS;const _0xbd5dc6=readUpgradeState();_0xbd5dc6?.['pending']&&(writeUpgradeState({..._0xbd5dc6,'pending':![],'rollback':![],'health_status':'healthy'}),console['log']('[wrapper]\x20core\x20upgra'+'de\x20healthy:\x20'+(_0xbd5dc6[_0x1cf994(0x1b4)]||_0xbd5dc6[_0x1cf994(0x1bc)]||'')));},_0x2a1bd4=(_0x595553,_0x3f5c41=![])=>{const _0x286883=_0x92becd,_0x2edfb6=_0x595553['toString']();(_0x3f5c41?process['stderr']:process['stdout'])[_0x286883(0x22d)](_0x2edfb6);if(_0x3f5c41)for(const _0x26afa4 of _0x2edfb6[_0x286883(0x1ad)](/\r?\n/)){if(!_0x26afa4[_0x286883(0x221)]())continue;_0x1809a2[_0x286883(0x212)](_0x26afa4);if(_0x1809a2[_0x286883(0x1d2)]>_0x2c8275)_0x1809a2['shift']();const _0x461893=_0x26afa4['match'](FATAL_PATTERN);if(_0x461893)_0x33efc0=_0x461893[0x0];}(_0x2edfb6['includes']('[gateway]\x20Connected')||_0x2edfb6['includes'](_0x286883(0x22e)+'achine')||_0x2edfb6[_0x286883(0x213)](_0x286883(0x208)))&&_0x21ab81();};_0x286adc['stdout']?.['on'](_0x92becd(0x232),_0x4cd1fa=>_0x2a1bd4(_0x4cd1fa,![])),_0x286adc['stderr']?.['on'](_0x92becd(0x232),_0x493265=>_0x2a1bd4(_0x493265,!![]));_0x11b82d&&(_0x1dda67=setTimeout(()=>{const _0x3a4be6=_0x92becd;if(_0x561405||!_0x286adc||_0x286adc['killed'])return;console['error'](_0x3a4be6(0x1da)+'id\x20not\x20become\x20health'+'y\x20in\x20time;\x20rolling\x20b'+'ack');try{_0x286adc['kill']('SIGTERM');}catch{}},HEALTH_TIMEOUT_MS));const _0x543504=await new Promise(_0x3ede38=>{const _0x1a4472=_0x92becd;_0x286adc[_0x1a4472(0x1ca)](_0x1a4472(0x1cc),(_0x49ddd0,_0x3176cd)=>_0x3ede38({'code':_0x49ddd0,'signal':_0x3176cd}));});if(_0x1dda67)clearTimeout(_0x1dda67);_0x286adc=null;if(_0x1d1f76)process['exit'](_0x543504[_0x92becd(0x20f)]??0x0);const _0x43f4c7=readUpgradeState();if(_0x43f4c7?.[_0x92becd(0x1fe)]&&!_0x561405){const _0x7dd2de=String(_0x43f4c7[_0x92becd(0x229)+'n']||'')['trim']();if(_0x7dd2de){console['error']('[wrapper]\x20rolling\x20ba'+_0x92becd(0x1e4)+_0x7dd2de);const _0x346842=installCoreVersion(_0x7dd2de);writeUpgradeState({..._0x43f4c7,'pending':![],'rollback':!![],'health_status':_0x346842['ok']?_0x92becd(0x217):_0x92becd(0x237),'error':_0x346842['ok']?'':_0x346842['output']});}else writeUpgradeState({..._0x43f4c7,'pending':![],'rollback':!![],'health_status':'rollback_unavailable','error':'previous\x20core\x20versio'+_0x92becd(0x201)});}const _0x10e89c=_0x543504['code']===SUPERVISED_RESTART_CODE||_0x43f4c7?.[_0x92becd(0x1fe)];if(!_0x10e89c&&_0x543504[_0x92becd(0x20f)]===0x0)process['exit'](0x0);const _0xcd7ae6=Date[_0x92becd(0x1dc)]();_0x3a69af[_0x92becd(0x212)](_0xcd7ae6);while(_0x3a69af[_0x92becd(0x1d2)]>0x0&&_0xcd7ae6-_0x3a69af[0x0]>CRASH_WINDOW_MS){_0x3a69af[_0x92becd(0x1fc)]();}const _0x20df5e=_0x3a69af['length'];writeLastCrash({'timestamp':_0xcd7ae6,'exit_code':_0x543504[_0x92becd(0x20f)],'exit_signal':_0x543504['signal']||null,'fatal_line':_0x33efc0,'raw_tail':_0x1809a2['join']('\x0a'),'consecutive_crashes':_0x20df5e}),console[_0x92becd(0x1c7)](_0x92becd(0x1af)+_0x92becd(0x214)+(_0x543504[_0x92becd(0x20f)]??'')+(_0x543504['signal']?'\x20signal='+_0x543504['signal']:'')+'\x20('+_0x20df5e+'/'+MAX_CRASHES_IN_WINDOW+'\x20in\x20last\x20'+Math[_0x92becd(0x1b0)](CRASH_WINDOW_MS/0x3e8)+'s)');if(_0x33efc0)console['log'](_0x92becd(0x22b)+':\x20'+_0x33efc0);_0x20df5e>=MAX_CRASHES_IN_WINDOW&&(console[_0x92becd(0x227)](_0x92becd(0x1b5)+'d\x20'+_0x20df5e+_0x92becd(0x1b2)+Math[_0x92becd(0x1b0)](CRASH_WINDOW_MS/0x3e8)+(_0x92becd(0x219)+'record:\x20')+lastCrashFilePath()+('.\x20Restart\x20wrapper\x20ma'+'nually\x20after\x20the\x20und'+_0x92becd(0x1fb)+'ed.')),process['exit'](0x1)),console['log']('[wrapper]\x20restarting'+'\x20in\x20'+_0x31bfdd+'ms'),await new Promise(_0x298e54=>setTimeout(_0x298e54,_0x31bfdd)),_0x31bfdd=Math[_0x92becd(0x1f2)](_0x31bfdd*0x2,MAX_RESTART_DELAY_MS);}}async function main(){const _0x149301=a0_0x782f9d,_0x2e25c8=process[_0x149301(0x20d)]['slice'](0x2);if(_0x2e25c8[0x0]==='--version'||_0x2e25c8[0x0]==='-v'||_0x2e25c8[0x0]==='version'){printVersion();return;}if((_0x2e25c8[0x0]==='status'||_0x2e25c8[0x0]==='ls'||_0x2e25c8[0x0]==='ps')&&!_0x2e25c8['includes']('--json')){console[_0x149301(0x1c7)](_0x149301(0x209)+WRAPPER_VERSION);try{console['log'](_0x149301(0x224)+(coreVersion()||'not\x20installed'));}catch{console['log']('core\x20not\x20installed');}}maybeUpdateWrapper(_0x2e25c8);if(!shouldSupervise(_0x2e25c8))directCore(_0x2e25c8);await superviseCore(_0x2e25c8);}main()[a0_0x782f9d(0x20a)](_0x7b0484=>{const _0x2695eb=a0_0x782f9d;console[_0x2695eb(0x227)](_0x2695eb(0x1fd)+'r:\x20'+(_0x7b0484?.[_0x2695eb(0x1e8)]||String(_0x7b0484))),process[_0x2695eb(0x1cc)](0x1);});
|
|
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);});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whalent/agent",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.94",
|
|
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.
|
|
45
|
+
"@whalent/agent-core": "0.3.94"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/node": "^20.0.0",
|