@sleep2agi/agent-network 2.3.0-preview.221 → 2.3.0-preview.224

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_0x369c55=a0_0x1894;function a0_0x1ce5(){const _0x4de065=['type','tools/call','registered','task.replied','toAlias','send_reply','failed','\x20error=','toTimeString','resumeId','emit','<pending>','task.send.failed','catch','/events/','error_message','lifecycle_tracking','SSE\x20reconnecting\x20in\x20','SSE\x20failed:\x20','split','s...','from_session','decode','replace','\x20duration_ms=','get_inbox','send_rejected','cwd','running','\x20transport=','heartbeatTimer','disconnected','delivered','to_alias','send_failed','idle','unknown\x20error','Bearer\x20','abort','error','min','sleep','alias','2.0','<missing>','fromAlias','new_task','1146491spSsMz','Authorization','task.expired','signal','name','autoConnect','sdk','startsWith','2UysXkK','\x20from=','POST','CommHub\x20rejected\x20task','mcp_http','agent','parse','result','parentTaskId','text','disconnect','heartbeatInterval','not_tracked','task.ack','\x20network_id=','offline',']\x20[commhub:','connect','1684884TnwbSi','report_status','read','SSE\x20connected','<unknown>','task','pop','network_id','3897180OZOHiL','application/json,\x20text/event-stream','reconnectDelay','1814620aVkolM','transport','message_id','status','sdk-','connectSSE','call','task.send.delivered','processInbox','broadcast','[REDACTED]','stringify','server','duration_ms','slice','\x20task_id=','application/json','send_task','missing_task_id','content','task_id','ack_inbox','CommHub\x20response\x20omitted\x20task_id','25116784MtIomv','12965flHsMN','inbox\x20error:\x20','message','send','get_all_status','token','from_alias','task.send.start','text/event-stream','body','8qsckqp','connected','log','3684KRooau','completed','normal','10917BUvHWO','AbortError','url','sseAbort','/mcp','\x20lifecycle=','now','data:\x20','3528YiQQGK','sending'];a0_0x1ce5=function(){return _0x4de065;};return a0_0x1ce5();}(function(_0x1998f7,_0x28fe99){const _0x4411ea=a0_0x1894,_0x1605aa=_0x1998f7();while(!![]){try{const _0x589a91=-parseInt(_0x4411ea(0x15c))/0x1*(parseInt(_0x4411ea(0x164))/0x2)+parseInt(_0x4411ea(0x176))/0x3*(parseInt(_0x4411ea(0x1a3))/0x4)+parseInt(_0x4411ea(0x199))/0x5*(-parseInt(_0x4411ea(0x1a6))/0x6)+parseInt(_0x4411ea(0x17e))/0x7+-parseInt(_0x4411ea(0x1b1))/0x8*(parseInt(_0x4411ea(0x1a9))/0x9)+parseInt(_0x4411ea(0x181))/0xa+parseInt(_0x4411ea(0x198))/0xb;if(_0x589a91===_0x28fe99)break;else _0x1605aa['push'](_0x1605aa['shift']());}catch(_0x2fa8d9){_0x1605aa['push'](_0x1605aa['shift']());}}}(a0_0x1ce5,0xd4b6c));import{EventEmitter as a0_0x353cf1}from'events';import{hostname as a0_0x33db31}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x1c2e75,_0xec0c3)=>(_0x1c2e75??_0xec0c3)[a0_0x369c55(0x144)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x369c55(0x18f)](0x0,0xf0);function N(_0x33cd37){const _0x2bc6a1=a0_0x369c55;return(_0x33cd37 instanceof Error?_0x33cd37['message']:String(_0x33cd37??_0x2bc6a1(0x151)))['replace'](K,_0x2bc6a1(0x18b))['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function O(_0x147432,_0x293380=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0x13c9f9=a0_0x369c55;if(_0x293380)return JSON[_0x13c9f9(0x18c)](_0x147432);let _0x527060=L(_0x147432['parent_task_id'],_0x13c9f9(0x159)),_0x5ee430=L(_0x147432[_0x13c9f9(0x195)],_0x13c9f9(0x1be)),_0x17626a=_0x147432['error_code']?_0x13c9f9(0x1ba)+_0x147432['error_code']+':'+(_0x147432[_0x13c9f9(0x1c2)]??''):'';return'[commhub:task]\x20'+_0x147432[_0x13c9f9(0x184)]+_0x13c9f9(0x165)+L(_0x147432[_0x13c9f9(0x19f)],_0x13c9f9(0x17a))+'\x20to='+L(_0x147432[_0x13c9f9(0x14e)],_0x13c9f9(0x17a))+_0x13c9f9(0x190)+_0x5ee430+'\x20parent_task_id='+_0x527060+_0x13c9f9(0x172)+L(_0x147432[_0x13c9f9(0x17d)],_0x13c9f9(0x17a))+_0x13c9f9(0x14a)+_0x147432[_0x13c9f9(0x182)]+_0x13c9f9(0x145)+_0x147432[_0x13c9f9(0x18e)]+_0x13c9f9(0x1ae)+_0x147432[_0x13c9f9(0x1c3)]+_0x17626a;}function a0_0x1894(_0xf7e15e,_0x43fd27){_0xf7e15e=_0xf7e15e-0x13f;const _0x1ce5d2=a0_0x1ce5();let _0x18949b=_0x1ce5d2[_0xf7e15e];return _0x18949b;}function U(_0x39aefd){const _0xec4a2e=a0_0x369c55;return{'event':{'sending':_0xec4a2e(0x1a0),'delivered':_0xec4a2e(0x188),'failed':_0xec4a2e(0x1bf),'acked':_0xec4a2e(0x171),'started':'task.started','replied':_0xec4a2e(0x1b6),'expired':_0xec4a2e(0x15e)}[_0x39aefd['status']],..._0x39aefd};}function j(_0x4c3896){const _0x2d3b64=a0_0x369c55;let _0x128dd6=_0x4c3896?.['task_id']||_0x4c3896?.[_0x2d3b64(0x183)]||_0x4c3896?.['id'];if(_0x128dd6)return String(_0x128dd6);let _0x4aab34=_0x4c3896?.[_0x2d3b64(0x194)]?.[0x0]?.[_0x2d3b64(0x16d)];if(typeof _0x4aab34!=='string')return null;try{let _0x164801=JSON[_0x2d3b64(0x16a)](_0x4aab34);return _0x164801?.[_0x2d3b64(0x195)]||_0x164801?.[_0x2d3b64(0x183)]||_0x164801?.['id']||null;}catch{return null;}}async function X(_0x4615ed,_0x1f2bbd){const _0x6656ce=a0_0x369c55;let _0x177078=_0x1f2bbd['now']??Date[_0x6656ce(0x1af)],_0x19ae28=_0x177078(),_0x297b6e=(_0x48576c,_0x1499a2,_0x4060d6,_0x312dfe)=>{const _0x17fe2e=_0x6656ce;_0x1f2bbd[_0x17fe2e(0x1a5)](O(U({'from_alias':_0x4615ed[_0x17fe2e(0x15a)],'to_alias':_0x4615ed[_0x17fe2e(0x1b7)],'task_id':_0x1499a2,'parent_task_id':_0x4615ed[_0x17fe2e(0x16c)],'network_id':_0x4615ed['networkId'],'transport':_0x4615ed[_0x17fe2e(0x182)],'status':_0x48576c,'duration_ms':_0x177078()-_0x19ae28,'lifecycle_tracking':_0x4615ed['lifecycleTracking'],..._0x4060d6!==void 0x0?{'error_code':_0x312dfe||'send_failed','error_message':N(_0x4060d6)}:{}})));};_0x297b6e(_0x6656ce(0x1b2),null);try{let _0x1df06f=await _0x1f2bbd[_0x6656ce(0x19c)](),_0x2855fd=j(_0x1df06f);if(_0x2855fd)_0x297b6e(_0x6656ce(0x14d),_0x2855fd);else{if(_0x1df06f?.['ok']===!0x1||_0x1df06f?.[_0x6656ce(0x154)])_0x297b6e(_0x6656ce(0x1b9),_0x2855fd,_0x1df06f?.[_0x6656ce(0x154)]||_0x6656ce(0x167),_0x6656ce(0x147));else _0x297b6e('failed',null,_0x6656ce(0x197),_0x6656ce(0x193));}return _0x1df06f;}catch(_0x84c577){throw _0x297b6e(_0x6656ce(0x1b9),null,_0x84c577,_0x6656ce(0x14f)),_0x84c577;}}async function Y(_0x27e2f2,_0x17c6dc){const _0x220bb7=a0_0x369c55;return X({'fromAlias':_0x27e2f2['fromAlias'],'toAlias':_0x27e2f2[_0x220bb7(0x157)],'parentTaskId':_0x27e2f2['parentTaskId']||null,'networkId':_0x27e2f2['networkId']||null,'transport':_0x220bb7(0x168),'lifecycleTracking':_0x220bb7(0x170)},_0x17c6dc);}class $ extends a0_0x353cf1{['url'];[a0_0x369c55(0x157)];['token'];['agent'];[a0_0x369c55(0x1bc)];[a0_0x369c55(0x16f)];[a0_0x369c55(0x180)];[a0_0x369c55(0x14b)];[a0_0x369c55(0x1ac)];[a0_0x369c55(0x149)]=!0x1;constructor(_0x1e4ff6){const _0x4f4e07=a0_0x369c55;super();if(this['url']=_0x1e4ff6[_0x4f4e07(0x1ab)]['replace'](/\/$/,''),this[_0x4f4e07(0x157)]=_0x1e4ff6['alias'],this['token']=_0x1e4ff6['token'],this[_0x4f4e07(0x169)]=_0x1e4ff6[_0x4f4e07(0x169)]||_0x4f4e07(0x162),this['resumeId']=_0x4f4e07(0x185)+_0x1e4ff6[_0x4f4e07(0x157)]+'-'+Date[_0x4f4e07(0x1af)]()['toString'](0x24),this[_0x4f4e07(0x16f)]=_0x1e4ff6[_0x4f4e07(0x16f)]??0x2bf20,this[_0x4f4e07(0x180)]=_0x1e4ff6['reconnectDelay']??0xbb8,_0x1e4ff6[_0x4f4e07(0x161)]!==!0x1)this[_0x4f4e07(0x175)]();}[a0_0x369c55(0x1a5)](_0x3df325){const _0x109527=a0_0x369c55;console['log']('['+new Date()[_0x109527(0x1bb)]()[_0x109527(0x18f)](0x0,0x8)+_0x109527(0x174)+this[_0x109527(0x157)]+']\x20'+_0x3df325);}async[a0_0x369c55(0x187)](_0x5579a3,_0x2f63a0){const _0x32d644=a0_0x369c55;let _0x47d394={'Content-Type':_0x32d644(0x191),'Accept':_0x32d644(0x17f)};if(this[_0x32d644(0x19e)])_0x47d394[_0x32d644(0x15d)]='Bearer\x20'+this[_0x32d644(0x19e)];let _0x492bcb=await(await fetch(this[_0x32d644(0x1ab)]+_0x32d644(0x1ad),{'method':_0x32d644(0x166),'headers':_0x47d394,'body':JSON['stringify']({'jsonrpc':_0x32d644(0x158),'id':Date[_0x32d644(0x1af)](),'method':_0x32d644(0x1b4),'params':{'name':_0x5579a3,'arguments':_0x2f63a0}})}))[_0x32d644(0x16d)](),_0x5f532f=_0x492bcb['match'](/data: (.+)/),_0x3b5982=_0x5f532f?JSON[_0x32d644(0x16a)](_0x5f532f[0x1]):JSON[_0x32d644(0x16a)](_0x492bcb),_0x23cc65=_0x3b5982?.[_0x32d644(0x16b)]?.[_0x32d644(0x194)]?.[0x0]?.['text'];return _0x23cc65?JSON[_0x32d644(0x16a)](_0x23cc65):_0x3b5982;}async[a0_0x369c55(0x175)](){const _0x1dbd3e=a0_0x369c55;if(this['running'])return;this['running']=!0x0,await this[_0x1dbd3e(0x184)](_0x1dbd3e(0x150)),this['log'](_0x1dbd3e(0x1b5)),this[_0x1dbd3e(0x14b)]=setInterval(()=>{const _0x186975=_0x1dbd3e;this['status']('idle')[_0x186975(0x1c0)](_0x5dae91=>this[_0x186975(0x1a5)]('heartbeat\x20failed:\x20'+_0x5dae91['message']));},this[_0x1dbd3e(0x16f)]),this[_0x1dbd3e(0x186)]();}async[a0_0x369c55(0x16e)](){const _0x5cac9f=a0_0x369c55;if(this[_0x5cac9f(0x149)]=!0x1,this[_0x5cac9f(0x1ac)]?.[_0x5cac9f(0x153)](),this['heartbeatTimer'])clearInterval(this['heartbeatTimer']);await this[_0x5cac9f(0x184)](_0x5cac9f(0x173))[_0x5cac9f(0x1c0)](()=>{}),this[_0x5cac9f(0x1a5)](_0x5cac9f(0x14c));}async[a0_0x369c55(0x19c)](_0x5b4722,_0x498bca,_0x42f952=a0_0x369c55(0x1a8)){const _0x45ea82=a0_0x369c55;return Y({'alias':_0x5b4722,'fromAlias':this[_0x45ea82(0x157)]},{'log':_0x2a52fb=>console['log'](_0x2a52fb),'send':()=>this['call'](_0x45ea82(0x192),{'alias':_0x5b4722,'task':_0x498bca,'priority':_0x42f952,'from_session':this[_0x45ea82(0x157)]})});}async[a0_0x369c55(0x19b)](_0x1c5b6f,_0x529a5d){return this['call']('send_message',{'alias':_0x1c5b6f,'message':_0x529a5d,'from_session':this['alias']});}async['reply'](_0x1bec36,_0x1c15e,_0x583f2f=a0_0x369c55(0x1a7)){const _0x4423fa=a0_0x369c55;return this[_0x4423fa(0x187)](_0x4423fa(0x1b8),{'in_reply_to':_0x1bec36,'text':_0x1c15e,'status':_0x583f2f});}async[a0_0x369c55(0x184)](_0x24fe03,_0x3df37f){const _0x5901c5=a0_0x369c55;return this[_0x5901c5(0x187)](_0x5901c5(0x177),{'resume_id':this[_0x5901c5(0x1bc)],'alias':this[_0x5901c5(0x157)],'status':_0x24fe03,'server':a0_0x33db31(),'hostname':a0_0x33db31(),'agent':this['agent'],'project_dir':process[_0x5901c5(0x148)](),..._0x3df37f});}async['getAllStatus'](){const _0x2ed14d=a0_0x369c55;return this['call'](_0x2ed14d(0x19d),{});}async[a0_0x369c55(0x18a)](_0x117ff1,_0x4c08d8){const _0x2920c9=a0_0x369c55;return this[_0x2920c9(0x187)](_0x2920c9(0x18a),{'message':_0x117ff1,'filter_server':_0x4c08d8?.[_0x2920c9(0x18d)],'filter_status':_0x4c08d8?.['status']});}async['connectSSE'](){const _0x3317a1=a0_0x369c55;let _0x5511aa=encodeURIComponent(this[_0x3317a1(0x157)]),_0x2780f3=this['url']+_0x3317a1(0x1c1)+_0x5511aa,_0x4e058d=this[_0x3317a1(0x180)];while(this[_0x3317a1(0x149)]){try{this[_0x3317a1(0x1ac)]=new AbortController();let _0xc116a6={'Accept':_0x3317a1(0x1a1)};if(this[_0x3317a1(0x19e)])_0xc116a6[_0x3317a1(0x15d)]=_0x3317a1(0x152)+this['token'];let _0x568372=await fetch(_0x2780f3,{'headers':_0xc116a6,'signal':this[_0x3317a1(0x1ac)][_0x3317a1(0x15f)]});if(!_0x568372['ok']||!_0x568372[_0x3317a1(0x1a2)]){this['log'](_0x3317a1(0x13f)+_0x568372[_0x3317a1(0x184)]),await this['sleep'](_0x4e058d),_0x4e058d=Math[_0x3317a1(0x155)](_0x4e058d*1.5,0xea60);continue;}_0x4e058d=this[_0x3317a1(0x180)];let _0x5a7521=_0x568372[_0x3317a1(0x1a2)]['getReader'](),_0x1d4ff6=new TextDecoder(),_0x36ecdd='';while(this[_0x3317a1(0x149)]){let {done:_0x12555e,value:_0x42e5bf}=await _0x5a7521[_0x3317a1(0x178)]();if(_0x12555e)break;_0x36ecdd+=_0x1d4ff6[_0x3317a1(0x143)](_0x42e5bf,{'stream':!0x0});let _0x508b3c=_0x36ecdd[_0x3317a1(0x140)]('\x0a');_0x36ecdd=_0x508b3c[_0x3317a1(0x17c)]()||'';for(let _0x4d8682 of _0x508b3c){if(!_0x4d8682[_0x3317a1(0x163)](_0x3317a1(0x1b0)))continue;try{let _0x1627e6=JSON[_0x3317a1(0x16a)](_0x4d8682['slice'](0x6));if(_0x1627e6[_0x3317a1(0x1b3)]===_0x3317a1(0x1a4)){this['log'](_0x3317a1(0x179)),this[_0x3317a1(0x1bd)](_0x3317a1(0x1a4));continue;}if(_0x1627e6[_0x3317a1(0x1b3)]===_0x3317a1(0x15b)||_0x1627e6['type']==='new_message'||_0x1627e6[_0x3317a1(0x1b3)]===_0x3317a1(0x18a))await this[_0x3317a1(0x189)]();}catch{}}}}catch(_0x58ebda){if(_0x58ebda[_0x3317a1(0x160)]===_0x3317a1(0x1aa))break;this[_0x3317a1(0x1bd)]('error',_0x58ebda),this[_0x3317a1(0x1a5)]('SSE\x20error:\x20'+_0x58ebda['message']);}if(this[_0x3317a1(0x149)])this[_0x3317a1(0x1bd)](_0x3317a1(0x14c)),this[_0x3317a1(0x1a5)](_0x3317a1(0x1c4)+_0x4e058d/0x3e8+_0x3317a1(0x141)),await this[_0x3317a1(0x156)](_0x4e058d),_0x4e058d=Math['min'](_0x4e058d*1.5,0xea60);}}async[a0_0x369c55(0x189)](){const _0x117ce0=a0_0x369c55;try{let _0x38c19a=(await this[_0x117ce0(0x187)](_0x117ce0(0x146),{'alias':this['alias'],'limit':0xa}))?.['messages']||[];for(let _0x58678b of _0x38c19a)await this[_0x117ce0(0x187)](_0x117ce0(0x196),{'alias':this[_0x117ce0(0x157)],'message_id':_0x58678b['id']}),this[_0x117ce0(0x1a5)]('←\x20'+_0x58678b[_0x117ce0(0x142)]+':\x20'+_0x58678b[_0x117ce0(0x194)]['slice'](0x0,0x3c)),this[_0x117ce0(0x1bd)](_0x117ce0(0x17b),_0x58678b),this[_0x117ce0(0x1bd)](_0x117ce0(0x19b),_0x58678b);}catch(_0x3cf619){this[_0x117ce0(0x1a5)](_0x117ce0(0x19a)+_0x3cf619[_0x117ce0(0x19b)]);}}[a0_0x369c55(0x156)](_0x3d13c4){return new Promise(_0x177aed=>setTimeout(_0x177aed,_0x3d13c4));}}var F=$;export{F as default,$ as CommHub};
1
+ function a0_0x2c35(){const _0x43d2ac=['lifecycle_tracking','decode','tools/call','\x20duration_ms=','toAlias','heartbeatTimer','transport','656577cMjNlH','running','new_task','min','autoConnect','\x20from=','match','type','send','abort','heartbeat\x20failed:\x20','to_alias','resumeId','error_message','sleep','42585059ABLvou','agent','unknown\x20error','stringify','registered','<unknown>','body','json','67945nqBrLG','[REDACTED]','reply','Bearer\x20','status','url','fromAlias','ack_inbox','lifecycleTracking','SSE\x20connected','alias','40NsTobz','heartbeatInterval','now','text','204GGjmYI','send_failed','[commhub:task]\x20','CommHub\x20response\x20omitted\x20task_id','idle','parse','application/json','cwd','processInbox','s...','string','/events/','5394BnnrII','get_all_status','sdk','5467yZqOJY','mcp_http','delivered','report_status','emit','\x20lifecycle=','send_rejected','\x20task_id=','content','inbox\x20error:\x20','log','error','8336010UZDhTQ','\x20parent_task_id=','offline','SSE\x20error:\x20','broadcast','failed','task.expired','call','parentTaskId','send_reply','reconnectDelay','1ouAFmV','message_id','split','<pending>','CommHub\x20rejected\x20task','from_session','connectSSE','from_alias','result','toString','text/event-stream','sseAbort','networkId','connect','connected','toTimeString','disconnect','message','1721878kuaLBA','task_id','POST','data:\x20','catch','task.send.delivered','application/json,\x20text/event-stream','Authorization','token','replace','signal','disconnected','SSE\x20failed:\x20','completed','missing_task_id','sdk-','task','/mcp',']\x20[commhub:','send_message','get_inbox','2020077WpwFpM','task.send.start','slice','new_message'];a0_0x2c35=function(){return _0x43d2ac;};return a0_0x2c35();}const a0_0x21df2a=a0_0x19a4;(function(_0x19b62f,_0x1cef4a){const _0x2d1e53=a0_0x19a4,_0x161abe=_0x19b62f();while(!![]){try{const _0xa6fca6=-parseInt(_0x2d1e53(0x221))/0x1*(parseInt(_0x2d1e53(0x233))/0x2)+-parseInt(_0x2d1e53(0x248))/0x3+parseInt(_0x2d1e53(0x1fb))/0x4*(-parseInt(_0x2d1e53(0x26a))/0x5)+parseInt(_0x2d1e53(0x207))/0x6*(-parseInt(_0x2d1e53(0x20a))/0x7)+parseInt(_0x2d1e53(0x1f7))/0x8*(parseInt(_0x2d1e53(0x253))/0x9)+-parseInt(_0x2d1e53(0x216))/0xa+parseInt(_0x2d1e53(0x262))/0xb;if(_0xa6fca6===_0x1cef4a)break;else _0x161abe['push'](_0x161abe['shift']());}catch(_0x2f8215){_0x161abe['push'](_0x161abe['shift']());}}}(a0_0x2c35,0x737f5));import{EventEmitter as a0_0x766962}from'events';function a0_0x19a4(_0x17fad5,_0x583f61){_0x17fad5=_0x17fad5-0x1ef;const _0x2c35f6=a0_0x2c35();let _0x19a459=_0x2c35f6[_0x17fad5];return _0x19a459;}import{hostname as a0_0x113adc}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x426e67,_0x12d32a)=>(_0x426e67??_0x12d32a)[a0_0x21df2a(0x23c)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x21df2a(0x24a)](0x0,0xf0);function N(_0x1efc18){const _0x4c4c85=a0_0x21df2a;return(_0x1efc18 instanceof Error?_0x1efc18[_0x4c4c85(0x232)]:String(_0x1efc18??_0x4c4c85(0x264)))[_0x4c4c85(0x23c)](K,_0x4c4c85(0x26b))[_0x4c4c85(0x23c)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function O(_0x7e01bc,_0x5f0cb8=process.env.ANET_TASK_TRACE_FORMAT===a0_0x21df2a(0x269)){const _0x26370f=a0_0x21df2a;if(_0x5f0cb8)return JSON[_0x26370f(0x265)](_0x7e01bc);let _0x4ed008=L(_0x7e01bc['parent_task_id'],'<missing>'),_0x119552=L(_0x7e01bc['task_id'],_0x26370f(0x224)),_0x1ab671=_0x7e01bc['error_code']?'\x20error='+_0x7e01bc['error_code']+':'+(_0x7e01bc[_0x26370f(0x260)]??''):'';return _0x26370f(0x1fd)+_0x7e01bc[_0x26370f(0x1f0)]+_0x26370f(0x258)+L(_0x7e01bc[_0x26370f(0x228)],_0x26370f(0x267))+'\x20to='+L(_0x7e01bc[_0x26370f(0x25e)],_0x26370f(0x267))+_0x26370f(0x211)+_0x119552+_0x26370f(0x217)+_0x4ed008+'\x20network_id='+L(_0x7e01bc['network_id'],_0x26370f(0x267))+'\x20transport='+_0x7e01bc[_0x26370f(0x252)]+_0x26370f(0x24f)+_0x7e01bc['duration_ms']+_0x26370f(0x20f)+_0x7e01bc[_0x26370f(0x24c)]+_0x1ab671;}function U(_0x4d7c50){const _0xea725e=a0_0x21df2a;return{'event':{'sending':_0xea725e(0x249),'delivered':_0xea725e(0x238),'failed':'task.send.failed','acked':'task.ack','started':'task.started','replied':'task.replied','expired':_0xea725e(0x21c)}[_0x4d7c50[_0xea725e(0x1f0)]],..._0x4d7c50};}function j(_0xdf2a71){const _0x158325=a0_0x21df2a;let _0x331aec=_0xdf2a71?.['task_id']||_0xdf2a71?.['message_id']||_0xdf2a71?.['id'];if(_0x331aec)return String(_0x331aec);let _0x56ece0=_0xdf2a71?.[_0x158325(0x212)]?.[0x0]?.[_0x158325(0x1fa)];if(typeof _0x56ece0!==_0x158325(0x205))return null;try{let _0x60951d=JSON[_0x158325(0x200)](_0x56ece0);return _0x60951d?.[_0x158325(0x234)]||_0x60951d?.[_0x158325(0x222)]||_0x60951d?.['id']||null;}catch{return null;}}async function X(_0xeb1c47,_0x191eeb){const _0x253f4a=a0_0x21df2a;let _0x3f33a0=_0x191eeb['now']??Date[_0x253f4a(0x1f9)],_0x14c332=_0x3f33a0(),_0x102aa4=(_0x123a24,_0xa65637,_0x50e898,_0x1ae184)=>{const _0x5dd2d7=_0x253f4a;_0x191eeb[_0x5dd2d7(0x214)](O(U({'from_alias':_0xeb1c47[_0x5dd2d7(0x1f2)],'to_alias':_0xeb1c47[_0x5dd2d7(0x250)],'task_id':_0xa65637,'parent_task_id':_0xeb1c47[_0x5dd2d7(0x21e)],'network_id':_0xeb1c47[_0x5dd2d7(0x22d)],'transport':_0xeb1c47[_0x5dd2d7(0x252)],'status':_0x123a24,'duration_ms':_0x3f33a0()-_0x14c332,'lifecycle_tracking':_0xeb1c47[_0x5dd2d7(0x1f4)],..._0x50e898!==void 0x0?{'error_code':_0x1ae184||_0x5dd2d7(0x1fc),'error_message':N(_0x50e898)}:{}})));};_0x102aa4('sending',null);try{let _0x2bced7=await _0x191eeb[_0x253f4a(0x25b)](),_0x4f4036=j(_0x2bced7);if(_0x4f4036)_0x102aa4(_0x253f4a(0x20c),_0x4f4036);else{if(_0x2bced7?.['ok']===!0x1||_0x2bced7?.[_0x253f4a(0x215)])_0x102aa4(_0x253f4a(0x21b),_0x4f4036,_0x2bced7?.[_0x253f4a(0x215)]||_0x253f4a(0x225),_0x253f4a(0x210));else _0x102aa4(_0x253f4a(0x21b),null,_0x253f4a(0x1fe),_0x253f4a(0x241));}return _0x2bced7;}catch(_0x1cb4cd){throw _0x102aa4(_0x253f4a(0x21b),null,_0x1cb4cd,_0x253f4a(0x1fc)),_0x1cb4cd;}}async function Y(_0x2596ad,_0xa123c3){const _0x3eb281=a0_0x21df2a;return X({'fromAlias':_0x2596ad[_0x3eb281(0x1f2)],'toAlias':_0x2596ad[_0x3eb281(0x1f6)],'parentTaskId':_0x2596ad['parentTaskId']||null,'networkId':_0x2596ad[_0x3eb281(0x22d)]||null,'transport':_0x3eb281(0x20b),'lifecycleTracking':'not_tracked'},_0xa123c3);}class $ extends a0_0x766962{[a0_0x21df2a(0x1f1)];[a0_0x21df2a(0x1f6)];[a0_0x21df2a(0x23b)];[a0_0x21df2a(0x263)];[a0_0x21df2a(0x25f)];[a0_0x21df2a(0x1f8)];[a0_0x21df2a(0x220)];[a0_0x21df2a(0x251)];[a0_0x21df2a(0x22c)];[a0_0x21df2a(0x254)]=!0x1;constructor(_0xfbf59b){const _0x49823f=a0_0x21df2a;super();if(this[_0x49823f(0x1f1)]=_0xfbf59b['url'][_0x49823f(0x23c)](/\/$/,''),this['alias']=_0xfbf59b[_0x49823f(0x1f6)],this[_0x49823f(0x23b)]=_0xfbf59b[_0x49823f(0x23b)],this[_0x49823f(0x263)]=_0xfbf59b['agent']||_0x49823f(0x209),this[_0x49823f(0x25f)]=_0x49823f(0x242)+_0xfbf59b[_0x49823f(0x1f6)]+'-'+Date[_0x49823f(0x1f9)]()[_0x49823f(0x22a)](0x24),this[_0x49823f(0x1f8)]=_0xfbf59b['heartbeatInterval']??0x2bf20,this[_0x49823f(0x220)]=_0xfbf59b[_0x49823f(0x220)]??0xbb8,_0xfbf59b[_0x49823f(0x257)]!==!0x1)this[_0x49823f(0x22e)]();}[a0_0x21df2a(0x214)](_0x2a9b8b){const _0x1d2276=a0_0x21df2a;console[_0x1d2276(0x214)]('['+new Date()[_0x1d2276(0x230)]()[_0x1d2276(0x24a)](0x0,0x8)+_0x1d2276(0x245)+this[_0x1d2276(0x1f6)]+']\x20'+_0x2a9b8b);}async[a0_0x21df2a(0x21d)](_0x5738c8,_0x50199b){const _0x51a500=a0_0x21df2a;let _0x1d09fe={'Content-Type':_0x51a500(0x201),'Accept':_0x51a500(0x239)};if(this[_0x51a500(0x23b)])_0x1d09fe['Authorization']=_0x51a500(0x1ef)+this[_0x51a500(0x23b)];let _0x56a27f=await(await fetch(this['url']+_0x51a500(0x244),{'method':_0x51a500(0x235),'headers':_0x1d09fe,'body':JSON[_0x51a500(0x265)]({'jsonrpc':'2.0','id':Date[_0x51a500(0x1f9)](),'method':_0x51a500(0x24e),'params':{'name':_0x5738c8,'arguments':_0x50199b}})}))[_0x51a500(0x1fa)](),_0x545d10=_0x56a27f[_0x51a500(0x259)](/data: (.+)/),_0x542bdc=_0x545d10?JSON['parse'](_0x545d10[0x1]):JSON['parse'](_0x56a27f),_0x520d84=_0x542bdc?.[_0x51a500(0x229)]?.[_0x51a500(0x212)]?.[0x0]?.[_0x51a500(0x1fa)];return _0x520d84?JSON[_0x51a500(0x200)](_0x520d84):_0x542bdc;}async['connect'](){const _0x29a377=a0_0x21df2a;if(this['running'])return;this[_0x29a377(0x254)]=!0x0,await this['status'](_0x29a377(0x1ff)),this['log'](_0x29a377(0x266)),this['heartbeatTimer']=setInterval(()=>{const _0x5635a1=_0x29a377;this[_0x5635a1(0x1f0)](_0x5635a1(0x1ff))['catch'](_0x28f7af=>this[_0x5635a1(0x214)](_0x5635a1(0x25d)+_0x28f7af['message']));},this[_0x29a377(0x1f8)]),this['connectSSE']();}async[a0_0x21df2a(0x231)](){const _0x843964=a0_0x21df2a;if(this['running']=!0x1,this['sseAbort']?.[_0x843964(0x25c)](),this[_0x843964(0x251)])clearInterval(this[_0x843964(0x251)]);await this[_0x843964(0x1f0)](_0x843964(0x218))[_0x843964(0x237)](()=>{}),this[_0x843964(0x214)](_0x843964(0x23e));}async[a0_0x21df2a(0x25b)](_0x2ded44,_0x1a6fab,_0x15a03e='normal'){const _0x426825=a0_0x21df2a;return Y({'alias':_0x2ded44,'fromAlias':this[_0x426825(0x1f6)]},{'log':_0x7b937f=>console[_0x426825(0x214)](_0x7b937f),'send':()=>this[_0x426825(0x21d)]('send_task',{'alias':_0x2ded44,'task':_0x1a6fab,'priority':_0x15a03e,'from_session':this[_0x426825(0x1f6)]})});}async[a0_0x21df2a(0x232)](_0x515f8e,_0x4132d6){const _0xf690a4=a0_0x21df2a;return this[_0xf690a4(0x21d)](_0xf690a4(0x246),{'alias':_0x515f8e,'message':_0x4132d6,'from_session':this[_0xf690a4(0x1f6)]});}async[a0_0x21df2a(0x26c)](_0x411ed1,_0x450d7f,_0x884d39=a0_0x21df2a(0x240)){const _0x3a3042=a0_0x21df2a;return this['call'](_0x3a3042(0x21f),{'in_reply_to':_0x411ed1,'text':_0x450d7f,'status':_0x884d39});}async['status'](_0x183ad2,_0x5a61f3){const _0x531504=a0_0x21df2a;return this[_0x531504(0x21d)](_0x531504(0x20d),{'resume_id':this[_0x531504(0x25f)],'alias':this[_0x531504(0x1f6)],'status':_0x183ad2,'server':a0_0x113adc(),'hostname':a0_0x113adc(),'agent':this[_0x531504(0x263)],'project_dir':process[_0x531504(0x202)](),..._0x5a61f3});}async['getAllStatus'](){const _0x580770=a0_0x21df2a;return this[_0x580770(0x21d)](_0x580770(0x208),{});}async[a0_0x21df2a(0x21a)](_0x2a9bcd,_0x35647c){const _0x51ad52=a0_0x21df2a;return this[_0x51ad52(0x21d)](_0x51ad52(0x21a),{'message':_0x2a9bcd,'filter_server':_0x35647c?.['server'],'filter_status':_0x35647c?.['status']});}async[a0_0x21df2a(0x227)](){const _0x245344=a0_0x21df2a;let _0x55449f=encodeURIComponent(this[_0x245344(0x1f6)]),_0xa45498=this[_0x245344(0x1f1)]+_0x245344(0x206)+_0x55449f,_0xd255de=this[_0x245344(0x220)];while(this[_0x245344(0x254)]){try{this[_0x245344(0x22c)]=new AbortController();let _0x1284ab={'Accept':_0x245344(0x22b)};if(this[_0x245344(0x23b)])_0x1284ab[_0x245344(0x23a)]=_0x245344(0x1ef)+this[_0x245344(0x23b)];let _0x4ae1fd=await fetch(_0xa45498,{'headers':_0x1284ab,'signal':this[_0x245344(0x22c)][_0x245344(0x23d)]});if(!_0x4ae1fd['ok']||!_0x4ae1fd[_0x245344(0x268)]){this[_0x245344(0x214)](_0x245344(0x23f)+_0x4ae1fd[_0x245344(0x1f0)]),await this['sleep'](_0xd255de),_0xd255de=Math[_0x245344(0x256)](_0xd255de*1.5,0xea60);continue;}_0xd255de=this[_0x245344(0x220)];let _0x571808=_0x4ae1fd[_0x245344(0x268)]['getReader'](),_0x52caae=new TextDecoder(),_0x145c3c='';while(this[_0x245344(0x254)]){let {done:_0x3bea73,value:_0x4f5bed}=await _0x571808['read']();if(_0x3bea73)break;_0x145c3c+=_0x52caae[_0x245344(0x24d)](_0x4f5bed,{'stream':!0x0});let _0x532393=_0x145c3c[_0x245344(0x223)]('\x0a');_0x145c3c=_0x532393['pop']()||'';for(let _0x283c0b of _0x532393){if(!_0x283c0b['startsWith'](_0x245344(0x236)))continue;try{let _0x157da3=JSON[_0x245344(0x200)](_0x283c0b[_0x245344(0x24a)](0x6));if(_0x157da3[_0x245344(0x25a)]===_0x245344(0x22f)){this[_0x245344(0x214)](_0x245344(0x1f5)),this['emit']('connected');continue;}if(_0x157da3[_0x245344(0x25a)]===_0x245344(0x255)||_0x157da3[_0x245344(0x25a)]===_0x245344(0x24b)||_0x157da3[_0x245344(0x25a)]===_0x245344(0x21a))await this['processInbox']();}catch{}}}}catch(_0x5a78ac){if(_0x5a78ac['name']==='AbortError')break;this[_0x245344(0x20e)](_0x245344(0x215),_0x5a78ac),this['log'](_0x245344(0x219)+_0x5a78ac[_0x245344(0x232)]);}if(this[_0x245344(0x254)])this[_0x245344(0x20e)]('disconnected'),this['log']('SSE\x20reconnecting\x20in\x20'+_0xd255de/0x3e8+_0x245344(0x204)),await this[_0x245344(0x261)](_0xd255de),_0xd255de=Math['min'](_0xd255de*1.5,0xea60);}}async[a0_0x21df2a(0x203)](){const _0x3f2af2=a0_0x21df2a;try{let _0xdac29=(await this[_0x3f2af2(0x21d)](_0x3f2af2(0x247),{'alias':this[_0x3f2af2(0x1f6)],'limit':0xa}))?.['messages']||[];for(let _0x18d588 of _0xdac29)await this[_0x3f2af2(0x21d)](_0x3f2af2(0x1f3),{'alias':this['alias'],'message_id':_0x18d588['id']}),this[_0x3f2af2(0x214)]('←\x20'+_0x18d588[_0x3f2af2(0x226)]+':\x20'+_0x18d588[_0x3f2af2(0x212)][_0x3f2af2(0x24a)](0x0,0x3c)),this[_0x3f2af2(0x20e)](_0x3f2af2(0x243),_0x18d588),this['emit'](_0x3f2af2(0x232),_0x18d588);}catch(_0x403dae){this['log'](_0x3f2af2(0x213)+_0x403dae['message']);}}[a0_0x21df2a(0x261)](_0x374330){return new Promise(_0x56c52c=>setTimeout(_0x56c52c,_0x374330));}}var F=$;export{F as default,$ as CommHub};