@sleep2agi/agent-network 2.0.0-preview.6 → 2.0.0-preview.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
- function a0_0x2bc2(){const _0x467141=['log','SSE\x20reconnecting\x20in\x20','now','status','url','connect','offline','messages','send_task','toString','27FQlmba','report_status','/mcp','type','567vTDcAj','task','registered','signal','stringify','/events/','running','2514170OxYSpC','2.0','24QPdcUS','new_message','sdk-','reply','content','heartbeatInterval','reconnectDelay',']\x20[commhub:','4824jQGDGi','connectSSE','parse','autoConnect','message','emit','slice','50414zDmaZd','completed','decode','Authorization','getReader','send','2747965AWhGMM','587562vQcLKk','SSE\x20connected','text/event-stream','heartbeat\x20failed:\x20','catch','ack_inbox','sseAbort','SSE\x20failed:\x20','token','startsWith','normal','processInbox','inbox\x20error:\x20','send_message','from_session','get_all_status','SSE\x20error:\x20','broadcast','get_inbox','4026sNvObD','name','idle','sleep','1wuyDsR','s...','application/json','new_task','call','POST','body','11068GFdXyg','tools/call','Bearer\x20','1336616iaFVNM','match','split','agent','disconnect','getAllStatus','text','resumeId','replace','read','data:\x20','heartbeatTimer','toTimeString','cwd','connected','alias','AbortError','disconnected','min'];a0_0x2bc2=function(){return _0x467141;};return a0_0x2bc2();}const a0_0x151ed8=a0_0x149a;(function(_0x522ac3,_0x48c33f){const _0x48c642=a0_0x149a,_0x4f9978=_0x522ac3();while(!![]){try{const _0x337993=parseInt(_0x48c642(0xee))/0x1*(-parseInt(_0x48c642(0xd7))/0x2)+parseInt(_0x48c642(0xb8))/0x3*(-parseInt(_0x48c642(0xf5))/0x4)+parseInt(_0x48c642(0xd6))/0x5+-parseInt(_0x48c642(0xc1))/0x6*(parseInt(_0x48c642(0xd0))/0x7)+-parseInt(_0x48c642(0xf8))/0x8*(-parseInt(_0x48c642(0xb4))/0x9)+parseInt(_0x48c642(0xbf))/0xa+-parseInt(_0x48c642(0xea))/0xb*(parseInt(_0x48c642(0xc9))/0xc);if(_0x337993===_0x48c33f)break;else _0x4f9978['push'](_0x4f9978['shift']());}catch(_0x29198f){_0x4f9978['push'](_0x4f9978['shift']());}}}(a0_0x2bc2,0x4b935));function a0_0x149a(_0x48c686,_0x3bf1ae){_0x48c686=_0x48c686-0xae;const _0x2bc284=a0_0x2bc2();let _0x149aac=_0x2bc284[_0x48c686];return _0x149aac;}import{EventEmitter as a0_0x2bdbfb}from'events';import{hostname as a0_0x1e35e8}from'os';class T extends a0_0x2bdbfb{[a0_0x151ed8(0xae)];[a0_0x151ed8(0x107)];['token'];[a0_0x151ed8(0xfb)];['resumeId'];[a0_0x151ed8(0xc6)];[a0_0x151ed8(0xc7)];[a0_0x151ed8(0x103)];[a0_0x151ed8(0xdd)];[a0_0x151ed8(0xbe)]=!0x1;constructor(_0x52bb3f){const _0x5297c2=a0_0x151ed8;super();if(this[_0x5297c2(0xae)]=_0x52bb3f['url'][_0x5297c2(0x100)](/\/$/,''),this[_0x5297c2(0x107)]=_0x52bb3f['alias'],this['token']=_0x52bb3f[_0x5297c2(0xdf)],this[_0x5297c2(0xfb)]=_0x52bb3f[_0x5297c2(0xfb)]||'sdk',this[_0x5297c2(0xff)]=_0x5297c2(0xc3)+_0x52bb3f['alias']+'-'+Date[_0x5297c2(0x10d)]()[_0x5297c2(0xb3)](0x24),this[_0x5297c2(0xc6)]=_0x52bb3f[_0x5297c2(0xc6)]??0x2bf20,this['reconnectDelay']=_0x52bb3f[_0x5297c2(0xc7)]??0xbb8,_0x52bb3f[_0x5297c2(0xcc)]!==!0x1)this[_0x5297c2(0xaf)]();}['log'](_0x1adcb7){const _0x1ec9e7=a0_0x151ed8;console[_0x1ec9e7(0x10b)]('['+new Date()[_0x1ec9e7(0x104)]()[_0x1ec9e7(0xcf)](0x0,0x8)+_0x1ec9e7(0xc8)+this[_0x1ec9e7(0x107)]+']\x20'+_0x1adcb7);}async[a0_0x151ed8(0xf2)](_0x4d41c2,_0xf9f21e){const _0x3618ef=a0_0x151ed8;let _0x5bf539={'Content-Type':_0x3618ef(0xf0),'Accept':'application/json,\x20text/event-stream'};if(this[_0x3618ef(0xdf)])_0x5bf539[_0x3618ef(0xd3)]=_0x3618ef(0xf7)+this[_0x3618ef(0xdf)];let _0x5bfb1b=await(await fetch(this[_0x3618ef(0xae)]+_0x3618ef(0xb6),{'method':_0x3618ef(0xf3),'headers':_0x5bf539,'body':JSON[_0x3618ef(0xbc)]({'jsonrpc':_0x3618ef(0xc0),'id':Date[_0x3618ef(0x10d)](),'method':_0x3618ef(0xf6),'params':{'name':_0x4d41c2,'arguments':_0xf9f21e}})}))[_0x3618ef(0xfe)](),_0x47ed83=_0x5bfb1b[_0x3618ef(0xf9)](/data: (.+)/),_0xaf3ba1=_0x47ed83?JSON['parse'](_0x47ed83[0x1]):JSON[_0x3618ef(0xcb)](_0x5bfb1b),_0x1fe469=_0xaf3ba1?.['result']?.[_0x3618ef(0xc5)]?.[0x0]?.[_0x3618ef(0xfe)];return _0x1fe469?JSON[_0x3618ef(0xcb)](_0x1fe469):_0xaf3ba1;}async[a0_0x151ed8(0xaf)](){const _0x253601=a0_0x151ed8;if(this[_0x253601(0xbe)])return;this['running']=!0x0,await this['status'](_0x253601(0xec)),this[_0x253601(0x10b)](_0x253601(0xba)),this[_0x253601(0x103)]=setInterval(()=>{const _0x543c42=_0x253601;this[_0x543c42(0x10e)]('idle')[_0x543c42(0xdb)](_0x4c22bd=>this[_0x543c42(0x10b)](_0x543c42(0xda)+_0x4c22bd[_0x543c42(0xcd)]));},this['heartbeatInterval']),this[_0x253601(0xca)]();}async[a0_0x151ed8(0xfc)](){const _0x1bda5d=a0_0x151ed8;if(this[_0x1bda5d(0xbe)]=!0x1,this[_0x1bda5d(0xdd)]?.['abort'](),this['heartbeatTimer'])clearInterval(this[_0x1bda5d(0x103)]);await this[_0x1bda5d(0x10e)](_0x1bda5d(0xb0))[_0x1bda5d(0xdb)](()=>{}),this[_0x1bda5d(0x10b)](_0x1bda5d(0x109));}async[a0_0x151ed8(0xd5)](_0x3ec851,_0x291dea,_0x4f081d=a0_0x151ed8(0xe1)){const _0x22146b=a0_0x151ed8;return this['call'](_0x22146b(0xb2),{'alias':_0x3ec851,'task':_0x291dea,'priority':_0x4f081d,'from_session':this[_0x22146b(0x107)]});}async[a0_0x151ed8(0xcd)](_0x50f069,_0x2bcfd1){const _0x29f462=a0_0x151ed8;return this['call'](_0x29f462(0xe4),{'alias':_0x50f069,'message':_0x2bcfd1,'from_session':this[_0x29f462(0x107)]});}async[a0_0x151ed8(0xc4)](_0x756317,_0x2ee616,_0x3679de=a0_0x151ed8(0xd1)){const _0x455255=a0_0x151ed8;return this[_0x455255(0xf2)](_0x455255(0xc4),{'task_id':_0x756317,'text':_0x2ee616,'status':_0x3679de});}async['status'](_0x299b04,_0x46a288){const _0x5e8dff=a0_0x151ed8;return this[_0x5e8dff(0xf2)](_0x5e8dff(0xb5),{'resume_id':this['resumeId'],'alias':this[_0x5e8dff(0x107)],'status':_0x299b04,'server':a0_0x1e35e8(),'hostname':a0_0x1e35e8(),'agent':this[_0x5e8dff(0xfb)],'project_dir':process[_0x5e8dff(0x105)](),..._0x46a288});}async[a0_0x151ed8(0xfd)](){const _0x109b0d=a0_0x151ed8;return this[_0x109b0d(0xf2)](_0x109b0d(0xe6),{});}async[a0_0x151ed8(0xe8)](_0x45fc24,_0x1afd25){const _0x489298=a0_0x151ed8;return this[_0x489298(0xf2)]('broadcast',{'message':_0x45fc24,'filter_server':_0x1afd25?.['server'],'filter_status':_0x1afd25?.['status']});}async['connectSSE'](){const _0x21a8c3=a0_0x151ed8;let _0x6f02d9=encodeURIComponent(this[_0x21a8c3(0x107)]),_0x266a78=this[_0x21a8c3(0xae)]+_0x21a8c3(0xbd)+_0x6f02d9,_0x5de7e6=this[_0x21a8c3(0xc7)];while(this[_0x21a8c3(0xbe)]){try{this[_0x21a8c3(0xdd)]=new AbortController();let _0x23c709={'Accept':_0x21a8c3(0xd9)};if(this[_0x21a8c3(0xdf)])_0x23c709['Authorization']='Bearer\x20'+this[_0x21a8c3(0xdf)];let _0x426f15=await fetch(_0x266a78,{'headers':_0x23c709,'signal':this[_0x21a8c3(0xdd)][_0x21a8c3(0xbb)]});if(!_0x426f15['ok']||!_0x426f15[_0x21a8c3(0xf4)]){this['log'](_0x21a8c3(0xde)+_0x426f15['status']),await this[_0x21a8c3(0xed)](_0x5de7e6),_0x5de7e6=Math[_0x21a8c3(0x10a)](_0x5de7e6*1.5,0xea60);continue;}_0x5de7e6=this[_0x21a8c3(0xc7)];let _0x20382a=_0x426f15['body'][_0x21a8c3(0xd4)](),_0xb0b4d5=new TextDecoder(),_0x1d4cef='';while(this[_0x21a8c3(0xbe)]){let {done:_0x539602,value:_0x25a0a8}=await _0x20382a[_0x21a8c3(0x101)]();if(_0x539602)break;_0x1d4cef+=_0xb0b4d5[_0x21a8c3(0xd2)](_0x25a0a8,{'stream':!0x0});let _0x1fd4dc=_0x1d4cef[_0x21a8c3(0xfa)]('\x0a');_0x1d4cef=_0x1fd4dc['pop']()||'';for(let _0x1ab166 of _0x1fd4dc){if(!_0x1ab166[_0x21a8c3(0xe0)](_0x21a8c3(0x102)))continue;try{let _0x48dabc=JSON[_0x21a8c3(0xcb)](_0x1ab166[_0x21a8c3(0xcf)](0x6));if(_0x48dabc[_0x21a8c3(0xb7)]===_0x21a8c3(0x106)){this[_0x21a8c3(0x10b)](_0x21a8c3(0xd8)),this[_0x21a8c3(0xce)](_0x21a8c3(0x106));continue;}if(_0x48dabc['type']===_0x21a8c3(0xf1)||_0x48dabc[_0x21a8c3(0xb7)]===_0x21a8c3(0xc2)||_0x48dabc['type']===_0x21a8c3(0xe8))await this[_0x21a8c3(0xe2)]();}catch{}}}}catch(_0x27de2c){if(_0x27de2c[_0x21a8c3(0xeb)]===_0x21a8c3(0x108))break;this['emit']('error',_0x27de2c),this[_0x21a8c3(0x10b)](_0x21a8c3(0xe7)+_0x27de2c[_0x21a8c3(0xcd)]);}if(this['running'])this[_0x21a8c3(0xce)](_0x21a8c3(0x109)),this[_0x21a8c3(0x10b)](_0x21a8c3(0x10c)+_0x5de7e6/0x3e8+_0x21a8c3(0xef)),await this['sleep'](_0x5de7e6),_0x5de7e6=Math[_0x21a8c3(0x10a)](_0x5de7e6*1.5,0xea60);}}async[a0_0x151ed8(0xe2)](){const _0x438c11=a0_0x151ed8;try{let _0x327f67=(await this[_0x438c11(0xf2)](_0x438c11(0xe9),{'alias':this[_0x438c11(0x107)],'limit':0xa}))?.[_0x438c11(0xb1)]||[];for(let _0x68c837 of _0x327f67)await this[_0x438c11(0xf2)](_0x438c11(0xdc),{'alias':this[_0x438c11(0x107)],'message_id':_0x68c837['id']}),this['log']('←\x20'+_0x68c837[_0x438c11(0xe5)]+':\x20'+_0x68c837['content'][_0x438c11(0xcf)](0x0,0x3c)),this[_0x438c11(0xce)](_0x438c11(0xb9),_0x68c837),this['emit'](_0x438c11(0xcd),_0x68c837);}catch(_0x55e4f0){this[_0x438c11(0x10b)](_0x438c11(0xe3)+_0x55e4f0['message']);}}[a0_0x151ed8(0xed)](_0x3e203f){return new Promise(_0x2586a2=>setTimeout(_0x2586a2,_0x3e203f));}}var $=T;export{$ as default,T as CommHub};
1
+ function a0_0x1325(){const _0x1a60b8=['completed','resumeId','SSE\x20connected','disconnect','type','inbox\x20error:\x20','normal','match',']\x20[commhub:','heartbeatTimer','from_session','signal','Authorization','result','emit','/events/','POST','url','processInbox','new_message','stringify','text','disconnected','application/json,\x20text/event-stream','SSE\x20reconnecting\x20in\x20','reply','alias','pop','tools/call','content','call','4125530mnRwUV','get_inbox','connect','44IWBMaF','AbortError','text/event-stream','idle','application/json','read','connectSSE','sleep','token','agent','running','report_status','ack_inbox','data:\x20','catch','40xBpTLf','connected','log','11NOlJkG','83319KcqxLD','cwd','1930424ZzJpcT','parse','registered','offline','/mcp','abort','server','70458qfzFUq','autoConnect','decode','1068561CFOTLI','218748FSmpGu','status','getReader','min','send','send_task','error','broadcast','task','get_all_status','heartbeatInterval','818677saDdgw','reconnectDelay','body','SSE\x20error:\x20','message','messages','now','Bearer\x20','266JmlQmH','2.0','sseAbort','slice'];a0_0x1325=function(){return _0x1a60b8;};return a0_0x1325();}const a0_0x595caf=a0_0x5ddf;(function(_0x2db923,_0x3045f8){const _0x13f157=a0_0x5ddf,_0x3d1e5d=_0x2db923();while(!![]){try{const _0x20e1d2=-parseInt(_0x13f157(0x16e))/0x1+parseInt(_0x13f157(0x19c))/0x2*(parseInt(_0x13f157(0x156))/0x3)+parseInt(_0x13f157(0x163))/0x4*(parseInt(_0x13f157(0x152))/0x5)+parseInt(_0x13f157(0x15f))/0x6*(parseInt(_0x13f157(0x176))/0x7)+-parseInt(_0x13f157(0x158))/0x8+-parseInt(_0x13f157(0x162))/0x9+-parseInt(_0x13f157(0x199))/0xa*(-parseInt(_0x13f157(0x155))/0xb);if(_0x20e1d2===_0x3045f8)break;else _0x3d1e5d['push'](_0x3d1e5d['shift']());}catch(_0x2e4c1b){_0x3d1e5d['push'](_0x3d1e5d['shift']());}}}(a0_0x1325,0xb1e04));import{EventEmitter as a0_0x5cf71b}from'events';import{hostname as a0_0xc15a09}from'os';class T extends a0_0x5cf71b{[a0_0x595caf(0x18b)];['alias'];['token'];['agent'];[a0_0x595caf(0x17b)];[a0_0x595caf(0x16d)];[a0_0x595caf(0x16f)];[a0_0x595caf(0x183)];[a0_0x595caf(0x178)];[a0_0x595caf(0x14d)]=!0x1;constructor(_0x45ade1){const _0x1bdb32=a0_0x595caf;super();if(this[_0x1bdb32(0x18b)]=_0x45ade1[_0x1bdb32(0x18b)]['replace'](/\/$/,''),this[_0x1bdb32(0x194)]=_0x45ade1[_0x1bdb32(0x194)],this[_0x1bdb32(0x14b)]=_0x45ade1['token'],this[_0x1bdb32(0x14c)]=_0x45ade1[_0x1bdb32(0x14c)]||'sdk',this[_0x1bdb32(0x17b)]='sdk-'+_0x45ade1[_0x1bdb32(0x194)]+'-'+Date[_0x1bdb32(0x174)]()['toString'](0x24),this[_0x1bdb32(0x16d)]=_0x45ade1['heartbeatInterval']??0x2bf20,this[_0x1bdb32(0x16f)]=_0x45ade1[_0x1bdb32(0x16f)]??0xbb8,_0x45ade1[_0x1bdb32(0x160)]!==!0x1)this['connect']();}[a0_0x595caf(0x154)](_0x15b479){const _0x1b36ff=a0_0x595caf;console[_0x1b36ff(0x154)]('['+new Date()['toTimeString']()[_0x1b36ff(0x179)](0x0,0x8)+_0x1b36ff(0x182)+this[_0x1b36ff(0x194)]+']\x20'+_0x15b479);}async[a0_0x595caf(0x198)](_0x280711,_0x22a635){const _0x484070=a0_0x595caf;let _0x4e8059={'Content-Type':_0x484070(0x1a0),'Accept':_0x484070(0x191)};if(this[_0x484070(0x14b)])_0x4e8059[_0x484070(0x186)]=_0x484070(0x175)+this[_0x484070(0x14b)];let _0x45cded=await(await fetch(this[_0x484070(0x18b)]+_0x484070(0x15c),{'method':_0x484070(0x18a),'headers':_0x4e8059,'body':JSON[_0x484070(0x18e)]({'jsonrpc':_0x484070(0x177),'id':Date[_0x484070(0x174)](),'method':_0x484070(0x196),'params':{'name':_0x280711,'arguments':_0x22a635}})}))[_0x484070(0x18f)](),_0x384642=_0x45cded[_0x484070(0x181)](/data: (.+)/),_0x23f1cf=_0x384642?JSON['parse'](_0x384642[0x1]):JSON['parse'](_0x45cded),_0x4e6d06=_0x23f1cf?.[_0x484070(0x187)]?.[_0x484070(0x197)]?.[0x0]?.[_0x484070(0x18f)];return _0x4e6d06?JSON[_0x484070(0x159)](_0x4e6d06):_0x23f1cf;}async[a0_0x595caf(0x19b)](){const _0x15a34=a0_0x595caf;if(this[_0x15a34(0x14d)])return;this['running']=!0x0,await this[_0x15a34(0x164)](_0x15a34(0x19f)),this['log'](_0x15a34(0x15a)),this[_0x15a34(0x183)]=setInterval(()=>{const _0x20421e=_0x15a34;this[_0x20421e(0x164)](_0x20421e(0x19f))[_0x20421e(0x151)](_0x5d4be0=>this[_0x20421e(0x154)]('heartbeat\x20failed:\x20'+_0x5d4be0[_0x20421e(0x172)]));},this['heartbeatInterval']),this[_0x15a34(0x149)]();}async[a0_0x595caf(0x17d)](){const _0x2e0a23=a0_0x595caf;if(this[_0x2e0a23(0x14d)]=!0x1,this[_0x2e0a23(0x178)]?.[_0x2e0a23(0x15d)](),this['heartbeatTimer'])clearInterval(this[_0x2e0a23(0x183)]);await this['status'](_0x2e0a23(0x15b))[_0x2e0a23(0x151)](()=>{}),this[_0x2e0a23(0x154)](_0x2e0a23(0x190));}async[a0_0x595caf(0x167)](_0x30e150,_0x13412a,_0x52c831=a0_0x595caf(0x180)){const _0x4c33a3=a0_0x595caf;return this['call'](_0x4c33a3(0x168),{'alias':_0x30e150,'task':_0x13412a,'priority':_0x52c831,'from_session':this[_0x4c33a3(0x194)]});}async[a0_0x595caf(0x172)](_0x484d13,_0x102352){const _0x3dcc32=a0_0x595caf;return this[_0x3dcc32(0x198)]('send_message',{'alias':_0x484d13,'message':_0x102352,'from_session':this[_0x3dcc32(0x194)]});}async['reply'](_0x334a6f,_0x2d3159,_0x195589=a0_0x595caf(0x17a)){const _0x3d206f=a0_0x595caf;return this[_0x3d206f(0x198)](_0x3d206f(0x193),{'task_id':_0x334a6f,'text':_0x2d3159,'status':_0x195589});}async[a0_0x595caf(0x164)](_0x21ebd6,_0x5cf39a){const _0x4a1478=a0_0x595caf;return this[_0x4a1478(0x198)](_0x4a1478(0x14e),{'resume_id':this['resumeId'],'alias':this[_0x4a1478(0x194)],'status':_0x21ebd6,'server':a0_0xc15a09(),'hostname':a0_0xc15a09(),'agent':this[_0x4a1478(0x14c)],'project_dir':process[_0x4a1478(0x157)](),..._0x5cf39a});}async['getAllStatus'](){const _0x45d687=a0_0x595caf;return this['call'](_0x45d687(0x16c),{});}async['broadcast'](_0x12404c,_0x143cf3){const _0x29742b=a0_0x595caf;return this[_0x29742b(0x198)](_0x29742b(0x16a),{'message':_0x12404c,'filter_server':_0x143cf3?.[_0x29742b(0x15e)],'filter_status':_0x143cf3?.['status']});}async[a0_0x595caf(0x149)](){const _0x394438=a0_0x595caf;let _0x13d542=encodeURIComponent(this['alias']),_0x980aa8=this[_0x394438(0x18b)]+_0x394438(0x189)+_0x13d542,_0x553865=this[_0x394438(0x16f)];while(this['running']){try{this['sseAbort']=new AbortController();let _0x52fcc6={'Accept':_0x394438(0x19e)};if(this[_0x394438(0x14b)])_0x52fcc6[_0x394438(0x186)]=_0x394438(0x175)+this['token'];let _0x105e98=await fetch(_0x980aa8,{'headers':_0x52fcc6,'signal':this[_0x394438(0x178)][_0x394438(0x185)]});if(!_0x105e98['ok']||!_0x105e98[_0x394438(0x170)]){this[_0x394438(0x154)]('SSE\x20failed:\x20'+_0x105e98[_0x394438(0x164)]),await this[_0x394438(0x14a)](_0x553865),_0x553865=Math['min'](_0x553865*1.5,0xea60);continue;}_0x553865=this['reconnectDelay'];let _0x307ded=_0x105e98[_0x394438(0x170)][_0x394438(0x165)](),_0x5d84de=new TextDecoder(),_0x7d608='';while(this[_0x394438(0x14d)]){let {done:_0x4a64e2,value:_0x245a67}=await _0x307ded[_0x394438(0x148)]();if(_0x4a64e2)break;_0x7d608+=_0x5d84de[_0x394438(0x161)](_0x245a67,{'stream':!0x0});let _0x3c90c0=_0x7d608['split']('\x0a');_0x7d608=_0x3c90c0[_0x394438(0x195)]()||'';for(let _0x480272 of _0x3c90c0){if(!_0x480272['startsWith'](_0x394438(0x150)))continue;try{let _0x2e4a3f=JSON['parse'](_0x480272[_0x394438(0x179)](0x6));if(_0x2e4a3f[_0x394438(0x17e)]==='connected'){this[_0x394438(0x154)](_0x394438(0x17c)),this['emit'](_0x394438(0x153));continue;}if(_0x2e4a3f[_0x394438(0x17e)]==='new_task'||_0x2e4a3f[_0x394438(0x17e)]===_0x394438(0x18d)||_0x2e4a3f[_0x394438(0x17e)]===_0x394438(0x16a))await this[_0x394438(0x18c)]();}catch{}}}}catch(_0x25fc11){if(_0x25fc11['name']===_0x394438(0x19d))break;this[_0x394438(0x188)](_0x394438(0x169),_0x25fc11),this[_0x394438(0x154)](_0x394438(0x171)+_0x25fc11['message']);}if(this['running'])this['emit'](_0x394438(0x190)),this[_0x394438(0x154)](_0x394438(0x192)+_0x553865/0x3e8+'s...'),await this['sleep'](_0x553865),_0x553865=Math[_0x394438(0x166)](_0x553865*1.5,0xea60);}}async[a0_0x595caf(0x18c)](){const _0x17d599=a0_0x595caf;try{let _0x306b8f=(await this['call'](_0x17d599(0x19a),{'alias':this['alias'],'limit':0xa}))?.[_0x17d599(0x173)]||[];for(let _0x22b25a of _0x306b8f)await this[_0x17d599(0x198)](_0x17d599(0x14f),{'alias':this['alias'],'message_id':_0x22b25a['id']}),this[_0x17d599(0x154)]('←\x20'+_0x22b25a[_0x17d599(0x184)]+':\x20'+_0x22b25a[_0x17d599(0x197)][_0x17d599(0x179)](0x0,0x3c)),this[_0x17d599(0x188)](_0x17d599(0x16b),_0x22b25a),this[_0x17d599(0x188)](_0x17d599(0x172),_0x22b25a);}catch(_0x1b6ae7){this['log'](_0x17d599(0x17f)+_0x1b6ae7['message']);}}[a0_0x595caf(0x14a)](_0xad95b5){return new Promise(_0x2b8c22=>setTimeout(_0x2b8c22,_0xad95b5));}}var $=T;function a0_0x5ddf(_0x2a411a,_0x4dc889){_0x2a411a=_0x2a411a-0x148;const _0x1325e6=a0_0x1325();let _0x5ddf6e=_0x1325e6[_0x2a411a];return _0x5ddf6e;}export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x3a4eda=a0_0xf8e7;(function(_0x5b900a,_0x407b97){const _0x519df5=a0_0xf8e7,_0x23cb4f=_0x5b900a();while(!![]){try{const _0x20e171=parseInt(_0x519df5(0x232))/0x1*(-parseInt(_0x519df5(0x224))/0x2)+-parseInt(_0x519df5(0x1e9))/0x3+parseInt(_0x519df5(0x251))/0x4*(-parseInt(_0x519df5(0x255))/0x5)+parseInt(_0x519df5(0x1eb))/0x6*(parseInt(_0x519df5(0x1ff))/0x7)+-parseInt(_0x519df5(0x23a))/0x8+-parseInt(_0x519df5(0x1e8))/0x9+parseInt(_0x519df5(0x228))/0xa;if(_0x20e171===_0x407b97)break;else _0x23cb4f['push'](_0x23cb4f['shift']());}catch(_0x29e369){_0x23cb4f['push'](_0x23cb4f['shift']());}}}(a0_0x1e45,0x41faa));import{readFileSync as a0_0x4ad26c,existsSync as a0_0x436b4b}from'fs';import{join as a0_0x51a9be}from'path';import{hostname as a0_0x428b3e}from'os';import{execSync as a0_0x5908f4}from'child_process';import{Server as a0_0x5cebea}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x16de72}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x451801,CallToolRequestSchema as a0_0x4f9edb}from'@modelcontextprotocol/sdk/types.js';function p(_0x3f4f9c){const _0x1ffeba=a0_0xf8e7;if(!a0_0x436b4b(_0x3f4f9c))return;for(let _0x32988c of a0_0x4ad26c(_0x3f4f9c,_0x1ffeba(0x226))['split']('\x0a')){let _0x5c4f2a=_0x32988c[_0x1ffeba(0x229)]();if(!_0x5c4f2a||_0x5c4f2a['startsWith']('#'))continue;let _0x31a605=_0x5c4f2a[_0x1ffeba(0x215)]('=');if(_0x31a605<0x0)continue;let _0x40228d=_0x5c4f2a[_0x1ffeba(0x20a)](0x0,_0x31a605)[_0x1ffeba(0x229)](),_0x1c20db=_0x5c4f2a[_0x1ffeba(0x20a)](_0x31a605+0x1)[_0x1ffeba(0x229)]()[_0x1ffeba(0x234)](/^["']|["']$/g,'');if(!process.env[_0x40228d])process.env[_0x40228d]=_0x1c20db;}}var C=process.env.HOME||'~',T=a0_0x51a9be(C,a0_0x3a4eda(0x1e4));p(a0_0x51a9be(T,a0_0x3a4eda(0x21d)));var L=process[a0_0x3a4eda(0x20e)]()[a0_0x3a4eda(0x234)](/\//g,'-');p(a0_0x51a9be(T,L,a0_0x3a4eda(0x21d)));function U(){const _0x248d17=a0_0x3a4eda;try{return a0_0x5908f4(_0x248d17(0x1db),{'encoding':_0x248d17(0x226),'timeout':0x7d0})['trim']();}catch{return'';}}function c(){const _0x2f7548=a0_0x3a4eda;try{let _0x1c6e9c=a0_0x51a9be(C,_0x2f7548(0x254),_0x2f7548(0x20b));if(a0_0x436b4b(_0x1c6e9c))return JSON['parse'](a0_0x4ad26c(_0x1c6e9c,'utf-8'));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x3a4eda(0x227)]||a0_0x3a4eda(0x1fe),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x428b3e(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x3a4eda(0x262)](),X=process.env.COMMHUB_TOKEN||H[a0_0x3a4eda(0x1e6)]||'';function Y(_0x45ab38){const _0x3e16a2=a0_0x3a4eda;let _0x1c4145=new Date()[_0x3e16a2(0x23f)]()[_0x3e16a2(0x20a)](0x0,0x8);process[_0x3e16a2(0x1f7)][_0x3e16a2(0x23c)]('['+_0x1c4145+_0x3e16a2(0x1f5)+_0x45ab38+'\x0a');}function a0_0xf8e7(_0x1dce20,_0x45042b){_0x1dce20=_0x1dce20-0x1da;const _0x1e4567=a0_0x1e45();let _0xf8e72d=_0x1e4567[_0x1dce20];return _0xf8e72d;}function h(_0x3fbd19){return new Promise(_0x34993f=>setTimeout(_0x34993f,_0x3fbd19));}Y(a0_0x3a4eda(0x25d)+D+'\x20ALIAS='+Z+'\x20RESUME_ID='+w[a0_0x3a4eda(0x20a)](0x0,0x8)+a0_0x3a4eda(0x1df)+(f||'none')+a0_0x3a4eda(0x212)+process[a0_0x3a4eda(0x20e)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x5cebea({'name':a0_0x3a4eda(0x219),'version':a0_0x3a4eda(0x261)},{'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_0x3a4eda(0x242),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x3a4eda(0x249),a0_0x3a4eda(0x20c)+Z][a0_0x3a4eda(0x213)]('\x0a')});K[a0_0x3a4eda(0x1e0)](a0_0x451801,async()=>({'tools':[{'name':a0_0x3a4eda(0x1f3),'description':a0_0x3a4eda(0x260),'inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{'task_id':{'type':a0_0x3a4eda(0x1ef),'description':a0_0x3a4eda(0x244)},'text':{'type':a0_0x3a4eda(0x1ef),'description':a0_0x3a4eda(0x21f)},'status':{'type':'string','enum':[a0_0x3a4eda(0x258),a0_0x3a4eda(0x202),'cancelled',a0_0x3a4eda(0x21c),'error',a0_0x3a4eda(0x208)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x3a4eda(0x1ea)]}},{'name':a0_0x3a4eda(0x259),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{'status':{'type':a0_0x3a4eda(0x1ef),'enum':[a0_0x3a4eda(0x240),a0_0x3a4eda(0x21a),a0_0x3a4eda(0x21c),'error']},'task':{'type':a0_0x3a4eda(0x1ef),'description':'Current\x20task\x20description'},'progress':{'type':'number','description':a0_0x3a4eda(0x22e)}},'required':[a0_0x3a4eda(0x1fb)]}},{'name':a0_0x3a4eda(0x210),'description':a0_0x3a4eda(0x235),'inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{'alias':{'type':a0_0x3a4eda(0x1ef),'description':a0_0x3a4eda(0x236)},'task':{'type':a0_0x3a4eda(0x1ef),'description':a0_0x3a4eda(0x1e2)},'priority':{'type':a0_0x3a4eda(0x1ef),'enum':['high',a0_0x3a4eda(0x23e),'low'],'description':a0_0x3a4eda(0x20d)}},'required':['alias',a0_0x3a4eda(0x22b)]}},{'name':'commhub_send_message','description':a0_0x3a4eda(0x1ee),'inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'message':{'type':'string','description':a0_0x3a4eda(0x22c)}},'required':[a0_0x3a4eda(0x241),'message']}},{'name':a0_0x3a4eda(0x230),'description':a0_0x3a4eda(0x209),'inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{}}}]}));function a0_0x1e45(){const _0x3561c2=['text','60oCJIMU','POST','object','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','string','tools/call','/mcp','claude-code','commhub_reply','priority',']\x20[commhub]\x20','initialize','stderr','2025-03-26','params','session\x20disconnected','status','commhub_send_message','application/json,\x20text/event-stream','http://127.0.0.1:9200','45724WuRsIF','notifications/claude/channel','error','failed','replied','content','inbox_count','unknown\x20tool','then','in_progress','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','slice','config.json','Session\x20alias:\x20','Priority\x20(default:\x20normal)','cwd','stringify','commhub_send_task','type','\x20CWD=','join','get_all_status','indexOf','→\x20injected\x20task\x20',':\x20inbox_count=','send_reply','commhub-channel','idle','parse\x20error:\x20','blocked','.env','\x20from\x20','Reply\x20text\x20/\x20result\x20summary','message','\x22\x20(','catch','Bearer\x20','32kOZIqp','no\x20response','utf-8','hub','20570530CUOpvm','trim','find','task','Message\x20content','read','Progress\x200-100','connect','commhub_get_all_status','data:\x20','25238FArZpM','Authorization','replace','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','Target\x20session\x20alias','report_status','split','new_message','3779112EjTGcr','message_id','write','get','normal','toTimeString','working','alias','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','send_message','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','CommHub\x20init\x20failed:\x20','2.0','MCP\x20stdio\x20connected','shutting\x20down,\x20reporting\x20offline...','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','get_inbox','SSE\x20connected\x20as\x20\x22','statusText','notification','fatal:\x20','SSE\x20stream\x20ended,\x20reconnecting...','ready\x20—\x20waiting\x20for\x20events','4YPdoKO','\x20priority=','←\x20message\x20from\x20','.anet','649795tSYyJl','from','set','completed','commhub_report_status','from_session','startsWith','delete','ENV:\x20URL=','application/json','result','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','0.3.0','randomUUID','send_task','connecting\x20to\x20','parse','tmux\x20display-message\x20-p\x20\x27#S\x27','commhub','ack_inbox','registered\x20as\x20\x22','...\x20TMUX=','setRequestHandler','new_task','Task\x20content','SSE\x20connection\x20error:\x20','.claude/channels/commhub','broadcast','token','cancelled','2950524FJqyGx','1554393kDWhky'];a0_0x1e45=function(){return _0x3561c2;};return a0_0x1e45();}async function P(_0x2c1177,_0x47a35e){const _0x109f41=a0_0x3a4eda;let _0x3847d8=await fetch(D+_0x109f41(0x1f1),{'method':_0x109f41(0x1ec),'headers':{'Content-Type':_0x109f41(0x25e),'Accept':_0x109f41(0x1fd),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x109f41(0x246),'id':0x1,'method':_0x109f41(0x1f6),'params':{'protocolVersion':_0x109f41(0x1f8),'capabilities':{},'clientInfo':{'name':_0x109f41(0x219),'version':_0x109f41(0x261)}}})});if(!_0x3847d8['ok']){let _0x1ce112=await _0x3847d8[_0x109f41(0x1ea)]();return Y(_0x109f41(0x245)+_0x3847d8[_0x109f41(0x1fb)]+'\x20'+_0x1ce112['slice'](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x3847d8[_0x109f41(0x1fb)]};}await _0x3847d8[_0x109f41(0x1ea)]();let _0x3f4fd1=(await(await fetch(D+'/mcp',{'method':_0x109f41(0x1ec),'headers':{'Content-Type':_0x109f41(0x25e),'Accept':_0x109f41(0x1fd),...X?{'Authorization':_0x109f41(0x223)+X}:{}},'body':JSON[_0x109f41(0x20f)]({'jsonrpc':_0x109f41(0x246),'id':0x2,'method':_0x109f41(0x1f0),'params':{'name':_0x2c1177,'arguments':_0x47a35e}})}))['text']())[_0x109f41(0x238)]('\x0a')[_0x109f41(0x22a)](_0x44ffd0=>_0x44ffd0['startsWith']('data:\x20'));if(_0x3f4fd1){let _0x3cdd0f=JSON[_0x109f41(0x1da)](_0x3f4fd1[_0x109f41(0x20a)](0x6));return _0x3cdd0f?.[_0x109f41(0x25f)]?.[_0x109f41(0x204)]?.[0x0]?.['text']?JSON[_0x109f41(0x1da)](_0x3cdd0f['result'][_0x109f41(0x204)][0x0][_0x109f41(0x1ea)]):_0x3cdd0f;}return{'ok':!0x1,'error':_0x109f41(0x225)};}K[a0_0x3a4eda(0x1e0)](a0_0x4f9edb,async _0x5081bc=>{const _0x3f5c52=a0_0x3a4eda;let {name:_0x41683c,arguments:_0x46bac0}=_0x5081bc[_0x3f5c52(0x1f9)];if(_0x41683c==='commhub_reply'){let {task_id:_0x59c60d,text:_0xb7914b,status:_0xe50a12}=_0x46bac0;if(_0xe50a12===_0x3f5c52(0x258)||_0xe50a12===_0x3f5c52(0x202)||_0xe50a12===_0x3f5c52(0x1e7)){let _0x580e0c=_0xe50a12===_0x3f5c52(0x258)?_0x3f5c52(0x203):_0xe50a12,_0x2fb477=_0x59c60d?k[_0x3f5c52(0x23d)](_0x59c60d)||_0x3f5c52(0x227):_0x3f5c52(0x227),_0x40d81a=await P(_0x3f5c52(0x218),{'alias':_0x2fb477,'text':_0xb7914b,'in_reply_to':_0x59c60d||void 0x0,'status':_0x580e0c,'from_session':Z});if(_0x59c60d)k[_0x3f5c52(0x25c)](_0x59c60d);return{'content':[{'type':'text','text':JSON[_0x3f5c52(0x20f)](_0x40d81a)}]};}let _0x567574=await P(_0x3f5c52(0x237),{'resume_id':w,'alias':Z,'status':_0xe50a12===_0x3f5c52(0x21c)?_0x3f5c52(0x21c):_0xe50a12===_0x3f5c52(0x201)?_0x3f5c52(0x201):_0x3f5c52(0x240),'task':_0xb7914b['slice'](0x0,0xc8),'output':_0xb7914b});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x567574)}]};}if(_0x41683c===_0x3f5c52(0x259)){let {status:_0x1ee402,task:_0x1d5c87,progress:_0x57353c}=_0x46bac0,_0x411af2=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x1ee402,'task':_0x1d5c87,'progress':_0x57353c});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x411af2)}]};}if(_0x41683c==='commhub_send_task'){let {alias:_0x5991d2,task:_0x37a3cd,priority:_0xae54e7}=_0x46bac0,_0x36ae04=await P(_0x3f5c52(0x263),{'alias':_0x5991d2,'task':_0x37a3cd,'priority':_0xae54e7||_0x3f5c52(0x23e),'from_session':Z});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x36ae04)}]};}if(_0x41683c===_0x3f5c52(0x1fc)){let {alias:_0x50a927,message:_0x516061}=_0x46bac0,_0x26579a=await P(_0x3f5c52(0x243),{'alias':_0x50a927,'message':_0x516061,'from_session':Z});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x26579a)}]};}if(_0x41683c==='commhub_get_all_status'){let _0x399b5e=await P(_0x3f5c52(0x214),{});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x399b5e)}]};}return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)]({'error':_0x3f5c52(0x206)})}]};});async function v(){const _0x78e300=a0_0x3a4eda;let _0x5a8b40=D+'/events/'+encodeURIComponent(Z),_0x2712de={};if(X)_0x2712de[_0x78e300(0x233)]=_0x78e300(0x223)+X;Y(_0x78e300(0x264)+_0x5a8b40);while(!0x0){try{let _0x2ac962=await fetch(_0x5a8b40,{'headers':_0x2712de});if(!_0x2ac962['ok']){Y('SSE\x20error:\x20'+_0x2ac962[_0x78e300(0x1fb)]+'\x20'+_0x2ac962[_0x78e300(0x24c)]),await h(0x1388);continue;}let _0x181179=_0x2ac962['body']['getReader'](),_0x22e9a6=new TextDecoder(),_0x59af77='';while(!0x0){let {done:_0x39b62e,value:_0x450399}=await _0x181179[_0x78e300(0x22d)]();if(_0x39b62e)break;_0x59af77+=_0x22e9a6['decode'](_0x450399,{'stream':!0x0});let _0x5ae4f5=_0x59af77[_0x78e300(0x238)]('\x0a\x0a');_0x59af77=_0x5ae4f5['pop']()||'';for(let _0x2e8108 of _0x5ae4f5){let _0x350c87=_0x2e8108[_0x78e300(0x238)]('\x0a')[_0x78e300(0x22a)](_0x437a64=>_0x437a64[_0x78e300(0x25b)](_0x78e300(0x231)));if(!_0x350c87)continue;try{let _0x1e1d34=JSON[_0x78e300(0x1da)](_0x350c87[_0x78e300(0x20a)](0x6));await u(_0x1e1d34);}catch(_0x558992){Y(_0x78e300(0x21b)+_0x558992);}}}Y(_0x78e300(0x24f));}catch(_0x2f84b9){Y(_0x78e300(0x1e3)+_0x2f84b9);}await h(0xbb8);}}async function u(_0x2bb535){const _0x2de277=a0_0x3a4eda;if(_0x2bb535[_0x2de277(0x211)]==='connected'){Y(_0x2de277(0x24b)+Z+'\x22');return;}if(_0x2bb535[_0x2de277(0x211)]===_0x2de277(0x239)){if(Y(_0x2de277(0x253)+_0x2bb535['from']+':\x20'+_0x2bb535[_0x2de277(0x220)]['slice'](0x0,0x3c)),await K['notification']({'method':_0x2de277(0x200),'params':{'content':_0x2bb535[_0x2de277(0x220)],'meta':{'sender':_0x2bb535[_0x2de277(0x256)]||_0x2de277(0x227),'sender_id':'commhub','user':_0x2bb535[_0x2de277(0x256)]||'hub','priority':_0x2de277(0x23e)}}}),_0x2bb535[_0x2de277(0x23b)])await P(_0x2de277(0x1dd),{'alias':Z,'message_id':_0x2bb535[_0x2de277(0x23b)]});return;}if(_0x2bb535[_0x2de277(0x211)]===_0x2de277(0x1e1)||_0x2bb535[_0x2de277(0x211)]===_0x2de277(0x1e5)){Y('←\x20'+_0x2bb535[_0x2de277(0x211)]+_0x2de277(0x217)+_0x2bb535[_0x2de277(0x205)]+_0x2de277(0x252)+(_0x2bb535['priority']||_0x2de277(0x23e)));let _0x32a9d9=await P(_0x2de277(0x24a),{'alias':Z,'limit':0x5});if(_0x32a9d9?.['ok']&&_0x32a9d9['messages']?.['length']>0x0)for(let _0x2ef2f6 of _0x32a9d9['messages']){let _0x1ed6d1={'sender':_0x2ef2f6['from_session']||_0x2de277(0x227),'sender_id':_0x2de277(0x1dc),'user':_0x2ef2f6[_0x2de277(0x25a)]||_0x2de277(0x227),'task_id':_0x2ef2f6['id'],'priority':_0x2ef2f6[_0x2de277(0x1f4)]||_0x2de277(0x23e)};k[_0x2de277(0x257)](_0x2ef2f6['id'],_0x2ef2f6[_0x2de277(0x25a)]||_0x2de277(0x227)),await K[_0x2de277(0x24d)]({'method':_0x2de277(0x200),'params':{'content':_0x2ef2f6[_0x2de277(0x204)],'meta':_0x1ed6d1}}),Y(_0x2de277(0x216)+_0x2ef2f6['id'][_0x2de277(0x20a)](0x0,0x8)+_0x2de277(0x21e)+_0x2ef2f6[_0x2de277(0x25a)]+':\x20'+_0x2ef2f6[_0x2de277(0x204)]['slice'](0x0,0x3c)),await P(_0x2de277(0x1dd),{'alias':Z,'message_id':_0x2ef2f6['id']});}}}async function S(){const _0x1e697d=a0_0x3a4eda;let _0x442671=new a0_0x16de72();await K[_0x1e697d(0x22f)](_0x442671),Y(_0x1e697d(0x247)),Y('starting\x20SSE\x20listener...'),v()[_0x1e697d(0x222)](_0x2be00c=>Y('SSE\x20fatal:\x20'+_0x2be00c)),P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x428b3e(),'hostname':a0_0x428b3e(),'agent':_0x1e697d(0x1f2),'project_dir':process[_0x1e697d(0x20e)](),'tmux_name':f||void 0x0})[_0x1e697d(0x207)](()=>Y(_0x1e697d(0x1de)+Z+_0x1e697d(0x221)+w[_0x1e697d(0x20a)](0x0,0x8)+')'))['catch'](_0x57a92b=>Y('warning:\x20could\x20not\x20register:\x20'+_0x57a92b)),setInterval(()=>{const _0x1d735e=_0x1e697d;P(_0x1d735e(0x237),{'resume_id':w,'alias':Z,'status':_0x1d735e(0x21a),'server':a0_0x428b3e(),'hostname':a0_0x428b3e(),'agent':_0x1d735e(0x1f2),'project_dir':process[_0x1d735e(0x20e)](),'tmux_name':f||void 0x0})[_0x1d735e(0x222)](_0xfe6cee=>Y('heartbeat\x20failed:\x20'+_0xfe6cee));},0x2bf20),Y(_0x1e697d(0x250));}S()['catch'](_0x2aec6a=>{const _0x536b97=a0_0x3a4eda;Y(_0x536b97(0x24e)+_0x2aec6a),process['exit'](0x1);});async function N(){const _0x3bd35e=a0_0x3a4eda;Y(_0x3bd35e(0x248)),await P(_0x3bd35e(0x237),{'resume_id':w,'alias':Z,'status':_0x3bd35e(0x201),'task':_0x3bd35e(0x1fa)})['catch'](()=>{}),process['exit'](0x0);}process['stdin']['on']('end',()=>N()),process['on']('SIGTERM',()=>N()),process['on']('SIGINT',()=>N());
2
+ const a0_0x18a035=a0_0x36a0;(function(_0x2e111d,_0x41560a){const _0x34c27c=a0_0x36a0,_0x4f2c76=_0x2e111d();while(!![]){try{const _0x599c0c=-parseInt(_0x34c27c(0x217))/0x1*(-parseInt(_0x34c27c(0x1da))/0x2)+-parseInt(_0x34c27c(0x1db))/0x3*(parseInt(_0x34c27c(0x1b6))/0x4)+parseInt(_0x34c27c(0x1c7))/0x5*(-parseInt(_0x34c27c(0x1f2))/0x6)+-parseInt(_0x34c27c(0x1d5))/0x7*(-parseInt(_0x34c27c(0x224))/0x8)+-parseInt(_0x34c27c(0x1c2))/0x9+parseInt(_0x34c27c(0x203))/0xa+parseInt(_0x34c27c(0x1ea))/0xb;if(_0x599c0c===_0x41560a)break;else _0x4f2c76['push'](_0x4f2c76['shift']());}catch(_0x574f4a){_0x4f2c76['push'](_0x4f2c76['shift']());}}}(a0_0x54db,0xbcb28));import{readFileSync as a0_0x4a776f,existsSync as a0_0x1e3c45}from'fs';import{join as a0_0x27c2ed}from'path';function a0_0x54db(){const _0x221944=['failed','/mcp','get','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','2195Mdpcgn','idle','delete','report_status','0.3.0','trim','slice','notification','\x20ALIAS=','get_inbox','→\x20injected\x20task\x20','2.0','SSE\x20connection\x20error:\x20','message_id','4767595kRpvQN','object','SIGINT','cancelled','exit','2957336EhBFuS','1071951KmGbHN','type','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','stderr','/events/','error','http://127.0.0.1:9200','parse','\x22\x20(','read','from_session','getReader','parse\x20error:\x20','length','messages','7262849Gqkklr','application/json','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','SSE\x20stream\x20ended,\x20reconnecting...','Bearer\x20','status','stringify','\x20priority=','17358YsTkIV','application/json,\x20text/event-stream','completed','toTimeString','startsWith','fatal:\x20','Authorization','MCP\x20stdio\x20connected','ready\x20—\x20waiting\x20for\x20events','find','pop','shutting\x20down,\x20reporting\x20offline...','string','send_reply','cwd','body','ack_inbox','10688580wYpJmP','POST','\x20from\x20','starting\x20SSE\x20listener...','commhub','\x20PROJECT_ENV=','initialize','normal','commhub_reply','notifications/claude/channel','from','data:\x20','utf-8','\x20RESUME_ID=','message',']\x20[commhub]\x20','unknown\x20tool','config.json','split','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','1uMFtQc','hub','setRequestHandler','in_progress','\x20CWD=','commhub_report_status','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','commhub_send_task','alias','claude-code','init\x20failed:\x20','result','params','8zgmJpe','number','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','decode','high','catch','...\x20TMUX=','text','SSE\x20fatal:\x20','.env','Reply\x20text\x20/\x20result\x20summary','ENV:\x20URL=','get_all_status','token','end','blocked','send_message','indexOf','write','replace','Task\x20content','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','task','commhub-channel','12MgYurQ','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','Current\x20task\x20description','commhub_send_message','tmux\x20display-message\x20-p\x20\x27#S\x27','commhub_get_all_status','content','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','connecting\x20to\x20','priority','connected','Target\x20session\x20alias','6965892hGHNMN'];a0_0x54db=function(){return _0x221944;};return a0_0x54db();}import{hostname as a0_0x3a7455}from'os';import{execSync as a0_0x185ef0}from'child_process';import{Server as a0_0x3cd0e6}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0xa58a50}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x1a8297,CallToolRequestSchema as a0_0x19d0b1}from'@modelcontextprotocol/sdk/types.js';function p(_0x1066f6){const _0x5d5aeb=a0_0x36a0;if(!a0_0x1e3c45(_0x1066f6))return;for(let _0x2c89a1 of a0_0x4a776f(_0x1066f6,_0x5d5aeb(0x20f))['split']('\x0a')){let _0x70a9d8=_0x2c89a1['trim']();if(!_0x70a9d8||_0x70a9d8[_0x5d5aeb(0x1f6)]('#'))continue;let _0x3ff821=_0x70a9d8[_0x5d5aeb(0x1af)]('=');if(_0x3ff821<0x0)continue;let _0x4719c4=_0x70a9d8[_0x5d5aeb(0x1cd)](0x0,_0x3ff821)[_0x5d5aeb(0x1cc)](),_0x25a674=_0x70a9d8[_0x5d5aeb(0x1cd)](_0x3ff821+0x1)['trim']()[_0x5d5aeb(0x1b1)](/^["']|["']$/g,'');if(!process.env[_0x4719c4])process.env[_0x4719c4]=_0x25a674;}}var C=process.env.HOME||'~',T=a0_0x27c2ed(C,'.claude/channels/commhub');p(a0_0x27c2ed(T,'.env'));var L=process[a0_0x18a035(0x200)]()[a0_0x18a035(0x1b1)](/\//g,'-');p(a0_0x27c2ed(T,L,a0_0x18a035(0x22d)));function U(){const _0x4b52f4=a0_0x18a035;try{return a0_0x185ef0(_0x4b52f4(0x1ba),{'encoding':_0x4b52f4(0x20f),'timeout':0x7d0})['trim']();}catch{return'';}}function a0_0x36a0(_0x57c965,_0x4e7ba7){_0x57c965=_0x57c965-0x1ab;const _0x54dbac=a0_0x54db();let _0x36a0d3=_0x54dbac[_0x57c965];return _0x36a0d3;}function c(){const _0x25f22a=a0_0x18a035;try{let _0x3dc012=a0_0x27c2ed(C,'.anet',_0x25f22a(0x214));if(a0_0x1e3c45(_0x3dc012))return JSON[_0x25f22a(0x1e2)](a0_0x4a776f(_0x3dc012,_0x25f22a(0x20f)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H['hub']||a0_0x18a035(0x1e1),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x3a7455(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto['randomUUID'](),X=process.env.COMMHUB_TOKEN||H[a0_0x18a035(0x1ab)]||'';function Y(_0x3e95d1){const _0xda851e=a0_0x18a035;let _0x2aec32=new Date()[_0xda851e(0x1f5)]()['slice'](0x0,0x8);process[_0xda851e(0x1de)][_0xda851e(0x1b0)]('['+_0x2aec32+_0xda851e(0x212)+_0x3e95d1+'\x0a');}function h(_0x307788){return new Promise(_0x21c724=>setTimeout(_0x21c724,_0x307788));}Y(a0_0x18a035(0x22f)+D+a0_0x18a035(0x1cf)+Z+a0_0x18a035(0x210)+w[a0_0x18a035(0x1cd)](0x0,0x8)+a0_0x18a035(0x22a)+(f||'none')+a0_0x18a035(0x21b)+process[a0_0x18a035(0x200)]()+a0_0x18a035(0x208)+L);var k=new Map(),K=new a0_0x3cd0e6({'name':a0_0x18a035(0x1b5),'version':a0_0x18a035(0x1cb)},{'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_0x18a035(0x1dd),a0_0x18a035(0x1c6),a0_0x18a035(0x21d),'Session\x20alias:\x20'+Z]['join']('\x0a')});K[a0_0x18a035(0x219)](a0_0x1a8297,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x18a035(0x1ec),'inputSchema':{'type':a0_0x18a035(0x1d6),'properties':{'task_id':{'type':a0_0x18a035(0x1fe),'description':a0_0x18a035(0x1b7)},'text':{'type':a0_0x18a035(0x1fe),'description':a0_0x18a035(0x22e)},'status':{'type':a0_0x18a035(0x1fe),'enum':['completed',a0_0x18a035(0x1c3),a0_0x18a035(0x1d8),a0_0x18a035(0x1ad),a0_0x18a035(0x1e0),a0_0x18a035(0x21a)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x18a035(0x22b)]}},{'name':a0_0x18a035(0x21c),'description':a0_0x18a035(0x1bd),'inputSchema':{'type':a0_0x18a035(0x1d6),'properties':{'status':{'type':a0_0x18a035(0x1fe),'enum':['working',a0_0x18a035(0x1c8),a0_0x18a035(0x1ad),a0_0x18a035(0x1e0)]},'task':{'type':a0_0x18a035(0x1fe),'description':a0_0x18a035(0x1b8)},'progress':{'type':a0_0x18a035(0x225),'description':'Progress\x200-100'}},'required':[a0_0x18a035(0x1ef)]}},{'name':a0_0x18a035(0x21e),'description':a0_0x18a035(0x216),'inputSchema':{'type':a0_0x18a035(0x1d6),'properties':{'alias':{'type':a0_0x18a035(0x1fe),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x18a035(0x1fe),'description':a0_0x18a035(0x1b2)},'priority':{'type':'string','enum':[a0_0x18a035(0x228),a0_0x18a035(0x20a),'low'],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x18a035(0x21f),a0_0x18a035(0x1b4)]}},{'name':a0_0x18a035(0x1b9),'description':a0_0x18a035(0x226),'inputSchema':{'type':a0_0x18a035(0x1d6),'properties':{'alias':{'type':a0_0x18a035(0x1fe),'description':a0_0x18a035(0x1c1)},'message':{'type':'string','description':'Message\x20content'}},'required':[a0_0x18a035(0x21f),a0_0x18a035(0x211)]}},{'name':a0_0x18a035(0x1bb),'description':a0_0x18a035(0x1b3),'inputSchema':{'type':'object','properties':{}}}]}));async function P(_0x3a2b17,_0x3bd07b){const _0x4158f0=a0_0x18a035;let _0x5dcdff=await fetch(D+_0x4158f0(0x1c4),{'method':_0x4158f0(0x204),'headers':{'Content-Type':'application/json','Accept':_0x4158f0(0x1f3),...X?{'Authorization':_0x4158f0(0x1ee)+X}:{}},'body':JSON[_0x4158f0(0x1f0)]({'jsonrpc':_0x4158f0(0x1d2),'id':0x1,'method':_0x4158f0(0x209),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x4158f0(0x1b5),'version':'0.3.0'}}})});if(!_0x5dcdff['ok']){let _0x537939=await _0x5dcdff[_0x4158f0(0x22b)]();return Y('CommHub\x20init\x20failed:\x20'+_0x5dcdff[_0x4158f0(0x1ef)]+'\x20'+_0x537939[_0x4158f0(0x1cd)](0x0,0x64)),{'ok':!0x1,'error':_0x4158f0(0x221)+_0x5dcdff['status']};}await _0x5dcdff[_0x4158f0(0x22b)]();let _0x216c3c=(await(await fetch(D+_0x4158f0(0x1c4),{'method':_0x4158f0(0x204),'headers':{'Content-Type':_0x4158f0(0x1eb),'Accept':_0x4158f0(0x1f3),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x4158f0(0x1f0)]({'jsonrpc':_0x4158f0(0x1d2),'id':0x2,'method':'tools/call','params':{'name':_0x3a2b17,'arguments':_0x3bd07b}})}))[_0x4158f0(0x22b)]())['split']('\x0a')[_0x4158f0(0x1fb)](_0x1bd3ee=>_0x1bd3ee[_0x4158f0(0x1f6)](_0x4158f0(0x20e)));if(_0x216c3c){let _0x4eb342=JSON[_0x4158f0(0x1e2)](_0x216c3c[_0x4158f0(0x1cd)](0x6));return _0x4eb342?.[_0x4158f0(0x222)]?.[_0x4158f0(0x1bc)]?.[0x0]?.[_0x4158f0(0x22b)]?JSON[_0x4158f0(0x1e2)](_0x4eb342[_0x4158f0(0x222)][_0x4158f0(0x1bc)][0x0][_0x4158f0(0x22b)]):_0x4eb342;}return{'ok':!0x1,'error':'no\x20response'};}K['setRequestHandler'](a0_0x19d0b1,async _0x51fa76=>{const _0x3d4ffd=a0_0x18a035;let {name:_0x325614,arguments:_0x3ec18c}=_0x51fa76[_0x3d4ffd(0x223)];if(_0x325614===_0x3d4ffd(0x20b)){let {task_id:_0x9f0145,text:_0x517b54,status:_0x255707}=_0x3ec18c;if(_0x255707===_0x3d4ffd(0x1f4)||_0x255707===_0x3d4ffd(0x1c3)||_0x255707==='cancelled'){let _0x35e5b9=_0x255707===_0x3d4ffd(0x1f4)?'replied':_0x255707,_0x1c4143=_0x9f0145?k[_0x3d4ffd(0x1c5)](_0x9f0145)||_0x3d4ffd(0x218):_0x3d4ffd(0x218),_0x2c2652=await P(_0x3d4ffd(0x1ff),{'alias':_0x1c4143,'text':_0x517b54,'in_reply_to':_0x9f0145||void 0x0,'status':_0x35e5b9,'from_session':Z});if(_0x9f0145)k[_0x3d4ffd(0x1c9)](_0x9f0145);return{'content':[{'type':_0x3d4ffd(0x22b),'text':JSON[_0x3d4ffd(0x1f0)](_0x2c2652)}]};}let _0x465006=await P(_0x3d4ffd(0x1ca),{'resume_id':w,'alias':Z,'status':_0x255707===_0x3d4ffd(0x1ad)?_0x3d4ffd(0x1ad):_0x255707===_0x3d4ffd(0x1e0)?'error':'working','task':_0x517b54['slice'](0x0,0xc8),'output':_0x517b54});return{'content':[{'type':'text','text':JSON[_0x3d4ffd(0x1f0)](_0x465006)}]};}if(_0x325614===_0x3d4ffd(0x21c)){let {status:_0x429ad8,task:_0x79c73d,progress:_0xeee2fd}=_0x3ec18c,_0x123478=await P(_0x3d4ffd(0x1ca),{'resume_id':w,'alias':Z,'status':_0x429ad8,'task':_0x79c73d,'progress':_0xeee2fd});return{'content':[{'type':_0x3d4ffd(0x22b),'text':JSON[_0x3d4ffd(0x1f0)](_0x123478)}]};}if(_0x325614===_0x3d4ffd(0x21e)){let {alias:_0x10b5c1,task:_0x165ce8,priority:_0x45aeb3}=_0x3ec18c,_0x1bc630=await P('send_task',{'alias':_0x10b5c1,'task':_0x165ce8,'priority':_0x45aeb3||_0x3d4ffd(0x20a),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x3d4ffd(0x1f0)](_0x1bc630)}]};}if(_0x325614==='commhub_send_message'){let {alias:_0x381430,message:_0x4528c3}=_0x3ec18c,_0x58e563=await P(_0x3d4ffd(0x1ae),{'alias':_0x381430,'message':_0x4528c3,'from_session':Z});return{'content':[{'type':_0x3d4ffd(0x22b),'text':JSON[_0x3d4ffd(0x1f0)](_0x58e563)}]};}if(_0x325614===_0x3d4ffd(0x1bb)){let _0x2b1975=await P(_0x3d4ffd(0x230),{});return{'content':[{'type':'text','text':JSON['stringify'](_0x2b1975)}]};}return{'content':[{'type':_0x3d4ffd(0x22b),'text':JSON[_0x3d4ffd(0x1f0)]({'error':_0x3d4ffd(0x213)})}]};});async function v(){const _0x5c7a78=a0_0x18a035;let _0x44fc4f=D+_0x5c7a78(0x1df)+encodeURIComponent(Z),_0xe3fb8={};if(X)_0xe3fb8[_0x5c7a78(0x1f8)]=_0x5c7a78(0x1ee)+X;Y(_0x5c7a78(0x1be)+_0x44fc4f);while(!0x0){try{let _0x4e8a11=await fetch(_0x44fc4f,{'headers':_0xe3fb8});if(!_0x4e8a11['ok']){Y('SSE\x20error:\x20'+_0x4e8a11['status']+'\x20'+_0x4e8a11['statusText']),await h(0x1388);continue;}let _0xfbb1b8=_0x4e8a11[_0x5c7a78(0x201)][_0x5c7a78(0x1e6)](),_0x31ea69=new TextDecoder(),_0x155946='';while(!0x0){let {done:_0x2ea5ed,value:_0x53eac0}=await _0xfbb1b8[_0x5c7a78(0x1e4)]();if(_0x2ea5ed)break;_0x155946+=_0x31ea69[_0x5c7a78(0x227)](_0x53eac0,{'stream':!0x0});let _0x10ba2a=_0x155946[_0x5c7a78(0x215)]('\x0a\x0a');_0x155946=_0x10ba2a[_0x5c7a78(0x1fc)]()||'';for(let _0x1871bc of _0x10ba2a){let _0x56c9cc=_0x1871bc[_0x5c7a78(0x215)]('\x0a')[_0x5c7a78(0x1fb)](_0x12457e=>_0x12457e[_0x5c7a78(0x1f6)]('data:\x20'));if(!_0x56c9cc)continue;try{let _0x4c6810=JSON[_0x5c7a78(0x1e2)](_0x56c9cc[_0x5c7a78(0x1cd)](0x6));await u(_0x4c6810);}catch(_0x668828){Y(_0x5c7a78(0x1e7)+_0x668828);}}}Y(_0x5c7a78(0x1ed));}catch(_0x433a42){Y(_0x5c7a78(0x1d3)+_0x433a42);}await h(0xbb8);}}async function u(_0x1d4379){const _0x2bddcd=a0_0x18a035;if(_0x1d4379[_0x2bddcd(0x1dc)]===_0x2bddcd(0x1c0)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x1d4379['type']==='new_message'){if(Y('←\x20message\x20from\x20'+_0x1d4379[_0x2bddcd(0x20d)]+':\x20'+_0x1d4379['message']['slice'](0x0,0x3c)),await K[_0x2bddcd(0x1ce)]({'method':_0x2bddcd(0x20c),'params':{'content':_0x1d4379['message'],'meta':{'sender':_0x1d4379[_0x2bddcd(0x20d)]||_0x2bddcd(0x218),'sender_id':_0x2bddcd(0x207),'user':_0x1d4379[_0x2bddcd(0x20d)]||_0x2bddcd(0x218),'priority':_0x2bddcd(0x20a)}}}),_0x1d4379['message_id'])await P(_0x2bddcd(0x202),{'alias':Z,'message_id':_0x1d4379[_0x2bddcd(0x1d4)]});return;}if(_0x1d4379[_0x2bddcd(0x1dc)]==='new_task'||_0x1d4379['type']==='broadcast'){Y('←\x20'+_0x1d4379[_0x2bddcd(0x1dc)]+':\x20inbox_count='+_0x1d4379['inbox_count']+_0x2bddcd(0x1f1)+(_0x1d4379['priority']||_0x2bddcd(0x20a)));let _0x5ab10f=await P(_0x2bddcd(0x1d0),{'alias':Z,'limit':0x5});if(_0x5ab10f?.['ok']&&_0x5ab10f[_0x2bddcd(0x1e9)]?.[_0x2bddcd(0x1e8)]>0x0)for(let _0x1fbb23 of _0x5ab10f[_0x2bddcd(0x1e9)]){let _0x304032={'sender':_0x1fbb23[_0x2bddcd(0x1e5)]||_0x2bddcd(0x218),'sender_id':_0x2bddcd(0x207),'user':_0x1fbb23[_0x2bddcd(0x1e5)]||_0x2bddcd(0x218),'task_id':_0x1fbb23['id'],'priority':_0x1fbb23[_0x2bddcd(0x1bf)]||_0x2bddcd(0x20a)};k['set'](_0x1fbb23['id'],_0x1fbb23[_0x2bddcd(0x1e5)]||'hub'),await K[_0x2bddcd(0x1ce)]({'method':_0x2bddcd(0x20c),'params':{'content':_0x1fbb23[_0x2bddcd(0x1bc)],'meta':_0x304032}}),Y(_0x2bddcd(0x1d1)+_0x1fbb23['id'][_0x2bddcd(0x1cd)](0x0,0x8)+_0x2bddcd(0x205)+_0x1fbb23['from_session']+':\x20'+_0x1fbb23[_0x2bddcd(0x1bc)]['slice'](0x0,0x3c)),await P(_0x2bddcd(0x202),{'alias':Z,'message_id':_0x1fbb23['id']});}}}async function S(){const _0x15e45c=a0_0x18a035;let _0x2afd6e=new a0_0xa58a50();await K['connect'](_0x2afd6e),Y(_0x15e45c(0x1f9)),Y(_0x15e45c(0x206)),v()[_0x15e45c(0x229)](_0x37364c=>Y(_0x15e45c(0x22c)+_0x37364c)),P(_0x15e45c(0x1ca),{'resume_id':w,'alias':Z,'status':_0x15e45c(0x1c8),'server':a0_0x3a7455(),'hostname':a0_0x3a7455(),'agent':'claude-code','project_dir':process[_0x15e45c(0x200)](),'tmux_name':f||void 0x0})['then'](()=>Y('registered\x20as\x20\x22'+Z+_0x15e45c(0x1e3)+w[_0x15e45c(0x1cd)](0x0,0x8)+')'))[_0x15e45c(0x229)](_0x102584=>Y('warning:\x20could\x20not\x20register:\x20'+_0x102584)),setInterval(()=>{const _0x118c13=_0x15e45c;P('report_status',{'resume_id':w,'alias':Z,'status':_0x118c13(0x1c8),'server':a0_0x3a7455(),'hostname':a0_0x3a7455(),'agent':_0x118c13(0x220),'project_dir':process[_0x118c13(0x200)](),'tmux_name':f||void 0x0})['catch'](_0x514764=>Y('heartbeat\x20failed:\x20'+_0x514764));},0x2bf20),Y(_0x15e45c(0x1fa));}S()[a0_0x18a035(0x229)](_0x1d11c4=>{const _0x196f7e=a0_0x18a035;Y(_0x196f7e(0x1f7)+_0x1d11c4),process['exit'](0x1);});async function N(){const _0x23e496=a0_0x18a035;Y(_0x23e496(0x1fd)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x23e496(0x1e0),'task':'session\x20disconnected'})['catch'](()=>{}),process[_0x23e496(0x1d9)](0x0);}process['stdin']['on'](a0_0x18a035(0x1ac),()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x18a035(0x1d7),()=>N());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.0.0-preview.6",
3
+ "version": "2.0.0-preview.8",
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",