@sleep2agi/agent-network 2.0.0-preview.6 → 2.0.0-preview.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +215 -73
- package/dist/bin/cli.js +1 -1
- package/dist/src/client.js +1 -1
- package/dist/src/node-server.js +1 -1
- package/package.json +9 -7
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a0_0x31904f=a0_0x2e0a;(function(_0x397b54,_0x5d033){const _0x5bb7d3=a0_0x2e0a,_0x405c98=_0x397b54();while(!![]){try{const _0x1cbe9c=-parseInt(_0x5bb7d3(0x12f))/0x1*(parseInt(_0x5bb7d3(0x161))/0x2)+-parseInt(_0x5bb7d3(0x113))/0x3*(parseInt(_0x5bb7d3(0x14f))/0x4)+parseInt(_0x5bb7d3(0x138))/0x5+-parseInt(_0x5bb7d3(0x149))/0x6+parseInt(_0x5bb7d3(0x131))/0x7+-parseInt(_0x5bb7d3(0x16d))/0x8*(-parseInt(_0x5bb7d3(0x129))/0x9)+-parseInt(_0x5bb7d3(0x169))/0xa*(parseInt(_0x5bb7d3(0x13d))/0xb);if(_0x1cbe9c===_0x5d033)break;else _0x405c98['push'](_0x405c98['shift']());}catch(_0x32573){_0x405c98['push'](_0x405c98['shift']());}}}(a0_0xc854,0x91728));import{EventEmitter as a0_0x3841fd}from'events';function a0_0xc854(){const _0x3094da=['inbox\x20error:\x20','connect','/mcp','data:\x20','sdk','report_status','result','body','1768ZztkUw','disconnect','message','catch','broadcast','call','type','send','96070tnNLef','toTimeString','error','Authorization','5634456QhuptM','SSE\x20connected','123ZcTLTb','getAllStatus','toString','disconnected','alias','server','connectSSE','tools/call','/events/','agent','new_task','heartbeatTimer','slice','SSE\x20error:\x20','text/event-stream','now','resumeId','content','normal','token','registered','emit','9IohOEG','url','heartbeat\x20failed:\x20','running','split','sleep','715ThafQu','from_session','7212310aWuShN','sdk-','completed','signal','reconnectDelay','SSE\x20reconnecting\x20in\x20','send_message','5418850JJfEWM','connected','get_all_status','parse',']\x20[commhub:','473cfgIcm','2.0','offline','sseAbort','match','min','AbortError','startsWith','ack_inbox','cwd','POST','application/json,\x20text/event-stream','3900912IFxyIT','send_task','Bearer\x20','stringify','reply','log','51448WLbWmj','idle','text','status','replace','processInbox','read','s...','getReader','heartbeatInterval'];a0_0xc854=function(){return _0x3094da;};return a0_0xc854();}import{hostname as a0_0x258c38}from'os';class T extends a0_0x3841fd{[a0_0x31904f(0x12a)];[a0_0x31904f(0x117)];[a0_0x31904f(0x126)];[a0_0x31904f(0x11c)];[a0_0x31904f(0x123)];[a0_0x31904f(0x158)];['reconnectDelay'];[a0_0x31904f(0x11e)];[a0_0x31904f(0x140)];[a0_0x31904f(0x12c)]=!0x1;constructor(_0x21766c){const _0x269059=a0_0x31904f;super();if(this[_0x269059(0x12a)]=_0x21766c[_0x269059(0x12a)][_0x269059(0x153)](/\/$/,''),this[_0x269059(0x117)]=_0x21766c[_0x269059(0x117)],this[_0x269059(0x126)]=_0x21766c['token'],this['agent']=_0x21766c[_0x269059(0x11c)]||_0x269059(0x15d),this[_0x269059(0x123)]=_0x269059(0x132)+_0x21766c[_0x269059(0x117)]+'-'+Date[_0x269059(0x122)]()[_0x269059(0x115)](0x24),this['heartbeatInterval']=_0x21766c[_0x269059(0x158)]??0x2bf20,this[_0x269059(0x135)]=_0x21766c[_0x269059(0x135)]??0xbb8,_0x21766c['autoConnect']!==!0x1)this[_0x269059(0x15a)]();}[a0_0x31904f(0x14e)](_0x49675c){const _0x488d6f=a0_0x31904f;console[_0x488d6f(0x14e)]('['+new Date()[_0x488d6f(0x16a)]()[_0x488d6f(0x11f)](0x0,0x8)+_0x488d6f(0x13c)+this[_0x488d6f(0x117)]+']\x20'+_0x49675c);}async[a0_0x31904f(0x166)](_0x2f1899,_0x4b2a9b){const _0xe5c2d2=a0_0x31904f;let _0x41b011={'Content-Type':'application/json','Accept':_0xe5c2d2(0x148)};if(this[_0xe5c2d2(0x126)])_0x41b011['Authorization']=_0xe5c2d2(0x14b)+this[_0xe5c2d2(0x126)];let _0x12d317=await(await fetch(this['url']+_0xe5c2d2(0x15b),{'method':_0xe5c2d2(0x147),'headers':_0x41b011,'body':JSON[_0xe5c2d2(0x14c)]({'jsonrpc':_0xe5c2d2(0x13e),'id':Date[_0xe5c2d2(0x122)](),'method':_0xe5c2d2(0x11a),'params':{'name':_0x2f1899,'arguments':_0x4b2a9b}})}))[_0xe5c2d2(0x151)](),_0x2bbd13=_0x12d317[_0xe5c2d2(0x141)](/data: (.+)/),_0x29716e=_0x2bbd13?JSON[_0xe5c2d2(0x13b)](_0x2bbd13[0x1]):JSON[_0xe5c2d2(0x13b)](_0x12d317),_0x17e04f=_0x29716e?.[_0xe5c2d2(0x15f)]?.[_0xe5c2d2(0x124)]?.[0x0]?.[_0xe5c2d2(0x151)];return _0x17e04f?JSON[_0xe5c2d2(0x13b)](_0x17e04f):_0x29716e;}async[a0_0x31904f(0x15a)](){const _0x5279ff=a0_0x31904f;if(this[_0x5279ff(0x12c)])return;this[_0x5279ff(0x12c)]=!0x0,await this[_0x5279ff(0x152)](_0x5279ff(0x150)),this[_0x5279ff(0x14e)](_0x5279ff(0x127)),this['heartbeatTimer']=setInterval(()=>{const _0x267459=_0x5279ff;this[_0x267459(0x152)](_0x267459(0x150))['catch'](_0x32e402=>this[_0x267459(0x14e)](_0x267459(0x12b)+_0x32e402[_0x267459(0x163)]));},this[_0x5279ff(0x158)]),this['connectSSE']();}async[a0_0x31904f(0x162)](){const _0x1fbeab=a0_0x31904f;if(this['running']=!0x1,this[_0x1fbeab(0x140)]?.['abort'](),this[_0x1fbeab(0x11e)])clearInterval(this['heartbeatTimer']);await this['status'](_0x1fbeab(0x13f))[_0x1fbeab(0x164)](()=>{}),this[_0x1fbeab(0x14e)](_0x1fbeab(0x116));}async[a0_0x31904f(0x168)](_0x4e55b6,_0x163387,_0x1ba137=a0_0x31904f(0x125)){const _0x4a6781=a0_0x31904f;return this[_0x4a6781(0x166)](_0x4a6781(0x14a),{'alias':_0x4e55b6,'task':_0x163387,'priority':_0x1ba137,'from_session':this['alias']});}async[a0_0x31904f(0x163)](_0x2b0023,_0x55457c){const _0x3e4d05=a0_0x31904f;return this[_0x3e4d05(0x166)](_0x3e4d05(0x137),{'alias':_0x2b0023,'message':_0x55457c,'from_session':this[_0x3e4d05(0x117)]});}async[a0_0x31904f(0x14d)](_0x21d679,_0x24734a,_0x180ba0=a0_0x31904f(0x133)){const _0xb7ff1d=a0_0x31904f;return this[_0xb7ff1d(0x166)](_0xb7ff1d(0x14d),{'task_id':_0x21d679,'text':_0x24734a,'status':_0x180ba0});}async[a0_0x31904f(0x152)](_0x4e422e,_0xe9a122){const _0x3e4e81=a0_0x31904f;return this['call'](_0x3e4e81(0x15e),{'resume_id':this['resumeId'],'alias':this[_0x3e4e81(0x117)],'status':_0x4e422e,'server':a0_0x258c38(),'hostname':a0_0x258c38(),'agent':this[_0x3e4e81(0x11c)],'project_dir':process[_0x3e4e81(0x146)](),..._0xe9a122});}async[a0_0x31904f(0x114)](){const _0x21598d=a0_0x31904f;return this[_0x21598d(0x166)](_0x21598d(0x13a),{});}async['broadcast'](_0x625117,_0x2c409f){const _0x19a956=a0_0x31904f;return this[_0x19a956(0x166)](_0x19a956(0x165),{'message':_0x625117,'filter_server':_0x2c409f?.[_0x19a956(0x118)],'filter_status':_0x2c409f?.[_0x19a956(0x152)]});}async[a0_0x31904f(0x119)](){const _0x1bc8f6=a0_0x31904f;let _0x3fecd4=encodeURIComponent(this[_0x1bc8f6(0x117)]),_0x5972d5=this[_0x1bc8f6(0x12a)]+_0x1bc8f6(0x11b)+_0x3fecd4,_0x3f0e0a=this[_0x1bc8f6(0x135)];while(this[_0x1bc8f6(0x12c)]){try{this['sseAbort']=new AbortController();let _0x9175f4={'Accept':_0x1bc8f6(0x121)};if(this[_0x1bc8f6(0x126)])_0x9175f4[_0x1bc8f6(0x16c)]=_0x1bc8f6(0x14b)+this[_0x1bc8f6(0x126)];let _0x4a23ce=await fetch(_0x5972d5,{'headers':_0x9175f4,'signal':this[_0x1bc8f6(0x140)][_0x1bc8f6(0x134)]});if(!_0x4a23ce['ok']||!_0x4a23ce[_0x1bc8f6(0x160)]){this[_0x1bc8f6(0x14e)]('SSE\x20failed:\x20'+_0x4a23ce[_0x1bc8f6(0x152)]),await this[_0x1bc8f6(0x12e)](_0x3f0e0a),_0x3f0e0a=Math['min'](_0x3f0e0a*1.5,0xea60);continue;}_0x3f0e0a=this[_0x1bc8f6(0x135)];let _0x583c0d=_0x4a23ce['body'][_0x1bc8f6(0x157)](),_0x373f18=new TextDecoder(),_0x198ee8='';while(this[_0x1bc8f6(0x12c)]){let {done:_0x44202c,value:_0x49aa0d}=await _0x583c0d[_0x1bc8f6(0x155)]();if(_0x44202c)break;_0x198ee8+=_0x373f18['decode'](_0x49aa0d,{'stream':!0x0});let _0x1b221b=_0x198ee8[_0x1bc8f6(0x12d)]('\x0a');_0x198ee8=_0x1b221b['pop']()||'';for(let _0x5f29ae of _0x1b221b){if(!_0x5f29ae[_0x1bc8f6(0x144)](_0x1bc8f6(0x15c)))continue;try{let _0x306e99=JSON[_0x1bc8f6(0x13b)](_0x5f29ae['slice'](0x6));if(_0x306e99[_0x1bc8f6(0x167)]===_0x1bc8f6(0x139)){this['log'](_0x1bc8f6(0x112)),this['emit'](_0x1bc8f6(0x139));continue;}if(_0x306e99[_0x1bc8f6(0x167)]===_0x1bc8f6(0x11d)||_0x306e99[_0x1bc8f6(0x167)]==='new_message'||_0x306e99[_0x1bc8f6(0x167)]===_0x1bc8f6(0x165))await this[_0x1bc8f6(0x154)]();}catch{}}}}catch(_0x3f3449){if(_0x3f3449['name']===_0x1bc8f6(0x143))break;this[_0x1bc8f6(0x128)](_0x1bc8f6(0x16b),_0x3f3449),this[_0x1bc8f6(0x14e)](_0x1bc8f6(0x120)+_0x3f3449[_0x1bc8f6(0x163)]);}if(this[_0x1bc8f6(0x12c)])this[_0x1bc8f6(0x128)](_0x1bc8f6(0x116)),this[_0x1bc8f6(0x14e)](_0x1bc8f6(0x136)+_0x3f0e0a/0x3e8+_0x1bc8f6(0x156)),await this[_0x1bc8f6(0x12e)](_0x3f0e0a),_0x3f0e0a=Math[_0x1bc8f6(0x142)](_0x3f0e0a*1.5,0xea60);}}async['processInbox'](){const _0x1a589d=a0_0x31904f;try{let _0xbd8778=(await this[_0x1a589d(0x166)]('get_inbox',{'alias':this[_0x1a589d(0x117)],'limit':0xa}))?.['messages']||[];for(let _0x230efc of _0xbd8778)await this[_0x1a589d(0x166)](_0x1a589d(0x145),{'alias':this[_0x1a589d(0x117)],'message_id':_0x230efc['id']}),this[_0x1a589d(0x14e)]('←\x20'+_0x230efc[_0x1a589d(0x130)]+':\x20'+_0x230efc[_0x1a589d(0x124)]['slice'](0x0,0x3c)),this[_0x1a589d(0x128)]('task',_0x230efc),this['emit']('message',_0x230efc);}catch(_0x3efbd2){this[_0x1a589d(0x14e)](_0x1a589d(0x159)+_0x3efbd2['message']);}}[a0_0x31904f(0x12e)](_0x4102ef){return new Promise(_0x49d780=>setTimeout(_0x49d780,_0x4102ef));}}function a0_0x2e0a(_0x2873e9,_0x4c7f2d){_0x2873e9=_0x2873e9-0x112;const _0xc8541=a0_0xc854();let _0x2e0a2c=_0xc8541[_0x2873e9];return _0x2e0a2c;}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_0x3a4eda=a0_0xf8e7;(function(_0x5b900a,_0x407b97){const _0x519df5=a0_0xf8e7,_0x23cb4f=_0x5b900a();while(!![]){try{const _0x20e171=parseInt(_0x519df5(0x232))/0x1*(-parseInt(_0x519df5(0x224))/0x2)+-parseInt(_0x519df5(0x1e9))/0x3+parseInt(_0x519df5(0x251))/0x4*(-parseInt(_0x519df5(0x255))/0x5)+parseInt(_0x519df5(0x1eb))/0x6*(parseInt(_0x519df5(0x1ff))/0x7)+-parseInt(_0x519df5(0x23a))/0x8+-parseInt(_0x519df5(0x1e8))/0x9+parseInt(_0x519df5(0x228))/0xa;if(_0x20e171===_0x407b97)break;else _0x23cb4f['push'](_0x23cb4f['shift']());}catch(_0x29e369){_0x23cb4f['push'](_0x23cb4f['shift']());}}}(a0_0x1e45,0x41faa));import{readFileSync as a0_0x4ad26c,existsSync as a0_0x436b4b}from'fs';import{join as a0_0x51a9be}from'path';import{hostname as a0_0x428b3e}from'os';import{execSync as a0_0x5908f4}from'child_process';import{Server as a0_0x5cebea}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x16de72}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x451801,CallToolRequestSchema as a0_0x4f9edb}from'@modelcontextprotocol/sdk/types.js';function p(_0x3f4f9c){const _0x1ffeba=a0_0xf8e7;if(!a0_0x436b4b(_0x3f4f9c))return;for(let _0x32988c of a0_0x4ad26c(_0x3f4f9c,_0x1ffeba(0x226))['split']('\x0a')){let _0x5c4f2a=_0x32988c[_0x1ffeba(0x229)]();if(!_0x5c4f2a||_0x5c4f2a['startsWith']('#'))continue;let _0x31a605=_0x5c4f2a[_0x1ffeba(0x215)]('=');if(_0x31a605<0x0)continue;let _0x40228d=_0x5c4f2a[_0x1ffeba(0x20a)](0x0,_0x31a605)[_0x1ffeba(0x229)](),_0x1c20db=_0x5c4f2a[_0x1ffeba(0x20a)](_0x31a605+0x1)[_0x1ffeba(0x229)]()[_0x1ffeba(0x234)](/^["']|["']$/g,'');if(!process.env[_0x40228d])process.env[_0x40228d]=_0x1c20db;}}var C=process.env.HOME||'~',T=a0_0x51a9be(C,a0_0x3a4eda(0x1e4));p(a0_0x51a9be(T,a0_0x3a4eda(0x21d)));var L=process[a0_0x3a4eda(0x20e)]()[a0_0x3a4eda(0x234)](/\//g,'-');p(a0_0x51a9be(T,L,a0_0x3a4eda(0x21d)));function U(){const _0x248d17=a0_0x3a4eda;try{return a0_0x5908f4(_0x248d17(0x1db),{'encoding':_0x248d17(0x226),'timeout':0x7d0})['trim']();}catch{return'';}}function c(){const _0x2f7548=a0_0x3a4eda;try{let _0x1c6e9c=a0_0x51a9be(C,_0x2f7548(0x254),_0x2f7548(0x20b));if(a0_0x436b4b(_0x1c6e9c))return JSON['parse'](a0_0x4ad26c(_0x1c6e9c,'utf-8'));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x3a4eda(0x227)]||a0_0x3a4eda(0x1fe),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x428b3e(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x3a4eda(0x262)](),X=process.env.COMMHUB_TOKEN||H[a0_0x3a4eda(0x1e6)]||'';function Y(_0x45ab38){const _0x3e16a2=a0_0x3a4eda;let _0x1c4145=new Date()[_0x3e16a2(0x23f)]()[_0x3e16a2(0x20a)](0x0,0x8);process[_0x3e16a2(0x1f7)][_0x3e16a2(0x23c)]('['+_0x1c4145+_0x3e16a2(0x1f5)+_0x45ab38+'\x0a');}function a0_0xf8e7(_0x1dce20,_0x45042b){_0x1dce20=_0x1dce20-0x1da;const _0x1e4567=a0_0x1e45();let _0xf8e72d=_0x1e4567[_0x1dce20];return _0xf8e72d;}function h(_0x3fbd19){return new Promise(_0x34993f=>setTimeout(_0x34993f,_0x3fbd19));}Y(a0_0x3a4eda(0x25d)+D+'\x20ALIAS='+Z+'\x20RESUME_ID='+w[a0_0x3a4eda(0x20a)](0x0,0x8)+a0_0x3a4eda(0x1df)+(f||'none')+a0_0x3a4eda(0x212)+process[a0_0x3a4eda(0x20e)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x5cebea({'name':a0_0x3a4eda(0x219),'version':a0_0x3a4eda(0x261)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':['Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>',a0_0x3a4eda(0x242),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x3a4eda(0x249),a0_0x3a4eda(0x20c)+Z][a0_0x3a4eda(0x213)]('\x0a')});K[a0_0x3a4eda(0x1e0)](a0_0x451801,async()=>({'tools':[{'name':a0_0x3a4eda(0x1f3),'description':a0_0x3a4eda(0x260),'inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{'task_id':{'type':a0_0x3a4eda(0x1ef),'description':a0_0x3a4eda(0x244)},'text':{'type':a0_0x3a4eda(0x1ef),'description':a0_0x3a4eda(0x21f)},'status':{'type':'string','enum':[a0_0x3a4eda(0x258),a0_0x3a4eda(0x202),'cancelled',a0_0x3a4eda(0x21c),'error',a0_0x3a4eda(0x208)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x3a4eda(0x1ea)]}},{'name':a0_0x3a4eda(0x259),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{'status':{'type':a0_0x3a4eda(0x1ef),'enum':[a0_0x3a4eda(0x240),a0_0x3a4eda(0x21a),a0_0x3a4eda(0x21c),'error']},'task':{'type':a0_0x3a4eda(0x1ef),'description':'Current\x20task\x20description'},'progress':{'type':'number','description':a0_0x3a4eda(0x22e)}},'required':[a0_0x3a4eda(0x1fb)]}},{'name':a0_0x3a4eda(0x210),'description':a0_0x3a4eda(0x235),'inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{'alias':{'type':a0_0x3a4eda(0x1ef),'description':a0_0x3a4eda(0x236)},'task':{'type':a0_0x3a4eda(0x1ef),'description':a0_0x3a4eda(0x1e2)},'priority':{'type':a0_0x3a4eda(0x1ef),'enum':['high',a0_0x3a4eda(0x23e),'low'],'description':a0_0x3a4eda(0x20d)}},'required':['alias',a0_0x3a4eda(0x22b)]}},{'name':'commhub_send_message','description':a0_0x3a4eda(0x1ee),'inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'message':{'type':'string','description':a0_0x3a4eda(0x22c)}},'required':[a0_0x3a4eda(0x241),'message']}},{'name':a0_0x3a4eda(0x230),'description':a0_0x3a4eda(0x209),'inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{}}}]}));function a0_0x1e45(){const _0x3561c2=['text','60oCJIMU','POST','object','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','string','tools/call','/mcp','claude-code','commhub_reply','priority',']\x20[commhub]\x20','initialize','stderr','2025-03-26','params','session\x20disconnected','status','commhub_send_message','application/json,\x20text/event-stream','http://127.0.0.1:9200','45724WuRsIF','notifications/claude/channel','error','failed','replied','content','inbox_count','unknown\x20tool','then','in_progress','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','slice','config.json','Session\x20alias:\x20','Priority\x20(default:\x20normal)','cwd','stringify','commhub_send_task','type','\x20CWD=','join','get_all_status','indexOf','→\x20injected\x20task\x20',':\x20inbox_count=','send_reply','commhub-channel','idle','parse\x20error:\x20','blocked','.env','\x20from\x20','Reply\x20text\x20/\x20result\x20summary','message','\x22\x20(','catch','Bearer\x20','32kOZIqp','no\x20response','utf-8','hub','20570530CUOpvm','trim','find','task','Message\x20content','read','Progress\x200-100','connect','commhub_get_all_status','data:\x20','25238FArZpM','Authorization','replace','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','Target\x20session\x20alias','report_status','split','new_message','3779112EjTGcr','message_id','write','get','normal','toTimeString','working','alias','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','send_message','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','CommHub\x20init\x20failed:\x20','2.0','MCP\x20stdio\x20connected','shutting\x20down,\x20reporting\x20offline...','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','get_inbox','SSE\x20connected\x20as\x20\x22','statusText','notification','fatal:\x20','SSE\x20stream\x20ended,\x20reconnecting...','ready\x20—\x20waiting\x20for\x20events','4YPdoKO','\x20priority=','←\x20message\x20from\x20','.anet','649795tSYyJl','from','set','completed','commhub_report_status','from_session','startsWith','delete','ENV:\x20URL=','application/json','result','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','0.3.0','randomUUID','send_task','connecting\x20to\x20','parse','tmux\x20display-message\x20-p\x20\x27#S\x27','commhub','ack_inbox','registered\x20as\x20\x22','...\x20TMUX=','setRequestHandler','new_task','Task\x20content','SSE\x20connection\x20error:\x20','.claude/channels/commhub','broadcast','token','cancelled','2950524FJqyGx','1554393kDWhky'];a0_0x1e45=function(){return _0x3561c2;};return a0_0x1e45();}async function P(_0x2c1177,_0x47a35e){const _0x109f41=a0_0x3a4eda;let _0x3847d8=await fetch(D+_0x109f41(0x1f1),{'method':_0x109f41(0x1ec),'headers':{'Content-Type':_0x109f41(0x25e),'Accept':_0x109f41(0x1fd),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x109f41(0x246),'id':0x1,'method':_0x109f41(0x1f6),'params':{'protocolVersion':_0x109f41(0x1f8),'capabilities':{},'clientInfo':{'name':_0x109f41(0x219),'version':_0x109f41(0x261)}}})});if(!_0x3847d8['ok']){let _0x1ce112=await _0x3847d8[_0x109f41(0x1ea)]();return Y(_0x109f41(0x245)+_0x3847d8[_0x109f41(0x1fb)]+'\x20'+_0x1ce112['slice'](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x3847d8[_0x109f41(0x1fb)]};}await _0x3847d8[_0x109f41(0x1ea)]();let _0x3f4fd1=(await(await fetch(D+'/mcp',{'method':_0x109f41(0x1ec),'headers':{'Content-Type':_0x109f41(0x25e),'Accept':_0x109f41(0x1fd),...X?{'Authorization':_0x109f41(0x223)+X}:{}},'body':JSON[_0x109f41(0x20f)]({'jsonrpc':_0x109f41(0x246),'id':0x2,'method':_0x109f41(0x1f0),'params':{'name':_0x2c1177,'arguments':_0x47a35e}})}))['text']())[_0x109f41(0x238)]('\x0a')[_0x109f41(0x22a)](_0x44ffd0=>_0x44ffd0['startsWith']('data:\x20'));if(_0x3f4fd1){let _0x3cdd0f=JSON[_0x109f41(0x1da)](_0x3f4fd1[_0x109f41(0x20a)](0x6));return _0x3cdd0f?.[_0x109f41(0x25f)]?.[_0x109f41(0x204)]?.[0x0]?.['text']?JSON[_0x109f41(0x1da)](_0x3cdd0f['result'][_0x109f41(0x204)][0x0][_0x109f41(0x1ea)]):_0x3cdd0f;}return{'ok':!0x1,'error':_0x109f41(0x225)};}K[a0_0x3a4eda(0x1e0)](a0_0x4f9edb,async _0x5081bc=>{const _0x3f5c52=a0_0x3a4eda;let {name:_0x41683c,arguments:_0x46bac0}=_0x5081bc[_0x3f5c52(0x1f9)];if(_0x41683c==='commhub_reply'){let {task_id:_0x59c60d,text:_0xb7914b,status:_0xe50a12}=_0x46bac0;if(_0xe50a12===_0x3f5c52(0x258)||_0xe50a12===_0x3f5c52(0x202)||_0xe50a12===_0x3f5c52(0x1e7)){let _0x580e0c=_0xe50a12===_0x3f5c52(0x258)?_0x3f5c52(0x203):_0xe50a12,_0x2fb477=_0x59c60d?k[_0x3f5c52(0x23d)](_0x59c60d)||_0x3f5c52(0x227):_0x3f5c52(0x227),_0x40d81a=await P(_0x3f5c52(0x218),{'alias':_0x2fb477,'text':_0xb7914b,'in_reply_to':_0x59c60d||void 0x0,'status':_0x580e0c,'from_session':Z});if(_0x59c60d)k[_0x3f5c52(0x25c)](_0x59c60d);return{'content':[{'type':'text','text':JSON[_0x3f5c52(0x20f)](_0x40d81a)}]};}let _0x567574=await P(_0x3f5c52(0x237),{'resume_id':w,'alias':Z,'status':_0xe50a12===_0x3f5c52(0x21c)?_0x3f5c52(0x21c):_0xe50a12===_0x3f5c52(0x201)?_0x3f5c52(0x201):_0x3f5c52(0x240),'task':_0xb7914b['slice'](0x0,0xc8),'output':_0xb7914b});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x567574)}]};}if(_0x41683c===_0x3f5c52(0x259)){let {status:_0x1ee402,task:_0x1d5c87,progress:_0x57353c}=_0x46bac0,_0x411af2=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x1ee402,'task':_0x1d5c87,'progress':_0x57353c});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x411af2)}]};}if(_0x41683c==='commhub_send_task'){let {alias:_0x5991d2,task:_0x37a3cd,priority:_0xae54e7}=_0x46bac0,_0x36ae04=await P(_0x3f5c52(0x263),{'alias':_0x5991d2,'task':_0x37a3cd,'priority':_0xae54e7||_0x3f5c52(0x23e),'from_session':Z});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x36ae04)}]};}if(_0x41683c===_0x3f5c52(0x1fc)){let {alias:_0x50a927,message:_0x516061}=_0x46bac0,_0x26579a=await P(_0x3f5c52(0x243),{'alias':_0x50a927,'message':_0x516061,'from_session':Z});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x26579a)}]};}if(_0x41683c==='commhub_get_all_status'){let _0x399b5e=await P(_0x3f5c52(0x214),{});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x399b5e)}]};}return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)]({'error':_0x3f5c52(0x206)})}]};});async function v(){const _0x78e300=a0_0x3a4eda;let _0x5a8b40=D+'/events/'+encodeURIComponent(Z),_0x2712de={};if(X)_0x2712de[_0x78e300(0x233)]=_0x78e300(0x223)+X;Y(_0x78e300(0x264)+_0x5a8b40);while(!0x0){try{let _0x2ac962=await fetch(_0x5a8b40,{'headers':_0x2712de});if(!_0x2ac962['ok']){Y('SSE\x20error:\x20'+_0x2ac962[_0x78e300(0x1fb)]+'\x20'+_0x2ac962[_0x78e300(0x24c)]),await h(0x1388);continue;}let _0x181179=_0x2ac962['body']['getReader'](),_0x22e9a6=new TextDecoder(),_0x59af77='';while(!0x0){let {done:_0x39b62e,value:_0x450399}=await _0x181179[_0x78e300(0x22d)]();if(_0x39b62e)break;_0x59af77+=_0x22e9a6['decode'](_0x450399,{'stream':!0x0});let _0x5ae4f5=_0x59af77[_0x78e300(0x238)]('\x0a\x0a');_0x59af77=_0x5ae4f5['pop']()||'';for(let _0x2e8108 of _0x5ae4f5){let _0x350c87=_0x2e8108[_0x78e300(0x238)]('\x0a')[_0x78e300(0x22a)](_0x437a64=>_0x437a64[_0x78e300(0x25b)](_0x78e300(0x231)));if(!_0x350c87)continue;try{let _0x1e1d34=JSON[_0x78e300(0x1da)](_0x350c87[_0x78e300(0x20a)](0x6));await u(_0x1e1d34);}catch(_0x558992){Y(_0x78e300(0x21b)+_0x558992);}}}Y(_0x78e300(0x24f));}catch(_0x2f84b9){Y(_0x78e300(0x1e3)+_0x2f84b9);}await h(0xbb8);}}async function u(_0x2bb535){const _0x2de277=a0_0x3a4eda;if(_0x2bb535[_0x2de277(0x211)]==='connected'){Y(_0x2de277(0x24b)+Z+'\x22');return;}if(_0x2bb535[_0x2de277(0x211)]===_0x2de277(0x239)){if(Y(_0x2de277(0x253)+_0x2bb535['from']+':\x20'+_0x2bb535[_0x2de277(0x220)]['slice'](0x0,0x3c)),await K['notification']({'method':_0x2de277(0x200),'params':{'content':_0x2bb535[_0x2de277(0x220)],'meta':{'sender':_0x2bb535[_0x2de277(0x256)]||_0x2de277(0x227),'sender_id':'commhub','user':_0x2bb535[_0x2de277(0x256)]||'hub','priority':_0x2de277(0x23e)}}}),_0x2bb535[_0x2de277(0x23b)])await P(_0x2de277(0x1dd),{'alias':Z,'message_id':_0x2bb535[_0x2de277(0x23b)]});return;}if(_0x2bb535[_0x2de277(0x211)]===_0x2de277(0x1e1)||_0x2bb535[_0x2de277(0x211)]===_0x2de277(0x1e5)){Y('←\x20'+_0x2bb535[_0x2de277(0x211)]+_0x2de277(0x217)+_0x2bb535[_0x2de277(0x205)]+_0x2de277(0x252)+(_0x2bb535['priority']||_0x2de277(0x23e)));let _0x32a9d9=await P(_0x2de277(0x24a),{'alias':Z,'limit':0x5});if(_0x32a9d9?.['ok']&&_0x32a9d9['messages']?.['length']>0x0)for(let _0x2ef2f6 of _0x32a9d9['messages']){let _0x1ed6d1={'sender':_0x2ef2f6['from_session']||_0x2de277(0x227),'sender_id':_0x2de277(0x1dc),'user':_0x2ef2f6[_0x2de277(0x25a)]||_0x2de277(0x227),'task_id':_0x2ef2f6['id'],'priority':_0x2ef2f6[_0x2de277(0x1f4)]||_0x2de277(0x23e)};k[_0x2de277(0x257)](_0x2ef2f6['id'],_0x2ef2f6[_0x2de277(0x25a)]||_0x2de277(0x227)),await K[_0x2de277(0x24d)]({'method':_0x2de277(0x200),'params':{'content':_0x2ef2f6[_0x2de277(0x204)],'meta':_0x1ed6d1}}),Y(_0x2de277(0x216)+_0x2ef2f6['id'][_0x2de277(0x20a)](0x0,0x8)+_0x2de277(0x21e)+_0x2ef2f6[_0x2de277(0x25a)]+':\x20'+_0x2ef2f6[_0x2de277(0x204)]['slice'](0x0,0x3c)),await P(_0x2de277(0x1dd),{'alias':Z,'message_id':_0x2ef2f6['id']});}}}async function S(){const _0x1e697d=a0_0x3a4eda;let _0x442671=new a0_0x16de72();await K[_0x1e697d(0x22f)](_0x442671),Y(_0x1e697d(0x247)),Y('starting\x20SSE\x20listener...'),v()[_0x1e697d(0x222)](_0x2be00c=>Y('SSE\x20fatal:\x20'+_0x2be00c)),P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x428b3e(),'hostname':a0_0x428b3e(),'agent':_0x1e697d(0x1f2),'project_dir':process[_0x1e697d(0x20e)](),'tmux_name':f||void 0x0})[_0x1e697d(0x207)](()=>Y(_0x1e697d(0x1de)+Z+_0x1e697d(0x221)+w[_0x1e697d(0x20a)](0x0,0x8)+')'))['catch'](_0x57a92b=>Y('warning:\x20could\x20not\x20register:\x20'+_0x57a92b)),setInterval(()=>{const _0x1d735e=_0x1e697d;P(_0x1d735e(0x237),{'resume_id':w,'alias':Z,'status':_0x1d735e(0x21a),'server':a0_0x428b3e(),'hostname':a0_0x428b3e(),'agent':_0x1d735e(0x1f2),'project_dir':process[_0x1d735e(0x20e)](),'tmux_name':f||void 0x0})[_0x1d735e(0x222)](_0xfe6cee=>Y('heartbeat\x20failed:\x20'+_0xfe6cee));},0x2bf20),Y(_0x1e697d(0x250));}S()['catch'](_0x2aec6a=>{const _0x536b97=a0_0x3a4eda;Y(_0x536b97(0x24e)+_0x2aec6a),process['exit'](0x1);});async function N(){const _0x3bd35e=a0_0x3a4eda;Y(_0x3bd35e(0x248)),await P(_0x3bd35e(0x237),{'resume_id':w,'alias':Z,'status':_0x3bd35e(0x201),'task':_0x3bd35e(0x1fa)})['catch'](()=>{}),process['exit'](0x0);}process['stdin']['on']('end',()=>N()),process['on']('SIGTERM',()=>N()),process['on']('SIGINT',()=>N());
|
|
2
|
+
const a0_0x28e694=a0_0xe1c9;(function(_0x170564,_0x411b40){const _0x23135d=a0_0xe1c9,_0x2c4759=_0x170564();while(!![]){try{const _0x4cfb2c=-parseInt(_0x23135d(0x21e))/0x1*(parseInt(_0x23135d(0x23e))/0x2)+parseInt(_0x23135d(0x226))/0x3+-parseInt(_0x23135d(0x229))/0x4*(parseInt(_0x23135d(0x254))/0x5)+parseInt(_0x23135d(0x26a))/0x6+-parseInt(_0x23135d(0x26d))/0x7*(parseInt(_0x23135d(0x249))/0x8)+-parseInt(_0x23135d(0x24f))/0x9+parseInt(_0x23135d(0x25b))/0xa;if(_0x4cfb2c===_0x411b40)break;else _0x2c4759['push'](_0x2c4759['shift']());}catch(_0x589fb){_0x2c4759['push'](_0x2c4759['shift']());}}}(a0_0x5099,0x812bf));import{readFileSync as a0_0x32a021,existsSync as a0_0x2ff1c6}from'fs';import{join as a0_0x17852f}from'path';import{hostname as a0_0x345ca0}from'os';import{execSync as a0_0x32f729}from'child_process';import{Server as a0_0x3f4b6b}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x42cf96}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x206fa2,CallToolRequestSchema as a0_0x4a5706}from'@modelcontextprotocol/sdk/types.js';function p(_0x589740){const _0x1829a0=a0_0xe1c9;if(!a0_0x2ff1c6(_0x589740))return;for(let _0x48b687 of a0_0x32a021(_0x589740,_0x1829a0(0x241))['split']('\x0a')){let _0x1a8525=_0x48b687['trim']();if(!_0x1a8525||_0x1a8525[_0x1829a0(0x20a)]('#'))continue;let _0x5940f6=_0x1a8525[_0x1829a0(0x231)]('=');if(_0x5940f6<0x0)continue;let _0x456805=_0x1a8525[_0x1829a0(0x1fd)](0x0,_0x5940f6)[_0x1829a0(0x26b)](),_0x7e0236=_0x1a8525[_0x1829a0(0x1fd)](_0x5940f6+0x1)['trim']()['replace'](/^["']|["']$/g,'');if(!process.env[_0x456805])process.env[_0x456805]=_0x7e0236;}}var C=process.env.HOME||'~',T=a0_0x17852f(C,a0_0x28e694(0x262));p(a0_0x17852f(T,a0_0x28e694(0x26c)));var L=process[a0_0x28e694(0x1e4)]()['replace'](/\//g,'-');p(a0_0x17852f(T,L,a0_0x28e694(0x26c)));function a0_0xe1c9(_0x165f89,_0x2c8d86){_0x165f89=_0x165f89-0x1e2;const _0x509974=a0_0x5099();let _0xe1c9f8=_0x509974[_0x165f89];return _0xe1c9f8;}function U(){const _0x51acc5=a0_0x28e694;try{return a0_0x32f729(_0x51acc5(0x1e5),{'encoding':_0x51acc5(0x241),'timeout':0x7d0})['trim']();}catch{return'';}}function c(){const _0x2c9704=a0_0x28e694;try{let _0x1f677d=a0_0x17852f(C,_0x2c9704(0x1e6),_0x2c9704(0x228));if(a0_0x2ff1c6(_0x1f677d))return JSON[_0x2c9704(0x1f4)](a0_0x32a021(_0x1f677d,_0x2c9704(0x241)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x28e694(0x213)]||a0_0x28e694(0x216),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x345ca0(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto['randomUUID'](),X=process.env.COMMHUB_TOKEN||H[a0_0x28e694(0x224)]||'';function a0_0x5099(){const _0x2a932e=['none','text','failed','alias','indexOf','string','exit','new_message','object','working','commhub','toTimeString','join','message_id','commhub_send_message','content','session\x20disconnected','4fuSWxq','commhub-channel','2.0','utf-8','send_message','ENV:\x20URL=','parse\x20error:\x20','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','result','normal','SSE\x20error:\x20','5581008hlLAyT','status','\x20ALIAS=','SSE\x20connection\x20error:\x20',']\x20[commhub]\x20','\x20RESUME_ID=','872856IkguWK','blocked','stderr','SIGTERM','body','15HACNKS','commhub_report_status','starting\x20SSE\x20listener...','params','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','Authorization','SSE\x20connected\x20as\x20\x22','27244830GflVfK','broadcast','get_all_status','\x20from\x20','write','notification','inbox_count','.claude/channels/commhub','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','\x20CWD=','high','idle','from_session','report_status','2017872qYaOtW','trim','.env','7TQtfeD','error',':\x20inbox_count=','split','cwd','tmux\x20display-message\x20-p\x20\x27#S\x27','.anet','connecting\x20to\x20','...\x20TMUX=','commhub_send_task','Bearer\x20','shutting\x20down,\x20reporting\x20offline...','completed','application/json,\x20text/event-stream','new_task','CommHub\x20init\x20failed:\x20','SSE\x20fatal:\x20','cancelled','/events/','priority','parse','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','registered\x20as\x20\x22','message','then','Session\x20alias:\x20','notifications/claude/channel','get_inbox','init\x20failed:\x20','slice','\x22\x20(','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','data:\x20','in_progress','0.3.0','stdin','find','ack_inbox','read','commhub_reply','SSE\x20stream\x20ended,\x20reconnecting...','catch','startsWith','stringify','unknown\x20tool','Reply\x20text\x20/\x20result\x20summary','set','from','length','claude-code','type','hub','Priority\x20(default:\x20normal)','send_task','http://127.0.0.1:9200','POST','Progress\x200-100','commhub_get_all_status','delete','connected','→\x20injected\x20task\x20','decode','519989CedzMa','get','Task\x20content','messages','MCP\x20stdio\x20connected','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','token','←\x20message\x20from\x20','36663OeBmVW','SIGINT','config.json','945788TjmflP','task','Target\x20session\x20alias','fatal:\x20'];a0_0x5099=function(){return _0x2a932e;};return a0_0x5099();}function Y(_0x285a60){const _0x548905=a0_0x28e694;let _0x4ef1b8=new Date()[_0x548905(0x238)]()[_0x548905(0x1fd)](0x0,0x8);process[_0x548905(0x251)][_0x548905(0x25f)]('['+_0x4ef1b8+_0x548905(0x24d)+_0x285a60+'\x0a');}function h(_0x8493e2){return new Promise(_0x45de6e=>setTimeout(_0x45de6e,_0x8493e2));}Y(a0_0x28e694(0x243)+D+a0_0x28e694(0x24b)+Z+a0_0x28e694(0x24e)+w[a0_0x28e694(0x1fd)](0x0,0x8)+a0_0x28e694(0x1e8)+(f||a0_0x28e694(0x22d))+a0_0x28e694(0x265)+process[a0_0x28e694(0x1e4)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x3f4b6b({'name':a0_0x28e694(0x23f),'version':a0_0x28e694(0x202)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':['Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>',a0_0x28e694(0x263),a0_0x28e694(0x258),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x28e694(0x1f9)+Z][a0_0x28e694(0x239)]('\x0a')});K['setRequestHandler'](a0_0x206fa2,async()=>({'tools':[{'name':a0_0x28e694(0x207),'description':a0_0x28e694(0x1f5),'inputSchema':{'type':a0_0x28e694(0x235),'properties':{'task_id':{'type':a0_0x28e694(0x232),'description':a0_0x28e694(0x1ff)},'text':{'type':a0_0x28e694(0x232),'description':a0_0x28e694(0x20d)},'status':{'type':a0_0x28e694(0x232),'enum':['completed','failed',a0_0x28e694(0x1f1),a0_0x28e694(0x250),a0_0x28e694(0x26e),a0_0x28e694(0x201)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x28e694(0x22e)]}},{'name':a0_0x28e694(0x255),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':'object','properties':{'status':{'type':'string','enum':[a0_0x28e694(0x236),'idle',a0_0x28e694(0x250),a0_0x28e694(0x26e)]},'task':{'type':a0_0x28e694(0x232),'description':'Current\x20task\x20description'},'progress':{'type':'number','description':a0_0x28e694(0x218)}},'required':[a0_0x28e694(0x24a)]}},{'name':'commhub_send_task','description':a0_0x28e694(0x264),'inputSchema':{'type':a0_0x28e694(0x235),'properties':{'alias':{'type':a0_0x28e694(0x232),'description':a0_0x28e694(0x22b)},'task':{'type':a0_0x28e694(0x232),'description':a0_0x28e694(0x220)},'priority':{'type':'string','enum':[a0_0x28e694(0x266),a0_0x28e694(0x247),'low'],'description':a0_0x28e694(0x214)}},'required':[a0_0x28e694(0x230),a0_0x28e694(0x22a)]}},{'name':a0_0x28e694(0x23b),'description':a0_0x28e694(0x245),'inputSchema':{'type':a0_0x28e694(0x235),'properties':{'alias':{'type':a0_0x28e694(0x232),'description':a0_0x28e694(0x22b)},'message':{'type':'string','description':'Message\x20content'}},'required':[a0_0x28e694(0x230),a0_0x28e694(0x1f7)]}},{'name':a0_0x28e694(0x219),'description':a0_0x28e694(0x223),'inputSchema':{'type':'object','properties':{}}}]}));async function P(_0x56684a,_0xf45bed){const _0x139d18=a0_0x28e694;let _0x40fdc3=await fetch(D+'/mcp',{'method':_0x139d18(0x217),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x139d18(0x240),'id':0x1,'method':'initialize','params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x139d18(0x23f),'version':_0x139d18(0x202)}}})});if(!_0x40fdc3['ok']){let _0x45d280=await _0x40fdc3[_0x139d18(0x22e)]();return Y(_0x139d18(0x1ef)+_0x40fdc3[_0x139d18(0x24a)]+'\x20'+_0x45d280[_0x139d18(0x1fd)](0x0,0x64)),{'ok':!0x1,'error':_0x139d18(0x1fc)+_0x40fdc3[_0x139d18(0x24a)]};}await _0x40fdc3[_0x139d18(0x22e)]();let _0x41d8ca=(await(await fetch(D+'/mcp',{'method':'POST','headers':{'Content-Type':'application/json','Accept':_0x139d18(0x1ed),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x139d18(0x240),'id':0x2,'method':'tools/call','params':{'name':_0x56684a,'arguments':_0xf45bed}})}))[_0x139d18(0x22e)]())[_0x139d18(0x1e3)]('\x0a')['find'](_0x12e0d1=>_0x12e0d1[_0x139d18(0x20a)](_0x139d18(0x200)));if(_0x41d8ca){let _0x13d5b4=JSON[_0x139d18(0x1f4)](_0x41d8ca[_0x139d18(0x1fd)](0x6));return _0x13d5b4?.[_0x139d18(0x246)]?.[_0x139d18(0x23c)]?.[0x0]?.[_0x139d18(0x22e)]?JSON[_0x139d18(0x1f4)](_0x13d5b4['result']['content'][0x0][_0x139d18(0x22e)]):_0x13d5b4;}return{'ok':!0x1,'error':'no\x20response'};}K['setRequestHandler'](a0_0x4a5706,async _0x87954f=>{const _0x47ce39=a0_0x28e694;let {name:_0x3e5a7a,arguments:_0x458668}=_0x87954f[_0x47ce39(0x257)];if(_0x3e5a7a===_0x47ce39(0x207)){let {task_id:_0x1f3bdd,text:_0x55785a,status:_0x189317}=_0x458668;if(_0x189317===_0x47ce39(0x1ec)||_0x189317===_0x47ce39(0x22f)||_0x189317===_0x47ce39(0x1f1)){let _0x3b45b4=_0x189317===_0x47ce39(0x1ec)?'replied':_0x189317,_0x48bedd=_0x1f3bdd?k[_0x47ce39(0x21f)](_0x1f3bdd)||'hub':_0x47ce39(0x213),_0x2376fe=await P('send_reply',{'alias':_0x48bedd,'text':_0x55785a,'in_reply_to':_0x1f3bdd||void 0x0,'status':_0x3b45b4,'from_session':Z});if(_0x1f3bdd)k[_0x47ce39(0x21a)](_0x1f3bdd);return{'content':[{'type':'text','text':JSON[_0x47ce39(0x20b)](_0x2376fe)}]};}let _0x3ed94e=await P(_0x47ce39(0x269),{'resume_id':w,'alias':Z,'status':_0x189317==='blocked'?_0x47ce39(0x250):_0x189317===_0x47ce39(0x26e)?_0x47ce39(0x26e):_0x47ce39(0x236),'task':_0x55785a[_0x47ce39(0x1fd)](0x0,0xc8),'output':_0x55785a});return{'content':[{'type':_0x47ce39(0x22e),'text':JSON[_0x47ce39(0x20b)](_0x3ed94e)}]};}if(_0x3e5a7a==='commhub_report_status'){let {status:_0x59aed5,task:_0x488865,progress:_0x147913}=_0x458668,_0x5358a6=await P(_0x47ce39(0x269),{'resume_id':w,'alias':Z,'status':_0x59aed5,'task':_0x488865,'progress':_0x147913});return{'content':[{'type':_0x47ce39(0x22e),'text':JSON[_0x47ce39(0x20b)](_0x5358a6)}]};}if(_0x3e5a7a===_0x47ce39(0x1e9)){let {alias:_0x203e5a,task:_0x42fabf,priority:_0x483d56}=_0x458668,_0x4c5653=await P(_0x47ce39(0x215),{'alias':_0x203e5a,'task':_0x42fabf,'priority':_0x483d56||_0x47ce39(0x247),'from_session':Z});return{'content':[{'type':_0x47ce39(0x22e),'text':JSON[_0x47ce39(0x20b)](_0x4c5653)}]};}if(_0x3e5a7a==='commhub_send_message'){let {alias:_0x35bebf,message:_0x45f96b}=_0x458668,_0x5f597b=await P(_0x47ce39(0x242),{'alias':_0x35bebf,'message':_0x45f96b,'from_session':Z});return{'content':[{'type':_0x47ce39(0x22e),'text':JSON['stringify'](_0x5f597b)}]};}if(_0x3e5a7a===_0x47ce39(0x219)){let _0x13c6f6=await P(_0x47ce39(0x25d),{});return{'content':[{'type':_0x47ce39(0x22e),'text':JSON[_0x47ce39(0x20b)](_0x13c6f6)}]};}return{'content':[{'type':_0x47ce39(0x22e),'text':JSON['stringify']({'error':_0x47ce39(0x20c)})}]};});async function v(){const _0x1e988c=a0_0x28e694;let _0x5abd5d=D+_0x1e988c(0x1f2)+encodeURIComponent(Z),_0x4473ac={};if(X)_0x4473ac[_0x1e988c(0x259)]=_0x1e988c(0x1ea)+X;Y(_0x1e988c(0x1e7)+_0x5abd5d);while(!0x0){try{let _0x1019da=await fetch(_0x5abd5d,{'headers':_0x4473ac});if(!_0x1019da['ok']){Y(_0x1e988c(0x248)+_0x1019da[_0x1e988c(0x24a)]+'\x20'+_0x1019da['statusText']),await h(0x1388);continue;}let _0x3fda85=_0x1019da[_0x1e988c(0x253)]['getReader'](),_0x308ce0=new TextDecoder(),_0x341d33='';while(!0x0){let {done:_0x2258c0,value:_0x2bf067}=await _0x3fda85[_0x1e988c(0x206)]();if(_0x2258c0)break;_0x341d33+=_0x308ce0[_0x1e988c(0x21d)](_0x2bf067,{'stream':!0x0});let _0x114c73=_0x341d33['split']('\x0a\x0a');_0x341d33=_0x114c73['pop']()||'';for(let _0x5848e3 of _0x114c73){let _0x4e3699=_0x5848e3['split']('\x0a')[_0x1e988c(0x204)](_0x56d793=>_0x56d793[_0x1e988c(0x20a)](_0x1e988c(0x200)));if(!_0x4e3699)continue;try{let _0x12939f=JSON[_0x1e988c(0x1f4)](_0x4e3699[_0x1e988c(0x1fd)](0x6));await u(_0x12939f);}catch(_0x26da38){Y(_0x1e988c(0x244)+_0x26da38);}}}Y(_0x1e988c(0x208));}catch(_0x430ccc){Y(_0x1e988c(0x24c)+_0x430ccc);}await h(0xbb8);}}async function u(_0x2bb88a){const _0x4bca02=a0_0x28e694;if(_0x2bb88a[_0x4bca02(0x212)]===_0x4bca02(0x21b)){Y(_0x4bca02(0x25a)+Z+'\x22');return;}if(_0x2bb88a[_0x4bca02(0x212)]===_0x4bca02(0x234)){if(Y(_0x4bca02(0x225)+_0x2bb88a[_0x4bca02(0x20f)]+':\x20'+_0x2bb88a[_0x4bca02(0x1f7)]['slice'](0x0,0x3c)),await K[_0x4bca02(0x260)]({'method':_0x4bca02(0x1fa),'params':{'content':_0x2bb88a[_0x4bca02(0x1f7)],'meta':{'sender':_0x2bb88a[_0x4bca02(0x20f)]||'hub','sender_id':_0x4bca02(0x237),'user':_0x2bb88a[_0x4bca02(0x20f)]||'hub','priority':'normal'}}}),_0x2bb88a[_0x4bca02(0x23a)])await P(_0x4bca02(0x205),{'alias':Z,'message_id':_0x2bb88a['message_id']});return;}if(_0x2bb88a['type']===_0x4bca02(0x1ee)||_0x2bb88a[_0x4bca02(0x212)]===_0x4bca02(0x25c)){Y('←\x20'+_0x2bb88a[_0x4bca02(0x212)]+_0x4bca02(0x1e2)+_0x2bb88a[_0x4bca02(0x261)]+'\x20priority='+(_0x2bb88a[_0x4bca02(0x1f3)]||_0x4bca02(0x247)));let _0x59f5ad=await P(_0x4bca02(0x1fb),{'alias':Z,'limit':0x5});if(_0x59f5ad?.['ok']&&_0x59f5ad[_0x4bca02(0x221)]?.[_0x4bca02(0x210)]>0x0)for(let _0x5e08bf of _0x59f5ad[_0x4bca02(0x221)]){let _0x5e8547={'sender':_0x5e08bf[_0x4bca02(0x268)]||'hub','sender_id':'commhub','user':_0x5e08bf[_0x4bca02(0x268)]||_0x4bca02(0x213),'task_id':_0x5e08bf['id'],'priority':_0x5e08bf[_0x4bca02(0x1f3)]||_0x4bca02(0x247)};k[_0x4bca02(0x20e)](_0x5e08bf['id'],_0x5e08bf[_0x4bca02(0x268)]||_0x4bca02(0x213)),await K[_0x4bca02(0x260)]({'method':'notifications/claude/channel','params':{'content':_0x5e08bf['content'],'meta':_0x5e8547}}),Y(_0x4bca02(0x21c)+_0x5e08bf['id']['slice'](0x0,0x8)+_0x4bca02(0x25e)+_0x5e08bf[_0x4bca02(0x268)]+':\x20'+_0x5e08bf['content'][_0x4bca02(0x1fd)](0x0,0x3c)),await P(_0x4bca02(0x205),{'alias':Z,'message_id':_0x5e08bf['id']});}}}async function S(){const _0x5bb0d7=a0_0x28e694;let _0x1e9d29=new a0_0x42cf96();await K['connect'](_0x1e9d29),Y(_0x5bb0d7(0x222)),Y(_0x5bb0d7(0x256)),v()[_0x5bb0d7(0x209)](_0x11c1cd=>Y(_0x5bb0d7(0x1f0)+_0x11c1cd)),P('report_status',{'resume_id':w,'alias':Z,'status':_0x5bb0d7(0x267),'server':a0_0x345ca0(),'hostname':a0_0x345ca0(),'agent':'claude-code','project_dir':process[_0x5bb0d7(0x1e4)](),'tmux_name':f||void 0x0})[_0x5bb0d7(0x1f8)](()=>Y(_0x5bb0d7(0x1f6)+Z+_0x5bb0d7(0x1fe)+w[_0x5bb0d7(0x1fd)](0x0,0x8)+')'))[_0x5bb0d7(0x209)](_0x504eab=>Y('warning:\x20could\x20not\x20register:\x20'+_0x504eab)),setInterval(()=>{const _0x162a75=_0x5bb0d7;P(_0x162a75(0x269),{'resume_id':w,'alias':Z,'status':_0x162a75(0x267),'server':a0_0x345ca0(),'hostname':a0_0x345ca0(),'agent':_0x162a75(0x211),'project_dir':process[_0x162a75(0x1e4)](),'tmux_name':f||void 0x0})[_0x162a75(0x209)](_0x1f249e=>Y('heartbeat\x20failed:\x20'+_0x1f249e));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}S()[a0_0x28e694(0x209)](_0x4761c8=>{const _0xb0a653=a0_0x28e694;Y(_0xb0a653(0x22c)+_0x4761c8),process[_0xb0a653(0x233)](0x1);});async function N(){const _0x31fe52=a0_0x28e694;Y(_0x31fe52(0x1eb)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x31fe52(0x26e),'task':_0x31fe52(0x23d)})[_0x31fe52(0x209)](()=>{}),process[_0x31fe52(0x233)](0x0);}process[a0_0x28e694(0x203)]['on']('end',()=>N()),process['on'](a0_0x28e694(0x252),()=>N()),process['on'](a0_0x28e694(0x227),()=>N());
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.0.0-preview.
|
|
4
|
-
"description": "AI Agent Network
|
|
3
|
+
"version": "2.0.0-preview.60",
|
|
4
|
+
"description": "AI Agent Network CLI \u2014 Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 39 commands.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|
|
7
7
|
"types": "dist/client.d.ts",
|
|
@@ -31,18 +31,20 @@
|
|
|
31
31
|
"mcp",
|
|
32
32
|
"sse",
|
|
33
33
|
"claude",
|
|
34
|
+
"codex",
|
|
34
35
|
"openai",
|
|
35
36
|
"minimax",
|
|
36
37
|
"orchestration",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"multi-agent",
|
|
39
|
+
"cli",
|
|
40
|
+
"anet"
|
|
40
41
|
],
|
|
41
42
|
"author": "sleep2agi",
|
|
42
43
|
"license": "MIT",
|
|
44
|
+
"homepage": "https://anet.vansin.me",
|
|
43
45
|
"repository": {
|
|
44
46
|
"type": "git",
|
|
45
|
-
"url": "https://github.com/sleep2agi/agent-
|
|
47
|
+
"url": "https://github.com/sleep2agi/agent-network",
|
|
46
48
|
"directory": "agent-network"
|
|
47
49
|
},
|
|
48
50
|
"engines": {
|
|
@@ -57,4 +59,4 @@
|
|
|
57
59
|
"node-pty": "^1.1.0",
|
|
58
60
|
"typescript": "^5.0.0"
|
|
59
61
|
}
|
|
60
|
-
}
|
|
62
|
+
}
|