@sleep2agi/agent-network 2.3.0-preview.101 → 2.3.0-preview.103

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_0x41c19a=a0_0x5a73;(function(_0x5a0a7d,_0x45c01e){const _0x574b3f=a0_0x5a73,_0xc6d61a=_0x5a0a7d();while(!![]){try{const _0x20da1f=-parseInt(_0x574b3f(0x15c))/0x1+parseInt(_0x574b3f(0x114))/0x2*(parseInt(_0x574b3f(0x131))/0x3)+-parseInt(_0x574b3f(0x132))/0x4+-parseInt(_0x574b3f(0xf1))/0x5+parseInt(_0x574b3f(0x137))/0x6*(-parseInt(_0x574b3f(0x115))/0x7)+parseInt(_0x574b3f(0x16d))/0x8+parseInt(_0x574b3f(0x104))/0x9;if(_0x20da1f===_0x45c01e)break;else _0xc6d61a['push'](_0xc6d61a['shift']());}catch(_0x4f6ece){_0xc6d61a['push'](_0xc6d61a['shift']());}}}(a0_0x5c8d,0x3ca29));function a0_0x5a73(_0x335993,_0x4c89b4){_0x335993=_0x335993-0xee;const _0x5c8df8=a0_0x5c8d();let _0x5a7371=_0x5c8df8[_0x335993];return _0x5a7371;}import{EventEmitter as a0_0x7f778d}from'events';import{hostname as a0_0xecbbea}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x246011,_0xc8e654)=>(_0x246011??_0xc8e654)[a0_0x41c19a(0x15e)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x41c19a(0xfe)](0x0,0xf0);function N(_0x440fa9){const _0x55a93e=a0_0x41c19a;return(_0x440fa9 instanceof Error?_0x440fa9[_0x55a93e(0x106)]:String(_0x440fa9??_0x55a93e(0x16e)))[_0x55a93e(0x15e)](K,_0x55a93e(0xfb))[_0x55a93e(0x15e)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x55a93e(0xfe)](0x0,0xf0);}function O(_0x23e89d,_0x3a6e7d=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0xdf66c1=a0_0x41c19a;if(_0x3a6e7d)return JSON[_0xdf66c1(0x100)](_0x23e89d);let _0x11ca7a=L(_0x23e89d[_0xdf66c1(0x145)],_0xdf66c1(0x162)),_0x355e31=L(_0x23e89d[_0xdf66c1(0x13a)],_0xdf66c1(0x11a)),_0x108cf2=_0x23e89d[_0xdf66c1(0x12e)]?'\x20error='+_0x23e89d['error_code']+':'+(_0x23e89d[_0xdf66c1(0x13f)]??''):'';return'[commhub:task]\x20'+_0x23e89d[_0xdf66c1(0x144)]+_0xdf66c1(0x149)+L(_0x23e89d[_0xdf66c1(0x159)],_0xdf66c1(0x14c))+_0xdf66c1(0x102)+L(_0x23e89d[_0xdf66c1(0x10c)],_0xdf66c1(0x14c))+_0xdf66c1(0x139)+_0x355e31+_0xdf66c1(0x119)+_0x11ca7a+_0xdf66c1(0x11c)+L(_0x23e89d[_0xdf66c1(0x121)],_0xdf66c1(0x14c))+'\x20transport='+_0x23e89d[_0xdf66c1(0x14b)]+'\x20duration_ms='+_0x23e89d['duration_ms']+'\x20lifecycle='+_0x23e89d['lifecycle_tracking']+_0x108cf2;}function U(_0x411781){const _0xa7bea=a0_0x41c19a;return{'event':{'sending':_0xa7bea(0x167),'delivered':'task.send.delivered','failed':_0xa7bea(0x142),'acked':'task.ack','started':_0xa7bea(0x109),'replied':_0xa7bea(0x10a),'expired':_0xa7bea(0x126)}[_0x411781[_0xa7bea(0x144)]],..._0x411781};}function j(_0x5c842d){const _0x2184f5=a0_0x41c19a;let _0x551548=_0x5c842d?.[_0x2184f5(0x13a)]||_0x5c842d?.[_0x2184f5(0x12c)]||_0x5c842d?.['id'];if(_0x551548)return String(_0x551548);let _0x14fb5f=_0x5c842d?.[_0x2184f5(0xfc)]?.[0x0]?.[_0x2184f5(0x103)];if(typeof _0x14fb5f!==_0x2184f5(0x134))return null;try{let _0x2bb18a=JSON['parse'](_0x14fb5f);return _0x2bb18a?.[_0x2184f5(0x13a)]||_0x2bb18a?.[_0x2184f5(0x12c)]||_0x2bb18a?.['id']||null;}catch{return null;}}async function X(_0x4f114a,_0x5ed91a){const _0x108d33=a0_0x41c19a;let _0x2f8cb0=_0x5ed91a[_0x108d33(0xf8)]??Date['now'],_0x172eb2=_0x2f8cb0(),_0x413190=(_0x4f1214,_0x5897b7,_0x3f6482,_0x2cbd07)=>{const _0xd2f3a8=_0x108d33;_0x5ed91a['log'](O(U({'from_alias':_0x4f114a[_0xd2f3a8(0x116)],'to_alias':_0x4f114a[_0xd2f3a8(0x129)],'task_id':_0x5897b7,'parent_task_id':_0x4f114a[_0xd2f3a8(0x10d)],'network_id':_0x4f114a[_0xd2f3a8(0x164)],'transport':_0x4f114a[_0xd2f3a8(0x14b)],'status':_0x4f1214,'duration_ms':_0x2f8cb0()-_0x172eb2,'lifecycle_tracking':_0x4f114a[_0xd2f3a8(0x136)],..._0x3f6482!==void 0x0?{'error_code':_0x2cbd07||_0xd2f3a8(0x150),'error_message':N(_0x3f6482)}:{}})));};_0x413190(_0x108d33(0x163),null);try{let _0x419b98=await _0x5ed91a[_0x108d33(0x101)](),_0x4330fa=j(_0x419b98);if(_0x4330fa)_0x413190(_0x108d33(0x124),_0x4330fa);else{if(_0x419b98?.['ok']===!0x1||_0x419b98?.[_0x108d33(0x133)])_0x413190(_0x108d33(0x152),_0x4330fa,_0x419b98?.[_0x108d33(0x133)]||_0x108d33(0x117),_0x108d33(0x146));else _0x413190(_0x108d33(0x152),null,_0x108d33(0x12f),_0x108d33(0xff));}return _0x419b98;}catch(_0x183c3c){throw _0x413190('failed',null,_0x183c3c,_0x108d33(0x150)),_0x183c3c;}}function a0_0x5c8d(){const _0x58fcea=['task.send.start','data:\x20','application/json,\x20text/event-stream','get_all_status','read','broadcast','3637184yRxDIR','unknown\x20error','toTimeString','/events/','text/event-stream','1536880sCYdsB','idle','disconnect','min','disconnected','call','log','now','agent','autoConnect','[REDACTED]','content','normal','slice','missing_task_id','stringify','send','\x20to=','text','7266906bxKGIf','heartbeatInterval','message','parse','/mcp','task.started','task.replied','abort','to_alias','parentTaskId','cwd','application/json','2.0','connected','alias','reconnectDelay','283606awuJWZ','7yuBeiI','fromAlias','CommHub\x20rejected\x20task','get_inbox','\x20parent_task_id=','<pending>','messages','\x20network_id=','from_session','body','match','heartbeat\x20failed:\x20','network_id','send_message','signal','delivered','connect','task.expired','Bearer\x20','Authorization','toAlias','SSE\x20error:\x20','type','message_id','catch','error_code','CommHub\x20response\x20omitted\x20task_id','s...','6hSDWtL','1203388UQMafH','error','string','new_task','lifecycleTracking','2641818FRIYUd','completed','\x20task_id=','task_id','sdk-','send_task','report_status','startsWith','error_message','SSE\x20connected','sleep','task.send.failed','processInbox','status','parent_task_id','send_rejected','emit','split','\x20from=','sseAbort','transport','<unknown>','ack_inbox','heartbeatTimer','mcp_http','send_failed','inbox\x20error:\x20','failed','tools/call','registered','reply','url','name','POST','from_alias','SSE\x20failed:\x20','pop','248801gEBPTX','resumeId','replace','running','server','getAllStatus','<missing>','sending','networkId','token','SSE\x20reconnecting\x20in\x20'];a0_0x5c8d=function(){return _0x58fcea;};return a0_0x5c8d();}async function Y(_0x5c153a,_0xeb8a6b){const _0x297768=a0_0x41c19a;return X({'fromAlias':_0x5c153a[_0x297768(0x116)],'toAlias':_0x5c153a[_0x297768(0x112)],'parentTaskId':_0x5c153a[_0x297768(0x10d)]||null,'networkId':_0x5c153a[_0x297768(0x164)]||null,'transport':_0x297768(0x14f),'lifecycleTracking':'not_tracked'},_0xeb8a6b);}class $ extends a0_0x7f778d{[a0_0x41c19a(0x156)];[a0_0x41c19a(0x112)];[a0_0x41c19a(0x165)];[a0_0x41c19a(0xf9)];[a0_0x41c19a(0x15d)];[a0_0x41c19a(0x105)];[a0_0x41c19a(0x113)];[a0_0x41c19a(0x14e)];[a0_0x41c19a(0x14a)];[a0_0x41c19a(0x15f)]=!0x1;constructor(_0x3c91c8){const _0x4a8f9e=a0_0x41c19a;super();if(this[_0x4a8f9e(0x156)]=_0x3c91c8[_0x4a8f9e(0x156)][_0x4a8f9e(0x15e)](/\/$/,''),this[_0x4a8f9e(0x112)]=_0x3c91c8[_0x4a8f9e(0x112)],this['token']=_0x3c91c8[_0x4a8f9e(0x165)],this[_0x4a8f9e(0xf9)]=_0x3c91c8[_0x4a8f9e(0xf9)]||'sdk',this['resumeId']=_0x4a8f9e(0x13b)+_0x3c91c8[_0x4a8f9e(0x112)]+'-'+Date['now']()['toString'](0x24),this[_0x4a8f9e(0x105)]=_0x3c91c8['heartbeatInterval']??0x2bf20,this[_0x4a8f9e(0x113)]=_0x3c91c8['reconnectDelay']??0xbb8,_0x3c91c8[_0x4a8f9e(0xfa)]!==!0x1)this[_0x4a8f9e(0x125)]();}[a0_0x41c19a(0xf7)](_0xb858a9){const _0x1f260f=a0_0x41c19a;console[_0x1f260f(0xf7)]('['+new Date()[_0x1f260f(0xee)]()[_0x1f260f(0xfe)](0x0,0x8)+']\x20[commhub:'+this[_0x1f260f(0x112)]+']\x20'+_0xb858a9);}async[a0_0x41c19a(0xf6)](_0x731e3d,_0x1aabd7){const _0x276cf1=a0_0x41c19a;let _0x3c0dcf={'Content-Type':_0x276cf1(0x10f),'Accept':_0x276cf1(0x169)};if(this[_0x276cf1(0x165)])_0x3c0dcf[_0x276cf1(0x128)]=_0x276cf1(0x127)+this['token'];let _0x2acb20=await(await fetch(this['url']+_0x276cf1(0x108),{'method':_0x276cf1(0x158),'headers':_0x3c0dcf,'body':JSON[_0x276cf1(0x100)]({'jsonrpc':_0x276cf1(0x110),'id':Date[_0x276cf1(0xf8)](),'method':_0x276cf1(0x153),'params':{'name':_0x731e3d,'arguments':_0x1aabd7}})}))[_0x276cf1(0x103)](),_0x6c646e=_0x2acb20[_0x276cf1(0x11f)](/data: (.+)/),_0x4cc53d=_0x6c646e?JSON[_0x276cf1(0x107)](_0x6c646e[0x1]):JSON[_0x276cf1(0x107)](_0x2acb20),_0x3e7a38=_0x4cc53d?.['result']?.[_0x276cf1(0xfc)]?.[0x0]?.[_0x276cf1(0x103)];return _0x3e7a38?JSON[_0x276cf1(0x107)](_0x3e7a38):_0x4cc53d;}async[a0_0x41c19a(0x125)](){const _0x3eba55=a0_0x41c19a;if(this['running'])return;this[_0x3eba55(0x15f)]=!0x0,await this[_0x3eba55(0x144)](_0x3eba55(0xf2)),this[_0x3eba55(0xf7)](_0x3eba55(0x154)),this['heartbeatTimer']=setInterval(()=>{const _0x206b81=_0x3eba55;this[_0x206b81(0x144)](_0x206b81(0xf2))[_0x206b81(0x12d)](_0x26dd69=>this[_0x206b81(0xf7)](_0x206b81(0x120)+_0x26dd69[_0x206b81(0x106)]));},this[_0x3eba55(0x105)]),this['connectSSE']();}async[a0_0x41c19a(0xf3)](){const _0x3704ac=a0_0x41c19a;if(this[_0x3704ac(0x15f)]=!0x1,this[_0x3704ac(0x14a)]?.[_0x3704ac(0x10b)](),this[_0x3704ac(0x14e)])clearInterval(this[_0x3704ac(0x14e)]);await this[_0x3704ac(0x144)]('offline')[_0x3704ac(0x12d)](()=>{}),this['log'](_0x3704ac(0xf5));}async['send'](_0x1c90bb,_0x23a8e7,_0x55ac7d=a0_0x41c19a(0xfd)){const _0xa07781=a0_0x41c19a;return Y({'alias':_0x1c90bb,'fromAlias':this[_0xa07781(0x112)]},{'log':_0x596a00=>console[_0xa07781(0xf7)](_0x596a00),'send':()=>this[_0xa07781(0xf6)](_0xa07781(0x13c),{'alias':_0x1c90bb,'task':_0x23a8e7,'priority':_0x55ac7d,'from_session':this[_0xa07781(0x112)]})});}async[a0_0x41c19a(0x106)](_0x4d7860,_0x1520da){const _0x3ec1ff=a0_0x41c19a;return this[_0x3ec1ff(0xf6)](_0x3ec1ff(0x122),{'alias':_0x4d7860,'message':_0x1520da,'from_session':this[_0x3ec1ff(0x112)]});}async[a0_0x41c19a(0x155)](_0x4b56ec,_0x2378f9,_0x13a0fb=a0_0x41c19a(0x138)){return this['call']('send_reply',{'in_reply_to':_0x4b56ec,'text':_0x2378f9,'status':_0x13a0fb});}async[a0_0x41c19a(0x144)](_0x218d45,_0x44e9da){const _0x2879cf=a0_0x41c19a;return this[_0x2879cf(0xf6)](_0x2879cf(0x13d),{'resume_id':this[_0x2879cf(0x15d)],'alias':this['alias'],'status':_0x218d45,'server':a0_0xecbbea(),'hostname':a0_0xecbbea(),'agent':this['agent'],'project_dir':process[_0x2879cf(0x10e)](),..._0x44e9da});}async[a0_0x41c19a(0x161)](){const _0x10e991=a0_0x41c19a;return this[_0x10e991(0xf6)](_0x10e991(0x16a),{});}async[a0_0x41c19a(0x16c)](_0x3bd5b6,_0x4cb79c){const _0x550578=a0_0x41c19a;return this[_0x550578(0xf6)](_0x550578(0x16c),{'message':_0x3bd5b6,'filter_server':_0x4cb79c?.[_0x550578(0x160)],'filter_status':_0x4cb79c?.[_0x550578(0x144)]});}async['connectSSE'](){const _0x516816=a0_0x41c19a;let _0xf3b7f=encodeURIComponent(this[_0x516816(0x112)]),_0x106022=this[_0x516816(0x156)]+_0x516816(0xef)+_0xf3b7f,_0x4f53a6=this[_0x516816(0x113)];while(this[_0x516816(0x15f)]){try{this['sseAbort']=new AbortController();let _0x2670f4={'Accept':_0x516816(0xf0)};if(this['token'])_0x2670f4['Authorization']=_0x516816(0x127)+this[_0x516816(0x165)];let _0x86bab9=await fetch(_0x106022,{'headers':_0x2670f4,'signal':this[_0x516816(0x14a)][_0x516816(0x123)]});if(!_0x86bab9['ok']||!_0x86bab9[_0x516816(0x11e)]){this[_0x516816(0xf7)](_0x516816(0x15a)+_0x86bab9[_0x516816(0x144)]),await this[_0x516816(0x141)](_0x4f53a6),_0x4f53a6=Math[_0x516816(0xf4)](_0x4f53a6*1.5,0xea60);continue;}_0x4f53a6=this[_0x516816(0x113)];let _0x16c513=_0x86bab9['body']['getReader'](),_0x5508d2=new TextDecoder(),_0x77ef='';while(this[_0x516816(0x15f)]){let {done:_0x1744a0,value:_0x558575}=await _0x16c513[_0x516816(0x16b)]();if(_0x1744a0)break;_0x77ef+=_0x5508d2['decode'](_0x558575,{'stream':!0x0});let _0x3920fe=_0x77ef[_0x516816(0x148)]('\x0a');_0x77ef=_0x3920fe[_0x516816(0x15b)]()||'';for(let _0xa8d774 of _0x3920fe){if(!_0xa8d774[_0x516816(0x13e)](_0x516816(0x168)))continue;try{let _0x59fbaa=JSON[_0x516816(0x107)](_0xa8d774['slice'](0x6));if(_0x59fbaa[_0x516816(0x12b)]===_0x516816(0x111)){this[_0x516816(0xf7)](_0x516816(0x140)),this[_0x516816(0x147)](_0x516816(0x111));continue;}if(_0x59fbaa[_0x516816(0x12b)]===_0x516816(0x135)||_0x59fbaa[_0x516816(0x12b)]==='new_message'||_0x59fbaa['type']===_0x516816(0x16c))await this[_0x516816(0x143)]();}catch{}}}}catch(_0x4a3595){if(_0x4a3595[_0x516816(0x157)]==='AbortError')break;this['emit']('error',_0x4a3595),this[_0x516816(0xf7)](_0x516816(0x12a)+_0x4a3595['message']);}if(this['running'])this[_0x516816(0x147)]('disconnected'),this['log'](_0x516816(0x166)+_0x4f53a6/0x3e8+_0x516816(0x130)),await this[_0x516816(0x141)](_0x4f53a6),_0x4f53a6=Math[_0x516816(0xf4)](_0x4f53a6*1.5,0xea60);}}async[a0_0x41c19a(0x143)](){const _0x5d75eb=a0_0x41c19a;try{let _0x40e463=(await this[_0x5d75eb(0xf6)](_0x5d75eb(0x118),{'alias':this[_0x5d75eb(0x112)],'limit':0xa}))?.[_0x5d75eb(0x11b)]||[];for(let _0x594d93 of _0x40e463)await this['call'](_0x5d75eb(0x14d),{'alias':this[_0x5d75eb(0x112)],'message_id':_0x594d93['id']}),this[_0x5d75eb(0xf7)]('←\x20'+_0x594d93[_0x5d75eb(0x11d)]+':\x20'+_0x594d93[_0x5d75eb(0xfc)][_0x5d75eb(0xfe)](0x0,0x3c)),this['emit']('task',_0x594d93),this[_0x5d75eb(0x147)](_0x5d75eb(0x106),_0x594d93);}catch(_0x5215a9){this['log'](_0x5d75eb(0x151)+_0x5215a9[_0x5d75eb(0x106)]);}}['sleep'](_0x155e7e){return new Promise(_0x24322b=>setTimeout(_0x24322b,_0x155e7e));}}var F=$;export{F as default,$ as CommHub};
1
+ const a0_0x78f856=a0_0x4c67;(function(_0x15b692,_0x3456c4){const _0x209c6b=a0_0x4c67,_0x3efb04=_0x15b692();while(!![]){try{const _0x8d47c2=-parseInt(_0x209c6b(0x260))/0x1*(-parseInt(_0x209c6b(0x253))/0x2)+-parseInt(_0x209c6b(0x267))/0x3+-parseInt(_0x209c6b(0x20f))/0x4*(parseInt(_0x209c6b(0x22d))/0x5)+-parseInt(_0x209c6b(0x224))/0x6*(parseInt(_0x209c6b(0x24a))/0x7)+-parseInt(_0x209c6b(0x20a))/0x8*(-parseInt(_0x209c6b(0x214))/0x9)+parseInt(_0x209c6b(0x23d))/0xa*(parseInt(_0x209c6b(0x24f))/0xb)+-parseInt(_0x209c6b(0x226))/0xc*(-parseInt(_0x209c6b(0x1f6))/0xd);if(_0x8d47c2===_0x3456c4)break;else _0x3efb04['push'](_0x3efb04['shift']());}catch(_0x54073c){_0x3efb04['push'](_0x3efb04['shift']());}}}(a0_0x5c99,0x420b8));import{EventEmitter as a0_0x33dc6a}from'events';function a0_0x5c99(){const _0x460a75=['700TvyqFl','failed','toAlias','application/json','name','Bearer\x20',']\x20[commhub:','new_task','call','<unknown>','running','alias','error_message','/events/','catch','error_code','631010yyjfMO','\x20to=','body','split','\x20lifecycle=','resumeId','url','connected','Authorization','data:\x20','autoConnect','sdk-','text/event-stream','21679NUkNCD','lifecycle_tracking','text','AbortError','SSE\x20reconnecting\x20in\x20','11zEEdYb','tools/call','duration_ms','task.started','17264qslVub','sdk','read','lifecycleTracking','type','transport','CommHub\x20rejected\x20task','\x20network_id=','content','send_reply','delivered','log','completed','24UCPqKX','task.send.delivered','missing_task_id','task','getReader','task.send.start','get_all_status','421566mpMbAa','result','to_alias','[REDACTED]','fromAlias','min','registered','SSE\x20error:\x20','reconnectDelay','POST','mcp_http','token','task.send.failed','now','\x20from=','string','send','<pending>','task_id','[commhub:task]\x20','networkId','getAllStatus','broadcast','13KTmDyV','<missing>','decode','sending','agent','parse','2.0','disconnect','messages','processInbox','\x20transport=','idle','abort','\x20duration_ms=','send_failed','\x20parent_task_id=','task.replied','startsWith','replace','from_session','24tqShIF','send_message','\x20error=','new_message','heartbeatInterval','3028azISMc','server','ack_inbox','emit','sleep','78129xeRKkB','CommHub\x20response\x20omitted\x20task_id','heartbeatTimer','inbox\x20error:\x20','status','normal','SSE\x20failed:\x20','disconnected','pop','stringify','match','task.expired','signal','heartbeat\x20failed:\x20','reply','task.ack','894tUxpZz','sseAbort','8185956tqZFPl','message','message_id','not_tracked','connectSSE','slice','error'];a0_0x5c99=function(){return _0x460a75;};return a0_0x5c99();}import{hostname as a0_0x3cb95e}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x55332b,_0x293f6f)=>(_0x55332b??_0x293f6f)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x78f856(0x22b)](0x0,0xf0);function N(_0x10a0ae){const _0x32b73e=a0_0x78f856;return(_0x10a0ae instanceof Error?_0x10a0ae['message']:String(_0x10a0ae??'unknown\x20error'))[_0x32b73e(0x208)](K,_0x32b73e(0x26a))[_0x32b73e(0x208)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x32b73e(0x22b)](0x0,0xf0);}function O(_0x159a22,_0x1e8c9c=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0x3c8ea0=a0_0x78f856;if(_0x1e8c9c)return JSON['stringify'](_0x159a22);let _0x8521db=L(_0x159a22['parent_task_id'],_0x3c8ea0(0x1f7)),_0x1b276e=L(_0x159a22[_0x3c8ea0(0x1f1)],_0x3c8ea0(0x1f0)),_0x52375d=_0x159a22[_0x3c8ea0(0x23c)]?_0x3c8ea0(0x20c)+_0x159a22[_0x3c8ea0(0x23c)]+':'+(_0x159a22[_0x3c8ea0(0x239)]??''):'';return _0x3c8ea0(0x1f2)+_0x159a22[_0x3c8ea0(0x218)]+_0x3c8ea0(0x275)+L(_0x159a22['from_alias'],_0x3c8ea0(0x236))+_0x3c8ea0(0x23e)+L(_0x159a22[_0x3c8ea0(0x269)],_0x3c8ea0(0x236))+'\x20task_id='+_0x1b276e+_0x3c8ea0(0x205)+_0x8521db+_0x3c8ea0(0x25a)+L(_0x159a22['network_id'],'<unknown>')+_0x3c8ea0(0x200)+_0x159a22[_0x3c8ea0(0x258)]+_0x3c8ea0(0x203)+_0x159a22[_0x3c8ea0(0x251)]+_0x3c8ea0(0x241)+_0x159a22[_0x3c8ea0(0x24b)]+_0x52375d;}function U(_0x332d41){const _0x4872ee=a0_0x78f856;return{'event':{'sending':_0x4872ee(0x265),'delivered':_0x4872ee(0x261),'failed':_0x4872ee(0x273),'acked':_0x4872ee(0x223),'started':_0x4872ee(0x252),'replied':_0x4872ee(0x206),'expired':_0x4872ee(0x21f)}[_0x332d41[_0x4872ee(0x218)]],..._0x332d41};}function j(_0x58a26){const _0x596c62=a0_0x78f856;let _0x4dd93d=_0x58a26?.['task_id']||_0x58a26?.[_0x596c62(0x228)]||_0x58a26?.['id'];if(_0x4dd93d)return String(_0x4dd93d);let _0x4e6c74=_0x58a26?.[_0x596c62(0x25b)]?.[0x0]?.[_0x596c62(0x24c)];if(typeof _0x4e6c74!==_0x596c62(0x276))return null;try{let _0x9dbec6=JSON[_0x596c62(0x1fb)](_0x4e6c74);return _0x9dbec6?.[_0x596c62(0x1f1)]||_0x9dbec6?.[_0x596c62(0x228)]||_0x9dbec6?.['id']||null;}catch{return null;}}async function X(_0x39570d,_0x329e62){const _0x1b4d98=a0_0x78f856;let _0x2d74ed=_0x329e62[_0x1b4d98(0x274)]??Date[_0x1b4d98(0x274)],_0x3d1c97=_0x2d74ed(),_0x1abf7d=(_0x3ec254,_0x6866cb,_0x5a6958,_0x569d85)=>{const _0x5ed6d2=_0x1b4d98;_0x329e62['log'](O(U({'from_alias':_0x39570d['fromAlias'],'to_alias':_0x39570d[_0x5ed6d2(0x22f)],'task_id':_0x6866cb,'parent_task_id':_0x39570d['parentTaskId'],'network_id':_0x39570d[_0x5ed6d2(0x1f3)],'transport':_0x39570d[_0x5ed6d2(0x258)],'status':_0x3ec254,'duration_ms':_0x2d74ed()-_0x3d1c97,'lifecycle_tracking':_0x39570d[_0x5ed6d2(0x256)],..._0x5a6958!==void 0x0?{'error_code':_0x569d85||'send_failed','error_message':N(_0x5a6958)}:{}})));};_0x1abf7d(_0x1b4d98(0x1f9),null);try{let _0x206b5a=await _0x329e62['send'](),_0x4ee670=j(_0x206b5a);if(_0x4ee670)_0x1abf7d(_0x1b4d98(0x25d),_0x4ee670);else{if(_0x206b5a?.['ok']===!0x1||_0x206b5a?.[_0x1b4d98(0x22c)])_0x1abf7d(_0x1b4d98(0x22e),_0x4ee670,_0x206b5a?.['error']||_0x1b4d98(0x259),'send_rejected');else _0x1abf7d(_0x1b4d98(0x22e),null,_0x1b4d98(0x215),_0x1b4d98(0x262));}return _0x206b5a;}catch(_0x39ecea){throw _0x1abf7d('failed',null,_0x39ecea,_0x1b4d98(0x204)),_0x39ecea;}}async function Y(_0x408ea4,_0x177629){const _0x37078c=a0_0x78f856;return X({'fromAlias':_0x408ea4[_0x37078c(0x26b)],'toAlias':_0x408ea4[_0x37078c(0x238)],'parentTaskId':_0x408ea4['parentTaskId']||null,'networkId':_0x408ea4[_0x37078c(0x1f3)]||null,'transport':_0x37078c(0x271),'lifecycleTracking':_0x37078c(0x229)},_0x177629);}function a0_0x4c67(_0x1a388d,_0x8693c5){_0x1a388d=_0x1a388d-0x1ef;const _0x5c99f7=a0_0x5c99();let _0x4c6703=_0x5c99f7[_0x1a388d];return _0x4c6703;}class $ extends a0_0x33dc6a{[a0_0x78f856(0x243)];[a0_0x78f856(0x238)];[a0_0x78f856(0x272)];[a0_0x78f856(0x1fa)];[a0_0x78f856(0x242)];[a0_0x78f856(0x20e)];[a0_0x78f856(0x26f)];[a0_0x78f856(0x216)];[a0_0x78f856(0x225)];['running']=!0x1;constructor(_0x94c3d5){const _0x12e923=a0_0x78f856;super();if(this[_0x12e923(0x243)]=_0x94c3d5[_0x12e923(0x243)][_0x12e923(0x208)](/\/$/,''),this[_0x12e923(0x238)]=_0x94c3d5[_0x12e923(0x238)],this[_0x12e923(0x272)]=_0x94c3d5[_0x12e923(0x272)],this['agent']=_0x94c3d5[_0x12e923(0x1fa)]||_0x12e923(0x254),this[_0x12e923(0x242)]=_0x12e923(0x248)+_0x94c3d5[_0x12e923(0x238)]+'-'+Date['now']()['toString'](0x24),this[_0x12e923(0x20e)]=_0x94c3d5[_0x12e923(0x20e)]??0x2bf20,this['reconnectDelay']=_0x94c3d5[_0x12e923(0x26f)]??0xbb8,_0x94c3d5[_0x12e923(0x247)]!==!0x1)this['connect']();}[a0_0x78f856(0x25e)](_0x4a709c){const _0xd0d02b=a0_0x78f856;console[_0xd0d02b(0x25e)]('['+new Date()['toTimeString']()['slice'](0x0,0x8)+_0xd0d02b(0x233)+this[_0xd0d02b(0x238)]+']\x20'+_0x4a709c);}async[a0_0x78f856(0x235)](_0x1b33c2,_0x2f4365){const _0x2e30c5=a0_0x78f856;let _0x165e68={'Content-Type':_0x2e30c5(0x230),'Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x165e68[_0x2e30c5(0x245)]=_0x2e30c5(0x232)+this[_0x2e30c5(0x272)];let _0x38ded9=await(await fetch(this[_0x2e30c5(0x243)]+'/mcp',{'method':_0x2e30c5(0x270),'headers':_0x165e68,'body':JSON[_0x2e30c5(0x21d)]({'jsonrpc':_0x2e30c5(0x1fc),'id':Date[_0x2e30c5(0x274)](),'method':_0x2e30c5(0x250),'params':{'name':_0x1b33c2,'arguments':_0x2f4365}})}))[_0x2e30c5(0x24c)](),_0x57f42d=_0x38ded9[_0x2e30c5(0x21e)](/data: (.+)/),_0x280e57=_0x57f42d?JSON['parse'](_0x57f42d[0x1]):JSON[_0x2e30c5(0x1fb)](_0x38ded9),_0xa3a4d=_0x280e57?.[_0x2e30c5(0x268)]?.['content']?.[0x0]?.[_0x2e30c5(0x24c)];return _0xa3a4d?JSON[_0x2e30c5(0x1fb)](_0xa3a4d):_0x280e57;}async['connect'](){const _0x522cfd=a0_0x78f856;if(this['running'])return;this['running']=!0x0,await this[_0x522cfd(0x218)](_0x522cfd(0x201)),this[_0x522cfd(0x25e)](_0x522cfd(0x26d)),this['heartbeatTimer']=setInterval(()=>{const _0x531f17=_0x522cfd;this[_0x531f17(0x218)](_0x531f17(0x201))[_0x531f17(0x23b)](_0x3f81c2=>this['log'](_0x531f17(0x221)+_0x3f81c2['message']));},this[_0x522cfd(0x20e)]),this['connectSSE']();}async[a0_0x78f856(0x1fd)](){const _0x2743ab=a0_0x78f856;if(this[_0x2743ab(0x237)]=!0x1,this['sseAbort']?.[_0x2743ab(0x202)](),this[_0x2743ab(0x216)])clearInterval(this[_0x2743ab(0x216)]);await this[_0x2743ab(0x218)]('offline')[_0x2743ab(0x23b)](()=>{}),this[_0x2743ab(0x25e)](_0x2743ab(0x21b));}async[a0_0x78f856(0x1ef)](_0x43f6d4,_0x577f98,_0xd3b6e6=a0_0x78f856(0x219)){const _0x4b1f94=a0_0x78f856;return Y({'alias':_0x43f6d4,'fromAlias':this[_0x4b1f94(0x238)]},{'log':_0x931e94=>console[_0x4b1f94(0x25e)](_0x931e94),'send':()=>this[_0x4b1f94(0x235)]('send_task',{'alias':_0x43f6d4,'task':_0x577f98,'priority':_0xd3b6e6,'from_session':this['alias']})});}async[a0_0x78f856(0x227)](_0x3f3e76,_0x263232){const _0x3d33a1=a0_0x78f856;return this[_0x3d33a1(0x235)](_0x3d33a1(0x20b),{'alias':_0x3f3e76,'message':_0x263232,'from_session':this[_0x3d33a1(0x238)]});}async[a0_0x78f856(0x222)](_0x5ef90f,_0x5da895,_0x2f59d9=a0_0x78f856(0x25f)){const _0x42319f=a0_0x78f856;return this[_0x42319f(0x235)](_0x42319f(0x25c),{'in_reply_to':_0x5ef90f,'text':_0x5da895,'status':_0x2f59d9});}async[a0_0x78f856(0x218)](_0x2fe3a9,_0xd10c43){const _0x1c168a=a0_0x78f856;return this['call']('report_status',{'resume_id':this['resumeId'],'alias':this[_0x1c168a(0x238)],'status':_0x2fe3a9,'server':a0_0x3cb95e(),'hostname':a0_0x3cb95e(),'agent':this[_0x1c168a(0x1fa)],'project_dir':process['cwd'](),..._0xd10c43});}async[a0_0x78f856(0x1f4)](){const _0x50aaef=a0_0x78f856;return this[_0x50aaef(0x235)](_0x50aaef(0x266),{});}async['broadcast'](_0x31654a,_0x84b58b){const _0x2a5a42=a0_0x78f856;return this[_0x2a5a42(0x235)](_0x2a5a42(0x1f5),{'message':_0x31654a,'filter_server':_0x84b58b?.[_0x2a5a42(0x210)],'filter_status':_0x84b58b?.[_0x2a5a42(0x218)]});}async[a0_0x78f856(0x22a)](){const _0x5abd52=a0_0x78f856;let _0x364599=encodeURIComponent(this['alias']),_0x1209f8=this[_0x5abd52(0x243)]+_0x5abd52(0x23a)+_0x364599,_0x44e665=this[_0x5abd52(0x26f)];while(this[_0x5abd52(0x237)]){try{this[_0x5abd52(0x225)]=new AbortController();let _0x2d8f21={'Accept':_0x5abd52(0x249)};if(this[_0x5abd52(0x272)])_0x2d8f21['Authorization']=_0x5abd52(0x232)+this['token'];let _0x763963=await fetch(_0x1209f8,{'headers':_0x2d8f21,'signal':this[_0x5abd52(0x225)][_0x5abd52(0x220)]});if(!_0x763963['ok']||!_0x763963[_0x5abd52(0x23f)]){this[_0x5abd52(0x25e)](_0x5abd52(0x21a)+_0x763963[_0x5abd52(0x218)]),await this[_0x5abd52(0x213)](_0x44e665),_0x44e665=Math[_0x5abd52(0x26c)](_0x44e665*1.5,0xea60);continue;}_0x44e665=this[_0x5abd52(0x26f)];let _0x28a39b=_0x763963[_0x5abd52(0x23f)][_0x5abd52(0x264)](),_0x4ece51=new TextDecoder(),_0x4621e3='';while(this['running']){let {done:_0x1db90f,value:_0x1be220}=await _0x28a39b[_0x5abd52(0x255)]();if(_0x1db90f)break;_0x4621e3+=_0x4ece51[_0x5abd52(0x1f8)](_0x1be220,{'stream':!0x0});let _0x494c12=_0x4621e3[_0x5abd52(0x240)]('\x0a');_0x4621e3=_0x494c12[_0x5abd52(0x21c)]()||'';for(let _0x570f4c of _0x494c12){if(!_0x570f4c[_0x5abd52(0x207)](_0x5abd52(0x246)))continue;try{let _0x4e3791=JSON[_0x5abd52(0x1fb)](_0x570f4c['slice'](0x6));if(_0x4e3791[_0x5abd52(0x257)]===_0x5abd52(0x244)){this[_0x5abd52(0x25e)]('SSE\x20connected'),this['emit'](_0x5abd52(0x244));continue;}if(_0x4e3791['type']===_0x5abd52(0x234)||_0x4e3791[_0x5abd52(0x257)]===_0x5abd52(0x20d)||_0x4e3791['type']==='broadcast')await this[_0x5abd52(0x1ff)]();}catch{}}}}catch(_0x343a7f){if(_0x343a7f[_0x5abd52(0x231)]===_0x5abd52(0x24d))break;this[_0x5abd52(0x212)](_0x5abd52(0x22c),_0x343a7f),this[_0x5abd52(0x25e)](_0x5abd52(0x26e)+_0x343a7f[_0x5abd52(0x227)]);}if(this[_0x5abd52(0x237)])this['emit']('disconnected'),this[_0x5abd52(0x25e)](_0x5abd52(0x24e)+_0x44e665/0x3e8+'s...'),await this[_0x5abd52(0x213)](_0x44e665),_0x44e665=Math[_0x5abd52(0x26c)](_0x44e665*1.5,0xea60);}}async['processInbox'](){const _0xfcfce=a0_0x78f856;try{let _0x34d4f1=(await this[_0xfcfce(0x235)]('get_inbox',{'alias':this[_0xfcfce(0x238)],'limit':0xa}))?.[_0xfcfce(0x1fe)]||[];for(let _0x42f299 of _0x34d4f1)await this[_0xfcfce(0x235)](_0xfcfce(0x211),{'alias':this[_0xfcfce(0x238)],'message_id':_0x42f299['id']}),this['log']('←\x20'+_0x42f299[_0xfcfce(0x209)]+':\x20'+_0x42f299[_0xfcfce(0x25b)]['slice'](0x0,0x3c)),this[_0xfcfce(0x212)](_0xfcfce(0x263),_0x42f299),this['emit']('message',_0x42f299);}catch(_0x2c5641){this[_0xfcfce(0x25e)](_0xfcfce(0x217)+_0x2c5641[_0xfcfce(0x227)]);}}['sleep'](_0x5cbb24){return new Promise(_0x510de8=>setTimeout(_0x510de8,_0x5cbb24));}}var F=$;export{F as default,$ as CommHub};