@sleep2agi/agent-network 2.3.0-preview.241 → 2.3.0-preview.242

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_0x547f64=a0_0x491a;(function(_0x52639f,_0x37737c){const _0x2e0df2=a0_0x491a,_0x1c9a1d=_0x52639f();while(!![]){try{const _0x74ba7b=parseInt(_0x2e0df2(0xe9))/0x1*(-parseInt(_0x2e0df2(0xa3))/0x2)+-parseInt(_0x2e0df2(0x91))/0x3*(-parseInt(_0x2e0df2(0xfb))/0x4)+-parseInt(_0x2e0df2(0xac))/0x5*(-parseInt(_0x2e0df2(0xa8))/0x6)+parseInt(_0x2e0df2(0xe4))/0x7+-parseInt(_0x2e0df2(0xdc))/0x8*(-parseInt(_0x2e0df2(0xc0))/0x9)+parseInt(_0x2e0df2(0xd0))/0xa*(parseInt(_0x2e0df2(0xc5))/0xb)+-parseInt(_0x2e0df2(0xb6))/0xc*(parseInt(_0x2e0df2(0x9b))/0xd);if(_0x74ba7b===_0x37737c)break;else _0x1c9a1d['push'](_0x1c9a1d['shift']());}catch(_0x40e2c0){_0x1c9a1d['push'](_0x1c9a1d['shift']());}}}(a0_0x556a,0xe564f));function a0_0x491a(_0x5513f9,_0x678b3d){_0x5513f9=_0x5513f9-0x84;const _0x556a12=a0_0x556a();let _0x491aa7=_0x556a12[_0x5513f9];return _0x491aa7;}import{EventEmitter as a0_0x8f975a}from'events';import{hostname as a0_0x530b89}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x235e18,_0x1c9389)=>(_0x235e18??_0x1c9389)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x547f64(0xf8)](0x0,0xf0);function N(_0x2f1b91){const _0x3886da=a0_0x547f64;return(_0x2f1b91 instanceof Error?_0x2f1b91[_0x3886da(0xec)]:String(_0x2f1b91??_0x3886da(0xd5)))[_0x3886da(0xea)](K,'[REDACTED]')[_0x3886da(0xea)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x3886da(0xf8)](0x0,0xf0);}function O(_0x694d82,_0xf8c0ec=process.env.ANET_TASK_TRACE_FORMAT===a0_0x547f64(0xf0)){const _0x3791a3=a0_0x547f64;if(_0xf8c0ec)return JSON[_0x3791a3(0xe2)](_0x694d82);let _0x54b12d=L(_0x694d82['parent_task_id'],_0x3791a3(0xab)),_0x3925d6=L(_0x694d82[_0x3791a3(0xa0)],_0x3791a3(0xfe)),_0x289271=_0x694d82[_0x3791a3(0x9a)]?'\x20error='+_0x694d82[_0x3791a3(0x9a)]+':'+(_0x694d82[_0x3791a3(0x9e)]??''):'';return _0x3791a3(0xbc)+_0x694d82[_0x3791a3(0xbe)]+'\x20from='+L(_0x694d82[_0x3791a3(0xa6)],_0x3791a3(0x9f))+_0x3791a3(0xc1)+L(_0x694d82[_0x3791a3(0xfd)],_0x3791a3(0x9f))+_0x3791a3(0x8c)+_0x3925d6+_0x3791a3(0x96)+_0x54b12d+_0x3791a3(0xb7)+L(_0x694d82['network_id'],_0x3791a3(0x9f))+'\x20transport='+_0x694d82[_0x3791a3(0xa1)]+'\x20duration_ms='+_0x694d82['duration_ms']+_0x3791a3(0xad)+_0x694d82[_0x3791a3(0xf6)]+_0x289271;}function U(_0x4b6d71){const _0x41afc4=a0_0x547f64;return{'event':{'sending':'task.send.start','delivered':_0x41afc4(0xd2),'failed':'task.send.failed','acked':'task.ack','started':'task.started','replied':_0x41afc4(0xee),'expired':_0x41afc4(0xdb)}[_0x4b6d71[_0x41afc4(0xbe)]],..._0x4b6d71};}function j(_0x2af352){const _0x742f8=a0_0x547f64;let _0x206936=_0x2af352?.['task_id']||_0x2af352?.[_0x742f8(0xdf)]||_0x2af352?.['id'];if(_0x206936)return String(_0x206936);let _0x228357=_0x2af352?.[_0x742f8(0xb8)]?.[0x0]?.[_0x742f8(0xcf)];if(typeof _0x228357!==_0x742f8(0x95))return null;try{let _0x59bb21=JSON[_0x742f8(0xd7)](_0x228357);return _0x59bb21?.[_0x742f8(0xa0)]||_0x59bb21?.[_0x742f8(0xdf)]||_0x59bb21?.['id']||null;}catch{return null;}}async function X(_0x578e60,_0x80b4bb){const _0x5bd121=a0_0x547f64;let _0x5d5b4b=_0x80b4bb[_0x5bd121(0xe7)]??Date['now'],_0x5491bf=_0x5d5b4b(),_0xb9da75=(_0x47e1f2,_0x5f0201,_0x4f639f,_0x5ddbf9)=>{const _0xd2b474=_0x5bd121;_0x80b4bb[_0xd2b474(0xdd)](O(U({'from_alias':_0x578e60[_0xd2b474(0xf7)],'to_alias':_0x578e60['toAlias'],'task_id':_0x5f0201,'parent_task_id':_0x578e60[_0xd2b474(0xf3)],'network_id':_0x578e60['networkId'],'transport':_0x578e60[_0xd2b474(0xa1)],'status':_0x47e1f2,'duration_ms':_0x5d5b4b()-_0x5491bf,'lifecycle_tracking':_0x578e60[_0xd2b474(0xe6)],..._0x4f639f!==void 0x0?{'error_code':_0x5ddbf9||_0xd2b474(0xaf),'error_message':N(_0x4f639f)}:{}})));};_0xb9da75(_0x5bd121(0xcd),null);try{let _0x100573=await _0x80b4bb['send'](),_0x40e904=j(_0x100573);if(_0x40e904)_0xb9da75('delivered',_0x40e904);else{if(_0x100573?.['ok']===!0x1||_0x100573?.['error'])_0xb9da75(_0x5bd121(0x8d),_0x40e904,_0x100573?.['error']||_0x5bd121(0xe0),_0x5bd121(0xc4));else _0xb9da75(_0x5bd121(0x8d),null,'CommHub\x20response\x20omitted\x20task_id',_0x5bd121(0x89));}return _0x100573;}catch(_0x2faea0){throw _0xb9da75(_0x5bd121(0x8d),null,_0x2faea0,_0x5bd121(0xaf)),_0x2faea0;}}async function Y(_0x323592,_0x38de9d){const _0x3e760d=a0_0x547f64;return X({'fromAlias':_0x323592[_0x3e760d(0xf7)],'toAlias':_0x323592[_0x3e760d(0xd3)],'parentTaskId':_0x323592[_0x3e760d(0xf3)]||null,'networkId':_0x323592[_0x3e760d(0xb0)]||null,'transport':_0x3e760d(0xef),'lifecycleTracking':_0x3e760d(0xfa)},_0x38de9d);}function a0_0x556a(){const _0x3c998f=['136iWSCjq','POST','to_alias','<pending>','send_reply','/events/','name','abort','Bearer\x20','missing_task_id','body','getAllStatus','\x20task_id=','failed','task','result','heartbeatInterval','46407IegeGV','send_message','heartbeat\x20failed:\x20','broadcast','string','\x20parent_task_id=','get_inbox','getReader','connectSSE','error_code','1547YMiVhV','match','reply','error_message','<unknown>','task_id','transport','heartbeatTimer','2gETRnA','resumeId','disconnected','from_alias','new_message','6sDyOaP','catch','token','<missing>','9243820TEWAlF','\x20lifecycle=','call','send_failed','networkId','reconnectDelay','connected','read','report_status','AbortError','286428OAUcDL','\x20network_id=','content','completed','normal','min','[commhub:task]\x20','processInbox','status','text/event-stream','84618Dhgvkh','\x20to=','emit','Authorization','send_rejected','10705310WJWWkM','SSE\x20error:\x20',']\x20[commhub:','tools/call','toTimeString','agent','url','disconnect','sending','/mcp','text','10Hdlbsv','2.0','task.send.delivered','alias','ack_inbox','unknown\x20error','idle','parse','signal','application/json','type','task.expired','392qlTNcF','log','decode','message_id','CommHub\x20rejected\x20task','offline','stringify','split','11740631MvgUTq','error','lifecycleTracking','now','running','1705841WPBxNy','replace','server','message','data:\x20','task.replied','mcp_http','json','send','registered','parentTaskId','connect','SSE\x20reconnecting\x20in\x20','lifecycle_tracking','fromAlias','slice','sseAbort','not_tracked'];a0_0x556a=function(){return _0x3c998f;};return a0_0x556a();}class $ extends a0_0x8f975a{[a0_0x547f64(0xcb)];[a0_0x547f64(0xd3)];[a0_0x547f64(0xaa)];['agent'];[a0_0x547f64(0xa4)];[a0_0x547f64(0x90)];['reconnectDelay'];['heartbeatTimer'];['sseAbort'];[a0_0x547f64(0xe8)]=!0x1;constructor(_0xeb6b5e){const _0x31f68d=a0_0x547f64;super();if(this[_0x31f68d(0xcb)]=_0xeb6b5e[_0x31f68d(0xcb)][_0x31f68d(0xea)](/\/$/,''),this['alias']=_0xeb6b5e[_0x31f68d(0xd3)],this[_0x31f68d(0xaa)]=_0xeb6b5e['token'],this[_0x31f68d(0xca)]=_0xeb6b5e[_0x31f68d(0xca)]||'sdk',this[_0x31f68d(0xa4)]='sdk-'+_0xeb6b5e[_0x31f68d(0xd3)]+'-'+Date[_0x31f68d(0xe7)]()['toString'](0x24),this[_0x31f68d(0x90)]=_0xeb6b5e[_0x31f68d(0x90)]??0x2bf20,this['reconnectDelay']=_0xeb6b5e[_0x31f68d(0xb1)]??0xbb8,_0xeb6b5e['autoConnect']!==!0x1)this['connect']();}[a0_0x547f64(0xdd)](_0x2a972b){const _0x4374d2=a0_0x547f64;console[_0x4374d2(0xdd)]('['+new Date()[_0x4374d2(0xc9)]()[_0x4374d2(0xf8)](0x0,0x8)+_0x4374d2(0xc7)+this['alias']+']\x20'+_0x2a972b);}async[a0_0x547f64(0xae)](_0x4e93a2,_0x52f81b){const _0x1aaecc=a0_0x547f64;let _0x35c37f={'Content-Type':_0x1aaecc(0xd9),'Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x35c37f[_0x1aaecc(0xc3)]=_0x1aaecc(0x88)+this['token'];let _0x3cccc0=await(await fetch(this[_0x1aaecc(0xcb)]+_0x1aaecc(0xce),{'method':_0x1aaecc(0xfc),'headers':_0x35c37f,'body':JSON[_0x1aaecc(0xe2)]({'jsonrpc':_0x1aaecc(0xd1),'id':Date[_0x1aaecc(0xe7)](),'method':_0x1aaecc(0xc8),'params':{'name':_0x4e93a2,'arguments':_0x52f81b}})}))[_0x1aaecc(0xcf)](),_0x291bc5=_0x3cccc0[_0x1aaecc(0x9c)](/data: (.+)/),_0x861c2e=_0x291bc5?JSON['parse'](_0x291bc5[0x1]):JSON[_0x1aaecc(0xd7)](_0x3cccc0),_0x243ff9=_0x861c2e?.[_0x1aaecc(0x8f)]?.[_0x1aaecc(0xb8)]?.[0x0]?.[_0x1aaecc(0xcf)];return _0x243ff9?JSON[_0x1aaecc(0xd7)](_0x243ff9):_0x861c2e;}async[a0_0x547f64(0xf4)](){const _0x5a4e3=a0_0x547f64;if(this[_0x5a4e3(0xe8)])return;this[_0x5a4e3(0xe8)]=!0x0,await this[_0x5a4e3(0xbe)](_0x5a4e3(0xd6)),this[_0x5a4e3(0xdd)](_0x5a4e3(0xf2)),this['heartbeatTimer']=setInterval(()=>{const _0x536b2b=_0x5a4e3;this[_0x536b2b(0xbe)](_0x536b2b(0xd6))[_0x536b2b(0xa9)](_0x2e8ea7=>this[_0x536b2b(0xdd)](_0x536b2b(0x93)+_0x2e8ea7[_0x536b2b(0xec)]));},this[_0x5a4e3(0x90)]),this[_0x5a4e3(0x99)]();}async[a0_0x547f64(0xcc)](){const _0x4c2ab1=a0_0x547f64;if(this[_0x4c2ab1(0xe8)]=!0x1,this['sseAbort']?.[_0x4c2ab1(0x87)](),this[_0x4c2ab1(0xa2)])clearInterval(this['heartbeatTimer']);await this['status'](_0x4c2ab1(0xe1))['catch'](()=>{}),this[_0x4c2ab1(0xdd)](_0x4c2ab1(0xa5));}async[a0_0x547f64(0xf1)](_0x1114d0,_0x91d19e,_0x3b1c4c=a0_0x547f64(0xba)){const _0x2f1ff5=a0_0x547f64;return Y({'alias':_0x1114d0,'fromAlias':this['alias']},{'log':_0x2be9b2=>console[_0x2f1ff5(0xdd)](_0x2be9b2),'send':()=>this[_0x2f1ff5(0xae)]('send_task',{'alias':_0x1114d0,'task':_0x91d19e,'priority':_0x3b1c4c,'from_session':this[_0x2f1ff5(0xd3)]})});}async[a0_0x547f64(0xec)](_0x22f7b3,_0x140444){const _0x3a03be=a0_0x547f64;return this['call'](_0x3a03be(0x92),{'alias':_0x22f7b3,'message':_0x140444,'from_session':this[_0x3a03be(0xd3)]});}async[a0_0x547f64(0x9d)](_0x5125bb,_0xc2bb80,_0x32af82=a0_0x547f64(0xb9)){const _0x18db5f=a0_0x547f64;return this[_0x18db5f(0xae)](_0x18db5f(0x84),{'in_reply_to':_0x5125bb,'text':_0xc2bb80,'status':_0x32af82});}async[a0_0x547f64(0xbe)](_0x3aa24,_0x4ba111){const _0xfaca7d=a0_0x547f64;return this[_0xfaca7d(0xae)](_0xfaca7d(0xb4),{'resume_id':this['resumeId'],'alias':this[_0xfaca7d(0xd3)],'status':_0x3aa24,'server':a0_0x530b89(),'hostname':a0_0x530b89(),'agent':this['agent'],'project_dir':process['cwd'](),..._0x4ba111});}async[a0_0x547f64(0x8b)](){const _0x12efde=a0_0x547f64;return this[_0x12efde(0xae)]('get_all_status',{});}async[a0_0x547f64(0x94)](_0x1d0be6,_0x2e09fb){const _0x5b7deb=a0_0x547f64;return this[_0x5b7deb(0xae)]('broadcast',{'message':_0x1d0be6,'filter_server':_0x2e09fb?.[_0x5b7deb(0xeb)],'filter_status':_0x2e09fb?.[_0x5b7deb(0xbe)]});}async[a0_0x547f64(0x99)](){const _0x1ba4ab=a0_0x547f64;let _0x2af99f=encodeURIComponent(this[_0x1ba4ab(0xd3)]),_0x3909e0=this['url']+_0x1ba4ab(0x85)+_0x2af99f,_0x4665f8=this['reconnectDelay'];while(this['running']){try{this[_0x1ba4ab(0xf9)]=new AbortController();let _0x198c3e={'Accept':_0x1ba4ab(0xbf)};if(this[_0x1ba4ab(0xaa)])_0x198c3e[_0x1ba4ab(0xc3)]=_0x1ba4ab(0x88)+this[_0x1ba4ab(0xaa)];let _0x58bb85=await fetch(_0x3909e0,{'headers':_0x198c3e,'signal':this[_0x1ba4ab(0xf9)][_0x1ba4ab(0xd8)]});if(!_0x58bb85['ok']||!_0x58bb85[_0x1ba4ab(0x8a)]){this[_0x1ba4ab(0xdd)]('SSE\x20failed:\x20'+_0x58bb85[_0x1ba4ab(0xbe)]),await this['sleep'](_0x4665f8),_0x4665f8=Math[_0x1ba4ab(0xbb)](_0x4665f8*1.5,0xea60);continue;}_0x4665f8=this[_0x1ba4ab(0xb1)];let _0x461f32=_0x58bb85['body'][_0x1ba4ab(0x98)](),_0x93663f=new TextDecoder(),_0x1c974d='';while(this[_0x1ba4ab(0xe8)]){let {done:_0x34d5b5,value:_0xb83faa}=await _0x461f32[_0x1ba4ab(0xb3)]();if(_0x34d5b5)break;_0x1c974d+=_0x93663f[_0x1ba4ab(0xde)](_0xb83faa,{'stream':!0x0});let _0x9939c=_0x1c974d[_0x1ba4ab(0xe3)]('\x0a');_0x1c974d=_0x9939c['pop']()||'';for(let _0x5ce91a of _0x9939c){if(!_0x5ce91a['startsWith'](_0x1ba4ab(0xed)))continue;try{let _0x46fac6=JSON['parse'](_0x5ce91a[_0x1ba4ab(0xf8)](0x6));if(_0x46fac6[_0x1ba4ab(0xda)]===_0x1ba4ab(0xb2)){this[_0x1ba4ab(0xdd)]('SSE\x20connected'),this[_0x1ba4ab(0xc2)](_0x1ba4ab(0xb2));continue;}if(_0x46fac6[_0x1ba4ab(0xda)]==='new_task'||_0x46fac6['type']===_0x1ba4ab(0xa7)||_0x46fac6['type']===_0x1ba4ab(0x94))await this[_0x1ba4ab(0xbd)]();}catch{}}}}catch(_0x4ca135){if(_0x4ca135[_0x1ba4ab(0x86)]===_0x1ba4ab(0xb5))break;this[_0x1ba4ab(0xc2)](_0x1ba4ab(0xe5),_0x4ca135),this[_0x1ba4ab(0xdd)](_0x1ba4ab(0xc6)+_0x4ca135[_0x1ba4ab(0xec)]);}if(this[_0x1ba4ab(0xe8)])this[_0x1ba4ab(0xc2)](_0x1ba4ab(0xa5)),this[_0x1ba4ab(0xdd)](_0x1ba4ab(0xf5)+_0x4665f8/0x3e8+'s...'),await this['sleep'](_0x4665f8),_0x4665f8=Math[_0x1ba4ab(0xbb)](_0x4665f8*1.5,0xea60);}}async[a0_0x547f64(0xbd)](){const _0x4f9d5e=a0_0x547f64;try{let _0x1801cc=(await this[_0x4f9d5e(0xae)](_0x4f9d5e(0x97),{'alias':this[_0x4f9d5e(0xd3)],'limit':0xa}))?.['messages']||[];for(let _0x46a119 of _0x1801cc)await this['call'](_0x4f9d5e(0xd4),{'alias':this[_0x4f9d5e(0xd3)],'message_id':_0x46a119['id']}),this[_0x4f9d5e(0xdd)]('←\x20'+_0x46a119['from_session']+':\x20'+_0x46a119[_0x4f9d5e(0xb8)]['slice'](0x0,0x3c)),this[_0x4f9d5e(0xc2)](_0x4f9d5e(0x8e),_0x46a119),this[_0x4f9d5e(0xc2)](_0x4f9d5e(0xec),_0x46a119);}catch(_0x52089e){this['log']('inbox\x20error:\x20'+_0x52089e['message']);}}['sleep'](_0x515749){return new Promise(_0x4eb177=>setTimeout(_0x4eb177,_0x515749));}}var F=$;export{F as default,$ as CommHub};
1
+ const a0_0x566e4c=a0_0x22d8;(function(_0x1c3c53,_0x38c0ba){const _0x23d810=a0_0x22d8,_0x43d618=_0x1c3c53();while(!![]){try{const _0x3e4070=-parseInt(_0x23d810(0x108))/0x1+parseInt(_0x23d810(0x13d))/0x2+-parseInt(_0x23d810(0x135))/0x3*(parseInt(_0x23d810(0x119))/0x4)+-parseInt(_0x23d810(0x178))/0x5*(-parseInt(_0x23d810(0x12f))/0x6)+parseInt(_0x23d810(0x130))/0x7+parseInt(_0x23d810(0x12d))/0x8+parseInt(_0x23d810(0x11e))/0x9*(-parseInt(_0x23d810(0x14e))/0xa);if(_0x3e4070===_0x38c0ba)break;else _0x43d618['push'](_0x43d618['shift']());}catch(_0x51b5e7){_0x43d618['push'](_0x43d618['shift']());}}}(a0_0x1968,0xbb6cc));import{EventEmitter as a0_0x281258}from'events';import{hostname as a0_0x487300}from'os';function a0_0x22d8(_0xea7eef,_0x20f4bd){_0xea7eef=_0xea7eef-0x102;const _0x196856=a0_0x1968();let _0x22d88c=_0x196856[_0xea7eef];return _0x22d88c;}var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x43ff79,_0x5c38b8)=>(_0x43ff79??_0x5c38b8)[a0_0x566e4c(0x132)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x566e4c(0x114)](0x0,0xf0);function N(_0x2502e2){const _0x2c54f6=a0_0x566e4c;return(_0x2502e2 instanceof Error?_0x2502e2[_0x2c54f6(0x11d)]:String(_0x2502e2??_0x2c54f6(0x14d)))[_0x2c54f6(0x132)](K,_0x2c54f6(0x113))[_0x2c54f6(0x132)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x2c54f6(0x114)](0x0,0xf0);}function O(_0x160896,_0x3e5729=process.env.ANET_TASK_TRACE_FORMAT===a0_0x566e4c(0x184)){const _0x4fa5a2=a0_0x566e4c;if(_0x3e5729)return JSON[_0x4fa5a2(0x153)](_0x160896);let _0x2a9c3f=L(_0x160896[_0x4fa5a2(0x17f)],_0x4fa5a2(0x16f)),_0x3abe31=L(_0x160896[_0x4fa5a2(0x185)],'<pending>'),_0x3625df=_0x160896[_0x4fa5a2(0x140)]?_0x4fa5a2(0x165)+_0x160896[_0x4fa5a2(0x140)]+':'+(_0x160896[_0x4fa5a2(0x169)]??''):'';return'[commhub:task]\x20'+_0x160896[_0x4fa5a2(0x148)]+'\x20from='+L(_0x160896['from_alias'],_0x4fa5a2(0x180))+'\x20to='+L(_0x160896[_0x4fa5a2(0x10e)],_0x4fa5a2(0x180))+_0x4fa5a2(0x171)+_0x3abe31+_0x4fa5a2(0x16a)+_0x2a9c3f+_0x4fa5a2(0x174)+L(_0x160896['network_id'],_0x4fa5a2(0x180))+_0x4fa5a2(0x15a)+_0x160896[_0x4fa5a2(0x183)]+_0x4fa5a2(0x18c)+_0x160896[_0x4fa5a2(0x104)]+_0x4fa5a2(0x17c)+_0x160896[_0x4fa5a2(0x187)]+_0x3625df;}function U(_0x35d7ed){const _0x3fc497=a0_0x566e4c;return{'event':{'sending':_0x3fc497(0x10f),'delivered':_0x3fc497(0x151),'failed':_0x3fc497(0x128),'acked':_0x3fc497(0x162),'started':_0x3fc497(0x134),'replied':_0x3fc497(0x11b),'expired':_0x3fc497(0x155)}[_0x35d7ed['status']],..._0x35d7ed};}function j(_0x59c984){const _0xc14c37=a0_0x566e4c;let _0x280017=_0x59c984?.[_0xc14c37(0x185)]||_0x59c984?.['message_id']||_0x59c984?.['id'];if(_0x280017)return String(_0x280017);let _0xce0281=_0x59c984?.[_0xc14c37(0x103)]?.[0x0]?.[_0xc14c37(0x177)];if(typeof _0xce0281!==_0xc14c37(0x102))return null;try{let _0x312dd5=JSON[_0xc14c37(0x133)](_0xce0281);return _0x312dd5?.[_0xc14c37(0x185)]||_0x312dd5?.[_0xc14c37(0x186)]||_0x312dd5?.['id']||null;}catch{return null;}}async function X(_0x2b256,_0xb8a151){const _0x169086=a0_0x566e4c;let _0x16b5a7=_0xb8a151[_0x169086(0x149)]??Date[_0x169086(0x149)],_0x1f5d0d=_0x16b5a7(),_0x26aa8b=(_0x6d588b,_0x1bedfa,_0x501026,_0x43e13f)=>{const _0x1b969c=_0x169086;_0xb8a151[_0x1b969c(0x107)](O(U({'from_alias':_0x2b256[_0x1b969c(0x163)],'to_alias':_0x2b256[_0x1b969c(0x175)],'task_id':_0x1bedfa,'parent_task_id':_0x2b256[_0x1b969c(0x112)],'network_id':_0x2b256['networkId'],'transport':_0x2b256[_0x1b969c(0x183)],'status':_0x6d588b,'duration_ms':_0x16b5a7()-_0x1f5d0d,'lifecycle_tracking':_0x2b256[_0x1b969c(0x118)],..._0x501026!==void 0x0?{'error_code':_0x43e13f||'send_failed','error_message':N(_0x501026)}:{}})));};_0x26aa8b(_0x169086(0x15f),null);try{let _0x46dbb0=await _0xb8a151[_0x169086(0x14f)](),_0x332ffa=j(_0x46dbb0);if(_0x332ffa)_0x26aa8b(_0x169086(0x10c),_0x332ffa);else{if(_0x46dbb0?.['ok']===!0x1||_0x46dbb0?.[_0x169086(0x12b)])_0x26aa8b(_0x169086(0x116),_0x332ffa,_0x46dbb0?.['error']||_0x169086(0x10b),'send_rejected');else _0x26aa8b(_0x169086(0x116),null,_0x169086(0x16e),_0x169086(0x12c));}return _0x46dbb0;}catch(_0x2a767d){throw _0x26aa8b(_0x169086(0x116),null,_0x2a767d,_0x169086(0x13a)),_0x2a767d;}}async function Y(_0x51ea43,_0x48ac51){const _0x4c4266=a0_0x566e4c;return X({'fromAlias':_0x51ea43[_0x4c4266(0x163)],'toAlias':_0x51ea43[_0x4c4266(0x14a)],'parentTaskId':_0x51ea43['parentTaskId']||null,'networkId':_0x51ea43[_0x4c4266(0x15d)]||null,'transport':_0x4c4266(0x17b),'lifecycleTracking':_0x4c4266(0x154)},_0x48ac51);}class $ extends a0_0x281258{[a0_0x566e4c(0x17d)];[a0_0x566e4c(0x14a)];[a0_0x566e4c(0x13b)];[a0_0x566e4c(0x176)];[a0_0x566e4c(0x181)];[a0_0x566e4c(0x106)];[a0_0x566e4c(0x11a)];['heartbeatTimer'];[a0_0x566e4c(0x189)];[a0_0x566e4c(0x13c)]=!0x1;constructor(_0x5602e8){const _0x483722=a0_0x566e4c;super();if(this[_0x483722(0x17d)]=_0x5602e8[_0x483722(0x17d)]['replace'](/\/$/,''),this[_0x483722(0x14a)]=_0x5602e8[_0x483722(0x14a)],this[_0x483722(0x13b)]=_0x5602e8[_0x483722(0x13b)],this[_0x483722(0x176)]=_0x5602e8[_0x483722(0x176)]||_0x483722(0x18a),this[_0x483722(0x181)]='sdk-'+_0x5602e8[_0x483722(0x14a)]+'-'+Date['now']()[_0x483722(0x126)](0x24),this[_0x483722(0x106)]=_0x5602e8[_0x483722(0x106)]??0x2bf20,this[_0x483722(0x11a)]=_0x5602e8[_0x483722(0x11a)]??0xbb8,_0x5602e8[_0x483722(0x12a)]!==!0x1)this[_0x483722(0x127)]();}[a0_0x566e4c(0x107)](_0x227440){const _0x28730d=a0_0x566e4c;console[_0x28730d(0x107)]('['+new Date()[_0x28730d(0x147)]()['slice'](0x0,0x8)+_0x28730d(0x150)+this[_0x28730d(0x14a)]+']\x20'+_0x227440);}async[a0_0x566e4c(0x14c)](_0x1f564e,_0x387f97){const _0x5c50e1=a0_0x566e4c;let _0xc7cdee={'Content-Type':_0x5c50e1(0x143),'Accept':_0x5c50e1(0x13e)};if(this[_0x5c50e1(0x13b)])_0xc7cdee[_0x5c50e1(0x159)]='Bearer\x20'+this[_0x5c50e1(0x13b)];let _0x9606a2=await(await fetch(this[_0x5c50e1(0x17d)]+_0x5c50e1(0x161),{'method':_0x5c50e1(0x157),'headers':_0xc7cdee,'body':JSON[_0x5c50e1(0x153)]({'jsonrpc':_0x5c50e1(0x173),'id':Date[_0x5c50e1(0x149)](),'method':_0x5c50e1(0x166),'params':{'name':_0x1f564e,'arguments':_0x387f97}})}))[_0x5c50e1(0x177)](),_0x2dea5b=_0x9606a2[_0x5c50e1(0x15c)](/data: (.+)/),_0x57cb6a=_0x2dea5b?JSON[_0x5c50e1(0x133)](_0x2dea5b[0x1]):JSON[_0x5c50e1(0x133)](_0x9606a2),_0x5a1408=_0x57cb6a?.[_0x5c50e1(0x182)]?.[_0x5c50e1(0x103)]?.[0x0]?.[_0x5c50e1(0x177)];return _0x5a1408?JSON[_0x5c50e1(0x133)](_0x5a1408):_0x57cb6a;}async[a0_0x566e4c(0x127)](){const _0x2935fa=a0_0x566e4c;if(this[_0x2935fa(0x13c)])return;this[_0x2935fa(0x13c)]=!0x0,await this[_0x2935fa(0x148)](_0x2935fa(0x158)),this['log'](_0x2935fa(0x120)),this[_0x2935fa(0x188)]=setInterval(()=>{const _0x3264cb=_0x2935fa;this[_0x3264cb(0x148)](_0x3264cb(0x158))[_0x3264cb(0x164)](_0x127e4a=>this['log'](_0x3264cb(0x15b)+_0x127e4a[_0x3264cb(0x11d)]));},this[_0x2935fa(0x106)]),this['connectSSE']();}async[a0_0x566e4c(0x138)](){const _0x1cd496=a0_0x566e4c;if(this[_0x1cd496(0x13c)]=!0x1,this[_0x1cd496(0x189)]?.[_0x1cd496(0x117)](),this[_0x1cd496(0x188)])clearInterval(this[_0x1cd496(0x188)]);await this[_0x1cd496(0x148)](_0x1cd496(0x15e))[_0x1cd496(0x164)](()=>{}),this[_0x1cd496(0x107)](_0x1cd496(0x16c));}async['send'](_0x2e38c1,_0x1f6206,_0x49d114=a0_0x566e4c(0x121)){const _0x1a60b8=a0_0x566e4c;return Y({'alias':_0x2e38c1,'fromAlias':this['alias']},{'log':_0x2ffcf6=>console[_0x1a60b8(0x107)](_0x2ffcf6),'send':()=>this[_0x1a60b8(0x14c)](_0x1a60b8(0x109),{'alias':_0x2e38c1,'task':_0x1f6206,'priority':_0x49d114,'from_session':this[_0x1a60b8(0x14a)]})});}async[a0_0x566e4c(0x11d)](_0x3bb6be,_0x5e1feb){const _0x33a9e4=a0_0x566e4c;return this[_0x33a9e4(0x14c)](_0x33a9e4(0x146),{'alias':_0x3bb6be,'message':_0x5e1feb,'from_session':this['alias']});}async[a0_0x566e4c(0x139)](_0x2f2a36,_0x202e80,_0x9e075f=a0_0x566e4c(0x115)){const _0x4a536e=a0_0x566e4c;return this[_0x4a536e(0x14c)](_0x4a536e(0x136),{'in_reply_to':_0x2f2a36,'text':_0x202e80,'status':_0x9e075f});}async[a0_0x566e4c(0x148)](_0x2a4260,_0x18c0cc){const _0x293184=a0_0x566e4c;return this[_0x293184(0x14c)](_0x293184(0x12e),{'resume_id':this[_0x293184(0x181)],'alias':this[_0x293184(0x14a)],'status':_0x2a4260,'server':a0_0x487300(),'hostname':a0_0x487300(),'agent':this[_0x293184(0x176)],'project_dir':process['cwd'](),..._0x18c0cc});}async[a0_0x566e4c(0x17e)](){const _0x185189=a0_0x566e4c;return this[_0x185189(0x14c)]('get_all_status',{});}async[a0_0x566e4c(0x14b)](_0x1c83f6,_0x18b3ac){const _0x4f55dd=a0_0x566e4c;return this[_0x4f55dd(0x14c)](_0x4f55dd(0x14b),{'message':_0x1c83f6,'filter_server':_0x18b3ac?.[_0x4f55dd(0x18d)],'filter_status':_0x18b3ac?.['status']});}async[a0_0x566e4c(0x11c)](){const _0x4bdc6d=a0_0x566e4c;let _0xb40063=encodeURIComponent(this['alias']),_0x5d5fd4=this['url']+_0x4bdc6d(0x122)+_0xb40063,_0x1fe9a1=this[_0x4bdc6d(0x11a)];while(this['running']){try{this[_0x4bdc6d(0x189)]=new AbortController();let _0x3ab9c4={'Accept':_0x4bdc6d(0x16b)};if(this[_0x4bdc6d(0x13b)])_0x3ab9c4[_0x4bdc6d(0x159)]=_0x4bdc6d(0x167)+this[_0x4bdc6d(0x13b)];let _0x58e150=await fetch(_0x5d5fd4,{'headers':_0x3ab9c4,'signal':this['sseAbort']['signal']});if(!_0x58e150['ok']||!_0x58e150[_0x4bdc6d(0x144)]){this[_0x4bdc6d(0x107)](_0x4bdc6d(0x123)+_0x58e150['status']),await this[_0x4bdc6d(0x10a)](_0x1fe9a1),_0x1fe9a1=Math[_0x4bdc6d(0x11f)](_0x1fe9a1*1.5,0xea60);continue;}_0x1fe9a1=this[_0x4bdc6d(0x11a)];let _0x2b8169=_0x58e150['body'][_0x4bdc6d(0x156)](),_0x336aaa=new TextDecoder(),_0x2eef60='';while(this[_0x4bdc6d(0x13c)]){let {done:_0x38f362,value:_0x30bd19}=await _0x2b8169[_0x4bdc6d(0x168)]();if(_0x38f362)break;_0x2eef60+=_0x336aaa[_0x4bdc6d(0x145)](_0x30bd19,{'stream':!0x0});let _0x293711=_0x2eef60['split']('\x0a');_0x2eef60=_0x293711[_0x4bdc6d(0x17a)]()||'';for(let _0xd6bca4 of _0x293711){if(!_0xd6bca4[_0x4bdc6d(0x170)](_0x4bdc6d(0x129)))continue;try{let _0x450eeb=JSON[_0x4bdc6d(0x133)](_0xd6bca4[_0x4bdc6d(0x114)](0x6));if(_0x450eeb['type']===_0x4bdc6d(0x125)){this[_0x4bdc6d(0x107)](_0x4bdc6d(0x179)),this[_0x4bdc6d(0x16d)](_0x4bdc6d(0x125));continue;}if(_0x450eeb[_0x4bdc6d(0x18b)]===_0x4bdc6d(0x110)||_0x450eeb[_0x4bdc6d(0x18b)]===_0x4bdc6d(0x111)||_0x450eeb[_0x4bdc6d(0x18b)]==='broadcast')await this[_0x4bdc6d(0x10d)]();}catch{}}}}catch(_0x41fc10){if(_0x41fc10['name']===_0x4bdc6d(0x142))break;this[_0x4bdc6d(0x16d)](_0x4bdc6d(0x12b),_0x41fc10),this[_0x4bdc6d(0x107)](_0x4bdc6d(0x152)+_0x41fc10[_0x4bdc6d(0x11d)]);}if(this[_0x4bdc6d(0x13c)])this[_0x4bdc6d(0x16d)](_0x4bdc6d(0x16c)),this['log'](_0x4bdc6d(0x13f)+_0x1fe9a1/0x3e8+_0x4bdc6d(0x137)),await this['sleep'](_0x1fe9a1),_0x1fe9a1=Math['min'](_0x1fe9a1*1.5,0xea60);}}async[a0_0x566e4c(0x10d)](){const _0xf1127c=a0_0x566e4c;try{let _0x270745=(await this['call'](_0xf1127c(0x160),{'alias':this[_0xf1127c(0x14a)],'limit':0xa}))?.[_0xf1127c(0x172)]||[];for(let _0x1ea553 of _0x270745)await this[_0xf1127c(0x14c)](_0xf1127c(0x105),{'alias':this[_0xf1127c(0x14a)],'message_id':_0x1ea553['id']}),this[_0xf1127c(0x107)]('←\x20'+_0x1ea553[_0xf1127c(0x124)]+':\x20'+_0x1ea553[_0xf1127c(0x103)][_0xf1127c(0x114)](0x0,0x3c)),this['emit'](_0xf1127c(0x131),_0x1ea553),this[_0xf1127c(0x16d)](_0xf1127c(0x11d),_0x1ea553);}catch(_0x20c304){this[_0xf1127c(0x107)](_0xf1127c(0x141)+_0x20c304['message']);}}[a0_0x566e4c(0x10a)](_0x412e2a){return new Promise(_0x20ce6e=>setTimeout(_0x20ce6e,_0x412e2a));}}function a0_0x1968(){const _0x53867f=['url','getAllStatus','parent_task_id','<unknown>','resumeId','result','transport','json','task_id','message_id','lifecycle_tracking','heartbeatTimer','sseAbort','sdk','type','\x20duration_ms=','server','string','content','duration_ms','ack_inbox','heartbeatInterval','log','262036Halccv','send_task','sleep','CommHub\x20rejected\x20task','delivered','processInbox','to_alias','task.send.start','new_task','new_message','parentTaskId','[REDACTED]','slice','completed','failed','abort','lifecycleTracking','4876724HWxplR','reconnectDelay','task.replied','connectSSE','message','4791015TAtbry','min','registered','normal','/events/','SSE\x20failed:\x20','from_session','connected','toString','connect','task.send.failed','data:\x20','autoConnect','error','missing_task_id','8884528gCsfeL','report_status','101826jfDwIg','2073953blvCDQ','task','replace','parse','task.started','3AWLzRy','send_reply','s...','disconnect','reply','send_failed','token','running','1900248VejHIJ','application/json,\x20text/event-stream','SSE\x20reconnecting\x20in\x20','error_code','inbox\x20error:\x20','AbortError','application/json','body','decode','send_message','toTimeString','status','now','alias','broadcast','call','unknown\x20error','10zTfDnR','send',']\x20[commhub:','task.send.delivered','SSE\x20error:\x20','stringify','not_tracked','task.expired','getReader','POST','idle','Authorization','\x20transport=','heartbeat\x20failed:\x20','match','networkId','offline','sending','get_inbox','/mcp','task.ack','fromAlias','catch','\x20error=','tools/call','Bearer\x20','read','error_message','\x20parent_task_id=','text/event-stream','disconnected','emit','CommHub\x20response\x20omitted\x20task_id','<missing>','startsWith','\x20task_id=','messages','2.0','\x20network_id=','toAlias','agent','text','125DGCxWr','SSE\x20connected','pop','mcp_http','\x20lifecycle='];a0_0x1968=function(){return _0x53867f;};return a0_0x1968();}var F=$;export{F as default,$ as CommHub};