@sleep2agi/agent-network 2.0.0-preview.25 → 2.0.0-preview.26

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_0x1a26ba=a0_0x5850;(function(_0x4c0c1d,_0x1ec7d6){const _0x5a7f9f=a0_0x5850,_0x1756a3=_0x4c0c1d();while(!![]){try{const _0x77c333=-parseInt(_0x5a7f9f(0x1e0))/0x1*(parseInt(_0x5a7f9f(0x1d1))/0x2)+-parseInt(_0x5a7f9f(0x1d8))/0x3+-parseInt(_0x5a7f9f(0x20b))/0x4+-parseInt(_0x5a7f9f(0x1ef))/0x5+-parseInt(_0x5a7f9f(0x1e8))/0x6+parseInt(_0x5a7f9f(0x21a))/0x7*(-parseInt(_0x5a7f9f(0x1e3))/0x8)+-parseInt(_0x5a7f9f(0x203))/0x9*(-parseInt(_0x5a7f9f(0x1cd))/0xa);if(_0x77c333===_0x1ec7d6)break;else _0x1756a3['push'](_0x1756a3['shift']());}catch(_0x3eeb02){_0x1756a3['push'](_0x1756a3['shift']());}}}(a0_0x1904,0x40b24));import{EventEmitter as a0_0x36b051}from'events';import{hostname as a0_0x1892c4}from'os';class T extends a0_0x36b051{[a0_0x1a26ba(0x1fe)];[a0_0x1a26ba(0x1d6)];[a0_0x1a26ba(0x216)];[a0_0x1a26ba(0x210)];[a0_0x1a26ba(0x1e5)];[a0_0x1a26ba(0x1f8)];[a0_0x1a26ba(0x1d5)];['heartbeatTimer'];[a0_0x1a26ba(0x1ca)];['running']=!0x1;constructor(_0x5f023d){const _0x308d5f=a0_0x1a26ba;super();if(this[_0x308d5f(0x1fe)]=_0x5f023d['url'][_0x308d5f(0x1eb)](/\/$/,''),this['alias']=_0x5f023d['alias'],this[_0x308d5f(0x216)]=_0x5f023d[_0x308d5f(0x216)],this[_0x308d5f(0x210)]=_0x5f023d[_0x308d5f(0x210)]||_0x308d5f(0x1ec),this[_0x308d5f(0x1e5)]=_0x308d5f(0x21e)+_0x5f023d[_0x308d5f(0x1d6)]+'-'+Date[_0x308d5f(0x1fb)]()[_0x308d5f(0x1ff)](0x24),this[_0x308d5f(0x1f8)]=_0x5f023d['heartbeatInterval']??0x2bf20,this[_0x308d5f(0x1d5)]=_0x5f023d[_0x308d5f(0x1d5)]??0xbb8,_0x5f023d[_0x308d5f(0x1d7)]!==!0x1)this[_0x308d5f(0x20e)]();}['log'](_0x24ffe1){const _0x73f2e4=a0_0x1a26ba;console[_0x73f2e4(0x1e4)]('['+new Date()[_0x73f2e4(0x20c)]()[_0x73f2e4(0x1f3)](0x0,0x8)+_0x73f2e4(0x1e2)+this[_0x73f2e4(0x1d6)]+']\x20'+_0x24ffe1);}async[a0_0x1a26ba(0x221)](_0x36c885,_0x37dcba){const _0x269f40=a0_0x1a26ba;let _0x460006={'Content-Type':_0x269f40(0x1e9),'Accept':_0x269f40(0x1f6)};if(this[_0x269f40(0x216)])_0x460006['Authorization']=_0x269f40(0x208)+this[_0x269f40(0x216)];let _0x2acd87=await(await fetch(this[_0x269f40(0x1fe)]+_0x269f40(0x20d),{'method':_0x269f40(0x202),'headers':_0x460006,'body':JSON[_0x269f40(0x1de)]({'jsonrpc':_0x269f40(0x1f9),'id':Date[_0x269f40(0x1fb)](),'method':'tools/call','params':{'name':_0x36c885,'arguments':_0x37dcba}})}))['text'](),_0x1572b4=_0x2acd87['match'](/data: (.+)/),_0x38c197=_0x1572b4?JSON['parse'](_0x1572b4[0x1]):JSON[_0x269f40(0x21d)](_0x2acd87),_0x7d00c8=_0x38c197?.[_0x269f40(0x1fc)]?.[_0x269f40(0x21b)]?.[0x0]?.[_0x269f40(0x213)];return _0x7d00c8?JSON['parse'](_0x7d00c8):_0x38c197;}async[a0_0x1a26ba(0x20e)](){const _0xbfd54e=a0_0x1a26ba;if(this['running'])return;this['running']=!0x0,await this[_0xbfd54e(0x1f5)]('idle'),this[_0xbfd54e(0x1e4)]('registered'),this[_0xbfd54e(0x204)]=setInterval(()=>{const _0x4c32ff=_0xbfd54e;this[_0x4c32ff(0x1f5)](_0x4c32ff(0x201))['catch'](_0x11b68c=>this[_0x4c32ff(0x1e4)](_0x4c32ff(0x209)+_0x11b68c['message']));},this[_0xbfd54e(0x1f8)]),this[_0xbfd54e(0x1dc)]();}async['disconnect'](){const _0x4460e0=a0_0x1a26ba;if(this[_0x4460e0(0x215)]=!0x1,this['sseAbort']?.['abort'](),this[_0x4460e0(0x204)])clearInterval(this[_0x4460e0(0x204)]);await this[_0x4460e0(0x1f5)]('offline')['catch'](()=>{}),this[_0x4460e0(0x1e4)](_0x4460e0(0x1ce));}async[a0_0x1a26ba(0x1f1)](_0x3bdd86,_0x573c34,_0x4dda2a=a0_0x1a26ba(0x1cc)){const _0x47e2e9=a0_0x1a26ba;return this[_0x47e2e9(0x221)](_0x47e2e9(0x219),{'alias':_0x3bdd86,'task':_0x573c34,'priority':_0x4dda2a,'from_session':this[_0x47e2e9(0x1d6)]});}async[a0_0x1a26ba(0x205)](_0x51b94d,_0x5f4704){const _0xae5598=a0_0x1a26ba;return this[_0xae5598(0x221)]('send_message',{'alias':_0x51b94d,'message':_0x5f4704,'from_session':this[_0xae5598(0x1d6)]});}async[a0_0x1a26ba(0x1f7)](_0x5b8101,_0x1f9a1f,_0x571239=a0_0x1a26ba(0x1fa)){const _0x15bd91=a0_0x1a26ba;return this[_0x15bd91(0x221)](_0x15bd91(0x1f7),{'task_id':_0x5b8101,'text':_0x1f9a1f,'status':_0x571239});}async[a0_0x1a26ba(0x1f5)](_0x1d37ca,_0xec921b){const _0x6ee3d6=a0_0x1a26ba;return this[_0x6ee3d6(0x221)](_0x6ee3d6(0x1ea),{'resume_id':this[_0x6ee3d6(0x1e5)],'alias':this[_0x6ee3d6(0x1d6)],'status':_0x1d37ca,'server':a0_0x1892c4(),'hostname':a0_0x1892c4(),'agent':this[_0x6ee3d6(0x210)],'project_dir':process[_0x6ee3d6(0x1f2)](),..._0xec921b});}async[a0_0x1a26ba(0x1db)](){const _0x3a90f5=a0_0x1a26ba;return this[_0x3a90f5(0x221)](_0x3a90f5(0x1d9),{});}async['broadcast'](_0x1f864f,_0x24357e){const _0x4caa12=a0_0x1a26ba;return this[_0x4caa12(0x221)](_0x4caa12(0x1df),{'message':_0x1f864f,'filter_server':_0x24357e?.[_0x4caa12(0x206)],'filter_status':_0x24357e?.[_0x4caa12(0x1f5)]});}async[a0_0x1a26ba(0x1dc)](){const _0x13c4da=a0_0x1a26ba;let _0x169752=encodeURIComponent(this[_0x13c4da(0x1d6)]),_0x596c8c=this['url']+_0x13c4da(0x1f0)+_0x169752,_0x2fd503=this[_0x13c4da(0x1d5)];while(this[_0x13c4da(0x215)]){try{this[_0x13c4da(0x1ca)]=new AbortController();let _0x3c045b={'Accept':_0x13c4da(0x21f)};if(this['token'])_0x3c045b['Authorization']=_0x13c4da(0x208)+this[_0x13c4da(0x216)];let _0x4c4279=await fetch(_0x596c8c,{'headers':_0x3c045b,'signal':this[_0x13c4da(0x1ca)][_0x13c4da(0x214)]});if(!_0x4c4279['ok']||!_0x4c4279['body']){this['log'](_0x13c4da(0x1d4)+_0x4c4279[_0x13c4da(0x1f5)]),await this[_0x13c4da(0x1e6)](_0x2fd503),_0x2fd503=Math[_0x13c4da(0x1dd)](_0x2fd503*1.5,0xea60);continue;}_0x2fd503=this[_0x13c4da(0x1d5)];let _0x1267e8=_0x4c4279[_0x13c4da(0x1ee)]['getReader'](),_0x2d9b50=new TextDecoder(),_0x4a97fb='';while(this['running']){let {done:_0x3571cf,value:_0x41800c}=await _0x1267e8[_0x13c4da(0x1e1)]();if(_0x3571cf)break;_0x4a97fb+=_0x2d9b50[_0x13c4da(0x207)](_0x41800c,{'stream':!0x0});let _0x863401=_0x4a97fb[_0x13c4da(0x212)]('\x0a');_0x4a97fb=_0x863401[_0x13c4da(0x1cf)]()||'';for(let _0x3d2bbf of _0x863401){if(!_0x3d2bbf[_0x13c4da(0x1d2)](_0x13c4da(0x20a)))continue;try{let _0x2dbbe8=JSON[_0x13c4da(0x21d)](_0x3d2bbf[_0x13c4da(0x1f3)](0x6));if(_0x2dbbe8[_0x13c4da(0x1da)]===_0x13c4da(0x200)){this[_0x13c4da(0x1e4)]('SSE\x20connected'),this[_0x13c4da(0x1f4)](_0x13c4da(0x200));continue;}if(_0x2dbbe8[_0x13c4da(0x1da)]===_0x13c4da(0x1e7)||_0x2dbbe8['type']===_0x13c4da(0x217)||_0x2dbbe8['type']===_0x13c4da(0x1df))await this[_0x13c4da(0x1fd)]();}catch{}}}}catch(_0x52faa0){if(_0x52faa0[_0x13c4da(0x21c)]==='AbortError')break;this[_0x13c4da(0x1f4)](_0x13c4da(0x220),_0x52faa0),this['log'](_0x13c4da(0x20f)+_0x52faa0[_0x13c4da(0x205)]);}if(this['running'])this[_0x13c4da(0x1f4)](_0x13c4da(0x1ce)),this[_0x13c4da(0x1e4)](_0x13c4da(0x1cb)+_0x2fd503/0x3e8+_0x13c4da(0x1d0)),await this[_0x13c4da(0x1e6)](_0x2fd503),_0x2fd503=Math[_0x13c4da(0x1dd)](_0x2fd503*1.5,0xea60);}}async[a0_0x1a26ba(0x1fd)](){const _0x38ab64=a0_0x1a26ba;try{let _0x1c4381=(await this['call'](_0x38ab64(0x1d3),{'alias':this[_0x38ab64(0x1d6)],'limit':0xa}))?.[_0x38ab64(0x211)]||[];for(let _0x59d7f9 of _0x1c4381)await this[_0x38ab64(0x221)]('ack_inbox',{'alias':this[_0x38ab64(0x1d6)],'message_id':_0x59d7f9['id']}),this['log']('←\x20'+_0x59d7f9[_0x38ab64(0x218)]+':\x20'+_0x59d7f9[_0x38ab64(0x21b)][_0x38ab64(0x1f3)](0x0,0x3c)),this['emit'](_0x38ab64(0x1ed),_0x59d7f9),this[_0x38ab64(0x1f4)](_0x38ab64(0x205),_0x59d7f9);}catch(_0x5c58d6){this[_0x38ab64(0x1e4)]('inbox\x20error:\x20'+_0x5c58d6[_0x38ab64(0x205)]);}}['sleep'](_0x20ec76){return new Promise(_0x7a9b28=>setTimeout(_0x7a9b28,_0x20ec76));}}function a0_0x5850(_0x1b4e38,_0x27a880){_0x1b4e38=_0x1b4e38-0x1ca;const _0x190428=a0_0x1904();let _0x5850c4=_0x190428[_0x1b4e38];return _0x5850c4;}var $=T;function a0_0x1904(){const _0x50d08e=['signal','running','token','new_message','from_session','send_task','41594emwPOu','content','name','parse','sdk-','text/event-stream','error','call','sseAbort','SSE\x20reconnecting\x20in\x20','normal','10dPxvdh','disconnected','pop','s...','393128XALUeA','startsWith','get_inbox','SSE\x20failed:\x20','reconnectDelay','alias','autoConnect','805194nZghJX','get_all_status','type','getAllStatus','connectSSE','min','stringify','broadcast','1fGtqUn','read',']\x20[commhub:','224NSHPcw','log','resumeId','sleep','new_task','2700180RSOqud','application/json','report_status','replace','sdk','task','body','9055tBhBkX','/events/','send','cwd','slice','emit','status','application/json,\x20text/event-stream','reply','heartbeatInterval','2.0','completed','now','result','processInbox','url','toString','connected','idle','POST','15178518MFOrdu','heartbeatTimer','message','server','decode','Bearer\x20','heartbeat\x20failed:\x20','data:\x20','1353308CqJCAR','toTimeString','/mcp','connect','SSE\x20error:\x20','agent','messages','split','text'];a0_0x1904=function(){return _0x50d08e;};return a0_0x1904();}export{$ as default,T as CommHub};
1
+ const a0_0x2102b0=a0_0x2a2e;(function(_0x177dcb,_0x24e9dd){const _0x529566=a0_0x2a2e,_0x1a8b77=_0x177dcb();while(!![]){try{const _0x5ea71b=parseInt(_0x529566(0xa0))/0x1+-parseInt(_0x529566(0xe9))/0x2*(parseInt(_0x529566(0xa3))/0x3)+parseInt(_0x529566(0xa6))/0x4*(parseInt(_0x529566(0xe1))/0x5)+-parseInt(_0x529566(0xe0))/0x6*(-parseInt(_0x529566(0xf3))/0x7)+parseInt(_0x529566(0xd1))/0x8*(parseInt(_0x529566(0xe6))/0x9)+parseInt(_0x529566(0xd5))/0xa*(parseInt(_0x529566(0xdc))/0xb)+-parseInt(_0x529566(0xa7))/0xc;if(_0x5ea71b===_0x24e9dd)break;else _0x1a8b77['push'](_0x1a8b77['shift']());}catch(_0x3fd5c8){_0x1a8b77['push'](_0x1a8b77['shift']());}}}(a0_0x7602,0xed22c));import{EventEmitter as a0_0x4bb4cd}from'events';function a0_0x2a2e(_0xe66631,_0x30f55a){_0xe66631=_0xe66631-0x9f;const _0x7602f8=a0_0x7602();let _0x2a2e47=_0x7602f8[_0xe66631];return _0x2a2e47;}import{hostname as a0_0x2b4ca5}from'os';class T extends a0_0x4bb4cd{[a0_0x2102b0(0xe8)];[a0_0x2102b0(0xa1)];[a0_0x2102b0(0xba)];['agent'];[a0_0x2102b0(0xb8)];[a0_0x2102b0(0xaa)];[a0_0x2102b0(0xc5)];[a0_0x2102b0(0xb1)];[a0_0x2102b0(0xec)];['running']=!0x1;constructor(_0x52b74f){const _0xce8712=a0_0x2102b0;super();if(this[_0xce8712(0xe8)]=_0x52b74f[_0xce8712(0xe8)][_0xce8712(0xf5)](/\/$/,''),this[_0xce8712(0xa1)]=_0x52b74f[_0xce8712(0xa1)],this['token']=_0x52b74f['token'],this[_0xce8712(0xb4)]=_0x52b74f['agent']||_0xce8712(0xe3),this['resumeId']='sdk-'+_0x52b74f['alias']+'-'+Date[_0xce8712(0xbd)]()['toString'](0x24),this[_0xce8712(0xaa)]=_0x52b74f['heartbeatInterval']??0x2bf20,this[_0xce8712(0xc5)]=_0x52b74f[_0xce8712(0xc5)]??0xbb8,_0x52b74f[_0xce8712(0xc4)]!==!0x1)this[_0xce8712(0xf4)]();}['log'](_0x99040){const _0x38dcc0=a0_0x2102b0;console[_0x38dcc0(0xb0)]('['+new Date()[_0x38dcc0(0xc1)]()[_0x38dcc0(0xca)](0x0,0x8)+_0x38dcc0(0xdf)+this['alias']+']\x20'+_0x99040);}async[a0_0x2102b0(0xc6)](_0x4c8a4f,_0x235602){const _0x519573=a0_0x2102b0;let _0x45f3fa={'Content-Type':_0x519573(0xd0),'Accept':_0x519573(0xa9)};if(this[_0x519573(0xba)])_0x45f3fa[_0x519573(0xb5)]=_0x519573(0xde)+this[_0x519573(0xba)];let _0x3c7a7b=await(await fetch(this[_0x519573(0xe8)]+_0x519573(0xea),{'method':_0x519573(0xcc),'headers':_0x45f3fa,'body':JSON[_0x519573(0xa5)]({'jsonrpc':_0x519573(0xd8),'id':Date['now'](),'method':_0x519573(0xa4),'params':{'name':_0x4c8a4f,'arguments':_0x235602}})}))['text'](),_0x5d55cf=_0x3c7a7b[_0x519573(0xed)](/data: (.+)/),_0xa71a5d=_0x5d55cf?JSON[_0x519573(0xf8)](_0x5d55cf[0x1]):JSON[_0x519573(0xf8)](_0x3c7a7b),_0x2757e9=_0xa71a5d?.['result']?.[_0x519573(0xbb)]?.[0x0]?.[_0x519573(0xb9)];return _0x2757e9?JSON[_0x519573(0xf8)](_0x2757e9):_0xa71a5d;}async[a0_0x2102b0(0xf4)](){const _0x10405c=a0_0x2102b0;if(this[_0x10405c(0xee)])return;this[_0x10405c(0xee)]=!0x0,await this[_0x10405c(0xb3)]('idle'),this[_0x10405c(0xb0)](_0x10405c(0xac)),this[_0x10405c(0xb1)]=setInterval(()=>{const _0x1af245=_0x10405c;this[_0x1af245(0xb3)](_0x1af245(0xf0))[_0x1af245(0xbe)](_0x2aae01=>this[_0x1af245(0xb0)](_0x1af245(0xd4)+_0x2aae01[_0x1af245(0xb6)]));},this['heartbeatInterval']),this[_0x10405c(0xd3)]();}async[a0_0x2102b0(0xe2)](){const _0x38e15e=a0_0x2102b0;if(this[_0x38e15e(0xee)]=!0x1,this['sseAbort']?.[_0x38e15e(0xbc)](),this[_0x38e15e(0xb1)])clearInterval(this['heartbeatTimer']);await this[_0x38e15e(0xb3)](_0x38e15e(0xeb))[_0x38e15e(0xbe)](()=>{}),this['log'](_0x38e15e(0xef));}async[a0_0x2102b0(0xf6)](_0x4b9b21,_0x19eca3,_0x1f06a2='normal'){const _0x494207=a0_0x2102b0;return this[_0x494207(0xc6)](_0x494207(0xa8),{'alias':_0x4b9b21,'task':_0x19eca3,'priority':_0x1f06a2,'from_session':this[_0x494207(0xa1)]});}async[a0_0x2102b0(0xb6)](_0x41da49,_0x37d9cc){const _0xad2796=a0_0x2102b0;return this[_0xad2796(0xc6)](_0xad2796(0xce),{'alias':_0x41da49,'message':_0x37d9cc,'from_session':this['alias']});}async[a0_0x2102b0(0xc7)](_0x2f79df,_0x2009ed,_0x11fe05=a0_0x2102b0(0xc2)){const _0x493d8e=a0_0x2102b0;return this['call'](_0x493d8e(0xc7),{'task_id':_0x2f79df,'text':_0x2009ed,'status':_0x11fe05});}async[a0_0x2102b0(0xb3)](_0x306f73,_0x4da296){const _0x7fd085=a0_0x2102b0;return this['call']('report_status',{'resume_id':this[_0x7fd085(0xb8)],'alias':this[_0x7fd085(0xa1)],'status':_0x306f73,'server':a0_0x2b4ca5(),'hostname':a0_0x2b4ca5(),'agent':this[_0x7fd085(0xb4)],'project_dir':process[_0x7fd085(0xc3)](),..._0x4da296});}async['getAllStatus'](){const _0x32cfd3=a0_0x2102b0;return this[_0x32cfd3(0xc6)](_0x32cfd3(0xd7),{});}async['broadcast'](_0x4b94e0,_0x3dba05){const _0x154c2b=a0_0x2102b0;return this['call'](_0x154c2b(0xc0),{'message':_0x4b94e0,'filter_server':_0x3dba05?.[_0x154c2b(0xaf)],'filter_status':_0x3dba05?.[_0x154c2b(0xb3)]});}async[a0_0x2102b0(0xd3)](){const _0x3deccd=a0_0x2102b0;let _0x584572=encodeURIComponent(this[_0x3deccd(0xa1)]),_0xb64f24=this[_0x3deccd(0xe8)]+'/events/'+_0x584572,_0xe7797d=this['reconnectDelay'];while(this[_0x3deccd(0xee)]){try{this[_0x3deccd(0xec)]=new AbortController();let _0x4dd804={'Accept':_0x3deccd(0xab)};if(this[_0x3deccd(0xba)])_0x4dd804[_0x3deccd(0xb5)]=_0x3deccd(0xde)+this['token'];let _0x1ddaa2=await fetch(_0xb64f24,{'headers':_0x4dd804,'signal':this['sseAbort'][_0x3deccd(0xcb)]});if(!_0x1ddaa2['ok']||!_0x1ddaa2['body']){this[_0x3deccd(0xb0)](_0x3deccd(0xe4)+_0x1ddaa2[_0x3deccd(0xb3)]),await this['sleep'](_0xe7797d),_0xe7797d=Math['min'](_0xe7797d*1.5,0xea60);continue;}_0xe7797d=this[_0x3deccd(0xc5)];let _0x29e099=_0x1ddaa2['body']['getReader'](),_0x125d8d=new TextDecoder(),_0x202db9='';while(this[_0x3deccd(0xee)]){let {done:_0x5e6dfd,value:_0x2b059e}=await _0x29e099[_0x3deccd(0x9f)]();if(_0x5e6dfd)break;_0x202db9+=_0x125d8d[_0x3deccd(0xd9)](_0x2b059e,{'stream':!0x0});let _0x4e08df=_0x202db9[_0x3deccd(0xe5)]('\x0a');_0x202db9=_0x4e08df[_0x3deccd(0xcf)]()||'';for(let _0x3fcc22 of _0x4e08df){if(!_0x3fcc22[_0x3deccd(0xcd)](_0x3deccd(0xd2)))continue;try{let _0x2c352f=JSON[_0x3deccd(0xf8)](_0x3fcc22[_0x3deccd(0xca)](0x6));if(_0x2c352f[_0x3deccd(0xda)]===_0x3deccd(0xf2)){this[_0x3deccd(0xb0)](_0x3deccd(0xc9)),this[_0x3deccd(0xb7)](_0x3deccd(0xf2));continue;}if(_0x2c352f[_0x3deccd(0xda)]===_0x3deccd(0xf7)||_0x2c352f['type']==='new_message'||_0x2c352f['type']===_0x3deccd(0xc0))await this[_0x3deccd(0xae)]();}catch{}}}}catch(_0x61f823){if(_0x61f823[_0x3deccd(0xb2)]===_0x3deccd(0xdb))break;this[_0x3deccd(0xb7)](_0x3deccd(0xd6),_0x61f823),this['log']('SSE\x20error:\x20'+_0x61f823[_0x3deccd(0xb6)]);}if(this[_0x3deccd(0xee)])this['emit'](_0x3deccd(0xef)),this[_0x3deccd(0xb0)](_0x3deccd(0xc8)+_0xe7797d/0x3e8+'s...'),await this[_0x3deccd(0xe7)](_0xe7797d),_0xe7797d=Math[_0x3deccd(0xdd)](_0xe7797d*1.5,0xea60);}}async[a0_0x2102b0(0xae)](){const _0x3e96c4=a0_0x2102b0;try{let _0x4d7996=(await this['call']('get_inbox',{'alias':this[_0x3e96c4(0xa1)],'limit':0xa}))?.[_0x3e96c4(0xbf)]||[];for(let _0x3d7b08 of _0x4d7996)await this[_0x3e96c4(0xc6)](_0x3e96c4(0xa2),{'alias':this[_0x3e96c4(0xa1)],'message_id':_0x3d7b08['id']}),this['log']('←\x20'+_0x3d7b08[_0x3e96c4(0xad)]+':\x20'+_0x3d7b08[_0x3e96c4(0xbb)][_0x3e96c4(0xca)](0x0,0x3c)),this[_0x3e96c4(0xb7)]('task',_0x3d7b08),this['emit'](_0x3e96c4(0xb6),_0x3d7b08);}catch(_0x105731){this[_0x3e96c4(0xb0)](_0x3e96c4(0xf1)+_0x105731[_0x3e96c4(0xb6)]);}}['sleep'](_0x4adc7d){return new Promise(_0x48b019=>setTimeout(_0x48b019,_0x4adc7d));}}function a0_0x7602(){const _0x5ae777=['stringify','106936LvmUKU','24483552NaXskA','send_task','application/json,\x20text/event-stream','heartbeatInterval','text/event-stream','registered','from_session','processInbox','server','log','heartbeatTimer','name','status','agent','Authorization','message','emit','resumeId','text','token','content','abort','now','catch','messages','broadcast','toTimeString','completed','cwd','autoConnect','reconnectDelay','call','reply','SSE\x20reconnecting\x20in\x20','SSE\x20connected','slice','signal','POST','startsWith','send_message','pop','application/json','24tRXChY','data:\x20','connectSSE','heartbeat\x20failed:\x20','2490eaOhHe','error','get_all_status','2.0','decode','type','AbortError','9031Qzzeyp','min','Bearer\x20',']\x20[commhub:','4029990akdCyA','45GArLZE','disconnect','sdk','SSE\x20failed:\x20','split','5240583sCGKkC','sleep','url','6lRiATz','/mcp','offline','sseAbort','match','running','disconnected','idle','inbox\x20error:\x20','connected','7PXBYoZ','connect','replace','send','new_task','parse','read','189548xUbgoH','alias','ack_inbox','41505xvjrcI','tools/call'];a0_0x7602=function(){return _0x5ae777;};return a0_0x7602();}var $=T;export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0xaf1b4d=a0_0x3a1b;(function(_0x36bed5,_0x3be8fd){const _0x22733a=a0_0x3a1b,_0x513acb=_0x36bed5();while(!![]){try{const _0x43933a=parseInt(_0x22733a(0x12b))/0x1*(-parseInt(_0x22733a(0x15c))/0x2)+-parseInt(_0x22733a(0x165))/0x3+-parseInt(_0x22733a(0x13f))/0x4+parseInt(_0x22733a(0x15d))/0x5+-parseInt(_0x22733a(0x163))/0x6+-parseInt(_0x22733a(0x161))/0x7*(-parseInt(_0x22733a(0x172))/0x8)+parseInt(_0x22733a(0x109))/0x9*(parseInt(_0x22733a(0x12c))/0xa);if(_0x43933a===_0x3be8fd)break;else _0x513acb['push'](_0x513acb['shift']());}catch(_0x2e2355){_0x513acb['push'](_0x513acb['shift']());}}}(a0_0x1457,0x3cd75));import{readFileSync as a0_0x2d475e,existsSync as a0_0x284e7f}from'fs';import{join as a0_0x384299}from'path';import{hostname as a0_0x2ae81f}from'os';import{execSync as a0_0x999a1f}from'child_process';import{Server as a0_0x73f1f9}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x3a1b(_0x584722,_0x4cbc8b){_0x584722=_0x584722-0xf1;const _0x1457df=a0_0x1457();let _0x3a1b10=_0x1457df[_0x584722];return _0x3a1b10;}import{StdioServerTransport as a0_0x482d48}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0xd1454e,CallToolRequestSchema as a0_0x462085}from'@modelcontextprotocol/sdk/types.js';function p(_0x47164c){const _0x5a622=a0_0x3a1b;if(!a0_0x284e7f(_0x47164c))return;for(let _0x478d7e of a0_0x2d475e(_0x47164c,_0x5a622(0x114))[_0x5a622(0xf2)]('\x0a')){let _0x5ea864=_0x478d7e['trim']();if(!_0x5ea864||_0x5ea864['startsWith']('#'))continue;let _0x2fbac6=_0x5ea864[_0x5a622(0x164)]('=');if(_0x2fbac6<0x0)continue;let _0x43ab2b=_0x5ea864['slice'](0x0,_0x2fbac6)[_0x5a622(0x116)](),_0x2d8bd0=_0x5ea864[_0x5a622(0xf9)](_0x2fbac6+0x1)[_0x5a622(0x116)]()[_0x5a622(0x103)](/^["']|["']$/g,'');if(!process.env[_0x43ab2b])process.env[_0x43ab2b]=_0x2d8bd0;}}var C=process.env.HOME||'~',T=a0_0x384299(C,a0_0xaf1b4d(0x118));p(a0_0x384299(T,a0_0xaf1b4d(0x16a)));var L=process[a0_0xaf1b4d(0x150)]()[a0_0xaf1b4d(0x103)](/\//g,'-');p(a0_0x384299(T,L,a0_0xaf1b4d(0x16a)));function U(){const _0x4c72e8=a0_0xaf1b4d;try{return a0_0x999a1f('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x4c72e8(0x114),'timeout':0x7d0})[_0x4c72e8(0x116)]();}catch{return'';}}function c(){const _0x56a00d=a0_0xaf1b4d;try{let _0x3a7282=a0_0x384299(C,_0x56a00d(0x147),'config.json');if(a0_0x284e7f(_0x3a7282))return JSON[_0x56a00d(0x10d)](a0_0x2d475e(_0x3a7282,_0x56a00d(0x114)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0xaf1b4d(0x137)]||a0_0xaf1b4d(0x17d),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x2ae81f(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0xaf1b4d(0x112)](),X=process.env.COMMHUB_TOKEN||H[a0_0xaf1b4d(0x162)]||'';function Y(_0x3d350b){const _0x4a1d03=a0_0xaf1b4d;let _0x203b60=new Date()[_0x4a1d03(0x11e)]()[_0x4a1d03(0xf9)](0x0,0x8);process[_0x4a1d03(0x104)][_0x4a1d03(0xfe)]('['+_0x203b60+_0x4a1d03(0x182)+_0x3d350b+'\x0a');}function h(_0x2f9a60){return new Promise(_0x388be0=>setTimeout(_0x388be0,_0x2f9a60));}function a0_0x1457(){const _0x45e5ca=['type','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','ack_inbox','inbox_count','\x20ALIAS=','parse\x20error:\x20','tools/call','from','set','25975halnGd','32890QvoxZU','then','string','2025-03-26','priority','SSE\x20connection\x20error:\x20','POST','content','application/json','commhub_send_message','SIGINT','hub','Bearer\x20','end','object','/mcp','2.0','\x20PROJECT_ENV=','commhub_get_all_status','1756412EpAQnJ','normal','pop','get','0.3.0','working','\x22\x20(','broadcast','.anet','report_status','idle','SSE\x20fatal:\x20','setRequestHandler','get_inbox','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','failed','statusText','cwd','commhub-channel','alias','warning:\x20could\x20not\x20register:\x20','get_all_status','messages','Session\x20alias:\x20','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','Progress\x200-100','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','number','message','14sUcddx','540485PySDlN','catch','initialize','session\x20disconnected','229859whjnGs','token','2130318ZlrUUE','indexOf','939129kPrjCL','notifications/claude/channel','\x20from\x20','low','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','.env','heartbeat\x20failed:\x20','ENV:\x20URL=','\x20priority=','decode','SSE\x20error:\x20','←\x20message\x20from\x20','unknown\x20tool','88TqVOFK','new_task','starting\x20SSE\x20listener...','params','join','stringify','/events/','connecting\x20to\x20','text','cancelled','none','http://127.0.0.1:9200','shutting\x20down,\x20reporting\x20offline...','no\x20response','registered\x20as\x20\x22','commhub_send_task',']\x20[commhub]\x20','SSE\x20stream\x20ended,\x20reconnecting...','split','data:\x20','claude-code','error','status','length','init\x20failed:\x20','slice','Target\x20session\x20alias','from_session','high','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','write','\x20RESUME_ID=','stdin','exit','application/json,\x20text/event-stream','replace','stderr','completed','blocked','CommHub\x20init\x20failed:\x20','commhub_reply','2925nHNkrm','replied','Reply\x20text\x20/\x20result\x20summary','body','parse','Priority\x20(default:\x20normal)','new_message','commhub','find','randomUUID','Message\x20content','utf-8','send_reply','trim','...\x20TMUX=','.claude/channels/commhub','send_message','notification','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','connected','delete','toTimeString','message_id','in_progress','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.'];a0_0x1457=function(){return _0x45e5ca;};return a0_0x1457();}Y(a0_0xaf1b4d(0x16c)+D+a0_0xaf1b4d(0x126)+Z+a0_0xaf1b4d(0xff)+w[a0_0xaf1b4d(0xf9)](0x0,0x8)+a0_0xaf1b4d(0x117)+(f||a0_0xaf1b4d(0x17c))+'\x20CWD='+process[a0_0xaf1b4d(0x150)]()+a0_0xaf1b4d(0x13d)+L);var k=new Map(),K=new a0_0x73f1f9({'name':'commhub-channel','version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0xaf1b4d(0x11b),a0_0xaf1b4d(0x121),a0_0xaf1b4d(0x123),a0_0xaf1b4d(0x169),a0_0xaf1b4d(0x156)+Z][a0_0xaf1b4d(0x176)]('\x0a')});K[a0_0xaf1b4d(0x14b)](a0_0xd1454e,async()=>({'tools':[{'name':'commhub_reply','description':a0_0xaf1b4d(0xfd),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0xaf1b4d(0x12e),'description':a0_0xaf1b4d(0x14d)},'text':{'type':a0_0xaf1b4d(0x12e),'description':a0_0xaf1b4d(0x10b)},'status':{'type':'string','enum':['completed',a0_0xaf1b4d(0x14e),a0_0xaf1b4d(0x17b),'blocked',a0_0xaf1b4d(0xf5),a0_0xaf1b4d(0x120)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0xaf1b4d(0x17a)]}},{'name':'commhub_report_status','description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0xaf1b4d(0x13a),'properties':{'status':{'type':'string','enum':[a0_0xaf1b4d(0x144),a0_0xaf1b4d(0x149),a0_0xaf1b4d(0x106),'error']},'task':{'type':a0_0xaf1b4d(0x12e),'description':'Current\x20task\x20description'},'progress':{'type':a0_0xaf1b4d(0x15a),'description':a0_0xaf1b4d(0x158)}},'required':[a0_0xaf1b4d(0xf6)]}},{'name':'commhub_send_task','description':a0_0xaf1b4d(0x157),'inputSchema':{'type':a0_0xaf1b4d(0x13a),'properties':{'alias':{'type':a0_0xaf1b4d(0x12e),'description':a0_0xaf1b4d(0xfa)},'task':{'type':a0_0xaf1b4d(0x12e),'description':'Task\x20content'},'priority':{'type':a0_0xaf1b4d(0x12e),'enum':[a0_0xaf1b4d(0xfc),a0_0xaf1b4d(0x140),a0_0xaf1b4d(0x168)],'description':a0_0xaf1b4d(0x10e)}},'required':[a0_0xaf1b4d(0x152),'task']}},{'name':a0_0xaf1b4d(0x135),'description':a0_0xaf1b4d(0x159),'inputSchema':{'type':a0_0xaf1b4d(0x13a),'properties':{'alias':{'type':'string','description':a0_0xaf1b4d(0xfa)},'message':{'type':a0_0xaf1b4d(0x12e),'description':a0_0xaf1b4d(0x113)}},'required':[a0_0xaf1b4d(0x152),a0_0xaf1b4d(0x15b)]}},{'name':a0_0xaf1b4d(0x13e),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0xaf1b4d(0x13a),'properties':{}}}]}));async function P(_0x126e46,_0x52411a){const _0x3f13a6=a0_0xaf1b4d;let _0x20ef88=await fetch(D+'/mcp',{'method':_0x3f13a6(0x132),'headers':{'Content-Type':_0x3f13a6(0x134),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x3f13a6(0x138)+X}:{}},'body':JSON[_0x3f13a6(0x177)]({'jsonrpc':_0x3f13a6(0x13c),'id':0x1,'method':_0x3f13a6(0x15f),'params':{'protocolVersion':_0x3f13a6(0x12f),'capabilities':{},'clientInfo':{'name':_0x3f13a6(0x151),'version':_0x3f13a6(0x143)}}})});if(!_0x20ef88['ok']){let _0x402be8=await _0x20ef88['text']();return Y(_0x3f13a6(0x107)+_0x20ef88[_0x3f13a6(0xf6)]+'\x20'+_0x402be8[_0x3f13a6(0xf9)](0x0,0x64)),{'ok':!0x1,'error':_0x3f13a6(0xf8)+_0x20ef88[_0x3f13a6(0xf6)]};}await _0x20ef88[_0x3f13a6(0x17a)]();let _0x3603b0=(await(await fetch(D+_0x3f13a6(0x13b),{'method':_0x3f13a6(0x132),'headers':{'Content-Type':_0x3f13a6(0x134),'Accept':_0x3f13a6(0x102),...X?{'Authorization':_0x3f13a6(0x138)+X}:{}},'body':JSON[_0x3f13a6(0x177)]({'jsonrpc':'2.0','id':0x2,'method':_0x3f13a6(0x128),'params':{'name':_0x126e46,'arguments':_0x52411a}})}))[_0x3f13a6(0x17a)]())[_0x3f13a6(0xf2)]('\x0a')[_0x3f13a6(0x111)](_0xa745=>_0xa745['startsWith'](_0x3f13a6(0xf3)));if(_0x3603b0){let _0x12ea09=JSON[_0x3f13a6(0x10d)](_0x3603b0[_0x3f13a6(0xf9)](0x6));return _0x12ea09?.['result']?.[_0x3f13a6(0x133)]?.[0x0]?.[_0x3f13a6(0x17a)]?JSON[_0x3f13a6(0x10d)](_0x12ea09['result'][_0x3f13a6(0x133)][0x0]['text']):_0x12ea09;}return{'ok':!0x1,'error':_0x3f13a6(0x17f)};}K[a0_0xaf1b4d(0x14b)](a0_0x462085,async _0x372068=>{const _0x2b0b04=a0_0xaf1b4d;let {name:_0x25b500,arguments:_0x492503}=_0x372068[_0x2b0b04(0x175)];if(_0x25b500===_0x2b0b04(0x108)){let {task_id:_0x4bd18d,text:_0x450954,status:_0x52db43}=_0x492503;if(_0x52db43===_0x2b0b04(0x105)||_0x52db43===_0x2b0b04(0x14e)||_0x52db43===_0x2b0b04(0x17b)){let _0xa7167c=_0x52db43===_0x2b0b04(0x105)?_0x2b0b04(0x10a):_0x52db43,_0x125d0f=_0x4bd18d?k[_0x2b0b04(0x142)](_0x4bd18d)||_0x2b0b04(0x137):_0x2b0b04(0x137),_0x4b3f1c=await P(_0x2b0b04(0x115),{'alias':_0x125d0f,'text':_0x450954,'in_reply_to':_0x4bd18d||void 0x0,'status':_0xa7167c,'from_session':Z});if(_0x4bd18d)k[_0x2b0b04(0x11d)](_0x4bd18d);return{'content':[{'type':_0x2b0b04(0x17a),'text':JSON[_0x2b0b04(0x177)](_0x4b3f1c)}]};}let _0x15960b=await P(_0x2b0b04(0x148),{'resume_id':w,'alias':Z,'status':_0x52db43===_0x2b0b04(0x106)?_0x2b0b04(0x106):_0x52db43==='error'?_0x2b0b04(0xf5):_0x2b0b04(0x144),'task':_0x450954[_0x2b0b04(0xf9)](0x0,0xc8),'output':_0x450954});return{'content':[{'type':_0x2b0b04(0x17a),'text':JSON[_0x2b0b04(0x177)](_0x15960b)}]};}if(_0x25b500==='commhub_report_status'){let {status:_0x21c8eb,task:_0x5cd6f9,progress:_0x48345e}=_0x492503,_0x5e23ac=await P(_0x2b0b04(0x148),{'resume_id':w,'alias':Z,'status':_0x21c8eb,'task':_0x5cd6f9,'progress':_0x48345e});return{'content':[{'type':_0x2b0b04(0x17a),'text':JSON[_0x2b0b04(0x177)](_0x5e23ac)}]};}if(_0x25b500===_0x2b0b04(0x181)){let {alias:_0x5a4e80,task:_0x4424d9,priority:_0x420037}=_0x492503,_0x53b325=await P('send_task',{'alias':_0x5a4e80,'task':_0x4424d9,'priority':_0x420037||'normal','from_session':Z});return{'content':[{'type':_0x2b0b04(0x17a),'text':JSON[_0x2b0b04(0x177)](_0x53b325)}]};}if(_0x25b500===_0x2b0b04(0x135)){let {alias:_0x842a4c,message:_0x42455f}=_0x492503,_0x5c0af6=await P(_0x2b0b04(0x119),{'alias':_0x842a4c,'message':_0x42455f,'from_session':Z});return{'content':[{'type':_0x2b0b04(0x17a),'text':JSON[_0x2b0b04(0x177)](_0x5c0af6)}]};}if(_0x25b500===_0x2b0b04(0x13e)){let _0x12e22b=await P(_0x2b0b04(0x154),{});return{'content':[{'type':_0x2b0b04(0x17a),'text':JSON['stringify'](_0x12e22b)}]};}return{'content':[{'type':_0x2b0b04(0x17a),'text':JSON['stringify']({'error':_0x2b0b04(0x171)})}]};});async function v(){const _0x8a1b6e=a0_0xaf1b4d;let _0x475ebb=D+_0x8a1b6e(0x178)+encodeURIComponent(Z),_0x169c98={};if(X)_0x169c98['Authorization']='Bearer\x20'+X;Y(_0x8a1b6e(0x179)+_0x475ebb);while(!0x0){try{let _0x19da1e=await fetch(_0x475ebb,{'headers':_0x169c98});if(!_0x19da1e['ok']){Y(_0x8a1b6e(0x16f)+_0x19da1e['status']+'\x20'+_0x19da1e[_0x8a1b6e(0x14f)]),await h(0x1388);continue;}let _0x3c83c6=_0x19da1e[_0x8a1b6e(0x10c)]['getReader'](),_0x3d6430=new TextDecoder(),_0x5e2bc0='';while(!0x0){let {done:_0x4bed30,value:_0x47aba2}=await _0x3c83c6['read']();if(_0x4bed30)break;_0x5e2bc0+=_0x3d6430[_0x8a1b6e(0x16e)](_0x47aba2,{'stream':!0x0});let _0x90eb5a=_0x5e2bc0[_0x8a1b6e(0xf2)]('\x0a\x0a');_0x5e2bc0=_0x90eb5a[_0x8a1b6e(0x141)]()||'';for(let _0x2d550f of _0x90eb5a){let _0x57645d=_0x2d550f[_0x8a1b6e(0xf2)]('\x0a')[_0x8a1b6e(0x111)](_0x44fade=>_0x44fade['startsWith']('data:\x20'));if(!_0x57645d)continue;try{let _0x362f96=JSON[_0x8a1b6e(0x10d)](_0x57645d[_0x8a1b6e(0xf9)](0x6));await u(_0x362f96);}catch(_0xc6d6c9){Y(_0x8a1b6e(0x127)+_0xc6d6c9);}}}Y(_0x8a1b6e(0xf1));}catch(_0x41bbee){Y(_0x8a1b6e(0x131)+_0x41bbee);}await h(0xbb8);}}async function u(_0x26a5b5){const _0x3ebb50=a0_0xaf1b4d;if(_0x26a5b5[_0x3ebb50(0x122)]===_0x3ebb50(0x11c)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x26a5b5[_0x3ebb50(0x122)]===_0x3ebb50(0x10f)){if(Y(_0x3ebb50(0x170)+_0x26a5b5[_0x3ebb50(0x129)]+':\x20'+_0x26a5b5[_0x3ebb50(0x15b)]['slice'](0x0,0x3c)),await K[_0x3ebb50(0x11a)]({'method':'notifications/claude/channel','params':{'content':_0x26a5b5[_0x3ebb50(0x15b)],'meta':{'sender':_0x26a5b5[_0x3ebb50(0x129)]||_0x3ebb50(0x137),'sender_id':_0x3ebb50(0x110),'user':_0x26a5b5['from']||_0x3ebb50(0x137),'priority':_0x3ebb50(0x140)}}}),_0x26a5b5[_0x3ebb50(0x11f)])await P(_0x3ebb50(0x124),{'alias':Z,'message_id':_0x26a5b5[_0x3ebb50(0x11f)]});return;}if(_0x26a5b5['type']===_0x3ebb50(0x173)||_0x26a5b5[_0x3ebb50(0x122)]===_0x3ebb50(0x146)){Y('←\x20'+_0x26a5b5[_0x3ebb50(0x122)]+':\x20inbox_count='+_0x26a5b5[_0x3ebb50(0x125)]+_0x3ebb50(0x16d)+(_0x26a5b5['priority']||'normal'));let _0xa491af=await P(_0x3ebb50(0x14c),{'alias':Z,'limit':0x5});if(_0xa491af?.['ok']&&_0xa491af[_0x3ebb50(0x155)]?.[_0x3ebb50(0xf7)]>0x0)for(let _0xfcc31a of _0xa491af['messages']){let _0x3f70a9={'sender':_0xfcc31a['from_session']||_0x3ebb50(0x137),'sender_id':_0x3ebb50(0x110),'user':_0xfcc31a[_0x3ebb50(0xfb)]||'hub','task_id':_0xfcc31a['id'],'priority':_0xfcc31a[_0x3ebb50(0x130)]||'normal'};k[_0x3ebb50(0x12a)](_0xfcc31a['id'],_0xfcc31a[_0x3ebb50(0xfb)]||_0x3ebb50(0x137)),await K[_0x3ebb50(0x11a)]({'method':_0x3ebb50(0x166),'params':{'content':_0xfcc31a['content'],'meta':_0x3f70a9}}),Y('→\x20injected\x20task\x20'+_0xfcc31a['id'][_0x3ebb50(0xf9)](0x0,0x8)+_0x3ebb50(0x167)+_0xfcc31a['from_session']+':\x20'+_0xfcc31a[_0x3ebb50(0x133)][_0x3ebb50(0xf9)](0x0,0x3c)),await P(_0x3ebb50(0x124),{'alias':Z,'message_id':_0xfcc31a['id']});}}}async function S(){const _0x589905=a0_0xaf1b4d;let _0x3ef90b=new a0_0x482d48();await K['connect'](_0x3ef90b),Y('MCP\x20stdio\x20connected'),Y(_0x589905(0x174)),v()['catch'](_0x1a207d=>Y(_0x589905(0x14a)+_0x1a207d)),P(_0x589905(0x148),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x2ae81f(),'hostname':a0_0x2ae81f(),'agent':_0x589905(0xf4),'project_dir':process[_0x589905(0x150)](),'tmux_name':f||void 0x0})[_0x589905(0x12d)](()=>Y(_0x589905(0x180)+Z+_0x589905(0x145)+w[_0x589905(0xf9)](0x0,0x8)+')'))[_0x589905(0x15e)](_0xaf4576=>Y(_0x589905(0x153)+_0xaf4576)),setInterval(()=>{const _0x4b9326=_0x589905;P(_0x4b9326(0x148),{'resume_id':w,'alias':Z,'status':_0x4b9326(0x149),'server':a0_0x2ae81f(),'hostname':a0_0x2ae81f(),'agent':_0x4b9326(0xf4),'project_dir':process[_0x4b9326(0x150)](),'tmux_name':f||void 0x0})[_0x4b9326(0x15e)](_0xa2995a=>Y(_0x4b9326(0x16b)+_0xa2995a));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}S()[a0_0xaf1b4d(0x15e)](_0x54a689=>{const _0x1006fe=a0_0xaf1b4d;Y('fatal:\x20'+_0x54a689),process[_0x1006fe(0x101)](0x1);});async function N(){const _0x11a380=a0_0xaf1b4d;Y(_0x11a380(0x17e)),await P(_0x11a380(0x148),{'resume_id':w,'alias':Z,'status':_0x11a380(0xf5),'task':_0x11a380(0x160)})[_0x11a380(0x15e)](()=>{}),process[_0x11a380(0x101)](0x0);}process[a0_0xaf1b4d(0x100)]['on'](a0_0xaf1b4d(0x139),()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0xaf1b4d(0x136),()=>N());
2
+ const a0_0x499f72=a0_0x5111;(function(_0x54b761,_0x104e43){const _0x1b6b97=a0_0x5111,_0x590f53=_0x54b761();while(!![]){try{const _0x5ba491=parseInt(_0x1b6b97(0x1f6))/0x1+-parseInt(_0x1b6b97(0x213))/0x2+-parseInt(_0x1b6b97(0x1f9))/0x3+parseInt(_0x1b6b97(0x255))/0x4*(-parseInt(_0x1b6b97(0x214))/0x5)+-parseInt(_0x1b6b97(0x26e))/0x6*(-parseInt(_0x1b6b97(0x209))/0x7)+-parseInt(_0x1b6b97(0x21e))/0x8*(parseInt(_0x1b6b97(0x1f4))/0x9)+parseInt(_0x1b6b97(0x258))/0xa*(parseInt(_0x1b6b97(0x266))/0xb);if(_0x5ba491===_0x104e43)break;else _0x590f53['push'](_0x590f53['shift']());}catch(_0x189aa5){_0x590f53['push'](_0x590f53['shift']());}}}(a0_0x1655,0x396f2));import{readFileSync as a0_0x30c045,existsSync as a0_0x36485a}from'fs';import{join as a0_0x5d5e4c}from'path';import{hostname as a0_0x1bf7b1}from'os';import{execSync as a0_0x5e2245}from'child_process';function a0_0x1655(){const _0x18d5e5=['text','MCP\x20stdio\x20connected','\x20CWD=','.anet','completed','message','join','cwd','→\x20injected\x20task\x20','decode','replied','no\x20response','error','503944ZbCZwg','low','in_progress','15430gWxDLX','0.3.0','/mcp','working','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','Priority\x20(default:\x20normal)','task','application/json,\x20text/event-stream','replace','ready\x20—\x20waiting\x20for\x20events','result','indexOf','type','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','4037woPmsk','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','read','then','stdin','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','.claude/channels/commhub','398958kWmsQR','slice','ack_inbox','getReader','startsWith','Task\x20content','failed','SSE\x20connected\x20as\x20\x22','2025-03-26','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','\x20PROJECT_ENV=','split','body','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','fatal:\x20','tmux\x20display-message\x20-p\x20\x27#S\x27','content','object','normal','token','report_status','unknown\x20tool','toTimeString','messages','185292dBaEqK','high','177067QfVCQw','data:\x20','Authorization','780609wNSXJX','message_id','initialize','setRequestHandler','POST','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','write','parse\x20error:\x20','string','stderr','none','send_task','end','new_message','from_session','commhub_send_message','28eiEdmJ','set','commhub_send_task','Target\x20session\x20alias','find','connecting\x20to\x20','trim','notifications/claude/channel','cancelled','stringify','446354JpSAAt','5YhqMWB','delete','←\x20message\x20from\x20','blocked','Bearer\x20','get','\x20priority=','SIGTERM','commhub','\x22\x20(','64gJBJfg','shutting\x20down,\x20reporting\x20offline...','priority','...\x20TMUX=','application/json','utf-8','SSE\x20stream\x20ended,\x20reconnecting...','parse','starting\x20SSE\x20listener...','Current\x20task\x20description','from','config.json','2.0','send_message','\x20from\x20',']\x20[commhub]\x20','alias','\x20ALIAS=','/events/','catch',':\x20inbox_count=','commhub_get_all_status','status','Reply\x20text\x20/\x20result\x20summary','SSE\x20connection\x20error:\x20','claude-code','broadcast','\x20RESUME_ID=','hub','session\x20disconnected','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','get_all_status','Session\x20alias:\x20','commhub_report_status','.env','CommHub\x20init\x20failed:\x20','idle','new_task','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','statusText','init\x20failed:\x20','commhub_reply'];a0_0x1655=function(){return _0x18d5e5;};return a0_0x1655();}import{Server as a0_0x565864}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x1e1653}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x2d0675,CallToolRequestSchema as a0_0xdd2322}from'@modelcontextprotocol/sdk/types.js';function p(_0x54a714){const _0x528583=a0_0x5111;if(!a0_0x36485a(_0x54a714))return;for(let _0x20fd12 of a0_0x30c045(_0x54a714,_0x528583(0x223))[_0x528583(0x1e7)]('\x0a')){let _0x1c406f=_0x20fd12[_0x528583(0x20f)]();if(!_0x1c406f||_0x1c406f[_0x528583(0x272)]('#'))continue;let _0x160a50=_0x1c406f[_0x528583(0x263)]('=');if(_0x160a50<0x0)continue;let _0x35072b=_0x1c406f[_0x528583(0x26f)](0x0,_0x160a50)['trim'](),_0x281633=_0x1c406f[_0x528583(0x26f)](_0x160a50+0x1)['trim']()[_0x528583(0x260)](/^["']|["']$/g,'');if(!process.env[_0x35072b])process.env[_0x35072b]=_0x281633;}}var C=process.env.HOME||'~',T=a0_0x5d5e4c(C,a0_0x499f72(0x26d));p(a0_0x5d5e4c(T,a0_0x499f72(0x240)));var L=process[a0_0x499f72(0x24f)]()[a0_0x499f72(0x260)](/\//g,'-');p(a0_0x5d5e4c(T,L,a0_0x499f72(0x240)));function U(){const _0x522f34=a0_0x499f72;try{return a0_0x5e2245(_0x522f34(0x1eb),{'encoding':'utf-8','timeout':0x7d0})[_0x522f34(0x20f)]();}catch{return'';}}function c(){const _0x361890=a0_0x499f72;try{let _0x166269=a0_0x5d5e4c(C,_0x361890(0x24b),_0x361890(0x229));if(a0_0x36485a(_0x166269))return JSON['parse'](a0_0x30c045(_0x166269,_0x361890(0x223)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x499f72(0x23a)]||'http://127.0.0.1:9200',f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x1bf7b1(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto['randomUUID'](),X=process.env.COMMHUB_TOKEN||H[a0_0x499f72(0x1ef)]||'';function a0_0x5111(_0x2ce17c,_0x292086){_0x2ce17c=_0x2ce17c-0x1e4;const _0x165555=a0_0x1655();let _0x5111ce=_0x165555[_0x2ce17c];return _0x5111ce;}function Y(_0x59536d){const _0xd49e40=a0_0x499f72;let _0x3c4fbc=new Date()[_0xd49e40(0x1f2)]()[_0xd49e40(0x26f)](0x0,0x8);process[_0xd49e40(0x202)][_0xd49e40(0x1ff)]('['+_0x3c4fbc+_0xd49e40(0x22d)+_0x59536d+'\x0a');}function h(_0x1eb3a9){return new Promise(_0x81347b=>setTimeout(_0x81347b,_0x1eb3a9));}Y('ENV:\x20URL='+D+a0_0x499f72(0x22f)+Z+a0_0x499f72(0x239)+w[a0_0x499f72(0x26f)](0x0,0x8)+a0_0x499f72(0x221)+(f||a0_0x499f72(0x203))+a0_0x499f72(0x24a)+process[a0_0x499f72(0x24f)]()+a0_0x499f72(0x1e6)+L);var k=new Map(),K=new a0_0x565864({'name':'commhub-channel','version':a0_0x499f72(0x259)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x499f72(0x23c),a0_0x499f72(0x26b),a0_0x499f72(0x265),a0_0x499f72(0x1e9),a0_0x499f72(0x23e)+Z][a0_0x499f72(0x24e)]('\x0a')});K['setRequestHandler'](a0_0x2d0675,async()=>({'tools':[{'name':a0_0x499f72(0x247),'description':a0_0x499f72(0x244),'inputSchema':{'type':a0_0x499f72(0x1ed),'properties':{'task_id':{'type':a0_0x499f72(0x201),'description':a0_0x499f72(0x26c)},'text':{'type':'string','description':a0_0x499f72(0x235)},'status':{'type':a0_0x499f72(0x201),'enum':['completed',a0_0x499f72(0x274),a0_0x499f72(0x211),a0_0x499f72(0x217),a0_0x499f72(0x254),a0_0x499f72(0x257)],'description':a0_0x499f72(0x25c)}},'required':[a0_0x499f72(0x248)]}},{'name':a0_0x499f72(0x23f),'description':a0_0x499f72(0x267),'inputSchema':{'type':a0_0x499f72(0x1ed),'properties':{'status':{'type':'string','enum':[a0_0x499f72(0x25b),a0_0x499f72(0x242),a0_0x499f72(0x217),'error']},'task':{'type':a0_0x499f72(0x201),'description':a0_0x499f72(0x227)},'progress':{'type':'number','description':'Progress\x200-100'}},'required':['status']}},{'name':a0_0x499f72(0x20b),'description':a0_0x499f72(0x1e5),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x499f72(0x201),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x499f72(0x201),'description':a0_0x499f72(0x273)},'priority':{'type':a0_0x499f72(0x201),'enum':[a0_0x499f72(0x1f5),a0_0x499f72(0x1ee),a0_0x499f72(0x256)],'description':a0_0x499f72(0x25d)}},'required':[a0_0x499f72(0x22e),a0_0x499f72(0x25e)]}},{'name':a0_0x499f72(0x208),'description':a0_0x499f72(0x1fe),'inputSchema':{'type':'object','properties':{'alias':{'type':'string','description':a0_0x499f72(0x20c)},'message':{'type':a0_0x499f72(0x201),'description':'Message\x20content'}},'required':['alias',a0_0x499f72(0x24d)]}},{'name':'commhub_get_all_status','description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x499f72(0x1ed),'properties':{}}}]}));async function P(_0x927259,_0x371dc8){const _0x10e9d7=a0_0x499f72;let _0x27292d=await fetch(D+_0x10e9d7(0x25a),{'method':_0x10e9d7(0x1fd),'headers':{'Content-Type':_0x10e9d7(0x222),'Accept':_0x10e9d7(0x25f),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x10e9d7(0x212)]({'jsonrpc':_0x10e9d7(0x22a),'id':0x1,'method':_0x10e9d7(0x1fb),'params':{'protocolVersion':_0x10e9d7(0x1e4),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x10e9d7(0x259)}}})});if(!_0x27292d['ok']){let _0x25db72=await _0x27292d[_0x10e9d7(0x248)]();return Y(_0x10e9d7(0x241)+_0x27292d[_0x10e9d7(0x234)]+'\x20'+_0x25db72[_0x10e9d7(0x26f)](0x0,0x64)),{'ok':!0x1,'error':_0x10e9d7(0x246)+_0x27292d[_0x10e9d7(0x234)]};}await _0x27292d[_0x10e9d7(0x248)]();let _0xced4ad=(await(await fetch(D+'/mcp',{'method':_0x10e9d7(0x1fd),'headers':{'Content-Type':_0x10e9d7(0x222),'Accept':_0x10e9d7(0x25f),...X?{'Authorization':_0x10e9d7(0x218)+X}:{}},'body':JSON[_0x10e9d7(0x212)]({'jsonrpc':_0x10e9d7(0x22a),'id':0x2,'method':'tools/call','params':{'name':_0x927259,'arguments':_0x371dc8}})}))['text']())[_0x10e9d7(0x1e7)]('\x0a')[_0x10e9d7(0x20d)](_0x43400a=>_0x43400a['startsWith']('data:\x20'));if(_0xced4ad){let _0x157160=JSON[_0x10e9d7(0x225)](_0xced4ad[_0x10e9d7(0x26f)](0x6));return _0x157160?.[_0x10e9d7(0x262)]?.[_0x10e9d7(0x1ec)]?.[0x0]?.['text']?JSON[_0x10e9d7(0x225)](_0x157160[_0x10e9d7(0x262)][_0x10e9d7(0x1ec)][0x0][_0x10e9d7(0x248)]):_0x157160;}return{'ok':!0x1,'error':_0x10e9d7(0x253)};}K[a0_0x499f72(0x1fc)](a0_0xdd2322,async _0x3c289e=>{const _0x55df36=a0_0x499f72;let {name:_0x439682,arguments:_0x2c8fb0}=_0x3c289e['params'];if(_0x439682===_0x55df36(0x247)){let {task_id:_0x4c168a,text:_0x382c15,status:_0x4794fb}=_0x2c8fb0;if(_0x4794fb===_0x55df36(0x24c)||_0x4794fb===_0x55df36(0x274)||_0x4794fb===_0x55df36(0x211)){let _0x2211ce=_0x4794fb===_0x55df36(0x24c)?_0x55df36(0x252):_0x4794fb,_0x3190b8=_0x4c168a?k[_0x55df36(0x219)](_0x4c168a)||'hub':_0x55df36(0x23a),_0x8ec866=await P('send_reply',{'alias':_0x3190b8,'text':_0x382c15,'in_reply_to':_0x4c168a||void 0x0,'status':_0x2211ce,'from_session':Z});if(_0x4c168a)k[_0x55df36(0x215)](_0x4c168a);return{'content':[{'type':_0x55df36(0x248),'text':JSON['stringify'](_0x8ec866)}]};}let _0x147cdf=await P(_0x55df36(0x1f0),{'resume_id':w,'alias':Z,'status':_0x4794fb===_0x55df36(0x217)?_0x55df36(0x217):_0x4794fb==='error'?_0x55df36(0x254):_0x55df36(0x25b),'task':_0x382c15[_0x55df36(0x26f)](0x0,0xc8),'output':_0x382c15});return{'content':[{'type':_0x55df36(0x248),'text':JSON[_0x55df36(0x212)](_0x147cdf)}]};}if(_0x439682===_0x55df36(0x23f)){let {status:_0xcb65ed,task:_0x42253f,progress:_0x96f293}=_0x2c8fb0,_0xb08848=await P(_0x55df36(0x1f0),{'resume_id':w,'alias':Z,'status':_0xcb65ed,'task':_0x42253f,'progress':_0x96f293});return{'content':[{'type':_0x55df36(0x248),'text':JSON['stringify'](_0xb08848)}]};}if(_0x439682==='commhub_send_task'){let {alias:_0x299323,task:_0x2dd347,priority:_0x2d1848}=_0x2c8fb0,_0x4e3718=await P(_0x55df36(0x204),{'alias':_0x299323,'task':_0x2dd347,'priority':_0x2d1848||_0x55df36(0x1ee),'from_session':Z});return{'content':[{'type':_0x55df36(0x248),'text':JSON[_0x55df36(0x212)](_0x4e3718)}]};}if(_0x439682===_0x55df36(0x208)){let {alias:_0x5e9384,message:_0x2648f4}=_0x2c8fb0,_0x37842c=await P(_0x55df36(0x22b),{'alias':_0x5e9384,'message':_0x2648f4,'from_session':Z});return{'content':[{'type':_0x55df36(0x248),'text':JSON[_0x55df36(0x212)](_0x37842c)}]};}if(_0x439682===_0x55df36(0x233)){let _0x7759ee=await P(_0x55df36(0x23d),{});return{'content':[{'type':_0x55df36(0x248),'text':JSON['stringify'](_0x7759ee)}]};}return{'content':[{'type':'text','text':JSON[_0x55df36(0x212)]({'error':_0x55df36(0x1f1)})}]};});async function v(){const _0x212750=a0_0x499f72;let _0x1de250=D+_0x212750(0x230)+encodeURIComponent(Z),_0x2ce99d={};if(X)_0x2ce99d[_0x212750(0x1f8)]=_0x212750(0x218)+X;Y(_0x212750(0x20e)+_0x1de250);while(!0x0){try{let _0x37055a=await fetch(_0x1de250,{'headers':_0x2ce99d});if(!_0x37055a['ok']){Y('SSE\x20error:\x20'+_0x37055a['status']+'\x20'+_0x37055a[_0x212750(0x245)]),await h(0x1388);continue;}let _0x196c4a=_0x37055a[_0x212750(0x1e8)][_0x212750(0x271)](),_0x3d9377=new TextDecoder(),_0x11b316='';while(!0x0){let {done:_0x5f54b5,value:_0x339c06}=await _0x196c4a[_0x212750(0x268)]();if(_0x5f54b5)break;_0x11b316+=_0x3d9377[_0x212750(0x251)](_0x339c06,{'stream':!0x0});let _0x2277c1=_0x11b316['split']('\x0a\x0a');_0x11b316=_0x2277c1['pop']()||'';for(let _0x2df77a of _0x2277c1){let _0xb6225d=_0x2df77a['split']('\x0a')[_0x212750(0x20d)](_0x28b37b=>_0x28b37b[_0x212750(0x272)](_0x212750(0x1f7)));if(!_0xb6225d)continue;try{let _0x3114e6=JSON[_0x212750(0x225)](_0xb6225d[_0x212750(0x26f)](0x6));await u(_0x3114e6);}catch(_0x28ee94){Y(_0x212750(0x200)+_0x28ee94);}}}Y(_0x212750(0x224));}catch(_0x48049a){Y(_0x212750(0x236)+_0x48049a);}await h(0xbb8);}}async function u(_0x5b06d6){const _0x2ca962=a0_0x499f72;if(_0x5b06d6['type']==='connected'){Y(_0x2ca962(0x275)+Z+'\x22');return;}if(_0x5b06d6[_0x2ca962(0x264)]===_0x2ca962(0x206)){if(Y(_0x2ca962(0x216)+_0x5b06d6[_0x2ca962(0x228)]+':\x20'+_0x5b06d6['message'][_0x2ca962(0x26f)](0x0,0x3c)),await K['notification']({'method':_0x2ca962(0x210),'params':{'content':_0x5b06d6['message'],'meta':{'sender':_0x5b06d6[_0x2ca962(0x228)]||_0x2ca962(0x23a),'sender_id':_0x2ca962(0x21c),'user':_0x5b06d6[_0x2ca962(0x228)]||_0x2ca962(0x23a),'priority':_0x2ca962(0x1ee)}}}),_0x5b06d6['message_id'])await P(_0x2ca962(0x270),{'alias':Z,'message_id':_0x5b06d6[_0x2ca962(0x1fa)]});return;}if(_0x5b06d6[_0x2ca962(0x264)]===_0x2ca962(0x243)||_0x5b06d6[_0x2ca962(0x264)]===_0x2ca962(0x238)){Y('←\x20'+_0x5b06d6[_0x2ca962(0x264)]+_0x2ca962(0x232)+_0x5b06d6['inbox_count']+_0x2ca962(0x21a)+(_0x5b06d6[_0x2ca962(0x220)]||_0x2ca962(0x1ee)));let _0x3a3053=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x3a3053?.['ok']&&_0x3a3053[_0x2ca962(0x1f3)]?.['length']>0x0)for(let _0x104f44 of _0x3a3053[_0x2ca962(0x1f3)]){let _0x3ecefc={'sender':_0x104f44['from_session']||'hub','sender_id':_0x2ca962(0x21c),'user':_0x104f44[_0x2ca962(0x207)]||'hub','task_id':_0x104f44['id'],'priority':_0x104f44[_0x2ca962(0x220)]||_0x2ca962(0x1ee)};k[_0x2ca962(0x20a)](_0x104f44['id'],_0x104f44[_0x2ca962(0x207)]||_0x2ca962(0x23a)),await K['notification']({'method':_0x2ca962(0x210),'params':{'content':_0x104f44[_0x2ca962(0x1ec)],'meta':_0x3ecefc}}),Y(_0x2ca962(0x250)+_0x104f44['id'][_0x2ca962(0x26f)](0x0,0x8)+_0x2ca962(0x22c)+_0x104f44[_0x2ca962(0x207)]+':\x20'+_0x104f44[_0x2ca962(0x1ec)]['slice'](0x0,0x3c)),await P(_0x2ca962(0x270),{'alias':Z,'message_id':_0x104f44['id']});}}}async function S(){const _0x12509c=a0_0x499f72;let _0x290684=new a0_0x1e1653();await K['connect'](_0x290684),Y(_0x12509c(0x249)),Y(_0x12509c(0x226)),v()[_0x12509c(0x231)](_0x2a6615=>Y('SSE\x20fatal:\x20'+_0x2a6615)),P(_0x12509c(0x1f0),{'resume_id':w,'alias':Z,'status':_0x12509c(0x242),'server':a0_0x1bf7b1(),'hostname':a0_0x1bf7b1(),'agent':_0x12509c(0x237),'project_dir':process[_0x12509c(0x24f)](),'tmux_name':f||void 0x0})[_0x12509c(0x269)](()=>Y('registered\x20as\x20\x22'+Z+_0x12509c(0x21d)+w['slice'](0x0,0x8)+')'))['catch'](_0xa75799=>Y('warning:\x20could\x20not\x20register:\x20'+_0xa75799)),setInterval(()=>{const _0x1c2c75=_0x12509c;P('report_status',{'resume_id':w,'alias':Z,'status':_0x1c2c75(0x242),'server':a0_0x1bf7b1(),'hostname':a0_0x1bf7b1(),'agent':_0x1c2c75(0x237),'project_dir':process[_0x1c2c75(0x24f)](),'tmux_name':f||void 0x0})[_0x1c2c75(0x231)](_0x291297=>Y('heartbeat\x20failed:\x20'+_0x291297));},0x2bf20),Y(_0x12509c(0x261));}S()[a0_0x499f72(0x231)](_0x203cfa=>{const _0x25e217=a0_0x499f72;Y(_0x25e217(0x1ea)+_0x203cfa),process['exit'](0x1);});async function N(){const _0x5f0061=a0_0x499f72;Y(_0x5f0061(0x21f)),await P(_0x5f0061(0x1f0),{'resume_id':w,'alias':Z,'status':'error','task':_0x5f0061(0x23b)})[_0x5f0061(0x231)](()=>{}),process['exit'](0x0);}process[a0_0x499f72(0x26a)]['on'](a0_0x499f72(0x205),()=>N()),process['on'](a0_0x499f72(0x21b),()=>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.25",
3
+ "version": "2.0.0-preview.26",
4
4
  "description": "AI Agent Network CLI \u2014 Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 34 commands.",
5
5
  "type": "module",
6
6
  "main": "dist/src/client.js",