@sleep2agi/agent-network 2.1.8-preview.4 → 2.1.8-preview.5

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_0x47f495=a0_0x1b17;(function(_0x43cb3a,_0x318107){const _0x56b027=a0_0x1b17,_0x43ee57=_0x43cb3a();while(!![]){try{const _0x343896=parseInt(_0x56b027(0x19c))/0x1*(-parseInt(_0x56b027(0x14c))/0x2)+-parseInt(_0x56b027(0x17e))/0x3+parseInt(_0x56b027(0x187))/0x4+-parseInt(_0x56b027(0x17c))/0x5+-parseInt(_0x56b027(0x167))/0x6*(-parseInt(_0x56b027(0x180))/0x7)+parseInt(_0x56b027(0x191))/0x8*(parseInt(_0x56b027(0x185))/0x9)+parseInt(_0x56b027(0x156))/0xa;if(_0x343896===_0x318107)break;else _0x43ee57['push'](_0x43ee57['shift']());}catch(_0x31771d){_0x43ee57['push'](_0x43ee57['shift']());}}}(a0_0x55b9,0xaca19));import{EventEmitter as a0_0x3019ba}from'events';function a0_0x55b9(){const _0x3640a5=['type','2547508YeeHvD','processInbox','resumeId','heartbeatTimer','inbox\x20error:\x20','get_inbox','toTimeString','broadcast','send_reply','replace','200eutiIj','status','running','get_all_status','call','SSE\x20connected','AbortError','content','/events/','completed','disconnected','28imFclp','catch','ack_inbox','reply','slice','SSE\x20reconnecting\x20in\x20','send_message','signal','token','autoConnect','47756EZSgCz',']\x20[commhub:','sseAbort','min','cwd','url','connected','new_task','application/json,\x20text/event-stream','read','3560160VCRUZi','body','sleep','text','agent','parse','decode','POST','Authorization','log','s...','getReader','connect','/mcp','idle','task','new_message','4792902nbAWBu','message','normal','registered','abort','offline','getAllStatus','pop','SSE\x20error:\x20','error','report_status','now','result','send','messages','Bearer\x20','server','heartbeatInterval','connectSSE','startsWith','SSE\x20failed:\x20','1837710hfMKnj','name','2290836MCQrEY','disconnect','7ZhtvHB','split','emit','reconnectDelay','alias','257445yNDArP'];a0_0x55b9=function(){return _0x3640a5;};return a0_0x55b9();}import{hostname as a0_0xfccdba}from'os';class T extends a0_0x3019ba{[a0_0x47f495(0x151)];[a0_0x47f495(0x184)];[a0_0x47f495(0x14a)];[a0_0x47f495(0x15a)];[a0_0x47f495(0x189)];['heartbeatInterval'];[a0_0x47f495(0x183)];[a0_0x47f495(0x18a)];[a0_0x47f495(0x14e)];[a0_0x47f495(0x193)]=!0x1;constructor(_0xe4a09b){const _0x484200=a0_0x47f495;super();if(this[_0x484200(0x151)]=_0xe4a09b[_0x484200(0x151)][_0x484200(0x190)](/\/$/,''),this[_0x484200(0x184)]=_0xe4a09b[_0x484200(0x184)],this[_0x484200(0x14a)]=_0xe4a09b[_0x484200(0x14a)],this['agent']=_0xe4a09b[_0x484200(0x15a)]||'sdk',this[_0x484200(0x189)]='sdk-'+_0xe4a09b[_0x484200(0x184)]+'-'+Date[_0x484200(0x172)]()['toString'](0x24),this['heartbeatInterval']=_0xe4a09b[_0x484200(0x178)]??0x2bf20,this[_0x484200(0x183)]=_0xe4a09b['reconnectDelay']??0xbb8,_0xe4a09b[_0x484200(0x14b)]!==!0x1)this[_0x484200(0x162)]();}[a0_0x47f495(0x15f)](_0x9cd167){const _0x512243=a0_0x47f495;console[_0x512243(0x15f)]('['+new Date()[_0x512243(0x18d)]()[_0x512243(0x146)](0x0,0x8)+_0x512243(0x14d)+this[_0x512243(0x184)]+']\x20'+_0x9cd167);}async[a0_0x47f495(0x195)](_0x39a66f,_0x1d8c30){const _0x1a8597=a0_0x47f495;let _0x3ce0e3={'Content-Type':'application/json','Accept':_0x1a8597(0x154)};if(this['token'])_0x3ce0e3[_0x1a8597(0x15e)]='Bearer\x20'+this[_0x1a8597(0x14a)];let _0x4177ac=await(await fetch(this['url']+_0x1a8597(0x163),{'method':_0x1a8597(0x15d),'headers':_0x3ce0e3,'body':JSON['stringify']({'jsonrpc':'2.0','id':Date[_0x1a8597(0x172)](),'method':'tools/call','params':{'name':_0x39a66f,'arguments':_0x1d8c30}})}))[_0x1a8597(0x159)](),_0xeca6b=_0x4177ac['match'](/data: (.+)/),_0xf87d31=_0xeca6b?JSON[_0x1a8597(0x15b)](_0xeca6b[0x1]):JSON['parse'](_0x4177ac),_0x4ae6f7=_0xf87d31?.[_0x1a8597(0x173)]?.[_0x1a8597(0x198)]?.[0x0]?.[_0x1a8597(0x159)];return _0x4ae6f7?JSON[_0x1a8597(0x15b)](_0x4ae6f7):_0xf87d31;}async[a0_0x47f495(0x162)](){const _0x406a23=a0_0x47f495;if(this[_0x406a23(0x193)])return;this['running']=!0x0,await this[_0x406a23(0x192)](_0x406a23(0x164)),this['log'](_0x406a23(0x16a)),this['heartbeatTimer']=setInterval(()=>{const _0x59250=_0x406a23;this[_0x59250(0x192)](_0x59250(0x164))[_0x59250(0x19d)](_0x1b4bba=>this[_0x59250(0x15f)]('heartbeat\x20failed:\x20'+_0x1b4bba[_0x59250(0x168)]));},this[_0x406a23(0x178)]),this[_0x406a23(0x179)]();}async[a0_0x47f495(0x17f)](){const _0x9e949a=a0_0x47f495;if(this[_0x9e949a(0x193)]=!0x1,this[_0x9e949a(0x14e)]?.[_0x9e949a(0x16b)](),this['heartbeatTimer'])clearInterval(this['heartbeatTimer']);await this[_0x9e949a(0x192)](_0x9e949a(0x16c))[_0x9e949a(0x19d)](()=>{}),this[_0x9e949a(0x15f)](_0x9e949a(0x19b));}async[a0_0x47f495(0x174)](_0x41800e,_0x1651f6,_0x6b30a8=a0_0x47f495(0x169)){const _0xc6915c=a0_0x47f495;return this['call']('send_task',{'alias':_0x41800e,'task':_0x1651f6,'priority':_0x6b30a8,'from_session':this[_0xc6915c(0x184)]});}async[a0_0x47f495(0x168)](_0x350c60,_0x366fbe){const _0x1283a5=a0_0x47f495;return this[_0x1283a5(0x195)](_0x1283a5(0x148),{'alias':_0x350c60,'message':_0x366fbe,'from_session':this[_0x1283a5(0x184)]});}async[a0_0x47f495(0x145)](_0x469d97,_0x19b051,_0x4c2f3c=a0_0x47f495(0x19a)){const _0x190dde=a0_0x47f495;return this['call'](_0x190dde(0x18f),{'in_reply_to':_0x469d97,'text':_0x19b051,'status':_0x4c2f3c});}async[a0_0x47f495(0x192)](_0x2578e0,_0x2854ef){const _0x239786=a0_0x47f495;return this['call'](_0x239786(0x171),{'resume_id':this[_0x239786(0x189)],'alias':this['alias'],'status':_0x2578e0,'server':a0_0xfccdba(),'hostname':a0_0xfccdba(),'agent':this['agent'],'project_dir':process[_0x239786(0x150)](),..._0x2854ef});}async[a0_0x47f495(0x16d)](){const _0x50db2=a0_0x47f495;return this['call'](_0x50db2(0x194),{});}async[a0_0x47f495(0x18e)](_0x38d68b,_0x189175){const _0x554306=a0_0x47f495;return this['call'](_0x554306(0x18e),{'message':_0x38d68b,'filter_server':_0x189175?.[_0x554306(0x177)],'filter_status':_0x189175?.[_0x554306(0x192)]});}async[a0_0x47f495(0x179)](){const _0x38c824=a0_0x47f495;let _0x14aa54=encodeURIComponent(this[_0x38c824(0x184)]),_0x468f27=this[_0x38c824(0x151)]+_0x38c824(0x199)+_0x14aa54,_0x2f413b=this[_0x38c824(0x183)];while(this[_0x38c824(0x193)]){try{this[_0x38c824(0x14e)]=new AbortController();let _0x33a49d={'Accept':'text/event-stream'};if(this['token'])_0x33a49d[_0x38c824(0x15e)]=_0x38c824(0x176)+this[_0x38c824(0x14a)];let _0x1a77f2=await fetch(_0x468f27,{'headers':_0x33a49d,'signal':this[_0x38c824(0x14e)][_0x38c824(0x149)]});if(!_0x1a77f2['ok']||!_0x1a77f2[_0x38c824(0x157)]){this['log'](_0x38c824(0x17b)+_0x1a77f2[_0x38c824(0x192)]),await this[_0x38c824(0x158)](_0x2f413b),_0x2f413b=Math[_0x38c824(0x14f)](_0x2f413b*1.5,0xea60);continue;}_0x2f413b=this[_0x38c824(0x183)];let _0x3d3ee5=_0x1a77f2['body'][_0x38c824(0x161)](),_0x3a2e65=new TextDecoder(),_0x449bc3='';while(this[_0x38c824(0x193)]){let {done:_0xbcf5ff,value:_0x3aaba7}=await _0x3d3ee5[_0x38c824(0x155)]();if(_0xbcf5ff)break;_0x449bc3+=_0x3a2e65[_0x38c824(0x15c)](_0x3aaba7,{'stream':!0x0});let _0x5d888e=_0x449bc3[_0x38c824(0x181)]('\x0a');_0x449bc3=_0x5d888e[_0x38c824(0x16e)]()||'';for(let _0x4e019c of _0x5d888e){if(!_0x4e019c[_0x38c824(0x17a)]('data:\x20'))continue;try{let _0x596e42=JSON[_0x38c824(0x15b)](_0x4e019c[_0x38c824(0x146)](0x6));if(_0x596e42[_0x38c824(0x186)]===_0x38c824(0x152)){this['log'](_0x38c824(0x196)),this[_0x38c824(0x182)](_0x38c824(0x152));continue;}if(_0x596e42[_0x38c824(0x186)]===_0x38c824(0x153)||_0x596e42[_0x38c824(0x186)]===_0x38c824(0x166)||_0x596e42[_0x38c824(0x186)]===_0x38c824(0x18e))await this[_0x38c824(0x188)]();}catch{}}}}catch(_0x1f7eb7){if(_0x1f7eb7[_0x38c824(0x17d)]===_0x38c824(0x197))break;this[_0x38c824(0x182)](_0x38c824(0x170),_0x1f7eb7),this['log'](_0x38c824(0x16f)+_0x1f7eb7[_0x38c824(0x168)]);}if(this[_0x38c824(0x193)])this[_0x38c824(0x182)](_0x38c824(0x19b)),this[_0x38c824(0x15f)](_0x38c824(0x147)+_0x2f413b/0x3e8+_0x38c824(0x160)),await this[_0x38c824(0x158)](_0x2f413b),_0x2f413b=Math['min'](_0x2f413b*1.5,0xea60);}}async[a0_0x47f495(0x188)](){const _0x2c7687=a0_0x47f495;try{let _0x5b0cab=(await this[_0x2c7687(0x195)](_0x2c7687(0x18c),{'alias':this['alias'],'limit':0xa}))?.[_0x2c7687(0x175)]||[];for(let _0x185f31 of _0x5b0cab)await this[_0x2c7687(0x195)](_0x2c7687(0x19e),{'alias':this['alias'],'message_id':_0x185f31['id']}),this['log']('←\x20'+_0x185f31['from_session']+':\x20'+_0x185f31[_0x2c7687(0x198)][_0x2c7687(0x146)](0x0,0x3c)),this[_0x2c7687(0x182)](_0x2c7687(0x165),_0x185f31),this[_0x2c7687(0x182)](_0x2c7687(0x168),_0x185f31);}catch(_0x23205e){this[_0x2c7687(0x15f)](_0x2c7687(0x18b)+_0x23205e['message']);}}[a0_0x47f495(0x158)](_0x5bbc4d){return new Promise(_0x269252=>setTimeout(_0x269252,_0x5bbc4d));}}var $=T;function a0_0x1b17(_0x36df03,_0x5423a0){_0x36df03=_0x36df03-0x145;const _0x55b9c0=a0_0x55b9();let _0x1b17fe=_0x55b9c0[_0x36df03];return _0x1b17fe;}export{$ as default,T as CommHub};
1
+ const a0_0x5dc79c=a0_0x4301;(function(_0x10c6fa,_0x59e1a6){const _0x1957e8=a0_0x4301,_0x4b76cf=_0x10c6fa();while(!![]){try{const _0x19d3c0=-parseInt(_0x1957e8(0x163))/0x1*(-parseInt(_0x1957e8(0x147))/0x2)+parseInt(_0x1957e8(0x155))/0x3+parseInt(_0x1957e8(0x165))/0x4*(parseInt(_0x1957e8(0x120))/0x5)+parseInt(_0x1957e8(0x159))/0x6*(parseInt(_0x1957e8(0x14f))/0x7)+-parseInt(_0x1957e8(0x142))/0x8+parseInt(_0x1957e8(0x162))/0x9+-parseInt(_0x1957e8(0x13b))/0xa;if(_0x19d3c0===_0x59e1a6)break;else _0x4b76cf['push'](_0x4b76cf['shift']());}catch(_0x12d939){_0x4b76cf['push'](_0x4b76cf['shift']());}}}(a0_0x5d22,0xebc8d));import{EventEmitter as a0_0x3e8536}from'events';function a0_0x5d22(){const _0x7039fc=['result','tools/call','body','status','min','5tMzjCJ','broadcast','inbox\x20error:\x20','slice','from_session','SSE\x20reconnecting\x20in\x20','match','get_all_status','heartbeatTimer','sdk-','Bearer\x20','now','replace','sseAbort','getReader','send_message','s...','data:\x20','report_status','reconnectDelay','token','resumeId','AbortError','toTimeString','alias','emit','processInbox','36685480ZVYlgD','messages','heartbeat\x20failed:\x20','toString','read','agent','type','4719464rizHUZ','message','autoConnect','sdk','2.0','296156qLjeZz','idle','split','log','startsWith','error','heartbeatInterval','application/json','182UjrURN','send','get_inbox','url','running','stringify','466365oVXIFS','send_reply','name','offline','378006kXRbrk','call','abort','connectSSE','ack_inbox','new_task','sleep','registered','text','16544943niKiOC','8dBeyjA','catch','1631288PoHUCJ','connect','normal','server','/events/','new_message','parse','completed','disconnect','content','reply','connected','disconnected'];a0_0x5d22=function(){return _0x7039fc;};return a0_0x5d22();}import{hostname as a0_0x140ec7}from'os';function a0_0x4301(_0x8bcef,_0x40f219){_0x8bcef=_0x8bcef-0x11d;const _0x5d223d=a0_0x5d22();let _0x4301a0=_0x5d223d[_0x8bcef];return _0x4301a0;}class T extends a0_0x3e8536{[a0_0x5dc79c(0x152)];[a0_0x5dc79c(0x138)];['token'];[a0_0x5dc79c(0x140)];[a0_0x5dc79c(0x135)];[a0_0x5dc79c(0x14d)];[a0_0x5dc79c(0x133)];[a0_0x5dc79c(0x128)];[a0_0x5dc79c(0x12d)];['running']=!0x1;constructor(_0x4f5066){const _0x248b26=a0_0x5dc79c;super();if(this[_0x248b26(0x152)]=_0x4f5066['url'][_0x248b26(0x12c)](/\/$/,''),this[_0x248b26(0x138)]=_0x4f5066[_0x248b26(0x138)],this['token']=_0x4f5066[_0x248b26(0x134)],this['agent']=_0x4f5066[_0x248b26(0x140)]||_0x248b26(0x145),this[_0x248b26(0x135)]=_0x248b26(0x129)+_0x4f5066[_0x248b26(0x138)]+'-'+Date[_0x248b26(0x12b)]()[_0x248b26(0x13e)](0x24),this[_0x248b26(0x14d)]=_0x4f5066[_0x248b26(0x14d)]??0x2bf20,this[_0x248b26(0x133)]=_0x4f5066[_0x248b26(0x133)]??0xbb8,_0x4f5066[_0x248b26(0x144)]!==!0x1)this[_0x248b26(0x166)]();}[a0_0x5dc79c(0x14a)](_0x31778a){const _0x5646dc=a0_0x5dc79c;console[_0x5646dc(0x14a)]('['+new Date()[_0x5646dc(0x137)]()[_0x5646dc(0x123)](0x0,0x8)+']\x20[commhub:'+this[_0x5646dc(0x138)]+']\x20'+_0x31778a);}async[a0_0x5dc79c(0x15a)](_0x1fd20f,_0x4a59d5){const _0x5a5ab4=a0_0x5dc79c;let _0x54abb8={'Content-Type':_0x5a5ab4(0x14e),'Accept':'application/json,\x20text/event-stream'};if(this[_0x5a5ab4(0x134)])_0x54abb8['Authorization']=_0x5a5ab4(0x12a)+this[_0x5a5ab4(0x134)];let _0x2c4ead=await(await fetch(this[_0x5a5ab4(0x152)]+'/mcp',{'method':'POST','headers':_0x54abb8,'body':JSON[_0x5a5ab4(0x154)]({'jsonrpc':_0x5a5ab4(0x146),'id':Date[_0x5a5ab4(0x12b)](),'method':_0x5a5ab4(0x173),'params':{'name':_0x1fd20f,'arguments':_0x4a59d5}})}))[_0x5a5ab4(0x161)](),_0x49b561=_0x2c4ead[_0x5a5ab4(0x126)](/data: (.+)/),_0x2f1d64=_0x49b561?JSON[_0x5a5ab4(0x16b)](_0x49b561[0x1]):JSON[_0x5a5ab4(0x16b)](_0x2c4ead),_0x5b465c=_0x2f1d64?.[_0x5a5ab4(0x172)]?.[_0x5a5ab4(0x16e)]?.[0x0]?.[_0x5a5ab4(0x161)];return _0x5b465c?JSON[_0x5a5ab4(0x16b)](_0x5b465c):_0x2f1d64;}async[a0_0x5dc79c(0x166)](){const _0x9efd87=a0_0x5dc79c;if(this[_0x9efd87(0x153)])return;this[_0x9efd87(0x153)]=!0x0,await this[_0x9efd87(0x11e)](_0x9efd87(0x148)),this['log'](_0x9efd87(0x160)),this[_0x9efd87(0x128)]=setInterval(()=>{const _0x55c887=_0x9efd87;this['status'](_0x55c887(0x148))[_0x55c887(0x164)](_0x3fbc5e=>this['log'](_0x55c887(0x13d)+_0x3fbc5e[_0x55c887(0x143)]));},this['heartbeatInterval']),this[_0x9efd87(0x15c)]();}async[a0_0x5dc79c(0x16d)](){const _0x2bc3fa=a0_0x5dc79c;if(this[_0x2bc3fa(0x153)]=!0x1,this[_0x2bc3fa(0x12d)]?.[_0x2bc3fa(0x15b)](),this[_0x2bc3fa(0x128)])clearInterval(this[_0x2bc3fa(0x128)]);await this[_0x2bc3fa(0x11e)](_0x2bc3fa(0x158))['catch'](()=>{}),this[_0x2bc3fa(0x14a)](_0x2bc3fa(0x171));}async[a0_0x5dc79c(0x150)](_0x4180ea,_0xc140e0,_0x5dcb5b=a0_0x5dc79c(0x167)){const _0x4bfeef=a0_0x5dc79c;return this[_0x4bfeef(0x15a)]('send_task',{'alias':_0x4180ea,'task':_0xc140e0,'priority':_0x5dcb5b,'from_session':this['alias']});}async[a0_0x5dc79c(0x143)](_0x1434e0,_0x3bee5f){const _0x20c1af=a0_0x5dc79c;return this[_0x20c1af(0x15a)](_0x20c1af(0x12f),{'alias':_0x1434e0,'message':_0x3bee5f,'from_session':this[_0x20c1af(0x138)]});}async[a0_0x5dc79c(0x16f)](_0x1d3c0a,_0x1ca814,_0x424199=a0_0x5dc79c(0x16c)){const _0x2771cb=a0_0x5dc79c;return this[_0x2771cb(0x15a)](_0x2771cb(0x156),{'in_reply_to':_0x1d3c0a,'text':_0x1ca814,'status':_0x424199});}async[a0_0x5dc79c(0x11e)](_0x170bc8,_0x43cfe0){const _0x599c4f=a0_0x5dc79c;return this[_0x599c4f(0x15a)](_0x599c4f(0x132),{'resume_id':this[_0x599c4f(0x135)],'alias':this['alias'],'status':_0x170bc8,'server':a0_0x140ec7(),'hostname':a0_0x140ec7(),'agent':this['agent'],'project_dir':process['cwd'](),..._0x43cfe0});}async['getAllStatus'](){const _0x5f30a9=a0_0x5dc79c;return this[_0x5f30a9(0x15a)](_0x5f30a9(0x127),{});}async[a0_0x5dc79c(0x121)](_0x394364,_0x28a1d3){const _0x201c3c=a0_0x5dc79c;return this['call'](_0x201c3c(0x121),{'message':_0x394364,'filter_server':_0x28a1d3?.[_0x201c3c(0x168)],'filter_status':_0x28a1d3?.[_0x201c3c(0x11e)]});}async[a0_0x5dc79c(0x15c)](){const _0x3f0954=a0_0x5dc79c;let _0x400fe9=encodeURIComponent(this[_0x3f0954(0x138)]),_0x5eb832=this[_0x3f0954(0x152)]+_0x3f0954(0x169)+_0x400fe9,_0x3135f1=this[_0x3f0954(0x133)];while(this[_0x3f0954(0x153)]){try{this['sseAbort']=new AbortController();let _0x5bdad2={'Accept':'text/event-stream'};if(this[_0x3f0954(0x134)])_0x5bdad2['Authorization']=_0x3f0954(0x12a)+this[_0x3f0954(0x134)];let _0x57d941=await fetch(_0x5eb832,{'headers':_0x5bdad2,'signal':this['sseAbort']['signal']});if(!_0x57d941['ok']||!_0x57d941[_0x3f0954(0x11d)]){this[_0x3f0954(0x14a)]('SSE\x20failed:\x20'+_0x57d941[_0x3f0954(0x11e)]),await this[_0x3f0954(0x15f)](_0x3135f1),_0x3135f1=Math[_0x3f0954(0x11f)](_0x3135f1*1.5,0xea60);continue;}_0x3135f1=this[_0x3f0954(0x133)];let _0x758e50=_0x57d941[_0x3f0954(0x11d)][_0x3f0954(0x12e)](),_0x452889=new TextDecoder(),_0x52b9ef='';while(this[_0x3f0954(0x153)]){let {done:_0x425792,value:_0x5aaf12}=await _0x758e50[_0x3f0954(0x13f)]();if(_0x425792)break;_0x52b9ef+=_0x452889['decode'](_0x5aaf12,{'stream':!0x0});let _0x54744a=_0x52b9ef[_0x3f0954(0x149)]('\x0a');_0x52b9ef=_0x54744a['pop']()||'';for(let _0x3f4b57 of _0x54744a){if(!_0x3f4b57[_0x3f0954(0x14b)](_0x3f0954(0x131)))continue;try{let _0x54bf9d=JSON[_0x3f0954(0x16b)](_0x3f4b57[_0x3f0954(0x123)](0x6));if(_0x54bf9d[_0x3f0954(0x141)]==='connected'){this[_0x3f0954(0x14a)]('SSE\x20connected'),this[_0x3f0954(0x139)](_0x3f0954(0x170));continue;}if(_0x54bf9d[_0x3f0954(0x141)]===_0x3f0954(0x15e)||_0x54bf9d[_0x3f0954(0x141)]===_0x3f0954(0x16a)||_0x54bf9d[_0x3f0954(0x141)]===_0x3f0954(0x121))await this['processInbox']();}catch{}}}}catch(_0x201d4c){if(_0x201d4c[_0x3f0954(0x157)]===_0x3f0954(0x136))break;this['emit'](_0x3f0954(0x14c),_0x201d4c),this['log']('SSE\x20error:\x20'+_0x201d4c[_0x3f0954(0x143)]);}if(this[_0x3f0954(0x153)])this[_0x3f0954(0x139)](_0x3f0954(0x171)),this['log'](_0x3f0954(0x125)+_0x3135f1/0x3e8+_0x3f0954(0x130)),await this['sleep'](_0x3135f1),_0x3135f1=Math[_0x3f0954(0x11f)](_0x3135f1*1.5,0xea60);}}async[a0_0x5dc79c(0x13a)](){const _0x5827ff=a0_0x5dc79c;try{let _0x5d9967=(await this[_0x5827ff(0x15a)](_0x5827ff(0x151),{'alias':this[_0x5827ff(0x138)],'limit':0xa}))?.[_0x5827ff(0x13c)]||[];for(let _0x4bbcc9 of _0x5d9967)await this[_0x5827ff(0x15a)](_0x5827ff(0x15d),{'alias':this[_0x5827ff(0x138)],'message_id':_0x4bbcc9['id']}),this[_0x5827ff(0x14a)]('←\x20'+_0x4bbcc9[_0x5827ff(0x124)]+':\x20'+_0x4bbcc9[_0x5827ff(0x16e)][_0x5827ff(0x123)](0x0,0x3c)),this[_0x5827ff(0x139)]('task',_0x4bbcc9),this[_0x5827ff(0x139)](_0x5827ff(0x143),_0x4bbcc9);}catch(_0x36a609){this[_0x5827ff(0x14a)](_0x5827ff(0x122)+_0x36a609['message']);}}[a0_0x5dc79c(0x15f)](_0x741319){return new Promise(_0x1968d5=>setTimeout(_0x1968d5,_0x741319));}}var $=T;export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x219173=a0_0x31ef;(function(_0x41089f,_0x5a7f07){const _0x5b4f9a=a0_0x31ef,_0x24f0f8=_0x41089f();while(!![]){try{const _0x4e457d=parseInt(_0x5b4f9a(0x1e9))/0x1+-parseInt(_0x5b4f9a(0x1d6))/0x2*(parseInt(_0x5b4f9a(0x1e3))/0x3)+parseInt(_0x5b4f9a(0x175))/0x4+-parseInt(_0x5b4f9a(0x189))/0x5+-parseInt(_0x5b4f9a(0x1cd))/0x6+-parseInt(_0x5b4f9a(0x1b9))/0x7+parseInt(_0x5b4f9a(0x1a0))/0x8;if(_0x4e457d===_0x5a7f07)break;else _0x24f0f8['push'](_0x24f0f8['shift']());}catch(_0x2358d2){_0x24f0f8['push'](_0x24f0f8['shift']());}}}(a0_0x3fa0,0x68197));import{readFileSync as a0_0x523088,existsSync as a0_0x595911}from'fs';import{randomUUID as a0_0x383c4a}from'crypto';import{join as a0_0x56eb0e}from'path';import{hostname as a0_0xa56403}from'os';function a0_0x3fa0(){const _0x19b598=['string','new_message','from','object','\x20priority=','no\x20response','find','working','statusText','decode','Target\x20session\x20alias','cwd','notification','commhub_reply','failed','commhub_send_message','1700312esPyTZ','Session\x20alias:\x20','toTimeString','.anet','shutting\x20down,\x20reporting\x20offline...','ENV:\x20URL=','\x20CWD=','normal','MCP\x20stdio\x20connected','messages','SIGINT','idle','Bearer\x20','POST','parse\x20error:\x20','/mcp','Task\x20content','text','status','cancelled','2499135CoGHym','initialize','get','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','new_task','alias','Message\x20content','delete','catch','data:\x20','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','commhub_report_status','Reply\x20text\x20/\x20result\x20summary','connect','→\x20injected\x20task\x20',']\x20[commhub]\x20','high','task','ready\x20—\x20waiting\x20for\x20events','from_session','send_task','connected','indexOf','14444176ilqelV','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','blocked','commhub','send_reply','exit','\x20RESUME_ID=','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','body','.env','←\x20message\x20from\x20','slice','stderr','send_message','commhub_get_all_status','\x22\x20(','inbox_count','message_id','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','hub','SSE\x20fatal:\x20','then','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','config.json','1108758izeSfu','\x20from\x20','pop','claude-code','session\x20disconnected','ack_inbox','completed','stringify','commhub_send_task','2.0',':\x20inbox_count=','application/json,\x20text/event-stream','init\x20failed:\x20','none','unknown\x20tool','CommHub\x20init\x20failed:\x20','split','connecting\x20to\x20','parse','in_progress','3504474SxOSJL','type','error','content','replace','commhub-channel','\x20ALIAS=','startsWith','number','1381252YigeuN','0.3.0','SSE\x20stream\x20ended,\x20reconnecting...','.claude/channels/commhub','/events/','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','length','report_status','starting\x20SSE\x20listener...','low','application/json','heartbeat\x20failed:\x20','trim','3ntmliF','utf-8','Current\x20task\x20description','setRequestHandler','message','read','128717cLaYDn','Authorization','SSE\x20connection\x20error:\x20','get_inbox'];a0_0x3fa0=function(){return _0x19b598;};return a0_0x3fa0();}import{execSync as a0_0xa186c8}from'child_process';import{Server as a0_0x2445b2}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x31ef(_0x7e18b0,_0x5280ac){_0x7e18b0=_0x7e18b0-0x16d;const _0x3fa07d=a0_0x3fa0();let _0x31eff0=_0x3fa07d[_0x7e18b0];return _0x31eff0;}import{StdioServerTransport as a0_0x556996}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x573f22,CallToolRequestSchema as a0_0x2d024b}from'@modelcontextprotocol/sdk/types.js';function p(_0x8e74d6){const _0x3af491=a0_0x31ef;if(!a0_0x595911(_0x8e74d6))return;for(let _0x20f6bd of a0_0x523088(_0x8e74d6,_0x3af491(0x1e4))['split']('\x0a')){let _0x556fbd=_0x20f6bd[_0x3af491(0x1e2)]();if(!_0x556fbd||_0x556fbd[_0x3af491(0x1d4)]('#'))continue;let _0x121a15=_0x556fbd[_0x3af491(0x19f)]('=');if(_0x121a15<0x0)continue;let _0x3c836a=_0x556fbd[_0x3af491(0x1ac)](0x0,_0x121a15)[_0x3af491(0x1e2)](),_0x44863c=_0x556fbd['slice'](_0x121a15+0x1)['trim']()[_0x3af491(0x1d1)](/^["']|["']$/g,'');if(!process.env[_0x3c836a])process.env[_0x3c836a]=_0x44863c;}}var C=process.env.HOME||'~',T=a0_0x56eb0e(C,a0_0x219173(0x1d9));p(a0_0x56eb0e(T,a0_0x219173(0x1aa)));var L=process['cwd']()['replace'](/\//g,'-');p(a0_0x56eb0e(T,L,a0_0x219173(0x1aa)));function U(){const _0x1f9a97=a0_0x219173;try{return a0_0xa186c8('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x1f9a97(0x1e4),'timeout':0x7d0})[_0x1f9a97(0x1e2)]();}catch{return'';}}function v(){const _0x3dd65b=a0_0x219173;try{let _0x465f6f=a0_0x56eb0e(C,_0x3dd65b(0x178),_0x3dd65b(0x1b8));if(a0_0x595911(_0x465f6f))return JSON[_0x3dd65b(0x1cb)](a0_0x523088(_0x465f6f,_0x3dd65b(0x1e4)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x219173(0x1b4)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0xa56403(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x383c4a(),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x4b39b6){const _0xbe437d=a0_0x219173;let _0x57ee55=new Date()[_0xbe437d(0x177)]()[_0xbe437d(0x1ac)](0x0,0x8);process[_0xbe437d(0x1ad)]['write']('['+_0x57ee55+_0xbe437d(0x198)+_0x4b39b6+'\x0a');}function h(_0x5b9117){return new Promise(_0x240eca=>setTimeout(_0x240eca,_0x5b9117));}Y(a0_0x219173(0x17a)+f+a0_0x219173(0x1d3)+Z+a0_0x219173(0x1a7)+w[a0_0x219173(0x1ac)](0x0,0x8)+'...\x20TMUX='+(j||a0_0x219173(0x1c6))+a0_0x219173(0x17b)+process[a0_0x219173(0x170)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x2445b2({'name':a0_0x219173(0x1d2),'version':a0_0x219173(0x1d7)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x219173(0x18c),a0_0x219173(0x1b3),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x219173(0x193),a0_0x219173(0x176)+Z]['join']('\x0a')});K[a0_0x219173(0x1e6)](a0_0x573f22,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x219173(0x1a1),'inputSchema':{'type':a0_0x219173(0x1f0),'properties':{'task_id':{'type':a0_0x219173(0x1ed),'description':a0_0x219173(0x1a2)},'text':{'type':a0_0x219173(0x1ed),'description':a0_0x219173(0x195)},'status':{'type':a0_0x219173(0x1ed),'enum':[a0_0x219173(0x1bf),a0_0x219173(0x173),a0_0x219173(0x188),'blocked',a0_0x219173(0x1cf),a0_0x219173(0x1cc)],'description':a0_0x219173(0x1db)}},'required':[a0_0x219173(0x186)]}},{'name':a0_0x219173(0x194),'description':a0_0x219173(0x1a8),'inputSchema':{'type':a0_0x219173(0x1f0),'properties':{'status':{'type':a0_0x219173(0x1ed),'enum':[a0_0x219173(0x1f4),a0_0x219173(0x180),a0_0x219173(0x1a3),a0_0x219173(0x1cf)]},'task':{'type':a0_0x219173(0x1ed),'description':a0_0x219173(0x1e5)},'progress':{'type':a0_0x219173(0x1d5),'description':'Progress\x200-100'}},'required':[a0_0x219173(0x187)]}},{'name':a0_0x219173(0x1c1),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x219173(0x1f0),'properties':{'alias':{'type':a0_0x219173(0x1ed),'description':a0_0x219173(0x16f)},'task':{'type':a0_0x219173(0x1ed),'description':a0_0x219173(0x185)},'priority':{'type':a0_0x219173(0x1ed),'enum':[a0_0x219173(0x199),a0_0x219173(0x17c),a0_0x219173(0x1df)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x219173(0x18e),a0_0x219173(0x19a)]}},{'name':a0_0x219173(0x174),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x219173(0x1f0),'properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'message':{'type':a0_0x219173(0x1ed),'description':a0_0x219173(0x18f)}},'required':['alias','message']}},{'name':a0_0x219173(0x1af),'description':a0_0x219173(0x1b7),'inputSchema':{'type':a0_0x219173(0x1f0),'properties':{}}}]}));async function P(_0x7e0e09,_0x4b011c){const _0x46e319=a0_0x219173;let _0x11659d=await fetch(f+_0x46e319(0x184),{'method':_0x46e319(0x182),'headers':{'Content-Type':_0x46e319(0x1e0),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x46e319(0x181)+X}:{}},'body':JSON[_0x46e319(0x1c0)]({'jsonrpc':_0x46e319(0x1c2),'id':0x1,'method':_0x46e319(0x18a),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x46e319(0x1d2),'version':_0x46e319(0x1d7)}}})});if(!_0x11659d['ok']){let _0x5c1b24=await _0x11659d['text']();return Y(_0x46e319(0x1c8)+_0x11659d[_0x46e319(0x187)]+'\x20'+_0x5c1b24[_0x46e319(0x1ac)](0x0,0x64)),{'ok':!0x1,'error':_0x46e319(0x1c5)+_0x11659d['status']};}await _0x11659d[_0x46e319(0x186)]();let _0x3cb1bc=(await(await fetch(f+'/mcp',{'method':_0x46e319(0x182),'headers':{'Content-Type':_0x46e319(0x1e0),'Accept':_0x46e319(0x1c4),...X?{'Authorization':_0x46e319(0x181)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x46e319(0x1c2),'id':0x2,'method':'tools/call','params':{'name':_0x7e0e09,'arguments':_0x4b011c}})}))[_0x46e319(0x186)]())[_0x46e319(0x1c9)]('\x0a')['find'](_0xd8c0ce=>_0xd8c0ce[_0x46e319(0x1d4)](_0x46e319(0x192)));if(_0x3cb1bc){let _0x3785d2=JSON['parse'](_0x3cb1bc[_0x46e319(0x1ac)](0x6));return _0x3785d2?.['result']?.[_0x46e319(0x1d0)]?.[0x0]?.['text']?JSON[_0x46e319(0x1cb)](_0x3785d2['result']['content'][0x0][_0x46e319(0x186)]):_0x3785d2;}return{'ok':!0x1,'error':_0x46e319(0x1f2)};}K[a0_0x219173(0x1e6)](a0_0x2d024b,async _0x4d7f42=>{const _0x1cff39=a0_0x219173;let {name:_0x1fe59b,arguments:_0x416822}=_0x4d7f42['params'];if(_0x1fe59b===_0x1cff39(0x172)){let {task_id:_0x3074d0,text:_0x9475c0,status:_0xa1b6aa}=_0x416822;if(_0xa1b6aa===_0x1cff39(0x1bf)||_0xa1b6aa===_0x1cff39(0x173)||_0xa1b6aa===_0x1cff39(0x188)){let _0x101825=_0xa1b6aa===_0x1cff39(0x1bf)?'replied':_0xa1b6aa,_0x56c8a0=_0x3074d0?k[_0x1cff39(0x18b)](_0x3074d0)||_0x1cff39(0x1b4):'hub',_0x560b70=await P(_0x1cff39(0x1a5),{'alias':_0x56c8a0,'text':_0x9475c0,'in_reply_to':_0x3074d0||void 0x0,'status':_0x101825,'from_session':Z});if(_0x3074d0)k[_0x1cff39(0x190)](_0x3074d0);return{'content':[{'type':_0x1cff39(0x186),'text':JSON[_0x1cff39(0x1c0)](_0x560b70)}]};}let _0x3eeadc=await P(_0x1cff39(0x1dd),{'resume_id':w,'alias':Z,'status':_0xa1b6aa===_0x1cff39(0x1a3)?'blocked':_0xa1b6aa===_0x1cff39(0x1cf)?'error':_0x1cff39(0x1f4),'task':_0x9475c0[_0x1cff39(0x1ac)](0x0,0xc8),'output':_0x9475c0});return{'content':[{'type':_0x1cff39(0x186),'text':JSON[_0x1cff39(0x1c0)](_0x3eeadc)}]};}if(_0x1fe59b===_0x1cff39(0x194)){let {status:_0x42d8f9,task:_0x20af14,progress:_0x2fa4ac}=_0x416822,_0x38307f=await P(_0x1cff39(0x1dd),{'resume_id':w,'alias':Z,'status':_0x42d8f9,'task':_0x20af14,'progress':_0x2fa4ac});return{'content':[{'type':_0x1cff39(0x186),'text':JSON[_0x1cff39(0x1c0)](_0x38307f)}]};}if(_0x1fe59b==='commhub_send_task'){let {alias:_0x5220d6,task:_0x847fcd,priority:_0x37fdc5}=_0x416822,_0x3d03d4=await P(_0x1cff39(0x19d),{'alias':_0x5220d6,'task':_0x847fcd,'priority':_0x37fdc5||_0x1cff39(0x17c),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x1cff39(0x1c0)](_0x3d03d4)}]};}if(_0x1fe59b===_0x1cff39(0x174)){let {alias:_0xfd6bb2,message:_0x19837b}=_0x416822,_0x5dd29d=await P(_0x1cff39(0x1ae),{'alias':_0xfd6bb2,'message':_0x19837b,'from_session':Z});return{'content':[{'type':_0x1cff39(0x186),'text':JSON[_0x1cff39(0x1c0)](_0x5dd29d)}]};}if(_0x1fe59b==='commhub_get_all_status'){let _0x3fc107=await P('get_all_status',{});return{'content':[{'type':_0x1cff39(0x186),'text':JSON[_0x1cff39(0x1c0)](_0x3fc107)}]};}return{'content':[{'type':'text','text':JSON['stringify']({'error':_0x1cff39(0x1c7)})}]};});async function u(){const _0x543e78=a0_0x219173;let _0x4187a2=f+_0x543e78(0x1da)+encodeURIComponent(Z),_0x1b323b={};if(X)_0x1b323b[_0x543e78(0x1ea)]=_0x543e78(0x181)+X;Y(_0x543e78(0x1ca)+_0x4187a2);while(!0x0){try{let _0x18de56=await fetch(_0x4187a2,{'headers':_0x1b323b});if(!_0x18de56['ok']){Y('SSE\x20error:\x20'+_0x18de56[_0x543e78(0x187)]+'\x20'+_0x18de56[_0x543e78(0x16d)]),await h(0x1388);continue;}let _0x4775ab=_0x18de56[_0x543e78(0x1a9)]['getReader'](),_0x2dbb55=new TextDecoder(),_0x5c50d0='';while(!0x0){let {done:_0x43ca14,value:_0x39bc74}=await _0x4775ab[_0x543e78(0x1e8)]();if(_0x43ca14)break;_0x5c50d0+=_0x2dbb55[_0x543e78(0x16e)](_0x39bc74,{'stream':!0x0});let _0x10f3b8=_0x5c50d0[_0x543e78(0x1c9)]('\x0a\x0a');_0x5c50d0=_0x10f3b8[_0x543e78(0x1bb)]()||'';for(let _0x1802a4 of _0x10f3b8){let _0x717ba0=_0x1802a4['split']('\x0a')[_0x543e78(0x1f3)](_0x545f2f=>_0x545f2f[_0x543e78(0x1d4)]('data:\x20'));if(!_0x717ba0)continue;try{let _0x2e14e9=JSON[_0x543e78(0x1cb)](_0x717ba0[_0x543e78(0x1ac)](0x6));await S(_0x2e14e9);}catch(_0x57a53c){Y(_0x543e78(0x183)+_0x57a53c);}}}Y(_0x543e78(0x1d8));}catch(_0x40c7ea){Y(_0x543e78(0x1eb)+_0x40c7ea);}await h(0xbb8);}}async function S(_0x4d2be3){const _0xf6a499=a0_0x219173;if(_0x4d2be3[_0xf6a499(0x1ce)]===_0xf6a499(0x19e)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x4d2be3[_0xf6a499(0x1ce)]===_0xf6a499(0x1ee)){if(Y(_0xf6a499(0x1ab)+_0x4d2be3[_0xf6a499(0x1ef)]+':\x20'+_0x4d2be3[_0xf6a499(0x1e7)][_0xf6a499(0x1ac)](0x0,0x3c)),await K[_0xf6a499(0x171)]({'method':'notifications/claude/channel','params':{'content':_0x4d2be3[_0xf6a499(0x1e7)],'meta':{'sender':_0x4d2be3[_0xf6a499(0x1ef)]||_0xf6a499(0x1b4),'sender_id':'commhub','user':_0x4d2be3[_0xf6a499(0x1ef)]||'hub','priority':_0xf6a499(0x17c)}}}),_0x4d2be3[_0xf6a499(0x1b2)])await P(_0xf6a499(0x1be),{'alias':Z,'message_id':_0x4d2be3[_0xf6a499(0x1b2)]});return;}if(_0x4d2be3[_0xf6a499(0x1ce)]===_0xf6a499(0x18d)||_0x4d2be3[_0xf6a499(0x1ce)]==='broadcast'){Y('←\x20'+_0x4d2be3[_0xf6a499(0x1ce)]+_0xf6a499(0x1c3)+_0x4d2be3[_0xf6a499(0x1b1)]+_0xf6a499(0x1f1)+(_0x4d2be3['priority']||_0xf6a499(0x17c)));let _0x405c40=await P(_0xf6a499(0x1ec),{'alias':Z,'limit':0x5});if(_0x405c40?.['ok']&&_0x405c40[_0xf6a499(0x17e)]?.[_0xf6a499(0x1dc)]>0x0)for(let _0x5b6993 of _0x405c40['messages']){let _0x5dc2b1={'sender':_0x5b6993['from_session']||_0xf6a499(0x1b4),'sender_id':_0xf6a499(0x1a4),'user':_0x5b6993['from_session']||_0xf6a499(0x1b4),'task_id':_0x5b6993['id'],'priority':_0x5b6993['priority']||_0xf6a499(0x17c)};k['set'](_0x5b6993['id'],_0x5b6993['from_session']||_0xf6a499(0x1b4)),await K[_0xf6a499(0x171)]({'method':'notifications/claude/channel','params':{'content':_0x5b6993['content'],'meta':_0x5dc2b1}}),Y(_0xf6a499(0x197)+_0x5b6993['id'][_0xf6a499(0x1ac)](0x0,0x8)+_0xf6a499(0x1ba)+_0x5b6993[_0xf6a499(0x19c)]+':\x20'+_0x5b6993[_0xf6a499(0x1d0)][_0xf6a499(0x1ac)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x5b6993['id']});}}}async function A(){const _0xa1193f=a0_0x219173;let _0x2e3eed=new a0_0x556996();await K[_0xa1193f(0x196)](_0x2e3eed),Y(_0xa1193f(0x17d)),Y(_0xa1193f(0x1de)),u()[_0xa1193f(0x191)](_0x4ed9a4=>Y(_0xa1193f(0x1b5)+_0x4ed9a4)),P(_0xa1193f(0x1dd),{'resume_id':w,'alias':Z,'status':_0xa1193f(0x180),'server':a0_0xa56403(),'hostname':a0_0xa56403(),'agent':_0xa1193f(0x1bc),'project_dir':process[_0xa1193f(0x170)](),'tmux_name':j||void 0x0})[_0xa1193f(0x1b6)](()=>Y('registered\x20as\x20\x22'+Z+_0xa1193f(0x1b0)+w[_0xa1193f(0x1ac)](0x0,0x8)+')'))['catch'](_0x2d327c=>Y('warning:\x20could\x20not\x20register:\x20'+_0x2d327c)),setInterval(()=>{const _0x32130a=_0xa1193f;P(_0x32130a(0x1dd),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0xa56403(),'hostname':a0_0xa56403(),'agent':_0x32130a(0x1bc),'project_dir':process[_0x32130a(0x170)](),'tmux_name':j||void 0x0})[_0x32130a(0x191)](_0xa72fd7=>Y(_0x32130a(0x1e1)+_0xa72fd7));},0x2bf20),Y(_0xa1193f(0x19b));}A()['catch'](_0x4b07f5=>{const _0x2905bc=a0_0x219173;Y('fatal:\x20'+_0x4b07f5),process[_0x2905bc(0x1a6)](0x1);});async function N(){const _0x1701d7=a0_0x219173;Y(_0x1701d7(0x179)),await P(_0x1701d7(0x1dd),{'resume_id':w,'alias':Z,'status':_0x1701d7(0x1cf),'task':_0x1701d7(0x1bd)})[_0x1701d7(0x191)](()=>{}),process[_0x1701d7(0x1a6)](0x0);}process['stdin']['on']('end',()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x219173(0x17f),()=>N());
2
+ const a0_0x5afc3c=a0_0x1644;(function(_0x44ff8f,_0x525b4d){const _0x31c6dd=a0_0x1644,_0x3b86ef=_0x44ff8f();while(!![]){try{const _0x314bcb=-parseInt(_0x31c6dd(0x152))/0x1*(parseInt(_0x31c6dd(0x10f))/0x2)+-parseInt(_0x31c6dd(0x158))/0x3*(-parseInt(_0x31c6dd(0x128))/0x4)+-parseInt(_0x31c6dd(0xd4))/0x5*(-parseInt(_0x31c6dd(0xfa))/0x6)+parseInt(_0x31c6dd(0x12c))/0x7*(parseInt(_0x31c6dd(0x110))/0x8)+parseInt(_0x31c6dd(0x144))/0x9+-parseInt(_0x31c6dd(0xeb))/0xa*(parseInt(_0x31c6dd(0x141))/0xb)+parseInt(_0x31c6dd(0x102))/0xc;if(_0x314bcb===_0x525b4d)break;else _0x3b86ef['push'](_0x3b86ef['shift']());}catch(_0x1d3ab){_0x3b86ef['push'](_0x3b86ef['shift']());}}}(a0_0x40eb,0xe3170));import{readFileSync as a0_0x3f9e5e,existsSync as a0_0x758f04}from'fs';import{randomUUID as a0_0x12e77c}from'crypto';import{join as a0_0x18d90a}from'path';import{hostname as a0_0x2a592f}from'os';import{execSync as a0_0x403dc6}from'child_process';import{Server as a0_0x1d6a70}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x58a500}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x43fcca,CallToolRequestSchema as a0_0xa99d8}from'@modelcontextprotocol/sdk/types.js';function p(_0x5a7c89){const _0x393a39=a0_0x1644;if(!a0_0x758f04(_0x5a7c89))return;for(let _0x2d6255 of a0_0x3f9e5e(_0x5a7c89,_0x393a39(0x10a))[_0x393a39(0xe1)]('\x0a')){let _0x503b7d=_0x2d6255[_0x393a39(0x10e)]();if(!_0x503b7d||_0x503b7d['startsWith']('#'))continue;let _0x5aab51=_0x503b7d[_0x393a39(0x11d)]('=');if(_0x5aab51<0x0)continue;let _0x1b38ec=_0x503b7d['slice'](0x0,_0x5aab51)[_0x393a39(0x10e)](),_0x59f78a=_0x503b7d[_0x393a39(0xd5)](_0x5aab51+0x1)['trim']()['replace'](/^["']|["']$/g,'');if(!process.env[_0x1b38ec])process.env[_0x1b38ec]=_0x59f78a;}}var C=process.env.HOME||'~',T=a0_0x18d90a(C,a0_0x5afc3c(0x129));p(a0_0x18d90a(T,a0_0x5afc3c(0xed)));var L=process[a0_0x5afc3c(0xd0)]()[a0_0x5afc3c(0x119)](/\//g,'-');p(a0_0x18d90a(T,L,a0_0x5afc3c(0xed)));function U(){const _0x84a464=a0_0x5afc3c;try{return a0_0x403dc6('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x84a464(0x10a),'timeout':0x7d0})['trim']();}catch{return'';}}function v(){const _0x41f078=a0_0x5afc3c;try{let _0x1b79bc=a0_0x18d90a(C,_0x41f078(0x11f),_0x41f078(0xf5));if(a0_0x758f04(_0x1b79bc))return JSON[_0x41f078(0x143)](a0_0x3f9e5e(_0x1b79bc,_0x41f078(0x10a)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x5afc3c(0xda)]||a0_0x5afc3c(0xd2),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x2a592f(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x12e77c(),X=process.env.COMMHUB_TOKEN||H[a0_0x5afc3c(0xff)]||'';function Y(_0x21ac04){const _0x3083c1=a0_0x5afc3c;let _0x2d1ed1=new Date()[_0x3083c1(0x104)]()[_0x3083c1(0xd5)](0x0,0x8);process['stderr'][_0x3083c1(0xfb)]('['+_0x2d1ed1+_0x3083c1(0xf2)+_0x21ac04+'\x0a');}function h(_0x269553){return new Promise(_0x675e1=>setTimeout(_0x675e1,_0x269553));}Y('ENV:\x20URL='+f+a0_0x5afc3c(0x109)+Z+a0_0x5afc3c(0x114)+w[a0_0x5afc3c(0xd5)](0x0,0x8)+a0_0x5afc3c(0xee)+(j||a0_0x5afc3c(0x15a))+a0_0x5afc3c(0x115)+process['cwd']()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x1d6a70({'name':a0_0x5afc3c(0xf6),'version':a0_0x5afc3c(0xe6)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x5afc3c(0x130),a0_0x5afc3c(0x11a),a0_0x5afc3c(0x12b),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Session\x20alias:\x20'+Z][a0_0x5afc3c(0xe2)]('\x0a')});K[a0_0x5afc3c(0x132)](a0_0x43fcca,async()=>({'tools':[{'name':a0_0x5afc3c(0xf8),'description':a0_0x5afc3c(0x10c),'inputSchema':{'type':a0_0x5afc3c(0xf4),'properties':{'task_id':{'type':a0_0x5afc3c(0x145),'description':a0_0x5afc3c(0xe5)},'text':{'type':a0_0x5afc3c(0x145),'description':a0_0x5afc3c(0xfc)},'status':{'type':a0_0x5afc3c(0x145),'enum':['completed',a0_0x5afc3c(0x150),a0_0x5afc3c(0xcc),a0_0x5afc3c(0x121),a0_0x5afc3c(0x134),a0_0x5afc3c(0xe0)],'description':a0_0x5afc3c(0x12e)}},'required':[a0_0x5afc3c(0xea)]}},{'name':a0_0x5afc3c(0xca),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x5afc3c(0xf4),'properties':{'status':{'type':a0_0x5afc3c(0x145),'enum':[a0_0x5afc3c(0x124),a0_0x5afc3c(0x118),a0_0x5afc3c(0x121),'error']},'task':{'type':a0_0x5afc3c(0x145),'description':a0_0x5afc3c(0x101)},'progress':{'type':a0_0x5afc3c(0x125),'description':a0_0x5afc3c(0x131)}},'required':[a0_0x5afc3c(0x137)]}},{'name':a0_0x5afc3c(0x153),'description':a0_0x5afc3c(0x103),'inputSchema':{'type':a0_0x5afc3c(0xf4),'properties':{'alias':{'type':a0_0x5afc3c(0x145),'description':a0_0x5afc3c(0xf3)},'task':{'type':a0_0x5afc3c(0x145),'description':'Task\x20content'},'priority':{'type':a0_0x5afc3c(0x145),'enum':[a0_0x5afc3c(0x12d),'normal',a0_0x5afc3c(0xd9)],'description':a0_0x5afc3c(0xce)}},'required':[a0_0x5afc3c(0x117),a0_0x5afc3c(0x108)]}},{'name':a0_0x5afc3c(0x14f),'description':a0_0x5afc3c(0x12a),'inputSchema':{'type':a0_0x5afc3c(0xf4),'properties':{'alias':{'type':'string','description':a0_0x5afc3c(0xf3)},'message':{'type':a0_0x5afc3c(0x145),'description':a0_0x5afc3c(0x155)}},'required':['alias',a0_0x5afc3c(0xe7)]}},{'name':a0_0x5afc3c(0x135),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x5afc3c(0xf4),'properties':{}}}]}));async function P(_0x37102f,_0x4edad5){const _0x6e9552=a0_0x5afc3c;let _0x1145b9=await fetch(f+_0x6e9552(0xdc),{'method':_0x6e9552(0x142),'headers':{'Content-Type':_0x6e9552(0x156),'Accept':_0x6e9552(0xec),...X?{'Authorization':_0x6e9552(0x111)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x6e9552(0xf0),'id':0x1,'method':_0x6e9552(0x122),'params':{'protocolVersion':_0x6e9552(0x105),'capabilities':{},'clientInfo':{'name':_0x6e9552(0xf6),'version':_0x6e9552(0xe6)}}})});if(!_0x1145b9['ok']){let _0x3a2dea=await _0x1145b9[_0x6e9552(0xea)]();return Y(_0x6e9552(0x13a)+_0x1145b9[_0x6e9552(0x137)]+'\x20'+_0x3a2dea[_0x6e9552(0xd5)](0x0,0x64)),{'ok':!0x1,'error':_0x6e9552(0x120)+_0x1145b9[_0x6e9552(0x137)]};}await _0x1145b9[_0x6e9552(0xea)]();let _0x16a824=(await(await fetch(f+_0x6e9552(0xdc),{'method':_0x6e9552(0x142),'headers':{'Content-Type':_0x6e9552(0x156),'Accept':_0x6e9552(0xec),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x6e9552(0x13e)]({'jsonrpc':_0x6e9552(0xf0),'id':0x2,'method':_0x6e9552(0x14a),'params':{'name':_0x37102f,'arguments':_0x4edad5}})}))[_0x6e9552(0xea)]())[_0x6e9552(0xe1)]('\x0a')[_0x6e9552(0x154)](_0x54e0b2=>_0x54e0b2['startsWith'](_0x6e9552(0x146)));if(_0x16a824){let _0x14ae60=JSON[_0x6e9552(0x143)](_0x16a824[_0x6e9552(0xd5)](0x6));return _0x14ae60?.[_0x6e9552(0xe8)]?.[_0x6e9552(0x136)]?.[0x0]?.[_0x6e9552(0xea)]?JSON[_0x6e9552(0x143)](_0x14ae60[_0x6e9552(0xe8)]['content'][0x0]['text']):_0x14ae60;}return{'ok':!0x1,'error':_0x6e9552(0x14e)};}function a0_0x1644(_0x28afcc,_0x5655e7){_0x28afcc=_0x28afcc-0xca;const _0x40eb85=a0_0x40eb();let _0x16443f=_0x40eb85[_0x28afcc];return _0x16443f;}K[a0_0x5afc3c(0x132)](a0_0xa99d8,async _0x13d9cc=>{const _0x130b5d=a0_0x5afc3c;let {name:_0x2d2bd,arguments:_0x17f670}=_0x13d9cc['params'];if(_0x2d2bd===_0x130b5d(0xf8)){let {task_id:_0x136cf7,text:_0x32f03d,status:_0x3c68c0}=_0x17f670;if(_0x3c68c0===_0x130b5d(0x13b)||_0x3c68c0==='failed'||_0x3c68c0===_0x130b5d(0xcc)){let _0x52e421=_0x3c68c0===_0x130b5d(0x13b)?'replied':_0x3c68c0,_0x54a186=_0x136cf7?k[_0x130b5d(0xe9)](_0x136cf7)||_0x130b5d(0xda):_0x130b5d(0xda),_0x521301=await P('send_reply',{'alias':_0x54a186,'text':_0x32f03d,'in_reply_to':_0x136cf7||void 0x0,'status':_0x52e421,'from_session':Z});if(_0x136cf7)k[_0x130b5d(0xf7)](_0x136cf7);return{'content':[{'type':_0x130b5d(0xea),'text':JSON[_0x130b5d(0x13e)](_0x521301)}]};}let _0x5cfa77=await P(_0x130b5d(0x113),{'resume_id':w,'alias':Z,'status':_0x3c68c0===_0x130b5d(0x121)?'blocked':_0x3c68c0==='error'?_0x130b5d(0x134):_0x130b5d(0x124),'task':_0x32f03d[_0x130b5d(0xd5)](0x0,0xc8),'output':_0x32f03d});return{'content':[{'type':'text','text':JSON[_0x130b5d(0x13e)](_0x5cfa77)}]};}if(_0x2d2bd===_0x130b5d(0xca)){let {status:_0x20963d,task:_0x28ce40,progress:_0x301bae}=_0x17f670,_0x358c59=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x20963d,'task':_0x28ce40,'progress':_0x301bae});return{'content':[{'type':'text','text':JSON[_0x130b5d(0x13e)](_0x358c59)}]};}if(_0x2d2bd===_0x130b5d(0x153)){let {alias:_0x343202,task:_0x4abb2e,priority:_0x3fce70}=_0x17f670,_0x34a9d5=await P(_0x130b5d(0x157),{'alias':_0x343202,'task':_0x4abb2e,'priority':_0x3fce70||_0x130b5d(0x11b),'from_session':Z});return{'content':[{'type':_0x130b5d(0xea),'text':JSON['stringify'](_0x34a9d5)}]};}if(_0x2d2bd===_0x130b5d(0x14f)){let {alias:_0x283c3a,message:_0x1145db}=_0x17f670,_0xfdee1d=await P(_0x130b5d(0xcb),{'alias':_0x283c3a,'message':_0x1145db,'from_session':Z});return{'content':[{'type':_0x130b5d(0xea),'text':JSON['stringify'](_0xfdee1d)}]};}if(_0x2d2bd==='commhub_get_all_status'){let _0x27efc9=await P(_0x130b5d(0xf1),{});return{'content':[{'type':_0x130b5d(0xea),'text':JSON[_0x130b5d(0x13e)](_0x27efc9)}]};}return{'content':[{'type':_0x130b5d(0xea),'text':JSON[_0x130b5d(0x13e)]({'error':_0x130b5d(0x100)})}]};});async function u(){const _0x1cfa64=a0_0x5afc3c;let _0x246e03=f+_0x1cfa64(0xe3)+encodeURIComponent(Z),_0x573d20={};if(X)_0x573d20[_0x1cfa64(0xfd)]=_0x1cfa64(0x111)+X;Y(_0x1cfa64(0x139)+_0x246e03);while(!0x0){try{let _0x1aba62=await fetch(_0x246e03,{'headers':_0x573d20});if(!_0x1aba62['ok']){Y(_0x1cfa64(0x13c)+_0x1aba62[_0x1cfa64(0x137)]+'\x20'+_0x1aba62[_0x1cfa64(0x133)]),await h(0x1388);continue;}let _0x23b34b=_0x1aba62[_0x1cfa64(0x123)]['getReader'](),_0x5aa8a8=new TextDecoder(),_0x5f2062='';while(!0x0){let {done:_0x3e3d78,value:_0x31e2e6}=await _0x23b34b[_0x1cfa64(0xdb)]();if(_0x3e3d78)break;_0x5f2062+=_0x5aa8a8[_0x1cfa64(0xd8)](_0x31e2e6,{'stream':!0x0});let _0x92465c=_0x5f2062[_0x1cfa64(0xe1)]('\x0a\x0a');_0x5f2062=_0x92465c[_0x1cfa64(0x147)]()||'';for(let _0x40e655 of _0x92465c){let _0x1d9806=_0x40e655[_0x1cfa64(0xe1)]('\x0a')['find'](_0x3d7e78=>_0x3d7e78[_0x1cfa64(0xd7)](_0x1cfa64(0x146)));if(!_0x1d9806)continue;try{let _0x3c669d=JSON[_0x1cfa64(0x143)](_0x1d9806[_0x1cfa64(0xd5)](0x6));await S(_0x3c669d);}catch(_0x5b8761){Y(_0x1cfa64(0x11c)+_0x5b8761);}}}Y(_0x1cfa64(0x126));}catch(_0xd00cda){Y('SSE\x20connection\x20error:\x20'+_0xd00cda);}await h(0xbb8);}}async function S(_0x2803cf){const _0xed37f4=a0_0x5afc3c;if(_0x2803cf[_0xed37f4(0x12f)]===_0xed37f4(0xde)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x2803cf['type']==='new_message'){if(Y(_0xed37f4(0x106)+_0x2803cf[_0xed37f4(0xdf)]+':\x20'+_0x2803cf['message'][_0xed37f4(0xd5)](0x0,0x3c)),await K[_0xed37f4(0xef)]({'method':_0xed37f4(0xd6),'params':{'content':_0x2803cf[_0xed37f4(0xe7)],'meta':{'sender':_0x2803cf[_0xed37f4(0xdf)]||_0xed37f4(0xda),'sender_id':_0xed37f4(0x127),'user':_0x2803cf[_0xed37f4(0xdf)]||_0xed37f4(0xda),'priority':_0xed37f4(0x11b)}}}),_0x2803cf[_0xed37f4(0x151)])await P(_0xed37f4(0x159),{'alias':Z,'message_id':_0x2803cf['message_id']});return;}if(_0x2803cf['type']===_0xed37f4(0xdd)||_0x2803cf[_0xed37f4(0x12f)]===_0xed37f4(0x140)){Y('←\x20'+_0x2803cf[_0xed37f4(0x12f)]+_0xed37f4(0x15b)+_0x2803cf[_0xed37f4(0xd1)]+'\x20priority='+(_0x2803cf[_0xed37f4(0xe4)]||_0xed37f4(0x11b)));let _0x223d28=await P(_0xed37f4(0xf9),{'alias':Z,'limit':0x5});if(_0x223d28?.['ok']&&_0x223d28[_0xed37f4(0x14c)]?.[_0xed37f4(0x149)]>0x0)for(let _0x35f1ed of _0x223d28[_0xed37f4(0x14c)]){let _0x477b05={'sender':_0x35f1ed[_0xed37f4(0x14b)]||_0xed37f4(0xda),'sender_id':_0xed37f4(0x127),'user':_0x35f1ed[_0xed37f4(0x14b)]||_0xed37f4(0xda),'task_id':_0x35f1ed['id'],'priority':_0x35f1ed[_0xed37f4(0xe4)]||_0xed37f4(0x11b)};k[_0xed37f4(0xcd)](_0x35f1ed['id'],_0x35f1ed[_0xed37f4(0x14b)]||_0xed37f4(0xda)),await K[_0xed37f4(0xef)]({'method':_0xed37f4(0xd6),'params':{'content':_0x35f1ed['content'],'meta':_0x477b05}}),Y(_0xed37f4(0x138)+_0x35f1ed['id']['slice'](0x0,0x8)+_0xed37f4(0x112)+_0x35f1ed[_0xed37f4(0x14b)]+':\x20'+_0x35f1ed['content'][_0xed37f4(0xd5)](0x0,0x3c)),await P(_0xed37f4(0x159),{'alias':Z,'message_id':_0x35f1ed['id']});}}}function a0_0x40eb(){const _0x4cc1ff=['\x20ALIAS=','utf-8','catch','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','shutting\x20down,\x20reporting\x20offline...','trim','781918ZXJyGZ','450040eanlgX','Bearer\x20','\x20from\x20','report_status','\x20RESUME_ID=','\x20CWD=','exit','alias','idle','replace','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','normal','parse\x20error:\x20','indexOf','end','.anet','init\x20failed:\x20','blocked','initialize','body','working','number','SSE\x20stream\x20ended,\x20reconnecting...','commhub','4RcDZjk','.claude/channels/commhub','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','49ZjoSza','high','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','type','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','Progress\x200-100','setRequestHandler','statusText','error','commhub_get_all_status','content','status','→\x20injected\x20task\x20','connecting\x20to\x20','CommHub\x20init\x20failed:\x20','completed','SSE\x20error:\x20','claude-code','stringify','starting\x20SSE\x20listener...','broadcast','187KPvTlM','POST','parse','8332965wlMjSk','string','data:\x20','pop','SSE\x20fatal:\x20','length','tools/call','from_session','messages','MCP\x20stdio\x20connected','no\x20response','commhub_send_message','failed','message_id','1omOFTw','commhub_send_task','find','Message\x20content','application/json','send_task','1195521EeEYAH','ack_inbox','none',':\x20inbox_count=','commhub_report_status','send_message','cancelled','set','Priority\x20(default:\x20normal)','fatal:\x20','cwd','inbox_count','http://127.0.0.1:9200','SIGTERM','4485145RsEECL','slice','notifications/claude/channel','startsWith','decode','low','hub','read','/mcp','new_task','connected','from','in_progress','split','join','/events/','priority','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','0.3.0','message','result','get','text','983140PCpuSU','application/json,\x20text/event-stream','.env','...\x20TMUX=','notification','2.0','get_all_status',']\x20[commhub]\x20','Target\x20session\x20alias','object','config.json','commhub-channel','delete','commhub_reply','get_inbox','6VNqPAA','write','Reply\x20text\x20/\x20result\x20summary','Authorization','warning:\x20could\x20not\x20register:\x20','token','unknown\x20tool','Current\x20task\x20description','4527012mFCOZT','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','toTimeString','2025-03-26','←\x20message\x20from\x20','stdin','task'];a0_0x40eb=function(){return _0x4cc1ff;};return a0_0x40eb();}async function A(){const _0x4ce632=a0_0x5afc3c;let _0xfd61db=new a0_0x58a500();await K['connect'](_0xfd61db),Y(_0x4ce632(0x14d)),Y(_0x4ce632(0x13f)),u()[_0x4ce632(0x10b)](_0x3899fb=>Y(_0x4ce632(0x148)+_0x3899fb)),P(_0x4ce632(0x113),{'resume_id':w,'alias':Z,'status':_0x4ce632(0x118),'server':a0_0x2a592f(),'hostname':a0_0x2a592f(),'agent':'claude-code','project_dir':process[_0x4ce632(0xd0)](),'tmux_name':j||void 0x0})['then'](()=>Y('registered\x20as\x20\x22'+Z+'\x22\x20('+w[_0x4ce632(0xd5)](0x0,0x8)+')'))[_0x4ce632(0x10b)](_0x2bc13f=>Y(_0x4ce632(0xfe)+_0x2bc13f)),setInterval(()=>{const _0x7cd90c=_0x4ce632;P(_0x7cd90c(0x113),{'resume_id':w,'alias':Z,'status':_0x7cd90c(0x118),'server':a0_0x2a592f(),'hostname':a0_0x2a592f(),'agent':_0x7cd90c(0x13d),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x7cd90c(0x10b)](_0x4d300c=>Y('heartbeat\x20failed:\x20'+_0x4d300c));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()['catch'](_0x43f393=>{const _0x3eb012=a0_0x5afc3c;Y(_0x3eb012(0xcf)+_0x43f393),process[_0x3eb012(0x116)](0x1);});async function N(){const _0x311466=a0_0x5afc3c;Y(_0x311466(0x10d)),await P(_0x311466(0x113),{'resume_id':w,'alias':Z,'status':_0x311466(0x134),'task':'session\x20disconnected'})[_0x311466(0x10b)](()=>{}),process[_0x311466(0x116)](0x0);}process[a0_0x5afc3c(0x107)]['on'](a0_0x5afc3c(0x11e),()=>N()),process['on'](a0_0x5afc3c(0xd3),()=>N()),process['on']('SIGINT',()=>N());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.1.8-preview.4",
3
+ "version": "2.1.8-preview.5",
4
4
  "description": "AI Agent Network CLI — 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",
package/dist/client.d.ts DELETED
@@ -1,78 +0,0 @@
1
- /**
2
- * @sleep2agi/commhub-sdk
3
- *
4
- * CommHub 通信 SDK — 一个文件,SSE 长连接 + 自动重连 + 心跳。
5
- * 支持 Node.js 18+ 和 Bun。
6
- */
7
- import { EventEmitter } from "events";
8
- export interface CommHubOptions {
9
- /** CommHub Server URL, e.g. "http://YOUR_COMMHUB_IP:9200" */
10
- url: string;
11
- /** Session alias, e.g. "SDK马" */
12
- alias: string;
13
- /** Auth token (optional) */
14
- token?: string;
15
- /** Agent type for registration (default: "sdk") */
16
- agent?: string;
17
- /** Heartbeat interval in ms (default: 180000 = 3 min) */
18
- heartbeatInterval?: number;
19
- /** SSE reconnect base delay in ms (default: 3000) */
20
- reconnectDelay?: number;
21
- /** Auto-connect on creation (default: true) */
22
- autoConnect?: boolean;
23
- }
24
- export interface InboxMessage {
25
- id: string;
26
- content: string;
27
- from_session: string;
28
- priority: string;
29
- created_at: string;
30
- }
31
- export interface CommHubEvents {
32
- task: (msg: InboxMessage) => void;
33
- message: (msg: InboxMessage) => void;
34
- connected: () => void;
35
- disconnected: () => void;
36
- error: (err: Error) => void;
37
- }
38
- export declare class CommHub extends EventEmitter {
39
- private url;
40
- private alias;
41
- private token?;
42
- private agent;
43
- private resumeId;
44
- private heartbeatInterval;
45
- private reconnectDelay;
46
- private heartbeatTimer?;
47
- private sseAbort?;
48
- private running;
49
- constructor(opts: CommHubOptions);
50
- private log;
51
- private call;
52
- /** Connect to CommHub: register + start SSE + heartbeat */
53
- connect(): Promise<void>;
54
- /** Disconnect: stop SSE + heartbeat, report offline */
55
- disconnect(): Promise<void>;
56
- /** Send a task to another session */
57
- send(targetAlias: string, content: string, priority?: "high" | "normal" | "low"): Promise<any>;
58
- /** Send a message (no task lifecycle) */
59
- message(targetAlias: string, content: string): Promise<any>;
60
- /** Reply to a task (update status) */
61
- reply(taskId: string, text: string, status?: "completed" | "blocked" | "error" | "in_progress"): Promise<any>;
62
- /** Update session status */
63
- status(state: string, extra?: {
64
- task?: string;
65
- progress?: number;
66
- }): Promise<any>;
67
- /** Get all session statuses */
68
- getAllStatus(): Promise<any>;
69
- /** Broadcast to all sessions */
70
- broadcast(content: string, filter?: {
71
- server?: string;
72
- status?: string;
73
- }): Promise<any>;
74
- private connectSSE;
75
- private processInbox;
76
- private sleep;
77
- }
78
- export default CommHub;