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

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
+ const a0_0x102bc7=a0_0x14eb;(function(_0x1f9b45,_0x43fc8b){const _0x1bade9=a0_0x14eb,_0x4ba34d=_0x1f9b45();while(!![]){try{const _0x530f53=-parseInt(_0x1bade9(0x153))/0x1+parseInt(_0x1bade9(0x137))/0x2*(-parseInt(_0x1bade9(0x1a2))/0x3)+-parseInt(_0x1bade9(0x161))/0x4+parseInt(_0x1bade9(0x19b))/0x5*(parseInt(_0x1bade9(0x124))/0x6)+parseInt(_0x1bade9(0x163))/0x7+parseInt(_0x1bade9(0x126))/0x8+-parseInt(_0x1bade9(0x12e))/0x9*(-parseInt(_0x1bade9(0x176))/0xa);if(_0x530f53===_0x43fc8b)break;else _0x4ba34d['push'](_0x4ba34d['shift']());}catch(_0x4cac69){_0x4ba34d['push'](_0x4ba34d['shift']());}}}(a0_0x4342,0xa5219));function a0_0x14eb(_0x4fd668,_0x5b4226){_0x4fd668=_0x4fd668-0x124;const _0x4342bd=a0_0x4342();let _0x14eb93=_0x4342bd[_0x4fd668];return _0x14eb93;}import{EventEmitter as a0_0x177516}from'events';import{hostname as a0_0x2ce197}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x550ce3,_0x2aca58)=>(_0x550ce3??_0x2aca58)[a0_0x102bc7(0x178)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x102bc7(0x144)](0x0,0xf0);function N(_0x2625a1){const _0x231c97=a0_0x102bc7;return(_0x2625a1 instanceof Error?_0x2625a1[_0x231c97(0x168)]:String(_0x2625a1??_0x231c97(0x156)))[_0x231c97(0x178)](K,_0x231c97(0x184))[_0x231c97(0x178)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x231c97(0x144)](0x0,0xf0);}function O(_0x48f019,_0x2560eb=process.env.ANET_TASK_TRACE_FORMAT===a0_0x102bc7(0x190)){const _0x3d5a07=a0_0x102bc7;if(_0x2560eb)return JSON[_0x3d5a07(0x179)](_0x48f019);let _0x3c0419=L(_0x48f019[_0x3d5a07(0x183)],_0x3d5a07(0x136)),_0x1cd4ea=L(_0x48f019[_0x3d5a07(0x193)],_0x3d5a07(0x159)),_0x4c9eed=_0x48f019['error_code']?'\x20error='+_0x48f019[_0x3d5a07(0x155)]+':'+(_0x48f019['error_message']??''):'';return _0x3d5a07(0x19c)+_0x48f019['status']+_0x3d5a07(0x12d)+L(_0x48f019['from_alias'],_0x3d5a07(0x158))+_0x3d5a07(0x191)+L(_0x48f019['to_alias'],_0x3d5a07(0x158))+_0x3d5a07(0x149)+_0x1cd4ea+_0x3d5a07(0x14c)+_0x3c0419+_0x3d5a07(0x199)+L(_0x48f019[_0x3d5a07(0x145)],'<unknown>')+_0x3d5a07(0x18f)+_0x48f019[_0x3d5a07(0x17c)]+_0x3d5a07(0x166)+_0x48f019[_0x3d5a07(0x177)]+_0x3d5a07(0x171)+_0x48f019['lifecycle_tracking']+_0x4c9eed;}function U(_0x44e486){const _0x36dae5=a0_0x102bc7;return{'event':{'sending':'task.send.start','delivered':_0x36dae5(0x16e),'failed':_0x36dae5(0x173),'acked':_0x36dae5(0x147),'started':'task.started','replied':_0x36dae5(0x133),'expired':'task.expired'}[_0x44e486[_0x36dae5(0x157)]],..._0x44e486};}function j(_0x3e18bc){const _0xa4f02e=a0_0x102bc7;let _0x1c6703=_0x3e18bc?.[_0xa4f02e(0x193)]||_0x3e18bc?.[_0xa4f02e(0x148)]||_0x3e18bc?.['id'];if(_0x1c6703)return String(_0x1c6703);let _0xad9c46=_0x3e18bc?.[_0xa4f02e(0x188)]?.[0x0]?.[_0xa4f02e(0x17e)];if(typeof _0xad9c46!==_0xa4f02e(0x182))return null;try{let _0x5f28a2=JSON[_0xa4f02e(0x135)](_0xad9c46);return _0x5f28a2?.[_0xa4f02e(0x193)]||_0x5f28a2?.[_0xa4f02e(0x148)]||_0x5f28a2?.['id']||null;}catch{return null;}}async function X(_0x3b5bc5,_0x12dd0b){const _0x56b960=a0_0x102bc7;let _0x43cf5e=_0x12dd0b[_0x56b960(0x19d)]??Date[_0x56b960(0x19d)],_0x2e75b5=_0x43cf5e(),_0x12efb0=(_0x5cbc45,_0xa4f752,_0x1673ba,_0x1203a8)=>{const _0x42343e=_0x56b960;_0x12dd0b['log'](O(U({'from_alias':_0x3b5bc5[_0x42343e(0x196)],'to_alias':_0x3b5bc5[_0x42343e(0x12f)],'task_id':_0xa4f752,'parent_task_id':_0x3b5bc5[_0x42343e(0x12a)],'network_id':_0x3b5bc5[_0x42343e(0x130)],'transport':_0x3b5bc5[_0x42343e(0x17c)],'status':_0x5cbc45,'duration_ms':_0x43cf5e()-_0x2e75b5,'lifecycle_tracking':_0x3b5bc5['lifecycleTracking'],..._0x1673ba!==void 0x0?{'error_code':_0x1203a8||_0x42343e(0x128),'error_message':N(_0x1673ba)}:{}})));};_0x12efb0(_0x56b960(0x17a),null);try{let _0x565a2e=await _0x12dd0b[_0x56b960(0x174)](),_0xd143a5=j(_0x565a2e);if(_0xd143a5)_0x12efb0(_0x56b960(0x167),_0xd143a5);else{if(_0x565a2e?.['ok']===!0x1||_0x565a2e?.[_0x56b960(0x18a)])_0x12efb0(_0x56b960(0x189),_0xd143a5,_0x565a2e?.[_0x56b960(0x18a)]||_0x56b960(0x138),_0x56b960(0x132));else _0x12efb0(_0x56b960(0x189),null,_0x56b960(0x192),_0x56b960(0x12c));}return _0x565a2e;}catch(_0x33fa2f){throw _0x12efb0(_0x56b960(0x189),null,_0x33fa2f,_0x56b960(0x128)),_0x33fa2f;}}async function Y(_0x2b0bad,_0x2f4ece){const _0x3dfc07=a0_0x102bc7;return X({'fromAlias':_0x2b0bad[_0x3dfc07(0x196)],'toAlias':_0x2b0bad[_0x3dfc07(0x150)],'parentTaskId':_0x2b0bad[_0x3dfc07(0x12a)]||null,'networkId':_0x2b0bad[_0x3dfc07(0x130)]||null,'transport':_0x3dfc07(0x186),'lifecycleTracking':'not_tracked'},_0x2f4ece);}class $ extends a0_0x177516{[a0_0x102bc7(0x198)];[a0_0x102bc7(0x150)];[a0_0x102bc7(0x162)];[a0_0x102bc7(0x18c)];[a0_0x102bc7(0x170)];[a0_0x102bc7(0x12b)];[a0_0x102bc7(0x127)];['heartbeatTimer'];[a0_0x102bc7(0x164)];[a0_0x102bc7(0x146)]=!0x1;constructor(_0x40d673){const _0x2e3432=a0_0x102bc7;super();if(this[_0x2e3432(0x198)]=_0x40d673[_0x2e3432(0x198)]['replace'](/\/$/,''),this[_0x2e3432(0x150)]=_0x40d673[_0x2e3432(0x150)],this['token']=_0x40d673[_0x2e3432(0x162)],this[_0x2e3432(0x18c)]=_0x40d673[_0x2e3432(0x18c)]||_0x2e3432(0x175),this[_0x2e3432(0x170)]=_0x2e3432(0x14b)+_0x40d673[_0x2e3432(0x150)]+'-'+Date['now']()[_0x2e3432(0x185)](0x24),this[_0x2e3432(0x12b)]=_0x40d673[_0x2e3432(0x12b)]??0x2bf20,this['reconnectDelay']=_0x40d673[_0x2e3432(0x127)]??0xbb8,_0x40d673[_0x2e3432(0x172)]!==!0x1)this[_0x2e3432(0x151)]();}[a0_0x102bc7(0x152)](_0x243906){const _0x2e6a60=a0_0x102bc7;console[_0x2e6a60(0x152)]('['+new Date()['toTimeString']()[_0x2e6a60(0x144)](0x0,0x8)+_0x2e6a60(0x125)+this[_0x2e6a60(0x150)]+']\x20'+_0x243906);}async[a0_0x102bc7(0x15c)](_0x3bccf6,_0x4dba5f){const _0x68bcf9=a0_0x102bc7;let _0x322b3c={'Content-Type':_0x68bcf9(0x14d),'Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x322b3c[_0x68bcf9(0x180)]=_0x68bcf9(0x16c)+this['token'];let _0x5b4839=await(await fetch(this[_0x68bcf9(0x198)]+'/mcp',{'method':_0x68bcf9(0x154),'headers':_0x322b3c,'body':JSON[_0x68bcf9(0x179)]({'jsonrpc':_0x68bcf9(0x18b),'id':Date[_0x68bcf9(0x19d)](),'method':_0x68bcf9(0x16f),'params':{'name':_0x3bccf6,'arguments':_0x4dba5f}})}))['text'](),_0x1b6a92=_0x5b4839['match'](/data: (.+)/),_0x2748f7=_0x1b6a92?JSON[_0x68bcf9(0x135)](_0x1b6a92[0x1]):JSON[_0x68bcf9(0x135)](_0x5b4839),_0x3862d9=_0x2748f7?.['result']?.[_0x68bcf9(0x188)]?.[0x0]?.[_0x68bcf9(0x17e)];return _0x3862d9?JSON[_0x68bcf9(0x135)](_0x3862d9):_0x2748f7;}async['connect'](){const _0x8b5334=a0_0x102bc7;if(this[_0x8b5334(0x146)])return;this[_0x8b5334(0x146)]=!0x0,await this[_0x8b5334(0x157)]('idle'),this[_0x8b5334(0x152)](_0x8b5334(0x19f)),this[_0x8b5334(0x129)]=setInterval(()=>{const _0x1ee9c7=_0x8b5334;this[_0x1ee9c7(0x157)]('idle')['catch'](_0x18d794=>this[_0x1ee9c7(0x152)](_0x1ee9c7(0x15d)+_0x18d794[_0x1ee9c7(0x168)]));},this['heartbeatInterval']),this[_0x8b5334(0x13e)]();}async[a0_0x102bc7(0x134)](){const _0x15860f=a0_0x102bc7;if(this[_0x15860f(0x146)]=!0x1,this[_0x15860f(0x164)]?.['abort'](),this[_0x15860f(0x129)])clearInterval(this[_0x15860f(0x129)]);await this[_0x15860f(0x157)](_0x15860f(0x169))[_0x15860f(0x15b)](()=>{}),this[_0x15860f(0x152)](_0x15860f(0x15f));}async[a0_0x102bc7(0x174)](_0x1e8c2c,_0x272b39,_0x53eba5=a0_0x102bc7(0x181)){const _0x24c9b0=a0_0x102bc7;return Y({'alias':_0x1e8c2c,'fromAlias':this[_0x24c9b0(0x150)]},{'log':_0x5b3f1f=>console[_0x24c9b0(0x152)](_0x5b3f1f),'send':()=>this[_0x24c9b0(0x15c)](_0x24c9b0(0x131),{'alias':_0x1e8c2c,'task':_0x272b39,'priority':_0x53eba5,'from_session':this[_0x24c9b0(0x150)]})});}async['message'](_0x5584de,_0x36ed49){const _0x4b4316=a0_0x102bc7;return this[_0x4b4316(0x15c)](_0x4b4316(0x142),{'alias':_0x5584de,'message':_0x36ed49,'from_session':this['alias']});}async[a0_0x102bc7(0x1a0)](_0x307790,_0x5ac7be,_0x496871=a0_0x102bc7(0x17d)){const _0x439598=a0_0x102bc7;return this[_0x439598(0x15c)](_0x439598(0x19a),{'in_reply_to':_0x307790,'text':_0x5ac7be,'status':_0x496871});}async[a0_0x102bc7(0x157)](_0x224af0,_0x3c6cd0){const _0x26b9a1=a0_0x102bc7;return this[_0x26b9a1(0x15c)]('report_status',{'resume_id':this[_0x26b9a1(0x170)],'alias':this[_0x26b9a1(0x150)],'status':_0x224af0,'server':a0_0x2ce197(),'hostname':a0_0x2ce197(),'agent':this[_0x26b9a1(0x18c)],'project_dir':process[_0x26b9a1(0x16d)](),..._0x3c6cd0});}async['getAllStatus'](){const _0xd28cb4=a0_0x102bc7;return this[_0xd28cb4(0x15c)]('get_all_status',{});}async[a0_0x102bc7(0x14e)](_0x14351e,_0x1bb8a5){const _0x29ae0d=a0_0x102bc7;return this[_0x29ae0d(0x15c)](_0x29ae0d(0x14e),{'message':_0x14351e,'filter_server':_0x1bb8a5?.[_0x29ae0d(0x14a)],'filter_status':_0x1bb8a5?.[_0x29ae0d(0x157)]});}async[a0_0x102bc7(0x13e)](){const _0x4979fa=a0_0x102bc7;let _0x209f53=encodeURIComponent(this['alias']),_0x16dc6b=this[_0x4979fa(0x198)]+_0x4979fa(0x15a)+_0x209f53,_0x3c663a=this[_0x4979fa(0x127)];while(this[_0x4979fa(0x146)]){try{this[_0x4979fa(0x164)]=new AbortController();let _0x55958a={'Accept':_0x4979fa(0x18e)};if(this[_0x4979fa(0x162)])_0x55958a[_0x4979fa(0x180)]=_0x4979fa(0x16c)+this[_0x4979fa(0x162)];let _0x4d1664=await fetch(_0x16dc6b,{'headers':_0x55958a,'signal':this['sseAbort'][_0x4979fa(0x1a1)]});if(!_0x4d1664['ok']||!_0x4d1664['body']){this[_0x4979fa(0x152)](_0x4979fa(0x13a)+_0x4d1664[_0x4979fa(0x157)]),await this[_0x4979fa(0x141)](_0x3c663a),_0x3c663a=Math[_0x4979fa(0x17f)](_0x3c663a*1.5,0xea60);continue;}_0x3c663a=this[_0x4979fa(0x127)];let _0x359842=_0x4d1664['body'][_0x4979fa(0x13f)](),_0x2641e3=new TextDecoder(),_0x208c60='';while(this[_0x4979fa(0x146)]){let {done:_0x160cc6,value:_0x173f5b}=await _0x359842[_0x4979fa(0x195)]();if(_0x160cc6)break;_0x208c60+=_0x2641e3[_0x4979fa(0x16b)](_0x173f5b,{'stream':!0x0});let _0x26c04f=_0x208c60[_0x4979fa(0x18d)]('\x0a');_0x208c60=_0x26c04f['pop']()||'';for(let _0x29834d of _0x26c04f){if(!_0x29834d['startsWith']('data:\x20'))continue;try{let _0x2e1aa2=JSON[_0x4979fa(0x135)](_0x29834d[_0x4979fa(0x144)](0x6));if(_0x2e1aa2[_0x4979fa(0x13b)]===_0x4979fa(0x13d)){this[_0x4979fa(0x152)](_0x4979fa(0x13c)),this[_0x4979fa(0x15e)]('connected');continue;}if(_0x2e1aa2[_0x4979fa(0x13b)]===_0x4979fa(0x139)||_0x2e1aa2['type']==='new_message'||_0x2e1aa2[_0x4979fa(0x13b)]===_0x4979fa(0x14e))await this['processInbox']();}catch{}}}}catch(_0x48f7af){if(_0x48f7af[_0x4979fa(0x14f)]===_0x4979fa(0x17b))break;this[_0x4979fa(0x15e)](_0x4979fa(0x18a),_0x48f7af),this['log']('SSE\x20error:\x20'+_0x48f7af[_0x4979fa(0x168)]);}if(this[_0x4979fa(0x146)])this[_0x4979fa(0x15e)](_0x4979fa(0x15f)),this[_0x4979fa(0x152)](_0x4979fa(0x19e)+_0x3c663a/0x3e8+_0x4979fa(0x187)),await this[_0x4979fa(0x141)](_0x3c663a),_0x3c663a=Math[_0x4979fa(0x17f)](_0x3c663a*1.5,0xea60);}}async[a0_0x102bc7(0x197)](){const _0x3d6846=a0_0x102bc7;try{let _0x148638=(await this[_0x3d6846(0x15c)](_0x3d6846(0x143),{'alias':this[_0x3d6846(0x150)],'limit':0xa}))?.[_0x3d6846(0x194)]||[];for(let _0x30f13e of _0x148638)await this[_0x3d6846(0x15c)](_0x3d6846(0x140),{'alias':this[_0x3d6846(0x150)],'message_id':_0x30f13e['id']}),this[_0x3d6846(0x152)]('←\x20'+_0x30f13e[_0x3d6846(0x165)]+':\x20'+_0x30f13e[_0x3d6846(0x188)]['slice'](0x0,0x3c)),this[_0x3d6846(0x15e)](_0x3d6846(0x16a),_0x30f13e),this[_0x3d6846(0x15e)](_0x3d6846(0x168),_0x30f13e);}catch(_0x57690c){this[_0x3d6846(0x152)](_0x3d6846(0x160)+_0x57690c[_0x3d6846(0x168)]);}}[a0_0x102bc7(0x141)](_0x580a1d){return new Promise(_0x34e06f=>setTimeout(_0x34e06f,_0x580a1d));}}var F=$;export{F as default,$ as CommHub};function a0_0x4342(){const _0x4b9b70=['text/event-stream','\x20transport=','json','\x20to=','CommHub\x20response\x20omitted\x20task_id','task_id','messages','read','fromAlias','processInbox','url','\x20network_id=','send_reply','4664325RnVNKy','[commhub:task]\x20','now','SSE\x20reconnecting\x20in\x20','registered','reply','signal','3jVgwHQ','6NPRHbM',']\x20[commhub:','7806344WNCHmJ','reconnectDelay','send_failed','heartbeatTimer','parentTaskId','heartbeatInterval','missing_task_id','\x20from=','9qmdPrE','toAlias','networkId','send_task','send_rejected','task.replied','disconnect','parse','<missing>','1984252qaxIbf','CommHub\x20rejected\x20task','new_task','SSE\x20failed:\x20','type','SSE\x20connected','connected','connectSSE','getReader','ack_inbox','sleep','send_message','get_inbox','slice','network_id','running','task.ack','message_id','\x20task_id=','server','sdk-','\x20parent_task_id=','application/json','broadcast','name','alias','connect','log','116834fuxRuD','POST','error_code','unknown\x20error','status','<unknown>','<pending>','/events/','catch','call','heartbeat\x20failed:\x20','emit','disconnected','inbox\x20error:\x20','1516412IeHZUm','token','301161CPwWbP','sseAbort','from_session','\x20duration_ms=','delivered','message','offline','task','decode','Bearer\x20','cwd','task.send.delivered','tools/call','resumeId','\x20lifecycle=','autoConnect','task.send.failed','send','sdk','2127590jeoWxM','duration_ms','replace','stringify','sending','AbortError','transport','completed','text','min','Authorization','normal','string','parent_task_id','[REDACTED]','toString','mcp_http','s...','content','failed','error','2.0','agent','split'];a0_0x4342=function(){return _0x4b9b70;};return a0_0x4342();}