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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- const a0_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_0x405b(_0x22765c,_0x29f12a){_0x22765c=_0x22765c-0x72;const _0x451c68=a0_0x451c();let _0x405bf5=_0x451c68[_0x22765c];return _0x405bf5;}const a0_0x58c682=a0_0x405b;(function(_0x7e7d53,_0x32c8a7){const _0x349de4=a0_0x405b,_0x471087=_0x7e7d53();while(!![]){try{const _0x1729bd=-parseInt(_0x349de4(0xc6))/0x1+-parseInt(_0x349de4(0x9e))/0x2*(-parseInt(_0x349de4(0x8c))/0x3)+-parseInt(_0x349de4(0x76))/0x4*(-parseInt(_0x349de4(0x9c))/0x5)+-parseInt(_0x349de4(0xac))/0x6*(-parseInt(_0x349de4(0x82))/0x7)+-parseInt(_0x349de4(0xc8))/0x8*(-parseInt(_0x349de4(0xbb))/0x9)+-parseInt(_0x349de4(0xb0))/0xa*(parseInt(_0x349de4(0x97))/0xb)+-parseInt(_0x349de4(0xb8))/0xc*(parseInt(_0x349de4(0x7a))/0xd);if(_0x1729bd===_0x32c8a7)break;else _0x471087['push'](_0x471087['shift']());}catch(_0x23a47f){_0x471087['push'](_0x471087['shift']());}}}(a0_0x451c,0x87fd6));import{EventEmitter as a0_0x1aeff1}from'events';import{hostname as a0_0x45ec76}from'os';class T extends a0_0x1aeff1{[a0_0x58c682(0xa5)];['alias'];[a0_0x58c682(0xa3)];['agent'];[a0_0x58c682(0x80)];['heartbeatInterval'];[a0_0x58c682(0x7d)];[a0_0x58c682(0xb5)];['sseAbort'];[a0_0x58c682(0x7c)]=!0x1;constructor(_0x3224d1){const _0x48ef99=a0_0x58c682;super();if(this[_0x48ef99(0xa5)]=_0x3224d1[_0x48ef99(0xa5)]['replace'](/\/$/,''),this[_0x48ef99(0xa7)]=_0x3224d1[_0x48ef99(0xa7)],this['token']=_0x3224d1['token'],this[_0x48ef99(0x83)]=_0x3224d1[_0x48ef99(0x83)]||'sdk',this[_0x48ef99(0x80)]='sdk-'+_0x3224d1[_0x48ef99(0xa7)]+'-'+Date['now']()[_0x48ef99(0xba)](0x24),this[_0x48ef99(0xc5)]=_0x3224d1[_0x48ef99(0xc5)]??0x2bf20,this[_0x48ef99(0x7d)]=_0x3224d1[_0x48ef99(0x7d)]??0xbb8,_0x3224d1[_0x48ef99(0xc9)]!==!0x1)this['connect']();}[a0_0x58c682(0x98)](_0xc595a4){const _0x4d9b11=a0_0x58c682;console['log']('['+new Date()['toTimeString']()[_0x4d9b11(0x90)](0x0,0x8)+_0x4d9b11(0x85)+this[_0x4d9b11(0xa7)]+']\x20'+_0xc595a4);}async[a0_0x58c682(0xbc)](_0x1f36dd,_0x5e42f6){const _0x3db04e=a0_0x58c682;let _0x544970={'Content-Type':_0x3db04e(0x75),'Accept':_0x3db04e(0xb4)};if(this[_0x3db04e(0xa3)])_0x544970[_0x3db04e(0x99)]=_0x3db04e(0x7f)+this[_0x3db04e(0xa3)];let _0x39d342=await(await fetch(this[_0x3db04e(0xa5)]+_0x3db04e(0x87),{'method':_0x3db04e(0x96),'headers':_0x544970,'body':JSON[_0x3db04e(0x8f)]({'jsonrpc':_0x3db04e(0x94),'id':Date[_0x3db04e(0x8e)](),'method':'tools/call','params':{'name':_0x1f36dd,'arguments':_0x5e42f6}})}))[_0x3db04e(0xb1)](),_0x33033c=_0x39d342[_0x3db04e(0x77)](/data: (.+)/),_0x1393fc=_0x33033c?JSON[_0x3db04e(0xa9)](_0x33033c[0x1]):JSON[_0x3db04e(0xa9)](_0x39d342),_0x4133cc=_0x1393fc?.[_0x3db04e(0x89)]?.[_0x3db04e(0xa6)]?.[0x0]?.[_0x3db04e(0xb1)];return _0x4133cc?JSON[_0x3db04e(0xa9)](_0x4133cc):_0x1393fc;}async['connect'](){const _0x230381=a0_0x58c682;if(this['running'])return;this[_0x230381(0x7c)]=!0x0,await this[_0x230381(0x74)](_0x230381(0x95)),this[_0x230381(0x98)](_0x230381(0xa2)),this[_0x230381(0xb5)]=setInterval(()=>{const _0x17333e=_0x230381;this['status'](_0x17333e(0x95))[_0x17333e(0x84)](_0x5a96f5=>this[_0x17333e(0x98)]('heartbeat\x20failed:\x20'+_0x5a96f5[_0x17333e(0x92)]));},this['heartbeatInterval']),this[_0x230381(0xbf)]();}async[a0_0x58c682(0x73)](){const _0x329888=a0_0x58c682;if(this['running']=!0x1,this['sseAbort']?.[_0x329888(0x91)](),this[_0x329888(0xb5)])clearInterval(this[_0x329888(0xb5)]);await this[_0x329888(0x74)](_0x329888(0x8b))[_0x329888(0x84)](()=>{}),this[_0x329888(0x98)](_0x329888(0xc2));}async[a0_0x58c682(0xbd)](_0x5aed2d,_0x35cfb7,_0x19ee55=a0_0x58c682(0x9b)){const _0x3cf3a5=a0_0x58c682;return this['call']('send_task',{'alias':_0x5aed2d,'task':_0x35cfb7,'priority':_0x19ee55,'from_session':this[_0x3cf3a5(0xa7)]});}async['message'](_0x3c30d9,_0x341063){const _0x5e9cde=a0_0x58c682;return this[_0x5e9cde(0xbc)]('send_message',{'alias':_0x3c30d9,'message':_0x341063,'from_session':this[_0x5e9cde(0xa7)]});}async[a0_0x58c682(0xa0)](_0x4d18cf,_0x5e0411,_0x2226b5=a0_0x58c682(0xcb)){const _0x3997d1=a0_0x58c682;return this['call'](_0x3997d1(0xa0),{'task_id':_0x4d18cf,'text':_0x5e0411,'status':_0x2226b5});}async[a0_0x58c682(0x74)](_0x542135,_0x40623f){const _0xfe3e07=a0_0x58c682;return this[_0xfe3e07(0xbc)](_0xfe3e07(0x9a),{'resume_id':this[_0xfe3e07(0x80)],'alias':this['alias'],'status':_0x542135,'server':a0_0x45ec76(),'hostname':a0_0x45ec76(),'agent':this['agent'],'project_dir':process[_0xfe3e07(0x8d)](),..._0x40623f});}async[a0_0x58c682(0xa1)](){const _0x538400=a0_0x58c682;return this[_0x538400(0xbc)]('get_all_status',{});}async['broadcast'](_0x50ecf2,_0x563288){const _0x40d152=a0_0x58c682;return this[_0x40d152(0xbc)](_0x40d152(0xca),{'message':_0x50ecf2,'filter_server':_0x563288?.[_0x40d152(0x7b)],'filter_status':_0x563288?.[_0x40d152(0x74)]});}async[a0_0x58c682(0xbf)](){const _0x587cc7=a0_0x58c682;let _0x3848fe=encodeURIComponent(this[_0x587cc7(0xa7)]),_0x2311d3=this[_0x587cc7(0xa5)]+'/events/'+_0x3848fe,_0x802ef7=this[_0x587cc7(0x7d)];while(this[_0x587cc7(0x7c)]){try{this[_0x587cc7(0xb7)]=new AbortController();let _0xf5faba={'Accept':_0x587cc7(0xb6)};if(this[_0x587cc7(0xa3)])_0xf5faba['Authorization']=_0x587cc7(0x7f)+this['token'];let _0x2f8ce2=await fetch(_0x2311d3,{'headers':_0xf5faba,'signal':this['sseAbort'][_0x587cc7(0xb3)]});if(!_0x2f8ce2['ok']||!_0x2f8ce2[_0x587cc7(0x79)]){this[_0x587cc7(0x98)](_0x587cc7(0xbe)+_0x2f8ce2['status']),await this[_0x587cc7(0x88)](_0x802ef7),_0x802ef7=Math[_0x587cc7(0xae)](_0x802ef7*1.5,0xea60);continue;}_0x802ef7=this['reconnectDelay'];let _0x3c2bf5=_0x2f8ce2['body'][_0x587cc7(0x8a)](),_0x5bd741=new TextDecoder(),_0x5e693f='';while(this[_0x587cc7(0x7c)]){let {done:_0x494439,value:_0x38b899}=await _0x3c2bf5['read']();if(_0x494439)break;_0x5e693f+=_0x5bd741[_0x587cc7(0xa4)](_0x38b899,{'stream':!0x0});let _0x250d28=_0x5e693f[_0x587cc7(0x7e)]('\x0a');_0x5e693f=_0x250d28[_0x587cc7(0x93)]()||'';for(let _0x4d76eb of _0x250d28){if(!_0x4d76eb[_0x587cc7(0xc0)]('data:\x20'))continue;try{let _0x2604b7=JSON[_0x587cc7(0xa9)](_0x4d76eb['slice'](0x6));if(_0x2604b7['type']===_0x587cc7(0x78)){this['log'](_0x587cc7(0xc7)),this[_0x587cc7(0x72)](_0x587cc7(0x78));continue;}if(_0x2604b7[_0x587cc7(0xb2)]===_0x587cc7(0xc4)||_0x2604b7[_0x587cc7(0xb2)]===_0x587cc7(0x86)||_0x2604b7[_0x587cc7(0xb2)]===_0x587cc7(0xca))await this[_0x587cc7(0xad)]();}catch{}}}}catch(_0x8efa90){if(_0x8efa90['name']===_0x587cc7(0xaf))break;this[_0x587cc7(0x72)](_0x587cc7(0xc1),_0x8efa90),this[_0x587cc7(0x98)](_0x587cc7(0x81)+_0x8efa90[_0x587cc7(0x92)]);}if(this[_0x587cc7(0x7c)])this['emit'](_0x587cc7(0xc2)),this['log'](_0x587cc7(0x9d)+_0x802ef7/0x3e8+_0x587cc7(0xa8)),await this[_0x587cc7(0x88)](_0x802ef7),_0x802ef7=Math['min'](_0x802ef7*1.5,0xea60);}}async[a0_0x58c682(0xad)](){const _0x3701c1=a0_0x58c682;try{let _0x547102=(await this[_0x3701c1(0xbc)](_0x3701c1(0xaa),{'alias':this[_0x3701c1(0xa7)],'limit':0xa}))?.['messages']||[];for(let _0x363ac5 of _0x547102)await this['call'](_0x3701c1(0x9f),{'alias':this[_0x3701c1(0xa7)],'message_id':_0x363ac5['id']}),this[_0x3701c1(0x98)]('←\x20'+_0x363ac5[_0x3701c1(0xab)]+':\x20'+_0x363ac5[_0x3701c1(0xa6)]['slice'](0x0,0x3c)),this[_0x3701c1(0x72)](_0x3701c1(0xb9),_0x363ac5),this[_0x3701c1(0x72)](_0x3701c1(0x92),_0x363ac5);}catch(_0xdb18ea){this['log'](_0x3701c1(0xc3)+_0xdb18ea[_0x3701c1(0x92)]);}}[a0_0x58c682(0x88)](_0x35379d){return new Promise(_0x462af4=>setTimeout(_0x462af4,_0x35379d));}}var $=T;function a0_0x451c(){const _0x2b365d=['SSE\x20failed:\x20','connectSSE','startsWith','error','disconnected','inbox\x20error:\x20','new_task','heartbeatInterval','988702tuNhfE','SSE\x20connected','776NHdAGM','autoConnect','broadcast','completed','emit','disconnect','status','application/json','4sDtmyx','match','connected','body','286GImjBA','server','running','reconnectDelay','split','Bearer\x20','resumeId','SSE\x20error:\x20','1330175KcrtVW','agent','catch',']\x20[commhub:','new_message','/mcp','sleep','result','getReader','offline','3UZRQPh','cwd','now','stringify','slice','abort','message','pop','2.0','idle','POST','1023528DYvcru','log','Authorization','report_status','normal','3479675WSPEle','SSE\x20reconnecting\x20in\x20','2045294EDKRBM','ack_inbox','reply','getAllStatus','registered','token','decode','url','content','alias','s...','parse','get_inbox','from_session','18IVTcyc','processInbox','min','AbortError','10YpBzRK','text','type','signal','application/json,\x20text/event-stream','heartbeatTimer','text/event-stream','sseAbort','382476mPsdmT','task','toString','4761vBfLTf','call','send'];a0_0x451c=function(){return _0x2b365d;};return a0_0x451c();}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_0x4eb00a=a0_0x279e;(function(_0x357d5e,_0x59c0bf){const _0x459576=a0_0x279e,_0xc7ff5b=_0x357d5e();while(!![]){try{const _0x38bb63=-parseInt(_0x459576(0x211))/0x1*(-parseInt(_0x459576(0x1d5))/0x2)+-parseInt(_0x459576(0x21f))/0x3*(-parseInt(_0x459576(0x206))/0x4)+parseInt(_0x459576(0x1dc))/0x5+-parseInt(_0x459576(0x20b))/0x6*(-parseInt(_0x459576(0x21b))/0x7)+parseInt(_0x459576(0x249))/0x8+parseInt(_0x459576(0x1d6))/0x9*(parseInt(_0x459576(0x23d))/0xa)+-parseInt(_0x459576(0x1de))/0xb*(parseInt(_0x459576(0x227))/0xc);if(_0x38bb63===_0x59c0bf)break;else _0xc7ff5b['push'](_0xc7ff5b['shift']());}catch(_0x4b6cc6){_0xc7ff5b['push'](_0xc7ff5b['shift']());}}}(a0_0x441a,0x546d7));import{readFileSync as a0_0x4a338c,existsSync as a0_0x57606d}from'fs';import{randomUUID as a0_0xa73832}from'crypto';import{join as a0_0x1a3ec3}from'path';import{hostname as a0_0x4680fe}from'os';import{execSync as a0_0x4ee0c6}from'child_process';import{Server as a0_0x4ccaff}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x223c8e}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x271a40,CallToolRequestSchema as a0_0x59ccac}from'@modelcontextprotocol/sdk/types.js';function p(_0x190ee8){const _0x86c244=a0_0x279e;if(!a0_0x57606d(_0x190ee8))return;for(let _0x357265 of a0_0x4a338c(_0x190ee8,_0x86c244(0x1ea))[_0x86c244(0x1e0)]('\x0a')){let _0x1ff25b=_0x357265['trim']();if(!_0x1ff25b||_0x1ff25b['startsWith']('#'))continue;let _0x4b9dad=_0x1ff25b[_0x86c244(0x1fa)]('=');if(_0x4b9dad<0x0)continue;let _0x52dbdb=_0x1ff25b[_0x86c244(0x1cd)](0x0,_0x4b9dad)[_0x86c244(0x248)](),_0x4dcc10=_0x1ff25b['slice'](_0x4b9dad+0x1)[_0x86c244(0x248)]()[_0x86c244(0x20c)](/^["']|["']$/g,'');if(!process.env[_0x52dbdb])process.env[_0x52dbdb]=_0x4dcc10;}}var C=process.env.HOME||'~',T=a0_0x1a3ec3(C,'.claude/channels/commhub');p(a0_0x1a3ec3(T,a0_0x4eb00a(0x20d)));var L=process[a0_0x4eb00a(0x21d)]()[a0_0x4eb00a(0x20c)](/\//g,'-');function a0_0x441a(){const _0x3aaaaa=['data:\x20','Reply\x20text\x20/\x20result\x20summary','idle','MCP\x20stdio\x20connected','60ZjoTEz','exit','failed','from','message','stringify','http://127.0.0.1:9200','type','application/json,\x20text/event-stream','POST','\x22\x20(','session\x20disconnected','parse\x20error:\x20','body','tools/call','connecting\x20to\x20','string','SSE\x20stream\x20ended,\x20reconnecting...','then','warning:\x20could\x20not\x20register:\x20','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','toTimeString','110tQBYgG','commhub_reply','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','messages','commhub','application/json','error','none','claude-code','ack_inbox','init\x20failed:\x20','trim','4098312rnQEjj','commhub_send_message','new_task','Session\x20alias:\x20','SIGINT','getReader','get_inbox','SSE\x20fatal:\x20','end','params','connected','normal','task','replied','shutting\x20down,\x20reporting\x20offline...','/events/','object','number','blocked','slice','Message\x20content','\x20ALIAS=','get_all_status','from_session','CommHub\x20init\x20failed:\x20','unknown\x20tool','stderr','2wPmYbO','332964PaTQxi','Bearer\x20','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','set','working','low','2211990qMojSO','catch','4755212BbyKwO','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','split',':\x20inbox_count=','0.3.0','.anet','send_message','commhub_send_task','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','setRequestHandler','token','report_status','utf-8','SSE\x20error:\x20','notifications/claude/channel','ENV:\x20URL=','message_id','hub','\x20from\x20','no\x20response','Priority\x20(default:\x20normal)','starting\x20SSE\x20listener...','commhub_get_all_status','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','/mcp','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Authorization','tmux\x20display-message\x20-p\x20\x27#S\x27','indexOf','commhub-channel','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','status','text','parse','priority','get','config.json','notification','pop','read','268ORjOoO','high','SSE\x20connection\x20error:\x20','send_task','alias','6qFeYNn','replace','.env','completed','find','initialize','551788BtzQPN','connect','commhub_report_status','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','content','\x20RESUME_ID=','fatal:\x20','\x20priority=','\x20PROJECT_ENV=','Task\x20content','278747suGrpW','ready\x20—\x20waiting\x20for\x20events','cwd','stdin','24807iFpziQ','new_message','statusText','2025-03-26'];a0_0x441a=function(){return _0x3aaaaa;};return a0_0x441a();}p(a0_0x1a3ec3(T,L,a0_0x4eb00a(0x20d)));function U(){const _0x4c62bb=a0_0x4eb00a;try{return a0_0x4ee0c6(_0x4c62bb(0x1f9),{'encoding':_0x4c62bb(0x1ea),'timeout':0x7d0})[_0x4c62bb(0x248)]();}catch{return'';}}function v(){const _0x43f7d3=a0_0x4eb00a;try{let _0xc60eb7=a0_0x1a3ec3(C,_0x43f7d3(0x1e3),_0x43f7d3(0x202));if(a0_0x57606d(_0xc60eb7))return JSON['parse'](a0_0x4a338c(_0xc60eb7,_0x43f7d3(0x1ea)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x4eb00a(0x1ef)]||a0_0x4eb00a(0x22d),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x4680fe(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0xa73832(),X=process.env.COMMHUB_TOKEN||H[a0_0x4eb00a(0x1e8)]||'';function Y(_0x517774){const _0x399ada=a0_0x4eb00a;let _0x402d88=new Date()[_0x399ada(0x23c)]()[_0x399ada(0x1cd)](0x0,0x8);process[_0x399ada(0x1d4)]['write']('['+_0x402d88+']\x20[commhub]\x20'+_0x517774+'\x0a');}function h(_0x582e65){return new Promise(_0x3d7f22=>setTimeout(_0x3d7f22,_0x582e65));}Y(a0_0x4eb00a(0x1ed)+f+a0_0x4eb00a(0x1cf)+Z+a0_0x4eb00a(0x216)+w[a0_0x4eb00a(0x1cd)](0x0,0x8)+'...\x20TMUX='+(j||a0_0x4eb00a(0x244))+'\x20CWD='+process[a0_0x4eb00a(0x21d)]()+a0_0x4eb00a(0x219)+L);function a0_0x279e(_0x57859b,_0x41d4df){_0x57859b=_0x57859b-0x1be;const _0x441a7b=a0_0x441a();let _0x279e34=_0x441a7b[_0x57859b];return _0x279e34;}var k=new Map(),K=new a0_0x4ccaff({'name':a0_0x4eb00a(0x1fb),'version':a0_0x4eb00a(0x1e2)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x4eb00a(0x1df),a0_0x4eb00a(0x23f),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x4eb00a(0x214),a0_0x4eb00a(0x24c)+Z]['join']('\x0a')});K[a0_0x4eb00a(0x1e7)](a0_0x271a40,async()=>({'tools':[{'name':a0_0x4eb00a(0x23e),'description':a0_0x4eb00a(0x1e6),'inputSchema':{'type':'object','properties':{'task_id':{'type':'string','description':a0_0x4eb00a(0x1fc)},'text':{'type':a0_0x4eb00a(0x237),'description':a0_0x4eb00a(0x224)},'status':{'type':'string','enum':[a0_0x4eb00a(0x20e),a0_0x4eb00a(0x229),'cancelled',a0_0x4eb00a(0x1cc),a0_0x4eb00a(0x243),'in_progress'],'description':a0_0x4eb00a(0x23b)}},'required':[a0_0x4eb00a(0x1fe)]}},{'name':a0_0x4eb00a(0x213),'description':a0_0x4eb00a(0x1f7),'inputSchema':{'type':a0_0x4eb00a(0x1ca),'properties':{'status':{'type':a0_0x4eb00a(0x237),'enum':[a0_0x4eb00a(0x1da),a0_0x4eb00a(0x225),a0_0x4eb00a(0x1cc),a0_0x4eb00a(0x243)]},'task':{'type':a0_0x4eb00a(0x237),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x4eb00a(0x1cb),'description':'Progress\x200-100'}},'required':[a0_0x4eb00a(0x1fd)]}},{'name':a0_0x4eb00a(0x1e5),'description':a0_0x4eb00a(0x1d8),'inputSchema':{'type':a0_0x4eb00a(0x1ca),'properties':{'alias':{'type':a0_0x4eb00a(0x237),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x4eb00a(0x237),'description':a0_0x4eb00a(0x21a)},'priority':{'type':a0_0x4eb00a(0x237),'enum':[a0_0x4eb00a(0x207),a0_0x4eb00a(0x1c5),a0_0x4eb00a(0x1db)],'description':a0_0x4eb00a(0x1f2)}},'required':[a0_0x4eb00a(0x20a),a0_0x4eb00a(0x1c6)]}},{'name':a0_0x4eb00a(0x24a),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x4eb00a(0x1ca),'properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'message':{'type':a0_0x4eb00a(0x237),'description':a0_0x4eb00a(0x1ce)}},'required':[a0_0x4eb00a(0x20a),a0_0x4eb00a(0x22b)]}},{'name':'commhub_get_all_status','description':a0_0x4eb00a(0x1f5),'inputSchema':{'type':a0_0x4eb00a(0x1ca),'properties':{}}}]}));async function P(_0x1f1142,_0xb413a){const _0x499cf6=a0_0x4eb00a;let _0x1c6604=await fetch(f+_0x499cf6(0x1f6),{'method':_0x499cf6(0x230),'headers':{'Content-Type':_0x499cf6(0x242),'Accept':_0x499cf6(0x22f),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x499cf6(0x22c)]({'jsonrpc':'2.0','id':0x1,'method':_0x499cf6(0x210),'params':{'protocolVersion':_0x499cf6(0x222),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x499cf6(0x1e2)}}})});if(!_0x1c6604['ok']){let _0x1e7aaa=await _0x1c6604[_0x499cf6(0x1fe)]();return Y(_0x499cf6(0x1d2)+_0x1c6604['status']+'\x20'+_0x1e7aaa[_0x499cf6(0x1cd)](0x0,0x64)),{'ok':!0x1,'error':_0x499cf6(0x247)+_0x1c6604[_0x499cf6(0x1fd)]};}await _0x1c6604['text']();let _0x24c976=(await(await fetch(f+_0x499cf6(0x1f6),{'method':_0x499cf6(0x230),'headers':{'Content-Type':_0x499cf6(0x242),'Accept':_0x499cf6(0x22f),...X?{'Authorization':_0x499cf6(0x1d7)+X}:{}},'body':JSON[_0x499cf6(0x22c)]({'jsonrpc':'2.0','id':0x2,'method':_0x499cf6(0x235),'params':{'name':_0x1f1142,'arguments':_0xb413a}})}))[_0x499cf6(0x1fe)]())['split']('\x0a')[_0x499cf6(0x20f)](_0x497bc5=>_0x497bc5['startsWith']('data:\x20'));if(_0x24c976){let _0x34b291=JSON[_0x499cf6(0x1ff)](_0x24c976[_0x499cf6(0x1cd)](0x6));return _0x34b291?.['result']?.['content']?.[0x0]?.[_0x499cf6(0x1fe)]?JSON[_0x499cf6(0x1ff)](_0x34b291['result'][_0x499cf6(0x215)][0x0][_0x499cf6(0x1fe)]):_0x34b291;}return{'ok':!0x1,'error':_0x499cf6(0x1f1)};}K[a0_0x4eb00a(0x1e7)](a0_0x59ccac,async _0x13d469=>{const _0x35a493=a0_0x4eb00a;let {name:_0x320e8d,arguments:_0x1c2fb6}=_0x13d469[_0x35a493(0x1c3)];if(_0x320e8d===_0x35a493(0x23e)){let {task_id:_0x6d3288,text:_0x3698dd,status:_0x1a0513}=_0x1c2fb6;if(_0x1a0513===_0x35a493(0x20e)||_0x1a0513===_0x35a493(0x229)||_0x1a0513==='cancelled'){let _0x46886e=_0x1a0513===_0x35a493(0x20e)?_0x35a493(0x1c7):_0x1a0513,_0x1e0f39=_0x6d3288?k[_0x35a493(0x201)](_0x6d3288)||_0x35a493(0x1ef):_0x35a493(0x1ef),_0x277356=await P('send_reply',{'alias':_0x1e0f39,'text':_0x3698dd,'in_reply_to':_0x6d3288||void 0x0,'status':_0x46886e,'from_session':Z});if(_0x6d3288)k['delete'](_0x6d3288);return{'content':[{'type':'text','text':JSON[_0x35a493(0x22c)](_0x277356)}]};}let _0x4afaa9=await P(_0x35a493(0x1e9),{'resume_id':w,'alias':Z,'status':_0x1a0513===_0x35a493(0x1cc)?_0x35a493(0x1cc):_0x1a0513===_0x35a493(0x243)?_0x35a493(0x243):_0x35a493(0x1da),'task':_0x3698dd[_0x35a493(0x1cd)](0x0,0xc8),'output':_0x3698dd});return{'content':[{'type':_0x35a493(0x1fe),'text':JSON['stringify'](_0x4afaa9)}]};}if(_0x320e8d===_0x35a493(0x213)){let {status:_0x25a14a,task:_0x1c3302,progress:_0x3afcc2}=_0x1c2fb6,_0x222cae=await P(_0x35a493(0x1e9),{'resume_id':w,'alias':Z,'status':_0x25a14a,'task':_0x1c3302,'progress':_0x3afcc2});return{'content':[{'type':_0x35a493(0x1fe),'text':JSON['stringify'](_0x222cae)}]};}if(_0x320e8d===_0x35a493(0x1e5)){let {alias:_0x317caa,task:_0x2f0361,priority:_0x2ab9e6}=_0x1c2fb6,_0x3b4ff6=await P(_0x35a493(0x209),{'alias':_0x317caa,'task':_0x2f0361,'priority':_0x2ab9e6||'normal','from_session':Z});return{'content':[{'type':_0x35a493(0x1fe),'text':JSON[_0x35a493(0x22c)](_0x3b4ff6)}]};}if(_0x320e8d==='commhub_send_message'){let {alias:_0x273751,message:_0x248b97}=_0x1c2fb6,_0x57afcb=await P(_0x35a493(0x1e4),{'alias':_0x273751,'message':_0x248b97,'from_session':Z});return{'content':[{'type':_0x35a493(0x1fe),'text':JSON[_0x35a493(0x22c)](_0x57afcb)}]};}if(_0x320e8d===_0x35a493(0x1f4)){let _0x36ba85=await P(_0x35a493(0x1d0),{});return{'content':[{'type':_0x35a493(0x1fe),'text':JSON[_0x35a493(0x22c)](_0x36ba85)}]};}return{'content':[{'type':_0x35a493(0x1fe),'text':JSON[_0x35a493(0x22c)]({'error':_0x35a493(0x1d3)})}]};});async function u(){const _0x5321a6=a0_0x4eb00a;let _0x114714=f+_0x5321a6(0x1c9)+encodeURIComponent(Z),_0x34695c={};if(X)_0x34695c[_0x5321a6(0x1f8)]='Bearer\x20'+X;Y(_0x5321a6(0x236)+_0x114714);while(!0x0){try{let _0x597c67=await fetch(_0x114714,{'headers':_0x34695c});if(!_0x597c67['ok']){Y(_0x5321a6(0x1eb)+_0x597c67[_0x5321a6(0x1fd)]+'\x20'+_0x597c67[_0x5321a6(0x221)]),await h(0x1388);continue;}let _0xe53878=_0x597c67[_0x5321a6(0x234)][_0x5321a6(0x1bf)](),_0x3e69e7=new TextDecoder(),_0x46b18a='';while(!0x0){let {done:_0x22e39e,value:_0x374b47}=await _0xe53878[_0x5321a6(0x205)]();if(_0x22e39e)break;_0x46b18a+=_0x3e69e7['decode'](_0x374b47,{'stream':!0x0});let _0x47a0a9=_0x46b18a['split']('\x0a\x0a');_0x46b18a=_0x47a0a9[_0x5321a6(0x204)]()||'';for(let _0x20a756 of _0x47a0a9){let _0x4951a0=_0x20a756[_0x5321a6(0x1e0)]('\x0a')['find'](_0x1f1db3=>_0x1f1db3['startsWith'](_0x5321a6(0x223)));if(!_0x4951a0)continue;try{let _0x16d3b2=JSON[_0x5321a6(0x1ff)](_0x4951a0[_0x5321a6(0x1cd)](0x6));await S(_0x16d3b2);}catch(_0x1a37cd){Y(_0x5321a6(0x233)+_0x1a37cd);}}}Y(_0x5321a6(0x238));}catch(_0x199166){Y(_0x5321a6(0x208)+_0x199166);}await h(0xbb8);}}async function S(_0x35b29e){const _0x2c9b0a=a0_0x4eb00a;if(_0x35b29e['type']===_0x2c9b0a(0x1c4)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x35b29e[_0x2c9b0a(0x22e)]===_0x2c9b0a(0x220)){if(Y('←\x20message\x20from\x20'+_0x35b29e[_0x2c9b0a(0x22a)]+':\x20'+_0x35b29e['message'][_0x2c9b0a(0x1cd)](0x0,0x3c)),await K[_0x2c9b0a(0x203)]({'method':_0x2c9b0a(0x1ec),'params':{'content':_0x35b29e[_0x2c9b0a(0x22b)],'meta':{'sender':_0x35b29e[_0x2c9b0a(0x22a)]||_0x2c9b0a(0x1ef),'sender_id':_0x2c9b0a(0x241),'user':_0x35b29e[_0x2c9b0a(0x22a)]||_0x2c9b0a(0x1ef),'priority':_0x2c9b0a(0x1c5)}}}),_0x35b29e[_0x2c9b0a(0x1ee)])await P(_0x2c9b0a(0x246),{'alias':Z,'message_id':_0x35b29e[_0x2c9b0a(0x1ee)]});return;}if(_0x35b29e['type']===_0x2c9b0a(0x24b)||_0x35b29e[_0x2c9b0a(0x22e)]==='broadcast'){Y('←\x20'+_0x35b29e['type']+_0x2c9b0a(0x1e1)+_0x35b29e['inbox_count']+_0x2c9b0a(0x218)+(_0x35b29e[_0x2c9b0a(0x200)]||_0x2c9b0a(0x1c5)));let _0x5459fd=await P(_0x2c9b0a(0x1c0),{'alias':Z,'limit':0x5});if(_0x5459fd?.['ok']&&_0x5459fd[_0x2c9b0a(0x240)]?.['length']>0x0)for(let _0x3d6893 of _0x5459fd[_0x2c9b0a(0x240)]){let _0xcfee30={'sender':_0x3d6893[_0x2c9b0a(0x1d1)]||_0x2c9b0a(0x1ef),'sender_id':_0x2c9b0a(0x241),'user':_0x3d6893['from_session']||_0x2c9b0a(0x1ef),'task_id':_0x3d6893['id'],'priority':_0x3d6893[_0x2c9b0a(0x200)]||_0x2c9b0a(0x1c5)};k[_0x2c9b0a(0x1d9)](_0x3d6893['id'],_0x3d6893[_0x2c9b0a(0x1d1)]||'hub'),await K[_0x2c9b0a(0x203)]({'method':'notifications/claude/channel','params':{'content':_0x3d6893[_0x2c9b0a(0x215)],'meta':_0xcfee30}}),Y('→\x20injected\x20task\x20'+_0x3d6893['id'][_0x2c9b0a(0x1cd)](0x0,0x8)+_0x2c9b0a(0x1f0)+_0x3d6893[_0x2c9b0a(0x1d1)]+':\x20'+_0x3d6893[_0x2c9b0a(0x215)][_0x2c9b0a(0x1cd)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x3d6893['id']});}}}async function A(){const _0x53de57=a0_0x4eb00a;let _0x5853e5=new a0_0x223c8e();await K[_0x53de57(0x212)](_0x5853e5),Y(_0x53de57(0x226)),Y(_0x53de57(0x1f3)),u()[_0x53de57(0x1dd)](_0x3b1e9a=>Y(_0x53de57(0x1c1)+_0x3b1e9a)),P(_0x53de57(0x1e9),{'resume_id':w,'alias':Z,'status':_0x53de57(0x225),'server':a0_0x4680fe(),'hostname':a0_0x4680fe(),'agent':_0x53de57(0x245),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x53de57(0x239)](()=>Y('registered\x20as\x20\x22'+Z+_0x53de57(0x231)+w['slice'](0x0,0x8)+')'))[_0x53de57(0x1dd)](_0x4d5d53=>Y(_0x53de57(0x23a)+_0x4d5d53)),setInterval(()=>{const _0xcb412=_0x53de57;P('report_status',{'resume_id':w,'alias':Z,'status':_0xcb412(0x225),'server':a0_0x4680fe(),'hostname':a0_0x4680fe(),'agent':'claude-code','project_dir':process[_0xcb412(0x21d)](),'tmux_name':j||void 0x0})[_0xcb412(0x1dd)](_0x20b507=>Y('heartbeat\x20failed:\x20'+_0x20b507));},0x2bf20),Y(_0x53de57(0x21c));}A()[a0_0x4eb00a(0x1dd)](_0x1a35c9=>{const _0xae849=a0_0x4eb00a;Y(_0xae849(0x217)+_0x1a35c9),process['exit'](0x1);});async function N(){const _0x23e724=a0_0x4eb00a;Y(_0x23e724(0x1c8)),await P(_0x23e724(0x1e9),{'resume_id':w,'alias':Z,'status':_0x23e724(0x243),'task':_0x23e724(0x232)})[_0x23e724(0x1dd)](()=>{}),process[_0x23e724(0x228)](0x0);}process[a0_0x4eb00a(0x21e)]['on'](a0_0x4eb00a(0x1c2),()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x4eb00a(0x1be),()=>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.0",
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",