@sleep2agi/agent-network 2.1.7-preview.0 → 2.1.7-preview.1
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
|
+
function a0_0x4c06(_0x4278ed,_0x52979c){_0x4278ed=_0x4278ed-0x1ca;const _0x2dcd0b=a0_0x2dcd();let _0x4c0603=_0x2dcd0b[_0x4278ed];return _0x4c0603;}function a0_0x2dcd(){const _0x56312f=['/events/','log','4459464OxKQiP','type','abort','reply','send_reply',']\x20[commhub:','messages','data:\x20','body','connect','completed','1165966OnJLpQ','SSE\x20reconnecting\x20in\x20','now','disconnect','send','160152FjzzqS','getReader','error','send_message','new_task','from_session','get_all_status','new_message','application/json','AbortError','parse','disconnected','heartbeatInterval','min','toString','sdk','sleep','status','processInbox','text/event-stream','Authorization','broadcast','8OUttEP','normal','getAllStatus','call','text','task','alias','9290350chTqis','name','resumeId','Bearer\x20','registered','read','9anMSOf','reconnectDelay','offline','slice','cwd','autoConnect','862673NBDEdh','token','SSE\x20connected','562108LJbfdw','heartbeatTimer','POST','ack_inbox','connected','577775fPbwQV','heartbeat\x20failed:\x20','message','content','idle','agent','get_inbox','signal','emit','server','running','toTimeString','/mcp','inbox\x20error:\x20','s...','url','connectSSE','send_task','startsWith','catch','sseAbort','75lMKcrb'];a0_0x2dcd=function(){return _0x56312f;};return a0_0x2dcd();}const a0_0x1bcb36=a0_0x4c06;(function(_0x3ae62a,_0x4f4f81){const _0x152414=a0_0x4c06,_0x34be04=_0x3ae62a();while(!![]){try{const _0x382fbe=-parseInt(_0x152414(0x218))/0x1+parseInt(_0x152414(0x1e2))/0x2+-parseInt(_0x152414(0x20a))/0x3*(-parseInt(_0x152414(0x213))/0x4)+parseInt(_0x152414(0x1d4))/0x5*(-parseInt(_0x152414(0x1e7))/0x6)+-parseInt(_0x152414(0x210))/0x7*(parseInt(_0x152414(0x1fd))/0x8)+-parseInt(_0x152414(0x1d7))/0x9+parseInt(_0x152414(0x204))/0xa;if(_0x382fbe===_0x4f4f81)break;else _0x34be04['push'](_0x34be04['shift']());}catch(_0x1ab0fb){_0x34be04['push'](_0x34be04['shift']());}}}(a0_0x2dcd,0x52345));import{EventEmitter as a0_0xbed7b2}from'events';import{hostname as a0_0x187a06}from'os';class T extends a0_0xbed7b2{[a0_0x1bcb36(0x1ce)];[a0_0x1bcb36(0x203)];['token'];['agent'];[a0_0x1bcb36(0x206)];[a0_0x1bcb36(0x1f3)];[a0_0x1bcb36(0x20b)];[a0_0x1bcb36(0x214)];[a0_0x1bcb36(0x1d3)];[a0_0x1bcb36(0x222)]=!0x1;constructor(_0x277232){const _0x5d7ce0=a0_0x1bcb36;super();if(this[_0x5d7ce0(0x1ce)]=_0x277232[_0x5d7ce0(0x1ce)]['replace'](/\/$/,''),this[_0x5d7ce0(0x203)]=_0x277232[_0x5d7ce0(0x203)],this[_0x5d7ce0(0x211)]=_0x277232[_0x5d7ce0(0x211)],this[_0x5d7ce0(0x21d)]=_0x277232['agent']||_0x5d7ce0(0x1f6),this['resumeId']='sdk-'+_0x277232['alias']+'-'+Date[_0x5d7ce0(0x1e4)]()[_0x5d7ce0(0x1f5)](0x24),this[_0x5d7ce0(0x1f3)]=_0x277232[_0x5d7ce0(0x1f3)]??0x2bf20,this[_0x5d7ce0(0x20b)]=_0x277232[_0x5d7ce0(0x20b)]??0xbb8,_0x277232[_0x5d7ce0(0x20f)]!==!0x1)this[_0x5d7ce0(0x1e0)]();}[a0_0x1bcb36(0x1d6)](_0xd8cac1){const _0x44a761=a0_0x1bcb36;console[_0x44a761(0x1d6)]('['+new Date()[_0x44a761(0x1ca)]()[_0x44a761(0x20d)](0x0,0x8)+_0x44a761(0x1dc)+this[_0x44a761(0x203)]+']\x20'+_0xd8cac1);}async[a0_0x1bcb36(0x200)](_0x55dc0b,_0x32b552){const _0x15729e=a0_0x1bcb36;let _0x393bb5={'Content-Type':_0x15729e(0x1ef),'Accept':'application/json,\x20text/event-stream'};if(this[_0x15729e(0x211)])_0x393bb5['Authorization']=_0x15729e(0x207)+this[_0x15729e(0x211)];let _0x456b02=await(await fetch(this[_0x15729e(0x1ce)]+_0x15729e(0x1cb),{'method':_0x15729e(0x215),'headers':_0x393bb5,'body':JSON['stringify']({'jsonrpc':'2.0','id':Date[_0x15729e(0x1e4)](),'method':'tools/call','params':{'name':_0x55dc0b,'arguments':_0x32b552}})}))['text'](),_0x4fe18b=_0x456b02['match'](/data: (.+)/),_0x2deb58=_0x4fe18b?JSON['parse'](_0x4fe18b[0x1]):JSON[_0x15729e(0x1f1)](_0x456b02),_0x2fd1df=_0x2deb58?.['result']?.[_0x15729e(0x21b)]?.[0x0]?.[_0x15729e(0x201)];return _0x2fd1df?JSON[_0x15729e(0x1f1)](_0x2fd1df):_0x2deb58;}async[a0_0x1bcb36(0x1e0)](){const _0x28d267=a0_0x1bcb36;if(this[_0x28d267(0x222)])return;this[_0x28d267(0x222)]=!0x0,await this[_0x28d267(0x1f8)](_0x28d267(0x21c)),this[_0x28d267(0x1d6)](_0x28d267(0x208)),this['heartbeatTimer']=setInterval(()=>{const _0x411bf9=_0x28d267;this['status'](_0x411bf9(0x21c))[_0x411bf9(0x1d2)](_0x58d108=>this[_0x411bf9(0x1d6)](_0x411bf9(0x219)+_0x58d108[_0x411bf9(0x21a)]));},this[_0x28d267(0x1f3)]),this[_0x28d267(0x1cf)]();}async[a0_0x1bcb36(0x1e5)](){const _0x3ae405=a0_0x1bcb36;if(this[_0x3ae405(0x222)]=!0x1,this['sseAbort']?.[_0x3ae405(0x1d9)](),this[_0x3ae405(0x214)])clearInterval(this[_0x3ae405(0x214)]);await this[_0x3ae405(0x1f8)](_0x3ae405(0x20c))[_0x3ae405(0x1d2)](()=>{}),this[_0x3ae405(0x1d6)](_0x3ae405(0x1f2));}async[a0_0x1bcb36(0x1e6)](_0x83d07b,_0x3d4627,_0x2d47a=a0_0x1bcb36(0x1fe)){const _0x2bc916=a0_0x1bcb36;return this[_0x2bc916(0x200)](_0x2bc916(0x1d0),{'alias':_0x83d07b,'task':_0x3d4627,'priority':_0x2d47a,'from_session':this[_0x2bc916(0x203)]});}async[a0_0x1bcb36(0x21a)](_0x38a64b,_0x280c9b){const _0x3ed462=a0_0x1bcb36;return this[_0x3ed462(0x200)](_0x3ed462(0x1ea),{'alias':_0x38a64b,'message':_0x280c9b,'from_session':this[_0x3ed462(0x203)]});}async[a0_0x1bcb36(0x1da)](_0x17a544,_0x4c0804,_0x5d803c=a0_0x1bcb36(0x1e1)){const _0x228fe8=a0_0x1bcb36;return this[_0x228fe8(0x200)](_0x228fe8(0x1db),{'in_reply_to':_0x17a544,'text':_0x4c0804,'status':_0x5d803c});}async[a0_0x1bcb36(0x1f8)](_0x2a736a,_0x1fd8fc){const _0x13c311=a0_0x1bcb36;return this[_0x13c311(0x200)]('report_status',{'resume_id':this[_0x13c311(0x206)],'alias':this[_0x13c311(0x203)],'status':_0x2a736a,'server':a0_0x187a06(),'hostname':a0_0x187a06(),'agent':this[_0x13c311(0x21d)],'project_dir':process[_0x13c311(0x20e)](),..._0x1fd8fc});}async[a0_0x1bcb36(0x1ff)](){const _0x5743fe=a0_0x1bcb36;return this['call'](_0x5743fe(0x1ed),{});}async['broadcast'](_0x21a7fa,_0xac0c8f){const _0x36c0a4=a0_0x1bcb36;return this[_0x36c0a4(0x200)](_0x36c0a4(0x1fc),{'message':_0x21a7fa,'filter_server':_0xac0c8f?.[_0x36c0a4(0x221)],'filter_status':_0xac0c8f?.[_0x36c0a4(0x1f8)]});}async[a0_0x1bcb36(0x1cf)](){const _0x2993fc=a0_0x1bcb36;let _0x53377c=encodeURIComponent(this[_0x2993fc(0x203)]),_0x55fba0=this[_0x2993fc(0x1ce)]+_0x2993fc(0x1d5)+_0x53377c,_0x1139e5=this[_0x2993fc(0x20b)];while(this[_0x2993fc(0x222)]){try{this[_0x2993fc(0x1d3)]=new AbortController();let _0x278b7a={'Accept':_0x2993fc(0x1fa)};if(this[_0x2993fc(0x211)])_0x278b7a[_0x2993fc(0x1fb)]='Bearer\x20'+this[_0x2993fc(0x211)];let _0x1ebf4f=await fetch(_0x55fba0,{'headers':_0x278b7a,'signal':this['sseAbort'][_0x2993fc(0x21f)]});if(!_0x1ebf4f['ok']||!_0x1ebf4f[_0x2993fc(0x1df)]){this['log']('SSE\x20failed:\x20'+_0x1ebf4f[_0x2993fc(0x1f8)]),await this['sleep'](_0x1139e5),_0x1139e5=Math[_0x2993fc(0x1f4)](_0x1139e5*1.5,0xea60);continue;}_0x1139e5=this[_0x2993fc(0x20b)];let _0xb3b768=_0x1ebf4f[_0x2993fc(0x1df)][_0x2993fc(0x1e8)](),_0x1531d6=new TextDecoder(),_0x3241d8='';while(this['running']){let {done:_0x1db703,value:_0x58f617}=await _0xb3b768[_0x2993fc(0x209)]();if(_0x1db703)break;_0x3241d8+=_0x1531d6['decode'](_0x58f617,{'stream':!0x0});let _0x528279=_0x3241d8['split']('\x0a');_0x3241d8=_0x528279['pop']()||'';for(let _0x401779 of _0x528279){if(!_0x401779[_0x2993fc(0x1d1)](_0x2993fc(0x1de)))continue;try{let _0x2fbe3e=JSON[_0x2993fc(0x1f1)](_0x401779[_0x2993fc(0x20d)](0x6));if(_0x2fbe3e[_0x2993fc(0x1d8)]===_0x2993fc(0x217)){this['log'](_0x2993fc(0x212)),this[_0x2993fc(0x220)](_0x2993fc(0x217));continue;}if(_0x2fbe3e['type']===_0x2993fc(0x1eb)||_0x2fbe3e[_0x2993fc(0x1d8)]===_0x2993fc(0x1ee)||_0x2fbe3e['type']===_0x2993fc(0x1fc))await this[_0x2993fc(0x1f9)]();}catch{}}}}catch(_0x2441ed){if(_0x2441ed[_0x2993fc(0x205)]===_0x2993fc(0x1f0))break;this[_0x2993fc(0x220)](_0x2993fc(0x1e9),_0x2441ed),this[_0x2993fc(0x1d6)]('SSE\x20error:\x20'+_0x2441ed[_0x2993fc(0x21a)]);}if(this[_0x2993fc(0x222)])this[_0x2993fc(0x220)](_0x2993fc(0x1f2)),this[_0x2993fc(0x1d6)](_0x2993fc(0x1e3)+_0x1139e5/0x3e8+_0x2993fc(0x1cd)),await this[_0x2993fc(0x1f7)](_0x1139e5),_0x1139e5=Math[_0x2993fc(0x1f4)](_0x1139e5*1.5,0xea60);}}async['processInbox'](){const _0x127aef=a0_0x1bcb36;try{let _0x3a07fb=(await this[_0x127aef(0x200)](_0x127aef(0x21e),{'alias':this['alias'],'limit':0xa}))?.[_0x127aef(0x1dd)]||[];for(let _0x18359c of _0x3a07fb)await this[_0x127aef(0x200)](_0x127aef(0x216),{'alias':this[_0x127aef(0x203)],'message_id':_0x18359c['id']}),this[_0x127aef(0x1d6)]('←\x20'+_0x18359c[_0x127aef(0x1ec)]+':\x20'+_0x18359c['content'][_0x127aef(0x20d)](0x0,0x3c)),this[_0x127aef(0x220)](_0x127aef(0x202),_0x18359c),this[_0x127aef(0x220)]('message',_0x18359c);}catch(_0x53516f){this['log'](_0x127aef(0x1cc)+_0x53516f[_0x127aef(0x21a)]);}}['sleep'](_0x3cba50){return new Promise(_0x49cd53=>setTimeout(_0x49cd53,_0x3cba50));}}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_0x3f4d20=a0_0xd0c1;(function(_0x455955,_0x5ea6f1){const _0x2830ce=a0_0xd0c1,_0x2c7ab3=_0x455955();while(!![]){try{const _0x1aed66=-parseInt(_0x2830ce(0xe3))/0x1+parseInt(_0x2830ce(0x112))/0x2*(-parseInt(_0x2830ce(0xfe))/0x3)+parseInt(_0x2830ce(0xc5))/0x4*(parseInt(_0x2830ce(0x13a))/0x5)+parseInt(_0x2830ce(0xcd))/0x6+parseInt(_0x2830ce(0x116))/0x7+-parseInt(_0x2830ce(0x126))/0x8*(parseInt(_0x2830ce(0x131))/0x9)+parseInt(_0x2830ce(0x11b))/0xa*(-parseInt(_0x2830ce(0x127))/0xb);if(_0x1aed66===_0x5ea6f1)break;else _0x2c7ab3['push'](_0x2c7ab3['shift']());}catch(_0x1b1652){_0x2c7ab3['push'](_0x2c7ab3['shift']());}}}(a0_0x30fe,0x8d2bd));import{readFileSync as a0_0x4fc692,existsSync as a0_0x5118b}from'fs';import{randomUUID as a0_0x1ed902}from'crypto';import{join as a0_0x3f409d}from'path';import{hostname as a0_0x4f7831}from'os';import{execSync as a0_0x4559b2}from'child_process';import{Server as a0_0x4aa06a}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x3843ba}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x54d77c,CallToolRequestSchema as a0_0x56a742}from'@modelcontextprotocol/sdk/types.js';function p(_0x299c5a){const _0x513858=a0_0xd0c1;if(!a0_0x5118b(_0x299c5a))return;for(let _0x2fb769 of a0_0x4fc692(_0x299c5a,_0x513858(0xee))[_0x513858(0xce)]('\x0a')){let _0x52b3e7=_0x2fb769['trim']();if(!_0x52b3e7||_0x52b3e7[_0x513858(0x137)]('#'))continue;let _0x559894=_0x52b3e7['indexOf']('=');if(_0x559894<0x0)continue;let _0x43dc9f=_0x52b3e7[_0x513858(0x123)](0x0,_0x559894)[_0x513858(0xdf)](),_0x58c99c=_0x52b3e7[_0x513858(0x123)](_0x559894+0x1)[_0x513858(0xdf)]()[_0x513858(0x132)](/^["']|["']$/g,'');if(!process.env[_0x43dc9f])process.env[_0x43dc9f]=_0x58c99c;}}var C=process.env.HOME||'~',T=a0_0x3f409d(C,'.claude/channels/commhub');p(a0_0x3f409d(T,a0_0x3f4d20(0x11c)));var L=process[a0_0x3f4d20(0x135)]()[a0_0x3f4d20(0x132)](/\//g,'-');p(a0_0x3f409d(T,L,a0_0x3f4d20(0x11c)));function U(){const _0x4502db=a0_0x3f4d20;try{return a0_0x4559b2(_0x4502db(0x12e),{'encoding':_0x4502db(0xee),'timeout':0x7d0})[_0x4502db(0xdf)]();}catch{return'';}}function v(){const _0x38eb58=a0_0x3f4d20;try{let _0x232fe9=a0_0x3f409d(C,_0x38eb58(0xbc),_0x38eb58(0xc1));if(a0_0x5118b(_0x232fe9))return JSON[_0x38eb58(0xc3)](a0_0x4fc692(_0x232fe9,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x3f4d20(0xbb)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x4f7831(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x1ed902(),X=process.env.COMMHUB_TOKEN||H[a0_0x3f4d20(0x10a)]||'';function Y(_0x38bcc7){const _0x2d931a=a0_0x3f4d20;let _0x45580e=new Date()[_0x2d931a(0xd0)]()['slice'](0x0,0x8);process[_0x2d931a(0xec)][_0x2d931a(0xe2)]('['+_0x45580e+_0x2d931a(0x124)+_0x38bcc7+'\x0a');}function h(_0x3ed784){return new Promise(_0x2c5c67=>setTimeout(_0x2c5c67,_0x3ed784));}Y(a0_0x3f4d20(0x130)+f+'\x20ALIAS='+Z+a0_0x3f4d20(0x141)+w[a0_0x3f4d20(0x123)](0x0,0x8)+a0_0x3f4d20(0x121)+(j||a0_0x3f4d20(0xc0))+a0_0x3f4d20(0x122)+process[a0_0x3f4d20(0x135)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x4aa06a({'name':a0_0x3f4d20(0x114),'version':a0_0x3f4d20(0xcc)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x3f4d20(0x143),a0_0x3f4d20(0xe1),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x3f4d20(0xc6),a0_0x3f4d20(0xc4)+Z][a0_0x3f4d20(0xdb)]('\x0a')});K[a0_0x3f4d20(0x10b)](a0_0x54d77c,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x3f4d20(0x100),'inputSchema':{'type':a0_0x3f4d20(0xdc),'properties':{'task_id':{'type':a0_0x3f4d20(0xf1),'description':a0_0x3f4d20(0x125)},'text':{'type':a0_0x3f4d20(0xf1),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':'string','enum':[a0_0x3f4d20(0xe5),a0_0x3f4d20(0x13d),a0_0x3f4d20(0x139),a0_0x3f4d20(0xbd),a0_0x3f4d20(0xfa),a0_0x3f4d20(0xfd)],'description':a0_0x3f4d20(0xf9)}},'required':[a0_0x3f4d20(0x134)]}},{'name':a0_0x3f4d20(0x13c),'description':a0_0x3f4d20(0xf8),'inputSchema':{'type':a0_0x3f4d20(0xdc),'properties':{'status':{'type':a0_0x3f4d20(0xf1),'enum':[a0_0x3f4d20(0xea),a0_0x3f4d20(0xb6),a0_0x3f4d20(0xbd),'error']},'task':{'type':'string','description':a0_0x3f4d20(0x119)},'progress':{'type':a0_0x3f4d20(0xc2),'description':a0_0x3f4d20(0xfc)}},'required':[a0_0x3f4d20(0xb9)]}},{'name':a0_0x3f4d20(0x12c),'description':a0_0x3f4d20(0x13b),'inputSchema':{'type':a0_0x3f4d20(0xdc),'properties':{'alias':{'type':a0_0x3f4d20(0xf1),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x3f4d20(0xf1),'description':a0_0x3f4d20(0x11f)},'priority':{'type':a0_0x3f4d20(0xf1),'enum':[a0_0x3f4d20(0xf7),a0_0x3f4d20(0x142),a0_0x3f4d20(0x128)],'description':a0_0x3f4d20(0x13f)}},'required':['alias',a0_0x3f4d20(0x105)]}},{'name':a0_0x3f4d20(0x110),'description':a0_0x3f4d20(0xf4),'inputSchema':{'type':a0_0x3f4d20(0xdc),'properties':{'alias':{'type':a0_0x3f4d20(0xf1),'description':a0_0x3f4d20(0xf6)},'message':{'type':'string','description':a0_0x3f4d20(0x12d)}},'required':[a0_0x3f4d20(0xc8),'message']}},{'name':'commhub_get_all_status','description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x3f4d20(0xdc),'properties':{}}}]}));async function P(_0x1a056b,_0x36353c){const _0x3aecce=a0_0x3f4d20;let _0x7f3c3=await fetch(f+_0x3aecce(0xef),{'method':_0x3aecce(0x101),'headers':{'Content-Type':'application/json','Accept':_0x3aecce(0x111),...X?{'Authorization':_0x3aecce(0xd8)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x3aecce(0x107),'id':0x1,'method':_0x3aecce(0xd3),'params':{'protocolVersion':_0x3aecce(0x103),'capabilities':{},'clientInfo':{'name':_0x3aecce(0x114),'version':'0.3.0'}}})});if(!_0x7f3c3['ok']){let _0x3b3595=await _0x7f3c3[_0x3aecce(0x134)]();return Y(_0x3aecce(0x10c)+_0x7f3c3[_0x3aecce(0xb9)]+'\x20'+_0x3b3595[_0x3aecce(0x123)](0x0,0x64)),{'ok':!0x1,'error':_0x3aecce(0x115)+_0x7f3c3[_0x3aecce(0xb9)]};}await _0x7f3c3[_0x3aecce(0x134)]();let _0x1878ea=(await(await fetch(f+_0x3aecce(0xef),{'method':_0x3aecce(0x101),'headers':{'Content-Type':_0x3aecce(0xb8),'Accept':_0x3aecce(0x111),...X?{'Authorization':_0x3aecce(0xd8)+X}:{}},'body':JSON[_0x3aecce(0xba)]({'jsonrpc':_0x3aecce(0x107),'id':0x2,'method':_0x3aecce(0xd5),'params':{'name':_0x1a056b,'arguments':_0x36353c}})}))[_0x3aecce(0x134)]())['split']('\x0a')['find'](_0x4790d3=>_0x4790d3[_0x3aecce(0x137)](_0x3aecce(0x108)));if(_0x1878ea){let _0x11fc47=JSON[_0x3aecce(0xc3)](_0x1878ea[_0x3aecce(0x123)](0x6));return _0x11fc47?.[_0x3aecce(0xeb)]?.['content']?.[0x0]?.[_0x3aecce(0x134)]?JSON['parse'](_0x11fc47[_0x3aecce(0xeb)]['content'][0x0][_0x3aecce(0x134)]):_0x11fc47;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x3f4d20(0x10b)](a0_0x56a742,async _0x162a13=>{const _0x40628e=a0_0x3f4d20;let {name:_0x4839b2,arguments:_0x3a9677}=_0x162a13[_0x40628e(0xdd)];if(_0x4839b2===_0x40628e(0x140)){let {task_id:_0x3bc418,text:_0x1de0ca,status:_0x263921}=_0x3a9677;if(_0x263921===_0x40628e(0xe5)||_0x263921===_0x40628e(0x13d)||_0x263921==='cancelled'){let _0x38030d=_0x263921===_0x40628e(0xe5)?'replied':_0x263921,_0x149892=_0x3bc418?k['get'](_0x3bc418)||'hub':_0x40628e(0xbb),_0x3afbef=await P(_0x40628e(0x129),{'alias':_0x149892,'text':_0x1de0ca,'in_reply_to':_0x3bc418||void 0x0,'status':_0x38030d,'from_session':Z});if(_0x3bc418)k['delete'](_0x3bc418);return{'content':[{'type':_0x40628e(0x134),'text':JSON[_0x40628e(0xba)](_0x3afbef)}]};}let _0x2b6696=await P(_0x40628e(0x12f),{'resume_id':w,'alias':Z,'status':_0x263921==='blocked'?_0x40628e(0xbd):_0x263921==='error'?_0x40628e(0xfa):_0x40628e(0xea),'task':_0x1de0ca[_0x40628e(0x123)](0x0,0xc8),'output':_0x1de0ca});return{'content':[{'type':_0x40628e(0x134),'text':JSON['stringify'](_0x2b6696)}]};}if(_0x4839b2===_0x40628e(0x13c)){let {status:_0x2b3901,task:_0x4514b5,progress:_0x5b97b0}=_0x3a9677,_0x57dec0=await P(_0x40628e(0x12f),{'resume_id':w,'alias':Z,'status':_0x2b3901,'task':_0x4514b5,'progress':_0x5b97b0});return{'content':[{'type':_0x40628e(0x134),'text':JSON[_0x40628e(0xba)](_0x57dec0)}]};}if(_0x4839b2===_0x40628e(0x12c)){let {alias:_0x3a2648,task:_0x56279b,priority:_0x35babe}=_0x3a9677,_0x4c4d6b=await P(_0x40628e(0xbf),{'alias':_0x3a2648,'task':_0x56279b,'priority':_0x35babe||_0x40628e(0x142),'from_session':Z});return{'content':[{'type':_0x40628e(0x134),'text':JSON[_0x40628e(0xba)](_0x4c4d6b)}]};}if(_0x4839b2==='commhub_send_message'){let {alias:_0x23aa9f,message:_0x25c52f}=_0x3a9677,_0x22d1a1=await P(_0x40628e(0xe6),{'alias':_0x23aa9f,'message':_0x25c52f,'from_session':Z});return{'content':[{'type':_0x40628e(0x134),'text':JSON['stringify'](_0x22d1a1)}]};}if(_0x4839b2===_0x40628e(0x117)){let _0x11fbb6=await P(_0x40628e(0x113),{});return{'content':[{'type':_0x40628e(0x134),'text':JSON[_0x40628e(0xba)](_0x11fbb6)}]};}return{'content':[{'type':'text','text':JSON[_0x40628e(0xba)]({'error':_0x40628e(0xb5)})}]};});async function u(){const _0x456e9d=a0_0x3f4d20;let _0x11ad86=f+_0x456e9d(0xe0)+encodeURIComponent(Z),_0x35e2d3={};if(X)_0x35e2d3[_0x456e9d(0x12a)]=_0x456e9d(0xd8)+X;Y('connecting\x20to\x20'+_0x11ad86);while(!0x0){try{let _0x415672=await fetch(_0x11ad86,{'headers':_0x35e2d3});if(!_0x415672['ok']){Y(_0x456e9d(0x109)+_0x415672['status']+'\x20'+_0x415672[_0x456e9d(0xf2)]),await h(0x1388);continue;}let _0x3fc720=_0x415672['body'][_0x456e9d(0xf5)](),_0x1be529=new TextDecoder(),_0x56c747='';while(!0x0){let {done:_0x4961ac,value:_0x3e1db0}=await _0x3fc720[_0x456e9d(0xd9)]();if(_0x4961ac)break;_0x56c747+=_0x1be529[_0x456e9d(0xca)](_0x3e1db0,{'stream':!0x0});let _0x5ace71=_0x56c747[_0x456e9d(0xce)]('\x0a\x0a');_0x56c747=_0x5ace71['pop']()||'';for(let _0x12f223 of _0x5ace71){let _0x4a412e=_0x12f223[_0x456e9d(0xce)]('\x0a')[_0x456e9d(0x120)](_0xd42959=>_0xd42959['startsWith'](_0x456e9d(0x108)));if(!_0x4a412e)continue;try{let _0x21cbc7=JSON[_0x456e9d(0xc3)](_0x4a412e[_0x456e9d(0x123)](0x6));await S(_0x21cbc7);}catch(_0x3c2515){Y(_0x456e9d(0x136)+_0x3c2515);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x4cf8e9){Y(_0x456e9d(0xff)+_0x4cf8e9);}await h(0xbb8);}}async function S(_0xa662b3){const _0x158326=a0_0x3f4d20;if(_0xa662b3[_0x158326(0xe8)]==='connected'){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0xa662b3[_0x158326(0xe8)]===_0x158326(0xf0)){if(Y('←\x20message\x20from\x20'+_0xa662b3[_0x158326(0xc7)]+':\x20'+_0xa662b3['message'][_0x158326(0x123)](0x0,0x3c)),await K['notification']({'method':_0x158326(0xe7),'params':{'content':_0xa662b3['message'],'meta':{'sender':_0xa662b3[_0x158326(0xc7)]||'hub','sender_id':_0x158326(0xf3),'user':_0xa662b3['from']||'hub','priority':_0x158326(0x142)}}}),_0xa662b3[_0x158326(0x133)])await P('ack_inbox',{'alias':Z,'message_id':_0xa662b3[_0x158326(0x133)]});return;}if(_0xa662b3['type']===_0x158326(0x106)||_0xa662b3['type']===_0x158326(0x11e)){Y('←\x20'+_0xa662b3['type']+_0x158326(0xed)+_0xa662b3['inbox_count']+'\x20priority='+(_0xa662b3[_0x158326(0x11a)]||'normal'));let _0x41ecb2=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x41ecb2?.['ok']&&_0x41ecb2[_0x158326(0x138)]?.[_0x158326(0xcb)]>0x0)for(let _0x262a8b of _0x41ecb2[_0x158326(0x138)]){let _0x453a47={'sender':_0x262a8b[_0x158326(0xcf)]||_0x158326(0xbb),'sender_id':'commhub','user':_0x262a8b[_0x158326(0xcf)]||'hub','task_id':_0x262a8b['id'],'priority':_0x262a8b['priority']||_0x158326(0x142)};k[_0x158326(0xc9)](_0x262a8b['id'],_0x262a8b['from_session']||_0x158326(0xbb)),await K[_0x158326(0x10f)]({'method':'notifications/claude/channel','params':{'content':_0x262a8b[_0x158326(0x104)],'meta':_0x453a47}}),Y(_0x158326(0x12b)+_0x262a8b['id'][_0x158326(0x123)](0x0,0x8)+_0x158326(0xfb)+_0x262a8b[_0x158326(0xcf)]+':\x20'+_0x262a8b[_0x158326(0x104)][_0x158326(0x123)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x262a8b['id']});}}}async function A(){const _0x31ee7a=a0_0x3f4d20;let _0x462beb=new a0_0x3843ba();await K[_0x31ee7a(0xda)](_0x462beb),Y(_0x31ee7a(0x11d)),Y(_0x31ee7a(0x13e)),u()[_0x31ee7a(0xb7)](_0x5b44e2=>Y(_0x31ee7a(0xe9)+_0x5b44e2)),P(_0x31ee7a(0x12f),{'resume_id':w,'alias':Z,'status':_0x31ee7a(0xb6),'server':a0_0x4f7831(),'hostname':a0_0x4f7831(),'agent':_0x31ee7a(0x145),'project_dir':process[_0x31ee7a(0x135)](),'tmux_name':j||void 0x0})[_0x31ee7a(0xd4)](()=>Y(_0x31ee7a(0x102)+Z+_0x31ee7a(0xe4)+w['slice'](0x0,0x8)+')'))[_0x31ee7a(0xb7)](_0x51cf8d=>Y(_0x31ee7a(0xbe)+_0x51cf8d)),setInterval(()=>{const _0xa3cd9a=_0x31ee7a;P('report_status',{'resume_id':w,'alias':Z,'status':_0xa3cd9a(0xb6),'server':a0_0x4f7831(),'hostname':a0_0x4f7831(),'agent':'claude-code','project_dir':process[_0xa3cd9a(0x135)](),'tmux_name':j||void 0x0})[_0xa3cd9a(0xb7)](_0x54a917=>Y(_0xa3cd9a(0x144)+_0x54a917));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x3f4d20(0xb7)](_0x3f943d=>{const _0x295265=a0_0x3f4d20;Y(_0x295265(0xde)+_0x3f943d),process[_0x295265(0x10e)](0x1);});async function N(){const _0x52ffd5=a0_0x3f4d20;Y(_0x52ffd5(0xd7)),await P(_0x52ffd5(0x12f),{'resume_id':w,'alias':Z,'status':_0x52ffd5(0xfa),'task':_0x52ffd5(0xd6)})['catch'](()=>{}),process['exit'](0x0);}function a0_0xd0c1(_0x1bdc55,_0x27702e){_0x1bdc55=_0x1bdc55-0xb5;const _0x30fe02=a0_0x30fe();let _0xd0c147=_0x30fe02[_0x1bdc55];return _0xd0c147;}process[a0_0x3f4d20(0x118)]['on'](a0_0x3f4d20(0xd2),()=>N()),process['on'](a0_0x3f4d20(0xd1),()=>N()),process['on'](a0_0x3f4d20(0x10d),()=>N());function a0_0x30fe(){const _0x51e76d=['error','\x20from\x20','Progress\x200-100','in_progress','19677aHhZpc','SSE\x20connection\x20error:\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','POST','registered\x20as\x20\x22','2025-03-26','content','task','new_task','2.0','data:\x20','SSE\x20error:\x20','token','setRequestHandler','CommHub\x20init\x20failed:\x20','SIGINT','exit','notification','commhub_send_message','application/json,\x20text/event-stream','42ruNkGn','get_all_status','commhub-channel','init\x20failed:\x20','4373691DcWzmr','commhub_get_all_status','stdin','Current\x20task\x20description','priority','8222080GZxtjt','.env','MCP\x20stdio\x20connected','broadcast','Task\x20content','find','...\x20TMUX=','\x20CWD=','slice',']\x20[commhub]\x20','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','1808pYQVNU','11QKUqFG','low','send_reply','Authorization','→\x20injected\x20task\x20','commhub_send_task','Message\x20content','tmux\x20display-message\x20-p\x20\x27#S\x27','report_status','ENV:\x20URL=','6957DFtOGV','replace','message_id','text','cwd','parse\x20error:\x20','startsWith','messages','cancelled','5045AbTcWW','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','commhub_report_status','failed','starting\x20SSE\x20listener...','Priority\x20(default:\x20normal)','commhub_reply','\x20RESUME_ID=','normal','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','heartbeat\x20failed:\x20','claude-code','unknown\x20tool','idle','catch','application/json','status','stringify','hub','.anet','blocked','warning:\x20could\x20not\x20register:\x20','send_task','none','config.json','number','parse','Session\x20alias:\x20','3308RwccHH','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','from','alias','set','decode','length','0.3.0','1601376GHRQod','split','from_session','toTimeString','SIGTERM','end','initialize','then','tools/call','session\x20disconnected','shutting\x20down,\x20reporting\x20offline...','Bearer\x20','read','connect','join','object','params','fatal:\x20','trim','/events/','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','write','13270YAgpif','\x22\x20(','completed','send_message','notifications/claude/channel','type','SSE\x20fatal:\x20','working','result','stderr',':\x20inbox_count=','utf-8','/mcp','new_message','string','statusText','commhub','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','getReader','Target\x20session\x20alias','high','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'];a0_0x30fe=function(){return _0x51e76d;};return a0_0x30fe();}
|
|
2
|
+
const a0_0x36e548=a0_0x4da2;(function(_0x15023d,_0x56c55a){const _0x354547=a0_0x4da2,_0x4801c5=_0x15023d();while(!![]){try{const _0x5423a6=parseInt(_0x354547(0xe6))/0x1+-parseInt(_0x354547(0xdb))/0x2+parseInt(_0x354547(0x127))/0x3*(parseInt(_0x354547(0x102))/0x4)+-parseInt(_0x354547(0xf4))/0x5+parseInt(_0x354547(0xd7))/0x6+parseInt(_0x354547(0xb8))/0x7*(parseInt(_0x354547(0xfc))/0x8)+parseInt(_0x354547(0xe5))/0x9*(-parseInt(_0x354547(0xc9))/0xa);if(_0x5423a6===_0x56c55a)break;else _0x4801c5['push'](_0x4801c5['shift']());}catch(_0x498900){_0x4801c5['push'](_0x4801c5['shift']());}}}(a0_0x4b45,0x8ba81));import{readFileSync as a0_0x2a0a99,existsSync as a0_0xb71bfe}from'fs';import{randomUUID as a0_0x5cdfd1}from'crypto';import{join as a0_0xfb859b}from'path';import{hostname as a0_0x4755b6}from'os';import{execSync as a0_0x6dff69}from'child_process';function a0_0x4b45(){const _0x4c475c=['read','inbox_count','text','content','message_id','blocked','slice','hub','fatal:\x20','registered\x20as\x20\x22','\x22\x20(','\x20ALIAS=','ready\x20—\x20waiting\x20for\x20events','messages','ENV:\x20URL=','shutting\x20down,\x20reporting\x20offline...','7DQpXXK','commhub-channel','status','split','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','no\x20response','application/json,\x20text/event-stream','from','Priority\x20(default:\x20normal)','Message\x20content','trim','.anet','ack_inbox','body','startsWith','.env','write','90xWxJes',':\x20inbox_count=','none','2.0','replied','notification','stdin','commhub','data:\x20','\x20CWD=','replace','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','commhub_get_all_status','message','4568622AdBJNK','SIGTERM','POST','connecting\x20to\x20','545944KfPIbE','from_session','connected','token','get_inbox','application/json','SSE\x20error:\x20','claude-code','delete','SSE\x20connected\x20as\x20\x22','1018467bHVlms','1024237IlBUVm','SSE\x20stream\x20ended,\x20reconnecting...','Target\x20session\x20alias','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','statusText','.claude/channels/commhub','indexOf','Bearer\x20','notifications/claude/channel','high','\x20RESUME_ID=','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','commhub_send_message','utf-8','4694885mlcNkw','commhub_report_status','...\x20TMUX=','toTimeString','error','exit','send_message','warning:\x20could\x20not\x20register:\x20','7531144EYsvIt','broadcast','completed','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','normal','failed','4rwucYE','stringify','get_all_status',']\x20[commhub]\x20','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','object','cwd','Authorization','heartbeat\x20failed:\x20','parse','alias','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','SIGINT','length','→\x20injected\x20task\x20','Task\x20content','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','parse\x20error:\x20','priority','initialize','http://127.0.0.1:9200','then','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','in_progress','cancelled','/mcp','working','\x20PROJECT_ENV=','stderr','get','CommHub\x20init\x20failed:\x20','unknown\x20tool','catch','Current\x20task\x20description','new_task','pop','setRequestHandler','226146JnRwTn','tmux\x20display-message\x20-p\x20\x27#S\x27','send_task','commhub_send_task','find','string','type','idle','tools/call','←\x20message\x20from\x20','low','\x20from\x20','report_status','starting\x20SSE\x20listener...'];a0_0x4b45=function(){return _0x4c475c;};return a0_0x4b45();}import{Server as a0_0x1d4dd0}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x2099b0}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x2180f5,CallToolRequestSchema as a0_0x16fa10}from'@modelcontextprotocol/sdk/types.js';function p(_0x1ba07d){const _0x207c97=a0_0x4da2;if(!a0_0xb71bfe(_0x1ba07d))return;for(let _0x4485a0 of a0_0x2a0a99(_0x1ba07d,_0x207c97(0xf3))['split']('\x0a')){let _0x6ef96b=_0x4485a0[_0x207c97(0xc2)]();if(!_0x6ef96b||_0x6ef96b[_0x207c97(0xc6)]('#'))continue;let _0x4ac9ae=_0x6ef96b[_0x207c97(0xec)]('=');if(_0x4ac9ae<0x0)continue;let _0x4aeed8=_0x6ef96b['slice'](0x0,_0x4ac9ae)['trim'](),_0x3770c6=_0x6ef96b['slice'](_0x4ac9ae+0x1)['trim']()[_0x207c97(0xd3)](/^["']|["']$/g,'');if(!process.env[_0x4aeed8])process.env[_0x4aeed8]=_0x3770c6;}}var C=process.env.HOME||'~',T=a0_0xfb859b(C,a0_0x36e548(0xeb));p(a0_0xfb859b(T,'.env'));var L=process['cwd']()[a0_0x36e548(0xd3)](/\//g,'-');p(a0_0xfb859b(T,L,a0_0x36e548(0xc7)));function U(){const _0x256740=a0_0x36e548;try{return a0_0x6dff69(_0x256740(0x128),{'encoding':'utf-8','timeout':0x7d0})[_0x256740(0xc2)]();}catch{return'';}}function a0_0x4da2(_0x2d5593,_0x480305){_0x2d5593=_0x2d5593-0xac;const _0x4b4555=a0_0x4b45();let _0x4da297=_0x4b4555[_0x2d5593];return _0x4da297;}function v(){const _0x25c1b9=a0_0x36e548;try{let _0x51838f=a0_0xfb859b(C,_0x25c1b9(0xc3),'config.json');if(a0_0xb71bfe(_0x51838f))return JSON[_0x25c1b9(0x10b)](a0_0x2a0a99(_0x51838f,_0x25c1b9(0xf3)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x36e548(0xaf)]||a0_0x36e548(0x116),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x4755b6(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x5cdfd1(),X=process.env.COMMHUB_TOKEN||H[a0_0x36e548(0xde)]||'';function Y(_0xb7dee){const _0x2e75a7=a0_0x36e548;let _0x227f4d=new Date()[_0x2e75a7(0xf7)]()[_0x2e75a7(0xae)](0x0,0x8);process[_0x2e75a7(0x11e)][_0x2e75a7(0xc8)]('['+_0x227f4d+_0x2e75a7(0x105)+_0xb7dee+'\x0a');}function h(_0x5f2dc4){return new Promise(_0x49e025=>setTimeout(_0x49e025,_0x5f2dc4));}Y(a0_0x36e548(0xb6)+f+a0_0x36e548(0xb3)+Z+a0_0x36e548(0xf0)+w['slice'](0x0,0x8)+a0_0x36e548(0xf6)+(j||a0_0x36e548(0xcb))+a0_0x36e548(0xd2)+process['cwd']()+a0_0x36e548(0x11d)+L);var k=new Map(),K=new a0_0x1d4dd0({'name':a0_0x36e548(0xb9),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x36e548(0x106),a0_0x36e548(0x118),a0_0x36e548(0xe9),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Session\x20alias:\x20'+Z]['join']('\x0a')});K[a0_0x36e548(0x126)](a0_0x2180f5,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x36e548(0xd4),'inputSchema':{'type':a0_0x36e548(0x107),'properties':{'task_id':{'type':a0_0x36e548(0x12c),'description':a0_0x36e548(0xf1)},'text':{'type':a0_0x36e548(0x12c),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x36e548(0x12c),'enum':[a0_0x36e548(0xfe),a0_0x36e548(0x101),a0_0x36e548(0x11a),a0_0x36e548(0xad),a0_0x36e548(0xf8),a0_0x36e548(0x119)],'description':a0_0x36e548(0xbc)}},'required':[a0_0x36e548(0x137)]}},{'name':'commhub_report_status','description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':'object','properties':{'status':{'type':a0_0x36e548(0x12c),'enum':[a0_0x36e548(0x11c),a0_0x36e548(0x12e),'blocked',a0_0x36e548(0xf8)]},'task':{'type':a0_0x36e548(0x12c),'description':a0_0x36e548(0x123)},'progress':{'type':'number','description':'Progress\x200-100'}},'required':[a0_0x36e548(0xba)]}},{'name':'commhub_send_task','description':a0_0x36e548(0xff),'inputSchema':{'type':a0_0x36e548(0x107),'properties':{'alias':{'type':a0_0x36e548(0x12c),'description':a0_0x36e548(0xe8)},'task':{'type':a0_0x36e548(0x12c),'description':a0_0x36e548(0x111)},'priority':{'type':a0_0x36e548(0x12c),'enum':[a0_0x36e548(0xef),a0_0x36e548(0x100),a0_0x36e548(0x131)],'description':a0_0x36e548(0xc0)}},'required':[a0_0x36e548(0x10c),'task']}},{'name':a0_0x36e548(0xf2),'description':a0_0x36e548(0x10d),'inputSchema':{'type':a0_0x36e548(0x107),'properties':{'alias':{'type':'string','description':a0_0x36e548(0xe8)},'message':{'type':a0_0x36e548(0x12c),'description':a0_0x36e548(0xc1)}},'required':[a0_0x36e548(0x10c),a0_0x36e548(0xd6)]}},{'name':'commhub_get_all_status','description':a0_0x36e548(0x112),'inputSchema':{'type':a0_0x36e548(0x107),'properties':{}}}]}));async function P(_0x478e1e,_0x3a1aca){const _0x3dbe9b=a0_0x36e548;let _0x52df02=await fetch(f+_0x3dbe9b(0x11b),{'method':_0x3dbe9b(0xd9),'headers':{'Content-Type':_0x3dbe9b(0xe0),'Accept':_0x3dbe9b(0xbe),...X?{'Authorization':_0x3dbe9b(0xed)+X}:{}},'body':JSON[_0x3dbe9b(0x103)]({'jsonrpc':_0x3dbe9b(0xcc),'id':0x1,'method':_0x3dbe9b(0x115),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x3dbe9b(0xb9),'version':'0.3.0'}}})});if(!_0x52df02['ok']){let _0x1ce142=await _0x52df02[_0x3dbe9b(0x137)]();return Y(_0x3dbe9b(0x120)+_0x52df02['status']+'\x20'+_0x1ce142[_0x3dbe9b(0xae)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x52df02[_0x3dbe9b(0xba)]};}await _0x52df02[_0x3dbe9b(0x137)]();let _0x177e2a=(await(await fetch(f+_0x3dbe9b(0x11b),{'method':_0x3dbe9b(0xd9),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x3dbe9b(0xed)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x3dbe9b(0xcc),'id':0x2,'method':_0x3dbe9b(0x12f),'params':{'name':_0x478e1e,'arguments':_0x3a1aca}})}))[_0x3dbe9b(0x137)]())[_0x3dbe9b(0xbb)]('\x0a')['find'](_0x4bc2a9=>_0x4bc2a9[_0x3dbe9b(0xc6)](_0x3dbe9b(0xd1)));if(_0x177e2a){let _0xb08949=JSON[_0x3dbe9b(0x10b)](_0x177e2a[_0x3dbe9b(0xae)](0x6));return _0xb08949?.['result']?.['content']?.[0x0]?.[_0x3dbe9b(0x137)]?JSON[_0x3dbe9b(0x10b)](_0xb08949['result']['content'][0x0][_0x3dbe9b(0x137)]):_0xb08949;}return{'ok':!0x1,'error':_0x3dbe9b(0xbd)};}K['setRequestHandler'](a0_0x16fa10,async _0x3d487c=>{const _0x569980=a0_0x36e548;let {name:_0xf89910,arguments:_0x81fc24}=_0x3d487c['params'];if(_0xf89910==='commhub_reply'){let {task_id:_0x25dede,text:_0x23d0dd,status:_0x1547e6}=_0x81fc24;if(_0x1547e6==='completed'||_0x1547e6==='failed'||_0x1547e6==='cancelled'){let _0x1b3f3d=_0x1547e6===_0x569980(0xfe)?_0x569980(0xcd):_0x1547e6,_0x3d5d2e=_0x25dede?k[_0x569980(0x11f)](_0x25dede)||_0x569980(0xaf):_0x569980(0xaf),_0x314769=await P('send_reply',{'alias':_0x3d5d2e,'text':_0x23d0dd,'in_reply_to':_0x25dede||void 0x0,'status':_0x1b3f3d,'from_session':Z});if(_0x25dede)k[_0x569980(0xe3)](_0x25dede);return{'content':[{'type':_0x569980(0x137),'text':JSON[_0x569980(0x103)](_0x314769)}]};}let _0x529169=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x1547e6==='blocked'?_0x569980(0xad):_0x1547e6===_0x569980(0xf8)?'error':_0x569980(0x11c),'task':_0x23d0dd[_0x569980(0xae)](0x0,0xc8),'output':_0x23d0dd});return{'content':[{'type':_0x569980(0x137),'text':JSON[_0x569980(0x103)](_0x529169)}]};}if(_0xf89910===_0x569980(0xf5)){let {status:_0x327f35,task:_0x2c5373,progress:_0xa7db04}=_0x81fc24,_0x59cad3=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x327f35,'task':_0x2c5373,'progress':_0xa7db04});return{'content':[{'type':'text','text':JSON[_0x569980(0x103)](_0x59cad3)}]};}if(_0xf89910===_0x569980(0x12a)){let {alias:_0x50437d,task:_0x215ab0,priority:_0x45505b}=_0x81fc24,_0x4ddedd=await P(_0x569980(0x129),{'alias':_0x50437d,'task':_0x215ab0,'priority':_0x45505b||_0x569980(0x100),'from_session':Z});return{'content':[{'type':_0x569980(0x137),'text':JSON[_0x569980(0x103)](_0x4ddedd)}]};}if(_0xf89910==='commhub_send_message'){let {alias:_0x4c0f55,message:_0x3dc41f}=_0x81fc24,_0x59cba1=await P(_0x569980(0xfa),{'alias':_0x4c0f55,'message':_0x3dc41f,'from_session':Z});return{'content':[{'type':_0x569980(0x137),'text':JSON[_0x569980(0x103)](_0x59cba1)}]};}if(_0xf89910===_0x569980(0xd5)){let _0x20d755=await P(_0x569980(0x104),{});return{'content':[{'type':_0x569980(0x137),'text':JSON[_0x569980(0x103)](_0x20d755)}]};}return{'content':[{'type':_0x569980(0x137),'text':JSON[_0x569980(0x103)]({'error':_0x569980(0x121)})}]};});async function u(){const _0x2b3124=a0_0x36e548;let _0x46fe40=f+'/events/'+encodeURIComponent(Z),_0x2e93a2={};if(X)_0x2e93a2[_0x2b3124(0x109)]=_0x2b3124(0xed)+X;Y(_0x2b3124(0xda)+_0x46fe40);while(!0x0){try{let _0x3a27fa=await fetch(_0x46fe40,{'headers':_0x2e93a2});if(!_0x3a27fa['ok']){Y(_0x2b3124(0xe1)+_0x3a27fa[_0x2b3124(0xba)]+'\x20'+_0x3a27fa[_0x2b3124(0xea)]),await h(0x1388);continue;}let _0x422278=_0x3a27fa[_0x2b3124(0xc5)]['getReader'](),_0x49f707=new TextDecoder(),_0x128b9d='';while(!0x0){let {done:_0x53dcd7,value:_0x548d1a}=await _0x422278[_0x2b3124(0x135)]();if(_0x53dcd7)break;_0x128b9d+=_0x49f707['decode'](_0x548d1a,{'stream':!0x0});let _0x41f7cc=_0x128b9d['split']('\x0a\x0a');_0x128b9d=_0x41f7cc[_0x2b3124(0x125)]()||'';for(let _0x3beadf of _0x41f7cc){let _0x173673=_0x3beadf[_0x2b3124(0xbb)]('\x0a')[_0x2b3124(0x12b)](_0x183992=>_0x183992[_0x2b3124(0xc6)](_0x2b3124(0xd1)));if(!_0x173673)continue;try{let _0x5b442e=JSON[_0x2b3124(0x10b)](_0x173673[_0x2b3124(0xae)](0x6));await S(_0x5b442e);}catch(_0x25fee4){Y(_0x2b3124(0x113)+_0x25fee4);}}}Y(_0x2b3124(0xe7));}catch(_0xb41f17){Y('SSE\x20connection\x20error:\x20'+_0xb41f17);}await h(0xbb8);}}async function S(_0x5e3788){const _0x1e790d=a0_0x36e548;if(_0x5e3788[_0x1e790d(0x12d)]===_0x1e790d(0xdd)){Y(_0x1e790d(0xe4)+Z+'\x22');return;}if(_0x5e3788['type']==='new_message'){if(Y(_0x1e790d(0x130)+_0x5e3788['from']+':\x20'+_0x5e3788[_0x1e790d(0xd6)][_0x1e790d(0xae)](0x0,0x3c)),await K[_0x1e790d(0xce)]({'method':_0x1e790d(0xee),'params':{'content':_0x5e3788['message'],'meta':{'sender':_0x5e3788[_0x1e790d(0xbf)]||_0x1e790d(0xaf),'sender_id':_0x1e790d(0xd0),'user':_0x5e3788[_0x1e790d(0xbf)]||'hub','priority':_0x1e790d(0x100)}}}),_0x5e3788['message_id'])await P(_0x1e790d(0xc4),{'alias':Z,'message_id':_0x5e3788[_0x1e790d(0xac)]});return;}if(_0x5e3788[_0x1e790d(0x12d)]===_0x1e790d(0x124)||_0x5e3788[_0x1e790d(0x12d)]===_0x1e790d(0xfd)){Y('←\x20'+_0x5e3788[_0x1e790d(0x12d)]+_0x1e790d(0xca)+_0x5e3788[_0x1e790d(0x136)]+'\x20priority='+(_0x5e3788['priority']||_0x1e790d(0x100)));let _0x319bcd=await P(_0x1e790d(0xdf),{'alias':Z,'limit':0x5});if(_0x319bcd?.['ok']&&_0x319bcd[_0x1e790d(0xb5)]?.[_0x1e790d(0x10f)]>0x0)for(let _0x4519a7 of _0x319bcd[_0x1e790d(0xb5)]){let _0x5a92b4={'sender':_0x4519a7[_0x1e790d(0xdc)]||_0x1e790d(0xaf),'sender_id':_0x1e790d(0xd0),'user':_0x4519a7[_0x1e790d(0xdc)]||_0x1e790d(0xaf),'task_id':_0x4519a7['id'],'priority':_0x4519a7[_0x1e790d(0x114)]||_0x1e790d(0x100)};k['set'](_0x4519a7['id'],_0x4519a7[_0x1e790d(0xdc)]||_0x1e790d(0xaf)),await K['notification']({'method':_0x1e790d(0xee),'params':{'content':_0x4519a7[_0x1e790d(0x138)],'meta':_0x5a92b4}}),Y(_0x1e790d(0x110)+_0x4519a7['id'][_0x1e790d(0xae)](0x0,0x8)+_0x1e790d(0x132)+_0x4519a7[_0x1e790d(0xdc)]+':\x20'+_0x4519a7[_0x1e790d(0x138)][_0x1e790d(0xae)](0x0,0x3c)),await P(_0x1e790d(0xc4),{'alias':Z,'message_id':_0x4519a7['id']});}}}async function A(){const _0x2803ad=a0_0x36e548;let _0x5b8eb3=new a0_0x2099b0();await K['connect'](_0x5b8eb3),Y('MCP\x20stdio\x20connected'),Y(_0x2803ad(0x134)),u()[_0x2803ad(0x122)](_0x2ad811=>Y('SSE\x20fatal:\x20'+_0x2ad811)),P(_0x2803ad(0x133),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x4755b6(),'hostname':a0_0x4755b6(),'agent':_0x2803ad(0xe2),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x2803ad(0x117)](()=>Y(_0x2803ad(0xb1)+Z+_0x2803ad(0xb2)+w[_0x2803ad(0xae)](0x0,0x8)+')'))[_0x2803ad(0x122)](_0x463f49=>Y(_0x2803ad(0xfb)+_0x463f49)),setInterval(()=>{const _0x5ec367=_0x2803ad;P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x4755b6(),'hostname':a0_0x4755b6(),'agent':'claude-code','project_dir':process[_0x5ec367(0x108)](),'tmux_name':j||void 0x0})[_0x5ec367(0x122)](_0x40b5bd=>Y(_0x5ec367(0x10a)+_0x40b5bd));},0x2bf20),Y(_0x2803ad(0xb4));}A()['catch'](_0x1e58ab=>{const _0x2aae5b=a0_0x36e548;Y(_0x2aae5b(0xb0)+_0x1e58ab),process[_0x2aae5b(0xf9)](0x1);});async function N(){const _0x1604d1=a0_0x36e548;Y(_0x1604d1(0xb7)),await P(_0x1604d1(0x133),{'resume_id':w,'alias':Z,'status':'error','task':'session\x20disconnected'})[_0x1604d1(0x122)](()=>{}),process['exit'](0x0);}process[a0_0x36e548(0xcf)]['on']('end',()=>N()),process['on'](a0_0x36e548(0xd8),()=>N()),process['on'](a0_0x36e548(0x10e),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.1.7-preview.
|
|
3
|
+
"version": "2.1.7-preview.1",
|
|
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",
|