@sleep2agi/agent-network 2.3.0-preview.39 → 2.3.0-preview.40

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_0x275b2c=a0_0x5183;(function(_0x1899e4,_0x2c3e24){const _0x389bbc=a0_0x5183,_0x541eb9=_0x1899e4();while(!![]){try{const _0x3ae317=-parseInt(_0x389bbc(0x103))/0x1*(-parseInt(_0x389bbc(0x10e))/0x2)+-parseInt(_0x389bbc(0x14a))/0x3+parseInt(_0x389bbc(0x130))/0x4*(-parseInt(_0x389bbc(0x164))/0x5)+-parseInt(_0x389bbc(0x176))/0x6*(-parseInt(_0x389bbc(0x10c))/0x7)+parseInt(_0x389bbc(0x138))/0x8*(-parseInt(_0x389bbc(0x159))/0x9)+-parseInt(_0x389bbc(0x11a))/0xa+parseInt(_0x389bbc(0xf9))/0xb*(parseInt(_0x389bbc(0x139))/0xc);if(_0x3ae317===_0x2c3e24)break;else _0x541eb9['push'](_0x541eb9['shift']());}catch(_0x2beda3){_0x541eb9['push'](_0x541eb9['shift']());}}}(a0_0x25fe,0x5569c));import{EventEmitter as a0_0x5ae740}from'events';import{hostname as a0_0x4a8173}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x4743b1,_0x387712)=>(_0x4743b1??_0x387712)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);function N(_0x34379d){const _0x48c8ff=a0_0x5183;return(_0x34379d instanceof Error?_0x34379d[_0x48c8ff(0x165)]:String(_0x34379d??'unknown\x20error'))[_0x48c8ff(0xfb)](K,_0x48c8ff(0x132))[_0x48c8ff(0xfb)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x48c8ff(0x142)](0x0,0xf0);}function O(_0x64e4ee,_0x475a73=process.env.ANET_TASK_TRACE_FORMAT===a0_0x275b2c(0xfe)){const _0xe76c26=a0_0x275b2c;if(_0x475a73)return JSON[_0xe76c26(0xfc)](_0x64e4ee);let _0x5a7033=L(_0x64e4ee[_0xe76c26(0x118)],_0xe76c26(0x149)),_0x2a3bbf=L(_0x64e4ee[_0xe76c26(0x15f)],_0xe76c26(0x17d)),_0x1eb80c=_0x64e4ee[_0xe76c26(0x106)]?'\x20error='+_0x64e4ee['error_code']+':'+(_0x64e4ee[_0xe76c26(0x154)]??''):'';return _0xe76c26(0x121)+_0x64e4ee[_0xe76c26(0x178)]+_0xe76c26(0x10f)+L(_0x64e4ee[_0xe76c26(0x155)],_0xe76c26(0x124))+_0xe76c26(0x136)+L(_0x64e4ee['to_alias'],'<unknown>')+_0xe76c26(0x166)+_0x2a3bbf+'\x20parent_task_id='+_0x5a7033+_0xe76c26(0x146)+L(_0x64e4ee[_0xe76c26(0x137)],'<unknown>')+_0xe76c26(0x10b)+_0x64e4ee[_0xe76c26(0x115)]+'\x20duration_ms='+_0x64e4ee[_0xe76c26(0x13d)]+'\x20lifecycle='+_0x64e4ee[_0xe76c26(0x141)]+_0x1eb80c;}function U(_0x2eaa25){const _0x4a10df=a0_0x275b2c;return{'event':{'sending':_0x4a10df(0x15b),'delivered':_0x4a10df(0x123),'failed':'task.send.failed','acked':_0x4a10df(0x152),'started':_0x4a10df(0x11d),'replied':_0x4a10df(0x108),'expired':'task.expired'}[_0x2eaa25[_0x4a10df(0x178)]],..._0x2eaa25};}function j(_0x15e281){const _0x47f926=a0_0x275b2c;let _0x77ac62=_0x15e281?.[_0x47f926(0x15f)]||_0x15e281?.[_0x47f926(0x169)]||_0x15e281?.['id'];if(_0x77ac62)return String(_0x77ac62);let _0x35281d=_0x15e281?.[_0x47f926(0x150)]?.[0x0]?.[_0x47f926(0x17b)];if(typeof _0x35281d!==_0x47f926(0x101))return null;try{let _0x43be0f=JSON[_0x47f926(0x135)](_0x35281d);return _0x43be0f?.[_0x47f926(0x15f)]||_0x43be0f?.[_0x47f926(0x169)]||_0x43be0f?.['id']||null;}catch{return null;}}async function X(_0x5ecc93,_0x1155af){const _0x5c5188=a0_0x275b2c;let _0x9b96b5=_0x1155af['now']??Date[_0x5c5188(0x13a)],_0x3f9c06=_0x9b96b5(),_0x467551=(_0x62eec,_0x352098,_0x1d0c38,_0xfe19e3)=>{const _0x250fd7=_0x5c5188;_0x1155af[_0x250fd7(0x112)](O(U({'from_alias':_0x5ecc93['fromAlias'],'to_alias':_0x5ecc93[_0x250fd7(0xff)],'task_id':_0x352098,'parent_task_id':_0x5ecc93['parentTaskId'],'network_id':_0x5ecc93[_0x250fd7(0x161)],'transport':_0x5ecc93[_0x250fd7(0x115)],'status':_0x62eec,'duration_ms':_0x9b96b5()-_0x3f9c06,'lifecycle_tracking':_0x5ecc93[_0x250fd7(0x15d)],..._0x1d0c38!==void 0x0?{'error_code':_0xfe19e3||_0x250fd7(0x11f),'error_message':N(_0x1d0c38)}:{}})));};_0x467551('sending',null);try{let _0x221bd3=await _0x1155af[_0x5c5188(0x11c)](),_0x1e21d7=j(_0x221bd3);if(_0x1e21d7)_0x467551(_0x5c5188(0x126),_0x1e21d7);else{if(_0x221bd3?.['ok']===!0x1||_0x221bd3?.[_0x5c5188(0x13b)])_0x467551(_0x5c5188(0x133),_0x1e21d7,_0x221bd3?.[_0x5c5188(0x13b)]||_0x5c5188(0x156),_0x5c5188(0x153));else _0x467551(_0x5c5188(0x133),null,_0x5c5188(0x167),_0x5c5188(0x15e));}return _0x221bd3;}catch(_0x265dd6){throw _0x467551(_0x5c5188(0x133),null,_0x265dd6,_0x5c5188(0x11f)),_0x265dd6;}}function a0_0x25fe(){const _0xb9dfae=['error_code','type','task.replied','application/json','Authorization','\x20transport=','810859gFhvDy','alias','2QtQwAI','\x20from=','SSE\x20connected','send_reply','log','get_all_status','normal','transport','messages','toTimeString','parent_task_id','toString','2797230WXXUnF','min','send','task.started','connect','send_failed','Bearer\x20','[commhub:task]\x20','from_session','task.send.delivered','<unknown>','catch','delivered','tools/call','startsWith','new_message','cwd','report_status','agent','broadcast','offline','token','2328412dtpHim','/events/','[REDACTED]','failed','name','parse','\x20to=','network_id','8PwpKDP','16622268xsqAyf','now','error','call','duration_ms','abort','emit','not_tracked','lifecycle_tracking','slice','SSE\x20error:\x20','server','disconnected','\x20network_id=','POST','/mcp','<missing>','1706547nWmBRh','get_inbox','resumeId','sleep','decode','heartbeat\x20failed:\x20','content','sdk-','task.ack','send_rejected','error_message','from_alias','CommHub\x20rejected\x20task','heartbeatTimer','url','2211723zhhLSV','body','task.send.start','running','lifecycleTracking','missing_task_id','task_id','sseAbort','networkId','application/json,\x20text/event-stream','heartbeatInterval','5jCJfIG','message','\x20task_id=','CommHub\x20response\x20omitted\x20task_id','match','message_id','split','idle','connectSSE','disconnect','parentTaskId','reply','reconnectDelay','getAllStatus','completed','autoConnect',']\x20[commhub:','sdk','24vfqScU','pop','status','SSE\x20reconnecting\x20in\x20','registered','text','fromAlias','<pending>','AbortError','11hYJWWR','send_task','replace','stringify','SSE\x20failed:\x20','json','toAlias','connected','string','s...','177737YcXhsF','processInbox','new_task'];a0_0x25fe=function(){return _0xb9dfae;};return a0_0x25fe();}async function Y(_0x18f5b7,_0x34f68a){const _0x370848=a0_0x275b2c;return X({'fromAlias':_0x18f5b7[_0x370848(0x17c)],'toAlias':_0x18f5b7[_0x370848(0x10d)],'parentTaskId':_0x18f5b7[_0x370848(0x16e)]||null,'networkId':_0x18f5b7[_0x370848(0x161)]||null,'transport':'mcp_http','lifecycleTracking':_0x370848(0x140)},_0x34f68a);}class $ extends a0_0x5ae740{[a0_0x275b2c(0x158)];[a0_0x275b2c(0x10d)];[a0_0x275b2c(0x12f)];[a0_0x275b2c(0x12c)];['resumeId'];[a0_0x275b2c(0x163)];[a0_0x275b2c(0x170)];[a0_0x275b2c(0x157)];[a0_0x275b2c(0x160)];[a0_0x275b2c(0x15c)]=!0x1;constructor(_0xe91faf){const _0x3a18a8=a0_0x275b2c;super();if(this[_0x3a18a8(0x158)]=_0xe91faf['url'][_0x3a18a8(0xfb)](/\/$/,''),this[_0x3a18a8(0x10d)]=_0xe91faf[_0x3a18a8(0x10d)],this['token']=_0xe91faf[_0x3a18a8(0x12f)],this[_0x3a18a8(0x12c)]=_0xe91faf['agent']||_0x3a18a8(0x175),this[_0x3a18a8(0x14c)]=_0x3a18a8(0x151)+_0xe91faf[_0x3a18a8(0x10d)]+'-'+Date[_0x3a18a8(0x13a)]()[_0x3a18a8(0x119)](0x24),this[_0x3a18a8(0x163)]=_0xe91faf['heartbeatInterval']??0x2bf20,this[_0x3a18a8(0x170)]=_0xe91faf[_0x3a18a8(0x170)]??0xbb8,_0xe91faf[_0x3a18a8(0x173)]!==!0x1)this[_0x3a18a8(0x11e)]();}[a0_0x275b2c(0x112)](_0x50b378){const _0x149a5c=a0_0x275b2c;console[_0x149a5c(0x112)]('['+new Date()[_0x149a5c(0x117)]()[_0x149a5c(0x142)](0x0,0x8)+_0x149a5c(0x174)+this['alias']+']\x20'+_0x50b378);}async[a0_0x275b2c(0x13c)](_0xdcca6f,_0x554b6d){const _0x2b3ea0=a0_0x275b2c;let _0x273539={'Content-Type':_0x2b3ea0(0x109),'Accept':_0x2b3ea0(0x162)};if(this[_0x2b3ea0(0x12f)])_0x273539[_0x2b3ea0(0x10a)]=_0x2b3ea0(0x120)+this[_0x2b3ea0(0x12f)];let _0x3d6607=await(await fetch(this[_0x2b3ea0(0x158)]+_0x2b3ea0(0x148),{'method':_0x2b3ea0(0x147),'headers':_0x273539,'body':JSON['stringify']({'jsonrpc':'2.0','id':Date[_0x2b3ea0(0x13a)](),'method':_0x2b3ea0(0x127),'params':{'name':_0xdcca6f,'arguments':_0x554b6d}})}))[_0x2b3ea0(0x17b)](),_0x674607=_0x3d6607[_0x2b3ea0(0x168)](/data: (.+)/),_0x4ead71=_0x674607?JSON[_0x2b3ea0(0x135)](_0x674607[0x1]):JSON[_0x2b3ea0(0x135)](_0x3d6607),_0x8743ad=_0x4ead71?.['result']?.[_0x2b3ea0(0x150)]?.[0x0]?.[_0x2b3ea0(0x17b)];return _0x8743ad?JSON[_0x2b3ea0(0x135)](_0x8743ad):_0x4ead71;}async['connect'](){const _0x1c19af=a0_0x275b2c;if(this[_0x1c19af(0x15c)])return;this[_0x1c19af(0x15c)]=!0x0,await this[_0x1c19af(0x178)](_0x1c19af(0x16b)),this[_0x1c19af(0x112)](_0x1c19af(0x17a)),this[_0x1c19af(0x157)]=setInterval(()=>{const _0x3cc4de=_0x1c19af;this[_0x3cc4de(0x178)]('idle')[_0x3cc4de(0x125)](_0x3373a7=>this[_0x3cc4de(0x112)](_0x3cc4de(0x14f)+_0x3373a7[_0x3cc4de(0x165)]));},this[_0x1c19af(0x163)]),this[_0x1c19af(0x16c)]();}async[a0_0x275b2c(0x16d)](){const _0x1687cd=a0_0x275b2c;if(this['running']=!0x1,this['sseAbort']?.[_0x1687cd(0x13e)](),this[_0x1687cd(0x157)])clearInterval(this[_0x1687cd(0x157)]);await this[_0x1687cd(0x178)](_0x1687cd(0x12e))[_0x1687cd(0x125)](()=>{}),this['log'](_0x1687cd(0x145));}async[a0_0x275b2c(0x11c)](_0x24a943,_0x33edf7,_0x134b0b=a0_0x275b2c(0x114)){const _0x317fa0=a0_0x275b2c;return Y({'alias':_0x24a943,'fromAlias':this[_0x317fa0(0x10d)]},{'log':_0x239d0b=>console[_0x317fa0(0x112)](_0x239d0b),'send':()=>this[_0x317fa0(0x13c)](_0x317fa0(0xfa),{'alias':_0x24a943,'task':_0x33edf7,'priority':_0x134b0b,'from_session':this[_0x317fa0(0x10d)]})});}async[a0_0x275b2c(0x165)](_0x907eb4,_0x1fc553){const _0x4d46c4=a0_0x275b2c;return this['call']('send_message',{'alias':_0x907eb4,'message':_0x1fc553,'from_session':this[_0x4d46c4(0x10d)]});}async[a0_0x275b2c(0x16f)](_0xc96fc,_0x52b5bb,_0x4f6d42=a0_0x275b2c(0x172)){const _0x840d4d=a0_0x275b2c;return this[_0x840d4d(0x13c)](_0x840d4d(0x111),{'in_reply_to':_0xc96fc,'text':_0x52b5bb,'status':_0x4f6d42});}async[a0_0x275b2c(0x178)](_0xd11d92,_0x3a87e7){const _0xbecf5f=a0_0x275b2c;return this[_0xbecf5f(0x13c)](_0xbecf5f(0x12b),{'resume_id':this['resumeId'],'alias':this[_0xbecf5f(0x10d)],'status':_0xd11d92,'server':a0_0x4a8173(),'hostname':a0_0x4a8173(),'agent':this[_0xbecf5f(0x12c)],'project_dir':process[_0xbecf5f(0x12a)](),..._0x3a87e7});}async[a0_0x275b2c(0x171)](){const _0x114689=a0_0x275b2c;return this[_0x114689(0x13c)](_0x114689(0x113),{});}async[a0_0x275b2c(0x12d)](_0x1ff19e,_0x121f13){const _0x3ffceb=a0_0x275b2c;return this[_0x3ffceb(0x13c)]('broadcast',{'message':_0x1ff19e,'filter_server':_0x121f13?.[_0x3ffceb(0x144)],'filter_status':_0x121f13?.[_0x3ffceb(0x178)]});}async[a0_0x275b2c(0x16c)](){const _0x173812=a0_0x275b2c;let _0x223ecb=encodeURIComponent(this['alias']),_0x335935=this[_0x173812(0x158)]+_0x173812(0x131)+_0x223ecb,_0x293a88=this['reconnectDelay'];while(this[_0x173812(0x15c)]){try{this[_0x173812(0x160)]=new AbortController();let _0xd9b782={'Accept':'text/event-stream'};if(this[_0x173812(0x12f)])_0xd9b782[_0x173812(0x10a)]=_0x173812(0x120)+this[_0x173812(0x12f)];let _0x55a5a2=await fetch(_0x335935,{'headers':_0xd9b782,'signal':this[_0x173812(0x160)]['signal']});if(!_0x55a5a2['ok']||!_0x55a5a2[_0x173812(0x15a)]){this['log'](_0x173812(0xfd)+_0x55a5a2[_0x173812(0x178)]),await this['sleep'](_0x293a88),_0x293a88=Math[_0x173812(0x11b)](_0x293a88*1.5,0xea60);continue;}_0x293a88=this[_0x173812(0x170)];let _0x237050=_0x55a5a2[_0x173812(0x15a)]['getReader'](),_0x2a4625=new TextDecoder(),_0x1ea83b='';while(this[_0x173812(0x15c)]){let {done:_0x202ca0,value:_0x272c4c}=await _0x237050['read']();if(_0x202ca0)break;_0x1ea83b+=_0x2a4625[_0x173812(0x14e)](_0x272c4c,{'stream':!0x0});let _0x1efefc=_0x1ea83b[_0x173812(0x16a)]('\x0a');_0x1ea83b=_0x1efefc[_0x173812(0x177)]()||'';for(let _0x2df130 of _0x1efefc){if(!_0x2df130[_0x173812(0x128)]('data:\x20'))continue;try{let _0xd64f37=JSON['parse'](_0x2df130[_0x173812(0x142)](0x6));if(_0xd64f37[_0x173812(0x107)]===_0x173812(0x100)){this[_0x173812(0x112)](_0x173812(0x110)),this[_0x173812(0x13f)](_0x173812(0x100));continue;}if(_0xd64f37[_0x173812(0x107)]===_0x173812(0x105)||_0xd64f37[_0x173812(0x107)]===_0x173812(0x129)||_0xd64f37[_0x173812(0x107)]===_0x173812(0x12d))await this['processInbox']();}catch{}}}}catch(_0x102b5d){if(_0x102b5d[_0x173812(0x134)]===_0x173812(0x17e))break;this['emit'](_0x173812(0x13b),_0x102b5d),this[_0x173812(0x112)](_0x173812(0x143)+_0x102b5d['message']);}if(this['running'])this['emit']('disconnected'),this[_0x173812(0x112)](_0x173812(0x179)+_0x293a88/0x3e8+_0x173812(0x102)),await this[_0x173812(0x14d)](_0x293a88),_0x293a88=Math[_0x173812(0x11b)](_0x293a88*1.5,0xea60);}}async[a0_0x275b2c(0x104)](){const _0x2b8f9d=a0_0x275b2c;try{let _0x4ff533=(await this[_0x2b8f9d(0x13c)](_0x2b8f9d(0x14b),{'alias':this[_0x2b8f9d(0x10d)],'limit':0xa}))?.[_0x2b8f9d(0x116)]||[];for(let _0xd8ad70 of _0x4ff533)await this['call']('ack_inbox',{'alias':this[_0x2b8f9d(0x10d)],'message_id':_0xd8ad70['id']}),this[_0x2b8f9d(0x112)]('←\x20'+_0xd8ad70[_0x2b8f9d(0x122)]+':\x20'+_0xd8ad70[_0x2b8f9d(0x150)][_0x2b8f9d(0x142)](0x0,0x3c)),this[_0x2b8f9d(0x13f)]('task',_0xd8ad70),this[_0x2b8f9d(0x13f)](_0x2b8f9d(0x165),_0xd8ad70);}catch(_0x56c577){this[_0x2b8f9d(0x112)]('inbox\x20error:\x20'+_0x56c577['message']);}}[a0_0x275b2c(0x14d)](_0x8c993e){return new Promise(_0xc522b3=>setTimeout(_0xc522b3,_0x8c993e));}}var F=$;function a0_0x5183(_0x4903e5,_0x33c9ae){_0x4903e5=_0x4903e5-0xf9;const _0x25fe6e=a0_0x25fe();let _0x5183bc=_0x25fe6e[_0x4903e5];return _0x5183bc;}export{F as default,$ as CommHub};
1
+ const a0_0x48272b=a0_0x4270;(function(_0x518421,_0x24257a){const _0x28eaa4=a0_0x4270,_0x3c9de8=_0x518421();while(!![]){try{const _0x586398=-parseInt(_0x28eaa4(0x242))/0x1+parseInt(_0x28eaa4(0x240))/0x2+parseInt(_0x28eaa4(0x229))/0x3*(parseInt(_0x28eaa4(0x24f))/0x4)+parseInt(_0x28eaa4(0x1ff))/0x5*(-parseInt(_0x28eaa4(0x263))/0x6)+parseInt(_0x28eaa4(0x22c))/0x7+parseInt(_0x28eaa4(0x214))/0x8*(parseInt(_0x28eaa4(0x262))/0x9)+-parseInt(_0x28eaa4(0x225))/0xa;if(_0x586398===_0x24257a)break;else _0x3c9de8['push'](_0x3c9de8['shift']());}catch(_0x51d780){_0x3c9de8['push'](_0x3c9de8['shift']());}}}(a0_0x4f75,0xd5184));import{EventEmitter as a0_0x5582f2}from'events';import{hostname as a0_0x56836f}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x552101,_0x16b042)=>(_0x552101??_0x16b042)[a0_0x48272b(0x230)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);function N(_0x53dcd9){const _0x2d194a=a0_0x48272b;return(_0x53dcd9 instanceof Error?_0x53dcd9['message']:String(_0x53dcd9??_0x2d194a(0x236)))[_0x2d194a(0x230)](K,_0x2d194a(0x258))[_0x2d194a(0x230)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x2d194a(0x260)](0x0,0xf0);}function O(_0x430111,_0x3b7071=process.env.ANET_TASK_TRACE_FORMAT===a0_0x48272b(0x23b)){const _0x37ee88=a0_0x48272b;if(_0x3b7071)return JSON[_0x37ee88(0x245)](_0x430111);let _0x4acdff=L(_0x430111['parent_task_id'],_0x37ee88(0x1ef)),_0x3add72=L(_0x430111[_0x37ee88(0x22e)],_0x37ee88(0x251)),_0x414faf=_0x430111['error_code']?_0x37ee88(0x219)+_0x430111['error_code']+':'+(_0x430111['error_message']??''):'';return _0x37ee88(0x228)+_0x430111[_0x37ee88(0x1fa)]+_0x37ee88(0x246)+L(_0x430111[_0x37ee88(0x22a)],_0x37ee88(0x244))+_0x37ee88(0x20b)+L(_0x430111[_0x37ee88(0x1f7)],_0x37ee88(0x244))+_0x37ee88(0x220)+_0x3add72+_0x37ee88(0x232)+_0x4acdff+_0x37ee88(0x1f5)+L(_0x430111['network_id'],_0x37ee88(0x244))+'\x20transport='+_0x430111[_0x37ee88(0x267)]+_0x37ee88(0x239)+_0x430111['duration_ms']+_0x37ee88(0x211)+_0x430111[_0x37ee88(0x204)]+_0x414faf;}function U(_0x1745a2){const _0x59ecd6=a0_0x48272b;return{'event':{'sending':_0x59ecd6(0x206),'delivered':_0x59ecd6(0x1f9),'failed':_0x59ecd6(0x1f2),'acked':_0x59ecd6(0x250),'started':_0x59ecd6(0x24e),'replied':'task.replied','expired':_0x59ecd6(0x1ee)}[_0x1745a2[_0x59ecd6(0x1fa)]],..._0x1745a2};}function a0_0x4f75(){const _0x3c7394=['name','heartbeatInterval','task.started','88qkXYlc','task.ack','<pending>','min','connectSSE','2.0','toString','getAllStatus','now','[REDACTED]','split','send_message','autoConnect','tools/call','catch','fromAlias','send','slice','application/json,\x20text/event-stream','27DpQXWL','541110YVYbgL','getReader','call','startsWith','transport','error','send_reply','result','task.expired','<missing>','idle','/mcp','task.send.failed','failed','completed','\x20network_id=','running','to_alias','log','task.send.delivered','status','type','resumeId','ack_inbox',']\x20[commhub:','80dPvtXV','task','sseAbort','read','lifecycleTracking','lifecycle_tracking','normal','task.send.start','alias','offline','message_id','report_status','\x20to=','send_rejected','CommHub\x20response\x20omitted\x20task_id','agent','broadcast','mcp_http','\x20lifecycle=','heartbeat\x20failed:\x20','Authorization','3354704AKYsOD','content','data:\x20','processInbox','toTimeString','\x20error=','send_task','new_message','connected','decode','SSE\x20failed:\x20','parentTaskId','\x20task_id=','disconnected','body','url','SSE\x20connected','1383540mYhJmK','connect','Bearer\x20','[commhub:task]\x20','41589tbyqgw','from_alias','token','5114235OYgWUU','signal','task_id','reconnectDelay','replace','get_inbox','\x20parent_task_id=','pop','heartbeatTimer','application/json','unknown\x20error','server','emit','\x20duration_ms=','delivered','json','networkId','sleep','inbox\x20error:\x20','get_all_status','518624iOrovF','text','98767TaVubW','/events/','<unknown>','stringify','\x20from=','parse','message','text/event-stream','sdk','toAlias'];a0_0x4f75=function(){return _0x3c7394;};return a0_0x4f75();}function j(_0xef2634){const _0xc62a7d=a0_0x48272b;let _0xcd4873=_0xef2634?.[_0xc62a7d(0x22e)]||_0xef2634?.[_0xc62a7d(0x209)]||_0xef2634?.['id'];if(_0xcd4873)return String(_0xcd4873);let _0x5cd0b5=_0xef2634?.[_0xc62a7d(0x215)]?.[0x0]?.['text'];if(typeof _0x5cd0b5!=='string')return null;try{let _0x36edf7=JSON['parse'](_0x5cd0b5);return _0x36edf7?.[_0xc62a7d(0x22e)]||_0x36edf7?.[_0xc62a7d(0x209)]||_0x36edf7?.['id']||null;}catch{return null;}}async function X(_0xfad233,_0x4feb00){const _0x4f15f1=a0_0x48272b;let _0x4f3335=_0x4feb00['now']??Date[_0x4f15f1(0x257)],_0x13b6c2=_0x4f3335(),_0x45e6fd=(_0xc4ef21,_0x5491ad,_0x9e9b6d,_0x10b7d8)=>{const _0x142824=_0x4f15f1;_0x4feb00[_0x142824(0x1f8)](O(U({'from_alias':_0xfad233[_0x142824(0x25e)],'to_alias':_0xfad233[_0x142824(0x24b)],'task_id':_0x5491ad,'parent_task_id':_0xfad233[_0x142824(0x21f)],'network_id':_0xfad233[_0x142824(0x23c)],'transport':_0xfad233[_0x142824(0x267)],'status':_0xc4ef21,'duration_ms':_0x4f3335()-_0x13b6c2,'lifecycle_tracking':_0xfad233[_0x142824(0x203)],..._0x9e9b6d!==void 0x0?{'error_code':_0x10b7d8||'send_failed','error_message':N(_0x9e9b6d)}:{}})));};_0x45e6fd('sending',null);try{let _0x26e393=await _0x4feb00[_0x4f15f1(0x25f)](),_0xc48db5=j(_0x26e393);if(_0xc48db5)_0x45e6fd(_0x4f15f1(0x23a),_0xc48db5);else{if(_0x26e393?.['ok']===!0x1||_0x26e393?.[_0x4f15f1(0x268)])_0x45e6fd(_0x4f15f1(0x1f3),_0xc48db5,_0x26e393?.[_0x4f15f1(0x268)]||'CommHub\x20rejected\x20task',_0x4f15f1(0x20c));else _0x45e6fd('failed',null,_0x4f15f1(0x20d),'missing_task_id');}return _0x26e393;}catch(_0x5e4fa3){throw _0x45e6fd(_0x4f15f1(0x1f3),null,_0x5e4fa3,'send_failed'),_0x5e4fa3;}}async function Y(_0x130bf6,_0x45cf15){const _0x8fe689=a0_0x48272b;return X({'fromAlias':_0x130bf6[_0x8fe689(0x25e)],'toAlias':_0x130bf6[_0x8fe689(0x207)],'parentTaskId':_0x130bf6[_0x8fe689(0x21f)]||null,'networkId':_0x130bf6[_0x8fe689(0x23c)]||null,'transport':_0x8fe689(0x210),'lifecycleTracking':'not_tracked'},_0x45cf15);}class $ extends a0_0x5582f2{['url'];[a0_0x48272b(0x207)];['token'];[a0_0x48272b(0x20e)];['resumeId'];[a0_0x48272b(0x24d)];[a0_0x48272b(0x22f)];[a0_0x48272b(0x234)];[a0_0x48272b(0x201)];[a0_0x48272b(0x1f6)]=!0x1;constructor(_0x9168e9){const _0x3cee55=a0_0x48272b;super();if(this['url']=_0x9168e9[_0x3cee55(0x223)][_0x3cee55(0x230)](/\/$/,''),this[_0x3cee55(0x207)]=_0x9168e9[_0x3cee55(0x207)],this[_0x3cee55(0x22b)]=_0x9168e9[_0x3cee55(0x22b)],this[_0x3cee55(0x20e)]=_0x9168e9[_0x3cee55(0x20e)]||_0x3cee55(0x24a),this[_0x3cee55(0x1fc)]='sdk-'+_0x9168e9[_0x3cee55(0x207)]+'-'+Date[_0x3cee55(0x257)]()[_0x3cee55(0x255)](0x24),this[_0x3cee55(0x24d)]=_0x9168e9[_0x3cee55(0x24d)]??0x2bf20,this[_0x3cee55(0x22f)]=_0x9168e9[_0x3cee55(0x22f)]??0xbb8,_0x9168e9[_0x3cee55(0x25b)]!==!0x1)this[_0x3cee55(0x226)]();}[a0_0x48272b(0x1f8)](_0x16c4a2){const _0x3f1fd5=a0_0x48272b;console[_0x3f1fd5(0x1f8)]('['+new Date()[_0x3f1fd5(0x218)]()['slice'](0x0,0x8)+_0x3f1fd5(0x1fe)+this['alias']+']\x20'+_0x16c4a2);}async[a0_0x48272b(0x265)](_0x3e61ec,_0x213d75){const _0x3a5cb0=a0_0x48272b;let _0x2fd48e={'Content-Type':_0x3a5cb0(0x235),'Accept':_0x3a5cb0(0x261)};if(this[_0x3a5cb0(0x22b)])_0x2fd48e['Authorization']=_0x3a5cb0(0x227)+this[_0x3a5cb0(0x22b)];let _0x103818=await(await fetch(this[_0x3a5cb0(0x223)]+_0x3a5cb0(0x1f1),{'method':'POST','headers':_0x2fd48e,'body':JSON[_0x3a5cb0(0x245)]({'jsonrpc':_0x3a5cb0(0x254),'id':Date[_0x3a5cb0(0x257)](),'method':_0x3a5cb0(0x25c),'params':{'name':_0x3e61ec,'arguments':_0x213d75}})}))[_0x3a5cb0(0x241)](),_0x5c0b84=_0x103818['match'](/data: (.+)/),_0x1831f2=_0x5c0b84?JSON[_0x3a5cb0(0x247)](_0x5c0b84[0x1]):JSON[_0x3a5cb0(0x247)](_0x103818),_0x2be163=_0x1831f2?.[_0x3a5cb0(0x1ed)]?.[_0x3a5cb0(0x215)]?.[0x0]?.[_0x3a5cb0(0x241)];return _0x2be163?JSON[_0x3a5cb0(0x247)](_0x2be163):_0x1831f2;}async[a0_0x48272b(0x226)](){const _0x4f17af=a0_0x48272b;if(this[_0x4f17af(0x1f6)])return;this[_0x4f17af(0x1f6)]=!0x0,await this[_0x4f17af(0x1fa)](_0x4f17af(0x1f0)),this['log']('registered'),this[_0x4f17af(0x234)]=setInterval(()=>{const _0x37bccc=_0x4f17af;this['status']('idle')['catch'](_0x52e170=>this[_0x37bccc(0x1f8)](_0x37bccc(0x212)+_0x52e170['message']));},this[_0x4f17af(0x24d)]),this[_0x4f17af(0x253)]();}async['disconnect'](){const _0x3164cc=a0_0x48272b;if(this[_0x3164cc(0x1f6)]=!0x1,this['sseAbort']?.['abort'](),this[_0x3164cc(0x234)])clearInterval(this['heartbeatTimer']);await this[_0x3164cc(0x1fa)](_0x3164cc(0x208))[_0x3164cc(0x25d)](()=>{}),this['log']('disconnected');}async[a0_0x48272b(0x25f)](_0x19d492,_0x51f329,_0x332591=a0_0x48272b(0x205)){const _0x6db59b=a0_0x48272b;return Y({'alias':_0x19d492,'fromAlias':this['alias']},{'log':_0x427ec5=>console[_0x6db59b(0x1f8)](_0x427ec5),'send':()=>this[_0x6db59b(0x265)](_0x6db59b(0x21a),{'alias':_0x19d492,'task':_0x51f329,'priority':_0x332591,'from_session':this[_0x6db59b(0x207)]})});}async['message'](_0x11f237,_0x527b95){const _0x4c312b=a0_0x48272b;return this['call'](_0x4c312b(0x25a),{'alias':_0x11f237,'message':_0x527b95,'from_session':this[_0x4c312b(0x207)]});}async['reply'](_0xb6822d,_0x4032f4,_0x55a2e0=a0_0x48272b(0x1f4)){const _0x20f505=a0_0x48272b;return this['call'](_0x20f505(0x269),{'in_reply_to':_0xb6822d,'text':_0x4032f4,'status':_0x55a2e0});}async[a0_0x48272b(0x1fa)](_0xdcd44d,_0xd200e7){const _0x16ca54=a0_0x48272b;return this[_0x16ca54(0x265)](_0x16ca54(0x20a),{'resume_id':this['resumeId'],'alias':this['alias'],'status':_0xdcd44d,'server':a0_0x56836f(),'hostname':a0_0x56836f(),'agent':this[_0x16ca54(0x20e)],'project_dir':process['cwd'](),..._0xd200e7});}async[a0_0x48272b(0x256)](){const _0x27abd0=a0_0x48272b;return this['call'](_0x27abd0(0x23f),{});}async[a0_0x48272b(0x20f)](_0x2f8faf,_0xd49d11){const _0x2136d8=a0_0x48272b;return this[_0x2136d8(0x265)]('broadcast',{'message':_0x2f8faf,'filter_server':_0xd49d11?.[_0x2136d8(0x237)],'filter_status':_0xd49d11?.[_0x2136d8(0x1fa)]});}async[a0_0x48272b(0x253)](){const _0x497fbb=a0_0x48272b;let _0x5f3279=encodeURIComponent(this[_0x497fbb(0x207)]),_0x19cb7d=this[_0x497fbb(0x223)]+_0x497fbb(0x243)+_0x5f3279,_0x3e2421=this[_0x497fbb(0x22f)];while(this[_0x497fbb(0x1f6)]){try{this[_0x497fbb(0x201)]=new AbortController();let _0x352782={'Accept':_0x497fbb(0x249)};if(this[_0x497fbb(0x22b)])_0x352782[_0x497fbb(0x213)]=_0x497fbb(0x227)+this['token'];let _0x30033=await fetch(_0x19cb7d,{'headers':_0x352782,'signal':this['sseAbort'][_0x497fbb(0x22d)]});if(!_0x30033['ok']||!_0x30033[_0x497fbb(0x222)]){this[_0x497fbb(0x1f8)](_0x497fbb(0x21e)+_0x30033['status']),await this[_0x497fbb(0x23d)](_0x3e2421),_0x3e2421=Math[_0x497fbb(0x252)](_0x3e2421*1.5,0xea60);continue;}_0x3e2421=this[_0x497fbb(0x22f)];let _0x2a0e20=_0x30033['body'][_0x497fbb(0x264)](),_0x189b3d=new TextDecoder(),_0x3f75e3='';while(this[_0x497fbb(0x1f6)]){let {done:_0x1a583b,value:_0x119e48}=await _0x2a0e20[_0x497fbb(0x202)]();if(_0x1a583b)break;_0x3f75e3+=_0x189b3d[_0x497fbb(0x21d)](_0x119e48,{'stream':!0x0});let _0x144efc=_0x3f75e3[_0x497fbb(0x259)]('\x0a');_0x3f75e3=_0x144efc[_0x497fbb(0x233)]()||'';for(let _0x5c2778 of _0x144efc){if(!_0x5c2778[_0x497fbb(0x266)](_0x497fbb(0x216)))continue;try{let _0x2d5dd3=JSON['parse'](_0x5c2778[_0x497fbb(0x260)](0x6));if(_0x2d5dd3['type']===_0x497fbb(0x21c)){this[_0x497fbb(0x1f8)](_0x497fbb(0x224)),this[_0x497fbb(0x238)](_0x497fbb(0x21c));continue;}if(_0x2d5dd3[_0x497fbb(0x1fb)]==='new_task'||_0x2d5dd3[_0x497fbb(0x1fb)]===_0x497fbb(0x21b)||_0x2d5dd3[_0x497fbb(0x1fb)]===_0x497fbb(0x20f))await this[_0x497fbb(0x217)]();}catch{}}}}catch(_0x234b32){if(_0x234b32[_0x497fbb(0x24c)]==='AbortError')break;this[_0x497fbb(0x238)](_0x497fbb(0x268),_0x234b32),this['log']('SSE\x20error:\x20'+_0x234b32[_0x497fbb(0x248)]);}if(this[_0x497fbb(0x1f6)])this[_0x497fbb(0x238)](_0x497fbb(0x221)),this[_0x497fbb(0x1f8)]('SSE\x20reconnecting\x20in\x20'+_0x3e2421/0x3e8+'s...'),await this[_0x497fbb(0x23d)](_0x3e2421),_0x3e2421=Math['min'](_0x3e2421*1.5,0xea60);}}async['processInbox'](){const _0x5473b0=a0_0x48272b;try{let _0x49d8ca=(await this[_0x5473b0(0x265)](_0x5473b0(0x231),{'alias':this[_0x5473b0(0x207)],'limit':0xa}))?.['messages']||[];for(let _0x5554a2 of _0x49d8ca)await this['call'](_0x5473b0(0x1fd),{'alias':this[_0x5473b0(0x207)],'message_id':_0x5554a2['id']}),this['log']('←\x20'+_0x5554a2['from_session']+':\x20'+_0x5554a2[_0x5473b0(0x215)][_0x5473b0(0x260)](0x0,0x3c)),this['emit'](_0x5473b0(0x200),_0x5554a2),this[_0x5473b0(0x238)](_0x5473b0(0x248),_0x5554a2);}catch(_0x2729c7){this['log'](_0x5473b0(0x23e)+_0x2729c7[_0x5473b0(0x248)]);}}['sleep'](_0x235230){return new Promise(_0x47d8e1=>setTimeout(_0x47d8e1,_0x235230));}}function a0_0x4270(_0x32b12a,_0x15415d){_0x32b12a=_0x32b12a-0x1ed;const _0x4f750b=a0_0x4f75();let _0x427085=_0x4f750b[_0x32b12a];return _0x427085;}var F=$;export{F as default,$ as CommHub};
@@ -1,10 +1,10 @@
1
1
  export type GrokCopresenceSessionDisclosure = "configured" | "new" | "resume";
