@sleep2agi/agent-network 2.3.0-preview.109 → 2.3.0-preview.110

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_0x437b34=a0_0xf07a;(function(_0x38fd25,_0x1e0409){const _0x56698f=a0_0xf07a,_0xf836f3=_0x38fd25();while(!![]){try{const _0x254ee1=-parseInt(_0x56698f(0x198))/0x1*(parseInt(_0x56698f(0x13e))/0x2)+parseInt(_0x56698f(0x16e))/0x3*(parseInt(_0x56698f(0x144))/0x4)+parseInt(_0x56698f(0x135))/0x5+parseInt(_0x56698f(0x17a))/0x6+-parseInt(_0x56698f(0x132))/0x7*(parseInt(_0x56698f(0x151))/0x8)+parseInt(_0x56698f(0x161))/0x9+-parseInt(_0x56698f(0x19c))/0xa*(-parseInt(_0x56698f(0x175))/0xb);if(_0x254ee1===_0x1e0409)break;else _0xf836f3['push'](_0xf836f3['shift']());}catch(_0x45e495){_0xf836f3['push'](_0xf836f3['shift']());}}}(a0_0x5307,0x1e1e8));import{EventEmitter as a0_0x3726ac}from'events';function a0_0x5307(){const _0x1d0c16=['sleep','connected','decode','result','POST','<unknown>','parse','2riHCEG','task_id','transport','now','error','task.send.delivered','92rtQTag','send_failed','<missing>','missing_task_id','\x20to=','text','send_task','signal','registered','messages','report_status','send','from_session','1866856QODCyZ','pop','task.ack','log','get_all_status','autoConnect','new_message','\x20network_id=','processInbox','to_alias','\x20lifecycle=','url','running','idle','reconnectDelay','s...','405144XQJXIl','unknown\x20error','completed','heartbeatTimer','task.expired','connect','match','broadcast','sdk','lifecycleTracking','\x20transport=','agent','heartbeatInterval','21879bQMdvk','task.send.start','slice','toTimeString','text/event-stream','\x20parent_task_id=','networkId','3751zsqRJI','message','message_id','failed','normal','244902WAgvLi','\x20error=','AbortError','stringify','SSE\x20failed:\x20','sdk-','resumeId','sseAbort','not_tracked','application/json,\x20text/event-stream','startsWith','replace','reply',']\x20[commhub:','toString','call','task.started','task.replied','sending','new_task','/mcp','send_message','emit','data:\x20','heartbeat\x20failed:\x20','Bearer\x20','content','token','parent_task_id','delivered','183409ZknYvr','task','offline','disconnected','6820dMAWwo','cwd','[commhub:task]\x20','duration_ms','abort','application/json','send_reply','send_rejected','connectSSE','getAllStatus','body','split','type','<pending>','status','CommHub\x20response\x20omitted\x20task_id','alias','\x20duration_ms=','catch','getReader','task.send.failed','SSE\x20connected','parentTaskId','server','7hPqpSq','mcp_http','lifecycle_tracking','270000RTDumu','SSE\x20error:\x20'];a0_0x5307=function(){return _0x1d0c16;};return a0_0x5307();}import{hostname as a0_0x537b2c}from'os';function a0_0xf07a(_0x22ab29,_0x311ae2){_0x22ab29=_0x22ab29-0x11c;const _0x5307ee=a0_0x5307();let _0xf07a7=_0x5307ee[_0x22ab29];return _0xf07a7;}var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x27d89d,_0x4b221a)=>(_0x27d89d??_0x4b221a)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x437b34(0x170)](0x0,0xf0);function N(_0x43360f){const _0x7deb01=a0_0x437b34;return(_0x43360f instanceof Error?_0x43360f[_0x7deb01(0x176)]:String(_0x43360f??_0x7deb01(0x162)))[_0x7deb01(0x185)](K,'[REDACTED]')[_0x7deb01(0x185)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x7deb01(0x170)](0x0,0xf0);}function O(_0x2a2447,_0x13a80a=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0x43f7c7=a0_0x437b34;if(_0x13a80a)return JSON[_0x43f7c7(0x17d)](_0x2a2447);let _0x4a71c7=L(_0x2a2447[_0x43f7c7(0x196)],_0x43f7c7(0x146)),_0x4bd662=L(_0x2a2447[_0x43f7c7(0x13f)],_0x43f7c7(0x127)),_0x2bdd1e=_0x2a2447['error_code']?_0x43f7c7(0x17b)+_0x2a2447['error_code']+':'+(_0x2a2447['error_message']??''):'';return _0x43f7c7(0x11c)+_0x2a2447[_0x43f7c7(0x128)]+'\x20from='+L(_0x2a2447['from_alias'],_0x43f7c7(0x13c))+_0x43f7c7(0x148)+L(_0x2a2447[_0x43f7c7(0x15a)],_0x43f7c7(0x13c))+'\x20task_id='+_0x4bd662+_0x43f7c7(0x173)+_0x4a71c7+_0x43f7c7(0x158)+L(_0x2a2447['network_id'],_0x43f7c7(0x13c))+_0x43f7c7(0x16b)+_0x2a2447[_0x43f7c7(0x140)]+_0x43f7c7(0x12b)+_0x2a2447[_0x43f7c7(0x11d)]+_0x43f7c7(0x15b)+_0x2a2447[_0x43f7c7(0x134)]+_0x2bdd1e;}function U(_0x161344){const _0x5d5e67=a0_0x437b34;return{'event':{'sending':_0x5d5e67(0x16f),'delivered':_0x5d5e67(0x143),'failed':_0x5d5e67(0x12e),'acked':_0x5d5e67(0x153),'started':_0x5d5e67(0x18a),'replied':_0x5d5e67(0x18b),'expired':_0x5d5e67(0x165)}[_0x161344[_0x5d5e67(0x128)]],..._0x161344};}function j(_0xb42e37){const _0xb5723a=a0_0x437b34;let _0x3b359b=_0xb42e37?.[_0xb5723a(0x13f)]||_0xb42e37?.['message_id']||_0xb42e37?.['id'];if(_0x3b359b)return String(_0x3b359b);let _0x319067=_0xb42e37?.[_0xb5723a(0x194)]?.[0x0]?.[_0xb5723a(0x149)];if(typeof _0x319067!=='string')return null;try{let _0x769eab=JSON[_0xb5723a(0x13d)](_0x319067);return _0x769eab?.[_0xb5723a(0x13f)]||_0x769eab?.[_0xb5723a(0x177)]||_0x769eab?.['id']||null;}catch{return null;}}async function X(_0x174e1c,_0x40d717){const _0x14d5cd=a0_0x437b34;let _0x2eb449=_0x40d717[_0x14d5cd(0x141)]??Date[_0x14d5cd(0x141)],_0x470e27=_0x2eb449(),_0x76424f=(_0x548e42,_0x1c301f,_0x3866e4,_0x2e5d92)=>{const _0x32ddb3=_0x14d5cd;_0x40d717['log'](O(U({'from_alias':_0x174e1c['fromAlias'],'to_alias':_0x174e1c['toAlias'],'task_id':_0x1c301f,'parent_task_id':_0x174e1c[_0x32ddb3(0x130)],'network_id':_0x174e1c[_0x32ddb3(0x174)],'transport':_0x174e1c['transport'],'status':_0x548e42,'duration_ms':_0x2eb449()-_0x470e27,'lifecycle_tracking':_0x174e1c[_0x32ddb3(0x16a)],..._0x3866e4!==void 0x0?{'error_code':_0x2e5d92||_0x32ddb3(0x145),'error_message':N(_0x3866e4)}:{}})));};_0x76424f(_0x14d5cd(0x18c),null);try{let _0x44a7ab=await _0x40d717[_0x14d5cd(0x14f)](),_0x4e3966=j(_0x44a7ab);if(_0x4e3966)_0x76424f(_0x14d5cd(0x197),_0x4e3966);else{if(_0x44a7ab?.['ok']===!0x1||_0x44a7ab?.[_0x14d5cd(0x142)])_0x76424f(_0x14d5cd(0x178),_0x4e3966,_0x44a7ab?.['error']||'CommHub\x20rejected\x20task',_0x14d5cd(0x121));else _0x76424f(_0x14d5cd(0x178),null,_0x14d5cd(0x129),_0x14d5cd(0x147));}return _0x44a7ab;}catch(_0x53c6c7){throw _0x76424f(_0x14d5cd(0x178),null,_0x53c6c7,_0x14d5cd(0x145)),_0x53c6c7;}}async function Y(_0x14a3ec,_0x46d465){const _0xb189a1=a0_0x437b34;return X({'fromAlias':_0x14a3ec['fromAlias'],'toAlias':_0x14a3ec[_0xb189a1(0x12a)],'parentTaskId':_0x14a3ec[_0xb189a1(0x130)]||null,'networkId':_0x14a3ec[_0xb189a1(0x174)]||null,'transport':_0xb189a1(0x133),'lifecycleTracking':_0xb189a1(0x182)},_0x46d465);}class $ extends a0_0x3726ac{[a0_0x437b34(0x15c)];[a0_0x437b34(0x12a)];[a0_0x437b34(0x195)];[a0_0x437b34(0x16c)];[a0_0x437b34(0x180)];[a0_0x437b34(0x16d)];[a0_0x437b34(0x15f)];[a0_0x437b34(0x164)];[a0_0x437b34(0x181)];[a0_0x437b34(0x15d)]=!0x1;constructor(_0x29a3e){const _0x1ce120=a0_0x437b34;super();if(this['url']=_0x29a3e[_0x1ce120(0x15c)][_0x1ce120(0x185)](/\/$/,''),this['alias']=_0x29a3e[_0x1ce120(0x12a)],this[_0x1ce120(0x195)]=_0x29a3e[_0x1ce120(0x195)],this[_0x1ce120(0x16c)]=_0x29a3e[_0x1ce120(0x16c)]||_0x1ce120(0x169),this['resumeId']=_0x1ce120(0x17f)+_0x29a3e['alias']+'-'+Date[_0x1ce120(0x141)]()[_0x1ce120(0x188)](0x24),this[_0x1ce120(0x16d)]=_0x29a3e[_0x1ce120(0x16d)]??0x2bf20,this[_0x1ce120(0x15f)]=_0x29a3e['reconnectDelay']??0xbb8,_0x29a3e[_0x1ce120(0x156)]!==!0x1)this['connect']();}[a0_0x437b34(0x154)](_0x36a660){const _0x5193e5=a0_0x437b34;console['log']('['+new Date()[_0x5193e5(0x171)]()[_0x5193e5(0x170)](0x0,0x8)+_0x5193e5(0x187)+this[_0x5193e5(0x12a)]+']\x20'+_0x36a660);}async[a0_0x437b34(0x189)](_0x3ce4cc,_0x540600){const _0x16fe10=a0_0x437b34;let _0x59b895={'Content-Type':_0x16fe10(0x11f),'Accept':_0x16fe10(0x183)};if(this[_0x16fe10(0x195)])_0x59b895['Authorization']=_0x16fe10(0x193)+this['token'];let _0x1ffa55=await(await fetch(this[_0x16fe10(0x15c)]+_0x16fe10(0x18e),{'method':_0x16fe10(0x13b),'headers':_0x59b895,'body':JSON[_0x16fe10(0x17d)]({'jsonrpc':'2.0','id':Date[_0x16fe10(0x141)](),'method':'tools/call','params':{'name':_0x3ce4cc,'arguments':_0x540600}})}))[_0x16fe10(0x149)](),_0x3d104b=_0x1ffa55[_0x16fe10(0x167)](/data: (.+)/),_0x4b64ca=_0x3d104b?JSON[_0x16fe10(0x13d)](_0x3d104b[0x1]):JSON['parse'](_0x1ffa55),_0x3770ac=_0x4b64ca?.[_0x16fe10(0x13a)]?.['content']?.[0x0]?.[_0x16fe10(0x149)];return _0x3770ac?JSON[_0x16fe10(0x13d)](_0x3770ac):_0x4b64ca;}async[a0_0x437b34(0x166)](){const _0x686384=a0_0x437b34;if(this[_0x686384(0x15d)])return;this[_0x686384(0x15d)]=!0x0,await this['status'](_0x686384(0x15e)),this['log'](_0x686384(0x14c)),this[_0x686384(0x164)]=setInterval(()=>{const _0x21ff45=_0x686384;this[_0x21ff45(0x128)](_0x21ff45(0x15e))['catch'](_0x1730d5=>this[_0x21ff45(0x154)](_0x21ff45(0x192)+_0x1730d5['message']));},this['heartbeatInterval']),this[_0x686384(0x122)]();}async['disconnect'](){const _0x2b022b=a0_0x437b34;if(this[_0x2b022b(0x15d)]=!0x1,this['sseAbort']?.[_0x2b022b(0x11e)](),this[_0x2b022b(0x164)])clearInterval(this['heartbeatTimer']);await this[_0x2b022b(0x128)](_0x2b022b(0x19a))[_0x2b022b(0x12c)](()=>{}),this[_0x2b022b(0x154)](_0x2b022b(0x19b));}async[a0_0x437b34(0x14f)](_0x124861,_0x13b923,_0x2811c1=a0_0x437b34(0x179)){const _0x5c1197=a0_0x437b34;return Y({'alias':_0x124861,'fromAlias':this[_0x5c1197(0x12a)]},{'log':_0x1de1c1=>console[_0x5c1197(0x154)](_0x1de1c1),'send':()=>this[_0x5c1197(0x189)](_0x5c1197(0x14a),{'alias':_0x124861,'task':_0x13b923,'priority':_0x2811c1,'from_session':this[_0x5c1197(0x12a)]})});}async['message'](_0x220aa8,_0x543527){const _0xd48640=a0_0x437b34;return this[_0xd48640(0x189)](_0xd48640(0x18f),{'alias':_0x220aa8,'message':_0x543527,'from_session':this[_0xd48640(0x12a)]});}async[a0_0x437b34(0x186)](_0x980bf0,_0x4194f0,_0x293783=a0_0x437b34(0x163)){const _0x5d68eb=a0_0x437b34;return this[_0x5d68eb(0x189)](_0x5d68eb(0x120),{'in_reply_to':_0x980bf0,'text':_0x4194f0,'status':_0x293783});}async[a0_0x437b34(0x128)](_0x18c0e2,_0x30095a){const _0x2ee4b8=a0_0x437b34;return this['call'](_0x2ee4b8(0x14e),{'resume_id':this[_0x2ee4b8(0x180)],'alias':this[_0x2ee4b8(0x12a)],'status':_0x18c0e2,'server':a0_0x537b2c(),'hostname':a0_0x537b2c(),'agent':this[_0x2ee4b8(0x16c)],'project_dir':process[_0x2ee4b8(0x19d)](),..._0x30095a});}async[a0_0x437b34(0x123)](){const _0x24002c=a0_0x437b34;return this['call'](_0x24002c(0x155),{});}async['broadcast'](_0x1c053a,_0x541a15){const _0x285383=a0_0x437b34;return this[_0x285383(0x189)](_0x285383(0x168),{'message':_0x1c053a,'filter_server':_0x541a15?.[_0x285383(0x131)],'filter_status':_0x541a15?.[_0x285383(0x128)]});}async[a0_0x437b34(0x122)](){const _0x27928d=a0_0x437b34;let _0x1f2f45=encodeURIComponent(this['alias']),_0x3c30b2=this['url']+'/events/'+_0x1f2f45,_0x51aec5=this[_0x27928d(0x15f)];while(this[_0x27928d(0x15d)]){try{this[_0x27928d(0x181)]=new AbortController();let _0x38ba3e={'Accept':_0x27928d(0x172)};if(this[_0x27928d(0x195)])_0x38ba3e['Authorization']=_0x27928d(0x193)+this['token'];let _0x5a5d60=await fetch(_0x3c30b2,{'headers':_0x38ba3e,'signal':this[_0x27928d(0x181)][_0x27928d(0x14b)]});if(!_0x5a5d60['ok']||!_0x5a5d60[_0x27928d(0x124)]){this[_0x27928d(0x154)](_0x27928d(0x17e)+_0x5a5d60[_0x27928d(0x128)]),await this[_0x27928d(0x137)](_0x51aec5),_0x51aec5=Math['min'](_0x51aec5*1.5,0xea60);continue;}_0x51aec5=this[_0x27928d(0x15f)];let _0x13bd54=_0x5a5d60[_0x27928d(0x124)][_0x27928d(0x12d)](),_0x1adcfe=new TextDecoder(),_0x5c3de8='';while(this[_0x27928d(0x15d)]){let {done:_0x505c01,value:_0xedf7cf}=await _0x13bd54['read']();if(_0x505c01)break;_0x5c3de8+=_0x1adcfe[_0x27928d(0x139)](_0xedf7cf,{'stream':!0x0});let _0x331c2a=_0x5c3de8[_0x27928d(0x125)]('\x0a');_0x5c3de8=_0x331c2a[_0x27928d(0x152)]()||'';for(let _0x2fa687 of _0x331c2a){if(!_0x2fa687[_0x27928d(0x184)](_0x27928d(0x191)))continue;try{let _0x25f746=JSON['parse'](_0x2fa687[_0x27928d(0x170)](0x6));if(_0x25f746[_0x27928d(0x126)]===_0x27928d(0x138)){this[_0x27928d(0x154)](_0x27928d(0x12f)),this['emit'](_0x27928d(0x138));continue;}if(_0x25f746['type']===_0x27928d(0x18d)||_0x25f746[_0x27928d(0x126)]===_0x27928d(0x157)||_0x25f746[_0x27928d(0x126)]==='broadcast')await this[_0x27928d(0x159)]();}catch{}}}}catch(_0x43c646){if(_0x43c646['name']===_0x27928d(0x17c))break;this[_0x27928d(0x190)](_0x27928d(0x142),_0x43c646),this['log'](_0x27928d(0x136)+_0x43c646[_0x27928d(0x176)]);}if(this[_0x27928d(0x15d)])this[_0x27928d(0x190)]('disconnected'),this[_0x27928d(0x154)]('SSE\x20reconnecting\x20in\x20'+_0x51aec5/0x3e8+_0x27928d(0x160)),await this[_0x27928d(0x137)](_0x51aec5),_0x51aec5=Math['min'](_0x51aec5*1.5,0xea60);}}async[a0_0x437b34(0x159)](){const _0x52c15f=a0_0x437b34;try{let _0x4dc308=(await this[_0x52c15f(0x189)]('get_inbox',{'alias':this[_0x52c15f(0x12a)],'limit':0xa}))?.[_0x52c15f(0x14d)]||[];for(let _0x370045 of _0x4dc308)await this[_0x52c15f(0x189)]('ack_inbox',{'alias':this['alias'],'message_id':_0x370045['id']}),this[_0x52c15f(0x154)]('←\x20'+_0x370045[_0x52c15f(0x150)]+':\x20'+_0x370045['content'][_0x52c15f(0x170)](0x0,0x3c)),this['emit'](_0x52c15f(0x199),_0x370045),this[_0x52c15f(0x190)](_0x52c15f(0x176),_0x370045);}catch(_0x40f6df){this[_0x52c15f(0x154)]('inbox\x20error:\x20'+_0x40f6df[_0x52c15f(0x176)]);}}['sleep'](_0x39f71d){return new Promise(_0x2c6d5b=>setTimeout(_0x2c6d5b,_0x39f71d));}}var F=$;export{F as default,$ as CommHub};
1
+ const a0_0x299df7=a0_0x1702;(function(_0x3c2861,_0x2ece58){const _0xc758b8=a0_0x1702,_0x32f1e7=_0x3c2861();while(!![]){try{const _0x897b03=-parseInt(_0xc758b8(0x1d1))/0x1*(-parseInt(_0xc758b8(0x1b8))/0x2)+-parseInt(_0xc758b8(0x198))/0x3+parseInt(_0xc758b8(0x1bd))/0x4*(parseInt(_0xc758b8(0x1db))/0x5)+-parseInt(_0xc758b8(0x1c4))/0x6+parseInt(_0xc758b8(0x194))/0x7+-parseInt(_0xc758b8(0x1a2))/0x8*(-parseInt(_0xc758b8(0x1eb))/0x9)+-parseInt(_0xc758b8(0x18b))/0xa*(parseInt(_0xc758b8(0x199))/0xb);if(_0x897b03===_0x2ece58)break;else _0x32f1e7['push'](_0x32f1e7['shift']());}catch(_0x5194b7){_0x32f1e7['push'](_0x32f1e7['shift']());}}}(a0_0x2af0,0xb1cf2));import{EventEmitter as a0_0x243591}from'events';import{hostname as a0_0x29b66a}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x412db3,_0xdc3f)=>(_0x412db3??_0xdc3f)[a0_0x299df7(0x1b1)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x299df7(0x1ff)](0x0,0xf0);function N(_0x1e1dc4){const _0x37cffa=a0_0x299df7;return(_0x1e1dc4 instanceof Error?_0x1e1dc4[_0x37cffa(0x1a7)]:String(_0x1e1dc4??'unknown\x20error'))[_0x37cffa(0x1b1)](K,'[REDACTED]')['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x37cffa(0x1ff)](0x0,0xf0);}function a0_0x2af0(){const _0x1be8a8=['SSE\x20failed:\x20','getAllStatus','parse','reply','startsWith','<missing>','error_code','network_id','type','toString','connect','sending','min','474120PttKzj','from_alias','report_status','failed','Bearer\x20','\x20transport=','stringify','send_reply','<pending>','fromAlias','to_alias','call','getReader','match','error','abort','url','send_task','sdk-','2.0','slice','\x20duration_ms=','inbox\x20error:\x20','application/json','duration_ms','data:\x20','\x20from=','task.started','47810vVpceb','idle','parentTaskId','status','SSE\x20reconnecting\x20in\x20','lifecycleTracking','connectSSE','running','reconnectDelay','6753355ktAjIL','text','message_id','send_rejected','1360965AaDQEq','2167nXQakN','cwd','disconnected','get_all_status','emit',']\x20[commhub:','processInbox','networkId','catch','32pGIQHp','now','agent','[commhub:task]\x20','json','message','log','sleep','heartbeatTimer','heartbeatInterval','pop','\x20error=','not_tracked','delivered','tools/call','replace','parent_task_id','text/event-stream','CommHub\x20response\x20omitted\x20task_id','sseAbort','send','connected','3826ajLoWa','Authorization','task.send.failed','mcp_http','new_message','8iirrEE','content','/mcp','s...','broadcast','token','POST','3166188GeCsbE','transport','ack_inbox','decode','task.replied','\x20network_id=','<unknown>','normal','signal','task.expired','application/json,\x20text/event-stream','task_id','from_session','73vmhcGp','body','heartbeat\x20failed:\x20','alias','SSE\x20error:\x20','resumeId','send_failed','task.send.start','new_task','read','3340955CtXfGp','toTimeString','\x20lifecycle='];a0_0x2af0=function(){return _0x1be8a8;};return a0_0x2af0();}function O(_0x2979fe,_0x5e97c0=process.env.ANET_TASK_TRACE_FORMAT===a0_0x299df7(0x1a6)){const _0xe754fc=a0_0x299df7;if(_0x5e97c0)return JSON[_0xe754fc(0x1f1)](_0x2979fe);let _0x1075ed=L(_0x2979fe[_0xe754fc(0x1b2)],_0xe754fc(0x1e3)),_0x4b31b8=L(_0x2979fe['task_id'],_0xe754fc(0x1f3)),_0x4489f5=_0x2979fe[_0xe754fc(0x1e4)]?_0xe754fc(0x1ad)+_0x2979fe[_0xe754fc(0x1e4)]+':'+(_0x2979fe['error_message']??''):'';return _0xe754fc(0x1a5)+_0x2979fe[_0xe754fc(0x18e)]+_0xe754fc(0x189)+L(_0x2979fe[_0xe754fc(0x1ec)],_0xe754fc(0x1ca))+'\x20to='+L(_0x2979fe[_0xe754fc(0x1f5)],_0xe754fc(0x1ca))+'\x20task_id='+_0x4b31b8+'\x20parent_task_id='+_0x1075ed+_0xe754fc(0x1c9)+L(_0x2979fe[_0xe754fc(0x1e5)],_0xe754fc(0x1ca))+_0xe754fc(0x1f0)+_0x2979fe[_0xe754fc(0x1c5)]+_0xe754fc(0x200)+_0x2979fe[_0xe754fc(0x187)]+_0xe754fc(0x1dd)+_0x2979fe['lifecycle_tracking']+_0x4489f5;}function U(_0x11919c){const _0x1cfabe=a0_0x299df7;return{'event':{'sending':_0x1cfabe(0x1d8),'delivered':'task.send.delivered','failed':_0x1cfabe(0x1ba),'acked':'task.ack','started':_0x1cfabe(0x18a),'replied':_0x1cfabe(0x1c8),'expired':_0x1cfabe(0x1cd)}[_0x11919c[_0x1cfabe(0x18e)]],..._0x11919c};}function j(_0x2162cf){const _0x369abc=a0_0x299df7;let _0x293409=_0x2162cf?.[_0x369abc(0x1cf)]||_0x2162cf?.['message_id']||_0x2162cf?.['id'];if(_0x293409)return String(_0x293409);let _0x4b3c43=_0x2162cf?.[_0x369abc(0x1be)]?.[0x0]?.[_0x369abc(0x195)];if(typeof _0x4b3c43!=='string')return null;try{let _0x319218=JSON[_0x369abc(0x1e0)](_0x4b3c43);return _0x319218?.[_0x369abc(0x1cf)]||_0x319218?.[_0x369abc(0x196)]||_0x319218?.['id']||null;}catch{return null;}}async function X(_0x2d0768,_0xfc4e68){const _0x2931eb=a0_0x299df7;let _0x2abfd4=_0xfc4e68[_0x2931eb(0x1a3)]??Date['now'],_0x24272d=_0x2abfd4(),_0x4a6715=(_0x5ee53f,_0x23c4e3,_0x1ad9b3,_0x34ad5a)=>{const _0x45f006=_0x2931eb;_0xfc4e68[_0x45f006(0x1a8)](O(U({'from_alias':_0x2d0768['fromAlias'],'to_alias':_0x2d0768['toAlias'],'task_id':_0x23c4e3,'parent_task_id':_0x2d0768[_0x45f006(0x18d)],'network_id':_0x2d0768[_0x45f006(0x1a0)],'transport':_0x2d0768[_0x45f006(0x1c5)],'status':_0x5ee53f,'duration_ms':_0x2abfd4()-_0x24272d,'lifecycle_tracking':_0x2d0768[_0x45f006(0x190)],..._0x1ad9b3!==void 0x0?{'error_code':_0x34ad5a||'send_failed','error_message':N(_0x1ad9b3)}:{}})));};_0x4a6715(_0x2931eb(0x1e9),null);try{let _0x3d2bb6=await _0xfc4e68[_0x2931eb(0x1b6)](),_0xaa36a4=j(_0x3d2bb6);if(_0xaa36a4)_0x4a6715(_0x2931eb(0x1af),_0xaa36a4);else{if(_0x3d2bb6?.['ok']===!0x1||_0x3d2bb6?.[_0x2931eb(0x1f9)])_0x4a6715(_0x2931eb(0x1ee),_0xaa36a4,_0x3d2bb6?.[_0x2931eb(0x1f9)]||'CommHub\x20rejected\x20task',_0x2931eb(0x197));else _0x4a6715(_0x2931eb(0x1ee),null,_0x2931eb(0x1b4),'missing_task_id');}return _0x3d2bb6;}catch(_0x535214){throw _0x4a6715(_0x2931eb(0x1ee),null,_0x535214,_0x2931eb(0x1d7)),_0x535214;}}async function Y(_0x8441f8,_0x205aa3){const _0x262aa1=a0_0x299df7;return X({'fromAlias':_0x8441f8[_0x262aa1(0x1f4)],'toAlias':_0x8441f8[_0x262aa1(0x1d4)],'parentTaskId':_0x8441f8[_0x262aa1(0x18d)]||null,'networkId':_0x8441f8['networkId']||null,'transport':_0x262aa1(0x1bb),'lifecycleTracking':_0x262aa1(0x1ae)},_0x205aa3);}function a0_0x1702(_0x3fa9a6,_0x4cdf26){_0x3fa9a6=_0x3fa9a6-0x185;const _0x2af0de=a0_0x2af0();let _0x1702f1=_0x2af0de[_0x3fa9a6];return _0x1702f1;}class $ extends a0_0x243591{['url'];['alias'];[a0_0x299df7(0x1c2)];[a0_0x299df7(0x1a4)];[a0_0x299df7(0x1d6)];[a0_0x299df7(0x1ab)];['reconnectDelay'];[a0_0x299df7(0x1aa)];[a0_0x299df7(0x1b5)];['running']=!0x1;constructor(_0x22b9dc){const _0x31ff1c=a0_0x299df7;super();if(this['url']=_0x22b9dc['url'][_0x31ff1c(0x1b1)](/\/$/,''),this['alias']=_0x22b9dc[_0x31ff1c(0x1d4)],this[_0x31ff1c(0x1c2)]=_0x22b9dc['token'],this['agent']=_0x22b9dc[_0x31ff1c(0x1a4)]||'sdk',this[_0x31ff1c(0x1d6)]=_0x31ff1c(0x1fd)+_0x22b9dc[_0x31ff1c(0x1d4)]+'-'+Date[_0x31ff1c(0x1a3)]()[_0x31ff1c(0x1e7)](0x24),this['heartbeatInterval']=_0x22b9dc[_0x31ff1c(0x1ab)]??0x2bf20,this[_0x31ff1c(0x193)]=_0x22b9dc[_0x31ff1c(0x193)]??0xbb8,_0x22b9dc['autoConnect']!==!0x1)this[_0x31ff1c(0x1e8)]();}['log'](_0x2878da){const _0x3dbbcf=a0_0x299df7;console['log']('['+new Date()[_0x3dbbcf(0x1dc)]()['slice'](0x0,0x8)+_0x3dbbcf(0x19e)+this['alias']+']\x20'+_0x2878da);}async[a0_0x299df7(0x1f6)](_0x5435ec,_0x260c01){const _0x42f2c8=a0_0x299df7;let _0x4d8388={'Content-Type':_0x42f2c8(0x186),'Accept':_0x42f2c8(0x1ce)};if(this['token'])_0x4d8388[_0x42f2c8(0x1b9)]='Bearer\x20'+this['token'];let _0xb7c83d=await(await fetch(this[_0x42f2c8(0x1fb)]+_0x42f2c8(0x1bf),{'method':_0x42f2c8(0x1c3),'headers':_0x4d8388,'body':JSON[_0x42f2c8(0x1f1)]({'jsonrpc':_0x42f2c8(0x1fe),'id':Date[_0x42f2c8(0x1a3)](),'method':_0x42f2c8(0x1b0),'params':{'name':_0x5435ec,'arguments':_0x260c01}})}))['text'](),_0x5f5c36=_0xb7c83d[_0x42f2c8(0x1f8)](/data: (.+)/),_0x25a33c=_0x5f5c36?JSON[_0x42f2c8(0x1e0)](_0x5f5c36[0x1]):JSON['parse'](_0xb7c83d),_0x523a6b=_0x25a33c?.['result']?.[_0x42f2c8(0x1be)]?.[0x0]?.['text'];return _0x523a6b?JSON[_0x42f2c8(0x1e0)](_0x523a6b):_0x25a33c;}async[a0_0x299df7(0x1e8)](){const _0x39682b=a0_0x299df7;if(this[_0x39682b(0x192)])return;this[_0x39682b(0x192)]=!0x0,await this['status']('idle'),this[_0x39682b(0x1a8)]('registered'),this[_0x39682b(0x1aa)]=setInterval(()=>{const _0x3fae7d=_0x39682b;this[_0x3fae7d(0x18e)](_0x3fae7d(0x18c))[_0x3fae7d(0x1a1)](_0x36515e=>this[_0x3fae7d(0x1a8)](_0x3fae7d(0x1d3)+_0x36515e[_0x3fae7d(0x1a7)]));},this['heartbeatInterval']),this[_0x39682b(0x191)]();}async['disconnect'](){const _0xc6488d=a0_0x299df7;if(this[_0xc6488d(0x192)]=!0x1,this['sseAbort']?.[_0xc6488d(0x1fa)](),this['heartbeatTimer'])clearInterval(this['heartbeatTimer']);await this[_0xc6488d(0x18e)]('offline')[_0xc6488d(0x1a1)](()=>{}),this[_0xc6488d(0x1a8)](_0xc6488d(0x19b));}async[a0_0x299df7(0x1b6)](_0x5acb85,_0x41459f,_0x50dcc4=a0_0x299df7(0x1cb)){const _0x476d58=a0_0x299df7;return Y({'alias':_0x5acb85,'fromAlias':this[_0x476d58(0x1d4)]},{'log':_0x4505c9=>console['log'](_0x4505c9),'send':()=>this[_0x476d58(0x1f6)](_0x476d58(0x1fc),{'alias':_0x5acb85,'task':_0x41459f,'priority':_0x50dcc4,'from_session':this[_0x476d58(0x1d4)]})});}async['message'](_0x31cf67,_0x4f536d){const _0x521b86=a0_0x299df7;return this[_0x521b86(0x1f6)]('send_message',{'alias':_0x31cf67,'message':_0x4f536d,'from_session':this[_0x521b86(0x1d4)]});}async[a0_0x299df7(0x1e1)](_0x49fa7d,_0x5d1047,_0x991c81='completed'){const _0x50ccf2=a0_0x299df7;return this[_0x50ccf2(0x1f6)](_0x50ccf2(0x1f2),{'in_reply_to':_0x49fa7d,'text':_0x5d1047,'status':_0x991c81});}async[a0_0x299df7(0x18e)](_0x3953cc,_0x3bb175){const _0x30b470=a0_0x299df7;return this[_0x30b470(0x1f6)](_0x30b470(0x1ed),{'resume_id':this[_0x30b470(0x1d6)],'alias':this[_0x30b470(0x1d4)],'status':_0x3953cc,'server':a0_0x29b66a(),'hostname':a0_0x29b66a(),'agent':this['agent'],'project_dir':process[_0x30b470(0x19a)](),..._0x3bb175});}async[a0_0x299df7(0x1df)](){const _0x858caa=a0_0x299df7;return this[_0x858caa(0x1f6)](_0x858caa(0x19c),{});}async[a0_0x299df7(0x1c1)](_0x5b2edc,_0x41e67d){const _0x514c6d=a0_0x299df7;return this[_0x514c6d(0x1f6)](_0x514c6d(0x1c1),{'message':_0x5b2edc,'filter_server':_0x41e67d?.['server'],'filter_status':_0x41e67d?.['status']});}async[a0_0x299df7(0x191)](){const _0x497b93=a0_0x299df7;let _0x2386ef=encodeURIComponent(this['alias']),_0x4001d5=this['url']+'/events/'+_0x2386ef,_0x1b2390=this[_0x497b93(0x193)];while(this[_0x497b93(0x192)]){try{this[_0x497b93(0x1b5)]=new AbortController();let _0x17fc99={'Accept':_0x497b93(0x1b3)};if(this[_0x497b93(0x1c2)])_0x17fc99[_0x497b93(0x1b9)]=_0x497b93(0x1ef)+this[_0x497b93(0x1c2)];let _0x4ef46d=await fetch(_0x4001d5,{'headers':_0x17fc99,'signal':this['sseAbort'][_0x497b93(0x1cc)]});if(!_0x4ef46d['ok']||!_0x4ef46d[_0x497b93(0x1d2)]){this['log'](_0x497b93(0x1de)+_0x4ef46d[_0x497b93(0x18e)]),await this[_0x497b93(0x1a9)](_0x1b2390),_0x1b2390=Math['min'](_0x1b2390*1.5,0xea60);continue;}_0x1b2390=this['reconnectDelay'];let _0x253f76=_0x4ef46d['body'][_0x497b93(0x1f7)](),_0x53e39b=new TextDecoder(),_0x464446='';while(this[_0x497b93(0x192)]){let {done:_0x39afc2,value:_0x523d91}=await _0x253f76[_0x497b93(0x1da)]();if(_0x39afc2)break;_0x464446+=_0x53e39b[_0x497b93(0x1c7)](_0x523d91,{'stream':!0x0});let _0x3bd7b2=_0x464446['split']('\x0a');_0x464446=_0x3bd7b2[_0x497b93(0x1ac)]()||'';for(let _0x20bc34 of _0x3bd7b2){if(!_0x20bc34[_0x497b93(0x1e2)](_0x497b93(0x188)))continue;try{let _0x97957=JSON['parse'](_0x20bc34[_0x497b93(0x1ff)](0x6));if(_0x97957[_0x497b93(0x1e6)]===_0x497b93(0x1b7)){this[_0x497b93(0x1a8)]('SSE\x20connected'),this[_0x497b93(0x19d)](_0x497b93(0x1b7));continue;}if(_0x97957['type']===_0x497b93(0x1d9)||_0x97957[_0x497b93(0x1e6)]===_0x497b93(0x1bc)||_0x97957[_0x497b93(0x1e6)]===_0x497b93(0x1c1))await this[_0x497b93(0x19f)]();}catch{}}}}catch(_0x4f6052){if(_0x4f6052['name']==='AbortError')break;this[_0x497b93(0x19d)](_0x497b93(0x1f9),_0x4f6052),this[_0x497b93(0x1a8)](_0x497b93(0x1d5)+_0x4f6052[_0x497b93(0x1a7)]);}if(this[_0x497b93(0x192)])this[_0x497b93(0x19d)]('disconnected'),this[_0x497b93(0x1a8)](_0x497b93(0x18f)+_0x1b2390/0x3e8+_0x497b93(0x1c0)),await this[_0x497b93(0x1a9)](_0x1b2390),_0x1b2390=Math[_0x497b93(0x1ea)](_0x1b2390*1.5,0xea60);}}async[a0_0x299df7(0x19f)](){const _0x1ae8f4=a0_0x299df7;try{let _0xe0c788=(await this['call']('get_inbox',{'alias':this[_0x1ae8f4(0x1d4)],'limit':0xa}))?.['messages']||[];for(let _0x5ef687 of _0xe0c788)await this[_0x1ae8f4(0x1f6)](_0x1ae8f4(0x1c6),{'alias':this['alias'],'message_id':_0x5ef687['id']}),this[_0x1ae8f4(0x1a8)]('←\x20'+_0x5ef687[_0x1ae8f4(0x1d0)]+':\x20'+_0x5ef687['content'][_0x1ae8f4(0x1ff)](0x0,0x3c)),this['emit']('task',_0x5ef687),this['emit']('message',_0x5ef687);}catch(_0x5c76b9){this[_0x1ae8f4(0x1a8)](_0x1ae8f4(0x185)+_0x5c76b9[_0x1ae8f4(0x1a7)]);}}[a0_0x299df7(0x1a9)](_0x4bbc6d){return new Promise(_0x250412=>setTimeout(_0x250412,_0x4bbc6d));}}var F=$;export{F as default,$ as CommHub};
@@ -0,0 +1,32 @@
1
+ export declare function daemonAnetBinRepairCommand(reason: string, target?: string): string;
2
+ export declare function verifyDaemonAnetBinIdentity(abs: string): void;
3
+ export declare function resolveCurrentAnetBinForDaemon(input: {
4
+ envBin?: string;
5
+ argv1?: string;
6
+ }): string;
7
+ export type DaemonAnetBinCheck = {
8
+ ok: true;
9
+ bin: string;
10
+ notes: string[];
11
+ } | {
12
+ ok: false;
13
+ code: "resolve" | "writable" | "not-executable";
14
+ lines: string[];
15
+ };
16
+ /** Non-fatal resolve + verify: the exact checks `anet daemon start` applies,
17
+ * returned instead of `process.exit`. `prepareDaemonAnetBin()` exits on
18
+ * `ok:false`; the `anet node start <daemon>` path logs and continues. */
19
+ export declare function checkDaemonAnetBin(input: {
20
+ envBin?: string;
21
+ argv1?: string;
22
+ }): DaemonAnetBinCheck;
23
+ /** The env the daemon (and, via the #1353 passthrough, its spawned agent-node)
24
+ * needs once the pin is verified. Same three keys `prepareDaemonAnetBin()` set. */
25
+ export declare function daemonAnetBinEnv(bin: string): Record<string, string>;
26
+ /** Should `anet node start` resolve a pin for this profile?
27
+ * Only for daemons (role=host_supervisor), and only when the `anet daemon …`
28
+ * entry has not already done it in this process (it sets the env). */
29
+ export declare function shouldPinDaemonOnNodeStart(input: {
30
+ role?: string;
31
+ alreadyPrepared: boolean;
32
+ }): boolean;