@sleep2agi/agent-network 2.3.0-preview.224 → 2.3.0-preview.226
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
|
-
function a0_0x2c35(){const _0x43d2ac=['lifecycle_tracking','decode','tools/call','\x20duration_ms=','toAlias','heartbeatTimer','transport','656577cMjNlH','running','new_task','min','autoConnect','\x20from=','match','type','send','abort','heartbeat\x20failed:\x20','to_alias','resumeId','error_message','sleep','42585059ABLvou','agent','unknown\x20error','stringify','registered','<unknown>','body','json','67945nqBrLG','[REDACTED]','reply','Bearer\x20','status','url','fromAlias','ack_inbox','lifecycleTracking','SSE\x20connected','alias','40NsTobz','heartbeatInterval','now','text','204GGjmYI','send_failed','[commhub:task]\x20','CommHub\x20response\x20omitted\x20task_id','idle','parse','application/json','cwd','processInbox','s...','string','/events/','5394BnnrII','get_all_status','sdk','5467yZqOJY','mcp_http','delivered','report_status','emit','\x20lifecycle=','send_rejected','\x20task_id=','content','inbox\x20error:\x20','log','error','8336010UZDhTQ','\x20parent_task_id=','offline','SSE\x20error:\x20','broadcast','failed','task.expired','call','parentTaskId','send_reply','reconnectDelay','1ouAFmV','message_id','split','<pending>','CommHub\x20rejected\x20task','from_session','connectSSE','from_alias','result','toString','text/event-stream','sseAbort','networkId','connect','connected','toTimeString','disconnect','message','1721878kuaLBA','task_id','POST','data:\x20','catch','task.send.delivered','application/json,\x20text/event-stream','Authorization','token','replace','signal','disconnected','SSE\x20failed:\x20','completed','missing_task_id','sdk-','task','/mcp',']\x20[commhub:','send_message','get_inbox','2020077WpwFpM','task.send.start','slice','new_message'];a0_0x2c35=function(){return _0x43d2ac;};return a0_0x2c35();}const a0_0x21df2a=a0_0x19a4;(function(_0x19b62f,_0x1cef4a){const _0x2d1e53=a0_0x19a4,_0x161abe=_0x19b62f();while(!![]){try{const _0xa6fca6=-parseInt(_0x2d1e53(0x221))/0x1*(parseInt(_0x2d1e53(0x233))/0x2)+-parseInt(_0x2d1e53(0x248))/0x3+parseInt(_0x2d1e53(0x1fb))/0x4*(-parseInt(_0x2d1e53(0x26a))/0x5)+parseInt(_0x2d1e53(0x207))/0x6*(-parseInt(_0x2d1e53(0x20a))/0x7)+parseInt(_0x2d1e53(0x1f7))/0x8*(parseInt(_0x2d1e53(0x253))/0x9)+-parseInt(_0x2d1e53(0x216))/0xa+parseInt(_0x2d1e53(0x262))/0xb;if(_0xa6fca6===_0x1cef4a)break;else _0x161abe['push'](_0x161abe['shift']());}catch(_0x2f8215){_0x161abe['push'](_0x161abe['shift']());}}}(a0_0x2c35,0x737f5));import{EventEmitter as a0_0x766962}from'events';function a0_0x19a4(_0x17fad5,_0x583f61){_0x17fad5=_0x17fad5-0x1ef;const _0x2c35f6=a0_0x2c35();let _0x19a459=_0x2c35f6[_0x17fad5];return _0x19a459;}import{hostname as a0_0x113adc}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x426e67,_0x12d32a)=>(_0x426e67??_0x12d32a)[a0_0x21df2a(0x23c)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x21df2a(0x24a)](0x0,0xf0);function N(_0x1efc18){const _0x4c4c85=a0_0x21df2a;return(_0x1efc18 instanceof Error?_0x1efc18[_0x4c4c85(0x232)]:String(_0x1efc18??_0x4c4c85(0x264)))[_0x4c4c85(0x23c)](K,_0x4c4c85(0x26b))[_0x4c4c85(0x23c)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function O(_0x7e01bc,_0x5f0cb8=process.env.ANET_TASK_TRACE_FORMAT===a0_0x21df2a(0x269)){const _0x26370f=a0_0x21df2a;if(_0x5f0cb8)return JSON[_0x26370f(0x265)](_0x7e01bc);let _0x4ed008=L(_0x7e01bc['parent_task_id'],'<missing>'),_0x119552=L(_0x7e01bc['task_id'],_0x26370f(0x224)),_0x1ab671=_0x7e01bc['error_code']?'\x20error='+_0x7e01bc['error_code']+':'+(_0x7e01bc[_0x26370f(0x260)]??''):'';return _0x26370f(0x1fd)+_0x7e01bc[_0x26370f(0x1f0)]+_0x26370f(0x258)+L(_0x7e01bc[_0x26370f(0x228)],_0x26370f(0x267))+'\x20to='+L(_0x7e01bc[_0x26370f(0x25e)],_0x26370f(0x267))+_0x26370f(0x211)+_0x119552+_0x26370f(0x217)+_0x4ed008+'\x20network_id='+L(_0x7e01bc['network_id'],_0x26370f(0x267))+'\x20transport='+_0x7e01bc[_0x26370f(0x252)]+_0x26370f(0x24f)+_0x7e01bc['duration_ms']+_0x26370f(0x20f)+_0x7e01bc[_0x26370f(0x24c)]+_0x1ab671;}function U(_0x4d7c50){const _0xea725e=a0_0x21df2a;return{'event':{'sending':_0xea725e(0x249),'delivered':_0xea725e(0x238),'failed':'task.send.failed','acked':'task.ack','started':'task.started','replied':'task.replied','expired':_0xea725e(0x21c)}[_0x4d7c50[_0xea725e(0x1f0)]],..._0x4d7c50};}function j(_0xdf2a71){const _0x158325=a0_0x21df2a;let _0x331aec=_0xdf2a71?.['task_id']||_0xdf2a71?.['message_id']||_0xdf2a71?.['id'];if(_0x331aec)return String(_0x331aec);let _0x56ece0=_0xdf2a71?.[_0x158325(0x212)]?.[0x0]?.[_0x158325(0x1fa)];if(typeof _0x56ece0!==_0x158325(0x205))return null;try{let _0x60951d=JSON[_0x158325(0x200)](_0x56ece0);return _0x60951d?.[_0x158325(0x234)]||_0x60951d?.[_0x158325(0x222)]||_0x60951d?.['id']||null;}catch{return null;}}async function X(_0xeb1c47,_0x191eeb){const _0x253f4a=a0_0x21df2a;let _0x3f33a0=_0x191eeb['now']??Date[_0x253f4a(0x1f9)],_0x14c332=_0x3f33a0(),_0x102aa4=(_0x123a24,_0xa65637,_0x50e898,_0x1ae184)=>{const _0x5dd2d7=_0x253f4a;_0x191eeb[_0x5dd2d7(0x214)](O(U({'from_alias':_0xeb1c47[_0x5dd2d7(0x1f2)],'to_alias':_0xeb1c47[_0x5dd2d7(0x250)],'task_id':_0xa65637,'parent_task_id':_0xeb1c47[_0x5dd2d7(0x21e)],'network_id':_0xeb1c47[_0x5dd2d7(0x22d)],'transport':_0xeb1c47[_0x5dd2d7(0x252)],'status':_0x123a24,'duration_ms':_0x3f33a0()-_0x14c332,'lifecycle_tracking':_0xeb1c47[_0x5dd2d7(0x1f4)],..._0x50e898!==void 0x0?{'error_code':_0x1ae184||_0x5dd2d7(0x1fc),'error_message':N(_0x50e898)}:{}})));};_0x102aa4('sending',null);try{let _0x2bced7=await _0x191eeb[_0x253f4a(0x25b)](),_0x4f4036=j(_0x2bced7);if(_0x4f4036)_0x102aa4(_0x253f4a(0x20c),_0x4f4036);else{if(_0x2bced7?.['ok']===!0x1||_0x2bced7?.[_0x253f4a(0x215)])_0x102aa4(_0x253f4a(0x21b),_0x4f4036,_0x2bced7?.[_0x253f4a(0x215)]||_0x253f4a(0x225),_0x253f4a(0x210));else _0x102aa4(_0x253f4a(0x21b),null,_0x253f4a(0x1fe),_0x253f4a(0x241));}return _0x2bced7;}catch(_0x1cb4cd){throw _0x102aa4(_0x253f4a(0x21b),null,_0x1cb4cd,_0x253f4a(0x1fc)),_0x1cb4cd;}}async function Y(_0x2596ad,_0xa123c3){const _0x3eb281=a0_0x21df2a;return X({'fromAlias':_0x2596ad[_0x3eb281(0x1f2)],'toAlias':_0x2596ad[_0x3eb281(0x1f6)],'parentTaskId':_0x2596ad['parentTaskId']||null,'networkId':_0x2596ad[_0x3eb281(0x22d)]||null,'transport':_0x3eb281(0x20b),'lifecycleTracking':'not_tracked'},_0xa123c3);}class $ extends a0_0x766962{[a0_0x21df2a(0x1f1)];[a0_0x21df2a(0x1f6)];[a0_0x21df2a(0x23b)];[a0_0x21df2a(0x263)];[a0_0x21df2a(0x25f)];[a0_0x21df2a(0x1f8)];[a0_0x21df2a(0x220)];[a0_0x21df2a(0x251)];[a0_0x21df2a(0x22c)];[a0_0x21df2a(0x254)]=!0x1;constructor(_0xfbf59b){const _0x49823f=a0_0x21df2a;super();if(this[_0x49823f(0x1f1)]=_0xfbf59b['url'][_0x49823f(0x23c)](/\/$/,''),this['alias']=_0xfbf59b[_0x49823f(0x1f6)],this[_0x49823f(0x23b)]=_0xfbf59b[_0x49823f(0x23b)],this[_0x49823f(0x263)]=_0xfbf59b['agent']||_0x49823f(0x209),this[_0x49823f(0x25f)]=_0x49823f(0x242)+_0xfbf59b[_0x49823f(0x1f6)]+'-'+Date[_0x49823f(0x1f9)]()[_0x49823f(0x22a)](0x24),this[_0x49823f(0x1f8)]=_0xfbf59b['heartbeatInterval']??0x2bf20,this[_0x49823f(0x220)]=_0xfbf59b[_0x49823f(0x220)]??0xbb8,_0xfbf59b[_0x49823f(0x257)]!==!0x1)this[_0x49823f(0x22e)]();}[a0_0x21df2a(0x214)](_0x2a9b8b){const _0x1d2276=a0_0x21df2a;console[_0x1d2276(0x214)]('['+new Date()[_0x1d2276(0x230)]()[_0x1d2276(0x24a)](0x0,0x8)+_0x1d2276(0x245)+this[_0x1d2276(0x1f6)]+']\x20'+_0x2a9b8b);}async[a0_0x21df2a(0x21d)](_0x5738c8,_0x50199b){const _0x51a500=a0_0x21df2a;let _0x1d09fe={'Content-Type':_0x51a500(0x201),'Accept':_0x51a500(0x239)};if(this[_0x51a500(0x23b)])_0x1d09fe['Authorization']=_0x51a500(0x1ef)+this[_0x51a500(0x23b)];let _0x56a27f=await(await fetch(this['url']+_0x51a500(0x244),{'method':_0x51a500(0x235),'headers':_0x1d09fe,'body':JSON[_0x51a500(0x265)]({'jsonrpc':'2.0','id':Date[_0x51a500(0x1f9)](),'method':_0x51a500(0x24e),'params':{'name':_0x5738c8,'arguments':_0x50199b}})}))[_0x51a500(0x1fa)](),_0x545d10=_0x56a27f[_0x51a500(0x259)](/data: (.+)/),_0x542bdc=_0x545d10?JSON['parse'](_0x545d10[0x1]):JSON['parse'](_0x56a27f),_0x520d84=_0x542bdc?.[_0x51a500(0x229)]?.[_0x51a500(0x212)]?.[0x0]?.[_0x51a500(0x1fa)];return _0x520d84?JSON[_0x51a500(0x200)](_0x520d84):_0x542bdc;}async['connect'](){const _0x29a377=a0_0x21df2a;if(this['running'])return;this[_0x29a377(0x254)]=!0x0,await this['status'](_0x29a377(0x1ff)),this['log'](_0x29a377(0x266)),this['heartbeatTimer']=setInterval(()=>{const _0x5635a1=_0x29a377;this[_0x5635a1(0x1f0)](_0x5635a1(0x1ff))['catch'](_0x28f7af=>this[_0x5635a1(0x214)](_0x5635a1(0x25d)+_0x28f7af['message']));},this[_0x29a377(0x1f8)]),this['connectSSE']();}async[a0_0x21df2a(0x231)](){const _0x843964=a0_0x21df2a;if(this['running']=!0x1,this['sseAbort']?.[_0x843964(0x25c)](),this[_0x843964(0x251)])clearInterval(this[_0x843964(0x251)]);await this[_0x843964(0x1f0)](_0x843964(0x218))[_0x843964(0x237)](()=>{}),this[_0x843964(0x214)](_0x843964(0x23e));}async[a0_0x21df2a(0x25b)](_0x2ded44,_0x1a6fab,_0x15a03e='normal'){const _0x426825=a0_0x21df2a;return Y({'alias':_0x2ded44,'fromAlias':this[_0x426825(0x1f6)]},{'log':_0x7b937f=>console[_0x426825(0x214)](_0x7b937f),'send':()=>this[_0x426825(0x21d)]('send_task',{'alias':_0x2ded44,'task':_0x1a6fab,'priority':_0x15a03e,'from_session':this[_0x426825(0x1f6)]})});}async[a0_0x21df2a(0x232)](_0x515f8e,_0x4132d6){const _0xf690a4=a0_0x21df2a;return this[_0xf690a4(0x21d)](_0xf690a4(0x246),{'alias':_0x515f8e,'message':_0x4132d6,'from_session':this[_0xf690a4(0x1f6)]});}async[a0_0x21df2a(0x26c)](_0x411ed1,_0x450d7f,_0x884d39=a0_0x21df2a(0x240)){const _0x3a3042=a0_0x21df2a;return this['call'](_0x3a3042(0x21f),{'in_reply_to':_0x411ed1,'text':_0x450d7f,'status':_0x884d39});}async['status'](_0x183ad2,_0x5a61f3){const _0x531504=a0_0x21df2a;return this[_0x531504(0x21d)](_0x531504(0x20d),{'resume_id':this[_0x531504(0x25f)],'alias':this[_0x531504(0x1f6)],'status':_0x183ad2,'server':a0_0x113adc(),'hostname':a0_0x113adc(),'agent':this[_0x531504(0x263)],'project_dir':process[_0x531504(0x202)](),..._0x5a61f3});}async['getAllStatus'](){const _0x580770=a0_0x21df2a;return this[_0x580770(0x21d)](_0x580770(0x208),{});}async[a0_0x21df2a(0x21a)](_0x2a9bcd,_0x35647c){const _0x51ad52=a0_0x21df2a;return this[_0x51ad52(0x21d)](_0x51ad52(0x21a),{'message':_0x2a9bcd,'filter_server':_0x35647c?.['server'],'filter_status':_0x35647c?.['status']});}async[a0_0x21df2a(0x227)](){const _0x245344=a0_0x21df2a;let _0x55449f=encodeURIComponent(this[_0x245344(0x1f6)]),_0xa45498=this[_0x245344(0x1f1)]+_0x245344(0x206)+_0x55449f,_0xd255de=this[_0x245344(0x220)];while(this[_0x245344(0x254)]){try{this[_0x245344(0x22c)]=new AbortController();let _0x1284ab={'Accept':_0x245344(0x22b)};if(this[_0x245344(0x23b)])_0x1284ab[_0x245344(0x23a)]=_0x245344(0x1ef)+this[_0x245344(0x23b)];let _0x4ae1fd=await fetch(_0xa45498,{'headers':_0x1284ab,'signal':this[_0x245344(0x22c)][_0x245344(0x23d)]});if(!_0x4ae1fd['ok']||!_0x4ae1fd[_0x245344(0x268)]){this[_0x245344(0x214)](_0x245344(0x23f)+_0x4ae1fd[_0x245344(0x1f0)]),await this['sleep'](_0xd255de),_0xd255de=Math[_0x245344(0x256)](_0xd255de*1.5,0xea60);continue;}_0xd255de=this[_0x245344(0x220)];let _0x571808=_0x4ae1fd[_0x245344(0x268)]['getReader'](),_0x52caae=new TextDecoder(),_0x145c3c='';while(this[_0x245344(0x254)]){let {done:_0x3bea73,value:_0x4f5bed}=await _0x571808['read']();if(_0x3bea73)break;_0x145c3c+=_0x52caae[_0x245344(0x24d)](_0x4f5bed,{'stream':!0x0});let _0x532393=_0x145c3c[_0x245344(0x223)]('\x0a');_0x145c3c=_0x532393['pop']()||'';for(let _0x283c0b of _0x532393){if(!_0x283c0b['startsWith'](_0x245344(0x236)))continue;try{let _0x157da3=JSON[_0x245344(0x200)](_0x283c0b[_0x245344(0x24a)](0x6));if(_0x157da3[_0x245344(0x25a)]===_0x245344(0x22f)){this[_0x245344(0x214)](_0x245344(0x1f5)),this['emit']('connected');continue;}if(_0x157da3[_0x245344(0x25a)]===_0x245344(0x255)||_0x157da3[_0x245344(0x25a)]===_0x245344(0x24b)||_0x157da3[_0x245344(0x25a)]===_0x245344(0x21a))await this['processInbox']();}catch{}}}}catch(_0x5a78ac){if(_0x5a78ac['name']==='AbortError')break;this[_0x245344(0x20e)](_0x245344(0x215),_0x5a78ac),this['log'](_0x245344(0x219)+_0x5a78ac[_0x245344(0x232)]);}if(this[_0x245344(0x254)])this[_0x245344(0x20e)]('disconnected'),this['log']('SSE\x20reconnecting\x20in\x20'+_0xd255de/0x3e8+_0x245344(0x204)),await this[_0x245344(0x261)](_0xd255de),_0xd255de=Math['min'](_0xd255de*1.5,0xea60);}}async[a0_0x21df2a(0x203)](){const _0x3f2af2=a0_0x21df2a;try{let _0xdac29=(await this[_0x3f2af2(0x21d)](_0x3f2af2(0x247),{'alias':this[_0x3f2af2(0x1f6)],'limit':0xa}))?.['messages']||[];for(let _0x18d588 of _0xdac29)await this[_0x3f2af2(0x21d)](_0x3f2af2(0x1f3),{'alias':this['alias'],'message_id':_0x18d588['id']}),this[_0x3f2af2(0x214)]('←\x20'+_0x18d588[_0x3f2af2(0x226)]+':\x20'+_0x18d588[_0x3f2af2(0x212)][_0x3f2af2(0x24a)](0x0,0x3c)),this[_0x3f2af2(0x20e)](_0x3f2af2(0x243),_0x18d588),this['emit'](_0x3f2af2(0x232),_0x18d588);}catch(_0x403dae){this['log'](_0x3f2af2(0x213)+_0x403dae['message']);}}[a0_0x21df2a(0x261)](_0x374330){return new Promise(_0x56c52c=>setTimeout(_0x56c52c,_0x374330));}}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x42c9ed=a0_0xe91c;(function(_0x3e8db0,_0x56955d){const _0x5e7061=a0_0xe91c,_0x2bf5ee=_0x3e8db0();while(!![]){try{const _0x74bc61=parseInt(_0x5e7061(0x130))/0x1*(parseInt(_0x5e7061(0x177))/0x2)+-parseInt(_0x5e7061(0x131))/0x3*(parseInt(_0x5e7061(0x179))/0x4)+-parseInt(_0x5e7061(0x191))/0x5+-parseInt(_0x5e7061(0x199))/0x6*(parseInt(_0x5e7061(0x138))/0x7)+parseInt(_0x5e7061(0x141))/0x8+parseInt(_0x5e7061(0x156))/0x9+parseInt(_0x5e7061(0x135))/0xa;if(_0x74bc61===_0x56955d)break;else _0x2bf5ee['push'](_0x2bf5ee['shift']());}catch(_0x40aa9f){_0x2bf5ee['push'](_0x2bf5ee['shift']());}}}(a0_0x4a54,0x9d9f0));import{EventEmitter as a0_0x6fe51b}from'events';import{hostname as a0_0xff0b17}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x253c98,_0x4e32d3)=>(_0x253c98??_0x4e32d3)[a0_0x42c9ed(0x160)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x42c9ed(0x193)](0x0,0xf0);function N(_0x9279ad){const _0x2685aa=a0_0x42c9ed;return(_0x9279ad instanceof Error?_0x9279ad[_0x2685aa(0x142)]:String(_0x9279ad??'unknown\x20error'))[_0x2685aa(0x160)](K,_0x2685aa(0x13f))[_0x2685aa(0x160)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x2685aa(0x193)](0x0,0xf0);}function a0_0xe91c(_0x311154,_0x37d48d){_0x311154=_0x311154-0x119;const _0x4a54f8=a0_0x4a54();let _0xe91c87=_0x4a54f8[_0x311154];return _0xe91c87;}function O(_0x342fea,_0xf33e07=process.env.ANET_TASK_TRACE_FORMAT===a0_0x42c9ed(0x121)){const _0x4518ff=a0_0x42c9ed;if(_0xf33e07)return JSON[_0x4518ff(0x126)](_0x342fea);let _0x226218=L(_0x342fea['parent_task_id'],'<missing>'),_0x1e625e=L(_0x342fea[_0x4518ff(0x13b)],_0x4518ff(0x16c)),_0x19f216=_0x342fea[_0x4518ff(0x188)]?_0x4518ff(0x18d)+_0x342fea[_0x4518ff(0x188)]+':'+(_0x342fea['error_message']??''):'';return _0x4518ff(0x154)+_0x342fea[_0x4518ff(0x189)]+_0x4518ff(0x11b)+L(_0x342fea[_0x4518ff(0x163)],_0x4518ff(0x17a))+_0x4518ff(0x147)+L(_0x342fea[_0x4518ff(0x151)],_0x4518ff(0x17a))+_0x4518ff(0x162)+_0x1e625e+_0x4518ff(0x16f)+_0x226218+_0x4518ff(0x15a)+L(_0x342fea[_0x4518ff(0x190)],'<unknown>')+_0x4518ff(0x153)+_0x342fea['transport']+_0x4518ff(0x18b)+_0x342fea[_0x4518ff(0x185)]+_0x4518ff(0x150)+_0x342fea['lifecycle_tracking']+_0x19f216;}function a0_0x4a54(){const _0x1b8425=['toTimeString','4454096kNhqmV','message',']\x20[commhub:','send_reply','sseAbort','string','\x20to=','content','sending','s...','normal','autoConnect','error','task.ack','parse','\x20lifecycle=','to_alias','SSE\x20reconnecting\x20in\x20','\x20transport=','[commhub:task]\x20','sdk-','10056915UGFQrl','CommHub\x20response\x20omitted\x20task_id','ack_inbox','now','\x20network_id=','server','send','reply','offline','mcp_http','replace','idle','\x20task_id=','from_alias','agent','heartbeatTimer','SSE\x20connected','/events/','parentTaskId','task.expired','read','failed','<pending>','SSE\x20error:\x20','connect','\x20parent_task_id=','data:\x20','message_id','send_rejected','sdk','CommHub\x20rejected\x20task','task.replied','get_all_status','2BqDinQ','toAlias','8KmLfgn','<unknown>','/mcp','processInbox','task.started','not_tracked','2.0','url','transport','task.send.delivered','missing_task_id','task','duration_ms','alias','toString','error_code','status','fromAlias','\x20duration_ms=','match','\x20error=','connected','type','network_id','5260545gDpTps','name','slice','min','abort','inbox\x20error:\x20','registered','emit','1364172mAwkDz','task.send.failed','connectSSE','messages','running','call','resumeId','POST','\x20from=','broadcast','reconnectDelay','Authorization','Bearer\x20','text/event-stream','json','log','new_message','application/json','getAllStatus','stringify','send_message','catch','split','delivered','heartbeat\x20failed:\x20','decode','token','text','sleep','322159IBqSur','979059FrSNUO','send_failed','disconnect','body','8087990dvjPpc','send_task','networkId','14yyivjS','report_status','from_session','task_id','tools/call','heartbeatInterval','disconnected','[REDACTED]'];a0_0x4a54=function(){return _0x1b8425;};return a0_0x4a54();}function U(_0x36c0b4){const _0x2de1c3=a0_0x42c9ed;return{'event':{'sending':'task.send.start','delivered':_0x2de1c3(0x182),'failed':_0x2de1c3(0x19a),'acked':_0x2de1c3(0x14e),'started':_0x2de1c3(0x17d),'replied':_0x2de1c3(0x175),'expired':_0x2de1c3(0x169)}[_0x36c0b4['status']],..._0x36c0b4};}function j(_0x11a990){const _0x4bb384=a0_0x42c9ed;let _0x5b59e9=_0x11a990?.[_0x4bb384(0x13b)]||_0x11a990?.[_0x4bb384(0x171)]||_0x11a990?.['id'];if(_0x5b59e9)return String(_0x5b59e9);let _0x5b7b6e=_0x11a990?.[_0x4bb384(0x148)]?.[0x0]?.[_0x4bb384(0x12e)];if(typeof _0x5b7b6e!==_0x4bb384(0x146))return null;try{let _0x3813f4=JSON[_0x4bb384(0x14f)](_0x5b7b6e);return _0x3813f4?.[_0x4bb384(0x13b)]||_0x3813f4?.['message_id']||_0x3813f4?.['id']||null;}catch{return null;}}async function X(_0x5a1800,_0x332e25){const _0x5b4fa4=a0_0x42c9ed;let _0x1d7003=_0x332e25[_0x5b4fa4(0x159)]??Date['now'],_0x3feffd=_0x1d7003(),_0x4de1a1=(_0x5c07f7,_0x1b0096,_0x4920c2,_0x220722)=>{const _0x34647c=_0x5b4fa4;_0x332e25[_0x34647c(0x122)](O(U({'from_alias':_0x5a1800[_0x34647c(0x18a)],'to_alias':_0x5a1800[_0x34647c(0x178)],'task_id':_0x1b0096,'parent_task_id':_0x5a1800[_0x34647c(0x168)],'network_id':_0x5a1800[_0x34647c(0x137)],'transport':_0x5a1800[_0x34647c(0x181)],'status':_0x5c07f7,'duration_ms':_0x1d7003()-_0x3feffd,'lifecycle_tracking':_0x5a1800['lifecycleTracking'],..._0x4920c2!==void 0x0?{'error_code':_0x220722||'send_failed','error_message':N(_0x4920c2)}:{}})));};_0x4de1a1(_0x5b4fa4(0x149),null);try{let _0x17ba46=await _0x332e25[_0x5b4fa4(0x15c)](),_0x3dad72=j(_0x17ba46);if(_0x3dad72)_0x4de1a1(_0x5b4fa4(0x12a),_0x3dad72);else{if(_0x17ba46?.['ok']===!0x1||_0x17ba46?.[_0x5b4fa4(0x14d)])_0x4de1a1('failed',_0x3dad72,_0x17ba46?.[_0x5b4fa4(0x14d)]||_0x5b4fa4(0x174),_0x5b4fa4(0x172));else _0x4de1a1(_0x5b4fa4(0x16b),null,_0x5b4fa4(0x157),_0x5b4fa4(0x183));}return _0x17ba46;}catch(_0x346787){throw _0x4de1a1(_0x5b4fa4(0x16b),null,_0x346787,_0x5b4fa4(0x132)),_0x346787;}}async function Y(_0x4c0539,_0x283a1a){const _0x2b5f1f=a0_0x42c9ed;return X({'fromAlias':_0x4c0539['fromAlias'],'toAlias':_0x4c0539['alias'],'parentTaskId':_0x4c0539['parentTaskId']||null,'networkId':_0x4c0539['networkId']||null,'transport':_0x2b5f1f(0x15f),'lifecycleTracking':_0x2b5f1f(0x17e)},_0x283a1a);}class $ extends a0_0x6fe51b{['url'];[a0_0x42c9ed(0x186)];[a0_0x42c9ed(0x12d)];['agent'];[a0_0x42c9ed(0x119)];['heartbeatInterval'];[a0_0x42c9ed(0x11d)];[a0_0x42c9ed(0x165)];['sseAbort'];[a0_0x42c9ed(0x19d)]=!0x1;constructor(_0x5486b7){const _0x17ef7d=a0_0x42c9ed;super();if(this[_0x17ef7d(0x180)]=_0x5486b7['url'][_0x17ef7d(0x160)](/\/$/,''),this['alias']=_0x5486b7[_0x17ef7d(0x186)],this[_0x17ef7d(0x12d)]=_0x5486b7['token'],this[_0x17ef7d(0x164)]=_0x5486b7[_0x17ef7d(0x164)]||_0x17ef7d(0x173),this[_0x17ef7d(0x119)]=_0x17ef7d(0x155)+_0x5486b7['alias']+'-'+Date[_0x17ef7d(0x159)]()[_0x17ef7d(0x187)](0x24),this['heartbeatInterval']=_0x5486b7['heartbeatInterval']??0x2bf20,this[_0x17ef7d(0x11d)]=_0x5486b7[_0x17ef7d(0x11d)]??0xbb8,_0x5486b7[_0x17ef7d(0x14c)]!==!0x1)this[_0x17ef7d(0x16e)]();}[a0_0x42c9ed(0x122)](_0x28ef3c){const _0x64636e=a0_0x42c9ed;console['log']('['+new Date()[_0x64636e(0x140)]()['slice'](0x0,0x8)+_0x64636e(0x143)+this[_0x64636e(0x186)]+']\x20'+_0x28ef3c);}async[a0_0x42c9ed(0x19e)](_0x1a67b6,_0x1c7d6b){const _0x9e7a0e=a0_0x42c9ed;let _0x456a3f={'Content-Type':_0x9e7a0e(0x124),'Accept':'application/json,\x20text/event-stream'};if(this[_0x9e7a0e(0x12d)])_0x456a3f[_0x9e7a0e(0x11e)]=_0x9e7a0e(0x11f)+this[_0x9e7a0e(0x12d)];let _0xe3e043=await(await fetch(this['url']+_0x9e7a0e(0x17b),{'method':_0x9e7a0e(0x11a),'headers':_0x456a3f,'body':JSON[_0x9e7a0e(0x126)]({'jsonrpc':_0x9e7a0e(0x17f),'id':Date['now'](),'method':_0x9e7a0e(0x13c),'params':{'name':_0x1a67b6,'arguments':_0x1c7d6b}})}))[_0x9e7a0e(0x12e)](),_0x2d3250=_0xe3e043[_0x9e7a0e(0x18c)](/data: (.+)/),_0x29e73d=_0x2d3250?JSON[_0x9e7a0e(0x14f)](_0x2d3250[0x1]):JSON[_0x9e7a0e(0x14f)](_0xe3e043),_0x1204a4=_0x29e73d?.['result']?.[_0x9e7a0e(0x148)]?.[0x0]?.['text'];return _0x1204a4?JSON['parse'](_0x1204a4):_0x29e73d;}async[a0_0x42c9ed(0x16e)](){const _0x18d1b4=a0_0x42c9ed;if(this[_0x18d1b4(0x19d)])return;this[_0x18d1b4(0x19d)]=!0x0,await this[_0x18d1b4(0x189)]('idle'),this[_0x18d1b4(0x122)](_0x18d1b4(0x197)),this[_0x18d1b4(0x165)]=setInterval(()=>{const _0x70ae0b=_0x18d1b4;this['status'](_0x70ae0b(0x161))[_0x70ae0b(0x128)](_0x33d37a=>this[_0x70ae0b(0x122)](_0x70ae0b(0x12b)+_0x33d37a[_0x70ae0b(0x142)]));},this[_0x18d1b4(0x13d)]),this['connectSSE']();}async[a0_0x42c9ed(0x133)](){const _0x887604=a0_0x42c9ed;if(this['running']=!0x1,this['sseAbort']?.[_0x887604(0x195)](),this[_0x887604(0x165)])clearInterval(this[_0x887604(0x165)]);await this[_0x887604(0x189)](_0x887604(0x15e))[_0x887604(0x128)](()=>{}),this[_0x887604(0x122)](_0x887604(0x13e));}async[a0_0x42c9ed(0x15c)](_0x4b2b84,_0x1b7aad,_0x3eff47=a0_0x42c9ed(0x14b)){const _0x164a9d=a0_0x42c9ed;return Y({'alias':_0x4b2b84,'fromAlias':this[_0x164a9d(0x186)]},{'log':_0xef5135=>console[_0x164a9d(0x122)](_0xef5135),'send':()=>this['call'](_0x164a9d(0x136),{'alias':_0x4b2b84,'task':_0x1b7aad,'priority':_0x3eff47,'from_session':this['alias']})});}async[a0_0x42c9ed(0x142)](_0xfaedd6,_0xeabdda){const _0x17165b=a0_0x42c9ed;return this[_0x17165b(0x19e)](_0x17165b(0x127),{'alias':_0xfaedd6,'message':_0xeabdda,'from_session':this[_0x17165b(0x186)]});}async[a0_0x42c9ed(0x15d)](_0x3fa6fe,_0x45500e,_0x544fb5='completed'){const _0x3a2c76=a0_0x42c9ed;return this[_0x3a2c76(0x19e)](_0x3a2c76(0x144),{'in_reply_to':_0x3fa6fe,'text':_0x45500e,'status':_0x544fb5});}async[a0_0x42c9ed(0x189)](_0xb9a159,_0x179aa3){const _0x296e55=a0_0x42c9ed;return this[_0x296e55(0x19e)](_0x296e55(0x139),{'resume_id':this[_0x296e55(0x119)],'alias':this[_0x296e55(0x186)],'status':_0xb9a159,'server':a0_0xff0b17(),'hostname':a0_0xff0b17(),'agent':this[_0x296e55(0x164)],'project_dir':process['cwd'](),..._0x179aa3});}async[a0_0x42c9ed(0x125)](){const _0x2f3a1e=a0_0x42c9ed;return this[_0x2f3a1e(0x19e)](_0x2f3a1e(0x176),{});}async[a0_0x42c9ed(0x11c)](_0x168350,_0x3142c6){const _0x27864c=a0_0x42c9ed;return this[_0x27864c(0x19e)](_0x27864c(0x11c),{'message':_0x168350,'filter_server':_0x3142c6?.[_0x27864c(0x15b)],'filter_status':_0x3142c6?.['status']});}async[a0_0x42c9ed(0x19b)](){const _0x570fc4=a0_0x42c9ed;let _0x8e86fb=encodeURIComponent(this[_0x570fc4(0x186)]),_0x13a2fc=this[_0x570fc4(0x180)]+_0x570fc4(0x167)+_0x8e86fb,_0x52d341=this[_0x570fc4(0x11d)];while(this[_0x570fc4(0x19d)]){try{this[_0x570fc4(0x145)]=new AbortController();let _0x5e4641={'Accept':_0x570fc4(0x120)};if(this[_0x570fc4(0x12d)])_0x5e4641[_0x570fc4(0x11e)]=_0x570fc4(0x11f)+this['token'];let _0x493d7f=await fetch(_0x13a2fc,{'headers':_0x5e4641,'signal':this[_0x570fc4(0x145)]['signal']});if(!_0x493d7f['ok']||!_0x493d7f['body']){this[_0x570fc4(0x122)]('SSE\x20failed:\x20'+_0x493d7f[_0x570fc4(0x189)]),await this[_0x570fc4(0x12f)](_0x52d341),_0x52d341=Math[_0x570fc4(0x194)](_0x52d341*1.5,0xea60);continue;}_0x52d341=this['reconnectDelay'];let _0x328f84=_0x493d7f[_0x570fc4(0x134)]['getReader'](),_0x4f5c17=new TextDecoder(),_0x47d535='';while(this[_0x570fc4(0x19d)]){let {done:_0x1fc969,value:_0x176da8}=await _0x328f84[_0x570fc4(0x16a)]();if(_0x1fc969)break;_0x47d535+=_0x4f5c17[_0x570fc4(0x12c)](_0x176da8,{'stream':!0x0});let _0xa780db=_0x47d535[_0x570fc4(0x129)]('\x0a');_0x47d535=_0xa780db['pop']()||'';for(let _0x4ea3ae of _0xa780db){if(!_0x4ea3ae['startsWith'](_0x570fc4(0x170)))continue;try{let _0x1b644d=JSON[_0x570fc4(0x14f)](_0x4ea3ae[_0x570fc4(0x193)](0x6));if(_0x1b644d[_0x570fc4(0x18f)]==='connected'){this['log'](_0x570fc4(0x166)),this[_0x570fc4(0x198)](_0x570fc4(0x18e));continue;}if(_0x1b644d[_0x570fc4(0x18f)]==='new_task'||_0x1b644d['type']===_0x570fc4(0x123)||_0x1b644d[_0x570fc4(0x18f)]===_0x570fc4(0x11c))await this[_0x570fc4(0x17c)]();}catch{}}}}catch(_0x546b46){if(_0x546b46[_0x570fc4(0x192)]==='AbortError')break;this['emit'](_0x570fc4(0x14d),_0x546b46),this[_0x570fc4(0x122)](_0x570fc4(0x16d)+_0x546b46[_0x570fc4(0x142)]);}if(this[_0x570fc4(0x19d)])this[_0x570fc4(0x198)](_0x570fc4(0x13e)),this[_0x570fc4(0x122)](_0x570fc4(0x152)+_0x52d341/0x3e8+_0x570fc4(0x14a)),await this[_0x570fc4(0x12f)](_0x52d341),_0x52d341=Math[_0x570fc4(0x194)](_0x52d341*1.5,0xea60);}}async[a0_0x42c9ed(0x17c)](){const _0xf37cc6=a0_0x42c9ed;try{let _0x402f5c=(await this[_0xf37cc6(0x19e)]('get_inbox',{'alias':this[_0xf37cc6(0x186)],'limit':0xa}))?.[_0xf37cc6(0x19c)]||[];for(let _0x1df0f3 of _0x402f5c)await this[_0xf37cc6(0x19e)](_0xf37cc6(0x158),{'alias':this[_0xf37cc6(0x186)],'message_id':_0x1df0f3['id']}),this[_0xf37cc6(0x122)]('←\x20'+_0x1df0f3[_0xf37cc6(0x13a)]+':\x20'+_0x1df0f3[_0xf37cc6(0x148)]['slice'](0x0,0x3c)),this[_0xf37cc6(0x198)](_0xf37cc6(0x184),_0x1df0f3),this[_0xf37cc6(0x198)](_0xf37cc6(0x142),_0x1df0f3);}catch(_0x218562){this[_0xf37cc6(0x122)](_0xf37cc6(0x196)+_0x218562[_0xf37cc6(0x142)]);}}[a0_0x42c9ed(0x12f)](_0x250072){return new Promise(_0x18be5b=>setTimeout(_0x18be5b,_0x250072));}}var F=$;export{F as default,$ as CommHub};
|