@sleep2agi/agent-network 2.3.0-preview.119 → 2.3.0-preview.120
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.
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x44d3c0=a0_0x9fb0;(function(_0xcf57d2,_0x277d03){const _0x13f471=a0_0x9fb0,_0x23abe9=_0xcf57d2();while(!![]){try{const _0x493b8f=parseInt(_0x13f471(0x1a2))/0x1+-parseInt(_0x13f471(0x1bf))/0x2*(-parseInt(_0x13f471(0x196))/0x3)+-parseInt(_0x13f471(0x1a1))/0x4+parseInt(_0x13f471(0x1f3))/0x5+parseInt(_0x13f471(0x1ef))/0x6+-parseInt(_0x13f471(0x1ff))/0x7*(-parseInt(_0x13f471(0x1b9))/0x8)+parseInt(_0x13f471(0x199))/0x9*(-parseInt(_0x13f471(0x1c0))/0xa);if(_0x493b8f===_0x277d03)break;else _0x23abe9['push'](_0x23abe9['shift']());}catch(_0x436a6d){_0x23abe9['push'](_0x23abe9['shift']());}}}(a0_0x2e69,0x7102a));function a0_0x9fb0(_0x140a00,_0x48433a){_0x140a00=_0x140a00-0x180;const _0x2e6917=a0_0x2e69();let _0x9fb03e=_0x2e6917[_0x140a00];return _0x9fb03e;}import{EventEmitter as a0_0x3f510e}from'events';import{hostname as a0_0x593437}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x52bcf3,_0x135a45)=>(_0x52bcf3??_0x135a45)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x44d3c0(0x1ae)](0x0,0xf0);function N(_0x4dee0f){const _0x45f874=a0_0x44d3c0;return(_0x4dee0f instanceof Error?_0x4dee0f[_0x45f874(0x1b5)]:String(_0x4dee0f??_0x45f874(0x1a7)))[_0x45f874(0x1da)](K,_0x45f874(0x194))[_0x45f874(0x1da)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x45f874(0x1ae)](0x0,0xf0);}function O(_0x54a03c,_0x838a8f=process.env.ANET_TASK_TRACE_FORMAT===a0_0x44d3c0(0x1e9)){const _0x61b3ee=a0_0x44d3c0;if(_0x838a8f)return JSON['stringify'](_0x54a03c);let _0x2a0b72=L(_0x54a03c[_0x61b3ee(0x1fc)],_0x61b3ee(0x1ba)),_0x3e7ef4=L(_0x54a03c[_0x61b3ee(0x1f1)],_0x61b3ee(0x1bd)),_0x2135f8=_0x54a03c['error_code']?'\x20error='+_0x54a03c[_0x61b3ee(0x1c5)]+':'+(_0x54a03c[_0x61b3ee(0x1dc)]??''):'';return'[commhub:task]\x20'+_0x54a03c['status']+'\x20from='+L(_0x54a03c[_0x61b3ee(0x19f)],_0x61b3ee(0x1de))+_0x61b3ee(0x1ca)+L(_0x54a03c[_0x61b3ee(0x1d3)],_0x61b3ee(0x1de))+'\x20task_id='+_0x3e7ef4+_0x61b3ee(0x1be)+_0x2a0b72+_0x61b3ee(0x1c6)+L(_0x54a03c['network_id'],_0x61b3ee(0x1de))+_0x61b3ee(0x1ee)+_0x54a03c[_0x61b3ee(0x19c)]+'\x20duration_ms='+_0x54a03c[_0x61b3ee(0x1af)]+_0x61b3ee(0x184)+_0x54a03c['lifecycle_tracking']+_0x2135f8;}function U(_0x2f3a4d){const _0x3b3f41=a0_0x44d3c0;return{'event':{'sending':_0x3b3f41(0x195),'delivered':_0x3b3f41(0x1b3),'failed':'task.send.failed','acked':_0x3b3f41(0x1f7),'started':_0x3b3f41(0x186),'replied':_0x3b3f41(0x18f),'expired':_0x3b3f41(0x1d7)}[_0x2f3a4d[_0x3b3f41(0x18e)]],..._0x2f3a4d};}function j(_0x302975){const _0x28e126=a0_0x44d3c0;let _0x5a39bc=_0x302975?.[_0x28e126(0x1f1)]||_0x302975?.['message_id']||_0x302975?.['id'];if(_0x5a39bc)return String(_0x5a39bc);let _0x248dd0=_0x302975?.[_0x28e126(0x1a4)]?.[0x0]?.['text'];if(typeof _0x248dd0!==_0x28e126(0x1d1))return null;try{let _0x505dfd=JSON[_0x28e126(0x197)](_0x248dd0);return _0x505dfd?.[_0x28e126(0x1f1)]||_0x505dfd?.[_0x28e126(0x198)]||_0x505dfd?.['id']||null;}catch{return null;}}async function X(_0x1951ba,_0x1032e8){const _0x53a1fa=a0_0x44d3c0;let _0x17c4ba=_0x1032e8['now']??Date[_0x53a1fa(0x1dd)],_0x11a02b=_0x17c4ba(),_0x1be674=(_0x2db59e,_0x1c03dd,_0x1797c0,_0x4678a6)=>{const _0x1fec13=_0x53a1fa;_0x1032e8[_0x1fec13(0x1cf)](O(U({'from_alias':_0x1951ba[_0x1fec13(0x19d)],'to_alias':_0x1951ba[_0x1fec13(0x1e5)],'task_id':_0x1c03dd,'parent_task_id':_0x1951ba[_0x1fec13(0x1b4)],'network_id':_0x1951ba['networkId'],'transport':_0x1951ba[_0x1fec13(0x19c)],'status':_0x2db59e,'duration_ms':_0x17c4ba()-_0x11a02b,'lifecycle_tracking':_0x1951ba[_0x1fec13(0x187)],..._0x1797c0!==void 0x0?{'error_code':_0x4678a6||_0x1fec13(0x1fd),'error_message':N(_0x1797c0)}:{}})));};_0x1be674(_0x53a1fa(0x18c),null);try{let _0x7bd43c=await _0x1032e8[_0x53a1fa(0x1f5)](),_0x4f94ee=j(_0x7bd43c);if(_0x4f94ee)_0x1be674(_0x53a1fa(0x18a),_0x4f94ee);else{if(_0x7bd43c?.['ok']===!0x1||_0x7bd43c?.[_0x53a1fa(0x1b6)])_0x1be674(_0x53a1fa(0x1b8),_0x4f94ee,_0x7bd43c?.[_0x53a1fa(0x1b6)]||_0x53a1fa(0x1d6),_0x53a1fa(0x1b2));else _0x1be674(_0x53a1fa(0x1b8),null,'CommHub\x20response\x20omitted\x20task_id',_0x53a1fa(0x1c2));}return _0x7bd43c;}catch(_0x29b343){throw _0x1be674(_0x53a1fa(0x1b8),null,_0x29b343,_0x53a1fa(0x1fd)),_0x29b343;}}async function Y(_0x4e71b1,_0x3f4cf5){const _0x338d33=a0_0x44d3c0;return X({'fromAlias':_0x4e71b1['fromAlias'],'toAlias':_0x4e71b1[_0x338d33(0x19e)],'parentTaskId':_0x4e71b1[_0x338d33(0x1b4)]||null,'networkId':_0x4e71b1[_0x338d33(0x1f4)]||null,'transport':'mcp_http','lifecycleTracking':_0x338d33(0x1fa)},_0x3f4cf5);}function a0_0x2e69(){const _0x1ef0d5=['connect','error_message','now','<unknown>','connectSSE','processInbox','from_session','SSE\x20failed:\x20','send_task','application/json,\x20text/event-stream','toAlias','text','autoConnect','ack_inbox','json','heartbeatTimer','broadcast','report_status','connected','\x20transport=','442728vpehxI','heartbeatInterval','task_id','2.0','4078790ikGein','networkId','send','signal','task.ack','sdk','/mcp','not_tracked','min','parent_task_id','send_failed','resumeId','3122861MxmouK','result','agent','url','sdk-','registered','\x20lifecycle=','POST','task.started','lifecycleTracking','send_message','server','delivered','toTimeString','sending','AbortError','status','task.replied','catch','sleep','idle','disconnected','[REDACTED]','task.send.start','912885gGsKZb','parse','message_id','3705804fvzjzX','sseAbort','toString','transport','fromAlias','alias','from_alias','read','520732rfRnWA','780688yuhMYm','heartbeat\x20failed:\x20','content','inbox\x20error:\x20','token','unknown\x20error','match','text/event-stream','running','reconnectDelay','type','Bearer\x20','slice','duration_ms','tools/call','cwd','send_rejected','task.send.delivered','parentTaskId','message','error','call','failed','16CZfydS','<missing>','Authorization','name','<pending>','\x20parent_task_id=','6VjeolS','70LwmSbQ','normal','missing_task_id','split','disconnect','error_code','\x20network_id=','new_message','send_reply','getReader','\x20to=','emit','startsWith','abort','application/json','log','SSE\x20connected','string','reply','to_alias','data:\x20','pop','CommHub\x20rejected\x20task','task.expired','stringify',']\x20[commhub:','replace'];a0_0x2e69=function(){return _0x1ef0d5;};return a0_0x2e69();}class $ extends a0_0x3f510e{[a0_0x44d3c0(0x181)];[a0_0x44d3c0(0x19e)];['token'];['agent'];[a0_0x44d3c0(0x1fe)];[a0_0x44d3c0(0x1f0)];[a0_0x44d3c0(0x1ab)];[a0_0x44d3c0(0x1ea)];[a0_0x44d3c0(0x19a)];[a0_0x44d3c0(0x1aa)]=!0x1;constructor(_0x36b404){const _0x35cf30=a0_0x44d3c0;super();if(this[_0x35cf30(0x181)]=_0x36b404[_0x35cf30(0x181)][_0x35cf30(0x1da)](/\/$/,''),this['alias']=_0x36b404[_0x35cf30(0x19e)],this[_0x35cf30(0x1a6)]=_0x36b404['token'],this[_0x35cf30(0x180)]=_0x36b404['agent']||_0x35cf30(0x1f8),this[_0x35cf30(0x1fe)]=_0x35cf30(0x182)+_0x36b404[_0x35cf30(0x19e)]+'-'+Date[_0x35cf30(0x1dd)]()[_0x35cf30(0x19b)](0x24),this[_0x35cf30(0x1f0)]=_0x36b404[_0x35cf30(0x1f0)]??0x2bf20,this[_0x35cf30(0x1ab)]=_0x36b404[_0x35cf30(0x1ab)]??0xbb8,_0x36b404[_0x35cf30(0x1e7)]!==!0x1)this[_0x35cf30(0x1db)]();}[a0_0x44d3c0(0x1cf)](_0x3ea427){const _0x3d5483=a0_0x44d3c0;console[_0x3d5483(0x1cf)]('['+new Date()[_0x3d5483(0x18b)]()[_0x3d5483(0x1ae)](0x0,0x8)+_0x3d5483(0x1d9)+this[_0x3d5483(0x19e)]+']\x20'+_0x3ea427);}async[a0_0x44d3c0(0x1b7)](_0x18f954,_0x16d7ae){const _0x5c7d8a=a0_0x44d3c0;let _0x53d9eb={'Content-Type':_0x5c7d8a(0x1ce),'Accept':_0x5c7d8a(0x1e4)};if(this[_0x5c7d8a(0x1a6)])_0x53d9eb['Authorization']='Bearer\x20'+this[_0x5c7d8a(0x1a6)];let _0x36f2d0=await(await fetch(this[_0x5c7d8a(0x181)]+_0x5c7d8a(0x1f9),{'method':_0x5c7d8a(0x185),'headers':_0x53d9eb,'body':JSON[_0x5c7d8a(0x1d8)]({'jsonrpc':_0x5c7d8a(0x1f2),'id':Date[_0x5c7d8a(0x1dd)](),'method':_0x5c7d8a(0x1b0),'params':{'name':_0x18f954,'arguments':_0x16d7ae}})}))[_0x5c7d8a(0x1e6)](),_0x5ec370=_0x36f2d0[_0x5c7d8a(0x1a8)](/data: (.+)/),_0x36ca9b=_0x5ec370?JSON[_0x5c7d8a(0x197)](_0x5ec370[0x1]):JSON[_0x5c7d8a(0x197)](_0x36f2d0),_0x5df45e=_0x36ca9b?.[_0x5c7d8a(0x200)]?.[_0x5c7d8a(0x1a4)]?.[0x0]?.[_0x5c7d8a(0x1e6)];return _0x5df45e?JSON['parse'](_0x5df45e):_0x36ca9b;}async['connect'](){const _0x28eeda=a0_0x44d3c0;if(this[_0x28eeda(0x1aa)])return;this[_0x28eeda(0x1aa)]=!0x0,await this['status'](_0x28eeda(0x192)),this[_0x28eeda(0x1cf)](_0x28eeda(0x183)),this['heartbeatTimer']=setInterval(()=>{const _0x3c579b=_0x28eeda;this['status'](_0x3c579b(0x192))[_0x3c579b(0x190)](_0x1a47f0=>this['log'](_0x3c579b(0x1a3)+_0x1a47f0[_0x3c579b(0x1b5)]));},this[_0x28eeda(0x1f0)]),this[_0x28eeda(0x1df)]();}async[a0_0x44d3c0(0x1c4)](){const _0x3479b7=a0_0x44d3c0;if(this[_0x3479b7(0x1aa)]=!0x1,this['sseAbort']?.[_0x3479b7(0x1cd)](),this[_0x3479b7(0x1ea)])clearInterval(this[_0x3479b7(0x1ea)]);await this[_0x3479b7(0x18e)]('offline')[_0x3479b7(0x190)](()=>{}),this['log'](_0x3479b7(0x193));}async['send'](_0x4fc32f,_0x1f360c,_0x20b766=a0_0x44d3c0(0x1c1)){const _0x37afd3=a0_0x44d3c0;return Y({'alias':_0x4fc32f,'fromAlias':this['alias']},{'log':_0x5192f0=>console['log'](_0x5192f0),'send':()=>this[_0x37afd3(0x1b7)](_0x37afd3(0x1e3),{'alias':_0x4fc32f,'task':_0x1f360c,'priority':_0x20b766,'from_session':this['alias']})});}async[a0_0x44d3c0(0x1b5)](_0x404832,_0x4cb98c){const _0x214641=a0_0x44d3c0;return this[_0x214641(0x1b7)](_0x214641(0x188),{'alias':_0x404832,'message':_0x4cb98c,'from_session':this[_0x214641(0x19e)]});}async[a0_0x44d3c0(0x1d2)](_0x274e43,_0x2bb064,_0x26fb75='completed'){const _0x8abaed=a0_0x44d3c0;return this[_0x8abaed(0x1b7)](_0x8abaed(0x1c8),{'in_reply_to':_0x274e43,'text':_0x2bb064,'status':_0x26fb75});}async[a0_0x44d3c0(0x18e)](_0x51497b,_0x2683b3){const _0x9649d=a0_0x44d3c0;return this[_0x9649d(0x1b7)](_0x9649d(0x1ec),{'resume_id':this[_0x9649d(0x1fe)],'alias':this[_0x9649d(0x19e)],'status':_0x51497b,'server':a0_0x593437(),'hostname':a0_0x593437(),'agent':this[_0x9649d(0x180)],'project_dir':process[_0x9649d(0x1b1)](),..._0x2683b3});}async['getAllStatus'](){const _0x2ecc15=a0_0x44d3c0;return this[_0x2ecc15(0x1b7)]('get_all_status',{});}async[a0_0x44d3c0(0x1eb)](_0x324533,_0x2d1f3e){const _0x1d8b80=a0_0x44d3c0;return this[_0x1d8b80(0x1b7)](_0x1d8b80(0x1eb),{'message':_0x324533,'filter_server':_0x2d1f3e?.[_0x1d8b80(0x189)],'filter_status':_0x2d1f3e?.[_0x1d8b80(0x18e)]});}async[a0_0x44d3c0(0x1df)](){const _0xe68942=a0_0x44d3c0;let _0x478e0e=encodeURIComponent(this['alias']),_0x3b12fe=this[_0xe68942(0x181)]+'/events/'+_0x478e0e,_0x53fb37=this[_0xe68942(0x1ab)];while(this[_0xe68942(0x1aa)]){try{this[_0xe68942(0x19a)]=new AbortController();let _0x3b5769={'Accept':_0xe68942(0x1a9)};if(this[_0xe68942(0x1a6)])_0x3b5769[_0xe68942(0x1bb)]=_0xe68942(0x1ad)+this[_0xe68942(0x1a6)];let _0x2a6e10=await fetch(_0x3b12fe,{'headers':_0x3b5769,'signal':this[_0xe68942(0x19a)][_0xe68942(0x1f6)]});if(!_0x2a6e10['ok']||!_0x2a6e10['body']){this[_0xe68942(0x1cf)](_0xe68942(0x1e2)+_0x2a6e10['status']),await this['sleep'](_0x53fb37),_0x53fb37=Math[_0xe68942(0x1fb)](_0x53fb37*1.5,0xea60);continue;}_0x53fb37=this[_0xe68942(0x1ab)];let _0x24f92a=_0x2a6e10['body'][_0xe68942(0x1c9)](),_0x4d2d97=new TextDecoder(),_0x758892='';while(this[_0xe68942(0x1aa)]){let {done:_0x1951c9,value:_0x426191}=await _0x24f92a[_0xe68942(0x1a0)]();if(_0x1951c9)break;_0x758892+=_0x4d2d97['decode'](_0x426191,{'stream':!0x0});let _0x64441f=_0x758892[_0xe68942(0x1c3)]('\x0a');_0x758892=_0x64441f[_0xe68942(0x1d5)]()||'';for(let _0x2237fb of _0x64441f){if(!_0x2237fb[_0xe68942(0x1cc)](_0xe68942(0x1d4)))continue;try{let _0x494be1=JSON[_0xe68942(0x197)](_0x2237fb[_0xe68942(0x1ae)](0x6));if(_0x494be1['type']===_0xe68942(0x1ed)){this[_0xe68942(0x1cf)](_0xe68942(0x1d0)),this[_0xe68942(0x1cb)](_0xe68942(0x1ed));continue;}if(_0x494be1[_0xe68942(0x1ac)]==='new_task'||_0x494be1[_0xe68942(0x1ac)]===_0xe68942(0x1c7)||_0x494be1[_0xe68942(0x1ac)]==='broadcast')await this[_0xe68942(0x1e0)]();}catch{}}}}catch(_0x10bd10){if(_0x10bd10[_0xe68942(0x1bc)]===_0xe68942(0x18d))break;this[_0xe68942(0x1cb)](_0xe68942(0x1b6),_0x10bd10),this['log']('SSE\x20error:\x20'+_0x10bd10['message']);}if(this[_0xe68942(0x1aa)])this[_0xe68942(0x1cb)](_0xe68942(0x193)),this[_0xe68942(0x1cf)]('SSE\x20reconnecting\x20in\x20'+_0x53fb37/0x3e8+'s...'),await this[_0xe68942(0x191)](_0x53fb37),_0x53fb37=Math[_0xe68942(0x1fb)](_0x53fb37*1.5,0xea60);}}async[a0_0x44d3c0(0x1e0)](){const _0x1826df=a0_0x44d3c0;try{let _0x556d92=(await this[_0x1826df(0x1b7)]('get_inbox',{'alias':this[_0x1826df(0x19e)],'limit':0xa}))?.['messages']||[];for(let _0x4d4f45 of _0x556d92)await this[_0x1826df(0x1b7)](_0x1826df(0x1e8),{'alias':this[_0x1826df(0x19e)],'message_id':_0x4d4f45['id']}),this['log']('←\x20'+_0x4d4f45[_0x1826df(0x1e1)]+':\x20'+_0x4d4f45['content']['slice'](0x0,0x3c)),this[_0x1826df(0x1cb)]('task',_0x4d4f45),this['emit']('message',_0x4d4f45);}catch(_0x29f54f){this['log'](_0x1826df(0x1a5)+_0x29f54f[_0x1826df(0x1b5)]);}}[a0_0x44d3c0(0x191)](_0x6e27d0){return new Promise(_0x54e9a4=>setTimeout(_0x54e9a4,_0x6e27d0));}}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x5eb80c=a0_0x1a30;(function(_0x3902ed,_0x5503e5){const _0x198a6f=a0_0x1a30,_0x44968a=_0x3902ed();while(!![]){try{const _0x10a8ab=parseInt(_0x198a6f(0x230))/0x1+parseInt(_0x198a6f(0x249))/0x2+-parseInt(_0x198a6f(0x1f8))/0x3+-parseInt(_0x198a6f(0x23d))/0x4+-parseInt(_0x198a6f(0x1f5))/0x5*(-parseInt(_0x198a6f(0x262))/0x6)+-parseInt(_0x198a6f(0x21c))/0x7+parseInt(_0x198a6f(0x21b))/0x8;if(_0x10a8ab===_0x5503e5)break;else _0x44968a['push'](_0x44968a['shift']());}catch(_0x4c2a99){_0x44968a['push'](_0x44968a['shift']());}}}(a0_0x3797,0xc0ed5));import{EventEmitter as a0_0x250011}from'events';import{hostname as a0_0x5dc034}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x278e77,_0x4e136e)=>(_0x278e77??_0x4e136e)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x5eb80c(0x1f3)](0x0,0xf0);function a0_0x3797(){const _0x3f31fe=['message_id','180FrHAqU','sdk','abort','4328658AUdIiN','\x20from=','lifecycleTracking','\x20parent_task_id=','toTimeString','token','idle','registered','connected','parent_task_id','sseAbort','error_message','\x20network_id=','AbortError','heartbeatTimer','send_failed','application/json,\x20text/event-stream','message','\x20to=','CommHub\x20rejected\x20task','task.send.delivered','heartbeatInterval','call','not_tracked','resumeId','status','failed','task.ack','Authorization','connect','running','match','messages','now','[commhub:task]\x20','15641744WaWVYl','10562328qAFwVu','send_task','CommHub\x20response\x20omitted\x20task_id','parse','parentTaskId','mcp_http','normal','connectSSE','delivered','task.expired','toAlias','error','send_rejected','task.replied','send','type','task','autoConnect','name','agent','1470859htIwts','networkId','from_alias','signal','POST','s...','SSE\x20connected','alias','catch','task.send.failed','/mcp','url','missing_task_id','5107784lSnOrR','toString','send_message','json','server','<pending>','/events/','\x20lifecycle=','stringify','reply','replace','application/json','1745704snwdiZ','disconnected','getReader','network_id','string','getAllStatus','sdk-','split','<unknown>','completed','tools/call','lifecycle_tracking','send_reply','task.send.start','SSE\x20error:\x20','task_id','result','[REDACTED]','min','fromAlias','emit','SSE\x20reconnecting\x20in\x20',']\x20[commhub:','body','to_alias','120006oBOOUL','SSE\x20failed:\x20','2.0','startsWith','sleep','content','Bearer\x20','text','log','processInbox','reconnectDelay','broadcast','pop','slice'];a0_0x3797=function(){return _0x3f31fe;};return a0_0x3797();}function a0_0x1a30(_0xa2bc5e,_0x26f636){_0xa2bc5e=_0xa2bc5e-0x1ed;const _0x379728=a0_0x3797();let _0x1a3097=_0x379728[_0xa2bc5e];return _0x1a3097;}function N(_0x147209){const _0x152c56=a0_0x5eb80c;return(_0x147209 instanceof Error?_0x147209[_0x152c56(0x209)]:String(_0x147209??'unknown\x20error'))[_0x152c56(0x247)](K,_0x152c56(0x25a))['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function O(_0x5f332c,_0x5a5d6f=process.env.ANET_TASK_TRACE_FORMAT===a0_0x5eb80c(0x240)){const _0x5c46a6=a0_0x5eb80c;if(_0x5a5d6f)return JSON[_0x5c46a6(0x245)](_0x5f332c);let _0x3aa4bb=L(_0x5f332c[_0x5c46a6(0x201)],'<missing>'),_0x2b4b76=L(_0x5f332c[_0x5c46a6(0x258)],_0x5c46a6(0x242)),_0x48d7d1=_0x5f332c['error_code']?'\x20error='+_0x5f332c['error_code']+':'+(_0x5f332c[_0x5c46a6(0x203)]??''):'';return _0x5c46a6(0x21a)+_0x5f332c[_0x5c46a6(0x211)]+_0x5c46a6(0x1f9)+L(_0x5f332c[_0x5c46a6(0x232)],_0x5c46a6(0x251))+_0x5c46a6(0x20a)+L(_0x5f332c[_0x5c46a6(0x261)],_0x5c46a6(0x251))+'\x20task_id='+_0x2b4b76+_0x5c46a6(0x1fb)+_0x3aa4bb+_0x5c46a6(0x204)+L(_0x5f332c[_0x5c46a6(0x24c)],'<unknown>')+'\x20transport='+_0x5f332c['transport']+'\x20duration_ms='+_0x5f332c['duration_ms']+_0x5c46a6(0x244)+_0x5f332c[_0x5c46a6(0x254)]+_0x48d7d1;}function U(_0x211b3c){const _0x3d5d03=a0_0x5eb80c;return{'event':{'sending':_0x3d5d03(0x256),'delivered':_0x3d5d03(0x20c),'failed':_0x3d5d03(0x239),'acked':_0x3d5d03(0x213),'started':'task.started','replied':_0x3d5d03(0x229),'expired':_0x3d5d03(0x225)}[_0x211b3c['status']],..._0x211b3c};}function j(_0x3e160a){const _0x373b34=a0_0x5eb80c;let _0x5a8bd8=_0x3e160a?.[_0x373b34(0x258)]||_0x3e160a?.[_0x373b34(0x1f4)]||_0x3e160a?.['id'];if(_0x5a8bd8)return String(_0x5a8bd8);let _0x452c06=_0x3e160a?.[_0x373b34(0x267)]?.[0x0]?.[_0x373b34(0x1ed)];if(typeof _0x452c06!==_0x373b34(0x24d))return null;try{let _0x3387ef=JSON['parse'](_0x452c06);return _0x3387ef?.[_0x373b34(0x258)]||_0x3387ef?.[_0x373b34(0x1f4)]||_0x3387ef?.['id']||null;}catch{return null;}}async function X(_0x550df0,_0x2e51cc){const _0xb456ae=a0_0x5eb80c;let _0x14745a=_0x2e51cc['now']??Date['now'],_0x1e11f5=_0x14745a(),_0xc533b0=(_0x1dc8e3,_0x1ec3b5,_0x42d0bd,_0x144368)=>{const _0x524b2e=a0_0x1a30;_0x2e51cc['log'](O(U({'from_alias':_0x550df0[_0x524b2e(0x25c)],'to_alias':_0x550df0[_0x524b2e(0x226)],'task_id':_0x1ec3b5,'parent_task_id':_0x550df0[_0x524b2e(0x220)],'network_id':_0x550df0[_0x524b2e(0x231)],'transport':_0x550df0['transport'],'status':_0x1dc8e3,'duration_ms':_0x14745a()-_0x1e11f5,'lifecycle_tracking':_0x550df0[_0x524b2e(0x1fa)],..._0x42d0bd!==void 0x0?{'error_code':_0x144368||_0x524b2e(0x207),'error_message':N(_0x42d0bd)}:{}})));};_0xc533b0('sending',null);try{let _0x176ccb=await _0x2e51cc[_0xb456ae(0x22a)](),_0x428544=j(_0x176ccb);if(_0x428544)_0xc533b0(_0xb456ae(0x224),_0x428544);else{if(_0x176ccb?.['ok']===!0x1||_0x176ccb?.[_0xb456ae(0x227)])_0xc533b0('failed',_0x428544,_0x176ccb?.[_0xb456ae(0x227)]||_0xb456ae(0x20b),_0xb456ae(0x228));else _0xc533b0('failed',null,_0xb456ae(0x21e),_0xb456ae(0x23c));}return _0x176ccb;}catch(_0x486fd8){throw _0xc533b0(_0xb456ae(0x212),null,_0x486fd8,_0xb456ae(0x207)),_0x486fd8;}}async function Y(_0x315d20,_0x23b724){const _0x31f96d=a0_0x5eb80c;return X({'fromAlias':_0x315d20[_0x31f96d(0x25c)],'toAlias':_0x315d20[_0x31f96d(0x237)],'parentTaskId':_0x315d20[_0x31f96d(0x220)]||null,'networkId':_0x315d20[_0x31f96d(0x231)]||null,'transport':_0x31f96d(0x221),'lifecycleTracking':_0x31f96d(0x20f)},_0x23b724);}class $ extends a0_0x250011{[a0_0x5eb80c(0x23b)];[a0_0x5eb80c(0x237)];[a0_0x5eb80c(0x1fd)];[a0_0x5eb80c(0x22f)];[a0_0x5eb80c(0x210)];[a0_0x5eb80c(0x20d)];[a0_0x5eb80c(0x1f0)];[a0_0x5eb80c(0x206)];['sseAbort'];['running']=!0x1;constructor(_0x22e9ca){const _0x33d4b4=a0_0x5eb80c;super();if(this[_0x33d4b4(0x23b)]=_0x22e9ca[_0x33d4b4(0x23b)][_0x33d4b4(0x247)](/\/$/,''),this[_0x33d4b4(0x237)]=_0x22e9ca[_0x33d4b4(0x237)],this[_0x33d4b4(0x1fd)]=_0x22e9ca[_0x33d4b4(0x1fd)],this[_0x33d4b4(0x22f)]=_0x22e9ca['agent']||_0x33d4b4(0x1f6),this[_0x33d4b4(0x210)]=_0x33d4b4(0x24f)+_0x22e9ca[_0x33d4b4(0x237)]+'-'+Date[_0x33d4b4(0x219)]()[_0x33d4b4(0x23e)](0x24),this[_0x33d4b4(0x20d)]=_0x22e9ca[_0x33d4b4(0x20d)]??0x2bf20,this[_0x33d4b4(0x1f0)]=_0x22e9ca[_0x33d4b4(0x1f0)]??0xbb8,_0x22e9ca[_0x33d4b4(0x22d)]!==!0x1)this[_0x33d4b4(0x215)]();}[a0_0x5eb80c(0x1ee)](_0x17b3c1){const _0x2863fe=a0_0x5eb80c;console['log']('['+new Date()[_0x2863fe(0x1fc)]()['slice'](0x0,0x8)+_0x2863fe(0x25f)+this[_0x2863fe(0x237)]+']\x20'+_0x17b3c1);}async['call'](_0x1c2d60,_0x298923){const _0x28c641=a0_0x5eb80c;let _0x5387e4={'Content-Type':_0x28c641(0x248),'Accept':_0x28c641(0x208)};if(this[_0x28c641(0x1fd)])_0x5387e4[_0x28c641(0x214)]=_0x28c641(0x268)+this['token'];let _0xe61d2c=await(await fetch(this[_0x28c641(0x23b)]+_0x28c641(0x23a),{'method':_0x28c641(0x234),'headers':_0x5387e4,'body':JSON[_0x28c641(0x245)]({'jsonrpc':_0x28c641(0x264),'id':Date[_0x28c641(0x219)](),'method':_0x28c641(0x253),'params':{'name':_0x1c2d60,'arguments':_0x298923}})}))[_0x28c641(0x1ed)](),_0x2e94ee=_0xe61d2c[_0x28c641(0x217)](/data: (.+)/),_0x19a7e9=_0x2e94ee?JSON[_0x28c641(0x21f)](_0x2e94ee[0x1]):JSON[_0x28c641(0x21f)](_0xe61d2c),_0x26fccb=_0x19a7e9?.[_0x28c641(0x259)]?.[_0x28c641(0x267)]?.[0x0]?.['text'];return _0x26fccb?JSON['parse'](_0x26fccb):_0x19a7e9;}async[a0_0x5eb80c(0x215)](){const _0x2a944a=a0_0x5eb80c;if(this[_0x2a944a(0x216)])return;this[_0x2a944a(0x216)]=!0x0,await this[_0x2a944a(0x211)]('idle'),this[_0x2a944a(0x1ee)](_0x2a944a(0x1ff)),this[_0x2a944a(0x206)]=setInterval(()=>{const _0x49d862=_0x2a944a;this['status'](_0x49d862(0x1fe))[_0x49d862(0x238)](_0x135d03=>this['log']('heartbeat\x20failed:\x20'+_0x135d03[_0x49d862(0x209)]));},this[_0x2a944a(0x20d)]),this[_0x2a944a(0x223)]();}async['disconnect'](){const _0x1ade56=a0_0x5eb80c;if(this[_0x1ade56(0x216)]=!0x1,this[_0x1ade56(0x202)]?.[_0x1ade56(0x1f7)](),this[_0x1ade56(0x206)])clearInterval(this[_0x1ade56(0x206)]);await this[_0x1ade56(0x211)]('offline')[_0x1ade56(0x238)](()=>{}),this[_0x1ade56(0x1ee)]('disconnected');}async[a0_0x5eb80c(0x22a)](_0x4f5de2,_0x18bea0,_0x2e0365=a0_0x5eb80c(0x222)){const _0x5361c5=a0_0x5eb80c;return Y({'alias':_0x4f5de2,'fromAlias':this['alias']},{'log':_0xbaac93=>console[_0x5361c5(0x1ee)](_0xbaac93),'send':()=>this[_0x5361c5(0x20e)](_0x5361c5(0x21d),{'alias':_0x4f5de2,'task':_0x18bea0,'priority':_0x2e0365,'from_session':this['alias']})});}async[a0_0x5eb80c(0x209)](_0x49be41,_0x17d559){const _0x2bfd2f=a0_0x5eb80c;return this['call'](_0x2bfd2f(0x23f),{'alias':_0x49be41,'message':_0x17d559,'from_session':this[_0x2bfd2f(0x237)]});}async[a0_0x5eb80c(0x246)](_0x5d4298,_0x175c44,_0x228468=a0_0x5eb80c(0x252)){const _0x1ca748=a0_0x5eb80c;return this[_0x1ca748(0x20e)](_0x1ca748(0x255),{'in_reply_to':_0x5d4298,'text':_0x175c44,'status':_0x228468});}async[a0_0x5eb80c(0x211)](_0x1ead92,_0x574344){const _0x4e587a=a0_0x5eb80c;return this[_0x4e587a(0x20e)]('report_status',{'resume_id':this[_0x4e587a(0x210)],'alias':this[_0x4e587a(0x237)],'status':_0x1ead92,'server':a0_0x5dc034(),'hostname':a0_0x5dc034(),'agent':this[_0x4e587a(0x22f)],'project_dir':process['cwd'](),..._0x574344});}async[a0_0x5eb80c(0x24e)](){const _0x2492d4=a0_0x5eb80c;return this[_0x2492d4(0x20e)]('get_all_status',{});}async[a0_0x5eb80c(0x1f1)](_0x502c56,_0x1d3e08){const _0x857ef3=a0_0x5eb80c;return this[_0x857ef3(0x20e)](_0x857ef3(0x1f1),{'message':_0x502c56,'filter_server':_0x1d3e08?.[_0x857ef3(0x241)],'filter_status':_0x1d3e08?.['status']});}async[a0_0x5eb80c(0x223)](){const _0x31332e=a0_0x5eb80c;let _0x1d977d=encodeURIComponent(this[_0x31332e(0x237)]),_0x4b9acd=this[_0x31332e(0x23b)]+_0x31332e(0x243)+_0x1d977d,_0x555c0c=this[_0x31332e(0x1f0)];while(this[_0x31332e(0x216)]){try{this[_0x31332e(0x202)]=new AbortController();let _0x5d09e1={'Accept':'text/event-stream'};if(this[_0x31332e(0x1fd)])_0x5d09e1[_0x31332e(0x214)]=_0x31332e(0x268)+this[_0x31332e(0x1fd)];let _0x3fb4cf=await fetch(_0x4b9acd,{'headers':_0x5d09e1,'signal':this['sseAbort'][_0x31332e(0x233)]});if(!_0x3fb4cf['ok']||!_0x3fb4cf[_0x31332e(0x260)]){this[_0x31332e(0x1ee)](_0x31332e(0x263)+_0x3fb4cf[_0x31332e(0x211)]),await this[_0x31332e(0x266)](_0x555c0c),_0x555c0c=Math[_0x31332e(0x25b)](_0x555c0c*1.5,0xea60);continue;}_0x555c0c=this[_0x31332e(0x1f0)];let _0x32c9d0=_0x3fb4cf[_0x31332e(0x260)][_0x31332e(0x24b)](),_0x30bb75=new TextDecoder(),_0x12167c='';while(this[_0x31332e(0x216)]){let {done:_0x4a42e2,value:_0x850cb8}=await _0x32c9d0['read']();if(_0x4a42e2)break;_0x12167c+=_0x30bb75['decode'](_0x850cb8,{'stream':!0x0});let _0x34195b=_0x12167c[_0x31332e(0x250)]('\x0a');_0x12167c=_0x34195b[_0x31332e(0x1f2)]()||'';for(let _0x1c50d9 of _0x34195b){if(!_0x1c50d9[_0x31332e(0x265)]('data:\x20'))continue;try{let _0x36f451=JSON[_0x31332e(0x21f)](_0x1c50d9['slice'](0x6));if(_0x36f451[_0x31332e(0x22b)]==='connected'){this['log'](_0x31332e(0x236)),this['emit'](_0x31332e(0x200));continue;}if(_0x36f451[_0x31332e(0x22b)]==='new_task'||_0x36f451['type']==='new_message'||_0x36f451['type']==='broadcast')await this['processInbox']();}catch{}}}}catch(_0x1ed613){if(_0x1ed613[_0x31332e(0x22e)]===_0x31332e(0x205))break;this[_0x31332e(0x25d)](_0x31332e(0x227),_0x1ed613),this[_0x31332e(0x1ee)](_0x31332e(0x257)+_0x1ed613[_0x31332e(0x209)]);}if(this[_0x31332e(0x216)])this['emit'](_0x31332e(0x24a)),this[_0x31332e(0x1ee)](_0x31332e(0x25e)+_0x555c0c/0x3e8+_0x31332e(0x235)),await this[_0x31332e(0x266)](_0x555c0c),_0x555c0c=Math['min'](_0x555c0c*1.5,0xea60);}}async[a0_0x5eb80c(0x1ef)](){const _0xb3c55d=a0_0x5eb80c;try{let _0x3fadbc=(await this['call']('get_inbox',{'alias':this[_0xb3c55d(0x237)],'limit':0xa}))?.[_0xb3c55d(0x218)]||[];for(let _0x32905e of _0x3fadbc)await this['call']('ack_inbox',{'alias':this[_0xb3c55d(0x237)],'message_id':_0x32905e['id']}),this[_0xb3c55d(0x1ee)]('←\x20'+_0x32905e['from_session']+':\x20'+_0x32905e['content'][_0xb3c55d(0x1f3)](0x0,0x3c)),this[_0xb3c55d(0x25d)](_0xb3c55d(0x22c),_0x32905e),this[_0xb3c55d(0x25d)](_0xb3c55d(0x209),_0x32905e);}catch(_0x3f355){this[_0xb3c55d(0x1ee)]('inbox\x20error:\x20'+_0x3f355[_0xb3c55d(0x209)]);}}['sleep'](_0x2f81ac){return new Promise(_0xb9b2bd=>setTimeout(_0xb9b2bd,_0x2f81ac));}}var F=$;export{F as default,$ as CommHub};
|