@sleep2agi/agent-network 2.3.0-preview.13 → 2.3.0-preview.15

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.
@@ -1 +1 @@
1
- const a0_0xf1c06c=a0_0x2fb6;(function(_0x24f5d0,_0x46255b){const _0x55a99b=a0_0x2fb6,_0x3a2bc6=_0x24f5d0();while(!![]){try{const _0x44d267=parseInt(_0x55a99b(0x1b3))/0x1+-parseInt(_0x55a99b(0x1da))/0x2*(parseInt(_0x55a99b(0x205))/0x3)+parseInt(_0x55a99b(0x1d8))/0x4*(-parseInt(_0x55a99b(0x1d0))/0x5)+-parseInt(_0x55a99b(0x1e3))/0x6*(-parseInt(_0x55a99b(0x1e6))/0x7)+parseInt(_0x55a99b(0x1f4))/0x8*(-parseInt(_0x55a99b(0x1eb))/0x9)+-parseInt(_0x55a99b(0x203))/0xa*(-parseInt(_0x55a99b(0x1c1))/0xb)+parseInt(_0x55a99b(0x1b6))/0xc*(-parseInt(_0x55a99b(0x1f6))/0xd);if(_0x44d267===_0x46255b)break;else _0x3a2bc6['push'](_0x3a2bc6['shift']());}catch(_0x45778e){_0x3a2bc6['push'](_0x3a2bc6['shift']());}}}(a0_0x10c1,0xee739));import{EventEmitter as a0_0x1aefac}from'events';import{hostname as a0_0x9816c1}from'os';class T extends a0_0x1aefac{[a0_0xf1c06c(0x208)];[a0_0xf1c06c(0x1cd)];[a0_0xf1c06c(0x1f2)];[a0_0xf1c06c(0x1d1)];[a0_0xf1c06c(0x1f1)];[a0_0xf1c06c(0x1c2)];[a0_0xf1c06c(0x1d5)];['heartbeatTimer'];[a0_0xf1c06c(0x1d4)];['running']=!0x1;constructor(_0xa28ffe){const _0x2f4640=a0_0xf1c06c;super();if(this[_0x2f4640(0x208)]=_0xa28ffe[_0x2f4640(0x208)][_0x2f4640(0x1bf)](/\/$/,''),this[_0x2f4640(0x1cd)]=_0xa28ffe[_0x2f4640(0x1cd)],this['token']=_0xa28ffe[_0x2f4640(0x1f2)],this[_0x2f4640(0x1d1)]=_0xa28ffe[_0x2f4640(0x1d1)]||_0x2f4640(0x1ba),this['resumeId']=_0x2f4640(0x1ca)+_0xa28ffe[_0x2f4640(0x1cd)]+'-'+Date['now']()[_0x2f4640(0x1f3)](0x24),this[_0x2f4640(0x1c2)]=_0xa28ffe[_0x2f4640(0x1c2)]??0x2bf20,this[_0x2f4640(0x1d5)]=_0xa28ffe['reconnectDelay']??0xbb8,_0xa28ffe[_0x2f4640(0x1f7)]!==!0x1)this['connect']();}[a0_0xf1c06c(0x1ef)](_0x5514ed){const _0x40161b=a0_0xf1c06c;console['log']('['+new Date()[_0x40161b(0x1de)]()[_0x40161b(0x1fc)](0x0,0x8)+_0x40161b(0x1fa)+this[_0x40161b(0x1cd)]+']\x20'+_0x5514ed);}async['call'](_0x435db5,_0xb0bcfc){const _0x566ce9=a0_0xf1c06c;let _0xa14dce={'Content-Type':_0x566ce9(0x1c0),'Accept':'application/json,\x20text/event-stream'};if(this[_0x566ce9(0x1f2)])_0xa14dce[_0x566ce9(0x1bd)]=_0x566ce9(0x1df)+this['token'];let _0x5f0e8c=await(await fetch(this[_0x566ce9(0x208)]+_0x566ce9(0x1c7),{'method':'POST','headers':_0xa14dce,'body':JSON['stringify']({'jsonrpc':_0x566ce9(0x20c),'id':Date['now'](),'method':_0x566ce9(0x1ce),'params':{'name':_0x435db5,'arguments':_0xb0bcfc}})}))[_0x566ce9(0x1cf)](),_0x1fd6ff=_0x5f0e8c[_0x566ce9(0x1c3)](/data: (.+)/),_0x32c202=_0x1fd6ff?JSON['parse'](_0x1fd6ff[0x1]):JSON[_0x566ce9(0x209)](_0x5f0e8c),_0x1569a9=_0x32c202?.[_0x566ce9(0x1c8)]?.['content']?.[0x0]?.[_0x566ce9(0x1cf)];return _0x1569a9?JSON['parse'](_0x1569a9):_0x32c202;}async['connect'](){const _0x63b9df=a0_0xf1c06c;if(this['running'])return;this[_0x63b9df(0x1bc)]=!0x0,await this[_0x63b9df(0x1dd)]('idle'),this[_0x63b9df(0x1ef)](_0x63b9df(0x1ed)),this[_0x63b9df(0x1b8)]=setInterval(()=>{const _0x4bb546=_0x63b9df;this[_0x4bb546(0x1dd)](_0x4bb546(0x1fe))[_0x4bb546(0x1b7)](_0x3c7c19=>this[_0x4bb546(0x1ef)](_0x4bb546(0x1c6)+_0x3c7c19['message']));},this[_0x63b9df(0x1c2)]),this['connectSSE']();}async[a0_0xf1c06c(0x206)](){const _0xf8a9e9=a0_0xf1c06c;if(this[_0xf8a9e9(0x1bc)]=!0x1,this[_0xf8a9e9(0x1d4)]?.['abort'](),this[_0xf8a9e9(0x1b8)])clearInterval(this[_0xf8a9e9(0x1b8)]);await this[_0xf8a9e9(0x1dd)](_0xf8a9e9(0x201))[_0xf8a9e9(0x1b7)](()=>{}),this[_0xf8a9e9(0x1ef)](_0xf8a9e9(0x1f5));}async['send'](_0x5799b8,_0xb54cb0,_0x24ed41=a0_0xf1c06c(0x207)){const _0x1e3a77=a0_0xf1c06c;return this[_0x1e3a77(0x1f8)]('send_task',{'alias':_0x5799b8,'task':_0xb54cb0,'priority':_0x24ed41,'from_session':this[_0x1e3a77(0x1cd)]});}async[a0_0xf1c06c(0x1cc)](_0x4bdfb4,_0x52ff34){const _0x2b341d=a0_0xf1c06c;return this[_0x2b341d(0x1f8)](_0x2b341d(0x1cb),{'alias':_0x4bdfb4,'message':_0x52ff34,'from_session':this[_0x2b341d(0x1cd)]});}async[a0_0xf1c06c(0x1ff)](_0x3c83d9,_0x5a06ec,_0xc8aa36=a0_0xf1c06c(0x1ec)){const _0x188c2b=a0_0xf1c06c;return this[_0x188c2b(0x1f8)](_0x188c2b(0x1c5),{'in_reply_to':_0x3c83d9,'text':_0x5a06ec,'status':_0xc8aa36});}async['status'](_0x53a109,_0x37edbd){const _0x1091ea=a0_0xf1c06c;return this['call'](_0x1091ea(0x202),{'resume_id':this[_0x1091ea(0x1f1)],'alias':this[_0x1091ea(0x1cd)],'status':_0x53a109,'server':a0_0x9816c1(),'hostname':a0_0x9816c1(),'agent':this[_0x1091ea(0x1d1)],'project_dir':process['cwd'](),..._0x37edbd});}async['getAllStatus'](){const _0x472c60=a0_0xf1c06c;return this[_0x472c60(0x1f8)](_0x472c60(0x1d6),{});}async[a0_0xf1c06c(0x1d3)](_0x59bff9,_0xc555a9){const _0x2bf5d0=a0_0xf1c06c;return this[_0x2bf5d0(0x1f8)]('broadcast',{'message':_0x59bff9,'filter_server':_0xc555a9?.['server'],'filter_status':_0xc555a9?.['status']});}async[a0_0xf1c06c(0x1e2)](){const _0x1c67a8=a0_0xf1c06c;let _0x5c0588=encodeURIComponent(this[_0x1c67a8(0x1cd)]),_0x26c11b=this['url']+_0x1c67a8(0x200)+_0x5c0588,_0x3e5be0=this[_0x1c67a8(0x1d5)];while(this[_0x1c67a8(0x1bc)]){try{this[_0x1c67a8(0x1d4)]=new AbortController();let _0x5dac57={'Accept':_0x1c67a8(0x1e1)};if(this['token'])_0x5dac57[_0x1c67a8(0x1bd)]=_0x1c67a8(0x1df)+this[_0x1c67a8(0x1f2)];let _0x3a096f=await fetch(_0x26c11b,{'headers':_0x5dac57,'signal':this[_0x1c67a8(0x1d4)][_0x1c67a8(0x1ee)]});if(!_0x3a096f['ok']||!_0x3a096f[_0x1c67a8(0x1c4)]){this['log'](_0x1c67a8(0x204)+_0x3a096f[_0x1c67a8(0x1dd)]),await this['sleep'](_0x3e5be0),_0x3e5be0=Math[_0x1c67a8(0x1e5)](_0x3e5be0*1.5,0xea60);continue;}_0x3e5be0=this[_0x1c67a8(0x1d5)];let _0x297609=_0x3a096f[_0x1c67a8(0x1c4)][_0x1c67a8(0x1b9)](),_0x3c4588=new TextDecoder(),_0x371de5='';while(this[_0x1c67a8(0x1bc)]){let {done:_0x38b805,value:_0x23dbec}=await _0x297609[_0x1c67a8(0x1e0)]();if(_0x38b805)break;_0x371de5+=_0x3c4588[_0x1c67a8(0x1f9)](_0x23dbec,{'stream':!0x0});let _0x39d447=_0x371de5[_0x1c67a8(0x1fd)]('\x0a');_0x371de5=_0x39d447['pop']()||'';for(let _0x16a83e of _0x39d447){if(!_0x16a83e['startsWith'](_0x1c67a8(0x1c9)))continue;try{let _0x4ba2c1=JSON[_0x1c67a8(0x209)](_0x16a83e[_0x1c67a8(0x1fc)](0x6));if(_0x4ba2c1[_0x1c67a8(0x1fb)]==='connected'){this['log'](_0x1c67a8(0x1f0)),this[_0x1c67a8(0x20d)](_0x1c67a8(0x1bb));continue;}if(_0x4ba2c1[_0x1c67a8(0x1fb)]===_0x1c67a8(0x1d7)||_0x4ba2c1[_0x1c67a8(0x1fb)]===_0x1c67a8(0x1e9)||_0x4ba2c1[_0x1c67a8(0x1fb)]===_0x1c67a8(0x1d3))await this[_0x1c67a8(0x20a)]();}catch{}}}}catch(_0x40632e){if(_0x40632e['name']===_0x1c67a8(0x1db))break;this['emit'](_0x1c67a8(0x1b4),_0x40632e),this['log'](_0x1c67a8(0x1dc)+_0x40632e[_0x1c67a8(0x1cc)]);}if(this[_0x1c67a8(0x1bc)])this[_0x1c67a8(0x20d)](_0x1c67a8(0x1f5)),this[_0x1c67a8(0x1ef)](_0x1c67a8(0x1d9)+_0x3e5be0/0x3e8+_0x1c67a8(0x1e7)),await this[_0x1c67a8(0x1e4)](_0x3e5be0),_0x3e5be0=Math['min'](_0x3e5be0*1.5,0xea60);}}async[a0_0xf1c06c(0x20a)](){const _0xc52ce6=a0_0xf1c06c;try{let _0x2515a3=(await this['call'](_0xc52ce6(0x20b),{'alias':this[_0xc52ce6(0x1cd)],'limit':0xa}))?.[_0xc52ce6(0x1be)]||[];for(let _0x334a8d of _0x2515a3)await this['call'](_0xc52ce6(0x1d2),{'alias':this[_0xc52ce6(0x1cd)],'message_id':_0x334a8d['id']}),this[_0xc52ce6(0x1ef)]('←\x20'+_0x334a8d[_0xc52ce6(0x1e8)]+':\x20'+_0x334a8d['content']['slice'](0x0,0x3c)),this[_0xc52ce6(0x20d)](_0xc52ce6(0x1b5),_0x334a8d),this['emit'](_0xc52ce6(0x1cc),_0x334a8d);}catch(_0x4aadd2){this['log'](_0xc52ce6(0x1ea)+_0x4aadd2[_0xc52ce6(0x1cc)]);}}[a0_0xf1c06c(0x1e4)](_0x1b31d3){return new Promise(_0x3661e1=>setTimeout(_0x3661e1,_0x1b31d3));}}function a0_0x2fb6(_0x13ed3c,_0x1f9da5){_0x13ed3c=_0x13ed3c-0x1b3;const _0x10c166=a0_0x10c1();let _0x2fb6e8=_0x10c166[_0x13ed3c];return _0x2fb6e8;}function a0_0x10c1(){const _0x509aab=['log','SSE\x20connected','resumeId','token','toString','24856cExImL','disconnected','117EeDmKL','autoConnect','call','decode',']\x20[commhub:','type','slice','split','idle','reply','/events/','offline','report_status','20whfLXo','SSE\x20failed:\x20','104724ZLoDSu','disconnect','normal','url','parse','processInbox','get_inbox','2.0','emit','1830591SdfYRp','error','task','716712GJYvvZ','catch','heartbeatTimer','getReader','sdk','connected','running','Authorization','messages','replace','application/json','3402487xYzowj','heartbeatInterval','match','body','send_reply','heartbeat\x20failed:\x20','/mcp','result','data:\x20','sdk-','send_message','message','alias','tools/call','text','19165TAbOWU','agent','ack_inbox','broadcast','sseAbort','reconnectDelay','get_all_status','new_task','244ZWUyeI','SSE\x20reconnecting\x20in\x20','38savXng','AbortError','SSE\x20error:\x20','status','toTimeString','Bearer\x20','read','text/event-stream','connectSSE','300PBUSRe','sleep','min','80381qpLuBM','s...','from_session','new_message','inbox\x20error:\x20','1773OkknaX','completed','registered','signal'];a0_0x10c1=function(){return _0x509aab;};return a0_0x10c1();}var $=T;export{$ as default,T as CommHub};
1
+ const a0_0x57f1ff=a0_0x101e;function a0_0x101e(_0x54fed8,_0x2dad15){_0x54fed8=_0x54fed8-0x1f2;const _0x748cb4=a0_0x748c();let _0x101e72=_0x748cb4[_0x54fed8];return _0x101e72;}(function(_0x3d6ecb,_0x4654e8){const _0x2f9768=a0_0x101e,_0x565f3a=_0x3d6ecb();while(!![]){try{const _0x5d10f4=-parseInt(_0x2f9768(0x236))/0x1+parseInt(_0x2f9768(0x212))/0x2+-parseInt(_0x2f9768(0x221))/0x3+parseInt(_0x2f9768(0x1f8))/0x4+parseInt(_0x2f9768(0x203))/0x5+parseInt(_0x2f9768(0x219))/0x6+parseInt(_0x2f9768(0x237))/0x7;if(_0x5d10f4===_0x4654e8)break;else _0x565f3a['push'](_0x565f3a['shift']());}catch(_0x17c87d){_0x565f3a['push'](_0x565f3a['shift']());}}}(a0_0x748c,0xe5fe4));import{EventEmitter as a0_0x364783}from'events';import{hostname as a0_0x257b58}from'os';class T extends a0_0x364783{[a0_0x57f1ff(0x22e)];[a0_0x57f1ff(0x201)];[a0_0x57f1ff(0x20d)];['agent'];[a0_0x57f1ff(0x21b)];[a0_0x57f1ff(0x213)];[a0_0x57f1ff(0x231)];[a0_0x57f1ff(0x1f9)];[a0_0x57f1ff(0x1fa)];[a0_0x57f1ff(0x20b)]=!0x1;constructor(_0x7e9fc6){const _0xd27749=a0_0x57f1ff;super();if(this['url']=_0x7e9fc6['url'][_0xd27749(0x244)](/\/$/,''),this[_0xd27749(0x201)]=_0x7e9fc6[_0xd27749(0x201)],this[_0xd27749(0x20d)]=_0x7e9fc6['token'],this['agent']=_0x7e9fc6[_0xd27749(0x21d)]||_0xd27749(0x248),this[_0xd27749(0x21b)]=_0xd27749(0x1fc)+_0x7e9fc6[_0xd27749(0x201)]+'-'+Date['now']()[_0xd27749(0x218)](0x24),this['heartbeatInterval']=_0x7e9fc6[_0xd27749(0x213)]??0x2bf20,this[_0xd27749(0x231)]=_0x7e9fc6[_0xd27749(0x231)]??0xbb8,_0x7e9fc6[_0xd27749(0x23b)]!==!0x1)this['connect']();}['log'](_0x4b3a02){const _0x82dcbb=a0_0x57f1ff;console[_0x82dcbb(0x22f)]('['+new Date()[_0x82dcbb(0x20f)]()[_0x82dcbb(0x1f6)](0x0,0x8)+']\x20[commhub:'+this['alias']+']\x20'+_0x4b3a02);}async['call'](_0x317f8b,_0x4ea8d6){const _0x3d188e=a0_0x57f1ff;let _0x5a1afd={'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x5a1afd['Authorization']='Bearer\x20'+this[_0x3d188e(0x20d)];let _0x153bee=await(await fetch(this[_0x3d188e(0x22e)]+_0x3d188e(0x1f5),{'method':_0x3d188e(0x228),'headers':_0x5a1afd,'body':JSON[_0x3d188e(0x22b)]({'jsonrpc':_0x3d188e(0x210),'id':Date[_0x3d188e(0x245)](),'method':'tools/call','params':{'name':_0x317f8b,'arguments':_0x4ea8d6}})}))[_0x3d188e(0x239)](),_0x30b6ca=_0x153bee[_0x3d188e(0x247)](/data: (.+)/),_0xf47e6f=_0x30b6ca?JSON['parse'](_0x30b6ca[0x1]):JSON[_0x3d188e(0x214)](_0x153bee),_0x362790=_0xf47e6f?.[_0x3d188e(0x21a)]?.[_0x3d188e(0x216)]?.[0x0]?.[_0x3d188e(0x239)];return _0x362790?JSON[_0x3d188e(0x214)](_0x362790):_0xf47e6f;}async[a0_0x57f1ff(0x232)](){const _0x2b9a59=a0_0x57f1ff;if(this[_0x2b9a59(0x20b)])return;this['running']=!0x0,await this['status'](_0x2b9a59(0x21f)),this['log'](_0x2b9a59(0x22a)),this[_0x2b9a59(0x1f9)]=setInterval(()=>{const _0x3fdc0b=_0x2b9a59;this[_0x3fdc0b(0x23c)](_0x3fdc0b(0x21f))[_0x3fdc0b(0x211)](_0x399825=>this[_0x3fdc0b(0x22f)]('heartbeat\x20failed:\x20'+_0x399825[_0x3fdc0b(0x200)]));},this['heartbeatInterval']),this[_0x2b9a59(0x1fd)]();}async['disconnect'](){const _0x44a6d0=a0_0x57f1ff;if(this[_0x44a6d0(0x20b)]=!0x1,this[_0x44a6d0(0x1fa)]?.[_0x44a6d0(0x204)](),this[_0x44a6d0(0x1f9)])clearInterval(this[_0x44a6d0(0x1f9)]);await this[_0x44a6d0(0x23c)](_0x44a6d0(0x1f7))['catch'](()=>{}),this[_0x44a6d0(0x22f)](_0x44a6d0(0x206));}async[a0_0x57f1ff(0x22d)](_0x3858c9,_0x4ed4d8,_0x294b99=a0_0x57f1ff(0x233)){const _0x589252=a0_0x57f1ff;return this[_0x589252(0x23f)]('send_task',{'alias':_0x3858c9,'task':_0x4ed4d8,'priority':_0x294b99,'from_session':this[_0x589252(0x201)]});}async[a0_0x57f1ff(0x200)](_0x539fd7,_0x176a28){const _0x88635=a0_0x57f1ff;return this[_0x88635(0x23f)](_0x88635(0x20e),{'alias':_0x539fd7,'message':_0x176a28,'from_session':this[_0x88635(0x201)]});}async[a0_0x57f1ff(0x217)](_0x2d9386,_0x415560,_0x425cd6=a0_0x57f1ff(0x220)){const _0x3132ee=a0_0x57f1ff;return this[_0x3132ee(0x23f)](_0x3132ee(0x1ff),{'in_reply_to':_0x2d9386,'text':_0x415560,'status':_0x425cd6});}async[a0_0x57f1ff(0x23c)](_0x28243d,_0x7e6cf2){const _0x443c45=a0_0x57f1ff;return this[_0x443c45(0x23f)](_0x443c45(0x240),{'resume_id':this['resumeId'],'alias':this['alias'],'status':_0x28243d,'server':a0_0x257b58(),'hostname':a0_0x257b58(),'agent':this[_0x443c45(0x21d)],'project_dir':process['cwd'](),..._0x7e6cf2});}async['getAllStatus'](){const _0x20a559=a0_0x57f1ff;return this[_0x20a559(0x23f)]('get_all_status',{});}async[a0_0x57f1ff(0x225)](_0x307972,_0x21c6ce){const _0x3f35ec=a0_0x57f1ff;return this[_0x3f35ec(0x23f)](_0x3f35ec(0x225),{'message':_0x307972,'filter_server':_0x21c6ce?.[_0x3f35ec(0x208)],'filter_status':_0x21c6ce?.[_0x3f35ec(0x23c)]});}async[a0_0x57f1ff(0x1fd)](){const _0x2536bc=a0_0x57f1ff;let _0x2901c9=encodeURIComponent(this[_0x2536bc(0x201)]),_0x1cad20=this[_0x2536bc(0x22e)]+'/events/'+_0x2901c9,_0x3c4ca0=this[_0x2536bc(0x231)];while(this['running']){try{this[_0x2536bc(0x1fa)]=new AbortController();let _0x5f0c75={'Accept':_0x2536bc(0x23e)};if(this[_0x2536bc(0x20d)])_0x5f0c75['Authorization']=_0x2536bc(0x202)+this['token'];let _0xa6ae1f=await fetch(_0x1cad20,{'headers':_0x5f0c75,'signal':this[_0x2536bc(0x1fa)][_0x2536bc(0x241)]});if(!_0xa6ae1f['ok']||!_0xa6ae1f[_0x2536bc(0x227)]){this[_0x2536bc(0x22f)](_0x2536bc(0x1fb)+_0xa6ae1f[_0x2536bc(0x23c)]),await this['sleep'](_0x3c4ca0),_0x3c4ca0=Math[_0x2536bc(0x23a)](_0x3c4ca0*1.5,0xea60);continue;}_0x3c4ca0=this[_0x2536bc(0x231)];let _0x15d782=_0xa6ae1f['body'][_0x2536bc(0x205)](),_0x3b2994=new TextDecoder(),_0x5719cd='';while(this[_0x2536bc(0x20b)]){let {done:_0x61e56a,value:_0x46bff0}=await _0x15d782['read']();if(_0x61e56a)break;_0x5719cd+=_0x3b2994[_0x2536bc(0x230)](_0x46bff0,{'stream':!0x0});let _0xef2cec=_0x5719cd[_0x2536bc(0x226)]('\x0a');_0x5719cd=_0xef2cec[_0x2536bc(0x1fe)]()||'';for(let _0x3b7359 of _0xef2cec){if(!_0x3b7359[_0x2536bc(0x224)](_0x2536bc(0x222)))continue;try{let _0x165e54=JSON[_0x2536bc(0x214)](_0x3b7359[_0x2536bc(0x1f6)](0x6));if(_0x165e54[_0x2536bc(0x234)]===_0x2536bc(0x22c)){this[_0x2536bc(0x22f)](_0x2536bc(0x1f3)),this[_0x2536bc(0x1f4)]('connected');continue;}if(_0x165e54['type']===_0x2536bc(0x235)||_0x165e54[_0x2536bc(0x234)]===_0x2536bc(0x20c)||_0x165e54[_0x2536bc(0x234)]===_0x2536bc(0x225))await this[_0x2536bc(0x207)]();}catch{}}}}catch(_0x269680){if(_0x269680[_0x2536bc(0x229)]===_0x2536bc(0x215))break;this[_0x2536bc(0x1f4)](_0x2536bc(0x23d),_0x269680),this[_0x2536bc(0x22f)](_0x2536bc(0x238)+_0x269680[_0x2536bc(0x200)]);}if(this[_0x2536bc(0x20b)])this['emit'](_0x2536bc(0x206)),this['log'](_0x2536bc(0x21c)+_0x3c4ca0/0x3e8+_0x2536bc(0x209)),await this['sleep'](_0x3c4ca0),_0x3c4ca0=Math[_0x2536bc(0x23a)](_0x3c4ca0*1.5,0xea60);}}async[a0_0x57f1ff(0x207)](){const _0x248cc7=a0_0x57f1ff;try{let _0x12827d=(await this['call'](_0x248cc7(0x20a),{'alias':this[_0x248cc7(0x201)],'limit':0xa}))?.[_0x248cc7(0x242)]||[];for(let _0x2cc4c9 of _0x12827d)await this[_0x248cc7(0x23f)](_0x248cc7(0x243),{'alias':this[_0x248cc7(0x201)],'message_id':_0x2cc4c9['id']}),this[_0x248cc7(0x22f)]('←\x20'+_0x2cc4c9[_0x248cc7(0x1f2)]+':\x20'+_0x2cc4c9[_0x248cc7(0x216)][_0x248cc7(0x1f6)](0x0,0x3c)),this[_0x248cc7(0x1f4)](_0x248cc7(0x21e),_0x2cc4c9),this[_0x248cc7(0x1f4)](_0x248cc7(0x200),_0x2cc4c9);}catch(_0x2d0577){this[_0x248cc7(0x22f)](_0x248cc7(0x246)+_0x2d0577['message']);}}[a0_0x57f1ff(0x223)](_0x1f3f87){return new Promise(_0xf1fa84=>setTimeout(_0xf1fa84,_0x1f3f87));}}var $=T;function a0_0x748c(){const _0xe4972d=['autoConnect','status','error','text/event-stream','call','report_status','signal','messages','ack_inbox','replace','now','inbox\x20error:\x20','match','sdk','from_session','SSE\x20connected','emit','/mcp','slice','offline','5667020RNCYmH','heartbeatTimer','sseAbort','SSE\x20failed:\x20','sdk-','connectSSE','pop','send_reply','message','alias','Bearer\x20','1455210fYJmFf','abort','getReader','disconnected','processInbox','server','s...','get_inbox','running','new_message','token','send_message','toTimeString','2.0','catch','749774OjJRIK','heartbeatInterval','parse','AbortError','content','reply','toString','1412286bwWKGN','result','resumeId','SSE\x20reconnecting\x20in\x20','agent','task','idle','completed','4672041vjJjbT','data:\x20','sleep','startsWith','broadcast','split','body','POST','name','registered','stringify','connected','send','url','log','decode','reconnectDelay','connect','normal','type','new_task','358874HzVAkD','3781456xzcCLB','SSE\x20error:\x20','text','min'];a0_0x748c=function(){return _0xe4972d;};return a0_0x748c();}export{$ as default,T as CommHub};
@@ -94,4 +94,30 @@ export declare function parsePostContent(rawJson: string): string;
94
94
  * @internal exported for unit tests.
95
95
  */
96
96
  export declare function extractPostImageKeys(rawJson: string): string[];
97
+ /**
98
+ * Feishu text-message practical chunk threshold (RFC-020 §16).
99
+ *
100
+ * The official `im.message.create`/`reply` content limit for
101
+ * `msg_type:text` is ~30 KB JSON-encoded (`{"text":"..."}`), comfortably
102
+ * under what any reasonable bot reply produces. We chunk below that
103
+ * limit at 4000 CHARACTERS — gives a roomy safety margin for multi-byte
104
+ * UTF-8 and lets us split at paragraph boundaries cleanly. Chosen
105
+ * conservatively after Vincent 2026-06-30 ask "issue 发文字" (i.e.
106
+ * never silently fall back to PNG for "long" plain-text replies — they
107
+ * just chunk into multiple messages).
108
+ *
109
+ * Single-message ceiling, NOT a per-second rate limit (that's separate;
110
+ * RFC-020 §4.4).
111
+ */
112
+ export declare const FEISHU_TEXT_SINGLE_LIMIT = 4000;
113
+ /**
114
+ * Split a long text into chunks ≤ `maxChars`. Tries paragraph boundaries
115
+ * (`\n\n`), then line boundaries (`\n`), then word boundaries (space),
116
+ * then hard byte split. Output preserves the original text content
117
+ * (sum of chunks == original, modulo the boundary character that gets
118
+ * consumed by the split).
119
+ *
120
+ * If the input is already short enough, returns a single-element array.
121
+ */
122
+ export declare function splitTextForFeishu(text: string, maxChars: number): string[];
97
123
  export {};
@@ -8,6 +8,31 @@ export interface FeishuAccessList {
8
8
  /** Feishu chat_ids the bot is permitted to listen in. */
9
9
  allowChats: string[];
10
10
  }
11
+ /**
12
+ * Outbound text-reply rendering mode (RFC-020 §16). Controls how
13
+ * `adapter.send` handles a text/markdown payload that doesn't already
14
+ * carry an `imagePath` / `files[]` (those upload routes are unaffected).
15
+ *
16
+ * - "plain" (DEFAULT): always send `msg_type:text`. Bot replies are
17
+ * fully copy-pasteable in Feishu; long replies are chunked into
18
+ * multiple text messages instead of being PNG-rendered. This is the
19
+ * correct default for issue/code/CLI bot replies where users want
20
+ * to grab the text. Vincent 2026-06-30 explicit ask: "issue 发文字".
21
+ *
22
+ * - "card": short markdown (bold, list, link, inline code) goes via
23
+ * schema 1.0 interactive card with `markdown` element — text stays
24
+ * copy-friendly + gets bolds/bullets styled. Heading/table/long
25
+ * fall back to plain text (no PNG). Suited to operators who want
26
+ * light formatting without losing copy.
27
+ *
28
+ * - "auto": preserve the pre-2026-06-30 behavior — markdown with
29
+ * headings / tables / >2000 chars is rendered to PNG via headless
30
+ * chromium (#329 path), short markdown goes to schema 1.0 card,
31
+ * plain text goes to msg_type:text. Highest fidelity at the cost
32
+ * of copy-paste. Opt-in for operators who genuinely need rendered
33
+ * tables / heading hierarchy in chat.
34
+ */
35
+ export type OutboundRenderMode = "plain" | "card" | "auto";
11
36
  export interface FeishuChannelConfig {
12
37
  appId: string;
13
38
  appSecret: string;
@@ -20,6 +45,12 @@ export interface FeishuChannelConfig {
20
45
  auditRaw: boolean;
21
46
  /** Per-task timeout in ms; default 5 min (RFC-020 §4.5). */
22
47
  taskTimeoutMs: number;
48
+ /**
49
+ * RFC-020 §16 outbound rendering mode for text replies. Default `"plain"`.
50
+ * See `OutboundRenderMode` for per-mode semantics. Channels that omit
51
+ * the field get `"plain"` — Vincent's "issue 发文字" default.
52
+ */
53
+ outboundRender: OutboundRenderMode;
23
54
  /**
24
55
  * Absolute path to the channel directory. The adapter writes downloaded
25
56
  * inbound media to `<channelDir>/media/` (M5c). Populated by the loader so