@sleep2agi/agent-network 2.0.3-preview.0 → 2.0.3-preview.10
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 +33 -21
- 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 +3 -3
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a0_0x1910(_0x5af589,_0x3dab1a){_0x5af589=_0x5af589-0x13e;const _0x5c6c76=a0_0x5c6c();let _0x1910a0=_0x5c6c76[_0x5af589];return _0x1910a0;}const a0_0x3498c8=a0_0x1910;function a0_0x5c6c(){const _0xc72e36=['body','new_task','startsWith','678RHIcQX','signal','split','getAllStatus','connected','toTimeString','get_inbox','decode','SSE\x20reconnecting\x20in\x20','pop','AbortError','read','14nYzXGP','parse','running','content','send_task','broadcast','reply','5341479aFoQub','data:\x20','stringify','connect','1695736eEfnvh','Bearer\x20','emit','normal','token','min','url','replace','call','tools/call','837452wKXGHh','117910ZVdrcR','abort','application/json,\x20text/event-stream','status','registered','sdk-','ack_inbox','Authorization','log','getReader','report_status','1346065JuAooB','offline','cwd','messages','90EjFvPm','s...','3fjqwqa','send_message','2.0','7670DWdQwB','disconnected','message','new_message','heartbeatTimer','from_session','alias','13109KcpTqf','resumeId','connectSSE','autoConnect','SSE\x20connected','toString','sdk','processInbox','now','server','reconnectDelay','completed','sseAbort','text','slice','heartbeatInterval','inbox\x20error:\x20','sleep','agent','type','catch','POST','SSE\x20error:\x20'];a0_0x5c6c=function(){return _0xc72e36;};return a0_0x5c6c();}(function(_0xf847da,_0x5b67ce){const _0x1faeef=a0_0x1910,_0x1c90ef=_0xf847da();while(!![]){try{const _0x20c321=parseInt(_0x1faeef(0x171))/0x1*(parseInt(_0x1faeef(0x140))/0x2)+parseInt(_0x1faeef(0x167))/0x3*(parseInt(_0x1faeef(0x155))/0x4)+-parseInt(_0x1faeef(0x16a))/0x5*(-parseInt(_0x1faeef(0x18b))/0x6)+-parseInt(_0x1faeef(0x161))/0x7+parseInt(_0x1faeef(0x14b))/0x8+parseInt(_0x1faeef(0x165))/0x9*(parseInt(_0x1faeef(0x156))/0xa)+-parseInt(_0x1faeef(0x147))/0xb;if(_0x20c321===_0x5b67ce)break;else _0x1c90ef['push'](_0x1c90ef['shift']());}catch(_0x40eb7c){_0x1c90ef['push'](_0x1c90ef['shift']());}}}(a0_0x5c6c,0x1edfd));import{EventEmitter as a0_0x4de213}from'events';import{hostname as a0_0x48e395}from'os';class T extends a0_0x4de213{[a0_0x3498c8(0x151)];['alias'];['token'];[a0_0x3498c8(0x183)];[a0_0x3498c8(0x172)];['heartbeatInterval'];[a0_0x3498c8(0x17b)];[a0_0x3498c8(0x16e)];[a0_0x3498c8(0x17d)];[a0_0x3498c8(0x142)]=!0x1;constructor(_0x1788a1){const _0x1b19ea=a0_0x3498c8;super();if(this['url']=_0x1788a1[_0x1b19ea(0x151)][_0x1b19ea(0x152)](/\/$/,''),this['alias']=_0x1788a1[_0x1b19ea(0x170)],this[_0x1b19ea(0x14f)]=_0x1788a1[_0x1b19ea(0x14f)],this[_0x1b19ea(0x183)]=_0x1788a1[_0x1b19ea(0x183)]||_0x1b19ea(0x177),this['resumeId']=_0x1b19ea(0x15b)+_0x1788a1[_0x1b19ea(0x170)]+'-'+Date[_0x1b19ea(0x179)]()[_0x1b19ea(0x176)](0x24),this['heartbeatInterval']=_0x1788a1[_0x1b19ea(0x180)]??0x2bf20,this['reconnectDelay']=_0x1788a1[_0x1b19ea(0x17b)]??0xbb8,_0x1788a1[_0x1b19ea(0x174)]!==!0x1)this[_0x1b19ea(0x14a)]();}['log'](_0x1daa06){const _0x1f1349=a0_0x3498c8;console[_0x1f1349(0x15e)]('['+new Date()[_0x1f1349(0x190)]()[_0x1f1349(0x17f)](0x0,0x8)+']\x20[commhub:'+this[_0x1f1349(0x170)]+']\x20'+_0x1daa06);}async[a0_0x3498c8(0x153)](_0xfd8a4d,_0x4581b1){const _0x4280c9=a0_0x3498c8;let _0x5846e5={'Content-Type':'application/json','Accept':_0x4280c9(0x158)};if(this[_0x4280c9(0x14f)])_0x5846e5['Authorization']=_0x4280c9(0x14c)+this[_0x4280c9(0x14f)];let _0x2113f9=await(await fetch(this[_0x4280c9(0x151)]+'/mcp',{'method':_0x4280c9(0x186),'headers':_0x5846e5,'body':JSON[_0x4280c9(0x149)]({'jsonrpc':_0x4280c9(0x169),'id':Date['now'](),'method':_0x4280c9(0x154),'params':{'name':_0xfd8a4d,'arguments':_0x4581b1}})}))[_0x4280c9(0x17e)](),_0x22afa2=_0x2113f9['match'](/data: (.+)/),_0x3a6bd0=_0x22afa2?JSON[_0x4280c9(0x141)](_0x22afa2[0x1]):JSON[_0x4280c9(0x141)](_0x2113f9),_0x185a88=_0x3a6bd0?.['result']?.[_0x4280c9(0x143)]?.[0x0]?.['text'];return _0x185a88?JSON[_0x4280c9(0x141)](_0x185a88):_0x3a6bd0;}async[a0_0x3498c8(0x14a)](){const _0x1c5513=a0_0x3498c8;if(this[_0x1c5513(0x142)])return;this[_0x1c5513(0x142)]=!0x0,await this[_0x1c5513(0x159)]('idle'),this[_0x1c5513(0x15e)](_0x1c5513(0x15a)),this['heartbeatTimer']=setInterval(()=>{const _0x501876=_0x1c5513;this[_0x501876(0x159)]('idle')[_0x501876(0x185)](_0x431bcd=>this[_0x501876(0x15e)]('heartbeat\x20failed:\x20'+_0x431bcd[_0x501876(0x16c)]));},this['heartbeatInterval']),this[_0x1c5513(0x173)]();}async['disconnect'](){const _0x3afead=a0_0x3498c8;if(this['running']=!0x1,this[_0x3afead(0x17d)]?.[_0x3afead(0x157)](),this[_0x3afead(0x16e)])clearInterval(this['heartbeatTimer']);await this[_0x3afead(0x159)](_0x3afead(0x162))['catch'](()=>{}),this[_0x3afead(0x15e)](_0x3afead(0x16b));}async['send'](_0x5f6672,_0x38cdbb,_0x1ed272=a0_0x3498c8(0x14e)){const _0x5b3342=a0_0x3498c8;return this[_0x5b3342(0x153)](_0x5b3342(0x144),{'alias':_0x5f6672,'task':_0x38cdbb,'priority':_0x1ed272,'from_session':this[_0x5b3342(0x170)]});}async[a0_0x3498c8(0x16c)](_0xeb9b32,_0x46ee06){const _0x3019bd=a0_0x3498c8;return this['call'](_0x3019bd(0x168),{'alias':_0xeb9b32,'message':_0x46ee06,'from_session':this[_0x3019bd(0x170)]});}async[a0_0x3498c8(0x146)](_0x1a8040,_0x104722,_0x280249=a0_0x3498c8(0x17c)){const _0x56d03c=a0_0x3498c8;return this[_0x56d03c(0x153)](_0x56d03c(0x146),{'task_id':_0x1a8040,'text':_0x104722,'status':_0x280249});}async[a0_0x3498c8(0x159)](_0x1d4c20,_0x8e3493){const _0x202c1b=a0_0x3498c8;return this[_0x202c1b(0x153)](_0x202c1b(0x160),{'resume_id':this[_0x202c1b(0x172)],'alias':this[_0x202c1b(0x170)],'status':_0x1d4c20,'server':a0_0x48e395(),'hostname':a0_0x48e395(),'agent':this[_0x202c1b(0x183)],'project_dir':process[_0x202c1b(0x163)](),..._0x8e3493});}async[a0_0x3498c8(0x18e)](){const _0x392888=a0_0x3498c8;return this[_0x392888(0x153)]('get_all_status',{});}async['broadcast'](_0x17820f,_0x1fabfa){const _0x2de702=a0_0x3498c8;return this['call'](_0x2de702(0x145),{'message':_0x17820f,'filter_server':_0x1fabfa?.[_0x2de702(0x17a)],'filter_status':_0x1fabfa?.[_0x2de702(0x159)]});}async[a0_0x3498c8(0x173)](){const _0x4a5728=a0_0x3498c8;let _0x4421d0=encodeURIComponent(this[_0x4a5728(0x170)]),_0x96f16b=this['url']+'/events/'+_0x4421d0,_0x17c204=this[_0x4a5728(0x17b)];while(this[_0x4a5728(0x142)]){try{this[_0x4a5728(0x17d)]=new AbortController();let _0x43199e={'Accept':'text/event-stream'};if(this[_0x4a5728(0x14f)])_0x43199e[_0x4a5728(0x15d)]=_0x4a5728(0x14c)+this['token'];let _0x55fcdb=await fetch(_0x96f16b,{'headers':_0x43199e,'signal':this['sseAbort'][_0x4a5728(0x18c)]});if(!_0x55fcdb['ok']||!_0x55fcdb[_0x4a5728(0x188)]){this['log']('SSE\x20failed:\x20'+_0x55fcdb[_0x4a5728(0x159)]),await this['sleep'](_0x17c204),_0x17c204=Math[_0x4a5728(0x150)](_0x17c204*1.5,0xea60);continue;}_0x17c204=this[_0x4a5728(0x17b)];let _0x1de36c=_0x55fcdb[_0x4a5728(0x188)][_0x4a5728(0x15f)](),_0x2c27fe=new TextDecoder(),_0xf7903e='';while(this[_0x4a5728(0x142)]){let {done:_0x57537f,value:_0x136be8}=await _0x1de36c[_0x4a5728(0x13f)]();if(_0x57537f)break;_0xf7903e+=_0x2c27fe[_0x4a5728(0x192)](_0x136be8,{'stream':!0x0});let _0x272831=_0xf7903e[_0x4a5728(0x18d)]('\x0a');_0xf7903e=_0x272831[_0x4a5728(0x194)]()||'';for(let _0x57de0b of _0x272831){if(!_0x57de0b[_0x4a5728(0x18a)](_0x4a5728(0x148)))continue;try{let _0xd91029=JSON[_0x4a5728(0x141)](_0x57de0b[_0x4a5728(0x17f)](0x6));if(_0xd91029[_0x4a5728(0x184)]==='connected'){this[_0x4a5728(0x15e)](_0x4a5728(0x175)),this[_0x4a5728(0x14d)](_0x4a5728(0x18f));continue;}if(_0xd91029[_0x4a5728(0x184)]===_0x4a5728(0x189)||_0xd91029[_0x4a5728(0x184)]===_0x4a5728(0x16d)||_0xd91029[_0x4a5728(0x184)]==='broadcast')await this[_0x4a5728(0x178)]();}catch{}}}}catch(_0x17227c){if(_0x17227c['name']===_0x4a5728(0x13e))break;this[_0x4a5728(0x14d)]('error',_0x17227c),this[_0x4a5728(0x15e)](_0x4a5728(0x187)+_0x17227c[_0x4a5728(0x16c)]);}if(this['running'])this[_0x4a5728(0x14d)](_0x4a5728(0x16b)),this[_0x4a5728(0x15e)](_0x4a5728(0x193)+_0x17c204/0x3e8+_0x4a5728(0x166)),await this['sleep'](_0x17c204),_0x17c204=Math[_0x4a5728(0x150)](_0x17c204*1.5,0xea60);}}async['processInbox'](){const _0x3780cc=a0_0x3498c8;try{let _0x2185bb=(await this['call'](_0x3780cc(0x191),{'alias':this[_0x3780cc(0x170)],'limit':0xa}))?.[_0x3780cc(0x164)]||[];for(let _0x107e53 of _0x2185bb)await this[_0x3780cc(0x153)](_0x3780cc(0x15c),{'alias':this[_0x3780cc(0x170)],'message_id':_0x107e53['id']}),this[_0x3780cc(0x15e)]('←\x20'+_0x107e53[_0x3780cc(0x16f)]+':\x20'+_0x107e53['content'][_0x3780cc(0x17f)](0x0,0x3c)),this[_0x3780cc(0x14d)]('task',_0x107e53),this[_0x3780cc(0x14d)]('message',_0x107e53);}catch(_0x84784c){this[_0x3780cc(0x15e)](_0x3780cc(0x181)+_0x84784c[_0x3780cc(0x16c)]);}}[a0_0x3498c8(0x182)](_0x3d38c5){return new Promise(_0x8b1e10=>setTimeout(_0x8b1e10,_0x3d38c5));}}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_0x51d63f=a0_0x1553;(function(_0x246343,_0xf37cd0){const _0x43ee9d=a0_0x1553,_0xdd07d=_0x246343();while(!![]){try{const _0xa4a345=parseInt(_0x43ee9d(0x1d5))/0x1+-parseInt(_0x43ee9d(0x177))/0x2*(-parseInt(_0x43ee9d(0x1a5))/0x3)+parseInt(_0x43ee9d(0x173))/0x4*(parseInt(_0x43ee9d(0x18c))/0x5)+parseInt(_0x43ee9d(0x17a))/0x6+-parseInt(_0x43ee9d(0x184))/0x7*(parseInt(_0x43ee9d(0x1da))/0x8)+-parseInt(_0x43ee9d(0x1ec))/0x9*(-parseInt(_0x43ee9d(0x1ae))/0xa)+-parseInt(_0x43ee9d(0x1c9))/0xb*(parseInt(_0x43ee9d(0x1bb))/0xc);if(_0xa4a345===_0xf37cd0)break;else _0xdd07d['push'](_0xdd07d['shift']());}catch(_0x3bf01d){_0xdd07d['push'](_0xdd07d['shift']());}}}(a0_0x892a,0x3641b));import{readFileSync as a0_0x189bc7,existsSync as a0_0x339850}from'fs';import{randomUUID as a0_0x5bd3a9}from'crypto';function a0_0x1553(_0x2f7437,_0x2e552e){_0x2f7437=_0x2f7437-0x15c;const _0x892a83=a0_0x892a();let _0x1553aa=_0x892a83[_0x2f7437];return _0x1553aa;}import{join as a0_0x50650a}from'path';import{hostname as a0_0x29d6ec}from'os';function a0_0x892a(){const _0x63b7ae=['heartbeat\x20failed:\x20','9594hhxWCm','statusText','setRequestHandler',':\x20inbox_count=','broadcast','MCP\x20stdio\x20connected','message','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','connected','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','slice','exit','ack_inbox','\x20CWD=','messages','write','claude-code','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','\x22\x20(','set','body','string','unknown\x20tool','new_task','488564XyZHLn',']\x20[commhub]\x20','content','status','691830xlDLIJ','toTimeString','http://127.0.0.1:9200','42246uQCJKo','parse\x20error:\x20','initialize','Message\x20content','low','commhub_report_status','inbox_count','/mcp','init\x20failed:\x20','type','147546VOVRIf','from','SIGINT','SSE\x20connected\x20as\x20\x22','Session\x20alias:\x20','.env','normal','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','10OKSJBN','Reply\x20text\x20/\x20result\x20summary','read','commhub_get_all_status','hub','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','length','SIGTERM','decode','catch','from_session','→\x20injected\x20task\x20','end','...\x20TMUX=','\x20from\x20','alias','Authorization','get','in_progress','split','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','POST','cwd','result','delete','3ewLifF','params','trim','shutting\x20down,\x20reporting\x20offline...','text','no\x20response','send_task','replace','token','50VPEgIH','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','startsWith','error','commhub_send_task','join','\x20priority=','high','utf-8','stdin','\x20PROJECT_ENV=','fatal:\x20','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','12IjMhmT','ENV:\x20URL=','Task\x20content','stringify','.anet','2025-03-26','task','commhub_reply','.claude/channels/commhub','\x20ALIAS=','application/json,\x20text/event-stream','blocked','parse','working','2519781dTgbvd','message_id','report_status','2.0','idle','0.3.0','notification','priority','session\x20disconnected','application/json','object','SSE\x20connection\x20error:\x20','80596GigsSt','commhub-channel','completed','commhub','Target\x20session\x20alias','88gBYhor','failed','CommHub\x20init\x20failed:\x20','warning:\x20could\x20not\x20register:\x20','none','Bearer\x20','commhub_send_message','find','/events/','ready\x20—\x20waiting\x20for\x20events','registered\x20as\x20\x22','notifications/claude/channel','data:\x20','Current\x20task\x20description','cancelled','←\x20message\x20from\x20','tools/call'];a0_0x892a=function(){return _0x63b7ae;};return a0_0x892a();}import{execSync as a0_0x91fe92}from'child_process';import{Server as a0_0x3392c5}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0xef4093}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x1dbfd2,CallToolRequestSchema as a0_0x79331d}from'@modelcontextprotocol/sdk/types.js';function p(_0x26271e){const _0x2daa02=a0_0x1553;if(!a0_0x339850(_0x26271e))return;for(let _0x1a770f of a0_0x189bc7(_0x26271e,_0x2daa02(0x1b6))[_0x2daa02(0x19f)]('\x0a')){let _0x5a047b=_0x1a770f[_0x2daa02(0x1a7)]();if(!_0x5a047b||_0x5a047b[_0x2daa02(0x1b0)]('#'))continue;let _0x3602cb=_0x5a047b['indexOf']('=');if(_0x3602cb<0x0)continue;let _0x3e3480=_0x5a047b[_0x2daa02(0x165)](0x0,_0x3602cb)[_0x2daa02(0x1a7)](),_0x1ba47f=_0x5a047b[_0x2daa02(0x165)](_0x3602cb+0x1)[_0x2daa02(0x1a7)]()[_0x2daa02(0x1ac)](/^["']|["']$/g,'');if(!process.env[_0x3e3480])process.env[_0x3e3480]=_0x1ba47f;}}var C=process.env.HOME||'~',T=a0_0x50650a(C,a0_0x51d63f(0x1c3));p(a0_0x50650a(T,'.env'));var L=process[a0_0x51d63f(0x1a2)]()['replace'](/\//g,'-');p(a0_0x50650a(T,L,a0_0x51d63f(0x189)));function U(){const _0x41fb69=a0_0x51d63f;try{return a0_0x91fe92('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x41fb69(0x1b6),'timeout':0x7d0})[_0x41fb69(0x1a7)]();}catch{return'';}}function v(){const _0x4a376d=a0_0x51d63f;try{let _0x9fb395=a0_0x50650a(C,_0x4a376d(0x1bf),'config.json');if(a0_0x339850(_0x9fb395))return JSON[_0x4a376d(0x1c7)](a0_0x189bc7(_0x9fb395,_0x4a376d(0x1b6)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x51d63f(0x190)]||a0_0x51d63f(0x179),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x29d6ec(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x5bd3a9(),X=process.env.COMMHUB_TOKEN||H[a0_0x51d63f(0x1ad)]||'';function Y(_0x2c9c3a){const _0x351a87=a0_0x51d63f;let _0x39deae=new Date()[_0x351a87(0x178)]()['slice'](0x0,0x8);process['stderr'][_0x351a87(0x16a)]('['+_0x39deae+_0x351a87(0x174)+_0x2c9c3a+'\x0a');}function h(_0x1cd24e){return new Promise(_0x21528b=>setTimeout(_0x21528b,_0x1cd24e));}Y(a0_0x51d63f(0x1bc)+f+a0_0x51d63f(0x1c4)+Z+'\x20RESUME_ID='+w[a0_0x51d63f(0x165)](0x0,0x8)+a0_0x51d63f(0x199)+(j||a0_0x51d63f(0x1de))+a0_0x51d63f(0x168)+process[a0_0x51d63f(0x1a2)]()+a0_0x51d63f(0x1b8)+L);var k=new Map(),K=new a0_0x3392c5({'name':a0_0x51d63f(0x1d6),'version':a0_0x51d63f(0x1ce)},{'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_0x51d63f(0x1af),a0_0x51d63f(0x16c),a0_0x51d63f(0x1a0),a0_0x51d63f(0x188)+Z][a0_0x51d63f(0x1b3)]('\x0a')});K['setRequestHandler'](a0_0x1dbfd2,async()=>({'tools':[{'name':a0_0x51d63f(0x1c2),'description':a0_0x51d63f(0x162),'inputSchema':{'type':a0_0x51d63f(0x1d3),'properties':{'task_id':{'type':'string','description':a0_0x51d63f(0x191)},'text':{'type':a0_0x51d63f(0x170),'description':a0_0x51d63f(0x18d)},'status':{'type':a0_0x51d63f(0x170),'enum':[a0_0x51d63f(0x1d7),a0_0x51d63f(0x1db),'cancelled','blocked','error',a0_0x51d63f(0x19e)],'description':a0_0x51d63f(0x18b)}},'required':['text']}},{'name':'commhub_report_status','description':a0_0x51d63f(0x164),'inputSchema':{'type':a0_0x51d63f(0x1d3),'properties':{'status':{'type':a0_0x51d63f(0x170),'enum':[a0_0x51d63f(0x1c8),a0_0x51d63f(0x1cd),a0_0x51d63f(0x1c6),'error']},'task':{'type':a0_0x51d63f(0x170),'description':a0_0x51d63f(0x1e7)},'progress':{'type':'number','description':'Progress\x200-100'}},'required':[a0_0x51d63f(0x176)]}},{'name':a0_0x51d63f(0x1b2),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x51d63f(0x1d3),'properties':{'alias':{'type':a0_0x51d63f(0x170),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x51d63f(0x170),'description':a0_0x51d63f(0x1bd)},'priority':{'type':a0_0x51d63f(0x170),'enum':[a0_0x51d63f(0x1b5),a0_0x51d63f(0x18a),a0_0x51d63f(0x17e)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x51d63f(0x19b),a0_0x51d63f(0x1c1)]}},{'name':a0_0x51d63f(0x1e0),'description':a0_0x51d63f(0x1ba),'inputSchema':{'type':a0_0x51d63f(0x1d3),'properties':{'alias':{'type':'string','description':a0_0x51d63f(0x1d9)},'message':{'type':a0_0x51d63f(0x170),'description':a0_0x51d63f(0x17d)}},'required':['alias','message']}},{'name':a0_0x51d63f(0x18f),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x51d63f(0x1d3),'properties':{}}}]}));async function P(_0x4ded7a,_0x15263b){const _0x9c1116=a0_0x51d63f;let _0x125299=await fetch(f+'/mcp',{'method':_0x9c1116(0x1a1),'headers':{'Content-Type':_0x9c1116(0x1d2),'Accept':_0x9c1116(0x1c5),...X?{'Authorization':_0x9c1116(0x1df)+X}:{}},'body':JSON[_0x9c1116(0x1be)]({'jsonrpc':_0x9c1116(0x1cc),'id':0x1,'method':_0x9c1116(0x17c),'params':{'protocolVersion':_0x9c1116(0x1c0),'capabilities':{},'clientInfo':{'name':_0x9c1116(0x1d6),'version':_0x9c1116(0x1ce)}}})});if(!_0x125299['ok']){let _0x3bcf8c=await _0x125299[_0x9c1116(0x1a9)]();return Y(_0x9c1116(0x1dc)+_0x125299[_0x9c1116(0x176)]+'\x20'+_0x3bcf8c[_0x9c1116(0x165)](0x0,0x64)),{'ok':!0x1,'error':_0x9c1116(0x182)+_0x125299['status']};}await _0x125299[_0x9c1116(0x1a9)]();let _0xd24996=(await(await fetch(f+_0x9c1116(0x181),{'method':_0x9c1116(0x1a1),'headers':{'Content-Type':_0x9c1116(0x1d2),'Accept':_0x9c1116(0x1c5),...X?{'Authorization':_0x9c1116(0x1df)+X}:{}},'body':JSON[_0x9c1116(0x1be)]({'jsonrpc':'2.0','id':0x2,'method':_0x9c1116(0x1ea),'params':{'name':_0x4ded7a,'arguments':_0x15263b}})}))[_0x9c1116(0x1a9)]())[_0x9c1116(0x19f)]('\x0a')[_0x9c1116(0x1e1)](_0xefcaa6=>_0xefcaa6['startsWith']('data:\x20'));if(_0xd24996){let _0x3e967f=JSON[_0x9c1116(0x1c7)](_0xd24996['slice'](0x6));return _0x3e967f?.[_0x9c1116(0x1a3)]?.[_0x9c1116(0x175)]?.[0x0]?.['text']?JSON[_0x9c1116(0x1c7)](_0x3e967f[_0x9c1116(0x1a3)]['content'][0x0][_0x9c1116(0x1a9)]):_0x3e967f;}return{'ok':!0x1,'error':_0x9c1116(0x1aa)};}K[a0_0x51d63f(0x15d)](a0_0x79331d,async _0x14d2c1=>{const _0x487a88=a0_0x51d63f;let {name:_0x293598,arguments:_0x7570e9}=_0x14d2c1[_0x487a88(0x1a6)];if(_0x293598===_0x487a88(0x1c2)){let {task_id:_0x33247f,text:_0x3601a7,status:_0x2e2ef2}=_0x7570e9;if(_0x2e2ef2===_0x487a88(0x1d7)||_0x2e2ef2==='failed'||_0x2e2ef2===_0x487a88(0x1e8)){let _0x1c4f42=_0x2e2ef2==='completed'?'replied':_0x2e2ef2,_0x138fc3=_0x33247f?k[_0x487a88(0x19d)](_0x33247f)||_0x487a88(0x190):_0x487a88(0x190),_0x1008cb=await P('send_reply',{'alias':_0x138fc3,'text':_0x3601a7,'in_reply_to':_0x33247f||void 0x0,'status':_0x1c4f42,'from_session':Z});if(_0x33247f)k[_0x487a88(0x1a4)](_0x33247f);return{'content':[{'type':_0x487a88(0x1a9),'text':JSON[_0x487a88(0x1be)](_0x1008cb)}]};}let _0x4fc7ec=await P(_0x487a88(0x1cb),{'resume_id':w,'alias':Z,'status':_0x2e2ef2===_0x487a88(0x1c6)?'blocked':_0x2e2ef2==='error'?_0x487a88(0x1b1):_0x487a88(0x1c8),'task':_0x3601a7['slice'](0x0,0xc8),'output':_0x3601a7});return{'content':[{'type':_0x487a88(0x1a9),'text':JSON['stringify'](_0x4fc7ec)}]};}if(_0x293598===_0x487a88(0x17f)){let {status:_0x356971,task:_0x3bef7a,progress:_0x988567}=_0x7570e9,_0x21daac=await P(_0x487a88(0x1cb),{'resume_id':w,'alias':Z,'status':_0x356971,'task':_0x3bef7a,'progress':_0x988567});return{'content':[{'type':_0x487a88(0x1a9),'text':JSON[_0x487a88(0x1be)](_0x21daac)}]};}if(_0x293598==='commhub_send_task'){let {alias:_0x58ffe7,task:_0x380ae8,priority:_0x47ff69}=_0x7570e9,_0x3d1492=await P(_0x487a88(0x1ab),{'alias':_0x58ffe7,'task':_0x380ae8,'priority':_0x47ff69||_0x487a88(0x18a),'from_session':Z});return{'content':[{'type':_0x487a88(0x1a9),'text':JSON['stringify'](_0x3d1492)}]};}if(_0x293598===_0x487a88(0x1e0)){let {alias:_0x5334e3,message:_0x540662}=_0x7570e9,_0x3c733c=await P('send_message',{'alias':_0x5334e3,'message':_0x540662,'from_session':Z});return{'content':[{'type':_0x487a88(0x1a9),'text':JSON[_0x487a88(0x1be)](_0x3c733c)}]};}if(_0x293598==='commhub_get_all_status'){let _0x177c90=await P('get_all_status',{});return{'content':[{'type':_0x487a88(0x1a9),'text':JSON['stringify'](_0x177c90)}]};}return{'content':[{'type':_0x487a88(0x1a9),'text':JSON[_0x487a88(0x1be)]({'error':_0x487a88(0x171)})}]};});async function u(){const _0x3ee9fc=a0_0x51d63f;let _0x109fab=f+_0x3ee9fc(0x1e2)+encodeURIComponent(Z),_0x5236f0={};if(X)_0x5236f0[_0x3ee9fc(0x19c)]=_0x3ee9fc(0x1df)+X;Y('connecting\x20to\x20'+_0x109fab);while(!0x0){try{let _0x8e24b5=await fetch(_0x109fab,{'headers':_0x5236f0});if(!_0x8e24b5['ok']){Y('SSE\x20error:\x20'+_0x8e24b5['status']+'\x20'+_0x8e24b5[_0x3ee9fc(0x15c)]),await h(0x1388);continue;}let _0x4c720f=_0x8e24b5[_0x3ee9fc(0x16f)]['getReader'](),_0x1e7099=new TextDecoder(),_0x240b40='';while(!0x0){let {done:_0x119cc4,value:_0x11c7cf}=await _0x4c720f[_0x3ee9fc(0x18e)]();if(_0x119cc4)break;_0x240b40+=_0x1e7099[_0x3ee9fc(0x194)](_0x11c7cf,{'stream':!0x0});let _0x2b324f=_0x240b40[_0x3ee9fc(0x19f)]('\x0a\x0a');_0x240b40=_0x2b324f['pop']()||'';for(let _0x229957 of _0x2b324f){let _0x8ed258=_0x229957['split']('\x0a')[_0x3ee9fc(0x1e1)](_0xc2f680=>_0xc2f680[_0x3ee9fc(0x1b0)](_0x3ee9fc(0x1e6)));if(!_0x8ed258)continue;try{let _0x5f4cd0=JSON[_0x3ee9fc(0x1c7)](_0x8ed258[_0x3ee9fc(0x165)](0x6));await S(_0x5f4cd0);}catch(_0x58f1e5){Y(_0x3ee9fc(0x17b)+_0x58f1e5);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x67a721){Y(_0x3ee9fc(0x1d4)+_0x67a721);}await h(0xbb8);}}async function S(_0x2ff1a8){const _0x8aedc6=a0_0x51d63f;if(_0x2ff1a8[_0x8aedc6(0x183)]===_0x8aedc6(0x163)){Y(_0x8aedc6(0x187)+Z+'\x22');return;}if(_0x2ff1a8[_0x8aedc6(0x183)]==='new_message'){if(Y(_0x8aedc6(0x1e9)+_0x2ff1a8[_0x8aedc6(0x185)]+':\x20'+_0x2ff1a8[_0x8aedc6(0x161)][_0x8aedc6(0x165)](0x0,0x3c)),await K[_0x8aedc6(0x1cf)]({'method':'notifications/claude/channel','params':{'content':_0x2ff1a8[_0x8aedc6(0x161)],'meta':{'sender':_0x2ff1a8[_0x8aedc6(0x185)]||_0x8aedc6(0x190),'sender_id':_0x8aedc6(0x1d8),'user':_0x2ff1a8[_0x8aedc6(0x185)]||_0x8aedc6(0x190),'priority':_0x8aedc6(0x18a)}}}),_0x2ff1a8[_0x8aedc6(0x1ca)])await P(_0x8aedc6(0x167),{'alias':Z,'message_id':_0x2ff1a8[_0x8aedc6(0x1ca)]});return;}if(_0x2ff1a8[_0x8aedc6(0x183)]===_0x8aedc6(0x172)||_0x2ff1a8[_0x8aedc6(0x183)]===_0x8aedc6(0x15f)){Y('←\x20'+_0x2ff1a8['type']+_0x8aedc6(0x15e)+_0x2ff1a8[_0x8aedc6(0x180)]+_0x8aedc6(0x1b4)+(_0x2ff1a8[_0x8aedc6(0x1d0)]||_0x8aedc6(0x18a)));let _0x4ee615=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x4ee615?.['ok']&&_0x4ee615[_0x8aedc6(0x169)]?.[_0x8aedc6(0x192)]>0x0)for(let _0x188044 of _0x4ee615['messages']){let _0x2a1c1c={'sender':_0x188044[_0x8aedc6(0x196)]||_0x8aedc6(0x190),'sender_id':'commhub','user':_0x188044[_0x8aedc6(0x196)]||'hub','task_id':_0x188044['id'],'priority':_0x188044[_0x8aedc6(0x1d0)]||'normal'};k[_0x8aedc6(0x16e)](_0x188044['id'],_0x188044[_0x8aedc6(0x196)]||_0x8aedc6(0x190)),await K['notification']({'method':_0x8aedc6(0x1e5),'params':{'content':_0x188044['content'],'meta':_0x2a1c1c}}),Y(_0x8aedc6(0x197)+_0x188044['id']['slice'](0x0,0x8)+_0x8aedc6(0x19a)+_0x188044['from_session']+':\x20'+_0x188044[_0x8aedc6(0x175)][_0x8aedc6(0x165)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x188044['id']});}}}async function A(){const _0x5940b6=a0_0x51d63f;let _0x44525f=new a0_0xef4093();await K['connect'](_0x44525f),Y(_0x5940b6(0x160)),Y('starting\x20SSE\x20listener...'),u()[_0x5940b6(0x195)](_0x5abf77=>Y('SSE\x20fatal:\x20'+_0x5abf77)),P(_0x5940b6(0x1cb),{'resume_id':w,'alias':Z,'status':_0x5940b6(0x1cd),'server':a0_0x29d6ec(),'hostname':a0_0x29d6ec(),'agent':_0x5940b6(0x16b),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})['then'](()=>Y(_0x5940b6(0x1e4)+Z+_0x5940b6(0x16d)+w[_0x5940b6(0x165)](0x0,0x8)+')'))['catch'](_0x1f94af=>Y(_0x5940b6(0x1dd)+_0x1f94af)),setInterval(()=>{const _0x55fa6a=_0x5940b6;P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x29d6ec(),'hostname':a0_0x29d6ec(),'agent':_0x55fa6a(0x16b),'project_dir':process[_0x55fa6a(0x1a2)](),'tmux_name':j||void 0x0})['catch'](_0x46a733=>Y(_0x55fa6a(0x1eb)+_0x46a733));},0x2bf20),Y(_0x5940b6(0x1e3));}A()[a0_0x51d63f(0x195)](_0x1588ab=>{const _0x58c150=a0_0x51d63f;Y(_0x58c150(0x1b9)+_0x1588ab),process[_0x58c150(0x166)](0x1);});async function N(){const _0x4da88b=a0_0x51d63f;Y(_0x4da88b(0x1a8)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x4da88b(0x1b1),'task':_0x4da88b(0x1d1)})[_0x4da88b(0x195)](()=>{}),process[_0x4da88b(0x166)](0x0);}process[a0_0x51d63f(0x1b7)]['on'](a0_0x51d63f(0x198),()=>N()),process['on'](a0_0x51d63f(0x193),()=>N()),process['on'](a0_0x51d63f(0x186),()=>N());
|
|
2
|
+
const a0_0x34c1d6=a0_0x33c5;(function(_0x2a1ec0,_0x578bc2){const _0x494b18=a0_0x33c5,_0x2e27de=_0x2a1ec0();while(!![]){try{const _0x48be10=-parseInt(_0x494b18(0x139))/0x1+-parseInt(_0x494b18(0x14c))/0x2*(parseInt(_0x494b18(0x12e))/0x3)+-parseInt(_0x494b18(0x135))/0x4*(parseInt(_0x494b18(0x16e))/0x5)+parseInt(_0x494b18(0x176))/0x6+parseInt(_0x494b18(0x155))/0x7*(parseInt(_0x494b18(0x15b))/0x8)+parseInt(_0x494b18(0x157))/0x9*(-parseInt(_0x494b18(0x108))/0xa)+parseInt(_0x494b18(0x13b))/0xb;if(_0x48be10===_0x578bc2)break;else _0x2e27de['push'](_0x2e27de['shift']());}catch(_0x3c2fac){_0x2e27de['push'](_0x2e27de['shift']());}}}(a0_0x4563,0x30a98));import{readFileSync as a0_0x1fe2cb,existsSync as a0_0x2657d6}from'fs';function a0_0x33c5(_0x517bc2,_0x146d90){_0x517bc2=_0x517bc2-0xfc;const _0x456371=a0_0x4563();let _0x33c54b=_0x456371[_0x517bc2];return _0x33c54b;}import{randomUUID as a0_0x2c51a8}from'crypto';import{join as a0_0x480f90}from'path';import{hostname as a0_0x1c689e}from'os';import{execSync as a0_0x479b08}from'child_process';import{Server as a0_0x45577c}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x44ae00}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x49838,CallToolRequestSchema as a0_0xda8193}from'@modelcontextprotocol/sdk/types.js';function p(_0x285795){const _0xa3d19b=a0_0x33c5;if(!a0_0x2657d6(_0x285795))return;for(let _0x37b6a9 of a0_0x1fe2cb(_0x285795,'utf-8')[_0xa3d19b(0x16c)]('\x0a')){let _0x35e66d=_0x37b6a9[_0xa3d19b(0x17e)]();if(!_0x35e66d||_0x35e66d['startsWith']('#'))continue;let _0x1ef50a=_0x35e66d['indexOf']('=');if(_0x1ef50a<0x0)continue;let _0x507a6f=_0x35e66d[_0xa3d19b(0x187)](0x0,_0x1ef50a)[_0xa3d19b(0x17e)](),_0x24e7c3=_0x35e66d['slice'](_0x1ef50a+0x1)[_0xa3d19b(0x17e)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x507a6f])process.env[_0x507a6f]=_0x24e7c3;}}var C=process.env.HOME||'~',T=a0_0x480f90(C,a0_0x34c1d6(0x11c));p(a0_0x480f90(T,'.env'));var L=process[a0_0x34c1d6(0x148)]()[a0_0x34c1d6(0x151)](/\//g,'-');p(a0_0x480f90(T,L,a0_0x34c1d6(0x133)));function U(){const _0x392b1a=a0_0x34c1d6;try{return a0_0x479b08('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':'utf-8','timeout':0x7d0})[_0x392b1a(0x17e)]();}catch{return'';}}function a0_0x4563(){const _0x2085a6=['new_task','broadcast','trim','fatal:\x20','SSE\x20connection\x20error:\x20','\x20PROJECT_ENV=','.anet','...\x20TMUX=','read','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','starting\x20SSE\x20listener...','slice','status','Target\x20session\x20alias','Session\x20alias:\x20','connecting\x20to\x20','send_task','report_status','join','none','ENV:\x20URL=','notification','get_inbox','\x20ALIAS=','/events/','35790QDmrif','commhub-channel','http://127.0.0.1:9200','claude-code','priority','init\x20failed:\x20','Authorization','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','Bearer\x20','application/json','from_session','content','completed','application/json,\x20text/event-stream','unknown\x20tool','parse','0.3.0','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','working','cancelled','.claude/channels/commhub','inbox_count','2025-03-26','\x20from\x20','ready\x20—\x20waiting\x20for\x20events','delete','POST','/mcp','hub','stringify','CommHub\x20init\x20failed:\x20','Priority\x20(default:\x20normal)','task','string','commhub','no\x20response','write','SSE\x20error:\x20','259431JbqPoR','SSE\x20stream\x20ended,\x20reconnecting...','config.json','MCP\x20stdio\x20connected','find','.env','get','68AzzyxX','idle','ack_inbox','→\x20injected\x20task\x20','90124ErhYlz','blocked','6393761TnWqdn','statusText','data:\x20','object','text','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','commhub_send_task','send_message','alias','connected','startsWith','stderr','stdin','cwd','heartbeat\x20failed:\x20','\x20RESUME_ID=','getReader','4TrzDSS','messages','exit','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','tools/call','replace','catch','commhub_report_status','\x20priority=','6062GvmVzK','message','765aTCMwW','SIGINT','parse\x20error:\x20','token','1992TCwxQY','normal','get_all_status','Progress\x200-100','set','result','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','notifications/claude/channel','commhub_reply','Current\x20task\x20description','shutting\x20down,\x20reporting\x20offline...','params','decode','SSE\x20connected\x20as\x20\x22','in_progress','low','message_id','split','failed','114715eTwMuc','commhub_send_message','length','error','type','registered\x20as\x20\x22','commhub_get_all_status','setRequestHandler','2158554BrHdXV','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','connect','from','2.0','warning:\x20could\x20not\x20register:\x20'];a0_0x4563=function(){return _0x2085a6;};return a0_0x4563();}function v(){const _0x5a75a1=a0_0x34c1d6;try{let _0x4f594e=a0_0x480f90(C,_0x5a75a1(0x182),_0x5a75a1(0x130));if(a0_0x2657d6(_0x4f594e))return JSON['parse'](a0_0x1fe2cb(_0x4f594e,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H['hub']||a0_0x34c1d6(0x10a),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x1c689e(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x2c51a8(),X=process.env.COMMHUB_TOKEN||H[a0_0x34c1d6(0x15a)]||'';function Y(_0x30eabb){const _0x2648e0=a0_0x34c1d6;let _0x1f1bec=new Date()['toTimeString']()[_0x2648e0(0x187)](0x0,0x8);process[_0x2648e0(0x146)][_0x2648e0(0x12c)]('['+_0x1f1bec+']\x20[commhub]\x20'+_0x30eabb+'\x0a');}function h(_0x556b07){return new Promise(_0x516ebd=>setTimeout(_0x516ebd,_0x556b07));}Y(a0_0x34c1d6(0x103)+f+a0_0x34c1d6(0x106)+Z+a0_0x34c1d6(0x14a)+w[a0_0x34c1d6(0x187)](0x0,0x8)+a0_0x34c1d6(0x183)+(j||a0_0x34c1d6(0x102))+'\x20CWD='+process[a0_0x34c1d6(0x148)]()+a0_0x34c1d6(0x181)+L);var k=new Map(),K=new a0_0x45577c({'name':a0_0x34c1d6(0x109),'version':a0_0x34c1d6(0x118)},{'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_0x34c1d6(0x10f),a0_0x34c1d6(0x140),a0_0x34c1d6(0xfd)+Z][a0_0x34c1d6(0x101)]('\x0a')});K[a0_0x34c1d6(0x175)](a0_0x49838,async()=>({'tools':[{'name':a0_0x34c1d6(0x163),'description':a0_0x34c1d6(0x161),'inputSchema':{'type':a0_0x34c1d6(0x13e),'properties':{'task_id':{'type':a0_0x34c1d6(0x129),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x34c1d6(0x129),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x34c1d6(0x129),'enum':[a0_0x34c1d6(0x114),a0_0x34c1d6(0x16d),'cancelled','blocked',a0_0x34c1d6(0x171),a0_0x34c1d6(0x169)],'description':a0_0x34c1d6(0x119)}},'required':[a0_0x34c1d6(0x13f)]}},{'name':'commhub_report_status','description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x34c1d6(0x13e),'properties':{'status':{'type':a0_0x34c1d6(0x129),'enum':[a0_0x34c1d6(0x11a),a0_0x34c1d6(0x136),a0_0x34c1d6(0x13a),a0_0x34c1d6(0x171)]},'task':{'type':a0_0x34c1d6(0x129),'description':a0_0x34c1d6(0x164)},'progress':{'type':'number','description':a0_0x34c1d6(0x15e)}},'required':[a0_0x34c1d6(0x188)]}},{'name':a0_0x34c1d6(0x141),'description':a0_0x34c1d6(0x177),'inputSchema':{'type':a0_0x34c1d6(0x13e),'properties':{'alias':{'type':a0_0x34c1d6(0x129),'description':a0_0x34c1d6(0xfc)},'task':{'type':a0_0x34c1d6(0x129),'description':'Task\x20content'},'priority':{'type':a0_0x34c1d6(0x129),'enum':['high',a0_0x34c1d6(0x15c),a0_0x34c1d6(0x16a)],'description':a0_0x34c1d6(0x127)}},'required':['alias',a0_0x34c1d6(0x128)]}},{'name':'commhub_send_message','description':a0_0x34c1d6(0x185),'inputSchema':{'type':a0_0x34c1d6(0x13e),'properties':{'alias':{'type':a0_0x34c1d6(0x129),'description':a0_0x34c1d6(0xfc)},'message':{'type':a0_0x34c1d6(0x129),'description':'Message\x20content'}},'required':[a0_0x34c1d6(0x143),a0_0x34c1d6(0x156)]}},{'name':a0_0x34c1d6(0x174),'description':a0_0x34c1d6(0x14f),'inputSchema':{'type':a0_0x34c1d6(0x13e),'properties':{}}}]}));async function P(_0x308f54,_0x3d2150){const _0x588cdd=a0_0x34c1d6;let _0x118c6d=await fetch(f+_0x588cdd(0x123),{'method':_0x588cdd(0x122),'headers':{'Content-Type':_0x588cdd(0x111),'Accept':_0x588cdd(0x115),...X?{'Authorization':_0x588cdd(0x110)+X}:{}},'body':JSON[_0x588cdd(0x125)]({'jsonrpc':_0x588cdd(0x17a),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x588cdd(0x11e),'capabilities':{},'clientInfo':{'name':_0x588cdd(0x109),'version':'0.3.0'}}})});if(!_0x118c6d['ok']){let _0x2354cd=await _0x118c6d[_0x588cdd(0x13f)]();return Y(_0x588cdd(0x126)+_0x118c6d[_0x588cdd(0x188)]+'\x20'+_0x2354cd[_0x588cdd(0x187)](0x0,0x64)),{'ok':!0x1,'error':_0x588cdd(0x10d)+_0x118c6d[_0x588cdd(0x188)]};}await _0x118c6d[_0x588cdd(0x13f)]();let _0x1bcd29=(await(await fetch(f+_0x588cdd(0x123),{'method':_0x588cdd(0x122),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x588cdd(0x125)]({'jsonrpc':'2.0','id':0x2,'method':_0x588cdd(0x150),'params':{'name':_0x308f54,'arguments':_0x3d2150}})}))[_0x588cdd(0x13f)]())[_0x588cdd(0x16c)]('\x0a')[_0x588cdd(0x132)](_0x164d92=>_0x164d92[_0x588cdd(0x145)]('data:\x20'));if(_0x1bcd29){let _0x1a3836=JSON['parse'](_0x1bcd29[_0x588cdd(0x187)](0x6));return _0x1a3836?.[_0x588cdd(0x160)]?.[_0x588cdd(0x113)]?.[0x0]?.[_0x588cdd(0x13f)]?JSON[_0x588cdd(0x117)](_0x1a3836[_0x588cdd(0x160)][_0x588cdd(0x113)][0x0][_0x588cdd(0x13f)]):_0x1a3836;}return{'ok':!0x1,'error':_0x588cdd(0x12b)};}K['setRequestHandler'](a0_0xda8193,async _0x271de6=>{const _0x108f88=a0_0x34c1d6;let {name:_0x5a03d6,arguments:_0x2a871c}=_0x271de6[_0x108f88(0x166)];if(_0x5a03d6===_0x108f88(0x163)){let {task_id:_0x598ff2,text:_0x321324,status:_0x5ea438}=_0x2a871c;if(_0x5ea438===_0x108f88(0x114)||_0x5ea438===_0x108f88(0x16d)||_0x5ea438===_0x108f88(0x11b)){let _0x984720=_0x5ea438===_0x108f88(0x114)?'replied':_0x5ea438,_0x56658f=_0x598ff2?k[_0x108f88(0x134)](_0x598ff2)||_0x108f88(0x124):_0x108f88(0x124),_0x354cbf=await P('send_reply',{'alias':_0x56658f,'text':_0x321324,'in_reply_to':_0x598ff2||void 0x0,'status':_0x984720,'from_session':Z});if(_0x598ff2)k[_0x108f88(0x121)](_0x598ff2);return{'content':[{'type':'text','text':JSON[_0x108f88(0x125)](_0x354cbf)}]};}let _0x42fc7a=await P(_0x108f88(0x100),{'resume_id':w,'alias':Z,'status':_0x5ea438===_0x108f88(0x13a)?_0x108f88(0x13a):_0x5ea438===_0x108f88(0x171)?_0x108f88(0x171):_0x108f88(0x11a),'task':_0x321324[_0x108f88(0x187)](0x0,0xc8),'output':_0x321324});return{'content':[{'type':_0x108f88(0x13f),'text':JSON[_0x108f88(0x125)](_0x42fc7a)}]};}if(_0x5a03d6===_0x108f88(0x153)){let {status:_0x400c70,task:_0x29bf02,progress:_0x21f181}=_0x2a871c,_0x5a2629=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x400c70,'task':_0x29bf02,'progress':_0x21f181});return{'content':[{'type':_0x108f88(0x13f),'text':JSON['stringify'](_0x5a2629)}]};}if(_0x5a03d6==='commhub_send_task'){let {alias:_0x5caf36,task:_0x3c7423,priority:_0x46e5c2}=_0x2a871c,_0x253e99=await P(_0x108f88(0xff),{'alias':_0x5caf36,'task':_0x3c7423,'priority':_0x46e5c2||'normal','from_session':Z});return{'content':[{'type':_0x108f88(0x13f),'text':JSON['stringify'](_0x253e99)}]};}if(_0x5a03d6===_0x108f88(0x16f)){let {alias:_0x524632,message:_0x1ff8b0}=_0x2a871c,_0x5df72d=await P(_0x108f88(0x142),{'alias':_0x524632,'message':_0x1ff8b0,'from_session':Z});return{'content':[{'type':_0x108f88(0x13f),'text':JSON[_0x108f88(0x125)](_0x5df72d)}]};}if(_0x5a03d6===_0x108f88(0x174)){let _0x2528f6=await P(_0x108f88(0x15d),{});return{'content':[{'type':_0x108f88(0x13f),'text':JSON[_0x108f88(0x125)](_0x2528f6)}]};}return{'content':[{'type':_0x108f88(0x13f),'text':JSON[_0x108f88(0x125)]({'error':_0x108f88(0x116)})}]};});async function u(){const _0x148785=a0_0x34c1d6;let _0x303664=f+_0x148785(0x107)+encodeURIComponent(Z),_0x204c09={};if(X)_0x204c09[_0x148785(0x10e)]=_0x148785(0x110)+X;Y(_0x148785(0xfe)+_0x303664);while(!0x0){try{let _0x2c15f=await fetch(_0x303664,{'headers':_0x204c09});if(!_0x2c15f['ok']){Y(_0x148785(0x12d)+_0x2c15f[_0x148785(0x188)]+'\x20'+_0x2c15f[_0x148785(0x13c)]),await h(0x1388);continue;}let _0x44d501=_0x2c15f['body'][_0x148785(0x14b)](),_0x6e36b5=new TextDecoder(),_0x3a11a6='';while(!0x0){let {done:_0x3301d2,value:_0x51393c}=await _0x44d501[_0x148785(0x184)]();if(_0x3301d2)break;_0x3a11a6+=_0x6e36b5[_0x148785(0x167)](_0x51393c,{'stream':!0x0});let _0x420f9e=_0x3a11a6[_0x148785(0x16c)]('\x0a\x0a');_0x3a11a6=_0x420f9e['pop']()||'';for(let _0x1fda4c of _0x420f9e){let _0x486469=_0x1fda4c[_0x148785(0x16c)]('\x0a')['find'](_0x22bff1=>_0x22bff1[_0x148785(0x145)](_0x148785(0x13d)));if(!_0x486469)continue;try{let _0x2bb48d=JSON[_0x148785(0x117)](_0x486469[_0x148785(0x187)](0x6));await S(_0x2bb48d);}catch(_0x133352){Y(_0x148785(0x159)+_0x133352);}}}Y(_0x148785(0x12f));}catch(_0x2479ed){Y(_0x148785(0x180)+_0x2479ed);}await h(0xbb8);}}async function S(_0x5d8ae3){const _0x1cb331=a0_0x34c1d6;if(_0x5d8ae3['type']===_0x1cb331(0x144)){Y(_0x1cb331(0x168)+Z+'\x22');return;}if(_0x5d8ae3[_0x1cb331(0x172)]==='new_message'){if(Y('←\x20message\x20from\x20'+_0x5d8ae3['from']+':\x20'+_0x5d8ae3[_0x1cb331(0x156)][_0x1cb331(0x187)](0x0,0x3c)),await K['notification']({'method':_0x1cb331(0x162),'params':{'content':_0x5d8ae3[_0x1cb331(0x156)],'meta':{'sender':_0x5d8ae3[_0x1cb331(0x179)]||_0x1cb331(0x124),'sender_id':_0x1cb331(0x12a),'user':_0x5d8ae3[_0x1cb331(0x179)]||_0x1cb331(0x124),'priority':'normal'}}}),_0x5d8ae3[_0x1cb331(0x16b)])await P(_0x1cb331(0x137),{'alias':Z,'message_id':_0x5d8ae3[_0x1cb331(0x16b)]});return;}if(_0x5d8ae3[_0x1cb331(0x172)]===_0x1cb331(0x17c)||_0x5d8ae3[_0x1cb331(0x172)]===_0x1cb331(0x17d)){Y('←\x20'+_0x5d8ae3[_0x1cb331(0x172)]+':\x20inbox_count='+_0x5d8ae3[_0x1cb331(0x11d)]+_0x1cb331(0x154)+(_0x5d8ae3['priority']||_0x1cb331(0x15c)));let _0x23e6ff=await P(_0x1cb331(0x105),{'alias':Z,'limit':0x5});if(_0x23e6ff?.['ok']&&_0x23e6ff[_0x1cb331(0x14d)]?.[_0x1cb331(0x170)]>0x0)for(let _0x4d9648 of _0x23e6ff[_0x1cb331(0x14d)]){let _0x1d9185={'sender':_0x4d9648[_0x1cb331(0x112)]||_0x1cb331(0x124),'sender_id':'commhub','user':_0x4d9648[_0x1cb331(0x112)]||'hub','task_id':_0x4d9648['id'],'priority':_0x4d9648[_0x1cb331(0x10c)]||_0x1cb331(0x15c)};k[_0x1cb331(0x15f)](_0x4d9648['id'],_0x4d9648[_0x1cb331(0x112)]||_0x1cb331(0x124)),await K[_0x1cb331(0x104)]({'method':_0x1cb331(0x162),'params':{'content':_0x4d9648[_0x1cb331(0x113)],'meta':_0x1d9185}}),Y(_0x1cb331(0x138)+_0x4d9648['id'][_0x1cb331(0x187)](0x0,0x8)+_0x1cb331(0x11f)+_0x4d9648['from_session']+':\x20'+_0x4d9648[_0x1cb331(0x113)][_0x1cb331(0x187)](0x0,0x3c)),await P(_0x1cb331(0x137),{'alias':Z,'message_id':_0x4d9648['id']});}}}async function A(){const _0x25e2b3=a0_0x34c1d6;let _0x5d3fd5=new a0_0x44ae00();await K[_0x25e2b3(0x178)](_0x5d3fd5),Y(_0x25e2b3(0x131)),Y(_0x25e2b3(0x186)),u()[_0x25e2b3(0x152)](_0x4072e4=>Y('SSE\x20fatal:\x20'+_0x4072e4)),P(_0x25e2b3(0x100),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x1c689e(),'hostname':a0_0x1c689e(),'agent':_0x25e2b3(0x10b),'project_dir':process[_0x25e2b3(0x148)](),'tmux_name':j||void 0x0})['then'](()=>Y(_0x25e2b3(0x173)+Z+'\x22\x20('+w[_0x25e2b3(0x187)](0x0,0x8)+')'))[_0x25e2b3(0x152)](_0x5601dc=>Y(_0x25e2b3(0x17b)+_0x5601dc)),setInterval(()=>{const _0x1fda53=_0x25e2b3;P('report_status',{'resume_id':w,'alias':Z,'status':_0x1fda53(0x136),'server':a0_0x1c689e(),'hostname':a0_0x1c689e(),'agent':_0x1fda53(0x10b),'project_dir':process[_0x1fda53(0x148)](),'tmux_name':j||void 0x0})[_0x1fda53(0x152)](_0x182224=>Y(_0x1fda53(0x149)+_0x182224));},0x2bf20),Y(_0x25e2b3(0x120));}A()[a0_0x34c1d6(0x152)](_0x4268aa=>{const _0xc8bb58=a0_0x34c1d6;Y(_0xc8bb58(0x17f)+_0x4268aa),process[_0xc8bb58(0x14e)](0x1);});async function N(){const _0x507a10=a0_0x34c1d6;Y(_0x507a10(0x165)),await P(_0x507a10(0x100),{'resume_id':w,'alias':Z,'status':_0x507a10(0x171),'task':'session\x20disconnected'})['catch'](()=>{}),process[_0x507a10(0x14e)](0x0);}process[a0_0x34c1d6(0x147)]['on']('end',()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x34c1d6(0x158),()=>N());
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.0.3-preview.
|
|
4
|
-
"description": "AI Agent Network CLI
|
|
3
|
+
"version": "2.0.3-preview.10",
|
|
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",
|
|
7
7
|
"types": "dist/client.d.ts",
|
|
@@ -59,4 +59,4 @@
|
|
|
59
59
|
"node-pty": "^1.1.0",
|
|
60
60
|
"typescript": "^5.0.0"
|
|
61
61
|
}
|
|
62
|
-
}
|
|
62
|
+
}
|