@sleep2agi/agent-network 2.3.0-preview.56 → 2.3.0-preview.58
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_0x3f65d7=a0_0x1cd6;(function(_0xe9cf55,_0x3a793d){const _0xc0a76d=a0_0x1cd6,_0xace6a8=_0xe9cf55();while(!![]){try{const _0x389d4a=parseInt(_0xc0a76d(0x1ce))/0x1*(-parseInt(_0xc0a76d(0x1cf))/0x2)+-parseInt(_0xc0a76d(0x1a8))/0x3+-parseInt(_0xc0a76d(0x19d))/0x4+-parseInt(_0xc0a76d(0x186))/0x5+parseInt(_0xc0a76d(0x1f9))/0x6*(-parseInt(_0xc0a76d(0x184))/0x7)+parseInt(_0xc0a76d(0x1cd))/0x8*(-parseInt(_0xc0a76d(0x1d8))/0x9)+parseInt(_0xc0a76d(0x19f))/0xa;if(_0x389d4a===_0x3a793d)break;else _0xace6a8['push'](_0xace6a8['shift']());}catch(_0x136866){_0xace6a8['push'](_0xace6a8['shift']());}}}(a0_0x4a19,0x7d246));import{EventEmitter as a0_0x230289}from'events';function a0_0x1cd6(_0x5a6bb8,_0x377bae){_0x5a6bb8=_0x5a6bb8-0x184;const _0x4a198b=a0_0x4a19();let _0x1cd653=_0x4a198b[_0x5a6bb8];return _0x1cd653;}import{hostname as a0_0x4e0bfc}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x730d07,_0x308f3e)=>(_0x730d07??_0x308f3e)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x3f65d7(0x1a1)](0x0,0xf0);function N(_0x3dd80b){const _0x5d0563=a0_0x3f65d7;return(_0x3dd80b instanceof Error?_0x3dd80b['message']:String(_0x3dd80b??'unknown\x20error'))[_0x5d0563(0x1f4)](K,_0x5d0563(0x1cc))[_0x5d0563(0x1f4)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x5d0563(0x1a1)](0x0,0xf0);}function O(_0x51121c,_0x4aace4=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0x34f409=a0_0x3f65d7;if(_0x4aace4)return JSON['stringify'](_0x51121c);let _0x1a9f21=L(_0x51121c['parent_task_id'],_0x34f409(0x188)),_0x47f430=L(_0x51121c[_0x34f409(0x201)],_0x34f409(0x1a4)),_0x755976=_0x51121c['error_code']?_0x34f409(0x18b)+_0x51121c[_0x34f409(0x1c3)]+':'+(_0x51121c[_0x34f409(0x1bf)]??''):'';return'[commhub:task]\x20'+_0x51121c[_0x34f409(0x1da)]+_0x34f409(0x1ad)+L(_0x51121c[_0x34f409(0x1ff)],_0x34f409(0x19b))+_0x34f409(0x1e8)+L(_0x51121c[_0x34f409(0x1a0)],_0x34f409(0x19b))+_0x34f409(0x1e4)+_0x47f430+_0x34f409(0x1d4)+_0x1a9f21+_0x34f409(0x19a)+L(_0x51121c[_0x34f409(0x1d6)],_0x34f409(0x19b))+'\x20transport='+_0x51121c[_0x34f409(0x1ee)]+_0x34f409(0x1b5)+_0x51121c['duration_ms']+_0x34f409(0x1e7)+_0x51121c['lifecycle_tracking']+_0x755976;}function U(_0x317e1b){const _0x382614=a0_0x3f65d7;return{'event':{'sending':_0x382614(0x19e),'delivered':'task.send.delivered','failed':_0x382614(0x193),'acked':_0x382614(0x1b3),'started':'task.started','replied':'task.replied','expired':_0x382614(0x1ab)}[_0x317e1b[_0x382614(0x1da)]],..._0x317e1b};}function j(_0x3fc9a2){const _0x2580be=a0_0x3f65d7;let _0x2dccb2=_0x3fc9a2?.[_0x2580be(0x201)]||_0x3fc9a2?.[_0x2580be(0x1e5)]||_0x3fc9a2?.['id'];if(_0x2dccb2)return String(_0x2dccb2);let _0x21c2e8=_0x3fc9a2?.['content']?.[0x0]?.[_0x2580be(0x1ae)];if(typeof _0x21c2e8!==_0x2580be(0x1f8))return null;try{let _0x31307b=JSON['parse'](_0x21c2e8);return _0x31307b?.[_0x2580be(0x201)]||_0x31307b?.[_0x2580be(0x1e5)]||_0x31307b?.['id']||null;}catch{return null;}}async function X(_0x2c19bb,_0x38032c){const _0x326441=a0_0x3f65d7;let _0x25b47b=_0x38032c[_0x326441(0x1fa)]??Date['now'],_0x376741=_0x25b47b(),_0x441012=(_0x5851ec,_0x1d7b55,_0x2b3fa9,_0x380b82)=>{const _0x36baaf=_0x326441;_0x38032c[_0x36baaf(0x1df)](O(U({'from_alias':_0x2c19bb['fromAlias'],'to_alias':_0x2c19bb[_0x36baaf(0x1e2)],'task_id':_0x1d7b55,'parent_task_id':_0x2c19bb['parentTaskId'],'network_id':_0x2c19bb['networkId'],'transport':_0x2c19bb[_0x36baaf(0x1ee)],'status':_0x5851ec,'duration_ms':_0x25b47b()-_0x376741,'lifecycle_tracking':_0x2c19bb[_0x36baaf(0x1ba)],..._0x2b3fa9!==void 0x0?{'error_code':_0x380b82||'send_failed','error_message':N(_0x2b3fa9)}:{}})));};_0x441012(_0x326441(0x18f),null);try{let _0x54c3d6=await _0x38032c['send'](),_0x52d46a=j(_0x54c3d6);if(_0x52d46a)_0x441012('delivered',_0x52d46a);else{if(_0x54c3d6?.['ok']===!0x1||_0x54c3d6?.[_0x326441(0x196)])_0x441012(_0x326441(0x1bc),_0x52d46a,_0x54c3d6?.[_0x326441(0x196)]||_0x326441(0x1ca),'send_rejected');else _0x441012(_0x326441(0x1bc),null,_0x326441(0x1b7),_0x326441(0x1b0));}return _0x54c3d6;}catch(_0x3d6ffd){throw _0x441012(_0x326441(0x1bc),null,_0x3d6ffd,_0x326441(0x1c0)),_0x3d6ffd;}}async function Y(_0x1cf34c,_0x3b903d){const _0x527d39=a0_0x3f65d7;return X({'fromAlias':_0x1cf34c[_0x527d39(0x1db)],'toAlias':_0x1cf34c[_0x527d39(0x195)],'parentTaskId':_0x1cf34c[_0x527d39(0x1e9)]||null,'networkId':_0x1cf34c[_0x527d39(0x1f2)]||null,'transport':_0x527d39(0x1d2),'lifecycleTracking':_0x527d39(0x1d1)},_0x3b903d);}class $ extends a0_0x230289{[a0_0x3f65d7(0x1de)];[a0_0x3f65d7(0x195)];[a0_0x3f65d7(0x1f6)];[a0_0x3f65d7(0x1d7)];[a0_0x3f65d7(0x1ac)];[a0_0x3f65d7(0x190)];['reconnectDelay'];[a0_0x3f65d7(0x1b2)];['sseAbort'];['running']=!0x1;constructor(_0x55a2fe){const _0x43428f=a0_0x3f65d7;super();if(this[_0x43428f(0x1de)]=_0x55a2fe[_0x43428f(0x1de)][_0x43428f(0x1f4)](/\/$/,''),this[_0x43428f(0x195)]=_0x55a2fe[_0x43428f(0x195)],this['token']=_0x55a2fe[_0x43428f(0x1f6)],this[_0x43428f(0x1d7)]=_0x55a2fe[_0x43428f(0x1d7)]||'sdk',this['resumeId']=_0x43428f(0x1dd)+_0x55a2fe['alias']+'-'+Date[_0x43428f(0x1fa)]()[_0x43428f(0x1f7)](0x24),this['heartbeatInterval']=_0x55a2fe[_0x43428f(0x190)]??0x2bf20,this[_0x43428f(0x1fb)]=_0x55a2fe['reconnectDelay']??0xbb8,_0x55a2fe[_0x43428f(0x1ed)]!==!0x1)this[_0x43428f(0x187)]();}['log'](_0x133e8e){const _0x420a67=a0_0x3f65d7;console[_0x420a67(0x1df)]('['+new Date()['toTimeString']()['slice'](0x0,0x8)+']\x20[commhub:'+this[_0x420a67(0x195)]+']\x20'+_0x133e8e);}async['call'](_0x202a9e,_0x582b1c){const _0x4c22fb=a0_0x3f65d7;let _0x52bc12={'Content-Type':_0x4c22fb(0x1a6),'Accept':_0x4c22fb(0x1bd)};if(this[_0x4c22fb(0x1f6)])_0x52bc12['Authorization']='Bearer\x20'+this[_0x4c22fb(0x1f6)];let _0x13e77c=await(await fetch(this['url']+_0x4c22fb(0x200),{'method':_0x4c22fb(0x1c2),'headers':_0x52bc12,'body':JSON[_0x4c22fb(0x189)]({'jsonrpc':_0x4c22fb(0x1f3),'id':Date[_0x4c22fb(0x1fa)](),'method':_0x4c22fb(0x1f0),'params':{'name':_0x202a9e,'arguments':_0x582b1c}})}))[_0x4c22fb(0x1ae)](),_0x5a765c=_0x13e77c[_0x4c22fb(0x191)](/data: (.+)/),_0x5664e7=_0x5a765c?JSON[_0x4c22fb(0x1c6)](_0x5a765c[0x1]):JSON[_0x4c22fb(0x1c6)](_0x13e77c),_0x39a235=_0x5664e7?.[_0x4c22fb(0x1b8)]?.[_0x4c22fb(0x1aa)]?.[0x0]?.[_0x4c22fb(0x1ae)];return _0x39a235?JSON['parse'](_0x39a235):_0x5664e7;}async[a0_0x3f65d7(0x187)](){const _0x53ca67=a0_0x3f65d7;if(this[_0x53ca67(0x198)])return;this[_0x53ca67(0x198)]=!0x0,await this[_0x53ca67(0x1da)]('idle'),this[_0x53ca67(0x1df)](_0x53ca67(0x1c4)),this[_0x53ca67(0x1b2)]=setInterval(()=>{const _0xea42d1=_0x53ca67;this[_0xea42d1(0x1da)](_0xea42d1(0x1a7))['catch'](_0x392d2c=>this['log']('heartbeat\x20failed:\x20'+_0x392d2c[_0xea42d1(0x192)]));},this['heartbeatInterval']),this[_0x53ca67(0x1d9)]();}async[a0_0x3f65d7(0x18c)](){const _0x4fac11=a0_0x3f65d7;if(this[_0x4fac11(0x198)]=!0x1,this[_0x4fac11(0x1b1)]?.[_0x4fac11(0x1fe)](),this[_0x4fac11(0x1b2)])clearInterval(this[_0x4fac11(0x1b2)]);await this[_0x4fac11(0x1da)]('offline')[_0x4fac11(0x1f5)](()=>{}),this[_0x4fac11(0x1df)](_0x4fac11(0x1dc));}async[a0_0x3f65d7(0x1af)](_0x192a68,_0x138fd7,_0x148424=a0_0x3f65d7(0x1f1)){const _0x605a7=a0_0x3f65d7;return Y({'alias':_0x192a68,'fromAlias':this[_0x605a7(0x195)]},{'log':_0xb12c5=>console[_0x605a7(0x1df)](_0xb12c5),'send':()=>this[_0x605a7(0x18a)](_0x605a7(0x18d),{'alias':_0x192a68,'task':_0x138fd7,'priority':_0x148424,'from_session':this[_0x605a7(0x195)]})});}async[a0_0x3f65d7(0x192)](_0x4d067a,_0xd8a469){const _0x38485c=a0_0x3f65d7;return this['call'](_0x38485c(0x1fc),{'alias':_0x4d067a,'message':_0xd8a469,'from_session':this[_0x38485c(0x195)]});}async[a0_0x3f65d7(0x1a2)](_0x191ad8,_0x2847f6,_0x48f258=a0_0x3f65d7(0x1d0)){const _0x22751d=a0_0x3f65d7;return this[_0x22751d(0x18a)](_0x22751d(0x1e0),{'in_reply_to':_0x191ad8,'text':_0x2847f6,'status':_0x48f258});}async['status'](_0x3bd97b,_0x5e8d12){const _0x4d0de5=a0_0x3f65d7;return this[_0x4d0de5(0x18a)](_0x4d0de5(0x1bb),{'resume_id':this[_0x4d0de5(0x1ac)],'alias':this[_0x4d0de5(0x195)],'status':_0x3bd97b,'server':a0_0x4e0bfc(),'hostname':a0_0x4e0bfc(),'agent':this['agent'],'project_dir':process[_0x4d0de5(0x1be)](),..._0x5e8d12});}async[a0_0x3f65d7(0x1b6)](){const _0x55f3bf=a0_0x3f65d7;return this[_0x55f3bf(0x18a)](_0x55f3bf(0x1c9),{});}async[a0_0x3f65d7(0x194)](_0x1d52c3,_0x5b5eae){const _0x26ffa4=a0_0x3f65d7;return this['call'](_0x26ffa4(0x194),{'message':_0x1d52c3,'filter_server':_0x5b5eae?.[_0x26ffa4(0x199)],'filter_status':_0x5b5eae?.[_0x26ffa4(0x1da)]});}async['connectSSE'](){const _0x32966a=a0_0x3f65d7;let _0x13f82a=encodeURIComponent(this[_0x32966a(0x195)]),_0x1899a8=this[_0x32966a(0x1de)]+_0x32966a(0x1e3)+_0x13f82a,_0x20ae69=this[_0x32966a(0x1fb)];while(this[_0x32966a(0x198)]){try{this[_0x32966a(0x1b1)]=new AbortController();let _0x15a6c8={'Accept':_0x32966a(0x197)};if(this[_0x32966a(0x1f6)])_0x15a6c8['Authorization']=_0x32966a(0x1c7)+this[_0x32966a(0x1f6)];let _0x57e021=await fetch(_0x1899a8,{'headers':_0x15a6c8,'signal':this[_0x32966a(0x1b1)][_0x32966a(0x18e)]});if(!_0x57e021['ok']||!_0x57e021[_0x32966a(0x1a3)]){this[_0x32966a(0x1df)]('SSE\x20failed:\x20'+_0x57e021[_0x32966a(0x1da)]),await this['sleep'](_0x20ae69),_0x20ae69=Math[_0x32966a(0x1ec)](_0x20ae69*1.5,0xea60);continue;}_0x20ae69=this[_0x32966a(0x1fb)];let _0x11b34b=_0x57e021[_0x32966a(0x1a3)][_0x32966a(0x1a9)](),_0x5d706b=new TextDecoder(),_0x4d76de='';while(this[_0x32966a(0x198)]){let {done:_0x466c19,value:_0x48a84f}=await _0x11b34b['read']();if(_0x466c19)break;_0x4d76de+=_0x5d706b[_0x32966a(0x1a5)](_0x48a84f,{'stream':!0x0});let _0x5c802a=_0x4d76de[_0x32966a(0x1ef)]('\x0a');_0x4d76de=_0x5c802a[_0x32966a(0x1e6)]()||'';for(let _0x14403b of _0x5c802a){if(!_0x14403b[_0x32966a(0x1d3)](_0x32966a(0x19c)))continue;try{let _0x12008d=JSON[_0x32966a(0x1c6)](_0x14403b[_0x32966a(0x1a1)](0x6));if(_0x12008d[_0x32966a(0x1ea)]==='connected'){this[_0x32966a(0x1df)]('SSE\x20connected'),this['emit']('connected');continue;}if(_0x12008d[_0x32966a(0x1ea)]===_0x32966a(0x1c1)||_0x12008d['type']===_0x32966a(0x1fd)||_0x12008d[_0x32966a(0x1ea)]===_0x32966a(0x194))await this['processInbox']();}catch{}}}}catch(_0xe0b062){if(_0xe0b062[_0x32966a(0x1eb)]==='AbortError')break;this[_0x32966a(0x1c8)](_0x32966a(0x196),_0xe0b062),this[_0x32966a(0x1df)]('SSE\x20error:\x20'+_0xe0b062[_0x32966a(0x192)]);}if(this['running'])this[_0x32966a(0x1c8)](_0x32966a(0x1dc)),this['log'](_0x32966a(0x1b9)+_0x20ae69/0x3e8+_0x32966a(0x1b4)),await this[_0x32966a(0x185)](_0x20ae69),_0x20ae69=Math['min'](_0x20ae69*1.5,0xea60);}}async['processInbox'](){const _0x1efbb0=a0_0x3f65d7;try{let _0x553a87=(await this[_0x1efbb0(0x18a)](_0x1efbb0(0x1e1),{'alias':this['alias'],'limit':0xa}))?.[_0x1efbb0(0x202)]||[];for(let _0x214d38 of _0x553a87)await this[_0x1efbb0(0x18a)](_0x1efbb0(0x1c5),{'alias':this['alias'],'message_id':_0x214d38['id']}),this['log']('←\x20'+_0x214d38[_0x1efbb0(0x1d5)]+':\x20'+_0x214d38[_0x1efbb0(0x1aa)][_0x1efbb0(0x1a1)](0x0,0x3c)),this[_0x1efbb0(0x1c8)](_0x1efbb0(0x1cb),_0x214d38),this[_0x1efbb0(0x1c8)]('message',_0x214d38);}catch(_0x43b122){this[_0x1efbb0(0x1df)]('inbox\x20error:\x20'+_0x43b122['message']);}}[a0_0x3f65d7(0x185)](_0x4a3f3f){return new Promise(_0x2dc8d0=>setTimeout(_0x2dc8d0,_0x4a3f3f));}}function a0_0x4a19(){const _0x4f082f=['SSE\x20reconnecting\x20in\x20','lifecycleTracking','report_status','failed','application/json,\x20text/event-stream','cwd','error_message','send_failed','new_task','POST','error_code','registered','ack_inbox','parse','Bearer\x20','emit','get_all_status','CommHub\x20rejected\x20task','task','[REDACTED]','136cFeQOq','1btMHqW','1206410uTFgdg','completed','not_tracked','mcp_http','startsWith','\x20parent_task_id=','from_session','network_id','agent','44991jKEbpE','connectSSE','status','fromAlias','disconnected','sdk-','url','log','send_reply','get_inbox','toAlias','/events/','\x20task_id=','message_id','pop','\x20lifecycle=','\x20to=','parentTaskId','type','name','min','autoConnect','transport','split','tools/call','normal','networkId','2.0','replace','catch','token','toString','string','1998120yRupLC','now','reconnectDelay','send_message','new_message','abort','from_alias','/mcp','task_id','messages','7wluzuT','sleep','222465UYeufE','connect','<missing>','stringify','call','\x20error=','disconnect','send_task','signal','sending','heartbeatInterval','match','message','task.send.failed','broadcast','alias','error','text/event-stream','running','server','\x20network_id=','<unknown>','data:\x20','3808920QnqOpZ','task.send.start','32233120ZBxyIb','to_alias','slice','reply','body','<pending>','decode','application/json','idle','2078397gSCuTG','getReader','content','task.expired','resumeId','\x20from=','text','send','missing_task_id','sseAbort','heartbeatTimer','task.ack','s...','\x20duration_ms=','getAllStatus','CommHub\x20response\x20omitted\x20task_id','result'];a0_0x4a19=function(){return _0x4f082f;};return a0_0x4a19();}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x2e18f7=a0_0x1a85;(function(_0x4dd29e,_0x13d560){const _0x4867d1=a0_0x1a85,_0x1061fd=_0x4dd29e();while(!![]){try{const _0x469229=-parseInt(_0x4867d1(0x176))/0x1+-parseInt(_0x4867d1(0x16a))/0x2+-parseInt(_0x4867d1(0x1e2))/0x3*(-parseInt(_0x4867d1(0x1a9))/0x4)+parseInt(_0x4867d1(0x198))/0x5*(parseInt(_0x4867d1(0x1c4))/0x6)+-parseInt(_0x4867d1(0x1b8))/0x7*(parseInt(_0x4867d1(0x1d3))/0x8)+parseInt(_0x4867d1(0x175))/0x9+-parseInt(_0x4867d1(0x18c))/0xa*(-parseInt(_0x4867d1(0x196))/0xb);if(_0x469229===_0x13d560)break;else _0x1061fd['push'](_0x1061fd['shift']());}catch(_0x5ee623){_0x1061fd['push'](_0x1061fd['shift']());}}}(a0_0x5d43,0x74afe));import{EventEmitter as a0_0x483b08}from'events';import{hostname as a0_0x4e38be}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x10fde7,_0x33a013)=>(_0x10fde7??_0x33a013)[a0_0x2e18f7(0x19f)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x2e18f7(0x1ac)](0x0,0xf0);function N(_0x25ba4c){const _0x32491e=a0_0x2e18f7;return(_0x25ba4c instanceof Error?_0x25ba4c[_0x32491e(0x1a8)]:String(_0x25ba4c??_0x32491e(0x1d6)))[_0x32491e(0x19f)](K,_0x32491e(0x189))[_0x32491e(0x19f)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x32491e(0x1ac)](0x0,0xf0);}function O(_0x12b8cd,_0x2449b7=process.env.ANET_TASK_TRACE_FORMAT===a0_0x2e18f7(0x1dd)){const _0x217de1=a0_0x2e18f7;if(_0x2449b7)return JSON[_0x217de1(0x1b7)](_0x12b8cd);let _0x3d98c6=L(_0x12b8cd[_0x217de1(0x1e0)],_0x217de1(0x1de)),_0x2cb7bb=L(_0x12b8cd[_0x217de1(0x19b)],'<pending>'),_0x2a8b8d=_0x12b8cd[_0x217de1(0x18a)]?_0x217de1(0x1d7)+_0x12b8cd[_0x217de1(0x18a)]+':'+(_0x12b8cd[_0x217de1(0x1b6)]??''):'';return'[commhub:task]\x20'+_0x12b8cd['status']+_0x217de1(0x16c)+L(_0x12b8cd[_0x217de1(0x1b1)],_0x217de1(0x1c6))+_0x217de1(0x1bc)+L(_0x12b8cd[_0x217de1(0x180)],_0x217de1(0x1c6))+_0x217de1(0x1a3)+_0x2cb7bb+_0x217de1(0x1aa)+_0x3d98c6+_0x217de1(0x1ad)+L(_0x12b8cd['network_id'],_0x217de1(0x1c6))+_0x217de1(0x1ba)+_0x12b8cd['transport']+_0x217de1(0x1b2)+_0x12b8cd[_0x217de1(0x193)]+_0x217de1(0x19c)+_0x12b8cd[_0x217de1(0x17f)]+_0x2a8b8d;}function U(_0x1e8359){const _0x3dfb76=a0_0x2e18f7;return{'event':{'sending':_0x3dfb76(0x1ae),'delivered':_0x3dfb76(0x1d5),'failed':_0x3dfb76(0x199),'acked':'task.ack','started':_0x3dfb76(0x194),'replied':'task.replied','expired':_0x3dfb76(0x1e1)}[_0x1e8359[_0x3dfb76(0x192)]],..._0x1e8359};}function j(_0x46eba2){const _0x3ab234=a0_0x2e18f7;let _0x32fd05=_0x46eba2?.[_0x3ab234(0x19b)]||_0x46eba2?.[_0x3ab234(0x184)]||_0x46eba2?.['id'];if(_0x32fd05)return String(_0x32fd05);let _0x10f80e=_0x46eba2?.[_0x3ab234(0x191)]?.[0x0]?.[_0x3ab234(0x1ce)];if(typeof _0x10f80e!==_0x3ab234(0x1c8))return null;try{let _0x5f09ce=JSON['parse'](_0x10f80e);return _0x5f09ce?.[_0x3ab234(0x19b)]||_0x5f09ce?.[_0x3ab234(0x184)]||_0x5f09ce?.['id']||null;}catch{return null;}}async function X(_0x2109bc,_0x5a4203){const _0x335eef=a0_0x2e18f7;let _0x1fa334=_0x5a4203[_0x335eef(0x173)]??Date[_0x335eef(0x173)],_0x330755=_0x1fa334(),_0x54c1f6=(_0x54e162,_0x2212f2,_0x425062,_0x53b738)=>{const _0x7a1fb0=_0x335eef;_0x5a4203[_0x7a1fb0(0x163)](O(U({'from_alias':_0x2109bc['fromAlias'],'to_alias':_0x2109bc['toAlias'],'task_id':_0x2212f2,'parent_task_id':_0x2109bc[_0x7a1fb0(0x1cd)],'network_id':_0x2109bc['networkId'],'transport':_0x2109bc[_0x7a1fb0(0x169)],'status':_0x54e162,'duration_ms':_0x1fa334()-_0x330755,'lifecycle_tracking':_0x2109bc[_0x7a1fb0(0x1c3)],..._0x425062!==void 0x0?{'error_code':_0x53b738||_0x7a1fb0(0x164),'error_message':N(_0x425062)}:{}})));};_0x54c1f6(_0x335eef(0x179),null);try{let _0x5abddf=await _0x5a4203['send'](),_0x1b4170=j(_0x5abddf);if(_0x1b4170)_0x54c1f6(_0x335eef(0x1d4),_0x1b4170);else{if(_0x5abddf?.['ok']===!0x1||_0x5abddf?.[_0x335eef(0x19a)])_0x54c1f6('failed',_0x1b4170,_0x5abddf?.[_0x335eef(0x19a)]||_0x335eef(0x18e),'send_rejected');else _0x54c1f6(_0x335eef(0x177),null,'CommHub\x20response\x20omitted\x20task_id',_0x335eef(0x1a2));}return _0x5abddf;}catch(_0x2ae0e8){throw _0x54c1f6(_0x335eef(0x177),null,_0x2ae0e8,_0x335eef(0x164)),_0x2ae0e8;}}function a0_0x1a85(_0x3204d7,_0x3b6dc4){_0x3204d7=_0x3204d7-0x163;const _0x5d43f4=a0_0x5d43();let _0x1a8573=_0x5d43f4[_0x3204d7];return _0x1a8573;}async function Y(_0x49aa04,_0xbd4eb0){const _0x392948=a0_0x2e18f7;return X({'fromAlias':_0x49aa04[_0x392948(0x18d)],'toAlias':_0x49aa04[_0x392948(0x17e)],'parentTaskId':_0x49aa04[_0x392948(0x1cd)]||null,'networkId':_0x49aa04['networkId']||null,'transport':_0x392948(0x195),'lifecycleTracking':'not_tracked'},_0xbd4eb0);}class $ extends a0_0x483b08{[a0_0x2e18f7(0x187)];[a0_0x2e18f7(0x17e)];['token'];[a0_0x2e18f7(0x1d9)];['resumeId'];[a0_0x2e18f7(0x16e)];[a0_0x2e18f7(0x178)];[a0_0x2e18f7(0x1a1)];[a0_0x2e18f7(0x16f)];[a0_0x2e18f7(0x185)]=!0x1;constructor(_0xecbc65){const _0x3cedd0=a0_0x2e18f7;super();if(this['url']=_0xecbc65[_0x3cedd0(0x187)][_0x3cedd0(0x19f)](/\/$/,''),this[_0x3cedd0(0x17e)]=_0xecbc65[_0x3cedd0(0x17e)],this[_0x3cedd0(0x1a7)]=_0xecbc65[_0x3cedd0(0x1a7)],this[_0x3cedd0(0x1d9)]=_0xecbc65[_0x3cedd0(0x1d9)]||'sdk',this[_0x3cedd0(0x1bd)]=_0x3cedd0(0x168)+_0xecbc65[_0x3cedd0(0x17e)]+'-'+Date['now']()[_0x3cedd0(0x1b3)](0x24),this[_0x3cedd0(0x16e)]=_0xecbc65[_0x3cedd0(0x16e)]??0x2bf20,this['reconnectDelay']=_0xecbc65['reconnectDelay']??0xbb8,_0xecbc65[_0x3cedd0(0x1b9)]!==!0x1)this[_0x3cedd0(0x1db)]();}['log'](_0x4cec13){const _0x1ca208=a0_0x2e18f7;console[_0x1ca208(0x163)]('['+new Date()[_0x1ca208(0x1d8)]()[_0x1ca208(0x1ac)](0x0,0x8)+']\x20[commhub:'+this[_0x1ca208(0x17e)]+']\x20'+_0x4cec13);}async[a0_0x2e18f7(0x188)](_0x59f51d,_0x154d3e){const _0xc219c1=a0_0x2e18f7;let _0x336868={'Content-Type':_0xc219c1(0x1b4),'Accept':_0xc219c1(0x1c9)};if(this['token'])_0x336868[_0xc219c1(0x186)]=_0xc219c1(0x1be)+this[_0xc219c1(0x1a7)];let _0x657e64=await(await fetch(this[_0xc219c1(0x187)]+'/mcp',{'method':'POST','headers':_0x336868,'body':JSON[_0xc219c1(0x1b7)]({'jsonrpc':'2.0','id':Date[_0xc219c1(0x173)](),'method':'tools/call','params':{'name':_0x59f51d,'arguments':_0x154d3e}})}))[_0xc219c1(0x1ce)](),_0x342c64=_0x657e64[_0xc219c1(0x174)](/data: (.+)/),_0x535363=_0x342c64?JSON[_0xc219c1(0x17b)](_0x342c64[0x1]):JSON[_0xc219c1(0x17b)](_0x657e64),_0x110686=_0x535363?.['result']?.['content']?.[0x0]?.[_0xc219c1(0x1ce)];return _0x110686?JSON[_0xc219c1(0x17b)](_0x110686):_0x535363;}async[a0_0x2e18f7(0x1db)](){const _0x2afdfb=a0_0x2e18f7;if(this[_0x2afdfb(0x185)])return;this[_0x2afdfb(0x185)]=!0x0,await this['status'](_0x2afdfb(0x1cc)),this[_0x2afdfb(0x163)]('registered'),this['heartbeatTimer']=setInterval(()=>{const _0x4d0884=_0x2afdfb;this[_0x4d0884(0x192)](_0x4d0884(0x1cc))[_0x4d0884(0x165)](_0x27817c=>this[_0x4d0884(0x163)](_0x4d0884(0x1cb)+_0x27817c['message']));},this[_0x2afdfb(0x16e)]),this['connectSSE']();}async[a0_0x2e18f7(0x1c1)](){const _0x5d12e4=a0_0x2e18f7;if(this[_0x5d12e4(0x185)]=!0x1,this[_0x5d12e4(0x16f)]?.['abort'](),this[_0x5d12e4(0x1a1)])clearInterval(this[_0x5d12e4(0x1a1)]);await this[_0x5d12e4(0x192)](_0x5d12e4(0x1a0))[_0x5d12e4(0x165)](()=>{}),this[_0x5d12e4(0x163)](_0x5d12e4(0x181));}async[a0_0x2e18f7(0x1c7)](_0x474a0b,_0x1e8919,_0x527e3f=a0_0x2e18f7(0x1b5)){const _0x4960d8=a0_0x2e18f7;return Y({'alias':_0x474a0b,'fromAlias':this[_0x4960d8(0x17e)]},{'log':_0x118868=>console[_0x4960d8(0x163)](_0x118868),'send':()=>this['call'](_0x4960d8(0x190),{'alias':_0x474a0b,'task':_0x1e8919,'priority':_0x527e3f,'from_session':this['alias']})});}async[a0_0x2e18f7(0x1a8)](_0x10297b,_0x296399){const _0x29a5b4=a0_0x2e18f7;return this[_0x29a5b4(0x188)](_0x29a5b4(0x1d2),{'alias':_0x10297b,'message':_0x296399,'from_session':this[_0x29a5b4(0x17e)]});}async[a0_0x2e18f7(0x19d)](_0xdd5d13,_0x42646c,_0x1cb438=a0_0x2e18f7(0x1a5)){const _0x1b1e08=a0_0x2e18f7;return this[_0x1b1e08(0x188)](_0x1b1e08(0x183),{'in_reply_to':_0xdd5d13,'text':_0x42646c,'status':_0x1cb438});}async[a0_0x2e18f7(0x192)](_0x5988e0,_0x32ed10){const _0xdf9c9=a0_0x2e18f7;return this[_0xdf9c9(0x188)]('report_status',{'resume_id':this['resumeId'],'alias':this[_0xdf9c9(0x17e)],'status':_0x5988e0,'server':a0_0x4e38be(),'hostname':a0_0x4e38be(),'agent':this[_0xdf9c9(0x1d9)],'project_dir':process['cwd'](),..._0x32ed10});}async['getAllStatus'](){const _0x4aea0f=a0_0x2e18f7;return this[_0x4aea0f(0x188)](_0x4aea0f(0x1dc),{});}async[a0_0x2e18f7(0x1cf)](_0x5a3de5,_0x39ba9d){const _0x452849=a0_0x2e18f7;return this[_0x452849(0x188)]('broadcast',{'message':_0x5a3de5,'filter_server':_0x39ba9d?.[_0x452849(0x1ca)],'filter_status':_0x39ba9d?.[_0x452849(0x192)]});}async[a0_0x2e18f7(0x1d1)](){const _0x4d7fbd=a0_0x2e18f7;let _0x373a40=encodeURIComponent(this[_0x4d7fbd(0x17e)]),_0x59a223=this['url']+_0x4d7fbd(0x197)+_0x373a40,_0x3dc34a=this[_0x4d7fbd(0x178)];while(this[_0x4d7fbd(0x185)]){try{this[_0x4d7fbd(0x16f)]=new AbortController();let _0x3e7630={'Accept':_0x4d7fbd(0x18f)};if(this[_0x4d7fbd(0x1a7)])_0x3e7630[_0x4d7fbd(0x186)]='Bearer\x20'+this['token'];let _0x36fef7=await fetch(_0x59a223,{'headers':_0x3e7630,'signal':this['sseAbort'][_0x4d7fbd(0x1ab)]});if(!_0x36fef7['ok']||!_0x36fef7[_0x4d7fbd(0x1d0)]){this[_0x4d7fbd(0x163)](_0x4d7fbd(0x166)+_0x36fef7[_0x4d7fbd(0x192)]),await this[_0x4d7fbd(0x1af)](_0x3dc34a),_0x3dc34a=Math['min'](_0x3dc34a*1.5,0xea60);continue;}_0x3dc34a=this['reconnectDelay'];let _0x16efd9=_0x36fef7['body']['getReader'](),_0x4b3501=new TextDecoder(),_0x20eb9d='';while(this[_0x4d7fbd(0x185)]){let {done:_0x21d4bf,value:_0x183429}=await _0x16efd9[_0x4d7fbd(0x18b)]();if(_0x21d4bf)break;_0x20eb9d+=_0x4b3501[_0x4d7fbd(0x1c5)](_0x183429,{'stream':!0x0});let _0x7e020e=_0x20eb9d[_0x4d7fbd(0x1da)]('\x0a');_0x20eb9d=_0x7e020e[_0x4d7fbd(0x16b)]()||'';for(let _0x79e157 of _0x7e020e){if(!_0x79e157[_0x4d7fbd(0x19e)](_0x4d7fbd(0x167)))continue;try{let _0x37162f=JSON[_0x4d7fbd(0x17b)](_0x79e157[_0x4d7fbd(0x1ac)](0x6));if(_0x37162f[_0x4d7fbd(0x1bf)]===_0x4d7fbd(0x1c2)){this['log'](_0x4d7fbd(0x172)),this[_0x4d7fbd(0x182)](_0x4d7fbd(0x1c2));continue;}if(_0x37162f[_0x4d7fbd(0x1bf)]===_0x4d7fbd(0x1a4)||_0x37162f[_0x4d7fbd(0x1bf)]===_0x4d7fbd(0x17d)||_0x37162f[_0x4d7fbd(0x1bf)]===_0x4d7fbd(0x1cf))await this['processInbox']();}catch{}}}}catch(_0x1f689a){if(_0x1f689a[_0x4d7fbd(0x16d)]==='AbortError')break;this[_0x4d7fbd(0x182)]('error',_0x1f689a),this[_0x4d7fbd(0x163)](_0x4d7fbd(0x171)+_0x1f689a[_0x4d7fbd(0x1a8)]);}if(this['running'])this[_0x4d7fbd(0x182)]('disconnected'),this[_0x4d7fbd(0x163)](_0x4d7fbd(0x1df)+_0x3dc34a/0x3e8+_0x4d7fbd(0x1c0)),await this[_0x4d7fbd(0x1af)](_0x3dc34a),_0x3dc34a=Math[_0x4d7fbd(0x1bb)](_0x3dc34a*1.5,0xea60);}}async[a0_0x2e18f7(0x17c)](){const _0x4b12f3=a0_0x2e18f7;try{let _0x598b00=(await this[_0x4b12f3(0x188)](_0x4b12f3(0x1a6),{'alias':this[_0x4b12f3(0x17e)],'limit':0xa}))?.['messages']||[];for(let _0x2f98c1 of _0x598b00)await this[_0x4b12f3(0x188)](_0x4b12f3(0x1b0),{'alias':this['alias'],'message_id':_0x2f98c1['id']}),this[_0x4b12f3(0x163)]('←\x20'+_0x2f98c1[_0x4b12f3(0x170)]+':\x20'+_0x2f98c1[_0x4b12f3(0x191)][_0x4b12f3(0x1ac)](0x0,0x3c)),this[_0x4b12f3(0x182)]('task',_0x2f98c1),this[_0x4b12f3(0x182)](_0x4b12f3(0x1a8),_0x2f98c1);}catch(_0x2deb17){this[_0x4b12f3(0x163)](_0x4b12f3(0x17a)+_0x2deb17[_0x4b12f3(0x1a8)]);}}[a0_0x2e18f7(0x1af)](_0x7560cd){return new Promise(_0x1323f1=>setTimeout(_0x1323f1,_0x7560cd));}}function a0_0x5d43(){const _0x458a03=['log','send_failed','catch','SSE\x20failed:\x20','data:\x20','sdk-','transport','392100bsAFnL','pop','\x20from=','name','heartbeatInterval','sseAbort','from_session','SSE\x20error:\x20','SSE\x20connected','now','match','1949328WHfidA','221945pWVaDt','failed','reconnectDelay','sending','inbox\x20error:\x20','parse','processInbox','new_message','alias','lifecycle_tracking','to_alias','disconnected','emit','send_reply','message_id','running','Authorization','url','call','[REDACTED]','error_code','read','190ExYbDs','fromAlias','CommHub\x20rejected\x20task','text/event-stream','send_task','content','status','duration_ms','task.started','mcp_http','121352hTwMwY','/events/','464395BWHLdA','task.send.failed','error','task_id','\x20lifecycle=','reply','startsWith','replace','offline','heartbeatTimer','missing_task_id','\x20task_id=','new_task','completed','get_inbox','token','message','104hhRCXc','\x20parent_task_id=','signal','slice','\x20network_id=','task.send.start','sleep','ack_inbox','from_alias','\x20duration_ms=','toString','application/json','normal','error_message','stringify','56PlfzNq','autoConnect','\x20transport=','min','\x20to=','resumeId','Bearer\x20','type','s...','disconnect','connected','lifecycleTracking','18RjZMll','decode','<unknown>','send','string','application/json,\x20text/event-stream','server','heartbeat\x20failed:\x20','idle','parentTaskId','text','broadcast','body','connectSSE','send_message','204144uxQuvb','delivered','task.send.delivered','unknown\x20error','\x20error=','toTimeString','agent','split','connect','get_all_status','json','<missing>','SSE\x20reconnecting\x20in\x20','parent_task_id','task.expired','45606EzZJVG'];a0_0x5d43=function(){return _0x458a03;};return a0_0x5d43();}var F=$;export{F as default,$ as CommHub};
|