@sleep2agi/agent-network 2.0.0-preview.9 → 2.0.0
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 +99 -20
- 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 +10 -8
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x4cdf14=a0_0x5a49;(function(_0x404bc7,_0xa80994){const _0x17ca59=a0_0x5a49,_0x4359b3=_0x404bc7();while(!![]){try{const _0x2603f7=-parseInt(_0x17ca59(0xb8))/0x1+-parseInt(_0x17ca59(0x94))/0x2+-parseInt(_0x17ca59(0x92))/0x3*(parseInt(_0x17ca59(0x96))/0x4)+parseInt(_0x17ca59(0xa1))/0x5+-parseInt(_0x17ca59(0x8f))/0x6*(-parseInt(_0x17ca59(0x89))/0x7)+parseInt(_0x17ca59(0xb6))/0x8*(parseInt(_0x17ca59(0xa7))/0x9)+parseInt(_0x17ca59(0x8d))/0xa;if(_0x2603f7===_0xa80994)break;else _0x4359b3['push'](_0x4359b3['shift']());}catch(_0x2fa141){_0x4359b3['push'](_0x4359b3['shift']());}}}(a0_0x4a18,0x4ef28));import{EventEmitter as a0_0x4054c9}from'events';import{hostname as a0_0x1022ed}from'os';function a0_0x5a49(_0x1679ef,_0x58da0b){_0x1679ef=_0x1679ef-0x84;const _0x4a1824=a0_0x4a18();let _0x5a496c=_0x4a1824[_0x1679ef];return _0x5a496c;}class T extends a0_0x4054c9{[a0_0x4cdf14(0xa5)];[a0_0x4cdf14(0xad)];[a0_0x4cdf14(0x85)];[a0_0x4cdf14(0x87)];[a0_0x4cdf14(0xa8)];['heartbeatInterval'];[a0_0x4cdf14(0xaf)];[a0_0x4cdf14(0xce)];['sseAbort'];[a0_0x4cdf14(0x8b)]=!0x1;constructor(_0x597958){const _0x4220da=a0_0x4cdf14;super();if(this['url']=_0x597958[_0x4220da(0xa5)][_0x4220da(0xc2)](/\/$/,''),this[_0x4220da(0xad)]=_0x597958[_0x4220da(0xad)],this[_0x4220da(0x85)]=_0x597958[_0x4220da(0x85)],this[_0x4220da(0x87)]=_0x597958['agent']||_0x4220da(0x8c),this[_0x4220da(0xa8)]=_0x4220da(0x98)+_0x597958[_0x4220da(0xad)]+'-'+Date[_0x4220da(0xc5)]()['toString'](0x24),this[_0x4220da(0xd5)]=_0x597958[_0x4220da(0xd5)]??0x2bf20,this[_0x4220da(0xaf)]=_0x597958[_0x4220da(0xaf)]??0xbb8,_0x597958[_0x4220da(0xb3)]!==!0x1)this[_0x4220da(0xb0)]();}[a0_0x4cdf14(0xac)](_0x20bbd5){const _0x408413=a0_0x4cdf14;console[_0x408413(0xac)]('['+new Date()[_0x408413(0xba)]()['slice'](0x0,0x8)+']\x20[commhub:'+this[_0x408413(0xad)]+']\x20'+_0x20bbd5);}async[a0_0x4cdf14(0xbb)](_0x1e6db2,_0x5ef0f9){const _0x5b0f46=a0_0x4cdf14;let _0x15c380={'Content-Type':_0x5b0f46(0xc0),'Accept':'application/json,\x20text/event-stream'};if(this[_0x5b0f46(0x85)])_0x15c380[_0x5b0f46(0xbf)]=_0x5b0f46(0xa6)+this[_0x5b0f46(0x85)];let _0x512471=await(await fetch(this['url']+_0x5b0f46(0xae),{'method':'POST','headers':_0x15c380,'body':JSON[_0x5b0f46(0x8a)]({'jsonrpc':_0x5b0f46(0x9a),'id':Date[_0x5b0f46(0xc5)](),'method':'tools/call','params':{'name':_0x1e6db2,'arguments':_0x5ef0f9}})}))[_0x5b0f46(0xd4)](),_0x983d1d=_0x512471[_0x5b0f46(0x8e)](/data: (.+)/),_0x22c2ac=_0x983d1d?JSON[_0x5b0f46(0xcc)](_0x983d1d[0x1]):JSON[_0x5b0f46(0xcc)](_0x512471),_0x331c65=_0x22c2ac?.[_0x5b0f46(0xb5)]?.['content']?.[0x0]?.['text'];return _0x331c65?JSON[_0x5b0f46(0xcc)](_0x331c65):_0x22c2ac;}async[a0_0x4cdf14(0xb0)](){const _0x3854da=a0_0x4cdf14;if(this[_0x3854da(0x8b)])return;this['running']=!0x0,await this[_0x3854da(0xb7)](_0x3854da(0xd2)),this[_0x3854da(0xac)](_0x3854da(0xbd)),this['heartbeatTimer']=setInterval(()=>{const _0x43b03=_0x3854da;this[_0x43b03(0xb7)](_0x43b03(0xd2))[_0x43b03(0xca)](_0x3300a4=>this[_0x43b03(0xac)]('heartbeat\x20failed:\x20'+_0x3300a4[_0x43b03(0xcb)]));},this[_0x3854da(0xd5)]),this[_0x3854da(0xa3)]();}async[a0_0x4cdf14(0xc6)](){const _0x3fd43e=a0_0x4cdf14;if(this[_0x3fd43e(0x8b)]=!0x1,this[_0x3fd43e(0xc3)]?.['abort'](),this[_0x3fd43e(0xce)])clearInterval(this[_0x3fd43e(0xce)]);await this['status'](_0x3fd43e(0x86))[_0x3fd43e(0xca)](()=>{}),this[_0x3fd43e(0xac)](_0x3fd43e(0x84));}async['send'](_0x42df91,_0xdaf7fa,_0x182d12=a0_0x4cdf14(0xd0)){const _0x3c8625=a0_0x4cdf14;return this[_0x3c8625(0xbb)](_0x3c8625(0xa4),{'alias':_0x42df91,'task':_0xdaf7fa,'priority':_0x182d12,'from_session':this[_0x3c8625(0xad)]});}async['message'](_0x26fb8,_0x3ab440){const _0x3b2355=a0_0x4cdf14;return this[_0x3b2355(0xbb)](_0x3b2355(0xc4),{'alias':_0x26fb8,'message':_0x3ab440,'from_session':this['alias']});}async[a0_0x4cdf14(0x99)](_0x5864c2,_0xfa5d14,_0xf06ab1=a0_0x4cdf14(0xd3)){return this['call']('reply',{'task_id':_0x5864c2,'text':_0xfa5d14,'status':_0xf06ab1});}async[a0_0x4cdf14(0xb7)](_0x3a0a50,_0x49a5b4){const _0x271d89=a0_0x4cdf14;return this[_0x271d89(0xbb)](_0x271d89(0x9f),{'resume_id':this[_0x271d89(0xa8)],'alias':this['alias'],'status':_0x3a0a50,'server':a0_0x1022ed(),'hostname':a0_0x1022ed(),'agent':this['agent'],'project_dir':process[_0x271d89(0x91)](),..._0x49a5b4});}async['getAllStatus'](){const _0x3e8846=a0_0x4cdf14;return this[_0x3e8846(0xbb)](_0x3e8846(0xab),{});}async[a0_0x4cdf14(0xbe)](_0x2e5031,_0x472d30){const _0x51c961=a0_0x4cdf14;return this[_0x51c961(0xbb)](_0x51c961(0xbe),{'message':_0x2e5031,'filter_server':_0x472d30?.[_0x51c961(0xb9)],'filter_status':_0x472d30?.[_0x51c961(0xb7)]});}async[a0_0x4cdf14(0xa3)](){const _0x2faef1=a0_0x4cdf14;let _0x47edb5=encodeURIComponent(this[_0x2faef1(0xad)]),_0x16a640=this[_0x2faef1(0xa5)]+'/events/'+_0x47edb5,_0x1add11=this[_0x2faef1(0xaf)];while(this['running']){try{this['sseAbort']=new AbortController();let _0x5ae88f={'Accept':_0x2faef1(0x9d)};if(this[_0x2faef1(0x85)])_0x5ae88f[_0x2faef1(0xbf)]='Bearer\x20'+this[_0x2faef1(0x85)];let _0x191249=await fetch(_0x16a640,{'headers':_0x5ae88f,'signal':this[_0x2faef1(0xc3)]['signal']});if(!_0x191249['ok']||!_0x191249['body']){this[_0x2faef1(0xac)](_0x2faef1(0xc1)+_0x191249[_0x2faef1(0xb7)]),await this[_0x2faef1(0x90)](_0x1add11),_0x1add11=Math['min'](_0x1add11*1.5,0xea60);continue;}_0x1add11=this[_0x2faef1(0xaf)];let _0x3f3b3f=_0x191249[_0x2faef1(0xbc)][_0x2faef1(0xcf)](),_0x381112=new TextDecoder(),_0xa5f64d='';while(this['running']){let {done:_0x44f739,value:_0x5b299a}=await _0x3f3b3f[_0x2faef1(0xb2)]();if(_0x44f739)break;_0xa5f64d+=_0x381112['decode'](_0x5b299a,{'stream':!0x0});let _0x455829=_0xa5f64d[_0x2faef1(0xa9)]('\x0a');_0xa5f64d=_0x455829[_0x2faef1(0xc7)]()||'';for(let _0x3de177 of _0x455829){if(!_0x3de177['startsWith'](_0x2faef1(0xb4)))continue;try{let _0x22d0a1=JSON[_0x2faef1(0xcc)](_0x3de177['slice'](0x6));if(_0x22d0a1[_0x2faef1(0xb1)]===_0x2faef1(0x88)){this[_0x2faef1(0xac)](_0x2faef1(0xc8)),this[_0x2faef1(0x9e)]('connected');continue;}if(_0x22d0a1[_0x2faef1(0xb1)]===_0x2faef1(0xc9)||_0x22d0a1[_0x2faef1(0xb1)]==='new_message'||_0x22d0a1[_0x2faef1(0xb1)]==='broadcast')await this[_0x2faef1(0x95)]();}catch{}}}}catch(_0x42981d){if(_0x42981d[_0x2faef1(0x93)]==='AbortError')break;this[_0x2faef1(0x9e)]('error',_0x42981d),this[_0x2faef1(0xac)](_0x2faef1(0xa0)+_0x42981d[_0x2faef1(0xcb)]);}if(this['running'])this['emit'](_0x2faef1(0x84)),this[_0x2faef1(0xac)](_0x2faef1(0x9c)+_0x1add11/0x3e8+_0x2faef1(0xa2)),await this['sleep'](_0x1add11),_0x1add11=Math[_0x2faef1(0x97)](_0x1add11*1.5,0xea60);}}async['processInbox'](){const _0x29680f=a0_0x4cdf14;try{let _0x1b2684=(await this[_0x29680f(0xbb)](_0x29680f(0x9b),{'alias':this[_0x29680f(0xad)],'limit':0xa}))?.['messages']||[];for(let _0x281235 of _0x1b2684)await this[_0x29680f(0xbb)](_0x29680f(0xcd),{'alias':this['alias'],'message_id':_0x281235['id']}),this[_0x29680f(0xac)]('←\x20'+_0x281235['from_session']+':\x20'+_0x281235[_0x29680f(0xd1)]['slice'](0x0,0x3c)),this[_0x29680f(0x9e)]('task',_0x281235),this[_0x29680f(0x9e)](_0x29680f(0xcb),_0x281235);}catch(_0x3ea950){this[_0x29680f(0xac)](_0x29680f(0xaa)+_0x3ea950['message']);}}[a0_0x4cdf14(0x90)](_0x5d3881){return new Promise(_0x54d753=>setTimeout(_0x54d753,_0x5d3881));}}var $=T;export{$ as default,T as CommHub};function a0_0x4a18(){const _0x5efd58=['connected','14yuJFBK','stringify','running','sdk','3551230SbJcPM','match','246426LwJIky','sleep','cwd','39iyVRRI','name','1027584ECyddq','processInbox','3100wTVAro','min','sdk-','reply','2.0','get_inbox','SSE\x20reconnecting\x20in\x20','text/event-stream','emit','report_status','SSE\x20error:\x20','1831050KwQqHA','s...','connectSSE','send_task','url','Bearer\x20','2778507pwIHGS','resumeId','split','inbox\x20error:\x20','get_all_status','log','alias','/mcp','reconnectDelay','connect','type','read','autoConnect','data:\x20','result','8YyIqgv','status','264963fMNguF','server','toTimeString','call','body','registered','broadcast','Authorization','application/json','SSE\x20failed:\x20','replace','sseAbort','send_message','now','disconnect','pop','SSE\x20connected','new_task','catch','message','parse','ack_inbox','heartbeatTimer','getReader','normal','content','idle','completed','text','heartbeatInterval','disconnected','token','offline','agent'];a0_0x4a18=function(){return _0x5efd58;};return a0_0x4a18();}
|
package/dist/src/node-server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
const a0_0x344305=a0_0x57e0;(function(_0x3a5e4a,_0x5d6927){const _0x4065c5=a0_0x57e0,_0x8bad6a=_0x3a5e4a();while(!![]){try{const _0x3a2071=parseInt(_0x4065c5(0x17b))/0x1*(parseInt(_0x4065c5(0x129))/0x2)+parseInt(_0x4065c5(0x12b))/0x3*(-parseInt(_0x4065c5(0x158))/0x4)+parseInt(_0x4065c5(0x15e))/0x5+-parseInt(_0x4065c5(0x184))/0x6*(parseInt(_0x4065c5(0x139))/0x7)+parseInt(_0x4065c5(0x186))/0x8*(parseInt(_0x4065c5(0x16c))/0x9)+parseInt(_0x4065c5(0x173))/0xa*(-parseInt(_0x4065c5(0x183))/0xb)+parseInt(_0x4065c5(0x127))/0xc;if(_0x3a2071===_0x5d6927)break;else _0x8bad6a['push'](_0x8bad6a['shift']());}catch(_0x3234ba){_0x8bad6a['push'](_0x8bad6a['shift']());}}}(a0_0x2ac8,0x33ea3));import{readFileSync as a0_0x50af8b,existsSync as a0_0x31c8b9}from'fs';import{join as a0_0x470b38}from'path';import{hostname as a0_0x4ded6d}from'os';import{execSync as a0_0x102278}from'child_process';import{Server as a0_0x48847b}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x103f7b}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x523fbe,CallToolRequestSchema as a0_0x1975f7}from'@modelcontextprotocol/sdk/types.js';function p(_0x5435e1){const _0x26ef96=a0_0x57e0;if(!a0_0x31c8b9(_0x5435e1))return;for(let _0x294ccd of a0_0x50af8b(_0x5435e1,_0x26ef96(0x193))['split']('\x0a')){let _0x5a3728=_0x294ccd['trim']();if(!_0x5a3728||_0x5a3728[_0x26ef96(0x1a3)]('#'))continue;let _0x127bce=_0x5a3728[_0x26ef96(0x14b)]('=');if(_0x127bce<0x0)continue;let _0x465756=_0x5a3728[_0x26ef96(0x159)](0x0,_0x127bce)[_0x26ef96(0x176)](),_0x54903c=_0x5a3728[_0x26ef96(0x159)](_0x127bce+0x1)[_0x26ef96(0x176)]()[_0x26ef96(0x155)](/^["']|["']$/g,'');if(!process.env[_0x465756])process.env[_0x465756]=_0x54903c;}}var C=process.env.HOME||'~',T=a0_0x470b38(C,a0_0x344305(0x195));p(a0_0x470b38(T,a0_0x344305(0x1a5)));var L=process[a0_0x344305(0x135)]()['replace'](/\//g,'-');p(a0_0x470b38(T,L,'.env'));function U(){const _0x195b68=a0_0x344305;try{return a0_0x102278(_0x195b68(0x172),{'encoding':_0x195b68(0x193),'timeout':0x7d0})['trim']();}catch{return'';}}function c(){const _0x2650a6=a0_0x344305;try{let _0x319fb8=a0_0x470b38(C,_0x2650a6(0x17e),_0x2650a6(0x13c));if(a0_0x31c8b9(_0x319fb8))return JSON[_0x2650a6(0x128)](a0_0x50af8b(_0x319fb8,_0x2650a6(0x193)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x344305(0x182)]||a0_0x344305(0x19e),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x4ded6d(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x344305(0x194)](),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x2e5899){const _0x2e6d19=a0_0x344305;let _0x32810f=new Date()['toTimeString']()[_0x2e6d19(0x159)](0x0,0x8);process['stderr']['write']('['+_0x32810f+_0x2e6d19(0x177)+_0x2e5899+'\x0a');}function h(_0x12a626){return new Promise(_0x272652=>setTimeout(_0x272652,_0x12a626));}function a0_0x57e0(_0x2e8cdf,_0x3d6fe8){_0x2e8cdf=_0x2e8cdf-0x11f;const _0x2ac8c0=a0_0x2ac8();let _0x57e08c=_0x2ac8c0[_0x2e8cdf];return _0x57e08c;}Y(a0_0x344305(0x198)+D+a0_0x344305(0x138)+Z+a0_0x344305(0x12a)+w['slice'](0x0,0x8)+a0_0x344305(0x192)+(f||'none')+a0_0x344305(0x19c)+process['cwd']()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x48847b({'name':a0_0x344305(0x1a4),'version':a0_0x344305(0x160)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x344305(0x14e),a0_0x344305(0x17a),a0_0x344305(0x1ac),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Session\x20alias:\x20'+Z][a0_0x344305(0x161)]('\x0a')});K[a0_0x344305(0x134)](a0_0x523fbe,async()=>({'tools':[{'name':'commhub_reply','description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x344305(0x140),'description':a0_0x344305(0x14c)},'text':{'type':a0_0x344305(0x140),'description':a0_0x344305(0x199)},'status':{'type':a0_0x344305(0x140),'enum':[a0_0x344305(0x146),'failed',a0_0x344305(0x16d),a0_0x344305(0x151),a0_0x344305(0x1ad),a0_0x344305(0x170)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x344305(0x174)]}},{'name':a0_0x344305(0x14d),'description':a0_0x344305(0x1a1),'inputSchema':{'type':'object','properties':{'status':{'type':'string','enum':[a0_0x344305(0x143),'idle',a0_0x344305(0x151),'error']},'task':{'type':a0_0x344305(0x140),'description':a0_0x344305(0x1a2)},'progress':{'type':'number','description':a0_0x344305(0x188)}},'required':[a0_0x344305(0x181)]}},{'name':'commhub_send_task','description':a0_0x344305(0x1a8),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x344305(0x140),'description':a0_0x344305(0x11f)},'task':{'type':a0_0x344305(0x140),'description':a0_0x344305(0x157)},'priority':{'type':'string','enum':[a0_0x344305(0x15b),a0_0x344305(0x124),a0_0x344305(0x125)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x344305(0x149),a0_0x344305(0x19d)]}},{'name':a0_0x344305(0x122),'description':a0_0x344305(0x15d),'inputSchema':{'type':a0_0x344305(0x163),'properties':{'alias':{'type':a0_0x344305(0x140),'description':a0_0x344305(0x11f)},'message':{'type':'string','description':a0_0x344305(0x14a)}},'required':[a0_0x344305(0x149),'message']}},{'name':a0_0x344305(0x13b),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x344305(0x163),'properties':{}}}]}));async function P(_0x500f15,_0x16bd77){const _0xd2758f=a0_0x344305;let _0x5bd512=await fetch(D+_0xd2758f(0x196),{'method':_0xd2758f(0x191),'headers':{'Content-Type':_0xd2758f(0x12f),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0xd2758f(0x137)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0xd2758f(0x130),'id':0x1,'method':_0xd2758f(0x16e),'params':{'protocolVersion':_0xd2758f(0x15a),'capabilities':{},'clientInfo':{'name':_0xd2758f(0x1a4),'version':_0xd2758f(0x160)}}})});if(!_0x5bd512['ok']){let _0x1ef240=await _0x5bd512[_0xd2758f(0x174)]();return Y(_0xd2758f(0x18f)+_0x5bd512[_0xd2758f(0x181)]+'\x20'+_0x1ef240[_0xd2758f(0x159)](0x0,0x64)),{'ok':!0x1,'error':_0xd2758f(0x1a9)+_0x5bd512[_0xd2758f(0x181)]};}await _0x5bd512[_0xd2758f(0x174)]();let _0x4041a5=(await(await fetch(D+_0xd2758f(0x196),{'method':_0xd2758f(0x191),'headers':{'Content-Type':_0xd2758f(0x12f),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0xd2758f(0x13a)]({'jsonrpc':_0xd2758f(0x130),'id':0x2,'method':_0xd2758f(0x190),'params':{'name':_0x500f15,'arguments':_0x16bd77}})}))[_0xd2758f(0x174)]())[_0xd2758f(0x15f)]('\x0a')[_0xd2758f(0x1aa)](_0x1a4ae8=>_0x1a4ae8[_0xd2758f(0x1a3)]('data:\x20'));if(_0x4041a5){let _0x13974e=JSON[_0xd2758f(0x128)](_0x4041a5[_0xd2758f(0x159)](0x6));return _0x13974e?.[_0xd2758f(0x18b)]?.[_0xd2758f(0x142)]?.[0x0]?.[_0xd2758f(0x174)]?JSON[_0xd2758f(0x128)](_0x13974e[_0xd2758f(0x18b)][_0xd2758f(0x142)][0x0][_0xd2758f(0x174)]):_0x13974e;}return{'ok':!0x1,'error':_0xd2758f(0x1a6)};}K[a0_0x344305(0x134)](a0_0x1975f7,async _0x1457f9=>{const _0x45725e=a0_0x344305;let {name:_0x16e683,arguments:_0x344eb4}=_0x1457f9['params'];if(_0x16e683===_0x45725e(0x18e)){let {task_id:_0x3d6518,text:_0x5aa32f,status:_0x27bffa}=_0x344eb4;if(_0x27bffa===_0x45725e(0x146)||_0x27bffa===_0x45725e(0x189)||_0x27bffa==='cancelled'){let _0xfafdac=_0x27bffa==='completed'?_0x45725e(0x156):_0x27bffa,_0x4c5784=_0x3d6518?k[_0x45725e(0x17d)](_0x3d6518)||_0x45725e(0x182):'hub',_0x34d504=await P(_0x45725e(0x147),{'alias':_0x4c5784,'text':_0x5aa32f,'in_reply_to':_0x3d6518||void 0x0,'status':_0xfafdac,'from_session':Z});if(_0x3d6518)k[_0x45725e(0x18c)](_0x3d6518);return{'content':[{'type':'text','text':JSON[_0x45725e(0x13a)](_0x34d504)}]};}let _0x544a7e=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x27bffa===_0x45725e(0x151)?'blocked':_0x27bffa===_0x45725e(0x1ad)?'error':_0x45725e(0x143),'task':_0x5aa32f[_0x45725e(0x159)](0x0,0xc8),'output':_0x5aa32f});return{'content':[{'type':_0x45725e(0x174),'text':JSON[_0x45725e(0x13a)](_0x544a7e)}]};}if(_0x16e683===_0x45725e(0x14d)){let {status:_0x3dd17e,task:_0x49c30e,progress:_0x750c5e}=_0x344eb4,_0x2bb5bd=await P(_0x45725e(0x13f),{'resume_id':w,'alias':Z,'status':_0x3dd17e,'task':_0x49c30e,'progress':_0x750c5e});return{'content':[{'type':'text','text':JSON[_0x45725e(0x13a)](_0x2bb5bd)}]};}if(_0x16e683==='commhub_send_task'){let {alias:_0x13ad6a,task:_0x5c5554,priority:_0x495756}=_0x344eb4,_0x539af7=await P(_0x45725e(0x153),{'alias':_0x13ad6a,'task':_0x5c5554,'priority':_0x495756||'normal','from_session':Z});return{'content':[{'type':_0x45725e(0x174),'text':JSON[_0x45725e(0x13a)](_0x539af7)}]};}if(_0x16e683==='commhub_send_message'){let {alias:_0x560867,message:_0x353bc3}=_0x344eb4,_0xebe8b6=await P('send_message',{'alias':_0x560867,'message':_0x353bc3,'from_session':Z});return{'content':[{'type':_0x45725e(0x174),'text':JSON[_0x45725e(0x13a)](_0xebe8b6)}]};}if(_0x16e683===_0x45725e(0x13b)){let _0x502dda=await P(_0x45725e(0x178),{});return{'content':[{'type':'text','text':JSON[_0x45725e(0x13a)](_0x502dda)}]};}return{'content':[{'type':_0x45725e(0x174),'text':JSON[_0x45725e(0x13a)]({'error':_0x45725e(0x16f)})}]};});async function v(){const _0xc862cf=a0_0x344305;let _0x2985fe=D+'/events/'+encodeURIComponent(Z),_0x520e89={};if(X)_0x520e89['Authorization']=_0xc862cf(0x137)+X;Y(_0xc862cf(0x185)+_0x2985fe);while(!0x0){try{let _0x52a8da=await fetch(_0x2985fe,{'headers':_0x520e89});if(!_0x52a8da['ok']){Y('SSE\x20error:\x20'+_0x52a8da[_0xc862cf(0x181)]+'\x20'+_0x52a8da[_0xc862cf(0x133)]),await h(0x1388);continue;}let _0x3b9816=_0x52a8da[_0xc862cf(0x19a)][_0xc862cf(0x164)](),_0x111078=new TextDecoder(),_0x46f64a='';while(!0x0){let {done:_0x3abbe9,value:_0x53d8c7}=await _0x3b9816[_0xc862cf(0x126)]();if(_0x3abbe9)break;_0x46f64a+=_0x111078[_0xc862cf(0x17c)](_0x53d8c7,{'stream':!0x0});let _0x2ed715=_0x46f64a[_0xc862cf(0x15f)]('\x0a\x0a');_0x46f64a=_0x2ed715[_0xc862cf(0x175)]()||'';for(let _0x27468e of _0x2ed715){let _0x55429d=_0x27468e[_0xc862cf(0x15f)]('\x0a')[_0xc862cf(0x1aa)](_0x1cc534=>_0x1cc534[_0xc862cf(0x1a3)](_0xc862cf(0x12d)));if(!_0x55429d)continue;try{let _0x47ce4e=JSON[_0xc862cf(0x128)](_0x55429d[_0xc862cf(0x159)](0x6));await u(_0x47ce4e);}catch(_0x32504d){Y(_0xc862cf(0x145)+_0x32504d);}}}Y(_0xc862cf(0x148));}catch(_0x368c0b){Y(_0xc862cf(0x132)+_0x368c0b);}await h(0xbb8);}}async function u(_0x53df99){const _0x1258fa=a0_0x344305;if(_0x53df99['type']==='connected'){Y(_0x1258fa(0x166)+Z+'\x22');return;}if(_0x53df99[_0x1258fa(0x1a7)]==='new_message'){if(Y(_0x1258fa(0x150)+_0x53df99[_0x1258fa(0x19b)]+':\x20'+_0x53df99[_0x1258fa(0x16b)][_0x1258fa(0x159)](0x0,0x3c)),await K[_0x1258fa(0x16a)]({'method':'notifications/claude/channel','params':{'content':_0x53df99['message'],'meta':{'sender':_0x53df99[_0x1258fa(0x19b)]||_0x1258fa(0x182),'sender_id':'commhub','user':_0x53df99[_0x1258fa(0x19b)]||_0x1258fa(0x182),'priority':'normal'}}}),_0x53df99[_0x1258fa(0x152)])await P(_0x1258fa(0x123),{'alias':Z,'message_id':_0x53df99[_0x1258fa(0x152)]});return;}if(_0x53df99[_0x1258fa(0x1a7)]===_0x1258fa(0x15c)||_0x53df99[_0x1258fa(0x1a7)]===_0x1258fa(0x131)){Y('←\x20'+_0x53df99[_0x1258fa(0x1a7)]+_0x1258fa(0x13d)+_0x53df99[_0x1258fa(0x12e)]+_0x1258fa(0x169)+(_0x53df99['priority']||_0x1258fa(0x124)));let _0x3ec145=await P(_0x1258fa(0x120),{'alias':Z,'limit':0x5});if(_0x3ec145?.['ok']&&_0x3ec145[_0x1258fa(0x165)]?.[_0x1258fa(0x154)]>0x0)for(let _0x364f63 of _0x3ec145['messages']){let _0x4be15b={'sender':_0x364f63[_0x1258fa(0x168)]||_0x1258fa(0x182),'sender_id':_0x1258fa(0x187),'user':_0x364f63[_0x1258fa(0x168)]||_0x1258fa(0x182),'task_id':_0x364f63['id'],'priority':_0x364f63['priority']||_0x1258fa(0x124)};k[_0x1258fa(0x18d)](_0x364f63['id'],_0x364f63[_0x1258fa(0x168)]||_0x1258fa(0x182)),await K[_0x1258fa(0x16a)]({'method':'notifications/claude/channel','params':{'content':_0x364f63['content'],'meta':_0x4be15b}}),Y(_0x1258fa(0x141)+_0x364f63['id']['slice'](0x0,0x8)+'\x20from\x20'+_0x364f63[_0x1258fa(0x168)]+':\x20'+_0x364f63[_0x1258fa(0x142)][_0x1258fa(0x159)](0x0,0x3c)),await P(_0x1258fa(0x123),{'alias':Z,'message_id':_0x364f63['id']});}}}async function S(){const _0x153fa4=a0_0x344305;let _0x193e7a=new a0_0x103f7b();await K[_0x153fa4(0x14f)](_0x193e7a),Y('MCP\x20stdio\x20connected'),Y(_0x153fa4(0x179)),v()[_0x153fa4(0x180)](_0x34ac6d=>Y(_0x153fa4(0x167)+_0x34ac6d)),P(_0x153fa4(0x13f),{'resume_id':w,'alias':Z,'status':_0x153fa4(0x171),'server':a0_0x4ded6d(),'hostname':a0_0x4ded6d(),'agent':_0x153fa4(0x1a0),'project_dir':process[_0x153fa4(0x135)](),'tmux_name':f||void 0x0})['then'](()=>Y(_0x153fa4(0x12c)+Z+_0x153fa4(0x144)+w[_0x153fa4(0x159)](0x0,0x8)+')'))[_0x153fa4(0x180)](_0x24caba=>Y(_0x153fa4(0x19f)+_0x24caba)),setInterval(()=>{const _0x19617a=_0x153fa4;P('report_status',{'resume_id':w,'alias':Z,'status':_0x19617a(0x171),'server':a0_0x4ded6d(),'hostname':a0_0x4ded6d(),'agent':_0x19617a(0x1a0),'project_dir':process[_0x19617a(0x135)](),'tmux_name':f||void 0x0})[_0x19617a(0x180)](_0x4b8702=>Y(_0x19617a(0x17f)+_0x4b8702));},0x2bf20),Y(_0x153fa4(0x13e));}function a0_0x2ac8(){const _0xc903e0=['setRequestHandler','cwd','SIGINT','Bearer\x20','\x20ALIAS=','2541przLTE','stringify','commhub_get_all_status','config.json',':\x20inbox_count=','ready\x20—\x20waiting\x20for\x20events','report_status','string','→\x20injected\x20task\x20','content','working','\x22\x20(','parse\x20error:\x20','completed','send_reply','SSE\x20stream\x20ended,\x20reconnecting...','alias','Message\x20content','indexOf','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','commhub_report_status','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','connect','←\x20message\x20from\x20','blocked','message_id','send_task','length','replace','replied','Task\x20content','25788MMugxe','slice','2025-03-26','high','new_task','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','1477690RnAXcG','split','0.3.0','join','stdin','object','getReader','messages','SSE\x20connected\x20as\x20\x22','SSE\x20fatal:\x20','from_session','\x20priority=','notification','message','219852iIDZJX','cancelled','initialize','unknown\x20tool','in_progress','idle','tmux\x20display-message\x20-p\x20\x27#S\x27','654170wuXhCl','text','pop','trim',']\x20[commhub]\x20','get_all_status','starting\x20SSE\x20listener...','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','3949uwkQhp','decode','get','.anet','heartbeat\x20failed:\x20','catch','status','hub','11fmIumG','6954CipEom','connecting\x20to\x20','56hUvICF','commhub','Progress\x200-100','failed','shutting\x20down,\x20reporting\x20offline...','result','delete','set','commhub_reply','CommHub\x20init\x20failed:\x20','tools/call','POST','...\x20TMUX=','utf-8','randomUUID','.claude/channels/commhub','/mcp','end','ENV:\x20URL=','Reply\x20text\x20/\x20result\x20summary','body','from','\x20CWD=','task','http://127.0.0.1:9200','warning:\x20could\x20not\x20register:\x20','claude-code','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Current\x20task\x20description','startsWith','commhub-channel','.env','no\x20response','type','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','init\x20failed:\x20','find','fatal:\x20','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','error','SIGTERM','Target\x20session\x20alias','get_inbox','exit','commhub_send_message','ack_inbox','normal','low','read','3097260aHgSef','parse','62WVFcsX','\x20RESUME_ID=','69KfGmCg','registered\x20as\x20\x22','data:\x20','inbox_count','application/json','2.0','broadcast','SSE\x20connection\x20error:\x20','statusText'];a0_0x2ac8=function(){return _0xc903e0;};return a0_0x2ac8();}S()[a0_0x344305(0x180)](_0x36c71a=>{const _0x511dca=a0_0x344305;Y(_0x511dca(0x1ab)+_0x36c71a),process['exit'](0x1);});async function N(){const _0x46c136=a0_0x344305;Y(_0x46c136(0x18a)),await P(_0x46c136(0x13f),{'resume_id':w,'alias':Z,'status':'error','task':'session\x20disconnected'})[_0x46c136(0x180)](()=>{}),process[_0x46c136(0x121)](0x0);}process[a0_0x344305(0x162)]['on'](a0_0x344305(0x197),()=>N()),process['on'](a0_0x344305(0x1ae),()=>N()),process['on'](a0_0x344305(0x136),()=>N());
|
|
2
|
+
const a0_0x1bfcde=a0_0x3477;(function(_0x4735e4,_0x56291a){const _0x32fcb0=a0_0x3477,_0x4c7414=_0x4735e4();while(!![]){try{const _0x3cdf36=-parseInt(_0x32fcb0(0x24d))/0x1*(-parseInt(_0x32fcb0(0x215))/0x2)+-parseInt(_0x32fcb0(0x234))/0x3+-parseInt(_0x32fcb0(0x1d8))/0x4*(parseInt(_0x32fcb0(0x1e7))/0x5)+parseInt(_0x32fcb0(0x213))/0x6+parseInt(_0x32fcb0(0x24a))/0x7+-parseInt(_0x32fcb0(0x251))/0x8+-parseInt(_0x32fcb0(0x257))/0x9*(-parseInt(_0x32fcb0(0x1d9))/0xa);if(_0x3cdf36===_0x56291a)break;else _0x4c7414['push'](_0x4c7414['shift']());}catch(_0x29e40a){_0x4c7414['push'](_0x4c7414['shift']());}}}(a0_0x1d41,0x38ddb));import{readFileSync as a0_0x1b88b8,existsSync as a0_0x1e344c}from'fs';import{join as a0_0xf9833a}from'path';import{hostname as a0_0x4dcd02}from'os';import{execSync as a0_0x1b6641}from'child_process';import{Server as a0_0xc1fe57}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x90d41f}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x240108,CallToolRequestSchema as a0_0x3d1ab7}from'@modelcontextprotocol/sdk/types.js';function a0_0x1d41(){const _0x3d4c4b=['idle','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','unknown\x20tool','token','parse\x20error:\x20','commhub','Current\x20task\x20description','Reply\x20text\x20/\x20result\x20summary','commhub_reply','find','0.3.0','setRequestHandler','application/json,\x20text/event-stream','application/json','get','utf-8','Task\x20content','catch','blocked','CommHub\x20init\x20failed:\x20','split','type','string','\x22\x20(','slice','Bearer\x20','tmux\x20display-message\x20-p\x20\x27#S\x27','status','toTimeString','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','\x20RESUME_ID=','priority','239880zENqCB','replace','162jqkUiQ','claude-code','cwd','data:\x20','initialize','normal','stderr','from_session','messages','indexOf','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','failed','...\x20TMUX=','parse','http://127.0.0.1:9200','in_progress','low','hub','Target\x20session\x20alias','ack_inbox','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','length','report_status','commhub_send_message',']\x20[commhub]\x20','no\x20response','exit','.env','←\x20message\x20from\x20','message','commhub_send_task','438933BIFiQb','set','working','warning:\x20could\x20not\x20register:\x20','commhub_get_all_status','alias','replied','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','trim','heartbeat\x20failed:\x20','broadcast','from','commhub-channel','commhub_report_status','get_inbox','registered\x20as\x20\x22','Priority\x20(default:\x20normal)','body','SIGINT','statusText','get_all_status','none','324254xrOEJP','startsWith','connected','4161ftdegg','Message\x20content','send_reply','object','1641104aiQddb','cancelled','SSE\x20connection\x20error:\x20','ENV:\x20URL=','\x20priority=','send_task','20259fKUWFX','\x20PROJECT_ENV=','2.0','inbox_count','end','stringify','72764vYJJik','2170IpBPpY','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','notification','connect','send_message','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','shutting\x20down,\x20reporting\x20offline...','content','message_id','notifications/claude/channel','text','completed','/mcp','number','90YvXUKt','error','tools/call','2025-03-26','\x20from\x20','POST','pop','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','MCP\x20stdio\x20connected','\x20ALIAS=','SIGTERM','SSE\x20stream\x20ended,\x20reconnecting...'];a0_0x1d41=function(){return _0x3d4c4b;};return a0_0x1d41();}function a0_0x3477(_0x4cb252,_0x85363b){_0x4cb252=_0x4cb252-0x1d8;const _0x1d4143=a0_0x1d41();let _0x34779a=_0x1d4143[_0x4cb252];return _0x34779a;}function p(_0x2452fe){const _0x5aa658=a0_0x3477;if(!a0_0x1e344c(_0x2452fe))return;for(let _0x188a2a of a0_0x1b88b8(_0x2452fe,_0x5aa658(0x202))[_0x5aa658(0x207)]('\x0a')){let _0x356b85=_0x188a2a[_0x5aa658(0x23c)]();if(!_0x356b85||_0x356b85[_0x5aa658(0x24b)]('#'))continue;let _0x277f23=_0x356b85[_0x5aa658(0x21e)]('=');if(_0x277f23<0x0)continue;let _0xa61733=_0x356b85['slice'](0x0,_0x277f23)[_0x5aa658(0x23c)](),_0x548b01=_0x356b85['slice'](_0x277f23+0x1)[_0x5aa658(0x23c)]()[_0x5aa658(0x214)](/^["']|["']$/g,'');if(!process.env[_0xa61733])process.env[_0xa61733]=_0x548b01;}}var C=process.env.HOME||'~',T=a0_0xf9833a(C,'.claude/channels/commhub');p(a0_0xf9833a(T,a0_0x1bfcde(0x230)));var L=process[a0_0x1bfcde(0x217)]()['replace'](/\//g,'-');p(a0_0xf9833a(T,L,'.env'));function U(){const _0x30c373=a0_0x1bfcde;try{return a0_0x1b6641(_0x30c373(0x20d),{'encoding':_0x30c373(0x202),'timeout':0x7d0})['trim']();}catch{return'';}}function c(){const _0x141b69=a0_0x1bfcde;try{let _0x1c8451=a0_0xf9833a(C,'.anet','config.json');if(a0_0x1e344c(_0x1c8451))return JSON['parse'](a0_0x1b88b8(_0x1c8451,_0x141b69(0x202)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x1bfcde(0x226)]||a0_0x1bfcde(0x223),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x4dcd02(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto['randomUUID'](),X=process.env.COMMHUB_TOKEN||H[a0_0x1bfcde(0x1f6)]||'';function Y(_0x335d64){const _0x21ca9e=a0_0x1bfcde;let _0xa6cc2f=new Date()[_0x21ca9e(0x20f)]()[_0x21ca9e(0x20b)](0x0,0x8);process[_0x21ca9e(0x21b)]['write']('['+_0xa6cc2f+_0x21ca9e(0x22d)+_0x335d64+'\x0a');}function h(_0x1103f2){return new Promise(_0x51957a=>setTimeout(_0x51957a,_0x1103f2));}Y(a0_0x1bfcde(0x254)+D+a0_0x1bfcde(0x1f0)+Z+a0_0x1bfcde(0x211)+w['slice'](0x0,0x8)+a0_0x1bfcde(0x221)+(f||a0_0x1bfcde(0x249))+'\x20CWD='+process[a0_0x1bfcde(0x217)]()+a0_0x1bfcde(0x258)+L);var k=new Map(),K=new a0_0xc1fe57({'name':'commhub-channel','version':a0_0x1bfcde(0x1fd)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x1bfcde(0x210),a0_0x1bfcde(0x23b),a0_0x1bfcde(0x1de),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Session\x20alias:\x20'+Z]['join']('\x0a')});K[a0_0x1bfcde(0x1fe)](a0_0x240108,async()=>({'tools':[{'name':a0_0x1bfcde(0x1fb),'description':a0_0x1bfcde(0x1ee),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x1bfcde(0x209),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x1bfcde(0x209),'description':a0_0x1bfcde(0x1fa)},'status':{'type':a0_0x1bfcde(0x209),'enum':['completed',a0_0x1bfcde(0x220),a0_0x1bfcde(0x252),a0_0x1bfcde(0x205),a0_0x1bfcde(0x1e8),a0_0x1bfcde(0x224)],'description':a0_0x1bfcde(0x1f4)}},'required':[a0_0x1bfcde(0x1e3)]}},{'name':'commhub_report_status','description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x1bfcde(0x250),'properties':{'status':{'type':'string','enum':[a0_0x1bfcde(0x236),'idle',a0_0x1bfcde(0x205),a0_0x1bfcde(0x1e8)]},'task':{'type':a0_0x1bfcde(0x209),'description':a0_0x1bfcde(0x1f9)},'progress':{'type':a0_0x1bfcde(0x1e6),'description':'Progress\x200-100'}},'required':[a0_0x1bfcde(0x20e)]}},{'name':a0_0x1bfcde(0x233),'description':a0_0x1bfcde(0x1da),'inputSchema':{'type':a0_0x1bfcde(0x250),'properties':{'alias':{'type':a0_0x1bfcde(0x209),'description':a0_0x1bfcde(0x227)},'task':{'type':a0_0x1bfcde(0x209),'description':a0_0x1bfcde(0x203)},'priority':{'type':a0_0x1bfcde(0x209),'enum':['high',a0_0x1bfcde(0x21a),a0_0x1bfcde(0x225)],'description':a0_0x1bfcde(0x244)}},'required':['alias','task']}},{'name':a0_0x1bfcde(0x22c),'description':a0_0x1bfcde(0x21f),'inputSchema':{'type':a0_0x1bfcde(0x250),'properties':{'alias':{'type':a0_0x1bfcde(0x209),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x1bfcde(0x209),'description':a0_0x1bfcde(0x24e)}},'required':[a0_0x1bfcde(0x239),'message']}},{'name':'commhub_get_all_status','description':a0_0x1bfcde(0x229),'inputSchema':{'type':a0_0x1bfcde(0x250),'properties':{}}}]}));async function P(_0x316971,_0x3948fc){const _0x51b984=a0_0x1bfcde;let _0x2694a2=await fetch(D+_0x51b984(0x1e5),{'method':_0x51b984(0x1ec),'headers':{'Content-Type':_0x51b984(0x200),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x51b984(0x20c)+X}:{}},'body':JSON[_0x51b984(0x25c)]({'jsonrpc':'2.0','id':0x1,'method':_0x51b984(0x219),'params':{'protocolVersion':_0x51b984(0x1ea),'capabilities':{},'clientInfo':{'name':_0x51b984(0x240),'version':_0x51b984(0x1fd)}}})});if(!_0x2694a2['ok']){let _0x8da0c5=await _0x2694a2[_0x51b984(0x1e3)]();return Y(_0x51b984(0x206)+_0x2694a2[_0x51b984(0x20e)]+'\x20'+_0x8da0c5[_0x51b984(0x20b)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x2694a2[_0x51b984(0x20e)]};}await _0x2694a2[_0x51b984(0x1e3)]();let _0x31123b=(await(await fetch(D+_0x51b984(0x1e5),{'method':_0x51b984(0x1ec),'headers':{'Content-Type':_0x51b984(0x200),'Accept':_0x51b984(0x1ff),...X?{'Authorization':_0x51b984(0x20c)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x51b984(0x259),'id':0x2,'method':_0x51b984(0x1e9),'params':{'name':_0x316971,'arguments':_0x3948fc}})}))['text']())[_0x51b984(0x207)]('\x0a')['find'](_0xf78749=>_0xf78749[_0x51b984(0x24b)](_0x51b984(0x218)));if(_0x31123b){let _0x10da20=JSON['parse'](_0x31123b[_0x51b984(0x20b)](0x6));return _0x10da20?.['result']?.[_0x51b984(0x1e0)]?.[0x0]?.[_0x51b984(0x1e3)]?JSON['parse'](_0x10da20['result'][_0x51b984(0x1e0)][0x0][_0x51b984(0x1e3)]):_0x10da20;}return{'ok':!0x1,'error':_0x51b984(0x22e)};}K[a0_0x1bfcde(0x1fe)](a0_0x3d1ab7,async _0x5ec644=>{const _0x2ad2c=a0_0x1bfcde;let {name:_0x93baa8,arguments:_0x2c4815}=_0x5ec644['params'];if(_0x93baa8==='commhub_reply'){let {task_id:_0x4671f5,text:_0x22d80e,status:_0x15be96}=_0x2c4815;if(_0x15be96===_0x2ad2c(0x1e4)||_0x15be96===_0x2ad2c(0x220)||_0x15be96===_0x2ad2c(0x252)){let _0x2e5106=_0x15be96===_0x2ad2c(0x1e4)?_0x2ad2c(0x23a):_0x15be96,_0x1142b0=_0x4671f5?k[_0x2ad2c(0x201)](_0x4671f5)||_0x2ad2c(0x226):'hub',_0x1a838a=await P(_0x2ad2c(0x24f),{'alias':_0x1142b0,'text':_0x22d80e,'in_reply_to':_0x4671f5||void 0x0,'status':_0x2e5106,'from_session':Z});if(_0x4671f5)k['delete'](_0x4671f5);return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON[_0x2ad2c(0x25c)](_0x1a838a)}]};}let _0x1ebe8d=await P(_0x2ad2c(0x22b),{'resume_id':w,'alias':Z,'status':_0x15be96==='blocked'?_0x2ad2c(0x205):_0x15be96==='error'?_0x2ad2c(0x1e8):'working','task':_0x22d80e[_0x2ad2c(0x20b)](0x0,0xc8),'output':_0x22d80e});return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON[_0x2ad2c(0x25c)](_0x1ebe8d)}]};}if(_0x93baa8===_0x2ad2c(0x241)){let {status:_0x41a26b,task:_0x3ad149,progress:_0x5cfc7e}=_0x2c4815,_0xbb9721=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x41a26b,'task':_0x3ad149,'progress':_0x5cfc7e});return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON[_0x2ad2c(0x25c)](_0xbb9721)}]};}if(_0x93baa8===_0x2ad2c(0x233)){let {alias:_0x537a0e,task:_0x506210,priority:_0x5131c3}=_0x2c4815,_0x467616=await P(_0x2ad2c(0x256),{'alias':_0x537a0e,'task':_0x506210,'priority':_0x5131c3||_0x2ad2c(0x21a),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x2ad2c(0x25c)](_0x467616)}]};}if(_0x93baa8===_0x2ad2c(0x22c)){let {alias:_0x15ab1a,message:_0x2cae7d}=_0x2c4815,_0x3a1d68=await P(_0x2ad2c(0x1dd),{'alias':_0x15ab1a,'message':_0x2cae7d,'from_session':Z});return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON[_0x2ad2c(0x25c)](_0x3a1d68)}]};}if(_0x93baa8===_0x2ad2c(0x238)){let _0x322f88=await P(_0x2ad2c(0x248),{});return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON[_0x2ad2c(0x25c)](_0x322f88)}]};}return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON['stringify']({'error':_0x2ad2c(0x1f5)})}]};});async function v(){const _0x2eff2b=a0_0x1bfcde;let _0x21dfdb=D+'/events/'+encodeURIComponent(Z),_0x23d0ff={};if(X)_0x23d0ff['Authorization']=_0x2eff2b(0x20c)+X;Y('connecting\x20to\x20'+_0x21dfdb);while(!0x0){try{let _0x101c64=await fetch(_0x21dfdb,{'headers':_0x23d0ff});if(!_0x101c64['ok']){Y('SSE\x20error:\x20'+_0x101c64[_0x2eff2b(0x20e)]+'\x20'+_0x101c64[_0x2eff2b(0x247)]),await h(0x1388);continue;}let _0x590abd=_0x101c64[_0x2eff2b(0x245)]['getReader'](),_0x592518=new TextDecoder(),_0x556545='';while(!0x0){let {done:_0x25bf4a,value:_0x2106a3}=await _0x590abd['read']();if(_0x25bf4a)break;_0x556545+=_0x592518['decode'](_0x2106a3,{'stream':!0x0});let _0x48b926=_0x556545[_0x2eff2b(0x207)]('\x0a\x0a');_0x556545=_0x48b926[_0x2eff2b(0x1ed)]()||'';for(let _0x2ceefc of _0x48b926){let _0xe3f426=_0x2ceefc[_0x2eff2b(0x207)]('\x0a')[_0x2eff2b(0x1fc)](_0x281105=>_0x281105[_0x2eff2b(0x24b)](_0x2eff2b(0x218)));if(!_0xe3f426)continue;try{let _0x4b59eb=JSON[_0x2eff2b(0x222)](_0xe3f426['slice'](0x6));await u(_0x4b59eb);}catch(_0x1c9c74){Y(_0x2eff2b(0x1f7)+_0x1c9c74);}}}Y(_0x2eff2b(0x1f2));}catch(_0x3d705e){Y(_0x2eff2b(0x253)+_0x3d705e);}await h(0xbb8);}}async function u(_0x18ef59){const _0x13eb17=a0_0x1bfcde;if(_0x18ef59['type']===_0x13eb17(0x24c)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x18ef59['type']==='new_message'){if(Y(_0x13eb17(0x231)+_0x18ef59[_0x13eb17(0x23f)]+':\x20'+_0x18ef59['message'][_0x13eb17(0x20b)](0x0,0x3c)),await K[_0x13eb17(0x1db)]({'method':_0x13eb17(0x1e2),'params':{'content':_0x18ef59[_0x13eb17(0x232)],'meta':{'sender':_0x18ef59[_0x13eb17(0x23f)]||_0x13eb17(0x226),'sender_id':_0x13eb17(0x1f8),'user':_0x18ef59[_0x13eb17(0x23f)]||_0x13eb17(0x226),'priority':_0x13eb17(0x21a)}}}),_0x18ef59[_0x13eb17(0x1e1)])await P('ack_inbox',{'alias':Z,'message_id':_0x18ef59[_0x13eb17(0x1e1)]});return;}if(_0x18ef59['type']==='new_task'||_0x18ef59[_0x13eb17(0x208)]===_0x13eb17(0x23e)){Y('←\x20'+_0x18ef59[_0x13eb17(0x208)]+':\x20inbox_count='+_0x18ef59[_0x13eb17(0x25a)]+_0x13eb17(0x255)+(_0x18ef59[_0x13eb17(0x212)]||_0x13eb17(0x21a)));let _0x22d86c=await P(_0x13eb17(0x242),{'alias':Z,'limit':0x5});if(_0x22d86c?.['ok']&&_0x22d86c[_0x13eb17(0x21d)]?.[_0x13eb17(0x22a)]>0x0)for(let _0x183b31 of _0x22d86c['messages']){let _0x32cb18={'sender':_0x183b31[_0x13eb17(0x21c)]||_0x13eb17(0x226),'sender_id':_0x13eb17(0x1f8),'user':_0x183b31['from_session']||'hub','task_id':_0x183b31['id'],'priority':_0x183b31[_0x13eb17(0x212)]||_0x13eb17(0x21a)};k[_0x13eb17(0x235)](_0x183b31['id'],_0x183b31[_0x13eb17(0x21c)]||'hub'),await K['notification']({'method':'notifications/claude/channel','params':{'content':_0x183b31['content'],'meta':_0x32cb18}}),Y('→\x20injected\x20task\x20'+_0x183b31['id'][_0x13eb17(0x20b)](0x0,0x8)+_0x13eb17(0x1eb)+_0x183b31[_0x13eb17(0x21c)]+':\x20'+_0x183b31[_0x13eb17(0x1e0)][_0x13eb17(0x20b)](0x0,0x3c)),await P(_0x13eb17(0x228),{'alias':Z,'message_id':_0x183b31['id']});}}}async function S(){const _0x23dbcc=a0_0x1bfcde;let _0x4a99d9=new a0_0x90d41f();await K[_0x23dbcc(0x1dc)](_0x4a99d9),Y(_0x23dbcc(0x1ef)),Y('starting\x20SSE\x20listener...'),v()[_0x23dbcc(0x204)](_0x1f0f98=>Y('SSE\x20fatal:\x20'+_0x1f0f98)),P(_0x23dbcc(0x22b),{'resume_id':w,'alias':Z,'status':_0x23dbcc(0x1f3),'server':a0_0x4dcd02(),'hostname':a0_0x4dcd02(),'agent':_0x23dbcc(0x216),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})['then'](()=>Y(_0x23dbcc(0x243)+Z+_0x23dbcc(0x20a)+w[_0x23dbcc(0x20b)](0x0,0x8)+')'))[_0x23dbcc(0x204)](_0x292b2e=>Y(_0x23dbcc(0x237)+_0x292b2e)),setInterval(()=>{const _0xb9ba01=_0x23dbcc;P('report_status',{'resume_id':w,'alias':Z,'status':_0xb9ba01(0x1f3),'server':a0_0x4dcd02(),'hostname':a0_0x4dcd02(),'agent':_0xb9ba01(0x216),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0xb9ba01(0x204)](_0x35d54f=>Y(_0xb9ba01(0x23d)+_0x35d54f));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}S()[a0_0x1bfcde(0x204)](_0x76d579=>{const _0x4b8e13=a0_0x1bfcde;Y('fatal:\x20'+_0x76d579),process[_0x4b8e13(0x22f)](0x1);});async function N(){const _0x3c9ff6=a0_0x1bfcde;Y(_0x3c9ff6(0x1df)),await P(_0x3c9ff6(0x22b),{'resume_id':w,'alias':Z,'status':'error','task':'session\x20disconnected'})[_0x3c9ff6(0x204)](()=>{}),process[_0x3c9ff6(0x22f)](0x0);}process['stdin']['on'](a0_0x1bfcde(0x25b),()=>N()),process['on'](a0_0x1bfcde(0x1f1),()=>N()),process['on'](a0_0x1bfcde(0x246),()=>N());
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.0.0
|
|
4
|
-
"description": "AI Agent Network
|
|
3
|
+
"version": "2.0.0",
|
|
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",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
|
-
"build": "bun build src/client.ts --outdir dist/src --target node --minify && bun build bin/cli.ts --outdir dist/bin --target node --minify --external @sleep2agi/commhub-server --external bun:sqlite --external '../../server/*' && bun build src/node-server.ts --outdir dist/src --target node --minify --external @modelcontextprotocol/sdk && tsc --emitDeclarationOnly --declaration --outDir dist && npx javascript-obfuscator dist/bin/cli.js --output dist/bin/cli.js --compact true --
|
|
24
|
+
"build": "bun build src/client.ts --outdir dist/src --target node --minify && bun build bin/cli.ts --outdir dist/bin --target node --minify --external @sleep2agi/commhub-server --external bun:sqlite --external '../../server/*' && bun build src/node-server.ts --outdir dist/src --target node --minify --external @modelcontextprotocol/sdk && tsc --emitDeclarationOnly --declaration --outDir dist && npx javascript-obfuscator dist/bin/cli.js --output dist/bin/cli.js --compact true --string-array true --string-array-encoding base64 && npx javascript-obfuscator dist/src/client.js --output dist/src/client.js --compact true --string-array true && npx javascript-obfuscator dist/src/node-server.js --output dist/src/node-server.js --compact true --string-array true",
|
|
25
25
|
"prepublishOnly": "npm run build"
|
|
26
26
|
},
|
|
27
27
|
"keywords": [
|
|
@@ -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
|
+
}
|