@sleep2agi/agent-network 2.3.0-preview.180 → 2.3.0-preview.181

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_0x3c37c0=a0_0x3d18;(function(_0x3517d6,_0x5848dd){const _0x49aeaf=a0_0x3d18,_0x332e9d=_0x3517d6();while(!![]){try{const _0x5b2d22=parseInt(_0x49aeaf(0xba))/0x1*(-parseInt(_0x49aeaf(0xaa))/0x2)+parseInt(_0x49aeaf(0xf2))/0x3*(parseInt(_0x49aeaf(0xbb))/0x4)+-parseInt(_0x49aeaf(0xd0))/0x5*(-parseInt(_0x49aeaf(0xac))/0x6)+parseInt(_0x49aeaf(0xbe))/0x7*(-parseInt(_0x49aeaf(0xd5))/0x8)+-parseInt(_0x49aeaf(0x117))/0x9*(parseInt(_0x49aeaf(0xe6))/0xa)+parseInt(_0x49aeaf(0xb2))/0xb+parseInt(_0x49aeaf(0x109))/0xc*(parseInt(_0x49aeaf(0xe1))/0xd);if(_0x5b2d22===_0x5848dd)break;else _0x332e9d['push'](_0x332e9d['shift']());}catch(_0x3bf1a2){_0x332e9d['push'](_0x332e9d['shift']());}}}(a0_0x4cec,0x412e5));import{EventEmitter as a0_0xaedd27}from'events';import{hostname as a0_0xdd2ec0}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x4cfe60,_0x532ebc)=>(_0x4cfe60??_0x532ebc)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x3c37c0(0xc7)](0x0,0xf0);function a0_0x3d18(_0xa41998,_0x88bb6e){_0xa41998=_0xa41998-0x9c;const _0x4cec84=a0_0x4cec();let _0x3d18ce=_0x4cec84[_0xa41998];return _0x3d18ce;}function N(_0x28e915){const _0x567b97=a0_0x3c37c0;return(_0x28e915 instanceof Error?_0x28e915[_0x567b97(0xf6)]:String(_0x28e915??_0x567b97(0x10c)))[_0x567b97(0xe5)](K,'[REDACTED]')[_0x567b97(0xe5)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x567b97(0xc7)](0x0,0xf0);}function O(_0x1fbf80,_0x11d3d3=process.env.ANET_TASK_TRACE_FORMAT===a0_0x3c37c0(0x114)){const _0x186d8f=a0_0x3c37c0;if(_0x11d3d3)return JSON['stringify'](_0x1fbf80);let _0x2c9d90=L(_0x1fbf80['parent_task_id'],'<missing>'),_0x1da5cc=L(_0x1fbf80['task_id'],_0x186d8f(0xf7)),_0x5e02bd=_0x1fbf80[_0x186d8f(0xb8)]?_0x186d8f(0x112)+_0x1fbf80[_0x186d8f(0xb8)]+':'+(_0x1fbf80['error_message']??''):'';return _0x186d8f(0x118)+_0x1fbf80['status']+_0x186d8f(0xff)+L(_0x1fbf80['from_alias'],_0x186d8f(0xe4))+'\x20to='+L(_0x1fbf80['to_alias'],_0x186d8f(0xe4))+_0x186d8f(0xe3)+_0x1da5cc+_0x186d8f(0x104)+_0x2c9d90+'\x20network_id='+L(_0x1fbf80[_0x186d8f(0xb3)],_0x186d8f(0xe4))+_0x186d8f(0xb6)+_0x1fbf80[_0x186d8f(0xbd)]+_0x186d8f(0xd1)+_0x1fbf80[_0x186d8f(0x10e)]+_0x186d8f(0xc3)+_0x1fbf80['lifecycle_tracking']+_0x5e02bd;}function a0_0x4cec(){const _0x118b8e=['Authorization','name','\x20parent_task_id=','error','autoConnect','resumeId','server','217692nLmxSq','startsWith','now','unknown\x20error','from_session','duration_ms','registered','getReader','SSE\x20failed:\x20','\x20error=','task.send.start','json','broadcast','sleep','72ZYwsVf','[commhub:task]\x20','parentTaskId','2.0','connectSSE','SSE\x20connected','connected','match','reply','task.ack','missing_task_id','disconnected','reconnectDelay','call','min','SSE\x20error:\x20','running','message_id','stringify','sdk','sending','read','11016Rkptxa','parse','71940Ygdckr','emit','send_failed','type','pop','processInbox','2006224RQjZXB','network_id','string','task.send.failed','\x20transport=','send_rejected','error_code','send','39IHcFjJ','55184hOxFqi','task_id','transport','52549XZhjHm','AbortError','sdk-','status','task.expired','\x20lifecycle=','heartbeat\x20failed:\x20','tools/call','s...','slice','cwd','task.started','send_reply','new_task','signal','toAlias','disconnect','body','70kTNvFw','\x20duration_ms=','decode','connect','text/event-stream','224cWzzbQ','delivered',']\x20[commhub:','heartbeatInterval','get_inbox','failed','getAllStatus','task','fromAlias','POST','mcp_http','CommHub\x20rejected\x20task','117ITkzqI','SSE\x20reconnecting\x20in\x20','\x20task_id=','<unknown>','replace','277010xGzYXQ','Bearer\x20','catch','alias','idle','content','/events/','url','data:\x20','log','not_tracked','CommHub\x20response\x20omitted\x20task_id','87kVChCo','completed','result','lifecycleTracking','message','<pending>','/mcp','networkId','agent','sseAbort','split','new_message','text','\x20from=','token','heartbeatTimer'];a0_0x4cec=function(){return _0x118b8e;};return a0_0x4cec();}function U(_0x608806){const _0x4a2d91=a0_0x3c37c0;return{'event':{'sending':_0x4a2d91(0x113),'delivered':'task.send.delivered','failed':_0x4a2d91(0xb5),'acked':_0x4a2d91(0x9d),'started':_0x4a2d91(0xc9),'replied':'task.replied','expired':_0x4a2d91(0xc2)}[_0x608806['status']],..._0x608806};}function j(_0x54e1ed){const _0x45a8a3=a0_0x3c37c0;let _0x3c7077=_0x54e1ed?.[_0x45a8a3(0xbc)]||_0x54e1ed?.[_0x45a8a3(0xa5)]||_0x54e1ed?.['id'];if(_0x3c7077)return String(_0x3c7077);let _0x293008=_0x54e1ed?.['content']?.[0x0]?.[_0x45a8a3(0xfe)];if(typeof _0x293008!==_0x45a8a3(0xb4))return null;try{let _0x36cac2=JSON[_0x45a8a3(0xab)](_0x293008);return _0x36cac2?.[_0x45a8a3(0xbc)]||_0x36cac2?.[_0x45a8a3(0xa5)]||_0x36cac2?.['id']||null;}catch{return null;}}async function X(_0x250557,_0x33f279){const _0x1c2133=a0_0x3c37c0;let _0x1fc67e=_0x33f279[_0x1c2133(0x10b)]??Date[_0x1c2133(0x10b)],_0x3ad200=_0x1fc67e(),_0x2f3b99=(_0x4fa75a,_0x1f0c32,_0xeba654,_0x3ff6e5)=>{const _0x33895e=_0x1c2133;_0x33f279['log'](O(U({'from_alias':_0x250557[_0x33895e(0xdd)],'to_alias':_0x250557[_0x33895e(0xcd)],'task_id':_0x1f0c32,'parent_task_id':_0x250557[_0x33895e(0x119)],'network_id':_0x250557[_0x33895e(0xf9)],'transport':_0x250557[_0x33895e(0xbd)],'status':_0x4fa75a,'duration_ms':_0x1fc67e()-_0x3ad200,'lifecycle_tracking':_0x250557[_0x33895e(0xf5)],..._0xeba654!==void 0x0?{'error_code':_0x3ff6e5||_0x33895e(0xae),'error_message':N(_0xeba654)}:{}})));};_0x2f3b99(_0x1c2133(0xa8),null);try{let _0x3feb45=await _0x33f279[_0x1c2133(0xb9)](),_0x12599b=j(_0x3feb45);if(_0x12599b)_0x2f3b99(_0x1c2133(0xd6),_0x12599b);else{if(_0x3feb45?.['ok']===!0x1||_0x3feb45?.[_0x1c2133(0x105)])_0x2f3b99(_0x1c2133(0xda),_0x12599b,_0x3feb45?.[_0x1c2133(0x105)]||_0x1c2133(0xe0),_0x1c2133(0xb7));else _0x2f3b99(_0x1c2133(0xda),null,_0x1c2133(0xf1),_0x1c2133(0x9e));}return _0x3feb45;}catch(_0x199dee){throw _0x2f3b99(_0x1c2133(0xda),null,_0x199dee,_0x1c2133(0xae)),_0x199dee;}}async function Y(_0xe49c58,_0x32f9a6){const _0x5a41ef=a0_0x3c37c0;return X({'fromAlias':_0xe49c58[_0x5a41ef(0xdd)],'toAlias':_0xe49c58[_0x5a41ef(0xe9)],'parentTaskId':_0xe49c58[_0x5a41ef(0x119)]||null,'networkId':_0xe49c58['networkId']||null,'transport':_0x5a41ef(0xdf),'lifecycleTracking':_0x5a41ef(0xf0)},_0x32f9a6);}class $ extends a0_0xaedd27{[a0_0x3c37c0(0xed)];[a0_0x3c37c0(0xe9)];['token'];[a0_0x3c37c0(0xfa)];[a0_0x3c37c0(0x107)];[a0_0x3c37c0(0xd8)];['reconnectDelay'];[a0_0x3c37c0(0x101)];['sseAbort'];[a0_0x3c37c0(0xa4)]=!0x1;constructor(_0x5b102d){const _0x4ed522=a0_0x3c37c0;super();if(this[_0x4ed522(0xed)]=_0x5b102d[_0x4ed522(0xed)][_0x4ed522(0xe5)](/\/$/,''),this[_0x4ed522(0xe9)]=_0x5b102d['alias'],this[_0x4ed522(0x100)]=_0x5b102d[_0x4ed522(0x100)],this[_0x4ed522(0xfa)]=_0x5b102d[_0x4ed522(0xfa)]||_0x4ed522(0xa7),this[_0x4ed522(0x107)]=_0x4ed522(0xc0)+_0x5b102d[_0x4ed522(0xe9)]+'-'+Date[_0x4ed522(0x10b)]()['toString'](0x24),this[_0x4ed522(0xd8)]=_0x5b102d[_0x4ed522(0xd8)]??0x2bf20,this['reconnectDelay']=_0x5b102d[_0x4ed522(0xa0)]??0xbb8,_0x5b102d[_0x4ed522(0x106)]!==!0x1)this[_0x4ed522(0xd3)]();}['log'](_0x7095fc){const _0x5a1a7e=a0_0x3c37c0;console['log']('['+new Date()['toTimeString']()[_0x5a1a7e(0xc7)](0x0,0x8)+_0x5a1a7e(0xd7)+this[_0x5a1a7e(0xe9)]+']\x20'+_0x7095fc);}async[a0_0x3c37c0(0xa1)](_0x53850e,_0x2691f1){const _0x4cd8bb=a0_0x3c37c0;let _0x3e849a={'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x3e849a[_0x4cd8bb(0x102)]=_0x4cd8bb(0xe7)+this[_0x4cd8bb(0x100)];let _0x57160d=await(await fetch(this[_0x4cd8bb(0xed)]+_0x4cd8bb(0xf8),{'method':_0x4cd8bb(0xde),'headers':_0x3e849a,'body':JSON[_0x4cd8bb(0xa6)]({'jsonrpc':_0x4cd8bb(0x11a),'id':Date[_0x4cd8bb(0x10b)](),'method':_0x4cd8bb(0xc5),'params':{'name':_0x53850e,'arguments':_0x2691f1}})}))['text'](),_0x479b5a=_0x57160d[_0x4cd8bb(0x11e)](/data: (.+)/),_0x172ba9=_0x479b5a?JSON[_0x4cd8bb(0xab)](_0x479b5a[0x1]):JSON[_0x4cd8bb(0xab)](_0x57160d),_0xfe0632=_0x172ba9?.[_0x4cd8bb(0xf4)]?.[_0x4cd8bb(0xeb)]?.[0x0]?.[_0x4cd8bb(0xfe)];return _0xfe0632?JSON[_0x4cd8bb(0xab)](_0xfe0632):_0x172ba9;}async['connect'](){const _0x4c06b1=a0_0x3c37c0;if(this[_0x4c06b1(0xa4)])return;this[_0x4c06b1(0xa4)]=!0x0,await this[_0x4c06b1(0xc1)](_0x4c06b1(0xea)),this[_0x4c06b1(0xef)](_0x4c06b1(0x10f)),this['heartbeatTimer']=setInterval(()=>{const _0x17aad8=_0x4c06b1;this[_0x17aad8(0xc1)](_0x17aad8(0xea))['catch'](_0x485757=>this[_0x17aad8(0xef)](_0x17aad8(0xc4)+_0x485757[_0x17aad8(0xf6)]));},this[_0x4c06b1(0xd8)]),this[_0x4c06b1(0x11b)]();}async[a0_0x3c37c0(0xce)](){const _0x2ba498=a0_0x3c37c0;if(this[_0x2ba498(0xa4)]=!0x1,this['sseAbort']?.['abort'](),this['heartbeatTimer'])clearInterval(this[_0x2ba498(0x101)]);await this['status']('offline')[_0x2ba498(0xe8)](()=>{}),this['log']('disconnected');}async[a0_0x3c37c0(0xb9)](_0x5cdb2a,_0x3b9ba2,_0x503e9a='normal'){const _0x4c7eff=a0_0x3c37c0;return Y({'alias':_0x5cdb2a,'fromAlias':this[_0x4c7eff(0xe9)]},{'log':_0x480af4=>console['log'](_0x480af4),'send':()=>this[_0x4c7eff(0xa1)]('send_task',{'alias':_0x5cdb2a,'task':_0x3b9ba2,'priority':_0x503e9a,'from_session':this[_0x4c7eff(0xe9)]})});}async[a0_0x3c37c0(0xf6)](_0xb0fca6,_0x19b34a){const _0x5c6b03=a0_0x3c37c0;return this['call']('send_message',{'alias':_0xb0fca6,'message':_0x19b34a,'from_session':this[_0x5c6b03(0xe9)]});}async[a0_0x3c37c0(0x9c)](_0x8a6431,_0x17c182,_0xeacfbb=a0_0x3c37c0(0xf3)){const _0x68ea17=a0_0x3c37c0;return this[_0x68ea17(0xa1)](_0x68ea17(0xca),{'in_reply_to':_0x8a6431,'text':_0x17c182,'status':_0xeacfbb});}async['status'](_0x2fdcab,_0x5cd68a){const _0x29486c=a0_0x3c37c0;return this[_0x29486c(0xa1)]('report_status',{'resume_id':this[_0x29486c(0x107)],'alias':this[_0x29486c(0xe9)],'status':_0x2fdcab,'server':a0_0xdd2ec0(),'hostname':a0_0xdd2ec0(),'agent':this[_0x29486c(0xfa)],'project_dir':process[_0x29486c(0xc8)](),..._0x5cd68a});}async[a0_0x3c37c0(0xdb)](){return this['call']('get_all_status',{});}async[a0_0x3c37c0(0x115)](_0x215a71,_0x316d86){const _0x728b8b=a0_0x3c37c0;return this['call'](_0x728b8b(0x115),{'message':_0x215a71,'filter_server':_0x316d86?.[_0x728b8b(0x108)],'filter_status':_0x316d86?.[_0x728b8b(0xc1)]});}async['connectSSE'](){const _0x5743e7=a0_0x3c37c0;let _0x635f31=encodeURIComponent(this[_0x5743e7(0xe9)]),_0x1d8079=this[_0x5743e7(0xed)]+_0x5743e7(0xec)+_0x635f31,_0x2276a5=this['reconnectDelay'];while(this['running']){try{this['sseAbort']=new AbortController();let _0x167732={'Accept':_0x5743e7(0xd4)};if(this[_0x5743e7(0x100)])_0x167732[_0x5743e7(0x102)]='Bearer\x20'+this[_0x5743e7(0x100)];let _0x2830e9=await fetch(_0x1d8079,{'headers':_0x167732,'signal':this[_0x5743e7(0xfb)][_0x5743e7(0xcc)]});if(!_0x2830e9['ok']||!_0x2830e9[_0x5743e7(0xcf)]){this[_0x5743e7(0xef)](_0x5743e7(0x111)+_0x2830e9[_0x5743e7(0xc1)]),await this[_0x5743e7(0x116)](_0x2276a5),_0x2276a5=Math[_0x5743e7(0xa2)](_0x2276a5*1.5,0xea60);continue;}_0x2276a5=this[_0x5743e7(0xa0)];let _0xaa85bf=_0x2830e9[_0x5743e7(0xcf)][_0x5743e7(0x110)](),_0x3a58e6=new TextDecoder(),_0x475fe3='';while(this[_0x5743e7(0xa4)]){let {done:_0x341a3a,value:_0x190149}=await _0xaa85bf[_0x5743e7(0xa9)]();if(_0x341a3a)break;_0x475fe3+=_0x3a58e6[_0x5743e7(0xd2)](_0x190149,{'stream':!0x0});let _0x1c36f7=_0x475fe3[_0x5743e7(0xfc)]('\x0a');_0x475fe3=_0x1c36f7[_0x5743e7(0xb0)]()||'';for(let _0x2a584c of _0x1c36f7){if(!_0x2a584c[_0x5743e7(0x10a)](_0x5743e7(0xee)))continue;try{let _0x39f27d=JSON[_0x5743e7(0xab)](_0x2a584c[_0x5743e7(0xc7)](0x6));if(_0x39f27d[_0x5743e7(0xaf)]===_0x5743e7(0x11d)){this['log'](_0x5743e7(0x11c)),this[_0x5743e7(0xad)]('connected');continue;}if(_0x39f27d['type']===_0x5743e7(0xcb)||_0x39f27d['type']===_0x5743e7(0xfd)||_0x39f27d[_0x5743e7(0xaf)]===_0x5743e7(0x115))await this[_0x5743e7(0xb1)]();}catch{}}}}catch(_0x5310b5){if(_0x5310b5[_0x5743e7(0x103)]===_0x5743e7(0xbf))break;this[_0x5743e7(0xad)](_0x5743e7(0x105),_0x5310b5),this[_0x5743e7(0xef)](_0x5743e7(0xa3)+_0x5310b5['message']);}if(this['running'])this['emit'](_0x5743e7(0x9f)),this[_0x5743e7(0xef)](_0x5743e7(0xe2)+_0x2276a5/0x3e8+_0x5743e7(0xc6)),await this[_0x5743e7(0x116)](_0x2276a5),_0x2276a5=Math[_0x5743e7(0xa2)](_0x2276a5*1.5,0xea60);}}async[a0_0x3c37c0(0xb1)](){const _0x5b5cf6=a0_0x3c37c0;try{let _0x5048a3=(await this['call'](_0x5b5cf6(0xd9),{'alias':this['alias'],'limit':0xa}))?.['messages']||[];for(let _0x3a0341 of _0x5048a3)await this[_0x5b5cf6(0xa1)]('ack_inbox',{'alias':this['alias'],'message_id':_0x3a0341['id']}),this[_0x5b5cf6(0xef)]('←\x20'+_0x3a0341[_0x5b5cf6(0x10d)]+':\x20'+_0x3a0341[_0x5b5cf6(0xeb)][_0x5b5cf6(0xc7)](0x0,0x3c)),this[_0x5b5cf6(0xad)](_0x5b5cf6(0xdc),_0x3a0341),this[_0x5b5cf6(0xad)](_0x5b5cf6(0xf6),_0x3a0341);}catch(_0x46e7aa){this[_0x5b5cf6(0xef)]('inbox\x20error:\x20'+_0x46e7aa['message']);}}['sleep'](_0x1568ee){return new Promise(_0x22adbe=>setTimeout(_0x22adbe,_0x1568ee));}}var F=$;export{F as default,$ as CommHub};
1
+ function a0_0x2045(){const _0x30d566=['898992pVSRvv','running','get_all_status','SSE\x20reconnecting\x20in\x20','call','processInbox','355CzYpVw','task.started','agent','send_message','signal','lifecycleTracking','CommHub\x20response\x20omitted\x20task_id','from_alias','networkId','send_rejected','application/json,\x20text/event-stream','848607jRuAlf','alias','[REDACTED]','error_message','message','replace','[commhub:task]\x20',']\x20[commhub:','registered','autoConnect','\x20transport=','idle','\x20error=','send_reply','slice','319558ImumPh','5333148CqsCmu','lifecycle_tracking','sdk-','parentTaskId','url','from_session','toString','min','emit','status','new_task','2358020iTEdXy','broadcast','duration_ms','delivered','\x20network_id=','catch','Authorization','2717416ENiGfm','task_id','getAllStatus','SSE\x20error:\x20','text','resumeId','heartbeatTimer','task.ack','sseAbort','SSE\x20connected','error_code','application/json','parent_task_id','network_id','body','messages','failed','new_message','abort','<unknown>','token','send','get_inbox','s...','toTimeString','connected','string','\x20from=','ack_inbox','unknown\x20error','parse','read','send_failed','\x20task_id=','data:\x20','tools/call','\x20to=','content','connect','name','/events/','1poZono','not_tracked','message_id','disconnected','disconnect','error','reconnectDelay','\x20parent_task_id=','fromAlias','AbortError','sending','2.0','task.send.delivered','transport','Bearer\x20','getReader','\x20lifecycle=','reply','SSE\x20failed:\x20','startsWith','send_task','CommHub\x20rejected\x20task','sdk','cwd','now','json','task.send.failed','4596mNvAhB','task.replied','/mcp','text/event-stream','split','connectSSE','sleep','match','POST','inbox\x20error:\x20','type','log','heartbeatInterval','stringify'];a0_0x2045=function(){return _0x30d566;};return a0_0x2045();}function a0_0x2f88(_0x54999f,_0x19eaa9){_0x54999f=_0x54999f-0x1de;const _0x204512=a0_0x2045();let _0x2f884a=_0x204512[_0x54999f];return _0x2f884a;}const a0_0x32cf33=a0_0x2f88;(function(_0x4c090d,_0x2b1fe6){const _0x19c426=a0_0x2f88,_0x3a618c=_0x4c090d();while(!![]){try{const _0x5c3ea9=-parseInt(_0x19c426(0x22a))/0x1*(parseInt(_0x19c426(0x1ee))/0x2)+parseInt(_0x19c426(0x1df))/0x3+parseInt(_0x19c426(0x253))/0x4+-parseInt(_0x19c426(0x259))/0x5*(parseInt(_0x19c426(0x245))/0x6)+-parseInt(_0x19c426(0x1fa))/0x7+-parseInt(_0x19c426(0x201))/0x8+parseInt(_0x19c426(0x1ef))/0x9;if(_0x5c3ea9===_0x2b1fe6)break;else _0x3a618c['push'](_0x3a618c['shift']());}catch(_0x2404f5){_0x3a618c['push'](_0x3a618c['shift']());}}}(a0_0x2045,0x3324f));import{EventEmitter as a0_0x3b27ed}from'events';import{hostname as a0_0x497543}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x2fd6c8,_0x380f4d)=>(_0x2fd6c8??_0x380f4d)[a0_0x32cf33(0x1e4)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x32cf33(0x1ed)](0x0,0xf0);function N(_0x24d8aa){const _0x17d297=a0_0x32cf33;return(_0x24d8aa instanceof Error?_0x24d8aa[_0x17d297(0x1e3)]:String(_0x24d8aa??_0x17d297(0x21e)))[_0x17d297(0x1e4)](K,_0x17d297(0x1e1))[_0x17d297(0x1e4)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x17d297(0x1ed)](0x0,0xf0);}function O(_0x34c24f,_0x133462=process.env.ANET_TASK_TRACE_FORMAT===a0_0x32cf33(0x243)){const _0x1e6cfc=a0_0x32cf33;if(_0x133462)return JSON['stringify'](_0x34c24f);let _0x182678=L(_0x34c24f[_0x1e6cfc(0x20d)],'<missing>'),_0x543377=L(_0x34c24f[_0x1e6cfc(0x202)],'<pending>'),_0x348da1=_0x34c24f[_0x1e6cfc(0x20b)]?_0x1e6cfc(0x1eb)+_0x34c24f[_0x1e6cfc(0x20b)]+':'+(_0x34c24f[_0x1e6cfc(0x1e2)]??''):'';return _0x1e6cfc(0x1e5)+_0x34c24f[_0x1e6cfc(0x1f8)]+_0x1e6cfc(0x21c)+L(_0x34c24f[_0x1e6cfc(0x260)],_0x1e6cfc(0x214))+_0x1e6cfc(0x225)+L(_0x34c24f['to_alias'],_0x1e6cfc(0x214))+_0x1e6cfc(0x222)+_0x543377+_0x1e6cfc(0x231)+_0x182678+_0x1e6cfc(0x1fe)+L(_0x34c24f[_0x1e6cfc(0x20e)],_0x1e6cfc(0x214))+_0x1e6cfc(0x1e9)+_0x34c24f[_0x1e6cfc(0x237)]+'\x20duration_ms='+_0x34c24f[_0x1e6cfc(0x1fc)]+_0x1e6cfc(0x23a)+_0x34c24f[_0x1e6cfc(0x1f0)]+_0x348da1;}function U(_0x153209){const _0xcb07e0=a0_0x32cf33;return{'event':{'sending':'task.send.start','delivered':_0xcb07e0(0x236),'failed':_0xcb07e0(0x244),'acked':_0xcb07e0(0x208),'started':_0xcb07e0(0x25a),'replied':_0xcb07e0(0x246),'expired':'task.expired'}[_0x153209[_0xcb07e0(0x1f8)]],..._0x153209};}function j(_0x38f774){const _0x2ef376=a0_0x32cf33;let _0x36604a=_0x38f774?.[_0x2ef376(0x202)]||_0x38f774?.[_0x2ef376(0x22c)]||_0x38f774?.['id'];if(_0x36604a)return String(_0x36604a);let _0x291ec5=_0x38f774?.[_0x2ef376(0x226)]?.[0x0]?.[_0x2ef376(0x205)];if(typeof _0x291ec5!==_0x2ef376(0x21b))return null;try{let _0x172a61=JSON[_0x2ef376(0x21f)](_0x291ec5);return _0x172a61?.['task_id']||_0x172a61?.[_0x2ef376(0x22c)]||_0x172a61?.['id']||null;}catch{return null;}}async function X(_0x3ec07c,_0x516016){const _0x3a7276=a0_0x32cf33;let _0x38e66c=_0x516016[_0x3a7276(0x242)]??Date[_0x3a7276(0x242)],_0x259a29=_0x38e66c(),_0x3e4bec=(_0x249bd6,_0x5c4c44,_0x5a7d7,_0x57b306)=>{const _0x4f0fd5=_0x3a7276;_0x516016[_0x4f0fd5(0x250)](O(U({'from_alias':_0x3ec07c[_0x4f0fd5(0x232)],'to_alias':_0x3ec07c['toAlias'],'task_id':_0x5c4c44,'parent_task_id':_0x3ec07c[_0x4f0fd5(0x1f2)],'network_id':_0x3ec07c['networkId'],'transport':_0x3ec07c['transport'],'status':_0x249bd6,'duration_ms':_0x38e66c()-_0x259a29,'lifecycle_tracking':_0x3ec07c[_0x4f0fd5(0x25e)],..._0x5a7d7!==void 0x0?{'error_code':_0x57b306||_0x4f0fd5(0x221),'error_message':N(_0x5a7d7)}:{}})));};_0x3e4bec(_0x3a7276(0x234),null);try{let _0x37eefa=await _0x516016['send'](),_0x3a061a=j(_0x37eefa);if(_0x3a061a)_0x3e4bec(_0x3a7276(0x1fd),_0x3a061a);else{if(_0x37eefa?.['ok']===!0x1||_0x37eefa?.['error'])_0x3e4bec('failed',_0x3a061a,_0x37eefa?.[_0x3a7276(0x22f)]||_0x3a7276(0x23f),_0x3a7276(0x262));else _0x3e4bec(_0x3a7276(0x211),null,_0x3a7276(0x25f),'missing_task_id');}return _0x37eefa;}catch(_0x56e82c){throw _0x3e4bec('failed',null,_0x56e82c,_0x3a7276(0x221)),_0x56e82c;}}async function Y(_0x154f3b,_0xa82bd9){const _0x4733f8=a0_0x32cf33;return X({'fromAlias':_0x154f3b[_0x4733f8(0x232)],'toAlias':_0x154f3b[_0x4733f8(0x1e0)],'parentTaskId':_0x154f3b[_0x4733f8(0x1f2)]||null,'networkId':_0x154f3b[_0x4733f8(0x261)]||null,'transport':'mcp_http','lifecycleTracking':_0x4733f8(0x22b)},_0xa82bd9);}class $ extends a0_0x3b27ed{['url'];[a0_0x32cf33(0x1e0)];['token'];[a0_0x32cf33(0x25b)];[a0_0x32cf33(0x206)];[a0_0x32cf33(0x251)];[a0_0x32cf33(0x230)];['heartbeatTimer'];['sseAbort'];[a0_0x32cf33(0x254)]=!0x1;constructor(_0x1f21f0){const _0x282766=a0_0x32cf33;super();if(this[_0x282766(0x1f3)]=_0x1f21f0[_0x282766(0x1f3)][_0x282766(0x1e4)](/\/$/,''),this['alias']=_0x1f21f0[_0x282766(0x1e0)],this['token']=_0x1f21f0['token'],this[_0x282766(0x25b)]=_0x1f21f0[_0x282766(0x25b)]||_0x282766(0x240),this['resumeId']=_0x282766(0x1f1)+_0x1f21f0['alias']+'-'+Date[_0x282766(0x242)]()[_0x282766(0x1f5)](0x24),this[_0x282766(0x251)]=_0x1f21f0['heartbeatInterval']??0x2bf20,this[_0x282766(0x230)]=_0x1f21f0[_0x282766(0x230)]??0xbb8,_0x1f21f0[_0x282766(0x1e8)]!==!0x1)this[_0x282766(0x227)]();}[a0_0x32cf33(0x250)](_0x254961){const _0x40f27d=a0_0x32cf33;console[_0x40f27d(0x250)]('['+new Date()[_0x40f27d(0x219)]()[_0x40f27d(0x1ed)](0x0,0x8)+_0x40f27d(0x1e6)+this['alias']+']\x20'+_0x254961);}async['call'](_0x43a562,_0x218bfb){const _0x6ee5b=a0_0x32cf33;let _0x776743={'Content-Type':_0x6ee5b(0x20c),'Accept':_0x6ee5b(0x1de)};if(this['token'])_0x776743[_0x6ee5b(0x200)]=_0x6ee5b(0x238)+this['token'];let _0x2ddb11=await(await fetch(this[_0x6ee5b(0x1f3)]+_0x6ee5b(0x247),{'method':_0x6ee5b(0x24d),'headers':_0x776743,'body':JSON[_0x6ee5b(0x252)]({'jsonrpc':_0x6ee5b(0x235),'id':Date[_0x6ee5b(0x242)](),'method':_0x6ee5b(0x224),'params':{'name':_0x43a562,'arguments':_0x218bfb}})}))['text'](),_0x58eb7d=_0x2ddb11[_0x6ee5b(0x24c)](/data: (.+)/),_0x3d2417=_0x58eb7d?JSON[_0x6ee5b(0x21f)](_0x58eb7d[0x1]):JSON['parse'](_0x2ddb11),_0x1c69a3=_0x3d2417?.['result']?.['content']?.[0x0]?.['text'];return _0x1c69a3?JSON['parse'](_0x1c69a3):_0x3d2417;}async[a0_0x32cf33(0x227)](){const _0x12a2b5=a0_0x32cf33;if(this[_0x12a2b5(0x254)])return;this[_0x12a2b5(0x254)]=!0x0,await this['status']('idle'),this[_0x12a2b5(0x250)](_0x12a2b5(0x1e7)),this[_0x12a2b5(0x207)]=setInterval(()=>{const _0x120255=_0x12a2b5;this['status'](_0x120255(0x1ea))[_0x120255(0x1ff)](_0xfc128f=>this[_0x120255(0x250)]('heartbeat\x20failed:\x20'+_0xfc128f[_0x120255(0x1e3)]));},this[_0x12a2b5(0x251)]),this['connectSSE']();}async[a0_0x32cf33(0x22e)](){const _0xab3fc=a0_0x32cf33;if(this[_0xab3fc(0x254)]=!0x1,this[_0xab3fc(0x209)]?.[_0xab3fc(0x213)](),this[_0xab3fc(0x207)])clearInterval(this[_0xab3fc(0x207)]);await this[_0xab3fc(0x1f8)]('offline')[_0xab3fc(0x1ff)](()=>{}),this[_0xab3fc(0x250)](_0xab3fc(0x22d));}async[a0_0x32cf33(0x216)](_0x27c40e,_0x4ee14b,_0x55ef18='normal'){const _0x4d011f=a0_0x32cf33;return Y({'alias':_0x27c40e,'fromAlias':this[_0x4d011f(0x1e0)]},{'log':_0x3779f8=>console[_0x4d011f(0x250)](_0x3779f8),'send':()=>this[_0x4d011f(0x257)](_0x4d011f(0x23e),{'alias':_0x27c40e,'task':_0x4ee14b,'priority':_0x55ef18,'from_session':this[_0x4d011f(0x1e0)]})});}async[a0_0x32cf33(0x1e3)](_0x5e91e1,_0x3fa960){const _0x45ed3e=a0_0x32cf33;return this['call'](_0x45ed3e(0x25c),{'alias':_0x5e91e1,'message':_0x3fa960,'from_session':this[_0x45ed3e(0x1e0)]});}async[a0_0x32cf33(0x23b)](_0x39836c,_0x53af3b,_0xb3d124='completed'){const _0x3a2c01=a0_0x32cf33;return this[_0x3a2c01(0x257)](_0x3a2c01(0x1ec),{'in_reply_to':_0x39836c,'text':_0x53af3b,'status':_0xb3d124});}async['status'](_0x45b0b8,_0x223f88){const _0x543fb0=a0_0x32cf33;return this[_0x543fb0(0x257)]('report_status',{'resume_id':this['resumeId'],'alias':this[_0x543fb0(0x1e0)],'status':_0x45b0b8,'server':a0_0x497543(),'hostname':a0_0x497543(),'agent':this[_0x543fb0(0x25b)],'project_dir':process[_0x543fb0(0x241)](),..._0x223f88});}async[a0_0x32cf33(0x203)](){const _0x38a1cd=a0_0x32cf33;return this['call'](_0x38a1cd(0x255),{});}async[a0_0x32cf33(0x1fb)](_0x387792,_0x3720df){const _0x3e5eb8=a0_0x32cf33;return this[_0x3e5eb8(0x257)]('broadcast',{'message':_0x387792,'filter_server':_0x3720df?.['server'],'filter_status':_0x3720df?.['status']});}async[a0_0x32cf33(0x24a)](){const _0x1ed0d7=a0_0x32cf33;let _0x25dfa9=encodeURIComponent(this['alias']),_0x4195e7=this[_0x1ed0d7(0x1f3)]+_0x1ed0d7(0x229)+_0x25dfa9,_0x42fcf1=this[_0x1ed0d7(0x230)];while(this[_0x1ed0d7(0x254)]){try{this[_0x1ed0d7(0x209)]=new AbortController();let _0x26052e={'Accept':_0x1ed0d7(0x248)};if(this[_0x1ed0d7(0x215)])_0x26052e[_0x1ed0d7(0x200)]=_0x1ed0d7(0x238)+this[_0x1ed0d7(0x215)];let _0x46086d=await fetch(_0x4195e7,{'headers':_0x26052e,'signal':this['sseAbort'][_0x1ed0d7(0x25d)]});if(!_0x46086d['ok']||!_0x46086d[_0x1ed0d7(0x20f)]){this[_0x1ed0d7(0x250)](_0x1ed0d7(0x23c)+_0x46086d[_0x1ed0d7(0x1f8)]),await this[_0x1ed0d7(0x24b)](_0x42fcf1),_0x42fcf1=Math[_0x1ed0d7(0x1f6)](_0x42fcf1*1.5,0xea60);continue;}_0x42fcf1=this[_0x1ed0d7(0x230)];let _0x5743a0=_0x46086d['body'][_0x1ed0d7(0x239)](),_0x5c0217=new TextDecoder(),_0xa030d7='';while(this[_0x1ed0d7(0x254)]){let {done:_0x3df6b0,value:_0x51c677}=await _0x5743a0[_0x1ed0d7(0x220)]();if(_0x3df6b0)break;_0xa030d7+=_0x5c0217['decode'](_0x51c677,{'stream':!0x0});let _0x40ec4e=_0xa030d7[_0x1ed0d7(0x249)]('\x0a');_0xa030d7=_0x40ec4e['pop']()||'';for(let _0x31d781 of _0x40ec4e){if(!_0x31d781[_0x1ed0d7(0x23d)](_0x1ed0d7(0x223)))continue;try{let _0x1f5adc=JSON['parse'](_0x31d781[_0x1ed0d7(0x1ed)](0x6));if(_0x1f5adc[_0x1ed0d7(0x24f)]===_0x1ed0d7(0x21a)){this[_0x1ed0d7(0x250)](_0x1ed0d7(0x20a)),this[_0x1ed0d7(0x1f7)](_0x1ed0d7(0x21a));continue;}if(_0x1f5adc[_0x1ed0d7(0x24f)]===_0x1ed0d7(0x1f9)||_0x1f5adc[_0x1ed0d7(0x24f)]===_0x1ed0d7(0x212)||_0x1f5adc[_0x1ed0d7(0x24f)]===_0x1ed0d7(0x1fb))await this[_0x1ed0d7(0x258)]();}catch{}}}}catch(_0x56f073){if(_0x56f073[_0x1ed0d7(0x228)]===_0x1ed0d7(0x233))break;this[_0x1ed0d7(0x1f7)](_0x1ed0d7(0x22f),_0x56f073),this[_0x1ed0d7(0x250)](_0x1ed0d7(0x204)+_0x56f073[_0x1ed0d7(0x1e3)]);}if(this[_0x1ed0d7(0x254)])this[_0x1ed0d7(0x1f7)](_0x1ed0d7(0x22d)),this[_0x1ed0d7(0x250)](_0x1ed0d7(0x256)+_0x42fcf1/0x3e8+_0x1ed0d7(0x218)),await this[_0x1ed0d7(0x24b)](_0x42fcf1),_0x42fcf1=Math[_0x1ed0d7(0x1f6)](_0x42fcf1*1.5,0xea60);}}async[a0_0x32cf33(0x258)](){const _0x5d87d7=a0_0x32cf33;try{let _0x298ebc=(await this[_0x5d87d7(0x257)](_0x5d87d7(0x217),{'alias':this[_0x5d87d7(0x1e0)],'limit':0xa}))?.[_0x5d87d7(0x210)]||[];for(let _0x3c3bf5 of _0x298ebc)await this[_0x5d87d7(0x257)](_0x5d87d7(0x21d),{'alias':this[_0x5d87d7(0x1e0)],'message_id':_0x3c3bf5['id']}),this[_0x5d87d7(0x250)]('←\x20'+_0x3c3bf5[_0x5d87d7(0x1f4)]+':\x20'+_0x3c3bf5[_0x5d87d7(0x226)][_0x5d87d7(0x1ed)](0x0,0x3c)),this[_0x5d87d7(0x1f7)]('task',_0x3c3bf5),this[_0x5d87d7(0x1f7)](_0x5d87d7(0x1e3),_0x3c3bf5);}catch(_0x4c5a91){this[_0x5d87d7(0x250)](_0x5d87d7(0x24e)+_0x4c5a91[_0x5d87d7(0x1e3)]);}}[a0_0x32cf33(0x24b)](_0x235d31){return new Promise(_0x2182c1=>setTimeout(_0x2182c1,_0x235d31));}}var F=$;export{F as default,$ as CommHub};