@sleep2agi/agent-network 2.2.2-preview.0 → 2.2.2

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_0x3e5e98=a0_0x5acc;function a0_0x5acc(_0x5d1f43,_0x22e063){_0x5d1f43=_0x5d1f43-0x1b0;const _0x117f34=a0_0x117f();let _0x5acc5f=_0x117f34[_0x5d1f43];return _0x5acc5f;}(function(_0x20d2e7,_0x5f3c79){const _0x35e6b3=a0_0x5acc,_0x288977=_0x20d2e7();while(!![]){try{const _0x52b575=parseInt(_0x35e6b3(0x1bb))/0x1*(parseInt(_0x35e6b3(0x1f3))/0x2)+parseInt(_0x35e6b3(0x1d4))/0x3*(parseInt(_0x35e6b3(0x1c4))/0x4)+parseInt(_0x35e6b3(0x1b4))/0x5+-parseInt(_0x35e6b3(0x205))/0x6*(-parseInt(_0x35e6b3(0x1e6))/0x7)+-parseInt(_0x35e6b3(0x1bd))/0x8+-parseInt(_0x35e6b3(0x1cc))/0x9+-parseInt(_0x35e6b3(0x1bc))/0xa*(parseInt(_0x35e6b3(0x1fa))/0xb);if(_0x52b575===_0x5f3c79)break;else _0x288977['push'](_0x288977['shift']());}catch(_0x414d43){_0x288977['push'](_0x288977['shift']());}}}(a0_0x117f,0xebce5));import{EventEmitter as a0_0x35faba}from'events';import{hostname as a0_0x513164}from'os';class T extends a0_0x35faba{['url'];[a0_0x3e5e98(0x1fd)];[a0_0x3e5e98(0x1c3)];[a0_0x3e5e98(0x201)];[a0_0x3e5e98(0x1f1)];['heartbeatInterval'];[a0_0x3e5e98(0x1d8)];['heartbeatTimer'];[a0_0x3e5e98(0x203)];[a0_0x3e5e98(0x1b9)]=!0x1;constructor(_0x5f1061){const _0x517c34=a0_0x3e5e98;super();if(this[_0x517c34(0x208)]=_0x5f1061[_0x517c34(0x208)][_0x517c34(0x1ce)](/\/$/,''),this[_0x517c34(0x1fd)]=_0x5f1061[_0x517c34(0x1fd)],this[_0x517c34(0x1c3)]=_0x5f1061[_0x517c34(0x1c3)],this['agent']=_0x5f1061[_0x517c34(0x201)]||'sdk',this['resumeId']=_0x517c34(0x1fc)+_0x5f1061[_0x517c34(0x1fd)]+'-'+Date['now']()[_0x517c34(0x1c9)](0x24),this[_0x517c34(0x1e3)]=_0x5f1061[_0x517c34(0x1e3)]??0x2bf20,this['reconnectDelay']=_0x5f1061[_0x517c34(0x1d8)]??0xbb8,_0x5f1061[_0x517c34(0x1c0)]!==!0x1)this[_0x517c34(0x1b8)]();}['log'](_0x42c0f9){const _0x1995b7=a0_0x3e5e98;console[_0x1995b7(0x206)]('['+new Date()[_0x1995b7(0x1f4)]()[_0x1995b7(0x1f5)](0x0,0x8)+_0x1995b7(0x207)+this['alias']+']\x20'+_0x42c0f9);}async['call'](_0x48840a,_0x1c2035){const _0x3a6727=a0_0x3e5e98;let _0x41e975={'Content-Type':_0x3a6727(0x1b0),'Accept':_0x3a6727(0x1b5)};if(this['token'])_0x41e975[_0x3a6727(0x1e4)]=_0x3a6727(0x1eb)+this['token'];let _0x49fa8e=await(await fetch(this['url']+_0x3a6727(0x1f9),{'method':_0x3a6727(0x202),'headers':_0x41e975,'body':JSON['stringify']({'jsonrpc':_0x3a6727(0x200),'id':Date[_0x3a6727(0x1b2)](),'method':_0x3a6727(0x1ec),'params':{'name':_0x48840a,'arguments':_0x1c2035}})}))[_0x3a6727(0x1fb)](),_0x23e2fd=_0x49fa8e[_0x3a6727(0x1f7)](/data: (.+)/),_0x2cfacc=_0x23e2fd?JSON[_0x3a6727(0x1bf)](_0x23e2fd[0x1]):JSON['parse'](_0x49fa8e),_0x58331b=_0x2cfacc?.['result']?.[_0x3a6727(0x1cd)]?.[0x0]?.[_0x3a6727(0x1fb)];return _0x58331b?JSON[_0x3a6727(0x1bf)](_0x58331b):_0x2cfacc;}async[a0_0x3e5e98(0x1b8)](){const _0x42b9ec=a0_0x3e5e98;if(this['running'])return;this[_0x42b9ec(0x1b9)]=!0x0,await this[_0x42b9ec(0x1e5)](_0x42b9ec(0x1df)),this[_0x42b9ec(0x206)](_0x42b9ec(0x209)),this[_0x42b9ec(0x1f6)]=setInterval(()=>{const _0x728a4c=_0x42b9ec;this[_0x728a4c(0x1e5)](_0x728a4c(0x1df))[_0x728a4c(0x1e9)](_0x53c721=>this[_0x728a4c(0x206)](_0x728a4c(0x1c5)+_0x53c721[_0x728a4c(0x1d1)]));},this['heartbeatInterval']),this[_0x42b9ec(0x1f8)]();}async[a0_0x3e5e98(0x1d3)](){const _0x38ce05=a0_0x3e5e98;if(this[_0x38ce05(0x1b9)]=!0x1,this[_0x38ce05(0x203)]?.[_0x38ce05(0x1ef)](),this[_0x38ce05(0x1f6)])clearInterval(this[_0x38ce05(0x1f6)]);await this[_0x38ce05(0x1e5)](_0x38ce05(0x1cf))[_0x38ce05(0x1e9)](()=>{}),this[_0x38ce05(0x206)](_0x38ce05(0x1d5));}async['send'](_0x159e81,_0x388547,_0x534b72=a0_0x3e5e98(0x1d6)){const _0x26b360=a0_0x3e5e98;return this[_0x26b360(0x1e1)]('send_task',{'alias':_0x159e81,'task':_0x388547,'priority':_0x534b72,'from_session':this[_0x26b360(0x1fd)]});}async['message'](_0x165dad,_0x542cf7){const _0x586efe=a0_0x3e5e98;return this[_0x586efe(0x1e1)](_0x586efe(0x204),{'alias':_0x165dad,'message':_0x542cf7,'from_session':this[_0x586efe(0x1fd)]});}async[a0_0x3e5e98(0x1b1)](_0x3dc9b1,_0x37462e,_0xc7831='completed'){const _0xe22f8d=a0_0x3e5e98;return this[_0xe22f8d(0x1e1)](_0xe22f8d(0x1c6),{'in_reply_to':_0x3dc9b1,'text':_0x37462e,'status':_0xc7831});}async[a0_0x3e5e98(0x1e5)](_0x1477a0,_0xc8c67f){const _0x599463=a0_0x3e5e98;return this[_0x599463(0x1e1)](_0x599463(0x1dc),{'resume_id':this[_0x599463(0x1f1)],'alias':this[_0x599463(0x1fd)],'status':_0x1477a0,'server':a0_0x513164(),'hostname':a0_0x513164(),'agent':this[_0x599463(0x201)],'project_dir':process[_0x599463(0x1c1)](),..._0xc8c67f});}async[a0_0x3e5e98(0x1ea)](){const _0x319be4=a0_0x3e5e98;return this[_0x319be4(0x1e1)]('get_all_status',{});}async[a0_0x3e5e98(0x1be)](_0x8fdef2,_0x55a9bc){const _0x426bb3=a0_0x3e5e98;return this[_0x426bb3(0x1e1)](_0x426bb3(0x1be),{'message':_0x8fdef2,'filter_server':_0x55a9bc?.[_0x426bb3(0x1ee)],'filter_status':_0x55a9bc?.['status']});}async[a0_0x3e5e98(0x1f8)](){const _0x19d74b=a0_0x3e5e98;let _0x40b178=encodeURIComponent(this[_0x19d74b(0x1fd)]),_0x325248=this['url']+_0x19d74b(0x1d0)+_0x40b178,_0x4bac5a=this['reconnectDelay'];while(this[_0x19d74b(0x1b9)]){try{this[_0x19d74b(0x203)]=new AbortController();let _0x4ed062={'Accept':_0x19d74b(0x1dd)};if(this[_0x19d74b(0x1c3)])_0x4ed062[_0x19d74b(0x1e4)]='Bearer\x20'+this[_0x19d74b(0x1c3)];let _0x2c66ac=await fetch(_0x325248,{'headers':_0x4ed062,'signal':this['sseAbort'][_0x19d74b(0x1b7)]});if(!_0x2c66ac['ok']||!_0x2c66ac[_0x19d74b(0x1b3)]){this[_0x19d74b(0x206)](_0x19d74b(0x1e7)+_0x2c66ac[_0x19d74b(0x1e5)]),await this[_0x19d74b(0x1b6)](_0x4bac5a),_0x4bac5a=Math[_0x19d74b(0x1c2)](_0x4bac5a*1.5,0xea60);continue;}_0x4bac5a=this[_0x19d74b(0x1d8)];let _0x8fcc4=_0x2c66ac['body']['getReader'](),_0x46f974=new TextDecoder(),_0x1d69fa='';while(this[_0x19d74b(0x1b9)]){let {done:_0x3949aa,value:_0x5da831}=await _0x8fcc4['read']();if(_0x3949aa)break;_0x1d69fa+=_0x46f974[_0x19d74b(0x1ff)](_0x5da831,{'stream':!0x0});let _0x231f5a=_0x1d69fa[_0x19d74b(0x1ba)]('\x0a');_0x1d69fa=_0x231f5a[_0x19d74b(0x1cb)]()||'';for(let _0xea4c03 of _0x231f5a){if(!_0xea4c03[_0x19d74b(0x1ca)](_0x19d74b(0x1e8)))continue;try{let _0x2c2963=JSON[_0x19d74b(0x1bf)](_0xea4c03[_0x19d74b(0x1f5)](0x6));if(_0x2c2963[_0x19d74b(0x1f0)]===_0x19d74b(0x1d2)){this[_0x19d74b(0x206)]('SSE\x20connected'),this[_0x19d74b(0x1de)](_0x19d74b(0x1d2));continue;}if(_0x2c2963[_0x19d74b(0x1f0)]===_0x19d74b(0x1e2)||_0x2c2963[_0x19d74b(0x1f0)]===_0x19d74b(0x1c7)||_0x2c2963[_0x19d74b(0x1f0)]===_0x19d74b(0x1be))await this[_0x19d74b(0x1da)]();}catch{}}}}catch(_0x3a2894){if(_0x3a2894[_0x19d74b(0x1d9)]===_0x19d74b(0x1e0))break;this['emit'](_0x19d74b(0x1ed),_0x3a2894),this[_0x19d74b(0x206)](_0x19d74b(0x1c8)+_0x3a2894[_0x19d74b(0x1d1)]);}if(this['running'])this['emit'](_0x19d74b(0x1d5)),this[_0x19d74b(0x206)]('SSE\x20reconnecting\x20in\x20'+_0x4bac5a/0x3e8+'s...'),await this[_0x19d74b(0x1b6)](_0x4bac5a),_0x4bac5a=Math[_0x19d74b(0x1c2)](_0x4bac5a*1.5,0xea60);}}async[a0_0x3e5e98(0x1da)](){const _0x1aee87=a0_0x3e5e98;try{let _0x35d6a6=(await this[_0x1aee87(0x1e1)](_0x1aee87(0x1fe),{'alias':this[_0x1aee87(0x1fd)],'limit':0xa}))?.[_0x1aee87(0x1db)]||[];for(let _0x5a0c69 of _0x35d6a6)await this[_0x1aee87(0x1e1)](_0x1aee87(0x1f2),{'alias':this[_0x1aee87(0x1fd)],'message_id':_0x5a0c69['id']}),this['log']('←\x20'+_0x5a0c69['from_session']+':\x20'+_0x5a0c69[_0x1aee87(0x1cd)]['slice'](0x0,0x3c)),this[_0x1aee87(0x1de)](_0x1aee87(0x1d7),_0x5a0c69),this[_0x1aee87(0x1de)](_0x1aee87(0x1d1),_0x5a0c69);}catch(_0x435859){this[_0x1aee87(0x206)]('inbox\x20error:\x20'+_0x435859[_0x1aee87(0x1d1)]);}}[a0_0x3e5e98(0x1b6)](_0x4ee17e){return new Promise(_0xfe0263=>setTimeout(_0xfe0263,_0x4ee17e));}}var $=T;function a0_0x117f(){const _0xae2947=['message','connected','disconnect','12846lgJYPu','disconnected','normal','task','reconnectDelay','name','processInbox','messages','report_status','text/event-stream','emit','idle','AbortError','call','new_task','heartbeatInterval','Authorization','status','7396459coExoE','SSE\x20failed:\x20','data:\x20','catch','getAllStatus','Bearer\x20','tools/call','error','server','abort','type','resumeId','ack_inbox','4YUUETw','toTimeString','slice','heartbeatTimer','match','connectSSE','/mcp','1983652hdTYft','text','sdk-','alias','get_inbox','decode','2.0','agent','POST','sseAbort','send_message','6dIEYcP','log',']\x20[commhub:','url','registered','application/json','reply','now','body','4748170OPIAUV','application/json,\x20text/event-stream','sleep','signal','connect','running','split','485519lxaVSd','20vtlSMo','9358864NmtcNI','broadcast','parse','autoConnect','cwd','min','token','188TkZCYE','heartbeat\x20failed:\x20','send_reply','new_message','SSE\x20error:\x20','toString','startsWith','pop','6139620vkljBF','content','replace','offline','/events/'];a0_0x117f=function(){return _0xae2947;};return a0_0x117f();}export{$ as default,T as CommHub};
1
+ const a0_0x3d7897=a0_0x21c1;(function(_0x443b3f,_0x524ecd){const _0x29b635=a0_0x21c1,_0x24711d=_0x443b3f();while(!![]){try{const _0x650ae4=parseInt(_0x29b635(0xf7))/0x1*(parseInt(_0x29b635(0x10f))/0x2)+-parseInt(_0x29b635(0xf5))/0x3*(-parseInt(_0x29b635(0x105))/0x4)+parseInt(_0x29b635(0x10c))/0x5+parseInt(_0x29b635(0xdc))/0x6*(parseInt(_0x29b635(0xfb))/0x7)+parseInt(_0x29b635(0xf1))/0x8*(parseInt(_0x29b635(0xe7))/0x9)+-parseInt(_0x29b635(0xce))/0xa*(-parseInt(_0x29b635(0xdf))/0xb)+-parseInt(_0x29b635(0xfc))/0xc;if(_0x650ae4===_0x524ecd)break;else _0x24711d['push'](_0x24711d['shift']());}catch(_0x1e1821){_0x24711d['push'](_0x24711d['shift']());}}}(a0_0x56a4,0xe6cba));function a0_0x56a4(){const _0x4641ab=['toString','from_session','2NNXyBV','name','min','Authorization','cwd','processInbox','/events/','log','registered','sseAbort','connect','resumeId','status','get_inbox','text','SSE\x20failed:\x20','disconnected','application/json,\x20text/event-stream','tools/call','toTimeString','send_task','227110gXQjSz','normal','completed','content','split','alias','body','message','s...','new_message','reconnectDelay','2.0','heartbeatTimer','broadcast','980436OrjFgQ','task','now','319hkGZXX','SSE\x20error:\x20','text/event-stream','inbox\x20error:\x20','POST','url','stringify','heartbeat\x20failed:\x20','13802931IrpVZi','parse','getAllStatus','heartbeatInterval','startsWith','AbortError','send_reply','error','slice','getReader','8kSGkzb','sdk','call','Bearer\x20','5934ObvukP','read','879059XnczUr','type','reply',']\x20[commhub:','56ttPrFq','59238240yVILio','data:\x20','agent','send_message','emit','sleep','new_task','idle','token','792ndWQCY','running','report_status','decode','abort','match','catch','5558145keajsf'];a0_0x56a4=function(){return _0x4641ab;};return a0_0x56a4();}import{EventEmitter as a0_0x35b3d6}from'events';import{hostname as a0_0x3df197}from'os';class T extends a0_0x35b3d6{[a0_0x3d7897(0xe4)];['alias'];[a0_0x3d7897(0x104)];[a0_0x3d7897(0xfe)];[a0_0x3d7897(0x11a)];['heartbeatInterval'];['reconnectDelay'];[a0_0x3d7897(0xda)];[a0_0x3d7897(0x118)];[a0_0x3d7897(0x106)]=!0x1;constructor(_0x1224f1){const _0x22d927=a0_0x3d7897;super();if(this[_0x22d927(0xe4)]=_0x1224f1[_0x22d927(0xe4)]['replace'](/\/$/,''),this[_0x22d927(0xd3)]=_0x1224f1[_0x22d927(0xd3)],this[_0x22d927(0x104)]=_0x1224f1[_0x22d927(0x104)],this[_0x22d927(0xfe)]=_0x1224f1['agent']||_0x22d927(0xf2),this[_0x22d927(0x11a)]='sdk-'+_0x1224f1['alias']+'-'+Date[_0x22d927(0xde)]()[_0x22d927(0x10d)](0x24),this['heartbeatInterval']=_0x1224f1[_0x22d927(0xea)]??0x2bf20,this[_0x22d927(0xd8)]=_0x1224f1['reconnectDelay']??0xbb8,_0x1224f1['autoConnect']!==!0x1)this[_0x22d927(0x119)]();}[a0_0x3d7897(0x116)](_0x2be55a){const _0x2f269b=a0_0x3d7897;console[_0x2f269b(0x116)]('['+new Date()[_0x2f269b(0xcc)]()[_0x2f269b(0xef)](0x0,0x8)+_0x2f269b(0xfa)+this['alias']+']\x20'+_0x2be55a);}async[a0_0x3d7897(0xf3)](_0x16ec18,_0x128c75){const _0x4dcbe1=a0_0x3d7897;let _0x47765f={'Content-Type':'application/json','Accept':_0x4dcbe1(0xca)};if(this['token'])_0x47765f['Authorization']=_0x4dcbe1(0xf4)+this[_0x4dcbe1(0x104)];let _0x5e00f8=await(await fetch(this[_0x4dcbe1(0xe4)]+'/mcp',{'method':_0x4dcbe1(0xe3),'headers':_0x47765f,'body':JSON[_0x4dcbe1(0xe5)]({'jsonrpc':_0x4dcbe1(0xd9),'id':Date[_0x4dcbe1(0xde)](),'method':_0x4dcbe1(0xcb),'params':{'name':_0x16ec18,'arguments':_0x128c75}})}))[_0x4dcbe1(0x11d)](),_0x261700=_0x5e00f8[_0x4dcbe1(0x10a)](/data: (.+)/),_0x21ad6c=_0x261700?JSON[_0x4dcbe1(0xe8)](_0x261700[0x1]):JSON['parse'](_0x5e00f8),_0x903897=_0x21ad6c?.['result']?.[_0x4dcbe1(0xd1)]?.[0x0]?.['text'];return _0x903897?JSON[_0x4dcbe1(0xe8)](_0x903897):_0x21ad6c;}async['connect'](){const _0x2d0758=a0_0x3d7897;if(this[_0x2d0758(0x106)])return;this[_0x2d0758(0x106)]=!0x0,await this['status'](_0x2d0758(0x103)),this[_0x2d0758(0x116)](_0x2d0758(0x117)),this[_0x2d0758(0xda)]=setInterval(()=>{const _0x507957=_0x2d0758;this[_0x507957(0x11b)]('idle')[_0x507957(0x10b)](_0x3ebf5d=>this[_0x507957(0x116)](_0x507957(0xe6)+_0x3ebf5d['message']));},this[_0x2d0758(0xea)]),this['connectSSE']();}async['disconnect'](){const _0x25ab74=a0_0x3d7897;if(this[_0x25ab74(0x106)]=!0x1,this[_0x25ab74(0x118)]?.[_0x25ab74(0x109)](),this[_0x25ab74(0xda)])clearInterval(this[_0x25ab74(0xda)]);await this[_0x25ab74(0x11b)]('offline')['catch'](()=>{}),this[_0x25ab74(0x116)](_0x25ab74(0x11f));}async['send'](_0x45548c,_0x8e4943,_0x5325a3=a0_0x3d7897(0xcf)){const _0x41268d=a0_0x3d7897;return this[_0x41268d(0xf3)](_0x41268d(0xcd),{'alias':_0x45548c,'task':_0x8e4943,'priority':_0x5325a3,'from_session':this['alias']});}async[a0_0x3d7897(0xd5)](_0x2afd76,_0x1d42c5){const _0xf4f732=a0_0x3d7897;return this[_0xf4f732(0xf3)](_0xf4f732(0xff),{'alias':_0x2afd76,'message':_0x1d42c5,'from_session':this[_0xf4f732(0xd3)]});}async[a0_0x3d7897(0xf9)](_0x2fa7e7,_0x25ad47,_0x34a8ea=a0_0x3d7897(0xd0)){const _0x28644f=a0_0x3d7897;return this[_0x28644f(0xf3)](_0x28644f(0xed),{'in_reply_to':_0x2fa7e7,'text':_0x25ad47,'status':_0x34a8ea});}async['status'](_0x5ace45,_0x586463){const _0x2a4ca6=a0_0x3d7897;return this['call'](_0x2a4ca6(0x107),{'resume_id':this[_0x2a4ca6(0x11a)],'alias':this[_0x2a4ca6(0xd3)],'status':_0x5ace45,'server':a0_0x3df197(),'hostname':a0_0x3df197(),'agent':this[_0x2a4ca6(0xfe)],'project_dir':process[_0x2a4ca6(0x113)](),..._0x586463});}async[a0_0x3d7897(0xe9)](){const _0xc00856=a0_0x3d7897;return this[_0xc00856(0xf3)]('get_all_status',{});}async[a0_0x3d7897(0xdb)](_0x5d009e,_0x460656){const _0x3b38dc=a0_0x3d7897;return this[_0x3b38dc(0xf3)]('broadcast',{'message':_0x5d009e,'filter_server':_0x460656?.['server'],'filter_status':_0x460656?.[_0x3b38dc(0x11b)]});}async['connectSSE'](){const _0x456cc3=a0_0x3d7897;let _0x202c27=encodeURIComponent(this[_0x456cc3(0xd3)]),_0x985c72=this[_0x456cc3(0xe4)]+_0x456cc3(0x115)+_0x202c27,_0xd4c084=this[_0x456cc3(0xd8)];while(this['running']){try{this['sseAbort']=new AbortController();let _0xf53f9c={'Accept':_0x456cc3(0xe1)};if(this[_0x456cc3(0x104)])_0xf53f9c[_0x456cc3(0x112)]=_0x456cc3(0xf4)+this['token'];let _0x1f9b5b=await fetch(_0x985c72,{'headers':_0xf53f9c,'signal':this[_0x456cc3(0x118)]['signal']});if(!_0x1f9b5b['ok']||!_0x1f9b5b[_0x456cc3(0xd4)]){this[_0x456cc3(0x116)](_0x456cc3(0x11e)+_0x1f9b5b[_0x456cc3(0x11b)]),await this[_0x456cc3(0x101)](_0xd4c084),_0xd4c084=Math['min'](_0xd4c084*1.5,0xea60);continue;}_0xd4c084=this[_0x456cc3(0xd8)];let _0x58a7ec=_0x1f9b5b[_0x456cc3(0xd4)][_0x456cc3(0xf0)](),_0x59ea75=new TextDecoder(),_0x5cd595='';while(this[_0x456cc3(0x106)]){let {done:_0x232e1b,value:_0x27e338}=await _0x58a7ec[_0x456cc3(0xf6)]();if(_0x232e1b)break;_0x5cd595+=_0x59ea75[_0x456cc3(0x108)](_0x27e338,{'stream':!0x0});let _0x16b22b=_0x5cd595[_0x456cc3(0xd2)]('\x0a');_0x5cd595=_0x16b22b['pop']()||'';for(let _0x25387a of _0x16b22b){if(!_0x25387a[_0x456cc3(0xeb)](_0x456cc3(0xfd)))continue;try{let _0x446843=JSON[_0x456cc3(0xe8)](_0x25387a[_0x456cc3(0xef)](0x6));if(_0x446843[_0x456cc3(0xf8)]==='connected'){this['log']('SSE\x20connected'),this[_0x456cc3(0x100)]('connected');continue;}if(_0x446843[_0x456cc3(0xf8)]===_0x456cc3(0x102)||_0x446843['type']===_0x456cc3(0xd7)||_0x446843['type']===_0x456cc3(0xdb))await this[_0x456cc3(0x114)]();}catch{}}}}catch(_0x86b503){if(_0x86b503[_0x456cc3(0x110)]===_0x456cc3(0xec))break;this[_0x456cc3(0x100)](_0x456cc3(0xee),_0x86b503),this[_0x456cc3(0x116)](_0x456cc3(0xe0)+_0x86b503[_0x456cc3(0xd5)]);}if(this[_0x456cc3(0x106)])this['emit'](_0x456cc3(0x11f)),this['log']('SSE\x20reconnecting\x20in\x20'+_0xd4c084/0x3e8+_0x456cc3(0xd6)),await this[_0x456cc3(0x101)](_0xd4c084),_0xd4c084=Math[_0x456cc3(0x111)](_0xd4c084*1.5,0xea60);}}async[a0_0x3d7897(0x114)](){const _0x4d276e=a0_0x3d7897;try{let _0x596b66=(await this[_0x4d276e(0xf3)](_0x4d276e(0x11c),{'alias':this[_0x4d276e(0xd3)],'limit':0xa}))?.['messages']||[];for(let _0x3fd757 of _0x596b66)await this[_0x4d276e(0xf3)]('ack_inbox',{'alias':this['alias'],'message_id':_0x3fd757['id']}),this['log']('←\x20'+_0x3fd757[_0x4d276e(0x10e)]+':\x20'+_0x3fd757[_0x4d276e(0xd1)][_0x4d276e(0xef)](0x0,0x3c)),this[_0x4d276e(0x100)](_0x4d276e(0xdd),_0x3fd757),this[_0x4d276e(0x100)](_0x4d276e(0xd5),_0x3fd757);}catch(_0x11b8c2){this[_0x4d276e(0x116)](_0x4d276e(0xe2)+_0x11b8c2['message']);}}[a0_0x3d7897(0x101)](_0x1c2140){return new Promise(_0x516d21=>setTimeout(_0x516d21,_0x1c2140));}}function a0_0x21c1(_0xb7afbb,_0x235bcc){_0xb7afbb=_0xb7afbb-0xca;const _0x56a491=a0_0x56a4();let _0x21c1af=_0x56a491[_0xb7afbb];return _0x21c1af;}var $=T;export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x923dcb=a0_0x2d2b;(function(_0x5a8f08,_0x3aafcb){const _0x477a66=a0_0x2d2b,_0x13c18d=_0x5a8f08();while(!![]){try{const _0x1425c1=parseInt(_0x477a66(0xd7))/0x1+parseInt(_0x477a66(0x10f))/0x2*(-parseInt(_0x477a66(0x143))/0x3)+-parseInt(_0x477a66(0xd5))/0x4+parseInt(_0x477a66(0xc8))/0x5*(-parseInt(_0x477a66(0xec))/0x6)+parseInt(_0x477a66(0x136))/0x7+parseInt(_0x477a66(0x119))/0x8*(-parseInt(_0x477a66(0xd9))/0x9)+parseInt(_0x477a66(0x12f))/0xa;if(_0x1425c1===_0x3aafcb)break;else _0x13c18d['push'](_0x13c18d['shift']());}catch(_0x31739a){_0x13c18d['push'](_0x13c18d['shift']());}}}(a0_0x59ee,0x25b83));import{readFileSync as a0_0x1f5938,existsSync as a0_0x5589c6}from'fs';import{randomUUID as a0_0x13945d}from'crypto';import{join as a0_0x1ed1b6}from'path';import{hostname as a0_0x57e10e}from'os';import{execSync as a0_0x14efb6}from'child_process';import{Server as a0_0xebd3b8}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x4677d3}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x58d468,CallToolRequestSchema as a0_0x4e9b91}from'@modelcontextprotocol/sdk/types.js';function p(_0x2a1625){const _0x23e831=a0_0x2d2b;if(!a0_0x5589c6(_0x2a1625))return;for(let _0x48f1a of a0_0x1f5938(_0x2a1625,_0x23e831(0x148))[_0x23e831(0xfc)]('\x0a')){let _0x286d8f=_0x48f1a[_0x23e831(0x10e)]();if(!_0x286d8f||_0x286d8f[_0x23e831(0x103)]('#'))continue;let _0xa45a13=_0x286d8f[_0x23e831(0xba)]('=');if(_0xa45a13<0x0)continue;let _0x5e0555=_0x286d8f[_0x23e831(0xfd)](0x0,_0xa45a13)[_0x23e831(0x10e)](),_0x424c38=_0x286d8f[_0x23e831(0xfd)](_0xa45a13+0x1)['trim']()[_0x23e831(0xc9)](/^["']|["']$/g,'');if(!process.env[_0x5e0555])process.env[_0x5e0555]=_0x424c38;}}var C=process.env.HOME||'~',T=a0_0x1ed1b6(C,'.claude/channels/commhub');p(a0_0x1ed1b6(T,a0_0x923dcb(0xef)));var L=process[a0_0x923dcb(0x142)]()[a0_0x923dcb(0xc9)](/\//g,'-');p(a0_0x1ed1b6(T,L,a0_0x923dcb(0xef)));function a0_0x59ee(){const _0x21c524=['/events/','1654646BXlrYy','.anet','stringify','ready\x20—\x20waiting\x20for\x20events','→\x20injected\x20task\x20','pop','SSE\x20connection\x20error:\x20','2025-03-26','decode','none','ack_inbox','SSE\x20connected\x20as\x20\x22','cwd','709899SjeKUQ','delete','CommHub\x20init\x20failed:\x20','0.3.0','MCP\x20stdio\x20connected','utf-8','\x20from\x20','indexOf','write','\x20RESUME_ID=','completed','normal','number','claude-code','read','\x20PROJECT_ENV=','setRequestHandler','notifications/claude/channel','parse\x20error:\x20','text','SIGINT','86215UftjCv','replace','Session\x20alias:\x20','content','initialize','set','in_progress','POST','registered\x20as\x20\x22','from','commhub_send_task','commhub-channel','exit','1167532mjTnhJ','notification','251388SSoKph','result','85815OUFTsN','new_task','then','catch','config.json','init\x20failed:\x20','toTimeString',']\x20[commhub]\x20','unknown\x20tool','send_message','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','from_session','Priority\x20(default:\x20normal)','SSE\x20stream\x20ended,\x20reconnecting...','\x22\x20(','get','messages','stdin','Target\x20session\x20alias','42KmfZyO','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','2.0','.env','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','SIGTERM','send_task','connected','tmux\x20display-message\x20-p\x20\x27#S\x27','string','commhub_reply','fatal:\x20','tools/call','object','find','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','split','slice','no\x20response','hub','heartbeat\x20failed:\x20','\x20ALIAS=','Bearer\x20','startsWith','session\x20disconnected','params','alias','\x20priority=','statusText','failed','report_status','connect','status','idle','trim','2XZFMaB','ENV:\x20URL=','high','application/json','parse','Authorization','Message\x20content','priority','Reply\x20text\x20/\x20result\x20summary','SSE\x20fatal:\x20','104qiXqUP','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','message_id','message','blocked','send_reply','http://127.0.0.1:9200',':\x20inbox_count=','application/json,\x20text/event-stream','inbox_count','type','join','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','task','getReader','starting\x20SSE\x20listener...','\x20CWD=','cancelled','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','connecting\x20to\x20','commhub_send_message','working','4399050pKpfrh','error','body','commhub','low','commhub_get_all_status'];a0_0x59ee=function(){return _0x21c524;};return a0_0x59ee();}function U(){const _0x5ef342=a0_0x923dcb;try{return a0_0x14efb6(_0x5ef342(0xf4),{'encoding':_0x5ef342(0x148),'timeout':0x7d0})['trim']();}catch{return'';}}function v(){const _0x2e647c=a0_0x923dcb;try{let _0x110a40=a0_0x1ed1b6(C,_0x2e647c(0x137),_0x2e647c(0xdd));if(a0_0x5589c6(_0x110a40))return JSON[_0x2e647c(0x113)](a0_0x1f5938(_0x110a40,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x923dcb(0xff)]||a0_0x923dcb(0x11f),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x57e10e(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x13945d(),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x2d430d){const _0x1234cd=a0_0x923dcb;let _0x2c30f0=new Date()[_0x1234cd(0xdf)]()['slice'](0x0,0x8);process['stderr'][_0x1234cd(0xbb)]('['+_0x2c30f0+_0x1234cd(0xe0)+_0x2d430d+'\x0a');}function h(_0x172eee){return new Promise(_0x17d5b4=>setTimeout(_0x17d5b4,_0x172eee));}Y(a0_0x923dcb(0x110)+f+a0_0x923dcb(0x101)+Z+a0_0x923dcb(0xbc)+w['slice'](0x0,0x8)+'...\x20TMUX='+(j||a0_0x923dcb(0x13f))+a0_0x923dcb(0x129)+process['cwd']()+a0_0x923dcb(0xc2)+L);var k=new Map(),K=new a0_0xebd3b8({'name':a0_0x923dcb(0xd3),'version':a0_0x923dcb(0x146)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x923dcb(0xfb),a0_0x923dcb(0xf0),a0_0x923dcb(0xe3),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x923dcb(0xca)+Z][a0_0x923dcb(0x124)]('\x0a')});K[a0_0x923dcb(0xc3)](a0_0x58d468,async()=>({'tools':[{'name':'commhub_reply','description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x923dcb(0xf5),'description':a0_0x923dcb(0xed)},'text':{'type':a0_0x923dcb(0xf5),'description':a0_0x923dcb(0x117)},'status':{'type':a0_0x923dcb(0xf5),'enum':[a0_0x923dcb(0xbd),a0_0x923dcb(0x109),a0_0x923dcb(0x12a),a0_0x923dcb(0x11d),a0_0x923dcb(0x130),a0_0x923dcb(0xce)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x923dcb(0xc6)]}},{'name':'commhub_report_status','description':a0_0x923dcb(0x12b),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x923dcb(0xf5),'enum':[a0_0x923dcb(0x12e),a0_0x923dcb(0x10d),'blocked',a0_0x923dcb(0x130)]},'task':{'type':a0_0x923dcb(0xf5),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x923dcb(0xbf),'description':'Progress\x200-100'}},'required':[a0_0x923dcb(0x10c)]}},{'name':a0_0x923dcb(0xd2),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x923dcb(0xf5),'description':a0_0x923dcb(0xeb)},'task':{'type':a0_0x923dcb(0xf5),'description':'Task\x20content'},'priority':{'type':'string','enum':[a0_0x923dcb(0x111),a0_0x923dcb(0xbe),a0_0x923dcb(0x133)],'description':a0_0x923dcb(0xe5)}},'required':[a0_0x923dcb(0x106),a0_0x923dcb(0x126)]}},{'name':a0_0x923dcb(0x12d),'description':a0_0x923dcb(0x11a),'inputSchema':{'type':a0_0x923dcb(0xf9),'properties':{'alias':{'type':a0_0x923dcb(0xf5),'description':a0_0x923dcb(0xeb)},'message':{'type':a0_0x923dcb(0xf5),'description':a0_0x923dcb(0x115)}},'required':[a0_0x923dcb(0x106),a0_0x923dcb(0x11c)]}},{'name':a0_0x923dcb(0x134),'description':a0_0x923dcb(0x125),'inputSchema':{'type':a0_0x923dcb(0xf9),'properties':{}}}]}));async function P(_0x358001,_0x4846cb){const _0x19c9c5=a0_0x923dcb;let _0x5625fd=await fetch(f+'/mcp',{'method':_0x19c9c5(0xcf),'headers':{'Content-Type':_0x19c9c5(0x112),'Accept':_0x19c9c5(0x121),...X?{'Authorization':_0x19c9c5(0x102)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x19c9c5(0xee),'id':0x1,'method':_0x19c9c5(0xcc),'params':{'protocolVersion':_0x19c9c5(0x13d),'capabilities':{},'clientInfo':{'name':_0x19c9c5(0xd3),'version':_0x19c9c5(0x146)}}})});if(!_0x5625fd['ok']){let _0x30610d=await _0x5625fd[_0x19c9c5(0xc6)]();return Y(_0x19c9c5(0x145)+_0x5625fd[_0x19c9c5(0x10c)]+'\x20'+_0x30610d['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x19c9c5(0xde)+_0x5625fd[_0x19c9c5(0x10c)]};}await _0x5625fd[_0x19c9c5(0xc6)]();let _0x362a6e=(await(await fetch(f+'/mcp',{'method':_0x19c9c5(0xcf),'headers':{'Content-Type':'application/json','Accept':_0x19c9c5(0x121),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x19c9c5(0xee),'id':0x2,'method':_0x19c9c5(0xf8),'params':{'name':_0x358001,'arguments':_0x4846cb}})}))['text']())[_0x19c9c5(0xfc)]('\x0a')[_0x19c9c5(0xfa)](_0x5860b3=>_0x5860b3[_0x19c9c5(0x103)]('data:\x20'));if(_0x362a6e){let _0x559da1=JSON[_0x19c9c5(0x113)](_0x362a6e[_0x19c9c5(0xfd)](0x6));return _0x559da1?.[_0x19c9c5(0xd8)]?.[_0x19c9c5(0xcb)]?.[0x0]?.['text']?JSON[_0x19c9c5(0x113)](_0x559da1[_0x19c9c5(0xd8)]['content'][0x0][_0x19c9c5(0xc6)]):_0x559da1;}return{'ok':!0x1,'error':_0x19c9c5(0xfe)};}K[a0_0x923dcb(0xc3)](a0_0x4e9b91,async _0x13adc9=>{const _0x3b24d3=a0_0x923dcb;let {name:_0x478fe6,arguments:_0xb089ca}=_0x13adc9[_0x3b24d3(0x105)];if(_0x478fe6===_0x3b24d3(0xf6)){let {task_id:_0x320e0f,text:_0x17cd46,status:_0x355eb3}=_0xb089ca;if(_0x355eb3===_0x3b24d3(0xbd)||_0x355eb3===_0x3b24d3(0x109)||_0x355eb3===_0x3b24d3(0x12a)){let _0x3f000e=_0x355eb3===_0x3b24d3(0xbd)?'replied':_0x355eb3,_0x361c07=_0x320e0f?k[_0x3b24d3(0xe8)](_0x320e0f)||_0x3b24d3(0xff):_0x3b24d3(0xff),_0x153f98=await P(_0x3b24d3(0x11e),{'alias':_0x361c07,'text':_0x17cd46,'in_reply_to':_0x320e0f||void 0x0,'status':_0x3f000e,'from_session':Z});if(_0x320e0f)k[_0x3b24d3(0x144)](_0x320e0f);return{'content':[{'type':'text','text':JSON[_0x3b24d3(0x138)](_0x153f98)}]};}let _0x2a3cdb=await P(_0x3b24d3(0x10a),{'resume_id':w,'alias':Z,'status':_0x355eb3==='blocked'?'blocked':_0x355eb3===_0x3b24d3(0x130)?'error':_0x3b24d3(0x12e),'task':_0x17cd46[_0x3b24d3(0xfd)](0x0,0xc8),'output':_0x17cd46});return{'content':[{'type':'text','text':JSON[_0x3b24d3(0x138)](_0x2a3cdb)}]};}if(_0x478fe6==='commhub_report_status'){let {status:_0x5e9552,task:_0x213c8b,progress:_0x2bf419}=_0xb089ca,_0x383f12=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x5e9552,'task':_0x213c8b,'progress':_0x2bf419});return{'content':[{'type':'text','text':JSON[_0x3b24d3(0x138)](_0x383f12)}]};}if(_0x478fe6==='commhub_send_task'){let {alias:_0x2e1cde,task:_0x2e7deb,priority:_0x4bb4a7}=_0xb089ca,_0x1084ec=await P(_0x3b24d3(0xf2),{'alias':_0x2e1cde,'task':_0x2e7deb,'priority':_0x4bb4a7||_0x3b24d3(0xbe),'from_session':Z});return{'content':[{'type':_0x3b24d3(0xc6),'text':JSON[_0x3b24d3(0x138)](_0x1084ec)}]};}if(_0x478fe6===_0x3b24d3(0x12d)){let {alias:_0xe5410e,message:_0x1864b7}=_0xb089ca,_0x4f7d19=await P(_0x3b24d3(0xe2),{'alias':_0xe5410e,'message':_0x1864b7,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x3b24d3(0x138)](_0x4f7d19)}]};}if(_0x478fe6===_0x3b24d3(0x134)){let _0x9a58a5=await P('get_all_status',{});return{'content':[{'type':_0x3b24d3(0xc6),'text':JSON[_0x3b24d3(0x138)](_0x9a58a5)}]};}return{'content':[{'type':_0x3b24d3(0xc6),'text':JSON[_0x3b24d3(0x138)]({'error':_0x3b24d3(0xe1)})}]};});async function u(){const _0x1a2d65=a0_0x923dcb;let _0x12d9d8=f+_0x1a2d65(0x135)+encodeURIComponent(Z),_0x57a718={};if(X)_0x57a718[_0x1a2d65(0x114)]=_0x1a2d65(0x102)+X;Y(_0x1a2d65(0x12c)+_0x12d9d8);while(!0x0){try{let _0x1a0be4=await fetch(_0x12d9d8,{'headers':_0x57a718});if(!_0x1a0be4['ok']){Y('SSE\x20error:\x20'+_0x1a0be4['status']+'\x20'+_0x1a0be4[_0x1a2d65(0x108)]),await h(0x1388);continue;}let _0x5a513a=_0x1a0be4[_0x1a2d65(0x131)][_0x1a2d65(0x127)](),_0x40378c=new TextDecoder(),_0x29784c='';while(!0x0){let {done:_0x147f81,value:_0x54f35c}=await _0x5a513a[_0x1a2d65(0xc1)]();if(_0x147f81)break;_0x29784c+=_0x40378c[_0x1a2d65(0x13e)](_0x54f35c,{'stream':!0x0});let _0x2f8bf1=_0x29784c[_0x1a2d65(0xfc)]('\x0a\x0a');_0x29784c=_0x2f8bf1[_0x1a2d65(0x13b)]()||'';for(let _0x2d53ca of _0x2f8bf1){let _0x2f14d7=_0x2d53ca['split']('\x0a')[_0x1a2d65(0xfa)](_0x308252=>_0x308252['startsWith']('data:\x20'));if(!_0x2f14d7)continue;try{let _0x199182=JSON[_0x1a2d65(0x113)](_0x2f14d7[_0x1a2d65(0xfd)](0x6));await S(_0x199182);}catch(_0xf5651e){Y(_0x1a2d65(0xc5)+_0xf5651e);}}}Y(_0x1a2d65(0xe6));}catch(_0x359705){Y(_0x1a2d65(0x13c)+_0x359705);}await h(0xbb8);}}async function S(_0x28b91d){const _0x4ffcc0=a0_0x923dcb;if(_0x28b91d[_0x4ffcc0(0x123)]===_0x4ffcc0(0xf3)){Y(_0x4ffcc0(0x141)+Z+'\x22');return;}if(_0x28b91d['type']==='new_message'){if(Y('←\x20message\x20from\x20'+_0x28b91d[_0x4ffcc0(0xd1)]+':\x20'+_0x28b91d[_0x4ffcc0(0x11c)]['slice'](0x0,0x3c)),await K[_0x4ffcc0(0xd6)]({'method':_0x4ffcc0(0xc4),'params':{'content':_0x28b91d[_0x4ffcc0(0x11c)],'meta':{'sender':_0x28b91d[_0x4ffcc0(0xd1)]||_0x4ffcc0(0xff),'sender_id':_0x4ffcc0(0x132),'user':_0x28b91d[_0x4ffcc0(0xd1)]||_0x4ffcc0(0xff),'priority':_0x4ffcc0(0xbe)}}}),_0x28b91d[_0x4ffcc0(0x11b)])await P('ack_inbox',{'alias':Z,'message_id':_0x28b91d['message_id']});return;}if(_0x28b91d[_0x4ffcc0(0x123)]===_0x4ffcc0(0xda)||_0x28b91d[_0x4ffcc0(0x123)]==='broadcast'){Y('←\x20'+_0x28b91d[_0x4ffcc0(0x123)]+_0x4ffcc0(0x120)+_0x28b91d[_0x4ffcc0(0x122)]+_0x4ffcc0(0x107)+(_0x28b91d[_0x4ffcc0(0x116)]||_0x4ffcc0(0xbe)));let _0x3f7f4f=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x3f7f4f?.['ok']&&_0x3f7f4f[_0x4ffcc0(0xe9)]?.['length']>0x0)for(let _0x2a6a5b of _0x3f7f4f[_0x4ffcc0(0xe9)]){let _0x41862f={'sender':_0x2a6a5b[_0x4ffcc0(0xe4)]||_0x4ffcc0(0xff),'sender_id':_0x4ffcc0(0x132),'user':_0x2a6a5b['from_session']||_0x4ffcc0(0xff),'task_id':_0x2a6a5b['id'],'priority':_0x2a6a5b[_0x4ffcc0(0x116)]||_0x4ffcc0(0xbe)};k[_0x4ffcc0(0xcd)](_0x2a6a5b['id'],_0x2a6a5b[_0x4ffcc0(0xe4)]||_0x4ffcc0(0xff)),await K['notification']({'method':_0x4ffcc0(0xc4),'params':{'content':_0x2a6a5b[_0x4ffcc0(0xcb)],'meta':_0x41862f}}),Y(_0x4ffcc0(0x13a)+_0x2a6a5b['id'][_0x4ffcc0(0xfd)](0x0,0x8)+_0x4ffcc0(0xb9)+_0x2a6a5b[_0x4ffcc0(0xe4)]+':\x20'+_0x2a6a5b[_0x4ffcc0(0xcb)][_0x4ffcc0(0xfd)](0x0,0x3c)),await P(_0x4ffcc0(0x140),{'alias':Z,'message_id':_0x2a6a5b['id']});}}}async function A(){const _0x37316a=a0_0x923dcb;let _0x1d754c=new a0_0x4677d3();await K[_0x37316a(0x10b)](_0x1d754c),Y(_0x37316a(0x147)),Y(_0x37316a(0x128)),u()[_0x37316a(0xdc)](_0x33d862=>Y(_0x37316a(0x118)+_0x33d862)),P(_0x37316a(0x10a),{'resume_id':w,'alias':Z,'status':_0x37316a(0x10d),'server':a0_0x57e10e(),'hostname':a0_0x57e10e(),'agent':_0x37316a(0xc0),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x37316a(0xdb)](()=>Y(_0x37316a(0xd0)+Z+_0x37316a(0xe7)+w[_0x37316a(0xfd)](0x0,0x8)+')'))['catch'](_0x5e2371=>Y('warning:\x20could\x20not\x20register:\x20'+_0x5e2371)),setInterval(()=>{const _0xc290a0=_0x37316a;P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x57e10e(),'hostname':a0_0x57e10e(),'agent':_0xc290a0(0xc0),'project_dir':process[_0xc290a0(0x142)](),'tmux_name':j||void 0x0})[_0xc290a0(0xdc)](_0x3101f3=>Y(_0xc290a0(0x100)+_0x3101f3));},0x2bf20),Y(_0x37316a(0x139));}A()[a0_0x923dcb(0xdc)](_0x25a50d=>{const _0x536ef3=a0_0x923dcb;Y(_0x536ef3(0xf7)+_0x25a50d),process[_0x536ef3(0xd4)](0x1);});async function N(){const _0x422dd8=a0_0x923dcb;Y('shutting\x20down,\x20reporting\x20offline...'),await P('report_status',{'resume_id':w,'alias':Z,'status':'error','task':_0x422dd8(0x104)})[_0x422dd8(0xdc)](()=>{}),process[_0x422dd8(0xd4)](0x0);}function a0_0x2d2b(_0x472143,_0x734982){_0x472143=_0x472143-0xb9;const _0x59eef7=a0_0x59ee();let _0x2d2b09=_0x59eef7[_0x472143];return _0x2d2b09;}process[a0_0x923dcb(0xea)]['on']('end',()=>N()),process['on'](a0_0x923dcb(0xf1),()=>N()),process['on'](a0_0x923dcb(0xc7),()=>N());
2
+ const a0_0x3b1832=a0_0x5975;(function(_0x4afaa9,_0x17d161){const _0x912061=a0_0x5975,_0xc77a6a=_0x4afaa9();while(!![]){try{const _0x5a7747=-parseInt(_0x912061(0x1b0))/0x1+parseInt(_0x912061(0x216))/0x2+-parseInt(_0x912061(0x21b))/0x3*(-parseInt(_0x912061(0x1b5))/0x4)+-parseInt(_0x912061(0x1db))/0x5+-parseInt(_0x912061(0x197))/0x6*(-parseInt(_0x912061(0x215))/0x7)+parseInt(_0x912061(0x200))/0x8*(-parseInt(_0x912061(0x204))/0x9)+-parseInt(_0x912061(0x18e))/0xa*(-parseInt(_0x912061(0x1bd))/0xb);if(_0x5a7747===_0x17d161)break;else _0xc77a6a['push'](_0xc77a6a['shift']());}catch(_0x1bcf46){_0xc77a6a['push'](_0xc77a6a['shift']());}}}(a0_0x5861,0x83ade));import{readFileSync as a0_0xc3da35,existsSync as a0_0x1f98cb}from'fs';import{randomUUID as a0_0x47835b}from'crypto';import{join as a0_0x1ed1a1}from'path';import{hostname as a0_0x418ff2}from'os';import{execSync as a0_0x23db1e}from'child_process';function a0_0x5861(){const _0x174f6d=['data:\x20','\x22\x20(','777934bBLpKw','ready\x20—\x20waiting\x20for\x20events','join','token','toTimeString','8FBLgKF','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.',']\x20[commhub]\x20','registered\x20as\x20\x22','config.json','initialize','starting\x20SSE\x20listener...','Task\x20content','583piPTgd','connected','commhub_get_all_status','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','startsWith','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','SSE\x20connection\x20error:\x20','tools/call','params','.anet','get_all_status','new_task','string','init\x20failed:\x20','unknown\x20tool','\x20CWD=','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','result','CommHub\x20init\x20failed:\x20','priority','body','normal','warning:\x20could\x20not\x20register:\x20','send_message','delete','Reply\x20text\x20/\x20result\x20summary','catch','.claude/channels/commhub','replace','claude-code','4430650sHwOBC','commhub_send_task','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','hub','slice','working','MCP\x20stdio\x20connected','SIGINT','find','stderr','trim','number','replied','shutting\x20down,\x20reporting\x20offline...','cancelled','notifications/claude/channel','commhub_send_message','getReader','commhub','send_task','alias','stringify','read','object','\x20RESUME_ID=','message_id','Bearer\x20','Priority\x20(default:\x20normal)','no\x20response','statusText','type','SSE\x20stream\x20ended,\x20reconnecting...','low','\x20from\x20','pop','utf-8','/events/','64tlktBn','indexOf','messages','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','1154133iXSoRa','idle','commhub-channel','get_inbox','text','\x20PROJECT_ENV=','setRequestHandler','from_session','message','SSE\x20fatal:\x20','Authorization',':\x20inbox_count=','completed','get','status','in_progress','error','29246cEnluz','1351384IYmgfR','parse\x20error:\x20','ack_inbox','notification','decode','1510641KmfOet','Target\x20session\x20alias','→\x20injected\x20task\x20','/mcp','212180SnWQMg','application/json,\x20text/event-stream','ENV:\x20URL=','...\x20TMUX=','cwd','SSE\x20connected\x20as\x20\x22','SIGTERM','new_message','failed','606DJznJt','blocked','.env','broadcast','report_status','application/json','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','set','2.0','Current\x20task\x20description','commhub_report_status','2025-03-26','content','Progress\x200-100','POST','0.3.0','task','split','parse','send_reply','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','from','\x20ALIAS='];a0_0x5861=function(){return _0x174f6d;};return a0_0x5861();}import{Server as a0_0x1f3d38}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x3d44d8}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x25c473,CallToolRequestSchema as a0_0x5cc9b8}from'@modelcontextprotocol/sdk/types.js';function p(_0x2783ef){const _0x5b465d=a0_0x5975;if(!a0_0x1f98cb(_0x2783ef))return;for(let _0x2db1bd of a0_0xc3da35(_0x2783ef,'utf-8')[_0x5b465d(0x1a8)]('\x0a')){let _0x151259=_0x2db1bd[_0x5b465d(0x1e5)]();if(!_0x151259||_0x151259['startsWith']('#'))continue;let _0x50324f=_0x151259[_0x5b465d(0x201)]('=');if(_0x50324f<0x0)continue;let _0x31759a=_0x151259[_0x5b465d(0x1df)](0x0,_0x50324f)[_0x5b465d(0x1e5)](),_0x1ab181=_0x151259[_0x5b465d(0x1df)](_0x50324f+0x1)[_0x5b465d(0x1e5)]()[_0x5b465d(0x1d9)](/^["']|["']$/g,'');if(!process.env[_0x31759a])process.env[_0x31759a]=_0x1ab181;}}var C=process.env.HOME||'~',T=a0_0x1ed1a1(C,a0_0x3b1832(0x1d8));p(a0_0x1ed1a1(T,a0_0x3b1832(0x199)));var L=process['cwd']()[a0_0x3b1832(0x1d9)](/\//g,'-');p(a0_0x1ed1a1(T,L,a0_0x3b1832(0x199)));function U(){const _0x4fa540=a0_0x3b1832;try{return a0_0x23db1e('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x4fa540(0x1fe),'timeout':0x7d0})['trim']();}catch{return'';}}function v(){const _0x3fef90=a0_0x3b1832;try{let _0x17b864=a0_0x1ed1a1(C,_0x3fef90(0x1c6),_0x3fef90(0x1b9));if(a0_0x1f98cb(_0x17b864))return JSON[_0x3fef90(0x1a9)](a0_0xc3da35(_0x17b864,_0x3fef90(0x1fe)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x3b1832(0x1de)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x418ff2(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x47835b(),X=process.env.COMMHUB_TOKEN||H[a0_0x3b1832(0x1b3)]||'';function Y(_0xb48c75){const _0x4d075e=a0_0x3b1832;let _0x2e7ee8=new Date()[_0x4d075e(0x1b4)]()[_0x4d075e(0x1df)](0x0,0x8);process[_0x4d075e(0x1e4)]['write']('['+_0x2e7ee8+_0x4d075e(0x1b7)+_0xb48c75+'\x0a');}function h(_0x4d449e){return new Promise(_0x2fb00f=>setTimeout(_0x2fb00f,_0x4d449e));}Y(a0_0x3b1832(0x190)+f+a0_0x3b1832(0x1ad)+Z+a0_0x3b1832(0x1f3)+w[a0_0x3b1832(0x1df)](0x0,0x8)+a0_0x3b1832(0x191)+(j||'none')+a0_0x3b1832(0x1cc)+process[a0_0x3b1832(0x192)]()+a0_0x3b1832(0x209)+L);var k=new Map(),K=new a0_0x1f3d38({'name':a0_0x3b1832(0x206),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':['Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x3b1832(0x1ab),a0_0x3b1832(0x19d),'Session\x20alias:\x20'+Z][a0_0x3b1832(0x1b2)]('\x0a')});K[a0_0x3b1832(0x20a)](a0_0x25c473,async()=>({'tools':[{'name':'commhub_reply','description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x3b1832(0x1c9),'description':a0_0x3b1832(0x1dd)},'text':{'type':'string','description':a0_0x3b1832(0x1d6)},'status':{'type':'string','enum':[a0_0x3b1832(0x210),a0_0x3b1832(0x196),a0_0x3b1832(0x1e9),'blocked',a0_0x3b1832(0x214),a0_0x3b1832(0x213)],'description':a0_0x3b1832(0x203)}},'required':[a0_0x3b1832(0x208)]}},{'name':a0_0x3b1832(0x1a1),'description':a0_0x3b1832(0x1b6),'inputSchema':{'type':a0_0x3b1832(0x1f2),'properties':{'status':{'type':'string','enum':[a0_0x3b1832(0x1e0),a0_0x3b1832(0x205),a0_0x3b1832(0x198),a0_0x3b1832(0x214)]},'task':{'type':a0_0x3b1832(0x1c9),'description':a0_0x3b1832(0x1a0)},'progress':{'type':a0_0x3b1832(0x1e6),'description':a0_0x3b1832(0x1a4)}},'required':[a0_0x3b1832(0x212)]}},{'name':a0_0x3b1832(0x1dc),'description':a0_0x3b1832(0x1cd),'inputSchema':{'type':'object','properties':{'alias':{'type':'string','description':a0_0x3b1832(0x21c)},'task':{'type':a0_0x3b1832(0x1c9),'description':a0_0x3b1832(0x1bc)},'priority':{'type':a0_0x3b1832(0x1c9),'enum':['high',a0_0x3b1832(0x1d2),a0_0x3b1832(0x1fb)],'description':a0_0x3b1832(0x1f6)}},'required':['alias',a0_0x3b1832(0x1a7)]}},{'name':a0_0x3b1832(0x1eb),'description':a0_0x3b1832(0x1c2),'inputSchema':{'type':a0_0x3b1832(0x1f2),'properties':{'alias':{'type':a0_0x3b1832(0x1c9),'description':a0_0x3b1832(0x21c)},'message':{'type':a0_0x3b1832(0x1c9),'description':'Message\x20content'}},'required':[a0_0x3b1832(0x1ef),a0_0x3b1832(0x20c)]}},{'name':a0_0x3b1832(0x1bf),'description':a0_0x3b1832(0x1c0),'inputSchema':{'type':a0_0x3b1832(0x1f2),'properties':{}}}]}));async function P(_0x3600cf,_0x5473c7){const _0x5e7b0d=a0_0x3b1832;let _0x8cd001=await fetch(f+_0x5e7b0d(0x18d),{'method':_0x5e7b0d(0x1a5),'headers':{'Content-Type':_0x5e7b0d(0x19c),'Accept':_0x5e7b0d(0x18f),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x5e7b0d(0x1f0)]({'jsonrpc':_0x5e7b0d(0x19f),'id':0x1,'method':_0x5e7b0d(0x1ba),'params':{'protocolVersion':_0x5e7b0d(0x1a2),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x5e7b0d(0x1a6)}}})});if(!_0x8cd001['ok']){let _0x4e835f=await _0x8cd001[_0x5e7b0d(0x208)]();return Y(_0x5e7b0d(0x1cf)+_0x8cd001[_0x5e7b0d(0x212)]+'\x20'+_0x4e835f[_0x5e7b0d(0x1df)](0x0,0x64)),{'ok':!0x1,'error':_0x5e7b0d(0x1ca)+_0x8cd001['status']};}await _0x8cd001['text']();let _0xb005ba=(await(await fetch(f+_0x5e7b0d(0x18d),{'method':_0x5e7b0d(0x1a5),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x5e7b0d(0x1f5)+X}:{}},'body':JSON[_0x5e7b0d(0x1f0)]({'jsonrpc':_0x5e7b0d(0x19f),'id':0x2,'method':_0x5e7b0d(0x1c4),'params':{'name':_0x3600cf,'arguments':_0x5473c7}})}))['text']())['split']('\x0a')[_0x5e7b0d(0x1e3)](_0x5fc4d1=>_0x5fc4d1[_0x5e7b0d(0x1c1)]('data:\x20'));if(_0xb005ba){let _0x41df4f=JSON[_0x5e7b0d(0x1a9)](_0xb005ba[_0x5e7b0d(0x1df)](0x6));return _0x41df4f?.['result']?.[_0x5e7b0d(0x1a3)]?.[0x0]?.['text']?JSON[_0x5e7b0d(0x1a9)](_0x41df4f[_0x5e7b0d(0x1ce)][_0x5e7b0d(0x1a3)][0x0]['text']):_0x41df4f;}return{'ok':!0x1,'error':_0x5e7b0d(0x1f7)};}K['setRequestHandler'](a0_0x5cc9b8,async _0x5ba395=>{const _0xa4534d=a0_0x3b1832;let {name:_0x3d5137,arguments:_0x128bc5}=_0x5ba395[_0xa4534d(0x1c5)];if(_0x3d5137==='commhub_reply'){let {task_id:_0x417b62,text:_0x2ee6f0,status:_0x3d5457}=_0x128bc5;if(_0x3d5457===_0xa4534d(0x210)||_0x3d5457===_0xa4534d(0x196)||_0x3d5457===_0xa4534d(0x1e9)){let _0x187737=_0x3d5457===_0xa4534d(0x210)?_0xa4534d(0x1e7):_0x3d5457,_0x425037=_0x417b62?k[_0xa4534d(0x211)](_0x417b62)||_0xa4534d(0x1de):_0xa4534d(0x1de),_0x16cd9a=await P(_0xa4534d(0x1aa),{'alias':_0x425037,'text':_0x2ee6f0,'in_reply_to':_0x417b62||void 0x0,'status':_0x187737,'from_session':Z});if(_0x417b62)k[_0xa4534d(0x1d5)](_0x417b62);return{'content':[{'type':_0xa4534d(0x208),'text':JSON[_0xa4534d(0x1f0)](_0x16cd9a)}]};}let _0x58b411=await P(_0xa4534d(0x19b),{'resume_id':w,'alias':Z,'status':_0x3d5457==='blocked'?_0xa4534d(0x198):_0x3d5457===_0xa4534d(0x214)?_0xa4534d(0x214):'working','task':_0x2ee6f0[_0xa4534d(0x1df)](0x0,0xc8),'output':_0x2ee6f0});return{'content':[{'type':_0xa4534d(0x208),'text':JSON[_0xa4534d(0x1f0)](_0x58b411)}]};}if(_0x3d5137===_0xa4534d(0x1a1)){let {status:_0x4ab2f5,task:_0x4d0819,progress:_0xea98a8}=_0x128bc5,_0x28783a=await P(_0xa4534d(0x19b),{'resume_id':w,'alias':Z,'status':_0x4ab2f5,'task':_0x4d0819,'progress':_0xea98a8});return{'content':[{'type':'text','text':JSON['stringify'](_0x28783a)}]};}if(_0x3d5137===_0xa4534d(0x1dc)){let {alias:_0x4d8934,task:_0x674fb3,priority:_0x5c9845}=_0x128bc5,_0x219ab2=await P(_0xa4534d(0x1ee),{'alias':_0x4d8934,'task':_0x674fb3,'priority':_0x5c9845||_0xa4534d(0x1d2),'from_session':Z});return{'content':[{'type':_0xa4534d(0x208),'text':JSON[_0xa4534d(0x1f0)](_0x219ab2)}]};}if(_0x3d5137==='commhub_send_message'){let {alias:_0x447f04,message:_0x27d62a}=_0x128bc5,_0x5d564d=await P(_0xa4534d(0x1d4),{'alias':_0x447f04,'message':_0x27d62a,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0xa4534d(0x1f0)](_0x5d564d)}]};}if(_0x3d5137==='commhub_get_all_status'){let _0x11a680=await P(_0xa4534d(0x1c7),{});return{'content':[{'type':_0xa4534d(0x208),'text':JSON[_0xa4534d(0x1f0)](_0x11a680)}]};}return{'content':[{'type':_0xa4534d(0x208),'text':JSON[_0xa4534d(0x1f0)]({'error':_0xa4534d(0x1cb)})}]};});async function u(){const _0x2f2a7d=a0_0x3b1832;let _0x41c2b7=f+_0x2f2a7d(0x1ff)+encodeURIComponent(Z),_0x5015dd={};if(X)_0x5015dd[_0x2f2a7d(0x20e)]='Bearer\x20'+X;Y('connecting\x20to\x20'+_0x41c2b7);while(!0x0){try{let _0x19de01=await fetch(_0x41c2b7,{'headers':_0x5015dd});if(!_0x19de01['ok']){Y('SSE\x20error:\x20'+_0x19de01[_0x2f2a7d(0x212)]+'\x20'+_0x19de01[_0x2f2a7d(0x1f8)]),await h(0x1388);continue;}let _0x2d30de=_0x19de01[_0x2f2a7d(0x1d1)][_0x2f2a7d(0x1ec)](),_0xd1a900=new TextDecoder(),_0x24c099='';while(!0x0){let {done:_0x47a1e6,value:_0x247222}=await _0x2d30de[_0x2f2a7d(0x1f1)]();if(_0x47a1e6)break;_0x24c099+=_0xd1a900[_0x2f2a7d(0x21a)](_0x247222,{'stream':!0x0});let _0x2ddceb=_0x24c099[_0x2f2a7d(0x1a8)]('\x0a\x0a');_0x24c099=_0x2ddceb[_0x2f2a7d(0x1fd)]()||'';for(let _0x2f9413 of _0x2ddceb){let _0x6a7e80=_0x2f9413['split']('\x0a')[_0x2f2a7d(0x1e3)](_0x4a0c87=>_0x4a0c87[_0x2f2a7d(0x1c1)](_0x2f2a7d(0x1ae)));if(!_0x6a7e80)continue;try{let _0xd14098=JSON[_0x2f2a7d(0x1a9)](_0x6a7e80[_0x2f2a7d(0x1df)](0x6));await S(_0xd14098);}catch(_0x5c32c3){Y(_0x2f2a7d(0x217)+_0x5c32c3);}}}Y(_0x2f2a7d(0x1fa));}catch(_0x4cf035){Y(_0x2f2a7d(0x1c3)+_0x4cf035);}await h(0xbb8);}}async function S(_0x237d0c){const _0x85be88=a0_0x3b1832;if(_0x237d0c['type']===_0x85be88(0x1be)){Y(_0x85be88(0x193)+Z+'\x22');return;}if(_0x237d0c['type']===_0x85be88(0x195)){if(Y('←\x20message\x20from\x20'+_0x237d0c[_0x85be88(0x1ac)]+':\x20'+_0x237d0c['message'][_0x85be88(0x1df)](0x0,0x3c)),await K[_0x85be88(0x219)]({'method':_0x85be88(0x1ea),'params':{'content':_0x237d0c[_0x85be88(0x20c)],'meta':{'sender':_0x237d0c[_0x85be88(0x1ac)]||_0x85be88(0x1de),'sender_id':_0x85be88(0x1ed),'user':_0x237d0c[_0x85be88(0x1ac)]||_0x85be88(0x1de),'priority':_0x85be88(0x1d2)}}}),_0x237d0c[_0x85be88(0x1f4)])await P(_0x85be88(0x218),{'alias':Z,'message_id':_0x237d0c[_0x85be88(0x1f4)]});return;}if(_0x237d0c[_0x85be88(0x1f9)]===_0x85be88(0x1c8)||_0x237d0c[_0x85be88(0x1f9)]===_0x85be88(0x19a)){Y('←\x20'+_0x237d0c[_0x85be88(0x1f9)]+_0x85be88(0x20f)+_0x237d0c['inbox_count']+'\x20priority='+(_0x237d0c[_0x85be88(0x1d0)]||_0x85be88(0x1d2)));let _0x45480e=await P(_0x85be88(0x207),{'alias':Z,'limit':0x5});if(_0x45480e?.['ok']&&_0x45480e[_0x85be88(0x202)]?.['length']>0x0)for(let _0x4711d7 of _0x45480e[_0x85be88(0x202)]){let _0x198309={'sender':_0x4711d7[_0x85be88(0x20b)]||_0x85be88(0x1de),'sender_id':_0x85be88(0x1ed),'user':_0x4711d7['from_session']||_0x85be88(0x1de),'task_id':_0x4711d7['id'],'priority':_0x4711d7['priority']||_0x85be88(0x1d2)};k[_0x85be88(0x19e)](_0x4711d7['id'],_0x4711d7[_0x85be88(0x20b)]||'hub'),await K[_0x85be88(0x219)]({'method':_0x85be88(0x1ea),'params':{'content':_0x4711d7['content'],'meta':_0x198309}}),Y(_0x85be88(0x21d)+_0x4711d7['id'][_0x85be88(0x1df)](0x0,0x8)+_0x85be88(0x1fc)+_0x4711d7['from_session']+':\x20'+_0x4711d7[_0x85be88(0x1a3)][_0x85be88(0x1df)](0x0,0x3c)),await P(_0x85be88(0x218),{'alias':Z,'message_id':_0x4711d7['id']});}}}async function A(){const _0x9ed7b9=a0_0x3b1832;let _0x5b66f7=new a0_0x3d44d8();await K['connect'](_0x5b66f7),Y(_0x9ed7b9(0x1e1)),Y(_0x9ed7b9(0x1bb)),u()[_0x9ed7b9(0x1d7)](_0x1067c9=>Y(_0x9ed7b9(0x20d)+_0x1067c9)),P(_0x9ed7b9(0x19b),{'resume_id':w,'alias':Z,'status':_0x9ed7b9(0x205),'server':a0_0x418ff2(),'hostname':a0_0x418ff2(),'agent':_0x9ed7b9(0x1da),'project_dir':process[_0x9ed7b9(0x192)](),'tmux_name':j||void 0x0})['then'](()=>Y(_0x9ed7b9(0x1b8)+Z+_0x9ed7b9(0x1af)+w[_0x9ed7b9(0x1df)](0x0,0x8)+')'))['catch'](_0x58b332=>Y(_0x9ed7b9(0x1d3)+_0x58b332)),setInterval(()=>{const _0x2f2a38=_0x9ed7b9;P(_0x2f2a38(0x19b),{'resume_id':w,'alias':Z,'status':_0x2f2a38(0x205),'server':a0_0x418ff2(),'hostname':a0_0x418ff2(),'agent':_0x2f2a38(0x1da),'project_dir':process[_0x2f2a38(0x192)](),'tmux_name':j||void 0x0})[_0x2f2a38(0x1d7)](_0x520c17=>Y('heartbeat\x20failed:\x20'+_0x520c17));},0x2bf20),Y(_0x9ed7b9(0x1b1));}function a0_0x5975(_0x13f503,_0x4a3557){_0x13f503=_0x13f503-0x18d;const _0x5861b1=a0_0x5861();let _0x597591=_0x5861b1[_0x13f503];return _0x597591;}A()['catch'](_0x4c95da=>{Y('fatal:\x20'+_0x4c95da),process['exit'](0x1);});async function N(){const _0x3db3bd=a0_0x3b1832;Y(_0x3db3bd(0x1e8)),await P(_0x3db3bd(0x19b),{'resume_id':w,'alias':Z,'status':_0x3db3bd(0x214),'task':'session\x20disconnected'})[_0x3db3bd(0x1d7)](()=>{}),process['exit'](0x0);}process['stdin']['on']('end',()=>N()),process['on'](a0_0x3b1832(0x194),()=>N()),process['on'](a0_0x3b1832(0x1e2),()=>N());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.2.2-preview.0",
3
+ "version": "2.2.2",
4
4
  "description": "AI Agent Network CLI — Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 39 commands.",
5
5
  "type": "module",
6
6
  "main": "dist/src/client.js",