@sleep2agi/agent-network 2.2.8 → 2.2.9-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- const a0_0x4f84ce=a0_0x3ccc;(function(_0x5c8a58,_0x435d33){const _0x198e4c=a0_0x3ccc,_0x18eb97=_0x5c8a58();while(!![]){try{const _0x5458ee=parseInt(_0x198e4c(0x198))/0x1*(parseInt(_0x198e4c(0x165))/0x2)+-parseInt(_0x198e4c(0x1a1))/0x3+-parseInt(_0x198e4c(0x162))/0x4+parseInt(_0x198e4c(0x1b4))/0x5*(parseInt(_0x198e4c(0x170))/0x6)+-parseInt(_0x198e4c(0x16b))/0x7*(parseInt(_0x198e4c(0x197))/0x8)+-parseInt(_0x198e4c(0x18d))/0x9+parseInt(_0x198e4c(0x167))/0xa;if(_0x5458ee===_0x435d33)break;else _0x18eb97['push'](_0x18eb97['shift']());}catch(_0x305de1){_0x18eb97['push'](_0x18eb97['shift']());}}}(a0_0x204d,0x91113));import{EventEmitter as a0_0x1e08c0}from'events';import{hostname as a0_0x710d98}from'os';class T extends a0_0x1e08c0{[a0_0x4f84ce(0x190)];[a0_0x4f84ce(0x17c)];[a0_0x4f84ce(0x176)];[a0_0x4f84ce(0x1b6)];[a0_0x4f84ce(0x183)];[a0_0x4f84ce(0x1ab)];[a0_0x4f84ce(0x19a)];[a0_0x4f84ce(0x19e)];[a0_0x4f84ce(0x169)];[a0_0x4f84ce(0x182)]=!0x1;constructor(_0x474e0f){const _0x5c7c67=a0_0x4f84ce;super();if(this[_0x5c7c67(0x190)]=_0x474e0f[_0x5c7c67(0x190)]['replace'](/\/$/,''),this[_0x5c7c67(0x17c)]=_0x474e0f[_0x5c7c67(0x17c)],this[_0x5c7c67(0x176)]=_0x474e0f['token'],this[_0x5c7c67(0x1b6)]=_0x474e0f[_0x5c7c67(0x1b6)]||'sdk',this[_0x5c7c67(0x183)]=_0x5c7c67(0x192)+_0x474e0f[_0x5c7c67(0x17c)]+'-'+Date[_0x5c7c67(0x181)]()[_0x5c7c67(0x1ae)](0x24),this[_0x5c7c67(0x1ab)]=_0x474e0f['heartbeatInterval']??0x2bf20,this[_0x5c7c67(0x19a)]=_0x474e0f[_0x5c7c67(0x19a)]??0xbb8,_0x474e0f['autoConnect']!==!0x1)this[_0x5c7c67(0x1aa)]();}['log'](_0x1d521b){const _0xb56915=a0_0x4f84ce;console[_0xb56915(0x166)]('['+new Date()[_0xb56915(0x1b1)]()[_0xb56915(0x168)](0x0,0x8)+_0xb56915(0x1b0)+this[_0xb56915(0x17c)]+']\x20'+_0x1d521b);}async[a0_0x4f84ce(0x164)](_0x21e6a2,_0x2312a0){const _0x4b9476=a0_0x4f84ce;let _0x3a4c30={'Content-Type':_0x4b9476(0x18c),'Accept':'application/json,\x20text/event-stream'};if(this[_0x4b9476(0x176)])_0x3a4c30[_0x4b9476(0x174)]=_0x4b9476(0x1a4)+this[_0x4b9476(0x176)];let _0x2e544a=await(await fetch(this[_0x4b9476(0x190)]+_0x4b9476(0x1a5),{'method':_0x4b9476(0x177),'headers':_0x3a4c30,'body':JSON[_0x4b9476(0x196)]({'jsonrpc':_0x4b9476(0x1b5),'id':Date[_0x4b9476(0x181)](),'method':'tools/call','params':{'name':_0x21e6a2,'arguments':_0x2312a0}})}))[_0x4b9476(0x16f)](),_0x41a93d=_0x2e544a[_0x4b9476(0x191)](/data: (.+)/),_0x59479e=_0x41a93d?JSON[_0x4b9476(0x16d)](_0x41a93d[0x1]):JSON[_0x4b9476(0x16d)](_0x2e544a),_0x2a2951=_0x59479e?.[_0x4b9476(0x188)]?.[_0x4b9476(0x1ac)]?.[0x0]?.[_0x4b9476(0x16f)];return _0x2a2951?JSON['parse'](_0x2a2951):_0x59479e;}async['connect'](){const _0x350fa8=a0_0x4f84ce;if(this['running'])return;this[_0x350fa8(0x182)]=!0x0,await this[_0x350fa8(0x199)](_0x350fa8(0x1a3)),this['log']('registered'),this[_0x350fa8(0x19e)]=setInterval(()=>{const _0x52f9e0=_0x350fa8;this[_0x52f9e0(0x199)]('idle')[_0x52f9e0(0x18e)](_0x25ef04=>this[_0x52f9e0(0x166)](_0x52f9e0(0x17f)+_0x25ef04[_0x52f9e0(0x19b)]));},this['heartbeatInterval']),this[_0x350fa8(0x1b2)]();}async['disconnect'](){const _0x2f496f=a0_0x4f84ce;if(this['running']=!0x1,this['sseAbort']?.[_0x2f496f(0x195)](),this[_0x2f496f(0x19e)])clearInterval(this[_0x2f496f(0x19e)]);await this[_0x2f496f(0x199)]('offline')[_0x2f496f(0x18e)](()=>{}),this[_0x2f496f(0x166)]('disconnected');}async[a0_0x4f84ce(0x193)](_0x4f5b3f,_0x2af648,_0x15e079='normal'){const _0x2163af=a0_0x4f84ce;return this[_0x2163af(0x164)](_0x2163af(0x184),{'alias':_0x4f5b3f,'task':_0x2af648,'priority':_0x15e079,'from_session':this[_0x2163af(0x17c)]});}async[a0_0x4f84ce(0x19b)](_0x5a59d4,_0x1349d5){const _0x4d607b=a0_0x4f84ce;return this[_0x4d607b(0x164)]('send_message',{'alias':_0x5a59d4,'message':_0x1349d5,'from_session':this[_0x4d607b(0x17c)]});}async[a0_0x4f84ce(0x1a9)](_0x2086e5,_0x4136f4,_0x4da1a5=a0_0x4f84ce(0x1af)){return this['call']('send_reply',{'in_reply_to':_0x2086e5,'text':_0x4136f4,'status':_0x4da1a5});}async[a0_0x4f84ce(0x199)](_0x1df3f2,_0x557eb4){const _0x34118e=a0_0x4f84ce;return this[_0x34118e(0x164)](_0x34118e(0x18a),{'resume_id':this['resumeId'],'alias':this[_0x34118e(0x17c)],'status':_0x1df3f2,'server':a0_0x710d98(),'hostname':a0_0x710d98(),'agent':this[_0x34118e(0x1b6)],'project_dir':process[_0x34118e(0x19c)](),..._0x557eb4});}async[a0_0x4f84ce(0x17e)](){const _0x5e7bb7=a0_0x4f84ce;return this[_0x5e7bb7(0x164)](_0x5e7bb7(0x16c),{});}async[a0_0x4f84ce(0x17d)](_0x50d251,_0x5bf452){const _0x5cd78c=a0_0x4f84ce;return this[_0x5cd78c(0x164)](_0x5cd78c(0x17d),{'message':_0x50d251,'filter_server':_0x5bf452?.['server'],'filter_status':_0x5bf452?.[_0x5cd78c(0x199)]});}async[a0_0x4f84ce(0x1b2)](){const _0x3da8a1=a0_0x4f84ce;let _0x31208b=encodeURIComponent(this[_0x3da8a1(0x17c)]),_0x15d2a5=this[_0x3da8a1(0x190)]+'/events/'+_0x31208b,_0x48de50=this[_0x3da8a1(0x19a)];while(this[_0x3da8a1(0x182)]){try{this[_0x3da8a1(0x169)]=new AbortController();let _0x20607e={'Accept':_0x3da8a1(0x16e)};if(this[_0x3da8a1(0x176)])_0x20607e['Authorization']=_0x3da8a1(0x1a4)+this[_0x3da8a1(0x176)];let _0x200df8=await fetch(_0x15d2a5,{'headers':_0x20607e,'signal':this[_0x3da8a1(0x169)][_0x3da8a1(0x185)]});if(!_0x200df8['ok']||!_0x200df8[_0x3da8a1(0x19f)]){this[_0x3da8a1(0x166)](_0x3da8a1(0x178)+_0x200df8[_0x3da8a1(0x199)]),await this[_0x3da8a1(0x1a6)](_0x48de50),_0x48de50=Math['min'](_0x48de50*1.5,0xea60);continue;}_0x48de50=this[_0x3da8a1(0x19a)];let _0x2154f0=_0x200df8[_0x3da8a1(0x19f)][_0x3da8a1(0x187)](),_0x3c1348=new TextDecoder(),_0x18ac01='';while(this[_0x3da8a1(0x182)]){let {done:_0x890003,value:_0x242d7b}=await _0x2154f0[_0x3da8a1(0x175)]();if(_0x890003)break;_0x18ac01+=_0x3c1348[_0x3da8a1(0x1ad)](_0x242d7b,{'stream':!0x0});let _0x2425e9=_0x18ac01[_0x3da8a1(0x173)]('\x0a');_0x18ac01=_0x2425e9[_0x3da8a1(0x18f)]()||'';for(let _0x1545aa of _0x2425e9){if(!_0x1545aa[_0x3da8a1(0x17a)]('data:\x20'))continue;try{let _0x4cc2b8=JSON[_0x3da8a1(0x16d)](_0x1545aa['slice'](0x6));if(_0x4cc2b8[_0x3da8a1(0x194)]===_0x3da8a1(0x17b)){this[_0x3da8a1(0x166)](_0x3da8a1(0x19d)),this[_0x3da8a1(0x18b)]('connected');continue;}if(_0x4cc2b8[_0x3da8a1(0x194)]==='new_task'||_0x4cc2b8[_0x3da8a1(0x194)]===_0x3da8a1(0x180)||_0x4cc2b8['type']===_0x3da8a1(0x17d))await this['processInbox']();}catch{}}}}catch(_0x1b750a){if(_0x1b750a['name']==='AbortError')break;this[_0x3da8a1(0x18b)](_0x3da8a1(0x172),_0x1b750a),this[_0x3da8a1(0x166)](_0x3da8a1(0x171)+_0x1b750a[_0x3da8a1(0x19b)]);}if(this['running'])this[_0x3da8a1(0x18b)](_0x3da8a1(0x161)),this[_0x3da8a1(0x166)](_0x3da8a1(0x1a8)+_0x48de50/0x3e8+_0x3da8a1(0x163)),await this[_0x3da8a1(0x1a6)](_0x48de50),_0x48de50=Math[_0x3da8a1(0x1a0)](_0x48de50*1.5,0xea60);}}async[a0_0x4f84ce(0x179)](){const _0x35f35b=a0_0x4f84ce;try{let _0x35c67c=(await this[_0x35f35b(0x164)](_0x35f35b(0x1b3),{'alias':this['alias'],'limit':0xa}))?.[_0x35f35b(0x1a7)]||[];for(let _0x3fb202 of _0x35c67c)await this['call'](_0x35f35b(0x1a2),{'alias':this[_0x35f35b(0x17c)],'message_id':_0x3fb202['id']}),this[_0x35f35b(0x166)]('←\x20'+_0x3fb202[_0x35f35b(0x189)]+':\x20'+_0x3fb202[_0x35f35b(0x1ac)][_0x35f35b(0x168)](0x0,0x3c)),this[_0x35f35b(0x18b)](_0x35f35b(0x186),_0x3fb202),this[_0x35f35b(0x18b)](_0x35f35b(0x19b),_0x3fb202);}catch(_0x4a8952){this['log'](_0x35f35b(0x16a)+_0x4a8952[_0x35f35b(0x19b)]);}}['sleep'](_0x504db0){return new Promise(_0x51af75=>setTimeout(_0x51af75,_0x504db0));}}var $=T;function a0_0x3ccc(_0x285656,_0x3272f6){_0x285656=_0x285656-0x161;const _0x204d7e=a0_0x204d();let _0x3ccc51=_0x204d7e[_0x285656];return _0x3ccc51;}function a0_0x204d(){const _0x173447=['reconnectDelay','message','cwd','SSE\x20connected','heartbeatTimer','body','min','3055989izmwdL','ack_inbox','idle','Bearer\x20','/mcp','sleep','messages','SSE\x20reconnecting\x20in\x20','reply','connect','heartbeatInterval','content','decode','toString','completed',']\x20[commhub:','toTimeString','connectSSE','get_inbox','25NlUckt','2.0','agent','disconnected','796056YbQAcc','s...','call','58dkuiir','log','23816670gygHdW','slice','sseAbort','inbox\x20error:\x20','172550eAzOGe','get_all_status','parse','text/event-stream','text','622176JmgNyT','SSE\x20error:\x20','error','split','Authorization','read','token','POST','SSE\x20failed:\x20','processInbox','startsWith','connected','alias','broadcast','getAllStatus','heartbeat\x20failed:\x20','new_message','now','running','resumeId','send_task','signal','task','getReader','result','from_session','report_status','emit','application/json','8326089ZZaMdS','catch','pop','url','match','sdk-','send','type','abort','stringify','208GpqTuG','16474uCgQya','status'];a0_0x204d=function(){return _0x173447;};return a0_0x204d();}export{$ as default,T as CommHub};
1
+ function a0_0x58ea(_0x4d01a9,_0x19598b){_0x4d01a9=_0x4d01a9-0xa7;const _0x296a94=a0_0x296a();let _0x58ea18=_0x296a94[_0x4d01a9];return _0x58ea18;}const a0_0x3d4157=a0_0x58ea;(function(_0x535690,_0x5568b5){const _0x323759=a0_0x58ea,_0xbc4cc3=_0x535690();while(!![]){try{const _0x3eb9d9=parseInt(_0x323759(0xb4))/0x1*(parseInt(_0x323759(0xca))/0x2)+parseInt(_0x323759(0xe4))/0x3+parseInt(_0x323759(0xe0))/0x4+-parseInt(_0x323759(0xde))/0x5*(parseInt(_0x323759(0xf5))/0x6)+parseInt(_0x323759(0xbe))/0x7+-parseInt(_0x323759(0xab))/0x8*(-parseInt(_0x323759(0xcb))/0x9)+-parseInt(_0x323759(0xf9))/0xa*(parseInt(_0x323759(0xeb))/0xb);if(_0x3eb9d9===_0x5568b5)break;else _0xbc4cc3['push'](_0xbc4cc3['shift']());}catch(_0x3fb39a){_0xbc4cc3['push'](_0xbc4cc3['shift']());}}}(a0_0x296a,0x8363d));import{EventEmitter as a0_0x4c8c32}from'events';import{hostname as a0_0x524b04}from'os';class T extends a0_0x4c8c32{['url'];[a0_0x3d4157(0xfd)];[a0_0x3d4157(0xd9)];[a0_0x3d4157(0xdd)];[a0_0x3d4157(0xb1)];[a0_0x3d4157(0xc1)];[a0_0x3d4157(0xb9)];[a0_0x3d4157(0xf6)];[a0_0x3d4157(0xe8)];[a0_0x3d4157(0xec)]=!0x1;constructor(_0x610d66){const _0x4e6156=a0_0x3d4157;super();if(this['url']=_0x610d66[_0x4e6156(0xcc)]['replace'](/\/$/,''),this[_0x4e6156(0xfd)]=_0x610d66[_0x4e6156(0xfd)],this[_0x4e6156(0xd9)]=_0x610d66[_0x4e6156(0xd9)],this[_0x4e6156(0xdd)]=_0x610d66[_0x4e6156(0xdd)]||_0x4e6156(0xed),this[_0x4e6156(0xb1)]=_0x4e6156(0xa9)+_0x610d66['alias']+'-'+Date[_0x4e6156(0xb5)]()[_0x4e6156(0xdc)](0x24),this['heartbeatInterval']=_0x610d66[_0x4e6156(0xc1)]??0x2bf20,this[_0x4e6156(0xb9)]=_0x610d66[_0x4e6156(0xb9)]??0xbb8,_0x610d66[_0x4e6156(0xad)]!==!0x1)this[_0x4e6156(0xf8)]();}[a0_0x3d4157(0xfa)](_0x1185aa){const _0x5d535f=a0_0x3d4157;console[_0x5d535f(0xfa)]('['+new Date()[_0x5d535f(0xb0)]()[_0x5d535f(0xd7)](0x0,0x8)+_0x5d535f(0xa7)+this[_0x5d535f(0xfd)]+']\x20'+_0x1185aa);}async[a0_0x3d4157(0xd1)](_0x7cc606,_0x24d820){const _0x3dda0b=a0_0x3d4157;let _0x5e4a0e={'Content-Type':_0x3dda0b(0xd0),'Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x5e4a0e[_0x3dda0b(0xaf)]=_0x3dda0b(0xea)+this[_0x3dda0b(0xd9)];let _0x4a59cd=await(await fetch(this[_0x3dda0b(0xcc)]+_0x3dda0b(0xdf),{'method':'POST','headers':_0x5e4a0e,'body':JSON[_0x3dda0b(0xc5)]({'jsonrpc':_0x3dda0b(0xcd),'id':Date[_0x3dda0b(0xb5)](),'method':_0x3dda0b(0xd2),'params':{'name':_0x7cc606,'arguments':_0x24d820}})}))['text'](),_0x2843c4=_0x4a59cd[_0x3dda0b(0xef)](/data: (.+)/),_0x235c92=_0x2843c4?JSON[_0x3dda0b(0xc3)](_0x2843c4[0x1]):JSON[_0x3dda0b(0xc3)](_0x4a59cd),_0x5ac46b=_0x235c92?.[_0x3dda0b(0xfe)]?.[_0x3dda0b(0xb2)]?.[0x0]?.['text'];return _0x5ac46b?JSON[_0x3dda0b(0xc3)](_0x5ac46b):_0x235c92;}async[a0_0x3d4157(0xf8)](){const _0x18a2ef=a0_0x3d4157;if(this[_0x18a2ef(0xec)])return;this[_0x18a2ef(0xec)]=!0x0,await this[_0x18a2ef(0xe7)]('idle'),this[_0x18a2ef(0xfa)]('registered'),this[_0x18a2ef(0xf6)]=setInterval(()=>{const _0x3ba350=_0x18a2ef;this[_0x3ba350(0xe7)](_0x3ba350(0xbb))[_0x3ba350(0xf0)](_0x5947a8=>this[_0x3ba350(0xfa)](_0x3ba350(0xce)+_0x5947a8[_0x3ba350(0xe2)]));},this[_0x18a2ef(0xc1)]),this[_0x18a2ef(0xe6)]();}async[a0_0x3d4157(0xe3)](){const _0x1cfae7=a0_0x3d4157;if(this[_0x1cfae7(0xec)]=!0x1,this[_0x1cfae7(0xe8)]?.[_0x1cfae7(0xaa)](),this[_0x1cfae7(0xf6)])clearInterval(this[_0x1cfae7(0xf6)]);await this[_0x1cfae7(0xe7)]('offline')[_0x1cfae7(0xf0)](()=>{}),this[_0x1cfae7(0xfa)](_0x1cfae7(0xff));}async[a0_0x3d4157(0xc4)](_0x57558a,_0x4883cd,_0x541075=a0_0x3d4157(0xc7)){const _0x4c58db=a0_0x3d4157;return this[_0x4c58db(0xd1)](_0x4c58db(0xd4),{'alias':_0x57558a,'task':_0x4883cd,'priority':_0x541075,'from_session':this[_0x4c58db(0xfd)]});}async[a0_0x3d4157(0xe2)](_0x22af40,_0x21018c){const _0x22d63d=a0_0x3d4157;return this[_0x22d63d(0xd1)]('send_message',{'alias':_0x22af40,'message':_0x21018c,'from_session':this[_0x22d63d(0xfd)]});}async[a0_0x3d4157(0xee)](_0x6fa748,_0x18ce3a,_0x3c6402=a0_0x3d4157(0xdb)){const _0x155a2b=a0_0x3d4157;return this[_0x155a2b(0xd1)]('send_reply',{'in_reply_to':_0x6fa748,'text':_0x18ce3a,'status':_0x3c6402});}async['status'](_0xafe204,_0x3f302a){const _0x37b00f=a0_0x3d4157;return this[_0x37b00f(0xd1)](_0x37b00f(0xb6),{'resume_id':this[_0x37b00f(0xb1)],'alias':this['alias'],'status':_0xafe204,'server':a0_0x524b04(),'hostname':a0_0x524b04(),'agent':this[_0x37b00f(0xdd)],'project_dir':process['cwd'](),..._0x3f302a});}async[a0_0x3d4157(0xf3)](){const _0x26f7c4=a0_0x3d4157;return this[_0x26f7c4(0xd1)](_0x26f7c4(0xcf),{});}async[a0_0x3d4157(0xae)](_0x2b5fc3,_0x5b72f2){const _0x436024=a0_0x3d4157;return this[_0x436024(0xd1)](_0x436024(0xae),{'message':_0x2b5fc3,'filter_server':_0x5b72f2?.[_0x436024(0xbd)],'filter_status':_0x5b72f2?.[_0x436024(0xe7)]});}async[a0_0x3d4157(0xe6)](){const _0x16ae58=a0_0x3d4157;let _0x3f835b=encodeURIComponent(this[_0x16ae58(0xfd)]),_0x2f2ee6=this[_0x16ae58(0xcc)]+'/events/'+_0x3f835b,_0x310d3d=this[_0x16ae58(0xb9)];while(this[_0x16ae58(0xec)]){try{this[_0x16ae58(0xe8)]=new AbortController();let _0x16b681={'Accept':_0x16ae58(0xd8)};if(this[_0x16ae58(0xd9)])_0x16b681['Authorization']='Bearer\x20'+this[_0x16ae58(0xd9)];let _0x25fc12=await fetch(_0x2f2ee6,{'headers':_0x16b681,'signal':this[_0x16ae58(0xe8)][_0x16ae58(0xba)]});if(!_0x25fc12['ok']||!_0x25fc12['body']){this['log'](_0x16ae58(0xac)+_0x25fc12[_0x16ae58(0xe7)]),await this['sleep'](_0x310d3d),_0x310d3d=Math[_0x16ae58(0xd5)](_0x310d3d*1.5,0xea60);continue;}_0x310d3d=this[_0x16ae58(0xb9)];let _0x27c2ce=_0x25fc12[_0x16ae58(0xe9)]['getReader'](),_0x6d11b8=new TextDecoder(),_0x4f8219='';while(this[_0x16ae58(0xec)]){let {done:_0x4e1023,value:_0x554ced}=await _0x27c2ce[_0x16ae58(0xf1)]();if(_0x4e1023)break;_0x4f8219+=_0x6d11b8[_0x16ae58(0xb7)](_0x554ced,{'stream':!0x0});let _0x2effdf=_0x4f8219[_0x16ae58(0xc0)]('\x0a');_0x4f8219=_0x2effdf[_0x16ae58(0xc8)]()||'';for(let _0xd997d of _0x2effdf){if(!_0xd997d[_0x16ae58(0xb8)](_0x16ae58(0xda)))continue;try{let _0x43908f=JSON['parse'](_0xd997d['slice'](0x6));if(_0x43908f[_0x16ae58(0xc9)]==='connected'){this[_0x16ae58(0xfa)](_0x16ae58(0xfb)),this['emit'](_0x16ae58(0xe1));continue;}if(_0x43908f[_0x16ae58(0xc9)]===_0x16ae58(0xbc)||_0x43908f[_0x16ae58(0xc9)]==='new_message'||_0x43908f[_0x16ae58(0xc9)]===_0x16ae58(0xae))await this[_0x16ae58(0xf2)]();}catch{}}}}catch(_0x52a05e){if(_0x52a05e[_0x16ae58(0xd6)]===_0x16ae58(0xbf))break;this[_0x16ae58(0xd3)](_0x16ae58(0xa8),_0x52a05e),this[_0x16ae58(0xfa)](_0x16ae58(0xc2)+_0x52a05e[_0x16ae58(0xe2)]);}if(this['running'])this[_0x16ae58(0xd3)]('disconnected'),this[_0x16ae58(0xfa)]('SSE\x20reconnecting\x20in\x20'+_0x310d3d/0x3e8+'s...'),await this[_0x16ae58(0xb3)](_0x310d3d),_0x310d3d=Math[_0x16ae58(0xd5)](_0x310d3d*1.5,0xea60);}}async[a0_0x3d4157(0xf2)](){const _0x558b07=a0_0x3d4157;try{let _0x5c84a9=(await this['call'](_0x558b07(0xf4),{'alias':this[_0x558b07(0xfd)],'limit':0xa}))?.['messages']||[];for(let _0x2352cf of _0x5c84a9)await this[_0x558b07(0xd1)](_0x558b07(0xfc),{'alias':this[_0x558b07(0xfd)],'message_id':_0x2352cf['id']}),this[_0x558b07(0xfa)]('←\x20'+_0x2352cf[_0x558b07(0xc6)]+':\x20'+_0x2352cf['content'][_0x558b07(0xd7)](0x0,0x3c)),this[_0x558b07(0xd3)](_0x558b07(0xf7),_0x2352cf),this[_0x558b07(0xd3)](_0x558b07(0xe2),_0x2352cf);}catch(_0x150b8f){this[_0x558b07(0xfa)](_0x558b07(0xe5)+_0x150b8f[_0x558b07(0xe2)]);}}[a0_0x3d4157(0xb3)](_0x28dbc2){return new Promise(_0x4617e7=>setTimeout(_0x4617e7,_0x28dbc2));}}function a0_0x296a(){const _0x462c47=['reply','match','catch','read','processInbox','getAllStatus','get_inbox','717258SjlBJi','heartbeatTimer','task','connect','155530UGaXoc','log','SSE\x20connected','ack_inbox','alias','result','disconnected',']\x20[commhub:','error','sdk-','abort','3864008ltVmYI','SSE\x20failed:\x20','autoConnect','broadcast','Authorization','toTimeString','resumeId','content','sleep','9EfANpU','now','report_status','decode','startsWith','reconnectDelay','signal','idle','new_task','server','5522832kHVvqR','AbortError','split','heartbeatInterval','SSE\x20error:\x20','parse','send','stringify','from_session','normal','pop','type','76226KKFred','9gvWWkM','url','2.0','heartbeat\x20failed:\x20','get_all_status','application/json','call','tools/call','emit','send_task','min','name','slice','text/event-stream','token','data:\x20','completed','toString','agent','10tDdRCU','/mcp','3157184gFfPMI','connected','message','disconnect','1137918vpNYJM','inbox\x20error:\x20','connectSSE','status','sseAbort','body','Bearer\x20','1419DdRdaT','running','sdk'];a0_0x296a=function(){return _0x462c47;};return a0_0x296a();}var $=T;export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x4e5b9b=a0_0x44b6;(function(_0x178274,_0x4af529){const _0x27ac52=a0_0x44b6,_0x116800=_0x178274();while(!![]){try{const _0x282743=-parseInt(_0x27ac52(0x219))/0x1*(-parseInt(_0x27ac52(0x1e8))/0x2)+parseInt(_0x27ac52(0x20f))/0x3*(-parseInt(_0x27ac52(0x1dc))/0x4)+parseInt(_0x27ac52(0x1cf))/0x5*(-parseInt(_0x27ac52(0x1f2))/0x6)+-parseInt(_0x27ac52(0x21b))/0x7*(-parseInt(_0x27ac52(0x208))/0x8)+-parseInt(_0x27ac52(0x1dd))/0x9*(parseInt(_0x27ac52(0x26a))/0xa)+-parseInt(_0x27ac52(0x256))/0xb+-parseInt(_0x27ac52(0x24e))/0xc*(-parseInt(_0x27ac52(0x245))/0xd);if(_0x282743===_0x4af529)break;else _0x116800['push'](_0x116800['shift']());}catch(_0x438bce){_0x116800['push'](_0x116800['shift']());}}}(a0_0x4610,0xd7149));import{readFileSync as a0_0x3780b2,existsSync as a0_0x4630bf}from'fs';import{randomUUID as a0_0x2a66ba}from'crypto';import{join as a0_0x5d4dab}from'path';import{hostname as a0_0x2b25b4}from'os';import{execSync as a0_0x3b8f3c}from'child_process';import{Server as a0_0x500049}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x394e6c}from'@modelcontextprotocol/sdk/server/stdio.js';function a0_0x44b6(_0x97c757,_0x2a1196){_0x97c757=_0x97c757-0x1ce;const _0x461032=a0_0x4610();let _0x44b698=_0x461032[_0x97c757];return _0x44b698;}import{ListToolsRequestSchema as a0_0x1558fa,CallToolRequestSchema as a0_0x2f3eba}from'@modelcontextprotocol/sdk/types.js';function p(_0x4e64ef){const _0x49769f=a0_0x44b6;if(!a0_0x4630bf(_0x4e64ef))return;for(let _0xb37586 of a0_0x3780b2(_0x4e64ef,'utf-8')['split']('\x0a')){let _0x153414=_0xb37586[_0x49769f(0x1ea)]();if(!_0x153414||_0x153414['startsWith']('#'))continue;let _0x124f19=_0x153414[_0x49769f(0x238)]('=');if(_0x124f19<0x0)continue;let _0x491b48=_0x153414[_0x49769f(0x248)](0x0,_0x124f19)[_0x49769f(0x1ea)](),_0x4ca722=_0x153414[_0x49769f(0x248)](_0x124f19+0x1)['trim']()[_0x49769f(0x255)](/^["']|["']$/g,'');if(!process.env[_0x491b48])process.env[_0x491b48]=_0x4ca722;}}var T=process.env.HOME||'~',C=a0_0x5d4dab(T,a0_0x4e5b9b(0x264));p(a0_0x5d4dab(C,'.env'));var L=process['cwd']()[a0_0x4e5b9b(0x255)](/\//g,'-');p(a0_0x5d4dab(C,L,a0_0x4e5b9b(0x1f5)));function U(){const _0x5c183e=a0_0x4e5b9b;try{return a0_0x3b8f3c(_0x5c183e(0x216),{'encoding':'utf-8','timeout':0x7d0})['trim']();}catch{return'';}}function c(){const _0x526158=a0_0x4e5b9b;try{let _0x555cdb=a0_0x5d4dab(T,_0x526158(0x1e5),_0x526158(0x1fc));if(a0_0x4630bf(_0x555cdb))return JSON['parse'](a0_0x3780b2(_0x555cdb,'utf-8'));}catch{}return{};}var I=c(),f=process.env.COMMHUB_URL||I[a0_0x4e5b9b(0x246)]||'http://127.0.0.1:9200',x=process.env.COMMHUB_TMUX||U(),G=process.env.COMMHUB_ALIAS||x||a0_0x2b25b4(),X=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x2a66ba(),F=process.env.COMMHUB_TOKEN||I[a0_0x4e5b9b(0x22e)]||'';function Z(_0x476796){const _0x81e3e=a0_0x4e5b9b;let _0x55ba8b=new Date()[_0x81e3e(0x250)]()['slice'](0x0,0x8);process[_0x81e3e(0x224)][_0x81e3e(0x1d3)]('['+_0x55ba8b+']\x20[commhub]\x20'+_0x476796+'\x0a');}function O(_0x2ff118){return new Promise(_0x19067f=>setTimeout(_0x19067f,_0x2ff118));}Z(a0_0x4e5b9b(0x266)+f+a0_0x4e5b9b(0x237)+G+a0_0x4e5b9b(0x225)+X[a0_0x4e5b9b(0x248)](0x0,0x8)+a0_0x4e5b9b(0x241)+(x||a0_0x4e5b9b(0x211))+a0_0x4e5b9b(0x230)+process[a0_0x4e5b9b(0x24d)]()+a0_0x4e5b9b(0x267)+L);var N=new Map(),y=new a0_0x500049({'name':'commhub-channel','version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x4e5b9b(0x1fd),a0_0x4e5b9b(0x253),a0_0x4e5b9b(0x1d6),a0_0x4e5b9b(0x1e3),a0_0x4e5b9b(0x269)+G][a0_0x4e5b9b(0x254)]('\x0a')});y['setRequestHandler'](a0_0x1558fa,async()=>({'tools':[{'name':a0_0x4e5b9b(0x26c),'description':a0_0x4e5b9b(0x26e),'inputSchema':{'type':a0_0x4e5b9b(0x261),'properties':{'task_id':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x1db)},'text':{'type':'string','description':a0_0x4e5b9b(0x1da)},'status':{'type':a0_0x4e5b9b(0x1e2),'enum':['completed',a0_0x4e5b9b(0x1ff),a0_0x4e5b9b(0x23d),a0_0x4e5b9b(0x243),'error','in_progress'],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x4e5b9b(0x1f0)]}},{'name':'commhub_report_status','description':a0_0x4e5b9b(0x23e),'inputSchema':{'type':a0_0x4e5b9b(0x261),'properties':{'status':{'type':a0_0x4e5b9b(0x1e2),'enum':[a0_0x4e5b9b(0x21e),'idle',a0_0x4e5b9b(0x243),a0_0x4e5b9b(0x249)]},'task':{'type':a0_0x4e5b9b(0x1e2),'description':'Current\x20task\x20description'},'progress':{'type':'number','description':a0_0x4e5b9b(0x26b)}},'required':[a0_0x4e5b9b(0x262)]}},{'name':a0_0x4e5b9b(0x252),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x4e5b9b(0x261),'properties':{'alias':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x209)},'task':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x259)},'priority':{'type':'string','enum':['high',a0_0x4e5b9b(0x232),a0_0x4e5b9b(0x1d4)],'description':'Priority\x20(default:\x20normal)'},'parent_task_id':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x240)},'ttl_seconds':{'type':'number','description':a0_0x4e5b9b(0x1d8)},'context':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x1ed)},'meta':{'type':'object','description':a0_0x4e5b9b(0x1ce)}},'required':[a0_0x4e5b9b(0x25b),a0_0x4e5b9b(0x22b)]}},{'name':'commhub_send_message','description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x4e5b9b(0x261),'properties':{'alias':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x209)},'message':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x25a)}},'required':[a0_0x4e5b9b(0x25b),a0_0x4e5b9b(0x244)]}},{'name':a0_0x4e5b9b(0x1f8),'description':a0_0x4e5b9b(0x1f4),'inputSchema':{'type':a0_0x4e5b9b(0x261),'properties':{}}},{'name':a0_0x4e5b9b(0x1e9),'description':a0_0x4e5b9b(0x1eb),'inputSchema':{'type':a0_0x4e5b9b(0x261),'properties':{'alias':{'type':a0_0x4e5b9b(0x1e2),'description':'Session\x20alias'}},'required':[a0_0x4e5b9b(0x25b)]}},{'name':a0_0x4e5b9b(0x1d5),'description':'Get\x20task\x20details\x20by\x20task_id.\x20Poll\x20this\x20until\x20status\x20is\x20replied\x20or\x20failed.','inputSchema':{'type':'object','properties':{'task_id':{'type':'string','description':a0_0x4e5b9b(0x25f)}},'required':['task_id']}},{'name':a0_0x4e5b9b(0x1f7),'description':a0_0x4e5b9b(0x202),'inputSchema':{'type':'object','properties':{'to_name':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x1ec)},'from_name':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x24a)},'status':{'type':a0_0x4e5b9b(0x1e2),'description':a0_0x4e5b9b(0x24b)},'limit':{'type':a0_0x4e5b9b(0x1fb),'description':a0_0x4e5b9b(0x1e4)}}}}]}));async function P(_0x2c178f,_0x3a43b7){const _0x34add9=a0_0x4e5b9b;let _0xea864b=await fetch(f+_0x34add9(0x1d9),{'method':_0x34add9(0x207),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...F?{'Authorization':'Bearer\x20'+F}:{}},'body':JSON[_0x34add9(0x25e)]({'jsonrpc':_0x34add9(0x22d),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x34add9(0x222),'capabilities':{},'clientInfo':{'name':_0x34add9(0x1fe),'version':_0x34add9(0x1fa)}}})});if(!_0xea864b['ok']){let _0x2692f1=await _0xea864b[_0x34add9(0x1f0)]();return Z('CommHub\x20init\x20failed:\x20'+_0xea864b[_0x34add9(0x262)]+'\x20'+_0x2692f1[_0x34add9(0x248)](0x0,0x64)),{'ok':!0x1,'error':_0x34add9(0x22c)+_0xea864b[_0x34add9(0x262)]};}await _0xea864b[_0x34add9(0x1f0)]();let _0x16bba8=(await(await fetch(f+'/mcp',{'method':_0x34add9(0x207),'headers':{'Content-Type':'application/json','Accept':_0x34add9(0x214),...F?{'Authorization':_0x34add9(0x20c)+F}:{}},'body':JSON[_0x34add9(0x25e)]({'jsonrpc':_0x34add9(0x22d),'id':0x2,'method':_0x34add9(0x235),'params':{'name':_0x2c178f,'arguments':_0x3a43b7}})}))[_0x34add9(0x1f0)]())[_0x34add9(0x226)]('\x0a')[_0x34add9(0x1de)](_0x2efc08=>_0x2efc08[_0x34add9(0x220)](_0x34add9(0x218)));if(_0x16bba8){let _0x377bcb=JSON[_0x34add9(0x21a)](_0x16bba8[_0x34add9(0x248)](0x6));return _0x377bcb?.[_0x34add9(0x1f6)]?.['content']?.[0x0]?.['text']?JSON[_0x34add9(0x21a)](_0x377bcb[_0x34add9(0x1f6)][_0x34add9(0x233)][0x0][_0x34add9(0x1f0)]):_0x377bcb;}return{'ok':!0x1,'error':_0x34add9(0x1f9)};}y[a0_0x4e5b9b(0x22f)](a0_0x2f3eba,async _0x5514c7=>{const _0x238543=a0_0x4e5b9b;let {name:_0x1815b5,arguments:_0xa4d5fb}=_0x5514c7['params'];if(_0x1815b5===_0x238543(0x26c)){let {task_id:_0x2b50c4,text:_0x283f0a,status:_0x5863dc}=_0xa4d5fb;if(_0x5863dc===_0x238543(0x20d)||_0x5863dc===_0x238543(0x1ff)||_0x5863dc===_0x238543(0x23d)){let _0x312d7e=_0x5863dc==='completed'?_0x238543(0x210):_0x5863dc,_0x41d1dc=_0x2b50c4?N[_0x238543(0x229)](_0x2b50c4)||_0x238543(0x246):_0x238543(0x246),_0x89bb2d=await P(_0x238543(0x20e),{'alias':_0x41d1dc,'text':_0x283f0a,'in_reply_to':_0x2b50c4||void 0x0,'status':_0x312d7e,'from_session':G});if(_0x2b50c4)N[_0x238543(0x23c)](_0x2b50c4);return{'content':[{'type':'text','text':JSON['stringify'](_0x89bb2d)}]};}let _0x4293cf=await P(_0x238543(0x204),{'resume_id':X,'alias':G,'status':_0x5863dc===_0x238543(0x243)?_0x238543(0x243):_0x5863dc===_0x238543(0x249)?_0x238543(0x249):'working','task':_0x283f0a[_0x238543(0x248)](0x0,0xc8),'output':_0x283f0a});return{'content':[{'type':_0x238543(0x1f0),'text':JSON['stringify'](_0x4293cf)}]};}if(_0x1815b5===_0x238543(0x265)){let {status:_0x5738f0,task:_0x50952c,progress:_0x1ced98}=_0xa4d5fb,_0x5ef014=await P(_0x238543(0x204),{'resume_id':X,'alias':G,'status':_0x5738f0,'task':_0x50952c,'progress':_0x1ced98});return{'content':[{'type':_0x238543(0x1f0),'text':JSON[_0x238543(0x25e)](_0x5ef014)}]};}if(_0x1815b5==='commhub_send_task'){let {alias:_0x587271,task:_0x1f4639,priority:_0x55b462,parent_task_id:_0x3692ae,ttl_seconds:_0xe32cfa,context:_0x206677,meta:_0x2a6cb8}=_0xa4d5fb,_0x4edf02=await P(_0x238543(0x206),{'alias':_0x587271,'task':_0x1f4639,'priority':_0x55b462||_0x238543(0x232),'parent_task_id':_0x3692ae,'ttl_seconds':_0xe32cfa,'context':_0x206677,'meta':_0x2a6cb8,'from_session':G});return{'content':[{'type':_0x238543(0x1f0),'text':JSON[_0x238543(0x25e)](_0x4edf02)}]};}if(_0x1815b5===_0x238543(0x21f)){let {alias:_0x5717f7,message:_0x361450}=_0xa4d5fb,_0x561e4b=await P('send_message',{'alias':_0x5717f7,'message':_0x361450,'from_session':G});return{'content':[{'type':_0x238543(0x1f0),'text':JSON[_0x238543(0x25e)](_0x561e4b)}]};}if(_0x1815b5===_0x238543(0x1f8)){let _0x2c1b9e=await P(_0x238543(0x231),{});return{'content':[{'type':'text','text':JSON[_0x238543(0x25e)](_0x2c1b9e)}]};}if(_0x1815b5===_0x238543(0x1e9)){let {alias:_0x1875e7}=_0xa4d5fb,_0x31e407=await P(_0x238543(0x221),{'alias':_0x1875e7});return{'content':[{'type':_0x238543(0x1f0),'text':JSON['stringify'](_0x31e407)}]};}if(_0x1815b5===_0x238543(0x1d5)){let {task_id:_0x5d7d4c}=_0xa4d5fb,_0x3b53cf=await P(_0x238543(0x234),{'task_id':_0x5d7d4c});return{'content':[{'type':_0x238543(0x1f0),'text':JSON[_0x238543(0x25e)](_0x3b53cf)}]};}if(_0x1815b5===_0x238543(0x1f7)){let {to_name:_0x4052dd,from_name:_0x2924cd,status:_0x2e5b10,limit:_0x14fe7a}=_0xa4d5fb,_0x12e6e0=await P(_0x238543(0x203),{'to_name':_0x4052dd,'from_name':_0x2924cd,'status':_0x2e5b10,'limit':_0x14fe7a});return{'content':[{'type':_0x238543(0x1f0),'text':JSON[_0x238543(0x25e)](_0x12e6e0)}]};}return{'content':[{'type':_0x238543(0x1f0),'text':JSON['stringify']({'error':_0x238543(0x258)})}]};});async function S(){const _0x5ef33c=a0_0x4e5b9b;let _0x2c50b3=f+'/events/'+encodeURIComponent(G),_0x10c076={};if(F)_0x10c076[_0x5ef33c(0x1df)]=_0x5ef33c(0x20c)+F;Z(_0x5ef33c(0x23b)+_0x2c50b3);while(!0x0){try{let _0x239f2c=await fetch(_0x2c50b3,{'headers':_0x10c076});if(!_0x239f2c['ok']){Z('SSE\x20error:\x20'+_0x239f2c[_0x5ef33c(0x262)]+'\x20'+_0x239f2c['statusText']),await O(0x1388);continue;}let _0x35ce96=_0x239f2c[_0x5ef33c(0x1ef)][_0x5ef33c(0x1d2)](),_0x50196f=new TextDecoder(),_0x23d922='';while(!0x0){let {done:_0x160b82,value:_0x498a9c}=await _0x35ce96[_0x5ef33c(0x236)]();if(_0x160b82)break;_0x23d922+=_0x50196f[_0x5ef33c(0x213)](_0x498a9c,{'stream':!0x0});let _0x153ae4=_0x23d922[_0x5ef33c(0x226)]('\x0a\x0a');_0x23d922=_0x153ae4['pop']()||'';for(let _0xd95c65 of _0x153ae4){let _0x3ff8ce=_0xd95c65[_0x5ef33c(0x226)]('\x0a')[_0x5ef33c(0x1de)](_0x1db378=>_0x1db378['startsWith'](_0x5ef33c(0x218)));if(!_0x3ff8ce)continue;try{let _0x2263ee=JSON[_0x5ef33c(0x21a)](_0x3ff8ce[_0x5ef33c(0x248)](0x6));await A(_0x2263ee);}catch(_0x1f9169){Z(_0x5ef33c(0x242)+_0x1f9169);}}}Z('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x4b96eb){Z(_0x5ef33c(0x25c)+_0x4b96eb);}await O(0xbb8);}}async function A(_0x5e1a90){const _0x1cdbd7=a0_0x4e5b9b;if(_0x5e1a90['type']===_0x1cdbd7(0x228)){Z(_0x1cdbd7(0x268)+G+'\x22');return;}if(_0x5e1a90['type']===_0x1cdbd7(0x1ee)){if(Z(_0x1cdbd7(0x25d)+_0x5e1a90['from']+':\x20'+_0x5e1a90[_0x1cdbd7(0x244)][_0x1cdbd7(0x248)](0x0,0x3c)),await y['notification']({'method':'notifications/claude/channel','params':{'content':_0x5e1a90[_0x1cdbd7(0x244)],'meta':{'sender':_0x5e1a90[_0x1cdbd7(0x200)]||'hub','sender_id':'commhub','user':_0x5e1a90['from']||_0x1cdbd7(0x246),'priority':_0x1cdbd7(0x232)}}}),_0x5e1a90['message_id'])await P(_0x1cdbd7(0x1e0),{'alias':G,'message_id':_0x5e1a90['message_id']});return;}if(_0x5e1a90[_0x1cdbd7(0x24f)]===_0x1cdbd7(0x212)||_0x5e1a90[_0x1cdbd7(0x24f)]==='broadcast'){Z('←\x20'+_0x5e1a90[_0x1cdbd7(0x24f)]+_0x1cdbd7(0x1d1)+_0x5e1a90[_0x1cdbd7(0x251)]+_0x1cdbd7(0x1d0)+(_0x5e1a90[_0x1cdbd7(0x1f1)]||_0x1cdbd7(0x232)));let _0x5a891f=await P(_0x1cdbd7(0x24c),{'alias':G,'limit':0x5});if(_0x5a891f?.['ok']&&_0x5a891f[_0x1cdbd7(0x1e6)]?.[_0x1cdbd7(0x257)]>0x0)for(let _0x37d7bc of _0x5a891f[_0x1cdbd7(0x1e6)]){let _0x236012={'sender':_0x37d7bc[_0x1cdbd7(0x23a)]||_0x1cdbd7(0x246),'sender_id':_0x1cdbd7(0x263),'user':_0x37d7bc[_0x1cdbd7(0x23a)]||_0x1cdbd7(0x246),'task_id':_0x37d7bc['id'],'priority':_0x37d7bc[_0x1cdbd7(0x1f1)]||_0x1cdbd7(0x232)};N[_0x1cdbd7(0x20a)](_0x37d7bc['id'],_0x37d7bc[_0x1cdbd7(0x23a)]||_0x1cdbd7(0x246)),await y[_0x1cdbd7(0x26f)]({'method':'notifications/claude/channel','params':{'content':_0x37d7bc['content'],'meta':_0x236012}}),Z('→\x20injected\x20task\x20'+_0x37d7bc['id'][_0x1cdbd7(0x248)](0x0,0x8)+_0x1cdbd7(0x1d7)+_0x37d7bc['from_session']+':\x20'+_0x37d7bc[_0x1cdbd7(0x233)][_0x1cdbd7(0x248)](0x0,0x3c)),await P(_0x1cdbd7(0x1e0),{'alias':G,'message_id':_0x37d7bc['id']});}}}async function u(){const _0x475e2b=a0_0x4e5b9b;let _0x1c2402=new a0_0x394e6c();await y[_0x475e2b(0x21d)](_0x1c2402),Z(_0x475e2b(0x227)),Z(_0x475e2b(0x260)),S()[_0x475e2b(0x217)](_0xc773eb=>Z('SSE\x20fatal:\x20'+_0xc773eb)),P(_0x475e2b(0x204),{'resume_id':X,'alias':G,'status':'idle','server':a0_0x2b25b4(),'hostname':a0_0x2b25b4(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':x||void 0x0})[_0x475e2b(0x201)](()=>Z(_0x475e2b(0x223)+G+_0x475e2b(0x215)+X[_0x475e2b(0x248)](0x0,0x8)+')'))[_0x475e2b(0x217)](_0x3b6049=>Z(_0x475e2b(0x22a)+_0x3b6049)),setInterval(()=>{const _0x499611=_0x475e2b;P('report_status',{'resume_id':X,'alias':G,'status':_0x499611(0x21c),'server':a0_0x2b25b4(),'hostname':a0_0x2b25b4(),'agent':_0x499611(0x239),'project_dir':process[_0x499611(0x24d)](),'tmux_name':x||void 0x0})['catch'](_0x14dd3d=>Z('heartbeat\x20failed:\x20'+_0x14dd3d));},0x2bf20),Z('ready\x20—\x20waiting\x20for\x20events');}u()[a0_0x4e5b9b(0x217)](_0x3e066f=>{const _0x2703cb=a0_0x4e5b9b;Z(_0x2703cb(0x1f3)+_0x3e066f),process['exit'](0x1);});async function h(){const _0x4cc68f=a0_0x4e5b9b;Z(_0x4cc68f(0x1e1)),await P(_0x4cc68f(0x204),{'resume_id':X,'alias':G,'status':_0x4cc68f(0x26d),'task':_0x4cc68f(0x1e7)})['catch'](()=>{}),process[_0x4cc68f(0x205)](0x0);}process[a0_0x4e5b9b(0x20b)]['on'](a0_0x4e5b9b(0x247),()=>h()),process['on'](a0_0x4e5b9b(0x23f),()=>h()),process['on']('SIGINT',()=>h());function a0_0x4610(){const _0x2b51b5=['parse','14546QpErKe','idle','connect','working','commhub_send_message','startsWith','get_session_status','2025-03-26','registered\x20as\x20\x22','stderr','\x20RESUME_ID=','split','MCP\x20stdio\x20connected','connected','get','warning:\x20could\x20not\x20register:\x20','task','init\x20failed:\x20','2.0','token','setRequestHandler','\x20CWD=','get_all_status','normal','content','get_task','tools/call','read','\x20ALIAS=','indexOf','claude-code','from_session','connecting\x20to\x20','delete','cancelled','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','SIGTERM','Parent\x20task\x20id\x20for\x20auto-chaining\x20child\x20replies','...\x20TMUX=','parse\x20error:\x20','blocked','message','13NSqLwa','hub','end','slice','error','Filter\x20by\x20sender\x20alias','Filter\x20by\x20status','get_inbox','cwd','46887396Drkstd','type','toTimeString','inbox_count','commhub_send_task','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','join','replace','17463974nRjZlr','length','unknown\x20tool','Task\x20content','Message\x20content','alias','SSE\x20connection\x20error:\x20','←\x20message\x20from\x20','stringify','Task\x20id','starting\x20SSE\x20listener...','object','status','commhub','.claude/channels/commhub','commhub_report_status','ENV:\x20URL=','\x20PROJECT_ENV=','SSE\x20connected\x20as\x20\x22','Session\x20alias:\x20','7318960CxPBLc','Progress\x200-100','commhub_reply','offline','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','notification','Optional\x20structured\x20metadata','535GMfmKu','\x20priority=',':\x20inbox_count=','getReader','write','low','commhub_get_task','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','\x20from\x20','Task\x20TTL\x20in\x20seconds','/mcp','Reply\x20text\x20/\x20result\x20summary','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','871936aiSyjJ','9ZovMsh','find','Authorization','ack_inbox','shutting\x20down,\x20reporting\x20offline...','string','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Max\x20rows','.anet','messages','session\x20disconnected','1255366nWQkDz','commhub_get_session_status','trim','Get\x20detailed\x20status\x20for\x20a\x20session\x20alias.','Filter\x20by\x20recipient\x20alias','Optional\x20context','new_message','body','text','priority','57258jYPjPG','fatal:\x20','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','.env','result','commhub_list_tasks','commhub_get_all_status','no\x20response','0.3.0','number','config.json','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','commhub-channel','failed','from','then','List\x20tasks\x20with\x20optional\x20filters.','list_tasks','report_status','exit','send_task','POST','472SftnFH','Target\x20session\x20alias','set','stdin','Bearer\x20','completed','send_reply','6bhpWAo','replied','none','new_task','decode','application/json,\x20text/event-stream','\x22\x20(','tmux\x20display-message\x20-p\x20\x27#S\x27','catch','data:\x20','1ynYlop'];a0_0x4610=function(){return _0x2b51b5;};return a0_0x4610();}
2
+ const a0_0x116ce2=a0_0x4aa1;function a0_0x4aa1(_0x4d6576,_0x3291be){_0x4d6576=_0x4d6576-0x15a;const _0x4e20a5=a0_0x4e20();let _0x4aa159=_0x4e20a5[_0x4d6576];return _0x4aa159;}(function(_0x2b6f4d,_0x323234){const _0x385c5d=a0_0x4aa1,_0x43311d=_0x2b6f4d();while(!![]){try{const _0xd531c0=-parseInt(_0x385c5d(0x168))/0x1+-parseInt(_0x385c5d(0x1b7))/0x2+parseInt(_0x385c5d(0x161))/0x3*(parseInt(_0x385c5d(0x1e7))/0x4)+-parseInt(_0x385c5d(0x160))/0x5+-parseInt(_0x385c5d(0x1a2))/0x6+-parseInt(_0x385c5d(0x1d9))/0x7*(parseInt(_0x385c5d(0x19b))/0x8)+parseInt(_0x385c5d(0x1b4))/0x9*(parseInt(_0x385c5d(0x184))/0xa);if(_0xd531c0===_0x323234)break;else _0x43311d['push'](_0x43311d['shift']());}catch(_0x347121){_0x43311d['push'](_0x43311d['shift']());}}}(a0_0x4e20,0x8d46a));import{readFileSync as a0_0x482c9c,existsSync as a0_0x97892a}from'fs';import{randomUUID as a0_0x455b31}from'crypto';import{join as a0_0x673813}from'path';import{hostname as a0_0x411ffd}from'os';import{execSync as a0_0x29c630}from'child_process';import{Server as a0_0x7a5448}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x3efa73}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x507215,CallToolRequestSchema as a0_0x49f6a8}from'@modelcontextprotocol/sdk/types.js';function p(_0x815faf){const _0x360e75=a0_0x4aa1;if(!a0_0x97892a(_0x815faf))return;for(let _0x34c16d of a0_0x482c9c(_0x815faf,_0x360e75(0x1e9))[_0x360e75(0x183)]('\x0a')){let _0x5b439a=_0x34c16d['trim']();if(!_0x5b439a||_0x5b439a[_0x360e75(0x181)]('#'))continue;let _0x6c332c=_0x5b439a[_0x360e75(0x1cb)]('=');if(_0x6c332c<0x0)continue;let _0x4f77b9=_0x5b439a[_0x360e75(0x185)](0x0,_0x6c332c)[_0x360e75(0x1d4)](),_0x53abaa=_0x5b439a['slice'](_0x6c332c+0x1)[_0x360e75(0x1d4)]()[_0x360e75(0x164)](/^["']|["']$/g,'');if(!process.env[_0x4f77b9])process.env[_0x4f77b9]=_0x53abaa;}}var C=process.env.HOME||'~',T=a0_0x673813(C,a0_0x116ce2(0x18d));p(a0_0x673813(T,a0_0x116ce2(0x18b)));var L=process['cwd']()[a0_0x116ce2(0x164)](/\//g,'-');p(a0_0x673813(T,L,a0_0x116ce2(0x18b)));function U(){const _0x4d81c5=a0_0x116ce2;try{return a0_0x29c630(_0x4d81c5(0x16e),{'encoding':'utf-8','timeout':0x7d0})[_0x4d81c5(0x1d4)]();}catch{return'';}}function v(){const _0x20cdc6=a0_0x116ce2;try{let _0x548c93=a0_0x673813(C,'.anet',_0x20cdc6(0x1d5));if(a0_0x97892a(_0x548c93))return JSON['parse'](a0_0x482c9c(_0x548c93,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x116ce2(0x177)]||a0_0x116ce2(0x1b6),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x411ffd(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x455b31(),X=process.env.COMMHUB_TOKEN||H[a0_0x116ce2(0x16c)]||'';function Y(_0x375c67){const _0x346d49=a0_0x116ce2;let _0x34a6f2=new Date()[_0x346d49(0x1b5)]()['slice'](0x0,0x8);process[_0x346d49(0x1e3)]['write']('['+_0x34a6f2+_0x346d49(0x1db)+_0x375c67+'\x0a');}function a0_0x4e20(){const _0x5cabfb=['starting\x20SSE\x20listener...','low','blocked','find','ENV:\x20URL=','SSE\x20connection\x20error:\x20','result','new_message','initialize','task','SSE\x20stream\x20ended,\x20reconnecting...','read','Authorization','delete','set','commhub_send_message','ready\x20—\x20waiting\x20for\x20events','parse','indexOf','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','data:\x20','fatal:\x20','commhub','Progress\x200-100','join','cancelled','commhub-channel','trim','config.json','Message\x20content','exit','commhub_send_task','2270681SoWlTL','priority',']\x20[commhub]\x20','tools/call','\x22\x20(','\x20CWD=','connecting\x20to\x20','from','warning:\x20could\x20not\x20register:\x20','type','stderr','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','string','commhub_get_all_status','542444Rkheej','alias','utf-8','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','error','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','...\x20TMUX=','ack_inbox','Target\x20session\x20alias','SSE\x20connected\x20as\x20\x22','length','\x20RESUME_ID=','messages','4463010cUAtYg','3PNAfuK','inbox_count','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','replace','\x20PROJECT_ENV=','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','application/json','460731CQaiQL','connected','message','→\x20injected\x20task\x20','token','text','tmux\x20display-message\x20-p\x20\x27#S\x27','Session\x20alias:\x20','heartbeat\x20failed:\x20','send_task','then','catch','cwd','content','\x20ALIAS=','hub','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','commhub_reply','message_id','commhub_report_status','completed','get_all_status','normal','send_message','SSE\x20error:\x20','startsWith','in_progress','split','3670VTVDut','slice','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','registered\x20as\x20\x22','send_reply','parse\x20error:\x20','from_session','.env','Reply\x20text\x20/\x20result\x20summary','.claude/channels/commhub','report_status','idle','number','MCP\x20stdio\x20connected','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','object','POST','CommHub\x20init\x20failed:\x20','none','offline','←\x20message\x20from\x20','body','end','8nWBfLZ','broadcast','SSE\x20fatal:\x20',':\x20inbox_count=','getReader','status','stringify','2787384CQYsiS','new_task','failed','setRequestHandler','claude-code','connect','SIGINT','\x20from\x20','Bearer\x20','\x20priority=','session\x20disconnected','working','2.0','notifications/claude/channel','decode','high','/mcp','notification','71271rbWGkz','toTimeString','http://127.0.0.1:9200','641876QjoIVO','0.3.0'];a0_0x4e20=function(){return _0x5cabfb;};return a0_0x4e20();}function h(_0x2cad16){return new Promise(_0x50931a=>setTimeout(_0x50931a,_0x2cad16));}Y(a0_0x116ce2(0x1bd)+f+a0_0x116ce2(0x176)+Z+a0_0x116ce2(0x15e)+w[a0_0x116ce2(0x185)](0x0,0x8)+a0_0x116ce2(0x1ed)+(j||a0_0x116ce2(0x196))+a0_0x116ce2(0x1de)+process['cwd']()+a0_0x116ce2(0x165)+L);var k=new Map(),K=new a0_0x7a5448({'name':a0_0x116ce2(0x1d3),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x116ce2(0x1e4),a0_0x116ce2(0x186),a0_0x116ce2(0x1ec),a0_0x116ce2(0x166),a0_0x116ce2(0x16f)+Z][a0_0x116ce2(0x1d1)]('\x0a')});K[a0_0x116ce2(0x1a5)](a0_0x507215,async()=>({'tools':[{'name':a0_0x116ce2(0x179),'description':a0_0x116ce2(0x178),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x116ce2(0x1e5),'description':a0_0x116ce2(0x1cc)},'text':{'type':a0_0x116ce2(0x1e5),'description':a0_0x116ce2(0x18c)},'status':{'type':'string','enum':[a0_0x116ce2(0x17c),a0_0x116ce2(0x1a4),a0_0x116ce2(0x1d2),'blocked','error',a0_0x116ce2(0x182)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x116ce2(0x16d)]}},{'name':a0_0x116ce2(0x17b),'description':a0_0x116ce2(0x1ea),'inputSchema':{'type':a0_0x116ce2(0x193),'properties':{'status':{'type':a0_0x116ce2(0x1e5),'enum':['working',a0_0x116ce2(0x18f),a0_0x116ce2(0x1bb),'error']},'task':{'type':a0_0x116ce2(0x1e5),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x116ce2(0x190),'description':a0_0x116ce2(0x1d0)}},'required':[a0_0x116ce2(0x1a0)]}},{'name':a0_0x116ce2(0x1d8),'description':a0_0x116ce2(0x192),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x116ce2(0x1e5),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x116ce2(0x1e5),'description':'Task\x20content'},'priority':{'type':'string','enum':[a0_0x116ce2(0x1b1),a0_0x116ce2(0x17e),a0_0x116ce2(0x1ba)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x116ce2(0x1e8),a0_0x116ce2(0x1c2)]}},{'name':a0_0x116ce2(0x1c8),'description':a0_0x116ce2(0x163),'inputSchema':{'type':a0_0x116ce2(0x193),'properties':{'alias':{'type':'string','description':a0_0x116ce2(0x15b)},'message':{'type':a0_0x116ce2(0x1e5),'description':a0_0x116ce2(0x1d6)}},'required':['alias',a0_0x116ce2(0x16a)]}},{'name':a0_0x116ce2(0x1e6),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x116ce2(0x193),'properties':{}}}]}));async function P(_0x5ede1a,_0x5b8d48){const _0x374476=a0_0x116ce2;let _0x2dd252=await fetch(f+_0x374476(0x1b2),{'method':_0x374476(0x194),'headers':{'Content-Type':_0x374476(0x167),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x374476(0x1aa)+X}:{}},'body':JSON[_0x374476(0x1a1)]({'jsonrpc':_0x374476(0x1ae),'id':0x1,'method':_0x374476(0x1c1),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x374476(0x1d3),'version':_0x374476(0x1b8)}}})});if(!_0x2dd252['ok']){let _0x3bd10b=await _0x2dd252[_0x374476(0x16d)]();return Y(_0x374476(0x195)+_0x2dd252[_0x374476(0x1a0)]+'\x20'+_0x3bd10b[_0x374476(0x185)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x2dd252[_0x374476(0x1a0)]};}await _0x2dd252[_0x374476(0x16d)]();let _0x202a61=(await(await fetch(f+_0x374476(0x1b2),{'method':_0x374476(0x194),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x374476(0x1a1)]({'jsonrpc':_0x374476(0x1ae),'id':0x2,'method':_0x374476(0x1dc),'params':{'name':_0x5ede1a,'arguments':_0x5b8d48}})}))[_0x374476(0x16d)]())['split']('\x0a')[_0x374476(0x1bc)](_0x4ef7cd=>_0x4ef7cd[_0x374476(0x181)](_0x374476(0x1cd)));if(_0x202a61){let _0x2f8b77=JSON['parse'](_0x202a61['slice'](0x6));return _0x2f8b77?.[_0x374476(0x1bf)]?.[_0x374476(0x175)]?.[0x0]?.[_0x374476(0x16d)]?JSON['parse'](_0x2f8b77[_0x374476(0x1bf)][_0x374476(0x175)][0x0][_0x374476(0x16d)]):_0x2f8b77;}return{'ok':!0x1,'error':'no\x20response'};}K['setRequestHandler'](a0_0x49f6a8,async _0x403d23=>{const _0x28af75=a0_0x116ce2;let {name:_0x53faf8,arguments:_0x1a38c7}=_0x403d23['params'];if(_0x53faf8===_0x28af75(0x179)){let {task_id:_0x579c29,text:_0x30f660,status:_0x26a6c9}=_0x1a38c7;if(_0x26a6c9===_0x28af75(0x17c)||_0x26a6c9==='failed'||_0x26a6c9===_0x28af75(0x1d2)){let _0x3a31eb=_0x26a6c9===_0x28af75(0x17c)?'replied':_0x26a6c9,_0x38cd60=_0x579c29?k['get'](_0x579c29)||_0x28af75(0x177):_0x28af75(0x177),_0x401bff=await P(_0x28af75(0x188),{'alias':_0x38cd60,'text':_0x30f660,'in_reply_to':_0x579c29||void 0x0,'status':_0x3a31eb,'from_session':Z});if(_0x579c29)k[_0x28af75(0x1c6)](_0x579c29);return{'content':[{'type':_0x28af75(0x16d),'text':JSON[_0x28af75(0x1a1)](_0x401bff)}]};}let _0x163b03=await P(_0x28af75(0x18e),{'resume_id':w,'alias':Z,'status':_0x26a6c9===_0x28af75(0x1bb)?_0x28af75(0x1bb):_0x26a6c9===_0x28af75(0x1eb)?'error':_0x28af75(0x1ad),'task':_0x30f660[_0x28af75(0x185)](0x0,0xc8),'output':_0x30f660});return{'content':[{'type':'text','text':JSON[_0x28af75(0x1a1)](_0x163b03)}]};}if(_0x53faf8===_0x28af75(0x17b)){let {status:_0x268869,task:_0x57395d,progress:_0x25448e}=_0x1a38c7,_0xb50965=await P(_0x28af75(0x18e),{'resume_id':w,'alias':Z,'status':_0x268869,'task':_0x57395d,'progress':_0x25448e});return{'content':[{'type':_0x28af75(0x16d),'text':JSON[_0x28af75(0x1a1)](_0xb50965)}]};}if(_0x53faf8===_0x28af75(0x1d8)){let {alias:_0x2731ab,task:_0x168a7e,priority:_0x4654c5}=_0x1a38c7,_0x49b90b=await P(_0x28af75(0x171),{'alias':_0x2731ab,'task':_0x168a7e,'priority':_0x4654c5||_0x28af75(0x17e),'from_session':Z});return{'content':[{'type':_0x28af75(0x16d),'text':JSON[_0x28af75(0x1a1)](_0x49b90b)}]};}if(_0x53faf8===_0x28af75(0x1c8)){let {alias:_0xd0c0c0,message:_0x499983}=_0x1a38c7,_0x2cb526=await P(_0x28af75(0x17f),{'alias':_0xd0c0c0,'message':_0x499983,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x28af75(0x1a1)](_0x2cb526)}]};}if(_0x53faf8===_0x28af75(0x1e6)){let _0x2b2c41=await P(_0x28af75(0x17d),{});return{'content':[{'type':_0x28af75(0x16d),'text':JSON[_0x28af75(0x1a1)](_0x2b2c41)}]};}return{'content':[{'type':_0x28af75(0x16d),'text':JSON[_0x28af75(0x1a1)]({'error':'unknown\x20tool'})}]};});async function u(){const _0x29d198=a0_0x116ce2;let _0x10f964=f+'/events/'+encodeURIComponent(Z),_0x284cc0={};if(X)_0x284cc0[_0x29d198(0x1c5)]=_0x29d198(0x1aa)+X;Y(_0x29d198(0x1df)+_0x10f964);while(!0x0){try{let _0xd3d8a2=await fetch(_0x10f964,{'headers':_0x284cc0});if(!_0xd3d8a2['ok']){Y(_0x29d198(0x180)+_0xd3d8a2[_0x29d198(0x1a0)]+'\x20'+_0xd3d8a2['statusText']),await h(0x1388);continue;}let _0x498f47=_0xd3d8a2[_0x29d198(0x199)][_0x29d198(0x19f)](),_0x5f03a2=new TextDecoder(),_0x4ffd9b='';while(!0x0){let {done:_0x306f59,value:_0x34cb2b}=await _0x498f47[_0x29d198(0x1c4)]();if(_0x306f59)break;_0x4ffd9b+=_0x5f03a2[_0x29d198(0x1b0)](_0x34cb2b,{'stream':!0x0});let _0x50837e=_0x4ffd9b['split']('\x0a\x0a');_0x4ffd9b=_0x50837e['pop']()||'';for(let _0x27bc41 of _0x50837e){let _0x114eb4=_0x27bc41[_0x29d198(0x183)]('\x0a')['find'](_0x331136=>_0x331136[_0x29d198(0x181)](_0x29d198(0x1cd)));if(!_0x114eb4)continue;try{let _0x259aa4=JSON[_0x29d198(0x1ca)](_0x114eb4[_0x29d198(0x185)](0x6));await S(_0x259aa4);}catch(_0x2ab49c){Y(_0x29d198(0x189)+_0x2ab49c);}}}Y(_0x29d198(0x1c3));}catch(_0x1fe2b7){Y(_0x29d198(0x1be)+_0x1fe2b7);}await h(0xbb8);}}async function S(_0x46ef4a){const _0x2c6b82=a0_0x116ce2;if(_0x46ef4a[_0x2c6b82(0x1e2)]===_0x2c6b82(0x169)){Y(_0x2c6b82(0x15c)+Z+'\x22');return;}if(_0x46ef4a[_0x2c6b82(0x1e2)]===_0x2c6b82(0x1c0)){if(Y(_0x2c6b82(0x198)+_0x46ef4a[_0x2c6b82(0x1e0)]+':\x20'+_0x46ef4a[_0x2c6b82(0x16a)][_0x2c6b82(0x185)](0x0,0x3c)),await K['notification']({'method':_0x2c6b82(0x1af),'params':{'content':_0x46ef4a[_0x2c6b82(0x16a)],'meta':{'sender':_0x46ef4a[_0x2c6b82(0x1e0)]||_0x2c6b82(0x177),'sender_id':'commhub','user':_0x46ef4a[_0x2c6b82(0x1e0)]||_0x2c6b82(0x177),'priority':'normal'}}}),_0x46ef4a[_0x2c6b82(0x17a)])await P(_0x2c6b82(0x15a),{'alias':Z,'message_id':_0x46ef4a[_0x2c6b82(0x17a)]});return;}if(_0x46ef4a[_0x2c6b82(0x1e2)]===_0x2c6b82(0x1a3)||_0x46ef4a['type']===_0x2c6b82(0x19c)){Y('←\x20'+_0x46ef4a['type']+_0x2c6b82(0x19e)+_0x46ef4a[_0x2c6b82(0x162)]+_0x2c6b82(0x1ab)+(_0x46ef4a[_0x2c6b82(0x1da)]||'normal'));let _0x882a1=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x882a1?.['ok']&&_0x882a1['messages']?.[_0x2c6b82(0x15d)]>0x0)for(let _0x173b79 of _0x882a1[_0x2c6b82(0x15f)]){let _0x233857={'sender':_0x173b79['from_session']||_0x2c6b82(0x177),'sender_id':_0x2c6b82(0x1cf),'user':_0x173b79[_0x2c6b82(0x18a)]||'hub','task_id':_0x173b79['id'],'priority':_0x173b79[_0x2c6b82(0x1da)]||_0x2c6b82(0x17e)};k[_0x2c6b82(0x1c7)](_0x173b79['id'],_0x173b79[_0x2c6b82(0x18a)]||_0x2c6b82(0x177)),await K[_0x2c6b82(0x1b3)]({'method':_0x2c6b82(0x1af),'params':{'content':_0x173b79[_0x2c6b82(0x175)],'meta':_0x233857}}),Y(_0x2c6b82(0x16b)+_0x173b79['id'][_0x2c6b82(0x185)](0x0,0x8)+_0x2c6b82(0x1a9)+_0x173b79[_0x2c6b82(0x18a)]+':\x20'+_0x173b79[_0x2c6b82(0x175)]['slice'](0x0,0x3c)),await P(_0x2c6b82(0x15a),{'alias':Z,'message_id':_0x173b79['id']});}}}async function A(){const _0x271866=a0_0x116ce2;let _0x467c6f=new a0_0x3efa73();await K[_0x271866(0x1a7)](_0x467c6f),Y(_0x271866(0x191)),Y(_0x271866(0x1b9)),u()[_0x271866(0x173)](_0x578bc2=>Y(_0x271866(0x19d)+_0x578bc2)),P(_0x271866(0x18e),{'resume_id':w,'alias':Z,'status':_0x271866(0x18f),'server':a0_0x411ffd(),'hostname':a0_0x411ffd(),'agent':_0x271866(0x1a6),'project_dir':process[_0x271866(0x174)](),'tmux_name':j||void 0x0})[_0x271866(0x172)](()=>Y(_0x271866(0x187)+Z+_0x271866(0x1dd)+w[_0x271866(0x185)](0x0,0x8)+')'))[_0x271866(0x173)](_0x50f111=>Y(_0x271866(0x1e1)+_0x50f111)),setInterval(()=>{const _0x4d19cd=_0x271866;P(_0x4d19cd(0x18e),{'resume_id':w,'alias':Z,'status':_0x4d19cd(0x18f),'server':a0_0x411ffd(),'hostname':a0_0x411ffd(),'agent':'claude-code','project_dir':process[_0x4d19cd(0x174)](),'tmux_name':j||void 0x0})[_0x4d19cd(0x173)](_0xee25d5=>Y(_0x4d19cd(0x170)+_0xee25d5));},0x2bf20),Y(_0x271866(0x1c9));}A()['catch'](_0x2fb11b=>{const _0x5a65ad=a0_0x116ce2;Y(_0x5a65ad(0x1ce)+_0x2fb11b),process[_0x5a65ad(0x1d7)](0x1);});async function N(){const _0x28553a=a0_0x116ce2;Y('shutting\x20down,\x20reporting\x20offline...'),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x28553a(0x197),'task':_0x28553a(0x1ac)})['catch'](()=>{}),process[_0x28553a(0x1d7)](0x0);}process['stdin']['on'](a0_0x116ce2(0x19a),()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x116ce2(0x1a8),()=>N());
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.2.8",
4
- "description": "AI Agent Network CLI Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 39 commands.",
3
+ "version": "2.2.9-preview.1",
4
+ "description": "AI Agent Network CLI \u2014 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",
7
7
  "types": "dist/client.d.ts",
@@ -42,7 +42,7 @@
42
42
  "homepage": "https://anet.sh",
43
43
  "repository": {
44
44
  "type": "git",
45
- "url": "git+https://github.com/sleep2agi/agent-network.git",
45
+ "url": "https://github.com/sleep2agi/agent-network",
46
46
  "directory": "agent-network"
47
47
  },
48
48
  "publishConfig": {