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

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_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
+ const a0_0x4f84ce=a0_0x3ccc;(function(_0x5c8a58,_0x435d33){const _0x198e4c=a0_0x3ccc,_0x18eb97=_0x5c8a58();while(!![]){try{const _0x5458ee=parseInt(_0x198e4c(0x198))/0x1*(parseInt(_0x198e4c(0x165))/0x2)+-parseInt(_0x198e4c(0x1a1))/0x3+-parseInt(_0x198e4c(0x162))/0x4+parseInt(_0x198e4c(0x1b4))/0x5*(parseInt(_0x198e4c(0x170))/0x6)+-parseInt(_0x198e4c(0x16b))/0x7*(parseInt(_0x198e4c(0x197))/0x8)+-parseInt(_0x198e4c(0x18d))/0x9+parseInt(_0x198e4c(0x167))/0xa;if(_0x5458ee===_0x435d33)break;else _0x18eb97['push'](_0x18eb97['shift']());}catch(_0x305de1){_0x18eb97['push'](_0x18eb97['shift']());}}}(a0_0x204d,0x91113));import{EventEmitter as a0_0x1e08c0}from'events';import{hostname as a0_0x710d98}from'os';class T extends a0_0x1e08c0{[a0_0x4f84ce(0x190)];[a0_0x4f84ce(0x17c)];[a0_0x4f84ce(0x176)];[a0_0x4f84ce(0x1b6)];[a0_0x4f84ce(0x183)];[a0_0x4f84ce(0x1ab)];[a0_0x4f84ce(0x19a)];[a0_0x4f84ce(0x19e)];[a0_0x4f84ce(0x169)];[a0_0x4f84ce(0x182)]=!0x1;constructor(_0x474e0f){const _0x5c7c67=a0_0x4f84ce;super();if(this[_0x5c7c67(0x190)]=_0x474e0f[_0x5c7c67(0x190)]['replace'](/\/$/,''),this[_0x5c7c67(0x17c)]=_0x474e0f[_0x5c7c67(0x17c)],this[_0x5c7c67(0x176)]=_0x474e0f['token'],this[_0x5c7c67(0x1b6)]=_0x474e0f[_0x5c7c67(0x1b6)]||'sdk',this[_0x5c7c67(0x183)]=_0x5c7c67(0x192)+_0x474e0f[_0x5c7c67(0x17c)]+'-'+Date[_0x5c7c67(0x181)]()[_0x5c7c67(0x1ae)](0x24),this[_0x5c7c67(0x1ab)]=_0x474e0f['heartbeatInterval']??0x2bf20,this[_0x5c7c67(0x19a)]=_0x474e0f[_0x5c7c67(0x19a)]??0xbb8,_0x474e0f['autoConnect']!==!0x1)this[_0x5c7c67(0x1aa)]();}['log'](_0x1d521b){const _0xb56915=a0_0x4f84ce;console[_0xb56915(0x166)]('['+new Date()[_0xb56915(0x1b1)]()[_0xb56915(0x168)](0x0,0x8)+_0xb56915(0x1b0)+this[_0xb56915(0x17c)]+']\x20'+_0x1d521b);}async[a0_0x4f84ce(0x164)](_0x21e6a2,_0x2312a0){const _0x4b9476=a0_0x4f84ce;let _0x3a4c30={'Content-Type':_0x4b9476(0x18c),'Accept':'application/json,\x20text/event-stream'};if(this[_0x4b9476(0x176)])_0x3a4c30[_0x4b9476(0x174)]=_0x4b9476(0x1a4)+this[_0x4b9476(0x176)];let _0x2e544a=await(await fetch(this[_0x4b9476(0x190)]+_0x4b9476(0x1a5),{'method':_0x4b9476(0x177),'headers':_0x3a4c30,'body':JSON[_0x4b9476(0x196)]({'jsonrpc':_0x4b9476(0x1b5),'id':Date[_0x4b9476(0x181)](),'method':'tools/call','params':{'name':_0x21e6a2,'arguments':_0x2312a0}})}))[_0x4b9476(0x16f)](),_0x41a93d=_0x2e544a[_0x4b9476(0x191)](/data: (.+)/),_0x59479e=_0x41a93d?JSON[_0x4b9476(0x16d)](_0x41a93d[0x1]):JSON[_0x4b9476(0x16d)](_0x2e544a),_0x2a2951=_0x59479e?.[_0x4b9476(0x188)]?.[_0x4b9476(0x1ac)]?.[0x0]?.[_0x4b9476(0x16f)];return _0x2a2951?JSON['parse'](_0x2a2951):_0x59479e;}async['connect'](){const _0x350fa8=a0_0x4f84ce;if(this['running'])return;this[_0x350fa8(0x182)]=!0x0,await this[_0x350fa8(0x199)](_0x350fa8(0x1a3)),this['log']('registered'),this[_0x350fa8(0x19e)]=setInterval(()=>{const _0x52f9e0=_0x350fa8;this[_0x52f9e0(0x199)]('idle')[_0x52f9e0(0x18e)](_0x25ef04=>this[_0x52f9e0(0x166)](_0x52f9e0(0x17f)+_0x25ef04[_0x52f9e0(0x19b)]));},this['heartbeatInterval']),this[_0x350fa8(0x1b2)]();}async['disconnect'](){const _0x2f496f=a0_0x4f84ce;if(this['running']=!0x1,this['sseAbort']?.[_0x2f496f(0x195)](),this[_0x2f496f(0x19e)])clearInterval(this[_0x2f496f(0x19e)]);await this[_0x2f496f(0x199)]('offline')[_0x2f496f(0x18e)](()=>{}),this[_0x2f496f(0x166)]('disconnected');}async[a0_0x4f84ce(0x193)](_0x4f5b3f,_0x2af648,_0x15e079='normal'){const _0x2163af=a0_0x4f84ce;return this[_0x2163af(0x164)](_0x2163af(0x184),{'alias':_0x4f5b3f,'task':_0x2af648,'priority':_0x15e079,'from_session':this[_0x2163af(0x17c)]});}async[a0_0x4f84ce(0x19b)](_0x5a59d4,_0x1349d5){const _0x4d607b=a0_0x4f84ce;return this[_0x4d607b(0x164)]('send_message',{'alias':_0x5a59d4,'message':_0x1349d5,'from_session':this[_0x4d607b(0x17c)]});}async[a0_0x4f84ce(0x1a9)](_0x2086e5,_0x4136f4,_0x4da1a5=a0_0x4f84ce(0x1af)){return this['call']('send_reply',{'in_reply_to':_0x2086e5,'text':_0x4136f4,'status':_0x4da1a5});}async[a0_0x4f84ce(0x199)](_0x1df3f2,_0x557eb4){const _0x34118e=a0_0x4f84ce;return this[_0x34118e(0x164)](_0x34118e(0x18a),{'resume_id':this['resumeId'],'alias':this[_0x34118e(0x17c)],'status':_0x1df3f2,'server':a0_0x710d98(),'hostname':a0_0x710d98(),'agent':this[_0x34118e(0x1b6)],'project_dir':process[_0x34118e(0x19c)](),..._0x557eb4});}async[a0_0x4f84ce(0x17e)](){const _0x5e7bb7=a0_0x4f84ce;return this[_0x5e7bb7(0x164)](_0x5e7bb7(0x16c),{});}async[a0_0x4f84ce(0x17d)](_0x50d251,_0x5bf452){const _0x5cd78c=a0_0x4f84ce;return this[_0x5cd78c(0x164)](_0x5cd78c(0x17d),{'message':_0x50d251,'filter_server':_0x5bf452?.['server'],'filter_status':_0x5bf452?.[_0x5cd78c(0x199)]});}async[a0_0x4f84ce(0x1b2)](){const _0x3da8a1=a0_0x4f84ce;let _0x31208b=encodeURIComponent(this[_0x3da8a1(0x17c)]),_0x15d2a5=this[_0x3da8a1(0x190)]+'/events/'+_0x31208b,_0x48de50=this[_0x3da8a1(0x19a)];while(this[_0x3da8a1(0x182)]){try{this[_0x3da8a1(0x169)]=new AbortController();let _0x20607e={'Accept':_0x3da8a1(0x16e)};if(this[_0x3da8a1(0x176)])_0x20607e['Authorization']=_0x3da8a1(0x1a4)+this[_0x3da8a1(0x176)];let _0x200df8=await fetch(_0x15d2a5,{'headers':_0x20607e,'signal':this[_0x3da8a1(0x169)][_0x3da8a1(0x185)]});if(!_0x200df8['ok']||!_0x200df8[_0x3da8a1(0x19f)]){this[_0x3da8a1(0x166)](_0x3da8a1(0x178)+_0x200df8[_0x3da8a1(0x199)]),await this[_0x3da8a1(0x1a6)](_0x48de50),_0x48de50=Math['min'](_0x48de50*1.5,0xea60);continue;}_0x48de50=this[_0x3da8a1(0x19a)];let _0x2154f0=_0x200df8[_0x3da8a1(0x19f)][_0x3da8a1(0x187)](),_0x3c1348=new TextDecoder(),_0x18ac01='';while(this[_0x3da8a1(0x182)]){let {done:_0x890003,value:_0x242d7b}=await _0x2154f0[_0x3da8a1(0x175)]();if(_0x890003)break;_0x18ac01+=_0x3c1348[_0x3da8a1(0x1ad)](_0x242d7b,{'stream':!0x0});let _0x2425e9=_0x18ac01[_0x3da8a1(0x173)]('\x0a');_0x18ac01=_0x2425e9[_0x3da8a1(0x18f)]()||'';for(let _0x1545aa of _0x2425e9){if(!_0x1545aa[_0x3da8a1(0x17a)]('data:\x20'))continue;try{let _0x4cc2b8=JSON[_0x3da8a1(0x16d)](_0x1545aa['slice'](0x6));if(_0x4cc2b8[_0x3da8a1(0x194)]===_0x3da8a1(0x17b)){this[_0x3da8a1(0x166)](_0x3da8a1(0x19d)),this[_0x3da8a1(0x18b)]('connected');continue;}if(_0x4cc2b8[_0x3da8a1(0x194)]==='new_task'||_0x4cc2b8[_0x3da8a1(0x194)]===_0x3da8a1(0x180)||_0x4cc2b8['type']===_0x3da8a1(0x17d))await this['processInbox']();}catch{}}}}catch(_0x1b750a){if(_0x1b750a['name']==='AbortError')break;this[_0x3da8a1(0x18b)](_0x3da8a1(0x172),_0x1b750a),this[_0x3da8a1(0x166)](_0x3da8a1(0x171)+_0x1b750a[_0x3da8a1(0x19b)]);}if(this['running'])this[_0x3da8a1(0x18b)](_0x3da8a1(0x161)),this[_0x3da8a1(0x166)](_0x3da8a1(0x1a8)+_0x48de50/0x3e8+_0x3da8a1(0x163)),await this[_0x3da8a1(0x1a6)](_0x48de50),_0x48de50=Math[_0x3da8a1(0x1a0)](_0x48de50*1.5,0xea60);}}async[a0_0x4f84ce(0x179)](){const _0x35f35b=a0_0x4f84ce;try{let _0x35c67c=(await this[_0x35f35b(0x164)](_0x35f35b(0x1b3),{'alias':this['alias'],'limit':0xa}))?.[_0x35f35b(0x1a7)]||[];for(let _0x3fb202 of _0x35c67c)await this['call'](_0x35f35b(0x1a2),{'alias':this[_0x35f35b(0x17c)],'message_id':_0x3fb202['id']}),this[_0x35f35b(0x166)]('←\x20'+_0x3fb202[_0x35f35b(0x189)]+':\x20'+_0x3fb202[_0x35f35b(0x1ac)][_0x35f35b(0x168)](0x0,0x3c)),this[_0x35f35b(0x18b)](_0x35f35b(0x186),_0x3fb202),this[_0x35f35b(0x18b)](_0x35f35b(0x19b),_0x3fb202);}catch(_0x4a8952){this['log'](_0x35f35b(0x16a)+_0x4a8952[_0x35f35b(0x19b)]);}}['sleep'](_0x504db0){return new Promise(_0x51af75=>setTimeout(_0x51af75,_0x504db0));}}var $=T;function a0_0x3ccc(_0x285656,_0x3272f6){_0x285656=_0x285656-0x161;const _0x204d7e=a0_0x204d();let _0x3ccc51=_0x204d7e[_0x285656];return _0x3ccc51;}function a0_0x204d(){const _0x173447=['reconnectDelay','message','cwd','SSE\x20connected','heartbeatTimer','body','min','3055989izmwdL','ack_inbox','idle','Bearer\x20','/mcp','sleep','messages','SSE\x20reconnecting\x20in\x20','reply','connect','heartbeatInterval','content','decode','toString','completed',']\x20[commhub:','toTimeString','connectSSE','get_inbox','25NlUckt','2.0','agent','disconnected','796056YbQAcc','s...','call','58dkuiir','log','23816670gygHdW','slice','sseAbort','inbox\x20error:\x20','172550eAzOGe','get_all_status','parse','text/event-stream','text','622176JmgNyT','SSE\x20error:\x20','error','split','Authorization','read','token','POST','SSE\x20failed:\x20','processInbox','startsWith','connected','alias','broadcast','getAllStatus','heartbeat\x20failed:\x20','new_message','now','running','resumeId','send_task','signal','task','getReader','result','from_session','report_status','emit','application/json','8326089ZZaMdS','catch','pop','url','match','sdk-','send','type','abort','stringify','208GpqTuG','16474uCgQya','status'];a0_0x204d=function(){return _0x173447;};return a0_0x204d();}export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
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());
2
+ const a0_0x4e5b9b=a0_0x44b6;(function(_0x178274,_0x4af529){const _0x27ac52=a0_0x44b6,_0x116800=_0x178274();while(!![]){try{const _0x282743=-parseInt(_0x27ac52(0x219))/0x1*(-parseInt(_0x27ac52(0x1e8))/0x2)+parseInt(_0x27ac52(0x20f))/0x3*(-parseInt(_0x27ac52(0x1dc))/0x4)+parseInt(_0x27ac52(0x1cf))/0x5*(-parseInt(_0x27ac52(0x1f2))/0x6)+-parseInt(_0x27ac52(0x21b))/0x7*(-parseInt(_0x27ac52(0x208))/0x8)+-parseInt(_0x27ac52(0x1dd))/0x9*(parseInt(_0x27ac52(0x26a))/0xa)+-parseInt(_0x27ac52(0x256))/0xb+-parseInt(_0x27ac52(0x24e))/0xc*(-parseInt(_0x27ac52(0x245))/0xd);if(_0x282743===_0x4af529)break;else _0x116800['push'](_0x116800['shift']());}catch(_0x438bce){_0x116800['push'](_0x116800['shift']());}}}(a0_0x4610,0xd7149));import{readFileSync as a0_0x3780b2,existsSync as a0_0x4630bf}from'fs';import{randomUUID as a0_0x2a66ba}from'crypto';import{join as a0_0x5d4dab}from'path';import{hostname as a0_0x2b25b4}from'os';import{execSync as a0_0x3b8f3c}from'child_process';import{Server as a0_0x500049}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x394e6c}from'@modelcontextprotocol/sdk/server/stdio.js';function a0_0x44b6(_0x97c757,_0x2a1196){_0x97c757=_0x97c757-0x1ce;const _0x461032=a0_0x4610();let _0x44b698=_0x461032[_0x97c757];return _0x44b698;}import{ListToolsRequestSchema as a0_0x1558fa,CallToolRequestSchema as a0_0x2f3eba}from'@modelcontextprotocol/sdk/types.js';function p(_0x4e64ef){const _0x49769f=a0_0x44b6;if(!a0_0x4630bf(_0x4e64ef))return;for(let _0xb37586 of a0_0x3780b2(_0x4e64ef,'utf-8')['split']('\x0a')){let _0x153414=_0xb37586[_0x49769f(0x1ea)]();if(!_0x153414||_0x153414['startsWith']('#'))continue;let _0x124f19=_0x153414[_0x49769f(0x238)]('=');if(_0x124f19<0x0)continue;let _0x491b48=_0x153414[_0x49769f(0x248)](0x0,_0x124f19)[_0x49769f(0x1ea)](),_0x4ca722=_0x153414[_0x49769f(0x248)](_0x124f19+0x1)['trim']()[_0x49769f(0x255)](/^["']|["']$/g,'');if(!process.env[_0x491b48])process.env[_0x491b48]=_0x4ca722;}}var T=process.env.HOME||'~',C=a0_0x5d4dab(T,a0_0x4e5b9b(0x264));p(a0_0x5d4dab(C,'.env'));var L=process['cwd']()[a0_0x4e5b9b(0x255)](/\//g,'-');p(a0_0x5d4dab(C,L,a0_0x4e5b9b(0x1f5)));function U(){const _0x5c183e=a0_0x4e5b9b;try{return a0_0x3b8f3c(_0x5c183e(0x216),{'encoding':'utf-8','timeout':0x7d0})['trim']();}catch{return'';}}function c(){const _0x526158=a0_0x4e5b9b;try{let _0x555cdb=a0_0x5d4dab(T,_0x526158(0x1e5),_0x526158(0x1fc));if(a0_0x4630bf(_0x555cdb))return JSON['parse'](a0_0x3780b2(_0x555cdb,'utf-8'));}catch{}return{};}var I=c(),f=process.env.COMMHUB_URL||I[a0_0x4e5b9b(0x246)]||'http://127.0.0.1:9200',x=process.env.COMMHUB_TMUX||U(),G=process.env.COMMHUB_ALIAS||x||a0_0x2b25b4(),X=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x2a66ba(),F=process.env.COMMHUB_TOKEN||I[a0_0x4e5b9b(0x22e)]||'';function Z(_0x476796){const _0x81e3e=a0_0x4e5b9b;let _0x55ba8b=new Date()[_0x81e3e(0x250)]()['slice'](0x0,0x8);process[_0x81e3e(0x224)][_0x81e3e(0x1d3)]('['+_0x55ba8b+']\x20[commhub]\x20'+_0x476796+'\x0a');}function O(_0x2ff118){return new Promise(_0x19067f=>setTimeout(_0x19067f,_0x2ff118));}Z(a0_0x4e5b9b(0x266)+f+a0_0x4e5b9b(0x237)+G+a0_0x4e5b9b(0x225)+X[a0_0x4e5b9b(0x248)](0x0,0x8)+a0_0x4e5b9b(0x241)+(x||a0_0x4e5b9b(0x211))+a0_0x4e5b9b(0x230)+process[a0_0x4e5b9b(0x24d)]()+a0_0x4e5b9b(0x267)+L);var N=new Map(),y=new a0_0x500049({'name':'commhub-channel','version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x4e5b9b(0x1fd),a0_0x4e5b9b(0x253),a0_0x4e5b9b(0x1d6),a0_0x4e5b9b(0x1e3),a0_0x4e5b9b(0x269)+G][a0_0x4e5b9b(0x254)]('\x0a')});y['setRequestHandler'](a0_0x1558fa,async()=>({'tools':[{'name':a0_0x4e5b9b(0x26c),'description':a0_0x4e5b9b(0x26e),'inputSchema':{'type':a0_0x4e5b9b(0x261),'properties':{'task_id':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x1db)},'text':{'type':'string','description':a0_0x4e5b9b(0x1da)},'status':{'type':a0_0x4e5b9b(0x1e2),'enum':['completed',a0_0x4e5b9b(0x1ff),a0_0x4e5b9b(0x23d),a0_0x4e5b9b(0x243),'error','in_progress'],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x4e5b9b(0x1f0)]}},{'name':'commhub_report_status','description':a0_0x4e5b9b(0x23e),'inputSchema':{'type':a0_0x4e5b9b(0x261),'properties':{'status':{'type':a0_0x4e5b9b(0x1e2),'enum':[a0_0x4e5b9b(0x21e),'idle',a0_0x4e5b9b(0x243),a0_0x4e5b9b(0x249)]},'task':{'type':a0_0x4e5b9b(0x1e2),'description':'Current\x20task\x20description'},'progress':{'type':'number','description':a0_0x4e5b9b(0x26b)}},'required':[a0_0x4e5b9b(0x262)]}},{'name':a0_0x4e5b9b(0x252),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x4e5b9b(0x261),'properties':{'alias':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x209)},'task':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x259)},'priority':{'type':'string','enum':['high',a0_0x4e5b9b(0x232),a0_0x4e5b9b(0x1d4)],'description':'Priority\x20(default:\x20normal)'},'parent_task_id':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x240)},'ttl_seconds':{'type':'number','description':a0_0x4e5b9b(0x1d8)},'context':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x1ed)},'meta':{'type':'object','description':a0_0x4e5b9b(0x1ce)}},'required':[a0_0x4e5b9b(0x25b),a0_0x4e5b9b(0x22b)]}},{'name':'commhub_send_message','description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x4e5b9b(0x261),'properties':{'alias':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x209)},'message':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x25a)}},'required':[a0_0x4e5b9b(0x25b),a0_0x4e5b9b(0x244)]}},{'name':a0_0x4e5b9b(0x1f8),'description':a0_0x4e5b9b(0x1f4),'inputSchema':{'type':a0_0x4e5b9b(0x261),'properties':{}}},{'name':a0_0x4e5b9b(0x1e9),'description':a0_0x4e5b9b(0x1eb),'inputSchema':{'type':a0_0x4e5b9b(0x261),'properties':{'alias':{'type':a0_0x4e5b9b(0x1e2),'description':'Session\x20alias'}},'required':[a0_0x4e5b9b(0x25b)]}},{'name':a0_0x4e5b9b(0x1d5),'description':'Get\x20task\x20details\x20by\x20task_id.\x20Poll\x20this\x20until\x20status\x20is\x20replied\x20or\x20failed.','inputSchema':{'type':'object','properties':{'task_id':{'type':'string','description':a0_0x4e5b9b(0x25f)}},'required':['task_id']}},{'name':a0_0x4e5b9b(0x1f7),'description':a0_0x4e5b9b(0x202),'inputSchema':{'type':'object','properties':{'to_name':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x1ec)},'from_name':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x24a)},'status':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x24b)},'limit':{'type':a0_0x4e5b9b(0x1fb),'description':a0_0x4e5b9b(0x1e4)}}}}]}));async function P(_0x2c178f,_0x3a43b7){const _0x34add9=a0_0x4e5b9b;let _0xea864b=await fetch(f+_0x34add9(0x1d9),{'method':_0x34add9(0x207),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...F?{'Authorization':'Bearer\x20'+F}:{}},'body':JSON[_0x34add9(0x25e)]({'jsonrpc':_0x34add9(0x22d),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x34add9(0x222),'capabilities':{},'clientInfo':{'name':_0x34add9(0x1fe),'version':_0x34add9(0x1fa)}}})});if(!_0xea864b['ok']){let _0x2692f1=await _0xea864b[_0x34add9(0x1f0)]();return Z('CommHub\x20init\x20failed:\x20'+_0xea864b[_0x34add9(0x262)]+'\x20'+_0x2692f1[_0x34add9(0x248)](0x0,0x64)),{'ok':!0x1,'error':_0x34add9(0x22c)+_0xea864b[_0x34add9(0x262)]};}await _0xea864b[_0x34add9(0x1f0)]();let _0x16bba8=(await(await fetch(f+'/mcp',{'method':_0x34add9(0x207),'headers':{'Content-Type':'application/json','Accept':_0x34add9(0x214),...F?{'Authorization':_0x34add9(0x20c)+F}:{}},'body':JSON[_0x34add9(0x25e)]({'jsonrpc':_0x34add9(0x22d),'id':0x2,'method':_0x34add9(0x235),'params':{'name':_0x2c178f,'arguments':_0x3a43b7}})}))[_0x34add9(0x1f0)]())[_0x34add9(0x226)]('\x0a')[_0x34add9(0x1de)](_0x2efc08=>_0x2efc08[_0x34add9(0x220)](_0x34add9(0x218)));if(_0x16bba8){let _0x377bcb=JSON[_0x34add9(0x21a)](_0x16bba8[_0x34add9(0x248)](0x6));return _0x377bcb?.[_0x34add9(0x1f6)]?.['content']?.[0x0]?.['text']?JSON[_0x34add9(0x21a)](_0x377bcb[_0x34add9(0x1f6)][_0x34add9(0x233)][0x0][_0x34add9(0x1f0)]):_0x377bcb;}return{'ok':!0x1,'error':_0x34add9(0x1f9)};}y[a0_0x4e5b9b(0x22f)](a0_0x2f3eba,async _0x5514c7=>{const _0x238543=a0_0x4e5b9b;let {name:_0x1815b5,arguments:_0xa4d5fb}=_0x5514c7['params'];if(_0x1815b5===_0x238543(0x26c)){let {task_id:_0x2b50c4,text:_0x283f0a,status:_0x5863dc}=_0xa4d5fb;if(_0x5863dc===_0x238543(0x20d)||_0x5863dc===_0x238543(0x1ff)||_0x5863dc===_0x238543(0x23d)){let _0x312d7e=_0x5863dc==='completed'?_0x238543(0x210):_0x5863dc,_0x41d1dc=_0x2b50c4?N[_0x238543(0x229)](_0x2b50c4)||_0x238543(0x246):_0x238543(0x246),_0x89bb2d=await P(_0x238543(0x20e),{'alias':_0x41d1dc,'text':_0x283f0a,'in_reply_to':_0x2b50c4||void 0x0,'status':_0x312d7e,'from_session':G});if(_0x2b50c4)N[_0x238543(0x23c)](_0x2b50c4);return{'content':[{'type':'text','text':JSON['stringify'](_0x89bb2d)}]};}let _0x4293cf=await P(_0x238543(0x204),{'resume_id':X,'alias':G,'status':_0x5863dc===_0x238543(0x243)?_0x238543(0x243):_0x5863dc===_0x238543(0x249)?_0x238543(0x249):'working','task':_0x283f0a[_0x238543(0x248)](0x0,0xc8),'output':_0x283f0a});return{'content':[{'type':_0x238543(0x1f0),'text':JSON['stringify'](_0x4293cf)}]};}if(_0x1815b5===_0x238543(0x265)){let {status:_0x5738f0,task:_0x50952c,progress:_0x1ced98}=_0xa4d5fb,_0x5ef014=await P(_0x238543(0x204),{'resume_id':X,'alias':G,'status':_0x5738f0,'task':_0x50952c,'progress':_0x1ced98});return{'content':[{'type':_0x238543(0x1f0),'text':JSON[_0x238543(0x25e)](_0x5ef014)}]};}if(_0x1815b5==='commhub_send_task'){let {alias:_0x587271,task:_0x1f4639,priority:_0x55b462,parent_task_id:_0x3692ae,ttl_seconds:_0xe32cfa,context:_0x206677,meta:_0x2a6cb8}=_0xa4d5fb,_0x4edf02=await P(_0x238543(0x206),{'alias':_0x587271,'task':_0x1f4639,'priority':_0x55b462||_0x238543(0x232),'parent_task_id':_0x3692ae,'ttl_seconds':_0xe32cfa,'context':_0x206677,'meta':_0x2a6cb8,'from_session':G});return{'content':[{'type':_0x238543(0x1f0),'text':JSON[_0x238543(0x25e)](_0x4edf02)}]};}if(_0x1815b5===_0x238543(0x21f)){let {alias:_0x5717f7,message:_0x361450}=_0xa4d5fb,_0x561e4b=await P('send_message',{'alias':_0x5717f7,'message':_0x361450,'from_session':G});return{'content':[{'type':_0x238543(0x1f0),'text':JSON[_0x238543(0x25e)](_0x561e4b)}]};}if(_0x1815b5===_0x238543(0x1f8)){let _0x2c1b9e=await P(_0x238543(0x231),{});return{'content':[{'type':'text','text':JSON[_0x238543(0x25e)](_0x2c1b9e)}]};}if(_0x1815b5===_0x238543(0x1e9)){let {alias:_0x1875e7}=_0xa4d5fb,_0x31e407=await P(_0x238543(0x221),{'alias':_0x1875e7});return{'content':[{'type':_0x238543(0x1f0),'text':JSON['stringify'](_0x31e407)}]};}if(_0x1815b5===_0x238543(0x1d5)){let {task_id:_0x5d7d4c}=_0xa4d5fb,_0x3b53cf=await P(_0x238543(0x234),{'task_id':_0x5d7d4c});return{'content':[{'type':_0x238543(0x1f0),'text':JSON[_0x238543(0x25e)](_0x3b53cf)}]};}if(_0x1815b5===_0x238543(0x1f7)){let {to_name:_0x4052dd,from_name:_0x2924cd,status:_0x2e5b10,limit:_0x14fe7a}=_0xa4d5fb,_0x12e6e0=await P(_0x238543(0x203),{'to_name':_0x4052dd,'from_name':_0x2924cd,'status':_0x2e5b10,'limit':_0x14fe7a});return{'content':[{'type':_0x238543(0x1f0),'text':JSON[_0x238543(0x25e)](_0x12e6e0)}]};}return{'content':[{'type':_0x238543(0x1f0),'text':JSON['stringify']({'error':_0x238543(0x258)})}]};});async function S(){const _0x5ef33c=a0_0x4e5b9b;let _0x2c50b3=f+'/events/'+encodeURIComponent(G),_0x10c076={};if(F)_0x10c076[_0x5ef33c(0x1df)]=_0x5ef33c(0x20c)+F;Z(_0x5ef33c(0x23b)+_0x2c50b3);while(!0x0){try{let _0x239f2c=await fetch(_0x2c50b3,{'headers':_0x10c076});if(!_0x239f2c['ok']){Z('SSE\x20error:\x20'+_0x239f2c[_0x5ef33c(0x262)]+'\x20'+_0x239f2c['statusText']),await O(0x1388);continue;}let _0x35ce96=_0x239f2c[_0x5ef33c(0x1ef)][_0x5ef33c(0x1d2)](),_0x50196f=new TextDecoder(),_0x23d922='';while(!0x0){let {done:_0x160b82,value:_0x498a9c}=await _0x35ce96[_0x5ef33c(0x236)]();if(_0x160b82)break;_0x23d922+=_0x50196f[_0x5ef33c(0x213)](_0x498a9c,{'stream':!0x0});let _0x153ae4=_0x23d922[_0x5ef33c(0x226)]('\x0a\x0a');_0x23d922=_0x153ae4['pop']()||'';for(let _0xd95c65 of _0x153ae4){let _0x3ff8ce=_0xd95c65[_0x5ef33c(0x226)]('\x0a')[_0x5ef33c(0x1de)](_0x1db378=>_0x1db378['startsWith'](_0x5ef33c(0x218)));if(!_0x3ff8ce)continue;try{let _0x2263ee=JSON[_0x5ef33c(0x21a)](_0x3ff8ce[_0x5ef33c(0x248)](0x6));await A(_0x2263ee);}catch(_0x1f9169){Z(_0x5ef33c(0x242)+_0x1f9169);}}}Z('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x4b96eb){Z(_0x5ef33c(0x25c)+_0x4b96eb);}await O(0xbb8);}}async function A(_0x5e1a90){const _0x1cdbd7=a0_0x4e5b9b;if(_0x5e1a90['type']===_0x1cdbd7(0x228)){Z(_0x1cdbd7(0x268)+G+'\x22');return;}if(_0x5e1a90['type']===_0x1cdbd7(0x1ee)){if(Z(_0x1cdbd7(0x25d)+_0x5e1a90['from']+':\x20'+_0x5e1a90[_0x1cdbd7(0x244)][_0x1cdbd7(0x248)](0x0,0x3c)),await y['notification']({'method':'notifications/claude/channel','params':{'content':_0x5e1a90[_0x1cdbd7(0x244)],'meta':{'sender':_0x5e1a90[_0x1cdbd7(0x200)]||'hub','sender_id':'commhub','user':_0x5e1a90['from']||_0x1cdbd7(0x246),'priority':_0x1cdbd7(0x232)}}}),_0x5e1a90['message_id'])await P(_0x1cdbd7(0x1e0),{'alias':G,'message_id':_0x5e1a90['message_id']});return;}if(_0x5e1a90[_0x1cdbd7(0x24f)]===_0x1cdbd7(0x212)||_0x5e1a90[_0x1cdbd7(0x24f)]==='broadcast'){Z('←\x20'+_0x5e1a90[_0x1cdbd7(0x24f)]+_0x1cdbd7(0x1d1)+_0x5e1a90[_0x1cdbd7(0x251)]+_0x1cdbd7(0x1d0)+(_0x5e1a90[_0x1cdbd7(0x1f1)]||_0x1cdbd7(0x232)));let _0x5a891f=await P(_0x1cdbd7(0x24c),{'alias':G,'limit':0x5});if(_0x5a891f?.['ok']&&_0x5a891f[_0x1cdbd7(0x1e6)]?.[_0x1cdbd7(0x257)]>0x0)for(let _0x37d7bc of _0x5a891f[_0x1cdbd7(0x1e6)]){let _0x236012={'sender':_0x37d7bc[_0x1cdbd7(0x23a)]||_0x1cdbd7(0x246),'sender_id':_0x1cdbd7(0x263),'user':_0x37d7bc[_0x1cdbd7(0x23a)]||_0x1cdbd7(0x246),'task_id':_0x37d7bc['id'],'priority':_0x37d7bc[_0x1cdbd7(0x1f1)]||_0x1cdbd7(0x232)};N[_0x1cdbd7(0x20a)](_0x37d7bc['id'],_0x37d7bc[_0x1cdbd7(0x23a)]||_0x1cdbd7(0x246)),await y[_0x1cdbd7(0x26f)]({'method':'notifications/claude/channel','params':{'content':_0x37d7bc['content'],'meta':_0x236012}}),Z('→\x20injected\x20task\x20'+_0x37d7bc['id'][_0x1cdbd7(0x248)](0x0,0x8)+_0x1cdbd7(0x1d7)+_0x37d7bc['from_session']+':\x20'+_0x37d7bc[_0x1cdbd7(0x233)][_0x1cdbd7(0x248)](0x0,0x3c)),await P(_0x1cdbd7(0x1e0),{'alias':G,'message_id':_0x37d7bc['id']});}}}async function u(){const _0x475e2b=a0_0x4e5b9b;let _0x1c2402=new a0_0x394e6c();await y[_0x475e2b(0x21d)](_0x1c2402),Z(_0x475e2b(0x227)),Z(_0x475e2b(0x260)),S()[_0x475e2b(0x217)](_0xc773eb=>Z('SSE\x20fatal:\x20'+_0xc773eb)),P(_0x475e2b(0x204),{'resume_id':X,'alias':G,'status':'idle','server':a0_0x2b25b4(),'hostname':a0_0x2b25b4(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':x||void 0x0})[_0x475e2b(0x201)](()=>Z(_0x475e2b(0x223)+G+_0x475e2b(0x215)+X[_0x475e2b(0x248)](0x0,0x8)+')'))[_0x475e2b(0x217)](_0x3b6049=>Z(_0x475e2b(0x22a)+_0x3b6049)),setInterval(()=>{const _0x499611=_0x475e2b;P('report_status',{'resume_id':X,'alias':G,'status':_0x499611(0x21c),'server':a0_0x2b25b4(),'hostname':a0_0x2b25b4(),'agent':_0x499611(0x239),'project_dir':process[_0x499611(0x24d)](),'tmux_name':x||void 0x0})['catch'](_0x14dd3d=>Z('heartbeat\x20failed:\x20'+_0x14dd3d));},0x2bf20),Z('ready\x20—\x20waiting\x20for\x20events');}u()[a0_0x4e5b9b(0x217)](_0x3e066f=>{const _0x2703cb=a0_0x4e5b9b;Z(_0x2703cb(0x1f3)+_0x3e066f),process['exit'](0x1);});async function h(){const _0x4cc68f=a0_0x4e5b9b;Z(_0x4cc68f(0x1e1)),await P(_0x4cc68f(0x204),{'resume_id':X,'alias':G,'status':_0x4cc68f(0x26d),'task':_0x4cc68f(0x1e7)})['catch'](()=>{}),process[_0x4cc68f(0x205)](0x0);}process[a0_0x4e5b9b(0x20b)]['on'](a0_0x4e5b9b(0x247),()=>h()),process['on'](a0_0x4e5b9b(0x23f),()=>h()),process['on']('SIGINT',()=>h());function a0_0x4610(){const _0x2b51b5=['parse','14546QpErKe','idle','connect','working','commhub_send_message','startsWith','get_session_status','2025-03-26','registered\x20as\x20\x22','stderr','\x20RESUME_ID=','split','MCP\x20stdio\x20connected','connected','get','warning:\x20could\x20not\x20register:\x20','task','init\x20failed:\x20','2.0','token','setRequestHandler','\x20CWD=','get_all_status','normal','content','get_task','tools/call','read','\x20ALIAS=','indexOf','claude-code','from_session','connecting\x20to\x20','delete','cancelled','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','SIGTERM','Parent\x20task\x20id\x20for\x20auto-chaining\x20child\x20replies','...\x20TMUX=','parse\x20error:\x20','blocked','message','13NSqLwa','hub','end','slice','error','Filter\x20by\x20sender\x20alias','Filter\x20by\x20status','get_inbox','cwd','46887396Drkstd','type','toTimeString','inbox_count','commhub_send_task','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','join','replace','17463974nRjZlr','length','unknown\x20tool','Task\x20content','Message\x20content','alias','SSE\x20connection\x20error:\x20','←\x20message\x20from\x20','stringify','Task\x20id','starting\x20SSE\x20listener...','object','status','commhub','.claude/channels/commhub','commhub_report_status','ENV:\x20URL=','\x20PROJECT_ENV=','SSE\x20connected\x20as\x20\x22','Session\x20alias:\x20','7318960CxPBLc','Progress\x200-100','commhub_reply','offline','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','notification','Optional\x20structured\x20metadata','535GMfmKu','\x20priority=',':\x20inbox_count=','getReader','write','low','commhub_get_task','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','\x20from\x20','Task\x20TTL\x20in\x20seconds','/mcp','Reply\x20text\x20/\x20result\x20summary','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','871936aiSyjJ','9ZovMsh','find','Authorization','ack_inbox','shutting\x20down,\x20reporting\x20offline...','string','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Max\x20rows','.anet','messages','session\x20disconnected','1255366nWQkDz','commhub_get_session_status','trim','Get\x20detailed\x20status\x20for\x20a\x20session\x20alias.','Filter\x20by\x20recipient\x20alias','Optional\x20context','new_message','body','text','priority','57258jYPjPG','fatal:\x20','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','.env','result','commhub_list_tasks','commhub_get_all_status','no\x20response','0.3.0','number','config.json','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','commhub-channel','failed','from','then','List\x20tasks\x20with\x20optional\x20filters.','list_tasks','report_status','exit','send_task','POST','472SftnFH','Target\x20session\x20alias','set','stdin','Bearer\x20','completed','send_reply','6bhpWAo','replied','none','new_task','decode','application/json,\x20text/event-stream','\x22\x20(','tmux\x20display-message\x20-p\x20\x27#S\x27','catch','data:\x20','1ynYlop'];a0_0x4610=function(){return _0x2b51b5;};return a0_0x4610();}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.2.8-preview.1",
3
+ "version": "2.2.8",
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",