@sleep2agi/agent-network 2.1.15-preview.6 → 2.1.15
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/dist/bin/cli.js +1 -1
- package/dist/src/client.js +1 -1
- package/dist/src/node-server.js +1 -1
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x1858ed=a0_0xf662;(function(_0x4ccd03,_0x274419){const _0x29fbf2=a0_0xf662,_0x4b34fd=_0x4ccd03();while(!![]){try{const _0xb43a7b=-parseInt(_0x29fbf2(0x175))/0x1*(parseInt(_0x29fbf2(0x17e))/0x2)+parseInt(_0x29fbf2(0x1a1))/0x3+parseInt(_0x29fbf2(0x176))/0x4+parseInt(_0x29fbf2(0x1b2))/0x5+-parseInt(_0x29fbf2(0x197))/0x6*(-parseInt(_0x29fbf2(0x16c))/0x7)+parseInt(_0x29fbf2(0x1b5))/0x8*(parseInt(_0x29fbf2(0x185))/0x9)+parseInt(_0x29fbf2(0x17b))/0xa*(-parseInt(_0x29fbf2(0x1b6))/0xb);if(_0xb43a7b===_0x274419)break;else _0x4b34fd['push'](_0x4b34fd['shift']());}catch(_0x1afec2){_0x4b34fd['push'](_0x4b34fd['shift']());}}}(a0_0x5abd,0xa2b81));import{EventEmitter as a0_0x4d4689}from'events';import{hostname as a0_0x52aced}from'os';function a0_0xf662(_0x28df68,_0xe49c9a){_0x28df68=_0x28df68-0x166;const _0x5abd93=a0_0x5abd();let _0xf66281=_0x5abd93[_0x28df68];return _0xf66281;}function a0_0x5abd(){const _0x5ad939=['application/json,\x20text/event-stream','heartbeat\x20failed:\x20','parse','message','disconnect','Bearer\x20','get_inbox','idle','toString','pop','call','3401080FkOfeO','SSE\x20failed:\x20','type','464kVLXQp','341mDImek','running','resumeId',']\x20[commhub:','normal','token','inbox\x20error:\x20','new_task','emit','SSE\x20error:\x20','error','322HgCPHt','now','result','connect','signal','processInbox','2.0','body','completed','35254WBzbJm','364020IgbMrc','reconnectDelay','sdk-','get_all_status','server','555740pUpJxI','getAllStatus','data:\x20','10RdPVyb','broadcast','toTimeString','connected','cwd','heartbeatInterval','messages','57123skEEKO','name','agent','send_task','slice','text/event-stream','log','send_message','new_message','read','sseAbort','stringify','alias','send_reply','content','heartbeatTimer','startsWith','min','48318iTkYTa','match','/events/','text','getReader','application/json','AbortError','sleep','connectSSE','ack_inbox','3167328uEnnQg','disconnected','status','catch','decode','url'];a0_0x5abd=function(){return _0x5ad939;};return a0_0x5abd();}class T extends a0_0x4d4689{[a0_0x1858ed(0x1a6)];[a0_0x1858ed(0x191)];['token'];[a0_0x1858ed(0x187)];['resumeId'];[a0_0x1858ed(0x183)];[a0_0x1858ed(0x177)];[a0_0x1858ed(0x194)];[a0_0x1858ed(0x18f)];['running']=!0x1;constructor(_0x246ec6){const _0x23c0b9=a0_0x1858ed;super();if(this[_0x23c0b9(0x1a6)]=_0x246ec6[_0x23c0b9(0x1a6)]['replace'](/\/$/,''),this[_0x23c0b9(0x191)]=_0x246ec6[_0x23c0b9(0x191)],this['token']=_0x246ec6[_0x23c0b9(0x166)],this[_0x23c0b9(0x187)]=_0x246ec6[_0x23c0b9(0x187)]||'sdk',this[_0x23c0b9(0x1b8)]=_0x23c0b9(0x178)+_0x246ec6[_0x23c0b9(0x191)]+'-'+Date['now']()[_0x23c0b9(0x1af)](0x24),this[_0x23c0b9(0x183)]=_0x246ec6[_0x23c0b9(0x183)]??0x2bf20,this[_0x23c0b9(0x177)]=_0x246ec6['reconnectDelay']??0xbb8,_0x246ec6['autoConnect']!==!0x1)this[_0x23c0b9(0x16f)]();}[a0_0x1858ed(0x18b)](_0x7ac2b5){const _0x51e630=a0_0x1858ed;console[_0x51e630(0x18b)]('['+new Date()[_0x51e630(0x180)]()[_0x51e630(0x189)](0x0,0x8)+_0x51e630(0x1b9)+this[_0x51e630(0x191)]+']\x20'+_0x7ac2b5);}async[a0_0x1858ed(0x1b1)](_0x508b67,_0x438424){const _0x63b5fb=a0_0x1858ed;let _0x28642e={'Content-Type':_0x63b5fb(0x19c),'Accept':_0x63b5fb(0x1a7)};if(this[_0x63b5fb(0x166)])_0x28642e['Authorization']=_0x63b5fb(0x1ac)+this[_0x63b5fb(0x166)];let _0x261d0e=await(await fetch(this[_0x63b5fb(0x1a6)]+'/mcp',{'method':'POST','headers':_0x28642e,'body':JSON[_0x63b5fb(0x190)]({'jsonrpc':_0x63b5fb(0x172),'id':Date[_0x63b5fb(0x16d)](),'method':'tools/call','params':{'name':_0x508b67,'arguments':_0x438424}})}))[_0x63b5fb(0x19a)](),_0x2509e9=_0x261d0e[_0x63b5fb(0x198)](/data: (.+)/),_0xc21fe6=_0x2509e9?JSON[_0x63b5fb(0x1a9)](_0x2509e9[0x1]):JSON['parse'](_0x261d0e),_0x251004=_0xc21fe6?.[_0x63b5fb(0x16e)]?.[_0x63b5fb(0x193)]?.[0x0]?.[_0x63b5fb(0x19a)];return _0x251004?JSON[_0x63b5fb(0x1a9)](_0x251004):_0xc21fe6;}async[a0_0x1858ed(0x16f)](){const _0x1d84a1=a0_0x1858ed;if(this[_0x1d84a1(0x1b7)])return;this['running']=!0x0,await this[_0x1d84a1(0x1a3)]('idle'),this[_0x1d84a1(0x18b)]('registered'),this[_0x1d84a1(0x194)]=setInterval(()=>{const _0x2070f8=_0x1d84a1;this[_0x2070f8(0x1a3)](_0x2070f8(0x1ae))[_0x2070f8(0x1a4)](_0x339846=>this['log'](_0x2070f8(0x1a8)+_0x339846[_0x2070f8(0x1aa)]));},this['heartbeatInterval']),this['connectSSE']();}async[a0_0x1858ed(0x1ab)](){const _0x39c9b1=a0_0x1858ed;if(this['running']=!0x1,this[_0x39c9b1(0x18f)]?.['abort'](),this[_0x39c9b1(0x194)])clearInterval(this[_0x39c9b1(0x194)]);await this[_0x39c9b1(0x1a3)]('offline')['catch'](()=>{}),this['log'](_0x39c9b1(0x1a2));}async['send'](_0xe44cd5,_0x5cd490,_0x4d76de=a0_0x1858ed(0x1ba)){const _0xca4c82=a0_0x1858ed;return this[_0xca4c82(0x1b1)](_0xca4c82(0x188),{'alias':_0xe44cd5,'task':_0x5cd490,'priority':_0x4d76de,'from_session':this[_0xca4c82(0x191)]});}async[a0_0x1858ed(0x1aa)](_0xad55a5,_0x1a54f4){const _0x36b276=a0_0x1858ed;return this['call'](_0x36b276(0x18c),{'alias':_0xad55a5,'message':_0x1a54f4,'from_session':this[_0x36b276(0x191)]});}async['reply'](_0x33fac3,_0x420298,_0x416b91=a0_0x1858ed(0x174)){const _0x4daf7a=a0_0x1858ed;return this[_0x4daf7a(0x1b1)](_0x4daf7a(0x192),{'in_reply_to':_0x33fac3,'text':_0x420298,'status':_0x416b91});}async[a0_0x1858ed(0x1a3)](_0x128d8c,_0x395587){const _0xd203ff=a0_0x1858ed;return this[_0xd203ff(0x1b1)]('report_status',{'resume_id':this[_0xd203ff(0x1b8)],'alias':this['alias'],'status':_0x128d8c,'server':a0_0x52aced(),'hostname':a0_0x52aced(),'agent':this[_0xd203ff(0x187)],'project_dir':process[_0xd203ff(0x182)](),..._0x395587});}async[a0_0x1858ed(0x17c)](){const _0x77ac00=a0_0x1858ed;return this[_0x77ac00(0x1b1)](_0x77ac00(0x179),{});}async[a0_0x1858ed(0x17f)](_0x4a3949,_0x298a57){const _0x22b557=a0_0x1858ed;return this['call'](_0x22b557(0x17f),{'message':_0x4a3949,'filter_server':_0x298a57?.[_0x22b557(0x17a)],'filter_status':_0x298a57?.[_0x22b557(0x1a3)]});}async[a0_0x1858ed(0x19f)](){const _0x4afab4=a0_0x1858ed;let _0xc5e0c9=encodeURIComponent(this[_0x4afab4(0x191)]),_0x2014fe=this[_0x4afab4(0x1a6)]+_0x4afab4(0x199)+_0xc5e0c9,_0x3ef05c=this[_0x4afab4(0x177)];while(this[_0x4afab4(0x1b7)]){try{this[_0x4afab4(0x18f)]=new AbortController();let _0x410777={'Accept':_0x4afab4(0x18a)};if(this[_0x4afab4(0x166)])_0x410777['Authorization']='Bearer\x20'+this['token'];let _0x374620=await fetch(_0x2014fe,{'headers':_0x410777,'signal':this[_0x4afab4(0x18f)][_0x4afab4(0x170)]});if(!_0x374620['ok']||!_0x374620['body']){this['log'](_0x4afab4(0x1b3)+_0x374620[_0x4afab4(0x1a3)]),await this[_0x4afab4(0x19e)](_0x3ef05c),_0x3ef05c=Math[_0x4afab4(0x196)](_0x3ef05c*1.5,0xea60);continue;}_0x3ef05c=this[_0x4afab4(0x177)];let _0x18f005=_0x374620[_0x4afab4(0x173)][_0x4afab4(0x19b)](),_0x43d084=new TextDecoder(),_0x1712ee='';while(this[_0x4afab4(0x1b7)]){let {done:_0x3f5df7,value:_0x39db66}=await _0x18f005[_0x4afab4(0x18e)]();if(_0x3f5df7)break;_0x1712ee+=_0x43d084[_0x4afab4(0x1a5)](_0x39db66,{'stream':!0x0});let _0x1b6f38=_0x1712ee['split']('\x0a');_0x1712ee=_0x1b6f38[_0x4afab4(0x1b0)]()||'';for(let _0x26c42b of _0x1b6f38){if(!_0x26c42b[_0x4afab4(0x195)](_0x4afab4(0x17d)))continue;try{let _0x33c6cf=JSON[_0x4afab4(0x1a9)](_0x26c42b[_0x4afab4(0x189)](0x6));if(_0x33c6cf['type']===_0x4afab4(0x181)){this[_0x4afab4(0x18b)]('SSE\x20connected'),this['emit'](_0x4afab4(0x181));continue;}if(_0x33c6cf[_0x4afab4(0x1b4)]===_0x4afab4(0x168)||_0x33c6cf[_0x4afab4(0x1b4)]===_0x4afab4(0x18d)||_0x33c6cf['type']==='broadcast')await this[_0x4afab4(0x171)]();}catch{}}}}catch(_0x2d3fe6){if(_0x2d3fe6[_0x4afab4(0x186)]===_0x4afab4(0x19d))break;this['emit'](_0x4afab4(0x16b),_0x2d3fe6),this['log'](_0x4afab4(0x16a)+_0x2d3fe6[_0x4afab4(0x1aa)]);}if(this[_0x4afab4(0x1b7)])this['emit'](_0x4afab4(0x1a2)),this[_0x4afab4(0x18b)]('SSE\x20reconnecting\x20in\x20'+_0x3ef05c/0x3e8+'s...'),await this[_0x4afab4(0x19e)](_0x3ef05c),_0x3ef05c=Math[_0x4afab4(0x196)](_0x3ef05c*1.5,0xea60);}}async[a0_0x1858ed(0x171)](){const _0x4a8408=a0_0x1858ed;try{let _0x1fafe7=(await this[_0x4a8408(0x1b1)](_0x4a8408(0x1ad),{'alias':this['alias'],'limit':0xa}))?.[_0x4a8408(0x184)]||[];for(let _0x3faa19 of _0x1fafe7)await this[_0x4a8408(0x1b1)](_0x4a8408(0x1a0),{'alias':this['alias'],'message_id':_0x3faa19['id']}),this[_0x4a8408(0x18b)]('←\x20'+_0x3faa19['from_session']+':\x20'+_0x3faa19[_0x4a8408(0x193)][_0x4a8408(0x189)](0x0,0x3c)),this[_0x4a8408(0x169)]('task',_0x3faa19),this[_0x4a8408(0x169)](_0x4a8408(0x1aa),_0x3faa19);}catch(_0x454162){this[_0x4a8408(0x18b)](_0x4a8408(0x167)+_0x454162[_0x4a8408(0x1aa)]);}}[a0_0x1858ed(0x19e)](_0x2c9e01){return new Promise(_0x123623=>setTimeout(_0x123623,_0x2c9e01));}}var $=T;export{$ as default,T as CommHub};
|
package/dist/src/node-server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
const a0_0x99d77c=a0_0x4332;(function(_0xea57f7,_0x8b2ba4){const _0x518bd0=a0_0x4332,_0x42179f=_0xea57f7();while(!![]){try{const _0x583fa6=parseInt(_0x518bd0(0x12c))/0x1*(parseInt(_0x518bd0(0xce))/0x2)+parseInt(_0x518bd0(0xfe))/0x3+parseInt(_0x518bd0(0x136))/0x4+-parseInt(_0x518bd0(0xf2))/0x5+-parseInt(_0x518bd0(0xd3))/0x6+-parseInt(_0x518bd0(0xb6))/0x7+-parseInt(_0x518bd0(0x145))/0x8*(-parseInt(_0x518bd0(0xdf))/0x9);if(_0x583fa6===_0x8b2ba4)break;else _0x42179f['push'](_0x42179f['shift']());}catch(_0x30ab6c){_0x42179f['push'](_0x42179f['shift']());}}}(a0_0x3efd,0xeaaa7));import{readFileSync as a0_0x33e575,existsSync as a0_0x538ae4}from'fs';import{randomUUID as a0_0x15be60}from'crypto';import{join as a0_0x3ebf34}from'path';import{hostname as a0_0x4c81e0}from'os';import{execSync as a0_0x49d0dd}from'child_process';import{Server as a0_0x10b097}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x4efcd7}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x4d5341,CallToolRequestSchema as a0_0x2b8731}from'@modelcontextprotocol/sdk/types.js';function p(_0x470ab7){const _0x4023bd=a0_0x4332;if(!a0_0x538ae4(_0x470ab7))return;for(let _0xe78da7 of a0_0x33e575(_0x470ab7,_0x4023bd(0xd1))[_0x4023bd(0xc2)]('\x0a')){let _0x121cf9=_0xe78da7['trim']();if(!_0x121cf9||_0x121cf9['startsWith']('#'))continue;let _0x3b7750=_0x121cf9[_0x4023bd(0xfb)]('=');if(_0x3b7750<0x0)continue;let _0x1b81ad=_0x121cf9['slice'](0x0,_0x3b7750)['trim'](),_0xce2a=_0x121cf9['slice'](_0x3b7750+0x1)[_0x4023bd(0x103)]()[_0x4023bd(0x126)](/^["']|["']$/g,'');if(!process.env[_0x1b81ad])process.env[_0x1b81ad]=_0xce2a;}}var C=process.env.HOME||'~',T=a0_0x3ebf34(C,a0_0x99d77c(0x11c));p(a0_0x3ebf34(T,a0_0x99d77c(0xe7)));var L=process[a0_0x99d77c(0xb7)]()[a0_0x99d77c(0x126)](/\//g,'-');p(a0_0x3ebf34(T,L,'.env'));function U(){const _0xf6561b=a0_0x99d77c;try{return a0_0x49d0dd(_0xf6561b(0x124),{'encoding':_0xf6561b(0xd1),'timeout':0x7d0})[_0xf6561b(0x103)]();}catch{return'';}}function v(){const _0x2b3df1=a0_0x99d77c;try{let _0xd36043=a0_0x3ebf34(C,_0x2b3df1(0xcd),'config.json');if(a0_0x538ae4(_0xd36043))return JSON['parse'](a0_0x33e575(_0xd36043,_0x2b3df1(0xd1)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x99d77c(0xb4)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x4c81e0(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x15be60(),X=process.env.COMMHUB_TOKEN||H[a0_0x99d77c(0xc6)]||'';function Y(_0x3450ca){const _0x96492b=a0_0x99d77c;let _0x515103=new Date()[_0x96492b(0x147)]()[_0x96492b(0xe2)](0x0,0x8);process[_0x96492b(0x109)]['write']('['+_0x515103+']\x20[commhub]\x20'+_0x3450ca+'\x0a');}function h(_0x342879){return new Promise(_0x311e2f=>setTimeout(_0x311e2f,_0x342879));}Y('ENV:\x20URL='+f+a0_0x99d77c(0xc5)+Z+a0_0x99d77c(0xde)+w[a0_0x99d77c(0xe2)](0x0,0x8)+a0_0x99d77c(0x10b)+(j||a0_0x99d77c(0xd8))+a0_0x99d77c(0x12f)+process[a0_0x99d77c(0xb7)]()+a0_0x99d77c(0xc7)+L);var k=new Map(),K=new a0_0x10b097({'name':a0_0x99d77c(0x132),'version':a0_0x99d77c(0x10f)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x99d77c(0x138),a0_0x99d77c(0x131),a0_0x99d77c(0x133),a0_0x99d77c(0x140),a0_0x99d77c(0xe0)+Z][a0_0x99d77c(0xfc)]('\x0a')});K['setRequestHandler'](a0_0x4d5341,async()=>({'tools':[{'name':a0_0x99d77c(0xc4),'description':a0_0x99d77c(0xf9),'inputSchema':{'type':a0_0x99d77c(0x137),'properties':{'task_id':{'type':'string','description':a0_0x99d77c(0xbe)},'text':{'type':a0_0x99d77c(0x10a),'description':a0_0x99d77c(0x130)},'status':{'type':a0_0x99d77c(0x10a),'enum':[a0_0x99d77c(0xd7),'failed',a0_0x99d77c(0xcf),'blocked',a0_0x99d77c(0x100),a0_0x99d77c(0xf0)],'description':a0_0x99d77c(0xc1)}},'required':[a0_0x99d77c(0xbf)]}},{'name':a0_0x99d77c(0x12e),'description':a0_0x99d77c(0x116),'inputSchema':{'type':a0_0x99d77c(0x137),'properties':{'status':{'type':a0_0x99d77c(0x10a),'enum':[a0_0x99d77c(0x146),'idle',a0_0x99d77c(0xda),a0_0x99d77c(0x100)]},'task':{'type':'string','description':'Current\x20task\x20description'},'progress':{'type':a0_0x99d77c(0x114),'description':a0_0x99d77c(0x11b)}},'required':[a0_0x99d77c(0x127)]}},{'name':a0_0x99d77c(0x13a),'description':a0_0x99d77c(0xdc),'inputSchema':{'type':a0_0x99d77c(0x137),'properties':{'alias':{'type':a0_0x99d77c(0x10a),'description':a0_0x99d77c(0x10d)},'task':{'type':'string','description':'Task\x20content'},'priority':{'type':'string','enum':[a0_0x99d77c(0xf1),'normal',a0_0x99d77c(0x118)],'description':a0_0x99d77c(0x112)}},'required':[a0_0x99d77c(0x125),a0_0x99d77c(0x10e)]}},{'name':a0_0x99d77c(0xd5),'description':a0_0x99d77c(0xd0),'inputSchema':{'type':a0_0x99d77c(0x137),'properties':{'alias':{'type':a0_0x99d77c(0x10a),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x99d77c(0x10a),'description':a0_0x99d77c(0xfa)}},'required':['alias',a0_0x99d77c(0x102)]}},{'name':'commhub_get_all_status','description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':'object','properties':{}}}]}));async function P(_0x126906,_0x206ec6){const _0x3eaacc=a0_0x99d77c;let _0x52d20a=await fetch(f+_0x3eaacc(0x128),{'method':_0x3eaacc(0xf3),'headers':{'Content-Type':_0x3eaacc(0x110),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x3eaacc(0x119),'id':0x1,'method':_0x3eaacc(0x142),'params':{'protocolVersion':_0x3eaacc(0xca),'capabilities':{},'clientInfo':{'name':_0x3eaacc(0x132),'version':_0x3eaacc(0x10f)}}})});if(!_0x52d20a['ok']){let _0xc2b815=await _0x52d20a['text']();return Y('CommHub\x20init\x20failed:\x20'+_0x52d20a[_0x3eaacc(0x127)]+'\x20'+_0xc2b815[_0x3eaacc(0xe2)](0x0,0x64)),{'ok':!0x1,'error':_0x3eaacc(0xef)+_0x52d20a[_0x3eaacc(0x127)]};}await _0x52d20a[_0x3eaacc(0xbf)]();let _0x1adfae=(await(await fetch(f+_0x3eaacc(0x128),{'method':_0x3eaacc(0xf3),'headers':{'Content-Type':_0x3eaacc(0x110),'Accept':_0x3eaacc(0xeb),...X?{'Authorization':_0x3eaacc(0xee)+X}:{}},'body':JSON[_0x3eaacc(0x104)]({'jsonrpc':'2.0','id':0x2,'method':_0x3eaacc(0x11a),'params':{'name':_0x126906,'arguments':_0x206ec6}})}))['text']())[_0x3eaacc(0xc2)]('\x0a')[_0x3eaacc(0x122)](_0x3ee64e=>_0x3ee64e[_0x3eaacc(0xe5)](_0x3eaacc(0xc9)));if(_0x1adfae){let _0x3cf360=JSON['parse'](_0x1adfae[_0x3eaacc(0xe2)](0x6));return _0x3cf360?.['result']?.['content']?.[0x0]?.[_0x3eaacc(0xbf)]?JSON[_0x3eaacc(0xba)](_0x3cf360['result']['content'][0x0][_0x3eaacc(0xbf)]):_0x3cf360;}return{'ok':!0x1,'error':_0x3eaacc(0xb5)};}function a0_0x3efd(){const _0x681fec=['Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','pop','commhub_send_task','set','getReader','get_all_status','SSE\x20connected\x20as\x20\x22','SSE\x20stream\x20ended,\x20reconnecting...','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','message_id','initialize','SIGINT','type','8CQDiFr','working','toTimeString','hub','no\x20response','6004341GMlLMN','cwd','new_message','decode','parse','parse\x20error:\x20','normal','connect','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','text','inbox_count','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','split','failed','commhub_reply','\x20ALIAS=','token','\x20PROJECT_ENV=','report_status','data:\x20','2025-03-26','notifications/claude/channel','send_task','.anet','6ICYPES','cancelled','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','utf-8','ack_inbox','9801930zqblCj','new_task','commhub_send_message','read','completed','none','\x20priority=','blocked','unknown\x20tool','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','claude-code','\x20RESUME_ID=','32340915yjdYrM','Session\x20alias:\x20','priority','slice','connected','setRequestHandler','startsWith','\x22\x20(','.env','from_session','send_message','SSE\x20connection\x20error:\x20','application/json,\x20text/event-stream','get','length','Bearer\x20','init\x20failed:\x20','in_progress','high','7003265XyEryI','POST','catch','stdin','idle','starting\x20SSE\x20listener...','commhub','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','Message\x20content','indexOf','join','broadcast','173766BXjuqc','then','error','/events/','message','trim','stringify','heartbeat\x20failed:\x20','notification','exit','SIGTERM','stderr','string','...\x20TMUX=','body','Target\x20session\x20alias','task','0.3.0','application/json','MCP\x20stdio\x20connected','Priority\x20(default:\x20normal)','\x20from\x20','number','fatal:\x20','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','end','low','2.0','tools/call','Progress\x200-100','.claude/channels/commhub','Authorization','session\x20disconnected','commhub_get_all_status','replied','content','find','params','tmux\x20display-message\x20-p\x20\x27#S\x27','alias','replace','status','/mcp','from','connecting\x20to\x20','registered\x20as\x20\x22','222062pcZkSp','←\x20message\x20from\x20','commhub_report_status','\x20CWD=','Reply\x20text\x20/\x20result\x20summary','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','commhub-channel','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','shutting\x20down,\x20reporting\x20offline...','ready\x20—\x20waiting\x20for\x20events','2142876mZacyr','object'];a0_0x3efd=function(){return _0x681fec;};return a0_0x3efd();}K[a0_0x99d77c(0xe4)](a0_0x2b8731,async _0x27bcfd=>{const _0x4c79d6=a0_0x99d77c;let {name:_0x39905d,arguments:_0x274f22}=_0x27bcfd[_0x4c79d6(0x123)];if(_0x39905d===_0x4c79d6(0xc4)){let {task_id:_0x106c00,text:_0x5531e9,status:_0x5af010}=_0x274f22;if(_0x5af010===_0x4c79d6(0xd7)||_0x5af010===_0x4c79d6(0xc3)||_0x5af010===_0x4c79d6(0xcf)){let _0x2badec=_0x5af010===_0x4c79d6(0xd7)?_0x4c79d6(0x120):_0x5af010,_0x19a326=_0x106c00?k[_0x4c79d6(0xec)](_0x106c00)||'hub':_0x4c79d6(0xb4),_0x36efa9=await P('send_reply',{'alias':_0x19a326,'text':_0x5531e9,'in_reply_to':_0x106c00||void 0x0,'status':_0x2badec,'from_session':Z});if(_0x106c00)k['delete'](_0x106c00);return{'content':[{'type':'text','text':JSON['stringify'](_0x36efa9)}]};}let _0x1e7504=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x5af010===_0x4c79d6(0xda)?_0x4c79d6(0xda):_0x5af010===_0x4c79d6(0x100)?_0x4c79d6(0x100):'working','task':_0x5531e9['slice'](0x0,0xc8),'output':_0x5531e9});return{'content':[{'type':_0x4c79d6(0xbf),'text':JSON['stringify'](_0x1e7504)}]};}if(_0x39905d===_0x4c79d6(0x12e)){let {status:_0x2db757,task:_0x11a957,progress:_0x50d784}=_0x274f22,_0x1ba2b0=await P(_0x4c79d6(0xc8),{'resume_id':w,'alias':Z,'status':_0x2db757,'task':_0x11a957,'progress':_0x50d784});return{'content':[{'type':_0x4c79d6(0xbf),'text':JSON['stringify'](_0x1ba2b0)}]};}if(_0x39905d==='commhub_send_task'){let {alias:_0x191040,task:_0xb23e2,priority:_0xdd5818}=_0x274f22,_0x3999f2=await P(_0x4c79d6(0xcc),{'alias':_0x191040,'task':_0xb23e2,'priority':_0xdd5818||_0x4c79d6(0xbc),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x4c79d6(0x104)](_0x3999f2)}]};}if(_0x39905d===_0x4c79d6(0xd5)){let {alias:_0x3b4572,message:_0x11e72d}=_0x274f22,_0xfdea5e=await P(_0x4c79d6(0xe9),{'alias':_0x3b4572,'message':_0x11e72d,'from_session':Z});return{'content':[{'type':_0x4c79d6(0xbf),'text':JSON[_0x4c79d6(0x104)](_0xfdea5e)}]};}if(_0x39905d===_0x4c79d6(0x11f)){let _0x543913=await P(_0x4c79d6(0x13d),{});return{'content':[{'type':_0x4c79d6(0xbf),'text':JSON['stringify'](_0x543913)}]};}return{'content':[{'type':_0x4c79d6(0xbf),'text':JSON[_0x4c79d6(0x104)]({'error':_0x4c79d6(0xdb)})}]};});function a0_0x4332(_0x288cec,_0x3a210a){_0x288cec=_0x288cec-0xb4;const _0x3efdca=a0_0x3efd();let _0x4332d4=_0x3efdca[_0x288cec];return _0x4332d4;}async function u(){const _0x5349c5=a0_0x99d77c;let _0xe90fc1=f+_0x5349c5(0x101)+encodeURIComponent(Z),_0x49b56b={};if(X)_0x49b56b[_0x5349c5(0x11d)]=_0x5349c5(0xee)+X;Y(_0x5349c5(0x12a)+_0xe90fc1);while(!0x0){try{let _0x594fcb=await fetch(_0xe90fc1,{'headers':_0x49b56b});if(!_0x594fcb['ok']){Y('SSE\x20error:\x20'+_0x594fcb['status']+'\x20'+_0x594fcb['statusText']),await h(0x1388);continue;}let _0xd7bdfc=_0x594fcb[_0x5349c5(0x10c)][_0x5349c5(0x13c)](),_0x1ce02a=new TextDecoder(),_0x4b571c='';while(!0x0){let {done:_0x2a415a,value:_0x335c4b}=await _0xd7bdfc[_0x5349c5(0xd6)]();if(_0x2a415a)break;_0x4b571c+=_0x1ce02a[_0x5349c5(0xb9)](_0x335c4b,{'stream':!0x0});let _0x4f0e40=_0x4b571c['split']('\x0a\x0a');_0x4b571c=_0x4f0e40[_0x5349c5(0x139)]()||'';for(let _0x3dd167 of _0x4f0e40){let _0x3fc79c=_0x3dd167[_0x5349c5(0xc2)]('\x0a')['find'](_0xcb4f9c=>_0xcb4f9c[_0x5349c5(0xe5)]('data:\x20'));if(!_0x3fc79c)continue;try{let _0x2dd9dd=JSON[_0x5349c5(0xba)](_0x3fc79c[_0x5349c5(0xe2)](0x6));await S(_0x2dd9dd);}catch(_0x218ba2){Y(_0x5349c5(0xbb)+_0x218ba2);}}}Y(_0x5349c5(0x13f));}catch(_0x2cae52){Y(_0x5349c5(0xea)+_0x2cae52);}await h(0xbb8);}}async function S(_0x29cafe){const _0x36ec1b=a0_0x99d77c;if(_0x29cafe['type']===_0x36ec1b(0xe3)){Y(_0x36ec1b(0x13e)+Z+'\x22');return;}if(_0x29cafe['type']===_0x36ec1b(0xb8)){if(Y(_0x36ec1b(0x12d)+_0x29cafe['from']+':\x20'+_0x29cafe['message']['slice'](0x0,0x3c)),await K[_0x36ec1b(0x106)]({'method':_0x36ec1b(0xcb),'params':{'content':_0x29cafe['message'],'meta':{'sender':_0x29cafe[_0x36ec1b(0x129)]||_0x36ec1b(0xb4),'sender_id':_0x36ec1b(0xf8),'user':_0x29cafe[_0x36ec1b(0x129)]||_0x36ec1b(0xb4),'priority':_0x36ec1b(0xbc)}}}),_0x29cafe[_0x36ec1b(0x141)])await P(_0x36ec1b(0xd2),{'alias':Z,'message_id':_0x29cafe[_0x36ec1b(0x141)]});return;}if(_0x29cafe[_0x36ec1b(0x144)]===_0x36ec1b(0xd4)||_0x29cafe[_0x36ec1b(0x144)]===_0x36ec1b(0xfd)){Y('←\x20'+_0x29cafe[_0x36ec1b(0x144)]+':\x20inbox_count='+_0x29cafe[_0x36ec1b(0xc0)]+_0x36ec1b(0xd9)+(_0x29cafe[_0x36ec1b(0xe1)]||'normal'));let _0x5a11c6=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x5a11c6?.['ok']&&_0x5a11c6['messages']?.[_0x36ec1b(0xed)]>0x0)for(let _0x466cf5 of _0x5a11c6['messages']){let _0x4df314={'sender':_0x466cf5[_0x36ec1b(0xe8)]||_0x36ec1b(0xb4),'sender_id':'commhub','user':_0x466cf5[_0x36ec1b(0xe8)]||_0x36ec1b(0xb4),'task_id':_0x466cf5['id'],'priority':_0x466cf5['priority']||_0x36ec1b(0xbc)};k[_0x36ec1b(0x13b)](_0x466cf5['id'],_0x466cf5[_0x36ec1b(0xe8)]||_0x36ec1b(0xb4)),await K[_0x36ec1b(0x106)]({'method':_0x36ec1b(0xcb),'params':{'content':_0x466cf5['content'],'meta':_0x4df314}}),Y('→\x20injected\x20task\x20'+_0x466cf5['id'][_0x36ec1b(0xe2)](0x0,0x8)+_0x36ec1b(0x113)+_0x466cf5[_0x36ec1b(0xe8)]+':\x20'+_0x466cf5[_0x36ec1b(0x121)][_0x36ec1b(0xe2)](0x0,0x3c)),await P(_0x36ec1b(0xd2),{'alias':Z,'message_id':_0x466cf5['id']});}}}async function A(){const _0x3ef178=a0_0x99d77c;let _0x50edf4=new a0_0x4efcd7();await K[_0x3ef178(0xbd)](_0x50edf4),Y(_0x3ef178(0x111)),Y(_0x3ef178(0xf7)),u()[_0x3ef178(0xf4)](_0x1d43f6=>Y('SSE\x20fatal:\x20'+_0x1d43f6)),P(_0x3ef178(0xc8),{'resume_id':w,'alias':Z,'status':_0x3ef178(0xf6),'server':a0_0x4c81e0(),'hostname':a0_0x4c81e0(),'agent':_0x3ef178(0xdd),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x3ef178(0xff)](()=>Y(_0x3ef178(0x12b)+Z+_0x3ef178(0xe6)+w[_0x3ef178(0xe2)](0x0,0x8)+')'))[_0x3ef178(0xf4)](_0x2df1f1=>Y('warning:\x20could\x20not\x20register:\x20'+_0x2df1f1)),setInterval(()=>{const _0x486402=_0x3ef178;P(_0x486402(0xc8),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x4c81e0(),'hostname':a0_0x4c81e0(),'agent':_0x486402(0xdd),'project_dir':process[_0x486402(0xb7)](),'tmux_name':j||void 0x0})[_0x486402(0xf4)](_0x17a40a=>Y(_0x486402(0x105)+_0x17a40a));},0x2bf20),Y(_0x3ef178(0x135));}A()[a0_0x99d77c(0xf4)](_0x33887e=>{const _0x1fadeb=a0_0x99d77c;Y(_0x1fadeb(0x115)+_0x33887e),process['exit'](0x1);});async function N(){const _0x850e9b=a0_0x99d77c;Y(_0x850e9b(0x134)),await P(_0x850e9b(0xc8),{'resume_id':w,'alias':Z,'status':_0x850e9b(0x100),'task':_0x850e9b(0x11e)})['catch'](()=>{}),process[_0x850e9b(0x107)](0x0);}process[a0_0x99d77c(0xf5)]['on'](a0_0x99d77c(0x117),()=>N()),process['on'](a0_0x99d77c(0x108),()=>N()),process['on'](a0_0x99d77c(0x143),()=>N());
|
|
2
|
+
const a0_0x3239df=a0_0x2066;(function(_0x342b2a,_0x68c555){const _0x62a2d2=a0_0x2066,_0x44aa10=_0x342b2a();while(!![]){try{const _0x49097a=parseInt(_0x62a2d2(0xb7))/0x1*(-parseInt(_0x62a2d2(0x88))/0x2)+parseInt(_0x62a2d2(0xea))/0x3+parseInt(_0x62a2d2(0x99))/0x4+parseInt(_0x62a2d2(0xd8))/0x5*(parseInt(_0x62a2d2(0xc0))/0x6)+parseInt(_0x62a2d2(0xe0))/0x7+parseInt(_0x62a2d2(0x8d))/0x8*(-parseInt(_0x62a2d2(0xaf))/0x9)+parseInt(_0x62a2d2(0xfc))/0xa*(-parseInt(_0x62a2d2(0x91))/0xb);if(_0x49097a===_0x68c555)break;else _0x44aa10['push'](_0x44aa10['shift']());}catch(_0x5ba4a8){_0x44aa10['push'](_0x44aa10['shift']());}}}(a0_0x441b,0x3be78));import{readFileSync as a0_0x4231bd,existsSync as a0_0x52e76f}from'fs';import{randomUUID as a0_0x516cd6}from'crypto';import{join as a0_0x3bef62}from'path';import{hostname as a0_0x48d882}from'os';import{execSync as a0_0x2e94d1}from'child_process';import{Server as a0_0x39a9d8}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x322fa5}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x2f12d5,CallToolRequestSchema as a0_0x2fc727}from'@modelcontextprotocol/sdk/types.js';function p(_0x28809a){const _0x65397c=a0_0x2066;if(!a0_0x52e76f(_0x28809a))return;for(let _0x3a7755 of a0_0x4231bd(_0x28809a,_0x65397c(0xa0))[_0x65397c(0x86)]('\x0a')){let _0x2f835f=_0x3a7755[_0x65397c(0xc1)]();if(!_0x2f835f||_0x2f835f['startsWith']('#'))continue;let _0xd932d2=_0x2f835f[_0x65397c(0x100)]('=');if(_0xd932d2<0x0)continue;let _0x5dfee7=_0x2f835f['slice'](0x0,_0xd932d2)[_0x65397c(0xc1)](),_0xa26c66=_0x2f835f[_0x65397c(0xcb)](_0xd932d2+0x1)[_0x65397c(0xc1)]()[_0x65397c(0xca)](/^["']|["']$/g,'');if(!process.env[_0x5dfee7])process.env[_0x5dfee7]=_0xa26c66;}}var C=process.env.HOME||'~',T=a0_0x3bef62(C,a0_0x3239df(0xc6));p(a0_0x3bef62(T,'.env'));var L=process[a0_0x3239df(0xcc)]()['replace'](/\//g,'-');p(a0_0x3bef62(T,L,a0_0x3239df(0x7f)));function U(){const _0x3065ba=a0_0x3239df;try{return a0_0x2e94d1(_0x3065ba(0xda),{'encoding':'utf-8','timeout':0x7d0})[_0x3065ba(0xc1)]();}catch{return'';}}function v(){const _0x5dfb34=a0_0x3239df;try{let _0x5eb307=a0_0x3bef62(C,_0x5dfb34(0xa5),'config.json');if(a0_0x52e76f(_0x5eb307))return JSON[_0x5dfb34(0xbe)](a0_0x4231bd(_0x5eb307,_0x5dfb34(0xa0)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x3239df(0x103)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x48d882(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x516cd6(),X=process.env.COMMHUB_TOKEN||H[a0_0x3239df(0xe7)]||'';function a0_0x441b(){const _0x15fcf4=['message_id','number','replace','slice','cwd','Bearer\x20','set','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','notification','text','send_reply','message','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','initialize','\x20ALIAS=','pop','195oqVAJW','join','tmux\x20display-message\x20-p\x20\x27#S\x27','\x20from\x20','application/json,\x20text/event-stream','in_progress','2.0','commhub_report_status','2304547RxXhoW','data:\x20','priority','failed','completed','Current\x20task\x20description','body','token','Task\x20content','stderr','945993ycNTkd','Progress\x200-100','Target\x20session\x20alias','fatal:\x20','2025-03-26','find','tools/call','none','no\x20response','heartbeat\x20failed:\x20','string','normal','stringify','broadcast','SSE\x20error:\x20','setRequestHandler','catch','toTimeString','80uBdVvW','error','ack_inbox','send_message','indexOf','SSE\x20connected\x20as\x20\x22','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','hub','decode','working','getReader','commhub_send_task','Priority\x20(default:\x20normal)','end','starting\x20SSE\x20listener...','length','parse\x20error:\x20','.env','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','task','←\x20message\x20from\x20','init\x20failed:\x20','content','from_session','split','Authorization','8CUPrUW','SSE\x20fatal:\x20','blocked','params','notifications/claude/channel','8PAcWvc','report_status','commhub_send_message','POST','462297GbeNag','ENV:\x20URL=','unknown\x20tool','warning:\x20could\x20not\x20register:\x20','get','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','cancelled','session\x20disconnected','1031140DRHtvV','type','CommHub\x20init\x20failed:\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','MCP\x20stdio\x20connected','application/json','messages','utf-8','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','→\x20injected\x20task\x20','get_inbox','0.3.0','.anet','idle','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','\x20PROJECT_ENV=','connected','Message\x20content','status','high','SSE\x20stream\x20ended,\x20reconnecting...','2092995ohBYLR','\x22\x20(','exit','commhub-channel','from','commhub_get_all_status','get_all_status','low','82519dSKaEC','claude-code','commhub','delete',']\x20[commhub]\x20','alias','commhub_reply','parse','/mcp','37212vAVugH','trim','object','then','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','SIGTERM','.claude/channels/commhub','shutting\x20down,\x20reporting\x20offline...'];a0_0x441b=function(){return _0x15fcf4;};return a0_0x441b();}function Y(_0x5d65e2){const _0x3f6af5=a0_0x3239df;let _0x2197e4=new Date()[_0x3f6af5(0xfb)]()[_0x3f6af5(0xcb)](0x0,0x8);process[_0x3f6af5(0xe9)]['write']('['+_0x2197e4+_0x3f6af5(0xbb)+_0x5d65e2+'\x0a');}function h(_0x4477d0){return new Promise(_0x538751=>setTimeout(_0x538751,_0x4477d0));}Y(a0_0x3239df(0x92)+f+a0_0x3239df(0xd6)+Z+'\x20RESUME_ID='+w[a0_0x3239df(0xcb)](0x0,0x8)+'...\x20TMUX='+(j||a0_0x3239df(0xf1))+'\x20CWD='+process[a0_0x3239df(0xcc)]()+a0_0x3239df(0xa9)+L);var k=new Map(),K=new a0_0x39a9d8({'name':a0_0x3239df(0xb2),'version':a0_0x3239df(0xa4)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x3239df(0xd4),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x3239df(0x102),a0_0x3239df(0xa8),'Session\x20alias:\x20'+Z][a0_0x3239df(0xd9)]('\x0a')});K[a0_0x3239df(0xf9)](a0_0x2f12d5,async()=>({'tools':[{'name':a0_0x3239df(0xbd),'description':a0_0x3239df(0x9c),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x3239df(0xf4),'description':a0_0x3239df(0xcf)},'text':{'type':a0_0x3239df(0xf4),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':'string','enum':[a0_0x3239df(0xe4),a0_0x3239df(0xe3),'cancelled',a0_0x3239df(0x8a),a0_0x3239df(0xfd),a0_0x3239df(0xdd)],'description':a0_0x3239df(0x80)}},'required':['text']}},{'name':a0_0x3239df(0xdf),'description':a0_0x3239df(0xa1),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x3239df(0xf4),'enum':[a0_0x3239df(0x105),a0_0x3239df(0xa6),a0_0x3239df(0x8a),a0_0x3239df(0xfd)]},'task':{'type':a0_0x3239df(0xf4),'description':a0_0x3239df(0xe5)},'progress':{'type':a0_0x3239df(0xc9),'description':a0_0x3239df(0xeb)}},'required':[a0_0x3239df(0xac)]}},{'name':a0_0x3239df(0x79),'description':a0_0x3239df(0xc4),'inputSchema':{'type':a0_0x3239df(0xc2),'properties':{'alias':{'type':a0_0x3239df(0xf4),'description':a0_0x3239df(0xec)},'task':{'type':a0_0x3239df(0xf4),'description':a0_0x3239df(0xe8)},'priority':{'type':a0_0x3239df(0xf4),'enum':[a0_0x3239df(0xad),a0_0x3239df(0xf5),a0_0x3239df(0xb6)],'description':a0_0x3239df(0x7a)}},'required':[a0_0x3239df(0xbc),a0_0x3239df(0x81)]}},{'name':a0_0x3239df(0x8f),'description':a0_0x3239df(0x96),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x3239df(0xf4),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x3239df(0xf4),'description':a0_0x3239df(0xab)}},'required':[a0_0x3239df(0xbc),'message']}},{'name':a0_0x3239df(0xb4),'description':a0_0x3239df(0xa7),'inputSchema':{'type':a0_0x3239df(0xc2),'properties':{}}}]}));async function P(_0x2d45d0,_0x46dc62){const _0x5e9335=a0_0x3239df;let _0x24fa8b=await fetch(f+'/mcp',{'method':_0x5e9335(0x90),'headers':{'Content-Type':_0x5e9335(0x9e),'Accept':_0x5e9335(0xdc),...X?{'Authorization':_0x5e9335(0xcd)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x1,'method':_0x5e9335(0xd5),'params':{'protocolVersion':_0x5e9335(0xee),'capabilities':{},'clientInfo':{'name':_0x5e9335(0xb2),'version':_0x5e9335(0xa4)}}})});if(!_0x24fa8b['ok']){let _0x3457a8=await _0x24fa8b[_0x5e9335(0xd1)]();return Y(_0x5e9335(0x9b)+_0x24fa8b['status']+'\x20'+_0x3457a8[_0x5e9335(0xcb)](0x0,0x64)),{'ok':!0x1,'error':_0x5e9335(0x83)+_0x24fa8b[_0x5e9335(0xac)]};}await _0x24fa8b[_0x5e9335(0xd1)]();let _0xd2d0f1=(await(await fetch(f+_0x5e9335(0xbf),{'method':_0x5e9335(0x90),'headers':{'Content-Type':_0x5e9335(0x9e),'Accept':_0x5e9335(0xdc),...X?{'Authorization':_0x5e9335(0xcd)+X}:{}},'body':JSON[_0x5e9335(0xf6)]({'jsonrpc':_0x5e9335(0xde),'id':0x2,'method':_0x5e9335(0xf0),'params':{'name':_0x2d45d0,'arguments':_0x46dc62}})}))[_0x5e9335(0xd1)]())['split']('\x0a')['find'](_0x180a03=>_0x180a03['startsWith'](_0x5e9335(0xe1)));if(_0xd2d0f1){let _0x53ebd3=JSON[_0x5e9335(0xbe)](_0xd2d0f1[_0x5e9335(0xcb)](0x6));return _0x53ebd3?.['result']?.['content']?.[0x0]?.[_0x5e9335(0xd1)]?JSON[_0x5e9335(0xbe)](_0x53ebd3['result'][_0x5e9335(0x84)][0x0]['text']):_0x53ebd3;}return{'ok':!0x1,'error':_0x5e9335(0xf2)};}K['setRequestHandler'](a0_0x2fc727,async _0x20a0f2=>{const _0x48d347=a0_0x3239df;let {name:_0x557927,arguments:_0x136c45}=_0x20a0f2[_0x48d347(0x8b)];if(_0x557927===_0x48d347(0xbd)){let {task_id:_0x472824,text:_0x30d68b,status:_0x48cd20}=_0x136c45;if(_0x48cd20===_0x48d347(0xe4)||_0x48cd20===_0x48d347(0xe3)||_0x48cd20===_0x48d347(0x97)){let _0x333335=_0x48cd20===_0x48d347(0xe4)?'replied':_0x48cd20,_0x30d095=_0x472824?k[_0x48d347(0x95)](_0x472824)||_0x48d347(0x103):'hub',_0x4830de=await P(_0x48d347(0xd2),{'alias':_0x30d095,'text':_0x30d68b,'in_reply_to':_0x472824||void 0x0,'status':_0x333335,'from_session':Z});if(_0x472824)k[_0x48d347(0xba)](_0x472824);return{'content':[{'type':_0x48d347(0xd1),'text':JSON[_0x48d347(0xf6)](_0x4830de)}]};}let _0x560267=await P(_0x48d347(0x8e),{'resume_id':w,'alias':Z,'status':_0x48cd20==='blocked'?_0x48d347(0x8a):_0x48cd20==='error'?_0x48d347(0xfd):'working','task':_0x30d68b[_0x48d347(0xcb)](0x0,0xc8),'output':_0x30d68b});return{'content':[{'type':'text','text':JSON[_0x48d347(0xf6)](_0x560267)}]};}if(_0x557927==='commhub_report_status'){let {status:_0x22ebfb,task:_0x7451bd,progress:_0x2cdae3}=_0x136c45,_0x2b5932=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x22ebfb,'task':_0x7451bd,'progress':_0x2cdae3});return{'content':[{'type':_0x48d347(0xd1),'text':JSON[_0x48d347(0xf6)](_0x2b5932)}]};}if(_0x557927===_0x48d347(0x79)){let {alias:_0xe02bf2,task:_0x97c14d,priority:_0x1e3cc3}=_0x136c45,_0xbb6c47=await P('send_task',{'alias':_0xe02bf2,'task':_0x97c14d,'priority':_0x1e3cc3||_0x48d347(0xf5),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x48d347(0xf6)](_0xbb6c47)}]};}if(_0x557927===_0x48d347(0x8f)){let {alias:_0xa8d992,message:_0x57d7a5}=_0x136c45,_0x46c756=await P(_0x48d347(0xff),{'alias':_0xa8d992,'message':_0x57d7a5,'from_session':Z});return{'content':[{'type':_0x48d347(0xd1),'text':JSON['stringify'](_0x46c756)}]};}if(_0x557927===_0x48d347(0xb4)){let _0x484a88=await P(_0x48d347(0xb5),{});return{'content':[{'type':'text','text':JSON[_0x48d347(0xf6)](_0x484a88)}]};}return{'content':[{'type':_0x48d347(0xd1),'text':JSON[_0x48d347(0xf6)]({'error':_0x48d347(0x93)})}]};});async function u(){const _0x3916b3=a0_0x3239df;let _0x52f3b0=f+'/events/'+encodeURIComponent(Z),_0x9fb352={};if(X)_0x9fb352[_0x3916b3(0x87)]=_0x3916b3(0xcd)+X;Y('connecting\x20to\x20'+_0x52f3b0);while(!0x0){try{let _0x40f540=await fetch(_0x52f3b0,{'headers':_0x9fb352});if(!_0x40f540['ok']){Y(_0x3916b3(0xf8)+_0x40f540[_0x3916b3(0xac)]+'\x20'+_0x40f540['statusText']),await h(0x1388);continue;}let _0x185d4b=_0x40f540[_0x3916b3(0xe6)][_0x3916b3(0x78)](),_0x468141=new TextDecoder(),_0x1e5b3c='';while(!0x0){let {done:_0x301665,value:_0x5bcf82}=await _0x185d4b['read']();if(_0x301665)break;_0x1e5b3c+=_0x468141[_0x3916b3(0x104)](_0x5bcf82,{'stream':!0x0});let _0x912117=_0x1e5b3c[_0x3916b3(0x86)]('\x0a\x0a');_0x1e5b3c=_0x912117[_0x3916b3(0xd7)]()||'';for(let _0x381e01 of _0x912117){let _0x132fe2=_0x381e01[_0x3916b3(0x86)]('\x0a')[_0x3916b3(0xef)](_0x23fad3=>_0x23fad3['startsWith']('data:\x20'));if(!_0x132fe2)continue;try{let _0x32762a=JSON['parse'](_0x132fe2[_0x3916b3(0xcb)](0x6));await S(_0x32762a);}catch(_0x33d293){Y(_0x3916b3(0x7e)+_0x33d293);}}}Y(_0x3916b3(0xae));}catch(_0x48fec8){Y('SSE\x20connection\x20error:\x20'+_0x48fec8);}await h(0xbb8);}}function a0_0x2066(_0x40d1c4,_0x2047ff){_0x40d1c4=_0x40d1c4-0x78;const _0x441b88=a0_0x441b();let _0x2066c5=_0x441b88[_0x40d1c4];return _0x2066c5;}async function S(_0x1546ec){const _0x6994a8=a0_0x3239df;if(_0x1546ec[_0x6994a8(0x9a)]===_0x6994a8(0xaa)){Y(_0x6994a8(0x101)+Z+'\x22');return;}if(_0x1546ec[_0x6994a8(0x9a)]==='new_message'){if(Y(_0x6994a8(0x82)+_0x1546ec[_0x6994a8(0xb3)]+':\x20'+_0x1546ec[_0x6994a8(0xd3)]['slice'](0x0,0x3c)),await K['notification']({'method':'notifications/claude/channel','params':{'content':_0x1546ec['message'],'meta':{'sender':_0x1546ec['from']||_0x6994a8(0x103),'sender_id':_0x6994a8(0xb9),'user':_0x1546ec[_0x6994a8(0xb3)]||_0x6994a8(0x103),'priority':'normal'}}}),_0x1546ec[_0x6994a8(0xc8)])await P(_0x6994a8(0xfe),{'alias':Z,'message_id':_0x1546ec[_0x6994a8(0xc8)]});return;}if(_0x1546ec['type']==='new_task'||_0x1546ec[_0x6994a8(0x9a)]===_0x6994a8(0xf7)){Y('←\x20'+_0x1546ec[_0x6994a8(0x9a)]+':\x20inbox_count='+_0x1546ec['inbox_count']+'\x20priority='+(_0x1546ec[_0x6994a8(0xe2)]||_0x6994a8(0xf5)));let _0x310a13=await P(_0x6994a8(0xa3),{'alias':Z,'limit':0x5});if(_0x310a13?.['ok']&&_0x310a13['messages']?.[_0x6994a8(0x7d)]>0x0)for(let _0x19bf89 of _0x310a13[_0x6994a8(0x9f)]){let _0x918acc={'sender':_0x19bf89[_0x6994a8(0x85)]||_0x6994a8(0x103),'sender_id':_0x6994a8(0xb9),'user':_0x19bf89['from_session']||'hub','task_id':_0x19bf89['id'],'priority':_0x19bf89[_0x6994a8(0xe2)]||'normal'};k[_0x6994a8(0xce)](_0x19bf89['id'],_0x19bf89[_0x6994a8(0x85)]||_0x6994a8(0x103)),await K[_0x6994a8(0xd0)]({'method':_0x6994a8(0x8c),'params':{'content':_0x19bf89[_0x6994a8(0x84)],'meta':_0x918acc}}),Y(_0x6994a8(0xa2)+_0x19bf89['id'][_0x6994a8(0xcb)](0x0,0x8)+_0x6994a8(0xdb)+_0x19bf89[_0x6994a8(0x85)]+':\x20'+_0x19bf89[_0x6994a8(0x84)]['slice'](0x0,0x3c)),await P(_0x6994a8(0xfe),{'alias':Z,'message_id':_0x19bf89['id']});}}}async function A(){const _0x43e3b8=a0_0x3239df;let _0x591fd6=new a0_0x322fa5();await K['connect'](_0x591fd6),Y(_0x43e3b8(0x9d)),Y(_0x43e3b8(0x7c)),u()[_0x43e3b8(0xfa)](_0x580236=>Y(_0x43e3b8(0x89)+_0x580236)),P(_0x43e3b8(0x8e),{'resume_id':w,'alias':Z,'status':_0x43e3b8(0xa6),'server':a0_0x48d882(),'hostname':a0_0x48d882(),'agent':'claude-code','project_dir':process[_0x43e3b8(0xcc)](),'tmux_name':j||void 0x0})[_0x43e3b8(0xc3)](()=>Y('registered\x20as\x20\x22'+Z+_0x43e3b8(0xb0)+w[_0x43e3b8(0xcb)](0x0,0x8)+')'))['catch'](_0x35e00f=>Y(_0x43e3b8(0x94)+_0x35e00f)),setInterval(()=>{const _0x54d784=_0x43e3b8;P(_0x54d784(0x8e),{'resume_id':w,'alias':Z,'status':_0x54d784(0xa6),'server':a0_0x48d882(),'hostname':a0_0x48d882(),'agent':_0x54d784(0xb8),'project_dir':process[_0x54d784(0xcc)](),'tmux_name':j||void 0x0})[_0x54d784(0xfa)](_0xf3b218=>Y(_0x54d784(0xf3)+_0xf3b218));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x3239df(0xfa)](_0x137969=>{const _0x556a30=a0_0x3239df;Y(_0x556a30(0xed)+_0x137969),process[_0x556a30(0xb1)](0x1);});async function N(){const _0x5290e6=a0_0x3239df;Y(_0x5290e6(0xc7)),await P(_0x5290e6(0x8e),{'resume_id':w,'alias':Z,'status':'error','task':_0x5290e6(0x98)})['catch'](()=>{}),process[_0x5290e6(0xb1)](0x0);}process['stdin']['on'](a0_0x3239df(0x7b),()=>N()),process['on'](a0_0x3239df(0xc5),()=>N()),process['on']('SIGINT',()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.1.15
|
|
3
|
+
"version": "2.1.15",
|
|
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",
|