@sleep2agi/agent-network 2.0.0-preview.19 → 2.0.0-preview.20

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_0x1e00b7=a0_0x2cff;(function(_0x557934,_0x15b4ea){const _0x5bd86d=a0_0x2cff,_0x3990d5=_0x557934();while(!![]){try{const _0x58306d=-parseInt(_0x5bd86d(0x14c))/0x1*(parseInt(_0x5bd86d(0x160))/0x2)+-parseInt(_0x5bd86d(0x12a))/0x3*(-parseInt(_0x5bd86d(0x165))/0x4)+parseInt(_0x5bd86d(0x164))/0x5+-parseInt(_0x5bd86d(0x127))/0x6+parseInt(_0x5bd86d(0x177))/0x7*(parseInt(_0x5bd86d(0x179))/0x8)+-parseInt(_0x5bd86d(0x124))/0x9*(-parseInt(_0x5bd86d(0x17a))/0xa)+parseInt(_0x5bd86d(0x137))/0xb*(-parseInt(_0x5bd86d(0x14b))/0xc);if(_0x58306d===_0x15b4ea)break;else _0x3990d5['push'](_0x3990d5['shift']());}catch(_0x1e7484){_0x3990d5['push'](_0x3990d5['shift']());}}}(a0_0x10b9,0xf02ff));import{EventEmitter as a0_0x18c0b9}from'events';import{hostname as a0_0x3fe062}from'os';class T extends a0_0x18c0b9{[a0_0x1e00b7(0x15f)];[a0_0x1e00b7(0x145)];[a0_0x1e00b7(0x16e)];['agent'];['resumeId'];[a0_0x1e00b7(0x162)];[a0_0x1e00b7(0x16c)];[a0_0x1e00b7(0x157)];[a0_0x1e00b7(0x14f)];[a0_0x1e00b7(0x171)]=!0x1;constructor(_0x56da4a){const _0x3bca63=a0_0x1e00b7;super();if(this[_0x3bca63(0x15f)]=_0x56da4a[_0x3bca63(0x15f)][_0x3bca63(0x142)](/\/$/,''),this[_0x3bca63(0x145)]=_0x56da4a[_0x3bca63(0x145)],this[_0x3bca63(0x16e)]=_0x56da4a[_0x3bca63(0x16e)],this['agent']=_0x56da4a[_0x3bca63(0x15a)]||_0x3bca63(0x168),this['resumeId']=_0x3bca63(0x174)+_0x56da4a['alias']+'-'+Date[_0x3bca63(0x13a)]()[_0x3bca63(0x13f)](0x24),this[_0x3bca63(0x162)]=_0x56da4a[_0x3bca63(0x162)]??0x2bf20,this['reconnectDelay']=_0x56da4a[_0x3bca63(0x16c)]??0xbb8,_0x56da4a[_0x3bca63(0x14e)]!==!0x1)this[_0x3bca63(0x175)]();}[a0_0x1e00b7(0x15c)](_0x5e9030){const _0x344505=a0_0x1e00b7;console['log']('['+new Date()[_0x344505(0x13c)]()['slice'](0x0,0x8)+_0x344505(0x120)+this[_0x344505(0x145)]+']\x20'+_0x5e9030);}async['call'](_0x4b6324,_0x5229ca){const _0x48fc01=a0_0x1e00b7;let _0x2b816d={'Content-Type':_0x48fc01(0x169),'Accept':_0x48fc01(0x130)};if(this[_0x48fc01(0x16e)])_0x2b816d[_0x48fc01(0x146)]='Bearer\x20'+this[_0x48fc01(0x16e)];let _0x5f514f=await(await fetch(this['url']+_0x48fc01(0x16d),{'method':'POST','headers':_0x2b816d,'body':JSON[_0x48fc01(0x15e)]({'jsonrpc':_0x48fc01(0x15b),'id':Date[_0x48fc01(0x13a)](),'method':'tools/call','params':{'name':_0x4b6324,'arguments':_0x5229ca}})}))[_0x48fc01(0x132)](),_0x3536da=_0x5f514f[_0x48fc01(0x155)](/data: (.+)/),_0x39a90c=_0x3536da?JSON[_0x48fc01(0x139)](_0x3536da[0x1]):JSON[_0x48fc01(0x139)](_0x5f514f),_0x2da068=_0x39a90c?.[_0x48fc01(0x153)]?.[_0x48fc01(0x156)]?.[0x0]?.[_0x48fc01(0x132)];return _0x2da068?JSON['parse'](_0x2da068):_0x39a90c;}async[a0_0x1e00b7(0x175)](){const _0x4dc68a=a0_0x1e00b7;if(this['running'])return;this['running']=!0x0,await this[_0x4dc68a(0x13b)](_0x4dc68a(0x166)),this[_0x4dc68a(0x15c)](_0x4dc68a(0x16f)),this[_0x4dc68a(0x157)]=setInterval(()=>{const _0x1cd40c=_0x4dc68a;this[_0x1cd40c(0x13b)](_0x1cd40c(0x166))['catch'](_0x2bcd3e=>this[_0x1cd40c(0x15c)](_0x1cd40c(0x149)+_0x2bcd3e[_0x1cd40c(0x159)]));},this['heartbeatInterval']),this[_0x4dc68a(0x178)]();}async[a0_0x1e00b7(0x121)](){const _0x41387f=a0_0x1e00b7;if(this['running']=!0x1,this['sseAbort']?.[_0x41387f(0x170)](),this[_0x41387f(0x157)])clearInterval(this[_0x41387f(0x157)]);await this[_0x41387f(0x13b)](_0x41387f(0x167))[_0x41387f(0x13d)](()=>{}),this['log'](_0x41387f(0x12c));}async[a0_0x1e00b7(0x134)](_0x460a80,_0x2f9871,_0x1682b2=a0_0x1e00b7(0x129)){const _0x3722a3=a0_0x1e00b7;return this['call']('send_task',{'alias':_0x460a80,'task':_0x2f9871,'priority':_0x1682b2,'from_session':this[_0x3722a3(0x145)]});}async[a0_0x1e00b7(0x159)](_0x2f5e99,_0x5e9e54){const _0x56702b=a0_0x1e00b7;return this[_0x56702b(0x141)](_0x56702b(0x154),{'alias':_0x2f5e99,'message':_0x5e9e54,'from_session':this['alias']});}async[a0_0x1e00b7(0x144)](_0x4669fc,_0x13aedc,_0x2666d9=a0_0x1e00b7(0x15d)){const _0x13b681=a0_0x1e00b7;return this[_0x13b681(0x141)](_0x13b681(0x144),{'task_id':_0x4669fc,'text':_0x13aedc,'status':_0x2666d9});}async[a0_0x1e00b7(0x13b)](_0x317ba9,_0x475e18){const _0x55d18d=a0_0x1e00b7;return this[_0x55d18d(0x141)](_0x55d18d(0x151),{'resume_id':this['resumeId'],'alias':this[_0x55d18d(0x145)],'status':_0x317ba9,'server':a0_0x3fe062(),'hostname':a0_0x3fe062(),'agent':this['agent'],'project_dir':process[_0x55d18d(0x13e)](),..._0x475e18});}async[a0_0x1e00b7(0x16b)](){const _0x2abe10=a0_0x1e00b7;return this[_0x2abe10(0x141)](_0x2abe10(0x126),{});}async[a0_0x1e00b7(0x128)](_0x16c3c7,_0x324eb3){const _0x42e77a=a0_0x1e00b7;return this[_0x42e77a(0x141)]('broadcast',{'message':_0x16c3c7,'filter_server':_0x324eb3?.[_0x42e77a(0x125)],'filter_status':_0x324eb3?.[_0x42e77a(0x13b)]});}async[a0_0x1e00b7(0x178)](){const _0x2803d4=a0_0x1e00b7;let _0x27f12b=encodeURIComponent(this['alias']),_0x1ea2e8=this['url']+_0x2803d4(0x161)+_0x27f12b,_0x422c55=this[_0x2803d4(0x16c)];while(this[_0x2803d4(0x171)]){try{this[_0x2803d4(0x14f)]=new AbortController();let _0xc74d2e={'Accept':'text/event-stream'};if(this[_0x2803d4(0x16e)])_0xc74d2e['Authorization']=_0x2803d4(0x12e)+this[_0x2803d4(0x16e)];let _0x4217b8=await fetch(_0x1ea2e8,{'headers':_0xc74d2e,'signal':this[_0x2803d4(0x14f)]['signal']});if(!_0x4217b8['ok']||!_0x4217b8['body']){this[_0x2803d4(0x15c)](_0x2803d4(0x11f)+_0x4217b8[_0x2803d4(0x13b)]),await this['sleep'](_0x422c55),_0x422c55=Math['min'](_0x422c55*1.5,0xea60);continue;}_0x422c55=this[_0x2803d4(0x16c)];let _0x342e94=_0x4217b8[_0x2803d4(0x140)][_0x2803d4(0x143)](),_0x504e4f=new TextDecoder(),_0x2f7c85='';while(this['running']){let {done:_0x31d9d4,value:_0xcbd871}=await _0x342e94[_0x2803d4(0x16a)]();if(_0x31d9d4)break;_0x2f7c85+=_0x504e4f['decode'](_0xcbd871,{'stream':!0x0});let _0x44787b=_0x2f7c85[_0x2803d4(0x135)]('\x0a');_0x2f7c85=_0x44787b[_0x2803d4(0x133)]()||'';for(let _0x2b5334 of _0x44787b){if(!_0x2b5334['startsWith'](_0x2803d4(0x176)))continue;try{let _0x5218b5=JSON[_0x2803d4(0x139)](_0x2b5334[_0x2803d4(0x163)](0x6));if(_0x5218b5['type']===_0x2803d4(0x147)){this['log']('SSE\x20connected'),this['emit'](_0x2803d4(0x147));continue;}if(_0x5218b5[_0x2803d4(0x148)]===_0x2803d4(0x123)||_0x5218b5[_0x2803d4(0x148)]===_0x2803d4(0x138)||_0x5218b5[_0x2803d4(0x148)]==='broadcast')await this[_0x2803d4(0x158)]();}catch{}}}}catch(_0x19d8be){if(_0x19d8be[_0x2803d4(0x12b)]===_0x2803d4(0x152))break;this[_0x2803d4(0x12f)](_0x2803d4(0x131),_0x19d8be),this[_0x2803d4(0x15c)]('SSE\x20error:\x20'+_0x19d8be[_0x2803d4(0x159)]);}if(this[_0x2803d4(0x171)])this['emit'](_0x2803d4(0x12c)),this[_0x2803d4(0x15c)](_0x2803d4(0x173)+_0x422c55/0x3e8+_0x2803d4(0x150)),await this['sleep'](_0x422c55),_0x422c55=Math['min'](_0x422c55*1.5,0xea60);}}async[a0_0x1e00b7(0x158)](){const _0x321716=a0_0x1e00b7;try{let _0x152c01=(await this[_0x321716(0x141)](_0x321716(0x136),{'alias':this[_0x321716(0x145)],'limit':0xa}))?.[_0x321716(0x12d)]||[];for(let _0x1ded0d of _0x152c01)await this['call'](_0x321716(0x14a),{'alias':this[_0x321716(0x145)],'message_id':_0x1ded0d['id']}),this[_0x321716(0x15c)]('←\x20'+_0x1ded0d[_0x321716(0x122)]+':\x20'+_0x1ded0d[_0x321716(0x156)][_0x321716(0x163)](0x0,0x3c)),this[_0x321716(0x12f)](_0x321716(0x172),_0x1ded0d),this[_0x321716(0x12f)]('message',_0x1ded0d);}catch(_0x1d8589){this[_0x321716(0x15c)](_0x321716(0x11e)+_0x1d8589[_0x321716(0x159)]);}}[a0_0x1e00b7(0x14d)](_0x2e60a3){return new Promise(_0x56fa26=>setTimeout(_0x56fa26,_0x2e60a3));}}var $=T;function a0_0x2cff(_0x554408,_0x1a3096){_0x554408=_0x554408-0x11e;const _0x10b903=a0_0x10b9();let _0x2cff92=_0x10b903[_0x554408];return _0x2cff92;}export{$ as default,T as CommHub};function a0_0x10b9(){const _0x433c51=['catch','cwd','toString','body','call','replace','getReader','reply','alias','Authorization','connected','type','heartbeat\x20failed:\x20','ack_inbox','17927604KzbvrF','1zQDLxL','sleep','autoConnect','sseAbort','s...','report_status','AbortError','result','send_message','match','content','heartbeatTimer','processInbox','message','agent','2.0','log','completed','stringify','url','2234010WWSTVl','/events/','heartbeatInterval','slice','6227990MjlbSv','8igRyUN','idle','offline','sdk','application/json','read','getAllStatus','reconnectDelay','/mcp','token','registered','abort','running','task','SSE\x20reconnecting\x20in\x20','sdk-','connect','data:\x20','7PqyFuh','connectSSE','6898448FZevwb','9376430sfzojg','inbox\x20error:\x20','SSE\x20failed:\x20',']\x20[commhub:','disconnect','from_session','new_task','18CpGssq','server','get_all_status','2521782AqAtqn','broadcast','normal','47829nRlHBj','name','disconnected','messages','Bearer\x20','emit','application/json,\x20text/event-stream','error','text','pop','send','split','get_inbox','11aRodlR','new_message','parse','now','status','toTimeString'];a0_0x10b9=function(){return _0x433c51;};return a0_0x10b9();}
1
+ const a0_0x4ced14=a0_0x3299;function a0_0x3299(_0x146f96,_0x5c3219){_0x146f96=_0x146f96-0x7b;const _0x2ef8cd=a0_0x2ef8();let _0x3299ef=_0x2ef8cd[_0x146f96];return _0x3299ef;}(function(_0x2c1816,_0x449e4a){const _0x3d5874=a0_0x3299,_0x2d6b8b=_0x2c1816();while(!![]){try{const _0x2bdac5=-parseInt(_0x3d5874(0xca))/0x1+parseInt(_0x3d5874(0xd2))/0x2+parseInt(_0x3d5874(0xad))/0x3+parseInt(_0x3d5874(0xd4))/0x4*(-parseInt(_0x3d5874(0xd1))/0x5)+parseInt(_0x3d5874(0xd6))/0x6+parseInt(_0x3d5874(0xa5))/0x7+parseInt(_0x3d5874(0xd0))/0x8*(-parseInt(_0x3d5874(0x7d))/0x9);if(_0x2bdac5===_0x449e4a)break;else _0x2d6b8b['push'](_0x2d6b8b['shift']());}catch(_0x8ccf10){_0x2d6b8b['push'](_0x2d6b8b['shift']());}}}(a0_0x2ef8,0x2f91d));import{EventEmitter as a0_0x14de88}from'events';function a0_0x2ef8(){const _0x2c6feb=['/events/','connected','cwd','1536WHTOPT','550pYzyaf','159070vdMQpG','sdk','156kHeTbr','running','1771854ytoQpp','data:\x20','signal','24372xcViud','url','type','read','connect','s...','body','offline','from_session','resumeId','inbox\x20error:\x20','error','agent','messages','connectSSE','token','message','completed','SSE\x20reconnecting\x20in\x20','POST','replace','status','get_inbox','abort','Bearer\x20','alias','log','getAllStatus','heartbeatTimer','processInbox','registered','AbortError','server','idle','task','pop','call','sdk-','application/json','min','2366840tJKhyI','getReader','reconnectDelay','catch','heartbeat\x20failed:\x20','decode','send','startsWith','1010346iNoHSv','SSE\x20failed:\x20','broadcast','slice','autoConnect','parse',']\x20[commhub:','content','Authorization','normal','reply','match','get_all_status','toTimeString','emit','send_message','sseAbort','now','SSE\x20error:\x20','heartbeatInterval','application/json,\x20text/event-stream','report_status','SSE\x20connected','text/event-stream','new_message','name','2.0','text','sleep','330675ZZgnnT','new_task','stringify'];a0_0x2ef8=function(){return _0x2c6feb;};return a0_0x2ef8();}import{hostname as a0_0x12598a}from'os';class T extends a0_0x14de88{['url'];[a0_0x4ced14(0x96)];[a0_0x4ced14(0x8c)];[a0_0x4ced14(0x89)];['resumeId'];[a0_0x4ced14(0xc0)];[a0_0x4ced14(0xa7)];['heartbeatTimer'];[a0_0x4ced14(0xbd)];[a0_0x4ced14(0xd5)]=!0x1;constructor(_0x2c6d03){const _0x1d8f92=a0_0x4ced14;super();if(this[_0x1d8f92(0x7e)]=_0x2c6d03['url'][_0x1d8f92(0x91)](/\/$/,''),this[_0x1d8f92(0x96)]=_0x2c6d03['alias'],this[_0x1d8f92(0x8c)]=_0x2c6d03['token'],this[_0x1d8f92(0x89)]=_0x2c6d03[_0x1d8f92(0x89)]||_0x1d8f92(0xd3),this[_0x1d8f92(0x86)]=_0x1d8f92(0xa2)+_0x2c6d03[_0x1d8f92(0x96)]+'-'+Date[_0x1d8f92(0xbe)]()['toString'](0x24),this[_0x1d8f92(0xc0)]=_0x2c6d03[_0x1d8f92(0xc0)]??0x2bf20,this[_0x1d8f92(0xa7)]=_0x2c6d03[_0x1d8f92(0xa7)]??0xbb8,_0x2c6d03[_0x1d8f92(0xb1)]!==!0x1)this['connect']();}[a0_0x4ced14(0x97)](_0x32ea9e){const _0x4609dd=a0_0x4ced14;console[_0x4609dd(0x97)]('['+new Date()[_0x4609dd(0xba)]()[_0x4609dd(0xb0)](0x0,0x8)+_0x4609dd(0xb3)+this[_0x4609dd(0x96)]+']\x20'+_0x32ea9e);}async[a0_0x4ced14(0xa1)](_0x346395,_0x3f96e9){const _0x21362c=a0_0x4ced14;let _0x3f6cfb={'Content-Type':_0x21362c(0xa3),'Accept':_0x21362c(0xc1)};if(this[_0x21362c(0x8c)])_0x3f6cfb[_0x21362c(0xb5)]='Bearer\x20'+this[_0x21362c(0x8c)];let _0x14d6d4=await(await fetch(this[_0x21362c(0x7e)]+'/mcp',{'method':_0x21362c(0x90),'headers':_0x3f6cfb,'body':JSON[_0x21362c(0xcc)]({'jsonrpc':_0x21362c(0xc7),'id':Date['now'](),'method':'tools/call','params':{'name':_0x346395,'arguments':_0x3f96e9}})}))[_0x21362c(0xc8)](),_0x4ed5a1=_0x14d6d4[_0x21362c(0xb8)](/data: (.+)/),_0x1fe01d=_0x4ed5a1?JSON[_0x21362c(0xb2)](_0x4ed5a1[0x1]):JSON['parse'](_0x14d6d4),_0x35ddac=_0x1fe01d?.['result']?.[_0x21362c(0xb4)]?.[0x0]?.['text'];return _0x35ddac?JSON[_0x21362c(0xb2)](_0x35ddac):_0x1fe01d;}async[a0_0x4ced14(0x81)](){const _0x41f6ea=a0_0x4ced14;if(this[_0x41f6ea(0xd5)])return;this[_0x41f6ea(0xd5)]=!0x0,await this[_0x41f6ea(0x92)](_0x41f6ea(0x9e)),this[_0x41f6ea(0x97)](_0x41f6ea(0x9b)),this[_0x41f6ea(0x99)]=setInterval(()=>{const _0x1cd598=_0x41f6ea;this[_0x1cd598(0x92)]('idle')[_0x1cd598(0xa8)](_0x135d62=>this[_0x1cd598(0x97)](_0x1cd598(0xa9)+_0x135d62['message']));},this['heartbeatInterval']),this[_0x41f6ea(0x8b)]();}async['disconnect'](){const _0x1f0ac5=a0_0x4ced14;if(this['running']=!0x1,this[_0x1f0ac5(0xbd)]?.[_0x1f0ac5(0x94)](),this[_0x1f0ac5(0x99)])clearInterval(this[_0x1f0ac5(0x99)]);await this[_0x1f0ac5(0x92)](_0x1f0ac5(0x84))[_0x1f0ac5(0xa8)](()=>{}),this[_0x1f0ac5(0x97)]('disconnected');}async[a0_0x4ced14(0xab)](_0x509c3c,_0x39797b,_0x578e7c=a0_0x4ced14(0xb6)){const _0x3ed279=a0_0x4ced14;return this[_0x3ed279(0xa1)]('send_task',{'alias':_0x509c3c,'task':_0x39797b,'priority':_0x578e7c,'from_session':this[_0x3ed279(0x96)]});}async[a0_0x4ced14(0x8d)](_0x2ce930,_0x527d1c){const _0xdb6ff9=a0_0x4ced14;return this['call'](_0xdb6ff9(0xbc),{'alias':_0x2ce930,'message':_0x527d1c,'from_session':this[_0xdb6ff9(0x96)]});}async[a0_0x4ced14(0xb7)](_0xd42fcb,_0x389a67,_0x35bb45=a0_0x4ced14(0x8e)){return this['call']('reply',{'task_id':_0xd42fcb,'text':_0x389a67,'status':_0x35bb45});}async['status'](_0x4aa296,_0x5b5442){const _0x295d68=a0_0x4ced14;return this[_0x295d68(0xa1)](_0x295d68(0xc2),{'resume_id':this[_0x295d68(0x86)],'alias':this[_0x295d68(0x96)],'status':_0x4aa296,'server':a0_0x12598a(),'hostname':a0_0x12598a(),'agent':this[_0x295d68(0x89)],'project_dir':process[_0x295d68(0xcf)](),..._0x5b5442});}async[a0_0x4ced14(0x98)](){const _0x39baba=a0_0x4ced14;return this[_0x39baba(0xa1)](_0x39baba(0xb9),{});}async['broadcast'](_0x183500,_0x1057fa){const _0x22fb11=a0_0x4ced14;return this[_0x22fb11(0xa1)](_0x22fb11(0xaf),{'message':_0x183500,'filter_server':_0x1057fa?.[_0x22fb11(0x9d)],'filter_status':_0x1057fa?.[_0x22fb11(0x92)]});}async['connectSSE'](){const _0x2772af=a0_0x4ced14;let _0x5ebe76=encodeURIComponent(this[_0x2772af(0x96)]),_0x2e3690=this['url']+_0x2772af(0xcd)+_0x5ebe76,_0x242145=this['reconnectDelay'];while(this[_0x2772af(0xd5)]){try{this['sseAbort']=new AbortController();let _0x3342ee={'Accept':_0x2772af(0xc4)};if(this[_0x2772af(0x8c)])_0x3342ee['Authorization']=_0x2772af(0x95)+this['token'];let _0x2b4959=await fetch(_0x2e3690,{'headers':_0x3342ee,'signal':this[_0x2772af(0xbd)][_0x2772af(0x7c)]});if(!_0x2b4959['ok']||!_0x2b4959[_0x2772af(0x83)]){this[_0x2772af(0x97)](_0x2772af(0xae)+_0x2b4959[_0x2772af(0x92)]),await this[_0x2772af(0xc9)](_0x242145),_0x242145=Math[_0x2772af(0xa4)](_0x242145*1.5,0xea60);continue;}_0x242145=this[_0x2772af(0xa7)];let _0x5dd1fd=_0x2b4959['body'][_0x2772af(0xa6)](),_0x3fba34=new TextDecoder(),_0x54792b='';while(this[_0x2772af(0xd5)]){let {done:_0x289aa6,value:_0x1988f7}=await _0x5dd1fd[_0x2772af(0x80)]();if(_0x289aa6)break;_0x54792b+=_0x3fba34[_0x2772af(0xaa)](_0x1988f7,{'stream':!0x0});let _0x51d098=_0x54792b['split']('\x0a');_0x54792b=_0x51d098[_0x2772af(0xa0)]()||'';for(let _0x355bbb of _0x51d098){if(!_0x355bbb[_0x2772af(0xac)](_0x2772af(0x7b)))continue;try{let _0x16bdd8=JSON[_0x2772af(0xb2)](_0x355bbb['slice'](0x6));if(_0x16bdd8['type']===_0x2772af(0xce)){this['log'](_0x2772af(0xc3)),this[_0x2772af(0xbb)](_0x2772af(0xce));continue;}if(_0x16bdd8[_0x2772af(0x7f)]===_0x2772af(0xcb)||_0x16bdd8[_0x2772af(0x7f)]===_0x2772af(0xc5)||_0x16bdd8['type']==='broadcast')await this[_0x2772af(0x9a)]();}catch{}}}}catch(_0xb4ae13){if(_0xb4ae13[_0x2772af(0xc6)]===_0x2772af(0x9c))break;this['emit'](_0x2772af(0x88),_0xb4ae13),this['log'](_0x2772af(0xbf)+_0xb4ae13[_0x2772af(0x8d)]);}if(this[_0x2772af(0xd5)])this[_0x2772af(0xbb)]('disconnected'),this['log'](_0x2772af(0x8f)+_0x242145/0x3e8+_0x2772af(0x82)),await this[_0x2772af(0xc9)](_0x242145),_0x242145=Math[_0x2772af(0xa4)](_0x242145*1.5,0xea60);}}async[a0_0x4ced14(0x9a)](){const _0x2f9c91=a0_0x4ced14;try{let _0x16c331=(await this[_0x2f9c91(0xa1)](_0x2f9c91(0x93),{'alias':this[_0x2f9c91(0x96)],'limit':0xa}))?.[_0x2f9c91(0x8a)]||[];for(let _0x58697d of _0x16c331)await this[_0x2f9c91(0xa1)]('ack_inbox',{'alias':this[_0x2f9c91(0x96)],'message_id':_0x58697d['id']}),this[_0x2f9c91(0x97)]('←\x20'+_0x58697d[_0x2f9c91(0x85)]+':\x20'+_0x58697d['content']['slice'](0x0,0x3c)),this[_0x2f9c91(0xbb)](_0x2f9c91(0x9f),_0x58697d),this[_0x2f9c91(0xbb)](_0x2f9c91(0x8d),_0x58697d);}catch(_0x40c696){this[_0x2f9c91(0x97)](_0x2f9c91(0x87)+_0x40c696[_0x2f9c91(0x8d)]);}}[a0_0x4ced14(0xc9)](_0x2a0511){return new Promise(_0x2b8fec=>setTimeout(_0x2b8fec,_0x2a0511));}}var $=T;export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x36896c=a0_0x44a6;(function(_0x37a36b,_0x2439da){const _0x19c72a=a0_0x44a6,_0x514744=_0x37a36b();while(!![]){try{const _0x4b466e=parseInt(_0x19c72a(0x16e))/0x1*(parseInt(_0x19c72a(0x16d))/0x2)+-parseInt(_0x19c72a(0x1bf))/0x3+parseInt(_0x19c72a(0x1c1))/0x4*(-parseInt(_0x19c72a(0x1a4))/0x5)+parseInt(_0x19c72a(0x1e0))/0x6+parseInt(_0x19c72a(0x15e))/0x7*(-parseInt(_0x19c72a(0x1aa))/0x8)+parseInt(_0x19c72a(0x17f))/0x9*(-parseInt(_0x19c72a(0x1ad))/0xa)+parseInt(_0x19c72a(0x199))/0xb;if(_0x4b466e===_0x2439da)break;else _0x514744['push'](_0x514744['shift']());}catch(_0x14fef1){_0x514744['push'](_0x514744['shift']());}}}(a0_0x5f10,0x571a1));import{readFileSync as a0_0x50838b,existsSync as a0_0x2c250c}from'fs';import{join as a0_0x3b7de0}from'path';import{hostname as a0_0x4197a}from'os';import{execSync as a0_0x1fee49}from'child_process';import{Server as a0_0xdc7477}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x57fecb}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x5bfcd0,CallToolRequestSchema as a0_0x4486ee}from'@modelcontextprotocol/sdk/types.js';function a0_0x5f10(){const _0x26e56a=['stringify','Priority\x20(default:\x20normal)',':\x20inbox_count=','application/json,\x20text/event-stream','decode','.claude/channels/commhub','text','new_task','body','join','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','application/json','Session\x20alias:\x20','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','SIGTERM','4274685IgSpzV','parse\x20error:\x20','\x20RESUME_ID=','SIGINT','failed','SSE\x20connected\x20as\x20\x22','Target\x20session\x20alias','unknown\x20tool','SSE\x20error:\x20','init\x20failed:\x20','report_status','replace','delete','session\x20disconnected','/events/','cwd','send_reply','ready\x20—\x20waiting\x20for\x20events','initialize','commhub-channel','idle','split','new_message','.env','tmux\x20display-message\x20-p\x20\x27#S\x27','startsWith','8607258WVLRBi','replied','stdin','blocked','0.3.0','exit','cancelled','\x20priority=','/mcp','2.0','tools/call','11805SvHXrg','Authorization','low','token','priority','config.json','400CRTuqI','2025-03-26','notification','10eePtiU','read','claude-code','connecting\x20to\x20','ENV:\x20URL=','get_inbox','pop','end',']\x20[commhub]\x20','warning:\x20could\x20not\x20register:\x20','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','status','commhub','normal','connected','hub','http://127.0.0.1:9200','Task\x20content','257409ImuSPJ','trim','196eHzgQf','write','none','Progress\x200-100','type','parse','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','object','in_progress','ack_inbox','Message\x20content','SSE\x20connection\x20error:\x20','alias','catch','setRequestHandler','commhub_get_all_status','result','...\x20TMUX=','task','Bearer\x20','then','data:\x20','find','content','string','number','commhub_send_task','POST','messages','getReader','utf-8','1987992uQPLLW','SSE\x20fatal:\x20','message_id','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','completed','Reply\x20text\x20/\x20result\x20summary','commhub_reply','registered\x20as\x20\x22','from_session','broadcast','send_message','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','message','slice','from','notifications/claude/channel','commhub_send_message','shutting\x20down,\x20reporting\x20offline...','45094DAYWgW','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','fatal:\x20','error','Current\x20task\x20description','no\x20response','working','randomUUID','params','heartbeat\x20failed:\x20','high','.anet','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','MCP\x20stdio\x20connected','commhub_report_status','4ZUjyhm','120758GQHhWD','get'];a0_0x5f10=function(){return _0x26e56a;};return a0_0x5f10();}function p(_0x2e3a8a){const _0x1448f7=a0_0x44a6;if(!a0_0x2c250c(_0x2e3a8a))return;for(let _0x28e077 of a0_0x50838b(_0x2e3a8a,_0x1448f7(0x1df))[_0x1448f7(0x194)]('\x0a')){let _0x9c4919=_0x28e077['trim']();if(!_0x9c4919||_0x9c4919['startsWith']('#'))continue;let _0x1f4fd2=_0x9c4919['indexOf']('=');if(_0x1f4fd2<0x0)continue;let _0x178917=_0x9c4919[_0x1448f7(0x1ed)](0x0,_0x1f4fd2)[_0x1448f7(0x1c0)](),_0x4548ef=_0x9c4919[_0x1448f7(0x1ed)](_0x1f4fd2+0x1)['trim']()['replace'](/^["']|["']$/g,'');if(!process.env[_0x178917])process.env[_0x178917]=_0x4548ef;}}var C=process.env.HOME||'~',T=a0_0x3b7de0(C,a0_0x36896c(0x175));p(a0_0x3b7de0(T,a0_0x36896c(0x196)));function a0_0x44a6(_0x5f2ee9,_0x5bf682){_0x5f2ee9=_0x5f2ee9-0x15b;const _0x5f1075=a0_0x5f10();let _0x44a614=_0x5f1075[_0x5f2ee9];return _0x44a614;}var L=process[a0_0x36896c(0x18e)]()[a0_0x36896c(0x18a)](/\//g,'-');p(a0_0x3b7de0(T,L,a0_0x36896c(0x196)));function U(){const _0x27bc1d=a0_0x36896c;try{return a0_0x1fee49(_0x27bc1d(0x197),{'encoding':'utf-8','timeout':0x7d0})[_0x27bc1d(0x1c0)]();}catch{return'';}}function c(){const _0x9805fd=a0_0x36896c;try{let _0x352129=a0_0x3b7de0(C,_0x9805fd(0x169),_0x9805fd(0x1a9));if(a0_0x2c250c(_0x352129))return JSON['parse'](a0_0x50838b(_0x352129,_0x9805fd(0x1df)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x36896c(0x1bc)]||a0_0x36896c(0x1bd),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x4197a(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x36896c(0x165)](),X=process.env.COMMHUB_TOKEN||H[a0_0x36896c(0x1a7)]||'';function Y(_0x259adf){const _0x2d0ab5=a0_0x36896c;let _0xc90d55=new Date()['toTimeString']()[_0x2d0ab5(0x1ed)](0x0,0x8);process['stderr'][_0x2d0ab5(0x1c2)]('['+_0xc90d55+_0x2d0ab5(0x1b5)+_0x259adf+'\x0a');}function h(_0xe8ed81){return new Promise(_0x14caa6=>setTimeout(_0x14caa6,_0xe8ed81));}Y(a0_0x36896c(0x1b1)+D+'\x20ALIAS='+Z+a0_0x36896c(0x181)+w[a0_0x36896c(0x1ed)](0x0,0x8)+a0_0x36896c(0x1d2)+(f||a0_0x36896c(0x1c3))+'\x20CWD='+process[a0_0x36896c(0x18e)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0xdc7477({'name':'commhub-channel','version':a0_0x36896c(0x19d)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x36896c(0x1e3),a0_0x36896c(0x17a),a0_0x36896c(0x17d),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x36896c(0x17c)+Z][a0_0x36896c(0x179)]('\x0a')});K[a0_0x36896c(0x1cf)](a0_0x5bfcd0,async()=>({'tools':[{'name':a0_0x36896c(0x1e6),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x36896c(0x1c8),'properties':{'task_id':{'type':a0_0x36896c(0x1d9),'description':a0_0x36896c(0x15f)},'text':{'type':a0_0x36896c(0x1d9),'description':a0_0x36896c(0x1e5)},'status':{'type':a0_0x36896c(0x1d9),'enum':[a0_0x36896c(0x1e4),a0_0x36896c(0x183),a0_0x36896c(0x19f),a0_0x36896c(0x19c),a0_0x36896c(0x161),a0_0x36896c(0x1c9)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x36896c(0x176)]}},{'name':a0_0x36896c(0x16c),'description':a0_0x36896c(0x1c7),'inputSchema':{'type':a0_0x36896c(0x1c8),'properties':{'status':{'type':'string','enum':['working','idle','blocked','error']},'task':{'type':'string','description':a0_0x36896c(0x162)},'progress':{'type':a0_0x36896c(0x1da),'description':a0_0x36896c(0x1c4)}},'required':[a0_0x36896c(0x1b8)]}},{'name':a0_0x36896c(0x1db),'description':a0_0x36896c(0x16a),'inputSchema':{'type':a0_0x36896c(0x1c8),'properties':{'alias':{'type':a0_0x36896c(0x1d9),'description':a0_0x36896c(0x185)},'task':{'type':a0_0x36896c(0x1d9),'description':a0_0x36896c(0x1be)},'priority':{'type':'string','enum':[a0_0x36896c(0x168),a0_0x36896c(0x1ba),a0_0x36896c(0x1a6)],'description':a0_0x36896c(0x171)}},'required':[a0_0x36896c(0x1cd),a0_0x36896c(0x1d3)]}},{'name':a0_0x36896c(0x15c),'description':a0_0x36896c(0x1eb),'inputSchema':{'type':a0_0x36896c(0x1c8),'properties':{'alias':{'type':a0_0x36896c(0x1d9),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x36896c(0x1d9),'description':a0_0x36896c(0x1cb)}},'required':[a0_0x36896c(0x1cd),'message']}},{'name':a0_0x36896c(0x1d0),'description':a0_0x36896c(0x1b7),'inputSchema':{'type':a0_0x36896c(0x1c8),'properties':{}}}]}));async function P(_0x44eb7,_0x440e92){const _0xdb371e=a0_0x36896c;let _0x4ba880=await fetch(D+_0xdb371e(0x1a1),{'method':_0xdb371e(0x1dc),'headers':{'Content-Type':'application/json','Accept':_0xdb371e(0x173),...X?{'Authorization':_0xdb371e(0x1d4)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0xdb371e(0x1a2),'id':0x1,'method':_0xdb371e(0x191),'params':{'protocolVersion':_0xdb371e(0x1ab),'capabilities':{},'clientInfo':{'name':_0xdb371e(0x192),'version':_0xdb371e(0x19d)}}})});if(!_0x4ba880['ok']){let _0x58e8fe=await _0x4ba880['text']();return Y('CommHub\x20init\x20failed:\x20'+_0x4ba880[_0xdb371e(0x1b8)]+'\x20'+_0x58e8fe[_0xdb371e(0x1ed)](0x0,0x64)),{'ok':!0x1,'error':_0xdb371e(0x188)+_0x4ba880[_0xdb371e(0x1b8)]};}await _0x4ba880[_0xdb371e(0x176)]();let _0x3c2465=(await(await fetch(D+_0xdb371e(0x1a1),{'method':_0xdb371e(0x1dc),'headers':{'Content-Type':_0xdb371e(0x17b),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0xdb371e(0x1d4)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0xdb371e(0x1a2),'id':0x2,'method':_0xdb371e(0x1a3),'params':{'name':_0x44eb7,'arguments':_0x440e92}})}))[_0xdb371e(0x176)]())[_0xdb371e(0x194)]('\x0a')[_0xdb371e(0x1d7)](_0x57f9a7=>_0x57f9a7[_0xdb371e(0x198)](_0xdb371e(0x1d6)));if(_0x3c2465){let _0x4aa79e=JSON[_0xdb371e(0x1c6)](_0x3c2465[_0xdb371e(0x1ed)](0x6));return _0x4aa79e?.['result']?.[_0xdb371e(0x1d8)]?.[0x0]?.[_0xdb371e(0x176)]?JSON[_0xdb371e(0x1c6)](_0x4aa79e[_0xdb371e(0x1d1)][_0xdb371e(0x1d8)][0x0]['text']):_0x4aa79e;}return{'ok':!0x1,'error':_0xdb371e(0x163)};}K[a0_0x36896c(0x1cf)](a0_0x4486ee,async _0x48b3f9=>{const _0x272ac8=a0_0x36896c;let {name:_0x111e61,arguments:_0x55bdc5}=_0x48b3f9[_0x272ac8(0x166)];if(_0x111e61===_0x272ac8(0x1e6)){let {task_id:_0xb38443,text:_0xf7e199,status:_0x5220d9}=_0x55bdc5;if(_0x5220d9===_0x272ac8(0x1e4)||_0x5220d9===_0x272ac8(0x183)||_0x5220d9===_0x272ac8(0x19f)){let _0x3920a5=_0x5220d9===_0x272ac8(0x1e4)?_0x272ac8(0x19a):_0x5220d9,_0x363c63=_0xb38443?k[_0x272ac8(0x16f)](_0xb38443)||_0x272ac8(0x1bc):_0x272ac8(0x1bc),_0x3adda5=await P(_0x272ac8(0x18f),{'alias':_0x363c63,'text':_0xf7e199,'in_reply_to':_0xb38443||void 0x0,'status':_0x3920a5,'from_session':Z});if(_0xb38443)k[_0x272ac8(0x18b)](_0xb38443);return{'content':[{'type':'text','text':JSON[_0x272ac8(0x170)](_0x3adda5)}]};}let _0x7bc444=await P(_0x272ac8(0x189),{'resume_id':w,'alias':Z,'status':_0x5220d9===_0x272ac8(0x19c)?_0x272ac8(0x19c):_0x5220d9===_0x272ac8(0x161)?'error':_0x272ac8(0x164),'task':_0xf7e199['slice'](0x0,0xc8),'output':_0xf7e199});return{'content':[{'type':'text','text':JSON[_0x272ac8(0x170)](_0x7bc444)}]};}if(_0x111e61===_0x272ac8(0x16c)){let {status:_0x3b9abd,task:_0x41496d,progress:_0x28f8de}=_0x55bdc5,_0x3a49e4=await P(_0x272ac8(0x189),{'resume_id':w,'alias':Z,'status':_0x3b9abd,'task':_0x41496d,'progress':_0x28f8de});return{'content':[{'type':_0x272ac8(0x176),'text':JSON[_0x272ac8(0x170)](_0x3a49e4)}]};}if(_0x111e61===_0x272ac8(0x1db)){let {alias:_0x351573,task:_0x30d640,priority:_0x4c183a}=_0x55bdc5,_0x1bb5af=await P('send_task',{'alias':_0x351573,'task':_0x30d640,'priority':_0x4c183a||'normal','from_session':Z});return{'content':[{'type':'text','text':JSON[_0x272ac8(0x170)](_0x1bb5af)}]};}if(_0x111e61===_0x272ac8(0x15c)){let {alias:_0x96b191,message:_0x391175}=_0x55bdc5,_0x4c6071=await P(_0x272ac8(0x1ea),{'alias':_0x96b191,'message':_0x391175,'from_session':Z});return{'content':[{'type':_0x272ac8(0x176),'text':JSON[_0x272ac8(0x170)](_0x4c6071)}]};}if(_0x111e61===_0x272ac8(0x1d0)){let _0x1a06a9=await P('get_all_status',{});return{'content':[{'type':_0x272ac8(0x176),'text':JSON[_0x272ac8(0x170)](_0x1a06a9)}]};}return{'content':[{'type':_0x272ac8(0x176),'text':JSON[_0x272ac8(0x170)]({'error':_0x272ac8(0x186)})}]};});async function v(){const _0x27bba9=a0_0x36896c;let _0x5dd499=D+_0x27bba9(0x18d)+encodeURIComponent(Z),_0x5b078b={};if(X)_0x5b078b[_0x27bba9(0x1a5)]=_0x27bba9(0x1d4)+X;Y(_0x27bba9(0x1b0)+_0x5dd499);while(!0x0){try{let _0x10dd2d=await fetch(_0x5dd499,{'headers':_0x5b078b});if(!_0x10dd2d['ok']){Y(_0x27bba9(0x187)+_0x10dd2d['status']+'\x20'+_0x10dd2d['statusText']),await h(0x1388);continue;}let _0x5be72f=_0x10dd2d[_0x27bba9(0x178)][_0x27bba9(0x1de)](),_0x202e05=new TextDecoder(),_0x59ef50='';while(!0x0){let {done:_0x5a7272,value:_0xebd3e1}=await _0x5be72f[_0x27bba9(0x1ae)]();if(_0x5a7272)break;_0x59ef50+=_0x202e05[_0x27bba9(0x174)](_0xebd3e1,{'stream':!0x0});let _0x587fd7=_0x59ef50[_0x27bba9(0x194)]('\x0a\x0a');_0x59ef50=_0x587fd7[_0x27bba9(0x1b3)]()||'';for(let _0x2d606d of _0x587fd7){let _0x386947=_0x2d606d[_0x27bba9(0x194)]('\x0a')[_0x27bba9(0x1d7)](_0x1996f3=>_0x1996f3['startsWith'](_0x27bba9(0x1d6)));if(!_0x386947)continue;try{let _0x3313aa=JSON[_0x27bba9(0x1c6)](_0x386947[_0x27bba9(0x1ed)](0x6));await u(_0x3313aa);}catch(_0x4b75b3){Y(_0x27bba9(0x180)+_0x4b75b3);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x2faa62){Y(_0x27bba9(0x1cc)+_0x2faa62);}await h(0xbb8);}}async function u(_0x136a50){const _0x16948e=a0_0x36896c;if(_0x136a50[_0x16948e(0x1c5)]===_0x16948e(0x1bb)){Y(_0x16948e(0x184)+Z+'\x22');return;}if(_0x136a50[_0x16948e(0x1c5)]===_0x16948e(0x195)){if(Y('←\x20message\x20from\x20'+_0x136a50[_0x16948e(0x1ee)]+':\x20'+_0x136a50['message'][_0x16948e(0x1ed)](0x0,0x3c)),await K[_0x16948e(0x1ac)]({'method':'notifications/claude/channel','params':{'content':_0x136a50[_0x16948e(0x1ec)],'meta':{'sender':_0x136a50[_0x16948e(0x1ee)]||_0x16948e(0x1bc),'sender_id':_0x16948e(0x1b9),'user':_0x136a50[_0x16948e(0x1ee)]||_0x16948e(0x1bc),'priority':'normal'}}}),_0x136a50[_0x16948e(0x1e2)])await P(_0x16948e(0x1ca),{'alias':Z,'message_id':_0x136a50[_0x16948e(0x1e2)]});return;}if(_0x136a50[_0x16948e(0x1c5)]===_0x16948e(0x177)||_0x136a50['type']===_0x16948e(0x1e9)){Y('←\x20'+_0x136a50[_0x16948e(0x1c5)]+_0x16948e(0x172)+_0x136a50['inbox_count']+_0x16948e(0x1a0)+(_0x136a50[_0x16948e(0x1a8)]||_0x16948e(0x1ba)));let _0x5db881=await P(_0x16948e(0x1b2),{'alias':Z,'limit':0x5});if(_0x5db881?.['ok']&&_0x5db881[_0x16948e(0x1dd)]?.['length']>0x0)for(let _0x43d0dc of _0x5db881[_0x16948e(0x1dd)]){let _0x33a1f1={'sender':_0x43d0dc[_0x16948e(0x1e8)]||_0x16948e(0x1bc),'sender_id':'commhub','user':_0x43d0dc['from_session']||_0x16948e(0x1bc),'task_id':_0x43d0dc['id'],'priority':_0x43d0dc[_0x16948e(0x1a8)]||_0x16948e(0x1ba)};k['set'](_0x43d0dc['id'],_0x43d0dc[_0x16948e(0x1e8)]||'hub'),await K[_0x16948e(0x1ac)]({'method':_0x16948e(0x15b),'params':{'content':_0x43d0dc[_0x16948e(0x1d8)],'meta':_0x33a1f1}}),Y('→\x20injected\x20task\x20'+_0x43d0dc['id']['slice'](0x0,0x8)+'\x20from\x20'+_0x43d0dc['from_session']+':\x20'+_0x43d0dc[_0x16948e(0x1d8)][_0x16948e(0x1ed)](0x0,0x3c)),await P(_0x16948e(0x1ca),{'alias':Z,'message_id':_0x43d0dc['id']});}}}async function S(){const _0x651a9f=a0_0x36896c;let _0x1dd172=new a0_0x57fecb();await K['connect'](_0x1dd172),Y(_0x651a9f(0x16b)),Y('starting\x20SSE\x20listener...'),v()[_0x651a9f(0x1ce)](_0x4bc635=>Y(_0x651a9f(0x1e1)+_0x4bc635)),P(_0x651a9f(0x189),{'resume_id':w,'alias':Z,'status':_0x651a9f(0x193),'server':a0_0x4197a(),'hostname':a0_0x4197a(),'agent':_0x651a9f(0x1af),'project_dir':process[_0x651a9f(0x18e)](),'tmux_name':f||void 0x0})[_0x651a9f(0x1d5)](()=>Y(_0x651a9f(0x1e7)+Z+'\x22\x20('+w[_0x651a9f(0x1ed)](0x0,0x8)+')'))[_0x651a9f(0x1ce)](_0x4e6b89=>Y(_0x651a9f(0x1b6)+_0x4e6b89)),setInterval(()=>{const _0x4ae84e=_0x651a9f;P(_0x4ae84e(0x189),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x4197a(),'hostname':a0_0x4197a(),'agent':_0x4ae84e(0x1af),'project_dir':process[_0x4ae84e(0x18e)](),'tmux_name':f||void 0x0})['catch'](_0x5c8cb3=>Y(_0x4ae84e(0x167)+_0x5c8cb3));},0x2bf20),Y(_0x651a9f(0x190));}S()['catch'](_0x176ffb=>{const _0x1ca6ff=a0_0x36896c;Y(_0x1ca6ff(0x160)+_0x176ffb),process[_0x1ca6ff(0x19e)](0x1);});async function N(){const _0x26fd19=a0_0x36896c;Y(_0x26fd19(0x15d)),await P(_0x26fd19(0x189),{'resume_id':w,'alias':Z,'status':_0x26fd19(0x161),'task':_0x26fd19(0x18c)})[_0x26fd19(0x1ce)](()=>{}),process['exit'](0x0);}process[a0_0x36896c(0x19b)]['on'](a0_0x36896c(0x1b4),()=>N()),process['on'](a0_0x36896c(0x17e),()=>N()),process['on'](a0_0x36896c(0x182),()=>N());
2
+ const a0_0x2f5f5a=a0_0x435d;(function(_0x43b623,_0x12010a){const _0x4259a2=a0_0x435d,_0x285496=_0x43b623();while(!![]){try{const _0x186094=-parseInt(_0x4259a2(0xec))/0x1*(-parseInt(_0x4259a2(0x114))/0x2)+parseInt(_0x4259a2(0x10a))/0x3*(-parseInt(_0x4259a2(0x132))/0x4)+parseInt(_0x4259a2(0x105))/0x5*(parseInt(_0x4259a2(0x161))/0x6)+-parseInt(_0x4259a2(0x158))/0x7+-parseInt(_0x4259a2(0x147))/0x8*(parseInt(_0x4259a2(0xf7))/0x9)+-parseInt(_0x4259a2(0x134))/0xa+-parseInt(_0x4259a2(0x104))/0xb*(-parseInt(_0x4259a2(0x172))/0xc);if(_0x186094===_0x12010a)break;else _0x285496['push'](_0x285496['shift']());}catch(_0x3fc92b){_0x285496['push'](_0x285496['shift']());}}}(a0_0x3ae2,0xcd099));import{readFileSync as a0_0x55e6e4,existsSync as a0_0x48526e}from'fs';import{join as a0_0x1ff871}from'path';import{hostname as a0_0x161551}from'os';import{execSync as a0_0x3ba3a2}from'child_process';import{Server as a0_0x5219ed}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x3ae2(){const _0xc45344=['message_id','ack_inbox','54376pbMYpa','then','SSE\x20connection\x20error:\x20','message','startsWith','application/json,\x20text/event-stream','Current\x20task\x20description','toTimeString','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','normal','initialize','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','split','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','POST','idle','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','9000579YqqeNp','SIGINT','catch','stderr','get_all_status','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','find','Bearer\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','22746ErKdcR','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','←\x20message\x20from\x20','slice','unknown\x20tool','error','\x20RESUME_ID=','send_reply','http://127.0.0.1:9200','blocked','new_task','warning:\x20could\x20not\x20register:\x20','string','0.3.0','read','messages','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','24sOJcmw','Reply\x20text\x20/\x20result\x20summary','2.0','status','connected','1RiDfGU','set','completed','cancelled','get','replied','priority','working','claude-code','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','registered\x20as\x20\x22','1143XAlanI','...\x20TMUX=','session\x20disconnected','Session\x20alias:\x20','result','object','parse','commhub_get_all_status','randomUUID','shutting\x20down,\x20reporting\x20offline...','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','SSE\x20fatal:\x20','SSE\x20connected\x20as\x20\x22','17148505UnkaTf','55TTWkIS','\x22\x20(','new_message','\x20CWD=','hub','361758KPPTsf','trim','data:\x20','report_status','/mcp','write','alias','→\x20injected\x20task\x20','failed','application/json','1486550pgtBbA','stdin','.claude/channels/commhub','pop','SIGTERM','length','replace','end','Priority\x20(default:\x20normal)','content','notification',':\x20inbox_count=','cwd','in_progress','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','.env','/events/','decode','type','\x20ALIAS=','ready\x20—\x20waiting\x20for\x20events','send_message','from','Message\x20content','get_inbox','send_task','init\x20failed:\x20','inbox_count','getReader','\x20PROJECT_ENV=','16EzIzHf','from_session','4316930EzKSZQ','exit','high','commhub_report_status','utf-8','commhub_reply','connecting\x20to\x20','low','notifications/claude/channel','commhub_send_message','text','task','Progress\x200-100','SSE\x20stream\x20ended,\x20reconnecting...','stringify','commhub_send_task','none'];a0_0x3ae2=function(){return _0xc45344;};return a0_0x3ae2();}import{StdioServerTransport as a0_0xcb3d89}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x591d98,CallToolRequestSchema as a0_0x4749f3}from'@modelcontextprotocol/sdk/types.js';function p(_0x564fb9){const _0x46b256=a0_0x435d;if(!a0_0x48526e(_0x564fb9))return;for(let _0x4899de of a0_0x55e6e4(_0x564fb9,'utf-8')[_0x46b256(0x153)]('\x0a')){let _0x4c8f82=_0x4899de[_0x46b256(0x10b)]();if(!_0x4c8f82||_0x4c8f82['startsWith']('#'))continue;let _0x1e2784=_0x4c8f82['indexOf']('=');if(_0x1e2784<0x0)continue;let _0x4e7df6=_0x4c8f82[_0x46b256(0x164)](0x0,_0x1e2784)[_0x46b256(0x10b)](),_0x1c1115=_0x4c8f82['slice'](_0x1e2784+0x1)[_0x46b256(0x10b)]()[_0x46b256(0x11a)](/^["']|["']$/g,'');if(!process.env[_0x4e7df6])process.env[_0x4e7df6]=_0x1c1115;}}function a0_0x435d(_0x29673e,_0x56bbbf){_0x29673e=_0x29673e-0xe9;const _0x3ae2e2=a0_0x3ae2();let _0x435df6=_0x3ae2e2[_0x29673e];return _0x435df6;}var C=process.env.HOME||'~',T=a0_0x1ff871(C,a0_0x2f5f5a(0x116));p(a0_0x1ff871(T,a0_0x2f5f5a(0x123)));var L=process[a0_0x2f5f5a(0x120)]()[a0_0x2f5f5a(0x11a)](/\//g,'-');p(a0_0x1ff871(T,L,a0_0x2f5f5a(0x123)));function U(){const _0x5d7479=a0_0x2f5f5a;try{return a0_0x3ba3a2('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x5d7479(0x138),'timeout':0x7d0})[_0x5d7479(0x10b)]();}catch{return'';}}function c(){const _0x2f610f=a0_0x2f5f5a;try{let _0x2810b2=a0_0x1ff871(C,'.anet','config.json');if(a0_0x48526e(_0x2810b2))return JSON[_0x2f610f(0xfd)](a0_0x55e6e4(_0x2810b2,_0x2f610f(0x138)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x2f5f5a(0x109)]||a0_0x2f5f5a(0x169),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x161551(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x2f5f5a(0xff)](),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x46f08d){const _0x1c2420=a0_0x2f5f5a;let _0x345970=new Date()[_0x1c2420(0x14e)]()['slice'](0x0,0x8);process[_0x1c2420(0x15b)][_0x1c2420(0x10f)]('['+_0x345970+']\x20[commhub]\x20'+_0x46f08d+'\x0a');}function h(_0x36b350){return new Promise(_0x51a785=>setTimeout(_0x51a785,_0x36b350));}Y('ENV:\x20URL='+D+a0_0x2f5f5a(0x127)+Z+a0_0x2f5f5a(0x167)+w[a0_0x2f5f5a(0x164)](0x0,0x8)+a0_0x2f5f5a(0xf8)+(f||a0_0x2f5f5a(0x144))+a0_0x2f5f5a(0x108)+process[a0_0x2f5f5a(0x120)]()+a0_0x2f5f5a(0x131)+L);var k=new Map(),K=new a0_0x5219ed({'name':'commhub-channel','version':a0_0x2f5f5a(0x16e)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x2f5f5a(0x122),a0_0x2f5f5a(0xf5),a0_0x2f5f5a(0x154),a0_0x2f5f5a(0x152),a0_0x2f5f5a(0xfa)+Z]['join']('\x0a')});K['setRequestHandler'](a0_0x591d98,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x2f5f5a(0x160),'inputSchema':{'type':a0_0x2f5f5a(0xfc),'properties':{'task_id':{'type':a0_0x2f5f5a(0x16d),'description':a0_0x2f5f5a(0x157)},'text':{'type':a0_0x2f5f5a(0x16d),'description':a0_0x2f5f5a(0x173)},'status':{'type':a0_0x2f5f5a(0x16d),'enum':[a0_0x2f5f5a(0xee),a0_0x2f5f5a(0x112),a0_0x2f5f5a(0xef),'blocked','error',a0_0x2f5f5a(0x121)],'description':a0_0x2f5f5a(0x171)}},'required':[a0_0x2f5f5a(0x13e)]}},{'name':'commhub_report_status','description':a0_0x2f5f5a(0x101),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x2f5f5a(0x16d),'enum':[a0_0x2f5f5a(0xf3),a0_0x2f5f5a(0x156),a0_0x2f5f5a(0x16a),a0_0x2f5f5a(0x166)]},'task':{'type':a0_0x2f5f5a(0x16d),'description':a0_0x2f5f5a(0x14d)},'progress':{'type':'number','description':a0_0x2f5f5a(0x140)}},'required':[a0_0x2f5f5a(0xea)]}},{'name':a0_0x2f5f5a(0x143),'description':a0_0x2f5f5a(0x162),'inputSchema':{'type':a0_0x2f5f5a(0xfc),'properties':{'alias':{'type':a0_0x2f5f5a(0x16d),'description':'Target\x20session\x20alias'},'task':{'type':'string','description':'Task\x20content'},'priority':{'type':a0_0x2f5f5a(0x16d),'enum':[a0_0x2f5f5a(0x136),a0_0x2f5f5a(0x150),a0_0x2f5f5a(0x13b)],'description':a0_0x2f5f5a(0x11c)}},'required':[a0_0x2f5f5a(0x110),a0_0x2f5f5a(0x13f)]}},{'name':a0_0x2f5f5a(0x13d),'description':a0_0x2f5f5a(0x15d),'inputSchema':{'type':a0_0x2f5f5a(0xfc),'properties':{'alias':{'type':a0_0x2f5f5a(0x16d),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x2f5f5a(0x16d),'description':a0_0x2f5f5a(0x12b)}},'required':['alias',a0_0x2f5f5a(0x14a)]}},{'name':a0_0x2f5f5a(0xfe),'description':a0_0x2f5f5a(0x14f),'inputSchema':{'type':a0_0x2f5f5a(0xfc),'properties':{}}}]}));async function P(_0x11eef4,_0x40a439){const _0x4b7160=a0_0x2f5f5a;let _0x28165d=await fetch(D+_0x4b7160(0x10e),{'method':_0x4b7160(0x155),'headers':{'Content-Type':_0x4b7160(0x113),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x4b7160(0xe9),'id':0x1,'method':_0x4b7160(0x151),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x4b7160(0x16e)}}})});if(!_0x28165d['ok']){let _0x4c4b9e=await _0x28165d[_0x4b7160(0x13e)]();return Y('CommHub\x20init\x20failed:\x20'+_0x28165d[_0x4b7160(0xea)]+'\x20'+_0x4c4b9e[_0x4b7160(0x164)](0x0,0x64)),{'ok':!0x1,'error':_0x4b7160(0x12e)+_0x28165d[_0x4b7160(0xea)]};}await _0x28165d['text']();let _0x399722=(await(await fetch(D+_0x4b7160(0x10e),{'method':_0x4b7160(0x155),'headers':{'Content-Type':_0x4b7160(0x113),'Accept':_0x4b7160(0x14c),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x4b7160(0x142)]({'jsonrpc':_0x4b7160(0xe9),'id':0x2,'method':'tools/call','params':{'name':_0x11eef4,'arguments':_0x40a439}})}))[_0x4b7160(0x13e)]())[_0x4b7160(0x153)]('\x0a')[_0x4b7160(0x15e)](_0x241679=>_0x241679[_0x4b7160(0x14b)](_0x4b7160(0x10c)));if(_0x399722){let _0x4fbb63=JSON[_0x4b7160(0xfd)](_0x399722['slice'](0x6));return _0x4fbb63?.[_0x4b7160(0xfb)]?.[_0x4b7160(0x11d)]?.[0x0]?.['text']?JSON[_0x4b7160(0xfd)](_0x4fbb63['result']['content'][0x0][_0x4b7160(0x13e)]):_0x4fbb63;}return{'ok':!0x1,'error':'no\x20response'};}K['setRequestHandler'](a0_0x4749f3,async _0x27e9d3=>{const _0x28d0e6=a0_0x2f5f5a;let {name:_0x5676ba,arguments:_0x23fe83}=_0x27e9d3['params'];if(_0x5676ba===_0x28d0e6(0x139)){let {task_id:_0x38a0f8,text:_0x3a2f62,status:_0x3dbbe1}=_0x23fe83;if(_0x3dbbe1===_0x28d0e6(0xee)||_0x3dbbe1===_0x28d0e6(0x112)||_0x3dbbe1===_0x28d0e6(0xef)){let _0x23555a=_0x3dbbe1===_0x28d0e6(0xee)?_0x28d0e6(0xf1):_0x3dbbe1,_0x209aef=_0x38a0f8?k[_0x28d0e6(0xf0)](_0x38a0f8)||_0x28d0e6(0x109):'hub',_0x393485=await P(_0x28d0e6(0x168),{'alias':_0x209aef,'text':_0x3a2f62,'in_reply_to':_0x38a0f8||void 0x0,'status':_0x23555a,'from_session':Z});if(_0x38a0f8)k['delete'](_0x38a0f8);return{'content':[{'type':_0x28d0e6(0x13e),'text':JSON[_0x28d0e6(0x142)](_0x393485)}]};}let _0x103db9=await P(_0x28d0e6(0x10d),{'resume_id':w,'alias':Z,'status':_0x3dbbe1===_0x28d0e6(0x16a)?'blocked':_0x3dbbe1===_0x28d0e6(0x166)?_0x28d0e6(0x166):_0x28d0e6(0xf3),'task':_0x3a2f62[_0x28d0e6(0x164)](0x0,0xc8),'output':_0x3a2f62});return{'content':[{'type':_0x28d0e6(0x13e),'text':JSON[_0x28d0e6(0x142)](_0x103db9)}]};}if(_0x5676ba===_0x28d0e6(0x137)){let {status:_0x43e630,task:_0x4e163a,progress:_0x2fc70b}=_0x23fe83,_0x1da0f2=await P(_0x28d0e6(0x10d),{'resume_id':w,'alias':Z,'status':_0x43e630,'task':_0x4e163a,'progress':_0x2fc70b});return{'content':[{'type':_0x28d0e6(0x13e),'text':JSON[_0x28d0e6(0x142)](_0x1da0f2)}]};}if(_0x5676ba==='commhub_send_task'){let {alias:_0x4d02c9,task:_0x344c33,priority:_0x1ad12e}=_0x23fe83,_0x17146f=await P(_0x28d0e6(0x12d),{'alias':_0x4d02c9,'task':_0x344c33,'priority':_0x1ad12e||'normal','from_session':Z});return{'content':[{'type':'text','text':JSON[_0x28d0e6(0x142)](_0x17146f)}]};}if(_0x5676ba==='commhub_send_message'){let {alias:_0x3132a0,message:_0x36cf44}=_0x23fe83,_0xa4056a=await P(_0x28d0e6(0x129),{'alias':_0x3132a0,'message':_0x36cf44,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x28d0e6(0x142)](_0xa4056a)}]};}if(_0x5676ba===_0x28d0e6(0xfe)){let _0x45ca04=await P(_0x28d0e6(0x15c),{});return{'content':[{'type':_0x28d0e6(0x13e),'text':JSON[_0x28d0e6(0x142)](_0x45ca04)}]};}return{'content':[{'type':_0x28d0e6(0x13e),'text':JSON[_0x28d0e6(0x142)]({'error':_0x28d0e6(0x165)})}]};});async function v(){const _0x45a9a4=a0_0x2f5f5a;let _0xa769d=D+_0x45a9a4(0x124)+encodeURIComponent(Z),_0x291a14={};if(X)_0x291a14['Authorization']=_0x45a9a4(0x15f)+X;Y(_0x45a9a4(0x13a)+_0xa769d);while(!0x0){try{let _0x1c8068=await fetch(_0xa769d,{'headers':_0x291a14});if(!_0x1c8068['ok']){Y('SSE\x20error:\x20'+_0x1c8068['status']+'\x20'+_0x1c8068['statusText']),await h(0x1388);continue;}let _0x584d76=_0x1c8068['body'][_0x45a9a4(0x130)](),_0x3ce61=new TextDecoder(),_0x31576d='';while(!0x0){let {done:_0x5c7ce1,value:_0x1ab236}=await _0x584d76[_0x45a9a4(0x16f)]();if(_0x5c7ce1)break;_0x31576d+=_0x3ce61[_0x45a9a4(0x125)](_0x1ab236,{'stream':!0x0});let _0x492b32=_0x31576d['split']('\x0a\x0a');_0x31576d=_0x492b32[_0x45a9a4(0x117)]()||'';for(let _0x278610 of _0x492b32){let _0x346fd9=_0x278610[_0x45a9a4(0x153)]('\x0a')[_0x45a9a4(0x15e)](_0xe5006a=>_0xe5006a[_0x45a9a4(0x14b)](_0x45a9a4(0x10c)));if(!_0x346fd9)continue;try{let _0xe4611e=JSON[_0x45a9a4(0xfd)](_0x346fd9[_0x45a9a4(0x164)](0x6));await u(_0xe4611e);}catch(_0x2d37ef){Y('parse\x20error:\x20'+_0x2d37ef);}}}Y(_0x45a9a4(0x141));}catch(_0x53e05a){Y(_0x45a9a4(0x149)+_0x53e05a);}await h(0xbb8);}}async function u(_0x182ff2){const _0x28fed7=a0_0x2f5f5a;if(_0x182ff2[_0x28fed7(0x126)]===_0x28fed7(0xeb)){Y(_0x28fed7(0x103)+Z+'\x22');return;}if(_0x182ff2[_0x28fed7(0x126)]===_0x28fed7(0x107)){if(Y(_0x28fed7(0x163)+_0x182ff2[_0x28fed7(0x12a)]+':\x20'+_0x182ff2['message'][_0x28fed7(0x164)](0x0,0x3c)),await K[_0x28fed7(0x11e)]({'method':_0x28fed7(0x13c),'params':{'content':_0x182ff2[_0x28fed7(0x14a)],'meta':{'sender':_0x182ff2[_0x28fed7(0x12a)]||_0x28fed7(0x109),'sender_id':'commhub','user':_0x182ff2[_0x28fed7(0x12a)]||'hub','priority':_0x28fed7(0x150)}}}),_0x182ff2[_0x28fed7(0x145)])await P(_0x28fed7(0x146),{'alias':Z,'message_id':_0x182ff2[_0x28fed7(0x145)]});return;}if(_0x182ff2[_0x28fed7(0x126)]===_0x28fed7(0x16b)||_0x182ff2[_0x28fed7(0x126)]==='broadcast'){Y('←\x20'+_0x182ff2['type']+_0x28fed7(0x11f)+_0x182ff2[_0x28fed7(0x12f)]+'\x20priority='+(_0x182ff2[_0x28fed7(0xf2)]||_0x28fed7(0x150)));let _0xc530cf=await P(_0x28fed7(0x12c),{'alias':Z,'limit':0x5});if(_0xc530cf?.['ok']&&_0xc530cf[_0x28fed7(0x170)]?.[_0x28fed7(0x119)]>0x0)for(let _0x54342c of _0xc530cf[_0x28fed7(0x170)]){let _0x31867e={'sender':_0x54342c['from_session']||_0x28fed7(0x109),'sender_id':'commhub','user':_0x54342c[_0x28fed7(0x133)]||_0x28fed7(0x109),'task_id':_0x54342c['id'],'priority':_0x54342c['priority']||_0x28fed7(0x150)};k[_0x28fed7(0xed)](_0x54342c['id'],_0x54342c[_0x28fed7(0x133)]||_0x28fed7(0x109)),await K[_0x28fed7(0x11e)]({'method':'notifications/claude/channel','params':{'content':_0x54342c[_0x28fed7(0x11d)],'meta':_0x31867e}}),Y(_0x28fed7(0x111)+_0x54342c['id'][_0x28fed7(0x164)](0x0,0x8)+'\x20from\x20'+_0x54342c[_0x28fed7(0x133)]+':\x20'+_0x54342c['content'][_0x28fed7(0x164)](0x0,0x3c)),await P(_0x28fed7(0x146),{'alias':Z,'message_id':_0x54342c['id']});}}}async function S(){const _0x31e9e1=a0_0x2f5f5a;let _0x4c185a=new a0_0xcb3d89();await K['connect'](_0x4c185a),Y('MCP\x20stdio\x20connected'),Y('starting\x20SSE\x20listener...'),v()['catch'](_0x4cea40=>Y(_0x31e9e1(0x102)+_0x4cea40)),P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x161551(),'hostname':a0_0x161551(),'agent':_0x31e9e1(0xf4),'project_dir':process[_0x31e9e1(0x120)](),'tmux_name':f||void 0x0})[_0x31e9e1(0x148)](()=>Y(_0x31e9e1(0xf6)+Z+_0x31e9e1(0x106)+w[_0x31e9e1(0x164)](0x0,0x8)+')'))['catch'](_0x1e1c55=>Y(_0x31e9e1(0x16c)+_0x1e1c55)),setInterval(()=>{const _0x307d27=_0x31e9e1;P(_0x307d27(0x10d),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x161551(),'hostname':a0_0x161551(),'agent':'claude-code','project_dir':process[_0x307d27(0x120)](),'tmux_name':f||void 0x0})[_0x307d27(0x15a)](_0x397eae=>Y('heartbeat\x20failed:\x20'+_0x397eae));},0x2bf20),Y(_0x31e9e1(0x128));}S()['catch'](_0x47063a=>{const _0x2a4064=a0_0x2f5f5a;Y('fatal:\x20'+_0x47063a),process[_0x2a4064(0x135)](0x1);});async function N(){const _0x549ad2=a0_0x2f5f5a;Y(_0x549ad2(0x100)),await P(_0x549ad2(0x10d),{'resume_id':w,'alias':Z,'status':'error','task':_0x549ad2(0xf9)})['catch'](()=>{}),process[_0x549ad2(0x135)](0x0);}process[a0_0x2f5f5a(0x115)]['on'](a0_0x2f5f5a(0x11b),()=>N()),process['on'](a0_0x2f5f5a(0x118),()=>N()),process['on'](a0_0x2f5f5a(0x159),()=>N());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.0.0-preview.19",
3
+ "version": "2.0.0-preview.20",
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",