@sleep2agi/agent-network 2.3.0-preview.67 → 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_0x517d1f=a0_0x35cf;(function(_0x3a1ffa,_0x243bbe){const _0x3f1791=a0_0x35cf,_0xb95119=_0x3a1ffa();while(!![]){try{const _0x59c2d4=-parseInt(_0x3f1791(0x150))/0x1*(parseInt(_0x3f1791(0x161))/0x2)+-parseInt(_0x3f1791(0x12d))/0x3+-parseInt(_0x3f1791(0x160))/0x4*(parseInt(_0x3f1791(0x179))/0x5)+-parseInt(_0x3f1791(0x176))/0x6+parseInt(_0x3f1791(0x157))/0x7+-parseInt(_0x3f1791(0x17d))/0x8+parseInt(_0x3f1791(0x109))/0x9;if(_0x59c2d4===_0x243bbe)break;else _0xb95119['push'](_0xb95119['shift']());}catch(_0x18916b){_0xb95119['push'](_0xb95119['shift']());}}}(a0_0x42bb,0x9090a));import{EventEmitter as a0_0x1726db}from'events';import{hostname as a0_0x2b7564}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x4212b3,_0x117c43)=>(_0x4212b3??_0x117c43)[a0_0x517d1f(0x136)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x517d1f(0x126)](0x0,0xf0);function N(_0x338ee8){const _0x4567d5=a0_0x517d1f;return(_0x338ee8 instanceof Error?_0x338ee8[_0x4567d5(0x171)]:String(_0x338ee8??'unknown\x20error'))[_0x4567d5(0x136)](K,'[REDACTED]')['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x4567d5(0x126)](0x0,0xf0);}function O(_0x4e5718,_0x577c25=process.env.ANET_TASK_TRACE_FORMAT===a0_0x517d1f(0x17e)){const _0x685adc=a0_0x517d1f;if(_0x577c25)return JSON[_0x685adc(0x17a)](_0x4e5718);let _0x5a1be1=L(_0x4e5718[_0x685adc(0xfe)],_0x685adc(0x164)),_0x593441=L(_0x4e5718[_0x685adc(0x11a)],_0x685adc(0x105)),_0x5231ba=_0x4e5718[_0x685adc(0x119)]?'\x20error='+_0x4e5718[_0x685adc(0x119)]+':'+(_0x4e5718[_0x685adc(0x149)]??''):'';return'[commhub:task]\x20'+_0x4e5718[_0x685adc(0x10c)]+'\x20from='+L(_0x4e5718[_0x685adc(0x134)],_0x685adc(0x103))+_0x685adc(0x17b)+L(_0x4e5718[_0x685adc(0x153)],_0x685adc(0x103))+_0x685adc(0x147)+_0x593441+_0x685adc(0x11c)+_0x5a1be1+_0x685adc(0x12a)+L(_0x4e5718[_0x685adc(0x12e)],_0x685adc(0x103))+_0x685adc(0x140)+_0x4e5718[_0x685adc(0x172)]+'\x20duration_ms='+_0x4e5718[_0x685adc(0x14e)]+_0x685adc(0x117)+_0x4e5718[_0x685adc(0x15e)]+_0x5231ba;}function U(_0x40baca){const _0x5ebdc3=a0_0x517d1f;return{'event':{'sending':_0x5ebdc3(0x148),'delivered':_0x5ebdc3(0x10b),'failed':_0x5ebdc3(0x115),'acked':_0x5ebdc3(0x111),'started':_0x5ebdc3(0x108),'replied':_0x5ebdc3(0x168),'expired':_0x5ebdc3(0x129)}[_0x40baca[_0x5ebdc3(0x10c)]],..._0x40baca};}function j(_0x5edc64){const _0x1b2749=a0_0x517d1f;let _0x4947da=_0x5edc64?.[_0x1b2749(0x11a)]||_0x5edc64?.[_0x1b2749(0x14d)]||_0x5edc64?.['id'];if(_0x4947da)return String(_0x4947da);let _0x1196e3=_0x5edc64?.[_0x1b2749(0x15b)]?.[0x0]?.[_0x1b2749(0x15c)];if(typeof _0x1196e3!==_0x1b2749(0x11b))return null;try{let _0x15e866=JSON[_0x1b2749(0x13a)](_0x1196e3);return _0x15e866?.[_0x1b2749(0x11a)]||_0x15e866?.['message_id']||_0x15e866?.['id']||null;}catch{return null;}}async function X(_0x3436c1,_0x1cbc1e){const _0x37621e=a0_0x517d1f;let _0x35cb93=_0x1cbc1e['now']??Date['now'],_0x56f2b8=_0x35cb93(),_0x5285c7=(_0x17e458,_0x3bbaac,_0x55bfca,_0x4e49f5)=>{const _0x118583=a0_0x35cf;_0x1cbc1e['log'](O(U({'from_alias':_0x3436c1[_0x118583(0x16f)],'to_alias':_0x3436c1['toAlias'],'task_id':_0x3bbaac,'parent_task_id':_0x3436c1[_0x118583(0x13f)],'network_id':_0x3436c1[_0x118583(0x133)],'transport':_0x3436c1[_0x118583(0x172)],'status':_0x17e458,'duration_ms':_0x35cb93()-_0x56f2b8,'lifecycle_tracking':_0x3436c1[_0x118583(0x142)],..._0x55bfca!==void 0x0?{'error_code':_0x4e49f5||_0x118583(0x107),'error_message':N(_0x55bfca)}:{}})));};_0x5285c7(_0x37621e(0x163),null);try{let _0x19dfac=await _0x1cbc1e[_0x37621e(0x146)](),_0x569816=j(_0x19dfac);if(_0x569816)_0x5285c7(_0x37621e(0x152),_0x569816);else{if(_0x19dfac?.['ok']===!0x1||_0x19dfac?.[_0x37621e(0x12f)])_0x5285c7('failed',_0x569816,_0x19dfac?.['error']||_0x37621e(0x16b),_0x37621e(0x138));else _0x5285c7(_0x37621e(0x122),null,_0x37621e(0x10d),_0x37621e(0x16a));}return _0x19dfac;}catch(_0x4d0a25){throw _0x5285c7(_0x37621e(0x122),null,_0x4d0a25,'send_failed'),_0x4d0a25;}}async function Y(_0x410c09,_0x4b2793){const _0x3389d8=a0_0x517d1f;return X({'fromAlias':_0x410c09[_0x3389d8(0x16f)],'toAlias':_0x410c09[_0x3389d8(0x120)],'parentTaskId':_0x410c09[_0x3389d8(0x13f)]||null,'networkId':_0x410c09[_0x3389d8(0x133)]||null,'transport':'mcp_http','lifecycleTracking':_0x3389d8(0x177)},_0x4b2793);}function a0_0x42bb(){const _0x1cb441=['autoConnect','reply','task.send.failed','sdk','\x20lifecycle=','application/json','error_code','task_id','string','\x20parent_task_id=','broadcast','running','heartbeatTimer','alias','toString','failed','data:\x20','SSE\x20error:\x20','body','slice','send_reply','catch','task.expired','\x20network_id=','cwd','disconnect','2390448eAQtjT','network_id','error','normal','reconnectDelay','send_message','networkId','from_alias','task','replace','POST','send_rejected','heartbeat\x20failed:\x20','parse','text/event-stream','connected','log','server','parentTaskId','\x20transport=','processInbox','lifecycleTracking','disconnected','SSE\x20reconnecting\x20in\x20','SSE\x20failed:\x20','send','\x20task_id=','task.send.start','error_message','inbox\x20error:\x20','url','s...','message_id','duration_ms','sdk-','101197oJghsY','startsWith','delivered','to_alias','Authorization','offline','agent','7899164ifhwUo','read','name','ack_inbox','content','text','new_task','lifecycle_tracking','sleep','4nYQPYv','2mLxLVp','application/json,\x20text/event-stream','sending','<missing>','connectSSE','token','get_all_status','task.replied','match','missing_task_id','CommHub\x20rejected\x20task','2.0','type','now','fromAlias','get_inbox','message','transport','connect','Bearer\x20','resumeId','5880894yUXmsS','not_tracked','idle','4747115iMCoMb','stringify','\x20to=','pop','1110064iiTLvU','json','parent_task_id','heartbeatInterval','abort','/events/','signal','<unknown>','min','<pending>','completed','send_failed','task.started','21870261WPafHy','/mcp','task.send.delivered','status','CommHub\x20response\x20omitted\x20task_id','sseAbort','call','getReader','task.ack','emit'];a0_0x42bb=function(){return _0x1cb441;};return a0_0x42bb();}class $ extends a0_0x1726db{[a0_0x517d1f(0x14b)];[a0_0x517d1f(0x120)];[a0_0x517d1f(0x166)];[a0_0x517d1f(0x156)];[a0_0x517d1f(0x175)];['heartbeatInterval'];[a0_0x517d1f(0x131)];[a0_0x517d1f(0x11f)];['sseAbort'];[a0_0x517d1f(0x11e)]=!0x1;constructor(_0x3b8333){const _0x50b9fa=a0_0x517d1f;super();if(this[_0x50b9fa(0x14b)]=_0x3b8333[_0x50b9fa(0x14b)]['replace'](/\/$/,''),this['alias']=_0x3b8333['alias'],this['token']=_0x3b8333[_0x50b9fa(0x166)],this[_0x50b9fa(0x156)]=_0x3b8333[_0x50b9fa(0x156)]||_0x50b9fa(0x116),this[_0x50b9fa(0x175)]=_0x50b9fa(0x14f)+_0x3b8333[_0x50b9fa(0x120)]+'-'+Date[_0x50b9fa(0x16e)]()[_0x50b9fa(0x121)](0x24),this['heartbeatInterval']=_0x3b8333[_0x50b9fa(0xff)]??0x2bf20,this['reconnectDelay']=_0x3b8333[_0x50b9fa(0x131)]??0xbb8,_0x3b8333[_0x50b9fa(0x113)]!==!0x1)this[_0x50b9fa(0x173)]();}[a0_0x517d1f(0x13d)](_0x29c842){const _0x5b7ca1=a0_0x517d1f;console[_0x5b7ca1(0x13d)]('['+new Date()['toTimeString']()[_0x5b7ca1(0x126)](0x0,0x8)+']\x20[commhub:'+this[_0x5b7ca1(0x120)]+']\x20'+_0x29c842);}async['call'](_0x1ac54c,_0x13971c){const _0x2e9985=a0_0x517d1f;let _0x84c15d={'Content-Type':_0x2e9985(0x118),'Accept':_0x2e9985(0x162)};if(this[_0x2e9985(0x166)])_0x84c15d[_0x2e9985(0x154)]=_0x2e9985(0x174)+this[_0x2e9985(0x166)];let _0x3aa945=await(await fetch(this[_0x2e9985(0x14b)]+_0x2e9985(0x10a),{'method':_0x2e9985(0x137),'headers':_0x84c15d,'body':JSON[_0x2e9985(0x17a)]({'jsonrpc':_0x2e9985(0x16c),'id':Date['now'](),'method':'tools/call','params':{'name':_0x1ac54c,'arguments':_0x13971c}})}))[_0x2e9985(0x15c)](),_0x378c2e=_0x3aa945[_0x2e9985(0x169)](/data: (.+)/),_0x1b1da6=_0x378c2e?JSON[_0x2e9985(0x13a)](_0x378c2e[0x1]):JSON['parse'](_0x3aa945),_0x9d31ba=_0x1b1da6?.['result']?.[_0x2e9985(0x15b)]?.[0x0]?.[_0x2e9985(0x15c)];return _0x9d31ba?JSON[_0x2e9985(0x13a)](_0x9d31ba):_0x1b1da6;}async[a0_0x517d1f(0x173)](){const _0x114cf1=a0_0x517d1f;if(this['running'])return;this[_0x114cf1(0x11e)]=!0x0,await this[_0x114cf1(0x10c)](_0x114cf1(0x178)),this[_0x114cf1(0x13d)]('registered'),this[_0x114cf1(0x11f)]=setInterval(()=>{const _0x238fc1=_0x114cf1;this['status'](_0x238fc1(0x178))['catch'](_0x360aa0=>this[_0x238fc1(0x13d)](_0x238fc1(0x139)+_0x360aa0['message']));},this[_0x114cf1(0xff)]),this[_0x114cf1(0x165)]();}async[a0_0x517d1f(0x12c)](){const _0x1394f2=a0_0x517d1f;if(this[_0x1394f2(0x11e)]=!0x1,this['sseAbort']?.[_0x1394f2(0x100)](),this['heartbeatTimer'])clearInterval(this[_0x1394f2(0x11f)]);await this[_0x1394f2(0x10c)](_0x1394f2(0x155))[_0x1394f2(0x128)](()=>{}),this[_0x1394f2(0x13d)](_0x1394f2(0x143));}async['send'](_0x2d0a2f,_0xab1b7c,_0x49cdd5=a0_0x517d1f(0x130)){const _0x172c0f=a0_0x517d1f;return Y({'alias':_0x2d0a2f,'fromAlias':this[_0x172c0f(0x120)]},{'log':_0x1efd3d=>console['log'](_0x1efd3d),'send':()=>this['call']('send_task',{'alias':_0x2d0a2f,'task':_0xab1b7c,'priority':_0x49cdd5,'from_session':this[_0x172c0f(0x120)]})});}async['message'](_0xa67724,_0x4dd06d){const _0x5ebbd2=a0_0x517d1f;return this[_0x5ebbd2(0x10f)](_0x5ebbd2(0x132),{'alias':_0xa67724,'message':_0x4dd06d,'from_session':this['alias']});}async[a0_0x517d1f(0x114)](_0x3dd789,_0x234a18,_0x2fe917=a0_0x517d1f(0x106)){const _0x1c55db=a0_0x517d1f;return this[_0x1c55db(0x10f)](_0x1c55db(0x127),{'in_reply_to':_0x3dd789,'text':_0x234a18,'status':_0x2fe917});}async[a0_0x517d1f(0x10c)](_0x1f3dc7,_0x5de153){const _0x1a5e89=a0_0x517d1f;return this[_0x1a5e89(0x10f)]('report_status',{'resume_id':this['resumeId'],'alias':this['alias'],'status':_0x1f3dc7,'server':a0_0x2b7564(),'hostname':a0_0x2b7564(),'agent':this['agent'],'project_dir':process[_0x1a5e89(0x12b)](),..._0x5de153});}async['getAllStatus'](){const _0x3aefb0=a0_0x517d1f;return this[_0x3aefb0(0x10f)](_0x3aefb0(0x167),{});}async[a0_0x517d1f(0x11d)](_0x4ec4c6,_0x3388dc){const _0x53973b=a0_0x517d1f;return this['call'](_0x53973b(0x11d),{'message':_0x4ec4c6,'filter_server':_0x3388dc?.[_0x53973b(0x13e)],'filter_status':_0x3388dc?.[_0x53973b(0x10c)]});}async[a0_0x517d1f(0x165)](){const _0x369ede=a0_0x517d1f;let _0x2f7edd=encodeURIComponent(this['alias']),_0x131ba4=this[_0x369ede(0x14b)]+_0x369ede(0x101)+_0x2f7edd,_0x25dc02=this[_0x369ede(0x131)];while(this[_0x369ede(0x11e)]){try{this[_0x369ede(0x10e)]=new AbortController();let _0x24a0f1={'Accept':_0x369ede(0x13b)};if(this[_0x369ede(0x166)])_0x24a0f1[_0x369ede(0x154)]=_0x369ede(0x174)+this['token'];let _0x297ef3=await fetch(_0x131ba4,{'headers':_0x24a0f1,'signal':this['sseAbort'][_0x369ede(0x102)]});if(!_0x297ef3['ok']||!_0x297ef3[_0x369ede(0x125)]){this[_0x369ede(0x13d)](_0x369ede(0x145)+_0x297ef3['status']),await this[_0x369ede(0x15f)](_0x25dc02),_0x25dc02=Math[_0x369ede(0x104)](_0x25dc02*1.5,0xea60);continue;}_0x25dc02=this[_0x369ede(0x131)];let _0xb4fed6=_0x297ef3[_0x369ede(0x125)][_0x369ede(0x110)](),_0x292ca6=new TextDecoder(),_0x12c6f1='';while(this[_0x369ede(0x11e)]){let {done:_0x1af3dc,value:_0x3ebeb6}=await _0xb4fed6[_0x369ede(0x158)]();if(_0x1af3dc)break;_0x12c6f1+=_0x292ca6['decode'](_0x3ebeb6,{'stream':!0x0});let _0x44a389=_0x12c6f1['split']('\x0a');_0x12c6f1=_0x44a389[_0x369ede(0x17c)]()||'';for(let _0x1ac5b5 of _0x44a389){if(!_0x1ac5b5[_0x369ede(0x151)](_0x369ede(0x123)))continue;try{let _0x3973f2=JSON['parse'](_0x1ac5b5[_0x369ede(0x126)](0x6));if(_0x3973f2['type']===_0x369ede(0x13c)){this['log']('SSE\x20connected'),this[_0x369ede(0x112)](_0x369ede(0x13c));continue;}if(_0x3973f2[_0x369ede(0x16d)]===_0x369ede(0x15d)||_0x3973f2['type']==='new_message'||_0x3973f2[_0x369ede(0x16d)]===_0x369ede(0x11d))await this[_0x369ede(0x141)]();}catch{}}}}catch(_0x45a0df){if(_0x45a0df[_0x369ede(0x159)]==='AbortError')break;this['emit'](_0x369ede(0x12f),_0x45a0df),this['log'](_0x369ede(0x124)+_0x45a0df[_0x369ede(0x171)]);}if(this[_0x369ede(0x11e)])this[_0x369ede(0x112)]('disconnected'),this[_0x369ede(0x13d)](_0x369ede(0x144)+_0x25dc02/0x3e8+_0x369ede(0x14c)),await this[_0x369ede(0x15f)](_0x25dc02),_0x25dc02=Math[_0x369ede(0x104)](_0x25dc02*1.5,0xea60);}}async[a0_0x517d1f(0x141)](){const _0x37260=a0_0x517d1f;try{let _0x17ad16=(await this[_0x37260(0x10f)](_0x37260(0x170),{'alias':this[_0x37260(0x120)],'limit':0xa}))?.['messages']||[];for(let _0x41b47d of _0x17ad16)await this['call'](_0x37260(0x15a),{'alias':this[_0x37260(0x120)],'message_id':_0x41b47d['id']}),this['log']('←\x20'+_0x41b47d['from_session']+':\x20'+_0x41b47d[_0x37260(0x15b)]['slice'](0x0,0x3c)),this[_0x37260(0x112)](_0x37260(0x135),_0x41b47d),this['emit']('message',_0x41b47d);}catch(_0xca6970){this[_0x37260(0x13d)](_0x37260(0x14a)+_0xca6970[_0x37260(0x171)]);}}[a0_0x517d1f(0x15f)](_0x32b102){return new Promise(_0x4f7788=>setTimeout(_0x4f7788,_0x32b102));}}var F=$;function a0_0x35cf(_0x3c6411,_0x4a2004){_0x3c6411=_0x3c6411-0xfe;const _0x42bb64=a0_0x42bb();let _0x35cf0c=_0x42bb64[_0x3c6411];return _0x35cf0c;}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};