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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- const a0_0x1b30c1=a0_0xb372;(function(_0x3a0358,_0x43b43e){const _0x83d370=a0_0xb372,_0x293098=_0x3a0358();while(!![]){try{const _0x218d21=-parseInt(_0x83d370(0x187))/0x1+-parseInt(_0x83d370(0x1a5))/0x2*(-parseInt(_0x83d370(0x1af))/0x3)+-parseInt(_0x83d370(0x1ab))/0x4+parseInt(_0x83d370(0x18c))/0x5*(parseInt(_0x83d370(0x199))/0x6)+-parseInt(_0x83d370(0x1a4))/0x7*(parseInt(_0x83d370(0x17d))/0x8)+parseInt(_0x83d370(0x176))/0x9+parseInt(_0x83d370(0x167))/0xa;if(_0x218d21===_0x43b43e)break;else _0x293098['push'](_0x293098['shift']());}catch(_0x5cac13){_0x293098['push'](_0x293098['shift']());}}}(a0_0x2f4e,0xe51a0));function a0_0xb372(_0x1a4b56,_0x476a88){_0x1a4b56=_0x1a4b56-0x162;const _0x2f4e0c=a0_0x2f4e();let _0xb372b8=_0x2f4e0c[_0x1a4b56];return _0xb372b8;}import{EventEmitter as a0_0x5b58cb}from'events';function a0_0x2f4e(){const _0x238abe=['sdk','send_message','998066iMbaLn','catch','getReader','alias','connected','395YzCqwZ','get_inbox','read','result','processInbox','signal','slice','resumeId','abort','/mcp','sleep','new_message','decode','115764MPTimn','AbortError','completed','from_session','split','task','broadcast','registered','text','heartbeatInterval','call','518DmqJqs','2349326RBlRmO','reply',']\x20[commhub:','idle','running','send_reply','7345580BORbZw','connect','min','report_status','3UtGgsF','application/json,\x20text/event-stream','content','data:\x20','status','url','inbox\x20error:\x20','/events/','emit','getAllStatus','sdk-','heartbeatTimer','token','now','get_all_status','13805240eLDNUU','stringify','toTimeString','application/json','type','disconnect','send_task','replace','message','normal','cwd','log','reconnectDelay','Bearer\x20','sseAbort','9521406HbLFCX','send','disconnected','startsWith','toString','offline','SSE\x20failed:\x20','147512FTYtvw','SSE\x20connected','Authorization','agent','connectSSE','SSE\x20error:\x20','body','parse'];a0_0x2f4e=function(){return _0x238abe;};return a0_0x2f4e();}import{hostname as a0_0x2ebe85}from'os';class T extends a0_0x5b58cb{[a0_0x1b30c1(0x1b4)];[a0_0x1b30c1(0x18a)];[a0_0x1b30c1(0x164)];[a0_0x1b30c1(0x180)];[a0_0x1b30c1(0x193)];[a0_0x1b30c1(0x1a2)];['reconnectDelay'];['heartbeatTimer'];[a0_0x1b30c1(0x175)];[a0_0x1b30c1(0x1a9)]=!0x1;constructor(_0x2acb24){const _0x55cf9d=a0_0x1b30c1;super();if(this[_0x55cf9d(0x1b4)]=_0x2acb24['url'][_0x55cf9d(0x16e)](/\/$/,''),this[_0x55cf9d(0x18a)]=_0x2acb24[_0x55cf9d(0x18a)],this[_0x55cf9d(0x164)]=_0x2acb24[_0x55cf9d(0x164)],this[_0x55cf9d(0x180)]=_0x2acb24['agent']||_0x55cf9d(0x185),this[_0x55cf9d(0x193)]=_0x55cf9d(0x162)+_0x2acb24[_0x55cf9d(0x18a)]+'-'+Date[_0x55cf9d(0x165)]()[_0x55cf9d(0x17a)](0x24),this[_0x55cf9d(0x1a2)]=_0x2acb24['heartbeatInterval']??0x2bf20,this[_0x55cf9d(0x173)]=_0x2acb24[_0x55cf9d(0x173)]??0xbb8,_0x2acb24['autoConnect']!==!0x1)this[_0x55cf9d(0x1ac)]();}['log'](_0x16d8ba){const _0x245e9f=a0_0x1b30c1;console[_0x245e9f(0x172)]('['+new Date()[_0x245e9f(0x169)]()['slice'](0x0,0x8)+_0x245e9f(0x1a7)+this[_0x245e9f(0x18a)]+']\x20'+_0x16d8ba);}async[a0_0x1b30c1(0x1a3)](_0x2f0392,_0x3267be){const _0x29a3c9=a0_0x1b30c1;let _0x29bf2={'Content-Type':_0x29a3c9(0x16a),'Accept':_0x29a3c9(0x1b0)};if(this[_0x29a3c9(0x164)])_0x29bf2[_0x29a3c9(0x17f)]=_0x29a3c9(0x174)+this['token'];let _0x13c4e5=await(await fetch(this[_0x29a3c9(0x1b4)]+_0x29a3c9(0x195),{'method':'POST','headers':_0x29bf2,'body':JSON[_0x29a3c9(0x168)]({'jsonrpc':'2.0','id':Date['now'](),'method':'tools/call','params':{'name':_0x2f0392,'arguments':_0x3267be}})}))[_0x29a3c9(0x1a1)](),_0x5c957f=_0x13c4e5['match'](/data: (.+)/),_0x4ef2a8=_0x5c957f?JSON[_0x29a3c9(0x184)](_0x5c957f[0x1]):JSON['parse'](_0x13c4e5),_0x44992d=_0x4ef2a8?.[_0x29a3c9(0x18f)]?.[_0x29a3c9(0x1b1)]?.[0x0]?.[_0x29a3c9(0x1a1)];return _0x44992d?JSON['parse'](_0x44992d):_0x4ef2a8;}async[a0_0x1b30c1(0x1ac)](){const _0x1c3faa=a0_0x1b30c1;if(this[_0x1c3faa(0x1a9)])return;this[_0x1c3faa(0x1a9)]=!0x0,await this['status'](_0x1c3faa(0x1a8)),this[_0x1c3faa(0x172)](_0x1c3faa(0x1a0)),this[_0x1c3faa(0x163)]=setInterval(()=>{const _0x227a25=_0x1c3faa;this[_0x227a25(0x1b3)]('idle')['catch'](_0x43631f=>this[_0x227a25(0x172)]('heartbeat\x20failed:\x20'+_0x43631f[_0x227a25(0x16f)]));},this['heartbeatInterval']),this[_0x1c3faa(0x181)]();}async[a0_0x1b30c1(0x16c)](){const _0x4144aa=a0_0x1b30c1;if(this[_0x4144aa(0x1a9)]=!0x1,this[_0x4144aa(0x175)]?.[_0x4144aa(0x194)](),this[_0x4144aa(0x163)])clearInterval(this[_0x4144aa(0x163)]);await this['status'](_0x4144aa(0x17b))[_0x4144aa(0x188)](()=>{}),this[_0x4144aa(0x172)](_0x4144aa(0x178));}async[a0_0x1b30c1(0x177)](_0x5b95c8,_0x4798bb,_0x5f1f4f=a0_0x1b30c1(0x170)){const _0x1d414f=a0_0x1b30c1;return this[_0x1d414f(0x1a3)](_0x1d414f(0x16d),{'alias':_0x5b95c8,'task':_0x4798bb,'priority':_0x5f1f4f,'from_session':this['alias']});}async['message'](_0x3deb9f,_0xcb1a66){const _0x419537=a0_0x1b30c1;return this['call'](_0x419537(0x186),{'alias':_0x3deb9f,'message':_0xcb1a66,'from_session':this['alias']});}async[a0_0x1b30c1(0x1a6)](_0x4f7be7,_0x1ed4a9,_0x41b4ba=a0_0x1b30c1(0x19b)){const _0x5dcbed=a0_0x1b30c1;return this[_0x5dcbed(0x1a3)](_0x5dcbed(0x1aa),{'in_reply_to':_0x4f7be7,'text':_0x1ed4a9,'status':_0x41b4ba});}async[a0_0x1b30c1(0x1b3)](_0x392f75,_0x1d4ec0){const _0x4c0068=a0_0x1b30c1;return this['call'](_0x4c0068(0x1ae),{'resume_id':this[_0x4c0068(0x193)],'alias':this[_0x4c0068(0x18a)],'status':_0x392f75,'server':a0_0x2ebe85(),'hostname':a0_0x2ebe85(),'agent':this[_0x4c0068(0x180)],'project_dir':process[_0x4c0068(0x171)](),..._0x1d4ec0});}async[a0_0x1b30c1(0x1b8)](){const _0x599265=a0_0x1b30c1;return this[_0x599265(0x1a3)](_0x599265(0x166),{});}async[a0_0x1b30c1(0x19f)](_0x595bb7,_0x400361){const _0xa0d664=a0_0x1b30c1;return this[_0xa0d664(0x1a3)](_0xa0d664(0x19f),{'message':_0x595bb7,'filter_server':_0x400361?.['server'],'filter_status':_0x400361?.[_0xa0d664(0x1b3)]});}async[a0_0x1b30c1(0x181)](){const _0x27ceb7=a0_0x1b30c1;let _0x3d3c92=encodeURIComponent(this[_0x27ceb7(0x18a)]),_0x5aba98=this[_0x27ceb7(0x1b4)]+_0x27ceb7(0x1b6)+_0x3d3c92,_0x192594=this[_0x27ceb7(0x173)];while(this[_0x27ceb7(0x1a9)]){try{this['sseAbort']=new AbortController();let _0x4abe4e={'Accept':'text/event-stream'};if(this[_0x27ceb7(0x164)])_0x4abe4e['Authorization']=_0x27ceb7(0x174)+this[_0x27ceb7(0x164)];let _0x5eed62=await fetch(_0x5aba98,{'headers':_0x4abe4e,'signal':this[_0x27ceb7(0x175)][_0x27ceb7(0x191)]});if(!_0x5eed62['ok']||!_0x5eed62['body']){this[_0x27ceb7(0x172)](_0x27ceb7(0x17c)+_0x5eed62[_0x27ceb7(0x1b3)]),await this[_0x27ceb7(0x196)](_0x192594),_0x192594=Math[_0x27ceb7(0x1ad)](_0x192594*1.5,0xea60);continue;}_0x192594=this[_0x27ceb7(0x173)];let _0x4496bf=_0x5eed62[_0x27ceb7(0x183)][_0x27ceb7(0x189)](),_0x592a1e=new TextDecoder(),_0x49b01='';while(this[_0x27ceb7(0x1a9)]){let {done:_0x222a5e,value:_0x1d578b}=await _0x4496bf[_0x27ceb7(0x18e)]();if(_0x222a5e)break;_0x49b01+=_0x592a1e[_0x27ceb7(0x198)](_0x1d578b,{'stream':!0x0});let _0x1f6f60=_0x49b01[_0x27ceb7(0x19d)]('\x0a');_0x49b01=_0x1f6f60['pop']()||'';for(let _0xc1e030 of _0x1f6f60){if(!_0xc1e030[_0x27ceb7(0x179)](_0x27ceb7(0x1b2)))continue;try{let _0x10c80c=JSON['parse'](_0xc1e030[_0x27ceb7(0x192)](0x6));if(_0x10c80c[_0x27ceb7(0x16b)]===_0x27ceb7(0x18b)){this['log'](_0x27ceb7(0x17e)),this[_0x27ceb7(0x1b7)]('connected');continue;}if(_0x10c80c[_0x27ceb7(0x16b)]==='new_task'||_0x10c80c['type']===_0x27ceb7(0x197)||_0x10c80c[_0x27ceb7(0x16b)]===_0x27ceb7(0x19f))await this[_0x27ceb7(0x190)]();}catch{}}}}catch(_0x1a4065){if(_0x1a4065['name']===_0x27ceb7(0x19a))break;this[_0x27ceb7(0x1b7)]('error',_0x1a4065),this[_0x27ceb7(0x172)](_0x27ceb7(0x182)+_0x1a4065[_0x27ceb7(0x16f)]);}if(this[_0x27ceb7(0x1a9)])this['emit'](_0x27ceb7(0x178)),this[_0x27ceb7(0x172)]('SSE\x20reconnecting\x20in\x20'+_0x192594/0x3e8+'s...'),await this[_0x27ceb7(0x196)](_0x192594),_0x192594=Math['min'](_0x192594*1.5,0xea60);}}async[a0_0x1b30c1(0x190)](){const _0x464f9d=a0_0x1b30c1;try{let _0x27cb92=(await this[_0x464f9d(0x1a3)](_0x464f9d(0x18d),{'alias':this[_0x464f9d(0x18a)],'limit':0xa}))?.['messages']||[];for(let _0x3ef2a7 of _0x27cb92)await this[_0x464f9d(0x1a3)]('ack_inbox',{'alias':this[_0x464f9d(0x18a)],'message_id':_0x3ef2a7['id']}),this[_0x464f9d(0x172)]('←\x20'+_0x3ef2a7[_0x464f9d(0x19c)]+':\x20'+_0x3ef2a7[_0x464f9d(0x1b1)][_0x464f9d(0x192)](0x0,0x3c)),this['emit'](_0x464f9d(0x19e),_0x3ef2a7),this[_0x464f9d(0x1b7)]('message',_0x3ef2a7);}catch(_0x19dd9f){this[_0x464f9d(0x172)](_0x464f9d(0x1b5)+_0x19dd9f[_0x464f9d(0x16f)]);}}[a0_0x1b30c1(0x196)](_0x5d9d7a){return new Promise(_0xd0eb37=>setTimeout(_0xd0eb37,_0x5d9d7a));}}var $=T;export{$ as default,T as CommHub};
1
+ const a0_0x2d582f=a0_0x61fc;(function(_0x5b8f9a,_0x472113){const _0x45cb21=a0_0x61fc,_0x238368=_0x5b8f9a();while(!![]){try{const _0x3804d0=-parseInt(_0x45cb21(0x17e))/0x1+-parseInt(_0x45cb21(0x169))/0x2+parseInt(_0x45cb21(0x16b))/0x3*(-parseInt(_0x45cb21(0x177))/0x4)+parseInt(_0x45cb21(0x151))/0x5+parseInt(_0x45cb21(0x158))/0x6*(parseInt(_0x45cb21(0x148))/0x7)+-parseInt(_0x45cb21(0x12f))/0x8+parseInt(_0x45cb21(0x163))/0x9;if(_0x3804d0===_0x472113)break;else _0x238368['push'](_0x238368['shift']());}catch(_0x575d4c){_0x238368['push'](_0x238368['shift']());}}}(a0_0x2c7c,0xcde10));import{EventEmitter as a0_0x453faf}from'events';import{hostname as a0_0x1d8542}from'os';function a0_0x2c7c(){const _0x3fa0a8=['pop','AbortError','heartbeatTimer','getReader','abort','1129400fTWqsr','message','cwd','text/event-stream','application/json','task','slice','sdk','send_task','3985400hIDMKU','broadcast','emit','messages','report_status','match','agent','from_session','name','call','reply','Bearer\x20','status','autoConnect','ack_inbox','new_task','sleep','decode','disconnected','resumeId','idle','reconnectDelay','registered','parse','text','5940067qOHoBu','alias','application/json,\x20text/event-stream','min','send_message','Authorization','POST','catch','SSE\x20error:\x20','1556480tWRtwl','server','read','s...','data:\x20','body','disconnect','6Unwnva','running','get_all_status','split','SSE\x20reconnecting\x20in\x20','send','sdk-','send_reply','SSE\x20connected','heartbeatInterval','processInbox','27262188MuFlJa','tools/call','/events/','type','token','stringify','3142020PPGTJL','now','36tEXeWc','inbox\x20error:\x20','sseAbort','log','connectSSE','error','new_message','content','SSE\x20failed:\x20','url','connected','get_inbox','49048dNJoca','toString'];a0_0x2c7c=function(){return _0x3fa0a8;};return a0_0x2c7c();}class T extends a0_0x453faf{['url'];[a0_0x2d582f(0x149)];[a0_0x2d582f(0x167)];[a0_0x2d582f(0x135)];['resumeId'];[a0_0x2d582f(0x161)];[a0_0x2d582f(0x144)];[a0_0x2d582f(0x17b)];['sseAbort'];[a0_0x2d582f(0x159)]=!0x1;constructor(_0x104dde){const _0x987e6c=a0_0x2d582f;super();if(this[_0x987e6c(0x174)]=_0x104dde[_0x987e6c(0x174)]['replace'](/\/$/,''),this[_0x987e6c(0x149)]=_0x104dde['alias'],this['token']=_0x104dde['token'],this['agent']=_0x104dde[_0x987e6c(0x135)]||_0x987e6c(0x12d),this[_0x987e6c(0x142)]=_0x987e6c(0x15e)+_0x104dde[_0x987e6c(0x149)]+'-'+Date[_0x987e6c(0x16a)]()[_0x987e6c(0x178)](0x24),this[_0x987e6c(0x161)]=_0x104dde['heartbeatInterval']??0x2bf20,this[_0x987e6c(0x144)]=_0x104dde['reconnectDelay']??0xbb8,_0x104dde[_0x987e6c(0x13c)]!==!0x1)this['connect']();}[a0_0x2d582f(0x16e)](_0x3d8ff9){const _0x4a082f=a0_0x2d582f;console[_0x4a082f(0x16e)]('['+new Date()['toTimeString']()[_0x4a082f(0x184)](0x0,0x8)+']\x20[commhub:'+this[_0x4a082f(0x149)]+']\x20'+_0x3d8ff9);}async[a0_0x2d582f(0x138)](_0x1297b1,_0x2d2b34){const _0xde445d=a0_0x2d582f;let _0x1c111c={'Content-Type':_0xde445d(0x182),'Accept':_0xde445d(0x14a)};if(this[_0xde445d(0x167)])_0x1c111c['Authorization']=_0xde445d(0x13a)+this[_0xde445d(0x167)];let _0x4b9dd6=await(await fetch(this[_0xde445d(0x174)]+'/mcp',{'method':_0xde445d(0x14e),'headers':_0x1c111c,'body':JSON[_0xde445d(0x168)]({'jsonrpc':'2.0','id':Date[_0xde445d(0x16a)](),'method':_0xde445d(0x164),'params':{'name':_0x1297b1,'arguments':_0x2d2b34}})}))[_0xde445d(0x147)](),_0x5376bc=_0x4b9dd6[_0xde445d(0x134)](/data: (.+)/),_0x2b93d2=_0x5376bc?JSON[_0xde445d(0x146)](_0x5376bc[0x1]):JSON[_0xde445d(0x146)](_0x4b9dd6),_0x151bc0=_0x2b93d2?.['result']?.[_0xde445d(0x172)]?.[0x0]?.[_0xde445d(0x147)];return _0x151bc0?JSON[_0xde445d(0x146)](_0x151bc0):_0x2b93d2;}async['connect'](){const _0xaa0716=a0_0x2d582f;if(this[_0xaa0716(0x159)])return;this['running']=!0x0,await this[_0xaa0716(0x13b)](_0xaa0716(0x143)),this[_0xaa0716(0x16e)](_0xaa0716(0x145)),this[_0xaa0716(0x17b)]=setInterval(()=>{const _0x24e919=_0xaa0716;this[_0x24e919(0x13b)]('idle')['catch'](_0x39b1a2=>this['log']('heartbeat\x20failed:\x20'+_0x39b1a2[_0x24e919(0x17f)]));},this[_0xaa0716(0x161)]),this[_0xaa0716(0x16f)]();}async[a0_0x2d582f(0x157)](){const _0x422ab6=a0_0x2d582f;if(this[_0x422ab6(0x159)]=!0x1,this[_0x422ab6(0x16d)]?.[_0x422ab6(0x17d)](),this['heartbeatTimer'])clearInterval(this[_0x422ab6(0x17b)]);await this['status']('offline')[_0x422ab6(0x14f)](()=>{}),this[_0x422ab6(0x16e)]('disconnected');}async[a0_0x2d582f(0x15d)](_0x5af88e,_0x4d07b5,_0x3687c5='normal'){const _0x403250=a0_0x2d582f;return this[_0x403250(0x138)](_0x403250(0x12e),{'alias':_0x5af88e,'task':_0x4d07b5,'priority':_0x3687c5,'from_session':this[_0x403250(0x149)]});}async['message'](_0x4ec1ea,_0x455575){const _0x11c3e9=a0_0x2d582f;return this[_0x11c3e9(0x138)](_0x11c3e9(0x14c),{'alias':_0x4ec1ea,'message':_0x455575,'from_session':this['alias']});}async[a0_0x2d582f(0x139)](_0x124f2f,_0x424958,_0x7f0d11='completed'){const _0x4ac5df=a0_0x2d582f;return this[_0x4ac5df(0x138)](_0x4ac5df(0x15f),{'in_reply_to':_0x124f2f,'text':_0x424958,'status':_0x7f0d11});}async[a0_0x2d582f(0x13b)](_0x4546e3,_0x261ab2){const _0x3506ea=a0_0x2d582f;return this[_0x3506ea(0x138)](_0x3506ea(0x133),{'resume_id':this['resumeId'],'alias':this[_0x3506ea(0x149)],'status':_0x4546e3,'server':a0_0x1d8542(),'hostname':a0_0x1d8542(),'agent':this[_0x3506ea(0x135)],'project_dir':process[_0x3506ea(0x180)](),..._0x261ab2});}async['getAllStatus'](){const _0x518d1c=a0_0x2d582f;return this[_0x518d1c(0x138)](_0x518d1c(0x15a),{});}async['broadcast'](_0x5d6253,_0x33b6f7){const _0x20b886=a0_0x2d582f;return this[_0x20b886(0x138)](_0x20b886(0x130),{'message':_0x5d6253,'filter_server':_0x33b6f7?.[_0x20b886(0x152)],'filter_status':_0x33b6f7?.[_0x20b886(0x13b)]});}async[a0_0x2d582f(0x16f)](){const _0x195cd2=a0_0x2d582f;let _0x2aff09=encodeURIComponent(this[_0x195cd2(0x149)]),_0x555bec=this[_0x195cd2(0x174)]+_0x195cd2(0x165)+_0x2aff09,_0x1e3c02=this['reconnectDelay'];while(this[_0x195cd2(0x159)]){try{this[_0x195cd2(0x16d)]=new AbortController();let _0x23a3ff={'Accept':_0x195cd2(0x181)};if(this[_0x195cd2(0x167)])_0x23a3ff[_0x195cd2(0x14d)]=_0x195cd2(0x13a)+this[_0x195cd2(0x167)];let _0x543c84=await fetch(_0x555bec,{'headers':_0x23a3ff,'signal':this[_0x195cd2(0x16d)]['signal']});if(!_0x543c84['ok']||!_0x543c84['body']){this['log'](_0x195cd2(0x173)+_0x543c84[_0x195cd2(0x13b)]),await this['sleep'](_0x1e3c02),_0x1e3c02=Math['min'](_0x1e3c02*1.5,0xea60);continue;}_0x1e3c02=this[_0x195cd2(0x144)];let _0x29aece=_0x543c84[_0x195cd2(0x156)][_0x195cd2(0x17c)](),_0x231d9e=new TextDecoder(),_0x1ddd2b='';while(this['running']){let {done:_0x4d962a,value:_0x3af0e7}=await _0x29aece[_0x195cd2(0x153)]();if(_0x4d962a)break;_0x1ddd2b+=_0x231d9e[_0x195cd2(0x140)](_0x3af0e7,{'stream':!0x0});let _0x571b8d=_0x1ddd2b[_0x195cd2(0x15b)]('\x0a');_0x1ddd2b=_0x571b8d[_0x195cd2(0x179)]()||'';for(let _0x4a661f of _0x571b8d){if(!_0x4a661f['startsWith'](_0x195cd2(0x155)))continue;try{let _0x15f78e=JSON[_0x195cd2(0x146)](_0x4a661f[_0x195cd2(0x184)](0x6));if(_0x15f78e[_0x195cd2(0x166)]==='connected'){this[_0x195cd2(0x16e)](_0x195cd2(0x160)),this[_0x195cd2(0x131)](_0x195cd2(0x175));continue;}if(_0x15f78e[_0x195cd2(0x166)]===_0x195cd2(0x13e)||_0x15f78e[_0x195cd2(0x166)]===_0x195cd2(0x171)||_0x15f78e[_0x195cd2(0x166)]==='broadcast')await this[_0x195cd2(0x162)]();}catch{}}}}catch(_0x103c78){if(_0x103c78[_0x195cd2(0x137)]===_0x195cd2(0x17a))break;this['emit'](_0x195cd2(0x170),_0x103c78),this[_0x195cd2(0x16e)](_0x195cd2(0x150)+_0x103c78[_0x195cd2(0x17f)]);}if(this[_0x195cd2(0x159)])this[_0x195cd2(0x131)](_0x195cd2(0x141)),this['log'](_0x195cd2(0x15c)+_0x1e3c02/0x3e8+_0x195cd2(0x154)),await this[_0x195cd2(0x13f)](_0x1e3c02),_0x1e3c02=Math[_0x195cd2(0x14b)](_0x1e3c02*1.5,0xea60);}}async['processInbox'](){const _0x2c675d=a0_0x2d582f;try{let _0x5bf416=(await this['call'](_0x2c675d(0x176),{'alias':this['alias'],'limit':0xa}))?.[_0x2c675d(0x132)]||[];for(let _0x2b552e of _0x5bf416)await this[_0x2c675d(0x138)](_0x2c675d(0x13d),{'alias':this['alias'],'message_id':_0x2b552e['id']}),this['log']('←\x20'+_0x2b552e[_0x2c675d(0x136)]+':\x20'+_0x2b552e[_0x2c675d(0x172)][_0x2c675d(0x184)](0x0,0x3c)),this[_0x2c675d(0x131)](_0x2c675d(0x183),_0x2b552e),this[_0x2c675d(0x131)](_0x2c675d(0x17f),_0x2b552e);}catch(_0x24fd35){this[_0x2c675d(0x16e)](_0x2c675d(0x16c)+_0x24fd35[_0x2c675d(0x17f)]);}}[a0_0x2d582f(0x13f)](_0x1abcea){return new Promise(_0x15a1ea=>setTimeout(_0x15a1ea,_0x1abcea));}}var $=T;function a0_0x61fc(_0x1e4093,_0x556b84){_0x1e4093=_0x1e4093-0x12d;const _0x2c7c6e=a0_0x2c7c();let _0x61fc91=_0x2c7c6e[_0x1e4093];return _0x61fc91;}export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x3ae604=a0_0x3075;(function(_0x5a8129,_0x5756c1){const _0x2598f5=a0_0x3075,_0x240c54=_0x5a8129();while(!![]){try{const _0x519cc4=parseInt(_0x2598f5(0x13a))/0x1+parseInt(_0x2598f5(0xd7))/0x2+parseInt(_0x2598f5(0x140))/0x3+-parseInt(_0x2598f5(0x148))/0x4+parseInt(_0x2598f5(0x14c))/0x5*(parseInt(_0x2598f5(0x146))/0x6)+parseInt(_0x2598f5(0xbb))/0x7*(-parseInt(_0x2598f5(0x100))/0x8)+parseInt(_0x2598f5(0x135))/0x9*(parseInt(_0x2598f5(0xc6))/0xa);if(_0x519cc4===_0x5756c1)break;else _0x240c54['push'](_0x240c54['shift']());}catch(_0x40c2d5){_0x240c54['push'](_0x240c54['shift']());}}}(a0_0x4895,0x29472));import{readFileSync as a0_0x4a198a,existsSync as a0_0x4155d0}from'fs';import{randomUUID as a0_0x22c662}from'crypto';import{join as a0_0x28d13d}from'path';import{hostname as a0_0x4ef5e6}from'os';import{execSync as a0_0x558da6}from'child_process';import{Server as a0_0x1e3f90}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x401e97}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x3dc9af,CallToolRequestSchema as a0_0x12589d}from'@modelcontextprotocol/sdk/types.js';function I(_0x2ca656){const _0x5c1019=a0_0x3075;if(!a0_0x4155d0(_0x2ca656))return;for(let _0xa6ea66 of a0_0x4a198a(_0x2ca656,_0x5c1019(0x136))[_0x5c1019(0xf0)]('\x0a')){let _0x58142a=_0xa6ea66[_0x5c1019(0x147)]();if(!_0x58142a||_0x58142a[_0x5c1019(0x128)]('#'))continue;let _0x269872=_0x58142a['indexOf']('=');if(_0x269872<0x0)continue;let _0x11bf74=_0x58142a[_0x5c1019(0xc7)](0x0,_0x269872)[_0x5c1019(0x147)](),_0x51f089=_0x58142a[_0x5c1019(0xc7)](_0x269872+0x1)['trim']()[_0x5c1019(0xd4)](/^["']|["']$/g,'');if(!process.env[_0x11bf74])process.env[_0x11bf74]=_0x51f089;}}var L=process.env.HOME||'~',U=a0_0x28d13d(L,'.claude/channels/commhub');function a0_0x3075(_0x1e4114,_0xf3a032){_0x1e4114=_0x1e4114-0xb5;const _0x489584=a0_0x4895();let _0x30759b=_0x489584[_0x1e4114];return _0x30759b;}I(a0_0x28d13d(U,a0_0x3ae604(0x11f)));var v=process[a0_0x3ae604(0xf7)]()[a0_0x3ae604(0xd4)](/\//g,'-');I(a0_0x28d13d(U,v,a0_0x3ae604(0x11f)));function d(){const _0x51e235=a0_0x3ae604;try{return a0_0x558da6(_0x51e235(0x112),{'encoding':_0x51e235(0x136),'timeout':0x7d0})[_0x51e235(0x147)]();}catch{return'';}}function m(){const _0x202493=a0_0x3ae604;try{let _0x5cf832=a0_0x28d13d(L,_0x202493(0xdf),_0x202493(0xfa));if(a0_0x4155d0(_0x5cf832))return JSON[_0x202493(0xf3)](a0_0x4a198a(_0x5cf832,_0x202493(0x136)));}catch{}return{};}var u=m(),j=process.env.COMMHUB_URL||u[a0_0x3ae604(0xd3)]||'http://127.0.0.1:9200',f=process.env.COMMHUB_TMUX||d();function r(){const _0x54c004=a0_0x3ae604;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x54c004(0x147)]())return process.env.COMMHUB_ALIAS['trim']();return process[_0x54c004(0xfd)][_0x54c004(0x142)](_0x54c004(0x104)+(_0x54c004(0xcd)+(f||_0x54c004(0xdd))+'\x20/\x20hostname='+a0_0x4ef5e6()+_0x54c004(0x11a))),'unattributed-'+process[_0x54c004(0x119)];}var G=r(),K=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x22c662(),F=process.env.COMMHUB_TOKEN||u[a0_0x3ae604(0xc9)]||'';function W(_0x47ba2c){const _0x3591de=a0_0x3ae604;let _0x283157=new Date()['toTimeString']()[_0x3591de(0xc7)](0x0,0x8);process[_0x3591de(0xfd)][_0x3591de(0x142)]('['+_0x283157+_0x3591de(0xbf)+_0x47ba2c+'\x0a');}function N(_0x510b0a){return new Promise(_0x352791=>setTimeout(_0x352791,_0x510b0a));}W(a0_0x3ae604(0xf2)+j+a0_0x3ae604(0x11c)+G+'\x20RESUME_ID='+K[a0_0x3ae604(0xc7)](0x0,0x8)+a0_0x3ae604(0x145)+(f||a0_0x3ae604(0x12f))+'\x20CWD='+process['cwd']()+a0_0x3ae604(0x122)+v);var D=new Map(),x=new a0_0x1e3f90({'name':a0_0x3ae604(0x118),'version':a0_0x3ae604(0xe1)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x3ae604(0x149),a0_0x3ae604(0x129),a0_0x3ae604(0xd1),a0_0x3ae604(0x12e),a0_0x3ae604(0xd6)+G][a0_0x3ae604(0x12d)]('\x0a')});function a0_0x4895(){const _0x9a59b=['idle','normal','SSE\x20connection\x20error:\x20','239424PPJjcl','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','write','connecting\x20to\x20','getReader','...\x20TMUX=','6lMMFBL','trim','664132GacdmM','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','commhub_send_task','send_message','311615IoGixP','text','blocked','\x22\x20after\x20SSE\x20reconnect','initialize','2.0','unknown\x20tool','then','175rQmeuU','object','←\x20message\x20from\x20','\x20priority=',']\x20[commhub]\x20','→\x20injected\x20task\x20','tools/call','decode','in_progress','SIGINT','parse\x20error:\x20','1088620odxjqx','slice','heartbeat\x20failed:\x20','token','MCP\x20stdio\x20connected','find','body','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','exit','task','commhub_report_status','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','report_status','hub','replace','setRequestHandler','Session\x20alias:\x20','2270CGjxsz','result','ready\x20—\x20waiting\x20for\x20events','content','string','commhub_reply','(none)','notifications/claude/channel','.anet','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','0.3.0','high','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','priority','get','low','broadcast','Message\x20content','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','completed','Priority\x20(default:\x20normal)','status','warning:\x20could\x20not\x20register:\x20','set','split','connected','ENV:\x20URL=','parse','\x22\x20(','get_all_status','cancelled','cwd','min','starting\x20SSE\x20listener...','config.json','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','application/json','stderr','offline','from','58664VGglxl','application/json,\x20text/event-stream','Task\x20content','message','[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20','stringify','replied','message_id','statusText','POST','/events/','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','CommHub\x20init\x20failed:\x20','Bearer\x20','SSE\x20stream\x20ended,\x20reconnecting...','alias','re-register\x20failed:\x20','commhub_send_message','tmux\x20display-message\x20-p\x20\x27#S\x27','commhub_get_all_status','fatal:\x20','length','claude-code','SSE\x20error:\x20','commhub-channel','pid','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','messages','\x20ALIAS=','working','now','.env','error','Reply\x20text\x20/\x20result\x20summary','\x20PROJECT_ENV=','type','catch','data:\x20','no\x20response','pop','startsWith','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','re-registered\x20as\x20\x22','stdin','failed','join','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','none','SSE\x20connected\x20as\x20\x22','session\x20disconnected','ack_inbox','/mcp','Target\x20session\x20alias','18ibjUHC','utf-8',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','notification','commhub','157442VskWCO','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','from_session'];a0_0x4895=function(){return _0x9a59b;};return a0_0x4895();}x['setRequestHandler'](a0_0x3dc9af,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x3ae604(0x141),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x3ae604(0xdb),'description':a0_0x3ae604(0xe3)},'text':{'type':'string','description':a0_0x3ae604(0x121)},'status':{'type':a0_0x3ae604(0xdb),'enum':[a0_0x3ae604(0xeb),a0_0x3ae604(0x12c),a0_0x3ae604(0xf6),a0_0x3ae604(0xb5),a0_0x3ae604(0x120),a0_0x3ae604(0xc3)],'description':a0_0x3ae604(0xfb)}},'required':['text']}},{'name':a0_0x3ae604(0xd0),'description':a0_0x3ae604(0xe0),'inputSchema':{'type':a0_0x3ae604(0xbc),'properties':{'status':{'type':a0_0x3ae604(0xdb),'enum':['working',a0_0x3ae604(0x13d),a0_0x3ae604(0xb5),a0_0x3ae604(0x120)]},'task':{'type':'string','description':'Current\x20task\x20description'},'progress':{'type':'number','description':'Progress\x200-100'}},'required':[a0_0x3ae604(0xed)]}},{'name':a0_0x3ae604(0x14a),'description':a0_0x3ae604(0xea),'inputSchema':{'type':a0_0x3ae604(0xbc),'properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'task':{'type':a0_0x3ae604(0xdb),'description':a0_0x3ae604(0x102)},'priority':{'type':a0_0x3ae604(0xdb),'enum':[a0_0x3ae604(0xe2),'normal',a0_0x3ae604(0xe6)],'description':a0_0x3ae604(0xec)}},'required':[a0_0x3ae604(0x10f),a0_0x3ae604(0xcf)]}},{'name':a0_0x3ae604(0x111),'description':a0_0x3ae604(0xe9),'inputSchema':{'type':a0_0x3ae604(0xbc),'properties':{'alias':{'type':a0_0x3ae604(0xdb),'description':a0_0x3ae604(0x134)},'message':{'type':a0_0x3ae604(0xdb),'description':a0_0x3ae604(0xe8)}},'required':[a0_0x3ae604(0x10f),a0_0x3ae604(0x103)]}},{'name':a0_0x3ae604(0x113),'description':a0_0x3ae604(0x13b),'inputSchema':{'type':a0_0x3ae604(0xbc),'properties':{}}}]}));async function Y(_0x19cc54,_0x47ec97){const _0x5972ca=a0_0x3ae604;let _0x7a9de9=await fetch(j+_0x5972ca(0x133),{'method':_0x5972ca(0x109),'headers':{'Content-Type':_0x5972ca(0xfc),'Accept':_0x5972ca(0x101),...F?{'Authorization':_0x5972ca(0x10d)+F}:{}},'body':JSON[_0x5972ca(0x105)]({'jsonrpc':'2.0','id':0x1,'method':_0x5972ca(0xb7),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x5972ca(0x118),'version':_0x5972ca(0xe1)}}})});if(!_0x7a9de9['ok']){let _0x329dc4=await _0x7a9de9[_0x5972ca(0x14d)]();return W(_0x5972ca(0x10c)+_0x7a9de9[_0x5972ca(0xed)]+'\x20'+_0x329dc4['slice'](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x7a9de9['status']};}await _0x7a9de9[_0x5972ca(0x14d)]();let _0x21bd46=(await(await fetch(j+_0x5972ca(0x133),{'method':_0x5972ca(0x109),'headers':{'Content-Type':'application/json','Accept':_0x5972ca(0x101),...F?{'Authorization':'Bearer\x20'+F}:{}},'body':JSON[_0x5972ca(0x105)]({'jsonrpc':_0x5972ca(0xb8),'id':0x2,'method':_0x5972ca(0xc1),'params':{'name':_0x19cc54,'arguments':_0x47ec97}})}))[_0x5972ca(0x14d)]())[_0x5972ca(0xf0)]('\x0a')[_0x5972ca(0xcb)](_0x50d7a6=>_0x50d7a6[_0x5972ca(0x128)](_0x5972ca(0x125)));if(_0x21bd46){let _0x2fcb19=JSON[_0x5972ca(0xf3)](_0x21bd46[_0x5972ca(0xc7)](0x6));return _0x2fcb19?.[_0x5972ca(0xd8)]?.[_0x5972ca(0xda)]?.[0x0]?.[_0x5972ca(0x14d)]?JSON[_0x5972ca(0xf3)](_0x2fcb19[_0x5972ca(0xd8)][_0x5972ca(0xda)][0x0][_0x5972ca(0x14d)]):_0x2fcb19;}return{'ok':!0x1,'error':_0x5972ca(0x126)};}x[a0_0x3ae604(0xd5)](a0_0x12589d,async _0x53b6fb=>{const _0x939594=a0_0x3ae604;let {name:_0x3e9f45,arguments:_0x1fb14f}=_0x53b6fb['params'];if(_0x3e9f45===_0x939594(0xdc)){let {task_id:_0x53ed5f,text:_0x55a24a,status:_0x5cb73b}=_0x1fb14f;if(_0x5cb73b==='completed'||_0x5cb73b===_0x939594(0x12c)||_0x5cb73b===_0x939594(0xf6)){let _0x1e95ae=_0x5cb73b===_0x939594(0xeb)?_0x939594(0x106):_0x5cb73b,_0x32f7ac=_0x53ed5f?D[_0x939594(0xe5)](_0x53ed5f)||_0x939594(0xd3):_0x939594(0xd3),_0x32feb0=await Y('send_reply',{'alias':_0x32f7ac,'text':_0x55a24a,'in_reply_to':_0x53ed5f||void 0x0,'status':_0x1e95ae,'from_session':G});if(_0x53ed5f)D['delete'](_0x53ed5f);return{'content':[{'type':'text','text':JSON[_0x939594(0x105)](_0x32feb0)}]};}let _0x542f96=await Y('report_status',{'resume_id':K,'alias':G,'status':_0x5cb73b==='blocked'?'blocked':_0x5cb73b===_0x939594(0x120)?_0x939594(0x120):_0x939594(0x11d),'task':_0x55a24a['slice'](0x0,0xc8),'output':_0x55a24a});return{'content':[{'type':'text','text':JSON[_0x939594(0x105)](_0x542f96)}]};}if(_0x3e9f45==='commhub_report_status'){let {status:_0x3761b0,task:_0x462271,progress:_0x5c5a98}=_0x1fb14f,_0x54cf02=await Y(_0x939594(0xd2),{'resume_id':K,'alias':G,'status':_0x3761b0,'task':_0x462271,'progress':_0x5c5a98});return{'content':[{'type':_0x939594(0x14d),'text':JSON[_0x939594(0x105)](_0x54cf02)}]};}if(_0x3e9f45==='commhub_send_task'){let {alias:_0x14008d,task:_0x102e4f,priority:_0x5627a9}=_0x1fb14f,_0x593ca9=await Y('send_task',{'alias':_0x14008d,'task':_0x102e4f,'priority':_0x5627a9||_0x939594(0x13e),'from_session':G});return{'content':[{'type':_0x939594(0x14d),'text':JSON['stringify'](_0x593ca9)}]};}if(_0x3e9f45===_0x939594(0x111)){let {alias:_0x5d62b0,message:_0x4a9e77}=_0x1fb14f,_0x3592b9=await Y(_0x939594(0x14b),{'alias':_0x5d62b0,'message':_0x4a9e77,'from_session':G});return{'content':[{'type':_0x939594(0x14d),'text':JSON[_0x939594(0x105)](_0x3592b9)}]};}if(_0x3e9f45===_0x939594(0x113)){let _0x4d42c4=await Y(_0x939594(0xf5),{});return{'content':[{'type':_0x939594(0x14d),'text':JSON[_0x939594(0x105)](_0x4d42c4)}]};}return{'content':[{'type':_0x939594(0x14d),'text':JSON[_0x939594(0x105)]({'error':_0x939594(0xb9)})}]};});var O=0x3e8,R=0x7530,T=0x36ee80;async function l(){const _0x32e74d=a0_0x3ae604;try{await Y(_0x32e74d(0xd2),{'resume_id':K,'alias':G,'status':_0x32e74d(0x13d),'server':a0_0x4ef5e6(),'hostname':a0_0x4ef5e6(),'agent':_0x32e74d(0x116),'project_dir':process['cwd'](),'tmux_name':f||void 0x0}),W(_0x32e74d(0x12a)+G+_0x32e74d(0xb6));}catch(_0x55383d){W(_0x32e74d(0x110)+_0x55383d);}}async function o(){const _0x2c3d92=a0_0x3ae604;let _0x5cbdf6=j+_0x2c3d92(0x10a)+encodeURIComponent(G),_0x48c08a={};if(F)_0x48c08a['Authorization']=_0x2c3d92(0x10d)+F;W(_0x2c3d92(0x143)+_0x5cbdf6);let _0x373844=O,_0x5396f8=!0x0,_0x470622=null;while(!0x0){try{let _0x313878=await fetch(_0x5cbdf6,{'headers':_0x48c08a});if(!_0x313878['ok']){if(W(_0x2c3d92(0x117)+_0x313878[_0x2c3d92(0xed)]+'\x20'+_0x313878[_0x2c3d92(0x108)]),_0x470622=_0x470622??Date[_0x2c3d92(0x11e)](),Date[_0x2c3d92(0x11e)]()-_0x470622>T){W(_0x2c3d92(0x10b)+j+_0x2c3d92(0x137));return;}await N(_0x373844),_0x373844=Math[_0x2c3d92(0xf8)](_0x373844*0x2,R);continue;}let _0x163d9f=_0x313878[_0x2c3d92(0xcc)][_0x2c3d92(0x144)](),_0x502d43=new TextDecoder(),_0x17eb1c='';_0x373844=O;while(!0x0){let {done:_0x1f8d94,value:_0x424fa5}=await _0x163d9f['read']();if(_0x1f8d94)break;_0x17eb1c+=_0x502d43[_0x2c3d92(0xc2)](_0x424fa5,{'stream':!0x0});let _0x48e14e=_0x17eb1c[_0x2c3d92(0xf0)]('\x0a\x0a');_0x17eb1c=_0x48e14e[_0x2c3d92(0x127)]()||'';for(let _0x25f392 of _0x48e14e){let _0x3c2d87=_0x25f392[_0x2c3d92(0xf0)]('\x0a')['find'](_0x5011ba=>_0x5011ba[_0x2c3d92(0x128)]('data:\x20'));if(!_0x3c2d87)continue;try{let _0x452550=JSON[_0x2c3d92(0xf3)](_0x3c2d87[_0x2c3d92(0xc7)](0x6));if(await a(_0x452550),_0x452550[_0x2c3d92(0x123)]==='connected'){if(_0x470622=null,!_0x5396f8)await l();_0x5396f8=!0x1;}}catch(_0x3c87bc){W(_0x2c3d92(0xc5)+_0x3c87bc);}}}W(_0x2c3d92(0x10e));}catch(_0x480f0d){W(_0x2c3d92(0x13f)+_0x480f0d);}if(_0x470622=_0x470622??Date[_0x2c3d92(0x11e)](),Date['now']()-_0x470622>T){W('SSE\x20连续\x20>1h\x20连不上\x20hub\x20('+j+_0x2c3d92(0x137));return;}await N(_0x373844),_0x373844=Math[_0x2c3d92(0xf8)](_0x373844*0x2,R);}}async function a(_0x388cdb){const _0x3b88fc=a0_0x3ae604;if(_0x388cdb['type']===_0x3b88fc(0xf1)){W(_0x3b88fc(0x130)+G+'\x22');return;}if(_0x388cdb['type']==='new_message'){if(W(_0x3b88fc(0xbd)+_0x388cdb[_0x3b88fc(0xff)]+':\x20'+_0x388cdb[_0x3b88fc(0x103)][_0x3b88fc(0xc7)](0x0,0x3c)),await x[_0x3b88fc(0x138)]({'method':_0x3b88fc(0xde),'params':{'content':_0x388cdb[_0x3b88fc(0x103)],'meta':{'sender':_0x388cdb['from']||'hub','sender_id':_0x3b88fc(0x139),'user':_0x388cdb[_0x3b88fc(0xff)]||_0x3b88fc(0xd3),'priority':_0x3b88fc(0x13e)}}}),_0x388cdb[_0x3b88fc(0x107)])await Y(_0x3b88fc(0x132),{'alias':G,'message_id':_0x388cdb['message_id']});return;}if(_0x388cdb[_0x3b88fc(0x123)]==='new_task'||_0x388cdb[_0x3b88fc(0x123)]===_0x3b88fc(0xe7)){W('←\x20'+_0x388cdb[_0x3b88fc(0x123)]+':\x20inbox_count='+_0x388cdb['inbox_count']+_0x3b88fc(0xbe)+(_0x388cdb['priority']||_0x3b88fc(0x13e)));let _0x14add8=await Y('get_inbox',{'alias':G,'limit':0x5});if(_0x14add8?.['ok']&&_0x14add8[_0x3b88fc(0x11b)]?.[_0x3b88fc(0x115)]>0x0)for(let _0x1d47b2 of _0x14add8[_0x3b88fc(0x11b)]){let _0x58562a={'sender':_0x1d47b2['from_session']||_0x3b88fc(0xd3),'sender_id':'commhub','user':_0x1d47b2[_0x3b88fc(0x13c)]||'hub','task_id':_0x1d47b2['id'],'priority':_0x1d47b2[_0x3b88fc(0xe4)]||_0x3b88fc(0x13e)};D[_0x3b88fc(0xef)](_0x1d47b2['id'],_0x1d47b2['from_session']||_0x3b88fc(0xd3)),await x[_0x3b88fc(0x138)]({'method':_0x3b88fc(0xde),'params':{'content':_0x1d47b2[_0x3b88fc(0xda)],'meta':_0x58562a}}),W(_0x3b88fc(0xc0)+_0x1d47b2['id'][_0x3b88fc(0xc7)](0x0,0x8)+'\x20from\x20'+_0x1d47b2['from_session']+':\x20'+_0x1d47b2[_0x3b88fc(0xda)][_0x3b88fc(0xc7)](0x0,0x3c)),await Y(_0x3b88fc(0x132),{'alias':G,'message_id':_0x1d47b2['id']});}}}async function n(){const _0x5a7335=a0_0x3ae604;let _0x23b6b5=new a0_0x401e97();await x['connect'](_0x23b6b5),W(_0x5a7335(0xca)),W(_0x5a7335(0xf9)),o()['catch'](_0xedb224=>W('SSE\x20fatal:\x20'+_0xedb224)),Y(_0x5a7335(0xd2),{'resume_id':K,'alias':G,'status':'idle','server':a0_0x4ef5e6(),'hostname':a0_0x4ef5e6(),'agent':'claude-code','project_dir':process[_0x5a7335(0xf7)](),'tmux_name':f||void 0x0})[_0x5a7335(0xba)](()=>W('registered\x20as\x20\x22'+G+_0x5a7335(0xf4)+K['slice'](0x0,0x8)+')'))[_0x5a7335(0x124)](_0x286daf=>W(_0x5a7335(0xee)+_0x286daf)),setInterval(()=>{const _0x353124=_0x5a7335;Y(_0x353124(0xd2),{'resume_id':K,'alias':G,'status':_0x353124(0x13d),'server':a0_0x4ef5e6(),'hostname':a0_0x4ef5e6(),'agent':_0x353124(0x116),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x353124(0x124)](_0x3a0425=>W(_0x353124(0xc8)+_0x3a0425));},0x2bf20),W(_0x5a7335(0xd9));}n()['catch'](_0x2aaa6b=>{const _0x292e00=a0_0x3ae604;W(_0x292e00(0x114)+_0x2aaa6b),process[_0x292e00(0xce)](0x1);});async function b(){const _0xb687b7=a0_0x3ae604;W('shutting\x20down,\x20reporting\x20offline...'),await Y('report_status',{'resume_id':K,'alias':G,'status':_0xb687b7(0xfe),'task':_0xb687b7(0x131)})[_0xb687b7(0x124)](()=>{}),process[_0xb687b7(0xce)](0x0);}process[a0_0x3ae604(0x12b)]['on']('end',()=>b()),process['on']('SIGTERM',()=>b()),process['on'](a0_0x3ae604(0xc4),()=>b());
2
+ const a0_0x221966=a0_0x1874;(function(_0x408cb9,_0x596e93){const _0x2b7093=a0_0x1874,_0x4fd8ea=_0x408cb9();while(!![]){try{const _0x481ab7=-parseInt(_0x2b7093(0x22e))/0x1+-parseInt(_0x2b7093(0x227))/0x2+parseInt(_0x2b7093(0x24a))/0x3*(-parseInt(_0x2b7093(0x25a))/0x4)+parseInt(_0x2b7093(0x1e1))/0x5*(parseInt(_0x2b7093(0x24c))/0x6)+parseInt(_0x2b7093(0x21a))/0x7+parseInt(_0x2b7093(0x214))/0x8+-parseInt(_0x2b7093(0x1ea))/0x9*(-parseInt(_0x2b7093(0x208))/0xa);if(_0x481ab7===_0x596e93)break;else _0x4fd8ea['push'](_0x4fd8ea['shift']());}catch(_0x332faf){_0x4fd8ea['push'](_0x4fd8ea['shift']());}}}(a0_0x3262,0xbd8d6));import{readFileSync as a0_0x3c273c,existsSync as a0_0x345cd8}from'fs';import{randomUUID as a0_0x1b8658}from'crypto';import{join as a0_0x50bc38}from'path';import{hostname as a0_0x47108d}from'os';import{execSync as a0_0x134f3d}from'child_process';import{Server as a0_0x864aa2}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x8886fd}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x45f609,CallToolRequestSchema as a0_0x30a158}from'@modelcontextprotocol/sdk/types.js';function I(_0x4b1334){const _0x5353d5=a0_0x1874;if(!a0_0x345cd8(_0x4b1334))return;for(let _0x5d8442 of a0_0x3c273c(_0x4b1334,_0x5353d5(0x26a))[_0x5353d5(0x1e8)]('\x0a')){let _0x41c1b9=_0x5d8442[_0x5353d5(0x262)]();if(!_0x41c1b9||_0x41c1b9[_0x5353d5(0x204)]('#'))continue;let _0x188384=_0x41c1b9[_0x5353d5(0x23e)]('=');if(_0x188384<0x0)continue;let _0x1a5149=_0x41c1b9[_0x5353d5(0x26c)](0x0,_0x188384)[_0x5353d5(0x262)](),_0x1366c5=_0x41c1b9[_0x5353d5(0x26c)](_0x188384+0x1)[_0x5353d5(0x262)]()[_0x5353d5(0x203)](/^["']|["']$/g,'');if(!process.env[_0x1a5149])process.env[_0x1a5149]=_0x1366c5;}}var L=process.env.HOME||'~',U=a0_0x50bc38(L,'.claude/channels/commhub');I(a0_0x50bc38(U,a0_0x221966(0x213)));var v=process[a0_0x221966(0x221)]()[a0_0x221966(0x203)](/\//g,'-');I(a0_0x50bc38(U,v,a0_0x221966(0x213)));function d(){const _0x4254a9=a0_0x221966;try{return a0_0x134f3d(_0x4254a9(0x240),{'encoding':_0x4254a9(0x26a),'timeout':0x7d0})[_0x4254a9(0x262)]();}catch{return'';}}function m(){const _0x563e5f=a0_0x221966;try{let _0x15265d=a0_0x50bc38(L,_0x563e5f(0x231),'config.json');if(a0_0x345cd8(_0x15265d))return JSON['parse'](a0_0x3c273c(_0x15265d,_0x563e5f(0x26a)));}catch{}return{};}var u=m(),j=process.env.COMMHUB_URL||u[a0_0x221966(0x260)]||a0_0x221966(0x24b),f=process.env.COMMHUB_TMUX||d();function r(){const _0x4c6abe=a0_0x221966;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x4c6abe(0x262)]())return process.env.COMMHUB_ALIAS[_0x4c6abe(0x262)]();return process['stderr']['write']('[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20'+(_0x4c6abe(0x23f)+(f||_0x4c6abe(0x22a))+_0x4c6abe(0x206)+a0_0x47108d()+_0x4c6abe(0x20a))),_0x4c6abe(0x215)+process[_0x4c6abe(0x1d9)];}var G=r(),K=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x1b8658(),F=process.env.COMMHUB_TOKEN||u['token']||'';function W(_0x593acd){const _0x456f46=a0_0x221966;let _0x3d3c5b=new Date()[_0x456f46(0x253)]()[_0x456f46(0x26c)](0x0,0x8);process[_0x456f46(0x22d)][_0x456f46(0x1f8)]('['+_0x3d3c5b+_0x456f46(0x241)+_0x593acd+'\x0a');}function N(_0x59b862){return new Promise(_0x59d6a3=>setTimeout(_0x59d6a3,_0x59b862));}W('ENV:\x20URL='+j+'\x20ALIAS='+G+a0_0x221966(0x244)+K[a0_0x221966(0x26c)](0x0,0x8)+a0_0x221966(0x268)+(f||a0_0x221966(0x201))+a0_0x221966(0x25c)+process[a0_0x221966(0x221)]()+a0_0x221966(0x20e)+v);var D=new Map(),x=new a0_0x864aa2({'name':a0_0x221966(0x219),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x221966(0x1e7),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x221966(0x261),a0_0x221966(0x226),a0_0x221966(0x246)+G][a0_0x221966(0x239)]('\x0a')});x['setRequestHandler'](a0_0x45f609,async()=>({'tools':[{'name':a0_0x221966(0x210),'description':a0_0x221966(0x1fb),'inputSchema':{'type':a0_0x221966(0x236),'properties':{'task_id':{'type':a0_0x221966(0x1f6),'description':a0_0x221966(0x243)},'text':{'type':'string','description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':'string','enum':[a0_0x221966(0x1e0),a0_0x221966(0x238),a0_0x221966(0x21c),'blocked','error',a0_0x221966(0x257)],'description':a0_0x221966(0x25f)}},'required':[a0_0x221966(0x248)]}},{'name':a0_0x221966(0x23c),'description':a0_0x221966(0x1ed),'inputSchema':{'type':a0_0x221966(0x236),'properties':{'status':{'type':a0_0x221966(0x1f6),'enum':[a0_0x221966(0x225),a0_0x221966(0x1db),a0_0x221966(0x249),a0_0x221966(0x20c)]},'task':{'type':a0_0x221966(0x1f6),'description':a0_0x221966(0x1fd)},'progress':{'type':a0_0x221966(0x217),'description':a0_0x221966(0x1e5)}},'required':[a0_0x221966(0x1fc)]}},{'name':'commhub_send_task','description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':'object','properties':{'alias':{'type':'string','description':a0_0x221966(0x229)},'task':{'type':a0_0x221966(0x1f6),'description':a0_0x221966(0x23a)},'priority':{'type':a0_0x221966(0x1f6),'enum':['high',a0_0x221966(0x26e),a0_0x221966(0x267)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x221966(0x1ef),a0_0x221966(0x1e4)]}},{'name':a0_0x221966(0x1f7),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x221966(0x236),'properties':{'alias':{'type':a0_0x221966(0x1f6),'description':a0_0x221966(0x229)},'message':{'type':'string','description':'Message\x20content'}},'required':[a0_0x221966(0x1ef),'message']}},{'name':a0_0x221966(0x264),'description':a0_0x221966(0x25b),'inputSchema':{'type':a0_0x221966(0x236),'properties':{}}}]}));async function Y(_0x8c8ec7,_0xa8591f){const _0x3821c9=a0_0x221966;let _0x48cb87=await fetch(j+'/mcp',{'method':_0x3821c9(0x256),'headers':{'Content-Type':'application/json','Accept':_0x3821c9(0x24e),...F?{'Authorization':_0x3821c9(0x269)+F}:{}},'body':JSON[_0x3821c9(0x237)]({'jsonrpc':_0x3821c9(0x25d),'id':0x1,'method':_0x3821c9(0x26b),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x3821c9(0x219),'version':_0x3821c9(0x26f)}}})});if(!_0x48cb87['ok']){let _0x9f1ef7=await _0x48cb87[_0x3821c9(0x248)]();return W(_0x3821c9(0x22c)+_0x48cb87[_0x3821c9(0x1fc)]+'\x20'+_0x9f1ef7['slice'](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x48cb87[_0x3821c9(0x1fc)]};}await _0x48cb87[_0x3821c9(0x248)]();let _0x4394ca=(await(await fetch(j+_0x3821c9(0x270),{'method':'POST','headers':{'Content-Type':_0x3821c9(0x1f4),'Accept':'application/json,\x20text/event-stream',...F?{'Authorization':_0x3821c9(0x269)+F}:{}},'body':JSON[_0x3821c9(0x237)]({'jsonrpc':_0x3821c9(0x25d),'id':0x2,'method':'tools/call','params':{'name':_0x8c8ec7,'arguments':_0xa8591f}})}))['text']())[_0x3821c9(0x1e8)]('\x0a')['find'](_0x56aa05=>_0x56aa05[_0x3821c9(0x204)](_0x3821c9(0x250)));if(_0x4394ca){let _0x4759c3=JSON[_0x3821c9(0x209)](_0x4394ca[_0x3821c9(0x26c)](0x6));return _0x4759c3?.[_0x3821c9(0x1ec)]?.[_0x3821c9(0x1dc)]?.[0x0]?.[_0x3821c9(0x248)]?JSON[_0x3821c9(0x209)](_0x4759c3[_0x3821c9(0x1ec)][_0x3821c9(0x1dc)][0x0][_0x3821c9(0x248)]):_0x4759c3;}return{'ok':!0x1,'error':_0x3821c9(0x24f)};}x[a0_0x221966(0x1e6)](a0_0x30a158,async _0x5a29d6=>{const _0x4bed34=a0_0x221966;let {name:_0x5f5130,arguments:_0x191c2d}=_0x5a29d6[_0x4bed34(0x21f)];if(_0x5f5130===_0x4bed34(0x210)){let {task_id:_0x4b9e21,text:_0x4cb217,status:_0x1eea3e}=_0x191c2d;if(_0x1eea3e===_0x4bed34(0x1e0)||_0x1eea3e===_0x4bed34(0x238)||_0x1eea3e===_0x4bed34(0x21c)){let _0x204c58=_0x1eea3e==='completed'?_0x4bed34(0x22f):_0x1eea3e,_0x296638=_0x4b9e21?D['get'](_0x4b9e21)||_0x4bed34(0x260):'hub',_0x482448=await Y('send_reply',{'alias':_0x296638,'text':_0x4cb217,'in_reply_to':_0x4b9e21||void 0x0,'status':_0x204c58,'from_session':G});if(_0x4b9e21)D[_0x4bed34(0x220)](_0x4b9e21);return{'content':[{'type':_0x4bed34(0x248),'text':JSON[_0x4bed34(0x237)](_0x482448)}]};}let _0x496a40=await Y('report_status',{'resume_id':K,'alias':G,'status':_0x1eea3e==='blocked'?_0x4bed34(0x249):_0x1eea3e===_0x4bed34(0x20c)?'error':_0x4bed34(0x225),'task':_0x4cb217[_0x4bed34(0x26c)](0x0,0xc8),'output':_0x4cb217});return{'content':[{'type':_0x4bed34(0x248),'text':JSON[_0x4bed34(0x237)](_0x496a40)}]};}if(_0x5f5130===_0x4bed34(0x23c)){let {status:_0x50cad9,task:_0x3ed1c1,progress:_0x2dc969}=_0x191c2d,_0x15971f=await Y('report_status',{'resume_id':K,'alias':G,'status':_0x50cad9,'task':_0x3ed1c1,'progress':_0x2dc969});return{'content':[{'type':_0x4bed34(0x248),'text':JSON[_0x4bed34(0x237)](_0x15971f)}]};}if(_0x5f5130===_0x4bed34(0x245)){let {alias:_0x182c09,task:_0x1f6e01,priority:_0x2c7b58}=_0x191c2d,_0x2fe2b9=await Y('send_task',{'alias':_0x182c09,'task':_0x1f6e01,'priority':_0x2c7b58||_0x4bed34(0x26e),'from_session':G});return{'content':[{'type':_0x4bed34(0x248),'text':JSON[_0x4bed34(0x237)](_0x2fe2b9)}]};}if(_0x5f5130==='commhub_send_message'){let {alias:_0x2c85d9,message:_0x1c92e0}=_0x191c2d,_0x81207e=await Y(_0x4bed34(0x205),{'alias':_0x2c85d9,'message':_0x1c92e0,'from_session':G});return{'content':[{'type':_0x4bed34(0x248),'text':JSON[_0x4bed34(0x237)](_0x81207e)}]};}if(_0x5f5130==='commhub_get_all_status'){let _0x1942a8=await Y(_0x4bed34(0x1dd),{});return{'content':[{'type':_0x4bed34(0x248),'text':JSON['stringify'](_0x1942a8)}]};}return{'content':[{'type':_0x4bed34(0x248),'text':JSON['stringify']({'error':_0x4bed34(0x1f0)})}]};});var O=0x3e8,R=0x7530,T=0x36ee80;async function l(){const _0x1fe7b8=a0_0x221966;try{await Y('report_status',{'resume_id':K,'alias':G,'status':'idle','server':a0_0x47108d(),'hostname':a0_0x47108d(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':f||void 0x0}),W(_0x1fe7b8(0x25e)+G+'\x22\x20after\x20SSE\x20reconnect');}catch(_0x4511ac){W(_0x1fe7b8(0x265)+_0x4511ac);}}async function o(){const _0x3c4547=a0_0x221966;let _0x512601=j+_0x3c4547(0x200)+encodeURIComponent(G),_0x49ad42={};if(F)_0x49ad42[_0x3c4547(0x258)]=_0x3c4547(0x269)+F;W(_0x3c4547(0x26d)+_0x512601);let _0x5498a2=O,_0x516807=!0x0,_0x4d45e0=null;while(!0x0){try{let _0x117b03=await fetch(_0x512601,{'headers':_0x49ad42});if(!_0x117b03['ok']){if(W(_0x3c4547(0x21e)+_0x117b03[_0x3c4547(0x1fc)]+'\x20'+_0x117b03[_0x3c4547(0x218)]),_0x4d45e0=_0x4d45e0??Date[_0x3c4547(0x254)](),Date[_0x3c4547(0x254)]()-_0x4d45e0>T){W(_0x3c4547(0x232)+j+_0x3c4547(0x1fa));return;}await N(_0x5498a2),_0x5498a2=Math[_0x3c4547(0x1f3)](_0x5498a2*0x2,R);continue;}let _0x24cb18=_0x117b03[_0x3c4547(0x1f2)][_0x3c4547(0x1ff)](),_0x51e5e5=new TextDecoder(),_0x384985='';_0x5498a2=O;while(!0x0){let {done:_0x7ea129,value:_0x2db890}=await _0x24cb18[_0x3c4547(0x1e3)]();if(_0x7ea129)break;_0x384985+=_0x51e5e5[_0x3c4547(0x252)](_0x2db890,{'stream':!0x0});let _0x8309ab=_0x384985[_0x3c4547(0x1e8)]('\x0a\x0a');_0x384985=_0x8309ab[_0x3c4547(0x20b)]()||'';for(let _0x1ca0e8 of _0x8309ab){let _0x3e71fa=_0x1ca0e8['split']('\x0a')[_0x3c4547(0x212)](_0x54fd8d=>_0x54fd8d[_0x3c4547(0x204)](_0x3c4547(0x250)));if(!_0x3e71fa)continue;try{let _0x1938dd=JSON[_0x3c4547(0x209)](_0x3e71fa['slice'](0x6));if(await a(_0x1938dd),_0x1938dd[_0x3c4547(0x259)]===_0x3c4547(0x1eb)){if(_0x4d45e0=null,!_0x516807)await l();_0x516807=!0x1;}}catch(_0x4a0924){W('parse\x20error:\x20'+_0x4a0924);}}}W('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x1bbf7c){W(_0x3c4547(0x247)+_0x1bbf7c);}if(_0x4d45e0=_0x4d45e0??Date['now'](),Date[_0x3c4547(0x254)]()-_0x4d45e0>T){W(_0x3c4547(0x232)+j+')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。');return;}await N(_0x5498a2),_0x5498a2=Math['min'](_0x5498a2*0x2,R);}}async function a(_0xf6cf8e){const _0x56c118=a0_0x221966;if(_0xf6cf8e[_0x56c118(0x259)]===_0x56c118(0x1eb)){W(_0x56c118(0x233)+G+'\x22');return;}if(_0xf6cf8e['type']===_0x56c118(0x22b)){if(W('←\x20message\x20from\x20'+_0xf6cf8e['from']+':\x20'+_0xf6cf8e[_0x56c118(0x1ee)][_0x56c118(0x26c)](0x0,0x3c)),await x[_0x56c118(0x1e2)]({'method':_0x56c118(0x251),'params':{'content':_0xf6cf8e['message'],'meta':{'sender':_0xf6cf8e['from']||_0x56c118(0x260),'sender_id':_0x56c118(0x216),'user':_0xf6cf8e[_0x56c118(0x235)]||_0x56c118(0x260),'priority':_0x56c118(0x26e)}}}),_0xf6cf8e[_0x56c118(0x242)])await Y('ack_inbox',{'alias':G,'message_id':_0xf6cf8e['message_id']});return;}if(_0xf6cf8e[_0x56c118(0x259)]===_0x56c118(0x1f5)||_0xf6cf8e['type']===_0x56c118(0x255)){W('←\x20'+_0xf6cf8e[_0x56c118(0x259)]+_0x56c118(0x1df)+_0xf6cf8e[_0x56c118(0x224)]+'\x20priority='+(_0xf6cf8e[_0x56c118(0x207)]||_0x56c118(0x26e)));let _0x2b12c4=await Y(_0x56c118(0x223),{'alias':G,'limit':0x5});if(_0x2b12c4?.['ok']&&_0x2b12c4[_0x56c118(0x1fe)]?.['length']>0x0)for(let _0x5c5fd2 of _0x2b12c4[_0x56c118(0x1fe)]){let _0x1707cd={'sender':_0x5c5fd2[_0x56c118(0x263)]||_0x56c118(0x260),'sender_id':_0x56c118(0x216),'user':_0x5c5fd2[_0x56c118(0x263)]||'hub','task_id':_0x5c5fd2['id'],'priority':_0x5c5fd2['priority']||_0x56c118(0x26e)};D['set'](_0x5c5fd2['id'],_0x5c5fd2[_0x56c118(0x263)]||_0x56c118(0x260)),await x[_0x56c118(0x1e2)]({'method':_0x56c118(0x251),'params':{'content':_0x5c5fd2[_0x56c118(0x1dc)],'meta':_0x1707cd}}),W(_0x56c118(0x266)+_0x5c5fd2['id']['slice'](0x0,0x8)+_0x56c118(0x202)+_0x5c5fd2['from_session']+':\x20'+_0x5c5fd2['content']['slice'](0x0,0x3c)),await Y(_0x56c118(0x1de),{'alias':G,'message_id':_0x5c5fd2['id']});}}}async function n(){const _0x4da26e=a0_0x221966;let _0x54bc5e=new a0_0x8886fd();await x[_0x4da26e(0x20f)](_0x54bc5e),W(_0x4da26e(0x230)),W(_0x4da26e(0x234)),o()[_0x4da26e(0x222)](_0x1831e2=>W(_0x4da26e(0x1f9)+_0x1831e2)),Y('report_status',{'resume_id':K,'alias':G,'status':_0x4da26e(0x1db),'server':a0_0x47108d(),'hostname':a0_0x47108d(),'agent':_0x4da26e(0x211),'project_dir':process[_0x4da26e(0x221)](),'tmux_name':f||void 0x0})['then'](()=>W(_0x4da26e(0x23b)+G+_0x4da26e(0x1d8)+K[_0x4da26e(0x26c)](0x0,0x8)+')'))[_0x4da26e(0x222)](_0x11dd2f=>W(_0x4da26e(0x228)+_0x11dd2f)),setInterval(()=>{const _0x3d8a09=_0x4da26e;Y(_0x3d8a09(0x24d),{'resume_id':K,'alias':G,'status':_0x3d8a09(0x1db),'server':a0_0x47108d(),'hostname':a0_0x47108d(),'agent':'claude-code','project_dir':process[_0x3d8a09(0x221)](),'tmux_name':f||void 0x0})[_0x3d8a09(0x222)](_0x337418=>W(_0x3d8a09(0x21b)+_0x337418));},0x2bf20),W(_0x4da26e(0x21d));}n()[a0_0x221966(0x222)](_0xf26f1e=>{const _0x177e56=a0_0x221966;W(_0x177e56(0x23d)+_0xf26f1e),process['exit'](0x1);});function a0_0x1874(_0x3593ec,_0x3adf31){_0x3593ec=_0x3593ec-0x1d8;const _0x326282=a0_0x3262();let _0x18749e=_0x326282[_0x3593ec];return _0x18749e;}async function b(){const _0x41d9fb=a0_0x221966;W('shutting\x20down,\x20reporting\x20offline...'),await Y(_0x41d9fb(0x24d),{'resume_id':K,'alias':G,'status':_0x41d9fb(0x1e9),'task':_0x41d9fb(0x20d)})[_0x41d9fb(0x222)](()=>{}),process['exit'](0x0);}process['stdin']['on']('end',()=>b()),process['on'](a0_0x221966(0x1f1),()=>b()),process['on'](a0_0x221966(0x1da),()=>b());function a0_0x3262(){const _0x271eb9=['utf-8','initialize','slice','connecting\x20to\x20','normal','0.3.0','/mcp','\x22\x20(','pid','SIGINT','idle','content','get_all_status','ack_inbox',':\x20inbox_count=','completed','2966695aiXcGH','notification','read','task','Progress\x200-100','setRequestHandler','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','split','offline','235359gqkMpM','connected','result','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','message','alias','unknown\x20tool','SIGTERM','body','min','application/json','new_task','string','commhub_send_message','write','SSE\x20fatal:\x20',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','status','Current\x20task\x20description','messages','getReader','/events/','none','\x20from\x20','replace','startsWith','send_message','\x20/\x20hostname=','priority','490rbcfLa','parse','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','pop','error','session\x20disconnected','\x20PROJECT_ENV=','connect','commhub_reply','claude-code','find','.env','4467576Ybhlbq','unattributed-','commhub','number','statusText','commhub-channel','4798472GmtkRN','heartbeat\x20failed:\x20','cancelled','ready\x20—\x20waiting\x20for\x20events','SSE\x20error:\x20','params','delete','cwd','catch','get_inbox','inbox_count','working','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','1246280cPDohT','warning:\x20could\x20not\x20register:\x20','Target\x20session\x20alias','(none)','new_message','CommHub\x20init\x20failed:\x20','stderr','781939ukNfwS','replied','MCP\x20stdio\x20connected','.anet','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','SSE\x20connected\x20as\x20\x22','starting\x20SSE\x20listener...','from','object','stringify','failed','join','Task\x20content','registered\x20as\x20\x22','commhub_report_status','fatal:\x20','indexOf','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','tmux\x20display-message\x20-p\x20\x27#S\x27',']\x20[commhub]\x20','message_id','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','\x20RESUME_ID=','commhub_send_task','Session\x20alias:\x20','SSE\x20connection\x20error:\x20','text','blocked','78PAkmbK','http://127.0.0.1:9200','6IyhgFv','report_status','application/json,\x20text/event-stream','no\x20response','data:\x20','notifications/claude/channel','decode','toTimeString','now','broadcast','POST','in_progress','Authorization','type','144184Hoalgs','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','\x20CWD=','2.0','re-registered\x20as\x20\x22','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','hub','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','trim','from_session','commhub_get_all_status','re-register\x20failed:\x20','→\x20injected\x20task\x20','low','...\x20TMUX=','Bearer\x20'];a0_0x3262=function(){return _0x271eb9;};return a0_0x3262();}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.2.14-preview.0",
3
+ "version": "2.2.15-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",