@sleep2agi/agent-network 2.2.22-preview.4 → 2.3.0-preview.1

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_0x4b397d=a0_0x1405;(function(_0x142921,_0x2f137f){const _0xb2c17f=a0_0x1405,_0x5e7735=_0x142921();while(!![]){try{const _0x221887=parseInt(_0xb2c17f(0xb6))/0x1*(parseInt(_0xb2c17f(0xd9))/0x2)+-parseInt(_0xb2c17f(0xa4))/0x3+parseInt(_0xb2c17f(0xcc))/0x4+-parseInt(_0xb2c17f(0xc6))/0x5+parseInt(_0xb2c17f(0xb5))/0x6+parseInt(_0xb2c17f(0xbd))/0x7+-parseInt(_0xb2c17f(0xc7))/0x8*(parseInt(_0xb2c17f(0xd2))/0x9);if(_0x221887===_0x2f137f)break;else _0x5e7735['push'](_0x5e7735['shift']());}catch(_0x231c65){_0x5e7735['push'](_0x5e7735['shift']());}}}(a0_0xa6cb,0xefc2b));function a0_0x1405(_0x31b3ce,_0x37592b){_0x31b3ce=_0x31b3ce-0x93;const _0xa6cbc2=a0_0xa6cb();let _0x1405d2=_0xa6cbc2[_0x31b3ce];return _0x1405d2;}import{EventEmitter as a0_0x9dfe0b}from'events';import{hostname as a0_0x26019b}from'os';class T extends a0_0x9dfe0b{[a0_0x4b397d(0xd7)];[a0_0x4b397d(0xd6)];[a0_0x4b397d(0xca)];[a0_0x4b397d(0x94)];[a0_0x4b397d(0xba)];[a0_0x4b397d(0xc5)];[a0_0x4b397d(0xb4)];[a0_0x4b397d(0xb2)];[a0_0x4b397d(0xac)];[a0_0x4b397d(0xd1)]=!0x1;constructor(_0x326d50){const _0xdbb1b8=a0_0x4b397d;super();if(this[_0xdbb1b8(0xd7)]=_0x326d50[_0xdbb1b8(0xd7)][_0xdbb1b8(0xc3)](/\/$/,''),this['alias']=_0x326d50[_0xdbb1b8(0xd6)],this[_0xdbb1b8(0xca)]=_0x326d50['token'],this[_0xdbb1b8(0x94)]=_0x326d50['agent']||_0xdbb1b8(0xe1),this[_0xdbb1b8(0xba)]=_0xdbb1b8(0xce)+_0x326d50[_0xdbb1b8(0xd6)]+'-'+Date[_0xdbb1b8(0xde)]()[_0xdbb1b8(0xe3)](0x24),this[_0xdbb1b8(0xc5)]=_0x326d50[_0xdbb1b8(0xc5)]??0x2bf20,this[_0xdbb1b8(0xb4)]=_0x326d50[_0xdbb1b8(0xb4)]??0xbb8,_0x326d50['autoConnect']!==!0x1)this[_0xdbb1b8(0x99)]();}[a0_0x4b397d(0xd8)](_0x4bbd57){const _0x3ee55b=a0_0x4b397d;console[_0x3ee55b(0xd8)]('['+new Date()[_0x3ee55b(0x9c)]()[_0x3ee55b(0xe6)](0x0,0x8)+_0x3ee55b(0xdd)+this[_0x3ee55b(0xd6)]+']\x20'+_0x4bbd57);}async['call'](_0x41c671,_0x2c9689){const _0x511a55=a0_0x4b397d;let _0x476b32={'Content-Type':_0x511a55(0xc9),'Accept':_0x511a55(0xb1)};if(this['token'])_0x476b32[_0x511a55(0xa7)]='Bearer\x20'+this[_0x511a55(0xca)];let _0x2aab7b=await(await fetch(this['url']+'/mcp',{'method':_0x511a55(0xd3),'headers':_0x476b32,'body':JSON[_0x511a55(0xcd)]({'jsonrpc':_0x511a55(0xc2),'id':Date[_0x511a55(0xde)](),'method':'tools/call','params':{'name':_0x41c671,'arguments':_0x2c9689}})}))[_0x511a55(0xa6)](),_0x401177=_0x2aab7b[_0x511a55(0xc4)](/data: (.+)/),_0x488450=_0x401177?JSON[_0x511a55(0xbc)](_0x401177[0x1]):JSON['parse'](_0x2aab7b),_0x31e6e6=_0x488450?.[_0x511a55(0xd0)]?.['content']?.[0x0]?.[_0x511a55(0xa6)];return _0x31e6e6?JSON['parse'](_0x31e6e6):_0x488450;}async[a0_0x4b397d(0x99)](){const _0x4c68ef=a0_0x4b397d;if(this[_0x4c68ef(0xd1)])return;this[_0x4c68ef(0xd1)]=!0x0,await this[_0x4c68ef(0xd4)]('idle'),this['log'](_0x4c68ef(0xa3)),this[_0x4c68ef(0xb2)]=setInterval(()=>{const _0x1ec5ab=_0x4c68ef;this[_0x1ec5ab(0xd4)](_0x1ec5ab(0xb7))[_0x1ec5ab(0xe4)](_0x5bbdbc=>this[_0x1ec5ab(0xd8)](_0x1ec5ab(0xe5)+_0x5bbdbc[_0x1ec5ab(0xa8)]));},this[_0x4c68ef(0xc5)]),this[_0x4c68ef(0x98)]();}async['disconnect'](){const _0x3e891c=a0_0x4b397d;if(this[_0x3e891c(0xd1)]=!0x1,this[_0x3e891c(0xac)]?.[_0x3e891c(0xda)](),this[_0x3e891c(0xb2)])clearInterval(this[_0x3e891c(0xb2)]);await this[_0x3e891c(0xd4)]('offline')[_0x3e891c(0xe4)](()=>{}),this['log'](_0x3e891c(0xe0));}async['send'](_0x532a1b,_0x5796f6,_0x241792='normal'){const _0x1e9521=a0_0x4b397d;return this[_0x1e9521(0xa1)](_0x1e9521(0xd5),{'alias':_0x532a1b,'task':_0x5796f6,'priority':_0x241792,'from_session':this[_0x1e9521(0xd6)]});}async[a0_0x4b397d(0xa8)](_0x35da9b,_0x4a5ff1){const _0xb23d66=a0_0x4b397d;return this[_0xb23d66(0xa1)]('send_message',{'alias':_0x35da9b,'message':_0x4a5ff1,'from_session':this['alias']});}async['reply'](_0xaa4e02,_0x3491cb,_0xe4d4c=a0_0x4b397d(0xbe)){const _0xc53964=a0_0x4b397d;return this[_0xc53964(0xa1)](_0xc53964(0x9f),{'in_reply_to':_0xaa4e02,'text':_0x3491cb,'status':_0xe4d4c});}async[a0_0x4b397d(0xd4)](_0x5a4d47,_0x4b2863){const _0x149cbf=a0_0x4b397d;return this[_0x149cbf(0xa1)](_0x149cbf(0xa9),{'resume_id':this[_0x149cbf(0xba)],'alias':this[_0x149cbf(0xd6)],'status':_0x5a4d47,'server':a0_0x26019b(),'hostname':a0_0x26019b(),'agent':this[_0x149cbf(0x94)],'project_dir':process['cwd'](),..._0x4b2863});}async[a0_0x4b397d(0xa0)](){const _0x2a769c=a0_0x4b397d;return this[_0x2a769c(0xa1)](_0x2a769c(0xa5),{});}async[a0_0x4b397d(0x9b)](_0x147f66,_0x5ab487){const _0x1a624b=a0_0x4b397d;return this[_0x1a624b(0xa1)](_0x1a624b(0x9b),{'message':_0x147f66,'filter_server':_0x5ab487?.[_0x1a624b(0xdb)],'filter_status':_0x5ab487?.[_0x1a624b(0xd4)]});}async[a0_0x4b397d(0x98)](){const _0x4c2b6e=a0_0x4b397d;let _0x444ee7=encodeURIComponent(this['alias']),_0x67882=this[_0x4c2b6e(0xd7)]+_0x4c2b6e(0xc0)+_0x444ee7,_0x1cfc5c=this[_0x4c2b6e(0xb4)];while(this[_0x4c2b6e(0xd1)]){try{this['sseAbort']=new AbortController();let _0x393420={'Accept':_0x4c2b6e(0xe2)};if(this[_0x4c2b6e(0xca)])_0x393420[_0x4c2b6e(0xa7)]=_0x4c2b6e(0xc1)+this[_0x4c2b6e(0xca)];let _0x205bd5=await fetch(_0x67882,{'headers':_0x393420,'signal':this[_0x4c2b6e(0xac)][_0x4c2b6e(0xaa)]});if(!_0x205bd5['ok']||!_0x205bd5[_0x4c2b6e(0xa2)]){this[_0x4c2b6e(0xd8)](_0x4c2b6e(0x9d)+_0x205bd5[_0x4c2b6e(0xd4)]),await this[_0x4c2b6e(0x97)](_0x1cfc5c),_0x1cfc5c=Math[_0x4c2b6e(0xc8)](_0x1cfc5c*1.5,0xea60);continue;}_0x1cfc5c=this[_0x4c2b6e(0xb4)];let _0x14143d=_0x205bd5[_0x4c2b6e(0xa2)]['getReader'](),_0x5904d3=new TextDecoder(),_0x350091='';while(this[_0x4c2b6e(0xd1)]){let {done:_0x2bff13,value:_0xe49e91}=await _0x14143d[_0x4c2b6e(0xaf)]();if(_0x2bff13)break;_0x350091+=_0x5904d3['decode'](_0xe49e91,{'stream':!0x0});let _0x394fde=_0x350091[_0x4c2b6e(0xb8)]('\x0a');_0x350091=_0x394fde[_0x4c2b6e(0x96)]()||'';for(let _0x4e6362 of _0x394fde){if(!_0x4e6362[_0x4c2b6e(0xad)](_0x4c2b6e(0xbb)))continue;try{let _0x1c5241=JSON[_0x4c2b6e(0xbc)](_0x4e6362['slice'](0x6));if(_0x1c5241['type']===_0x4c2b6e(0xcf)){this[_0x4c2b6e(0xd8)](_0x4c2b6e(0x9e)),this[_0x4c2b6e(0xb3)](_0x4c2b6e(0xcf));continue;}if(_0x1c5241[_0x4c2b6e(0x9a)]===_0x4c2b6e(0xe7)||_0x1c5241[_0x4c2b6e(0x9a)]===_0x4c2b6e(0xcb)||_0x1c5241[_0x4c2b6e(0x9a)]==='broadcast')await this['processInbox']();}catch{}}}}catch(_0x1053cb){if(_0x1053cb[_0x4c2b6e(0xab)]===_0x4c2b6e(0xae))break;this['emit'](_0x4c2b6e(0xdf),_0x1053cb),this[_0x4c2b6e(0xd8)](_0x4c2b6e(0x95)+_0x1053cb['message']);}if(this[_0x4c2b6e(0xd1)])this[_0x4c2b6e(0xb3)](_0x4c2b6e(0xe0)),this['log']('SSE\x20reconnecting\x20in\x20'+_0x1cfc5c/0x3e8+_0x4c2b6e(0xb0)),await this[_0x4c2b6e(0x97)](_0x1cfc5c),_0x1cfc5c=Math['min'](_0x1cfc5c*1.5,0xea60);}}async[a0_0x4b397d(0xbf)](){const _0x1d41b1=a0_0x4b397d;try{let _0x32b248=(await this[_0x1d41b1(0xa1)]('get_inbox',{'alias':this[_0x1d41b1(0xd6)],'limit':0xa}))?.[_0x1d41b1(0xb9)]||[];for(let _0x23cd7e of _0x32b248)await this[_0x1d41b1(0xa1)]('ack_inbox',{'alias':this[_0x1d41b1(0xd6)],'message_id':_0x23cd7e['id']}),this[_0x1d41b1(0xd8)]('←\x20'+_0x23cd7e['from_session']+':\x20'+_0x23cd7e['content']['slice'](0x0,0x3c)),this[_0x1d41b1(0xb3)](_0x1d41b1(0x93),_0x23cd7e),this[_0x1d41b1(0xb3)](_0x1d41b1(0xa8),_0x23cd7e);}catch(_0x779bce){this[_0x1d41b1(0xd8)](_0x1d41b1(0xdc)+_0x779bce[_0x1d41b1(0xa8)]);}}[a0_0x4b397d(0x97)](_0x391763){return new Promise(_0x53b40f=>setTimeout(_0x53b40f,_0x391763));}}function a0_0xa6cb(){const _0x291d7e=['21BehwSj','idle','split','messages','resumeId','data:\x20','parse','13605767YxXNVJ','completed','processInbox','/events/','Bearer\x20','2.0','replace','match','heartbeatInterval','7153130xlirlw','7865616cfJDFG','min','application/json','token','new_message','4663300FXlezg','stringify','sdk-','connected','result','running','18DMYhmw','POST','status','send_task','alias','url','log','60284vnChOR','abort','server','inbox\x20error:\x20',']\x20[commhub:','now','error','disconnected','sdk','text/event-stream','toString','catch','heartbeat\x20failed:\x20','slice','new_task','task','agent','SSE\x20error:\x20','pop','sleep','connectSSE','connect','type','broadcast','toTimeString','SSE\x20failed:\x20','SSE\x20connected','send_reply','getAllStatus','call','body','registered','2928978nozQuu','get_all_status','text','Authorization','message','report_status','signal','name','sseAbort','startsWith','AbortError','read','s...','application/json,\x20text/event-stream','heartbeatTimer','emit','reconnectDelay','9677562KJjDlO'];a0_0xa6cb=function(){return _0x291d7e;};return a0_0xa6cb();}var $=T;export{$ as default,T as CommHub};
1
+ const a0_0x245f1e=a0_0x3d1a;(function(_0x5a7b1c,_0x4b0e95){const _0x195303=a0_0x3d1a,_0x510511=_0x5a7b1c();while(!![]){try{const _0x5d2b32=parseInt(_0x195303(0x95))/0x1*(parseInt(_0x195303(0xd5))/0x2)+-parseInt(_0x195303(0x93))/0x3+parseInt(_0x195303(0xb7))/0x4+parseInt(_0x195303(0xd0))/0x5*(-parseInt(_0x195303(0x9c))/0x6)+parseInt(_0x195303(0xa7))/0x7+parseInt(_0x195303(0xb0))/0x8*(parseInt(_0x195303(0x91))/0x9)+-parseInt(_0x195303(0xcb))/0xa;if(_0x5d2b32===_0x4b0e95)break;else _0x510511['push'](_0x510511['shift']());}catch(_0x317665){_0x510511['push'](_0x510511['shift']());}}}(a0_0x1cd6,0xf200d));import{EventEmitter as a0_0x317040}from'events';import{hostname as a0_0x33f726}from'os';class T extends a0_0x317040{[a0_0x245f1e(0xda)];['alias'];[a0_0x245f1e(0xbb)];[a0_0x245f1e(0xae)];[a0_0x245f1e(0xb5)];[a0_0x245f1e(0xa3)];[a0_0x245f1e(0xaa)];[a0_0x245f1e(0xe2)];[a0_0x245f1e(0x92)];['running']=!0x1;constructor(_0x3540c6){const _0x4346c9=a0_0x245f1e;super();if(this[_0x4346c9(0xda)]=_0x3540c6['url'][_0x4346c9(0xbd)](/\/$/,''),this[_0x4346c9(0x90)]=_0x3540c6[_0x4346c9(0x90)],this[_0x4346c9(0xbb)]=_0x3540c6[_0x4346c9(0xbb)],this[_0x4346c9(0xae)]=_0x3540c6['agent']||'sdk',this[_0x4346c9(0xb5)]=_0x4346c9(0xbc)+_0x3540c6[_0x4346c9(0x90)]+'-'+Date['now']()[_0x4346c9(0xde)](0x24),this[_0x4346c9(0xa3)]=_0x3540c6['heartbeatInterval']??0x2bf20,this[_0x4346c9(0xaa)]=_0x3540c6[_0x4346c9(0xaa)]??0xbb8,_0x3540c6[_0x4346c9(0xd7)]!==!0x1)this['connect']();}[a0_0x245f1e(0x8e)](_0xd56960){const _0x5dd363=a0_0x245f1e;console[_0x5dd363(0x8e)]('['+new Date()[_0x5dd363(0xc2)]()[_0x5dd363(0x9b)](0x0,0x8)+_0x5dd363(0xb9)+this[_0x5dd363(0x90)]+']\x20'+_0xd56960);}async['call'](_0x236515,_0x5739fa){const _0x5fbf37=a0_0x245f1e;let _0x5a9633={'Content-Type':_0x5fbf37(0xc1),'Accept':_0x5fbf37(0xc0)};if(this[_0x5fbf37(0xbb)])_0x5a9633['Authorization']=_0x5fbf37(0xac)+this[_0x5fbf37(0xbb)];let _0x4a86b4=await(await fetch(this[_0x5fbf37(0xda)]+_0x5fbf37(0xca),{'method':_0x5fbf37(0xbf),'headers':_0x5a9633,'body':JSON['stringify']({'jsonrpc':_0x5fbf37(0xb3),'id':Date[_0x5fbf37(0xab)](),'method':_0x5fbf37(0xe1),'params':{'name':_0x236515,'arguments':_0x5739fa}})}))[_0x5fbf37(0xa9)](),_0x3a2838=_0x4a86b4['match'](/data: (.+)/),_0x4be409=_0x3a2838?JSON[_0x5fbf37(0xba)](_0x3a2838[0x1]):JSON[_0x5fbf37(0xba)](_0x4a86b4),_0xdebda4=_0x4be409?.[_0x5fbf37(0xc6)]?.[_0x5fbf37(0xd1)]?.[0x0]?.[_0x5fbf37(0xa9)];return _0xdebda4?JSON[_0x5fbf37(0xba)](_0xdebda4):_0x4be409;}async[a0_0x245f1e(0xdc)](){const _0x2af897=a0_0x245f1e;if(this['running'])return;this[_0x2af897(0x98)]=!0x0,await this[_0x2af897(0xdb)]('idle'),this['log'](_0x2af897(0xdf)),this['heartbeatTimer']=setInterval(()=>{const _0xf7761b=_0x2af897;this['status'](_0xf7761b(0xb6))[_0xf7761b(0xb8)](_0x1d94bf=>this[_0xf7761b(0x8e)](_0xf7761b(0x9a)+_0x1d94bf[_0xf7761b(0xa8)]));},this[_0x2af897(0xa3)]),this['connectSSE']();}async['disconnect'](){const _0x2dd220=a0_0x245f1e;if(this['running']=!0x1,this['sseAbort']?.[_0x2dd220(0xc4)](),this[_0x2dd220(0xe2)])clearInterval(this[_0x2dd220(0xe2)]);await this[_0x2dd220(0xdb)](_0x2dd220(0xcc))['catch'](()=>{}),this[_0x2dd220(0x8e)]('disconnected');}async[a0_0x245f1e(0x99)](_0x3255d1,_0x2949d9,_0x5906df=a0_0x245f1e(0xa4)){const _0xdee442=a0_0x245f1e;return this[_0xdee442(0xa5)]('send_task',{'alias':_0x3255d1,'task':_0x2949d9,'priority':_0x5906df,'from_session':this[_0xdee442(0x90)]});}async[a0_0x245f1e(0xa8)](_0x464b56,_0x3f02f1){const _0x3ac9b0=a0_0x245f1e;return this[_0x3ac9b0(0xa5)](_0x3ac9b0(0xc3),{'alias':_0x464b56,'message':_0x3f02f1,'from_session':this['alias']});}async['reply'](_0x324d53,_0x2a7c95,_0x4b9720=a0_0x245f1e(0xa2)){const _0x50586d=a0_0x245f1e;return this[_0x50586d(0xa5)](_0x50586d(0x94),{'in_reply_to':_0x324d53,'text':_0x2a7c95,'status':_0x4b9720});}async[a0_0x245f1e(0xdb)](_0x28e8f1,_0x52782d){const _0x3b4b62=a0_0x245f1e;return this[_0x3b4b62(0xa5)](_0x3b4b62(0xd9),{'resume_id':this[_0x3b4b62(0xb5)],'alias':this[_0x3b4b62(0x90)],'status':_0x28e8f1,'server':a0_0x33f726(),'hostname':a0_0x33f726(),'agent':this[_0x3b4b62(0xae)],'project_dir':process[_0x3b4b62(0xa6)](),..._0x52782d});}async['getAllStatus'](){const _0x2c6071=a0_0x245f1e;return this['call'](_0x2c6071(0xa0),{});}async['broadcast'](_0x7c59df,_0xcf53ba){const _0x585bf2=a0_0x245f1e;return this['call'](_0x585bf2(0xb4),{'message':_0x7c59df,'filter_server':_0xcf53ba?.['server'],'filter_status':_0xcf53ba?.[_0x585bf2(0xdb)]});}async['connectSSE'](){const _0xb28033=a0_0x245f1e;let _0xd4bf68=encodeURIComponent(this[_0xb28033(0x90)]),_0x520900=this[_0xb28033(0xda)]+_0xb28033(0xc5)+_0xd4bf68,_0x3bce39=this[_0xb28033(0xaa)];while(this[_0xb28033(0x98)]){try{this[_0xb28033(0x92)]=new AbortController();let _0x59294e={'Accept':_0xb28033(0xd6)};if(this[_0xb28033(0xbb)])_0x59294e[_0xb28033(0xd4)]=_0xb28033(0xac)+this[_0xb28033(0xbb)];let _0x50d661=await fetch(_0x520900,{'headers':_0x59294e,'signal':this[_0xb28033(0x92)]['signal']});if(!_0x50d661['ok']||!_0x50d661[_0xb28033(0xe0)]){this['log'](_0xb28033(0xce)+_0x50d661[_0xb28033(0xdb)]),await this['sleep'](_0x3bce39),_0x3bce39=Math[_0xb28033(0x96)](_0x3bce39*1.5,0xea60);continue;}_0x3bce39=this[_0xb28033(0xaa)];let _0x159a22=_0x50d661[_0xb28033(0xe0)]['getReader'](),_0x1b774a=new TextDecoder(),_0x25826f='';while(this[_0xb28033(0x98)]){let {done:_0x5396de,value:_0x25d01e}=await _0x159a22['read']();if(_0x5396de)break;_0x25826f+=_0x1b774a[_0xb28033(0xb2)](_0x25d01e,{'stream':!0x0});let _0x5349c3=_0x25826f[_0xb28033(0x8f)]('\x0a');_0x25826f=_0x5349c3[_0xb28033(0xbe)]()||'';for(let _0x47522b of _0x5349c3){if(!_0x47522b[_0xb28033(0xaf)]('data:\x20'))continue;try{let _0x47de2b=JSON[_0xb28033(0xba)](_0x47522b[_0xb28033(0x9b)](0x6));if(_0x47de2b['type']===_0xb28033(0x9f)){this[_0xb28033(0x8e)](_0xb28033(0xc7)),this[_0xb28033(0xcf)](_0xb28033(0x9f));continue;}if(_0x47de2b[_0xb28033(0xcd)]===_0xb28033(0xd3)||_0x47de2b[_0xb28033(0xcd)]===_0xb28033(0xdd)||_0x47de2b[_0xb28033(0xcd)]==='broadcast')await this[_0xb28033(0xad)]();}catch{}}}}catch(_0x569f3b){if(_0x569f3b['name']==='AbortError')break;this[_0xb28033(0xcf)](_0xb28033(0xc9),_0x569f3b),this['log'](_0xb28033(0x97)+_0x569f3b[_0xb28033(0xa8)]);}if(this[_0xb28033(0x98)])this[_0xb28033(0xcf)]('disconnected'),this[_0xb28033(0x8e)](_0xb28033(0xd2)+_0x3bce39/0x3e8+_0xb28033(0xd8)),await this['sleep'](_0x3bce39),_0x3bce39=Math[_0xb28033(0x96)](_0x3bce39*1.5,0xea60);}}async[a0_0x245f1e(0xad)](){const _0x45a32b=a0_0x245f1e;try{let _0x28bc89=(await this[_0x45a32b(0xa5)](_0x45a32b(0xc8),{'alias':this[_0x45a32b(0x90)],'limit':0xa}))?.[_0x45a32b(0x9d)]||[];for(let _0x38a57c of _0x28bc89)await this[_0x45a32b(0xa5)](_0x45a32b(0xa1),{'alias':this[_0x45a32b(0x90)],'message_id':_0x38a57c['id']}),this[_0x45a32b(0x8e)]('←\x20'+_0x38a57c[_0x45a32b(0x9e)]+':\x20'+_0x38a57c[_0x45a32b(0xd1)]['slice'](0x0,0x3c)),this['emit']('task',_0x38a57c),this[_0x45a32b(0xcf)]('message',_0x38a57c);}catch(_0x13b4ce){this[_0x45a32b(0x8e)](_0x45a32b(0xb1)+_0x13b4ce[_0x45a32b(0xa8)]);}}['sleep'](_0xa5e5){return new Promise(_0x57f733=>setTimeout(_0x57f733,_0xa5e5));}}function a0_0x1cd6(){const _0x10bc79=['split','alias','1143891ZKyEnI','sseAbort','1703472VBATGc','send_reply','1VeVDAQ','min','SSE\x20error:\x20','running','send','heartbeat\x20failed:\x20','slice','54nnbnqB','messages','from_session','connected','get_all_status','ack_inbox','completed','heartbeatInterval','normal','call','cwd','13518295FYUktq','message','text','reconnectDelay','now','Bearer\x20','processInbox','agent','startsWith','40tZELig','inbox\x20error:\x20','decode','2.0','broadcast','resumeId','idle','7633244eBvtLX','catch',']\x20[commhub:','parse','token','sdk-','replace','pop','POST','application/json,\x20text/event-stream','application/json','toTimeString','send_message','abort','/events/','result','SSE\x20connected','get_inbox','error','/mcp','21919240vKZNvu','offline','type','SSE\x20failed:\x20','emit','831005QfhfqY','content','SSE\x20reconnecting\x20in\x20','new_task','Authorization','1543622CGGAMX','text/event-stream','autoConnect','s...','report_status','url','status','connect','new_message','toString','registered','body','tools/call','heartbeatTimer','log'];a0_0x1cd6=function(){return _0x10bc79;};return a0_0x1cd6();}function a0_0x3d1a(_0x272d91,_0x1e3d59){_0x272d91=_0x272d91-0x8e;const _0x1cd602=a0_0x1cd6();let _0x3d1ab0=_0x1cd602[_0x272d91];return _0x3d1ab0;}var $=T;export{$ as default,T as CommHub};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Outcome of one rule check against one `.gitignore` file.
3
+ */
4
+ export type EnsureRuleOutcome = "already-present" | "appended" | "created" | "skipped-no-anet";
5
+ /**
6
+ * Append `rule` to `gitignorePath` unless an exactly-matching line
7
+ * already exists. Returns the outcome. Never throws on missing parent
8
+ * directory — caller is expected to have created it (or wants the
9
+ * gitignore skipped, per the `.anet`-scoped writer below).
10
+ *
11
+ * The rule comparison is line-exact after `trim()`. Rules with leading
12
+ * `#` (comment lines in the same file) are ignored for the duplicate
13
+ * check, so an end-user can leave commented-out variants in place
14
+ * without confusing the idempotent guard.
15
+ */
16
+ export declare function ensureGitignoreRule(gitignorePath: string, rule: string): EnsureRuleOutcome;
17
+ /**
18
+ * Convenience: append multiple rules to one `.gitignore` file with one
19
+ * read/write pair. Returns the outcome per rule, in input order.
20
+ */
21
+ export declare function ensureGitignoreRules(gitignorePath: string, rules: string[]): EnsureRuleOutcome[];
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x2ef949=a0_0x1543;(function(_0x40afb0,_0x3aeef5){const _0x3ce9d2=a0_0x1543,_0x2ac270=_0x40afb0();while(!![]){try{const _0x210d95=-parseInt(_0x3ce9d2(0xd2))/0x1+-parseInt(_0x3ce9d2(0x113))/0x2*(parseInt(_0x3ce9d2(0xe9))/0x3)+parseInt(_0x3ce9d2(0xc5))/0x4*(-parseInt(_0x3ce9d2(0xf9))/0x5)+parseInt(_0x3ce9d2(0x10a))/0x6+parseInt(_0x3ce9d2(0x123))/0x7*(-parseInt(_0x3ce9d2(0x100))/0x8)+parseInt(_0x3ce9d2(0xb0))/0x9+parseInt(_0x3ce9d2(0xac))/0xa;if(_0x210d95===_0x3aeef5)break;else _0x2ac270['push'](_0x2ac270['shift']());}catch(_0x26e205){_0x2ac270['push'](_0x2ac270['shift']());}}}(a0_0xde0a,0x94af3));import{readFileSync as a0_0x4d54a6,existsSync as a0_0x2360fd}from'fs';import{randomUUID as a0_0x398362}from'crypto';import{join as a0_0x3df207}from'path';import{hostname as a0_0x4c64de}from'os';import{execSync as a0_0x492c53}from'child_process';import{Server as a0_0x52407d}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x413ca9}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x3a76a2,CallToolRequestSchema as a0_0x5cab8f}from'@modelcontextprotocol/sdk/types.js';function I(_0x4520f3){const _0x155e5e=a0_0x1543;if(!a0_0x2360fd(_0x4520f3))return;for(let _0xe60003 of a0_0x4d54a6(_0x4520f3,_0x155e5e(0x112))['split']('\x0a')){let _0x18b363=_0xe60003['trim']();if(!_0x18b363||_0x18b363[_0x155e5e(0xfd)]('#'))continue;let _0x2acc1b=_0x18b363[_0x155e5e(0x104)]('=');if(_0x2acc1b<0x0)continue;let _0x50bb80=_0x18b363[_0x155e5e(0xcf)](0x0,_0x2acc1b)[_0x155e5e(0x10c)](),_0x3b0fea=_0x18b363[_0x155e5e(0xcf)](_0x2acc1b+0x1)[_0x155e5e(0x10c)]()[_0x155e5e(0x129)](/^["']|["']$/g,'');if(!process.env[_0x50bb80])process.env[_0x50bb80]=_0x3b0fea;}}var L=process.env.HOME||'~',U=a0_0x3df207(L,a0_0x2ef949(0x106));I(a0_0x3df207(U,a0_0x2ef949(0xfe)));var v=process[a0_0x2ef949(0xb4)]()[a0_0x2ef949(0x129)](/\//g,'-');I(a0_0x3df207(U,v,a0_0x2ef949(0xfe)));function d(){const _0x186c16=a0_0x2ef949;try{return a0_0x492c53('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x186c16(0x112),'timeout':0x7d0})[_0x186c16(0x10c)]();}catch{return'';}}function m(){const _0x408f1a=a0_0x2ef949;try{let _0x59ec5b=a0_0x3df207(L,'.anet',_0x408f1a(0xf5));if(a0_0x2360fd(_0x59ec5b))return JSON[_0x408f1a(0xd5)](a0_0x4d54a6(_0x59ec5b,_0x408f1a(0x112)));}catch{}return{};}var u=m(),j=process.env.COMMHUB_URL||u[a0_0x2ef949(0xf3)]||a0_0x2ef949(0x115),f=process.env.COMMHUB_TMUX||d();function a0_0xde0a(){const _0x2f521=['.claude/channels/commhub','none','SSE\x20connected\x20as\x20\x22','result','552048duLpMP','\x20CWD=','trim','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','connecting\x20to\x20','/mcp','error','heartbeat\x20failed:\x20','utf-8','706zahVue','messages','http://127.0.0.1:9200','in_progress','SSE\x20connection\x20error:\x20','cancelled','Session\x20alias:\x20','SSE\x20fatal:\x20','get_inbox','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','unattributed-','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','now','/events/','number','catch','301LJIikL','registered\x20as\x20\x22','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','body','exit','replace','find','SSE\x20error:\x20','Bearer\x20','commhub_send_message','connected','params','offline','task','SSE\x20stream\x20ended,\x20reconnecting...','length','then','ack_inbox','\x20PROJECT_ENV=','blocked','application/json,\x20text/event-stream','\x20ALIAS=','0.3.0','init\x20failed:\x20','new_task','application/json','commhub_report_status','session\x20disconnected','\x20RESUME_ID=','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','2.0','message_id','Authorization','25989040CEnXor','toTimeString','stderr','pid','5796882SsbkIo','send_message','from_session','failed','cwd','decode','alias','notifications/claude/channel','ENV:\x20URL=','[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20','...\x20TMUX=','unknown\x20tool','2025-03-26','type','delete','tools/call','Task\x20content','no\x20response','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','status','notification','2614908tqNlvz','min','statusText',':\x20inbox_count=','get_all_status','message','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','object','normal','high','slice','shutting\x20down,\x20reporting\x20offline...','claude-code','908140gnqmUE','connect','POST','parse','stringify','Reply\x20text\x20/\x20result\x20summary','commhub_send_task','re-register\x20failed:\x20',']\x20[commhub]\x20','data:\x20','completed','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','report_status','end','set','\x20from\x20','\x20/\x20hostname=','commhub_reply','re-registered\x20as\x20\x22','inbox_count','Target\x20session\x20alias','commhub_get_all_status','text','6978rScgWw','idle','send_task','write','warning:\x20could\x20not\x20register:\x20','MCP\x20stdio\x20connected','parse\x20error:\x20','from','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','setRequestHandler','hub','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','config.json','fatal:\x20','content','priority','5qCUuTF','starting\x20SSE\x20listener...','\x22\x20(','→\x20injected\x20task\x20','startsWith','.env','commhub-channel','63824OTDlZy','SIGTERM','string','new_message','indexOf','split'];a0_0xde0a=function(){return _0x2f521;};return a0_0xde0a();}function r(){const _0x2577eb=a0_0x2ef949;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x2577eb(0x10c)]())return process.env.COMMHUB_ALIAS[_0x2577eb(0x10c)]();return process[_0x2577eb(0xae)]['write'](_0x2577eb(0xb9)+(_0x2577eb(0xf1)+(f||'(none)')+_0x2577eb(0xe2)+a0_0x4c64de()+_0x2577eb(0x11c))),_0x2577eb(0x11d)+process[_0x2577eb(0xaf)];}var G=r(),K=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x398362(),F=process.env.COMMHUB_TOKEN||u['token']||'';function W(_0x1c3a63){const _0x17b319=a0_0x2ef949;let _0x759fcd=new Date()[_0x17b319(0xad)]()['slice'](0x0,0x8);process[_0x17b319(0xae)][_0x17b319(0xec)]('['+_0x759fcd+_0x17b319(0xda)+_0x1c3a63+'\x0a');}function N(_0x527a0f){return new Promise(_0xc7506e=>setTimeout(_0xc7506e,_0x527a0f));}W(a0_0x2ef949(0xb8)+j+a0_0x2ef949(0x139)+G+a0_0x2ef949(0xa6)+K[a0_0x2ef949(0xcf)](0x0,0x8)+a0_0x2ef949(0xba)+(f||a0_0x2ef949(0x107))+a0_0x2ef949(0x10b)+process[a0_0x2ef949(0xb4)]()+a0_0x2ef949(0x136)+v);var D=new Map(),x=new a0_0x52407d({'name':a0_0x2ef949(0xff),'version':a0_0x2ef949(0x13a)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x2ef949(0xa8),a0_0x2ef949(0x11e),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x2ef949(0xdd),a0_0x2ef949(0x119)+G]['join']('\x0a')});function a0_0x1543(_0x5e2ea4,_0x1600f2){_0x5e2ea4=_0x5e2ea4-0xa3;const _0xde0a4c=a0_0xde0a();let _0x1543ca=_0xde0a4c[_0x5e2ea4];return _0x1543ca;}x['setRequestHandler'](a0_0x3a76a2,async()=>({'tools':[{'name':a0_0x2ef949(0xe3),'description':a0_0x2ef949(0x125),'inputSchema':{'type':a0_0x2ef949(0xcc),'properties':{'task_id':{'type':a0_0x2ef949(0x102),'description':a0_0x2ef949(0xcb)},'text':{'type':a0_0x2ef949(0x102),'description':a0_0x2ef949(0xd7)},'status':{'type':a0_0x2ef949(0x102),'enum':[a0_0x2ef949(0xdc),a0_0x2ef949(0xb3),a0_0x2ef949(0x118),a0_0x2ef949(0x137),a0_0x2ef949(0x110),a0_0x2ef949(0x116)],'description':a0_0x2ef949(0x126)}},'required':[a0_0x2ef949(0xe8)]}},{'name':a0_0x2ef949(0xa4),'description':a0_0x2ef949(0xa7),'inputSchema':{'type':a0_0x2ef949(0xcc),'properties':{'status':{'type':a0_0x2ef949(0x102),'enum':['working',a0_0x2ef949(0xea),'blocked',a0_0x2ef949(0x110)]},'task':{'type':a0_0x2ef949(0x102),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x2ef949(0x121),'description':'Progress\x200-100'}},'required':[a0_0x2ef949(0xc3)]}},{'name':a0_0x2ef949(0xd8),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x2ef949(0xcc),'properties':{'alias':{'type':'string','description':a0_0x2ef949(0xe6)},'task':{'type':'string','description':a0_0x2ef949(0xc0)},'priority':{'type':a0_0x2ef949(0x102),'enum':[a0_0x2ef949(0xce),'normal','low'],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x2ef949(0xb6),a0_0x2ef949(0x131)]}},{'name':a0_0x2ef949(0x12d),'description':a0_0x2ef949(0xc2),'inputSchema':{'type':a0_0x2ef949(0xcc),'properties':{'alias':{'type':a0_0x2ef949(0x102),'description':a0_0x2ef949(0xe6)},'message':{'type':a0_0x2ef949(0x102),'description':'Message\x20content'}},'required':[a0_0x2ef949(0xb6),'message']}},{'name':a0_0x2ef949(0xe7),'description':a0_0x2ef949(0xf4),'inputSchema':{'type':'object','properties':{}}}]}));async function Y(_0x15c14e,_0x516a61){const _0x2aafdc=a0_0x2ef949;let _0x229c09=await fetch(j+_0x2aafdc(0x10f),{'method':_0x2aafdc(0xd4),'headers':{'Content-Type':_0x2aafdc(0xa3),'Accept':'application/json,\x20text/event-stream',...F?{'Authorization':_0x2aafdc(0x12c)+F}:{}},'body':JSON[_0x2aafdc(0xd6)]({'jsonrpc':_0x2aafdc(0xa9),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x2aafdc(0xbc),'capabilities':{},'clientInfo':{'name':_0x2aafdc(0xff),'version':'0.3.0'}}})});if(!_0x229c09['ok']){let _0x25e575=await _0x229c09[_0x2aafdc(0xe8)]();return W('CommHub\x20init\x20failed:\x20'+_0x229c09[_0x2aafdc(0xc3)]+'\x20'+_0x25e575[_0x2aafdc(0xcf)](0x0,0x64)),{'ok':!0x1,'error':_0x2aafdc(0x13b)+_0x229c09[_0x2aafdc(0xc3)]};}await _0x229c09[_0x2aafdc(0xe8)]();let _0x5ce1cf=(await(await fetch(j+_0x2aafdc(0x10f),{'method':'POST','headers':{'Content-Type':'application/json','Accept':_0x2aafdc(0x138),...F?{'Authorization':'Bearer\x20'+F}:{}},'body':JSON[_0x2aafdc(0xd6)]({'jsonrpc':_0x2aafdc(0xa9),'id':0x2,'method':_0x2aafdc(0xbf),'params':{'name':_0x15c14e,'arguments':_0x516a61}})}))[_0x2aafdc(0xe8)]())[_0x2aafdc(0x105)]('\x0a')['find'](_0x3e4502=>_0x3e4502[_0x2aafdc(0xfd)]('data:\x20'));if(_0x5ce1cf){let _0x34f421=JSON[_0x2aafdc(0xd5)](_0x5ce1cf[_0x2aafdc(0xcf)](0x6));return _0x34f421?.[_0x2aafdc(0x109)]?.['content']?.[0x0]?.[_0x2aafdc(0xe8)]?JSON[_0x2aafdc(0xd5)](_0x34f421[_0x2aafdc(0x109)][_0x2aafdc(0xf7)][0x0]['text']):_0x34f421;}return{'ok':!0x1,'error':_0x2aafdc(0xc1)};}x[a0_0x2ef949(0xf2)](a0_0x5cab8f,async _0x476e56=>{const _0x1a508e=a0_0x2ef949;let {name:_0x42141b,arguments:_0x411c52}=_0x476e56[_0x1a508e(0x12f)];if(_0x42141b==='commhub_reply'){let {task_id:_0x1f5dd9,text:_0x56199e,status:_0x3c2a7d}=_0x411c52;if(_0x3c2a7d==='completed'||_0x3c2a7d===_0x1a508e(0xb3)||_0x3c2a7d===_0x1a508e(0x118)){let _0x4bd937=_0x3c2a7d==='completed'?'replied':_0x3c2a7d,_0x232c44=_0x1f5dd9?D['get'](_0x1f5dd9)||_0x1a508e(0xf3):_0x1a508e(0xf3),_0x1ffb82=await Y('send_reply',{'alias':_0x232c44,'text':_0x56199e,'in_reply_to':_0x1f5dd9||void 0x0,'status':_0x4bd937,'from_session':G});if(_0x1f5dd9)D[_0x1a508e(0xbe)](_0x1f5dd9);return{'content':[{'type':'text','text':JSON[_0x1a508e(0xd6)](_0x1ffb82)}]};}let _0x41fd14=await Y('report_status',{'resume_id':K,'alias':G,'status':_0x3c2a7d===_0x1a508e(0x137)?'blocked':_0x3c2a7d===_0x1a508e(0x110)?'error':'working','task':_0x56199e['slice'](0x0,0xc8),'output':_0x56199e});return{'content':[{'type':'text','text':JSON[_0x1a508e(0xd6)](_0x41fd14)}]};}if(_0x42141b==='commhub_report_status'){let {status:_0xd52126,task:_0x107a04,progress:_0x51666a}=_0x411c52,_0x5c827f=await Y(_0x1a508e(0xde),{'resume_id':K,'alias':G,'status':_0xd52126,'task':_0x107a04,'progress':_0x51666a});return{'content':[{'type':_0x1a508e(0xe8),'text':JSON['stringify'](_0x5c827f)}]};}if(_0x42141b===_0x1a508e(0xd8)){let {alias:_0x454934,task:_0x16262b,priority:_0x17e511}=_0x411c52,_0x4e5010=await Y(_0x1a508e(0xeb),{'alias':_0x454934,'task':_0x16262b,'priority':_0x17e511||_0x1a508e(0xcd),'from_session':G});return{'content':[{'type':_0x1a508e(0xe8),'text':JSON['stringify'](_0x4e5010)}]};}if(_0x42141b==='commhub_send_message'){let {alias:_0x210dc6,message:_0x29242}=_0x411c52,_0x534913=await Y(_0x1a508e(0xb1),{'alias':_0x210dc6,'message':_0x29242,'from_session':G});return{'content':[{'type':_0x1a508e(0xe8),'text':JSON[_0x1a508e(0xd6)](_0x534913)}]};}if(_0x42141b===_0x1a508e(0xe7)){let _0x5606fe=await Y(_0x1a508e(0xc9),{});return{'content':[{'type':_0x1a508e(0xe8),'text':JSON[_0x1a508e(0xd6)](_0x5606fe)}]};}return{'content':[{'type':_0x1a508e(0xe8),'text':JSON[_0x1a508e(0xd6)]({'error':_0x1a508e(0xbb)})}]};});var O=0x3e8,R=0x7530,T=0x36ee80;async function l(){const _0x2629a2=a0_0x2ef949;try{await Y(_0x2629a2(0xde),{'resume_id':K,'alias':G,'status':_0x2629a2(0xea),'server':a0_0x4c64de(),'hostname':a0_0x4c64de(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':f||void 0x0}),W(_0x2629a2(0xe4)+G+'\x22\x20after\x20SSE\x20reconnect');}catch(_0x5384ef){W(_0x2629a2(0xd9)+_0x5384ef);}}async function o(){const _0x327b88=a0_0x2ef949;let _0x14c376=j+_0x327b88(0x120)+encodeURIComponent(G),_0x4d01c9={};if(F)_0x4d01c9[_0x327b88(0xab)]=_0x327b88(0x12c)+F;W(_0x327b88(0x10e)+_0x14c376);let _0x5b5e11=O,_0x4f15ba=!0x0,_0x1b5f1d=null;while(!0x0){try{let _0x4dc888=await fetch(_0x14c376,{'headers':_0x4d01c9});if(!_0x4dc888['ok']){if(W(_0x327b88(0x12b)+_0x4dc888[_0x327b88(0xc3)]+'\x20'+_0x4dc888[_0x327b88(0xc7)]),_0x1b5f1d=_0x1b5f1d??Date[_0x327b88(0x11f)](),Date[_0x327b88(0x11f)]()-_0x1b5f1d>T){W('SSE\x20连续\x20>1h\x20连不上\x20hub\x20('+j+')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。');return;}await N(_0x5b5e11),_0x5b5e11=Math[_0x327b88(0xc6)](_0x5b5e11*0x2,R);continue;}let _0x1f74ca=_0x4dc888[_0x327b88(0x127)]['getReader'](),_0x5d1c08=new TextDecoder(),_0x14c0f4='';_0x5b5e11=O;while(!0x0){let {done:_0x289da0,value:_0x2cbf53}=await _0x1f74ca['read']();if(_0x289da0)break;_0x14c0f4+=_0x5d1c08[_0x327b88(0xb5)](_0x2cbf53,{'stream':!0x0});let _0x177624=_0x14c0f4[_0x327b88(0x105)]('\x0a\x0a');_0x14c0f4=_0x177624['pop']()||'';for(let _0x1179ab of _0x177624){let _0x16ad9d=_0x1179ab[_0x327b88(0x105)]('\x0a')[_0x327b88(0x12a)](_0x13433c=>_0x13433c[_0x327b88(0xfd)](_0x327b88(0xdb)));if(!_0x16ad9d)continue;try{let _0x2345c8=JSON[_0x327b88(0xd5)](_0x16ad9d['slice'](0x6));if(await a(_0x2345c8),_0x2345c8[_0x327b88(0xbd)]===_0x327b88(0x12e)){if(_0x1b5f1d=null,!_0x4f15ba)await l();_0x4f15ba=!0x1;}}catch(_0x5f0bfd){W(_0x327b88(0xef)+_0x5f0bfd);}}}W(_0x327b88(0x132));}catch(_0x41f9f6){W(_0x327b88(0x117)+_0x41f9f6);}if(_0x1b5f1d=_0x1b5f1d??Date[_0x327b88(0x11f)](),Date['now']()-_0x1b5f1d>T){W(_0x327b88(0x10d)+j+')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。');return;}await N(_0x5b5e11),_0x5b5e11=Math[_0x327b88(0xc6)](_0x5b5e11*0x2,R);}}async function a(_0x3042ea){const _0x46df54=a0_0x2ef949;if(_0x3042ea[_0x46df54(0xbd)]===_0x46df54(0x12e)){W(_0x46df54(0x108)+G+'\x22');return;}if(_0x3042ea['type']===_0x46df54(0x103)){if(W('←\x20message\x20from\x20'+_0x3042ea[_0x46df54(0xf0)]+':\x20'+_0x3042ea[_0x46df54(0xca)]['slice'](0x0,0x3c)),await x['notification']({'method':_0x46df54(0xb7),'params':{'content':_0x3042ea[_0x46df54(0xca)],'meta':{'sender':_0x3042ea['from']||'hub','sender_id':'commhub','user':_0x3042ea['from']||_0x46df54(0xf3),'priority':'normal'}}}),_0x3042ea[_0x46df54(0xaa)])await Y(_0x46df54(0x135),{'alias':G,'message_id':_0x3042ea['message_id']});return;}if(_0x3042ea[_0x46df54(0xbd)]===_0x46df54(0x13c)||_0x3042ea[_0x46df54(0xbd)]==='broadcast'){W('←\x20'+_0x3042ea[_0x46df54(0xbd)]+_0x46df54(0xc8)+_0x3042ea[_0x46df54(0xe5)]+'\x20priority='+(_0x3042ea[_0x46df54(0xf8)]||'normal'));let _0x1b5b31=await Y(_0x46df54(0x11b),{'alias':G,'limit':0x5});if(_0x1b5b31?.['ok']&&_0x1b5b31[_0x46df54(0x114)]?.[_0x46df54(0x133)]>0x0)for(let _0x142952 of _0x1b5b31['messages']){let _0x41ced0={'sender':_0x142952[_0x46df54(0xb2)]||_0x46df54(0xf3),'sender_id':'commhub','user':_0x142952[_0x46df54(0xb2)]||'hub','task_id':_0x142952['id'],'priority':_0x142952[_0x46df54(0xf8)]||'normal'};D[_0x46df54(0xe0)](_0x142952['id'],_0x142952[_0x46df54(0xb2)]||_0x46df54(0xf3)),await x[_0x46df54(0xc4)]({'method':'notifications/claude/channel','params':{'content':_0x142952[_0x46df54(0xf7)],'meta':_0x41ced0}}),W(_0x46df54(0xfc)+_0x142952['id']['slice'](0x0,0x8)+_0x46df54(0xe1)+_0x142952[_0x46df54(0xb2)]+':\x20'+_0x142952['content'][_0x46df54(0xcf)](0x0,0x3c)),await Y(_0x46df54(0x135),{'alias':G,'message_id':_0x142952['id']});}}}async function n(){const _0x4506d7=a0_0x2ef949;let _0x3df388=new a0_0x413ca9();await x[_0x4506d7(0xd3)](_0x3df388),W(_0x4506d7(0xee)),W(_0x4506d7(0xfa)),o()['catch'](_0x4afe0d=>W(_0x4506d7(0x11a)+_0x4afe0d)),Y(_0x4506d7(0xde),{'resume_id':K,'alias':G,'status':_0x4506d7(0xea),'server':a0_0x4c64de(),'hostname':a0_0x4c64de(),'agent':_0x4506d7(0xd1),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x4506d7(0x134)](()=>W(_0x4506d7(0x124)+G+_0x4506d7(0xfb)+K[_0x4506d7(0xcf)](0x0,0x8)+')'))[_0x4506d7(0x122)](_0x19e17e=>W(_0x4506d7(0xed)+_0x19e17e)),setInterval(()=>{const _0xb74d9d=_0x4506d7;Y(_0xb74d9d(0xde),{'resume_id':K,'alias':G,'status':_0xb74d9d(0xea),'server':a0_0x4c64de(),'hostname':a0_0x4c64de(),'agent':_0xb74d9d(0xd1),'project_dir':process[_0xb74d9d(0xb4)](),'tmux_name':f||void 0x0})[_0xb74d9d(0x122)](_0x41d28e=>W(_0xb74d9d(0x111)+_0x41d28e));},0x2bf20),W('ready\x20—\x20waiting\x20for\x20events');}n()['catch'](_0x2ab1d4=>{const _0x5e9678=a0_0x2ef949;W(_0x5e9678(0xf6)+_0x2ab1d4),process[_0x5e9678(0x128)](0x1);});async function b(){const _0x2ade01=a0_0x2ef949;W(_0x2ade01(0xd0)),await Y(_0x2ade01(0xde),{'resume_id':K,'alias':G,'status':_0x2ade01(0x130),'task':_0x2ade01(0xa5)})['catch'](()=>{}),process[_0x2ade01(0x128)](0x0);}process['stdin']['on'](a0_0x2ef949(0xdf),()=>b()),process['on'](a0_0x2ef949(0x101),()=>b()),process['on']('SIGINT',()=>b());
2
+ const a0_0x2f6489=a0_0x910f;(function(_0x10285f,_0x31ae8e){const _0x252300=a0_0x910f,_0x29240d=_0x10285f();while(!![]){try{const _0x240ff0=-parseInt(_0x252300(0x1d7))/0x1*(-parseInt(_0x252300(0x235))/0x2)+-parseInt(_0x252300(0x1d5))/0x3*(-parseInt(_0x252300(0x220))/0x4)+-parseInt(_0x252300(0x1b3))/0x5+-parseInt(_0x252300(0x221))/0x6+-parseInt(_0x252300(0x23e))/0x7*(parseInt(_0x252300(0x1cd))/0x8)+parseInt(_0x252300(0x20b))/0x9+parseInt(_0x252300(0x201))/0xa;if(_0x240ff0===_0x31ae8e)break;else _0x29240d['push'](_0x29240d['shift']());}catch(_0x7d01d6){_0x29240d['push'](_0x29240d['shift']());}}}(a0_0x26a1,0x6ff10));import{readFileSync as a0_0x125c3b,existsSync as a0_0x4d8313}from'fs';import{randomUUID as a0_0x57c336}from'crypto';import{join as a0_0x293d60}from'path';import{hostname as a0_0x26e9c9}from'os';import{execSync as a0_0x4c624f}from'child_process';import{Server as a0_0x11b58c}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x57ed7a}from'@modelcontextprotocol/sdk/server/stdio.js';function a0_0x910f(_0x5d44f4,_0x2fe00d){_0x5d44f4=_0x5d44f4-0x1af;const _0x26a11c=a0_0x26a1();let _0x910f7=_0x26a11c[_0x5d44f4];return _0x910f7;}import{ListToolsRequestSchema as a0_0x4a3abc,CallToolRequestSchema as a0_0x49d6db}from'@modelcontextprotocol/sdk/types.js';function I(_0x912882){const _0x5b7df3=a0_0x910f;if(!a0_0x4d8313(_0x912882))return;for(let _0x161f68 of a0_0x125c3b(_0x912882,_0x5b7df3(0x236))[_0x5b7df3(0x1d4)]('\x0a')){let _0x28c117=_0x161f68[_0x5b7df3(0x244)]();if(!_0x28c117||_0x28c117[_0x5b7df3(0x246)]('#'))continue;let _0x13a768=_0x28c117['indexOf']('=');if(_0x13a768<0x0)continue;let _0x3ed58c=_0x28c117[_0x5b7df3(0x210)](0x0,_0x13a768)[_0x5b7df3(0x244)](),_0x287877=_0x28c117[_0x5b7df3(0x210)](_0x13a768+0x1)[_0x5b7df3(0x244)]()[_0x5b7df3(0x208)](/^["']|["']$/g,'');if(!process.env[_0x3ed58c])process.env[_0x3ed58c]=_0x287877;}}var L=process.env.HOME||'~',U=a0_0x293d60(L,a0_0x2f6489(0x1e3));I(a0_0x293d60(U,a0_0x2f6489(0x1e1)));var v=process[a0_0x2f6489(0x1dd)]()[a0_0x2f6489(0x208)](/\//g,'-');I(a0_0x293d60(U,v,a0_0x2f6489(0x1e1)));function d(){const _0x3b3e6c=a0_0x2f6489;try{return a0_0x4c624f(_0x3b3e6c(0x1c1),{'encoding':_0x3b3e6c(0x236),'timeout':0x7d0})[_0x3b3e6c(0x244)]();}catch{return'';}}function m(){const _0x1c7b18=a0_0x2f6489;try{let _0x2f66c3=a0_0x293d60(L,'.anet',_0x1c7b18(0x1d9));if(a0_0x4d8313(_0x2f66c3))return JSON['parse'](a0_0x125c3b(_0x2f66c3,_0x1c7b18(0x236)));}catch{}return{};}var u=m(),j=process.env.COMMHUB_URL||u[a0_0x2f6489(0x1ce)]||a0_0x2f6489(0x24b),f=process.env.COMMHUB_TMUX||d();function r(){const _0x3a4531=a0_0x2f6489;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS['trim']())return process.env.COMMHUB_ALIAS['trim']();return process[_0x3a4531(0x22d)][_0x3a4531(0x1bc)](_0x3a4531(0x21c)+(_0x3a4531(0x1c7)+(f||_0x3a4531(0x1ff))+_0x3a4531(0x1c9)+a0_0x26e9c9()+_0x3a4531(0x230))),_0x3a4531(0x243)+process[_0x3a4531(0x234)];}var G=r(),K=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x57c336(),F=process.env.COMMHUB_TOKEN||u[a0_0x2f6489(0x1d6)]||'';function W(_0x432d7e){const _0x1f663a=a0_0x2f6489;let _0x3ac2ec=new Date()[_0x1f663a(0x1f3)]()[_0x1f663a(0x210)](0x0,0x8);process['stderr']['write']('['+_0x3ac2ec+_0x1f663a(0x23b)+_0x432d7e+'\x0a');}function N(_0x5b13a9){return new Promise(_0x32ec43=>setTimeout(_0x32ec43,_0x5b13a9));}W(a0_0x2f6489(0x24a)+j+a0_0x2f6489(0x245)+G+a0_0x2f6489(0x1cb)+K[a0_0x2f6489(0x210)](0x0,0x8)+'...\x20TMUX='+(f||a0_0x2f6489(0x218))+a0_0x2f6489(0x242)+process[a0_0x2f6489(0x1dd)]()+a0_0x2f6489(0x1cc)+v);var D=new Map(),x=new a0_0x11b58c({'name':a0_0x2f6489(0x228),'version':a0_0x2f6489(0x20d)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x2f6489(0x1af),a0_0x2f6489(0x1b8),a0_0x2f6489(0x240),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Session\x20alias:\x20'+G][a0_0x2f6489(0x1f5)]('\x0a')});x[a0_0x2f6489(0x214)](a0_0x4a3abc,async()=>({'tools':[{'name':a0_0x2f6489(0x1f4),'description':a0_0x2f6489(0x204),'inputSchema':{'type':a0_0x2f6489(0x1dc),'properties':{'task_id':{'type':a0_0x2f6489(0x1c6),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x2f6489(0x1c6),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x2f6489(0x1c6),'enum':[a0_0x2f6489(0x1c0),a0_0x2f6489(0x1b7),a0_0x2f6489(0x1be),'blocked','error','in_progress'],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x2f6489(0x1e4)]}},{'name':a0_0x2f6489(0x1ea),'description':a0_0x2f6489(0x1b0),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x2f6489(0x1c6),'enum':[a0_0x2f6489(0x1f9),'idle',a0_0x2f6489(0x20e),a0_0x2f6489(0x1fa)]},'task':{'type':'string','description':a0_0x2f6489(0x21a)},'progress':{'type':a0_0x2f6489(0x224),'description':'Progress\x200-100'}},'required':[a0_0x2f6489(0x1b2)]}},{'name':a0_0x2f6489(0x22f),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x2f6489(0x1dc),'properties':{'alias':{'type':a0_0x2f6489(0x1c6),'description':a0_0x2f6489(0x1ef)},'task':{'type':a0_0x2f6489(0x1c6),'description':a0_0x2f6489(0x1ba)},'priority':{'type':a0_0x2f6489(0x1c6),'enum':[a0_0x2f6489(0x206),a0_0x2f6489(0x1bd),'low'],'description':a0_0x2f6489(0x1f1)}},'required':[a0_0x2f6489(0x1d1),'task']}},{'name':a0_0x2f6489(0x241),'description':a0_0x2f6489(0x203),'inputSchema':{'type':a0_0x2f6489(0x1dc),'properties':{'alias':{'type':a0_0x2f6489(0x1c6),'description':a0_0x2f6489(0x1ef)},'message':{'type':'string','description':a0_0x2f6489(0x1da)}},'required':[a0_0x2f6489(0x1d1),a0_0x2f6489(0x225)]}},{'name':'commhub_get_all_status','description':a0_0x2f6489(0x219),'inputSchema':{'type':a0_0x2f6489(0x1dc),'properties':{}}}]}));async function Y(_0x43e00e,_0x330ede){const _0x5ad611=a0_0x2f6489;let _0xeb0fe3=await fetch(j+_0x5ad611(0x1bf),{'method':'POST','headers':{'Content-Type':_0x5ad611(0x1fd),'Accept':'application/json,\x20text/event-stream',...F?{'Authorization':_0x5ad611(0x21d)+F}:{}},'body':JSON[_0x5ad611(0x1c4)]({'jsonrpc':'2.0','id':0x1,'method':_0x5ad611(0x215),'params':{'protocolVersion':_0x5ad611(0x20c),'capabilities':{},'clientInfo':{'name':_0x5ad611(0x228),'version':_0x5ad611(0x20d)}}})});if(!_0xeb0fe3['ok']){let _0x21e042=await _0xeb0fe3['text']();return W(_0x5ad611(0x216)+_0xeb0fe3[_0x5ad611(0x1b2)]+'\x20'+_0x21e042[_0x5ad611(0x210)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0xeb0fe3[_0x5ad611(0x1b2)]};}await _0xeb0fe3[_0x5ad611(0x1e4)]();let _0x2e6801=(await(await fetch(j+_0x5ad611(0x1bf),{'method':_0x5ad611(0x223),'headers':{'Content-Type':_0x5ad611(0x1fd),'Accept':'application/json,\x20text/event-stream',...F?{'Authorization':_0x5ad611(0x21d)+F}:{}},'body':JSON[_0x5ad611(0x1c4)]({'jsonrpc':_0x5ad611(0x232),'id':0x2,'method':_0x5ad611(0x1b9),'params':{'name':_0x43e00e,'arguments':_0x330ede}})}))[_0x5ad611(0x1e4)]())[_0x5ad611(0x1d4)]('\x0a')[_0x5ad611(0x239)](_0x50e346=>_0x50e346[_0x5ad611(0x246)](_0x5ad611(0x226)));if(_0x2e6801){let _0x558dbe=JSON[_0x5ad611(0x231)](_0x2e6801[_0x5ad611(0x210)](0x6));return _0x558dbe?.[_0x5ad611(0x238)]?.[_0x5ad611(0x1c8)]?.[0x0]?.[_0x5ad611(0x1e4)]?JSON[_0x5ad611(0x231)](_0x558dbe[_0x5ad611(0x238)][_0x5ad611(0x1c8)][0x0][_0x5ad611(0x1e4)]):_0x558dbe;}return{'ok':!0x1,'error':_0x5ad611(0x247)};}x[a0_0x2f6489(0x214)](a0_0x49d6db,async _0x6c7e78=>{const _0x67f01=a0_0x2f6489;let {name:_0x5d7ba4,arguments:_0x4bd0a8}=_0x6c7e78['params'];if(_0x5d7ba4===_0x67f01(0x1f4)){let {task_id:_0x97858b,text:_0x2a3a1a,status:_0x27e114}=_0x4bd0a8;if(_0x27e114===_0x67f01(0x1c0)||_0x27e114==='failed'||_0x27e114===_0x67f01(0x1be)){let _0x25d572=_0x27e114==='completed'?_0x67f01(0x233):_0x27e114,_0x368820=_0x97858b?D[_0x67f01(0x213)](_0x97858b)||_0x67f01(0x1ce):_0x67f01(0x1ce),_0x143467=await Y(_0x67f01(0x1f8),{'alias':_0x368820,'text':_0x2a3a1a,'in_reply_to':_0x97858b||void 0x0,'status':_0x25d572,'from_session':G});if(_0x97858b)D[_0x67f01(0x1e6)](_0x97858b);return{'content':[{'type':_0x67f01(0x1e4),'text':JSON[_0x67f01(0x1c4)](_0x143467)}]};}let _0x45b44e=await Y(_0x67f01(0x1d0),{'resume_id':K,'alias':G,'status':_0x27e114==='blocked'?'blocked':_0x27e114==='error'?_0x67f01(0x1fa):_0x67f01(0x1f9),'task':_0x2a3a1a[_0x67f01(0x210)](0x0,0xc8),'output':_0x2a3a1a});return{'content':[{'type':_0x67f01(0x1e4),'text':JSON[_0x67f01(0x1c4)](_0x45b44e)}]};}if(_0x5d7ba4===_0x67f01(0x1ea)){let {status:_0x243ced,task:_0x6b3607,progress:_0x24b30b}=_0x4bd0a8,_0x5cf599=await Y(_0x67f01(0x1d0),{'resume_id':K,'alias':G,'status':_0x243ced,'task':_0x6b3607,'progress':_0x24b30b});return{'content':[{'type':'text','text':JSON[_0x67f01(0x1c4)](_0x5cf599)}]};}if(_0x5d7ba4===_0x67f01(0x22f)){let {alias:_0x2774a0,task:_0x21befa,priority:_0x718814}=_0x4bd0a8,_0x5adf2f=await Y(_0x67f01(0x209),{'alias':_0x2774a0,'task':_0x21befa,'priority':_0x718814||_0x67f01(0x1bd),'from_session':G});return{'content':[{'type':_0x67f01(0x1e4),'text':JSON[_0x67f01(0x1c4)](_0x5adf2f)}]};}if(_0x5d7ba4==='commhub_send_message'){let {alias:_0x55f867,message:_0x119296}=_0x4bd0a8,_0x37cfcf=await Y(_0x67f01(0x237),{'alias':_0x55f867,'message':_0x119296,'from_session':G});return{'content':[{'type':_0x67f01(0x1e4),'text':JSON[_0x67f01(0x1c4)](_0x37cfcf)}]};}if(_0x5d7ba4===_0x67f01(0x249)){let _0x475d0b=await Y(_0x67f01(0x1f0),{});return{'content':[{'type':_0x67f01(0x1e4),'text':JSON[_0x67f01(0x1c4)](_0x475d0b)}]};}return{'content':[{'type':_0x67f01(0x1e4),'text':JSON['stringify']({'error':_0x67f01(0x1b4)})}]};});var O=0x3e8,R=0x7530,T=0x36ee80;async function l(){const _0x328c5e=a0_0x2f6489;try{await Y(_0x328c5e(0x1d0),{'resume_id':K,'alias':G,'status':_0x328c5e(0x1e9),'server':a0_0x26e9c9(),'hostname':a0_0x26e9c9(),'agent':_0x328c5e(0x1f2),'project_dir':process[_0x328c5e(0x1dd)](),'tmux_name':f||void 0x0}),W(_0x328c5e(0x21f)+G+'\x22\x20after\x20SSE\x20reconnect');}catch(_0x807f81){W(_0x328c5e(0x1cf)+_0x807f81);}}async function o(){const _0x462214=a0_0x2f6489;let _0x2b4bf=j+_0x462214(0x20a)+encodeURIComponent(G),_0x6d743f={};if(F)_0x6d743f[_0x462214(0x1fe)]=_0x462214(0x21d)+F;W(_0x462214(0x1e0)+_0x2b4bf);let _0x29848f=O,_0x4dd33d=!0x0,_0x85c049=null;while(!0x0){try{let _0x2ce17d=await fetch(_0x2b4bf,{'headers':_0x6d743f});if(!_0x2ce17d['ok']){if(W(_0x462214(0x1f6)+_0x2ce17d[_0x462214(0x1b2)]+'\x20'+_0x2ce17d['statusText']),_0x85c049=_0x85c049??Date[_0x462214(0x1db)](),Date['now']()-_0x85c049>T){W(_0x462214(0x217)+j+_0x462214(0x22a));return;}await N(_0x29848f),_0x29848f=Math[_0x462214(0x24c)](_0x29848f*0x2,R);continue;}let _0x68713e=_0x2ce17d[_0x462214(0x1c3)][_0x462214(0x1ee)](),_0x37bc22=new TextDecoder(),_0x48b9e8='';_0x29848f=O;while(!0x0){let {done:_0x5848e3,value:_0x48e64b}=await _0x68713e[_0x462214(0x22e)]();if(_0x5848e3)break;_0x48b9e8+=_0x37bc22[_0x462214(0x1b6)](_0x48e64b,{'stream':!0x0});let _0x109970=_0x48b9e8[_0x462214(0x1d4)]('\x0a\x0a');_0x48b9e8=_0x109970[_0x462214(0x207)]()||'';for(let _0x464724 of _0x109970){let _0x5bb1ec=_0x464724[_0x462214(0x1d4)]('\x0a')[_0x462214(0x239)](_0x257d8a=>_0x257d8a['startsWith'](_0x462214(0x226)));if(!_0x5bb1ec)continue;try{let _0x3904b3=JSON['parse'](_0x5bb1ec[_0x462214(0x210)](0x6));if(await a(_0x3904b3),_0x3904b3['type']===_0x462214(0x205)){if(_0x85c049=null,!_0x4dd33d)await l();_0x4dd33d=!0x1;}}catch(_0x195748){W('parse\x20error:\x20'+_0x195748);}}}W(_0x462214(0x248));}catch(_0x208427){W(_0x462214(0x1e7)+_0x208427);}if(_0x85c049=_0x85c049??Date['now'](),Date[_0x462214(0x1db)]()-_0x85c049>T){W(_0x462214(0x217)+j+_0x462214(0x22a));return;}await N(_0x29848f),_0x29848f=Math[_0x462214(0x24c)](_0x29848f*0x2,R);}}async function a(_0x3cb4d0){const _0x177a92=a0_0x2f6489;if(_0x3cb4d0[_0x177a92(0x23c)]===_0x177a92(0x205)){W(_0x177a92(0x1b1)+G+'\x22');return;}if(_0x3cb4d0[_0x177a92(0x23c)]===_0x177a92(0x23f)){if(W(_0x177a92(0x23d)+_0x3cb4d0[_0x177a92(0x1d2)]+':\x20'+_0x3cb4d0[_0x177a92(0x225)][_0x177a92(0x210)](0x0,0x3c)),await x['notification']({'method':_0x177a92(0x1fc),'params':{'content':_0x3cb4d0[_0x177a92(0x225)],'meta':{'sender':_0x3cb4d0[_0x177a92(0x1d2)]||_0x177a92(0x1ce),'sender_id':_0x177a92(0x1eb),'user':_0x3cb4d0['from']||_0x177a92(0x1ce),'priority':_0x177a92(0x1bd)}}}),_0x3cb4d0[_0x177a92(0x23a)])await Y('ack_inbox',{'alias':G,'message_id':_0x3cb4d0['message_id']});return;}if(_0x3cb4d0[_0x177a92(0x23c)]===_0x177a92(0x222)||_0x3cb4d0[_0x177a92(0x23c)]===_0x177a92(0x229)){W('←\x20'+_0x3cb4d0[_0x177a92(0x23c)]+':\x20inbox_count='+_0x3cb4d0[_0x177a92(0x20f)]+'\x20priority='+(_0x3cb4d0[_0x177a92(0x1c5)]||_0x177a92(0x1bd)));let _0x45477f=await Y(_0x177a92(0x227),{'alias':G,'limit':0x5});if(_0x45477f?.['ok']&&_0x45477f['messages']?.['length']>0x0)for(let _0x1456fe of _0x45477f[_0x177a92(0x1df)]){let _0x2867d5={'sender':_0x1456fe[_0x177a92(0x1d8)]||_0x177a92(0x1ce),'sender_id':_0x177a92(0x1eb),'user':_0x1456fe[_0x177a92(0x1d8)]||'hub','task_id':_0x1456fe['id'],'priority':_0x1456fe[_0x177a92(0x1c5)]||_0x177a92(0x1bd)};D[_0x177a92(0x1fb)](_0x1456fe['id'],_0x1456fe['from_session']||_0x177a92(0x1ce)),await x[_0x177a92(0x22c)]({'method':_0x177a92(0x1fc),'params':{'content':_0x1456fe[_0x177a92(0x1c8)],'meta':_0x2867d5}}),W(_0x177a92(0x21b)+_0x1456fe['id'][_0x177a92(0x210)](0x0,0x8)+_0x177a92(0x1f7)+_0x1456fe[_0x177a92(0x1d8)]+':\x20'+_0x1456fe[_0x177a92(0x1c8)]['slice'](0x0,0x3c)),await Y(_0x177a92(0x1de),{'alias':G,'message_id':_0x1456fe['id']});}}}async function n(){const _0x67c7e0=a0_0x2f6489;let _0x4b278a=new a0_0x57ed7a();await x[_0x67c7e0(0x1d3)](_0x4b278a),W(_0x67c7e0(0x1bb)),W(_0x67c7e0(0x1ed)),o()[_0x67c7e0(0x21e)](_0x44845c=>W('SSE\x20fatal:\x20'+_0x44845c)),Y(_0x67c7e0(0x1d0),{'resume_id':K,'alias':G,'status':_0x67c7e0(0x1e9),'server':a0_0x26e9c9(),'hostname':a0_0x26e9c9(),'agent':_0x67c7e0(0x1f2),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x67c7e0(0x22b)](()=>W(_0x67c7e0(0x1ca)+G+_0x67c7e0(0x212)+K['slice'](0x0,0x8)+')'))['catch'](_0x2d793d=>W(_0x67c7e0(0x1c2)+_0x2d793d)),setInterval(()=>{const _0x29e1c4=_0x67c7e0;Y(_0x29e1c4(0x1d0),{'resume_id':K,'alias':G,'status':_0x29e1c4(0x1e9),'server':a0_0x26e9c9(),'hostname':a0_0x26e9c9(),'agent':'claude-code','project_dir':process[_0x29e1c4(0x1dd)](),'tmux_name':f||void 0x0})['catch'](_0x3266a1=>W(_0x29e1c4(0x1b5)+_0x3266a1));},0x2bf20),W('ready\x20—\x20waiting\x20for\x20events');}n()[a0_0x2f6489(0x21e)](_0x5cf806=>{const _0x544197=a0_0x2f6489;W(_0x544197(0x200)+_0x5cf806),process[_0x544197(0x1e2)](0x1);});async function b(){const _0x4792be=a0_0x2f6489;W(_0x4792be(0x1ec)),await Y(_0x4792be(0x1d0),{'resume_id':K,'alias':G,'status':_0x4792be(0x1e5),'task':_0x4792be(0x202)})['catch'](()=>{}),process['exit'](0x0);}function a0_0x26a1(){const _0x16e9a3=['Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','connected','high','pop','replace','send_task','/events/','2098539ewpQsv','2025-03-26','0.3.0','blocked','inbox_count','slice','SIGINT','\x22\x20(','get','setRequestHandler','initialize','CommHub\x20init\x20failed:\x20','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','none','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','Current\x20task\x20description','→\x20injected\x20task\x20','[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20','Bearer\x20','catch','re-registered\x20as\x20\x22','135384SjeJgn','1809060PeZmym','new_task','POST','number','message','data:\x20','get_inbox','commhub-channel','broadcast',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','then','notification','stderr','read','commhub_send_task','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','parse','2.0','replied','pid','4vEJiwy','utf-8','send_message','result','find','message_id',']\x20[commhub]\x20','type','←\x20message\x20from\x20','105WmlXAI','new_message','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','commhub_send_message','\x20CWD=','unattributed-','trim','\x20ALIAS=','startsWith','no\x20response','SSE\x20stream\x20ended,\x20reconnecting...','commhub_get_all_status','ENV:\x20URL=','http://127.0.0.1:9200','min','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','SSE\x20connected\x20as\x20\x22','status','1671705ttOHou','unknown\x20tool','heartbeat\x20failed:\x20','decode','failed','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','tools/call','Task\x20content','MCP\x20stdio\x20connected','write','normal','cancelled','/mcp','completed','tmux\x20display-message\x20-p\x20\x27#S\x27','warning:\x20could\x20not\x20register:\x20','body','stringify','priority','string','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','content','\x20/\x20hostname=','registered\x20as\x20\x22','\x20RESUME_ID=','\x20PROJECT_ENV=','206224mpKvdl','hub','re-register\x20failed:\x20','report_status','alias','from','connect','split','51PSphXB','token','253513AuHoLA','from_session','config.json','Message\x20content','now','object','cwd','ack_inbox','messages','connecting\x20to\x20','.env','exit','.claude/channels/commhub','text','offline','delete','SSE\x20connection\x20error:\x20','SIGTERM','idle','commhub_report_status','commhub','shutting\x20down,\x20reporting\x20offline...','starting\x20SSE\x20listener...','getReader','Target\x20session\x20alias','get_all_status','Priority\x20(default:\x20normal)','claude-code','toTimeString','commhub_reply','join','SSE\x20error:\x20','\x20from\x20','send_reply','working','error','set','notifications/claude/channel','application/json','Authorization','(none)','fatal:\x20','1654540KfjULG','session\x20disconnected','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.'];a0_0x26a1=function(){return _0x16e9a3;};return a0_0x26a1();}process['stdin']['on']('end',()=>b()),process['on'](a0_0x2f6489(0x1e8),()=>b()),process['on'](a0_0x2f6489(0x211),()=>b());
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.2.22-preview.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.",
3
+ "version": "2.3.0-preview.1",
4
+ "description": "AI Agent Network CLI \u2014 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",
7
7
  "types": "dist/client.d.ts",