@sleep2agi/agent-network 2.0.0-preview.5 → 2.0.0-preview.6

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
- function a0_0x57f7(_0x4deeee,_0x1dcb68){_0x4deeee=_0x4deeee-0xca;const _0x4166b0=a0_0x4166();let _0x57f783=_0x4166b0[_0x4deeee];return _0x57f783;}const a0_0x2be9be=a0_0x57f7;(function(_0x510038,_0x12ebbf){const _0x245a94=a0_0x57f7,_0x36c2e2=_0x510038();while(!![]){try{const _0x5cfe70=parseInt(_0x245a94(0x105))/0x1+parseInt(_0x245a94(0xee))/0x2*(parseInt(_0x245a94(0x11f))/0x3)+parseInt(_0x245a94(0x107))/0x4+-parseInt(_0x245a94(0xcc))/0x5+-parseInt(_0x245a94(0x11c))/0x6*(parseInt(_0x245a94(0xe5))/0x7)+-parseInt(_0x245a94(0xe3))/0x8+parseInt(_0x245a94(0xce))/0x9*(parseInt(_0x245a94(0xfe))/0xa);if(_0x5cfe70===_0x12ebbf)break;else _0x36c2e2['push'](_0x36c2e2['shift']());}catch(_0x205dde){_0x36c2e2['push'](_0x36c2e2['shift']());}}}(a0_0x4166,0x445c6));function a0_0x4166(){const _0x4d9001=['data:\x20','task','get_all_status','POST','registered','now','split','heartbeatInterval','sleep','body','1140430bHrcLA','message','AbortError','alias','2.0','ack_inbox','slice','484570jOCICX','abort','705036zwiHNK','signal','tools/call','type','stringify','disconnected','messages','text','log','url','resumeId','SSE\x20connected','new_task','offline','new_message','name','emit','normal','reconnectDelay','server','reply','829482MwQkyc','result','content','188127YjgKEb','call','min','pop','heartbeatTimer','2322945HMCCtC','sdk','9mzrnwt','replace','heartbeat\x20failed:\x20','get_inbox','send_message','/events/','disconnect','startsWith','status','broadcast','from_session','getAllStatus','autoConnect','completed','toTimeString','token','Authorization','SSE\x20error:\x20','catch','agent','report_status','1644600pLqexp','parse','7YJlhdZ',']\x20[commhub:','match','error','processInbox','sseAbort','s...','send','running','10dktOXS','connect','sdk-','connected','idle','connectSSE'];a0_0x4166=function(){return _0x4d9001;};return a0_0x4166();}import{EventEmitter as a0_0x44b5b1}from'events';import{hostname as a0_0x24a89d}from'os';class T extends a0_0x44b5b1{[a0_0x2be9be(0x110)];[a0_0x2be9be(0x101)];[a0_0x2be9be(0xdd)];[a0_0x2be9be(0xe1)];[a0_0x2be9be(0x111)];[a0_0x2be9be(0xfb)];['reconnectDelay'];['heartbeatTimer'];[a0_0x2be9be(0xea)];[a0_0x2be9be(0xed)]=!0x1;constructor(_0x3911b7){const _0x188837=a0_0x2be9be;super();if(this['url']=_0x3911b7[_0x188837(0x110)][_0x188837(0xcf)](/\/$/,''),this[_0x188837(0x101)]=_0x3911b7[_0x188837(0x101)],this['token']=_0x3911b7[_0x188837(0xdd)],this[_0x188837(0xe1)]=_0x3911b7[_0x188837(0xe1)]||_0x188837(0xcd),this[_0x188837(0x111)]=_0x188837(0xf0)+_0x3911b7[_0x188837(0x101)]+'-'+Date[_0x188837(0xf9)]()['toString'](0x24),this['heartbeatInterval']=_0x3911b7[_0x188837(0xfb)]??0x2bf20,this[_0x188837(0x119)]=_0x3911b7[_0x188837(0x119)]??0xbb8,_0x3911b7[_0x188837(0xda)]!==!0x1)this[_0x188837(0xef)]();}[a0_0x2be9be(0x10f)](_0x307c7f){const _0x16ce7d=a0_0x2be9be;console[_0x16ce7d(0x10f)]('['+new Date()[_0x16ce7d(0xdc)]()[_0x16ce7d(0x104)](0x0,0x8)+_0x16ce7d(0xe6)+this[_0x16ce7d(0x101)]+']\x20'+_0x307c7f);}async[a0_0x2be9be(0x120)](_0x295360,_0x59fed2){const _0x130406=a0_0x2be9be;let _0x5ebbb9={'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream'};if(this[_0x130406(0xdd)])_0x5ebbb9['Authorization']='Bearer\x20'+this[_0x130406(0xdd)];let _0x4ed7a3=await(await fetch(this[_0x130406(0x110)]+'/mcp',{'method':_0x130406(0xf7),'headers':_0x5ebbb9,'body':JSON[_0x130406(0x10b)]({'jsonrpc':_0x130406(0x102),'id':Date['now'](),'method':_0x130406(0x109),'params':{'name':_0x295360,'arguments':_0x59fed2}})}))['text'](),_0xcb45de=_0x4ed7a3[_0x130406(0xe7)](/data: (.+)/),_0x6036ba=_0xcb45de?JSON[_0x130406(0xe4)](_0xcb45de[0x1]):JSON[_0x130406(0xe4)](_0x4ed7a3),_0x38444d=_0x6036ba?.[_0x130406(0x11d)]?.['content']?.[0x0]?.[_0x130406(0x10e)];return _0x38444d?JSON[_0x130406(0xe4)](_0x38444d):_0x6036ba;}async[a0_0x2be9be(0xef)](){const _0x5f03ac=a0_0x2be9be;if(this[_0x5f03ac(0xed)])return;this['running']=!0x0,await this['status'](_0x5f03ac(0xf2)),this[_0x5f03ac(0x10f)](_0x5f03ac(0xf8)),this[_0x5f03ac(0xcb)]=setInterval(()=>{const _0x3ac22a=_0x5f03ac;this[_0x3ac22a(0xd6)](_0x3ac22a(0xf2))[_0x3ac22a(0xe0)](_0x5a1de2=>this[_0x3ac22a(0x10f)](_0x3ac22a(0xd0)+_0x5a1de2[_0x3ac22a(0xff)]));},this[_0x5f03ac(0xfb)]),this[_0x5f03ac(0xf3)]();}async[a0_0x2be9be(0xd4)](){const _0x4dcc35=a0_0x2be9be;if(this['running']=!0x1,this[_0x4dcc35(0xea)]?.[_0x4dcc35(0x106)](),this[_0x4dcc35(0xcb)])clearInterval(this[_0x4dcc35(0xcb)]);await this['status'](_0x4dcc35(0x114))[_0x4dcc35(0xe0)](()=>{}),this[_0x4dcc35(0x10f)](_0x4dcc35(0x10c));}async[a0_0x2be9be(0xec)](_0x39ae49,_0x326e62,_0x28386a=a0_0x2be9be(0x118)){const _0x3257f4=a0_0x2be9be;return this[_0x3257f4(0x120)]('send_task',{'alias':_0x39ae49,'task':_0x326e62,'priority':_0x28386a,'from_session':this[_0x3257f4(0x101)]});}async[a0_0x2be9be(0xff)](_0x2b8433,_0x17da1e){const _0x5303c3=a0_0x2be9be;return this[_0x5303c3(0x120)](_0x5303c3(0xd2),{'alias':_0x2b8433,'message':_0x17da1e,'from_session':this[_0x5303c3(0x101)]});}async[a0_0x2be9be(0x11b)](_0xaa2525,_0x34d024,_0x4e2faa=a0_0x2be9be(0xdb)){const _0x2cf995=a0_0x2be9be;return this[_0x2cf995(0x120)](_0x2cf995(0x11b),{'task_id':_0xaa2525,'text':_0x34d024,'status':_0x4e2faa});}async['status'](_0x3bb29e,_0x5aba67){const _0x144b63=a0_0x2be9be;return this['call'](_0x144b63(0xe2),{'resume_id':this[_0x144b63(0x111)],'alias':this[_0x144b63(0x101)],'status':_0x3bb29e,'server':a0_0x24a89d(),'hostname':a0_0x24a89d(),'agent':this[_0x144b63(0xe1)],'project_dir':process['cwd'](),..._0x5aba67});}async[a0_0x2be9be(0xd9)](){const _0x137b22=a0_0x2be9be;return this[_0x137b22(0x120)](_0x137b22(0xf6),{});}async[a0_0x2be9be(0xd7)](_0x5843b8,_0x2701d6){const _0x2c0380=a0_0x2be9be;return this[_0x2c0380(0x120)](_0x2c0380(0xd7),{'message':_0x5843b8,'filter_server':_0x2701d6?.[_0x2c0380(0x11a)],'filter_status':_0x2701d6?.[_0x2c0380(0xd6)]});}async[a0_0x2be9be(0xf3)](){const _0x5eae0e=a0_0x2be9be;let _0x41b9b4=encodeURIComponent(this[_0x5eae0e(0x101)]),_0x276e4f=this[_0x5eae0e(0x110)]+_0x5eae0e(0xd3)+_0x41b9b4,_0x1cde35=this[_0x5eae0e(0x119)];while(this[_0x5eae0e(0xed)]){try{this[_0x5eae0e(0xea)]=new AbortController();let _0x296de1={'Accept':'text/event-stream'};if(this[_0x5eae0e(0xdd)])_0x296de1[_0x5eae0e(0xde)]='Bearer\x20'+this[_0x5eae0e(0xdd)];let _0x1c1137=await fetch(_0x276e4f,{'headers':_0x296de1,'signal':this[_0x5eae0e(0xea)][_0x5eae0e(0x108)]});if(!_0x1c1137['ok']||!_0x1c1137[_0x5eae0e(0xfd)]){this['log']('SSE\x20failed:\x20'+_0x1c1137['status']),await this[_0x5eae0e(0xfc)](_0x1cde35),_0x1cde35=Math[_0x5eae0e(0x121)](_0x1cde35*1.5,0xea60);continue;}_0x1cde35=this[_0x5eae0e(0x119)];let _0x5e89ef=_0x1c1137['body']['getReader'](),_0x18dfd1=new TextDecoder(),_0x3d1bd7='';while(this[_0x5eae0e(0xed)]){let {done:_0x3bc81a,value:_0x31d7d7}=await _0x5e89ef['read']();if(_0x3bc81a)break;_0x3d1bd7+=_0x18dfd1['decode'](_0x31d7d7,{'stream':!0x0});let _0x1080f7=_0x3d1bd7[_0x5eae0e(0xfa)]('\x0a');_0x3d1bd7=_0x1080f7[_0x5eae0e(0xca)]()||'';for(let _0x248a1d of _0x1080f7){if(!_0x248a1d[_0x5eae0e(0xd5)](_0x5eae0e(0xf4)))continue;try{let _0x279a7c=JSON['parse'](_0x248a1d['slice'](0x6));if(_0x279a7c['type']===_0x5eae0e(0xf1)){this[_0x5eae0e(0x10f)](_0x5eae0e(0x112)),this[_0x5eae0e(0x117)](_0x5eae0e(0xf1));continue;}if(_0x279a7c[_0x5eae0e(0x10a)]===_0x5eae0e(0x113)||_0x279a7c['type']===_0x5eae0e(0x115)||_0x279a7c['type']===_0x5eae0e(0xd7))await this[_0x5eae0e(0xe9)]();}catch{}}}}catch(_0x1ccc9f){if(_0x1ccc9f[_0x5eae0e(0x116)]===_0x5eae0e(0x100))break;this[_0x5eae0e(0x117)](_0x5eae0e(0xe8),_0x1ccc9f),this[_0x5eae0e(0x10f)](_0x5eae0e(0xdf)+_0x1ccc9f[_0x5eae0e(0xff)]);}if(this[_0x5eae0e(0xed)])this[_0x5eae0e(0x117)](_0x5eae0e(0x10c)),this[_0x5eae0e(0x10f)]('SSE\x20reconnecting\x20in\x20'+_0x1cde35/0x3e8+_0x5eae0e(0xeb)),await this['sleep'](_0x1cde35),_0x1cde35=Math[_0x5eae0e(0x121)](_0x1cde35*1.5,0xea60);}}async['processInbox'](){const _0x84b4d9=a0_0x2be9be;try{let _0x31c2c0=(await this[_0x84b4d9(0x120)](_0x84b4d9(0xd1),{'alias':this[_0x84b4d9(0x101)],'limit':0xa}))?.[_0x84b4d9(0x10d)]||[];for(let _0x51fdd5 of _0x31c2c0)await this[_0x84b4d9(0x120)](_0x84b4d9(0x103),{'alias':this[_0x84b4d9(0x101)],'message_id':_0x51fdd5['id']}),this[_0x84b4d9(0x10f)]('←\x20'+_0x51fdd5[_0x84b4d9(0xd8)]+':\x20'+_0x51fdd5[_0x84b4d9(0x11e)][_0x84b4d9(0x104)](0x0,0x3c)),this['emit'](_0x84b4d9(0xf5),_0x51fdd5),this[_0x84b4d9(0x117)]('message',_0x51fdd5);}catch(_0x3f3b1c){this[_0x84b4d9(0x10f)]('inbox\x20error:\x20'+_0x3f3b1c['message']);}}[a0_0x2be9be(0xfc)](_0x53d573){return new Promise(_0x48bb13=>setTimeout(_0x48bb13,_0x53d573));}}var $=T;export{$ as default,T as CommHub};
1
+ function a0_0x2bc2(){const _0x467141=['log','SSE\x20reconnecting\x20in\x20','now','status','url','connect','offline','messages','send_task','toString','27FQlmba','report_status','/mcp','type','567vTDcAj','task','registered','signal','stringify','/events/','running','2514170OxYSpC','2.0','24QPdcUS','new_message','sdk-','reply','content','heartbeatInterval','reconnectDelay',']\x20[commhub:','4824jQGDGi','connectSSE','parse','autoConnect','message','emit','slice','50414zDmaZd','completed','decode','Authorization','getReader','send','2747965AWhGMM','587562vQcLKk','SSE\x20connected','text/event-stream','heartbeat\x20failed:\x20','catch','ack_inbox','sseAbort','SSE\x20failed:\x20','token','startsWith','normal','processInbox','inbox\x20error:\x20','send_message','from_session','get_all_status','SSE\x20error:\x20','broadcast','get_inbox','4026sNvObD','name','idle','sleep','1wuyDsR','s...','application/json','new_task','call','POST','body','11068GFdXyg','tools/call','Bearer\x20','1336616iaFVNM','match','split','agent','disconnect','getAllStatus','text','resumeId','replace','read','data:\x20','heartbeatTimer','toTimeString','cwd','connected','alias','AbortError','disconnected','min'];a0_0x2bc2=function(){return _0x467141;};return a0_0x2bc2();}const a0_0x151ed8=a0_0x149a;(function(_0x522ac3,_0x48c33f){const _0x48c642=a0_0x149a,_0x4f9978=_0x522ac3();while(!![]){try{const _0x337993=parseInt(_0x48c642(0xee))/0x1*(-parseInt(_0x48c642(0xd7))/0x2)+parseInt(_0x48c642(0xb8))/0x3*(-parseInt(_0x48c642(0xf5))/0x4)+parseInt(_0x48c642(0xd6))/0x5+-parseInt(_0x48c642(0xc1))/0x6*(parseInt(_0x48c642(0xd0))/0x7)+-parseInt(_0x48c642(0xf8))/0x8*(-parseInt(_0x48c642(0xb4))/0x9)+parseInt(_0x48c642(0xbf))/0xa+-parseInt(_0x48c642(0xea))/0xb*(parseInt(_0x48c642(0xc9))/0xc);if(_0x337993===_0x48c33f)break;else _0x4f9978['push'](_0x4f9978['shift']());}catch(_0x29198f){_0x4f9978['push'](_0x4f9978['shift']());}}}(a0_0x2bc2,0x4b935));function a0_0x149a(_0x48c686,_0x3bf1ae){_0x48c686=_0x48c686-0xae;const _0x2bc284=a0_0x2bc2();let _0x149aac=_0x2bc284[_0x48c686];return _0x149aac;}import{EventEmitter as a0_0x2bdbfb}from'events';import{hostname as a0_0x1e35e8}from'os';class T extends a0_0x2bdbfb{[a0_0x151ed8(0xae)];[a0_0x151ed8(0x107)];['token'];[a0_0x151ed8(0xfb)];['resumeId'];[a0_0x151ed8(0xc6)];[a0_0x151ed8(0xc7)];[a0_0x151ed8(0x103)];[a0_0x151ed8(0xdd)];[a0_0x151ed8(0xbe)]=!0x1;constructor(_0x52bb3f){const _0x5297c2=a0_0x151ed8;super();if(this[_0x5297c2(0xae)]=_0x52bb3f['url'][_0x5297c2(0x100)](/\/$/,''),this[_0x5297c2(0x107)]=_0x52bb3f['alias'],this['token']=_0x52bb3f[_0x5297c2(0xdf)],this[_0x5297c2(0xfb)]=_0x52bb3f[_0x5297c2(0xfb)]||'sdk',this[_0x5297c2(0xff)]=_0x5297c2(0xc3)+_0x52bb3f['alias']+'-'+Date[_0x5297c2(0x10d)]()[_0x5297c2(0xb3)](0x24),this[_0x5297c2(0xc6)]=_0x52bb3f[_0x5297c2(0xc6)]??0x2bf20,this['reconnectDelay']=_0x52bb3f[_0x5297c2(0xc7)]??0xbb8,_0x52bb3f[_0x5297c2(0xcc)]!==!0x1)this[_0x5297c2(0xaf)]();}['log'](_0x1adcb7){const _0x1ec9e7=a0_0x151ed8;console[_0x1ec9e7(0x10b)]('['+new Date()[_0x1ec9e7(0x104)]()[_0x1ec9e7(0xcf)](0x0,0x8)+_0x1ec9e7(0xc8)+this[_0x1ec9e7(0x107)]+']\x20'+_0x1adcb7);}async[a0_0x151ed8(0xf2)](_0x4d41c2,_0xf9f21e){const _0x3618ef=a0_0x151ed8;let _0x5bf539={'Content-Type':_0x3618ef(0xf0),'Accept':'application/json,\x20text/event-stream'};if(this[_0x3618ef(0xdf)])_0x5bf539[_0x3618ef(0xd3)]=_0x3618ef(0xf7)+this[_0x3618ef(0xdf)];let _0x5bfb1b=await(await fetch(this[_0x3618ef(0xae)]+_0x3618ef(0xb6),{'method':_0x3618ef(0xf3),'headers':_0x5bf539,'body':JSON[_0x3618ef(0xbc)]({'jsonrpc':_0x3618ef(0xc0),'id':Date[_0x3618ef(0x10d)](),'method':_0x3618ef(0xf6),'params':{'name':_0x4d41c2,'arguments':_0xf9f21e}})}))[_0x3618ef(0xfe)](),_0x47ed83=_0x5bfb1b[_0x3618ef(0xf9)](/data: (.+)/),_0xaf3ba1=_0x47ed83?JSON['parse'](_0x47ed83[0x1]):JSON[_0x3618ef(0xcb)](_0x5bfb1b),_0x1fe469=_0xaf3ba1?.['result']?.[_0x3618ef(0xc5)]?.[0x0]?.[_0x3618ef(0xfe)];return _0x1fe469?JSON[_0x3618ef(0xcb)](_0x1fe469):_0xaf3ba1;}async[a0_0x151ed8(0xaf)](){const _0x253601=a0_0x151ed8;if(this[_0x253601(0xbe)])return;this['running']=!0x0,await this['status'](_0x253601(0xec)),this[_0x253601(0x10b)](_0x253601(0xba)),this[_0x253601(0x103)]=setInterval(()=>{const _0x543c42=_0x253601;this[_0x543c42(0x10e)]('idle')[_0x543c42(0xdb)](_0x4c22bd=>this[_0x543c42(0x10b)](_0x543c42(0xda)+_0x4c22bd[_0x543c42(0xcd)]));},this['heartbeatInterval']),this[_0x253601(0xca)]();}async[a0_0x151ed8(0xfc)](){const _0x1bda5d=a0_0x151ed8;if(this[_0x1bda5d(0xbe)]=!0x1,this[_0x1bda5d(0xdd)]?.['abort'](),this['heartbeatTimer'])clearInterval(this[_0x1bda5d(0x103)]);await this[_0x1bda5d(0x10e)](_0x1bda5d(0xb0))[_0x1bda5d(0xdb)](()=>{}),this[_0x1bda5d(0x10b)](_0x1bda5d(0x109));}async[a0_0x151ed8(0xd5)](_0x3ec851,_0x291dea,_0x4f081d=a0_0x151ed8(0xe1)){const _0x22146b=a0_0x151ed8;return this['call'](_0x22146b(0xb2),{'alias':_0x3ec851,'task':_0x291dea,'priority':_0x4f081d,'from_session':this[_0x22146b(0x107)]});}async[a0_0x151ed8(0xcd)](_0x50f069,_0x2bcfd1){const _0x29f462=a0_0x151ed8;return this['call'](_0x29f462(0xe4),{'alias':_0x50f069,'message':_0x2bcfd1,'from_session':this[_0x29f462(0x107)]});}async[a0_0x151ed8(0xc4)](_0x756317,_0x2ee616,_0x3679de=a0_0x151ed8(0xd1)){const _0x455255=a0_0x151ed8;return this[_0x455255(0xf2)](_0x455255(0xc4),{'task_id':_0x756317,'text':_0x2ee616,'status':_0x3679de});}async['status'](_0x299b04,_0x46a288){const _0x5e8dff=a0_0x151ed8;return this[_0x5e8dff(0xf2)](_0x5e8dff(0xb5),{'resume_id':this['resumeId'],'alias':this[_0x5e8dff(0x107)],'status':_0x299b04,'server':a0_0x1e35e8(),'hostname':a0_0x1e35e8(),'agent':this[_0x5e8dff(0xfb)],'project_dir':process[_0x5e8dff(0x105)](),..._0x46a288});}async[a0_0x151ed8(0xfd)](){const _0x109b0d=a0_0x151ed8;return this[_0x109b0d(0xf2)](_0x109b0d(0xe6),{});}async[a0_0x151ed8(0xe8)](_0x45fc24,_0x1afd25){const _0x489298=a0_0x151ed8;return this[_0x489298(0xf2)]('broadcast',{'message':_0x45fc24,'filter_server':_0x1afd25?.['server'],'filter_status':_0x1afd25?.['status']});}async['connectSSE'](){const _0x21a8c3=a0_0x151ed8;let _0x6f02d9=encodeURIComponent(this[_0x21a8c3(0x107)]),_0x266a78=this[_0x21a8c3(0xae)]+_0x21a8c3(0xbd)+_0x6f02d9,_0x5de7e6=this[_0x21a8c3(0xc7)];while(this[_0x21a8c3(0xbe)]){try{this[_0x21a8c3(0xdd)]=new AbortController();let _0x23c709={'Accept':_0x21a8c3(0xd9)};if(this[_0x21a8c3(0xdf)])_0x23c709['Authorization']='Bearer\x20'+this[_0x21a8c3(0xdf)];let _0x426f15=await fetch(_0x266a78,{'headers':_0x23c709,'signal':this[_0x21a8c3(0xdd)][_0x21a8c3(0xbb)]});if(!_0x426f15['ok']||!_0x426f15[_0x21a8c3(0xf4)]){this['log'](_0x21a8c3(0xde)+_0x426f15['status']),await this[_0x21a8c3(0xed)](_0x5de7e6),_0x5de7e6=Math[_0x21a8c3(0x10a)](_0x5de7e6*1.5,0xea60);continue;}_0x5de7e6=this[_0x21a8c3(0xc7)];let _0x20382a=_0x426f15['body'][_0x21a8c3(0xd4)](),_0xb0b4d5=new TextDecoder(),_0x1d4cef='';while(this[_0x21a8c3(0xbe)]){let {done:_0x539602,value:_0x25a0a8}=await _0x20382a[_0x21a8c3(0x101)]();if(_0x539602)break;_0x1d4cef+=_0xb0b4d5[_0x21a8c3(0xd2)](_0x25a0a8,{'stream':!0x0});let _0x1fd4dc=_0x1d4cef[_0x21a8c3(0xfa)]('\x0a');_0x1d4cef=_0x1fd4dc['pop']()||'';for(let _0x1ab166 of _0x1fd4dc){if(!_0x1ab166[_0x21a8c3(0xe0)](_0x21a8c3(0x102)))continue;try{let _0x48dabc=JSON[_0x21a8c3(0xcb)](_0x1ab166[_0x21a8c3(0xcf)](0x6));if(_0x48dabc[_0x21a8c3(0xb7)]===_0x21a8c3(0x106)){this[_0x21a8c3(0x10b)](_0x21a8c3(0xd8)),this[_0x21a8c3(0xce)](_0x21a8c3(0x106));continue;}if(_0x48dabc['type']===_0x21a8c3(0xf1)||_0x48dabc[_0x21a8c3(0xb7)]===_0x21a8c3(0xc2)||_0x48dabc['type']===_0x21a8c3(0xe8))await this[_0x21a8c3(0xe2)]();}catch{}}}}catch(_0x27de2c){if(_0x27de2c[_0x21a8c3(0xeb)]===_0x21a8c3(0x108))break;this['emit']('error',_0x27de2c),this[_0x21a8c3(0x10b)](_0x21a8c3(0xe7)+_0x27de2c[_0x21a8c3(0xcd)]);}if(this['running'])this[_0x21a8c3(0xce)](_0x21a8c3(0x109)),this[_0x21a8c3(0x10b)](_0x21a8c3(0x10c)+_0x5de7e6/0x3e8+_0x21a8c3(0xef)),await this['sleep'](_0x5de7e6),_0x5de7e6=Math[_0x21a8c3(0x10a)](_0x5de7e6*1.5,0xea60);}}async[a0_0x151ed8(0xe2)](){const _0x438c11=a0_0x151ed8;try{let _0x327f67=(await this[_0x438c11(0xf2)](_0x438c11(0xe9),{'alias':this[_0x438c11(0x107)],'limit':0xa}))?.[_0x438c11(0xb1)]||[];for(let _0x68c837 of _0x327f67)await this[_0x438c11(0xf2)](_0x438c11(0xdc),{'alias':this[_0x438c11(0x107)],'message_id':_0x68c837['id']}),this['log']('←\x20'+_0x68c837[_0x438c11(0xe5)]+':\x20'+_0x68c837['content'][_0x438c11(0xcf)](0x0,0x3c)),this[_0x438c11(0xce)](_0x438c11(0xb9),_0x68c837),this['emit'](_0x438c11(0xcd),_0x68c837);}catch(_0x55e4f0){this[_0x438c11(0x10b)](_0x438c11(0xe3)+_0x55e4f0['message']);}}[a0_0x151ed8(0xed)](_0x3e203f){return new Promise(_0x2586a2=>setTimeout(_0x2586a2,_0x3e203f));}}var $=T;export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x26a715=a0_0x404e;(function(_0x472e0c,_0x35b763){const _0x1b9f0e=a0_0x404e,_0x22db40=_0x472e0c();while(!![]){try{const _0x5e5f21=-parseInt(_0x1b9f0e(0x1e0))/0x1+-parseInt(_0x1b9f0e(0x248))/0x2+parseInt(_0x1b9f0e(0x210))/0x3+-parseInt(_0x1b9f0e(0x258))/0x4+-parseInt(_0x1b9f0e(0x25a))/0x5*(-parseInt(_0x1b9f0e(0x1ef))/0x6)+parseInt(_0x1b9f0e(0x238))/0x7+-parseInt(_0x1b9f0e(0x1e8))/0x8;if(_0x5e5f21===_0x35b763)break;else _0x22db40['push'](_0x22db40['shift']());}catch(_0x217a9c){_0x22db40['push'](_0x22db40['shift']());}}}(a0_0xdd34,0x6e359));import{readFileSync as a0_0x5eb03a,existsSync as a0_0x23b41a}from'fs';import{join as a0_0x451d9a}from'path';import{hostname as a0_0x51d750}from'os';import{execSync as a0_0x2588a6}from'child_process';import{Server as a0_0x296253}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x2087d1}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x5d884f,CallToolRequestSchema as a0_0x31c153}from'@modelcontextprotocol/sdk/types.js';function p(_0x27866b){const _0x21148f=a0_0x404e;if(!a0_0x23b41a(_0x27866b))return;for(let _0x377ffc of a0_0x5eb03a(_0x27866b,_0x21148f(0x1f9))[_0x21148f(0x253)]('\x0a')){let _0x29ee43=_0x377ffc[_0x21148f(0x1ea)]();if(!_0x29ee43||_0x29ee43[_0x21148f(0x1e3)]('#'))continue;let _0x2af5b2=_0x29ee43[_0x21148f(0x1ed)]('=');if(_0x2af5b2<0x0)continue;let _0x435644=_0x29ee43[_0x21148f(0x230)](0x0,_0x2af5b2)[_0x21148f(0x1ea)](),_0x6d1cea=_0x29ee43['slice'](_0x2af5b2+0x1)[_0x21148f(0x1ea)]()[_0x21148f(0x200)](/^["']|["']$/g,'');if(!process.env[_0x435644])process.env[_0x435644]=_0x6d1cea;}}var C=process.env.HOME||'~',T=a0_0x451d9a(C,'.claude/channels/commhub');p(a0_0x451d9a(T,a0_0x26a715(0x1db)));var L=process[a0_0x26a715(0x204)]()[a0_0x26a715(0x200)](/\//g,'-');p(a0_0x451d9a(T,L,'.env'));function U(){const _0x1a4b7d=a0_0x26a715;try{return a0_0x2588a6('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x1a4b7d(0x1f9),'timeout':0x7d0})['trim']();}catch{return'';}}function c(){const _0x4bbdce=a0_0x26a715;try{let _0x36235e=a0_0x451d9a(C,_0x4bbdce(0x1e6),_0x4bbdce(0x1fb));if(a0_0x23b41a(_0x36235e))return JSON[_0x4bbdce(0x242)](a0_0x5eb03a(_0x36235e,_0x4bbdce(0x1f9)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H['hub']||a0_0x26a715(0x223),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x51d750(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x26a715(0x21d)](),X=process.env.COMMHUB_TOKEN||H[a0_0x26a715(0x24f)]||'';function Y(_0xd203c5){const _0x513a93=a0_0x26a715;let _0x22a388=new Date()[_0x513a93(0x207)]()['slice'](0x0,0x8);process['stderr'][_0x513a93(0x1f4)]('['+_0x22a388+_0x513a93(0x213)+_0xd203c5+'\x0a');}function h(_0x579ccb){return new Promise(_0x4a64fc=>setTimeout(_0x4a64fc,_0x579ccb));}Y(a0_0x26a715(0x212)+D+a0_0x26a715(0x1f3)+Z+a0_0x26a715(0x21a)+w[a0_0x26a715(0x230)](0x0,0x8)+'...\x20TMUX='+(f||a0_0x26a715(0x245))+a0_0x26a715(0x24e)+process[a0_0x26a715(0x204)]()+a0_0x26a715(0x247)+L);var k=new Map(),K=new a0_0x296253({'name':'commhub-channel','version':a0_0x26a715(0x23b)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x26a715(0x1df),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x26a715(0x24d)+Z][a0_0x26a715(0x1e2)]('\x0a')});K[a0_0x26a715(0x237)](a0_0x5d884f,async()=>({'tools':[{'name':a0_0x26a715(0x1eb),'description':a0_0x26a715(0x244),'inputSchema':{'type':a0_0x26a715(0x202),'properties':{'task_id':{'type':'string','description':a0_0x26a715(0x206)},'text':{'type':a0_0x26a715(0x1f1),'description':a0_0x26a715(0x1ff)},'status':{'type':a0_0x26a715(0x1f1),'enum':[a0_0x26a715(0x22d),a0_0x26a715(0x226),a0_0x26a715(0x23a),a0_0x26a715(0x1e5),a0_0x26a715(0x23e),a0_0x26a715(0x24b)],'description':a0_0x26a715(0x1de)}},'required':[a0_0x26a715(0x257)]}},{'name':a0_0x26a715(0x241),'description':a0_0x26a715(0x225),'inputSchema':{'type':a0_0x26a715(0x202),'properties':{'status':{'type':a0_0x26a715(0x1f1),'enum':[a0_0x26a715(0x235),'idle',a0_0x26a715(0x1e5),a0_0x26a715(0x23e)]},'task':{'type':'string','description':'Current\x20task\x20description'},'progress':{'type':'number','description':a0_0x26a715(0x233)}},'required':[a0_0x26a715(0x1d9)]}},{'name':'commhub_send_task','description':a0_0x26a715(0x256),'inputSchema':{'type':a0_0x26a715(0x202),'properties':{'alias':{'type':'string','description':a0_0x26a715(0x229)},'task':{'type':a0_0x26a715(0x1f1),'description':a0_0x26a715(0x21e)},'priority':{'type':a0_0x26a715(0x1f1),'enum':['high','normal',a0_0x26a715(0x209)],'description':a0_0x26a715(0x23f)}},'required':[a0_0x26a715(0x1e4),a0_0x26a715(0x201)]}},{'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':'object','properties':{'alias':{'type':a0_0x26a715(0x1f1),'description':a0_0x26a715(0x229)},'message':{'type':'string','description':a0_0x26a715(0x1d7)}},'required':[a0_0x26a715(0x1e4),a0_0x26a715(0x1d8)]}},{'name':'commhub_get_all_status','description':a0_0x26a715(0x222),'inputSchema':{'type':a0_0x26a715(0x202),'properties':{}}}]}));async function P(_0x53d421,_0x244639){const _0x472bc4=a0_0x26a715;let _0x4badf2=await fetch(D+_0x472bc4(0x224),{'method':'POST','headers':{'Content-Type':_0x472bc4(0x1f2),'Accept':_0x472bc4(0x231),...X?{'Authorization':_0x472bc4(0x250)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x1,'method':_0x472bc4(0x1fc),'params':{'protocolVersion':_0x472bc4(0x218),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x472bc4(0x23b)}}})});if(!_0x4badf2['ok']){let _0x3c2966=await _0x4badf2['text']();return Y(_0x472bc4(0x1dc)+_0x4badf2['status']+'\x20'+_0x3c2966[_0x472bc4(0x230)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x4badf2['status']};}await _0x4badf2[_0x472bc4(0x257)]();let _0xffbc8d=(await(await fetch(D+_0x472bc4(0x224),{'method':'POST','headers':{'Content-Type':_0x472bc4(0x1f2),'Accept':_0x472bc4(0x231),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x472bc4(0x1ee)]({'jsonrpc':'2.0','id':0x2,'method':_0x472bc4(0x22c),'params':{'name':_0x53d421,'arguments':_0x244639}})}))[_0x472bc4(0x257)]())[_0x472bc4(0x253)]('\x0a')[_0x472bc4(0x215)](_0x5beaa7=>_0x5beaa7[_0x472bc4(0x1e3)](_0x472bc4(0x20e)));if(_0xffbc8d){let _0xfe8906=JSON['parse'](_0xffbc8d[_0x472bc4(0x230)](0x6));return _0xfe8906?.[_0x472bc4(0x236)]?.[_0x472bc4(0x1e1)]?.[0x0]?.['text']?JSON[_0x472bc4(0x242)](_0xfe8906[_0x472bc4(0x236)][_0x472bc4(0x1e1)][0x0][_0x472bc4(0x257)]):_0xfe8906;}return{'ok':!0x1,'error':_0x472bc4(0x217)};}K[a0_0x26a715(0x237)](a0_0x31c153,async _0x260b3a=>{const _0x1330ca=a0_0x26a715;let {name:_0x50e66f,arguments:_0x322b0f}=_0x260b3a[_0x1330ca(0x21c)];if(_0x50e66f===_0x1330ca(0x1eb)){let {task_id:_0x5813e5,text:_0x2b72ef,status:_0xf6a14d}=_0x322b0f;if(_0xf6a14d===_0x1330ca(0x22d)||_0xf6a14d===_0x1330ca(0x226)||_0xf6a14d===_0x1330ca(0x23a)){let _0x485818=_0xf6a14d===_0x1330ca(0x22d)?_0x1330ca(0x232):_0xf6a14d,_0x1c84e7=_0x5813e5?k[_0x1330ca(0x211)](_0x5813e5)||_0x1330ca(0x23c):_0x1330ca(0x23c),_0x2ae26a=await P(_0x1330ca(0x20b),{'alias':_0x1c84e7,'text':_0x2b72ef,'in_reply_to':_0x5813e5||void 0x0,'status':_0x485818,'from_session':Z});if(_0x5813e5)k['delete'](_0x5813e5);return{'content':[{'type':'text','text':JSON[_0x1330ca(0x1ee)](_0x2ae26a)}]};}let _0x229a43=await P(_0x1330ca(0x246),{'resume_id':w,'alias':Z,'status':_0xf6a14d===_0x1330ca(0x1e5)?_0x1330ca(0x1e5):_0xf6a14d===_0x1330ca(0x23e)?_0x1330ca(0x23e):'working','task':_0x2b72ef[_0x1330ca(0x230)](0x0,0xc8),'output':_0x2b72ef});return{'content':[{'type':_0x1330ca(0x257),'text':JSON[_0x1330ca(0x1ee)](_0x229a43)}]};}if(_0x50e66f===_0x1330ca(0x241)){let {status:_0x32f332,task:_0x274ce1,progress:_0xc74c04}=_0x322b0f,_0x2d4e90=await P(_0x1330ca(0x246),{'resume_id':w,'alias':Z,'status':_0x32f332,'task':_0x274ce1,'progress':_0xc74c04});return{'content':[{'type':'text','text':JSON['stringify'](_0x2d4e90)}]};}if(_0x50e66f===_0x1330ca(0x1f8)){let {alias:_0x115182,task:_0xcaac77,priority:_0x36a2ad}=_0x322b0f,_0xf13e60=await P('send_task',{'alias':_0x115182,'task':_0xcaac77,'priority':_0x36a2ad||_0x1330ca(0x203),'from_session':Z});return{'content':[{'type':_0x1330ca(0x257),'text':JSON[_0x1330ca(0x1ee)](_0xf13e60)}]};}if(_0x50e66f===_0x1330ca(0x23d)){let {alias:_0x2ed16b,message:_0x48a3df}=_0x322b0f,_0x5e4221=await P(_0x1330ca(0x24c),{'alias':_0x2ed16b,'message':_0x48a3df,'from_session':Z});return{'content':[{'type':_0x1330ca(0x257),'text':JSON[_0x1330ca(0x1ee)](_0x5e4221)}]};}if(_0x50e66f===_0x1330ca(0x240)){let _0x43a345=await P('get_all_status',{});return{'content':[{'type':_0x1330ca(0x257),'text':JSON[_0x1330ca(0x1ee)](_0x43a345)}]};}return{'content':[{'type':_0x1330ca(0x257),'text':JSON[_0x1330ca(0x1ee)]({'error':_0x1330ca(0x1da)})}]};});async function v(){const _0x3532e0=a0_0x26a715;let _0x267ea4=D+_0x3532e0(0x251)+encodeURIComponent(Z),_0x570c73={};if(X)_0x570c73['Authorization']=_0x3532e0(0x250)+X;Y(_0x3532e0(0x21b)+_0x267ea4);while(!0x0){try{let _0x193f66=await fetch(_0x267ea4,{'headers':_0x570c73});if(!_0x193f66['ok']){Y(_0x3532e0(0x1fe)+_0x193f66[_0x3532e0(0x1d9)]+'\x20'+_0x193f66[_0x3532e0(0x259)]),await h(0x1388);continue;}let _0x20a4ae=_0x193f66[_0x3532e0(0x221)]['getReader'](),_0x2fb22b=new TextDecoder(),_0x1e0f4e='';while(!0x0){let {done:_0x4481f7,value:_0x262e58}=await _0x20a4ae[_0x3532e0(0x255)]();if(_0x4481f7)break;_0x1e0f4e+=_0x2fb22b['decode'](_0x262e58,{'stream':!0x0});let _0x48f97e=_0x1e0f4e['split']('\x0a\x0a');_0x1e0f4e=_0x48f97e['pop']()||'';for(let _0x494ebf of _0x48f97e){let _0x306c15=_0x494ebf[_0x3532e0(0x253)]('\x0a')[_0x3532e0(0x215)](_0x4e4f0c=>_0x4e4f0c[_0x3532e0(0x1e3)]('data:\x20'));if(!_0x306c15)continue;try{let _0x7f007a=JSON['parse'](_0x306c15['slice'](0x6));await u(_0x7f007a);}catch(_0x25a917){Y('parse\x20error:\x20'+_0x25a917);}}}Y(_0x3532e0(0x220));}catch(_0x55e241){Y(_0x3532e0(0x234)+_0x55e241);}await h(0xbb8);}}async function u(_0x5b7024){const _0x535ef8=a0_0x26a715;if(_0x5b7024[_0x535ef8(0x24a)]===_0x535ef8(0x208)){Y(_0x535ef8(0x239)+Z+'\x22');return;}if(_0x5b7024[_0x535ef8(0x24a)]===_0x535ef8(0x228)){if(Y('←\x20message\x20from\x20'+_0x5b7024[_0x535ef8(0x1f5)]+':\x20'+_0x5b7024['message'][_0x535ef8(0x230)](0x0,0x3c)),await K[_0x535ef8(0x22a)]({'method':_0x535ef8(0x1dd),'params':{'content':_0x5b7024[_0x535ef8(0x1d8)],'meta':{'sender':_0x5b7024['from']||'hub','sender_id':_0x535ef8(0x21f),'user':_0x5b7024[_0x535ef8(0x1f5)]||'hub','priority':_0x535ef8(0x203)}}}),_0x5b7024[_0x535ef8(0x219)])await P(_0x535ef8(0x216),{'alias':Z,'message_id':_0x5b7024['message_id']});return;}if(_0x5b7024[_0x535ef8(0x24a)]===_0x535ef8(0x1f7)||_0x5b7024['type']===_0x535ef8(0x20a)){Y('←\x20'+_0x5b7024['type']+_0x535ef8(0x205)+_0x5b7024[_0x535ef8(0x22f)]+'\x20priority='+(_0x5b7024[_0x535ef8(0x20c)]||_0x535ef8(0x203)));let _0x2645d6=await P(_0x535ef8(0x252),{'alias':Z,'limit':0x5});if(_0x2645d6?.['ok']&&_0x2645d6[_0x535ef8(0x1e9)]?.['length']>0x0)for(let _0x1e654e of _0x2645d6[_0x535ef8(0x1e9)]){let _0x1ec5c7={'sender':_0x1e654e[_0x535ef8(0x1e7)]||_0x535ef8(0x23c),'sender_id':'commhub','user':_0x1e654e[_0x535ef8(0x1e7)]||'hub','task_id':_0x1e654e['id'],'priority':_0x1e654e[_0x535ef8(0x20c)]||_0x535ef8(0x203)};k['set'](_0x1e654e['id'],_0x1e654e['from_session']||_0x535ef8(0x23c)),await K[_0x535ef8(0x22a)]({'method':_0x535ef8(0x1dd),'params':{'content':_0x1e654e['content'],'meta':_0x1ec5c7}}),Y('→\x20injected\x20task\x20'+_0x1e654e['id'][_0x535ef8(0x230)](0x0,0x8)+_0x535ef8(0x20f)+_0x1e654e[_0x535ef8(0x1e7)]+':\x20'+_0x1e654e[_0x535ef8(0x1e1)][_0x535ef8(0x230)](0x0,0x3c)),await P(_0x535ef8(0x216),{'alias':Z,'message_id':_0x1e654e['id']});}}}async function S(){const _0xe35416=a0_0x26a715;let _0x1cb90f=new a0_0x2087d1();await K[_0xe35416(0x22e)](_0x1cb90f),Y(_0xe35416(0x22b)),Y('starting\x20SSE\x20listener...'),v()[_0xe35416(0x1fd)](_0x172d50=>Y('SSE\x20fatal:\x20'+_0x172d50)),P('report_status',{'resume_id':w,'alias':Z,'status':_0xe35416(0x214),'server':a0_0x51d750(),'hostname':a0_0x51d750(),'agent':'claude-code','project_dir':process[_0xe35416(0x204)](),'tmux_name':f||void 0x0})[_0xe35416(0x254)](()=>Y(_0xe35416(0x1f6)+Z+_0xe35416(0x1f0)+w['slice'](0x0,0x8)+')'))['catch'](_0x1d51eb=>Y('warning:\x20could\x20not\x20register:\x20'+_0x1d51eb)),setInterval(()=>{const _0x5f051b=_0xe35416;P(_0x5f051b(0x246),{'resume_id':w,'alias':Z,'status':_0x5f051b(0x214),'server':a0_0x51d750(),'hostname':a0_0x51d750(),'agent':'claude-code','project_dir':process[_0x5f051b(0x204)](),'tmux_name':f||void 0x0})[_0x5f051b(0x1fd)](_0x3f608b=>Y(_0x5f051b(0x243)+_0x3f608b));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}S()[a0_0x26a715(0x1fd)](_0x2e2155=>{const _0x44d682=a0_0x26a715;Y('fatal:\x20'+_0x2e2155),process[_0x44d682(0x20d)](0x1);});async function N(){const _0x67cb59=a0_0x26a715;Y(_0x67cb59(0x227)),await P(_0x67cb59(0x246),{'resume_id':w,'alias':Z,'status':_0x67cb59(0x23e),'task':_0x67cb59(0x1ec)})[_0x67cb59(0x1fd)](()=>{}),process['exit'](0x0);}function a0_0x404e(_0xa2cab7,_0x1f17cc){_0xa2cab7=_0xa2cab7-0x1d7;const _0xdd343b=a0_0xdd34();let _0x404e7c=_0xdd343b[_0xa2cab7];return _0x404e7c;}function a0_0xdd34(){const _0x193b8f=['.env','CommHub\x20init\x20failed:\x20','notifications/claude/channel','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','190641WnsZWd','content','join','startsWith','alias','blocked','.anet','from_session','1796216YPAJYP','messages','trim','commhub_reply','session\x20disconnected','indexOf','stringify','564ktTkif','\x22\x20(','string','application/json','\x20ALIAS=','write','from','registered\x20as\x20\x22','new_task','commhub_send_task','utf-8','end','config.json','initialize','catch','SSE\x20error:\x20','Reply\x20text\x20/\x20result\x20summary','replace','task','object','normal','cwd',':\x20inbox_count=','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','toTimeString','connected','low','broadcast','send_reply','priority','exit','data:\x20','\x20from\x20','2138007tzUDvp','get','ENV:\x20URL=',']\x20[commhub]\x20','idle','find','ack_inbox','no\x20response','2025-03-26','message_id','\x20RESUME_ID=','connecting\x20to\x20','params','randomUUID','Task\x20content','commhub','SSE\x20stream\x20ended,\x20reconnecting...','body','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','http://127.0.0.1:9200','/mcp','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','failed','shutting\x20down,\x20reporting\x20offline...','new_message','Target\x20session\x20alias','notification','MCP\x20stdio\x20connected','tools/call','completed','connect','inbox_count','slice','application/json,\x20text/event-stream','replied','Progress\x200-100','SSE\x20connection\x20error:\x20','working','result','setRequestHandler','1996078qzfmTJ','SSE\x20connected\x20as\x20\x22','cancelled','0.3.0','hub','commhub_send_message','error','Priority\x20(default:\x20normal)','commhub_get_all_status','commhub_report_status','parse','heartbeat\x20failed:\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','none','report_status','\x20PROJECT_ENV=','110894PtwVHm','stdin','type','in_progress','send_message','Session\x20alias:\x20','\x20CWD=','token','Bearer\x20','/events/','get_inbox','split','then','read','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','text','645700HWVJqc','statusText','4555VfQGYo','Message\x20content','message','status','unknown\x20tool'];a0_0xdd34=function(){return _0x193b8f;};return a0_0xdd34();}process[a0_0x26a715(0x249)]['on'](a0_0x26a715(0x1fa),()=>N()),process['on']('SIGTERM',()=>N()),process['on']('SIGINT',()=>N());
2
+ const a0_0x3a4eda=a0_0xf8e7;(function(_0x5b900a,_0x407b97){const _0x519df5=a0_0xf8e7,_0x23cb4f=_0x5b900a();while(!![]){try{const _0x20e171=parseInt(_0x519df5(0x232))/0x1*(-parseInt(_0x519df5(0x224))/0x2)+-parseInt(_0x519df5(0x1e9))/0x3+parseInt(_0x519df5(0x251))/0x4*(-parseInt(_0x519df5(0x255))/0x5)+parseInt(_0x519df5(0x1eb))/0x6*(parseInt(_0x519df5(0x1ff))/0x7)+-parseInt(_0x519df5(0x23a))/0x8+-parseInt(_0x519df5(0x1e8))/0x9+parseInt(_0x519df5(0x228))/0xa;if(_0x20e171===_0x407b97)break;else _0x23cb4f['push'](_0x23cb4f['shift']());}catch(_0x29e369){_0x23cb4f['push'](_0x23cb4f['shift']());}}}(a0_0x1e45,0x41faa));import{readFileSync as a0_0x4ad26c,existsSync as a0_0x436b4b}from'fs';import{join as a0_0x51a9be}from'path';import{hostname as a0_0x428b3e}from'os';import{execSync as a0_0x5908f4}from'child_process';import{Server as a0_0x5cebea}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x16de72}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x451801,CallToolRequestSchema as a0_0x4f9edb}from'@modelcontextprotocol/sdk/types.js';function p(_0x3f4f9c){const _0x1ffeba=a0_0xf8e7;if(!a0_0x436b4b(_0x3f4f9c))return;for(let _0x32988c of a0_0x4ad26c(_0x3f4f9c,_0x1ffeba(0x226))['split']('\x0a')){let _0x5c4f2a=_0x32988c[_0x1ffeba(0x229)]();if(!_0x5c4f2a||_0x5c4f2a['startsWith']('#'))continue;let _0x31a605=_0x5c4f2a[_0x1ffeba(0x215)]('=');if(_0x31a605<0x0)continue;let _0x40228d=_0x5c4f2a[_0x1ffeba(0x20a)](0x0,_0x31a605)[_0x1ffeba(0x229)](),_0x1c20db=_0x5c4f2a[_0x1ffeba(0x20a)](_0x31a605+0x1)[_0x1ffeba(0x229)]()[_0x1ffeba(0x234)](/^["']|["']$/g,'');if(!process.env[_0x40228d])process.env[_0x40228d]=_0x1c20db;}}var C=process.env.HOME||'~',T=a0_0x51a9be(C,a0_0x3a4eda(0x1e4));p(a0_0x51a9be(T,a0_0x3a4eda(0x21d)));var L=process[a0_0x3a4eda(0x20e)]()[a0_0x3a4eda(0x234)](/\//g,'-');p(a0_0x51a9be(T,L,a0_0x3a4eda(0x21d)));function U(){const _0x248d17=a0_0x3a4eda;try{return a0_0x5908f4(_0x248d17(0x1db),{'encoding':_0x248d17(0x226),'timeout':0x7d0})['trim']();}catch{return'';}}function c(){const _0x2f7548=a0_0x3a4eda;try{let _0x1c6e9c=a0_0x51a9be(C,_0x2f7548(0x254),_0x2f7548(0x20b));if(a0_0x436b4b(_0x1c6e9c))return JSON['parse'](a0_0x4ad26c(_0x1c6e9c,'utf-8'));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x3a4eda(0x227)]||a0_0x3a4eda(0x1fe),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x428b3e(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x3a4eda(0x262)](),X=process.env.COMMHUB_TOKEN||H[a0_0x3a4eda(0x1e6)]||'';function Y(_0x45ab38){const _0x3e16a2=a0_0x3a4eda;let _0x1c4145=new Date()[_0x3e16a2(0x23f)]()[_0x3e16a2(0x20a)](0x0,0x8);process[_0x3e16a2(0x1f7)][_0x3e16a2(0x23c)]('['+_0x1c4145+_0x3e16a2(0x1f5)+_0x45ab38+'\x0a');}function a0_0xf8e7(_0x1dce20,_0x45042b){_0x1dce20=_0x1dce20-0x1da;const _0x1e4567=a0_0x1e45();let _0xf8e72d=_0x1e4567[_0x1dce20];return _0xf8e72d;}function h(_0x3fbd19){return new Promise(_0x34993f=>setTimeout(_0x34993f,_0x3fbd19));}Y(a0_0x3a4eda(0x25d)+D+'\x20ALIAS='+Z+'\x20RESUME_ID='+w[a0_0x3a4eda(0x20a)](0x0,0x8)+a0_0x3a4eda(0x1df)+(f||'none')+a0_0x3a4eda(0x212)+process[a0_0x3a4eda(0x20e)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x5cebea({'name':a0_0x3a4eda(0x219),'version':a0_0x3a4eda(0x261)},{'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_0x3a4eda(0x242),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x3a4eda(0x249),a0_0x3a4eda(0x20c)+Z][a0_0x3a4eda(0x213)]('\x0a')});K[a0_0x3a4eda(0x1e0)](a0_0x451801,async()=>({'tools':[{'name':a0_0x3a4eda(0x1f3),'description':a0_0x3a4eda(0x260),'inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{'task_id':{'type':a0_0x3a4eda(0x1ef),'description':a0_0x3a4eda(0x244)},'text':{'type':a0_0x3a4eda(0x1ef),'description':a0_0x3a4eda(0x21f)},'status':{'type':'string','enum':[a0_0x3a4eda(0x258),a0_0x3a4eda(0x202),'cancelled',a0_0x3a4eda(0x21c),'error',a0_0x3a4eda(0x208)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x3a4eda(0x1ea)]}},{'name':a0_0x3a4eda(0x259),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{'status':{'type':a0_0x3a4eda(0x1ef),'enum':[a0_0x3a4eda(0x240),a0_0x3a4eda(0x21a),a0_0x3a4eda(0x21c),'error']},'task':{'type':a0_0x3a4eda(0x1ef),'description':'Current\x20task\x20description'},'progress':{'type':'number','description':a0_0x3a4eda(0x22e)}},'required':[a0_0x3a4eda(0x1fb)]}},{'name':a0_0x3a4eda(0x210),'description':a0_0x3a4eda(0x235),'inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{'alias':{'type':a0_0x3a4eda(0x1ef),'description':a0_0x3a4eda(0x236)},'task':{'type':a0_0x3a4eda(0x1ef),'description':a0_0x3a4eda(0x1e2)},'priority':{'type':a0_0x3a4eda(0x1ef),'enum':['high',a0_0x3a4eda(0x23e),'low'],'description':a0_0x3a4eda(0x20d)}},'required':['alias',a0_0x3a4eda(0x22b)]}},{'name':'commhub_send_message','description':a0_0x3a4eda(0x1ee),'inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'message':{'type':'string','description':a0_0x3a4eda(0x22c)}},'required':[a0_0x3a4eda(0x241),'message']}},{'name':a0_0x3a4eda(0x230),'description':a0_0x3a4eda(0x209),'inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{}}}]}));function a0_0x1e45(){const _0x3561c2=['text','60oCJIMU','POST','object','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','string','tools/call','/mcp','claude-code','commhub_reply','priority',']\x20[commhub]\x20','initialize','stderr','2025-03-26','params','session\x20disconnected','status','commhub_send_message','application/json,\x20text/event-stream','http://127.0.0.1:9200','45724WuRsIF','notifications/claude/channel','error','failed','replied','content','inbox_count','unknown\x20tool','then','in_progress','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','slice','config.json','Session\x20alias:\x20','Priority\x20(default:\x20normal)','cwd','stringify','commhub_send_task','type','\x20CWD=','join','get_all_status','indexOf','→\x20injected\x20task\x20',':\x20inbox_count=','send_reply','commhub-channel','idle','parse\x20error:\x20','blocked','.env','\x20from\x20','Reply\x20text\x20/\x20result\x20summary','message','\x22\x20(','catch','Bearer\x20','32kOZIqp','no\x20response','utf-8','hub','20570530CUOpvm','trim','find','task','Message\x20content','read','Progress\x200-100','connect','commhub_get_all_status','data:\x20','25238FArZpM','Authorization','replace','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','Target\x20session\x20alias','report_status','split','new_message','3779112EjTGcr','message_id','write','get','normal','toTimeString','working','alias','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','send_message','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','CommHub\x20init\x20failed:\x20','2.0','MCP\x20stdio\x20connected','shutting\x20down,\x20reporting\x20offline...','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','get_inbox','SSE\x20connected\x20as\x20\x22','statusText','notification','fatal:\x20','SSE\x20stream\x20ended,\x20reconnecting...','ready\x20—\x20waiting\x20for\x20events','4YPdoKO','\x20priority=','←\x20message\x20from\x20','.anet','649795tSYyJl','from','set','completed','commhub_report_status','from_session','startsWith','delete','ENV:\x20URL=','application/json','result','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','0.3.0','randomUUID','send_task','connecting\x20to\x20','parse','tmux\x20display-message\x20-p\x20\x27#S\x27','commhub','ack_inbox','registered\x20as\x20\x22','...\x20TMUX=','setRequestHandler','new_task','Task\x20content','SSE\x20connection\x20error:\x20','.claude/channels/commhub','broadcast','token','cancelled','2950524FJqyGx','1554393kDWhky'];a0_0x1e45=function(){return _0x3561c2;};return a0_0x1e45();}async function P(_0x2c1177,_0x47a35e){const _0x109f41=a0_0x3a4eda;let _0x3847d8=await fetch(D+_0x109f41(0x1f1),{'method':_0x109f41(0x1ec),'headers':{'Content-Type':_0x109f41(0x25e),'Accept':_0x109f41(0x1fd),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x109f41(0x246),'id':0x1,'method':_0x109f41(0x1f6),'params':{'protocolVersion':_0x109f41(0x1f8),'capabilities':{},'clientInfo':{'name':_0x109f41(0x219),'version':_0x109f41(0x261)}}})});if(!_0x3847d8['ok']){let _0x1ce112=await _0x3847d8[_0x109f41(0x1ea)]();return Y(_0x109f41(0x245)+_0x3847d8[_0x109f41(0x1fb)]+'\x20'+_0x1ce112['slice'](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x3847d8[_0x109f41(0x1fb)]};}await _0x3847d8[_0x109f41(0x1ea)]();let _0x3f4fd1=(await(await fetch(D+'/mcp',{'method':_0x109f41(0x1ec),'headers':{'Content-Type':_0x109f41(0x25e),'Accept':_0x109f41(0x1fd),...X?{'Authorization':_0x109f41(0x223)+X}:{}},'body':JSON[_0x109f41(0x20f)]({'jsonrpc':_0x109f41(0x246),'id':0x2,'method':_0x109f41(0x1f0),'params':{'name':_0x2c1177,'arguments':_0x47a35e}})}))['text']())[_0x109f41(0x238)]('\x0a')[_0x109f41(0x22a)](_0x44ffd0=>_0x44ffd0['startsWith']('data:\x20'));if(_0x3f4fd1){let _0x3cdd0f=JSON[_0x109f41(0x1da)](_0x3f4fd1[_0x109f41(0x20a)](0x6));return _0x3cdd0f?.[_0x109f41(0x25f)]?.[_0x109f41(0x204)]?.[0x0]?.['text']?JSON[_0x109f41(0x1da)](_0x3cdd0f['result'][_0x109f41(0x204)][0x0][_0x109f41(0x1ea)]):_0x3cdd0f;}return{'ok':!0x1,'error':_0x109f41(0x225)};}K[a0_0x3a4eda(0x1e0)](a0_0x4f9edb,async _0x5081bc=>{const _0x3f5c52=a0_0x3a4eda;let {name:_0x41683c,arguments:_0x46bac0}=_0x5081bc[_0x3f5c52(0x1f9)];if(_0x41683c==='commhub_reply'){let {task_id:_0x59c60d,text:_0xb7914b,status:_0xe50a12}=_0x46bac0;if(_0xe50a12===_0x3f5c52(0x258)||_0xe50a12===_0x3f5c52(0x202)||_0xe50a12===_0x3f5c52(0x1e7)){let _0x580e0c=_0xe50a12===_0x3f5c52(0x258)?_0x3f5c52(0x203):_0xe50a12,_0x2fb477=_0x59c60d?k[_0x3f5c52(0x23d)](_0x59c60d)||_0x3f5c52(0x227):_0x3f5c52(0x227),_0x40d81a=await P(_0x3f5c52(0x218),{'alias':_0x2fb477,'text':_0xb7914b,'in_reply_to':_0x59c60d||void 0x0,'status':_0x580e0c,'from_session':Z});if(_0x59c60d)k[_0x3f5c52(0x25c)](_0x59c60d);return{'content':[{'type':'text','text':JSON[_0x3f5c52(0x20f)](_0x40d81a)}]};}let _0x567574=await P(_0x3f5c52(0x237),{'resume_id':w,'alias':Z,'status':_0xe50a12===_0x3f5c52(0x21c)?_0x3f5c52(0x21c):_0xe50a12===_0x3f5c52(0x201)?_0x3f5c52(0x201):_0x3f5c52(0x240),'task':_0xb7914b['slice'](0x0,0xc8),'output':_0xb7914b});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x567574)}]};}if(_0x41683c===_0x3f5c52(0x259)){let {status:_0x1ee402,task:_0x1d5c87,progress:_0x57353c}=_0x46bac0,_0x411af2=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x1ee402,'task':_0x1d5c87,'progress':_0x57353c});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x411af2)}]};}if(_0x41683c==='commhub_send_task'){let {alias:_0x5991d2,task:_0x37a3cd,priority:_0xae54e7}=_0x46bac0,_0x36ae04=await P(_0x3f5c52(0x263),{'alias':_0x5991d2,'task':_0x37a3cd,'priority':_0xae54e7||_0x3f5c52(0x23e),'from_session':Z});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x36ae04)}]};}if(_0x41683c===_0x3f5c52(0x1fc)){let {alias:_0x50a927,message:_0x516061}=_0x46bac0,_0x26579a=await P(_0x3f5c52(0x243),{'alias':_0x50a927,'message':_0x516061,'from_session':Z});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x26579a)}]};}if(_0x41683c==='commhub_get_all_status'){let _0x399b5e=await P(_0x3f5c52(0x214),{});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x399b5e)}]};}return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)]({'error':_0x3f5c52(0x206)})}]};});async function v(){const _0x78e300=a0_0x3a4eda;let _0x5a8b40=D+'/events/'+encodeURIComponent(Z),_0x2712de={};if(X)_0x2712de[_0x78e300(0x233)]=_0x78e300(0x223)+X;Y(_0x78e300(0x264)+_0x5a8b40);while(!0x0){try{let _0x2ac962=await fetch(_0x5a8b40,{'headers':_0x2712de});if(!_0x2ac962['ok']){Y('SSE\x20error:\x20'+_0x2ac962[_0x78e300(0x1fb)]+'\x20'+_0x2ac962[_0x78e300(0x24c)]),await h(0x1388);continue;}let _0x181179=_0x2ac962['body']['getReader'](),_0x22e9a6=new TextDecoder(),_0x59af77='';while(!0x0){let {done:_0x39b62e,value:_0x450399}=await _0x181179[_0x78e300(0x22d)]();if(_0x39b62e)break;_0x59af77+=_0x22e9a6['decode'](_0x450399,{'stream':!0x0});let _0x5ae4f5=_0x59af77[_0x78e300(0x238)]('\x0a\x0a');_0x59af77=_0x5ae4f5['pop']()||'';for(let _0x2e8108 of _0x5ae4f5){let _0x350c87=_0x2e8108[_0x78e300(0x238)]('\x0a')[_0x78e300(0x22a)](_0x437a64=>_0x437a64[_0x78e300(0x25b)](_0x78e300(0x231)));if(!_0x350c87)continue;try{let _0x1e1d34=JSON[_0x78e300(0x1da)](_0x350c87[_0x78e300(0x20a)](0x6));await u(_0x1e1d34);}catch(_0x558992){Y(_0x78e300(0x21b)+_0x558992);}}}Y(_0x78e300(0x24f));}catch(_0x2f84b9){Y(_0x78e300(0x1e3)+_0x2f84b9);}await h(0xbb8);}}async function u(_0x2bb535){const _0x2de277=a0_0x3a4eda;if(_0x2bb535[_0x2de277(0x211)]==='connected'){Y(_0x2de277(0x24b)+Z+'\x22');return;}if(_0x2bb535[_0x2de277(0x211)]===_0x2de277(0x239)){if(Y(_0x2de277(0x253)+_0x2bb535['from']+':\x20'+_0x2bb535[_0x2de277(0x220)]['slice'](0x0,0x3c)),await K['notification']({'method':_0x2de277(0x200),'params':{'content':_0x2bb535[_0x2de277(0x220)],'meta':{'sender':_0x2bb535[_0x2de277(0x256)]||_0x2de277(0x227),'sender_id':'commhub','user':_0x2bb535[_0x2de277(0x256)]||'hub','priority':_0x2de277(0x23e)}}}),_0x2bb535[_0x2de277(0x23b)])await P(_0x2de277(0x1dd),{'alias':Z,'message_id':_0x2bb535[_0x2de277(0x23b)]});return;}if(_0x2bb535[_0x2de277(0x211)]===_0x2de277(0x1e1)||_0x2bb535[_0x2de277(0x211)]===_0x2de277(0x1e5)){Y('←\x20'+_0x2bb535[_0x2de277(0x211)]+_0x2de277(0x217)+_0x2bb535[_0x2de277(0x205)]+_0x2de277(0x252)+(_0x2bb535['priority']||_0x2de277(0x23e)));let _0x32a9d9=await P(_0x2de277(0x24a),{'alias':Z,'limit':0x5});if(_0x32a9d9?.['ok']&&_0x32a9d9['messages']?.['length']>0x0)for(let _0x2ef2f6 of _0x32a9d9['messages']){let _0x1ed6d1={'sender':_0x2ef2f6['from_session']||_0x2de277(0x227),'sender_id':_0x2de277(0x1dc),'user':_0x2ef2f6[_0x2de277(0x25a)]||_0x2de277(0x227),'task_id':_0x2ef2f6['id'],'priority':_0x2ef2f6[_0x2de277(0x1f4)]||_0x2de277(0x23e)};k[_0x2de277(0x257)](_0x2ef2f6['id'],_0x2ef2f6[_0x2de277(0x25a)]||_0x2de277(0x227)),await K[_0x2de277(0x24d)]({'method':_0x2de277(0x200),'params':{'content':_0x2ef2f6[_0x2de277(0x204)],'meta':_0x1ed6d1}}),Y(_0x2de277(0x216)+_0x2ef2f6['id'][_0x2de277(0x20a)](0x0,0x8)+_0x2de277(0x21e)+_0x2ef2f6[_0x2de277(0x25a)]+':\x20'+_0x2ef2f6[_0x2de277(0x204)]['slice'](0x0,0x3c)),await P(_0x2de277(0x1dd),{'alias':Z,'message_id':_0x2ef2f6['id']});}}}async function S(){const _0x1e697d=a0_0x3a4eda;let _0x442671=new a0_0x16de72();await K[_0x1e697d(0x22f)](_0x442671),Y(_0x1e697d(0x247)),Y('starting\x20SSE\x20listener...'),v()[_0x1e697d(0x222)](_0x2be00c=>Y('SSE\x20fatal:\x20'+_0x2be00c)),P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x428b3e(),'hostname':a0_0x428b3e(),'agent':_0x1e697d(0x1f2),'project_dir':process[_0x1e697d(0x20e)](),'tmux_name':f||void 0x0})[_0x1e697d(0x207)](()=>Y(_0x1e697d(0x1de)+Z+_0x1e697d(0x221)+w[_0x1e697d(0x20a)](0x0,0x8)+')'))['catch'](_0x57a92b=>Y('warning:\x20could\x20not\x20register:\x20'+_0x57a92b)),setInterval(()=>{const _0x1d735e=_0x1e697d;P(_0x1d735e(0x237),{'resume_id':w,'alias':Z,'status':_0x1d735e(0x21a),'server':a0_0x428b3e(),'hostname':a0_0x428b3e(),'agent':_0x1d735e(0x1f2),'project_dir':process[_0x1d735e(0x20e)](),'tmux_name':f||void 0x0})[_0x1d735e(0x222)](_0xfe6cee=>Y('heartbeat\x20failed:\x20'+_0xfe6cee));},0x2bf20),Y(_0x1e697d(0x250));}S()['catch'](_0x2aec6a=>{const _0x536b97=a0_0x3a4eda;Y(_0x536b97(0x24e)+_0x2aec6a),process['exit'](0x1);});async function N(){const _0x3bd35e=a0_0x3a4eda;Y(_0x3bd35e(0x248)),await P(_0x3bd35e(0x237),{'resume_id':w,'alias':Z,'status':_0x3bd35e(0x201),'task':_0x3bd35e(0x1fa)})['catch'](()=>{}),process['exit'](0x0);}process['stdin']['on']('end',()=>N()),process['on']('SIGTERM',()=>N()),process['on']('SIGINT',()=>N());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.0.0-preview.5",
3
+ "version": "2.0.0-preview.6",
4
4
  "description": "AI Agent Network — Server + Client + Setup in one package. SSE real-time communication for multi-agent orchestration.",
5
5
  "type": "module",
6
6
  "main": "dist/src/client.js",