@sleep2agi/agent-network 2.1.13-preview.2 → 2.1.13-preview.4

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_0x5c9bdd=a0_0x46af;(function(_0xb02204,_0x510c38){const _0x2a2250=a0_0x46af,_0x5882c9=_0xb02204();while(!![]){try{const _0x289b26=parseInt(_0x2a2250(0x1a2))/0x1+parseInt(_0x2a2250(0x1c3))/0x2+-parseInt(_0x2a2250(0x1ad))/0x3+parseInt(_0x2a2250(0x1b4))/0x4+parseInt(_0x2a2250(0x19e))/0x5+-parseInt(_0x2a2250(0x181))/0x6+-parseInt(_0x2a2250(0x1c2))/0x7*(-parseInt(_0x2a2250(0x1cf))/0x8);if(_0x289b26===_0x510c38)break;else _0x5882c9['push'](_0x5882c9['shift']());}catch(_0x23ae94){_0x5882c9['push'](_0x5882c9['shift']());}}}(a0_0x4a93,0xc97c6));function a0_0x46af(_0x57cf06,_0x1a2911){_0x57cf06=_0x57cf06-0x181;const _0x4a9334=a0_0x4a93();let _0x46af5d=_0x4a9334[_0x57cf06];return _0x46af5d;}function a0_0x4a93(){const _0xc7e7c5=['alias',']\x20[commhub:','sdk','offline','send_message','Bearer\x20','decode','application/json,\x20text/event-stream','from_session','status','match','connected','new_task','3252720hNjXxE','sdk-','body','ack_inbox','43448hKBkRq','signal','broadcast','send_task','connectSSE','POST','read','url','slice','data:\x20','SSE\x20reconnecting\x20in\x20','3577530dCyVeD','SSE\x20error:\x20','now','registered','toTimeString','call','completed','3845372faIZjV','reconnectDelay','heartbeat\x20failed:\x20','connect','report_status','send','s...','agent','content','task','tools/call','emit','message','toString','2821kgnazQ','3177460DLtAZv','parse','new_message','sseAbort','token','type','sleep','startsWith','AbortError','messages','text/event-stream','stringify','5752zWsyhY','heartbeatTimer','resumeId','heartbeatInterval','9096156COmSFA','catch','processInbox','text','min','2.0','split','application/json','log','running','idle','Authorization','autoConnect','replace','cwd','reply'];a0_0x4a93=function(){return _0xc7e7c5;};return a0_0x4a93();}import{EventEmitter as a0_0x45f8c3}from'events';import{hostname as a0_0x8fe7e2}from'os';class T extends a0_0x45f8c3{[a0_0x5c9bdd(0x1a9)];[a0_0x5c9bdd(0x191)];[a0_0x5c9bdd(0x1c7)];['agent'];['resumeId'];['heartbeatInterval'];['reconnectDelay'];[a0_0x5c9bdd(0x1d0)];[a0_0x5c9bdd(0x1c6)];[a0_0x5c9bdd(0x18a)]=!0x1;constructor(_0x4415af){const _0x22eec5=a0_0x5c9bdd;super();if(this['url']=_0x4415af[_0x22eec5(0x1a9)][_0x22eec5(0x18e)](/\/$/,''),this[_0x22eec5(0x191)]=_0x4415af[_0x22eec5(0x191)],this[_0x22eec5(0x1c7)]=_0x4415af['token'],this['agent']=_0x4415af[_0x22eec5(0x1bb)]||_0x22eec5(0x193),this[_0x22eec5(0x1d1)]=_0x22eec5(0x19f)+_0x4415af[_0x22eec5(0x191)]+'-'+Date[_0x22eec5(0x1af)]()[_0x22eec5(0x1c1)](0x24),this['heartbeatInterval']=_0x4415af[_0x22eec5(0x1d2)]??0x2bf20,this[_0x22eec5(0x1b5)]=_0x4415af[_0x22eec5(0x1b5)]??0xbb8,_0x4415af[_0x22eec5(0x18d)]!==!0x1)this[_0x22eec5(0x1b7)]();}[a0_0x5c9bdd(0x189)](_0x36488b){const _0x5ce93e=a0_0x5c9bdd;console[_0x5ce93e(0x189)]('['+new Date()[_0x5ce93e(0x1b1)]()[_0x5ce93e(0x1aa)](0x0,0x8)+_0x5ce93e(0x192)+this[_0x5ce93e(0x191)]+']\x20'+_0x36488b);}async[a0_0x5c9bdd(0x1b2)](_0x3cffe6,_0x1777fd){const _0x2bb220=a0_0x5c9bdd;let _0x5f5cd9={'Content-Type':_0x2bb220(0x188),'Accept':_0x2bb220(0x198)};if(this[_0x2bb220(0x1c7)])_0x5f5cd9[_0x2bb220(0x18c)]='Bearer\x20'+this['token'];let _0x21b3ca=await(await fetch(this[_0x2bb220(0x1a9)]+'/mcp',{'method':_0x2bb220(0x1a7),'headers':_0x5f5cd9,'body':JSON[_0x2bb220(0x1ce)]({'jsonrpc':_0x2bb220(0x186),'id':Date[_0x2bb220(0x1af)](),'method':_0x2bb220(0x1be),'params':{'name':_0x3cffe6,'arguments':_0x1777fd}})}))[_0x2bb220(0x184)](),_0x3e2004=_0x21b3ca[_0x2bb220(0x19b)](/data: (.+)/),_0x342f79=_0x3e2004?JSON[_0x2bb220(0x1c4)](_0x3e2004[0x1]):JSON[_0x2bb220(0x1c4)](_0x21b3ca),_0x113f8f=_0x342f79?.['result']?.['content']?.[0x0]?.['text'];return _0x113f8f?JSON[_0x2bb220(0x1c4)](_0x113f8f):_0x342f79;}async[a0_0x5c9bdd(0x1b7)](){const _0x8a4825=a0_0x5c9bdd;if(this[_0x8a4825(0x18a)])return;this[_0x8a4825(0x18a)]=!0x0,await this[_0x8a4825(0x19a)](_0x8a4825(0x18b)),this[_0x8a4825(0x189)](_0x8a4825(0x1b0)),this[_0x8a4825(0x1d0)]=setInterval(()=>{const _0x12a18c=_0x8a4825;this[_0x12a18c(0x19a)]('idle')['catch'](_0x37aa61=>this[_0x12a18c(0x189)](_0x12a18c(0x1b6)+_0x37aa61[_0x12a18c(0x1c0)]));},this[_0x8a4825(0x1d2)]),this['connectSSE']();}async['disconnect'](){const _0x4ca3c0=a0_0x5c9bdd;if(this[_0x4ca3c0(0x18a)]=!0x1,this['sseAbort']?.['abort'](),this[_0x4ca3c0(0x1d0)])clearInterval(this[_0x4ca3c0(0x1d0)]);await this[_0x4ca3c0(0x19a)](_0x4ca3c0(0x194))[_0x4ca3c0(0x182)](()=>{}),this[_0x4ca3c0(0x189)]('disconnected');}async[a0_0x5c9bdd(0x1b9)](_0x2cea50,_0x8212a8,_0x11d55a='normal'){const _0x1647c8=a0_0x5c9bdd;return this[_0x1647c8(0x1b2)](_0x1647c8(0x1a5),{'alias':_0x2cea50,'task':_0x8212a8,'priority':_0x11d55a,'from_session':this['alias']});}async[a0_0x5c9bdd(0x1c0)](_0x23a7c5,_0x356610){const _0x17cdb9=a0_0x5c9bdd;return this[_0x17cdb9(0x1b2)](_0x17cdb9(0x195),{'alias':_0x23a7c5,'message':_0x356610,'from_session':this[_0x17cdb9(0x191)]});}async[a0_0x5c9bdd(0x190)](_0x29cf79,_0x42312a,_0x2b9ba5=a0_0x5c9bdd(0x1b3)){return this['call']('send_reply',{'in_reply_to':_0x29cf79,'text':_0x42312a,'status':_0x2b9ba5});}async[a0_0x5c9bdd(0x19a)](_0x4decb6,_0x4d537f){const _0x473b60=a0_0x5c9bdd;return this[_0x473b60(0x1b2)](_0x473b60(0x1b8),{'resume_id':this['resumeId'],'alias':this[_0x473b60(0x191)],'status':_0x4decb6,'server':a0_0x8fe7e2(),'hostname':a0_0x8fe7e2(),'agent':this['agent'],'project_dir':process[_0x473b60(0x18f)](),..._0x4d537f});}async['getAllStatus'](){const _0x5f3fd=a0_0x5c9bdd;return this[_0x5f3fd(0x1b2)]('get_all_status',{});}async[a0_0x5c9bdd(0x1a4)](_0x147da6,_0x1d363e){const _0x2d3016=a0_0x5c9bdd;return this[_0x2d3016(0x1b2)](_0x2d3016(0x1a4),{'message':_0x147da6,'filter_server':_0x1d363e?.['server'],'filter_status':_0x1d363e?.['status']});}async[a0_0x5c9bdd(0x1a6)](){const _0x534afd=a0_0x5c9bdd;let _0x303365=encodeURIComponent(this['alias']),_0x5b6ad5=this[_0x534afd(0x1a9)]+'/events/'+_0x303365,_0xdd4d03=this[_0x534afd(0x1b5)];while(this[_0x534afd(0x18a)]){try{this[_0x534afd(0x1c6)]=new AbortController();let _0x9000f2={'Accept':_0x534afd(0x1cd)};if(this['token'])_0x9000f2[_0x534afd(0x18c)]=_0x534afd(0x196)+this[_0x534afd(0x1c7)];let _0x54fe91=await fetch(_0x5b6ad5,{'headers':_0x9000f2,'signal':this[_0x534afd(0x1c6)][_0x534afd(0x1a3)]});if(!_0x54fe91['ok']||!_0x54fe91[_0x534afd(0x1a0)]){this[_0x534afd(0x189)]('SSE\x20failed:\x20'+_0x54fe91[_0x534afd(0x19a)]),await this[_0x534afd(0x1c9)](_0xdd4d03),_0xdd4d03=Math[_0x534afd(0x185)](_0xdd4d03*1.5,0xea60);continue;}_0xdd4d03=this[_0x534afd(0x1b5)];let _0x35dbea=_0x54fe91[_0x534afd(0x1a0)]['getReader'](),_0xf4c5e5=new TextDecoder(),_0x24c8d0='';while(this[_0x534afd(0x18a)]){let {done:_0x1d5c7f,value:_0x491a74}=await _0x35dbea[_0x534afd(0x1a8)]();if(_0x1d5c7f)break;_0x24c8d0+=_0xf4c5e5[_0x534afd(0x197)](_0x491a74,{'stream':!0x0});let _0x240c65=_0x24c8d0[_0x534afd(0x187)]('\x0a');_0x24c8d0=_0x240c65['pop']()||'';for(let _0x1c8706 of _0x240c65){if(!_0x1c8706[_0x534afd(0x1ca)](_0x534afd(0x1ab)))continue;try{let _0x1dc54f=JSON['parse'](_0x1c8706[_0x534afd(0x1aa)](0x6));if(_0x1dc54f[_0x534afd(0x1c8)]===_0x534afd(0x19c)){this[_0x534afd(0x189)]('SSE\x20connected'),this['emit']('connected');continue;}if(_0x1dc54f[_0x534afd(0x1c8)]===_0x534afd(0x19d)||_0x1dc54f[_0x534afd(0x1c8)]===_0x534afd(0x1c5)||_0x1dc54f[_0x534afd(0x1c8)]===_0x534afd(0x1a4))await this[_0x534afd(0x183)]();}catch{}}}}catch(_0x392a75){if(_0x392a75['name']===_0x534afd(0x1cb))break;this[_0x534afd(0x1bf)]('error',_0x392a75),this['log'](_0x534afd(0x1ae)+_0x392a75['message']);}if(this[_0x534afd(0x18a)])this['emit']('disconnected'),this[_0x534afd(0x189)](_0x534afd(0x1ac)+_0xdd4d03/0x3e8+_0x534afd(0x1ba)),await this[_0x534afd(0x1c9)](_0xdd4d03),_0xdd4d03=Math[_0x534afd(0x185)](_0xdd4d03*1.5,0xea60);}}async[a0_0x5c9bdd(0x183)](){const _0x27369d=a0_0x5c9bdd;try{let _0x30da67=(await this[_0x27369d(0x1b2)]('get_inbox',{'alias':this[_0x27369d(0x191)],'limit':0xa}))?.[_0x27369d(0x1cc)]||[];for(let _0x5b7353 of _0x30da67)await this[_0x27369d(0x1b2)](_0x27369d(0x1a1),{'alias':this[_0x27369d(0x191)],'message_id':_0x5b7353['id']}),this['log']('←\x20'+_0x5b7353[_0x27369d(0x199)]+':\x20'+_0x5b7353[_0x27369d(0x1bc)][_0x27369d(0x1aa)](0x0,0x3c)),this[_0x27369d(0x1bf)](_0x27369d(0x1bd),_0x5b7353),this[_0x27369d(0x1bf)](_0x27369d(0x1c0),_0x5b7353);}catch(_0x1a8d82){this[_0x27369d(0x189)]('inbox\x20error:\x20'+_0x1a8d82[_0x27369d(0x1c0)]);}}[a0_0x5c9bdd(0x1c9)](_0x210839){return new Promise(_0x29ac63=>setTimeout(_0x29ac63,_0x210839));}}var $=T;export{$ as default,T as CommHub};
1
+ const a0_0x286063=a0_0x1315;function a0_0x3941(){const _0x442b41=['call','content','10ycxWPV','toString','task','get_inbox','getReader','server','idle','toTimeString','application/json,\x20text/event-stream','slice','917322eHqsin','startsWith','disconnected','2.0','ack_inbox','completed','56138Hasrjo','normal','min','catch','status','heartbeatTimer','registered','report_status','text','parse','3822136XMbnYv','692046XzQjLc','856076IlipJA','alias','token','connectSSE','get_all_status','stringify','tools/call','read','Bearer\x20','text/event-stream','AbortError','SSE\x20connected','disconnect','send_reply','new_task','Authorization','agent','new_message','abort','inbox\x20error:\x20','error','reply','log','reconnectDelay','SSE\x20error:\x20','sleep','message','getAllStatus','connect','2093385OduKoo','send_task','match','289495NjCiAW','name','body','split','broadcast','s...','offline','SSE\x20failed:\x20','now','url','heartbeat\x20failed:\x20','processInbox','heartbeatInterval','sdk','decode','resumeId','emit','sseAbort','/mcp','messages',']\x20[commhub:','SSE\x20reconnecting\x20in\x20','running','type','send'];a0_0x3941=function(){return _0x442b41;};return a0_0x3941();}(function(_0x2dcd76,_0x13124c){const _0x537895=a0_0x1315,_0x5432b0=_0x2dcd76();while(!![]){try{const _0x441184=parseInt(_0x537895(0xc6))/0x1*(parseInt(_0x537895(0xd6))/0x2)+-parseInt(_0x537895(0xd0))/0x3+parseInt(_0x537895(0xe2))/0x4+parseInt(_0x537895(0x102))/0x5+parseInt(_0x537895(0xe1))/0x6+parseInt(_0x537895(0xff))/0x7+-parseInt(_0x537895(0xe0))/0x8;if(_0x441184===_0x13124c)break;else _0x5432b0['push'](_0x5432b0['shift']());}catch(_0x113a4b){_0x5432b0['push'](_0x5432b0['shift']());}}}(a0_0x3941,0x2cca7));import{EventEmitter as a0_0x2a398f}from'events';import{hostname as a0_0xc43b87}from'os';class T extends a0_0x2a398f{[a0_0x286063(0x10b)];[a0_0x286063(0xe3)];[a0_0x286063(0xe4)];[a0_0x286063(0xf2)];['resumeId'];[a0_0x286063(0x10e)];['reconnectDelay'];[a0_0x286063(0xdb)];[a0_0x286063(0xbc)];[a0_0x286063(0xc1)]=!0x1;constructor(_0x43d346){const _0x196353=a0_0x286063;super();if(this[_0x196353(0x10b)]=_0x43d346[_0x196353(0x10b)]['replace'](/\/$/,''),this[_0x196353(0xe3)]=_0x43d346['alias'],this['token']=_0x43d346['token'],this['agent']=_0x43d346[_0x196353(0xf2)]||_0x196353(0x10f),this[_0x196353(0x111)]='sdk-'+_0x43d346['alias']+'-'+Date['now']()[_0x196353(0xc7)](0x24),this[_0x196353(0x10e)]=_0x43d346[_0x196353(0x10e)]??0x2bf20,this['reconnectDelay']=_0x43d346[_0x196353(0xf9)]??0xbb8,_0x43d346['autoConnect']!==!0x1)this['connect']();}[a0_0x286063(0xf8)](_0x330697){const _0x9a60a7=a0_0x286063;console[_0x9a60a7(0xf8)]('['+new Date()[_0x9a60a7(0xcd)]()[_0x9a60a7(0xcf)](0x0,0x8)+_0x9a60a7(0xbf)+this[_0x9a60a7(0xe3)]+']\x20'+_0x330697);}async[a0_0x286063(0xc4)](_0x21be47,_0x331c16){const _0x4e9a67=a0_0x286063;let _0x59c1b9={'Content-Type':'application/json','Accept':_0x4e9a67(0xce)};if(this[_0x4e9a67(0xe4)])_0x59c1b9[_0x4e9a67(0xf1)]=_0x4e9a67(0xea)+this[_0x4e9a67(0xe4)];let _0x96d609=await(await fetch(this[_0x4e9a67(0x10b)]+_0x4e9a67(0xbd),{'method':'POST','headers':_0x59c1b9,'body':JSON[_0x4e9a67(0xe7)]({'jsonrpc':_0x4e9a67(0xd3),'id':Date[_0x4e9a67(0x10a)](),'method':_0x4e9a67(0xe8),'params':{'name':_0x21be47,'arguments':_0x331c16}})}))[_0x4e9a67(0xde)](),_0x50ebfc=_0x96d609[_0x4e9a67(0x101)](/data: (.+)/),_0x22ad1a=_0x50ebfc?JSON[_0x4e9a67(0xdf)](_0x50ebfc[0x1]):JSON['parse'](_0x96d609),_0xc8e24d=_0x22ad1a?.['result']?.[_0x4e9a67(0xc5)]?.[0x0]?.[_0x4e9a67(0xde)];return _0xc8e24d?JSON['parse'](_0xc8e24d):_0x22ad1a;}async[a0_0x286063(0xfe)](){const _0x1efed0=a0_0x286063;if(this[_0x1efed0(0xc1)])return;this[_0x1efed0(0xc1)]=!0x0,await this[_0x1efed0(0xda)](_0x1efed0(0xcc)),this[_0x1efed0(0xf8)](_0x1efed0(0xdc)),this[_0x1efed0(0xdb)]=setInterval(()=>{const _0x331550=_0x1efed0;this[_0x331550(0xda)](_0x331550(0xcc))[_0x331550(0xd9)](_0x85e8ff=>this['log'](_0x331550(0x10c)+_0x85e8ff[_0x331550(0xfc)]));},this[_0x1efed0(0x10e)]),this[_0x1efed0(0xe5)]();}async[a0_0x286063(0xee)](){const _0x39e1bc=a0_0x286063;if(this[_0x39e1bc(0xc1)]=!0x1,this[_0x39e1bc(0xbc)]?.[_0x39e1bc(0xf4)](),this[_0x39e1bc(0xdb)])clearInterval(this['heartbeatTimer']);await this['status'](_0x39e1bc(0x108))['catch'](()=>{}),this[_0x39e1bc(0xf8)](_0x39e1bc(0xd2));}async[a0_0x286063(0xc3)](_0x42b6b6,_0x43e016,_0x16c0a4=a0_0x286063(0xd7)){const _0x41d49d=a0_0x286063;return this[_0x41d49d(0xc4)](_0x41d49d(0x100),{'alias':_0x42b6b6,'task':_0x43e016,'priority':_0x16c0a4,'from_session':this[_0x41d49d(0xe3)]});}async[a0_0x286063(0xfc)](_0x32d6c3,_0x3564fc){const _0x2c89d1=a0_0x286063;return this[_0x2c89d1(0xc4)]('send_message',{'alias':_0x32d6c3,'message':_0x3564fc,'from_session':this['alias']});}async[a0_0x286063(0xf7)](_0x470ff9,_0x5a1beb,_0x5f3cc6=a0_0x286063(0xd5)){const _0x1fb715=a0_0x286063;return this[_0x1fb715(0xc4)](_0x1fb715(0xef),{'in_reply_to':_0x470ff9,'text':_0x5a1beb,'status':_0x5f3cc6});}async['status'](_0x54c831,_0x86b476){const _0xdcbc5=a0_0x286063;return this[_0xdcbc5(0xc4)](_0xdcbc5(0xdd),{'resume_id':this[_0xdcbc5(0x111)],'alias':this[_0xdcbc5(0xe3)],'status':_0x54c831,'server':a0_0xc43b87(),'hostname':a0_0xc43b87(),'agent':this[_0xdcbc5(0xf2)],'project_dir':process['cwd'](),..._0x86b476});}async[a0_0x286063(0xfd)](){const _0x3ae2c6=a0_0x286063;return this[_0x3ae2c6(0xc4)](_0x3ae2c6(0xe6),{});}async['broadcast'](_0x1ee081,_0x5bedfc){const _0x25ce05=a0_0x286063;return this[_0x25ce05(0xc4)](_0x25ce05(0x106),{'message':_0x1ee081,'filter_server':_0x5bedfc?.[_0x25ce05(0xcb)],'filter_status':_0x5bedfc?.[_0x25ce05(0xda)]});}async[a0_0x286063(0xe5)](){const _0x3eb980=a0_0x286063;let _0x16e05c=encodeURIComponent(this[_0x3eb980(0xe3)]),_0xd36bd8=this[_0x3eb980(0x10b)]+'/events/'+_0x16e05c,_0x3158e4=this[_0x3eb980(0xf9)];while(this[_0x3eb980(0xc1)]){try{this[_0x3eb980(0xbc)]=new AbortController();let _0x41c458={'Accept':_0x3eb980(0xeb)};if(this[_0x3eb980(0xe4)])_0x41c458[_0x3eb980(0xf1)]=_0x3eb980(0xea)+this[_0x3eb980(0xe4)];let _0x16ec00=await fetch(_0xd36bd8,{'headers':_0x41c458,'signal':this['sseAbort']['signal']});if(!_0x16ec00['ok']||!_0x16ec00['body']){this[_0x3eb980(0xf8)](_0x3eb980(0x109)+_0x16ec00[_0x3eb980(0xda)]),await this[_0x3eb980(0xfb)](_0x3158e4),_0x3158e4=Math[_0x3eb980(0xd8)](_0x3158e4*1.5,0xea60);continue;}_0x3158e4=this[_0x3eb980(0xf9)];let _0x3138da=_0x16ec00[_0x3eb980(0x104)][_0x3eb980(0xca)](),_0x347868=new TextDecoder(),_0x1c1c40='';while(this['running']){let {done:_0x28cd71,value:_0x44abca}=await _0x3138da[_0x3eb980(0xe9)]();if(_0x28cd71)break;_0x1c1c40+=_0x347868[_0x3eb980(0x110)](_0x44abca,{'stream':!0x0});let _0x504993=_0x1c1c40[_0x3eb980(0x105)]('\x0a');_0x1c1c40=_0x504993['pop']()||'';for(let _0x30b1eb of _0x504993){if(!_0x30b1eb[_0x3eb980(0xd1)]('data:\x20'))continue;try{let _0x55cf6c=JSON['parse'](_0x30b1eb[_0x3eb980(0xcf)](0x6));if(_0x55cf6c[_0x3eb980(0xc2)]==='connected'){this[_0x3eb980(0xf8)](_0x3eb980(0xed)),this[_0x3eb980(0xbb)]('connected');continue;}if(_0x55cf6c[_0x3eb980(0xc2)]===_0x3eb980(0xf0)||_0x55cf6c[_0x3eb980(0xc2)]===_0x3eb980(0xf3)||_0x55cf6c['type']==='broadcast')await this[_0x3eb980(0x10d)]();}catch{}}}}catch(_0x511c75){if(_0x511c75[_0x3eb980(0x103)]===_0x3eb980(0xec))break;this[_0x3eb980(0xbb)](_0x3eb980(0xf6),_0x511c75),this['log'](_0x3eb980(0xfa)+_0x511c75[_0x3eb980(0xfc)]);}if(this[_0x3eb980(0xc1)])this['emit'](_0x3eb980(0xd2)),this[_0x3eb980(0xf8)](_0x3eb980(0xc0)+_0x3158e4/0x3e8+_0x3eb980(0x107)),await this[_0x3eb980(0xfb)](_0x3158e4),_0x3158e4=Math['min'](_0x3158e4*1.5,0xea60);}}async[a0_0x286063(0x10d)](){const _0x4ab663=a0_0x286063;try{let _0x3d9ed8=(await this['call'](_0x4ab663(0xc9),{'alias':this[_0x4ab663(0xe3)],'limit':0xa}))?.[_0x4ab663(0xbe)]||[];for(let _0x4f1611 of _0x3d9ed8)await this[_0x4ab663(0xc4)](_0x4ab663(0xd4),{'alias':this[_0x4ab663(0xe3)],'message_id':_0x4f1611['id']}),this[_0x4ab663(0xf8)]('←\x20'+_0x4f1611['from_session']+':\x20'+_0x4f1611['content'][_0x4ab663(0xcf)](0x0,0x3c)),this[_0x4ab663(0xbb)](_0x4ab663(0xc8),_0x4f1611),this[_0x4ab663(0xbb)](_0x4ab663(0xfc),_0x4f1611);}catch(_0x3d3c03){this[_0x4ab663(0xf8)](_0x4ab663(0xf5)+_0x3d3c03[_0x4ab663(0xfc)]);}}[a0_0x286063(0xfb)](_0x49d215){return new Promise(_0x48846c=>setTimeout(_0x48846c,_0x49d215));}}var $=T;function a0_0x1315(_0x46775c,_0x1b72ed){_0x46775c=_0x46775c-0xbb;const _0x3941e6=a0_0x3941();let _0x1315e7=_0x3941e6[_0x46775c];return _0x1315e7;}export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x231b7f=a0_0x1ea8;(function(_0x5f4e92,_0x51eb93){const _0x4813ee=a0_0x1ea8,_0x59692a=_0x5f4e92();while(!![]){try{const _0xb3a01b=-parseInt(_0x4813ee(0x1d3))/0x1*(parseInt(_0x4813ee(0x1ce))/0x2)+-parseInt(_0x4813ee(0x1cb))/0x3+-parseInt(_0x4813ee(0x200))/0x4+-parseInt(_0x4813ee(0x21d))/0x5*(-parseInt(_0x4813ee(0x22b))/0x6)+parseInt(_0x4813ee(0x232))/0x7*(-parseInt(_0x4813ee(0x228))/0x8)+-parseInt(_0x4813ee(0x1c1))/0x9*(parseInt(_0x4813ee(0x1fb))/0xa)+parseInt(_0x4813ee(0x210))/0xb;if(_0xb3a01b===_0x51eb93)break;else _0x59692a['push'](_0x59692a['shift']());}catch(_0x29f396){_0x59692a['push'](_0x59692a['shift']());}}}(a0_0x8245,0xd2afd));import{readFileSync as a0_0x486f51,existsSync as a0_0x423ca0}from'fs';import{randomUUID as a0_0x315ad1}from'crypto';import{join as a0_0x268e90}from'path';import{hostname as a0_0x2c5713}from'os';import{execSync as a0_0x3a5b48}from'child_process';import{Server as a0_0x585681}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x41586b}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x211877,CallToolRequestSchema as a0_0xfa524b}from'@modelcontextprotocol/sdk/types.js';function p(_0x113aa8){const _0x4e6187=a0_0x1ea8;if(!a0_0x423ca0(_0x113aa8))return;for(let _0x5bb0fe of a0_0x486f51(_0x113aa8,_0x4e6187(0x1bd))[_0x4e6187(0x1bc)]('\x0a')){let _0x5c1074=_0x5bb0fe[_0x4e6187(0x1be)]();if(!_0x5c1074||_0x5c1074['startsWith']('#'))continue;let _0x3fa029=_0x5c1074[_0x4e6187(0x22f)]('=');if(_0x3fa029<0x0)continue;let _0x54a5f4=_0x5c1074[_0x4e6187(0x1ee)](0x0,_0x3fa029)[_0x4e6187(0x1be)](),_0x35106f=_0x5c1074['slice'](_0x3fa029+0x1)[_0x4e6187(0x1be)]()[_0x4e6187(0x225)](/^["']|["']$/g,'');if(!process.env[_0x54a5f4])process.env[_0x54a5f4]=_0x35106f;}}var C=process.env.HOME||'~',T=a0_0x268e90(C,a0_0x231b7f(0x1d6));p(a0_0x268e90(T,'.env'));var L=process['cwd']()[a0_0x231b7f(0x225)](/\//g,'-');p(a0_0x268e90(T,L,a0_0x231b7f(0x217)));function U(){const _0x41769c=a0_0x231b7f;try{return a0_0x3a5b48(_0x41769c(0x1d5),{'encoding':'utf-8','timeout':0x7d0})['trim']();}catch{return'';}}function a0_0x8245(){const _0x320b1b=['2025-03-26','commhub','shutting\x20down,\x20reporting\x20offline...','set','string','stderr','replace','from','SSE\x20stream\x20ended,\x20reconnecting...','347112dcxZmM','error','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','6700164zcfVHF','Bearer\x20','SSE\x20connected\x20as\x20\x22','Authorization','indexOf','no\x20response','commhub-channel','112MkZEeB','failed','send_reply','report_status','initialize','decode','\x20ALIAS=','alias','application/json','hub','exit','stdin','connected','send_message','then','warning:\x20could\x20not\x20register:\x20','connecting\x20to\x20','commhub_send_message','MCP\x20stdio\x20connected','write','find','split','utf-8','trim','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','data:\x20','18uyVryh','message','POST','messages','get','idle','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','commhub_send_task','join','broadcast','3576831RWEzlw','working','ENV:\x20URL=','7110RMzCGd','in_progress','result','starting\x20SSE\x20listener...','params','27DelEvf','.anet','tmux\x20display-message\x20-p\x20\x27#S\x27','.claude/channels/commhub','object','\x20PROJECT_ENV=','SIGTERM','task','toTimeString','parse','read','claude-code','0.3.0','Priority\x20(default:\x20normal)','high','number','/events/','\x20CWD=','SSE\x20error:\x20','startsWith','end','content','priority','from_session','get_inbox','CommHub\x20init\x20failed:\x20','http://127.0.0.1:9200','slice','type','new_message','commhub_report_status','text','blocked','notification','ack_inbox','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','config.json','body','Session\x20alias:\x20','4569330BzvHWP','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','init\x20failed:\x20','catch','status','5773472fMLymQ','tools/call','notifications/claude/channel','cwd','none','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','2.0','replied','SIGINT','Task\x20content','...\x20TMUX=','completed','normal','Target\x20session\x20alias','fatal:\x20','SSE\x20fatal:\x20','44945989IuwoOK','stringify','commhub_get_all_status','low','length','application/json,\x20text/event-stream','unknown\x20tool','.env','setRequestHandler','cancelled','commhub_reply','Current\x20task\x20description','registered\x20as\x20\x22','5XWxNhW','connect'];a0_0x8245=function(){return _0x320b1b;};return a0_0x8245();}function v(){const _0x315fc3=a0_0x231b7f;try{let _0x50a431=a0_0x268e90(C,_0x315fc3(0x1d4),_0x315fc3(0x1f8));if(a0_0x423ca0(_0x50a431))return JSON[_0x315fc3(0x1dc)](a0_0x486f51(_0x50a431,_0x315fc3(0x1bd)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x231b7f(0x1b0)]||a0_0x231b7f(0x1ed),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x2c5713(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x315ad1(),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x17897d){const _0x2929be=a0_0x231b7f;let _0x5f5114=new Date()[_0x2929be(0x1db)]()['slice'](0x0,0x8);process[_0x2929be(0x224)][_0x2929be(0x1ba)]('['+_0x5f5114+']\x20[commhub]\x20'+_0x17897d+'\x0a');}function h(_0x1ecb07){return new Promise(_0x43d881=>setTimeout(_0x43d881,_0x1ecb07));}Y(a0_0x231b7f(0x1cd)+f+a0_0x231b7f(0x1ad)+Z+'\x20RESUME_ID='+w[a0_0x231b7f(0x1ee)](0x0,0x8)+a0_0x231b7f(0x20a)+(j||a0_0x231b7f(0x204))+a0_0x231b7f(0x1e4)+process[a0_0x231b7f(0x203)]()+a0_0x231b7f(0x1d8)+L);var k=new Map(),K=new a0_0x585681({'name':a0_0x231b7f(0x231),'version':a0_0x231b7f(0x1df)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x231b7f(0x1bf),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x231b7f(0x1fc),a0_0x231b7f(0x1c7),a0_0x231b7f(0x1fa)+Z][a0_0x231b7f(0x1c9)]('\x0a')});K[a0_0x231b7f(0x218)](a0_0x211877,async()=>({'tools':[{'name':a0_0x231b7f(0x21a),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x231b7f(0x1d7),'properties':{'task_id':{'type':a0_0x231b7f(0x223),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x231b7f(0x223),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x231b7f(0x223),'enum':[a0_0x231b7f(0x20b),a0_0x231b7f(0x233),a0_0x231b7f(0x219),a0_0x231b7f(0x1f3),a0_0x231b7f(0x229),a0_0x231b7f(0x1cf)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x231b7f(0x1f2)]}},{'name':a0_0x231b7f(0x1f1),'description':a0_0x231b7f(0x1f7),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x231b7f(0x223),'enum':[a0_0x231b7f(0x1cc),a0_0x231b7f(0x1c6),a0_0x231b7f(0x1f3),a0_0x231b7f(0x229)]},'task':{'type':a0_0x231b7f(0x223),'description':a0_0x231b7f(0x21b)},'progress':{'type':a0_0x231b7f(0x1e2),'description':'Progress\x200-100'}},'required':[a0_0x231b7f(0x1ff)]}},{'name':a0_0x231b7f(0x1c8),'description':a0_0x231b7f(0x205),'inputSchema':{'type':a0_0x231b7f(0x1d7),'properties':{'alias':{'type':a0_0x231b7f(0x223),'description':a0_0x231b7f(0x20d)},'task':{'type':a0_0x231b7f(0x223),'description':a0_0x231b7f(0x209)},'priority':{'type':a0_0x231b7f(0x223),'enum':[a0_0x231b7f(0x1e1),a0_0x231b7f(0x20c),a0_0x231b7f(0x213)],'description':a0_0x231b7f(0x1e0)}},'required':[a0_0x231b7f(0x1ae),a0_0x231b7f(0x1da)]}},{'name':a0_0x231b7f(0x1b8),'description':a0_0x231b7f(0x1f6),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x231b7f(0x223),'description':a0_0x231b7f(0x20d)},'message':{'type':'string','description':'Message\x20content'}},'required':[a0_0x231b7f(0x1ae),a0_0x231b7f(0x1c2)]}},{'name':'commhub_get_all_status','description':a0_0x231b7f(0x22a),'inputSchema':{'type':a0_0x231b7f(0x1d7),'properties':{}}}]}));async function P(_0x49d2b5,_0x3b03ee){const _0xa7fce=a0_0x231b7f;let _0x982b0d=await fetch(f+'/mcp',{'method':_0xa7fce(0x1c3),'headers':{'Content-Type':_0xa7fce(0x1af),'Accept':_0xa7fce(0x215),...X?{'Authorization':_0xa7fce(0x22c)+X}:{}},'body':JSON[_0xa7fce(0x211)]({'jsonrpc':'2.0','id':0x1,'method':_0xa7fce(0x1ab),'params':{'protocolVersion':_0xa7fce(0x21f),'capabilities':{},'clientInfo':{'name':_0xa7fce(0x231),'version':_0xa7fce(0x1df)}}})});if(!_0x982b0d['ok']){let _0x410a4f=await _0x982b0d['text']();return Y(_0xa7fce(0x1ec)+_0x982b0d[_0xa7fce(0x1ff)]+'\x20'+_0x410a4f['slice'](0x0,0x64)),{'ok':!0x1,'error':_0xa7fce(0x1fd)+_0x982b0d['status']};}await _0x982b0d[_0xa7fce(0x1f2)]();let _0x22875c=(await(await fetch(f+'/mcp',{'method':_0xa7fce(0x1c3),'headers':{'Content-Type':'application/json','Accept':_0xa7fce(0x215),...X?{'Authorization':_0xa7fce(0x22c)+X}:{}},'body':JSON[_0xa7fce(0x211)]({'jsonrpc':_0xa7fce(0x206),'id':0x2,'method':_0xa7fce(0x201),'params':{'name':_0x49d2b5,'arguments':_0x3b03ee}})}))[_0xa7fce(0x1f2)]())[_0xa7fce(0x1bc)]('\x0a')[_0xa7fce(0x1bb)](_0x248b3e=>_0x248b3e[_0xa7fce(0x1e6)](_0xa7fce(0x1c0)));if(_0x22875c){let _0x2e72c6=JSON[_0xa7fce(0x1dc)](_0x22875c[_0xa7fce(0x1ee)](0x6));return _0x2e72c6?.[_0xa7fce(0x1d0)]?.[_0xa7fce(0x1e8)]?.[0x0]?.[_0xa7fce(0x1f2)]?JSON[_0xa7fce(0x1dc)](_0x2e72c6['result'][_0xa7fce(0x1e8)][0x0]['text']):_0x2e72c6;}return{'ok':!0x1,'error':_0xa7fce(0x230)};}K[a0_0x231b7f(0x218)](a0_0xfa524b,async _0x2f88ee=>{const _0x2f7b48=a0_0x231b7f;let {name:_0x2008b3,arguments:_0x5bae6c}=_0x2f88ee[_0x2f7b48(0x1d2)];if(_0x2008b3===_0x2f7b48(0x21a)){let {task_id:_0x21404e,text:_0x41ebd6,status:_0x3b8a56}=_0x5bae6c;if(_0x3b8a56==='completed'||_0x3b8a56===_0x2f7b48(0x233)||_0x3b8a56===_0x2f7b48(0x219)){let _0x16205b=_0x3b8a56===_0x2f7b48(0x20b)?_0x2f7b48(0x207):_0x3b8a56,_0x1b2be5=_0x21404e?k[_0x2f7b48(0x1c5)](_0x21404e)||_0x2f7b48(0x1b0):_0x2f7b48(0x1b0),_0x5be135=await P(_0x2f7b48(0x234),{'alias':_0x1b2be5,'text':_0x41ebd6,'in_reply_to':_0x21404e||void 0x0,'status':_0x16205b,'from_session':Z});if(_0x21404e)k['delete'](_0x21404e);return{'content':[{'type':'text','text':JSON[_0x2f7b48(0x211)](_0x5be135)}]};}let _0x1549f=await P(_0x2f7b48(0x235),{'resume_id':w,'alias':Z,'status':_0x3b8a56==='blocked'?'blocked':_0x3b8a56==='error'?'error':_0x2f7b48(0x1cc),'task':_0x41ebd6[_0x2f7b48(0x1ee)](0x0,0xc8),'output':_0x41ebd6});return{'content':[{'type':_0x2f7b48(0x1f2),'text':JSON['stringify'](_0x1549f)}]};}if(_0x2008b3==='commhub_report_status'){let {status:_0x54ceb7,task:_0x417ae9,progress:_0x439042}=_0x5bae6c,_0x517fcc=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x54ceb7,'task':_0x417ae9,'progress':_0x439042});return{'content':[{'type':_0x2f7b48(0x1f2),'text':JSON[_0x2f7b48(0x211)](_0x517fcc)}]};}if(_0x2008b3===_0x2f7b48(0x1c8)){let {alias:_0x43845c,task:_0x10c23e,priority:_0x348b2d}=_0x5bae6c,_0x334229=await P('send_task',{'alias':_0x43845c,'task':_0x10c23e,'priority':_0x348b2d||_0x2f7b48(0x20c),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x2f7b48(0x211)](_0x334229)}]};}if(_0x2008b3===_0x2f7b48(0x1b8)){let {alias:_0x1c7d37,message:_0x2e37c0}=_0x5bae6c,_0x5c11b2=await P(_0x2f7b48(0x1b4),{'alias':_0x1c7d37,'message':_0x2e37c0,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x2f7b48(0x211)](_0x5c11b2)}]};}if(_0x2008b3===_0x2f7b48(0x212)){let _0x364512=await P('get_all_status',{});return{'content':[{'type':_0x2f7b48(0x1f2),'text':JSON[_0x2f7b48(0x211)](_0x364512)}]};}return{'content':[{'type':_0x2f7b48(0x1f2),'text':JSON[_0x2f7b48(0x211)]({'error':_0x2f7b48(0x216)})}]};});async function u(){const _0x53b6d2=a0_0x231b7f;let _0x546db1=f+_0x53b6d2(0x1e3)+encodeURIComponent(Z),_0x2c8115={};if(X)_0x2c8115[_0x53b6d2(0x22e)]=_0x53b6d2(0x22c)+X;Y(_0x53b6d2(0x1b7)+_0x546db1);while(!0x0){try{let _0x43ce12=await fetch(_0x546db1,{'headers':_0x2c8115});if(!_0x43ce12['ok']){Y(_0x53b6d2(0x1e5)+_0x43ce12[_0x53b6d2(0x1ff)]+'\x20'+_0x43ce12['statusText']),await h(0x1388);continue;}let _0x48986c=_0x43ce12[_0x53b6d2(0x1f9)]['getReader'](),_0x184149=new TextDecoder(),_0x1bc4fb='';while(!0x0){let {done:_0xa20da2,value:_0x1227e5}=await _0x48986c[_0x53b6d2(0x1dd)]();if(_0xa20da2)break;_0x1bc4fb+=_0x184149[_0x53b6d2(0x1ac)](_0x1227e5,{'stream':!0x0});let _0x57b0db=_0x1bc4fb['split']('\x0a\x0a');_0x1bc4fb=_0x57b0db['pop']()||'';for(let _0x599749 of _0x57b0db){let _0x4432ee=_0x599749[_0x53b6d2(0x1bc)]('\x0a')[_0x53b6d2(0x1bb)](_0x5be654=>_0x5be654[_0x53b6d2(0x1e6)](_0x53b6d2(0x1c0)));if(!_0x4432ee)continue;try{let _0x37251a=JSON['parse'](_0x4432ee[_0x53b6d2(0x1ee)](0x6));await S(_0x37251a);}catch(_0x16a240){Y('parse\x20error:\x20'+_0x16a240);}}}Y(_0x53b6d2(0x227));}catch(_0xb83db){Y('SSE\x20connection\x20error:\x20'+_0xb83db);}await h(0xbb8);}}function a0_0x1ea8(_0x4d3082,_0x32b0ba){_0x4d3082=_0x4d3082-0x1ab;const _0x824566=a0_0x8245();let _0x1ea8ee=_0x824566[_0x4d3082];return _0x1ea8ee;}async function S(_0x13dab7){const _0x38ec20=a0_0x231b7f;if(_0x13dab7[_0x38ec20(0x1ef)]===_0x38ec20(0x1b3)){Y(_0x38ec20(0x22d)+Z+'\x22');return;}if(_0x13dab7['type']===_0x38ec20(0x1f0)){if(Y('←\x20message\x20from\x20'+_0x13dab7[_0x38ec20(0x226)]+':\x20'+_0x13dab7['message'][_0x38ec20(0x1ee)](0x0,0x3c)),await K[_0x38ec20(0x1f4)]({'method':_0x38ec20(0x202),'params':{'content':_0x13dab7['message'],'meta':{'sender':_0x13dab7[_0x38ec20(0x226)]||_0x38ec20(0x1b0),'sender_id':'commhub','user':_0x13dab7[_0x38ec20(0x226)]||_0x38ec20(0x1b0),'priority':_0x38ec20(0x20c)}}}),_0x13dab7['message_id'])await P(_0x38ec20(0x1f5),{'alias':Z,'message_id':_0x13dab7['message_id']});return;}if(_0x13dab7[_0x38ec20(0x1ef)]==='new_task'||_0x13dab7[_0x38ec20(0x1ef)]===_0x38ec20(0x1ca)){Y('←\x20'+_0x13dab7[_0x38ec20(0x1ef)]+':\x20inbox_count='+_0x13dab7['inbox_count']+'\x20priority='+(_0x13dab7['priority']||_0x38ec20(0x20c)));let _0x5e2d2d=await P(_0x38ec20(0x1eb),{'alias':Z,'limit':0x5});if(_0x5e2d2d?.['ok']&&_0x5e2d2d[_0x38ec20(0x1c4)]?.[_0x38ec20(0x214)]>0x0)for(let _0x4f3a09 of _0x5e2d2d[_0x38ec20(0x1c4)]){let _0x292757={'sender':_0x4f3a09[_0x38ec20(0x1ea)]||_0x38ec20(0x1b0),'sender_id':_0x38ec20(0x220),'user':_0x4f3a09[_0x38ec20(0x1ea)]||_0x38ec20(0x1b0),'task_id':_0x4f3a09['id'],'priority':_0x4f3a09[_0x38ec20(0x1e9)]||_0x38ec20(0x20c)};k[_0x38ec20(0x222)](_0x4f3a09['id'],_0x4f3a09[_0x38ec20(0x1ea)]||_0x38ec20(0x1b0)),await K[_0x38ec20(0x1f4)]({'method':_0x38ec20(0x202),'params':{'content':_0x4f3a09[_0x38ec20(0x1e8)],'meta':_0x292757}}),Y('→\x20injected\x20task\x20'+_0x4f3a09['id'][_0x38ec20(0x1ee)](0x0,0x8)+'\x20from\x20'+_0x4f3a09[_0x38ec20(0x1ea)]+':\x20'+_0x4f3a09[_0x38ec20(0x1e8)][_0x38ec20(0x1ee)](0x0,0x3c)),await P(_0x38ec20(0x1f5),{'alias':Z,'message_id':_0x4f3a09['id']});}}}async function A(){const _0x4db8b9=a0_0x231b7f;let _0x43d6ad=new a0_0x41586b();await K[_0x4db8b9(0x21e)](_0x43d6ad),Y(_0x4db8b9(0x1b9)),Y(_0x4db8b9(0x1d1)),u()[_0x4db8b9(0x1fe)](_0x1c9bde=>Y(_0x4db8b9(0x20f)+_0x1c9bde)),P(_0x4db8b9(0x235),{'resume_id':w,'alias':Z,'status':_0x4db8b9(0x1c6),'server':a0_0x2c5713(),'hostname':a0_0x2c5713(),'agent':_0x4db8b9(0x1de),'project_dir':process[_0x4db8b9(0x203)](),'tmux_name':j||void 0x0})[_0x4db8b9(0x1b5)](()=>Y(_0x4db8b9(0x21c)+Z+'\x22\x20('+w[_0x4db8b9(0x1ee)](0x0,0x8)+')'))['catch'](_0x628d03=>Y(_0x4db8b9(0x1b6)+_0x628d03)),setInterval(()=>{const _0x326269=_0x4db8b9;P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x2c5713(),'hostname':a0_0x2c5713(),'agent':_0x326269(0x1de),'project_dir':process[_0x326269(0x203)](),'tmux_name':j||void 0x0})[_0x326269(0x1fe)](_0x567b24=>Y('heartbeat\x20failed:\x20'+_0x567b24));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x231b7f(0x1fe)](_0x4582a6=>{const _0x141805=a0_0x231b7f;Y(_0x141805(0x20e)+_0x4582a6),process[_0x141805(0x1b1)](0x1);});async function N(){const _0x3a9b94=a0_0x231b7f;Y(_0x3a9b94(0x221)),await P(_0x3a9b94(0x235),{'resume_id':w,'alias':Z,'status':_0x3a9b94(0x229),'task':'session\x20disconnected'})['catch'](()=>{}),process[_0x3a9b94(0x1b1)](0x0);}process[a0_0x231b7f(0x1b2)]['on'](a0_0x231b7f(0x1e7),()=>N()),process['on'](a0_0x231b7f(0x1d9),()=>N()),process['on'](a0_0x231b7f(0x208),()=>N());
2
+ const a0_0x1911d7=a0_0x4476;(function(_0x5ddb49,_0x1392c5){const _0x3871ee=a0_0x4476,_0x4cb3b9=_0x5ddb49();while(!![]){try{const _0x4eb9e4=-parseInt(_0x3871ee(0xf2))/0x1+parseInt(_0x3871ee(0x8e))/0x2+-parseInt(_0x3871ee(0xe6))/0x3*(-parseInt(_0x3871ee(0xa4))/0x4)+-parseInt(_0x3871ee(0xc6))/0x5+parseInt(_0x3871ee(0xdf))/0x6+parseInt(_0x3871ee(0xdc))/0x7*(parseInt(_0x3871ee(0xa9))/0x8)+parseInt(_0x3871ee(0xdd))/0x9;if(_0x4eb9e4===_0x1392c5)break;else _0x4cb3b9['push'](_0x4cb3b9['shift']());}catch(_0x24d1c8){_0x4cb3b9['push'](_0x4cb3b9['shift']());}}}(a0_0xa32b,0x6580a));import{readFileSync as a0_0x176b01,existsSync as a0_0x5ebc88}from'fs';import{randomUUID as a0_0xd569bd}from'crypto';function a0_0x4476(_0x382175,_0x4a30ce){_0x382175=_0x382175-0x6b;const _0xa32bfd=a0_0xa32b();let _0x4476d9=_0xa32bfd[_0x382175];return _0x4476d9;}import{join as a0_0x374525}from'path';import{hostname as a0_0x3ef463}from'os';import{execSync as a0_0x2fd266}from'child_process';import{Server as a0_0x23f068}from'@modelcontextprotocol/sdk/server/index.js';function a0_0xa32b(){const _0xa44839=['connect','SIGINT','completed','3hUMkgi',':\x20inbox_count=','cwd','normal','SSE\x20error:\x20','exit','string','status','no\x20response','result','body','set','734399IGyjZD','commhub_send_message','text','\x20RESUME_ID=','ready\x20—\x20waiting\x20for\x20events','report_status','catch','\x20from\x20','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','config.json','SSE\x20fatal:\x20','failed','error','.env','messages','from','fatal:\x20','→\x20injected\x20task\x20','in_progress','shutting\x20down,\x20reporting\x20offline...','new_message','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','commhub_get_all_status','getReader','Progress\x200-100','utf-8','stringify','SSE\x20stream\x20ended,\x20reconnecting...','priority','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','commhub_send_task','find','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','Priority\x20(default:\x20normal)','working','decode','from_session','type','replied','unknown\x20tool','779124WpqmWI','hub','token','high','replace','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','message','get','session\x20disconnected','application/json','join','ENV:\x20URL=','inbox_count','Target\x20session\x20alias','notifications/claude/channel','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','commhub','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','claude-code','Current\x20task\x20description','MCP\x20stdio\x20connected','none','777192UiQNph','stderr','.anet','commhub_report_status','delete','90112XINucP','idle','trim','pop','split',']\x20[commhub]\x20','\x20CWD=','ack_inbox','content','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','send_reply','/mcp','slice','0.3.0','parse\x20error:\x20','/events/','message_id','\x20ALIAS=','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','object','blocked','\x20priority=','tools/call','task','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','2025-03-26','POST','initialize','Message\x20content','1694825DWxBTL','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','Bearer\x20','broadcast','toTimeString','write','\x20PROJECT_ENV=','commhub-channel','length','Authorization','Session\x20alias:\x20','send_message','get_inbox','application/json,\x20text/event-stream','SSE\x20connection\x20error:\x20','data:\x20','alias','2.0','startsWith','warning:\x20could\x20not\x20register:\x20','notification','setRequestHandler','140wnTFPL','615483mHZZLe','...\x20TMUX=','3669546HrIjHw','parse','starting\x20SSE\x20listener...','indexOf'];a0_0xa32b=function(){return _0xa44839;};return a0_0xa32b();}import{StdioServerTransport as a0_0xa0284f}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x57a6fb,CallToolRequestSchema as a0_0x3b3a6b}from'@modelcontextprotocol/sdk/types.js';function p(_0x35ff77){const _0x185f0e=a0_0x4476;if(!a0_0x5ebc88(_0x35ff77))return;for(let _0x1c48ef of a0_0x176b01(_0x35ff77,_0x185f0e(0x7f))[_0x185f0e(0xad)]('\x0a')){let _0x2fa411=_0x1c48ef[_0x185f0e(0xab)]();if(!_0x2fa411||_0x2fa411['startsWith']('#'))continue;let _0x582cb4=_0x2fa411[_0x185f0e(0xe2)]('=');if(_0x582cb4<0x0)continue;let _0x5e4450=_0x2fa411[_0x185f0e(0xb5)](0x0,_0x582cb4)[_0x185f0e(0xab)](),_0x15edad=_0x2fa411['slice'](_0x582cb4+0x1)[_0x185f0e(0xab)]()[_0x185f0e(0x92)](/^["']|["']$/g,'');if(!process.env[_0x5e4450])process.env[_0x5e4450]=_0x15edad;}}var C=process.env.HOME||'~',T=a0_0x374525(C,'.claude/channels/commhub');p(a0_0x374525(T,a0_0x1911d7(0x73)));var L=process['cwd']()[a0_0x1911d7(0x92)](/\//g,'-');p(a0_0x374525(T,L,a0_0x1911d7(0x73)));function U(){const _0xff573=a0_0x1911d7;try{return a0_0x2fd266('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':'utf-8','timeout':0x7d0})[_0xff573(0xab)]();}catch{return'';}}function v(){const _0x211bd9=a0_0x1911d7;try{let _0x31749f=a0_0x374525(C,_0x211bd9(0xa6),_0x211bd9(0x6f));if(a0_0x5ebc88(_0x31749f))return JSON[_0x211bd9(0xe0)](a0_0x176b01(_0x31749f,_0x211bd9(0x7f)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H['hub']||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x3ef463(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0xd569bd(),X=process.env.COMMHUB_TOKEN||H[a0_0x1911d7(0x90)]||'';function Y(_0x458b73){const _0x50f159=a0_0x1911d7;let _0x2e54cf=new Date()[_0x50f159(0xca)]()[_0x50f159(0xb5)](0x0,0x8);process[_0x50f159(0xa5)][_0x50f159(0xcb)]('['+_0x2e54cf+_0x50f159(0xae)+_0x458b73+'\x0a');}function h(_0x28aa51){return new Promise(_0x49077f=>setTimeout(_0x49077f,_0x28aa51));}Y(a0_0x1911d7(0x99)+f+a0_0x1911d7(0xba)+Z+a0_0x1911d7(0xf5)+w[a0_0x1911d7(0xb5)](0x0,0x8)+a0_0x1911d7(0xde)+(j||a0_0x1911d7(0xa3))+a0_0x1911d7(0xaf)+process[a0_0x1911d7(0xe8)]()+a0_0x1911d7(0xcc)+L);var k=new Map(),K=new a0_0x23f068({'name':a0_0x1911d7(0xcd),'version':a0_0x1911d7(0xb6)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x1911d7(0x6e),a0_0x1911d7(0xc1),a0_0x1911d7(0xc7),a0_0x1911d7(0xb2),a0_0x1911d7(0xd0)+Z][a0_0x1911d7(0x98)]('\x0a')});K[a0_0x1911d7(0xdb)](a0_0x57a6fb,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x1911d7(0x7b),'inputSchema':{'type':a0_0x1911d7(0xbc),'properties':{'task_id':{'type':a0_0x1911d7(0xec),'description':a0_0x1911d7(0x9d)},'text':{'type':a0_0x1911d7(0xec),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x1911d7(0xec),'enum':[a0_0x1911d7(0xe5),'failed','cancelled',a0_0x1911d7(0xbd),a0_0x1911d7(0x72),a0_0x1911d7(0x78)],'description':a0_0x1911d7(0xbb)}},'required':[a0_0x1911d7(0xf4)]}},{'name':a0_0x1911d7(0xa7),'description':a0_0x1911d7(0x9f),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x1911d7(0xec),'enum':[a0_0x1911d7(0x88),a0_0x1911d7(0xaa),'blocked',a0_0x1911d7(0x72)]},'task':{'type':a0_0x1911d7(0xec),'description':a0_0x1911d7(0xa1)},'progress':{'type':'number','description':a0_0x1911d7(0x7e)}},'required':[a0_0x1911d7(0xed)]}},{'name':a0_0x1911d7(0x84),'description':a0_0x1911d7(0x93),'inputSchema':{'type':a0_0x1911d7(0xbc),'properties':{'alias':{'type':a0_0x1911d7(0xec),'description':a0_0x1911d7(0x9b)},'task':{'type':a0_0x1911d7(0xec),'description':'Task\x20content'},'priority':{'type':a0_0x1911d7(0xec),'enum':[a0_0x1911d7(0x91),a0_0x1911d7(0xe9),'low'],'description':a0_0x1911d7(0x87)}},'required':['alias',a0_0x1911d7(0xc0)]}},{'name':a0_0x1911d7(0xf3),'description':a0_0x1911d7(0x86),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x1911d7(0xec),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x1911d7(0xec),'description':a0_0x1911d7(0xc5)}},'required':[a0_0x1911d7(0xd6),a0_0x1911d7(0x94)]}},{'name':a0_0x1911d7(0x7c),'description':a0_0x1911d7(0x83),'inputSchema':{'type':a0_0x1911d7(0xbc),'properties':{}}}]}));async function P(_0xd25b62,_0x536664){const _0xf090bd=a0_0x1911d7;let _0x3a90d0=await fetch(f+'/mcp',{'method':_0xf090bd(0xc3),'headers':{'Content-Type':_0xf090bd(0x97),'Accept':_0xf090bd(0xd3),...X?{'Authorization':_0xf090bd(0xc8)+X}:{}},'body':JSON[_0xf090bd(0x80)]({'jsonrpc':_0xf090bd(0xd7),'id':0x1,'method':_0xf090bd(0xc4),'params':{'protocolVersion':_0xf090bd(0xc2),'capabilities':{},'clientInfo':{'name':_0xf090bd(0xcd),'version':'0.3.0'}}})});if(!_0x3a90d0['ok']){let _0x16d2f3=await _0x3a90d0[_0xf090bd(0xf4)]();return Y('CommHub\x20init\x20failed:\x20'+_0x3a90d0['status']+'\x20'+_0x16d2f3[_0xf090bd(0xb5)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x3a90d0['status']};}await _0x3a90d0[_0xf090bd(0xf4)]();let _0x13cfed=(await(await fetch(f+_0xf090bd(0xb4),{'method':_0xf090bd(0xc3),'headers':{'Content-Type':'application/json','Accept':_0xf090bd(0xd3),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0xf090bd(0x80)]({'jsonrpc':_0xf090bd(0xd7),'id':0x2,'method':_0xf090bd(0xbf),'params':{'name':_0xd25b62,'arguments':_0x536664}})}))[_0xf090bd(0xf4)]())[_0xf090bd(0xad)]('\x0a')['find'](_0x348c6d=>_0x348c6d[_0xf090bd(0xd8)]('data:\x20'));if(_0x13cfed){let _0x303305=JSON[_0xf090bd(0xe0)](_0x13cfed[_0xf090bd(0xb5)](0x6));return _0x303305?.[_0xf090bd(0xef)]?.[_0xf090bd(0xb1)]?.[0x0]?.[_0xf090bd(0xf4)]?JSON[_0xf090bd(0xe0)](_0x303305[_0xf090bd(0xef)][_0xf090bd(0xb1)][0x0]['text']):_0x303305;}return{'ok':!0x1,'error':_0xf090bd(0xee)};}K[a0_0x1911d7(0xdb)](a0_0x3b3a6b,async _0x269cc4=>{const _0x2582a2=a0_0x1911d7;let {name:_0x25a8a7,arguments:_0x463e86}=_0x269cc4['params'];if(_0x25a8a7==='commhub_reply'){let {task_id:_0x26c8a3,text:_0x2e549e,status:_0x5866f9}=_0x463e86;if(_0x5866f9===_0x2582a2(0xe5)||_0x5866f9===_0x2582a2(0x71)||_0x5866f9==='cancelled'){let _0x40d23d=_0x5866f9===_0x2582a2(0xe5)?_0x2582a2(0x8c):_0x5866f9,_0x5342b1=_0x26c8a3?k[_0x2582a2(0x95)](_0x26c8a3)||_0x2582a2(0x8f):_0x2582a2(0x8f),_0x46aaae=await P(_0x2582a2(0xb3),{'alias':_0x5342b1,'text':_0x2e549e,'in_reply_to':_0x26c8a3||void 0x0,'status':_0x40d23d,'from_session':Z});if(_0x26c8a3)k[_0x2582a2(0xa8)](_0x26c8a3);return{'content':[{'type':_0x2582a2(0xf4),'text':JSON[_0x2582a2(0x80)](_0x46aaae)}]};}let _0x3f3562=await P(_0x2582a2(0x6b),{'resume_id':w,'alias':Z,'status':_0x5866f9===_0x2582a2(0xbd)?_0x2582a2(0xbd):_0x5866f9===_0x2582a2(0x72)?_0x2582a2(0x72):_0x2582a2(0x88),'task':_0x2e549e[_0x2582a2(0xb5)](0x0,0xc8),'output':_0x2e549e});return{'content':[{'type':'text','text':JSON[_0x2582a2(0x80)](_0x3f3562)}]};}if(_0x25a8a7==='commhub_report_status'){let {status:_0x19a500,task:_0xf50328,progress:_0x4bd999}=_0x463e86,_0x5a335f=await P(_0x2582a2(0x6b),{'resume_id':w,'alias':Z,'status':_0x19a500,'task':_0xf50328,'progress':_0x4bd999});return{'content':[{'type':'text','text':JSON['stringify'](_0x5a335f)}]};}if(_0x25a8a7===_0x2582a2(0x84)){let {alias:_0x15ce2a,task:_0x5147a5,priority:_0x4dcc72}=_0x463e86,_0x2763f4=await P('send_task',{'alias':_0x15ce2a,'task':_0x5147a5,'priority':_0x4dcc72||_0x2582a2(0xe9),'from_session':Z});return{'content':[{'type':_0x2582a2(0xf4),'text':JSON[_0x2582a2(0x80)](_0x2763f4)}]};}if(_0x25a8a7===_0x2582a2(0xf3)){let {alias:_0x48fef1,message:_0x5046f5}=_0x463e86,_0x53a5c1=await P(_0x2582a2(0xd1),{'alias':_0x48fef1,'message':_0x5046f5,'from_session':Z});return{'content':[{'type':_0x2582a2(0xf4),'text':JSON[_0x2582a2(0x80)](_0x53a5c1)}]};}if(_0x25a8a7===_0x2582a2(0x7c)){let _0x174714=await P('get_all_status',{});return{'content':[{'type':_0x2582a2(0xf4),'text':JSON[_0x2582a2(0x80)](_0x174714)}]};}return{'content':[{'type':_0x2582a2(0xf4),'text':JSON[_0x2582a2(0x80)]({'error':_0x2582a2(0x8d)})}]};});async function u(){const _0x21cf0c=a0_0x1911d7;let _0x3e91c5=f+_0x21cf0c(0xb8)+encodeURIComponent(Z),_0x2ffad9={};if(X)_0x2ffad9[_0x21cf0c(0xcf)]=_0x21cf0c(0xc8)+X;Y('connecting\x20to\x20'+_0x3e91c5);while(!0x0){try{let _0x14b750=await fetch(_0x3e91c5,{'headers':_0x2ffad9});if(!_0x14b750['ok']){Y(_0x21cf0c(0xea)+_0x14b750[_0x21cf0c(0xed)]+'\x20'+_0x14b750['statusText']),await h(0x1388);continue;}let _0x1f95ee=_0x14b750[_0x21cf0c(0xf0)][_0x21cf0c(0x7d)](),_0x56990a=new TextDecoder(),_0x518b71='';while(!0x0){let {done:_0x4b842f,value:_0x323d6a}=await _0x1f95ee['read']();if(_0x4b842f)break;_0x518b71+=_0x56990a[_0x21cf0c(0x89)](_0x323d6a,{'stream':!0x0});let _0x364995=_0x518b71[_0x21cf0c(0xad)]('\x0a\x0a');_0x518b71=_0x364995[_0x21cf0c(0xac)]()||'';for(let _0x583b2e of _0x364995){let _0xfeac9f=_0x583b2e['split']('\x0a')[_0x21cf0c(0x85)](_0x22fbbb=>_0x22fbbb['startsWith'](_0x21cf0c(0xd5)));if(!_0xfeac9f)continue;try{let _0x52ae2b=JSON['parse'](_0xfeac9f['slice'](0x6));await S(_0x52ae2b);}catch(_0x2f9b3c){Y(_0x21cf0c(0xb7)+_0x2f9b3c);}}}Y(_0x21cf0c(0x81));}catch(_0x5ae3cc){Y(_0x21cf0c(0xd4)+_0x5ae3cc);}await h(0xbb8);}}async function S(_0x125c2a){const _0xc14f15=a0_0x1911d7;if(_0x125c2a[_0xc14f15(0x8b)]==='connected'){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x125c2a[_0xc14f15(0x8b)]===_0xc14f15(0x7a)){if(Y('←\x20message\x20from\x20'+_0x125c2a[_0xc14f15(0x75)]+':\x20'+_0x125c2a[_0xc14f15(0x94)][_0xc14f15(0xb5)](0x0,0x3c)),await K[_0xc14f15(0xda)]({'method':_0xc14f15(0x9c),'params':{'content':_0x125c2a[_0xc14f15(0x94)],'meta':{'sender':_0x125c2a[_0xc14f15(0x75)]||'hub','sender_id':_0xc14f15(0x9e),'user':_0x125c2a[_0xc14f15(0x75)]||'hub','priority':_0xc14f15(0xe9)}}}),_0x125c2a['message_id'])await P('ack_inbox',{'alias':Z,'message_id':_0x125c2a[_0xc14f15(0xb9)]});return;}if(_0x125c2a['type']==='new_task'||_0x125c2a[_0xc14f15(0x8b)]===_0xc14f15(0xc9)){Y('←\x20'+_0x125c2a[_0xc14f15(0x8b)]+_0xc14f15(0xe7)+_0x125c2a[_0xc14f15(0x9a)]+_0xc14f15(0xbe)+(_0x125c2a[_0xc14f15(0x82)]||_0xc14f15(0xe9)));let _0x41535a=await P(_0xc14f15(0xd2),{'alias':Z,'limit':0x5});if(_0x41535a?.['ok']&&_0x41535a['messages']?.[_0xc14f15(0xce)]>0x0)for(let _0x3f8c3f of _0x41535a[_0xc14f15(0x74)]){let _0x37c646={'sender':_0x3f8c3f[_0xc14f15(0x8a)]||_0xc14f15(0x8f),'sender_id':_0xc14f15(0x9e),'user':_0x3f8c3f[_0xc14f15(0x8a)]||'hub','task_id':_0x3f8c3f['id'],'priority':_0x3f8c3f[_0xc14f15(0x82)]||_0xc14f15(0xe9)};k[_0xc14f15(0xf1)](_0x3f8c3f['id'],_0x3f8c3f[_0xc14f15(0x8a)]||_0xc14f15(0x8f)),await K[_0xc14f15(0xda)]({'method':_0xc14f15(0x9c),'params':{'content':_0x3f8c3f[_0xc14f15(0xb1)],'meta':_0x37c646}}),Y(_0xc14f15(0x77)+_0x3f8c3f['id'][_0xc14f15(0xb5)](0x0,0x8)+_0xc14f15(0x6d)+_0x3f8c3f[_0xc14f15(0x8a)]+':\x20'+_0x3f8c3f[_0xc14f15(0xb1)][_0xc14f15(0xb5)](0x0,0x3c)),await P(_0xc14f15(0xb0),{'alias':Z,'message_id':_0x3f8c3f['id']});}}}async function A(){const _0x3561b3=a0_0x1911d7;let _0xf9a93c=new a0_0xa0284f();await K[_0x3561b3(0xe3)](_0xf9a93c),Y(_0x3561b3(0xa2)),Y(_0x3561b3(0xe1)),u()[_0x3561b3(0x6c)](_0x1af6d3=>Y(_0x3561b3(0x70)+_0x1af6d3)),P(_0x3561b3(0x6b),{'resume_id':w,'alias':Z,'status':_0x3561b3(0xaa),'server':a0_0x3ef463(),'hostname':a0_0x3ef463(),'agent':_0x3561b3(0xa0),'project_dir':process[_0x3561b3(0xe8)](),'tmux_name':j||void 0x0})['then'](()=>Y('registered\x20as\x20\x22'+Z+'\x22\x20('+w[_0x3561b3(0xb5)](0x0,0x8)+')'))[_0x3561b3(0x6c)](_0x3f3681=>Y(_0x3561b3(0xd9)+_0x3f3681)),setInterval(()=>{const _0x5828a5=_0x3561b3;P(_0x5828a5(0x6b),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x3ef463(),'hostname':a0_0x3ef463(),'agent':_0x5828a5(0xa0),'project_dir':process[_0x5828a5(0xe8)](),'tmux_name':j||void 0x0})[_0x5828a5(0x6c)](_0x372efb=>Y('heartbeat\x20failed:\x20'+_0x372efb));},0x2bf20),Y(_0x3561b3(0xf6));}A()[a0_0x1911d7(0x6c)](_0x48fc08=>{const _0x794560=a0_0x1911d7;Y(_0x794560(0x76)+_0x48fc08),process[_0x794560(0xeb)](0x1);});async function N(){const _0x4ae36f=a0_0x1911d7;Y(_0x4ae36f(0x79)),await P(_0x4ae36f(0x6b),{'resume_id':w,'alias':Z,'status':_0x4ae36f(0x72),'task':_0x4ae36f(0x96)})[_0x4ae36f(0x6c)](()=>{}),process[_0x4ae36f(0xeb)](0x0);}process['stdin']['on']('end',()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x1911d7(0xe4),()=>N());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.1.13-preview.2",
3
+ "version": "2.1.13-preview.4",
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",