@sleep2agi/agent-network 2.3.0-preview.243 → 2.3.0-preview.245
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_0x265bba=a0_0xd7c1;(function(_0x1c3abf,_0x251805){const _0x497da0=a0_0xd7c1,_0xf7b04e=_0x1c3abf();while(!![]){try{const _0x27bda5=-parseInt(_0x497da0(0x107))/0x1+parseInt(_0x497da0(0xf5))/0x2*(-parseInt(_0x497da0(0xcc))/0x3)+-parseInt(_0x497da0(0xe2))/0x4*(-parseInt(_0x497da0(0xd6))/0x5)+-parseInt(_0x497da0(0xc9))/0x6+-parseInt(_0x497da0(0xa3))/0x7*(-parseInt(_0x497da0(0xbb))/0x8)+parseInt(_0x497da0(0x112))/0x9*(parseInt(_0x497da0(0xf6))/0xa)+parseInt(_0x497da0(0xea))/0xb*(-parseInt(_0x497da0(0xc4))/0xc);if(_0x27bda5===_0x251805)break;else _0xf7b04e['push'](_0xf7b04e['shift']());}catch(_0x501413){_0xf7b04e['push'](_0xf7b04e['shift']());}}}(a0_0x12eb,0xbcffa));import{EventEmitter as a0_0xe1aceb}from'events';import{hostname as a0_0x1c5d6a}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x55e852,_0x3bac8f)=>(_0x55e852??_0x3bac8f)[a0_0x265bba(0xe3)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x265bba(0xda)](0x0,0xf0);function a0_0xd7c1(_0x156f6c,_0x2b8f94){_0x156f6c=_0x156f6c-0x98;const _0x12eb7f=a0_0x12eb();let _0xd7c12=_0x12eb7f[_0x156f6c];return _0xd7c12;}function a0_0x12eb(){const _0x27ede5=['task_id','parent_task_id','emit','toTimeString','send_rejected','SSE\x20error:\x20','8YWmBmN','message_id','from_alias','content','\x20duration_ms=','signal','<unknown>','toString','getAllStatus','24NgrrMk','send_failed','\x20task_id=','\x20from=','status','7265274pYPRcu','task.send.start','fromAlias','532383LAHVOv','2.0','error_message','[commhub:task]\x20','inbox\x20error:\x20','sdk','heartbeatTimer','\x20to=','<missing>','sleep','10NkgVuT','reconnectDelay','call','alias','slice','sseAbort','not_tracked','data:\x20','parentTaskId','report_status','\x20lifecycle=','tools/call','838828upaLRJ','replace','task.ack','connectSSE','resumeId','Authorization','server','connected','1285328VleFKA','message','\x20parent_task_id=',']\x20[commhub:','connect','token','normal','read','abort','SSE\x20reconnecting\x20in\x20','min','2RapSAC','10BggBCD','log','url','cwd','sdk-','new_message','/mcp','to_alias','now','SSE\x20failed:\x20','transport','task','<pending>','networkId','network_id','match','send_reply','57767AzuSNi','disconnect','SSE\x20connected','lifecycleTracking','Bearer\x20','sending','toAlias','result','parse','failed','s...','11225394sRJCmu','mcp_http','running','duration_ms','type','heartbeat\x20failed:\x20','lifecycle_tracking','catch','task.started','stringify','heartbeatInterval','\x20error=','new_task','broadcast','error','send_message','agent','text/event-stream','disconnected','5510827GpFyzu','startsWith','CommHub\x20response\x20omitted\x20task_id','\x20transport=','idle','body','error_code','missing_task_id','processInbox','decode','get_inbox','messages','application/json,\x20text/event-stream','POST','task.send.failed','/events/','\x20network_id=','CommHub\x20rejected\x20task'];a0_0x12eb=function(){return _0x27ede5;};return a0_0x12eb();}function N(_0x1606c0){const _0x152055=a0_0x265bba;return(_0x1606c0 instanceof Error?_0x1606c0[_0x152055(0xeb)]:String(_0x1606c0??'unknown\x20error'))[_0x152055(0xe3)](K,'[REDACTED]')[_0x152055(0xe3)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x152055(0xda)](0x0,0xf0);}function O(_0x1dbf0e,_0x2376b8=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0x2c8231=a0_0x265bba;if(_0x2376b8)return JSON[_0x2c8231(0x99)](_0x1dbf0e);let _0x45c215=L(_0x1dbf0e[_0x2c8231(0xb6)],_0x2c8231(0xd4)),_0x10c577=L(_0x1dbf0e[_0x2c8231(0xb5)],_0x2c8231(0x102)),_0x3f2719=_0x1dbf0e['error_code']?_0x2c8231(0x9b)+_0x1dbf0e[_0x2c8231(0xa9)]+':'+(_0x1dbf0e[_0x2c8231(0xce)]??''):'';return _0x2c8231(0xcf)+_0x1dbf0e['status']+_0x2c8231(0xc7)+L(_0x1dbf0e[_0x2c8231(0xbd)],_0x2c8231(0xc1))+_0x2c8231(0xd3)+L(_0x1dbf0e[_0x2c8231(0xfd)],_0x2c8231(0xc1))+_0x2c8231(0xc6)+_0x10c577+_0x2c8231(0xec)+_0x45c215+_0x2c8231(0xb3)+L(_0x1dbf0e[_0x2c8231(0x104)],_0x2c8231(0xc1))+_0x2c8231(0xa6)+_0x1dbf0e['transport']+_0x2c8231(0xbf)+_0x1dbf0e[_0x2c8231(0x115)]+_0x2c8231(0xe0)+_0x1dbf0e[_0x2c8231(0x118)]+_0x3f2719;}function U(_0x38a00d){const _0x4ccb12=a0_0x265bba;return{'event':{'sending':_0x4ccb12(0xca),'delivered':'task.send.delivered','failed':_0x4ccb12(0xb1),'acked':_0x4ccb12(0xe4),'started':_0x4ccb12(0x98),'replied':'task.replied','expired':'task.expired'}[_0x38a00d[_0x4ccb12(0xc8)]],..._0x38a00d};}function j(_0x406ce0){const _0x52a470=a0_0x265bba;let _0x54c444=_0x406ce0?.['task_id']||_0x406ce0?.['message_id']||_0x406ce0?.['id'];if(_0x54c444)return String(_0x54c444);let _0x91c2af=_0x406ce0?.[_0x52a470(0xbe)]?.[0x0]?.['text'];if(typeof _0x91c2af!=='string')return null;try{let _0x1ac78e=JSON['parse'](_0x91c2af);return _0x1ac78e?.[_0x52a470(0xb5)]||_0x1ac78e?.[_0x52a470(0xbc)]||_0x1ac78e?.['id']||null;}catch{return null;}}async function X(_0x3ef694,_0x36a329){const _0x195157=a0_0x265bba;let _0x24e1ca=_0x36a329[_0x195157(0xfe)]??Date['now'],_0x3b75b4=_0x24e1ca(),_0x21596f=(_0x56629a,_0x5aef15,_0x2a1213,_0x5791c0)=>{const _0x5b90df=_0x195157;_0x36a329[_0x5b90df(0xf7)](O(U({'from_alias':_0x3ef694[_0x5b90df(0xcb)],'to_alias':_0x3ef694[_0x5b90df(0x10d)],'task_id':_0x5aef15,'parent_task_id':_0x3ef694[_0x5b90df(0xde)],'network_id':_0x3ef694[_0x5b90df(0x103)],'transport':_0x3ef694[_0x5b90df(0x100)],'status':_0x56629a,'duration_ms':_0x24e1ca()-_0x3b75b4,'lifecycle_tracking':_0x3ef694[_0x5b90df(0x10a)],..._0x2a1213!==void 0x0?{'error_code':_0x5791c0||_0x5b90df(0xc5),'error_message':N(_0x2a1213)}:{}})));};_0x21596f(_0x195157(0x10c),null);try{let _0x4beced=await _0x36a329['send'](),_0x590aee=j(_0x4beced);if(_0x590aee)_0x21596f('delivered',_0x590aee);else{if(_0x4beced?.['ok']===!0x1||_0x4beced?.[_0x195157(0x9e)])_0x21596f(_0x195157(0x110),_0x590aee,_0x4beced?.[_0x195157(0x9e)]||_0x195157(0xb4),_0x195157(0xb9));else _0x21596f(_0x195157(0x110),null,_0x195157(0xa5),_0x195157(0xaa));}return _0x4beced;}catch(_0x3f24bd){throw _0x21596f(_0x195157(0x110),null,_0x3f24bd,'send_failed'),_0x3f24bd;}}async function Y(_0x492a26,_0x3d5e85){const _0x2fb4f3=a0_0x265bba;return X({'fromAlias':_0x492a26[_0x2fb4f3(0xcb)],'toAlias':_0x492a26[_0x2fb4f3(0xd9)],'parentTaskId':_0x492a26[_0x2fb4f3(0xde)]||null,'networkId':_0x492a26[_0x2fb4f3(0x103)]||null,'transport':_0x2fb4f3(0x113),'lifecycleTracking':_0x2fb4f3(0xdc)},_0x3d5e85);}class $ extends a0_0xe1aceb{['url'];[a0_0x265bba(0xd9)];[a0_0x265bba(0xef)];[a0_0x265bba(0xa0)];['resumeId'];[a0_0x265bba(0x9a)];[a0_0x265bba(0xd7)];[a0_0x265bba(0xd2)];['sseAbort'];[a0_0x265bba(0x114)]=!0x1;constructor(_0x1757f2){const _0x464bcc=a0_0x265bba;super();if(this[_0x464bcc(0xf8)]=_0x1757f2[_0x464bcc(0xf8)][_0x464bcc(0xe3)](/\/$/,''),this[_0x464bcc(0xd9)]=_0x1757f2[_0x464bcc(0xd9)],this[_0x464bcc(0xef)]=_0x1757f2['token'],this[_0x464bcc(0xa0)]=_0x1757f2[_0x464bcc(0xa0)]||_0x464bcc(0xd1),this[_0x464bcc(0xe6)]=_0x464bcc(0xfa)+_0x1757f2['alias']+'-'+Date['now']()[_0x464bcc(0xc2)](0x24),this[_0x464bcc(0x9a)]=_0x1757f2[_0x464bcc(0x9a)]??0x2bf20,this[_0x464bcc(0xd7)]=_0x1757f2['reconnectDelay']??0xbb8,_0x1757f2['autoConnect']!==!0x1)this[_0x464bcc(0xee)]();}[a0_0x265bba(0xf7)](_0x5472a0){const _0x30236e=a0_0x265bba;console[_0x30236e(0xf7)]('['+new Date()[_0x30236e(0xb8)]()[_0x30236e(0xda)](0x0,0x8)+_0x30236e(0xed)+this[_0x30236e(0xd9)]+']\x20'+_0x5472a0);}async[a0_0x265bba(0xd8)](_0x205848,_0x5cc57){const _0x163c93=a0_0x265bba;let _0x368c19={'Content-Type':'application/json','Accept':_0x163c93(0xaf)};if(this['token'])_0x368c19[_0x163c93(0xe7)]=_0x163c93(0x10b)+this[_0x163c93(0xef)];let _0x418a1c=await(await fetch(this[_0x163c93(0xf8)]+_0x163c93(0xfc),{'method':_0x163c93(0xb0),'headers':_0x368c19,'body':JSON[_0x163c93(0x99)]({'jsonrpc':_0x163c93(0xcd),'id':Date['now'](),'method':_0x163c93(0xe1),'params':{'name':_0x205848,'arguments':_0x5cc57}})}))['text'](),_0xbfa588=_0x418a1c[_0x163c93(0x105)](/data: (.+)/),_0x464fb2=_0xbfa588?JSON[_0x163c93(0x10f)](_0xbfa588[0x1]):JSON['parse'](_0x418a1c),_0x124fa6=_0x464fb2?.[_0x163c93(0x10e)]?.[_0x163c93(0xbe)]?.[0x0]?.['text'];return _0x124fa6?JSON[_0x163c93(0x10f)](_0x124fa6):_0x464fb2;}async[a0_0x265bba(0xee)](){const _0x109bfd=a0_0x265bba;if(this[_0x109bfd(0x114)])return;this[_0x109bfd(0x114)]=!0x0,await this[_0x109bfd(0xc8)](_0x109bfd(0xa7)),this['log']('registered'),this['heartbeatTimer']=setInterval(()=>{const _0x3bdce4=_0x109bfd;this[_0x3bdce4(0xc8)](_0x3bdce4(0xa7))[_0x3bdce4(0x119)](_0x7b6242=>this[_0x3bdce4(0xf7)](_0x3bdce4(0x117)+_0x7b6242[_0x3bdce4(0xeb)]));},this[_0x109bfd(0x9a)]),this[_0x109bfd(0xe5)]();}async[a0_0x265bba(0x108)](){const _0x3d4310=a0_0x265bba;if(this['running']=!0x1,this[_0x3d4310(0xdb)]?.[_0x3d4310(0xf2)](),this[_0x3d4310(0xd2)])clearInterval(this[_0x3d4310(0xd2)]);await this[_0x3d4310(0xc8)]('offline')[_0x3d4310(0x119)](()=>{}),this[_0x3d4310(0xf7)](_0x3d4310(0xa2));}async['send'](_0x587943,_0x557b6e,_0x35610b=a0_0x265bba(0xf0)){const _0x5c7bb0=a0_0x265bba;return Y({'alias':_0x587943,'fromAlias':this[_0x5c7bb0(0xd9)]},{'log':_0x79d8fc=>console['log'](_0x79d8fc),'send':()=>this[_0x5c7bb0(0xd8)]('send_task',{'alias':_0x587943,'task':_0x557b6e,'priority':_0x35610b,'from_session':this[_0x5c7bb0(0xd9)]})});}async['message'](_0x2fb679,_0x23574d){const _0x5e9da9=a0_0x265bba;return this[_0x5e9da9(0xd8)](_0x5e9da9(0x9f),{'alias':_0x2fb679,'message':_0x23574d,'from_session':this[_0x5e9da9(0xd9)]});}async['reply'](_0x29713c,_0x26ba7d,_0x5cc780='completed'){const _0x3f1262=a0_0x265bba;return this[_0x3f1262(0xd8)](_0x3f1262(0x106),{'in_reply_to':_0x29713c,'text':_0x26ba7d,'status':_0x5cc780});}async['status'](_0x4435f1,_0x32c28a){const _0x2979c8=a0_0x265bba;return this[_0x2979c8(0xd8)](_0x2979c8(0xdf),{'resume_id':this[_0x2979c8(0xe6)],'alias':this[_0x2979c8(0xd9)],'status':_0x4435f1,'server':a0_0x1c5d6a(),'hostname':a0_0x1c5d6a(),'agent':this[_0x2979c8(0xa0)],'project_dir':process[_0x2979c8(0xf9)](),..._0x32c28a});}async[a0_0x265bba(0xc3)](){const _0x206933=a0_0x265bba;return this[_0x206933(0xd8)]('get_all_status',{});}async['broadcast'](_0x485d1f,_0x4be5ef){const _0x27afc5=a0_0x265bba;return this['call'](_0x27afc5(0x9d),{'message':_0x485d1f,'filter_server':_0x4be5ef?.[_0x27afc5(0xe8)],'filter_status':_0x4be5ef?.[_0x27afc5(0xc8)]});}async['connectSSE'](){const _0x6e220c=a0_0x265bba;let _0x2b96de=encodeURIComponent(this['alias']),_0x12b2b4=this[_0x6e220c(0xf8)]+_0x6e220c(0xb2)+_0x2b96de,_0x4cc12d=this[_0x6e220c(0xd7)];while(this['running']){try{this[_0x6e220c(0xdb)]=new AbortController();let _0x48c9bd={'Accept':_0x6e220c(0xa1)};if(this['token'])_0x48c9bd['Authorization']='Bearer\x20'+this[_0x6e220c(0xef)];let _0xd164ff=await fetch(_0x12b2b4,{'headers':_0x48c9bd,'signal':this[_0x6e220c(0xdb)][_0x6e220c(0xc0)]});if(!_0xd164ff['ok']||!_0xd164ff[_0x6e220c(0xa8)]){this[_0x6e220c(0xf7)](_0x6e220c(0xff)+_0xd164ff[_0x6e220c(0xc8)]),await this[_0x6e220c(0xd5)](_0x4cc12d),_0x4cc12d=Math[_0x6e220c(0xf4)](_0x4cc12d*1.5,0xea60);continue;}_0x4cc12d=this[_0x6e220c(0xd7)];let _0x19eee6=_0xd164ff['body']['getReader'](),_0x528357=new TextDecoder(),_0x405880='';while(this[_0x6e220c(0x114)]){let {done:_0x2c6dd8,value:_0x530930}=await _0x19eee6[_0x6e220c(0xf1)]();if(_0x2c6dd8)break;_0x405880+=_0x528357[_0x6e220c(0xac)](_0x530930,{'stream':!0x0});let _0x347635=_0x405880['split']('\x0a');_0x405880=_0x347635['pop']()||'';for(let _0x5bd6c6 of _0x347635){if(!_0x5bd6c6[_0x6e220c(0xa4)](_0x6e220c(0xdd)))continue;try{let _0x4bd726=JSON[_0x6e220c(0x10f)](_0x5bd6c6[_0x6e220c(0xda)](0x6));if(_0x4bd726[_0x6e220c(0x116)]==='connected'){this[_0x6e220c(0xf7)](_0x6e220c(0x109)),this[_0x6e220c(0xb7)](_0x6e220c(0xe9));continue;}if(_0x4bd726['type']===_0x6e220c(0x9c)||_0x4bd726[_0x6e220c(0x116)]===_0x6e220c(0xfb)||_0x4bd726[_0x6e220c(0x116)]===_0x6e220c(0x9d))await this[_0x6e220c(0xab)]();}catch{}}}}catch(_0x5da394){if(_0x5da394['name']==='AbortError')break;this['emit'](_0x6e220c(0x9e),_0x5da394),this['log'](_0x6e220c(0xba)+_0x5da394['message']);}if(this[_0x6e220c(0x114)])this[_0x6e220c(0xb7)](_0x6e220c(0xa2)),this[_0x6e220c(0xf7)](_0x6e220c(0xf3)+_0x4cc12d/0x3e8+_0x6e220c(0x111)),await this['sleep'](_0x4cc12d),_0x4cc12d=Math['min'](_0x4cc12d*1.5,0xea60);}}async[a0_0x265bba(0xab)](){const _0x43b619=a0_0x265bba;try{let _0x49de05=(await this[_0x43b619(0xd8)](_0x43b619(0xad),{'alias':this[_0x43b619(0xd9)],'limit':0xa}))?.[_0x43b619(0xae)]||[];for(let _0x3b6418 of _0x49de05)await this[_0x43b619(0xd8)]('ack_inbox',{'alias':this[_0x43b619(0xd9)],'message_id':_0x3b6418['id']}),this[_0x43b619(0xf7)]('←\x20'+_0x3b6418['from_session']+':\x20'+_0x3b6418['content'][_0x43b619(0xda)](0x0,0x3c)),this[_0x43b619(0xb7)](_0x43b619(0x101),_0x3b6418),this[_0x43b619(0xb7)]('message',_0x3b6418);}catch(_0x4a8c1d){this[_0x43b619(0xf7)](_0x43b619(0xd0)+_0x4a8c1d[_0x43b619(0xeb)]);}}[a0_0x265bba(0xd5)](_0x184a51){return new Promise(_0x15bce3=>setTimeout(_0x15bce3,_0x184a51));}}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x55eb92=a0_0x45b6;(function(_0x267ebb,_0x136818){const _0x196a0e=a0_0x45b6,_0x5c8128=_0x267ebb();while(!![]){try{const _0x25b3df=parseInt(_0x196a0e(0x167))/0x1*(parseInt(_0x196a0e(0x1ad))/0x2)+parseInt(_0x196a0e(0x1cd))/0x3+-parseInt(_0x196a0e(0x1b1))/0x4+parseInt(_0x196a0e(0x18a))/0x5*(-parseInt(_0x196a0e(0x15f))/0x6)+parseInt(_0x196a0e(0x193))/0x7*(-parseInt(_0x196a0e(0x1a4))/0x8)+parseInt(_0x196a0e(0x163))/0x9*(parseInt(_0x196a0e(0x164))/0xa)+-parseInt(_0x196a0e(0x1a8))/0xb*(-parseInt(_0x196a0e(0x1ba))/0xc);if(_0x25b3df===_0x136818)break;else _0x5c8128['push'](_0x5c8128['shift']());}catch(_0x3d0a19){_0x5c8128['push'](_0x5c8128['shift']());}}}(a0_0x2905,0xec5b1));import{EventEmitter as a0_0x57742f}from'events';import{hostname as a0_0x463126}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x14e2ba,_0x12fcae)=>(_0x14e2ba??_0x12fcae)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x55eb92(0x18d)](0x0,0xf0);function N(_0xbaf20f){const _0x4b5985=a0_0x55eb92;return(_0xbaf20f instanceof Error?_0xbaf20f[_0x4b5985(0x1cc)]:String(_0xbaf20f??_0x4b5985(0x16f)))[_0x4b5985(0x1cb)](K,'[REDACTED]')['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function a0_0x2905(){const _0x50430c=['1026666VBRwMD','cwd','resumeId','status','idle','failed','AbortError','server','task.send.start','split','connect','broadcast','task.ack','2.0','missing_task_id','to_alias','[commhub:task]\x20','message_id','send','send_task','6Joalju','json','parse','task','51498oejjPp','2290lRYgip','task_id','normal','162362FLpfeP','from_alias','type','new_message',']\x20[commhub:','data:\x20','SSE\x20error:\x20','content','unknown\x20error','heartbeat\x20failed:\x20','sleep','lifecycleTracking','catch','now','lifecycle_tracking','log','heartbeatInterval','match','error_message','get_all_status','reply','task.send.delivered','disconnect','sending','sseAbort','decode','autoConnect','send_rejected','min','application/json','/mcp','SSE\x20connected','abort','send_reply','body','6171380ayljWV','parentTaskId','error_code','slice','call','running','s...','heartbeatTimer','Bearer\x20','9986221swKvaJ','emit','report_status','name','url','networkId','delivered','CommHub\x20response\x20omitted\x20task_id','agent','alias','connected','getReader','string','messages','completed','processInbox','reconnectDelay','8eaBNIJ','new_task','\x20parent_task_id=','get_inbox','2241492qFZspQ','duration_ms','task.send.failed','disconnected','from_session','6zFQldp','result','task.started','sdk-','3823672IpgKQg','network_id','connectSSE','SSE\x20reconnecting\x20in\x20','toString','registered','startsWith','signal','task.expired','144ZpONxQ','toAlias','\x20network_id=','\x20duration_ms=','Authorization','send_failed','toTimeString','error','<pending>','<unknown>','stringify','text','tools/call','transport','token','\x20to=','\x20from=','replace','message'];a0_0x2905=function(){return _0x50430c;};return a0_0x2905();}function O(_0x25fde0,_0x500a58=process.env.ANET_TASK_TRACE_FORMAT===a0_0x55eb92(0x160)){const _0x2122d2=a0_0x55eb92;if(_0x500a58)return JSON[_0x2122d2(0x1c4)](_0x25fde0);let _0x40649e=L(_0x25fde0['parent_task_id'],'<missing>'),_0x1ebef0=L(_0x25fde0['task_id'],_0x2122d2(0x1c2)),_0x55e29a=_0x25fde0[_0x2122d2(0x18c)]?'\x20error='+_0x25fde0['error_code']+':'+(_0x25fde0[_0x2122d2(0x179)]??''):'';return _0x2122d2(0x15b)+_0x25fde0['status']+_0x2122d2(0x1ca)+L(_0x25fde0[_0x2122d2(0x168)],_0x2122d2(0x1c3))+_0x2122d2(0x1c9)+L(_0x25fde0[_0x2122d2(0x15a)],_0x2122d2(0x1c3))+'\x20task_id='+_0x1ebef0+_0x2122d2(0x1a6)+_0x40649e+_0x2122d2(0x1bc)+L(_0x25fde0[_0x2122d2(0x1b2)],'<unknown>')+'\x20transport='+_0x25fde0[_0x2122d2(0x1c7)]+_0x2122d2(0x1bd)+_0x25fde0[_0x2122d2(0x1a9)]+'\x20lifecycle='+_0x25fde0[_0x2122d2(0x175)]+_0x55e29a;}function U(_0x558f3e){const _0x13b57e=a0_0x55eb92;return{'event':{'sending':_0x13b57e(0x153),'delivered':_0x13b57e(0x17c),'failed':_0x13b57e(0x1aa),'acked':_0x13b57e(0x157),'started':_0x13b57e(0x1af),'replied':'task.replied','expired':_0x13b57e(0x1b9)}[_0x558f3e[_0x13b57e(0x1d0)]],..._0x558f3e};}function j(_0x51cb5d){const _0x222202=a0_0x55eb92;let _0x18ee0e=_0x51cb5d?.[_0x222202(0x165)]||_0x51cb5d?.['message_id']||_0x51cb5d?.['id'];if(_0x18ee0e)return String(_0x18ee0e);let _0x4ec1dc=_0x51cb5d?.[_0x222202(0x16e)]?.[0x0]?.[_0x222202(0x1c5)];if(typeof _0x4ec1dc!==_0x222202(0x19f))return null;try{let _0x4e2660=JSON['parse'](_0x4ec1dc);return _0x4e2660?.['task_id']||_0x4e2660?.[_0x222202(0x15c)]||_0x4e2660?.['id']||null;}catch{return null;}}async function X(_0x489e9e,_0x8de6e4){const _0x672f8e=a0_0x55eb92;let _0x2cd8e4=_0x8de6e4[_0x672f8e(0x174)]??Date[_0x672f8e(0x174)],_0x261b26=_0x2cd8e4(),_0x41a278=(_0xab3b7e,_0x2de927,_0x1e6ee6,_0x256785)=>{const _0x5952b1=_0x672f8e;_0x8de6e4[_0x5952b1(0x176)](O(U({'from_alias':_0x489e9e['fromAlias'],'to_alias':_0x489e9e[_0x5952b1(0x1bb)],'task_id':_0x2de927,'parent_task_id':_0x489e9e[_0x5952b1(0x18b)],'network_id':_0x489e9e[_0x5952b1(0x198)],'transport':_0x489e9e['transport'],'status':_0xab3b7e,'duration_ms':_0x2cd8e4()-_0x261b26,'lifecycle_tracking':_0x489e9e[_0x5952b1(0x172)],..._0x1e6ee6!==void 0x0?{'error_code':_0x256785||_0x5952b1(0x1bf),'error_message':N(_0x1e6ee6)}:{}})));};_0x41a278(_0x672f8e(0x17e),null);try{let _0x217062=await _0x8de6e4[_0x672f8e(0x15d)](),_0x2b25b0=j(_0x217062);if(_0x2b25b0)_0x41a278(_0x672f8e(0x199),_0x2b25b0);else{if(_0x217062?.['ok']===!0x1||_0x217062?.['error'])_0x41a278('failed',_0x2b25b0,_0x217062?.[_0x672f8e(0x1c1)]||'CommHub\x20rejected\x20task',_0x672f8e(0x182));else _0x41a278(_0x672f8e(0x1d2),null,_0x672f8e(0x19a),_0x672f8e(0x159));}return _0x217062;}catch(_0x25d251){throw _0x41a278(_0x672f8e(0x1d2),null,_0x25d251,_0x672f8e(0x1bf)),_0x25d251;}}async function Y(_0xd40d1,_0xbf0e16){const _0x506cc1=a0_0x55eb92;return X({'fromAlias':_0xd40d1['fromAlias'],'toAlias':_0xd40d1[_0x506cc1(0x19c)],'parentTaskId':_0xd40d1[_0x506cc1(0x18b)]||null,'networkId':_0xd40d1[_0x506cc1(0x198)]||null,'transport':'mcp_http','lifecycleTracking':'not_tracked'},_0xbf0e16);}function a0_0x45b6(_0x5a4ec0,_0x79799c){_0x5a4ec0=_0x5a4ec0-0x152;const _0x29058b=a0_0x2905();let _0x45b694=_0x29058b[_0x5a4ec0];return _0x45b694;}class $ extends a0_0x57742f{['url'];[a0_0x55eb92(0x19c)];[a0_0x55eb92(0x1c8)];[a0_0x55eb92(0x19b)];['resumeId'];[a0_0x55eb92(0x177)];[a0_0x55eb92(0x1a3)];[a0_0x55eb92(0x191)];[a0_0x55eb92(0x17f)];[a0_0x55eb92(0x18f)]=!0x1;constructor(_0xe0c5ee){const _0x19bcd3=a0_0x55eb92;super();if(this['url']=_0xe0c5ee[_0x19bcd3(0x197)][_0x19bcd3(0x1cb)](/\/$/,''),this[_0x19bcd3(0x19c)]=_0xe0c5ee[_0x19bcd3(0x19c)],this[_0x19bcd3(0x1c8)]=_0xe0c5ee[_0x19bcd3(0x1c8)],this['agent']=_0xe0c5ee[_0x19bcd3(0x19b)]||'sdk',this['resumeId']=_0x19bcd3(0x1b0)+_0xe0c5ee[_0x19bcd3(0x19c)]+'-'+Date[_0x19bcd3(0x174)]()[_0x19bcd3(0x1b5)](0x24),this[_0x19bcd3(0x177)]=_0xe0c5ee[_0x19bcd3(0x177)]??0x2bf20,this[_0x19bcd3(0x1a3)]=_0xe0c5ee[_0x19bcd3(0x1a3)]??0xbb8,_0xe0c5ee[_0x19bcd3(0x181)]!==!0x1)this[_0x19bcd3(0x155)]();}['log'](_0x22504c){const _0x243d8f=a0_0x55eb92;console[_0x243d8f(0x176)]('['+new Date()[_0x243d8f(0x1c0)]()['slice'](0x0,0x8)+_0x243d8f(0x16b)+this[_0x243d8f(0x19c)]+']\x20'+_0x22504c);}async['call'](_0x92af95,_0x9d6317){const _0x48c31b=a0_0x55eb92;let _0x7c096e={'Content-Type':_0x48c31b(0x184),'Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x7c096e[_0x48c31b(0x1be)]=_0x48c31b(0x192)+this['token'];let _0x205039=await(await fetch(this['url']+_0x48c31b(0x185),{'method':'POST','headers':_0x7c096e,'body':JSON['stringify']({'jsonrpc':_0x48c31b(0x158),'id':Date[_0x48c31b(0x174)](),'method':_0x48c31b(0x1c6),'params':{'name':_0x92af95,'arguments':_0x9d6317}})}))['text'](),_0x2233c7=_0x205039[_0x48c31b(0x178)](/data: (.+)/),_0x6962a9=_0x2233c7?JSON['parse'](_0x2233c7[0x1]):JSON[_0x48c31b(0x161)](_0x205039),_0x441df7=_0x6962a9?.[_0x48c31b(0x1ae)]?.[_0x48c31b(0x16e)]?.[0x0]?.[_0x48c31b(0x1c5)];return _0x441df7?JSON['parse'](_0x441df7):_0x6962a9;}async[a0_0x55eb92(0x155)](){const _0x355459=a0_0x55eb92;if(this[_0x355459(0x18f)])return;this[_0x355459(0x18f)]=!0x0,await this[_0x355459(0x1d0)](_0x355459(0x1d1)),this['log'](_0x355459(0x1b6)),this['heartbeatTimer']=setInterval(()=>{const _0x29e1b5=_0x355459;this[_0x29e1b5(0x1d0)](_0x29e1b5(0x1d1))[_0x29e1b5(0x173)](_0x4adb61=>this[_0x29e1b5(0x176)](_0x29e1b5(0x170)+_0x4adb61[_0x29e1b5(0x1cc)]));},this[_0x355459(0x177)]),this[_0x355459(0x1b3)]();}async[a0_0x55eb92(0x17d)](){const _0x1b616e=a0_0x55eb92;if(this[_0x1b616e(0x18f)]=!0x1,this[_0x1b616e(0x17f)]?.[_0x1b616e(0x187)](),this[_0x1b616e(0x191)])clearInterval(this[_0x1b616e(0x191)]);await this[_0x1b616e(0x1d0)]('offline')['catch'](()=>{}),this['log'](_0x1b616e(0x1ab));}async[a0_0x55eb92(0x15d)](_0x505c50,_0x4cb9e0,_0x617b81=a0_0x55eb92(0x166)){const _0x39d92e=a0_0x55eb92;return Y({'alias':_0x505c50,'fromAlias':this['alias']},{'log':_0x4985cd=>console[_0x39d92e(0x176)](_0x4985cd),'send':()=>this[_0x39d92e(0x18e)](_0x39d92e(0x15e),{'alias':_0x505c50,'task':_0x4cb9e0,'priority':_0x617b81,'from_session':this[_0x39d92e(0x19c)]})});}async[a0_0x55eb92(0x1cc)](_0x4e20cd,_0x9018bc){const _0x385a25=a0_0x55eb92;return this[_0x385a25(0x18e)]('send_message',{'alias':_0x4e20cd,'message':_0x9018bc,'from_session':this[_0x385a25(0x19c)]});}async[a0_0x55eb92(0x17b)](_0x4671c2,_0x5d8d72,_0x2beb9c=a0_0x55eb92(0x1a1)){const _0x486dc2=a0_0x55eb92;return this[_0x486dc2(0x18e)](_0x486dc2(0x188),{'in_reply_to':_0x4671c2,'text':_0x5d8d72,'status':_0x2beb9c});}async[a0_0x55eb92(0x1d0)](_0xb00ada,_0x856f13){const _0x30bbd9=a0_0x55eb92;return this['call'](_0x30bbd9(0x195),{'resume_id':this[_0x30bbd9(0x1cf)],'alias':this[_0x30bbd9(0x19c)],'status':_0xb00ada,'server':a0_0x463126(),'hostname':a0_0x463126(),'agent':this[_0x30bbd9(0x19b)],'project_dir':process[_0x30bbd9(0x1ce)](),..._0x856f13});}async['getAllStatus'](){const _0x2c618c=a0_0x55eb92;return this[_0x2c618c(0x18e)](_0x2c618c(0x17a),{});}async[a0_0x55eb92(0x156)](_0x2c3f8a,_0x1afc8c){const _0x3f9635=a0_0x55eb92;return this['call'](_0x3f9635(0x156),{'message':_0x2c3f8a,'filter_server':_0x1afc8c?.[_0x3f9635(0x152)],'filter_status':_0x1afc8c?.[_0x3f9635(0x1d0)]});}async['connectSSE'](){const _0x1d8871=a0_0x55eb92;let _0x50d784=encodeURIComponent(this[_0x1d8871(0x19c)]),_0x46e4d5=this[_0x1d8871(0x197)]+'/events/'+_0x50d784,_0x3779e2=this[_0x1d8871(0x1a3)];while(this['running']){try{this[_0x1d8871(0x17f)]=new AbortController();let _0x354e92={'Accept':'text/event-stream'};if(this[_0x1d8871(0x1c8)])_0x354e92[_0x1d8871(0x1be)]=_0x1d8871(0x192)+this['token'];let _0x4df6da=await fetch(_0x46e4d5,{'headers':_0x354e92,'signal':this['sseAbort'][_0x1d8871(0x1b8)]});if(!_0x4df6da['ok']||!_0x4df6da[_0x1d8871(0x189)]){this[_0x1d8871(0x176)]('SSE\x20failed:\x20'+_0x4df6da[_0x1d8871(0x1d0)]),await this[_0x1d8871(0x171)](_0x3779e2),_0x3779e2=Math[_0x1d8871(0x183)](_0x3779e2*1.5,0xea60);continue;}_0x3779e2=this[_0x1d8871(0x1a3)];let _0x20c7ae=_0x4df6da[_0x1d8871(0x189)][_0x1d8871(0x19e)](),_0x3537cc=new TextDecoder(),_0x4bb10a='';while(this[_0x1d8871(0x18f)]){let {done:_0x483262,value:_0x406d7a}=await _0x20c7ae['read']();if(_0x483262)break;_0x4bb10a+=_0x3537cc[_0x1d8871(0x180)](_0x406d7a,{'stream':!0x0});let _0x9c5c6b=_0x4bb10a[_0x1d8871(0x154)]('\x0a');_0x4bb10a=_0x9c5c6b['pop']()||'';for(let _0x1fc8f4 of _0x9c5c6b){if(!_0x1fc8f4[_0x1d8871(0x1b7)](_0x1d8871(0x16c)))continue;try{let _0x154b11=JSON[_0x1d8871(0x161)](_0x1fc8f4[_0x1d8871(0x18d)](0x6));if(_0x154b11[_0x1d8871(0x169)]==='connected'){this[_0x1d8871(0x176)](_0x1d8871(0x186)),this['emit'](_0x1d8871(0x19d));continue;}if(_0x154b11[_0x1d8871(0x169)]===_0x1d8871(0x1a5)||_0x154b11['type']===_0x1d8871(0x16a)||_0x154b11[_0x1d8871(0x169)]==='broadcast')await this['processInbox']();}catch{}}}}catch(_0x643ba7){if(_0x643ba7[_0x1d8871(0x196)]===_0x1d8871(0x1d3))break;this[_0x1d8871(0x194)]('error',_0x643ba7),this[_0x1d8871(0x176)](_0x1d8871(0x16d)+_0x643ba7[_0x1d8871(0x1cc)]);}if(this['running'])this[_0x1d8871(0x194)](_0x1d8871(0x1ab)),this[_0x1d8871(0x176)](_0x1d8871(0x1b4)+_0x3779e2/0x3e8+_0x1d8871(0x190)),await this[_0x1d8871(0x171)](_0x3779e2),_0x3779e2=Math[_0x1d8871(0x183)](_0x3779e2*1.5,0xea60);}}async[a0_0x55eb92(0x1a2)](){const _0x13244c=a0_0x55eb92;try{let _0x5696c1=(await this[_0x13244c(0x18e)](_0x13244c(0x1a7),{'alias':this['alias'],'limit':0xa}))?.[_0x13244c(0x1a0)]||[];for(let _0x517d1f of _0x5696c1)await this['call']('ack_inbox',{'alias':this[_0x13244c(0x19c)],'message_id':_0x517d1f['id']}),this[_0x13244c(0x176)]('←\x20'+_0x517d1f[_0x13244c(0x1ac)]+':\x20'+_0x517d1f['content'][_0x13244c(0x18d)](0x0,0x3c)),this[_0x13244c(0x194)](_0x13244c(0x162),_0x517d1f),this[_0x13244c(0x194)](_0x13244c(0x1cc),_0x517d1f);}catch(_0x3a6e93){this[_0x13244c(0x176)]('inbox\x20error:\x20'+_0x3a6e93[_0x13244c(0x1cc)]);}}[a0_0x55eb92(0x171)](_0x11bcc3){return new Promise(_0x27bea7=>setTimeout(_0x27bea7,_0x11bcc3));}}var F=$;export{F as default,$ as CommHub};
|