@sleep2agi/agent-network 2.3.0-preview.205 → 2.3.0-preview.206
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_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_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};
|