@sleep2agi/agent-network 2.0.3-preview.9 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- const a0_0x5e001d=a0_0x3311;(function(_0x34c990,_0x520495){const _0xbc6fab=a0_0x3311,_0x56a059=_0x34c990();while(!![]){try{const _0x367bfb=-parseInt(_0xbc6fab(0x1c6))/0x1+-parseInt(_0xbc6fab(0x1a6))/0x2*(parseInt(_0xbc6fab(0x1be))/0x3)+-parseInt(_0xbc6fab(0x1d0))/0x4*(parseInt(_0xbc6fab(0x1c2))/0x5)+parseInt(_0xbc6fab(0x1cd))/0x6+-parseInt(_0xbc6fab(0x1c7))/0x7*(parseInt(_0xbc6fab(0x1ef))/0x8)+-parseInt(_0xbc6fab(0x1dc))/0x9+parseInt(_0xbc6fab(0x1d2))/0xa;if(_0x367bfb===_0x520495)break;else _0x56a059['push'](_0x56a059['shift']());}catch(_0x41469a){_0x56a059['push'](_0x56a059['shift']());}}}(a0_0x2e16,0x54e8d));import{EventEmitter as a0_0x5cc9ad}from'events';function a0_0x3311(_0x3a8a95,_0x3e6c71){_0x3a8a95=_0x3a8a95-0x1a0;const _0x2e16b4=a0_0x2e16();let _0x331119=_0x2e16b4[_0x3a8a95];return _0x331119;}import{hostname as a0_0x5bca2b}from'os';class T extends a0_0x5cc9ad{[a0_0x5e001d(0x1ac)];[a0_0x5e001d(0x1ba)];[a0_0x5e001d(0x1f5)];[a0_0x5e001d(0x1b9)];[a0_0x5e001d(0x1bf)];[a0_0x5e001d(0x1eb)];['reconnectDelay'];['heartbeatTimer'];['sseAbort'];['running']=!0x1;constructor(_0x39a6df){const _0x5139a3=a0_0x5e001d;super();if(this[_0x5139a3(0x1ac)]=_0x39a6df['url'][_0x5139a3(0x1b0)](/\/$/,''),this[_0x5139a3(0x1ba)]=_0x39a6df['alias'],this['token']=_0x39a6df['token'],this['agent']=_0x39a6df[_0x5139a3(0x1b9)]||_0x5139a3(0x1a8),this[_0x5139a3(0x1bf)]=_0x5139a3(0x1f1)+_0x39a6df[_0x5139a3(0x1ba)]+'-'+Date[_0x5139a3(0x1d6)]()[_0x5139a3(0x1b8)](0x24),this[_0x5139a3(0x1eb)]=_0x39a6df[_0x5139a3(0x1eb)]??0x2bf20,this[_0x5139a3(0x1cb)]=_0x39a6df[_0x5139a3(0x1cb)]??0xbb8,_0x39a6df[_0x5139a3(0x1cc)]!==!0x1)this[_0x5139a3(0x1d1)]();}[a0_0x5e001d(0x1c1)](_0xf13d97){const _0x2118b1=a0_0x5e001d;console[_0x2118b1(0x1c1)]('['+new Date()['toTimeString']()['slice'](0x0,0x8)+_0x2118b1(0x1e6)+this['alias']+']\x20'+_0xf13d97);}async[a0_0x5e001d(0x1e9)](_0x54eada,_0x3312d5){const _0x584b97=a0_0x5e001d;let _0x4de890={'Content-Type':_0x584b97(0x1c5),'Accept':_0x584b97(0x1e8)};if(this[_0x584b97(0x1f5)])_0x4de890[_0x584b97(0x1b3)]=_0x584b97(0x1c0)+this[_0x584b97(0x1f5)];let _0xa9fb56=await(await fetch(this[_0x584b97(0x1ac)]+_0x584b97(0x1d5),{'method':_0x584b97(0x1b5),'headers':_0x4de890,'body':JSON[_0x584b97(0x1c9)]({'jsonrpc':_0x584b97(0x1bd),'id':Date['now'](),'method':'tools/call','params':{'name':_0x54eada,'arguments':_0x3312d5}})}))[_0x584b97(0x1b6)](),_0x2a6751=_0xa9fb56['match'](/data: (.+)/),_0x223a88=_0x2a6751?JSON['parse'](_0x2a6751[0x1]):JSON[_0x584b97(0x1c3)](_0xa9fb56),_0x53fb8f=_0x223a88?.[_0x584b97(0x1e3)]?.[_0x584b97(0x1cf)]?.[0x0]?.['text'];return _0x53fb8f?JSON[_0x584b97(0x1c3)](_0x53fb8f):_0x223a88;}async['connect'](){const _0x18da2e=a0_0x5e001d;if(this[_0x18da2e(0x1ae)])return;this[_0x18da2e(0x1ae)]=!0x0,await this[_0x18da2e(0x1e2)](_0x18da2e(0x1e7)),this[_0x18da2e(0x1c1)](_0x18da2e(0x1f4)),this[_0x18da2e(0x1bc)]=setInterval(()=>{const _0x3ed42b=_0x18da2e;this[_0x3ed42b(0x1e2)]('idle')[_0x3ed42b(0x1ca)](_0x4efd79=>this[_0x3ed42b(0x1c1)](_0x3ed42b(0x1af)+_0x4efd79[_0x3ed42b(0x1de)]));},this[_0x18da2e(0x1eb)]),this[_0x18da2e(0x1a2)]();}async[a0_0x5e001d(0x1b2)](){const _0x563274=a0_0x5e001d;if(this[_0x563274(0x1ae)]=!0x1,this[_0x563274(0x1f0)]?.[_0x563274(0x1f6)](),this[_0x563274(0x1bc)])clearInterval(this[_0x563274(0x1bc)]);await this[_0x563274(0x1e2)]('offline')[_0x563274(0x1ca)](()=>{}),this['log'](_0x563274(0x1df));}async['send'](_0xe852a4,_0x138503,_0x32e9e0=a0_0x5e001d(0x1dd)){const _0x40f18b=a0_0x5e001d;return this['call'](_0x40f18b(0x1a9),{'alias':_0xe852a4,'task':_0x138503,'priority':_0x32e9e0,'from_session':this['alias']});}async[a0_0x5e001d(0x1de)](_0x9890d6,_0xf23053){const _0x258cdc=a0_0x5e001d;return this[_0x258cdc(0x1e9)](_0x258cdc(0x1e4),{'alias':_0x9890d6,'message':_0xf23053,'from_session':this[_0x258cdc(0x1ba)]});}async[a0_0x5e001d(0x1aa)](_0x15272e,_0x20f317,_0x2fcce5=a0_0x5e001d(0x1ea)){const _0x42bd26=a0_0x5e001d;return this[_0x42bd26(0x1e9)]('reply',{'task_id':_0x15272e,'text':_0x20f317,'status':_0x2fcce5});}async[a0_0x5e001d(0x1e2)](_0x156b3b,_0x3b9309){const _0x373d99=a0_0x5e001d;return this[_0x373d99(0x1e9)](_0x373d99(0x1ab),{'resume_id':this[_0x373d99(0x1bf)],'alias':this[_0x373d99(0x1ba)],'status':_0x156b3b,'server':a0_0x5bca2b(),'hostname':a0_0x5bca2b(),'agent':this[_0x373d99(0x1b9)],'project_dir':process[_0x373d99(0x1d3)](),..._0x3b9309});}async[a0_0x5e001d(0x1a5)](){const _0x297730=a0_0x5e001d;return this[_0x297730(0x1e9)](_0x297730(0x1f7),{});}async[a0_0x5e001d(0x1a4)](_0x2a03e6,_0xa5fcbe){const _0x407a18=a0_0x5e001d;return this[_0x407a18(0x1e9)](_0x407a18(0x1a4),{'message':_0x2a03e6,'filter_server':_0xa5fcbe?.[_0x407a18(0x1ad)],'filter_status':_0xa5fcbe?.['status']});}async[a0_0x5e001d(0x1a2)](){const _0x1df09c=a0_0x5e001d;let _0xb0d221=encodeURIComponent(this[_0x1df09c(0x1ba)]),_0x59d007=this[_0x1df09c(0x1ac)]+'/events/'+_0xb0d221,_0x125830=this[_0x1df09c(0x1cb)];while(this[_0x1df09c(0x1ae)]){try{this[_0x1df09c(0x1f0)]=new AbortController();let _0x1595c6={'Accept':_0x1df09c(0x1b4)};if(this[_0x1df09c(0x1f5)])_0x1595c6['Authorization']='Bearer\x20'+this['token'];let _0x133b7b=await fetch(_0x59d007,{'headers':_0x1595c6,'signal':this[_0x1df09c(0x1f0)][_0x1df09c(0x1ce)]});if(!_0x133b7b['ok']||!_0x133b7b[_0x1df09c(0x1a7)]){this[_0x1df09c(0x1c1)]('SSE\x20failed:\x20'+_0x133b7b[_0x1df09c(0x1e2)]),await this['sleep'](_0x125830),_0x125830=Math[_0x1df09c(0x1b7)](_0x125830*1.5,0xea60);continue;}_0x125830=this[_0x1df09c(0x1cb)];let _0x2b5c18=_0x133b7b['body'][_0x1df09c(0x1d4)](),_0x32dc9c=new TextDecoder(),_0x34a0c9='';while(this[_0x1df09c(0x1ae)]){let {done:_0x8571c8,value:_0x21e3b0}=await _0x2b5c18[_0x1df09c(0x1c4)]();if(_0x8571c8)break;_0x34a0c9+=_0x32dc9c[_0x1df09c(0x1e0)](_0x21e3b0,{'stream':!0x0});let _0x4b9f8d=_0x34a0c9[_0x1df09c(0x1e5)]('\x0a');_0x34a0c9=_0x4b9f8d['pop']()||'';for(let _0x206a6b of _0x4b9f8d){if(!_0x206a6b[_0x1df09c(0x1f8)](_0x1df09c(0x1d8)))continue;try{let _0x2d6c34=JSON[_0x1df09c(0x1c3)](_0x206a6b[_0x1df09c(0x1a1)](0x6));if(_0x2d6c34[_0x1df09c(0x1da)]===_0x1df09c(0x1b1)){this[_0x1df09c(0x1c1)](_0x1df09c(0x1d9)),this[_0x1df09c(0x1bb)](_0x1df09c(0x1b1));continue;}if(_0x2d6c34['type']===_0x1df09c(0x1db)||_0x2d6c34[_0x1df09c(0x1da)]===_0x1df09c(0x1d7)||_0x2d6c34[_0x1df09c(0x1da)]===_0x1df09c(0x1a4))await this[_0x1df09c(0x1ee)]();}catch{}}}}catch(_0x42e864){if(_0x42e864[_0x1df09c(0x1ec)]==='AbortError')break;this[_0x1df09c(0x1bb)]('error',_0x42e864),this[_0x1df09c(0x1c1)](_0x1df09c(0x1a0)+_0x42e864[_0x1df09c(0x1de)]);}if(this[_0x1df09c(0x1ae)])this[_0x1df09c(0x1bb)](_0x1df09c(0x1df)),this[_0x1df09c(0x1c1)]('SSE\x20reconnecting\x20in\x20'+_0x125830/0x3e8+_0x1df09c(0x1f2)),await this['sleep'](_0x125830),_0x125830=Math[_0x1df09c(0x1b7)](_0x125830*1.5,0xea60);}}async[a0_0x5e001d(0x1ee)](){const _0x165e3b=a0_0x5e001d;try{let _0xc3ceb4=(await this[_0x165e3b(0x1e9)]('get_inbox',{'alias':this[_0x165e3b(0x1ba)],'limit':0xa}))?.[_0x165e3b(0x1c8)]||[];for(let _0x58919a of _0xc3ceb4)await this[_0x165e3b(0x1e9)](_0x165e3b(0x1e1),{'alias':this['alias'],'message_id':_0x58919a['id']}),this['log']('←\x20'+_0x58919a[_0x165e3b(0x1ed)]+':\x20'+_0x58919a[_0x165e3b(0x1cf)][_0x165e3b(0x1a1)](0x0,0x3c)),this[_0x165e3b(0x1bb)](_0x165e3b(0x1a3),_0x58919a),this[_0x165e3b(0x1bb)](_0x165e3b(0x1de),_0x58919a);}catch(_0x1aefc7){this[_0x165e3b(0x1c1)]('inbox\x20error:\x20'+_0x1aefc7['message']);}}[a0_0x5e001d(0x1f3)](_0x485d39){return new Promise(_0x3f4e32=>setTimeout(_0x3f4e32,_0x485d39));}}var $=T;function a0_0x2e16(){const _0x36cc47=['min','toString','agent','alias','emit','heartbeatTimer','2.0','3378Csfxkk','resumeId','Bearer\x20','log','1311685ekAPMO','parse','read','application/json','108494uRaYNa','35jDOnvx','messages','stringify','catch','reconnectDelay','autoConnect','3996870iePzVj','signal','content','4zOwOEw','connect','4472400bGomol','cwd','getReader','/mcp','now','new_message','data:\x20','SSE\x20connected','type','new_task','1261926adiXon','normal','message','disconnected','decode','ack_inbox','status','result','send_message','split',']\x20[commhub:','idle','application/json,\x20text/event-stream','call','completed','heartbeatInterval','name','from_session','processInbox','36152sRixwo','sseAbort','sdk-','s...','sleep','registered','token','abort','get_all_status','startsWith','SSE\x20error:\x20','slice','connectSSE','task','broadcast','getAllStatus','412aUkdHl','body','sdk','send_task','reply','report_status','url','server','running','heartbeat\x20failed:\x20','replace','connected','disconnect','Authorization','text/event-stream','POST','text'];a0_0x2e16=function(){return _0x36cc47;};return a0_0x2e16();}export{$ as default,T as CommHub};
1
+ function a0_0x4a96(_0x239321,_0x4dba44){_0x239321=_0x239321-0xb3;const _0x55d685=a0_0x55d6();let _0x4a9607=_0x55d685[_0x239321];return _0x4a9607;}const a0_0x2f58b1=a0_0x4a96;(function(_0x593300,_0x47f113){const _0x1980bc=a0_0x4a96,_0x280030=_0x593300();while(!![]){try{const _0x10b473=-parseInt(_0x1980bc(0x109))/0x1*(-parseInt(_0x1980bc(0xd7))/0x2)+-parseInt(_0x1980bc(0xd8))/0x3*(parseInt(_0x1980bc(0x102))/0x4)+-parseInt(_0x1980bc(0x103))/0x5+parseInt(_0x1980bc(0xe9))/0x6*(-parseInt(_0x1980bc(0xe1))/0x7)+-parseInt(_0x1980bc(0xe6))/0x8*(-parseInt(_0x1980bc(0xc2))/0x9)+-parseInt(_0x1980bc(0xf3))/0xa*(-parseInt(_0x1980bc(0xb4))/0xb)+parseInt(_0x1980bc(0xfb))/0xc*(parseInt(_0x1980bc(0xe0))/0xd);if(_0x10b473===_0x47f113)break;else _0x280030['push'](_0x280030['shift']());}catch(_0x4ae82d){_0x280030['push'](_0x280030['shift']());}}}(a0_0x55d6,0x64fd9));import{EventEmitter as a0_0x10552d}from'events';import{hostname as a0_0x24eb05}from'os';function a0_0x55d6(){const _0x123de4=[']\x20[commhub:','registered','1884DkleZd','pop','send_task','normal','application/json','token','application/json,\x20text/event-stream','319988FEkLpL','3599305VxSTyX','replace','inbox\x20error:\x20','get_inbox','catch','tools/call','263vHGWiz','disconnected','sleep','1256959cUgarx','messages','alias','now','autoConnect','call','Bearer\x20','reconnectDelay','resumeId','url','cwd','SSE\x20error:\x20','name','read','9VViBxG','match','sdk','parse','sseAbort','result','send','slice','task','type','message','toString','error','broadcast','emit','reply','split','data:\x20','get_all_status','log','Authorization','4510TRpgRg','12QNMuGr','idle','abort','SSE\x20failed:\x20','disconnect','processInbox','connected','text','23335zECOGK','5206033KeQWQX','connectSSE','min','send_message','heartbeatTimer','5093848GPPUdm','completed','connect','6jVEvRI','text/event-stream','POST','/mcp','content','SSE\x20connected','signal','stringify','report_status','running','60JctsME','offline','heartbeatInterval','2.0','agent','status'];a0_0x55d6=function(){return _0x123de4;};return a0_0x55d6();}class T extends a0_0x10552d{[a0_0x2f58b1(0xbd)];[a0_0x2f58b1(0xb6)];[a0_0x2f58b1(0x100)];['agent'];[a0_0x2f58b1(0xbc)];[a0_0x2f58b1(0xf5)];[a0_0x2f58b1(0xbb)];[a0_0x2f58b1(0xe5)];[a0_0x2f58b1(0xc6)];[a0_0x2f58b1(0xf2)]=!0x1;constructor(_0x11c083){const _0x1d0d87=a0_0x2f58b1;super();if(this['url']=_0x11c083[_0x1d0d87(0xbd)][_0x1d0d87(0x104)](/\/$/,''),this[_0x1d0d87(0xb6)]=_0x11c083[_0x1d0d87(0xb6)],this[_0x1d0d87(0x100)]=_0x11c083[_0x1d0d87(0x100)],this[_0x1d0d87(0xf7)]=_0x11c083[_0x1d0d87(0xf7)]||_0x1d0d87(0xc4),this[_0x1d0d87(0xbc)]='sdk-'+_0x11c083[_0x1d0d87(0xb6)]+'-'+Date[_0x1d0d87(0xb7)]()[_0x1d0d87(0xcd)](0x24),this[_0x1d0d87(0xf5)]=_0x11c083[_0x1d0d87(0xf5)]??0x2bf20,this[_0x1d0d87(0xbb)]=_0x11c083[_0x1d0d87(0xbb)]??0xbb8,_0x11c083[_0x1d0d87(0xb8)]!==!0x1)this[_0x1d0d87(0xe8)]();}[a0_0x2f58b1(0xd5)](_0x40eafe){const _0x59a254=a0_0x2f58b1;console['log']('['+new Date()['toTimeString']()[_0x59a254(0xc9)](0x0,0x8)+_0x59a254(0xf9)+this[_0x59a254(0xb6)]+']\x20'+_0x40eafe);}async[a0_0x2f58b1(0xb9)](_0x1e52d5,_0x419544){const _0x509f35=a0_0x2f58b1;let _0x395da0={'Content-Type':_0x509f35(0xff),'Accept':_0x509f35(0x101)};if(this[_0x509f35(0x100)])_0x395da0[_0x509f35(0xd6)]=_0x509f35(0xba)+this[_0x509f35(0x100)];let _0x2eee08=await(await fetch(this[_0x509f35(0xbd)]+_0x509f35(0xec),{'method':_0x509f35(0xeb),'headers':_0x395da0,'body':JSON[_0x509f35(0xf0)]({'jsonrpc':_0x509f35(0xf6),'id':Date[_0x509f35(0xb7)](),'method':_0x509f35(0x108),'params':{'name':_0x1e52d5,'arguments':_0x419544}})}))[_0x509f35(0xdf)](),_0xd1de2e=_0x2eee08[_0x509f35(0xc3)](/data: (.+)/),_0x32c500=_0xd1de2e?JSON[_0x509f35(0xc5)](_0xd1de2e[0x1]):JSON[_0x509f35(0xc5)](_0x2eee08),_0x4dd2e8=_0x32c500?.[_0x509f35(0xc7)]?.[_0x509f35(0xed)]?.[0x0]?.[_0x509f35(0xdf)];return _0x4dd2e8?JSON[_0x509f35(0xc5)](_0x4dd2e8):_0x32c500;}async[a0_0x2f58b1(0xe8)](){const _0x5af01f=a0_0x2f58b1;if(this[_0x5af01f(0xf2)])return;this['running']=!0x0,await this[_0x5af01f(0xf8)](_0x5af01f(0xd9)),this[_0x5af01f(0xd5)](_0x5af01f(0xfa)),this[_0x5af01f(0xe5)]=setInterval(()=>{const _0x39544d=_0x5af01f;this[_0x39544d(0xf8)](_0x39544d(0xd9))[_0x39544d(0x107)](_0x1671ee=>this[_0x39544d(0xd5)]('heartbeat\x20failed:\x20'+_0x1671ee[_0x39544d(0xcc)]));},this['heartbeatInterval']),this[_0x5af01f(0xe2)]();}async[a0_0x2f58b1(0xdc)](){const _0x4348e8=a0_0x2f58b1;if(this[_0x4348e8(0xf2)]=!0x1,this['sseAbort']?.[_0x4348e8(0xda)](),this[_0x4348e8(0xe5)])clearInterval(this[_0x4348e8(0xe5)]);await this[_0x4348e8(0xf8)](_0x4348e8(0xf4))[_0x4348e8(0x107)](()=>{}),this[_0x4348e8(0xd5)](_0x4348e8(0x10a));}async[a0_0x2f58b1(0xc8)](_0x4ebca2,_0x1e4589,_0x4847da=a0_0x2f58b1(0xfe)){const _0x21b621=a0_0x2f58b1;return this[_0x21b621(0xb9)](_0x21b621(0xfd),{'alias':_0x4ebca2,'task':_0x1e4589,'priority':_0x4847da,'from_session':this[_0x21b621(0xb6)]});}async['message'](_0x1303bf,_0x112960){const _0x30c3ed=a0_0x2f58b1;return this[_0x30c3ed(0xb9)](_0x30c3ed(0xe4),{'alias':_0x1303bf,'message':_0x112960,'from_session':this[_0x30c3ed(0xb6)]});}async[a0_0x2f58b1(0xd1)](_0x5239af,_0x394813,_0x33480b=a0_0x2f58b1(0xe7)){const _0x42c9c9=a0_0x2f58b1;return this[_0x42c9c9(0xb9)](_0x42c9c9(0xd1),{'task_id':_0x5239af,'text':_0x394813,'status':_0x33480b});}async[a0_0x2f58b1(0xf8)](_0x5ac2ba,_0x1fdc7d){const _0x2fbe7f=a0_0x2f58b1;return this['call'](_0x2fbe7f(0xf1),{'resume_id':this[_0x2fbe7f(0xbc)],'alias':this[_0x2fbe7f(0xb6)],'status':_0x5ac2ba,'server':a0_0x24eb05(),'hostname':a0_0x24eb05(),'agent':this[_0x2fbe7f(0xf7)],'project_dir':process[_0x2fbe7f(0xbe)](),..._0x1fdc7d});}async['getAllStatus'](){const _0x4b29c4=a0_0x2f58b1;return this[_0x4b29c4(0xb9)](_0x4b29c4(0xd4),{});}async['broadcast'](_0x548ead,_0x1a1f0d){const _0x15f67d=a0_0x2f58b1;return this[_0x15f67d(0xb9)](_0x15f67d(0xcf),{'message':_0x548ead,'filter_server':_0x1a1f0d?.['server'],'filter_status':_0x1a1f0d?.[_0x15f67d(0xf8)]});}async[a0_0x2f58b1(0xe2)](){const _0x3059e4=a0_0x2f58b1;let _0x56214f=encodeURIComponent(this[_0x3059e4(0xb6)]),_0x48e843=this[_0x3059e4(0xbd)]+'/events/'+_0x56214f,_0x2bcc10=this[_0x3059e4(0xbb)];while(this[_0x3059e4(0xf2)]){try{this[_0x3059e4(0xc6)]=new AbortController();let _0x10f8b9={'Accept':_0x3059e4(0xea)};if(this[_0x3059e4(0x100)])_0x10f8b9[_0x3059e4(0xd6)]=_0x3059e4(0xba)+this[_0x3059e4(0x100)];let _0xb857dc=await fetch(_0x48e843,{'headers':_0x10f8b9,'signal':this[_0x3059e4(0xc6)][_0x3059e4(0xef)]});if(!_0xb857dc['ok']||!_0xb857dc['body']){this[_0x3059e4(0xd5)](_0x3059e4(0xdb)+_0xb857dc['status']),await this['sleep'](_0x2bcc10),_0x2bcc10=Math[_0x3059e4(0xe3)](_0x2bcc10*1.5,0xea60);continue;}_0x2bcc10=this[_0x3059e4(0xbb)];let _0x32acac=_0xb857dc['body']['getReader'](),_0x17462c=new TextDecoder(),_0x460185='';while(this['running']){let {done:_0x42d7e2,value:_0x541b5f}=await _0x32acac[_0x3059e4(0xc1)]();if(_0x42d7e2)break;_0x460185+=_0x17462c['decode'](_0x541b5f,{'stream':!0x0});let _0x3d649c=_0x460185[_0x3059e4(0xd2)]('\x0a');_0x460185=_0x3d649c[_0x3059e4(0xfc)]()||'';for(let _0x4ec55d of _0x3d649c){if(!_0x4ec55d['startsWith'](_0x3059e4(0xd3)))continue;try{let _0x14a2cf=JSON[_0x3059e4(0xc5)](_0x4ec55d[_0x3059e4(0xc9)](0x6));if(_0x14a2cf[_0x3059e4(0xcb)]===_0x3059e4(0xde)){this['log'](_0x3059e4(0xee)),this['emit']('connected');continue;}if(_0x14a2cf[_0x3059e4(0xcb)]==='new_task'||_0x14a2cf[_0x3059e4(0xcb)]==='new_message'||_0x14a2cf[_0x3059e4(0xcb)]==='broadcast')await this[_0x3059e4(0xdd)]();}catch{}}}}catch(_0x5bb57f){if(_0x5bb57f[_0x3059e4(0xc0)]==='AbortError')break;this[_0x3059e4(0xd0)](_0x3059e4(0xce),_0x5bb57f),this['log'](_0x3059e4(0xbf)+_0x5bb57f[_0x3059e4(0xcc)]);}if(this[_0x3059e4(0xf2)])this[_0x3059e4(0xd0)](_0x3059e4(0x10a)),this[_0x3059e4(0xd5)]('SSE\x20reconnecting\x20in\x20'+_0x2bcc10/0x3e8+'s...'),await this[_0x3059e4(0xb3)](_0x2bcc10),_0x2bcc10=Math[_0x3059e4(0xe3)](_0x2bcc10*1.5,0xea60);}}async[a0_0x2f58b1(0xdd)](){const _0x374d90=a0_0x2f58b1;try{let _0x447d12=(await this['call'](_0x374d90(0x106),{'alias':this['alias'],'limit':0xa}))?.[_0x374d90(0xb5)]||[];for(let _0x585480 of _0x447d12)await this[_0x374d90(0xb9)]('ack_inbox',{'alias':this[_0x374d90(0xb6)],'message_id':_0x585480['id']}),this['log']('←\x20'+_0x585480['from_session']+':\x20'+_0x585480[_0x374d90(0xed)][_0x374d90(0xc9)](0x0,0x3c)),this['emit'](_0x374d90(0xca),_0x585480),this[_0x374d90(0xd0)](_0x374d90(0xcc),_0x585480);}catch(_0x47dd93){this[_0x374d90(0xd5)](_0x374d90(0x105)+_0x47dd93[_0x374d90(0xcc)]);}}['sleep'](_0x26beb0){return new Promise(_0x35da29=>setTimeout(_0x35da29,_0x26beb0));}}var $=T;export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x55afc9=a0_0x39f2;(function(_0x59bb83,_0x4e328a){const _0x13cae0=a0_0x39f2,_0x4da61d=_0x59bb83();while(!![]){try{const _0x4cebc2=parseInt(_0x13cae0(0x1f5))/0x1*(parseInt(_0x13cae0(0x213))/0x2)+parseInt(_0x13cae0(0x1fc))/0x3+-parseInt(_0x13cae0(0x23d))/0x4+parseInt(_0x13cae0(0x1ea))/0x5*(-parseInt(_0x13cae0(0x1f8))/0x6)+parseInt(_0x13cae0(0x1f2))/0x7*(-parseInt(_0x13cae0(0x1fa))/0x8)+-parseInt(_0x13cae0(0x274))/0x9*(-parseInt(_0x13cae0(0x255))/0xa)+-parseInt(_0x13cae0(0x218))/0xb*(-parseInt(_0x13cae0(0x1ec))/0xc);if(_0x4cebc2===_0x4e328a)break;else _0x4da61d['push'](_0x4da61d['shift']());}catch(_0x1fc93e){_0x4da61d['push'](_0x4da61d['shift']());}}}(a0_0x4a19,0x67dad));import{readFileSync as a0_0x8d21db,existsSync as a0_0x54d138}from'fs';import{randomUUID as a0_0x297324}from'crypto';import{join as a0_0xeb263f}from'path';import{hostname as a0_0x3c76ce}from'os';import{execSync as a0_0x572900}from'child_process';function a0_0x39f2(_0x30ff79,_0x184048){_0x30ff79=_0x30ff79-0x1e9;const _0x4a19d1=a0_0x4a19();let _0x39f261=_0x4a19d1[_0x30ff79];return _0x39f261;}import{Server as a0_0x2b4a81}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x374d4b}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x1699a9,CallToolRequestSchema as a0_0x4bd245}from'@modelcontextprotocol/sdk/types.js';function p(_0x45739b){const _0x89365b=a0_0x39f2;if(!a0_0x54d138(_0x45739b))return;for(let _0x700e94 of a0_0x8d21db(_0x45739b,_0x89365b(0x26a))[_0x89365b(0x244)]('\x0a')){let _0x317d15=_0x700e94[_0x89365b(0x227)]();if(!_0x317d15||_0x317d15[_0x89365b(0x1eb)]('#'))continue;let _0x34d456=_0x317d15[_0x89365b(0x270)]('=');if(_0x34d456<0x0)continue;let _0x5d6e23=_0x317d15[_0x89365b(0x240)](0x0,_0x34d456)[_0x89365b(0x227)](),_0x68d8cb=_0x317d15['slice'](_0x34d456+0x1)[_0x89365b(0x227)]()[_0x89365b(0x233)](/^["']|["']$/g,'');if(!process.env[_0x5d6e23])process.env[_0x5d6e23]=_0x68d8cb;}}var C=process.env.HOME||'~',T=a0_0xeb263f(C,'.claude/channels/commhub');p(a0_0xeb263f(T,a0_0x55afc9(0x22d)));var L=process[a0_0x55afc9(0x271)]()[a0_0x55afc9(0x233)](/\//g,'-');p(a0_0xeb263f(T,L,'.env'));function U(){const _0x5ef468=a0_0x55afc9;try{return a0_0x572900(_0x5ef468(0x26c),{'encoding':_0x5ef468(0x26a),'timeout':0x7d0})[_0x5ef468(0x227)]();}catch{return'';}}function v(){const _0x16ad94=a0_0x55afc9;try{let _0x40ae16=a0_0xeb263f(C,_0x16ad94(0x221),_0x16ad94(0x207));if(a0_0x54d138(_0x40ae16))return JSON[_0x16ad94(0x237)](a0_0x8d21db(_0x40ae16,_0x16ad94(0x26a)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x55afc9(0x23c)]||a0_0x55afc9(0x214),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x3c76ce(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x297324(),X=process.env.COMMHUB_TOKEN||H[a0_0x55afc9(0x203)]||'';function Y(_0x963c7){const _0x26163d=a0_0x55afc9;let _0x2a008a=new Date()[_0x26163d(0x205)]()[_0x26163d(0x240)](0x0,0x8);process[_0x26163d(0x202)]['write']('['+_0x2a008a+']\x20[commhub]\x20'+_0x963c7+'\x0a');}function h(_0x3c9624){return new Promise(_0x2e5f9c=>setTimeout(_0x2e5f9c,_0x3c9624));}Y(a0_0x55afc9(0x245)+f+a0_0x55afc9(0x241)+Z+a0_0x55afc9(0x273)+w[a0_0x55afc9(0x240)](0x0,0x8)+a0_0x55afc9(0x21a)+(j||a0_0x55afc9(0x22c))+a0_0x55afc9(0x1f4)+process[a0_0x55afc9(0x271)]()+a0_0x55afc9(0x20d)+L);var k=new Map(),K=new a0_0x2b4a81({'name':a0_0x55afc9(0x272),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x55afc9(0x262),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x55afc9(0x226),a0_0x55afc9(0x268)+Z][a0_0x55afc9(0x239)]('\x0a')});K[a0_0x55afc9(0x252)](a0_0x1699a9,async()=>({'tools':[{'name':a0_0x55afc9(0x23f),'description':a0_0x55afc9(0x1ee),'inputSchema':{'type':a0_0x55afc9(0x229),'properties':{'task_id':{'type':a0_0x55afc9(0x1ff),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x55afc9(0x1ff),'description':a0_0x55afc9(0x1f0)},'status':{'type':'string','enum':[a0_0x55afc9(0x24a),a0_0x55afc9(0x1f1),a0_0x55afc9(0x250),a0_0x55afc9(0x263),a0_0x55afc9(0x225),a0_0x55afc9(0x231)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':['text']}},{'name':'commhub_report_status','description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x55afc9(0x229),'properties':{'status':{'type':'string','enum':[a0_0x55afc9(0x224),a0_0x55afc9(0x23e),'blocked','error']},'task':{'type':'string','description':a0_0x55afc9(0x212)},'progress':{'type':'number','description':a0_0x55afc9(0x235)}},'required':[a0_0x55afc9(0x236)]}},{'name':'commhub_send_task','description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x55afc9(0x229),'properties':{'alias':{'type':a0_0x55afc9(0x1ff),'description':a0_0x55afc9(0x20b)},'task':{'type':'string','description':a0_0x55afc9(0x22e)},'priority':{'type':a0_0x55afc9(0x1ff),'enum':[a0_0x55afc9(0x200),a0_0x55afc9(0x1f7),a0_0x55afc9(0x1e9)],'description':a0_0x55afc9(0x26e)}},'required':[a0_0x55afc9(0x25e),'task']}},{'name':a0_0x55afc9(0x219),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x55afc9(0x1ff),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x55afc9(0x1ff),'description':'Message\x20content'}},'required':[a0_0x55afc9(0x25e),a0_0x55afc9(0x24d)]}},{'name':a0_0x55afc9(0x242),'description':a0_0x55afc9(0x234),'inputSchema':{'type':a0_0x55afc9(0x229),'properties':{}}}]}));async function P(_0x289c9e,_0x21c2ce){const _0x5b0267=a0_0x55afc9;let _0x12023a=await fetch(f+_0x5b0267(0x25c),{'method':'POST','headers':{'Content-Type':'application/json','Accept':_0x5b0267(0x26f),...X?{'Authorization':_0x5b0267(0x25b)+X}:{}},'body':JSON[_0x5b0267(0x222)]({'jsonrpc':_0x5b0267(0x211),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x5b0267(0x26d),'capabilities':{},'clientInfo':{'name':_0x5b0267(0x272),'version':_0x5b0267(0x25a)}}})});if(!_0x12023a['ok']){let _0x22d38c=await _0x12023a['text']();return Y(_0x5b0267(0x22a)+_0x12023a[_0x5b0267(0x236)]+'\x20'+_0x22d38c[_0x5b0267(0x240)](0x0,0x64)),{'ok':!0x1,'error':_0x5b0267(0x21e)+_0x12023a['status']};}await _0x12023a[_0x5b0267(0x1ed)]();let _0x2a7c83=(await(await fetch(f+_0x5b0267(0x25c),{'method':_0x5b0267(0x216),'headers':{'Content-Type':_0x5b0267(0x251),'Accept':_0x5b0267(0x26f),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x5b0267(0x222)]({'jsonrpc':_0x5b0267(0x211),'id':0x2,'method':_0x5b0267(0x215),'params':{'name':_0x289c9e,'arguments':_0x21c2ce}})}))['text']())['split']('\x0a')['find'](_0x2e1630=>_0x2e1630[_0x5b0267(0x1eb)](_0x5b0267(0x26b)));if(_0x2a7c83){let _0x2a2ec1=JSON[_0x5b0267(0x237)](_0x2a7c83['slice'](0x6));return _0x2a2ec1?.['result']?.[_0x5b0267(0x21f)]?.[0x0]?.[_0x5b0267(0x1ed)]?JSON[_0x5b0267(0x237)](_0x2a2ec1[_0x5b0267(0x208)]['content'][0x0][_0x5b0267(0x1ed)]):_0x2a2ec1;}return{'ok':!0x1,'error':_0x5b0267(0x22f)};}function a0_0x4a19(){const _0x1c6d39=['tmux\x20display-message\x20-p\x20\x27#S\x27','2025-03-26','Priority\x20(default:\x20normal)','application/json,\x20text/event-stream','indexOf','cwd','commhub-channel','\x20RESUME_ID=','470277dgDghV','new_message','claude-code','low','35RQRQNq','startsWith','4016496EMIkeF','text','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','connected','Reply\x20text\x20/\x20result\x20summary','failed','245413AEEFtK','inbox_count','\x20CWD=','118sbMLgw','notification','normal','393252rYkoBR','params','136TXriGf','SIGTERM','1901511yxRJwj','/events/','→\x20injected\x20task\x20','string','high','pop','stderr','token','find','toTimeString',':\x20inbox_count=','config.json','result','from_session','stdin','Target\x20session\x20alias','registered\x20as\x20\x22','\x20PROJECT_ENV=','type','SIGINT','send_reply','2.0','Current\x20task\x20description','6442WcYWmm','http://127.0.0.1:9200','tools/call','POST','catch','33MUrWCX','commhub_send_message','...\x20TMUX=','getReader','message_id','broadcast','init\x20failed:\x20','content','body','.anet','stringify','send_task','working','error','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','trim','shutting\x20down,\x20reporting\x20offline...','object','CommHub\x20init\x20failed:\x20','get_inbox','none','.env','Task\x20content','no\x20response','messages','in_progress','parse\x20error:\x20','replace','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','Progress\x200-100','status','parse','\x20from\x20','join','set','exit','hub','2987460RcmhAA','idle','commhub_reply','slice','\x20ALIAS=','commhub_get_all_status','replied','split','ENV:\x20URL=','Authorization','commhub_report_status','MCP\x20stdio\x20connected','notifications/claude/channel','completed','commhub','SSE\x20error:\x20','message','SSE\x20connection\x20error:\x20','from','cancelled','application/json','setRequestHandler','fatal:\x20','new_task','40COskMa','commhub_send_task','read','delete','statusText','0.3.0','Bearer\x20','/mcp','\x20priority=','alias','←\x20message\x20from\x20','\x22\x20(','starting\x20SSE\x20listener...','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','blocked','send_message','length','priority','report_status','Session\x20alias:\x20','session\x20disconnected','utf-8','data:\x20'];a0_0x4a19=function(){return _0x1c6d39;};return a0_0x4a19();}K[a0_0x55afc9(0x252)](a0_0x4bd245,async _0x1f566c=>{const _0x217861=a0_0x55afc9;let {name:_0x1d60df,arguments:_0x11ca63}=_0x1f566c[_0x217861(0x1f9)];if(_0x1d60df===_0x217861(0x23f)){let {task_id:_0x35da08,text:_0x586f43,status:_0x49aca7}=_0x11ca63;if(_0x49aca7===_0x217861(0x24a)||_0x49aca7===_0x217861(0x1f1)||_0x49aca7===_0x217861(0x250)){let _0x397dd1=_0x49aca7===_0x217861(0x24a)?_0x217861(0x243):_0x49aca7,_0x4b481e=_0x35da08?k['get'](_0x35da08)||'hub':'hub',_0x41db4a=await P(_0x217861(0x210),{'alias':_0x4b481e,'text':_0x586f43,'in_reply_to':_0x35da08||void 0x0,'status':_0x397dd1,'from_session':Z});if(_0x35da08)k[_0x217861(0x258)](_0x35da08);return{'content':[{'type':_0x217861(0x1ed),'text':JSON[_0x217861(0x222)](_0x41db4a)}]};}let _0x2ef9a6=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x49aca7==='blocked'?_0x217861(0x263):_0x49aca7===_0x217861(0x225)?_0x217861(0x225):_0x217861(0x224),'task':_0x586f43[_0x217861(0x240)](0x0,0xc8),'output':_0x586f43});return{'content':[{'type':_0x217861(0x1ed),'text':JSON[_0x217861(0x222)](_0x2ef9a6)}]};}if(_0x1d60df===_0x217861(0x247)){let {status:_0x2e30c5,task:_0x1adab8,progress:_0x3ab4b5}=_0x11ca63,_0x5cebc2=await P(_0x217861(0x267),{'resume_id':w,'alias':Z,'status':_0x2e30c5,'task':_0x1adab8,'progress':_0x3ab4b5});return{'content':[{'type':_0x217861(0x1ed),'text':JSON[_0x217861(0x222)](_0x5cebc2)}]};}if(_0x1d60df===_0x217861(0x256)){let {alias:_0x24b133,task:_0x6164a9,priority:_0x4b6694}=_0x11ca63,_0x7cdce7=await P(_0x217861(0x223),{'alias':_0x24b133,'task':_0x6164a9,'priority':_0x4b6694||'normal','from_session':Z});return{'content':[{'type':_0x217861(0x1ed),'text':JSON['stringify'](_0x7cdce7)}]};}if(_0x1d60df==='commhub_send_message'){let {alias:_0x3989bf,message:_0x32276e}=_0x11ca63,_0xc6eda0=await P(_0x217861(0x264),{'alias':_0x3989bf,'message':_0x32276e,'from_session':Z});return{'content':[{'type':_0x217861(0x1ed),'text':JSON[_0x217861(0x222)](_0xc6eda0)}]};}if(_0x1d60df==='commhub_get_all_status'){let _0x59aa65=await P('get_all_status',{});return{'content':[{'type':_0x217861(0x1ed),'text':JSON[_0x217861(0x222)](_0x59aa65)}]};}return{'content':[{'type':'text','text':JSON[_0x217861(0x222)]({'error':'unknown\x20tool'})}]};});async function u(){const _0x33b39c=a0_0x55afc9;let _0x331650=f+_0x33b39c(0x1fd)+encodeURIComponent(Z),_0x9e1422={};if(X)_0x9e1422[_0x33b39c(0x246)]=_0x33b39c(0x25b)+X;Y('connecting\x20to\x20'+_0x331650);while(!0x0){try{let _0x5d9909=await fetch(_0x331650,{'headers':_0x9e1422});if(!_0x5d9909['ok']){Y(_0x33b39c(0x24c)+_0x5d9909[_0x33b39c(0x236)]+'\x20'+_0x5d9909[_0x33b39c(0x259)]),await h(0x1388);continue;}let _0x13ef0d=_0x5d9909[_0x33b39c(0x220)][_0x33b39c(0x21b)](),_0x4d0e1a=new TextDecoder(),_0x1d0e98='';while(!0x0){let {done:_0x578de0,value:_0x5e1c47}=await _0x13ef0d[_0x33b39c(0x257)]();if(_0x578de0)break;_0x1d0e98+=_0x4d0e1a['decode'](_0x5e1c47,{'stream':!0x0});let _0x24fe3f=_0x1d0e98[_0x33b39c(0x244)]('\x0a\x0a');_0x1d0e98=_0x24fe3f[_0x33b39c(0x201)]()||'';for(let _0x1f05cc of _0x24fe3f){let _0x457235=_0x1f05cc[_0x33b39c(0x244)]('\x0a')[_0x33b39c(0x204)](_0x205bf4=>_0x205bf4[_0x33b39c(0x1eb)](_0x33b39c(0x26b)));if(!_0x457235)continue;try{let _0x87fec6=JSON[_0x33b39c(0x237)](_0x457235['slice'](0x6));await S(_0x87fec6);}catch(_0x18ed12){Y(_0x33b39c(0x232)+_0x18ed12);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0xb2d67){Y(_0x33b39c(0x24e)+_0xb2d67);}await h(0xbb8);}}async function S(_0x40a42d){const _0xe12490=a0_0x55afc9;if(_0x40a42d[_0xe12490(0x20e)]===_0xe12490(0x1ef)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x40a42d['type']===_0xe12490(0x275)){if(Y(_0xe12490(0x25f)+_0x40a42d['from']+':\x20'+_0x40a42d[_0xe12490(0x24d)][_0xe12490(0x240)](0x0,0x3c)),await K[_0xe12490(0x1f6)]({'method':_0xe12490(0x249),'params':{'content':_0x40a42d['message'],'meta':{'sender':_0x40a42d[_0xe12490(0x24f)]||'hub','sender_id':_0xe12490(0x24b),'user':_0x40a42d[_0xe12490(0x24f)]||'hub','priority':'normal'}}}),_0x40a42d['message_id'])await P('ack_inbox',{'alias':Z,'message_id':_0x40a42d[_0xe12490(0x21c)]});return;}if(_0x40a42d[_0xe12490(0x20e)]===_0xe12490(0x254)||_0x40a42d[_0xe12490(0x20e)]===_0xe12490(0x21d)){Y('←\x20'+_0x40a42d[_0xe12490(0x20e)]+_0xe12490(0x206)+_0x40a42d[_0xe12490(0x1f3)]+_0xe12490(0x25d)+(_0x40a42d[_0xe12490(0x266)]||_0xe12490(0x1f7)));let _0xed90d1=await P(_0xe12490(0x22b),{'alias':Z,'limit':0x5});if(_0xed90d1?.['ok']&&_0xed90d1[_0xe12490(0x230)]?.[_0xe12490(0x265)]>0x0)for(let _0x545df3 of _0xed90d1['messages']){let _0x460088={'sender':_0x545df3[_0xe12490(0x209)]||_0xe12490(0x23c),'sender_id':'commhub','user':_0x545df3['from_session']||'hub','task_id':_0x545df3['id'],'priority':_0x545df3['priority']||'normal'};k[_0xe12490(0x23a)](_0x545df3['id'],_0x545df3[_0xe12490(0x209)]||'hub'),await K[_0xe12490(0x1f6)]({'method':'notifications/claude/channel','params':{'content':_0x545df3[_0xe12490(0x21f)],'meta':_0x460088}}),Y(_0xe12490(0x1fe)+_0x545df3['id'][_0xe12490(0x240)](0x0,0x8)+_0xe12490(0x238)+_0x545df3[_0xe12490(0x209)]+':\x20'+_0x545df3[_0xe12490(0x21f)][_0xe12490(0x240)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x545df3['id']});}}}async function A(){const _0x18f617=a0_0x55afc9;let _0x573d6f=new a0_0x374d4b();await K['connect'](_0x573d6f),Y(_0x18f617(0x248)),Y(_0x18f617(0x261)),u()['catch'](_0x5061b5=>Y('SSE\x20fatal:\x20'+_0x5061b5)),P(_0x18f617(0x267),{'resume_id':w,'alias':Z,'status':_0x18f617(0x23e),'server':a0_0x3c76ce(),'hostname':a0_0x3c76ce(),'agent':_0x18f617(0x276),'project_dir':process[_0x18f617(0x271)](),'tmux_name':j||void 0x0})['then'](()=>Y(_0x18f617(0x20c)+Z+_0x18f617(0x260)+w[_0x18f617(0x240)](0x0,0x8)+')'))[_0x18f617(0x217)](_0x348d63=>Y('warning:\x20could\x20not\x20register:\x20'+_0x348d63)),setInterval(()=>{const _0x26ca05=_0x18f617;P(_0x26ca05(0x267),{'resume_id':w,'alias':Z,'status':_0x26ca05(0x23e),'server':a0_0x3c76ce(),'hostname':a0_0x3c76ce(),'agent':_0x26ca05(0x276),'project_dir':process[_0x26ca05(0x271)](),'tmux_name':j||void 0x0})[_0x26ca05(0x217)](_0x12b66b=>Y('heartbeat\x20failed:\x20'+_0x12b66b));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x55afc9(0x217)](_0x4bc2d2=>{const _0x2c1671=a0_0x55afc9;Y(_0x2c1671(0x253)+_0x4bc2d2),process[_0x2c1671(0x23b)](0x1);});async function N(){const _0x33bb63=a0_0x55afc9;Y(_0x33bb63(0x228)),await P('report_status',{'resume_id':w,'alias':Z,'status':'error','task':_0x33bb63(0x269)})[_0x33bb63(0x217)](()=>{}),process['exit'](0x0);}process[a0_0x55afc9(0x20a)]['on']('end',()=>N()),process['on'](a0_0x55afc9(0x1fb),()=>N()),process['on'](a0_0x55afc9(0x20f),()=>N());
2
+ const a0_0x158381=a0_0xf5ad;(function(_0x306d4a,_0x5f5daf){const _0x39c0da=a0_0xf5ad,_0x3d423a=_0x306d4a();while(!![]){try{const _0x1393f3=-parseInt(_0x39c0da(0x173))/0x1+-parseInt(_0x39c0da(0x1cf))/0x2+-parseInt(_0x39c0da(0x19d))/0x3*(parseInt(_0x39c0da(0x17e))/0x4)+parseInt(_0x39c0da(0x1b1))/0x5*(-parseInt(_0x39c0da(0x1d8))/0x6)+-parseInt(_0x39c0da(0x1b5))/0x7+-parseInt(_0x39c0da(0x17d))/0x8*(parseInt(_0x39c0da(0x17a))/0x9)+parseInt(_0x39c0da(0x165))/0xa;if(_0x1393f3===_0x5f5daf)break;else _0x3d423a['push'](_0x3d423a['shift']());}catch(_0x4d06fe){_0x3d423a['push'](_0x3d423a['shift']());}}}(a0_0x54b2,0x88302));import{readFileSync as a0_0x1ed82a,existsSync as a0_0x17f8bf}from'fs';import{randomUUID as a0_0x51ec75}from'crypto';import{join as a0_0x59f17f}from'path';import{hostname as a0_0x592bbe}from'os';import{execSync as a0_0x5b9049}from'child_process';import{Server as a0_0x43ba51}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x3104be}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x253b39,CallToolRequestSchema as a0_0x4f97f4}from'@modelcontextprotocol/sdk/types.js';function p(_0x3a8aa6){const _0x5ad673=a0_0xf5ad;if(!a0_0x17f8bf(_0x3a8aa6))return;for(let _0x434adb of a0_0x1ed82a(_0x3a8aa6,'utf-8')['split']('\x0a')){let _0x1a1dea=_0x434adb[_0x5ad673(0x1ce)]();if(!_0x1a1dea||_0x1a1dea[_0x5ad673(0x1a7)]('#'))continue;let _0x10eea9=_0x1a1dea[_0x5ad673(0x16d)]('=');if(_0x10eea9<0x0)continue;let _0x322ea6=_0x1a1dea[_0x5ad673(0x1d3)](0x0,_0x10eea9)[_0x5ad673(0x1ce)](),_0x5ec558=_0x1a1dea[_0x5ad673(0x1d3)](_0x10eea9+0x1)[_0x5ad673(0x1ce)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x322ea6])process.env[_0x322ea6]=_0x5ec558;}}var C=process.env.HOME||'~',T=a0_0x59f17f(C,a0_0x158381(0x1b3));p(a0_0x59f17f(T,'.env'));var L=process['cwd']()[a0_0x158381(0x18b)](/\//g,'-');p(a0_0x59f17f(T,L,'.env'));function U(){const _0x820496=a0_0x158381;try{return a0_0x5b9049(_0x820496(0x1b4),{'encoding':_0x820496(0x175),'timeout':0x7d0})[_0x820496(0x1ce)]();}catch{return'';}}function v(){const _0x2394a9=a0_0x158381;try{let _0x45cfc2=a0_0x59f17f(C,_0x2394a9(0x194),_0x2394a9(0x15e));if(a0_0x17f8bf(_0x45cfc2))return JSON[_0x2394a9(0x163)](a0_0x1ed82a(_0x45cfc2,_0x2394a9(0x175)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x158381(0x1a5)]||a0_0x158381(0x187),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x592bbe(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x51ec75(),X=process.env.COMMHUB_TOKEN||H[a0_0x158381(0x1b9)]||'';function Y(_0x4d9f1b){const _0x1851ad=a0_0x158381;let _0x284be6=new Date()[_0x1851ad(0x1be)]()[_0x1851ad(0x1d3)](0x0,0x8);process[_0x1851ad(0x171)]['write']('['+_0x284be6+']\x20[commhub]\x20'+_0x4d9f1b+'\x0a');}function h(_0x4c327c){return new Promise(_0xcb323=>setTimeout(_0xcb323,_0x4c327c));}function a0_0xf5ad(_0x51b4d9,_0x116f96){_0x51b4d9=_0x51b4d9-0x15b;const _0x54b22d=a0_0x54b2();let _0xf5add3=_0x54b22d[_0x51b4d9];return _0xf5add3;}Y(a0_0x158381(0x178)+f+'\x20ALIAS='+Z+a0_0x158381(0x1e0)+w[a0_0x158381(0x1d3)](0x0,0x8)+a0_0x158381(0x1b0)+(j||a0_0x158381(0x18f))+a0_0x158381(0x16a)+process[a0_0x158381(0x1bd)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x43ba51({'name':a0_0x158381(0x196),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x158381(0x18c),a0_0x158381(0x19c),a0_0x158381(0x182),a0_0x158381(0x1e3),a0_0x158381(0x186)+Z][a0_0x158381(0x180)]('\x0a')});K['setRequestHandler'](a0_0x253b39,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x158381(0x1b6),'inputSchema':{'type':a0_0x158381(0x1bf),'properties':{'task_id':{'type':a0_0x158381(0x1a9),'description':a0_0x158381(0x15c)},'text':{'type':a0_0x158381(0x1a9),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':'string','enum':[a0_0x158381(0x192),a0_0x158381(0x1a2),'cancelled',a0_0x158381(0x15d),a0_0x158381(0x1ab),'in_progress'],'description':a0_0x158381(0x1de)}},'required':[a0_0x158381(0x1a6)]}},{'name':'commhub_report_status','description':a0_0x158381(0x166),'inputSchema':{'type':a0_0x158381(0x1bf),'properties':{'status':{'type':a0_0x158381(0x1a9),'enum':[a0_0x158381(0x184),a0_0x158381(0x1dd),'blocked',a0_0x158381(0x1ab)]},'task':{'type':a0_0x158381(0x1a9),'description':a0_0x158381(0x1ac)},'progress':{'type':a0_0x158381(0x1db),'description':a0_0x158381(0x164)}},'required':['status']}},{'name':a0_0x158381(0x15b),'description':a0_0x158381(0x1ae),'inputSchema':{'type':a0_0x158381(0x1bf),'properties':{'alias':{'type':a0_0x158381(0x1a9),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x158381(0x1a9),'description':a0_0x158381(0x1aa)},'priority':{'type':'string','enum':[a0_0x158381(0x199),a0_0x158381(0x1bb),'low'],'description':a0_0x158381(0x167)}},'required':[a0_0x158381(0x1c3),a0_0x158381(0x1a1)]}},{'name':a0_0x158381(0x1b7),'description':a0_0x158381(0x177),'inputSchema':{'type':'object','properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'message':{'type':a0_0x158381(0x1a9),'description':a0_0x158381(0x1c5)}},'required':[a0_0x158381(0x1c3),a0_0x158381(0x188)]}},{'name':a0_0x158381(0x172),'description':a0_0x158381(0x170),'inputSchema':{'type':a0_0x158381(0x1bf),'properties':{}}}]}));async function P(_0x391961,_0x286c77){const _0x30faf3=a0_0x158381;let _0x456cc0=await fetch(f+_0x30faf3(0x1d9),{'method':_0x30faf3(0x183),'headers':{'Content-Type':_0x30faf3(0x1bc),'Accept':_0x30faf3(0x16c),...X?{'Authorization':_0x30faf3(0x19a)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x1,'method':'initialize','params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x30faf3(0x189)}}})});if(!_0x456cc0['ok']){let _0x50730d=await _0x456cc0[_0x30faf3(0x1a6)]();return Y(_0x30faf3(0x1d2)+_0x456cc0[_0x30faf3(0x168)]+'\x20'+_0x50730d[_0x30faf3(0x1d3)](0x0,0x64)),{'ok':!0x1,'error':_0x30faf3(0x1e5)+_0x456cc0['status']};}await _0x456cc0[_0x30faf3(0x1a6)]();let _0xb72f72=(await(await fetch(f+_0x30faf3(0x1d9),{'method':_0x30faf3(0x183),'headers':{'Content-Type':_0x30faf3(0x1bc),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x30faf3(0x19a)+X}:{}},'body':JSON[_0x30faf3(0x181)]({'jsonrpc':'2.0','id':0x2,'method':_0x30faf3(0x1b8),'params':{'name':_0x391961,'arguments':_0x286c77}})}))[_0x30faf3(0x1a6)]())['split']('\x0a')[_0x30faf3(0x16b)](_0x59d7e8=>_0x59d7e8[_0x30faf3(0x1a7)](_0x30faf3(0x197)));if(_0xb72f72){let _0x5306a3=JSON[_0x30faf3(0x163)](_0xb72f72['slice'](0x6));return _0x5306a3?.['result']?.['content']?.[0x0]?.[_0x30faf3(0x1a6)]?JSON[_0x30faf3(0x163)](_0x5306a3[_0x30faf3(0x1cd)][_0x30faf3(0x179)][0x0][_0x30faf3(0x1a6)]):_0x5306a3;}return{'ok':!0x1,'error':_0x30faf3(0x191)};}K['setRequestHandler'](a0_0x4f97f4,async _0x4792da=>{const _0x3794d5=a0_0x158381;let {name:_0x29cb5a,arguments:_0x1f9fe5}=_0x4792da['params'];if(_0x29cb5a===_0x3794d5(0x1a3)){let {task_id:_0x450f94,text:_0x263368,status:_0x3bdf19}=_0x1f9fe5;if(_0x3bdf19===_0x3794d5(0x192)||_0x3bdf19===_0x3794d5(0x1a2)||_0x3bdf19===_0x3794d5(0x19f)){let _0x444892=_0x3bdf19===_0x3794d5(0x192)?_0x3794d5(0x1c0):_0x3bdf19,_0x2be51f=_0x450f94?k[_0x3794d5(0x190)](_0x450f94)||_0x3794d5(0x1a5):_0x3794d5(0x1a5),_0x387538=await P(_0x3794d5(0x1c6),{'alias':_0x2be51f,'text':_0x263368,'in_reply_to':_0x450f94||void 0x0,'status':_0x444892,'from_session':Z});if(_0x450f94)k[_0x3794d5(0x161)](_0x450f94);return{'content':[{'type':'text','text':JSON[_0x3794d5(0x181)](_0x387538)}]};}let _0x3e21b5=await P(_0x3794d5(0x1cc),{'resume_id':w,'alias':Z,'status':_0x3bdf19===_0x3794d5(0x15d)?_0x3794d5(0x15d):_0x3bdf19===_0x3794d5(0x1ab)?_0x3794d5(0x1ab):_0x3794d5(0x184),'task':_0x263368[_0x3794d5(0x1d3)](0x0,0xc8),'output':_0x263368});return{'content':[{'type':_0x3794d5(0x1a6),'text':JSON[_0x3794d5(0x181)](_0x3e21b5)}]};}if(_0x29cb5a===_0x3794d5(0x1e7)){let {status:_0x3b4f6b,task:_0x43c927,progress:_0x581db5}=_0x1f9fe5,_0x189285=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x3b4f6b,'task':_0x43c927,'progress':_0x581db5});return{'content':[{'type':_0x3794d5(0x1a6),'text':JSON['stringify'](_0x189285)}]};}if(_0x29cb5a==='commhub_send_task'){let {alias:_0x403709,task:_0x3f9e6a,priority:_0x2f5115}=_0x1f9fe5,_0x340f6f=await P('send_task',{'alias':_0x403709,'task':_0x3f9e6a,'priority':_0x2f5115||_0x3794d5(0x1bb),'from_session':Z});return{'content':[{'type':_0x3794d5(0x1a6),'text':JSON[_0x3794d5(0x181)](_0x340f6f)}]};}if(_0x29cb5a===_0x3794d5(0x1b7)){let {alias:_0x43868c,message:_0x15e748}=_0x1f9fe5,_0x3b1b79=await P(_0x3794d5(0x162),{'alias':_0x43868c,'message':_0x15e748,'from_session':Z});return{'content':[{'type':'text','text':JSON['stringify'](_0x3b1b79)}]};}if(_0x29cb5a===_0x3794d5(0x172)){let _0x47778a=await P(_0x3794d5(0x18d),{});return{'content':[{'type':_0x3794d5(0x1a6),'text':JSON['stringify'](_0x47778a)}]};}return{'content':[{'type':_0x3794d5(0x1a6),'text':JSON[_0x3794d5(0x181)]({'error':_0x3794d5(0x1e4)})}]};});async function u(){const _0x32d053=a0_0x158381;let _0x28dfee=f+_0x32d053(0x1d4)+encodeURIComponent(Z),_0x1cd3e7={};if(X)_0x1cd3e7[_0x32d053(0x1c2)]=_0x32d053(0x19a)+X;Y(_0x32d053(0x198)+_0x28dfee);while(!0x0){try{let _0xedb4a5=await fetch(_0x28dfee,{'headers':_0x1cd3e7});if(!_0xedb4a5['ok']){Y(_0x32d053(0x1dc)+_0xedb4a5[_0x32d053(0x168)]+'\x20'+_0xedb4a5[_0x32d053(0x18e)]),await h(0x1388);continue;}let _0x448791=_0xedb4a5[_0x32d053(0x16e)][_0x32d053(0x1a4)](),_0x2d20df=new TextDecoder(),_0x27dd06='';while(!0x0){let {done:_0x5f0ae6,value:_0x3499eb}=await _0x448791[_0x32d053(0x169)]();if(_0x5f0ae6)break;_0x27dd06+=_0x2d20df[_0x32d053(0x1d0)](_0x3499eb,{'stream':!0x0});let _0x5eaec6=_0x27dd06['split']('\x0a\x0a');_0x27dd06=_0x5eaec6[_0x32d053(0x16f)]()||'';for(let _0x32cad4 of _0x5eaec6){let _0x864d99=_0x32cad4[_0x32d053(0x176)]('\x0a')[_0x32d053(0x16b)](_0x4414ca=>_0x4414ca[_0x32d053(0x1a7)](_0x32d053(0x197)));if(!_0x864d99)continue;try{let _0x5e1b00=JSON[_0x32d053(0x163)](_0x864d99[_0x32d053(0x1d3)](0x6));await S(_0x5e1b00);}catch(_0x210798){Y(_0x32d053(0x185)+_0x210798);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x54d55f){Y(_0x32d053(0x1a8)+_0x54d55f);}await h(0xbb8);}}async function S(_0xc0d174){const _0x918b61=a0_0x158381;if(_0xc0d174[_0x918b61(0x1e2)]==='connected'){Y(_0x918b61(0x1b2)+Z+'\x22');return;}if(_0xc0d174['type']==='new_message'){if(Y(_0x918b61(0x1af)+_0xc0d174[_0x918b61(0x1c9)]+':\x20'+_0xc0d174[_0x918b61(0x188)][_0x918b61(0x1d3)](0x0,0x3c)),await K[_0x918b61(0x17f)]({'method':_0x918b61(0x1e1),'params':{'content':_0xc0d174['message'],'meta':{'sender':_0xc0d174[_0x918b61(0x1c9)]||_0x918b61(0x1a5),'sender_id':'commhub','user':_0xc0d174['from']||_0x918b61(0x1a5),'priority':_0x918b61(0x1bb)}}}),_0xc0d174['message_id'])await P(_0x918b61(0x19e),{'alias':Z,'message_id':_0xc0d174[_0x918b61(0x1e6)]});return;}if(_0xc0d174[_0x918b61(0x1e2)]===_0x918b61(0x1df)||_0xc0d174['type']==='broadcast'){Y('←\x20'+_0xc0d174[_0x918b61(0x1e2)]+':\x20inbox_count='+_0xc0d174[_0x918b61(0x17b)]+'\x20priority='+(_0xc0d174[_0x918b61(0x1ca)]||_0x918b61(0x1bb)));let _0x4aa6ea=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x4aa6ea?.['ok']&&_0x4aa6ea[_0x918b61(0x1d5)]?.[_0x918b61(0x1ba)]>0x0)for(let _0x2213d3 of _0x4aa6ea['messages']){let _0xfd8e97={'sender':_0x2213d3[_0x918b61(0x1c7)]||'hub','sender_id':'commhub','user':_0x2213d3[_0x918b61(0x1c7)]||_0x918b61(0x1a5),'task_id':_0x2213d3['id'],'priority':_0x2213d3[_0x918b61(0x1ca)]||_0x918b61(0x1bb)};k[_0x918b61(0x1c8)](_0x2213d3['id'],_0x2213d3[_0x918b61(0x1c7)]||'hub'),await K['notification']({'method':_0x918b61(0x1e1),'params':{'content':_0x2213d3[_0x918b61(0x179)],'meta':_0xfd8e97}}),Y(_0x918b61(0x17c)+_0x2213d3['id'][_0x918b61(0x1d3)](0x0,0x8)+_0x918b61(0x160)+_0x2213d3[_0x918b61(0x1c7)]+':\x20'+_0x2213d3['content'][_0x918b61(0x1d3)](0x0,0x3c)),await P(_0x918b61(0x19e),{'alias':Z,'message_id':_0x2213d3['id']});}}}function a0_0x54b2(){const _0x399726=['length','normal','application/json','cwd','toTimeString','object','replied','stdin','Authorization','alias','claude-code','Message\x20content','send_reply','from_session','set','from','priority','shutting\x20down,\x20reporting\x20offline...','report_status','result','trim','1764292lwtAte','decode','then','CommHub\x20init\x20failed:\x20','slice','/events/','messages','registered\x20as\x20\x22','warning:\x20could\x20not\x20register:\x20','1206RtchPP','/mcp','SIGINT','number','SSE\x20error:\x20','idle','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','new_task','\x20RESUME_ID=','notifications/claude/channel','type','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','unknown\x20tool','init\x20failed:\x20','message_id','commhub_report_status','commhub_send_task','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','blocked','config.json','catch','\x20from\x20','delete','send_message','parse','Progress\x200-100','40636200nmudAX','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Priority\x20(default:\x20normal)','status','read','\x20CWD=','find','application/json,\x20text/event-stream','indexOf','body','pop','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','stderr','commhub_get_all_status','611952NqEwGM','exit','utf-8','split','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','ENV:\x20URL=','content','18QldZyj','inbox_count','→\x20injected\x20task\x20','92368zOcUxP','4384748kxkWnM','notification','join','stringify','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','POST','working','parse\x20error:\x20','Session\x20alias:\x20','http://127.0.0.1:9200','message','0.3.0','connect','replace','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','get_all_status','statusText','none','get','no\x20response','completed','end','.anet','SSE\x20fatal:\x20','commhub-channel','data:\x20','connecting\x20to\x20','high','Bearer\x20','\x22\x20(','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','3pSDlAv','ack_inbox','cancelled','fatal:\x20','task','failed','commhub_reply','getReader','hub','text','startsWith','SSE\x20connection\x20error:\x20','string','Task\x20content','error','Current\x20task\x20description','session\x20disconnected','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','←\x20message\x20from\x20','...\x20TMUX=','955wcDudw','SSE\x20connected\x20as\x20\x22','.claude/channels/commhub','tmux\x20display-message\x20-p\x20\x27#S\x27','5978182jUEjrb','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','commhub_send_message','tools/call','token'];a0_0x54b2=function(){return _0x399726;};return a0_0x54b2();}async function A(){const _0x3e4c25=a0_0x158381;let _0x4e0b5f=new a0_0x3104be();await K[_0x3e4c25(0x18a)](_0x4e0b5f),Y('MCP\x20stdio\x20connected'),Y('starting\x20SSE\x20listener...'),u()['catch'](_0x159475=>Y(_0x3e4c25(0x195)+_0x159475)),P(_0x3e4c25(0x1cc),{'resume_id':w,'alias':Z,'status':_0x3e4c25(0x1dd),'server':a0_0x592bbe(),'hostname':a0_0x592bbe(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x3e4c25(0x1d1)](()=>Y(_0x3e4c25(0x1d6)+Z+_0x3e4c25(0x19b)+w['slice'](0x0,0x8)+')'))[_0x3e4c25(0x15f)](_0x4d36ad=>Y(_0x3e4c25(0x1d7)+_0x4d36ad)),setInterval(()=>{const _0x4b594f=_0x3e4c25;P(_0x4b594f(0x1cc),{'resume_id':w,'alias':Z,'status':_0x4b594f(0x1dd),'server':a0_0x592bbe(),'hostname':a0_0x592bbe(),'agent':_0x4b594f(0x1c4),'project_dir':process[_0x4b594f(0x1bd)](),'tmux_name':j||void 0x0})[_0x4b594f(0x15f)](_0x4dc7f5=>Y('heartbeat\x20failed:\x20'+_0x4dc7f5));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x158381(0x15f)](_0x2a8255=>{const _0x3a96ed=a0_0x158381;Y(_0x3a96ed(0x1a0)+_0x2a8255),process[_0x3a96ed(0x174)](0x1);});async function N(){const _0x2e996f=a0_0x158381;Y(_0x2e996f(0x1cb)),await P(_0x2e996f(0x1cc),{'resume_id':w,'alias':Z,'status':'error','task':_0x2e996f(0x1ad)})['catch'](()=>{}),process[_0x2e996f(0x174)](0x0);}process[a0_0x158381(0x1c1)]['on'](a0_0x158381(0x193),()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x158381(0x1da),()=>N());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.0.3-preview.9",
3
+ "version": "2.1.1",
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",
@@ -40,13 +40,19 @@
40
40
  "anet"
41
41
  ],
42
42
  "author": "sleep2agi",
43
- "license": "MIT",
44
- "homepage": "https://anet.vansin.me",
43
+ "license": "Apache-2.0",
44
+ "homepage": "https://anet.sh",
45
45
  "repository": {
46
46
  "type": "git",
47
47
  "url": "https://github.com/sleep2agi/agent-network",
48
48
  "directory": "agent-network"
49
49
  },
50
+ "publishConfig": {
51
+ "access": "public"
52
+ },
53
+ "bugs": {
54
+ "url": "https://github.com/sleep2agi/agent-network/issues"
55
+ },
50
56
  "engines": {
51
57
  "bun": ">=1.2.0"
52
58
  },