@sleep2agi/agent-network 2.0.0-preview.46 → 2.0.0-preview.48

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_0x5d7258=a0_0xfc9f;function a0_0x1a26(){const _0x1c5f2b=['sseAbort','new_message','get_all_status','text','getReader','send_task','replace','type','resumeId','heartbeatTimer','catch','sdk','12FfzOVa','send_message','239880PoOZGF','inbox\x20error:\x20','broadcast','signal','content','parse','reconnectDelay','disconnect','alias','message','url','idle','connectSSE','new_task','get_inbox','48811524fDmLZV','SSE\x20connected','3544fHFZEw','Authorization','AbortError','sleep','offline','5925186VMDbIF','14UNbzwP','toString','Bearer\x20','send','split','token','agent','disconnected','min','sdk-','s...','reply','data:\x20','autoConnect','emit','758vzFRsK','5338024aGzuZr','now','text/event-stream','/events/','connect','heartbeat\x20failed:\x20','status','decode','pop','SSE\x20error:\x20','running','6ZqvRSa','18905480foByXH','log','processInbox','connected','ack_inbox','SSE\x20failed:\x20','10ZROMTG','report_status','abort','2.0','from_session','task','2864115QCJVpT','call','heartbeatInterval','getAllStatus','normal','toTimeString','body','read','slice','cwd'];a0_0x1a26=function(){return _0x1c5f2b;};return a0_0x1a26();}function a0_0xfc9f(_0x30e3fc,_0x5c38c2){_0x30e3fc=_0x30e3fc-0xf9;const _0x1a26ca=a0_0x1a26();let _0xfc9f0c=_0x1a26ca[_0x30e3fc];return _0xfc9f0c;}(function(_0x2df832,_0x4fe2c8){const _0x3bd5ae=a0_0xfc9f,_0x11e9c5=_0x2df832();while(!![]){try{const _0x16cc0d=parseInt(_0x3bd5ae(0x103))/0x1*(-parseInt(_0x3bd5ae(0x145))/0x2)+-parseInt(_0x3bd5ae(0x134))/0x3*(parseInt(_0x3bd5ae(0x132))/0x4)+-parseInt(_0x3bd5ae(0x11c))/0x5*(parseInt(_0x3bd5ae(0x10f))/0x6)+-parseInt(_0x3bd5ae(0x14b))/0x7*(-parseInt(_0x3bd5ae(0x104))/0x8)+-parseInt(_0x3bd5ae(0x14a))/0x9+parseInt(_0x3bd5ae(0x116))/0xa*(-parseInt(_0x3bd5ae(0x110))/0xb)+parseInt(_0x3bd5ae(0x143))/0xc;if(_0x16cc0d===_0x4fe2c8)break;else _0x11e9c5['push'](_0x11e9c5['shift']());}catch(_0x1b9ac1){_0x11e9c5['push'](_0x11e9c5['shift']());}}}(a0_0x1a26,0xd4364));import{EventEmitter as a0_0x374eb6}from'events';import{hostname as a0_0x36e574}from'os';class T extends a0_0x374eb6{[a0_0x5d7258(0x13e)];[a0_0x5d7258(0x13c)];['token'];['agent'];[a0_0x5d7258(0x12e)];['heartbeatInterval'];['reconnectDelay'];['heartbeatTimer'];['sseAbort'];[a0_0x5d7258(0x10e)]=!0x1;constructor(_0x128603){const _0x390f97=a0_0x5d7258;super();if(this['url']=_0x128603[_0x390f97(0x13e)][_0x390f97(0x12c)](/\/$/,''),this[_0x390f97(0x13c)]=_0x128603[_0x390f97(0x13c)],this[_0x390f97(0xf9)]=_0x128603[_0x390f97(0xf9)],this['agent']=_0x128603['agent']||_0x390f97(0x131),this['resumeId']=_0x390f97(0xfd)+_0x128603['alias']+'-'+Date[_0x390f97(0x105)]()[_0x390f97(0x14c)](0x24),this[_0x390f97(0x11e)]=_0x128603[_0x390f97(0x11e)]??0x2bf20,this['reconnectDelay']=_0x128603[_0x390f97(0x13a)]??0xbb8,_0x128603[_0x390f97(0x101)]!==!0x1)this[_0x390f97(0x108)]();}['log'](_0x1a5dfc){const _0x58ced5=a0_0x5d7258;console[_0x58ced5(0x111)]('['+new Date()[_0x58ced5(0x121)]()[_0x58ced5(0x124)](0x0,0x8)+']\x20[commhub:'+this[_0x58ced5(0x13c)]+']\x20'+_0x1a5dfc);}async[a0_0x5d7258(0x11d)](_0x342fad,_0x2bb864){const _0x33756c=a0_0x5d7258;let _0x17b16f={'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x17b16f[_0x33756c(0x146)]=_0x33756c(0x14d)+this['token'];let _0x2b2227=await(await fetch(this['url']+'/mcp',{'method':'POST','headers':_0x17b16f,'body':JSON['stringify']({'jsonrpc':_0x33756c(0x119),'id':Date['now'](),'method':'tools/call','params':{'name':_0x342fad,'arguments':_0x2bb864}})}))['text'](),_0x392b71=_0x2b2227['match'](/data: (.+)/),_0x390abd=_0x392b71?JSON[_0x33756c(0x139)](_0x392b71[0x1]):JSON['parse'](_0x2b2227),_0x2803ee=_0x390abd?.['result']?.[_0x33756c(0x138)]?.[0x0]?.[_0x33756c(0x129)];return _0x2803ee?JSON[_0x33756c(0x139)](_0x2803ee):_0x390abd;}async[a0_0x5d7258(0x108)](){const _0x176276=a0_0x5d7258;if(this['running'])return;this['running']=!0x0,await this[_0x176276(0x10a)](_0x176276(0x13f)),this[_0x176276(0x111)]('registered'),this[_0x176276(0x12f)]=setInterval(()=>{const _0x25fc3c=_0x176276;this['status'](_0x25fc3c(0x13f))[_0x25fc3c(0x130)](_0x3b3e14=>this[_0x25fc3c(0x111)](_0x25fc3c(0x109)+_0x3b3e14['message']));},this['heartbeatInterval']),this[_0x176276(0x140)]();}async[a0_0x5d7258(0x13b)](){const _0x2ed87e=a0_0x5d7258;if(this[_0x2ed87e(0x10e)]=!0x1,this['sseAbort']?.[_0x2ed87e(0x118)](),this[_0x2ed87e(0x12f)])clearInterval(this[_0x2ed87e(0x12f)]);await this[_0x2ed87e(0x10a)](_0x2ed87e(0x149))['catch'](()=>{}),this[_0x2ed87e(0x111)](_0x2ed87e(0xfb));}async[a0_0x5d7258(0x14e)](_0x1eeb90,_0x6f8a18,_0x1c164e=a0_0x5d7258(0x120)){const _0x472267=a0_0x5d7258;return this['call'](_0x472267(0x12b),{'alias':_0x1eeb90,'task':_0x6f8a18,'priority':_0x1c164e,'from_session':this['alias']});}async[a0_0x5d7258(0x13d)](_0x4c6b4a,_0xb8c8c9){const _0x5b2305=a0_0x5d7258;return this[_0x5b2305(0x11d)](_0x5b2305(0x133),{'alias':_0x4c6b4a,'message':_0xb8c8c9,'from_session':this[_0x5b2305(0x13c)]});}async[a0_0x5d7258(0xff)](_0x2c4faa,_0x347b50,_0x443d69='completed'){const _0x2e57b2=a0_0x5d7258;return this['call'](_0x2e57b2(0xff),{'task_id':_0x2c4faa,'text':_0x347b50,'status':_0x443d69});}async[a0_0x5d7258(0x10a)](_0x7ececb,_0x4e3d2b){const _0x49e5c7=a0_0x5d7258;return this['call'](_0x49e5c7(0x117),{'resume_id':this[_0x49e5c7(0x12e)],'alias':this[_0x49e5c7(0x13c)],'status':_0x7ececb,'server':a0_0x36e574(),'hostname':a0_0x36e574(),'agent':this[_0x49e5c7(0xfa)],'project_dir':process[_0x49e5c7(0x125)](),..._0x4e3d2b});}async[a0_0x5d7258(0x11f)](){const _0x3fc739=a0_0x5d7258;return this['call'](_0x3fc739(0x128),{});}async[a0_0x5d7258(0x136)](_0x3246c1,_0x2a6c42){const _0x223198=a0_0x5d7258;return this[_0x223198(0x11d)](_0x223198(0x136),{'message':_0x3246c1,'filter_server':_0x2a6c42?.['server'],'filter_status':_0x2a6c42?.['status']});}async[a0_0x5d7258(0x140)](){const _0x4d23a2=a0_0x5d7258;let _0x38633a=encodeURIComponent(this[_0x4d23a2(0x13c)]),_0x15aeca=this[_0x4d23a2(0x13e)]+_0x4d23a2(0x107)+_0x38633a,_0x5d685a=this[_0x4d23a2(0x13a)];while(this['running']){try{this['sseAbort']=new AbortController();let _0x5d2ed5={'Accept':_0x4d23a2(0x106)};if(this['token'])_0x5d2ed5[_0x4d23a2(0x146)]='Bearer\x20'+this[_0x4d23a2(0xf9)];let _0x2ea26e=await fetch(_0x15aeca,{'headers':_0x5d2ed5,'signal':this[_0x4d23a2(0x126)][_0x4d23a2(0x137)]});if(!_0x2ea26e['ok']||!_0x2ea26e[_0x4d23a2(0x122)]){this[_0x4d23a2(0x111)](_0x4d23a2(0x115)+_0x2ea26e[_0x4d23a2(0x10a)]),await this['sleep'](_0x5d685a),_0x5d685a=Math['min'](_0x5d685a*1.5,0xea60);continue;}_0x5d685a=this[_0x4d23a2(0x13a)];let _0x3da08d=_0x2ea26e[_0x4d23a2(0x122)][_0x4d23a2(0x12a)](),_0x561925=new TextDecoder(),_0x59c0a2='';while(this[_0x4d23a2(0x10e)]){let {done:_0x145f53,value:_0x2c0d10}=await _0x3da08d[_0x4d23a2(0x123)]();if(_0x145f53)break;_0x59c0a2+=_0x561925[_0x4d23a2(0x10b)](_0x2c0d10,{'stream':!0x0});let _0x5c8fa2=_0x59c0a2[_0x4d23a2(0x14f)]('\x0a');_0x59c0a2=_0x5c8fa2[_0x4d23a2(0x10c)]()||'';for(let _0x5bc1ad of _0x5c8fa2){if(!_0x5bc1ad['startsWith'](_0x4d23a2(0x100)))continue;try{let _0x25ab51=JSON[_0x4d23a2(0x139)](_0x5bc1ad[_0x4d23a2(0x124)](0x6));if(_0x25ab51[_0x4d23a2(0x12d)]===_0x4d23a2(0x113)){this[_0x4d23a2(0x111)](_0x4d23a2(0x144)),this[_0x4d23a2(0x102)](_0x4d23a2(0x113));continue;}if(_0x25ab51['type']===_0x4d23a2(0x141)||_0x25ab51[_0x4d23a2(0x12d)]===_0x4d23a2(0x127)||_0x25ab51[_0x4d23a2(0x12d)]==='broadcast')await this['processInbox']();}catch{}}}}catch(_0x583edb){if(_0x583edb['name']===_0x4d23a2(0x147))break;this[_0x4d23a2(0x102)]('error',_0x583edb),this['log'](_0x4d23a2(0x10d)+_0x583edb[_0x4d23a2(0x13d)]);}if(this[_0x4d23a2(0x10e)])this[_0x4d23a2(0x102)](_0x4d23a2(0xfb)),this[_0x4d23a2(0x111)]('SSE\x20reconnecting\x20in\x20'+_0x5d685a/0x3e8+_0x4d23a2(0xfe)),await this[_0x4d23a2(0x148)](_0x5d685a),_0x5d685a=Math[_0x4d23a2(0xfc)](_0x5d685a*1.5,0xea60);}}async[a0_0x5d7258(0x112)](){const _0x87c625=a0_0x5d7258;try{let _0xa9fee0=(await this[_0x87c625(0x11d)](_0x87c625(0x142),{'alias':this['alias'],'limit':0xa}))?.['messages']||[];for(let _0x15d4ba of _0xa9fee0)await this[_0x87c625(0x11d)](_0x87c625(0x114),{'alias':this[_0x87c625(0x13c)],'message_id':_0x15d4ba['id']}),this[_0x87c625(0x111)]('←\x20'+_0x15d4ba[_0x87c625(0x11a)]+':\x20'+_0x15d4ba[_0x87c625(0x138)][_0x87c625(0x124)](0x0,0x3c)),this[_0x87c625(0x102)](_0x87c625(0x11b),_0x15d4ba),this[_0x87c625(0x102)]('message',_0x15d4ba);}catch(_0x780fbc){this[_0x87c625(0x111)](_0x87c625(0x135)+_0x780fbc['message']);}}[a0_0x5d7258(0x148)](_0x2cbc4a){return new Promise(_0x462f43=>setTimeout(_0x462f43,_0x2cbc4a));}}var $=T;export{$ as default,T as CommHub};
1
+ const a0_0x18f9cc=a0_0x3913;(function(_0x46f0ef,_0x494782){const _0x229911=a0_0x3913,_0xd35e28=_0x46f0ef();while(!![]){try{const _0xb9e59b=parseInt(_0x229911(0x1b1))/0x1+parseInt(_0x229911(0x1af))/0x2*(parseInt(_0x229911(0x1cd))/0x3)+parseInt(_0x229911(0x19e))/0x4*(parseInt(_0x229911(0x1d4))/0x5)+-parseInt(_0x229911(0x19c))/0x6+parseInt(_0x229911(0x1da))/0x7+-parseInt(_0x229911(0x1c9))/0x8*(parseInt(_0x229911(0x1a6))/0x9)+parseInt(_0x229911(0x1ac))/0xa*(-parseInt(_0x229911(0x1d8))/0xb);if(_0xb9e59b===_0x494782)break;else _0xd35e28['push'](_0xd35e28['shift']());}catch(_0x5d3a1d){_0xd35e28['push'](_0xd35e28['shift']());}}}(a0_0x4ea1,0x1e6c9));import{EventEmitter as a0_0x392e5e}from'events';import{hostname as a0_0x2feaec}from'os';function a0_0x3913(_0x5ec9dd,_0x3f6d4f){_0x5ec9dd=_0x5ec9dd-0x190;const _0x4ea1c8=a0_0x4ea1();let _0x3913ce=_0x4ea1c8[_0x5ec9dd];return _0x3913ce;}function a0_0x4ea1(){const _0x302a1b=['2871130GCjtsl','send_message','task','714qHerwk','send','218934orcABy','server','new_message','2.0','SSE\x20error:\x20','Authorization','stringify','token','now','messages','replace','processInbox','result','read','completed','idle','status','error','toTimeString','report_status','log','sdk-','offline','agent','24SmgQhi','normal','heartbeat\x20failed:\x20','url','1935kPkpPp',']\x20[commhub:','slice','get_all_status','connected','call','alias','10715qmPKKL','from_session','connect','emit','11ketTUX','split','1426355nMUzud','getReader','sleep','sseAbort','reconnectDelay','ack_inbox','abort','tools/call','heartbeatTimer','catch','resumeId','SSE\x20reconnecting\x20in\x20','Bearer\x20','body','getAllStatus','parse','SSE\x20connected','send_task','connectSSE','s...','min','startsWith','content','/events/','1408038zndgSu','POST','264arGJUZ','disconnect','get_inbox','broadcast','heartbeatInterval','running','disconnected','application/json,\x20text/event-stream','443997KMVfNN','autoConnect','new_task','message','SSE\x20failed:\x20','type'];a0_0x4ea1=function(){return _0x302a1b;};return a0_0x4ea1();}class T extends a0_0x392e5e{[a0_0x18f9cc(0x1cc)];[a0_0x18f9cc(0x1d3)];[a0_0x18f9cc(0x1b8)];[a0_0x18f9cc(0x1c8)];[a0_0x18f9cc(0x1e4)];[a0_0x18f9cc(0x1a2)];['reconnectDelay'];[a0_0x18f9cc(0x1e2)];[a0_0x18f9cc(0x1dd)];[a0_0x18f9cc(0x1a3)]=!0x1;constructor(_0x320acb){const _0x139303=a0_0x18f9cc;super();if(this['url']=_0x320acb['url'][_0x139303(0x1bb)](/\/$/,''),this[_0x139303(0x1d3)]=_0x320acb[_0x139303(0x1d3)],this[_0x139303(0x1b8)]=_0x320acb[_0x139303(0x1b8)],this[_0x139303(0x1c8)]=_0x320acb[_0x139303(0x1c8)]||'sdk',this[_0x139303(0x1e4)]=_0x139303(0x1c6)+_0x320acb[_0x139303(0x1d3)]+'-'+Date[_0x139303(0x1b9)]()['toString'](0x24),this[_0x139303(0x1a2)]=_0x320acb[_0x139303(0x1a2)]??0x2bf20,this[_0x139303(0x1de)]=_0x320acb[_0x139303(0x1de)]??0xbb8,_0x320acb[_0x139303(0x1a7)]!==!0x1)this[_0x139303(0x1d6)]();}[a0_0x18f9cc(0x1c5)](_0x20b5f8){const _0x182930=a0_0x18f9cc;console[_0x182930(0x1c5)]('['+new Date()[_0x182930(0x1c3)]()[_0x182930(0x1cf)](0x0,0x8)+_0x182930(0x1ce)+this[_0x182930(0x1d3)]+']\x20'+_0x20b5f8);}async[a0_0x18f9cc(0x1d2)](_0x53036d,_0x492dac){const _0x294bd7=a0_0x18f9cc;let _0x4e4eae={'Content-Type':'application/json','Accept':_0x294bd7(0x1a5)};if(this[_0x294bd7(0x1b8)])_0x4e4eae['Authorization']='Bearer\x20'+this[_0x294bd7(0x1b8)];let _0x443761=await(await fetch(this[_0x294bd7(0x1cc)]+'/mcp',{'method':_0x294bd7(0x19d),'headers':_0x4e4eae,'body':JSON[_0x294bd7(0x1b7)]({'jsonrpc':_0x294bd7(0x1b4),'id':Date[_0x294bd7(0x1b9)](),'method':_0x294bd7(0x1e1),'params':{'name':_0x53036d,'arguments':_0x492dac}})}))['text'](),_0x46d8be=_0x443761['match'](/data: (.+)/),_0x23b964=_0x46d8be?JSON[_0x294bd7(0x193)](_0x46d8be[0x1]):JSON[_0x294bd7(0x193)](_0x443761),_0x1eacce=_0x23b964?.[_0x294bd7(0x1bd)]?.[_0x294bd7(0x19a)]?.[0x0]?.['text'];return _0x1eacce?JSON[_0x294bd7(0x193)](_0x1eacce):_0x23b964;}async[a0_0x18f9cc(0x1d6)](){const _0x55a5aa=a0_0x18f9cc;if(this[_0x55a5aa(0x1a3)])return;this[_0x55a5aa(0x1a3)]=!0x0,await this[_0x55a5aa(0x1c1)](_0x55a5aa(0x1c0)),this[_0x55a5aa(0x1c5)]('registered'),this[_0x55a5aa(0x1e2)]=setInterval(()=>{const _0x425104=_0x55a5aa;this[_0x425104(0x1c1)](_0x425104(0x1c0))[_0x425104(0x1e3)](_0x23b715=>this[_0x425104(0x1c5)](_0x425104(0x1cb)+_0x23b715[_0x425104(0x1a9)]));},this[_0x55a5aa(0x1a2)]),this[_0x55a5aa(0x196)]();}async[a0_0x18f9cc(0x19f)](){const _0x4b3ef1=a0_0x18f9cc;if(this[_0x4b3ef1(0x1a3)]=!0x1,this[_0x4b3ef1(0x1dd)]?.[_0x4b3ef1(0x1e0)](),this[_0x4b3ef1(0x1e2)])clearInterval(this[_0x4b3ef1(0x1e2)]);await this[_0x4b3ef1(0x1c1)](_0x4b3ef1(0x1c7))[_0x4b3ef1(0x1e3)](()=>{}),this['log'](_0x4b3ef1(0x1a4));}async[a0_0x18f9cc(0x1b0)](_0x4211ae,_0x274346,_0x38b41e=a0_0x18f9cc(0x1ca)){const _0x4edbd4=a0_0x18f9cc;return this[_0x4edbd4(0x1d2)](_0x4edbd4(0x195),{'alias':_0x4211ae,'task':_0x274346,'priority':_0x38b41e,'from_session':this[_0x4edbd4(0x1d3)]});}async[a0_0x18f9cc(0x1a9)](_0x5cd9d8,_0x1d0f6d){const _0x5622b7=a0_0x18f9cc;return this[_0x5622b7(0x1d2)](_0x5622b7(0x1ad),{'alias':_0x5cd9d8,'message':_0x1d0f6d,'from_session':this[_0x5622b7(0x1d3)]});}async['reply'](_0x2ceeb7,_0x402af6,_0x384341=a0_0x18f9cc(0x1bf)){return this['call']('reply',{'task_id':_0x2ceeb7,'text':_0x402af6,'status':_0x384341});}async['status'](_0x5563f3,_0x2fce50){const _0x477c3f=a0_0x18f9cc;return this['call'](_0x477c3f(0x1c4),{'resume_id':this[_0x477c3f(0x1e4)],'alias':this['alias'],'status':_0x5563f3,'server':a0_0x2feaec(),'hostname':a0_0x2feaec(),'agent':this[_0x477c3f(0x1c8)],'project_dir':process['cwd'](),..._0x2fce50});}async[a0_0x18f9cc(0x192)](){const _0x35e632=a0_0x18f9cc;return this[_0x35e632(0x1d2)](_0x35e632(0x1d0),{});}async[a0_0x18f9cc(0x1a1)](_0x24c1ce,_0x268cee){const _0x65f9f9=a0_0x18f9cc;return this[_0x65f9f9(0x1d2)](_0x65f9f9(0x1a1),{'message':_0x24c1ce,'filter_server':_0x268cee?.[_0x65f9f9(0x1b2)],'filter_status':_0x268cee?.['status']});}async['connectSSE'](){const _0xff22a4=a0_0x18f9cc;let _0x5d00e2=encodeURIComponent(this[_0xff22a4(0x1d3)]),_0x25d3ae=this[_0xff22a4(0x1cc)]+_0xff22a4(0x19b)+_0x5d00e2,_0x35a36f=this[_0xff22a4(0x1de)];while(this[_0xff22a4(0x1a3)]){try{this[_0xff22a4(0x1dd)]=new AbortController();let _0x206501={'Accept':'text/event-stream'};if(this[_0xff22a4(0x1b8)])_0x206501[_0xff22a4(0x1b6)]=_0xff22a4(0x190)+this[_0xff22a4(0x1b8)];let _0x5220f0=await fetch(_0x25d3ae,{'headers':_0x206501,'signal':this[_0xff22a4(0x1dd)]['signal']});if(!_0x5220f0['ok']||!_0x5220f0[_0xff22a4(0x191)]){this[_0xff22a4(0x1c5)](_0xff22a4(0x1aa)+_0x5220f0[_0xff22a4(0x1c1)]),await this[_0xff22a4(0x1dc)](_0x35a36f),_0x35a36f=Math[_0xff22a4(0x198)](_0x35a36f*1.5,0xea60);continue;}_0x35a36f=this[_0xff22a4(0x1de)];let _0x1f7685=_0x5220f0[_0xff22a4(0x191)][_0xff22a4(0x1db)](),_0x5501fa=new TextDecoder(),_0x4573f3='';while(this[_0xff22a4(0x1a3)]){let {done:_0x34e0db,value:_0x166e42}=await _0x1f7685[_0xff22a4(0x1be)]();if(_0x34e0db)break;_0x4573f3+=_0x5501fa['decode'](_0x166e42,{'stream':!0x0});let _0x151a2b=_0x4573f3[_0xff22a4(0x1d9)]('\x0a');_0x4573f3=_0x151a2b['pop']()||'';for(let _0xc7ab8a of _0x151a2b){if(!_0xc7ab8a[_0xff22a4(0x199)]('data:\x20'))continue;try{let _0x49cc8d=JSON[_0xff22a4(0x193)](_0xc7ab8a[_0xff22a4(0x1cf)](0x6));if(_0x49cc8d['type']===_0xff22a4(0x1d1)){this[_0xff22a4(0x1c5)](_0xff22a4(0x194)),this[_0xff22a4(0x1d7)](_0xff22a4(0x1d1));continue;}if(_0x49cc8d[_0xff22a4(0x1ab)]===_0xff22a4(0x1a8)||_0x49cc8d[_0xff22a4(0x1ab)]===_0xff22a4(0x1b3)||_0x49cc8d[_0xff22a4(0x1ab)]===_0xff22a4(0x1a1))await this[_0xff22a4(0x1bc)]();}catch{}}}}catch(_0x34b75b){if(_0x34b75b['name']==='AbortError')break;this[_0xff22a4(0x1d7)](_0xff22a4(0x1c2),_0x34b75b),this[_0xff22a4(0x1c5)](_0xff22a4(0x1b5)+_0x34b75b[_0xff22a4(0x1a9)]);}if(this[_0xff22a4(0x1a3)])this['emit'](_0xff22a4(0x1a4)),this['log'](_0xff22a4(0x1e5)+_0x35a36f/0x3e8+_0xff22a4(0x197)),await this[_0xff22a4(0x1dc)](_0x35a36f),_0x35a36f=Math[_0xff22a4(0x198)](_0x35a36f*1.5,0xea60);}}async[a0_0x18f9cc(0x1bc)](){const _0x12cddd=a0_0x18f9cc;try{let _0x172b89=(await this[_0x12cddd(0x1d2)](_0x12cddd(0x1a0),{'alias':this[_0x12cddd(0x1d3)],'limit':0xa}))?.[_0x12cddd(0x1ba)]||[];for(let _0xc3ae88 of _0x172b89)await this['call'](_0x12cddd(0x1df),{'alias':this[_0x12cddd(0x1d3)],'message_id':_0xc3ae88['id']}),this['log']('←\x20'+_0xc3ae88[_0x12cddd(0x1d5)]+':\x20'+_0xc3ae88[_0x12cddd(0x19a)][_0x12cddd(0x1cf)](0x0,0x3c)),this[_0x12cddd(0x1d7)](_0x12cddd(0x1ae),_0xc3ae88),this[_0x12cddd(0x1d7)](_0x12cddd(0x1a9),_0xc3ae88);}catch(_0x31aedd){this['log']('inbox\x20error:\x20'+_0x31aedd['message']);}}[a0_0x18f9cc(0x1dc)](_0x5e9054){return new Promise(_0x863d89=>setTimeout(_0x863d89,_0x5e9054));}}var $=T;export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x1788e5=a0_0xae98;(function(_0x4e0c22,_0x3332c7){const _0x17eea5=a0_0xae98,_0x5f5000=_0x4e0c22();while(!![]){try{const _0x358146=-parseInt(_0x17eea5(0x21f))/0x1*(-parseInt(_0x17eea5(0x1c4))/0x2)+-parseInt(_0x17eea5(0x1de))/0x3+-parseInt(_0x17eea5(0x200))/0x4*(parseInt(_0x17eea5(0x22a))/0x5)+parseInt(_0x17eea5(0x1ba))/0x6+-parseInt(_0x17eea5(0x1a9))/0x7+-parseInt(_0x17eea5(0x1ff))/0x8*(-parseInt(_0x17eea5(0x1ca))/0x9)+parseInt(_0x17eea5(0x1c1))/0xa;if(_0x358146===_0x3332c7)break;else _0x5f5000['push'](_0x5f5000['shift']());}catch(_0x2fe79d){_0x5f5000['push'](_0x5f5000['shift']());}}}(a0_0x532a,0xd4a86));import{readFileSync as a0_0x46e71a,existsSync as a0_0x5a2ae9}from'fs';import{join as a0_0x50dbd1}from'path';import{hostname as a0_0xacd5a}from'os';import{execSync as a0_0x52bfc2}from'child_process';import{Server as a0_0x33fbcb}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x19db8d}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x5b9919,CallToolRequestSchema as a0_0x260f94}from'@modelcontextprotocol/sdk/types.js';function p(_0x39d099){const _0x5f0944=a0_0xae98;if(!a0_0x5a2ae9(_0x39d099))return;for(let _0xffcb7e of a0_0x46e71a(_0x39d099,_0x5f0944(0x216))[_0x5f0944(0x221)]('\x0a')){let _0x53eeca=_0xffcb7e[_0x5f0944(0x1bb)]();if(!_0x53eeca||_0x53eeca[_0x5f0944(0x1d0)]('#'))continue;let _0x454247=_0x53eeca[_0x5f0944(0x20e)]('=');if(_0x454247<0x0)continue;let _0x9d9421=_0x53eeca['slice'](0x0,_0x454247)[_0x5f0944(0x1bb)](),_0x550b19=_0x53eeca[_0x5f0944(0x1c6)](_0x454247+0x1)[_0x5f0944(0x1bb)]()[_0x5f0944(0x1d2)](/^["']|["']$/g,'');if(!process.env[_0x9d9421])process.env[_0x9d9421]=_0x550b19;}}var C=process.env.HOME||'~',T=a0_0x50dbd1(C,a0_0x1788e5(0x1dd));p(a0_0x50dbd1(T,'.env'));var L=process[a0_0x1788e5(0x1ce)]()[a0_0x1788e5(0x1d2)](/\//g,'-');p(a0_0x50dbd1(T,L,'.env'));function U(){const _0x5e969d=a0_0x1788e5;try{return a0_0x52bfc2('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x5e969d(0x216),'timeout':0x7d0})[_0x5e969d(0x1bb)]();}catch{return'';}}function a0_0xae98(_0xe00cde,_0xfd0fb9){_0xe00cde=_0xe00cde-0x1a1;const _0x532a15=a0_0x532a();let _0xae98df=_0x532a15[_0xe00cde];return _0xae98df;}function c(){const _0x695aca=a0_0x1788e5;try{let _0x162393=a0_0x50dbd1(C,'.anet',_0x695aca(0x1e1));if(a0_0x5a2ae9(_0x162393))return JSON[_0x695aca(0x1c0)](a0_0x46e71a(_0x162393,_0x695aca(0x216)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x1788e5(0x22d)]||'http://127.0.0.1:9200',f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0xacd5a(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x1788e5(0x1bd)](),X=process.env.COMMHUB_TOKEN||H[a0_0x1788e5(0x210)]||'';function Y(_0x5592fa){const _0x23bfdd=a0_0x1788e5;let _0x579404=new Date()[_0x23bfdd(0x1cf)]()[_0x23bfdd(0x1c6)](0x0,0x8);process[_0x23bfdd(0x1c9)]['write']('['+_0x579404+_0x23bfdd(0x20b)+_0x5592fa+'\x0a');}function h(_0x5e2912){return new Promise(_0x5829a7=>setTimeout(_0x5829a7,_0x5e2912));}Y(a0_0x1788e5(0x1af)+D+a0_0x1788e5(0x1ed)+Z+'\x20RESUME_ID='+w[a0_0x1788e5(0x1c6)](0x0,0x8)+a0_0x1788e5(0x1f7)+(f||a0_0x1788e5(0x1ad))+'\x20CWD='+process[a0_0x1788e5(0x1ce)]()+a0_0x1788e5(0x222)+L);var k=new Map(),K=new a0_0x33fbcb({'name':a0_0x1788e5(0x226),'version':a0_0x1788e5(0x1b6)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x1788e5(0x1da),a0_0x1788e5(0x1e8),a0_0x1788e5(0x204),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x1788e5(0x1b5)+Z][a0_0x1788e5(0x1d8)]('\x0a')});K[a0_0x1788e5(0x1e7)](a0_0x5b9919,async()=>({'tools':[{'name':a0_0x1788e5(0x20d),'description':a0_0x1788e5(0x1a6),'inputSchema':{'type':a0_0x1788e5(0x1ae),'properties':{'task_id':{'type':a0_0x1788e5(0x1e0),'description':a0_0x1788e5(0x225)},'text':{'type':'string','description':a0_0x1788e5(0x1ec)},'status':{'type':a0_0x1788e5(0x1e0),'enum':[a0_0x1788e5(0x1a4),a0_0x1788e5(0x1fc),a0_0x1788e5(0x213),'blocked',a0_0x1788e5(0x1f9),a0_0x1788e5(0x1b8)],'description':a0_0x1788e5(0x1e6)}},'required':['text']}},{'name':a0_0x1788e5(0x1a3),'description':a0_0x1788e5(0x1f4),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x1788e5(0x1e0),'enum':[a0_0x1788e5(0x1f0),a0_0x1788e5(0x21b),a0_0x1788e5(0x1cd),'error']},'task':{'type':a0_0x1788e5(0x1e0),'description':a0_0x1788e5(0x1d9)},'progress':{'type':'number','description':a0_0x1788e5(0x1d1)}},'required':[a0_0x1788e5(0x1db)]}},{'name':a0_0x1788e5(0x20c),'description':a0_0x1788e5(0x1b0),'inputSchema':{'type':a0_0x1788e5(0x1ae),'properties':{'alias':{'type':a0_0x1788e5(0x1e0),'description':a0_0x1788e5(0x1cb)},'task':{'type':a0_0x1788e5(0x1e0),'description':'Task\x20content'},'priority':{'type':a0_0x1788e5(0x1e0),'enum':[a0_0x1788e5(0x1b3),a0_0x1788e5(0x1eb),'low'],'description':a0_0x1788e5(0x1f1)}},'required':[a0_0x1788e5(0x1f8),'task']}},{'name':a0_0x1788e5(0x1d4),'description':a0_0x1788e5(0x1d5),'inputSchema':{'type':a0_0x1788e5(0x1ae),'properties':{'alias':{'type':a0_0x1788e5(0x1e0),'description':a0_0x1788e5(0x1cb)},'message':{'type':a0_0x1788e5(0x1e0),'description':a0_0x1788e5(0x207)}},'required':[a0_0x1788e5(0x1f8),a0_0x1788e5(0x1e3)]}},{'name':a0_0x1788e5(0x21a),'description':a0_0x1788e5(0x215),'inputSchema':{'type':a0_0x1788e5(0x1ae),'properties':{}}}]}));function a0_0x532a(){const _0x337c43=['slice','pop','2.0','stderr','873OWuMZR','Target\x20session\x20alias','parse\x20error:\x20','blocked','cwd','toTimeString','startsWith','Progress\x200-100','replace','broadcast','commhub_send_message','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','ready\x20—\x20waiting\x20for\x20events','from','join','Current\x20task\x20description','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','status','end','.claude/channels/commhub','1933221JtsYmo','init\x20failed:\x20','string','config.json','connect','message','warning:\x20could\x20not\x20register:\x20','send_task','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','setRequestHandler','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','type','session\x20disconnected','normal','Reply\x20text\x20/\x20result\x20summary','\x20ALIAS=','\x20priority=','text','working','Priority\x20(default:\x20normal)','from_session','read','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','messages','SSE\x20stream\x20ended,\x20reconnecting...','...\x20TMUX=','alias','error','Bearer\x20','getReader','failed','body','decode','54232CtaDHw','23396XiUvQF','delete','2025-03-26','data:\x20','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','message_id','notifications/claude/channel','Message\x20content','→\x20injected\x20task\x20','notification','\x22\x20(',']\x20[commhub]\x20','commhub_send_task','commhub_reply','indexOf','/mcp','token','claude-code','find','cancelled','send_message','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','utf-8','tools/call','replied','catch','commhub_get_all_status','idle','fatal:\x20','SSE\x20connection\x20error:\x20','stdin','34019ZphaZE','unknown\x20tool','split','\x20PROJECT_ENV=','result','/events/','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','commhub-channel','MCP\x20stdio\x20connected','inbox_count','priority','985VhiFmP','then','report_status','hub','get_inbox','exit','commhub_report_status','completed','SSE\x20error:\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','commhub','SIGTERM','5698028EQGhRZ','send_reply','Authorization','SSE\x20fatal:\x20','none','object','ENV:\x20URL=','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','content','application/json','high','stringify','Session\x20alias:\x20','0.3.0','ack_inbox','in_progress','statusText','160536XtaypD','trim','length','randomUUID','new_task','set','parse','24572010jjMPkY','application/json,\x20text/event-stream','shutting\x20down,\x20reporting\x20offline...','20JilgAz','POST'];a0_0x532a=function(){return _0x337c43;};return a0_0x532a();}async function P(_0x1561c3,_0x273fd9){const _0x5a2a82=a0_0x1788e5;let _0x5fcf67=await fetch(D+'/mcp',{'method':_0x5a2a82(0x1c5),'headers':{'Content-Type':_0x5a2a82(0x1b2),'Accept':_0x5a2a82(0x1c2),...X?{'Authorization':_0x5a2a82(0x1fa)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x5a2a82(0x1c8),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x5a2a82(0x202),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':'0.3.0'}}})});if(!_0x5fcf67['ok']){let _0x202c26=await _0x5fcf67[_0x5a2a82(0x1ef)]();return Y('CommHub\x20init\x20failed:\x20'+_0x5fcf67[_0x5a2a82(0x1db)]+'\x20'+_0x202c26[_0x5a2a82(0x1c6)](0x0,0x64)),{'ok':!0x1,'error':_0x5a2a82(0x1df)+_0x5fcf67[_0x5a2a82(0x1db)]};}await _0x5fcf67['text']();let _0x11aec9=(await(await fetch(D+_0x5a2a82(0x20f),{'method':_0x5a2a82(0x1c5),'headers':{'Content-Type':_0x5a2a82(0x1b2),'Accept':_0x5a2a82(0x1c2),...X?{'Authorization':_0x5a2a82(0x1fa)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x2,'method':_0x5a2a82(0x217),'params':{'name':_0x1561c3,'arguments':_0x273fd9}})}))[_0x5a2a82(0x1ef)]())[_0x5a2a82(0x221)]('\x0a')[_0x5a2a82(0x212)](_0x384580=>_0x384580[_0x5a2a82(0x1d0)]('data:\x20'));if(_0x11aec9){let _0x3b681c=JSON[_0x5a2a82(0x1c0)](_0x11aec9[_0x5a2a82(0x1c6)](0x6));return _0x3b681c?.[_0x5a2a82(0x223)]?.[_0x5a2a82(0x1b1)]?.[0x0]?.['text']?JSON[_0x5a2a82(0x1c0)](_0x3b681c[_0x5a2a82(0x223)][_0x5a2a82(0x1b1)][0x0][_0x5a2a82(0x1ef)]):_0x3b681c;}return{'ok':!0x1,'error':'no\x20response'};}K['setRequestHandler'](a0_0x260f94,async _0x4d631e=>{const _0x106fec=a0_0x1788e5;let {name:_0x1bcd51,arguments:_0x2e2fab}=_0x4d631e['params'];if(_0x1bcd51===_0x106fec(0x20d)){let {task_id:_0x5adf96,text:_0x1b9a74,status:_0x155e3b}=_0x2e2fab;if(_0x155e3b===_0x106fec(0x1a4)||_0x155e3b===_0x106fec(0x1fc)||_0x155e3b===_0x106fec(0x213)){let _0x294bde=_0x155e3b===_0x106fec(0x1a4)?_0x106fec(0x218):_0x155e3b,_0x195ac6=_0x5adf96?k['get'](_0x5adf96)||_0x106fec(0x22d):_0x106fec(0x22d),_0x456d0e=await P(_0x106fec(0x1aa),{'alias':_0x195ac6,'text':_0x1b9a74,'in_reply_to':_0x5adf96||void 0x0,'status':_0x294bde,'from_session':Z});if(_0x5adf96)k[_0x106fec(0x201)](_0x5adf96);return{'content':[{'type':_0x106fec(0x1ef),'text':JSON['stringify'](_0x456d0e)}]};}let _0x27290e=await P(_0x106fec(0x22c),{'resume_id':w,'alias':Z,'status':_0x155e3b===_0x106fec(0x1cd)?_0x106fec(0x1cd):_0x155e3b===_0x106fec(0x1f9)?_0x106fec(0x1f9):'working','task':_0x1b9a74[_0x106fec(0x1c6)](0x0,0xc8),'output':_0x1b9a74});return{'content':[{'type':_0x106fec(0x1ef),'text':JSON[_0x106fec(0x1b4)](_0x27290e)}]};}if(_0x1bcd51===_0x106fec(0x1a3)){let {status:_0x58bfc2,task:_0x1b8b70,progress:_0x4643f6}=_0x2e2fab,_0x2bbe4e=await P(_0x106fec(0x22c),{'resume_id':w,'alias':Z,'status':_0x58bfc2,'task':_0x1b8b70,'progress':_0x4643f6});return{'content':[{'type':_0x106fec(0x1ef),'text':JSON[_0x106fec(0x1b4)](_0x2bbe4e)}]};}if(_0x1bcd51===_0x106fec(0x20c)){let {alias:_0x554f3d,task:_0x13d400,priority:_0x4d3980}=_0x2e2fab,_0x1b360e=await P(_0x106fec(0x1e5),{'alias':_0x554f3d,'task':_0x13d400,'priority':_0x4d3980||'normal','from_session':Z});return{'content':[{'type':'text','text':JSON[_0x106fec(0x1b4)](_0x1b360e)}]};}if(_0x1bcd51===_0x106fec(0x1d4)){let {alias:_0x233e01,message:_0x1dc4bd}=_0x2e2fab,_0x5bd8d2=await P(_0x106fec(0x214),{'alias':_0x233e01,'message':_0x1dc4bd,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x106fec(0x1b4)](_0x5bd8d2)}]};}if(_0x1bcd51===_0x106fec(0x21a)){let _0x548170=await P('get_all_status',{});return{'content':[{'type':'text','text':JSON[_0x106fec(0x1b4)](_0x548170)}]};}return{'content':[{'type':_0x106fec(0x1ef),'text':JSON[_0x106fec(0x1b4)]({'error':_0x106fec(0x220)})}]};});async function v(){const _0x57420e=a0_0x1788e5;let _0x35d4cd=D+_0x57420e(0x224)+encodeURIComponent(Z),_0x40cd53={};if(X)_0x40cd53[_0x57420e(0x1ab)]='Bearer\x20'+X;Y('connecting\x20to\x20'+_0x35d4cd);while(!0x0){try{let _0xff584d=await fetch(_0x35d4cd,{'headers':_0x40cd53});if(!_0xff584d['ok']){Y(_0x57420e(0x1a5)+_0xff584d[_0x57420e(0x1db)]+'\x20'+_0xff584d[_0x57420e(0x1b9)]),await h(0x1388);continue;}let _0x3b5945=_0xff584d[_0x57420e(0x1fd)][_0x57420e(0x1fb)](),_0x3a644f=new TextDecoder(),_0x2f38cc='';while(!0x0){let {done:_0x31002d,value:_0x3919ba}=await _0x3b5945[_0x57420e(0x1f3)]();if(_0x31002d)break;_0x2f38cc+=_0x3a644f[_0x57420e(0x1fe)](_0x3919ba,{'stream':!0x0});let _0x122738=_0x2f38cc[_0x57420e(0x221)]('\x0a\x0a');_0x2f38cc=_0x122738[_0x57420e(0x1c7)]()||'';for(let _0x26dfaa of _0x122738){let _0x2a43c8=_0x26dfaa[_0x57420e(0x221)]('\x0a')[_0x57420e(0x212)](_0x32e473=>_0x32e473['startsWith'](_0x57420e(0x203)));if(!_0x2a43c8)continue;try{let _0x521ab2=JSON['parse'](_0x2a43c8[_0x57420e(0x1c6)](0x6));await u(_0x521ab2);}catch(_0x3b6f7f){Y(_0x57420e(0x1cc)+_0x3b6f7f);}}}Y(_0x57420e(0x1f6));}catch(_0x330436){Y(_0x57420e(0x21d)+_0x330436);}await h(0xbb8);}}async function u(_0x2d3af6){const _0x486d98=a0_0x1788e5;if(_0x2d3af6['type']==='connected'){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x2d3af6[_0x486d98(0x1e9)]==='new_message'){if(Y('←\x20message\x20from\x20'+_0x2d3af6[_0x486d98(0x1d7)]+':\x20'+_0x2d3af6['message'][_0x486d98(0x1c6)](0x0,0x3c)),await K[_0x486d98(0x209)]({'method':_0x486d98(0x206),'params':{'content':_0x2d3af6[_0x486d98(0x1e3)],'meta':{'sender':_0x2d3af6[_0x486d98(0x1d7)]||_0x486d98(0x22d),'sender_id':_0x486d98(0x1a7),'user':_0x2d3af6[_0x486d98(0x1d7)]||_0x486d98(0x22d),'priority':_0x486d98(0x1eb)}}}),_0x2d3af6[_0x486d98(0x205)])await P(_0x486d98(0x1b7),{'alias':Z,'message_id':_0x2d3af6[_0x486d98(0x205)]});return;}if(_0x2d3af6[_0x486d98(0x1e9)]===_0x486d98(0x1be)||_0x2d3af6[_0x486d98(0x1e9)]===_0x486d98(0x1d3)){Y('←\x20'+_0x2d3af6[_0x486d98(0x1e9)]+':\x20inbox_count='+_0x2d3af6[_0x486d98(0x228)]+_0x486d98(0x1ee)+(_0x2d3af6[_0x486d98(0x229)]||_0x486d98(0x1eb)));let _0x23fd74=await P(_0x486d98(0x1a1),{'alias':Z,'limit':0x5});if(_0x23fd74?.['ok']&&_0x23fd74[_0x486d98(0x1f5)]?.[_0x486d98(0x1bc)]>0x0)for(let _0x9a4af5 of _0x23fd74[_0x486d98(0x1f5)]){let _0x5e52c0={'sender':_0x9a4af5[_0x486d98(0x1f2)]||_0x486d98(0x22d),'sender_id':'commhub','user':_0x9a4af5[_0x486d98(0x1f2)]||_0x486d98(0x22d),'task_id':_0x9a4af5['id'],'priority':_0x9a4af5[_0x486d98(0x229)]||_0x486d98(0x1eb)};k[_0x486d98(0x1bf)](_0x9a4af5['id'],_0x9a4af5[_0x486d98(0x1f2)]||_0x486d98(0x22d)),await K[_0x486d98(0x209)]({'method':'notifications/claude/channel','params':{'content':_0x9a4af5['content'],'meta':_0x5e52c0}}),Y(_0x486d98(0x208)+_0x9a4af5['id']['slice'](0x0,0x8)+'\x20from\x20'+_0x9a4af5[_0x486d98(0x1f2)]+':\x20'+_0x9a4af5[_0x486d98(0x1b1)]['slice'](0x0,0x3c)),await P(_0x486d98(0x1b7),{'alias':Z,'message_id':_0x9a4af5['id']});}}}async function S(){const _0x1439ff=a0_0x1788e5;let _0x2daec4=new a0_0x19db8d();await K[_0x1439ff(0x1e2)](_0x2daec4),Y(_0x1439ff(0x227)),Y('starting\x20SSE\x20listener...'),v()[_0x1439ff(0x219)](_0x2d3531=>Y(_0x1439ff(0x1ac)+_0x2d3531)),P(_0x1439ff(0x22c),{'resume_id':w,'alias':Z,'status':_0x1439ff(0x21b),'server':a0_0xacd5a(),'hostname':a0_0xacd5a(),'agent':_0x1439ff(0x211),'project_dir':process[_0x1439ff(0x1ce)](),'tmux_name':f||void 0x0})[_0x1439ff(0x22b)](()=>Y('registered\x20as\x20\x22'+Z+_0x1439ff(0x20a)+w[_0x1439ff(0x1c6)](0x0,0x8)+')'))['catch'](_0x1e4b17=>Y(_0x1439ff(0x1e4)+_0x1e4b17)),setInterval(()=>{const _0xd507ca=_0x1439ff;P(_0xd507ca(0x22c),{'resume_id':w,'alias':Z,'status':_0xd507ca(0x21b),'server':a0_0xacd5a(),'hostname':a0_0xacd5a(),'agent':_0xd507ca(0x211),'project_dir':process[_0xd507ca(0x1ce)](),'tmux_name':f||void 0x0})['catch'](_0x37053a=>Y('heartbeat\x20failed:\x20'+_0x37053a));},0x2bf20),Y(_0x1439ff(0x1d6));}S()[a0_0x1788e5(0x219)](_0x1bd3d0=>{const _0x2ca812=a0_0x1788e5;Y(_0x2ca812(0x21c)+_0x1bd3d0),process[_0x2ca812(0x1a2)](0x1);});async function N(){const _0x27d2a9=a0_0x1788e5;Y(_0x27d2a9(0x1c3)),await P(_0x27d2a9(0x22c),{'resume_id':w,'alias':Z,'status':_0x27d2a9(0x1f9),'task':_0x27d2a9(0x1ea)})[_0x27d2a9(0x219)](()=>{}),process[_0x27d2a9(0x1a2)](0x0);}process[a0_0x1788e5(0x21e)]['on'](a0_0x1788e5(0x1dc),()=>N()),process['on'](a0_0x1788e5(0x1a8),()=>N()),process['on']('SIGINT',()=>N());
2
+ const a0_0x330916=a0_0x56f7;(function(_0xdc8f80,_0x5d3045){const _0x385fbd=a0_0x56f7,_0x44f336=_0xdc8f80();while(!![]){try{const _0x137004=-parseInt(_0x385fbd(0x164))/0x1*(-parseInt(_0x385fbd(0x16a))/0x2)+-parseInt(_0x385fbd(0x12e))/0x3+-parseInt(_0x385fbd(0x1a8))/0x4+-parseInt(_0x385fbd(0x157))/0x5*(-parseInt(_0x385fbd(0x17f))/0x6)+parseInt(_0x385fbd(0x197))/0x7*(-parseInt(_0x385fbd(0x162))/0x8)+parseInt(_0x385fbd(0x19f))/0x9+parseInt(_0x385fbd(0x137))/0xa*(parseInt(_0x385fbd(0x12d))/0xb);if(_0x137004===_0x5d3045)break;else _0x44f336['push'](_0x44f336['shift']());}catch(_0x4cadc3){_0x44f336['push'](_0x44f336['shift']());}}}(a0_0x39b2,0xe7545));import{readFileSync as a0_0x1b1b09,existsSync as a0_0x4dfa71}from'fs';import{join as a0_0x34a16e}from'path';function a0_0x56f7(_0x45971f,_0x22a9a4){_0x45971f=_0x45971f-0x120;const _0x39b29b=a0_0x39b2();let _0x56f703=_0x39b29b[_0x45971f];return _0x56f703;}import{hostname as a0_0x107527}from'os';import{execSync as a0_0x589097}from'child_process';import{Server as a0_0x30cac6}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x39b2(){const _0x4877d8=['SIGTERM','end','10jstyyC','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','then','data:\x20','.env','connect','init\x20failed:\x20','get','in_progress','\x20priority=','number','Task\x20content','application/json,\x20text/event-stream','cancelled','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','blocked','unknown\x20tool','ready\x20—\x20waiting\x20for\x20events','...\x20TMUX=','message','get_inbox','tmux\x20display-message\x20-p\x20\x27#S\x27','toTimeString','send_reply','length','split','status','fatal:\x20','result','high','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','type','290555HITwYp','completed','exit','error','none','\x20ALIAS=','cwd','parse\x20error:\x20','stringify','alias','delete','2120728wPjPFp','commhub_send_task','1435465eCHfSq','utf-8','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','statusText','commhub','\x20from\x20','2QeHUTu','from_session','Bearer\x20','←\x20message\x20from\x20','warning:\x20could\x20not\x20register:\x20','SIGINT','commhub_send_message','Session\x20alias:\x20','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','normal','report_status','failed','Priority\x20(default:\x20normal)','catch','priority','get_all_status','claude-code','startsWith','commhub_reply','hub','messages','60GppaLW','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','getReader','low','notifications/claude/channel','setRequestHandler','text','Progress\x200-100','ENV:\x20URL=','stderr','new_task','→\x20injected\x20task\x20','.anet','no\x20response','body','message_id','decode','Current\x20task\x20description','commhub-channel','notification',':\x20inbox_count=','/events/','indexOf','parse','49faTqWd','initialize','commhub_report_status','/mcp','read','\x20RESUME_ID=','application/json','new_message','1737414vXNzFe','POST','string','working','heartbeat\x20failed:\x20','set','token','task','2.0','7516208HsthOJ','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inbox_count',']\x20[commhub]\x20','find','CommHub\x20init\x20failed:\x20','http://127.0.0.1:9200','shutting\x20down,\x20reporting\x20offline...','idle','randomUUID','0.3.0','Target\x20session\x20alias','content','slice','commhub_get_all_status','object','write','trim','32448669ZBVJiS','1431858lskHsS','pop','params','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','from','tools/call','MCP\x20stdio\x20connected'];a0_0x39b2=function(){return _0x4877d8;};return a0_0x39b2();}import{StdioServerTransport as a0_0x587c98}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0xb385dc,CallToolRequestSchema as a0_0x3a58e4}from'@modelcontextprotocol/sdk/types.js';function p(_0x4823ee){const _0x3ca2b9=a0_0x56f7;if(!a0_0x4dfa71(_0x4823ee))return;for(let _0x1b560c of a0_0x1b1b09(_0x4823ee,_0x3ca2b9(0x165))[_0x3ca2b9(0x150)]('\x0a')){let _0x56d1b0=_0x1b560c[_0x3ca2b9(0x12c)]();if(!_0x56d1b0||_0x56d1b0[_0x3ca2b9(0x17b)]('#'))continue;let _0x2e953a=_0x56d1b0[_0x3ca2b9(0x195)]('=');if(_0x2e953a<0x0)continue;let _0x2c9385=_0x56d1b0[_0x3ca2b9(0x128)](0x0,_0x2e953a)[_0x3ca2b9(0x12c)](),_0x5598b3=_0x56d1b0[_0x3ca2b9(0x128)](_0x2e953a+0x1)['trim']()['replace'](/^["']|["']$/g,'');if(!process.env[_0x2c9385])process.env[_0x2c9385]=_0x5598b3;}}var C=process.env.HOME||'~',T=a0_0x34a16e(C,'.claude/channels/commhub');p(a0_0x34a16e(T,a0_0x330916(0x13b)));var L=process[a0_0x330916(0x15d)]()['replace'](/\//g,'-');p(a0_0x34a16e(T,L,'.env'));function U(){const _0x2a3ea1=a0_0x330916;try{return a0_0x589097(_0x2a3ea1(0x14c),{'encoding':_0x2a3ea1(0x165),'timeout':0x7d0})[_0x2a3ea1(0x12c)]();}catch{return'';}}function c(){const _0x5bafb3=a0_0x330916;try{let _0x57536a=a0_0x34a16e(C,_0x5bafb3(0x18b),'config.json');if(a0_0x4dfa71(_0x57536a))return JSON['parse'](a0_0x1b1b09(_0x57536a,_0x5bafb3(0x165)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x330916(0x17d)]||a0_0x330916(0x121),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x107527(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x330916(0x124)](),X=process.env.COMMHUB_TOKEN||H[a0_0x330916(0x1a5)]||'';function Y(_0x571155){const _0x4598c4=a0_0x330916;let _0x459ea7=new Date()[_0x4598c4(0x14d)]()['slice'](0x0,0x8);process[_0x4598c4(0x188)][_0x4598c4(0x12b)]('['+_0x459ea7+_0x4598c4(0x1ab)+_0x571155+'\x0a');}function h(_0x4032cb){return new Promise(_0xdcc3f4=>setTimeout(_0xdcc3f4,_0x4032cb));}Y(a0_0x330916(0x187)+D+a0_0x330916(0x15c)+Z+a0_0x330916(0x19c)+w[a0_0x330916(0x128)](0x0,0x8)+a0_0x330916(0x149)+(f||a0_0x330916(0x15b))+'\x20CWD='+process[a0_0x330916(0x15d)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x30cac6({'name':a0_0x330916(0x191),'version':a0_0x330916(0x125)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x330916(0x138),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x330916(0x131),a0_0x330916(0x166),a0_0x330916(0x171)+Z]['join']('\x0a')});K[a0_0x330916(0x184)](a0_0xb385dc,async()=>({'tools':[{'name':a0_0x330916(0x17c),'description':a0_0x330916(0x155),'inputSchema':{'type':a0_0x330916(0x12a),'properties':{'task_id':{'type':'string','description':a0_0x330916(0x172)},'text':{'type':'string','description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x330916(0x1a1),'enum':[a0_0x330916(0x158),a0_0x330916(0x175),a0_0x330916(0x144),'blocked',a0_0x330916(0x15a),a0_0x330916(0x13f)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x330916(0x185)]}},{'name':a0_0x330916(0x199),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x330916(0x12a),'properties':{'status':{'type':'string','enum':[a0_0x330916(0x1a2),a0_0x330916(0x123),a0_0x330916(0x146),a0_0x330916(0x15a)]},'task':{'type':a0_0x330916(0x1a1),'description':a0_0x330916(0x190)},'progress':{'type':a0_0x330916(0x141),'description':a0_0x330916(0x186)}},'required':[a0_0x330916(0x151)]}},{'name':a0_0x330916(0x163),'description':a0_0x330916(0x180),'inputSchema':{'type':a0_0x330916(0x12a),'properties':{'alias':{'type':a0_0x330916(0x1a1),'description':a0_0x330916(0x126)},'task':{'type':a0_0x330916(0x1a1),'description':a0_0x330916(0x142)},'priority':{'type':'string','enum':[a0_0x330916(0x154),a0_0x330916(0x173),a0_0x330916(0x182)],'description':a0_0x330916(0x176)}},'required':[a0_0x330916(0x160),a0_0x330916(0x1a6)]}},{'name':a0_0x330916(0x170),'description':a0_0x330916(0x1a9),'inputSchema':{'type':a0_0x330916(0x12a),'properties':{'alias':{'type':a0_0x330916(0x1a1),'description':a0_0x330916(0x126)},'message':{'type':a0_0x330916(0x1a1),'description':'Message\x20content'}},'required':['alias',a0_0x330916(0x14a)]}},{'name':a0_0x330916(0x129),'description':a0_0x330916(0x145),'inputSchema':{'type':a0_0x330916(0x12a),'properties':{}}}]}));async function P(_0xff76dd,_0x2d3220){const _0x503a66=a0_0x330916;let _0x1e7929=await fetch(D+_0x503a66(0x19a),{'method':_0x503a66(0x1a0),'headers':{'Content-Type':_0x503a66(0x19d),'Accept':_0x503a66(0x143),...X?{'Authorization':_0x503a66(0x16c)+X}:{}},'body':JSON[_0x503a66(0x15f)]({'jsonrpc':_0x503a66(0x1a7),'id':0x1,'method':_0x503a66(0x198),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x503a66(0x191),'version':_0x503a66(0x125)}}})});if(!_0x1e7929['ok']){let _0x31ea75=await _0x1e7929[_0x503a66(0x185)]();return Y(_0x503a66(0x120)+_0x1e7929[_0x503a66(0x151)]+'\x20'+_0x31ea75['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x503a66(0x13d)+_0x1e7929[_0x503a66(0x151)]};}await _0x1e7929['text']();let _0x34ea79=(await(await fetch(D+_0x503a66(0x19a),{'method':_0x503a66(0x1a0),'headers':{'Content-Type':_0x503a66(0x19d),'Accept':_0x503a66(0x143),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x503a66(0x15f)]({'jsonrpc':_0x503a66(0x1a7),'id':0x2,'method':_0x503a66(0x133),'params':{'name':_0xff76dd,'arguments':_0x2d3220}})}))[_0x503a66(0x185)]())[_0x503a66(0x150)]('\x0a')[_0x503a66(0x1ac)](_0x1046b4=>_0x1046b4['startsWith'](_0x503a66(0x13a)));if(_0x34ea79){let _0xa22d9e=JSON[_0x503a66(0x196)](_0x34ea79[_0x503a66(0x128)](0x6));return _0xa22d9e?.[_0x503a66(0x153)]?.[_0x503a66(0x127)]?.[0x0]?.['text']?JSON[_0x503a66(0x196)](_0xa22d9e[_0x503a66(0x153)][_0x503a66(0x127)][0x0][_0x503a66(0x185)]):_0xa22d9e;}return{'ok':!0x1,'error':_0x503a66(0x18c)};}K['setRequestHandler'](a0_0x3a58e4,async _0x52770a=>{const _0x3a84b3=a0_0x330916;let {name:_0x562958,arguments:_0x2eaf99}=_0x52770a[_0x3a84b3(0x130)];if(_0x562958==='commhub_reply'){let {task_id:_0x248f88,text:_0x8eabb3,status:_0x552b71}=_0x2eaf99;if(_0x552b71===_0x3a84b3(0x158)||_0x552b71===_0x3a84b3(0x175)||_0x552b71===_0x3a84b3(0x144)){let _0x2b5f84=_0x552b71===_0x3a84b3(0x158)?'replied':_0x552b71,_0x12bbff=_0x248f88?k[_0x3a84b3(0x13e)](_0x248f88)||_0x3a84b3(0x17d):_0x3a84b3(0x17d),_0x4e6ebf=await P(_0x3a84b3(0x14e),{'alias':_0x12bbff,'text':_0x8eabb3,'in_reply_to':_0x248f88||void 0x0,'status':_0x2b5f84,'from_session':Z});if(_0x248f88)k[_0x3a84b3(0x161)](_0x248f88);return{'content':[{'type':_0x3a84b3(0x185),'text':JSON[_0x3a84b3(0x15f)](_0x4e6ebf)}]};}let _0x2a11fc=await P(_0x3a84b3(0x174),{'resume_id':w,'alias':Z,'status':_0x552b71===_0x3a84b3(0x146)?'blocked':_0x552b71===_0x3a84b3(0x15a)?_0x3a84b3(0x15a):'working','task':_0x8eabb3[_0x3a84b3(0x128)](0x0,0xc8),'output':_0x8eabb3});return{'content':[{'type':_0x3a84b3(0x185),'text':JSON[_0x3a84b3(0x15f)](_0x2a11fc)}]};}if(_0x562958===_0x3a84b3(0x199)){let {status:_0x746bbe,task:_0x3d7f03,progress:_0x1fbce5}=_0x2eaf99,_0x5aa9d8=await P(_0x3a84b3(0x174),{'resume_id':w,'alias':Z,'status':_0x746bbe,'task':_0x3d7f03,'progress':_0x1fbce5});return{'content':[{'type':_0x3a84b3(0x185),'text':JSON[_0x3a84b3(0x15f)](_0x5aa9d8)}]};}if(_0x562958===_0x3a84b3(0x163)){let {alias:_0xa0f365,task:_0x223569,priority:_0x2ad671}=_0x2eaf99,_0x2d1a0f=await P('send_task',{'alias':_0xa0f365,'task':_0x223569,'priority':_0x2ad671||_0x3a84b3(0x173),'from_session':Z});return{'content':[{'type':_0x3a84b3(0x185),'text':JSON['stringify'](_0x2d1a0f)}]};}if(_0x562958===_0x3a84b3(0x170)){let {alias:_0x148902,message:_0x371ba2}=_0x2eaf99,_0x1aafae=await P('send_message',{'alias':_0x148902,'message':_0x371ba2,'from_session':Z});return{'content':[{'type':_0x3a84b3(0x185),'text':JSON['stringify'](_0x1aafae)}]};}if(_0x562958===_0x3a84b3(0x129)){let _0x5c2651=await P(_0x3a84b3(0x179),{});return{'content':[{'type':_0x3a84b3(0x185),'text':JSON['stringify'](_0x5c2651)}]};}return{'content':[{'type':'text','text':JSON[_0x3a84b3(0x15f)]({'error':_0x3a84b3(0x147)})}]};});async function v(){const _0x10aed6=a0_0x330916;let _0x41e888=D+_0x10aed6(0x194)+encodeURIComponent(Z),_0x6a97c6={};if(X)_0x6a97c6['Authorization']=_0x10aed6(0x16c)+X;Y('connecting\x20to\x20'+_0x41e888);while(!0x0){try{let _0x581395=await fetch(_0x41e888,{'headers':_0x6a97c6});if(!_0x581395['ok']){Y('SSE\x20error:\x20'+_0x581395[_0x10aed6(0x151)]+'\x20'+_0x581395[_0x10aed6(0x167)]),await h(0x1388);continue;}let _0xaa7312=_0x581395[_0x10aed6(0x18d)][_0x10aed6(0x181)](),_0x5a5e2f=new TextDecoder(),_0x145306='';while(!0x0){let {done:_0x575c68,value:_0x5ebe86}=await _0xaa7312[_0x10aed6(0x19b)]();if(_0x575c68)break;_0x145306+=_0x5a5e2f[_0x10aed6(0x18f)](_0x5ebe86,{'stream':!0x0});let _0x2c99ce=_0x145306[_0x10aed6(0x150)]('\x0a\x0a');_0x145306=_0x2c99ce[_0x10aed6(0x12f)]()||'';for(let _0x229ecb of _0x2c99ce){let _0x561be7=_0x229ecb[_0x10aed6(0x150)]('\x0a')[_0x10aed6(0x1ac)](_0xcc8faa=>_0xcc8faa[_0x10aed6(0x17b)](_0x10aed6(0x13a)));if(!_0x561be7)continue;try{let _0x2fe440=JSON['parse'](_0x561be7[_0x10aed6(0x128)](0x6));await u(_0x2fe440);}catch(_0x35d74f){Y(_0x10aed6(0x15e)+_0x35d74f);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x1015fc){Y('SSE\x20connection\x20error:\x20'+_0x1015fc);}await h(0xbb8);}}async function u(_0x46e990){const _0x10c6d9=a0_0x330916;if(_0x46e990[_0x10c6d9(0x156)]==='connected'){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x46e990[_0x10c6d9(0x156)]===_0x10c6d9(0x19e)){if(Y(_0x10c6d9(0x16d)+_0x46e990[_0x10c6d9(0x132)]+':\x20'+_0x46e990[_0x10c6d9(0x14a)][_0x10c6d9(0x128)](0x0,0x3c)),await K['notification']({'method':_0x10c6d9(0x183),'params':{'content':_0x46e990['message'],'meta':{'sender':_0x46e990[_0x10c6d9(0x132)]||_0x10c6d9(0x17d),'sender_id':_0x10c6d9(0x168),'user':_0x46e990[_0x10c6d9(0x132)]||_0x10c6d9(0x17d),'priority':_0x10c6d9(0x173)}}}),_0x46e990[_0x10c6d9(0x18e)])await P('ack_inbox',{'alias':Z,'message_id':_0x46e990['message_id']});return;}if(_0x46e990[_0x10c6d9(0x156)]===_0x10c6d9(0x189)||_0x46e990['type']==='broadcast'){Y('←\x20'+_0x46e990[_0x10c6d9(0x156)]+_0x10c6d9(0x193)+_0x46e990[_0x10c6d9(0x1aa)]+_0x10c6d9(0x140)+(_0x46e990[_0x10c6d9(0x178)]||_0x10c6d9(0x173)));let _0x91a009=await P(_0x10c6d9(0x14b),{'alias':Z,'limit':0x5});if(_0x91a009?.['ok']&&_0x91a009[_0x10c6d9(0x17e)]?.[_0x10c6d9(0x14f)]>0x0)for(let _0x44d0f3 of _0x91a009['messages']){let _0x550e30={'sender':_0x44d0f3[_0x10c6d9(0x16b)]||_0x10c6d9(0x17d),'sender_id':_0x10c6d9(0x168),'user':_0x44d0f3[_0x10c6d9(0x16b)]||_0x10c6d9(0x17d),'task_id':_0x44d0f3['id'],'priority':_0x44d0f3[_0x10c6d9(0x178)]||_0x10c6d9(0x173)};k[_0x10c6d9(0x1a4)](_0x44d0f3['id'],_0x44d0f3[_0x10c6d9(0x16b)]||_0x10c6d9(0x17d)),await K[_0x10c6d9(0x192)]({'method':_0x10c6d9(0x183),'params':{'content':_0x44d0f3['content'],'meta':_0x550e30}}),Y(_0x10c6d9(0x18a)+_0x44d0f3['id'][_0x10c6d9(0x128)](0x0,0x8)+_0x10c6d9(0x169)+_0x44d0f3[_0x10c6d9(0x16b)]+':\x20'+_0x44d0f3[_0x10c6d9(0x127)]['slice'](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x44d0f3['id']});}}}async function S(){const _0x2e7785=a0_0x330916;let _0x3e9adf=new a0_0x587c98();await K[_0x2e7785(0x13c)](_0x3e9adf),Y(_0x2e7785(0x134)),Y('starting\x20SSE\x20listener...'),v()[_0x2e7785(0x177)](_0x2ca7dc=>Y('SSE\x20fatal:\x20'+_0x2ca7dc)),P(_0x2e7785(0x174),{'resume_id':w,'alias':Z,'status':_0x2e7785(0x123),'server':a0_0x107527(),'hostname':a0_0x107527(),'agent':'claude-code','project_dir':process[_0x2e7785(0x15d)](),'tmux_name':f||void 0x0})[_0x2e7785(0x139)](()=>Y('registered\x20as\x20\x22'+Z+'\x22\x20('+w['slice'](0x0,0x8)+')'))[_0x2e7785(0x177)](_0x19bd7c=>Y(_0x2e7785(0x16e)+_0x19bd7c)),setInterval(()=>{const _0x5c8fa4=_0x2e7785;P(_0x5c8fa4(0x174),{'resume_id':w,'alias':Z,'status':_0x5c8fa4(0x123),'server':a0_0x107527(),'hostname':a0_0x107527(),'agent':_0x5c8fa4(0x17a),'project_dir':process[_0x5c8fa4(0x15d)](),'tmux_name':f||void 0x0})[_0x5c8fa4(0x177)](_0x2535c8=>Y(_0x5c8fa4(0x1a3)+_0x2535c8));},0x2bf20),Y(_0x2e7785(0x148));}S()['catch'](_0x47e34f=>{const _0x124031=a0_0x330916;Y(_0x124031(0x152)+_0x47e34f),process[_0x124031(0x159)](0x1);});async function N(){const _0x363a93=a0_0x330916;Y(_0x363a93(0x122)),await P(_0x363a93(0x174),{'resume_id':w,'alias':Z,'status':_0x363a93(0x15a),'task':'session\x20disconnected'})['catch'](()=>{}),process[_0x363a93(0x159)](0x0);}process['stdin']['on'](a0_0x330916(0x136),()=>N()),process['on'](a0_0x330916(0x135),()=>N()),process['on'](a0_0x330916(0x16f),()=>N());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.0.0-preview.46",
3
+ "version": "2.0.0-preview.48",
4
4
  "description": "AI Agent Network CLI \u2014 Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 39 commands.",
5
5
  "type": "module",
6
6
  "main": "dist/src/client.js",