@sleep2agi/agent-network 2.2.7 → 2.2.8-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- const a0_0x5a7ee9=a0_0x45d6;(function(_0x270a2b,_0x50f67e){const _0x21ba01=a0_0x45d6,_0x1a4080=_0x270a2b();while(!![]){try{const _0x152656=-parseInt(_0x21ba01(0x159))/0x1*(-parseInt(_0x21ba01(0x195))/0x2)+-parseInt(_0x21ba01(0x16b))/0x3+-parseInt(_0x21ba01(0x17d))/0x4*(-parseInt(_0x21ba01(0x1a4))/0x5)+parseInt(_0x21ba01(0x166))/0x6*(parseInt(_0x21ba01(0x1a5))/0x7)+-parseInt(_0x21ba01(0x197))/0x8+-parseInt(_0x21ba01(0x161))/0x9+parseInt(_0x21ba01(0x1a1))/0xa*(parseInt(_0x21ba01(0x188))/0xb);if(_0x152656===_0x50f67e)break;else _0x1a4080['push'](_0x1a4080['shift']());}catch(_0x3b817e){_0x1a4080['push'](_0x1a4080['shift']());}}}(a0_0x50d4,0x2fa65));import{EventEmitter as a0_0x3f45ec}from'events';import{hostname as a0_0x30eb10}from'os';class T extends a0_0x3f45ec{[a0_0x5a7ee9(0x168)];[a0_0x5a7ee9(0x178)];[a0_0x5a7ee9(0x160)];[a0_0x5a7ee9(0x15f)];[a0_0x5a7ee9(0x179)];[a0_0x5a7ee9(0x19d)];[a0_0x5a7ee9(0x174)];[a0_0x5a7ee9(0x191)];[a0_0x5a7ee9(0x171)];['running']=!0x1;constructor(_0x1170a1){const _0x4b2c49=a0_0x5a7ee9;super();if(this[_0x4b2c49(0x168)]=_0x1170a1['url'][_0x4b2c49(0x158)](/\/$/,''),this['alias']=_0x1170a1[_0x4b2c49(0x178)],this[_0x4b2c49(0x160)]=_0x1170a1[_0x4b2c49(0x160)],this['agent']=_0x1170a1['agent']||_0x4b2c49(0x193),this[_0x4b2c49(0x179)]=_0x4b2c49(0x199)+_0x1170a1[_0x4b2c49(0x178)]+'-'+Date[_0x4b2c49(0x16e)]()['toString'](0x24),this[_0x4b2c49(0x19d)]=_0x1170a1[_0x4b2c49(0x19d)]??0x2bf20,this[_0x4b2c49(0x174)]=_0x1170a1[_0x4b2c49(0x174)]??0xbb8,_0x1170a1[_0x4b2c49(0x17a)]!==!0x1)this[_0x4b2c49(0x170)]();}[a0_0x5a7ee9(0x181)](_0x3ac9f3){const _0x320da3=a0_0x5a7ee9;console[_0x320da3(0x181)]('['+new Date()[_0x320da3(0x165)]()[_0x320da3(0x173)](0x0,0x8)+']\x20[commhub:'+this[_0x320da3(0x178)]+']\x20'+_0x3ac9f3);}async[a0_0x5a7ee9(0x194)](_0x46f165,_0x197078){const _0xb2f210=a0_0x5a7ee9;let _0x6ece77={'Content-Type':_0xb2f210(0x176),'Accept':_0xb2f210(0x1a3)};if(this['token'])_0x6ece77[_0xb2f210(0x183)]=_0xb2f210(0x18b)+this[_0xb2f210(0x160)];let _0x34af5d=await(await fetch(this['url']+'/mcp',{'method':_0xb2f210(0x19e),'headers':_0x6ece77,'body':JSON[_0xb2f210(0x164)]({'jsonrpc':_0xb2f210(0x192),'id':Date[_0xb2f210(0x16e)](),'method':_0xb2f210(0x163),'params':{'name':_0x46f165,'arguments':_0x197078}})}))['text'](),_0x3559a3=_0x34af5d[_0xb2f210(0x186)](/data: (.+)/),_0x326f07=_0x3559a3?JSON[_0xb2f210(0x182)](_0x3559a3[0x1]):JSON['parse'](_0x34af5d),_0x5e3bf4=_0x326f07?.[_0xb2f210(0x17f)]?.[_0xb2f210(0x169)]?.[0x0]?.[_0xb2f210(0x155)];return _0x5e3bf4?JSON[_0xb2f210(0x182)](_0x5e3bf4):_0x326f07;}async[a0_0x5a7ee9(0x170)](){const _0x2e8564=a0_0x5a7ee9;if(this['running'])return;this[_0x2e8564(0x16d)]=!0x0,await this[_0x2e8564(0x15c)](_0x2e8564(0x17b)),this[_0x2e8564(0x181)](_0x2e8564(0x175)),this[_0x2e8564(0x191)]=setInterval(()=>{const _0x26e97c=_0x2e8564;this['status'](_0x26e97c(0x17b))[_0x26e97c(0x189)](_0x51c855=>this[_0x26e97c(0x181)](_0x26e97c(0x18c)+_0x51c855[_0x26e97c(0x1a0)]));},this[_0x2e8564(0x19d)]),this[_0x2e8564(0x1a6)]();}async[a0_0x5a7ee9(0x19c)](){const _0x1d38f3=a0_0x5a7ee9;if(this[_0x1d38f3(0x16d)]=!0x1,this[_0x1d38f3(0x171)]?.[_0x1d38f3(0x177)](),this['heartbeatTimer'])clearInterval(this['heartbeatTimer']);await this[_0x1d38f3(0x15c)](_0x1d38f3(0x19a))[_0x1d38f3(0x189)](()=>{}),this[_0x1d38f3(0x181)](_0x1d38f3(0x180));}async[a0_0x5a7ee9(0x18a)](_0x2e5270,_0x3312a8,_0x4c0ffb=a0_0x5a7ee9(0x19f)){const _0x5dade5=a0_0x5a7ee9;return this[_0x5dade5(0x194)](_0x5dade5(0x16a),{'alias':_0x2e5270,'task':_0x3312a8,'priority':_0x4c0ffb,'from_session':this[_0x5dade5(0x178)]});}async[a0_0x5a7ee9(0x1a0)](_0x92d30a,_0x12bced){const _0x2ffcfb=a0_0x5a7ee9;return this[_0x2ffcfb(0x194)](_0x2ffcfb(0x185),{'alias':_0x92d30a,'message':_0x12bced,'from_session':this[_0x2ffcfb(0x178)]});}async[a0_0x5a7ee9(0x151)](_0x1cc4fa,_0x1dd68a,_0x398f45=a0_0x5a7ee9(0x152)){return this['call']('send_reply',{'in_reply_to':_0x1cc4fa,'text':_0x1dd68a,'status':_0x398f45});}async['status'](_0x2979d7,_0x449819){const _0x423ee0=a0_0x5a7ee9;return this['call'](_0x423ee0(0x1a2),{'resume_id':this['resumeId'],'alias':this[_0x423ee0(0x178)],'status':_0x2979d7,'server':a0_0x30eb10(),'hostname':a0_0x30eb10(),'agent':this[_0x423ee0(0x15f)],'project_dir':process['cwd'](),..._0x449819});}async[a0_0x5a7ee9(0x1a9)](){const _0xfa47a=a0_0x5a7ee9;return this[_0xfa47a(0x194)](_0xfa47a(0x16f),{});}async[a0_0x5a7ee9(0x1a8)](_0x338909,_0x5e6f9b){const _0x32f70d=a0_0x5a7ee9;return this[_0x32f70d(0x194)](_0x32f70d(0x1a8),{'message':_0x338909,'filter_server':_0x5e6f9b?.['server'],'filter_status':_0x5e6f9b?.[_0x32f70d(0x15c)]});}async['connectSSE'](){const _0x2f5d76=a0_0x5a7ee9;let _0x5ef07d=encodeURIComponent(this[_0x2f5d76(0x178)]),_0xb8dd9c=this[_0x2f5d76(0x168)]+_0x2f5d76(0x162)+_0x5ef07d,_0x34befa=this[_0x2f5d76(0x174)];while(this[_0x2f5d76(0x16d)]){try{this[_0x2f5d76(0x171)]=new AbortController();let _0x1117b8={'Accept':_0x2f5d76(0x190)};if(this[_0x2f5d76(0x160)])_0x1117b8[_0x2f5d76(0x183)]='Bearer\x20'+this[_0x2f5d76(0x160)];let _0xdc81c8=await fetch(_0xb8dd9c,{'headers':_0x1117b8,'signal':this[_0x2f5d76(0x171)][_0x2f5d76(0x15b)]});if(!_0xdc81c8['ok']||!_0xdc81c8['body']){this['log']('SSE\x20failed:\x20'+_0xdc81c8[_0x2f5d76(0x15c)]),await this['sleep'](_0x34befa),_0x34befa=Math[_0x2f5d76(0x187)](_0x34befa*1.5,0xea60);continue;}_0x34befa=this[_0x2f5d76(0x174)];let _0x2d8c89=_0xdc81c8['body'][_0x2f5d76(0x17e)](),_0x24cf48=new TextDecoder(),_0x3b5cf7='';while(this['running']){let {done:_0x543713,value:_0x158b7d}=await _0x2d8c89['read']();if(_0x543713)break;_0x3b5cf7+=_0x24cf48[_0x2f5d76(0x16c)](_0x158b7d,{'stream':!0x0});let _0x277066=_0x3b5cf7['split']('\x0a');_0x3b5cf7=_0x277066['pop']()||'';for(let _0x2dc627 of _0x277066){if(!_0x2dc627[_0x2f5d76(0x167)](_0x2f5d76(0x17c)))continue;try{let _0x5ea6f4=JSON[_0x2f5d76(0x182)](_0x2dc627[_0x2f5d76(0x173)](0x6));if(_0x5ea6f4[_0x2f5d76(0x15d)]===_0x2f5d76(0x1aa)){this[_0x2f5d76(0x181)](_0x2f5d76(0x196)),this[_0x2f5d76(0x156)]('connected');continue;}if(_0x5ea6f4[_0x2f5d76(0x15d)]===_0x2f5d76(0x198)||_0x5ea6f4[_0x2f5d76(0x15d)]===_0x2f5d76(0x18e)||_0x5ea6f4[_0x2f5d76(0x15d)]===_0x2f5d76(0x1a8))await this[_0x2f5d76(0x18f)]();}catch{}}}}catch(_0x4bf752){if(_0x4bf752['name']===_0x2f5d76(0x18d))break;this[_0x2f5d76(0x156)](_0x2f5d76(0x172),_0x4bf752),this[_0x2f5d76(0x181)](_0x2f5d76(0x19b)+_0x4bf752[_0x2f5d76(0x1a0)]);}if(this['running'])this[_0x2f5d76(0x156)](_0x2f5d76(0x180)),this[_0x2f5d76(0x181)](_0x2f5d76(0x15e)+_0x34befa/0x3e8+_0x2f5d76(0x184)),await this[_0x2f5d76(0x154)](_0x34befa),_0x34befa=Math['min'](_0x34befa*1.5,0xea60);}}async[a0_0x5a7ee9(0x18f)](){const _0x46588c=a0_0x5a7ee9;try{let _0x3b3760=(await this[_0x46588c(0x194)](_0x46588c(0x153),{'alias':this['alias'],'limit':0xa}))?.[_0x46588c(0x157)]||[];for(let _0x29c3c2 of _0x3b3760)await this[_0x46588c(0x194)](_0x46588c(0x1a7),{'alias':this[_0x46588c(0x178)],'message_id':_0x29c3c2['id']}),this['log']('←\x20'+_0x29c3c2['from_session']+':\x20'+_0x29c3c2[_0x46588c(0x169)][_0x46588c(0x173)](0x0,0x3c)),this[_0x46588c(0x156)]('task',_0x29c3c2),this['emit'](_0x46588c(0x1a0),_0x29c3c2);}catch(_0x1eab53){this[_0x46588c(0x181)](_0x46588c(0x15a)+_0x1eab53['message']);}}[a0_0x5a7ee9(0x154)](_0xe3ebfa){return new Promise(_0x1383d4=>setTimeout(_0x1383d4,_0xe3ebfa));}}function a0_0x45d6(_0x21a4a5,_0x59120f){_0x21a4a5=_0x21a4a5-0x151;const _0x50d46b=a0_0x50d4();let _0x45d614=_0x50d46b[_0x21a4a5];return _0x45d614;}function a0_0x50d4(){const _0x4f0cb4=['content','send_task','16803wvSNnz','decode','running','now','get_all_status','connect','sseAbort','error','slice','reconnectDelay','registered','application/json','abort','alias','resumeId','autoConnect','idle','data:\x20','40coQgWL','getReader','result','disconnected','log','parse','Authorization','s...','send_message','match','min','2766489UGMKzy','catch','send','Bearer\x20','heartbeat\x20failed:\x20','AbortError','new_message','processInbox','text/event-stream','heartbeatTimer','2.0','sdk','call','72214PKlRBn','SSE\x20connected','1743264ggBfBm','new_task','sdk-','offline','SSE\x20error:\x20','disconnect','heartbeatInterval','POST','normal','message','10MgQYZI','report_status','application/json,\x20text/event-stream','119135HNBEzn','315JxbzDc','connectSSE','ack_inbox','broadcast','getAllStatus','connected','reply','completed','get_inbox','sleep','text','emit','messages','replace','1JFMFmA','inbox\x20error:\x20','signal','status','type','SSE\x20reconnecting\x20in\x20','agent','token','2688831WyXebN','/events/','tools/call','stringify','toTimeString','25542okPrdE','startsWith','url'];a0_0x50d4=function(){return _0x4f0cb4;};return a0_0x50d4();}var $=T;export{$ as default,T as CommHub};
1
+ const a0_0x1c3eb7=a0_0x324a;function a0_0x3fb1(){const _0x4bc8f6=['decode','heartbeatInterval','send','text','stringify','308472RLHRqP','102063IgYpaR','pop','content','type','SSE\x20reconnecting\x20in\x20','normal','toString','url','catch','message','now','application/json,\x20text/event-stream',']\x20[commhub:','send_reply','heartbeat\x20failed:\x20','startsWith','slice','abort','call','get_inbox','toTimeString','connectSSE','SSE\x20connected','emit','completed','idle','getReader','Authorization','reconnectDelay','141175QHEoaR','Bearer\x20','resumeId','agent','reply','495818KhdAEb','status','/events/','parse','alias','SSE\x20error:\x20','inbox\x20error:\x20','name','from_session','connected','tools/call','disconnected','body','2.0','disconnect','heartbeatTimer','autoConnect','246050AdkbfO','data:\x20','new_message','send_message','952288CJgAcl','get_all_status','read','getAllStatus','ack_inbox','task','sseAbort','8OHXHyS','cwd','log','new_task','text/event-stream','running','messages','server','offline','split','application/json','token','broadcast','699030xGfVlW','min','result','processInbox','sleep'];a0_0x3fb1=function(){return _0x4bc8f6;};return a0_0x3fb1();}(function(_0x50cc92,_0x27a905){const _0x2817c0=a0_0x324a,_0x55f5b7=_0x50cc92();while(!![]){try{const _0x59cbe1=parseInt(_0x2817c0(0x178))/0x1+-parseInt(_0x2817c0(0x19b))/0x2+parseInt(_0x2817c0(0x179))/0x3+parseInt(_0x2817c0(0x15a))/0x4+parseInt(_0x2817c0(0x196))/0x5+-parseInt(_0x2817c0(0x16e))/0x6+-parseInt(_0x2817c0(0x156))/0x7*(parseInt(_0x2817c0(0x161))/0x8);if(_0x59cbe1===_0x27a905)break;else _0x55f5b7['push'](_0x55f5b7['shift']());}catch(_0x2e50a0){_0x55f5b7['push'](_0x55f5b7['shift']());}}}(a0_0x3fb1,0x33154));import{EventEmitter as a0_0x2503d4}from'events';function a0_0x324a(_0x4ab220,_0x16a02f){_0x4ab220=_0x4ab220-0x154;const _0x3fb19c=a0_0x3fb1();let _0x324af4=_0x3fb19c[_0x4ab220];return _0x324af4;}import{hostname as a0_0x3d072b}from'os';class T extends a0_0x2503d4{[a0_0x1c3eb7(0x180)];[a0_0x1c3eb7(0x19f)];[a0_0x1c3eb7(0x16c)];[a0_0x1c3eb7(0x199)];[a0_0x1c3eb7(0x198)];[a0_0x1c3eb7(0x174)];[a0_0x1c3eb7(0x195)];['heartbeatTimer'];[a0_0x1c3eb7(0x160)];[a0_0x1c3eb7(0x166)]=!0x1;constructor(_0x174781){const _0x5b6e38=a0_0x1c3eb7;super();if(this[_0x5b6e38(0x180)]=_0x174781[_0x5b6e38(0x180)]['replace'](/\/$/,''),this['alias']=_0x174781[_0x5b6e38(0x19f)],this['token']=_0x174781['token'],this[_0x5b6e38(0x199)]=_0x174781['agent']||'sdk',this[_0x5b6e38(0x198)]='sdk-'+_0x174781[_0x5b6e38(0x19f)]+'-'+Date[_0x5b6e38(0x183)]()[_0x5b6e38(0x17f)](0x24),this[_0x5b6e38(0x174)]=_0x174781[_0x5b6e38(0x174)]??0x2bf20,this[_0x5b6e38(0x195)]=_0x174781[_0x5b6e38(0x195)]??0xbb8,_0x174781[_0x5b6e38(0x155)]!==!0x1)this['connect']();}['log'](_0x80acb9){const _0x27438b=a0_0x1c3eb7;console['log']('['+new Date()[_0x27438b(0x18d)]()[_0x27438b(0x189)](0x0,0x8)+_0x27438b(0x185)+this[_0x27438b(0x19f)]+']\x20'+_0x80acb9);}async['call'](_0x43e2ed,_0x106997){const _0x3847ee=a0_0x1c3eb7;let _0x1e16f3={'Content-Type':_0x3847ee(0x16b),'Accept':_0x3847ee(0x184)};if(this[_0x3847ee(0x16c)])_0x1e16f3[_0x3847ee(0x194)]=_0x3847ee(0x197)+this[_0x3847ee(0x16c)];let _0x854882=await(await fetch(this[_0x3847ee(0x180)]+'/mcp',{'method':'POST','headers':_0x1e16f3,'body':JSON[_0x3847ee(0x177)]({'jsonrpc':_0x3847ee(0x1a8),'id':Date[_0x3847ee(0x183)](),'method':_0x3847ee(0x1a5),'params':{'name':_0x43e2ed,'arguments':_0x106997}})}))['text'](),_0x5cbde0=_0x854882['match'](/data: (.+)/),_0x56be29=_0x5cbde0?JSON[_0x3847ee(0x19e)](_0x5cbde0[0x1]):JSON[_0x3847ee(0x19e)](_0x854882),_0x2dc614=_0x56be29?.[_0x3847ee(0x170)]?.[_0x3847ee(0x17b)]?.[0x0]?.[_0x3847ee(0x176)];return _0x2dc614?JSON[_0x3847ee(0x19e)](_0x2dc614):_0x56be29;}async['connect'](){const _0x549307=a0_0x1c3eb7;if(this[_0x549307(0x166)])return;this[_0x549307(0x166)]=!0x0,await this[_0x549307(0x19c)](_0x549307(0x192)),this['log']('registered'),this[_0x549307(0x154)]=setInterval(()=>{const _0x2ad21e=_0x549307;this[_0x2ad21e(0x19c)](_0x2ad21e(0x192))[_0x2ad21e(0x181)](_0x3fd0a9=>this[_0x2ad21e(0x163)](_0x2ad21e(0x187)+_0x3fd0a9['message']));},this['heartbeatInterval']),this['connectSSE']();}async[a0_0x1c3eb7(0x1a9)](){const _0x38bcd2=a0_0x1c3eb7;if(this[_0x38bcd2(0x166)]=!0x1,this['sseAbort']?.[_0x38bcd2(0x18a)](),this['heartbeatTimer'])clearInterval(this['heartbeatTimer']);await this[_0x38bcd2(0x19c)](_0x38bcd2(0x169))[_0x38bcd2(0x181)](()=>{}),this['log'](_0x38bcd2(0x1a6));}async[a0_0x1c3eb7(0x175)](_0x409396,_0x5f1ab4,_0x967e40=a0_0x1c3eb7(0x17e)){const _0x19a8f7=a0_0x1c3eb7;return this[_0x19a8f7(0x18b)]('send_task',{'alias':_0x409396,'task':_0x5f1ab4,'priority':_0x967e40,'from_session':this[_0x19a8f7(0x19f)]});}async[a0_0x1c3eb7(0x182)](_0x3f16a7,_0x124035){const _0x29a478=a0_0x1c3eb7;return this[_0x29a478(0x18b)](_0x29a478(0x159),{'alias':_0x3f16a7,'message':_0x124035,'from_session':this['alias']});}async[a0_0x1c3eb7(0x19a)](_0x55d7b5,_0x2c56fd,_0x5f382f=a0_0x1c3eb7(0x191)){const _0x29d2fc=a0_0x1c3eb7;return this[_0x29d2fc(0x18b)](_0x29d2fc(0x186),{'in_reply_to':_0x55d7b5,'text':_0x2c56fd,'status':_0x5f382f});}async[a0_0x1c3eb7(0x19c)](_0x5507bf,_0x3be853){const _0xbfa5ab=a0_0x1c3eb7;return this[_0xbfa5ab(0x18b)]('report_status',{'resume_id':this['resumeId'],'alias':this['alias'],'status':_0x5507bf,'server':a0_0x3d072b(),'hostname':a0_0x3d072b(),'agent':this[_0xbfa5ab(0x199)],'project_dir':process[_0xbfa5ab(0x162)](),..._0x3be853});}async[a0_0x1c3eb7(0x15d)](){const _0x1d944f=a0_0x1c3eb7;return this[_0x1d944f(0x18b)](_0x1d944f(0x15b),{});}async[a0_0x1c3eb7(0x16d)](_0x496058,_0x705f14){const _0x3f7e72=a0_0x1c3eb7;return this[_0x3f7e72(0x18b)]('broadcast',{'message':_0x496058,'filter_server':_0x705f14?.[_0x3f7e72(0x168)],'filter_status':_0x705f14?.[_0x3f7e72(0x19c)]});}async[a0_0x1c3eb7(0x18e)](){const _0x52f46e=a0_0x1c3eb7;let _0x802ed2=encodeURIComponent(this[_0x52f46e(0x19f)]),_0xb292fa=this[_0x52f46e(0x180)]+_0x52f46e(0x19d)+_0x802ed2,_0x4221c4=this[_0x52f46e(0x195)];while(this[_0x52f46e(0x166)]){try{this[_0x52f46e(0x160)]=new AbortController();let _0x4db337={'Accept':_0x52f46e(0x165)};if(this[_0x52f46e(0x16c)])_0x4db337[_0x52f46e(0x194)]=_0x52f46e(0x197)+this['token'];let _0x53067e=await fetch(_0xb292fa,{'headers':_0x4db337,'signal':this[_0x52f46e(0x160)]['signal']});if(!_0x53067e['ok']||!_0x53067e[_0x52f46e(0x1a7)]){this[_0x52f46e(0x163)]('SSE\x20failed:\x20'+_0x53067e[_0x52f46e(0x19c)]),await this[_0x52f46e(0x172)](_0x4221c4),_0x4221c4=Math[_0x52f46e(0x16f)](_0x4221c4*1.5,0xea60);continue;}_0x4221c4=this[_0x52f46e(0x195)];let _0x52c390=_0x53067e[_0x52f46e(0x1a7)][_0x52f46e(0x193)](),_0x2d4946=new TextDecoder(),_0xb716a1='';while(this['running']){let {done:_0x1b0798,value:_0x5d4cc7}=await _0x52c390[_0x52f46e(0x15c)]();if(_0x1b0798)break;_0xb716a1+=_0x2d4946[_0x52f46e(0x173)](_0x5d4cc7,{'stream':!0x0});let _0x4f5b87=_0xb716a1[_0x52f46e(0x16a)]('\x0a');_0xb716a1=_0x4f5b87[_0x52f46e(0x17a)]()||'';for(let _0x19187f of _0x4f5b87){if(!_0x19187f[_0x52f46e(0x188)](_0x52f46e(0x157)))continue;try{let _0x57c228=JSON[_0x52f46e(0x19e)](_0x19187f[_0x52f46e(0x189)](0x6));if(_0x57c228[_0x52f46e(0x17c)]===_0x52f46e(0x1a4)){this[_0x52f46e(0x163)](_0x52f46e(0x18f)),this[_0x52f46e(0x190)](_0x52f46e(0x1a4));continue;}if(_0x57c228[_0x52f46e(0x17c)]===_0x52f46e(0x164)||_0x57c228[_0x52f46e(0x17c)]===_0x52f46e(0x158)||_0x57c228[_0x52f46e(0x17c)]===_0x52f46e(0x16d))await this[_0x52f46e(0x171)]();}catch{}}}}catch(_0x497d42){if(_0x497d42[_0x52f46e(0x1a2)]==='AbortError')break;this['emit']('error',_0x497d42),this['log'](_0x52f46e(0x1a0)+_0x497d42[_0x52f46e(0x182)]);}if(this['running'])this['emit'](_0x52f46e(0x1a6)),this[_0x52f46e(0x163)](_0x52f46e(0x17d)+_0x4221c4/0x3e8+'s...'),await this[_0x52f46e(0x172)](_0x4221c4),_0x4221c4=Math[_0x52f46e(0x16f)](_0x4221c4*1.5,0xea60);}}async[a0_0x1c3eb7(0x171)](){const _0x263ea3=a0_0x1c3eb7;try{let _0x25cbc2=(await this[_0x263ea3(0x18b)](_0x263ea3(0x18c),{'alias':this[_0x263ea3(0x19f)],'limit':0xa}))?.[_0x263ea3(0x167)]||[];for(let _0x3f1349 of _0x25cbc2)await this[_0x263ea3(0x18b)](_0x263ea3(0x15e),{'alias':this['alias'],'message_id':_0x3f1349['id']}),this[_0x263ea3(0x163)]('←\x20'+_0x3f1349[_0x263ea3(0x1a3)]+':\x20'+_0x3f1349[_0x263ea3(0x17b)][_0x263ea3(0x189)](0x0,0x3c)),this[_0x263ea3(0x190)](_0x263ea3(0x15f),_0x3f1349),this['emit'](_0x263ea3(0x182),_0x3f1349);}catch(_0x35409d){this[_0x263ea3(0x163)](_0x263ea3(0x1a1)+_0x35409d['message']);}}[a0_0x1c3eb7(0x172)](_0x2ab467){return new Promise(_0x5c5645=>setTimeout(_0x5c5645,_0x2ab467));}}var $=T;export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x40833c=a0_0x1de6;(function(_0x8dc7ff,_0x5c1b25){const _0x2ad476=a0_0x1de6,_0x34afb4=_0x8dc7ff();while(!![]){try{const _0x39010e=-parseInt(_0x2ad476(0x104))/0x1*(parseInt(_0x2ad476(0x108))/0x2)+-parseInt(_0x2ad476(0xec))/0x3*(parseInt(_0x2ad476(0xbb))/0x4)+parseInt(_0x2ad476(0xd0))/0x5*(-parseInt(_0x2ad476(0xf2))/0x6)+-parseInt(_0x2ad476(0xad))/0x7*(-parseInt(_0x2ad476(0xc1))/0x8)+parseInt(_0x2ad476(0xe5))/0x9*(parseInt(_0x2ad476(0xce))/0xa)+parseInt(_0x2ad476(0xdc))/0xb*(parseInt(_0x2ad476(0x111))/0xc)+-parseInt(_0x2ad476(0xe2))/0xd*(-parseInt(_0x2ad476(0x9e))/0xe);if(_0x39010e===_0x5c1b25)break;else _0x34afb4['push'](_0x34afb4['shift']());}catch(_0x47a2c2){_0x34afb4['push'](_0x34afb4['shift']());}}}(a0_0x3f31,0xc5b1a));import{readFileSync as a0_0x14f765,existsSync as a0_0x1aeafd}from'fs';import{randomUUID as a0_0x3819dc}from'crypto';function a0_0x3f31(){const _0x1c2f85=['error','messages','SSE\x20connection\x20error:\x20','1773104ollHyc','broadcast','\x22\x20(','SSE\x20fatal:\x20','stdin','setRequestHandler','shutting\x20down,\x20reporting\x20offline...','fatal:\x20','normal','catch','Current\x20task\x20description','utf-8','application/json','5494690HLTGlu','POST','99445lhxgol','\x20from\x20','\x20ALIAS=','Authorization','startsWith','report_status','pop','stringify','blocked','no\x20response','commhub','heartbeat\x20failed:\x20','66XGWKDE','Reply\x20text\x20/\x20result\x20summary','offline','get_all_status','completed','from_session','1265797zfSbeS',':\x20inbox_count=','ENV:\x20URL=','18LKEWot','status','http://127.0.0.1:9200','hub','claude-code','params','2.0','701169rJNoLE','then','commhub_send_message','none','set','body','6CMVjHt','failed','priority','send_reply','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','.claude/channels/commhub','.env','notification','registered\x20as\x20\x22','find','connecting\x20to\x20','session\x20disconnected','CommHub\x20init\x20failed:\x20','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','Progress\x200-100','data:\x20','Bearer\x20','type','737421PYzHgZ','tools/call','join','write','4rwdTTr','trim','exit','Session\x20alias:\x20','2025-03-26','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','get_inbox','content','replace','476964CnTKrE','working','new_task','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','parse','commhub_report_status','connected','ready\x20—\x20waiting\x20for\x20events','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','SSE\x20connected\x20as\x20\x22','MCP\x20stdio\x20connected','cwd','config.json','SSE\x20stream\x20ended,\x20reconnecting...','in_progress','SIGINT','send_task','notifications/claude/channel','commhub_get_all_status','send_message','split','cancelled','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','alias','replied','84OLGuou','slice','←\x20message\x20from\x20','commhub-channel','from','/mcp','\x20PROJECT_ENV=','parse\x20error:\x20','application/json,\x20text/event-stream','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','length','result','token','get','text','49nELbvV','stderr','ack_inbox','commhub_reply','/events/','object','message','idle','string','read',']\x20[commhub]\x20','Message\x20content','delete','commhub_send_task','20NzAYbw','0.3.0','statusText'];a0_0x3f31=function(){return _0x1c2f85;};return a0_0x3f31();}import{join as a0_0x13d10e}from'path';import{hostname as a0_0x569c50}from'os';import{execSync as a0_0x5b612a}from'child_process';import{Server as a0_0x23a3b2}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x34239d}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x3af468,CallToolRequestSchema as a0_0x18b3f2}from'@modelcontextprotocol/sdk/types.js';function p(_0x3f5266){const _0xd3b58f=a0_0x1de6;if(!a0_0x1aeafd(_0x3f5266))return;for(let _0x1ac711 of a0_0x14f765(_0x3f5266,_0xd3b58f(0xcc))[_0xd3b58f(0x98)]('\x0a')){let _0x1033e3=_0x1ac711[_0xd3b58f(0x109)]();if(!_0x1033e3||_0x1033e3['startsWith']('#'))continue;let _0xb6ff76=_0x1033e3['indexOf']('=');if(_0xb6ff76<0x0)continue;let _0xd61d6f=_0x1033e3['slice'](0x0,_0xb6ff76)['trim'](),_0x47486c=_0x1033e3['slice'](_0xb6ff76+0x1)[_0xd3b58f(0x109)]()[_0xd3b58f(0x110)](/^["']|["']$/g,'');if(!process.env[_0xd61d6f])process.env[_0xd61d6f]=_0x47486c;}}var C=process.env.HOME||'~',T=a0_0x13d10e(C,a0_0x40833c(0xf7));p(a0_0x13d10e(T,a0_0x40833c(0xf8)));var L=process[a0_0x40833c(0x8f)]()[a0_0x40833c(0x110)](/\//g,'-');p(a0_0x13d10e(T,L,a0_0x40833c(0xf8)));function U(){const _0x21837b=a0_0x40833c;try{return a0_0x5b612a('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x21837b(0xcc),'timeout':0x7d0})['trim']();}catch{return'';}}function v(){const _0x308008=a0_0x40833c;try{let _0x5eb1c0=a0_0x13d10e(C,'.anet',_0x308008(0x90));if(a0_0x1aeafd(_0x5eb1c0))return JSON[_0x308008(0x88)](a0_0x14f765(_0x5eb1c0,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x40833c(0xe8)]||a0_0x40833c(0xe7),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x569c50(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x3819dc(),X=process.env.COMMHUB_TOKEN||H[a0_0x40833c(0xaa)]||'';function Y(_0x54de99){const _0x846eb=a0_0x40833c;let _0xf4c59a=new Date()['toTimeString']()[_0x846eb(0x9f)](0x0,0x8);process[_0x846eb(0xae)][_0x846eb(0x107)]('['+_0xf4c59a+_0x846eb(0xb7)+_0x54de99+'\x0a');}function h(_0x5868b5){return new Promise(_0x425ead=>setTimeout(_0x425ead,_0x5868b5));}function a0_0x1de6(_0x2d5b59,_0x313087){_0x2d5b59=_0x2d5b59-0x85;const _0x3f3188=a0_0x3f31();let _0x1de6dc=_0x3f3188[_0x2d5b59];return _0x1de6dc;}Y(a0_0x40833c(0xe4)+f+a0_0x40833c(0xd2)+Z+'\x20RESUME_ID='+w[a0_0x40833c(0x9f)](0x0,0x8)+'...\x20TMUX='+(j||a0_0x40833c(0xef))+'\x20CWD='+process[a0_0x40833c(0x8f)]()+a0_0x40833c(0xa4)+L);var k=new Map(),K=new a0_0x23a3b2({'name':'commhub-channel','version':a0_0x40833c(0xbc)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x40833c(0xa7),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x40833c(0x9a),a0_0x40833c(0xf6),a0_0x40833c(0x10b)+Z][a0_0x40833c(0x106)]('\x0a')});K['setRequestHandler'](a0_0x3af468,async()=>({'tools':[{'name':a0_0x40833c(0xb0),'description':a0_0x40833c(0x8c),'inputSchema':{'type':a0_0x40833c(0xb2),'properties':{'task_id':{'type':a0_0x40833c(0xb5),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x40833c(0xb5),'description':a0_0x40833c(0xdd)},'status':{'type':a0_0x40833c(0xb5),'enum':['completed',a0_0x40833c(0xf3),'cancelled',a0_0x40833c(0xd8),'error',a0_0x40833c(0x92)],'description':a0_0x40833c(0x10d)}},'required':['text']}},{'name':a0_0x40833c(0x89),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x40833c(0xb2),'properties':{'status':{'type':a0_0x40833c(0xb5),'enum':[a0_0x40833c(0x85),a0_0x40833c(0xb4),a0_0x40833c(0xd8),a0_0x40833c(0xbe)]},'task':{'type':a0_0x40833c(0xb5),'description':a0_0x40833c(0xcb)},'progress':{'type':'number','description':a0_0x40833c(0x100)}},'required':[a0_0x40833c(0xe6)]}},{'name':a0_0x40833c(0xba),'description':a0_0x40833c(0x87),'inputSchema':{'type':a0_0x40833c(0xb2),'properties':{'alias':{'type':a0_0x40833c(0xb5),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x40833c(0xb5),'description':'Task\x20content'},'priority':{'type':'string','enum':['high','normal','low'],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x40833c(0x9c),'task']}},{'name':a0_0x40833c(0xee),'description':a0_0x40833c(0x9b),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x40833c(0xb5),'description':'Target\x20session\x20alias'},'message':{'type':'string','description':a0_0x40833c(0xb8)}},'required':[a0_0x40833c(0x9c),a0_0x40833c(0xb3)]}},{'name':a0_0x40833c(0x96),'description':a0_0x40833c(0xff),'inputSchema':{'type':'object','properties':{}}}]}));async function P(_0x3ee4cf,_0x56d041){const _0x396ddf=a0_0x40833c;let _0x4a229c=await fetch(f+_0x396ddf(0xa3),{'method':_0x396ddf(0xcf),'headers':{'Content-Type':_0x396ddf(0xcd),'Accept':_0x396ddf(0xa6),...X?{'Authorization':_0x396ddf(0x102)+X}:{}},'body':JSON[_0x396ddf(0xd7)]({'jsonrpc':_0x396ddf(0xeb),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x396ddf(0x10c),'capabilities':{},'clientInfo':{'name':_0x396ddf(0xa1),'version':_0x396ddf(0xbc)}}})});if(!_0x4a229c['ok']){let _0x3c1844=await _0x4a229c[_0x396ddf(0xac)]();return Y(_0x396ddf(0xfe)+_0x4a229c[_0x396ddf(0xe6)]+'\x20'+_0x3c1844[_0x396ddf(0x9f)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x4a229c[_0x396ddf(0xe6)]};}await _0x4a229c['text']();let _0x1be050=(await(await fetch(f+_0x396ddf(0xa3),{'method':_0x396ddf(0xcf),'headers':{'Content-Type':_0x396ddf(0xcd),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x396ddf(0x102)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x2,'method':_0x396ddf(0x105),'params':{'name':_0x3ee4cf,'arguments':_0x56d041}})}))[_0x396ddf(0xac)]())[_0x396ddf(0x98)]('\x0a')[_0x396ddf(0xfb)](_0x42fce8=>_0x42fce8[_0x396ddf(0xd4)](_0x396ddf(0x101)));if(_0x1be050){let _0xd5d3bd=JSON[_0x396ddf(0x88)](_0x1be050[_0x396ddf(0x9f)](0x6));return _0xd5d3bd?.[_0x396ddf(0xa9)]?.[_0x396ddf(0x10f)]?.[0x0]?.['text']?JSON[_0x396ddf(0x88)](_0xd5d3bd[_0x396ddf(0xa9)][_0x396ddf(0x10f)][0x0][_0x396ddf(0xac)]):_0xd5d3bd;}return{'ok':!0x1,'error':_0x396ddf(0xd9)};}K[a0_0x40833c(0xc6)](a0_0x18b3f2,async _0x2841f4=>{const _0x5cc7b4=a0_0x40833c;let {name:_0x87c849,arguments:_0x4b8432}=_0x2841f4[_0x5cc7b4(0xea)];if(_0x87c849===_0x5cc7b4(0xb0)){let {task_id:_0x21a24b,text:_0x4711b2,status:_0x585f4c}=_0x4b8432;if(_0x585f4c===_0x5cc7b4(0xe0)||_0x585f4c===_0x5cc7b4(0xf3)||_0x585f4c===_0x5cc7b4(0x99)){let _0x4827ae=_0x585f4c==='completed'?_0x5cc7b4(0x9d):_0x585f4c,_0x4e57ec=_0x21a24b?k[_0x5cc7b4(0xab)](_0x21a24b)||_0x5cc7b4(0xe8):_0x5cc7b4(0xe8),_0x24982d=await P(_0x5cc7b4(0xf5),{'alias':_0x4e57ec,'text':_0x4711b2,'in_reply_to':_0x21a24b||void 0x0,'status':_0x4827ae,'from_session':Z});if(_0x21a24b)k[_0x5cc7b4(0xb9)](_0x21a24b);return{'content':[{'type':'text','text':JSON['stringify'](_0x24982d)}]};}let _0x41a7c6=await P(_0x5cc7b4(0xd5),{'resume_id':w,'alias':Z,'status':_0x585f4c===_0x5cc7b4(0xd8)?_0x5cc7b4(0xd8):_0x585f4c===_0x5cc7b4(0xbe)?'error':_0x5cc7b4(0x85),'task':_0x4711b2[_0x5cc7b4(0x9f)](0x0,0xc8),'output':_0x4711b2});return{'content':[{'type':_0x5cc7b4(0xac),'text':JSON[_0x5cc7b4(0xd7)](_0x41a7c6)}]};}if(_0x87c849===_0x5cc7b4(0x89)){let {status:_0x22dedf,task:_0x12f7ac,progress:_0x568235}=_0x4b8432,_0x57072c=await P(_0x5cc7b4(0xd5),{'resume_id':w,'alias':Z,'status':_0x22dedf,'task':_0x12f7ac,'progress':_0x568235});return{'content':[{'type':_0x5cc7b4(0xac),'text':JSON[_0x5cc7b4(0xd7)](_0x57072c)}]};}if(_0x87c849===_0x5cc7b4(0xba)){let {alias:_0x3ce135,task:_0x578862,priority:_0x83b81a}=_0x4b8432,_0x28bf08=await P(_0x5cc7b4(0x94),{'alias':_0x3ce135,'task':_0x578862,'priority':_0x83b81a||_0x5cc7b4(0xc9),'from_session':Z});return{'content':[{'type':_0x5cc7b4(0xac),'text':JSON[_0x5cc7b4(0xd7)](_0x28bf08)}]};}if(_0x87c849===_0x5cc7b4(0xee)){let {alias:_0x1568aa,message:_0x546ab9}=_0x4b8432,_0x5b518e=await P(_0x5cc7b4(0x97),{'alias':_0x1568aa,'message':_0x546ab9,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x5cc7b4(0xd7)](_0x5b518e)}]};}if(_0x87c849==='commhub_get_all_status'){let _0x4f460d=await P(_0x5cc7b4(0xdf),{});return{'content':[{'type':'text','text':JSON[_0x5cc7b4(0xd7)](_0x4f460d)}]};}return{'content':[{'type':_0x5cc7b4(0xac),'text':JSON['stringify']({'error':'unknown\x20tool'})}]};});async function u(){const _0x364460=a0_0x40833c;let _0x280b6b=f+_0x364460(0xb1)+encodeURIComponent(Z),_0x32f883={};if(X)_0x32f883[_0x364460(0xd3)]=_0x364460(0x102)+X;Y(_0x364460(0xfc)+_0x280b6b);while(!0x0){try{let _0x15c405=await fetch(_0x280b6b,{'headers':_0x32f883});if(!_0x15c405['ok']){Y('SSE\x20error:\x20'+_0x15c405[_0x364460(0xe6)]+'\x20'+_0x15c405[_0x364460(0xbd)]),await h(0x1388);continue;}let _0x47c322=_0x15c405[_0x364460(0xf1)]['getReader'](),_0x185cc6=new TextDecoder(),_0x486f38='';while(!0x0){let {done:_0x1f7f80,value:_0x2c3cd3}=await _0x47c322[_0x364460(0xb6)]();if(_0x1f7f80)break;_0x486f38+=_0x185cc6['decode'](_0x2c3cd3,{'stream':!0x0});let _0x3a8b9d=_0x486f38['split']('\x0a\x0a');_0x486f38=_0x3a8b9d[_0x364460(0xd6)]()||'';for(let _0x54c154 of _0x3a8b9d){let _0x4697a3=_0x54c154['split']('\x0a')[_0x364460(0xfb)](_0x2957dd=>_0x2957dd[_0x364460(0xd4)]('data:\x20'));if(!_0x4697a3)continue;try{let _0x23e3b1=JSON[_0x364460(0x88)](_0x4697a3['slice'](0x6));await S(_0x23e3b1);}catch(_0x1ced78){Y(_0x364460(0xa5)+_0x1ced78);}}}Y(_0x364460(0x91));}catch(_0x12416f){Y(_0x364460(0xc0)+_0x12416f);}await h(0xbb8);}}async function S(_0x59268f){const _0x753b36=a0_0x40833c;if(_0x59268f[_0x753b36(0x103)]===_0x753b36(0x8a)){Y(_0x753b36(0x8d)+Z+'\x22');return;}if(_0x59268f[_0x753b36(0x103)]==='new_message'){if(Y(_0x753b36(0xa0)+_0x59268f[_0x753b36(0xa2)]+':\x20'+_0x59268f[_0x753b36(0xb3)][_0x753b36(0x9f)](0x0,0x3c)),await K['notification']({'method':_0x753b36(0x95),'params':{'content':_0x59268f[_0x753b36(0xb3)],'meta':{'sender':_0x59268f[_0x753b36(0xa2)]||_0x753b36(0xe8),'sender_id':_0x753b36(0xda),'user':_0x59268f[_0x753b36(0xa2)]||'hub','priority':_0x753b36(0xc9)}}}),_0x59268f['message_id'])await P(_0x753b36(0xaf),{'alias':Z,'message_id':_0x59268f['message_id']});return;}if(_0x59268f[_0x753b36(0x103)]===_0x753b36(0x86)||_0x59268f[_0x753b36(0x103)]===_0x753b36(0xc2)){Y('←\x20'+_0x59268f['type']+_0x753b36(0xe3)+_0x59268f['inbox_count']+'\x20priority='+(_0x59268f[_0x753b36(0xf4)]||_0x753b36(0xc9)));let _0x592a86=await P(_0x753b36(0x10e),{'alias':Z,'limit':0x5});if(_0x592a86?.['ok']&&_0x592a86[_0x753b36(0xbf)]?.[_0x753b36(0xa8)]>0x0)for(let _0x3086d3 of _0x592a86[_0x753b36(0xbf)]){let _0x3c8cf7={'sender':_0x3086d3[_0x753b36(0xe1)]||_0x753b36(0xe8),'sender_id':_0x753b36(0xda),'user':_0x3086d3[_0x753b36(0xe1)]||_0x753b36(0xe8),'task_id':_0x3086d3['id'],'priority':_0x3086d3[_0x753b36(0xf4)]||_0x753b36(0xc9)};k[_0x753b36(0xf0)](_0x3086d3['id'],_0x3086d3[_0x753b36(0xe1)]||_0x753b36(0xe8)),await K[_0x753b36(0xf9)]({'method':'notifications/claude/channel','params':{'content':_0x3086d3[_0x753b36(0x10f)],'meta':_0x3c8cf7}}),Y('→\x20injected\x20task\x20'+_0x3086d3['id']['slice'](0x0,0x8)+_0x753b36(0xd1)+_0x3086d3[_0x753b36(0xe1)]+':\x20'+_0x3086d3[_0x753b36(0x10f)][_0x753b36(0x9f)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x3086d3['id']});}}}async function A(){const _0x432a8b=a0_0x40833c;let _0x5d32d6=new a0_0x34239d();await K['connect'](_0x5d32d6),Y(_0x432a8b(0x8e)),Y('starting\x20SSE\x20listener...'),u()[_0x432a8b(0xca)](_0xd4595d=>Y(_0x432a8b(0xc4)+_0xd4595d)),P(_0x432a8b(0xd5),{'resume_id':w,'alias':Z,'status':_0x432a8b(0xb4),'server':a0_0x569c50(),'hostname':a0_0x569c50(),'agent':_0x432a8b(0xe9),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x432a8b(0xed)](()=>Y(_0x432a8b(0xfa)+Z+_0x432a8b(0xc3)+w[_0x432a8b(0x9f)](0x0,0x8)+')'))[_0x432a8b(0xca)](_0x813b2e=>Y('warning:\x20could\x20not\x20register:\x20'+_0x813b2e)),setInterval(()=>{const _0x6c9884=_0x432a8b;P(_0x6c9884(0xd5),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x569c50(),'hostname':a0_0x569c50(),'agent':_0x6c9884(0xe9),'project_dir':process[_0x6c9884(0x8f)](),'tmux_name':j||void 0x0})['catch'](_0xd6e1d4=>Y(_0x6c9884(0xdb)+_0xd6e1d4));},0x2bf20),Y(_0x432a8b(0x8b));}A()['catch'](_0x49c861=>{const _0xa5070d=a0_0x40833c;Y(_0xa5070d(0xc8)+_0x49c861),process[_0xa5070d(0x10a)](0x1);});async function N(){const _0x46bbdf=a0_0x40833c;Y(_0x46bbdf(0xc7)),await P(_0x46bbdf(0xd5),{'resume_id':w,'alias':Z,'status':_0x46bbdf(0xde),'task':_0x46bbdf(0xfd)})[_0x46bbdf(0xca)](()=>{}),process[_0x46bbdf(0x10a)](0x0);}process[a0_0x40833c(0xc5)]['on']('end',()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x40833c(0x93),()=>N());
2
+ const a0_0x86f61=a0_0x27af;(function(_0x56c710,_0x543040){const _0x2b753b=a0_0x27af,_0x461484=_0x56c710();while(!![]){try{const _0x14a5eb=-parseInt(_0x2b753b(0x23a))/0x1+parseInt(_0x2b753b(0x25f))/0x2*(parseInt(_0x2b753b(0x266))/0x3)+parseInt(_0x2b753b(0x223))/0x4*(-parseInt(_0x2b753b(0x228))/0x5)+parseInt(_0x2b753b(0x1de))/0x6*(-parseInt(_0x2b753b(0x214))/0x7)+parseInt(_0x2b753b(0x1f8))/0x8+-parseInt(_0x2b753b(0x1e5))/0x9*(-parseInt(_0x2b753b(0x1e0))/0xa)+-parseInt(_0x2b753b(0x1f3))/0xb*(-parseInt(_0x2b753b(0x1f6))/0xc);if(_0x14a5eb===_0x543040)break;else _0x461484['push'](_0x461484['shift']());}catch(_0x17d658){_0x461484['push'](_0x461484['shift']());}}}(a0_0x1563,0x7f27b));import{readFileSync as a0_0xfdad20,existsSync as a0_0x4ef9cc}from'fs';import{randomUUID as a0_0x2139e9}from'crypto';import{join as a0_0x357460}from'path';import{hostname as a0_0x30e4c4}from'os';import{execSync as a0_0x2bd4cb}from'child_process';import{Server as a0_0xb52157}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x5d0477}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x23f8b9,CallToolRequestSchema as a0_0x3fa19a}from'@modelcontextprotocol/sdk/types.js';function p(_0x88812b){const _0xcdac21=a0_0x27af;if(!a0_0x4ef9cc(_0x88812b))return;for(let _0x11c92a of a0_0xfdad20(_0x88812b,_0xcdac21(0x245))[_0xcdac21(0x1d8)]('\x0a')){let _0x31b27b=_0x11c92a[_0xcdac21(0x236)]();if(!_0x31b27b||_0x31b27b['startsWith']('#'))continue;let _0x36d8ab=_0x31b27b[_0xcdac21(0x20c)]('=');if(_0x36d8ab<0x0)continue;let _0x552b32=_0x31b27b[_0xcdac21(0x250)](0x0,_0x36d8ab)['trim'](),_0x2a79bd=_0x31b27b[_0xcdac21(0x250)](_0x36d8ab+0x1)[_0xcdac21(0x236)]()[_0xcdac21(0x263)](/^["']|["']$/g,'');if(!process.env[_0x552b32])process.env[_0x552b32]=_0x2a79bd;}}var T=process.env.HOME||'~',C=a0_0x357460(T,a0_0x86f61(0x252));p(a0_0x357460(C,a0_0x86f61(0x1ea)));var L=process['cwd']()['replace'](/\//g,'-');p(a0_0x357460(C,L,'.env'));function U(){const _0x49a08f=a0_0x86f61;try{return a0_0x2bd4cb('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':'utf-8','timeout':0x7d0})[_0x49a08f(0x236)]();}catch{return'';}}function c(){const _0x316316=a0_0x86f61;try{let _0x48ee7e=a0_0x357460(T,_0x316316(0x222),'config.json');if(a0_0x4ef9cc(_0x48ee7e))return JSON[_0x316316(0x212)](a0_0xfdad20(_0x48ee7e,_0x316316(0x245)));}catch{}return{};}var I=c(),f=process.env.COMMHUB_URL||I[a0_0x86f61(0x21d)]||'http://127.0.0.1:9200',x=process.env.COMMHUB_TMUX||U(),G=process.env.COMMHUB_ALIAS||x||a0_0x30e4c4(),X=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x2139e9(),F=process.env.COMMHUB_TOKEN||I[a0_0x86f61(0x205)]||'';function Z(_0x54f016){const _0x5a3f81=a0_0x86f61;let _0x4d56ed=new Date()[_0x5a3f81(0x1e9)]()[_0x5a3f81(0x250)](0x0,0x8);process[_0x5a3f81(0x20a)][_0x5a3f81(0x206)]('['+_0x4d56ed+']\x20[commhub]\x20'+_0x54f016+'\x0a');}function O(_0xfd05d8){return new Promise(_0x1e4d89=>setTimeout(_0x1e4d89,_0xfd05d8));}Z(a0_0x86f61(0x243)+f+a0_0x86f61(0x256)+G+'\x20RESUME_ID='+X[a0_0x86f61(0x250)](0x0,0x8)+'...\x20TMUX='+(x||a0_0x86f61(0x21f))+a0_0x86f61(0x23b)+process[a0_0x86f61(0x235)]()+'\x20PROJECT_ENV='+L);var N=new Map(),y=new a0_0xb52157({'name':a0_0x86f61(0x25c),'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>',a0_0x86f61(0x24c),a0_0x86f61(0x1fd),a0_0x86f61(0x1dd),a0_0x86f61(0x261)+G][a0_0x86f61(0x224)]('\x0a')});function a0_0x1563(){const _0x563f4f=['initialize','Filter\x20by\x20sender\x20alias','parse\x20error:\x20','registered\x20as\x20\x22','ENV:\x20URL=','list_tasks','utf-8','high','result','statusText','status','alias','startsWith','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','application/json,\x20text/event-stream','text','\x20priority=','slice','data:\x20','.claude/channels/commhub','shutting\x20down,\x20reporting\x20offline...','get','commhub','\x20ALIAS=','Session\x20alias','commhub_get_session_status','ready\x20—\x20waiting\x20for\x20events','messages','commhub_get_task','commhub-channel','connecting\x20to\x20','starting\x20SSE\x20listener...','139618bBgprv','exit','Session\x20alias:\x20','stdin','replace','stringify','SSE\x20error:\x20','18cphtCm','Authorization','pop','POST','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Optional\x20structured\x20metadata','blocked','Parent\x20task\x20id\x20for\x20auto-chaining\x20child\x20replies','SSE\x20connection\x20error:\x20','get_inbox','params','Filter\x20by\x20status','notifications/claude/channel','from_session','string','commhub_reply','replied','report_status','fatal:\x20','read','split','SIGTERM','Task\x20TTL\x20in\x20seconds','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','type','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','1816446iFbCsm','idle','1263020gRxydl','Current\x20task\x20description','set','get_task','Get\x20detailed\x20status\x20for\x20a\x20session\x20alias.','9nkqqjH','low','←\x20message\x20from\x20','application/json','toTimeString','.env','SSE\x20connected\x20as\x20\x22','connected','find','body','Get\x20task\x20details\x20by\x20task_id.\x20Poll\x20this\x20until\x20status\x20is\x20replied\x20or\x20failed.','working','in_progress','Max\x20rows','11npEyXj','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','offline','15453768GfRqAD','new_task','6098224VzVHqK','object','priority','unknown\x20tool','setRequestHandler','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','failed','Optional\x20context','Bearer\x20','catch','normal','→\x20injected\x20task\x20','message','token','write','Reply\x20text\x20/\x20result\x20summary','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','2025-03-26','stderr','Filter\x20by\x20recipient\x20alias','indexOf','SSE\x20fatal:\x20','commhub_list_tasks','Target\x20session\x20alias','Priority\x20(default:\x20normal)','task','parse','broadcast','21MBpEOl','number','send_reply','\x20from\x20','heartbeat\x20failed:\x20','CommHub\x20init\x20failed:\x20','delete','connect','List\x20tasks\x20with\x20optional\x20filters.','hub','Progress\x200-100','none','commhub_get_all_status','commhub_report_status','.anet','786908DpqOZm','join','/events/','ack_inbox','SSE\x20stream\x20ended,\x20reconnecting...','25sABoPx','init\x20failed:\x20','MCP\x20stdio\x20connected','send_task','commhub_send_task','get_all_status','Message\x20content','error','commhub_send_message','decode','message_id','content','getReader','cwd','trim','from','completed','inbox_count','182563SbMsyg','\x20CWD=','cancelled','notification','get_session_status'];a0_0x1563=function(){return _0x563f4f;};return a0_0x1563();}y['setRequestHandler'](a0_0x23f8b9,async()=>({'tools':[{'name':a0_0x86f61(0x275),'description':a0_0x86f61(0x1f4),'inputSchema':{'type':'object','properties':{'task_id':{'type':'string','description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x86f61(0x274),'description':a0_0x86f61(0x207)},'status':{'type':a0_0x86f61(0x274),'enum':[a0_0x86f61(0x238),a0_0x86f61(0x1fe),a0_0x86f61(0x23c),'blocked',a0_0x86f61(0x22f),a0_0x86f61(0x1f1)],'description':a0_0x86f61(0x1db)}},'required':[a0_0x86f61(0x24e)]}},{'name':a0_0x86f61(0x221),'description':a0_0x86f61(0x26a),'inputSchema':{'type':a0_0x86f61(0x1f9),'properties':{'status':{'type':a0_0x86f61(0x274),'enum':[a0_0x86f61(0x1f0),a0_0x86f61(0x1df),a0_0x86f61(0x26c),a0_0x86f61(0x22f)]},'task':{'type':a0_0x86f61(0x274),'description':a0_0x86f61(0x1e1)},'progress':{'type':a0_0x86f61(0x215),'description':a0_0x86f61(0x21e)}},'required':[a0_0x86f61(0x249)]}},{'name':'commhub_send_task','description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x86f61(0x1f9),'properties':{'alias':{'type':a0_0x86f61(0x274),'description':a0_0x86f61(0x20f)},'task':{'type':a0_0x86f61(0x274),'description':'Task\x20content'},'priority':{'type':'string','enum':[a0_0x86f61(0x246),a0_0x86f61(0x202),a0_0x86f61(0x1e6)],'description':a0_0x86f61(0x210)},'parent_task_id':{'type':'string','description':a0_0x86f61(0x26d)},'ttl_seconds':{'type':'number','description':a0_0x86f61(0x1da)},'context':{'type':a0_0x86f61(0x274),'description':a0_0x86f61(0x1ff)},'meta':{'type':a0_0x86f61(0x1f9),'description':a0_0x86f61(0x26b)}},'required':['alias',a0_0x86f61(0x211)]}},{'name':a0_0x86f61(0x230),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x86f61(0x1f9),'properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'message':{'type':'string','description':a0_0x86f61(0x22e)}},'required':[a0_0x86f61(0x24a),'message']}},{'name':a0_0x86f61(0x220),'description':a0_0x86f61(0x208),'inputSchema':{'type':'object','properties':{}}},{'name':a0_0x86f61(0x258),'description':a0_0x86f61(0x1e4),'inputSchema':{'type':a0_0x86f61(0x1f9),'properties':{'alias':{'type':a0_0x86f61(0x274),'description':a0_0x86f61(0x257)}},'required':[a0_0x86f61(0x24a)]}},{'name':a0_0x86f61(0x25b),'description':a0_0x86f61(0x1ef),'inputSchema':{'type':a0_0x86f61(0x1f9),'properties':{'task_id':{'type':a0_0x86f61(0x274),'description':'Task\x20id'}},'required':['task_id']}},{'name':a0_0x86f61(0x20e),'description':a0_0x86f61(0x21c),'inputSchema':{'type':'object','properties':{'to_name':{'type':'string','description':a0_0x86f61(0x20b)},'from_name':{'type':'string','description':a0_0x86f61(0x240)},'status':{'type':a0_0x86f61(0x274),'description':a0_0x86f61(0x271)},'limit':{'type':a0_0x86f61(0x215),'description':a0_0x86f61(0x1f2)}}}}]}));async function P(_0x56942b,_0x18441f){const _0x43871b=a0_0x86f61;let _0x393a92=await fetch(f+'/mcp',{'method':_0x43871b(0x269),'headers':{'Content-Type':_0x43871b(0x1e8),'Accept':_0x43871b(0x24d),...F?{'Authorization':_0x43871b(0x200)+F}:{}},'body':JSON[_0x43871b(0x264)]({'jsonrpc':'2.0','id':0x1,'method':_0x43871b(0x23f),'params':{'protocolVersion':_0x43871b(0x209),'capabilities':{},'clientInfo':{'name':_0x43871b(0x25c),'version':'0.3.0'}}})});if(!_0x393a92['ok']){let _0xaa3047=await _0x393a92[_0x43871b(0x24e)]();return Z(_0x43871b(0x219)+_0x393a92['status']+'\x20'+_0xaa3047[_0x43871b(0x250)](0x0,0x64)),{'ok':!0x1,'error':_0x43871b(0x229)+_0x393a92[_0x43871b(0x249)]};}await _0x393a92[_0x43871b(0x24e)]();let _0x1bf905=(await(await fetch(f+'/mcp',{'method':_0x43871b(0x269),'headers':{'Content-Type':_0x43871b(0x1e8),'Accept':_0x43871b(0x24d),...F?{'Authorization':_0x43871b(0x200)+F}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x2,'method':'tools/call','params':{'name':_0x56942b,'arguments':_0x18441f}})}))[_0x43871b(0x24e)]())[_0x43871b(0x1d8)]('\x0a')['find'](_0x1bfab1=>_0x1bfab1[_0x43871b(0x24b)](_0x43871b(0x251)));if(_0x1bf905){let _0x2d812b=JSON[_0x43871b(0x212)](_0x1bf905['slice'](0x6));return _0x2d812b?.[_0x43871b(0x247)]?.[_0x43871b(0x233)]?.[0x0]?.[_0x43871b(0x24e)]?JSON[_0x43871b(0x212)](_0x2d812b[_0x43871b(0x247)]['content'][0x0][_0x43871b(0x24e)]):_0x2d812b;}return{'ok':!0x1,'error':'no\x20response'};}y[a0_0x86f61(0x1fc)](a0_0x3fa19a,async _0x2bf832=>{const _0x45757a=a0_0x86f61;let {name:_0x1c0b1a,arguments:_0x24b82c}=_0x2bf832[_0x45757a(0x270)];if(_0x1c0b1a===_0x45757a(0x275)){let {task_id:_0x4b9b2c,text:_0x1356c5,status:_0x4c6d86}=_0x24b82c;if(_0x4c6d86===_0x45757a(0x238)||_0x4c6d86===_0x45757a(0x1fe)||_0x4c6d86===_0x45757a(0x23c)){let _0x1d9ef0=_0x4c6d86===_0x45757a(0x238)?_0x45757a(0x1d4):_0x4c6d86,_0x329d09=_0x4b9b2c?N[_0x45757a(0x254)](_0x4b9b2c)||_0x45757a(0x21d):_0x45757a(0x21d),_0x2b7818=await P(_0x45757a(0x216),{'alias':_0x329d09,'text':_0x1356c5,'in_reply_to':_0x4b9b2c||void 0x0,'status':_0x1d9ef0,'from_session':G});if(_0x4b9b2c)N[_0x45757a(0x21a)](_0x4b9b2c);return{'content':[{'type':_0x45757a(0x24e),'text':JSON['stringify'](_0x2b7818)}]};}let _0x341414=await P(_0x45757a(0x1d5),{'resume_id':X,'alias':G,'status':_0x4c6d86===_0x45757a(0x26c)?_0x45757a(0x26c):_0x4c6d86===_0x45757a(0x22f)?_0x45757a(0x22f):'working','task':_0x1356c5[_0x45757a(0x250)](0x0,0xc8),'output':_0x1356c5});return{'content':[{'type':_0x45757a(0x24e),'text':JSON['stringify'](_0x341414)}]};}if(_0x1c0b1a===_0x45757a(0x221)){let {status:_0x56ff9e,task:_0x1e3ae7,progress:_0xd8384f}=_0x24b82c,_0x418c17=await P(_0x45757a(0x1d5),{'resume_id':X,'alias':G,'status':_0x56ff9e,'task':_0x1e3ae7,'progress':_0xd8384f});return{'content':[{'type':_0x45757a(0x24e),'text':JSON[_0x45757a(0x264)](_0x418c17)}]};}if(_0x1c0b1a===_0x45757a(0x22c)){let {alias:_0x17db73,task:_0x1cb4e6,priority:_0x3e9078,parent_task_id:_0xb077ad,ttl_seconds:_0x4365fd,context:_0x233e22,meta:_0x5898c8}=_0x24b82c,_0x45252c=await P(_0x45757a(0x22b),{'alias':_0x17db73,'task':_0x1cb4e6,'priority':_0x3e9078||_0x45757a(0x202),'parent_task_id':_0xb077ad,'ttl_seconds':_0x4365fd,'context':_0x233e22,'meta':_0x5898c8,'from_session':G});return{'content':[{'type':'text','text':JSON['stringify'](_0x45252c)}]};}if(_0x1c0b1a==='commhub_send_message'){let {alias:_0x578faa,message:_0x7bf6f}=_0x24b82c,_0x199d80=await P('send_message',{'alias':_0x578faa,'message':_0x7bf6f,'from_session':G});return{'content':[{'type':_0x45757a(0x24e),'text':JSON['stringify'](_0x199d80)}]};}if(_0x1c0b1a===_0x45757a(0x220)){let _0x2f7327=await P(_0x45757a(0x22d),{});return{'content':[{'type':'text','text':JSON[_0x45757a(0x264)](_0x2f7327)}]};}if(_0x1c0b1a===_0x45757a(0x258)){let {alias:_0x5a537e}=_0x24b82c,_0x2ed295=await P(_0x45757a(0x23e),{'alias':_0x5a537e});return{'content':[{'type':_0x45757a(0x24e),'text':JSON[_0x45757a(0x264)](_0x2ed295)}]};}if(_0x1c0b1a===_0x45757a(0x25b)){let {task_id:_0x413824}=_0x24b82c,_0x5419cd=await P(_0x45757a(0x1e3),{'task_id':_0x413824});return{'content':[{'type':'text','text':JSON[_0x45757a(0x264)](_0x5419cd)}]};}if(_0x1c0b1a===_0x45757a(0x20e)){let {to_name:_0x252b38,from_name:_0x5ae763,status:_0x545172,limit:_0x68a37f}=_0x24b82c,_0x236cfe=await P(_0x45757a(0x244),{'to_name':_0x252b38,'from_name':_0x5ae763,'status':_0x545172,'limit':_0x68a37f});return{'content':[{'type':'text','text':JSON[_0x45757a(0x264)](_0x236cfe)}]};}return{'content':[{'type':'text','text':JSON[_0x45757a(0x264)]({'error':_0x45757a(0x1fb)})}]};});function a0_0x27af(_0x41aead,_0x1fc469){_0x41aead=_0x41aead-0x1d4;const _0x1563e9=a0_0x1563();let _0x27af05=_0x1563e9[_0x41aead];return _0x27af05;}async function S(){const _0x2019ac=a0_0x86f61;let _0x572179=f+_0x2019ac(0x225)+encodeURIComponent(G),_0x274721={};if(F)_0x274721[_0x2019ac(0x267)]=_0x2019ac(0x200)+F;Z(_0x2019ac(0x25d)+_0x572179);while(!0x0){try{let _0x53e318=await fetch(_0x572179,{'headers':_0x274721});if(!_0x53e318['ok']){Z(_0x2019ac(0x265)+_0x53e318['status']+'\x20'+_0x53e318[_0x2019ac(0x248)]),await O(0x1388);continue;}let _0x58f200=_0x53e318[_0x2019ac(0x1ee)][_0x2019ac(0x234)](),_0x5251ac=new TextDecoder(),_0x3de3d2='';while(!0x0){let {done:_0x5d5a35,value:_0x4bce00}=await _0x58f200[_0x2019ac(0x1d7)]();if(_0x5d5a35)break;_0x3de3d2+=_0x5251ac[_0x2019ac(0x231)](_0x4bce00,{'stream':!0x0});let _0x2a14ee=_0x3de3d2[_0x2019ac(0x1d8)]('\x0a\x0a');_0x3de3d2=_0x2a14ee[_0x2019ac(0x268)]()||'';for(let _0x3585fb of _0x2a14ee){let _0x50b252=_0x3585fb[_0x2019ac(0x1d8)]('\x0a')[_0x2019ac(0x1ed)](_0x309ffe=>_0x309ffe['startsWith'](_0x2019ac(0x251)));if(!_0x50b252)continue;try{let _0x229918=JSON[_0x2019ac(0x212)](_0x50b252['slice'](0x6));await A(_0x229918);}catch(_0x53d127){Z(_0x2019ac(0x241)+_0x53d127);}}}Z(_0x2019ac(0x227));}catch(_0x1eb82f){Z(_0x2019ac(0x26e)+_0x1eb82f);}await O(0xbb8);}}async function A(_0x44d270){const _0x17fb80=a0_0x86f61;if(_0x44d270[_0x17fb80(0x1dc)]===_0x17fb80(0x1ec)){Z(_0x17fb80(0x1eb)+G+'\x22');return;}if(_0x44d270[_0x17fb80(0x1dc)]==='new_message'){if(Z(_0x17fb80(0x1e7)+_0x44d270[_0x17fb80(0x237)]+':\x20'+_0x44d270[_0x17fb80(0x204)]['slice'](0x0,0x3c)),await y[_0x17fb80(0x23d)]({'method':_0x17fb80(0x272),'params':{'content':_0x44d270['message'],'meta':{'sender':_0x44d270[_0x17fb80(0x237)]||_0x17fb80(0x21d),'sender_id':'commhub','user':_0x44d270[_0x17fb80(0x237)]||_0x17fb80(0x21d),'priority':'normal'}}}),_0x44d270[_0x17fb80(0x232)])await P(_0x17fb80(0x226),{'alias':G,'message_id':_0x44d270['message_id']});return;}if(_0x44d270['type']===_0x17fb80(0x1f7)||_0x44d270['type']===_0x17fb80(0x213)){Z('←\x20'+_0x44d270[_0x17fb80(0x1dc)]+':\x20inbox_count='+_0x44d270[_0x17fb80(0x239)]+_0x17fb80(0x24f)+(_0x44d270['priority']||_0x17fb80(0x202)));let _0x6f686a=await P(_0x17fb80(0x26f),{'alias':G,'limit':0x5});if(_0x6f686a?.['ok']&&_0x6f686a[_0x17fb80(0x25a)]?.['length']>0x0)for(let _0x56de17 of _0x6f686a[_0x17fb80(0x25a)]){let _0x3cc2c2={'sender':_0x56de17['from_session']||'hub','sender_id':_0x17fb80(0x255),'user':_0x56de17[_0x17fb80(0x273)]||'hub','task_id':_0x56de17['id'],'priority':_0x56de17[_0x17fb80(0x1fa)]||_0x17fb80(0x202)};N[_0x17fb80(0x1e2)](_0x56de17['id'],_0x56de17[_0x17fb80(0x273)]||_0x17fb80(0x21d)),await y[_0x17fb80(0x23d)]({'method':_0x17fb80(0x272),'params':{'content':_0x56de17[_0x17fb80(0x233)],'meta':_0x3cc2c2}}),Z(_0x17fb80(0x203)+_0x56de17['id']['slice'](0x0,0x8)+_0x17fb80(0x217)+_0x56de17['from_session']+':\x20'+_0x56de17[_0x17fb80(0x233)][_0x17fb80(0x250)](0x0,0x3c)),await P(_0x17fb80(0x226),{'alias':G,'message_id':_0x56de17['id']});}}}async function u(){const _0x1a5925=a0_0x86f61;let _0x4895d6=new a0_0x5d0477();await y[_0x1a5925(0x21b)](_0x4895d6),Z(_0x1a5925(0x22a)),Z(_0x1a5925(0x25e)),S()['catch'](_0x586098=>Z(_0x1a5925(0x20d)+_0x586098)),P(_0x1a5925(0x1d5),{'resume_id':X,'alias':G,'status':_0x1a5925(0x1df),'server':a0_0x30e4c4(),'hostname':a0_0x30e4c4(),'agent':'claude-code','project_dir':process[_0x1a5925(0x235)](),'tmux_name':x||void 0x0})['then'](()=>Z(_0x1a5925(0x242)+G+'\x22\x20('+X[_0x1a5925(0x250)](0x0,0x8)+')'))[_0x1a5925(0x201)](_0x358e4b=>Z('warning:\x20could\x20not\x20register:\x20'+_0x358e4b)),setInterval(()=>{const _0x17b109=_0x1a5925;P(_0x17b109(0x1d5),{'resume_id':X,'alias':G,'status':_0x17b109(0x1df),'server':a0_0x30e4c4(),'hostname':a0_0x30e4c4(),'agent':'claude-code','project_dir':process[_0x17b109(0x235)](),'tmux_name':x||void 0x0})[_0x17b109(0x201)](_0x319eae=>Z(_0x17b109(0x218)+_0x319eae));},0x2bf20),Z(_0x1a5925(0x259));}u()[a0_0x86f61(0x201)](_0x226a31=>{const _0x59ea20=a0_0x86f61;Z(_0x59ea20(0x1d6)+_0x226a31),process['exit'](0x1);});async function h(){const _0x21f668=a0_0x86f61;Z(_0x21f668(0x253)),await P(_0x21f668(0x1d5),{'resume_id':X,'alias':G,'status':_0x21f668(0x1f5),'task':'session\x20disconnected'})[_0x21f668(0x201)](()=>{}),process[_0x21f668(0x260)](0x0);}process[a0_0x86f61(0x262)]['on']('end',()=>h()),process['on'](a0_0x86f61(0x1d9),()=>h()),process['on']('SIGINT',()=>h());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.2.7",
3
+ "version": "2.2.8-preview.1",
4
4
  "description": "AI Agent Network CLI — 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",
@@ -42,7 +42,7 @@
42
42
  "homepage": "https://anet.sh",
43
43
  "repository": {
44
44
  "type": "git",
45
- "url": "https://github.com/sleep2agi/agent-network",
45
+ "url": "git+https://github.com/sleep2agi/agent-network.git",
46
46
  "directory": "agent-network"
47
47
  },
48
48
  "publishConfig": {