@sleep2agi/agent-network 2.3.0-preview.112 → 2.3.0-preview.113
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_0x2c6390=a0_0x54aa;(function(_0x2e0c12,_0xe55294){const _0x44a09d=a0_0x54aa,_0x48f334=_0x2e0c12();while(!![]){try{const _0x1a86f4=parseInt(_0x44a09d(0x11f))/0x1+parseInt(_0x44a09d(0x121))/0x2*(-parseInt(_0x44a09d(0xbd))/0x3)+-parseInt(_0x44a09d(0x115))/0x4*(parseInt(_0x44a09d(0xef))/0x5)+parseInt(_0x44a09d(0xe4))/0x6+parseInt(_0x44a09d(0x12d))/0x7+-parseInt(_0x44a09d(0xc3))/0x8*(-parseInt(_0x44a09d(0xe0))/0x9)+-parseInt(_0x44a09d(0xf6))/0xa;if(_0x1a86f4===_0xe55294)break;else _0x48f334['push'](_0x48f334['shift']());}catch(_0xbefd82){_0x48f334['push'](_0x48f334['shift']());}}}(a0_0x3da2,0xee530));function a0_0x54aa(_0x2c36ef,_0x2c07cc){_0x2c36ef=_0x2c36ef-0xba;const _0x3da2b5=a0_0x3da2();let _0x54aa02=_0x3da2b5[_0x2c36ef];return _0x54aa02;}import{EventEmitter as a0_0xae0a67}from'events';import{hostname as a0_0x5b0365}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x2a4beb,_0x22043f)=>(_0x2a4beb??_0x22043f)[a0_0x2c6390(0x126)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x2c6390(0xdf)](0x0,0xf0);function N(_0x57474c){const _0x3f5df7=a0_0x2c6390;return(_0x57474c instanceof Error?_0x57474c['message']:String(_0x57474c??_0x3f5df7(0x137)))[_0x3f5df7(0x126)](K,_0x3f5df7(0x130))[_0x3f5df7(0x126)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x3f5df7(0xdf)](0x0,0xf0);}function O(_0x52d5e4,_0x1d26f7=process.env.ANET_TASK_TRACE_FORMAT===a0_0x2c6390(0xc2)){const _0x3efd53=a0_0x2c6390;if(_0x1d26f7)return JSON[_0x3efd53(0x13a)](_0x52d5e4);let _0x1a2960=L(_0x52d5e4['parent_task_id'],_0x3efd53(0xe1)),_0x2ae310=L(_0x52d5e4[_0x3efd53(0xec)],'<pending>'),_0x57f841=_0x52d5e4[_0x3efd53(0xf0)]?_0x3efd53(0x12f)+_0x52d5e4['error_code']+':'+(_0x52d5e4[_0x3efd53(0x103)]??''):'';return _0x3efd53(0x10f)+_0x52d5e4[_0x3efd53(0xf3)]+'\x20from='+L(_0x52d5e4['from_alias'],_0x3efd53(0xd9))+'\x20to='+L(_0x52d5e4[_0x3efd53(0x100)],_0x3efd53(0xd9))+_0x3efd53(0xd4)+_0x2ae310+_0x3efd53(0xed)+_0x1a2960+_0x3efd53(0xea)+L(_0x52d5e4[_0x3efd53(0xcd)],_0x3efd53(0xd9))+_0x3efd53(0xc8)+_0x52d5e4['transport']+_0x3efd53(0xcb)+_0x52d5e4[_0x3efd53(0xbc)]+'\x20lifecycle='+_0x52d5e4['lifecycle_tracking']+_0x57f841;}function U(_0x1ba4d3){const _0x1631de=a0_0x2c6390;return{'event':{'sending':_0x1631de(0x129),'delivered':_0x1631de(0x133),'failed':'task.send.failed','acked':_0x1631de(0xfd),'started':_0x1631de(0xc1),'replied':_0x1631de(0xf1),'expired':_0x1631de(0x135)}[_0x1ba4d3[_0x1631de(0xf3)]],..._0x1ba4d3};}function j(_0x3aab8f){const _0x29551d=a0_0x2c6390;let _0xec6f81=_0x3aab8f?.[_0x29551d(0xec)]||_0x3aab8f?.[_0x29551d(0x134)]||_0x3aab8f?.['id'];if(_0xec6f81)return String(_0xec6f81);let _0x38dcc2=_0x3aab8f?.[_0x29551d(0x108)]?.[0x0]?.[_0x29551d(0x113)];if(typeof _0x38dcc2!==_0x29551d(0xba))return null;try{let _0x4f2739=JSON[_0x29551d(0xdd)](_0x38dcc2);return _0x4f2739?.[_0x29551d(0xec)]||_0x4f2739?.[_0x29551d(0x134)]||_0x4f2739?.['id']||null;}catch{return null;}}function a0_0x3da2(){const _0x11378e=['agent','connected','body','abort','catch','[commhub:task]\x20','heartbeatTimer','ack_inbox','autoConnect','text','processInbox','640jXkdgP','getReader','SSE\x20error:\x20','report_status','task','CommHub\x20response\x20omitted\x20task_id','heartbeatInterval','getAllStatus','from_session','toTimeString','1107224ZqdUwb','networkId','500866ZzADmw','completed','transport','SSE\x20reconnecting\x20in\x20','parentTaskId','replace','Authorization','min','task.send.start','running','token','alias','5740931tqBXRv','heartbeat\x20failed:\x20','\x20error=','[REDACTED]','call','/mcp','task.send.delivered','message_id','task.expired','lifecycleTracking','unknown\x20error','CommHub\x20rejected\x20task','s...','stringify','string','delivered','duration_ms','12zRfWYI','error','sending','new_task','task.started','json','1148408tvJGYB','now','send_task','connect','type','\x20transport=','Bearer\x20','server','\x20duration_ms=','failed','network_id','sdk-','cwd','reconnectDelay','toAlias','idle','inbox\x20error:\x20','\x20task_id=','application/json,\x20text/event-stream','sseAbort','missing_task_id','decode','<unknown>','reply','SSE\x20connected','emit','parse','POST','slice','99FXQsFp','<missing>','log','data:\x20','8501622OLdxuU','new_message','messages','message','result','sleep','\x20network_id=','/events/','task_id','\x20parent_task_id=','fromAlias','23990ojwexk','error_code','task.replied','broadcast','status','connectSSE','disconnected','21777670frcXnW','url','application/json','name','startsWith','SSE\x20failed:\x20','signal','task.ack','split','toString','to_alias','disconnect','resumeId','error_message','match','send_reply','registered','tools/call','content','mcp_http'];a0_0x3da2=function(){return _0x11378e;};return a0_0x3da2();}async function X(_0x54fedf,_0x38349b){const _0x1e51aa=a0_0x2c6390;let _0x5d4125=_0x38349b[_0x1e51aa(0xc4)]??Date[_0x1e51aa(0xc4)],_0x15e997=_0x5d4125(),_0x29288d=(_0x3483d4,_0x26f624,_0x35f4f0,_0x590628)=>{const _0x5285eb=_0x1e51aa;_0x38349b[_0x5285eb(0xe2)](O(U({'from_alias':_0x54fedf['fromAlias'],'to_alias':_0x54fedf[_0x5285eb(0xd1)],'task_id':_0x26f624,'parent_task_id':_0x54fedf[_0x5285eb(0x125)],'network_id':_0x54fedf['networkId'],'transport':_0x54fedf[_0x5285eb(0x123)],'status':_0x3483d4,'duration_ms':_0x5d4125()-_0x15e997,'lifecycle_tracking':_0x54fedf[_0x5285eb(0x136)],..._0x35f4f0!==void 0x0?{'error_code':_0x590628||'send_failed','error_message':N(_0x35f4f0)}:{}})));};_0x29288d(_0x1e51aa(0xbf),null);try{let _0x73ce8d=await _0x38349b['send'](),_0x374e4e=j(_0x73ce8d);if(_0x374e4e)_0x29288d(_0x1e51aa(0xbb),_0x374e4e);else{if(_0x73ce8d?.['ok']===!0x1||_0x73ce8d?.[_0x1e51aa(0xbe)])_0x29288d(_0x1e51aa(0xcc),_0x374e4e,_0x73ce8d?.[_0x1e51aa(0xbe)]||_0x1e51aa(0x138),'send_rejected');else _0x29288d(_0x1e51aa(0xcc),null,_0x1e51aa(0x11a),_0x1e51aa(0xd7));}return _0x73ce8d;}catch(_0x4d84a5){throw _0x29288d(_0x1e51aa(0xcc),null,_0x4d84a5,'send_failed'),_0x4d84a5;}}async function Y(_0x45311a,_0xd17807){const _0x4a1675=a0_0x2c6390;return X({'fromAlias':_0x45311a[_0x4a1675(0xee)],'toAlias':_0x45311a['alias'],'parentTaskId':_0x45311a['parentTaskId']||null,'networkId':_0x45311a[_0x4a1675(0x120)]||null,'transport':_0x4a1675(0x109),'lifecycleTracking':'not_tracked'},_0xd17807);}class $ extends a0_0xae0a67{['url'];[a0_0x2c6390(0x12c)];[a0_0x2c6390(0x12b)];[a0_0x2c6390(0x10a)];[a0_0x2c6390(0x102)];[a0_0x2c6390(0x11b)];[a0_0x2c6390(0xd0)];[a0_0x2c6390(0x110)];[a0_0x2c6390(0xd6)];['running']=!0x1;constructor(_0x74e88f){const _0x26c287=a0_0x2c6390;super();if(this[_0x26c287(0xf7)]=_0x74e88f['url'][_0x26c287(0x126)](/\/$/,''),this['alias']=_0x74e88f[_0x26c287(0x12c)],this['token']=_0x74e88f[_0x26c287(0x12b)],this[_0x26c287(0x10a)]=_0x74e88f[_0x26c287(0x10a)]||'sdk',this[_0x26c287(0x102)]=_0x26c287(0xce)+_0x74e88f[_0x26c287(0x12c)]+'-'+Date['now']()[_0x26c287(0xff)](0x24),this[_0x26c287(0x11b)]=_0x74e88f['heartbeatInterval']??0x2bf20,this[_0x26c287(0xd0)]=_0x74e88f[_0x26c287(0xd0)]??0xbb8,_0x74e88f[_0x26c287(0x112)]!==!0x1)this[_0x26c287(0xc6)]();}['log'](_0x90ca08){const _0x51c70d=a0_0x2c6390;console['log']('['+new Date()[_0x51c70d(0x11e)]()[_0x51c70d(0xdf)](0x0,0x8)+']\x20[commhub:'+this[_0x51c70d(0x12c)]+']\x20'+_0x90ca08);}async[a0_0x2c6390(0x131)](_0x3bedae,_0x364aa0){const _0x109010=a0_0x2c6390;let _0xfc4924={'Content-Type':_0x109010(0xf8),'Accept':_0x109010(0xd5)};if(this[_0x109010(0x12b)])_0xfc4924[_0x109010(0x127)]=_0x109010(0xc9)+this[_0x109010(0x12b)];let _0x425e18=await(await fetch(this[_0x109010(0xf7)]+_0x109010(0x132),{'method':_0x109010(0xde),'headers':_0xfc4924,'body':JSON[_0x109010(0x13a)]({'jsonrpc':'2.0','id':Date[_0x109010(0xc4)](),'method':_0x109010(0x107),'params':{'name':_0x3bedae,'arguments':_0x364aa0}})}))[_0x109010(0x113)](),_0x1adc5c=_0x425e18[_0x109010(0x104)](/data: (.+)/),_0x3fd96e=_0x1adc5c?JSON[_0x109010(0xdd)](_0x1adc5c[0x1]):JSON[_0x109010(0xdd)](_0x425e18),_0x17bf6c=_0x3fd96e?.[_0x109010(0xe8)]?.[_0x109010(0x108)]?.[0x0]?.[_0x109010(0x113)];return _0x17bf6c?JSON[_0x109010(0xdd)](_0x17bf6c):_0x3fd96e;}async['connect'](){const _0x1c33a5=a0_0x2c6390;if(this['running'])return;this[_0x1c33a5(0x12a)]=!0x0,await this[_0x1c33a5(0xf3)]('idle'),this['log'](_0x1c33a5(0x106)),this[_0x1c33a5(0x110)]=setInterval(()=>{const _0x10cf80=_0x1c33a5;this[_0x10cf80(0xf3)](_0x10cf80(0xd2))[_0x10cf80(0x10e)](_0x207bfd=>this[_0x10cf80(0xe2)](_0x10cf80(0x12e)+_0x207bfd['message']));},this[_0x1c33a5(0x11b)]),this[_0x1c33a5(0xf4)]();}async[a0_0x2c6390(0x101)](){const _0x1280b7=a0_0x2c6390;if(this[_0x1280b7(0x12a)]=!0x1,this['sseAbort']?.[_0x1280b7(0x10d)](),this[_0x1280b7(0x110)])clearInterval(this['heartbeatTimer']);await this[_0x1280b7(0xf3)]('offline')[_0x1280b7(0x10e)](()=>{}),this[_0x1280b7(0xe2)]('disconnected');}async['send'](_0x412f4e,_0x478e09,_0x1b07a9='normal'){const _0x27f946=a0_0x2c6390;return Y({'alias':_0x412f4e,'fromAlias':this[_0x27f946(0x12c)]},{'log':_0x23d0f0=>console['log'](_0x23d0f0),'send':()=>this[_0x27f946(0x131)](_0x27f946(0xc5),{'alias':_0x412f4e,'task':_0x478e09,'priority':_0x1b07a9,'from_session':this[_0x27f946(0x12c)]})});}async[a0_0x2c6390(0xe7)](_0x16cceb,_0x1fabba){const _0x322d19=a0_0x2c6390;return this[_0x322d19(0x131)]('send_message',{'alias':_0x16cceb,'message':_0x1fabba,'from_session':this[_0x322d19(0x12c)]});}async[a0_0x2c6390(0xda)](_0x22102a,_0x4d7441,_0xdc4803=a0_0x2c6390(0x122)){const _0x236a22=a0_0x2c6390;return this[_0x236a22(0x131)](_0x236a22(0x105),{'in_reply_to':_0x22102a,'text':_0x4d7441,'status':_0xdc4803});}async['status'](_0x3251f7,_0x2b72b8){const _0x2f3937=a0_0x2c6390;return this['call'](_0x2f3937(0x118),{'resume_id':this[_0x2f3937(0x102)],'alias':this['alias'],'status':_0x3251f7,'server':a0_0x5b0365(),'hostname':a0_0x5b0365(),'agent':this[_0x2f3937(0x10a)],'project_dir':process[_0x2f3937(0xcf)](),..._0x2b72b8});}async[a0_0x2c6390(0x11c)](){return this['call']('get_all_status',{});}async[a0_0x2c6390(0xf2)](_0x58eab5,_0x569b95){const _0x52957d=a0_0x2c6390;return this[_0x52957d(0x131)](_0x52957d(0xf2),{'message':_0x58eab5,'filter_server':_0x569b95?.[_0x52957d(0xca)],'filter_status':_0x569b95?.['status']});}async[a0_0x2c6390(0xf4)](){const _0x2d4c31=a0_0x2c6390;let _0x5b9fbd=encodeURIComponent(this[_0x2d4c31(0x12c)]),_0x546add=this[_0x2d4c31(0xf7)]+_0x2d4c31(0xeb)+_0x5b9fbd,_0x5499d3=this[_0x2d4c31(0xd0)];while(this[_0x2d4c31(0x12a)]){try{this[_0x2d4c31(0xd6)]=new AbortController();let _0x4cd146={'Accept':'text/event-stream'};if(this['token'])_0x4cd146[_0x2d4c31(0x127)]=_0x2d4c31(0xc9)+this['token'];let _0x1b9cf8=await fetch(_0x546add,{'headers':_0x4cd146,'signal':this[_0x2d4c31(0xd6)][_0x2d4c31(0xfc)]});if(!_0x1b9cf8['ok']||!_0x1b9cf8['body']){this[_0x2d4c31(0xe2)](_0x2d4c31(0xfb)+_0x1b9cf8[_0x2d4c31(0xf3)]),await this[_0x2d4c31(0xe9)](_0x5499d3),_0x5499d3=Math[_0x2d4c31(0x128)](_0x5499d3*1.5,0xea60);continue;}_0x5499d3=this[_0x2d4c31(0xd0)];let _0x137eba=_0x1b9cf8[_0x2d4c31(0x10c)][_0x2d4c31(0x116)](),_0xd7c54c=new TextDecoder(),_0x27bbfd='';while(this[_0x2d4c31(0x12a)]){let {done:_0x3a8b6d,value:_0x4f8eb9}=await _0x137eba['read']();if(_0x3a8b6d)break;_0x27bbfd+=_0xd7c54c[_0x2d4c31(0xd8)](_0x4f8eb9,{'stream':!0x0});let _0x57ad78=_0x27bbfd[_0x2d4c31(0xfe)]('\x0a');_0x27bbfd=_0x57ad78['pop']()||'';for(let _0x17711e of _0x57ad78){if(!_0x17711e[_0x2d4c31(0xfa)](_0x2d4c31(0xe3)))continue;try{let _0xad1eca=JSON['parse'](_0x17711e[_0x2d4c31(0xdf)](0x6));if(_0xad1eca[_0x2d4c31(0xc7)]===_0x2d4c31(0x10b)){this[_0x2d4c31(0xe2)](_0x2d4c31(0xdb)),this[_0x2d4c31(0xdc)]('connected');continue;}if(_0xad1eca[_0x2d4c31(0xc7)]===_0x2d4c31(0xc0)||_0xad1eca[_0x2d4c31(0xc7)]===_0x2d4c31(0xe5)||_0xad1eca['type']==='broadcast')await this[_0x2d4c31(0x114)]();}catch{}}}}catch(_0x301a10){if(_0x301a10[_0x2d4c31(0xf9)]==='AbortError')break;this[_0x2d4c31(0xdc)](_0x2d4c31(0xbe),_0x301a10),this[_0x2d4c31(0xe2)](_0x2d4c31(0x117)+_0x301a10[_0x2d4c31(0xe7)]);}if(this['running'])this[_0x2d4c31(0xdc)](_0x2d4c31(0xf5)),this['log'](_0x2d4c31(0x124)+_0x5499d3/0x3e8+_0x2d4c31(0x139)),await this['sleep'](_0x5499d3),_0x5499d3=Math['min'](_0x5499d3*1.5,0xea60);}}async[a0_0x2c6390(0x114)](){const _0x169ea6=a0_0x2c6390;try{let _0x241706=(await this['call']('get_inbox',{'alias':this['alias'],'limit':0xa}))?.[_0x169ea6(0xe6)]||[];for(let _0xbaf486 of _0x241706)await this[_0x169ea6(0x131)](_0x169ea6(0x111),{'alias':this[_0x169ea6(0x12c)],'message_id':_0xbaf486['id']}),this[_0x169ea6(0xe2)]('←\x20'+_0xbaf486[_0x169ea6(0x11d)]+':\x20'+_0xbaf486[_0x169ea6(0x108)][_0x169ea6(0xdf)](0x0,0x3c)),this[_0x169ea6(0xdc)](_0x169ea6(0x119),_0xbaf486),this[_0x169ea6(0xdc)](_0x169ea6(0xe7),_0xbaf486);}catch(_0x16f8f4){this['log'](_0x169ea6(0xd3)+_0x16f8f4['message']);}}[a0_0x2c6390(0xe9)](_0x52f705){return new Promise(_0x59b510=>setTimeout(_0x59b510,_0x52f705));}}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x239bda=a0_0x16e4;(function(_0x45c6fd,_0x5aa123){const _0x8b3aa8=a0_0x16e4,_0x12265c=_0x45c6fd();while(!![]){try{const _0x1a5e97=-parseInt(_0x8b3aa8(0x13c))/0x1*(parseInt(_0x8b3aa8(0x115))/0x2)+-parseInt(_0x8b3aa8(0x171))/0x3*(-parseInt(_0x8b3aa8(0x111))/0x4)+-parseInt(_0x8b3aa8(0x145))/0x5+-parseInt(_0x8b3aa8(0x112))/0x6+parseInt(_0x8b3aa8(0x146))/0x7*(parseInt(_0x8b3aa8(0x119))/0x8)+parseInt(_0x8b3aa8(0x15b))/0x9+parseInt(_0x8b3aa8(0x149))/0xa*(parseInt(_0x8b3aa8(0x137))/0xb);if(_0x1a5e97===_0x5aa123)break;else _0x12265c['push'](_0x12265c['shift']());}catch(_0x3ab8c0){_0x12265c['push'](_0x12265c['shift']());}}}(a0_0x3052,0x326e6));import{EventEmitter as a0_0x7b4736}from'events';import{hostname as a0_0x4ef828}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x3de8ff,_0x5435f2)=>(_0x3de8ff??_0x5435f2)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x239bda(0xfc)](0x0,0xf0);function a0_0x3052(){const _0x45df98=['url','/events/','cwd','read','token','CommHub\x20rejected\x20task','idle','ack_inbox','sleep','getReader','message_id','POST','call','55048MTOSeJ','1172124VHWnKp','networkId','task.send.start','94mYDFOZ','task','<missing>','heartbeatInterval','1567344vQVZMu','to_alias','task.send.failed','error_code','data:\x20','toTimeString','application/json','message','from_alias','server','connect','SSE\x20error:\x20','result','new_task','completed','offline','<pending>','text/event-stream','2.0','inbox\x20error:\x20','reply',']\x20[commhub:','\x20duration_ms=','log','processInbox','json','get_all_status','Authorization','status','heartbeat\x20failed:\x20','197285DkKdqP','getAllStatus','task_id','parentTaskId','sending','7085KBqfYz','lifecycle_tracking','reconnectDelay','report_status','toString','\x20lifecycle=','min','get_inbox','registered','484165wfOVMS','7DTXgzj','send','now','90tYoVRP','\x20transport=','parent_task_id','\x20task_id=','send_message','match','SSE\x20connected','name','network_id','stringify','alias','task.started','<unknown>','connected','type','fromAlias','\x20network_id=','heartbeatTimer','677853iSefrj','emit','resumeId','send_reply','[commhub:task]\x20','missing_task_id','disconnected','send_task','CommHub\x20response\x20omitted\x20task_id','sseAbort','failed','agent','text','broadcast','parse','transport','send_failed','connectSSE','string','delivered','catch','sdk-','87SJDmOZ','task.ack','task.expired','signal','autoConnect','normal','body','unknown\x20error','SSE\x20failed:\x20','lifecycleTracking','pop','running','SSE\x20reconnecting\x20in\x20','replace','error','split','slice','send_rejected','\x20parent_task_id=','startsWith','/mcp','not_tracked','AbortError','content'];a0_0x3052=function(){return _0x45df98;};return a0_0x3052();}function N(_0x3d0162){const _0xde428=a0_0x239bda;return(_0x3d0162 instanceof Error?_0x3d0162[_0xde428(0x120)]:String(_0x3d0162??_0xde428(0x178)))[_0xde428(0x17e)](K,'[REDACTED]')['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0xde428(0xfc)](0x0,0xf0);}function O(_0x4e2dfd,_0x90493c=process.env.ANET_TASK_TRACE_FORMAT===a0_0x239bda(0x132)){const _0x2a0e38=a0_0x239bda;if(_0x90493c)return JSON[_0x2a0e38(0x152)](_0x4e2dfd);let _0x2c0efa=L(_0x4e2dfd[_0x2a0e38(0x14b)],_0x2a0e38(0x117)),_0x55734c=L(_0x4e2dfd[_0x2a0e38(0x139)],_0x2a0e38(0x129)),_0x4a0c84=_0x4e2dfd[_0x2a0e38(0x11c)]?'\x20error='+_0x4e2dfd['error_code']+':'+(_0x4e2dfd['error_message']??''):'';return _0x2a0e38(0x15f)+_0x4e2dfd[_0x2a0e38(0x135)]+'\x20from='+L(_0x4e2dfd[_0x2a0e38(0x121)],'<unknown>')+'\x20to='+L(_0x4e2dfd[_0x2a0e38(0x11a)],_0x2a0e38(0x155))+_0x2a0e38(0x14c)+_0x55734c+_0x2a0e38(0xfe)+_0x2c0efa+_0x2a0e38(0x159)+L(_0x4e2dfd[_0x2a0e38(0x151)],_0x2a0e38(0x155))+_0x2a0e38(0x14a)+_0x4e2dfd[_0x2a0e38(0x16a)]+_0x2a0e38(0x12f)+_0x4e2dfd['duration_ms']+_0x2a0e38(0x141)+_0x4e2dfd[_0x2a0e38(0x13d)]+_0x4a0c84;}function U(_0x466689){const _0x48eb34=a0_0x239bda;return{'event':{'sending':_0x48eb34(0x114),'delivered':'task.send.delivered','failed':_0x48eb34(0x11b),'acked':_0x48eb34(0x172),'started':_0x48eb34(0x154),'replied':'task.replied','expired':_0x48eb34(0x173)}[_0x466689[_0x48eb34(0x135)]],..._0x466689};}function j(_0x4ab035){const _0x199902=a0_0x239bda;let _0x20c4a8=_0x4ab035?.['task_id']||_0x4ab035?.[_0x199902(0x10e)]||_0x4ab035?.['id'];if(_0x20c4a8)return String(_0x20c4a8);let _0x38a3c9=_0x4ab035?.[_0x199902(0x103)]?.[0x0]?.[_0x199902(0x167)];if(typeof _0x38a3c9!==_0x199902(0x16d))return null;try{let _0x4f69b5=JSON[_0x199902(0x169)](_0x38a3c9);return _0x4f69b5?.['task_id']||_0x4f69b5?.['message_id']||_0x4f69b5?.['id']||null;}catch{return null;}}async function X(_0x8d53c7,_0x5a1e5e){const _0xee2fd5=a0_0x239bda;let _0x32f459=_0x5a1e5e['now']??Date[_0xee2fd5(0x148)],_0x25f692=_0x32f459(),_0x497563=(_0x55bf1c,_0x41dc1e,_0x440ab2,_0x1127bc)=>{const _0x516b04=_0xee2fd5;_0x5a1e5e[_0x516b04(0x130)](O(U({'from_alias':_0x8d53c7[_0x516b04(0x158)],'to_alias':_0x8d53c7['toAlias'],'task_id':_0x41dc1e,'parent_task_id':_0x8d53c7['parentTaskId'],'network_id':_0x8d53c7[_0x516b04(0x113)],'transport':_0x8d53c7[_0x516b04(0x16a)],'status':_0x55bf1c,'duration_ms':_0x32f459()-_0x25f692,'lifecycle_tracking':_0x8d53c7[_0x516b04(0x17a)],..._0x440ab2!==void 0x0?{'error_code':_0x1127bc||_0x516b04(0x16b),'error_message':N(_0x440ab2)}:{}})));};_0x497563(_0xee2fd5(0x13b),null);try{let _0x463e57=await _0x5a1e5e[_0xee2fd5(0x147)](),_0x1d8625=j(_0x463e57);if(_0x1d8625)_0x497563(_0xee2fd5(0x16e),_0x1d8625);else{if(_0x463e57?.['ok']===!0x1||_0x463e57?.[_0xee2fd5(0x17f)])_0x497563(_0xee2fd5(0x165),_0x1d8625,_0x463e57?.[_0xee2fd5(0x17f)]||_0xee2fd5(0x109),_0xee2fd5(0xfd));else _0x497563(_0xee2fd5(0x165),null,_0xee2fd5(0x163),_0xee2fd5(0x160));}return _0x463e57;}catch(_0x2d3d54){throw _0x497563('failed',null,_0x2d3d54,'send_failed'),_0x2d3d54;}}async function Y(_0x73558e,_0x4d6e81){const _0x41bb59=a0_0x239bda;return X({'fromAlias':_0x73558e[_0x41bb59(0x158)],'toAlias':_0x73558e[_0x41bb59(0x153)],'parentTaskId':_0x73558e[_0x41bb59(0x13a)]||null,'networkId':_0x73558e[_0x41bb59(0x113)]||null,'transport':'mcp_http','lifecycleTracking':_0x41bb59(0x101)},_0x4d6e81);}class $ extends a0_0x7b4736{['url'];[a0_0x239bda(0x153)];['token'];[a0_0x239bda(0x166)];[a0_0x239bda(0x15d)];['heartbeatInterval'];[a0_0x239bda(0x13e)];[a0_0x239bda(0x15a)];[a0_0x239bda(0x164)];[a0_0x239bda(0x17c)]=!0x1;constructor(_0x223920){const _0x1a6d58=a0_0x239bda;super();if(this[_0x1a6d58(0x104)]=_0x223920[_0x1a6d58(0x104)][_0x1a6d58(0x17e)](/\/$/,''),this['alias']=_0x223920[_0x1a6d58(0x153)],this[_0x1a6d58(0x108)]=_0x223920[_0x1a6d58(0x108)],this[_0x1a6d58(0x166)]=_0x223920[_0x1a6d58(0x166)]||'sdk',this['resumeId']=_0x1a6d58(0x170)+_0x223920[_0x1a6d58(0x153)]+'-'+Date[_0x1a6d58(0x148)]()[_0x1a6d58(0x140)](0x24),this[_0x1a6d58(0x118)]=_0x223920['heartbeatInterval']??0x2bf20,this[_0x1a6d58(0x13e)]=_0x223920[_0x1a6d58(0x13e)]??0xbb8,_0x223920[_0x1a6d58(0x175)]!==!0x1)this[_0x1a6d58(0x123)]();}['log'](_0x447ae9){const _0x3bbdc0=a0_0x239bda;console[_0x3bbdc0(0x130)]('['+new Date()[_0x3bbdc0(0x11e)]()[_0x3bbdc0(0xfc)](0x0,0x8)+_0x3bbdc0(0x12e)+this[_0x3bbdc0(0x153)]+']\x20'+_0x447ae9);}async[a0_0x239bda(0x110)](_0x13fba5,_0x5bda6e){const _0x54738f=a0_0x239bda;let _0x49943c={'Content-Type':_0x54738f(0x11f),'Accept':'application/json,\x20text/event-stream'};if(this[_0x54738f(0x108)])_0x49943c[_0x54738f(0x134)]='Bearer\x20'+this[_0x54738f(0x108)];let _0x578b04=await(await fetch(this['url']+_0x54738f(0x100),{'method':_0x54738f(0x10f),'headers':_0x49943c,'body':JSON[_0x54738f(0x152)]({'jsonrpc':_0x54738f(0x12b),'id':Date[_0x54738f(0x148)](),'method':'tools/call','params':{'name':_0x13fba5,'arguments':_0x5bda6e}})}))[_0x54738f(0x167)](),_0x36347d=_0x578b04[_0x54738f(0x14e)](/data: (.+)/),_0x51cd49=_0x36347d?JSON[_0x54738f(0x169)](_0x36347d[0x1]):JSON[_0x54738f(0x169)](_0x578b04),_0x1dff0c=_0x51cd49?.[_0x54738f(0x125)]?.[_0x54738f(0x103)]?.[0x0]?.[_0x54738f(0x167)];return _0x1dff0c?JSON[_0x54738f(0x169)](_0x1dff0c):_0x51cd49;}async[a0_0x239bda(0x123)](){const _0x38faf6=a0_0x239bda;if(this[_0x38faf6(0x17c)])return;this['running']=!0x0,await this[_0x38faf6(0x135)](_0x38faf6(0x10a)),this[_0x38faf6(0x130)](_0x38faf6(0x144)),this[_0x38faf6(0x15a)]=setInterval(()=>{const _0x4c3ce0=_0x38faf6;this[_0x4c3ce0(0x135)](_0x4c3ce0(0x10a))[_0x4c3ce0(0x16f)](_0x2b989f=>this[_0x4c3ce0(0x130)](_0x4c3ce0(0x136)+_0x2b989f[_0x4c3ce0(0x120)]));},this[_0x38faf6(0x118)]),this['connectSSE']();}async['disconnect'](){const _0x3715e3=a0_0x239bda;if(this[_0x3715e3(0x17c)]=!0x1,this[_0x3715e3(0x164)]?.['abort'](),this[_0x3715e3(0x15a)])clearInterval(this[_0x3715e3(0x15a)]);await this[_0x3715e3(0x135)](_0x3715e3(0x128))[_0x3715e3(0x16f)](()=>{}),this[_0x3715e3(0x130)](_0x3715e3(0x161));}async[a0_0x239bda(0x147)](_0x3d5acc,_0x23a51f,_0x5e4f88=a0_0x239bda(0x176)){const _0x20e89e=a0_0x239bda;return Y({'alias':_0x3d5acc,'fromAlias':this['alias']},{'log':_0x5f16bd=>console[_0x20e89e(0x130)](_0x5f16bd),'send':()=>this['call'](_0x20e89e(0x162),{'alias':_0x3d5acc,'task':_0x23a51f,'priority':_0x5e4f88,'from_session':this[_0x20e89e(0x153)]})});}async['message'](_0x1c678c,_0x5e0eb3){const _0x205075=a0_0x239bda;return this[_0x205075(0x110)](_0x205075(0x14d),{'alias':_0x1c678c,'message':_0x5e0eb3,'from_session':this['alias']});}async[a0_0x239bda(0x12d)](_0x25364d,_0x76b36b,_0x2bc4bd=a0_0x239bda(0x127)){const _0x1dfc3b=a0_0x239bda;return this[_0x1dfc3b(0x110)](_0x1dfc3b(0x15e),{'in_reply_to':_0x25364d,'text':_0x76b36b,'status':_0x2bc4bd});}async[a0_0x239bda(0x135)](_0x16dfd0,_0x436ca4){const _0x5e7fec=a0_0x239bda;return this[_0x5e7fec(0x110)](_0x5e7fec(0x13f),{'resume_id':this[_0x5e7fec(0x15d)],'alias':this[_0x5e7fec(0x153)],'status':_0x16dfd0,'server':a0_0x4ef828(),'hostname':a0_0x4ef828(),'agent':this[_0x5e7fec(0x166)],'project_dir':process[_0x5e7fec(0x106)](),..._0x436ca4});}async[a0_0x239bda(0x138)](){const _0x1d3671=a0_0x239bda;return this[_0x1d3671(0x110)](_0x1d3671(0x133),{});}async[a0_0x239bda(0x168)](_0x277b4a,_0x1e9600){const _0x18a234=a0_0x239bda;return this['call'](_0x18a234(0x168),{'message':_0x277b4a,'filter_server':_0x1e9600?.[_0x18a234(0x122)],'filter_status':_0x1e9600?.[_0x18a234(0x135)]});}async[a0_0x239bda(0x16c)](){const _0x56535c=a0_0x239bda;let _0x5baa9a=encodeURIComponent(this['alias']),_0x304f98=this[_0x56535c(0x104)]+_0x56535c(0x105)+_0x5baa9a,_0x1c044a=this[_0x56535c(0x13e)];while(this['running']){try{this[_0x56535c(0x164)]=new AbortController();let _0x14c5c9={'Accept':_0x56535c(0x12a)};if(this[_0x56535c(0x108)])_0x14c5c9['Authorization']='Bearer\x20'+this[_0x56535c(0x108)];let _0x28100c=await fetch(_0x304f98,{'headers':_0x14c5c9,'signal':this['sseAbort'][_0x56535c(0x174)]});if(!_0x28100c['ok']||!_0x28100c[_0x56535c(0x177)]){this[_0x56535c(0x130)](_0x56535c(0x179)+_0x28100c[_0x56535c(0x135)]),await this[_0x56535c(0x10c)](_0x1c044a),_0x1c044a=Math['min'](_0x1c044a*1.5,0xea60);continue;}_0x1c044a=this['reconnectDelay'];let _0x632a20=_0x28100c[_0x56535c(0x177)][_0x56535c(0x10d)](),_0x466b0d=new TextDecoder(),_0x360686='';while(this[_0x56535c(0x17c)]){let {done:_0x35ba17,value:_0x34f668}=await _0x632a20[_0x56535c(0x107)]();if(_0x35ba17)break;_0x360686+=_0x466b0d['decode'](_0x34f668,{'stream':!0x0});let _0x3a0874=_0x360686[_0x56535c(0xfb)]('\x0a');_0x360686=_0x3a0874[_0x56535c(0x17b)]()||'';for(let _0x4b5d49 of _0x3a0874){if(!_0x4b5d49[_0x56535c(0xff)](_0x56535c(0x11d)))continue;try{let _0x257ac4=JSON[_0x56535c(0x169)](_0x4b5d49[_0x56535c(0xfc)](0x6));if(_0x257ac4[_0x56535c(0x157)]===_0x56535c(0x156)){this[_0x56535c(0x130)](_0x56535c(0x14f)),this['emit'](_0x56535c(0x156));continue;}if(_0x257ac4[_0x56535c(0x157)]===_0x56535c(0x126)||_0x257ac4[_0x56535c(0x157)]==='new_message'||_0x257ac4['type']===_0x56535c(0x168))await this[_0x56535c(0x131)]();}catch{}}}}catch(_0x407b6c){if(_0x407b6c[_0x56535c(0x150)]===_0x56535c(0x102))break;this[_0x56535c(0x15c)]('error',_0x407b6c),this['log'](_0x56535c(0x124)+_0x407b6c[_0x56535c(0x120)]);}if(this[_0x56535c(0x17c)])this[_0x56535c(0x15c)](_0x56535c(0x161)),this[_0x56535c(0x130)](_0x56535c(0x17d)+_0x1c044a/0x3e8+'s...'),await this[_0x56535c(0x10c)](_0x1c044a),_0x1c044a=Math[_0x56535c(0x142)](_0x1c044a*1.5,0xea60);}}async[a0_0x239bda(0x131)](){const _0x1f869e=a0_0x239bda;try{let _0x3193ee=(await this['call'](_0x1f869e(0x143),{'alias':this['alias'],'limit':0xa}))?.['messages']||[];for(let _0x958ebb of _0x3193ee)await this[_0x1f869e(0x110)](_0x1f869e(0x10b),{'alias':this[_0x1f869e(0x153)],'message_id':_0x958ebb['id']}),this['log']('←\x20'+_0x958ebb['from_session']+':\x20'+_0x958ebb['content'][_0x1f869e(0xfc)](0x0,0x3c)),this[_0x1f869e(0x15c)](_0x1f869e(0x116),_0x958ebb),this[_0x1f869e(0x15c)](_0x1f869e(0x120),_0x958ebb);}catch(_0x3abfaa){this[_0x1f869e(0x130)](_0x1f869e(0x12c)+_0x3abfaa['message']);}}[a0_0x239bda(0x10c)](_0xd7daf1){return new Promise(_0x585ecc=>setTimeout(_0x585ecc,_0xd7daf1));}}function a0_0x16e4(_0x53abbe,_0x1d176d){_0x53abbe=_0x53abbe-0xfb;const _0x30522e=a0_0x3052();let _0x16e416=_0x30522e[_0x53abbe];return _0x16e416;}var F=$;export{F as default,$ as CommHub};
|