@sleep2agi/agent-network 2.3.0-preview.29 → 2.3.0-preview.30
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
|
+
function a0_0x10ba(_0x162cd1,_0x5b48b5){_0x162cd1=_0x162cd1-0x110;const _0x1b967f=a0_0x1b96();let _0x10ba4c=_0x1b967f[_0x162cd1];return _0x10ba4c;}const a0_0x42d0a8=a0_0x10ba;(function(_0x13073e,_0x22ec33){const _0x1a0b32=a0_0x10ba,_0x1b2cfe=_0x13073e();while(!![]){try{const _0x4d7453=parseInt(_0x1a0b32(0x153))/0x1*(parseInt(_0x1a0b32(0x164))/0x2)+-parseInt(_0x1a0b32(0x156))/0x3*(parseInt(_0x1a0b32(0x136))/0x4)+-parseInt(_0x1a0b32(0x15c))/0x5*(parseInt(_0x1a0b32(0x118))/0x6)+-parseInt(_0x1a0b32(0x131))/0x7*(parseInt(_0x1a0b32(0x15f))/0x8)+-parseInt(_0x1a0b32(0x122))/0x9+parseInt(_0x1a0b32(0x140))/0xa+parseInt(_0x1a0b32(0x14e))/0xb*(parseInt(_0x1a0b32(0x112))/0xc);if(_0x4d7453===_0x22ec33)break;else _0x1b2cfe['push'](_0x1b2cfe['shift']());}catch(_0x315eed){_0x1b2cfe['push'](_0x1b2cfe['shift']());}}}(a0_0x1b96,0xabf29));import{EventEmitter as a0_0x336085}from'events';function a0_0x1b96(){const _0x3c4ea6=['error','call','agent','type','sdk','heartbeatInterval','38654tAVqZK','name','message','/mcp','getAllStatus','62569rreYxH','startsWith','pop','22674TGZHtt','getReader','get_all_status','slice','report_status','task','2925985NmcHeT','normal','get_inbox','48mbuQjx','running','from_session',']\x20[commhub:','broadcast','2zpEbpg','SSE\x20error:\x20','idle','connectSSE','/events/','parse','POST','text','5316pNweNr','heartbeatTimer','min','registered','catch','log','6gvUbrH','alias','completed','autoConnect','signal','processInbox','tools/call','connected','offline','new_task','2393136xIsEup','resumeId','server','toTimeString','disconnected','disconnect','reconnectDelay','send_task','sseAbort','now','sleep','split','text/event-stream','SSE\x20reconnecting\x20in\x20','send','650545neTgCO','Bearer\x20','data:\x20','toString','SSE\x20connected','244WDAEHu','application/json,\x20text/event-stream','url','new_message','SSE\x20failed:\x20','emit','result','cwd','token','Authorization','9547750irdpVP','s...','connect','abort','ack_inbox','status','send_reply','2.0'];a0_0x1b96=function(){return _0x3c4ea6;};return a0_0x1b96();}import{hostname as a0_0x31b1e7}from'os';class T extends a0_0x336085{['url'];[a0_0x42d0a8(0x119)];['token'];['agent'];[a0_0x42d0a8(0x123)];[a0_0x42d0a8(0x14d)];[a0_0x42d0a8(0x128)];['heartbeatTimer'];[a0_0x42d0a8(0x12a)];[a0_0x42d0a8(0x160)]=!0x1;constructor(_0x113442){const _0x1a2606=a0_0x42d0a8;super();if(this[_0x1a2606(0x138)]=_0x113442[_0x1a2606(0x138)]['replace'](/\/$/,''),this['alias']=_0x113442[_0x1a2606(0x119)],this[_0x1a2606(0x13e)]=_0x113442['token'],this[_0x1a2606(0x14a)]=_0x113442['agent']||_0x1a2606(0x14c),this[_0x1a2606(0x123)]='sdk-'+_0x113442['alias']+'-'+Date[_0x1a2606(0x12b)]()[_0x1a2606(0x134)](0x24),this[_0x1a2606(0x14d)]=_0x113442[_0x1a2606(0x14d)]??0x2bf20,this[_0x1a2606(0x128)]=_0x113442[_0x1a2606(0x128)]??0xbb8,_0x113442[_0x1a2606(0x11b)]!==!0x1)this[_0x1a2606(0x142)]();}['log'](_0x31190a){const _0x13b5f0=a0_0x42d0a8;console[_0x13b5f0(0x117)]('['+new Date()[_0x13b5f0(0x125)]()[_0x13b5f0(0x159)](0x0,0x8)+_0x13b5f0(0x162)+this['alias']+']\x20'+_0x31190a);}async[a0_0x42d0a8(0x149)](_0x6649bd,_0x2b887c){const _0x3986cc=a0_0x42d0a8;let _0x36bb42={'Content-Type':'application/json','Accept':_0x3986cc(0x137)};if(this[_0x3986cc(0x13e)])_0x36bb42['Authorization']='Bearer\x20'+this['token'];let _0x5e7ba3=await(await fetch(this[_0x3986cc(0x138)]+_0x3986cc(0x151),{'method':_0x3986cc(0x110),'headers':_0x36bb42,'body':JSON['stringify']({'jsonrpc':_0x3986cc(0x147),'id':Date[_0x3986cc(0x12b)](),'method':_0x3986cc(0x11e),'params':{'name':_0x6649bd,'arguments':_0x2b887c}})}))[_0x3986cc(0x111)](),_0x223473=_0x5e7ba3['match'](/data: (.+)/),_0x1077ab=_0x223473?JSON[_0x3986cc(0x169)](_0x223473[0x1]):JSON['parse'](_0x5e7ba3),_0x4ebe38=_0x1077ab?.[_0x3986cc(0x13c)]?.['content']?.[0x0]?.[_0x3986cc(0x111)];return _0x4ebe38?JSON[_0x3986cc(0x169)](_0x4ebe38):_0x1077ab;}async[a0_0x42d0a8(0x142)](){const _0x386288=a0_0x42d0a8;if(this[_0x386288(0x160)])return;this[_0x386288(0x160)]=!0x0,await this[_0x386288(0x145)](_0x386288(0x166)),this['log'](_0x386288(0x115)),this['heartbeatTimer']=setInterval(()=>{const _0x48f991=_0x386288;this[_0x48f991(0x145)](_0x48f991(0x166))[_0x48f991(0x116)](_0x353f7f=>this['log']('heartbeat\x20failed:\x20'+_0x353f7f[_0x48f991(0x150)]));},this[_0x386288(0x14d)]),this[_0x386288(0x167)]();}async[a0_0x42d0a8(0x127)](){const _0x1210e3=a0_0x42d0a8;if(this[_0x1210e3(0x160)]=!0x1,this[_0x1210e3(0x12a)]?.[_0x1210e3(0x143)](),this[_0x1210e3(0x113)])clearInterval(this[_0x1210e3(0x113)]);await this[_0x1210e3(0x145)](_0x1210e3(0x120))[_0x1210e3(0x116)](()=>{}),this[_0x1210e3(0x117)](_0x1210e3(0x126));}async[a0_0x42d0a8(0x130)](_0x588a4c,_0x210d3e,_0x23dd45=a0_0x42d0a8(0x15d)){const _0x2d543c=a0_0x42d0a8;return this[_0x2d543c(0x149)](_0x2d543c(0x129),{'alias':_0x588a4c,'task':_0x210d3e,'priority':_0x23dd45,'from_session':this['alias']});}async['message'](_0x2544cb,_0x7fefb6){const _0x373ef3=a0_0x42d0a8;return this['call']('send_message',{'alias':_0x2544cb,'message':_0x7fefb6,'from_session':this[_0x373ef3(0x119)]});}async['reply'](_0x91fce8,_0x3a7a51,_0xc85abd=a0_0x42d0a8(0x11a)){const _0x4f12dc=a0_0x42d0a8;return this[_0x4f12dc(0x149)](_0x4f12dc(0x146),{'in_reply_to':_0x91fce8,'text':_0x3a7a51,'status':_0xc85abd});}async[a0_0x42d0a8(0x145)](_0x33b60e,_0x40a785){const _0x2895ba=a0_0x42d0a8;return this['call'](_0x2895ba(0x15a),{'resume_id':this[_0x2895ba(0x123)],'alias':this[_0x2895ba(0x119)],'status':_0x33b60e,'server':a0_0x31b1e7(),'hostname':a0_0x31b1e7(),'agent':this['agent'],'project_dir':process[_0x2895ba(0x13d)](),..._0x40a785});}async[a0_0x42d0a8(0x152)](){const _0xb77912=a0_0x42d0a8;return this[_0xb77912(0x149)](_0xb77912(0x158),{});}async[a0_0x42d0a8(0x163)](_0x34a901,_0x45b0b7){const _0x29aa3b=a0_0x42d0a8;return this[_0x29aa3b(0x149)](_0x29aa3b(0x163),{'message':_0x34a901,'filter_server':_0x45b0b7?.[_0x29aa3b(0x124)],'filter_status':_0x45b0b7?.['status']});}async['connectSSE'](){const _0x23552a=a0_0x42d0a8;let _0x40e746=encodeURIComponent(this['alias']),_0x17a3a0=this[_0x23552a(0x138)]+_0x23552a(0x168)+_0x40e746,_0x4b0e79=this[_0x23552a(0x128)];while(this['running']){try{this[_0x23552a(0x12a)]=new AbortController();let _0x6b7920={'Accept':_0x23552a(0x12e)};if(this[_0x23552a(0x13e)])_0x6b7920[_0x23552a(0x13f)]=_0x23552a(0x132)+this[_0x23552a(0x13e)];let _0x4d10e5=await fetch(_0x17a3a0,{'headers':_0x6b7920,'signal':this[_0x23552a(0x12a)][_0x23552a(0x11c)]});if(!_0x4d10e5['ok']||!_0x4d10e5['body']){this[_0x23552a(0x117)](_0x23552a(0x13a)+_0x4d10e5[_0x23552a(0x145)]),await this['sleep'](_0x4b0e79),_0x4b0e79=Math[_0x23552a(0x114)](_0x4b0e79*1.5,0xea60);continue;}_0x4b0e79=this[_0x23552a(0x128)];let _0x49467b=_0x4d10e5['body'][_0x23552a(0x157)](),_0xf0099b=new TextDecoder(),_0x28377e='';while(this[_0x23552a(0x160)]){let {done:_0x3659ed,value:_0x3fff9d}=await _0x49467b['read']();if(_0x3659ed)break;_0x28377e+=_0xf0099b['decode'](_0x3fff9d,{'stream':!0x0});let _0x546cf1=_0x28377e[_0x23552a(0x12d)]('\x0a');_0x28377e=_0x546cf1[_0x23552a(0x155)]()||'';for(let _0x56154c of _0x546cf1){if(!_0x56154c[_0x23552a(0x154)](_0x23552a(0x133)))continue;try{let _0x591038=JSON['parse'](_0x56154c[_0x23552a(0x159)](0x6));if(_0x591038[_0x23552a(0x14b)]===_0x23552a(0x11f)){this[_0x23552a(0x117)](_0x23552a(0x135)),this[_0x23552a(0x13b)](_0x23552a(0x11f));continue;}if(_0x591038[_0x23552a(0x14b)]===_0x23552a(0x121)||_0x591038[_0x23552a(0x14b)]===_0x23552a(0x139)||_0x591038[_0x23552a(0x14b)]===_0x23552a(0x163))await this[_0x23552a(0x11d)]();}catch{}}}}catch(_0x4cdde7){if(_0x4cdde7[_0x23552a(0x14f)]==='AbortError')break;this['emit'](_0x23552a(0x148),_0x4cdde7),this[_0x23552a(0x117)](_0x23552a(0x165)+_0x4cdde7['message']);}if(this[_0x23552a(0x160)])this[_0x23552a(0x13b)](_0x23552a(0x126)),this[_0x23552a(0x117)](_0x23552a(0x12f)+_0x4b0e79/0x3e8+_0x23552a(0x141)),await this[_0x23552a(0x12c)](_0x4b0e79),_0x4b0e79=Math[_0x23552a(0x114)](_0x4b0e79*1.5,0xea60);}}async[a0_0x42d0a8(0x11d)](){const _0x3e41cc=a0_0x42d0a8;try{let _0xb5a9a6=(await this[_0x3e41cc(0x149)](_0x3e41cc(0x15e),{'alias':this['alias'],'limit':0xa}))?.['messages']||[];for(let _0x44d8cc of _0xb5a9a6)await this[_0x3e41cc(0x149)](_0x3e41cc(0x144),{'alias':this[_0x3e41cc(0x119)],'message_id':_0x44d8cc['id']}),this[_0x3e41cc(0x117)]('←\x20'+_0x44d8cc[_0x3e41cc(0x161)]+':\x20'+_0x44d8cc['content']['slice'](0x0,0x3c)),this[_0x3e41cc(0x13b)](_0x3e41cc(0x15b),_0x44d8cc),this[_0x3e41cc(0x13b)](_0x3e41cc(0x150),_0x44d8cc);}catch(_0x1f11a3){this[_0x3e41cc(0x117)]('inbox\x20error:\x20'+_0x1f11a3[_0x3e41cc(0x150)]);}}['sleep'](_0x1f687f){return new Promise(_0x364aa6=>setTimeout(_0x364aa6,_0x1f687f));}}var $=T;export{$ as default,T as CommHub};
|