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

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_0x2e53c0=a0_0x1b15;function a0_0x1b15(_0x348776,_0x177d49){_0x348776=_0x348776-0x179;const _0x18e4e4=a0_0x18e4();let _0x1b156f=_0x18e4e4[_0x348776];return _0x1b156f;}(function(_0x4b51a1,_0x18c37e){const _0x19e700=a0_0x1b15,_0x55578d=_0x4b51a1();while(!![]){try{const _0x588d4=parseInt(_0x19e700(0x190))/0x1+parseInt(_0x19e700(0x182))/0x2*(parseInt(_0x19e700(0x1af))/0x3)+parseInt(_0x19e700(0x181))/0x4*(parseInt(_0x19e700(0x1b3))/0x5)+-parseInt(_0x19e700(0x19d))/0x6+parseInt(_0x19e700(0x187))/0x7*(parseInt(_0x19e700(0x185))/0x8)+-parseInt(_0x19e700(0x1be))/0x9*(-parseInt(_0x19e700(0x19b))/0xa)+parseInt(_0x19e700(0x1cc))/0xb*(-parseInt(_0x19e700(0x1b0))/0xc);if(_0x588d4===_0x18c37e)break;else _0x55578d['push'](_0x55578d['shift']());}catch(_0x374efd){_0x55578d['push'](_0x55578d['shift']());}}}(a0_0x18e4,0xe78f5));import{EventEmitter as a0_0x31ccac}from'events';import{hostname as a0_0x189871}from'os';class T extends a0_0x31ccac{[a0_0x2e53c0(0x188)];[a0_0x2e53c0(0x1c4)];[a0_0x2e53c0(0x1ca)];[a0_0x2e53c0(0x1d1)];['resumeId'];['heartbeatInterval'];[a0_0x2e53c0(0x18f)];[a0_0x2e53c0(0x1c0)];[a0_0x2e53c0(0x18e)];[a0_0x2e53c0(0x17f)]=!0x1;constructor(_0x4b39dd){const _0x22bbc3=a0_0x2e53c0;super();if(this['url']=_0x4b39dd[_0x22bbc3(0x188)]['replace'](/\/$/,''),this[_0x22bbc3(0x1c4)]=_0x4b39dd[_0x22bbc3(0x1c4)],this[_0x22bbc3(0x1ca)]=_0x4b39dd['token'],this['agent']=_0x4b39dd['agent']||_0x22bbc3(0x1ce),this['resumeId']=_0x22bbc3(0x1b2)+_0x4b39dd['alias']+'-'+Date['now']()[_0x22bbc3(0x1ae)](0x24),this[_0x22bbc3(0x1bf)]=_0x4b39dd['heartbeatInterval']??0x2bf20,this[_0x22bbc3(0x18f)]=_0x4b39dd['reconnectDelay']??0xbb8,_0x4b39dd[_0x22bbc3(0x184)]!==!0x1)this[_0x22bbc3(0x198)]();}[a0_0x2e53c0(0x1c1)](_0x1eb960){const _0x32ddb5=a0_0x2e53c0;console[_0x32ddb5(0x1c1)]('['+new Date()[_0x32ddb5(0x1a7)]()[_0x32ddb5(0x17c)](0x0,0x8)+_0x32ddb5(0x1d2)+this[_0x32ddb5(0x1c4)]+']\x20'+_0x1eb960);}async[a0_0x2e53c0(0x1c2)](_0x55e174,_0x1b53c2){const _0x44c006=a0_0x2e53c0;let _0x516a08={'Content-Type':_0x44c006(0x18c),'Accept':_0x44c006(0x1cb)};if(this[_0x44c006(0x1ca)])_0x516a08[_0x44c006(0x1a6)]=_0x44c006(0x1a9)+this[_0x44c006(0x1ca)];let _0x5dfd33=await(await fetch(this[_0x44c006(0x188)]+_0x44c006(0x1ab),{'method':_0x44c006(0x1bc),'headers':_0x516a08,'body':JSON['stringify']({'jsonrpc':_0x44c006(0x18b),'id':Date['now'](),'method':_0x44c006(0x17b),'params':{'name':_0x55e174,'arguments':_0x1b53c2}})}))[_0x44c006(0x1cd)](),_0x4a0487=_0x5dfd33['match'](/data: (.+)/),_0x5f1c98=_0x4a0487?JSON['parse'](_0x4a0487[0x1]):JSON[_0x44c006(0x19e)](_0x5dfd33),_0x2e7203=_0x5f1c98?.['result']?.[_0x44c006(0x1c3)]?.[0x0]?.[_0x44c006(0x1cd)];return _0x2e7203?JSON['parse'](_0x2e7203):_0x5f1c98;}async[a0_0x2e53c0(0x198)](){const _0x1b7e31=a0_0x2e53c0;if(this[_0x1b7e31(0x17f)])return;this[_0x1b7e31(0x17f)]=!0x0,await this['status'](_0x1b7e31(0x19c)),this[_0x1b7e31(0x1c1)](_0x1b7e31(0x18a)),this[_0x1b7e31(0x1c0)]=setInterval(()=>{const _0x1f942b=_0x1b7e31;this[_0x1f942b(0x1c9)]('idle')[_0x1f942b(0x1a8)](_0x765d98=>this[_0x1f942b(0x1c1)](_0x1f942b(0x1b9)+_0x765d98[_0x1f942b(0x1ac)]));},this['heartbeatInterval']),this[_0x1b7e31(0x189)]();}async[a0_0x2e53c0(0x1a3)](){const _0x123cbc=a0_0x2e53c0;if(this[_0x123cbc(0x17f)]=!0x1,this[_0x123cbc(0x18e)]?.[_0x123cbc(0x17a)](),this[_0x123cbc(0x1c0)])clearInterval(this[_0x123cbc(0x1c0)]);await this['status'](_0x123cbc(0x1ad))['catch'](()=>{}),this[_0x123cbc(0x1c1)]('disconnected');}async['send'](_0x346a0a,_0x18f092,_0x43ced5=a0_0x2e53c0(0x17e)){const _0xff6582=a0_0x2e53c0;return this[_0xff6582(0x1c2)](_0xff6582(0x1b1),{'alias':_0x346a0a,'task':_0x18f092,'priority':_0x43ced5,'from_session':this[_0xff6582(0x1c4)]});}async[a0_0x2e53c0(0x1ac)](_0x30de21,_0x1d926c){const _0x4e6160=a0_0x2e53c0;return this[_0x4e6160(0x1c2)](_0x4e6160(0x1b5),{'alias':_0x30de21,'message':_0x1d926c,'from_session':this[_0x4e6160(0x1c4)]});}async[a0_0x2e53c0(0x1a1)](_0x5cf5b3,_0x2b358c,_0x397885=a0_0x2e53c0(0x17d)){const _0x197534=a0_0x2e53c0;return this[_0x197534(0x1c2)](_0x197534(0x1a1),{'task_id':_0x5cf5b3,'text':_0x2b358c,'status':_0x397885});}async[a0_0x2e53c0(0x1c9)](_0x3a46dd,_0x3ac27b){const _0x2a0421=a0_0x2e53c0;return this[_0x2a0421(0x1c2)](_0x2a0421(0x197),{'resume_id':this[_0x2a0421(0x1cf)],'alias':this[_0x2a0421(0x1c4)],'status':_0x3a46dd,'server':a0_0x189871(),'hostname':a0_0x189871(),'agent':this[_0x2a0421(0x1d1)],'project_dir':process[_0x2a0421(0x1ba)](),..._0x3ac27b});}async[a0_0x2e53c0(0x1c5)](){const _0x383abe=a0_0x2e53c0;return this[_0x383abe(0x1c2)](_0x383abe(0x183),{});}async[a0_0x2e53c0(0x1b7)](_0x341da0,_0x20f513){const _0x359f0d=a0_0x2e53c0;return this[_0x359f0d(0x1c2)](_0x359f0d(0x1b7),{'message':_0x341da0,'filter_server':_0x20f513?.['server'],'filter_status':_0x20f513?.[_0x359f0d(0x1c9)]});}async[a0_0x2e53c0(0x189)](){const _0x3a3607=a0_0x2e53c0;let _0x5d99cf=encodeURIComponent(this[_0x3a3607(0x1c4)]),_0x14b433=this[_0x3a3607(0x188)]+'/events/'+_0x5d99cf,_0x45c3c4=this[_0x3a3607(0x18f)];while(this[_0x3a3607(0x17f)]){try{this['sseAbort']=new AbortController();let _0x408682={'Accept':_0x3a3607(0x195)};if(this[_0x3a3607(0x1ca)])_0x408682[_0x3a3607(0x1a6)]='Bearer\x20'+this['token'];let _0x1fdc31=await fetch(_0x14b433,{'headers':_0x408682,'signal':this[_0x3a3607(0x18e)][_0x3a3607(0x186)]});if(!_0x1fdc31['ok']||!_0x1fdc31['body']){this[_0x3a3607(0x1c1)](_0x3a3607(0x1aa)+_0x1fdc31[_0x3a3607(0x1c9)]),await this[_0x3a3607(0x1bb)](_0x45c3c4),_0x45c3c4=Math[_0x3a3607(0x1b8)](_0x45c3c4*1.5,0xea60);continue;}_0x45c3c4=this[_0x3a3607(0x18f)];let _0xab2891=_0x1fdc31[_0x3a3607(0x1c6)][_0x3a3607(0x191)](),_0x523504=new TextDecoder(),_0x2cad37='';while(this[_0x3a3607(0x17f)]){let {done:_0x497fac,value:_0x28e7d0}=await _0xab2891[_0x3a3607(0x1b4)]();if(_0x497fac)break;_0x2cad37+=_0x523504[_0x3a3607(0x1b6)](_0x28e7d0,{'stream':!0x0});let _0x8ec26e=_0x2cad37[_0x3a3607(0x1bd)]('\x0a');_0x2cad37=_0x8ec26e['pop']()||'';for(let _0x31b8bf of _0x8ec26e){if(!_0x31b8bf[_0x3a3607(0x1a4)]('data:\x20'))continue;try{let _0x3fb41f=JSON[_0x3a3607(0x19e)](_0x31b8bf['slice'](0x6));if(_0x3fb41f[_0x3a3607(0x180)]===_0x3a3607(0x1a2)){this[_0x3a3607(0x1c1)](_0x3a3607(0x196)),this[_0x3a3607(0x1d0)]('connected');continue;}if(_0x3fb41f['type']==='new_task'||_0x3fb41f[_0x3a3607(0x180)]===_0x3a3607(0x194)||_0x3fb41f['type']==='broadcast')await this[_0x3a3607(0x179)]();}catch{}}}}catch(_0x3e874a){if(_0x3e874a[_0x3a3607(0x1a0)]===_0x3a3607(0x19a))break;this[_0x3a3607(0x1d0)](_0x3a3607(0x193),_0x3e874a),this['log'](_0x3a3607(0x1a5)+_0x3e874a[_0x3a3607(0x1ac)]);}if(this[_0x3a3607(0x17f)])this[_0x3a3607(0x1d0)](_0x3a3607(0x192)),this[_0x3a3607(0x1c1)](_0x3a3607(0x18d)+_0x45c3c4/0x3e8+_0x3a3607(0x19f)),await this[_0x3a3607(0x1bb)](_0x45c3c4),_0x45c3c4=Math[_0x3a3607(0x1b8)](_0x45c3c4*1.5,0xea60);}}async[a0_0x2e53c0(0x179)](){const _0x2325f8=a0_0x2e53c0;try{let _0x2a8f99=(await this[_0x2325f8(0x1c2)]('get_inbox',{'alias':this[_0x2325f8(0x1c4)],'limit':0xa}))?.[_0x2325f8(0x199)]||[];for(let _0x5bb860 of _0x2a8f99)await this[_0x2325f8(0x1c2)](_0x2325f8(0x1c8),{'alias':this[_0x2325f8(0x1c4)],'message_id':_0x5bb860['id']}),this[_0x2325f8(0x1c1)]('←\x20'+_0x5bb860['from_session']+':\x20'+_0x5bb860[_0x2325f8(0x1c3)][_0x2325f8(0x17c)](0x0,0x3c)),this[_0x2325f8(0x1d0)]('task',_0x5bb860),this[_0x2325f8(0x1d0)]('message',_0x5bb860);}catch(_0x4e0a3d){this[_0x2325f8(0x1c1)](_0x2325f8(0x1c7)+_0x4e0a3d['message']);}}[a0_0x2e53c0(0x1bb)](_0x251e4d){return new Promise(_0x2cc979=>setTimeout(_0x2cc979,_0x251e4d));}}var $=T;export{$ as default,T as CommHub};function a0_0x18e4(){const _0x28e120=['read','send_message','decode','broadcast','min','heartbeat\x20failed:\x20','cwd','sleep','POST','split','801WXOKZk','heartbeatInterval','heartbeatTimer','log','call','content','alias','getAllStatus','body','inbox\x20error:\x20','ack_inbox','status','token','application/json,\x20text/event-stream','33XhVlUY','text','sdk','resumeId','emit','agent',']\x20[commhub:','processInbox','abort','tools/call','slice','completed','normal','running','type','136YVjNAD','196pkxMSI','get_all_status','autoConnect','40pDidoN','signal','1006936nvkJoK','url','connectSSE','registered','2.0','application/json','SSE\x20reconnecting\x20in\x20','sseAbort','reconnectDelay','480605JQxnrj','getReader','disconnected','error','new_message','text/event-stream','SSE\x20connected','report_status','connect','messages','AbortError','128770bRYsSu','idle','520584dzDadO','parse','s...','name','reply','connected','disconnect','startsWith','SSE\x20error:\x20','Authorization','toTimeString','catch','Bearer\x20','SSE\x20failed:\x20','/mcp','message','offline','toString','30498OGiCxH','14833788brcbzH','send_task','sdk-','206105ggfeoy'];a0_0x18e4=function(){return _0x28e120;};return a0_0x18e4();}
@@ -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_0x1452a5=a0_0xe364;(function(_0x1a4c3a,_0x507d58){const _0x43b4f9=a0_0xe364,_0x425e98=_0x1a4c3a();while(!![]){try{const _0x385e9b=-parseInt(_0x43b4f9(0xf8))/0x1+-parseInt(_0x43b4f9(0x107))/0x2*(-parseInt(_0x43b4f9(0x12c))/0x3)+parseInt(_0x43b4f9(0x103))/0x4+parseInt(_0x43b4f9(0x115))/0x5*(parseInt(_0x43b4f9(0x124))/0x6)+parseInt(_0x43b4f9(0xda))/0x7*(-parseInt(_0x43b4f9(0x13d))/0x8)+-parseInt(_0x43b4f9(0x127))/0x9*(-parseInt(_0x43b4f9(0xbe))/0xa)+-parseInt(_0x43b4f9(0x10a))/0xb*(parseInt(_0x43b4f9(0xb8))/0xc);if(_0x385e9b===_0x507d58)break;else _0x425e98['push'](_0x425e98['shift']());}catch(_0x17f185){_0x425e98['push'](_0x425e98['shift']());}}}(a0_0x56e1,0x2c971));import{readFileSync as a0_0x4b8c12,existsSync as a0_0x3efcb7}from'fs';import{join as a0_0xdf6dd8}from'path';import{hostname as a0_0x2b86d8}from'os';import{execSync as a0_0x3772dc}from'child_process';import{Server as a0_0x3945ac}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x52601a}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x1cb21d,CallToolRequestSchema as a0_0xd42e2c}from'@modelcontextprotocol/sdk/types.js';function p(_0xe577f0){const _0x2ad386=a0_0xe364;if(!a0_0x3efcb7(_0xe577f0))return;for(let _0x363938 of a0_0x4b8c12(_0xe577f0,_0x2ad386(0xf7))['split']('\x0a')){let _0x324786=_0x363938['trim']();if(!_0x324786||_0x324786[_0x2ad386(0xf9)]('#'))continue;let _0x32c99f=_0x324786['indexOf']('=');if(_0x32c99f<0x0)continue;let _0x5a0f49=_0x324786[_0x2ad386(0x12b)](0x0,_0x32c99f)['trim'](),_0x16f341=_0x324786[_0x2ad386(0x12b)](_0x32c99f+0x1)[_0x2ad386(0xf1)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x5a0f49])process.env[_0x5a0f49]=_0x16f341;}}var C=process.env.HOME||'~',T=a0_0xdf6dd8(C,'.claude/channels/commhub');p(a0_0xdf6dd8(T,a0_0x1452a5(0x139)));var L=process[a0_0x1452a5(0xfa)]()[a0_0x1452a5(0x106)](/\//g,'-');p(a0_0xdf6dd8(T,L,a0_0x1452a5(0x139)));function U(){const _0x308f6e=a0_0x1452a5;try{return a0_0x3772dc(_0x308f6e(0x121),{'encoding':'utf-8','timeout':0x7d0})['trim']();}catch{return'';}}function c(){const _0xd5636=a0_0x1452a5;try{let _0xb31be7=a0_0xdf6dd8(C,_0xd5636(0xbb),_0xd5636(0xde));if(a0_0x3efcb7(_0xb31be7))return JSON[_0xd5636(0x116)](a0_0x4b8c12(_0xb31be7,_0xd5636(0xf7)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x1452a5(0xf6)]||a0_0x1452a5(0xf2),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x2b86d8(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x1452a5(0xd2)](),X=process.env.COMMHUB_TOKEN||H[a0_0x1452a5(0x102)]||'';function a0_0x56e1(){const _0x2fed87=['commhub_get_all_status','SSE\x20fatal:\x20','hub','utf-8','343715XqnZxw','startsWith','cwd','low','priority','/events/','object','Message\x20content','set','toTimeString','token','134016QWpcsB','high',':\x20inbox_count=','replace','14IVwhZH','task','POST','11NHzEWI','write','\x20CWD=','type','application/json,\x20text/event-stream','string','get_inbox','length','failed','data:\x20','notifications/claude/channel','1635205nZGzLi','parse','connected','text','catch','initialize','warning:\x20could\x20not\x20register:\x20','Target\x20session\x20alias','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','cancelled','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','tmux\x20display-message\x20-p\x20\x27#S\x27','unknown\x20tool','from_session','6jHNGDq','commhub_report_status','blocked','9yhnZFN','body','end','\x20ALIAS=','slice','121566uyvHRG','broadcast','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','\x20from\x20','messages','\x20RESUME_ID=','getReader','ack_inbox','new_task','commhub_send_message','inbox_count','←\x20message\x20from\x20','ready\x20—\x20waiting\x20for\x20events','.env','new_message','stdin','commhub_reply','776664vcBgxj','/mcp','statusText','send_task','status','split','content','\x20PROJECT_ENV=','tools/call','Authorization','parse\x20error:\x20','stderr','send_reply','SSE\x20connected\x20as\x20\x22','4057836MxtXXs','claude-code','→\x20injected\x20task\x20','.anet','Session\x20alias:\x20','no\x20response','3173930nDfkGx','Bearer\x20','none','get','send_message','shutting\x20down,\x20reporting\x20offline...','normal','message_id','init\x20failed:\x20','read','Task\x20content','application/json','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','\x22\x20(','report_status','then','join','MCP\x20stdio\x20connected','2025-03-26','message','randomUUID','completed','fatal:\x20','number','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','working','Current\x20task\x20description','SIGTERM','7TlZODW','stringify','0.3.0','in_progress','config.json','SSE\x20error:\x20','alias','starting\x20SSE\x20listener...','find','Reply\x20text\x20/\x20result\x20summary','commhub-channel','error','...\x20TMUX=','idle','from',']\x20[commhub]\x20','params','result','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','exit','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','notification','SSE\x20stream\x20ended,\x20reconnecting...','trim','http://127.0.0.1:9200','commhub'];a0_0x56e1=function(){return _0x2fed87;};return a0_0x56e1();}function Y(_0x2881b4){const _0x540c16=a0_0x1452a5;let _0x354044=new Date()[_0x540c16(0x101)]()['slice'](0x0,0x8);process[_0x540c16(0x148)][_0x540c16(0x10b)]('['+_0x354044+_0x540c16(0xe9)+_0x2881b4+'\x0a');}function h(_0x4a15d0){return new Promise(_0x250948=>setTimeout(_0x250948,_0x4a15d0));}Y('ENV:\x20URL='+D+a0_0x1452a5(0x12a)+Z+a0_0x1452a5(0x131)+w[a0_0x1452a5(0x12b)](0x0,0x8)+a0_0x1452a5(0xe6)+(f||a0_0x1452a5(0xc0))+a0_0x1452a5(0x10c)+process[a0_0x1452a5(0xfa)]()+a0_0x1452a5(0x144)+L);var k=new Map(),K=new a0_0x3945ac({'name':a0_0x1452a5(0xe4),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x1452a5(0xee),a0_0x1452a5(0x11d),a0_0x1452a5(0xec),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x1452a5(0xbc)+Z][a0_0x1452a5(0xce)]('\x0a')});K['setRequestHandler'](a0_0x1cb21d,async()=>({'tools':[{'name':a0_0x1452a5(0x13c),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x1452a5(0xfe),'properties':{'task_id':{'type':a0_0x1452a5(0x10f),'description':a0_0x1452a5(0xca)},'text':{'type':'string','description':a0_0x1452a5(0xe3)},'status':{'type':a0_0x1452a5(0x10f),'enum':[a0_0x1452a5(0xd3),a0_0x1452a5(0x112),a0_0x1452a5(0x11f),a0_0x1452a5(0x126),a0_0x1452a5(0xe5),a0_0x1452a5(0xdd)],'description':a0_0x1452a5(0x12e)}},'required':['text']}},{'name':a0_0x1452a5(0x125),'description':a0_0x1452a5(0x11e),'inputSchema':{'type':a0_0x1452a5(0xfe),'properties':{'status':{'type':a0_0x1452a5(0x10f),'enum':[a0_0x1452a5(0xd7),a0_0x1452a5(0xe7),'blocked',a0_0x1452a5(0xe5)]},'task':{'type':a0_0x1452a5(0x10f),'description':a0_0x1452a5(0xd8)},'progress':{'type':a0_0x1452a5(0xd5),'description':'Progress\x200-100'}},'required':[a0_0x1452a5(0x141)]}},{'name':'commhub_send_task','description':a0_0x1452a5(0xd6),'inputSchema':{'type':a0_0x1452a5(0xfe),'properties':{'alias':{'type':a0_0x1452a5(0x10f),'description':'Target\x20session\x20alias'},'task':{'type':'string','description':a0_0x1452a5(0xc8)},'priority':{'type':a0_0x1452a5(0x10f),'enum':[a0_0x1452a5(0x104),a0_0x1452a5(0xc4),a0_0x1452a5(0xfb)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x1452a5(0xe0),a0_0x1452a5(0x108)]}},{'name':a0_0x1452a5(0x135),'description':a0_0x1452a5(0x120),'inputSchema':{'type':a0_0x1452a5(0xfe),'properties':{'alias':{'type':a0_0x1452a5(0x10f),'description':a0_0x1452a5(0x11c)},'message':{'type':a0_0x1452a5(0x10f),'description':a0_0x1452a5(0xff)}},'required':[a0_0x1452a5(0xe0),'message']}},{'name':a0_0x1452a5(0xf4),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':'object','properties':{}}}]}));async function P(_0x54ed6f,_0x3235f9){const _0x5a44b4=a0_0x1452a5;let _0x24a3fc=await fetch(D+_0x5a44b4(0x13e),{'method':_0x5a44b4(0x109),'headers':{'Content-Type':_0x5a44b4(0xc9),'Accept':_0x5a44b4(0x10e),...X?{'Authorization':_0x5a44b4(0xbf)+X}:{}},'body':JSON[_0x5a44b4(0xdb)]({'jsonrpc':'2.0','id':0x1,'method':_0x5a44b4(0x11a),'params':{'protocolVersion':_0x5a44b4(0xd0),'capabilities':{},'clientInfo':{'name':_0x5a44b4(0xe4),'version':_0x5a44b4(0xdc)}}})});if(!_0x24a3fc['ok']){let _0x538c5c=await _0x24a3fc[_0x5a44b4(0x118)]();return Y('CommHub\x20init\x20failed:\x20'+_0x24a3fc[_0x5a44b4(0x141)]+'\x20'+_0x538c5c[_0x5a44b4(0x12b)](0x0,0x64)),{'ok':!0x1,'error':_0x5a44b4(0xc6)+_0x24a3fc[_0x5a44b4(0x141)]};}await _0x24a3fc[_0x5a44b4(0x118)]();let _0x23cf55=(await(await fetch(D+_0x5a44b4(0x13e),{'method':_0x5a44b4(0x109),'headers':{'Content-Type':_0x5a44b4(0xc9),'Accept':_0x5a44b4(0x10e),...X?{'Authorization':_0x5a44b4(0xbf)+X}:{}},'body':JSON[_0x5a44b4(0xdb)]({'jsonrpc':'2.0','id':0x2,'method':_0x5a44b4(0x145),'params':{'name':_0x54ed6f,'arguments':_0x3235f9}})}))[_0x5a44b4(0x118)]())[_0x5a44b4(0x142)]('\x0a')[_0x5a44b4(0xe2)](_0x2a9a6e=>_0x2a9a6e[_0x5a44b4(0xf9)]('data:\x20'));if(_0x23cf55){let _0x635524=JSON[_0x5a44b4(0x116)](_0x23cf55['slice'](0x6));return _0x635524?.[_0x5a44b4(0xeb)]?.[_0x5a44b4(0x143)]?.[0x0]?.[_0x5a44b4(0x118)]?JSON[_0x5a44b4(0x116)](_0x635524[_0x5a44b4(0xeb)]['content'][0x0][_0x5a44b4(0x118)]):_0x635524;}return{'ok':!0x1,'error':_0x5a44b4(0xbd)};}K['setRequestHandler'](a0_0xd42e2c,async _0x1f78fe=>{const _0x2dc2c9=a0_0x1452a5;let {name:_0x35e07a,arguments:_0xf10335}=_0x1f78fe[_0x2dc2c9(0xea)];if(_0x35e07a===_0x2dc2c9(0x13c)){let {task_id:_0x13c8b2,text:_0x1abfd3,status:_0x4a085d}=_0xf10335;if(_0x4a085d===_0x2dc2c9(0xd3)||_0x4a085d===_0x2dc2c9(0x112)||_0x4a085d===_0x2dc2c9(0x11f)){let _0x46cffe=_0x4a085d===_0x2dc2c9(0xd3)?'replied':_0x4a085d,_0x24ca39=_0x13c8b2?k[_0x2dc2c9(0xc1)](_0x13c8b2)||'hub':_0x2dc2c9(0xf6),_0x51cc03=await P(_0x2dc2c9(0x149),{'alias':_0x24ca39,'text':_0x1abfd3,'in_reply_to':_0x13c8b2||void 0x0,'status':_0x46cffe,'from_session':Z});if(_0x13c8b2)k['delete'](_0x13c8b2);return{'content':[{'type':'text','text':JSON[_0x2dc2c9(0xdb)](_0x51cc03)}]};}let _0x32d3f5=await P(_0x2dc2c9(0xcc),{'resume_id':w,'alias':Z,'status':_0x4a085d===_0x2dc2c9(0x126)?'blocked':_0x4a085d===_0x2dc2c9(0xe5)?_0x2dc2c9(0xe5):_0x2dc2c9(0xd7),'task':_0x1abfd3[_0x2dc2c9(0x12b)](0x0,0xc8),'output':_0x1abfd3});return{'content':[{'type':_0x2dc2c9(0x118),'text':JSON[_0x2dc2c9(0xdb)](_0x32d3f5)}]};}if(_0x35e07a===_0x2dc2c9(0x125)){let {status:_0x39bbab,task:_0x113318,progress:_0x88dabc}=_0xf10335,_0x15721a=await P(_0x2dc2c9(0xcc),{'resume_id':w,'alias':Z,'status':_0x39bbab,'task':_0x113318,'progress':_0x88dabc});return{'content':[{'type':_0x2dc2c9(0x118),'text':JSON[_0x2dc2c9(0xdb)](_0x15721a)}]};}if(_0x35e07a==='commhub_send_task'){let {alias:_0x45f064,task:_0x661c97,priority:_0x187883}=_0xf10335,_0x567412=await P(_0x2dc2c9(0x140),{'alias':_0x45f064,'task':_0x661c97,'priority':_0x187883||_0x2dc2c9(0xc4),'from_session':Z});return{'content':[{'type':_0x2dc2c9(0x118),'text':JSON[_0x2dc2c9(0xdb)](_0x567412)}]};}if(_0x35e07a===_0x2dc2c9(0x135)){let {alias:_0x186ee,message:_0x267d18}=_0xf10335,_0x1c2431=await P(_0x2dc2c9(0xc2),{'alias':_0x186ee,'message':_0x267d18,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x2dc2c9(0xdb)](_0x1c2431)}]};}if(_0x35e07a===_0x2dc2c9(0xf4)){let _0x46178d=await P('get_all_status',{});return{'content':[{'type':_0x2dc2c9(0x118),'text':JSON[_0x2dc2c9(0xdb)](_0x46178d)}]};}return{'content':[{'type':_0x2dc2c9(0x118),'text':JSON['stringify']({'error':_0x2dc2c9(0x122)})}]};});function a0_0xe364(_0x491e35,_0x23c994){_0x491e35=_0x491e35-0xb8;const _0x56e1da=a0_0x56e1();let _0xe36410=_0x56e1da[_0x491e35];return _0xe36410;}async function v(){const _0x19defb=a0_0x1452a5;let _0x4d22b1=D+_0x19defb(0xfd)+encodeURIComponent(Z),_0x2aca4c={};if(X)_0x2aca4c[_0x19defb(0x146)]=_0x19defb(0xbf)+X;Y('connecting\x20to\x20'+_0x4d22b1);while(!0x0){try{let _0xe338ed=await fetch(_0x4d22b1,{'headers':_0x2aca4c});if(!_0xe338ed['ok']){Y(_0x19defb(0xdf)+_0xe338ed[_0x19defb(0x141)]+'\x20'+_0xe338ed[_0x19defb(0x13f)]),await h(0x1388);continue;}let _0x1d83af=_0xe338ed[_0x19defb(0x128)][_0x19defb(0x132)](),_0x326e3e=new TextDecoder(),_0x9e25ba='';while(!0x0){let {done:_0x30bc89,value:_0x380983}=await _0x1d83af[_0x19defb(0xc7)]();if(_0x30bc89)break;_0x9e25ba+=_0x326e3e['decode'](_0x380983,{'stream':!0x0});let _0x42f885=_0x9e25ba['split']('\x0a\x0a');_0x9e25ba=_0x42f885['pop']()||'';for(let _0x29c17f of _0x42f885){let _0x4c4638=_0x29c17f[_0x19defb(0x142)]('\x0a')[_0x19defb(0xe2)](_0x35734b=>_0x35734b[_0x19defb(0xf9)](_0x19defb(0x113)));if(!_0x4c4638)continue;try{let _0x1c1d88=JSON[_0x19defb(0x116)](_0x4c4638['slice'](0x6));await u(_0x1c1d88);}catch(_0x282e73){Y(_0x19defb(0x147)+_0x282e73);}}}Y(_0x19defb(0xf0));}catch(_0x325d59){Y('SSE\x20connection\x20error:\x20'+_0x325d59);}await h(0xbb8);}}async function u(_0x378435){const _0x8d8ee4=a0_0x1452a5;if(_0x378435[_0x8d8ee4(0x10d)]===_0x8d8ee4(0x117)){Y(_0x8d8ee4(0x14a)+Z+'\x22');return;}if(_0x378435['type']===_0x8d8ee4(0x13a)){if(Y(_0x8d8ee4(0x137)+_0x378435[_0x8d8ee4(0xe8)]+':\x20'+_0x378435[_0x8d8ee4(0xd1)][_0x8d8ee4(0x12b)](0x0,0x3c)),await K[_0x8d8ee4(0xef)]({'method':_0x8d8ee4(0x114),'params':{'content':_0x378435[_0x8d8ee4(0xd1)],'meta':{'sender':_0x378435[_0x8d8ee4(0xe8)]||_0x8d8ee4(0xf6),'sender_id':_0x8d8ee4(0xf3),'user':_0x378435[_0x8d8ee4(0xe8)]||_0x8d8ee4(0xf6),'priority':_0x8d8ee4(0xc4)}}}),_0x378435[_0x8d8ee4(0xc5)])await P('ack_inbox',{'alias':Z,'message_id':_0x378435['message_id']});return;}if(_0x378435[_0x8d8ee4(0x10d)]===_0x8d8ee4(0x134)||_0x378435[_0x8d8ee4(0x10d)]===_0x8d8ee4(0x12d)){Y('←\x20'+_0x378435[_0x8d8ee4(0x10d)]+_0x8d8ee4(0x105)+_0x378435[_0x8d8ee4(0x136)]+'\x20priority='+(_0x378435['priority']||_0x8d8ee4(0xc4)));let _0x22158f=await P(_0x8d8ee4(0x110),{'alias':Z,'limit':0x5});if(_0x22158f?.['ok']&&_0x22158f[_0x8d8ee4(0x130)]?.[_0x8d8ee4(0x111)]>0x0)for(let _0x4cbf6c of _0x22158f[_0x8d8ee4(0x130)]){let _0x3d10ec={'sender':_0x4cbf6c[_0x8d8ee4(0x123)]||_0x8d8ee4(0xf6),'sender_id':'commhub','user':_0x4cbf6c[_0x8d8ee4(0x123)]||_0x8d8ee4(0xf6),'task_id':_0x4cbf6c['id'],'priority':_0x4cbf6c[_0x8d8ee4(0xfc)]||'normal'};k[_0x8d8ee4(0x100)](_0x4cbf6c['id'],_0x4cbf6c[_0x8d8ee4(0x123)]||_0x8d8ee4(0xf6)),await K[_0x8d8ee4(0xef)]({'method':_0x8d8ee4(0x114),'params':{'content':_0x4cbf6c['content'],'meta':_0x3d10ec}}),Y(_0x8d8ee4(0xba)+_0x4cbf6c['id'][_0x8d8ee4(0x12b)](0x0,0x8)+_0x8d8ee4(0x12f)+_0x4cbf6c[_0x8d8ee4(0x123)]+':\x20'+_0x4cbf6c[_0x8d8ee4(0x143)]['slice'](0x0,0x3c)),await P(_0x8d8ee4(0x133),{'alias':Z,'message_id':_0x4cbf6c['id']});}}}async function S(){const _0x420955=a0_0x1452a5;let _0x4080e7=new a0_0x52601a();await K['connect'](_0x4080e7),Y(_0x420955(0xcf)),Y(_0x420955(0xe1)),v()[_0x420955(0x119)](_0x5bdd87=>Y(_0x420955(0xf5)+_0x5bdd87)),P(_0x420955(0xcc),{'resume_id':w,'alias':Z,'status':_0x420955(0xe7),'server':a0_0x2b86d8(),'hostname':a0_0x2b86d8(),'agent':_0x420955(0xb9),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x420955(0xcd)](()=>Y('registered\x20as\x20\x22'+Z+_0x420955(0xcb)+w[_0x420955(0x12b)](0x0,0x8)+')'))[_0x420955(0x119)](_0x511bad=>Y(_0x420955(0x11b)+_0x511bad)),setInterval(()=>{const _0x54369d=_0x420955;P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x2b86d8(),'hostname':a0_0x2b86d8(),'agent':'claude-code','project_dir':process[_0x54369d(0xfa)](),'tmux_name':f||void 0x0})[_0x54369d(0x119)](_0x2f6bb1=>Y('heartbeat\x20failed:\x20'+_0x2f6bb1));},0x2bf20),Y(_0x420955(0x138));}S()[a0_0x1452a5(0x119)](_0xad95=>{const _0x585a12=a0_0x1452a5;Y(_0x585a12(0xd4)+_0xad95),process[_0x585a12(0xed)](0x1);});async function N(){const _0x112524=a0_0x1452a5;Y(_0x112524(0xc3)),await P(_0x112524(0xcc),{'resume_id':w,'alias':Z,'status':'error','task':'session\x20disconnected'})[_0x112524(0x119)](()=>{}),process[_0x112524(0xed)](0x0);}process[a0_0x1452a5(0x13b)]['on'](a0_0x1452a5(0x129),()=>N()),process['on'](a0_0x1452a5(0xd9),()=>N()),process['on']('SIGINT',()=>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.47",
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",