@sleep2agi/agent-network 2.3.0-preview.26 → 2.3.0-preview.28

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_0x207ba8=a0_0xb317;(function(_0x3b19df,_0x200a85){const _0x20e34a=a0_0xb317,_0x27403e=_0x3b19df();while(!![]){try{const _0x1df244=parseInt(_0x20e34a(0x196))/0x1+parseInt(_0x20e34a(0x1ce))/0x2*(parseInt(_0x20e34a(0x1b1))/0x3)+parseInt(_0x20e34a(0x1d5))/0x4*(-parseInt(_0x20e34a(0x1cf))/0x5)+parseInt(_0x20e34a(0x1b3))/0x6+-parseInt(_0x20e34a(0x19c))/0x7+-parseInt(_0x20e34a(0x1d6))/0x8*(-parseInt(_0x20e34a(0x1b7))/0x9)+-parseInt(_0x20e34a(0x1c7))/0xa*(parseInt(_0x20e34a(0x1c4))/0xb);if(_0x1df244===_0x200a85)break;else _0x27403e['push'](_0x27403e['shift']());}catch(_0x5d1b1d){_0x27403e['push'](_0x27403e['shift']());}}}(a0_0x4a6c,0x8217c));import{EventEmitter as a0_0x3b927b}from'events';import{hostname as a0_0x3e26be}from'os';function a0_0x4a6c(){const _0x362514=['pop','processInbox','disconnected','heartbeat\x20failed:\x20','872063lpsakg','2.0','replace','send','reply','text/event-stream','1096193fnosFi','abort','log','new_message','getReader','registered','message','sseAbort','normal','url','agent','emit','Bearer\x20','get_all_status','getAllStatus','error','/mcp','server','content','ack_inbox','application/json','3JrdMKn','Authorization','147348wPhCDk','POST','toTimeString','new_task','17181mBXUlf','slice','disconnect','result','SSE\x20failed:\x20','completed',']\x20[commhub:','body','broadcast','split','running','connected','resumeId','49434xGnUza','alias','SSE\x20reconnecting\x20in\x20','1170vWvFxv','get_inbox','match','signal','inbox\x20error:\x20','from_session','call','1333118QpukGo','3639070zfThAC','text','/events/','AbortError','send_message','reconnectDelay','4CcaYfn','1592xyrURf','min','s...','sleep','SSE\x20error:\x20','name','parse','connect','send_reply','read','heartbeatInterval','status','connectSSE','sdk','heartbeatTimer','type','send_task','stringify','token'];a0_0x4a6c=function(){return _0x362514;};return a0_0x4a6c();}class T extends a0_0x3b927b{[a0_0x207ba8(0x1a5)];[a0_0x207ba8(0x1c5)];['token'];[a0_0x207ba8(0x1a6)];[a0_0x207ba8(0x1c3)];['heartbeatInterval'];[a0_0x207ba8(0x1d4)];[a0_0x207ba8(0x18d)];['sseAbort'];[a0_0x207ba8(0x1c1)]=!0x1;constructor(_0x5054ab){const _0x1474c2=a0_0x207ba8;super();if(this[_0x1474c2(0x1a5)]=_0x5054ab[_0x1474c2(0x1a5)][_0x1474c2(0x198)](/\/$/,''),this[_0x1474c2(0x1c5)]=_0x5054ab[_0x1474c2(0x1c5)],this[_0x1474c2(0x191)]=_0x5054ab[_0x1474c2(0x191)],this[_0x1474c2(0x1a6)]=_0x5054ab[_0x1474c2(0x1a6)]||_0x1474c2(0x18c),this[_0x1474c2(0x1c3)]='sdk-'+_0x5054ab['alias']+'-'+Date['now']()['toString'](0x24),this['heartbeatInterval']=_0x5054ab[_0x1474c2(0x189)]??0x2bf20,this[_0x1474c2(0x1d4)]=_0x5054ab['reconnectDelay']??0xbb8,_0x5054ab['autoConnect']!==!0x1)this['connect']();}[a0_0x207ba8(0x19e)](_0x4f4a62){const _0x53bcb1=a0_0x207ba8;console[_0x53bcb1(0x19e)]('['+new Date()[_0x53bcb1(0x1b5)]()[_0x53bcb1(0x1b8)](0x0,0x8)+_0x53bcb1(0x1bd)+this[_0x53bcb1(0x1c5)]+']\x20'+_0x4f4a62);}async['call'](_0x296e18,_0x23821c){const _0x31bcb7=a0_0x207ba8;let _0x3f51ee={'Content-Type':_0x31bcb7(0x1b0),'Accept':'application/json,\x20text/event-stream'};if(this[_0x31bcb7(0x191)])_0x3f51ee[_0x31bcb7(0x1b2)]=_0x31bcb7(0x1a8)+this[_0x31bcb7(0x191)];let _0x1b71b3=await(await fetch(this[_0x31bcb7(0x1a5)]+_0x31bcb7(0x1ac),{'method':_0x31bcb7(0x1b4),'headers':_0x3f51ee,'body':JSON[_0x31bcb7(0x190)]({'jsonrpc':_0x31bcb7(0x197),'id':Date['now'](),'method':'tools/call','params':{'name':_0x296e18,'arguments':_0x23821c}})}))[_0x31bcb7(0x1d0)](),_0xe8bbd3=_0x1b71b3[_0x31bcb7(0x1c9)](/data: (.+)/),_0x289e12=_0xe8bbd3?JSON[_0x31bcb7(0x1dc)](_0xe8bbd3[0x1]):JSON[_0x31bcb7(0x1dc)](_0x1b71b3),_0x91f3d=_0x289e12?.[_0x31bcb7(0x1ba)]?.[_0x31bcb7(0x1ae)]?.[0x0]?.[_0x31bcb7(0x1d0)];return _0x91f3d?JSON[_0x31bcb7(0x1dc)](_0x91f3d):_0x289e12;}async[a0_0x207ba8(0x1dd)](){const _0x5929c7=a0_0x207ba8;if(this[_0x5929c7(0x1c1)])return;this[_0x5929c7(0x1c1)]=!0x0,await this['status']('idle'),this['log'](_0x5929c7(0x1a1)),this[_0x5929c7(0x18d)]=setInterval(()=>{const _0x340be8=_0x5929c7;this[_0x340be8(0x18a)]('idle')['catch'](_0x127b1d=>this[_0x340be8(0x19e)](_0x340be8(0x195)+_0x127b1d[_0x340be8(0x1a2)]));},this[_0x5929c7(0x189)]),this['connectSSE']();}async[a0_0x207ba8(0x1b9)](){const _0x14a408=a0_0x207ba8;if(this['running']=!0x1,this[_0x14a408(0x1a3)]?.[_0x14a408(0x19d)](),this[_0x14a408(0x18d)])clearInterval(this[_0x14a408(0x18d)]);await this[_0x14a408(0x18a)]('offline')['catch'](()=>{}),this[_0x14a408(0x19e)](_0x14a408(0x194));}async[a0_0x207ba8(0x199)](_0x3c1de7,_0x2c4077,_0x4a982d=a0_0x207ba8(0x1a4)){const _0x446524=a0_0x207ba8;return this[_0x446524(0x1cd)](_0x446524(0x18f),{'alias':_0x3c1de7,'task':_0x2c4077,'priority':_0x4a982d,'from_session':this['alias']});}async[a0_0x207ba8(0x1a2)](_0x924501,_0x27c3f2){const _0x58a9d9=a0_0x207ba8;return this[_0x58a9d9(0x1cd)](_0x58a9d9(0x1d3),{'alias':_0x924501,'message':_0x27c3f2,'from_session':this[_0x58a9d9(0x1c5)]});}async[a0_0x207ba8(0x19a)](_0x13af1d,_0x333ba2,_0x534fc4=a0_0x207ba8(0x1bc)){const _0x47b3d6=a0_0x207ba8;return this[_0x47b3d6(0x1cd)](_0x47b3d6(0x1de),{'in_reply_to':_0x13af1d,'text':_0x333ba2,'status':_0x534fc4});}async[a0_0x207ba8(0x18a)](_0x4988c9,_0x4b4fc5){const _0x3a3c64=a0_0x207ba8;return this[_0x3a3c64(0x1cd)]('report_status',{'resume_id':this['resumeId'],'alias':this[_0x3a3c64(0x1c5)],'status':_0x4988c9,'server':a0_0x3e26be(),'hostname':a0_0x3e26be(),'agent':this[_0x3a3c64(0x1a6)],'project_dir':process['cwd'](),..._0x4b4fc5});}async[a0_0x207ba8(0x1aa)](){const _0x115b02=a0_0x207ba8;return this[_0x115b02(0x1cd)](_0x115b02(0x1a9),{});}async['broadcast'](_0x5f3666,_0x1c5ed2){const _0x1ad14f=a0_0x207ba8;return this['call']('broadcast',{'message':_0x5f3666,'filter_server':_0x1c5ed2?.[_0x1ad14f(0x1ad)],'filter_status':_0x1c5ed2?.[_0x1ad14f(0x18a)]});}async[a0_0x207ba8(0x18b)](){const _0x27c5d5=a0_0x207ba8;let _0x1bb9ae=encodeURIComponent(this[_0x27c5d5(0x1c5)]),_0x217b7d=this[_0x27c5d5(0x1a5)]+_0x27c5d5(0x1d1)+_0x1bb9ae,_0x5143cd=this[_0x27c5d5(0x1d4)];while(this[_0x27c5d5(0x1c1)]){try{this[_0x27c5d5(0x1a3)]=new AbortController();let _0x39eec6={'Accept':_0x27c5d5(0x19b)};if(this['token'])_0x39eec6[_0x27c5d5(0x1b2)]=_0x27c5d5(0x1a8)+this[_0x27c5d5(0x191)];let _0x4dde27=await fetch(_0x217b7d,{'headers':_0x39eec6,'signal':this[_0x27c5d5(0x1a3)][_0x27c5d5(0x1ca)]});if(!_0x4dde27['ok']||!_0x4dde27[_0x27c5d5(0x1be)]){this[_0x27c5d5(0x19e)](_0x27c5d5(0x1bb)+_0x4dde27[_0x27c5d5(0x18a)]),await this[_0x27c5d5(0x1d9)](_0x5143cd),_0x5143cd=Math[_0x27c5d5(0x1d7)](_0x5143cd*1.5,0xea60);continue;}_0x5143cd=this[_0x27c5d5(0x1d4)];let _0xfa0403=_0x4dde27[_0x27c5d5(0x1be)][_0x27c5d5(0x1a0)](),_0x2b27ea=new TextDecoder(),_0x2043e9='';while(this[_0x27c5d5(0x1c1)]){let {done:_0x82e737,value:_0x508446}=await _0xfa0403[_0x27c5d5(0x1df)]();if(_0x82e737)break;_0x2043e9+=_0x2b27ea['decode'](_0x508446,{'stream':!0x0});let _0x49d281=_0x2043e9[_0x27c5d5(0x1c0)]('\x0a');_0x2043e9=_0x49d281[_0x27c5d5(0x192)]()||'';for(let _0x256ab3 of _0x49d281){if(!_0x256ab3['startsWith']('data:\x20'))continue;try{let _0x26221f=JSON[_0x27c5d5(0x1dc)](_0x256ab3[_0x27c5d5(0x1b8)](0x6));if(_0x26221f[_0x27c5d5(0x18e)]==='connected'){this[_0x27c5d5(0x19e)]('SSE\x20connected'),this[_0x27c5d5(0x1a7)](_0x27c5d5(0x1c2));continue;}if(_0x26221f[_0x27c5d5(0x18e)]===_0x27c5d5(0x1b6)||_0x26221f['type']===_0x27c5d5(0x19f)||_0x26221f['type']===_0x27c5d5(0x1bf))await this[_0x27c5d5(0x193)]();}catch{}}}}catch(_0x227bc3){if(_0x227bc3[_0x27c5d5(0x1db)]===_0x27c5d5(0x1d2))break;this[_0x27c5d5(0x1a7)](_0x27c5d5(0x1ab),_0x227bc3),this[_0x27c5d5(0x19e)](_0x27c5d5(0x1da)+_0x227bc3[_0x27c5d5(0x1a2)]);}if(this['running'])this[_0x27c5d5(0x1a7)](_0x27c5d5(0x194)),this[_0x27c5d5(0x19e)](_0x27c5d5(0x1c6)+_0x5143cd/0x3e8+_0x27c5d5(0x1d8)),await this[_0x27c5d5(0x1d9)](_0x5143cd),_0x5143cd=Math[_0x27c5d5(0x1d7)](_0x5143cd*1.5,0xea60);}}async[a0_0x207ba8(0x193)](){const _0x16d6b1=a0_0x207ba8;try{let _0x1cc421=(await this[_0x16d6b1(0x1cd)](_0x16d6b1(0x1c8),{'alias':this[_0x16d6b1(0x1c5)],'limit':0xa}))?.['messages']||[];for(let _0x529c6d of _0x1cc421)await this['call'](_0x16d6b1(0x1af),{'alias':this[_0x16d6b1(0x1c5)],'message_id':_0x529c6d['id']}),this['log']('←\x20'+_0x529c6d[_0x16d6b1(0x1cc)]+':\x20'+_0x529c6d['content'][_0x16d6b1(0x1b8)](0x0,0x3c)),this[_0x16d6b1(0x1a7)]('task',_0x529c6d),this[_0x16d6b1(0x1a7)]('message',_0x529c6d);}catch(_0x1011f4){this[_0x16d6b1(0x19e)](_0x16d6b1(0x1cb)+_0x1011f4[_0x16d6b1(0x1a2)]);}}[a0_0x207ba8(0x1d9)](_0x2fd696){return new Promise(_0x455c8f=>setTimeout(_0x455c8f,_0x2fd696));}}var $=T;function a0_0xb317(_0x27394e,_0x214bed){_0x27394e=_0x27394e-0x189;const _0x4a6c38=a0_0x4a6c();let _0xb317a0=_0x4a6c38[_0x27394e];return _0xb317a0;}export{$ as default,T as CommHub};
1
+ const a0_0x594ba2=a0_0x5a88;(function(_0x4b764d,_0x2d1e14){const _0x593750=a0_0x5a88,_0x1d2280=_0x4b764d();while(!![]){try{const _0x2cc4a1=parseInt(_0x593750(0x15c))/0x1*(-parseInt(_0x593750(0x175))/0x2)+parseInt(_0x593750(0x136))/0x3*(-parseInt(_0x593750(0x143))/0x4)+parseInt(_0x593750(0x157))/0x5*(parseInt(_0x593750(0x17c))/0x6)+parseInt(_0x593750(0x15f))/0x7*(-parseInt(_0x593750(0x134))/0x8)+-parseInt(_0x593750(0x186))/0x9*(parseInt(_0x593750(0x160))/0xa)+-parseInt(_0x593750(0x15a))/0xb*(-parseInt(_0x593750(0x13c))/0xc)+parseInt(_0x593750(0x13e))/0xd*(parseInt(_0x593750(0x12f))/0xe);if(_0x2cc4a1===_0x2d1e14)break;else _0x1d2280['push'](_0x1d2280['shift']());}catch(_0x3dfae7){_0x1d2280['push'](_0x1d2280['shift']());}}}(a0_0x57b9,0x72f78));function a0_0x57b9(){const _0x222a26=['/events/','sdk','parse','SSE\x20error:\x20','sseAbort','reply','error','s...','running','2533070XmcIWY','text/event-stream','idle','55SEOicz','autoConnect','1RyZPvI','/mcp','disconnect','9289ZQDcIO','430GjoZlp','heartbeatInterval','SSE\x20reconnecting\x20in\x20','heartbeatTimer','messages','connected','connectSSE','send_message','Authorization','match','text','Bearer\x20','message','content','broadcast','connect','split','now','server','toTimeString','offline','1537994jcLiQT','min','completed','resumeId','get_inbox','data:\x20','tools/call','6aoFAVA','new_task','catch','name','emit','signal','processInbox','send','SSE\x20connected','task','142407pCFBFk','disconnected','1050rPFClq','url','agent','status','SSE\x20failed:\x20','5584nLxqTn','call','621597dNEjnh','inbox\x20error:\x20','POST','AbortError','alias','type','2082648BMfxFY','normal','327002wDJiUg','sleep','2.0','new_message','result','8SLqXMY','token','send_task',']\x20[commhub:','log','stringify','reconnectDelay','cwd','heartbeat\x20failed:\x20','slice','read'];a0_0x57b9=function(){return _0x222a26;};return a0_0x57b9();}import{EventEmitter as a0_0x2e46ec}from'events';import{hostname as a0_0x216e53}from'os';function a0_0x5a88(_0x4e3c6f,_0x2c886c){_0x4e3c6f=_0x4e3c6f-0x12f;const _0x57b909=a0_0x57b9();let _0x5a88be=_0x57b909[_0x4e3c6f];return _0x5a88be;}class T extends a0_0x2e46ec{[a0_0x594ba2(0x130)];[a0_0x594ba2(0x13a)];['token'];[a0_0x594ba2(0x131)];[a0_0x594ba2(0x178)];[a0_0x594ba2(0x161)];['reconnectDelay'];[a0_0x594ba2(0x163)];['sseAbort'];[a0_0x594ba2(0x156)]=!0x1;constructor(_0x52ba96){const _0x2f5b86=a0_0x594ba2;super();if(this[_0x2f5b86(0x130)]=_0x52ba96[_0x2f5b86(0x130)]['replace'](/\/$/,''),this[_0x2f5b86(0x13a)]=_0x52ba96['alias'],this[_0x2f5b86(0x144)]=_0x52ba96[_0x2f5b86(0x144)],this['agent']=_0x52ba96[_0x2f5b86(0x131)]||_0x2f5b86(0x14f),this['resumeId']='sdk-'+_0x52ba96[_0x2f5b86(0x13a)]+'-'+Date[_0x2f5b86(0x171)]()['toString'](0x24),this['heartbeatInterval']=_0x52ba96[_0x2f5b86(0x161)]??0x2bf20,this['reconnectDelay']=_0x52ba96[_0x2f5b86(0x149)]??0xbb8,_0x52ba96[_0x2f5b86(0x15b)]!==!0x1)this[_0x2f5b86(0x16f)]();}[a0_0x594ba2(0x147)](_0x3674ac){const _0x4165c3=a0_0x594ba2;console['log']('['+new Date()[_0x4165c3(0x173)]()[_0x4165c3(0x14c)](0x0,0x8)+_0x4165c3(0x146)+this[_0x4165c3(0x13a)]+']\x20'+_0x3674ac);}async[a0_0x594ba2(0x135)](_0x4a1261,_0x48ee4a){const _0x22cfa1=a0_0x594ba2;let _0x18c233={'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream'};if(this[_0x22cfa1(0x144)])_0x18c233[_0x22cfa1(0x168)]='Bearer\x20'+this[_0x22cfa1(0x144)];let _0x31e4fe=await(await fetch(this[_0x22cfa1(0x130)]+_0x22cfa1(0x15d),{'method':_0x22cfa1(0x138),'headers':_0x18c233,'body':JSON[_0x22cfa1(0x148)]({'jsonrpc':_0x22cfa1(0x140),'id':Date[_0x22cfa1(0x171)](),'method':_0x22cfa1(0x17b),'params':{'name':_0x4a1261,'arguments':_0x48ee4a}})}))[_0x22cfa1(0x16a)](),_0x4d1ab2=_0x31e4fe[_0x22cfa1(0x169)](/data: (.+)/),_0x4ad537=_0x4d1ab2?JSON['parse'](_0x4d1ab2[0x1]):JSON[_0x22cfa1(0x150)](_0x31e4fe),_0x4badcc=_0x4ad537?.[_0x22cfa1(0x142)]?.[_0x22cfa1(0x16d)]?.[0x0]?.[_0x22cfa1(0x16a)];return _0x4badcc?JSON[_0x22cfa1(0x150)](_0x4badcc):_0x4ad537;}async[a0_0x594ba2(0x16f)](){const _0x3d0b35=a0_0x594ba2;if(this[_0x3d0b35(0x156)])return;this[_0x3d0b35(0x156)]=!0x0,await this['status'](_0x3d0b35(0x159)),this[_0x3d0b35(0x147)]('registered'),this['heartbeatTimer']=setInterval(()=>{const _0x5a6dcd=_0x3d0b35;this[_0x5a6dcd(0x132)](_0x5a6dcd(0x159))['catch'](_0x45a269=>this[_0x5a6dcd(0x147)](_0x5a6dcd(0x14b)+_0x45a269[_0x5a6dcd(0x16c)]));},this[_0x3d0b35(0x161)]),this[_0x3d0b35(0x166)]();}async[a0_0x594ba2(0x15e)](){const _0x430266=a0_0x594ba2;if(this[_0x430266(0x156)]=!0x1,this[_0x430266(0x152)]?.['abort'](),this[_0x430266(0x163)])clearInterval(this[_0x430266(0x163)]);await this[_0x430266(0x132)](_0x430266(0x174))[_0x430266(0x17e)](()=>{}),this[_0x430266(0x147)](_0x430266(0x187));}async[a0_0x594ba2(0x183)](_0x568577,_0x5a409d,_0x418b3e=a0_0x594ba2(0x13d)){const _0x3ab2be=a0_0x594ba2;return this['call'](_0x3ab2be(0x145),{'alias':_0x568577,'task':_0x5a409d,'priority':_0x418b3e,'from_session':this['alias']});}async[a0_0x594ba2(0x16c)](_0x32f41a,_0x1ffe74){const _0x43fa69=a0_0x594ba2;return this['call'](_0x43fa69(0x167),{'alias':_0x32f41a,'message':_0x1ffe74,'from_session':this[_0x43fa69(0x13a)]});}async[a0_0x594ba2(0x153)](_0x4ec8ca,_0x4ce4ef,_0x598710=a0_0x594ba2(0x177)){return this['call']('send_reply',{'in_reply_to':_0x4ec8ca,'text':_0x4ce4ef,'status':_0x598710});}async[a0_0x594ba2(0x132)](_0x5ca2cc,_0x590a45){const _0x3eb0d0=a0_0x594ba2;return this[_0x3eb0d0(0x135)]('report_status',{'resume_id':this[_0x3eb0d0(0x178)],'alias':this[_0x3eb0d0(0x13a)],'status':_0x5ca2cc,'server':a0_0x216e53(),'hostname':a0_0x216e53(),'agent':this[_0x3eb0d0(0x131)],'project_dir':process[_0x3eb0d0(0x14a)](),..._0x590a45});}async['getAllStatus'](){const _0x149697=a0_0x594ba2;return this[_0x149697(0x135)]('get_all_status',{});}async[a0_0x594ba2(0x16e)](_0x4b0330,_0x7a19d7){const _0x3598d7=a0_0x594ba2;return this['call'](_0x3598d7(0x16e),{'message':_0x4b0330,'filter_server':_0x7a19d7?.[_0x3598d7(0x172)],'filter_status':_0x7a19d7?.[_0x3598d7(0x132)]});}async[a0_0x594ba2(0x166)](){const _0x5aade6=a0_0x594ba2;let _0xcf14da=encodeURIComponent(this[_0x5aade6(0x13a)]),_0x2f51f2=this[_0x5aade6(0x130)]+_0x5aade6(0x14e)+_0xcf14da,_0x5555f5=this['reconnectDelay'];while(this[_0x5aade6(0x156)]){try{this[_0x5aade6(0x152)]=new AbortController();let _0x33c577={'Accept':_0x5aade6(0x158)};if(this[_0x5aade6(0x144)])_0x33c577[_0x5aade6(0x168)]=_0x5aade6(0x16b)+this[_0x5aade6(0x144)];let _0x150625=await fetch(_0x2f51f2,{'headers':_0x33c577,'signal':this[_0x5aade6(0x152)][_0x5aade6(0x181)]});if(!_0x150625['ok']||!_0x150625['body']){this[_0x5aade6(0x147)](_0x5aade6(0x133)+_0x150625[_0x5aade6(0x132)]),await this[_0x5aade6(0x13f)](_0x5555f5),_0x5555f5=Math[_0x5aade6(0x176)](_0x5555f5*1.5,0xea60);continue;}_0x5555f5=this[_0x5aade6(0x149)];let _0x3dab86=_0x150625['body']['getReader'](),_0x2f49f7=new TextDecoder(),_0x3042e7='';while(this[_0x5aade6(0x156)]){let {done:_0x5990ed,value:_0x486889}=await _0x3dab86[_0x5aade6(0x14d)]();if(_0x5990ed)break;_0x3042e7+=_0x2f49f7['decode'](_0x486889,{'stream':!0x0});let _0x2221b7=_0x3042e7[_0x5aade6(0x170)]('\x0a');_0x3042e7=_0x2221b7['pop']()||'';for(let _0x2d29b6 of _0x2221b7){if(!_0x2d29b6['startsWith'](_0x5aade6(0x17a)))continue;try{let _0x39fff3=JSON[_0x5aade6(0x150)](_0x2d29b6['slice'](0x6));if(_0x39fff3[_0x5aade6(0x13b)]===_0x5aade6(0x165)){this['log'](_0x5aade6(0x184)),this[_0x5aade6(0x180)](_0x5aade6(0x165));continue;}if(_0x39fff3[_0x5aade6(0x13b)]===_0x5aade6(0x17d)||_0x39fff3[_0x5aade6(0x13b)]===_0x5aade6(0x141)||_0x39fff3[_0x5aade6(0x13b)]===_0x5aade6(0x16e))await this[_0x5aade6(0x182)]();}catch{}}}}catch(_0x4b9573){if(_0x4b9573[_0x5aade6(0x17f)]===_0x5aade6(0x139))break;this[_0x5aade6(0x180)](_0x5aade6(0x154),_0x4b9573),this[_0x5aade6(0x147)](_0x5aade6(0x151)+_0x4b9573[_0x5aade6(0x16c)]);}if(this[_0x5aade6(0x156)])this[_0x5aade6(0x180)]('disconnected'),this[_0x5aade6(0x147)](_0x5aade6(0x162)+_0x5555f5/0x3e8+_0x5aade6(0x155)),await this[_0x5aade6(0x13f)](_0x5555f5),_0x5555f5=Math['min'](_0x5555f5*1.5,0xea60);}}async[a0_0x594ba2(0x182)](){const _0x1a2460=a0_0x594ba2;try{let _0x1d16e2=(await this[_0x1a2460(0x135)](_0x1a2460(0x179),{'alias':this['alias'],'limit':0xa}))?.[_0x1a2460(0x164)]||[];for(let _0xcd9da4 of _0x1d16e2)await this[_0x1a2460(0x135)]('ack_inbox',{'alias':this['alias'],'message_id':_0xcd9da4['id']}),this['log']('←\x20'+_0xcd9da4['from_session']+':\x20'+_0xcd9da4['content']['slice'](0x0,0x3c)),this[_0x1a2460(0x180)](_0x1a2460(0x185),_0xcd9da4),this[_0x1a2460(0x180)](_0x1a2460(0x16c),_0xcd9da4);}catch(_0x463c14){this[_0x1a2460(0x147)](_0x1a2460(0x137)+_0x463c14[_0x1a2460(0x16c)]);}}['sleep'](_0x304ab2){return new Promise(_0x283b8d=>setTimeout(_0x283b8d,_0x304ab2));}}var $=T;export{$ as default,T as CommHub};
@@ -0,0 +1,17 @@
1
+ /** Exact RFC-030 release pair validated against the real WebSocket wire. */
2
+ export declare const CODEX_APP_SERVER_CLI_VERSION = "0.144.0";
3
+ export declare const CODEX_APP_SERVER_AGENT_NODE_VERSION = "2.5.0-preview.24";
4
+ export declare const CODEX_APP_SERVER_AGENT_NODE_SPEC = "@sleep2agi/agent-node@2.5.0-preview.24";
5
+ export declare function codexAppServerCliVersion(output: string): string | null;
6
+ export declare function agentNodeHelpSupportsCodexAppServer(help: string): boolean;
7
+ export declare function codexAppServerExactInstallCommand(): string;
8
+ export interface CodexNativeIdentity {
9
+ binary: string;
10
+ packageRoot: string;
11
+ version: string;
12
+ }
13
+ /**
14
+ * Resolve the native executable from an exact global npm package root. The
15
+ * JS/npm shim is never executed with the node token in its environment.
16
+ */
17
+ export declare function resolveCodexNativeIdentity(npmGlobalRoot: string, expectedVersion?: string, platform?: NodeJS.Platform, arch?: NodeJS.Architecture): CodexNativeIdentity;
@@ -0,0 +1,115 @@
1
+ import type { Duplex } from "node:stream";
2
+ export declare const GROK_ATTACH_PROTOCOL = "anet-grok-copresence-attach";
3
+ export declare const GROK_ATTACH_PROTOCOL_VERSION = 1;
4
+ export declare const GROK_ATTACH_DEFAULT_MAX_FRAME_BYTES: number;
5
+ export declare const GROK_ATTACH_DEFAULT_MAX_BUFFER_BYTES: number;
6
+ export declare const GROK_ATTACH_DEFAULT_HANDSHAKE_TIMEOUT_MS = 5000;
7
+ export declare const GROK_ATTACH_DEFAULT_CLOSE_TIMEOUT_MS = 1000;
8
+ export type GrokAttachJsonValue = null | boolean | number | string | GrokAttachJsonValue[] | {
9
+ [key: string]: GrokAttachJsonValue;
10
+ };
11
+ export interface GrokAttachHelloFrame {
12
+ type: "hello";
13
+ protocol: typeof GROK_ATTACH_PROTOCOL;
14
+ version: typeof GROK_ATTACH_PROTOCOL_VERSION;
15
+ alias: string;
16
+ sessionId: string;
17
+ [key: string]: unknown;
18
+ }
19
+ export interface GrokAttachOutputFrame {
20
+ type: "output";
21
+ data: string;
22
+ encoding: "base64";
23
+ }
24
+ export interface GrokAttachStatusFrame {
25
+ type: "status";
26
+ status: GrokAttachJsonValue;
27
+ }
28
+ export interface GrokAttachErrorFrame {
29
+ type: "error";
30
+ code: string;
31
+ message: string;
32
+ fatal: boolean;
33
+ }
34
+ export interface GrokAttachDetachFrame {
35
+ type: "detach";
36
+ }
37
+ export type GrokAttachServerFrame = GrokAttachHelloFrame | GrokAttachOutputFrame | GrokAttachStatusFrame | GrokAttachErrorFrame | GrokAttachDetachFrame;
38
+ export interface GrokAttachInputFrame {
39
+ type: "input";
40
+ data: string;
41
+ encoding: "base64";
42
+ }
43
+ export interface GrokAttachResizeFrame {
44
+ type: "resize";
45
+ cols: number;
46
+ rows: number;
47
+ }
48
+ export type GrokAttachClientFrame = GrokAttachInputFrame | GrokAttachResizeFrame | GrokAttachDetachFrame;
49
+ export interface GrokAttachInputSource {
50
+ on(event: "data", listener: (chunk: unknown) => void): unknown;
51
+ on(event: "end", listener: () => void): unknown;
52
+ off?(event: "data" | "end", listener: (...args: any[]) => void): unknown;
53
+ removeListener?(event: "data" | "end", listener: (...args: any[]) => void): unknown;
54
+ pause?(): unknown;
55
+ resume?(): unknown;
56
+ }
57
+ export interface GrokAttachOutputSink {
58
+ write(chunk: Uint8Array): boolean | void;
59
+ columns?: number;
60
+ rows?: number;
61
+ once?(event: "drain", listener: () => void): unknown;
62
+ }
63
+ export interface GrokAttachSignalSource {
64
+ on(event: "SIGWINCH", listener: () => void): unknown;
65
+ off?(event: "SIGWINCH", listener: () => void): unknown;
66
+ removeListener?(event: "SIGWINCH", listener: () => void): unknown;
67
+ }
68
+ export interface GrokAttachSocketStat {
69
+ uid: number;
70
+ isSocket(): boolean;
71
+ isSymbolicLink(): boolean;
72
+ }
73
+ export interface GrokAttachDependencies {
74
+ lstat?: (socketPath: string) => Promise<GrokAttachSocketStat>;
75
+ getuid?: () => number | undefined;
76
+ connect?: (socketPath: string) => Duplex;
77
+ }
78
+ export interface GrokAttachClientOptions {
79
+ socketPath: string;
80
+ input: GrokAttachInputSource;
81
+ output: GrokAttachOutputSink;
82
+ signalSource?: GrokAttachSignalSource;
83
+ terminalSize?: () => {
84
+ cols: number | undefined;
85
+ rows: number | undefined;
86
+ };
87
+ maxFrameBytes?: number;
88
+ maxBufferBytes?: number;
89
+ handshakeTimeoutMs?: number;
90
+ closeTimeoutMs?: number;
91
+ detachOnInputEnd?: boolean;
92
+ onHello?: (frame: GrokAttachHelloFrame) => void;
93
+ onStatus?: (frame: GrokAttachStatusFrame) => void;
94
+ onError?: (error: Error, frame?: GrokAttachErrorFrame) => void;
95
+ onDetach?: (frame: GrokAttachDetachFrame) => void;
96
+ dependencies?: GrokAttachDependencies;
97
+ }
98
+ export type GrokAttachCloseReason = "local-detach" | "input-end" | "remote-detach" | "socket-close" | "socket-error" | "protocol-error";
99
+ export interface GrokAttachCloseInfo {
100
+ reason: GrokAttachCloseReason;
101
+ error?: Error;
102
+ }
103
+ export interface GrokAttachSession {
104
+ readonly socketPath: string;
105
+ readonly closed: Promise<GrokAttachCloseInfo>;
106
+ detach(): void;
107
+ resize(cols?: number, rows?: number): void;
108
+ }
109
+ export declare class GrokAttachRemoteError extends Error {
110
+ readonly code: string;
111
+ readonly fatal: boolean;
112
+ constructor(frame: GrokAttachErrorFrame);
113
+ }
114
+ export declare function validateGrokAttachSocket(socketPath: string, dependencies?: GrokAttachDependencies): Promise<void>;
115
+ export declare function connectGrokAttach(options: GrokAttachClientOptions): Promise<GrokAttachSession>;
@@ -0,0 +1,44 @@
1
+ export declare const GROK_UNIX_SOCKET_PATH_MAX_BYTES = 100;
2
+ export declare const GROK_COPRESENCE_CAPABILITY_MARKER = "ANET_CAPABILITY_GROK_COPRESENCE_V2";
3
+ export declare const GROK_PREVIEW_RESOLVER_INHERITED_ENV_KEYS: readonly ["PATH", "TMPDIR", "TMP", "TEMP", "LANG", "LC_ALL", "LC_CTYPE", "TZ"];
4
+ export declare const GROK_AGENT_NODE_INHERITED_ENV_KEYS: readonly ["PATH", "HOME", "TMPDIR", "TMP", "TEMP", "LANG", "LC_ALL", "LC_CTYPE", "TZ", "SHELL", "USER", "LOGNAME", "TERM", "COLORTERM", "NO_COLOR"];
5
+ export declare const GROK_AGENT_NODE_OPTIONAL_ENV_KEYS: readonly ["GROK_BINARY", "GROK_HOME", "FLOCK_BINARY", "SETPRIV_BINARY", "UNSHARE_BINARY", "GROK_CLI_TIMEOUT_MS", "GROK_HANDSHAKE_TIMEOUT_MS", "LOG_LEVEL", "ANET_GOAL_TICK_MS", "COMMHUB_MAX_GOALS_PER_NODE"];
6
+ /** Exact environment for the long-lived agent-node parent of the Grok TUI. */
7
+ export declare function buildGrokAgentNodeEnv(parentEnv: NodeJS.ProcessEnv): Record<string, string>;
8
+ export declare function grokPreviewResolverConfigPaths(home: string): {
9
+ directory: string;
10
+ userConfig: string;
11
+ globalConfig: string;
12
+ };
13
+ /**
14
+ * npm rejects loading the same file as both user and global config. Prepare
15
+ * two distinct, empty, owner-only files without following a final symlink so
16
+ * the resolver cannot inherit a user's ordinary npmrc credentials.
17
+ */
18
+ export declare function prepareGrokPreviewResolverConfigs(home: string): void;
19
+ /** Exact environment for the short-lived npm resolver and capability probe. */
20
+ export declare function buildGrokPreviewResolverEnv(parentEnv: NodeJS.ProcessEnv, home: string): Record<string, string>;
21
+ /** Old headless-only agent-node builds already advertised grok-build-cli. */
22
+ export declare function agentNodeHelpSupportsGrokCopresence(help: string): boolean;
23
+ export interface GrokCopresenceProfileFields {
24
+ grokCopresence: boolean;
25
+ grokLeaderSocket?: string;
26
+ grokAttachSocket?: string;
27
+ }
28
+ export interface GrokSocketPathOptions {
29
+ cwd?: string;
30
+ home?: string;
31
+ xdgRuntimeDir?: string;
32
+ uid?: number;
33
+ platform?: NodeJS.Platform;
34
+ }
35
+ /**
36
+ * Allocate deterministic, short Unix socket paths without creating anything.
37
+ * The runtime owns directory creation and permissions; `anet node create`
38
+ * only persists the identity of the two sockets.
39
+ */
40
+ export declare function grokCopresenceSocketPaths(nodeId: string, options?: GrokSocketPathOptions): {
41
+ leaderSocket: string;
42
+ attachSocket: string;
43
+ };
44
+ export declare function grokBuildCliCreationFields(runtime: string, nodeId: string, headless?: boolean, options?: GrokSocketPathOptions): GrokCopresenceProfileFields | Record<string, never>;