@sleep2agi/agent-network 2.3.0-preview.53 → 2.3.0-preview.55
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_0x2a613d=a0_0x133d;(function(_0x21ee4a,_0x3ccdd9){const _0x46be73=a0_0x133d,_0x1e840c=_0x21ee4a();while(!![]){try{const _0x422612=-parseInt(_0x46be73(0x223))/0x1+-parseInt(_0x46be73(0x260))/0x2+parseInt(_0x46be73(0x23e))/0x3+-parseInt(_0x46be73(0x1f1))/0x4*(-parseInt(_0x46be73(0x256))/0x5)+parseInt(_0x46be73(0x1f4))/0x6+-parseInt(_0x46be73(0x23f))/0x7+parseInt(_0x46be73(0x216))/0x8*(parseInt(_0x46be73(0x211))/0x9);if(_0x422612===_0x3ccdd9)break;else _0x1e840c['push'](_0x1e840c['shift']());}catch(_0x36ea20){_0x1e840c['push'](_0x1e840c['shift']());}}}(a0_0x3a99,0x7e9cd));import{EventEmitter as a0_0x3b2def}from'events';import{hostname as a0_0x23e654}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x222d0a,_0x2f8cd2)=>(_0x222d0a??_0x2f8cd2)[a0_0x2a613d(0x247)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x2a613d(0x1e7)](0x0,0xf0);function N(_0x4919a0){const _0x41c93e=a0_0x2a613d;return(_0x4919a0 instanceof Error?_0x4919a0[_0x41c93e(0x249)]:String(_0x4919a0??_0x41c93e(0x214)))['replace'](K,_0x41c93e(0x242))[_0x41c93e(0x247)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x41c93e(0x1e7)](0x0,0xf0);}function a0_0x3a99(){const _0x267a7c=['disconnected','\x20to=','\x20network_id=','resumeId','[commhub:task]\x20','new_task','task.send.start','stringify','transport','connect','AbortError','lifecycle_tracking','networkId','network_id','url','autoConnect','reconnectDelay','match','send_reply','offline','pop','error_code','running','parent_task_id','data:\x20','9hCMRst','log','send_failed','unknown\x20error','ack_inbox','7001144IVrzkL',']\x20[commhub:','2.0','error_message','connectSSE','call','send_task','SSE\x20connected','SSE\x20reconnecting\x20in\x20','failed','sseAbort','SSE\x20error:\x20','send','935313rCwsZO','error','now','broadcast','json','content','\x20error=','sleep','application/json,\x20text/event-stream','sdk','startsWith','emit','text','registered','processInbox','Authorization','min','abort','\x20from=','token','from_alias','<unknown>','completed','get_inbox','parse','send_message','\x20transport=','1702575ZvBXMR','2665019HBrCHz','SSE\x20failed:\x20','to_alias','[REDACTED]','message_id','CommHub\x20response\x20omitted\x20task_id','toTimeString','connected','replace','<pending>','message','missing_task_id','read','heartbeatInterval','disconnect','alias','not_tracked','decode','name','\x20lifecycle=','get_all_status','string','cwd','665290xsiQId','heartbeat\x20failed:\x20','status','new_message','<missing>','task.started','messages','task.replied','result','heartbeatTimer','1583384xOTRJI','inbox\x20error:\x20','sdk-','task','/mcp','slice','POST','task_id','split','catch','task.send.failed','Bearer\x20','mcp_http','toString','duration_ms','28glJeOq','idle','s...','1513518iwyyip','parentTaskId','body','agent'];a0_0x3a99=function(){return _0x267a7c;};return a0_0x3a99();}function O(_0x3189d5,_0x11f8a4=process.env.ANET_TASK_TRACE_FORMAT===a0_0x2a613d(0x227)){const _0x288eb1=a0_0x2a613d;if(_0x11f8a4)return JSON[_0x288eb1(0x1ff)](_0x3189d5);let _0x49f72f=L(_0x3189d5[_0x288eb1(0x20f)],_0x288eb1(0x25a)),_0x45cc9=L(_0x3189d5[_0x288eb1(0x1e9)],_0x288eb1(0x248)),_0x4bc272=_0x3189d5[_0x288eb1(0x20d)]?_0x288eb1(0x229)+_0x3189d5[_0x288eb1(0x20d)]+':'+(_0x3189d5[_0x288eb1(0x219)]??''):'';return _0x288eb1(0x1fc)+_0x3189d5[_0x288eb1(0x258)]+_0x288eb1(0x235)+L(_0x3189d5[_0x288eb1(0x237)],_0x288eb1(0x238))+_0x288eb1(0x1f9)+L(_0x3189d5[_0x288eb1(0x241)],_0x288eb1(0x238))+'\x20task_id='+_0x45cc9+'\x20parent_task_id='+_0x49f72f+_0x288eb1(0x1fa)+L(_0x3189d5[_0x288eb1(0x205)],_0x288eb1(0x238))+_0x288eb1(0x23d)+_0x3189d5[_0x288eb1(0x200)]+'\x20duration_ms='+_0x3189d5[_0x288eb1(0x1f0)]+_0x288eb1(0x252)+_0x3189d5[_0x288eb1(0x203)]+_0x4bc272;}function U(_0x438ae6){const _0x3c274c=a0_0x2a613d;return{'event':{'sending':_0x3c274c(0x1fe),'delivered':'task.send.delivered','failed':_0x3c274c(0x1ec),'acked':'task.ack','started':_0x3c274c(0x25b),'replied':_0x3c274c(0x25d),'expired':'task.expired'}[_0x438ae6[_0x3c274c(0x258)]],..._0x438ae6};}function j(_0x35c883){const _0x50c488=a0_0x2a613d;let _0x374345=_0x35c883?.[_0x50c488(0x1e9)]||_0x35c883?.[_0x50c488(0x243)]||_0x35c883?.['id'];if(_0x374345)return String(_0x374345);let _0x28329e=_0x35c883?.[_0x50c488(0x228)]?.[0x0]?.[_0x50c488(0x22f)];if(typeof _0x28329e!==_0x50c488(0x254))return null;try{let _0x2aa83d=JSON[_0x50c488(0x23b)](_0x28329e);return _0x2aa83d?.['task_id']||_0x2aa83d?.[_0x50c488(0x243)]||_0x2aa83d?.['id']||null;}catch{return null;}}async function X(_0x3b4153,_0x1b303c){const _0x273e3b=a0_0x2a613d;let _0x3ee895=_0x1b303c['now']??Date[_0x273e3b(0x225)],_0x2f7c29=_0x3ee895(),_0x5183f1=(_0x3a5e2c,_0x3fecd7,_0x181117,_0x3a4385)=>{const _0x26cd14=_0x273e3b;_0x1b303c[_0x26cd14(0x212)](O(U({'from_alias':_0x3b4153['fromAlias'],'to_alias':_0x3b4153['toAlias'],'task_id':_0x3fecd7,'parent_task_id':_0x3b4153[_0x26cd14(0x1f5)],'network_id':_0x3b4153[_0x26cd14(0x204)],'transport':_0x3b4153['transport'],'status':_0x3a5e2c,'duration_ms':_0x3ee895()-_0x2f7c29,'lifecycle_tracking':_0x3b4153['lifecycleTracking'],..._0x181117!==void 0x0?{'error_code':_0x3a4385||'send_failed','error_message':N(_0x181117)}:{}})));};_0x5183f1('sending',null);try{let _0x34623d=await _0x1b303c[_0x273e3b(0x222)](),_0x360a12=j(_0x34623d);if(_0x360a12)_0x5183f1('delivered',_0x360a12);else{if(_0x34623d?.['ok']===!0x1||_0x34623d?.['error'])_0x5183f1('failed',_0x360a12,_0x34623d?.['error']||'CommHub\x20rejected\x20task','send_rejected');else _0x5183f1(_0x273e3b(0x21f),null,_0x273e3b(0x244),_0x273e3b(0x24a));}return _0x34623d;}catch(_0x4e3b61){throw _0x5183f1(_0x273e3b(0x21f),null,_0x4e3b61,_0x273e3b(0x213)),_0x4e3b61;}}async function Y(_0x8c6ff7,_0x5dd545){const _0x525d74=a0_0x2a613d;return X({'fromAlias':_0x8c6ff7['fromAlias'],'toAlias':_0x8c6ff7[_0x525d74(0x24e)],'parentTaskId':_0x8c6ff7[_0x525d74(0x1f5)]||null,'networkId':_0x8c6ff7[_0x525d74(0x204)]||null,'transport':_0x525d74(0x1ee),'lifecycleTracking':_0x525d74(0x24f)},_0x5dd545);}class $ extends a0_0x3b2def{[a0_0x2a613d(0x206)];['alias'];[a0_0x2a613d(0x236)];['agent'];[a0_0x2a613d(0x1fb)];[a0_0x2a613d(0x24c)];[a0_0x2a613d(0x208)];[a0_0x2a613d(0x25f)];[a0_0x2a613d(0x220)];['running']=!0x1;constructor(_0x583938){const _0x3693b0=a0_0x2a613d;super();if(this[_0x3693b0(0x206)]=_0x583938[_0x3693b0(0x206)]['replace'](/\/$/,''),this[_0x3693b0(0x24e)]=_0x583938[_0x3693b0(0x24e)],this[_0x3693b0(0x236)]=_0x583938[_0x3693b0(0x236)],this['agent']=_0x583938[_0x3693b0(0x1f7)]||_0x3693b0(0x22c),this[_0x3693b0(0x1fb)]=_0x3693b0(0x262)+_0x583938[_0x3693b0(0x24e)]+'-'+Date['now']()[_0x3693b0(0x1ef)](0x24),this[_0x3693b0(0x24c)]=_0x583938[_0x3693b0(0x24c)]??0x2bf20,this['reconnectDelay']=_0x583938['reconnectDelay']??0xbb8,_0x583938[_0x3693b0(0x207)]!==!0x1)this['connect']();}['log'](_0x1c297c){const _0xece31d=a0_0x2a613d;console[_0xece31d(0x212)]('['+new Date()[_0xece31d(0x245)]()[_0xece31d(0x1e7)](0x0,0x8)+_0xece31d(0x217)+this[_0xece31d(0x24e)]+']\x20'+_0x1c297c);}async['call'](_0x468444,_0x453ef1){const _0x46c5c0=a0_0x2a613d;let _0x5ccbcd={'Content-Type':'application/json','Accept':_0x46c5c0(0x22b)};if(this[_0x46c5c0(0x236)])_0x5ccbcd[_0x46c5c0(0x232)]=_0x46c5c0(0x1ed)+this[_0x46c5c0(0x236)];let _0x3eda58=await(await fetch(this[_0x46c5c0(0x206)]+_0x46c5c0(0x264),{'method':_0x46c5c0(0x1e8),'headers':_0x5ccbcd,'body':JSON[_0x46c5c0(0x1ff)]({'jsonrpc':_0x46c5c0(0x218),'id':Date[_0x46c5c0(0x225)](),'method':'tools/call','params':{'name':_0x468444,'arguments':_0x453ef1}})}))['text'](),_0x43cad8=_0x3eda58[_0x46c5c0(0x209)](/data: (.+)/),_0xf2ddc=_0x43cad8?JSON['parse'](_0x43cad8[0x1]):JSON['parse'](_0x3eda58),_0x522c76=_0xf2ddc?.[_0x46c5c0(0x25e)]?.[_0x46c5c0(0x228)]?.[0x0]?.[_0x46c5c0(0x22f)];return _0x522c76?JSON[_0x46c5c0(0x23b)](_0x522c76):_0xf2ddc;}async[a0_0x2a613d(0x201)](){const _0x3faaff=a0_0x2a613d;if(this[_0x3faaff(0x20e)])return;this[_0x3faaff(0x20e)]=!0x0,await this[_0x3faaff(0x258)](_0x3faaff(0x1f2)),this[_0x3faaff(0x212)](_0x3faaff(0x230)),this[_0x3faaff(0x25f)]=setInterval(()=>{const _0x29f5a8=_0x3faaff;this[_0x29f5a8(0x258)](_0x29f5a8(0x1f2))[_0x29f5a8(0x1eb)](_0x3ab0ed=>this['log'](_0x29f5a8(0x257)+_0x3ab0ed['message']));},this[_0x3faaff(0x24c)]),this[_0x3faaff(0x21a)]();}async[a0_0x2a613d(0x24d)](){const _0x7c2113=a0_0x2a613d;if(this[_0x7c2113(0x20e)]=!0x1,this[_0x7c2113(0x220)]?.[_0x7c2113(0x234)](),this['heartbeatTimer'])clearInterval(this[_0x7c2113(0x25f)]);await this['status'](_0x7c2113(0x20b))[_0x7c2113(0x1eb)](()=>{}),this[_0x7c2113(0x212)](_0x7c2113(0x1f8));}async[a0_0x2a613d(0x222)](_0x4670c4,_0x125850,_0x492961='normal'){const _0x547ce8=a0_0x2a613d;return Y({'alias':_0x4670c4,'fromAlias':this[_0x547ce8(0x24e)]},{'log':_0xf5013f=>console[_0x547ce8(0x212)](_0xf5013f),'send':()=>this[_0x547ce8(0x21b)](_0x547ce8(0x21c),{'alias':_0x4670c4,'task':_0x125850,'priority':_0x492961,'from_session':this[_0x547ce8(0x24e)]})});}async[a0_0x2a613d(0x249)](_0x76472d,_0x56f100){const _0x219c81=a0_0x2a613d;return this[_0x219c81(0x21b)](_0x219c81(0x23c),{'alias':_0x76472d,'message':_0x56f100,'from_session':this['alias']});}async['reply'](_0xaa92b2,_0x2627be,_0x82600e=a0_0x2a613d(0x239)){const _0x572c1e=a0_0x2a613d;return this[_0x572c1e(0x21b)](_0x572c1e(0x20a),{'in_reply_to':_0xaa92b2,'text':_0x2627be,'status':_0x82600e});}async[a0_0x2a613d(0x258)](_0x53b22c,_0x5efec6){const _0x320fe6=a0_0x2a613d;return this[_0x320fe6(0x21b)]('report_status',{'resume_id':this['resumeId'],'alias':this[_0x320fe6(0x24e)],'status':_0x53b22c,'server':a0_0x23e654(),'hostname':a0_0x23e654(),'agent':this['agent'],'project_dir':process[_0x320fe6(0x255)](),..._0x5efec6});}async['getAllStatus'](){const _0x29315a=a0_0x2a613d;return this[_0x29315a(0x21b)](_0x29315a(0x253),{});}async[a0_0x2a613d(0x226)](_0x2c417c,_0x2b2b07){const _0x18ecb5=a0_0x2a613d;return this[_0x18ecb5(0x21b)](_0x18ecb5(0x226),{'message':_0x2c417c,'filter_server':_0x2b2b07?.['server'],'filter_status':_0x2b2b07?.[_0x18ecb5(0x258)]});}async[a0_0x2a613d(0x21a)](){const _0xee2f40=a0_0x2a613d;let _0x221a99=encodeURIComponent(this[_0xee2f40(0x24e)]),_0x3d6c2c=this[_0xee2f40(0x206)]+'/events/'+_0x221a99,_0x2f337e=this[_0xee2f40(0x208)];while(this[_0xee2f40(0x20e)]){try{this[_0xee2f40(0x220)]=new AbortController();let _0x51463e={'Accept':'text/event-stream'};if(this[_0xee2f40(0x236)])_0x51463e[_0xee2f40(0x232)]=_0xee2f40(0x1ed)+this['token'];let _0x7a6d5d=await fetch(_0x3d6c2c,{'headers':_0x51463e,'signal':this[_0xee2f40(0x220)]['signal']});if(!_0x7a6d5d['ok']||!_0x7a6d5d[_0xee2f40(0x1f6)]){this[_0xee2f40(0x212)](_0xee2f40(0x240)+_0x7a6d5d[_0xee2f40(0x258)]),await this[_0xee2f40(0x22a)](_0x2f337e),_0x2f337e=Math['min'](_0x2f337e*1.5,0xea60);continue;}_0x2f337e=this[_0xee2f40(0x208)];let _0x1d6a01=_0x7a6d5d[_0xee2f40(0x1f6)]['getReader'](),_0x263710=new TextDecoder(),_0x32dda3='';while(this[_0xee2f40(0x20e)]){let {done:_0xe88a56,value:_0x1b6072}=await _0x1d6a01[_0xee2f40(0x24b)]();if(_0xe88a56)break;_0x32dda3+=_0x263710[_0xee2f40(0x250)](_0x1b6072,{'stream':!0x0});let _0x23544f=_0x32dda3[_0xee2f40(0x1ea)]('\x0a');_0x32dda3=_0x23544f[_0xee2f40(0x20c)]()||'';for(let _0x370a80 of _0x23544f){if(!_0x370a80[_0xee2f40(0x22d)](_0xee2f40(0x210)))continue;try{let _0x402b0f=JSON[_0xee2f40(0x23b)](_0x370a80['slice'](0x6));if(_0x402b0f['type']===_0xee2f40(0x246)){this[_0xee2f40(0x212)](_0xee2f40(0x21d)),this[_0xee2f40(0x22e)]('connected');continue;}if(_0x402b0f['type']===_0xee2f40(0x1fd)||_0x402b0f['type']===_0xee2f40(0x259)||_0x402b0f['type']===_0xee2f40(0x226))await this[_0xee2f40(0x231)]();}catch{}}}}catch(_0xb203e3){if(_0xb203e3[_0xee2f40(0x251)]===_0xee2f40(0x202))break;this[_0xee2f40(0x22e)](_0xee2f40(0x224),_0xb203e3),this[_0xee2f40(0x212)](_0xee2f40(0x221)+_0xb203e3[_0xee2f40(0x249)]);}if(this[_0xee2f40(0x20e)])this[_0xee2f40(0x22e)](_0xee2f40(0x1f8)),this[_0xee2f40(0x212)](_0xee2f40(0x21e)+_0x2f337e/0x3e8+_0xee2f40(0x1f3)),await this[_0xee2f40(0x22a)](_0x2f337e),_0x2f337e=Math[_0xee2f40(0x233)](_0x2f337e*1.5,0xea60);}}async[a0_0x2a613d(0x231)](){const _0x516f40=a0_0x2a613d;try{let _0x71c829=(await this[_0x516f40(0x21b)](_0x516f40(0x23a),{'alias':this[_0x516f40(0x24e)],'limit':0xa}))?.[_0x516f40(0x25c)]||[];for(let _0x4a8d6d of _0x71c829)await this['call'](_0x516f40(0x215),{'alias':this[_0x516f40(0x24e)],'message_id':_0x4a8d6d['id']}),this['log']('←\x20'+_0x4a8d6d['from_session']+':\x20'+_0x4a8d6d[_0x516f40(0x228)][_0x516f40(0x1e7)](0x0,0x3c)),this['emit'](_0x516f40(0x263),_0x4a8d6d),this['emit'](_0x516f40(0x249),_0x4a8d6d);}catch(_0xc3a0ff){this[_0x516f40(0x212)](_0x516f40(0x261)+_0xc3a0ff[_0x516f40(0x249)]);}}[a0_0x2a613d(0x22a)](_0x4c06c2){return new Promise(_0x5605e3=>setTimeout(_0x5605e3,_0x4c06c2));}}var F=$;function a0_0x133d(_0x461188,_0x53caa5){_0x461188=_0x461188-0x1e7;const _0x3a9958=a0_0x3a99();let _0x133dde=_0x3a9958[_0x461188];return _0x133dde;}export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x30a80e=a0_0x198e;(function(_0x51b88b,_0x35a639){const _0x229363=a0_0x198e,_0x21f58f=_0x51b88b();while(!![]){try{const _0x20d2b5=parseInt(_0x229363(0x14b))/0x1+-parseInt(_0x229363(0x11e))/0x2*(-parseInt(_0x229363(0x146))/0x3)+-parseInt(_0x229363(0x168))/0x4*(parseInt(_0x229363(0x14c))/0x5)+parseInt(_0x229363(0x186))/0x6*(-parseInt(_0x229363(0x151))/0x7)+-parseInt(_0x229363(0x118))/0x8+parseInt(_0x229363(0x169))/0x9*(-parseInt(_0x229363(0x161))/0xa)+parseInt(_0x229363(0x111))/0xb;if(_0x20d2b5===_0x35a639)break;else _0x21f58f['push'](_0x21f58f['shift']());}catch(_0x5221dc){_0x21f58f['push'](_0x21f58f['shift']());}}}(a0_0x1e59,0xbc8f6));import{EventEmitter as a0_0xaa6cc3}from'events';import{hostname as a0_0x4cef47}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x16d387,_0x3543ea)=>(_0x16d387??_0x3543ea)[a0_0x30a80e(0x109)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);function N(_0x5a9fed){const _0x16f0d2=a0_0x30a80e;return(_0x5a9fed instanceof Error?_0x5a9fed[_0x16f0d2(0x157)]:String(_0x5a9fed??_0x16f0d2(0x159)))['replace'](K,_0x16f0d2(0x162))[_0x16f0d2(0x109)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x16f0d2(0x172)](0x0,0xf0);}function O(_0x18a0fe,_0x38fb1c=process.env.ANET_TASK_TRACE_FORMAT===a0_0x30a80e(0x148)){const _0x719f15=a0_0x30a80e;if(_0x38fb1c)return JSON[_0x719f15(0x179)](_0x18a0fe);let _0x542739=L(_0x18a0fe[_0x719f15(0x12b)],_0x719f15(0x165)),_0x4b1f23=L(_0x18a0fe[_0x719f15(0x156)],'<pending>'),_0xc4e92b=_0x18a0fe[_0x719f15(0x117)]?_0x719f15(0x11a)+_0x18a0fe['error_code']+':'+(_0x18a0fe[_0x719f15(0x164)]??''):'';return _0x719f15(0x119)+_0x18a0fe[_0x719f15(0x182)]+_0x719f15(0x11b)+L(_0x18a0fe[_0x719f15(0x153)],_0x719f15(0x14a))+_0x719f15(0x15a)+L(_0x18a0fe[_0x719f15(0x14e)],_0x719f15(0x14a))+_0x719f15(0x16f)+_0x4b1f23+'\x20parent_task_id='+_0x542739+_0x719f15(0x176)+L(_0x18a0fe['network_id'],_0x719f15(0x14a))+_0x719f15(0x131)+_0x18a0fe['transport']+_0x719f15(0x180)+_0x18a0fe[_0x719f15(0x107)]+_0x719f15(0x17b)+_0x18a0fe[_0x719f15(0x12e)]+_0xc4e92b;}function U(_0x329328){const _0x3f8c72=a0_0x30a80e;return{'event':{'sending':'task.send.start','delivered':_0x3f8c72(0x155),'failed':_0x3f8c72(0x145),'acked':_0x3f8c72(0x16a),'started':_0x3f8c72(0x14f),'replied':_0x3f8c72(0x134),'expired':'task.expired'}[_0x329328[_0x3f8c72(0x182)]],..._0x329328};}function a0_0x1e59(){const _0x450bd2=['new_message','decode','match','Authorization','\x20duration_ms=','alias','status','messages','agent',']\x20[commhub:','12ZjCYbe','signal','split','duration_ms','registered','replace','url','report_status','sseAbort','transport','normal','text','s...','25661196nUiXIH','SSE\x20reconnecting\x20in\x20','SSE\x20failed:\x20','send_reply','ack_inbox','call','error_code','11567608WjghbQ','[commhub:task]\x20','\x20error=','\x20from=','min','read','2pPddba','toAlias','send','reply','SSE\x20error:\x20','sleep','missing_task_id','content','not_tracked','parentTaskId','from_session','application/json','disconnected','parent_task_id','connect','CommHub\x20rejected\x20task','lifecycle_tracking','reconnectDelay','heartbeatTimer','\x20transport=','delivered','now','task.replied','task','CommHub\x20response\x20omitted\x20task_id','broadcast','processInbox','resumeId','networkId','catch','autoConnect','string','inbox\x20error:\x20','completed','mcp_http','body','parse','cwd','offline','task.send.failed','3433215zrMTWA','lifecycleTracking','json','text/event-stream','<unknown>','1323425DAodZK','2015BsKaRK','type','to_alias','task.started','POST','2503921YePYts','send_rejected','from_alias','send_message','task.send.delivered','task_id','message','emit','unknown\x20error','\x20to=','running','disconnect','toTimeString','log','Bearer\x20','connectSSE','20PiBhva','[REDACTED]','data:\x20','error_message','<missing>','get_inbox','error','6108IRVZOu','5632137fZpPZH','task.ack','new_task','heartbeatInterval','sending','message_id','\x20task_id=','startsWith','idle','slice','failed','connected','getAllStatus','\x20network_id=','sdk-','token','stringify','SSE\x20connected','\x20lifecycle='];a0_0x1e59=function(){return _0x450bd2;};return a0_0x1e59();}function j(_0x58100f){const _0x2c9288=a0_0x30a80e;let _0x5a53d8=_0x58100f?.['task_id']||_0x58100f?.[_0x2c9288(0x16e)]||_0x58100f?.['id'];if(_0x5a53d8)return String(_0x5a53d8);let _0x44858b=_0x58100f?.[_0x2c9288(0x125)]?.[0x0]?.['text'];if(typeof _0x44858b!==_0x2c9288(0x13d))return null;try{let _0x29aab2=JSON[_0x2c9288(0x142)](_0x44858b);return _0x29aab2?.[_0x2c9288(0x156)]||_0x29aab2?.[_0x2c9288(0x16e)]||_0x29aab2?.['id']||null;}catch{return null;}}async function X(_0x343eee,_0x64bb6f){const _0x549b4e=a0_0x30a80e;let _0x255b64=_0x64bb6f[_0x549b4e(0x133)]??Date['now'],_0x48c745=_0x255b64(),_0x18da47=(_0x5b8120,_0xa1346,_0x4ff74a,_0x345005)=>{const _0x336f56=_0x549b4e;_0x64bb6f['log'](O(U({'from_alias':_0x343eee['fromAlias'],'to_alias':_0x343eee[_0x336f56(0x11f)],'task_id':_0xa1346,'parent_task_id':_0x343eee[_0x336f56(0x127)],'network_id':_0x343eee[_0x336f56(0x13a)],'transport':_0x343eee[_0x336f56(0x10d)],'status':_0x5b8120,'duration_ms':_0x255b64()-_0x48c745,'lifecycle_tracking':_0x343eee[_0x336f56(0x147)],..._0x4ff74a!==void 0x0?{'error_code':_0x345005||'send_failed','error_message':N(_0x4ff74a)}:{}})));};_0x18da47(_0x549b4e(0x16d),null);try{let _0x5f179c=await _0x64bb6f['send'](),_0xc72e40=j(_0x5f179c);if(_0xc72e40)_0x18da47(_0x549b4e(0x132),_0xc72e40);else{if(_0x5f179c?.['ok']===!0x1||_0x5f179c?.[_0x549b4e(0x167)])_0x18da47(_0x549b4e(0x173),_0xc72e40,_0x5f179c?.['error']||_0x549b4e(0x12d),_0x549b4e(0x152));else _0x18da47(_0x549b4e(0x173),null,_0x549b4e(0x136),_0x549b4e(0x124));}return _0x5f179c;}catch(_0x19a863){throw _0x18da47(_0x549b4e(0x173),null,_0x19a863,'send_failed'),_0x19a863;}}function a0_0x198e(_0x35e674,_0xbd5336){_0x35e674=_0x35e674-0x106;const _0x1e59de=a0_0x1e59();let _0x198ecd=_0x1e59de[_0x35e674];return _0x198ecd;}async function Y(_0x1c5871,_0x439ee2){const _0x2af831=a0_0x30a80e;return X({'fromAlias':_0x1c5871['fromAlias'],'toAlias':_0x1c5871[_0x2af831(0x181)],'parentTaskId':_0x1c5871['parentTaskId']||null,'networkId':_0x1c5871['networkId']||null,'transport':_0x2af831(0x140),'lifecycleTracking':_0x2af831(0x126)},_0x439ee2);}class $ extends a0_0xaa6cc3{[a0_0x30a80e(0x10a)];['alias'];['token'];['agent'];[a0_0x30a80e(0x139)];[a0_0x30a80e(0x16c)];['reconnectDelay'];['heartbeatTimer'];['sseAbort'];['running']=!0x1;constructor(_0x22fd2d){const _0x2b4008=a0_0x30a80e;super();if(this[_0x2b4008(0x10a)]=_0x22fd2d[_0x2b4008(0x10a)][_0x2b4008(0x109)](/\/$/,''),this['alias']=_0x22fd2d[_0x2b4008(0x181)],this['token']=_0x22fd2d[_0x2b4008(0x178)],this[_0x2b4008(0x184)]=_0x22fd2d[_0x2b4008(0x184)]||'sdk',this[_0x2b4008(0x139)]=_0x2b4008(0x177)+_0x22fd2d[_0x2b4008(0x181)]+'-'+Date['now']()['toString'](0x24),this[_0x2b4008(0x16c)]=_0x22fd2d[_0x2b4008(0x16c)]??0x2bf20,this[_0x2b4008(0x12f)]=_0x22fd2d[_0x2b4008(0x12f)]??0xbb8,_0x22fd2d[_0x2b4008(0x13c)]!==!0x1)this['connect']();}[a0_0x30a80e(0x15e)](_0x21d716){const _0x2217f6=a0_0x30a80e;console[_0x2217f6(0x15e)]('['+new Date()[_0x2217f6(0x15d)]()[_0x2217f6(0x172)](0x0,0x8)+_0x2217f6(0x185)+this[_0x2217f6(0x181)]+']\x20'+_0x21d716);}async['call'](_0x2be764,_0x4ca2e6){const _0x14f78d=a0_0x30a80e;let _0x4de51a={'Content-Type':_0x14f78d(0x129),'Accept':'application/json,\x20text/event-stream'};if(this[_0x14f78d(0x178)])_0x4de51a[_0x14f78d(0x17f)]=_0x14f78d(0x15f)+this['token'];let _0x1b8938=await(await fetch(this[_0x14f78d(0x10a)]+'/mcp',{'method':_0x14f78d(0x150),'headers':_0x4de51a,'body':JSON['stringify']({'jsonrpc':'2.0','id':Date[_0x14f78d(0x133)](),'method':'tools/call','params':{'name':_0x2be764,'arguments':_0x4ca2e6}})}))[_0x14f78d(0x10f)](),_0x81445d=_0x1b8938[_0x14f78d(0x17e)](/data: (.+)/),_0x3905d7=_0x81445d?JSON['parse'](_0x81445d[0x1]):JSON[_0x14f78d(0x142)](_0x1b8938),_0x358dc4=_0x3905d7?.['result']?.[_0x14f78d(0x125)]?.[0x0]?.['text'];return _0x358dc4?JSON[_0x14f78d(0x142)](_0x358dc4):_0x3905d7;}async[a0_0x30a80e(0x12c)](){const _0x5031ed=a0_0x30a80e;if(this['running'])return;this[_0x5031ed(0x15b)]=!0x0,await this['status'](_0x5031ed(0x171)),this[_0x5031ed(0x15e)](_0x5031ed(0x108)),this[_0x5031ed(0x130)]=setInterval(()=>{const _0x2f6600=_0x5031ed;this['status'](_0x2f6600(0x171))[_0x2f6600(0x13b)](_0x367cb0=>this['log']('heartbeat\x20failed:\x20'+_0x367cb0['message']));},this['heartbeatInterval']),this['connectSSE']();}async[a0_0x30a80e(0x15c)](){const _0x57d80a=a0_0x30a80e;if(this['running']=!0x1,this[_0x57d80a(0x10c)]?.['abort'](),this[_0x57d80a(0x130)])clearInterval(this[_0x57d80a(0x130)]);await this[_0x57d80a(0x182)](_0x57d80a(0x144))[_0x57d80a(0x13b)](()=>{}),this[_0x57d80a(0x15e)](_0x57d80a(0x12a));}async[a0_0x30a80e(0x120)](_0x49e43c,_0x1adc80,_0x5bd5ef=a0_0x30a80e(0x10e)){const _0x18eab3=a0_0x30a80e;return Y({'alias':_0x49e43c,'fromAlias':this[_0x18eab3(0x181)]},{'log':_0x2681ea=>console[_0x18eab3(0x15e)](_0x2681ea),'send':()=>this[_0x18eab3(0x116)]('send_task',{'alias':_0x49e43c,'task':_0x1adc80,'priority':_0x5bd5ef,'from_session':this[_0x18eab3(0x181)]})});}async[a0_0x30a80e(0x157)](_0x165e47,_0x274f3b){const _0x3410c4=a0_0x30a80e;return this[_0x3410c4(0x116)](_0x3410c4(0x154),{'alias':_0x165e47,'message':_0x274f3b,'from_session':this[_0x3410c4(0x181)]});}async[a0_0x30a80e(0x121)](_0x37c415,_0x4993a6,_0x3e5efc=a0_0x30a80e(0x13f)){const _0x4b2545=a0_0x30a80e;return this[_0x4b2545(0x116)](_0x4b2545(0x114),{'in_reply_to':_0x37c415,'text':_0x4993a6,'status':_0x3e5efc});}async[a0_0x30a80e(0x182)](_0x476d34,_0x4cefff){const _0x413d25=a0_0x30a80e;return this[_0x413d25(0x116)](_0x413d25(0x10b),{'resume_id':this['resumeId'],'alias':this[_0x413d25(0x181)],'status':_0x476d34,'server':a0_0x4cef47(),'hostname':a0_0x4cef47(),'agent':this[_0x413d25(0x184)],'project_dir':process[_0x413d25(0x143)](),..._0x4cefff});}async[a0_0x30a80e(0x175)](){const _0x4e6adf=a0_0x30a80e;return this[_0x4e6adf(0x116)]('get_all_status',{});}async[a0_0x30a80e(0x137)](_0x126226,_0x9c08e1){const _0x3689c9=a0_0x30a80e;return this[_0x3689c9(0x116)](_0x3689c9(0x137),{'message':_0x126226,'filter_server':_0x9c08e1?.['server'],'filter_status':_0x9c08e1?.[_0x3689c9(0x182)]});}async[a0_0x30a80e(0x160)](){const _0x2e0300=a0_0x30a80e;let _0x4b55a3=encodeURIComponent(this['alias']),_0x5c0c63=this['url']+'/events/'+_0x4b55a3,_0x597f37=this[_0x2e0300(0x12f)];while(this[_0x2e0300(0x15b)]){try{this['sseAbort']=new AbortController();let _0x40af3f={'Accept':_0x2e0300(0x149)};if(this['token'])_0x40af3f['Authorization']='Bearer\x20'+this['token'];let _0x47ab65=await fetch(_0x5c0c63,{'headers':_0x40af3f,'signal':this[_0x2e0300(0x10c)][_0x2e0300(0x187)]});if(!_0x47ab65['ok']||!_0x47ab65[_0x2e0300(0x141)]){this['log'](_0x2e0300(0x113)+_0x47ab65[_0x2e0300(0x182)]),await this[_0x2e0300(0x123)](_0x597f37),_0x597f37=Math[_0x2e0300(0x11c)](_0x597f37*1.5,0xea60);continue;}_0x597f37=this[_0x2e0300(0x12f)];let _0x325065=_0x47ab65['body']['getReader'](),_0x274a66=new TextDecoder(),_0x3e67af='';while(this[_0x2e0300(0x15b)]){let {done:_0x9f14cf,value:_0xde2648}=await _0x325065[_0x2e0300(0x11d)]();if(_0x9f14cf)break;_0x3e67af+=_0x274a66[_0x2e0300(0x17d)](_0xde2648,{'stream':!0x0});let _0x148f1f=_0x3e67af[_0x2e0300(0x106)]('\x0a');_0x3e67af=_0x148f1f['pop']()||'';for(let _0xa1b22f of _0x148f1f){if(!_0xa1b22f[_0x2e0300(0x170)](_0x2e0300(0x163)))continue;try{let _0x3b3d41=JSON['parse'](_0xa1b22f[_0x2e0300(0x172)](0x6));if(_0x3b3d41[_0x2e0300(0x14d)]===_0x2e0300(0x174)){this[_0x2e0300(0x15e)](_0x2e0300(0x17a)),this['emit'](_0x2e0300(0x174));continue;}if(_0x3b3d41[_0x2e0300(0x14d)]===_0x2e0300(0x16b)||_0x3b3d41[_0x2e0300(0x14d)]===_0x2e0300(0x17c)||_0x3b3d41[_0x2e0300(0x14d)]==='broadcast')await this['processInbox']();}catch{}}}}catch(_0x5761e3){if(_0x5761e3['name']==='AbortError')break;this[_0x2e0300(0x158)](_0x2e0300(0x167),_0x5761e3),this['log'](_0x2e0300(0x122)+_0x5761e3[_0x2e0300(0x157)]);}if(this[_0x2e0300(0x15b)])this[_0x2e0300(0x158)](_0x2e0300(0x12a)),this[_0x2e0300(0x15e)](_0x2e0300(0x112)+_0x597f37/0x3e8+_0x2e0300(0x110)),await this[_0x2e0300(0x123)](_0x597f37),_0x597f37=Math[_0x2e0300(0x11c)](_0x597f37*1.5,0xea60);}}async[a0_0x30a80e(0x138)](){const _0xc424f9=a0_0x30a80e;try{let _0x1bd2d5=(await this[_0xc424f9(0x116)](_0xc424f9(0x166),{'alias':this[_0xc424f9(0x181)],'limit':0xa}))?.[_0xc424f9(0x183)]||[];for(let _0x565402 of _0x1bd2d5)await this[_0xc424f9(0x116)](_0xc424f9(0x115),{'alias':this[_0xc424f9(0x181)],'message_id':_0x565402['id']}),this[_0xc424f9(0x15e)]('←\x20'+_0x565402[_0xc424f9(0x128)]+':\x20'+_0x565402[_0xc424f9(0x125)]['slice'](0x0,0x3c)),this[_0xc424f9(0x158)](_0xc424f9(0x135),_0x565402),this[_0xc424f9(0x158)]('message',_0x565402);}catch(_0x268ddc){this[_0xc424f9(0x15e)](_0xc424f9(0x13e)+_0x268ddc['message']);}}['sleep'](_0x3e1973){return new Promise(_0x5d8496=>setTimeout(_0x5d8496,_0x3e1973));}}var F=$;export{F as default,$ as CommHub};
|