@sleep2agi/agent-network 2.2.15 → 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
- function a0_0x5ac1(){const _0x46880d=['91452UQVlGM','27864piDHSO','2.0','messages','reply','report_status','getAllStatus','offline','catch','heartbeatTimer','abort','825mNGIKx','normal','text/event-stream','autoConnect','send','toTimeString','completed','min','sleep','reconnectDelay',']\x20[commhub:','application/json,\x20text/event-stream','sseAbort','alias','5CaMrRH','get_all_status','/events/','signal','from_session','send_message','resumeId','log','new_task','toString','running','startsWith','connectSSE','Authorization','get_inbox','connect','type','AbortError','disconnect','cwd','tools/call','url','read','heartbeatInterval','disconnected','agent','5072940QdhEiM','content','4koxLXO','split','80187Duhwik','processInbox','pop','server','text','8561iyTTIk','sdk','status','new_message','result','Bearer\x20','broadcast','SSE\x20failed:\x20','application/json','slice','getReader','emit','idle','stringify','call','body','task','decode','1937028kcGWEA','s...','token','inbox\x20error:\x20','parse','send_task','SSE\x20connected','POST','1662zyHNUF','message','209696mdKEYT','99xzYMum','connected'];a0_0x5ac1=function(){return _0x46880d;};return a0_0x5ac1();}const a0_0x456b67=a0_0x4483;(function(_0x3fa3bd,_0x2822b8){const _0x15c65c=a0_0x4483,_0x45740f=_0x3fa3bd();while(!![]){try{const _0x4a322c=-parseInt(_0x15c65c(0x12a))/0x1*(-parseInt(_0x15c65c(0xf2))/0x2)+-parseInt(_0x15c65c(0x12c))/0x3+-parseInt(_0x15c65c(0xe8))/0x4*(parseInt(_0x15c65c(0x10e))/0x5)+-parseInt(_0x15c65c(0xf0))/0x6*(-parseInt(_0x15c65c(0x131))/0x7)+parseInt(_0x15c65c(0xf6))/0x8*(parseInt(_0x15c65c(0xf3))/0x9)+-parseInt(_0x15c65c(0x128))/0xa+parseInt(_0x15c65c(0x100))/0xb*(parseInt(_0x15c65c(0xf5))/0xc);if(_0x4a322c===_0x2822b8)break;else _0x45740f['push'](_0x45740f['shift']());}catch(_0x4482f5){_0x45740f['push'](_0x45740f['shift']());}}}(a0_0x5ac1,0x5564b));import{EventEmitter as a0_0x30df08}from'events';function a0_0x4483(_0x19d047,_0x2819e2){_0x19d047=_0x19d047-0xe7;const _0x5ac176=a0_0x5ac1();let _0x4483c1=_0x5ac176[_0x19d047];return _0x4483c1;}import{hostname as a0_0x9d7115}from'os';class T extends a0_0x30df08{[a0_0x456b67(0x123)];[a0_0x456b67(0x10d)];['token'];['agent'];[a0_0x456b67(0x114)];[a0_0x456b67(0x125)];[a0_0x456b67(0x109)];[a0_0x456b67(0xfe)];[a0_0x456b67(0x10c)];['running']=!0x1;constructor(_0x4a0d37){const _0x3ffab7=a0_0x456b67;super();if(this[_0x3ffab7(0x123)]=_0x4a0d37['url']['replace'](/\/$/,''),this[_0x3ffab7(0x10d)]=_0x4a0d37[_0x3ffab7(0x10d)],this['token']=_0x4a0d37[_0x3ffab7(0xea)],this[_0x3ffab7(0x127)]=_0x4a0d37[_0x3ffab7(0x127)]||_0x3ffab7(0x132),this[_0x3ffab7(0x114)]='sdk-'+_0x4a0d37['alias']+'-'+Date['now']()[_0x3ffab7(0x117)](0x24),this[_0x3ffab7(0x125)]=_0x4a0d37['heartbeatInterval']??0x2bf20,this[_0x3ffab7(0x109)]=_0x4a0d37[_0x3ffab7(0x109)]??0xbb8,_0x4a0d37[_0x3ffab7(0x103)]!==!0x1)this[_0x3ffab7(0x11d)]();}['log'](_0x1dc373){const _0x45ad68=a0_0x456b67;console[_0x45ad68(0x115)]('['+new Date()[_0x45ad68(0x105)]()[_0x45ad68(0x13a)](0x0,0x8)+_0x45ad68(0x10a)+this[_0x45ad68(0x10d)]+']\x20'+_0x1dc373);}async[a0_0x456b67(0x13f)](_0x376e61,_0x14bccb){const _0x2e927f=a0_0x456b67;let _0x440093={'Content-Type':_0x2e927f(0x139),'Accept':_0x2e927f(0x10b)};if(this[_0x2e927f(0xea)])_0x440093['Authorization']=_0x2e927f(0x136)+this[_0x2e927f(0xea)];let _0x538547=await(await fetch(this['url']+'/mcp',{'method':_0x2e927f(0xef),'headers':_0x440093,'body':JSON[_0x2e927f(0x13e)]({'jsonrpc':_0x2e927f(0xf7),'id':Date['now'](),'method':_0x2e927f(0x122),'params':{'name':_0x376e61,'arguments':_0x14bccb}})}))[_0x2e927f(0x130)](),_0x50f77b=_0x538547['match'](/data: (.+)/),_0x2dbd61=_0x50f77b?JSON[_0x2e927f(0xec)](_0x50f77b[0x1]):JSON[_0x2e927f(0xec)](_0x538547),_0x4769f1=_0x2dbd61?.[_0x2e927f(0x135)]?.['content']?.[0x0]?.['text'];return _0x4769f1?JSON[_0x2e927f(0xec)](_0x4769f1):_0x2dbd61;}async[a0_0x456b67(0x11d)](){const _0x1706b5=a0_0x456b67;if(this[_0x1706b5(0x118)])return;this[_0x1706b5(0x118)]=!0x0,await this['status']('idle'),this['log']('registered'),this[_0x1706b5(0xfe)]=setInterval(()=>{const _0x9df62f=_0x1706b5;this[_0x9df62f(0x133)](_0x9df62f(0x13d))[_0x9df62f(0xfd)](_0x1d3ea3=>this[_0x9df62f(0x115)]('heartbeat\x20failed:\x20'+_0x1d3ea3[_0x9df62f(0xf1)]));},this[_0x1706b5(0x125)]),this[_0x1706b5(0x11a)]();}async[a0_0x456b67(0x120)](){const _0x5effeb=a0_0x456b67;if(this[_0x5effeb(0x118)]=!0x1,this[_0x5effeb(0x10c)]?.[_0x5effeb(0xff)](),this[_0x5effeb(0xfe)])clearInterval(this[_0x5effeb(0xfe)]);await this['status'](_0x5effeb(0xfc))[_0x5effeb(0xfd)](()=>{}),this[_0x5effeb(0x115)](_0x5effeb(0x126));}async[a0_0x456b67(0x104)](_0x14efab,_0x268039,_0x432f22=a0_0x456b67(0x101)){const _0x338c8d=a0_0x456b67;return this[_0x338c8d(0x13f)](_0x338c8d(0xed),{'alias':_0x14efab,'task':_0x268039,'priority':_0x432f22,'from_session':this[_0x338c8d(0x10d)]});}async['message'](_0x62d5d4,_0x4916e3){const _0x49b2f0=a0_0x456b67;return this[_0x49b2f0(0x13f)](_0x49b2f0(0x113),{'alias':_0x62d5d4,'message':_0x4916e3,'from_session':this[_0x49b2f0(0x10d)]});}async[a0_0x456b67(0xf9)](_0x279bdf,_0x4a9b51,_0x567f4a=a0_0x456b67(0x106)){const _0x29699d=a0_0x456b67;return this[_0x29699d(0x13f)]('send_reply',{'in_reply_to':_0x279bdf,'text':_0x4a9b51,'status':_0x567f4a});}async[a0_0x456b67(0x133)](_0xafb762,_0x11a4f3){const _0x52e22c=a0_0x456b67;return this[_0x52e22c(0x13f)](_0x52e22c(0xfa),{'resume_id':this[_0x52e22c(0x114)],'alias':this['alias'],'status':_0xafb762,'server':a0_0x9d7115(),'hostname':a0_0x9d7115(),'agent':this[_0x52e22c(0x127)],'project_dir':process[_0x52e22c(0x121)](),..._0x11a4f3});}async[a0_0x456b67(0xfb)](){const _0x1d711d=a0_0x456b67;return this['call'](_0x1d711d(0x10f),{});}async['broadcast'](_0x24e632,_0x4922fc){const _0x3baedf=a0_0x456b67;return this[_0x3baedf(0x13f)]('broadcast',{'message':_0x24e632,'filter_server':_0x4922fc?.[_0x3baedf(0x12f)],'filter_status':_0x4922fc?.[_0x3baedf(0x133)]});}async[a0_0x456b67(0x11a)](){const _0x54c72e=a0_0x456b67;let _0x40c0bf=encodeURIComponent(this[_0x54c72e(0x10d)]),_0x123399=this['url']+_0x54c72e(0x110)+_0x40c0bf,_0x351fe9=this[_0x54c72e(0x109)];while(this[_0x54c72e(0x118)]){try{this[_0x54c72e(0x10c)]=new AbortController();let _0x312a77={'Accept':_0x54c72e(0x102)};if(this['token'])_0x312a77[_0x54c72e(0x11b)]='Bearer\x20'+this[_0x54c72e(0xea)];let _0x3750d8=await fetch(_0x123399,{'headers':_0x312a77,'signal':this['sseAbort'][_0x54c72e(0x111)]});if(!_0x3750d8['ok']||!_0x3750d8[_0x54c72e(0x140)]){this['log'](_0x54c72e(0x138)+_0x3750d8[_0x54c72e(0x133)]),await this['sleep'](_0x351fe9),_0x351fe9=Math[_0x54c72e(0x107)](_0x351fe9*1.5,0xea60);continue;}_0x351fe9=this[_0x54c72e(0x109)];let _0x2ff604=_0x3750d8[_0x54c72e(0x140)][_0x54c72e(0x13b)](),_0xe5a4e2=new TextDecoder(),_0x3749cd='';while(this[_0x54c72e(0x118)]){let {done:_0x14187f,value:_0x2e8550}=await _0x2ff604[_0x54c72e(0x124)]();if(_0x14187f)break;_0x3749cd+=_0xe5a4e2[_0x54c72e(0xe7)](_0x2e8550,{'stream':!0x0});let _0x319332=_0x3749cd[_0x54c72e(0x12b)]('\x0a');_0x3749cd=_0x319332[_0x54c72e(0x12e)]()||'';for(let _0x3d4d17 of _0x319332){if(!_0x3d4d17[_0x54c72e(0x119)]('data:\x20'))continue;try{let _0x2c9272=JSON['parse'](_0x3d4d17[_0x54c72e(0x13a)](0x6));if(_0x2c9272['type']===_0x54c72e(0xf4)){this['log'](_0x54c72e(0xee)),this[_0x54c72e(0x13c)](_0x54c72e(0xf4));continue;}if(_0x2c9272[_0x54c72e(0x11e)]===_0x54c72e(0x116)||_0x2c9272['type']===_0x54c72e(0x134)||_0x2c9272[_0x54c72e(0x11e)]===_0x54c72e(0x137))await this[_0x54c72e(0x12d)]();}catch{}}}}catch(_0x118f3f){if(_0x118f3f['name']===_0x54c72e(0x11f))break;this[_0x54c72e(0x13c)]('error',_0x118f3f),this[_0x54c72e(0x115)]('SSE\x20error:\x20'+_0x118f3f['message']);}if(this[_0x54c72e(0x118)])this[_0x54c72e(0x13c)](_0x54c72e(0x126)),this[_0x54c72e(0x115)]('SSE\x20reconnecting\x20in\x20'+_0x351fe9/0x3e8+_0x54c72e(0xe9)),await this[_0x54c72e(0x108)](_0x351fe9),_0x351fe9=Math[_0x54c72e(0x107)](_0x351fe9*1.5,0xea60);}}async[a0_0x456b67(0x12d)](){const _0x249930=a0_0x456b67;try{let _0x18e86e=(await this[_0x249930(0x13f)](_0x249930(0x11c),{'alias':this[_0x249930(0x10d)],'limit':0xa}))?.[_0x249930(0xf8)]||[];for(let _0x364109 of _0x18e86e)await this[_0x249930(0x13f)]('ack_inbox',{'alias':this[_0x249930(0x10d)],'message_id':_0x364109['id']}),this[_0x249930(0x115)]('←\x20'+_0x364109[_0x249930(0x112)]+':\x20'+_0x364109[_0x249930(0x129)][_0x249930(0x13a)](0x0,0x3c)),this[_0x249930(0x13c)](_0x249930(0x141),_0x364109),this[_0x249930(0x13c)](_0x249930(0xf1),_0x364109);}catch(_0x92bd7f){this[_0x249930(0x115)](_0x249930(0xeb)+_0x92bd7f[_0x249930(0xf1)]);}}[a0_0x456b67(0x108)](_0x3a8380){return new Promise(_0x1acf6c=>setTimeout(_0x1acf6c,_0x3a8380));}}var $=T;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_0xbc12a8=a0_0x12a6;(function(_0x7b66a7,_0x26b604){const _0x4f147a=a0_0x12a6,_0x3471ff=_0x7b66a7();while(!![]){try{const _0x1a07e9=parseInt(_0x4f147a(0x111))/0x1+-parseInt(_0x4f147a(0xd4))/0x2*(-parseInt(_0x4f147a(0x120))/0x3)+parseInt(_0x4f147a(0x146))/0x4+-parseInt(_0x4f147a(0x141))/0x5+-parseInt(_0x4f147a(0xe0))/0x6+-parseInt(_0x4f147a(0x145))/0x7*(parseInt(_0x4f147a(0x11f))/0x8)+parseInt(_0x4f147a(0x12f))/0x9*(-parseInt(_0x4f147a(0x124))/0xa);if(_0x1a07e9===_0x26b604)break;else _0x3471ff['push'](_0x3471ff['shift']());}catch(_0x4397b6){_0x3471ff['push'](_0x3471ff['shift']());}}}(a0_0x2c35,0x92bc9));import{readFileSync as a0_0x343f9a,existsSync as a0_0x113b8d}from'fs';import{randomUUID as a0_0x30f7fa}from'crypto';import{join as a0_0x22935a}from'path';import{hostname as a0_0x7dc3e9}from'os';import{execSync as a0_0x158e47}from'child_process';function a0_0x2c35(){const _0x1b0ef2=['claude-code',':\x20inbox_count=','message','warning:\x20could\x20not\x20register:\x20','\x20ALIAS=','alias','text','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','645418lOUWQO','high','ENV:\x20URL=','getReader','tmux\x20display-message\x20-p\x20\x27#S\x27','pid','connect','from_session','/mcp','report_status','broadcast','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','(none)','unknown\x20tool','2370496khMzWk','6486odrSql','messages','split','startsWith','10eIAftC','write','application/json','initialize','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','Target\x20session\x20alias','→\x20injected\x20task\x20','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','SIGINT','\x22\x20after\x20SSE\x20reconnect','2944206vEqRVC','2.0','content','delete','commhub-channel','hub','number','SSE\x20connected\x20as\x20\x22','parse\x20error:\x20','blocked','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','decode','[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20','commhub_get_all_status','registered\x20as\x20\x22','\x20priority=','cancelled','\x20/\x20hostname=','2970385erLOZE','shutting\x20down,\x20reporting\x20offline...','idle','send_message','7UiZEfh','4469252ZihHgc','commhub','config.json','notifications/claude/channel','exit','get_inbox','token','SIGTERM','\x20PROJECT_ENV=','←\x20message\x20from\x20','min','slice','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','\x22\x20(','SSE\x20fatal:\x20','fatal:\x20','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','type','Bearer\x20','task','/events/','commhub_reply','commhub_send_message','low','tools/call','status','commhub_report_status','now','init\x20failed:\x20','from','data:\x20','in_progress','212adDbiI','http://127.0.0.1:9200','join','working','commhub_send_task','2025-03-26','message_id','length','send_reply','indexOf','re-registered\x20as\x20\x22','new_message','1040082dJtHWm','error','stringify','application/json,\x20text/event-stream','connecting\x20to\x20','result','Priority\x20(default:\x20normal)','\x20RESUME_ID=','unattributed-','cwd','re-register\x20failed:\x20','replace','read','replied','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','string','Session\x20alias:\x20','notification','normal','catch','inbox_count','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','session\x20disconnected','0.3.0','trim','stderr','then','object','SSE\x20connection\x20error:\x20','get_all_status','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','\x20CWD=','connected','utf-8','priority','completed','POST','ack_inbox','MCP\x20stdio\x20connected','parse'];a0_0x2c35=function(){return _0x1b0ef2;};return a0_0x2c35();}function a0_0x12a6(_0x2b1df8,_0x508de8){_0x2b1df8=_0x2b1df8-0xd2;const _0x2c353a=a0_0x2c35();let _0x12a619=_0x2c353a[_0x2b1df8];return _0x12a619;}import{Server as a0_0x2337e6}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x29f2d5}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x5d1613,CallToolRequestSchema as a0_0x8c2c49}from'@modelcontextprotocol/sdk/types.js';function I(_0x1ffc03){const _0x15d5e0=a0_0x12a6;if(!a0_0x113b8d(_0x1ffc03))return;for(let _0x3892d2 of a0_0x343f9a(_0x1ffc03,_0x15d5e0(0x102))['split']('\x0a')){let _0x5be96a=_0x3892d2[_0x15d5e0(0xf9)]();if(!_0x5be96a||_0x5be96a[_0x15d5e0(0x123)]('#'))continue;let _0x3c73de=_0x5be96a[_0x15d5e0(0xdd)]('=');if(_0x3c73de<0x0)continue;let _0x3c2e2c=_0x5be96a['slice'](0x0,_0x3c73de)[_0x15d5e0(0xf9)](),_0x32e9df=_0x5be96a[_0x15d5e0(0x151)](_0x3c73de+0x1)[_0x15d5e0(0xf9)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x3c2e2c])process.env[_0x3c2e2c]=_0x32e9df;}}var L=process.env.HOME||'~',U=a0_0x22935a(L,'.claude/channels/commhub');I(a0_0x22935a(U,'.env'));var v=process[a0_0xbc12a8(0xe9)]()[a0_0xbc12a8(0xeb)](/\//g,'-');I(a0_0x22935a(U,v,'.env'));function d(){const _0x50ce0c=a0_0xbc12a8;try{return a0_0x158e47(_0x50ce0c(0x115),{'encoding':'utf-8','timeout':0x7d0})[_0x50ce0c(0xf9)]();}catch{return'';}}function m(){const _0x235854=a0_0xbc12a8;try{let _0x52570f=a0_0x22935a(L,'.anet',_0x235854(0x148));if(a0_0x113b8d(_0x52570f))return JSON['parse'](a0_0x343f9a(_0x52570f,_0x235854(0x102)));}catch{}return{};}var u=m(),j=process.env.COMMHUB_URL||u[a0_0xbc12a8(0x134)]||a0_0xbc12a8(0xd5),f=process.env.COMMHUB_TMUX||d();function r(){const _0xd84c83=a0_0xbc12a8;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0xd84c83(0xf9)]())return process.env.COMMHUB_ALIAS[_0xd84c83(0xf9)]();return process[_0xd84c83(0xfa)][_0xd84c83(0x125)](_0xd84c83(0x13b)+(_0xd84c83(0x110)+(f||_0xd84c83(0x11d))+_0xd84c83(0x140)+a0_0x7dc3e9()+_0xd84c83(0x11c))),_0xd84c83(0xe8)+process[_0xd84c83(0x116)];}var G=r(),K=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x30f7fa(),F=process.env.COMMHUB_TOKEN||u[a0_0xbc12a8(0x14c)]||'';function W(_0x13238d){const _0x1bdc80=a0_0xbc12a8;let _0x484f87=new Date()['toTimeString']()[_0x1bdc80(0x151)](0x0,0x8);process[_0x1bdc80(0xfa)][_0x1bdc80(0x125)]('['+_0x484f87+']\x20[commhub]\x20'+_0x13238d+'\x0a');}function N(_0x24a787){return new Promise(_0x485214=>setTimeout(_0x485214,_0x24a787));}W(a0_0xbc12a8(0x113)+j+a0_0xbc12a8(0x10d)+G+a0_0xbc12a8(0xe7)+K[a0_0xbc12a8(0x151)](0x0,0x8)+'...\x20TMUX='+(f||'none')+a0_0xbc12a8(0x100)+process[a0_0xbc12a8(0xe9)]()+a0_0xbc12a8(0x14e)+v);var D=new Map(),x=new a0_0x2337e6({'name':a0_0xbc12a8(0x133),'version':a0_0xbc12a8(0xf8)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0xbc12a8(0x12c),a0_0xbc12a8(0x156),a0_0xbc12a8(0x139),a0_0xbc12a8(0xee),a0_0xbc12a8(0xf0)+G][a0_0xbc12a8(0xd6)]('\x0a')});x['setRequestHandler'](a0_0x5d1613,async()=>({'tools':[{'name':a0_0xbc12a8(0x15b),'description':a0_0xbc12a8(0x152),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0xbc12a8(0xef),'description':a0_0xbc12a8(0xf5)},'text':{'type':'string','description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0xbc12a8(0xef),'enum':[a0_0xbc12a8(0x104),'failed',a0_0xbc12a8(0x13f),'blocked','error',a0_0xbc12a8(0xd3)],'description':a0_0xbc12a8(0x12b)}},'required':['text']}},{'name':a0_0xbc12a8(0x160),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':'object','properties':{'status':{'type':a0_0xbc12a8(0xef),'enum':[a0_0xbc12a8(0xd7),a0_0xbc12a8(0x143),a0_0xbc12a8(0x138),a0_0xbc12a8(0xe1)]},'task':{'type':a0_0xbc12a8(0xef),'description':'Current\x20task\x20description'},'progress':{'type':a0_0xbc12a8(0x135),'description':'Progress\x200-100'}},'required':[a0_0xbc12a8(0x15f)]}},{'name':a0_0xbc12a8(0xd8),'description':a0_0xbc12a8(0xff),'inputSchema':{'type':a0_0xbc12a8(0xfc),'properties':{'alias':{'type':a0_0xbc12a8(0xef),'description':a0_0xbc12a8(0x129)},'task':{'type':a0_0xbc12a8(0xef),'description':'Task\x20content'},'priority':{'type':'string','enum':[a0_0xbc12a8(0x112),a0_0xbc12a8(0xf2),a0_0xbc12a8(0x15d)],'description':a0_0xbc12a8(0xe6)}},'required':[a0_0xbc12a8(0x10e),a0_0xbc12a8(0x159)]}},{'name':a0_0xbc12a8(0x15c),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0xbc12a8(0xfc),'properties':{'alias':{'type':'string','description':a0_0xbc12a8(0x129)},'message':{'type':a0_0xbc12a8(0xef),'description':'Message\x20content'}},'required':['alias',a0_0xbc12a8(0x10b)]}},{'name':a0_0xbc12a8(0x13c),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':'object','properties':{}}}]}));async function Y(_0x19f6f0,_0x2bdb3e){const _0x5dab7d=a0_0xbc12a8;let _0x411506=await fetch(j+_0x5dab7d(0x119),{'method':'POST','headers':{'Content-Type':_0x5dab7d(0x126),'Accept':_0x5dab7d(0xe3),...F?{'Authorization':'Bearer\x20'+F}:{}},'body':JSON['stringify']({'jsonrpc':_0x5dab7d(0x130),'id':0x1,'method':_0x5dab7d(0x127),'params':{'protocolVersion':_0x5dab7d(0xd9),'capabilities':{},'clientInfo':{'name':_0x5dab7d(0x133),'version':_0x5dab7d(0xf8)}}})});if(!_0x411506['ok']){let _0x27bc72=await _0x411506[_0x5dab7d(0x10f)]();return W('CommHub\x20init\x20failed:\x20'+_0x411506[_0x5dab7d(0x15f)]+'\x20'+_0x27bc72[_0x5dab7d(0x151)](0x0,0x64)),{'ok':!0x1,'error':_0x5dab7d(0x162)+_0x411506[_0x5dab7d(0x15f)]};}await _0x411506[_0x5dab7d(0x10f)]();let _0x50fdab=(await(await fetch(j+_0x5dab7d(0x119),{'method':_0x5dab7d(0x105),'headers':{'Content-Type':_0x5dab7d(0x126),'Accept':_0x5dab7d(0xe3),...F?{'Authorization':_0x5dab7d(0x158)+F}:{}},'body':JSON[_0x5dab7d(0xe2)]({'jsonrpc':_0x5dab7d(0x130),'id':0x2,'method':_0x5dab7d(0x15e),'params':{'name':_0x19f6f0,'arguments':_0x2bdb3e}})}))[_0x5dab7d(0x10f)]())[_0x5dab7d(0x122)]('\x0a')['find'](_0x2919d8=>_0x2919d8[_0x5dab7d(0x123)](_0x5dab7d(0xd2)));if(_0x50fdab){let _0x598431=JSON[_0x5dab7d(0x108)](_0x50fdab[_0x5dab7d(0x151)](0x6));return _0x598431?.[_0x5dab7d(0xe5)]?.[_0x5dab7d(0x131)]?.[0x0]?.[_0x5dab7d(0x10f)]?JSON[_0x5dab7d(0x108)](_0x598431[_0x5dab7d(0xe5)]['content'][0x0][_0x5dab7d(0x10f)]):_0x598431;}return{'ok':!0x1,'error':'no\x20response'};}x['setRequestHandler'](a0_0x8c2c49,async _0x37f8ef=>{const _0x58af6e=a0_0xbc12a8;let {name:_0x2915a8,arguments:_0xcd690}=_0x37f8ef['params'];if(_0x2915a8===_0x58af6e(0x15b)){let {task_id:_0xc85256,text:_0x469597,status:_0xbb9471}=_0xcd690;if(_0xbb9471===_0x58af6e(0x104)||_0xbb9471==='failed'||_0xbb9471==='cancelled'){let _0x3ed64b=_0xbb9471==='completed'?_0x58af6e(0xed):_0xbb9471,_0x39b8af=_0xc85256?D['get'](_0xc85256)||_0x58af6e(0x134):_0x58af6e(0x134),_0x1cb329=await Y(_0x58af6e(0xdc),{'alias':_0x39b8af,'text':_0x469597,'in_reply_to':_0xc85256||void 0x0,'status':_0x3ed64b,'from_session':G});if(_0xc85256)D[_0x58af6e(0x132)](_0xc85256);return{'content':[{'type':_0x58af6e(0x10f),'text':JSON[_0x58af6e(0xe2)](_0x1cb329)}]};}let _0x2ef53a=await Y(_0x58af6e(0x11a),{'resume_id':K,'alias':G,'status':_0xbb9471===_0x58af6e(0x138)?_0x58af6e(0x138):_0xbb9471==='error'?_0x58af6e(0xe1):'working','task':_0x469597['slice'](0x0,0xc8),'output':_0x469597});return{'content':[{'type':_0x58af6e(0x10f),'text':JSON[_0x58af6e(0xe2)](_0x2ef53a)}]};}if(_0x2915a8===_0x58af6e(0x160)){let {status:_0x51918b,task:_0x48adb7,progress:_0x29c5f8}=_0xcd690,_0x52a736=await Y(_0x58af6e(0x11a),{'resume_id':K,'alias':G,'status':_0x51918b,'task':_0x48adb7,'progress':_0x29c5f8});return{'content':[{'type':_0x58af6e(0x10f),'text':JSON['stringify'](_0x52a736)}]};}if(_0x2915a8===_0x58af6e(0xd8)){let {alias:_0x5f1381,task:_0x47be88,priority:_0x545187}=_0xcd690,_0x4a1750=await Y('send_task',{'alias':_0x5f1381,'task':_0x47be88,'priority':_0x545187||_0x58af6e(0xf2),'from_session':G});return{'content':[{'type':_0x58af6e(0x10f),'text':JSON['stringify'](_0x4a1750)}]};}if(_0x2915a8==='commhub_send_message'){let {alias:_0x29f6f4,message:_0x552d5f}=_0xcd690,_0x345445=await Y(_0x58af6e(0x144),{'alias':_0x29f6f4,'message':_0x552d5f,'from_session':G});return{'content':[{'type':_0x58af6e(0x10f),'text':JSON[_0x58af6e(0xe2)](_0x345445)}]};}if(_0x2915a8===_0x58af6e(0x13c)){let _0x43bc93=await Y(_0x58af6e(0xfe),{});return{'content':[{'type':_0x58af6e(0x10f),'text':JSON[_0x58af6e(0xe2)](_0x43bc93)}]};}return{'content':[{'type':_0x58af6e(0x10f),'text':JSON['stringify']({'error':_0x58af6e(0x11e)})}]};});var O=0x3e8,R=0x7530,T=0x36ee80;async function l(){const _0x5c4c14=a0_0xbc12a8;try{await Y(_0x5c4c14(0x11a),{'resume_id':K,'alias':G,'status':_0x5c4c14(0x143),'server':a0_0x7dc3e9(),'hostname':a0_0x7dc3e9(),'agent':_0x5c4c14(0x109),'project_dir':process[_0x5c4c14(0xe9)](),'tmux_name':f||void 0x0}),W(_0x5c4c14(0xde)+G+_0x5c4c14(0x12e));}catch(_0x40abb4){W(_0x5c4c14(0xea)+_0x40abb4);}}async function o(){const _0x475519=a0_0xbc12a8;let _0x641f44=j+_0x475519(0x15a)+encodeURIComponent(G),_0x1e9aba={};if(F)_0x1e9aba['Authorization']=_0x475519(0x158)+F;W(_0x475519(0xe4)+_0x641f44);let _0x1783ef=O,_0x3c79b2=!0x0,_0x4db6e8=null;while(!0x0){try{let _0x2dd120=await fetch(_0x641f44,{'headers':_0x1e9aba});if(!_0x2dd120['ok']){if(W('SSE\x20error:\x20'+_0x2dd120[_0x475519(0x15f)]+'\x20'+_0x2dd120['statusText']),_0x4db6e8=_0x4db6e8??Date[_0x475519(0x161)](),Date['now']()-_0x4db6e8>T){W(_0x475519(0x128)+j+_0x475519(0xf6));return;}await N(_0x1783ef),_0x1783ef=Math['min'](_0x1783ef*0x2,R);continue;}let _0x4f2450=_0x2dd120['body'][_0x475519(0x114)](),_0x4ae23b=new TextDecoder(),_0x6167d2='';_0x1783ef=O;while(!0x0){let {done:_0x39bc7c,value:_0x384f30}=await _0x4f2450[_0x475519(0xec)]();if(_0x39bc7c)break;_0x6167d2+=_0x4ae23b[_0x475519(0x13a)](_0x384f30,{'stream':!0x0});let _0x1ea042=_0x6167d2[_0x475519(0x122)]('\x0a\x0a');_0x6167d2=_0x1ea042['pop']()||'';for(let _0x12a919 of _0x1ea042){let _0x3a9f45=_0x12a919[_0x475519(0x122)]('\x0a')['find'](_0x5bbcee=>_0x5bbcee[_0x475519(0x123)](_0x475519(0xd2)));if(!_0x3a9f45)continue;try{let _0x527faa=JSON[_0x475519(0x108)](_0x3a9f45[_0x475519(0x151)](0x6));if(await a(_0x527faa),_0x527faa[_0x475519(0x157)]===_0x475519(0x101)){if(_0x4db6e8=null,!_0x3c79b2)await l();_0x3c79b2=!0x1;}}catch(_0x1dca26){W(_0x475519(0x137)+_0x1dca26);}}}W('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x4c89b2){W(_0x475519(0xfd)+_0x4c89b2);}if(_0x4db6e8=_0x4db6e8??Date[_0x475519(0x161)](),Date['now']()-_0x4db6e8>T){W('SSE\x20连续\x20>1h\x20连不上\x20hub\x20('+j+_0x475519(0xf6));return;}await N(_0x1783ef),_0x1783ef=Math[_0x475519(0x150)](_0x1783ef*0x2,R);}}async function a(_0x281d73){const _0x1f7907=a0_0xbc12a8;if(_0x281d73['type']==='connected'){W(_0x1f7907(0x136)+G+'\x22');return;}if(_0x281d73[_0x1f7907(0x157)]===_0x1f7907(0xdf)){if(W(_0x1f7907(0x14f)+_0x281d73[_0x1f7907(0x163)]+':\x20'+_0x281d73[_0x1f7907(0x10b)][_0x1f7907(0x151)](0x0,0x3c)),await x[_0x1f7907(0xf1)]({'method':_0x1f7907(0x149),'params':{'content':_0x281d73[_0x1f7907(0x10b)],'meta':{'sender':_0x281d73[_0x1f7907(0x163)]||_0x1f7907(0x134),'sender_id':_0x1f7907(0x147),'user':_0x281d73['from']||_0x1f7907(0x134),'priority':_0x1f7907(0xf2)}}}),_0x281d73[_0x1f7907(0xda)])await Y(_0x1f7907(0x106),{'alias':G,'message_id':_0x281d73[_0x1f7907(0xda)]});return;}if(_0x281d73[_0x1f7907(0x157)]==='new_task'||_0x281d73['type']===_0x1f7907(0x11b)){W('←\x20'+_0x281d73['type']+_0x1f7907(0x10a)+_0x281d73[_0x1f7907(0xf4)]+_0x1f7907(0x13e)+(_0x281d73[_0x1f7907(0x103)]||'normal'));let _0x3b6632=await Y(_0x1f7907(0x14b),{'alias':G,'limit':0x5});if(_0x3b6632?.['ok']&&_0x3b6632['messages']?.[_0x1f7907(0xdb)]>0x0)for(let _0x391d5f of _0x3b6632[_0x1f7907(0x121)]){let _0x16c525={'sender':_0x391d5f['from_session']||_0x1f7907(0x134),'sender_id':_0x1f7907(0x147),'user':_0x391d5f[_0x1f7907(0x118)]||_0x1f7907(0x134),'task_id':_0x391d5f['id'],'priority':_0x391d5f['priority']||_0x1f7907(0xf2)};D['set'](_0x391d5f['id'],_0x391d5f[_0x1f7907(0x118)]||_0x1f7907(0x134)),await x[_0x1f7907(0xf1)]({'method':_0x1f7907(0x149),'params':{'content':_0x391d5f[_0x1f7907(0x131)],'meta':_0x16c525}}),W(_0x1f7907(0x12a)+_0x391d5f['id'][_0x1f7907(0x151)](0x0,0x8)+'\x20from\x20'+_0x391d5f[_0x1f7907(0x118)]+':\x20'+_0x391d5f[_0x1f7907(0x131)][_0x1f7907(0x151)](0x0,0x3c)),await Y('ack_inbox',{'alias':G,'message_id':_0x391d5f['id']});}}}async function n(){const _0x2aeb23=a0_0xbc12a8;let _0xcdb559=new a0_0x29f2d5();await x[_0x2aeb23(0x117)](_0xcdb559),W(_0x2aeb23(0x107)),W('starting\x20SSE\x20listener...'),o()['catch'](_0x3cae81=>W(_0x2aeb23(0x154)+_0x3cae81)),Y(_0x2aeb23(0x11a),{'resume_id':K,'alias':G,'status':_0x2aeb23(0x143),'server':a0_0x7dc3e9(),'hostname':a0_0x7dc3e9(),'agent':'claude-code','project_dir':process[_0x2aeb23(0xe9)](),'tmux_name':f||void 0x0})[_0x2aeb23(0xfb)](()=>W(_0x2aeb23(0x13d)+G+_0x2aeb23(0x153)+K[_0x2aeb23(0x151)](0x0,0x8)+')'))[_0x2aeb23(0xf3)](_0x3f6ff8=>W(_0x2aeb23(0x10c)+_0x3f6ff8)),setInterval(()=>{const _0x5c458c=_0x2aeb23;Y(_0x5c458c(0x11a),{'resume_id':K,'alias':G,'status':_0x5c458c(0x143),'server':a0_0x7dc3e9(),'hostname':a0_0x7dc3e9(),'agent':'claude-code','project_dir':process[_0x5c458c(0xe9)](),'tmux_name':f||void 0x0})['catch'](_0x30405f=>W('heartbeat\x20failed:\x20'+_0x30405f));},0x2bf20),W('ready\x20—\x20waiting\x20for\x20events');}n()[a0_0xbc12a8(0xf3)](_0x53d48a=>{const _0x2c397a=a0_0xbc12a8;W(_0x2c397a(0x155)+_0x53d48a),process[_0x2c397a(0x14a)](0x1);});async function b(){const _0x4e9d76=a0_0xbc12a8;W(_0x4e9d76(0x142)),await Y(_0x4e9d76(0x11a),{'resume_id':K,'alias':G,'status':'offline','task':_0x4e9d76(0xf7)})[_0x4e9d76(0xf3)](()=>{}),process[_0x4e9d76(0x14a)](0x0);}process['stdin']['on']('end',()=>b()),process['on'](a0_0xbc12a8(0x14d),()=>b()),process['on'](a0_0xbc12a8(0x12d),()=>b());
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",
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",