@sleep2agi/agent-network 2.0.0-preview.17 → 2.0.0-preview.18

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_0x318584=a0_0x1896;(function(_0x3829ee,_0x9f1140){const _0x5efc87=a0_0x1896,_0x139c2c=_0x3829ee();while(!![]){try{const _0x52ba98=parseInt(_0x5efc87(0x93))/0x1*(-parseInt(_0x5efc87(0xd4))/0x2)+-parseInt(_0x5efc87(0xb8))/0x3+-parseInt(_0x5efc87(0xa0))/0x4+-parseInt(_0x5efc87(0xd3))/0x5+-parseInt(_0x5efc87(0xc9))/0x6+parseInt(_0x5efc87(0xbd))/0x7+parseInt(_0x5efc87(0x96))/0x8;if(_0x52ba98===_0x9f1140)break;else _0x139c2c['push'](_0x139c2c['shift']());}catch(_0x305a51){_0x139c2c['push'](_0x139c2c['shift']());}}}(a0_0x2bc1,0xf1598));function a0_0x1896(_0x13e788,_0x312d11){_0x13e788=_0x13e788-0x89;const _0x2bc110=a0_0x2bc1();let _0x189608=_0x2bc110[_0x13e788];return _0x189608;}function a0_0x2bc1(){const _0x386924=['text/event-stream','text','connect','parse','inbox\x20error:\x20','autoConnect','Bearer\x20','agent','new_task','1438100BphrbC','startsWith','toTimeString','running','SSE\x20error:\x20','reply','connected','catch','resumeId','emit','disconnected','registered','replace','body','get_inbox','heartbeatInterval','cwd','task','SSE\x20connected','offline','heartbeatTimer','split','slice','send_task','3182556hWrFyI','read','new_message','sdk-','tools/call','11389945jGyaVd','reconnectDelay','server','status','alias','pop','sdk','from_session','data:\x20','getReader','log','toString','653766nMHaFX','call','token','now','name','idle','SSE\x20reconnecting\x20in\x20','disconnect','/mcp','send','8212695HTvIXu','239312ECeRlD','sleep','get_all_status','result','broadcast','completed','application/json','Authorization','message','SSE\x20failed:\x20',']\x20[commhub:','/events/','processInbox','sseAbort','s...','min','url','decode','normal','content','type','2.0','5kHPrfY','abort','getAllStatus','25052720ktCXvE'];a0_0x2bc1=function(){return _0x386924;};return a0_0x2bc1();}import{EventEmitter as a0_0x12ea5b}from'events';import{hostname as a0_0x4f1ddc}from'os';class T extends a0_0x12ea5b{['url'];[a0_0x318584(0xc1)];[a0_0x318584(0xcb)];[a0_0x318584(0x9e)];['resumeId'];[a0_0x318584(0xaf)];['reconnectDelay'];[a0_0x318584(0xb4)];[a0_0x318584(0x8a)];[a0_0x318584(0xa3)]=!0x1;constructor(_0x25205e){const _0x879bfa=a0_0x318584;super();if(this['url']=_0x25205e[_0x879bfa(0x8d)][_0x879bfa(0xac)](/\/$/,''),this[_0x879bfa(0xc1)]=_0x25205e[_0x879bfa(0xc1)],this[_0x879bfa(0xcb)]=_0x25205e[_0x879bfa(0xcb)],this['agent']=_0x25205e[_0x879bfa(0x9e)]||_0x879bfa(0xc3),this['resumeId']=_0x879bfa(0xbb)+_0x25205e['alias']+'-'+Date[_0x879bfa(0xcc)]()[_0x879bfa(0xc8)](0x24),this[_0x879bfa(0xaf)]=_0x25205e[_0x879bfa(0xaf)]??0x2bf20,this[_0x879bfa(0xbe)]=_0x25205e[_0x879bfa(0xbe)]??0xbb8,_0x25205e[_0x879bfa(0x9c)]!==!0x1)this[_0x879bfa(0x99)]();}['log'](_0x53bb53){const _0x4a56f4=a0_0x318584;console['log']('['+new Date()[_0x4a56f4(0xa2)]()['slice'](0x0,0x8)+_0x4a56f4(0xde)+this[_0x4a56f4(0xc1)]+']\x20'+_0x53bb53);}async['call'](_0x39db74,_0x3ae48f){const _0x2bb2d0=a0_0x318584;let _0x4be48a={'Content-Type':_0x2bb2d0(0xda),'Accept':'application/json,\x20text/event-stream'};if(this[_0x2bb2d0(0xcb)])_0x4be48a[_0x2bb2d0(0xdb)]=_0x2bb2d0(0x9d)+this[_0x2bb2d0(0xcb)];let _0x38dfd8=await(await fetch(this[_0x2bb2d0(0x8d)]+_0x2bb2d0(0xd1),{'method':'POST','headers':_0x4be48a,'body':JSON['stringify']({'jsonrpc':_0x2bb2d0(0x92),'id':Date[_0x2bb2d0(0xcc)](),'method':_0x2bb2d0(0xbc),'params':{'name':_0x39db74,'arguments':_0x3ae48f}})}))[_0x2bb2d0(0x98)](),_0x4adc22=_0x38dfd8['match'](/data: (.+)/),_0x5ae4d0=_0x4adc22?JSON['parse'](_0x4adc22[0x1]):JSON[_0x2bb2d0(0x9a)](_0x38dfd8),_0x18d973=_0x5ae4d0?.[_0x2bb2d0(0xd7)]?.[_0x2bb2d0(0x90)]?.[0x0]?.[_0x2bb2d0(0x98)];return _0x18d973?JSON[_0x2bb2d0(0x9a)](_0x18d973):_0x5ae4d0;}async[a0_0x318584(0x99)](){const _0x3b1b82=a0_0x318584;if(this[_0x3b1b82(0xa3)])return;this[_0x3b1b82(0xa3)]=!0x0,await this[_0x3b1b82(0xc0)](_0x3b1b82(0xce)),this[_0x3b1b82(0xc7)](_0x3b1b82(0xab)),this[_0x3b1b82(0xb4)]=setInterval(()=>{const _0x1665c4=_0x3b1b82;this[_0x1665c4(0xc0)](_0x1665c4(0xce))[_0x1665c4(0xa7)](_0x2bb3a9=>this['log']('heartbeat\x20failed:\x20'+_0x2bb3a9[_0x1665c4(0xdc)]));},this[_0x3b1b82(0xaf)]),this['connectSSE']();}async[a0_0x318584(0xd0)](){const _0xc1d1ad=a0_0x318584;if(this['running']=!0x1,this[_0xc1d1ad(0x8a)]?.[_0xc1d1ad(0x94)](),this['heartbeatTimer'])clearInterval(this[_0xc1d1ad(0xb4)]);await this[_0xc1d1ad(0xc0)](_0xc1d1ad(0xb3))[_0xc1d1ad(0xa7)](()=>{}),this['log']('disconnected');}async[a0_0x318584(0xd2)](_0x149986,_0x3c16a1,_0x5eb8a5=a0_0x318584(0x8f)){const _0x44266f=a0_0x318584;return this['call'](_0x44266f(0xb7),{'alias':_0x149986,'task':_0x3c16a1,'priority':_0x5eb8a5,'from_session':this[_0x44266f(0xc1)]});}async[a0_0x318584(0xdc)](_0xb4fd42,_0x4de716){const _0x50e38b=a0_0x318584;return this[_0x50e38b(0xca)]('send_message',{'alias':_0xb4fd42,'message':_0x4de716,'from_session':this['alias']});}async[a0_0x318584(0xa5)](_0xb4c0f0,_0x4c61fa,_0x3ec983=a0_0x318584(0xd9)){const _0x4e2f4f=a0_0x318584;return this[_0x4e2f4f(0xca)]('reply',{'task_id':_0xb4c0f0,'text':_0x4c61fa,'status':_0x3ec983});}async[a0_0x318584(0xc0)](_0x8c6477,_0x555ceb){const _0x9b5d59=a0_0x318584;return this[_0x9b5d59(0xca)]('report_status',{'resume_id':this[_0x9b5d59(0xa8)],'alias':this['alias'],'status':_0x8c6477,'server':a0_0x4f1ddc(),'hostname':a0_0x4f1ddc(),'agent':this[_0x9b5d59(0x9e)],'project_dir':process[_0x9b5d59(0xb0)](),..._0x555ceb});}async[a0_0x318584(0x95)](){const _0x4140a8=a0_0x318584;return this['call'](_0x4140a8(0xd6),{});}async['broadcast'](_0x4eb291,_0x35595f){const _0x3b5b7e=a0_0x318584;return this['call'](_0x3b5b7e(0xd8),{'message':_0x4eb291,'filter_server':_0x35595f?.[_0x3b5b7e(0xbf)],'filter_status':_0x35595f?.['status']});}async['connectSSE'](){const _0x2d4ab9=a0_0x318584;let _0x452259=encodeURIComponent(this[_0x2d4ab9(0xc1)]),_0x312e26=this[_0x2d4ab9(0x8d)]+_0x2d4ab9(0xdf)+_0x452259,_0x21f0b4=this[_0x2d4ab9(0xbe)];while(this[_0x2d4ab9(0xa3)]){try{this[_0x2d4ab9(0x8a)]=new AbortController();let _0x594191={'Accept':_0x2d4ab9(0x97)};if(this[_0x2d4ab9(0xcb)])_0x594191[_0x2d4ab9(0xdb)]=_0x2d4ab9(0x9d)+this[_0x2d4ab9(0xcb)];let _0x35fe4b=await fetch(_0x312e26,{'headers':_0x594191,'signal':this['sseAbort']['signal']});if(!_0x35fe4b['ok']||!_0x35fe4b['body']){this[_0x2d4ab9(0xc7)](_0x2d4ab9(0xdd)+_0x35fe4b['status']),await this[_0x2d4ab9(0xd5)](_0x21f0b4),_0x21f0b4=Math['min'](_0x21f0b4*1.5,0xea60);continue;}_0x21f0b4=this[_0x2d4ab9(0xbe)];let _0x20ce8c=_0x35fe4b[_0x2d4ab9(0xad)][_0x2d4ab9(0xc6)](),_0x3b63f9=new TextDecoder(),_0x29758c='';while(this[_0x2d4ab9(0xa3)]){let {done:_0x28370b,value:_0x2df8a2}=await _0x20ce8c[_0x2d4ab9(0xb9)]();if(_0x28370b)break;_0x29758c+=_0x3b63f9[_0x2d4ab9(0x8e)](_0x2df8a2,{'stream':!0x0});let _0x53e4a4=_0x29758c[_0x2d4ab9(0xb5)]('\x0a');_0x29758c=_0x53e4a4[_0x2d4ab9(0xc2)]()||'';for(let _0x20960e of _0x53e4a4){if(!_0x20960e[_0x2d4ab9(0xa1)](_0x2d4ab9(0xc5)))continue;try{let _0x26be07=JSON['parse'](_0x20960e[_0x2d4ab9(0xb6)](0x6));if(_0x26be07[_0x2d4ab9(0x91)]==='connected'){this[_0x2d4ab9(0xc7)](_0x2d4ab9(0xb2)),this[_0x2d4ab9(0xa9)](_0x2d4ab9(0xa6));continue;}if(_0x26be07['type']===_0x2d4ab9(0x9f)||_0x26be07[_0x2d4ab9(0x91)]===_0x2d4ab9(0xba)||_0x26be07[_0x2d4ab9(0x91)]==='broadcast')await this[_0x2d4ab9(0x89)]();}catch{}}}}catch(_0x70749e){if(_0x70749e[_0x2d4ab9(0xcd)]==='AbortError')break;this['emit']('error',_0x70749e),this['log'](_0x2d4ab9(0xa4)+_0x70749e[_0x2d4ab9(0xdc)]);}if(this['running'])this['emit'](_0x2d4ab9(0xaa)),this[_0x2d4ab9(0xc7)](_0x2d4ab9(0xcf)+_0x21f0b4/0x3e8+_0x2d4ab9(0x8b)),await this[_0x2d4ab9(0xd5)](_0x21f0b4),_0x21f0b4=Math[_0x2d4ab9(0x8c)](_0x21f0b4*1.5,0xea60);}}async[a0_0x318584(0x89)](){const _0x5b98f8=a0_0x318584;try{let _0xaffe26=(await this[_0x5b98f8(0xca)](_0x5b98f8(0xae),{'alias':this[_0x5b98f8(0xc1)],'limit':0xa}))?.['messages']||[];for(let _0x3ab57f of _0xaffe26)await this['call']('ack_inbox',{'alias':this[_0x5b98f8(0xc1)],'message_id':_0x3ab57f['id']}),this[_0x5b98f8(0xc7)]('←\x20'+_0x3ab57f[_0x5b98f8(0xc4)]+':\x20'+_0x3ab57f[_0x5b98f8(0x90)]['slice'](0x0,0x3c)),this['emit'](_0x5b98f8(0xb1),_0x3ab57f),this[_0x5b98f8(0xa9)](_0x5b98f8(0xdc),_0x3ab57f);}catch(_0x566267){this[_0x5b98f8(0xc7)](_0x5b98f8(0x9b)+_0x566267[_0x5b98f8(0xdc)]);}}[a0_0x318584(0xd5)](_0xf4e1bf){return new Promise(_0x131889=>setTimeout(_0x131889,_0xf4e1bf));}}var $=T;export{$ as default,T as CommHub};
1
+ function a0_0x21c9(){const _0x360753=['2640545GCEjha','8163QhfGXc','7790nzHQCh',']\x20[commhub:','heartbeatInterval','send_task','222741Bbewcn','log','6769bXFlxj','sdk','resumeId','min','toTimeString','getAllStatus','split','name','connected','Bearer\x20','idle','signal','broadcast','agent','SSE\x20reconnecting\x20in\x20','SSE\x20error:\x20','token','get_all_status','sdk-','new_message','emit','text','inbox\x20error:\x20','messages','/events/','message','replace','running','content','normal','heartbeatTimer','SSE\x20failed:\x20','s...','data:\x20','slice','call','8724bZNhkH','now','connect','tools/call','send','sleep','decode','registered','/mcp','send_message','2.0','type','reply','SSE\x20connected','from_session','5150AzeOJN','1310800kEPqop','heartbeat\x20failed:\x20','report_status','toString','Authorization','connectSSE','reconnectDelay','15392223fGCJJj','parse','4lSHneV','new_task','status','pop','789KSoHuf','alias','ack_inbox','get_inbox','catch','server','sseAbort','offline','match','read','body','url'];a0_0x21c9=function(){return _0x360753;};return a0_0x21c9();}const a0_0x13d0d7=a0_0x1312;(function(_0x1350d4,_0x39f6c4){const _0x41dd1a=a0_0x1312,_0x47d945=_0x1350d4();while(!![]){try{const _0x2c0034=parseInt(_0x41dd1a(0x143))/0x1+-parseInt(_0x41dd1a(0x123))/0x2*(parseInt(_0x41dd1a(0x131))/0x3)+-parseInt(_0x41dd1a(0x12d))/0x4*(parseInt(_0x41dd1a(0x13d))/0x5)+-parseInt(_0x41dd1a(0x114))/0x6*(-parseInt(_0x41dd1a(0x145))/0x7)+-parseInt(_0x41dd1a(0x124))/0x8+parseInt(_0x41dd1a(0x13e))/0x9*(-parseInt(_0x41dd1a(0x13f))/0xa)+parseInt(_0x41dd1a(0x12b))/0xb;if(_0x2c0034===_0x39f6c4)break;else _0x47d945['push'](_0x47d945['shift']());}catch(_0x2fa68d){_0x47d945['push'](_0x47d945['shift']());}}}(a0_0x21c9,0xe87fb));import{EventEmitter as a0_0x53d099}from'events';function a0_0x1312(_0x2c2726,_0x454ca2){_0x2c2726=_0x2c2726-0xfa;const _0x21c9c5=a0_0x21c9();let _0x1312a8=_0x21c9c5[_0x2c2726];return _0x1312a8;}import{hostname as a0_0xedc8b}from'os';class T extends a0_0x53d099{[a0_0x13d0d7(0x13c)];[a0_0x13d0d7(0x132)];[a0_0x13d0d7(0x100)];['agent'];[a0_0x13d0d7(0x147)];[a0_0x13d0d7(0x141)];['reconnectDelay'];[a0_0x13d0d7(0x10e)];[a0_0x13d0d7(0x137)];[a0_0x13d0d7(0x10b)]=!0x1;constructor(_0x44b9b1){const _0x3367b1=a0_0x13d0d7;super();if(this['url']=_0x44b9b1[_0x3367b1(0x13c)][_0x3367b1(0x10a)](/\/$/,''),this['alias']=_0x44b9b1['alias'],this[_0x3367b1(0x100)]=_0x44b9b1[_0x3367b1(0x100)],this[_0x3367b1(0xfd)]=_0x44b9b1[_0x3367b1(0xfd)]||_0x3367b1(0x146),this[_0x3367b1(0x147)]=_0x3367b1(0x102)+_0x44b9b1['alias']+'-'+Date[_0x3367b1(0x115)]()[_0x3367b1(0x127)](0x24),this[_0x3367b1(0x141)]=_0x44b9b1['heartbeatInterval']??0x2bf20,this['reconnectDelay']=_0x44b9b1[_0x3367b1(0x12a)]??0xbb8,_0x44b9b1['autoConnect']!==!0x1)this[_0x3367b1(0x116)]();}[a0_0x13d0d7(0x144)](_0x1083fc){const _0x3fb370=a0_0x13d0d7;console[_0x3fb370(0x144)]('['+new Date()[_0x3fb370(0x149)]()[_0x3fb370(0x112)](0x0,0x8)+_0x3fb370(0x140)+this[_0x3fb370(0x132)]+']\x20'+_0x1083fc);}async['call'](_0x2b6b6d,_0xe60959){const _0x1d1ad1=a0_0x13d0d7;let _0x2b325e={'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream'};if(this[_0x1d1ad1(0x100)])_0x2b325e[_0x1d1ad1(0x128)]=_0x1d1ad1(0x14e)+this[_0x1d1ad1(0x100)];let _0x2b30c1=await(await fetch(this['url']+_0x1d1ad1(0x11c),{'method':'POST','headers':_0x2b325e,'body':JSON['stringify']({'jsonrpc':_0x1d1ad1(0x11e),'id':Date[_0x1d1ad1(0x115)](),'method':_0x1d1ad1(0x117),'params':{'name':_0x2b6b6d,'arguments':_0xe60959}})}))[_0x1d1ad1(0x105)](),_0x544372=_0x2b30c1[_0x1d1ad1(0x139)](/data: (.+)/),_0x32e9bb=_0x544372?JSON['parse'](_0x544372[0x1]):JSON[_0x1d1ad1(0x12c)](_0x2b30c1),_0x111a20=_0x32e9bb?.['result']?.[_0x1d1ad1(0x10c)]?.[0x0]?.['text'];return _0x111a20?JSON[_0x1d1ad1(0x12c)](_0x111a20):_0x32e9bb;}async[a0_0x13d0d7(0x116)](){const _0x33c400=a0_0x13d0d7;if(this['running'])return;this[_0x33c400(0x10b)]=!0x0,await this[_0x33c400(0x12f)](_0x33c400(0xfa)),this[_0x33c400(0x144)](_0x33c400(0x11b)),this['heartbeatTimer']=setInterval(()=>{const _0x4247f9=_0x33c400;this['status'](_0x4247f9(0xfa))[_0x4247f9(0x135)](_0x3fd48e=>this[_0x4247f9(0x144)](_0x4247f9(0x125)+_0x3fd48e[_0x4247f9(0x109)]));},this[_0x33c400(0x141)]),this[_0x33c400(0x129)]();}async['disconnect'](){const _0x3cf20e=a0_0x13d0d7;if(this[_0x3cf20e(0x10b)]=!0x1,this['sseAbort']?.['abort'](),this[_0x3cf20e(0x10e)])clearInterval(this[_0x3cf20e(0x10e)]);await this['status'](_0x3cf20e(0x138))[_0x3cf20e(0x135)](()=>{}),this[_0x3cf20e(0x144)]('disconnected');}async[a0_0x13d0d7(0x118)](_0x291b14,_0x29b21b,_0x47a58e=a0_0x13d0d7(0x10d)){const _0x7cc752=a0_0x13d0d7;return this[_0x7cc752(0x113)](_0x7cc752(0x142),{'alias':_0x291b14,'task':_0x29b21b,'priority':_0x47a58e,'from_session':this[_0x7cc752(0x132)]});}async[a0_0x13d0d7(0x109)](_0xe5976c,_0x139d17){const _0x5404ad=a0_0x13d0d7;return this[_0x5404ad(0x113)](_0x5404ad(0x11d),{'alias':_0xe5976c,'message':_0x139d17,'from_session':this[_0x5404ad(0x132)]});}async[a0_0x13d0d7(0x120)](_0x33c2df,_0x1ae6ce,_0x4ec7b3='completed'){const _0x2f0703=a0_0x13d0d7;return this[_0x2f0703(0x113)]('reply',{'task_id':_0x33c2df,'text':_0x1ae6ce,'status':_0x4ec7b3});}async['status'](_0x34eb9e,_0x32c2f5){const _0x53ac6a=a0_0x13d0d7;return this[_0x53ac6a(0x113)](_0x53ac6a(0x126),{'resume_id':this[_0x53ac6a(0x147)],'alias':this[_0x53ac6a(0x132)],'status':_0x34eb9e,'server':a0_0xedc8b(),'hostname':a0_0xedc8b(),'agent':this[_0x53ac6a(0xfd)],'project_dir':process['cwd'](),..._0x32c2f5});}async[a0_0x13d0d7(0x14a)](){const _0x9fab49=a0_0x13d0d7;return this[_0x9fab49(0x113)](_0x9fab49(0x101),{});}async[a0_0x13d0d7(0xfc)](_0x36a5c4,_0x1732aa){const _0x44ea7f=a0_0x13d0d7;return this[_0x44ea7f(0x113)](_0x44ea7f(0xfc),{'message':_0x36a5c4,'filter_server':_0x1732aa?.[_0x44ea7f(0x136)],'filter_status':_0x1732aa?.[_0x44ea7f(0x12f)]});}async[a0_0x13d0d7(0x129)](){const _0x34d79f=a0_0x13d0d7;let _0x1964a8=encodeURIComponent(this[_0x34d79f(0x132)]),_0x3608d9=this[_0x34d79f(0x13c)]+_0x34d79f(0x108)+_0x1964a8,_0x554d02=this[_0x34d79f(0x12a)];while(this[_0x34d79f(0x10b)]){try{this['sseAbort']=new AbortController();let _0x4c5a0f={'Accept':'text/event-stream'};if(this[_0x34d79f(0x100)])_0x4c5a0f[_0x34d79f(0x128)]='Bearer\x20'+this[_0x34d79f(0x100)];let _0x284a34=await fetch(_0x3608d9,{'headers':_0x4c5a0f,'signal':this[_0x34d79f(0x137)][_0x34d79f(0xfb)]});if(!_0x284a34['ok']||!_0x284a34[_0x34d79f(0x13b)]){this['log'](_0x34d79f(0x10f)+_0x284a34[_0x34d79f(0x12f)]),await this[_0x34d79f(0x119)](_0x554d02),_0x554d02=Math[_0x34d79f(0x148)](_0x554d02*1.5,0xea60);continue;}_0x554d02=this['reconnectDelay'];let _0x61d55d=_0x284a34[_0x34d79f(0x13b)]['getReader'](),_0x49903e=new TextDecoder(),_0x1c09a5='';while(this[_0x34d79f(0x10b)]){let {done:_0x42acef,value:_0x5880c4}=await _0x61d55d[_0x34d79f(0x13a)]();if(_0x42acef)break;_0x1c09a5+=_0x49903e[_0x34d79f(0x11a)](_0x5880c4,{'stream':!0x0});let _0x12b6eb=_0x1c09a5[_0x34d79f(0x14b)]('\x0a');_0x1c09a5=_0x12b6eb[_0x34d79f(0x130)]()||'';for(let _0x18b9df of _0x12b6eb){if(!_0x18b9df['startsWith'](_0x34d79f(0x111)))continue;try{let _0x399707=JSON['parse'](_0x18b9df[_0x34d79f(0x112)](0x6));if(_0x399707[_0x34d79f(0x11f)]===_0x34d79f(0x14d)){this['log'](_0x34d79f(0x121)),this[_0x34d79f(0x104)](_0x34d79f(0x14d));continue;}if(_0x399707[_0x34d79f(0x11f)]===_0x34d79f(0x12e)||_0x399707['type']===_0x34d79f(0x103)||_0x399707[_0x34d79f(0x11f)]===_0x34d79f(0xfc))await this['processInbox']();}catch{}}}}catch(_0x2c51fe){if(_0x2c51fe[_0x34d79f(0x14c)]==='AbortError')break;this[_0x34d79f(0x104)]('error',_0x2c51fe),this[_0x34d79f(0x144)](_0x34d79f(0xff)+_0x2c51fe[_0x34d79f(0x109)]);}if(this['running'])this['emit']('disconnected'),this[_0x34d79f(0x144)](_0x34d79f(0xfe)+_0x554d02/0x3e8+_0x34d79f(0x110)),await this['sleep'](_0x554d02),_0x554d02=Math[_0x34d79f(0x148)](_0x554d02*1.5,0xea60);}}async['processInbox'](){const _0x1ee84b=a0_0x13d0d7;try{let _0xe8c5c2=(await this['call'](_0x1ee84b(0x134),{'alias':this[_0x1ee84b(0x132)],'limit':0xa}))?.[_0x1ee84b(0x107)]||[];for(let _0x22eec4 of _0xe8c5c2)await this[_0x1ee84b(0x113)](_0x1ee84b(0x133),{'alias':this[_0x1ee84b(0x132)],'message_id':_0x22eec4['id']}),this[_0x1ee84b(0x144)]('←\x20'+_0x22eec4[_0x1ee84b(0x122)]+':\x20'+_0x22eec4[_0x1ee84b(0x10c)][_0x1ee84b(0x112)](0x0,0x3c)),this[_0x1ee84b(0x104)]('task',_0x22eec4),this[_0x1ee84b(0x104)](_0x1ee84b(0x109),_0x22eec4);}catch(_0x3b53fd){this[_0x1ee84b(0x144)](_0x1ee84b(0x106)+_0x3b53fd[_0x1ee84b(0x109)]);}}[a0_0x13d0d7(0x119)](_0x222138){return new Promise(_0x21ecb8=>setTimeout(_0x21ecb8,_0x222138));}}var $=T;export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x3f9457=a0_0x2e54;(function(_0x27b174,_0x472186){const _0x4ec7d3=a0_0x2e54,_0x5648bf=_0x27b174();while(!![]){try{const _0x10bf98=-parseInt(_0x4ec7d3(0x19d))/0x1*(-parseInt(_0x4ec7d3(0x18d))/0x2)+parseInt(_0x4ec7d3(0x1dc))/0x3+-parseInt(_0x4ec7d3(0x199))/0x4*(parseInt(_0x4ec7d3(0x1df))/0x5)+parseInt(_0x4ec7d3(0x1a3))/0x6+parseInt(_0x4ec7d3(0x1d6))/0x7+-parseInt(_0x4ec7d3(0x19f))/0x8*(-parseInt(_0x4ec7d3(0x1aa))/0x9)+-parseInt(_0x4ec7d3(0x1a7))/0xa*(parseInt(_0x4ec7d3(0x1bc))/0xb);if(_0x10bf98===_0x472186)break;else _0x5648bf['push'](_0x5648bf['shift']());}catch(_0x39b0f1){_0x5648bf['push'](_0x5648bf['shift']());}}}(a0_0x567c,0x3a5b0));import{readFileSync as a0_0x3c8986,existsSync as a0_0x3720a2}from'fs';import{join as a0_0x1bab10}from'path';import{hostname as a0_0x18189b}from'os';import{execSync as a0_0x487488}from'child_process';import{Server as a0_0x2cf970}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x413c4a}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x148448,CallToolRequestSchema as a0_0x464ebb}from'@modelcontextprotocol/sdk/types.js';function p(_0x411e62){const _0x33fd50=a0_0x2e54;if(!a0_0x3720a2(_0x411e62))return;for(let _0x2d4aa1 of a0_0x3c8986(_0x411e62,_0x33fd50(0x1de))['split']('\x0a')){let _0x37deb6=_0x2d4aa1[_0x33fd50(0x1cf)]();if(!_0x37deb6||_0x37deb6[_0x33fd50(0x1f3)]('#'))continue;let _0x21ec9b=_0x37deb6[_0x33fd50(0x1f8)]('=');if(_0x21ec9b<0x0)continue;let _0x3d79c3=_0x37deb6[_0x33fd50(0x194)](0x0,_0x21ec9b)[_0x33fd50(0x1cf)](),_0xd5e3eb=_0x37deb6[_0x33fd50(0x194)](_0x21ec9b+0x1)[_0x33fd50(0x1cf)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x3d79c3])process.env[_0x3d79c3]=_0xd5e3eb;}}var C=process.env.HOME||'~',T=a0_0x1bab10(C,'.claude/channels/commhub');p(a0_0x1bab10(T,'.env'));var L=process[a0_0x3f9457(0x19a)]()[a0_0x3f9457(0x1c9)](/\//g,'-');p(a0_0x1bab10(T,L,'.env'));function U(){const _0x5c4306=a0_0x3f9457;try{return a0_0x487488(_0x5c4306(0x1d8),{'encoding':_0x5c4306(0x1de),'timeout':0x7d0})[_0x5c4306(0x1cf)]();}catch{return'';}}function c(){const _0x42d670=a0_0x3f9457;try{let _0xf86164=a0_0x1bab10(C,_0x42d670(0x1a6),_0x42d670(0x1fc));if(a0_0x3720a2(_0xf86164))return JSON[_0x42d670(0x196)](a0_0x3c8986(_0xf86164,_0x42d670(0x1de)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x3f9457(0x1c8)]||a0_0x3f9457(0x192),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x18189b(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x3f9457(0x20d)](),X=process.env.COMMHUB_TOKEN||H[a0_0x3f9457(0x1a2)]||'';function Y(_0x264a6b){const _0x1d9626=a0_0x3f9457;let _0x2ed097=new Date()[_0x1d9626(0x1c3)]()[_0x1d9626(0x194)](0x0,0x8);process[_0x1d9626(0x1b1)][_0x1d9626(0x1dd)]('['+_0x2ed097+_0x1d9626(0x1b2)+_0x264a6b+'\x0a');}function h(_0x3e4d21){return new Promise(_0x2934bd=>setTimeout(_0x2934bd,_0x3e4d21));}Y('ENV:\x20URL='+D+'\x20ALIAS='+Z+'\x20RESUME_ID='+w[a0_0x3f9457(0x194)](0x0,0x8)+a0_0x3f9457(0x193)+(f||'none')+a0_0x3f9457(0x1f9)+process[a0_0x3f9457(0x19a)]()+a0_0x3f9457(0x1c0)+L);var k=new Map(),K=new a0_0x2cf970({'name':a0_0x3f9457(0x191),'version':a0_0x3f9457(0x1c1)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x3f9457(0x1ec),a0_0x3f9457(0x1a1),a0_0x3f9457(0x210),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x3f9457(0x1f7)+Z][a0_0x3f9457(0x188)]('\x0a')});K[a0_0x3f9457(0x1bb)](a0_0x148448,async()=>({'tools':[{'name':a0_0x3f9457(0x1a0),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x3f9457(0x1c4),'properties':{'task_id':{'type':a0_0x3f9457(0x20f),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x3f9457(0x20f),'description':a0_0x3f9457(0x19c)},'status':{'type':'string','enum':[a0_0x3f9457(0x1e7),'failed',a0_0x3f9457(0x205),a0_0x3f9457(0x1d3),a0_0x3f9457(0x1ff),'in_progress'],'description':a0_0x3f9457(0x18c)}},'required':[a0_0x3f9457(0x1d2)]}},{'name':'commhub_report_status','description':a0_0x3f9457(0x1a9),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x3f9457(0x20f),'enum':[a0_0x3f9457(0x1ca),a0_0x3f9457(0x201),a0_0x3f9457(0x1d3),a0_0x3f9457(0x1ff)]},'task':{'type':a0_0x3f9457(0x20f),'description':'Current\x20task\x20description'},'progress':{'type':'number','description':'Progress\x200-100'}},'required':[a0_0x3f9457(0x1ba)]}},{'name':a0_0x3f9457(0x211),'description':a0_0x3f9457(0x19e),'inputSchema':{'type':a0_0x3f9457(0x1c4),'properties':{'alias':{'type':a0_0x3f9457(0x20f),'description':a0_0x3f9457(0x1af)},'task':{'type':a0_0x3f9457(0x20f),'description':a0_0x3f9457(0x18e)},'priority':{'type':a0_0x3f9457(0x20f),'enum':['high','normal','low'],'description':a0_0x3f9457(0x1e0)}},'required':[a0_0x3f9457(0x1e8),a0_0x3f9457(0x1ab)]}},{'name':a0_0x3f9457(0x1db),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x3f9457(0x1c4),'properties':{'alias':{'type':'string','description':a0_0x3f9457(0x1af)},'message':{'type':a0_0x3f9457(0x20f),'description':a0_0x3f9457(0x1f5)}},'required':[a0_0x3f9457(0x1e8),a0_0x3f9457(0x1f2)]}},{'name':a0_0x3f9457(0x1ea),'description':a0_0x3f9457(0x1fd),'inputSchema':{'type':a0_0x3f9457(0x1c4),'properties':{}}}]}));function a0_0x567c(){const _0xa55d0e=['4220OZZSkS','send_message','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','20151oHPOSg','task','content','heartbeat\x20failed:\x20',':\x20inbox_count=','Target\x20session\x20alias','report_status','stderr',']\x20[commhub]\x20','ready\x20—\x20waiting\x20for\x20events','unknown\x20tool','send_reply','registered\x20as\x20\x22','normal','CommHub\x20init\x20failed:\x20','then','status','setRequestHandler','12001FcDDZo','init\x20failed:\x20','read','getReader','\x20PROJECT_ENV=','0.3.0','notification','toTimeString','object','get_all_status','send_task','application/json,\x20text/event-stream','hub','replace','working','get','fatal:\x20','find','connecting\x20to\x20','trim','2025-03-26','Bearer\x20','text','blocked','length','exit','1240911CmyPiK','stdin','tmux\x20display-message\x20-p\x20\x27#S\x27','type','SSE\x20fatal:\x20','commhub_send_message','453573KcJsXJ','write','utf-8','35WBDUvL','Priority\x20(default:\x20normal)','\x20from\x20','end','from','new_task','tools/call','commhub','completed','alias','warning:\x20could\x20not\x20register:\x20','commhub_get_all_status','priority','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','catch','messages','ack_inbox','claude-code','statusText','message','startsWith','\x20priority=','Message\x20content','commhub_report_status','Session\x20alias:\x20','indexOf','\x20CWD=','SIGTERM','POST','config.json','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','from_session','error','replied','idle','notifications/claude/channel','pop','initialize','cancelled','body','message_id','data:\x20','stringify','SSE\x20connected\x20as\x20\x22','SSE\x20error:\x20','→\x20injected\x20task\x20','randomUUID','split','string','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','commhub_send_task','2.0','set','join','inbox_count','application/json','get_inbox','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','2duYyWw','Task\x20content','SSE\x20connection\x20error:\x20','result','commhub-channel','http://127.0.0.1:9200','...\x20TMUX=','slice','←\x20message\x20from\x20','parse','SIGINT','\x22\x20(','83728IQOJSx','cwd','Authorization','Reply\x20text\x20/\x20result\x20summary','105454lZVNqi','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','1352zkxtMH','commhub_reply','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','token','201846dMyBOb','/mcp','starting\x20SSE\x20listener...','.anet'];a0_0x567c=function(){return _0xa55d0e;};return a0_0x567c();}async function P(_0x586232,_0x3be638){const _0x3c247b=a0_0x3f9457;let _0x519abf=await fetch(D+_0x3c247b(0x1a4),{'method':'POST','headers':{'Content-Type':_0x3c247b(0x18a),'Accept':_0x3c247b(0x1c7),...X?{'Authorization':_0x3c247b(0x1d1)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x3c247b(0x186),'id':0x1,'method':_0x3c247b(0x204),'params':{'protocolVersion':_0x3c247b(0x1d0),'capabilities':{},'clientInfo':{'name':_0x3c247b(0x191),'version':_0x3c247b(0x1c1)}}})});if(!_0x519abf['ok']){let _0x5423e5=await _0x519abf['text']();return Y(_0x3c247b(0x1b8)+_0x519abf[_0x3c247b(0x1ba)]+'\x20'+_0x5423e5[_0x3c247b(0x194)](0x0,0x64)),{'ok':!0x1,'error':_0x3c247b(0x1bd)+_0x519abf[_0x3c247b(0x1ba)]};}await _0x519abf[_0x3c247b(0x1d2)]();let _0x3394d0=(await(await fetch(D+_0x3c247b(0x1a4),{'method':_0x3c247b(0x1fb),'headers':{'Content-Type':'application/json','Accept':_0x3c247b(0x1c7),...X?{'Authorization':_0x3c247b(0x1d1)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x3c247b(0x186),'id':0x2,'method':_0x3c247b(0x1e5),'params':{'name':_0x586232,'arguments':_0x3be638}})}))['text']())[_0x3c247b(0x20e)]('\x0a')[_0x3c247b(0x1cd)](_0x52787f=>_0x52787f[_0x3c247b(0x1f3)](_0x3c247b(0x208)));if(_0x3394d0){let _0x209654=JSON['parse'](_0x3394d0[_0x3c247b(0x194)](0x6));return _0x209654?.['result']?.[_0x3c247b(0x1ac)]?.[0x0]?.[_0x3c247b(0x1d2)]?JSON[_0x3c247b(0x196)](_0x209654[_0x3c247b(0x190)]['content'][0x0]['text']):_0x209654;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x3f9457(0x1bb)](a0_0x464ebb,async _0x498375=>{const _0x12551c=a0_0x3f9457;let {name:_0xa9a72b,arguments:_0x1f549c}=_0x498375['params'];if(_0xa9a72b===_0x12551c(0x1a0)){let {task_id:_0x3746db,text:_0x241a43,status:_0x204f48}=_0x1f549c;if(_0x204f48===_0x12551c(0x1e7)||_0x204f48==='failed'||_0x204f48===_0x12551c(0x205)){let _0x1a0607=_0x204f48===_0x12551c(0x1e7)?_0x12551c(0x200):_0x204f48,_0x2002a4=_0x3746db?k[_0x12551c(0x1cb)](_0x3746db)||_0x12551c(0x1c8):_0x12551c(0x1c8),_0x5badad=await P(_0x12551c(0x1b5),{'alias':_0x2002a4,'text':_0x241a43,'in_reply_to':_0x3746db||void 0x0,'status':_0x1a0607,'from_session':Z});if(_0x3746db)k['delete'](_0x3746db);return{'content':[{'type':'text','text':JSON[_0x12551c(0x209)](_0x5badad)}]};}let _0x1ff913=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x204f48==='blocked'?'blocked':_0x204f48===_0x12551c(0x1ff)?'error':_0x12551c(0x1ca),'task':_0x241a43['slice'](0x0,0xc8),'output':_0x241a43});return{'content':[{'type':_0x12551c(0x1d2),'text':JSON[_0x12551c(0x209)](_0x1ff913)}]};}if(_0xa9a72b===_0x12551c(0x1f6)){let {status:_0xd9eb04,task:_0x394a6f,progress:_0xd72ac0}=_0x1f549c,_0x537bf9=await P(_0x12551c(0x1b0),{'resume_id':w,'alias':Z,'status':_0xd9eb04,'task':_0x394a6f,'progress':_0xd72ac0});return{'content':[{'type':_0x12551c(0x1d2),'text':JSON[_0x12551c(0x209)](_0x537bf9)}]};}if(_0xa9a72b===_0x12551c(0x211)){let {alias:_0x5aedd1,task:_0x370ae3,priority:_0x432009}=_0x1f549c,_0x29f3bb=await P(_0x12551c(0x1c6),{'alias':_0x5aedd1,'task':_0x370ae3,'priority':_0x432009||_0x12551c(0x1b7),'from_session':Z});return{'content':[{'type':_0x12551c(0x1d2),'text':JSON[_0x12551c(0x209)](_0x29f3bb)}]};}if(_0xa9a72b===_0x12551c(0x1db)){let {alias:_0x4862cc,message:_0x1d0ae8}=_0x1f549c,_0x12d196=await P(_0x12551c(0x1a8),{'alias':_0x4862cc,'message':_0x1d0ae8,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x12551c(0x209)](_0x12d196)}]};}if(_0xa9a72b===_0x12551c(0x1ea)){let _0x48f9fb=await P(_0x12551c(0x1c5),{});return{'content':[{'type':_0x12551c(0x1d2),'text':JSON[_0x12551c(0x209)](_0x48f9fb)}]};}return{'content':[{'type':_0x12551c(0x1d2),'text':JSON[_0x12551c(0x209)]({'error':_0x12551c(0x1b4)})}]};});async function v(){const _0x1eb3ac=a0_0x3f9457;let _0x6cf983=D+'/events/'+encodeURIComponent(Z),_0x39de25={};if(X)_0x39de25[_0x1eb3ac(0x19b)]=_0x1eb3ac(0x1d1)+X;Y(_0x1eb3ac(0x1ce)+_0x6cf983);while(!0x0){try{let _0x37a79d=await fetch(_0x6cf983,{'headers':_0x39de25});if(!_0x37a79d['ok']){Y(_0x1eb3ac(0x20b)+_0x37a79d['status']+'\x20'+_0x37a79d[_0x1eb3ac(0x1f1)]),await h(0x1388);continue;}let _0x165474=_0x37a79d[_0x1eb3ac(0x206)][_0x1eb3ac(0x1bf)](),_0x11e10c=new TextDecoder(),_0x55f1b7='';while(!0x0){let {done:_0x3b13e6,value:_0x1ca109}=await _0x165474[_0x1eb3ac(0x1be)]();if(_0x3b13e6)break;_0x55f1b7+=_0x11e10c['decode'](_0x1ca109,{'stream':!0x0});let _0x500d6f=_0x55f1b7[_0x1eb3ac(0x20e)]('\x0a\x0a');_0x55f1b7=_0x500d6f[_0x1eb3ac(0x203)]()||'';for(let _0x11b77a of _0x500d6f){let _0x3995a9=_0x11b77a['split']('\x0a')[_0x1eb3ac(0x1cd)](_0x1e1ddc=>_0x1e1ddc[_0x1eb3ac(0x1f3)](_0x1eb3ac(0x208)));if(!_0x3995a9)continue;try{let _0x3dc0bb=JSON[_0x1eb3ac(0x196)](_0x3995a9[_0x1eb3ac(0x194)](0x6));await u(_0x3dc0bb);}catch(_0x170001){Y('parse\x20error:\x20'+_0x170001);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x48391a){Y(_0x1eb3ac(0x18f)+_0x48391a);}await h(0xbb8);}}async function u(_0x114523){const _0x2526e8=a0_0x3f9457;if(_0x114523[_0x2526e8(0x1d9)]==='connected'){Y(_0x2526e8(0x20a)+Z+'\x22');return;}if(_0x114523[_0x2526e8(0x1d9)]==='new_message'){if(Y(_0x2526e8(0x195)+_0x114523[_0x2526e8(0x1e3)]+':\x20'+_0x114523['message']['slice'](0x0,0x3c)),await K[_0x2526e8(0x1c2)]({'method':'notifications/claude/channel','params':{'content':_0x114523['message'],'meta':{'sender':_0x114523[_0x2526e8(0x1e3)]||'hub','sender_id':'commhub','user':_0x114523[_0x2526e8(0x1e3)]||_0x2526e8(0x1c8),'priority':_0x2526e8(0x1b7)}}}),_0x114523['message_id'])await P(_0x2526e8(0x1ef),{'alias':Z,'message_id':_0x114523[_0x2526e8(0x207)]});return;}if(_0x114523[_0x2526e8(0x1d9)]===_0x2526e8(0x1e4)||_0x114523['type']==='broadcast'){Y('←\x20'+_0x114523['type']+_0x2526e8(0x1ae)+_0x114523[_0x2526e8(0x189)]+_0x2526e8(0x1f4)+(_0x114523[_0x2526e8(0x1eb)]||_0x2526e8(0x1b7)));let _0x3ea452=await P(_0x2526e8(0x18b),{'alias':Z,'limit':0x5});if(_0x3ea452?.['ok']&&_0x3ea452[_0x2526e8(0x1ee)]?.[_0x2526e8(0x1d4)]>0x0)for(let _0x2a01fe of _0x3ea452['messages']){let _0x1d8775={'sender':_0x2a01fe[_0x2526e8(0x1fe)]||'hub','sender_id':_0x2526e8(0x1e6),'user':_0x2a01fe[_0x2526e8(0x1fe)]||_0x2526e8(0x1c8),'task_id':_0x2a01fe['id'],'priority':_0x2a01fe[_0x2526e8(0x1eb)]||_0x2526e8(0x1b7)};k[_0x2526e8(0x187)](_0x2a01fe['id'],_0x2a01fe[_0x2526e8(0x1fe)]||_0x2526e8(0x1c8)),await K[_0x2526e8(0x1c2)]({'method':_0x2526e8(0x202),'params':{'content':_0x2a01fe[_0x2526e8(0x1ac)],'meta':_0x1d8775}}),Y(_0x2526e8(0x20c)+_0x2a01fe['id'][_0x2526e8(0x194)](0x0,0x8)+_0x2526e8(0x1e1)+_0x2a01fe[_0x2526e8(0x1fe)]+':\x20'+_0x2a01fe[_0x2526e8(0x1ac)][_0x2526e8(0x194)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x2a01fe['id']});}}}function a0_0x2e54(_0x2ba69e,_0x42d34f){_0x2ba69e=_0x2ba69e-0x186;const _0x567c50=a0_0x567c();let _0x2e54b9=_0x567c50[_0x2ba69e];return _0x2e54b9;}async function S(){const _0x3104b1=a0_0x3f9457;let _0x4844c0=new a0_0x413c4a();await K['connect'](_0x4844c0),Y('MCP\x20stdio\x20connected'),Y(_0x3104b1(0x1a5)),v()[_0x3104b1(0x1ed)](_0x32c776=>Y(_0x3104b1(0x1da)+_0x32c776)),P(_0x3104b1(0x1b0),{'resume_id':w,'alias':Z,'status':_0x3104b1(0x201),'server':a0_0x18189b(),'hostname':a0_0x18189b(),'agent':_0x3104b1(0x1f0),'project_dir':process[_0x3104b1(0x19a)](),'tmux_name':f||void 0x0})[_0x3104b1(0x1b9)](()=>Y(_0x3104b1(0x1b6)+Z+_0x3104b1(0x198)+w[_0x3104b1(0x194)](0x0,0x8)+')'))['catch'](_0x399822=>Y(_0x3104b1(0x1e9)+_0x399822)),setInterval(()=>{const _0x5185e4=_0x3104b1;P(_0x5185e4(0x1b0),{'resume_id':w,'alias':Z,'status':_0x5185e4(0x201),'server':a0_0x18189b(),'hostname':a0_0x18189b(),'agent':_0x5185e4(0x1f0),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})['catch'](_0x3f8a6d=>Y(_0x5185e4(0x1ad)+_0x3f8a6d));},0x2bf20),Y(_0x3104b1(0x1b3));}S()[a0_0x3f9457(0x1ed)](_0x5381bc=>{const _0xe3a58d=a0_0x3f9457;Y(_0xe3a58d(0x1cc)+_0x5381bc),process[_0xe3a58d(0x1d5)](0x1);});async function N(){const _0x4e50f5=a0_0x3f9457;Y('shutting\x20down,\x20reporting\x20offline...'),await P('report_status',{'resume_id':w,'alias':Z,'status':'error','task':'session\x20disconnected'})['catch'](()=>{}),process[_0x4e50f5(0x1d5)](0x0);}process[a0_0x3f9457(0x1d7)]['on'](a0_0x3f9457(0x1e2),()=>N()),process['on'](a0_0x3f9457(0x1fa),()=>N()),process['on'](a0_0x3f9457(0x197),()=>N());
2
+ const a0_0x454245=a0_0x27be;function a0_0x5c20(){const _0x9de0d6=['POST','MCP\x20stdio\x20connected','init\x20failed:\x20','SIGTERM','\x20CWD=','indexOf','2hneSLQ','new_task','slice','6770lsXhPL','from_session','registered\x20as\x20\x22','starting\x20SSE\x20listener...','normal','config.json','commhub_reply','commhub_send_message','notifications/claude/channel','SSE\x20connected\x20as\x20\x22','cwd','ENV:\x20URL=','messages','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','exit','set','fatal:\x20','commhub','5128088uuLyCo','number','result','commhub_report_status','Task\x20content','status',':\x20inbox_count=','heartbeat\x20failed:\x20','2025-03-26','→\x20injected\x20task\x20','send_reply','get_inbox','token','idle','task','session\x20disconnected','commhub_get_all_status','text','Bearer\x20','message_id','setRequestHandler','commhub-channel','cancelled','unknown\x20tool','commhub_send_task','find','params','utf-8','failed','CommHub\x20init\x20failed:\x20','.env','parse\x20error:\x20','\x20RESUME_ID=','connecting\x20to\x20','error','7440qKqsCZ','toTimeString','/events/','40596908LEaqjz','data:\x20','completed','stderr','content','\x20from\x20','message','SSE\x20connection\x20error:\x20','blocked','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','no\x20response','claude-code','0.3.0','356GIogoQ','12YVNySU','randomUUID','2.0','\x20ALIAS=','application/json','shutting\x20down,\x20reporting\x20offline...','report_status','.anet','Message\x20content','initialize','object','\x22\x20(','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','parse','2135421KvKMhD','\x20priority=','new_message','in_progress','Authorization','replace','Target\x20session\x20alias','inbox_count','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','/mcp','40erUIgW','alias','write','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','application/json,\x20text/event-stream','connect','low','826328QGgAGr','startsWith','read','catch','.claude/channels/commhub','send_message','broadcast','statusText','SSE\x20fatal:\x20','body','from','string','ack_inbox','←\x20message\x20from\x20',']\x20[commhub]\x20','trim','type','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','stringify','get_all_status','http://127.0.0.1:9200','Progress\x200-100','notification','13179JAcapb','delete','Priority\x20(default:\x20normal)','getReader','hub','split','priority','connected','send_task','get','join','replied','940233cJqMjj','pop','tools/call','none','\x20PROJECT_ENV=','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>'];a0_0x5c20=function(){return _0x9de0d6;};return a0_0x5c20();}(function(_0x14549f,_0x3c7b33){const _0xb4dfad=a0_0x27be,_0x1df8ee=_0x14549f();while(!![]){try{const _0xcb7a7a=-parseInt(_0xb4dfad(0x1f5))/0x1*(-parseInt(_0xb4dfad(0x201))/0x2)+parseInt(_0xb4dfad(0x1e9))/0x3*(-parseInt(_0xb4dfad(0x1b2))/0x4)+-parseInt(_0xb4dfad(0x16c))/0x5*(parseInt(_0xb4dfad(0x1a1))/0x6)+-parseInt(_0xb4dfad(0x17e))/0x7+parseInt(_0xb4dfad(0x1d2))/0x8+-parseInt(_0xb4dfad(0x1c1))/0x9*(parseInt(_0xb4dfad(0x1cb))/0xa)+parseInt(_0xb4dfad(0x1a4))/0xb*(parseInt(_0xb4dfad(0x1b3))/0xc);if(_0xcb7a7a===_0x3c7b33)break;else _0x1df8ee['push'](_0x1df8ee['shift']());}catch(_0x4a925f){_0x1df8ee['push'](_0x1df8ee['shift']());}}}(a0_0x5c20,0xefe1b));import{readFileSync as a0_0x3cee0a,existsSync as a0_0x3f9ba0}from'fs';import{join as a0_0x1fbe01}from'path';import{hostname as a0_0x1bcb26}from'os';import{execSync as a0_0x65c4b5}from'child_process';import{Server as a0_0x4cddc7}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x43af36}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x1c7feb,CallToolRequestSchema as a0_0x36df87}from'@modelcontextprotocol/sdk/types.js';function a0_0x27be(_0x1128c3,_0x1ca38b){_0x1128c3=_0x1128c3-0x16a;const _0x5c20f8=a0_0x5c20();let _0x27be02=_0x5c20f8[_0x1128c3];return _0x27be02;}function p(_0x2dffad){const _0x477969=a0_0x27be;if(!a0_0x3f9ba0(_0x2dffad))return;for(let _0x4e2cc3 of a0_0x3cee0a(_0x2dffad,_0x477969(0x199))[_0x477969(0x1ee)]('\x0a')){let _0x3cab64=_0x4e2cc3[_0x477969(0x1e1)]();if(!_0x3cab64||_0x3cab64['startsWith']('#'))continue;let _0x484aff=_0x3cab64[_0x477969(0x200)]('=');if(_0x484aff<0x0)continue;let _0x50d6f8=_0x3cab64['slice'](0x0,_0x484aff)[_0x477969(0x1e1)](),_0x4c78c5=_0x3cab64[_0x477969(0x16b)](_0x484aff+0x1)[_0x477969(0x1e1)]()[_0x477969(0x1c6)](/^["']|["']$/g,'');if(!process.env[_0x50d6f8])process.env[_0x50d6f8]=_0x4c78c5;}}var C=process.env.HOME||'~',T=a0_0x1fbe01(C,a0_0x454245(0x1d6));p(a0_0x1fbe01(T,'.env'));var L=process['cwd']()[a0_0x454245(0x1c6)](/\//g,'-');p(a0_0x1fbe01(T,L,a0_0x454245(0x19c)));function U(){const _0x90d0c5=a0_0x454245;try{return a0_0x65c4b5(_0x90d0c5(0x1ae),{'encoding':_0x90d0c5(0x199),'timeout':0x7d0})[_0x90d0c5(0x1e1)]();}catch{return'';}}function c(){const _0x35f196=a0_0x454245;try{let _0x2a198c=a0_0x1fbe01(C,_0x35f196(0x1ba),_0x35f196(0x171));if(a0_0x3f9ba0(_0x2a198c))return JSON[_0x35f196(0x1c0)](a0_0x3cee0a(_0x2a198c,_0x35f196(0x199)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x454245(0x1ed)]||a0_0x454245(0x1e6),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x1bcb26(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x454245(0x1b4)](),X=process.env.COMMHUB_TOKEN||H[a0_0x454245(0x18a)]||'';function Y(_0xe83464){const _0x27c2e0=a0_0x454245;let _0x47dc71=new Date()[_0x27c2e0(0x1a2)]()[_0x27c2e0(0x16b)](0x0,0x8);process[_0x27c2e0(0x1a7)][_0x27c2e0(0x1cd)]('['+_0x47dc71+_0x27c2e0(0x1e0)+_0xe83464+'\x0a');}function h(_0x314013){return new Promise(_0x262fad=>setTimeout(_0x262fad,_0x314013));}Y(a0_0x454245(0x177)+D+a0_0x454245(0x1b6)+Z+a0_0x454245(0x19e)+w['slice'](0x0,0x8)+'...\x20TMUX='+(f||a0_0x454245(0x1f8))+a0_0x454245(0x1ff)+process[a0_0x454245(0x176)]()+a0_0x454245(0x1f9)+L);var k=new Map(),K=new a0_0x4cddc7({'name':a0_0x454245(0x193),'version':a0_0x454245(0x1b1)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x454245(0x1fa),a0_0x454245(0x1e3),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x454245(0x179),'Session\x20alias:\x20'+Z][a0_0x454245(0x1f3)]('\x0a')});K[a0_0x454245(0x192)](a0_0x1c7feb,async()=>({'tools':[{'name':a0_0x454245(0x172),'description':a0_0x454245(0x1bf),'inputSchema':{'type':a0_0x454245(0x1bd),'properties':{'task_id':{'type':a0_0x454245(0x1dd),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x454245(0x1dd),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':'string','enum':['completed',a0_0x454245(0x19a),a0_0x454245(0x194),a0_0x454245(0x1ac),a0_0x454245(0x1a0),a0_0x454245(0x1c4)],'description':a0_0x454245(0x1ce)}},'required':[a0_0x454245(0x18f)]}},{'name':a0_0x454245(0x181),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x454245(0x1bd),'properties':{'status':{'type':a0_0x454245(0x1dd),'enum':['working',a0_0x454245(0x18b),a0_0x454245(0x1ac),a0_0x454245(0x1a0)]},'task':{'type':a0_0x454245(0x1dd),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x454245(0x17f),'description':a0_0x454245(0x1e7)}},'required':['status']}},{'name':a0_0x454245(0x196),'description':a0_0x454245(0x1c9),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x454245(0x1dd),'description':a0_0x454245(0x1c7)},'task':{'type':a0_0x454245(0x1dd),'description':a0_0x454245(0x182)},'priority':{'type':a0_0x454245(0x1dd),'enum':['high',a0_0x454245(0x170),a0_0x454245(0x1d1)],'description':a0_0x454245(0x1eb)}},'required':[a0_0x454245(0x1cc),a0_0x454245(0x18c)]}},{'name':a0_0x454245(0x173),'description':a0_0x454245(0x1ad),'inputSchema':{'type':a0_0x454245(0x1bd),'properties':{'alias':{'type':a0_0x454245(0x1dd),'description':a0_0x454245(0x1c7)},'message':{'type':'string','description':a0_0x454245(0x1bb)}},'required':['alias',a0_0x454245(0x1aa)]}},{'name':a0_0x454245(0x18e),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x454245(0x1bd),'properties':{}}}]}));async function P(_0x39be93,_0xb44c1f){const _0x46f09d=a0_0x454245;let _0x2397e0=await fetch(D+_0x46f09d(0x1ca),{'method':_0x46f09d(0x1fb),'headers':{'Content-Type':_0x46f09d(0x1b7),'Accept':_0x46f09d(0x1cf),...X?{'Authorization':_0x46f09d(0x190)+X}:{}},'body':JSON[_0x46f09d(0x1e4)]({'jsonrpc':_0x46f09d(0x1b5),'id':0x1,'method':_0x46f09d(0x1bc),'params':{'protocolVersion':_0x46f09d(0x186),'capabilities':{},'clientInfo':{'name':_0x46f09d(0x193),'version':_0x46f09d(0x1b1)}}})});if(!_0x2397e0['ok']){let _0x31e199=await _0x2397e0['text']();return Y(_0x46f09d(0x19b)+_0x2397e0[_0x46f09d(0x183)]+'\x20'+_0x31e199['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x46f09d(0x1fd)+_0x2397e0[_0x46f09d(0x183)]};}await _0x2397e0[_0x46f09d(0x18f)]();let _0x37e4d8=(await(await fetch(D+'/mcp',{'method':'POST','headers':{'Content-Type':_0x46f09d(0x1b7),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x46f09d(0x190)+X}:{}},'body':JSON[_0x46f09d(0x1e4)]({'jsonrpc':_0x46f09d(0x1b5),'id':0x2,'method':_0x46f09d(0x1f7),'params':{'name':_0x39be93,'arguments':_0xb44c1f}})}))[_0x46f09d(0x18f)]())[_0x46f09d(0x1ee)]('\x0a')[_0x46f09d(0x197)](_0x56a445=>_0x56a445[_0x46f09d(0x1d3)](_0x46f09d(0x1a5)));if(_0x37e4d8){let _0x36f245=JSON[_0x46f09d(0x1c0)](_0x37e4d8['slice'](0x6));return _0x36f245?.[_0x46f09d(0x180)]?.[_0x46f09d(0x1a8)]?.[0x0]?.[_0x46f09d(0x18f)]?JSON[_0x46f09d(0x1c0)](_0x36f245[_0x46f09d(0x180)]['content'][0x0][_0x46f09d(0x18f)]):_0x36f245;}return{'ok':!0x1,'error':_0x46f09d(0x1af)};}K[a0_0x454245(0x192)](a0_0x36df87,async _0x18d777=>{const _0x251b0b=a0_0x454245;let {name:_0x3ddab8,arguments:_0xde7746}=_0x18d777[_0x251b0b(0x198)];if(_0x3ddab8===_0x251b0b(0x172)){let {task_id:_0x497477,text:_0x5b3d2b,status:_0x1eba7a}=_0xde7746;if(_0x1eba7a===_0x251b0b(0x1a6)||_0x1eba7a==='failed'||_0x1eba7a==='cancelled'){let _0x3b5308=_0x1eba7a===_0x251b0b(0x1a6)?_0x251b0b(0x1f4):_0x1eba7a,_0x2a7841=_0x497477?k[_0x251b0b(0x1f2)](_0x497477)||_0x251b0b(0x1ed):_0x251b0b(0x1ed),_0x42aa87=await P(_0x251b0b(0x188),{'alias':_0x2a7841,'text':_0x5b3d2b,'in_reply_to':_0x497477||void 0x0,'status':_0x3b5308,'from_session':Z});if(_0x497477)k[_0x251b0b(0x1ea)](_0x497477);return{'content':[{'type':_0x251b0b(0x18f),'text':JSON[_0x251b0b(0x1e4)](_0x42aa87)}]};}let _0xa7ae85=await P(_0x251b0b(0x1b9),{'resume_id':w,'alias':Z,'status':_0x1eba7a===_0x251b0b(0x1ac)?_0x251b0b(0x1ac):_0x1eba7a===_0x251b0b(0x1a0)?_0x251b0b(0x1a0):'working','task':_0x5b3d2b[_0x251b0b(0x16b)](0x0,0xc8),'output':_0x5b3d2b});return{'content':[{'type':_0x251b0b(0x18f),'text':JSON[_0x251b0b(0x1e4)](_0xa7ae85)}]};}if(_0x3ddab8===_0x251b0b(0x181)){let {status:_0x4fbc0c,task:_0x5a8424,progress:_0x369771}=_0xde7746,_0x3798cf=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x4fbc0c,'task':_0x5a8424,'progress':_0x369771});return{'content':[{'type':'text','text':JSON['stringify'](_0x3798cf)}]};}if(_0x3ddab8===_0x251b0b(0x196)){let {alias:_0x4d9b65,task:_0x22f8fa,priority:_0x350375}=_0xde7746,_0x1f165e=await P(_0x251b0b(0x1f1),{'alias':_0x4d9b65,'task':_0x22f8fa,'priority':_0x350375||'normal','from_session':Z});return{'content':[{'type':_0x251b0b(0x18f),'text':JSON[_0x251b0b(0x1e4)](_0x1f165e)}]};}if(_0x3ddab8==='commhub_send_message'){let {alias:_0x1c8640,message:_0x277dae}=_0xde7746,_0xa6e078=await P(_0x251b0b(0x1d7),{'alias':_0x1c8640,'message':_0x277dae,'from_session':Z});return{'content':[{'type':_0x251b0b(0x18f),'text':JSON[_0x251b0b(0x1e4)](_0xa6e078)}]};}if(_0x3ddab8==='commhub_get_all_status'){let _0x471b7e=await P(_0x251b0b(0x1e5),{});return{'content':[{'type':_0x251b0b(0x18f),'text':JSON[_0x251b0b(0x1e4)](_0x471b7e)}]};}return{'content':[{'type':'text','text':JSON['stringify']({'error':_0x251b0b(0x195)})}]};});async function v(){const _0x311c99=a0_0x454245;let _0x5cf95f=D+_0x311c99(0x1a3)+encodeURIComponent(Z),_0x5f01db={};if(X)_0x5f01db[_0x311c99(0x1c5)]='Bearer\x20'+X;Y(_0x311c99(0x19f)+_0x5cf95f);while(!0x0){try{let _0x17b0fc=await fetch(_0x5cf95f,{'headers':_0x5f01db});if(!_0x17b0fc['ok']){Y('SSE\x20error:\x20'+_0x17b0fc[_0x311c99(0x183)]+'\x20'+_0x17b0fc[_0x311c99(0x1d9)]),await h(0x1388);continue;}let _0x636b2d=_0x17b0fc[_0x311c99(0x1db)][_0x311c99(0x1ec)](),_0x4808f3=new TextDecoder(),_0xd3cc28='';while(!0x0){let {done:_0x2bab4d,value:_0x8eea9c}=await _0x636b2d[_0x311c99(0x1d4)]();if(_0x2bab4d)break;_0xd3cc28+=_0x4808f3['decode'](_0x8eea9c,{'stream':!0x0});let _0x446a36=_0xd3cc28[_0x311c99(0x1ee)]('\x0a\x0a');_0xd3cc28=_0x446a36[_0x311c99(0x1f6)]()||'';for(let _0x104f55 of _0x446a36){let _0x5bb02b=_0x104f55['split']('\x0a')['find'](_0x525ba0=>_0x525ba0[_0x311c99(0x1d3)](_0x311c99(0x1a5)));if(!_0x5bb02b)continue;try{let _0xec5e54=JSON[_0x311c99(0x1c0)](_0x5bb02b[_0x311c99(0x16b)](0x6));await u(_0xec5e54);}catch(_0x101b54){Y(_0x311c99(0x19d)+_0x101b54);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x2c6ae3){Y(_0x311c99(0x1ab)+_0x2c6ae3);}await h(0xbb8);}}async function u(_0x7a4bea){const _0x52029b=a0_0x454245;if(_0x7a4bea[_0x52029b(0x1e2)]===_0x52029b(0x1f0)){Y(_0x52029b(0x175)+Z+'\x22');return;}if(_0x7a4bea[_0x52029b(0x1e2)]===_0x52029b(0x1c3)){if(Y(_0x52029b(0x1df)+_0x7a4bea[_0x52029b(0x1dc)]+':\x20'+_0x7a4bea['message'][_0x52029b(0x16b)](0x0,0x3c)),await K[_0x52029b(0x1e8)]({'method':_0x52029b(0x174),'params':{'content':_0x7a4bea['message'],'meta':{'sender':_0x7a4bea[_0x52029b(0x1dc)]||_0x52029b(0x1ed),'sender_id':_0x52029b(0x17d),'user':_0x7a4bea['from']||_0x52029b(0x1ed),'priority':_0x52029b(0x170)}}}),_0x7a4bea[_0x52029b(0x191)])await P(_0x52029b(0x1de),{'alias':Z,'message_id':_0x7a4bea[_0x52029b(0x191)]});return;}if(_0x7a4bea['type']===_0x52029b(0x16a)||_0x7a4bea[_0x52029b(0x1e2)]===_0x52029b(0x1d8)){Y('←\x20'+_0x7a4bea[_0x52029b(0x1e2)]+_0x52029b(0x184)+_0x7a4bea[_0x52029b(0x1c8)]+_0x52029b(0x1c2)+(_0x7a4bea[_0x52029b(0x1ef)]||'normal'));let _0x389b3f=await P(_0x52029b(0x189),{'alias':Z,'limit':0x5});if(_0x389b3f?.['ok']&&_0x389b3f[_0x52029b(0x178)]?.['length']>0x0)for(let _0x340b95 of _0x389b3f['messages']){let _0xe206c4={'sender':_0x340b95[_0x52029b(0x16d)]||_0x52029b(0x1ed),'sender_id':'commhub','user':_0x340b95['from_session']||_0x52029b(0x1ed),'task_id':_0x340b95['id'],'priority':_0x340b95[_0x52029b(0x1ef)]||'normal'};k[_0x52029b(0x17b)](_0x340b95['id'],_0x340b95['from_session']||'hub'),await K['notification']({'method':_0x52029b(0x174),'params':{'content':_0x340b95[_0x52029b(0x1a8)],'meta':_0xe206c4}}),Y(_0x52029b(0x187)+_0x340b95['id']['slice'](0x0,0x8)+_0x52029b(0x1a9)+_0x340b95[_0x52029b(0x16d)]+':\x20'+_0x340b95['content'][_0x52029b(0x16b)](0x0,0x3c)),await P(_0x52029b(0x1de),{'alias':Z,'message_id':_0x340b95['id']});}}}async function S(){const _0x3495df=a0_0x454245;let _0x71c68=new a0_0x43af36();await K[_0x3495df(0x1d0)](_0x71c68),Y(_0x3495df(0x1fc)),Y(_0x3495df(0x16f)),v()[_0x3495df(0x1d5)](_0x4f133e=>Y(_0x3495df(0x1da)+_0x4f133e)),P(_0x3495df(0x1b9),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x1bcb26(),'hostname':a0_0x1bcb26(),'agent':_0x3495df(0x1b0),'project_dir':process[_0x3495df(0x176)](),'tmux_name':f||void 0x0})['then'](()=>Y(_0x3495df(0x16e)+Z+_0x3495df(0x1be)+w['slice'](0x0,0x8)+')'))[_0x3495df(0x1d5)](_0x212314=>Y('warning:\x20could\x20not\x20register:\x20'+_0x212314)),setInterval(()=>{const _0x3ac5f3=_0x3495df;P(_0x3ac5f3(0x1b9),{'resume_id':w,'alias':Z,'status':_0x3ac5f3(0x18b),'server':a0_0x1bcb26(),'hostname':a0_0x1bcb26(),'agent':_0x3ac5f3(0x1b0),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x3ac5f3(0x1d5)](_0x4f2b92=>Y(_0x3ac5f3(0x185)+_0x4f2b92));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}S()['catch'](_0x18bf3e=>{const _0x242c0c=a0_0x454245;Y(_0x242c0c(0x17c)+_0x18bf3e),process[_0x242c0c(0x17a)](0x1);});async function N(){const _0x13cd29=a0_0x454245;Y(_0x13cd29(0x1b8)),await P(_0x13cd29(0x1b9),{'resume_id':w,'alias':Z,'status':'error','task':_0x13cd29(0x18d)})['catch'](()=>{}),process[_0x13cd29(0x17a)](0x0);}process['stdin']['on']('end',()=>N()),process['on'](a0_0x454245(0x1fe),()=>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.17",
3
+ "version": "2.0.0-preview.18",
4
4
  "description": "AI Agent Network — Server + Client + Setup in one package. SSE real-time communication for multi-agent orchestration.",
5
5
  "type": "module",
6
6
  "main": "dist/src/client.js",