apt-mcp-agent-setup 1.2.0 → 1.2.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 _0x2b0ea7=_0x235a;(function(_0x5cec3b,_0x2936a2){const _0x489c2e=_0x235a,_0x89cac6=_0x5cec3b();while(!![]){try{const _0x26bb02=parseInt(_0x489c2e(0x144))/0x1*(parseInt(_0x489c2e(0x147))/0x2)+parseInt(_0x489c2e(0x11f))/0x3*(parseInt(_0x489c2e(0x121))/0x4)+-parseInt(_0x489c2e(0x177))/0x5+parseInt(_0x489c2e(0x138))/0x6+parseInt(_0x489c2e(0x10d))/0x7+parseInt(_0x489c2e(0x12e))/0x8*(-parseInt(_0x489c2e(0x12d))/0x9)+-parseInt(_0x489c2e(0x109))/0xa*(parseInt(_0x489c2e(0x127))/0xb);if(_0x26bb02===_0x2936a2)break;else _0x89cac6['push'](_0x89cac6['shift']());}catch(_0x14280e){_0x89cac6['push'](_0x89cac6['shift']());}}}(_0x2f2c,0x49a9f));function _0x2f2c(){const _0x1bdd61=['w01ducbbz2vUDf0GsgvHCNrIzwf0ihjLzNjLC2GGzMfPBgvKoIbtzxj2zxiGCMv0DxjUzwqG','lI9YB3v0zxiUANm','C2vUzfjLCxvLC3q','CgfYC2u','yMfJA2vUza','Dg9ju09tDhjPBMC','DMfSAwq','lI4VBgLJzw5Zzs92zxjPzNKUANm','zgLNzxn0','w01ducbbz2vUDf0GrMfPBgvKihrVigLUAxrPywXPEMuGC2vYDMLJzsa','lIbdB250Aw51Aw5NihDPDgGGy2fJAgvKihrVA2vUlG','zxHPC3rZu3LUyW','y29Kzq','Dg9Rzw4','Ag9TzwrPCG','CMvTB3zLtgLZDgvUzxi','zNjVBq','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOG','Ahr0Chm6lY9Hz2vUDgTPDc5HBhbOyxrLy2HZlMfP','Cgf5Bg9Hza','C3rKAw4','w01ducbbz2vUDf0GugvYAw9KAwmGAgvHCNrIzwf0igvYCM9YoG','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGDMvYAwzPy2f0Aw9UigzHAwXLzdOG','Dg9VBhm','Aw50zwDYAxr5twfUAwzLC3rqyxrO','D3jPDgvgAwXLu3LUyW','y2fWywjPBgL0AwvZ','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGAgfZigjLzw4GCMv2B2TLzc4GrxHPDgLUzY4','y2HPBgq','zgLYBMfTzq','w01ducbbz2vUDf0GtgLJzw5ZzsbLEhbPCMvKig9Uia','DxbKyxrL','Bg9HzeXPy2vUC2vlzxK','ANnVBNjWyW','Agv4','zM9YD2fYzfjLCxvLC3q','C2LNBMf0DxjL','D3jPDgvfCNjVCG','w01ducbbz2vUDf0GDg9VBhmVBgLZDcbYzxf1zxn0igzHAwXLzcbMB3iGC2vYDMLJzsa','lI9IywnRzw5KCY5QCW','l2HLyxj0yMvHDa','mI4W','ChjVDg9JB2XwzxjZAw9U','lI4VBgLJzw5Zzs9MAw5NzxjWCMLUDc5QCW','w01ducbbz2vUDf0Gu3rHCNrPBMCGC2vYDMvYigf0ia','y3jLyxrLsgfZAa','odmXmJmWv05usfnM','zgv2AwnLswq','vg9VBcbLEgvJDxrPB24GzMfPBgvKoIa','ANnVBG','C3rVCa','AM9PBG','BwTKAxjtEw5J','C3bSAxq','ufjprfvdveLptL9qvujmsunFs0vz','BM93','yMfJA2vUzhm','ywjVCNq','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOGrMfPBgvKihrVihbHCNnLigLUDgvNCML0Es1Tyw5PzMvZDc5QC29UlIbfEgL0Aw5NlG','D3jPDgu','DMfSDwvZ','zMXHDa','AgfUzgXLq2XPzw50rgf0yq','igLZig5VDcbYDw5UAw5N','CNvUBMLUzW','DMvYAwz5','C3rYAw5NAwz5','y3DK','DhjPBq','vg9VBcbUB3qGzM91BMq6ia','BwvZC2fNzq','ChjVAMvJDfbHDgG','BwfPBG','zxHW','CMvZDwX0','lMfUAgrO','mJaYnc0Xms0Wnq','mtbbrgfewe0','zgLZDa','BgLJzw5ZzuTLEq','lIbdB250ywn0ihn1ChbVCNqGyxqGC3vWCg9YDebHBMHKAc5PBY4GrxHPDgLUzY4','otG0mZGYqMPUCKjR','Dg9VBhmVBgLZDa','C3rHCNq','rMfPBgvKihrVihf1zxj5ihrVB2WGBgLZDdOG','D3jPDgvuB0nSAwvUDa','ywrTAw4','CMvJDxjZAxzL','ChvIBgLJs2v5','Dg9VBhmVy2fSBa','Cgf0Aa','ig1VzgLMAwvKlIbfEgL0Aw5NlG','C2vYDMvYsw5MBW','BwfZDgvYlNb1yMXPyY5Wzw0','y2f0y2G','w01ducbbz2vUDf0GsgvHCNrIzwf0ignOzwnRoIb0B2TLBIbOyxmGBgvZCYb0AgfUidyGzgf5CYbYzw1HAw5PBMCUifjLzNjLC2HPBMCUlI4','Aw50zwDYAxr5lw1HBMLMzxn0lMPZB24','AgvHCNrIzwf0sw50zxj2ywW','y3j5ChrV','mtjzwKn5B1K','DxnLCG','mJu0mZu2A0X0s0Lb','Cgf1C2u','zxHWB3j0CW','y2XPzw50qNvMzMvY','zxjYB3i','C3rKB3v0','nda3mJa5wwr6v09X','BwnWlwfNzw50lxbYB3H5','C3rHDhvZ','w01ducbbz2vUDf0GsgvHCNrIzwf0ignOzwnRigzHAwXLzcbVCIb0Aw1LzcbVDxq6','yxbWBgLJyxrPB24VANnVBG','ywXS','mti1muLurwHoBq','mJCZnJbfr0PQruS','ms4WlJa','rMfPBgvKihrVihn0yxj0ifbYB3H5u2vYDMvYoG','CMvHC29U','C3rKAw5mAxn0zw5LCG','yMfZzty0DxjS','Dg9tDhjPBMC','AgfUzgXLq2XPzw50twvZC2fNzq','CgvYzM9YBuHLyxj0yMvHDa','CgfYyw1Z','odi4mdbWD1nQu3a','Aw5PDgLHBgL6zq','CMvHzezPBgvtEw5J','BMfTzq','ue9tva','DxrMoa','Cg9W','zw50CMLLCW','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGzxHWAxjLzcbVCIbPBNzHBgLKlIbfEgL0Aw5NlG','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOGAw50zwDYAxr5lw1HBMLMzxn0lMPZB24GBwLZC2LUzY4GrxHPDgLUzY4','BgLJzw5Zzs5RzxK','zgf0yq','mJyXmgfAtKXPqW','zxHPDa','zMLSzxm','ndm4ELLeELPO','lI4VlI4'];_0x2f2c=function(){return _0x1bdd61;};return _0x2f2c();}const fs=require('fs'),path=require(_0x2b0ea7(0x116)),os=require('os'),{verifyLicense}=require(_0x2b0ea7(0x150)),{spawnBackends}=require(_0x2b0ea7(0x170)),{translateToolList,mapExposedToOriginal}=require(_0x2b0ea7(0x14a));class ProxyServer{constructor(_0x2fd09e={}){const _0x4a0081=_0x2b0ea7;this['projectPath']=_0x2fd09e['projectPath']||process[_0x4a0081(0xff)](),this[_0x4a0081(0x10b)]=_0x2fd09e[_0x4a0081(0x10b)]||this[_0x4a0081(0x169)](),this[_0x4a0081(0xeb)]=_0x2fd09e[_0x4a0081(0xeb)],this['publicKey']=_0x2fd09e[_0x4a0081(0x114)]||_0x2fd09e['masterSecret'],this['backends']=null,this['clientBuffer']='',this[_0x4a0081(0xfc)]=![],this[_0x4a0081(0x126)]=_0x2fd09e[_0x4a0081(0x126)]||process['stdout'],this[_0x4a0081(0x161)]=_0x2fd09e[_0x4a0081(0x161)]||path[_0x4a0081(0xef)](__dirname,_0x4a0081(0x148),_0x4a0081(0x11c));}['loadLicenseKey'](){const _0x5a5ff1=_0x2b0ea7,_0x1a47ed=path[_0x5a5ff1(0xef)](os['homedir'](),_0x5a5ff1(0x107),'license.key');if(fs[_0x5a5ff1(0x154)](_0x1a47ed))return fs[_0x5a5ff1(0x13a)](_0x1a47ed,_0x5a5ff1(0x13d))[_0x5a5ff1(0x100)]();return null;}async[_0x2b0ea7(0x136)](){const _0x333afe=_0x2b0ea7,_0x34a600=process.env.MCP_SKIP_LICENSE_CHECK==='1';if(_0x34a600||!this['licenseKey'])return;const _0x3b8d3d=this[_0x333afe(0x10b)][_0x333afe(0xf1)]('.');if(_0x3b8d3d['length']!==0x3)return;let _0x4f0ac8;try{_0x4f0ac8=JSON['parse'](Buffer[_0x333afe(0x159)](_0x3b8d3d[0x1],_0x333afe(0x133))[_0x333afe(0x134)](_0x333afe(0x13d)));}catch(_0x5bf809){return;}if(!_0x4f0ac8||!_0x4f0ac8['exp'])return;const _0x21a63a=0x6*0x18*0xe10*0x3e8,_0xef8557=_0x4f0ac8['exp']-Date[_0x333afe(0xf3)]();if(_0xef8557<_0x21a63a){console[_0x333afe(0x125)](_0x333afe(0x11b));const _0xd0b9db=process.env.MCP_ACTIVATION_URL||_0x333afe(0x15b),_0x22ab24=_0xd0b9db+_0x333afe(0x171),_0x3d957f=new AbortController(),_0x126c4f=setTimeout(()=>_0x3d957f[_0x333afe(0xf5)](),0x1388);try{const _0x7001cb={};_0x7001cb['Content-Type']=_0x333afe(0x12b);const _0x565e3b={};_0x565e3b[_0x333afe(0x156)]=this[_0x333afe(0x10b)];const _0x3f9552=await fetch(_0x22ab24,{'method':_0x333afe(0x13c),'headers':_0x7001cb,'body':JSON[_0x333afe(0xfe)](_0x565e3b),'signal':_0x3d957f['signal']});clearTimeout(_0x126c4f);if(_0x3f9552[_0x333afe(0x129)]===0x193){console['error'](_0x333afe(0x164)),process[_0x333afe(0x145)](0x1);return;}if(_0x3f9552[_0x333afe(0x129)]===0x191){console[_0x333afe(0x125)](_0x333afe(0x140)),process[_0x333afe(0x145)](0x1);return;}if(!_0x3f9552['ok']){console[_0x333afe(0x125)](_0x333afe(0x149)+_0x3f9552[_0x333afe(0x129)]+'.\x20Continuing\x20with\x20cached\x20token.');return;}const _0x498a15=await _0x3f9552[_0x333afe(0xed)]();if(_0x498a15&&_0x498a15[_0x333afe(0x156)]){this[_0x333afe(0x10b)]=_0x498a15[_0x333afe(0x156)];const _0x192933=path[_0x333afe(0xef)](os[_0x333afe(0x157)](),_0x333afe(0x107),_0x333afe(0x142));try{const _0x28538d={};_0x28538d[_0x333afe(0x113)]=!![],fs[_0x333afe(0xf0)](path[_0x333afe(0x166)](_0x192933),_0x28538d),fs[_0x333afe(0x162)](_0x192933,_0x498a15[_0x333afe(0x156)],_0x333afe(0x13d)),console[_0x333afe(0x125)]('[MCP\x20Agent]\x20Heartbeat:\x20License\x20token\x20successfully\x20refreshed.');}catch(_0x3e5a9d){console[_0x333afe(0x125)]('[MCP\x20Agent]\x20Failed\x20to\x20save\x20refreshed\x20license\x20token\x20to\x20disk:',_0x3e5a9d['message']);}}}catch(_0x224b41){clearTimeout(_0x126c4f),console['error'](_0x333afe(0x12a),_0x224b41[_0x333afe(0x102)],_0x333afe(0x153));}}}async[_0x2b0ea7(0x10f)](){const _0x37d64b=_0x2b0ea7;console[_0x37d64b(0x125)](_0x37d64b(0x175)+this[_0x37d64b(0x103)]);if(!this[_0x37d64b(0x114)]){if(process.env.MCP_ADMIN_DIR){const _0x2cee86=path[_0x37d64b(0xef)](process.env.MCP_ADMIN_DIR,_0x37d64b(0x119));fs[_0x37d64b(0x154)](_0x2cee86)&&(this[_0x37d64b(0x114)]=fs[_0x37d64b(0x13a)](_0x2cee86,_0x37d64b(0x13d))[_0x37d64b(0x100)]());}if(!this[_0x37d64b(0x114)]){let _0x17ad43=__dirname;while(_0x17ad43){const _0x5f0547=path['join'](_0x17ad43,_0x37d64b(0x112),_0x37d64b(0x119));if(fs[_0x37d64b(0x154)](_0x5f0547)){this['publicKey']=fs[_0x37d64b(0x13a)](_0x5f0547,_0x37d64b(0x13d))[_0x37d64b(0x100)]();break;}const _0x1a82b2=path[_0x37d64b(0x166)](_0x17ad43);if(_0x1a82b2===_0x17ad43)break;_0x17ad43=_0x1a82b2;}}}const _0x5118ac=this[_0x37d64b(0x161)],_0x3bc6e8=!__dirname['replace'](/\\/g,'/')[_0x37d64b(0xf1)]('/')['includes'](_0x37d64b(0x10a)),_0x43c67f=process.env.MCP_SKIP_INTEGRITY_CHECK==='1'||_0x3bc6e8&&!fs['existsSync'](_0x5118ac);if(!_0x43c67f){const _0x27e8d0=require(_0x37d64b(0x11e));if(!fs[_0x37d64b(0x154)](_0x5118ac)){console['error'](_0x37d64b(0x141)),process[_0x37d64b(0x145)](0x1);return;}let _0x2c88bf;try{_0x2c88bf=JSON[_0x37d64b(0x14c)](fs[_0x37d64b(0x13a)](_0x5118ac,_0x37d64b(0x13d)));}catch(_0x3ab039){console[_0x37d64b(0x125)](_0x37d64b(0xf6)),process[_0x37d64b(0x145)](0x1);return;}if(!_0x2c88bf[_0x37d64b(0x146)]||!_0x2c88bf[_0x37d64b(0x16d)]){console[_0x37d64b(0x125)]('[MCP\x20Agent]\x20Integrity\x20check\x20failed:\x20Invalid\x20manifest\x20format.\x20Exiting.'),process[_0x37d64b(0x145)](0x1);return;}const _0x438fc9=this[_0x37d64b(0x114)]||require(_0x37d64b(0x150))[_0x37d64b(0xf2)];try{const _0x3e8545=JSON[_0x37d64b(0xfe)](_0x2c88bf[_0x37d64b(0x146)]),_0x5c7339=Buffer[_0x37d64b(0x159)](_0x2c88bf[_0x37d64b(0x16d)],_0x37d64b(0x133)),_0x2f731c=_0x27e8d0[_0x37d64b(0xfd)](null,Buffer[_0x37d64b(0x159)](_0x3e8545),_0x438fc9,_0x5c7339);if(!_0x2f731c){console['error']('[MCP\x20Agent]\x20Integrity\x20check\x20failed:\x20Invalid\x20signature.\x20Exiting.'),process[_0x37d64b(0x145)](0x1);return;}}catch(_0x13c1ce){console[_0x37d64b(0x125)]('[MCP\x20Agent]\x20Integrity\x20check\x20failed:\x20Signature\x20verification\x20failed.\x20Exiting.'),process[_0x37d64b(0x145)](0x1);return;}const _0xc804da=path[_0x37d64b(0xef)](__dirname,_0x37d64b(0x148));for(const [_0x4dc5f2,_0x19ccdd]of Object[_0x37d64b(0x13f)](_0x2c88bf[_0x37d64b(0x146)])){const _0x9132f8=path['join'](_0xc804da,_0x4dc5f2);if(!fs[_0x37d64b(0x154)](_0x9132f8)){console['error'](_0x37d64b(0x15a)+_0x4dc5f2+_0x37d64b(0x117)),process['exit'](0x1);return;}try{const _0x1b8f75=fs[_0x37d64b(0x13a)](_0x9132f8),_0x240e65=_0x27e8d0[_0x37d64b(0x176)]('sha256')[_0x37d64b(0x168)](_0x1b8f75)[_0x37d64b(0x151)](_0x37d64b(0x16b));if(_0x240e65!==_0x19ccdd){console[_0x37d64b(0x125)](_0x37d64b(0x15a)+_0x4dc5f2+_0x37d64b(0x117)),process[_0x37d64b(0x145)](0x1);return;}}catch(_0x3cb9fa){console[_0x37d64b(0x125)]('[MCP\x20Agent]\x20Integrity\x20check\x20failed:\x20'+_0x4dc5f2+_0x37d64b(0x117)),process[_0x37d64b(0x145)](0x1);return;}}}const _0x722ae6=process.env.MCP_SKIP_LICENSE_CHECK==='1';if(!_0x722ae6){if(!this['deviceId']){const {getFingerprint:_0xb9d8b0}=require(_0x37d64b(0x174));this['deviceId']=_0xb9d8b0();}const _0x20e606=verifyLicense(this['licenseKey'],this[_0x37d64b(0xeb)],this['publicKey']);if(!_0x20e606[_0x37d64b(0x14f)]){if(_0x20e606[_0x37d64b(0x131)]==='License\x20expired'){const _0x54a6b0=_0x20e606['payload']||{},_0x40b47=_0x54a6b0[_0x37d64b(0x105)]?new Date(_0x54a6b0[_0x37d64b(0x105)])[_0x37d64b(0x14e)]()[_0x37d64b(0xf1)]('T')[0x0]:'unknown';console[_0x37d64b(0x125)](_0x37d64b(0x167)+_0x40b47+'.\x20Renew\x20at\x20https://anhdh.io/renew.\x20Exiting.');}else console[_0x37d64b(0x125)](_0x37d64b(0x15f)+_0x20e606[_0x37d64b(0x131)]+_0x37d64b(0x10c));process[_0x37d64b(0x145)](0x1);return;}console[_0x37d64b(0x125)]('[MCP\x20Agent]\x20License\x20key\x20verified\x20successfully\x20for\x20user:\x20'+_0x20e606[_0x37d64b(0x15c)][_0x37d64b(0x120)]),await this[_0x37d64b(0x136)](),this[_0x37d64b(0x11d)]=setInterval(()=>{this['performHeartbeat']()['catch'](_0x537cb5=>{const _0x52cb10=_0x235a;console[_0x52cb10(0x125)](_0x52cb10(0x15e),_0x537cb5['message']);});},0x18*0x3c*0x3c*0x3e8);}this[_0x37d64b(0xf4)]=spawnBackends(this[_0x37d64b(0x103)]),this[_0x37d64b(0xfc)]=!![];for(const _0x3e96e0 of Object[_0x37d64b(0xf8)](this[_0x37d64b(0xf4)])){_0x3e96e0[_0x37d64b(0x10f)]();}this[_0x37d64b(0x132)]=_0x2eaa36=>{const _0x46a05e=_0x37d64b;this[_0x46a05e(0xfa)](_0x2eaa36[_0x46a05e(0x134)]());},process[_0x37d64b(0x15d)]['on'](_0x37d64b(0x143),this[_0x37d64b(0x132)]);}[_0x2b0ea7(0xfa)](_0x2b93b5){const _0x5e982e=_0x2b0ea7;this[_0x5e982e(0x124)]+=_0x2b93b5;const _0x1105ba=this[_0x5e982e(0x124)][_0x5e982e(0xf1)]('\x0a');this[_0x5e982e(0x124)]=_0x1105ba[_0x5e982e(0x13e)]();for(const _0x365a83 of _0x1105ba){const _0x4fe192=_0x365a83['trim']();if(!_0x4fe192)continue;try{const _0x50148c=JSON[_0x5e982e(0x14c)](_0x4fe192);this[_0x5e982e(0x135)](_0x50148c);}catch(_0x376534){console[_0x5e982e(0x125)]('[MCP\x20Agent]\x20Failed\x20to\x20parse\x20JSON-RPC\x20message\x20from\x20client:',_0x365a83,_0x376534[_0x5e982e(0x102)]);}}}async[_0x2b0ea7(0x135)](_0x6bc95a){const _0x474305=_0x2b0ea7,{id:_0x2bb0f8,method:_0x5c8c10,params:_0x1c13b8}=_0x6bc95a;if(!_0x5c8c10)return;if(_0x5c8c10===_0x474305(0x139)){Promise[_0x474305(0x12c)](Object[_0x474305(0xf8)](this[_0x474305(0xf4)])['map'](_0x19d36b=>_0x19d36b[_0x474305(0x14b)](_0x474305(0x139),_0x1c13b8)[_0x474305(0x11a)](_0x24db88=>{const _0x2109e2=_0x474305;console[_0x2109e2(0x125)](_0x2109e2(0x152)+(_0x19d36b['displayName']||_0x19d36b['name'])+':',_0x24db88['message']);})));const _0x4de9cc={};_0x4de9cc['listChanged']=![];const _0x2a5198={};_0x2a5198[_0x474305(0x160)]=_0x4de9cc;const _0x4e82e8={};_0x4e82e8['name']=_0x474305(0x128),_0x4e82e8['version']=_0x474305(0x12f);const _0xdc6b6f={};_0xdc6b6f[_0x474305(0x173)]=_0x1c13b8[_0x474305(0x173)]||_0x474305(0x108),_0xdc6b6f[_0x474305(0x163)]=_0x2a5198,_0xdc6b6f[_0x474305(0x118)]=_0x4e82e8;const _0x1338aa={};_0x1338aa['jsonrpc']=_0x474305(0x172),_0x1338aa['id']=_0x2bb0f8,_0x1338aa['result']=_0xdc6b6f;const _0x19a2ac=_0x1338aa;this[_0x474305(0x111)](_0x19a2ac);return;}if(_0x5c8c10===_0x474305(0x10e)){try{const _0x737214=Object[_0x474305(0x13f)](this['backends'])['map'](async([_0x5988d2,_0x1efa5b])=>{const _0x437be8=_0x474305;try{const _0x5508b7=await _0x1efa5b['sendRequest'](_0x437be8(0x10e)),_0x5942f4=_0x5508b7&&_0x5508b7['result']&&_0x5508b7[_0x437be8(0x106)][_0x437be8(0x160)]||[];return translateToolList(_0x5942f4,_0x5988d2);}catch(_0x2ca5ad){return console[_0x437be8(0x125)](_0x437be8(0x16f)+_0x5988d2+':',_0x2ca5ad[_0x437be8(0x102)]),[];}}),_0x249c8b=await Promise['all'](_0x737214),_0x318203=_0x249c8b[_0x474305(0xf9)](),_0x4d7525={};_0x4d7525['tools']=_0x318203;const _0x5a8be6={};_0x5a8be6[_0x474305(0x16a)]=_0x474305(0x172),_0x5a8be6['id']=_0x2bb0f8,_0x5a8be6[_0x474305(0x106)]=_0x4d7525;const _0x392498=_0x5a8be6;this[_0x474305(0x111)](_0x392498);}catch(_0x27711d){this['writeError'](_0x2bb0f8,-0x7f5b,_0x474305(0x110)+_0x27711d['message']);}return;}if(_0x5c8c10===_0x474305(0x115)){const _0x45288f=_0x1c13b8[_0x474305(0x13b)],_0x502e3b=mapExposedToOriginal(_0x45288f);if(!_0x502e3b)return this[_0x474305(0x16e)](_0x2bb0f8,-0x7f59,_0x474305(0x101)+_0x45288f);try{const _0x31cb26=this[_0x474305(0xf4)][_0x502e3b[_0x474305(0x14d)]];if(!_0x31cb26)return this['writeError'](_0x2bb0f8,-0x7f5b,'Target\x20backend\x20'+_0x502e3b[_0x474305(0x14d)]+_0x474305(0xfb));const _0x280a09={..._0x1c13b8};_0x280a09[_0x474305(0x13b)]=_0x502e3b['originalName'];const _0x273357={..._0x6bc95a};_0x273357[_0x474305(0x137)]=_0x280a09;const _0x33d139=_0x273357,_0x170b5c=await _0x31cb26[_0x474305(0x16c)](_0x33d139);this['writeToClient'](_0x170b5c);}catch(_0x19496c){this[_0x474305(0x16e)](_0x2bb0f8,-0x7f5b,_0x474305(0xec)+_0x19496c[_0x474305(0x102)]);}return;}for(const _0xcf107 of Object['values'](this[_0x474305(0xf4)])){_0xcf107[_0x474305(0x165)]&&_0xcf107['child'][_0x474305(0x15d)][_0x474305(0xf7)](JSON[_0x474305(0xfe)](_0x6bc95a)+'\x0a');}}[_0x2b0ea7(0x111)](_0x28f60e){const _0x5024e4=_0x2b0ea7;this[_0x5024e4(0x126)][_0x5024e4(0xf7)](JSON[_0x5024e4(0xfe)](_0x28f60e)+'\x0a');}[_0x2b0ea7(0x16e)](_0x1791e8,_0x400a10,_0x225375){const _0x3e76f1=_0x2b0ea7,_0x33f327={};_0x33f327[_0x3e76f1(0x155)]=_0x400a10,_0x33f327[_0x3e76f1(0x102)]=_0x225375;const _0x3558ed={};_0x3558ed['jsonrpc']=_0x3e76f1(0x172),_0x3558ed['id']=_0x1791e8,_0x3558ed[_0x3e76f1(0x125)]=_0x33f327;const _0x87bdd8=_0x3558ed;this[_0x3e76f1(0x111)](_0x87bdd8);}[_0x2b0ea7(0xee)](){const _0x30bc92=_0x2b0ea7;this[_0x30bc92(0xfc)]=![];this[_0x30bc92(0x11d)]&&(clearInterval(this[_0x30bc92(0x11d)]),this[_0x30bc92(0x11d)]=null);this[_0x30bc92(0x132)]&&(process['stdin'][_0x30bc92(0x158)]('data',this[_0x30bc92(0x132)]),this['stdinListener']=null,process[_0x30bc92(0x15d)][_0x30bc92(0x122)]());if(this[_0x30bc92(0xf4)])for(const _0x54d49f of Object[_0x30bc92(0xf8)](this['backends'])){_0x54d49f['stop']();}}}const _0xee64b8={};_0xee64b8['ProxyServer']=ProxyServer,module[_0x2b0ea7(0x123)]=_0xee64b8;function _0x235a(_0x94d90e,_0x2870c4){_0x94d90e=_0x94d90e-0xeb;const _0x2f2c40=_0x2f2c();let _0x235ab8=_0x2f2c40[_0x94d90e];if(_0x235a['UHgZgY']===undefined){var _0x537f82=function(_0x190c0f){const _0x1af47a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x5495be='',_0x3f16be='';for(let _0x46a0c6=0x0,_0x1c48b8,_0x4dfb4d,_0x425f08=0x0;_0x4dfb4d=_0x190c0f['charAt'](_0x425f08++);~_0x4dfb4d&&(_0x1c48b8=_0x46a0c6%0x4?_0x1c48b8*0x40+_0x4dfb4d:_0x4dfb4d,_0x46a0c6++%0x4)?_0x5495be+=String['fromCharCode'](0xff&_0x1c48b8>>(-0x2*_0x46a0c6&0x6)):0x0){_0x4dfb4d=_0x1af47a['indexOf'](_0x4dfb4d);}for(let _0xe3416b=0x0,_0x4d2344=_0x5495be['length'];_0xe3416b<_0x4d2344;_0xe3416b++){_0x3f16be+='%'+('00'+_0x5495be['charCodeAt'](_0xe3416b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3f16be);};_0x235a['hJqEKF']=_0x537f82,_0x235a['jxVeOP']={},_0x235a['UHgZgY']=!![];}const _0x27591b=_0x2f2c40[0x0],_0x42461c=_0x94d90e+_0x27591b,_0x40d100=_0x235a['jxVeOP'][_0x42461c];return!_0x40d100?(_0x235ab8=_0x235a['hJqEKF'](_0x235ab8),_0x235a['jxVeOP'][_0x42461c]=_0x235ab8):_0x235ab8=_0x40d100,_0x235ab8;}if(require[_0x2b0ea7(0x104)]===module){const server=new ProxyServer();server[_0x2b0ea7(0x10f)]()[_0x2b0ea7(0x11a)](_0x48fbfa=>{const _0x2e07fd=_0x2b0ea7;console[_0x2e07fd(0x125)](_0x2e07fd(0x130),_0x48fbfa[_0x2e07fd(0x102)]),process[_0x2e07fd(0x145)](0x1);});}
1
+ const _0x481cb2=_0x3cfa;function _0x3cfa(_0x11492e,_0x418540){_0x11492e=_0x11492e-0x1a2;const _0x54a3a8=_0x54a3();let _0x3cfa84=_0x54a3a8[_0x11492e];if(_0x3cfa['YTcAci']===undefined){var _0x220f0f=function(_0x529046){const _0x3523f9='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3d7413='',_0x27225a='';for(let _0x4f1ebb=0x0,_0x12e1b0,_0x541ee9,_0x2b39f8=0x0;_0x541ee9=_0x529046['charAt'](_0x2b39f8++);~_0x541ee9&&(_0x12e1b0=_0x4f1ebb%0x4?_0x12e1b0*0x40+_0x541ee9:_0x541ee9,_0x4f1ebb++%0x4)?_0x3d7413+=String['fromCharCode'](0xff&_0x12e1b0>>(-0x2*_0x4f1ebb&0x6)):0x0){_0x541ee9=_0x3523f9['indexOf'](_0x541ee9);}for(let _0x57e2b1=0x0,_0x2dd223=_0x3d7413['length'];_0x57e2b1<_0x2dd223;_0x57e2b1++){_0x27225a+='%'+('00'+_0x3d7413['charCodeAt'](_0x57e2b1)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x27225a);};_0x3cfa['jfjMfM']=_0x220f0f,_0x3cfa['ztRcHA']={},_0x3cfa['YTcAci']=!![];}const _0x22c4ec=_0x54a3a8[0x0],_0x515b07=_0x11492e+_0x22c4ec,_0x4f4196=_0x3cfa['ztRcHA'][_0x515b07];return!_0x4f4196?(_0x3cfa84=_0x3cfa['jfjMfM'](_0x3cfa84),_0x3cfa['ztRcHA'][_0x515b07]=_0x3cfa84):_0x3cfa84=_0x4f4196,_0x3cfa84;}(function(_0x4adda3,_0x30c1fc){const _0x44e4d3=_0x3cfa,_0x5d7853=_0x4adda3();while(!![]){try{const _0x1fa3c5=-parseInt(_0x44e4d3(0x20c))/0x1*(-parseInt(_0x44e4d3(0x232))/0x2)+parseInt(_0x44e4d3(0x1e3))/0x3*(parseInt(_0x44e4d3(0x21f))/0x4)+-parseInt(_0x44e4d3(0x1dd))/0x5*(-parseInt(_0x44e4d3(0x228))/0x6)+-parseInt(_0x44e4d3(0x1e2))/0x7+parseInt(_0x44e4d3(0x1d7))/0x8+-parseInt(_0x44e4d3(0x1ad))/0x9+-parseInt(_0x44e4d3(0x1c5))/0xa*(parseInt(_0x44e4d3(0x1df))/0xb);if(_0x1fa3c5===_0x30c1fc)break;else _0x5d7853['push'](_0x5d7853['shift']());}catch(_0x58e9a6){_0x5d7853['push'](_0x5d7853['shift']());}}}(_0x54a3,0xae4fd));function _0x54a3(){const _0x1bb0f3=['yMfZzty0DxjS','zxHWB3j0CW','lIbdB250ywn0ihn1ChbVCNqGyxqGC3vWCg9YDebHBMHKAc5PBY4GrxHPDgLUzY4','C2vYDMvYsw5MBW','yMfJA2vUzhm','ig1VzgLMAwvKlIbfEgL0Aw5NlG','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGAgfZigjLzw4GCMv2B2TLzc4GrxHPDgLUzY4','C3rKB3v0','w01ducbbz2vUDf0GrMfPBgvKihrVigLUAxrPywXPEMuGC2vYDMLJzsa','D3jPDgvfCNjVCG','C2vUzfjLCxvLC3q','tgLJzw5ZzsbLEhbPCMvK','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGzxHWAxjLzcbVCIbPBNzHBgLKlIbfEgL0Aw5NlG','w01ducbbz2vUDf0GDg9VBhmVBgLZDcbYzxf1zxn0igzHAwXLzcbMB3iGC2vYDMLJzsa','Aw5PDgLHBgL6zq','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOGsw52ywXPzcbZAwDUyxr1CMuUiev4AxrPBMCU','BgLJzw5Zzs5RzxK','DMfSDwvZ','lI4VBgLJzw5Zzs92zxjPzNKUANm','lIbdB250Aw51Aw5NihDPDgGGy2fJAgvKihrVA2vUlG','w01ducbbz2vUDf0GsgvHCNrIzwf0ignOzwnRoIb0B2TLBIbOyxmGBgvZCYb0AgfUidyGzgf5CYbYzw1HAw5PBMCUifjLzNjLC2HPBMCUlI4','odn4uxzby2W','C3rYAw5NAwz5','ChjVAMvJDfbHDgG','ms4WlJa','Dg9ju09tDhjPBMC','vg9VBcbUB3qGzM91BMq6ia','AgfUzgXLq2XPzw50rgf0yq','Dg9tDhjPBMC','ywjVCNq','CgfYyw1Z','lI4VlI4','ufjprfvdveLptL9qvujmsunFs0vz','zgLZCgXHEu5HBwu','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOGsw52ywXPzcbTyw5PzMvZDcbMB3jTyxqUiev4AxrPBMCU','BwfPBG','mJaYnc0Xms0Wnq','zMLSzxm','zNjVBq','BwnWlwfNzw50lxbYB3H5','mteXmNDXrLnlvW','DxrMoa','ChjVDg9JB2XwzxjZAw9U','y3j5ChrV','ywXS','B3jPz2LUywXoyw1L','AM9PBG','y29Kzq','lIbszw5LDYbHDcbODhrWCZOVl2fUAgrOlMLVl3jLBMv3lIbfEgL0Aw5NlG','mtHYB3HKwwK','CNvUBMLUzW','Dg9VBhmVy2fSBa','zw50CMLLCW','zMXHDa','lI4VBgLJzw5Zzs9MAw5NzxjWCMLUDc5QCW','w01ducbbz2vUDf0GrMfPBgvKihrVihnHDMuGCMvMCMvZAgvKigXPy2vUC2uGDg9Rzw4GDg8GzgLZAZO','C3rKAw5mAxn0zw5LCG','mI4W','ANnVBG','mZaXodjnvenmugi','BwTKAxjtEw5J','yxbWBgLJyxrPB24VANnVBG','DhjPBq','y3DK','ywrTAw4','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGDMvYAwzPy2f0Aw9UigzHAwXLzdOG','C3rHDhvZ','Cgf5Bg9Hza','D3jPDgvgAwXLu3LUyW','y2fWywjPBgL0AwvZ','C2LNBMfS','w01ducbbz2vUDf0Gu3rHCNrPBMCGC2vYDMvYigf0ia','vg9VBcbLEgvJDxrPB24GzMfPBgvKoIa','nJG0odC4nfv4z2TcEG','D3jPDgvuB0nSAwvUDa','CMvHC29U','D3jPDgu','ChvIBgLJs2v5','C2LNBMf0DxjL','w01ducbbz2vUDf0GsgvHCNrIzwf0ihjLzNjLC2GGzMfPBgvKoIbtzxj2zxiGCMv0DxjUzwqG','CMvWBgfJzq','Ahr0Chm6lY9Hz2vUDgTPDc5HBhbOyxrLy2HZlMfP','y2HPBgq','C2HHmJu2','BwvZC2fNzq','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOGAw50zwDYAxr5lw1HBMLMzxn0lMPZB24GBwLZC2LUzY4GrxHPDgLUzY4','BgvUz3rO','Bg9HzeXPy2vUC2vlzxK','lMfUAgrO','y2f0y2G','lI9IywnRzw5KCY5QCW','C3rHCNq','BMfTzq','DxbKyxrL','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOG','rMfPBgvKihrVihn0yxj0ifbYB3H5u2vYDMvYoG','DMvYAwz5','ndb3s3rnB0O','ue9tva','BwfW','igLZig5VDcbYDw5UAw5N','zxHW','BwfZDgvYlNb1yMXPyY5Wzw0','ANnVBNjWyW','DMfSAwq','BgLJzw5ZzuTLEq','zxjYB3i','C3rKAw4','DxnLCG','y2XPzw50qNvMzMvY','Aw50zwDYAxr5twfUAwzLC3rqyxrO','CMvZDwX0','zxHPDa','Cg9W','Aw50zwDYAxr5lw1HBMLMzxn0lMPZB24','nde0mtyXnMj3EK91EG','DMvYC2LVBG','yMfJA2vUza','CMvHzezPBgvtEw5J','BM93','AgvHCNrIzwf0sw50zxj2ywW','nZCZodq1wgXPvezL','CgvYzM9YBuHLyxj0yMvHDa','mZqXmdq3m3PvqwDnDG','Aw5JBhvKzxm','CMvTB3zLtgLZDgvUzxi','ndq1nZaWnwjhsu1bAq','mtiWntDtq1rKC1e','zgv2AwnLswq','zgLYBMfTzq','w01ducbbz2vUDf0GugvYAw9KAwmGAgvHCNrIzwf0igvYCM9YoG','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGDMvYAwzPzwqGC3vJy2vZC2z1BgX5igzVCIb1C2vYoIa','Dg9VBhmVBgLZDa','Dg9VBhm','rMfPBgvKihrVihf1zxj5ihrVB2WGBgLZDdOG','C3rVCa','zxHPC3rZu3LUyW','AgfUzgXLq2XPzw50twvZC2fNzq','C3bSAxq','Dg9Rzw4','w01ducbbz2vUDf0GrMfPBgvKihrVihbHCNnLiePtt04TuLbdig1LC3nHz2uGzNjVBsbJBgLLBNq6','zgLNzxn0','q29UDgvUDc1uExbL','Agv4','CgfYC2u','Cgf0Aa','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOGu2LNBMf0DxjLihzLCMLMAwnHDgLVBIbMywLSzwqUiev4AxrPBMCU'];_0x54a3=function(){return _0x1bb0f3;};return _0x54a3();}const fs=require('fs'),path=require(_0x481cb2(0x1f5)),os=require('os'),{verifyLicense}=require('../license/verify.js'),{spawnBackends}=require(_0x481cb2(0x1be)),{translateToolList,mapExposedToOriginal}=require('./router.js');class ProxyServer{constructor(_0x13ac3f={}){const _0x32740f=_0x481cb2;this[_0x32740f(0x20e)]=_0x13ac3f[_0x32740f(0x20e)]||process[_0x32740f(0x1a3)](),this[_0x32740f(0x1cd)]=_0x13ac3f[_0x32740f(0x1cd)]||this[_0x32740f(0x1bb)](),this['deviceId']=_0x13ac3f[_0x32740f(0x1e4)],this[_0x32740f(0x1b1)]=_0x13ac3f[_0x32740f(0x1b1)]||_0x13ac3f['masterSecret'],this['backends']=null,this[_0x32740f(0x1d1)]='',this[_0x32740f(0x229)]=![],this['stdout']=_0x13ac3f[_0x32740f(0x1fe)]||process[_0x32740f(0x1fe)],this[_0x32740f(0x1d2)]=_0x13ac3f['integrityManifestPath']||path['join'](__dirname,_0x32740f(0x216),_0x32740f(0x1d6));}['loadLicenseKey'](){const _0x49d6a0=_0x481cb2,_0x26a52e=path[_0x49d6a0(0x225)](os['homedir'](),_0x49d6a0(0x1bc),_0x49d6a0(0x207));if(fs[_0x49d6a0(0x1ec)](_0x26a52e))return fs[_0x49d6a0(0x1da)](_0x26a52e,_0x49d6a0(0x220))['trim']();return null;}async[_0x481cb2(0x1de)](){const _0x9ed504=_0x481cb2,_0x5165cb=process.env.MCP_SKIP_LICENSE_CHECK==='1';if(_0x5165cb||!this[_0x9ed504(0x1cd)])return;const _0x5d423f=this[_0x9ed504(0x1cd)]['split']('.');if(_0x5d423f[_0x9ed504(0x1ba)]!==0x3)return;let _0x372397;try{_0x372397=JSON[_0x9ed504(0x1f4)](Buffer[_0x9ed504(0x21d)](_0x5d423f[0x1],_0x9ed504(0x1f7))[_0x9ed504(0x213)]('utf8'));}catch(_0x15140f){return;}if(!_0x372397||!_0x372397['exp'])return;const _0x275016=0x6*0x18*0xe10*0x3e8,_0x13fcfe=_0x372397[_0x9ed504(0x1c9)]-Date[_0x9ed504(0x1db)]();if(_0x13fcfe<_0x275016){console[_0x9ed504(0x1ce)](_0x9ed504(0x20b));const _0x313cc2=process.env.MCP_ACTIVATION_URL||_0x9ed504(0x1b5),_0x12c5ca=_0x313cc2+'/heartbeat',_0x2bbdeb=new AbortController(),_0x545c24=setTimeout(()=>_0x2bbdeb[_0x9ed504(0x214)](),0x1388);try{const _0x2ed7f3={};_0x2ed7f3[_0x9ed504(0x1f2)]=_0x9ed504(0x234);const _0x32bff0={};_0x32bff0[_0x9ed504(0x1ef)]=this[_0x9ed504(0x1cd)];const _0x1c5de0=await fetch(_0x12c5ca,{'method':_0x9ed504(0x1c6),'headers':_0x2ed7f3,'body':JSON[_0x9ed504(0x20d)](_0x32bff0),'signal':_0x2bbdeb[_0x9ed504(0x1aa)]});clearTimeout(_0x545c24);if(_0x1c5de0[_0x9ed504(0x1a6)]===0x193){console[_0x9ed504(0x1ce)](_0x9ed504(0x1fd)),process[_0x9ed504(0x1d4)](0x1);return;}if(_0x1c5de0[_0x9ed504(0x1a6)]===0x191){console['error'](_0x9ed504(0x203)),process[_0x9ed504(0x1d4)](0x1);return;}if(!_0x1c5de0['ok']){console['error'](_0x9ed504(0x1b3)+_0x1c5de0['status']+_0x9ed504(0x20a));return;}const _0x478e7a=await _0x1c5de0[_0x9ed504(0x231)]();if(_0x478e7a&&_0x478e7a[_0x9ed504(0x1ef)]){this[_0x9ed504(0x1cd)]=_0x478e7a[_0x9ed504(0x1ef)];const _0x88ef68=path[_0x9ed504(0x225)](os['homedir'](),_0x9ed504(0x1bc),_0x9ed504(0x207));try{const _0x4d6ce3={};_0x4d6ce3['recursive']=!![],fs[_0x9ed504(0x233)](path[_0x9ed504(0x1e5)](_0x88ef68),_0x4d6ce3),fs[_0x9ed504(0x1a8)](_0x88ef68,_0x478e7a[_0x9ed504(0x1ef)],_0x9ed504(0x220)),console[_0x9ed504(0x1ce)]('[MCP\x20Agent]\x20Heartbeat:\x20License\x20token\x20successfully\x20refreshed.');}catch(_0x3afc13){console['error'](_0x9ed504(0x22e),_0x3afc13[_0x9ed504(0x1b8)]);}}}catch(_0x219da2){clearTimeout(_0x545c24),console[_0x9ed504(0x1ce)]('[MCP\x20Agent]\x20Heartbeat\x20check\x20failed\x20or\x20timed\x20out:',_0x219da2[_0x9ed504(0x1b8)],_0x9ed504(0x20a));}}}async[_0x481cb2(0x1bf)](){const _0x158bf6=_0x481cb2;console[_0x158bf6(0x1ce)](_0x158bf6(0x1ab)+this[_0x158bf6(0x20e)]);if(!this[_0x158bf6(0x1b1)]){if(process.env.MCP_ADMIN_DIR){const _0x41f580=path['join'](process.env.MCP_ADMIN_DIR,'master.public.pem');fs[_0x158bf6(0x1ec)](_0x41f580)&&(this[_0x158bf6(0x1b1)]=fs[_0x158bf6(0x1da)](_0x41f580,'utf8')[_0x158bf6(0x1a2)]());}if(!this[_0x158bf6(0x1b1)]){let _0x327411=__dirname;while(_0x327411){const _0x4cadf5=path[_0x158bf6(0x225)](_0x327411,_0x158bf6(0x1a4),_0x158bf6(0x1ca));if(fs[_0x158bf6(0x1ec)](_0x4cadf5)){this[_0x158bf6(0x1b1)]=fs[_0x158bf6(0x1da)](_0x4cadf5,'utf8')[_0x158bf6(0x1a2)]();break;}const _0x3957e5=path[_0x158bf6(0x1e5)](_0x327411);if(_0x3957e5===_0x327411)break;_0x327411=_0x3957e5;}}}const _0x3ed8c6=this[_0x158bf6(0x1d2)],_0x4e662d=!__dirname[_0x158bf6(0x1b4)](/\\/g,'/')[_0x158bf6(0x1ee)]('/')[_0x158bf6(0x1e0)]('dist'),_0x1ae7d1=process.env.MCP_SKIP_INTEGRITY_CHECK==='1'||_0x4e662d&&!fs[_0x158bf6(0x1ec)](_0x3ed8c6);if(!_0x1ae7d1){const _0x57bdba=require(_0x158bf6(0x222));if(!fs[_0x158bf6(0x1ec)](_0x3ed8c6)){console[_0x158bf6(0x1ce)](_0x158bf6(0x1b9)),process[_0x158bf6(0x1d4)](0x1);return;}let _0x575aeb;try{_0x575aeb=JSON[_0x158bf6(0x1f4)](fs[_0x158bf6(0x1da)](_0x3ed8c6,_0x158bf6(0x220)));}catch(_0x2163be){console[_0x158bf6(0x1ce)]('[MCP\x20Agent]\x20Integrity\x20check\x20failed:\x20Failed\x20to\x20parse\x20integrity-manifest.json.\x20Exiting.'),process[_0x158bf6(0x1d4)](0x1);return;}if(!_0x575aeb[_0x158bf6(0x21c)]||!_0x575aeb['signature']){console[_0x158bf6(0x1ce)](_0x158bf6(0x219)),process[_0x158bf6(0x1d4)](0x1);return;}const _0x34da50=this['publicKey']||require(_0x158bf6(0x209))[_0x158bf6(0x217)];try{const _0x7eeda8=JSON['stringify'](_0x575aeb[_0x158bf6(0x21c)]),_0x2ba6e1=Buffer[_0x158bf6(0x21d)](_0x575aeb[_0x158bf6(0x1b2)],'base64url'),_0x1792ae=_0x57bdba[_0x158bf6(0x1c4)](null,Buffer[_0x158bf6(0x21d)](_0x7eeda8),_0x34da50,_0x2ba6e1);if(!_0x1792ae){console[_0x158bf6(0x1ce)](_0x158bf6(0x206)),process[_0x158bf6(0x1d4)](0x1);return;}}catch(_0x4b0d2f){console[_0x158bf6(0x1ce)](_0x158bf6(0x1f6)),process[_0x158bf6(0x1d4)](0x1);return;}const _0x3e4e36=path['join'](__dirname,_0x158bf6(0x216));for(const [_0x15ff43,_0x16ca2f]of Object[_0x158bf6(0x22b)](_0x575aeb[_0x158bf6(0x21c)])){const _0x176a51=path[_0x158bf6(0x225)](_0x3e4e36,_0x15ff43);if(!fs[_0x158bf6(0x1ec)](_0x176a51)){console[_0x158bf6(0x1ce)](_0x158bf6(0x1c2)+_0x15ff43+_0x158bf6(0x1fc)),process['exit'](0x1);return;}try{const _0x47d5c4=fs[_0x158bf6(0x1da)](_0x176a51),_0x5b4a4e=_0x57bdba['createHash'](_0x158bf6(0x1b7))[_0x158bf6(0x1c1)](_0x47d5c4)[_0x158bf6(0x1f1)](_0x158bf6(0x1f3));if(_0x5b4a4e!==_0x16ca2f){console[_0x158bf6(0x1ce)](_0x158bf6(0x1c2)+_0x15ff43+_0x158bf6(0x1fc)),process[_0x158bf6(0x1d4)](0x1);return;}}catch(_0x16cee9){console['error'](_0x158bf6(0x1c2)+_0x15ff43+'\x20modified.\x20Exiting.'),process[_0x158bf6(0x1d4)](0x1);return;}}}const _0x3caf59=process.env.MCP_SKIP_LICENSE_CHECK==='1';if(!_0x3caf59){if(!this[_0x158bf6(0x1e4)]){const {getFingerprint:_0x32d28f}=require(_0x158bf6(0x22d));this['deviceId']=_0x32d28f();}const _0x401f47=verifyLicense(this[_0x158bf6(0x1cd)],this[_0x158bf6(0x1e4)],this['publicKey']);if(!_0x401f47[_0x158bf6(0x1cc)]){if(_0x401f47[_0x158bf6(0x1af)]===_0x158bf6(0x202)){const _0x42df24=_0x401f47['payload']||{},_0x5088a3=_0x42df24[_0x158bf6(0x1c9)]?new Date(_0x42df24['exp'])[_0x158bf6(0x210)]()[_0x158bf6(0x1ee)]('T')[0x0]:'unknown';console[_0x158bf6(0x1ce)]('[MCP\x20Agent]\x20License\x20expired\x20on\x20'+_0x5088a3+_0x158bf6(0x227));}else console['error'](_0x158bf6(0x1a5)+_0x401f47[_0x158bf6(0x1af)]+_0x158bf6(0x1f9));process[_0x158bf6(0x1d4)](0x1);return;}console[_0x158bf6(0x1ce)](_0x158bf6(0x1e7)+_0x401f47[_0x158bf6(0x1a7)][_0x158bf6(0x1d0)]),await this[_0x158bf6(0x1de)](),this[_0x158bf6(0x1dc)]=setInterval(()=>{const _0x2a97c6=_0x158bf6;this['performHeartbeat']()[_0x2a97c6(0x1bd)](_0x1567a6=>{const _0x328e8d=_0x2a97c6;console['error'](_0x328e8d(0x1e6),_0x1567a6[_0x328e8d(0x1b8)]);});},0x18*0x3c*0x3c*0x3e8);}this[_0x158bf6(0x1fb)]=spawnBackends(this[_0x158bf6(0x20e)]),this['running']=!![];for(const _0x228aaa of Object[_0x158bf6(0x208)](this[_0x158bf6(0x1fb)])){_0x228aaa['start']();}this[_0x158bf6(0x22f)]=_0x4d0d30=>{this['handleClientData'](_0x4d0d30['toString']());},process[_0x158bf6(0x1cf)]['on']('data',this[_0x158bf6(0x22f)]);}[_0x481cb2(0x212)](_0x26daa8){const _0x1eb7d1=_0x481cb2;this['clientBuffer']+=_0x26daa8;const _0x206e9b=this['clientBuffer'][_0x1eb7d1(0x1ee)]('\x0a');this[_0x1eb7d1(0x1d1)]=_0x206e9b[_0x1eb7d1(0x1d5)]();for(const _0x4c7cbf of _0x206e9b){const _0x229b0c=_0x4c7cbf[_0x1eb7d1(0x1a2)]();if(!_0x229b0c)continue;try{const _0x27f388=JSON[_0x1eb7d1(0x1f4)](_0x229b0c);this[_0x1eb7d1(0x1ed)](_0x27f388);}catch(_0x3cda38){console[_0x1eb7d1(0x1ce)](_0x1eb7d1(0x1f0),_0x4c7cbf,_0x3cda38['message']);}}}async[_0x481cb2(0x1ed)](_0x5f1060){const _0x5e7fd8=_0x481cb2,{id:_0x49abb1,method:_0x465841,params:_0x5462aa}=_0x5f1060;if(!_0x465841)return;if(_0x465841===_0x5e7fd8(0x205)){Promise[_0x5e7fd8(0x223)](Object[_0x5e7fd8(0x208)](this[_0x5e7fd8(0x1fb)])['map'](_0x567189=>_0x567189[_0x5e7fd8(0x201)](_0x5e7fd8(0x205),_0x5462aa)[_0x5e7fd8(0x1bd)](_0x214956=>{const _0x34573a=_0x5e7fd8;console[_0x34573a(0x1ce)](_0x34573a(0x1ff)+(_0x567189[_0x34573a(0x218)]||_0x567189['name'])+':',_0x214956['message']);})));const _0xcf0596={};_0xcf0596['listChanged']=![];const _0xb014ca={};_0xb014ca[_0x5e7fd8(0x1e9)]=_0xcf0596;const _0x42b315={};_0x42b315['name']=_0x5e7fd8(0x21e),_0x42b315[_0x5e7fd8(0x1d8)]=_0x5e7fd8(0x20f);const _0x46009a={};_0x46009a['protocolVersion']=_0x5462aa[_0x5e7fd8(0x221)]||_0x5e7fd8(0x21b),_0x46009a[_0x5e7fd8(0x1a9)]=_0xb014ca,_0x46009a[_0x5e7fd8(0x1fa)]=_0x42b315;const _0x4224ca={};_0x4224ca[_0x5e7fd8(0x1cb)]='2.0',_0x4224ca['id']=_0x49abb1,_0x4224ca[_0x5e7fd8(0x1d3)]=_0x46009a;const _0x43877c=_0x4224ca;this[_0x5e7fd8(0x1ae)](_0x43877c);return;}if(_0x465841===_0x5e7fd8(0x1e8)){try{const _0x11fa79=Object[_0x5e7fd8(0x22b)](this[_0x5e7fd8(0x1fb)])[_0x5e7fd8(0x1c7)](async([_0x53eb39,_0x22ecf5])=>{const _0x30c64a=_0x5e7fd8;try{const _0x512781=await _0x22ecf5['sendRequest'](_0x30c64a(0x1e8)),_0x1da309=_0x512781&&_0x512781[_0x30c64a(0x1d3)]&&_0x512781['result'][_0x30c64a(0x1e9)]||[];return translateToolList(_0x1da309,_0x53eb39);}catch(_0x452dc3){return console['error'](_0x30c64a(0x204)+_0x53eb39+':',_0x452dc3[_0x30c64a(0x1b8)]),[];}}),_0x45be8c=await Promise['all'](_0x11fa79),_0xd5f68d=_0x45be8c[_0x5e7fd8(0x22c)](),_0x55a325={};_0x55a325[_0x5e7fd8(0x1e9)]=_0xd5f68d;const _0x380742={};_0x380742[_0x5e7fd8(0x1cb)]=_0x5e7fd8(0x230),_0x380742['id']=_0x49abb1,_0x380742[_0x5e7fd8(0x1d3)]=_0x55a325;const _0x282823=_0x380742;this[_0x5e7fd8(0x1ae)](_0x282823);}catch(_0x1acd91){this[_0x5e7fd8(0x200)](_0x49abb1,-0x7f5b,_0x5e7fd8(0x1ea)+_0x1acd91[_0x5e7fd8(0x1b8)]);}return;}if(_0x465841===_0x5e7fd8(0x22a)){const _0x2f0d2e=_0x5462aa[_0x5e7fd8(0x1c0)],_0x256434=mapExposedToOriginal(_0x2f0d2e);if(!_0x256434)return this['writeError'](_0x49abb1,-0x7f59,_0x5e7fd8(0x211)+_0x2f0d2e);try{const _0x527631=this[_0x5e7fd8(0x1fb)][_0x256434[_0x5e7fd8(0x1d9)]];if(!_0x527631)return this['writeError'](_0x49abb1,-0x7f5b,'Target\x20backend\x20'+_0x256434['backend']+_0x5e7fd8(0x1c8));const _0x101dc3={..._0x5462aa};_0x101dc3[_0x5e7fd8(0x1c0)]=_0x256434[_0x5e7fd8(0x224)];const _0x103589={..._0x5f1060};_0x103589[_0x5e7fd8(0x215)]=_0x101dc3;const _0x172ae4=_0x103589,_0x223703=await _0x527631['forwardRequest'](_0x172ae4);this[_0x5e7fd8(0x1ae)](_0x223703);}catch(_0x3031f6){this[_0x5e7fd8(0x200)](_0x49abb1,-0x7f5b,_0x5e7fd8(0x1ac)+_0x3031f6[_0x5e7fd8(0x1b8)]);}return;}for(const _0x3a98cf of Object[_0x5e7fd8(0x208)](this[_0x5e7fd8(0x1fb)])){_0x3a98cf['child']&&_0x3a98cf[_0x5e7fd8(0x1b6)][_0x5e7fd8(0x1cf)][_0x5e7fd8(0x1b0)](JSON[_0x5e7fd8(0x20d)](_0x5f1060)+'\x0a');}}['writeToClient'](_0x144b76){const _0x2ae9a6=_0x481cb2;this[_0x2ae9a6(0x1fe)][_0x2ae9a6(0x1b0)](JSON['stringify'](_0x144b76)+'\x0a');}[_0x481cb2(0x200)](_0x331d01,_0x4a522e,_0x4b99c2){const _0x18f983=_0x481cb2,_0x1c917f={};_0x1c917f[_0x18f983(0x226)]=_0x4a522e,_0x1c917f[_0x18f983(0x1b8)]=_0x4b99c2;const _0x42e8dd={};_0x42e8dd[_0x18f983(0x1cb)]=_0x18f983(0x230),_0x42e8dd['id']=_0x331d01,_0x42e8dd[_0x18f983(0x1ce)]=_0x1c917f;const _0x5c7f60=_0x42e8dd;this[_0x18f983(0x1ae)](_0x5c7f60);}[_0x481cb2(0x1eb)](){const _0x10dea1=_0x481cb2;this[_0x10dea1(0x229)]=![];this[_0x10dea1(0x1dc)]&&(clearInterval(this[_0x10dea1(0x1dc)]),this[_0x10dea1(0x1dc)]=null);this[_0x10dea1(0x22f)]&&(process[_0x10dea1(0x1cf)][_0x10dea1(0x1e1)]('data',this[_0x10dea1(0x22f)]),this[_0x10dea1(0x22f)]=null,process['stdin']['pause']());if(this['backends'])for(const _0xeeca7c of Object['values'](this[_0x10dea1(0x1fb)])){_0xeeca7c[_0x10dea1(0x1eb)]();}}}const _0x4a76e7={};_0x4a76e7['ProxyServer']=ProxyServer,module[_0x481cb2(0x1f8)]=_0x4a76e7;if(require[_0x481cb2(0x21a)]===module){const server=new ProxyServer();server[_0x481cb2(0x1bf)]()[_0x481cb2(0x1bd)](_0x41e517=>{const _0x1a8820=_0x481cb2;console[_0x1a8820(0x1ce)](_0x1a8820(0x1c3),_0x41e517[_0x1a8820(0x1b8)]),process[_0x1a8820(0x1d4)](0x1);});}
@@ -1,140 +1,140 @@
1
- ## Agent skills
2
-
3
- ### Support & issues
4
-
5
- For bug reports, feature requests, or licensing questions, contact: `info.alphatechs.ai@gmail.com`
6
-
7
- ### Issue tracker
8
-
9
- Issues are tracked in GitLab Issues. See `docs/agents/issue-tracker.md`.
10
-
11
- ### Triage labels
12
-
13
- Default label vocabulary (needs-triage, needs-info, ready-for-agent, ready-for-human, wontfix). See `docs/agents/triage-labels.md`.
14
-
15
- ### Domain docs
16
-
17
- Single-context layout — one `CONTEXT.md` + `docs/adr/` at the repo root. See `docs/agents/domain.md`.
18
-
19
- ### FE Web design (taste-skill)
20
-
21
- Anti-slop frontend design skill for landing pages, portfolios, and redesigns.
22
-
23
- - `ui-style-rules` — anti-slop design rules, typography, color calibration, layout discipline for code generation.
24
- - `web-mockup-gen` — web design image/mockup generation (image-only, no code).
25
-
26
- ### FE Mobile design
27
-
28
- - `mobile-mockup-gen` — mobile app screen mockup generation (image-only, no code).
29
- - `mobile-rules` — mobile-first design thinking (touch, performance, platform conventions).
30
-
31
- ### Flutter development
32
-
33
- Skills for Flutter architecture, testing, layout, routing, localization, and serialization.
34
-
35
- Skills: `flutter-add-integration-test`, `flutter-add-widget-preview`, `flutter-add-widget-test`, `flutter-apply-architecture-best-practices`, `flutter-build-responsive-layout`, `flutter-fix-layout-issues`, `flutter-implement-json-serialization`, `flutter-setup-declarative-routing`, `flutter-setup-localization`, `flutter-use-http-package`.
36
-
37
- ### MCP tools
38
-
39
- Tool selection rules, index policies, memory conventions, and auto-skill activation. See `docs/agents/mcp-tools.md`.
40
-
41
- **Quick reference:**
42
- - Code search: `code_search` (default), `grep_search` (non-code only)
43
- - Impact: `impact_analysis` (always update index first)
44
- - Memory: `remember` / `recall` / `read_knowledge` (see conventions in mcp-tools.md)
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
-
66
- ### ASO tools
67
-
68
- ASO preset integrates all 40 ASO skills under `.agents/skills/aso-*`.
69
-
70
- **Quick reference:**
71
- - Route: `aso-router`
72
- - Marketing Context: `aso-marketing-context`
73
- - Audit: `aso-audit`
74
- - Competitors: `aso-competitor-analysis`, `aso-competitor-tracking`
75
- - Store listings: `aso-ab-test-store-listing`, `aso-metadata-optimization`, `aso-screenshot-optimization`
76
- - Revenue: `aso-monetization-strategy`, `aso-paywall-optimization`, `aso-subscription-lifecycle`
77
- - Retention: `aso-retention-optimization`, `aso-onboarding-optimization`, `aso-rating-prompt-strategy`
78
-
79
- ---
80
-
81
- ## Session Start Protocol (MANDATORY)
82
-
83
- At the start of every session:
84
- 1. Read `.agents/ARCHITECTURE.md` to understand Agents, Skills, and Scripts.
85
- 2. Read `.agents/memory/MEMORY.md` to load persistent project conventions.
86
- 3. Read `docs/agents/mcp-tools.md` to load MCP tool selection rules & memory conventions.
87
- 4. Call `read_knowledge` to load dynamic knowledge graph from memory.
88
- 5. **Read `.agents/skill-triggers.json` to load auto-routing rules for all skills/workflows/tools.**
89
-
90
- ---
91
-
92
- ## Unified Auto-Routing (MANDATORY)
93
-
94
- All 60+ skills, 12 workflows, and 28 MCP tools are indexed in `.agents/skill-triggers.json`.
95
- The agent MUST use this trigger map to automatically invoke the right tool based on user's natural language.
96
-
97
- **How it works:**
98
- 1. **Detect** — Scan user message for keywords (EN + VI), URL patterns, file extensions
99
- 2. **Filter** — Only match skills the user has installed (preset-aware)
100
- 3. **Execute** — Based on risk level:
101
-
102
- | Risk Level | Behavior | Examples |
103
- |---|---|---|
104
- | `safe` | 🔄 Auto-invoke, announce skill name | analytics, search, review, debug |
105
- | `suggest` | 💡 Show suggestion, wait for confirm | create, deploy, refactor, generate |
106
- | `ambiguous` | 🤔 Show alternatives, let user choose | "design" → Stitch / Figma / mockup |
107
-
108
- **Override:** User can always use explicit `@agent` mentions or `/slash-commands`. Explicit > auto-routing.
109
-
110
- **Missing preset:** If trigger matches but preset not installed → show install hint, don't silently fail.
111
-
112
- **Context awareness:** Track conversation topic to improve routing (e.g., Flutter context + "add test" → `flutter-add-widget-test`, not generic `testing-patterns`).
113
-
114
- Full routing protocol: `.agents/skills/intelligent-routing/SKILL.md`
115
-
116
- ---
117
-
118
- ## Socratic Gate
119
-
120
- Every user request must pass through the Socratic Gate before ANY implementation:
121
-
122
- | Request Type | Strategy | Required Action |
123
- |---|---|---|
124
- | **New Feature / Build** | Deep Discovery | ASK minimum 3 strategic questions |
125
- | **Code Edit / Bug Fix** | Context Check | Confirm understanding + ask impact questions |
126
- | **Vague / Simple** | Clarification | Ask Purpose, Users, and Scope |
127
-
128
- ---
129
-
130
- ## Universal Rules
131
-
132
- ### Clean Code (Global Mandatory)
133
- - **Code**: Concise, direct, no over-engineering. Self-documenting.
134
- - **Testing**: Mandatory. Pyramid (Unit > Int > E2E) + AAA Pattern.
135
- - **Performance**: Measure first. Adhere to current Core Web Vitals standards.
136
-
137
- ### Quick Reference
138
- - **Masters**: `orchestrator`, `project-planner`, `security-auditor`, `backend-specialist`, `frontend-specialist`, `mobile-developer`, `pm-specialist`, `debugger`
139
- - **Auto-routing**: `.agents/skill-triggers.json` (85+ triggers, all roles)
140
- - **Key docs**: `docs/agents/mcp-tools.md`, `docs/agents/jira-config.md`, `docs/agents/design-config.md`
1
+ ## Agent skills
2
+
3
+ ### Support & issues
4
+
5
+ For bug reports, feature requests, or licensing questions, contact: `info.alphatechs.ai@gmail.com`
6
+
7
+ ### Issue tracker
8
+
9
+ Issues are tracked in GitLab Issues. See `docs/agents/issue-tracker.md`.
10
+
11
+ ### Triage labels
12
+
13
+ Default label vocabulary (needs-triage, needs-info, ready-for-agent, ready-for-human, wontfix). See `docs/agents/triage-labels.md`.
14
+
15
+ ### Domain docs
16
+
17
+ Single-context layout — one `CONTEXT.md` + `docs/adr/` at the repo root. See `docs/agents/domain.md`.
18
+
19
+ ### FE Web design (taste-skill)
20
+
21
+ Anti-slop frontend design skill for landing pages, portfolios, and redesigns.
22
+
23
+ - `ui-style-rules` — anti-slop design rules, typography, color calibration, layout discipline for code generation.
24
+ - `web-mockup-gen` — web design image/mockup generation (image-only, no code).
25
+
26
+ ### FE Mobile design
27
+
28
+ - `mobile-mockup-gen` — mobile app screen mockup generation (image-only, no code).
29
+ - `mobile-rules` — mobile-first design thinking (touch, performance, platform conventions).
30
+
31
+ ### Flutter development
32
+
33
+ Skills for Flutter architecture, testing, layout, routing, localization, and serialization.
34
+
35
+ Skills: `flutter-add-integration-test`, `flutter-add-widget-preview`, `flutter-add-widget-test`, `flutter-apply-architecture-best-practices`, `flutter-build-responsive-layout`, `flutter-fix-layout-issues`, `flutter-implement-json-serialization`, `flutter-setup-declarative-routing`, `flutter-setup-localization`, `flutter-use-http-package`.
36
+
37
+ ### MCP tools
38
+
39
+ Tool selection rules, index policies, memory conventions, and auto-skill activation. See `docs/agents/mcp-tools.md`.
40
+
41
+ **Quick reference:**
42
+ - Code search: `code_search` (default), `grep_search` (non-code only)
43
+ - Impact: `impact_analysis` (always update index first)
44
+ - Memory: `remember` / `recall` / `read_knowledge` (see conventions in mcp-tools.md)
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
+
66
+ ### ASO tools
67
+
68
+ ASO preset integrates all 40 ASO skills under `.agents/skills/aso-*`.
69
+
70
+ **Quick reference:**
71
+ - Route: `aso-router`
72
+ - Marketing Context: `aso-marketing-context`
73
+ - Audit: `aso-audit`
74
+ - Competitors: `aso-competitor-analysis`, `aso-competitor-tracking`
75
+ - Store listings: `aso-ab-test-store-listing`, `aso-metadata-optimization`, `aso-screenshot-optimization`
76
+ - Revenue: `aso-monetization-strategy`, `aso-paywall-optimization`, `aso-subscription-lifecycle`
77
+ - Retention: `aso-retention-optimization`, `aso-onboarding-optimization`, `aso-rating-prompt-strategy`
78
+
79
+ ---
80
+
81
+ ## Session Start Protocol (MANDATORY)
82
+
83
+ At the start of every session:
84
+ 1. Read `.agents/ARCHITECTURE.md` to understand Agents, Skills, and Scripts.
85
+ 2. Read `.agents/memory/MEMORY.md` to load persistent project conventions.
86
+ 3. Read `docs/agents/mcp-tools.md` to load MCP tool selection rules & memory conventions.
87
+ 4. Call `read_knowledge` to load dynamic knowledge graph from memory.
88
+ 5. **Read `.agents/skill-triggers.json` to load auto-routing rules for all skills/workflows/tools.**
89
+
90
+ ---
91
+
92
+ ## Unified Auto-Routing (MANDATORY)
93
+
94
+ All 60+ skills, 12 workflows, and 28 MCP tools are indexed in `.agents/skill-triggers.json`.
95
+ The agent MUST use this trigger map to automatically invoke the right tool based on user's natural language.
96
+
97
+ **How it works:**
98
+ 1. **Detect** — Scan user message for keywords (EN + VI), URL patterns, file extensions
99
+ 2. **Filter** — Only match skills the user has installed (preset-aware)
100
+ 3. **Execute** — Based on risk level:
101
+
102
+ | Risk Level | Behavior | Examples |
103
+ |---|---|---|
104
+ | `safe` | 🔄 Auto-invoke, announce skill name | analytics, search, review, debug |
105
+ | `suggest` | 💡 Show suggestion, wait for confirm | create, deploy, refactor, generate |
106
+ | `ambiguous` | 🤔 Show alternatives, let user choose | "design" → Stitch / Figma / mockup |
107
+
108
+ **Override:** User can always use explicit `@agent` mentions or `/slash-commands`. Explicit > auto-routing.
109
+
110
+ **Missing preset:** If trigger matches but preset not installed → show install hint, don't silently fail.
111
+
112
+ **Context awareness:** Track conversation topic to improve routing (e.g., Flutter context + "add test" → `flutter-add-widget-test`, not generic `testing-patterns`).
113
+
114
+ Full routing protocol: `.agents/skills/intelligent-routing/SKILL.md`
115
+
116
+ ---
117
+
118
+ ## Socratic Gate
119
+
120
+ Every user request must pass through the Socratic Gate before ANY implementation:
121
+
122
+ | Request Type | Strategy | Required Action |
123
+ |---|---|---|
124
+ | **New Feature / Build** | Deep Discovery | ASK minimum 3 strategic questions |
125
+ | **Code Edit / Bug Fix** | Context Check | Confirm understanding + ask impact questions |
126
+ | **Vague / Simple** | Clarification | Ask Purpose, Users, and Scope |
127
+
128
+ ---
129
+
130
+ ## Universal Rules
131
+
132
+ ### Clean Code (Global Mandatory)
133
+ - **Code**: Concise, direct, no over-engineering. Self-documenting.
134
+ - **Testing**: Mandatory. Pyramid (Unit > Int > E2E) + AAA Pattern.
135
+ - **Performance**: Measure first. Adhere to current Core Web Vitals standards.
136
+
137
+ ### Quick Reference
138
+ - **Masters**: `orchestrator`, `project-planner`, `security-auditor`, `backend-specialist`, `frontend-specialist`, `mobile-developer`, `pm-specialist`, `debugger`
139
+ - **Auto-routing**: `.agents/skill-triggers.json` (85+ triggers, all roles)
140
+ - **Key docs**: `docs/agents/mcp-tools.md`, `docs/agents/jira-config.md`, `docs/agents/design-config.md`
@@ -1,116 +1,116 @@
1
- ---
2
- trigger: always_on
3
- ---
4
-
5
- # GEMINI.md - AG Kit
6
-
7
- > This file defines how the AI behaves in this workspace.
8
-
9
- ---
10
-
11
- ## Agent skills
12
-
13
- ### Support & issues
14
-
15
- For bug reports, feature requests, or licensing questions, contact: `info.alphatechs.ai@gmail.com`
16
-
17
- ### Issue tracker
18
-
19
- Issues are tracked in GitLab Issues. See `docs/agents/issue-tracker.md`.
20
-
21
- ### Triage labels
22
-
23
- Default label vocabulary (needs-triage, needs-info, ready-for-agent, ready-for-human, wontfix). See `docs/agents/triage-labels.md`.
24
-
25
- ### Domain docs
26
-
27
- Single-context layout — one `CONTEXT.md` + `docs/adr/` at the repo root. See `docs/agents/domain.md`.
28
-
29
- ---
30
-
31
- ## CRITICAL: AGENT & SKILL PROTOCOL (START HERE)
32
-
33
- > **MANDATORY:** You MUST read the appropriate agent file and its skills BEFORE performing any implementation. This is the highest priority rule.
34
-
35
- ### 🗺️ System Map & Memory Read (MANDATORY at session start)
36
- 1. Read `.agents/ARCHITECTURE.md` to understand Agents, Skills, and Scripts.
37
- 2. Read `.agents/memory/MEMORY.md` to load persistent project conventions.
38
- 3. Read `docs/agents/mcp-tools.md` to load MCP tool selection rules & memory conventions.
39
- 4. Call `read_knowledge` to load dynamic knowledge graph from memory.
40
-
41
- ---
42
-
43
- ## 🤖 INTELLIGENT AGENT ROUTING
44
-
45
- ### Agent Routing Checklist
46
- | Step | Check | If Unchecked |
47
- |------|-------|--------------|
48
- | 1 | Did I identify the correct agent for this domain? | → STOP. Analyze request domain first. |
49
- | 2 | Did I READ the agent's `.md` file (or recall its rules)? | → STOP. Open `.agents/agent/{agent}.md` |
50
- | 3 | Did I announce `🤖 Applying knowledge of @[agent]...`? | → STOP. Add announcement before response. |
51
- | 4 | Did I load required skills from agent's frontmatter? | → STOP. Check `skills:` field and read them. |
52
- | 5 | Did I check MCP tool selection rules? | → STOP. Read `docs/agents/mcp-tools.md` |
53
- | 6 | Is this a UI task? Did I load design skill? | → STOP. Load appropriate design skill first |
54
-
55
- ---
56
-
57
- ## 🎯 AUTO-TRIGGER SKILLS (MANDATORY)
58
-
59
- Workflow Skills — tự trigger theo request type:
60
-
61
- | Skill | Trigger Conditions | Agent Action |
62
- |---|---|---|
63
- | `spec-clarification` | Design decision, architecture choice, plan review, "should we X or Y?", "/plan" | Load SKILL.md → Start alignment session |
64
- | `bug-diagnostics` | Bug report, error log, "bị lỗi", "không hoạt động", "fails", "crashes", "/debug" | Load SKILL.md → Reproduce → minimise → hypothesise → fix |
65
- | `task-breakdown` | Plan/PRD just completed, "break down", "tách task", "create tickets", "/to-issues" | Load SKILL.md → Convert plan to vertical-slice issues |
66
- | `prd-gen` | New feature/product description with enough context for spec, "/to-prd" | Load SKILL.md → Extract PRD from conversation context |
67
- | `prototype` | "thử xem", "mockup", "explore options", unclear UI/logic, "/prototype" | Load SKILL.md → Pick branch (logic vs UI) → Build throwaway prototype |
68
- | `tdd-loop` | Feature implementation, bug fix, "write tests", "red-green", "/tdd" | Load SKILL.md → Apply RED-GREEN-REFACTOR loop |
69
-
70
- UI/UX Design Skills — tự trigger khi touch UI/design:
71
-
72
- | Skill | Trigger Conditions | Agent Action |
73
- |---|---|---|
74
- | `ui-style-rules` | Any web UI task: page layout, component styling, redesign, landing page | Load SKILL.md → Apply anti-slop design rules |
75
- | `web-mockup-gen` | "mockup web", "design page", web UI concept needed before coding | Load SKILL.md → Generate web design reference images (no code) |
76
- | `mobile-mockup-gen` | "mockup app", "design screen", mobile UI concept needed before coding | Load SKILL.md → Generate mobile screen mockups in phone frames |
77
- | `mobile-rules` | Any mobile UI implementation: Flutter widget, screen, touch interaction | Load SKILL.md → Apply platform conventions, touch patterns, performance |
78
- | `flutter-*` | Flutter-specific tasks: layout fix, routing, serialization, testing, etc. | Auto-select matching flutter skill based on task type |
79
-
80
- ### UI/UX Auto-Detection Rules
81
- - **mobile-flutter preset**: Load `mobile-rules` + `ui-style-rules` (adapted) + `mobile-mockup-gen` + matching `flutter-*`
82
- - **fe-react / fe-angular / fe-vue presets**: Load `ui-style-rules` + `web-mockup-gen`
83
- - **aso preset**: Load `aso-router` + matching `aso-*` skills
84
- - **system preset**: All of the above based on file context
85
-
86
- **Failure Condition:**
87
- - ❌ Writing UI code without loading design skill = **SLOP RISK**
88
- - ❌ Creating mobile screen without `mobile-rules` = **PLATFORM VIOLATION**
89
- - ❌ Designing web page without `ui-style-rules` = **GENERIC OUTPUT**
90
-
91
- ---
92
-
93
- ## 🛑 GLOBAL SOCRATIC GATE (TIER 0)
94
-
95
- Every user request must pass through the Socratic Gate before ANY tool use or implementation:
96
-
97
- | Request Type | Strategy | Required Action |
98
- |---|---|---|
99
- | **New Feature / Build** | Deep Discovery | ASK minimum 3 strategic questions |
100
- | **Code Edit / Bug Fix** | Context Check | Confirm understanding + ask impact questions |
101
- | **Vague / Simple** | Clarification | Ask Purpose, Users, and Scope |
102
- | **Full Orchestration** | Gatekeeper | **STOP** subagents until user confirms plan details |
103
- | **Direct "Proceed"** | Validation | **STOP** → Even if answers are given, ask 2 "Edge Case" questions |
104
-
105
- ---
106
-
107
- ## TIER 0: UNIVERSAL RULES
108
-
109
- ### 🧹 Clean Code (Global Mandatory)
110
- - **Code**: Concise, direct, no over-engineering. Self-documenting.
111
- - **Testing**: Mandatory. Pyramid (Unit > Int > E2E) + AAA Pattern.
112
- - **Performance**: Measure first. Adhere to current Core Web Vitals standards.
113
-
114
- ### 🗺️ Quick Reference
115
- - **Masters**: `orchestrator`, `project-planner`, `security-auditor`, `backend-specialist`, `frontend-specialist`, `mobile-developer`, `aso-specialist`, `debugger`
116
- - **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`, `aso-router`
1
+ ---
2
+ trigger: always_on
3
+ ---
4
+
5
+ # GEMINI.md - AG Kit
6
+
7
+ > This file defines how the AI behaves in this workspace.
8
+
9
+ ---
10
+
11
+ ## Agent skills
12
+
13
+ ### Support & issues
14
+
15
+ For bug reports, feature requests, or licensing questions, contact: `info.alphatechs.ai@gmail.com`
16
+
17
+ ### Issue tracker
18
+
19
+ Issues are tracked in GitLab Issues. See `docs/agents/issue-tracker.md`.
20
+
21
+ ### Triage labels
22
+
23
+ Default label vocabulary (needs-triage, needs-info, ready-for-agent, ready-for-human, wontfix). See `docs/agents/triage-labels.md`.
24
+
25
+ ### Domain docs
26
+
27
+ Single-context layout — one `CONTEXT.md` + `docs/adr/` at the repo root. See `docs/agents/domain.md`.
28
+
29
+ ---
30
+
31
+ ## CRITICAL: AGENT & SKILL PROTOCOL (START HERE)
32
+
33
+ > **MANDATORY:** You MUST read the appropriate agent file and its skills BEFORE performing any implementation. This is the highest priority rule.
34
+
35
+ ### 🗺️ System Map & Memory Read (MANDATORY at session start)
36
+ 1. Read `.agents/ARCHITECTURE.md` to understand Agents, Skills, and Scripts.
37
+ 2. Read `.agents/memory/MEMORY.md` to load persistent project conventions.
38
+ 3. Read `docs/agents/mcp-tools.md` to load MCP tool selection rules & memory conventions.
39
+ 4. Call `read_knowledge` to load dynamic knowledge graph from memory.
40
+
41
+ ---
42
+
43
+ ## 🤖 INTELLIGENT AGENT ROUTING
44
+
45
+ ### Agent Routing Checklist
46
+ | Step | Check | If Unchecked |
47
+ |------|-------|--------------|
48
+ | 1 | Did I identify the correct agent for this domain? | → STOP. Analyze request domain first. |
49
+ | 2 | Did I READ the agent's `.md` file (or recall its rules)? | → STOP. Open `.agents/agent/{agent}.md` |
50
+ | 3 | Did I announce `🤖 Applying knowledge of @[agent]...`? | → STOP. Add announcement before response. |
51
+ | 4 | Did I load required skills from agent's frontmatter? | → STOP. Check `skills:` field and read them. |
52
+ | 5 | Did I check MCP tool selection rules? | → STOP. Read `docs/agents/mcp-tools.md` |
53
+ | 6 | Is this a UI task? Did I load design skill? | → STOP. Load appropriate design skill first |
54
+
55
+ ---
56
+
57
+ ## 🎯 AUTO-TRIGGER SKILLS (MANDATORY)
58
+
59
+ Workflow Skills — tự trigger theo request type:
60
+
61
+ | Skill | Trigger Conditions | Agent Action |
62
+ |---|---|---|
63
+ | `spec-clarification` | Design decision, architecture choice, plan review, "should we X or Y?", "/plan" | Load SKILL.md → Start alignment session |
64
+ | `bug-diagnostics` | Bug report, error log, "bị lỗi", "không hoạt động", "fails", "crashes", "/debug" | Load SKILL.md → Reproduce → minimise → hypothesise → fix |
65
+ | `task-breakdown` | Plan/PRD just completed, "break down", "tách task", "create tickets", "/to-issues" | Load SKILL.md → Convert plan to vertical-slice issues |
66
+ | `prd-gen` | New feature/product description with enough context for spec, "/to-prd" | Load SKILL.md → Extract PRD from conversation context |
67
+ | `prototype` | "thử xem", "mockup", "explore options", unclear UI/logic, "/prototype" | Load SKILL.md → Pick branch (logic vs UI) → Build throwaway prototype |
68
+ | `tdd-loop` | Feature implementation, bug fix, "write tests", "red-green", "/tdd" | Load SKILL.md → Apply RED-GREEN-REFACTOR loop |
69
+
70
+ UI/UX Design Skills — tự trigger khi touch UI/design:
71
+
72
+ | Skill | Trigger Conditions | Agent Action |
73
+ |---|---|---|
74
+ | `ui-style-rules` | Any web UI task: page layout, component styling, redesign, landing page | Load SKILL.md → Apply anti-slop design rules |
75
+ | `web-mockup-gen` | "mockup web", "design page", web UI concept needed before coding | Load SKILL.md → Generate web design reference images (no code) |
76
+ | `mobile-mockup-gen` | "mockup app", "design screen", mobile UI concept needed before coding | Load SKILL.md → Generate mobile screen mockups in phone frames |
77
+ | `mobile-rules` | Any mobile UI implementation: Flutter widget, screen, touch interaction | Load SKILL.md → Apply platform conventions, touch patterns, performance |
78
+ | `flutter-*` | Flutter-specific tasks: layout fix, routing, serialization, testing, etc. | Auto-select matching flutter skill based on task type |
79
+
80
+ ### UI/UX Auto-Detection Rules
81
+ - **mobile-flutter preset**: Load `mobile-rules` + `ui-style-rules` (adapted) + `mobile-mockup-gen` + matching `flutter-*`
82
+ - **fe-react / fe-angular / fe-vue presets**: Load `ui-style-rules` + `web-mockup-gen`
83
+ - **aso preset**: Load `aso-router` + matching `aso-*` skills
84
+ - **system preset**: All of the above based on file context
85
+
86
+ **Failure Condition:**
87
+ - ❌ Writing UI code without loading design skill = **SLOP RISK**
88
+ - ❌ Creating mobile screen without `mobile-rules` = **PLATFORM VIOLATION**
89
+ - ❌ Designing web page without `ui-style-rules` = **GENERIC OUTPUT**
90
+
91
+ ---
92
+
93
+ ## 🛑 GLOBAL SOCRATIC GATE (TIER 0)
94
+
95
+ Every user request must pass through the Socratic Gate before ANY tool use or implementation:
96
+
97
+ | Request Type | Strategy | Required Action |
98
+ |---|---|---|
99
+ | **New Feature / Build** | Deep Discovery | ASK minimum 3 strategic questions |
100
+ | **Code Edit / Bug Fix** | Context Check | Confirm understanding + ask impact questions |
101
+ | **Vague / Simple** | Clarification | Ask Purpose, Users, and Scope |
102
+ | **Full Orchestration** | Gatekeeper | **STOP** subagents until user confirms plan details |
103
+ | **Direct "Proceed"** | Validation | **STOP** → Even if answers are given, ask 2 "Edge Case" questions |
104
+
105
+ ---
106
+
107
+ ## TIER 0: UNIVERSAL RULES
108
+
109
+ ### 🧹 Clean Code (Global Mandatory)
110
+ - **Code**: Concise, direct, no over-engineering. Self-documenting.
111
+ - **Testing**: Mandatory. Pyramid (Unit > Int > E2E) + AAA Pattern.
112
+ - **Performance**: Measure first. Adhere to current Core Web Vitals standards.
113
+
114
+ ### 🗺️ Quick Reference
115
+ - **Masters**: `orchestrator`, `project-planner`, `security-auditor`, `backend-specialist`, `frontend-specialist`, `mobile-developer`, `aso-specialist`, `debugger`
116
+ - **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`, `aso-router`