apt-mcp-agent-setup 1.1.3 → 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 _0x5bdc97=_0x5583;(function(_0x16f6a7,_0x1833eb){const _0x398246=_0x5583,_0x36fce4=_0x16f6a7();while(!![]){try{const _0x57bbe5=-parseInt(_0x398246(0x120))/0x1*(parseInt(_0x398246(0x113))/0x2)+-parseInt(_0x398246(0xf9))/0x3*(-parseInt(_0x398246(0xc6))/0x4)+parseInt(_0x398246(0x9b))/0x5*(-parseInt(_0x398246(0xf1))/0x6)+-parseInt(_0x398246(0xc8))/0x7+-parseInt(_0x398246(0xeb))/0x8*(parseInt(_0x398246(0xa1))/0x9)+-parseInt(_0x398246(0x11f))/0xa*(-parseInt(_0x398246(0xde))/0xb)+parseInt(_0x398246(0xee))/0xc;if(_0x57bbe5===_0x1833eb)break;else _0x36fce4['push'](_0x36fce4['shift']());}catch(_0x350a21){_0x36fce4['push'](_0x36fce4['shift']());}}}(_0xd10e,0x3c956));const fs=require('fs'),path=require(_0x5bdc97(0xc3)),os=require('os'),{verifyLicense}=require(_0x5bdc97(0x9a)),{spawnBackends}=require(_0x5bdc97(0xb6)),{translateToolList,mapExposedToOriginal}=require('./router.js');class ProxyServer{constructor(_0x13f33e={}){const _0x59e307=_0x5bdc97;this['projectPath']=_0x13f33e[_0x59e307(0x9c)]||process[_0x59e307(0xab)](),this['licenseKey']=_0x13f33e[_0x59e307(0xd7)]||this[_0x59e307(0xdc)](),this['deviceId']=_0x13f33e[_0x59e307(0x11b)],this[_0x59e307(0xe4)]=_0x13f33e[_0x59e307(0xe4)]||_0x13f33e[_0x59e307(0xca)],this[_0x59e307(0x103)]=null,this['clientBuffer']='',this[_0x59e307(0x111)]=![],this[_0x59e307(0xbf)]=_0x13f33e[_0x59e307(0xbf)]||process['stdout'],this['integrityManifestPath']=_0x13f33e['integrityManifestPath']||path[_0x59e307(0xe5)](__dirname,_0x59e307(0xce),'integrity-manifest.json');}[_0x5bdc97(0xdc)](){const _0x5926b7=_0x5bdc97,_0x50d364=path['join'](os[_0x5926b7(0x106)](),'.anhdh',_0x5926b7(0xf2));if(fs[_0x5926b7(0xc2)](_0x50d364))return fs[_0x5926b7(0xfb)](_0x50d364,_0x5926b7(0x9d))[_0x5926b7(0x11a)]();return null;}async[_0x5bdc97(0xad)](){const _0x50b087=_0x5bdc97,_0x3089bf=process.env.MCP_SKIP_LICENSE_CHECK==='1';if(_0x3089bf||!this[_0x50b087(0xd7)])return;const _0xb5937a=this[_0x50b087(0xd7)][_0x50b087(0xb9)]('.');if(_0xb5937a[_0x50b087(0x10f)]!==0x3)return;let _0x1ed06b;try{_0x1ed06b=JSON[_0x50b087(0x10e)](Buffer['from'](_0xb5937a[0x1],_0x50b087(0xa7))[_0x50b087(0xff)](_0x50b087(0x9d)));}catch(_0x1c8f9d){return;}if(!_0x1ed06b||!_0x1ed06b[_0x50b087(0x112)])return;const _0x7d1898=0x6*0x18*0xe10*0x3e8,_0x38dcbb=_0x1ed06b['exp']-Date[_0x50b087(0xd2)]();if(_0x38dcbb<_0x7d1898){console[_0x50b087(0xed)]('[MCP\x20Agent]\x20Heartbeat\x20check:\x20token\x20has\x20less\x20than\x206\x20days\x20remaining.\x20Refreshing...');const _0x469782=process.env.MCP_ACTIVATION_URL||_0x50b087(0xa3),_0x529da6=_0x469782+'/heartbeat',_0x19f607=new AbortController(),_0x5553c0=setTimeout(()=>_0x19f607[_0x50b087(0x10d)](),0x1388);try{const _0x5e4583={};_0x5e4583[_0x50b087(0x105)]=_0x50b087(0xcc);const _0xa238db={};_0xa238db[_0x50b087(0xd6)]=this['licenseKey'];const _0x3c23f0=await fetch(_0x529da6,{'method':_0x50b087(0xf3),'headers':_0x5e4583,'body':JSON[_0x50b087(0xda)](_0xa238db),'signal':_0x19f607[_0x50b087(0xb2)]});clearTimeout(_0x5553c0);if(_0x3c23f0[_0x50b087(0xd0)]===0x193){console[_0x50b087(0xed)](_0x50b087(0xa6)),process[_0x50b087(0xe3)](0x1);return;}if(_0x3c23f0['status']===0x191){console[_0x50b087(0xed)](_0x50b087(0xf0)),process['exit'](0x1);return;}if(!_0x3c23f0['ok']){console[_0x50b087(0xed)](_0x50b087(0xdd)+_0x3c23f0[_0x50b087(0xd0)]+_0x50b087(0xbc));return;}const _0x562af2=await _0x3c23f0[_0x50b087(0x119)]();if(_0x562af2&&_0x562af2['token']){this[_0x50b087(0xd7)]=_0x562af2[_0x50b087(0xd6)];const _0x2c1961=path[_0x50b087(0xe5)](os['homedir'](),_0x50b087(0x104),_0x50b087(0xf2));try{const _0x476de0={};_0x476de0[_0x50b087(0xa2)]=!![],fs[_0x50b087(0x114)](path[_0x50b087(0xa9)](_0x2c1961),_0x476de0),fs[_0x50b087(0xc4)](_0x2c1961,_0x562af2[_0x50b087(0xd6)],_0x50b087(0x9d)),console[_0x50b087(0xed)]('[MCP\x20Agent]\x20Heartbeat:\x20License\x20token\x20successfully\x20refreshed.');}catch(_0x40942b){console[_0x50b087(0xed)]('[MCP\x20Agent]\x20Failed\x20to\x20save\x20refreshed\x20license\x20token\x20to\x20disk:',_0x40942b[_0x50b087(0xfa)]);}}}catch(_0x542998){clearTimeout(_0x5553c0),console[_0x50b087(0xed)](_0x50b087(0xcf),_0x542998[_0x50b087(0xfa)],_0x50b087(0xbc));}}}async[_0x5bdc97(0xcb)](){const _0x14f31f=_0x5bdc97;console['error']('[MCP\x20Agent]\x20Starting\x20server\x20at\x20'+this[_0x14f31f(0x9c)]);if(!this[_0x14f31f(0xe4)]){if(process.env.MCP_ADMIN_DIR){const _0x6a90d8=path[_0x14f31f(0xe5)](process.env.MCP_ADMIN_DIR,_0x14f31f(0xbb));fs[_0x14f31f(0xc2)](_0x6a90d8)&&(this[_0x14f31f(0xe4)]=fs[_0x14f31f(0xfb)](_0x6a90d8,_0x14f31f(0x9d))[_0x14f31f(0x11a)]());}if(!this['publicKey']){let _0x3813ed=__dirname;while(_0x3813ed){const _0x431414=path[_0x14f31f(0xe5)](_0x3813ed,'admin',_0x14f31f(0xbb));if(fs[_0x14f31f(0xc2)](_0x431414)){this['publicKey']=fs[_0x14f31f(0xfb)](_0x431414,_0x14f31f(0x9d))[_0x14f31f(0x11a)]();break;}const _0xff8ad5=path[_0x14f31f(0xa9)](_0x3813ed);if(_0xff8ad5===_0x3813ed)break;_0x3813ed=_0xff8ad5;}}}const _0x5b2c4f=this[_0x14f31f(0xc1)],_0x1642d6=!__dirname['replace'](/\\/g,'/')['split']('/')[_0x14f31f(0x11c)](_0x14f31f(0x11d)),_0x3205ec=process.env.MCP_SKIP_INTEGRITY_CHECK==='1'||_0x1642d6&&!fs[_0x14f31f(0xc2)](_0x5b2c4f);if(!_0x3205ec){const _0x234808=require(_0x14f31f(0xba));if(!fs['existsSync'](_0x5b2c4f)){console['error'](_0x14f31f(0xd8)),process[_0x14f31f(0xe3)](0x1);return;}let _0x30c1be;try{_0x30c1be=JSON[_0x14f31f(0x10e)](fs['readFileSync'](_0x5b2c4f,'utf8'));}catch(_0x15a23d){console[_0x14f31f(0xed)]('[MCP\x20Agent]\x20Integrity\x20check\x20failed:\x20Failed\x20to\x20parse\x20integrity-manifest.json.\x20Exiting.'),process[_0x14f31f(0xe3)](0x1);return;}if(!_0x30c1be['files']||!_0x30c1be[_0x14f31f(0x107)]){console[_0x14f31f(0xed)](_0x14f31f(0xe0)),process[_0x14f31f(0xe3)](0x1);return;}const _0x1a9af3=this[_0x14f31f(0xe4)]||require(_0x14f31f(0x9a))[_0x14f31f(0xb1)];try{const _0x18ad65=JSON[_0x14f31f(0xda)](_0x30c1be[_0x14f31f(0xd1)]),_0x363830=Buffer[_0x14f31f(0xd5)](_0x30c1be[_0x14f31f(0x107)],_0x14f31f(0xa7)),_0x3413f9=_0x234808['verify'](null,Buffer['from'](_0x18ad65),_0x1a9af3,_0x363830);if(!_0x3413f9){console['error'](_0x14f31f(0x108)),process['exit'](0x1);return;}}catch(_0x578f96){console[_0x14f31f(0xed)]('[MCP\x20Agent]\x20Integrity\x20check\x20failed:\x20Signature\x20verification\x20failed.\x20Exiting.'),process[_0x14f31f(0xe3)](0x1);return;}const _0x2c7c82=path[_0x14f31f(0xe5)](__dirname,_0x14f31f(0xce));for(const [_0x30f571,_0x4004af]of Object[_0x14f31f(0xb5)](_0x30c1be[_0x14f31f(0xd1)])){const _0x1e357f=path[_0x14f31f(0xe5)](_0x2c7c82,_0x30f571);if(!fs[_0x14f31f(0xc2)](_0x1e357f)){console['error']('[MCP\x20Agent]\x20Integrity\x20check\x20failed:\x20'+_0x30f571+'\x20modified.\x20Exiting.'),process[_0x14f31f(0xe3)](0x1);return;}try{const _0x3c83d6=fs[_0x14f31f(0xfb)](_0x1e357f),_0x36abe2=_0x234808[_0x14f31f(0xd4)]('sha256')[_0x14f31f(0xec)](_0x3c83d6)['digest'](_0x14f31f(0xef));if(_0x36abe2!==_0x4004af){console[_0x14f31f(0xed)](_0x14f31f(0xf8)+_0x30f571+_0x14f31f(0xe6)),process[_0x14f31f(0xe3)](0x1);return;}}catch(_0x1e8e84){console[_0x14f31f(0xed)](_0x14f31f(0xf8)+_0x30f571+_0x14f31f(0xe6)),process['exit'](0x1);return;}}}const _0x238166=process.env.MCP_SKIP_LICENSE_CHECK==='1';if(!_0x238166){if(!this[_0x14f31f(0x11b)]){const {getFingerprint:_0x27f0af}=require('../license/fingerprint.js');this[_0x14f31f(0x11b)]=_0x27f0af();}const _0x29522d=verifyLicense(this[_0x14f31f(0xd7)],this[_0x14f31f(0x11b)],this[_0x14f31f(0xe4)]);if(!_0x29522d[_0x14f31f(0xaf)]){if(_0x29522d['reason']==='License\x20expired'){const _0x83590=_0x29522d['payload']||{},_0x36fd34=_0x83590[_0x14f31f(0x112)]?new Date(_0x83590['exp'])['toISOString']()['split']('T')[0x0]:_0x14f31f(0x110);console[_0x14f31f(0xed)](_0x14f31f(0xbe)+_0x36fd34+_0x14f31f(0xea));}else console['error'](_0x14f31f(0x9e)+_0x29522d['reason']+'.\x20Contact\x20support\x20at\x20support@anhdh.io.\x20Exiting.');process[_0x14f31f(0xe3)](0x1);return;}console['error'](_0x14f31f(0xdf)+_0x29522d['payload']['user']),await this[_0x14f31f(0xad)](),this[_0x14f31f(0x101)]=setInterval(()=>{const _0x504e83=_0x14f31f;this[_0x504e83(0xad)]()[_0x504e83(0x117)](_0x2a4244=>{const _0x497f9d=_0x504e83;console[_0x497f9d(0xed)](_0x497f9d(0xb0),_0x2a4244[_0x497f9d(0xfa)]);});},0x18*0x3c*0x3c*0x3e8);}this[_0x14f31f(0x103)]=spawnBackends(this['projectPath']),this[_0x14f31f(0x111)]=!![];for(const _0xa2c761 of Object[_0x14f31f(0x10a)](this['backends'])){_0xa2c761['start']();}this[_0x14f31f(0x109)]=_0x5a0d34=>{const _0x2c204a=_0x14f31f;this['handleClientData'](_0x5a0d34[_0x2c204a(0xff)]());},process['stdin']['on']('data',this[_0x14f31f(0x109)]);}[_0x5bdc97(0x100)](_0xe414cc){const _0x406ec3=_0x5bdc97;this[_0x406ec3(0xa5)]+=_0xe414cc;const _0x8da828=this['clientBuffer'][_0x406ec3(0xb9)]('\x0a');this['clientBuffer']=_0x8da828['pop']();for(const _0x392aeb of _0x8da828){const _0xe0bd13=_0x392aeb['trim']();if(!_0xe0bd13)continue;try{const _0x159fa1=JSON[_0x406ec3(0x10e)](_0xe0bd13);this[_0x406ec3(0xb4)](_0x159fa1);}catch(_0x282a34){console[_0x406ec3(0xed)](_0x406ec3(0x9f),_0x392aeb,_0x282a34[_0x406ec3(0xfa)]);}}}async[_0x5bdc97(0xb4)](_0x180e77){const _0x285e04=_0x5bdc97,{id:_0x5848e5,method:_0x284f0a,params:_0x2958d6}=_0x180e77;if(!_0x284f0a)return;if(_0x284f0a==='initialize'){Promise[_0x285e04(0x116)](Object['values'](this[_0x285e04(0x103)])[_0x285e04(0xc5)](_0x25aba2=>_0x25aba2['sendRequest'](_0x285e04(0xe7),_0x2958d6)['catch'](_0x16d1e6=>{const _0x24d10e=_0x285e04;console[_0x24d10e(0xed)](_0x24d10e(0xaa)+(_0x25aba2['displayName']||_0x25aba2[_0x24d10e(0xc9)])+':',_0x16d1e6['message']);})));const _0x25cf81={};_0x25cf81[_0x285e04(0xf5)]=![];const _0xd9155={};_0xd9155[_0x285e04(0xc7)]=_0x25cf81;const _0x5c1a9a={};_0x5c1a9a[_0x285e04(0xc9)]=_0x285e04(0xe8),_0x5c1a9a[_0x285e04(0x11e)]=_0x285e04(0xa4);const _0x25ba6d={};_0x25ba6d[_0x285e04(0xfd)]=_0x2958d6[_0x285e04(0xfd)]||'2024-11-05',_0x25ba6d[_0x285e04(0xae)]=_0xd9155,_0x25ba6d[_0x285e04(0xb7)]=_0x5c1a9a;const _0x26faa8={};_0x26faa8['jsonrpc']=_0x285e04(0xf7),_0x26faa8['id']=_0x5848e5,_0x26faa8[_0x285e04(0xa8)]=_0x25ba6d;const _0xf73e8e=_0x26faa8;this['writeToClient'](_0xf73e8e);return;}if(_0x284f0a===_0x285e04(0xa0)){try{const _0x2bb5c7=Object[_0x285e04(0xb5)](this[_0x285e04(0x103)])['map'](async([_0x506770,_0x57f0bf])=>{const _0x4294f1=_0x285e04;try{const _0x240266=await _0x57f0bf[_0x4294f1(0xfe)](_0x4294f1(0xa0)),_0x2d689d=_0x240266&&_0x240266[_0x4294f1(0xa8)]&&_0x240266[_0x4294f1(0xa8)][_0x4294f1(0xc7)]||[];return translateToolList(_0x2d689d,_0x506770);}catch(_0x3ccf68){return console['error'](_0x4294f1(0xdb)+_0x506770+':',_0x3ccf68[_0x4294f1(0xfa)]),[];}}),_0x511c0c=await Promise[_0x285e04(0x116)](_0x2bb5c7),_0x156f05=_0x511c0c[_0x285e04(0xbd)](),_0x361d82={};_0x361d82[_0x285e04(0xc7)]=_0x156f05;const _0x3df3f6={};_0x3df3f6['jsonrpc']=_0x285e04(0xf7),_0x3df3f6['id']=_0x5848e5,_0x3df3f6['result']=_0x361d82;const _0x2ab560=_0x3df3f6;this[_0x285e04(0xd9)](_0x2ab560);}catch(_0x5f0f44){this[_0x285e04(0xe1)](_0x5848e5,-0x7f5b,_0x285e04(0x102)+_0x5f0f44['message']);}return;}if(_0x284f0a==='tools/call'){const _0x2100a5=_0x2958d6['name'],_0x5bc68f=mapExposedToOriginal(_0x2100a5);if(!_0x5bc68f)return this[_0x285e04(0xe1)](_0x5848e5,-0x7f59,'Tool\x20not\x20found:\x20'+_0x2100a5);try{const _0x28a199=this[_0x285e04(0x103)][_0x5bc68f[_0x285e04(0xd3)]];if(!_0x28a199)return this[_0x285e04(0xe1)](_0x5848e5,-0x7f5b,_0x285e04(0xf6)+_0x5bc68f['backend']+'\x20is\x20not\x20running');const _0x1d9849={..._0x2958d6};_0x1d9849[_0x285e04(0xc9)]=_0x5bc68f[_0x285e04(0x118)];const _0x49f385={..._0x180e77};_0x49f385['params']=_0x1d9849;const _0xaf57cd=_0x49f385,_0x4fdf49=await _0x28a199[_0x285e04(0xb3)](_0xaf57cd);this['writeToClient'](_0x4fdf49);}catch(_0x6ce48a){this['writeError'](_0x5848e5,-0x7f5b,_0x285e04(0xb8)+_0x6ce48a['message']);}return;}for(const _0x2a4804 of Object[_0x285e04(0x10a)](this[_0x285e04(0x103)])){_0x2a4804[_0x285e04(0xe2)]&&_0x2a4804[_0x285e04(0xe2)][_0x285e04(0xe9)]['write'](JSON[_0x285e04(0xda)](_0x180e77)+'\x0a');}}[_0x5bdc97(0xd9)](_0x2ada1d){const _0xb6bbf2=_0x5bdc97;this[_0xb6bbf2(0xbf)][_0xb6bbf2(0xf4)](JSON[_0xb6bbf2(0xda)](_0x2ada1d)+'\x0a');}['writeError'](_0x34b65c,_0x340037,_0x4e44b8){const _0x4778cd=_0x5bdc97,_0xdedbd4={};_0xdedbd4[_0x4778cd(0xcd)]=_0x340037,_0xdedbd4[_0x4778cd(0xfa)]=_0x4e44b8;const _0x55f8c4={};_0x55f8c4[_0x4778cd(0xac)]='2.0',_0x55f8c4['id']=_0x34b65c,_0x55f8c4[_0x4778cd(0xed)]=_0xdedbd4;const _0x2d841c=_0x55f8c4;this['writeToClient'](_0x2d841c);}[_0x5bdc97(0x10b)](){const _0x362311=_0x5bdc97;this[_0x362311(0x111)]=![];this['heartbeatInterval']&&(clearInterval(this[_0x362311(0x101)]),this[_0x362311(0x101)]=null);this[_0x362311(0x109)]&&(process[_0x362311(0xe9)]['removeListener'](_0x362311(0xc0),this[_0x362311(0x109)]),this[_0x362311(0x109)]=null,process[_0x362311(0xe9)][_0x362311(0xfc)]());if(this[_0x362311(0x103)])for(const _0x4a5bcf of Object[_0x362311(0x10a)](this[_0x362311(0x103)])){_0x4a5bcf[_0x362311(0x10b)]();}}}const _0x3caedd={};function _0x5583(_0x1ccccc,_0x2e8c87){_0x1ccccc=_0x1ccccc-0x9a;const _0xd10eec=_0xd10e();let _0x5583e7=_0xd10eec[_0x1ccccc];if(_0x5583['eUanpR']===undefined){var _0x4507a7=function(_0x52f72f){const _0x4c5b3d='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x12daf3='',_0x4bb596='';for(let _0x553c6e=0x0,_0x5972dc,_0x25a35d,_0x3f5877=0x0;_0x25a35d=_0x52f72f['charAt'](_0x3f5877++);~_0x25a35d&&(_0x5972dc=_0x553c6e%0x4?_0x5972dc*0x40+_0x25a35d:_0x25a35d,_0x553c6e++%0x4)?_0x12daf3+=String['fromCharCode'](0xff&_0x5972dc>>(-0x2*_0x553c6e&0x6)):0x0){_0x25a35d=_0x4c5b3d['indexOf'](_0x25a35d);}for(let _0x3afd71=0x0,_0x25e63d=_0x12daf3['length'];_0x3afd71<_0x25e63d;_0x3afd71++){_0x4bb596+='%'+('00'+_0x12daf3['charCodeAt'](_0x3afd71)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x4bb596);};_0x5583['uckpQs']=_0x4507a7,_0x5583['CUKYGM']={},_0x5583['eUanpR']=!![];}const _0x2da4b7=_0xd10eec[0x0],_0x157838=_0x1ccccc+_0x2da4b7,_0x4f2e12=_0x5583['CUKYGM'][_0x157838];return!_0x4f2e12?(_0x5583e7=_0x5583['uckpQs'](_0x5583e7),_0x5583['CUKYGM'][_0x157838]=_0x5583e7):_0x5583e7=_0x4f2e12,_0x5583e7;}_0x3caedd['ProxyServer']=ProxyServer,module[_0x5bdc97(0x10c)]=_0x3caedd;function _0xd10e(){const _0x5aa30b=['BgLJzw5ZzuTLEq','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOGAw50zwDYAxr5lw1HBMLMzxn0lMPZB24GBwLZC2LUzY4GrxHPDgLUzY4','D3jPDgvuB0nSAwvUDa','C3rYAw5NAwz5','w01ducbbz2vUDf0GDg9VBhmVBgLZDcbYzxf1zxn0igzHAwXLzcbMB3iGC2vYDMLJzsa','Bg9HzeXPy2vUC2vlzxK','w01ducbbz2vUDf0GsgvHCNrIzwf0ihjLzNjLC2GGzMfPBgvKoIbtzxj2zxiGCMv0DxjUzwqG','ndu2ndq1q0fcDLnN','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGDMvYAwzPzwqGC3vJy2vZC2z1BgX5igzVCIb1C2vYoIa','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOGsw52ywXPzcbTyw5PzMvZDcbMB3jTyxqUiev4AxrPBMCU','D3jPDgvfCNjVCG','y2HPBgq','zxHPDa','ChvIBgLJs2v5','AM9PBG','ig1VzgLMAwvKlIbfEgL0Aw5NlG','Aw5PDgLHBgL6zq','BwnWlwfNzw50lxbYB3H5','C3rKAw4','lIbszw5LDYbHDcbODhrWCZOVl2fUAgrOlMLVl3jLBMv3lIbfEgL0Aw5NlG','ndeWnZq0B01VAKD3','DxbKyxrL','zxjYB3i','mZC2mZq3nM5UAhDyuG','Agv4','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGzxHWAxjLzcbVCIbPBNzHBgLKlIbfEgL0Aw5NlG','mtaZnJu1ngzqu0jOyG','BgLJzw5Zzs5RzxK','ue9tva','D3jPDgu','BgLZDenOyw5Nzwq','vgfYz2v0igjHy2TLBMqG','mI4W','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOG','oxfeEhvQrq','BwvZC2fNzq','CMvHzezPBgvtEw5J','Cgf1C2u','ChjVDg9JB2XwzxjZAw9U','C2vUzfjLCxvLC3q','Dg9tDhjPBMC','AgfUzgXLq2XPzw50rgf0yq','AgvHCNrIzwf0sw50zxj2ywW','rMfPBgvKihrVihf1zxj5ihrVB2WGBgLZDdOG','yMfJA2vUzhm','lMfUAgrO','q29UDgvUDc1uExbL','Ag9TzwrPCG','C2LNBMf0DxjL','w01ducbbz2vUDf0Gsw50zwDYAxr5ignOzwnRigzHAwXLzdOGsw52ywXPzcbZAwDUyxr1CMuUiev4AxrPBMCU','C3rKAw5mAxn0zw5LCG','DMfSDwvZ','C3rVCa','zxHWB3j0CW','ywjVCNq','CgfYC2u','BgvUz3rO','Dw5RBM93BG','CNvUBMLUzW','zxHW','mti4vu5Zr3HA','BwTKAxjtEw5J','rMfPBgvKihrVihn0yxj0ifbYB3H5u2vYDMvYoG','ywXS','y2f0y2G','B3jPz2LUywXoyw1L','ANnVBG','DhjPBq','zgv2AwnLswq','Aw5JBhvKzxm','zgLZDa','DMvYC2LVBG','mteWtvnwshvp','nZiYwvryvujR','BwfPBG','lI4VBgLJzw5Zzs92zxjPzNKUANm','nunvz0z3ta','ChjVAMvJDfbHDgG','DxrMoa','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGDMvYAwzPy2f0Aw9UigzHAwXLzdOG','w01ducbbz2vUDf0GrMfPBgvKihrVihbHCNnLiePtt04TuLbdig1LC3nHz2uGzNjVBsbJBgLLBNq6','Dg9VBhmVBgLZDa','odfnqKrYzLi','CMvJDxjZAxzL','Ahr0Chm6lY9Hz2vUDgTPDc5HBhbOyxrLy2HZlMfP','ms4WlJa','y2XPzw50qNvMzMvY','w01ducbbz2vUDf0GtgLJzw5ZzsbRzxKGAgfZigjLzw4GCMv2B2TLzc4GrxHPDgLUzY4','yMfZzty0DxjS','CMvZDwX0','zgLYBMfTzq','w01ducbbz2vUDf0GrMfPBgvKihrVigLUAxrPywXPEMuGC2vYDMLJzsa','y3DK','ANnVBNjWyW','CgvYzM9YBuHLyxj0yMvHDa','y2fWywjPBgL0AwvZ','DMfSAwq','w01ducbbz2vUDf0GugvYAw9KAwmGAgvHCNrIzwf0igvYCM9YoG','ufjprfvdveLptL9qvujmsunFs0vz','C2LNBMfS','zM9YD2fYzfjLCxvLC3q','AgfUzgXLq2XPzw50twvZC2fNzq','zw50CMLLCW','lI9IywnRzw5KCY5QCW','C2vYDMvYsw5MBW','vg9VBcbLEgvJDxrPB24GzMfPBgvKoIa','C3bSAxq','y3j5ChrV','BwfZDgvYlNb1yMXPyY5Wzw0','lIbdB250Aw51Aw5NihDPDgGGy2fJAgvKihrVA2vUlG','zMXHDa','w01ducbbz2vUDf0GtgLJzw5ZzsbLEhbPCMvKig9Uia','C3rKB3v0','zgf0yq','Aw50zwDYAxr5twfUAwzLC3rqyxrO','zxHPC3rZu3LUyW','Cgf0Aa','D3jPDgvgAwXLu3LUyW','BwfW','mJq4ntq4uMLvDu1r','Dg9VBhm','mtKWoti1sfrmDw91','BMfTzq','BwfZDgvYu2vJCMv0','C3rHCNq','yxbWBgLJyxrPB24VANnVBG','y29Kzq','lI4VlI4','w01ducbbz2vUDf0GsgvHCNrIzwf0ignOzwnRigzHAwXLzcbVCIb0Aw1LzcbVDxq6','C3rHDhvZ','zMLSzxm','BM93','yMfJA2vUza','y3jLyxrLsgfZAa','zNjVBq','Dg9Rzw4'];_0xd10e=function(){return _0x5aa30b;};return _0xd10e();}if(require[_0x5bdc97(0x121)]===module){const server=new ProxyServer();server[_0x5bdc97(0xcb)]()['catch'](_0x2d943c=>{const _0x4119b2=_0x5bdc97;console[_0x4119b2(0xed)](_0x4119b2(0x115),_0x2d943c['message']),process[_0x4119b2(0xe3)](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,127 +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
- ---
67
-
68
- ## Session Start Protocol (MANDATORY)
69
-
70
- At the start of every session:
71
- 1. Read `.agents/ARCHITECTURE.md` to understand Agents, Skills, and Scripts.
72
- 2. Read `.agents/memory/MEMORY.md` to load persistent project conventions.
73
- 3. Read `docs/agents/mcp-tools.md` to load MCP tool selection rules & memory conventions.
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.**
76
-
77
- ---
78
-
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.
83
-
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:
88
-
89
- | Risk Level | Behavior | Examples |
90
- |---|---|---|
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 |
94
-
95
- **Override:** User can always use explicit `@agent` mentions or `/slash-commands`. Explicit > auto-routing.
96
-
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`
102
-
103
- ---
104
-
105
- ## Socratic Gate
106
-
107
- Every user request must pass through the Socratic Gate before ANY implementation:
108
-
109
- | Request Type | Strategy | Required Action |
110
- |---|---|---|
111
- | **New Feature / Build** | Deep Discovery | ASK minimum 3 strategic questions |
112
- | **Code Edit / Bug Fix** | Context Check | Confirm understanding + ask impact questions |
113
- | **Vague / Simple** | Clarification | Ask Purpose, Users, and Scope |
114
-
115
- ---
116
-
117
- ## Universal Rules
118
-
119
- ### Clean Code (Global Mandatory)
120
- - **Code**: Concise, direct, no over-engineering. Self-documenting.
121
- - **Testing**: Mandatory. Pyramid (Unit > Int > E2E) + AAA Pattern.
122
- - **Performance**: Measure first. Adhere to current Core Web Vitals standards.
123
-
124
- ### Quick Reference
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`
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,115 +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
- - **system preset**: All of the above based on file context
84
-
85
- **Failure Condition:**
86
- - ❌ Writing UI code without loading design skill = **SLOP RISK**
87
- - ❌ Creating mobile screen without `mobile-rules` = **PLATFORM VIOLATION**
88
- - ❌ Designing web page without `ui-style-rules` = **GENERIC OUTPUT**
89
-
90
- ---
91
-
92
- ## 🛑 GLOBAL SOCRATIC GATE (TIER 0)
93
-
94
- Every user request must pass through the Socratic Gate before ANY tool use or implementation:
95
-
96
- | Request Type | Strategy | Required Action |
97
- |---|---|---|
98
- | **New Feature / Build** | Deep Discovery | ASK minimum 3 strategic questions |
99
- | **Code Edit / Bug Fix** | Context Check | Confirm understanding + ask impact questions |
100
- | **Vague / Simple** | Clarification | Ask Purpose, Users, and Scope |
101
- | **Full Orchestration** | Gatekeeper | **STOP** subagents until user confirms plan details |
102
- | **Direct "Proceed"** | Validation | **STOP** → Even if answers are given, ask 2 "Edge Case" questions |
103
-
104
- ---
105
-
106
- ## TIER 0: UNIVERSAL RULES
107
-
108
- ### 🧹 Clean Code (Global Mandatory)
109
- - **Code**: Concise, direct, no over-engineering. Self-documenting.
110
- - **Testing**: Mandatory. Pyramid (Unit > Int > E2E) + AAA Pattern.
111
- - **Performance**: Measure first. Adhere to current Core Web Vitals standards.
112
-
113
- ### 🗺️ Quick Reference
114
- - **Masters**: `orchestrator`, `project-planner`, `security-auditor`, `backend-specialist`, `frontend-specialist`, `mobile-developer`, `debugger`
115
- - **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`
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`