2
2
  export type GrokCopresenceDisclosure = {
3
- profile: "commhub-only" | "x-search" | "invalid";
3
+ profile: "commhub-only" | "x-search" | "repo-read" | "invalid";
4
4
  lines: readonly string[];
5
5
  };
6
6
  /**
7
- * Describe only the two exact tool profiles accepted by the pinned Grok TUI
7
+ * Describe only the exact tool profiles accepted by the pinned Grok TUI
8
8
  * runtime. This is deliberately exact: a near-miss must never be presented as
9
9
  * either reviewed capability set.
10
10
  */
@@ -46,4 +46,20 @@ export declare function grokCopresenceSocketPaths(nodeId: string, options?: Grok
46
46
  leaderSocket: string;
47
47
  attachSocket: string;
48
48
  };
49
+ export type GrokAttachTarget = {
50
+ ok: true;
51
+ socketPath: string;
52
+ } | {
53
+ ok: false;
54
+ reason: "not_grok_build_cli" | "headless" | "missing_attach_socket";
55
+ };
56
+ /**
57
+ * `anet grok attach` eligibility. The CLI is the only human join path;
58
+ * this is the shipped decision so tests can drive it without a TTY.
59
+ */
60
+ export declare function resolveGrokAttachTarget(input: {
61
+ runtime: string;
62
+ grokCopresence?: unknown;
63
+ grokAttachSocket?: unknown;
64
+ }): GrokAttachTarget;
49
65
  export declare function grokBuildCliCreationFields(runtime: string, nodeId: string, headless?: boolean, options?: GrokSocketPathOptions): GrokCopresenceProfileFields | Record<string, never>;