@sleep2agi/agent-network 2.0.0-preview.5 → 2.0.0-preview.50
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.
- package/README.md +215 -73
- package/dist/bin/cli.js +1 -1
- package/dist/src/client.js +1 -1
- package/dist/src/node-server.js +1 -1
- package/package.json +9 -7
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a0_0x541f08=a0_0x32b0;(function(_0x10d81e,_0x2cc339){const _0x1f47b6=a0_0x32b0,_0xe4cbd3=_0x10d81e();while(!![]){try{const _0x5d52e4=-parseInt(_0x1f47b6(0xbe))/0x1*(-parseInt(_0x1f47b6(0x8d))/0x2)+-parseInt(_0x1f47b6(0x85))/0x3+parseInt(_0x1f47b6(0x6e))/0x4*(parseInt(_0x1f47b6(0xa1))/0x5)+-parseInt(_0x1f47b6(0xc5))/0x6+-parseInt(_0x1f47b6(0x72))/0x7*(parseInt(_0x1f47b6(0x7a))/0x8)+parseInt(_0x1f47b6(0x73))/0x9+parseInt(_0x1f47b6(0x79))/0xa;if(_0x5d52e4===_0x2cc339)break;else _0xe4cbd3['push'](_0xe4cbd3['shift']());}catch(_0x22d170){_0xe4cbd3['push'](_0xe4cbd3['shift']());}}}(a0_0xefac,0xcc684));import{EventEmitter as a0_0x36cb9a}from'events';function a0_0x32b0(_0x1b80c5,_0x4e2c38){_0x1b80c5=_0x1b80c5-0x6e;const _0xefac4b=a0_0xefac();let _0x32b0fc=_0xefac4b[_0x1b80c5];return _0x32b0fc;}import{hostname as a0_0x36d7a6}from'os';class T extends a0_0x36cb9a{[a0_0x541f08(0xaf)];[a0_0x541f08(0x78)];[a0_0x541f08(0x90)];[a0_0x541f08(0x91)];['resumeId'];['heartbeatInterval'];[a0_0x541f08(0x76)];['heartbeatTimer'];['sseAbort'];[a0_0x541f08(0x86)]=!0x1;constructor(_0x1fe7eb){const _0x1dae07=a0_0x541f08;super();if(this[_0x1dae07(0xaf)]=_0x1fe7eb[_0x1dae07(0xaf)][_0x1dae07(0xc0)](/\/$/,''),this[_0x1dae07(0x78)]=_0x1fe7eb['alias'],this[_0x1dae07(0x90)]=_0x1fe7eb[_0x1dae07(0x90)],this[_0x1dae07(0x91)]=_0x1fe7eb[_0x1dae07(0x91)]||_0x1dae07(0xb5),this[_0x1dae07(0x80)]=_0x1dae07(0xc4)+_0x1fe7eb[_0x1dae07(0x78)]+'-'+Date[_0x1dae07(0x9d)]()['toString'](0x24),this[_0x1dae07(0x9b)]=_0x1fe7eb[_0x1dae07(0x9b)]??0x2bf20,this[_0x1dae07(0x76)]=_0x1fe7eb['reconnectDelay']??0xbb8,_0x1fe7eb[_0x1dae07(0x82)]!==!0x1)this[_0x1dae07(0xbf)]();}[a0_0x541f08(0x92)](_0x141779){const _0x8779ce=a0_0x541f08;console[_0x8779ce(0x92)]('['+new Date()[_0x8779ce(0xba)]()['slice'](0x0,0x8)+']\x20[commhub:'+this[_0x8779ce(0x78)]+']\x20'+_0x141779);}async[a0_0x541f08(0xae)](_0xc0c95e,_0x38d692){const _0x1b9069=a0_0x541f08;let _0x146cb8={'Content-Type':_0x1b9069(0x87),'Accept':_0x1b9069(0xab)};if(this[_0x1b9069(0x90)])_0x146cb8[_0x1b9069(0x8e)]=_0x1b9069(0xa8)+this[_0x1b9069(0x90)];let _0x2724d6=await(await fetch(this['url']+'/mcp',{'method':_0x1b9069(0xaa),'headers':_0x146cb8,'body':JSON[_0x1b9069(0x71)]({'jsonrpc':_0x1b9069(0x97),'id':Date[_0x1b9069(0x9d)](),'method':_0x1b9069(0x89),'params':{'name':_0xc0c95e,'arguments':_0x38d692}})}))['text'](),_0x3720ae=_0x2724d6[_0x1b9069(0xa2)](/data: (.+)/),_0x3f18ca=_0x3720ae?JSON[_0x1b9069(0xc3)](_0x3720ae[0x1]):JSON['parse'](_0x2724d6),_0x5ca143=_0x3f18ca?.[_0x1b9069(0x70)]?.[_0x1b9069(0x7c)]?.[0x0]?.['text'];return _0x5ca143?JSON[_0x1b9069(0xc3)](_0x5ca143):_0x3f18ca;}async[a0_0x541f08(0xbf)](){const _0x569a30=a0_0x541f08;if(this['running'])return;this[_0x569a30(0x86)]=!0x0,await this[_0x569a30(0xa6)](_0x569a30(0x8c)),this[_0x569a30(0x92)](_0x569a30(0xb6)),this[_0x569a30(0x93)]=setInterval(()=>{const _0x413b7c=_0x569a30;this[_0x413b7c(0xa6)](_0x413b7c(0x8c))['catch'](_0x8a1cc4=>this['log'](_0x413b7c(0x84)+_0x8a1cc4['message']));},this[_0x569a30(0x9b)]),this[_0x569a30(0x83)]();}async[a0_0x541f08(0x8a)](){const _0x3e603d=a0_0x541f08;if(this['running']=!0x1,this['sseAbort']?.[_0x3e603d(0xb4)](),this[_0x3e603d(0x93)])clearInterval(this[_0x3e603d(0x93)]);await this[_0x3e603d(0xa6)]('offline')[_0x3e603d(0x7e)](()=>{}),this[_0x3e603d(0x92)](_0x3e603d(0xb8));}async['send'](_0x4e6e45,_0x3c1688,_0xfeb3bf=a0_0x541f08(0xa0)){const _0x565e50=a0_0x541f08;return this[_0x565e50(0xae)](_0x565e50(0xa3),{'alias':_0x4e6e45,'task':_0x3c1688,'priority':_0xfeb3bf,'from_session':this[_0x565e50(0x78)]});}async['message'](_0x90fbf7,_0x18b525){const _0x13c043=a0_0x541f08;return this['call'](_0x13c043(0xa5),{'alias':_0x90fbf7,'message':_0x18b525,'from_session':this[_0x13c043(0x78)]});}async['reply'](_0x3f6253,_0xb4d7df,_0x319fe4=a0_0x541f08(0x77)){const _0x213c34=a0_0x541f08;return this[_0x213c34(0xae)](_0x213c34(0xc2),{'task_id':_0x3f6253,'text':_0xb4d7df,'status':_0x319fe4});}async['status'](_0x1ac2c4,_0x3ca6c3){const _0x85e0e8=a0_0x541f08;return this[_0x85e0e8(0xae)](_0x85e0e8(0x98),{'resume_id':this['resumeId'],'alias':this['alias'],'status':_0x1ac2c4,'server':a0_0x36d7a6(),'hostname':a0_0x36d7a6(),'agent':this[_0x85e0e8(0x91)],'project_dir':process[_0x85e0e8(0x9f)](),..._0x3ca6c3});}async[a0_0x541f08(0x8b)](){const _0x14dc89=a0_0x541f08;return this[_0x14dc89(0xae)]('get_all_status',{});}async['broadcast'](_0x49e008,_0x488b57){const _0x42afcf=a0_0x541f08;return this[_0x42afcf(0xae)](_0x42afcf(0x95),{'message':_0x49e008,'filter_server':_0x488b57?.['server'],'filter_status':_0x488b57?.[_0x42afcf(0xa6)]});}async['connectSSE'](){const _0x1d953f=a0_0x541f08;let _0x263078=encodeURIComponent(this[_0x1d953f(0x78)]),_0x1e9b29=this[_0x1d953f(0xaf)]+'/events/'+_0x263078,_0x32139c=this[_0x1d953f(0x76)];while(this[_0x1d953f(0x86)]){try{this[_0x1d953f(0xa4)]=new AbortController();let _0x4b4a01={'Accept':_0x1d953f(0xb1)};if(this[_0x1d953f(0x90)])_0x4b4a01[_0x1d953f(0x8e)]='Bearer\x20'+this[_0x1d953f(0x90)];let _0x1bc0ca=await fetch(_0x1e9b29,{'headers':_0x4b4a01,'signal':this[_0x1d953f(0xa4)][_0x1d953f(0x8f)]});if(!_0x1bc0ca['ok']||!_0x1bc0ca['body']){this[_0x1d953f(0x92)](_0x1d953f(0x9c)+_0x1bc0ca[_0x1d953f(0xa6)]),await this[_0x1d953f(0xbb)](_0x32139c),_0x32139c=Math['min'](_0x32139c*1.5,0xea60);continue;}_0x32139c=this[_0x1d953f(0x76)];let _0x34742d=_0x1bc0ca['body'][_0x1d953f(0x75)](),_0x51ffed=new TextDecoder(),_0x14ce1a='';while(this['running']){let {done:_0x1be07c,value:_0x6da16a}=await _0x34742d[_0x1d953f(0xb9)]();if(_0x1be07c)break;_0x14ce1a+=_0x51ffed[_0x1d953f(0xb3)](_0x6da16a,{'stream':!0x0});let _0x21b144=_0x14ce1a[_0x1d953f(0x6f)]('\x0a');_0x14ce1a=_0x21b144[_0x1d953f(0x74)]()||'';for(let _0x448aa3 of _0x21b144){if(!_0x448aa3[_0x1d953f(0xbd)](_0x1d953f(0x7d)))continue;try{let _0x144412=JSON['parse'](_0x448aa3[_0x1d953f(0xb2)](0x6));if(_0x144412[_0x1d953f(0x99)]==='connected'){this[_0x1d953f(0x92)]('SSE\x20connected'),this[_0x1d953f(0xb7)](_0x1d953f(0xac));continue;}if(_0x144412[_0x1d953f(0x99)]===_0x1d953f(0xad)||_0x144412[_0x1d953f(0x99)]===_0x1d953f(0x9e)||_0x144412['type']===_0x1d953f(0x95))await this[_0x1d953f(0x7b)]();}catch{}}}}catch(_0x419bbd){if(_0x419bbd[_0x1d953f(0xb0)]===_0x1d953f(0x94))break;this[_0x1d953f(0xb7)](_0x1d953f(0xc1),_0x419bbd),this[_0x1d953f(0x92)](_0x1d953f(0x7f)+_0x419bbd[_0x1d953f(0x88)]);}if(this[_0x1d953f(0x86)])this[_0x1d953f(0xb7)]('disconnected'),this['log'](_0x1d953f(0x96)+_0x32139c/0x3e8+_0x1d953f(0xbc)),await this[_0x1d953f(0xbb)](_0x32139c),_0x32139c=Math[_0x1d953f(0xa7)](_0x32139c*1.5,0xea60);}}async[a0_0x541f08(0x7b)](){const _0x11ecdc=a0_0x541f08;try{let _0x566180=(await this[_0x11ecdc(0xae)](_0x11ecdc(0x81),{'alias':this[_0x11ecdc(0x78)],'limit':0xa}))?.[_0x11ecdc(0x9a)]||[];for(let _0x24c47c of _0x566180)await this['call']('ack_inbox',{'alias':this[_0x11ecdc(0x78)],'message_id':_0x24c47c['id']}),this[_0x11ecdc(0x92)]('←\x20'+_0x24c47c['from_session']+':\x20'+_0x24c47c[_0x11ecdc(0x7c)][_0x11ecdc(0xb2)](0x0,0x3c)),this[_0x11ecdc(0xb7)]('task',_0x24c47c),this[_0x11ecdc(0xb7)]('message',_0x24c47c);}catch(_0xe4ec98){this[_0x11ecdc(0x92)](_0x11ecdc(0xa9)+_0xe4ec98[_0x11ecdc(0x88)]);}}[a0_0x541f08(0xbb)](_0x4ba376){return new Promise(_0x5a2015=>setTimeout(_0x5a2015,_0x4ba376));}}var $=T;export{$ as default,T as CommHub};function a0_0xefac(){const _0xdcaea6=['connect','replace','error','reply','parse','sdk-','7477524ztSWFh','4mBOKSz','split','result','stringify','7pHCgnv','3789162GiIhhl','pop','getReader','reconnectDelay','completed','alias','15377700Fcyymn','4773824AwefKP','processInbox','content','data:\x20','catch','SSE\x20error:\x20','resumeId','get_inbox','autoConnect','connectSSE','heartbeat\x20failed:\x20','2187525qPBSZc','running','application/json','message','tools/call','disconnect','getAllStatus','idle','12498CDxmwM','Authorization','signal','token','agent','log','heartbeatTimer','AbortError','broadcast','SSE\x20reconnecting\x20in\x20','2.0','report_status','type','messages','heartbeatInterval','SSE\x20failed:\x20','now','new_message','cwd','normal','379205AOnsFb','match','send_task','sseAbort','send_message','status','min','Bearer\x20','inbox\x20error:\x20','POST','application/json,\x20text/event-stream','connected','new_task','call','url','name','text/event-stream','slice','decode','abort','sdk','registered','emit','disconnected','read','toTimeString','sleep','s...','startsWith','220nCVPJT'];a0_0xefac=function(){return _0xdcaea6;};return a0_0xefac();}
|
package/dist/src/node-server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
const a0_0x26a715=a0_0x404e;(function(_0x472e0c,_0x35b763){const _0x1b9f0e=a0_0x404e,_0x22db40=_0x472e0c();while(!![]){try{const _0x5e5f21=-parseInt(_0x1b9f0e(0x1e0))/0x1+-parseInt(_0x1b9f0e(0x248))/0x2+parseInt(_0x1b9f0e(0x210))/0x3+-parseInt(_0x1b9f0e(0x258))/0x4+-parseInt(_0x1b9f0e(0x25a))/0x5*(-parseInt(_0x1b9f0e(0x1ef))/0x6)+parseInt(_0x1b9f0e(0x238))/0x7+-parseInt(_0x1b9f0e(0x1e8))/0x8;if(_0x5e5f21===_0x35b763)break;else _0x22db40['push'](_0x22db40['shift']());}catch(_0x217a9c){_0x22db40['push'](_0x22db40['shift']());}}}(a0_0xdd34,0x6e359));import{readFileSync as a0_0x5eb03a,existsSync as a0_0x23b41a}from'fs';import{join as a0_0x451d9a}from'path';import{hostname as a0_0x51d750}from'os';import{execSync as a0_0x2588a6}from'child_process';import{Server as a0_0x296253}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x2087d1}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x5d884f,CallToolRequestSchema as a0_0x31c153}from'@modelcontextprotocol/sdk/types.js';function p(_0x27866b){const _0x21148f=a0_0x404e;if(!a0_0x23b41a(_0x27866b))return;for(let _0x377ffc of a0_0x5eb03a(_0x27866b,_0x21148f(0x1f9))[_0x21148f(0x253)]('\x0a')){let _0x29ee43=_0x377ffc[_0x21148f(0x1ea)]();if(!_0x29ee43||_0x29ee43[_0x21148f(0x1e3)]('#'))continue;let _0x2af5b2=_0x29ee43[_0x21148f(0x1ed)]('=');if(_0x2af5b2<0x0)continue;let _0x435644=_0x29ee43[_0x21148f(0x230)](0x0,_0x2af5b2)[_0x21148f(0x1ea)](),_0x6d1cea=_0x29ee43['slice'](_0x2af5b2+0x1)[_0x21148f(0x1ea)]()[_0x21148f(0x200)](/^["']|["']$/g,'');if(!process.env[_0x435644])process.env[_0x435644]=_0x6d1cea;}}var C=process.env.HOME||'~',T=a0_0x451d9a(C,'.claude/channels/commhub');p(a0_0x451d9a(T,a0_0x26a715(0x1db)));var L=process[a0_0x26a715(0x204)]()[a0_0x26a715(0x200)](/\//g,'-');p(a0_0x451d9a(T,L,'.env'));function U(){const _0x1a4b7d=a0_0x26a715;try{return a0_0x2588a6('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x1a4b7d(0x1f9),'timeout':0x7d0})['trim']();}catch{return'';}}function c(){const _0x4bbdce=a0_0x26a715;try{let _0x36235e=a0_0x451d9a(C,_0x4bbdce(0x1e6),_0x4bbdce(0x1fb));if(a0_0x23b41a(_0x36235e))return JSON[_0x4bbdce(0x242)](a0_0x5eb03a(_0x36235e,_0x4bbdce(0x1f9)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H['hub']||a0_0x26a715(0x223),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x51d750(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x26a715(0x21d)](),X=process.env.COMMHUB_TOKEN||H[a0_0x26a715(0x24f)]||'';function Y(_0xd203c5){const _0x513a93=a0_0x26a715;let _0x22a388=new Date()[_0x513a93(0x207)]()['slice'](0x0,0x8);process['stderr'][_0x513a93(0x1f4)]('['+_0x22a388+_0x513a93(0x213)+_0xd203c5+'\x0a');}function h(_0x579ccb){return new Promise(_0x4a64fc=>setTimeout(_0x4a64fc,_0x579ccb));}Y(a0_0x26a715(0x212)+D+a0_0x26a715(0x1f3)+Z+a0_0x26a715(0x21a)+w[a0_0x26a715(0x230)](0x0,0x8)+'...\x20TMUX='+(f||a0_0x26a715(0x245))+a0_0x26a715(0x24e)+process[a0_0x26a715(0x204)]()+a0_0x26a715(0x247)+L);var k=new Map(),K=new a0_0x296253({'name':'commhub-channel','version':a0_0x26a715(0x23b)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x26a715(0x1df),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x26a715(0x24d)+Z][a0_0x26a715(0x1e2)]('\x0a')});K[a0_0x26a715(0x237)](a0_0x5d884f,async()=>({'tools':[{'name':a0_0x26a715(0x1eb),'description':a0_0x26a715(0x244),'inputSchema':{'type':a0_0x26a715(0x202),'properties':{'task_id':{'type':'string','description':a0_0x26a715(0x206)},'text':{'type':a0_0x26a715(0x1f1),'description':a0_0x26a715(0x1ff)},'status':{'type':a0_0x26a715(0x1f1),'enum':[a0_0x26a715(0x22d),a0_0x26a715(0x226),a0_0x26a715(0x23a),a0_0x26a715(0x1e5),a0_0x26a715(0x23e),a0_0x26a715(0x24b)],'description':a0_0x26a715(0x1de)}},'required':[a0_0x26a715(0x257)]}},{'name':a0_0x26a715(0x241),'description':a0_0x26a715(0x225),'inputSchema':{'type':a0_0x26a715(0x202),'properties':{'status':{'type':a0_0x26a715(0x1f1),'enum':[a0_0x26a715(0x235),'idle',a0_0x26a715(0x1e5),a0_0x26a715(0x23e)]},'task':{'type':'string','description':'Current\x20task\x20description'},'progress':{'type':'number','description':a0_0x26a715(0x233)}},'required':[a0_0x26a715(0x1d9)]}},{'name':'commhub_send_task','description':a0_0x26a715(0x256),'inputSchema':{'type':a0_0x26a715(0x202),'properties':{'alias':{'type':'string','description':a0_0x26a715(0x229)},'task':{'type':a0_0x26a715(0x1f1),'description':a0_0x26a715(0x21e)},'priority':{'type':a0_0x26a715(0x1f1),'enum':['high','normal',a0_0x26a715(0x209)],'description':a0_0x26a715(0x23f)}},'required':[a0_0x26a715(0x1e4),a0_0x26a715(0x201)]}},{'name':'commhub_send_message','description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x26a715(0x1f1),'description':a0_0x26a715(0x229)},'message':{'type':'string','description':a0_0x26a715(0x1d7)}},'required':[a0_0x26a715(0x1e4),a0_0x26a715(0x1d8)]}},{'name':'commhub_get_all_status','description':a0_0x26a715(0x222),'inputSchema':{'type':a0_0x26a715(0x202),'properties':{}}}]}));async function P(_0x53d421,_0x244639){const _0x472bc4=a0_0x26a715;let _0x4badf2=await fetch(D+_0x472bc4(0x224),{'method':'POST','headers':{'Content-Type':_0x472bc4(0x1f2),'Accept':_0x472bc4(0x231),...X?{'Authorization':_0x472bc4(0x250)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x1,'method':_0x472bc4(0x1fc),'params':{'protocolVersion':_0x472bc4(0x218),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x472bc4(0x23b)}}})});if(!_0x4badf2['ok']){let _0x3c2966=await _0x4badf2['text']();return Y(_0x472bc4(0x1dc)+_0x4badf2['status']+'\x20'+_0x3c2966[_0x472bc4(0x230)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x4badf2['status']};}await _0x4badf2[_0x472bc4(0x257)]();let _0xffbc8d=(await(await fetch(D+_0x472bc4(0x224),{'method':'POST','headers':{'Content-Type':_0x472bc4(0x1f2),'Accept':_0x472bc4(0x231),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x472bc4(0x1ee)]({'jsonrpc':'2.0','id':0x2,'method':_0x472bc4(0x22c),'params':{'name':_0x53d421,'arguments':_0x244639}})}))[_0x472bc4(0x257)]())[_0x472bc4(0x253)]('\x0a')[_0x472bc4(0x215)](_0x5beaa7=>_0x5beaa7[_0x472bc4(0x1e3)](_0x472bc4(0x20e)));if(_0xffbc8d){let _0xfe8906=JSON['parse'](_0xffbc8d[_0x472bc4(0x230)](0x6));return _0xfe8906?.[_0x472bc4(0x236)]?.[_0x472bc4(0x1e1)]?.[0x0]?.['text']?JSON[_0x472bc4(0x242)](_0xfe8906[_0x472bc4(0x236)][_0x472bc4(0x1e1)][0x0][_0x472bc4(0x257)]):_0xfe8906;}return{'ok':!0x1,'error':_0x472bc4(0x217)};}K[a0_0x26a715(0x237)](a0_0x31c153,async _0x260b3a=>{const _0x1330ca=a0_0x26a715;let {name:_0x50e66f,arguments:_0x322b0f}=_0x260b3a[_0x1330ca(0x21c)];if(_0x50e66f===_0x1330ca(0x1eb)){let {task_id:_0x5813e5,text:_0x2b72ef,status:_0xf6a14d}=_0x322b0f;if(_0xf6a14d===_0x1330ca(0x22d)||_0xf6a14d===_0x1330ca(0x226)||_0xf6a14d===_0x1330ca(0x23a)){let _0x485818=_0xf6a14d===_0x1330ca(0x22d)?_0x1330ca(0x232):_0xf6a14d,_0x1c84e7=_0x5813e5?k[_0x1330ca(0x211)](_0x5813e5)||_0x1330ca(0x23c):_0x1330ca(0x23c),_0x2ae26a=await P(_0x1330ca(0x20b),{'alias':_0x1c84e7,'text':_0x2b72ef,'in_reply_to':_0x5813e5||void 0x0,'status':_0x485818,'from_session':Z});if(_0x5813e5)k['delete'](_0x5813e5);return{'content':[{'type':'text','text':JSON[_0x1330ca(0x1ee)](_0x2ae26a)}]};}let _0x229a43=await P(_0x1330ca(0x246),{'resume_id':w,'alias':Z,'status':_0xf6a14d===_0x1330ca(0x1e5)?_0x1330ca(0x1e5):_0xf6a14d===_0x1330ca(0x23e)?_0x1330ca(0x23e):'working','task':_0x2b72ef[_0x1330ca(0x230)](0x0,0xc8),'output':_0x2b72ef});return{'content':[{'type':_0x1330ca(0x257),'text':JSON[_0x1330ca(0x1ee)](_0x229a43)}]};}if(_0x50e66f===_0x1330ca(0x241)){let {status:_0x32f332,task:_0x274ce1,progress:_0xc74c04}=_0x322b0f,_0x2d4e90=await P(_0x1330ca(0x246),{'resume_id':w,'alias':Z,'status':_0x32f332,'task':_0x274ce1,'progress':_0xc74c04});return{'content':[{'type':'text','text':JSON['stringify'](_0x2d4e90)}]};}if(_0x50e66f===_0x1330ca(0x1f8)){let {alias:_0x115182,task:_0xcaac77,priority:_0x36a2ad}=_0x322b0f,_0xf13e60=await P('send_task',{'alias':_0x115182,'task':_0xcaac77,'priority':_0x36a2ad||_0x1330ca(0x203),'from_session':Z});return{'content':[{'type':_0x1330ca(0x257),'text':JSON[_0x1330ca(0x1ee)](_0xf13e60)}]};}if(_0x50e66f===_0x1330ca(0x23d)){let {alias:_0x2ed16b,message:_0x48a3df}=_0x322b0f,_0x5e4221=await P(_0x1330ca(0x24c),{'alias':_0x2ed16b,'message':_0x48a3df,'from_session':Z});return{'content':[{'type':_0x1330ca(0x257),'text':JSON[_0x1330ca(0x1ee)](_0x5e4221)}]};}if(_0x50e66f===_0x1330ca(0x240)){let _0x43a345=await P('get_all_status',{});return{'content':[{'type':_0x1330ca(0x257),'text':JSON[_0x1330ca(0x1ee)](_0x43a345)}]};}return{'content':[{'type':_0x1330ca(0x257),'text':JSON[_0x1330ca(0x1ee)]({'error':_0x1330ca(0x1da)})}]};});async function v(){const _0x3532e0=a0_0x26a715;let _0x267ea4=D+_0x3532e0(0x251)+encodeURIComponent(Z),_0x570c73={};if(X)_0x570c73['Authorization']=_0x3532e0(0x250)+X;Y(_0x3532e0(0x21b)+_0x267ea4);while(!0x0){try{let _0x193f66=await fetch(_0x267ea4,{'headers':_0x570c73});if(!_0x193f66['ok']){Y(_0x3532e0(0x1fe)+_0x193f66[_0x3532e0(0x1d9)]+'\x20'+_0x193f66[_0x3532e0(0x259)]),await h(0x1388);continue;}let _0x20a4ae=_0x193f66[_0x3532e0(0x221)]['getReader'](),_0x2fb22b=new TextDecoder(),_0x1e0f4e='';while(!0x0){let {done:_0x4481f7,value:_0x262e58}=await _0x20a4ae[_0x3532e0(0x255)]();if(_0x4481f7)break;_0x1e0f4e+=_0x2fb22b['decode'](_0x262e58,{'stream':!0x0});let _0x48f97e=_0x1e0f4e['split']('\x0a\x0a');_0x1e0f4e=_0x48f97e['pop']()||'';for(let _0x494ebf of _0x48f97e){let _0x306c15=_0x494ebf[_0x3532e0(0x253)]('\x0a')[_0x3532e0(0x215)](_0x4e4f0c=>_0x4e4f0c[_0x3532e0(0x1e3)]('data:\x20'));if(!_0x306c15)continue;try{let _0x7f007a=JSON['parse'](_0x306c15['slice'](0x6));await u(_0x7f007a);}catch(_0x25a917){Y('parse\x20error:\x20'+_0x25a917);}}}Y(_0x3532e0(0x220));}catch(_0x55e241){Y(_0x3532e0(0x234)+_0x55e241);}await h(0xbb8);}}async function u(_0x5b7024){const _0x535ef8=a0_0x26a715;if(_0x5b7024[_0x535ef8(0x24a)]===_0x535ef8(0x208)){Y(_0x535ef8(0x239)+Z+'\x22');return;}if(_0x5b7024[_0x535ef8(0x24a)]===_0x535ef8(0x228)){if(Y('←\x20message\x20from\x20'+_0x5b7024[_0x535ef8(0x1f5)]+':\x20'+_0x5b7024['message'][_0x535ef8(0x230)](0x0,0x3c)),await K[_0x535ef8(0x22a)]({'method':_0x535ef8(0x1dd),'params':{'content':_0x5b7024[_0x535ef8(0x1d8)],'meta':{'sender':_0x5b7024['from']||'hub','sender_id':_0x535ef8(0x21f),'user':_0x5b7024[_0x535ef8(0x1f5)]||'hub','priority':_0x535ef8(0x203)}}}),_0x5b7024[_0x535ef8(0x219)])await P(_0x535ef8(0x216),{'alias':Z,'message_id':_0x5b7024['message_id']});return;}if(_0x5b7024[_0x535ef8(0x24a)]===_0x535ef8(0x1f7)||_0x5b7024['type']===_0x535ef8(0x20a)){Y('←\x20'+_0x5b7024['type']+_0x535ef8(0x205)+_0x5b7024[_0x535ef8(0x22f)]+'\x20priority='+(_0x5b7024[_0x535ef8(0x20c)]||_0x535ef8(0x203)));let _0x2645d6=await P(_0x535ef8(0x252),{'alias':Z,'limit':0x5});if(_0x2645d6?.['ok']&&_0x2645d6[_0x535ef8(0x1e9)]?.['length']>0x0)for(let _0x1e654e of _0x2645d6[_0x535ef8(0x1e9)]){let _0x1ec5c7={'sender':_0x1e654e[_0x535ef8(0x1e7)]||_0x535ef8(0x23c),'sender_id':'commhub','user':_0x1e654e[_0x535ef8(0x1e7)]||'hub','task_id':_0x1e654e['id'],'priority':_0x1e654e[_0x535ef8(0x20c)]||_0x535ef8(0x203)};k['set'](_0x1e654e['id'],_0x1e654e['from_session']||_0x535ef8(0x23c)),await K[_0x535ef8(0x22a)]({'method':_0x535ef8(0x1dd),'params':{'content':_0x1e654e['content'],'meta':_0x1ec5c7}}),Y('→\x20injected\x20task\x20'+_0x1e654e['id'][_0x535ef8(0x230)](0x0,0x8)+_0x535ef8(0x20f)+_0x1e654e[_0x535ef8(0x1e7)]+':\x20'+_0x1e654e[_0x535ef8(0x1e1)][_0x535ef8(0x230)](0x0,0x3c)),await P(_0x535ef8(0x216),{'alias':Z,'message_id':_0x1e654e['id']});}}}async function S(){const _0xe35416=a0_0x26a715;let _0x1cb90f=new a0_0x2087d1();await K[_0xe35416(0x22e)](_0x1cb90f),Y(_0xe35416(0x22b)),Y('starting\x20SSE\x20listener...'),v()[_0xe35416(0x1fd)](_0x172d50=>Y('SSE\x20fatal:\x20'+_0x172d50)),P('report_status',{'resume_id':w,'alias':Z,'status':_0xe35416(0x214),'server':a0_0x51d750(),'hostname':a0_0x51d750(),'agent':'claude-code','project_dir':process[_0xe35416(0x204)](),'tmux_name':f||void 0x0})[_0xe35416(0x254)](()=>Y(_0xe35416(0x1f6)+Z+_0xe35416(0x1f0)+w['slice'](0x0,0x8)+')'))['catch'](_0x1d51eb=>Y('warning:\x20could\x20not\x20register:\x20'+_0x1d51eb)),setInterval(()=>{const _0x5f051b=_0xe35416;P(_0x5f051b(0x246),{'resume_id':w,'alias':Z,'status':_0x5f051b(0x214),'server':a0_0x51d750(),'hostname':a0_0x51d750(),'agent':'claude-code','project_dir':process[_0x5f051b(0x204)](),'tmux_name':f||void 0x0})[_0x5f051b(0x1fd)](_0x3f608b=>Y(_0x5f051b(0x243)+_0x3f608b));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}S()[a0_0x26a715(0x1fd)](_0x2e2155=>{const _0x44d682=a0_0x26a715;Y('fatal:\x20'+_0x2e2155),process[_0x44d682(0x20d)](0x1);});async function N(){const _0x67cb59=a0_0x26a715;Y(_0x67cb59(0x227)),await P(_0x67cb59(0x246),{'resume_id':w,'alias':Z,'status':_0x67cb59(0x23e),'task':_0x67cb59(0x1ec)})[_0x67cb59(0x1fd)](()=>{}),process['exit'](0x0);}function a0_0x404e(_0xa2cab7,_0x1f17cc){_0xa2cab7=_0xa2cab7-0x1d7;const _0xdd343b=a0_0xdd34();let _0x404e7c=_0xdd343b[_0xa2cab7];return _0x404e7c;}function a0_0xdd34(){const _0x193b8f=['.env','CommHub\x20init\x20failed:\x20','notifications/claude/channel','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','190641WnsZWd','content','join','startsWith','alias','blocked','.anet','from_session','1796216YPAJYP','messages','trim','commhub_reply','session\x20disconnected','indexOf','stringify','564ktTkif','\x22\x20(','string','application/json','\x20ALIAS=','write','from','registered\x20as\x20\x22','new_task','commhub_send_task','utf-8','end','config.json','initialize','catch','SSE\x20error:\x20','Reply\x20text\x20/\x20result\x20summary','replace','task','object','normal','cwd',':\x20inbox_count=','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','toTimeString','connected','low','broadcast','send_reply','priority','exit','data:\x20','\x20from\x20','2138007tzUDvp','get','ENV:\x20URL=',']\x20[commhub]\x20','idle','find','ack_inbox','no\x20response','2025-03-26','message_id','\x20RESUME_ID=','connecting\x20to\x20','params','randomUUID','Task\x20content','commhub','SSE\x20stream\x20ended,\x20reconnecting...','body','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','http://127.0.0.1:9200','/mcp','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','failed','shutting\x20down,\x20reporting\x20offline...','new_message','Target\x20session\x20alias','notification','MCP\x20stdio\x20connected','tools/call','completed','connect','inbox_count','slice','application/json,\x20text/event-stream','replied','Progress\x200-100','SSE\x20connection\x20error:\x20','working','result','setRequestHandler','1996078qzfmTJ','SSE\x20connected\x20as\x20\x22','cancelled','0.3.0','hub','commhub_send_message','error','Priority\x20(default:\x20normal)','commhub_get_all_status','commhub_report_status','parse','heartbeat\x20failed:\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','none','report_status','\x20PROJECT_ENV=','110894PtwVHm','stdin','type','in_progress','send_message','Session\x20alias:\x20','\x20CWD=','token','Bearer\x20','/events/','get_inbox','split','then','read','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','text','645700HWVJqc','statusText','4555VfQGYo','Message\x20content','message','status','unknown\x20tool'];a0_0xdd34=function(){return _0x193b8f;};return a0_0xdd34();}process[a0_0x26a715(0x249)]['on'](a0_0x26a715(0x1fa),()=>N()),process['on']('SIGTERM',()=>N()),process['on']('SIGINT',()=>N());
|
|
2
|
+
const a0_0x4e1363=a0_0x4e77;function a0_0x456f(){const _0x2c11e1=['normal','28IbEOke','heartbeat\x20failed:\x20','statusText','setRequestHandler','connected','getReader','2025-03-26','connect','write','connecting\x20to\x20','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','\x22\x20(','claude-code','content','Priority\x20(default:\x20normal)','priority','ready\x20—\x20waiting\x20for\x20events','SSE\x20error:\x20','/events/','SIGINT','failed','ENV:\x20URL=','get','SIGTERM','...\x20TMUX=','Bearer\x20','stringify','commhub_report_status','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','fatal:\x20','params','commhub-channel','stdin','787659cUvdCI','low','starting\x20SSE\x20listener...','6039512LulTEe','send_task','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','task','\x20from\x20','replace','send_reply','SSE\x20connected\x20as\x20\x22','7vsLCBj','11LdSnGC','parse','application/json','catch','type','MCP\x20stdio\x20connected','join','commhub','Current\x20task\x20description','message_id','parse\x20error:\x20','6678570rkhRZX','tools/call','Reply\x20text\x20/\x20result\x20summary','application/json,\x20text/event-stream','commhub_send_message','idle','ack_inbox','.anet','string','SSE\x20stream\x20ended,\x20reconnecting...','text','startsWith','get_all_status','685318qSWynh','15991310wWiFpD','0.3.0','notifications/claude/channel','delete','error','9yTPvXq','message','\x20ALIAS=','warning:\x20could\x20not\x20register:\x20','SSE\x20fatal:\x20','body','unknown\x20tool','blocked','indexOf','session\x20disconnected','alias','cancelled','http://127.0.0.1:9200','commhub_send_task','\x20PROJECT_ENV=','report_status','.claude/channels/commhub','randomUUID','Target\x20session\x20alias','6404412noOdTH','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','new_message','object','registered\x20as\x20\x22','high','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','working','inbox_count','commhub_get_all_status','shutting\x20down,\x20reporting\x20offline...','trim','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','1PILBAY','hub','\x20RESUME_ID=','token','Message\x20content','pop','Authorization','/mcp','completed','then','set','status','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','messages','Task\x20content','utf-8','1219065ignqLL','exit','←\x20message\x20from\x20','SSE\x20connection\x20error:\x20','POST','cwd',']\x20[commhub]\x20','commhub_reply','from_session','init\x20failed:\x20','end','2.0','from','\x20CWD=','data:\x20','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','toTimeString','decode','.env','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Session\x20alias:\x20','no\x20response','slice','split','send_message'];a0_0x456f=function(){return _0x2c11e1;};return a0_0x456f();}(function(_0x272c0f,_0x5ba71e){const _0x200394=a0_0x4e77,_0x2438f0=_0x272c0f();while(!![]){try{const _0x1a9f02=parseInt(_0x200394(0x107))/0x1*(parseInt(_0x200394(0xe1))/0x2)+-parseInt(_0x200394(0xbd))/0x3+-parseInt(_0x200394(0x131))/0x4*(parseInt(_0x200394(0x117))/0x5)+-parseInt(_0x200394(0xd4))/0x6*(-parseInt(_0x200394(0xc8))/0x7)+parseInt(_0x200394(0xc0))/0x8*(-parseInt(_0x200394(0xe7))/0x9)+parseInt(_0x200394(0xe2))/0xa*(parseInt(_0x200394(0xc9))/0xb)+parseInt(_0x200394(0xfa))/0xc;if(_0x1a9f02===_0x5ba71e)break;else _0x2438f0['push'](_0x2438f0['shift']());}catch(_0x531991){_0x2438f0['push'](_0x2438f0['shift']());}}}(a0_0x456f,0xd3093));import{readFileSync as a0_0x291ebd,existsSync as a0_0x26e049}from'fs';import{join as a0_0x361a6f}from'path';import{hostname as a0_0x2263d7}from'os';import{execSync as a0_0x32a8cd}from'child_process';import{Server as a0_0x388b3f}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x3b6b49}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x4af942,CallToolRequestSchema as a0_0x4dd893}from'@modelcontextprotocol/sdk/types.js';function p(_0x561e91){const _0x180615=a0_0x4e77;if(!a0_0x26e049(_0x561e91))return;for(let _0x285fdf of a0_0x291ebd(_0x561e91,_0x180615(0x116))[_0x180615(0x12e)]('\x0a')){let _0x280d53=_0x285fdf[_0x180615(0x105)]();if(!_0x280d53||_0x280d53['startsWith']('#'))continue;let _0x46c035=_0x280d53[_0x180615(0xef)]('=');if(_0x46c035<0x0)continue;let _0x358a94=_0x280d53[_0x180615(0x12d)](0x0,_0x46c035)[_0x180615(0x105)](),_0x2cf110=_0x280d53[_0x180615(0x12d)](_0x46c035+0x1)['trim']()['replace'](/^["']|["']$/g,'');if(!process.env[_0x358a94])process.env[_0x358a94]=_0x2cf110;}}var C=process.env.HOME||'~',T=a0_0x361a6f(C,a0_0x4e1363(0xf7));p(a0_0x361a6f(T,a0_0x4e1363(0x129)));var L=process[a0_0x4e1363(0x11c)]()[a0_0x4e1363(0xc5)](/\//g,'-');p(a0_0x361a6f(T,L,a0_0x4e1363(0x129)));function U(){const _0x2a8eb2=a0_0x4e1363;try{return a0_0x32a8cd('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x2a8eb2(0x116),'timeout':0x7d0})[_0x2a8eb2(0x105)]();}catch{return'';}}function c(){const _0x5258a3=a0_0x4e1363;try{let _0x546010=a0_0x361a6f(C,_0x5258a3(0xdb),'config.json');if(a0_0x26e049(_0x546010))return JSON[_0x5258a3(0xca)](a0_0x291ebd(_0x546010,_0x5258a3(0x116)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x4e1363(0x108)]||a0_0x4e1363(0xf3),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x2263d7(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x4e1363(0xf8)](),X=process.env.COMMHUB_TOKEN||H[a0_0x4e1363(0x10a)]||'';function Y(_0x1f2c65){const _0x5dc750=a0_0x4e1363;let _0x36d00d=new Date()[_0x5dc750(0x127)]()[_0x5dc750(0x12d)](0x0,0x8);process['stderr'][_0x5dc750(0x139)]('['+_0x36d00d+_0x5dc750(0x11d)+_0x1f2c65+'\x0a');}function h(_0xadd6ff){return new Promise(_0x19840e=>setTimeout(_0x19840e,_0xadd6ff));}Y(a0_0x4e1363(0xb1)+D+a0_0x4e1363(0xe9)+Z+a0_0x4e1363(0x109)+w[a0_0x4e1363(0x12d)](0x0,0x8)+a0_0x4e1363(0xb4)+(f||'none')+a0_0x4e1363(0x124)+process[a0_0x4e1363(0x11c)]()+a0_0x4e1363(0xf5)+L);var k=new Map(),K=new a0_0x388b3f({'name':a0_0x4e1363(0xbb),'version':a0_0x4e1363(0xe3)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':['Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>',a0_0x4e1363(0xfb),a0_0x4e1363(0x113),a0_0x4e1363(0x12a),a0_0x4e1363(0x12b)+Z][a0_0x4e1363(0xcf)]('\x0a')});K[a0_0x4e1363(0x134)](a0_0x4af942,async()=>({'tools':[{'name':a0_0x4e1363(0x11e),'description':a0_0x4e1363(0xc2),'inputSchema':{'type':a0_0x4e1363(0xfd),'properties':{'task_id':{'type':'string','description':a0_0x4e1363(0x126)},'text':{'type':'string','description':a0_0x4e1363(0xd6)},'status':{'type':a0_0x4e1363(0xdc),'enum':['completed',a0_0x4e1363(0x145),'cancelled',a0_0x4e1363(0xee),a0_0x4e1363(0xe6),'in_progress'],'description':a0_0x4e1363(0xb8)}},'required':[a0_0x4e1363(0xde)]}},{'name':a0_0x4e1363(0xb7),'description':a0_0x4e1363(0x13b),'inputSchema':{'type':a0_0x4e1363(0xfd),'properties':{'status':{'type':a0_0x4e1363(0xdc),'enum':[a0_0x4e1363(0x101),'idle','blocked',a0_0x4e1363(0xe6)]},'task':{'type':a0_0x4e1363(0xdc),'description':a0_0x4e1363(0xd1)},'progress':{'type':'number','description':'Progress\x200-100'}},'required':[a0_0x4e1363(0x112)]}},{'name':a0_0x4e1363(0xf4),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x4e1363(0xfd),'properties':{'alias':{'type':a0_0x4e1363(0xdc),'description':a0_0x4e1363(0xf9)},'task':{'type':'string','description':a0_0x4e1363(0x115)},'priority':{'type':a0_0x4e1363(0xdc),'enum':[a0_0x4e1363(0xff),a0_0x4e1363(0x130),a0_0x4e1363(0xbe)],'description':a0_0x4e1363(0x13f)}},'required':[a0_0x4e1363(0xf1),a0_0x4e1363(0xc3)]}},{'name':a0_0x4e1363(0xd8),'description':a0_0x4e1363(0x100),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x4e1363(0xdc),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x4e1363(0xdc),'description':a0_0x4e1363(0x10b)}},'required':[a0_0x4e1363(0xf1),a0_0x4e1363(0xe8)]}},{'name':a0_0x4e1363(0x103),'description':a0_0x4e1363(0x106),'inputSchema':{'type':'object','properties':{}}}]}));function a0_0x4e77(_0x3d531d,_0x4c3341){_0x3d531d=_0x3d531d-0xb1;const _0x456fff=a0_0x456f();let _0x4e77e0=_0x456fff[_0x3d531d];return _0x4e77e0;}async function P(_0x45dabe,_0xd834bf){const _0x1eafc0=a0_0x4e1363;let _0x226e44=await fetch(D+_0x1eafc0(0x10e),{'method':'POST','headers':{'Content-Type':_0x1eafc0(0xcb),'Accept':_0x1eafc0(0xd7),...X?{'Authorization':_0x1eafc0(0xb5)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x1eafc0(0x122),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x1eafc0(0x137),'capabilities':{},'clientInfo':{'name':_0x1eafc0(0xbb),'version':_0x1eafc0(0xe3)}}})});if(!_0x226e44['ok']){let _0x41f5c1=await _0x226e44['text']();return Y('CommHub\x20init\x20failed:\x20'+_0x226e44[_0x1eafc0(0x112)]+'\x20'+_0x41f5c1['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x1eafc0(0x120)+_0x226e44['status']};}await _0x226e44[_0x1eafc0(0xde)]();let _0x17862f=(await(await fetch(D+'/mcp',{'method':_0x1eafc0(0x11b),'headers':{'Content-Type':_0x1eafc0(0xcb),'Accept':_0x1eafc0(0xd7),...X?{'Authorization':_0x1eafc0(0xb5)+X}:{}},'body':JSON[_0x1eafc0(0xb6)]({'jsonrpc':_0x1eafc0(0x122),'id':0x2,'method':_0x1eafc0(0xd5),'params':{'name':_0x45dabe,'arguments':_0xd834bf}})}))[_0x1eafc0(0xde)]())[_0x1eafc0(0x12e)]('\x0a')['find'](_0x10dd5b=>_0x10dd5b[_0x1eafc0(0xdf)]('data:\x20'));if(_0x17862f){let _0x47b37f=JSON['parse'](_0x17862f[_0x1eafc0(0x12d)](0x6));return _0x47b37f?.['result']?.[_0x1eafc0(0x13e)]?.[0x0]?.[_0x1eafc0(0xde)]?JSON[_0x1eafc0(0xca)](_0x47b37f['result'][_0x1eafc0(0x13e)][0x0][_0x1eafc0(0xde)]):_0x47b37f;}return{'ok':!0x1,'error':_0x1eafc0(0x12c)};}K[a0_0x4e1363(0x134)](a0_0x4dd893,async _0x3e2268=>{const _0x49643d=a0_0x4e1363;let {name:_0x3d7a4f,arguments:_0x356f71}=_0x3e2268[_0x49643d(0xba)];if(_0x3d7a4f===_0x49643d(0x11e)){let {task_id:_0x444a7,text:_0x40e0f0,status:_0x203139}=_0x356f71;if(_0x203139===_0x49643d(0x10f)||_0x203139===_0x49643d(0x145)||_0x203139===_0x49643d(0xf2)){let _0x12f7b8=_0x203139===_0x49643d(0x10f)?'replied':_0x203139,_0x329139=_0x444a7?k[_0x49643d(0xb2)](_0x444a7)||_0x49643d(0x108):'hub',_0x5d6018=await P(_0x49643d(0xc6),{'alias':_0x329139,'text':_0x40e0f0,'in_reply_to':_0x444a7||void 0x0,'status':_0x12f7b8,'from_session':Z});if(_0x444a7)k[_0x49643d(0xe5)](_0x444a7);return{'content':[{'type':_0x49643d(0xde),'text':JSON[_0x49643d(0xb6)](_0x5d6018)}]};}let _0x1ca2b3=await P(_0x49643d(0xf6),{'resume_id':w,'alias':Z,'status':_0x203139===_0x49643d(0xee)?_0x49643d(0xee):_0x203139===_0x49643d(0xe6)?'error':_0x49643d(0x101),'task':_0x40e0f0[_0x49643d(0x12d)](0x0,0xc8),'output':_0x40e0f0});return{'content':[{'type':'text','text':JSON[_0x49643d(0xb6)](_0x1ca2b3)}]};}if(_0x3d7a4f===_0x49643d(0xb7)){let {status:_0x403cc4,task:_0x4dad67,progress:_0x1df387}=_0x356f71,_0x3ee735=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x403cc4,'task':_0x4dad67,'progress':_0x1df387});return{'content':[{'type':_0x49643d(0xde),'text':JSON['stringify'](_0x3ee735)}]};}if(_0x3d7a4f===_0x49643d(0xf4)){let {alias:_0x2081cd,task:_0x34a7f7,priority:_0x511921}=_0x356f71,_0x4f3a2b=await P(_0x49643d(0xc1),{'alias':_0x2081cd,'task':_0x34a7f7,'priority':_0x511921||_0x49643d(0x130),'from_session':Z});return{'content':[{'type':_0x49643d(0xde),'text':JSON[_0x49643d(0xb6)](_0x4f3a2b)}]};}if(_0x3d7a4f===_0x49643d(0xd8)){let {alias:_0x5b961d,message:_0x2cbf43}=_0x356f71,_0x28367=await P(_0x49643d(0x12f),{'alias':_0x5b961d,'message':_0x2cbf43,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x49643d(0xb6)](_0x28367)}]};}if(_0x3d7a4f==='commhub_get_all_status'){let _0x5c125a=await P(_0x49643d(0xe0),{});return{'content':[{'type':'text','text':JSON[_0x49643d(0xb6)](_0x5c125a)}]};}return{'content':[{'type':'text','text':JSON[_0x49643d(0xb6)]({'error':_0x49643d(0xed)})}]};});async function v(){const _0x113900=a0_0x4e1363;let _0x1f077e=D+_0x113900(0x143)+encodeURIComponent(Z),_0x157407={};if(X)_0x157407[_0x113900(0x10d)]=_0x113900(0xb5)+X;Y(_0x113900(0x13a)+_0x1f077e);while(!0x0){try{let _0x5a1bee=await fetch(_0x1f077e,{'headers':_0x157407});if(!_0x5a1bee['ok']){Y(_0x113900(0x142)+_0x5a1bee[_0x113900(0x112)]+'\x20'+_0x5a1bee[_0x113900(0x133)]),await h(0x1388);continue;}let _0xf3d65a=_0x5a1bee[_0x113900(0xec)][_0x113900(0x136)](),_0x397f0d=new TextDecoder(),_0xc43d81='';while(!0x0){let {done:_0x18bc6e,value:_0x402067}=await _0xf3d65a['read']();if(_0x18bc6e)break;_0xc43d81+=_0x397f0d[_0x113900(0x128)](_0x402067,{'stream':!0x0});let _0x58c979=_0xc43d81[_0x113900(0x12e)]('\x0a\x0a');_0xc43d81=_0x58c979[_0x113900(0x10c)]()||'';for(let _0x4e9fad of _0x58c979){let _0x1b603e=_0x4e9fad[_0x113900(0x12e)]('\x0a')['find'](_0x410602=>_0x410602[_0x113900(0xdf)](_0x113900(0x125)));if(!_0x1b603e)continue;try{let _0x12bc4d=JSON[_0x113900(0xca)](_0x1b603e[_0x113900(0x12d)](0x6));await u(_0x12bc4d);}catch(_0x76993){Y(_0x113900(0xd3)+_0x76993);}}}Y(_0x113900(0xdd));}catch(_0xb1598b){Y(_0x113900(0x11a)+_0xb1598b);}await h(0xbb8);}}async function u(_0x438a52){const _0x4b6326=a0_0x4e1363;if(_0x438a52['type']===_0x4b6326(0x135)){Y(_0x4b6326(0xc7)+Z+'\x22');return;}if(_0x438a52[_0x4b6326(0xcd)]===_0x4b6326(0xfc)){if(Y(_0x4b6326(0x119)+_0x438a52[_0x4b6326(0x123)]+':\x20'+_0x438a52[_0x4b6326(0xe8)][_0x4b6326(0x12d)](0x0,0x3c)),await K['notification']({'method':_0x4b6326(0xe4),'params':{'content':_0x438a52['message'],'meta':{'sender':_0x438a52[_0x4b6326(0x123)]||_0x4b6326(0x108),'sender_id':_0x4b6326(0xd0),'user':_0x438a52['from']||_0x4b6326(0x108),'priority':_0x4b6326(0x130)}}}),_0x438a52[_0x4b6326(0xd2)])await P(_0x4b6326(0xda),{'alias':Z,'message_id':_0x438a52[_0x4b6326(0xd2)]});return;}if(_0x438a52[_0x4b6326(0xcd)]==='new_task'||_0x438a52[_0x4b6326(0xcd)]==='broadcast'){Y('←\x20'+_0x438a52[_0x4b6326(0xcd)]+':\x20inbox_count='+_0x438a52[_0x4b6326(0x102)]+'\x20priority='+(_0x438a52[_0x4b6326(0x140)]||_0x4b6326(0x130)));let _0x2421a2=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x2421a2?.['ok']&&_0x2421a2[_0x4b6326(0x114)]?.['length']>0x0)for(let _0x33b897 of _0x2421a2['messages']){let _0x4c9dc1={'sender':_0x33b897[_0x4b6326(0x11f)]||_0x4b6326(0x108),'sender_id':_0x4b6326(0xd0),'user':_0x33b897[_0x4b6326(0x11f)]||_0x4b6326(0x108),'task_id':_0x33b897['id'],'priority':_0x33b897[_0x4b6326(0x140)]||_0x4b6326(0x130)};k[_0x4b6326(0x111)](_0x33b897['id'],_0x33b897[_0x4b6326(0x11f)]||_0x4b6326(0x108)),await K['notification']({'method':'notifications/claude/channel','params':{'content':_0x33b897['content'],'meta':_0x4c9dc1}}),Y('→\x20injected\x20task\x20'+_0x33b897['id'][_0x4b6326(0x12d)](0x0,0x8)+_0x4b6326(0xc4)+_0x33b897[_0x4b6326(0x11f)]+':\x20'+_0x33b897[_0x4b6326(0x13e)][_0x4b6326(0x12d)](0x0,0x3c)),await P(_0x4b6326(0xda),{'alias':Z,'message_id':_0x33b897['id']});}}}async function S(){const _0x3a7a0b=a0_0x4e1363;let _0x75a7e9=new a0_0x3b6b49();await K[_0x3a7a0b(0x138)](_0x75a7e9),Y(_0x3a7a0b(0xce)),Y(_0x3a7a0b(0xbf)),v()[_0x3a7a0b(0xcc)](_0x5618f2=>Y(_0x3a7a0b(0xeb)+_0x5618f2)),P('report_status',{'resume_id':w,'alias':Z,'status':_0x3a7a0b(0xd9),'server':a0_0x2263d7(),'hostname':a0_0x2263d7(),'agent':_0x3a7a0b(0x13d),'project_dir':process[_0x3a7a0b(0x11c)](),'tmux_name':f||void 0x0})[_0x3a7a0b(0x110)](()=>Y(_0x3a7a0b(0xfe)+Z+_0x3a7a0b(0x13c)+w[_0x3a7a0b(0x12d)](0x0,0x8)+')'))[_0x3a7a0b(0xcc)](_0x1d7e79=>Y(_0x3a7a0b(0xea)+_0x1d7e79)),setInterval(()=>{const _0x409001=_0x3a7a0b;P(_0x409001(0xf6),{'resume_id':w,'alias':Z,'status':_0x409001(0xd9),'server':a0_0x2263d7(),'hostname':a0_0x2263d7(),'agent':_0x409001(0x13d),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})['catch'](_0x4fae1b=>Y(_0x409001(0x132)+_0x4fae1b));},0x2bf20),Y(_0x3a7a0b(0x141));}S()[a0_0x4e1363(0xcc)](_0x34e073=>{const _0x1a3fb7=a0_0x4e1363;Y(_0x1a3fb7(0xb9)+_0x34e073),process[_0x1a3fb7(0x118)](0x1);});async function N(){const _0x50de80=a0_0x4e1363;Y(_0x50de80(0x104)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x50de80(0xe6),'task':_0x50de80(0xf0)})[_0x50de80(0xcc)](()=>{}),process['exit'](0x0);}process[a0_0x4e1363(0xbc)]['on'](a0_0x4e1363(0x121),()=>N()),process['on'](a0_0x4e1363(0xb3),()=>N()),process['on'](a0_0x4e1363(0x144),()=>N());
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.0.0-preview.
|
|
4
|
-
"description": "AI Agent Network
|
|
3
|
+
"version": "2.0.0-preview.50",
|
|
4
|
+
"description": "AI Agent Network CLI \u2014 Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 39 commands.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|
|
7
7
|
"types": "dist/client.d.ts",
|
|
@@ -31,18 +31,20 @@
|
|
|
31
31
|
"mcp",
|
|
32
32
|
"sse",
|
|
33
33
|
"claude",
|
|
34
|
+
"codex",
|
|
34
35
|
"openai",
|
|
35
36
|
"minimax",
|
|
36
37
|
"orchestration",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"multi-agent",
|
|
39
|
+
"cli",
|
|
40
|
+
"anet"
|
|
40
41
|
],
|
|
41
42
|
"author": "sleep2agi",
|
|
42
43
|
"license": "MIT",
|
|
44
|
+
"homepage": "https://anet.vansin.me",
|
|
43
45
|
"repository": {
|
|
44
46
|
"type": "git",
|
|
45
|
-
"url": "https://github.com/sleep2agi/agent-
|
|
47
|
+
"url": "https://github.com/sleep2agi/agent-network",
|
|
46
48
|
"directory": "agent-network"
|
|
47
49
|
},
|
|
48
50
|
"engines": {
|
|
@@ -57,4 +59,4 @@
|
|
|
57
59
|
"node-pty": "^1.1.0",
|
|
58
60
|
"typescript": "^5.0.0"
|
|
59
61
|
}
|
|
60
|
-
}
|
|
62
|
+
}
|