@sleep2agi/agent-network 2.1.8 → 2.1.10-preview.0

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_0x36efff=a0_0x1d2e;function a0_0x1afd(){const _0x37910d=['POST','offline','1297413pEnTEs','replace','parse','status','now','disconnect','SSE\x20failed:\x20','387400oIgwRe','body','broadcast','s...','message','slice','getReader','decode','text','35FyUwQs','heartbeatInterval','log','signal','disconnected','type','content','idle','normal','catch','alias','SSE\x20connected','inbox\x20error:\x20','report_status','min','text/event-stream','application/json,\x20text/event-stream','5oagBuB','pop','1464294ebuATB','stringify','messages','connectSSE','toTimeString','Authorization','reply','getAllStatus','71856DqMJcz','call','get_inbox','heartbeatTimer','500NQJyxV','sdk-','from_session','new_task','read','SSE\x20reconnecting\x20in\x20','abort','ack_inbox','174594WqKqmL','heartbeat\x20failed:\x20','registered','sseAbort','reconnectDelay','AbortError','name','emit','application/json','toString','server','resumeId','connect','split','800476YTxkDk','task','new_message','sleep','url','SSE\x20error:\x20','connected','processInbox','151146eAkgzI','token','Bearer\x20','startsWith','cwd','agent',']\x20[commhub:','tools/call','running','send_reply','sdk','completed'];a0_0x1afd=function(){return _0x37910d;};return a0_0x1afd();}(function(_0x2a0f8f,_0x30cfb6){const _0x39db81=a0_0x1d2e,_0x27c726=_0x2a0f8f();while(!![]){try{const _0x18b88d=-parseInt(_0x39db81(0x14c))/0x1+-parseInt(_0x39db81(0x15a))/0x2+parseInt(_0x39db81(0x170))/0x3+parseInt(_0x39db81(0x140))/0x4+parseInt(_0x39db81(0x191))/0x5*(-parseInt(_0x39db81(0x193))/0x6)+-parseInt(_0x39db81(0x180))/0x7*(parseInt(_0x39db81(0x177))/0x8)+-parseInt(_0x39db81(0x162))/0x9*(-parseInt(_0x39db81(0x144))/0xa);if(_0x18b88d===_0x30cfb6)break;else _0x27c726['push'](_0x27c726['shift']());}catch(_0x4c8a82){_0x27c726['push'](_0x27c726['shift']());}}}(a0_0x1afd,0x37f09));import{EventEmitter as a0_0x138b8e}from'events';import{hostname as a0_0x936f13}from'os';class T extends a0_0x138b8e{[a0_0x36efff(0x15e)];['alias'];[a0_0x36efff(0x163)];[a0_0x36efff(0x167)];[a0_0x36efff(0x157)];['heartbeatInterval'];[a0_0x36efff(0x150)];[a0_0x36efff(0x143)];[a0_0x36efff(0x14f)];['running']=!0x1;constructor(_0x3aca8f){const _0x19cd06=a0_0x36efff;super();if(this['url']=_0x3aca8f['url'][_0x19cd06(0x171)](/\/$/,''),this[_0x19cd06(0x18a)]=_0x3aca8f[_0x19cd06(0x18a)],this[_0x19cd06(0x163)]=_0x3aca8f['token'],this[_0x19cd06(0x167)]=_0x3aca8f['agent']||_0x19cd06(0x16c),this['resumeId']=_0x19cd06(0x145)+_0x3aca8f[_0x19cd06(0x18a)]+'-'+Date['now']()[_0x19cd06(0x155)](0x24),this[_0x19cd06(0x181)]=_0x3aca8f[_0x19cd06(0x181)]??0x2bf20,this[_0x19cd06(0x150)]=_0x3aca8f['reconnectDelay']??0xbb8,_0x3aca8f['autoConnect']!==!0x1)this[_0x19cd06(0x158)]();}[a0_0x36efff(0x182)](_0x912bde){const _0x3d1cd4=a0_0x36efff;console[_0x3d1cd4(0x182)]('['+new Date()[_0x3d1cd4(0x13c)]()[_0x3d1cd4(0x17c)](0x0,0x8)+_0x3d1cd4(0x168)+this['alias']+']\x20'+_0x912bde);}async['call'](_0x285fad,_0x2cc2b4){const _0x3cb9a1=a0_0x36efff;let _0x1a32b4={'Content-Type':_0x3cb9a1(0x154),'Accept':_0x3cb9a1(0x190)};if(this[_0x3cb9a1(0x163)])_0x1a32b4[_0x3cb9a1(0x13d)]=_0x3cb9a1(0x164)+this[_0x3cb9a1(0x163)];let _0x559c1f=await(await fetch(this[_0x3cb9a1(0x15e)]+'/mcp',{'method':_0x3cb9a1(0x16e),'headers':_0x1a32b4,'body':JSON[_0x3cb9a1(0x194)]({'jsonrpc':'2.0','id':Date[_0x3cb9a1(0x174)](),'method':_0x3cb9a1(0x169),'params':{'name':_0x285fad,'arguments':_0x2cc2b4}})}))[_0x3cb9a1(0x17f)](),_0x36d2e9=_0x559c1f['match'](/data: (.+)/),_0x6964a8=_0x36d2e9?JSON[_0x3cb9a1(0x172)](_0x36d2e9[0x1]):JSON[_0x3cb9a1(0x172)](_0x559c1f),_0x283dcd=_0x6964a8?.['result']?.[_0x3cb9a1(0x186)]?.[0x0]?.[_0x3cb9a1(0x17f)];return _0x283dcd?JSON[_0x3cb9a1(0x172)](_0x283dcd):_0x6964a8;}async[a0_0x36efff(0x158)](){const _0x188419=a0_0x36efff;if(this[_0x188419(0x16a)])return;this[_0x188419(0x16a)]=!0x0,await this[_0x188419(0x173)]('idle'),this[_0x188419(0x182)](_0x188419(0x14e)),this[_0x188419(0x143)]=setInterval(()=>{const _0x5b088c=_0x188419;this[_0x5b088c(0x173)](_0x5b088c(0x187))[_0x5b088c(0x189)](_0x456606=>this[_0x5b088c(0x182)](_0x5b088c(0x14d)+_0x456606[_0x5b088c(0x17b)]));},this[_0x188419(0x181)]),this[_0x188419(0x13b)]();}async[a0_0x36efff(0x175)](){const _0x390573=a0_0x36efff;if(this[_0x390573(0x16a)]=!0x1,this['sseAbort']?.[_0x390573(0x14a)](),this['heartbeatTimer'])clearInterval(this[_0x390573(0x143)]);await this[_0x390573(0x173)](_0x390573(0x16f))['catch'](()=>{}),this[_0x390573(0x182)](_0x390573(0x184));}async['send'](_0x49d578,_0x230ec9,_0x307d2c=a0_0x36efff(0x188)){const _0x2deaef=a0_0x36efff;return this[_0x2deaef(0x141)]('send_task',{'alias':_0x49d578,'task':_0x230ec9,'priority':_0x307d2c,'from_session':this[_0x2deaef(0x18a)]});}async['message'](_0x4c2f47,_0x5b3ad5){const _0x57bd7e=a0_0x36efff;return this[_0x57bd7e(0x141)]('send_message',{'alias':_0x4c2f47,'message':_0x5b3ad5,'from_session':this[_0x57bd7e(0x18a)]});}async[a0_0x36efff(0x13e)](_0x3673ac,_0x140a2a,_0x55171f=a0_0x36efff(0x16d)){const _0x322752=a0_0x36efff;return this[_0x322752(0x141)](_0x322752(0x16b),{'in_reply_to':_0x3673ac,'text':_0x140a2a,'status':_0x55171f});}async[a0_0x36efff(0x173)](_0x243e27,_0x20401a){const _0x465ab7=a0_0x36efff;return this['call'](_0x465ab7(0x18d),{'resume_id':this[_0x465ab7(0x157)],'alias':this[_0x465ab7(0x18a)],'status':_0x243e27,'server':a0_0x936f13(),'hostname':a0_0x936f13(),'agent':this[_0x465ab7(0x167)],'project_dir':process[_0x465ab7(0x166)](),..._0x20401a});}async[a0_0x36efff(0x13f)](){const _0x3d0bdb=a0_0x36efff;return this[_0x3d0bdb(0x141)]('get_all_status',{});}async[a0_0x36efff(0x179)](_0x2fca51,_0x588dd5){const _0x45b977=a0_0x36efff;return this[_0x45b977(0x141)]('broadcast',{'message':_0x2fca51,'filter_server':_0x588dd5?.[_0x45b977(0x156)],'filter_status':_0x588dd5?.[_0x45b977(0x173)]});}async[a0_0x36efff(0x13b)](){const _0x570544=a0_0x36efff;let _0x2097b8=encodeURIComponent(this[_0x570544(0x18a)]),_0xf44d8e=this['url']+'/events/'+_0x2097b8,_0x4f2ea6=this['reconnectDelay'];while(this[_0x570544(0x16a)]){try{this[_0x570544(0x14f)]=new AbortController();let _0x49b231={'Accept':_0x570544(0x18f)};if(this[_0x570544(0x163)])_0x49b231[_0x570544(0x13d)]='Bearer\x20'+this[_0x570544(0x163)];let _0x26d0c0=await fetch(_0xf44d8e,{'headers':_0x49b231,'signal':this[_0x570544(0x14f)][_0x570544(0x183)]});if(!_0x26d0c0['ok']||!_0x26d0c0['body']){this['log'](_0x570544(0x176)+_0x26d0c0['status']),await this[_0x570544(0x15d)](_0x4f2ea6),_0x4f2ea6=Math[_0x570544(0x18e)](_0x4f2ea6*1.5,0xea60);continue;}_0x4f2ea6=this[_0x570544(0x150)];let _0x2709a8=_0x26d0c0[_0x570544(0x178)][_0x570544(0x17d)](),_0x55032b=new TextDecoder(),_0x488b33='';while(this[_0x570544(0x16a)]){let {done:_0x2cc05e,value:_0xe57969}=await _0x2709a8[_0x570544(0x148)]();if(_0x2cc05e)break;_0x488b33+=_0x55032b[_0x570544(0x17e)](_0xe57969,{'stream':!0x0});let _0x280f88=_0x488b33[_0x570544(0x159)]('\x0a');_0x488b33=_0x280f88[_0x570544(0x192)]()||'';for(let _0x30c873 of _0x280f88){if(!_0x30c873[_0x570544(0x165)]('data:\x20'))continue;try{let _0x544454=JSON[_0x570544(0x172)](_0x30c873['slice'](0x6));if(_0x544454[_0x570544(0x185)]===_0x570544(0x160)){this[_0x570544(0x182)](_0x570544(0x18b)),this[_0x570544(0x153)](_0x570544(0x160));continue;}if(_0x544454[_0x570544(0x185)]===_0x570544(0x147)||_0x544454[_0x570544(0x185)]===_0x570544(0x15c)||_0x544454['type']===_0x570544(0x179))await this['processInbox']();}catch{}}}}catch(_0x557fef){if(_0x557fef[_0x570544(0x152)]===_0x570544(0x151))break;this['emit']('error',_0x557fef),this['log'](_0x570544(0x15f)+_0x557fef[_0x570544(0x17b)]);}if(this[_0x570544(0x16a)])this[_0x570544(0x153)](_0x570544(0x184)),this['log'](_0x570544(0x149)+_0x4f2ea6/0x3e8+_0x570544(0x17a)),await this[_0x570544(0x15d)](_0x4f2ea6),_0x4f2ea6=Math[_0x570544(0x18e)](_0x4f2ea6*1.5,0xea60);}}async[a0_0x36efff(0x161)](){const _0x29694e=a0_0x36efff;try{let _0x467f7c=(await this[_0x29694e(0x141)](_0x29694e(0x142),{'alias':this[_0x29694e(0x18a)],'limit':0xa}))?.[_0x29694e(0x13a)]||[];for(let _0x464dd3 of _0x467f7c)await this[_0x29694e(0x141)](_0x29694e(0x14b),{'alias':this['alias'],'message_id':_0x464dd3['id']}),this[_0x29694e(0x182)]('←\x20'+_0x464dd3[_0x29694e(0x146)]+':\x20'+_0x464dd3['content'][_0x29694e(0x17c)](0x0,0x3c)),this[_0x29694e(0x153)](_0x29694e(0x15b),_0x464dd3),this['emit'](_0x29694e(0x17b),_0x464dd3);}catch(_0xee946f){this[_0x29694e(0x182)](_0x29694e(0x18c)+_0xee946f[_0x29694e(0x17b)]);}}[a0_0x36efff(0x15d)](_0x605900){return new Promise(_0xb696d5=>setTimeout(_0xb696d5,_0x605900));}}var $=T;function a0_0x1d2e(_0x2b34b7,_0x4bcef1){_0x2b34b7=_0x2b34b7-0x13a;const _0x1afdd8=a0_0x1afd();let _0x1d2e19=_0x1afdd8[_0x2b34b7];return _0x1d2e19;}export{$ as default,T as CommHub};
1
+ const a0_0x22272=a0_0x19d2;function a0_0x19d2(_0x44cde8,_0x3fe16c){_0x44cde8=_0x44cde8-0x1d6;const _0x449792=a0_0x4497();let _0x19d2dc=_0x449792[_0x44cde8];return _0x19d2dc;}(function(_0xd9066a,_0x5cb6a2){const _0x50def6=a0_0x19d2,_0x3f26b4=_0xd9066a();while(!![]){try{const _0x2f6917=-parseInt(_0x50def6(0x1d8))/0x1+parseInt(_0x50def6(0x1e6))/0x2+parseInt(_0x50def6(0x21b))/0x3*(parseInt(_0x50def6(0x22d))/0x4)+-parseInt(_0x50def6(0x1f2))/0x5*(parseInt(_0x50def6(0x22b))/0x6)+-parseInt(_0x50def6(0x227))/0x7+parseInt(_0x50def6(0x209))/0x8+parseInt(_0x50def6(0x1f5))/0x9*(parseInt(_0x50def6(0x1f4))/0xa);if(_0x2f6917===_0x5cb6a2)break;else _0x3f26b4['push'](_0x3f26b4['shift']());}catch(_0x317861){_0x3f26b4['push'](_0x3f26b4['shift']());}}}(a0_0x4497,0x403a1));import{EventEmitter as a0_0x649004}from'events';import{hostname as a0_0x46c1d1}from'os';class T extends a0_0x649004{[a0_0x22272(0x1e4)];[a0_0x22272(0x1ff)];[a0_0x22272(0x208)];['agent'];['resumeId'];['heartbeatInterval'];[a0_0x22272(0x22c)];[a0_0x22272(0x1ea)];['sseAbort'];['running']=!0x1;constructor(_0x5b3aa5){const _0x423b11=a0_0x22272;super();if(this[_0x423b11(0x1e4)]=_0x5b3aa5['url'][_0x423b11(0x211)](/\/$/,''),this[_0x423b11(0x1ff)]=_0x5b3aa5[_0x423b11(0x1ff)],this[_0x423b11(0x208)]=_0x5b3aa5[_0x423b11(0x208)],this['agent']=_0x5b3aa5[_0x423b11(0x1e9)]||_0x423b11(0x231),this[_0x423b11(0x1f6)]=_0x423b11(0x213)+_0x5b3aa5[_0x423b11(0x1ff)]+'-'+Date[_0x423b11(0x229)]()[_0x423b11(0x203)](0x24),this[_0x423b11(0x1dc)]=_0x5b3aa5[_0x423b11(0x1dc)]??0x2bf20,this[_0x423b11(0x22c)]=_0x5b3aa5['reconnectDelay']??0xbb8,_0x5b3aa5[_0x423b11(0x232)]!==!0x1)this['connect']();}['log'](_0x4d0dcf){const _0x13d3ae=a0_0x22272;console[_0x13d3ae(0x21f)]('['+new Date()[_0x13d3ae(0x223)]()[_0x13d3ae(0x1e7)](0x0,0x8)+']\x20[commhub:'+this[_0x13d3ae(0x1ff)]+']\x20'+_0x4d0dcf);}async['call'](_0x37c6dc,_0x21543d){const _0x38077c=a0_0x22272;let _0x32f7d1={'Content-Type':_0x38077c(0x22f),'Accept':_0x38077c(0x220)};if(this[_0x38077c(0x208)])_0x32f7d1['Authorization']=_0x38077c(0x226)+this['token'];let _0x162daf=await(await fetch(this['url']+'/mcp',{'method':_0x38077c(0x200),'headers':_0x32f7d1,'body':JSON[_0x38077c(0x1e0)]({'jsonrpc':_0x38077c(0x1f8),'id':Date[_0x38077c(0x229)](),'method':_0x38077c(0x205),'params':{'name':_0x37c6dc,'arguments':_0x21543d}})}))['text'](),_0xb80e61=_0x162daf[_0x38077c(0x233)](/data: (.+)/),_0x326c58=_0xb80e61?JSON[_0x38077c(0x1fe)](_0xb80e61[0x1]):JSON[_0x38077c(0x1fe)](_0x162daf),_0x1da9d9=_0x326c58?.[_0x38077c(0x1ec)]?.[_0x38077c(0x1f0)]?.[0x0]?.[_0x38077c(0x1ed)];return _0x1da9d9?JSON[_0x38077c(0x1fe)](_0x1da9d9):_0x326c58;}async['connect'](){const _0x4f1c3f=a0_0x22272;if(this[_0x4f1c3f(0x218)])return;this['running']=!0x0,await this['status'](_0x4f1c3f(0x20b)),this[_0x4f1c3f(0x21f)](_0x4f1c3f(0x214)),this[_0x4f1c3f(0x1ea)]=setInterval(()=>{const _0x202e8f=_0x4f1c3f;this[_0x202e8f(0x1fd)](_0x202e8f(0x20b))[_0x202e8f(0x225)](_0x535872=>this[_0x202e8f(0x21f)](_0x202e8f(0x230)+_0x535872['message']));},this[_0x4f1c3f(0x1dc)]),this[_0x4f1c3f(0x22e)]();}async[a0_0x22272(0x210)](){const _0x23c974=a0_0x22272;if(this[_0x23c974(0x218)]=!0x1,this['sseAbort']?.[_0x23c974(0x1df)](),this[_0x23c974(0x1ea)])clearInterval(this['heartbeatTimer']);await this[_0x23c974(0x1fd)](_0x23c974(0x228))['catch'](()=>{}),this[_0x23c974(0x21f)](_0x23c974(0x1fc));}async[a0_0x22272(0x1fb)](_0xfec47e,_0x4b7b3a,_0x2033bd=a0_0x22272(0x20f)){const _0x4bb089=a0_0x22272;return this[_0x4bb089(0x1e3)](_0x4bb089(0x221),{'alias':_0xfec47e,'task':_0x4b7b3a,'priority':_0x2033bd,'from_session':this[_0x4bb089(0x1ff)]});}async[a0_0x22272(0x201)](_0x3867f1,_0x2528d9){const _0x48da1d=a0_0x22272;return this[_0x48da1d(0x1e3)](_0x48da1d(0x21c),{'alias':_0x3867f1,'message':_0x2528d9,'from_session':this[_0x48da1d(0x1ff)]});}async[a0_0x22272(0x222)](_0x3a7e6a,_0x3a83f2,_0x2bd182=a0_0x22272(0x1f7)){const _0x334243=a0_0x22272;return this['call'](_0x334243(0x1d6),{'in_reply_to':_0x3a7e6a,'text':_0x3a83f2,'status':_0x2bd182});}async[a0_0x22272(0x1fd)](_0x3e3e99,_0x4d4474){const _0x116b70=a0_0x22272;return this[_0x116b70(0x1e3)](_0x116b70(0x21e),{'resume_id':this['resumeId'],'alias':this[_0x116b70(0x1ff)],'status':_0x3e3e99,'server':a0_0x46c1d1(),'hostname':a0_0x46c1d1(),'agent':this['agent'],'project_dir':process[_0x116b70(0x1f9)](),..._0x4d4474});}async[a0_0x22272(0x207)](){const _0x541197=a0_0x22272;return this[_0x541197(0x1e3)](_0x541197(0x20c),{});}async['broadcast'](_0x5282c5,_0x39d26e){const _0x376277=a0_0x22272;return this[_0x376277(0x1e3)](_0x376277(0x1ef),{'message':_0x5282c5,'filter_server':_0x39d26e?.[_0x376277(0x1e5)],'filter_status':_0x39d26e?.[_0x376277(0x1fd)]});}async[a0_0x22272(0x22e)](){const _0x1cd463=a0_0x22272;let _0x528b2c=encodeURIComponent(this[_0x1cd463(0x1ff)]),_0xdda0a8=this[_0x1cd463(0x1e4)]+_0x1cd463(0x1e2)+_0x528b2c,_0x16da15=this[_0x1cd463(0x22c)];while(this[_0x1cd463(0x218)]){try{this[_0x1cd463(0x22a)]=new AbortController();let _0x44d814={'Accept':_0x1cd463(0x215)};if(this['token'])_0x44d814[_0x1cd463(0x1db)]='Bearer\x20'+this['token'];let _0x476f6b=await fetch(_0xdda0a8,{'headers':_0x44d814,'signal':this[_0x1cd463(0x22a)][_0x1cd463(0x20e)]});if(!_0x476f6b['ok']||!_0x476f6b['body']){this[_0x1cd463(0x21f)](_0x1cd463(0x216)+_0x476f6b[_0x1cd463(0x1fd)]),await this[_0x1cd463(0x20d)](_0x16da15),_0x16da15=Math[_0x1cd463(0x1fa)](_0x16da15*1.5,0xea60);continue;}_0x16da15=this[_0x1cd463(0x22c)];let _0x10d115=_0x476f6b[_0x1cd463(0x21d)][_0x1cd463(0x1dd)](),_0x8834f8=new TextDecoder(),_0x19f105='';while(this['running']){let {done:_0x559110,value:_0xff483e}=await _0x10d115[_0x1cd463(0x1f1)]();if(_0x559110)break;_0x19f105+=_0x8834f8[_0x1cd463(0x1da)](_0xff483e,{'stream':!0x0});let _0x29aaeb=_0x19f105[_0x1cd463(0x206)]('\x0a');_0x19f105=_0x29aaeb[_0x1cd463(0x1e1)]()||'';for(let _0x4dd055 of _0x29aaeb){if(!_0x4dd055[_0x1cd463(0x202)](_0x1cd463(0x1d7)))continue;try{let _0x12e54f=JSON[_0x1cd463(0x1fe)](_0x4dd055[_0x1cd463(0x1e7)](0x6));if(_0x12e54f['type']==='connected'){this[_0x1cd463(0x21f)](_0x1cd463(0x1e8)),this[_0x1cd463(0x21a)](_0x1cd463(0x20a));continue;}if(_0x12e54f[_0x1cd463(0x1de)]===_0x1cd463(0x204)||_0x12e54f['type']==='new_message'||_0x12e54f[_0x1cd463(0x1de)]===_0x1cd463(0x1ef))await this['processInbox']();}catch{}}}}catch(_0x3010f2){if(_0x3010f2[_0x1cd463(0x1eb)]==='AbortError')break;this['emit'](_0x1cd463(0x224),_0x3010f2),this[_0x1cd463(0x21f)]('SSE\x20error:\x20'+_0x3010f2[_0x1cd463(0x201)]);}if(this[_0x1cd463(0x218)])this[_0x1cd463(0x21a)](_0x1cd463(0x1fc)),this['log']('SSE\x20reconnecting\x20in\x20'+_0x16da15/0x3e8+'s...'),await this['sleep'](_0x16da15),_0x16da15=Math[_0x1cd463(0x1fa)](_0x16da15*1.5,0xea60);}}async[a0_0x22272(0x1f3)](){const _0x533761=a0_0x22272;try{let _0xdcb018=(await this[_0x533761(0x1e3)](_0x533761(0x212),{'alias':this['alias'],'limit':0xa}))?.[_0x533761(0x219)]||[];for(let _0xbf9ca0 of _0xdcb018)await this[_0x533761(0x1e3)](_0x533761(0x1ee),{'alias':this[_0x533761(0x1ff)],'message_id':_0xbf9ca0['id']}),this[_0x533761(0x21f)]('←\x20'+_0xbf9ca0[_0x533761(0x1d9)]+':\x20'+_0xbf9ca0[_0x533761(0x1f0)][_0x533761(0x1e7)](0x0,0x3c)),this[_0x533761(0x21a)](_0x533761(0x217),_0xbf9ca0),this[_0x533761(0x21a)](_0x533761(0x201),_0xbf9ca0);}catch(_0x694c82){this['log']('inbox\x20error:\x20'+_0x694c82[_0x533761(0x201)]);}}[a0_0x22272(0x20d)](_0x25a416){return new Promise(_0x51a20e=>setTimeout(_0x51a20e,_0x25a416));}}var $=T;export{$ as default,T as CommHub};function a0_0x4497(){const _0x49f37a=['body','report_status','log','application/json,\x20text/event-stream','send_task','reply','toTimeString','error','catch','Bearer\x20','2356662fbCldr','offline','now','sseAbort','66IjQWYn','reconnectDelay','364AFZWeT','connectSSE','application/json','heartbeat\x20failed:\x20','sdk','autoConnect','match','send_reply','data:\x20','351375ndLqmC','from_session','decode','Authorization','heartbeatInterval','getReader','type','abort','stringify','pop','/events/','call','url','server','907694TxwICs','slice','SSE\x20connected','agent','heartbeatTimer','name','result','text','ack_inbox','broadcast','content','read','138680ZgqSpp','processInbox','74220cqgLGE','549TxAKwK','resumeId','completed','2.0','cwd','min','send','disconnected','status','parse','alias','POST','message','startsWith','toString','new_task','tools/call','split','getAllStatus','token','421504tPzbjm','connected','idle','get_all_status','sleep','signal','normal','disconnect','replace','get_inbox','sdk-','registered','text/event-stream','SSE\x20failed:\x20','task','running','messages','emit','9789ilzKqH','send_message'];a0_0x4497=function(){return _0x49f37a;};return a0_0x4497();}
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x33500c=a0_0x26ff;(function(_0x5b8fae,_0x2510bb){const _0x98abaf=a0_0x26ff,_0x4cdc44=_0x5b8fae();while(!![]){try{const _0x418d3f=parseInt(_0x98abaf(0xff))/0x1*(-parseInt(_0x98abaf(0xca))/0x2)+-parseInt(_0x98abaf(0x89))/0x3*(parseInt(_0x98abaf(0xd4))/0x4)+-parseInt(_0x98abaf(0x8f))/0x5+parseInt(_0x98abaf(0xdd))/0x6*(-parseInt(_0x98abaf(0x81))/0x7)+parseInt(_0x98abaf(0xa1))/0x8+parseInt(_0x98abaf(0x95))/0x9*(parseInt(_0x98abaf(0x86))/0xa)+parseInt(_0x98abaf(0xaf))/0xb;if(_0x418d3f===_0x2510bb)break;else _0x4cdc44['push'](_0x4cdc44['shift']());}catch(_0x63be5){_0x4cdc44['push'](_0x4cdc44['shift']());}}}(a0_0xb31a,0x716e2));import{readFileSync as a0_0x2bfbd9,existsSync as a0_0x3db3d4}from'fs';import{randomUUID as a0_0x552445}from'crypto';import{join as a0_0x2d7caa}from'path';import{hostname as a0_0x35d7f8}from'os';import{execSync as a0_0x4523a5}from'child_process';import{Server as a0_0x1bf77a}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x22d501}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x22e0c1,CallToolRequestSchema as a0_0xde2443}from'@modelcontextprotocol/sdk/types.js';function p(_0x1c66a9){const _0xfa26d9=a0_0x26ff;if(!a0_0x3db3d4(_0x1c66a9))return;for(let _0x343556 of a0_0x2bfbd9(_0x1c66a9,_0xfa26d9(0xa7))[_0xfa26d9(0xd5)]('\x0a')){let _0x24ed3a=_0x343556[_0xfa26d9(0xbb)]();if(!_0x24ed3a||_0x24ed3a[_0xfa26d9(0xc1)]('#'))continue;let _0x2b677a=_0x24ed3a[_0xfa26d9(0xdb)]('=');if(_0x2b677a<0x0)continue;let _0x1354aa=_0x24ed3a[_0xfa26d9(0xbe)](0x0,_0x2b677a)[_0xfa26d9(0xbb)](),_0x1d227d=_0x24ed3a[_0xfa26d9(0xbe)](_0x2b677a+0x1)['trim']()[_0xfa26d9(0xb0)](/^["']|["']$/g,'');if(!process.env[_0x1354aa])process.env[_0x1354aa]=_0x1d227d;}}var C=process.env.HOME||'~',T=a0_0x2d7caa(C,a0_0x33500c(0xe8));p(a0_0x2d7caa(T,a0_0x33500c(0x10a)));var L=process[a0_0x33500c(0x7f)]()[a0_0x33500c(0xb0)](/\//g,'-');p(a0_0x2d7caa(T,L,a0_0x33500c(0x10a)));function U(){const _0x10e02f=a0_0x33500c;try{return a0_0x4523a5(_0x10e02f(0xbf),{'encoding':_0x10e02f(0xa7),'timeout':0x7d0})[_0x10e02f(0xbb)]();}catch{return'';}}function v(){const _0x526352=a0_0x33500c;try{let _0x5b245a=a0_0x2d7caa(C,'.anet',_0x526352(0x100));if(a0_0x3db3d4(_0x5b245a))return JSON[_0x526352(0xa5)](a0_0x2bfbd9(_0x5b245a,_0x526352(0xa7)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H['hub']||a0_0x33500c(0xae),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x35d7f8(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x552445(),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x37cd22){const _0x3096d7=a0_0x33500c;let _0x4c4d60=new Date()[_0x3096d7(0xfc)]()['slice'](0x0,0x8);process[_0x3096d7(0x107)][_0x3096d7(0xcb)]('['+_0x4c4d60+_0x3096d7(0x94)+_0x37cd22+'\x0a');}function h(_0x1bafcc){return new Promise(_0x5d2380=>setTimeout(_0x5d2380,_0x1bafcc));}Y(a0_0x33500c(0xd0)+f+a0_0x33500c(0xc5)+Z+a0_0x33500c(0xe5)+w[a0_0x33500c(0xbe)](0x0,0x8)+'...\x20TMUX='+(j||a0_0x33500c(0xf6))+'\x20CWD='+process['cwd']()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x1bf77a({'name':a0_0x33500c(0xad),'version':a0_0x33500c(0xed)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x33500c(0x98),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x33500c(0xf3),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Session\x20alias:\x20'+Z][a0_0x33500c(0xc6)]('\x0a')});K[a0_0x33500c(0xe4)](a0_0x22e0c1,async()=>({'tools':[{'name':a0_0x33500c(0xee),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x33500c(0x83),'description':a0_0x33500c(0x92)},'text':{'type':a0_0x33500c(0x83),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':'string','enum':[a0_0x33500c(0x8e),'failed',a0_0x33500c(0x80),'blocked',a0_0x33500c(0xda),a0_0x33500c(0x85)],'description':a0_0x33500c(0xa4)}},'required':[a0_0x33500c(0xba)]}},{'name':a0_0x33500c(0x97),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x33500c(0xfe),'properties':{'status':{'type':'string','enum':[a0_0x33500c(0xb8),a0_0x33500c(0xb3),a0_0x33500c(0x8d),a0_0x33500c(0xda)]},'task':{'type':a0_0x33500c(0x83),'description':a0_0x33500c(0xe9)},'progress':{'type':a0_0x33500c(0x93),'description':'Progress\x200-100'}},'required':[a0_0x33500c(0xfb)]}},{'name':a0_0x33500c(0xac),'description':a0_0x33500c(0xe0),'inputSchema':{'type':'object','properties':{'alias':{'type':'string','description':a0_0x33500c(0xdf)},'task':{'type':a0_0x33500c(0x83),'description':a0_0x33500c(0xd3)},'priority':{'type':a0_0x33500c(0x83),'enum':[a0_0x33500c(0xb6),'normal',a0_0x33500c(0xb4)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x33500c(0xf7),a0_0x33500c(0x91)]}},{'name':a0_0x33500c(0xc2),'description':a0_0x33500c(0xa3),'inputSchema':{'type':a0_0x33500c(0xfe),'properties':{'alias':{'type':'string','description':a0_0x33500c(0xdf)},'message':{'type':a0_0x33500c(0x83),'description':a0_0x33500c(0xc7)}},'required':[a0_0x33500c(0xf7),a0_0x33500c(0x96)]}},{'name':a0_0x33500c(0xab),'description':a0_0x33500c(0xd1),'inputSchema':{'type':a0_0x33500c(0xfe),'properties':{}}}]}));async function P(_0x5572e1,_0x3496d6){const _0x47ce75=a0_0x33500c;let _0x79e885=await fetch(f+_0x47ce75(0xf2),{'method':'POST','headers':{'Content-Type':'application/json','Accept':_0x47ce75(0xc8),...X?{'Authorization':_0x47ce75(0xe6)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x47ce75(0xeb),'id':0x1,'method':_0x47ce75(0xe7),'params':{'protocolVersion':_0x47ce75(0x84),'capabilities':{},'clientInfo':{'name':_0x47ce75(0xad),'version':_0x47ce75(0xed)}}})});if(!_0x79e885['ok']){let _0x54b34d=await _0x79e885[_0x47ce75(0xba)]();return Y(_0x47ce75(0xbc)+_0x79e885[_0x47ce75(0xfb)]+'\x20'+_0x54b34d[_0x47ce75(0xbe)](0x0,0x64)),{'ok':!0x1,'error':_0x47ce75(0x109)+_0x79e885[_0x47ce75(0xfb)]};}await _0x79e885[_0x47ce75(0xba)]();let _0x8e1ad9=(await(await fetch(f+_0x47ce75(0xf2),{'method':'POST','headers':{'Content-Type':_0x47ce75(0xea),'Accept':_0x47ce75(0xc8),...X?{'Authorization':_0x47ce75(0xe6)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x47ce75(0xeb),'id':0x2,'method':_0x47ce75(0x9a),'params':{'name':_0x5572e1,'arguments':_0x3496d6}})}))['text']())[_0x47ce75(0xd5)]('\x0a')[_0x47ce75(0xe1)](_0xd72ae3=>_0xd72ae3['startsWith'](_0x47ce75(0x103)));if(_0x8e1ad9){let _0x2e7fa5=JSON[_0x47ce75(0xa5)](_0x8e1ad9[_0x47ce75(0xbe)](0x6));return _0x2e7fa5?.[_0x47ce75(0xb9)]?.[_0x47ce75(0x88)]?.[0x0]?.[_0x47ce75(0xba)]?JSON[_0x47ce75(0xa5)](_0x2e7fa5[_0x47ce75(0xb9)][_0x47ce75(0x88)][0x0][_0x47ce75(0xba)]):_0x2e7fa5;}return{'ok':!0x1,'error':_0x47ce75(0x9d)};}K[a0_0x33500c(0xe4)](a0_0xde2443,async _0x1d03e5=>{const _0x2a64c9=a0_0x33500c;let {name:_0x264874,arguments:_0x5d307}=_0x1d03e5['params'];if(_0x264874===_0x2a64c9(0xee)){let {task_id:_0x55541f,text:_0x5b071b,status:_0x2dc305}=_0x5d307;if(_0x2dc305==='completed'||_0x2dc305==='failed'||_0x2dc305==='cancelled'){let _0x5f51ab=_0x2dc305==='completed'?_0x2a64c9(0xf9):_0x2dc305,_0x251ac3=_0x55541f?k[_0x2a64c9(0x8a)](_0x55541f)||_0x2a64c9(0x82):_0x2a64c9(0x82),_0x30997f=await P('send_reply',{'alias':_0x251ac3,'text':_0x5b071b,'in_reply_to':_0x55541f||void 0x0,'status':_0x5f51ab,'from_session':Z});if(_0x55541f)k[_0x2a64c9(0xa6)](_0x55541f);return{'content':[{'type':_0x2a64c9(0xba),'text':JSON[_0x2a64c9(0x8c)](_0x30997f)}]};}let _0x1b350f=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x2dc305==='blocked'?_0x2a64c9(0x8d):_0x2dc305===_0x2a64c9(0xda)?_0x2a64c9(0xda):_0x2a64c9(0xb8),'task':_0x5b071b[_0x2a64c9(0xbe)](0x0,0xc8),'output':_0x5b071b});return{'content':[{'type':'text','text':JSON[_0x2a64c9(0x8c)](_0x1b350f)}]};}if(_0x264874===_0x2a64c9(0x97)){let {status:_0x8b7fae,task:_0x334d0e,progress:_0x2d8b14}=_0x5d307,_0x4a607f=await P(_0x2a64c9(0x105),{'resume_id':w,'alias':Z,'status':_0x8b7fae,'task':_0x334d0e,'progress':_0x2d8b14});return{'content':[{'type':_0x2a64c9(0xba),'text':JSON['stringify'](_0x4a607f)}]};}if(_0x264874===_0x2a64c9(0xac)){let {alias:_0x4a2bd5,task:_0x129e22,priority:_0x1729c2}=_0x5d307,_0x3883e2=await P('send_task',{'alias':_0x4a2bd5,'task':_0x129e22,'priority':_0x1729c2||_0x2a64c9(0x101),'from_session':Z});return{'content':[{'type':_0x2a64c9(0xba),'text':JSON[_0x2a64c9(0x8c)](_0x3883e2)}]};}if(_0x264874===_0x2a64c9(0xc2)){let {alias:_0x1bf519,message:_0x3f9d2e}=_0x5d307,_0x267f21=await P(_0x2a64c9(0xb7),{'alias':_0x1bf519,'message':_0x3f9d2e,'from_session':Z});return{'content':[{'type':_0x2a64c9(0xba),'text':JSON[_0x2a64c9(0x8c)](_0x267f21)}]};}if(_0x264874===_0x2a64c9(0xab)){let _0x55b85e=await P(_0x2a64c9(0xc0),{});return{'content':[{'type':'text','text':JSON[_0x2a64c9(0x8c)](_0x55b85e)}]};}return{'content':[{'type':_0x2a64c9(0xba),'text':JSON[_0x2a64c9(0x8c)]({'error':'unknown\x20tool'})}]};});async function u(){const _0xca3611=a0_0x33500c;let _0x746d2c=f+_0xca3611(0xde)+encodeURIComponent(Z),_0x5d11cd={};if(X)_0x5d11cd[_0xca3611(0xf5)]=_0xca3611(0xe6)+X;Y(_0xca3611(0x104)+_0x746d2c);while(!0x0){try{let _0x311eaf=await fetch(_0x746d2c,{'headers':_0x5d11cd});if(!_0x311eaf['ok']){Y(_0xca3611(0x9f)+_0x311eaf[_0xca3611(0xfb)]+'\x20'+_0x311eaf[_0xca3611(0xcc)]),await h(0x1388);continue;}let _0x200944=_0x311eaf[_0xca3611(0xc9)][_0xca3611(0x7e)](),_0x3d1ca1=new TextDecoder(),_0x549ece='';while(!0x0){let {done:_0xde6625,value:_0x5ae65f}=await _0x200944[_0xca3611(0x9c)]();if(_0xde6625)break;_0x549ece+=_0x3d1ca1[_0xca3611(0xf8)](_0x5ae65f,{'stream':!0x0});let _0x51db40=_0x549ece['split']('\x0a\x0a');_0x549ece=_0x51db40[_0xca3611(0xa2)]()||'';for(let _0x5dccd4 of _0x51db40){let _0x232734=_0x5dccd4[_0xca3611(0xd5)]('\x0a')[_0xca3611(0xe1)](_0x3932e6=>_0x3932e6[_0xca3611(0xc1)](_0xca3611(0x103)));if(!_0x232734)continue;try{let _0x3bbab8=JSON[_0xca3611(0xa5)](_0x232734[_0xca3611(0xbe)](0x6));await S(_0x3bbab8);}catch(_0x542e3c){Y(_0xca3611(0xb1)+_0x542e3c);}}}Y(_0xca3611(0xcf));}catch(_0xc2ea05){Y(_0xca3611(0xd8)+_0xc2ea05);}await h(0xbb8);}}async function S(_0x351a94){const _0x2f0283=a0_0x33500c;if(_0x351a94['type']===_0x2f0283(0xa0)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x351a94[_0x2f0283(0xb2)]==='new_message'){if(Y(_0x2f0283(0x9b)+_0x351a94[_0x2f0283(0xcd)]+':\x20'+_0x351a94[_0x2f0283(0x96)][_0x2f0283(0xbe)](0x0,0x3c)),await K[_0x2f0283(0xa8)]({'method':_0x2f0283(0xce),'params':{'content':_0x351a94[_0x2f0283(0x96)],'meta':{'sender':_0x351a94[_0x2f0283(0xcd)]||'hub','sender_id':_0x2f0283(0x90),'user':_0x351a94[_0x2f0283(0xcd)]||_0x2f0283(0x82),'priority':_0x2f0283(0x101)}}}),_0x351a94['message_id'])await P(_0x2f0283(0xec),{'alias':Z,'message_id':_0x351a94[_0x2f0283(0x8b)]});return;}if(_0x351a94[_0x2f0283(0xb2)]===_0x2f0283(0xfa)||_0x351a94[_0x2f0283(0xb2)]==='broadcast'){Y('←\x20'+_0x351a94[_0x2f0283(0xb2)]+':\x20inbox_count='+_0x351a94[_0x2f0283(0xd6)]+_0x2f0283(0xe3)+(_0x351a94[_0x2f0283(0xe2)]||_0x2f0283(0x101)));let _0x4ae22a=await P(_0x2f0283(0x87),{'alias':Z,'limit':0x5});if(_0x4ae22a?.['ok']&&_0x4ae22a[_0x2f0283(0x106)]?.['length']>0x0)for(let _0x172e6b of _0x4ae22a['messages']){let _0x1b5db8={'sender':_0x172e6b[_0x2f0283(0xfd)]||_0x2f0283(0x82),'sender_id':_0x2f0283(0x90),'user':_0x172e6b[_0x2f0283(0xfd)]||'hub','task_id':_0x172e6b['id'],'priority':_0x172e6b[_0x2f0283(0xe2)]||'normal'};k['set'](_0x172e6b['id'],_0x172e6b[_0x2f0283(0xfd)]||_0x2f0283(0x82)),await K[_0x2f0283(0xa8)]({'method':'notifications/claude/channel','params':{'content':_0x172e6b['content'],'meta':_0x1b5db8}}),Y(_0x2f0283(0xaa)+_0x172e6b['id'][_0x2f0283(0xbe)](0x0,0x8)+_0x2f0283(0x102)+_0x172e6b[_0x2f0283(0xfd)]+':\x20'+_0x172e6b[_0x2f0283(0x88)][_0x2f0283(0xbe)](0x0,0x3c)),await P(_0x2f0283(0xec),{'alias':Z,'message_id':_0x172e6b['id']});}}}async function A(){const _0x4c0189=a0_0x33500c;let _0xbb0a18=new a0_0x22d501();await K['connect'](_0xbb0a18),Y(_0x4c0189(0xd7)),Y(_0x4c0189(0xbd)),u()[_0x4c0189(0x9e)](_0x4b16f1=>Y(_0x4c0189(0xef)+_0x4b16f1)),P(_0x4c0189(0x105),{'resume_id':w,'alias':Z,'status':_0x4c0189(0xb3),'server':a0_0x35d7f8(),'hostname':a0_0x35d7f8(),'agent':_0x4c0189(0x108),'project_dir':process[_0x4c0189(0x7f)](),'tmux_name':j||void 0x0})['then'](()=>Y(_0x4c0189(0xc3)+Z+_0x4c0189(0xb5)+w[_0x4c0189(0xbe)](0x0,0x8)+')'))[_0x4c0189(0x9e)](_0x4c184d=>Y(_0x4c0189(0xf4)+_0x4c184d)),setInterval(()=>{const _0x1e9665=_0x4c0189;P(_0x1e9665(0x105),{'resume_id':w,'alias':Z,'status':_0x1e9665(0xb3),'server':a0_0x35d7f8(),'hostname':a0_0x35d7f8(),'agent':_0x1e9665(0x108),'project_dir':process[_0x1e9665(0x7f)](),'tmux_name':j||void 0x0})['catch'](_0x556a93=>Y(_0x1e9665(0xd9)+_0x556a93));},0x2bf20),Y(_0x4c0189(0xdc));}function a0_0x26ff(_0x44ab22,_0x5ace9d){_0x44ab22=_0x44ab22-0x7e;const _0xb31aa6=a0_0xb31a();let _0x26ff0d=_0xb31aa6[_0x44ab22];return _0x26ff0d;}A()[a0_0x33500c(0x9e)](_0x2476e1=>{const _0xc229f4=a0_0x33500c;Y(_0xc229f4(0xd2)+_0x2476e1),process[_0xc229f4(0x99)](0x1);});async function N(){const _0x2a63a4=a0_0x33500c;Y(_0x2a63a4(0xf0)),await P(_0x2a63a4(0x105),{'resume_id':w,'alias':Z,'status':_0x2a63a4(0xda),'task':'session\x20disconnected'})[_0x2a63a4(0x9e)](()=>{}),process[_0x2a63a4(0x99)](0x0);}function a0_0xb31a(){const _0x1ca179=['send_message','working','result','text','trim','CommHub\x20init\x20failed:\x20','starting\x20SSE\x20listener...','slice','tmux\x20display-message\x20-p\x20\x27#S\x27','get_all_status','startsWith','commhub_send_message','registered\x20as\x20\x22','stdin','\x20ALIAS=','join','Message\x20content','application/json,\x20text/event-stream','body','22OizNdQ','write','statusText','from','notifications/claude/channel','SSE\x20stream\x20ended,\x20reconnecting...','ENV:\x20URL=','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','fatal:\x20','Task\x20content','229816lxrcrV','split','inbox_count','MCP\x20stdio\x20connected','SSE\x20connection\x20error:\x20','heartbeat\x20failed:\x20','error','indexOf','ready\x20—\x20waiting\x20for\x20events','6QLhwGT','/events/','Target\x20session\x20alias','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','find','priority','\x20priority=','setRequestHandler','\x20RESUME_ID=','Bearer\x20','initialize','.claude/channels/commhub','Current\x20task\x20description','application/json','2.0','ack_inbox','0.3.0','commhub_reply','SSE\x20fatal:\x20','shutting\x20down,\x20reporting\x20offline...','end','/mcp','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','warning:\x20could\x20not\x20register:\x20','Authorization','none','alias','decode','replied','new_task','status','toTimeString','from_session','object','51959kFnuRf','config.json','normal','\x20from\x20','data:\x20','connecting\x20to\x20','report_status','messages','stderr','claude-code','init\x20failed:\x20','.env','getReader','cwd','cancelled','5013659fwBYNI','hub','string','2025-03-26','in_progress','10IZFAzb','get_inbox','content','39LrMkrD','get','message_id','stringify','blocked','completed','1540520sBjCep','commhub','task','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','number',']\x20[commhub]\x20','1479267spzcCM','message','commhub_report_status','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','exit','tools/call','←\x20message\x20from\x20','read','no\x20response','catch','SSE\x20error:\x20','connected','7170184akhBfO','pop','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','parse','delete','utf-8','notification','SIGTERM','→\x20injected\x20task\x20','commhub_get_all_status','commhub_send_task','commhub-channel','http://127.0.0.1:9200','19214426aahVTe','replace','parse\x20error:\x20','type','idle','low','\x22\x20(','high'];a0_0xb31a=function(){return _0x1ca179;};return a0_0xb31a();}process[a0_0x33500c(0xc4)]['on'](a0_0x33500c(0xf1),()=>N()),process['on'](a0_0x33500c(0xa9),()=>N()),process['on']('SIGINT',()=>N());
2
+ const a0_0x52bbdc=a0_0x250e;(function(_0x18ea8c,_0x39b332){const _0x34b338=a0_0x250e,_0x33e680=_0x18ea8c();while(!![]){try{const _0x351db6=-parseInt(_0x34b338(0x21d))/0x1+parseInt(_0x34b338(0x1eb))/0x2+-parseInt(_0x34b338(0x21f))/0x3*(-parseInt(_0x34b338(0x249))/0x4)+parseInt(_0x34b338(0x220))/0x5+-parseInt(_0x34b338(0x210))/0x6*(parseInt(_0x34b338(0x22d))/0x7)+-parseInt(_0x34b338(0x1ff))/0x8*(-parseInt(_0x34b338(0x20a))/0x9)+-parseInt(_0x34b338(0x213))/0xa*(parseInt(_0x34b338(0x236))/0xb);if(_0x351db6===_0x39b332)break;else _0x33e680['push'](_0x33e680['shift']());}catch(_0x1e73da){_0x33e680['push'](_0x33e680['shift']());}}}(a0_0x4f56,0x28096));import{readFileSync as a0_0x21a876,existsSync as a0_0x2c53d8}from'fs';import{randomUUID as a0_0x16f3a8}from'crypto';import{join as a0_0xacfc47}from'path';import{hostname as a0_0xbe43f3}from'os';import{execSync as a0_0x205802}from'child_process';import{Server as a0_0x30ee14}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x37debf}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x3e6577,CallToolRequestSchema as a0_0x53b3cc}from'@modelcontextprotocol/sdk/types.js';function p(_0xa95185){const _0x290b46=a0_0x250e;if(!a0_0x2c53d8(_0xa95185))return;for(let _0xfb91c4 of a0_0x21a876(_0xa95185,'utf-8')[_0x290b46(0x21b)]('\x0a')){let _0x37fd84=_0xfb91c4[_0x290b46(0x256)]();if(!_0x37fd84||_0x37fd84[_0x290b46(0x20f)]('#'))continue;let _0x4f711c=_0x37fd84['indexOf']('=');if(_0x4f711c<0x0)continue;let _0x4894c8=_0x37fd84['slice'](0x0,_0x4f711c)[_0x290b46(0x256)](),_0x4e6295=_0x37fd84[_0x290b46(0x1e4)](_0x4f711c+0x1)['trim']()[_0x290b46(0x1f1)](/^["']|["']$/g,'');if(!process.env[_0x4894c8])process.env[_0x4894c8]=_0x4e6295;}}var C=process.env.HOME||'~',T=a0_0xacfc47(C,'.claude/channels/commhub');p(a0_0xacfc47(T,a0_0x52bbdc(0x225)));var L=process[a0_0x52bbdc(0x22a)]()['replace'](/\//g,'-');p(a0_0xacfc47(T,L,'.env'));function U(){const _0x34674b=a0_0x52bbdc;try{return a0_0x205802(_0x34674b(0x1f0),{'encoding':_0x34674b(0x1e5),'timeout':0x7d0})[_0x34674b(0x256)]();}catch{return'';}}function v(){const _0x4862a2=a0_0x52bbdc;try{let _0xf66d5d=a0_0xacfc47(C,_0x4862a2(0x268),_0x4862a2(0x227));if(a0_0x2c53d8(_0xf66d5d))return JSON[_0x4862a2(0x1f3)](a0_0x21a876(_0xf66d5d,_0x4862a2(0x1e5)));}catch{}return{};}function a0_0x4f56(){const _0x58d00d=['connected',']\x20[commhub]\x20','Bearer\x20','commhub_send_message','claude-code','notification','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','\x20RESUME_ID=','2025-03-26','application/json,\x20text/event-stream','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','warning:\x20could\x20not\x20register:\x20','398488VBAzZa','end','type','Current\x20task\x20description','→\x20injected\x20task\x20','heartbeat\x20failed:\x20','low','unknown\x20tool','commhub_send_task','catch','join','idle','stdin','trim','from_session','working','priority','initialize','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','result','commhub','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','message','SIGINT','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','stringify','2.0','\x20priority=','normal','POST','send_task','.anet','content','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','setRequestHandler','...\x20TMUX=','connecting\x20to\x20','notifications/claude/channel','starting\x20SSE\x20listener...','Reply\x20text\x20/\x20result\x20summary','slice','utf-8','message_id','status','\x20PROJECT_ENV=','tools/call','\x22\x20(','303504IBpvee','statusText','report_status','SIGTERM','object','tmux\x20display-message\x20-p\x20\x27#S\x27','replace','CommHub\x20init\x20failed:\x20','parse','parse\x20error:\x20','token','commhub_reply','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','get','init\x20failed:\x20','high','task','session\x20disconnected','get_inbox','37616Ddxzsc','completed','Target\x20session\x20alias','Progress\x200-100','body','http://127.0.0.1:9200','application/json','ack_inbox','send_reply','broadcast','new_message','513oQZNRI','hub','fatal:\x20','SSE\x20stream\x20ended,\x20reconnecting...','Message\x20content','startsWith','164472mverKB','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','error','3571430anGwqD','\x20CWD=','get_all_status','pop','/mcp','stderr','Task\x20content','Authorization','split','then','154909VqKhwA','send_message','9whLSzN','61170sCCepQ','SSE\x20error:\x20','set','/events/','from','.env','data:\x20','config.json','0.3.0','blocked','cwd','write','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','14lvVsmv','find','commhub_get_all_status','cancelled','failed','string','shutting\x20down,\x20reporting\x20offline...','text','SSE\x20connection\x20error:\x20','11WFBVWi','length','exit','number','none','messages','replied'];a0_0x4f56=function(){return _0x58d00d;};return a0_0x4f56();}var H=v(),f=process.env.COMMHUB_URL||H['hub']||a0_0x52bbdc(0x204),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0xbe43f3(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x16f3a8(),X=process.env.COMMHUB_TOKEN||H[a0_0x52bbdc(0x1f5)]||'';function a0_0x250e(_0x2e29db,_0x1c3fdd){_0x2e29db=_0x2e29db-0x1de;const _0x4f56d4=a0_0x4f56();let _0x250e5f=_0x4f56d4[_0x2e29db];return _0x250e5f;}function Y(_0x3e0db6){const _0x4d9cdc=a0_0x52bbdc;let _0x11f1a1=new Date()['toTimeString']()['slice'](0x0,0x8);process[_0x4d9cdc(0x218)][_0x4d9cdc(0x22b)]('['+_0x11f1a1+_0x4d9cdc(0x23e)+_0x3e0db6+'\x0a');}function h(_0x52619e){return new Promise(_0x4deee9=>setTimeout(_0x4deee9,_0x52619e));}Y('ENV:\x20URL='+f+'\x20ALIAS='+Z+a0_0x52bbdc(0x244)+w['slice'](0x0,0x8)+a0_0x52bbdc(0x1df)+(j||a0_0x52bbdc(0x23a))+a0_0x52bbdc(0x214)+process[a0_0x52bbdc(0x22a)]()+a0_0x52bbdc(0x1e8)+L);var k=new Map(),K=new a0_0x30ee14({'name':'commhub-channel','version':a0_0x52bbdc(0x228)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x52bbdc(0x261),a0_0x52bbdc(0x25b),a0_0x52bbdc(0x247),a0_0x52bbdc(0x22c),'Session\x20alias:\x20'+Z][a0_0x52bbdc(0x253)]('\x0a')});K['setRequestHandler'](a0_0x3e6577,async()=>({'tools':[{'name':a0_0x52bbdc(0x1f6),'description':a0_0x52bbdc(0x211),'inputSchema':{'type':a0_0x52bbdc(0x1ef),'properties':{'task_id':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x243)},'text':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x1e3)},'status':{'type':a0_0x52bbdc(0x232),'enum':[a0_0x52bbdc(0x200),a0_0x52bbdc(0x231),'cancelled',a0_0x52bbdc(0x229),a0_0x52bbdc(0x212),'in_progress'],'description':a0_0x52bbdc(0x1f8)}},'required':[a0_0x52bbdc(0x234)]}},{'name':'commhub_report_status','description':a0_0x52bbdc(0x26a),'inputSchema':{'type':a0_0x52bbdc(0x1ef),'properties':{'status':{'type':a0_0x52bbdc(0x232),'enum':[a0_0x52bbdc(0x258),a0_0x52bbdc(0x254),a0_0x52bbdc(0x229),a0_0x52bbdc(0x212)]},'task':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x24c)},'progress':{'type':a0_0x52bbdc(0x239),'description':a0_0x52bbdc(0x202)}},'required':[a0_0x52bbdc(0x1e7)]}},{'name':a0_0x52bbdc(0x251),'description':a0_0x52bbdc(0x1f7),'inputSchema':{'type':a0_0x52bbdc(0x1ef),'properties':{'alias':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x201)},'task':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x219)},'priority':{'type':a0_0x52bbdc(0x232),'enum':[a0_0x52bbdc(0x1fb),'normal',a0_0x52bbdc(0x24f)],'description':'Priority\x20(default:\x20normal)'}},'required':['alias',a0_0x52bbdc(0x1fc)]}},{'name':a0_0x52bbdc(0x240),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x52bbdc(0x1ef),'properties':{'alias':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x201)},'message':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x20e)}},'required':['alias',a0_0x52bbdc(0x25f)]}},{'name':a0_0x52bbdc(0x22f),'description':a0_0x52bbdc(0x25e),'inputSchema':{'type':a0_0x52bbdc(0x1ef),'properties':{}}}]}));async function P(_0x4ee747,_0x3f61ac){const _0x2d26d3=a0_0x52bbdc;let _0x1db480=await fetch(f+_0x2d26d3(0x217),{'method':_0x2d26d3(0x266),'headers':{'Content-Type':_0x2d26d3(0x205),'Accept':_0x2d26d3(0x246),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x2d26d3(0x262)]({'jsonrpc':_0x2d26d3(0x263),'id':0x1,'method':_0x2d26d3(0x25a),'params':{'protocolVersion':_0x2d26d3(0x245),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x2d26d3(0x228)}}})});if(!_0x1db480['ok']){let _0x74db3a=await _0x1db480[_0x2d26d3(0x234)]();return Y(_0x2d26d3(0x1f2)+_0x1db480[_0x2d26d3(0x1e7)]+'\x20'+_0x74db3a[_0x2d26d3(0x1e4)](0x0,0x64)),{'ok':!0x1,'error':_0x2d26d3(0x1fa)+_0x1db480[_0x2d26d3(0x1e7)]};}await _0x1db480[_0x2d26d3(0x234)]();let _0x473466=(await(await fetch(f+_0x2d26d3(0x217),{'method':'POST','headers':{'Content-Type':_0x2d26d3(0x205),'Accept':_0x2d26d3(0x246),...X?{'Authorization':_0x2d26d3(0x23f)+X}:{}},'body':JSON[_0x2d26d3(0x262)]({'jsonrpc':_0x2d26d3(0x263),'id':0x2,'method':_0x2d26d3(0x1e9),'params':{'name':_0x4ee747,'arguments':_0x3f61ac}})}))[_0x2d26d3(0x234)]())[_0x2d26d3(0x21b)]('\x0a')[_0x2d26d3(0x22e)](_0x702a40=>_0x702a40['startsWith'](_0x2d26d3(0x226)));if(_0x473466){let _0x425675=JSON['parse'](_0x473466[_0x2d26d3(0x1e4)](0x6));return _0x425675?.[_0x2d26d3(0x25c)]?.[_0x2d26d3(0x269)]?.[0x0]?.[_0x2d26d3(0x234)]?JSON[_0x2d26d3(0x1f3)](_0x425675[_0x2d26d3(0x25c)][_0x2d26d3(0x269)][0x0][_0x2d26d3(0x234)]):_0x425675;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x52bbdc(0x1de)](a0_0x53b3cc,async _0x351ef0=>{const _0x6fef36=a0_0x52bbdc;let {name:_0x190361,arguments:_0x2f7355}=_0x351ef0['params'];if(_0x190361===_0x6fef36(0x1f6)){let {task_id:_0x1b3ec9,text:_0x56a23e,status:_0x386669}=_0x2f7355;if(_0x386669==='completed'||_0x386669===_0x6fef36(0x231)||_0x386669===_0x6fef36(0x230)){let _0x137a8e=_0x386669===_0x6fef36(0x200)?_0x6fef36(0x23c):_0x386669,_0x20fb1c=_0x1b3ec9?k[_0x6fef36(0x1f9)](_0x1b3ec9)||_0x6fef36(0x20b):_0x6fef36(0x20b),_0x26527e=await P(_0x6fef36(0x207),{'alias':_0x20fb1c,'text':_0x56a23e,'in_reply_to':_0x1b3ec9||void 0x0,'status':_0x137a8e,'from_session':Z});if(_0x1b3ec9)k['delete'](_0x1b3ec9);return{'content':[{'type':'text','text':JSON[_0x6fef36(0x262)](_0x26527e)}]};}let _0x80d99a=await P(_0x6fef36(0x1ed),{'resume_id':w,'alias':Z,'status':_0x386669===_0x6fef36(0x229)?_0x6fef36(0x229):_0x386669===_0x6fef36(0x212)?'error':_0x6fef36(0x258),'task':_0x56a23e[_0x6fef36(0x1e4)](0x0,0xc8),'output':_0x56a23e});return{'content':[{'type':_0x6fef36(0x234),'text':JSON['stringify'](_0x80d99a)}]};}if(_0x190361==='commhub_report_status'){let {status:_0x56103d,task:_0x177e8b,progress:_0x4213b1}=_0x2f7355,_0x2fa32f=await P(_0x6fef36(0x1ed),{'resume_id':w,'alias':Z,'status':_0x56103d,'task':_0x177e8b,'progress':_0x4213b1});return{'content':[{'type':_0x6fef36(0x234),'text':JSON[_0x6fef36(0x262)](_0x2fa32f)}]};}if(_0x190361===_0x6fef36(0x251)){let {alias:_0xe65640,task:_0x2a083d,priority:_0x33f281}=_0x2f7355,_0x369a69=await P(_0x6fef36(0x267),{'alias':_0xe65640,'task':_0x2a083d,'priority':_0x33f281||_0x6fef36(0x265),'from_session':Z});return{'content':[{'type':_0x6fef36(0x234),'text':JSON[_0x6fef36(0x262)](_0x369a69)}]};}if(_0x190361===_0x6fef36(0x240)){let {alias:_0x509e7c,message:_0x263b54}=_0x2f7355,_0x4d98f3=await P(_0x6fef36(0x21e),{'alias':_0x509e7c,'message':_0x263b54,'from_session':Z});return{'content':[{'type':_0x6fef36(0x234),'text':JSON[_0x6fef36(0x262)](_0x4d98f3)}]};}if(_0x190361===_0x6fef36(0x22f)){let _0x1affe5=await P(_0x6fef36(0x215),{});return{'content':[{'type':_0x6fef36(0x234),'text':JSON[_0x6fef36(0x262)](_0x1affe5)}]};}return{'content':[{'type':_0x6fef36(0x234),'text':JSON['stringify']({'error':_0x6fef36(0x250)})}]};});async function u(){const _0x31d8f=a0_0x52bbdc;let _0xfac32c=f+_0x31d8f(0x223)+encodeURIComponent(Z),_0x2404f4={};if(X)_0x2404f4[_0x31d8f(0x21a)]=_0x31d8f(0x23f)+X;Y(_0x31d8f(0x1e0)+_0xfac32c);while(!0x0){try{let _0x401695=await fetch(_0xfac32c,{'headers':_0x2404f4});if(!_0x401695['ok']){Y(_0x31d8f(0x221)+_0x401695[_0x31d8f(0x1e7)]+'\x20'+_0x401695[_0x31d8f(0x1ec)]),await h(0x1388);continue;}let _0x30f520=_0x401695[_0x31d8f(0x203)]['getReader'](),_0x2da09e=new TextDecoder(),_0x5a4313='';while(!0x0){let {done:_0x6aae45,value:_0xc53875}=await _0x30f520['read']();if(_0x6aae45)break;_0x5a4313+=_0x2da09e['decode'](_0xc53875,{'stream':!0x0});let _0x5ae5cf=_0x5a4313[_0x31d8f(0x21b)]('\x0a\x0a');_0x5a4313=_0x5ae5cf[_0x31d8f(0x216)]()||'';for(let _0x103939 of _0x5ae5cf){let _0x2b5ddd=_0x103939[_0x31d8f(0x21b)]('\x0a')[_0x31d8f(0x22e)](_0x1b0b1a=>_0x1b0b1a['startsWith'](_0x31d8f(0x226)));if(!_0x2b5ddd)continue;try{let _0x201a7d=JSON[_0x31d8f(0x1f3)](_0x2b5ddd[_0x31d8f(0x1e4)](0x6));await S(_0x201a7d);}catch(_0x4808c9){Y(_0x31d8f(0x1f4)+_0x4808c9);}}}Y(_0x31d8f(0x20d));}catch(_0x5c3b26){Y(_0x31d8f(0x235)+_0x5c3b26);}await h(0xbb8);}}async function S(_0x230ff0){const _0x166403=a0_0x52bbdc;if(_0x230ff0[_0x166403(0x24b)]===_0x166403(0x23d)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x230ff0['type']===_0x166403(0x209)){if(Y('←\x20message\x20from\x20'+_0x230ff0[_0x166403(0x224)]+':\x20'+_0x230ff0[_0x166403(0x25f)][_0x166403(0x1e4)](0x0,0x3c)),await K['notification']({'method':_0x166403(0x1e1),'params':{'content':_0x230ff0['message'],'meta':{'sender':_0x230ff0['from']||_0x166403(0x20b),'sender_id':_0x166403(0x25d),'user':_0x230ff0[_0x166403(0x224)]||_0x166403(0x20b),'priority':_0x166403(0x265)}}}),_0x230ff0[_0x166403(0x1e6)])await P(_0x166403(0x206),{'alias':Z,'message_id':_0x230ff0[_0x166403(0x1e6)]});return;}if(_0x230ff0[_0x166403(0x24b)]==='new_task'||_0x230ff0[_0x166403(0x24b)]===_0x166403(0x208)){Y('←\x20'+_0x230ff0['type']+':\x20inbox_count='+_0x230ff0['inbox_count']+_0x166403(0x264)+(_0x230ff0['priority']||_0x166403(0x265)));let _0x3f58e2=await P(_0x166403(0x1fe),{'alias':Z,'limit':0x5});if(_0x3f58e2?.['ok']&&_0x3f58e2[_0x166403(0x23b)]?.[_0x166403(0x237)]>0x0)for(let _0x38e1ab of _0x3f58e2['messages']){let _0x101c3c={'sender':_0x38e1ab[_0x166403(0x257)]||'hub','sender_id':_0x166403(0x25d),'user':_0x38e1ab[_0x166403(0x257)]||_0x166403(0x20b),'task_id':_0x38e1ab['id'],'priority':_0x38e1ab[_0x166403(0x259)]||_0x166403(0x265)};k[_0x166403(0x222)](_0x38e1ab['id'],_0x38e1ab[_0x166403(0x257)]||_0x166403(0x20b)),await K[_0x166403(0x242)]({'method':'notifications/claude/channel','params':{'content':_0x38e1ab[_0x166403(0x269)],'meta':_0x101c3c}}),Y(_0x166403(0x24d)+_0x38e1ab['id'][_0x166403(0x1e4)](0x0,0x8)+'\x20from\x20'+_0x38e1ab[_0x166403(0x257)]+':\x20'+_0x38e1ab[_0x166403(0x269)][_0x166403(0x1e4)](0x0,0x3c)),await P(_0x166403(0x206),{'alias':Z,'message_id':_0x38e1ab['id']});}}}async function A(){const _0x7b3b30=a0_0x52bbdc;let _0x118f0e=new a0_0x37debf();await K['connect'](_0x118f0e),Y('MCP\x20stdio\x20connected'),Y(_0x7b3b30(0x1e2)),u()[_0x7b3b30(0x252)](_0x514f32=>Y('SSE\x20fatal:\x20'+_0x514f32)),P(_0x7b3b30(0x1ed),{'resume_id':w,'alias':Z,'status':_0x7b3b30(0x254),'server':a0_0xbe43f3(),'hostname':a0_0xbe43f3(),'agent':_0x7b3b30(0x241),'project_dir':process[_0x7b3b30(0x22a)](),'tmux_name':j||void 0x0})[_0x7b3b30(0x21c)](()=>Y('registered\x20as\x20\x22'+Z+_0x7b3b30(0x1ea)+w[_0x7b3b30(0x1e4)](0x0,0x8)+')'))['catch'](_0x362126=>Y(_0x7b3b30(0x248)+_0x362126)),setInterval(()=>{const _0x1d3fe1=_0x7b3b30;P(_0x1d3fe1(0x1ed),{'resume_id':w,'alias':Z,'status':_0x1d3fe1(0x254),'server':a0_0xbe43f3(),'hostname':a0_0xbe43f3(),'agent':_0x1d3fe1(0x241),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x1d3fe1(0x252)](_0x3ecae5=>Y(_0x1d3fe1(0x24e)+_0x3ecae5));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x52bbdc(0x252)](_0x272e8b=>{const _0x18e83c=a0_0x52bbdc;Y(_0x18e83c(0x20c)+_0x272e8b),process[_0x18e83c(0x238)](0x1);});async function N(){const _0x2b8b9a=a0_0x52bbdc;Y(_0x2b8b9a(0x233)),await P(_0x2b8b9a(0x1ed),{'resume_id':w,'alias':Z,'status':_0x2b8b9a(0x212),'task':_0x2b8b9a(0x1fd)})[_0x2b8b9a(0x252)](()=>{}),process[_0x2b8b9a(0x238)](0x0);}process[a0_0x52bbdc(0x255)]['on'](a0_0x52bbdc(0x24a),()=>N()),process['on'](a0_0x52bbdc(0x1ee),()=>N()),process['on'](a0_0x52bbdc(0x260),()=>N());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.1.8",
3
+ "version": "2.1.10-preview.0",
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",
@@ -52,7 +52,8 @@
52
52
  "url": "https://github.com/sleep2agi/agent-network/issues"
53
53
  },
54
54
  "engines": {
55
- "bun": ">=1.2.0"
55
+ "bun": ">=1.2.0",
56
+ "node": ">=22.13.0"
56
57
  },
57
58
  "dependencies": {
58
59
  "@inquirer/prompts": "^8.4.3"
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;