@sleep2agi/agent-network 2.3.0-preview.66 → 2.3.0-preview.68

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_0xda23(_0x5b11ff,_0xc2a8a3){_0x5b11ff=_0x5b11ff-0x1eb;const _0x507d75=a0_0x507d();let _0xda23ff=_0x507d75[_0x5b11ff];return _0xda23ff;}const a0_0x9228db=a0_0xda23;(function(_0x43f216,_0x338d7d){const _0x1c5e5b=a0_0xda23,_0x3b63cc=_0x43f216();while(!![]){try{const _0x33ddb6=-parseInt(_0x1c5e5b(0x1ff))/0x1*(-parseInt(_0x1c5e5b(0x23d))/0x2)+parseInt(_0x1c5e5b(0x264))/0x3+parseInt(_0x1c5e5b(0x25a))/0x4+-parseInt(_0x1c5e5b(0x218))/0x5*(parseInt(_0x1c5e5b(0x233))/0x6)+parseInt(_0x1c5e5b(0x235))/0x7*(parseInt(_0x1c5e5b(0x262))/0x8)+parseInt(_0x1c5e5b(0x22d))/0x9*(-parseInt(_0x1c5e5b(0x268))/0xa)+-parseInt(_0x1c5e5b(0x244))/0xb*(parseInt(_0x1c5e5b(0x25d))/0xc);if(_0x33ddb6===_0x338d7d)break;else _0x3b63cc['push'](_0x3b63cc['shift']());}catch(_0x82bb20){_0x3b63cc['push'](_0x3b63cc['shift']());}}}(a0_0x507d,0x88050));import{EventEmitter as a0_0x49fc90}from'events';import{hostname as a0_0x2287c5}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x2a4f44,_0xf997c2)=>(_0x2a4f44??_0xf997c2)[a0_0x9228db(0x200)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x9228db(0x259)](0x0,0xf0);function N(_0x49db0e){const _0x2e7e0f=a0_0x9228db;return(_0x49db0e instanceof Error?_0x49db0e['message']:String(_0x49db0e??_0x2e7e0f(0x1f8)))[_0x2e7e0f(0x200)](K,_0x2e7e0f(0x223))[_0x2e7e0f(0x200)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x2e7e0f(0x259)](0x0,0xf0);}function a0_0x507d(){const _0x461e9c=['body','inbox\x20error:\x20','\x20task_id=','min','error_message','task.send.delivered','new_task','Bearer\x20','slice','2609088HNwTTc','parent_task_id','duration_ms','11976YuTowb','missing_task_id','sdk','SSE\x20connected','message_id','176216AHjcpL','error_code','1800825ZKynsG',']\x20[commhub:','text/event-stream','SSE\x20failed:\x20','30GMtjtn','messages','server','agent','match','transport','task.expired','\x20from=','log','token','get_inbox','startsWith','task.send.start','CommHub\x20rejected\x20task','<pending>','sleep','from_alias','get_all_status','data:\x20','failed','disconnect','sdk-','application/json','pop','POST','Authorization','unknown\x20error','<unknown>','string','normal','resumeId','message','task.replied','3tmFLer','replace','\x20to=','send_reply','\x20transport=','SSE\x20error:\x20','toString','sseAbort','toAlias','mcp_http','emit','getAllStatus','error','abort','heartbeatInterval','to_alias','stringify','type','task_id','idle','/mcp','send_task','SSE\x20reconnecting\x20in\x20','alias','connected','205iMKUEu','\x20error=','catch','s...','text','from_session','reply','delivered','application/json,\x20text/event-stream','lifecycleTracking','offline','[REDACTED]','<missing>','task','fromAlias','result','\x20lifecycle=','parentTaskId','ack_inbox','networkId','status','999288BxpfjJ','\x20duration_ms=','completed','lifecycle_tracking','decode','\x20parent_task_id=','118326KCVnzJ','now','91OAxIpL','new_message','reconnectDelay','autoConnect','registered','heartbeat\x20failed:\x20','broadcast','url','638198KvflBt','call','send_failed','running','heartbeatTimer','task.ack','report_status','8789KOUIaQ','connectSSE','send_message','read','send','json','AbortError','send_rejected','connect','name','content','parse','sending'];a0_0x507d=function(){return _0x461e9c;};return a0_0x507d();}function O(_0xb4176a,_0x491b80=process.env.ANET_TASK_TRACE_FORMAT===a0_0x9228db(0x249)){const _0x4001dc=a0_0x9228db;if(_0x491b80)return JSON['stringify'](_0xb4176a);let _0x36eb0c=L(_0xb4176a[_0x4001dc(0x25b)],_0x4001dc(0x224)),_0xb1553d=L(_0xb4176a['task_id'],_0x4001dc(0x1ec)),_0x5c13e4=_0xb4176a[_0x4001dc(0x263)]?_0x4001dc(0x219)+_0xb4176a[_0x4001dc(0x263)]+':'+(_0xb4176a[_0x4001dc(0x255)]??''):'';return'[commhub:task]\x20'+_0xb4176a[_0x4001dc(0x22c)]+_0x4001dc(0x26f)+L(_0xb4176a[_0x4001dc(0x1ee)],'<unknown>')+_0x4001dc(0x201)+L(_0xb4176a[_0x4001dc(0x20e)],_0x4001dc(0x1f9))+_0x4001dc(0x253)+_0xb1553d+_0x4001dc(0x232)+_0x36eb0c+'\x20network_id='+L(_0xb4176a['network_id'],_0x4001dc(0x1f9))+_0x4001dc(0x203)+_0xb4176a['transport']+_0x4001dc(0x22e)+_0xb4176a[_0x4001dc(0x25c)]+_0x4001dc(0x228)+_0xb4176a[_0x4001dc(0x230)]+_0x5c13e4;}function U(_0x9aefea){const _0x4d2469=a0_0x9228db;return{'event':{'sending':_0x4d2469(0x274),'delivered':_0x4d2469(0x256),'failed':'task.send.failed','acked':_0x4d2469(0x242),'started':'task.started','replied':_0x4d2469(0x1fe),'expired':_0x4d2469(0x26e)}[_0x9aefea[_0x4d2469(0x22c)]],..._0x9aefea};}function j(_0x3b6add){const _0x28e979=a0_0x9228db;let _0x23787c=_0x3b6add?.[_0x28e979(0x211)]||_0x3b6add?.[_0x28e979(0x261)]||_0x3b6add?.['id'];if(_0x23787c)return String(_0x23787c);let _0x45f43a=_0x3b6add?.[_0x28e979(0x24e)]?.[0x0]?.[_0x28e979(0x21c)];if(typeof _0x45f43a!==_0x28e979(0x1fa))return null;try{let _0x5806bb=JSON[_0x28e979(0x24f)](_0x45f43a);return _0x5806bb?.['task_id']||_0x5806bb?.[_0x28e979(0x261)]||_0x5806bb?.['id']||null;}catch{return null;}}async function X(_0xafb613,_0x39baab){const _0x121505=a0_0x9228db;let _0x15d3f5=_0x39baab[_0x121505(0x234)]??Date['now'],_0x387080=_0x15d3f5(),_0x3c3df7=(_0x25b290,_0x1a9330,_0x1d2b9a,_0x136bfb)=>{const _0x5c66ae=_0x121505;_0x39baab[_0x5c66ae(0x270)](O(U({'from_alias':_0xafb613[_0x5c66ae(0x226)],'to_alias':_0xafb613[_0x5c66ae(0x207)],'task_id':_0x1a9330,'parent_task_id':_0xafb613[_0x5c66ae(0x229)],'network_id':_0xafb613[_0x5c66ae(0x22b)],'transport':_0xafb613[_0x5c66ae(0x26d)],'status':_0x25b290,'duration_ms':_0x15d3f5()-_0x387080,'lifecycle_tracking':_0xafb613[_0x5c66ae(0x221)],..._0x1d2b9a!==void 0x0?{'error_code':_0x136bfb||_0x5c66ae(0x23f),'error_message':N(_0x1d2b9a)}:{}})));};_0x3c3df7(_0x121505(0x250),null);try{let _0x1347a9=await _0x39baab['send'](),_0x274b8d=j(_0x1347a9);if(_0x274b8d)_0x3c3df7(_0x121505(0x21f),_0x274b8d);else{if(_0x1347a9?.['ok']===!0x1||_0x1347a9?.[_0x121505(0x20b)])_0x3c3df7(_0x121505(0x1f1),_0x274b8d,_0x1347a9?.[_0x121505(0x20b)]||_0x121505(0x1eb),_0x121505(0x24b));else _0x3c3df7(_0x121505(0x1f1),null,'CommHub\x20response\x20omitted\x20task_id',_0x121505(0x25e));}return _0x1347a9;}catch(_0x723f22){throw _0x3c3df7('failed',null,_0x723f22,_0x121505(0x23f)),_0x723f22;}}async function Y(_0x276b5c,_0x1f721f){const _0x1eb11e=a0_0x9228db;return X({'fromAlias':_0x276b5c[_0x1eb11e(0x226)],'toAlias':_0x276b5c[_0x1eb11e(0x216)],'parentTaskId':_0x276b5c[_0x1eb11e(0x229)]||null,'networkId':_0x276b5c[_0x1eb11e(0x22b)]||null,'transport':_0x1eb11e(0x208),'lifecycleTracking':'not_tracked'},_0x1f721f);}class $ extends a0_0x49fc90{['url'];['alias'];[a0_0x9228db(0x271)];['agent'];[a0_0x9228db(0x1fc)];[a0_0x9228db(0x20d)];[a0_0x9228db(0x237)];[a0_0x9228db(0x241)];[a0_0x9228db(0x206)];[a0_0x9228db(0x240)]=!0x1;constructor(_0x652da){const _0x3c7db5=a0_0x9228db;super();if(this[_0x3c7db5(0x23c)]=_0x652da[_0x3c7db5(0x23c)]['replace'](/\/$/,''),this[_0x3c7db5(0x216)]=_0x652da[_0x3c7db5(0x216)],this['token']=_0x652da[_0x3c7db5(0x271)],this[_0x3c7db5(0x26b)]=_0x652da[_0x3c7db5(0x26b)]||_0x3c7db5(0x25f),this['resumeId']=_0x3c7db5(0x1f3)+_0x652da[_0x3c7db5(0x216)]+'-'+Date[_0x3c7db5(0x234)]()[_0x3c7db5(0x205)](0x24),this[_0x3c7db5(0x20d)]=_0x652da[_0x3c7db5(0x20d)]??0x2bf20,this['reconnectDelay']=_0x652da['reconnectDelay']??0xbb8,_0x652da[_0x3c7db5(0x238)]!==!0x1)this[_0x3c7db5(0x24c)]();}[a0_0x9228db(0x270)](_0x3ae8ce){const _0x247124=a0_0x9228db;console[_0x247124(0x270)]('['+new Date()['toTimeString']()['slice'](0x0,0x8)+_0x247124(0x265)+this[_0x247124(0x216)]+']\x20'+_0x3ae8ce);}async[a0_0x9228db(0x23e)](_0x5d60f7,_0x5c61cc){const _0x1c8ac8=a0_0x9228db;let _0x2f50cb={'Content-Type':_0x1c8ac8(0x1f4),'Accept':_0x1c8ac8(0x220)};if(this['token'])_0x2f50cb[_0x1c8ac8(0x1f7)]=_0x1c8ac8(0x258)+this[_0x1c8ac8(0x271)];let _0x5435d9=await(await fetch(this[_0x1c8ac8(0x23c)]+_0x1c8ac8(0x213),{'method':_0x1c8ac8(0x1f6),'headers':_0x2f50cb,'body':JSON[_0x1c8ac8(0x20f)]({'jsonrpc':'2.0','id':Date[_0x1c8ac8(0x234)](),'method':'tools/call','params':{'name':_0x5d60f7,'arguments':_0x5c61cc}})}))[_0x1c8ac8(0x21c)](),_0xa13f6a=_0x5435d9[_0x1c8ac8(0x26c)](/data: (.+)/),_0x3544dc=_0xa13f6a?JSON[_0x1c8ac8(0x24f)](_0xa13f6a[0x1]):JSON[_0x1c8ac8(0x24f)](_0x5435d9),_0x1fcbb8=_0x3544dc?.[_0x1c8ac8(0x227)]?.[_0x1c8ac8(0x24e)]?.[0x0]?.[_0x1c8ac8(0x21c)];return _0x1fcbb8?JSON[_0x1c8ac8(0x24f)](_0x1fcbb8):_0x3544dc;}async[a0_0x9228db(0x24c)](){const _0x39cb15=a0_0x9228db;if(this[_0x39cb15(0x240)])return;this[_0x39cb15(0x240)]=!0x0,await this['status'](_0x39cb15(0x212)),this[_0x39cb15(0x270)](_0x39cb15(0x239)),this[_0x39cb15(0x241)]=setInterval(()=>{const _0x1ec088=_0x39cb15;this['status'](_0x1ec088(0x212))[_0x1ec088(0x21a)](_0x21877d=>this[_0x1ec088(0x270)](_0x1ec088(0x23a)+_0x21877d[_0x1ec088(0x1fd)]));},this[_0x39cb15(0x20d)]),this['connectSSE']();}async[a0_0x9228db(0x1f2)](){const _0x292dbd=a0_0x9228db;if(this[_0x292dbd(0x240)]=!0x1,this[_0x292dbd(0x206)]?.[_0x292dbd(0x20c)](),this[_0x292dbd(0x241)])clearInterval(this[_0x292dbd(0x241)]);await this['status'](_0x292dbd(0x222))[_0x292dbd(0x21a)](()=>{}),this[_0x292dbd(0x270)]('disconnected');}async[a0_0x9228db(0x248)](_0x2d747d,_0x286ea5,_0x312d5c=a0_0x9228db(0x1fb)){const _0x1f1cf3=a0_0x9228db;return Y({'alias':_0x2d747d,'fromAlias':this[_0x1f1cf3(0x216)]},{'log':_0x57a84e=>console[_0x1f1cf3(0x270)](_0x57a84e),'send':()=>this[_0x1f1cf3(0x23e)](_0x1f1cf3(0x214),{'alias':_0x2d747d,'task':_0x286ea5,'priority':_0x312d5c,'from_session':this[_0x1f1cf3(0x216)]})});}async[a0_0x9228db(0x1fd)](_0x27311c,_0x364e3d){const _0x2a17ae=a0_0x9228db;return this[_0x2a17ae(0x23e)](_0x2a17ae(0x246),{'alias':_0x27311c,'message':_0x364e3d,'from_session':this[_0x2a17ae(0x216)]});}async[a0_0x9228db(0x21e)](_0x182ae1,_0x2b22c4,_0xda1408=a0_0x9228db(0x22f)){const _0x594590=a0_0x9228db;return this['call'](_0x594590(0x202),{'in_reply_to':_0x182ae1,'text':_0x2b22c4,'status':_0xda1408});}async[a0_0x9228db(0x22c)](_0x171dfe,_0x3633b2){const _0x3a86e0=a0_0x9228db;return this[_0x3a86e0(0x23e)](_0x3a86e0(0x243),{'resume_id':this[_0x3a86e0(0x1fc)],'alias':this[_0x3a86e0(0x216)],'status':_0x171dfe,'server':a0_0x2287c5(),'hostname':a0_0x2287c5(),'agent':this[_0x3a86e0(0x26b)],'project_dir':process['cwd'](),..._0x3633b2});}async[a0_0x9228db(0x20a)](){const _0x262602=a0_0x9228db;return this[_0x262602(0x23e)](_0x262602(0x1ef),{});}async[a0_0x9228db(0x23b)](_0x3f5b69,_0x2fc4eb){const _0x1865e3=a0_0x9228db;return this[_0x1865e3(0x23e)](_0x1865e3(0x23b),{'message':_0x3f5b69,'filter_server':_0x2fc4eb?.[_0x1865e3(0x26a)],'filter_status':_0x2fc4eb?.[_0x1865e3(0x22c)]});}async[a0_0x9228db(0x245)](){const _0x2b3a0f=a0_0x9228db;let _0x179c3e=encodeURIComponent(this[_0x2b3a0f(0x216)]),_0x410970=this[_0x2b3a0f(0x23c)]+'/events/'+_0x179c3e,_0x2d3cf8=this['reconnectDelay'];while(this[_0x2b3a0f(0x240)]){try{this[_0x2b3a0f(0x206)]=new AbortController();let _0x5d4606={'Accept':_0x2b3a0f(0x266)};if(this[_0x2b3a0f(0x271)])_0x5d4606[_0x2b3a0f(0x1f7)]=_0x2b3a0f(0x258)+this[_0x2b3a0f(0x271)];let _0x44d672=await fetch(_0x410970,{'headers':_0x5d4606,'signal':this[_0x2b3a0f(0x206)]['signal']});if(!_0x44d672['ok']||!_0x44d672['body']){this['log'](_0x2b3a0f(0x267)+_0x44d672[_0x2b3a0f(0x22c)]),await this[_0x2b3a0f(0x1ed)](_0x2d3cf8),_0x2d3cf8=Math['min'](_0x2d3cf8*1.5,0xea60);continue;}_0x2d3cf8=this[_0x2b3a0f(0x237)];let _0x2d1c77=_0x44d672[_0x2b3a0f(0x251)]['getReader'](),_0x3f8e89=new TextDecoder(),_0x4d097f='';while(this['running']){let {done:_0x4a4f7e,value:_0x33315c}=await _0x2d1c77[_0x2b3a0f(0x247)]();if(_0x4a4f7e)break;_0x4d097f+=_0x3f8e89[_0x2b3a0f(0x231)](_0x33315c,{'stream':!0x0});let _0xa7464a=_0x4d097f['split']('\x0a');_0x4d097f=_0xa7464a[_0x2b3a0f(0x1f5)]()||'';for(let _0x5147b7 of _0xa7464a){if(!_0x5147b7[_0x2b3a0f(0x273)](_0x2b3a0f(0x1f0)))continue;try{let _0x296200=JSON[_0x2b3a0f(0x24f)](_0x5147b7[_0x2b3a0f(0x259)](0x6));if(_0x296200[_0x2b3a0f(0x210)]===_0x2b3a0f(0x217)){this[_0x2b3a0f(0x270)](_0x2b3a0f(0x260)),this[_0x2b3a0f(0x209)]('connected');continue;}if(_0x296200['type']===_0x2b3a0f(0x257)||_0x296200[_0x2b3a0f(0x210)]===_0x2b3a0f(0x236)||_0x296200[_0x2b3a0f(0x210)]==='broadcast')await this['processInbox']();}catch{}}}}catch(_0x118bfe){if(_0x118bfe[_0x2b3a0f(0x24d)]===_0x2b3a0f(0x24a))break;this[_0x2b3a0f(0x209)](_0x2b3a0f(0x20b),_0x118bfe),this[_0x2b3a0f(0x270)](_0x2b3a0f(0x204)+_0x118bfe[_0x2b3a0f(0x1fd)]);}if(this[_0x2b3a0f(0x240)])this[_0x2b3a0f(0x209)]('disconnected'),this['log'](_0x2b3a0f(0x215)+_0x2d3cf8/0x3e8+_0x2b3a0f(0x21b)),await this[_0x2b3a0f(0x1ed)](_0x2d3cf8),_0x2d3cf8=Math[_0x2b3a0f(0x254)](_0x2d3cf8*1.5,0xea60);}}async['processInbox'](){const _0x5ed8e1=a0_0x9228db;try{let _0x1653bb=(await this[_0x5ed8e1(0x23e)](_0x5ed8e1(0x272),{'alias':this[_0x5ed8e1(0x216)],'limit':0xa}))?.[_0x5ed8e1(0x269)]||[];for(let _0x484907 of _0x1653bb)await this[_0x5ed8e1(0x23e)](_0x5ed8e1(0x22a),{'alias':this[_0x5ed8e1(0x216)],'message_id':_0x484907['id']}),this[_0x5ed8e1(0x270)]('←\x20'+_0x484907[_0x5ed8e1(0x21d)]+':\x20'+_0x484907[_0x5ed8e1(0x24e)][_0x5ed8e1(0x259)](0x0,0x3c)),this['emit'](_0x5ed8e1(0x225),_0x484907),this[_0x5ed8e1(0x209)](_0x5ed8e1(0x1fd),_0x484907);}catch(_0x52c085){this[_0x5ed8e1(0x270)](_0x5ed8e1(0x252)+_0x52c085[_0x5ed8e1(0x1fd)]);}}[a0_0x9228db(0x1ed)](_0x5d1dd6){return new Promise(_0x8684ae=>setTimeout(_0x8684ae,_0x5d1dd6));}}var F=$;export{F as default,$ as CommHub};
1
+ const a0_0x4e0926=a0_0x49bd;(function(_0x155588,_0x52e51d){const _0x3f67af=a0_0x49bd,_0x28b773=_0x155588();while(!![]){try{const _0xd4b1b9=parseInt(_0x3f67af(0x1d2))/0x1+parseInt(_0x3f67af(0x199))/0x2*(parseInt(_0x3f67af(0x1a1))/0x3)+parseInt(_0x3f67af(0x1eb))/0x4*(-parseInt(_0x3f67af(0x19a))/0x5)+-parseInt(_0x3f67af(0x1c5))/0x6*(parseInt(_0x3f67af(0x196))/0x7)+-parseInt(_0x3f67af(0x1c2))/0x8*(-parseInt(_0x3f67af(0x1b1))/0x9)+-parseInt(_0x3f67af(0x1e9))/0xa+parseInt(_0x3f67af(0x1fa))/0xb;if(_0xd4b1b9===_0x52e51d)break;else _0x28b773['push'](_0x28b773['shift']());}catch(_0x27ff1a){_0x28b773['push'](_0x28b773['shift']());}}}(a0_0x1da9,0x5595b));import{EventEmitter as a0_0x145a41}from'events';import{hostname as a0_0x362b80}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x1d30b1,_0x438601)=>(_0x1d30b1??_0x438601)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x4e0926(0x1d4)](0x0,0xf0);function a0_0x49bd(_0x25e8c1,_0x5ee524){_0x25e8c1=_0x25e8c1-0x193;const _0x1da90c=a0_0x1da9();let _0x49bd9f=_0x1da90c[_0x25e8c1];return _0x49bd9f;}function a0_0x1da9(){const _0x4e9a10=[']\x20[commhub:','report_status','heartbeatTimer','message_id','stringify','connected','lifecycleTracking','task.expired','<missing>','data:\x20','task','missing_task_id','catch','text/event-stream','failed','transport','task_id','[REDACTED]','message','parse','task.send.start','from_alias','sseAbort','Bearer\x20','26677tDzQXx','call','reconnectDelay','6hJvclL','5QskNTp','get_all_status','networkId','lifecycle_tracking','token','send_task','sleep','383769ZYDdQr','heartbeat\x20failed:\x20','emit','parentTaskId','/events/','status','url','agent','<unknown>','replace','now','autoConnect','reply','startsWith','send_rejected','to_alias','109971BSzzYs','toAlias','getReader','2.0','\x20lifecycle=','not_tracked','application/json','running','server','disconnect','string','task.send.failed','error_code','fromAlias','pop','/mcp','connectSSE','200GhkypL','send_failed','\x20from=','930WbQmPR','result','idle','getAllStatus','AbortError','duration_ms','processInbox','connect','send_message','disconnected','normal','\x20task_id=','match','66379ojXrvM','completed','slice','read','broadcast','SSE\x20error:\x20','text','inbox\x20error:\x20','heartbeatInterval','POST','SSE\x20reconnecting\x20in\x20','\x20error=','min','body','tools/call','type','signal','log','sending','name','alias','delivered','split','5418260ROQnJD','ack_inbox','1584820YfMXlG','task.send.delivered','send','CommHub\x20rejected\x20task','toString','SSE\x20connected','new_task','task.replied','Authorization','offline','CommHub\x20response\x20omitted\x20task_id','resumeId','error','\x20parent_task_id=','content','12360348XDaWDo'];a0_0x1da9=function(){return _0x4e9a10;};return a0_0x1da9();}function N(_0x2c061c){const _0x45e7ff=a0_0x4e0926;return(_0x2c061c instanceof Error?_0x2c061c[_0x45e7ff(0x20d)]:String(_0x2c061c??'unknown\x20error'))[_0x45e7ff(0x1aa)](K,_0x45e7ff(0x20c))[_0x45e7ff(0x1aa)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x45e7ff(0x1d4)](0x0,0xf0);}function O(_0x7349f4,_0x1e9541=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0x86e788=a0_0x4e0926;if(_0x1e9541)return JSON[_0x86e788(0x1ff)](_0x7349f4);let _0x5ab9c7=L(_0x7349f4['parent_task_id'],_0x86e788(0x203)),_0x591a8d=L(_0x7349f4[_0x86e788(0x20b)],'<pending>'),_0x34838e=_0x7349f4['error_code']?_0x86e788(0x1dd)+_0x7349f4[_0x86e788(0x1bd)]+':'+(_0x7349f4['error_message']??''):'';return'[commhub:task]\x20'+_0x7349f4[_0x86e788(0x1a6)]+_0x86e788(0x1c4)+L(_0x7349f4[_0x86e788(0x193)],_0x86e788(0x1a9))+'\x20to='+L(_0x7349f4[_0x86e788(0x1b0)],_0x86e788(0x1a9))+_0x86e788(0x1d0)+_0x591a8d+_0x86e788(0x1f8)+_0x5ab9c7+'\x20network_id='+L(_0x7349f4['network_id'],'<unknown>')+'\x20transport='+_0x7349f4[_0x86e788(0x20a)]+'\x20duration_ms='+_0x7349f4[_0x86e788(0x1ca)]+_0x86e788(0x1b5)+_0x7349f4[_0x86e788(0x19d)]+_0x34838e;}function U(_0x1b6c4a){const _0x1b13cc=a0_0x4e0926;return{'event':{'sending':_0x1b13cc(0x20f),'delivered':_0x1b13cc(0x1ec),'failed':_0x1b13cc(0x1bc),'acked':'task.ack','started':'task.started','replied':_0x1b13cc(0x1f2),'expired':_0x1b13cc(0x202)}[_0x1b6c4a[_0x1b13cc(0x1a6)]],..._0x1b6c4a};}function j(_0x5b0fde){const _0x2fcb34=a0_0x4e0926;let _0x39e1f0=_0x5b0fde?.[_0x2fcb34(0x20b)]||_0x5b0fde?.['message_id']||_0x5b0fde?.['id'];if(_0x39e1f0)return String(_0x39e1f0);let _0x5cecaa=_0x5b0fde?.[_0x2fcb34(0x1f9)]?.[0x0]?.['text'];if(typeof _0x5cecaa!==_0x2fcb34(0x1bb))return null;try{let _0x29b828=JSON[_0x2fcb34(0x20e)](_0x5cecaa);return _0x29b828?.[_0x2fcb34(0x20b)]||_0x29b828?.[_0x2fcb34(0x1fe)]||_0x29b828?.['id']||null;}catch{return null;}}async function X(_0x3bf443,_0x5690f4){const _0x29ff8d=a0_0x4e0926;let _0x558ec0=_0x5690f4['now']??Date[_0x29ff8d(0x1ab)],_0x2d82e8=_0x558ec0(),_0x2b4385=(_0x2896f8,_0x5c2ccd,_0x401a5c,_0x338c81)=>{const _0x34f1e6=_0x29ff8d;_0x5690f4[_0x34f1e6(0x1e3)](O(U({'from_alias':_0x3bf443[_0x34f1e6(0x1be)],'to_alias':_0x3bf443[_0x34f1e6(0x1b2)],'task_id':_0x5c2ccd,'parent_task_id':_0x3bf443[_0x34f1e6(0x1a4)],'network_id':_0x3bf443[_0x34f1e6(0x19c)],'transport':_0x3bf443[_0x34f1e6(0x20a)],'status':_0x2896f8,'duration_ms':_0x558ec0()-_0x2d82e8,'lifecycle_tracking':_0x3bf443[_0x34f1e6(0x201)],..._0x401a5c!==void 0x0?{'error_code':_0x338c81||'send_failed','error_message':N(_0x401a5c)}:{}})));};_0x2b4385(_0x29ff8d(0x1e4),null);try{let _0x4bea9b=await _0x5690f4['send'](),_0x2968fe=j(_0x4bea9b);if(_0x2968fe)_0x2b4385(_0x29ff8d(0x1e7),_0x2968fe);else{if(_0x4bea9b?.['ok']===!0x1||_0x4bea9b?.[_0x29ff8d(0x1f7)])_0x2b4385(_0x29ff8d(0x209),_0x2968fe,_0x4bea9b?.[_0x29ff8d(0x1f7)]||_0x29ff8d(0x1ee),_0x29ff8d(0x1af));else _0x2b4385(_0x29ff8d(0x209),null,_0x29ff8d(0x1f5),_0x29ff8d(0x206));}return _0x4bea9b;}catch(_0x57a921){throw _0x2b4385(_0x29ff8d(0x209),null,_0x57a921,_0x29ff8d(0x1c3)),_0x57a921;}}async function Y(_0x34ed7b,_0x46419e){const _0x5ddd99=a0_0x4e0926;return X({'fromAlias':_0x34ed7b[_0x5ddd99(0x1be)],'toAlias':_0x34ed7b[_0x5ddd99(0x1e6)],'parentTaskId':_0x34ed7b['parentTaskId']||null,'networkId':_0x34ed7b[_0x5ddd99(0x19c)]||null,'transport':'mcp_http','lifecycleTracking':_0x5ddd99(0x1b6)},_0x46419e);}class $ extends a0_0x145a41{[a0_0x4e0926(0x1a7)];[a0_0x4e0926(0x1e6)];[a0_0x4e0926(0x19e)];['agent'];['resumeId'];[a0_0x4e0926(0x1da)];[a0_0x4e0926(0x198)];[a0_0x4e0926(0x1fd)];[a0_0x4e0926(0x194)];[a0_0x4e0926(0x1b8)]=!0x1;constructor(_0x59b3bc){const _0x3e5049=a0_0x4e0926;super();if(this['url']=_0x59b3bc[_0x3e5049(0x1a7)][_0x3e5049(0x1aa)](/\/$/,''),this['alias']=_0x59b3bc[_0x3e5049(0x1e6)],this['token']=_0x59b3bc[_0x3e5049(0x19e)],this[_0x3e5049(0x1a8)]=_0x59b3bc['agent']||'sdk',this[_0x3e5049(0x1f6)]='sdk-'+_0x59b3bc[_0x3e5049(0x1e6)]+'-'+Date[_0x3e5049(0x1ab)]()[_0x3e5049(0x1ef)](0x24),this[_0x3e5049(0x1da)]=_0x59b3bc[_0x3e5049(0x1da)]??0x2bf20,this['reconnectDelay']=_0x59b3bc['reconnectDelay']??0xbb8,_0x59b3bc[_0x3e5049(0x1ac)]!==!0x1)this[_0x3e5049(0x1cc)]();}[a0_0x4e0926(0x1e3)](_0x3c3fb2){const _0x7de5e2=a0_0x4e0926;console[_0x7de5e2(0x1e3)]('['+new Date()['toTimeString']()['slice'](0x0,0x8)+_0x7de5e2(0x1fb)+this['alias']+']\x20'+_0x3c3fb2);}async[a0_0x4e0926(0x197)](_0x563ab1,_0x358543){const _0x1fcae=a0_0x4e0926;let _0x3e000d={'Content-Type':_0x1fcae(0x1b7),'Accept':'application/json,\x20text/event-stream'};if(this[_0x1fcae(0x19e)])_0x3e000d[_0x1fcae(0x1f3)]=_0x1fcae(0x195)+this[_0x1fcae(0x19e)];let _0x1e710c=await(await fetch(this['url']+_0x1fcae(0x1c0),{'method':_0x1fcae(0x1db),'headers':_0x3e000d,'body':JSON[_0x1fcae(0x1ff)]({'jsonrpc':_0x1fcae(0x1b4),'id':Date[_0x1fcae(0x1ab)](),'method':_0x1fcae(0x1e0),'params':{'name':_0x563ab1,'arguments':_0x358543}})}))[_0x1fcae(0x1d8)](),_0x1dec70=_0x1e710c[_0x1fcae(0x1d1)](/data: (.+)/),_0x3ae201=_0x1dec70?JSON[_0x1fcae(0x20e)](_0x1dec70[0x1]):JSON[_0x1fcae(0x20e)](_0x1e710c),_0x23e5f9=_0x3ae201?.[_0x1fcae(0x1c6)]?.[_0x1fcae(0x1f9)]?.[0x0]?.['text'];return _0x23e5f9?JSON[_0x1fcae(0x20e)](_0x23e5f9):_0x3ae201;}async[a0_0x4e0926(0x1cc)](){const _0x555520=a0_0x4e0926;if(this[_0x555520(0x1b8)])return;this[_0x555520(0x1b8)]=!0x0,await this['status'](_0x555520(0x1c7)),this['log']('registered'),this[_0x555520(0x1fd)]=setInterval(()=>{const _0x21abb4=_0x555520;this[_0x21abb4(0x1a6)]('idle')[_0x21abb4(0x207)](_0x31c73d=>this['log'](_0x21abb4(0x1a2)+_0x31c73d['message']));},this['heartbeatInterval']),this[_0x555520(0x1c1)]();}async[a0_0x4e0926(0x1ba)](){const _0x3b6726=a0_0x4e0926;if(this[_0x3b6726(0x1b8)]=!0x1,this[_0x3b6726(0x194)]?.['abort'](),this[_0x3b6726(0x1fd)])clearInterval(this['heartbeatTimer']);await this[_0x3b6726(0x1a6)](_0x3b6726(0x1f4))[_0x3b6726(0x207)](()=>{}),this[_0x3b6726(0x1e3)]('disconnected');}async[a0_0x4e0926(0x1ed)](_0x475296,_0x540eff,_0x3cc8ce=a0_0x4e0926(0x1cf)){const _0x40b3bc=a0_0x4e0926;return Y({'alias':_0x475296,'fromAlias':this['alias']},{'log':_0xe66989=>console[_0x40b3bc(0x1e3)](_0xe66989),'send':()=>this[_0x40b3bc(0x197)](_0x40b3bc(0x19f),{'alias':_0x475296,'task':_0x540eff,'priority':_0x3cc8ce,'from_session':this[_0x40b3bc(0x1e6)]})});}async[a0_0x4e0926(0x20d)](_0x2af1f2,_0x3cbec2){const _0x2e4c7c=a0_0x4e0926;return this[_0x2e4c7c(0x197)](_0x2e4c7c(0x1cd),{'alias':_0x2af1f2,'message':_0x3cbec2,'from_session':this[_0x2e4c7c(0x1e6)]});}async[a0_0x4e0926(0x1ad)](_0x56ee44,_0x53f30a,_0x1377e6=a0_0x4e0926(0x1d3)){const _0x31df72=a0_0x4e0926;return this[_0x31df72(0x197)]('send_reply',{'in_reply_to':_0x56ee44,'text':_0x53f30a,'status':_0x1377e6});}async[a0_0x4e0926(0x1a6)](_0x1aa161,_0x5e826d){const _0x4863b5=a0_0x4e0926;return this[_0x4863b5(0x197)](_0x4863b5(0x1fc),{'resume_id':this[_0x4863b5(0x1f6)],'alias':this[_0x4863b5(0x1e6)],'status':_0x1aa161,'server':a0_0x362b80(),'hostname':a0_0x362b80(),'agent':this[_0x4863b5(0x1a8)],'project_dir':process['cwd'](),..._0x5e826d});}async[a0_0x4e0926(0x1c8)](){const _0xddee37=a0_0x4e0926;return this[_0xddee37(0x197)](_0xddee37(0x19b),{});}async[a0_0x4e0926(0x1d6)](_0x46d91a,_0x49fccf){const _0x20bd4a=a0_0x4e0926;return this['call'](_0x20bd4a(0x1d6),{'message':_0x46d91a,'filter_server':_0x49fccf?.[_0x20bd4a(0x1b9)],'filter_status':_0x49fccf?.[_0x20bd4a(0x1a6)]});}async[a0_0x4e0926(0x1c1)](){const _0x13c59d=a0_0x4e0926;let _0x4e5f4a=encodeURIComponent(this[_0x13c59d(0x1e6)]),_0x5d90b4=this[_0x13c59d(0x1a7)]+_0x13c59d(0x1a5)+_0x4e5f4a,_0x3dbb75=this[_0x13c59d(0x198)];while(this['running']){try{this[_0x13c59d(0x194)]=new AbortController();let _0x4e0bc3={'Accept':_0x13c59d(0x208)};if(this[_0x13c59d(0x19e)])_0x4e0bc3[_0x13c59d(0x1f3)]=_0x13c59d(0x195)+this['token'];let _0x3ab379=await fetch(_0x5d90b4,{'headers':_0x4e0bc3,'signal':this[_0x13c59d(0x194)][_0x13c59d(0x1e2)]});if(!_0x3ab379['ok']||!_0x3ab379[_0x13c59d(0x1df)]){this[_0x13c59d(0x1e3)]('SSE\x20failed:\x20'+_0x3ab379[_0x13c59d(0x1a6)]),await this[_0x13c59d(0x1a0)](_0x3dbb75),_0x3dbb75=Math[_0x13c59d(0x1de)](_0x3dbb75*1.5,0xea60);continue;}_0x3dbb75=this[_0x13c59d(0x198)];let _0x254a7e=_0x3ab379[_0x13c59d(0x1df)][_0x13c59d(0x1b3)](),_0xfb879=new TextDecoder(),_0x1156e1='';while(this[_0x13c59d(0x1b8)]){let {done:_0x215c34,value:_0x4e3a57}=await _0x254a7e[_0x13c59d(0x1d5)]();if(_0x215c34)break;_0x1156e1+=_0xfb879['decode'](_0x4e3a57,{'stream':!0x0});let _0xbb9381=_0x1156e1[_0x13c59d(0x1e8)]('\x0a');_0x1156e1=_0xbb9381[_0x13c59d(0x1bf)]()||'';for(let _0x3679f7 of _0xbb9381){if(!_0x3679f7[_0x13c59d(0x1ae)](_0x13c59d(0x204)))continue;try{let _0x546575=JSON['parse'](_0x3679f7[_0x13c59d(0x1d4)](0x6));if(_0x546575['type']===_0x13c59d(0x200)){this[_0x13c59d(0x1e3)](_0x13c59d(0x1f0)),this[_0x13c59d(0x1a3)](_0x13c59d(0x200));continue;}if(_0x546575['type']===_0x13c59d(0x1f1)||_0x546575[_0x13c59d(0x1e1)]==='new_message'||_0x546575['type']===_0x13c59d(0x1d6))await this[_0x13c59d(0x1cb)]();}catch{}}}}catch(_0x397ec7){if(_0x397ec7[_0x13c59d(0x1e5)]===_0x13c59d(0x1c9))break;this['emit']('error',_0x397ec7),this[_0x13c59d(0x1e3)](_0x13c59d(0x1d7)+_0x397ec7[_0x13c59d(0x20d)]);}if(this[_0x13c59d(0x1b8)])this[_0x13c59d(0x1a3)](_0x13c59d(0x1ce)),this[_0x13c59d(0x1e3)](_0x13c59d(0x1dc)+_0x3dbb75/0x3e8+'s...'),await this['sleep'](_0x3dbb75),_0x3dbb75=Math[_0x13c59d(0x1de)](_0x3dbb75*1.5,0xea60);}}async[a0_0x4e0926(0x1cb)](){const _0x1e0219=a0_0x4e0926;try{let _0x39d4d5=(await this[_0x1e0219(0x197)]('get_inbox',{'alias':this['alias'],'limit':0xa}))?.['messages']||[];for(let _0x3bb745 of _0x39d4d5)await this['call'](_0x1e0219(0x1ea),{'alias':this[_0x1e0219(0x1e6)],'message_id':_0x3bb745['id']}),this[_0x1e0219(0x1e3)]('←\x20'+_0x3bb745['from_session']+':\x20'+_0x3bb745[_0x1e0219(0x1f9)][_0x1e0219(0x1d4)](0x0,0x3c)),this[_0x1e0219(0x1a3)](_0x1e0219(0x205),_0x3bb745),this[_0x1e0219(0x1a3)](_0x1e0219(0x20d),_0x3bb745);}catch(_0x4dac96){this[_0x1e0219(0x1e3)](_0x1e0219(0x1d9)+_0x4dac96[_0x1e0219(0x20d)]);}}[a0_0x4e0926(0x1a0)](_0x49ccfc){return new Promise(_0x5a1106=>setTimeout(_0x5a1106,_0x49ccfc));}}var F=$;export{F as default,$ as CommHub};
@@ -0,0 +1,17 @@
1
+ export interface CopresenceStartupFailure {
2
+ /** 等的那个 attach launcher 路径。 */
3
+ attachScript: string;
4
+ /** bridge 输出的落盘文件(可能还不存在——bridge 可能压根没起来)。 */
5
+ bridgeLog: string;
6
+ /** 节点自己的日志目录。 */
7
+ nodeLogDir: string;
8
+ /** 判定失败的那一刻,bridge 的 tmux 会话还在不在。 */
9
+ bridgeAlive: boolean;
10
+ /** 等了多少秒。 */
11
+ waitedSeconds: number;
12
+ /** 落盘日志的尾巴(读不到就给空串)。 */
13
+ logTail: string;
14
+ /** tmux pane 的尾巴;会话已死时必然是空。 */
15
+ paneTail: string;
16
+ }
17
+ export declare function describeCopresenceStartupFailure(f: CopresenceStartupFailure): string[];