@sleep2agi/agent-network 2.3.0-preview.14 → 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
- function a0_0x2f33(_0x353897,_0x409370){_0x353897=_0x353897-0x126;const _0x48c7f0=a0_0x48c7();let _0x2f3388=_0x48c7f0[_0x353897];return _0x2f3388;}const a0_0x1e95e1=a0_0x2f33;(function(_0x5e9086,_0x2b0a96){const _0x4d805e=a0_0x2f33,_0x1d60c8=_0x5e9086();while(!![]){try{const _0x2072f3=-parseInt(_0x4d805e(0x169))/0x1*(parseInt(_0x4d805e(0x13b))/0x2)+parseInt(_0x4d805e(0x152))/0x3*(parseInt(_0x4d805e(0x129))/0x4)+-parseInt(_0x4d805e(0x14b))/0x5*(parseInt(_0x4d805e(0x12c))/0x6)+-parseInt(_0x4d805e(0x15b))/0x7+-parseInt(_0x4d805e(0x177))/0x8+parseInt(_0x4d805e(0x128))/0x9+parseInt(_0x4d805e(0x14f))/0xa;if(_0x2072f3===_0x2b0a96)break;else _0x1d60c8['push'](_0x1d60c8['shift']());}catch(_0x207967){_0x1d60c8['push'](_0x1d60c8['shift']());}}}(a0_0x48c7,0xa0827));import{EventEmitter as a0_0xa87c42}from'events';import{hostname as a0_0x40619f}from'os';class T extends a0_0xa87c42{[a0_0x1e95e1(0x15e)];[a0_0x1e95e1(0x178)];[a0_0x1e95e1(0x13c)];[a0_0x1e95e1(0x16e)];[a0_0x1e95e1(0x12a)];['heartbeatInterval'];[a0_0x1e95e1(0x12b)];[a0_0x1e95e1(0x13e)];[a0_0x1e95e1(0x168)];[a0_0x1e95e1(0x170)]=!0x1;constructor(_0x383ac3){const _0x4a3233=a0_0x1e95e1;super();if(this[_0x4a3233(0x15e)]=_0x383ac3['url'][_0x4a3233(0x134)](/\/$/,''),this['alias']=_0x383ac3[_0x4a3233(0x178)],this['token']=_0x383ac3['token'],this['agent']=_0x383ac3[_0x4a3233(0x16e)]||_0x4a3233(0x154),this['resumeId']=_0x4a3233(0x173)+_0x383ac3[_0x4a3233(0x178)]+'-'+Date[_0x4a3233(0x14a)]()[_0x4a3233(0x126)](0x24),this[_0x4a3233(0x148)]=_0x383ac3['heartbeatInterval']??0x2bf20,this[_0x4a3233(0x12b)]=_0x383ac3[_0x4a3233(0x12b)]??0xbb8,_0x383ac3[_0x4a3233(0x163)]!==!0x1)this[_0x4a3233(0x167)]();}[a0_0x1e95e1(0x133)](_0x23283f){const _0x267d49=a0_0x1e95e1;console['log']('['+new Date()[_0x267d49(0x141)]()['slice'](0x0,0x8)+_0x267d49(0x149)+this[_0x267d49(0x178)]+']\x20'+_0x23283f);}async['call'](_0x34936d,_0x33d3de){const _0x5a6c17=a0_0x1e95e1;let _0x18efe6={'Content-Type':_0x5a6c17(0x15f),'Accept':_0x5a6c17(0x146)};if(this[_0x5a6c17(0x13c)])_0x18efe6[_0x5a6c17(0x13d)]='Bearer\x20'+this[_0x5a6c17(0x13c)];let _0x41a697=await(await fetch(this[_0x5a6c17(0x15e)]+_0x5a6c17(0x13f),{'method':'POST','headers':_0x18efe6,'body':JSON['stringify']({'jsonrpc':_0x5a6c17(0x166),'id':Date[_0x5a6c17(0x14a)](),'method':_0x5a6c17(0x131),'params':{'name':_0x34936d,'arguments':_0x33d3de}})}))[_0x5a6c17(0x130)](),_0x1acb95=_0x41a697[_0x5a6c17(0x16a)](/data: (.+)/),_0x2e672d=_0x1acb95?JSON[_0x5a6c17(0x16c)](_0x1acb95[0x1]):JSON['parse'](_0x41a697),_0x16eea7=_0x2e672d?.[_0x5a6c17(0x142)]?.[_0x5a6c17(0x14e)]?.[0x0]?.[_0x5a6c17(0x130)];return _0x16eea7?JSON[_0x5a6c17(0x16c)](_0x16eea7):_0x2e672d;}async[a0_0x1e95e1(0x167)](){const _0x377d68=a0_0x1e95e1;if(this[_0x377d68(0x170)])return;this[_0x377d68(0x170)]=!0x0,await this[_0x377d68(0x127)](_0x377d68(0x161)),this[_0x377d68(0x133)](_0x377d68(0x17f)),this['heartbeatTimer']=setInterval(()=>{const _0x20cf1b=_0x377d68;this['status'](_0x20cf1b(0x161))['catch'](_0x440141=>this['log'](_0x20cf1b(0x16f)+_0x440141[_0x20cf1b(0x145)]));},this[_0x377d68(0x148)]),this[_0x377d68(0x162)]();}async[a0_0x1e95e1(0x176)](){const _0x3fd33d=a0_0x1e95e1;if(this['running']=!0x1,this[_0x3fd33d(0x168)]?.[_0x3fd33d(0x17d)](),this['heartbeatTimer'])clearInterval(this[_0x3fd33d(0x13e)]);await this[_0x3fd33d(0x127)]('offline')[_0x3fd33d(0x12e)](()=>{}),this[_0x3fd33d(0x133)](_0x3fd33d(0x140));}async[a0_0x1e95e1(0x180)](_0x33fe37,_0x28a774,_0x796b89=a0_0x1e95e1(0x165)){const _0x12d176=a0_0x1e95e1;return this[_0x12d176(0x147)](_0x12d176(0x175),{'alias':_0x33fe37,'task':_0x28a774,'priority':_0x796b89,'from_session':this[_0x12d176(0x178)]});}async[a0_0x1e95e1(0x145)](_0x3dbb4d,_0x6c0130){const _0x24d0a1=a0_0x1e95e1;return this[_0x24d0a1(0x147)](_0x24d0a1(0x17c),{'alias':_0x3dbb4d,'message':_0x6c0130,'from_session':this[_0x24d0a1(0x178)]});}async[a0_0x1e95e1(0x138)](_0x3c2bb0,_0x440799,_0x412930=a0_0x1e95e1(0x155)){return this['call']('send_reply',{'in_reply_to':_0x3c2bb0,'text':_0x440799,'status':_0x412930});}async[a0_0x1e95e1(0x127)](_0x2e9ed9,_0x3a90af){const _0x1faa59=a0_0x1e95e1;return this[_0x1faa59(0x147)](_0x1faa59(0x164),{'resume_id':this[_0x1faa59(0x12a)],'alias':this['alias'],'status':_0x2e9ed9,'server':a0_0x40619f(),'hostname':a0_0x40619f(),'agent':this['agent'],'project_dir':process[_0x1faa59(0x12f)](),..._0x3a90af});}async[a0_0x1e95e1(0x17a)](){const _0x49cef5=a0_0x1e95e1;return this[_0x49cef5(0x147)]('get_all_status',{});}async[a0_0x1e95e1(0x15d)](_0x53a4f2,_0x178deb){const _0x298063=a0_0x1e95e1;return this[_0x298063(0x147)]('broadcast',{'message':_0x53a4f2,'filter_server':_0x178deb?.[_0x298063(0x171)],'filter_status':_0x178deb?.[_0x298063(0x127)]});}async[a0_0x1e95e1(0x162)](){const _0x191183=a0_0x1e95e1;let _0x393880=encodeURIComponent(this[_0x191183(0x178)]),_0xab3694=this[_0x191183(0x15e)]+_0x191183(0x139)+_0x393880,_0x59aff1=this[_0x191183(0x12b)];while(this['running']){try{this[_0x191183(0x168)]=new AbortController();let _0x49ef84={'Accept':_0x191183(0x159)};if(this['token'])_0x49ef84[_0x191183(0x13d)]=_0x191183(0x160)+this[_0x191183(0x13c)];let _0x2dd256=await fetch(_0xab3694,{'headers':_0x49ef84,'signal':this[_0x191183(0x168)][_0x191183(0x135)]});if(!_0x2dd256['ok']||!_0x2dd256['body']){this[_0x191183(0x133)](_0x191183(0x143)+_0x2dd256[_0x191183(0x127)]),await this[_0x191183(0x14d)](_0x59aff1),_0x59aff1=Math[_0x191183(0x12d)](_0x59aff1*1.5,0xea60);continue;}_0x59aff1=this[_0x191183(0x12b)];let _0x491a0d=_0x2dd256['body'][_0x191183(0x179)](),_0x4cff4c=new TextDecoder(),_0x4e4b8b='';while(this[_0x191183(0x170)]){let {done:_0x1d0da4,value:_0x4217c3}=await _0x491a0d['read']();if(_0x1d0da4)break;_0x4e4b8b+=_0x4cff4c[_0x191183(0x172)](_0x4217c3,{'stream':!0x0});let _0x20f82f=_0x4e4b8b['split']('\x0a');_0x4e4b8b=_0x20f82f[_0x191183(0x150)]()||'';for(let _0x362f48 of _0x20f82f){if(!_0x362f48[_0x191183(0x17e)](_0x191183(0x15c)))continue;try{let _0x593020=JSON[_0x191183(0x16c)](_0x362f48['slice'](0x6));if(_0x593020[_0x191183(0x15a)]===_0x191183(0x158)){this[_0x191183(0x133)](_0x191183(0x151)),this[_0x191183(0x157)]('connected');continue;}if(_0x593020[_0x191183(0x15a)]==='new_task'||_0x593020[_0x191183(0x15a)]===_0x191183(0x132)||_0x593020[_0x191183(0x15a)]===_0x191183(0x15d))await this[_0x191183(0x156)]();}catch{}}}}catch(_0x3c3421){if(_0x3c3421[_0x191183(0x14c)]==='AbortError')break;this['emit']('error',_0x3c3421),this['log'](_0x191183(0x144)+_0x3c3421[_0x191183(0x145)]);}if(this['running'])this[_0x191183(0x157)](_0x191183(0x140)),this['log'](_0x191183(0x136)+_0x59aff1/0x3e8+_0x191183(0x16d)),await this[_0x191183(0x14d)](_0x59aff1),_0x59aff1=Math[_0x191183(0x12d)](_0x59aff1*1.5,0xea60);}}async['processInbox'](){const _0x152732=a0_0x1e95e1;try{let _0x2c93fe=(await this['call'](_0x152732(0x174),{'alias':this[_0x152732(0x178)],'limit':0xa}))?.[_0x152732(0x137)]||[];for(let _0x435e5b of _0x2c93fe)await this[_0x152732(0x147)](_0x152732(0x16b),{'alias':this['alias'],'message_id':_0x435e5b['id']}),this[_0x152732(0x133)]('←\x20'+_0x435e5b[_0x152732(0x13a)]+':\x20'+_0x435e5b['content'][_0x152732(0x17b)](0x0,0x3c)),this['emit']('task',_0x435e5b),this['emit'](_0x152732(0x145),_0x435e5b);}catch(_0x54ab5a){this[_0x152732(0x133)](_0x152732(0x153)+_0x54ab5a[_0x152732(0x145)]);}}[a0_0x1e95e1(0x14d)](_0x13fa4c){return new Promise(_0xe9e230=>setTimeout(_0xe9e230,_0x13fa4c));}}function a0_0x48c7(){const _0x1b6369=['8763PSbdXh','inbox\x20error:\x20','sdk','completed','processInbox','emit','connected','text/event-stream','type','7011368ArtPVa','data:\x20','broadcast','url','application/json','Bearer\x20','idle','connectSSE','autoConnect','report_status','normal','2.0','connect','sseAbort','127pSUIWS','match','ack_inbox','parse','s...','agent','heartbeat\x20failed:\x20','running','server','decode','sdk-','get_inbox','send_task','disconnect','3698576cHYcEN','alias','getReader','getAllStatus','slice','send_message','abort','startsWith','registered','send','toString','status','5222439sSuAeN','404NqbPLX','resumeId','reconnectDelay','42726ATMTpf','min','catch','cwd','text','tools/call','new_message','log','replace','signal','SSE\x20reconnecting\x20in\x20','messages','reply','/events/','from_session','548JRkBHP','token','Authorization','heartbeatTimer','/mcp','disconnected','toTimeString','result','SSE\x20failed:\x20','SSE\x20error:\x20','message','application/json,\x20text/event-stream','call','heartbeatInterval',']\x20[commhub:','now','705oitOvq','name','sleep','content','22849600BMFyOy','pop','SSE\x20connected'];a0_0x48c7=function(){return _0x1b6369;};return a0_0x48c7();}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