@sleep2agi/agent-network 2.3.0-preview.244 → 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.
@@ -1 +1 @@
1
- const a0_0x3202f1=a0_0x1ba1;(function(_0xae77d3,_0x41acd6){const _0x49d876=a0_0x1ba1,_0x747006=_0xae77d3();while(!![]){try{const _0x25261b=-parseInt(_0x49d876(0x108))/0x1+parseInt(_0x49d876(0xf1))/0x2+parseInt(_0x49d876(0x149))/0x3*(-parseInt(_0x49d876(0xd7))/0x4)+-parseInt(_0x49d876(0x10d))/0x5*(parseInt(_0x49d876(0x114))/0x6)+parseInt(_0x49d876(0x122))/0x7+parseInt(_0x49d876(0x11f))/0x8+-parseInt(_0x49d876(0x121))/0x9*(-parseInt(_0x49d876(0x101))/0xa);if(_0x25261b===_0x41acd6)break;else _0x747006['push'](_0x747006['shift']());}catch(_0x47c0fd){_0x747006['push'](_0x747006['shift']());}}}(a0_0x188e,0xa58d7));import{EventEmitter as a0_0x1408d2}from'events';import{hostname as a0_0x5e1407}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x2b6b91,_0x52bd46)=>(_0x2b6b91??_0x52bd46)[a0_0x3202f1(0x11a)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x3202f1(0xd2)](0x0,0xf0);function N(_0x20bb47){const _0x4d08ee=a0_0x3202f1;return(_0x20bb47 instanceof Error?_0x20bb47[_0x4d08ee(0x13e)]:String(_0x20bb47??_0x4d08ee(0xe9)))[_0x4d08ee(0x11a)](K,_0x4d08ee(0x13a))['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x4d08ee(0xd2)](0x0,0xf0);}function O(_0x31bc23,_0x1da239=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0x1f11cb=a0_0x3202f1;if(_0x1da239)return JSON[_0x1f11cb(0x137)](_0x31bc23);let _0x8a08cc=L(_0x31bc23[_0x1f11cb(0xfb)],_0x1f11cb(0xdf)),_0x58446d=L(_0x31bc23[_0x1f11cb(0xf3)],_0x1f11cb(0x119)),_0xc0d95c=_0x31bc23[_0x1f11cb(0x12d)]?'\x20error='+_0x31bc23[_0x1f11cb(0x12d)]+':'+(_0x31bc23['error_message']??''):'';return'[commhub:task]\x20'+_0x31bc23[_0x1f11cb(0x105)]+_0x1f11cb(0xdc)+L(_0x31bc23['from_alias'],_0x1f11cb(0x11c))+_0x1f11cb(0xe3)+L(_0x31bc23[_0x1f11cb(0x12f)],_0x1f11cb(0x11c))+'\x20task_id='+_0x58446d+_0x1f11cb(0xfe)+_0x8a08cc+_0x1f11cb(0xd8)+L(_0x31bc23['network_id'],_0x1f11cb(0x11c))+_0x1f11cb(0x131)+_0x31bc23[_0x1f11cb(0x100)]+_0x1f11cb(0xfa)+_0x31bc23[_0x1f11cb(0xe5)]+_0x1f11cb(0x117)+_0x31bc23['lifecycle_tracking']+_0xc0d95c;}function U(_0x2da560){const _0x54a55b=a0_0x3202f1;return{'event':{'sending':_0x54a55b(0x10e),'delivered':'task.send.delivered','failed':_0x54a55b(0xee),'acked':_0x54a55b(0xe4),'started':_0x54a55b(0xf6),'replied':_0x54a55b(0xd6),'expired':_0x54a55b(0x148)}[_0x2da560[_0x54a55b(0x105)]],..._0x2da560};}function j(_0x8ae5ac){const _0x548fbe=a0_0x3202f1;let _0x17e93b=_0x8ae5ac?.[_0x548fbe(0xf3)]||_0x8ae5ac?.[_0x548fbe(0x125)]||_0x8ae5ac?.['id'];if(_0x17e93b)return String(_0x17e93b);let _0x5e9e9b=_0x8ae5ac?.['content']?.[0x0]?.[_0x548fbe(0xfc)];if(typeof _0x5e9e9b!==_0x548fbe(0x110))return null;try{let _0x2d56a1=JSON[_0x548fbe(0xf0)](_0x5e9e9b);return _0x2d56a1?.[_0x548fbe(0xf3)]||_0x2d56a1?.[_0x548fbe(0x125)]||_0x2d56a1?.['id']||null;}catch{return null;}}function a0_0x1ba1(_0x801137,_0x7187fd){_0x801137=_0x801137-0xd2;const _0x188ef6=a0_0x188e();let _0x1ba167=_0x188ef6[_0x801137];return _0x1ba167;}function a0_0x188e(){const _0x843026=['\x20to=','task.ack','duration_ms','pop','heartbeatTimer','failed','unknown\x20error','toAlias','completed','reconnectDelay','delivered','task.send.failed','body','parse','1144224cqQBtk',']\x20[commhub:','task_id','new_task','mcp_http','task.started','disconnect','send_message','get_all_status','\x20duration_ms=','parent_task_id','text','broadcast','\x20parent_task_id=','networkId','transport','10AkZdfY','tools/call','error','server','status','result','reply','1255308mfxUzd','data:\x20','SSE\x20reconnecting\x20in\x20','inbox\x20error:\x20','new_message','127440DtaMdE','task.send.start','text/event-stream','string','min','connectSSE','emit','234uOgFUw','registered','agent','\x20lifecycle=','/events/','<pending>','replace','token','<unknown>','abort','application/json','8948872vKfZRz','report_status','9728973CNmBmM','4183291MytEUA','split','url','message_id','application/json,\x20text/event-stream','send_rejected','send_failed','parentTaskId','running','CommHub\x20rejected\x20task','connect','error_code','processInbox','to_alias','autoConnect','\x20transport=','ack_inbox','Bearer\x20','lifecycleTracking','toString','call','stringify','sending','send_task','[REDACTED]','messages','connected','type','message','send_reply','alias','cwd','signal','SSE\x20failed:\x20','disconnected','startsWith','fromAlias','sseAbort','task.expired','3PHteDx','decode','not_tracked','now','SSE\x20error:\x20','toTimeString','missing_task_id','name','CommHub\x20response\x20omitted\x20task_id','slice','idle','offline','content','task.replied','1767552cyDndf','\x20network_id=','send','from_session','2.0','\x20from=','log','heartbeatInterval','<missing>','task','resumeId','catch'];a0_0x188e=function(){return _0x843026;};return a0_0x188e();}async function X(_0x5b0fec,_0x2bbbc5){const _0x457a8f=a0_0x3202f1;let _0x2a852a=_0x2bbbc5[_0x457a8f(0x14c)]??Date['now'],_0x3e4035=_0x2a852a(),_0x2fa989=(_0x233cc6,_0x1d0a3b,_0x3607d7,_0x295198)=>{const _0x3bada=_0x457a8f;_0x2bbbc5[_0x3bada(0xdd)](O(U({'from_alias':_0x5b0fec[_0x3bada(0x146)],'to_alias':_0x5b0fec[_0x3bada(0xea)],'task_id':_0x1d0a3b,'parent_task_id':_0x5b0fec[_0x3bada(0x129)],'network_id':_0x5b0fec[_0x3bada(0xff)],'transport':_0x5b0fec[_0x3bada(0x100)],'status':_0x233cc6,'duration_ms':_0x2a852a()-_0x3e4035,'lifecycle_tracking':_0x5b0fec[_0x3bada(0x134)],..._0x3607d7!==void 0x0?{'error_code':_0x295198||'send_failed','error_message':N(_0x3607d7)}:{}})));};_0x2fa989(_0x457a8f(0x138),null);try{let _0x31786f=await _0x2bbbc5[_0x457a8f(0xd9)](),_0x1f97de=j(_0x31786f);if(_0x1f97de)_0x2fa989(_0x457a8f(0xed),_0x1f97de);else{if(_0x31786f?.['ok']===!0x1||_0x31786f?.[_0x457a8f(0x103)])_0x2fa989(_0x457a8f(0xe8),_0x1f97de,_0x31786f?.[_0x457a8f(0x103)]||_0x457a8f(0x12b),_0x457a8f(0x127));else _0x2fa989(_0x457a8f(0xe8),null,_0x457a8f(0x151),_0x457a8f(0x14f));}return _0x31786f;}catch(_0x58d5eb){throw _0x2fa989(_0x457a8f(0xe8),null,_0x58d5eb,_0x457a8f(0x128)),_0x58d5eb;}}async function Y(_0x4084db,_0x51ce19){const _0x53b4e6=a0_0x3202f1;return X({'fromAlias':_0x4084db[_0x53b4e6(0x146)],'toAlias':_0x4084db[_0x53b4e6(0x140)],'parentTaskId':_0x4084db[_0x53b4e6(0x129)]||null,'networkId':_0x4084db[_0x53b4e6(0xff)]||null,'transport':_0x53b4e6(0xf5),'lifecycleTracking':_0x53b4e6(0x14b)},_0x51ce19);}class $ extends a0_0x1408d2{[a0_0x3202f1(0x124)];[a0_0x3202f1(0x140)];['token'];[a0_0x3202f1(0x116)];[a0_0x3202f1(0xe1)];['heartbeatInterval'];[a0_0x3202f1(0xec)];['heartbeatTimer'];['sseAbort'];[a0_0x3202f1(0x12a)]=!0x1;constructor(_0x370c0c){const _0x3491cd=a0_0x3202f1;super();if(this[_0x3491cd(0x124)]=_0x370c0c[_0x3491cd(0x124)][_0x3491cd(0x11a)](/\/$/,''),this[_0x3491cd(0x140)]=_0x370c0c['alias'],this[_0x3491cd(0x11b)]=_0x370c0c[_0x3491cd(0x11b)],this[_0x3491cd(0x116)]=_0x370c0c[_0x3491cd(0x116)]||'sdk',this[_0x3491cd(0xe1)]='sdk-'+_0x370c0c[_0x3491cd(0x140)]+'-'+Date['now']()[_0x3491cd(0x135)](0x24),this[_0x3491cd(0xde)]=_0x370c0c[_0x3491cd(0xde)]??0x2bf20,this[_0x3491cd(0xec)]=_0x370c0c['reconnectDelay']??0xbb8,_0x370c0c[_0x3491cd(0x130)]!==!0x1)this['connect']();}[a0_0x3202f1(0xdd)](_0x5905ae){const _0x5fe975=a0_0x3202f1;console['log']('['+new Date()[_0x5fe975(0x14e)]()[_0x5fe975(0xd2)](0x0,0x8)+_0x5fe975(0xf2)+this[_0x5fe975(0x140)]+']\x20'+_0x5905ae);}async['call'](_0x3dfa10,_0x3778d3){const _0x35ec58=a0_0x3202f1;let _0x855b97={'Content-Type':_0x35ec58(0x11e),'Accept':_0x35ec58(0x126)};if(this[_0x35ec58(0x11b)])_0x855b97['Authorization']=_0x35ec58(0x133)+this[_0x35ec58(0x11b)];let _0x1594da=await(await fetch(this['url']+'/mcp',{'method':'POST','headers':_0x855b97,'body':JSON[_0x35ec58(0x137)]({'jsonrpc':_0x35ec58(0xdb),'id':Date[_0x35ec58(0x14c)](),'method':_0x35ec58(0x102),'params':{'name':_0x3dfa10,'arguments':_0x3778d3}})}))['text'](),_0x56d749=_0x1594da['match'](/data: (.+)/),_0x36e6e5=_0x56d749?JSON['parse'](_0x56d749[0x1]):JSON[_0x35ec58(0xf0)](_0x1594da),_0xa6f538=_0x36e6e5?.[_0x35ec58(0x106)]?.[_0x35ec58(0xd5)]?.[0x0]?.[_0x35ec58(0xfc)];return _0xa6f538?JSON['parse'](_0xa6f538):_0x36e6e5;}async[a0_0x3202f1(0x12c)](){const _0x83430d=a0_0x3202f1;if(this[_0x83430d(0x12a)])return;this[_0x83430d(0x12a)]=!0x0,await this[_0x83430d(0x105)]('idle'),this[_0x83430d(0xdd)](_0x83430d(0x115)),this[_0x83430d(0xe7)]=setInterval(()=>{const _0x1c285f=_0x83430d;this[_0x1c285f(0x105)](_0x1c285f(0xd3))[_0x1c285f(0xe2)](_0x36f5b1=>this[_0x1c285f(0xdd)]('heartbeat\x20failed:\x20'+_0x36f5b1[_0x1c285f(0x13e)]));},this['heartbeatInterval']),this['connectSSE']();}async[a0_0x3202f1(0xf7)](){const _0x5fecbb=a0_0x3202f1;if(this[_0x5fecbb(0x12a)]=!0x1,this['sseAbort']?.[_0x5fecbb(0x11d)](),this['heartbeatTimer'])clearInterval(this['heartbeatTimer']);await this[_0x5fecbb(0x105)](_0x5fecbb(0xd4))['catch'](()=>{}),this[_0x5fecbb(0xdd)](_0x5fecbb(0x144));}async[a0_0x3202f1(0xd9)](_0x465c47,_0x34eb43,_0x11d26d='normal'){const _0xf029c0=a0_0x3202f1;return Y({'alias':_0x465c47,'fromAlias':this['alias']},{'log':_0x4bcaf6=>console['log'](_0x4bcaf6),'send':()=>this[_0xf029c0(0x136)](_0xf029c0(0x139),{'alias':_0x465c47,'task':_0x34eb43,'priority':_0x11d26d,'from_session':this['alias']})});}async['message'](_0xd45c25,_0x226bda){const _0x55973f=a0_0x3202f1;return this[_0x55973f(0x136)](_0x55973f(0xf8),{'alias':_0xd45c25,'message':_0x226bda,'from_session':this[_0x55973f(0x140)]});}async[a0_0x3202f1(0x107)](_0x18f9ad,_0x32460c,_0x1e256c=a0_0x3202f1(0xeb)){const _0x320570=a0_0x3202f1;return this['call'](_0x320570(0x13f),{'in_reply_to':_0x18f9ad,'text':_0x32460c,'status':_0x1e256c});}async[a0_0x3202f1(0x105)](_0x5eb4ff,_0x214cdd){const _0x13a588=a0_0x3202f1;return this[_0x13a588(0x136)](_0x13a588(0x120),{'resume_id':this[_0x13a588(0xe1)],'alias':this[_0x13a588(0x140)],'status':_0x5eb4ff,'server':a0_0x5e1407(),'hostname':a0_0x5e1407(),'agent':this['agent'],'project_dir':process[_0x13a588(0x141)](),..._0x214cdd});}async['getAllStatus'](){const _0x3a3b59=a0_0x3202f1;return this['call'](_0x3a3b59(0xf9),{});}async[a0_0x3202f1(0xfd)](_0x303db7,_0x3c151f){const _0x3ccc8d=a0_0x3202f1;return this[_0x3ccc8d(0x136)](_0x3ccc8d(0xfd),{'message':_0x303db7,'filter_server':_0x3c151f?.[_0x3ccc8d(0x104)],'filter_status':_0x3c151f?.[_0x3ccc8d(0x105)]});}async[a0_0x3202f1(0x112)](){const _0x4e2f29=a0_0x3202f1;let _0x421715=encodeURIComponent(this[_0x4e2f29(0x140)]),_0xe65260=this['url']+_0x4e2f29(0x118)+_0x421715,_0x5ec7ba=this[_0x4e2f29(0xec)];while(this['running']){try{this[_0x4e2f29(0x147)]=new AbortController();let _0x112588={'Accept':_0x4e2f29(0x10f)};if(this[_0x4e2f29(0x11b)])_0x112588['Authorization']='Bearer\x20'+this[_0x4e2f29(0x11b)];let _0x56de16=await fetch(_0xe65260,{'headers':_0x112588,'signal':this[_0x4e2f29(0x147)][_0x4e2f29(0x142)]});if(!_0x56de16['ok']||!_0x56de16['body']){this['log'](_0x4e2f29(0x143)+_0x56de16[_0x4e2f29(0x105)]),await this['sleep'](_0x5ec7ba),_0x5ec7ba=Math[_0x4e2f29(0x111)](_0x5ec7ba*1.5,0xea60);continue;}_0x5ec7ba=this[_0x4e2f29(0xec)];let _0x147311=_0x56de16[_0x4e2f29(0xef)]['getReader'](),_0x1073aa=new TextDecoder(),_0x5ca052='';while(this[_0x4e2f29(0x12a)]){let {done:_0x1079e4,value:_0x1474e9}=await _0x147311['read']();if(_0x1079e4)break;_0x5ca052+=_0x1073aa[_0x4e2f29(0x14a)](_0x1474e9,{'stream':!0x0});let _0x333886=_0x5ca052[_0x4e2f29(0x123)]('\x0a');_0x5ca052=_0x333886[_0x4e2f29(0xe6)]()||'';for(let _0x2eded1 of _0x333886){if(!_0x2eded1[_0x4e2f29(0x145)](_0x4e2f29(0x109)))continue;try{let _0x407b67=JSON[_0x4e2f29(0xf0)](_0x2eded1[_0x4e2f29(0xd2)](0x6));if(_0x407b67[_0x4e2f29(0x13d)]==='connected'){this['log']('SSE\x20connected'),this[_0x4e2f29(0x113)](_0x4e2f29(0x13c));continue;}if(_0x407b67[_0x4e2f29(0x13d)]===_0x4e2f29(0xf4)||_0x407b67[_0x4e2f29(0x13d)]===_0x4e2f29(0x10c)||_0x407b67[_0x4e2f29(0x13d)]===_0x4e2f29(0xfd))await this[_0x4e2f29(0x12e)]();}catch{}}}}catch(_0x274ad0){if(_0x274ad0[_0x4e2f29(0x150)]==='AbortError')break;this[_0x4e2f29(0x113)](_0x4e2f29(0x103),_0x274ad0),this[_0x4e2f29(0xdd)](_0x4e2f29(0x14d)+_0x274ad0[_0x4e2f29(0x13e)]);}if(this[_0x4e2f29(0x12a)])this[_0x4e2f29(0x113)](_0x4e2f29(0x144)),this[_0x4e2f29(0xdd)](_0x4e2f29(0x10a)+_0x5ec7ba/0x3e8+'s...'),await this['sleep'](_0x5ec7ba),_0x5ec7ba=Math[_0x4e2f29(0x111)](_0x5ec7ba*1.5,0xea60);}}async[a0_0x3202f1(0x12e)](){const _0x493a77=a0_0x3202f1;try{let _0xe6fcfd=(await this['call']('get_inbox',{'alias':this['alias'],'limit':0xa}))?.[_0x493a77(0x13b)]||[];for(let _0x3a1850 of _0xe6fcfd)await this[_0x493a77(0x136)](_0x493a77(0x132),{'alias':this[_0x493a77(0x140)],'message_id':_0x3a1850['id']}),this[_0x493a77(0xdd)]('←\x20'+_0x3a1850[_0x493a77(0xda)]+':\x20'+_0x3a1850['content'][_0x493a77(0xd2)](0x0,0x3c)),this[_0x493a77(0x113)](_0x493a77(0xe0),_0x3a1850),this[_0x493a77(0x113)](_0x493a77(0x13e),_0x3a1850);}catch(_0x196d3d){this[_0x493a77(0xdd)](_0x493a77(0x10b)+_0x196d3d[_0x493a77(0x13e)]);}}['sleep'](_0xd7c6ad){return new Promise(_0x123e39=>setTimeout(_0x123e39,_0xd7c6ad));}}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};