@sleep2agi/agent-network 2.3.0-preview.20 → 2.3.0-preview.21
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/bin/cli.js +1 -1
- package/dist/src/client.js +1 -1
- package/dist/src/im/feishu/worker.js +1 -1
- package/dist/src/node-server.js +1 -1
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x1f50c6=a0_0x4ee1;function a0_0x4ee1(_0x2809d3,_0x3799ca){_0x2809d3=_0x2809d3-0x120;const _0x1f8847=a0_0x1f88();let _0x4ee1fb=_0x1f8847[_0x2809d3];return _0x4ee1fb;}(function(_0x167052,_0x5f3ad0){const _0x2664f2=a0_0x4ee1,_0x124bd5=_0x167052();while(!![]){try{const _0x1c3dd2=-parseInt(_0x2664f2(0x126))/0x1+-parseInt(_0x2664f2(0x162))/0x2+parseInt(_0x2664f2(0x124))/0x3+-parseInt(_0x2664f2(0x140))/0x4*(-parseInt(_0x2664f2(0x15a))/0x5)+-parseInt(_0x2664f2(0x165))/0x6+parseInt(_0x2664f2(0x14f))/0x7*(parseInt(_0x2664f2(0x130))/0x8)+parseInt(_0x2664f2(0x159))/0x9*(-parseInt(_0x2664f2(0x143))/0xa);if(_0x1c3dd2===_0x5f3ad0)break;else _0x124bd5['push'](_0x124bd5['shift']());}catch(_0x16d6a2){_0x124bd5['push'](_0x124bd5['shift']());}}}(a0_0x1f88,0xd8c74));import{EventEmitter as a0_0x3a8bbc}from'events';import{hostname as a0_0x331afb}from'os';class T extends a0_0x3a8bbc{['url'];['alias'];[a0_0x1f50c6(0x12e)];[a0_0x1f50c6(0x170)];[a0_0x1f50c6(0x142)];[a0_0x1f50c6(0x129)];[a0_0x1f50c6(0x132)];[a0_0x1f50c6(0x122)];[a0_0x1f50c6(0x123)];['running']=!0x1;constructor(_0x3e04aa){const _0x22b43f=a0_0x1f50c6;super();if(this[_0x22b43f(0x14a)]=_0x3e04aa['url'][_0x22b43f(0x163)](/\/$/,''),this['alias']=_0x3e04aa[_0x22b43f(0x12f)],this[_0x22b43f(0x12e)]=_0x3e04aa['token'],this[_0x22b43f(0x170)]=_0x3e04aa[_0x22b43f(0x170)]||_0x22b43f(0x139),this['resumeId']='sdk-'+_0x3e04aa['alias']+'-'+Date['now']()[_0x22b43f(0x16d)](0x24),this[_0x22b43f(0x129)]=_0x3e04aa['heartbeatInterval']??0x2bf20,this[_0x22b43f(0x132)]=_0x3e04aa[_0x22b43f(0x132)]??0xbb8,_0x3e04aa['autoConnect']!==!0x1)this[_0x22b43f(0x171)]();}[a0_0x1f50c6(0x120)](_0x251ee8){const _0x27f1f2=a0_0x1f50c6;console['log']('['+new Date()[_0x27f1f2(0x14d)]()[_0x27f1f2(0x131)](0x0,0x8)+_0x27f1f2(0x167)+this['alias']+']\x20'+_0x251ee8);}async[a0_0x1f50c6(0x15c)](_0x15d7fa,_0x5053a8){const _0x35ab40=a0_0x1f50c6;let _0x5b7acb={'Content-Type':'application/json','Accept':_0x35ab40(0x156)};if(this[_0x35ab40(0x12e)])_0x5b7acb[_0x35ab40(0x15e)]=_0x35ab40(0x172)+this[_0x35ab40(0x12e)];let _0xe9da6f=await(await fetch(this[_0x35ab40(0x14a)]+_0x35ab40(0x136),{'method':_0x35ab40(0x13d),'headers':_0x5b7acb,'body':JSON['stringify']({'jsonrpc':_0x35ab40(0x121),'id':Date['now'](),'method':_0x35ab40(0x151),'params':{'name':_0x15d7fa,'arguments':_0x5053a8}})}))[_0x35ab40(0x12d)](),_0x5b5403=_0xe9da6f[_0x35ab40(0x13b)](/data: (.+)/),_0x1c12dd=_0x5b5403?JSON['parse'](_0x5b5403[0x1]):JSON[_0x35ab40(0x137)](_0xe9da6f),_0x2e3450=_0x1c12dd?.[_0x35ab40(0x155)]?.['content']?.[0x0]?.[_0x35ab40(0x12d)];return _0x2e3450?JSON[_0x35ab40(0x137)](_0x2e3450):_0x1c12dd;}async[a0_0x1f50c6(0x171)](){const _0x300348=a0_0x1f50c6;if(this['running'])return;this[_0x300348(0x154)]=!0x0,await this[_0x300348(0x161)]('idle'),this[_0x300348(0x120)](_0x300348(0x15f)),this[_0x300348(0x122)]=setInterval(()=>{const _0x3c59c4=_0x300348;this[_0x3c59c4(0x161)](_0x3c59c4(0x12a))[_0x3c59c4(0x14c)](_0xd326dc=>this[_0x3c59c4(0x120)](_0x3c59c4(0x16e)+_0xd326dc['message']));},this[_0x300348(0x129)]),this[_0x300348(0x128)]();}async['disconnect'](){const _0x2a2d8b=a0_0x1f50c6;if(this['running']=!0x1,this[_0x2a2d8b(0x123)]?.[_0x2a2d8b(0x157)](),this['heartbeatTimer'])clearInterval(this[_0x2a2d8b(0x122)]);await this[_0x2a2d8b(0x161)]('offline')[_0x2a2d8b(0x14c)](()=>{}),this['log']('disconnected');}async['send'](_0x48589b,_0x3ddc58,_0x325cde=a0_0x1f50c6(0x150)){const _0xc933=a0_0x1f50c6;return this[_0xc933(0x15c)](_0xc933(0x16c),{'alias':_0x48589b,'task':_0x3ddc58,'priority':_0x325cde,'from_session':this['alias']});}async['message'](_0x250c83,_0x5292dc){const _0x481cab=a0_0x1f50c6;return this['call'](_0x481cab(0x16b),{'alias':_0x250c83,'message':_0x5292dc,'from_session':this[_0x481cab(0x12f)]});}async[a0_0x1f50c6(0x149)](_0x53a517,_0x2f8b4d,_0x5ba494='completed'){const _0x34c163=a0_0x1f50c6;return this[_0x34c163(0x15c)](_0x34c163(0x164),{'in_reply_to':_0x53a517,'text':_0x2f8b4d,'status':_0x5ba494});}async['status'](_0x4fd77c,_0x2e121f){const _0xeabaa6=a0_0x1f50c6;return this[_0xeabaa6(0x15c)](_0xeabaa6(0x138),{'resume_id':this[_0xeabaa6(0x142)],'alias':this[_0xeabaa6(0x12f)],'status':_0x4fd77c,'server':a0_0x331afb(),'hostname':a0_0x331afb(),'agent':this[_0xeabaa6(0x170)],'project_dir':process[_0xeabaa6(0x168)](),..._0x2e121f});}async['getAllStatus'](){const _0x227a65=a0_0x1f50c6;return this[_0x227a65(0x15c)](_0x227a65(0x158),{});}async[a0_0x1f50c6(0x144)](_0x1889d0,_0x3e42bd){const _0x2b53c7=a0_0x1f50c6;return this[_0x2b53c7(0x15c)](_0x2b53c7(0x144),{'message':_0x1889d0,'filter_server':_0x3e42bd?.[_0x2b53c7(0x135)],'filter_status':_0x3e42bd?.['status']});}async[a0_0x1f50c6(0x128)](){const _0x12f622=a0_0x1f50c6;let _0x317d88=encodeURIComponent(this[_0x12f622(0x12f)]),_0x1c71a5=this[_0x12f622(0x14a)]+'/events/'+_0x317d88,_0xcccd39=this[_0x12f622(0x132)];while(this[_0x12f622(0x154)]){try{this[_0x12f622(0x123)]=new AbortController();let _0x7e7e18={'Accept':_0x12f622(0x13a)};if(this[_0x12f622(0x12e)])_0x7e7e18[_0x12f622(0x15e)]=_0x12f622(0x172)+this[_0x12f622(0x12e)];let _0x5d99d8=await fetch(_0x1c71a5,{'headers':_0x7e7e18,'signal':this[_0x12f622(0x123)][_0x12f622(0x152)]});if(!_0x5d99d8['ok']||!_0x5d99d8[_0x12f622(0x16a)]){this[_0x12f622(0x120)]('SSE\x20failed:\x20'+_0x5d99d8[_0x12f622(0x161)]),await this[_0x12f622(0x146)](_0xcccd39),_0xcccd39=Math[_0x12f622(0x145)](_0xcccd39*1.5,0xea60);continue;}_0xcccd39=this[_0x12f622(0x132)];let _0x3c11fb=_0x5d99d8[_0x12f622(0x16a)][_0x12f622(0x13f)](),_0x38dd15=new TextDecoder(),_0x2a53da='';while(this['running']){let {done:_0x1d283f,value:_0x5d447b}=await _0x3c11fb['read']();if(_0x1d283f)break;_0x2a53da+=_0x38dd15[_0x12f622(0x13e)](_0x5d447b,{'stream':!0x0});let _0x4cdf56=_0x2a53da['split']('\x0a');_0x2a53da=_0x4cdf56[_0x12f622(0x15b)]()||'';for(let _0x237e5a of _0x4cdf56){if(!_0x237e5a['startsWith'](_0x12f622(0x133)))continue;try{let _0x6bfb3a=JSON[_0x12f622(0x137)](_0x237e5a[_0x12f622(0x131)](0x6));if(_0x6bfb3a[_0x12f622(0x148)]===_0x12f622(0x134)){this[_0x12f622(0x120)]('SSE\x20connected'),this[_0x12f622(0x125)](_0x12f622(0x134));continue;}if(_0x6bfb3a['type']==='new_task'||_0x6bfb3a['type']===_0x12f622(0x13c)||_0x6bfb3a[_0x12f622(0x148)]===_0x12f622(0x144))await this[_0x12f622(0x147)]();}catch{}}}}catch(_0x471d1b){if(_0x471d1b[_0x12f622(0x14e)]===_0x12f622(0x160))break;this[_0x12f622(0x125)](_0x12f622(0x12b),_0x471d1b),this['log'](_0x12f622(0x12c)+_0x471d1b[_0x12f622(0x14b)]);}if(this['running'])this['emit'](_0x12f622(0x169)),this[_0x12f622(0x120)](_0x12f622(0x141)+_0xcccd39/0x3e8+_0x12f622(0x16f)),await this[_0x12f622(0x146)](_0xcccd39),_0xcccd39=Math['min'](_0xcccd39*1.5,0xea60);}}async['processInbox'](){const _0x39ef4c=a0_0x1f50c6;try{let _0x2dfaf2=(await this[_0x39ef4c(0x15c)](_0x39ef4c(0x127),{'alias':this[_0x39ef4c(0x12f)],'limit':0xa}))?.['messages']||[];for(let _0x27005a of _0x2dfaf2)await this[_0x39ef4c(0x15c)](_0x39ef4c(0x15d),{'alias':this[_0x39ef4c(0x12f)],'message_id':_0x27005a['id']}),this[_0x39ef4c(0x120)]('←\x20'+_0x27005a[_0x39ef4c(0x166)]+':\x20'+_0x27005a[_0x39ef4c(0x153)][_0x39ef4c(0x131)](0x0,0x3c)),this[_0x39ef4c(0x125)]('task',_0x27005a),this[_0x39ef4c(0x125)](_0x39ef4c(0x14b),_0x27005a);}catch(_0x9f5f99){this[_0x39ef4c(0x120)]('inbox\x20error:\x20'+_0x9f5f99[_0x39ef4c(0x14b)]);}}['sleep'](_0xcb1bd3){return new Promise(_0x301af2=>setTimeout(_0x301af2,_0xcb1bd3));}}var $=T;export{$ as default,T as CommHub};function a0_0x1f88(){const _0x255ea8=['idle','error','SSE\x20error:\x20','text','token','alias','520280IgPZKY','slice','reconnectDelay','data:\x20','connected','server','/mcp','parse','report_status','sdk','text/event-stream','match','new_message','POST','decode','getReader','28uWeIAD','SSE\x20reconnecting\x20in\x20','resumeId','2527320noabwo','broadcast','min','sleep','processInbox','type','reply','url','message','catch','toTimeString','name','147vQnzmD','normal','tools/call','signal','content','running','result','application/json,\x20text/event-stream','abort','get_all_status','18OfRXfI','988170xuOMbC','pop','call','ack_inbox','Authorization','registered','AbortError','status','372378QfoHVJ','replace','send_reply','1033560ZwTilC','from_session',']\x20[commhub:','cwd','disconnected','body','send_message','send_task','toString','heartbeat\x20failed:\x20','s...','agent','connect','Bearer\x20','log','2.0','heartbeatTimer','sseAbort','2105607YIIVww','emit','1699205QyjICq','get_inbox','connectSSE','heartbeatInterval'];a0_0x1f88=function(){return _0x255ea8;};return a0_0x1f88();}
|