@sleep2agi/agent-network 2.0.0-preview.1 → 2.0.0-preview.11

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_0x3b58d7=a0_0x339c;(function(_0x33760c,_0x3c9855){const _0x20ecdc=a0_0x339c,_0x5ad7a2=_0x33760c();while(!![]){try{const _0x5d59de=parseInt(_0x20ecdc(0xef))/0x1*(-parseInt(_0x20ecdc(0xda))/0x2)+parseInt(_0x20ecdc(0xe8))/0x3+parseInt(_0x20ecdc(0x104))/0x4+-parseInt(_0x20ecdc(0xf8))/0x5+-parseInt(_0x20ecdc(0x112))/0x6+parseInt(_0x20ecdc(0x102))/0x7*(parseInt(_0x20ecdc(0xd0))/0x8)+-parseInt(_0x20ecdc(0x113))/0x9*(-parseInt(_0x20ecdc(0xf1))/0xa);if(_0x5d59de===_0x3c9855)break;else _0x5ad7a2['push'](_0x5ad7a2['shift']());}catch(_0x4a0222){_0x5ad7a2['push'](_0x5ad7a2['shift']());}}}(a0_0x9af3,0xac47b));function a0_0x339c(_0x4416dc,_0x1e9dfd){_0x4416dc=_0x4416dc-0xc7;const _0x9af3af=a0_0x9af3();let _0x339cb3=_0x9af3af[_0x4416dc];return _0x339cb3;}import{EventEmitter as a0_0x3595b8}from'events';import{hostname as a0_0x47450e}from'os';class T extends a0_0x3595b8{[a0_0x3b58d7(0xfa)];[a0_0x3b58d7(0xd8)];[a0_0x3b58d7(0xd4)];[a0_0x3b58d7(0xd7)];[a0_0x3b58d7(0xfd)];[a0_0x3b58d7(0x10e)];[a0_0x3b58d7(0x10c)];[a0_0x3b58d7(0x116)];[a0_0x3b58d7(0xf6)];[a0_0x3b58d7(0xfb)]=!0x1;constructor(_0x1021af){const _0x83c9c9=a0_0x3b58d7;super();if(this[_0x83c9c9(0xfa)]=_0x1021af[_0x83c9c9(0xfa)][_0x83c9c9(0xf7)](/\/$/,''),this[_0x83c9c9(0xd8)]=_0x1021af['alias'],this[_0x83c9c9(0xd4)]=_0x1021af[_0x83c9c9(0xd4)],this[_0x83c9c9(0xd7)]=_0x1021af[_0x83c9c9(0xd7)]||_0x83c9c9(0xd1),this[_0x83c9c9(0xfd)]=_0x83c9c9(0xe5)+_0x1021af[_0x83c9c9(0xd8)]+'-'+Date[_0x83c9c9(0x119)]()[_0x83c9c9(0xff)](0x24),this[_0x83c9c9(0x10e)]=_0x1021af[_0x83c9c9(0x10e)]??0x2bf20,this['reconnectDelay']=_0x1021af[_0x83c9c9(0x10c)]??0xbb8,_0x1021af[_0x83c9c9(0xcf)]!==!0x1)this[_0x83c9c9(0xf0)]();}[a0_0x3b58d7(0x117)](_0x12281c){const _0x1343a5=a0_0x3b58d7;console[_0x1343a5(0x117)]('['+new Date()[_0x1343a5(0xe9)]()[_0x1343a5(0xf9)](0x0,0x8)+_0x1343a5(0x11b)+this[_0x1343a5(0xd8)]+']\x20'+_0x12281c);}async['call'](_0x27200a,_0x2479c3){const _0x4b099b=a0_0x3b58d7;let _0x5a889a={'Content-Type':_0x4b099b(0x103),'Accept':_0x4b099b(0x118)};if(this[_0x4b099b(0xd4)])_0x5a889a[_0x4b099b(0xd9)]=_0x4b099b(0xd5)+this[_0x4b099b(0xd4)];let _0x3956b1=await(await fetch(this['url']+_0x4b099b(0xe3),{'method':_0x4b099b(0xc7),'headers':_0x5a889a,'body':JSON[_0x4b099b(0xdb)]({'jsonrpc':_0x4b099b(0xf5),'id':Date[_0x4b099b(0x119)](),'method':'tools/call','params':{'name':_0x27200a,'arguments':_0x2479c3}})}))[_0x4b099b(0xce)](),_0x41c54a=_0x3956b1[_0x4b099b(0xe6)](/data: (.+)/),_0x4ea34=_0x41c54a?JSON[_0x4b099b(0xea)](_0x41c54a[0x1]):JSON['parse'](_0x3956b1),_0x21e983=_0x4ea34?.[_0x4b099b(0xcb)]?.['content']?.[0x0]?.[_0x4b099b(0xce)];return _0x21e983?JSON[_0x4b099b(0xea)](_0x21e983):_0x4ea34;}async[a0_0x3b58d7(0xf0)](){const _0x2a531a=a0_0x3b58d7;if(this[_0x2a531a(0xfb)])return;this['running']=!0x0,await this[_0x2a531a(0xeb)](_0x2a531a(0xe7)),this[_0x2a531a(0x117)](_0x2a531a(0xf2)),this['heartbeatTimer']=setInterval(()=>{const _0x33c91f=_0x2a531a;this[_0x33c91f(0xeb)](_0x33c91f(0xe7))[_0x33c91f(0xed)](_0x1bbf90=>this[_0x33c91f(0x117)](_0x33c91f(0x109)+_0x1bbf90[_0x33c91f(0xfe)]));},this['heartbeatInterval']),this[_0x2a531a(0xc8)]();}async[a0_0x3b58d7(0xd6)](){const _0x4c44e9=a0_0x3b58d7;if(this[_0x4c44e9(0xfb)]=!0x1,this[_0x4c44e9(0xf6)]?.['abort'](),this[_0x4c44e9(0x116)])clearInterval(this['heartbeatTimer']);await this[_0x4c44e9(0xeb)](_0x4c44e9(0x11a))[_0x4c44e9(0xed)](()=>{}),this[_0x4c44e9(0x117)](_0x4c44e9(0x107));}async['send'](_0xb5739a,_0x5ec8da,_0x3393e4=a0_0x3b58d7(0xcd)){const _0x271687=a0_0x3b58d7;return this[_0x271687(0xee)]('send_task',{'alias':_0xb5739a,'task':_0x5ec8da,'priority':_0x3393e4,'from_session':this[_0x271687(0xd8)]});}async[a0_0x3b58d7(0xfe)](_0x2c75d0,_0x1698b0){const _0xb4fe24=a0_0x3b58d7;return this[_0xb4fe24(0xee)](_0xb4fe24(0x10a),{'alias':_0x2c75d0,'message':_0x1698b0,'from_session':this['alias']});}async[a0_0x3b58d7(0xf4)](_0x9c3ce6,_0x1839a6,_0x1288b8='completed'){const _0x3a7cb8=a0_0x3b58d7;return this['call'](_0x3a7cb8(0xf4),{'task_id':_0x9c3ce6,'text':_0x1839a6,'status':_0x1288b8});}async[a0_0x3b58d7(0xeb)](_0x14dd7e,_0x1a8893){const _0x265259=a0_0x3b58d7;return this['call'](_0x265259(0xdd),{'resume_id':this[_0x265259(0xfd)],'alias':this[_0x265259(0xd8)],'status':_0x14dd7e,'server':a0_0x47450e(),'hostname':a0_0x47450e(),'agent':this[_0x265259(0xd7)],'project_dir':process[_0x265259(0x106)](),..._0x1a8893});}async[a0_0x3b58d7(0x111)](){const _0x49cd23=a0_0x3b58d7;return this[_0x49cd23(0xee)]('get_all_status',{});}async[a0_0x3b58d7(0xde)](_0x55abdc,_0x4af47e){const _0x88acb7=a0_0x3b58d7;return this[_0x88acb7(0xee)]('broadcast',{'message':_0x55abdc,'filter_server':_0x4af47e?.['server'],'filter_status':_0x4af47e?.['status']});}async['connectSSE'](){const _0x5ac432=a0_0x3b58d7;let _0x12f7af=encodeURIComponent(this[_0x5ac432(0xd8)]),_0x425227=this[_0x5ac432(0xfa)]+'/events/'+_0x12f7af,_0x5d33e2=this['reconnectDelay'];while(this[_0x5ac432(0xfb)]){try{this['sseAbort']=new AbortController();let _0x24c578={'Accept':_0x5ac432(0x10d)};if(this['token'])_0x24c578[_0x5ac432(0xd9)]=_0x5ac432(0xd5)+this[_0x5ac432(0xd4)];let _0x28076a=await fetch(_0x425227,{'headers':_0x24c578,'signal':this[_0x5ac432(0xf6)][_0x5ac432(0xca)]});if(!_0x28076a['ok']||!_0x28076a[_0x5ac432(0xe0)]){this[_0x5ac432(0x117)]('SSE\x20failed:\x20'+_0x28076a[_0x5ac432(0xeb)]),await this[_0x5ac432(0xc9)](_0x5d33e2),_0x5d33e2=Math[_0x5ac432(0x10b)](_0x5d33e2*1.5,0xea60);continue;}_0x5d33e2=this[_0x5ac432(0x10c)];let _0x3c9dc5=_0x28076a[_0x5ac432(0xe0)][_0x5ac432(0xd2)](),_0x5af485=new TextDecoder(),_0x168c28='';while(this[_0x5ac432(0xfb)]){let {done:_0x21967d,value:_0x5e0203}=await _0x3c9dc5[_0x5ac432(0xdc)]();if(_0x21967d)break;_0x168c28+=_0x5af485[_0x5ac432(0x115)](_0x5e0203,{'stream':!0x0});let _0x50093a=_0x168c28[_0x5ac432(0xd3)]('\x0a');_0x168c28=_0x50093a[_0x5ac432(0xe1)]()||'';for(let _0x597fe3 of _0x50093a){if(!_0x597fe3[_0x5ac432(0x110)]('data:\x20'))continue;try{let _0x55da8e=JSON[_0x5ac432(0xea)](_0x597fe3[_0x5ac432(0xf9)](0x6));if(_0x55da8e['type']==='connected'){this[_0x5ac432(0x117)](_0x5ac432(0xe4)),this[_0x5ac432(0x105)]('connected');continue;}if(_0x55da8e[_0x5ac432(0xe2)]===_0x5ac432(0xdf)||_0x55da8e[_0x5ac432(0xe2)]===_0x5ac432(0xfc)||_0x55da8e[_0x5ac432(0xe2)]===_0x5ac432(0xde))await this['processInbox']();}catch{}}}}catch(_0x2c9e76){if(_0x2c9e76[_0x5ac432(0x108)]==='AbortError')break;this[_0x5ac432(0x105)]('error',_0x2c9e76),this[_0x5ac432(0x117)](_0x5ac432(0xcc)+_0x2c9e76[_0x5ac432(0xfe)]);}if(this[_0x5ac432(0xfb)])this['emit']('disconnected'),this[_0x5ac432(0x117)]('SSE\x20reconnecting\x20in\x20'+_0x5d33e2/0x3e8+_0x5ac432(0x101)),await this['sleep'](_0x5d33e2),_0x5d33e2=Math[_0x5ac432(0x10b)](_0x5d33e2*1.5,0xea60);}}async[a0_0x3b58d7(0x10f)](){const _0x5e1159=a0_0x3b58d7;try{let _0x392361=(await this[_0x5e1159(0xee)]('get_inbox',{'alias':this[_0x5e1159(0xd8)],'limit':0xa}))?.[_0x5e1159(0xf3)]||[];for(let _0x386bc9 of _0x392361)await this['call'](_0x5e1159(0x114),{'alias':this[_0x5e1159(0xd8)],'message_id':_0x386bc9['id']}),this['log']('←\x20'+_0x386bc9['from_session']+':\x20'+_0x386bc9[_0x5e1159(0x100)]['slice'](0x0,0x3c)),this[_0x5e1159(0x105)]('task',_0x386bc9),this[_0x5e1159(0x105)](_0x5e1159(0xfe),_0x386bc9);}catch(_0x909004){this[_0x5e1159(0x117)](_0x5e1159(0xec)+_0x909004[_0x5e1159(0xfe)]);}}[a0_0x3b58d7(0xc9)](_0x4cc15a){return new Promise(_0x156384=>setTimeout(_0x156384,_0x4cc15a));}}var $=T;export{$ as default,T as CommHub};function a0_0x9af3(){const _0x142a94=['application/json','248816aPCtQf','emit','cwd','disconnected','name','heartbeat\x20failed:\x20','send_message','min','reconnectDelay','text/event-stream','heartbeatInterval','processInbox','startsWith','getAllStatus','7877298MjAsWz','9LgRKxq','ack_inbox','decode','heartbeatTimer','log','application/json,\x20text/event-stream','now','offline',']\x20[commhub:','POST','connectSSE','sleep','signal','result','SSE\x20error:\x20','normal','text','autoConnect','32Tfzcwk','sdk','getReader','split','token','Bearer\x20','disconnect','agent','alias','Authorization','760deqWbi','stringify','read','report_status','broadcast','new_task','body','pop','type','/mcp','SSE\x20connected','sdk-','match','idle','825396yOkIix','toTimeString','parse','status','inbox\x20error:\x20','catch','call','2129qZHtws','connect','16768190tRsSop','registered','messages','reply','2.0','sseAbort','replace','2522805UivuEI','slice','url','running','new_message','resumeId','message','toString','content','s...','2306444KzSWlr'];a0_0x9af3=function(){return _0x142a94;};return a0_0x9af3();}
1
+ const a0_0x24fd3f=a0_0x2673;(function(_0x3850fc,_0x8fc892){const _0x2eccd4=a0_0x2673,_0x4d1362=_0x3850fc();while(!![]){try{const _0x234104=-parseInt(_0x2eccd4(0x18e))/0x1*(-parseInt(_0x2eccd4(0x1a7))/0x2)+parseInt(_0x2eccd4(0x194))/0x3*(parseInt(_0x2eccd4(0x19d))/0x4)+-parseInt(_0x2eccd4(0x18c))/0x5+parseInt(_0x2eccd4(0x1d3))/0x6+-parseInt(_0x2eccd4(0x1b3))/0x7*(-parseInt(_0x2eccd4(0x1ca))/0x8)+parseInt(_0x2eccd4(0x1d4))/0x9*(-parseInt(_0x2eccd4(0x1af))/0xa)+-parseInt(_0x2eccd4(0x1ac))/0xb;if(_0x234104===_0x8fc892)break;else _0x4d1362['push'](_0x4d1362['shift']());}catch(_0x1e0d34){_0x4d1362['push'](_0x4d1362['shift']());}}}(a0_0x2ec4,0xce265));import{EventEmitter as a0_0x7973b0}from'events';import{hostname as a0_0x29f5c7}from'os';function a0_0x2673(_0x4b8471,_0x29e175){_0x4b8471=_0x4b8471-0x17c;const _0x2ec405=a0_0x2ec4();let _0x26734f=_0x2ec405[_0x4b8471];return _0x26734f;}class T extends a0_0x7973b0{[a0_0x24fd3f(0x1bc)];['alias'];[a0_0x24fd3f(0x1a6)];[a0_0x24fd3f(0x198)];[a0_0x24fd3f(0x1c3)];[a0_0x24fd3f(0x1aa)];[a0_0x24fd3f(0x1c7)];[a0_0x24fd3f(0x1a8)];[a0_0x24fd3f(0x1c2)];[a0_0x24fd3f(0x1ba)]=!0x1;constructor(_0x546ea1){const _0xd0c9ec=a0_0x24fd3f;super();if(this['url']=_0x546ea1[_0xd0c9ec(0x1bc)][_0xd0c9ec(0x182)](/\/$/,''),this[_0xd0c9ec(0x1d0)]=_0x546ea1[_0xd0c9ec(0x1d0)],this[_0xd0c9ec(0x1a6)]=_0x546ea1[_0xd0c9ec(0x1a6)],this[_0xd0c9ec(0x198)]=_0x546ea1[_0xd0c9ec(0x198)]||_0xd0c9ec(0x17e),this[_0xd0c9ec(0x1c3)]=_0xd0c9ec(0x1a0)+_0x546ea1[_0xd0c9ec(0x1d0)]+'-'+Date[_0xd0c9ec(0x1c1)]()[_0xd0c9ec(0x1c8)](0x24),this[_0xd0c9ec(0x1aa)]=_0x546ea1['heartbeatInterval']??0x2bf20,this[_0xd0c9ec(0x1c7)]=_0x546ea1['reconnectDelay']??0xbb8,_0x546ea1[_0xd0c9ec(0x1a3)]!==!0x1)this['connect']();}[a0_0x24fd3f(0x1b0)](_0x2da1e5){const _0x3ef5f0=a0_0x24fd3f;console[_0x3ef5f0(0x1b0)]('['+new Date()['toTimeString']()[_0x3ef5f0(0x1b6)](0x0,0x8)+_0x3ef5f0(0x191)+this[_0x3ef5f0(0x1d0)]+']\x20'+_0x2da1e5);}async[a0_0x24fd3f(0x1cb)](_0x19ec8b,_0x36e23c){const _0x3a89f1=a0_0x24fd3f;let _0x27170d={'Content-Type':'application/json','Accept':_0x3a89f1(0x1c6)};if(this[_0x3a89f1(0x1a6)])_0x27170d[_0x3a89f1(0x183)]='Bearer\x20'+this[_0x3a89f1(0x1a6)];let _0x5ddb5d=await(await fetch(this[_0x3a89f1(0x1bc)]+_0x3a89f1(0x19c),{'method':_0x3a89f1(0x1ce),'headers':_0x27170d,'body':JSON[_0x3a89f1(0x1b8)]({'jsonrpc':_0x3a89f1(0x1d2),'id':Date[_0x3a89f1(0x1c1)](),'method':_0x3a89f1(0x1c5),'params':{'name':_0x19ec8b,'arguments':_0x36e23c}})}))[_0x3a89f1(0x18b)](),_0x3d6b66=_0x5ddb5d['match'](/data: (.+)/),_0x55d345=_0x3d6b66?JSON[_0x3a89f1(0x19b)](_0x3d6b66[0x1]):JSON[_0x3a89f1(0x19b)](_0x5ddb5d),_0x546625=_0x55d345?.['result']?.[_0x3a89f1(0x1b2)]?.[0x0]?.[_0x3a89f1(0x18b)];return _0x546625?JSON['parse'](_0x546625):_0x55d345;}async[a0_0x24fd3f(0x19f)](){const _0x1d3946=a0_0x24fd3f;if(this[_0x1d3946(0x1ba)])return;this[_0x1d3946(0x1ba)]=!0x0,await this[_0x1d3946(0x187)](_0x1d3946(0x196)),this[_0x1d3946(0x1b0)](_0x1d3946(0x1c4)),this[_0x1d3946(0x1a8)]=setInterval(()=>{const _0x37e897=_0x1d3946;this[_0x37e897(0x187)](_0x37e897(0x196))['catch'](_0x256e81=>this['log'](_0x37e897(0x1a4)+_0x256e81[_0x37e897(0x188)]));},this[_0x1d3946(0x1aa)]),this[_0x1d3946(0x1cf)]();}async[a0_0x24fd3f(0x1cc)](){const _0x412ca2=a0_0x24fd3f;if(this[_0x412ca2(0x1ba)]=!0x1,this['sseAbort']?.[_0x412ca2(0x1d5)](),this[_0x412ca2(0x1a8)])clearInterval(this[_0x412ca2(0x1a8)]);await this[_0x412ca2(0x187)](_0x412ca2(0x186))[_0x412ca2(0x1ae)](()=>{}),this['log'](_0x412ca2(0x1a9));}async[a0_0x24fd3f(0x199)](_0x5e301a,_0x1692b5,_0x54f3ed='normal'){const _0x5e1793=a0_0x24fd3f;return this[_0x5e1793(0x1cb)]('send_task',{'alias':_0x5e301a,'task':_0x1692b5,'priority':_0x54f3ed,'from_session':this[_0x5e1793(0x1d0)]});}async[a0_0x24fd3f(0x188)](_0x8da39d,_0x309afb){const _0x158528=a0_0x24fd3f;return this[_0x158528(0x1cb)](_0x158528(0x1bd),{'alias':_0x8da39d,'message':_0x309afb,'from_session':this[_0x158528(0x1d0)]});}async[a0_0x24fd3f(0x1ad)](_0x2c2afc,_0x31b43b,_0x2b8643=a0_0x24fd3f(0x193)){const _0x5046f9=a0_0x24fd3f;return this['call'](_0x5046f9(0x1ad),{'task_id':_0x2c2afc,'text':_0x31b43b,'status':_0x2b8643});}async[a0_0x24fd3f(0x187)](_0x13110a,_0xfb4675){const _0x403a96=a0_0x24fd3f;return this[_0x403a96(0x1cb)](_0x403a96(0x1b9),{'resume_id':this[_0x403a96(0x1c3)],'alias':this[_0x403a96(0x1d0)],'status':_0x13110a,'server':a0_0x29f5c7(),'hostname':a0_0x29f5c7(),'agent':this[_0x403a96(0x198)],'project_dir':process[_0x403a96(0x1b7)](),..._0xfb4675});}async[a0_0x24fd3f(0x19e)](){const _0x2ddc20=a0_0x24fd3f;return this['call'](_0x2ddc20(0x17c),{});}async[a0_0x24fd3f(0x192)](_0x5f08b2,_0x3e88c4){const _0x1bea64=a0_0x24fd3f;return this[_0x1bea64(0x1cb)](_0x1bea64(0x192),{'message':_0x5f08b2,'filter_server':_0x3e88c4?.['server'],'filter_status':_0x3e88c4?.[_0x1bea64(0x187)]});}async[a0_0x24fd3f(0x1cf)](){const _0x5281b6=a0_0x24fd3f;let _0x510c63=encodeURIComponent(this['alias']),_0x421625=this[_0x5281b6(0x1bc)]+'/events/'+_0x510c63,_0x2d2efd=this[_0x5281b6(0x1c7)];while(this[_0x5281b6(0x1ba)]){try{this['sseAbort']=new AbortController();let _0x421801={'Accept':'text/event-stream'};if(this['token'])_0x421801[_0x5281b6(0x183)]=_0x5281b6(0x1bf)+this[_0x5281b6(0x1a6)];let _0x3f3130=await fetch(_0x421625,{'headers':_0x421801,'signal':this[_0x5281b6(0x1c2)][_0x5281b6(0x17f)]});if(!_0x3f3130['ok']||!_0x3f3130[_0x5281b6(0x1cd)]){this[_0x5281b6(0x1b0)](_0x5281b6(0x195)+_0x3f3130['status']),await this[_0x5281b6(0x1b5)](_0x2d2efd),_0x2d2efd=Math[_0x5281b6(0x1a5)](_0x2d2efd*1.5,0xea60);continue;}_0x2d2efd=this['reconnectDelay'];let _0x33a119=_0x3f3130[_0x5281b6(0x1cd)][_0x5281b6(0x1bb)](),_0x292e40=new TextDecoder(),_0x587ecd='';while(this[_0x5281b6(0x1ba)]){let {done:_0x12e804,value:_0x543e94}=await _0x33a119[_0x5281b6(0x1b4)]();if(_0x12e804)break;_0x587ecd+=_0x292e40[_0x5281b6(0x180)](_0x543e94,{'stream':!0x0});let _0x460949=_0x587ecd[_0x5281b6(0x1d1)]('\x0a');_0x587ecd=_0x460949[_0x5281b6(0x197)]()||'';for(let _0x533b0a of _0x460949){if(!_0x533b0a[_0x5281b6(0x1b1)](_0x5281b6(0x18d)))continue;try{let _0x4e90c2=JSON[_0x5281b6(0x19b)](_0x533b0a[_0x5281b6(0x1b6)](0x6));if(_0x4e90c2[_0x5281b6(0x185)]===_0x5281b6(0x19a)){this[_0x5281b6(0x1b0)](_0x5281b6(0x184)),this[_0x5281b6(0x1a2)](_0x5281b6(0x19a));continue;}if(_0x4e90c2[_0x5281b6(0x185)]==='new_task'||_0x4e90c2[_0x5281b6(0x185)]===_0x5281b6(0x189)||_0x4e90c2[_0x5281b6(0x185)]===_0x5281b6(0x192))await this[_0x5281b6(0x17d)]();}catch{}}}}catch(_0x481058){if(_0x481058[_0x5281b6(0x18f)]===_0x5281b6(0x190))break;this[_0x5281b6(0x1a2)](_0x5281b6(0x1c9),_0x481058),this[_0x5281b6(0x1b0)](_0x5281b6(0x1ab)+_0x481058[_0x5281b6(0x188)]);}if(this[_0x5281b6(0x1ba)])this[_0x5281b6(0x1a2)](_0x5281b6(0x1a9)),this['log'](_0x5281b6(0x1be)+_0x2d2efd/0x3e8+_0x5281b6(0x1a1)),await this[_0x5281b6(0x1b5)](_0x2d2efd),_0x2d2efd=Math[_0x5281b6(0x1a5)](_0x2d2efd*1.5,0xea60);}}async[a0_0x24fd3f(0x17d)](){const _0x11ac9c=a0_0x24fd3f;try{let _0x5ddde2=(await this[_0x11ac9c(0x1cb)]('get_inbox',{'alias':this[_0x11ac9c(0x1d0)],'limit':0xa}))?.[_0x11ac9c(0x18a)]||[];for(let _0x46be29 of _0x5ddde2)await this[_0x11ac9c(0x1cb)](_0x11ac9c(0x181),{'alias':this[_0x11ac9c(0x1d0)],'message_id':_0x46be29['id']}),this[_0x11ac9c(0x1b0)]('←\x20'+_0x46be29['from_session']+':\x20'+_0x46be29[_0x11ac9c(0x1b2)][_0x11ac9c(0x1b6)](0x0,0x3c)),this[_0x11ac9c(0x1a2)](_0x11ac9c(0x1c0),_0x46be29),this[_0x11ac9c(0x1a2)](_0x11ac9c(0x188),_0x46be29);}catch(_0x473b26){this[_0x11ac9c(0x1b0)]('inbox\x20error:\x20'+_0x473b26[_0x11ac9c(0x188)]);}}[a0_0x24fd3f(0x1b5)](_0x2c5ecb){return new Promise(_0x2cc1c3=>setTimeout(_0x2cc1c3,_0x2c5ecb));}}var $=T;function a0_0x2ec4(){const _0x11e678=['resumeId','registered','tools/call','application/json,\x20text/event-stream','reconnectDelay','toString','error','6040GFxGYo','call','disconnect','body','POST','connectSSE','alias','split','2.0','8253654WElNof','36333sBfpPx','abort','get_all_status','processInbox','sdk','signal','decode','ack_inbox','replace','Authorization','SSE\x20connected','type','offline','status','message','new_message','messages','text','1782635sxIwKE','data:\x20','1sEilVg','name','AbortError',']\x20[commhub:','broadcast','completed','15177UcMBWg','SSE\x20failed:\x20','idle','pop','agent','send','connected','parse','/mcp','892IvGDbf','getAllStatus','connect','sdk-','s...','emit','autoConnect','heartbeat\x20failed:\x20','min','token','2854998LmTmQX','heartbeatTimer','disconnected','heartbeatInterval','SSE\x20error:\x20','20657483VgRQOU','reply','catch','2680OUensR','log','startsWith','content','2128tUTbbv','read','sleep','slice','cwd','stringify','report_status','running','getReader','url','send_message','SSE\x20reconnecting\x20in\x20','Bearer\x20','task','now','sseAbort'];a0_0x2ec4=function(){return _0x11e678;};return a0_0x2ec4();}export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x4e5ac0=a0_0x2999;(function(_0x51044d,_0x358a1e){const _0x430d25=a0_0x2999,_0x44c354=_0x51044d();while(!![]){try{const _0x5a91bc=-parseInt(_0x430d25(0x168))/0x1*(-parseInt(_0x430d25(0x142))/0x2)+-parseInt(_0x430d25(0x12f))/0x3+-parseInt(_0x430d25(0x151))/0x4+-parseInt(_0x430d25(0x138))/0x5*(-parseInt(_0x430d25(0x123))/0x6)+-parseInt(_0x430d25(0x149))/0x7*(-parseInt(_0x430d25(0x126))/0x8)+-parseInt(_0x430d25(0x128))/0x9*(-parseInt(_0x430d25(0x12e))/0xa)+-parseInt(_0x430d25(0x158))/0xb;if(_0x5a91bc===_0x358a1e)break;else _0x44c354['push'](_0x44c354['shift']());}catch(_0x5e1d39){_0x44c354['push'](_0x44c354['shift']());}}}(a0_0xc492,0x33364));import{readFileSync as a0_0x5ee94b,existsSync as a0_0x56a5df}from'fs';import{join as a0_0x507a4f}from'path';import{hostname as a0_0x907404}from'os';import{execSync as a0_0x29d0d1}from'child_process';import{Server as a0_0x1d74b7}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x122abe}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x542812,CallToolRequestSchema as a0_0x577e4f}from'@modelcontextprotocol/sdk/types.js';function h(_0x221af1){const _0x298cf0=a0_0x2999;if(!a0_0x56a5df(_0x221af1))return;for(let _0x534b01 of a0_0x5ee94b(_0x221af1,'utf-8')[_0x298cf0(0x10f)]('\x0a')){let _0x1f8f48=_0x534b01[_0x298cf0(0x172)]();if(!_0x1f8f48||_0x1f8f48[_0x298cf0(0x153)]('#'))continue;let _0x149c4b=_0x1f8f48['indexOf']('=');if(_0x149c4b<0x0)continue;let _0x8cde08=_0x1f8f48[_0x298cf0(0x12a)](0x0,_0x149c4b)[_0x298cf0(0x172)](),_0x356af5=_0x1f8f48[_0x298cf0(0x12a)](_0x149c4b+0x1)[_0x298cf0(0x172)]()[_0x298cf0(0x10d)](/^["']|["']$/g,'');if(!process.env[_0x8cde08])process.env[_0x8cde08]=_0x356af5;}}var R=process.env.HOME||'~',p=a0_0x507a4f(R,a0_0x4e5ac0(0x16a));h(a0_0x507a4f(p,'.env'));var C=process[a0_0x4e5ac0(0x194)]()[a0_0x4e5ac0(0x10d)](/\//g,'-');function a0_0x2999(_0x331d08,_0x12a298){_0x331d08=_0x331d08-0x10c;const _0xc49219=a0_0xc492();let _0x299934=_0xc49219[_0x331d08];return _0x299934;}h(a0_0x507a4f(p,C,a0_0x4e5ac0(0x14d)));function _(){const _0x2c85e3=a0_0x4e5ac0;try{return a0_0x29d0d1(_0x2c85e3(0x124),{'encoding':_0x2c85e3(0x17d),'timeout':0x7d0})[_0x2c85e3(0x172)]();}catch{return'';}}function a0_0xc492(){const _0x1c3231=['ack_inbox','0.3.0','report_status','working','2.0','new_task','commhub-channel','join','from','parse\x20error:\x20','number','/events/','/mcp','exit','\x20from\x20','2sADOTo','Priority\x20(default:\x20normal)','.claude/channels/commhub','no\x20response','initialize','connected','commhub_send_message','message','claude-code','getReader','trim','\x22\x20(','messages','text','read',':\x20inbox_count=','commhub','stringify','in_progress','CommHub\x20init\x20failed:\x20','config.json','utf-8','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','report_completion','data:\x20','connect','registered\x20as\x20\x22','blocked','Task\x20status','randomUUID','end','\x20priority=','Target\x20session\x20alias','commhub_send_task','warning:\x20could\x20not\x20register:\x20','shutting\x20down,\x20reporting\x20offline...','pop','high','SSE\x20connection\x20error:\x20','string','init\x20failed:\x20','content','write','priority','cwd','type','hub','decode','message_id','replace','Authorization','split','task','body','then','SSE\x20stream\x20ended,\x20reconnecting...','starting\x20SSE\x20listener...','result','get_all_status','Progress\x200-100','normal','Bearer\x20','statusText','SSE\x20error:\x20','toTimeString','unknown\x20tool','length','none','notifications/claude/channel','commhub_get_all_status','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','6pRxrbh','tmux\x20display-message\x20-p\x20\x27#S\x27','\x20RESUME_ID=','8dLdvUB','SSE\x20fatal:\x20','59391xPBSQS','from_session','slice','stderr','MCP\x20stdio\x20connected','.anet','110mZMQFt','611904RMivfv','Task\x20content',']\x20[commhub]\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','token','completed','POST','error','find','236435QWgTwv','parse','session\x20disconnected','commhub_report_status','ENV:\x20URL=','notification','Reply\x20text\x20/\x20result\x20summary','\x20ALIAS=','object','connecting\x20to\x20','254908rqjdTF','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','status','catch','application/json,\x20text/event-stream','...\x20TMUX=','2766694xKTJfu','broadcast','setRequestHandler','SSE\x20connected\x20as\x20\x22','.env','ready\x20—\x20waiting\x20for\x20events','Session\x20alias:\x20','application/json','1259928tadkcA','send_task','startsWith','low','alias','idle','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','454432xgFuKZ'];a0_0xc492=function(){return _0x1c3231;};return a0_0xc492();}function E(){const _0x4575e8=a0_0x4e5ac0;try{let _0xa9a06a=a0_0x507a4f(R,_0x4575e8(0x12d),_0x4575e8(0x17c));if(a0_0x56a5df(_0xa9a06a))return JSON[_0x4575e8(0x139)](a0_0x5ee94b(_0xa9a06a,_0x4575e8(0x17d)));}catch{}return{};}var T=E(),k=process.env.COMMHUB_URL||T[a0_0x4e5ac0(0x196)]||'http://127.0.0.1:9200',q=process.env.COMMHUB_TMUX||_(),Z=process.env.COMMHUB_ALIAS||q||a0_0x907404(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x4e5ac0(0x185)](),X=process.env.COMMHUB_TOKEN||T[a0_0x4e5ac0(0x133)]||'';function V(_0x2da062){const _0x5aa241=a0_0x4e5ac0;let _0x5212f1=new Date()[_0x5aa241(0x11c)]()[_0x5aa241(0x12a)](0x0,0x8);process[_0x5aa241(0x12b)][_0x5aa241(0x192)]('['+_0x5212f1+_0x5aa241(0x131)+_0x2da062+'\x0a');}function O(_0x5f085b){return new Promise(_0x1c9c5e=>setTimeout(_0x1c9c5e,_0x5f085b));}V(a0_0x4e5ac0(0x13c)+k+a0_0x4e5ac0(0x13f)+Z+a0_0x4e5ac0(0x125)+w[a0_0x4e5ac0(0x12a)](0x0,0x8)+a0_0x4e5ac0(0x148)+(q||a0_0x4e5ac0(0x11f))+'\x20CWD='+process[a0_0x4e5ac0(0x194)]()+'\x20PROJECT_ENV='+C);var K=new a0_0x1d74b7({'name':a0_0x4e5ac0(0x15f),'version':a0_0x4e5ac0(0x15a)},{'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>','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x4e5ac0(0x122),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x4e5ac0(0x14f)+Z][a0_0x4e5ac0(0x160)]('\x0a')});K[a0_0x4e5ac0(0x14b)](a0_0x542812,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x4e5ac0(0x132),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x4e5ac0(0x18f),'description':a0_0x4e5ac0(0x144)},'text':{'type':'string','description':a0_0x4e5ac0(0x13e)},'status':{'type':a0_0x4e5ac0(0x18f),'enum':[a0_0x4e5ac0(0x134),a0_0x4e5ac0(0x183),a0_0x4e5ac0(0x136),a0_0x4e5ac0(0x17a)],'description':a0_0x4e5ac0(0x184)}},'required':[a0_0x4e5ac0(0x175)]}},{'name':a0_0x4e5ac0(0x13b),'description':a0_0x4e5ac0(0x143),'inputSchema':{'type':a0_0x4e5ac0(0x140),'properties':{'status':{'type':a0_0x4e5ac0(0x18f),'enum':['working',a0_0x4e5ac0(0x156),a0_0x4e5ac0(0x183),a0_0x4e5ac0(0x136)]},'task':{'type':a0_0x4e5ac0(0x18f),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x4e5ac0(0x163),'description':a0_0x4e5ac0(0x117)}},'required':[a0_0x4e5ac0(0x145)]}},{'name':'commhub_send_task','description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x4e5ac0(0x140),'properties':{'alias':{'type':a0_0x4e5ac0(0x18f),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x4e5ac0(0x18f),'description':a0_0x4e5ac0(0x130)},'priority':{'type':'string','enum':[a0_0x4e5ac0(0x18d),a0_0x4e5ac0(0x118),a0_0x4e5ac0(0x154)],'description':a0_0x4e5ac0(0x169)}},'required':[a0_0x4e5ac0(0x155),a0_0x4e5ac0(0x110)]}},{'name':'commhub_send_message','description':a0_0x4e5ac0(0x157),'inputSchema':{'type':a0_0x4e5ac0(0x140),'properties':{'alias':{'type':'string','description':a0_0x4e5ac0(0x188)},'message':{'type':a0_0x4e5ac0(0x18f),'description':'Message\x20content'}},'required':['alias',a0_0x4e5ac0(0x16f)]}},{'name':a0_0x4e5ac0(0x121),'description':a0_0x4e5ac0(0x17e),'inputSchema':{'type':a0_0x4e5ac0(0x140),'properties':{}}}]}));async function P(_0x3c5c02,_0x510361){const _0x28ee07=a0_0x4e5ac0;let _0x562d1c=await fetch(k+_0x28ee07(0x165),{'method':_0x28ee07(0x135),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x28ee07(0x119)+X}:{}},'body':JSON[_0x28ee07(0x179)]({'jsonrpc':_0x28ee07(0x15d),'id':0x1,'method':_0x28ee07(0x16c),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x28ee07(0x15f),'version':_0x28ee07(0x15a)}}})});if(!_0x562d1c['ok']){let _0x5661d9=await _0x562d1c[_0x28ee07(0x175)]();return V(_0x28ee07(0x17b)+_0x562d1c[_0x28ee07(0x145)]+'\x20'+_0x5661d9['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x28ee07(0x190)+_0x562d1c[_0x28ee07(0x145)]};}await _0x562d1c['text']();let _0x4615e3=(await(await fetch(k+'/mcp',{'method':_0x28ee07(0x135),'headers':{'Content-Type':_0x28ee07(0x150),'Accept':_0x28ee07(0x147),...X?{'Authorization':_0x28ee07(0x119)+X}:{}},'body':JSON[_0x28ee07(0x179)]({'jsonrpc':_0x28ee07(0x15d),'id':0x2,'method':'tools/call','params':{'name':_0x3c5c02,'arguments':_0x510361}})}))[_0x28ee07(0x175)]())[_0x28ee07(0x10f)]('\x0a')[_0x28ee07(0x137)](_0x28ee0c=>_0x28ee0c[_0x28ee07(0x153)]('data:\x20'));if(_0x4615e3){let _0x5ee184=JSON['parse'](_0x4615e3[_0x28ee07(0x12a)](0x6));return _0x5ee184?.[_0x28ee07(0x115)]?.[_0x28ee07(0x191)]?.[0x0]?.[_0x28ee07(0x175)]?JSON[_0x28ee07(0x139)](_0x5ee184[_0x28ee07(0x115)][_0x28ee07(0x191)][0x0][_0x28ee07(0x175)]):_0x5ee184;}return{'ok':!0x1,'error':_0x28ee07(0x16b)};}K[a0_0x4e5ac0(0x14b)](a0_0x577e4f,async _0x25a3ad=>{const _0x2c2613=a0_0x4e5ac0;let {name:_0x47fb3f,arguments:_0x5734a6}=_0x25a3ad['params'];if(_0x47fb3f==='commhub_reply'){let {task_id:_0x3cc870,text:_0x5d4149,status:_0x53f98d}=_0x5734a6;if(_0x53f98d==='completed'){let _0xb8212b=await P(_0x2c2613(0x17f),{'alias':Z,'task':_0x3cc870||'task','result':_0x5d4149});return{'content':[{'type':'text','text':JSON[_0x2c2613(0x179)](_0xb8212b)}]};}let _0x57dcae=await P(_0x2c2613(0x15b),{'resume_id':w,'alias':Z,'status':_0x53f98d===_0x2c2613(0x183)?_0x2c2613(0x183):_0x53f98d===_0x2c2613(0x136)?_0x2c2613(0x136):_0x2c2613(0x15c),'task':_0x5d4149[_0x2c2613(0x12a)](0x0,0xc8),'output':_0x5d4149});return{'content':[{'type':_0x2c2613(0x175),'text':JSON[_0x2c2613(0x179)](_0x57dcae)}]};}if(_0x47fb3f===_0x2c2613(0x13b)){let {status:_0xbea76b,task:_0x10c939,progress:_0x521f08}=_0x5734a6,_0x48b90d=await P(_0x2c2613(0x15b),{'resume_id':w,'alias':Z,'status':_0xbea76b,'task':_0x10c939,'progress':_0x521f08});return{'content':[{'type':'text','text':JSON[_0x2c2613(0x179)](_0x48b90d)}]};}if(_0x47fb3f===_0x2c2613(0x189)){let {alias:_0x7f3260,task:_0xeec80e,priority:_0x274af7}=_0x5734a6,_0x53998b=await P(_0x2c2613(0x152),{'alias':_0x7f3260,'task':_0xeec80e,'priority':_0x274af7||_0x2c2613(0x118),'from_session':Z});return{'content':[{'type':_0x2c2613(0x175),'text':JSON[_0x2c2613(0x179)](_0x53998b)}]};}if(_0x47fb3f===_0x2c2613(0x16e)){let {alias:_0x4aedfe,message:_0x2ac6a0}=_0x5734a6,_0x33be49=await P('send_message',{'alias':_0x4aedfe,'message':_0x2ac6a0,'from_session':Z});return{'content':[{'type':_0x2c2613(0x175),'text':JSON[_0x2c2613(0x179)](_0x33be49)}]};}if(_0x47fb3f===_0x2c2613(0x121)){let _0x246f83=await P(_0x2c2613(0x116),{});return{'content':[{'type':'text','text':JSON[_0x2c2613(0x179)](_0x246f83)}]};}return{'content':[{'type':_0x2c2613(0x175),'text':JSON[_0x2c2613(0x179)]({'error':_0x2c2613(0x11d)})}]};});async function c(){const _0x23c6c3=a0_0x4e5ac0;let _0x51165b=k+_0x23c6c3(0x164)+encodeURIComponent(Z),_0x1273b4={};if(X)_0x1273b4[_0x23c6c3(0x10e)]=_0x23c6c3(0x119)+X;V(_0x23c6c3(0x141)+_0x51165b);while(!0x0){try{let _0x3a6110=await fetch(_0x51165b,{'headers':_0x1273b4});if(!_0x3a6110['ok']){V(_0x23c6c3(0x11b)+_0x3a6110[_0x23c6c3(0x145)]+'\x20'+_0x3a6110[_0x23c6c3(0x11a)]),await O(0x1388);continue;}let _0x984e1=_0x3a6110[_0x23c6c3(0x111)][_0x23c6c3(0x171)](),_0x22a978=new TextDecoder(),_0x4a588c='';while(!0x0){let {done:_0x591df8,value:_0x372ea1}=await _0x984e1[_0x23c6c3(0x176)]();if(_0x591df8)break;_0x4a588c+=_0x22a978[_0x23c6c3(0x197)](_0x372ea1,{'stream':!0x0});let _0x5c634f=_0x4a588c[_0x23c6c3(0x10f)]('\x0a\x0a');_0x4a588c=_0x5c634f[_0x23c6c3(0x18c)]()||'';for(let _0x56cbf4 of _0x5c634f){let _0x9c6f15=_0x56cbf4[_0x23c6c3(0x10f)]('\x0a')[_0x23c6c3(0x137)](_0x999dba=>_0x999dba[_0x23c6c3(0x153)](_0x23c6c3(0x180)));if(!_0x9c6f15)continue;try{let _0x2f75ea=JSON[_0x23c6c3(0x139)](_0x9c6f15[_0x23c6c3(0x12a)](0x6));await v(_0x2f75ea);}catch(_0x4cb8d8){V(_0x23c6c3(0x162)+_0x4cb8d8);}}}V(_0x23c6c3(0x113));}catch(_0x2bf44b){V(_0x23c6c3(0x18e)+_0x2bf44b);}await O(0xbb8);}}async function v(_0x159ed9){const _0xd0772d=a0_0x4e5ac0;if(_0x159ed9[_0xd0772d(0x195)]===_0xd0772d(0x16d)){V(_0xd0772d(0x14c)+Z+'\x22');return;}if(_0x159ed9[_0xd0772d(0x195)]==='new_message'){if(V('←\x20message\x20from\x20'+_0x159ed9[_0xd0772d(0x161)]+':\x20'+_0x159ed9[_0xd0772d(0x16f)][_0xd0772d(0x12a)](0x0,0x3c)),await K['notification']({'method':_0xd0772d(0x120),'params':{'content':_0x159ed9['message'],'meta':{'sender':_0x159ed9[_0xd0772d(0x161)]||_0xd0772d(0x196),'sender_id':'commhub','user':_0x159ed9[_0xd0772d(0x161)]||_0xd0772d(0x196),'priority':_0xd0772d(0x118)}}}),_0x159ed9[_0xd0772d(0x10c)])await P('ack_inbox',{'alias':Z,'message_id':_0x159ed9[_0xd0772d(0x10c)]});return;}if(_0x159ed9[_0xd0772d(0x195)]===_0xd0772d(0x15e)||_0x159ed9['type']===_0xd0772d(0x14a)){V('←\x20'+_0x159ed9[_0xd0772d(0x195)]+_0xd0772d(0x177)+_0x159ed9['inbox_count']+_0xd0772d(0x187)+(_0x159ed9[_0xd0772d(0x193)]||_0xd0772d(0x118)));let _0xb2a905=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0xb2a905?.['ok']&&_0xb2a905[_0xd0772d(0x174)]?.[_0xd0772d(0x11e)]>0x0)for(let _0x574053 of _0xb2a905[_0xd0772d(0x174)]){let _0x45631f={'sender':_0x574053[_0xd0772d(0x129)]||_0xd0772d(0x196),'sender_id':_0xd0772d(0x178),'user':_0x574053['from_session']||_0xd0772d(0x196),'task_id':_0x574053['id'],'priority':_0x574053['priority']||'normal'};await K[_0xd0772d(0x13d)]({'method':'notifications/claude/channel','params':{'content':_0x574053[_0xd0772d(0x191)],'meta':_0x45631f}}),V('→\x20injected\x20task\x20'+_0x574053['id'][_0xd0772d(0x12a)](0x0,0x8)+_0xd0772d(0x167)+_0x574053[_0xd0772d(0x129)]+':\x20'+_0x574053[_0xd0772d(0x191)]['slice'](0x0,0x3c)),await P(_0xd0772d(0x159),{'alias':Z,'message_id':_0x574053['id']});}}}async function u(){const _0x45d49f=a0_0x4e5ac0;let _0x5a7b30=new a0_0x122abe();await K[_0x45d49f(0x181)](_0x5a7b30),V(_0x45d49f(0x12c)),V(_0x45d49f(0x114)),c()[_0x45d49f(0x146)](_0x96d63e=>V(_0x45d49f(0x127)+_0x96d63e)),P(_0x45d49f(0x15b),{'resume_id':w,'alias':Z,'status':_0x45d49f(0x156),'server':a0_0x907404(),'hostname':a0_0x907404(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':q||void 0x0})[_0x45d49f(0x112)](()=>V(_0x45d49f(0x182)+Z+_0x45d49f(0x173)+w['slice'](0x0,0x8)+')'))[_0x45d49f(0x146)](_0x3ed7c0=>V(_0x45d49f(0x18a)+_0x3ed7c0)),setInterval(()=>{const _0x4a2b69=_0x45d49f;P('report_status',{'resume_id':w,'alias':Z,'status':_0x4a2b69(0x156),'server':a0_0x907404(),'hostname':a0_0x907404(),'agent':_0x4a2b69(0x170),'project_dir':process['cwd'](),'tmux_name':q||void 0x0})['catch'](_0x9dcea2=>V('heartbeat\x20failed:\x20'+_0x9dcea2));},0x2bf20),V(_0x45d49f(0x14e));}u()[a0_0x4e5ac0(0x146)](_0x208507=>{const _0x2b2eed=a0_0x4e5ac0;V('fatal:\x20'+_0x208507),process[_0x2b2eed(0x166)](0x1);});async function f(){const _0x320d34=a0_0x4e5ac0;V(_0x320d34(0x18b)),await P(_0x320d34(0x15b),{'resume_id':w,'alias':Z,'status':_0x320d34(0x136),'task':_0x320d34(0x13a)})[_0x320d34(0x146)](()=>{}),process[_0x320d34(0x166)](0x0);}process['stdin']['on'](a0_0x4e5ac0(0x186),()=>f()),process['on']('SIGTERM',()=>f()),process['on']('SIGINT',()=>f());
2
+ const a0_0x5373fd=a0_0x28ec;(function(_0x250565,_0x57572c){const _0x50cc89=a0_0x28ec,_0x1439b0=_0x250565();while(!![]){try{const _0x5f56f7=-parseInt(_0x50cc89(0x21b))/0x1*(parseInt(_0x50cc89(0x1e3))/0x2)+parseInt(_0x50cc89(0x1de))/0x3+parseInt(_0x50cc89(0x225))/0x4+parseInt(_0x50cc89(0x20c))/0x5+-parseInt(_0x50cc89(0x20f))/0x6*(-parseInt(_0x50cc89(0x1fc))/0x7)+parseInt(_0x50cc89(0x1b4))/0x8+parseInt(_0x50cc89(0x1fe))/0x9*(-parseInt(_0x50cc89(0x1b9))/0xa);if(_0x5f56f7===_0x57572c)break;else _0x1439b0['push'](_0x1439b0['shift']());}catch(_0x33870f){_0x1439b0['push'](_0x1439b0['shift']());}}}(a0_0x1392,0xdd1c8));import{readFileSync as a0_0x525c50,existsSync as a0_0x120f6c}from'fs';import{join as a0_0x1dfe54}from'path';import{hostname as a0_0x17322d}from'os';import{execSync as a0_0x462f36}from'child_process';import{Server as a0_0x593a79}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x2c10ab}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x25a9f8,CallToolRequestSchema as a0_0x5cc6cd}from'@modelcontextprotocol/sdk/types.js';function p(_0x620bdc){const _0x22c236=a0_0x28ec;if(!a0_0x120f6c(_0x620bdc))return;for(let _0x457d4b of a0_0x525c50(_0x620bdc,_0x22c236(0x22e))[_0x22c236(0x231)]('\x0a')){let _0x48d242=_0x457d4b['trim']();if(!_0x48d242||_0x48d242['startsWith']('#'))continue;let _0x540ae1=_0x48d242[_0x22c236(0x230)]('=');if(_0x540ae1<0x0)continue;let _0x50c433=_0x48d242[_0x22c236(0x22c)](0x0,_0x540ae1)[_0x22c236(0x1fd)](),_0x2d2550=_0x48d242['slice'](_0x540ae1+0x1)[_0x22c236(0x1fd)]()[_0x22c236(0x202)](/^["']|["']$/g,'');if(!process.env[_0x50c433])process.env[_0x50c433]=_0x2d2550;}}var C=process.env.HOME||'~',T=a0_0x1dfe54(C,'.claude/channels/commhub');p(a0_0x1dfe54(T,a0_0x5373fd(0x1ee)));var L=process[a0_0x5373fd(0x1e2)]()['replace'](/\//g,'-');p(a0_0x1dfe54(T,L,a0_0x5373fd(0x1ee)));function U(){const _0x34f105=a0_0x5373fd;try{return a0_0x462f36('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':'utf-8','timeout':0x7d0})[_0x34f105(0x1fd)]();}catch{return'';}}function c(){const _0x1d31b2=a0_0x5373fd;try{let _0x3336c8=a0_0x1dfe54(C,_0x1d31b2(0x1b1),_0x1d31b2(0x1c6));if(a0_0x120f6c(_0x3336c8))return JSON['parse'](a0_0x525c50(_0x3336c8,'utf-8'));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x5373fd(0x219)]||a0_0x5373fd(0x1ef),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x17322d(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto['randomUUID'](),X=process.env.COMMHUB_TOKEN||H[a0_0x5373fd(0x1d2)]||'';function Y(_0x506e1d){const _0xbeb88=a0_0x5373fd;let _0x452e7a=new Date()['toTimeString']()[_0xbeb88(0x22c)](0x0,0x8);process[_0xbeb88(0x223)][_0xbeb88(0x1d0)]('['+_0x452e7a+_0xbeb88(0x22f)+_0x506e1d+'\x0a');}function h(_0x4314f8){return new Promise(_0x5e7c16=>setTimeout(_0x5e7c16,_0x4314f8));}Y(a0_0x5373fd(0x206)+D+a0_0x5373fd(0x217)+Z+a0_0x5373fd(0x1cf)+w[a0_0x5373fd(0x22c)](0x0,0x8)+a0_0x5373fd(0x1bf)+(f||a0_0x5373fd(0x22a))+a0_0x5373fd(0x1f8)+process[a0_0x5373fd(0x1e2)]()+a0_0x5373fd(0x1c4)+L);var k=new Map(),K=new a0_0x593a79({'name':a0_0x5373fd(0x229),'version':a0_0x5373fd(0x1c8)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x5373fd(0x21f),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x5373fd(0x201),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Session\x20alias:\x20'+Z][a0_0x5373fd(0x205)]('\x0a')});K[a0_0x5373fd(0x203)](a0_0x25a9f8,async()=>({'tools':[{'name':a0_0x5373fd(0x209),'description':a0_0x5373fd(0x1b3),'inputSchema':{'type':a0_0x5373fd(0x1b6),'properties':{'task_id':{'type':a0_0x5373fd(0x226),'description':a0_0x5373fd(0x1db)},'text':{'type':a0_0x5373fd(0x226),'description':a0_0x5373fd(0x1d7)},'status':{'type':'string','enum':[a0_0x5373fd(0x222),a0_0x5373fd(0x1d4),a0_0x5373fd(0x1d3),a0_0x5373fd(0x1d6),a0_0x5373fd(0x1b8),a0_0x5373fd(0x1ba)],'description':a0_0x5373fd(0x1e0)}},'required':[a0_0x5373fd(0x1c1)]}},{'name':a0_0x5373fd(0x21c),'description':a0_0x5373fd(0x1c0),'inputSchema':{'type':a0_0x5373fd(0x1b6),'properties':{'status':{'type':a0_0x5373fd(0x226),'enum':['working','idle',a0_0x5373fd(0x1d6),a0_0x5373fd(0x1b8)]},'task':{'type':a0_0x5373fd(0x226),'description':a0_0x5373fd(0x1e9)},'progress':{'type':a0_0x5373fd(0x1ca),'description':a0_0x5373fd(0x1f2)}},'required':[a0_0x5373fd(0x213)]}},{'name':a0_0x5373fd(0x1e7),'description':a0_0x5373fd(0x1e4),'inputSchema':{'type':a0_0x5373fd(0x1b6),'properties':{'alias':{'type':a0_0x5373fd(0x226),'description':a0_0x5373fd(0x1bb)},'task':{'type':a0_0x5373fd(0x226),'description':a0_0x5373fd(0x1be)},'priority':{'type':'string','enum':['high',a0_0x5373fd(0x20b),a0_0x5373fd(0x1f7)],'description':a0_0x5373fd(0x20d)}},'required':[a0_0x5373fd(0x221),a0_0x5373fd(0x1fa)]}},{'name':a0_0x5373fd(0x1ae),'description':a0_0x5373fd(0x1ac),'inputSchema':{'type':a0_0x5373fd(0x1b6),'properties':{'alias':{'type':a0_0x5373fd(0x226),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x5373fd(0x226),'description':a0_0x5373fd(0x1f1)}},'required':[a0_0x5373fd(0x221),a0_0x5373fd(0x1e5)]}},{'name':a0_0x5373fd(0x1d5),'description':a0_0x5373fd(0x1f4),'inputSchema':{'type':a0_0x5373fd(0x1b6),'properties':{}}}]}));async function P(_0xbab294,_0x2f853c){const _0x26f844=a0_0x5373fd;let _0x319d11=await fetch(D+_0x26f844(0x1c9),{'method':_0x26f844(0x1f3),'headers':{'Content-Type':'application/json','Accept':_0x26f844(0x1b7),...X?{'Authorization':_0x26f844(0x1dd)+X}:{}},'body':JSON[_0x26f844(0x214)]({'jsonrpc':'2.0','id':0x1,'method':_0x26f844(0x1dc),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x26f844(0x1c8)}}})});if(!_0x319d11['ok']){let _0x3612c7=await _0x319d11[_0x26f844(0x1c1)]();return Y('CommHub\x20init\x20failed:\x20'+_0x319d11[_0x26f844(0x213)]+'\x20'+_0x3612c7[_0x26f844(0x22c)](0x0,0x64)),{'ok':!0x1,'error':_0x26f844(0x1da)+_0x319d11[_0x26f844(0x213)]};}await _0x319d11[_0x26f844(0x1c1)]();let _0x3bd5b1=(await(await fetch(D+'/mcp',{'method':_0x26f844(0x1f3),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x26f844(0x1cd),'id':0x2,'method':'tools/call','params':{'name':_0xbab294,'arguments':_0x2f853c}})}))[_0x26f844(0x1c1)]())['split']('\x0a')[_0x26f844(0x227)](_0x2a2cb4=>_0x2a2cb4[_0x26f844(0x1e1)](_0x26f844(0x1c5)));if(_0x3bd5b1){let _0x56babd=JSON['parse'](_0x3bd5b1['slice'](0x6));return _0x56babd?.['result']?.[_0x26f844(0x22b)]?.[0x0]?.['text']?JSON[_0x26f844(0x1ad)](_0x56babd[_0x26f844(0x21d)][_0x26f844(0x22b)][0x0][_0x26f844(0x1c1)]):_0x56babd;}return{'ok':!0x1,'error':'no\x20response'};}function a0_0x28ec(_0x473e1d,_0x528a76){_0x473e1d=_0x473e1d-0x1ac;const _0x1392fb=a0_0x1392();let _0x28ec35=_0x1392fb[_0x473e1d];return _0x28ec35;}K[a0_0x5373fd(0x203)](a0_0x5cc6cd,async _0x3e0a41=>{const _0x2d3b34=a0_0x5373fd;let {name:_0x5d6a5f,arguments:_0x47bce5}=_0x3e0a41[_0x2d3b34(0x1e8)];if(_0x5d6a5f===_0x2d3b34(0x209)){let {task_id:_0x47edb2,text:_0x506943,status:_0x378115}=_0x47bce5;if(_0x378115===_0x2d3b34(0x222)||_0x378115==='failed'||_0x378115===_0x2d3b34(0x1d3)){let _0x2ced28=_0x378115==='completed'?_0x2d3b34(0x1eb):_0x378115,_0x24f25d=_0x47edb2?k['get'](_0x47edb2)||_0x2d3b34(0x219):_0x2d3b34(0x219),_0x460e5a=await P('send_reply',{'alias':_0x24f25d,'text':_0x506943,'in_reply_to':_0x47edb2||void 0x0,'status':_0x2ced28,'from_session':Z});if(_0x47edb2)k['delete'](_0x47edb2);return{'content':[{'type':'text','text':JSON['stringify'](_0x460e5a)}]};}let _0x47cdec=await P(_0x2d3b34(0x1c2),{'resume_id':w,'alias':Z,'status':_0x378115===_0x2d3b34(0x1d6)?_0x2d3b34(0x1d6):_0x378115===_0x2d3b34(0x1b8)?'error':_0x2d3b34(0x212),'task':_0x506943[_0x2d3b34(0x22c)](0x0,0xc8),'output':_0x506943});return{'content':[{'type':_0x2d3b34(0x1c1),'text':JSON['stringify'](_0x47cdec)}]};}if(_0x5d6a5f===_0x2d3b34(0x21c)){let {status:_0x201436,task:_0x44be81,progress:_0x24b9fa}=_0x47bce5,_0x315531=await P(_0x2d3b34(0x1c2),{'resume_id':w,'alias':Z,'status':_0x201436,'task':_0x44be81,'progress':_0x24b9fa});return{'content':[{'type':_0x2d3b34(0x1c1),'text':JSON[_0x2d3b34(0x214)](_0x315531)}]};}if(_0x5d6a5f===_0x2d3b34(0x1e7)){let {alias:_0x1a0b21,task:_0x2383f4,priority:_0x381dbf}=_0x47bce5,_0x90f770=await P('send_task',{'alias':_0x1a0b21,'task':_0x2383f4,'priority':_0x381dbf||'normal','from_session':Z});return{'content':[{'type':_0x2d3b34(0x1c1),'text':JSON[_0x2d3b34(0x214)](_0x90f770)}]};}if(_0x5d6a5f===_0x2d3b34(0x1ae)){let {alias:_0x4afcf8,message:_0xe9bead}=_0x47bce5,_0x3706a4=await P('send_message',{'alias':_0x4afcf8,'message':_0xe9bead,'from_session':Z});return{'content':[{'type':_0x2d3b34(0x1c1),'text':JSON[_0x2d3b34(0x214)](_0x3706a4)}]};}if(_0x5d6a5f===_0x2d3b34(0x1d5)){let _0x5b5c68=await P('get_all_status',{});return{'content':[{'type':_0x2d3b34(0x1c1),'text':JSON[_0x2d3b34(0x214)](_0x5b5c68)}]};}return{'content':[{'type':_0x2d3b34(0x1c1),'text':JSON[_0x2d3b34(0x214)]({'error':_0x2d3b34(0x20e)})}]};});async function v(){const _0x2e13ee=a0_0x5373fd;let _0x1f6f8d=D+'/events/'+encodeURIComponent(Z),_0x35c1a6={};if(X)_0x35c1a6['Authorization']='Bearer\x20'+X;Y('connecting\x20to\x20'+_0x1f6f8d);while(!0x0){try{let _0x582060=await fetch(_0x1f6f8d,{'headers':_0x35c1a6});if(!_0x582060['ok']){Y(_0x2e13ee(0x1bc)+_0x582060[_0x2e13ee(0x213)]+'\x20'+_0x582060[_0x2e13ee(0x1b2)]),await h(0x1388);continue;}let _0x2a046e=_0x582060[_0x2e13ee(0x1ff)]['getReader'](),_0x42024f=new TextDecoder(),_0x57e4df='';while(!0x0){let {done:_0x4a382b,value:_0x49e874}=await _0x2a046e[_0x2e13ee(0x1b5)]();if(_0x4a382b)break;_0x57e4df+=_0x42024f['decode'](_0x49e874,{'stream':!0x0});let _0x26e93f=_0x57e4df[_0x2e13ee(0x231)]('\x0a\x0a');_0x57e4df=_0x26e93f['pop']()||'';for(let _0x3e134d of _0x26e93f){let _0xaf3f11=_0x3e134d[_0x2e13ee(0x231)]('\x0a')['find'](_0x264623=>_0x264623['startsWith']('data:\x20'));if(!_0xaf3f11)continue;try{let _0x5a0ff2=JSON['parse'](_0xaf3f11[_0x2e13ee(0x22c)](0x6));await u(_0x5a0ff2);}catch(_0x4122da){Y(_0x2e13ee(0x204)+_0x4122da);}}}Y(_0x2e13ee(0x1e6));}catch(_0x3f1b62){Y('SSE\x20connection\x20error:\x20'+_0x3f1b62);}await h(0xbb8);}}function a0_0x1392(){const _0x342662=['Bearer\x20','1350729fFPevV','type','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','startsWith','cwd','18SrJQax','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','message','SSE\x20stream\x20ended,\x20reconnecting...','commhub_send_task','params','Current\x20task\x20description','SSE\x20fatal:\x20','replied','MCP\x20stdio\x20connected','notifications/claude/channel','.env','http://127.0.0.1:9200','SIGTERM','Message\x20content','Progress\x200-100','POST','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','→\x20injected\x20task\x20','from_session','low','\x20CWD=','claude-code','task','notification','231784WHJUyo','trim','18382257tAFPZF','body','\x20from\x20','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','replace','setRequestHandler','parse\x20error:\x20','join','ENV:\x20URL=','\x22\x20(','←\x20message\x20from\x20','commhub_reply','from','normal','5477340eHgPGr','Priority\x20(default:\x20normal)','unknown\x20tool','132hBEtTI','SIGINT','commhub','working','status','stringify',':\x20inbox_count=','messages','\x20ALIAS=','session\x20disconnected','hub','idle','43317qCmReJ','commhub_report_status','result','exit','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','inbox_count','alias','completed','stderr','catch','663964hFwKXL','string','find','fatal:\x20','commhub-channel','none','content','slice','priority','utf-8',']\x20[commhub]\x20','indexOf','split','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','parse','commhub_send_message','length','shutting\x20down,\x20reporting\x20offline...','.anet','statusText','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','7182656iueGjD','read','object','application/json,\x20text/event-stream','error','10TOpBJn','in_progress','Target\x20session\x20alias','SSE\x20error:\x20','starting\x20SSE\x20listener...','Task\x20content','...\x20TMUX=','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','text','report_status','ack_inbox','\x20PROJECT_ENV=','data:\x20','config.json','ready\x20—\x20waiting\x20for\x20events','0.3.0','/mcp','number','connect','warning:\x20could\x20not\x20register:\x20','2.0','broadcast','\x20RESUME_ID=','write','end','token','cancelled','failed','commhub_get_all_status','blocked','Reply\x20text\x20/\x20result\x20summary','registered\x20as\x20\x22','get_inbox','init\x20failed:\x20','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','initialize'];a0_0x1392=function(){return _0x342662;};return a0_0x1392();}async function u(_0x17e4da){const _0x326f18=a0_0x5373fd;if(_0x17e4da['type']==='connected'){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x17e4da[_0x326f18(0x1df)]==='new_message'){if(Y(_0x326f18(0x208)+_0x17e4da[_0x326f18(0x20a)]+':\x20'+_0x17e4da[_0x326f18(0x1e5)]['slice'](0x0,0x3c)),await K['notification']({'method':_0x326f18(0x1ed),'params':{'content':_0x17e4da[_0x326f18(0x1e5)],'meta':{'sender':_0x17e4da[_0x326f18(0x20a)]||'hub','sender_id':'commhub','user':_0x17e4da[_0x326f18(0x20a)]||'hub','priority':'normal'}}}),_0x17e4da['message_id'])await P(_0x326f18(0x1c3),{'alias':Z,'message_id':_0x17e4da['message_id']});return;}if(_0x17e4da[_0x326f18(0x1df)]==='new_task'||_0x17e4da[_0x326f18(0x1df)]===_0x326f18(0x1ce)){Y('←\x20'+_0x17e4da[_0x326f18(0x1df)]+_0x326f18(0x215)+_0x17e4da[_0x326f18(0x220)]+'\x20priority='+(_0x17e4da[_0x326f18(0x22d)]||_0x326f18(0x20b)));let _0x572e28=await P(_0x326f18(0x1d9),{'alias':Z,'limit':0x5});if(_0x572e28?.['ok']&&_0x572e28[_0x326f18(0x216)]?.[_0x326f18(0x1af)]>0x0)for(let _0x1f4c50 of _0x572e28[_0x326f18(0x216)]){let _0x5ada01={'sender':_0x1f4c50['from_session']||_0x326f18(0x219),'sender_id':_0x326f18(0x211),'user':_0x1f4c50[_0x326f18(0x1f6)]||_0x326f18(0x219),'task_id':_0x1f4c50['id'],'priority':_0x1f4c50[_0x326f18(0x22d)]||_0x326f18(0x20b)};k['set'](_0x1f4c50['id'],_0x1f4c50['from_session']||_0x326f18(0x219)),await K[_0x326f18(0x1fb)]({'method':'notifications/claude/channel','params':{'content':_0x1f4c50[_0x326f18(0x22b)],'meta':_0x5ada01}}),Y(_0x326f18(0x1f5)+_0x1f4c50['id'][_0x326f18(0x22c)](0x0,0x8)+_0x326f18(0x200)+_0x1f4c50[_0x326f18(0x1f6)]+':\x20'+_0x1f4c50[_0x326f18(0x22b)][_0x326f18(0x22c)](0x0,0x3c)),await P(_0x326f18(0x1c3),{'alias':Z,'message_id':_0x1f4c50['id']});}}}async function S(){const _0x2595da=a0_0x5373fd;let _0x4e7a38=new a0_0x2c10ab();await K[_0x2595da(0x1cb)](_0x4e7a38),Y(_0x2595da(0x1ec)),Y(_0x2595da(0x1bd)),v()[_0x2595da(0x224)](_0x2bfde5=>Y(_0x2595da(0x1ea)+_0x2bfde5)),P(_0x2595da(0x1c2),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x17322d(),'hostname':a0_0x17322d(),'agent':_0x2595da(0x1f9),'project_dir':process[_0x2595da(0x1e2)](),'tmux_name':f||void 0x0})['then'](()=>Y(_0x2595da(0x1d8)+Z+_0x2595da(0x207)+w[_0x2595da(0x22c)](0x0,0x8)+')'))[_0x2595da(0x224)](_0x3c3ed6=>Y(_0x2595da(0x1cc)+_0x3c3ed6)),setInterval(()=>{const _0x46265b=_0x2595da;P(_0x46265b(0x1c2),{'resume_id':w,'alias':Z,'status':_0x46265b(0x21a),'server':a0_0x17322d(),'hostname':a0_0x17322d(),'agent':_0x46265b(0x1f9),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x46265b(0x224)](_0x24cc23=>Y('heartbeat\x20failed:\x20'+_0x24cc23));},0x2bf20),Y(_0x2595da(0x1c7));}S()['catch'](_0x3b98c4=>{const _0x16c062=a0_0x5373fd;Y(_0x16c062(0x228)+_0x3b98c4),process[_0x16c062(0x21e)](0x1);});async function N(){const _0x5c234a=a0_0x5373fd;Y(_0x5c234a(0x1b0)),await P(_0x5c234a(0x1c2),{'resume_id':w,'alias':Z,'status':_0x5c234a(0x1b8),'task':_0x5c234a(0x218)})[_0x5c234a(0x224)](()=>{}),process[_0x5c234a(0x21e)](0x0);}process['stdin']['on'](a0_0x5373fd(0x1d1),()=>N()),process['on'](a0_0x5373fd(0x1f0),()=>N()),process['on'](a0_0x5373fd(0x210),()=>N());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.0.0-preview.1",
3
+ "version": "2.0.0-preview.11",
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",