@sleep2agi/agent-network 2.3.0-preview.21 → 2.3.0-preview.22
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
|
|
1
|
+
const a0_0x1ae8e8=a0_0x418b;function a0_0x418b(_0x316f8a,_0x2d32c8){_0x316f8a=_0x316f8a-0x1cf;const _0x2ce83d=a0_0x2ce8();let _0x418b64=_0x2ce83d[_0x316f8a];return _0x418b64;}(function(_0x15c4d1,_0x524cf8){const _0x11ce2e=a0_0x418b,_0x16c4e7=_0x15c4d1();while(!![]){try{const _0x4ffbd6=-parseInt(_0x11ce2e(0x215))/0x1+-parseInt(_0x11ce2e(0x214))/0x2+parseInt(_0x11ce2e(0x1e6))/0x3*(parseInt(_0x11ce2e(0x1e0))/0x4)+-parseInt(_0x11ce2e(0x1df))/0x5*(parseInt(_0x11ce2e(0x1e9))/0x6)+parseInt(_0x11ce2e(0x208))/0x7+parseInt(_0x11ce2e(0x1d1))/0x8*(parseInt(_0x11ce2e(0x1f5))/0x9)+parseInt(_0x11ce2e(0x1e3))/0xa;if(_0x4ffbd6===_0x524cf8)break;else _0x16c4e7['push'](_0x16c4e7['shift']());}catch(_0x55d483){_0x16c4e7['push'](_0x16c4e7['shift']());}}}(a0_0x2ce8,0x8351d));function a0_0x2ce8(){const _0x42e57b=['message','now','report_status','decode','emit','startsWith','match','autoConnect','offline','SSE\x20failed:\x20','57688VdwCev','get_inbox','running','heartbeat\x20failed:\x20','heartbeatTimer','signal','status','catch','AbortError','get_all_status','toString','body','content','min','313340fLFcup','2916DbREny','Bearer\x20','data:\x20','8226330bfZMPY','read','2.0','3309gpbQzr','sdk-','type','96GkJQMB','task','replace','new_message','tools/call','broadcast',']\x20[commhub:','application/json','connectSSE','text','reconnectDelay','call','1161pHfTqK','application/json,\x20text/event-stream','/events/','sleep','split','new_task','send','stringify','idle','registered','slice','log','disconnect','SSE\x20connected','completed','Authorization','ack_inbox','send_reply','cwd','3774344KQPWvk','error','SSE\x20error:\x20','alias','connect','processInbox','sseAbort','send_task','normal','inbox\x20error:\x20','disconnected','name','1422856jfTHPx','844130BbrutR','connected','parse','token','resumeId','/mcp','send_message','SSE\x20reconnecting\x20in\x20','agent','abort','url','heartbeatInterval','text/event-stream'];a0_0x2ce8=function(){return _0x42e57b;};return a0_0x2ce8();}import{EventEmitter as a0_0x4108bc}from'events';import{hostname as a0_0x16c13a}from'os';class T extends a0_0x4108bc{['url'];[a0_0x1ae8e8(0x20b)];['token'];['agent'];[a0_0x1ae8e8(0x219)];['heartbeatInterval'];[a0_0x1ae8e8(0x1f3)];[a0_0x1ae8e8(0x1d5)];[a0_0x1ae8e8(0x20e)];[a0_0x1ae8e8(0x1d3)]=!0x1;constructor(_0xef7e84){const _0x4d6805=a0_0x1ae8e8;super();if(this[_0x4d6805(0x21f)]=_0xef7e84[_0x4d6805(0x21f)][_0x4d6805(0x1eb)](/\/$/,''),this['alias']=_0xef7e84['alias'],this[_0x4d6805(0x218)]=_0xef7e84[_0x4d6805(0x218)],this[_0x4d6805(0x21d)]=_0xef7e84['agent']||'sdk',this[_0x4d6805(0x219)]=_0x4d6805(0x1e7)+_0xef7e84[_0x4d6805(0x20b)]+'-'+Date['now']()[_0x4d6805(0x1db)](0x24),this['heartbeatInterval']=_0xef7e84[_0x4d6805(0x220)]??0x2bf20,this[_0x4d6805(0x1f3)]=_0xef7e84[_0x4d6805(0x1f3)]??0xbb8,_0xef7e84[_0x4d6805(0x229)]!==!0x1)this[_0x4d6805(0x20c)]();}[a0_0x1ae8e8(0x200)](_0x398a26){const _0x571d92=a0_0x1ae8e8;console[_0x571d92(0x200)]('['+new Date()['toTimeString']()['slice'](0x0,0x8)+_0x571d92(0x1ef)+this['alias']+']\x20'+_0x398a26);}async[a0_0x1ae8e8(0x1f4)](_0x31f369,_0xdb810e){const _0x22eb2b=a0_0x1ae8e8;let _0x17a2da={'Content-Type':_0x22eb2b(0x1f0),'Accept':_0x22eb2b(0x1f6)};if(this[_0x22eb2b(0x218)])_0x17a2da[_0x22eb2b(0x204)]=_0x22eb2b(0x1e1)+this[_0x22eb2b(0x218)];let _0x242bd7=await(await fetch(this[_0x22eb2b(0x21f)]+_0x22eb2b(0x21a),{'method':'POST','headers':_0x17a2da,'body':JSON[_0x22eb2b(0x1fc)]({'jsonrpc':_0x22eb2b(0x1e5),'id':Date[_0x22eb2b(0x223)](),'method':_0x22eb2b(0x1ed),'params':{'name':_0x31f369,'arguments':_0xdb810e}})}))[_0x22eb2b(0x1f2)](),_0x2aaae1=_0x242bd7[_0x22eb2b(0x228)](/data: (.+)/),_0x567f97=_0x2aaae1?JSON[_0x22eb2b(0x217)](_0x2aaae1[0x1]):JSON[_0x22eb2b(0x217)](_0x242bd7),_0x46e392=_0x567f97?.['result']?.[_0x22eb2b(0x1dd)]?.[0x0]?.[_0x22eb2b(0x1f2)];return _0x46e392?JSON[_0x22eb2b(0x217)](_0x46e392):_0x567f97;}async['connect'](){const _0x405717=a0_0x1ae8e8;if(this['running'])return;this['running']=!0x0,await this['status'](_0x405717(0x1fd)),this[_0x405717(0x200)](_0x405717(0x1fe)),this[_0x405717(0x1d5)]=setInterval(()=>{const _0x467dac=_0x405717;this[_0x467dac(0x1d7)](_0x467dac(0x1fd))[_0x467dac(0x1d8)](_0x323da3=>this['log'](_0x467dac(0x1d4)+_0x323da3[_0x467dac(0x222)]));},this[_0x405717(0x220)]),this[_0x405717(0x1f1)]();}async[a0_0x1ae8e8(0x201)](){const _0x5a5158=a0_0x1ae8e8;if(this[_0x5a5158(0x1d3)]=!0x1,this[_0x5a5158(0x20e)]?.[_0x5a5158(0x21e)](),this[_0x5a5158(0x1d5)])clearInterval(this[_0x5a5158(0x1d5)]);await this[_0x5a5158(0x1d7)](_0x5a5158(0x1cf))[_0x5a5158(0x1d8)](()=>{}),this[_0x5a5158(0x200)](_0x5a5158(0x212));}async[a0_0x1ae8e8(0x1fb)](_0x4c2f37,_0xa81b2e,_0x366b8f=a0_0x1ae8e8(0x210)){const _0x1e01ea=a0_0x1ae8e8;return this['call'](_0x1e01ea(0x20f),{'alias':_0x4c2f37,'task':_0xa81b2e,'priority':_0x366b8f,'from_session':this['alias']});}async[a0_0x1ae8e8(0x222)](_0xc518a2,_0x544b7b){const _0xb5684d=a0_0x1ae8e8;return this[_0xb5684d(0x1f4)](_0xb5684d(0x21b),{'alias':_0xc518a2,'message':_0x544b7b,'from_session':this[_0xb5684d(0x20b)]});}async['reply'](_0x5d6a21,_0x387945,_0x67004=a0_0x1ae8e8(0x203)){const _0x92f117=a0_0x1ae8e8;return this[_0x92f117(0x1f4)](_0x92f117(0x206),{'in_reply_to':_0x5d6a21,'text':_0x387945,'status':_0x67004});}async['status'](_0x10820c,_0x251d24){const _0xe4e570=a0_0x1ae8e8;return this[_0xe4e570(0x1f4)](_0xe4e570(0x224),{'resume_id':this[_0xe4e570(0x219)],'alias':this[_0xe4e570(0x20b)],'status':_0x10820c,'server':a0_0x16c13a(),'hostname':a0_0x16c13a(),'agent':this['agent'],'project_dir':process[_0xe4e570(0x207)](),..._0x251d24});}async['getAllStatus'](){const _0x50c39d=a0_0x1ae8e8;return this[_0x50c39d(0x1f4)](_0x50c39d(0x1da),{});}async[a0_0x1ae8e8(0x1ee)](_0xadb8b0,_0x2b457d){const _0x368e6=a0_0x1ae8e8;return this[_0x368e6(0x1f4)](_0x368e6(0x1ee),{'message':_0xadb8b0,'filter_server':_0x2b457d?.['server'],'filter_status':_0x2b457d?.['status']});}async[a0_0x1ae8e8(0x1f1)](){const _0x5b339e=a0_0x1ae8e8;let _0x1d8c27=encodeURIComponent(this[_0x5b339e(0x20b)]),_0x364b23=this[_0x5b339e(0x21f)]+_0x5b339e(0x1f7)+_0x1d8c27,_0xa6c448=this[_0x5b339e(0x1f3)];while(this['running']){try{this[_0x5b339e(0x20e)]=new AbortController();let _0x19c779={'Accept':_0x5b339e(0x221)};if(this[_0x5b339e(0x218)])_0x19c779[_0x5b339e(0x204)]='Bearer\x20'+this[_0x5b339e(0x218)];let _0x47cfc0=await fetch(_0x364b23,{'headers':_0x19c779,'signal':this['sseAbort'][_0x5b339e(0x1d6)]});if(!_0x47cfc0['ok']||!_0x47cfc0['body']){this[_0x5b339e(0x200)](_0x5b339e(0x1d0)+_0x47cfc0[_0x5b339e(0x1d7)]),await this[_0x5b339e(0x1f8)](_0xa6c448),_0xa6c448=Math[_0x5b339e(0x1de)](_0xa6c448*1.5,0xea60);continue;}_0xa6c448=this[_0x5b339e(0x1f3)];let _0x10c073=_0x47cfc0[_0x5b339e(0x1dc)]['getReader'](),_0x365ac7=new TextDecoder(),_0x34bb50='';while(this['running']){let {done:_0xc07b5f,value:_0x18c9c2}=await _0x10c073[_0x5b339e(0x1e4)]();if(_0xc07b5f)break;_0x34bb50+=_0x365ac7[_0x5b339e(0x225)](_0x18c9c2,{'stream':!0x0});let _0x2c40ae=_0x34bb50[_0x5b339e(0x1f9)]('\x0a');_0x34bb50=_0x2c40ae['pop']()||'';for(let _0x381516 of _0x2c40ae){if(!_0x381516[_0x5b339e(0x227)](_0x5b339e(0x1e2)))continue;try{let _0x49957f=JSON['parse'](_0x381516[_0x5b339e(0x1ff)](0x6));if(_0x49957f[_0x5b339e(0x1e8)]==='connected'){this['log'](_0x5b339e(0x202)),this[_0x5b339e(0x226)](_0x5b339e(0x216));continue;}if(_0x49957f[_0x5b339e(0x1e8)]===_0x5b339e(0x1fa)||_0x49957f['type']===_0x5b339e(0x1ec)||_0x49957f[_0x5b339e(0x1e8)]===_0x5b339e(0x1ee))await this[_0x5b339e(0x20d)]();}catch{}}}}catch(_0x533554){if(_0x533554[_0x5b339e(0x213)]===_0x5b339e(0x1d9))break;this[_0x5b339e(0x226)](_0x5b339e(0x209),_0x533554),this[_0x5b339e(0x200)](_0x5b339e(0x20a)+_0x533554[_0x5b339e(0x222)]);}if(this[_0x5b339e(0x1d3)])this[_0x5b339e(0x226)](_0x5b339e(0x212)),this['log'](_0x5b339e(0x21c)+_0xa6c448/0x3e8+'s...'),await this[_0x5b339e(0x1f8)](_0xa6c448),_0xa6c448=Math[_0x5b339e(0x1de)](_0xa6c448*1.5,0xea60);}}async[a0_0x1ae8e8(0x20d)](){const _0x2dbe49=a0_0x1ae8e8;try{let _0x3d23a2=(await this[_0x2dbe49(0x1f4)](_0x2dbe49(0x1d2),{'alias':this[_0x2dbe49(0x20b)],'limit':0xa}))?.['messages']||[];for(let _0x19736a of _0x3d23a2)await this[_0x2dbe49(0x1f4)](_0x2dbe49(0x205),{'alias':this[_0x2dbe49(0x20b)],'message_id':_0x19736a['id']}),this[_0x2dbe49(0x200)]('←\x20'+_0x19736a['from_session']+':\x20'+_0x19736a[_0x2dbe49(0x1dd)][_0x2dbe49(0x1ff)](0x0,0x3c)),this[_0x2dbe49(0x226)](_0x2dbe49(0x1ea),_0x19736a),this[_0x2dbe49(0x226)](_0x2dbe49(0x222),_0x19736a);}catch(_0x293ecd){this[_0x2dbe49(0x200)](_0x2dbe49(0x211)+_0x293ecd['message']);}}[a0_0x1ae8e8(0x1f8)](_0x132b2d){return new Promise(_0xc24840=>setTimeout(_0xc24840,_0x132b2d));}}var $=T;export{$ as default,T as CommHub};
|