@sleep2agi/agent-network 2.3.0-preview.242 → 2.3.0-preview.243
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_0x566e4c=a0_0x22d8;(function(_0x1c3c53,_0x38c0ba){const _0x23d810=a0_0x22d8,_0x43d618=_0x1c3c53();while(!![]){try{const _0x3e4070=-parseInt(_0x23d810(0x108))/0x1+parseInt(_0x23d810(0x13d))/0x2+-parseInt(_0x23d810(0x135))/0x3*(parseInt(_0x23d810(0x119))/0x4)+-parseInt(_0x23d810(0x178))/0x5*(-parseInt(_0x23d810(0x12f))/0x6)+parseInt(_0x23d810(0x130))/0x7+parseInt(_0x23d810(0x12d))/0x8+parseInt(_0x23d810(0x11e))/0x9*(-parseInt(_0x23d810(0x14e))/0xa);if(_0x3e4070===_0x38c0ba)break;else _0x43d618['push'](_0x43d618['shift']());}catch(_0x51b5e7){_0x43d618['push'](_0x43d618['shift']());}}}(a0_0x1968,0xbb6cc));import{EventEmitter as a0_0x281258}from'events';import{hostname as a0_0x487300}from'os';function a0_0x22d8(_0xea7eef,_0x20f4bd){_0xea7eef=_0xea7eef-0x102;const _0x196856=a0_0x1968();let _0x22d88c=_0x196856[_0xea7eef];return _0x22d88c;}var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x43ff79,_0x5c38b8)=>(_0x43ff79??_0x5c38b8)[a0_0x566e4c(0x132)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x566e4c(0x114)](0x0,0xf0);function N(_0x2502e2){const _0x2c54f6=a0_0x566e4c;return(_0x2502e2 instanceof Error?_0x2502e2[_0x2c54f6(0x11d)]:String(_0x2502e2??_0x2c54f6(0x14d)))[_0x2c54f6(0x132)](K,_0x2c54f6(0x113))[_0x2c54f6(0x132)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x2c54f6(0x114)](0x0,0xf0);}function O(_0x160896,_0x3e5729=process.env.ANET_TASK_TRACE_FORMAT===a0_0x566e4c(0x184)){const _0x4fa5a2=a0_0x566e4c;if(_0x3e5729)return JSON[_0x4fa5a2(0x153)](_0x160896);let _0x2a9c3f=L(_0x160896[_0x4fa5a2(0x17f)],_0x4fa5a2(0x16f)),_0x3abe31=L(_0x160896[_0x4fa5a2(0x185)],'<pending>'),_0x3625df=_0x160896[_0x4fa5a2(0x140)]?_0x4fa5a2(0x165)+_0x160896[_0x4fa5a2(0x140)]+':'+(_0x160896[_0x4fa5a2(0x169)]??''):'';return'[commhub:task]\x20'+_0x160896[_0x4fa5a2(0x148)]+'\x20from='+L(_0x160896['from_alias'],_0x4fa5a2(0x180))+'\x20to='+L(_0x160896[_0x4fa5a2(0x10e)],_0x4fa5a2(0x180))+_0x4fa5a2(0x171)+_0x3abe31+_0x4fa5a2(0x16a)+_0x2a9c3f+_0x4fa5a2(0x174)+L(_0x160896['network_id'],_0x4fa5a2(0x180))+_0x4fa5a2(0x15a)+_0x160896[_0x4fa5a2(0x183)]+_0x4fa5a2(0x18c)+_0x160896[_0x4fa5a2(0x104)]+_0x4fa5a2(0x17c)+_0x160896[_0x4fa5a2(0x187)]+_0x3625df;}function U(_0x35d7ed){const _0x3fc497=a0_0x566e4c;return{'event':{'sending':_0x3fc497(0x10f),'delivered':_0x3fc497(0x151),'failed':_0x3fc497(0x128),'acked':_0x3fc497(0x162),'started':_0x3fc497(0x134),'replied':_0x3fc497(0x11b),'expired':_0x3fc497(0x155)}[_0x35d7ed['status']],..._0x35d7ed};}function j(_0x59c984){const _0xc14c37=a0_0x566e4c;let _0x280017=_0x59c984?.[_0xc14c37(0x185)]||_0x59c984?.['message_id']||_0x59c984?.['id'];if(_0x280017)return String(_0x280017);let _0xce0281=_0x59c984?.[_0xc14c37(0x103)]?.[0x0]?.[_0xc14c37(0x177)];if(typeof _0xce0281!==_0xc14c37(0x102))return null;try{let _0x312dd5=JSON[_0xc14c37(0x133)](_0xce0281);return _0x312dd5?.[_0xc14c37(0x185)]||_0x312dd5?.[_0xc14c37(0x186)]||_0x312dd5?.['id']||null;}catch{return null;}}async function X(_0x2b256,_0xb8a151){const _0x169086=a0_0x566e4c;let _0x16b5a7=_0xb8a151[_0x169086(0x149)]??Date[_0x169086(0x149)],_0x1f5d0d=_0x16b5a7(),_0x26aa8b=(_0x6d588b,_0x1bedfa,_0x501026,_0x43e13f)=>{const _0x1b969c=_0x169086;_0xb8a151[_0x1b969c(0x107)](O(U({'from_alias':_0x2b256[_0x1b969c(0x163)],'to_alias':_0x2b256[_0x1b969c(0x175)],'task_id':_0x1bedfa,'parent_task_id':_0x2b256[_0x1b969c(0x112)],'network_id':_0x2b256['networkId'],'transport':_0x2b256[_0x1b969c(0x183)],'status':_0x6d588b,'duration_ms':_0x16b5a7()-_0x1f5d0d,'lifecycle_tracking':_0x2b256[_0x1b969c(0x118)],..._0x501026!==void 0x0?{'error_code':_0x43e13f||'send_failed','error_message':N(_0x501026)}:{}})));};_0x26aa8b(_0x169086(0x15f),null);try{let _0x46dbb0=await _0xb8a151[_0x169086(0x14f)](),_0x332ffa=j(_0x46dbb0);if(_0x332ffa)_0x26aa8b(_0x169086(0x10c),_0x332ffa);else{if(_0x46dbb0?.['ok']===!0x1||_0x46dbb0?.[_0x169086(0x12b)])_0x26aa8b(_0x169086(0x116),_0x332ffa,_0x46dbb0?.['error']||_0x169086(0x10b),'send_rejected');else _0x26aa8b(_0x169086(0x116),null,_0x169086(0x16e),_0x169086(0x12c));}return _0x46dbb0;}catch(_0x2a767d){throw _0x26aa8b(_0x169086(0x116),null,_0x2a767d,_0x169086(0x13a)),_0x2a767d;}}async function Y(_0x51ea43,_0x48ac51){const _0x4c4266=a0_0x566e4c;return X({'fromAlias':_0x51ea43[_0x4c4266(0x163)],'toAlias':_0x51ea43[_0x4c4266(0x14a)],'parentTaskId':_0x51ea43['parentTaskId']||null,'networkId':_0x51ea43[_0x4c4266(0x15d)]||null,'transport':_0x4c4266(0x17b),'lifecycleTracking':_0x4c4266(0x154)},_0x48ac51);}class $ extends a0_0x281258{[a0_0x566e4c(0x17d)];[a0_0x566e4c(0x14a)];[a0_0x566e4c(0x13b)];[a0_0x566e4c(0x176)];[a0_0x566e4c(0x181)];[a0_0x566e4c(0x106)];[a0_0x566e4c(0x11a)];['heartbeatTimer'];[a0_0x566e4c(0x189)];[a0_0x566e4c(0x13c)]=!0x1;constructor(_0x5602e8){const _0x483722=a0_0x566e4c;super();if(this[_0x483722(0x17d)]=_0x5602e8[_0x483722(0x17d)]['replace'](/\/$/,''),this[_0x483722(0x14a)]=_0x5602e8[_0x483722(0x14a)],this[_0x483722(0x13b)]=_0x5602e8[_0x483722(0x13b)],this[_0x483722(0x176)]=_0x5602e8[_0x483722(0x176)]||_0x483722(0x18a),this[_0x483722(0x181)]='sdk-'+_0x5602e8[_0x483722(0x14a)]+'-'+Date['now']()[_0x483722(0x126)](0x24),this[_0x483722(0x106)]=_0x5602e8[_0x483722(0x106)]??0x2bf20,this[_0x483722(0x11a)]=_0x5602e8[_0x483722(0x11a)]??0xbb8,_0x5602e8[_0x483722(0x12a)]!==!0x1)this[_0x483722(0x127)]();}[a0_0x566e4c(0x107)](_0x227440){const _0x28730d=a0_0x566e4c;console[_0x28730d(0x107)]('['+new Date()[_0x28730d(0x147)]()['slice'](0x0,0x8)+_0x28730d(0x150)+this[_0x28730d(0x14a)]+']\x20'+_0x227440);}async[a0_0x566e4c(0x14c)](_0x1f564e,_0x387f97){const _0x5c50e1=a0_0x566e4c;let _0xc7cdee={'Content-Type':_0x5c50e1(0x143),'Accept':_0x5c50e1(0x13e)};if(this[_0x5c50e1(0x13b)])_0xc7cdee[_0x5c50e1(0x159)]='Bearer\x20'+this[_0x5c50e1(0x13b)];let _0x9606a2=await(await fetch(this[_0x5c50e1(0x17d)]+_0x5c50e1(0x161),{'method':_0x5c50e1(0x157),'headers':_0xc7cdee,'body':JSON[_0x5c50e1(0x153)]({'jsonrpc':_0x5c50e1(0x173),'id':Date[_0x5c50e1(0x149)](),'method':_0x5c50e1(0x166),'params':{'name':_0x1f564e,'arguments':_0x387f97}})}))[_0x5c50e1(0x177)](),_0x2dea5b=_0x9606a2[_0x5c50e1(0x15c)](/data: (.+)/),_0x57cb6a=_0x2dea5b?JSON[_0x5c50e1(0x133)](_0x2dea5b[0x1]):JSON[_0x5c50e1(0x133)](_0x9606a2),_0x5a1408=_0x57cb6a?.[_0x5c50e1(0x182)]?.[_0x5c50e1(0x103)]?.[0x0]?.[_0x5c50e1(0x177)];return _0x5a1408?JSON[_0x5c50e1(0x133)](_0x5a1408):_0x57cb6a;}async[a0_0x566e4c(0x127)](){const _0x2935fa=a0_0x566e4c;if(this[_0x2935fa(0x13c)])return;this[_0x2935fa(0x13c)]=!0x0,await this[_0x2935fa(0x148)](_0x2935fa(0x158)),this['log'](_0x2935fa(0x120)),this[_0x2935fa(0x188)]=setInterval(()=>{const _0x3264cb=_0x2935fa;this[_0x3264cb(0x148)](_0x3264cb(0x158))[_0x3264cb(0x164)](_0x127e4a=>this['log'](_0x3264cb(0x15b)+_0x127e4a[_0x3264cb(0x11d)]));},this[_0x2935fa(0x106)]),this['connectSSE']();}async[a0_0x566e4c(0x138)](){const _0x1cd496=a0_0x566e4c;if(this[_0x1cd496(0x13c)]=!0x1,this[_0x1cd496(0x189)]?.[_0x1cd496(0x117)](),this[_0x1cd496(0x188)])clearInterval(this[_0x1cd496(0x188)]);await this[_0x1cd496(0x148)](_0x1cd496(0x15e))[_0x1cd496(0x164)](()=>{}),this[_0x1cd496(0x107)](_0x1cd496(0x16c));}async['send'](_0x2e38c1,_0x1f6206,_0x49d114=a0_0x566e4c(0x121)){const _0x1a60b8=a0_0x566e4c;return Y({'alias':_0x2e38c1,'fromAlias':this['alias']},{'log':_0x2ffcf6=>console[_0x1a60b8(0x107)](_0x2ffcf6),'send':()=>this[_0x1a60b8(0x14c)](_0x1a60b8(0x109),{'alias':_0x2e38c1,'task':_0x1f6206,'priority':_0x49d114,'from_session':this[_0x1a60b8(0x14a)]})});}async[a0_0x566e4c(0x11d)](_0x3bb6be,_0x5e1feb){const _0x33a9e4=a0_0x566e4c;return this[_0x33a9e4(0x14c)](_0x33a9e4(0x146),{'alias':_0x3bb6be,'message':_0x5e1feb,'from_session':this['alias']});}async[a0_0x566e4c(0x139)](_0x2f2a36,_0x202e80,_0x9e075f=a0_0x566e4c(0x115)){const _0x4a536e=a0_0x566e4c;return this[_0x4a536e(0x14c)](_0x4a536e(0x136),{'in_reply_to':_0x2f2a36,'text':_0x202e80,'status':_0x9e075f});}async[a0_0x566e4c(0x148)](_0x2a4260,_0x18c0cc){const _0x293184=a0_0x566e4c;return this[_0x293184(0x14c)](_0x293184(0x12e),{'resume_id':this[_0x293184(0x181)],'alias':this[_0x293184(0x14a)],'status':_0x2a4260,'server':a0_0x487300(),'hostname':a0_0x487300(),'agent':this[_0x293184(0x176)],'project_dir':process['cwd'](),..._0x18c0cc});}async[a0_0x566e4c(0x17e)](){const _0x185189=a0_0x566e4c;return this[_0x185189(0x14c)]('get_all_status',{});}async[a0_0x566e4c(0x14b)](_0x1c83f6,_0x18b3ac){const _0x4f55dd=a0_0x566e4c;return this[_0x4f55dd(0x14c)](_0x4f55dd(0x14b),{'message':_0x1c83f6,'filter_server':_0x18b3ac?.[_0x4f55dd(0x18d)],'filter_status':_0x18b3ac?.['status']});}async[a0_0x566e4c(0x11c)](){const _0x4bdc6d=a0_0x566e4c;let _0xb40063=encodeURIComponent(this['alias']),_0x5d5fd4=this['url']+_0x4bdc6d(0x122)+_0xb40063,_0x1fe9a1=this[_0x4bdc6d(0x11a)];while(this['running']){try{this[_0x4bdc6d(0x189)]=new AbortController();let _0x3ab9c4={'Accept':_0x4bdc6d(0x16b)};if(this[_0x4bdc6d(0x13b)])_0x3ab9c4[_0x4bdc6d(0x159)]=_0x4bdc6d(0x167)+this[_0x4bdc6d(0x13b)];let _0x58e150=await fetch(_0x5d5fd4,{'headers':_0x3ab9c4,'signal':this['sseAbort']['signal']});if(!_0x58e150['ok']||!_0x58e150[_0x4bdc6d(0x144)]){this[_0x4bdc6d(0x107)](_0x4bdc6d(0x123)+_0x58e150['status']),await this[_0x4bdc6d(0x10a)](_0x1fe9a1),_0x1fe9a1=Math[_0x4bdc6d(0x11f)](_0x1fe9a1*1.5,0xea60);continue;}_0x1fe9a1=this[_0x4bdc6d(0x11a)];let _0x2b8169=_0x58e150['body'][_0x4bdc6d(0x156)](),_0x336aaa=new TextDecoder(),_0x2eef60='';while(this[_0x4bdc6d(0x13c)]){let {done:_0x38f362,value:_0x30bd19}=await _0x2b8169[_0x4bdc6d(0x168)]();if(_0x38f362)break;_0x2eef60+=_0x336aaa[_0x4bdc6d(0x145)](_0x30bd19,{'stream':!0x0});let _0x293711=_0x2eef60['split']('\x0a');_0x2eef60=_0x293711[_0x4bdc6d(0x17a)]()||'';for(let _0xd6bca4 of _0x293711){if(!_0xd6bca4[_0x4bdc6d(0x170)](_0x4bdc6d(0x129)))continue;try{let _0x450eeb=JSON[_0x4bdc6d(0x133)](_0xd6bca4[_0x4bdc6d(0x114)](0x6));if(_0x450eeb['type']===_0x4bdc6d(0x125)){this[_0x4bdc6d(0x107)](_0x4bdc6d(0x179)),this[_0x4bdc6d(0x16d)](_0x4bdc6d(0x125));continue;}if(_0x450eeb[_0x4bdc6d(0x18b)]===_0x4bdc6d(0x110)||_0x450eeb[_0x4bdc6d(0x18b)]===_0x4bdc6d(0x111)||_0x450eeb[_0x4bdc6d(0x18b)]==='broadcast')await this[_0x4bdc6d(0x10d)]();}catch{}}}}catch(_0x41fc10){if(_0x41fc10['name']===_0x4bdc6d(0x142))break;this[_0x4bdc6d(0x16d)](_0x4bdc6d(0x12b),_0x41fc10),this[_0x4bdc6d(0x107)](_0x4bdc6d(0x152)+_0x41fc10[_0x4bdc6d(0x11d)]);}if(this[_0x4bdc6d(0x13c)])this[_0x4bdc6d(0x16d)](_0x4bdc6d(0x16c)),this['log'](_0x4bdc6d(0x13f)+_0x1fe9a1/0x3e8+_0x4bdc6d(0x137)),await this['sleep'](_0x1fe9a1),_0x1fe9a1=Math['min'](_0x1fe9a1*1.5,0xea60);}}async[a0_0x566e4c(0x10d)](){const _0xf1127c=a0_0x566e4c;try{let _0x270745=(await this['call'](_0xf1127c(0x160),{'alias':this[_0xf1127c(0x14a)],'limit':0xa}))?.[_0xf1127c(0x172)]||[];for(let _0x1ea553 of _0x270745)await this[_0xf1127c(0x14c)](_0xf1127c(0x105),{'alias':this[_0xf1127c(0x14a)],'message_id':_0x1ea553['id']}),this[_0xf1127c(0x107)]('←\x20'+_0x1ea553[_0xf1127c(0x124)]+':\x20'+_0x1ea553[_0xf1127c(0x103)][_0xf1127c(0x114)](0x0,0x3c)),this['emit'](_0xf1127c(0x131),_0x1ea553),this[_0xf1127c(0x16d)](_0xf1127c(0x11d),_0x1ea553);}catch(_0x20c304){this[_0xf1127c(0x107)](_0xf1127c(0x141)+_0x20c304['message']);}}[a0_0x566e4c(0x10a)](_0x412e2a){return new Promise(_0x20ce6e=>setTimeout(_0x20ce6e,_0x412e2a));}}function a0_0x1968(){const _0x53867f=['url','getAllStatus','parent_task_id','<unknown>','resumeId','result','transport','json','task_id','message_id','lifecycle_tracking','heartbeatTimer','sseAbort','sdk','type','\x20duration_ms=','server','string','content','duration_ms','ack_inbox','heartbeatInterval','log','262036Halccv','send_task','sleep','CommHub\x20rejected\x20task','delivered','processInbox','to_alias','task.send.start','new_task','new_message','parentTaskId','[REDACTED]','slice','completed','failed','abort','lifecycleTracking','4876724HWxplR','reconnectDelay','task.replied','connectSSE','message','4791015TAtbry','min','registered','normal','/events/','SSE\x20failed:\x20','from_session','connected','toString','connect','task.send.failed','data:\x20','autoConnect','error','missing_task_id','8884528gCsfeL','report_status','101826jfDwIg','2073953blvCDQ','task','replace','parse','task.started','3AWLzRy','send_reply','s...','disconnect','reply','send_failed','token','running','1900248VejHIJ','application/json,\x20text/event-stream','SSE\x20reconnecting\x20in\x20','error_code','inbox\x20error:\x20','AbortError','application/json','body','decode','send_message','toTimeString','status','now','alias','broadcast','call','unknown\x20error','10zTfDnR','send',']\x20[commhub:','task.send.delivered','SSE\x20error:\x20','stringify','not_tracked','task.expired','getReader','POST','idle','Authorization','\x20transport=','heartbeat\x20failed:\x20','match','networkId','offline','sending','get_inbox','/mcp','task.ack','fromAlias','catch','\x20error=','tools/call','Bearer\x20','read','error_message','\x20parent_task_id=','text/event-stream','disconnected','emit','CommHub\x20response\x20omitted\x20task_id','<missing>','startsWith','\x20task_id=','messages','2.0','\x20network_id=','toAlias','agent','text','125DGCxWr','SSE\x20connected','pop','mcp_http','\x20lifecycle='];a0_0x1968=function(){return _0x53867f;};return a0_0x1968();}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x265bba=a0_0xd7c1;(function(_0x1c3abf,_0x251805){const _0x497da0=a0_0xd7c1,_0xf7b04e=_0x1c3abf();while(!![]){try{const _0x27bda5=-parseInt(_0x497da0(0x107))/0x1+parseInt(_0x497da0(0xf5))/0x2*(-parseInt(_0x497da0(0xcc))/0x3)+-parseInt(_0x497da0(0xe2))/0x4*(-parseInt(_0x497da0(0xd6))/0x5)+-parseInt(_0x497da0(0xc9))/0x6+-parseInt(_0x497da0(0xa3))/0x7*(-parseInt(_0x497da0(0xbb))/0x8)+parseInt(_0x497da0(0x112))/0x9*(parseInt(_0x497da0(0xf6))/0xa)+parseInt(_0x497da0(0xea))/0xb*(-parseInt(_0x497da0(0xc4))/0xc);if(_0x27bda5===_0x251805)break;else _0xf7b04e['push'](_0xf7b04e['shift']());}catch(_0x501413){_0xf7b04e['push'](_0xf7b04e['shift']());}}}(a0_0x12eb,0xbcffa));import{EventEmitter as a0_0xe1aceb}from'events';import{hostname as a0_0x1c5d6a}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x55e852,_0x3bac8f)=>(_0x55e852??_0x3bac8f)[a0_0x265bba(0xe3)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x265bba(0xda)](0x0,0xf0);function a0_0xd7c1(_0x156f6c,_0x2b8f94){_0x156f6c=_0x156f6c-0x98;const _0x12eb7f=a0_0x12eb();let _0xd7c12=_0x12eb7f[_0x156f6c];return _0xd7c12;}function a0_0x12eb(){const _0x27ede5=['task_id','parent_task_id','emit','toTimeString','send_rejected','SSE\x20error:\x20','8YWmBmN','message_id','from_alias','content','\x20duration_ms=','signal','<unknown>','toString','getAllStatus','24NgrrMk','send_failed','\x20task_id=','\x20from=','status','7265274pYPRcu','task.send.start','fromAlias','532383LAHVOv','2.0','error_message','[commhub:task]\x20','inbox\x20error:\x20','sdk','heartbeatTimer','\x20to=','<missing>','sleep','10NkgVuT','reconnectDelay','call','alias','slice','sseAbort','not_tracked','data:\x20','parentTaskId','report_status','\x20lifecycle=','tools/call','838828upaLRJ','replace','task.ack','connectSSE','resumeId','Authorization','server','connected','1285328VleFKA','message','\x20parent_task_id=',']\x20[commhub:','connect','token','normal','read','abort','SSE\x20reconnecting\x20in\x20','min','2RapSAC','10BggBCD','log','url','cwd','sdk-','new_message','/mcp','to_alias','now','SSE\x20failed:\x20','transport','task','<pending>','networkId','network_id','match','send_reply','57767AzuSNi','disconnect','SSE\x20connected','lifecycleTracking','Bearer\x20','sending','toAlias','result','parse','failed','s...','11225394sRJCmu','mcp_http','running','duration_ms','type','heartbeat\x20failed:\x20','lifecycle_tracking','catch','task.started','stringify','heartbeatInterval','\x20error=','new_task','broadcast','error','send_message','agent','text/event-stream','disconnected','5510827GpFyzu','startsWith','CommHub\x20response\x20omitted\x20task_id','\x20transport=','idle','body','error_code','missing_task_id','processInbox','decode','get_inbox','messages','application/json,\x20text/event-stream','POST','task.send.failed','/events/','\x20network_id=','CommHub\x20rejected\x20task'];a0_0x12eb=function(){return _0x27ede5;};return a0_0x12eb();}function N(_0x1606c0){const _0x152055=a0_0x265bba;return(_0x1606c0 instanceof Error?_0x1606c0[_0x152055(0xeb)]:String(_0x1606c0??'unknown\x20error'))[_0x152055(0xe3)](K,'[REDACTED]')[_0x152055(0xe3)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x152055(0xda)](0x0,0xf0);}function O(_0x1dbf0e,_0x2376b8=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0x2c8231=a0_0x265bba;if(_0x2376b8)return JSON[_0x2c8231(0x99)](_0x1dbf0e);let _0x45c215=L(_0x1dbf0e[_0x2c8231(0xb6)],_0x2c8231(0xd4)),_0x10c577=L(_0x1dbf0e[_0x2c8231(0xb5)],_0x2c8231(0x102)),_0x3f2719=_0x1dbf0e['error_code']?_0x2c8231(0x9b)+_0x1dbf0e[_0x2c8231(0xa9)]+':'+(_0x1dbf0e[_0x2c8231(0xce)]??''):'';return _0x2c8231(0xcf)+_0x1dbf0e['status']+_0x2c8231(0xc7)+L(_0x1dbf0e[_0x2c8231(0xbd)],_0x2c8231(0xc1))+_0x2c8231(0xd3)+L(_0x1dbf0e[_0x2c8231(0xfd)],_0x2c8231(0xc1))+_0x2c8231(0xc6)+_0x10c577+_0x2c8231(0xec)+_0x45c215+_0x2c8231(0xb3)+L(_0x1dbf0e[_0x2c8231(0x104)],_0x2c8231(0xc1))+_0x2c8231(0xa6)+_0x1dbf0e['transport']+_0x2c8231(0xbf)+_0x1dbf0e[_0x2c8231(0x115)]+_0x2c8231(0xe0)+_0x1dbf0e[_0x2c8231(0x118)]+_0x3f2719;}function U(_0x38a00d){const _0x4ccb12=a0_0x265bba;return{'event':{'sending':_0x4ccb12(0xca),'delivered':'task.send.delivered','failed':_0x4ccb12(0xb1),'acked':_0x4ccb12(0xe4),'started':_0x4ccb12(0x98),'replied':'task.replied','expired':'task.expired'}[_0x38a00d[_0x4ccb12(0xc8)]],..._0x38a00d};}function j(_0x406ce0){const _0x52a470=a0_0x265bba;let _0x54c444=_0x406ce0?.['task_id']||_0x406ce0?.['message_id']||_0x406ce0?.['id'];if(_0x54c444)return String(_0x54c444);let _0x91c2af=_0x406ce0?.[_0x52a470(0xbe)]?.[0x0]?.['text'];if(typeof _0x91c2af!=='string')return null;try{let _0x1ac78e=JSON['parse'](_0x91c2af);return _0x1ac78e?.[_0x52a470(0xb5)]||_0x1ac78e?.[_0x52a470(0xbc)]||_0x1ac78e?.['id']||null;}catch{return null;}}async function X(_0x3ef694,_0x36a329){const _0x195157=a0_0x265bba;let _0x24e1ca=_0x36a329[_0x195157(0xfe)]??Date['now'],_0x3b75b4=_0x24e1ca(),_0x21596f=(_0x56629a,_0x5aef15,_0x2a1213,_0x5791c0)=>{const _0x5b90df=_0x195157;_0x36a329[_0x5b90df(0xf7)](O(U({'from_alias':_0x3ef694[_0x5b90df(0xcb)],'to_alias':_0x3ef694[_0x5b90df(0x10d)],'task_id':_0x5aef15,'parent_task_id':_0x3ef694[_0x5b90df(0xde)],'network_id':_0x3ef694[_0x5b90df(0x103)],'transport':_0x3ef694[_0x5b90df(0x100)],'status':_0x56629a,'duration_ms':_0x24e1ca()-_0x3b75b4,'lifecycle_tracking':_0x3ef694[_0x5b90df(0x10a)],..._0x2a1213!==void 0x0?{'error_code':_0x5791c0||_0x5b90df(0xc5),'error_message':N(_0x2a1213)}:{}})));};_0x21596f(_0x195157(0x10c),null);try{let _0x4beced=await _0x36a329['send'](),_0x590aee=j(_0x4beced);if(_0x590aee)_0x21596f('delivered',_0x590aee);else{if(_0x4beced?.['ok']===!0x1||_0x4beced?.[_0x195157(0x9e)])_0x21596f(_0x195157(0x110),_0x590aee,_0x4beced?.[_0x195157(0x9e)]||_0x195157(0xb4),_0x195157(0xb9));else _0x21596f(_0x195157(0x110),null,_0x195157(0xa5),_0x195157(0xaa));}return _0x4beced;}catch(_0x3f24bd){throw _0x21596f(_0x195157(0x110),null,_0x3f24bd,'send_failed'),_0x3f24bd;}}async function Y(_0x492a26,_0x3d5e85){const _0x2fb4f3=a0_0x265bba;return X({'fromAlias':_0x492a26[_0x2fb4f3(0xcb)],'toAlias':_0x492a26[_0x2fb4f3(0xd9)],'parentTaskId':_0x492a26[_0x2fb4f3(0xde)]||null,'networkId':_0x492a26[_0x2fb4f3(0x103)]||null,'transport':_0x2fb4f3(0x113),'lifecycleTracking':_0x2fb4f3(0xdc)},_0x3d5e85);}class $ extends a0_0xe1aceb{['url'];[a0_0x265bba(0xd9)];[a0_0x265bba(0xef)];[a0_0x265bba(0xa0)];['resumeId'];[a0_0x265bba(0x9a)];[a0_0x265bba(0xd7)];[a0_0x265bba(0xd2)];['sseAbort'];[a0_0x265bba(0x114)]=!0x1;constructor(_0x1757f2){const _0x464bcc=a0_0x265bba;super();if(this[_0x464bcc(0xf8)]=_0x1757f2[_0x464bcc(0xf8)][_0x464bcc(0xe3)](/\/$/,''),this[_0x464bcc(0xd9)]=_0x1757f2[_0x464bcc(0xd9)],this[_0x464bcc(0xef)]=_0x1757f2['token'],this[_0x464bcc(0xa0)]=_0x1757f2[_0x464bcc(0xa0)]||_0x464bcc(0xd1),this[_0x464bcc(0xe6)]=_0x464bcc(0xfa)+_0x1757f2['alias']+'-'+Date['now']()[_0x464bcc(0xc2)](0x24),this[_0x464bcc(0x9a)]=_0x1757f2[_0x464bcc(0x9a)]??0x2bf20,this[_0x464bcc(0xd7)]=_0x1757f2['reconnectDelay']??0xbb8,_0x1757f2['autoConnect']!==!0x1)this[_0x464bcc(0xee)]();}[a0_0x265bba(0xf7)](_0x5472a0){const _0x30236e=a0_0x265bba;console[_0x30236e(0xf7)]('['+new Date()[_0x30236e(0xb8)]()[_0x30236e(0xda)](0x0,0x8)+_0x30236e(0xed)+this[_0x30236e(0xd9)]+']\x20'+_0x5472a0);}async[a0_0x265bba(0xd8)](_0x205848,_0x5cc57){const _0x163c93=a0_0x265bba;let _0x368c19={'Content-Type':'application/json','Accept':_0x163c93(0xaf)};if(this['token'])_0x368c19[_0x163c93(0xe7)]=_0x163c93(0x10b)+this[_0x163c93(0xef)];let _0x418a1c=await(await fetch(this[_0x163c93(0xf8)]+_0x163c93(0xfc),{'method':_0x163c93(0xb0),'headers':_0x368c19,'body':JSON[_0x163c93(0x99)]({'jsonrpc':_0x163c93(0xcd),'id':Date['now'](),'method':_0x163c93(0xe1),'params':{'name':_0x205848,'arguments':_0x5cc57}})}))['text'](),_0xbfa588=_0x418a1c[_0x163c93(0x105)](/data: (.+)/),_0x464fb2=_0xbfa588?JSON[_0x163c93(0x10f)](_0xbfa588[0x1]):JSON['parse'](_0x418a1c),_0x124fa6=_0x464fb2?.[_0x163c93(0x10e)]?.[_0x163c93(0xbe)]?.[0x0]?.['text'];return _0x124fa6?JSON[_0x163c93(0x10f)](_0x124fa6):_0x464fb2;}async[a0_0x265bba(0xee)](){const _0x109bfd=a0_0x265bba;if(this[_0x109bfd(0x114)])return;this[_0x109bfd(0x114)]=!0x0,await this[_0x109bfd(0xc8)](_0x109bfd(0xa7)),this['log']('registered'),this['heartbeatTimer']=setInterval(()=>{const _0x3bdce4=_0x109bfd;this[_0x3bdce4(0xc8)](_0x3bdce4(0xa7))[_0x3bdce4(0x119)](_0x7b6242=>this[_0x3bdce4(0xf7)](_0x3bdce4(0x117)+_0x7b6242[_0x3bdce4(0xeb)]));},this[_0x109bfd(0x9a)]),this[_0x109bfd(0xe5)]();}async[a0_0x265bba(0x108)](){const _0x3d4310=a0_0x265bba;if(this['running']=!0x1,this[_0x3d4310(0xdb)]?.[_0x3d4310(0xf2)](),this[_0x3d4310(0xd2)])clearInterval(this[_0x3d4310(0xd2)]);await this[_0x3d4310(0xc8)]('offline')[_0x3d4310(0x119)](()=>{}),this[_0x3d4310(0xf7)](_0x3d4310(0xa2));}async['send'](_0x587943,_0x557b6e,_0x35610b=a0_0x265bba(0xf0)){const _0x5c7bb0=a0_0x265bba;return Y({'alias':_0x587943,'fromAlias':this[_0x5c7bb0(0xd9)]},{'log':_0x79d8fc=>console['log'](_0x79d8fc),'send':()=>this[_0x5c7bb0(0xd8)]('send_task',{'alias':_0x587943,'task':_0x557b6e,'priority':_0x35610b,'from_session':this[_0x5c7bb0(0xd9)]})});}async['message'](_0x2fb679,_0x23574d){const _0x5e9da9=a0_0x265bba;return this[_0x5e9da9(0xd8)](_0x5e9da9(0x9f),{'alias':_0x2fb679,'message':_0x23574d,'from_session':this[_0x5e9da9(0xd9)]});}async['reply'](_0x29713c,_0x26ba7d,_0x5cc780='completed'){const _0x3f1262=a0_0x265bba;return this[_0x3f1262(0xd8)](_0x3f1262(0x106),{'in_reply_to':_0x29713c,'text':_0x26ba7d,'status':_0x5cc780});}async['status'](_0x4435f1,_0x32c28a){const _0x2979c8=a0_0x265bba;return this[_0x2979c8(0xd8)](_0x2979c8(0xdf),{'resume_id':this[_0x2979c8(0xe6)],'alias':this[_0x2979c8(0xd9)],'status':_0x4435f1,'server':a0_0x1c5d6a(),'hostname':a0_0x1c5d6a(),'agent':this[_0x2979c8(0xa0)],'project_dir':process[_0x2979c8(0xf9)](),..._0x32c28a});}async[a0_0x265bba(0xc3)](){const _0x206933=a0_0x265bba;return this[_0x206933(0xd8)]('get_all_status',{});}async['broadcast'](_0x485d1f,_0x4be5ef){const _0x27afc5=a0_0x265bba;return this['call'](_0x27afc5(0x9d),{'message':_0x485d1f,'filter_server':_0x4be5ef?.[_0x27afc5(0xe8)],'filter_status':_0x4be5ef?.[_0x27afc5(0xc8)]});}async['connectSSE'](){const _0x6e220c=a0_0x265bba;let _0x2b96de=encodeURIComponent(this['alias']),_0x12b2b4=this[_0x6e220c(0xf8)]+_0x6e220c(0xb2)+_0x2b96de,_0x4cc12d=this[_0x6e220c(0xd7)];while(this['running']){try{this[_0x6e220c(0xdb)]=new AbortController();let _0x48c9bd={'Accept':_0x6e220c(0xa1)};if(this['token'])_0x48c9bd['Authorization']='Bearer\x20'+this[_0x6e220c(0xef)];let _0xd164ff=await fetch(_0x12b2b4,{'headers':_0x48c9bd,'signal':this[_0x6e220c(0xdb)][_0x6e220c(0xc0)]});if(!_0xd164ff['ok']||!_0xd164ff[_0x6e220c(0xa8)]){this[_0x6e220c(0xf7)](_0x6e220c(0xff)+_0xd164ff[_0x6e220c(0xc8)]),await this[_0x6e220c(0xd5)](_0x4cc12d),_0x4cc12d=Math[_0x6e220c(0xf4)](_0x4cc12d*1.5,0xea60);continue;}_0x4cc12d=this[_0x6e220c(0xd7)];let _0x19eee6=_0xd164ff['body']['getReader'](),_0x528357=new TextDecoder(),_0x405880='';while(this[_0x6e220c(0x114)]){let {done:_0x2c6dd8,value:_0x530930}=await _0x19eee6[_0x6e220c(0xf1)]();if(_0x2c6dd8)break;_0x405880+=_0x528357[_0x6e220c(0xac)](_0x530930,{'stream':!0x0});let _0x347635=_0x405880['split']('\x0a');_0x405880=_0x347635['pop']()||'';for(let _0x5bd6c6 of _0x347635){if(!_0x5bd6c6[_0x6e220c(0xa4)](_0x6e220c(0xdd)))continue;try{let _0x4bd726=JSON[_0x6e220c(0x10f)](_0x5bd6c6[_0x6e220c(0xda)](0x6));if(_0x4bd726[_0x6e220c(0x116)]==='connected'){this[_0x6e220c(0xf7)](_0x6e220c(0x109)),this[_0x6e220c(0xb7)](_0x6e220c(0xe9));continue;}if(_0x4bd726['type']===_0x6e220c(0x9c)||_0x4bd726[_0x6e220c(0x116)]===_0x6e220c(0xfb)||_0x4bd726[_0x6e220c(0x116)]===_0x6e220c(0x9d))await this[_0x6e220c(0xab)]();}catch{}}}}catch(_0x5da394){if(_0x5da394['name']==='AbortError')break;this['emit'](_0x6e220c(0x9e),_0x5da394),this['log'](_0x6e220c(0xba)+_0x5da394['message']);}if(this[_0x6e220c(0x114)])this[_0x6e220c(0xb7)](_0x6e220c(0xa2)),this[_0x6e220c(0xf7)](_0x6e220c(0xf3)+_0x4cc12d/0x3e8+_0x6e220c(0x111)),await this['sleep'](_0x4cc12d),_0x4cc12d=Math['min'](_0x4cc12d*1.5,0xea60);}}async[a0_0x265bba(0xab)](){const _0x43b619=a0_0x265bba;try{let _0x49de05=(await this[_0x43b619(0xd8)](_0x43b619(0xad),{'alias':this[_0x43b619(0xd9)],'limit':0xa}))?.[_0x43b619(0xae)]||[];for(let _0x3b6418 of _0x49de05)await this[_0x43b619(0xd8)]('ack_inbox',{'alias':this[_0x43b619(0xd9)],'message_id':_0x3b6418['id']}),this[_0x43b619(0xf7)]('←\x20'+_0x3b6418['from_session']+':\x20'+_0x3b6418['content'][_0x43b619(0xda)](0x0,0x3c)),this[_0x43b619(0xb7)](_0x43b619(0x101),_0x3b6418),this[_0x43b619(0xb7)]('message',_0x3b6418);}catch(_0x4a8c1d){this[_0x43b619(0xf7)](_0x43b619(0xd0)+_0x4a8c1d[_0x43b619(0xeb)]);}}[a0_0x265bba(0xd5)](_0x184a51){return new Promise(_0x15bce3=>setTimeout(_0x15bce3,_0x184a51));}}var F=$;export{F as default,$ as CommHub};
|