@sleep2agi/agent-network 2.3.0-preview.206 → 2.3.0-preview.207

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_0x4ab4f5=a0_0x4626;(function(_0x53633a,_0xa0cedc){const _0x6ccf95=a0_0x4626,_0x138f7d=_0x53633a();while(!![]){try{const _0x23ac7e=parseInt(_0x6ccf95(0x217))/0x1*(parseInt(_0x6ccf95(0x21d))/0x2)+-parseInt(_0x6ccf95(0x1c1))/0x3+parseInt(_0x6ccf95(0x1ff))/0x4+parseInt(_0x6ccf95(0x1ac))/0x5*(-parseInt(_0x6ccf95(0x1e5))/0x6)+parseInt(_0x6ccf95(0x202))/0x7+-parseInt(_0x6ccf95(0x212))/0x8+parseInt(_0x6ccf95(0x1fb))/0x9;if(_0x23ac7e===_0xa0cedc)break;else _0x138f7d['push'](_0x138f7d['shift']());}catch(_0x50b04a){_0x138f7d['push'](_0x138f7d['shift']());}}}(a0_0x5e33,0xc6917));function a0_0x4626(_0x5c648f,_0x183d8f){_0x5c648f=_0x5c648f-0x1a5;const _0x5e331e=a0_0x5e33();let _0x4626bd=_0x5e331e[_0x5c648f];return _0x4626bd;}import{EventEmitter as a0_0x1cc878}from'events';import{hostname as a0_0x8fbb80}from'os';function a0_0x5e33(){const _0x396160=['networkId','normal','url','get_all_status','cwd','slice','status','connect','idle','10580661hGQVUD','send_message','\x20task_id=','disconnected','314116ONObEV','result','task.send.start','9123695vwBGvG','failed','signal','token','from_alias','text','task','match','processInbox','toTimeString','\x20network_id=','lifecycle_tracking','Authorization','\x20error=','resumeId','min','10552584ymBgeV','s...','to_alias','message_id','reconnectDelay','3503CGqYKp','body','registered','/mcp','heartbeatInterval','task.send.delivered','888hzQrTv','heartbeat\x20failed:\x20','autoConnect','application/json,\x20text/event-stream','[REDACTED]','error_message','call','CommHub\x20response\x20omitted\x20task_id','\x20from=','[commhub:task]\x20','sleep','new_message','message','from_session','fromAlias','catch','type','5tXhazN','agent','transport','emit','get_inbox','running','SSE\x20error:\x20','parentTaskId','2.0','Bearer\x20','string','log','CommHub\x20rejected\x20task','now','read','offline','<pending>','abort','not_tracked','lifecycleTracking','task_id','4239432JHDFQr','completed','network_id','getAllStatus','sseAbort','pop','parent_task_id','send_reply','content','broadcast','missing_task_id','reply','send_failed','connectSSE','heartbeatTimer','POST','application/json','\x20parent_task_id=','task.replied','mcp_http','task.expired','send_task','delivered','error_code','<unknown>','data:\x20','alias',']\x20[commhub:','replace','task.started','<missing>','toAlias','SSE\x20connected','error','parse','/events/','3403938IOhnyv','\x20lifecycle=','getReader','toString','connected','stringify','decode','sending','\x20duration_ms=','name','inbox\x20error:\x20','startsWith','duration_ms'];a0_0x5e33=function(){return _0x396160;};return a0_0x5e33();}var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x374170,_0x5ee3a1)=>(_0x374170??_0x5ee3a1)[a0_0x4ab4f5(0x1dd)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x4ab4f5(0x1f7)](0x0,0xf0);function N(_0x11b4c1){const _0x29f5aa=a0_0x4ab4f5;return(_0x11b4c1 instanceof Error?_0x11b4c1[_0x29f5aa(0x1a7)]:String(_0x11b4c1??'unknown\x20error'))['replace'](K,_0x29f5aa(0x221))[_0x29f5aa(0x1dd)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function O(_0x29116d,_0x324168=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0x163d31=a0_0x4ab4f5;if(_0x324168)return JSON[_0x163d31(0x1ea)](_0x29116d);let _0x36f431=L(_0x29116d[_0x163d31(0x1c7)],_0x163d31(0x1df)),_0x26132c=L(_0x29116d[_0x163d31(0x1c0)],_0x163d31(0x1bc)),_0x2f5dd3=_0x29116d[_0x163d31(0x1d8)]?_0x163d31(0x20f)+_0x29116d['error_code']+':'+(_0x29116d[_0x163d31(0x222)]??''):'';return _0x163d31(0x226)+_0x29116d[_0x163d31(0x1f8)]+_0x163d31(0x225)+L(_0x29116d[_0x163d31(0x206)],_0x163d31(0x1d9))+'\x20to='+L(_0x29116d[_0x163d31(0x214)],_0x163d31(0x1d9))+_0x163d31(0x1fd)+_0x26132c+_0x163d31(0x1d2)+_0x36f431+_0x163d31(0x20c)+L(_0x29116d[_0x163d31(0x1c3)],_0x163d31(0x1d9))+'\x20transport='+_0x29116d[_0x163d31(0x1ae)]+_0x163d31(0x1ed)+_0x29116d[_0x163d31(0x1f1)]+_0x163d31(0x1e6)+_0x29116d[_0x163d31(0x20d)]+_0x2f5dd3;}function U(_0x2060b8){const _0x2477dc=a0_0x4ab4f5;return{'event':{'sending':_0x2477dc(0x201),'delivered':_0x2477dc(0x21c),'failed':'task.send.failed','acked':'task.ack','started':_0x2477dc(0x1de),'replied':_0x2477dc(0x1d3),'expired':_0x2477dc(0x1d5)}[_0x2060b8['status']],..._0x2060b8};}function j(_0x4a5c21){const _0x5d4078=a0_0x4ab4f5;let _0x2f6684=_0x4a5c21?.[_0x5d4078(0x1c0)]||_0x4a5c21?.['message_id']||_0x4a5c21?.['id'];if(_0x2f6684)return String(_0x2f6684);let _0x5aa685=_0x4a5c21?.[_0x5d4078(0x1c9)]?.[0x0]?.[_0x5d4078(0x207)];if(typeof _0x5aa685!==_0x5d4078(0x1b6))return null;try{let _0x47f4fc=JSON['parse'](_0x5aa685);return _0x47f4fc?.['task_id']||_0x47f4fc?.[_0x5d4078(0x215)]||_0x47f4fc?.['id']||null;}catch{return null;}}async function X(_0x37a13a,_0x51e85f){const _0x5d007f=a0_0x4ab4f5;let _0x25c6e1=_0x51e85f[_0x5d007f(0x1b9)]??Date['now'],_0xc112dd=_0x25c6e1(),_0x4bfd78=(_0x17c462,_0x3efd98,_0x44b54e,_0x486424)=>{const _0x5aa2b8=_0x5d007f;_0x51e85f[_0x5aa2b8(0x1b7)](O(U({'from_alias':_0x37a13a['fromAlias'],'to_alias':_0x37a13a[_0x5aa2b8(0x1e0)],'task_id':_0x3efd98,'parent_task_id':_0x37a13a[_0x5aa2b8(0x1b3)],'network_id':_0x37a13a['networkId'],'transport':_0x37a13a[_0x5aa2b8(0x1ae)],'status':_0x17c462,'duration_ms':_0x25c6e1()-_0xc112dd,'lifecycle_tracking':_0x37a13a[_0x5aa2b8(0x1bf)],..._0x44b54e!==void 0x0?{'error_code':_0x486424||_0x5aa2b8(0x1cd),'error_message':N(_0x44b54e)}:{}})));};_0x4bfd78(_0x5d007f(0x1ec),null);try{let _0x2adbc1=await _0x51e85f['send'](),_0x35ee5e=j(_0x2adbc1);if(_0x35ee5e)_0x4bfd78(_0x5d007f(0x1d7),_0x35ee5e);else{if(_0x2adbc1?.['ok']===!0x1||_0x2adbc1?.[_0x5d007f(0x1e2)])_0x4bfd78(_0x5d007f(0x203),_0x35ee5e,_0x2adbc1?.[_0x5d007f(0x1e2)]||_0x5d007f(0x1b8),'send_rejected');else _0x4bfd78(_0x5d007f(0x203),null,_0x5d007f(0x224),_0x5d007f(0x1cb));}return _0x2adbc1;}catch(_0x19ca9a){throw _0x4bfd78('failed',null,_0x19ca9a,_0x5d007f(0x1cd)),_0x19ca9a;}}async function Y(_0x265c6e,_0x14b6ad){const _0xcf2414=a0_0x4ab4f5;return X({'fromAlias':_0x265c6e[_0xcf2414(0x1a9)],'toAlias':_0x265c6e[_0xcf2414(0x1db)],'parentTaskId':_0x265c6e['parentTaskId']||null,'networkId':_0x265c6e[_0xcf2414(0x1f2)]||null,'transport':_0xcf2414(0x1d4),'lifecycleTracking':_0xcf2414(0x1be)},_0x14b6ad);}class $ extends a0_0x1cc878{[a0_0x4ab4f5(0x1f4)];[a0_0x4ab4f5(0x1db)];[a0_0x4ab4f5(0x205)];[a0_0x4ab4f5(0x1ad)];[a0_0x4ab4f5(0x210)];[a0_0x4ab4f5(0x21b)];[a0_0x4ab4f5(0x216)];[a0_0x4ab4f5(0x1cf)];[a0_0x4ab4f5(0x1c5)];['running']=!0x1;constructor(_0x532c49){const _0x106885=a0_0x4ab4f5;super();if(this[_0x106885(0x1f4)]=_0x532c49[_0x106885(0x1f4)][_0x106885(0x1dd)](/\/$/,''),this[_0x106885(0x1db)]=_0x532c49['alias'],this['token']=_0x532c49['token'],this[_0x106885(0x1ad)]=_0x532c49[_0x106885(0x1ad)]||'sdk',this[_0x106885(0x210)]='sdk-'+_0x532c49[_0x106885(0x1db)]+'-'+Date[_0x106885(0x1b9)]()[_0x106885(0x1e8)](0x24),this['heartbeatInterval']=_0x532c49[_0x106885(0x21b)]??0x2bf20,this['reconnectDelay']=_0x532c49[_0x106885(0x216)]??0xbb8,_0x532c49[_0x106885(0x21f)]!==!0x1)this[_0x106885(0x1f9)]();}['log'](_0x2a739a){const _0x5669cd=a0_0x4ab4f5;console[_0x5669cd(0x1b7)]('['+new Date()[_0x5669cd(0x20b)]()[_0x5669cd(0x1f7)](0x0,0x8)+_0x5669cd(0x1dc)+this['alias']+']\x20'+_0x2a739a);}async['call'](_0x35471f,_0x478d28){const _0x39bd4b=a0_0x4ab4f5;let _0x374076={'Content-Type':_0x39bd4b(0x1d1),'Accept':_0x39bd4b(0x220)};if(this[_0x39bd4b(0x205)])_0x374076[_0x39bd4b(0x20e)]=_0x39bd4b(0x1b5)+this[_0x39bd4b(0x205)];let _0x2ef452=await(await fetch(this[_0x39bd4b(0x1f4)]+_0x39bd4b(0x21a),{'method':_0x39bd4b(0x1d0),'headers':_0x374076,'body':JSON[_0x39bd4b(0x1ea)]({'jsonrpc':_0x39bd4b(0x1b4),'id':Date[_0x39bd4b(0x1b9)](),'method':'tools/call','params':{'name':_0x35471f,'arguments':_0x478d28}})}))[_0x39bd4b(0x207)](),_0x38f971=_0x2ef452[_0x39bd4b(0x209)](/data: (.+)/),_0x11d7c3=_0x38f971?JSON['parse'](_0x38f971[0x1]):JSON[_0x39bd4b(0x1e3)](_0x2ef452),_0x546135=_0x11d7c3?.[_0x39bd4b(0x200)]?.[_0x39bd4b(0x1c9)]?.[0x0]?.[_0x39bd4b(0x207)];return _0x546135?JSON[_0x39bd4b(0x1e3)](_0x546135):_0x11d7c3;}async['connect'](){const _0x12c7a0=a0_0x4ab4f5;if(this['running'])return;this[_0x12c7a0(0x1b1)]=!0x0,await this[_0x12c7a0(0x1f8)](_0x12c7a0(0x1fa)),this[_0x12c7a0(0x1b7)](_0x12c7a0(0x219)),this[_0x12c7a0(0x1cf)]=setInterval(()=>{const _0x56e55f=_0x12c7a0;this[_0x56e55f(0x1f8)](_0x56e55f(0x1fa))[_0x56e55f(0x1aa)](_0x51c931=>this[_0x56e55f(0x1b7)](_0x56e55f(0x21e)+_0x51c931['message']));},this[_0x12c7a0(0x21b)]),this[_0x12c7a0(0x1ce)]();}async['disconnect'](){const _0x35316d=a0_0x4ab4f5;if(this['running']=!0x1,this[_0x35316d(0x1c5)]?.[_0x35316d(0x1bd)](),this['heartbeatTimer'])clearInterval(this[_0x35316d(0x1cf)]);await this['status'](_0x35316d(0x1bb))['catch'](()=>{}),this[_0x35316d(0x1b7)](_0x35316d(0x1fe));}async['send'](_0x89ad08,_0x42db09,_0x3a3c83=a0_0x4ab4f5(0x1f3)){const _0x56c158=a0_0x4ab4f5;return Y({'alias':_0x89ad08,'fromAlias':this[_0x56c158(0x1db)]},{'log':_0x26983e=>console[_0x56c158(0x1b7)](_0x26983e),'send':()=>this['call'](_0x56c158(0x1d6),{'alias':_0x89ad08,'task':_0x42db09,'priority':_0x3a3c83,'from_session':this[_0x56c158(0x1db)]})});}async[a0_0x4ab4f5(0x1a7)](_0x504d11,_0x37c0f0){const _0x1416d4=a0_0x4ab4f5;return this[_0x1416d4(0x223)](_0x1416d4(0x1fc),{'alias':_0x504d11,'message':_0x37c0f0,'from_session':this[_0x1416d4(0x1db)]});}async[a0_0x4ab4f5(0x1cc)](_0xb65879,_0x1d506e,_0x3c8552=a0_0x4ab4f5(0x1c2)){const _0xf635cc=a0_0x4ab4f5;return this[_0xf635cc(0x223)](_0xf635cc(0x1c8),{'in_reply_to':_0xb65879,'text':_0x1d506e,'status':_0x3c8552});}async['status'](_0x53fc49,_0x56fd5c){const _0x2caae9=a0_0x4ab4f5;return this[_0x2caae9(0x223)]('report_status',{'resume_id':this['resumeId'],'alias':this[_0x2caae9(0x1db)],'status':_0x53fc49,'server':a0_0x8fbb80(),'hostname':a0_0x8fbb80(),'agent':this[_0x2caae9(0x1ad)],'project_dir':process[_0x2caae9(0x1f6)](),..._0x56fd5c});}async[a0_0x4ab4f5(0x1c4)](){const _0x3f8282=a0_0x4ab4f5;return this[_0x3f8282(0x223)](_0x3f8282(0x1f5),{});}async[a0_0x4ab4f5(0x1ca)](_0x3ccd1f,_0x4e2532){const _0x57090c=a0_0x4ab4f5;return this[_0x57090c(0x223)](_0x57090c(0x1ca),{'message':_0x3ccd1f,'filter_server':_0x4e2532?.['server'],'filter_status':_0x4e2532?.['status']});}async[a0_0x4ab4f5(0x1ce)](){const _0x4066a5=a0_0x4ab4f5;let _0x1011b7=encodeURIComponent(this['alias']),_0x485608=this['url']+_0x4066a5(0x1e4)+_0x1011b7,_0x4168dd=this[_0x4066a5(0x216)];while(this['running']){try{this['sseAbort']=new AbortController();let _0xe0255={'Accept':'text/event-stream'};if(this['token'])_0xe0255[_0x4066a5(0x20e)]='Bearer\x20'+this['token'];let _0xcf2722=await fetch(_0x485608,{'headers':_0xe0255,'signal':this[_0x4066a5(0x1c5)][_0x4066a5(0x204)]});if(!_0xcf2722['ok']||!_0xcf2722['body']){this[_0x4066a5(0x1b7)]('SSE\x20failed:\x20'+_0xcf2722[_0x4066a5(0x1f8)]),await this['sleep'](_0x4168dd),_0x4168dd=Math[_0x4066a5(0x211)](_0x4168dd*1.5,0xea60);continue;}_0x4168dd=this['reconnectDelay'];let _0x250656=_0xcf2722[_0x4066a5(0x218)][_0x4066a5(0x1e7)](),_0x526532=new TextDecoder(),_0x2e6843='';while(this[_0x4066a5(0x1b1)]){let {done:_0x3706a4,value:_0xae3beb}=await _0x250656[_0x4066a5(0x1ba)]();if(_0x3706a4)break;_0x2e6843+=_0x526532[_0x4066a5(0x1eb)](_0xae3beb,{'stream':!0x0});let _0x44139d=_0x2e6843['split']('\x0a');_0x2e6843=_0x44139d[_0x4066a5(0x1c6)]()||'';for(let _0x1b2bb8 of _0x44139d){if(!_0x1b2bb8[_0x4066a5(0x1f0)](_0x4066a5(0x1da)))continue;try{let _0x9e98c9=JSON[_0x4066a5(0x1e3)](_0x1b2bb8[_0x4066a5(0x1f7)](0x6));if(_0x9e98c9[_0x4066a5(0x1ab)]==='connected'){this[_0x4066a5(0x1b7)](_0x4066a5(0x1e1)),this[_0x4066a5(0x1af)](_0x4066a5(0x1e9));continue;}if(_0x9e98c9[_0x4066a5(0x1ab)]==='new_task'||_0x9e98c9[_0x4066a5(0x1ab)]===_0x4066a5(0x1a6)||_0x9e98c9[_0x4066a5(0x1ab)]===_0x4066a5(0x1ca))await this[_0x4066a5(0x20a)]();}catch{}}}}catch(_0x2feb34){if(_0x2feb34[_0x4066a5(0x1ee)]==='AbortError')break;this[_0x4066a5(0x1af)]('error',_0x2feb34),this[_0x4066a5(0x1b7)](_0x4066a5(0x1b2)+_0x2feb34[_0x4066a5(0x1a7)]);}if(this[_0x4066a5(0x1b1)])this[_0x4066a5(0x1af)]('disconnected'),this[_0x4066a5(0x1b7)]('SSE\x20reconnecting\x20in\x20'+_0x4168dd/0x3e8+_0x4066a5(0x213)),await this['sleep'](_0x4168dd),_0x4168dd=Math[_0x4066a5(0x211)](_0x4168dd*1.5,0xea60);}}async[a0_0x4ab4f5(0x20a)](){const _0x561a46=a0_0x4ab4f5;try{let _0x534aee=(await this[_0x561a46(0x223)](_0x561a46(0x1b0),{'alias':this['alias'],'limit':0xa}))?.['messages']||[];for(let _0x147bde of _0x534aee)await this[_0x561a46(0x223)]('ack_inbox',{'alias':this['alias'],'message_id':_0x147bde['id']}),this[_0x561a46(0x1b7)]('←\x20'+_0x147bde[_0x561a46(0x1a8)]+':\x20'+_0x147bde[_0x561a46(0x1c9)][_0x561a46(0x1f7)](0x0,0x3c)),this[_0x561a46(0x1af)](_0x561a46(0x208),_0x147bde),this[_0x561a46(0x1af)](_0x561a46(0x1a7),_0x147bde);}catch(_0x3ae733){this['log'](_0x561a46(0x1ef)+_0x3ae733['message']);}}[a0_0x4ab4f5(0x1a5)](_0x453a3a){return new Promise(_0x334e8d=>setTimeout(_0x334e8d,_0x453a3a));}}var F=$;export{F as default,$ as CommHub};
1
+ const a0_0x1e1d45=a0_0x2a3c;(function(_0x9ce942,_0x4d2a27){const _0xab0a6a=a0_0x2a3c,_0x7340c4=_0x9ce942();while(!![]){try{const _0x2c8b35=parseInt(_0xab0a6a(0x1f2))/0x1*(-parseInt(_0xab0a6a(0x206))/0x2)+-parseInt(_0xab0a6a(0x1dc))/0x3+parseInt(_0xab0a6a(0x207))/0x4+-parseInt(_0xab0a6a(0x222))/0x5+parseInt(_0xab0a6a(0x1f5))/0x6+parseInt(_0xab0a6a(0x1eb))/0x7+parseInt(_0xab0a6a(0x240))/0x8;if(_0x2c8b35===_0x4d2a27)break;else _0x7340c4['push'](_0x7340c4['shift']());}catch(_0xcf62ba){_0x7340c4['push'](_0x7340c4['shift']());}}}(a0_0x59ac,0x82aca));import{EventEmitter as a0_0x300e63}from'events';import{hostname as a0_0x1bf6d8}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x320d12,_0x34205b)=>(_0x320d12??_0x34205b)[a0_0x1e1d45(0x234)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x1e1d45(0x23c)](0x0,0xf0);function N(_0x44a7c3){const _0x4975c7=a0_0x1e1d45;return(_0x44a7c3 instanceof Error?_0x44a7c3['message']:String(_0x44a7c3??_0x4975c7(0x252)))['replace'](K,_0x4975c7(0x210))[_0x4975c7(0x234)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x4975c7(0x23c)](0x0,0xf0);}function a0_0x59ac(){const _0xd48ed9=['heartbeatTimer','send_message','completed','content','Bearer\x20','connect','inbox\x20error:\x20','get_all_status','pop','4638300IFhVNN','sleep','SSE\x20reconnecting\x20in\x20','parentTaskId','body','connected','parent_task_id','reply','heartbeat\x20failed:\x20','network_id','not_tracked','text/event-stream','send_rejected','heartbeatInterval','getAllStatus','sseAbort','registered','error_code','replace','\x20lifecycle=','error','abort','get_inbox','ack_inbox','failed','disconnected','slice','task.ack','lifecycle_tracking','send_task','8169864UHxXfO','string','sdk','fromAlias','Authorization','task.started','toAlias','[commhub:task]\x20','running','parse','url','data:\x20','cwd','status','\x20transport=','AbortError','CommHub\x20response\x20omitted\x20task_id','new_message','unknown\x20error','send','alias','normal','/mcp','\x20duration_ms=','decode','read','text','task.send.start','autoConnect','2496984sIsDAk','CommHub\x20rejected\x20task','s...','log','SSE\x20error:\x20','\x20from=','message_id','<unknown>','sdk-','call','signal','toString','/events/','networkId','broadcast','3490025YPWgDs','token','task.send.delivered','\x20network_id=','2.0','to_alias','send_reply','5613thWZRX','json','catch','4824150kTMPzs','new_task','<missing>','agent','idle','error_message','resumeId','messages','result','from_session','task','message','now',']\x20[commhub:','lifecycleTracking','processInbox','task.send.failed','306AmLNLR','3320744zYloPT','offline','\x20parent_task_id=','mcp_http','connectSSE','SSE\x20connected','emit','split','server','[REDACTED]','transport','name','POST','report_status','reconnectDelay','task_id','send_failed','type'];a0_0x59ac=function(){return _0xd48ed9;};return a0_0x59ac();}function O(_0x1affab,_0x4e2a02=process.env.ANET_TASK_TRACE_FORMAT===a0_0x1e1d45(0x1f3)){const _0x106835=a0_0x1e1d45;if(_0x4e2a02)return JSON['stringify'](_0x1affab);let _0x5ce38e=L(_0x1affab[_0x106835(0x228)],_0x106835(0x1f7)),_0x756df1=L(_0x1affab[_0x106835(0x216)],'<pending>'),_0x5356e9=_0x1affab[_0x106835(0x233)]?'\x20error='+_0x1affab['error_code']+':'+(_0x1affab[_0x106835(0x1fa)]??''):'';return _0x106835(0x247)+_0x1affab['status']+_0x106835(0x1e1)+L(_0x1affab['from_alias'],_0x106835(0x1e3))+'\x20to='+L(_0x1affab[_0x106835(0x1f0)],_0x106835(0x1e3))+'\x20task_id='+_0x756df1+_0x106835(0x209)+_0x5ce38e+_0x106835(0x1ee)+L(_0x1affab[_0x106835(0x22b)],_0x106835(0x1e3))+_0x106835(0x24e)+_0x1affab['transport']+_0x106835(0x1d6)+_0x1affab['duration_ms']+_0x106835(0x235)+_0x1affab[_0x106835(0x23e)]+_0x5356e9;}function U(_0x576aea){const _0x501b72=a0_0x1e1d45;return{'event':{'sending':_0x501b72(0x1da),'delivered':_0x501b72(0x1ed),'failed':_0x501b72(0x205),'acked':_0x501b72(0x23d),'started':_0x501b72(0x245),'replied':'task.replied','expired':'task.expired'}[_0x576aea[_0x501b72(0x24d)]],..._0x576aea};}function j(_0x4bc681){const _0x204f01=a0_0x1e1d45;let _0x135ca8=_0x4bc681?.[_0x204f01(0x216)]||_0x4bc681?.['message_id']||_0x4bc681?.['id'];if(_0x135ca8)return String(_0x135ca8);let _0xb52479=_0x4bc681?.['content']?.[0x0]?.['text'];if(typeof _0xb52479!==_0x204f01(0x241))return null;try{let _0x454547=JSON[_0x204f01(0x249)](_0xb52479);return _0x454547?.['task_id']||_0x454547?.[_0x204f01(0x1e2)]||_0x454547?.['id']||null;}catch{return null;}}async function X(_0x4c86da,_0x4da0e6){const _0x16b461=a0_0x1e1d45;let _0x531983=_0x4da0e6['now']??Date[_0x16b461(0x201)],_0x96ede7=_0x531983(),_0x2a332f=(_0x545578,_0x2169f2,_0x27335a,_0x38eb22)=>{const _0x1ebe0e=_0x16b461;_0x4da0e6[_0x1ebe0e(0x1df)](O(U({'from_alias':_0x4c86da['fromAlias'],'to_alias':_0x4c86da[_0x1ebe0e(0x246)],'task_id':_0x2169f2,'parent_task_id':_0x4c86da[_0x1ebe0e(0x225)],'network_id':_0x4c86da['networkId'],'transport':_0x4c86da[_0x1ebe0e(0x211)],'status':_0x545578,'duration_ms':_0x531983()-_0x96ede7,'lifecycle_tracking':_0x4c86da[_0x1ebe0e(0x203)],..._0x27335a!==void 0x0?{'error_code':_0x38eb22||_0x1ebe0e(0x217),'error_message':N(_0x27335a)}:{}})));};_0x2a332f('sending',null);try{let _0x108dec=await _0x4da0e6[_0x16b461(0x253)](),_0x2cdd87=j(_0x108dec);if(_0x2cdd87)_0x2a332f('delivered',_0x2cdd87);else{if(_0x108dec?.['ok']===!0x1||_0x108dec?.[_0x16b461(0x236)])_0x2a332f('failed',_0x2cdd87,_0x108dec?.[_0x16b461(0x236)]||_0x16b461(0x1dd),_0x16b461(0x22e));else _0x2a332f(_0x16b461(0x23a),null,_0x16b461(0x250),'missing_task_id');}return _0x108dec;}catch(_0x592175){throw _0x2a332f(_0x16b461(0x23a),null,_0x592175,_0x16b461(0x217)),_0x592175;}}async function Y(_0x5095c4,_0x30ddf4){const _0x3e9dd6=a0_0x1e1d45;return X({'fromAlias':_0x5095c4[_0x3e9dd6(0x243)],'toAlias':_0x5095c4['alias'],'parentTaskId':_0x5095c4[_0x3e9dd6(0x225)]||null,'networkId':_0x5095c4[_0x3e9dd6(0x1e9)]||null,'transport':_0x3e9dd6(0x20a),'lifecycleTracking':_0x3e9dd6(0x22c)},_0x30ddf4);}class $ extends a0_0x300e63{[a0_0x1e1d45(0x24a)];['alias'];[a0_0x1e1d45(0x1ec)];[a0_0x1e1d45(0x1f8)];[a0_0x1e1d45(0x1fb)];[a0_0x1e1d45(0x22f)];[a0_0x1e1d45(0x215)];[a0_0x1e1d45(0x219)];[a0_0x1e1d45(0x231)];[a0_0x1e1d45(0x248)]=!0x1;constructor(_0x5d6153){const _0x374d1a=a0_0x1e1d45;super();if(this[_0x374d1a(0x24a)]=_0x5d6153[_0x374d1a(0x24a)]['replace'](/\/$/,''),this['alias']=_0x5d6153[_0x374d1a(0x254)],this[_0x374d1a(0x1ec)]=_0x5d6153[_0x374d1a(0x1ec)],this[_0x374d1a(0x1f8)]=_0x5d6153[_0x374d1a(0x1f8)]||_0x374d1a(0x242),this[_0x374d1a(0x1fb)]=_0x374d1a(0x1e4)+_0x5d6153[_0x374d1a(0x254)]+'-'+Date[_0x374d1a(0x201)]()[_0x374d1a(0x1e7)](0x24),this[_0x374d1a(0x22f)]=_0x5d6153[_0x374d1a(0x22f)]??0x2bf20,this[_0x374d1a(0x215)]=_0x5d6153[_0x374d1a(0x215)]??0xbb8,_0x5d6153[_0x374d1a(0x1db)]!==!0x1)this[_0x374d1a(0x21e)]();}['log'](_0x15b37b){const _0x37d6e7=a0_0x1e1d45;console[_0x37d6e7(0x1df)]('['+new Date()['toTimeString']()[_0x37d6e7(0x23c)](0x0,0x8)+_0x37d6e7(0x202)+this['alias']+']\x20'+_0x15b37b);}async[a0_0x1e1d45(0x1e5)](_0x45d31d,_0x2d689e){const _0x5e34ca=a0_0x1e1d45;let _0x3d677e={'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream'};if(this[_0x5e34ca(0x1ec)])_0x3d677e[_0x5e34ca(0x244)]=_0x5e34ca(0x21d)+this[_0x5e34ca(0x1ec)];let _0x434847=await(await fetch(this[_0x5e34ca(0x24a)]+_0x5e34ca(0x1d5),{'method':_0x5e34ca(0x213),'headers':_0x3d677e,'body':JSON['stringify']({'jsonrpc':_0x5e34ca(0x1ef),'id':Date[_0x5e34ca(0x201)](),'method':'tools/call','params':{'name':_0x45d31d,'arguments':_0x2d689e}})}))[_0x5e34ca(0x1d9)](),_0x14fa12=_0x434847['match'](/data: (.+)/),_0x28aef5=_0x14fa12?JSON[_0x5e34ca(0x249)](_0x14fa12[0x1]):JSON['parse'](_0x434847),_0x46e593=_0x28aef5?.[_0x5e34ca(0x1fd)]?.[_0x5e34ca(0x21c)]?.[0x0]?.[_0x5e34ca(0x1d9)];return _0x46e593?JSON[_0x5e34ca(0x249)](_0x46e593):_0x28aef5;}async[a0_0x1e1d45(0x21e)](){const _0x43be0=a0_0x1e1d45;if(this[_0x43be0(0x248)])return;this[_0x43be0(0x248)]=!0x0,await this[_0x43be0(0x24d)]('idle'),this['log'](_0x43be0(0x232)),this['heartbeatTimer']=setInterval(()=>{const _0x3c98b5=_0x43be0;this[_0x3c98b5(0x24d)](_0x3c98b5(0x1f9))[_0x3c98b5(0x1f4)](_0x40cf89=>this[_0x3c98b5(0x1df)](_0x3c98b5(0x22a)+_0x40cf89[_0x3c98b5(0x200)]));},this[_0x43be0(0x22f)]),this[_0x43be0(0x20b)]();}async['disconnect'](){const _0xbdc152=a0_0x1e1d45;if(this[_0xbdc152(0x248)]=!0x1,this[_0xbdc152(0x231)]?.[_0xbdc152(0x237)](),this[_0xbdc152(0x219)])clearInterval(this[_0xbdc152(0x219)]);await this['status'](_0xbdc152(0x208))[_0xbdc152(0x1f4)](()=>{}),this[_0xbdc152(0x1df)](_0xbdc152(0x23b));}async[a0_0x1e1d45(0x253)](_0x16aa9e,_0x4a2e0d,_0x56c139=a0_0x1e1d45(0x255)){const _0x5ac850=a0_0x1e1d45;return Y({'alias':_0x16aa9e,'fromAlias':this[_0x5ac850(0x254)]},{'log':_0x237964=>console['log'](_0x237964),'send':()=>this[_0x5ac850(0x1e5)](_0x5ac850(0x23f),{'alias':_0x16aa9e,'task':_0x4a2e0d,'priority':_0x56c139,'from_session':this[_0x5ac850(0x254)]})});}async[a0_0x1e1d45(0x200)](_0x2c56d6,_0x30e276){const _0x3093d2=a0_0x1e1d45;return this['call'](_0x3093d2(0x21a),{'alias':_0x2c56d6,'message':_0x30e276,'from_session':this[_0x3093d2(0x254)]});}async[a0_0x1e1d45(0x229)](_0x3d1cbb,_0x53b4d7,_0x76cd11=a0_0x1e1d45(0x21b)){const _0x12ad5a=a0_0x1e1d45;return this[_0x12ad5a(0x1e5)](_0x12ad5a(0x1f1),{'in_reply_to':_0x3d1cbb,'text':_0x53b4d7,'status':_0x76cd11});}async[a0_0x1e1d45(0x24d)](_0x341b62,_0x367b81){const _0xe19e95=a0_0x1e1d45;return this['call'](_0xe19e95(0x214),{'resume_id':this[_0xe19e95(0x1fb)],'alias':this[_0xe19e95(0x254)],'status':_0x341b62,'server':a0_0x1bf6d8(),'hostname':a0_0x1bf6d8(),'agent':this[_0xe19e95(0x1f8)],'project_dir':process[_0xe19e95(0x24c)](),..._0x367b81});}async[a0_0x1e1d45(0x230)](){const _0x4c7d07=a0_0x1e1d45;return this[_0x4c7d07(0x1e5)](_0x4c7d07(0x220),{});}async[a0_0x1e1d45(0x1ea)](_0x1b189a,_0x58a79b){const _0x5b53aa=a0_0x1e1d45;return this[_0x5b53aa(0x1e5)](_0x5b53aa(0x1ea),{'message':_0x1b189a,'filter_server':_0x58a79b?.[_0x5b53aa(0x20f)],'filter_status':_0x58a79b?.[_0x5b53aa(0x24d)]});}async[a0_0x1e1d45(0x20b)](){const _0x2fe75b=a0_0x1e1d45;let _0x1f9336=encodeURIComponent(this[_0x2fe75b(0x254)]),_0x23253e=this[_0x2fe75b(0x24a)]+_0x2fe75b(0x1e8)+_0x1f9336,_0x1dd58a=this[_0x2fe75b(0x215)];while(this[_0x2fe75b(0x248)]){try{this['sseAbort']=new AbortController();let _0x5a8e68={'Accept':_0x2fe75b(0x22d)};if(this['token'])_0x5a8e68[_0x2fe75b(0x244)]=_0x2fe75b(0x21d)+this[_0x2fe75b(0x1ec)];let _0x5b798f=await fetch(_0x23253e,{'headers':_0x5a8e68,'signal':this[_0x2fe75b(0x231)][_0x2fe75b(0x1e6)]});if(!_0x5b798f['ok']||!_0x5b798f[_0x2fe75b(0x226)]){this[_0x2fe75b(0x1df)]('SSE\x20failed:\x20'+_0x5b798f[_0x2fe75b(0x24d)]),await this[_0x2fe75b(0x223)](_0x1dd58a),_0x1dd58a=Math['min'](_0x1dd58a*1.5,0xea60);continue;}_0x1dd58a=this[_0x2fe75b(0x215)];let _0xbf155=_0x5b798f[_0x2fe75b(0x226)]['getReader'](),_0x344451=new TextDecoder(),_0x283780='';while(this['running']){let {done:_0x3db989,value:_0x414f1e}=await _0xbf155[_0x2fe75b(0x1d8)]();if(_0x3db989)break;_0x283780+=_0x344451[_0x2fe75b(0x1d7)](_0x414f1e,{'stream':!0x0});let _0x38886e=_0x283780[_0x2fe75b(0x20e)]('\x0a');_0x283780=_0x38886e[_0x2fe75b(0x221)]()||'';for(let _0x3ae8e2 of _0x38886e){if(!_0x3ae8e2['startsWith'](_0x2fe75b(0x24b)))continue;try{let _0x35d15e=JSON[_0x2fe75b(0x249)](_0x3ae8e2[_0x2fe75b(0x23c)](0x6));if(_0x35d15e[_0x2fe75b(0x218)]===_0x2fe75b(0x227)){this[_0x2fe75b(0x1df)](_0x2fe75b(0x20c)),this[_0x2fe75b(0x20d)](_0x2fe75b(0x227));continue;}if(_0x35d15e[_0x2fe75b(0x218)]===_0x2fe75b(0x1f6)||_0x35d15e[_0x2fe75b(0x218)]===_0x2fe75b(0x251)||_0x35d15e[_0x2fe75b(0x218)]===_0x2fe75b(0x1ea))await this[_0x2fe75b(0x204)]();}catch{}}}}catch(_0x292832){if(_0x292832[_0x2fe75b(0x212)]===_0x2fe75b(0x24f))break;this['emit']('error',_0x292832),this[_0x2fe75b(0x1df)](_0x2fe75b(0x1e0)+_0x292832[_0x2fe75b(0x200)]);}if(this[_0x2fe75b(0x248)])this[_0x2fe75b(0x20d)](_0x2fe75b(0x23b)),this[_0x2fe75b(0x1df)](_0x2fe75b(0x224)+_0x1dd58a/0x3e8+_0x2fe75b(0x1de)),await this[_0x2fe75b(0x223)](_0x1dd58a),_0x1dd58a=Math['min'](_0x1dd58a*1.5,0xea60);}}async[a0_0x1e1d45(0x204)](){const _0x1a0e34=a0_0x1e1d45;try{let _0x379f9c=(await this[_0x1a0e34(0x1e5)](_0x1a0e34(0x238),{'alias':this[_0x1a0e34(0x254)],'limit':0xa}))?.[_0x1a0e34(0x1fc)]||[];for(let _0x12b483 of _0x379f9c)await this[_0x1a0e34(0x1e5)](_0x1a0e34(0x239),{'alias':this[_0x1a0e34(0x254)],'message_id':_0x12b483['id']}),this[_0x1a0e34(0x1df)]('←\x20'+_0x12b483[_0x1a0e34(0x1fe)]+':\x20'+_0x12b483[_0x1a0e34(0x21c)]['slice'](0x0,0x3c)),this[_0x1a0e34(0x20d)](_0x1a0e34(0x1ff),_0x12b483),this['emit']('message',_0x12b483);}catch(_0x3cc51a){this['log'](_0x1a0e34(0x21f)+_0x3cc51a[_0x1a0e34(0x200)]);}}['sleep'](_0x1b6f7d){return new Promise(_0x1287bc=>setTimeout(_0x1287bc,_0x1b6f7d));}}function a0_0x2a3c(_0x542321,_0x4820bf){_0x542321=_0x542321-0x1d5;const _0x59ac0b=a0_0x59ac();let _0x2a3c3c=_0x59ac0b[_0x542321];return _0x2a3c3c;}var F=$;export{F as default,$ as CommHub};