@sleep2agi/agent-network 2.0.0-preview.44 → 2.0.0-preview.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- const a0_0x5896a5=a0_0x9890;(function(_0x2a282e,_0x541854){const _0x3c5eba=a0_0x9890,_0x384130=_0x2a282e();while(!![]){try{const _0x34977a=-parseInt(_0x3c5eba(0x1d8))/0x1+parseInt(_0x3c5eba(0x197))/0x2+parseInt(_0x3c5eba(0x1af))/0x3*(parseInt(_0x3c5eba(0x1b2))/0x4)+-parseInt(_0x3c5eba(0x1bc))/0x5*(-parseInt(_0x3c5eba(0x1ac))/0x6)+-parseInt(_0x3c5eba(0x1bb))/0x7+-parseInt(_0x3c5eba(0x1c7))/0x8*(parseInt(_0x3c5eba(0x1a4))/0x9)+parseInt(_0x3c5eba(0x18c))/0xa;if(_0x34977a===_0x541854)break;else _0x384130['push'](_0x384130['shift']());}catch(_0x269b9f){_0x384130['push'](_0x384130['shift']());}}}(a0_0x1c75,0x7fa1f));import{EventEmitter as a0_0x15d2a7}from'events';import{hostname as a0_0x12d366}from'os';function a0_0x9890(_0x655792,_0x537a57){_0x655792=_0x655792-0x17f;const _0x1c75cc=a0_0x1c75();let _0x9890b7=_0x1c75cc[_0x655792];return _0x9890b7;}class T extends a0_0x15d2a7{[a0_0x5896a5(0x1a9)];[a0_0x5896a5(0x1ae)];[a0_0x5896a5(0x1a8)];['agent'];[a0_0x5896a5(0x18f)];[a0_0x5896a5(0x194)];['reconnectDelay'];[a0_0x5896a5(0x1c4)];[a0_0x5896a5(0x1ab)];[a0_0x5896a5(0x1c3)]=!0x1;constructor(_0xa2559d){const _0x55b66a=a0_0x5896a5;super();if(this['url']=_0xa2559d[_0x55b66a(0x1a9)][_0x55b66a(0x1c6)](/\/$/,''),this[_0x55b66a(0x1ae)]=_0xa2559d['alias'],this['token']=_0xa2559d[_0x55b66a(0x1a8)],this[_0x55b66a(0x1d2)]=_0xa2559d[_0x55b66a(0x1d2)]||_0x55b66a(0x1a2),this['resumeId']='sdk-'+_0xa2559d[_0x55b66a(0x1ae)]+'-'+Date[_0x55b66a(0x1b7)]()[_0x55b66a(0x1ad)](0x24),this[_0x55b66a(0x194)]=_0xa2559d[_0x55b66a(0x194)]??0x2bf20,this['reconnectDelay']=_0xa2559d['reconnectDelay']??0xbb8,_0xa2559d[_0x55b66a(0x1cc)]!==!0x1)this[_0x55b66a(0x181)]();}['log'](_0x111e76){const _0x4f9fac=a0_0x5896a5;console[_0x4f9fac(0x185)]('['+new Date()[_0x4f9fac(0x1c0)]()[_0x4f9fac(0x1a6)](0x0,0x8)+_0x4f9fac(0x19c)+this[_0x4f9fac(0x1ae)]+']\x20'+_0x111e76);}async[a0_0x5896a5(0x19f)](_0x5e05f0,_0x4d88e2){const _0xbca158=a0_0x5896a5;let _0x44ac09={'Content-Type':_0xbca158(0x1b9),'Accept':_0xbca158(0x190)};if(this[_0xbca158(0x1a8)])_0x44ac09[_0xbca158(0x1d0)]=_0xbca158(0x1b8)+this[_0xbca158(0x1a8)];let _0x39ee2b=await(await fetch(this[_0xbca158(0x1a9)]+_0xbca158(0x1d5),{'method':_0xbca158(0x17f),'headers':_0x44ac09,'body':JSON[_0xbca158(0x1ce)]({'jsonrpc':_0xbca158(0x191),'id':Date[_0xbca158(0x1b7)](),'method':_0xbca158(0x1ba),'params':{'name':_0x5e05f0,'arguments':_0x4d88e2}})}))[_0xbca158(0x1c9)](),_0xa5c4a0=_0x39ee2b['match'](/data: (.+)/),_0x166fe6=_0xa5c4a0?JSON['parse'](_0xa5c4a0[0x1]):JSON[_0xbca158(0x1cd)](_0x39ee2b),_0x21c659=_0x166fe6?.[_0xbca158(0x1c5)]?.[_0xbca158(0x1b4)]?.[0x0]?.[_0xbca158(0x1c9)];return _0x21c659?JSON[_0xbca158(0x1cd)](_0x21c659):_0x166fe6;}async[a0_0x5896a5(0x181)](){const _0x1fdca8=a0_0x5896a5;if(this[_0x1fdca8(0x1c3)])return;this[_0x1fdca8(0x1c3)]=!0x0,await this[_0x1fdca8(0x19a)]('idle'),this[_0x1fdca8(0x185)](_0x1fdca8(0x1c8)),this[_0x1fdca8(0x1c4)]=setInterval(()=>{const _0x467f4a=_0x1fdca8;this[_0x467f4a(0x19a)]('idle')[_0x467f4a(0x180)](_0x3e0e73=>this[_0x467f4a(0x185)](_0x467f4a(0x192)+_0x3e0e73[_0x467f4a(0x1b5)]));},this[_0x1fdca8(0x194)]),this[_0x1fdca8(0x18d)]();}async[a0_0x5896a5(0x189)](){const _0x3ab6a4=a0_0x5896a5;if(this[_0x3ab6a4(0x1c3)]=!0x1,this[_0x3ab6a4(0x1ab)]?.['abort'](),this['heartbeatTimer'])clearInterval(this[_0x3ab6a4(0x1c4)]);await this['status'](_0x3ab6a4(0x1b6))[_0x3ab6a4(0x180)](()=>{}),this[_0x3ab6a4(0x185)](_0x3ab6a4(0x18a));}async['send'](_0xfb5bce,_0x74bf7c,_0x488253=a0_0x5896a5(0x1b3)){const _0x39cde9=a0_0x5896a5;return this[_0x39cde9(0x19f)]('send_task',{'alias':_0xfb5bce,'task':_0x74bf7c,'priority':_0x488253,'from_session':this['alias']});}async['message'](_0x6aaad,_0x335ad7){const _0x41973e=a0_0x5896a5;return this[_0x41973e(0x19f)]('send_message',{'alias':_0x6aaad,'message':_0x335ad7,'from_session':this[_0x41973e(0x1ae)]});}async[a0_0x5896a5(0x1b1)](_0x3f43a6,_0x3c4f91,_0x1c747f=a0_0x5896a5(0x1be)){const _0x9e2beb=a0_0x5896a5;return this[_0x9e2beb(0x19f)](_0x9e2beb(0x1b1),{'task_id':_0x3f43a6,'text':_0x3c4f91,'status':_0x1c747f});}async[a0_0x5896a5(0x19a)](_0x53ec09,_0x525ed4){const _0x1855f5=a0_0x5896a5;return this[_0x1855f5(0x19f)](_0x1855f5(0x1d6),{'resume_id':this[_0x1855f5(0x18f)],'alias':this[_0x1855f5(0x1ae)],'status':_0x53ec09,'server':a0_0x12d366(),'hostname':a0_0x12d366(),'agent':this[_0x1855f5(0x1d2)],'project_dir':process[_0x1855f5(0x18e)](),..._0x525ed4});}async[a0_0x5896a5(0x1a1)](){const _0x5d20ff=a0_0x5896a5;return this[_0x5d20ff(0x19f)](_0x5d20ff(0x1cf),{});}async[a0_0x5896a5(0x183)](_0xcc9a72,_0x4fb6c6){const _0x559b71=a0_0x5896a5;return this[_0x559b71(0x19f)](_0x559b71(0x183),{'message':_0xcc9a72,'filter_server':_0x4fb6c6?.['server'],'filter_status':_0x4fb6c6?.['status']});}async['connectSSE'](){const _0x43b460=a0_0x5896a5;let _0x302cb0=encodeURIComponent(this[_0x43b460(0x1ae)]),_0x5dd50c=this[_0x43b460(0x1a9)]+_0x43b460(0x1a3)+_0x302cb0,_0x589e23=this[_0x43b460(0x186)];while(this[_0x43b460(0x1c3)]){try{this[_0x43b460(0x1ab)]=new AbortController();let _0xaccc64={'Accept':'text/event-stream'};if(this['token'])_0xaccc64[_0x43b460(0x1d0)]='Bearer\x20'+this[_0x43b460(0x1a8)];let _0x4f3c90=await fetch(_0x5dd50c,{'headers':_0xaccc64,'signal':this[_0x43b460(0x1ab)][_0x43b460(0x1b0)]});if(!_0x4f3c90['ok']||!_0x4f3c90[_0x43b460(0x195)]){this[_0x43b460(0x185)](_0x43b460(0x182)+_0x4f3c90['status']),await this[_0x43b460(0x1a0)](_0x589e23),_0x589e23=Math[_0x43b460(0x1a7)](_0x589e23*1.5,0xea60);continue;}_0x589e23=this[_0x43b460(0x186)];let _0x165a83=_0x4f3c90[_0x43b460(0x195)][_0x43b460(0x1c1)](),_0x3fd832=new TextDecoder(),_0x532c84='';while(this[_0x43b460(0x1c3)]){let {done:_0x42d2d8,value:_0x3ab949}=await _0x165a83[_0x43b460(0x18b)]();if(_0x42d2d8)break;_0x532c84+=_0x3fd832[_0x43b460(0x19b)](_0x3ab949,{'stream':!0x0});let _0x326443=_0x532c84['split']('\x0a');_0x532c84=_0x326443[_0x43b460(0x188)]()||'';for(let _0x1121aa of _0x326443){if(!_0x1121aa[_0x43b460(0x193)]('data:\x20'))continue;try{let _0x232841=JSON[_0x43b460(0x1cd)](_0x1121aa[_0x43b460(0x1a6)](0x6));if(_0x232841['type']===_0x43b460(0x1ca)){this[_0x43b460(0x185)](_0x43b460(0x1aa)),this[_0x43b460(0x1bd)](_0x43b460(0x1ca));continue;}if(_0x232841[_0x43b460(0x184)]==='new_task'||_0x232841['type']===_0x43b460(0x196)||_0x232841['type']===_0x43b460(0x183))await this['processInbox']();}catch{}}}}catch(_0x1495a2){if(_0x1495a2[_0x43b460(0x1cb)]===_0x43b460(0x1a5))break;this[_0x43b460(0x1bd)](_0x43b460(0x1d7),_0x1495a2),this[_0x43b460(0x185)](_0x43b460(0x199)+_0x1495a2[_0x43b460(0x1b5)]);}if(this['running'])this['emit'](_0x43b460(0x18a)),this[_0x43b460(0x185)](_0x43b460(0x187)+_0x589e23/0x3e8+_0x43b460(0x19d)),await this['sleep'](_0x589e23),_0x589e23=Math[_0x43b460(0x1a7)](_0x589e23*1.5,0xea60);}}async[a0_0x5896a5(0x1d4)](){const _0x43dd38=a0_0x5896a5;try{let _0x48f4d9=(await this[_0x43dd38(0x19f)](_0x43dd38(0x1d1),{'alias':this[_0x43dd38(0x1ae)],'limit':0xa}))?.[_0x43dd38(0x198)]||[];for(let _0x421687 of _0x48f4d9)await this[_0x43dd38(0x19f)](_0x43dd38(0x1bf),{'alias':this[_0x43dd38(0x1ae)],'message_id':_0x421687['id']}),this[_0x43dd38(0x185)]('←\x20'+_0x421687[_0x43dd38(0x1c2)]+':\x20'+_0x421687[_0x43dd38(0x1b4)][_0x43dd38(0x1a6)](0x0,0x3c)),this[_0x43dd38(0x1bd)](_0x43dd38(0x1d3),_0x421687),this[_0x43dd38(0x1bd)](_0x43dd38(0x1b5),_0x421687);}catch(_0x5ee08d){this['log'](_0x43dd38(0x19e)+_0x5ee08d[_0x43dd38(0x1b5)]);}}['sleep'](_0x4b2ffa){return new Promise(_0x6f8e6c=>setTimeout(_0x6f8e6c,_0x4b2ffa));}}function a0_0x1c75(){const _0x1ec475=['SSE\x20connected','sseAbort','6MWZTGL','toString','alias','6477hqaiZt','signal','reply','1172rBNrJv','normal','content','message','offline','now','Bearer\x20','application/json','tools/call','6912626mUFREN','3661895evunnz','emit','completed','ack_inbox','toTimeString','getReader','from_session','running','heartbeatTimer','result','replace','119272ZwRrkT','registered','text','connected','name','autoConnect','parse','stringify','get_all_status','Authorization','get_inbox','agent','task','processInbox','/mcp','report_status','error','690063KxGpcd','POST','catch','connect','SSE\x20failed:\x20','broadcast','type','log','reconnectDelay','SSE\x20reconnecting\x20in\x20','pop','disconnect','disconnected','read','8624420GjsqBc','connectSSE','cwd','resumeId','application/json,\x20text/event-stream','2.0','heartbeat\x20failed:\x20','startsWith','heartbeatInterval','body','new_message','333546ohfSvu','messages','SSE\x20error:\x20','status','decode',']\x20[commhub:','s...','inbox\x20error:\x20','call','sleep','getAllStatus','sdk','/events/','117paXItI','AbortError','slice','min','token','url'];a0_0x1c75=function(){return _0x1ec475;};return a0_0x1c75();}var $=T;export{$ as default,T as CommHub};
1
+ const a0_0x5d7258=a0_0xfc9f;function a0_0x1a26(){const _0x1c5f2b=['sseAbort','new_message','get_all_status','text','getReader','send_task','replace','type','resumeId','heartbeatTimer','catch','sdk','12FfzOVa','send_message','239880PoOZGF','inbox\x20error:\x20','broadcast','signal','content','parse','reconnectDelay','disconnect','alias','message','url','idle','connectSSE','new_task','get_inbox','48811524fDmLZV','SSE\x20connected','3544fHFZEw','Authorization','AbortError','sleep','offline','5925186VMDbIF','14UNbzwP','toString','Bearer\x20','send','split','token','agent','disconnected','min','sdk-','s...','reply','data:\x20','autoConnect','emit','758vzFRsK','5338024aGzuZr','now','text/event-stream','/events/','connect','heartbeat\x20failed:\x20','status','decode','pop','SSE\x20error:\x20','running','6ZqvRSa','18905480foByXH','log','processInbox','connected','ack_inbox','SSE\x20failed:\x20','10ZROMTG','report_status','abort','2.0','from_session','task','2864115QCJVpT','call','heartbeatInterval','getAllStatus','normal','toTimeString','body','read','slice','cwd'];a0_0x1a26=function(){return _0x1c5f2b;};return a0_0x1a26();}function a0_0xfc9f(_0x30e3fc,_0x5c38c2){_0x30e3fc=_0x30e3fc-0xf9;const _0x1a26ca=a0_0x1a26();let _0xfc9f0c=_0x1a26ca[_0x30e3fc];return _0xfc9f0c;}(function(_0x2df832,_0x4fe2c8){const _0x3bd5ae=a0_0xfc9f,_0x11e9c5=_0x2df832();while(!![]){try{const _0x16cc0d=parseInt(_0x3bd5ae(0x103))/0x1*(-parseInt(_0x3bd5ae(0x145))/0x2)+-parseInt(_0x3bd5ae(0x134))/0x3*(parseInt(_0x3bd5ae(0x132))/0x4)+-parseInt(_0x3bd5ae(0x11c))/0x5*(parseInt(_0x3bd5ae(0x10f))/0x6)+-parseInt(_0x3bd5ae(0x14b))/0x7*(-parseInt(_0x3bd5ae(0x104))/0x8)+-parseInt(_0x3bd5ae(0x14a))/0x9+parseInt(_0x3bd5ae(0x116))/0xa*(-parseInt(_0x3bd5ae(0x110))/0xb)+parseInt(_0x3bd5ae(0x143))/0xc;if(_0x16cc0d===_0x4fe2c8)break;else _0x11e9c5['push'](_0x11e9c5['shift']());}catch(_0x1b9ac1){_0x11e9c5['push'](_0x11e9c5['shift']());}}}(a0_0x1a26,0xd4364));import{EventEmitter as a0_0x374eb6}from'events';import{hostname as a0_0x36e574}from'os';class T extends a0_0x374eb6{[a0_0x5d7258(0x13e)];[a0_0x5d7258(0x13c)];['token'];['agent'];[a0_0x5d7258(0x12e)];['heartbeatInterval'];['reconnectDelay'];['heartbeatTimer'];['sseAbort'];[a0_0x5d7258(0x10e)]=!0x1;constructor(_0x128603){const _0x390f97=a0_0x5d7258;super();if(this['url']=_0x128603[_0x390f97(0x13e)][_0x390f97(0x12c)](/\/$/,''),this[_0x390f97(0x13c)]=_0x128603[_0x390f97(0x13c)],this[_0x390f97(0xf9)]=_0x128603[_0x390f97(0xf9)],this['agent']=_0x128603['agent']||_0x390f97(0x131),this['resumeId']=_0x390f97(0xfd)+_0x128603['alias']+'-'+Date[_0x390f97(0x105)]()[_0x390f97(0x14c)](0x24),this[_0x390f97(0x11e)]=_0x128603[_0x390f97(0x11e)]??0x2bf20,this['reconnectDelay']=_0x128603[_0x390f97(0x13a)]??0xbb8,_0x128603[_0x390f97(0x101)]!==!0x1)this[_0x390f97(0x108)]();}['log'](_0x1a5dfc){const _0x58ced5=a0_0x5d7258;console[_0x58ced5(0x111)]('['+new Date()[_0x58ced5(0x121)]()[_0x58ced5(0x124)](0x0,0x8)+']\x20[commhub:'+this[_0x58ced5(0x13c)]+']\x20'+_0x1a5dfc);}async[a0_0x5d7258(0x11d)](_0x342fad,_0x2bb864){const _0x33756c=a0_0x5d7258;let _0x17b16f={'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x17b16f[_0x33756c(0x146)]=_0x33756c(0x14d)+this['token'];let _0x2b2227=await(await fetch(this['url']+'/mcp',{'method':'POST','headers':_0x17b16f,'body':JSON['stringify']({'jsonrpc':_0x33756c(0x119),'id':Date['now'](),'method':'tools/call','params':{'name':_0x342fad,'arguments':_0x2bb864}})}))['text'](),_0x392b71=_0x2b2227['match'](/data: (.+)/),_0x390abd=_0x392b71?JSON[_0x33756c(0x139)](_0x392b71[0x1]):JSON['parse'](_0x2b2227),_0x2803ee=_0x390abd?.['result']?.[_0x33756c(0x138)]?.[0x0]?.[_0x33756c(0x129)];return _0x2803ee?JSON[_0x33756c(0x139)](_0x2803ee):_0x390abd;}async[a0_0x5d7258(0x108)](){const _0x176276=a0_0x5d7258;if(this['running'])return;this['running']=!0x0,await this[_0x176276(0x10a)](_0x176276(0x13f)),this[_0x176276(0x111)]('registered'),this[_0x176276(0x12f)]=setInterval(()=>{const _0x25fc3c=_0x176276;this['status'](_0x25fc3c(0x13f))[_0x25fc3c(0x130)](_0x3b3e14=>this[_0x25fc3c(0x111)](_0x25fc3c(0x109)+_0x3b3e14['message']));},this['heartbeatInterval']),this[_0x176276(0x140)]();}async[a0_0x5d7258(0x13b)](){const _0x2ed87e=a0_0x5d7258;if(this[_0x2ed87e(0x10e)]=!0x1,this['sseAbort']?.[_0x2ed87e(0x118)](),this[_0x2ed87e(0x12f)])clearInterval(this[_0x2ed87e(0x12f)]);await this[_0x2ed87e(0x10a)](_0x2ed87e(0x149))['catch'](()=>{}),this[_0x2ed87e(0x111)](_0x2ed87e(0xfb));}async[a0_0x5d7258(0x14e)](_0x1eeb90,_0x6f8a18,_0x1c164e=a0_0x5d7258(0x120)){const _0x472267=a0_0x5d7258;return this['call'](_0x472267(0x12b),{'alias':_0x1eeb90,'task':_0x6f8a18,'priority':_0x1c164e,'from_session':this['alias']});}async[a0_0x5d7258(0x13d)](_0x4c6b4a,_0xb8c8c9){const _0x5b2305=a0_0x5d7258;return this[_0x5b2305(0x11d)](_0x5b2305(0x133),{'alias':_0x4c6b4a,'message':_0xb8c8c9,'from_session':this[_0x5b2305(0x13c)]});}async[a0_0x5d7258(0xff)](_0x2c4faa,_0x347b50,_0x443d69='completed'){const _0x2e57b2=a0_0x5d7258;return this['call'](_0x2e57b2(0xff),{'task_id':_0x2c4faa,'text':_0x347b50,'status':_0x443d69});}async[a0_0x5d7258(0x10a)](_0x7ececb,_0x4e3d2b){const _0x49e5c7=a0_0x5d7258;return this['call'](_0x49e5c7(0x117),{'resume_id':this[_0x49e5c7(0x12e)],'alias':this[_0x49e5c7(0x13c)],'status':_0x7ececb,'server':a0_0x36e574(),'hostname':a0_0x36e574(),'agent':this[_0x49e5c7(0xfa)],'project_dir':process[_0x49e5c7(0x125)](),..._0x4e3d2b});}async[a0_0x5d7258(0x11f)](){const _0x3fc739=a0_0x5d7258;return this['call'](_0x3fc739(0x128),{});}async[a0_0x5d7258(0x136)](_0x3246c1,_0x2a6c42){const _0x223198=a0_0x5d7258;return this[_0x223198(0x11d)](_0x223198(0x136),{'message':_0x3246c1,'filter_server':_0x2a6c42?.['server'],'filter_status':_0x2a6c42?.['status']});}async[a0_0x5d7258(0x140)](){const _0x4d23a2=a0_0x5d7258;let _0x38633a=encodeURIComponent(this[_0x4d23a2(0x13c)]),_0x15aeca=this[_0x4d23a2(0x13e)]+_0x4d23a2(0x107)+_0x38633a,_0x5d685a=this[_0x4d23a2(0x13a)];while(this['running']){try{this['sseAbort']=new AbortController();let _0x5d2ed5={'Accept':_0x4d23a2(0x106)};if(this['token'])_0x5d2ed5[_0x4d23a2(0x146)]='Bearer\x20'+this[_0x4d23a2(0xf9)];let _0x2ea26e=await fetch(_0x15aeca,{'headers':_0x5d2ed5,'signal':this[_0x4d23a2(0x126)][_0x4d23a2(0x137)]});if(!_0x2ea26e['ok']||!_0x2ea26e[_0x4d23a2(0x122)]){this[_0x4d23a2(0x111)](_0x4d23a2(0x115)+_0x2ea26e[_0x4d23a2(0x10a)]),await this['sleep'](_0x5d685a),_0x5d685a=Math['min'](_0x5d685a*1.5,0xea60);continue;}_0x5d685a=this[_0x4d23a2(0x13a)];let _0x3da08d=_0x2ea26e[_0x4d23a2(0x122)][_0x4d23a2(0x12a)](),_0x561925=new TextDecoder(),_0x59c0a2='';while(this[_0x4d23a2(0x10e)]){let {done:_0x145f53,value:_0x2c0d10}=await _0x3da08d[_0x4d23a2(0x123)]();if(_0x145f53)break;_0x59c0a2+=_0x561925[_0x4d23a2(0x10b)](_0x2c0d10,{'stream':!0x0});let _0x5c8fa2=_0x59c0a2[_0x4d23a2(0x14f)]('\x0a');_0x59c0a2=_0x5c8fa2[_0x4d23a2(0x10c)]()||'';for(let _0x5bc1ad of _0x5c8fa2){if(!_0x5bc1ad['startsWith'](_0x4d23a2(0x100)))continue;try{let _0x25ab51=JSON[_0x4d23a2(0x139)](_0x5bc1ad[_0x4d23a2(0x124)](0x6));if(_0x25ab51[_0x4d23a2(0x12d)]===_0x4d23a2(0x113)){this[_0x4d23a2(0x111)](_0x4d23a2(0x144)),this[_0x4d23a2(0x102)](_0x4d23a2(0x113));continue;}if(_0x25ab51['type']===_0x4d23a2(0x141)||_0x25ab51[_0x4d23a2(0x12d)]===_0x4d23a2(0x127)||_0x25ab51[_0x4d23a2(0x12d)]==='broadcast')await this['processInbox']();}catch{}}}}catch(_0x583edb){if(_0x583edb['name']===_0x4d23a2(0x147))break;this[_0x4d23a2(0x102)]('error',_0x583edb),this['log'](_0x4d23a2(0x10d)+_0x583edb[_0x4d23a2(0x13d)]);}if(this[_0x4d23a2(0x10e)])this[_0x4d23a2(0x102)](_0x4d23a2(0xfb)),this[_0x4d23a2(0x111)]('SSE\x20reconnecting\x20in\x20'+_0x5d685a/0x3e8+_0x4d23a2(0xfe)),await this[_0x4d23a2(0x148)](_0x5d685a),_0x5d685a=Math[_0x4d23a2(0xfc)](_0x5d685a*1.5,0xea60);}}async[a0_0x5d7258(0x112)](){const _0x87c625=a0_0x5d7258;try{let _0xa9fee0=(await this[_0x87c625(0x11d)](_0x87c625(0x142),{'alias':this['alias'],'limit':0xa}))?.['messages']||[];for(let _0x15d4ba of _0xa9fee0)await this[_0x87c625(0x11d)](_0x87c625(0x114),{'alias':this[_0x87c625(0x13c)],'message_id':_0x15d4ba['id']}),this[_0x87c625(0x111)]('←\x20'+_0x15d4ba[_0x87c625(0x11a)]+':\x20'+_0x15d4ba[_0x87c625(0x138)][_0x87c625(0x124)](0x0,0x3c)),this[_0x87c625(0x102)](_0x87c625(0x11b),_0x15d4ba),this[_0x87c625(0x102)]('message',_0x15d4ba);}catch(_0x780fbc){this[_0x87c625(0x111)](_0x87c625(0x135)+_0x780fbc['message']);}}[a0_0x5d7258(0x148)](_0x2cbc4a){return new Promise(_0x462f43=>setTimeout(_0x462f43,_0x2cbc4a));}}var $=T;export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x31012a=a0_0x54ff;(function(_0x541af0,_0x9091df){const _0x62ec4d=a0_0x54ff,_0xbea92d=_0x541af0();while(!![]){try{const _0x45d201=parseInt(_0x62ec4d(0x98))/0x1*(-parseInt(_0x62ec4d(0x101))/0x2)+parseInt(_0x62ec4d(0x106))/0x3*(parseInt(_0x62ec4d(0x97))/0x4)+parseInt(_0x62ec4d(0xb6))/0x5*(-parseInt(_0x62ec4d(0x8c))/0x6)+parseInt(_0x62ec4d(0xfb))/0x7*(-parseInt(_0x62ec4d(0xe5))/0x8)+-parseInt(_0x62ec4d(0xca))/0x9+parseInt(_0x62ec4d(0x11d))/0xa*(-parseInt(_0x62ec4d(0x10d))/0xb)+-parseInt(_0x62ec4d(0x96))/0xc*(-parseInt(_0x62ec4d(0xcc))/0xd);if(_0x45d201===_0x9091df)break;else _0xbea92d['push'](_0xbea92d['shift']());}catch(_0x2f6d22){_0xbea92d['push'](_0xbea92d['shift']());}}}(a0_0x2428,0x973be));function a0_0x54ff(_0x43cf67,_0x4aba92){_0x43cf67=_0x43cf67-0x8b;const _0x242892=a0_0x2428();let _0x54ff60=_0x242892[_0x43cf67];return _0x54ff60;}import{readFileSync as a0_0x282b36,existsSync as a0_0x5bedbf}from'fs';import{join as a0_0x2a478a}from'path';import{hostname as a0_0x3cddc6}from'os';function a0_0x2428(){const _0xd2e2bf=['object','low','stringify','Task\x20content','text','send_message','Priority\x20(default:\x20normal)','\x20from\x20','308450JiDPtk','completed','inbox_count','Session\x20alias:\x20','\x20ALIAS=','...\x20TMUX=','session\x20disconnected','ENV:\x20URL=','error','indexOf','SIGTERM','decode','get','commhub-channel','config.json','hub','\x20priority=','startsWith','\x20RESUME_ID=','join','4640625YDazaz','commhub','18218330DZTWXV','stdin','→\x20injected\x20task\x20','exit','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','commhub_send_task','commhub_reply','catch','MCP\x20stdio\x20connected','trim','status',']\x20[commhub]\x20','http://127.0.0.1:9200','\x20CWD=','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','randomUUID','idle','alias','Target\x20session\x20alias','.claude/channels/commhub','blocked','priority','delete','ack_inbox','messages','9416QaKRbx','report_status','SSE\x20stream\x20ended,\x20reconnecting...','CommHub\x20init\x20failed:\x20','stderr','claude-code','data:\x20','heartbeat\x20failed:\x20','0.3.0','POST','SSE\x20fatal:\x20','from_session','replace','cwd','from','SSE\x20connected\x20as\x20\x22','SSE\x20connection\x20error:\x20','ready\x20—\x20waiting\x20for\x20events','2025-03-26','tools/call','SSE\x20error:\x20','find','4067aaPitN','none','pop','content','application/json,\x20text/event-stream','Message\x20content','4766VEedvl','string','parse\x20error:\x20','commhub_get_all_status','send_task','3bmmyaY','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','set','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','setRequestHandler','broadcast','slice','187JNAvEe','notification','\x20PROJECT_ENV=','cancelled','length','.env','initialize','in_progress','Bearer\x20','SIGINT','commhub_send_message','working','←\x20message\x20from\x20','body','parse','commhub_report_status','137510DyBZzI','replied','message','24OgHZex','type','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','number','tmux\x20display-message\x20-p\x20\x27#S\x27','getReader','result','send_reply','get_all_status','utf-8','24CHVXOF','236044NWBljq','236nlemqZ','\x22\x20(','failed','token','end','connect','write','read','2.0','Progress\x200-100','normal','connecting\x20to\x20','toTimeString','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','unknown\x20tool','warning:\x20could\x20not\x20register:\x20','Current\x20task\x20description','/events/','message_id','split','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','registered\x20as\x20\x22'];a0_0x2428=function(){return _0xd2e2bf;};return a0_0x2428();}import{execSync as a0_0x524147}from'child_process';import{Server as a0_0x1bf7dc}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x579153}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x49272d,CallToolRequestSchema as a0_0x1cf1cc}from'@modelcontextprotocol/sdk/types.js';function p(_0x541eec){const _0x3634b3=a0_0x54ff;if(!a0_0x5bedbf(_0x541eec))return;for(let _0x163690 of a0_0x282b36(_0x541eec,'utf-8')[_0x3634b3(0xab)]('\x0a')){let _0x180735=_0x163690[_0x3634b3(0xd5)]();if(!_0x180735||_0x180735[_0x3634b3(0xc7)]('#'))continue;let _0x3b4e5d=_0x180735[_0x3634b3(0xbf)]('=');if(_0x3b4e5d<0x0)continue;let _0x283248=_0x180735[_0x3634b3(0x10c)](0x0,_0x3b4e5d)[_0x3634b3(0xd5)](),_0x38bcdd=_0x180735[_0x3634b3(0x10c)](_0x3b4e5d+0x1)['trim']()['replace'](/^["']|["']$/g,'');if(!process.env[_0x283248])process.env[_0x283248]=_0x38bcdd;}}var C=process.env.HOME||'~',T=a0_0x2a478a(C,a0_0x31012a(0xdf));p(a0_0x2a478a(T,a0_0x31012a(0x112)));var L=process[a0_0x31012a(0xf2)]()[a0_0x31012a(0xf1)](/\//g,'-');p(a0_0x2a478a(T,L,a0_0x31012a(0x112)));function U(){const _0x5c36a1=a0_0x31012a;try{return a0_0x524147(_0x5c36a1(0x90),{'encoding':'utf-8','timeout':0x7d0})[_0x5c36a1(0xd5)]();}catch{return'';}}function c(){const _0x2617c3=a0_0x31012a;try{let _0x82c42f=a0_0x2a478a(C,'.anet',_0x2617c3(0xc4));if(a0_0x5bedbf(_0x82c42f))return JSON['parse'](a0_0x282b36(_0x82c42f,_0x2617c3(0x95)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x31012a(0xc5)]||a0_0x31012a(0xd8),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x3cddc6(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x31012a(0xdb)](),X=process.env.COMMHUB_TOKEN||H[a0_0x31012a(0x9b)]||'';function Y(_0x299e7d){const _0x4377ba=a0_0x31012a;let _0xb7f5e0=new Date()[_0x4377ba(0xa4)]()[_0x4377ba(0x10c)](0x0,0x8);process[_0x4377ba(0xe9)][_0x4377ba(0x9e)]('['+_0xb7f5e0+_0x4377ba(0xd7)+_0x299e7d+'\x0a');}function h(_0x2b9a59){return new Promise(_0x2f65e0=>setTimeout(_0x2f65e0,_0x2b9a59));}Y(a0_0x31012a(0xbd)+D+a0_0x31012a(0xba)+Z+a0_0x31012a(0xc8)+w[a0_0x31012a(0x10c)](0x0,0x8)+a0_0x31012a(0xbb)+(f||a0_0x31012a(0xfc))+a0_0x31012a(0xd9)+process[a0_0x31012a(0xf2)]()+a0_0x31012a(0x10f)+L);var k=new Map(),K=new a0_0x1bf7dc({'name':a0_0x31012a(0xc3),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':['Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x31012a(0xac),a0_0x31012a(0xd0),a0_0x31012a(0xb9)+Z][a0_0x31012a(0xc9)]('\x0a')});K[a0_0x31012a(0x10a)](a0_0x49272d,async()=>({'tools':[{'name':a0_0x31012a(0xd2),'description':a0_0x31012a(0xa5),'inputSchema':{'type':a0_0x31012a(0xae),'properties':{'task_id':{'type':'string','description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x31012a(0x102),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':'string','enum':[a0_0x31012a(0xb7),a0_0x31012a(0x9a),'cancelled','blocked',a0_0x31012a(0xbe),a0_0x31012a(0x114)],'description':a0_0x31012a(0xda)}},'required':['text']}},{'name':a0_0x31012a(0x11c),'description':a0_0x31012a(0x109),'inputSchema':{'type':a0_0x31012a(0xae),'properties':{'status':{'type':a0_0x31012a(0x102),'enum':[a0_0x31012a(0x118),a0_0x31012a(0xdc),a0_0x31012a(0xe0),a0_0x31012a(0xbe)]},'task':{'type':'string','description':a0_0x31012a(0xa8)},'progress':{'type':a0_0x31012a(0x8f),'description':a0_0x31012a(0xa1)}},'required':[a0_0x31012a(0xd6)]}},{'name':a0_0x31012a(0xd1),'description':a0_0x31012a(0x8e),'inputSchema':{'type':a0_0x31012a(0xae),'properties':{'alias':{'type':a0_0x31012a(0x102),'description':a0_0x31012a(0xde)},'task':{'type':'string','description':a0_0x31012a(0xb1)},'priority':{'type':a0_0x31012a(0x102),'enum':['high',a0_0x31012a(0xa2),a0_0x31012a(0xaf)],'description':a0_0x31012a(0xb4)}},'required':[a0_0x31012a(0xdd),'task']}},{'name':a0_0x31012a(0x117),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x31012a(0xae),'properties':{'alias':{'type':a0_0x31012a(0x102),'description':a0_0x31012a(0xde)},'message':{'type':a0_0x31012a(0x102),'description':a0_0x31012a(0x100)}},'required':[a0_0x31012a(0xdd),a0_0x31012a(0x8b)]}},{'name':a0_0x31012a(0x104),'description':a0_0x31012a(0x107),'inputSchema':{'type':a0_0x31012a(0xae),'properties':{}}}]}));async function P(_0xa5bfc7,_0x10765e){const _0x3eb4f6=a0_0x31012a;let _0x1d325d=await fetch(D+'/mcp',{'method':_0x3eb4f6(0xee),'headers':{'Content-Type':'application/json','Accept':_0x3eb4f6(0xff),...X?{'Authorization':_0x3eb4f6(0x115)+X}:{}},'body':JSON[_0x3eb4f6(0xb0)]({'jsonrpc':_0x3eb4f6(0xa0),'id':0x1,'method':_0x3eb4f6(0x113),'params':{'protocolVersion':_0x3eb4f6(0xf7),'capabilities':{},'clientInfo':{'name':_0x3eb4f6(0xc3),'version':_0x3eb4f6(0xed)}}})});if(!_0x1d325d['ok']){let _0x3f7e1f=await _0x1d325d[_0x3eb4f6(0xb2)]();return Y(_0x3eb4f6(0xe8)+_0x1d325d[_0x3eb4f6(0xd6)]+'\x20'+_0x3f7e1f['slice'](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x1d325d[_0x3eb4f6(0xd6)]};}await _0x1d325d[_0x3eb4f6(0xb2)]();let _0x18dadf=(await(await fetch(D+'/mcp',{'method':'POST','headers':{'Content-Type':'application/json','Accept':_0x3eb4f6(0xff),...X?{'Authorization':_0x3eb4f6(0x115)+X}:{}},'body':JSON[_0x3eb4f6(0xb0)]({'jsonrpc':_0x3eb4f6(0xa0),'id':0x2,'method':_0x3eb4f6(0xf8),'params':{'name':_0xa5bfc7,'arguments':_0x10765e}})}))[_0x3eb4f6(0xb2)]())[_0x3eb4f6(0xab)]('\x0a')['find'](_0x4b14b3=>_0x4b14b3[_0x3eb4f6(0xc7)]('data:\x20'));if(_0x18dadf){let _0x1d58ba=JSON[_0x3eb4f6(0x11b)](_0x18dadf[_0x3eb4f6(0x10c)](0x6));return _0x1d58ba?.[_0x3eb4f6(0x92)]?.[_0x3eb4f6(0xfe)]?.[0x0]?.[_0x3eb4f6(0xb2)]?JSON[_0x3eb4f6(0x11b)](_0x1d58ba['result'][_0x3eb4f6(0xfe)][0x0]['text']):_0x1d58ba;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x31012a(0x10a)](a0_0x1cf1cc,async _0xd13c5=>{const _0x419791=a0_0x31012a;let {name:_0x1b4284,arguments:_0x5db03b}=_0xd13c5['params'];if(_0x1b4284==='commhub_reply'){let {task_id:_0xec8376,text:_0x3914f1,status:_0x5578f3}=_0x5db03b;if(_0x5578f3===_0x419791(0xb7)||_0x5578f3===_0x419791(0x9a)||_0x5578f3===_0x419791(0x110)){let _0x1c2716=_0x5578f3===_0x419791(0xb7)?_0x419791(0x11e):_0x5578f3,_0x180430=_0xec8376?k[_0x419791(0xc2)](_0xec8376)||_0x419791(0xc5):_0x419791(0xc5),_0x631dff=await P(_0x419791(0x93),{'alias':_0x180430,'text':_0x3914f1,'in_reply_to':_0xec8376||void 0x0,'status':_0x1c2716,'from_session':Z});if(_0xec8376)k[_0x419791(0xe2)](_0xec8376);return{'content':[{'type':_0x419791(0xb2),'text':JSON['stringify'](_0x631dff)}]};}let _0x5792fb=await P(_0x419791(0xe6),{'resume_id':w,'alias':Z,'status':_0x5578f3==='blocked'?_0x419791(0xe0):_0x5578f3===_0x419791(0xbe)?_0x419791(0xbe):_0x419791(0x118),'task':_0x3914f1[_0x419791(0x10c)](0x0,0xc8),'output':_0x3914f1});return{'content':[{'type':_0x419791(0xb2),'text':JSON[_0x419791(0xb0)](_0x5792fb)}]};}if(_0x1b4284===_0x419791(0x11c)){let {status:_0x53a2cb,task:_0x5bc642,progress:_0x433679}=_0x5db03b,_0x379d25=await P(_0x419791(0xe6),{'resume_id':w,'alias':Z,'status':_0x53a2cb,'task':_0x5bc642,'progress':_0x433679});return{'content':[{'type':_0x419791(0xb2),'text':JSON['stringify'](_0x379d25)}]};}if(_0x1b4284===_0x419791(0xd1)){let {alias:_0x560d74,task:_0x5e3278,priority:_0x4c661e}=_0x5db03b,_0x5bed0f=await P(_0x419791(0x105),{'alias':_0x560d74,'task':_0x5e3278,'priority':_0x4c661e||_0x419791(0xa2),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x419791(0xb0)](_0x5bed0f)}]};}if(_0x1b4284===_0x419791(0x117)){let {alias:_0x46145d,message:_0x119e20}=_0x5db03b,_0x476bf1=await P(_0x419791(0xb3),{'alias':_0x46145d,'message':_0x119e20,'from_session':Z});return{'content':[{'type':_0x419791(0xb2),'text':JSON[_0x419791(0xb0)](_0x476bf1)}]};}if(_0x1b4284===_0x419791(0x104)){let _0x6a09ce=await P(_0x419791(0x94),{});return{'content':[{'type':'text','text':JSON[_0x419791(0xb0)](_0x6a09ce)}]};}return{'content':[{'type':_0x419791(0xb2),'text':JSON[_0x419791(0xb0)]({'error':_0x419791(0xa6)})}]};});async function v(){const _0x1fc967=a0_0x31012a;let _0x359cb6=D+_0x1fc967(0xa9)+encodeURIComponent(Z),_0x53a12f={};if(X)_0x53a12f['Authorization']=_0x1fc967(0x115)+X;Y(_0x1fc967(0xa3)+_0x359cb6);while(!0x0){try{let _0x16d88e=await fetch(_0x359cb6,{'headers':_0x53a12f});if(!_0x16d88e['ok']){Y(_0x1fc967(0xf9)+_0x16d88e[_0x1fc967(0xd6)]+'\x20'+_0x16d88e['statusText']),await h(0x1388);continue;}let _0x4fa4e7=_0x16d88e[_0x1fc967(0x11a)][_0x1fc967(0x91)](),_0x563aae=new TextDecoder(),_0xa2e4='';while(!0x0){let {done:_0x456470,value:_0x8cccb9}=await _0x4fa4e7[_0x1fc967(0x9f)]();if(_0x456470)break;_0xa2e4+=_0x563aae[_0x1fc967(0xc1)](_0x8cccb9,{'stream':!0x0});let _0x3d10e3=_0xa2e4[_0x1fc967(0xab)]('\x0a\x0a');_0xa2e4=_0x3d10e3[_0x1fc967(0xfd)]()||'';for(let _0x2e20d1 of _0x3d10e3){let _0x276d6d=_0x2e20d1[_0x1fc967(0xab)]('\x0a')[_0x1fc967(0xfa)](_0xe63161=>_0xe63161['startsWith'](_0x1fc967(0xeb)));if(!_0x276d6d)continue;try{let _0xe7fe1f=JSON[_0x1fc967(0x11b)](_0x276d6d[_0x1fc967(0x10c)](0x6));await u(_0xe7fe1f);}catch(_0x552506){Y(_0x1fc967(0x103)+_0x552506);}}}Y(_0x1fc967(0xe7));}catch(_0x540547){Y(_0x1fc967(0xf5)+_0x540547);}await h(0xbb8);}}async function u(_0xeefcaa){const _0x56e9a8=a0_0x31012a;if(_0xeefcaa['type']==='connected'){Y(_0x56e9a8(0xf4)+Z+'\x22');return;}if(_0xeefcaa['type']==='new_message'){if(Y(_0x56e9a8(0x119)+_0xeefcaa['from']+':\x20'+_0xeefcaa['message'][_0x56e9a8(0x10c)](0x0,0x3c)),await K[_0x56e9a8(0x10e)]({'method':'notifications/claude/channel','params':{'content':_0xeefcaa[_0x56e9a8(0x8b)],'meta':{'sender':_0xeefcaa['from']||_0x56e9a8(0xc5),'sender_id':_0x56e9a8(0xcb),'user':_0xeefcaa[_0x56e9a8(0xf3)]||_0x56e9a8(0xc5),'priority':_0x56e9a8(0xa2)}}}),_0xeefcaa[_0x56e9a8(0xaa)])await P(_0x56e9a8(0xe3),{'alias':Z,'message_id':_0xeefcaa['message_id']});return;}if(_0xeefcaa[_0x56e9a8(0x8d)]==='new_task'||_0xeefcaa[_0x56e9a8(0x8d)]===_0x56e9a8(0x10b)){Y('←\x20'+_0xeefcaa['type']+':\x20inbox_count='+_0xeefcaa[_0x56e9a8(0xb8)]+_0x56e9a8(0xc6)+(_0xeefcaa[_0x56e9a8(0xe1)]||_0x56e9a8(0xa2)));let _0x176928=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x176928?.['ok']&&_0x176928[_0x56e9a8(0xe4)]?.[_0x56e9a8(0x111)]>0x0)for(let _0x38a352 of _0x176928[_0x56e9a8(0xe4)]){let _0x17c2fd={'sender':_0x38a352[_0x56e9a8(0xf0)]||_0x56e9a8(0xc5),'sender_id':_0x56e9a8(0xcb),'user':_0x38a352[_0x56e9a8(0xf0)]||_0x56e9a8(0xc5),'task_id':_0x38a352['id'],'priority':_0x38a352[_0x56e9a8(0xe1)]||_0x56e9a8(0xa2)};k[_0x56e9a8(0x108)](_0x38a352['id'],_0x38a352[_0x56e9a8(0xf0)]||_0x56e9a8(0xc5)),await K[_0x56e9a8(0x10e)]({'method':'notifications/claude/channel','params':{'content':_0x38a352[_0x56e9a8(0xfe)],'meta':_0x17c2fd}}),Y(_0x56e9a8(0xce)+_0x38a352['id']['slice'](0x0,0x8)+_0x56e9a8(0xb5)+_0x38a352[_0x56e9a8(0xf0)]+':\x20'+_0x38a352[_0x56e9a8(0xfe)][_0x56e9a8(0x10c)](0x0,0x3c)),await P(_0x56e9a8(0xe3),{'alias':Z,'message_id':_0x38a352['id']});}}}async function S(){const _0x1644a6=a0_0x31012a;let _0x325d72=new a0_0x579153();await K[_0x1644a6(0x9d)](_0x325d72),Y(_0x1644a6(0xd4)),Y('starting\x20SSE\x20listener...'),v()[_0x1644a6(0xd3)](_0x4ff2c4=>Y(_0x1644a6(0xef)+_0x4ff2c4)),P('report_status',{'resume_id':w,'alias':Z,'status':_0x1644a6(0xdc),'server':a0_0x3cddc6(),'hostname':a0_0x3cddc6(),'agent':_0x1644a6(0xea),'project_dir':process[_0x1644a6(0xf2)](),'tmux_name':f||void 0x0})['then'](()=>Y(_0x1644a6(0xad)+Z+_0x1644a6(0x99)+w[_0x1644a6(0x10c)](0x0,0x8)+')'))[_0x1644a6(0xd3)](_0x54b79a=>Y(_0x1644a6(0xa7)+_0x54b79a)),setInterval(()=>{const _0x16ee98=_0x1644a6;P(_0x16ee98(0xe6),{'resume_id':w,'alias':Z,'status':_0x16ee98(0xdc),'server':a0_0x3cddc6(),'hostname':a0_0x3cddc6(),'agent':_0x16ee98(0xea),'project_dir':process[_0x16ee98(0xf2)](),'tmux_name':f||void 0x0})[_0x16ee98(0xd3)](_0x428acb=>Y(_0x16ee98(0xec)+_0x428acb));},0x2bf20),Y(_0x1644a6(0xf6));}S()[a0_0x31012a(0xd3)](_0x156a9e=>{const _0x1dfa51=a0_0x31012a;Y('fatal:\x20'+_0x156a9e),process[_0x1dfa51(0xcf)](0x1);});async function N(){const _0x5569ec=a0_0x31012a;Y('shutting\x20down,\x20reporting\x20offline...'),await P(_0x5569ec(0xe6),{'resume_id':w,'alias':Z,'status':_0x5569ec(0xbe),'task':_0x5569ec(0xbc)})[_0x5569ec(0xd3)](()=>{}),process[_0x5569ec(0xcf)](0x0);}process[a0_0x31012a(0xcd)]['on'](a0_0x31012a(0x9c),()=>N()),process['on'](a0_0x31012a(0xc0),()=>N()),process['on'](a0_0x31012a(0x116),()=>N());
2
+ const a0_0x1788e5=a0_0xae98;(function(_0x4e0c22,_0x3332c7){const _0x17eea5=a0_0xae98,_0x5f5000=_0x4e0c22();while(!![]){try{const _0x358146=-parseInt(_0x17eea5(0x21f))/0x1*(-parseInt(_0x17eea5(0x1c4))/0x2)+-parseInt(_0x17eea5(0x1de))/0x3+-parseInt(_0x17eea5(0x200))/0x4*(parseInt(_0x17eea5(0x22a))/0x5)+parseInt(_0x17eea5(0x1ba))/0x6+-parseInt(_0x17eea5(0x1a9))/0x7+-parseInt(_0x17eea5(0x1ff))/0x8*(-parseInt(_0x17eea5(0x1ca))/0x9)+parseInt(_0x17eea5(0x1c1))/0xa;if(_0x358146===_0x3332c7)break;else _0x5f5000['push'](_0x5f5000['shift']());}catch(_0x2fe79d){_0x5f5000['push'](_0x5f5000['shift']());}}}(a0_0x532a,0xd4a86));import{readFileSync as a0_0x46e71a,existsSync as a0_0x5a2ae9}from'fs';import{join as a0_0x50dbd1}from'path';import{hostname as a0_0xacd5a}from'os';import{execSync as a0_0x52bfc2}from'child_process';import{Server as a0_0x33fbcb}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x19db8d}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x5b9919,CallToolRequestSchema as a0_0x260f94}from'@modelcontextprotocol/sdk/types.js';function p(_0x39d099){const _0x5f0944=a0_0xae98;if(!a0_0x5a2ae9(_0x39d099))return;for(let _0xffcb7e of a0_0x46e71a(_0x39d099,_0x5f0944(0x216))[_0x5f0944(0x221)]('\x0a')){let _0x53eeca=_0xffcb7e[_0x5f0944(0x1bb)]();if(!_0x53eeca||_0x53eeca[_0x5f0944(0x1d0)]('#'))continue;let _0x454247=_0x53eeca[_0x5f0944(0x20e)]('=');if(_0x454247<0x0)continue;let _0x9d9421=_0x53eeca['slice'](0x0,_0x454247)[_0x5f0944(0x1bb)](),_0x550b19=_0x53eeca[_0x5f0944(0x1c6)](_0x454247+0x1)[_0x5f0944(0x1bb)]()[_0x5f0944(0x1d2)](/^["']|["']$/g,'');if(!process.env[_0x9d9421])process.env[_0x9d9421]=_0x550b19;}}var C=process.env.HOME||'~',T=a0_0x50dbd1(C,a0_0x1788e5(0x1dd));p(a0_0x50dbd1(T,'.env'));var L=process[a0_0x1788e5(0x1ce)]()[a0_0x1788e5(0x1d2)](/\//g,'-');p(a0_0x50dbd1(T,L,'.env'));function U(){const _0x5e969d=a0_0x1788e5;try{return a0_0x52bfc2('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x5e969d(0x216),'timeout':0x7d0})[_0x5e969d(0x1bb)]();}catch{return'';}}function a0_0xae98(_0xe00cde,_0xfd0fb9){_0xe00cde=_0xe00cde-0x1a1;const _0x532a15=a0_0x532a();let _0xae98df=_0x532a15[_0xe00cde];return _0xae98df;}function c(){const _0x695aca=a0_0x1788e5;try{let _0x162393=a0_0x50dbd1(C,'.anet',_0x695aca(0x1e1));if(a0_0x5a2ae9(_0x162393))return JSON[_0x695aca(0x1c0)](a0_0x46e71a(_0x162393,_0x695aca(0x216)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x1788e5(0x22d)]||'http://127.0.0.1:9200',f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0xacd5a(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x1788e5(0x1bd)](),X=process.env.COMMHUB_TOKEN||H[a0_0x1788e5(0x210)]||'';function Y(_0x5592fa){const _0x23bfdd=a0_0x1788e5;let _0x579404=new Date()[_0x23bfdd(0x1cf)]()[_0x23bfdd(0x1c6)](0x0,0x8);process[_0x23bfdd(0x1c9)]['write']('['+_0x579404+_0x23bfdd(0x20b)+_0x5592fa+'\x0a');}function h(_0x5e2912){return new Promise(_0x5829a7=>setTimeout(_0x5829a7,_0x5e2912));}Y(a0_0x1788e5(0x1af)+D+a0_0x1788e5(0x1ed)+Z+'\x20RESUME_ID='+w[a0_0x1788e5(0x1c6)](0x0,0x8)+a0_0x1788e5(0x1f7)+(f||a0_0x1788e5(0x1ad))+'\x20CWD='+process[a0_0x1788e5(0x1ce)]()+a0_0x1788e5(0x222)+L);var k=new Map(),K=new a0_0x33fbcb({'name':a0_0x1788e5(0x226),'version':a0_0x1788e5(0x1b6)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x1788e5(0x1da),a0_0x1788e5(0x1e8),a0_0x1788e5(0x204),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x1788e5(0x1b5)+Z][a0_0x1788e5(0x1d8)]('\x0a')});K[a0_0x1788e5(0x1e7)](a0_0x5b9919,async()=>({'tools':[{'name':a0_0x1788e5(0x20d),'description':a0_0x1788e5(0x1a6),'inputSchema':{'type':a0_0x1788e5(0x1ae),'properties':{'task_id':{'type':a0_0x1788e5(0x1e0),'description':a0_0x1788e5(0x225)},'text':{'type':'string','description':a0_0x1788e5(0x1ec)},'status':{'type':a0_0x1788e5(0x1e0),'enum':[a0_0x1788e5(0x1a4),a0_0x1788e5(0x1fc),a0_0x1788e5(0x213),'blocked',a0_0x1788e5(0x1f9),a0_0x1788e5(0x1b8)],'description':a0_0x1788e5(0x1e6)}},'required':['text']}},{'name':a0_0x1788e5(0x1a3),'description':a0_0x1788e5(0x1f4),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x1788e5(0x1e0),'enum':[a0_0x1788e5(0x1f0),a0_0x1788e5(0x21b),a0_0x1788e5(0x1cd),'error']},'task':{'type':a0_0x1788e5(0x1e0),'description':a0_0x1788e5(0x1d9)},'progress':{'type':'number','description':a0_0x1788e5(0x1d1)}},'required':[a0_0x1788e5(0x1db)]}},{'name':a0_0x1788e5(0x20c),'description':a0_0x1788e5(0x1b0),'inputSchema':{'type':a0_0x1788e5(0x1ae),'properties':{'alias':{'type':a0_0x1788e5(0x1e0),'description':a0_0x1788e5(0x1cb)},'task':{'type':a0_0x1788e5(0x1e0),'description':'Task\x20content'},'priority':{'type':a0_0x1788e5(0x1e0),'enum':[a0_0x1788e5(0x1b3),a0_0x1788e5(0x1eb),'low'],'description':a0_0x1788e5(0x1f1)}},'required':[a0_0x1788e5(0x1f8),'task']}},{'name':a0_0x1788e5(0x1d4),'description':a0_0x1788e5(0x1d5),'inputSchema':{'type':a0_0x1788e5(0x1ae),'properties':{'alias':{'type':a0_0x1788e5(0x1e0),'description':a0_0x1788e5(0x1cb)},'message':{'type':a0_0x1788e5(0x1e0),'description':a0_0x1788e5(0x207)}},'required':[a0_0x1788e5(0x1f8),a0_0x1788e5(0x1e3)]}},{'name':a0_0x1788e5(0x21a),'description':a0_0x1788e5(0x215),'inputSchema':{'type':a0_0x1788e5(0x1ae),'properties':{}}}]}));function a0_0x532a(){const _0x337c43=['slice','pop','2.0','stderr','873OWuMZR','Target\x20session\x20alias','parse\x20error:\x20','blocked','cwd','toTimeString','startsWith','Progress\x200-100','replace','broadcast','commhub_send_message','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','ready\x20—\x20waiting\x20for\x20events','from','join','Current\x20task\x20description','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','status','end','.claude/channels/commhub','1933221JtsYmo','init\x20failed:\x20','string','config.json','connect','message','warning:\x20could\x20not\x20register:\x20','send_task','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','setRequestHandler','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','type','session\x20disconnected','normal','Reply\x20text\x20/\x20result\x20summary','\x20ALIAS=','\x20priority=','text','working','Priority\x20(default:\x20normal)','from_session','read','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','messages','SSE\x20stream\x20ended,\x20reconnecting...','...\x20TMUX=','alias','error','Bearer\x20','getReader','failed','body','decode','54232CtaDHw','23396XiUvQF','delete','2025-03-26','data:\x20','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','message_id','notifications/claude/channel','Message\x20content','→\x20injected\x20task\x20','notification','\x22\x20(',']\x20[commhub]\x20','commhub_send_task','commhub_reply','indexOf','/mcp','token','claude-code','find','cancelled','send_message','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','utf-8','tools/call','replied','catch','commhub_get_all_status','idle','fatal:\x20','SSE\x20connection\x20error:\x20','stdin','34019ZphaZE','unknown\x20tool','split','\x20PROJECT_ENV=','result','/events/','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','commhub-channel','MCP\x20stdio\x20connected','inbox_count','priority','985VhiFmP','then','report_status','hub','get_inbox','exit','commhub_report_status','completed','SSE\x20error:\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','commhub','SIGTERM','5698028EQGhRZ','send_reply','Authorization','SSE\x20fatal:\x20','none','object','ENV:\x20URL=','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','content','application/json','high','stringify','Session\x20alias:\x20','0.3.0','ack_inbox','in_progress','statusText','160536XtaypD','trim','length','randomUUID','new_task','set','parse','24572010jjMPkY','application/json,\x20text/event-stream','shutting\x20down,\x20reporting\x20offline...','20JilgAz','POST'];a0_0x532a=function(){return _0x337c43;};return a0_0x532a();}async function P(_0x1561c3,_0x273fd9){const _0x5a2a82=a0_0x1788e5;let _0x5fcf67=await fetch(D+'/mcp',{'method':_0x5a2a82(0x1c5),'headers':{'Content-Type':_0x5a2a82(0x1b2),'Accept':_0x5a2a82(0x1c2),...X?{'Authorization':_0x5a2a82(0x1fa)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x5a2a82(0x1c8),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x5a2a82(0x202),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':'0.3.0'}}})});if(!_0x5fcf67['ok']){let _0x202c26=await _0x5fcf67[_0x5a2a82(0x1ef)]();return Y('CommHub\x20init\x20failed:\x20'+_0x5fcf67[_0x5a2a82(0x1db)]+'\x20'+_0x202c26[_0x5a2a82(0x1c6)](0x0,0x64)),{'ok':!0x1,'error':_0x5a2a82(0x1df)+_0x5fcf67[_0x5a2a82(0x1db)]};}await _0x5fcf67['text']();let _0x11aec9=(await(await fetch(D+_0x5a2a82(0x20f),{'method':_0x5a2a82(0x1c5),'headers':{'Content-Type':_0x5a2a82(0x1b2),'Accept':_0x5a2a82(0x1c2),...X?{'Authorization':_0x5a2a82(0x1fa)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x2,'method':_0x5a2a82(0x217),'params':{'name':_0x1561c3,'arguments':_0x273fd9}})}))[_0x5a2a82(0x1ef)]())[_0x5a2a82(0x221)]('\x0a')[_0x5a2a82(0x212)](_0x384580=>_0x384580[_0x5a2a82(0x1d0)]('data:\x20'));if(_0x11aec9){let _0x3b681c=JSON[_0x5a2a82(0x1c0)](_0x11aec9[_0x5a2a82(0x1c6)](0x6));return _0x3b681c?.[_0x5a2a82(0x223)]?.[_0x5a2a82(0x1b1)]?.[0x0]?.['text']?JSON[_0x5a2a82(0x1c0)](_0x3b681c[_0x5a2a82(0x223)][_0x5a2a82(0x1b1)][0x0][_0x5a2a82(0x1ef)]):_0x3b681c;}return{'ok':!0x1,'error':'no\x20response'};}K['setRequestHandler'](a0_0x260f94,async _0x4d631e=>{const _0x106fec=a0_0x1788e5;let {name:_0x1bcd51,arguments:_0x2e2fab}=_0x4d631e['params'];if(_0x1bcd51===_0x106fec(0x20d)){let {task_id:_0x5adf96,text:_0x1b9a74,status:_0x155e3b}=_0x2e2fab;if(_0x155e3b===_0x106fec(0x1a4)||_0x155e3b===_0x106fec(0x1fc)||_0x155e3b===_0x106fec(0x213)){let _0x294bde=_0x155e3b===_0x106fec(0x1a4)?_0x106fec(0x218):_0x155e3b,_0x195ac6=_0x5adf96?k['get'](_0x5adf96)||_0x106fec(0x22d):_0x106fec(0x22d),_0x456d0e=await P(_0x106fec(0x1aa),{'alias':_0x195ac6,'text':_0x1b9a74,'in_reply_to':_0x5adf96||void 0x0,'status':_0x294bde,'from_session':Z});if(_0x5adf96)k[_0x106fec(0x201)](_0x5adf96);return{'content':[{'type':_0x106fec(0x1ef),'text':JSON['stringify'](_0x456d0e)}]};}let _0x27290e=await P(_0x106fec(0x22c),{'resume_id':w,'alias':Z,'status':_0x155e3b===_0x106fec(0x1cd)?_0x106fec(0x1cd):_0x155e3b===_0x106fec(0x1f9)?_0x106fec(0x1f9):'working','task':_0x1b9a74[_0x106fec(0x1c6)](0x0,0xc8),'output':_0x1b9a74});return{'content':[{'type':_0x106fec(0x1ef),'text':JSON[_0x106fec(0x1b4)](_0x27290e)}]};}if(_0x1bcd51===_0x106fec(0x1a3)){let {status:_0x58bfc2,task:_0x1b8b70,progress:_0x4643f6}=_0x2e2fab,_0x2bbe4e=await P(_0x106fec(0x22c),{'resume_id':w,'alias':Z,'status':_0x58bfc2,'task':_0x1b8b70,'progress':_0x4643f6});return{'content':[{'type':_0x106fec(0x1ef),'text':JSON[_0x106fec(0x1b4)](_0x2bbe4e)}]};}if(_0x1bcd51===_0x106fec(0x20c)){let {alias:_0x554f3d,task:_0x13d400,priority:_0x4d3980}=_0x2e2fab,_0x1b360e=await P(_0x106fec(0x1e5),{'alias':_0x554f3d,'task':_0x13d400,'priority':_0x4d3980||'normal','from_session':Z});return{'content':[{'type':'text','text':JSON[_0x106fec(0x1b4)](_0x1b360e)}]};}if(_0x1bcd51===_0x106fec(0x1d4)){let {alias:_0x233e01,message:_0x1dc4bd}=_0x2e2fab,_0x5bd8d2=await P(_0x106fec(0x214),{'alias':_0x233e01,'message':_0x1dc4bd,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x106fec(0x1b4)](_0x5bd8d2)}]};}if(_0x1bcd51===_0x106fec(0x21a)){let _0x548170=await P('get_all_status',{});return{'content':[{'type':'text','text':JSON[_0x106fec(0x1b4)](_0x548170)}]};}return{'content':[{'type':_0x106fec(0x1ef),'text':JSON[_0x106fec(0x1b4)]({'error':_0x106fec(0x220)})}]};});async function v(){const _0x57420e=a0_0x1788e5;let _0x35d4cd=D+_0x57420e(0x224)+encodeURIComponent(Z),_0x40cd53={};if(X)_0x40cd53[_0x57420e(0x1ab)]='Bearer\x20'+X;Y('connecting\x20to\x20'+_0x35d4cd);while(!0x0){try{let _0xff584d=await fetch(_0x35d4cd,{'headers':_0x40cd53});if(!_0xff584d['ok']){Y(_0x57420e(0x1a5)+_0xff584d[_0x57420e(0x1db)]+'\x20'+_0xff584d[_0x57420e(0x1b9)]),await h(0x1388);continue;}let _0x3b5945=_0xff584d[_0x57420e(0x1fd)][_0x57420e(0x1fb)](),_0x3a644f=new TextDecoder(),_0x2f38cc='';while(!0x0){let {done:_0x31002d,value:_0x3919ba}=await _0x3b5945[_0x57420e(0x1f3)]();if(_0x31002d)break;_0x2f38cc+=_0x3a644f[_0x57420e(0x1fe)](_0x3919ba,{'stream':!0x0});let _0x122738=_0x2f38cc[_0x57420e(0x221)]('\x0a\x0a');_0x2f38cc=_0x122738[_0x57420e(0x1c7)]()||'';for(let _0x26dfaa of _0x122738){let _0x2a43c8=_0x26dfaa[_0x57420e(0x221)]('\x0a')[_0x57420e(0x212)](_0x32e473=>_0x32e473['startsWith'](_0x57420e(0x203)));if(!_0x2a43c8)continue;try{let _0x521ab2=JSON['parse'](_0x2a43c8[_0x57420e(0x1c6)](0x6));await u(_0x521ab2);}catch(_0x3b6f7f){Y(_0x57420e(0x1cc)+_0x3b6f7f);}}}Y(_0x57420e(0x1f6));}catch(_0x330436){Y(_0x57420e(0x21d)+_0x330436);}await h(0xbb8);}}async function u(_0x2d3af6){const _0x486d98=a0_0x1788e5;if(_0x2d3af6['type']==='connected'){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x2d3af6[_0x486d98(0x1e9)]==='new_message'){if(Y('←\x20message\x20from\x20'+_0x2d3af6[_0x486d98(0x1d7)]+':\x20'+_0x2d3af6['message'][_0x486d98(0x1c6)](0x0,0x3c)),await K[_0x486d98(0x209)]({'method':_0x486d98(0x206),'params':{'content':_0x2d3af6[_0x486d98(0x1e3)],'meta':{'sender':_0x2d3af6[_0x486d98(0x1d7)]||_0x486d98(0x22d),'sender_id':_0x486d98(0x1a7),'user':_0x2d3af6[_0x486d98(0x1d7)]||_0x486d98(0x22d),'priority':_0x486d98(0x1eb)}}}),_0x2d3af6[_0x486d98(0x205)])await P(_0x486d98(0x1b7),{'alias':Z,'message_id':_0x2d3af6[_0x486d98(0x205)]});return;}if(_0x2d3af6[_0x486d98(0x1e9)]===_0x486d98(0x1be)||_0x2d3af6[_0x486d98(0x1e9)]===_0x486d98(0x1d3)){Y('←\x20'+_0x2d3af6[_0x486d98(0x1e9)]+':\x20inbox_count='+_0x2d3af6[_0x486d98(0x228)]+_0x486d98(0x1ee)+(_0x2d3af6[_0x486d98(0x229)]||_0x486d98(0x1eb)));let _0x23fd74=await P(_0x486d98(0x1a1),{'alias':Z,'limit':0x5});if(_0x23fd74?.['ok']&&_0x23fd74[_0x486d98(0x1f5)]?.[_0x486d98(0x1bc)]>0x0)for(let _0x9a4af5 of _0x23fd74[_0x486d98(0x1f5)]){let _0x5e52c0={'sender':_0x9a4af5[_0x486d98(0x1f2)]||_0x486d98(0x22d),'sender_id':'commhub','user':_0x9a4af5[_0x486d98(0x1f2)]||_0x486d98(0x22d),'task_id':_0x9a4af5['id'],'priority':_0x9a4af5[_0x486d98(0x229)]||_0x486d98(0x1eb)};k[_0x486d98(0x1bf)](_0x9a4af5['id'],_0x9a4af5[_0x486d98(0x1f2)]||_0x486d98(0x22d)),await K[_0x486d98(0x209)]({'method':'notifications/claude/channel','params':{'content':_0x9a4af5['content'],'meta':_0x5e52c0}}),Y(_0x486d98(0x208)+_0x9a4af5['id']['slice'](0x0,0x8)+'\x20from\x20'+_0x9a4af5[_0x486d98(0x1f2)]+':\x20'+_0x9a4af5[_0x486d98(0x1b1)]['slice'](0x0,0x3c)),await P(_0x486d98(0x1b7),{'alias':Z,'message_id':_0x9a4af5['id']});}}}async function S(){const _0x1439ff=a0_0x1788e5;let _0x2daec4=new a0_0x19db8d();await K[_0x1439ff(0x1e2)](_0x2daec4),Y(_0x1439ff(0x227)),Y('starting\x20SSE\x20listener...'),v()[_0x1439ff(0x219)](_0x2d3531=>Y(_0x1439ff(0x1ac)+_0x2d3531)),P(_0x1439ff(0x22c),{'resume_id':w,'alias':Z,'status':_0x1439ff(0x21b),'server':a0_0xacd5a(),'hostname':a0_0xacd5a(),'agent':_0x1439ff(0x211),'project_dir':process[_0x1439ff(0x1ce)](),'tmux_name':f||void 0x0})[_0x1439ff(0x22b)](()=>Y('registered\x20as\x20\x22'+Z+_0x1439ff(0x20a)+w[_0x1439ff(0x1c6)](0x0,0x8)+')'))['catch'](_0x1e4b17=>Y(_0x1439ff(0x1e4)+_0x1e4b17)),setInterval(()=>{const _0xd507ca=_0x1439ff;P(_0xd507ca(0x22c),{'resume_id':w,'alias':Z,'status':_0xd507ca(0x21b),'server':a0_0xacd5a(),'hostname':a0_0xacd5a(),'agent':_0xd507ca(0x211),'project_dir':process[_0xd507ca(0x1ce)](),'tmux_name':f||void 0x0})['catch'](_0x37053a=>Y('heartbeat\x20failed:\x20'+_0x37053a));},0x2bf20),Y(_0x1439ff(0x1d6));}S()[a0_0x1788e5(0x219)](_0x1bd3d0=>{const _0x2ca812=a0_0x1788e5;Y(_0x2ca812(0x21c)+_0x1bd3d0),process[_0x2ca812(0x1a2)](0x1);});async function N(){const _0x27d2a9=a0_0x1788e5;Y(_0x27d2a9(0x1c3)),await P(_0x27d2a9(0x22c),{'resume_id':w,'alias':Z,'status':_0x27d2a9(0x1f9),'task':_0x27d2a9(0x1ea)})[_0x27d2a9(0x219)](()=>{}),process[_0x27d2a9(0x1a2)](0x0);}process[a0_0x1788e5(0x21e)]['on'](a0_0x1788e5(0x1dc),()=>N()),process['on'](a0_0x1788e5(0x1a8),()=>N()),process['on']('SIGINT',()=>N());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.0.0-preview.44",
3
+ "version": "2.0.0-preview.46",
4
4
  "description": "AI Agent Network CLI \u2014 Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 39 commands.",
5
5
  "type": "module",
6
6
  "main": "dist/src/client.js",