@sleep2agi/agent-network 2.0.1-preview.0 → 2.0.1-preview.1

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
- function a0_0x223a(){const _0x3c5548=['heartbeatInterval','10xpfVmg','resumeId','offline','application/json','now','registered','new_message','getAllStatus','normal','1710216jkJtgm','parse','task','2.0','message','disconnect','match','result','status','reply','89114cIVese','toString','POST','report_status','from_session','connect','messages','235gSOrki','pop','SSE\x20failed:\x20',']\x20[commhub:','split','heartbeatTimer','sleep','10947607XaoGFm','get_all_status','replace','1928871QvAPMc','log','1792vHgmoj','/mcp','41274BsUoPv','connected','emit','997578dgnEwf','getReader','/events/','tools/call','SSE\x20reconnecting\x20in\x20','agent','call','url','Bearer\x20','inbox\x20error:\x20','min','text','send_message','type','Authorization','SSE\x20connected','sseAbort','AbortError','slice','4JyTWKT','cwd','error','server','alias','get_inbox','connectSSE','15616JLdVoq','idle','heartbeat\x20failed:\x20','decode','body','token','sdk-','broadcast','reconnectDelay','autoConnect','content','disconnected','send','processInbox','running'];a0_0x223a=function(){return _0x3c5548;};return a0_0x223a();}const a0_0xef29a8=a0_0x3363;(function(_0x504ff3,_0x1d0608){const _0x23057c=a0_0x3363,_0xf24c5=_0x504ff3();while(!![]){try{const _0x4ce9d9=parseInt(_0x23057c(0x116))/0x1*(parseInt(_0x23057c(0xec))/0x2)+parseInt(_0x23057c(0x12e))/0x3+parseInt(_0x23057c(0x10c))/0x4+-parseInt(_0x23057c(0x11d))/0x5*(parseInt(_0x23057c(0x12b))/0x6)+-parseInt(_0x23057c(0x129))/0x7*(-parseInt(_0x23057c(0xf3))/0x8)+parseInt(_0x23057c(0x127))/0x9+parseInt(_0x23057c(0x103))/0xa*(-parseInt(_0x23057c(0x124))/0xb);if(_0x4ce9d9===_0x1d0608)break;else _0xf24c5['push'](_0xf24c5['shift']());}catch(_0x1022d6){_0xf24c5['push'](_0xf24c5['shift']());}}}(a0_0x223a,0x517dd));import{EventEmitter as a0_0x2784ee}from'events';import{hostname as a0_0x521ce2}from'os';function a0_0x3363(_0x367f58,_0x4e1291){_0x367f58=_0x367f58-0xe2;const _0x223a8a=a0_0x223a();let _0x336326=_0x223a8a[_0x367f58];return _0x336326;}class T extends a0_0x2784ee{[a0_0xef29a8(0x135)];[a0_0xef29a8(0xf0)];[a0_0xef29a8(0xf8)];['agent'];[a0_0xef29a8(0x104)];[a0_0xef29a8(0x102)];[a0_0xef29a8(0xfb)];[a0_0xef29a8(0x122)];[a0_0xef29a8(0xe9)];[a0_0xef29a8(0x101)]=!0x1;constructor(_0x3f5b6b){const _0x2a9da6=a0_0xef29a8;super();if(this[_0x2a9da6(0x135)]=_0x3f5b6b['url'][_0x2a9da6(0x126)](/\/$/,''),this[_0x2a9da6(0xf0)]=_0x3f5b6b[_0x2a9da6(0xf0)],this[_0x2a9da6(0xf8)]=_0x3f5b6b[_0x2a9da6(0xf8)],this[_0x2a9da6(0x133)]=_0x3f5b6b[_0x2a9da6(0x133)]||'sdk',this['resumeId']=_0x2a9da6(0xf9)+_0x3f5b6b['alias']+'-'+Date[_0x2a9da6(0x107)]()[_0x2a9da6(0x117)](0x24),this[_0x2a9da6(0x102)]=_0x3f5b6b[_0x2a9da6(0x102)]??0x2bf20,this['reconnectDelay']=_0x3f5b6b[_0x2a9da6(0xfb)]??0xbb8,_0x3f5b6b[_0x2a9da6(0xfc)]!==!0x1)this[_0x2a9da6(0x11b)]();}['log'](_0x19fa64){const _0xb41d30=a0_0xef29a8;console[_0xb41d30(0x128)]('['+new Date()['toTimeString']()[_0xb41d30(0xeb)](0x0,0x8)+_0xb41d30(0x120)+this[_0xb41d30(0xf0)]+']\x20'+_0x19fa64);}async['call'](_0x3517a,_0x276ec0){const _0x55ed06=a0_0xef29a8;let _0x13d4d7={'Content-Type':_0x55ed06(0x106),'Accept':'application/json,\x20text/event-stream'};if(this[_0x55ed06(0xf8)])_0x13d4d7[_0x55ed06(0xe7)]=_0x55ed06(0x136)+this[_0x55ed06(0xf8)];let _0x3506fd=await(await fetch(this[_0x55ed06(0x135)]+_0x55ed06(0x12a),{'method':_0x55ed06(0x118),'headers':_0x13d4d7,'body':JSON['stringify']({'jsonrpc':_0x55ed06(0x10f),'id':Date[_0x55ed06(0x107)](),'method':_0x55ed06(0x131),'params':{'name':_0x3517a,'arguments':_0x276ec0}})}))[_0x55ed06(0xe4)](),_0x107c7a=_0x3506fd[_0x55ed06(0x112)](/data: (.+)/),_0x5dd893=_0x107c7a?JSON[_0x55ed06(0x10d)](_0x107c7a[0x1]):JSON['parse'](_0x3506fd),_0x2eb7f9=_0x5dd893?.[_0x55ed06(0x113)]?.[_0x55ed06(0xfd)]?.[0x0]?.[_0x55ed06(0xe4)];return _0x2eb7f9?JSON[_0x55ed06(0x10d)](_0x2eb7f9):_0x5dd893;}async[a0_0xef29a8(0x11b)](){const _0x39ee87=a0_0xef29a8;if(this['running'])return;this['running']=!0x0,await this['status'](_0x39ee87(0xf4)),this[_0x39ee87(0x128)](_0x39ee87(0x108)),this[_0x39ee87(0x122)]=setInterval(()=>{const _0x2bfb19=_0x39ee87;this['status'](_0x2bfb19(0xf4))['catch'](_0x51d8f4=>this[_0x2bfb19(0x128)](_0x2bfb19(0xf5)+_0x51d8f4['message']));},this[_0x39ee87(0x102)]),this[_0x39ee87(0xf2)]();}async[a0_0xef29a8(0x111)](){const _0x1d3812=a0_0xef29a8;if(this[_0x1d3812(0x101)]=!0x1,this[_0x1d3812(0xe9)]?.['abort'](),this[_0x1d3812(0x122)])clearInterval(this[_0x1d3812(0x122)]);await this[_0x1d3812(0x114)](_0x1d3812(0x105))['catch'](()=>{}),this[_0x1d3812(0x128)](_0x1d3812(0xfe));}async[a0_0xef29a8(0xff)](_0x5697ca,_0x565fc4,_0x26e1fc=a0_0xef29a8(0x10b)){const _0x51c28f=a0_0xef29a8;return this[_0x51c28f(0x134)]('send_task',{'alias':_0x5697ca,'task':_0x565fc4,'priority':_0x26e1fc,'from_session':this['alias']});}async[a0_0xef29a8(0x110)](_0x539344,_0x281ee3){const _0x5b702f=a0_0xef29a8;return this['call'](_0x5b702f(0xe5),{'alias':_0x539344,'message':_0x281ee3,'from_session':this[_0x5b702f(0xf0)]});}async[a0_0xef29a8(0x115)](_0x47ae66,_0x609bd7,_0x2eada7='completed'){const _0x20b1eb=a0_0xef29a8;return this['call'](_0x20b1eb(0x115),{'task_id':_0x47ae66,'text':_0x609bd7,'status':_0x2eada7});}async[a0_0xef29a8(0x114)](_0x41758c,_0x338ed9){const _0x298777=a0_0xef29a8;return this['call'](_0x298777(0x119),{'resume_id':this['resumeId'],'alias':this[_0x298777(0xf0)],'status':_0x41758c,'server':a0_0x521ce2(),'hostname':a0_0x521ce2(),'agent':this[_0x298777(0x133)],'project_dir':process[_0x298777(0xed)](),..._0x338ed9});}async[a0_0xef29a8(0x10a)](){const _0x307676=a0_0xef29a8;return this[_0x307676(0x134)](_0x307676(0x125),{});}async['broadcast'](_0x14ef30,_0x353ea3){const _0x4a4e98=a0_0xef29a8;return this[_0x4a4e98(0x134)](_0x4a4e98(0xfa),{'message':_0x14ef30,'filter_server':_0x353ea3?.[_0x4a4e98(0xef)],'filter_status':_0x353ea3?.[_0x4a4e98(0x114)]});}async[a0_0xef29a8(0xf2)](){const _0x2b1574=a0_0xef29a8;let _0x5a8246=encodeURIComponent(this[_0x2b1574(0xf0)]),_0x466b41=this[_0x2b1574(0x135)]+_0x2b1574(0x130)+_0x5a8246,_0x1e55a2=this['reconnectDelay'];while(this[_0x2b1574(0x101)]){try{this[_0x2b1574(0xe9)]=new AbortController();let _0x9e302d={'Accept':'text/event-stream'};if(this['token'])_0x9e302d[_0x2b1574(0xe7)]=_0x2b1574(0x136)+this[_0x2b1574(0xf8)];let _0x16c7cc=await fetch(_0x466b41,{'headers':_0x9e302d,'signal':this[_0x2b1574(0xe9)]['signal']});if(!_0x16c7cc['ok']||!_0x16c7cc[_0x2b1574(0xf7)]){this[_0x2b1574(0x128)](_0x2b1574(0x11f)+_0x16c7cc['status']),await this[_0x2b1574(0x123)](_0x1e55a2),_0x1e55a2=Math[_0x2b1574(0xe3)](_0x1e55a2*1.5,0xea60);continue;}_0x1e55a2=this[_0x2b1574(0xfb)];let _0x152bcb=_0x16c7cc[_0x2b1574(0xf7)][_0x2b1574(0x12f)](),_0x4dd182=new TextDecoder(),_0x388940='';while(this[_0x2b1574(0x101)]){let {done:_0x90e089,value:_0x44ad62}=await _0x152bcb['read']();if(_0x90e089)break;_0x388940+=_0x4dd182[_0x2b1574(0xf6)](_0x44ad62,{'stream':!0x0});let _0x827bb=_0x388940[_0x2b1574(0x121)]('\x0a');_0x388940=_0x827bb[_0x2b1574(0x11e)]()||'';for(let _0x81c7bb of _0x827bb){if(!_0x81c7bb['startsWith']('data:\x20'))continue;try{let _0x8727b0=JSON['parse'](_0x81c7bb[_0x2b1574(0xeb)](0x6));if(_0x8727b0[_0x2b1574(0xe6)]===_0x2b1574(0x12c)){this['log'](_0x2b1574(0xe8)),this['emit'](_0x2b1574(0x12c));continue;}if(_0x8727b0[_0x2b1574(0xe6)]==='new_task'||_0x8727b0[_0x2b1574(0xe6)]===_0x2b1574(0x109)||_0x8727b0['type']===_0x2b1574(0xfa))await this[_0x2b1574(0x100)]();}catch{}}}}catch(_0x956532){if(_0x956532['name']===_0x2b1574(0xea))break;this[_0x2b1574(0x12d)](_0x2b1574(0xee),_0x956532),this[_0x2b1574(0x128)]('SSE\x20error:\x20'+_0x956532[_0x2b1574(0x110)]);}if(this[_0x2b1574(0x101)])this[_0x2b1574(0x12d)]('disconnected'),this[_0x2b1574(0x128)](_0x2b1574(0x132)+_0x1e55a2/0x3e8+'s...'),await this['sleep'](_0x1e55a2),_0x1e55a2=Math[_0x2b1574(0xe3)](_0x1e55a2*1.5,0xea60);}}async['processInbox'](){const _0x311a3e=a0_0xef29a8;try{let _0x351a1f=(await this[_0x311a3e(0x134)](_0x311a3e(0xf1),{'alias':this['alias'],'limit':0xa}))?.[_0x311a3e(0x11c)]||[];for(let _0x1754aa of _0x351a1f)await this[_0x311a3e(0x134)]('ack_inbox',{'alias':this[_0x311a3e(0xf0)],'message_id':_0x1754aa['id']}),this[_0x311a3e(0x128)]('←\x20'+_0x1754aa[_0x311a3e(0x11a)]+':\x20'+_0x1754aa['content'][_0x311a3e(0xeb)](0x0,0x3c)),this['emit'](_0x311a3e(0x10e),_0x1754aa),this[_0x311a3e(0x12d)](_0x311a3e(0x110),_0x1754aa);}catch(_0x454899){this['log'](_0x311a3e(0xe2)+_0x454899[_0x311a3e(0x110)]);}}[a0_0xef29a8(0x123)](_0x3ae096){return new Promise(_0x40fe90=>setTimeout(_0x40fe90,_0x3ae096));}}var $=T;export{$ as default,T as CommHub};
1
+ function a0_0x91cc(_0x309140,_0x58b6bc){_0x309140=_0x309140-0x1c3;const _0x35da70=a0_0x35da();let _0x91ccac=_0x35da70[_0x309140];return _0x91ccac;}function a0_0x35da(){const _0x426ded=['sdk-','signal','connect','getReader','reply','autoConnect','replace','707802KyNghk','type','token','text','3085840mCOdqz','alias','call','abort','offline','body','disconnect','log','server','split','Bearer\x20','3507931iUlYso','resumeId','stringify','/events/','match','result','55qjOCYU','parse','heartbeatInterval','toTimeString','registered','connectSSE','catch','sseAbort','slice','text/event-stream','send_task','message','min','broadcast','/mcp','emit','agent','send','SSE\x20failed:\x20','get_all_status','heartbeat\x20failed:\x20','application/json,\x20text/event-stream','now','content','770931CQqxuD','running','url','inbox\x20error:\x20','disconnected','7914BFWwCy','SSE\x20reconnecting\x20in\x20','connected','report_status','reconnectDelay','AbortError','208881qdmrUZ','data:\x20','application/json','2.0','s...','SSE\x20error:\x20','status','from_session','38059030cHJXVW','idle','sleep','decode','Authorization','POST','read','392QsVfQF','794ruKgxB','tools/call','toString','task','processInbox','heartbeatTimer'];a0_0x35da=function(){return _0x426ded;};return a0_0x35da();}const a0_0x4e50cb=a0_0x91cc;(function(_0x166df0,_0x3912ff){const _0x13e9ac=a0_0x91cc,_0x5190c4=_0x166df0();while(!![]){try{const _0x45add6=-parseInt(_0x13e9ac(0x1c7))/0x1+-parseInt(_0x13e9ac(0x1e2))/0x2*(parseInt(_0x13e9ac(0x1cc))/0x3)+-parseInt(_0x13e9ac(0x1f3))/0x4+-parseInt(_0x13e9ac(0x204))/0x5*(-parseInt(_0x13e9ac(0x1ef))/0x6)+-parseInt(_0x13e9ac(0x1fe))/0x7+-parseInt(_0x13e9ac(0x1e1))/0x8*(parseInt(_0x13e9ac(0x1d2))/0x9)+parseInt(_0x13e9ac(0x1da))/0xa;if(_0x45add6===_0x3912ff)break;else _0x5190c4['push'](_0x5190c4['shift']());}catch(_0x20da51){_0x5190c4['push'](_0x5190c4['shift']());}}}(a0_0x35da,0xd5be1));import{EventEmitter as a0_0x122f3a}from'events';import{hostname as a0_0x1ecbc1}from'os';class T extends a0_0x122f3a{[a0_0x4e50cb(0x1c9)];[a0_0x4e50cb(0x1f4)];[a0_0x4e50cb(0x1f1)];[a0_0x4e50cb(0x214)];['resumeId'];['heartbeatInterval'];[a0_0x4e50cb(0x1d0)];['heartbeatTimer'];['sseAbort'];[a0_0x4e50cb(0x1c8)]=!0x1;constructor(_0x2346ab){const _0x45bd7a=a0_0x4e50cb;super();if(this[_0x45bd7a(0x1c9)]=_0x2346ab[_0x45bd7a(0x1c9)][_0x45bd7a(0x1ee)](/\/$/,''),this[_0x45bd7a(0x1f4)]=_0x2346ab[_0x45bd7a(0x1f4)],this[_0x45bd7a(0x1f1)]=_0x2346ab[_0x45bd7a(0x1f1)],this['agent']=_0x2346ab[_0x45bd7a(0x214)]||'sdk',this['resumeId']=_0x45bd7a(0x1e8)+_0x2346ab[_0x45bd7a(0x1f4)]+'-'+Date[_0x45bd7a(0x1c5)]()[_0x45bd7a(0x1e4)](0x24),this[_0x45bd7a(0x206)]=_0x2346ab[_0x45bd7a(0x206)]??0x2bf20,this[_0x45bd7a(0x1d0)]=_0x2346ab['reconnectDelay']??0xbb8,_0x2346ab[_0x45bd7a(0x1ed)]!==!0x1)this[_0x45bd7a(0x1ea)]();}[a0_0x4e50cb(0x1fa)](_0x342b94){const _0x4b4743=a0_0x4e50cb;console[_0x4b4743(0x1fa)]('['+new Date()[_0x4b4743(0x207)]()[_0x4b4743(0x20c)](0x0,0x8)+']\x20[commhub:'+this['alias']+']\x20'+_0x342b94);}async[a0_0x4e50cb(0x1f5)](_0x2e8310,_0x37c275){const _0x513daa=a0_0x4e50cb;let _0x36b76d={'Content-Type':_0x513daa(0x1d4),'Accept':_0x513daa(0x1c4)};if(this[_0x513daa(0x1f1)])_0x36b76d[_0x513daa(0x1de)]=_0x513daa(0x1fd)+this[_0x513daa(0x1f1)];let _0xf6b805=await(await fetch(this['url']+_0x513daa(0x212),{'method':_0x513daa(0x1df),'headers':_0x36b76d,'body':JSON[_0x513daa(0x200)]({'jsonrpc':_0x513daa(0x1d5),'id':Date[_0x513daa(0x1c5)](),'method':_0x513daa(0x1e3),'params':{'name':_0x2e8310,'arguments':_0x37c275}})}))[_0x513daa(0x1f2)](),_0x15f8c6=_0xf6b805[_0x513daa(0x202)](/data: (.+)/),_0x2ac0c6=_0x15f8c6?JSON['parse'](_0x15f8c6[0x1]):JSON[_0x513daa(0x205)](_0xf6b805),_0x5a589d=_0x2ac0c6?.[_0x513daa(0x203)]?.['content']?.[0x0]?.[_0x513daa(0x1f2)];return _0x5a589d?JSON['parse'](_0x5a589d):_0x2ac0c6;}async['connect'](){const _0x751aea=a0_0x4e50cb;if(this['running'])return;this[_0x751aea(0x1c8)]=!0x0,await this[_0x751aea(0x1d8)](_0x751aea(0x1db)),this['log'](_0x751aea(0x208)),this['heartbeatTimer']=setInterval(()=>{const _0x467820=_0x751aea;this['status'](_0x467820(0x1db))[_0x467820(0x20a)](_0x4a82ea=>this[_0x467820(0x1fa)](_0x467820(0x1c3)+_0x4a82ea[_0x467820(0x20f)]));},this[_0x751aea(0x206)]),this[_0x751aea(0x209)]();}async[a0_0x4e50cb(0x1f9)](){const _0x547761=a0_0x4e50cb;if(this[_0x547761(0x1c8)]=!0x1,this[_0x547761(0x20b)]?.[_0x547761(0x1f6)](),this[_0x547761(0x1e7)])clearInterval(this[_0x547761(0x1e7)]);await this[_0x547761(0x1d8)](_0x547761(0x1f7))[_0x547761(0x20a)](()=>{}),this[_0x547761(0x1fa)](_0x547761(0x1cb));}async[a0_0x4e50cb(0x215)](_0x37c972,_0x153c7e,_0x4d213c='normal'){const _0x21dbd1=a0_0x4e50cb;return this['call'](_0x21dbd1(0x20e),{'alias':_0x37c972,'task':_0x153c7e,'priority':_0x4d213c,'from_session':this[_0x21dbd1(0x1f4)]});}async[a0_0x4e50cb(0x20f)](_0x3dc34e,_0x256af8){return this['call']('send_message',{'alias':_0x3dc34e,'message':_0x256af8,'from_session':this['alias']});}async[a0_0x4e50cb(0x1ec)](_0x420179,_0x42bebf,_0x5479ba='completed'){const _0x199a8f=a0_0x4e50cb;return this[_0x199a8f(0x1f5)](_0x199a8f(0x1ec),{'task_id':_0x420179,'text':_0x42bebf,'status':_0x5479ba});}async[a0_0x4e50cb(0x1d8)](_0xa9a1da,_0x288590){const _0x2261ee=a0_0x4e50cb;return this['call'](_0x2261ee(0x1cf),{'resume_id':this[_0x2261ee(0x1ff)],'alias':this[_0x2261ee(0x1f4)],'status':_0xa9a1da,'server':a0_0x1ecbc1(),'hostname':a0_0x1ecbc1(),'agent':this[_0x2261ee(0x214)],'project_dir':process['cwd'](),..._0x288590});}async['getAllStatus'](){const _0x560949=a0_0x4e50cb;return this['call'](_0x560949(0x217),{});}async[a0_0x4e50cb(0x211)](_0x43a17f,_0x105746){const _0x44db4e=a0_0x4e50cb;return this[_0x44db4e(0x1f5)]('broadcast',{'message':_0x43a17f,'filter_server':_0x105746?.[_0x44db4e(0x1fb)],'filter_status':_0x105746?.['status']});}async[a0_0x4e50cb(0x209)](){const _0x54db6a=a0_0x4e50cb;let _0x1d1cc0=encodeURIComponent(this[_0x54db6a(0x1f4)]),_0x4ffebc=this['url']+_0x54db6a(0x201)+_0x1d1cc0,_0x43e7f5=this[_0x54db6a(0x1d0)];while(this[_0x54db6a(0x1c8)]){try{this[_0x54db6a(0x20b)]=new AbortController();let _0x2ef5fc={'Accept':_0x54db6a(0x20d)};if(this['token'])_0x2ef5fc['Authorization']='Bearer\x20'+this['token'];let _0x3e5746=await fetch(_0x4ffebc,{'headers':_0x2ef5fc,'signal':this['sseAbort'][_0x54db6a(0x1e9)]});if(!_0x3e5746['ok']||!_0x3e5746[_0x54db6a(0x1f8)]){this[_0x54db6a(0x1fa)](_0x54db6a(0x216)+_0x3e5746[_0x54db6a(0x1d8)]),await this[_0x54db6a(0x1dc)](_0x43e7f5),_0x43e7f5=Math[_0x54db6a(0x210)](_0x43e7f5*1.5,0xea60);continue;}_0x43e7f5=this[_0x54db6a(0x1d0)];let _0x4def0a=_0x3e5746['body'][_0x54db6a(0x1eb)](),_0x444812=new TextDecoder(),_0x3a0120='';while(this[_0x54db6a(0x1c8)]){let {done:_0x42b3de,value:_0x5f5829}=await _0x4def0a[_0x54db6a(0x1e0)]();if(_0x42b3de)break;_0x3a0120+=_0x444812[_0x54db6a(0x1dd)](_0x5f5829,{'stream':!0x0});let _0x327683=_0x3a0120[_0x54db6a(0x1fc)]('\x0a');_0x3a0120=_0x327683['pop']()||'';for(let _0x282eee of _0x327683){if(!_0x282eee['startsWith'](_0x54db6a(0x1d3)))continue;try{let _0x523b21=JSON[_0x54db6a(0x205)](_0x282eee[_0x54db6a(0x20c)](0x6));if(_0x523b21['type']===_0x54db6a(0x1ce)){this[_0x54db6a(0x1fa)]('SSE\x20connected'),this[_0x54db6a(0x213)](_0x54db6a(0x1ce));continue;}if(_0x523b21[_0x54db6a(0x1f0)]==='new_task'||_0x523b21[_0x54db6a(0x1f0)]==='new_message'||_0x523b21['type']===_0x54db6a(0x211))await this[_0x54db6a(0x1e6)]();}catch{}}}}catch(_0x5de1b4){if(_0x5de1b4['name']===_0x54db6a(0x1d1))break;this[_0x54db6a(0x213)]('error',_0x5de1b4),this[_0x54db6a(0x1fa)](_0x54db6a(0x1d7)+_0x5de1b4['message']);}if(this[_0x54db6a(0x1c8)])this[_0x54db6a(0x213)](_0x54db6a(0x1cb)),this[_0x54db6a(0x1fa)](_0x54db6a(0x1cd)+_0x43e7f5/0x3e8+_0x54db6a(0x1d6)),await this[_0x54db6a(0x1dc)](_0x43e7f5),_0x43e7f5=Math[_0x54db6a(0x210)](_0x43e7f5*1.5,0xea60);}}async[a0_0x4e50cb(0x1e6)](){const _0x2ee228=a0_0x4e50cb;try{let _0x4074a5=(await this['call']('get_inbox',{'alias':this[_0x2ee228(0x1f4)],'limit':0xa}))?.['messages']||[];for(let _0x115670 of _0x4074a5)await this[_0x2ee228(0x1f5)]('ack_inbox',{'alias':this[_0x2ee228(0x1f4)],'message_id':_0x115670['id']}),this[_0x2ee228(0x1fa)]('←\x20'+_0x115670[_0x2ee228(0x1d9)]+':\x20'+_0x115670[_0x2ee228(0x1c6)][_0x2ee228(0x20c)](0x0,0x3c)),this['emit'](_0x2ee228(0x1e5),_0x115670),this[_0x2ee228(0x213)](_0x2ee228(0x20f),_0x115670);}catch(_0x4c6052){this[_0x2ee228(0x1fa)](_0x2ee228(0x1ca)+_0x4c6052[_0x2ee228(0x20f)]);}}[a0_0x4e50cb(0x1dc)](_0x3499d3){return new Promise(_0x62ed29=>setTimeout(_0x62ed29,_0x3499d3));}}var $=T;export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x3e6d72=a0_0x17e3;(function(_0x1d3a2b,_0x40421e){const _0x56e7e0=a0_0x17e3,_0xbbec5f=_0x1d3a2b();while(!![]){try{const _0x3023bb=-parseInt(_0x56e7e0(0x22b))/0x1+-parseInt(_0x56e7e0(0x1f1))/0x2*(-parseInt(_0x56e7e0(0x20d))/0x3)+-parseInt(_0x56e7e0(0x233))/0x4*(parseInt(_0x56e7e0(0x215))/0x5)+-parseInt(_0x56e7e0(0x25e))/0x6+-parseInt(_0x56e7e0(0x20e))/0x7*(-parseInt(_0x56e7e0(0x25b))/0x8)+-parseInt(_0x56e7e0(0x211))/0x9*(parseInt(_0x56e7e0(0x236))/0xa)+parseInt(_0x56e7e0(0x254))/0xb;if(_0x3023bb===_0x40421e)break;else _0xbbec5f['push'](_0xbbec5f['shift']());}catch(_0x5d0d4d){_0xbbec5f['push'](_0xbbec5f['shift']());}}}(a0_0x3b9f,0x4b707));import{readFileSync as a0_0x2631e6,existsSync as a0_0x56ee36}from'fs';import{randomUUID as a0_0x1bf8c9}from'crypto';import{join as a0_0x5b5672}from'path';import{hostname as a0_0x342df9}from'os';import{execSync as a0_0x233a98}from'child_process';import{Server as a0_0x198c9f}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x3e4b81}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x4177a8,CallToolRequestSchema as a0_0x443a8f}from'@modelcontextprotocol/sdk/types.js';function p(_0x592312){const _0x34f317=a0_0x17e3;if(!a0_0x56ee36(_0x592312))return;for(let _0x46f4c5 of a0_0x2631e6(_0x592312,_0x34f317(0x210))['split']('\x0a')){let _0x58b316=_0x46f4c5[_0x34f317(0x24c)]();if(!_0x58b316||_0x58b316[_0x34f317(0x231)]('#'))continue;let _0x2a09f4=_0x58b316[_0x34f317(0x266)]('=');if(_0x2a09f4<0x0)continue;let _0x4b3e8e=_0x58b316[_0x34f317(0x208)](0x0,_0x2a09f4)['trim'](),_0x4a79a7=_0x58b316[_0x34f317(0x208)](_0x2a09f4+0x1)['trim']()[_0x34f317(0x27c)](/^["']|["']$/g,'');if(!process.env[_0x4b3e8e])process.env[_0x4b3e8e]=_0x4a79a7;}}var C=process.env.HOME||'~',T=a0_0x5b5672(C,a0_0x3e6d72(0x235));p(a0_0x5b5672(T,'.env'));var L=process[a0_0x3e6d72(0x256)]()[a0_0x3e6d72(0x27c)](/\//g,'-');p(a0_0x5b5672(T,L,a0_0x3e6d72(0x1ff)));function U(){const _0x311930=a0_0x3e6d72;try{return a0_0x233a98(_0x311930(0x227),{'encoding':_0x311930(0x210),'timeout':0x7d0})[_0x311930(0x24c)]();}catch{return'';}}function v(){const _0x3338fd=a0_0x3e6d72;try{let _0x10a3fb=a0_0x5b5672(C,_0x3338fd(0x1f8),'config.json');if(a0_0x56ee36(_0x10a3fb))return JSON[_0x3338fd(0x214)](a0_0x2631e6(_0x10a3fb,_0x3338fd(0x210)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x3e6d72(0x26f)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x342df9(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x1bf8c9(),X=process.env.COMMHUB_TOKEN||H[a0_0x3e6d72(0x225)]||'';function Y(_0x2de9c1){const _0xdebd=a0_0x3e6d72;let _0x32128b=new Date()[_0xdebd(0x252)]()['slice'](0x0,0x8);process[_0xdebd(0x22e)][_0xdebd(0x213)]('['+_0x32128b+']\x20[commhub]\x20'+_0x2de9c1+'\x0a');}function h(_0x2175d1){return new Promise(_0x537899=>setTimeout(_0x537899,_0x2175d1));}Y('ENV:\x20URL='+f+'\x20ALIAS='+Z+a0_0x3e6d72(0x203)+w[a0_0x3e6d72(0x208)](0x0,0x8)+'...\x20TMUX='+(j||a0_0x3e6d72(0x24d))+a0_0x3e6d72(0x25c)+process['cwd']()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x198c9f({'name':a0_0x3e6d72(0x267),'version':a0_0x3e6d72(0x269)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x3e6d72(0x1fb),a0_0x3e6d72(0x228),a0_0x3e6d72(0x238),a0_0x3e6d72(0x247),a0_0x3e6d72(0x261)+Z][a0_0x3e6d72(0x218)]('\x0a')});function a0_0x17e3(_0x2c139a,_0x4d669c){_0x2c139a=_0x2c139a-0x1f0;const _0x3b9fd9=a0_0x3b9f();let _0x17e30d=_0x3b9fd9[_0x2c139a];return _0x17e30d;}K[a0_0x3e6d72(0x219)](a0_0x4177a8,async()=>({'tools':[{'name':'commhub_reply','description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x3e6d72(0x212),'properties':{'task_id':{'type':a0_0x3e6d72(0x23d),'description':a0_0x3e6d72(0x22a)},'text':{'type':a0_0x3e6d72(0x23d),'description':a0_0x3e6d72(0x20c)},'status':{'type':'string','enum':[a0_0x3e6d72(0x230),a0_0x3e6d72(0x223),a0_0x3e6d72(0x241),a0_0x3e6d72(0x202),a0_0x3e6d72(0x273),a0_0x3e6d72(0x258)],'description':a0_0x3e6d72(0x206)}},'required':[a0_0x3e6d72(0x220)]}},{'name':a0_0x3e6d72(0x207),'description':a0_0x3e6d72(0x279),'inputSchema':{'type':a0_0x3e6d72(0x212),'properties':{'status':{'type':a0_0x3e6d72(0x23d),'enum':['working','idle','blocked',a0_0x3e6d72(0x273)]},'task':{'type':a0_0x3e6d72(0x23d),'description':a0_0x3e6d72(0x24e)},'progress':{'type':a0_0x3e6d72(0x201),'description':'Progress\x200-100'}},'required':[a0_0x3e6d72(0x20b)]}},{'name':'commhub_send_task','description':a0_0x3e6d72(0x217),'inputSchema':{'type':a0_0x3e6d72(0x212),'properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'task':{'type':a0_0x3e6d72(0x23d),'description':a0_0x3e6d72(0x23f)},'priority':{'type':'string','enum':[a0_0x3e6d72(0x255),a0_0x3e6d72(0x1f2),a0_0x3e6d72(0x22c)],'description':'Priority\x20(default:\x20normal)'}},'required':['alias',a0_0x3e6d72(0x1fd)]}},{'name':a0_0x3e6d72(0x21b),'description':a0_0x3e6d72(0x243),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x3e6d72(0x23d),'description':a0_0x3e6d72(0x23b)},'message':{'type':a0_0x3e6d72(0x23d),'description':a0_0x3e6d72(0x275)}},'required':[a0_0x3e6d72(0x21e),a0_0x3e6d72(0x22f)]}},{'name':a0_0x3e6d72(0x277),'description':a0_0x3e6d72(0x23c),'inputSchema':{'type':'object','properties':{}}}]}));async function P(_0xd486dd,_0x47f3f8){const _0x573490=a0_0x3e6d72;let _0x35c0c1=await fetch(f+_0x573490(0x263),{'method':'POST','headers':{'Content-Type':_0x573490(0x1f7),'Accept':_0x573490(0x257),...X?{'Authorization':_0x573490(0x24f)+X}:{}},'body':JSON[_0x573490(0x20f)]({'jsonrpc':_0x573490(0x249),'id':0x1,'method':_0x573490(0x234),'params':{'protocolVersion':_0x573490(0x270),'capabilities':{},'clientInfo':{'name':_0x573490(0x267),'version':_0x573490(0x269)}}})});if(!_0x35c0c1['ok']){let _0x3e0c3d=await _0x35c0c1[_0x573490(0x220)]();return Y(_0x573490(0x253)+_0x35c0c1[_0x573490(0x20b)]+'\x20'+_0x3e0c3d[_0x573490(0x208)](0x0,0x64)),{'ok':!0x1,'error':_0x573490(0x26d)+_0x35c0c1[_0x573490(0x20b)]};}await _0x35c0c1[_0x573490(0x220)]();let _0x70041d=(await(await fetch(f+'/mcp',{'method':'POST','headers':{'Content-Type':'application/json','Accept':_0x573490(0x257),...X?{'Authorization':_0x573490(0x24f)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x2,'method':'tools/call','params':{'name':_0xd486dd,'arguments':_0x47f3f8}})}))[_0x573490(0x220)]())['split']('\x0a')[_0x573490(0x232)](_0x46ef7f=>_0x46ef7f[_0x573490(0x231)](_0x573490(0x244)));if(_0x70041d){let _0x5ea2f9=JSON[_0x573490(0x214)](_0x70041d['slice'](0x6));return _0x5ea2f9?.[_0x573490(0x272)]?.[_0x573490(0x237)]?.[0x0]?.[_0x573490(0x220)]?JSON[_0x573490(0x214)](_0x5ea2f9[_0x573490(0x272)][_0x573490(0x237)][0x0][_0x573490(0x220)]):_0x5ea2f9;}return{'ok':!0x1,'error':_0x573490(0x224)};}function a0_0x3b9f(){const _0x2a8db7=['commhub_send_task','\x20from\x20','init\x20failed:\x20','type','hub','2025-03-26','split','result','error','fatal:\x20','Message\x20content','read','commhub_get_all_status','from_session','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.',':\x20inbox_count=','decode','replace','get_all_status','42mKocIe','normal','connecting\x20to\x20','message_id','commhub','get_inbox','application/json','.anet','SIGTERM','connect','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','send_reply','task','idle','.env','SSE\x20stream\x20ended,\x20reconnecting...','number','blocked','\x20RESUME_ID=','warning:\x20could\x20not\x20register:\x20','statusText','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','commhub_report_status','slice','\x20priority=','broadcast','status','Reply\x20text\x20/\x20result\x20summary','10536uWPweg','42bQeUpj','stringify','utf-8','1093914ATnHvJ','object','write','parse','45DHtlho','priority','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','join','setRequestHandler','notifications/claude/channel','commhub_send_message','MCP\x20stdio\x20connected','Authorization','alias','body','text','messages','ready\x20—\x20waiting\x20for\x20events','failed','no\x20response','token','params','tmux\x20display-message\x20-p\x20\x27#S\x27','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','from','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','28174ourXri','low','SSE\x20fatal:\x20','stderr','message','completed','startsWith','find','135816QmglMh','initialize','.claude/channels/commhub','20xwaZqf','content','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','catch','session\x20disconnected','Target\x20session\x20alias','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','string','delete','Task\x20content','commhub_reply','cancelled','send_task','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','data:\x20','stdin','working','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','ack_inbox','2.0','/events/','notification','trim','none','Current\x20task\x20description','Bearer\x20','replied','SIGINT','toTimeString','CommHub\x20init\x20failed:\x20','5255668nOOfRE','high','cwd','application/json,\x20text/event-stream','in_progress','exit','then','711448iMUqqL','\x20CWD=','pop','1195650pDvJbY','report_status','set','Session\x20alias:\x20','end','/mcp','claude-code','send_message','indexOf','commhub-channel','inbox_count','0.3.0','←\x20message\x20from\x20'];a0_0x3b9f=function(){return _0x2a8db7;};return a0_0x3b9f();}K[a0_0x3e6d72(0x219)](a0_0x443a8f,async _0x3eb3ff=>{const _0x170b6d=a0_0x3e6d72;let {name:_0x63a199,arguments:_0x38e36b}=_0x3eb3ff[_0x170b6d(0x226)];if(_0x63a199===_0x170b6d(0x240)){let {task_id:_0x2874ac,text:_0x4d8d97,status:_0x23e766}=_0x38e36b;if(_0x23e766==='completed'||_0x23e766==='failed'||_0x23e766===_0x170b6d(0x241)){let _0x4ec15b=_0x23e766===_0x170b6d(0x230)?_0x170b6d(0x250):_0x23e766,_0xb33690=_0x2874ac?k['get'](_0x2874ac)||_0x170b6d(0x26f):_0x170b6d(0x26f),_0x2e91c2=await P(_0x170b6d(0x1fc),{'alias':_0xb33690,'text':_0x4d8d97,'in_reply_to':_0x2874ac||void 0x0,'status':_0x4ec15b,'from_session':Z});if(_0x2874ac)k[_0x170b6d(0x23e)](_0x2874ac);return{'content':[{'type':_0x170b6d(0x220),'text':JSON['stringify'](_0x2e91c2)}]};}let _0x3242d0=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x23e766===_0x170b6d(0x202)?'blocked':_0x23e766===_0x170b6d(0x273)?_0x170b6d(0x273):_0x170b6d(0x246),'task':_0x4d8d97[_0x170b6d(0x208)](0x0,0xc8),'output':_0x4d8d97});return{'content':[{'type':_0x170b6d(0x220),'text':JSON[_0x170b6d(0x20f)](_0x3242d0)}]};}if(_0x63a199==='commhub_report_status'){let {status:_0x45eeb3,task:_0x3f1c65,progress:_0x3e3dc5}=_0x38e36b,_0x50c84c=await P(_0x170b6d(0x25f),{'resume_id':w,'alias':Z,'status':_0x45eeb3,'task':_0x3f1c65,'progress':_0x3e3dc5});return{'content':[{'type':_0x170b6d(0x220),'text':JSON['stringify'](_0x50c84c)}]};}if(_0x63a199===_0x170b6d(0x26b)){let {alias:_0x31ce6d,task:_0x430e07,priority:_0xa138fa}=_0x38e36b,_0x18362c=await P(_0x170b6d(0x242),{'alias':_0x31ce6d,'task':_0x430e07,'priority':_0xa138fa||_0x170b6d(0x1f2),'from_session':Z});return{'content':[{'type':_0x170b6d(0x220),'text':JSON[_0x170b6d(0x20f)](_0x18362c)}]};}if(_0x63a199===_0x170b6d(0x21b)){let {alias:_0x2c205f,message:_0x5dc537}=_0x38e36b,_0x32a630=await P(_0x170b6d(0x265),{'alias':_0x2c205f,'message':_0x5dc537,'from_session':Z});return{'content':[{'type':_0x170b6d(0x220),'text':JSON[_0x170b6d(0x20f)](_0x32a630)}]};}if(_0x63a199===_0x170b6d(0x277)){let _0x3c9ff7=await P(_0x170b6d(0x1f0),{});return{'content':[{'type':_0x170b6d(0x220),'text':JSON[_0x170b6d(0x20f)](_0x3c9ff7)}]};}return{'content':[{'type':_0x170b6d(0x220),'text':JSON[_0x170b6d(0x20f)]({'error':'unknown\x20tool'})}]};});async function u(){const _0x4bcf30=a0_0x3e6d72;let _0x285c3b=f+_0x4bcf30(0x24a)+encodeURIComponent(Z),_0x490c36={};if(X)_0x490c36[_0x4bcf30(0x21d)]=_0x4bcf30(0x24f)+X;Y(_0x4bcf30(0x1f3)+_0x285c3b);while(!0x0){try{let _0x41f9a7=await fetch(_0x285c3b,{'headers':_0x490c36});if(!_0x41f9a7['ok']){Y('SSE\x20error:\x20'+_0x41f9a7[_0x4bcf30(0x20b)]+'\x20'+_0x41f9a7[_0x4bcf30(0x205)]),await h(0x1388);continue;}let _0x4591a2=_0x41f9a7[_0x4bcf30(0x21f)]['getReader'](),_0x3a5520=new TextDecoder(),_0x2b9692='';while(!0x0){let {done:_0x48ed25,value:_0x4d42cd}=await _0x4591a2[_0x4bcf30(0x276)]();if(_0x48ed25)break;_0x2b9692+=_0x3a5520[_0x4bcf30(0x27b)](_0x4d42cd,{'stream':!0x0});let _0x192dea=_0x2b9692[_0x4bcf30(0x271)]('\x0a\x0a');_0x2b9692=_0x192dea[_0x4bcf30(0x25d)]()||'';for(let _0x435941 of _0x192dea){let _0x7a6b68=_0x435941[_0x4bcf30(0x271)]('\x0a')[_0x4bcf30(0x232)](_0x202540=>_0x202540['startsWith'](_0x4bcf30(0x244)));if(!_0x7a6b68)continue;try{let _0x4cc814=JSON[_0x4bcf30(0x214)](_0x7a6b68[_0x4bcf30(0x208)](0x6));await S(_0x4cc814);}catch(_0xa2dca0){Y('parse\x20error:\x20'+_0xa2dca0);}}}Y(_0x4bcf30(0x200));}catch(_0x6b6443){Y('SSE\x20connection\x20error:\x20'+_0x6b6443);}await h(0xbb8);}}async function S(_0x4e35bb){const _0x49471d=a0_0x3e6d72;if(_0x4e35bb[_0x49471d(0x26e)]==='connected'){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x4e35bb['type']==='new_message'){if(Y(_0x49471d(0x26a)+_0x4e35bb[_0x49471d(0x229)]+':\x20'+_0x4e35bb[_0x49471d(0x22f)][_0x49471d(0x208)](0x0,0x3c)),await K[_0x49471d(0x24b)]({'method':_0x49471d(0x21a),'params':{'content':_0x4e35bb[_0x49471d(0x22f)],'meta':{'sender':_0x4e35bb['from']||_0x49471d(0x26f),'sender_id':_0x49471d(0x1f5),'user':_0x4e35bb[_0x49471d(0x229)]||_0x49471d(0x26f),'priority':_0x49471d(0x1f2)}}}),_0x4e35bb[_0x49471d(0x1f4)])await P(_0x49471d(0x248),{'alias':Z,'message_id':_0x4e35bb[_0x49471d(0x1f4)]});return;}if(_0x4e35bb[_0x49471d(0x26e)]==='new_task'||_0x4e35bb[_0x49471d(0x26e)]===_0x49471d(0x20a)){Y('←\x20'+_0x4e35bb[_0x49471d(0x26e)]+_0x49471d(0x27a)+_0x4e35bb[_0x49471d(0x268)]+_0x49471d(0x209)+(_0x4e35bb[_0x49471d(0x216)]||_0x49471d(0x1f2)));let _0x4dfb76=await P(_0x49471d(0x1f6),{'alias':Z,'limit':0x5});if(_0x4dfb76?.['ok']&&_0x4dfb76[_0x49471d(0x221)]?.['length']>0x0)for(let _0x2e7391 of _0x4dfb76[_0x49471d(0x221)]){let _0x25a297={'sender':_0x2e7391[_0x49471d(0x278)]||_0x49471d(0x26f),'sender_id':_0x49471d(0x1f5),'user':_0x2e7391[_0x49471d(0x278)]||_0x49471d(0x26f),'task_id':_0x2e7391['id'],'priority':_0x2e7391['priority']||_0x49471d(0x1f2)};k[_0x49471d(0x260)](_0x2e7391['id'],_0x2e7391[_0x49471d(0x278)]||_0x49471d(0x26f)),await K[_0x49471d(0x24b)]({'method':_0x49471d(0x21a),'params':{'content':_0x2e7391['content'],'meta':_0x25a297}}),Y('→\x20injected\x20task\x20'+_0x2e7391['id'][_0x49471d(0x208)](0x0,0x8)+_0x49471d(0x26c)+_0x2e7391[_0x49471d(0x278)]+':\x20'+_0x2e7391[_0x49471d(0x237)]['slice'](0x0,0x3c)),await P(_0x49471d(0x248),{'alias':Z,'message_id':_0x2e7391['id']});}}}async function A(){const _0x26c037=a0_0x3e6d72;let _0x135164=new a0_0x3e4b81();await K[_0x26c037(0x1fa)](_0x135164),Y(_0x26c037(0x21c)),Y('starting\x20SSE\x20listener...'),u()[_0x26c037(0x239)](_0x327f5c=>Y(_0x26c037(0x22d)+_0x327f5c)),P('report_status',{'resume_id':w,'alias':Z,'status':_0x26c037(0x1fe),'server':a0_0x342df9(),'hostname':a0_0x342df9(),'agent':_0x26c037(0x264),'project_dir':process[_0x26c037(0x256)](),'tmux_name':j||void 0x0})[_0x26c037(0x25a)](()=>Y('registered\x20as\x20\x22'+Z+'\x22\x20('+w[_0x26c037(0x208)](0x0,0x8)+')'))[_0x26c037(0x239)](_0x451235=>Y(_0x26c037(0x204)+_0x451235)),setInterval(()=>{const _0x3c4b2b=_0x26c037;P(_0x3c4b2b(0x25f),{'resume_id':w,'alias':Z,'status':_0x3c4b2b(0x1fe),'server':a0_0x342df9(),'hostname':a0_0x342df9(),'agent':_0x3c4b2b(0x264),'project_dir':process[_0x3c4b2b(0x256)](),'tmux_name':j||void 0x0})[_0x3c4b2b(0x239)](_0x158b16=>Y('heartbeat\x20failed:\x20'+_0x158b16));},0x2bf20),Y(_0x26c037(0x222));}A()[a0_0x3e6d72(0x239)](_0x556b0f=>{const _0x9289cd=a0_0x3e6d72;Y(_0x9289cd(0x274)+_0x556b0f),process['exit'](0x1);});async function N(){const _0x4f64bf=a0_0x3e6d72;Y('shutting\x20down,\x20reporting\x20offline...'),await P(_0x4f64bf(0x25f),{'resume_id':w,'alias':Z,'status':_0x4f64bf(0x273),'task':_0x4f64bf(0x23a)})[_0x4f64bf(0x239)](()=>{}),process[_0x4f64bf(0x259)](0x0);}process[a0_0x3e6d72(0x245)]['on'](a0_0x3e6d72(0x262),()=>N()),process['on'](a0_0x3e6d72(0x1f9),()=>N()),process['on'](a0_0x3e6d72(0x251),()=>N());
2
+ const a0_0x1f921f=a0_0x5b87;(function(_0x92ca2d,_0xdcabd2){const _0xd815c6=a0_0x5b87,_0x56e5cc=_0x92ca2d();while(!![]){try{const _0x283ba2=-parseInt(_0xd815c6(0x22c))/0x1*(parseInt(_0xd815c6(0x1df))/0x2)+-parseInt(_0xd815c6(0x234))/0x3+parseInt(_0xd815c6(0x1f8))/0x4*(parseInt(_0xd815c6(0x21d))/0x5)+-parseInt(_0xd815c6(0x21e))/0x6+parseInt(_0xd815c6(0x232))/0x7*(parseInt(_0xd815c6(0x1de))/0x8)+parseInt(_0xd815c6(0x1d1))/0x9+parseInt(_0xd815c6(0x207))/0xa*(parseInt(_0xd815c6(0x233))/0xb);if(_0x283ba2===_0xdcabd2)break;else _0x56e5cc['push'](_0x56e5cc['shift']());}catch(_0x5c2d9a){_0x56e5cc['push'](_0x56e5cc['shift']());}}}(a0_0x4216,0x594b5));import{readFileSync as a0_0x4f884a,existsSync as a0_0x587c12}from'fs';function a0_0x5b87(_0x25f8d6,_0x412276){_0x25f8d6=_0x25f8d6-0x1d1;const _0x421618=a0_0x4216();let _0x5b8784=_0x421618[_0x25f8d6];return _0x5b8784;}import{randomUUID as a0_0x34b683}from'crypto';import{join as a0_0x1f98a4}from'path';import{hostname as a0_0x116d52}from'os';import{execSync as a0_0x1be896}from'child_process';import{Server as a0_0x146840}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x51fe97}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x140c99,CallToolRequestSchema as a0_0x5560f9}from'@modelcontextprotocol/sdk/types.js';function p(_0x4c8407){const _0x56e4a2=a0_0x5b87;if(!a0_0x587c12(_0x4c8407))return;for(let _0x54e779 of a0_0x4f884a(_0x4c8407,_0x56e4a2(0x25e))[_0x56e4a2(0x201)]('\x0a')){let _0x4abdb9=_0x54e779[_0x56e4a2(0x23a)]();if(!_0x4abdb9||_0x4abdb9[_0x56e4a2(0x20c)]('#'))continue;let _0x45b178=_0x4abdb9['indexOf']('=');if(_0x45b178<0x0)continue;let _0x138b39=_0x4abdb9['slice'](0x0,_0x45b178)[_0x56e4a2(0x23a)](),_0xbaf729=_0x4abdb9['slice'](_0x45b178+0x1)[_0x56e4a2(0x23a)]()[_0x56e4a2(0x223)](/^["']|["']$/g,'');if(!process.env[_0x138b39])process.env[_0x138b39]=_0xbaf729;}}var C=process.env.HOME||'~',T=a0_0x1f98a4(C,'.claude/channels/commhub');p(a0_0x1f98a4(T,a0_0x1f921f(0x211)));var L=process[a0_0x1f921f(0x240)]()['replace'](/\//g,'-');p(a0_0x1f98a4(T,L,'.env'));function U(){const _0xeff77c=a0_0x1f921f;try{return a0_0x1be896(_0xeff77c(0x206),{'encoding':'utf-8','timeout':0x7d0})['trim']();}catch{return'';}}function v(){const _0x3cc6ab=a0_0x1f921f;try{let _0x1cd45a=a0_0x1f98a4(C,_0x3cc6ab(0x23e),_0x3cc6ab(0x248));if(a0_0x587c12(_0x1cd45a))return JSON[_0x3cc6ab(0x1e9)](a0_0x4f884a(_0x1cd45a,_0x3cc6ab(0x25e)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x1f921f(0x251)]||a0_0x1f921f(0x21c),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x116d52(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x34b683(),X=process.env.COMMHUB_TOKEN||H[a0_0x1f921f(0x227)]||'';function Y(_0x4213b6){const _0x422b10=a0_0x1f921f;let _0x5ecf92=new Date()['toTimeString']()[_0x422b10(0x21a)](0x0,0x8);process[_0x422b10(0x20f)]['write']('['+_0x5ecf92+_0x422b10(0x23d)+_0x4213b6+'\x0a');}function h(_0xa02ce3){return new Promise(_0x20421e=>setTimeout(_0x20421e,_0xa02ce3));}Y(a0_0x1f921f(0x21f)+f+a0_0x1f921f(0x222)+Z+a0_0x1f921f(0x20d)+w[a0_0x1f921f(0x21a)](0x0,0x8)+a0_0x1f921f(0x246)+(j||'none')+a0_0x1f921f(0x252)+process['cwd']()+a0_0x1f921f(0x1d2)+L);var k=new Map(),K=new a0_0x146840({'name':a0_0x1f921f(0x237),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x1f921f(0x24a),a0_0x1f921f(0x1db),a0_0x1f921f(0x20e),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x1f921f(0x24d)+Z][a0_0x1f921f(0x1fa)]('\x0a')});function a0_0x4216(){const _0x105537=['data:\x20','new_task','catch','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Bearer\x20','number','get_inbox','inbox_count','working','utf-8','182529ZOINzN','\x20PROJECT_ENV=','priority','from','Priority\x20(default:\x20normal)','SSE\x20connected\x20as\x20\x22','end','registered\x20as\x20\x22','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','heartbeat\x20failed:\x20','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Target\x20session\x20alias','tools/call','8sBXZiU','2BJlfWU','message_id','message','notifications/claude/channel','commhub_send_message','unknown\x20tool','type','no\x20response','commhub','/events/','parse','replied','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','connected','messages','stdin','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','find','2.0','connect','get','read','body','send_reply','session\x20disconnected','500316vXzOOy','initialize','join','commhub_get_all_status','Task\x20content','CommHub\x20init\x20failed:\x20','task','Current\x20task\x20description','text','split','application/json,\x20text/event-stream','idle','cancelled','decode','tmux\x20display-message\x20-p\x20\x27#S\x27','10hhfINw','getReader','new_message','setRequestHandler','/mcp','startsWith','\x20RESUME_ID=','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','stderr','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','.env','SSE\x20connection\x20error:\x20','then','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','object','low','string','2025-03-26','content','slice','←\x20message\x20from\x20','http://127.0.0.1:9200','15TjTHUq','2518674fGuppK','ENV:\x20URL=','statusText','→\x20injected\x20task\x20','\x20ALIAS=','replace','error','Message\x20content','ready\x20—\x20waiting\x20for\x20events','token','SIGTERM','init\x20failed:\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','stringify','440261NqyNjG','length','exit','status','SSE\x20fatal:\x20','ack_inbox','4935679hRftfi','3686155viKmnL','629793vmvGFX','Reply\x20text\x20/\x20result\x20summary','result','commhub-channel','get_all_status','report_status','trim','POST','commhub_reply',']\x20[commhub]\x20','.anet','alias','cwd','normal','failed','completed','claude-code','commhub_report_status','...\x20TMUX=','notification','config.json','blocked','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','application/json','commhub_send_task','Session\x20alias:\x20','\x20priority=','warning:\x20could\x20not\x20register:\x20','0.3.0','hub','\x20CWD=','from_session','send_message'];a0_0x4216=function(){return _0x105537;};return a0_0x4216();}K[a0_0x1f921f(0x20a)](a0_0x140c99,async()=>({'tools':[{'name':a0_0x1f921f(0x23c),'description':a0_0x1f921f(0x22a),'inputSchema':{'type':a0_0x1f921f(0x215),'properties':{'task_id':{'type':a0_0x1f921f(0x217),'description':a0_0x1f921f(0x214)},'text':{'type':'string','description':a0_0x1f921f(0x235)},'status':{'type':'string','enum':[a0_0x1f921f(0x243),a0_0x1f921f(0x242),a0_0x1f921f(0x204),a0_0x1f921f(0x249),'error','in_progress'],'description':a0_0x1f921f(0x210)}},'required':[a0_0x1f921f(0x200)]}},{'name':a0_0x1f921f(0x245),'description':a0_0x1f921f(0x258),'inputSchema':{'type':a0_0x1f921f(0x215),'properties':{'status':{'type':a0_0x1f921f(0x217),'enum':[a0_0x1f921f(0x25d),'idle',a0_0x1f921f(0x249),a0_0x1f921f(0x224)]},'task':{'type':a0_0x1f921f(0x217),'description':a0_0x1f921f(0x1ff)},'progress':{'type':a0_0x1f921f(0x25a),'description':'Progress\x200-100'}},'required':[a0_0x1f921f(0x22f)]}},{'name':a0_0x1f921f(0x24c),'description':a0_0x1f921f(0x1eb),'inputSchema':{'type':a0_0x1f921f(0x215),'properties':{'alias':{'type':a0_0x1f921f(0x217),'description':a0_0x1f921f(0x1dc)},'task':{'type':a0_0x1f921f(0x217),'description':a0_0x1f921f(0x1fc)},'priority':{'type':a0_0x1f921f(0x217),'enum':['high','normal',a0_0x1f921f(0x216)],'description':a0_0x1f921f(0x1d5)}},'required':['alias',a0_0x1f921f(0x1fe)]}},{'name':a0_0x1f921f(0x1e3),'description':a0_0x1f921f(0x1d9),'inputSchema':{'type':a0_0x1f921f(0x215),'properties':{'alias':{'type':a0_0x1f921f(0x217),'description':a0_0x1f921f(0x1dc)},'message':{'type':'string','description':a0_0x1f921f(0x225)}},'required':[a0_0x1f921f(0x23f),a0_0x1f921f(0x1e1)]}},{'name':a0_0x1f921f(0x1fb),'description':a0_0x1f921f(0x1ef),'inputSchema':{'type':a0_0x1f921f(0x215),'properties':{}}}]}));async function P(_0x21579c,_0x2263f1){const _0xf9c0c8=a0_0x1f921f;let _0x4c0e0e=await fetch(f+_0xf9c0c8(0x20b),{'method':_0xf9c0c8(0x23b),'headers':{'Content-Type':_0xf9c0c8(0x24b),'Accept':_0xf9c0c8(0x202),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x1,'method':_0xf9c0c8(0x1f9),'params':{'protocolVersion':_0xf9c0c8(0x218),'capabilities':{},'clientInfo':{'name':_0xf9c0c8(0x237),'version':_0xf9c0c8(0x250)}}})});if(!_0x4c0e0e['ok']){let _0x503d5b=await _0x4c0e0e[_0xf9c0c8(0x200)]();return Y(_0xf9c0c8(0x1fd)+_0x4c0e0e[_0xf9c0c8(0x22f)]+'\x20'+_0x503d5b[_0xf9c0c8(0x21a)](0x0,0x64)),{'ok':!0x1,'error':_0xf9c0c8(0x229)+_0x4c0e0e[_0xf9c0c8(0x22f)]};}await _0x4c0e0e['text']();let _0x4a2b2b=(await(await fetch(f+'/mcp',{'method':_0xf9c0c8(0x23b),'headers':{'Content-Type':'application/json','Accept':_0xf9c0c8(0x202),...X?{'Authorization':_0xf9c0c8(0x259)+X}:{}},'body':JSON[_0xf9c0c8(0x22b)]({'jsonrpc':_0xf9c0c8(0x1f1),'id':0x2,'method':_0xf9c0c8(0x1dd),'params':{'name':_0x21579c,'arguments':_0x2263f1}})}))[_0xf9c0c8(0x200)]())[_0xf9c0c8(0x201)]('\x0a')[_0xf9c0c8(0x1f0)](_0x5aad60=>_0x5aad60[_0xf9c0c8(0x20c)](_0xf9c0c8(0x255)));if(_0x4a2b2b){let _0x2ce1cc=JSON[_0xf9c0c8(0x1e9)](_0x4a2b2b[_0xf9c0c8(0x21a)](0x6));return _0x2ce1cc?.[_0xf9c0c8(0x236)]?.[_0xf9c0c8(0x219)]?.[0x0]?.[_0xf9c0c8(0x200)]?JSON[_0xf9c0c8(0x1e9)](_0x2ce1cc[_0xf9c0c8(0x236)][_0xf9c0c8(0x219)][0x0]['text']):_0x2ce1cc;}return{'ok':!0x1,'error':_0xf9c0c8(0x1e6)};}K[a0_0x1f921f(0x20a)](a0_0x5560f9,async _0x2da047=>{const _0x5df8e8=a0_0x1f921f;let {name:_0x5bd268,arguments:_0x4175d3}=_0x2da047['params'];if(_0x5bd268===_0x5df8e8(0x23c)){let {task_id:_0x4959e8,text:_0x203018,status:_0x3ea46c}=_0x4175d3;if(_0x3ea46c==='completed'||_0x3ea46c===_0x5df8e8(0x242)||_0x3ea46c==='cancelled'){let _0x5ac1e0=_0x3ea46c===_0x5df8e8(0x243)?_0x5df8e8(0x1ea):_0x3ea46c,_0x57d812=_0x4959e8?k[_0x5df8e8(0x1f3)](_0x4959e8)||_0x5df8e8(0x251):_0x5df8e8(0x251),_0x559d4c=await P(_0x5df8e8(0x1f6),{'alias':_0x57d812,'text':_0x203018,'in_reply_to':_0x4959e8||void 0x0,'status':_0x5ac1e0,'from_session':Z});if(_0x4959e8)k['delete'](_0x4959e8);return{'content':[{'type':_0x5df8e8(0x200),'text':JSON[_0x5df8e8(0x22b)](_0x559d4c)}]};}let _0x596c81=await P(_0x5df8e8(0x239),{'resume_id':w,'alias':Z,'status':_0x3ea46c==='blocked'?_0x5df8e8(0x249):_0x3ea46c===_0x5df8e8(0x224)?_0x5df8e8(0x224):_0x5df8e8(0x25d),'task':_0x203018[_0x5df8e8(0x21a)](0x0,0xc8),'output':_0x203018});return{'content':[{'type':_0x5df8e8(0x200),'text':JSON[_0x5df8e8(0x22b)](_0x596c81)}]};}if(_0x5bd268===_0x5df8e8(0x245)){let {status:_0x2dd303,task:_0x33bf6b,progress:_0xf3b3e3}=_0x4175d3,_0x25b3fa=await P(_0x5df8e8(0x239),{'resume_id':w,'alias':Z,'status':_0x2dd303,'task':_0x33bf6b,'progress':_0xf3b3e3});return{'content':[{'type':_0x5df8e8(0x200),'text':JSON[_0x5df8e8(0x22b)](_0x25b3fa)}]};}if(_0x5bd268===_0x5df8e8(0x24c)){let {alias:_0x1e1f5e,task:_0x33477c,priority:_0x2a2ab5}=_0x4175d3,_0x17b25b=await P('send_task',{'alias':_0x1e1f5e,'task':_0x33477c,'priority':_0x2a2ab5||_0x5df8e8(0x241),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x5df8e8(0x22b)](_0x17b25b)}]};}if(_0x5bd268===_0x5df8e8(0x1e3)){let {alias:_0x49a7bd,message:_0x3595dd}=_0x4175d3,_0x48a20a=await P(_0x5df8e8(0x254),{'alias':_0x49a7bd,'message':_0x3595dd,'from_session':Z});return{'content':[{'type':_0x5df8e8(0x200),'text':JSON[_0x5df8e8(0x22b)](_0x48a20a)}]};}if(_0x5bd268===_0x5df8e8(0x1fb)){let _0x223836=await P(_0x5df8e8(0x238),{});return{'content':[{'type':'text','text':JSON['stringify'](_0x223836)}]};}return{'content':[{'type':_0x5df8e8(0x200),'text':JSON[_0x5df8e8(0x22b)]({'error':_0x5df8e8(0x1e4)})}]};});async function u(){const _0x16cec5=a0_0x1f921f;let _0x575aa7=f+_0x16cec5(0x1e8)+encodeURIComponent(Z),_0x57fe5b={};if(X)_0x57fe5b['Authorization']=_0x16cec5(0x259)+X;Y('connecting\x20to\x20'+_0x575aa7);while(!0x0){try{let _0x25dda5=await fetch(_0x575aa7,{'headers':_0x57fe5b});if(!_0x25dda5['ok']){Y('SSE\x20error:\x20'+_0x25dda5[_0x16cec5(0x22f)]+'\x20'+_0x25dda5[_0x16cec5(0x220)]),await h(0x1388);continue;}let _0x1daa25=_0x25dda5[_0x16cec5(0x1f5)][_0x16cec5(0x208)](),_0x32d971=new TextDecoder(),_0x4c0f86='';while(!0x0){let {done:_0x517ed8,value:_0x55076d}=await _0x1daa25[_0x16cec5(0x1f4)]();if(_0x517ed8)break;_0x4c0f86+=_0x32d971[_0x16cec5(0x205)](_0x55076d,{'stream':!0x0});let _0x25ff0f=_0x4c0f86[_0x16cec5(0x201)]('\x0a\x0a');_0x4c0f86=_0x25ff0f['pop']()||'';for(let _0x1911e4 of _0x25ff0f){let _0x4be4f2=_0x1911e4[_0x16cec5(0x201)]('\x0a')[_0x16cec5(0x1f0)](_0x41ad3e=>_0x41ad3e[_0x16cec5(0x20c)]('data:\x20'));if(!_0x4be4f2)continue;try{let _0x301d3b=JSON[_0x16cec5(0x1e9)](_0x4be4f2['slice'](0x6));await S(_0x301d3b);}catch(_0x2801d8){Y('parse\x20error:\x20'+_0x2801d8);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x573617){Y(_0x16cec5(0x212)+_0x573617);}await h(0xbb8);}}async function S(_0x136b3c){const _0x11d270=a0_0x1f921f;if(_0x136b3c[_0x11d270(0x1e5)]===_0x11d270(0x1ec)){Y(_0x11d270(0x1d6)+Z+'\x22');return;}if(_0x136b3c[_0x11d270(0x1e5)]===_0x11d270(0x209)){if(Y(_0x11d270(0x21b)+_0x136b3c[_0x11d270(0x1d4)]+':\x20'+_0x136b3c['message'][_0x11d270(0x21a)](0x0,0x3c)),await K['notification']({'method':_0x11d270(0x1e2),'params':{'content':_0x136b3c[_0x11d270(0x1e1)],'meta':{'sender':_0x136b3c['from']||_0x11d270(0x251),'sender_id':'commhub','user':_0x136b3c['from']||_0x11d270(0x251),'priority':_0x11d270(0x241)}}}),_0x136b3c[_0x11d270(0x1e0)])await P(_0x11d270(0x231),{'alias':Z,'message_id':_0x136b3c[_0x11d270(0x1e0)]});return;}if(_0x136b3c['type']===_0x11d270(0x256)||_0x136b3c['type']==='broadcast'){Y('←\x20'+_0x136b3c[_0x11d270(0x1e5)]+':\x20inbox_count='+_0x136b3c[_0x11d270(0x25c)]+_0x11d270(0x24e)+(_0x136b3c[_0x11d270(0x1d3)]||_0x11d270(0x241)));let _0x35ba66=await P(_0x11d270(0x25b),{'alias':Z,'limit':0x5});if(_0x35ba66?.['ok']&&_0x35ba66[_0x11d270(0x1ed)]?.[_0x11d270(0x22d)]>0x0)for(let _0x3e23a4 of _0x35ba66['messages']){let _0x2f9160={'sender':_0x3e23a4['from_session']||_0x11d270(0x251),'sender_id':_0x11d270(0x1e7),'user':_0x3e23a4[_0x11d270(0x253)]||_0x11d270(0x251),'task_id':_0x3e23a4['id'],'priority':_0x3e23a4[_0x11d270(0x1d3)]||_0x11d270(0x241)};k['set'](_0x3e23a4['id'],_0x3e23a4[_0x11d270(0x253)]||_0x11d270(0x251)),await K[_0x11d270(0x247)]({'method':'notifications/claude/channel','params':{'content':_0x3e23a4['content'],'meta':_0x2f9160}}),Y(_0x11d270(0x221)+_0x3e23a4['id']['slice'](0x0,0x8)+'\x20from\x20'+_0x3e23a4['from_session']+':\x20'+_0x3e23a4[_0x11d270(0x219)][_0x11d270(0x21a)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x3e23a4['id']});}}}async function A(){const _0x1a7e37=a0_0x1f921f;let _0x50cce9=new a0_0x51fe97();await K[_0x1a7e37(0x1f2)](_0x50cce9),Y('MCP\x20stdio\x20connected'),Y('starting\x20SSE\x20listener...'),u()[_0x1a7e37(0x257)](_0xac0d9b=>Y(_0x1a7e37(0x230)+_0xac0d9b)),P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x116d52(),'hostname':a0_0x116d52(),'agent':_0x1a7e37(0x244),'project_dir':process[_0x1a7e37(0x240)](),'tmux_name':j||void 0x0})[_0x1a7e37(0x213)](()=>Y(_0x1a7e37(0x1d8)+Z+'\x22\x20('+w['slice'](0x0,0x8)+')'))[_0x1a7e37(0x257)](_0x5dc817=>Y(_0x1a7e37(0x24f)+_0x5dc817)),setInterval(()=>{const _0x7ff878=_0x1a7e37;P('report_status',{'resume_id':w,'alias':Z,'status':_0x7ff878(0x203),'server':a0_0x116d52(),'hostname':a0_0x116d52(),'agent':_0x7ff878(0x244),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x7ff878(0x257)](_0x24ac6b=>Y(_0x7ff878(0x1da)+_0x24ac6b));},0x2bf20),Y(_0x1a7e37(0x226));}A()[a0_0x1f921f(0x257)](_0x50ad74=>{const _0x1a5465=a0_0x1f921f;Y('fatal:\x20'+_0x50ad74),process[_0x1a5465(0x22e)](0x1);});async function N(){const _0x146193=a0_0x1f921f;Y('shutting\x20down,\x20reporting\x20offline...'),await P(_0x146193(0x239),{'resume_id':w,'alias':Z,'status':'error','task':_0x146193(0x1f7)})[_0x146193(0x257)](()=>{}),process['exit'](0x0);}process[a0_0x1f921f(0x1ee)]['on'](a0_0x1f921f(0x1d7),()=>N()),process['on'](a0_0x1f921f(0x228),()=>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.1-preview.0",
3
+ "version": "2.0.1-preview.1",
4
4
  "description": "AI Agent Network CLI \u2014 Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 39 commands.",
5
5
  "type": "module",
6
6
  "main": "dist/src/client.js",