@sleep2agi/agent-network 2.3.0-preview.10 → 2.3.0-preview.11
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
|
-
|
|
1
|
+
const a0_0x4059a6=a0_0x27f5;(function(_0x15cdca,_0x33c5b4){const _0x478268=a0_0x27f5,_0x51f030=_0x15cdca();while(!![]){try{const _0x2214d1=parseInt(_0x478268(0x1ee))/0x1+-parseInt(_0x478268(0x1d6))/0x2*(-parseInt(_0x478268(0x1db))/0x3)+parseInt(_0x478268(0x210))/0x4*(parseInt(_0x478268(0x1d4))/0x5)+parseInt(_0x478268(0x206))/0x6+-parseInt(_0x478268(0x1d2))/0x7+parseInt(_0x478268(0x1e9))/0x8*(parseInt(_0x478268(0x1dd))/0x9)+-parseInt(_0x478268(0x1da))/0xa;if(_0x2214d1===_0x33c5b4)break;else _0x51f030['push'](_0x51f030['shift']());}catch(_0x241b90){_0x51f030['push'](_0x51f030['shift']());}}}(a0_0x59e0,0x3f187));import{EventEmitter as a0_0x535c0e}from'events';import{hostname as a0_0x8960f3}from'os';class T extends a0_0x535c0e{[a0_0x4059a6(0x1f2)];[a0_0x4059a6(0x1e1)];[a0_0x4059a6(0x1f9)];[a0_0x4059a6(0x1ff)];['resumeId'];[a0_0x4059a6(0x1f1)];[a0_0x4059a6(0x209)];[a0_0x4059a6(0x211)];['sseAbort'];[a0_0x4059a6(0x1ce)]=!0x1;constructor(_0x332b50){const _0x1d936b=a0_0x4059a6;super();if(this[_0x1d936b(0x1f2)]=_0x332b50['url'][_0x1d936b(0x200)](/\/$/,''),this[_0x1d936b(0x1e1)]=_0x332b50['alias'],this[_0x1d936b(0x1f9)]=_0x332b50[_0x1d936b(0x1f9)],this[_0x1d936b(0x1ff)]=_0x332b50['agent']||_0x1d936b(0x1de),this[_0x1d936b(0x203)]=_0x1d936b(0x1d9)+_0x332b50[_0x1d936b(0x1e1)]+'-'+Date['now']()[_0x1d936b(0x1ca)](0x24),this['heartbeatInterval']=_0x332b50[_0x1d936b(0x1f1)]??0x2bf20,this[_0x1d936b(0x209)]=_0x332b50[_0x1d936b(0x209)]??0xbb8,_0x332b50[_0x1d936b(0x1eb)]!==!0x1)this[_0x1d936b(0x1d7)]();}[a0_0x4059a6(0x1e0)](_0x295217){const _0x5d9e3c=a0_0x4059a6;console[_0x5d9e3c(0x1e0)]('['+new Date()[_0x5d9e3c(0x20b)]()[_0x5d9e3c(0x1fd)](0x0,0x8)+_0x5d9e3c(0x1f0)+this[_0x5d9e3c(0x1e1)]+']\x20'+_0x295217);}async['call'](_0x311ad1,_0x4838d7){const _0x52ef0a=a0_0x4059a6;let _0x248b99={'Content-Type':_0x52ef0a(0x1f8),'Accept':_0x52ef0a(0x208)};if(this[_0x52ef0a(0x1f9)])_0x248b99[_0x52ef0a(0x1df)]=_0x52ef0a(0x204)+this[_0x52ef0a(0x1f9)];let _0x2059d2=await(await fetch(this[_0x52ef0a(0x1f2)]+_0x52ef0a(0x1e5),{'method':'POST','headers':_0x248b99,'body':JSON[_0x52ef0a(0x20a)]({'jsonrpc':'2.0','id':Date[_0x52ef0a(0x1e6)](),'method':_0x52ef0a(0x1c4),'params':{'name':_0x311ad1,'arguments':_0x4838d7}})}))[_0x52ef0a(0x1c9)](),_0x26c4a1=_0x2059d2[_0x52ef0a(0x1d1)](/data: (.+)/),_0x5a1078=_0x26c4a1?JSON[_0x52ef0a(0x1ef)](_0x26c4a1[0x1]):JSON['parse'](_0x2059d2),_0x38fd28=_0x5a1078?.[_0x52ef0a(0x1e4)]?.[_0x52ef0a(0x1cc)]?.[0x0]?.[_0x52ef0a(0x1c9)];return _0x38fd28?JSON[_0x52ef0a(0x1ef)](_0x38fd28):_0x5a1078;}async['connect'](){const _0x480e05=a0_0x4059a6;if(this['running'])return;this[_0x480e05(0x1ce)]=!0x0,await this[_0x480e05(0x1cd)](_0x480e05(0x1c2)),this[_0x480e05(0x1e0)]('registered'),this['heartbeatTimer']=setInterval(()=>{const _0x93e01c=_0x480e05;this[_0x93e01c(0x1cd)](_0x93e01c(0x1c2))[_0x93e01c(0x202)](_0x46ccbd=>this[_0x93e01c(0x1e0)]('heartbeat\x20failed:\x20'+_0x46ccbd[_0x93e01c(0x20f)]));},this[_0x480e05(0x1f1)]),this['connectSSE']();}async[a0_0x4059a6(0x1c1)](){const _0x1691e2=a0_0x4059a6;if(this['running']=!0x1,this['sseAbort']?.[_0x1691e2(0x1fe)](),this[_0x1691e2(0x211)])clearInterval(this[_0x1691e2(0x211)]);await this[_0x1691e2(0x1cd)]('offline')['catch'](()=>{}),this[_0x1691e2(0x1e0)](_0x1691e2(0x1fa));}async[a0_0x4059a6(0x1f6)](_0x27993b,_0x26abfd,_0xb43d11=a0_0x4059a6(0x1dc)){const _0x81460d=a0_0x4059a6;return this[_0x81460d(0x207)](_0x81460d(0x1cf),{'alias':_0x27993b,'task':_0x26abfd,'priority':_0xb43d11,'from_session':this[_0x81460d(0x1e1)]});}async['message'](_0x1c53a4,_0x2689bc){const _0xa4a523=a0_0x4059a6;return this[_0xa4a523(0x207)]('send_message',{'alias':_0x1c53a4,'message':_0x2689bc,'from_session':this['alias']});}async[a0_0x4059a6(0x1e2)](_0x50f553,_0x14ad02,_0x2a5143='completed'){const _0x36edf1=a0_0x4059a6;return this[_0x36edf1(0x207)]('send_reply',{'in_reply_to':_0x50f553,'text':_0x14ad02,'status':_0x2a5143});}async[a0_0x4059a6(0x1cd)](_0x80a390,_0x451e24){const _0x3c7df5=a0_0x4059a6;return this['call']('report_status',{'resume_id':this[_0x3c7df5(0x203)],'alias':this[_0x3c7df5(0x1e1)],'status':_0x80a390,'server':a0_0x8960f3(),'hostname':a0_0x8960f3(),'agent':this['agent'],'project_dir':process[_0x3c7df5(0x1c6)](),..._0x451e24});}async[a0_0x4059a6(0x1d5)](){const _0x1737ef=a0_0x4059a6;return this[_0x1737ef(0x207)](_0x1737ef(0x1f3),{});}async[a0_0x4059a6(0x20d)](_0x4b87de,_0x68abd2){const _0x18faab=a0_0x4059a6;return this['call'](_0x18faab(0x20d),{'message':_0x4b87de,'filter_server':_0x68abd2?.['server'],'filter_status':_0x68abd2?.[_0x18faab(0x1cd)]});}async['connectSSE'](){const _0x49128a=a0_0x4059a6;let _0x1575e4=encodeURIComponent(this['alias']),_0xc8d3ba=this[_0x49128a(0x1f2)]+'/events/'+_0x1575e4,_0x5e1288=this[_0x49128a(0x209)];while(this['running']){try{this['sseAbort']=new AbortController();let _0x19f575={'Accept':_0x49128a(0x1ea)};if(this['token'])_0x19f575[_0x49128a(0x1df)]='Bearer\x20'+this['token'];let _0x24d6f5=await fetch(_0xc8d3ba,{'headers':_0x19f575,'signal':this[_0x49128a(0x1fb)][_0x49128a(0x205)]});if(!_0x24d6f5['ok']||!_0x24d6f5['body']){this[_0x49128a(0x1e0)](_0x49128a(0x201)+_0x24d6f5[_0x49128a(0x1cd)]),await this[_0x49128a(0x1fc)](_0x5e1288),_0x5e1288=Math[_0x49128a(0x1c5)](_0x5e1288*1.5,0xea60);continue;}_0x5e1288=this[_0x49128a(0x209)];let _0x5c3cf4=_0x24d6f5['body'][_0x49128a(0x1d0)](),_0x1caacd=new TextDecoder(),_0x486e6e='';while(this['running']){let {done:_0x1d8055,value:_0x4606df}=await _0x5c3cf4[_0x49128a(0x1c3)]();if(_0x1d8055)break;_0x486e6e+=_0x1caacd['decode'](_0x4606df,{'stream':!0x0});let _0xad8b1=_0x486e6e['split']('\x0a');_0x486e6e=_0xad8b1[_0x49128a(0x1d8)]()||'';for(let _0x5cc51a of _0xad8b1){if(!_0x5cc51a[_0x49128a(0x20e)](_0x49128a(0x1f7)))continue;try{let _0x5081d2=JSON['parse'](_0x5cc51a[_0x49128a(0x1fd)](0x6));if(_0x5081d2[_0x49128a(0x1ec)]===_0x49128a(0x1cb)){this[_0x49128a(0x1e0)](_0x49128a(0x1c8)),this[_0x49128a(0x1d3)](_0x49128a(0x1cb));continue;}if(_0x5081d2[_0x49128a(0x1ec)]==='new_task'||_0x5081d2['type']===_0x49128a(0x1e3)||_0x5081d2[_0x49128a(0x1ec)]===_0x49128a(0x20d))await this[_0x49128a(0x1f4)]();}catch{}}}}catch(_0x9f64eb){if(_0x9f64eb['name']==='AbortError')break;this[_0x49128a(0x1d3)]('error',_0x9f64eb),this[_0x49128a(0x1e0)](_0x49128a(0x1e7)+_0x9f64eb[_0x49128a(0x20f)]);}if(this['running'])this[_0x49128a(0x1d3)](_0x49128a(0x1fa)),this[_0x49128a(0x1e0)](_0x49128a(0x1ed)+_0x5e1288/0x3e8+_0x49128a(0x1f5)),await this[_0x49128a(0x1fc)](_0x5e1288),_0x5e1288=Math['min'](_0x5e1288*1.5,0xea60);}}async['processInbox'](){const _0x3f58b6=a0_0x4059a6;try{let _0x565345=(await this[_0x3f58b6(0x207)](_0x3f58b6(0x1c7),{'alias':this[_0x3f58b6(0x1e1)],'limit':0xa}))?.['messages']||[];for(let _0x2ec321 of _0x565345)await this['call'](_0x3f58b6(0x20c),{'alias':this[_0x3f58b6(0x1e1)],'message_id':_0x2ec321['id']}),this['log']('←\x20'+_0x2ec321['from_session']+':\x20'+_0x2ec321[_0x3f58b6(0x1cc)]['slice'](0x0,0x3c)),this[_0x3f58b6(0x1d3)]('task',_0x2ec321),this[_0x3f58b6(0x1d3)]('message',_0x2ec321);}catch(_0x54eb28){this[_0x3f58b6(0x1e0)](_0x3f58b6(0x1e8)+_0x54eb28[_0x3f58b6(0x20f)]);}}[a0_0x4059a6(0x1fc)](_0x59d1f3){return new Promise(_0x175e80=>setTimeout(_0x175e80,_0x59d1f3));}}function a0_0x27f5(_0x46f7fb,_0x5cfedd){_0x46f7fb=_0x46f7fb-0x1c1;const _0x59e05e=a0_0x59e0();let _0x27f5cf=_0x59e05e[_0x46f7fb];return _0x27f5cf;}var $=T;export{$ as default,T as CommHub};function a0_0x59e0(){const _0x18b957=['12MZNXgz','heartbeatTimer','disconnect','idle','read','tools/call','min','cwd','get_inbox','SSE\x20connected','text','toString','connected','content','status','running','send_task','getReader','match','1724037tyLDEM','emit','87585gvKJbd','getAllStatus','42892KhZtrm','connect','pop','sdk-','6010190EZalRW','21nTlVZe','normal','9xUexcv','sdk','Authorization','log','alias','reply','new_message','result','/mcp','now','SSE\x20error:\x20','inbox\x20error:\x20','1390168FnahBL','text/event-stream','autoConnect','type','SSE\x20reconnecting\x20in\x20','427813GXMJxk','parse',']\x20[commhub:','heartbeatInterval','url','get_all_status','processInbox','s...','send','data:\x20','application/json','token','disconnected','sseAbort','sleep','slice','abort','agent','replace','SSE\x20failed:\x20','catch','resumeId','Bearer\x20','signal','1808952fKTtBp','call','application/json,\x20text/event-stream','reconnectDelay','stringify','toTimeString','ack_inbox','broadcast','startsWith','message'];a0_0x59e0=function(){return _0x18b957;};return a0_0x59e0();}
|