@sleep2agi/agent-network 2.2.15-preview.0 → 2.2.16-preview.0

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_0x2d582f=a0_0x61fc;(function(_0x5b8f9a,_0x472113){const _0x45cb21=a0_0x61fc,_0x238368=_0x5b8f9a();while(!![]){try{const _0x3804d0=-parseInt(_0x45cb21(0x17e))/0x1+-parseInt(_0x45cb21(0x169))/0x2+parseInt(_0x45cb21(0x16b))/0x3*(-parseInt(_0x45cb21(0x177))/0x4)+parseInt(_0x45cb21(0x151))/0x5+parseInt(_0x45cb21(0x158))/0x6*(parseInt(_0x45cb21(0x148))/0x7)+-parseInt(_0x45cb21(0x12f))/0x8+parseInt(_0x45cb21(0x163))/0x9;if(_0x3804d0===_0x472113)break;else _0x238368['push'](_0x238368['shift']());}catch(_0x575d4c){_0x238368['push'](_0x238368['shift']());}}}(a0_0x2c7c,0xcde10));import{EventEmitter as a0_0x453faf}from'events';import{hostname as a0_0x1d8542}from'os';function a0_0x2c7c(){const _0x3fa0a8=['pop','AbortError','heartbeatTimer','getReader','abort','1129400fTWqsr','message','cwd','text/event-stream','application/json','task','slice','sdk','send_task','3985400hIDMKU','broadcast','emit','messages','report_status','match','agent','from_session','name','call','reply','Bearer\x20','status','autoConnect','ack_inbox','new_task','sleep','decode','disconnected','resumeId','idle','reconnectDelay','registered','parse','text','5940067qOHoBu','alias','application/json,\x20text/event-stream','min','send_message','Authorization','POST','catch','SSE\x20error:\x20','1556480tWRtwl','server','read','s...','data:\x20','body','disconnect','6Unwnva','running','get_all_status','split','SSE\x20reconnecting\x20in\x20','send','sdk-','send_reply','SSE\x20connected','heartbeatInterval','processInbox','27262188MuFlJa','tools/call','/events/','type','token','stringify','3142020PPGTJL','now','36tEXeWc','inbox\x20error:\x20','sseAbort','log','connectSSE','error','new_message','content','SSE\x20failed:\x20','url','connected','get_inbox','49048dNJoca','toString'];a0_0x2c7c=function(){return _0x3fa0a8;};return a0_0x2c7c();}class T extends a0_0x453faf{['url'];[a0_0x2d582f(0x149)];[a0_0x2d582f(0x167)];[a0_0x2d582f(0x135)];['resumeId'];[a0_0x2d582f(0x161)];[a0_0x2d582f(0x144)];[a0_0x2d582f(0x17b)];['sseAbort'];[a0_0x2d582f(0x159)]=!0x1;constructor(_0x104dde){const _0x987e6c=a0_0x2d582f;super();if(this[_0x987e6c(0x174)]=_0x104dde[_0x987e6c(0x174)]['replace'](/\/$/,''),this[_0x987e6c(0x149)]=_0x104dde['alias'],this['token']=_0x104dde['token'],this['agent']=_0x104dde[_0x987e6c(0x135)]||_0x987e6c(0x12d),this[_0x987e6c(0x142)]=_0x987e6c(0x15e)+_0x104dde[_0x987e6c(0x149)]+'-'+Date[_0x987e6c(0x16a)]()[_0x987e6c(0x178)](0x24),this[_0x987e6c(0x161)]=_0x104dde['heartbeatInterval']??0x2bf20,this[_0x987e6c(0x144)]=_0x104dde['reconnectDelay']??0xbb8,_0x104dde[_0x987e6c(0x13c)]!==!0x1)this['connect']();}[a0_0x2d582f(0x16e)](_0x3d8ff9){const _0x4a082f=a0_0x2d582f;console[_0x4a082f(0x16e)]('['+new Date()['toTimeString']()[_0x4a082f(0x184)](0x0,0x8)+']\x20[commhub:'+this[_0x4a082f(0x149)]+']\x20'+_0x3d8ff9);}async[a0_0x2d582f(0x138)](_0x1297b1,_0x2d2b34){const _0xde445d=a0_0x2d582f;let _0x1c111c={'Content-Type':_0xde445d(0x182),'Accept':_0xde445d(0x14a)};if(this[_0xde445d(0x167)])_0x1c111c['Authorization']=_0xde445d(0x13a)+this[_0xde445d(0x167)];let _0x4b9dd6=await(await fetch(this[_0xde445d(0x174)]+'/mcp',{'method':_0xde445d(0x14e),'headers':_0x1c111c,'body':JSON[_0xde445d(0x168)]({'jsonrpc':'2.0','id':Date[_0xde445d(0x16a)](),'method':_0xde445d(0x164),'params':{'name':_0x1297b1,'arguments':_0x2d2b34}})}))[_0xde445d(0x147)](),_0x5376bc=_0x4b9dd6[_0xde445d(0x134)](/data: (.+)/),_0x2b93d2=_0x5376bc?JSON[_0xde445d(0x146)](_0x5376bc[0x1]):JSON[_0xde445d(0x146)](_0x4b9dd6),_0x151bc0=_0x2b93d2?.['result']?.[_0xde445d(0x172)]?.[0x0]?.[_0xde445d(0x147)];return _0x151bc0?JSON[_0xde445d(0x146)](_0x151bc0):_0x2b93d2;}async['connect'](){const _0xaa0716=a0_0x2d582f;if(this[_0xaa0716(0x159)])return;this['running']=!0x0,await this[_0xaa0716(0x13b)](_0xaa0716(0x143)),this[_0xaa0716(0x16e)](_0xaa0716(0x145)),this[_0xaa0716(0x17b)]=setInterval(()=>{const _0x24e919=_0xaa0716;this[_0x24e919(0x13b)]('idle')['catch'](_0x39b1a2=>this['log']('heartbeat\x20failed:\x20'+_0x39b1a2[_0x24e919(0x17f)]));},this[_0xaa0716(0x161)]),this[_0xaa0716(0x16f)]();}async[a0_0x2d582f(0x157)](){const _0x422ab6=a0_0x2d582f;if(this[_0x422ab6(0x159)]=!0x1,this[_0x422ab6(0x16d)]?.[_0x422ab6(0x17d)](),this['heartbeatTimer'])clearInterval(this[_0x422ab6(0x17b)]);await this['status']('offline')[_0x422ab6(0x14f)](()=>{}),this[_0x422ab6(0x16e)]('disconnected');}async[a0_0x2d582f(0x15d)](_0x5af88e,_0x4d07b5,_0x3687c5='normal'){const _0x403250=a0_0x2d582f;return this[_0x403250(0x138)](_0x403250(0x12e),{'alias':_0x5af88e,'task':_0x4d07b5,'priority':_0x3687c5,'from_session':this[_0x403250(0x149)]});}async['message'](_0x4ec1ea,_0x455575){const _0x11c3e9=a0_0x2d582f;return this[_0x11c3e9(0x138)](_0x11c3e9(0x14c),{'alias':_0x4ec1ea,'message':_0x455575,'from_session':this['alias']});}async[a0_0x2d582f(0x139)](_0x124f2f,_0x424958,_0x7f0d11='completed'){const _0x4ac5df=a0_0x2d582f;return this[_0x4ac5df(0x138)](_0x4ac5df(0x15f),{'in_reply_to':_0x124f2f,'text':_0x424958,'status':_0x7f0d11});}async[a0_0x2d582f(0x13b)](_0x4546e3,_0x261ab2){const _0x3506ea=a0_0x2d582f;return this[_0x3506ea(0x138)](_0x3506ea(0x133),{'resume_id':this['resumeId'],'alias':this[_0x3506ea(0x149)],'status':_0x4546e3,'server':a0_0x1d8542(),'hostname':a0_0x1d8542(),'agent':this[_0x3506ea(0x135)],'project_dir':process[_0x3506ea(0x180)](),..._0x261ab2});}async['getAllStatus'](){const _0x518d1c=a0_0x2d582f;return this[_0x518d1c(0x138)](_0x518d1c(0x15a),{});}async['broadcast'](_0x5d6253,_0x33b6f7){const _0x20b886=a0_0x2d582f;return this[_0x20b886(0x138)](_0x20b886(0x130),{'message':_0x5d6253,'filter_server':_0x33b6f7?.[_0x20b886(0x152)],'filter_status':_0x33b6f7?.[_0x20b886(0x13b)]});}async[a0_0x2d582f(0x16f)](){const _0x195cd2=a0_0x2d582f;let _0x2aff09=encodeURIComponent(this[_0x195cd2(0x149)]),_0x555bec=this[_0x195cd2(0x174)]+_0x195cd2(0x165)+_0x2aff09,_0x1e3c02=this['reconnectDelay'];while(this[_0x195cd2(0x159)]){try{this[_0x195cd2(0x16d)]=new AbortController();let _0x23a3ff={'Accept':_0x195cd2(0x181)};if(this[_0x195cd2(0x167)])_0x23a3ff[_0x195cd2(0x14d)]=_0x195cd2(0x13a)+this[_0x195cd2(0x167)];let _0x543c84=await fetch(_0x555bec,{'headers':_0x23a3ff,'signal':this[_0x195cd2(0x16d)]['signal']});if(!_0x543c84['ok']||!_0x543c84['body']){this['log'](_0x195cd2(0x173)+_0x543c84[_0x195cd2(0x13b)]),await this['sleep'](_0x1e3c02),_0x1e3c02=Math['min'](_0x1e3c02*1.5,0xea60);continue;}_0x1e3c02=this[_0x195cd2(0x144)];let _0x29aece=_0x543c84[_0x195cd2(0x156)][_0x195cd2(0x17c)](),_0x231d9e=new TextDecoder(),_0x1ddd2b='';while(this['running']){let {done:_0x4d962a,value:_0x3af0e7}=await _0x29aece[_0x195cd2(0x153)]();if(_0x4d962a)break;_0x1ddd2b+=_0x231d9e[_0x195cd2(0x140)](_0x3af0e7,{'stream':!0x0});let _0x571b8d=_0x1ddd2b[_0x195cd2(0x15b)]('\x0a');_0x1ddd2b=_0x571b8d[_0x195cd2(0x179)]()||'';for(let _0x4a661f of _0x571b8d){if(!_0x4a661f['startsWith'](_0x195cd2(0x155)))continue;try{let _0x15f78e=JSON[_0x195cd2(0x146)](_0x4a661f[_0x195cd2(0x184)](0x6));if(_0x15f78e[_0x195cd2(0x166)]==='connected'){this[_0x195cd2(0x16e)](_0x195cd2(0x160)),this[_0x195cd2(0x131)](_0x195cd2(0x175));continue;}if(_0x15f78e[_0x195cd2(0x166)]===_0x195cd2(0x13e)||_0x15f78e[_0x195cd2(0x166)]===_0x195cd2(0x171)||_0x15f78e[_0x195cd2(0x166)]==='broadcast')await this[_0x195cd2(0x162)]();}catch{}}}}catch(_0x103c78){if(_0x103c78[_0x195cd2(0x137)]===_0x195cd2(0x17a))break;this['emit'](_0x195cd2(0x170),_0x103c78),this[_0x195cd2(0x16e)](_0x195cd2(0x150)+_0x103c78[_0x195cd2(0x17f)]);}if(this[_0x195cd2(0x159)])this[_0x195cd2(0x131)](_0x195cd2(0x141)),this['log'](_0x195cd2(0x15c)+_0x1e3c02/0x3e8+_0x195cd2(0x154)),await this[_0x195cd2(0x13f)](_0x1e3c02),_0x1e3c02=Math[_0x195cd2(0x14b)](_0x1e3c02*1.5,0xea60);}}async['processInbox'](){const _0x2c675d=a0_0x2d582f;try{let _0x5bf416=(await this['call'](_0x2c675d(0x176),{'alias':this['alias'],'limit':0xa}))?.[_0x2c675d(0x132)]||[];for(let _0x2b552e of _0x5bf416)await this[_0x2c675d(0x138)](_0x2c675d(0x13d),{'alias':this['alias'],'message_id':_0x2b552e['id']}),this['log']('←\x20'+_0x2b552e[_0x2c675d(0x136)]+':\x20'+_0x2b552e[_0x2c675d(0x172)][_0x2c675d(0x184)](0x0,0x3c)),this[_0x2c675d(0x131)](_0x2c675d(0x183),_0x2b552e),this[_0x2c675d(0x131)](_0x2c675d(0x17f),_0x2b552e);}catch(_0x24fd35){this[_0x2c675d(0x16e)](_0x2c675d(0x16c)+_0x24fd35[_0x2c675d(0x17f)]);}}[a0_0x2d582f(0x13f)](_0x1abcea){return new Promise(_0x15a1ea=>setTimeout(_0x15a1ea,_0x1abcea));}}var $=T;function a0_0x61fc(_0x1e4093,_0x556b84){_0x1e4093=_0x1e4093-0x12d;const _0x2c7c6e=a0_0x2c7c();let _0x61fc91=_0x2c7c6e[_0x1e4093];return _0x61fc91;}export{$ as default,T as CommHub};
1
+ const a0_0x1f8908=a0_0x195a;(function(_0xecbdd5,_0x3d058e){const _0x29073d=a0_0x195a,_0x1b55d8=_0xecbdd5();while(!![]){try{const _0x53666c=parseInt(_0x29073d(0x1cd))/0x1*(parseInt(_0x29073d(0x1ce))/0x2)+parseInt(_0x29073d(0x1db))/0x3*(-parseInt(_0x29073d(0x1b9))/0x4)+-parseInt(_0x29073d(0x1da))/0x5*(parseInt(_0x29073d(0x1b7))/0x6)+parseInt(_0x29073d(0x1de))/0x7*(-parseInt(_0x29073d(0x1dd))/0x8)+-parseInt(_0x29073d(0x1fb))/0x9+parseInt(_0x29073d(0x1fd))/0xa*(parseInt(_0x29073d(0x1d6))/0xb)+parseInt(_0x29073d(0x1f5))/0xc;if(_0x53666c===_0x3d058e)break;else _0x1b55d8['push'](_0x1b55d8['shift']());}catch(_0x455fb1){_0x1b55d8['push'](_0x1b55d8['shift']());}}}(a0_0x459c,0x2e629));function a0_0x459c(){const _0x28e940=['send_task','ack_inbox','/mcp','reconnectDelay','5100828YCNioK','send_reply','sdk','processInbox','SSE\x20error:\x20','from_session','338085QKBUII','send_message','4340MJcZBr','message','result','tools/call','server','body','sdk-','log','sseAbort','connect','split','url','signal','now','read','idle','broadcast','get_all_status','startsWith','78LWkxZf','name','65180baKBBK','resumeId','connected','text/event-stream','catch','alias','abort','cwd','match','Authorization','autoConnect','heartbeat\x20failed:\x20','registered','heartbeatTimer','getAllStatus','decode','task','new_task','2.0','agent','1ReXrew','513482qTmHbZ','SSE\x20connected','sleep','SSE\x20failed:\x20','send','token','connectSSE','Bearer\x20','671YpMHQb','heartbeatInterval','type','slice','65525ZOVTzJ','30mLzXfB','text','393096WSZGIl','21qNvGSI','disconnected','call','getReader','parse','normal','status','report_status','AbortError','min','messages','completed','emit','toTimeString','running','/events/','new_message','error','content'];a0_0x459c=function(){return _0x28e940;};return a0_0x459c();}import{EventEmitter as a0_0xc22e97}from'events';import{hostname as a0_0x3bfe8d}from'os';class T extends a0_0xc22e97{[a0_0x1f8908(0x1af)];[a0_0x1f8908(0x1be)];['token'];[a0_0x1f8908(0x1cc)];[a0_0x1f8908(0x1ba)];[a0_0x1f8908(0x1d7)];[a0_0x1f8908(0x1f4)];[a0_0x1f8908(0x1c6)];[a0_0x1f8908(0x205)];[a0_0x1f8908(0x1ec)]=!0x1;constructor(_0x50db5a){const _0x5d2054=a0_0x1f8908;super();if(this['url']=_0x50db5a['url']['replace'](/\/$/,''),this[_0x5d2054(0x1be)]=_0x50db5a[_0x5d2054(0x1be)],this[_0x5d2054(0x1d3)]=_0x50db5a[_0x5d2054(0x1d3)],this[_0x5d2054(0x1cc)]=_0x50db5a[_0x5d2054(0x1cc)]||_0x5d2054(0x1f7),this[_0x5d2054(0x1ba)]=_0x5d2054(0x203)+_0x50db5a[_0x5d2054(0x1be)]+'-'+Date[_0x5d2054(0x1b1)]()['toString'](0x24),this[_0x5d2054(0x1d7)]=_0x50db5a[_0x5d2054(0x1d7)]??0x2bf20,this['reconnectDelay']=_0x50db5a[_0x5d2054(0x1f4)]??0xbb8,_0x50db5a[_0x5d2054(0x1c3)]!==!0x1)this[_0x5d2054(0x206)]();}[a0_0x1f8908(0x204)](_0x5cfc4b){const _0x23d293=a0_0x1f8908;console['log']('['+new Date()[_0x23d293(0x1eb)]()[_0x23d293(0x1d9)](0x0,0x8)+']\x20[commhub:'+this['alias']+']\x20'+_0x5cfc4b);}async[a0_0x1f8908(0x1e0)](_0x4b14b0,_0x24abc0){const _0x3abc8a=a0_0x1f8908;let _0x4e0797={'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream'};if(this[_0x3abc8a(0x1d3)])_0x4e0797[_0x3abc8a(0x1c2)]=_0x3abc8a(0x1d5)+this['token'];let _0x4908d3=await(await fetch(this['url']+_0x3abc8a(0x1f3),{'method':'POST','headers':_0x4e0797,'body':JSON['stringify']({'jsonrpc':_0x3abc8a(0x1cb),'id':Date[_0x3abc8a(0x1b1)](),'method':_0x3abc8a(0x200),'params':{'name':_0x4b14b0,'arguments':_0x24abc0}})}))[_0x3abc8a(0x1dc)](),_0x301e28=_0x4908d3[_0x3abc8a(0x1c1)](/data: (.+)/),_0xbda2f4=_0x301e28?JSON['parse'](_0x301e28[0x1]):JSON[_0x3abc8a(0x1e2)](_0x4908d3),_0x16864c=_0xbda2f4?.[_0x3abc8a(0x1ff)]?.['content']?.[0x0]?.[_0x3abc8a(0x1dc)];return _0x16864c?JSON[_0x3abc8a(0x1e2)](_0x16864c):_0xbda2f4;}async[a0_0x1f8908(0x206)](){const _0x216869=a0_0x1f8908;if(this[_0x216869(0x1ec)])return;this['running']=!0x0,await this[_0x216869(0x1e4)](_0x216869(0x1b3)),this['log'](_0x216869(0x1c5)),this[_0x216869(0x1c6)]=setInterval(()=>{const _0x389bee=_0x216869;this[_0x389bee(0x1e4)](_0x389bee(0x1b3))[_0x389bee(0x1bd)](_0x571af1=>this[_0x389bee(0x204)](_0x389bee(0x1c4)+_0x571af1[_0x389bee(0x1fe)]));},this[_0x216869(0x1d7)]),this[_0x216869(0x1d4)]();}async['disconnect'](){const _0xca744f=a0_0x1f8908;if(this['running']=!0x1,this[_0xca744f(0x205)]?.[_0xca744f(0x1bf)](),this['heartbeatTimer'])clearInterval(this[_0xca744f(0x1c6)]);await this[_0xca744f(0x1e4)]('offline')['catch'](()=>{}),this[_0xca744f(0x204)](_0xca744f(0x1df));}async[a0_0x1f8908(0x1d2)](_0xb2173f,_0x39e976,_0x48f8b2=a0_0x1f8908(0x1e3)){const _0xb27f69=a0_0x1f8908;return this['call'](_0xb27f69(0x1f1),{'alias':_0xb2173f,'task':_0x39e976,'priority':_0x48f8b2,'from_session':this['alias']});}async[a0_0x1f8908(0x1fe)](_0x38f05a,_0x1fb2a2){const _0x34dd26=a0_0x1f8908;return this[_0x34dd26(0x1e0)](_0x34dd26(0x1fc),{'alias':_0x38f05a,'message':_0x1fb2a2,'from_session':this[_0x34dd26(0x1be)]});}async['reply'](_0x48699b,_0x4ba247,_0x369690=a0_0x1f8908(0x1e9)){const _0x295766=a0_0x1f8908;return this[_0x295766(0x1e0)](_0x295766(0x1f6),{'in_reply_to':_0x48699b,'text':_0x4ba247,'status':_0x369690});}async['status'](_0x4cfbc5,_0x15fe72){const _0x29ee1f=a0_0x1f8908;return this[_0x29ee1f(0x1e0)](_0x29ee1f(0x1e5),{'resume_id':this[_0x29ee1f(0x1ba)],'alias':this[_0x29ee1f(0x1be)],'status':_0x4cfbc5,'server':a0_0x3bfe8d(),'hostname':a0_0x3bfe8d(),'agent':this[_0x29ee1f(0x1cc)],'project_dir':process[_0x29ee1f(0x1c0)](),..._0x15fe72});}async[a0_0x1f8908(0x1c7)](){const _0xc5401=a0_0x1f8908;return this[_0xc5401(0x1e0)](_0xc5401(0x1b5),{});}async[a0_0x1f8908(0x1b4)](_0x549148,_0x3962aa){const _0x106244=a0_0x1f8908;return this[_0x106244(0x1e0)](_0x106244(0x1b4),{'message':_0x549148,'filter_server':_0x3962aa?.[_0x106244(0x201)],'filter_status':_0x3962aa?.[_0x106244(0x1e4)]});}async[a0_0x1f8908(0x1d4)](){const _0x188026=a0_0x1f8908;let _0x4f0270=encodeURIComponent(this['alias']),_0x3ce143=this[_0x188026(0x1af)]+_0x188026(0x1ed)+_0x4f0270,_0x392af5=this['reconnectDelay'];while(this[_0x188026(0x1ec)]){try{this[_0x188026(0x205)]=new AbortController();let _0x8690f4={'Accept':_0x188026(0x1bc)};if(this[_0x188026(0x1d3)])_0x8690f4[_0x188026(0x1c2)]=_0x188026(0x1d5)+this[_0x188026(0x1d3)];let _0x1a7657=await fetch(_0x3ce143,{'headers':_0x8690f4,'signal':this[_0x188026(0x205)][_0x188026(0x1b0)]});if(!_0x1a7657['ok']||!_0x1a7657[_0x188026(0x202)]){this['log'](_0x188026(0x1d1)+_0x1a7657[_0x188026(0x1e4)]),await this[_0x188026(0x1d0)](_0x392af5),_0x392af5=Math[_0x188026(0x1e7)](_0x392af5*1.5,0xea60);continue;}_0x392af5=this[_0x188026(0x1f4)];let _0x164154=_0x1a7657[_0x188026(0x202)][_0x188026(0x1e1)](),_0x16a800=new TextDecoder(),_0x2dc21c='';while(this['running']){let {done:_0x14dc85,value:_0x3df84c}=await _0x164154[_0x188026(0x1b2)]();if(_0x14dc85)break;_0x2dc21c+=_0x16a800[_0x188026(0x1c8)](_0x3df84c,{'stream':!0x0});let _0x2c3d45=_0x2dc21c[_0x188026(0x207)]('\x0a');_0x2dc21c=_0x2c3d45['pop']()||'';for(let _0xb9fb27 of _0x2c3d45){if(!_0xb9fb27[_0x188026(0x1b6)]('data:\x20'))continue;try{let _0x1c32f1=JSON[_0x188026(0x1e2)](_0xb9fb27[_0x188026(0x1d9)](0x6));if(_0x1c32f1[_0x188026(0x1d8)]===_0x188026(0x1bb)){this[_0x188026(0x204)](_0x188026(0x1cf)),this[_0x188026(0x1ea)](_0x188026(0x1bb));continue;}if(_0x1c32f1[_0x188026(0x1d8)]===_0x188026(0x1ca)||_0x1c32f1[_0x188026(0x1d8)]===_0x188026(0x1ee)||_0x1c32f1[_0x188026(0x1d8)]===_0x188026(0x1b4))await this[_0x188026(0x1f8)]();}catch{}}}}catch(_0x385e6c){if(_0x385e6c[_0x188026(0x1b8)]===_0x188026(0x1e6))break;this[_0x188026(0x1ea)](_0x188026(0x1ef),_0x385e6c),this['log'](_0x188026(0x1f9)+_0x385e6c['message']);}if(this[_0x188026(0x1ec)])this[_0x188026(0x1ea)]('disconnected'),this[_0x188026(0x204)]('SSE\x20reconnecting\x20in\x20'+_0x392af5/0x3e8+'s...'),await this[_0x188026(0x1d0)](_0x392af5),_0x392af5=Math[_0x188026(0x1e7)](_0x392af5*1.5,0xea60);}}async[a0_0x1f8908(0x1f8)](){const _0x52870d=a0_0x1f8908;try{let _0x389cb9=(await this[_0x52870d(0x1e0)]('get_inbox',{'alias':this[_0x52870d(0x1be)],'limit':0xa}))?.[_0x52870d(0x1e8)]||[];for(let _0x20afcf of _0x389cb9)await this['call'](_0x52870d(0x1f2),{'alias':this[_0x52870d(0x1be)],'message_id':_0x20afcf['id']}),this[_0x52870d(0x204)]('←\x20'+_0x20afcf[_0x52870d(0x1fa)]+':\x20'+_0x20afcf[_0x52870d(0x1f0)][_0x52870d(0x1d9)](0x0,0x3c)),this[_0x52870d(0x1ea)](_0x52870d(0x1c9),_0x20afcf),this[_0x52870d(0x1ea)](_0x52870d(0x1fe),_0x20afcf);}catch(_0xa89752){this[_0x52870d(0x204)]('inbox\x20error:\x20'+_0xa89752[_0x52870d(0x1fe)]);}}[a0_0x1f8908(0x1d0)](_0x43769f){return new Promise(_0x55003c=>setTimeout(_0x55003c,_0x43769f));}}function a0_0x195a(_0x671262,_0x3793){_0x671262=_0x671262-0x1af;const _0x459c1a=a0_0x459c();let _0x195a45=_0x459c1a[_0x671262];return _0x195a45;}var $=T;export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x221966=a0_0x1874;(function(_0x408cb9,_0x596e93){const _0x2b7093=a0_0x1874,_0x4fd8ea=_0x408cb9();while(!![]){try{const _0x481ab7=-parseInt(_0x2b7093(0x22e))/0x1+-parseInt(_0x2b7093(0x227))/0x2+parseInt(_0x2b7093(0x24a))/0x3*(-parseInt(_0x2b7093(0x25a))/0x4)+parseInt(_0x2b7093(0x1e1))/0x5*(parseInt(_0x2b7093(0x24c))/0x6)+parseInt(_0x2b7093(0x21a))/0x7+parseInt(_0x2b7093(0x214))/0x8+-parseInt(_0x2b7093(0x1ea))/0x9*(-parseInt(_0x2b7093(0x208))/0xa);if(_0x481ab7===_0x596e93)break;else _0x4fd8ea['push'](_0x4fd8ea['shift']());}catch(_0x332faf){_0x4fd8ea['push'](_0x4fd8ea['shift']());}}}(a0_0x3262,0xbd8d6));import{readFileSync as a0_0x3c273c,existsSync as a0_0x345cd8}from'fs';import{randomUUID as a0_0x1b8658}from'crypto';import{join as a0_0x50bc38}from'path';import{hostname as a0_0x47108d}from'os';import{execSync as a0_0x134f3d}from'child_process';import{Server as a0_0x864aa2}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x8886fd}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x45f609,CallToolRequestSchema as a0_0x30a158}from'@modelcontextprotocol/sdk/types.js';function I(_0x4b1334){const _0x5353d5=a0_0x1874;if(!a0_0x345cd8(_0x4b1334))return;for(let _0x5d8442 of a0_0x3c273c(_0x4b1334,_0x5353d5(0x26a))[_0x5353d5(0x1e8)]('\x0a')){let _0x41c1b9=_0x5d8442[_0x5353d5(0x262)]();if(!_0x41c1b9||_0x41c1b9[_0x5353d5(0x204)]('#'))continue;let _0x188384=_0x41c1b9[_0x5353d5(0x23e)]('=');if(_0x188384<0x0)continue;let _0x1a5149=_0x41c1b9[_0x5353d5(0x26c)](0x0,_0x188384)[_0x5353d5(0x262)](),_0x1366c5=_0x41c1b9[_0x5353d5(0x26c)](_0x188384+0x1)[_0x5353d5(0x262)]()[_0x5353d5(0x203)](/^["']|["']$/g,'');if(!process.env[_0x1a5149])process.env[_0x1a5149]=_0x1366c5;}}var L=process.env.HOME||'~',U=a0_0x50bc38(L,'.claude/channels/commhub');I(a0_0x50bc38(U,a0_0x221966(0x213)));var v=process[a0_0x221966(0x221)]()[a0_0x221966(0x203)](/\//g,'-');I(a0_0x50bc38(U,v,a0_0x221966(0x213)));function d(){const _0x4254a9=a0_0x221966;try{return a0_0x134f3d(_0x4254a9(0x240),{'encoding':_0x4254a9(0x26a),'timeout':0x7d0})[_0x4254a9(0x262)]();}catch{return'';}}function m(){const _0x563e5f=a0_0x221966;try{let _0x15265d=a0_0x50bc38(L,_0x563e5f(0x231),'config.json');if(a0_0x345cd8(_0x15265d))return JSON['parse'](a0_0x3c273c(_0x15265d,_0x563e5f(0x26a)));}catch{}return{};}var u=m(),j=process.env.COMMHUB_URL||u[a0_0x221966(0x260)]||a0_0x221966(0x24b),f=process.env.COMMHUB_TMUX||d();function r(){const _0x4c6abe=a0_0x221966;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x4c6abe(0x262)]())return process.env.COMMHUB_ALIAS[_0x4c6abe(0x262)]();return process['stderr']['write']('[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20'+(_0x4c6abe(0x23f)+(f||_0x4c6abe(0x22a))+_0x4c6abe(0x206)+a0_0x47108d()+_0x4c6abe(0x20a))),_0x4c6abe(0x215)+process[_0x4c6abe(0x1d9)];}var G=r(),K=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x1b8658(),F=process.env.COMMHUB_TOKEN||u['token']||'';function W(_0x593acd){const _0x456f46=a0_0x221966;let _0x3d3c5b=new Date()[_0x456f46(0x253)]()[_0x456f46(0x26c)](0x0,0x8);process[_0x456f46(0x22d)][_0x456f46(0x1f8)]('['+_0x3d3c5b+_0x456f46(0x241)+_0x593acd+'\x0a');}function N(_0x59b862){return new Promise(_0x59d6a3=>setTimeout(_0x59d6a3,_0x59b862));}W('ENV:\x20URL='+j+'\x20ALIAS='+G+a0_0x221966(0x244)+K[a0_0x221966(0x26c)](0x0,0x8)+a0_0x221966(0x268)+(f||a0_0x221966(0x201))+a0_0x221966(0x25c)+process[a0_0x221966(0x221)]()+a0_0x221966(0x20e)+v);var D=new Map(),x=new a0_0x864aa2({'name':a0_0x221966(0x219),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x221966(0x1e7),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x221966(0x261),a0_0x221966(0x226),a0_0x221966(0x246)+G][a0_0x221966(0x239)]('\x0a')});x['setRequestHandler'](a0_0x45f609,async()=>({'tools':[{'name':a0_0x221966(0x210),'description':a0_0x221966(0x1fb),'inputSchema':{'type':a0_0x221966(0x236),'properties':{'task_id':{'type':a0_0x221966(0x1f6),'description':a0_0x221966(0x243)},'text':{'type':'string','description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':'string','enum':[a0_0x221966(0x1e0),a0_0x221966(0x238),a0_0x221966(0x21c),'blocked','error',a0_0x221966(0x257)],'description':a0_0x221966(0x25f)}},'required':[a0_0x221966(0x248)]}},{'name':a0_0x221966(0x23c),'description':a0_0x221966(0x1ed),'inputSchema':{'type':a0_0x221966(0x236),'properties':{'status':{'type':a0_0x221966(0x1f6),'enum':[a0_0x221966(0x225),a0_0x221966(0x1db),a0_0x221966(0x249),a0_0x221966(0x20c)]},'task':{'type':a0_0x221966(0x1f6),'description':a0_0x221966(0x1fd)},'progress':{'type':a0_0x221966(0x217),'description':a0_0x221966(0x1e5)}},'required':[a0_0x221966(0x1fc)]}},{'name':'commhub_send_task','description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':'object','properties':{'alias':{'type':'string','description':a0_0x221966(0x229)},'task':{'type':a0_0x221966(0x1f6),'description':a0_0x221966(0x23a)},'priority':{'type':a0_0x221966(0x1f6),'enum':['high',a0_0x221966(0x26e),a0_0x221966(0x267)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x221966(0x1ef),a0_0x221966(0x1e4)]}},{'name':a0_0x221966(0x1f7),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x221966(0x236),'properties':{'alias':{'type':a0_0x221966(0x1f6),'description':a0_0x221966(0x229)},'message':{'type':'string','description':'Message\x20content'}},'required':[a0_0x221966(0x1ef),'message']}},{'name':a0_0x221966(0x264),'description':a0_0x221966(0x25b),'inputSchema':{'type':a0_0x221966(0x236),'properties':{}}}]}));async function Y(_0x8c8ec7,_0xa8591f){const _0x3821c9=a0_0x221966;let _0x48cb87=await fetch(j+'/mcp',{'method':_0x3821c9(0x256),'headers':{'Content-Type':'application/json','Accept':_0x3821c9(0x24e),...F?{'Authorization':_0x3821c9(0x269)+F}:{}},'body':JSON[_0x3821c9(0x237)]({'jsonrpc':_0x3821c9(0x25d),'id':0x1,'method':_0x3821c9(0x26b),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x3821c9(0x219),'version':_0x3821c9(0x26f)}}})});if(!_0x48cb87['ok']){let _0x9f1ef7=await _0x48cb87[_0x3821c9(0x248)]();return W(_0x3821c9(0x22c)+_0x48cb87[_0x3821c9(0x1fc)]+'\x20'+_0x9f1ef7['slice'](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x48cb87[_0x3821c9(0x1fc)]};}await _0x48cb87[_0x3821c9(0x248)]();let _0x4394ca=(await(await fetch(j+_0x3821c9(0x270),{'method':'POST','headers':{'Content-Type':_0x3821c9(0x1f4),'Accept':'application/json,\x20text/event-stream',...F?{'Authorization':_0x3821c9(0x269)+F}:{}},'body':JSON[_0x3821c9(0x237)]({'jsonrpc':_0x3821c9(0x25d),'id':0x2,'method':'tools/call','params':{'name':_0x8c8ec7,'arguments':_0xa8591f}})}))['text']())[_0x3821c9(0x1e8)]('\x0a')['find'](_0x56aa05=>_0x56aa05[_0x3821c9(0x204)](_0x3821c9(0x250)));if(_0x4394ca){let _0x4759c3=JSON[_0x3821c9(0x209)](_0x4394ca[_0x3821c9(0x26c)](0x6));return _0x4759c3?.[_0x3821c9(0x1ec)]?.[_0x3821c9(0x1dc)]?.[0x0]?.[_0x3821c9(0x248)]?JSON[_0x3821c9(0x209)](_0x4759c3[_0x3821c9(0x1ec)][_0x3821c9(0x1dc)][0x0][_0x3821c9(0x248)]):_0x4759c3;}return{'ok':!0x1,'error':_0x3821c9(0x24f)};}x[a0_0x221966(0x1e6)](a0_0x30a158,async _0x5a29d6=>{const _0x4bed34=a0_0x221966;let {name:_0x5f5130,arguments:_0x191c2d}=_0x5a29d6[_0x4bed34(0x21f)];if(_0x5f5130===_0x4bed34(0x210)){let {task_id:_0x4b9e21,text:_0x4cb217,status:_0x1eea3e}=_0x191c2d;if(_0x1eea3e===_0x4bed34(0x1e0)||_0x1eea3e===_0x4bed34(0x238)||_0x1eea3e===_0x4bed34(0x21c)){let _0x204c58=_0x1eea3e==='completed'?_0x4bed34(0x22f):_0x1eea3e,_0x296638=_0x4b9e21?D['get'](_0x4b9e21)||_0x4bed34(0x260):'hub',_0x482448=await Y('send_reply',{'alias':_0x296638,'text':_0x4cb217,'in_reply_to':_0x4b9e21||void 0x0,'status':_0x204c58,'from_session':G});if(_0x4b9e21)D[_0x4bed34(0x220)](_0x4b9e21);return{'content':[{'type':_0x4bed34(0x248),'text':JSON[_0x4bed34(0x237)](_0x482448)}]};}let _0x496a40=await Y('report_status',{'resume_id':K,'alias':G,'status':_0x1eea3e==='blocked'?_0x4bed34(0x249):_0x1eea3e===_0x4bed34(0x20c)?'error':_0x4bed34(0x225),'task':_0x4cb217[_0x4bed34(0x26c)](0x0,0xc8),'output':_0x4cb217});return{'content':[{'type':_0x4bed34(0x248),'text':JSON[_0x4bed34(0x237)](_0x496a40)}]};}if(_0x5f5130===_0x4bed34(0x23c)){let {status:_0x50cad9,task:_0x3ed1c1,progress:_0x2dc969}=_0x191c2d,_0x15971f=await Y('report_status',{'resume_id':K,'alias':G,'status':_0x50cad9,'task':_0x3ed1c1,'progress':_0x2dc969});return{'content':[{'type':_0x4bed34(0x248),'text':JSON[_0x4bed34(0x237)](_0x15971f)}]};}if(_0x5f5130===_0x4bed34(0x245)){let {alias:_0x182c09,task:_0x1f6e01,priority:_0x2c7b58}=_0x191c2d,_0x2fe2b9=await Y('send_task',{'alias':_0x182c09,'task':_0x1f6e01,'priority':_0x2c7b58||_0x4bed34(0x26e),'from_session':G});return{'content':[{'type':_0x4bed34(0x248),'text':JSON[_0x4bed34(0x237)](_0x2fe2b9)}]};}if(_0x5f5130==='commhub_send_message'){let {alias:_0x2c85d9,message:_0x1c92e0}=_0x191c2d,_0x81207e=await Y(_0x4bed34(0x205),{'alias':_0x2c85d9,'message':_0x1c92e0,'from_session':G});return{'content':[{'type':_0x4bed34(0x248),'text':JSON[_0x4bed34(0x237)](_0x81207e)}]};}if(_0x5f5130==='commhub_get_all_status'){let _0x1942a8=await Y(_0x4bed34(0x1dd),{});return{'content':[{'type':_0x4bed34(0x248),'text':JSON['stringify'](_0x1942a8)}]};}return{'content':[{'type':_0x4bed34(0x248),'text':JSON['stringify']({'error':_0x4bed34(0x1f0)})}]};});var O=0x3e8,R=0x7530,T=0x36ee80;async function l(){const _0x1fe7b8=a0_0x221966;try{await Y('report_status',{'resume_id':K,'alias':G,'status':'idle','server':a0_0x47108d(),'hostname':a0_0x47108d(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':f||void 0x0}),W(_0x1fe7b8(0x25e)+G+'\x22\x20after\x20SSE\x20reconnect');}catch(_0x4511ac){W(_0x1fe7b8(0x265)+_0x4511ac);}}async function o(){const _0x3c4547=a0_0x221966;let _0x512601=j+_0x3c4547(0x200)+encodeURIComponent(G),_0x49ad42={};if(F)_0x49ad42[_0x3c4547(0x258)]=_0x3c4547(0x269)+F;W(_0x3c4547(0x26d)+_0x512601);let _0x5498a2=O,_0x516807=!0x0,_0x4d45e0=null;while(!0x0){try{let _0x117b03=await fetch(_0x512601,{'headers':_0x49ad42});if(!_0x117b03['ok']){if(W(_0x3c4547(0x21e)+_0x117b03[_0x3c4547(0x1fc)]+'\x20'+_0x117b03[_0x3c4547(0x218)]),_0x4d45e0=_0x4d45e0??Date[_0x3c4547(0x254)](),Date[_0x3c4547(0x254)]()-_0x4d45e0>T){W(_0x3c4547(0x232)+j+_0x3c4547(0x1fa));return;}await N(_0x5498a2),_0x5498a2=Math[_0x3c4547(0x1f3)](_0x5498a2*0x2,R);continue;}let _0x24cb18=_0x117b03[_0x3c4547(0x1f2)][_0x3c4547(0x1ff)](),_0x51e5e5=new TextDecoder(),_0x384985='';_0x5498a2=O;while(!0x0){let {done:_0x7ea129,value:_0x2db890}=await _0x24cb18[_0x3c4547(0x1e3)]();if(_0x7ea129)break;_0x384985+=_0x51e5e5[_0x3c4547(0x252)](_0x2db890,{'stream':!0x0});let _0x8309ab=_0x384985[_0x3c4547(0x1e8)]('\x0a\x0a');_0x384985=_0x8309ab[_0x3c4547(0x20b)]()||'';for(let _0x1ca0e8 of _0x8309ab){let _0x3e71fa=_0x1ca0e8['split']('\x0a')[_0x3c4547(0x212)](_0x54fd8d=>_0x54fd8d[_0x3c4547(0x204)](_0x3c4547(0x250)));if(!_0x3e71fa)continue;try{let _0x1938dd=JSON[_0x3c4547(0x209)](_0x3e71fa['slice'](0x6));if(await a(_0x1938dd),_0x1938dd[_0x3c4547(0x259)]===_0x3c4547(0x1eb)){if(_0x4d45e0=null,!_0x516807)await l();_0x516807=!0x1;}}catch(_0x4a0924){W('parse\x20error:\x20'+_0x4a0924);}}}W('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x1bbf7c){W(_0x3c4547(0x247)+_0x1bbf7c);}if(_0x4d45e0=_0x4d45e0??Date['now'](),Date[_0x3c4547(0x254)]()-_0x4d45e0>T){W(_0x3c4547(0x232)+j+')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。');return;}await N(_0x5498a2),_0x5498a2=Math['min'](_0x5498a2*0x2,R);}}async function a(_0xf6cf8e){const _0x56c118=a0_0x221966;if(_0xf6cf8e[_0x56c118(0x259)]===_0x56c118(0x1eb)){W(_0x56c118(0x233)+G+'\x22');return;}if(_0xf6cf8e['type']===_0x56c118(0x22b)){if(W('←\x20message\x20from\x20'+_0xf6cf8e['from']+':\x20'+_0xf6cf8e[_0x56c118(0x1ee)][_0x56c118(0x26c)](0x0,0x3c)),await x[_0x56c118(0x1e2)]({'method':_0x56c118(0x251),'params':{'content':_0xf6cf8e['message'],'meta':{'sender':_0xf6cf8e['from']||_0x56c118(0x260),'sender_id':_0x56c118(0x216),'user':_0xf6cf8e[_0x56c118(0x235)]||_0x56c118(0x260),'priority':_0x56c118(0x26e)}}}),_0xf6cf8e[_0x56c118(0x242)])await Y('ack_inbox',{'alias':G,'message_id':_0xf6cf8e['message_id']});return;}if(_0xf6cf8e[_0x56c118(0x259)]===_0x56c118(0x1f5)||_0xf6cf8e['type']===_0x56c118(0x255)){W('←\x20'+_0xf6cf8e[_0x56c118(0x259)]+_0x56c118(0x1df)+_0xf6cf8e[_0x56c118(0x224)]+'\x20priority='+(_0xf6cf8e[_0x56c118(0x207)]||_0x56c118(0x26e)));let _0x2b12c4=await Y(_0x56c118(0x223),{'alias':G,'limit':0x5});if(_0x2b12c4?.['ok']&&_0x2b12c4[_0x56c118(0x1fe)]?.['length']>0x0)for(let _0x5c5fd2 of _0x2b12c4[_0x56c118(0x1fe)]){let _0x1707cd={'sender':_0x5c5fd2[_0x56c118(0x263)]||_0x56c118(0x260),'sender_id':_0x56c118(0x216),'user':_0x5c5fd2[_0x56c118(0x263)]||'hub','task_id':_0x5c5fd2['id'],'priority':_0x5c5fd2['priority']||_0x56c118(0x26e)};D['set'](_0x5c5fd2['id'],_0x5c5fd2[_0x56c118(0x263)]||_0x56c118(0x260)),await x[_0x56c118(0x1e2)]({'method':_0x56c118(0x251),'params':{'content':_0x5c5fd2[_0x56c118(0x1dc)],'meta':_0x1707cd}}),W(_0x56c118(0x266)+_0x5c5fd2['id']['slice'](0x0,0x8)+_0x56c118(0x202)+_0x5c5fd2['from_session']+':\x20'+_0x5c5fd2['content']['slice'](0x0,0x3c)),await Y(_0x56c118(0x1de),{'alias':G,'message_id':_0x5c5fd2['id']});}}}async function n(){const _0x4da26e=a0_0x221966;let _0x54bc5e=new a0_0x8886fd();await x[_0x4da26e(0x20f)](_0x54bc5e),W(_0x4da26e(0x230)),W(_0x4da26e(0x234)),o()[_0x4da26e(0x222)](_0x1831e2=>W(_0x4da26e(0x1f9)+_0x1831e2)),Y('report_status',{'resume_id':K,'alias':G,'status':_0x4da26e(0x1db),'server':a0_0x47108d(),'hostname':a0_0x47108d(),'agent':_0x4da26e(0x211),'project_dir':process[_0x4da26e(0x221)](),'tmux_name':f||void 0x0})['then'](()=>W(_0x4da26e(0x23b)+G+_0x4da26e(0x1d8)+K[_0x4da26e(0x26c)](0x0,0x8)+')'))[_0x4da26e(0x222)](_0x11dd2f=>W(_0x4da26e(0x228)+_0x11dd2f)),setInterval(()=>{const _0x3d8a09=_0x4da26e;Y(_0x3d8a09(0x24d),{'resume_id':K,'alias':G,'status':_0x3d8a09(0x1db),'server':a0_0x47108d(),'hostname':a0_0x47108d(),'agent':'claude-code','project_dir':process[_0x3d8a09(0x221)](),'tmux_name':f||void 0x0})[_0x3d8a09(0x222)](_0x337418=>W(_0x3d8a09(0x21b)+_0x337418));},0x2bf20),W(_0x4da26e(0x21d));}n()[a0_0x221966(0x222)](_0xf26f1e=>{const _0x177e56=a0_0x221966;W(_0x177e56(0x23d)+_0xf26f1e),process['exit'](0x1);});function a0_0x1874(_0x3593ec,_0x3adf31){_0x3593ec=_0x3593ec-0x1d8;const _0x326282=a0_0x3262();let _0x18749e=_0x326282[_0x3593ec];return _0x18749e;}async function b(){const _0x41d9fb=a0_0x221966;W('shutting\x20down,\x20reporting\x20offline...'),await Y(_0x41d9fb(0x24d),{'resume_id':K,'alias':G,'status':_0x41d9fb(0x1e9),'task':_0x41d9fb(0x20d)})[_0x41d9fb(0x222)](()=>{}),process['exit'](0x0);}process['stdin']['on']('end',()=>b()),process['on'](a0_0x221966(0x1f1),()=>b()),process['on'](a0_0x221966(0x1da),()=>b());function a0_0x3262(){const _0x271eb9=['utf-8','initialize','slice','connecting\x20to\x20','normal','0.3.0','/mcp','\x22\x20(','pid','SIGINT','idle','content','get_all_status','ack_inbox',':\x20inbox_count=','completed','2966695aiXcGH','notification','read','task','Progress\x200-100','setRequestHandler','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','split','offline','235359gqkMpM','connected','result','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','message','alias','unknown\x20tool','SIGTERM','body','min','application/json','new_task','string','commhub_send_message','write','SSE\x20fatal:\x20',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','status','Current\x20task\x20description','messages','getReader','/events/','none','\x20from\x20','replace','startsWith','send_message','\x20/\x20hostname=','priority','490rbcfLa','parse','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','pop','error','session\x20disconnected','\x20PROJECT_ENV=','connect','commhub_reply','claude-code','find','.env','4467576Ybhlbq','unattributed-','commhub','number','statusText','commhub-channel','4798472GmtkRN','heartbeat\x20failed:\x20','cancelled','ready\x20—\x20waiting\x20for\x20events','SSE\x20error:\x20','params','delete','cwd','catch','get_inbox','inbox_count','working','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','1246280cPDohT','warning:\x20could\x20not\x20register:\x20','Target\x20session\x20alias','(none)','new_message','CommHub\x20init\x20failed:\x20','stderr','781939ukNfwS','replied','MCP\x20stdio\x20connected','.anet','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','SSE\x20connected\x20as\x20\x22','starting\x20SSE\x20listener...','from','object','stringify','failed','join','Task\x20content','registered\x20as\x20\x22','commhub_report_status','fatal:\x20','indexOf','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','tmux\x20display-message\x20-p\x20\x27#S\x27',']\x20[commhub]\x20','message_id','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','\x20RESUME_ID=','commhub_send_task','Session\x20alias:\x20','SSE\x20connection\x20error:\x20','text','blocked','78PAkmbK','http://127.0.0.1:9200','6IyhgFv','report_status','application/json,\x20text/event-stream','no\x20response','data:\x20','notifications/claude/channel','decode','toTimeString','now','broadcast','POST','in_progress','Authorization','type','144184Hoalgs','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','\x20CWD=','2.0','re-registered\x20as\x20\x22','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','hub','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','trim','from_session','commhub_get_all_status','re-register\x20failed:\x20','→\x20injected\x20task\x20','low','...\x20TMUX=','Bearer\x20'];a0_0x3262=function(){return _0x271eb9;};return a0_0x3262();}
2
+ const a0_0x169764=a0_0x42c9;(function(_0x327ba4,_0x4a616f){const _0x5c3bf0=a0_0x42c9,_0x211685=_0x327ba4();while(!![]){try{const _0x19479c=parseInt(_0x5c3bf0(0xe0))/0x1+-parseInt(_0x5c3bf0(0xab))/0x2+parseInt(_0x5c3bf0(0xc1))/0x3+parseInt(_0x5c3bf0(0xac))/0x4+-parseInt(_0x5c3bf0(0xcf))/0x5+-parseInt(_0x5c3bf0(0xa3))/0x6*(-parseInt(_0x5c3bf0(0xd2))/0x7)+parseInt(_0x5c3bf0(0xc9))/0x8*(-parseInt(_0x5c3bf0(0xd7))/0x9);if(_0x19479c===_0x4a616f)break;else _0x211685['push'](_0x211685['shift']());}catch(_0xe46404){_0x211685['push'](_0x211685['shift']());}}}(a0_0x5a85,0xe154c));import{readFileSync as a0_0x5a1017,existsSync as a0_0x2a34b4}from'fs';import{randomUUID as a0_0x4ced80}from'crypto';import{join as a0_0x146021}from'path';import{hostname as a0_0x575197}from'os';import{execSync as a0_0x438a47}from'child_process';import{Server as a0_0x1b9bca}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x1a8d1d}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x5d23bf,CallToolRequestSchema as a0_0x57f872}from'@modelcontextprotocol/sdk/types.js';function I(_0xb25dba){const _0x4c7014=a0_0x42c9;if(!a0_0x2a34b4(_0xb25dba))return;for(let _0x1df7e9 of a0_0x5a1017(_0xb25dba,_0x4c7014(0x128))[_0x4c7014(0x113)]('\x0a')){let _0x291254=_0x1df7e9[_0x4c7014(0xa2)]();if(!_0x291254||_0x291254[_0x4c7014(0x9a)]('#'))continue;let _0x2663f2=_0x291254[_0x4c7014(0xb8)]('=');if(_0x2663f2<0x0)continue;let _0x5630a5=_0x291254['slice'](0x0,_0x2663f2)['trim'](),_0x5bb3e5=_0x291254['slice'](_0x2663f2+0x1)[_0x4c7014(0xa2)]()[_0x4c7014(0x11d)](/^["']|["']$/g,'');if(!process.env[_0x5630a5])process.env[_0x5630a5]=_0x5bb3e5;}}var L=process.env.HOME||'~',U=a0_0x146021(L,'.claude/channels/commhub');I(a0_0x146021(U,'.env'));var v=process[a0_0x169764(0x115)]()[a0_0x169764(0x11d)](/\//g,'-');function a0_0x5a85(){const _0xaa7982=['toTimeString','Message\x20content','content','params','completed','\x20from\x20','ack_inbox','Target\x20session\x20alias','get','end','(none)','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','setRequestHandler','stringify','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','then','offline','\x22\x20after\x20SSE\x20reconnect','stderr','hub','SSE\x20stream\x20ended,\x20reconnecting...','from_session','find','text','normal','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','commhub_report_status','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','message','commhub_get_all_status','claude-code','task','catch','CommHub\x20init\x20failed:\x20',']\x20[commhub]\x20','unattributed-','SSE\x20connection\x20error:\x20','new_task',':\x20inbox_count=','commhub_send_message','commhub_reply','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','messages','token','split','inbox_count','cwd','warning:\x20could\x20not\x20register:\x20','alias','parse','pid',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','\x20priority=','commhub-channel','replace','commhub_send_task','ready\x20—\x20waiting\x20for\x20events','\x20ALIAS=','tmux\x20display-message\x20-p\x20\x27#S\x27','string','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','session\x20disconnected','delete','blocked','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','utf-8','failed','type','read','POST','startsWith','config.json','new_message','error','status','commhub','stdin','\x20PROJECT_ENV=','trim','6YMfPrM','application/json,\x20text/event-stream','send_task','re-registered\x20as\x20\x22','statusText','unknown\x20tool','high','MCP\x20stdio\x20connected','1341000pCofHY','5029468nfOBvz','replied','Bearer\x20','from','0.3.0','Priority\x20(default:\x20normal)','SIGTERM','starting\x20SSE\x20listener...','\x20RESUME_ID=','slice','broadcast','...\x20TMUX=','indexOf','/mcp','http://127.0.0.1:9200','idle','object','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','init\x20failed:\x20','←\x20message\x20from\x20','report_status','4649682LBocMg','now','getReader','Progress\x200-100','message_id','/events/','get_all_status','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','32359856KudkkL','shutting\x20down,\x20reporting\x20offline...','connected','.env','ENV:\x20URL=','notification','1255070GmjLEj','write','min','11576285kFwbwb','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','SSE\x20error:\x20','\x22\x20(','parse\x20error:\x20','9IaBvWB','initialize','number','priority','send_reply','→\x20injected\x20task\x20','SIGINT','send_message','no\x20response','1428436lHdxhI','Current\x20task\x20description','notifications/claude/channel','registered\x20as\x20\x22','get_inbox','length','exit'];a0_0x5a85=function(){return _0xaa7982;};return a0_0x5a85();}I(a0_0x146021(U,v,a0_0x169764(0xcc)));function d(){const _0x661be5=a0_0x169764;try{return a0_0x438a47(_0x661be5(0x121),{'encoding':_0x661be5(0x128),'timeout':0x7d0})[_0x661be5(0xa2)]();}catch{return'';}}function a0_0x42c9(_0x301b4a,_0x4127a0){_0x301b4a=_0x301b4a-0x9a;const _0x5a8566=a0_0x5a85();let _0x42c915=_0x5a8566[_0x301b4a];return _0x42c915;}function m(){const _0x3c911e=a0_0x169764;try{let _0x5ada9c=a0_0x146021(L,'.anet',_0x3c911e(0x9b));if(a0_0x2a34b4(_0x5ada9c))return JSON[_0x3c911e(0x118)](a0_0x5a1017(_0x5ada9c,_0x3c911e(0x128)));}catch{}return{};}var u=m(),j=process.env.COMMHUB_URL||u[a0_0x169764(0xfa)]||a0_0x169764(0xba),f=process.env.COMMHUB_TMUX||d();function r(){const _0x3ee428=a0_0x169764;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x3ee428(0xa2)]())return process.env.COMMHUB_ALIAS['trim']();return process[_0x3ee428(0xf9)][_0x3ee428(0xd0)]('[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20'+('would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME='+(f||_0x3ee428(0xf1))+'\x20/\x20hostname='+a0_0x575197()+'.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a')),_0x3ee428(0x10a)+process[_0x3ee428(0x119)];}var G=r(),K=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x4ced80(),F=process.env.COMMHUB_TOKEN||u[a0_0x169764(0x112)]||'';function W(_0x2d8827){const _0x15bda8=a0_0x169764;let _0x590be9=new Date()[_0x15bda8(0xe7)]()[_0x15bda8(0xb5)](0x0,0x8);process[_0x15bda8(0xf9)][_0x15bda8(0xd0)]('['+_0x590be9+_0x15bda8(0x109)+_0x2d8827+'\x0a');}function N(_0x10c462){return new Promise(_0x50131f=>setTimeout(_0x50131f,_0x10c462));}W(a0_0x169764(0xcd)+j+a0_0x169764(0x120)+G+a0_0x169764(0xb4)+K[a0_0x169764(0xb5)](0x0,0x8)+a0_0x169764(0xb7)+(f||'none')+'\x20CWD='+process[a0_0x169764(0x115)]()+a0_0x169764(0xa1)+v);var D=new Map(),x=new a0_0x1b9bca({'name':'commhub-channel','version':a0_0x169764(0xb0)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x169764(0x123),a0_0x169764(0x127),a0_0x169764(0xf2),a0_0x169764(0x100),'Session\x20alias:\x20'+G]['join']('\x0a')});x[a0_0x169764(0xf3)](a0_0x5d23bf,async()=>({'tools':[{'name':a0_0x169764(0x10f),'description':a0_0x169764(0x110),'inputSchema':{'type':a0_0x169764(0xbc),'properties':{'task_id':{'type':a0_0x169764(0x122),'description':a0_0x169764(0xf5)},'text':{'type':a0_0x169764(0x122),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x169764(0x122),'enum':['completed',a0_0x169764(0x129),'cancelled','blocked',a0_0x169764(0x9d),'in_progress'],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x169764(0xfe)]}},{'name':'commhub_report_status','description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x169764(0xbc),'properties':{'status':{'type':a0_0x169764(0x122),'enum':['working',a0_0x169764(0xbb),a0_0x169764(0x126),'error']},'task':{'type':a0_0x169764(0x122),'description':a0_0x169764(0xe1)},'progress':{'type':a0_0x169764(0xd9),'description':a0_0x169764(0xc4)}},'required':[a0_0x169764(0x9e)]}},{'name':a0_0x169764(0x11e),'description':a0_0x169764(0xc8),'inputSchema':{'type':a0_0x169764(0xbc),'properties':{'alias':{'type':a0_0x169764(0x122),'description':'Target\x20session\x20alias'},'task':{'type':'string','description':'Task\x20content'},'priority':{'type':a0_0x169764(0x122),'enum':[a0_0x169764(0xa9),'normal','low'],'description':a0_0x169764(0xb1)}},'required':['alias',a0_0x169764(0x106)]}},{'name':a0_0x169764(0x10e),'description':a0_0x169764(0xd3),'inputSchema':{'type':a0_0x169764(0xbc),'properties':{'alias':{'type':'string','description':a0_0x169764(0xee)},'message':{'type':'string','description':a0_0x169764(0xe8)}},'required':[a0_0x169764(0x117),'message']}},{'name':a0_0x169764(0x104),'description':a0_0x169764(0x102),'inputSchema':{'type':a0_0x169764(0xbc),'properties':{}}}]}));async function Y(_0x2a59bf,_0xbf9e7c){const _0x501c6b=a0_0x169764;let _0x9de75c=await fetch(j+_0x501c6b(0xb9),{'method':_0x501c6b(0x12c),'headers':{'Content-Type':'application/json','Accept':_0x501c6b(0xa4),...F?{'Authorization':'Bearer\x20'+F}:{}},'body':JSON[_0x501c6b(0xf4)]({'jsonrpc':'2.0','id':0x1,'method':_0x501c6b(0xd8),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x501c6b(0x11c),'version':_0x501c6b(0xb0)}}})});if(!_0x9de75c['ok']){let _0x57df32=await _0x9de75c[_0x501c6b(0xfe)]();return W(_0x501c6b(0x108)+_0x9de75c[_0x501c6b(0x9e)]+'\x20'+_0x57df32[_0x501c6b(0xb5)](0x0,0x64)),{'ok':!0x1,'error':_0x501c6b(0xbe)+_0x9de75c['status']};}await _0x9de75c[_0x501c6b(0xfe)]();let _0x197a33=(await(await fetch(j+'/mcp',{'method':_0x501c6b(0x12c),'headers':{'Content-Type':'application/json','Accept':_0x501c6b(0xa4),...F?{'Authorization':_0x501c6b(0xae)+F}:{}},'body':JSON[_0x501c6b(0xf4)]({'jsonrpc':'2.0','id':0x2,'method':'tools/call','params':{'name':_0x2a59bf,'arguments':_0xbf9e7c}})}))[_0x501c6b(0xfe)]())['split']('\x0a')[_0x501c6b(0xfd)](_0x14bbfc=>_0x14bbfc[_0x501c6b(0x9a)]('data:\x20'));if(_0x197a33){let _0x137e4c=JSON[_0x501c6b(0x118)](_0x197a33[_0x501c6b(0xb5)](0x6));return _0x137e4c?.['result']?.[_0x501c6b(0xe9)]?.[0x0]?.[_0x501c6b(0xfe)]?JSON[_0x501c6b(0x118)](_0x137e4c['result'][_0x501c6b(0xe9)][0x0][_0x501c6b(0xfe)]):_0x137e4c;}return{'ok':!0x1,'error':_0x501c6b(0xdf)};}x[a0_0x169764(0xf3)](a0_0x57f872,async _0x448aaa=>{const _0x48a25d=a0_0x169764;let {name:_0x5e3f29,arguments:_0x1d6c3b}=_0x448aaa[_0x48a25d(0xea)];if(_0x5e3f29===_0x48a25d(0x10f)){let {task_id:_0x562e73,text:_0xf504c5,status:_0x48386f}=_0x1d6c3b;if(_0x48386f==='completed'||_0x48386f===_0x48a25d(0x129)||_0x48386f==='cancelled'){let _0x43e32c=_0x48386f===_0x48a25d(0xeb)?_0x48a25d(0xad):_0x48386f,_0x1a6b67=_0x562e73?D[_0x48a25d(0xef)](_0x562e73)||_0x48a25d(0xfa):'hub',_0x5e5ccf=await Y(_0x48a25d(0xdb),{'alias':_0x1a6b67,'text':_0xf504c5,'in_reply_to':_0x562e73||void 0x0,'status':_0x43e32c,'from_session':G});if(_0x562e73)D[_0x48a25d(0x125)](_0x562e73);return{'content':[{'type':'text','text':JSON[_0x48a25d(0xf4)](_0x5e5ccf)}]};}let _0x53f3c7=await Y(_0x48a25d(0xc0),{'resume_id':K,'alias':G,'status':_0x48386f===_0x48a25d(0x126)?_0x48a25d(0x126):_0x48386f===_0x48a25d(0x9d)?'error':'working','task':_0xf504c5[_0x48a25d(0xb5)](0x0,0xc8),'output':_0xf504c5});return{'content':[{'type':_0x48a25d(0xfe),'text':JSON[_0x48a25d(0xf4)](_0x53f3c7)}]};}if(_0x5e3f29===_0x48a25d(0x101)){let {status:_0x545ceb,task:_0xb3d7f5,progress:_0xc46560}=_0x1d6c3b,_0x442867=await Y('report_status',{'resume_id':K,'alias':G,'status':_0x545ceb,'task':_0xb3d7f5,'progress':_0xc46560});return{'content':[{'type':_0x48a25d(0xfe),'text':JSON['stringify'](_0x442867)}]};}if(_0x5e3f29===_0x48a25d(0x11e)){let {alias:_0x295a7a,task:_0x5eb586,priority:_0x2b6c5c}=_0x1d6c3b,_0x561c10=await Y(_0x48a25d(0xa5),{'alias':_0x295a7a,'task':_0x5eb586,'priority':_0x2b6c5c||_0x48a25d(0xff),'from_session':G});return{'content':[{'type':_0x48a25d(0xfe),'text':JSON['stringify'](_0x561c10)}]};}if(_0x5e3f29===_0x48a25d(0x10e)){let {alias:_0x27333a,message:_0x30c99c}=_0x1d6c3b,_0x6e402=await Y(_0x48a25d(0xde),{'alias':_0x27333a,'message':_0x30c99c,'from_session':G});return{'content':[{'type':_0x48a25d(0xfe),'text':JSON[_0x48a25d(0xf4)](_0x6e402)}]};}if(_0x5e3f29===_0x48a25d(0x104)){let _0x552a0a=await Y(_0x48a25d(0xc7),{});return{'content':[{'type':_0x48a25d(0xfe),'text':JSON[_0x48a25d(0xf4)](_0x552a0a)}]};}return{'content':[{'type':'text','text':JSON[_0x48a25d(0xf4)]({'error':_0x48a25d(0xa8)})}]};});var O=0x3e8,R=0x7530,T=0x36ee80;async function l(){const _0x2ec2f3=a0_0x169764;try{await Y(_0x2ec2f3(0xc0),{'resume_id':K,'alias':G,'status':_0x2ec2f3(0xbb),'server':a0_0x575197(),'hostname':a0_0x575197(),'agent':_0x2ec2f3(0x105),'project_dir':process['cwd'](),'tmux_name':f||void 0x0}),W(_0x2ec2f3(0xa6)+G+_0x2ec2f3(0xf8));}catch(_0x18adb9){W('re-register\x20failed:\x20'+_0x18adb9);}}async function o(){const _0x43a809=a0_0x169764;let _0x259ed4=j+_0x43a809(0xc6)+encodeURIComponent(G),_0x2b7800={};if(F)_0x2b7800['Authorization']=_0x43a809(0xae)+F;W('connecting\x20to\x20'+_0x259ed4);let _0x2cc8c1=O,_0x451611=!0x0,_0x5d660f=null;while(!0x0){try{let _0x229c0c=await fetch(_0x259ed4,{'headers':_0x2b7800});if(!_0x229c0c['ok']){if(W(_0x43a809(0xd4)+_0x229c0c[_0x43a809(0x9e)]+'\x20'+_0x229c0c[_0x43a809(0xa7)]),_0x5d660f=_0x5d660f??Date[_0x43a809(0xc2)](),Date[_0x43a809(0xc2)]()-_0x5d660f>T){W(_0x43a809(0xbd)+j+')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。');return;}await N(_0x2cc8c1),_0x2cc8c1=Math['min'](_0x2cc8c1*0x2,R);continue;}let _0x29b042=_0x229c0c['body'][_0x43a809(0xc3)](),_0x1f8091=new TextDecoder(),_0x459d94='';_0x2cc8c1=O;while(!0x0){let {done:_0x1d2209,value:_0x181cac}=await _0x29b042[_0x43a809(0x12b)]();if(_0x1d2209)break;_0x459d94+=_0x1f8091['decode'](_0x181cac,{'stream':!0x0});let _0x194956=_0x459d94[_0x43a809(0x113)]('\x0a\x0a');_0x459d94=_0x194956['pop']()||'';for(let _0x2db864 of _0x194956){let _0x47155f=_0x2db864[_0x43a809(0x113)]('\x0a')[_0x43a809(0xfd)](_0x429771=>_0x429771[_0x43a809(0x9a)]('data:\x20'));if(!_0x47155f)continue;try{let _0x35c0e1=JSON[_0x43a809(0x118)](_0x47155f['slice'](0x6));if(await a(_0x35c0e1),_0x35c0e1['type']===_0x43a809(0xcb)){if(_0x5d660f=null,!_0x451611)await l();_0x451611=!0x1;}}catch(_0x1ea464){W(_0x43a809(0xd6)+_0x1ea464);}}}W(_0x43a809(0xfb));}catch(_0x159679){W(_0x43a809(0x10b)+_0x159679);}if(_0x5d660f=_0x5d660f??Date[_0x43a809(0xc2)](),Date['now']()-_0x5d660f>T){W(_0x43a809(0xbd)+j+_0x43a809(0x11a));return;}await N(_0x2cc8c1),_0x2cc8c1=Math[_0x43a809(0xd1)](_0x2cc8c1*0x2,R);}}async function a(_0x1a4508){const _0x54671f=a0_0x169764;if(_0x1a4508['type']==='connected'){W('SSE\x20connected\x20as\x20\x22'+G+'\x22');return;}if(_0x1a4508[_0x54671f(0x12a)]===_0x54671f(0x9c)){if(W(_0x54671f(0xbf)+_0x1a4508[_0x54671f(0xaf)]+':\x20'+_0x1a4508[_0x54671f(0x103)][_0x54671f(0xb5)](0x0,0x3c)),await x[_0x54671f(0xce)]({'method':'notifications/claude/channel','params':{'content':_0x1a4508[_0x54671f(0x103)],'meta':{'sender':_0x1a4508['from']||_0x54671f(0xfa),'sender_id':_0x54671f(0x9f),'user':_0x1a4508[_0x54671f(0xaf)]||_0x54671f(0xfa),'priority':_0x54671f(0xff)}}}),_0x1a4508['message_id'])await Y(_0x54671f(0xed),{'alias':G,'message_id':_0x1a4508[_0x54671f(0xc5)]});return;}if(_0x1a4508['type']===_0x54671f(0x10c)||_0x1a4508['type']===_0x54671f(0xb6)){W('←\x20'+_0x1a4508[_0x54671f(0x12a)]+_0x54671f(0x10d)+_0x1a4508[_0x54671f(0x114)]+_0x54671f(0x11b)+(_0x1a4508[_0x54671f(0xda)]||_0x54671f(0xff)));let _0x433912=await Y(_0x54671f(0xe4),{'alias':G,'limit':0x5});if(_0x433912?.['ok']&&_0x433912[_0x54671f(0x111)]?.[_0x54671f(0xe5)]>0x0)for(let _0x74210a of _0x433912['messages']){let _0x35c9cd={'sender':_0x74210a[_0x54671f(0xfc)]||_0x54671f(0xfa),'sender_id':_0x54671f(0x9f),'user':_0x74210a[_0x54671f(0xfc)]||_0x54671f(0xfa),'task_id':_0x74210a['id'],'priority':_0x74210a['priority']||_0x54671f(0xff)};D['set'](_0x74210a['id'],_0x74210a[_0x54671f(0xfc)]||_0x54671f(0xfa)),await x[_0x54671f(0xce)]({'method':_0x54671f(0xe2),'params':{'content':_0x74210a[_0x54671f(0xe9)],'meta':_0x35c9cd}}),W(_0x54671f(0xdc)+_0x74210a['id'][_0x54671f(0xb5)](0x0,0x8)+_0x54671f(0xec)+_0x74210a[_0x54671f(0xfc)]+':\x20'+_0x74210a[_0x54671f(0xe9)][_0x54671f(0xb5)](0x0,0x3c)),await Y(_0x54671f(0xed),{'alias':G,'message_id':_0x74210a['id']});}}}async function n(){const _0x25b3ed=a0_0x169764;let _0x53d217=new a0_0x1a8d1d();await x['connect'](_0x53d217),W(_0x25b3ed(0xaa)),W(_0x25b3ed(0xb3)),o()[_0x25b3ed(0x107)](_0x5b7808=>W('SSE\x20fatal:\x20'+_0x5b7808)),Y('report_status',{'resume_id':K,'alias':G,'status':_0x25b3ed(0xbb),'server':a0_0x575197(),'hostname':a0_0x575197(),'agent':_0x25b3ed(0x105),'project_dir':process[_0x25b3ed(0x115)](),'tmux_name':f||void 0x0})[_0x25b3ed(0xf6)](()=>W(_0x25b3ed(0xe3)+G+_0x25b3ed(0xd5)+K[_0x25b3ed(0xb5)](0x0,0x8)+')'))[_0x25b3ed(0x107)](_0x3246f8=>W(_0x25b3ed(0x116)+_0x3246f8)),setInterval(()=>{const _0x5352e3=_0x25b3ed;Y(_0x5352e3(0xc0),{'resume_id':K,'alias':G,'status':_0x5352e3(0xbb),'server':a0_0x575197(),'hostname':a0_0x575197(),'agent':_0x5352e3(0x105),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x5352e3(0x107)](_0x3f9a5e=>W('heartbeat\x20failed:\x20'+_0x3f9a5e));},0x2bf20),W(_0x25b3ed(0x11f));}n()['catch'](_0x559265=>{W('fatal:\x20'+_0x559265),process['exit'](0x1);});async function b(){const _0x435ad9=a0_0x169764;W(_0x435ad9(0xca)),await Y(_0x435ad9(0xc0),{'resume_id':K,'alias':G,'status':_0x435ad9(0xf7),'task':_0x435ad9(0x124)})[_0x435ad9(0x107)](()=>{}),process[_0x435ad9(0xe6)](0x0);}process[a0_0x169764(0xa0)]['on'](a0_0x169764(0xf0),()=>b()),process['on'](a0_0x169764(0xb2),()=>b()),process['on'](a0_0x169764(0xdd),()=>b());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.2.15-preview.0",
3
+ "version": "2.2.16-preview.0",
4
4
  "description": "AI Agent Network CLI — Local-first multi-agent orchestration across 4 runtimes (Claude Code CLI / Claude Agent SDK / Codex SDK / Grok Build ACP) and 8+ LLM providers (Anthropic / OpenAI / xAI Grok / MiniMax / DeepSeek / GLM / Kimi / InternLM / Xiaomi MiMo / OpenRouter). Apache 2.0.",
5
5
  "type": "module",
6
6
  "main": "dist/src/client.js",