@sleep2agi/agent-network 2.1.8-preview.1 → 2.1.8-preview.3

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_0x5b7137=a0_0x3a9e;(function(_0x368c6b,_0x16dfdc){const _0x4c3e3b=a0_0x3a9e,_0xa33256=_0x368c6b();while(!![]){try{const _0x45bfad=parseInt(_0x4c3e3b(0x161))/0x1+-parseInt(_0x4c3e3b(0x139))/0x2+-parseInt(_0x4c3e3b(0x13d))/0x3+-parseInt(_0x4c3e3b(0x15d))/0x4*(-parseInt(_0x4c3e3b(0x145))/0x5)+-parseInt(_0x4c3e3b(0x14b))/0x6+-parseInt(_0x4c3e3b(0x150))/0x7+-parseInt(_0x4c3e3b(0x138))/0x8*(-parseInt(_0x4c3e3b(0x154))/0x9);if(_0x45bfad===_0x16dfdc)break;else _0xa33256['push'](_0xa33256['shift']());}catch(_0x50b4fa){_0xa33256['push'](_0xa33256['shift']());}}}(a0_0x50b6,0xd2b76));import{EventEmitter as a0_0x30148e}from'events';function a0_0x3a9e(_0x34c1a0,_0x1e8279){_0x34c1a0=_0x34c1a0-0x112;const _0x50b639=a0_0x50b6();let _0x3a9e5a=_0x50b639[_0x34c1a0];return _0x3a9e5a;}import{hostname as a0_0x503094}from'os';class T extends a0_0x30148e{[a0_0x5b7137(0x156)];[a0_0x5b7137(0x12e)];[a0_0x5b7137(0x11d)];[a0_0x5b7137(0x137)];[a0_0x5b7137(0x13c)];['heartbeatInterval'];[a0_0x5b7137(0x13a)];[a0_0x5b7137(0x126)];[a0_0x5b7137(0x12b)];[a0_0x5b7137(0x151)]=!0x1;constructor(_0x4f170e){const _0x49349e=a0_0x5b7137;super();if(this[_0x49349e(0x156)]=_0x4f170e[_0x49349e(0x156)][_0x49349e(0x144)](/\/$/,''),this['alias']=_0x4f170e[_0x49349e(0x12e)],this[_0x49349e(0x11d)]=_0x4f170e[_0x49349e(0x11d)],this[_0x49349e(0x137)]=_0x4f170e[_0x49349e(0x137)]||_0x49349e(0x115),this[_0x49349e(0x13c)]=_0x49349e(0x15e)+_0x4f170e[_0x49349e(0x12e)]+'-'+Date[_0x49349e(0x131)]()[_0x49349e(0x14f)](0x24),this[_0x49349e(0x14e)]=_0x4f170e['heartbeatInterval']??0x2bf20,this[_0x49349e(0x13a)]=_0x4f170e[_0x49349e(0x13a)]??0xbb8,_0x4f170e[_0x49349e(0x12d)]!==!0x1)this[_0x49349e(0x13e)]();}[a0_0x5b7137(0x129)](_0x37ccc5){const _0x3cc102=a0_0x5b7137;console['log']('['+new Date()[_0x3cc102(0x15c)]()['slice'](0x0,0x8)+_0x3cc102(0x159)+this['alias']+']\x20'+_0x37ccc5);}async[a0_0x5b7137(0x123)](_0x499327,_0x5b1586){const _0x58d35f=a0_0x5b7137;let _0x5451bf={'Content-Type':_0x58d35f(0x11a),'Accept':_0x58d35f(0x149)};if(this[_0x58d35f(0x11d)])_0x5451bf['Authorization']=_0x58d35f(0x116)+this[_0x58d35f(0x11d)];let _0x18892c=await(await fetch(this[_0x58d35f(0x156)]+'/mcp',{'method':_0x58d35f(0x124),'headers':_0x5451bf,'body':JSON[_0x58d35f(0x158)]({'jsonrpc':'2.0','id':Date[_0x58d35f(0x131)](),'method':_0x58d35f(0x15b),'params':{'name':_0x499327,'arguments':_0x5b1586}})}))['text'](),_0x4a72c7=_0x18892c[_0x58d35f(0x134)](/data: (.+)/),_0x48f8ac=_0x4a72c7?JSON[_0x58d35f(0x14a)](_0x4a72c7[0x1]):JSON[_0x58d35f(0x14a)](_0x18892c),_0x5e9505=_0x48f8ac?.['result']?.[_0x58d35f(0x11c)]?.[0x0]?.[_0x58d35f(0x169)];return _0x5e9505?JSON[_0x58d35f(0x14a)](_0x5e9505):_0x48f8ac;}async[a0_0x5b7137(0x13e)](){const _0xa04d8=a0_0x5b7137;if(this[_0xa04d8(0x151)])return;this[_0xa04d8(0x151)]=!0x0,await this['status'](_0xa04d8(0x122)),this[_0xa04d8(0x129)](_0xa04d8(0x12a)),this[_0xa04d8(0x126)]=setInterval(()=>{const _0x5110f1=_0xa04d8;this['status'](_0x5110f1(0x122))[_0x5110f1(0x148)](_0x365a9f=>this['log'](_0x5110f1(0x163)+_0x365a9f[_0x5110f1(0x164)]));},this['heartbeatInterval']),this[_0xa04d8(0x165)]();}async['disconnect'](){const _0x1331a5=a0_0x5b7137;if(this['running']=!0x1,this['sseAbort']?.[_0x1331a5(0x16a)](),this[_0x1331a5(0x126)])clearInterval(this[_0x1331a5(0x126)]);await this[_0x1331a5(0x113)](_0x1331a5(0x133))[_0x1331a5(0x148)](()=>{}),this['log'](_0x1331a5(0x117));}async[a0_0x5b7137(0x141)](_0x11585e,_0x3d9154,_0x2a7991='normal'){return this['call']('send_task',{'alias':_0x11585e,'task':_0x3d9154,'priority':_0x2a7991,'from_session':this['alias']});}async[a0_0x5b7137(0x164)](_0x30be2e,_0x3a408a){const _0x56bca0=a0_0x5b7137;return this[_0x56bca0(0x123)](_0x56bca0(0x162),{'alias':_0x30be2e,'message':_0x3a408a,'from_session':this[_0x56bca0(0x12e)]});}async[a0_0x5b7137(0x15f)](_0x2dc105,_0x5cdedc,_0x37cdf8=a0_0x5b7137(0x13f)){const _0x4deea5=a0_0x5b7137;return this['call'](_0x4deea5(0x120),{'in_reply_to':_0x2dc105,'text':_0x5cdedc,'status':_0x37cdf8});}async['status'](_0x4173c2,_0x51fcbf){const _0x3ec50d=a0_0x5b7137;return this[_0x3ec50d(0x123)](_0x3ec50d(0x147),{'resume_id':this['resumeId'],'alias':this[_0x3ec50d(0x12e)],'status':_0x4173c2,'server':a0_0x503094(),'hostname':a0_0x503094(),'agent':this['agent'],'project_dir':process[_0x3ec50d(0x119)](),..._0x51fcbf});}async[a0_0x5b7137(0x155)](){const _0x1f47e2=a0_0x5b7137;return this[_0x1f47e2(0x123)](_0x1f47e2(0x118),{});}async[a0_0x5b7137(0x168)](_0x57ba6b,_0x135b6b){const _0x459760=a0_0x5b7137;return this[_0x459760(0x123)](_0x459760(0x168),{'message':_0x57ba6b,'filter_server':_0x135b6b?.[_0x459760(0x153)],'filter_status':_0x135b6b?.[_0x459760(0x113)]});}async[a0_0x5b7137(0x165)](){const _0x349970=a0_0x5b7137;let _0xe70dc7=encodeURIComponent(this['alias']),_0x58f6fd=this[_0x349970(0x156)]+'/events/'+_0xe70dc7,_0x9f127a=this['reconnectDelay'];while(this[_0x349970(0x151)]){try{this[_0x349970(0x12b)]=new AbortController();let _0x1cb5ad={'Accept':_0x349970(0x167)};if(this[_0x349970(0x11d)])_0x1cb5ad[_0x349970(0x135)]=_0x349970(0x116)+this[_0x349970(0x11d)];let _0x1024f5=await fetch(_0x58f6fd,{'headers':_0x1cb5ad,'signal':this['sseAbort'][_0x349970(0x14d)]});if(!_0x1024f5['ok']||!_0x1024f5[_0x349970(0x11f)]){this[_0x349970(0x129)](_0x349970(0x143)+_0x1024f5[_0x349970(0x113)]),await this[_0x349970(0x121)](_0x9f127a),_0x9f127a=Math['min'](_0x9f127a*1.5,0xea60);continue;}_0x9f127a=this['reconnectDelay'];let _0x1f31e6=_0x1024f5['body']['getReader'](),_0x458a39=new TextDecoder(),_0x29867a='';while(this[_0x349970(0x151)]){let {done:_0x470b66,value:_0x4e011c}=await _0x1f31e6[_0x349970(0x130)]();if(_0x470b66)break;_0x29867a+=_0x458a39[_0x349970(0x14c)](_0x4e011c,{'stream':!0x0});let _0x4c2ec2=_0x29867a[_0x349970(0x157)]('\x0a');_0x29867a=_0x4c2ec2['pop']()||'';for(let _0x1c2a13 of _0x4c2ec2){if(!_0x1c2a13[_0x349970(0x11e)](_0x349970(0x12c)))continue;try{let _0x1f2280=JSON[_0x349970(0x14a)](_0x1c2a13[_0x349970(0x142)](0x6));if(_0x1f2280[_0x349970(0x146)]===_0x349970(0x114)){this[_0x349970(0x129)]('SSE\x20connected'),this[_0x349970(0x160)](_0x349970(0x114));continue;}if(_0x1f2280['type']==='new_task'||_0x1f2280['type']===_0x349970(0x166)||_0x1f2280[_0x349970(0x146)]===_0x349970(0x168))await this[_0x349970(0x140)]();}catch{}}}}catch(_0x291002){if(_0x291002['name']===_0x349970(0x127))break;this[_0x349970(0x160)](_0x349970(0x136),_0x291002),this[_0x349970(0x129)](_0x349970(0x128)+_0x291002[_0x349970(0x164)]);}if(this[_0x349970(0x151)])this[_0x349970(0x160)](_0x349970(0x117)),this[_0x349970(0x129)](_0x349970(0x132)+_0x9f127a/0x3e8+_0x349970(0x112)),await this[_0x349970(0x121)](_0x9f127a),_0x9f127a=Math[_0x349970(0x11b)](_0x9f127a*1.5,0xea60);}}async['processInbox'](){const _0x3de6eb=a0_0x5b7137;try{let _0x4e7a11=(await this['call'](_0x3de6eb(0x15a),{'alias':this[_0x3de6eb(0x12e)],'limit':0xa}))?.[_0x3de6eb(0x125)]||[];for(let _0x172209 of _0x4e7a11)await this[_0x3de6eb(0x123)](_0x3de6eb(0x12f),{'alias':this[_0x3de6eb(0x12e)],'message_id':_0x172209['id']}),this[_0x3de6eb(0x129)]('←\x20'+_0x172209['from_session']+':\x20'+_0x172209[_0x3de6eb(0x11c)][_0x3de6eb(0x142)](0x0,0x3c)),this[_0x3de6eb(0x160)](_0x3de6eb(0x13b),_0x172209),this[_0x3de6eb(0x160)](_0x3de6eb(0x164),_0x172209);}catch(_0x14078f){this[_0x3de6eb(0x129)](_0x3de6eb(0x152)+_0x14078f[_0x3de6eb(0x164)]);}}[a0_0x5b7137(0x121)](_0x497186){return new Promise(_0x1e4ebe=>setTimeout(_0x1e4ebe,_0x497186));}}function a0_0x50b6(){const _0x3c3306=['url','split','stringify',']\x20[commhub:','get_inbox','tools/call','toTimeString','2341108BCqiWa','sdk-','reply','emit','1368224cjUKhZ','send_message','heartbeat\x20failed:\x20','message','connectSSE','new_message','text/event-stream','broadcast','text','abort','s...','status','connected','sdk','Bearer\x20','disconnected','get_all_status','cwd','application/json','min','content','token','startsWith','body','send_reply','sleep','idle','call','POST','messages','heartbeatTimer','AbortError','SSE\x20error:\x20','log','registered','sseAbort','data:\x20','autoConnect','alias','ack_inbox','read','now','SSE\x20reconnecting\x20in\x20','offline','match','Authorization','error','agent','21115600yYYPKL','3226694FIWqxc','reconnectDelay','task','resumeId','1664292QsGGlt','connect','completed','processInbox','send','slice','SSE\x20failed:\x20','replace','5XSXNco','type','report_status','catch','application/json,\x20text/event-stream','parse','3571782yTpjGE','decode','signal','heartbeatInterval','toString','6765143ZPWdlX','running','inbox\x20error:\x20','server','9rPQdnq','getAllStatus'];a0_0x50b6=function(){return _0x3c3306;};return a0_0x50b6();}var $=T;export{$ as default,T as CommHub};
1
+ const a0_0x3b6f26=a0_0x3a93;function a0_0x3a93(_0x2dcac7,_0x3fba99){_0x2dcac7=_0x2dcac7-0x1b5;const _0x30c0e9=a0_0x30c0();let _0x3a937f=_0x30c0e9[_0x2dcac7];return _0x3a937f;}(function(_0x517c94,_0x16397e){const _0x13da31=a0_0x3a93,_0x4cf4a4=_0x517c94();while(!![]){try{const _0x6699f5=parseInt(_0x13da31(0x1f5))/0x1+-parseInt(_0x13da31(0x1c3))/0x2*(-parseInt(_0x13da31(0x1d7))/0x3)+-parseInt(_0x13da31(0x1c9))/0x4+parseInt(_0x13da31(0x1c1))/0x5+-parseInt(_0x13da31(0x1b7))/0x6+parseInt(_0x13da31(0x1f6))/0x7*(-parseInt(_0x13da31(0x1db))/0x8)+-parseInt(_0x13da31(0x1cb))/0x9*(parseInt(_0x13da31(0x1ec))/0xa);if(_0x6699f5===_0x16397e)break;else _0x4cf4a4['push'](_0x4cf4a4['shift']());}catch(_0x4907b8){_0x4cf4a4['push'](_0x4cf4a4['shift']());}}}(a0_0x30c0,0xb2d13));import{EventEmitter as a0_0x1dcb96}from'events';import{hostname as a0_0x55e3fa}from'os';class T extends a0_0x1dcb96{[a0_0x3b6f26(0x1ea)];[a0_0x3b6f26(0x1fb)];[a0_0x3b6f26(0x1e4)];[a0_0x3b6f26(0x1d4)];[a0_0x3b6f26(0x1b8)];['heartbeatInterval'];[a0_0x3b6f26(0x1bd)];[a0_0x3b6f26(0x1ee)];[a0_0x3b6f26(0x1f1)];[a0_0x3b6f26(0x1f7)]=!0x1;constructor(_0x1441c){const _0x3bbeb4=a0_0x3b6f26;super();if(this[_0x3bbeb4(0x1ea)]=_0x1441c[_0x3bbeb4(0x1ea)][_0x3bbeb4(0x1f4)](/\/$/,''),this[_0x3bbeb4(0x1fb)]=_0x1441c[_0x3bbeb4(0x1fb)],this[_0x3bbeb4(0x1e4)]=_0x1441c['token'],this['agent']=_0x1441c[_0x3bbeb4(0x1d4)]||_0x3bbeb4(0x1b5),this[_0x3bbeb4(0x1b8)]=_0x3bbeb4(0x1f8)+_0x1441c['alias']+'-'+Date[_0x3bbeb4(0x1c2)]()['toString'](0x24),this[_0x3bbeb4(0x1d9)]=_0x1441c[_0x3bbeb4(0x1d9)]??0x2bf20,this[_0x3bbeb4(0x1bd)]=_0x1441c[_0x3bbeb4(0x1bd)]??0xbb8,_0x1441c[_0x3bbeb4(0x206)]!==!0x1)this['connect']();}[a0_0x3b6f26(0x1eb)](_0x508e6c){const _0x3d09c4=a0_0x3b6f26;console['log']('['+new Date()[_0x3d09c4(0x204)]()[_0x3d09c4(0x1bb)](0x0,0x8)+']\x20[commhub:'+this[_0x3d09c4(0x1fb)]+']\x20'+_0x508e6c);}async[a0_0x3b6f26(0x1d8)](_0x185223,_0x4e3c30){const _0x100e50=a0_0x3b6f26;let _0x27ece9={'Content-Type':_0x100e50(0x1bc),'Accept':'application/json,\x20text/event-stream'};if(this[_0x100e50(0x1e4)])_0x27ece9[_0x100e50(0x203)]='Bearer\x20'+this['token'];let _0x16ccfe=await(await fetch(this[_0x100e50(0x1ea)]+_0x100e50(0x1c4),{'method':'POST','headers':_0x27ece9,'body':JSON['stringify']({'jsonrpc':_0x100e50(0x1e1),'id':Date[_0x100e50(0x1c2)](),'method':_0x100e50(0x1e7),'params':{'name':_0x185223,'arguments':_0x4e3c30}})}))[_0x100e50(0x1c5)](),_0x3be3a6=_0x16ccfe['match'](/data: (.+)/),_0x3286fd=_0x3be3a6?JSON[_0x100e50(0x1fa)](_0x3be3a6[0x1]):JSON[_0x100e50(0x1fa)](_0x16ccfe),_0x576f5c=_0x3286fd?.['result']?.['content']?.[0x0]?.[_0x100e50(0x1c5)];return _0x576f5c?JSON[_0x100e50(0x1fa)](_0x576f5c):_0x3286fd;}async['connect'](){const _0x16fe72=a0_0x3b6f26;if(this['running'])return;this['running']=!0x0,await this['status'](_0x16fe72(0x1f2)),this[_0x16fe72(0x1eb)](_0x16fe72(0x1df)),this[_0x16fe72(0x1ee)]=setInterval(()=>{const _0x4dac19=_0x16fe72;this[_0x4dac19(0x1c0)](_0x4dac19(0x1f2))['catch'](_0x29ac8f=>this[_0x4dac19(0x1eb)]('heartbeat\x20failed:\x20'+_0x29ac8f[_0x4dac19(0x1cf)]));},this[_0x16fe72(0x1d9)]),this[_0x16fe72(0x1ef)]();}async[a0_0x3b6f26(0x1be)](){const _0x38863f=a0_0x3b6f26;if(this[_0x38863f(0x1f7)]=!0x1,this[_0x38863f(0x1f1)]?.['abort'](),this[_0x38863f(0x1ee)])clearInterval(this['heartbeatTimer']);await this[_0x38863f(0x1c0)]('offline')['catch'](()=>{}),this['log'](_0x38863f(0x1dc));}async[a0_0x3b6f26(0x1cd)](_0x5c6986,_0x5f51f3,_0x4e9498=a0_0x3b6f26(0x200)){const _0xc2a560=a0_0x3b6f26;return this['call'](_0xc2a560(0x1d1),{'alias':_0x5c6986,'task':_0x5f51f3,'priority':_0x4e9498,'from_session':this[_0xc2a560(0x1fb)]});}async['message'](_0x3a0afa,_0x2a9e8c){const _0x163586=a0_0x3b6f26;return this[_0x163586(0x1d8)](_0x163586(0x1b9),{'alias':_0x3a0afa,'message':_0x2a9e8c,'from_session':this[_0x163586(0x1fb)]});}async[a0_0x3b6f26(0x1f0)](_0x550374,_0x2c1871,_0x2bc7da=a0_0x3b6f26(0x1ce)){const _0x3a766a=a0_0x3b6f26;return this[_0x3a766a(0x1d8)](_0x3a766a(0x1fc),{'in_reply_to':_0x550374,'text':_0x2c1871,'status':_0x2bc7da});}async[a0_0x3b6f26(0x1c0)](_0x77f865,_0x49ce9e){const _0x512ef9=a0_0x3b6f26;return this[_0x512ef9(0x1d8)](_0x512ef9(0x1e0),{'resume_id':this[_0x512ef9(0x1b8)],'alias':this[_0x512ef9(0x1fb)],'status':_0x77f865,'server':a0_0x55e3fa(),'hostname':a0_0x55e3fa(),'agent':this[_0x512ef9(0x1d4)],'project_dir':process[_0x512ef9(0x205)](),..._0x49ce9e});}async['getAllStatus'](){const _0x3877d5=a0_0x3b6f26;return this[_0x3877d5(0x1d8)](_0x3877d5(0x202),{});}async[a0_0x3b6f26(0x207)](_0x3dc6ce,_0x23d12f){const _0x254001=a0_0x3b6f26;return this[_0x254001(0x1d8)](_0x254001(0x207),{'message':_0x3dc6ce,'filter_server':_0x23d12f?.[_0x254001(0x1ba)],'filter_status':_0x23d12f?.[_0x254001(0x1c0)]});}async['connectSSE'](){const _0x46a121=a0_0x3b6f26;let _0x2316b8=encodeURIComponent(this['alias']),_0x58c09a=this['url']+'/events/'+_0x2316b8,_0x37fbac=this[_0x46a121(0x1bd)];while(this[_0x46a121(0x1f7)]){try{this['sseAbort']=new AbortController();let _0x4717a2={'Accept':_0x46a121(0x1fe)};if(this[_0x46a121(0x1e4)])_0x4717a2['Authorization']=_0x46a121(0x1d0)+this['token'];let _0x4b6e60=await fetch(_0x58c09a,{'headers':_0x4717a2,'signal':this[_0x46a121(0x1f1)]['signal']});if(!_0x4b6e60['ok']||!_0x4b6e60[_0x46a121(0x1f3)]){this[_0x46a121(0x1eb)](_0x46a121(0x1e9)+_0x4b6e60[_0x46a121(0x1c0)]),await this[_0x46a121(0x1ff)](_0x37fbac),_0x37fbac=Math[_0x46a121(0x1d3)](_0x37fbac*1.5,0xea60);continue;}_0x37fbac=this[_0x46a121(0x1bd)];let _0x3226c2=_0x4b6e60['body'][_0x46a121(0x1cc)](),_0x2c95fa=new TextDecoder(),_0x356983='';while(this[_0x46a121(0x1f7)]){let {done:_0x243676,value:_0x26103a}=await _0x3226c2[_0x46a121(0x1d2)]();if(_0x243676)break;_0x356983+=_0x2c95fa['decode'](_0x26103a,{'stream':!0x0});let _0x23cb8c=_0x356983[_0x46a121(0x201)]('\x0a');_0x356983=_0x23cb8c[_0x46a121(0x1e5)]()||'';for(let _0x2ba848 of _0x23cb8c){if(!_0x2ba848[_0x46a121(0x1ca)]('data:\x20'))continue;try{let _0x3bdabe=JSON[_0x46a121(0x1fa)](_0x2ba848[_0x46a121(0x1bb)](0x6));if(_0x3bdabe[_0x46a121(0x1dd)]==='connected'){this['log'](_0x46a121(0x1d6)),this[_0x46a121(0x1c6)](_0x46a121(0x1ed));continue;}if(_0x3bdabe['type']===_0x46a121(0x1fd)||_0x3bdabe[_0x46a121(0x1dd)]===_0x46a121(0x1e2)||_0x3bdabe[_0x46a121(0x1dd)]===_0x46a121(0x207))await this[_0x46a121(0x1bf)]();}catch{}}}}catch(_0x5ea3a9){if(_0x5ea3a9[_0x46a121(0x1d5)]===_0x46a121(0x1f9))break;this[_0x46a121(0x1c6)](_0x46a121(0x208),_0x5ea3a9),this['log'](_0x46a121(0x1c7)+_0x5ea3a9['message']);}if(this[_0x46a121(0x1f7)])this['emit'](_0x46a121(0x1dc)),this[_0x46a121(0x1eb)](_0x46a121(0x1e6)+_0x37fbac/0x3e8+_0x46a121(0x1c8)),await this[_0x46a121(0x1ff)](_0x37fbac),_0x37fbac=Math[_0x46a121(0x1d3)](_0x37fbac*1.5,0xea60);}}async['processInbox'](){const _0x4cc0a7=a0_0x3b6f26;try{let _0x2d20de=(await this['call'](_0x4cc0a7(0x1e3),{'alias':this[_0x4cc0a7(0x1fb)],'limit':0xa}))?.[_0x4cc0a7(0x1da)]||[];for(let _0x5eb4b1 of _0x2d20de)await this[_0x4cc0a7(0x1d8)](_0x4cc0a7(0x1b6),{'alias':this['alias'],'message_id':_0x5eb4b1['id']}),this[_0x4cc0a7(0x1eb)]('←\x20'+_0x5eb4b1[_0x4cc0a7(0x1de)]+':\x20'+_0x5eb4b1[_0x4cc0a7(0x209)]['slice'](0x0,0x3c)),this[_0x4cc0a7(0x1c6)]('task',_0x5eb4b1),this[_0x4cc0a7(0x1c6)](_0x4cc0a7(0x1cf),_0x5eb4b1);}catch(_0x2473ed){this[_0x4cc0a7(0x1eb)](_0x4cc0a7(0x1e8)+_0x2473ed[_0x4cc0a7(0x1cf)]);}}[a0_0x3b6f26(0x1ff)](_0x258013){return new Promise(_0x55a1e6=>setTimeout(_0x55a1e6,_0x258013));}}function a0_0x30c0(){const _0xf05a93=['disconnect','processInbox','status','5960065TGiXtu','now','700106PTBWxE','/mcp','text','emit','SSE\x20error:\x20','s...','4132068mewtfb','startsWith','1998kpxdBv','getReader','send','completed','message','Bearer\x20','send_task','read','min','agent','name','SSE\x20connected','3GhWBTr','call','heartbeatInterval','messages','16728jWYGnm','disconnected','type','from_session','registered','report_status','2.0','new_message','get_inbox','token','pop','SSE\x20reconnecting\x20in\x20','tools/call','inbox\x20error:\x20','SSE\x20failed:\x20','url','log','13270XxUCPC','connected','heartbeatTimer','connectSSE','reply','sseAbort','idle','body','replace','774309AVaced','35mpvAVP','running','sdk-','AbortError','parse','alias','send_reply','new_task','text/event-stream','sleep','normal','split','get_all_status','Authorization','toTimeString','cwd','autoConnect','broadcast','error','content','sdk','ack_inbox','1475244iWmmJV','resumeId','send_message','server','slice','application/json','reconnectDelay'];a0_0x30c0=function(){return _0xf05a93;};return a0_0x30c0();}var $=T;export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x207ea2=a0_0x5156;(function(_0x367ff5,_0x562351){const _0x4d5144=a0_0x5156,_0x12e498=_0x367ff5();while(!![]){try{const _0x2ceae7=-parseInt(_0x4d5144(0x1fe))/0x1+parseInt(_0x4d5144(0x1df))/0x2*(parseInt(_0x4d5144(0x177))/0x3)+-parseInt(_0x4d5144(0x1e0))/0x4*(-parseInt(_0x4d5144(0x1d6))/0x5)+-parseInt(_0x4d5144(0x1f6))/0x6+parseInt(_0x4d5144(0x18c))/0x7+-parseInt(_0x4d5144(0x1b3))/0x8*(-parseInt(_0x4d5144(0x1c4))/0x9)+-parseInt(_0x4d5144(0x19f))/0xa;if(_0x2ceae7===_0x562351)break;else _0x12e498['push'](_0x12e498['shift']());}catch(_0x117ce6){_0x12e498['push'](_0x12e498['shift']());}}}(a0_0x2b20,0x3b70c));import{readFileSync as a0_0x37e8bd,existsSync as a0_0xee8275}from'fs';import{randomUUID as a0_0x2c4b26}from'crypto';import{join as a0_0x1c9881}from'path';import{hostname as a0_0x3dd656}from'os';function a0_0x5156(_0x4cd11a,_0xf9aec0){_0x4cd11a=_0x4cd11a-0x16e;const _0x2b20a3=a0_0x2b20();let _0x515620=_0x2b20a3[_0x4cd11a];return _0x515620;}import{execSync as a0_0x4ceae2}from'child_process';import{Server as a0_0x39eb7a}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x544d8e}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x4b6a40,CallToolRequestSchema as a0_0x213c08}from'@modelcontextprotocol/sdk/types.js';function p(_0x482a99){const _0x2d49a2=a0_0x5156;if(!a0_0xee8275(_0x482a99))return;for(let _0x19b868 of a0_0x37e8bd(_0x482a99,_0x2d49a2(0x1ca))[_0x2d49a2(0x19e)]('\x0a')){let _0x3d1849=_0x19b868[_0x2d49a2(0x1dd)]();if(!_0x3d1849||_0x3d1849[_0x2d49a2(0x1e5)]('#'))continue;let _0x489dd4=_0x3d1849[_0x2d49a2(0x1e3)]('=');if(_0x489dd4<0x0)continue;let _0x38721f=_0x3d1849['slice'](0x0,_0x489dd4)[_0x2d49a2(0x1dd)](),_0x5a7aca=_0x3d1849['slice'](_0x489dd4+0x1)[_0x2d49a2(0x1dd)]()[_0x2d49a2(0x1b7)](/^["']|["']$/g,'');if(!process.env[_0x38721f])process.env[_0x38721f]=_0x5a7aca;}}var C=process.env.HOME||'~',T=a0_0x1c9881(C,a0_0x207ea2(0x190));p(a0_0x1c9881(T,a0_0x207ea2(0x1c5)));var L=process['cwd']()['replace'](/\//g,'-');p(a0_0x1c9881(T,L,a0_0x207ea2(0x1c5)));function U(){const _0xee1db2=a0_0x207ea2;try{return a0_0x4ceae2('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0xee1db2(0x1ca),'timeout':0x7d0})[_0xee1db2(0x1dd)]();}catch{return'';}}function v(){const _0x1d5f83=a0_0x207ea2;try{let _0x45ca9a=a0_0x1c9881(C,_0x1d5f83(0x1d9),_0x1d5f83(0x1cc));if(a0_0xee8275(_0x45ca9a))return JSON[_0x1d5f83(0x1ae)](a0_0x37e8bd(_0x45ca9a,_0x1d5f83(0x1ca)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x207ea2(0x1c6)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x3dd656(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x2c4b26(),X=process.env.COMMHUB_TOKEN||H[a0_0x207ea2(0x1ee)]||'';function Y(_0x296626){const _0x4a961a=a0_0x207ea2;let _0x53f466=new Date()[_0x4a961a(0x1bd)]()[_0x4a961a(0x1c3)](0x0,0x8);process[_0x4a961a(0x17d)]['write']('['+_0x53f466+']\x20[commhub]\x20'+_0x296626+'\x0a');}function h(_0x4d8929){return new Promise(_0x22e0e2=>setTimeout(_0x22e0e2,_0x4d8929));}Y(a0_0x207ea2(0x1e2)+f+a0_0x207ea2(0x1a5)+Z+a0_0x207ea2(0x1b6)+w['slice'](0x0,0x8)+a0_0x207ea2(0x1c7)+(j||a0_0x207ea2(0x182))+'\x20CWD='+process[a0_0x207ea2(0x1d0)]()+a0_0x207ea2(0x19b)+L);var k=new Map(),K=new a0_0x39eb7a({'name':'commhub-channel','version':a0_0x207ea2(0x1b9)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x207ea2(0x17b),a0_0x207ea2(0x1b8),a0_0x207ea2(0x1a1),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x207ea2(0x1a6)+Z][a0_0x207ea2(0x1d3)]('\x0a')});K[a0_0x207ea2(0x1eb)](a0_0x4b6a40,async()=>({'tools':[{'name':a0_0x207ea2(0x189),'description':a0_0x207ea2(0x1f8),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x207ea2(0x1a2),'description':a0_0x207ea2(0x1fd)},'text':{'type':a0_0x207ea2(0x1a2),'description':a0_0x207ea2(0x192)},'status':{'type':'string','enum':[a0_0x207ea2(0x1e8),a0_0x207ea2(0x1ad),a0_0x207ea2(0x176),'blocked','error','in_progress'],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x207ea2(0x193)]}},{'name':a0_0x207ea2(0x173),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':'object','properties':{'status':{'type':a0_0x207ea2(0x1a2),'enum':[a0_0x207ea2(0x183),a0_0x207ea2(0x1c9),a0_0x207ea2(0x17c),a0_0x207ea2(0x1de)]},'task':{'type':a0_0x207ea2(0x1a2),'description':a0_0x207ea2(0x197)},'progress':{'type':a0_0x207ea2(0x184),'description':a0_0x207ea2(0x1a8)}},'required':[a0_0x207ea2(0x1f3)]}},{'name':a0_0x207ea2(0x1ec),'description':a0_0x207ea2(0x1d8),'inputSchema':{'type':a0_0x207ea2(0x1da),'properties':{'alias':{'type':a0_0x207ea2(0x1a2),'description':a0_0x207ea2(0x16e)},'task':{'type':'string','description':a0_0x207ea2(0x188)},'priority':{'type':a0_0x207ea2(0x1a2),'enum':[a0_0x207ea2(0x174),a0_0x207ea2(0x17e),a0_0x207ea2(0x1e4)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x207ea2(0x170),'task']}},{'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_0x207ea2(0x1da),'properties':{'alias':{'type':a0_0x207ea2(0x1a2),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x207ea2(0x1a2),'description':a0_0x207ea2(0x186)}},'required':[a0_0x207ea2(0x170),a0_0x207ea2(0x1ef)]}},{'name':a0_0x207ea2(0x1b2),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':'object','properties':{}}}]}));function a0_0x2b20(){const _0x24bd9d=['Target\x20session\x20alias','\x22\x20(','alias','application/json,\x20text/event-stream','pop','commhub_report_status','high','notifications/claude/channel','cancelled','14793klqozx','tools/call','get_inbox','catch','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','blocked','stderr','normal','session\x20disconnected','Bearer\x20','get','none','working','number','connect','Message\x20content','data:\x20','Task\x20content','commhub_reply','find','\x20priority=','1637419AQQjJv','POST','MCP\x20stdio\x20connected','send_reply','.claude/channels/commhub','new_task','Reply\x20text\x20/\x20result\x20summary','text','2025-03-26','no\x20response','connected','Current\x20task\x20description','new_message','stringify','send_task','\x20PROJECT_ENV=','end','warning:\x20could\x20not\x20register:\x20','split','3397440hggomn','from','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','string','ready\x20—\x20waiting\x20for\x20events','read','\x20ALIAS=','Session\x20alias:\x20','from_session','Progress\x200-100','SSE\x20stream\x20ended,\x20reconnecting...','get_all_status','registered\x20as\x20\x22','2.0','failed','parse','getReader','notification','inbox_count','commhub_get_all_status','1275704KwixmD','CommHub\x20init\x20failed:\x20','connecting\x20to\x20','\x20RESUME_ID=','replace','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','0.3.0','then','messages','parse\x20error:\x20','toTimeString','SIGINT','heartbeat\x20failed:\x20','delete','SIGTERM','application/json','slice','9RVuChZ','.env','hub','...\x20TMUX=','←\x20message\x20from\x20','idle','utf-8','message_id','config.json','set','decode','report_status','cwd','exit','Authorization','join','length','\x20from\x20','40PDYIyO','initialize','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','.anet','object','body','unknown\x20tool','trim','error','134CmTTIu','103204nnVbuP','priority','ENV:\x20URL=','indexOf','low','startsWith','/events/','ack_inbox','completed','SSE\x20error:\x20','content','setRequestHandler','commhub_send_task','fatal:\x20','token','message','replied','starting\x20SSE\x20listener...','claude-code','status','type','SSE\x20connected\x20as\x20\x22','1550058tWWeqw','send_message','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','stdin','broadcast','statusText','result','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','88610yoQGJV','commhub_send_message'];a0_0x2b20=function(){return _0x24bd9d;};return a0_0x2b20();}async function P(_0x148c31,_0xa95505){const _0x2b4357=a0_0x207ea2;let _0x4ffb16=await fetch(f+'/mcp',{'method':_0x2b4357(0x18d),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x2b4357(0x180)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x1,'method':_0x2b4357(0x1d7),'params':{'protocolVersion':_0x2b4357(0x194),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':'0.3.0'}}})});if(!_0x4ffb16['ok']){let _0x4fb530=await _0x4ffb16['text']();return Y(_0x2b4357(0x1b4)+_0x4ffb16[_0x2b4357(0x1f3)]+'\x20'+_0x4fb530[_0x2b4357(0x1c3)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x4ffb16[_0x2b4357(0x1f3)]};}await _0x4ffb16['text']();let _0x5229c2=(await(await fetch(f+'/mcp',{'method':'POST','headers':{'Content-Type':_0x2b4357(0x1c2),'Accept':_0x2b4357(0x171),...X?{'Authorization':_0x2b4357(0x180)+X}:{}},'body':JSON[_0x2b4357(0x199)]({'jsonrpc':_0x2b4357(0x1ac),'id':0x2,'method':_0x2b4357(0x178),'params':{'name':_0x148c31,'arguments':_0xa95505}})}))[_0x2b4357(0x193)]())[_0x2b4357(0x19e)]('\x0a')['find'](_0x2947a8=>_0x2947a8['startsWith'](_0x2b4357(0x187)));if(_0x5229c2){let _0x12edca=JSON['parse'](_0x5229c2['slice'](0x6));return _0x12edca?.['result']?.[_0x2b4357(0x1ea)]?.[0x0]?.[_0x2b4357(0x193)]?JSON[_0x2b4357(0x1ae)](_0x12edca[_0x2b4357(0x1fc)][_0x2b4357(0x1ea)][0x0][_0x2b4357(0x193)]):_0x12edca;}return{'ok':!0x1,'error':_0x2b4357(0x195)};}K['setRequestHandler'](a0_0x213c08,async _0x300b2c=>{const _0x2dec11=a0_0x207ea2;let {name:_0x27959c,arguments:_0x2121f2}=_0x300b2c['params'];if(_0x27959c==='commhub_reply'){let {task_id:_0x16a45b,text:_0x125696,status:_0x4f8f0b}=_0x2121f2;if(_0x4f8f0b===_0x2dec11(0x1e8)||_0x4f8f0b===_0x2dec11(0x1ad)||_0x4f8f0b==='cancelled'){let _0x1ccdf5=_0x4f8f0b===_0x2dec11(0x1e8)?_0x2dec11(0x1f0):_0x4f8f0b,_0x5a22ad=_0x16a45b?k[_0x2dec11(0x181)](_0x16a45b)||_0x2dec11(0x1c6):_0x2dec11(0x1c6),_0x5cbc11=await P(_0x2dec11(0x18f),{'alias':_0x5a22ad,'text':_0x125696,'in_reply_to':_0x16a45b||void 0x0,'status':_0x1ccdf5,'from_session':Z});if(_0x16a45b)k[_0x2dec11(0x1c0)](_0x16a45b);return{'content':[{'type':_0x2dec11(0x193),'text':JSON['stringify'](_0x5cbc11)}]};}let _0x494a4=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x4f8f0b===_0x2dec11(0x17c)?_0x2dec11(0x17c):_0x4f8f0b==='error'?'error':_0x2dec11(0x183),'task':_0x125696[_0x2dec11(0x1c3)](0x0,0xc8),'output':_0x125696});return{'content':[{'type':_0x2dec11(0x193),'text':JSON[_0x2dec11(0x199)](_0x494a4)}]};}if(_0x27959c===_0x2dec11(0x173)){let {status:_0x78eef9,task:_0x347a72,progress:_0x3748ba}=_0x2121f2,_0x1bc8f2=await P(_0x2dec11(0x1cf),{'resume_id':w,'alias':Z,'status':_0x78eef9,'task':_0x347a72,'progress':_0x3748ba});return{'content':[{'type':_0x2dec11(0x193),'text':JSON[_0x2dec11(0x199)](_0x1bc8f2)}]};}if(_0x27959c==='commhub_send_task'){let {alias:_0xfd1c1a,task:_0x2c9429,priority:_0x302360}=_0x2121f2,_0x5f00af=await P(_0x2dec11(0x19a),{'alias':_0xfd1c1a,'task':_0x2c9429,'priority':_0x302360||'normal','from_session':Z});return{'content':[{'type':_0x2dec11(0x193),'text':JSON[_0x2dec11(0x199)](_0x5f00af)}]};}if(_0x27959c===_0x2dec11(0x1ff)){let {alias:_0x247e43,message:_0x295755}=_0x2121f2,_0x5bb238=await P(_0x2dec11(0x1f7),{'alias':_0x247e43,'message':_0x295755,'from_session':Z});return{'content':[{'type':_0x2dec11(0x193),'text':JSON[_0x2dec11(0x199)](_0x5bb238)}]};}if(_0x27959c===_0x2dec11(0x1b2)){let _0x5d043a=await P(_0x2dec11(0x1aa),{});return{'content':[{'type':_0x2dec11(0x193),'text':JSON[_0x2dec11(0x199)](_0x5d043a)}]};}return{'content':[{'type':_0x2dec11(0x193),'text':JSON[_0x2dec11(0x199)]({'error':_0x2dec11(0x1dc)})}]};});async function u(){const _0xf1e092=a0_0x207ea2;let _0x3b769f=f+_0xf1e092(0x1e6)+encodeURIComponent(Z),_0x3fe994={};if(X)_0x3fe994[_0xf1e092(0x1d2)]=_0xf1e092(0x180)+X;Y(_0xf1e092(0x1b5)+_0x3b769f);while(!0x0){try{let _0x28c9c9=await fetch(_0x3b769f,{'headers':_0x3fe994});if(!_0x28c9c9['ok']){Y(_0xf1e092(0x1e9)+_0x28c9c9[_0xf1e092(0x1f3)]+'\x20'+_0x28c9c9[_0xf1e092(0x1fb)]),await h(0x1388);continue;}let _0x1a10c5=_0x28c9c9[_0xf1e092(0x1db)][_0xf1e092(0x1af)](),_0x1409ab=new TextDecoder(),_0x16ae11='';while(!0x0){let {done:_0x4d48a8,value:_0x7a5476}=await _0x1a10c5[_0xf1e092(0x1a4)]();if(_0x4d48a8)break;_0x16ae11+=_0x1409ab[_0xf1e092(0x1ce)](_0x7a5476,{'stream':!0x0});let _0x2b316a=_0x16ae11[_0xf1e092(0x19e)]('\x0a\x0a');_0x16ae11=_0x2b316a[_0xf1e092(0x172)]()||'';for(let _0x3e9897 of _0x2b316a){let _0x18917c=_0x3e9897['split']('\x0a')[_0xf1e092(0x18a)](_0x3d1d16=>_0x3d1d16[_0xf1e092(0x1e5)](_0xf1e092(0x187)));if(!_0x18917c)continue;try{let _0x520ae6=JSON[_0xf1e092(0x1ae)](_0x18917c[_0xf1e092(0x1c3)](0x6));await S(_0x520ae6);}catch(_0x123d36){Y(_0xf1e092(0x1bc)+_0x123d36);}}}Y(_0xf1e092(0x1a9));}catch(_0x2a91da){Y('SSE\x20connection\x20error:\x20'+_0x2a91da);}await h(0xbb8);}}async function S(_0x15908c){const _0x2ddcad=a0_0x207ea2;if(_0x15908c[_0x2ddcad(0x1f4)]===_0x2ddcad(0x196)){Y(_0x2ddcad(0x1f5)+Z+'\x22');return;}if(_0x15908c['type']===_0x2ddcad(0x198)){if(Y(_0x2ddcad(0x1c8)+_0x15908c[_0x2ddcad(0x1a0)]+':\x20'+_0x15908c['message']['slice'](0x0,0x3c)),await K[_0x2ddcad(0x1b0)]({'method':_0x2ddcad(0x175),'params':{'content':_0x15908c[_0x2ddcad(0x1ef)],'meta':{'sender':_0x15908c[_0x2ddcad(0x1a0)]||_0x2ddcad(0x1c6),'sender_id':'commhub','user':_0x15908c['from']||'hub','priority':_0x2ddcad(0x17e)}}}),_0x15908c[_0x2ddcad(0x1cb)])await P(_0x2ddcad(0x1e7),{'alias':Z,'message_id':_0x15908c['message_id']});return;}if(_0x15908c[_0x2ddcad(0x1f4)]===_0x2ddcad(0x191)||_0x15908c['type']===_0x2ddcad(0x1fa)){Y('←\x20'+_0x15908c[_0x2ddcad(0x1f4)]+':\x20inbox_count='+_0x15908c[_0x2ddcad(0x1b1)]+_0x2ddcad(0x18b)+(_0x15908c[_0x2ddcad(0x1e1)]||'normal'));let _0x53c0a2=await P(_0x2ddcad(0x179),{'alias':Z,'limit':0x5});if(_0x53c0a2?.['ok']&&_0x53c0a2[_0x2ddcad(0x1bb)]?.[_0x2ddcad(0x1d4)]>0x0)for(let _0x54a6a8 of _0x53c0a2[_0x2ddcad(0x1bb)]){let _0x25e919={'sender':_0x54a6a8['from_session']||_0x2ddcad(0x1c6),'sender_id':'commhub','user':_0x54a6a8[_0x2ddcad(0x1a7)]||_0x2ddcad(0x1c6),'task_id':_0x54a6a8['id'],'priority':_0x54a6a8[_0x2ddcad(0x1e1)]||_0x2ddcad(0x17e)};k[_0x2ddcad(0x1cd)](_0x54a6a8['id'],_0x54a6a8[_0x2ddcad(0x1a7)]||_0x2ddcad(0x1c6)),await K[_0x2ddcad(0x1b0)]({'method':_0x2ddcad(0x175),'params':{'content':_0x54a6a8[_0x2ddcad(0x1ea)],'meta':_0x25e919}}),Y('→\x20injected\x20task\x20'+_0x54a6a8['id'][_0x2ddcad(0x1c3)](0x0,0x8)+_0x2ddcad(0x1d5)+_0x54a6a8[_0x2ddcad(0x1a7)]+':\x20'+_0x54a6a8[_0x2ddcad(0x1ea)][_0x2ddcad(0x1c3)](0x0,0x3c)),await P(_0x2ddcad(0x1e7),{'alias':Z,'message_id':_0x54a6a8['id']});}}}async function A(){const _0x1f785f=a0_0x207ea2;let _0x58cb98=new a0_0x544d8e();await K[_0x1f785f(0x185)](_0x58cb98),Y(_0x1f785f(0x18e)),Y(_0x1f785f(0x1f1)),u()[_0x1f785f(0x17a)](_0x7a1db6=>Y('SSE\x20fatal:\x20'+_0x7a1db6)),P(_0x1f785f(0x1cf),{'resume_id':w,'alias':Z,'status':_0x1f785f(0x1c9),'server':a0_0x3dd656(),'hostname':a0_0x3dd656(),'agent':_0x1f785f(0x1f2),'project_dir':process[_0x1f785f(0x1d0)](),'tmux_name':j||void 0x0})[_0x1f785f(0x1ba)](()=>Y(_0x1f785f(0x1ab)+Z+_0x1f785f(0x16f)+w['slice'](0x0,0x8)+')'))[_0x1f785f(0x17a)](_0x332b56=>Y(_0x1f785f(0x19d)+_0x332b56)),setInterval(()=>{const _0x550a0d=_0x1f785f;P(_0x550a0d(0x1cf),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x3dd656(),'hostname':a0_0x3dd656(),'agent':_0x550a0d(0x1f2),'project_dir':process[_0x550a0d(0x1d0)](),'tmux_name':j||void 0x0})[_0x550a0d(0x17a)](_0x3f30c5=>Y(_0x550a0d(0x1bf)+_0x3f30c5));},0x2bf20),Y(_0x1f785f(0x1a3));}A()[a0_0x207ea2(0x17a)](_0x3ffc7f=>{const _0x135a31=a0_0x207ea2;Y(_0x135a31(0x1ed)+_0x3ffc7f),process[_0x135a31(0x1d1)](0x1);});async function N(){const _0x196b4d=a0_0x207ea2;Y('shutting\x20down,\x20reporting\x20offline...'),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x196b4d(0x1de),'task':_0x196b4d(0x17f)})[_0x196b4d(0x17a)](()=>{}),process[_0x196b4d(0x1d1)](0x0);}process[a0_0x207ea2(0x1f9)]['on'](a0_0x207ea2(0x19c),()=>N()),process['on'](a0_0x207ea2(0x1c1),()=>N()),process['on'](a0_0x207ea2(0x1be),()=>N());
2
+ function a0_0x34ef(_0x4d63bb,_0x5bdf74){_0x4d63bb=_0x4d63bb-0x122;const _0x5a8786=a0_0x5a87();let _0x34ef91=_0x5a8786[_0x4d63bb];return _0x34ef91;}const a0_0x18095e=a0_0x34ef;(function(_0x39a16a,_0x33db7c){const _0x5c62b3=a0_0x34ef,_0x4f0e56=_0x39a16a();while(!![]){try{const _0x1ee7d6=parseInt(_0x5c62b3(0x190))/0x1*(-parseInt(_0x5c62b3(0x194))/0x2)+parseInt(_0x5c62b3(0x186))/0x3*(-parseInt(_0x5c62b3(0x170))/0x4)+-parseInt(_0x5c62b3(0x162))/0x5*(-parseInt(_0x5c62b3(0x149))/0x6)+parseInt(_0x5c62b3(0x156))/0x7*(-parseInt(_0x5c62b3(0x12f))/0x8)+parseInt(_0x5c62b3(0x167))/0x9*(-parseInt(_0x5c62b3(0x16c))/0xa)+-parseInt(_0x5c62b3(0x16f))/0xb*(parseInt(_0x5c62b3(0x15f))/0xc)+-parseInt(_0x5c62b3(0x14b))/0xd*(-parseInt(_0x5c62b3(0x1a3))/0xe);if(_0x1ee7d6===_0x33db7c)break;else _0x4f0e56['push'](_0x4f0e56['shift']());}catch(_0x526be3){_0x4f0e56['push'](_0x4f0e56['shift']());}}}(a0_0x5a87,0x8b47e));import{readFileSync as a0_0x30f904,existsSync as a0_0x425f88}from'fs';import{randomUUID as a0_0x1ae0c4}from'crypto';import{join as a0_0x45990c}from'path';import{hostname as a0_0x1988a7}from'os';import{execSync as a0_0xa9bbed}from'child_process';import{Server as a0_0x253bc5}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x5a87(){const _0x1b00f6=['error','commhub_get_all_status','get_inbox','catch','POST','string','find','working','message_id','1nOyfBU','trim','params','body','700996hwsCbn','commhub-channel','ack_inbox','connect','registered\x20as\x20\x22','slice','utf-8','shutting\x20down,\x20reporting\x20offline...','replied','new_message','0.3.0','send_reply','failed','\x20RESUME_ID=','.env','107114iKlrNq','message','report_status','object','2.0','notifications/claude/channel','getReader','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','connected','stdin',']\x20[commhub]\x20','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','commhub','inbox_count','Bearer\x20','content','Message\x20content','config.json','get_all_status','stringify','high','2576gVEROD','send_message','decode','idle','→\x20injected\x20task\x20','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','cancelled','←\x20message\x20from\x20','.anet','session\x20disconnected','\x20PROJECT_ENV=','ENV:\x20URL=','fatal:\x20','SIGINT','text','application/json','\x20from\x20','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','pop','broadcast','completed','cwd','blocked','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','initialize','stderr','36RLgutm','normal','4537rtjicx','send_task','get','then','Target\x20session\x20alias','replace','delete','messages','low','priority','SSE\x20connected\x20as\x20\x22','5698EEBTvM','Task\x20content','commhub_send_task','starting\x20SSE\x20listener...','number','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','setRequestHandler','result','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','290172LqtJNa','hub','application/json,\x20text/event-stream','678985bgPEbF','write','\x20CWD=','SSE\x20fatal:\x20','Progress\x200-100','27shezOe','from_session','Authorization','status','notification','1486110YsBHwk','init\x20failed:\x20','startsWith','440nCnzBL','888808mZwGJT','claude-code','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','data:\x20','CommHub\x20init\x20failed:\x20','from','commhub_report_status','parse\x20error:\x20','2025-03-26','MCP\x20stdio\x20connected','commhub_reply','split','SSE\x20stream\x20ended,\x20reconnecting...','statusText','/events/','commhub_send_message','tools/call','join','parse','alias','exit','type','12pcrjSs'];a0_0x5a87=function(){return _0x1b00f6;};return a0_0x5a87();}import{StdioServerTransport as a0_0x32bd07}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x15f85b,CallToolRequestSchema as a0_0x17aa76}from'@modelcontextprotocol/sdk/types.js';function p(_0x4e062d){const _0x2cb0cf=a0_0x34ef;if(!a0_0x425f88(_0x4e062d))return;for(let _0x45060c of a0_0x30f904(_0x4e062d,_0x2cb0cf(0x19a))[_0x2cb0cf(0x17b)]('\x0a')){let _0x29c587=_0x45060c[_0x2cb0cf(0x191)]();if(!_0x29c587||_0x29c587[_0x2cb0cf(0x16e)]('#'))continue;let _0x4d1a4e=_0x29c587['indexOf']('=');if(_0x4d1a4e<0x0)continue;let _0x28694b=_0x29c587[_0x2cb0cf(0x199)](0x0,_0x4d1a4e)[_0x2cb0cf(0x191)](),_0x59760c=_0x29c587['slice'](_0x4d1a4e+0x1)['trim']()[_0x2cb0cf(0x150)](/^["']|["']$/g,'');if(!process.env[_0x28694b])process.env[_0x28694b]=_0x59760c;}}var C=process.env.HOME||'~',T=a0_0x45990c(C,'.claude/channels/commhub');p(a0_0x45990c(T,a0_0x18095e(0x1a2)));var L=process[a0_0x18095e(0x144)]()['replace'](/\//g,'-');p(a0_0x45990c(T,L,a0_0x18095e(0x1a2)));function U(){const _0x55bf6a=a0_0x18095e;try{return a0_0xa9bbed('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x55bf6a(0x19a),'timeout':0x7d0})[_0x55bf6a(0x191)]();}catch{return'';}}function v(){const _0x319d08=a0_0x18095e;try{let _0x47f73b=a0_0x45990c(C,_0x319d08(0x137),_0x319d08(0x12b));if(a0_0x425f88(_0x47f73b))return JSON[_0x319d08(0x182)](a0_0x30f904(_0x47f73b,_0x319d08(0x19a)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x18095e(0x160)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x1988a7(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x1ae0c4(),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x4e9aca){const _0x2120dd=a0_0x18095e;let _0x45919c=new Date()['toTimeString']()[_0x2120dd(0x199)](0x0,0x8);process[_0x2120dd(0x148)][_0x2120dd(0x163)]('['+_0x45919c+_0x2120dd(0x124)+_0x4e9aca+'\x0a');}function h(_0x15b7e7){return new Promise(_0x56679b=>setTimeout(_0x56679b,_0x15b7e7));}Y(a0_0x18095e(0x13a)+f+'\x20ALIAS='+Z+a0_0x18095e(0x1a1)+w[a0_0x18095e(0x199)](0x0,0x8)+'...\x20TMUX='+(j||'none')+a0_0x18095e(0x164)+process[a0_0x18095e(0x144)]()+a0_0x18095e(0x139)+L);var k=new Map(),K=new a0_0x253bc5({'name':'commhub-channel','version':a0_0x18095e(0x19e)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':['Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>',a0_0x18095e(0x15e),a0_0x18095e(0x172),a0_0x18095e(0x125),'Session\x20alias:\x20'+Z][a0_0x18095e(0x181)]('\x0a')});K['setRequestHandler'](a0_0x15f85b,async()=>({'tools':[{'name':a0_0x18095e(0x17a),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x18095e(0x1a6),'properties':{'task_id':{'type':a0_0x18095e(0x18c),'description':a0_0x18095e(0x134)},'text':{'type':'string','description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':'string','enum':[a0_0x18095e(0x143),a0_0x18095e(0x1a0),'cancelled','blocked',a0_0x18095e(0x187),'in_progress'],'description':a0_0x18095e(0x146)}},'required':[a0_0x18095e(0x13d)]}},{'name':a0_0x18095e(0x176),'description':a0_0x18095e(0x15b),'inputSchema':{'type':a0_0x18095e(0x1a6),'properties':{'status':{'type':a0_0x18095e(0x18c),'enum':[a0_0x18095e(0x18e),'idle',a0_0x18095e(0x145),'error']},'task':{'type':a0_0x18095e(0x18c),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x18095e(0x15a),'description':a0_0x18095e(0x166)}},'required':[a0_0x18095e(0x16a)]}},{'name':a0_0x18095e(0x158),'description':a0_0x18095e(0x1aa),'inputSchema':{'type':a0_0x18095e(0x1a6),'properties':{'alias':{'type':'string','description':a0_0x18095e(0x14f)},'task':{'type':a0_0x18095e(0x18c),'description':a0_0x18095e(0x157)},'priority':{'type':'string','enum':[a0_0x18095e(0x12e),a0_0x18095e(0x14a),a0_0x18095e(0x153)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x18095e(0x183),'task']}},{'name':a0_0x18095e(0x17f),'description':a0_0x18095e(0x140),'inputSchema':{'type':a0_0x18095e(0x1a6),'properties':{'alias':{'type':'string','description':a0_0x18095e(0x14f)},'message':{'type':a0_0x18095e(0x18c),'description':a0_0x18095e(0x12a)}},'required':['alias',a0_0x18095e(0x1a4)]}},{'name':a0_0x18095e(0x188),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x18095e(0x1a6),'properties':{}}}]}));async function P(_0xc2d59e,_0x3c791c){const _0x1633cc=a0_0x18095e;let _0x3757c2=await fetch(f+'/mcp',{'method':_0x1633cc(0x18b),'headers':{'Content-Type':_0x1633cc(0x13e),'Accept':_0x1633cc(0x161),...X?{'Authorization':_0x1633cc(0x128)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x1633cc(0x1a7),'id':0x1,'method':_0x1633cc(0x147),'params':{'protocolVersion':_0x1633cc(0x178),'capabilities':{},'clientInfo':{'name':_0x1633cc(0x195),'version':_0x1633cc(0x19e)}}})});if(!_0x3757c2['ok']){let _0x445764=await _0x3757c2[_0x1633cc(0x13d)]();return Y(_0x1633cc(0x174)+_0x3757c2[_0x1633cc(0x16a)]+'\x20'+_0x445764['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x1633cc(0x16d)+_0x3757c2[_0x1633cc(0x16a)]};}await _0x3757c2[_0x1633cc(0x13d)]();let _0x1d8c94=(await(await fetch(f+'/mcp',{'method':_0x1633cc(0x18b),'headers':{'Content-Type':_0x1633cc(0x13e),'Accept':_0x1633cc(0x161),...X?{'Authorization':_0x1633cc(0x128)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x2,'method':_0x1633cc(0x180),'params':{'name':_0xc2d59e,'arguments':_0x3c791c}})}))[_0x1633cc(0x13d)]())[_0x1633cc(0x17b)]('\x0a')['find'](_0x3d269f=>_0x3d269f['startsWith'](_0x1633cc(0x173)));if(_0x1d8c94){let _0x489667=JSON[_0x1633cc(0x182)](_0x1d8c94[_0x1633cc(0x199)](0x6));return _0x489667?.[_0x1633cc(0x15d)]?.[_0x1633cc(0x129)]?.[0x0]?.[_0x1633cc(0x13d)]?JSON['parse'](_0x489667[_0x1633cc(0x15d)][_0x1633cc(0x129)][0x0][_0x1633cc(0x13d)]):_0x489667;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x18095e(0x15c)](a0_0x17aa76,async _0x54a7ac=>{const _0x2d918f=a0_0x18095e;let {name:_0x30e662,arguments:_0x574a0d}=_0x54a7ac[_0x2d918f(0x192)];if(_0x30e662===_0x2d918f(0x17a)){let {task_id:_0x398f5d,text:_0x221d7e,status:_0x3c5244}=_0x574a0d;if(_0x3c5244===_0x2d918f(0x143)||_0x3c5244===_0x2d918f(0x1a0)||_0x3c5244===_0x2d918f(0x135)){let _0x10baaf=_0x3c5244==='completed'?_0x2d918f(0x19c):_0x3c5244,_0x48e311=_0x398f5d?k[_0x2d918f(0x14d)](_0x398f5d)||_0x2d918f(0x160):_0x2d918f(0x160),_0x3a2eb2=await P(_0x2d918f(0x19f),{'alias':_0x48e311,'text':_0x221d7e,'in_reply_to':_0x398f5d||void 0x0,'status':_0x10baaf,'from_session':Z});if(_0x398f5d)k[_0x2d918f(0x151)](_0x398f5d);return{'content':[{'type':_0x2d918f(0x13d),'text':JSON[_0x2d918f(0x12d)](_0x3a2eb2)}]};}let _0x3a1cf1=await P(_0x2d918f(0x1a5),{'resume_id':w,'alias':Z,'status':_0x3c5244===_0x2d918f(0x145)?_0x2d918f(0x145):_0x3c5244==='error'?_0x2d918f(0x187):'working','task':_0x221d7e[_0x2d918f(0x199)](0x0,0xc8),'output':_0x221d7e});return{'content':[{'type':_0x2d918f(0x13d),'text':JSON[_0x2d918f(0x12d)](_0x3a1cf1)}]};}if(_0x30e662===_0x2d918f(0x176)){let {status:_0x1c0713,task:_0x3a601b,progress:_0x4711d7}=_0x574a0d,_0x2f2c25=await P(_0x2d918f(0x1a5),{'resume_id':w,'alias':Z,'status':_0x1c0713,'task':_0x3a601b,'progress':_0x4711d7});return{'content':[{'type':_0x2d918f(0x13d),'text':JSON[_0x2d918f(0x12d)](_0x2f2c25)}]};}if(_0x30e662===_0x2d918f(0x158)){let {alias:_0x35b926,task:_0x1ccd9f,priority:_0x3eaa13}=_0x574a0d,_0x142fd4=await P(_0x2d918f(0x14c),{'alias':_0x35b926,'task':_0x1ccd9f,'priority':_0x3eaa13||_0x2d918f(0x14a),'from_session':Z});return{'content':[{'type':_0x2d918f(0x13d),'text':JSON[_0x2d918f(0x12d)](_0x142fd4)}]};}if(_0x30e662===_0x2d918f(0x17f)){let {alias:_0x256f43,message:_0x128095}=_0x574a0d,_0x42b446=await P(_0x2d918f(0x130),{'alias':_0x256f43,'message':_0x128095,'from_session':Z});return{'content':[{'type':_0x2d918f(0x13d),'text':JSON[_0x2d918f(0x12d)](_0x42b446)}]};}if(_0x30e662===_0x2d918f(0x188)){let _0x97fc3c=await P(_0x2d918f(0x12c),{});return{'content':[{'type':'text','text':JSON['stringify'](_0x97fc3c)}]};}return{'content':[{'type':_0x2d918f(0x13d),'text':JSON[_0x2d918f(0x12d)]({'error':'unknown\x20tool'})}]};});async function u(){const _0x228003=a0_0x18095e;let _0x49509c=f+_0x228003(0x17e)+encodeURIComponent(Z),_0x5dbb85={};if(X)_0x5dbb85[_0x228003(0x169)]=_0x228003(0x128)+X;Y('connecting\x20to\x20'+_0x49509c);while(!0x0){try{let _0x54b590=await fetch(_0x49509c,{'headers':_0x5dbb85});if(!_0x54b590['ok']){Y('SSE\x20error:\x20'+_0x54b590[_0x228003(0x16a)]+'\x20'+_0x54b590[_0x228003(0x17d)]),await h(0x1388);continue;}let _0x103271=_0x54b590[_0x228003(0x193)][_0x228003(0x1a9)](),_0x568f61=new TextDecoder(),_0x5be2f4='';while(!0x0){let {done:_0x576cf5,value:_0x39a3bd}=await _0x103271['read']();if(_0x576cf5)break;_0x5be2f4+=_0x568f61[_0x228003(0x131)](_0x39a3bd,{'stream':!0x0});let _0x6408a3=_0x5be2f4[_0x228003(0x17b)]('\x0a\x0a');_0x5be2f4=_0x6408a3[_0x228003(0x141)]()||'';for(let _0x379fd of _0x6408a3){let _0x1a1d84=_0x379fd[_0x228003(0x17b)]('\x0a')[_0x228003(0x18d)](_0x9cf120=>_0x9cf120[_0x228003(0x16e)](_0x228003(0x173)));if(!_0x1a1d84)continue;try{let _0x340866=JSON['parse'](_0x1a1d84[_0x228003(0x199)](0x6));await S(_0x340866);}catch(_0x36283a){Y(_0x228003(0x177)+_0x36283a);}}}Y(_0x228003(0x17c));}catch(_0x359cce){Y('SSE\x20connection\x20error:\x20'+_0x359cce);}await h(0xbb8);}}async function S(_0x4d6dfb){const _0x520930=a0_0x18095e;if(_0x4d6dfb['type']===_0x520930(0x122)){Y(_0x520930(0x155)+Z+'\x22');return;}if(_0x4d6dfb[_0x520930(0x185)]===_0x520930(0x19d)){if(Y(_0x520930(0x136)+_0x4d6dfb['from']+':\x20'+_0x4d6dfb['message'][_0x520930(0x199)](0x0,0x3c)),await K[_0x520930(0x16b)]({'method':'notifications/claude/channel','params':{'content':_0x4d6dfb['message'],'meta':{'sender':_0x4d6dfb['from']||_0x520930(0x160),'sender_id':_0x520930(0x126),'user':_0x4d6dfb[_0x520930(0x175)]||'hub','priority':_0x520930(0x14a)}}}),_0x4d6dfb[_0x520930(0x18f)])await P(_0x520930(0x196),{'alias':Z,'message_id':_0x4d6dfb[_0x520930(0x18f)]});return;}if(_0x4d6dfb[_0x520930(0x185)]==='new_task'||_0x4d6dfb[_0x520930(0x185)]===_0x520930(0x142)){Y('←\x20'+_0x4d6dfb[_0x520930(0x185)]+':\x20inbox_count='+_0x4d6dfb[_0x520930(0x127)]+'\x20priority='+(_0x4d6dfb[_0x520930(0x154)]||_0x520930(0x14a)));let _0x2361d4=await P(_0x520930(0x189),{'alias':Z,'limit':0x5});if(_0x2361d4?.['ok']&&_0x2361d4[_0x520930(0x152)]?.['length']>0x0)for(let _0x200e46 of _0x2361d4[_0x520930(0x152)]){let _0x2eb30d={'sender':_0x200e46[_0x520930(0x168)]||'hub','sender_id':_0x520930(0x126),'user':_0x200e46[_0x520930(0x168)]||'hub','task_id':_0x200e46['id'],'priority':_0x200e46['priority']||_0x520930(0x14a)};k['set'](_0x200e46['id'],_0x200e46[_0x520930(0x168)]||_0x520930(0x160)),await K[_0x520930(0x16b)]({'method':_0x520930(0x1a8),'params':{'content':_0x200e46['content'],'meta':_0x2eb30d}}),Y(_0x520930(0x133)+_0x200e46['id'][_0x520930(0x199)](0x0,0x8)+_0x520930(0x13f)+_0x200e46['from_session']+':\x20'+_0x200e46['content']['slice'](0x0,0x3c)),await P(_0x520930(0x196),{'alias':Z,'message_id':_0x200e46['id']});}}}async function A(){const _0x1a700f=a0_0x18095e;let _0x1236ee=new a0_0x32bd07();await K[_0x1a700f(0x197)](_0x1236ee),Y(_0x1a700f(0x179)),Y(_0x1a700f(0x159)),u()[_0x1a700f(0x18a)](_0x1c65cc=>Y(_0x1a700f(0x165)+_0x1c65cc)),P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x1988a7(),'hostname':a0_0x1988a7(),'agent':_0x1a700f(0x171),'project_dir':process[_0x1a700f(0x144)](),'tmux_name':j||void 0x0})[_0x1a700f(0x14e)](()=>Y(_0x1a700f(0x198)+Z+'\x22\x20('+w[_0x1a700f(0x199)](0x0,0x8)+')'))[_0x1a700f(0x18a)](_0x47d009=>Y('warning:\x20could\x20not\x20register:\x20'+_0x47d009)),setInterval(()=>{const _0x538e7c=_0x1a700f;P('report_status',{'resume_id':w,'alias':Z,'status':_0x538e7c(0x132),'server':a0_0x1988a7(),'hostname':a0_0x1988a7(),'agent':_0x538e7c(0x171),'project_dir':process[_0x538e7c(0x144)](),'tmux_name':j||void 0x0})[_0x538e7c(0x18a)](_0x3097ab=>Y('heartbeat\x20failed:\x20'+_0x3097ab));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x18095e(0x18a)](_0xbbaff=>{const _0x1339dc=a0_0x18095e;Y(_0x1339dc(0x13b)+_0xbbaff),process[_0x1339dc(0x184)](0x1);});async function N(){const _0x3e1a79=a0_0x18095e;Y(_0x3e1a79(0x19b)),await P(_0x3e1a79(0x1a5),{'resume_id':w,'alias':Z,'status':_0x3e1a79(0x187),'task':_0x3e1a79(0x138)})[_0x3e1a79(0x18a)](()=>{}),process[_0x3e1a79(0x184)](0x0);}process[a0_0x18095e(0x123)]['on']('end',()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x18095e(0x13c),()=>N());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.1.8-preview.1",
3
+ "version": "2.1.8-preview.3",
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",