@sleep2agi/agent-network 2.3.0-preview.234 → 2.3.0-preview.235
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.
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x589708=a0_0x26c6;function a0_0x26c6(_0xb527da,_0x110a68){_0xb527da=_0xb527da-0xc2;const _0x239709=a0_0x2397();let _0x26c63b=_0x239709[_0xb527da];return _0x26c63b;}(function(_0x2ec502,_0x2fb8dd){const _0x51e200=a0_0x26c6,_0x429e40=_0x2ec502();while(!![]){try{const _0x327bd0=parseInt(_0x51e200(0xcb))/0x1+-parseInt(_0x51e200(0x11f))/0x2*(-parseInt(_0x51e200(0xd9))/0x3)+parseInt(_0x51e200(0xd5))/0x4+parseInt(_0x51e200(0x12d))/0x5+parseInt(_0x51e200(0x114))/0x6*(-parseInt(_0x51e200(0x131))/0x7)+parseInt(_0x51e200(0xf2))/0x8+-parseInt(_0x51e200(0x119))/0x9;if(_0x327bd0===_0x2fb8dd)break;else _0x429e40['push'](_0x429e40['shift']());}catch(_0x190e0a){_0x429e40['push'](_0x429e40['shift']());}}}(a0_0x2397,0x8f538));import{EventEmitter as a0_0x35b66d}from'events';import{hostname as a0_0x4092be}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x14f1ce,_0x310c29)=>(_0x14f1ce??_0x310c29)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);function N(_0x2483c3){const _0x314ca6=a0_0x26c6;return(_0x2483c3 instanceof Error?_0x2483c3['message']:String(_0x2483c3??_0x314ca6(0xe1)))[_0x314ca6(0x127)](K,_0x314ca6(0x109))[_0x314ca6(0x127)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x314ca6(0x139)](0x0,0xf0);}function O(_0x597e2f,_0xf0002f=process.env.ANET_TASK_TRACE_FORMAT===a0_0x589708(0xfb)){const _0x4b8c8f=a0_0x589708;if(_0xf0002f)return JSON[_0x4b8c8f(0xc9)](_0x597e2f);let _0x5b493d=L(_0x597e2f[_0x4b8c8f(0xfa)],_0x4b8c8f(0xfd)),_0x501191=L(_0x597e2f[_0x4b8c8f(0x129)],_0x4b8c8f(0xc3)),_0x37f4cb=_0x597e2f[_0x4b8c8f(0xcc)]?'\x20error='+_0x597e2f['error_code']+':'+(_0x597e2f[_0x4b8c8f(0x12e)]??''):'';return _0x4b8c8f(0x136)+_0x597e2f[_0x4b8c8f(0xfc)]+_0x4b8c8f(0x13d)+L(_0x597e2f[_0x4b8c8f(0xc2)],_0x4b8c8f(0x103))+_0x4b8c8f(0x133)+L(_0x597e2f[_0x4b8c8f(0xe3)],_0x4b8c8f(0x103))+_0x4b8c8f(0x126)+_0x501191+'\x20parent_task_id='+_0x5b493d+_0x4b8c8f(0xd2)+L(_0x597e2f[_0x4b8c8f(0xf5)],_0x4b8c8f(0x103))+_0x4b8c8f(0xc7)+_0x597e2f[_0x4b8c8f(0x11e)]+_0x4b8c8f(0xd0)+_0x597e2f['duration_ms']+'\x20lifecycle='+_0x597e2f[_0x4b8c8f(0xe7)]+_0x37f4cb;}function U(_0x380ecf){const _0x152105=a0_0x589708;return{'event':{'sending':'task.send.start','delivered':_0x152105(0x105),'failed':'task.send.failed','acked':'task.ack','started':_0x152105(0x104),'replied':_0x152105(0xef),'expired':_0x152105(0xd4)}[_0x380ecf[_0x152105(0xfc)]],..._0x380ecf};}function j(_0x46d4c6){const _0x5e0fa3=a0_0x589708;let _0x1987b1=_0x46d4c6?.[_0x5e0fa3(0x129)]||_0x46d4c6?.['message_id']||_0x46d4c6?.['id'];if(_0x1987b1)return String(_0x1987b1);let _0x3286ea=_0x46d4c6?.[_0x5e0fa3(0x11a)]?.[0x0]?.['text'];if(typeof _0x3286ea!==_0x5e0fa3(0x12a))return null;try{let _0x1ff63f=JSON[_0x5e0fa3(0xd1)](_0x3286ea);return _0x1ff63f?.[_0x5e0fa3(0x129)]||_0x1ff63f?.[_0x5e0fa3(0x13f)]||_0x1ff63f?.['id']||null;}catch{return null;}}async function X(_0x308044,_0x1f3c75){const _0x2293ef=a0_0x589708;let _0x503423=_0x1f3c75[_0x2293ef(0xf0)]??Date['now'],_0x4f874a=_0x503423(),_0x209142=(_0x5e9319,_0x260d1f,_0x361841,_0x31be5d)=>{const _0x581665=_0x2293ef;_0x1f3c75['log'](O(U({'from_alias':_0x308044[_0x581665(0x11b)],'to_alias':_0x308044[_0x581665(0xdf)],'task_id':_0x260d1f,'parent_task_id':_0x308044[_0x581665(0x141)],'network_id':_0x308044['networkId'],'transport':_0x308044[_0x581665(0x11e)],'status':_0x5e9319,'duration_ms':_0x503423()-_0x4f874a,'lifecycle_tracking':_0x308044['lifecycleTracking'],..._0x361841!==void 0x0?{'error_code':_0x31be5d||_0x581665(0xe6),'error_message':N(_0x361841)}:{}})));};_0x209142(_0x2293ef(0x10b),null);try{let _0x109ba4=await _0x1f3c75[_0x2293ef(0x13b)](),_0x4f5d5f=j(_0x109ba4);if(_0x4f5d5f)_0x209142(_0x2293ef(0x10f),_0x4f5d5f);else{if(_0x109ba4?.['ok']===!0x1||_0x109ba4?.[_0x2293ef(0x132)])_0x209142(_0x2293ef(0x10c),_0x4f5d5f,_0x109ba4?.[_0x2293ef(0x132)]||_0x2293ef(0xea),_0x2293ef(0x110));else _0x209142(_0x2293ef(0x10c),null,_0x2293ef(0xc6),_0x2293ef(0xf9));}return _0x109ba4;}catch(_0x302839){throw _0x209142(_0x2293ef(0x10c),null,_0x302839,_0x2293ef(0xe6)),_0x302839;}}function a0_0x2397(){const _0x23aa6d=['send_rejected','running','get_inbox','match','216gmohxR','connected','url','2.0','log','15986997CTgNpz','content','fromAlias','disconnected','abort','transport','135484GmvDoI','ack_inbox','processInbox','connect','catch','mcp_http','split','\x20task_id=','replace','Bearer\x20','task_id','string','idle','sseAbort','2325180Esyqsa','error_message','message','sdk-','227514dGRpHW','error','\x20to=','not_tracked','/mcp','[commhub:task]\x20',']\x20[commhub:','inbox\x20error:\x20','slice','networkId','send','new_task','\x20from=','from_session','message_id','report_status','parentTaskId','from_alias','<pending>','emit','server','CommHub\x20response\x20omitted\x20task_id','\x20transport=','completed','stringify','send_reply','437250nxDVLc','error_code','heartbeatTimer','normal','decode','\x20duration_ms=','parse','\x20network_id=','toString','task.expired','1457640tZsZup','body','heartbeatInterval','toTimeString','51jTITcY','agent','tools/call','new_message','get_all_status','application/json,\x20text/event-stream','toAlias','text','unknown\x20error','resumeId','to_alias','heartbeat\x20failed:\x20','type','send_failed','lifecycle_tracking','send_task','reconnectDelay','CommHub\x20rejected\x20task','read','/events/','token','connectSSE','task.replied','now','text/event-stream','8921272DIdsBG','Authorization','SSE\x20error:\x20','network_id','autoConnect','startsWith','messages','missing_task_id','parent_task_id','json','status','<missing>','AbortError','disconnect','send_message','broadcast','call','<unknown>','task.started','task.send.delivered','SSE\x20connected','data:\x20','alias','[REDACTED]','offline','sending','failed','sleep','s...','delivered'];a0_0x2397=function(){return _0x23aa6d;};return a0_0x2397();}async function Y(_0x511e82,_0xd0eb47){const _0x123ab6=a0_0x589708;return X({'fromAlias':_0x511e82[_0x123ab6(0x11b)],'toAlias':_0x511e82[_0x123ab6(0x108)],'parentTaskId':_0x511e82['parentTaskId']||null,'networkId':_0x511e82[_0x123ab6(0x13a)]||null,'transport':_0x123ab6(0x124),'lifecycleTracking':_0x123ab6(0x134)},_0xd0eb47);}class $ extends a0_0x35b66d{[a0_0x589708(0x116)];[a0_0x589708(0x108)];[a0_0x589708(0xed)];['agent'];[a0_0x589708(0xe2)];['heartbeatInterval'];[a0_0x589708(0xe9)];[a0_0x589708(0xcd)];['sseAbort'];[a0_0x589708(0x111)]=!0x1;constructor(_0x273c4c){const _0x1332ff=a0_0x589708;super();if(this[_0x1332ff(0x116)]=_0x273c4c['url']['replace'](/\/$/,''),this['alias']=_0x273c4c[_0x1332ff(0x108)],this['token']=_0x273c4c[_0x1332ff(0xed)],this['agent']=_0x273c4c[_0x1332ff(0xda)]||'sdk',this[_0x1332ff(0xe2)]=_0x1332ff(0x130)+_0x273c4c[_0x1332ff(0x108)]+'-'+Date[_0x1332ff(0xf0)]()[_0x1332ff(0xd3)](0x24),this[_0x1332ff(0xd7)]=_0x273c4c[_0x1332ff(0xd7)]??0x2bf20,this[_0x1332ff(0xe9)]=_0x273c4c[_0x1332ff(0xe9)]??0xbb8,_0x273c4c[_0x1332ff(0xf6)]!==!0x1)this[_0x1332ff(0x122)]();}[a0_0x589708(0x118)](_0x1942ab){const _0x1aeb73=a0_0x589708;console[_0x1aeb73(0x118)]('['+new Date()[_0x1aeb73(0xd8)]()[_0x1aeb73(0x139)](0x0,0x8)+_0x1aeb73(0x137)+this[_0x1aeb73(0x108)]+']\x20'+_0x1942ab);}async[a0_0x589708(0x102)](_0x40c4f0,_0x46962a){const _0x4f9117=a0_0x589708;let _0x328d97={'Content-Type':'application/json','Accept':_0x4f9117(0xde)};if(this[_0x4f9117(0xed)])_0x328d97[_0x4f9117(0xf3)]=_0x4f9117(0x128)+this['token'];let _0x5c51e0=await(await fetch(this[_0x4f9117(0x116)]+_0x4f9117(0x135),{'method':'POST','headers':_0x328d97,'body':JSON[_0x4f9117(0xc9)]({'jsonrpc':_0x4f9117(0x117),'id':Date[_0x4f9117(0xf0)](),'method':_0x4f9117(0xdb),'params':{'name':_0x40c4f0,'arguments':_0x46962a}})}))[_0x4f9117(0xe0)](),_0x6381da=_0x5c51e0[_0x4f9117(0x113)](/data: (.+)/),_0x2c5bed=_0x6381da?JSON[_0x4f9117(0xd1)](_0x6381da[0x1]):JSON['parse'](_0x5c51e0),_0x5b7f3c=_0x2c5bed?.['result']?.[_0x4f9117(0x11a)]?.[0x0]?.[_0x4f9117(0xe0)];return _0x5b7f3c?JSON[_0x4f9117(0xd1)](_0x5b7f3c):_0x2c5bed;}async[a0_0x589708(0x122)](){const _0x53dedc=a0_0x589708;if(this['running'])return;this[_0x53dedc(0x111)]=!0x0,await this[_0x53dedc(0xfc)](_0x53dedc(0x12b)),this['log']('registered'),this[_0x53dedc(0xcd)]=setInterval(()=>{const _0x453310=_0x53dedc;this[_0x453310(0xfc)]('idle')[_0x453310(0x123)](_0x4f5596=>this[_0x453310(0x118)](_0x453310(0xe4)+_0x4f5596['message']));},this['heartbeatInterval']),this[_0x53dedc(0xee)]();}async[a0_0x589708(0xff)](){const _0xdb017e=a0_0x589708;if(this[_0xdb017e(0x111)]=!0x1,this[_0xdb017e(0x12c)]?.[_0xdb017e(0x11d)](),this[_0xdb017e(0xcd)])clearInterval(this[_0xdb017e(0xcd)]);await this[_0xdb017e(0xfc)](_0xdb017e(0x10a))[_0xdb017e(0x123)](()=>{}),this[_0xdb017e(0x118)](_0xdb017e(0x11c));}async[a0_0x589708(0x13b)](_0x2d3a8a,_0x8ebd7c,_0x56bf45=a0_0x589708(0xce)){const _0x3a9ae3=a0_0x589708;return Y({'alias':_0x2d3a8a,'fromAlias':this[_0x3a9ae3(0x108)]},{'log':_0x13dba0=>console[_0x3a9ae3(0x118)](_0x13dba0),'send':()=>this[_0x3a9ae3(0x102)](_0x3a9ae3(0xe8),{'alias':_0x2d3a8a,'task':_0x8ebd7c,'priority':_0x56bf45,'from_session':this['alias']})});}async[a0_0x589708(0x12f)](_0xfe6f84,_0x8b351){const _0x3c1059=a0_0x589708;return this[_0x3c1059(0x102)](_0x3c1059(0x100),{'alias':_0xfe6f84,'message':_0x8b351,'from_session':this[_0x3c1059(0x108)]});}async['reply'](_0x4c1723,_0x40ea0d,_0xed29c5=a0_0x589708(0xc8)){const _0x1671aa=a0_0x589708;return this[_0x1671aa(0x102)](_0x1671aa(0xca),{'in_reply_to':_0x4c1723,'text':_0x40ea0d,'status':_0xed29c5});}async[a0_0x589708(0xfc)](_0x5703c4,_0x19c94f){const _0x200529=a0_0x589708;return this[_0x200529(0x102)](_0x200529(0x140),{'resume_id':this[_0x200529(0xe2)],'alias':this['alias'],'status':_0x5703c4,'server':a0_0x4092be(),'hostname':a0_0x4092be(),'agent':this[_0x200529(0xda)],'project_dir':process['cwd'](),..._0x19c94f});}async['getAllStatus'](){const _0x4b48db=a0_0x589708;return this['call'](_0x4b48db(0xdd),{});}async[a0_0x589708(0x101)](_0x536e1b,_0x2642f1){const _0x303c53=a0_0x589708;return this[_0x303c53(0x102)]('broadcast',{'message':_0x536e1b,'filter_server':_0x2642f1?.[_0x303c53(0xc5)],'filter_status':_0x2642f1?.['status']});}async[a0_0x589708(0xee)](){const _0x1d23c1=a0_0x589708;let _0xbf160c=encodeURIComponent(this[_0x1d23c1(0x108)]),_0x32916b=this[_0x1d23c1(0x116)]+_0x1d23c1(0xec)+_0xbf160c,_0x324b50=this['reconnectDelay'];while(this[_0x1d23c1(0x111)]){try{this[_0x1d23c1(0x12c)]=new AbortController();let _0x50c163={'Accept':_0x1d23c1(0xf1)};if(this[_0x1d23c1(0xed)])_0x50c163[_0x1d23c1(0xf3)]=_0x1d23c1(0x128)+this[_0x1d23c1(0xed)];let _0x1ef180=await fetch(_0x32916b,{'headers':_0x50c163,'signal':this[_0x1d23c1(0x12c)]['signal']});if(!_0x1ef180['ok']||!_0x1ef180['body']){this['log']('SSE\x20failed:\x20'+_0x1ef180['status']),await this['sleep'](_0x324b50),_0x324b50=Math['min'](_0x324b50*1.5,0xea60);continue;}_0x324b50=this[_0x1d23c1(0xe9)];let _0x351110=_0x1ef180[_0x1d23c1(0xd6)]['getReader'](),_0x11713d=new TextDecoder(),_0x3b5a9f='';while(this[_0x1d23c1(0x111)]){let {done:_0x256ae4,value:_0x176399}=await _0x351110[_0x1d23c1(0xeb)]();if(_0x256ae4)break;_0x3b5a9f+=_0x11713d[_0x1d23c1(0xcf)](_0x176399,{'stream':!0x0});let _0x6ebc19=_0x3b5a9f[_0x1d23c1(0x125)]('\x0a');_0x3b5a9f=_0x6ebc19['pop']()||'';for(let _0x35b022 of _0x6ebc19){if(!_0x35b022[_0x1d23c1(0xf7)](_0x1d23c1(0x107)))continue;try{let _0x53e3e1=JSON[_0x1d23c1(0xd1)](_0x35b022['slice'](0x6));if(_0x53e3e1[_0x1d23c1(0xe5)]===_0x1d23c1(0x115)){this[_0x1d23c1(0x118)](_0x1d23c1(0x106)),this['emit'](_0x1d23c1(0x115));continue;}if(_0x53e3e1[_0x1d23c1(0xe5)]===_0x1d23c1(0x13c)||_0x53e3e1[_0x1d23c1(0xe5)]===_0x1d23c1(0xdc)||_0x53e3e1[_0x1d23c1(0xe5)]===_0x1d23c1(0x101))await this[_0x1d23c1(0x121)]();}catch{}}}}catch(_0x5462c7){if(_0x5462c7['name']===_0x1d23c1(0xfe))break;this[_0x1d23c1(0xc4)]('error',_0x5462c7),this[_0x1d23c1(0x118)](_0x1d23c1(0xf4)+_0x5462c7[_0x1d23c1(0x12f)]);}if(this[_0x1d23c1(0x111)])this[_0x1d23c1(0xc4)](_0x1d23c1(0x11c)),this['log']('SSE\x20reconnecting\x20in\x20'+_0x324b50/0x3e8+_0x1d23c1(0x10e)),await this[_0x1d23c1(0x10d)](_0x324b50),_0x324b50=Math['min'](_0x324b50*1.5,0xea60);}}async['processInbox'](){const _0x2c2608=a0_0x589708;try{let _0x42f725=(await this[_0x2c2608(0x102)](_0x2c2608(0x112),{'alias':this[_0x2c2608(0x108)],'limit':0xa}))?.[_0x2c2608(0xf8)]||[];for(let _0x3b0774 of _0x42f725)await this[_0x2c2608(0x102)](_0x2c2608(0x120),{'alias':this['alias'],'message_id':_0x3b0774['id']}),this[_0x2c2608(0x118)]('←\x20'+_0x3b0774[_0x2c2608(0x13e)]+':\x20'+_0x3b0774[_0x2c2608(0x11a)][_0x2c2608(0x139)](0x0,0x3c)),this['emit']('task',_0x3b0774),this[_0x2c2608(0xc4)](_0x2c2608(0x12f),_0x3b0774);}catch(_0x3082b7){this[_0x2c2608(0x118)](_0x2c2608(0x138)+_0x3082b7[_0x2c2608(0x12f)]);}}[a0_0x589708(0x10d)](_0x2dd25d){return new Promise(_0x2691de=>setTimeout(_0x2691de,_0x2dd25d));}}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x1c4ca7=a0_0x219d;(function(_0x5a0caf,_0x3a4cb7){const _0x2aabad=a0_0x219d,_0x19797c=_0x5a0caf();while(!![]){try{const _0x1674b7=-parseInt(_0x2aabad(0x142))/0x1*(parseInt(_0x2aabad(0x152))/0x2)+parseInt(_0x2aabad(0x14f))/0x3+parseInt(_0x2aabad(0x124))/0x4*(-parseInt(_0x2aabad(0x146))/0x5)+parseInt(_0x2aabad(0x150))/0x6+-parseInt(_0x2aabad(0x139))/0x7+-parseInt(_0x2aabad(0x177))/0x8*(-parseInt(_0x2aabad(0x115))/0x9)+parseInt(_0x2aabad(0x156))/0xa*(parseInt(_0x2aabad(0x106))/0xb);if(_0x1674b7===_0x3a4cb7)break;else _0x19797c['push'](_0x19797c['shift']());}catch(_0x9a9069){_0x19797c['push'](_0x19797c['shift']());}}}(a0_0x3094,0x9b936));import{EventEmitter as a0_0x33cc32}from'events';import{hostname as a0_0x21c79b}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x3bd04b,_0x5e4e86)=>(_0x3bd04b??_0x5e4e86)[a0_0x1c4ca7(0x103)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x1c4ca7(0x15b)](0x0,0xf0);function a0_0x3094(){const _0x31d4e2=['missing_task_id','connected','connectSSE','duration_ms','sleep','Authorization','1173069xoueRO','117390TbsLEV','disconnected','101746NRbaeJ',']\x20[commhub:','log','emit','10yXbsOK','status','content','min','task.send.failed','slice','[commhub:task]\x20','registered','unknown\x20error','resumeId','\x20to=','getAllStatus','send_reply','ack_inbox','CommHub\x20response\x20omitted\x20task_id','task.send.delivered','failed','/mcp','report_status','not_tracked','read','get_inbox','reconnectDelay','from_alias','parentTaskId','running','completed','text','data:\x20','\x20duration_ms=','application/json,\x20text/event-stream','alias','pop','8456bluLzh','task.expired','mcp_http','split','message','send_message','lifecycleTracking','task.ack','reply','error','<unknown>','SSE\x20connected','task','text/event-stream','lifecycle_tracking','SSE\x20error:\x20','network_id','s...','getReader','replace','sseAbort','CommHub\x20rejected\x20task','14914273CNGNpR','token','heartbeat\x20failed:\x20','type','offline','cwd','application/json','task_id','\x20parent_task_id=','server','\x20network_id=','json','error_code','disconnect','\x20lifecycle=','2727vWDKmv','agent','get_all_status','now','task.replied','inbox\x20error:\x20','url','2.0','transport','result','toString','send_rejected','sdk-','new_message','send','2468iHPQjz','networkId','SSE\x20failed:\x20','stringify','idle','delivered','error_message','Bearer\x20','sdk','heartbeatInterval','match','send_failed','heartbeatTimer','abort','call','toTimeString','autoConnect','<missing>','decode','normal','catch','1581370fEXJCA','task.send.start','fromAlias','\x20transport=','\x20from=','[REDACTED]','/events/','broadcast','sending','9NLzXNz','connect','signal','\x20task_id=','6205NMoIUu','SSE\x20reconnecting\x20in\x20','parse'];a0_0x3094=function(){return _0x31d4e2;};return a0_0x3094();}function N(_0x4e46b1){const _0x5a0d5e=a0_0x1c4ca7;return(_0x4e46b1 instanceof Error?_0x4e46b1[_0x5a0d5e(0x17b)]:String(_0x4e46b1??_0x5a0d5e(0x15e)))[_0x5a0d5e(0x103)](K,_0x5a0d5e(0x13e))[_0x5a0d5e(0x103)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function O(_0x134ded,_0x46e688=process.env.ANET_TASK_TRACE_FORMAT===a0_0x1c4ca7(0x111)){const _0x13741a=a0_0x1c4ca7;if(_0x46e688)return JSON[_0x13741a(0x127)](_0x134ded);let _0x11c527=L(_0x134ded['parent_task_id'],_0x13741a(0x135)),_0x41404f=L(_0x134ded[_0x13741a(0x10d)],'<pending>'),_0x3fbf73=_0x134ded['error_code']?'\x20error='+_0x134ded[_0x13741a(0x112)]+':'+(_0x134ded[_0x13741a(0x12a)]??''):'';return _0x13741a(0x15c)+_0x134ded[_0x13741a(0x157)]+_0x13741a(0x13d)+L(_0x134ded[_0x13741a(0x16d)],_0x13741a(0xfa))+_0x13741a(0x160)+L(_0x134ded['to_alias'],_0x13741a(0xfa))+_0x13741a(0x145)+_0x41404f+_0x13741a(0x10e)+_0x11c527+_0x13741a(0x110)+L(_0x134ded[_0x13741a(0x100)],_0x13741a(0xfa))+_0x13741a(0x13c)+_0x134ded[_0x13741a(0x11d)]+_0x13741a(0x173)+_0x134ded[_0x13741a(0x14c)]+_0x13741a(0x114)+_0x134ded[_0x13741a(0xfe)]+_0x3fbf73;}function U(_0xf67739){const _0x3a8b33=a0_0x1c4ca7;return{'event':{'sending':_0x3a8b33(0x13a),'delivered':_0x3a8b33(0x165),'failed':_0x3a8b33(0x15a),'acked':_0x3a8b33(0x17e),'started':'task.started','replied':_0x3a8b33(0x119),'expired':_0x3a8b33(0x178)}[_0xf67739[_0x3a8b33(0x157)]],..._0xf67739};}function j(_0xcda25f){const _0x1b06d4=a0_0x1c4ca7;let _0x19b9f5=_0xcda25f?.[_0x1b06d4(0x10d)]||_0xcda25f?.['message_id']||_0xcda25f?.['id'];if(_0x19b9f5)return String(_0x19b9f5);let _0xf60af1=_0xcda25f?.[_0x1b06d4(0x158)]?.[0x0]?.[_0x1b06d4(0x171)];if(typeof _0xf60af1!=='string')return null;try{let _0x358737=JSON['parse'](_0xf60af1);return _0x358737?.['task_id']||_0x358737?.['message_id']||_0x358737?.['id']||null;}catch{return null;}}async function X(_0x37a089,_0x1097e0){const _0x2e8e25=a0_0x1c4ca7;let _0x1e6d5d=_0x1097e0[_0x2e8e25(0x118)]??Date[_0x2e8e25(0x118)],_0x404a8c=_0x1e6d5d(),_0x46466d=(_0x237728,_0x2dce33,_0x1b7831,_0x30f151)=>{const _0x262c9c=_0x2e8e25;_0x1097e0['log'](O(U({'from_alias':_0x37a089[_0x262c9c(0x13b)],'to_alias':_0x37a089['toAlias'],'task_id':_0x2dce33,'parent_task_id':_0x37a089[_0x262c9c(0x16e)],'network_id':_0x37a089[_0x262c9c(0x125)],'transport':_0x37a089[_0x262c9c(0x11d)],'status':_0x237728,'duration_ms':_0x1e6d5d()-_0x404a8c,'lifecycle_tracking':_0x37a089[_0x262c9c(0x17d)],..._0x1b7831!==void 0x0?{'error_code':_0x30f151||_0x262c9c(0x12f),'error_message':N(_0x1b7831)}:{}})));};_0x46466d(_0x2e8e25(0x141),null);try{let _0x1011c6=await _0x1097e0[_0x2e8e25(0x123)](),_0x48ef4e=j(_0x1011c6);if(_0x48ef4e)_0x46466d(_0x2e8e25(0x129),_0x48ef4e);else{if(_0x1011c6?.['ok']===!0x1||_0x1011c6?.[_0x2e8e25(0x180)])_0x46466d(_0x2e8e25(0x166),_0x48ef4e,_0x1011c6?.[_0x2e8e25(0x180)]||_0x2e8e25(0x105),_0x2e8e25(0x120));else _0x46466d(_0x2e8e25(0x166),null,_0x2e8e25(0x164),_0x2e8e25(0x149));}return _0x1011c6;}catch(_0x4e0850){throw _0x46466d(_0x2e8e25(0x166),null,_0x4e0850,_0x2e8e25(0x12f)),_0x4e0850;}}async function Y(_0x4bc143,_0x5c1622){const _0x4a73c8=a0_0x1c4ca7;return X({'fromAlias':_0x4bc143['fromAlias'],'toAlias':_0x4bc143['alias'],'parentTaskId':_0x4bc143[_0x4a73c8(0x16e)]||null,'networkId':_0x4bc143[_0x4a73c8(0x125)]||null,'transport':_0x4a73c8(0x179),'lifecycleTracking':_0x4a73c8(0x169)},_0x5c1622);}class $ extends a0_0x33cc32{[a0_0x1c4ca7(0x11b)];[a0_0x1c4ca7(0x175)];[a0_0x1c4ca7(0x107)];['agent'];[a0_0x1c4ca7(0x15f)];[a0_0x1c4ca7(0x12d)];[a0_0x1c4ca7(0x16c)];['heartbeatTimer'];['sseAbort'];[a0_0x1c4ca7(0x16f)]=!0x1;constructor(_0x377534){const _0x141723=a0_0x1c4ca7;super();if(this[_0x141723(0x11b)]=_0x377534[_0x141723(0x11b)][_0x141723(0x103)](/\/$/,''),this[_0x141723(0x175)]=_0x377534[_0x141723(0x175)],this[_0x141723(0x107)]=_0x377534[_0x141723(0x107)],this[_0x141723(0x116)]=_0x377534[_0x141723(0x116)]||_0x141723(0x12c),this[_0x141723(0x15f)]=_0x141723(0x121)+_0x377534['alias']+'-'+Date['now']()[_0x141723(0x11f)](0x24),this['heartbeatInterval']=_0x377534[_0x141723(0x12d)]??0x2bf20,this[_0x141723(0x16c)]=_0x377534[_0x141723(0x16c)]??0xbb8,_0x377534[_0x141723(0x134)]!==!0x1)this[_0x141723(0x143)]();}[a0_0x1c4ca7(0x154)](_0x1db7ef){const _0x2865df=a0_0x1c4ca7;console[_0x2865df(0x154)]('['+new Date()[_0x2865df(0x133)]()[_0x2865df(0x15b)](0x0,0x8)+_0x2865df(0x153)+this[_0x2865df(0x175)]+']\x20'+_0x1db7ef);}async[a0_0x1c4ca7(0x132)](_0x136081,_0x9c5301){const _0x5833b3=a0_0x1c4ca7;let _0x4b925b={'Content-Type':_0x5833b3(0x10c),'Accept':_0x5833b3(0x174)};if(this['token'])_0x4b925b[_0x5833b3(0x14e)]=_0x5833b3(0x12b)+this[_0x5833b3(0x107)];let _0x56cba5=await(await fetch(this['url']+_0x5833b3(0x167),{'method':'POST','headers':_0x4b925b,'body':JSON['stringify']({'jsonrpc':_0x5833b3(0x11c),'id':Date[_0x5833b3(0x118)](),'method':'tools/call','params':{'name':_0x136081,'arguments':_0x9c5301}})}))[_0x5833b3(0x171)](),_0x4f1cc8=_0x56cba5[_0x5833b3(0x12e)](/data: (.+)/),_0x1c2c9d=_0x4f1cc8?JSON[_0x5833b3(0x148)](_0x4f1cc8[0x1]):JSON['parse'](_0x56cba5),_0x5cbb9b=_0x1c2c9d?.[_0x5833b3(0x11e)]?.['content']?.[0x0]?.[_0x5833b3(0x171)];return _0x5cbb9b?JSON[_0x5833b3(0x148)](_0x5cbb9b):_0x1c2c9d;}async[a0_0x1c4ca7(0x143)](){const _0x411d56=a0_0x1c4ca7;if(this['running'])return;this['running']=!0x0,await this['status'](_0x411d56(0x128)),this[_0x411d56(0x154)](_0x411d56(0x15d)),this[_0x411d56(0x130)]=setInterval(()=>{const _0x2e5219=_0x411d56;this[_0x2e5219(0x157)](_0x2e5219(0x128))[_0x2e5219(0x138)](_0x4ac13d=>this['log'](_0x2e5219(0x108)+_0x4ac13d[_0x2e5219(0x17b)]));},this[_0x411d56(0x12d)]),this[_0x411d56(0x14b)]();}async[a0_0x1c4ca7(0x113)](){const _0x5bfd40=a0_0x1c4ca7;if(this['running']=!0x1,this['sseAbort']?.[_0x5bfd40(0x131)](),this[_0x5bfd40(0x130)])clearInterval(this['heartbeatTimer']);await this[_0x5bfd40(0x157)](_0x5bfd40(0x10a))[_0x5bfd40(0x138)](()=>{}),this[_0x5bfd40(0x154)](_0x5bfd40(0x151));}async['send'](_0x30d796,_0x3bd242,_0x50de89=a0_0x1c4ca7(0x137)){const _0x23483a=a0_0x1c4ca7;return Y({'alias':_0x30d796,'fromAlias':this[_0x23483a(0x175)]},{'log':_0x3256aa=>console[_0x23483a(0x154)](_0x3256aa),'send':()=>this[_0x23483a(0x132)]('send_task',{'alias':_0x30d796,'task':_0x3bd242,'priority':_0x50de89,'from_session':this[_0x23483a(0x175)]})});}async['message'](_0x527860,_0x3cd4a5){const _0x5d544b=a0_0x1c4ca7;return this[_0x5d544b(0x132)](_0x5d544b(0x17c),{'alias':_0x527860,'message':_0x3cd4a5,'from_session':this[_0x5d544b(0x175)]});}async[a0_0x1c4ca7(0x17f)](_0x49d62e,_0x521343,_0x491ccc=a0_0x1c4ca7(0x170)){const _0x55400=a0_0x1c4ca7;return this[_0x55400(0x132)](_0x55400(0x162),{'in_reply_to':_0x49d62e,'text':_0x521343,'status':_0x491ccc});}async[a0_0x1c4ca7(0x157)](_0x3f6a46,_0x256a63){const _0x4f43f7=a0_0x1c4ca7;return this[_0x4f43f7(0x132)](_0x4f43f7(0x168),{'resume_id':this['resumeId'],'alias':this[_0x4f43f7(0x175)],'status':_0x3f6a46,'server':a0_0x21c79b(),'hostname':a0_0x21c79b(),'agent':this[_0x4f43f7(0x116)],'project_dir':process[_0x4f43f7(0x10b)](),..._0x256a63});}async[a0_0x1c4ca7(0x161)](){const _0x751a79=a0_0x1c4ca7;return this[_0x751a79(0x132)](_0x751a79(0x117),{});}async['broadcast'](_0x3e3c3d,_0x441df4){const _0xdf2ec=a0_0x1c4ca7;return this['call'](_0xdf2ec(0x140),{'message':_0x3e3c3d,'filter_server':_0x441df4?.[_0xdf2ec(0x10f)],'filter_status':_0x441df4?.[_0xdf2ec(0x157)]});}async[a0_0x1c4ca7(0x14b)](){const _0x5e154b=a0_0x1c4ca7;let _0x5f5604=encodeURIComponent(this[_0x5e154b(0x175)]),_0x424965=this[_0x5e154b(0x11b)]+_0x5e154b(0x13f)+_0x5f5604,_0x46f289=this[_0x5e154b(0x16c)];while(this['running']){try{this['sseAbort']=new AbortController();let _0x2677ac={'Accept':_0x5e154b(0xfd)};if(this['token'])_0x2677ac[_0x5e154b(0x14e)]='Bearer\x20'+this[_0x5e154b(0x107)];let _0x1d2e2b=await fetch(_0x424965,{'headers':_0x2677ac,'signal':this[_0x5e154b(0x104)][_0x5e154b(0x144)]});if(!_0x1d2e2b['ok']||!_0x1d2e2b['body']){this[_0x5e154b(0x154)](_0x5e154b(0x126)+_0x1d2e2b[_0x5e154b(0x157)]),await this[_0x5e154b(0x14d)](_0x46f289),_0x46f289=Math[_0x5e154b(0x159)](_0x46f289*1.5,0xea60);continue;}_0x46f289=this['reconnectDelay'];let _0x4bfa8f=_0x1d2e2b['body'][_0x5e154b(0x102)](),_0x3afc04=new TextDecoder(),_0x50e853='';while(this[_0x5e154b(0x16f)]){let {done:_0xae75d4,value:_0x3b35ef}=await _0x4bfa8f[_0x5e154b(0x16a)]();if(_0xae75d4)break;_0x50e853+=_0x3afc04[_0x5e154b(0x136)](_0x3b35ef,{'stream':!0x0});let _0x1bd74c=_0x50e853[_0x5e154b(0x17a)]('\x0a');_0x50e853=_0x1bd74c[_0x5e154b(0x176)]()||'';for(let _0x51abe7 of _0x1bd74c){if(!_0x51abe7['startsWith'](_0x5e154b(0x172)))continue;try{let _0x365b48=JSON[_0x5e154b(0x148)](_0x51abe7[_0x5e154b(0x15b)](0x6));if(_0x365b48[_0x5e154b(0x109)]==='connected'){this[_0x5e154b(0x154)](_0x5e154b(0xfb)),this[_0x5e154b(0x155)](_0x5e154b(0x14a));continue;}if(_0x365b48[_0x5e154b(0x109)]==='new_task'||_0x365b48['type']===_0x5e154b(0x122)||_0x365b48['type']==='broadcast')await this['processInbox']();}catch{}}}}catch(_0x2f129a){if(_0x2f129a['name']==='AbortError')break;this[_0x5e154b(0x155)]('error',_0x2f129a),this[_0x5e154b(0x154)](_0x5e154b(0xff)+_0x2f129a['message']);}if(this[_0x5e154b(0x16f)])this[_0x5e154b(0x155)]('disconnected'),this[_0x5e154b(0x154)](_0x5e154b(0x147)+_0x46f289/0x3e8+_0x5e154b(0x101)),await this[_0x5e154b(0x14d)](_0x46f289),_0x46f289=Math[_0x5e154b(0x159)](_0x46f289*1.5,0xea60);}}async['processInbox'](){const _0x315c9e=a0_0x1c4ca7;try{let _0x295b72=(await this[_0x315c9e(0x132)](_0x315c9e(0x16b),{'alias':this[_0x315c9e(0x175)],'limit':0xa}))?.['messages']||[];for(let _0x797ffd of _0x295b72)await this[_0x315c9e(0x132)](_0x315c9e(0x163),{'alias':this[_0x315c9e(0x175)],'message_id':_0x797ffd['id']}),this['log']('←\x20'+_0x797ffd['from_session']+':\x20'+_0x797ffd['content'][_0x315c9e(0x15b)](0x0,0x3c)),this[_0x315c9e(0x155)](_0x315c9e(0xfc),_0x797ffd),this[_0x315c9e(0x155)](_0x315c9e(0x17b),_0x797ffd);}catch(_0x396971){this['log'](_0x315c9e(0x11a)+_0x396971[_0x315c9e(0x17b)]);}}['sleep'](_0x487cbe){return new Promise(_0x2c02ae=>setTimeout(_0x2c02ae,_0x487cbe));}}function a0_0x219d(_0x5c9f87,_0x56a145){_0x5c9f87=_0x5c9f87-0xfa;const _0x30942b=a0_0x3094();let _0x219d62=_0x30942b[_0x5c9f87];return _0x219d62;}var F=$;export{F as default,$ as CommHub};
|