@sleep2agi/agent-network 2.3.0-preview.205 → 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_0xb9de8=a0_0x20ac;(function(_0x165231,_0x52407e){const _0x52d27b=a0_0x20ac,_0x453a04=_0x165231();while(!![]){try{const _0x2e9fd1=-parseInt(_0x52d27b(0x13e))/0x1*(-parseInt(_0x52d27b(0x102))/0x2)+-parseInt(_0x52d27b(0x113))/0x3*(-parseInt(_0x52d27b(0xfc))/0x4)+parseInt(_0x52d27b(0x14f))/0x5*(-parseInt(_0x52d27b(0xeb))/0x6)+-parseInt(_0x52d27b(0x139))/0x7*(parseInt(_0x52d27b(0xc9))/0x8)+-parseInt(_0x52d27b(0x12c))/0x9+-parseInt(_0x52d27b(0x131))/0xa*(-parseInt(_0x52d27b(0x13b))/0xb)+-parseInt(_0x52d27b(0x14c))/0xc*(-parseInt(_0x52d27b(0xe1))/0xd);if(_0x2e9fd1===_0x52407e)break;else _0x453a04['push'](_0x453a04['shift']());}catch(_0x4f9c8f){_0x453a04['push'](_0x453a04['shift']());}}}(a0_0x1a7b,0x58a94));function a0_0x20ac(_0x3d8fc3,_0x4e385e){_0x3d8fc3=_0x3d8fc3-0xc7;const _0x1a7bd1=a0_0x1a7b();let _0x20ac89=_0x1a7bd1[_0x3d8fc3];return _0x20ac89;}import{EventEmitter as a0_0xc28d1d}from'events';import{hostname as a0_0x446054}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x22ef5f,_0x47b8ac)=>(_0x22ef5f??_0x47b8ac)[a0_0xb9de8(0x123)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0xb9de8(0x147)](0x0,0xf0);function N(_0x443cf3){const _0x553fbb=a0_0xb9de8;return(_0x443cf3 instanceof Error?_0x443cf3[_0x553fbb(0x13a)]:String(_0x443cf3??_0x553fbb(0x106)))[_0x553fbb(0x123)](K,_0x553fbb(0xf5))['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x553fbb(0x147)](0x0,0xf0);}function O(_0x4af178,_0x50b20d=process.env.ANET_TASK_TRACE_FORMAT===a0_0xb9de8(0xef)){const _0x350026=a0_0xb9de8;if(_0x50b20d)return JSON[_0x350026(0x142)](_0x4af178);let _0x1bd681=L(_0x4af178[_0x350026(0xe5)],_0x350026(0x149)),_0x23ab66=L(_0x4af178['task_id'],_0x350026(0x109)),_0x1bb969=_0x4af178[_0x350026(0x12b)]?_0x350026(0x145)+_0x4af178[_0x350026(0x12b)]+':'+(_0x4af178[_0x350026(0x119)]??''):'';return _0x350026(0xf3)+_0x4af178[_0x350026(0x13d)]+_0x350026(0xe0)+L(_0x4af178[_0x350026(0x111)],_0x350026(0xee))+_0x350026(0x116)+L(_0x4af178[_0x350026(0x130)],_0x350026(0xee))+'\x20task_id='+_0x23ab66+_0x350026(0x14e)+_0x1bd681+_0x350026(0x137)+L(_0x4af178['network_id'],_0x350026(0xee))+'\x20transport='+_0x4af178[_0x350026(0x140)]+_0x350026(0x10c)+_0x4af178[_0x350026(0x103)]+_0x350026(0x124)+_0x4af178[_0x350026(0xe2)]+_0x1bb969;}function U(_0x517b70){const _0x35e6f1=a0_0xb9de8;return{'event':{'sending':'task.send.start','delivered':_0x35e6f1(0xc8),'failed':_0x35e6f1(0x120),'acked':_0x35e6f1(0xfd),'started':'task.started','replied':_0x35e6f1(0x128),'expired':_0x35e6f1(0xd0)}[_0x517b70[_0x35e6f1(0x13d)]],..._0x517b70};}function j(_0x2b52f3){const _0x30af5e=a0_0xb9de8;let _0x2c87ff=_0x2b52f3?.[_0x30af5e(0x11b)]||_0x2b52f3?.[_0x30af5e(0x10f)]||_0x2b52f3?.['id'];if(_0x2c87ff)return String(_0x2c87ff);let _0x3a7104=_0x2b52f3?.[_0x30af5e(0xd4)]?.[0x0]?.[_0x30af5e(0xf2)];if(typeof _0x3a7104!==_0x30af5e(0xff))return null;try{let _0x1b6b19=JSON['parse'](_0x3a7104);return _0x1b6b19?.[_0x30af5e(0x11b)]||_0x1b6b19?.[_0x30af5e(0x10f)]||_0x1b6b19?.['id']||null;}catch{return null;}}async function X(_0x3915be,_0x2ad9b1){const _0xe0adcf=a0_0xb9de8;let _0x4e273e=_0x2ad9b1[_0xe0adcf(0x125)]??Date[_0xe0adcf(0x125)],_0x2330a1=_0x4e273e(),_0x28ea52=(_0x21a472,_0x2d8694,_0x26a6d9,_0x31eb66)=>{const _0x586085=_0xe0adcf;_0x2ad9b1[_0x586085(0xf0)](O(U({'from_alias':_0x3915be[_0x586085(0x117)],'to_alias':_0x3915be[_0x586085(0x146)],'task_id':_0x2d8694,'parent_task_id':_0x3915be[_0x586085(0xf8)],'network_id':_0x3915be[_0x586085(0x12f)],'transport':_0x3915be[_0x586085(0x140)],'status':_0x21a472,'duration_ms':_0x4e273e()-_0x2330a1,'lifecycle_tracking':_0x3915be[_0x586085(0x101)],..._0x26a6d9!==void 0x0?{'error_code':_0x31eb66||_0x586085(0xec),'error_message':N(_0x26a6d9)}:{}})));};_0x28ea52(_0xe0adcf(0x10d),null);try{let _0x38c2d3=await _0x2ad9b1[_0xe0adcf(0x10b)](),_0x4329a6=j(_0x38c2d3);if(_0x4329a6)_0x28ea52(_0xe0adcf(0xce),_0x4329a6);else{if(_0x38c2d3?.['ok']===!0x1||_0x38c2d3?.['error'])_0x28ea52('failed',_0x4329a6,_0x38c2d3?.[_0xe0adcf(0x121)]||_0xe0adcf(0x12a),'send_rejected');else _0x28ea52(_0xe0adcf(0xc7),null,_0xe0adcf(0xe8),_0xe0adcf(0xdd));}return _0x38c2d3;}catch(_0x1f2b45){throw _0x28ea52(_0xe0adcf(0xc7),null,_0x1f2b45,_0xe0adcf(0xec)),_0x1f2b45;}}async function Y(_0x4ac0a0,_0x4921da){const _0xcdf8d6=a0_0xb9de8;return X({'fromAlias':_0x4ac0a0['fromAlias'],'toAlias':_0x4ac0a0['alias'],'parentTaskId':_0x4ac0a0['parentTaskId']||null,'networkId':_0x4ac0a0[_0xcdf8d6(0x12f)]||null,'transport':_0xcdf8d6(0x135),'lifecycleTracking':_0xcdf8d6(0xd5)},_0x4921da);}class $ extends a0_0xc28d1d{[a0_0xb9de8(0x11a)];['alias'];[a0_0xb9de8(0x114)];[a0_0xb9de8(0xed)];['resumeId'];[a0_0xb9de8(0x143)];['reconnectDelay'];[a0_0xb9de8(0x11c)];['sseAbort'];['running']=!0x1;constructor(_0x2aac90){const _0x24f706=a0_0xb9de8;super();if(this[_0x24f706(0x11a)]=_0x2aac90['url']['replace'](/\/$/,''),this[_0x24f706(0x14b)]=_0x2aac90[_0x24f706(0x14b)],this[_0x24f706(0x114)]=_0x2aac90[_0x24f706(0x114)],this['agent']=_0x2aac90[_0x24f706(0xed)]||_0x24f706(0xf9),this[_0x24f706(0x148)]=_0x24f706(0x136)+_0x2aac90['alias']+'-'+Date[_0x24f706(0x125)]()[_0x24f706(0x141)](0x24),this[_0x24f706(0x143)]=_0x2aac90[_0x24f706(0x143)]??0x2bf20,this[_0x24f706(0xcb)]=_0x2aac90[_0x24f706(0xcb)]??0xbb8,_0x2aac90[_0x24f706(0xda)]!==!0x1)this[_0x24f706(0xcc)]();}[a0_0xb9de8(0xf0)](_0x45b13e){const _0x5a327b=a0_0xb9de8;console['log']('['+new Date()['toTimeString']()[_0x5a327b(0x147)](0x0,0x8)+_0x5a327b(0x110)+this[_0x5a327b(0x14b)]+']\x20'+_0x45b13e);}async[a0_0xb9de8(0xfb)](_0x5d75a6,_0x4b2bd1){const _0xf3f4c1=a0_0xb9de8;let _0xd87179={'Content-Type':_0xf3f4c1(0x144),'Accept':_0xf3f4c1(0x11f)};if(this['token'])_0xd87179[_0xf3f4c1(0x105)]=_0xf3f4c1(0x126)+this[_0xf3f4c1(0x114)];let _0x1bbfee=await(await fetch(this[_0xf3f4c1(0x11a)]+_0xf3f4c1(0x104),{'method':_0xf3f4c1(0x14d),'headers':_0xd87179,'body':JSON['stringify']({'jsonrpc':'2.0','id':Date[_0xf3f4c1(0x125)](),'method':_0xf3f4c1(0x108),'params':{'name':_0x5d75a6,'arguments':_0x4b2bd1}})}))[_0xf3f4c1(0xf2)](),_0x8d2dad=_0x1bbfee[_0xf3f4c1(0xe3)](/data: (.+)/),_0x4fbd2a=_0x8d2dad?JSON['parse'](_0x8d2dad[0x1]):JSON[_0xf3f4c1(0x132)](_0x1bbfee),_0x26fd86=_0x4fbd2a?.[_0xf3f4c1(0xf4)]?.[_0xf3f4c1(0xd4)]?.[0x0]?.[_0xf3f4c1(0xf2)];return _0x26fd86?JSON['parse'](_0x26fd86):_0x4fbd2a;}async['connect'](){const _0x641f8d=a0_0xb9de8;if(this[_0x641f8d(0xcf)])return;this[_0x641f8d(0xcf)]=!0x0,await this[_0x641f8d(0x13d)](_0x641f8d(0xcd)),this[_0x641f8d(0xf0)](_0x641f8d(0x12d)),this[_0x641f8d(0x11c)]=setInterval(()=>{const _0x212147=_0x641f8d;this[_0x212147(0x13d)](_0x212147(0xcd))[_0x212147(0x127)](_0x239cf2=>this['log'](_0x212147(0x133)+_0x239cf2[_0x212147(0x13a)]));},this['heartbeatInterval']),this['connectSSE']();}async[a0_0xb9de8(0xdc)](){const _0x2ebb23=a0_0xb9de8;if(this[_0x2ebb23(0xcf)]=!0x1,this[_0x2ebb23(0xdf)]?.[_0x2ebb23(0xe9)](),this[_0x2ebb23(0x11c)])clearInterval(this[_0x2ebb23(0x11c)]);await this[_0x2ebb23(0x13d)]('offline')[_0x2ebb23(0x127)](()=>{}),this['log']('disconnected');}async[a0_0xb9de8(0x10b)](_0x5df26c,_0x44b8c1,_0x1176c6=a0_0xb9de8(0x107)){const _0x5d515d=a0_0xb9de8;return Y({'alias':_0x5df26c,'fromAlias':this[_0x5d515d(0x14b)]},{'log':_0x7ad2a=>console[_0x5d515d(0xf0)](_0x7ad2a),'send':()=>this[_0x5d515d(0xfb)](_0x5d515d(0x100),{'alias':_0x5df26c,'task':_0x44b8c1,'priority':_0x1176c6,'from_session':this['alias']})});}async[a0_0xb9de8(0x13a)](_0x3e02a2,_0x53ea77){const _0x313309=a0_0xb9de8;return this[_0x313309(0xfb)](_0x313309(0x129),{'alias':_0x3e02a2,'message':_0x53ea77,'from_session':this[_0x313309(0x14b)]});}async['reply'](_0x28eecb,_0xd06df8,_0x425d5d='completed'){return this['call']('send_reply',{'in_reply_to':_0x28eecb,'text':_0xd06df8,'status':_0x425d5d});}async[a0_0xb9de8(0x13d)](_0x5a587c,_0x1de39b){const _0x13ffe5=a0_0xb9de8;return this[_0x13ffe5(0xfb)]('report_status',{'resume_id':this[_0x13ffe5(0x148)],'alias':this[_0x13ffe5(0x14b)],'status':_0x5a587c,'server':a0_0x446054(),'hostname':a0_0x446054(),'agent':this['agent'],'project_dir':process[_0x13ffe5(0x11e)](),..._0x1de39b});}async[a0_0xb9de8(0xf7)](){const _0x2d526b=a0_0xb9de8;return this[_0x2d526b(0xfb)](_0x2d526b(0x11d),{});}async[a0_0xb9de8(0xd1)](_0x50f6a8,_0x1b30ff){const _0x2ddf41=a0_0xb9de8;return this['call']('broadcast',{'message':_0x50f6a8,'filter_server':_0x1b30ff?.['server'],'filter_status':_0x1b30ff?.[_0x2ddf41(0x13d)]});}async[a0_0xb9de8(0x12e)](){const _0x1041b8=a0_0xb9de8;let _0x3cee84=encodeURIComponent(this[_0x1041b8(0x14b)]),_0x32ff69=this[_0x1041b8(0x11a)]+_0x1041b8(0xd9)+_0x3cee84,_0x5677dc=this[_0x1041b8(0xcb)];while(this[_0x1041b8(0xcf)]){try{this[_0x1041b8(0xdf)]=new AbortController();let _0x4c30ce={'Accept':'text/event-stream'};if(this['token'])_0x4c30ce[_0x1041b8(0x105)]=_0x1041b8(0x126)+this[_0x1041b8(0x114)];let _0x441d23=await fetch(_0x32ff69,{'headers':_0x4c30ce,'signal':this['sseAbort'][_0x1041b8(0xe6)]});if(!_0x441d23['ok']||!_0x441d23[_0x1041b8(0xd3)]){this['log']('SSE\x20failed:\x20'+_0x441d23[_0x1041b8(0x13d)]),await this[_0x1041b8(0x118)](_0x5677dc),_0x5677dc=Math[_0x1041b8(0xea)](_0x5677dc*1.5,0xea60);continue;}_0x5677dc=this[_0x1041b8(0xcb)];let _0x28a028=_0x441d23[_0x1041b8(0xd3)]['getReader'](),_0x1c272b=new TextDecoder(),_0x1cf99e='';while(this[_0x1041b8(0xcf)]){let {done:_0xa9c45f,value:_0x51ce59}=await _0x28a028[_0x1041b8(0xfa)]();if(_0xa9c45f)break;_0x1cf99e+=_0x1c272b[_0x1041b8(0xd7)](_0x51ce59,{'stream':!0x0});let _0x585e37=_0x1cf99e[_0x1041b8(0x134)]('\x0a');_0x1cf99e=_0x585e37[_0x1041b8(0xd8)]()||'';for(let _0x2ea6c4 of _0x585e37){if(!_0x2ea6c4[_0x1041b8(0xd6)]('data:\x20'))continue;try{let _0x3bf1e6=JSON[_0x1041b8(0x132)](_0x2ea6c4['slice'](0x6));if(_0x3bf1e6[_0x1041b8(0xdb)]===_0x1041b8(0xca)){this['log'](_0x1041b8(0x138)),this[_0x1041b8(0x10e)](_0x1041b8(0xca));continue;}if(_0x3bf1e6['type']===_0x1041b8(0xf1)||_0x3bf1e6[_0x1041b8(0xdb)]===_0x1041b8(0x13c)||_0x3bf1e6[_0x1041b8(0xdb)]===_0x1041b8(0xd1))await this['processInbox']();}catch{}}}}catch(_0x165c7d){if(_0x165c7d[_0x1041b8(0xfe)]==='AbortError')break;this[_0x1041b8(0x10e)]('error',_0x165c7d),this[_0x1041b8(0xf0)](_0x1041b8(0x14a)+_0x165c7d[_0x1041b8(0x13a)]);}if(this['running'])this[_0x1041b8(0x10e)](_0x1041b8(0x122)),this[_0x1041b8(0xf0)](_0x1041b8(0x10a)+_0x5677dc/0x3e8+_0x1041b8(0x112)),await this[_0x1041b8(0x118)](_0x5677dc),_0x5677dc=Math[_0x1041b8(0xea)](_0x5677dc*1.5,0xea60);}}async[a0_0xb9de8(0xe7)](){const _0x6a1387=a0_0xb9de8;try{let _0x2dc1d3=(await this['call'](_0x6a1387(0xd2),{'alias':this['alias'],'limit':0xa}))?.[_0x6a1387(0x115)]||[];for(let _0x172480 of _0x2dc1d3)await this['call'](_0x6a1387(0xde),{'alias':this[_0x6a1387(0x14b)],'message_id':_0x172480['id']}),this[_0x6a1387(0xf0)]('←\x20'+_0x172480[_0x6a1387(0x13f)]+':\x20'+_0x172480['content'][_0x6a1387(0x147)](0x0,0x3c)),this[_0x6a1387(0x10e)](_0x6a1387(0xf6),_0x172480),this[_0x6a1387(0x10e)]('message',_0x172480);}catch(_0x1a7ce5){this[_0x6a1387(0xf0)](_0x6a1387(0xe4)+_0x1a7ce5[_0x6a1387(0x13a)]);}}[a0_0xb9de8(0x118)](_0x4e3c60){return new Promise(_0x49629c=>setTimeout(_0x49629c,_0x4e3c60));}}function a0_0x1a7b(){const _0x271624=['\x20lifecycle=','now','Bearer\x20','catch','task.replied','send_message','CommHub\x20rejected\x20task','error_code','4375557lOxQci','registered','connectSSE','networkId','to_alias','370kkzIqS','parse','heartbeat\x20failed:\x20','split','mcp_http','sdk-','\x20network_id=','SSE\x20connected','7CqvmpF','message','27610JNaRMO','new_message','status','1754RqidGe','from_session','transport','toString','stringify','heartbeatInterval','application/json','\x20error=','toAlias','slice','resumeId','<missing>','SSE\x20error:\x20','alias','24TrXYiK','POST','\x20parent_task_id=','1551640tszBmW','failed','task.send.delivered','2985544qEbvZS','connected','reconnectDelay','connect','idle','delivered','running','task.expired','broadcast','get_inbox','body','content','not_tracked','startsWith','decode','pop','/events/','autoConnect','type','disconnect','missing_task_id','ack_inbox','sseAbort','\x20from=','8359429hcIZgY','lifecycle_tracking','match','inbox\x20error:\x20','parent_task_id','signal','processInbox','CommHub\x20response\x20omitted\x20task_id','abort','min','12PuiGsT','send_failed','agent','<unknown>','json','log','new_task','text','[commhub:task]\x20','result','[REDACTED]','task','getAllStatus','parentTaskId','sdk','read','call','65516gmHqMs','task.ack','name','string','send_task','lifecycleTracking','492ovVnXv','duration_ms','/mcp','Authorization','unknown\x20error','normal','tools/call','<pending>','SSE\x20reconnecting\x20in\x20','send','\x20duration_ms=','sending','emit','message_id',']\x20[commhub:','from_alias','s...','6HMbWfH','token','messages','\x20to=','fromAlias','sleep','error_message','url','task_id','heartbeatTimer','get_all_status','cwd','application/json,\x20text/event-stream','task.send.failed','error','disconnected','replace'];a0_0x1a7b=function(){return _0x271624;};return a0_0x1a7b();}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};