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

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_0x9020(_0x4a1639,_0x124ab2){_0x4a1639=_0x4a1639-0x1bd;const _0x303dd5=a0_0x303d();let _0x902060=_0x303dd5[_0x4a1639];return _0x902060;}const a0_0x1af585=a0_0x9020;(function(_0x1e3a4b,_0x91b717){const _0x38cc6c=a0_0x9020,_0x1744d5=_0x1e3a4b();while(!![]){try{const _0x51acca=-parseInt(_0x38cc6c(0x1df))/0x1+parseInt(_0x38cc6c(0x1de))/0x2+-parseInt(_0x38cc6c(0x1d8))/0x3*(-parseInt(_0x38cc6c(0x205))/0x4)+parseInt(_0x38cc6c(0x1fd))/0x5+parseInt(_0x38cc6c(0x1f9))/0x6*(-parseInt(_0x38cc6c(0x1fc))/0x7)+parseInt(_0x38cc6c(0x1e4))/0x8+-parseInt(_0x38cc6c(0x1bf))/0x9*(-parseInt(_0x38cc6c(0x1c5))/0xa);if(_0x51acca===_0x91b717)break;else _0x1744d5['push'](_0x1744d5['shift']());}catch(_0x2b5aeb){_0x1744d5['push'](_0x1744d5['shift']());}}}(a0_0x303d,0x40396));import{EventEmitter as a0_0x3c5632}from'events';function a0_0x303d(){const _0x4c4382=['get_inbox','stringify','text/event-stream','offline','status','disconnected','report_status','server','url','emit','SSE\x20error:\x20','abort','type','s...','decode','normal','12muTKSm','broadcast','heartbeatTimer','987952yAVeVT','688485hLynfI','heartbeat\x20failed:\x20','from_session','read','startsWith','agent','tools/call','/mcp','4VCtxmT','Authorization','connectSSE','text','application/json','name','sdk-','reply','ack_inbox','toTimeString','get_all_status','disconnect','messages','parse','3200031fddiAa','content','SSE\x20connected','send_message','connected','SSE\x20failed:\x20','10MmuTyl','task','sseAbort','alias','heartbeatInterval','error','AbortError','reconnectDelay','pop','body','min','message','autoConnect','token','catch','split','log','registered','call','90327zWcbbA','result','connect','replace','idle','new_task','733668OioZQB','459874SNsJQM','SSE\x20reconnecting\x20in\x20','running','cwd','data:\x20','920072dmSYOW','slice','getReader','now','resumeId'];a0_0x303d=function(){return _0x4c4382;};return a0_0x303d();}import{hostname as a0_0x146331}from'os';class T extends a0_0x3c5632{['url'];[a0_0x1af585(0x1c8)];['token'];['agent'];[a0_0x1af585(0x1e8)];[a0_0x1af585(0x1c9)];[a0_0x1af585(0x1cc)];[a0_0x1af585(0x1fb)];[a0_0x1af585(0x1c7)];[a0_0x1af585(0x1e1)]=!0x1;constructor(_0x1f1d87){const _0xb73fe6=a0_0x1af585;super();if(this[_0xb73fe6(0x1f1)]=_0x1f1d87[_0xb73fe6(0x1f1)][_0xb73fe6(0x1db)](/\/$/,''),this['alias']=_0x1f1d87[_0xb73fe6(0x1c8)],this[_0xb73fe6(0x1d2)]=_0x1f1d87[_0xb73fe6(0x1d2)],this['agent']=_0x1f1d87[_0xb73fe6(0x202)]||'sdk',this[_0xb73fe6(0x1e8)]=_0xb73fe6(0x20b)+_0x1f1d87['alias']+'-'+Date['now']()['toString'](0x24),this[_0xb73fe6(0x1c9)]=_0x1f1d87[_0xb73fe6(0x1c9)]??0x2bf20,this[_0xb73fe6(0x1cc)]=_0x1f1d87[_0xb73fe6(0x1cc)]??0xbb8,_0x1f1d87[_0xb73fe6(0x1d1)]!==!0x1)this[_0xb73fe6(0x1da)]();}[a0_0x1af585(0x1d5)](_0x4b9695){const _0xd452f7=a0_0x1af585;console[_0xd452f7(0x1d5)]('['+new Date()[_0xd452f7(0x20e)]()[_0xd452f7(0x1e5)](0x0,0x8)+']\x20[commhub:'+this[_0xd452f7(0x1c8)]+']\x20'+_0x4b9695);}async['call'](_0x5a978a,_0x324115){const _0x38db84=a0_0x1af585;let _0x19974c={'Content-Type':_0x38db84(0x209),'Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x19974c['Authorization']='Bearer\x20'+this[_0x38db84(0x1d2)];let _0x568d25=await(await fetch(this[_0x38db84(0x1f1)]+_0x38db84(0x204),{'method':'POST','headers':_0x19974c,'body':JSON[_0x38db84(0x1ea)]({'jsonrpc':'2.0','id':Date[_0x38db84(0x1e7)](),'method':_0x38db84(0x203),'params':{'name':_0x5a978a,'arguments':_0x324115}})}))[_0x38db84(0x208)](),_0x14f051=_0x568d25['match'](/data: (.+)/),_0x4e4243=_0x14f051?JSON[_0x38db84(0x1be)](_0x14f051[0x1]):JSON[_0x38db84(0x1be)](_0x568d25),_0x289d40=_0x4e4243?.[_0x38db84(0x1d9)]?.[_0x38db84(0x1c0)]?.[0x0]?.[_0x38db84(0x208)];return _0x289d40?JSON[_0x38db84(0x1be)](_0x289d40):_0x4e4243;}async[a0_0x1af585(0x1da)](){const _0x5b12d3=a0_0x1af585;if(this[_0x5b12d3(0x1e1)])return;this[_0x5b12d3(0x1e1)]=!0x0,await this['status'](_0x5b12d3(0x1dc)),this[_0x5b12d3(0x1d5)](_0x5b12d3(0x1d6)),this[_0x5b12d3(0x1fb)]=setInterval(()=>{const _0x9e898a=_0x5b12d3;this['status'](_0x9e898a(0x1dc))[_0x9e898a(0x1d3)](_0xfe24d0=>this[_0x9e898a(0x1d5)](_0x9e898a(0x1fe)+_0xfe24d0[_0x9e898a(0x1d0)]));},this[_0x5b12d3(0x1c9)]),this[_0x5b12d3(0x207)]();}async[a0_0x1af585(0x210)](){const _0x502b0f=a0_0x1af585;if(this[_0x502b0f(0x1e1)]=!0x1,this[_0x502b0f(0x1c7)]?.[_0x502b0f(0x1f4)](),this['heartbeatTimer'])clearInterval(this[_0x502b0f(0x1fb)]);await this[_0x502b0f(0x1ed)](_0x502b0f(0x1ec))[_0x502b0f(0x1d3)](()=>{}),this['log'](_0x502b0f(0x1ee));}async['send'](_0x33bfc7,_0x3ceb34,_0xcef331=a0_0x1af585(0x1f8)){const _0x2abe41=a0_0x1af585;return this[_0x2abe41(0x1d7)]('send_task',{'alias':_0x33bfc7,'task':_0x3ceb34,'priority':_0xcef331,'from_session':this[_0x2abe41(0x1c8)]});}async['message'](_0x6c15dc,_0x92f715){const _0x4c7808=a0_0x1af585;return this[_0x4c7808(0x1d7)](_0x4c7808(0x1c2),{'alias':_0x6c15dc,'message':_0x92f715,'from_session':this[_0x4c7808(0x1c8)]});}async[a0_0x1af585(0x20c)](_0x3282d5,_0x2a6015,_0x46ec74='completed'){const _0x2c26e3=a0_0x1af585;return this[_0x2c26e3(0x1d7)](_0x2c26e3(0x20c),{'task_id':_0x3282d5,'text':_0x2a6015,'status':_0x46ec74});}async[a0_0x1af585(0x1ed)](_0x42dfa6,_0x26ce79){const _0x38e38e=a0_0x1af585;return this[_0x38e38e(0x1d7)](_0x38e38e(0x1ef),{'resume_id':this['resumeId'],'alias':this['alias'],'status':_0x42dfa6,'server':a0_0x146331(),'hostname':a0_0x146331(),'agent':this['agent'],'project_dir':process[_0x38e38e(0x1e2)](),..._0x26ce79});}async['getAllStatus'](){const _0x2b2cd9=a0_0x1af585;return this['call'](_0x2b2cd9(0x20f),{});}async[a0_0x1af585(0x1fa)](_0x3e276c,_0x2a63a5){const _0x1b7877=a0_0x1af585;return this[_0x1b7877(0x1d7)](_0x1b7877(0x1fa),{'message':_0x3e276c,'filter_server':_0x2a63a5?.[_0x1b7877(0x1f0)],'filter_status':_0x2a63a5?.['status']});}async['connectSSE'](){const _0x11dbe3=a0_0x1af585;let _0x25fb80=encodeURIComponent(this[_0x11dbe3(0x1c8)]),_0x2611e2=this['url']+'/events/'+_0x25fb80,_0x27a3f5=this[_0x11dbe3(0x1cc)];while(this[_0x11dbe3(0x1e1)]){try{this[_0x11dbe3(0x1c7)]=new AbortController();let _0x181911={'Accept':_0x11dbe3(0x1eb)};if(this[_0x11dbe3(0x1d2)])_0x181911[_0x11dbe3(0x206)]='Bearer\x20'+this['token'];let _0x25e1f5=await fetch(_0x2611e2,{'headers':_0x181911,'signal':this['sseAbort']['signal']});if(!_0x25e1f5['ok']||!_0x25e1f5[_0x11dbe3(0x1ce)]){this['log'](_0x11dbe3(0x1c4)+_0x25e1f5[_0x11dbe3(0x1ed)]),await this['sleep'](_0x27a3f5),_0x27a3f5=Math['min'](_0x27a3f5*1.5,0xea60);continue;}_0x27a3f5=this[_0x11dbe3(0x1cc)];let _0x3e0646=_0x25e1f5[_0x11dbe3(0x1ce)][_0x11dbe3(0x1e6)](),_0x25e866=new TextDecoder(),_0x9cbde6='';while(this[_0x11dbe3(0x1e1)]){let {done:_0x5ab50b,value:_0x58b4fa}=await _0x3e0646[_0x11dbe3(0x200)]();if(_0x5ab50b)break;_0x9cbde6+=_0x25e866[_0x11dbe3(0x1f7)](_0x58b4fa,{'stream':!0x0});let _0x415c12=_0x9cbde6[_0x11dbe3(0x1d4)]('\x0a');_0x9cbde6=_0x415c12[_0x11dbe3(0x1cd)]()||'';for(let _0xe3645f of _0x415c12){if(!_0xe3645f[_0x11dbe3(0x201)](_0x11dbe3(0x1e3)))continue;try{let _0x54223e=JSON[_0x11dbe3(0x1be)](_0xe3645f[_0x11dbe3(0x1e5)](0x6));if(_0x54223e[_0x11dbe3(0x1f5)]==='connected'){this['log'](_0x11dbe3(0x1c1)),this[_0x11dbe3(0x1f2)](_0x11dbe3(0x1c3));continue;}if(_0x54223e[_0x11dbe3(0x1f5)]===_0x11dbe3(0x1dd)||_0x54223e[_0x11dbe3(0x1f5)]==='new_message'||_0x54223e[_0x11dbe3(0x1f5)]===_0x11dbe3(0x1fa))await this['processInbox']();}catch{}}}}catch(_0x13e236){if(_0x13e236[_0x11dbe3(0x20a)]===_0x11dbe3(0x1cb))break;this['emit'](_0x11dbe3(0x1ca),_0x13e236),this['log'](_0x11dbe3(0x1f3)+_0x13e236['message']);}if(this['running'])this[_0x11dbe3(0x1f2)](_0x11dbe3(0x1ee)),this[_0x11dbe3(0x1d5)](_0x11dbe3(0x1e0)+_0x27a3f5/0x3e8+_0x11dbe3(0x1f6)),await this['sleep'](_0x27a3f5),_0x27a3f5=Math[_0x11dbe3(0x1cf)](_0x27a3f5*1.5,0xea60);}}async['processInbox'](){const _0x72b6f6=a0_0x1af585;try{let _0x38d482=(await this['call'](_0x72b6f6(0x1e9),{'alias':this['alias'],'limit':0xa}))?.[_0x72b6f6(0x1bd)]||[];for(let _0x33d211 of _0x38d482)await this[_0x72b6f6(0x1d7)](_0x72b6f6(0x20d),{'alias':this['alias'],'message_id':_0x33d211['id']}),this['log']('←\x20'+_0x33d211[_0x72b6f6(0x1ff)]+':\x20'+_0x33d211[_0x72b6f6(0x1c0)][_0x72b6f6(0x1e5)](0x0,0x3c)),this[_0x72b6f6(0x1f2)](_0x72b6f6(0x1c6),_0x33d211),this['emit'](_0x72b6f6(0x1d0),_0x33d211);}catch(_0x4cf21e){this[_0x72b6f6(0x1d5)]('inbox\x20error:\x20'+_0x4cf21e[_0x72b6f6(0x1d0)]);}}['sleep'](_0x2e826c){return new Promise(_0x2f9146=>setTimeout(_0x2f9146,_0x2e826c));}}var $=T;export{$ as default,T as CommHub};
1
+ const a0_0x5e001d=a0_0x3311;(function(_0x34c990,_0x520495){const _0xbc6fab=a0_0x3311,_0x56a059=_0x34c990();while(!![]){try{const _0x367bfb=-parseInt(_0xbc6fab(0x1c6))/0x1+-parseInt(_0xbc6fab(0x1a6))/0x2*(parseInt(_0xbc6fab(0x1be))/0x3)+-parseInt(_0xbc6fab(0x1d0))/0x4*(parseInt(_0xbc6fab(0x1c2))/0x5)+parseInt(_0xbc6fab(0x1cd))/0x6+-parseInt(_0xbc6fab(0x1c7))/0x7*(parseInt(_0xbc6fab(0x1ef))/0x8)+-parseInt(_0xbc6fab(0x1dc))/0x9+parseInt(_0xbc6fab(0x1d2))/0xa;if(_0x367bfb===_0x520495)break;else _0x56a059['push'](_0x56a059['shift']());}catch(_0x41469a){_0x56a059['push'](_0x56a059['shift']());}}}(a0_0x2e16,0x54e8d));import{EventEmitter as a0_0x5cc9ad}from'events';function a0_0x3311(_0x3a8a95,_0x3e6c71){_0x3a8a95=_0x3a8a95-0x1a0;const _0x2e16b4=a0_0x2e16();let _0x331119=_0x2e16b4[_0x3a8a95];return _0x331119;}import{hostname as a0_0x5bca2b}from'os';class T extends a0_0x5cc9ad{[a0_0x5e001d(0x1ac)];[a0_0x5e001d(0x1ba)];[a0_0x5e001d(0x1f5)];[a0_0x5e001d(0x1b9)];[a0_0x5e001d(0x1bf)];[a0_0x5e001d(0x1eb)];['reconnectDelay'];['heartbeatTimer'];['sseAbort'];['running']=!0x1;constructor(_0x39a6df){const _0x5139a3=a0_0x5e001d;super();if(this[_0x5139a3(0x1ac)]=_0x39a6df['url'][_0x5139a3(0x1b0)](/\/$/,''),this[_0x5139a3(0x1ba)]=_0x39a6df['alias'],this['token']=_0x39a6df['token'],this['agent']=_0x39a6df[_0x5139a3(0x1b9)]||_0x5139a3(0x1a8),this[_0x5139a3(0x1bf)]=_0x5139a3(0x1f1)+_0x39a6df[_0x5139a3(0x1ba)]+'-'+Date[_0x5139a3(0x1d6)]()[_0x5139a3(0x1b8)](0x24),this[_0x5139a3(0x1eb)]=_0x39a6df[_0x5139a3(0x1eb)]??0x2bf20,this[_0x5139a3(0x1cb)]=_0x39a6df[_0x5139a3(0x1cb)]??0xbb8,_0x39a6df[_0x5139a3(0x1cc)]!==!0x1)this[_0x5139a3(0x1d1)]();}[a0_0x5e001d(0x1c1)](_0xf13d97){const _0x2118b1=a0_0x5e001d;console[_0x2118b1(0x1c1)]('['+new Date()['toTimeString']()['slice'](0x0,0x8)+_0x2118b1(0x1e6)+this['alias']+']\x20'+_0xf13d97);}async[a0_0x5e001d(0x1e9)](_0x54eada,_0x3312d5){const _0x584b97=a0_0x5e001d;let _0x4de890={'Content-Type':_0x584b97(0x1c5),'Accept':_0x584b97(0x1e8)};if(this[_0x584b97(0x1f5)])_0x4de890[_0x584b97(0x1b3)]=_0x584b97(0x1c0)+this[_0x584b97(0x1f5)];let _0xa9fb56=await(await fetch(this[_0x584b97(0x1ac)]+_0x584b97(0x1d5),{'method':_0x584b97(0x1b5),'headers':_0x4de890,'body':JSON[_0x584b97(0x1c9)]({'jsonrpc':_0x584b97(0x1bd),'id':Date['now'](),'method':'tools/call','params':{'name':_0x54eada,'arguments':_0x3312d5}})}))[_0x584b97(0x1b6)](),_0x2a6751=_0xa9fb56['match'](/data: (.+)/),_0x223a88=_0x2a6751?JSON['parse'](_0x2a6751[0x1]):JSON[_0x584b97(0x1c3)](_0xa9fb56),_0x53fb8f=_0x223a88?.[_0x584b97(0x1e3)]?.[_0x584b97(0x1cf)]?.[0x0]?.['text'];return _0x53fb8f?JSON[_0x584b97(0x1c3)](_0x53fb8f):_0x223a88;}async['connect'](){const _0x18da2e=a0_0x5e001d;if(this[_0x18da2e(0x1ae)])return;this[_0x18da2e(0x1ae)]=!0x0,await this[_0x18da2e(0x1e2)](_0x18da2e(0x1e7)),this[_0x18da2e(0x1c1)](_0x18da2e(0x1f4)),this[_0x18da2e(0x1bc)]=setInterval(()=>{const _0x3ed42b=_0x18da2e;this[_0x3ed42b(0x1e2)]('idle')[_0x3ed42b(0x1ca)](_0x4efd79=>this[_0x3ed42b(0x1c1)](_0x3ed42b(0x1af)+_0x4efd79[_0x3ed42b(0x1de)]));},this[_0x18da2e(0x1eb)]),this[_0x18da2e(0x1a2)]();}async[a0_0x5e001d(0x1b2)](){const _0x563274=a0_0x5e001d;if(this[_0x563274(0x1ae)]=!0x1,this[_0x563274(0x1f0)]?.[_0x563274(0x1f6)](),this[_0x563274(0x1bc)])clearInterval(this[_0x563274(0x1bc)]);await this[_0x563274(0x1e2)]('offline')[_0x563274(0x1ca)](()=>{}),this['log'](_0x563274(0x1df));}async['send'](_0xe852a4,_0x138503,_0x32e9e0=a0_0x5e001d(0x1dd)){const _0x40f18b=a0_0x5e001d;return this['call'](_0x40f18b(0x1a9),{'alias':_0xe852a4,'task':_0x138503,'priority':_0x32e9e0,'from_session':this['alias']});}async[a0_0x5e001d(0x1de)](_0x9890d6,_0xf23053){const _0x258cdc=a0_0x5e001d;return this[_0x258cdc(0x1e9)](_0x258cdc(0x1e4),{'alias':_0x9890d6,'message':_0xf23053,'from_session':this[_0x258cdc(0x1ba)]});}async[a0_0x5e001d(0x1aa)](_0x15272e,_0x20f317,_0x2fcce5=a0_0x5e001d(0x1ea)){const _0x42bd26=a0_0x5e001d;return this[_0x42bd26(0x1e9)]('reply',{'task_id':_0x15272e,'text':_0x20f317,'status':_0x2fcce5});}async[a0_0x5e001d(0x1e2)](_0x156b3b,_0x3b9309){const _0x373d99=a0_0x5e001d;return this[_0x373d99(0x1e9)](_0x373d99(0x1ab),{'resume_id':this[_0x373d99(0x1bf)],'alias':this[_0x373d99(0x1ba)],'status':_0x156b3b,'server':a0_0x5bca2b(),'hostname':a0_0x5bca2b(),'agent':this[_0x373d99(0x1b9)],'project_dir':process[_0x373d99(0x1d3)](),..._0x3b9309});}async[a0_0x5e001d(0x1a5)](){const _0x297730=a0_0x5e001d;return this[_0x297730(0x1e9)](_0x297730(0x1f7),{});}async[a0_0x5e001d(0x1a4)](_0x2a03e6,_0xa5fcbe){const _0x407a18=a0_0x5e001d;return this[_0x407a18(0x1e9)](_0x407a18(0x1a4),{'message':_0x2a03e6,'filter_server':_0xa5fcbe?.[_0x407a18(0x1ad)],'filter_status':_0xa5fcbe?.['status']});}async[a0_0x5e001d(0x1a2)](){const _0x1df09c=a0_0x5e001d;let _0xb0d221=encodeURIComponent(this[_0x1df09c(0x1ba)]),_0x59d007=this[_0x1df09c(0x1ac)]+'/events/'+_0xb0d221,_0x125830=this[_0x1df09c(0x1cb)];while(this[_0x1df09c(0x1ae)]){try{this[_0x1df09c(0x1f0)]=new AbortController();let _0x1595c6={'Accept':_0x1df09c(0x1b4)};if(this[_0x1df09c(0x1f5)])_0x1595c6['Authorization']='Bearer\x20'+this['token'];let _0x133b7b=await fetch(_0x59d007,{'headers':_0x1595c6,'signal':this[_0x1df09c(0x1f0)][_0x1df09c(0x1ce)]});if(!_0x133b7b['ok']||!_0x133b7b[_0x1df09c(0x1a7)]){this[_0x1df09c(0x1c1)]('SSE\x20failed:\x20'+_0x133b7b[_0x1df09c(0x1e2)]),await this['sleep'](_0x125830),_0x125830=Math[_0x1df09c(0x1b7)](_0x125830*1.5,0xea60);continue;}_0x125830=this[_0x1df09c(0x1cb)];let _0x2b5c18=_0x133b7b['body'][_0x1df09c(0x1d4)](),_0x32dc9c=new TextDecoder(),_0x34a0c9='';while(this[_0x1df09c(0x1ae)]){let {done:_0x8571c8,value:_0x21e3b0}=await _0x2b5c18[_0x1df09c(0x1c4)]();if(_0x8571c8)break;_0x34a0c9+=_0x32dc9c[_0x1df09c(0x1e0)](_0x21e3b0,{'stream':!0x0});let _0x4b9f8d=_0x34a0c9[_0x1df09c(0x1e5)]('\x0a');_0x34a0c9=_0x4b9f8d['pop']()||'';for(let _0x206a6b of _0x4b9f8d){if(!_0x206a6b[_0x1df09c(0x1f8)](_0x1df09c(0x1d8)))continue;try{let _0x2d6c34=JSON[_0x1df09c(0x1c3)](_0x206a6b[_0x1df09c(0x1a1)](0x6));if(_0x2d6c34[_0x1df09c(0x1da)]===_0x1df09c(0x1b1)){this[_0x1df09c(0x1c1)](_0x1df09c(0x1d9)),this[_0x1df09c(0x1bb)](_0x1df09c(0x1b1));continue;}if(_0x2d6c34['type']===_0x1df09c(0x1db)||_0x2d6c34[_0x1df09c(0x1da)]===_0x1df09c(0x1d7)||_0x2d6c34[_0x1df09c(0x1da)]===_0x1df09c(0x1a4))await this[_0x1df09c(0x1ee)]();}catch{}}}}catch(_0x42e864){if(_0x42e864[_0x1df09c(0x1ec)]==='AbortError')break;this[_0x1df09c(0x1bb)]('error',_0x42e864),this[_0x1df09c(0x1c1)](_0x1df09c(0x1a0)+_0x42e864[_0x1df09c(0x1de)]);}if(this[_0x1df09c(0x1ae)])this[_0x1df09c(0x1bb)](_0x1df09c(0x1df)),this[_0x1df09c(0x1c1)]('SSE\x20reconnecting\x20in\x20'+_0x125830/0x3e8+_0x1df09c(0x1f2)),await this['sleep'](_0x125830),_0x125830=Math[_0x1df09c(0x1b7)](_0x125830*1.5,0xea60);}}async[a0_0x5e001d(0x1ee)](){const _0x165e3b=a0_0x5e001d;try{let _0xc3ceb4=(await this[_0x165e3b(0x1e9)]('get_inbox',{'alias':this[_0x165e3b(0x1ba)],'limit':0xa}))?.[_0x165e3b(0x1c8)]||[];for(let _0x58919a of _0xc3ceb4)await this[_0x165e3b(0x1e9)](_0x165e3b(0x1e1),{'alias':this['alias'],'message_id':_0x58919a['id']}),this['log']('←\x20'+_0x58919a[_0x165e3b(0x1ed)]+':\x20'+_0x58919a[_0x165e3b(0x1cf)][_0x165e3b(0x1a1)](0x0,0x3c)),this[_0x165e3b(0x1bb)](_0x165e3b(0x1a3),_0x58919a),this[_0x165e3b(0x1bb)](_0x165e3b(0x1de),_0x58919a);}catch(_0x1aefc7){this[_0x165e3b(0x1c1)]('inbox\x20error:\x20'+_0x1aefc7['message']);}}[a0_0x5e001d(0x1f3)](_0x485d39){return new Promise(_0x3f4e32=>setTimeout(_0x3f4e32,_0x485d39));}}var $=T;function a0_0x2e16(){const _0x36cc47=['min','toString','agent','alias','emit','heartbeatTimer','2.0','3378Csfxkk','resumeId','Bearer\x20','log','1311685ekAPMO','parse','read','application/json','108494uRaYNa','35jDOnvx','messages','stringify','catch','reconnectDelay','autoConnect','3996870iePzVj','signal','content','4zOwOEw','connect','4472400bGomol','cwd','getReader','/mcp','now','new_message','data:\x20','SSE\x20connected','type','new_task','1261926adiXon','normal','message','disconnected','decode','ack_inbox','status','result','send_message','split',']\x20[commhub:','idle','application/json,\x20text/event-stream','call','completed','heartbeatInterval','name','from_session','processInbox','36152sRixwo','sseAbort','sdk-','s...','sleep','registered','token','abort','get_all_status','startsWith','SSE\x20error:\x20','slice','connectSSE','task','broadcast','getAllStatus','412aUkdHl','body','sdk','send_task','reply','report_status','url','server','running','heartbeat\x20failed:\x20','replace','connected','disconnect','Authorization','text/event-stream','POST','text'];a0_0x2e16=function(){return _0x36cc47;};return a0_0x2e16();}export{$ as default,T as CommHub};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x3cdc6d=a0_0x1ddf;(function(_0xa5ccd5,_0x6b8032){const _0x57815c=a0_0x1ddf,_0x45ac01=_0xa5ccd5();while(!![]){try{const _0x407bea=-parseInt(_0x57815c(0x130))/0x1+parseInt(_0x57815c(0x10d))/0x2+-parseInt(_0x57815c(0x160))/0x3+-parseInt(_0x57815c(0x117))/0x4*(parseInt(_0x57815c(0x147))/0x5)+-parseInt(_0x57815c(0x16a))/0x6+-parseInt(_0x57815c(0xfd))/0x7+-parseInt(_0x57815c(0x131))/0x8*(-parseInt(_0x57815c(0x14d))/0x9);if(_0x407bea===_0x6b8032)break;else _0x45ac01['push'](_0x45ac01['shift']());}catch(_0x4f8d89){_0x45ac01['push'](_0x45ac01['shift']());}}}(a0_0x466d,0x834f7));import{readFileSync as a0_0x24596e,existsSync as a0_0x46cf61}from'fs';import{randomUUID as a0_0x436cfd}from'crypto';import{join as a0_0x1dc3d2}from'path';import{hostname as a0_0x50d3aa}from'os';import{execSync as a0_0x3c4ef6}from'child_process';import{Server as a0_0x1ea5f3}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x317865}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x342c09,CallToolRequestSchema as a0_0x21dfe5}from'@modelcontextprotocol/sdk/types.js';function a0_0x466d(){const _0x119a42=['commhub-channel','\x22\x20(','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','broadcast','/mcp','completed','SSE\x20fatal:\x20','low','.env','then','\x20ALIAS=','application/json,\x20text/event-stream','stringify','commhub_reply','Bearer\x20','commhub_send_message','\x20RESUME_ID=','send_reply','\x20PROJECT_ENV=','290865CSPuty','content','.claude/channels/commhub','initialize','working','failed','22242078DUjxav','messages','parse\x20error:\x20','type','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','←\x20message\x20from\x20','token','number','get','claude-code','notifications/claude/channel','ENV:\x20URL=','unknown\x20tool','send_message','getReader','stdin','cancelled','fatal:\x20','priority','1376814suSmCo','result','trim','slice','cwd','blocked','in_progress','connect','0.3.0','inbox_count','2720892jEjNSb','text','SIGINT','length','\x20from\x20','join','idle','Target\x20session\x20alias','exit','Progress\x200-100','stderr','replace','heartbeat\x20failed:\x20','catch','startsWith','from_session','indexOf','2.0','SSE\x20connected\x20as\x20\x22','starting\x20SSE\x20listener...','.anet','object','string','setRequestHandler','2540272CvruDf','new_message','set','params','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','utf-8','get_all_status','2025-03-26','registered\x20as\x20\x22',':\x20inbox_count=','ready\x20—\x20waiting\x20for\x20events','POST','normal','message','ack_inbox','report_status','1459566qJURKD','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','commhub_send_task','parse','CommHub\x20init\x20failed:\x20','send_task','session\x20disconnected','split','...\x20TMUX=','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','36VzAdhN','hub','notification','Priority\x20(default:\x20normal)','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','pop','Reply\x20text\x20/\x20result\x20summary','commhub_report_status','commhub','get_inbox','SSE\x20connection\x20error:\x20','message_id','/events/','high','find','status','SIGTERM',']\x20[commhub]\x20','Task\x20content','from','init\x20failed:\x20','connecting\x20to\x20','shutting\x20down,\x20reporting\x20offline...','Session\x20alias:\x20','replied','864405xYWwZB','8PYUiZf','Current\x20task\x20description','error'];a0_0x466d=function(){return _0x119a42;};return a0_0x466d();}function p(_0x72baf3){const _0x2e7531=a0_0x1ddf;if(!a0_0x46cf61(_0x72baf3))return;for(let _0x28f43e of a0_0x24596e(_0x72baf3,_0x2e7531(0x102))[_0x2e7531(0x114)]('\x0a')){let _0x42e717=_0x28f43e[_0x2e7531(0x162)]();if(!_0x42e717||_0x42e717['startsWith']('#'))continue;let _0x48b3e2=_0x42e717[_0x2e7531(0x17a)]('=');if(_0x48b3e2<0x0)continue;let _0x2ca38a=_0x42e717[_0x2e7531(0x163)](0x0,_0x48b3e2)[_0x2e7531(0x162)](),_0x48d37e=_0x42e717[_0x2e7531(0x163)](_0x48b3e2+0x1)[_0x2e7531(0x162)]()[_0x2e7531(0x175)](/^["']|["']$/g,'');if(!process.env[_0x2ca38a])process.env[_0x2ca38a]=_0x48d37e;}}var C=process.env.HOME||'~',T=a0_0x1dc3d2(C,a0_0x3cdc6d(0x149));p(a0_0x1dc3d2(T,'.env'));var L=process['cwd']()[a0_0x3cdc6d(0x175)](/\//g,'-');p(a0_0x1dc3d2(T,L,a0_0x3cdc6d(0x13c)));function U(){const _0x4080b0=a0_0x3cdc6d;try{return a0_0x3c4ef6('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x4080b0(0x102),'timeout':0x7d0})[_0x4080b0(0x162)]();}catch{return'';}}function v(){const _0x35c949=a0_0x3cdc6d;try{let _0x52790e=a0_0x1dc3d2(C,_0x35c949(0x17e),'config.json');if(a0_0x46cf61(_0x52790e))return JSON[_0x35c949(0x110)](a0_0x24596e(_0x52790e,_0x35c949(0x102)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x3cdc6d(0x118)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x50d3aa(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x436cfd(),X=process.env.COMMHUB_TOKEN||H[a0_0x3cdc6d(0x153)]||'';function Y(_0x5220b4){const _0x5be9ae=a0_0x3cdc6d;let _0x572c6e=new Date()['toTimeString']()[_0x5be9ae(0x163)](0x0,0x8);process[_0x5be9ae(0x174)]['write']('['+_0x572c6e+_0x5be9ae(0x128)+_0x5220b4+'\x0a');}function h(_0x2b6083){return new Promise(_0x34f95e=>setTimeout(_0x34f95e,_0x2b6083));}function a0_0x1ddf(_0x395c30,_0x522e6a){_0x395c30=_0x395c30-0xfd;const _0x466d66=a0_0x466d();let _0x1ddff8=_0x466d66[_0x395c30];return _0x1ddff8;}Y(a0_0x3cdc6d(0x158)+f+a0_0x3cdc6d(0x13e)+Z+a0_0x3cdc6d(0x144)+w['slice'](0x0,0x8)+a0_0x3cdc6d(0x115)+(j||'none')+'\x20CWD='+process['cwd']()+a0_0x3cdc6d(0x146)+L);var k=new Map(),K=new a0_0x1ea5f3({'name':a0_0x3cdc6d(0x134),'version':a0_0x3cdc6d(0x168)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x3cdc6d(0x10e),a0_0x3cdc6d(0x136),a0_0x3cdc6d(0x101),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x3cdc6d(0x12e)+Z][a0_0x3cdc6d(0x16f)]('\x0a')});K[a0_0x3cdc6d(0x181)](a0_0x342c09,async()=>({'tools':[{'name':a0_0x3cdc6d(0x141),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x3cdc6d(0x17f),'properties':{'task_id':{'type':a0_0x3cdc6d(0x180),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x3cdc6d(0x180),'description':a0_0x3cdc6d(0x11d)},'status':{'type':a0_0x3cdc6d(0x180),'enum':[a0_0x3cdc6d(0x139),a0_0x3cdc6d(0x14c),a0_0x3cdc6d(0x15d),a0_0x3cdc6d(0x165),a0_0x3cdc6d(0x133),a0_0x3cdc6d(0x166)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x3cdc6d(0x16b)]}},{'name':a0_0x3cdc6d(0x11e),'description':a0_0x3cdc6d(0x11b),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x3cdc6d(0x180),'enum':[a0_0x3cdc6d(0x14b),'idle',a0_0x3cdc6d(0x165),'error']},'task':{'type':a0_0x3cdc6d(0x180),'description':a0_0x3cdc6d(0x132)},'progress':{'type':a0_0x3cdc6d(0x154),'description':a0_0x3cdc6d(0x173)}},'required':[a0_0x3cdc6d(0x126)]}},{'name':'commhub_send_task','description':a0_0x3cdc6d(0x151),'inputSchema':{'type':a0_0x3cdc6d(0x17f),'properties':{'alias':{'type':a0_0x3cdc6d(0x180),'description':a0_0x3cdc6d(0x171)},'task':{'type':a0_0x3cdc6d(0x180),'description':a0_0x3cdc6d(0x129)},'priority':{'type':a0_0x3cdc6d(0x180),'enum':[a0_0x3cdc6d(0x124),a0_0x3cdc6d(0x109),a0_0x3cdc6d(0x13b)],'description':a0_0x3cdc6d(0x11a)}},'required':['alias','task']}},{'name':a0_0x3cdc6d(0x143),'description':a0_0x3cdc6d(0x116),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x3cdc6d(0x180),'description':a0_0x3cdc6d(0x171)},'message':{'type':a0_0x3cdc6d(0x180),'description':'Message\x20content'}},'required':['alias',a0_0x3cdc6d(0x10a)]}},{'name':'commhub_get_all_status','description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x3cdc6d(0x17f),'properties':{}}}]}));async function P(_0x47ae8c,_0x350fbf){const _0x37b017=a0_0x3cdc6d;let _0x109bd4=await fetch(f+'/mcp',{'method':_0x37b017(0x108),'headers':{'Content-Type':'application/json','Accept':_0x37b017(0x13f),...X?{'Authorization':_0x37b017(0x142)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x37b017(0x17b),'id':0x1,'method':_0x37b017(0x14a),'params':{'protocolVersion':_0x37b017(0x104),'capabilities':{},'clientInfo':{'name':_0x37b017(0x134),'version':'0.3.0'}}})});if(!_0x109bd4['ok']){let _0x10f848=await _0x109bd4[_0x37b017(0x16b)]();return Y(_0x37b017(0x111)+_0x109bd4[_0x37b017(0x126)]+'\x20'+_0x10f848[_0x37b017(0x163)](0x0,0x64)),{'ok':!0x1,'error':_0x37b017(0x12b)+_0x109bd4[_0x37b017(0x126)]};}await _0x109bd4[_0x37b017(0x16b)]();let _0x44cc69=(await(await fetch(f+_0x37b017(0x138),{'method':_0x37b017(0x108),'headers':{'Content-Type':'application/json','Accept':_0x37b017(0x13f),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x37b017(0x17b),'id':0x2,'method':'tools/call','params':{'name':_0x47ae8c,'arguments':_0x350fbf}})}))['text']())[_0x37b017(0x114)]('\x0a')[_0x37b017(0x125)](_0x5037a8=>_0x5037a8[_0x37b017(0x178)]('data:\x20'));if(_0x44cc69){let _0x460977=JSON[_0x37b017(0x110)](_0x44cc69[_0x37b017(0x163)](0x6));return _0x460977?.[_0x37b017(0x161)]?.[_0x37b017(0x148)]?.[0x0]?.['text']?JSON['parse'](_0x460977['result'][_0x37b017(0x148)][0x0][_0x37b017(0x16b)]):_0x460977;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x3cdc6d(0x181)](a0_0x21dfe5,async _0x2f466e=>{const _0x4274f3=a0_0x3cdc6d;let {name:_0x5aa1ef,arguments:_0x48e82f}=_0x2f466e[_0x4274f3(0x100)];if(_0x5aa1ef===_0x4274f3(0x141)){let {task_id:_0x557f76,text:_0x44369d,status:_0x11ecce}=_0x48e82f;if(_0x11ecce===_0x4274f3(0x139)||_0x11ecce===_0x4274f3(0x14c)||_0x11ecce===_0x4274f3(0x15d)){let _0x4db73c=_0x11ecce==='completed'?_0x4274f3(0x12f):_0x11ecce,_0x554602=_0x557f76?k[_0x4274f3(0x155)](_0x557f76)||_0x4274f3(0x118):'hub',_0x546db1=await P(_0x4274f3(0x145),{'alias':_0x554602,'text':_0x44369d,'in_reply_to':_0x557f76||void 0x0,'status':_0x4db73c,'from_session':Z});if(_0x557f76)k['delete'](_0x557f76);return{'content':[{'type':'text','text':JSON[_0x4274f3(0x140)](_0x546db1)}]};}let _0x4ef87f=await P(_0x4274f3(0x10c),{'resume_id':w,'alias':Z,'status':_0x11ecce===_0x4274f3(0x165)?_0x4274f3(0x165):_0x11ecce===_0x4274f3(0x133)?_0x4274f3(0x133):_0x4274f3(0x14b),'task':_0x44369d[_0x4274f3(0x163)](0x0,0xc8),'output':_0x44369d});return{'content':[{'type':_0x4274f3(0x16b),'text':JSON[_0x4274f3(0x140)](_0x4ef87f)}]};}if(_0x5aa1ef===_0x4274f3(0x11e)){let {status:_0x499cbd,task:_0x48bb5b,progress:_0x45c8f7}=_0x48e82f,_0x463f93=await P(_0x4274f3(0x10c),{'resume_id':w,'alias':Z,'status':_0x499cbd,'task':_0x48bb5b,'progress':_0x45c8f7});return{'content':[{'type':_0x4274f3(0x16b),'text':JSON[_0x4274f3(0x140)](_0x463f93)}]};}if(_0x5aa1ef===_0x4274f3(0x10f)){let {alias:_0x2f58f6,task:_0x2b913b,priority:_0x51fdce}=_0x48e82f,_0xac5a81=await P(_0x4274f3(0x112),{'alias':_0x2f58f6,'task':_0x2b913b,'priority':_0x51fdce||_0x4274f3(0x109),'from_session':Z});return{'content':[{'type':_0x4274f3(0x16b),'text':JSON[_0x4274f3(0x140)](_0xac5a81)}]};}if(_0x5aa1ef===_0x4274f3(0x143)){let {alias:_0x287a13,message:_0x211042}=_0x48e82f,_0x5240f7=await P(_0x4274f3(0x15a),{'alias':_0x287a13,'message':_0x211042,'from_session':Z});return{'content':[{'type':_0x4274f3(0x16b),'text':JSON['stringify'](_0x5240f7)}]};}if(_0x5aa1ef==='commhub_get_all_status'){let _0x5c30e0=await P(_0x4274f3(0x103),{});return{'content':[{'type':_0x4274f3(0x16b),'text':JSON[_0x4274f3(0x140)](_0x5c30e0)}]};}return{'content':[{'type':_0x4274f3(0x16b),'text':JSON[_0x4274f3(0x140)]({'error':_0x4274f3(0x159)})}]};});async function u(){const _0x3b890e=a0_0x3cdc6d;let _0x3a1743=f+_0x3b890e(0x123)+encodeURIComponent(Z),_0x4e6897={};if(X)_0x4e6897['Authorization']=_0x3b890e(0x142)+X;Y(_0x3b890e(0x12c)+_0x3a1743);while(!0x0){try{let _0x2eb1c0=await fetch(_0x3a1743,{'headers':_0x4e6897});if(!_0x2eb1c0['ok']){Y('SSE\x20error:\x20'+_0x2eb1c0[_0x3b890e(0x126)]+'\x20'+_0x2eb1c0['statusText']),await h(0x1388);continue;}let _0x390275=_0x2eb1c0['body'][_0x3b890e(0x15b)](),_0x2b3665=new TextDecoder(),_0x3991dd='';while(!0x0){let {done:_0x36df9e,value:_0x5189ec}=await _0x390275['read']();if(_0x36df9e)break;_0x3991dd+=_0x2b3665['decode'](_0x5189ec,{'stream':!0x0});let _0x5c54c1=_0x3991dd['split']('\x0a\x0a');_0x3991dd=_0x5c54c1[_0x3b890e(0x11c)]()||'';for(let _0x15080c of _0x5c54c1){let _0x1801b1=_0x15080c[_0x3b890e(0x114)]('\x0a')[_0x3b890e(0x125)](_0x1fbce7=>_0x1fbce7['startsWith']('data:\x20'));if(!_0x1801b1)continue;try{let _0x801a2d=JSON[_0x3b890e(0x110)](_0x1801b1[_0x3b890e(0x163)](0x6));await S(_0x801a2d);}catch(_0x2b76aa){Y(_0x3b890e(0x14f)+_0x2b76aa);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x331d90){Y(_0x3b890e(0x121)+_0x331d90);}await h(0xbb8);}}async function S(_0x31b33c){const _0x21ae69=a0_0x3cdc6d;if(_0x31b33c[_0x21ae69(0x150)]==='connected'){Y(_0x21ae69(0x17c)+Z+'\x22');return;}if(_0x31b33c[_0x21ae69(0x150)]===_0x21ae69(0xfe)){if(Y(_0x21ae69(0x152)+_0x31b33c['from']+':\x20'+_0x31b33c['message']['slice'](0x0,0x3c)),await K[_0x21ae69(0x119)]({'method':_0x21ae69(0x157),'params':{'content':_0x31b33c[_0x21ae69(0x10a)],'meta':{'sender':_0x31b33c[_0x21ae69(0x12a)]||_0x21ae69(0x118),'sender_id':_0x21ae69(0x11f),'user':_0x31b33c[_0x21ae69(0x12a)]||_0x21ae69(0x118),'priority':'normal'}}}),_0x31b33c[_0x21ae69(0x122)])await P(_0x21ae69(0x10b),{'alias':Z,'message_id':_0x31b33c[_0x21ae69(0x122)]});return;}if(_0x31b33c[_0x21ae69(0x150)]==='new_task'||_0x31b33c[_0x21ae69(0x150)]===_0x21ae69(0x137)){Y('←\x20'+_0x31b33c[_0x21ae69(0x150)]+_0x21ae69(0x106)+_0x31b33c[_0x21ae69(0x169)]+'\x20priority='+(_0x31b33c[_0x21ae69(0x15f)]||_0x21ae69(0x109)));let _0x5bc2bc=await P(_0x21ae69(0x120),{'alias':Z,'limit':0x5});if(_0x5bc2bc?.['ok']&&_0x5bc2bc['messages']?.[_0x21ae69(0x16d)]>0x0)for(let _0x12de38 of _0x5bc2bc[_0x21ae69(0x14e)]){let _0x122393={'sender':_0x12de38[_0x21ae69(0x179)]||'hub','sender_id':_0x21ae69(0x11f),'user':_0x12de38[_0x21ae69(0x179)]||'hub','task_id':_0x12de38['id'],'priority':_0x12de38['priority']||_0x21ae69(0x109)};k[_0x21ae69(0xff)](_0x12de38['id'],_0x12de38['from_session']||_0x21ae69(0x118)),await K[_0x21ae69(0x119)]({'method':_0x21ae69(0x157),'params':{'content':_0x12de38[_0x21ae69(0x148)],'meta':_0x122393}}),Y('→\x20injected\x20task\x20'+_0x12de38['id']['slice'](0x0,0x8)+_0x21ae69(0x16e)+_0x12de38[_0x21ae69(0x179)]+':\x20'+_0x12de38[_0x21ae69(0x148)][_0x21ae69(0x163)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x12de38['id']});}}}async function A(){const _0x4c61e7=a0_0x3cdc6d;let _0x3224f5=new a0_0x317865();await K[_0x4c61e7(0x167)](_0x3224f5),Y('MCP\x20stdio\x20connected'),Y(_0x4c61e7(0x17d)),u()[_0x4c61e7(0x177)](_0x1a7cb1=>Y(_0x4c61e7(0x13a)+_0x1a7cb1)),P(_0x4c61e7(0x10c),{'resume_id':w,'alias':Z,'status':_0x4c61e7(0x170),'server':a0_0x50d3aa(),'hostname':a0_0x50d3aa(),'agent':'claude-code','project_dir':process[_0x4c61e7(0x164)](),'tmux_name':j||void 0x0})[_0x4c61e7(0x13d)](()=>Y(_0x4c61e7(0x105)+Z+_0x4c61e7(0x135)+w[_0x4c61e7(0x163)](0x0,0x8)+')'))['catch'](_0x733b9c=>Y('warning:\x20could\x20not\x20register:\x20'+_0x733b9c)),setInterval(()=>{const _0x53886d=_0x4c61e7;P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x50d3aa(),'hostname':a0_0x50d3aa(),'agent':_0x53886d(0x156),'project_dir':process[_0x53886d(0x164)](),'tmux_name':j||void 0x0})[_0x53886d(0x177)](_0x2832cd=>Y(_0x53886d(0x176)+_0x2832cd));},0x2bf20),Y(_0x4c61e7(0x107));}A()[a0_0x3cdc6d(0x177)](_0x56a953=>{const _0x11b615=a0_0x3cdc6d;Y(_0x11b615(0x15e)+_0x56a953),process[_0x11b615(0x172)](0x1);});async function N(){const _0x37858c=a0_0x3cdc6d;Y(_0x37858c(0x12d)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x37858c(0x133),'task':_0x37858c(0x113)})[_0x37858c(0x177)](()=>{}),process[_0x37858c(0x172)](0x0);}process[a0_0x3cdc6d(0x15c)]['on']('end',()=>N()),process['on'](a0_0x3cdc6d(0x127),()=>N()),process['on'](a0_0x3cdc6d(0x16c),()=>N());
2
+ const a0_0x55afc9=a0_0x39f2;(function(_0x59bb83,_0x4e328a){const _0x13cae0=a0_0x39f2,_0x4da61d=_0x59bb83();while(!![]){try{const _0x4cebc2=parseInt(_0x13cae0(0x1f5))/0x1*(parseInt(_0x13cae0(0x213))/0x2)+parseInt(_0x13cae0(0x1fc))/0x3+-parseInt(_0x13cae0(0x23d))/0x4+parseInt(_0x13cae0(0x1ea))/0x5*(-parseInt(_0x13cae0(0x1f8))/0x6)+parseInt(_0x13cae0(0x1f2))/0x7*(-parseInt(_0x13cae0(0x1fa))/0x8)+-parseInt(_0x13cae0(0x274))/0x9*(-parseInt(_0x13cae0(0x255))/0xa)+-parseInt(_0x13cae0(0x218))/0xb*(-parseInt(_0x13cae0(0x1ec))/0xc);if(_0x4cebc2===_0x4e328a)break;else _0x4da61d['push'](_0x4da61d['shift']());}catch(_0x1fc93e){_0x4da61d['push'](_0x4da61d['shift']());}}}(a0_0x4a19,0x67dad));import{readFileSync as a0_0x8d21db,existsSync as a0_0x54d138}from'fs';import{randomUUID as a0_0x297324}from'crypto';import{join as a0_0xeb263f}from'path';import{hostname as a0_0x3c76ce}from'os';import{execSync as a0_0x572900}from'child_process';function a0_0x39f2(_0x30ff79,_0x184048){_0x30ff79=_0x30ff79-0x1e9;const _0x4a19d1=a0_0x4a19();let _0x39f261=_0x4a19d1[_0x30ff79];return _0x39f261;}import{Server as a0_0x2b4a81}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x374d4b}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x1699a9,CallToolRequestSchema as a0_0x4bd245}from'@modelcontextprotocol/sdk/types.js';function p(_0x45739b){const _0x89365b=a0_0x39f2;if(!a0_0x54d138(_0x45739b))return;for(let _0x700e94 of a0_0x8d21db(_0x45739b,_0x89365b(0x26a))[_0x89365b(0x244)]('\x0a')){let _0x317d15=_0x700e94[_0x89365b(0x227)]();if(!_0x317d15||_0x317d15[_0x89365b(0x1eb)]('#'))continue;let _0x34d456=_0x317d15[_0x89365b(0x270)]('=');if(_0x34d456<0x0)continue;let _0x5d6e23=_0x317d15[_0x89365b(0x240)](0x0,_0x34d456)[_0x89365b(0x227)](),_0x68d8cb=_0x317d15['slice'](_0x34d456+0x1)[_0x89365b(0x227)]()[_0x89365b(0x233)](/^["']|["']$/g,'');if(!process.env[_0x5d6e23])process.env[_0x5d6e23]=_0x68d8cb;}}var C=process.env.HOME||'~',T=a0_0xeb263f(C,'.claude/channels/commhub');p(a0_0xeb263f(T,a0_0x55afc9(0x22d)));var L=process[a0_0x55afc9(0x271)]()[a0_0x55afc9(0x233)](/\//g,'-');p(a0_0xeb263f(T,L,'.env'));function U(){const _0x5ef468=a0_0x55afc9;try{return a0_0x572900(_0x5ef468(0x26c),{'encoding':_0x5ef468(0x26a),'timeout':0x7d0})[_0x5ef468(0x227)]();}catch{return'';}}function v(){const _0x16ad94=a0_0x55afc9;try{let _0x40ae16=a0_0xeb263f(C,_0x16ad94(0x221),_0x16ad94(0x207));if(a0_0x54d138(_0x40ae16))return JSON[_0x16ad94(0x237)](a0_0x8d21db(_0x40ae16,_0x16ad94(0x26a)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x55afc9(0x23c)]||a0_0x55afc9(0x214),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x3c76ce(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x297324(),X=process.env.COMMHUB_TOKEN||H[a0_0x55afc9(0x203)]||'';function Y(_0x963c7){const _0x26163d=a0_0x55afc9;let _0x2a008a=new Date()[_0x26163d(0x205)]()[_0x26163d(0x240)](0x0,0x8);process[_0x26163d(0x202)]['write']('['+_0x2a008a+']\x20[commhub]\x20'+_0x963c7+'\x0a');}function h(_0x3c9624){return new Promise(_0x2e5f9c=>setTimeout(_0x2e5f9c,_0x3c9624));}Y(a0_0x55afc9(0x245)+f+a0_0x55afc9(0x241)+Z+a0_0x55afc9(0x273)+w[a0_0x55afc9(0x240)](0x0,0x8)+a0_0x55afc9(0x21a)+(j||a0_0x55afc9(0x22c))+a0_0x55afc9(0x1f4)+process[a0_0x55afc9(0x271)]()+a0_0x55afc9(0x20d)+L);var k=new Map(),K=new a0_0x2b4a81({'name':a0_0x55afc9(0x272),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x55afc9(0x262),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x55afc9(0x226),a0_0x55afc9(0x268)+Z][a0_0x55afc9(0x239)]('\x0a')});K[a0_0x55afc9(0x252)](a0_0x1699a9,async()=>({'tools':[{'name':a0_0x55afc9(0x23f),'description':a0_0x55afc9(0x1ee),'inputSchema':{'type':a0_0x55afc9(0x229),'properties':{'task_id':{'type':a0_0x55afc9(0x1ff),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x55afc9(0x1ff),'description':a0_0x55afc9(0x1f0)},'status':{'type':'string','enum':[a0_0x55afc9(0x24a),a0_0x55afc9(0x1f1),a0_0x55afc9(0x250),a0_0x55afc9(0x263),a0_0x55afc9(0x225),a0_0x55afc9(0x231)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':['text']}},{'name':'commhub_report_status','description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x55afc9(0x229),'properties':{'status':{'type':'string','enum':[a0_0x55afc9(0x224),a0_0x55afc9(0x23e),'blocked','error']},'task':{'type':'string','description':a0_0x55afc9(0x212)},'progress':{'type':'number','description':a0_0x55afc9(0x235)}},'required':[a0_0x55afc9(0x236)]}},{'name':'commhub_send_task','description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x55afc9(0x229),'properties':{'alias':{'type':a0_0x55afc9(0x1ff),'description':a0_0x55afc9(0x20b)},'task':{'type':'string','description':a0_0x55afc9(0x22e)},'priority':{'type':a0_0x55afc9(0x1ff),'enum':[a0_0x55afc9(0x200),a0_0x55afc9(0x1f7),a0_0x55afc9(0x1e9)],'description':a0_0x55afc9(0x26e)}},'required':[a0_0x55afc9(0x25e),'task']}},{'name':a0_0x55afc9(0x219),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x55afc9(0x1ff),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x55afc9(0x1ff),'description':'Message\x20content'}},'required':[a0_0x55afc9(0x25e),a0_0x55afc9(0x24d)]}},{'name':a0_0x55afc9(0x242),'description':a0_0x55afc9(0x234),'inputSchema':{'type':a0_0x55afc9(0x229),'properties':{}}}]}));async function P(_0x289c9e,_0x21c2ce){const _0x5b0267=a0_0x55afc9;let _0x12023a=await fetch(f+_0x5b0267(0x25c),{'method':'POST','headers':{'Content-Type':'application/json','Accept':_0x5b0267(0x26f),...X?{'Authorization':_0x5b0267(0x25b)+X}:{}},'body':JSON[_0x5b0267(0x222)]({'jsonrpc':_0x5b0267(0x211),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x5b0267(0x26d),'capabilities':{},'clientInfo':{'name':_0x5b0267(0x272),'version':_0x5b0267(0x25a)}}})});if(!_0x12023a['ok']){let _0x22d38c=await _0x12023a['text']();return Y(_0x5b0267(0x22a)+_0x12023a[_0x5b0267(0x236)]+'\x20'+_0x22d38c[_0x5b0267(0x240)](0x0,0x64)),{'ok':!0x1,'error':_0x5b0267(0x21e)+_0x12023a['status']};}await _0x12023a[_0x5b0267(0x1ed)]();let _0x2a7c83=(await(await fetch(f+_0x5b0267(0x25c),{'method':_0x5b0267(0x216),'headers':{'Content-Type':_0x5b0267(0x251),'Accept':_0x5b0267(0x26f),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x5b0267(0x222)]({'jsonrpc':_0x5b0267(0x211),'id':0x2,'method':_0x5b0267(0x215),'params':{'name':_0x289c9e,'arguments':_0x21c2ce}})}))['text']())['split']('\x0a')['find'](_0x2e1630=>_0x2e1630[_0x5b0267(0x1eb)](_0x5b0267(0x26b)));if(_0x2a7c83){let _0x2a2ec1=JSON[_0x5b0267(0x237)](_0x2a7c83['slice'](0x6));return _0x2a2ec1?.['result']?.[_0x5b0267(0x21f)]?.[0x0]?.[_0x5b0267(0x1ed)]?JSON[_0x5b0267(0x237)](_0x2a2ec1[_0x5b0267(0x208)]['content'][0x0][_0x5b0267(0x1ed)]):_0x2a2ec1;}return{'ok':!0x1,'error':_0x5b0267(0x22f)};}function a0_0x4a19(){const _0x1c6d39=['tmux\x20display-message\x20-p\x20\x27#S\x27','2025-03-26','Priority\x20(default:\x20normal)','application/json,\x20text/event-stream','indexOf','cwd','commhub-channel','\x20RESUME_ID=','470277dgDghV','new_message','claude-code','low','35RQRQNq','startsWith','4016496EMIkeF','text','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','connected','Reply\x20text\x20/\x20result\x20summary','failed','245413AEEFtK','inbox_count','\x20CWD=','118sbMLgw','notification','normal','393252rYkoBR','params','136TXriGf','SIGTERM','1901511yxRJwj','/events/','→\x20injected\x20task\x20','string','high','pop','stderr','token','find','toTimeString',':\x20inbox_count=','config.json','result','from_session','stdin','Target\x20session\x20alias','registered\x20as\x20\x22','\x20PROJECT_ENV=','type','SIGINT','send_reply','2.0','Current\x20task\x20description','6442WcYWmm','http://127.0.0.1:9200','tools/call','POST','catch','33MUrWCX','commhub_send_message','...\x20TMUX=','getReader','message_id','broadcast','init\x20failed:\x20','content','body','.anet','stringify','send_task','working','error','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','trim','shutting\x20down,\x20reporting\x20offline...','object','CommHub\x20init\x20failed:\x20','get_inbox','none','.env','Task\x20content','no\x20response','messages','in_progress','parse\x20error:\x20','replace','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','Progress\x200-100','status','parse','\x20from\x20','join','set','exit','hub','2987460RcmhAA','idle','commhub_reply','slice','\x20ALIAS=','commhub_get_all_status','replied','split','ENV:\x20URL=','Authorization','commhub_report_status','MCP\x20stdio\x20connected','notifications/claude/channel','completed','commhub','SSE\x20error:\x20','message','SSE\x20connection\x20error:\x20','from','cancelled','application/json','setRequestHandler','fatal:\x20','new_task','40COskMa','commhub_send_task','read','delete','statusText','0.3.0','Bearer\x20','/mcp','\x20priority=','alias','←\x20message\x20from\x20','\x22\x20(','starting\x20SSE\x20listener...','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','blocked','send_message','length','priority','report_status','Session\x20alias:\x20','session\x20disconnected','utf-8','data:\x20'];a0_0x4a19=function(){return _0x1c6d39;};return a0_0x4a19();}K[a0_0x55afc9(0x252)](a0_0x4bd245,async _0x1f566c=>{const _0x217861=a0_0x55afc9;let {name:_0x1d60df,arguments:_0x11ca63}=_0x1f566c[_0x217861(0x1f9)];if(_0x1d60df===_0x217861(0x23f)){let {task_id:_0x35da08,text:_0x586f43,status:_0x49aca7}=_0x11ca63;if(_0x49aca7===_0x217861(0x24a)||_0x49aca7===_0x217861(0x1f1)||_0x49aca7===_0x217861(0x250)){let _0x397dd1=_0x49aca7===_0x217861(0x24a)?_0x217861(0x243):_0x49aca7,_0x4b481e=_0x35da08?k['get'](_0x35da08)||'hub':'hub',_0x41db4a=await P(_0x217861(0x210),{'alias':_0x4b481e,'text':_0x586f43,'in_reply_to':_0x35da08||void 0x0,'status':_0x397dd1,'from_session':Z});if(_0x35da08)k[_0x217861(0x258)](_0x35da08);return{'content':[{'type':_0x217861(0x1ed),'text':JSON[_0x217861(0x222)](_0x41db4a)}]};}let _0x2ef9a6=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x49aca7==='blocked'?_0x217861(0x263):_0x49aca7===_0x217861(0x225)?_0x217861(0x225):_0x217861(0x224),'task':_0x586f43[_0x217861(0x240)](0x0,0xc8),'output':_0x586f43});return{'content':[{'type':_0x217861(0x1ed),'text':JSON[_0x217861(0x222)](_0x2ef9a6)}]};}if(_0x1d60df===_0x217861(0x247)){let {status:_0x2e30c5,task:_0x1adab8,progress:_0x3ab4b5}=_0x11ca63,_0x5cebc2=await P(_0x217861(0x267),{'resume_id':w,'alias':Z,'status':_0x2e30c5,'task':_0x1adab8,'progress':_0x3ab4b5});return{'content':[{'type':_0x217861(0x1ed),'text':JSON[_0x217861(0x222)](_0x5cebc2)}]};}if(_0x1d60df===_0x217861(0x256)){let {alias:_0x24b133,task:_0x6164a9,priority:_0x4b6694}=_0x11ca63,_0x7cdce7=await P(_0x217861(0x223),{'alias':_0x24b133,'task':_0x6164a9,'priority':_0x4b6694||'normal','from_session':Z});return{'content':[{'type':_0x217861(0x1ed),'text':JSON['stringify'](_0x7cdce7)}]};}if(_0x1d60df==='commhub_send_message'){let {alias:_0x3989bf,message:_0x32276e}=_0x11ca63,_0xc6eda0=await P(_0x217861(0x264),{'alias':_0x3989bf,'message':_0x32276e,'from_session':Z});return{'content':[{'type':_0x217861(0x1ed),'text':JSON[_0x217861(0x222)](_0xc6eda0)}]};}if(_0x1d60df==='commhub_get_all_status'){let _0x59aa65=await P('get_all_status',{});return{'content':[{'type':_0x217861(0x1ed),'text':JSON[_0x217861(0x222)](_0x59aa65)}]};}return{'content':[{'type':'text','text':JSON[_0x217861(0x222)]({'error':'unknown\x20tool'})}]};});async function u(){const _0x33b39c=a0_0x55afc9;let _0x331650=f+_0x33b39c(0x1fd)+encodeURIComponent(Z),_0x9e1422={};if(X)_0x9e1422[_0x33b39c(0x246)]=_0x33b39c(0x25b)+X;Y('connecting\x20to\x20'+_0x331650);while(!0x0){try{let _0x5d9909=await fetch(_0x331650,{'headers':_0x9e1422});if(!_0x5d9909['ok']){Y(_0x33b39c(0x24c)+_0x5d9909[_0x33b39c(0x236)]+'\x20'+_0x5d9909[_0x33b39c(0x259)]),await h(0x1388);continue;}let _0x13ef0d=_0x5d9909[_0x33b39c(0x220)][_0x33b39c(0x21b)](),_0x4d0e1a=new TextDecoder(),_0x1d0e98='';while(!0x0){let {done:_0x578de0,value:_0x5e1c47}=await _0x13ef0d[_0x33b39c(0x257)]();if(_0x578de0)break;_0x1d0e98+=_0x4d0e1a['decode'](_0x5e1c47,{'stream':!0x0});let _0x24fe3f=_0x1d0e98[_0x33b39c(0x244)]('\x0a\x0a');_0x1d0e98=_0x24fe3f[_0x33b39c(0x201)]()||'';for(let _0x1f05cc of _0x24fe3f){let _0x457235=_0x1f05cc[_0x33b39c(0x244)]('\x0a')[_0x33b39c(0x204)](_0x205bf4=>_0x205bf4[_0x33b39c(0x1eb)](_0x33b39c(0x26b)));if(!_0x457235)continue;try{let _0x87fec6=JSON[_0x33b39c(0x237)](_0x457235['slice'](0x6));await S(_0x87fec6);}catch(_0x18ed12){Y(_0x33b39c(0x232)+_0x18ed12);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0xb2d67){Y(_0x33b39c(0x24e)+_0xb2d67);}await h(0xbb8);}}async function S(_0x40a42d){const _0xe12490=a0_0x55afc9;if(_0x40a42d[_0xe12490(0x20e)]===_0xe12490(0x1ef)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x40a42d['type']===_0xe12490(0x275)){if(Y(_0xe12490(0x25f)+_0x40a42d['from']+':\x20'+_0x40a42d[_0xe12490(0x24d)][_0xe12490(0x240)](0x0,0x3c)),await K[_0xe12490(0x1f6)]({'method':_0xe12490(0x249),'params':{'content':_0x40a42d['message'],'meta':{'sender':_0x40a42d[_0xe12490(0x24f)]||'hub','sender_id':_0xe12490(0x24b),'user':_0x40a42d[_0xe12490(0x24f)]||'hub','priority':'normal'}}}),_0x40a42d['message_id'])await P('ack_inbox',{'alias':Z,'message_id':_0x40a42d[_0xe12490(0x21c)]});return;}if(_0x40a42d[_0xe12490(0x20e)]===_0xe12490(0x254)||_0x40a42d[_0xe12490(0x20e)]===_0xe12490(0x21d)){Y('←\x20'+_0x40a42d[_0xe12490(0x20e)]+_0xe12490(0x206)+_0x40a42d[_0xe12490(0x1f3)]+_0xe12490(0x25d)+(_0x40a42d[_0xe12490(0x266)]||_0xe12490(0x1f7)));let _0xed90d1=await P(_0xe12490(0x22b),{'alias':Z,'limit':0x5});if(_0xed90d1?.['ok']&&_0xed90d1[_0xe12490(0x230)]?.[_0xe12490(0x265)]>0x0)for(let _0x545df3 of _0xed90d1['messages']){let _0x460088={'sender':_0x545df3[_0xe12490(0x209)]||_0xe12490(0x23c),'sender_id':'commhub','user':_0x545df3['from_session']||'hub','task_id':_0x545df3['id'],'priority':_0x545df3['priority']||'normal'};k[_0xe12490(0x23a)](_0x545df3['id'],_0x545df3[_0xe12490(0x209)]||'hub'),await K[_0xe12490(0x1f6)]({'method':'notifications/claude/channel','params':{'content':_0x545df3[_0xe12490(0x21f)],'meta':_0x460088}}),Y(_0xe12490(0x1fe)+_0x545df3['id'][_0xe12490(0x240)](0x0,0x8)+_0xe12490(0x238)+_0x545df3[_0xe12490(0x209)]+':\x20'+_0x545df3[_0xe12490(0x21f)][_0xe12490(0x240)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x545df3['id']});}}}async function A(){const _0x18f617=a0_0x55afc9;let _0x573d6f=new a0_0x374d4b();await K['connect'](_0x573d6f),Y(_0x18f617(0x248)),Y(_0x18f617(0x261)),u()['catch'](_0x5061b5=>Y('SSE\x20fatal:\x20'+_0x5061b5)),P(_0x18f617(0x267),{'resume_id':w,'alias':Z,'status':_0x18f617(0x23e),'server':a0_0x3c76ce(),'hostname':a0_0x3c76ce(),'agent':_0x18f617(0x276),'project_dir':process[_0x18f617(0x271)](),'tmux_name':j||void 0x0})['then'](()=>Y(_0x18f617(0x20c)+Z+_0x18f617(0x260)+w[_0x18f617(0x240)](0x0,0x8)+')'))[_0x18f617(0x217)](_0x348d63=>Y('warning:\x20could\x20not\x20register:\x20'+_0x348d63)),setInterval(()=>{const _0x26ca05=_0x18f617;P(_0x26ca05(0x267),{'resume_id':w,'alias':Z,'status':_0x26ca05(0x23e),'server':a0_0x3c76ce(),'hostname':a0_0x3c76ce(),'agent':_0x26ca05(0x276),'project_dir':process[_0x26ca05(0x271)](),'tmux_name':j||void 0x0})[_0x26ca05(0x217)](_0x12b66b=>Y('heartbeat\x20failed:\x20'+_0x12b66b));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x55afc9(0x217)](_0x4bc2d2=>{const _0x2c1671=a0_0x55afc9;Y(_0x2c1671(0x253)+_0x4bc2d2),process[_0x2c1671(0x23b)](0x1);});async function N(){const _0x33bb63=a0_0x55afc9;Y(_0x33bb63(0x228)),await P('report_status',{'resume_id':w,'alias':Z,'status':'error','task':_0x33bb63(0x269)})[_0x33bb63(0x217)](()=>{}),process['exit'](0x0);}process[a0_0x55afc9(0x20a)]['on']('end',()=>N()),process['on'](a0_0x55afc9(0x1fb),()=>N()),process['on'](a0_0x55afc9(0x20f),()=>N());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.0.3-preview.8",
3
+ "version": "2.0.3-preview.9",
4
4
  "description": "AI Agent Network CLI — Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 39 commands.",
5
5
  "type": "module",
6
6
  "main": "dist/src/client.js",