@sleep2agi/agent-network 2.0.0-preview.2 → 2.0.0-preview.4

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
- function a0_0x4310(_0x3d525b,_0x440496){_0x3d525b=_0x3d525b-0x101;const _0x322e02=a0_0x322e();let _0x43101b=_0x322e02[_0x3d525b];return _0x43101b;}const a0_0x5da311=a0_0x4310;(function(_0x114b2c,_0x50b412){const _0x49f695=a0_0x4310,_0x222c39=_0x114b2c();while(!![]){try{const _0x3f2893=parseInt(_0x49f695(0x151))/0x1*(-parseInt(_0x49f695(0x14d))/0x2)+-parseInt(_0x49f695(0x10e))/0x3+parseInt(_0x49f695(0x13c))/0x4+-parseInt(_0x49f695(0x129))/0x5*(parseInt(_0x49f695(0x11b))/0x6)+parseInt(_0x49f695(0x115))/0x7+parseInt(_0x49f695(0x13e))/0x8*(-parseInt(_0x49f695(0x149))/0x9)+parseInt(_0x49f695(0x117))/0xa;if(_0x3f2893===_0x50b412)break;else _0x222c39['push'](_0x222c39['shift']());}catch(_0x593210){_0x222c39['push'](_0x222c39['shift']());}}}(a0_0x322e,0x79803));import{EventEmitter as a0_0x27f5be}from'events';function a0_0x322e(){const _0x33c8ac=['content','sleep','59ahDcfh','token','startsWith','sdk','application/json,\x20text/event-stream','Authorization','url','sdk-','log','SSE\x20connected','/mcp','agent','connectSSE','toTimeString','type','name','alias','AbortError','connect','tools/call','running','messages','2198094USUxKI','new_task','replace','min','broadcast','offline','getReader','1408064ARyXXJ','parse','26992440qUeYLD','from_session','idle','pop','5316918MSAome','new_message','get_inbox','body','slice','decode','SSE\x20reconnecting\x20in\x20','SSE\x20failed:\x20','processInbox','s...','Bearer\x20','inbox\x20error:\x20','ack_inbox','disconnected','5KRKaPr','/events/','reconnectDelay','call','send_message','now','connected','read','signal','report_status','autoConnect','heartbeatInterval','SSE\x20error:\x20','disconnect','reply','message','resumeId','send_task','error','379564nqdVPf','emit','38848cNeXvn','text/event-stream','match','heartbeatTimer','status','send','catch','2.0','POST',']\x20[commhub:','text','1044UKnsoc','toString','get_all_status','stringify','10694goowZg','normal'];a0_0x322e=function(){return _0x33c8ac;};return a0_0x322e();}import{hostname as a0_0x1a5023}from'os';class T extends a0_0x27f5be{[a0_0x5da311(0x157)];[a0_0x5da311(0x108)];['token'];[a0_0x5da311(0x103)];[a0_0x5da311(0x139)];['heartbeatInterval'];['reconnectDelay'];[a0_0x5da311(0x141)];['sseAbort'];[a0_0x5da311(0x10c)]=!0x1;constructor(_0x2ca193){const _0x11459f=a0_0x5da311;super();if(this[_0x11459f(0x157)]=_0x2ca193[_0x11459f(0x157)][_0x11459f(0x110)](/\/$/,''),this[_0x11459f(0x108)]=_0x2ca193[_0x11459f(0x108)],this[_0x11459f(0x152)]=_0x2ca193[_0x11459f(0x152)],this['agent']=_0x2ca193[_0x11459f(0x103)]||_0x11459f(0x154),this['resumeId']=_0x11459f(0x158)+_0x2ca193[_0x11459f(0x108)]+'-'+Date['now']()[_0x11459f(0x14a)](0x24),this[_0x11459f(0x134)]=_0x2ca193[_0x11459f(0x134)]??0x2bf20,this['reconnectDelay']=_0x2ca193[_0x11459f(0x12b)]??0xbb8,_0x2ca193[_0x11459f(0x133)]!==!0x1)this[_0x11459f(0x10a)]();}['log'](_0x17e767){const _0x5a5288=a0_0x5da311;console[_0x5a5288(0x159)]('['+new Date()[_0x5a5288(0x105)]()[_0x5a5288(0x11f)](0x0,0x8)+_0x5a5288(0x147)+this[_0x5a5288(0x108)]+']\x20'+_0x17e767);}async['call'](_0x48040,_0x1bc8be){const _0x75d7c5=a0_0x5da311;let _0x1bcdff={'Content-Type':'application/json','Accept':_0x75d7c5(0x155)};if(this[_0x75d7c5(0x152)])_0x1bcdff[_0x75d7c5(0x156)]=_0x75d7c5(0x125)+this[_0x75d7c5(0x152)];let _0xd95da6=await(await fetch(this[_0x75d7c5(0x157)]+_0x75d7c5(0x102),{'method':_0x75d7c5(0x146),'headers':_0x1bcdff,'body':JSON[_0x75d7c5(0x14c)]({'jsonrpc':_0x75d7c5(0x145),'id':Date[_0x75d7c5(0x12e)](),'method':_0x75d7c5(0x10b),'params':{'name':_0x48040,'arguments':_0x1bc8be}})}))[_0x75d7c5(0x148)](),_0x423b6c=_0xd95da6[_0x75d7c5(0x140)](/data: (.+)/),_0x21619f=_0x423b6c?JSON[_0x75d7c5(0x116)](_0x423b6c[0x1]):JSON[_0x75d7c5(0x116)](_0xd95da6),_0x325bf6=_0x21619f?.['result']?.[_0x75d7c5(0x14f)]?.[0x0]?.[_0x75d7c5(0x148)];return _0x325bf6?JSON[_0x75d7c5(0x116)](_0x325bf6):_0x21619f;}async[a0_0x5da311(0x10a)](){const _0x19cb1e=a0_0x5da311;if(this[_0x19cb1e(0x10c)])return;this[_0x19cb1e(0x10c)]=!0x0,await this[_0x19cb1e(0x142)]('idle'),this[_0x19cb1e(0x159)]('registered'),this[_0x19cb1e(0x141)]=setInterval(()=>{const _0x2b7be3=_0x19cb1e;this[_0x2b7be3(0x142)](_0x2b7be3(0x119))[_0x2b7be3(0x144)](_0x4c78c8=>this[_0x2b7be3(0x159)]('heartbeat\x20failed:\x20'+_0x4c78c8[_0x2b7be3(0x138)]));},this[_0x19cb1e(0x134)]),this[_0x19cb1e(0x104)]();}async[a0_0x5da311(0x136)](){const _0x373209=a0_0x5da311;if(this[_0x373209(0x10c)]=!0x1,this['sseAbort']?.['abort'](),this[_0x373209(0x141)])clearInterval(this[_0x373209(0x141)]);await this[_0x373209(0x142)](_0x373209(0x113))['catch'](()=>{}),this['log'](_0x373209(0x128));}async[a0_0x5da311(0x143)](_0x46948f,_0x270179,_0x37486f=a0_0x5da311(0x14e)){const _0x4085db=a0_0x5da311;return this['call'](_0x4085db(0x13a),{'alias':_0x46948f,'task':_0x270179,'priority':_0x37486f,'from_session':this[_0x4085db(0x108)]});}async['message'](_0x4e1baa,_0x5d3e8e){const _0x23c65a=a0_0x5da311;return this[_0x23c65a(0x12c)](_0x23c65a(0x12d),{'alias':_0x4e1baa,'message':_0x5d3e8e,'from_session':this[_0x23c65a(0x108)]});}async['reply'](_0x327094,_0x251ca8,_0x16b555='completed'){const _0x1f46ee=a0_0x5da311;return this[_0x1f46ee(0x12c)](_0x1f46ee(0x137),{'task_id':_0x327094,'text':_0x251ca8,'status':_0x16b555});}async[a0_0x5da311(0x142)](_0x184603,_0x2daf79){const _0x2e0cc1=a0_0x5da311;return this[_0x2e0cc1(0x12c)](_0x2e0cc1(0x132),{'resume_id':this[_0x2e0cc1(0x139)],'alias':this[_0x2e0cc1(0x108)],'status':_0x184603,'server':a0_0x1a5023(),'hostname':a0_0x1a5023(),'agent':this[_0x2e0cc1(0x103)],'project_dir':process['cwd'](),..._0x2daf79});}async['getAllStatus'](){const _0x1445e6=a0_0x5da311;return this['call'](_0x1445e6(0x14b),{});}async[a0_0x5da311(0x112)](_0x56a134,_0x39902d){const _0x5ed53e=a0_0x5da311;return this[_0x5ed53e(0x12c)](_0x5ed53e(0x112),{'message':_0x56a134,'filter_server':_0x39902d?.['server'],'filter_status':_0x39902d?.['status']});}async[a0_0x5da311(0x104)](){const _0x362ea9=a0_0x5da311;let _0xda99b9=encodeURIComponent(this[_0x362ea9(0x108)]),_0x1561cb=this[_0x362ea9(0x157)]+_0x362ea9(0x12a)+_0xda99b9,_0x39a845=this[_0x362ea9(0x12b)];while(this[_0x362ea9(0x10c)]){try{this['sseAbort']=new AbortController();let _0x579f2b={'Accept':_0x362ea9(0x13f)};if(this[_0x362ea9(0x152)])_0x579f2b[_0x362ea9(0x156)]=_0x362ea9(0x125)+this['token'];let _0x152748=await fetch(_0x1561cb,{'headers':_0x579f2b,'signal':this['sseAbort'][_0x362ea9(0x131)]});if(!_0x152748['ok']||!_0x152748['body']){this[_0x362ea9(0x159)](_0x362ea9(0x122)+_0x152748[_0x362ea9(0x142)]),await this[_0x362ea9(0x150)](_0x39a845),_0x39a845=Math[_0x362ea9(0x111)](_0x39a845*1.5,0xea60);continue;}_0x39a845=this[_0x362ea9(0x12b)];let _0x251cb5=_0x152748[_0x362ea9(0x11e)][_0x362ea9(0x114)](),_0x4e0d45=new TextDecoder(),_0x27ad94='';while(this[_0x362ea9(0x10c)]){let {done:_0x13f5e1,value:_0x3b0329}=await _0x251cb5[_0x362ea9(0x130)]();if(_0x13f5e1)break;_0x27ad94+=_0x4e0d45[_0x362ea9(0x120)](_0x3b0329,{'stream':!0x0});let _0x32eaeb=_0x27ad94['split']('\x0a');_0x27ad94=_0x32eaeb[_0x362ea9(0x11a)]()||'';for(let _0x269814 of _0x32eaeb){if(!_0x269814[_0x362ea9(0x153)]('data:\x20'))continue;try{let _0x2987dd=JSON['parse'](_0x269814[_0x362ea9(0x11f)](0x6));if(_0x2987dd['type']===_0x362ea9(0x12f)){this[_0x362ea9(0x159)](_0x362ea9(0x101)),this['emit'](_0x362ea9(0x12f));continue;}if(_0x2987dd['type']===_0x362ea9(0x10f)||_0x2987dd['type']===_0x362ea9(0x11c)||_0x2987dd[_0x362ea9(0x106)]===_0x362ea9(0x112))await this[_0x362ea9(0x123)]();}catch{}}}}catch(_0x397a84){if(_0x397a84[_0x362ea9(0x107)]===_0x362ea9(0x109))break;this[_0x362ea9(0x13d)](_0x362ea9(0x13b),_0x397a84),this[_0x362ea9(0x159)](_0x362ea9(0x135)+_0x397a84[_0x362ea9(0x138)]);}if(this[_0x362ea9(0x10c)])this[_0x362ea9(0x13d)]('disconnected'),this['log'](_0x362ea9(0x121)+_0x39a845/0x3e8+_0x362ea9(0x124)),await this[_0x362ea9(0x150)](_0x39a845),_0x39a845=Math[_0x362ea9(0x111)](_0x39a845*1.5,0xea60);}}async[a0_0x5da311(0x123)](){const _0x2e68f0=a0_0x5da311;try{let _0x5fd235=(await this['call'](_0x2e68f0(0x11d),{'alias':this[_0x2e68f0(0x108)],'limit':0xa}))?.[_0x2e68f0(0x10d)]||[];for(let _0x558117 of _0x5fd235)await this[_0x2e68f0(0x12c)](_0x2e68f0(0x127),{'alias':this[_0x2e68f0(0x108)],'message_id':_0x558117['id']}),this['log']('←\x20'+_0x558117[_0x2e68f0(0x118)]+':\x20'+_0x558117['content'][_0x2e68f0(0x11f)](0x0,0x3c)),this[_0x2e68f0(0x13d)]('task',_0x558117),this['emit'](_0x2e68f0(0x138),_0x558117);}catch(_0x1dd4de){this[_0x2e68f0(0x159)](_0x2e68f0(0x126)+_0x1dd4de[_0x2e68f0(0x138)]);}}[a0_0x5da311(0x150)](_0x57b96f){return new Promise(_0x3fb637=>setTimeout(_0x3fb637,_0x57b96f));}}var $=T;export{$ as default,T as CommHub};
1
+ const a0_0x2630a9=a0_0x18cc;function a0_0x22c5(){const _0xa3afb=['resumeId','body','11OqUdOv','2.0','running','get_all_status','connectSSE','url','send_task','new_message','content','now','read','46501XlsVim','46195CkWGVk','replace','tools/call','disconnect','data:\x20','SSE\x20connected','get_inbox','type','/events/','912bmMXex','normal','SSE\x20failed:\x20','token','result','registered','SSE\x20reconnecting\x20in\x20','call','inbox\x20error:\x20','parse','stringify','cwd','split','message','reconnectDelay','65129eKxhqj','sdk-','1328qZjUrS','text','catch','5520948IOuOdE','alias','connected','log','abort','reply','slice','text/event-stream','getAllStatus','min','s...','status','/mcp','14051244dDGXtz','agent','broadcast','Authorization','server','completed','Bearer\x20','offline','heartbeatTimer','new_task','toTimeString','send','sseAbort','emit','connect','1521831spAmpc','task','9cMQGSN','pop','application/json,\x20text/event-stream','heartbeat\x20failed:\x20','application/json','name','heartbeatInterval','8941870RxjHxN','signal','autoConnect','AbortError','34CyFCpy','POST','SSE\x20error:\x20','toString','getReader','sleep'];a0_0x22c5=function(){return _0xa3afb;};return a0_0x22c5();}(function(_0x154844,_0x343708){const _0x4923ac=a0_0x18cc,_0x78fd45=_0x154844();while(!![]){try{const _0x35cbd5=parseInt(_0x4923ac(0x22f))/0x1*(-parseInt(_0x4923ac(0x203))/0x2)+parseInt(_0x4923ac(0x1f6))/0x3+-parseInt(_0x4923ac(0x234))/0x4+-parseInt(_0x4923ac(0x217))/0x5*(-parseInt(_0x4923ac(0x220))/0x6)+-parseInt(_0x4923ac(0x216))/0x7*(-parseInt(_0x4923ac(0x231))/0x8)+parseInt(_0x4923ac(0x1f8))/0x9*(-parseInt(_0x4923ac(0x1ff))/0xa)+-parseInt(_0x4923ac(0x20b))/0xb*(-parseInt(_0x4923ac(0x241))/0xc);if(_0x35cbd5===_0x343708)break;else _0x78fd45['push'](_0x78fd45['shift']());}catch(_0x40f7c0){_0x78fd45['push'](_0x78fd45['shift']());}}}(a0_0x22c5,0xc434f));import{EventEmitter as a0_0x20a7f4}from'events';function a0_0x18cc(_0x548da2,_0x39305d){_0x548da2=_0x548da2-0x1eb;const _0x22c5b8=a0_0x22c5();let _0x18ccf6=_0x22c5b8[_0x548da2];return _0x18ccf6;}import{hostname as a0_0x1be352}from'os';class T extends a0_0x20a7f4{[a0_0x2630a9(0x210)];[a0_0x2630a9(0x235)];['token'];[a0_0x2630a9(0x242)];[a0_0x2630a9(0x209)];[a0_0x2630a9(0x1fe)];[a0_0x2630a9(0x22e)];['heartbeatTimer'];[a0_0x2630a9(0x1f3)];[a0_0x2630a9(0x20d)]=!0x1;constructor(_0x3d48be){const _0x32a1d2=a0_0x2630a9;super();if(this['url']=_0x3d48be[_0x32a1d2(0x210)][_0x32a1d2(0x218)](/\/$/,''),this[_0x32a1d2(0x235)]=_0x3d48be[_0x32a1d2(0x235)],this['token']=_0x3d48be[_0x32a1d2(0x223)],this[_0x32a1d2(0x242)]=_0x3d48be[_0x32a1d2(0x242)]||'sdk',this['resumeId']=_0x32a1d2(0x230)+_0x3d48be['alias']+'-'+Date[_0x32a1d2(0x214)]()[_0x32a1d2(0x206)](0x24),this[_0x32a1d2(0x1fe)]=_0x3d48be[_0x32a1d2(0x1fe)]??0x2bf20,this[_0x32a1d2(0x22e)]=_0x3d48be[_0x32a1d2(0x22e)]??0xbb8,_0x3d48be[_0x32a1d2(0x201)]!==!0x1)this[_0x32a1d2(0x1f5)]();}[a0_0x2630a9(0x237)](_0x2f90c8){const _0xa32dfe=a0_0x2630a9;console[_0xa32dfe(0x237)]('['+new Date()[_0xa32dfe(0x1f1)]()['slice'](0x0,0x8)+']\x20[commhub:'+this[_0xa32dfe(0x235)]+']\x20'+_0x2f90c8);}async[a0_0x2630a9(0x227)](_0x3d17de,_0x4d591a){const _0x4e3280=a0_0x2630a9;let _0x335cfa={'Content-Type':_0x4e3280(0x1fc),'Accept':_0x4e3280(0x1fa)};if(this['token'])_0x335cfa[_0x4e3280(0x244)]=_0x4e3280(0x1ed)+this[_0x4e3280(0x223)];let _0x2e07ce=await(await fetch(this[_0x4e3280(0x210)]+_0x4e3280(0x240),{'method':_0x4e3280(0x204),'headers':_0x335cfa,'body':JSON[_0x4e3280(0x22a)]({'jsonrpc':_0x4e3280(0x20c),'id':Date['now'](),'method':_0x4e3280(0x219),'params':{'name':_0x3d17de,'arguments':_0x4d591a}})}))[_0x4e3280(0x232)](),_0x2f3507=_0x2e07ce['match'](/data: (.+)/),_0x3266c2=_0x2f3507?JSON[_0x4e3280(0x229)](_0x2f3507[0x1]):JSON[_0x4e3280(0x229)](_0x2e07ce),_0x44d7a9=_0x3266c2?.[_0x4e3280(0x224)]?.['content']?.[0x0]?.[_0x4e3280(0x232)];return _0x44d7a9?JSON[_0x4e3280(0x229)](_0x44d7a9):_0x3266c2;}async[a0_0x2630a9(0x1f5)](){const _0x56b8dd=a0_0x2630a9;if(this[_0x56b8dd(0x20d)])return;this[_0x56b8dd(0x20d)]=!0x0,await this['status']('idle'),this[_0x56b8dd(0x237)](_0x56b8dd(0x225)),this[_0x56b8dd(0x1ef)]=setInterval(()=>{const _0x3cb529=_0x56b8dd;this[_0x3cb529(0x23f)]('idle')[_0x3cb529(0x233)](_0x1529c8=>this[_0x3cb529(0x237)](_0x3cb529(0x1fb)+_0x1529c8[_0x3cb529(0x22d)]));},this[_0x56b8dd(0x1fe)]),this[_0x56b8dd(0x20f)]();}async[a0_0x2630a9(0x21a)](){const _0x509e5b=a0_0x2630a9;if(this[_0x509e5b(0x20d)]=!0x1,this[_0x509e5b(0x1f3)]?.[_0x509e5b(0x238)](),this[_0x509e5b(0x1ef)])clearInterval(this[_0x509e5b(0x1ef)]);await this['status'](_0x509e5b(0x1ee))[_0x509e5b(0x233)](()=>{}),this[_0x509e5b(0x237)]('disconnected');}async[a0_0x2630a9(0x1f2)](_0x5b64d3,_0x598ea7,_0x4a1721=a0_0x2630a9(0x221)){const _0x201a1a=a0_0x2630a9;return this['call'](_0x201a1a(0x211),{'alias':_0x5b64d3,'task':_0x598ea7,'priority':_0x4a1721,'from_session':this['alias']});}async[a0_0x2630a9(0x22d)](_0x11aa12,_0x3b943d){const _0x8b63f1=a0_0x2630a9;return this[_0x8b63f1(0x227)]('send_message',{'alias':_0x11aa12,'message':_0x3b943d,'from_session':this[_0x8b63f1(0x235)]});}async[a0_0x2630a9(0x239)](_0x14afee,_0x52c3c6,_0xdaa83e=a0_0x2630a9(0x1ec)){const _0x37cbfb=a0_0x2630a9;return this[_0x37cbfb(0x227)](_0x37cbfb(0x239),{'task_id':_0x14afee,'text':_0x52c3c6,'status':_0xdaa83e});}async[a0_0x2630a9(0x23f)](_0x4b4f9e,_0x4ec86b){const _0x411cae=a0_0x2630a9;return this[_0x411cae(0x227)]('report_status',{'resume_id':this['resumeId'],'alias':this['alias'],'status':_0x4b4f9e,'server':a0_0x1be352(),'hostname':a0_0x1be352(),'agent':this[_0x411cae(0x242)],'project_dir':process[_0x411cae(0x22b)](),..._0x4ec86b});}async[a0_0x2630a9(0x23c)](){const _0x1969ef=a0_0x2630a9;return this['call'](_0x1969ef(0x20e),{});}async[a0_0x2630a9(0x243)](_0x343e1f,_0x55fd04){const _0x567aaa=a0_0x2630a9;return this['call'](_0x567aaa(0x243),{'message':_0x343e1f,'filter_server':_0x55fd04?.[_0x567aaa(0x1eb)],'filter_status':_0x55fd04?.['status']});}async[a0_0x2630a9(0x20f)](){const _0x2e3890=a0_0x2630a9;let _0x5b332c=encodeURIComponent(this['alias']),_0x529a45=this['url']+_0x2e3890(0x21f)+_0x5b332c,_0x218096=this[_0x2e3890(0x22e)];while(this[_0x2e3890(0x20d)]){try{this[_0x2e3890(0x1f3)]=new AbortController();let _0x1afc2a={'Accept':_0x2e3890(0x23b)};if(this[_0x2e3890(0x223)])_0x1afc2a[_0x2e3890(0x244)]=_0x2e3890(0x1ed)+this[_0x2e3890(0x223)];let _0x46c82f=await fetch(_0x529a45,{'headers':_0x1afc2a,'signal':this['sseAbort'][_0x2e3890(0x200)]});if(!_0x46c82f['ok']||!_0x46c82f[_0x2e3890(0x20a)]){this[_0x2e3890(0x237)](_0x2e3890(0x222)+_0x46c82f['status']),await this['sleep'](_0x218096),_0x218096=Math['min'](_0x218096*1.5,0xea60);continue;}_0x218096=this[_0x2e3890(0x22e)];let _0x407526=_0x46c82f[_0x2e3890(0x20a)][_0x2e3890(0x207)](),_0x41c1fc=new TextDecoder(),_0x2e9126='';while(this[_0x2e3890(0x20d)]){let {done:_0x37447f,value:_0x134061}=await _0x407526[_0x2e3890(0x215)]();if(_0x37447f)break;_0x2e9126+=_0x41c1fc['decode'](_0x134061,{'stream':!0x0});let _0x65da85=_0x2e9126[_0x2e3890(0x22c)]('\x0a');_0x2e9126=_0x65da85[_0x2e3890(0x1f9)]()||'';for(let _0x24ba26 of _0x65da85){if(!_0x24ba26['startsWith'](_0x2e3890(0x21b)))continue;try{let _0x59977a=JSON['parse'](_0x24ba26[_0x2e3890(0x23a)](0x6));if(_0x59977a[_0x2e3890(0x21e)]===_0x2e3890(0x236)){this[_0x2e3890(0x237)](_0x2e3890(0x21c)),this[_0x2e3890(0x1f4)](_0x2e3890(0x236));continue;}if(_0x59977a[_0x2e3890(0x21e)]===_0x2e3890(0x1f0)||_0x59977a['type']===_0x2e3890(0x212)||_0x59977a[_0x2e3890(0x21e)]===_0x2e3890(0x243))await this['processInbox']();}catch{}}}}catch(_0x3fa388){if(_0x3fa388[_0x2e3890(0x1fd)]===_0x2e3890(0x202))break;this[_0x2e3890(0x1f4)]('error',_0x3fa388),this[_0x2e3890(0x237)](_0x2e3890(0x205)+_0x3fa388['message']);}if(this['running'])this[_0x2e3890(0x1f4)]('disconnected'),this[_0x2e3890(0x237)](_0x2e3890(0x226)+_0x218096/0x3e8+_0x2e3890(0x23e)),await this['sleep'](_0x218096),_0x218096=Math[_0x2e3890(0x23d)](_0x218096*1.5,0xea60);}}async['processInbox'](){const _0x1fcf8c=a0_0x2630a9;try{let _0x119414=(await this[_0x1fcf8c(0x227)](_0x1fcf8c(0x21d),{'alias':this[_0x1fcf8c(0x235)],'limit':0xa}))?.['messages']||[];for(let _0x4f881f of _0x119414)await this[_0x1fcf8c(0x227)]('ack_inbox',{'alias':this[_0x1fcf8c(0x235)],'message_id':_0x4f881f['id']}),this[_0x1fcf8c(0x237)]('←\x20'+_0x4f881f['from_session']+':\x20'+_0x4f881f[_0x1fcf8c(0x213)][_0x1fcf8c(0x23a)](0x0,0x3c)),this[_0x1fcf8c(0x1f4)](_0x1fcf8c(0x1f7),_0x4f881f),this[_0x1fcf8c(0x1f4)](_0x1fcf8c(0x22d),_0x4f881f);}catch(_0x1268ea){this[_0x1fcf8c(0x237)](_0x1fcf8c(0x228)+_0x1268ea['message']);}}[a0_0x2630a9(0x208)](_0x208308){return new Promise(_0x43f8a4=>setTimeout(_0x43f8a4,_0x208308));}}var $=T;export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x5a24d8=a0_0x2e99;(function(_0x7b9ffb,_0x4221e5){const _0x244280=a0_0x2e99,_0x31017a=_0x7b9ffb();while(!![]){try{const _0x31ff1d=-parseInt(_0x244280(0x104))/0x1+parseInt(_0x244280(0xcc))/0x2+parseInt(_0x244280(0xab))/0x3+-parseInt(_0x244280(0x85))/0x4*(-parseInt(_0x244280(0xf3))/0x5)+parseInt(_0x244280(0xd8))/0x6*(-parseInt(_0x244280(0xfa))/0x7)+parseInt(_0x244280(0xb8))/0x8+parseInt(_0x244280(0xa2))/0x9*(-parseInt(_0x244280(0x112))/0xa);if(_0x31ff1d===_0x4221e5)break;else _0x31017a['push'](_0x31017a['shift']());}catch(_0x3c608f){_0x31017a['push'](_0x31017a['shift']());}}}(a0_0x211f,0x56a5f));import{readFileSync as a0_0x10de7b,existsSync as a0_0x12fbeb}from'fs';import{join as a0_0x2cd78d}from'path';import{hostname as a0_0xe34d17}from'os';function a0_0x2e99(_0x5f5d3d,_0x285bc5){_0x5f5d3d=_0x5f5d3d-0x83;const _0x211f5a=a0_0x211f();let _0x2e99e7=_0x211f5a[_0x5f5d3d];return _0x2e99e7;}import{execSync as a0_0x466c45}from'child_process';import{Server as a0_0x12193a}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0xde335d}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0xdbda12,CallToolRequestSchema as a0_0x447bbb}from'@modelcontextprotocol/sdk/types.js';function p(_0x25e83a){const _0x5e0089=a0_0x2e99;if(!a0_0x12fbeb(_0x25e83a))return;for(let _0x4344d1 of a0_0x10de7b(_0x25e83a,_0x5e0089(0xd6))[_0x5e0089(0xeb)]('\x0a')){let _0x117511=_0x4344d1['trim']();if(!_0x117511||_0x117511[_0x5e0089(0x9b)]('#'))continue;let _0x4622be=_0x117511[_0x5e0089(0x10c)]('=');if(_0x4622be<0x0)continue;let _0x42458c=_0x117511[_0x5e0089(0xbd)](0x0,_0x4622be)[_0x5e0089(0x101)](),_0x466dca=_0x117511['slice'](_0x4622be+0x1)[_0x5e0089(0x101)]()[_0x5e0089(0xd3)](/^["']|["']$/g,'');if(!process.env[_0x42458c])process.env[_0x42458c]=_0x466dca;}}var C=process.env.HOME||'~',T=a0_0x2cd78d(C,'.claude/channels/commhub');p(a0_0x2cd78d(T,a0_0x5a24d8(0x108)));var L=process[a0_0x5a24d8(0x110)]()[a0_0x5a24d8(0xd3)](/\//g,'-');p(a0_0x2cd78d(T,L,'.env'));function U(){const _0x506d41=a0_0x5a24d8;try{return a0_0x466c45('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x506d41(0xd6),'timeout':0x7d0})[_0x506d41(0x101)]();}catch{return'';}}function c(){const _0x21adeb=a0_0x5a24d8;try{let _0x5a0884=a0_0x2cd78d(C,_0x21adeb(0xed),_0x21adeb(0x95));if(a0_0x12fbeb(_0x5a0884))return JSON[_0x21adeb(0xee)](a0_0x10de7b(_0x5a0884,'utf-8'));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x5a24d8(0xe0)]||a0_0x5a24d8(0x10b),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0xe34d17(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x5a24d8(0xa0)](),X=process.env.COMMHUB_TOKEN||H[a0_0x5a24d8(0xc4)]||'';function Y(_0x4de0ee){const _0x2c813e=a0_0x5a24d8;let _0x4a7a40=new Date()[_0x2c813e(0xe7)]()[_0x2c813e(0xbd)](0x0,0x8);process[_0x2c813e(0xf1)][_0x2c813e(0xdb)]('['+_0x4a7a40+_0x2c813e(0xe9)+_0x4de0ee+'\x0a');}function h(_0x4b7f5f){return new Promise(_0x3869ce=>setTimeout(_0x3869ce,_0x4b7f5f));}Y(a0_0x5a24d8(0x84)+D+'\x20ALIAS='+Z+a0_0x5a24d8(0xac)+w[a0_0x5a24d8(0xbd)](0x0,0x8)+a0_0x5a24d8(0x109)+(f||a0_0x5a24d8(0xc8))+a0_0x5a24d8(0xd0)+process[a0_0x5a24d8(0x110)]()+a0_0x5a24d8(0x107)+L);var k=new Map(),K=new a0_0x12193a({'name':a0_0x5a24d8(0x9e),'version':a0_0x5a24d8(0x8b)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x5a24d8(0xc1),a0_0x5a24d8(0xd2),a0_0x5a24d8(0xe4),a0_0x5a24d8(0xfe),a0_0x5a24d8(0x105)+Z][a0_0x5a24d8(0x8e)]('\x0a')});K[a0_0x5a24d8(0xc9)](a0_0xdbda12,async()=>({'tools':[{'name':a0_0x5a24d8(0xbf),'description':a0_0x5a24d8(0xc6),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x5a24d8(0xdd),'description':a0_0x5a24d8(0x103)},'text':{'type':'string','description':a0_0x5a24d8(0xe6)},'status':{'type':a0_0x5a24d8(0xdd),'enum':[a0_0x5a24d8(0xe2),'failed',a0_0x5a24d8(0x90),a0_0x5a24d8(0xfb),'error',a0_0x5a24d8(0xce)],'description':a0_0x5a24d8(0xae)}},'required':['text']}},{'name':a0_0x5a24d8(0x87),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x5a24d8(0x9a),'properties':{'status':{'type':a0_0x5a24d8(0xdd),'enum':[a0_0x5a24d8(0xa8),a0_0x5a24d8(0x91),a0_0x5a24d8(0xfb),'error']},'task':{'type':a0_0x5a24d8(0xdd),'description':a0_0x5a24d8(0xbc)},'progress':{'type':'number','description':a0_0x5a24d8(0xaa)}},'required':['status']}},{'name':a0_0x5a24d8(0xde),'description':a0_0x5a24d8(0xff),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x5a24d8(0xdd),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x5a24d8(0xdd),'description':'Task\x20content'},'priority':{'type':a0_0x5a24d8(0xdd),'enum':[a0_0x5a24d8(0x102),a0_0x5a24d8(0xd1),'low'],'description':a0_0x5a24d8(0xd7)}},'required':[a0_0x5a24d8(0xa6),'task']}},{'name':'commhub_send_message','description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x5a24d8(0x9a),'properties':{'alias':{'type':a0_0x5a24d8(0xdd),'description':a0_0x5a24d8(0xa7)},'message':{'type':'string','description':'Message\x20content'}},'required':[a0_0x5a24d8(0xa6),a0_0x5a24d8(0xa4)]}},{'name':a0_0x5a24d8(0x9c),'description':a0_0x5a24d8(0xcb),'inputSchema':{'type':a0_0x5a24d8(0x9a),'properties':{}}}]}));async function P(_0x213908,_0x17fb12){const _0x3f8780=a0_0x5a24d8;let _0x1d8fc1=await fetch(D+_0x3f8780(0x106),{'method':_0x3f8780(0xf6),'headers':{'Content-Type':_0x3f8780(0x94),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x3f8780(0xe8)+X}:{}},'body':JSON[_0x3f8780(0x97)]({'jsonrpc':_0x3f8780(0x10f),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x3f8780(0xd4),'capabilities':{},'clientInfo':{'name':_0x3f8780(0x9e),'version':_0x3f8780(0x8b)}}})});if(!_0x1d8fc1['ok']){let _0x3a19e9=await _0x1d8fc1[_0x3f8780(0x93)]();return Y(_0x3f8780(0x9f)+_0x1d8fc1[_0x3f8780(0x92)]+'\x20'+_0x3a19e9[_0x3f8780(0xbd)](0x0,0x64)),{'ok':!0x1,'error':_0x3f8780(0xf4)+_0x1d8fc1[_0x3f8780(0x92)]};}await _0x1d8fc1[_0x3f8780(0x93)]();let _0x217d35=(await(await fetch(D+'/mcp',{'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x3f8780(0xe8)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x2,'method':'tools/call','params':{'name':_0x213908,'arguments':_0x17fb12}})}))[_0x3f8780(0x93)]())[_0x3f8780(0xeb)]('\x0a')[_0x3f8780(0xaf)](_0x3b06bc=>_0x3b06bc[_0x3f8780(0x9b)](_0x3f8780(0xa5)));if(_0x217d35){let _0x5d606b=JSON[_0x3f8780(0xee)](_0x217d35[_0x3f8780(0xbd)](0x6));return _0x5d606b?.[_0x3f8780(0x10e)]?.[_0x3f8780(0xd9)]?.[0x0]?.[_0x3f8780(0x93)]?JSON[_0x3f8780(0xee)](_0x5d606b[_0x3f8780(0x10e)][_0x3f8780(0xd9)][0x0][_0x3f8780(0x93)]):_0x5d606b;}return{'ok':!0x1,'error':_0x3f8780(0x88)};}function a0_0x211f(){const _0x4e70b8=['new_task','←\x20message\x20from\x20','12831jqYGMd','blocked','commhub_send_message','length','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','messages','trim','high','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','249985JKJNvm','Session\x20alias:\x20','/mcp','\x20PROJECT_ENV=','.env','...\x20TMUX=','get','http://127.0.0.1:9200','indexOf','ack_inbox','result','2.0','cwd','statusText','40mWAUuy','SSE\x20connection\x20error:\x20','ENV:\x20URL=','68IGLWTM','commhub','commhub_report_status','no\x20response','delete','failed','0.3.0','getReader','send_message','join','warning:\x20could\x20not\x20register:\x20','cancelled','idle','status','text','application/json','config.json','pop','stringify','then','SSE\x20stream\x20ended,\x20reconnecting...','object','startsWith','commhub_get_all_status','inbox_count','commhub-channel','CommHub\x20init\x20failed:\x20','randomUUID','notification','3266577ebIpxg','claude-code','message','data:\x20','alias','Target\x20session\x20alias','working','get_inbox','Progress\x200-100','1989948JyhfpA','\x20RESUME_ID=','error','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','find','from_session','MCP\x20stdio\x20connected','registered\x20as\x20\x22','SSE\x20error:\x20','shutting\x20down,\x20reporting\x20offline...','message_id','→\x20injected\x20task\x20','broadcast','3663336DtZLWS','set','decode','get_all_status','Current\x20task\x20description','slice','params','commhub_reply','catch','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','exit','\x20from\x20','token','heartbeat\x20failed:\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','session\x20disconnected','none','setRequestHandler','SSE\x20connected\x20as\x20\x22','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','1156588zBHFKv','from','in_progress','type','\x20CWD=','normal','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','replace','2025-03-26','connect','utf-8','Priority\x20(default:\x20normal)','1110UlpetR','content','\x20priority=','write','fatal:\x20','string','commhub_send_task','body','hub','ready\x20—\x20waiting\x20for\x20events','completed','/events/','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','SSE\x20fatal:\x20','Reply\x20text\x20/\x20result\x20summary','toTimeString','Bearer\x20',']\x20[commhub]\x20','priority','split','end','.anet','parse','SIGTERM','report_status','stderr',':\x20inbox_count=','204790ZaIFJe','init\x20failed:\x20','SIGINT','POST','unknown\x20tool'];a0_0x211f=function(){return _0x4e70b8;};return a0_0x211f();}K[a0_0x5a24d8(0xc9)](a0_0x447bbb,async _0xcb65a4=>{const _0x4df43a=a0_0x5a24d8;let {name:_0x35272e,arguments:_0xf54534}=_0xcb65a4[_0x4df43a(0xbe)];if(_0x35272e===_0x4df43a(0xbf)){let {task_id:_0x43ce4f,text:_0x225cbe,status:_0x1cafc8}=_0xf54534;if(_0x1cafc8==='completed'||_0x1cafc8===_0x4df43a(0x8a)||_0x1cafc8===_0x4df43a(0x90)){let _0x5c49e3=_0x1cafc8===_0x4df43a(0xe2)?'replied':_0x1cafc8,_0x23bc53=_0x43ce4f?k[_0x4df43a(0x10a)](_0x43ce4f)||_0x4df43a(0xe0):_0x4df43a(0xe0),_0x7630f2=await P('send_reply',{'alias':_0x23bc53,'text':_0x225cbe,'in_reply_to':_0x43ce4f||void 0x0,'status':_0x5c49e3,'from_session':Z});if(_0x43ce4f)k[_0x4df43a(0x89)](_0x43ce4f);return{'content':[{'type':'text','text':JSON[_0x4df43a(0x97)](_0x7630f2)}]};}let _0x2c2beb=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x1cafc8==='blocked'?'blocked':_0x1cafc8===_0x4df43a(0xad)?_0x4df43a(0xad):_0x4df43a(0xa8),'task':_0x225cbe[_0x4df43a(0xbd)](0x0,0xc8),'output':_0x225cbe});return{'content':[{'type':_0x4df43a(0x93),'text':JSON[_0x4df43a(0x97)](_0x2c2beb)}]};}if(_0x35272e===_0x4df43a(0x87)){let {status:_0x2f467a,task:_0x70e0f7,progress:_0x1f9797}=_0xf54534,_0x248b07=await P(_0x4df43a(0xf0),{'resume_id':w,'alias':Z,'status':_0x2f467a,'task':_0x70e0f7,'progress':_0x1f9797});return{'content':[{'type':_0x4df43a(0x93),'text':JSON[_0x4df43a(0x97)](_0x248b07)}]};}if(_0x35272e==='commhub_send_task'){let {alias:_0x3a43f7,task:_0x59c4aa,priority:_0x1e641c}=_0xf54534,_0x3d8ace=await P('send_task',{'alias':_0x3a43f7,'task':_0x59c4aa,'priority':_0x1e641c||_0x4df43a(0xd1),'from_session':Z});return{'content':[{'type':'text','text':JSON['stringify'](_0x3d8ace)}]};}if(_0x35272e===_0x4df43a(0xfc)){let {alias:_0x362a48,message:_0x20423f}=_0xf54534,_0x5c1e0=await P(_0x4df43a(0x8d),{'alias':_0x362a48,'message':_0x20423f,'from_session':Z});return{'content':[{'type':_0x4df43a(0x93),'text':JSON[_0x4df43a(0x97)](_0x5c1e0)}]};}if(_0x35272e==='commhub_get_all_status'){let _0x342e99=await P(_0x4df43a(0xbb),{});return{'content':[{'type':_0x4df43a(0x93),'text':JSON[_0x4df43a(0x97)](_0x342e99)}]};}return{'content':[{'type':'text','text':JSON['stringify']({'error':_0x4df43a(0xf7)})}]};});async function v(){const _0x27a7e6=a0_0x5a24d8;let _0x29babc=D+_0x27a7e6(0xe3)+encodeURIComponent(Z),_0x2a656b={};if(X)_0x2a656b['Authorization']=_0x27a7e6(0xe8)+X;Y('connecting\x20to\x20'+_0x29babc);while(!0x0){try{let _0x40ea2b=await fetch(_0x29babc,{'headers':_0x2a656b});if(!_0x40ea2b['ok']){Y(_0x27a7e6(0xb3)+_0x40ea2b['status']+'\x20'+_0x40ea2b[_0x27a7e6(0x111)]),await h(0x1388);continue;}let _0x478cc0=_0x40ea2b[_0x27a7e6(0xdf)][_0x27a7e6(0x8c)](),_0x5ac4af=new TextDecoder(),_0x4e7c50='';while(!0x0){let {done:_0x5198e0,value:_0xec87cb}=await _0x478cc0['read']();if(_0x5198e0)break;_0x4e7c50+=_0x5ac4af[_0x27a7e6(0xba)](_0xec87cb,{'stream':!0x0});let _0x31fb13=_0x4e7c50[_0x27a7e6(0xeb)]('\x0a\x0a');_0x4e7c50=_0x31fb13[_0x27a7e6(0x96)]()||'';for(let _0x2dc467 of _0x31fb13){let _0x2269f1=_0x2dc467['split']('\x0a')['find'](_0x3aacb5=>_0x3aacb5[_0x27a7e6(0x9b)](_0x27a7e6(0xa5)));if(!_0x2269f1)continue;try{let _0xa739bb=JSON[_0x27a7e6(0xee)](_0x2269f1[_0x27a7e6(0xbd)](0x6));await u(_0xa739bb);}catch(_0x45c568){Y('parse\x20error:\x20'+_0x45c568);}}}Y(_0x27a7e6(0x99));}catch(_0x2af1dd){Y(_0x27a7e6(0x83)+_0x2af1dd);}await h(0xbb8);}}async function u(_0x17b990){const _0x3d71ac=a0_0x5a24d8;if(_0x17b990['type']==='connected'){Y(_0x3d71ac(0xca)+Z+'\x22');return;}if(_0x17b990[_0x3d71ac(0xcf)]==='new_message'){if(Y(_0x3d71ac(0xf9)+_0x17b990[_0x3d71ac(0xcd)]+':\x20'+_0x17b990['message'][_0x3d71ac(0xbd)](0x0,0x3c)),await K[_0x3d71ac(0xa1)]({'method':'notifications/claude/channel','params':{'content':_0x17b990[_0x3d71ac(0xa4)],'meta':{'sender':_0x17b990[_0x3d71ac(0xcd)]||_0x3d71ac(0xe0),'sender_id':_0x3d71ac(0x86),'user':_0x17b990['from']||_0x3d71ac(0xe0),'priority':_0x3d71ac(0xd1)}}}),_0x17b990[_0x3d71ac(0xb5)])await P(_0x3d71ac(0x10d),{'alias':Z,'message_id':_0x17b990['message_id']});return;}if(_0x17b990[_0x3d71ac(0xcf)]===_0x3d71ac(0xf8)||_0x17b990[_0x3d71ac(0xcf)]===_0x3d71ac(0xb7)){Y('←\x20'+_0x17b990[_0x3d71ac(0xcf)]+_0x3d71ac(0xf2)+_0x17b990[_0x3d71ac(0x9d)]+_0x3d71ac(0xda)+(_0x17b990['priority']||_0x3d71ac(0xd1)));let _0x56df99=await P(_0x3d71ac(0xa9),{'alias':Z,'limit':0x5});if(_0x56df99?.['ok']&&_0x56df99[_0x3d71ac(0x100)]?.[_0x3d71ac(0xfd)]>0x0)for(let _0x40f494 of _0x56df99[_0x3d71ac(0x100)]){let _0x4d4b59={'sender':_0x40f494['from_session']||_0x3d71ac(0xe0),'sender_id':_0x3d71ac(0x86),'user':_0x40f494[_0x3d71ac(0xb0)]||_0x3d71ac(0xe0),'task_id':_0x40f494['id'],'priority':_0x40f494[_0x3d71ac(0xea)]||_0x3d71ac(0xd1)};k[_0x3d71ac(0xb9)](_0x40f494['id'],_0x40f494[_0x3d71ac(0xb0)]||_0x3d71ac(0xe0)),await K[_0x3d71ac(0xa1)]({'method':'notifications/claude/channel','params':{'content':_0x40f494[_0x3d71ac(0xd9)],'meta':_0x4d4b59}}),Y(_0x3d71ac(0xb6)+_0x40f494['id'][_0x3d71ac(0xbd)](0x0,0x8)+_0x3d71ac(0xc3)+_0x40f494['from_session']+':\x20'+_0x40f494[_0x3d71ac(0xd9)]['slice'](0x0,0x3c)),await P(_0x3d71ac(0x10d),{'alias':Z,'message_id':_0x40f494['id']});}}}async function S(){const _0x44b360=a0_0x5a24d8;let _0x2f5ce7=new a0_0xde335d();await K[_0x44b360(0xd5)](_0x2f5ce7),Y(_0x44b360(0xb1)),Y('starting\x20SSE\x20listener...'),v()[_0x44b360(0xc0)](_0x504347=>Y(_0x44b360(0xe5)+_0x504347)),P(_0x44b360(0xf0),{'resume_id':w,'alias':Z,'status':_0x44b360(0x91),'server':a0_0xe34d17(),'hostname':a0_0xe34d17(),'agent':'claude-code','project_dir':process[_0x44b360(0x110)](),'tmux_name':f||void 0x0})[_0x44b360(0x98)](()=>Y(_0x44b360(0xb2)+Z+'\x22\x20('+w[_0x44b360(0xbd)](0x0,0x8)+')'))[_0x44b360(0xc0)](_0x4be64d=>Y(_0x44b360(0x8f)+_0x4be64d)),setInterval(()=>{const _0x73249e=_0x44b360;P('report_status',{'resume_id':w,'alias':Z,'status':_0x73249e(0x91),'server':a0_0xe34d17(),'hostname':a0_0xe34d17(),'agent':_0x73249e(0xa3),'project_dir':process[_0x73249e(0x110)](),'tmux_name':f||void 0x0})[_0x73249e(0xc0)](_0x4af61e=>Y(_0x73249e(0xc5)+_0x4af61e));},0x2bf20),Y(_0x44b360(0xe1));}S()[a0_0x5a24d8(0xc0)](_0x5a95be=>{const _0x4754cd=a0_0x5a24d8;Y(_0x4754cd(0xdc)+_0x5a95be),process[_0x4754cd(0xc2)](0x1);});async function N(){const _0x12da06=a0_0x5a24d8;Y(_0x12da06(0xb4)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x12da06(0xad),'task':_0x12da06(0xc7)})[_0x12da06(0xc0)](()=>{}),process[_0x12da06(0xc2)](0x0);}process['stdin']['on'](a0_0x5a24d8(0xec),()=>N()),process['on'](a0_0x5a24d8(0xef),()=>N()),process['on'](a0_0x5a24d8(0xf5),()=>N());
2
+ function a0_0x380a(){const _0x3e75bc=['36MlRZMV','cancelled','message','application/json,\x20text/event-stream','find','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','no\x20response','commhub_send_task','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','pop',':\x20inbox_count=','status','failed','slice','.env','SSE\x20connected\x20as\x20\x22','number','replace','Reply\x20text\x20/\x20result\x20summary','blocked','broadcast','split','←\x20message\x20from\x20','replied','in_progress','send_task','unknown\x20tool','hub','config.json','stringify','session\x20disconnected','indexOf','1537833LIhzQU','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','task','utf-8','type','heartbeat\x20failed:\x20','new_message','send_reply','ack_inbox','send_message','messages','join','fatal:\x20','\x20priority=','catch','working','length','message_id','Target\x20session\x20alias','.anet','MCP\x20stdio\x20connected','string','notification','Bearer\x20','POST','http://127.0.0.1:9200','get','commhub_reply','error','new_task','SSE\x20fatal:\x20','startsWith','result','get_all_status','idle','completed','getReader','/mcp','32ospNpH','data:\x20','stdin','\x20from\x20','commhub_send_message','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','from','claude-code','cwd','shutting\x20down,\x20reporting\x20offline...','report_status','priority','from_session','2.0','initialize','commhub-channel','low','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','text','init\x20failed:\x20','\x22\x20(','/events/','setRequestHandler','5211dIVUBw','high','2025-03-26','end','SSE\x20stream\x20ended,\x20reconnecting...','→\x20injected\x20task\x20','token','ready\x20—\x20waiting\x20for\x20events','\x20CWD=','object','3689735WTsjNS','tools/call','then','get_inbox','connect','1616832KzyIpE','trim','notifications/claude/channel','inbox_count','commhub_get_all_status','registered\x20as\x20\x22','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Session\x20alias:\x20','Priority\x20(default:\x20normal)','144cXKerl','2233GajMay','SSE\x20error:\x20','6699760xXOrsE','commhub','178qbSVQA','parse','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','starting\x20SSE\x20listener...','Progress\x200-100','body','commhub_report_status','content','normal','9369lTUWbX','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','\x20RESUME_ID=','15294xTPBYE'];a0_0x380a=function(){return _0x3e75bc;};return a0_0x380a();}const a0_0x662eba=a0_0x2ad0;(function(_0x3c8205,_0xb34067){const _0x193798=a0_0x2ad0,_0x377129=_0x3c8205();while(!![]){try{const _0x5e333b=-parseInt(_0x193798(0x23c))/0x1*(-parseInt(_0x193798(0x259))/0x2)+parseInt(_0x193798(0x1db))/0x3*(parseInt(_0x193798(0x1df))/0x4)+parseInt(_0x193798(0x246))/0x5+parseInt(_0x193798(0x1de))/0x6*(parseInt(_0x193798(0x255))/0x7)+-parseInt(_0x193798(0x225))/0x8*(-parseInt(_0x193798(0x24b))/0x9)+-parseInt(_0x193798(0x257))/0xa+parseInt(_0x193798(0x1ff))/0xb*(-parseInt(_0x193798(0x254))/0xc);if(_0x5e333b===_0xb34067)break;else _0x377129['push'](_0x377129['shift']());}catch(_0xa2a0cb){_0x377129['push'](_0x377129['shift']());}}}(a0_0x380a,0x650f8));import{readFileSync as a0_0xbb5b7,existsSync as a0_0x140c4b}from'fs';import{join as a0_0x1516f9}from'path';import{hostname as a0_0x584493}from'os';import{execSync as a0_0x36b5cf}from'child_process';import{Server as a0_0x15d5b7}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x5397f0}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x52eddb,CallToolRequestSchema as a0_0x578a26}from'@modelcontextprotocol/sdk/types.js';function p(_0x467110){const _0x463a79=a0_0x2ad0;if(!a0_0x140c4b(_0x467110))return;for(let _0x50cf14 of a0_0xbb5b7(_0x467110,_0x463a79(0x202))[_0x463a79(0x1f4)]('\x0a')){let _0x3b01db=_0x50cf14[_0x463a79(0x24c)]();if(!_0x3b01db||_0x3b01db['startsWith']('#'))continue;let _0x33c00c=_0x3b01db[_0x463a79(0x1fe)]('=');if(_0x33c00c<0x0)continue;let _0x377d3b=_0x3b01db[_0x463a79(0x1ec)](0x0,_0x33c00c)[_0x463a79(0x24c)](),_0x2048d3=_0x3b01db[_0x463a79(0x1ec)](_0x33c00c+0x1)[_0x463a79(0x24c)]()[_0x463a79(0x1f0)](/^["']|["']$/g,'');if(!process.env[_0x377d3b])process.env[_0x377d3b]=_0x2048d3;}}var C=process.env.HOME||'~',T=a0_0x1516f9(C,'.claude/channels/commhub');p(a0_0x1516f9(T,a0_0x662eba(0x1ed)));function a0_0x2ad0(_0x39a1fb,_0x421fbe){_0x39a1fb=_0x39a1fb-0x1d8;const _0x380aaa=a0_0x380a();let _0x2ad0e8=_0x380aaa[_0x39a1fb];return _0x2ad0e8;}var L=process[a0_0x662eba(0x22d)]()['replace'](/\//g,'-');p(a0_0x1516f9(T,L,a0_0x662eba(0x1ed)));function U(){const _0x4e3db6=a0_0x662eba;try{return a0_0x36b5cf('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x4e3db6(0x202),'timeout':0x7d0})[_0x4e3db6(0x24c)]();}catch{return'';}}function c(){const _0x14bfa1=a0_0x662eba;try{let _0x4c74e4=a0_0x1516f9(C,_0x14bfa1(0x212),_0x14bfa1(0x1fb));if(a0_0x140c4b(_0x4c74e4))return JSON['parse'](a0_0xbb5b7(_0x4c74e4,_0x14bfa1(0x202)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x662eba(0x1fa)]||a0_0x662eba(0x218),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x584493(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto['randomUUID'](),X=process.env.COMMHUB_TOKEN||H[a0_0x662eba(0x242)]||'';function Y(_0x3956e3){const _0x17f0a3=a0_0x662eba;let _0x36b965=new Date()['toTimeString']()[_0x17f0a3(0x1ec)](0x0,0x8);process['stderr']['write']('['+_0x36b965+']\x20[commhub]\x20'+_0x3956e3+'\x0a');}function h(_0x16eb01){return new Promise(_0x1dcd78=>setTimeout(_0x1dcd78,_0x16eb01));}Y('ENV:\x20URL='+D+'\x20ALIAS='+Z+a0_0x662eba(0x1dd)+w[a0_0x662eba(0x1ec)](0x0,0x8)+'...\x20TMUX='+(f||'none')+a0_0x662eba(0x244)+process[a0_0x662eba(0x22d)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x15d5b7({'name':a0_0x662eba(0x234),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x662eba(0x22a),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x662eba(0x200),a0_0x662eba(0x25b),a0_0x662eba(0x252)+Z][a0_0x662eba(0x20a)]('\x0a')});K[a0_0x662eba(0x23b)](a0_0x52eddb,async()=>({'tools':[{'name':a0_0x662eba(0x21a),'description':a0_0x662eba(0x1e4),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x662eba(0x214),'description':a0_0x662eba(0x236)},'text':{'type':'string','description':a0_0x662eba(0x1f1)},'status':{'type':'string','enum':[a0_0x662eba(0x222),a0_0x662eba(0x1eb),a0_0x662eba(0x1e0),a0_0x662eba(0x1f2),a0_0x662eba(0x21b),a0_0x662eba(0x1f7)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':['text']}},{'name':a0_0x662eba(0x1d8),'description':a0_0x662eba(0x251),'inputSchema':{'type':a0_0x662eba(0x245),'properties':{'status':{'type':a0_0x662eba(0x214),'enum':[a0_0x662eba(0x20e),'idle','blocked',a0_0x662eba(0x21b)]},'task':{'type':a0_0x662eba(0x214),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x662eba(0x1ef),'description':a0_0x662eba(0x25d)}},'required':[a0_0x662eba(0x1ea)]}},{'name':a0_0x662eba(0x1e6),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x662eba(0x214),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x662eba(0x214),'description':'Task\x20content'},'priority':{'type':'string','enum':[a0_0x662eba(0x23d),a0_0x662eba(0x1da),a0_0x662eba(0x235)],'description':a0_0x662eba(0x253)}},'required':['alias',a0_0x662eba(0x201)]}},{'name':a0_0x662eba(0x229),'description':a0_0x662eba(0x1dc),'inputSchema':{'type':a0_0x662eba(0x245),'properties':{'alias':{'type':a0_0x662eba(0x214),'description':a0_0x662eba(0x211)},'message':{'type':'string','description':'Message\x20content'}},'required':['alias','message']}},{'name':a0_0x662eba(0x24f),'description':a0_0x662eba(0x1e7),'inputSchema':{'type':a0_0x662eba(0x245),'properties':{}}}]}));async function P(_0x33190f,_0x27364f){const _0xad1ffd=a0_0x662eba;let _0xe871f4=await fetch(D+'/mcp',{'method':_0xad1ffd(0x217),'headers':{'Content-Type':'application/json','Accept':_0xad1ffd(0x1e2),...X?{'Authorization':_0xad1ffd(0x216)+X}:{}},'body':JSON[_0xad1ffd(0x1fc)]({'jsonrpc':_0xad1ffd(0x232),'id':0x1,'method':_0xad1ffd(0x233),'params':{'protocolVersion':_0xad1ffd(0x23e),'capabilities':{},'clientInfo':{'name':_0xad1ffd(0x234),'version':'0.3.0'}}})});if(!_0xe871f4['ok']){let _0x248afd=await _0xe871f4[_0xad1ffd(0x237)]();return Y('CommHub\x20init\x20failed:\x20'+_0xe871f4[_0xad1ffd(0x1ea)]+'\x20'+_0x248afd[_0xad1ffd(0x1ec)](0x0,0x64)),{'ok':!0x1,'error':_0xad1ffd(0x238)+_0xe871f4[_0xad1ffd(0x1ea)]};}await _0xe871f4[_0xad1ffd(0x237)]();let _0x4aa628=(await(await fetch(D+_0xad1ffd(0x224),{'method':'POST','headers':{'Content-Type':'application/json','Accept':_0xad1ffd(0x1e2),...X?{'Authorization':_0xad1ffd(0x216)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0xad1ffd(0x232),'id':0x2,'method':_0xad1ffd(0x247),'params':{'name':_0x33190f,'arguments':_0x27364f}})}))[_0xad1ffd(0x237)]())[_0xad1ffd(0x1f4)]('\x0a')['find'](_0xe2eb3d=>_0xe2eb3d[_0xad1ffd(0x21e)]('data:\x20'));if(_0x4aa628){let _0x5d3fc1=JSON[_0xad1ffd(0x25a)](_0x4aa628[_0xad1ffd(0x1ec)](0x6));return _0x5d3fc1?.[_0xad1ffd(0x21f)]?.[_0xad1ffd(0x1d9)]?.[0x0]?.[_0xad1ffd(0x237)]?JSON['parse'](_0x5d3fc1[_0xad1ffd(0x21f)][_0xad1ffd(0x1d9)][0x0]['text']):_0x5d3fc1;}return{'ok':!0x1,'error':_0xad1ffd(0x1e5)};}K[a0_0x662eba(0x23b)](a0_0x578a26,async _0x34b487=>{const _0x8337af=a0_0x662eba;let {name:_0x39cf87,arguments:_0x3fc3d1}=_0x34b487['params'];if(_0x39cf87===_0x8337af(0x21a)){let {task_id:_0x5630e7,text:_0x537946,status:_0x1cb157}=_0x3fc3d1;if(_0x1cb157===_0x8337af(0x222)||_0x1cb157===_0x8337af(0x1eb)||_0x1cb157==='cancelled'){let _0x3dccda=_0x1cb157===_0x8337af(0x222)?_0x8337af(0x1f6):_0x1cb157,_0x260dcf=_0x5630e7?k[_0x8337af(0x219)](_0x5630e7)||'hub':_0x8337af(0x1fa),_0x5e9f62=await P(_0x8337af(0x206),{'alias':_0x260dcf,'text':_0x537946,'in_reply_to':_0x5630e7||void 0x0,'status':_0x3dccda,'from_session':Z});if(_0x5630e7)k['delete'](_0x5630e7);return{'content':[{'type':_0x8337af(0x237),'text':JSON[_0x8337af(0x1fc)](_0x5e9f62)}]};}let _0x4a2012=await P(_0x8337af(0x22f),{'resume_id':w,'alias':Z,'status':_0x1cb157===_0x8337af(0x1f2)?_0x8337af(0x1f2):_0x1cb157===_0x8337af(0x21b)?_0x8337af(0x21b):_0x8337af(0x20e),'task':_0x537946[_0x8337af(0x1ec)](0x0,0xc8),'output':_0x537946});return{'content':[{'type':_0x8337af(0x237),'text':JSON[_0x8337af(0x1fc)](_0x4a2012)}]};}if(_0x39cf87===_0x8337af(0x1d8)){let {status:_0x6b9336,task:_0x4e9f8c,progress:_0x53fdc7}=_0x3fc3d1,_0x4a2b50=await P(_0x8337af(0x22f),{'resume_id':w,'alias':Z,'status':_0x6b9336,'task':_0x4e9f8c,'progress':_0x53fdc7});return{'content':[{'type':'text','text':JSON[_0x8337af(0x1fc)](_0x4a2b50)}]};}if(_0x39cf87===_0x8337af(0x1e6)){let {alias:_0x3a1c21,task:_0x12c82e,priority:_0x14d5ca}=_0x3fc3d1,_0x42b810=await P(_0x8337af(0x1f8),{'alias':_0x3a1c21,'task':_0x12c82e,'priority':_0x14d5ca||_0x8337af(0x1da),'from_session':Z});return{'content':[{'type':_0x8337af(0x237),'text':JSON[_0x8337af(0x1fc)](_0x42b810)}]};}if(_0x39cf87===_0x8337af(0x229)){let {alias:_0x570484,message:_0xd8ba89}=_0x3fc3d1,_0x514402=await P(_0x8337af(0x208),{'alias':_0x570484,'message':_0xd8ba89,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x8337af(0x1fc)](_0x514402)}]};}if(_0x39cf87===_0x8337af(0x24f)){let _0x1d2d9b=await P(_0x8337af(0x220),{});return{'content':[{'type':_0x8337af(0x237),'text':JSON[_0x8337af(0x1fc)](_0x1d2d9b)}]};}return{'content':[{'type':_0x8337af(0x237),'text':JSON[_0x8337af(0x1fc)]({'error':_0x8337af(0x1f9)})}]};});async function v(){const _0x150379=a0_0x662eba;let _0x2a74c3=D+_0x150379(0x23a)+encodeURIComponent(Z),_0x290f9a={};if(X)_0x290f9a['Authorization']=_0x150379(0x216)+X;Y('connecting\x20to\x20'+_0x2a74c3);while(!0x0){try{let _0x55c17a=await fetch(_0x2a74c3,{'headers':_0x290f9a});if(!_0x55c17a['ok']){Y(_0x150379(0x256)+_0x55c17a[_0x150379(0x1ea)]+'\x20'+_0x55c17a['statusText']),await h(0x1388);continue;}let _0x5b2d37=_0x55c17a[_0x150379(0x25e)][_0x150379(0x223)](),_0x4e13e7=new TextDecoder(),_0x4f9314='';while(!0x0){let {done:_0x56336c,value:_0x57b68e}=await _0x5b2d37['read']();if(_0x56336c)break;_0x4f9314+=_0x4e13e7['decode'](_0x57b68e,{'stream':!0x0});let _0x1ed35f=_0x4f9314[_0x150379(0x1f4)]('\x0a\x0a');_0x4f9314=_0x1ed35f[_0x150379(0x1e8)]()||'';for(let _0x315a92 of _0x1ed35f){let _0x2c0b91=_0x315a92[_0x150379(0x1f4)]('\x0a')[_0x150379(0x1e3)](_0x35aa8e=>_0x35aa8e[_0x150379(0x21e)](_0x150379(0x226)));if(!_0x2c0b91)continue;try{let _0x5d426b=JSON[_0x150379(0x25a)](_0x2c0b91['slice'](0x6));await u(_0x5d426b);}catch(_0x3abcec){Y('parse\x20error:\x20'+_0x3abcec);}}}Y(_0x150379(0x240));}catch(_0x1fdd3f){Y('SSE\x20connection\x20error:\x20'+_0x1fdd3f);}await h(0xbb8);}}async function u(_0x1d4114){const _0x53f948=a0_0x662eba;if(_0x1d4114[_0x53f948(0x203)]==='connected'){Y(_0x53f948(0x1ee)+Z+'\x22');return;}if(_0x1d4114[_0x53f948(0x203)]===_0x53f948(0x205)){if(Y(_0x53f948(0x1f5)+_0x1d4114[_0x53f948(0x22b)]+':\x20'+_0x1d4114[_0x53f948(0x1e1)][_0x53f948(0x1ec)](0x0,0x3c)),await K[_0x53f948(0x215)]({'method':_0x53f948(0x24d),'params':{'content':_0x1d4114[_0x53f948(0x1e1)],'meta':{'sender':_0x1d4114['from']||'hub','sender_id':_0x53f948(0x258),'user':_0x1d4114[_0x53f948(0x22b)]||_0x53f948(0x1fa),'priority':_0x53f948(0x1da)}}}),_0x1d4114[_0x53f948(0x210)])await P(_0x53f948(0x207),{'alias':Z,'message_id':_0x1d4114[_0x53f948(0x210)]});return;}if(_0x1d4114[_0x53f948(0x203)]===_0x53f948(0x21c)||_0x1d4114[_0x53f948(0x203)]===_0x53f948(0x1f3)){Y('←\x20'+_0x1d4114[_0x53f948(0x203)]+_0x53f948(0x1e9)+_0x1d4114[_0x53f948(0x24e)]+_0x53f948(0x20c)+(_0x1d4114[_0x53f948(0x230)]||_0x53f948(0x1da)));let _0x2566a0=await P(_0x53f948(0x249),{'alias':Z,'limit':0x5});if(_0x2566a0?.['ok']&&_0x2566a0[_0x53f948(0x209)]?.[_0x53f948(0x20f)]>0x0)for(let _0x1af7eb of _0x2566a0[_0x53f948(0x209)]){let _0x4011a3={'sender':_0x1af7eb[_0x53f948(0x231)]||'hub','sender_id':_0x53f948(0x258),'user':_0x1af7eb[_0x53f948(0x231)]||_0x53f948(0x1fa),'task_id':_0x1af7eb['id'],'priority':_0x1af7eb[_0x53f948(0x230)]||_0x53f948(0x1da)};k['set'](_0x1af7eb['id'],_0x1af7eb[_0x53f948(0x231)]||_0x53f948(0x1fa)),await K[_0x53f948(0x215)]({'method':_0x53f948(0x24d),'params':{'content':_0x1af7eb[_0x53f948(0x1d9)],'meta':_0x4011a3}}),Y(_0x53f948(0x241)+_0x1af7eb['id'][_0x53f948(0x1ec)](0x0,0x8)+_0x53f948(0x228)+_0x1af7eb[_0x53f948(0x231)]+':\x20'+_0x1af7eb['content'][_0x53f948(0x1ec)](0x0,0x3c)),await P(_0x53f948(0x207),{'alias':Z,'message_id':_0x1af7eb['id']});}}}async function S(){const _0x4636aa=a0_0x662eba;let _0x125e90=new a0_0x5397f0();await K[_0x4636aa(0x24a)](_0x125e90),Y(_0x4636aa(0x213)),Y(_0x4636aa(0x25c)),v()[_0x4636aa(0x20d)](_0x538d0b=>Y(_0x4636aa(0x21d)+_0x538d0b)),P('report_status',{'resume_id':w,'alias':Z,'status':_0x4636aa(0x221),'server':a0_0x584493(),'hostname':a0_0x584493(),'agent':_0x4636aa(0x22c),'project_dir':process[_0x4636aa(0x22d)](),'tmux_name':f||void 0x0})[_0x4636aa(0x248)](()=>Y(_0x4636aa(0x250)+Z+_0x4636aa(0x239)+w['slice'](0x0,0x8)+')'))[_0x4636aa(0x20d)](_0x24ba88=>Y('warning:\x20could\x20not\x20register:\x20'+_0x24ba88)),setInterval(()=>{const _0xafede5=_0x4636aa;P('report_status',{'resume_id':w,'alias':Z,'status':_0xafede5(0x221),'server':a0_0x584493(),'hostname':a0_0x584493(),'agent':_0xafede5(0x22c),'project_dir':process[_0xafede5(0x22d)](),'tmux_name':f||void 0x0})[_0xafede5(0x20d)](_0x4563b8=>Y(_0xafede5(0x204)+_0x4563b8));},0x2bf20),Y(_0x4636aa(0x243));}S()[a0_0x662eba(0x20d)](_0x615934=>{const _0x385190=a0_0x662eba;Y(_0x385190(0x20b)+_0x615934),process['exit'](0x1);});async function N(){const _0x5b295e=a0_0x662eba;Y(_0x5b295e(0x22e)),await P(_0x5b295e(0x22f),{'resume_id':w,'alias':Z,'status':_0x5b295e(0x21b),'task':_0x5b295e(0x1fd)})[_0x5b295e(0x20d)](()=>{}),process['exit'](0x0);}process[a0_0x662eba(0x227)]['on'](a0_0x662eba(0x23f),()=>N()),process['on']('SIGTERM',()=>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.2",
3
+ "version": "2.0.0-preview.4",
4
4
  "description": "AI Agent Network — Server + Client + Setup in one package. SSE real-time communication for multi-agent orchestration.",
5
5
  "type": "module",
6
6
  "main": "dist/src/client.js",