@sleep2agi/agent-network 2.2.0 → 2.2.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
|
+
const a0_0x4f7e39=a0_0x2f0b;(function(_0x4bdea3,_0x43250a){const _0x20a73b=a0_0x2f0b,_0x54a75c=_0x4bdea3();while(!![]){try{const _0x5d9a9a=-parseInt(_0x20a73b(0xf2))/0x1*(parseInt(_0x20a73b(0x113))/0x2)+parseInt(_0x20a73b(0x114))/0x3*(-parseInt(_0x20a73b(0x103))/0x4)+parseInt(_0x20a73b(0xe6))/0x5+-parseInt(_0x20a73b(0x11a))/0x6+parseInt(_0x20a73b(0x11e))/0x7+-parseInt(_0x20a73b(0xf8))/0x8+parseInt(_0x20a73b(0x119))/0x9*(parseInt(_0x20a73b(0x11b))/0xa);if(_0x5d9a9a===_0x43250a)break;else _0x54a75c['push'](_0x54a75c['shift']());}catch(_0x2083d6){_0x54a75c['push'](_0x54a75c['shift']());}}}(a0_0x15cd,0x9f07c));function a0_0x15cd(){const _0x3abead=['send_reply','replace','token','send','6786NWWAaS','1467510AWPwiU','34340HObjRb','resumeId','completed','3966830vwSCrR','result','content','sdk-','signal','log','broadcast','call','report_status','data:\x20','text','read','text/event-stream','agent','connect','SSE\x20error:\x20','heartbeatTimer','heartbeatInterval','min','task','alias','send_message','getAllStatus','autoConnect','messages','toString','processInbox','split','Authorization','name','catch','2.0','404595bQdPSO','disconnected','get_inbox','inbox\x20error:\x20','s...','status','get_all_status','Bearer\x20','url','registered','stringify','from_session','4475CDhkFn','type','new_message','pop','message','SSE\x20connected','3691664ESggTv','emit','ack_inbox','new_task','sseAbort','SSE\x20reconnecting\x20in\x20','offline','application/json,\x20text/event-stream','server','application/json','sleep','4upiYBO','parse','getReader','body','running','abort','disconnect','idle','/events/','now','slice','reconnectDelay','reply','error','toTimeString','connected','422rOcfNO','2805567CvUjhO'];a0_0x15cd=function(){return _0x3abead;};return a0_0x15cd();}import{EventEmitter as a0_0x33bc0c}from'events';import{hostname as a0_0x43c30d}from'os';function a0_0x2f0b(_0x5731b2,_0x4ed3d2){_0x5731b2=_0x5731b2-0xce;const _0x15cd11=a0_0x15cd();let _0x2f0b7e=_0x15cd11[_0x5731b2];return _0x2f0b7e;}class T extends a0_0x33bc0c{['url'];[a0_0x4f7e39(0xda)];['token'];[a0_0x4f7e39(0xd3)];[a0_0x4f7e39(0x11c)];[a0_0x4f7e39(0xd7)];[a0_0x4f7e39(0x10e)];[a0_0x4f7e39(0xd6)];['sseAbort'];[a0_0x4f7e39(0x107)]=!0x1;constructor(_0x598088){const _0x3dd261=a0_0x4f7e39;super();if(this[_0x3dd261(0xee)]=_0x598088['url'][_0x3dd261(0x116)](/\/$/,''),this['alias']=_0x598088[_0x3dd261(0xda)],this[_0x3dd261(0x117)]=_0x598088['token'],this[_0x3dd261(0xd3)]=_0x598088[_0x3dd261(0xd3)]||'sdk',this[_0x3dd261(0x11c)]=_0x3dd261(0x121)+_0x598088['alias']+'-'+Date[_0x3dd261(0x10c)]()[_0x3dd261(0xdf)](0x24),this[_0x3dd261(0xd7)]=_0x598088[_0x3dd261(0xd7)]??0x2bf20,this[_0x3dd261(0x10e)]=_0x598088[_0x3dd261(0x10e)]??0xbb8,_0x598088[_0x3dd261(0xdd)]!==!0x1)this[_0x3dd261(0xd4)]();}['log'](_0x1fe499){const _0x46ab86=a0_0x4f7e39;console['log']('['+new Date()[_0x46ab86(0x111)]()[_0x46ab86(0x10d)](0x0,0x8)+']\x20[commhub:'+this['alias']+']\x20'+_0x1fe499);}async[a0_0x4f7e39(0x125)](_0x1ceb68,_0x180dca){const _0x186c10=a0_0x4f7e39;let _0x1df370={'Content-Type':_0x186c10(0x101),'Accept':_0x186c10(0xff)};if(this['token'])_0x1df370[_0x186c10(0xe2)]=_0x186c10(0xed)+this[_0x186c10(0x117)];let _0x520c76=await(await fetch(this['url']+'/mcp',{'method':'POST','headers':_0x1df370,'body':JSON[_0x186c10(0xf0)]({'jsonrpc':_0x186c10(0xe5),'id':Date[_0x186c10(0x10c)](),'method':'tools/call','params':{'name':_0x1ceb68,'arguments':_0x180dca}})}))[_0x186c10(0xd0)](),_0x2448f9=_0x520c76['match'](/data: (.+)/),_0x4dda86=_0x2448f9?JSON[_0x186c10(0x104)](_0x2448f9[0x1]):JSON[_0x186c10(0x104)](_0x520c76),_0x46000e=_0x4dda86?.[_0x186c10(0x11f)]?.['content']?.[0x0]?.['text'];return _0x46000e?JSON['parse'](_0x46000e):_0x4dda86;}async[a0_0x4f7e39(0xd4)](){const _0x160fdd=a0_0x4f7e39;if(this[_0x160fdd(0x107)])return;this[_0x160fdd(0x107)]=!0x0,await this[_0x160fdd(0xeb)](_0x160fdd(0x10a)),this[_0x160fdd(0x123)](_0x160fdd(0xef)),this[_0x160fdd(0xd6)]=setInterval(()=>{const _0x18dbb4=_0x160fdd;this['status'](_0x18dbb4(0x10a))[_0x18dbb4(0xe4)](_0x233bbe=>this['log']('heartbeat\x20failed:\x20'+_0x233bbe[_0x18dbb4(0xf6)]));},this[_0x160fdd(0xd7)]),this['connectSSE']();}async[a0_0x4f7e39(0x109)](){const _0x1fd899=a0_0x4f7e39;if(this['running']=!0x1,this[_0x1fd899(0xfc)]?.[_0x1fd899(0x108)](),this[_0x1fd899(0xd6)])clearInterval(this[_0x1fd899(0xd6)]);await this[_0x1fd899(0xeb)](_0x1fd899(0xfe))['catch'](()=>{}),this[_0x1fd899(0x123)]('disconnected');}async[a0_0x4f7e39(0x118)](_0x2894f4,_0x3471a3,_0x2a01cb='normal'){const _0x38533c=a0_0x4f7e39;return this[_0x38533c(0x125)]('send_task',{'alias':_0x2894f4,'task':_0x3471a3,'priority':_0x2a01cb,'from_session':this['alias']});}async[a0_0x4f7e39(0xf6)](_0x5b9d25,_0x5719e0){const _0x34309a=a0_0x4f7e39;return this['call'](_0x34309a(0xdb),{'alias':_0x5b9d25,'message':_0x5719e0,'from_session':this['alias']});}async[a0_0x4f7e39(0x10f)](_0x3ef385,_0x4412de,_0x436d90=a0_0x4f7e39(0x11d)){const _0x5b9607=a0_0x4f7e39;return this[_0x5b9607(0x125)](_0x5b9607(0x115),{'in_reply_to':_0x3ef385,'text':_0x4412de,'status':_0x436d90});}async[a0_0x4f7e39(0xeb)](_0x167533,_0x1459c9){const _0x2bfc46=a0_0x4f7e39;return this[_0x2bfc46(0x125)](_0x2bfc46(0xce),{'resume_id':this['resumeId'],'alias':this[_0x2bfc46(0xda)],'status':_0x167533,'server':a0_0x43c30d(),'hostname':a0_0x43c30d(),'agent':this[_0x2bfc46(0xd3)],'project_dir':process['cwd'](),..._0x1459c9});}async[a0_0x4f7e39(0xdc)](){const _0x18b7e6=a0_0x4f7e39;return this[_0x18b7e6(0x125)](_0x18b7e6(0xec),{});}async[a0_0x4f7e39(0x124)](_0x413cb4,_0x34af7c){const _0x298238=a0_0x4f7e39;return this[_0x298238(0x125)](_0x298238(0x124),{'message':_0x413cb4,'filter_server':_0x34af7c?.[_0x298238(0x100)],'filter_status':_0x34af7c?.['status']});}async['connectSSE'](){const _0x4ae24f=a0_0x4f7e39;let _0x596e19=encodeURIComponent(this[_0x4ae24f(0xda)]),_0x1f761d=this[_0x4ae24f(0xee)]+_0x4ae24f(0x10b)+_0x596e19,_0x3d104e=this[_0x4ae24f(0x10e)];while(this[_0x4ae24f(0x107)]){try{this['sseAbort']=new AbortController();let _0x2e2b67={'Accept':_0x4ae24f(0xd2)};if(this[_0x4ae24f(0x117)])_0x2e2b67[_0x4ae24f(0xe2)]=_0x4ae24f(0xed)+this[_0x4ae24f(0x117)];let _0x254992=await fetch(_0x1f761d,{'headers':_0x2e2b67,'signal':this[_0x4ae24f(0xfc)][_0x4ae24f(0x122)]});if(!_0x254992['ok']||!_0x254992[_0x4ae24f(0x106)]){this[_0x4ae24f(0x123)]('SSE\x20failed:\x20'+_0x254992['status']),await this['sleep'](_0x3d104e),_0x3d104e=Math[_0x4ae24f(0xd8)](_0x3d104e*1.5,0xea60);continue;}_0x3d104e=this['reconnectDelay'];let _0xc8cf71=_0x254992[_0x4ae24f(0x106)][_0x4ae24f(0x105)](),_0x114396=new TextDecoder(),_0xd245ab='';while(this[_0x4ae24f(0x107)]){let {done:_0x58a004,value:_0xb3cd3a}=await _0xc8cf71[_0x4ae24f(0xd1)]();if(_0x58a004)break;_0xd245ab+=_0x114396['decode'](_0xb3cd3a,{'stream':!0x0});let _0x3ef83f=_0xd245ab[_0x4ae24f(0xe1)]('\x0a');_0xd245ab=_0x3ef83f[_0x4ae24f(0xf5)]()||'';for(let _0x24bcb7 of _0x3ef83f){if(!_0x24bcb7['startsWith'](_0x4ae24f(0xcf)))continue;try{let _0x532b66=JSON[_0x4ae24f(0x104)](_0x24bcb7[_0x4ae24f(0x10d)](0x6));if(_0x532b66[_0x4ae24f(0xf3)]===_0x4ae24f(0x112)){this[_0x4ae24f(0x123)](_0x4ae24f(0xf7)),this[_0x4ae24f(0xf9)]('connected');continue;}if(_0x532b66['type']===_0x4ae24f(0xfb)||_0x532b66[_0x4ae24f(0xf3)]===_0x4ae24f(0xf4)||_0x532b66['type']===_0x4ae24f(0x124))await this[_0x4ae24f(0xe0)]();}catch{}}}}catch(_0x565ab7){if(_0x565ab7[_0x4ae24f(0xe3)]==='AbortError')break;this[_0x4ae24f(0xf9)](_0x4ae24f(0x110),_0x565ab7),this[_0x4ae24f(0x123)](_0x4ae24f(0xd5)+_0x565ab7[_0x4ae24f(0xf6)]);}if(this[_0x4ae24f(0x107)])this['emit'](_0x4ae24f(0xe7)),this[_0x4ae24f(0x123)](_0x4ae24f(0xfd)+_0x3d104e/0x3e8+_0x4ae24f(0xea)),await this[_0x4ae24f(0x102)](_0x3d104e),_0x3d104e=Math[_0x4ae24f(0xd8)](_0x3d104e*1.5,0xea60);}}async[a0_0x4f7e39(0xe0)](){const _0xa9831d=a0_0x4f7e39;try{let _0x118afa=(await this[_0xa9831d(0x125)](_0xa9831d(0xe8),{'alias':this[_0xa9831d(0xda)],'limit':0xa}))?.[_0xa9831d(0xde)]||[];for(let _0x5dea71 of _0x118afa)await this[_0xa9831d(0x125)](_0xa9831d(0xfa),{'alias':this[_0xa9831d(0xda)],'message_id':_0x5dea71['id']}),this['log']('←\x20'+_0x5dea71[_0xa9831d(0xf1)]+':\x20'+_0x5dea71[_0xa9831d(0x120)][_0xa9831d(0x10d)](0x0,0x3c)),this[_0xa9831d(0xf9)](_0xa9831d(0xd9),_0x5dea71),this[_0xa9831d(0xf9)]('message',_0x5dea71);}catch(_0x4ba1e2){this[_0xa9831d(0x123)](_0xa9831d(0xe9)+_0x4ba1e2[_0xa9831d(0xf6)]);}}[a0_0x4f7e39(0x102)](_0x521d9c){return new Promise(_0x4335e3=>setTimeout(_0x4335e3,_0x521d9c));}}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_0x5426cb=a0_0x5867;(function(_0x3eac44,_0x31c121){const _0xb1c39b=a0_0x5867,_0x46a402=_0x3eac44();while(!![]){try{const _0x5b17a0=parseInt(_0xb1c39b(0x269))/0x1+parseInt(_0xb1c39b(0x256))/0x2*(parseInt(_0xb1c39b(0x1fa))/0x3)+-parseInt(_0xb1c39b(0x267))/0x4*(-parseInt(_0xb1c39b(0x1f0))/0x5)+-parseInt(_0xb1c39b(0x225))/0x6+parseInt(_0xb1c39b(0x25f))/0x7+-parseInt(_0xb1c39b(0x1e1))/0x8+-parseInt(_0xb1c39b(0x1e4))/0x9;if(_0x5b17a0===_0x31c121)break;else _0x46a402['push'](_0x46a402['shift']());}catch(_0x258a07){_0x46a402['push'](_0x46a402['shift']());}}}(a0_0x1b33,0xc4dcd));import{readFileSync as a0_0x5e1a22,existsSync as a0_0x27dc4c}from'fs';import{randomUUID as a0_0x68ff34}from'crypto';import{join as a0_0x1d5732}from'path';import{hostname as a0_0x171ac2}from'os';import{execSync as a0_0x25654c}from'child_process';import{Server as a0_0x2a2aae}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x5867(_0x38233f,_0xf45c0f){_0x38233f=_0x38233f-0x1df;const _0x1b3313=a0_0x1b33();let _0x586773=_0x1b3313[_0x38233f];return _0x586773;}import{StdioServerTransport as a0_0x58ce57}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x281aee,CallToolRequestSchema as a0_0x3401cc}from'@modelcontextprotocol/sdk/types.js';function p(_0x27de4d){const _0x515a16=a0_0x5867;if(!a0_0x27dc4c(_0x27de4d))return;for(let _0x250081 of a0_0x5e1a22(_0x27de4d,_0x515a16(0x217))[_0x515a16(0x1e6)]('\x0a')){let _0x2ef262=_0x250081[_0x515a16(0x209)]();if(!_0x2ef262||_0x2ef262[_0x515a16(0x255)]('#'))continue;let _0xcbf6f1=_0x2ef262[_0x515a16(0x1e2)]('=');if(_0xcbf6f1<0x0)continue;let _0x944f17=_0x2ef262['slice'](0x0,_0xcbf6f1)[_0x515a16(0x209)](),_0x5d5869=_0x2ef262[_0x515a16(0x25b)](_0xcbf6f1+0x1)[_0x515a16(0x209)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x944f17])process.env[_0x944f17]=_0x5d5869;}}var C=process.env.HOME||'~',T=a0_0x1d5732(C,a0_0x5426cb(0x235));p(a0_0x1d5732(T,a0_0x5426cb(0x24b)));var L=process['cwd']()[a0_0x5426cb(0x22d)](/\//g,'-');p(a0_0x1d5732(T,L,a0_0x5426cb(0x24b)));function U(){const _0xa1f99=a0_0x5426cb;try{return a0_0x25654c(_0xa1f99(0x238),{'encoding':_0xa1f99(0x217),'timeout':0x7d0})['trim']();}catch{return'';}}function v(){const _0x2b3543=a0_0x5426cb;try{let _0x5163e3=a0_0x1d5732(C,_0x2b3543(0x254),'config.json');if(a0_0x27dc4c(_0x5163e3))return JSON[_0x2b3543(0x226)](a0_0x5e1a22(_0x5163e3,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x5426cb(0x1ec)]||a0_0x5426cb(0x23a),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x171ac2(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x68ff34(),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x32cc8f){const _0x351ca4=a0_0x5426cb;let _0x2c5313=new Date()['toTimeString']()[_0x351ca4(0x25b)](0x0,0x8);process[_0x351ca4(0x26a)]['write']('['+_0x2c5313+_0x351ca4(0x1f4)+_0x32cc8f+'\x0a');}function h(_0x4ec703){return new Promise(_0x2795e1=>setTimeout(_0x2795e1,_0x4ec703));}Y('ENV:\x20URL='+f+a0_0x5426cb(0x218)+Z+'\x20RESUME_ID='+w['slice'](0x0,0x8)+a0_0x5426cb(0x253)+(j||a0_0x5426cb(0x216))+a0_0x5426cb(0x206)+process[a0_0x5426cb(0x22b)]()+a0_0x5426cb(0x1ee)+L);var k=new Map(),K=new a0_0x2a2aae({'name':a0_0x5426cb(0x1eb),'version':a0_0x5426cb(0x1ef)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x5426cb(0x265),a0_0x5426cb(0x20c),a0_0x5426cb(0x250),a0_0x5426cb(0x24e),a0_0x5426cb(0x259)+Z][a0_0x5426cb(0x234)]('\x0a')});K[a0_0x5426cb(0x241)](a0_0x281aee,async()=>({'tools':[{'name':a0_0x5426cb(0x1f8),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x5426cb(0x21f),'properties':{'task_id':{'type':a0_0x5426cb(0x1f2),'description':a0_0x5426cb(0x203)},'text':{'type':a0_0x5426cb(0x1f2),'description':a0_0x5426cb(0x213)},'status':{'type':'string','enum':[a0_0x5426cb(0x236),a0_0x5426cb(0x20e),'cancelled',a0_0x5426cb(0x262),a0_0x5426cb(0x23e),a0_0x5426cb(0x230)],'description':a0_0x5426cb(0x242)}},'required':[a0_0x5426cb(0x261)]}},{'name':a0_0x5426cb(0x1e5),'description':a0_0x5426cb(0x20f),'inputSchema':{'type':'object','properties':{'status':{'type':'string','enum':[a0_0x5426cb(0x221),'idle','blocked',a0_0x5426cb(0x23e)]},'task':{'type':a0_0x5426cb(0x1f2),'description':'Current\x20task\x20description'},'progress':{'type':'number','description':a0_0x5426cb(0x219)}},'required':['status']}},{'name':a0_0x5426cb(0x266),'description':a0_0x5426cb(0x1e3),'inputSchema':{'type':a0_0x5426cb(0x21f),'properties':{'alias':{'type':'string','description':a0_0x5426cb(0x268)},'task':{'type':'string','description':a0_0x5426cb(0x248)},'priority':{'type':a0_0x5426cb(0x1f2),'enum':['high',a0_0x5426cb(0x243),a0_0x5426cb(0x21a)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x5426cb(0x21c),'task']}},{'name':a0_0x5426cb(0x23b),'description':a0_0x5426cb(0x252),'inputSchema':{'type':'object','properties':{'alias':{'type':'string','description':a0_0x5426cb(0x268)},'message':{'type':'string','description':a0_0x5426cb(0x237)}},'required':['alias',a0_0x5426cb(0x223)]}},{'name':a0_0x5426cb(0x247),'description':a0_0x5426cb(0x21e),'inputSchema':{'type':a0_0x5426cb(0x21f),'properties':{}}}]}));async function P(_0x387f7b,_0x148d9e){const _0x41b9cc=a0_0x5426cb;let _0x35de6c=await fetch(f+_0x41b9cc(0x23f),{'method':'POST','headers':{'Content-Type':_0x41b9cc(0x1f1),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x41b9cc(0x22e)]({'jsonrpc':_0x41b9cc(0x263),'id':0x1,'method':_0x41b9cc(0x25d),'params':{'protocolVersion':_0x41b9cc(0x200),'capabilities':{},'clientInfo':{'name':_0x41b9cc(0x1eb),'version':'0.3.0'}}})});if(!_0x35de6c['ok']){let _0x2de668=await _0x35de6c['text']();return Y(_0x41b9cc(0x212)+_0x35de6c[_0x41b9cc(0x24a)]+'\x20'+_0x2de668[_0x41b9cc(0x25b)](0x0,0x64)),{'ok':!0x1,'error':_0x41b9cc(0x20b)+_0x35de6c[_0x41b9cc(0x24a)]};}await _0x35de6c[_0x41b9cc(0x261)]();let _0x126755=(await(await fetch(f+_0x41b9cc(0x23f),{'method':_0x41b9cc(0x1f7),'headers':{'Content-Type':_0x41b9cc(0x1f1),'Accept':_0x41b9cc(0x1fc),...X?{'Authorization':_0x41b9cc(0x214)+X}:{}},'body':JSON[_0x41b9cc(0x22e)]({'jsonrpc':_0x41b9cc(0x263),'id':0x2,'method':_0x41b9cc(0x1fd),'params':{'name':_0x387f7b,'arguments':_0x148d9e}})}))[_0x41b9cc(0x261)]())[_0x41b9cc(0x1e6)]('\x0a')[_0x41b9cc(0x1fb)](_0x5f6192=>_0x5f6192['startsWith'](_0x41b9cc(0x264)));if(_0x126755){let _0x438036=JSON[_0x41b9cc(0x226)](_0x126755[_0x41b9cc(0x25b)](0x6));return _0x438036?.[_0x41b9cc(0x1ed)]?.[_0x41b9cc(0x231)]?.[0x0]?.[_0x41b9cc(0x261)]?JSON[_0x41b9cc(0x226)](_0x438036[_0x41b9cc(0x1ed)]['content'][0x0]['text']):_0x438036;}return{'ok':!0x1,'error':_0x41b9cc(0x1e9)};}K[a0_0x5426cb(0x241)](a0_0x3401cc,async _0x237f87=>{const _0x78f058=a0_0x5426cb;let {name:_0x4b2118,arguments:_0x1855ba}=_0x237f87[_0x78f058(0x202)];if(_0x4b2118===_0x78f058(0x1f8)){let {task_id:_0x1e08c5,text:_0x591cfa,status:_0x229e09}=_0x1855ba;if(_0x229e09===_0x78f058(0x236)||_0x229e09==='failed'||_0x229e09===_0x78f058(0x1ff)){let _0x8d6d58=_0x229e09===_0x78f058(0x236)?_0x78f058(0x24d):_0x229e09,_0xbbc2d9=_0x1e08c5?k[_0x78f058(0x21d)](_0x1e08c5)||_0x78f058(0x1ec):_0x78f058(0x1ec),_0x430f41=await P(_0x78f058(0x246),{'alias':_0xbbc2d9,'text':_0x591cfa,'in_reply_to':_0x1e08c5||void 0x0,'status':_0x8d6d58,'from_session':Z});if(_0x1e08c5)k[_0x78f058(0x204)](_0x1e08c5);return{'content':[{'type':_0x78f058(0x261),'text':JSON[_0x78f058(0x22e)](_0x430f41)}]};}let _0xe92c87=await P(_0x78f058(0x22a),{'resume_id':w,'alias':Z,'status':_0x229e09==='blocked'?'blocked':_0x229e09==='error'?'error':_0x78f058(0x221),'task':_0x591cfa[_0x78f058(0x25b)](0x0,0xc8),'output':_0x591cfa});return{'content':[{'type':_0x78f058(0x261),'text':JSON[_0x78f058(0x22e)](_0xe92c87)}]};}if(_0x4b2118==='commhub_report_status'){let {status:_0xe04031,task:_0xacbf8d,progress:_0xc4a56a}=_0x1855ba,_0x15eab7=await P(_0x78f058(0x22a),{'resume_id':w,'alias':Z,'status':_0xe04031,'task':_0xacbf8d,'progress':_0xc4a56a});return{'content':[{'type':_0x78f058(0x261),'text':JSON[_0x78f058(0x22e)](_0x15eab7)}]};}if(_0x4b2118==='commhub_send_task'){let {alias:_0x18a8a4,task:_0x411016,priority:_0x3b006b}=_0x1855ba,_0x5b1c6f=await P(_0x78f058(0x25a),{'alias':_0x18a8a4,'task':_0x411016,'priority':_0x3b006b||'normal','from_session':Z});return{'content':[{'type':_0x78f058(0x261),'text':JSON[_0x78f058(0x22e)](_0x5b1c6f)}]};}if(_0x4b2118===_0x78f058(0x23b)){let {alias:_0x34256a,message:_0xe512f2}=_0x1855ba,_0x26b67b=await P(_0x78f058(0x25e),{'alias':_0x34256a,'message':_0xe512f2,'from_session':Z});return{'content':[{'type':_0x78f058(0x261),'text':JSON[_0x78f058(0x22e)](_0x26b67b)}]};}if(_0x4b2118===_0x78f058(0x247)){let _0x1ace3f=await P(_0x78f058(0x1fe),{});return{'content':[{'type':_0x78f058(0x261),'text':JSON[_0x78f058(0x22e)](_0x1ace3f)}]};}return{'content':[{'type':_0x78f058(0x261),'text':JSON[_0x78f058(0x22e)]({'error':_0x78f058(0x244)})}]};});async function u(){const _0x2b82df=a0_0x5426cb;let _0x4c6bc5=f+_0x2b82df(0x23d)+encodeURIComponent(Z),_0x5c9fb0={};if(X)_0x5c9fb0[_0x2b82df(0x25c)]=_0x2b82df(0x214)+X;Y(_0x2b82df(0x20d)+_0x4c6bc5);while(!0x0){try{let _0x17eb52=await fetch(_0x4c6bc5,{'headers':_0x5c9fb0});if(!_0x17eb52['ok']){Y(_0x2b82df(0x1f6)+_0x17eb52[_0x2b82df(0x24a)]+'\x20'+_0x17eb52['statusText']),await h(0x1388);continue;}let _0x4611a6=_0x17eb52[_0x2b82df(0x23c)]['getReader'](),_0x37f829=new TextDecoder(),_0x58d942='';while(!0x0){let {done:_0x1fb04c,value:_0x4f0b92}=await _0x4611a6[_0x2b82df(0x26b)]();if(_0x1fb04c)break;_0x58d942+=_0x37f829['decode'](_0x4f0b92,{'stream':!0x0});let _0x4be363=_0x58d942[_0x2b82df(0x1e6)]('\x0a\x0a');_0x58d942=_0x4be363[_0x2b82df(0x215)]()||'';for(let _0x5c06ba of _0x4be363){let _0x1a1a0a=_0x5c06ba[_0x2b82df(0x1e6)]('\x0a')[_0x2b82df(0x1fb)](_0x5295cb=>_0x5295cb[_0x2b82df(0x255)](_0x2b82df(0x264)));if(!_0x1a1a0a)continue;try{let _0x107eb3=JSON[_0x2b82df(0x226)](_0x1a1a0a[_0x2b82df(0x25b)](0x6));await S(_0x107eb3);}catch(_0x3a02d4){Y(_0x2b82df(0x22c)+_0x3a02d4);}}}Y(_0x2b82df(0x1f9));}catch(_0x162976){Y(_0x2b82df(0x1f3)+_0x162976);}await h(0xbb8);}}async function S(_0x266872){const _0x44f447=a0_0x5426cb;if(_0x266872[_0x44f447(0x222)]==='connected'){Y(_0x44f447(0x257)+Z+'\x22');return;}if(_0x266872['type']==='new_message'){if(Y(_0x44f447(0x260)+_0x266872['from']+':\x20'+_0x266872[_0x44f447(0x223)][_0x44f447(0x25b)](0x0,0x3c)),await K[_0x44f447(0x210)]({'method':'notifications/claude/channel','params':{'content':_0x266872['message'],'meta':{'sender':_0x266872['from']||_0x44f447(0x1ec),'sender_id':'commhub','user':_0x266872['from']||_0x44f447(0x1ec),'priority':_0x44f447(0x243)}}}),_0x266872[_0x44f447(0x20a)])await P(_0x44f447(0x207),{'alias':Z,'message_id':_0x266872[_0x44f447(0x20a)]});return;}if(_0x266872[_0x44f447(0x222)]===_0x44f447(0x1e7)||_0x266872['type']===_0x44f447(0x22f)){Y('←\x20'+_0x266872[_0x44f447(0x222)]+_0x44f447(0x240)+_0x266872[_0x44f447(0x205)]+_0x44f447(0x24c)+(_0x266872[_0x44f447(0x249)]||'normal'));let _0xe7f3bd=await P(_0x44f447(0x227),{'alias':Z,'limit':0x5});if(_0xe7f3bd?.['ok']&&_0xe7f3bd[_0x44f447(0x220)]?.[_0x44f447(0x258)]>0x0)for(let _0x5703b6 of _0xe7f3bd[_0x44f447(0x220)]){let _0x3dfb18={'sender':_0x5703b6[_0x44f447(0x229)]||_0x44f447(0x1ec),'sender_id':'commhub','user':_0x5703b6['from_session']||'hub','task_id':_0x5703b6['id'],'priority':_0x5703b6[_0x44f447(0x249)]||_0x44f447(0x243)};k[_0x44f447(0x201)](_0x5703b6['id'],_0x5703b6[_0x44f447(0x229)]||_0x44f447(0x1ec)),await K['notification']({'method':_0x44f447(0x233),'params':{'content':_0x5703b6[_0x44f447(0x231)],'meta':_0x3dfb18}}),Y(_0x44f447(0x232)+_0x5703b6['id'][_0x44f447(0x25b)](0x0,0x8)+_0x44f447(0x1e0)+_0x5703b6[_0x44f447(0x229)]+':\x20'+_0x5703b6[_0x44f447(0x231)][_0x44f447(0x25b)](0x0,0x3c)),await P(_0x44f447(0x207),{'alias':Z,'message_id':_0x5703b6['id']});}}}async function A(){const _0x290db9=a0_0x5426cb;let _0x59d612=new a0_0x58ce57();await K[_0x290db9(0x24f)](_0x59d612),Y('MCP\x20stdio\x20connected'),Y(_0x290db9(0x251)),u()[_0x290db9(0x245)](_0x5b409c=>Y(_0x290db9(0x211)+_0x5b409c)),P('report_status',{'resume_id':w,'alias':Z,'status':_0x290db9(0x1ea),'server':a0_0x171ac2(),'hostname':a0_0x171ac2(),'agent':_0x290db9(0x1df),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x290db9(0x239)](()=>Y(_0x290db9(0x224)+Z+'\x22\x20('+w[_0x290db9(0x25b)](0x0,0x8)+')'))[_0x290db9(0x245)](_0x4277e7=>Y(_0x290db9(0x208)+_0x4277e7)),setInterval(()=>{const _0x545132=_0x290db9;P(_0x545132(0x22a),{'resume_id':w,'alias':Z,'status':_0x545132(0x1ea),'server':a0_0x171ac2(),'hostname':a0_0x171ac2(),'agent':_0x545132(0x1df),'project_dir':process[_0x545132(0x22b)](),'tmux_name':j||void 0x0})[_0x545132(0x245)](_0x4f8b25=>Y('heartbeat\x20failed:\x20'+_0x4f8b25));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x5426cb(0x245)](_0x250919=>{const _0x5424fb=a0_0x5426cb;Y(_0x5424fb(0x228)+_0x250919),process[_0x5424fb(0x1f5)](0x1);});async function N(){const _0x4174e5=a0_0x5426cb;Y('shutting\x20down,\x20reporting\x20offline...'),await P('report_status',{'resume_id':w,'alias':Z,'status':'error','task':'session\x20disconnected'})[_0x4174e5(0x245)](()=>{}),process['exit'](0x0);}process[a0_0x5426cb(0x21b)]['on'](a0_0x5426cb(0x1e8),()=>N()),process['on']('SIGTERM',()=>N()),process['on']('SIGINT',()=>N());function a0_0x1b33(){const _0x205916=['params','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','delete','inbox_count','\x20CWD=','ack_inbox','warning:\x20could\x20not\x20register:\x20','trim','message_id','init\x20failed:\x20','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','connecting\x20to\x20','failed','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','notification','SSE\x20fatal:\x20','CommHub\x20init\x20failed:\x20','Reply\x20text\x20/\x20result\x20summary','Bearer\x20','pop','none','utf-8','\x20ALIAS=','Progress\x200-100','low','stdin','alias','get','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','object','messages','working','type','message','registered\x20as\x20\x22','6025416CElYfd','parse','get_inbox','fatal:\x20','from_session','report_status','cwd','parse\x20error:\x20','replace','stringify','broadcast','in_progress','content','→\x20injected\x20task\x20','notifications/claude/channel','join','.claude/channels/commhub','completed','Message\x20content','tmux\x20display-message\x20-p\x20\x27#S\x27','then','http://127.0.0.1:9200','commhub_send_message','body','/events/','error','/mcp',':\x20inbox_count=','setRequestHandler','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','normal','unknown\x20tool','catch','send_reply','commhub_get_all_status','Task\x20content','priority','status','.env','\x20priority=','replied','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','connect','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','starting\x20SSE\x20listener...','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','...\x20TMUX=','.anet','startsWith','299494qvSbfA','SSE\x20connected\x20as\x20\x22','length','Session\x20alias:\x20','send_task','slice','Authorization','initialize','send_message','8475390Smldfp','←\x20message\x20from\x20','text','blocked','2.0','data:\x20','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','commhub_send_task','31604gvAmQv','Target\x20session\x20alias','976368VTbSTj','stderr','read','claude-code','\x20from\x20','8155184iHSPep','indexOf','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','3015171YzLSBv','commhub_report_status','split','new_task','end','no\x20response','idle','commhub-channel','hub','result','\x20PROJECT_ENV=','0.3.0','145MoobzY','application/json','string','SSE\x20connection\x20error:\x20',']\x20[commhub]\x20','exit','SSE\x20error:\x20','POST','commhub_reply','SSE\x20stream\x20ended,\x20reconnecting...','15wRbJKl','find','application/json,\x20text/event-stream','tools/call','get_all_status','cancelled','2025-03-26','set'];a0_0x1b33=function(){return _0x205916;};return a0_0x1b33();}
|
|
2
|
+
const a0_0x333af0=a0_0x39e1;(function(_0x125d95,_0x5868ee){const _0x555af8=a0_0x39e1,_0xf1d24b=_0x125d95();while(!![]){try{const _0x47b001=-parseInt(_0x555af8(0x1db))/0x1*(-parseInt(_0x555af8(0x1ec))/0x2)+parseInt(_0x555af8(0x1e3))/0x3*(-parseInt(_0x555af8(0x1a3))/0x4)+-parseInt(_0x555af8(0x1de))/0x5+parseInt(_0x555af8(0x169))/0x6*(-parseInt(_0x555af8(0x1d0))/0x7)+parseInt(_0x555af8(0x1ad))/0x8+-parseInt(_0x555af8(0x1cb))/0x9*(parseInt(_0x555af8(0x1e1))/0xa)+-parseInt(_0x555af8(0x187))/0xb*(-parseInt(_0x555af8(0x1ea))/0xc);if(_0x47b001===_0x5868ee)break;else _0xf1d24b['push'](_0xf1d24b['shift']());}catch(_0x1795a5){_0xf1d24b['push'](_0xf1d24b['shift']());}}}(a0_0x532e,0xa8ce5));import{readFileSync as a0_0x1bf441,existsSync as a0_0x551167}from'fs';import{randomUUID as a0_0x1031a6}from'crypto';import{join as a0_0x2a2ba6}from'path';import{hostname as a0_0x3fafea}from'os';import{execSync as a0_0x1e275e}from'child_process';import{Server as a0_0x11f3b2}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x532e(){const _0x404c80=['inbox_count','MCP\x20stdio\x20connected','→\x20injected\x20task\x20','...\x20TMUX=','warning:\x20could\x20not\x20register:\x20','replace','indexOf','commhub_reply','89023ZAfaHP','write','get_all_status','set','slice','utf-8','error','Authorization','high','trim','send_message','alias','\x20ALIAS=','messages','commhub_send_message','toTimeString','connected','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','type','starting\x20SSE\x20listener...','commhub_report_status','status','\x20RESUME_ID=','string','shutting\x20down,\x20reporting\x20offline...','setRequestHandler','idle','exit','4426692PDWxit','\x20CWD=','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','send_task','stdin','result','find','ready\x20—\x20waiting\x20for\x20events','working','new_message','203112CaYpvE','failed','parse','/mcp','task','.anet','SSE\x20error:\x20','2.0','SSE\x20connected\x20as\x20\x22','ack_inbox','2025-03-26','catch','connect','cwd','SIGTERM','config.json','CommHub\x20init\x20failed:\x20','priority','unknown\x20tool','claude-code','connecting\x20to\x20','then','commhub_send_task','getReader','Progress\x200-100','Reply\x20text\x20/\x20result\x20summary','text',':\x20inbox_count=','stderr','params','9uJWoFq','startsWith','parse\x20error:\x20','commhub_get_all_status','SSE\x20fatal:\x20','42hXKBZi','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','no\x20response','end','ENV:\x20URL=','initialize','.claude/channels/commhub',']\x20[commhub]\x20','notification','\x20PROJECT_ENV=','low','463143UYpJET','normal','Bearer\x20','1206665fwSvwP','commhub','Target\x20session\x20alias','2760790IBWPSR','SIGINT','3ytldqp','SSE\x20connection\x20error:\x20','application/json','length','message_id','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','3312kjactT','split','2EhRoly','init\x20failed:\x20','cancelled','hub','fatal:\x20','notifications/claude/channel','registered\x20as\x20\x22','send_reply','\x20from\x20','406686mnkJss','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','http://127.0.0.1:9200','data:\x20','heartbeat\x20failed:\x20','blocked','POST','object','0.3.0','stringify','in_progress','from','from_session','completed','report_status','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','content','.env','body','Message\x20content','message','get'];a0_0x532e=function(){return _0x404c80;};return a0_0x532e();}import{StdioServerTransport as a0_0x434a88}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x990d89,CallToolRequestSchema as a0_0x3b53f1}from'@modelcontextprotocol/sdk/types.js';function p(_0x1fb848){const _0x3b2513=a0_0x39e1;if(!a0_0x551167(_0x1fb848))return;for(let _0x5d9391 of a0_0x1bf441(_0x1fb848,_0x3b2513(0x18c))[_0x3b2513(0x1eb)]('\x0a')){let _0x17e10d=_0x5d9391[_0x3b2513(0x190)]();if(!_0x17e10d||_0x17e10d[_0x3b2513(0x1cc)]('#'))continue;let _0x162693=_0x17e10d[_0x3b2513(0x185)]('=');if(_0x162693<0x0)continue;let _0x5161df=_0x17e10d['slice'](0x0,_0x162693)[_0x3b2513(0x190)](),_0x259dfc=_0x17e10d['slice'](_0x162693+0x1)[_0x3b2513(0x190)]()[_0x3b2513(0x184)](/^["']|["']$/g,'');if(!process.env[_0x5161df])process.env[_0x5161df]=_0x259dfc;}}var C=process.env.HOME||'~',T=a0_0x2a2ba6(C,a0_0x333af0(0x1d6));p(a0_0x2a2ba6(T,'.env'));var L=process[a0_0x333af0(0x1ba)]()['replace'](/\//g,'-');p(a0_0x2a2ba6(T,L,a0_0x333af0(0x17a)));function U(){const _0x32f7d9=a0_0x333af0;try{return a0_0x1e275e('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x32f7d9(0x18c),'timeout':0x7d0})[_0x32f7d9(0x190)]();}catch{return'';}}function v(){const _0x17fdd9=a0_0x333af0;try{let _0x4c2189=a0_0x2a2ba6(C,_0x17fdd9(0x1b2),_0x17fdd9(0x1bc));if(a0_0x551167(_0x4c2189))return JSON['parse'](a0_0x1bf441(_0x4c2189,_0x17fdd9(0x18c)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x333af0(0x1ef)]||a0_0x333af0(0x16b),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x3fafea(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x1031a6(),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x3660ed){const _0x1aaedd=a0_0x333af0;let _0x568ca8=new Date()[_0x1aaedd(0x196)]()[_0x1aaedd(0x18b)](0x0,0x8);process[_0x1aaedd(0x1c9)][_0x1aaedd(0x188)]('['+_0x568ca8+_0x1aaedd(0x1d7)+_0x3660ed+'\x0a');}function h(_0x5bba53){return new Promise(_0x149dbe=>setTimeout(_0x149dbe,_0x5bba53));}Y(a0_0x333af0(0x1d4)+f+a0_0x333af0(0x193)+Z+a0_0x333af0(0x19d)+w[a0_0x333af0(0x18b)](0x0,0x8)+a0_0x333af0(0x182)+(j||'none')+a0_0x333af0(0x1a4)+process[a0_0x333af0(0x1ba)]()+a0_0x333af0(0x1d9)+L);var k=new Map(),K=new a0_0x11f3b2({'name':'commhub-channel','version':a0_0x333af0(0x171)},{'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>','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x333af0(0x16a),a0_0x333af0(0x1e9),'Session\x20alias:\x20'+Z]['join']('\x0a')});K[a0_0x333af0(0x1a0)](a0_0x990d89,async()=>({'tools':[{'name':a0_0x333af0(0x186),'description':a0_0x333af0(0x1e8),'inputSchema':{'type':a0_0x333af0(0x170),'properties':{'task_id':{'type':a0_0x333af0(0x19e),'description':a0_0x333af0(0x1a5)},'text':{'type':'string','description':a0_0x333af0(0x1c6)},'status':{'type':'string','enum':[a0_0x333af0(0x176),a0_0x333af0(0x1ae),a0_0x333af0(0x1ee),a0_0x333af0(0x16e),'error',a0_0x333af0(0x173)],'description':a0_0x333af0(0x178)}},'required':[a0_0x333af0(0x1c7)]}},{'name':a0_0x333af0(0x19b),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':'object','properties':{'status':{'type':a0_0x333af0(0x19e),'enum':['working',a0_0x333af0(0x1a1),a0_0x333af0(0x16e),'error']},'task':{'type':a0_0x333af0(0x19e),'description':'Current\x20task\x20description'},'progress':{'type':'number','description':a0_0x333af0(0x1c5)}},'required':[a0_0x333af0(0x19c)]}},{'name':a0_0x333af0(0x1c3),'description':a0_0x333af0(0x1d1),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x333af0(0x19e),'description':a0_0x333af0(0x1e0)},'task':{'type':a0_0x333af0(0x19e),'description':'Task\x20content'},'priority':{'type':a0_0x333af0(0x19e),'enum':[a0_0x333af0(0x18f),a0_0x333af0(0x1dc),a0_0x333af0(0x1da)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x333af0(0x192),a0_0x333af0(0x1b1)]}},{'name':'commhub_send_message','description':a0_0x333af0(0x198),'inputSchema':{'type':a0_0x333af0(0x170),'properties':{'alias':{'type':'string','description':a0_0x333af0(0x1e0)},'message':{'type':a0_0x333af0(0x19e),'description':a0_0x333af0(0x17c)}},'required':[a0_0x333af0(0x192),'message']}},{'name':a0_0x333af0(0x1ce),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x333af0(0x170),'properties':{}}}]}));async function P(_0xabaab7,_0xf1ce2f){const _0x60b326=a0_0x333af0;let _0x10851a=await fetch(f+_0x60b326(0x1b0),{'method':_0x60b326(0x16f),'headers':{'Content-Type':_0x60b326(0x1e5),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x60b326(0x1dd)+X}:{}},'body':JSON[_0x60b326(0x172)]({'jsonrpc':_0x60b326(0x1b4),'id':0x1,'method':_0x60b326(0x1d5),'params':{'protocolVersion':_0x60b326(0x1b7),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x60b326(0x171)}}})});if(!_0x10851a['ok']){let _0x437385=await _0x10851a[_0x60b326(0x1c7)]();return Y(_0x60b326(0x1bd)+_0x10851a['status']+'\x20'+_0x437385[_0x60b326(0x18b)](0x0,0x64)),{'ok':!0x1,'error':_0x60b326(0x1ed)+_0x10851a[_0x60b326(0x19c)]};}await _0x10851a[_0x60b326(0x1c7)]();let _0x168713=(await(await fetch(f+_0x60b326(0x1b0),{'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x60b326(0x172)]({'jsonrpc':_0x60b326(0x1b4),'id':0x2,'method':'tools/call','params':{'name':_0xabaab7,'arguments':_0xf1ce2f}})}))[_0x60b326(0x1c7)]())[_0x60b326(0x1eb)]('\x0a')[_0x60b326(0x1a9)](_0x2d396a=>_0x2d396a[_0x60b326(0x1cc)](_0x60b326(0x16c)));if(_0x168713){let _0x4b13b7=JSON[_0x60b326(0x1af)](_0x168713[_0x60b326(0x18b)](0x6));return _0x4b13b7?.[_0x60b326(0x1a8)]?.['content']?.[0x0]?.[_0x60b326(0x1c7)]?JSON[_0x60b326(0x1af)](_0x4b13b7[_0x60b326(0x1a8)][_0x60b326(0x179)][0x0]['text']):_0x4b13b7;}return{'ok':!0x1,'error':_0x60b326(0x1d2)};}K[a0_0x333af0(0x1a0)](a0_0x3b53f1,async _0x3975b1=>{const _0x1b317d=a0_0x333af0;let {name:_0x33374c,arguments:_0x1811a0}=_0x3975b1[_0x1b317d(0x1ca)];if(_0x33374c===_0x1b317d(0x186)){let {task_id:_0x4be889,text:_0x2d1d37,status:_0xe50634}=_0x1811a0;if(_0xe50634==='completed'||_0xe50634===_0x1b317d(0x1ae)||_0xe50634===_0x1b317d(0x1ee)){let _0x3dbd23=_0xe50634===_0x1b317d(0x176)?'replied':_0xe50634,_0x34c4bd=_0x4be889?k[_0x1b317d(0x17e)](_0x4be889)||_0x1b317d(0x1ef):_0x1b317d(0x1ef),_0x2648eb=await P(_0x1b317d(0x167),{'alias':_0x34c4bd,'text':_0x2d1d37,'in_reply_to':_0x4be889||void 0x0,'status':_0x3dbd23,'from_session':Z});if(_0x4be889)k['delete'](_0x4be889);return{'content':[{'type':_0x1b317d(0x1c7),'text':JSON[_0x1b317d(0x172)](_0x2648eb)}]};}let _0x15180f=await P(_0x1b317d(0x177),{'resume_id':w,'alias':Z,'status':_0xe50634===_0x1b317d(0x16e)?'blocked':_0xe50634==='error'?_0x1b317d(0x18d):_0x1b317d(0x1ab),'task':_0x2d1d37[_0x1b317d(0x18b)](0x0,0xc8),'output':_0x2d1d37});return{'content':[{'type':_0x1b317d(0x1c7),'text':JSON[_0x1b317d(0x172)](_0x15180f)}]};}if(_0x33374c===_0x1b317d(0x19b)){let {status:_0x45fef1,task:_0x278173,progress:_0x4a7d54}=_0x1811a0,_0x51a54e=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x45fef1,'task':_0x278173,'progress':_0x4a7d54});return{'content':[{'type':_0x1b317d(0x1c7),'text':JSON['stringify'](_0x51a54e)}]};}if(_0x33374c==='commhub_send_task'){let {alias:_0x5e9ada,task:_0x169fdd,priority:_0x6fefa1}=_0x1811a0,_0x3d5d63=await P(_0x1b317d(0x1a6),{'alias':_0x5e9ada,'task':_0x169fdd,'priority':_0x6fefa1||_0x1b317d(0x1dc),'from_session':Z});return{'content':[{'type':_0x1b317d(0x1c7),'text':JSON[_0x1b317d(0x172)](_0x3d5d63)}]};}if(_0x33374c===_0x1b317d(0x195)){let {alias:_0x2ab4b4,message:_0x41c2bb}=_0x1811a0,_0x2e995b=await P(_0x1b317d(0x191),{'alias':_0x2ab4b4,'message':_0x41c2bb,'from_session':Z});return{'content':[{'type':_0x1b317d(0x1c7),'text':JSON[_0x1b317d(0x172)](_0x2e995b)}]};}if(_0x33374c===_0x1b317d(0x1ce)){let _0x479ada=await P(_0x1b317d(0x189),{});return{'content':[{'type':_0x1b317d(0x1c7),'text':JSON[_0x1b317d(0x172)](_0x479ada)}]};}return{'content':[{'type':_0x1b317d(0x1c7),'text':JSON[_0x1b317d(0x172)]({'error':_0x1b317d(0x1bf)})}]};});async function u(){const _0x21f58d=a0_0x333af0;let _0x5d6e86=f+'/events/'+encodeURIComponent(Z),_0x22be39={};if(X)_0x22be39[_0x21f58d(0x18e)]=_0x21f58d(0x1dd)+X;Y(_0x21f58d(0x1c1)+_0x5d6e86);while(!0x0){try{let _0x276d7e=await fetch(_0x5d6e86,{'headers':_0x22be39});if(!_0x276d7e['ok']){Y(_0x21f58d(0x1b3)+_0x276d7e['status']+'\x20'+_0x276d7e['statusText']),await h(0x1388);continue;}let _0x22872f=_0x276d7e[_0x21f58d(0x17b)][_0x21f58d(0x1c4)](),_0x3c7ab9=new TextDecoder(),_0xd5d1a6='';while(!0x0){let {done:_0x42f917,value:_0x278163}=await _0x22872f['read']();if(_0x42f917)break;_0xd5d1a6+=_0x3c7ab9['decode'](_0x278163,{'stream':!0x0});let _0x3379fd=_0xd5d1a6[_0x21f58d(0x1eb)]('\x0a\x0a');_0xd5d1a6=_0x3379fd['pop']()||'';for(let _0x1b30fb of _0x3379fd){let _0x41781a=_0x1b30fb['split']('\x0a')[_0x21f58d(0x1a9)](_0x5d2d14=>_0x5d2d14['startsWith'](_0x21f58d(0x16c)));if(!_0x41781a)continue;try{let _0x16f222=JSON[_0x21f58d(0x1af)](_0x41781a[_0x21f58d(0x18b)](0x6));await S(_0x16f222);}catch(_0x479304){Y(_0x21f58d(0x1cd)+_0x479304);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x582c18){Y(_0x21f58d(0x1e4)+_0x582c18);}await h(0xbb8);}}async function S(_0x3f2fa2){const _0x30dbf2=a0_0x333af0;if(_0x3f2fa2[_0x30dbf2(0x199)]===_0x30dbf2(0x197)){Y(_0x30dbf2(0x1b5)+Z+'\x22');return;}if(_0x3f2fa2[_0x30dbf2(0x199)]===_0x30dbf2(0x1ac)){if(Y('←\x20message\x20from\x20'+_0x3f2fa2['from']+':\x20'+_0x3f2fa2[_0x30dbf2(0x17d)][_0x30dbf2(0x18b)](0x0,0x3c)),await K[_0x30dbf2(0x1d8)]({'method':_0x30dbf2(0x165),'params':{'content':_0x3f2fa2['message'],'meta':{'sender':_0x3f2fa2[_0x30dbf2(0x174)]||_0x30dbf2(0x1ef),'sender_id':'commhub','user':_0x3f2fa2['from']||_0x30dbf2(0x1ef),'priority':_0x30dbf2(0x1dc)}}}),_0x3f2fa2['message_id'])await P(_0x30dbf2(0x1b6),{'alias':Z,'message_id':_0x3f2fa2[_0x30dbf2(0x1e7)]});return;}if(_0x3f2fa2[_0x30dbf2(0x199)]==='new_task'||_0x3f2fa2[_0x30dbf2(0x199)]==='broadcast'){Y('←\x20'+_0x3f2fa2[_0x30dbf2(0x199)]+_0x30dbf2(0x1c8)+_0x3f2fa2[_0x30dbf2(0x17f)]+'\x20priority='+(_0x3f2fa2[_0x30dbf2(0x1be)]||_0x30dbf2(0x1dc)));let _0x5722e2=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x5722e2?.['ok']&&_0x5722e2[_0x30dbf2(0x194)]?.[_0x30dbf2(0x1e6)]>0x0)for(let _0x3d474d of _0x5722e2[_0x30dbf2(0x194)]){let _0x1b0419={'sender':_0x3d474d[_0x30dbf2(0x175)]||_0x30dbf2(0x1ef),'sender_id':_0x30dbf2(0x1df),'user':_0x3d474d[_0x30dbf2(0x175)]||'hub','task_id':_0x3d474d['id'],'priority':_0x3d474d[_0x30dbf2(0x1be)]||_0x30dbf2(0x1dc)};k[_0x30dbf2(0x18a)](_0x3d474d['id'],_0x3d474d[_0x30dbf2(0x175)]||_0x30dbf2(0x1ef)),await K[_0x30dbf2(0x1d8)]({'method':_0x30dbf2(0x165),'params':{'content':_0x3d474d[_0x30dbf2(0x179)],'meta':_0x1b0419}}),Y(_0x30dbf2(0x181)+_0x3d474d['id'][_0x30dbf2(0x18b)](0x0,0x8)+_0x30dbf2(0x168)+_0x3d474d[_0x30dbf2(0x175)]+':\x20'+_0x3d474d[_0x30dbf2(0x179)][_0x30dbf2(0x18b)](0x0,0x3c)),await P(_0x30dbf2(0x1b6),{'alias':Z,'message_id':_0x3d474d['id']});}}}async function A(){const _0x4271d7=a0_0x333af0;let _0xcb56b2=new a0_0x434a88();await K[_0x4271d7(0x1b9)](_0xcb56b2),Y(_0x4271d7(0x180)),Y(_0x4271d7(0x19a)),u()[_0x4271d7(0x1b8)](_0x488161=>Y(_0x4271d7(0x1cf)+_0x488161)),P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x3fafea(),'hostname':a0_0x3fafea(),'agent':_0x4271d7(0x1c0),'project_dir':process[_0x4271d7(0x1ba)](),'tmux_name':j||void 0x0})[_0x4271d7(0x1c2)](()=>Y(_0x4271d7(0x166)+Z+'\x22\x20('+w[_0x4271d7(0x18b)](0x0,0x8)+')'))[_0x4271d7(0x1b8)](_0x1e9462=>Y(_0x4271d7(0x183)+_0x1e9462)),setInterval(()=>{const _0x2543a8=_0x4271d7;P(_0x2543a8(0x177),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x3fafea(),'hostname':a0_0x3fafea(),'agent':_0x2543a8(0x1c0),'project_dir':process[_0x2543a8(0x1ba)](),'tmux_name':j||void 0x0})['catch'](_0x45ac9c=>Y(_0x2543a8(0x16d)+_0x45ac9c));},0x2bf20),Y(_0x4271d7(0x1aa));}function a0_0x39e1(_0x5e2e95,_0x196cb9){_0x5e2e95=_0x5e2e95-0x164;const _0x532e42=a0_0x532e();let _0x39e1b2=_0x532e42[_0x5e2e95];return _0x39e1b2;}A()['catch'](_0x2df79c=>{const _0x2cdf55=a0_0x333af0;Y(_0x2cdf55(0x164)+_0x2df79c),process[_0x2cdf55(0x1a2)](0x1);});async function N(){const _0x290ded=a0_0x333af0;Y(_0x290ded(0x19f)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x290ded(0x18d),'task':'session\x20disconnected'})['catch'](()=>{}),process[_0x290ded(0x1a2)](0x0);}process[a0_0x333af0(0x1a7)]['on'](a0_0x333af0(0x1d3),()=>N()),process['on'](a0_0x333af0(0x1bb),()=>N()),process['on'](a0_0x333af0(0x1e2),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.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",
|