@sleep2agi/agent-network 2.3.0-preview.68 → 2.3.0-preview.69

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.
@@ -1 +1 @@
1
- const a0_0x4e0926=a0_0x49bd;(function(_0x155588,_0x52e51d){const _0x3f67af=a0_0x49bd,_0x28b773=_0x155588();while(!![]){try{const _0xd4b1b9=parseInt(_0x3f67af(0x1d2))/0x1+parseInt(_0x3f67af(0x199))/0x2*(parseInt(_0x3f67af(0x1a1))/0x3)+parseInt(_0x3f67af(0x1eb))/0x4*(-parseInt(_0x3f67af(0x19a))/0x5)+-parseInt(_0x3f67af(0x1c5))/0x6*(parseInt(_0x3f67af(0x196))/0x7)+-parseInt(_0x3f67af(0x1c2))/0x8*(-parseInt(_0x3f67af(0x1b1))/0x9)+-parseInt(_0x3f67af(0x1e9))/0xa+parseInt(_0x3f67af(0x1fa))/0xb;if(_0xd4b1b9===_0x52e51d)break;else _0x28b773['push'](_0x28b773['shift']());}catch(_0x27ff1a){_0x28b773['push'](_0x28b773['shift']());}}}(a0_0x1da9,0x5595b));import{EventEmitter as a0_0x145a41}from'events';import{hostname as a0_0x362b80}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x1d30b1,_0x438601)=>(_0x1d30b1??_0x438601)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x4e0926(0x1d4)](0x0,0xf0);function a0_0x49bd(_0x25e8c1,_0x5ee524){_0x25e8c1=_0x25e8c1-0x193;const _0x1da90c=a0_0x1da9();let _0x49bd9f=_0x1da90c[_0x25e8c1];return _0x49bd9f;}function a0_0x1da9(){const _0x4e9a10=[']\x20[commhub:','report_status','heartbeatTimer','message_id','stringify','connected','lifecycleTracking','task.expired','<missing>','data:\x20','task','missing_task_id','catch','text/event-stream','failed','transport','task_id','[REDACTED]','message','parse','task.send.start','from_alias','sseAbort','Bearer\x20','26677tDzQXx','call','reconnectDelay','6hJvclL','5QskNTp','get_all_status','networkId','lifecycle_tracking','token','send_task','sleep','383769ZYDdQr','heartbeat\x20failed:\x20','emit','parentTaskId','/events/','status','url','agent','<unknown>','replace','now','autoConnect','reply','startsWith','send_rejected','to_alias','109971BSzzYs','toAlias','getReader','2.0','\x20lifecycle=','not_tracked','application/json','running','server','disconnect','string','task.send.failed','error_code','fromAlias','pop','/mcp','connectSSE','200GhkypL','send_failed','\x20from=','930WbQmPR','result','idle','getAllStatus','AbortError','duration_ms','processInbox','connect','send_message','disconnected','normal','\x20task_id=','match','66379ojXrvM','completed','slice','read','broadcast','SSE\x20error:\x20','text','inbox\x20error:\x20','heartbeatInterval','POST','SSE\x20reconnecting\x20in\x20','\x20error=','min','body','tools/call','type','signal','log','sending','name','alias','delivered','split','5418260ROQnJD','ack_inbox','1584820YfMXlG','task.send.delivered','send','CommHub\x20rejected\x20task','toString','SSE\x20connected','new_task','task.replied','Authorization','offline','CommHub\x20response\x20omitted\x20task_id','resumeId','error','\x20parent_task_id=','content','12360348XDaWDo'];a0_0x1da9=function(){return _0x4e9a10;};return a0_0x1da9();}function N(_0x2c061c){const _0x45e7ff=a0_0x4e0926;return(_0x2c061c instanceof Error?_0x2c061c[_0x45e7ff(0x20d)]:String(_0x2c061c??'unknown\x20error'))[_0x45e7ff(0x1aa)](K,_0x45e7ff(0x20c))[_0x45e7ff(0x1aa)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x45e7ff(0x1d4)](0x0,0xf0);}function O(_0x7349f4,_0x1e9541=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0x86e788=a0_0x4e0926;if(_0x1e9541)return JSON[_0x86e788(0x1ff)](_0x7349f4);let _0x5ab9c7=L(_0x7349f4['parent_task_id'],_0x86e788(0x203)),_0x591a8d=L(_0x7349f4[_0x86e788(0x20b)],'<pending>'),_0x34838e=_0x7349f4['error_code']?_0x86e788(0x1dd)+_0x7349f4[_0x86e788(0x1bd)]+':'+(_0x7349f4['error_message']??''):'';return'[commhub:task]\x20'+_0x7349f4[_0x86e788(0x1a6)]+_0x86e788(0x1c4)+L(_0x7349f4[_0x86e788(0x193)],_0x86e788(0x1a9))+'\x20to='+L(_0x7349f4[_0x86e788(0x1b0)],_0x86e788(0x1a9))+_0x86e788(0x1d0)+_0x591a8d+_0x86e788(0x1f8)+_0x5ab9c7+'\x20network_id='+L(_0x7349f4['network_id'],'<unknown>')+'\x20transport='+_0x7349f4[_0x86e788(0x20a)]+'\x20duration_ms='+_0x7349f4[_0x86e788(0x1ca)]+_0x86e788(0x1b5)+_0x7349f4[_0x86e788(0x19d)]+_0x34838e;}function U(_0x1b6c4a){const _0x1b13cc=a0_0x4e0926;return{'event':{'sending':_0x1b13cc(0x20f),'delivered':_0x1b13cc(0x1ec),'failed':_0x1b13cc(0x1bc),'acked':'task.ack','started':'task.started','replied':_0x1b13cc(0x1f2),'expired':_0x1b13cc(0x202)}[_0x1b6c4a[_0x1b13cc(0x1a6)]],..._0x1b6c4a};}function j(_0x5b0fde){const _0x2fcb34=a0_0x4e0926;let _0x39e1f0=_0x5b0fde?.[_0x2fcb34(0x20b)]||_0x5b0fde?.['message_id']||_0x5b0fde?.['id'];if(_0x39e1f0)return String(_0x39e1f0);let _0x5cecaa=_0x5b0fde?.[_0x2fcb34(0x1f9)]?.[0x0]?.['text'];if(typeof _0x5cecaa!==_0x2fcb34(0x1bb))return null;try{let _0x29b828=JSON[_0x2fcb34(0x20e)](_0x5cecaa);return _0x29b828?.[_0x2fcb34(0x20b)]||_0x29b828?.[_0x2fcb34(0x1fe)]||_0x29b828?.['id']||null;}catch{return null;}}async function X(_0x3bf443,_0x5690f4){const _0x29ff8d=a0_0x4e0926;let _0x558ec0=_0x5690f4['now']??Date[_0x29ff8d(0x1ab)],_0x2d82e8=_0x558ec0(),_0x2b4385=(_0x2896f8,_0x5c2ccd,_0x401a5c,_0x338c81)=>{const _0x34f1e6=_0x29ff8d;_0x5690f4[_0x34f1e6(0x1e3)](O(U({'from_alias':_0x3bf443[_0x34f1e6(0x1be)],'to_alias':_0x3bf443[_0x34f1e6(0x1b2)],'task_id':_0x5c2ccd,'parent_task_id':_0x3bf443[_0x34f1e6(0x1a4)],'network_id':_0x3bf443[_0x34f1e6(0x19c)],'transport':_0x3bf443[_0x34f1e6(0x20a)],'status':_0x2896f8,'duration_ms':_0x558ec0()-_0x2d82e8,'lifecycle_tracking':_0x3bf443[_0x34f1e6(0x201)],..._0x401a5c!==void 0x0?{'error_code':_0x338c81||'send_failed','error_message':N(_0x401a5c)}:{}})));};_0x2b4385(_0x29ff8d(0x1e4),null);try{let _0x4bea9b=await _0x5690f4['send'](),_0x2968fe=j(_0x4bea9b);if(_0x2968fe)_0x2b4385(_0x29ff8d(0x1e7),_0x2968fe);else{if(_0x4bea9b?.['ok']===!0x1||_0x4bea9b?.[_0x29ff8d(0x1f7)])_0x2b4385(_0x29ff8d(0x209),_0x2968fe,_0x4bea9b?.[_0x29ff8d(0x1f7)]||_0x29ff8d(0x1ee),_0x29ff8d(0x1af));else _0x2b4385(_0x29ff8d(0x209),null,_0x29ff8d(0x1f5),_0x29ff8d(0x206));}return _0x4bea9b;}catch(_0x57a921){throw _0x2b4385(_0x29ff8d(0x209),null,_0x57a921,_0x29ff8d(0x1c3)),_0x57a921;}}async function Y(_0x34ed7b,_0x46419e){const _0x5ddd99=a0_0x4e0926;return X({'fromAlias':_0x34ed7b[_0x5ddd99(0x1be)],'toAlias':_0x34ed7b[_0x5ddd99(0x1e6)],'parentTaskId':_0x34ed7b['parentTaskId']||null,'networkId':_0x34ed7b[_0x5ddd99(0x19c)]||null,'transport':'mcp_http','lifecycleTracking':_0x5ddd99(0x1b6)},_0x46419e);}class $ extends a0_0x145a41{[a0_0x4e0926(0x1a7)];[a0_0x4e0926(0x1e6)];[a0_0x4e0926(0x19e)];['agent'];['resumeId'];[a0_0x4e0926(0x1da)];[a0_0x4e0926(0x198)];[a0_0x4e0926(0x1fd)];[a0_0x4e0926(0x194)];[a0_0x4e0926(0x1b8)]=!0x1;constructor(_0x59b3bc){const _0x3e5049=a0_0x4e0926;super();if(this['url']=_0x59b3bc[_0x3e5049(0x1a7)][_0x3e5049(0x1aa)](/\/$/,''),this['alias']=_0x59b3bc[_0x3e5049(0x1e6)],this['token']=_0x59b3bc[_0x3e5049(0x19e)],this[_0x3e5049(0x1a8)]=_0x59b3bc['agent']||'sdk',this[_0x3e5049(0x1f6)]='sdk-'+_0x59b3bc[_0x3e5049(0x1e6)]+'-'+Date[_0x3e5049(0x1ab)]()[_0x3e5049(0x1ef)](0x24),this[_0x3e5049(0x1da)]=_0x59b3bc[_0x3e5049(0x1da)]??0x2bf20,this['reconnectDelay']=_0x59b3bc['reconnectDelay']??0xbb8,_0x59b3bc[_0x3e5049(0x1ac)]!==!0x1)this[_0x3e5049(0x1cc)]();}[a0_0x4e0926(0x1e3)](_0x3c3fb2){const _0x7de5e2=a0_0x4e0926;console[_0x7de5e2(0x1e3)]('['+new Date()['toTimeString']()['slice'](0x0,0x8)+_0x7de5e2(0x1fb)+this['alias']+']\x20'+_0x3c3fb2);}async[a0_0x4e0926(0x197)](_0x563ab1,_0x358543){const _0x1fcae=a0_0x4e0926;let _0x3e000d={'Content-Type':_0x1fcae(0x1b7),'Accept':'application/json,\x20text/event-stream'};if(this[_0x1fcae(0x19e)])_0x3e000d[_0x1fcae(0x1f3)]=_0x1fcae(0x195)+this[_0x1fcae(0x19e)];let _0x1e710c=await(await fetch(this['url']+_0x1fcae(0x1c0),{'method':_0x1fcae(0x1db),'headers':_0x3e000d,'body':JSON[_0x1fcae(0x1ff)]({'jsonrpc':_0x1fcae(0x1b4),'id':Date[_0x1fcae(0x1ab)](),'method':_0x1fcae(0x1e0),'params':{'name':_0x563ab1,'arguments':_0x358543}})}))[_0x1fcae(0x1d8)](),_0x1dec70=_0x1e710c[_0x1fcae(0x1d1)](/data: (.+)/),_0x3ae201=_0x1dec70?JSON[_0x1fcae(0x20e)](_0x1dec70[0x1]):JSON[_0x1fcae(0x20e)](_0x1e710c),_0x23e5f9=_0x3ae201?.[_0x1fcae(0x1c6)]?.[_0x1fcae(0x1f9)]?.[0x0]?.['text'];return _0x23e5f9?JSON[_0x1fcae(0x20e)](_0x23e5f9):_0x3ae201;}async[a0_0x4e0926(0x1cc)](){const _0x555520=a0_0x4e0926;if(this[_0x555520(0x1b8)])return;this[_0x555520(0x1b8)]=!0x0,await this['status'](_0x555520(0x1c7)),this['log']('registered'),this[_0x555520(0x1fd)]=setInterval(()=>{const _0x21abb4=_0x555520;this[_0x21abb4(0x1a6)]('idle')[_0x21abb4(0x207)](_0x31c73d=>this['log'](_0x21abb4(0x1a2)+_0x31c73d['message']));},this['heartbeatInterval']),this[_0x555520(0x1c1)]();}async[a0_0x4e0926(0x1ba)](){const _0x3b6726=a0_0x4e0926;if(this[_0x3b6726(0x1b8)]=!0x1,this[_0x3b6726(0x194)]?.['abort'](),this[_0x3b6726(0x1fd)])clearInterval(this['heartbeatTimer']);await this[_0x3b6726(0x1a6)](_0x3b6726(0x1f4))[_0x3b6726(0x207)](()=>{}),this[_0x3b6726(0x1e3)]('disconnected');}async[a0_0x4e0926(0x1ed)](_0x475296,_0x540eff,_0x3cc8ce=a0_0x4e0926(0x1cf)){const _0x40b3bc=a0_0x4e0926;return Y({'alias':_0x475296,'fromAlias':this['alias']},{'log':_0xe66989=>console[_0x40b3bc(0x1e3)](_0xe66989),'send':()=>this[_0x40b3bc(0x197)](_0x40b3bc(0x19f),{'alias':_0x475296,'task':_0x540eff,'priority':_0x3cc8ce,'from_session':this[_0x40b3bc(0x1e6)]})});}async[a0_0x4e0926(0x20d)](_0x2af1f2,_0x3cbec2){const _0x2e4c7c=a0_0x4e0926;return this[_0x2e4c7c(0x197)](_0x2e4c7c(0x1cd),{'alias':_0x2af1f2,'message':_0x3cbec2,'from_session':this[_0x2e4c7c(0x1e6)]});}async[a0_0x4e0926(0x1ad)](_0x56ee44,_0x53f30a,_0x1377e6=a0_0x4e0926(0x1d3)){const _0x31df72=a0_0x4e0926;return this[_0x31df72(0x197)]('send_reply',{'in_reply_to':_0x56ee44,'text':_0x53f30a,'status':_0x1377e6});}async[a0_0x4e0926(0x1a6)](_0x1aa161,_0x5e826d){const _0x4863b5=a0_0x4e0926;return this[_0x4863b5(0x197)](_0x4863b5(0x1fc),{'resume_id':this[_0x4863b5(0x1f6)],'alias':this[_0x4863b5(0x1e6)],'status':_0x1aa161,'server':a0_0x362b80(),'hostname':a0_0x362b80(),'agent':this[_0x4863b5(0x1a8)],'project_dir':process['cwd'](),..._0x5e826d});}async[a0_0x4e0926(0x1c8)](){const _0xddee37=a0_0x4e0926;return this[_0xddee37(0x197)](_0xddee37(0x19b),{});}async[a0_0x4e0926(0x1d6)](_0x46d91a,_0x49fccf){const _0x20bd4a=a0_0x4e0926;return this['call'](_0x20bd4a(0x1d6),{'message':_0x46d91a,'filter_server':_0x49fccf?.[_0x20bd4a(0x1b9)],'filter_status':_0x49fccf?.[_0x20bd4a(0x1a6)]});}async[a0_0x4e0926(0x1c1)](){const _0x13c59d=a0_0x4e0926;let _0x4e5f4a=encodeURIComponent(this[_0x13c59d(0x1e6)]),_0x5d90b4=this[_0x13c59d(0x1a7)]+_0x13c59d(0x1a5)+_0x4e5f4a,_0x3dbb75=this[_0x13c59d(0x198)];while(this['running']){try{this[_0x13c59d(0x194)]=new AbortController();let _0x4e0bc3={'Accept':_0x13c59d(0x208)};if(this[_0x13c59d(0x19e)])_0x4e0bc3[_0x13c59d(0x1f3)]=_0x13c59d(0x195)+this['token'];let _0x3ab379=await fetch(_0x5d90b4,{'headers':_0x4e0bc3,'signal':this[_0x13c59d(0x194)][_0x13c59d(0x1e2)]});if(!_0x3ab379['ok']||!_0x3ab379[_0x13c59d(0x1df)]){this[_0x13c59d(0x1e3)]('SSE\x20failed:\x20'+_0x3ab379[_0x13c59d(0x1a6)]),await this[_0x13c59d(0x1a0)](_0x3dbb75),_0x3dbb75=Math[_0x13c59d(0x1de)](_0x3dbb75*1.5,0xea60);continue;}_0x3dbb75=this[_0x13c59d(0x198)];let _0x254a7e=_0x3ab379[_0x13c59d(0x1df)][_0x13c59d(0x1b3)](),_0xfb879=new TextDecoder(),_0x1156e1='';while(this[_0x13c59d(0x1b8)]){let {done:_0x215c34,value:_0x4e3a57}=await _0x254a7e[_0x13c59d(0x1d5)]();if(_0x215c34)break;_0x1156e1+=_0xfb879['decode'](_0x4e3a57,{'stream':!0x0});let _0xbb9381=_0x1156e1[_0x13c59d(0x1e8)]('\x0a');_0x1156e1=_0xbb9381[_0x13c59d(0x1bf)]()||'';for(let _0x3679f7 of _0xbb9381){if(!_0x3679f7[_0x13c59d(0x1ae)](_0x13c59d(0x204)))continue;try{let _0x546575=JSON['parse'](_0x3679f7[_0x13c59d(0x1d4)](0x6));if(_0x546575['type']===_0x13c59d(0x200)){this[_0x13c59d(0x1e3)](_0x13c59d(0x1f0)),this[_0x13c59d(0x1a3)](_0x13c59d(0x200));continue;}if(_0x546575['type']===_0x13c59d(0x1f1)||_0x546575[_0x13c59d(0x1e1)]==='new_message'||_0x546575['type']===_0x13c59d(0x1d6))await this[_0x13c59d(0x1cb)]();}catch{}}}}catch(_0x397ec7){if(_0x397ec7[_0x13c59d(0x1e5)]===_0x13c59d(0x1c9))break;this['emit']('error',_0x397ec7),this[_0x13c59d(0x1e3)](_0x13c59d(0x1d7)+_0x397ec7[_0x13c59d(0x20d)]);}if(this[_0x13c59d(0x1b8)])this[_0x13c59d(0x1a3)](_0x13c59d(0x1ce)),this[_0x13c59d(0x1e3)](_0x13c59d(0x1dc)+_0x3dbb75/0x3e8+'s...'),await this['sleep'](_0x3dbb75),_0x3dbb75=Math[_0x13c59d(0x1de)](_0x3dbb75*1.5,0xea60);}}async[a0_0x4e0926(0x1cb)](){const _0x1e0219=a0_0x4e0926;try{let _0x39d4d5=(await this[_0x1e0219(0x197)]('get_inbox',{'alias':this['alias'],'limit':0xa}))?.['messages']||[];for(let _0x3bb745 of _0x39d4d5)await this['call'](_0x1e0219(0x1ea),{'alias':this[_0x1e0219(0x1e6)],'message_id':_0x3bb745['id']}),this[_0x1e0219(0x1e3)]('←\x20'+_0x3bb745['from_session']+':\x20'+_0x3bb745[_0x1e0219(0x1f9)][_0x1e0219(0x1d4)](0x0,0x3c)),this[_0x1e0219(0x1a3)](_0x1e0219(0x205),_0x3bb745),this[_0x1e0219(0x1a3)](_0x1e0219(0x20d),_0x3bb745);}catch(_0x4dac96){this[_0x1e0219(0x1e3)](_0x1e0219(0x1d9)+_0x4dac96[_0x1e0219(0x20d)]);}}[a0_0x4e0926(0x1a0)](_0x49ccfc){return new Promise(_0x5a1106=>setTimeout(_0x5a1106,_0x49ccfc));}}var F=$;export{F as default,$ as CommHub};
1
+ const a0_0xe4e73=a0_0x1482;(function(_0x5af11c,_0xde6ae8){const _0x28c537=a0_0x1482,_0x5435a4=_0x5af11c();while(!![]){try{const _0x19af82=parseInt(_0x28c537(0x22e))/0x1+parseInt(_0x28c537(0x24c))/0x2+parseInt(_0x28c537(0x1e3))/0x3*(parseInt(_0x28c537(0x246))/0x4)+parseInt(_0x28c537(0x1e8))/0x5*(-parseInt(_0x28c537(0x1d8))/0x6)+parseInt(_0x28c537(0x248))/0x7*(-parseInt(_0x28c537(0x24a))/0x8)+parseInt(_0x28c537(0x20b))/0x9*(parseInt(_0x28c537(0x219))/0xa)+-parseInt(_0x28c537(0x205))/0xb;if(_0x19af82===_0xde6ae8)break;else _0x5435a4['push'](_0x5435a4['shift']());}catch(_0x15e046){_0x5435a4['push'](_0x5435a4['shift']());}}}(a0_0x4e6f,0x237a9));import{EventEmitter as a0_0x4cacaf}from'events';import{hostname as a0_0x18d20d}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x20a474,_0x23fc26)=>(_0x20a474??_0x23fc26)[a0_0xe4e73(0x21b)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0xe4e73(0x1df)](0x0,0xf0);function N(_0x1fb060){const _0x5aa644=a0_0xe4e73;return(_0x1fb060 instanceof Error?_0x1fb060['message']:String(_0x1fb060??_0x5aa644(0x231)))[_0x5aa644(0x21b)](K,_0x5aa644(0x1cd))[_0x5aa644(0x21b)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x5aa644(0x1df)](0x0,0xf0);}function O(_0x1dafd8,_0x18be3c=process.env.ANET_TASK_TRACE_FORMAT===a0_0xe4e73(0x1fd)){const _0x59ec0d=a0_0xe4e73;if(_0x18be3c)return JSON[_0x59ec0d(0x1fb)](_0x1dafd8);let _0x46bbcf=L(_0x1dafd8['parent_task_id'],'<missing>'),_0x4075e3=L(_0x1dafd8[_0x59ec0d(0x22a)],'<pending>'),_0x57d970=_0x1dafd8['error_code']?_0x59ec0d(0x1db)+_0x1dafd8[_0x59ec0d(0x1d9)]+':'+(_0x1dafd8[_0x59ec0d(0x215)]??''):'';return _0x59ec0d(0x1dd)+_0x1dafd8[_0x59ec0d(0x1cb)]+_0x59ec0d(0x21e)+L(_0x1dafd8[_0x59ec0d(0x22c)],_0x59ec0d(0x1d6))+_0x59ec0d(0x226)+L(_0x1dafd8[_0x59ec0d(0x1d0)],_0x59ec0d(0x1d6))+_0x59ec0d(0x212)+_0x4075e3+_0x59ec0d(0x1d1)+_0x46bbcf+_0x59ec0d(0x222)+L(_0x1dafd8[_0x59ec0d(0x241)],_0x59ec0d(0x1d6))+'\x20transport='+_0x1dafd8[_0x59ec0d(0x242)]+_0x59ec0d(0x237)+_0x1dafd8[_0x59ec0d(0x1f2)]+_0x59ec0d(0x1ec)+_0x1dafd8[_0x59ec0d(0x1d2)]+_0x57d970;}function U(_0x1e2bd7){const _0x2a4f40=a0_0xe4e73;return{'event':{'sending':_0x2a4f40(0x216),'delivered':'task.send.delivered','failed':_0x2a4f40(0x1d5),'acked':_0x2a4f40(0x211),'started':_0x2a4f40(0x1fe),'replied':_0x2a4f40(0x1e1),'expired':_0x2a4f40(0x1cc)}[_0x1e2bd7[_0x2a4f40(0x1cb)]],..._0x1e2bd7};}function j(_0x26888b){const _0x2c1159=a0_0xe4e73;let _0x4c162d=_0x26888b?.[_0x2c1159(0x22a)]||_0x26888b?.[_0x2c1159(0x20e)]||_0x26888b?.['id'];if(_0x4c162d)return String(_0x4c162d);let _0x2e734b=_0x26888b?.[_0x2c1159(0x217)]?.[0x0]?.['text'];if(typeof _0x2e734b!==_0x2c1159(0x243))return null;try{let _0x137f3e=JSON['parse'](_0x2e734b);return _0x137f3e?.[_0x2c1159(0x22a)]||_0x137f3e?.[_0x2c1159(0x20e)]||_0x137f3e?.['id']||null;}catch{return null;}}async function X(_0x2ded0e,_0x4cec62){const _0x1e46d3=a0_0xe4e73;let _0x4c49a6=_0x4cec62[_0x1e46d3(0x24b)]??Date['now'],_0x16cb83=_0x4c49a6(),_0x29de88=(_0xfe69fd,_0x5e419a,_0x21e70f,_0x2064e1)=>{const _0x2ed202=_0x1e46d3;_0x4cec62[_0x2ed202(0x1de)](O(U({'from_alias':_0x2ded0e[_0x2ed202(0x1f6)],'to_alias':_0x2ded0e[_0x2ed202(0x1f8)],'task_id':_0x5e419a,'parent_task_id':_0x2ded0e['parentTaskId'],'network_id':_0x2ded0e[_0x2ed202(0x1fc)],'transport':_0x2ded0e['transport'],'status':_0xfe69fd,'duration_ms':_0x4c49a6()-_0x16cb83,'lifecycle_tracking':_0x2ded0e['lifecycleTracking'],..._0x21e70f!==void 0x0?{'error_code':_0x2064e1||'send_failed','error_message':N(_0x21e70f)}:{}})));};_0x29de88(_0x1e46d3(0x220),null);try{let _0x517079=await _0x4cec62[_0x1e46d3(0x250)](),_0xdb8daa=j(_0x517079);if(_0xdb8daa)_0x29de88(_0x1e46d3(0x207),_0xdb8daa);else{if(_0x517079?.['ok']===!0x1||_0x517079?.[_0x1e46d3(0x1dc)])_0x29de88(_0x1e46d3(0x1f7),_0xdb8daa,_0x517079?.['error']||_0x1e46d3(0x247),_0x1e46d3(0x221));else _0x29de88('failed',null,_0x1e46d3(0x1e2),_0x1e46d3(0x1ca));}return _0x517079;}catch(_0x4d9725){throw _0x29de88(_0x1e46d3(0x1f7),null,_0x4d9725,_0x1e46d3(0x227)),_0x4d9725;}}async function Y(_0x4a67a2,_0x2e7d2a){const _0x410e3b=a0_0xe4e73;return X({'fromAlias':_0x4a67a2[_0x410e3b(0x1f6)],'toAlias':_0x4a67a2[_0x410e3b(0x202)],'parentTaskId':_0x4a67a2[_0x410e3b(0x1cf)]||null,'networkId':_0x4a67a2[_0x410e3b(0x1fc)]||null,'transport':_0x410e3b(0x23c),'lifecycleTracking':_0x410e3b(0x244)},_0x2e7d2a);}function a0_0x4e6f(){const _0x3486f4=['agent','2.0','call','\x20to=','send_failed','connected','catch','task_id','application/json,\x20text/event-stream','from_alias','application/json','131479dNrMMK','token','heartbeatInterval','unknown\x20error','sdk','data:\x20','processInbox','/events/','read','\x20duration_ms=','broadcast','getAllStatus','connect','disconnect','mcp_http','pop','parse','from_session','min','network_id','transport','string','not_tracked','match','120372PnlSjp','CommHub\x20rejected\x20task','7NsibdF','sseAbort','156072rTtQNJ','now','108756HmSUPT','decode','s...','SSE\x20reconnecting\x20in\x20','send','body','missing_task_id','status','task.expired','[REDACTED]','running','parentTaskId','to_alias','\x20parent_task_id=','lifecycle_tracking','text',']\x20[commhub:','task.send.failed','<unknown>','task','2658TTOHxV','error_code','inbox\x20error:\x20','\x20error=','error','[commhub:task]\x20','log','slice','type','task.replied','CommHub\x20response\x20omitted\x20task_id','6brHWpA','signal','split','tools/call','abort','50nEDipL','send_message','sdk-','heartbeatTimer','\x20lifecycle=','name','new_task','SSE\x20failed:\x20','SSE\x20error:\x20','disconnected','duration_ms','SSE\x20connected','get_inbox','send_task','fromAlias','failed','toAlias','registered','cwd','stringify','networkId','json','task.started','messages','sleep','reconnectDelay','alias','idle','url','2921325HYURoz','Authorization','delivered','result','resumeId','completed','424782qwmRmH','server','message','message_id','text/event-stream','new_message','task.ack','\x20task_id=','connectSSE','emit','error_message','task.send.start','content','AbortError','40KfGBsq','toString','replace','autoConnect','ack_inbox','\x20from=','toTimeString','sending','send_rejected','\x20network_id='];a0_0x4e6f=function(){return _0x3486f4;};return a0_0x4e6f();}function a0_0x1482(_0x4ae13b,_0x4f1534){_0x4ae13b=_0x4ae13b-0x1ca;const _0x4e6fb0=a0_0x4e6f();let _0x1482f8=_0x4e6fb0[_0x4ae13b];return _0x1482f8;}class $ extends a0_0x4cacaf{[a0_0xe4e73(0x204)];[a0_0xe4e73(0x202)];['token'];[a0_0xe4e73(0x223)];[a0_0xe4e73(0x209)];[a0_0xe4e73(0x230)];[a0_0xe4e73(0x201)];[a0_0xe4e73(0x1eb)];[a0_0xe4e73(0x249)];[a0_0xe4e73(0x1ce)]=!0x1;constructor(_0x425b49){const _0x318748=a0_0xe4e73;super();if(this[_0x318748(0x204)]=_0x425b49[_0x318748(0x204)]['replace'](/\/$/,''),this[_0x318748(0x202)]=_0x425b49[_0x318748(0x202)],this[_0x318748(0x22f)]=_0x425b49[_0x318748(0x22f)],this['agent']=_0x425b49['agent']||_0x318748(0x232),this[_0x318748(0x209)]=_0x318748(0x1ea)+_0x425b49[_0x318748(0x202)]+'-'+Date[_0x318748(0x24b)]()[_0x318748(0x21a)](0x24),this[_0x318748(0x230)]=_0x425b49[_0x318748(0x230)]??0x2bf20,this[_0x318748(0x201)]=_0x425b49[_0x318748(0x201)]??0xbb8,_0x425b49[_0x318748(0x21c)]!==!0x1)this[_0x318748(0x23a)]();}[a0_0xe4e73(0x1de)](_0x1d36f0){const _0x5e4502=a0_0xe4e73;console[_0x5e4502(0x1de)]('['+new Date()[_0x5e4502(0x21f)]()['slice'](0x0,0x8)+_0x5e4502(0x1d4)+this[_0x5e4502(0x202)]+']\x20'+_0x1d36f0);}async[a0_0xe4e73(0x225)](_0x4abd69,_0x3e52a5){const _0x4c3e8a=a0_0xe4e73;let _0x3b3437={'Content-Type':_0x4c3e8a(0x22d),'Accept':_0x4c3e8a(0x22b)};if(this[_0x4c3e8a(0x22f)])_0x3b3437[_0x4c3e8a(0x206)]='Bearer\x20'+this[_0x4c3e8a(0x22f)];let _0x3031b7=await(await fetch(this[_0x4c3e8a(0x204)]+'/mcp',{'method':'POST','headers':_0x3b3437,'body':JSON['stringify']({'jsonrpc':_0x4c3e8a(0x224),'id':Date[_0x4c3e8a(0x24b)](),'method':_0x4c3e8a(0x1e6),'params':{'name':_0x4abd69,'arguments':_0x3e52a5}})}))['text'](),_0x11bf18=_0x3031b7[_0x4c3e8a(0x245)](/data: (.+)/),_0x276f61=_0x11bf18?JSON[_0x4c3e8a(0x23e)](_0x11bf18[0x1]):JSON[_0x4c3e8a(0x23e)](_0x3031b7),_0x423b84=_0x276f61?.[_0x4c3e8a(0x208)]?.['content']?.[0x0]?.[_0x4c3e8a(0x1d3)];return _0x423b84?JSON['parse'](_0x423b84):_0x276f61;}async[a0_0xe4e73(0x23a)](){const _0x5c9c4e=a0_0xe4e73;if(this[_0x5c9c4e(0x1ce)])return;this[_0x5c9c4e(0x1ce)]=!0x0,await this['status'](_0x5c9c4e(0x203)),this['log'](_0x5c9c4e(0x1f9)),this[_0x5c9c4e(0x1eb)]=setInterval(()=>{const _0xb25cee=_0x5c9c4e;this[_0xb25cee(0x1cb)](_0xb25cee(0x203))[_0xb25cee(0x229)](_0x14a1a3=>this[_0xb25cee(0x1de)]('heartbeat\x20failed:\x20'+_0x14a1a3['message']));},this[_0x5c9c4e(0x230)]),this[_0x5c9c4e(0x213)]();}async[a0_0xe4e73(0x23b)](){const _0x1b8b57=a0_0xe4e73;if(this[_0x1b8b57(0x1ce)]=!0x1,this[_0x1b8b57(0x249)]?.[_0x1b8b57(0x1e7)](),this[_0x1b8b57(0x1eb)])clearInterval(this[_0x1b8b57(0x1eb)]);await this[_0x1b8b57(0x1cb)]('offline')[_0x1b8b57(0x229)](()=>{}),this[_0x1b8b57(0x1de)](_0x1b8b57(0x1f1));}async[a0_0xe4e73(0x250)](_0x379365,_0x2eeef7,_0x24a40d='normal'){const _0x156675=a0_0xe4e73;return Y({'alias':_0x379365,'fromAlias':this[_0x156675(0x202)]},{'log':_0x2ecc50=>console[_0x156675(0x1de)](_0x2ecc50),'send':()=>this['call'](_0x156675(0x1f5),{'alias':_0x379365,'task':_0x2eeef7,'priority':_0x24a40d,'from_session':this['alias']})});}async['message'](_0xe6cabc,_0x58df9f){const _0x2d6ea8=a0_0xe4e73;return this[_0x2d6ea8(0x225)](_0x2d6ea8(0x1e9),{'alias':_0xe6cabc,'message':_0x58df9f,'from_session':this[_0x2d6ea8(0x202)]});}async['reply'](_0xbe960d,_0x847766,_0x229e7f=a0_0xe4e73(0x20a)){const _0x292f8f=a0_0xe4e73;return this[_0x292f8f(0x225)]('send_reply',{'in_reply_to':_0xbe960d,'text':_0x847766,'status':_0x229e7f});}async['status'](_0x58affa,_0x576a91){const _0x395c36=a0_0xe4e73;return this[_0x395c36(0x225)]('report_status',{'resume_id':this['resumeId'],'alias':this['alias'],'status':_0x58affa,'server':a0_0x18d20d(),'hostname':a0_0x18d20d(),'agent':this[_0x395c36(0x223)],'project_dir':process[_0x395c36(0x1fa)](),..._0x576a91});}async[a0_0xe4e73(0x239)](){const _0x2a9afe=a0_0xe4e73;return this[_0x2a9afe(0x225)]('get_all_status',{});}async[a0_0xe4e73(0x238)](_0x59a783,_0x794079){const _0x136bf5=a0_0xe4e73;return this['call']('broadcast',{'message':_0x59a783,'filter_server':_0x794079?.[_0x136bf5(0x20c)],'filter_status':_0x794079?.[_0x136bf5(0x1cb)]});}async[a0_0xe4e73(0x213)](){const _0x535ccb=a0_0xe4e73;let _0x52554b=encodeURIComponent(this[_0x535ccb(0x202)]),_0x5e57b2=this[_0x535ccb(0x204)]+_0x535ccb(0x235)+_0x52554b,_0xc79717=this[_0x535ccb(0x201)];while(this[_0x535ccb(0x1ce)]){try{this['sseAbort']=new AbortController();let _0x4445f8={'Accept':_0x535ccb(0x20f)};if(this[_0x535ccb(0x22f)])_0x4445f8[_0x535ccb(0x206)]='Bearer\x20'+this[_0x535ccb(0x22f)];let _0x16a335=await fetch(_0x5e57b2,{'headers':_0x4445f8,'signal':this[_0x535ccb(0x249)][_0x535ccb(0x1e4)]});if(!_0x16a335['ok']||!_0x16a335['body']){this['log'](_0x535ccb(0x1ef)+_0x16a335[_0x535ccb(0x1cb)]),await this[_0x535ccb(0x200)](_0xc79717),_0xc79717=Math['min'](_0xc79717*1.5,0xea60);continue;}_0xc79717=this[_0x535ccb(0x201)];let _0x166507=_0x16a335[_0x535ccb(0x251)]['getReader'](),_0x57b80d=new TextDecoder(),_0x2a8c79='';while(this[_0x535ccb(0x1ce)]){let {done:_0x3d261f,value:_0x77462b}=await _0x166507[_0x535ccb(0x236)]();if(_0x3d261f)break;_0x2a8c79+=_0x57b80d[_0x535ccb(0x24d)](_0x77462b,{'stream':!0x0});let _0xf93531=_0x2a8c79[_0x535ccb(0x1e5)]('\x0a');_0x2a8c79=_0xf93531[_0x535ccb(0x23d)]()||'';for(let _0x2acea1 of _0xf93531){if(!_0x2acea1['startsWith'](_0x535ccb(0x233)))continue;try{let _0x4a8820=JSON[_0x535ccb(0x23e)](_0x2acea1[_0x535ccb(0x1df)](0x6));if(_0x4a8820[_0x535ccb(0x1e0)]===_0x535ccb(0x228)){this[_0x535ccb(0x1de)](_0x535ccb(0x1f3)),this[_0x535ccb(0x214)](_0x535ccb(0x228));continue;}if(_0x4a8820[_0x535ccb(0x1e0)]===_0x535ccb(0x1ee)||_0x4a8820['type']===_0x535ccb(0x210)||_0x4a8820['type']===_0x535ccb(0x238))await this[_0x535ccb(0x234)]();}catch{}}}}catch(_0x1373fd){if(_0x1373fd[_0x535ccb(0x1ed)]===_0x535ccb(0x218))break;this[_0x535ccb(0x214)](_0x535ccb(0x1dc),_0x1373fd),this[_0x535ccb(0x1de)](_0x535ccb(0x1f0)+_0x1373fd[_0x535ccb(0x20d)]);}if(this[_0x535ccb(0x1ce)])this[_0x535ccb(0x214)](_0x535ccb(0x1f1)),this[_0x535ccb(0x1de)](_0x535ccb(0x24f)+_0xc79717/0x3e8+_0x535ccb(0x24e)),await this['sleep'](_0xc79717),_0xc79717=Math[_0x535ccb(0x240)](_0xc79717*1.5,0xea60);}}async[a0_0xe4e73(0x234)](){const _0x359bb6=a0_0xe4e73;try{let _0x84073a=(await this[_0x359bb6(0x225)](_0x359bb6(0x1f4),{'alias':this[_0x359bb6(0x202)],'limit':0xa}))?.[_0x359bb6(0x1ff)]||[];for(let _0x31ef80 of _0x84073a)await this['call'](_0x359bb6(0x21d),{'alias':this['alias'],'message_id':_0x31ef80['id']}),this[_0x359bb6(0x1de)]('←\x20'+_0x31ef80[_0x359bb6(0x23f)]+':\x20'+_0x31ef80[_0x359bb6(0x217)][_0x359bb6(0x1df)](0x0,0x3c)),this[_0x359bb6(0x214)](_0x359bb6(0x1d7),_0x31ef80),this[_0x359bb6(0x214)](_0x359bb6(0x20d),_0x31ef80);}catch(_0x59cd38){this[_0x359bb6(0x1de)](_0x359bb6(0x1da)+_0x59cd38[_0x359bb6(0x20d)]);}}[a0_0xe4e73(0x200)](_0xcf328e){return new Promise(_0x3e9f25=>setTimeout(_0x3e9f25,_0xcf328e));}}var F=$;export{F as default,$ as CommHub};