@sleep2agi/agent-network 2.3.0-preview.177 → 2.3.0-preview.179

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_0x44e94b=a0_0x4a4a;(function(_0x701d4e,_0x2dee80){const _0x2c711c=a0_0x4a4a,_0x2e47e7=_0x701d4e();while(!![]){try{const _0x3578c5=parseInt(_0x2c711c(0x125))/0x1*(parseInt(_0x2c711c(0x155))/0x2)+parseInt(_0x2c711c(0x11e))/0x3*(-parseInt(_0x2c711c(0x180))/0x4)+-parseInt(_0x2c711c(0x117))/0x5+-parseInt(_0x2c711c(0x131))/0x6+-parseInt(_0x2c711c(0x162))/0x7*(parseInt(_0x2c711c(0x113))/0x8)+-parseInt(_0x2c711c(0x179))/0x9*(parseInt(_0x2c711c(0x173))/0xa)+-parseInt(_0x2c711c(0x107))/0xb*(-parseInt(_0x2c711c(0x112))/0xc);if(_0x3578c5===_0x2dee80)break;else _0x2e47e7['push'](_0x2e47e7['shift']());}catch(_0x232445){_0x2e47e7['push'](_0x2e47e7['shift']());}}}(a0_0x4cd0,0xbbc1c));function a0_0x4a4a(_0x253da5,_0x2dea79){_0x253da5=_0x253da5-0x100;const _0x4cd036=a0_0x4cd0();let _0x4a4a38=_0x4cd036[_0x253da5];return _0x4a4a38;}import{EventEmitter as a0_0x408525}from'events';import{hostname as a0_0x29ead4}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x1458c5,_0x14bf76)=>(_0x1458c5??_0x14bf76)[a0_0x44e94b(0x166)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);function N(_0x1f135){const _0x287361=a0_0x44e94b;return(_0x1f135 instanceof Error?_0x1f135['message']:String(_0x1f135??_0x287361(0x14c)))[_0x287361(0x166)](K,_0x287361(0x163))['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x287361(0x14a)](0x0,0xf0);}function O(_0x534f49,_0xcee4c=process.env.ANET_TASK_TRACE_FORMAT===a0_0x44e94b(0x11b)){const _0x2bf5fe=a0_0x44e94b;if(_0xcee4c)return JSON[_0x2bf5fe(0x10c)](_0x534f49);let _0x445617=L(_0x534f49['parent_task_id'],_0x2bf5fe(0x11a)),_0x276150=L(_0x534f49['task_id'],'<pending>'),_0x21af82=_0x534f49['error_code']?_0x2bf5fe(0x16b)+_0x534f49[_0x2bf5fe(0x15a)]+':'+(_0x534f49[_0x2bf5fe(0x14f)]??''):'';return _0x2bf5fe(0x103)+_0x534f49['status']+_0x2bf5fe(0x138)+L(_0x534f49[_0x2bf5fe(0x143)],_0x2bf5fe(0x15e))+_0x2bf5fe(0x16e)+L(_0x534f49[_0x2bf5fe(0x11d)],'<unknown>')+_0x2bf5fe(0x128)+_0x276150+'\x20parent_task_id='+_0x445617+_0x2bf5fe(0x114)+L(_0x534f49[_0x2bf5fe(0x168)],_0x2bf5fe(0x15e))+_0x2bf5fe(0x104)+_0x534f49['transport']+'\x20duration_ms='+_0x534f49[_0x2bf5fe(0x16a)]+_0x2bf5fe(0x11f)+_0x534f49[_0x2bf5fe(0x176)]+_0x21af82;}function a0_0x4cd0(){const _0x24c87d=['Authorization','send','send_message','4311042fQQLpT','task_id','result','resumeId','CommHub\x20response\x20omitted\x20task_id','alias','s...','\x20from=','normal','task.started','error','parse','broadcast','task.send.start','/mcp','message_id','sdk-','tools/call','from_alias','get_inbox','delivered','abort','processInbox','application/json','toString','slice','now','unknown\x20error','connected','fromAlias','error_message','send_rejected','task','call','sleep','token','1113106RcySTl','heartbeatTimer','completed','catch','text','error_code','mcp_http','content','POST','<unknown>','SSE\x20error:\x20','url','application/json,\x20text/event-stream','10325KJlbCZ','[REDACTED]','getAllStatus','startsWith','replace','AbortError','network_id','2.0','duration_ms','\x20error=','running','body','\x20to=','not_tracked','log','ack_inbox','signal','10kUWsnz','agent','min','lifecycle_tracking','SSE\x20failed:\x20','SSE\x20connected','1996587cUkFuT','Bearer\x20','reconnectDelay','task.ack','failed','idle','toAlias','1415752cIkriJ','messages','data:\x20','emit','send_failed','[commhub:task]\x20','\x20transport=','inbox\x20error:\x20','type','19213337hleVdC','connectSSE','sending','disconnected','transport','stringify','send_task','heartbeatInterval','split','connect','status','12XYfTep','952YHTlXV','\x20network_id=','read','name','321775JzYZRW','task.send.delivered','pop','<missing>','json',']\x20[commhub:','to_alias','3fatXzE','\x20lifecycle=','/events/','new_task','CommHub\x20rejected\x20task','task.expired','message','1BytpEG','missing_task_id','heartbeat\x20failed:\x20','\x20task_id=','parentTaskId','string','task.replied','SSE\x20reconnecting\x20in\x20','sseAbort'];a0_0x4cd0=function(){return _0x24c87d;};return a0_0x4cd0();}function U(_0x59e58e){const _0x188bf0=a0_0x44e94b;return{'event':{'sending':_0x188bf0(0x13e),'delivered':_0x188bf0(0x118),'failed':'task.send.failed','acked':_0x188bf0(0x17c),'started':_0x188bf0(0x13a),'replied':_0x188bf0(0x12b),'expired':_0x188bf0(0x123)}[_0x59e58e[_0x188bf0(0x111)]],..._0x59e58e};}function j(_0x37567f){const _0x2d54ed=a0_0x44e94b;let _0x5f286c=_0x37567f?.[_0x2d54ed(0x132)]||_0x37567f?.[_0x2d54ed(0x140)]||_0x37567f?.['id'];if(_0x5f286c)return String(_0x5f286c);let _0x9d4a81=_0x37567f?.['content']?.[0x0]?.['text'];if(typeof _0x9d4a81!==_0x2d54ed(0x12a))return null;try{let _0x13d694=JSON[_0x2d54ed(0x13c)](_0x9d4a81);return _0x13d694?.[_0x2d54ed(0x132)]||_0x13d694?.[_0x2d54ed(0x140)]||_0x13d694?.['id']||null;}catch{return null;}}async function X(_0x13bcb4,_0x4ca609){const _0xa05b60=a0_0x44e94b;let _0x195904=_0x4ca609[_0xa05b60(0x14b)]??Date[_0xa05b60(0x14b)],_0x13f3e5=_0x195904(),_0x1b39fb=(_0x1f3c77,_0x53799c,_0x3c0c07,_0x1e1fee)=>{const _0x1248c6=_0xa05b60;_0x4ca609[_0x1248c6(0x170)](O(U({'from_alias':_0x13bcb4['fromAlias'],'to_alias':_0x13bcb4[_0x1248c6(0x17f)],'task_id':_0x53799c,'parent_task_id':_0x13bcb4['parentTaskId'],'network_id':_0x13bcb4['networkId'],'transport':_0x13bcb4[_0x1248c6(0x10b)],'status':_0x1f3c77,'duration_ms':_0x195904()-_0x13f3e5,'lifecycle_tracking':_0x13bcb4['lifecycleTracking'],..._0x3c0c07!==void 0x0?{'error_code':_0x1e1fee||_0x1248c6(0x102),'error_message':N(_0x3c0c07)}:{}})));};_0x1b39fb(_0xa05b60(0x109),null);try{let _0x5b377e=await _0x4ca609['send'](),_0x845db1=j(_0x5b377e);if(_0x845db1)_0x1b39fb(_0xa05b60(0x145),_0x845db1);else{if(_0x5b377e?.['ok']===!0x1||_0x5b377e?.[_0xa05b60(0x13b)])_0x1b39fb(_0xa05b60(0x17d),_0x845db1,_0x5b377e?.[_0xa05b60(0x13b)]||_0xa05b60(0x122),_0xa05b60(0x150));else _0x1b39fb(_0xa05b60(0x17d),null,_0xa05b60(0x135),_0xa05b60(0x126));}return _0x5b377e;}catch(_0xc79916){throw _0x1b39fb(_0xa05b60(0x17d),null,_0xc79916,_0xa05b60(0x102)),_0xc79916;}}async function Y(_0x2fe686,_0x2ad555){const _0xf1bf89=a0_0x44e94b;return X({'fromAlias':_0x2fe686[_0xf1bf89(0x14e)],'toAlias':_0x2fe686['alias'],'parentTaskId':_0x2fe686[_0xf1bf89(0x129)]||null,'networkId':_0x2fe686['networkId']||null,'transport':_0xf1bf89(0x15b),'lifecycleTracking':_0xf1bf89(0x16f)},_0x2ad555);}class $ extends a0_0x408525{['url'];[a0_0x44e94b(0x136)];[a0_0x44e94b(0x154)];[a0_0x44e94b(0x174)];[a0_0x44e94b(0x134)];[a0_0x44e94b(0x10e)];[a0_0x44e94b(0x17b)];[a0_0x44e94b(0x156)];[a0_0x44e94b(0x12d)];[a0_0x44e94b(0x16c)]=!0x1;constructor(_0x1fe568){const _0x1d08f5=a0_0x44e94b;super();if(this[_0x1d08f5(0x160)]=_0x1fe568[_0x1d08f5(0x160)][_0x1d08f5(0x166)](/\/$/,''),this[_0x1d08f5(0x136)]=_0x1fe568[_0x1d08f5(0x136)],this[_0x1d08f5(0x154)]=_0x1fe568[_0x1d08f5(0x154)],this[_0x1d08f5(0x174)]=_0x1fe568['agent']||'sdk',this['resumeId']=_0x1d08f5(0x141)+_0x1fe568[_0x1d08f5(0x136)]+'-'+Date[_0x1d08f5(0x14b)]()[_0x1d08f5(0x149)](0x24),this[_0x1d08f5(0x10e)]=_0x1fe568[_0x1d08f5(0x10e)]??0x2bf20,this[_0x1d08f5(0x17b)]=_0x1fe568['reconnectDelay']??0xbb8,_0x1fe568['autoConnect']!==!0x1)this['connect']();}[a0_0x44e94b(0x170)](_0xaf9588){const _0x182d09=a0_0x44e94b;console[_0x182d09(0x170)]('['+new Date()['toTimeString']()[_0x182d09(0x14a)](0x0,0x8)+_0x182d09(0x11c)+this['alias']+']\x20'+_0xaf9588);}async[a0_0x44e94b(0x152)](_0x350111,_0x467b35){const _0x36157b=a0_0x44e94b;let _0x351e70={'Content-Type':_0x36157b(0x148),'Accept':_0x36157b(0x161)};if(this[_0x36157b(0x154)])_0x351e70['Authorization']=_0x36157b(0x17a)+this[_0x36157b(0x154)];let _0x12d24e=await(await fetch(this[_0x36157b(0x160)]+_0x36157b(0x13f),{'method':_0x36157b(0x15d),'headers':_0x351e70,'body':JSON['stringify']({'jsonrpc':_0x36157b(0x169),'id':Date[_0x36157b(0x14b)](),'method':_0x36157b(0x142),'params':{'name':_0x350111,'arguments':_0x467b35}})}))[_0x36157b(0x159)](),_0x42ae0a=_0x12d24e['match'](/data: (.+)/),_0x76f3b6=_0x42ae0a?JSON[_0x36157b(0x13c)](_0x42ae0a[0x1]):JSON[_0x36157b(0x13c)](_0x12d24e),_0x237b22=_0x76f3b6?.[_0x36157b(0x133)]?.[_0x36157b(0x15c)]?.[0x0]?.[_0x36157b(0x159)];return _0x237b22?JSON[_0x36157b(0x13c)](_0x237b22):_0x76f3b6;}async[a0_0x44e94b(0x110)](){const _0x45e8f9=a0_0x44e94b;if(this[_0x45e8f9(0x16c)])return;this['running']=!0x0,await this[_0x45e8f9(0x111)](_0x45e8f9(0x17e)),this['log']('registered'),this[_0x45e8f9(0x156)]=setInterval(()=>{const _0x514594=_0x45e8f9;this[_0x514594(0x111)]('idle')[_0x514594(0x158)](_0x2f4df3=>this['log'](_0x514594(0x127)+_0x2f4df3[_0x514594(0x124)]));},this['heartbeatInterval']),this[_0x45e8f9(0x108)]();}async['disconnect'](){const _0x4fd0e5=a0_0x44e94b;if(this[_0x4fd0e5(0x16c)]=!0x1,this['sseAbort']?.[_0x4fd0e5(0x146)](),this['heartbeatTimer'])clearInterval(this[_0x4fd0e5(0x156)]);await this[_0x4fd0e5(0x111)]('offline')[_0x4fd0e5(0x158)](()=>{}),this['log'](_0x4fd0e5(0x10a));}async[a0_0x44e94b(0x12f)](_0x3132f1,_0x1de82b,_0xa89edf=a0_0x44e94b(0x139)){const _0x463baf=a0_0x44e94b;return Y({'alias':_0x3132f1,'fromAlias':this[_0x463baf(0x136)]},{'log':_0x446907=>console['log'](_0x446907),'send':()=>this[_0x463baf(0x152)](_0x463baf(0x10d),{'alias':_0x3132f1,'task':_0x1de82b,'priority':_0xa89edf,'from_session':this[_0x463baf(0x136)]})});}async[a0_0x44e94b(0x124)](_0x5bfa5b,_0x332f9c){const _0x236e0f=a0_0x44e94b;return this['call'](_0x236e0f(0x130),{'alias':_0x5bfa5b,'message':_0x332f9c,'from_session':this[_0x236e0f(0x136)]});}async['reply'](_0x3b85c2,_0x3b9fae,_0x15ef54=a0_0x44e94b(0x157)){return this['call']('send_reply',{'in_reply_to':_0x3b85c2,'text':_0x3b9fae,'status':_0x15ef54});}async['status'](_0x27317d,_0x5477dc){const _0x4be4c8=a0_0x44e94b;return this[_0x4be4c8(0x152)]('report_status',{'resume_id':this[_0x4be4c8(0x134)],'alias':this['alias'],'status':_0x27317d,'server':a0_0x29ead4(),'hostname':a0_0x29ead4(),'agent':this[_0x4be4c8(0x174)],'project_dir':process['cwd'](),..._0x5477dc});}async[a0_0x44e94b(0x164)](){const _0x515c82=a0_0x44e94b;return this[_0x515c82(0x152)]('get_all_status',{});}async['broadcast'](_0x8b37a2,_0x54fff7){const _0x17ce94=a0_0x44e94b;return this[_0x17ce94(0x152)](_0x17ce94(0x13d),{'message':_0x8b37a2,'filter_server':_0x54fff7?.['server'],'filter_status':_0x54fff7?.[_0x17ce94(0x111)]});}async[a0_0x44e94b(0x108)](){const _0x7440fc=a0_0x44e94b;let _0x53ae0b=encodeURIComponent(this[_0x7440fc(0x136)]),_0x149818=this[_0x7440fc(0x160)]+_0x7440fc(0x120)+_0x53ae0b,_0x2fd2b9=this['reconnectDelay'];while(this['running']){try{this[_0x7440fc(0x12d)]=new AbortController();let _0x9c7a0b={'Accept':'text/event-stream'};if(this[_0x7440fc(0x154)])_0x9c7a0b[_0x7440fc(0x12e)]='Bearer\x20'+this[_0x7440fc(0x154)];let _0x4c430d=await fetch(_0x149818,{'headers':_0x9c7a0b,'signal':this[_0x7440fc(0x12d)][_0x7440fc(0x172)]});if(!_0x4c430d['ok']||!_0x4c430d[_0x7440fc(0x16d)]){this['log'](_0x7440fc(0x177)+_0x4c430d[_0x7440fc(0x111)]),await this[_0x7440fc(0x153)](_0x2fd2b9),_0x2fd2b9=Math[_0x7440fc(0x175)](_0x2fd2b9*1.5,0xea60);continue;}_0x2fd2b9=this['reconnectDelay'];let _0x3bf094=_0x4c430d[_0x7440fc(0x16d)]['getReader'](),_0x52f083=new TextDecoder(),_0x1c2ec9='';while(this[_0x7440fc(0x16c)]){let {done:_0x34de0c,value:_0x10d2d5}=await _0x3bf094[_0x7440fc(0x115)]();if(_0x34de0c)break;_0x1c2ec9+=_0x52f083['decode'](_0x10d2d5,{'stream':!0x0});let _0x35a473=_0x1c2ec9[_0x7440fc(0x10f)]('\x0a');_0x1c2ec9=_0x35a473[_0x7440fc(0x119)]()||'';for(let _0x437803 of _0x35a473){if(!_0x437803[_0x7440fc(0x165)](_0x7440fc(0x100)))continue;try{let _0x4cd8e4=JSON['parse'](_0x437803[_0x7440fc(0x14a)](0x6));if(_0x4cd8e4['type']===_0x7440fc(0x14d)){this[_0x7440fc(0x170)](_0x7440fc(0x178)),this[_0x7440fc(0x101)](_0x7440fc(0x14d));continue;}if(_0x4cd8e4['type']===_0x7440fc(0x121)||_0x4cd8e4[_0x7440fc(0x106)]==='new_message'||_0x4cd8e4[_0x7440fc(0x106)]==='broadcast')await this[_0x7440fc(0x147)]();}catch{}}}}catch(_0x13ac33){if(_0x13ac33[_0x7440fc(0x116)]===_0x7440fc(0x167))break;this[_0x7440fc(0x101)](_0x7440fc(0x13b),_0x13ac33),this['log'](_0x7440fc(0x15f)+_0x13ac33['message']);}if(this['running'])this['emit'](_0x7440fc(0x10a)),this[_0x7440fc(0x170)](_0x7440fc(0x12c)+_0x2fd2b9/0x3e8+_0x7440fc(0x137)),await this[_0x7440fc(0x153)](_0x2fd2b9),_0x2fd2b9=Math[_0x7440fc(0x175)](_0x2fd2b9*1.5,0xea60);}}async[a0_0x44e94b(0x147)](){const _0x3d2822=a0_0x44e94b;try{let _0x1bc172=(await this[_0x3d2822(0x152)](_0x3d2822(0x144),{'alias':this[_0x3d2822(0x136)],'limit':0xa}))?.[_0x3d2822(0x181)]||[];for(let _0x29370d of _0x1bc172)await this[_0x3d2822(0x152)](_0x3d2822(0x171),{'alias':this[_0x3d2822(0x136)],'message_id':_0x29370d['id']}),this[_0x3d2822(0x170)]('←\x20'+_0x29370d['from_session']+':\x20'+_0x29370d[_0x3d2822(0x15c)]['slice'](0x0,0x3c)),this[_0x3d2822(0x101)](_0x3d2822(0x151),_0x29370d),this['emit'](_0x3d2822(0x124),_0x29370d);}catch(_0x36946a){this[_0x3d2822(0x170)](_0x3d2822(0x105)+_0x36946a[_0x3d2822(0x124)]);}}[a0_0x44e94b(0x153)](_0x1d8d26){return new Promise(_0x32d651=>setTimeout(_0x32d651,_0x1d8d26));}}var F=$;export{F as default,$ as CommHub};
1
+ function a0_0x48cd(){const _0x1c7eb4=['2.0','running','send_message','6135234wKDnKG','Bearer\x20','string','content','match','stringify','\x20from=','Authorization','text/event-stream','missing_task_id','broadcast','catch','call','heartbeatTimer','2060118VCCZPt','27095HdZgOC','abort','error_message','url','/events/','resumeId','failed','268vjSfsj','parentTaskId','task.started','getReader','new_message','networkId','message','token','transport','send_reply','send_task','121555uJyKMy','3531832tUjfrh','connect','task_id','<missing>','mcp_http','to_alias','<unknown>','fromAlias','heartbeatInterval','task.ack','538674DkzlNy','disconnect','SSE\x20error:\x20','send_failed','decode','getAllStatus','connectSSE','error_code','task.replied','\x20task_id=','cwd','ack_inbox','heartbeat\x20failed:\x20','slice','task','signal','alias','idle','parent_task_id','sending','sdk-','completed','json','\x20error=','sdk','body','1903126AtKUow','toAlias','send','SSE\x20reconnecting\x20in\x20','processInbox','<pending>','duration_ms','task.send.delivered','\x20transport=','offline','name','error','CommHub\x20response\x20omitted\x20task_id','tools/call','disconnected','emit','connected','from_alias','read','sseAbort','delivered','\x20duration_ms=','CommHub\x20rejected\x20task','status','replace','\x20network_id=','\x20lifecycle=','toTimeString','9aqSMiN','network_id','log','message_id','sleep','send_rejected','agent','startsWith','new_task','SSE\x20connected','from_session','POST','get_all_status','task.send.start','reconnectDelay','min','report_status','text','AbortError','\x20parent_task_id=','type','now','parse'];a0_0x48cd=function(){return _0x1c7eb4;};return a0_0x48cd();}const a0_0x25910b=a0_0x4668;(function(_0x24192e,_0x2c5f2){const _0x27cdba=a0_0x4668,_0x4a6d59=_0x24192e();while(!![]){try{const _0x2af6bd=-parseInt(_0x27cdba(0x264))/0x1+-parseInt(_0x27cdba(0x20d))/0x2+parseInt(_0x27cdba(0x251))/0x3+parseInt(_0x27cdba(0x259))/0x4*(parseInt(_0x27cdba(0x252))/0x5)+parseInt(_0x27cdba(0x1f3))/0x6+parseInt(_0x27cdba(0x243))/0x7+-parseInt(_0x27cdba(0x265))/0x8*(parseInt(_0x27cdba(0x229))/0x9);if(_0x2af6bd===_0x2c5f2)break;else _0x4a6d59['push'](_0x4a6d59['shift']());}catch(_0x184f20){_0x4a6d59['push'](_0x4a6d59['shift']());}}}(a0_0x48cd,0x7a6af));import{EventEmitter as a0_0x5dfd9d}from'events';import{hostname as a0_0x11896c}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x4f4660,_0xcd3b7)=>(_0x4f4660??_0xcd3b7)[a0_0x25910b(0x225)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);function N(_0x2de14a){const _0x2e7d73=a0_0x25910b;return(_0x2de14a instanceof Error?_0x2de14a[_0x2e7d73(0x25f)]:String(_0x2de14a??'unknown\x20error'))['replace'](K,'[REDACTED]')[_0x2e7d73(0x225)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x2e7d73(0x200)](0x0,0xf0);}function O(_0x3cac9b,_0x3c1e55=process.env.ANET_TASK_TRACE_FORMAT===a0_0x25910b(0x209)){const _0x20e8a4=a0_0x25910b;if(_0x3c1e55)return JSON[_0x20e8a4(0x248)](_0x3cac9b);let _0x2bd0ac=L(_0x3cac9b[_0x20e8a4(0x205)],_0x20e8a4(0x268)),_0x2190fb=L(_0x3cac9b['task_id'],_0x20e8a4(0x212)),_0x112929=_0x3cac9b['error_code']?_0x20e8a4(0x20a)+_0x3cac9b[_0x20e8a4(0x1fa)]+':'+(_0x3cac9b[_0x20e8a4(0x254)]??''):'';return'[commhub:task]\x20'+_0x3cac9b[_0x20e8a4(0x224)]+_0x20e8a4(0x249)+L(_0x3cac9b[_0x20e8a4(0x21e)],_0x20e8a4(0x1ef))+'\x20to='+L(_0x3cac9b[_0x20e8a4(0x1ee)],_0x20e8a4(0x1ef))+_0x20e8a4(0x1fc)+_0x2190fb+_0x20e8a4(0x23c)+_0x2bd0ac+_0x20e8a4(0x226)+L(_0x3cac9b[_0x20e8a4(0x22a)],'<unknown>')+_0x20e8a4(0x215)+_0x3cac9b[_0x20e8a4(0x261)]+_0x20e8a4(0x222)+_0x3cac9b[_0x20e8a4(0x213)]+_0x20e8a4(0x227)+_0x3cac9b['lifecycle_tracking']+_0x112929;}function U(_0x1705d9){const _0xa3f2d2=a0_0x25910b;return{'event':{'sending':_0xa3f2d2(0x236),'delivered':_0xa3f2d2(0x214),'failed':'task.send.failed','acked':_0xa3f2d2(0x1f2),'started':_0xa3f2d2(0x25b),'replied':_0xa3f2d2(0x1fb),'expired':'task.expired'}[_0x1705d9['status']],..._0x1705d9};}function j(_0x146878){const _0xd5a32b=a0_0x25910b;let _0x40a3ff=_0x146878?.[_0xd5a32b(0x267)]||_0x146878?.[_0xd5a32b(0x22c)]||_0x146878?.['id'];if(_0x40a3ff)return String(_0x40a3ff);let _0x53f0b9=_0x146878?.[_0xd5a32b(0x246)]?.[0x0]?.[_0xd5a32b(0x23a)];if(typeof _0x53f0b9!==_0xd5a32b(0x245))return null;try{let _0x2d0276=JSON[_0xd5a32b(0x23f)](_0x53f0b9);return _0x2d0276?.[_0xd5a32b(0x267)]||_0x2d0276?.['message_id']||_0x2d0276?.['id']||null;}catch{return null;}}async function X(_0x136513,_0x397615){const _0x8479cd=a0_0x25910b;let _0x507127=_0x397615[_0x8479cd(0x23e)]??Date[_0x8479cd(0x23e)],_0x126df0=_0x507127(),_0x3827fc=(_0x3f09a4,_0x41b409,_0x6ce4ea,_0x2acc71)=>{const _0x1eae73=_0x8479cd;_0x397615[_0x1eae73(0x22b)](O(U({'from_alias':_0x136513[_0x1eae73(0x1f0)],'to_alias':_0x136513[_0x1eae73(0x20e)],'task_id':_0x41b409,'parent_task_id':_0x136513[_0x1eae73(0x25a)],'network_id':_0x136513['networkId'],'transport':_0x136513['transport'],'status':_0x3f09a4,'duration_ms':_0x507127()-_0x126df0,'lifecycle_tracking':_0x136513['lifecycleTracking'],..._0x6ce4ea!==void 0x0?{'error_code':_0x2acc71||_0x1eae73(0x1f6),'error_message':N(_0x6ce4ea)}:{}})));};_0x3827fc(_0x8479cd(0x206),null);try{let _0x1ef95c=await _0x397615[_0x8479cd(0x20f)](),_0x35485c=j(_0x1ef95c);if(_0x35485c)_0x3827fc(_0x8479cd(0x221),_0x35485c);else{if(_0x1ef95c?.['ok']===!0x1||_0x1ef95c?.['error'])_0x3827fc(_0x8479cd(0x258),_0x35485c,_0x1ef95c?.[_0x8479cd(0x218)]||_0x8479cd(0x223),_0x8479cd(0x22e));else _0x3827fc(_0x8479cd(0x258),null,_0x8479cd(0x219),_0x8479cd(0x24c));}return _0x1ef95c;}catch(_0x5923b0){throw _0x3827fc(_0x8479cd(0x258),null,_0x5923b0,'send_failed'),_0x5923b0;}}function a0_0x4668(_0x420d71,_0x1835ef){_0x420d71=_0x420d71-0x1ed;const _0x48cd0e=a0_0x48cd();let _0x466858=_0x48cd0e[_0x420d71];return _0x466858;}async function Y(_0x200dd0,_0x1d8f14){const _0x20cdc7=a0_0x25910b;return X({'fromAlias':_0x200dd0['fromAlias'],'toAlias':_0x200dd0['alias'],'parentTaskId':_0x200dd0[_0x20cdc7(0x25a)]||null,'networkId':_0x200dd0[_0x20cdc7(0x25e)]||null,'transport':_0x20cdc7(0x1ed),'lifecycleTracking':'not_tracked'},_0x1d8f14);}class $ extends a0_0x5dfd9d{[a0_0x25910b(0x255)];['alias'];[a0_0x25910b(0x260)];['agent'];[a0_0x25910b(0x257)];[a0_0x25910b(0x1f1)];[a0_0x25910b(0x237)];[a0_0x25910b(0x250)];[a0_0x25910b(0x220)];[a0_0x25910b(0x241)]=!0x1;constructor(_0x183550){const _0x417c1e=a0_0x25910b;super();if(this['url']=_0x183550['url'][_0x417c1e(0x225)](/\/$/,''),this['alias']=_0x183550[_0x417c1e(0x203)],this[_0x417c1e(0x260)]=_0x183550[_0x417c1e(0x260)],this[_0x417c1e(0x22f)]=_0x183550[_0x417c1e(0x22f)]||_0x417c1e(0x20b),this[_0x417c1e(0x257)]=_0x417c1e(0x207)+_0x183550[_0x417c1e(0x203)]+'-'+Date[_0x417c1e(0x23e)]()['toString'](0x24),this[_0x417c1e(0x1f1)]=_0x183550['heartbeatInterval']??0x2bf20,this[_0x417c1e(0x237)]=_0x183550['reconnectDelay']??0xbb8,_0x183550['autoConnect']!==!0x1)this[_0x417c1e(0x266)]();}['log'](_0x5f561e){const _0x472022=a0_0x25910b;console['log']('['+new Date()[_0x472022(0x228)]()[_0x472022(0x200)](0x0,0x8)+']\x20[commhub:'+this['alias']+']\x20'+_0x5f561e);}async['call'](_0x56e381,_0x3fcac3){const _0x177933=a0_0x25910b;let _0x9d07d7={'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x9d07d7[_0x177933(0x24a)]='Bearer\x20'+this[_0x177933(0x260)];let _0x5de205=await(await fetch(this[_0x177933(0x255)]+'/mcp',{'method':_0x177933(0x234),'headers':_0x9d07d7,'body':JSON['stringify']({'jsonrpc':_0x177933(0x240),'id':Date['now'](),'method':_0x177933(0x21a),'params':{'name':_0x56e381,'arguments':_0x3fcac3}})}))[_0x177933(0x23a)](),_0x3934bf=_0x5de205[_0x177933(0x247)](/data: (.+)/),_0x270cae=_0x3934bf?JSON[_0x177933(0x23f)](_0x3934bf[0x1]):JSON[_0x177933(0x23f)](_0x5de205),_0x1227d8=_0x270cae?.['result']?.[_0x177933(0x246)]?.[0x0]?.[_0x177933(0x23a)];return _0x1227d8?JSON[_0x177933(0x23f)](_0x1227d8):_0x270cae;}async[a0_0x25910b(0x266)](){const _0xb65bc5=a0_0x25910b;if(this[_0xb65bc5(0x241)])return;this['running']=!0x0,await this['status'](_0xb65bc5(0x204)),this[_0xb65bc5(0x22b)]('registered'),this[_0xb65bc5(0x250)]=setInterval(()=>{const _0x53101c=_0xb65bc5;this['status'](_0x53101c(0x204))[_0x53101c(0x24e)](_0x53bbe2=>this[_0x53101c(0x22b)](_0x53101c(0x1ff)+_0x53bbe2['message']));},this['heartbeatInterval']),this[_0xb65bc5(0x1f9)]();}async[a0_0x25910b(0x1f4)](){const _0x59357a=a0_0x25910b;if(this[_0x59357a(0x241)]=!0x1,this['sseAbort']?.[_0x59357a(0x253)](),this[_0x59357a(0x250)])clearInterval(this[_0x59357a(0x250)]);await this[_0x59357a(0x224)](_0x59357a(0x216))[_0x59357a(0x24e)](()=>{}),this[_0x59357a(0x22b)]('disconnected');}async['send'](_0x32fab1,_0x1d0428,_0x36e061='normal'){const _0x1fe113=a0_0x25910b;return Y({'alias':_0x32fab1,'fromAlias':this['alias']},{'log':_0x16cc0f=>console[_0x1fe113(0x22b)](_0x16cc0f),'send':()=>this[_0x1fe113(0x24f)](_0x1fe113(0x263),{'alias':_0x32fab1,'task':_0x1d0428,'priority':_0x36e061,'from_session':this[_0x1fe113(0x203)]})});}async[a0_0x25910b(0x25f)](_0x5a19c4,_0xefc937){const _0x5334e1=a0_0x25910b;return this[_0x5334e1(0x24f)](_0x5334e1(0x242),{'alias':_0x5a19c4,'message':_0xefc937,'from_session':this[_0x5334e1(0x203)]});}async['reply'](_0x72e89f,_0x586faf,_0x4e78e4=a0_0x25910b(0x208)){const _0x47a6b2=a0_0x25910b;return this['call'](_0x47a6b2(0x262),{'in_reply_to':_0x72e89f,'text':_0x586faf,'status':_0x4e78e4});}async[a0_0x25910b(0x224)](_0x564603,_0x43cc8b){const _0x4151b4=a0_0x25910b;return this[_0x4151b4(0x24f)](_0x4151b4(0x239),{'resume_id':this[_0x4151b4(0x257)],'alias':this[_0x4151b4(0x203)],'status':_0x564603,'server':a0_0x11896c(),'hostname':a0_0x11896c(),'agent':this[_0x4151b4(0x22f)],'project_dir':process[_0x4151b4(0x1fd)](),..._0x43cc8b});}async[a0_0x25910b(0x1f8)](){const _0x2350f5=a0_0x25910b;return this[_0x2350f5(0x24f)](_0x2350f5(0x235),{});}async[a0_0x25910b(0x24d)](_0x49e2ea,_0x1f3193){const _0x48c21f=a0_0x25910b;return this[_0x48c21f(0x24f)](_0x48c21f(0x24d),{'message':_0x49e2ea,'filter_server':_0x1f3193?.['server'],'filter_status':_0x1f3193?.[_0x48c21f(0x224)]});}async[a0_0x25910b(0x1f9)](){const _0x313a21=a0_0x25910b;let _0x593348=encodeURIComponent(this[_0x313a21(0x203)]),_0x4bda64=this['url']+_0x313a21(0x256)+_0x593348,_0x267cd2=this[_0x313a21(0x237)];while(this[_0x313a21(0x241)]){try{this[_0x313a21(0x220)]=new AbortController();let _0x498abe={'Accept':_0x313a21(0x24b)};if(this['token'])_0x498abe['Authorization']=_0x313a21(0x244)+this['token'];let _0x1d0d64=await fetch(_0x4bda64,{'headers':_0x498abe,'signal':this['sseAbort'][_0x313a21(0x202)]});if(!_0x1d0d64['ok']||!_0x1d0d64[_0x313a21(0x20c)]){this[_0x313a21(0x22b)]('SSE\x20failed:\x20'+_0x1d0d64[_0x313a21(0x224)]),await this[_0x313a21(0x22d)](_0x267cd2),_0x267cd2=Math[_0x313a21(0x238)](_0x267cd2*1.5,0xea60);continue;}_0x267cd2=this[_0x313a21(0x237)];let _0x15e012=_0x1d0d64[_0x313a21(0x20c)][_0x313a21(0x25c)](),_0x1d9fb7=new TextDecoder(),_0x1d8187='';while(this[_0x313a21(0x241)]){let {done:_0x516aca,value:_0x35afc7}=await _0x15e012[_0x313a21(0x21f)]();if(_0x516aca)break;_0x1d8187+=_0x1d9fb7[_0x313a21(0x1f7)](_0x35afc7,{'stream':!0x0});let _0x292069=_0x1d8187['split']('\x0a');_0x1d8187=_0x292069['pop']()||'';for(let _0x34d8f8 of _0x292069){if(!_0x34d8f8[_0x313a21(0x230)]('data:\x20'))continue;try{let _0x520550=JSON[_0x313a21(0x23f)](_0x34d8f8[_0x313a21(0x200)](0x6));if(_0x520550[_0x313a21(0x23d)]===_0x313a21(0x21d)){this[_0x313a21(0x22b)](_0x313a21(0x232)),this[_0x313a21(0x21c)](_0x313a21(0x21d));continue;}if(_0x520550[_0x313a21(0x23d)]===_0x313a21(0x231)||_0x520550[_0x313a21(0x23d)]===_0x313a21(0x25d)||_0x520550[_0x313a21(0x23d)]===_0x313a21(0x24d))await this[_0x313a21(0x211)]();}catch{}}}}catch(_0xaf4f9d){if(_0xaf4f9d[_0x313a21(0x217)]===_0x313a21(0x23b))break;this[_0x313a21(0x21c)](_0x313a21(0x218),_0xaf4f9d),this[_0x313a21(0x22b)](_0x313a21(0x1f5)+_0xaf4f9d[_0x313a21(0x25f)]);}if(this[_0x313a21(0x241)])this[_0x313a21(0x21c)](_0x313a21(0x21b)),this['log'](_0x313a21(0x210)+_0x267cd2/0x3e8+'s...'),await this[_0x313a21(0x22d)](_0x267cd2),_0x267cd2=Math[_0x313a21(0x238)](_0x267cd2*1.5,0xea60);}}async[a0_0x25910b(0x211)](){const _0x470403=a0_0x25910b;try{let _0x5a07c5=(await this[_0x470403(0x24f)]('get_inbox',{'alias':this[_0x470403(0x203)],'limit':0xa}))?.['messages']||[];for(let _0x8d0b72 of _0x5a07c5)await this['call'](_0x470403(0x1fe),{'alias':this[_0x470403(0x203)],'message_id':_0x8d0b72['id']}),this[_0x470403(0x22b)]('←\x20'+_0x8d0b72[_0x470403(0x233)]+':\x20'+_0x8d0b72['content'][_0x470403(0x200)](0x0,0x3c)),this[_0x470403(0x21c)](_0x470403(0x201),_0x8d0b72),this[_0x470403(0x21c)](_0x470403(0x25f),_0x8d0b72);}catch(_0x47ff49){this['log']('inbox\x20error:\x20'+_0x47ff49[_0x470403(0x25f)]);}}[a0_0x25910b(0x22d)](_0x2345f1){return new Promise(_0x5bae16=>setTimeout(_0x5bae16,_0x2345f1));}}var F=$;export{F as default,$ as CommHub};