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

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_0x517d1f=a0_0x35cf;(function(_0x3a1ffa,_0x243bbe){const _0x3f1791=a0_0x35cf,_0xb95119=_0x3a1ffa();while(!![]){try{const _0x59c2d4=-parseInt(_0x3f1791(0x150))/0x1*(parseInt(_0x3f1791(0x161))/0x2)+-parseInt(_0x3f1791(0x12d))/0x3+-parseInt(_0x3f1791(0x160))/0x4*(parseInt(_0x3f1791(0x179))/0x5)+-parseInt(_0x3f1791(0x176))/0x6+parseInt(_0x3f1791(0x157))/0x7+-parseInt(_0x3f1791(0x17d))/0x8+parseInt(_0x3f1791(0x109))/0x9;if(_0x59c2d4===_0x243bbe)break;else _0xb95119['push'](_0xb95119['shift']());}catch(_0x18916b){_0xb95119['push'](_0xb95119['shift']());}}}(a0_0x42bb,0x9090a));import{EventEmitter as a0_0x1726db}from'events';import{hostname as a0_0x2b7564}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x4212b3,_0x117c43)=>(_0x4212b3??_0x117c43)[a0_0x517d1f(0x136)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x517d1f(0x126)](0x0,0xf0);function N(_0x338ee8){const _0x4567d5=a0_0x517d1f;return(_0x338ee8 instanceof Error?_0x338ee8[_0x4567d5(0x171)]:String(_0x338ee8??'unknown\x20error'))[_0x4567d5(0x136)](K,'[REDACTED]')['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x4567d5(0x126)](0x0,0xf0);}function O(_0x4e5718,_0x577c25=process.env.ANET_TASK_TRACE_FORMAT===a0_0x517d1f(0x17e)){const _0x685adc=a0_0x517d1f;if(_0x577c25)return JSON[_0x685adc(0x17a)](_0x4e5718);let _0x5a1be1=L(_0x4e5718[_0x685adc(0xfe)],_0x685adc(0x164)),_0x593441=L(_0x4e5718[_0x685adc(0x11a)],_0x685adc(0x105)),_0x5231ba=_0x4e5718[_0x685adc(0x119)]?'\x20error='+_0x4e5718[_0x685adc(0x119)]+':'+(_0x4e5718[_0x685adc(0x149)]??''):'';return'[commhub:task]\x20'+_0x4e5718[_0x685adc(0x10c)]+'\x20from='+L(_0x4e5718[_0x685adc(0x134)],_0x685adc(0x103))+_0x685adc(0x17b)+L(_0x4e5718[_0x685adc(0x153)],_0x685adc(0x103))+_0x685adc(0x147)+_0x593441+_0x685adc(0x11c)+_0x5a1be1+_0x685adc(0x12a)+L(_0x4e5718[_0x685adc(0x12e)],_0x685adc(0x103))+_0x685adc(0x140)+_0x4e5718[_0x685adc(0x172)]+'\x20duration_ms='+_0x4e5718[_0x685adc(0x14e)]+_0x685adc(0x117)+_0x4e5718[_0x685adc(0x15e)]+_0x5231ba;}function U(_0x40baca){const _0x5ebdc3=a0_0x517d1f;return{'event':{'sending':_0x5ebdc3(0x148),'delivered':_0x5ebdc3(0x10b),'failed':_0x5ebdc3(0x115),'acked':_0x5ebdc3(0x111),'started':_0x5ebdc3(0x108),'replied':_0x5ebdc3(0x168),'expired':_0x5ebdc3(0x129)}[_0x40baca[_0x5ebdc3(0x10c)]],..._0x40baca};}function j(_0x5edc64){const _0x1b2749=a0_0x517d1f;let _0x4947da=_0x5edc64?.[_0x1b2749(0x11a)]||_0x5edc64?.[_0x1b2749(0x14d)]||_0x5edc64?.['id'];if(_0x4947da)return String(_0x4947da);let _0x1196e3=_0x5edc64?.[_0x1b2749(0x15b)]?.[0x0]?.[_0x1b2749(0x15c)];if(typeof _0x1196e3!==_0x1b2749(0x11b))return null;try{let _0x15e866=JSON[_0x1b2749(0x13a)](_0x1196e3);return _0x15e866?.[_0x1b2749(0x11a)]||_0x15e866?.['message_id']||_0x15e866?.['id']||null;}catch{return null;}}async function X(_0x3436c1,_0x1cbc1e){const _0x37621e=a0_0x517d1f;let _0x35cb93=_0x1cbc1e['now']??Date['now'],_0x56f2b8=_0x35cb93(),_0x5285c7=(_0x17e458,_0x3bbaac,_0x55bfca,_0x4e49f5)=>{const _0x118583=a0_0x35cf;_0x1cbc1e['log'](O(U({'from_alias':_0x3436c1[_0x118583(0x16f)],'to_alias':_0x3436c1['toAlias'],'task_id':_0x3bbaac,'parent_task_id':_0x3436c1[_0x118583(0x13f)],'network_id':_0x3436c1[_0x118583(0x133)],'transport':_0x3436c1[_0x118583(0x172)],'status':_0x17e458,'duration_ms':_0x35cb93()-_0x56f2b8,'lifecycle_tracking':_0x3436c1[_0x118583(0x142)],..._0x55bfca!==void 0x0?{'error_code':_0x4e49f5||_0x118583(0x107),'error_message':N(_0x55bfca)}:{}})));};_0x5285c7(_0x37621e(0x163),null);try{let _0x19dfac=await _0x1cbc1e[_0x37621e(0x146)](),_0x569816=j(_0x19dfac);if(_0x569816)_0x5285c7(_0x37621e(0x152),_0x569816);else{if(_0x19dfac?.['ok']===!0x1||_0x19dfac?.[_0x37621e(0x12f)])_0x5285c7('failed',_0x569816,_0x19dfac?.['error']||_0x37621e(0x16b),_0x37621e(0x138));else _0x5285c7(_0x37621e(0x122),null,_0x37621e(0x10d),_0x37621e(0x16a));}return _0x19dfac;}catch(_0x4d0a25){throw _0x5285c7(_0x37621e(0x122),null,_0x4d0a25,'send_failed'),_0x4d0a25;}}async function Y(_0x410c09,_0x4b2793){const _0x3389d8=a0_0x517d1f;return X({'fromAlias':_0x410c09[_0x3389d8(0x16f)],'toAlias':_0x410c09[_0x3389d8(0x120)],'parentTaskId':_0x410c09[_0x3389d8(0x13f)]||null,'networkId':_0x410c09[_0x3389d8(0x133)]||null,'transport':'mcp_http','lifecycleTracking':_0x3389d8(0x177)},_0x4b2793);}function a0_0x42bb(){const _0x1cb441=['autoConnect','reply','task.send.failed','sdk','\x20lifecycle=','application/json','error_code','task_id','string','\x20parent_task_id=','broadcast','running','heartbeatTimer','alias','toString','failed','data:\x20','SSE\x20error:\x20','body','slice','send_reply','catch','task.expired','\x20network_id=','cwd','disconnect','2390448eAQtjT','network_id','error','normal','reconnectDelay','send_message','networkId','from_alias','task','replace','POST','send_rejected','heartbeat\x20failed:\x20','parse','text/event-stream','connected','log','server','parentTaskId','\x20transport=','processInbox','lifecycleTracking','disconnected','SSE\x20reconnecting\x20in\x20','SSE\x20failed:\x20','send','\x20task_id=','task.send.start','error_message','inbox\x20error:\x20','url','s...','message_id','duration_ms','sdk-','101197oJghsY','startsWith','delivered','to_alias','Authorization','offline','agent','7899164ifhwUo','read','name','ack_inbox','content','text','new_task','lifecycle_tracking','sleep','4nYQPYv','2mLxLVp','application/json,\x20text/event-stream','sending','<missing>','connectSSE','token','get_all_status','task.replied','match','missing_task_id','CommHub\x20rejected\x20task','2.0','type','now','fromAlias','get_inbox','message','transport','connect','Bearer\x20','resumeId','5880894yUXmsS','not_tracked','idle','4747115iMCoMb','stringify','\x20to=','pop','1110064iiTLvU','json','parent_task_id','heartbeatInterval','abort','/events/','signal','<unknown>','min','<pending>','completed','send_failed','task.started','21870261WPafHy','/mcp','task.send.delivered','status','CommHub\x20response\x20omitted\x20task_id','sseAbort','call','getReader','task.ack','emit'];a0_0x42bb=function(){return _0x1cb441;};return a0_0x42bb();}class $ extends a0_0x1726db{[a0_0x517d1f(0x14b)];[a0_0x517d1f(0x120)];[a0_0x517d1f(0x166)];[a0_0x517d1f(0x156)];[a0_0x517d1f(0x175)];['heartbeatInterval'];[a0_0x517d1f(0x131)];[a0_0x517d1f(0x11f)];['sseAbort'];[a0_0x517d1f(0x11e)]=!0x1;constructor(_0x3b8333){const _0x50b9fa=a0_0x517d1f;super();if(this[_0x50b9fa(0x14b)]=_0x3b8333[_0x50b9fa(0x14b)]['replace'](/\/$/,''),this['alias']=_0x3b8333['alias'],this['token']=_0x3b8333[_0x50b9fa(0x166)],this[_0x50b9fa(0x156)]=_0x3b8333[_0x50b9fa(0x156)]||_0x50b9fa(0x116),this[_0x50b9fa(0x175)]=_0x50b9fa(0x14f)+_0x3b8333[_0x50b9fa(0x120)]+'-'+Date[_0x50b9fa(0x16e)]()[_0x50b9fa(0x121)](0x24),this['heartbeatInterval']=_0x3b8333[_0x50b9fa(0xff)]??0x2bf20,this['reconnectDelay']=_0x3b8333[_0x50b9fa(0x131)]??0xbb8,_0x3b8333[_0x50b9fa(0x113)]!==!0x1)this[_0x50b9fa(0x173)]();}[a0_0x517d1f(0x13d)](_0x29c842){const _0x5b7ca1=a0_0x517d1f;console[_0x5b7ca1(0x13d)]('['+new Date()['toTimeString']()[_0x5b7ca1(0x126)](0x0,0x8)+']\x20[commhub:'+this[_0x5b7ca1(0x120)]+']\x20'+_0x29c842);}async['call'](_0x1ac54c,_0x13971c){const _0x2e9985=a0_0x517d1f;let _0x84c15d={'Content-Type':_0x2e9985(0x118),'Accept':_0x2e9985(0x162)};if(this[_0x2e9985(0x166)])_0x84c15d[_0x2e9985(0x154)]=_0x2e9985(0x174)+this[_0x2e9985(0x166)];let _0x3aa945=await(await fetch(this[_0x2e9985(0x14b)]+_0x2e9985(0x10a),{'method':_0x2e9985(0x137),'headers':_0x84c15d,'body':JSON[_0x2e9985(0x17a)]({'jsonrpc':_0x2e9985(0x16c),'id':Date['now'](),'method':'tools/call','params':{'name':_0x1ac54c,'arguments':_0x13971c}})}))[_0x2e9985(0x15c)](),_0x378c2e=_0x3aa945[_0x2e9985(0x169)](/data: (.+)/),_0x1b1da6=_0x378c2e?JSON[_0x2e9985(0x13a)](_0x378c2e[0x1]):JSON['parse'](_0x3aa945),_0x9d31ba=_0x1b1da6?.['result']?.[_0x2e9985(0x15b)]?.[0x0]?.[_0x2e9985(0x15c)];return _0x9d31ba?JSON[_0x2e9985(0x13a)](_0x9d31ba):_0x1b1da6;}async[a0_0x517d1f(0x173)](){const _0x114cf1=a0_0x517d1f;if(this['running'])return;this[_0x114cf1(0x11e)]=!0x0,await this[_0x114cf1(0x10c)](_0x114cf1(0x178)),this[_0x114cf1(0x13d)]('registered'),this[_0x114cf1(0x11f)]=setInterval(()=>{const _0x238fc1=_0x114cf1;this['status'](_0x238fc1(0x178))['catch'](_0x360aa0=>this[_0x238fc1(0x13d)](_0x238fc1(0x139)+_0x360aa0['message']));},this[_0x114cf1(0xff)]),this[_0x114cf1(0x165)]();}async[a0_0x517d1f(0x12c)](){const _0x1394f2=a0_0x517d1f;if(this[_0x1394f2(0x11e)]=!0x1,this['sseAbort']?.[_0x1394f2(0x100)](),this['heartbeatTimer'])clearInterval(this[_0x1394f2(0x11f)]);await this[_0x1394f2(0x10c)](_0x1394f2(0x155))[_0x1394f2(0x128)](()=>{}),this[_0x1394f2(0x13d)](_0x1394f2(0x143));}async['send'](_0x2d0a2f,_0xab1b7c,_0x49cdd5=a0_0x517d1f(0x130)){const _0x172c0f=a0_0x517d1f;return Y({'alias':_0x2d0a2f,'fromAlias':this[_0x172c0f(0x120)]},{'log':_0x1efd3d=>console['log'](_0x1efd3d),'send':()=>this['call']('send_task',{'alias':_0x2d0a2f,'task':_0xab1b7c,'priority':_0x49cdd5,'from_session':this[_0x172c0f(0x120)]})});}async['message'](_0xa67724,_0x4dd06d){const _0x5ebbd2=a0_0x517d1f;return this[_0x5ebbd2(0x10f)](_0x5ebbd2(0x132),{'alias':_0xa67724,'message':_0x4dd06d,'from_session':this['alias']});}async[a0_0x517d1f(0x114)](_0x3dd789,_0x234a18,_0x2fe917=a0_0x517d1f(0x106)){const _0x1c55db=a0_0x517d1f;return this[_0x1c55db(0x10f)](_0x1c55db(0x127),{'in_reply_to':_0x3dd789,'text':_0x234a18,'status':_0x2fe917});}async[a0_0x517d1f(0x10c)](_0x1f3dc7,_0x5de153){const _0x1a5e89=a0_0x517d1f;return this[_0x1a5e89(0x10f)]('report_status',{'resume_id':this['resumeId'],'alias':this['alias'],'status':_0x1f3dc7,'server':a0_0x2b7564(),'hostname':a0_0x2b7564(),'agent':this['agent'],'project_dir':process[_0x1a5e89(0x12b)](),..._0x5de153});}async['getAllStatus'](){const _0x3aefb0=a0_0x517d1f;return this[_0x3aefb0(0x10f)](_0x3aefb0(0x167),{});}async[a0_0x517d1f(0x11d)](_0x4ec4c6,_0x3388dc){const _0x53973b=a0_0x517d1f;return this['call'](_0x53973b(0x11d),{'message':_0x4ec4c6,'filter_server':_0x3388dc?.[_0x53973b(0x13e)],'filter_status':_0x3388dc?.[_0x53973b(0x10c)]});}async[a0_0x517d1f(0x165)](){const _0x369ede=a0_0x517d1f;let _0x2f7edd=encodeURIComponent(this['alias']),_0x131ba4=this[_0x369ede(0x14b)]+_0x369ede(0x101)+_0x2f7edd,_0x25dc02=this[_0x369ede(0x131)];while(this[_0x369ede(0x11e)]){try{this[_0x369ede(0x10e)]=new AbortController();let _0x24a0f1={'Accept':_0x369ede(0x13b)};if(this[_0x369ede(0x166)])_0x24a0f1[_0x369ede(0x154)]=_0x369ede(0x174)+this['token'];let _0x297ef3=await fetch(_0x131ba4,{'headers':_0x24a0f1,'signal':this['sseAbort'][_0x369ede(0x102)]});if(!_0x297ef3['ok']||!_0x297ef3[_0x369ede(0x125)]){this[_0x369ede(0x13d)](_0x369ede(0x145)+_0x297ef3['status']),await this[_0x369ede(0x15f)](_0x25dc02),_0x25dc02=Math[_0x369ede(0x104)](_0x25dc02*1.5,0xea60);continue;}_0x25dc02=this[_0x369ede(0x131)];let _0xb4fed6=_0x297ef3[_0x369ede(0x125)][_0x369ede(0x110)](),_0x292ca6=new TextDecoder(),_0x12c6f1='';while(this[_0x369ede(0x11e)]){let {done:_0x1af3dc,value:_0x3ebeb6}=await _0xb4fed6[_0x369ede(0x158)]();if(_0x1af3dc)break;_0x12c6f1+=_0x292ca6['decode'](_0x3ebeb6,{'stream':!0x0});let _0x44a389=_0x12c6f1['split']('\x0a');_0x12c6f1=_0x44a389[_0x369ede(0x17c)]()||'';for(let _0x1ac5b5 of _0x44a389){if(!_0x1ac5b5[_0x369ede(0x151)](_0x369ede(0x123)))continue;try{let _0x3973f2=JSON['parse'](_0x1ac5b5[_0x369ede(0x126)](0x6));if(_0x3973f2['type']===_0x369ede(0x13c)){this['log']('SSE\x20connected'),this[_0x369ede(0x112)](_0x369ede(0x13c));continue;}if(_0x3973f2[_0x369ede(0x16d)]===_0x369ede(0x15d)||_0x3973f2['type']==='new_message'||_0x3973f2[_0x369ede(0x16d)]===_0x369ede(0x11d))await this[_0x369ede(0x141)]();}catch{}}}}catch(_0x45a0df){if(_0x45a0df[_0x369ede(0x159)]==='AbortError')break;this['emit'](_0x369ede(0x12f),_0x45a0df),this['log'](_0x369ede(0x124)+_0x45a0df[_0x369ede(0x171)]);}if(this[_0x369ede(0x11e)])this[_0x369ede(0x112)]('disconnected'),this[_0x369ede(0x13d)](_0x369ede(0x144)+_0x25dc02/0x3e8+_0x369ede(0x14c)),await this[_0x369ede(0x15f)](_0x25dc02),_0x25dc02=Math[_0x369ede(0x104)](_0x25dc02*1.5,0xea60);}}async[a0_0x517d1f(0x141)](){const _0x37260=a0_0x517d1f;try{let _0x17ad16=(await this[_0x37260(0x10f)](_0x37260(0x170),{'alias':this[_0x37260(0x120)],'limit':0xa}))?.['messages']||[];for(let _0x41b47d of _0x17ad16)await this['call'](_0x37260(0x15a),{'alias':this[_0x37260(0x120)],'message_id':_0x41b47d['id']}),this['log']('←\x20'+_0x41b47d['from_session']+':\x20'+_0x41b47d[_0x37260(0x15b)]['slice'](0x0,0x3c)),this[_0x37260(0x112)](_0x37260(0x135),_0x41b47d),this['emit']('message',_0x41b47d);}catch(_0xca6970){this[_0x37260(0x13d)](_0x37260(0x14a)+_0xca6970[_0x37260(0x171)]);}}[a0_0x517d1f(0x15f)](_0x32b102){return new Promise(_0x4f7788=>setTimeout(_0x4f7788,_0x32b102));}}var F=$;function a0_0x35cf(_0x3c6411,_0x4a2004){_0x3c6411=_0x3c6411-0xfe;const _0x42bb64=a0_0x42bb();let _0x35cf0c=_0x42bb64[_0x3c6411];return _0x35cf0c;}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[];