@sleep2agi/agent-network 2.0.0 → 2.0.1-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -152
- package/dist/bin/cli.js +1 -1
- package/dist/src/client.js +1 -1
- package/dist/src/node-server.js +1 -1
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a0_0x223a(){const _0x3c5548=['heartbeatInterval','10xpfVmg','resumeId','offline','application/json','now','registered','new_message','getAllStatus','normal','1710216jkJtgm','parse','task','2.0','message','disconnect','match','result','status','reply','89114cIVese','toString','POST','report_status','from_session','connect','messages','235gSOrki','pop','SSE\x20failed:\x20',']\x20[commhub:','split','heartbeatTimer','sleep','10947607XaoGFm','get_all_status','replace','1928871QvAPMc','log','1792vHgmoj','/mcp','41274BsUoPv','connected','emit','997578dgnEwf','getReader','/events/','tools/call','SSE\x20reconnecting\x20in\x20','agent','call','url','Bearer\x20','inbox\x20error:\x20','min','text','send_message','type','Authorization','SSE\x20connected','sseAbort','AbortError','slice','4JyTWKT','cwd','error','server','alias','get_inbox','connectSSE','15616JLdVoq','idle','heartbeat\x20failed:\x20','decode','body','token','sdk-','broadcast','reconnectDelay','autoConnect','content','disconnected','send','processInbox','running'];a0_0x223a=function(){return _0x3c5548;};return a0_0x223a();}const a0_0xef29a8=a0_0x3363;(function(_0x504ff3,_0x1d0608){const _0x23057c=a0_0x3363,_0xf24c5=_0x504ff3();while(!![]){try{const _0x4ce9d9=parseInt(_0x23057c(0x116))/0x1*(parseInt(_0x23057c(0xec))/0x2)+parseInt(_0x23057c(0x12e))/0x3+parseInt(_0x23057c(0x10c))/0x4+-parseInt(_0x23057c(0x11d))/0x5*(parseInt(_0x23057c(0x12b))/0x6)+-parseInt(_0x23057c(0x129))/0x7*(-parseInt(_0x23057c(0xf3))/0x8)+parseInt(_0x23057c(0x127))/0x9+parseInt(_0x23057c(0x103))/0xa*(-parseInt(_0x23057c(0x124))/0xb);if(_0x4ce9d9===_0x1d0608)break;else _0xf24c5['push'](_0xf24c5['shift']());}catch(_0x1022d6){_0xf24c5['push'](_0xf24c5['shift']());}}}(a0_0x223a,0x517dd));import{EventEmitter as a0_0x2784ee}from'events';import{hostname as a0_0x521ce2}from'os';function a0_0x3363(_0x367f58,_0x4e1291){_0x367f58=_0x367f58-0xe2;const _0x223a8a=a0_0x223a();let _0x336326=_0x223a8a[_0x367f58];return _0x336326;}class T extends a0_0x2784ee{[a0_0xef29a8(0x135)];[a0_0xef29a8(0xf0)];[a0_0xef29a8(0xf8)];['agent'];[a0_0xef29a8(0x104)];[a0_0xef29a8(0x102)];[a0_0xef29a8(0xfb)];[a0_0xef29a8(0x122)];[a0_0xef29a8(0xe9)];[a0_0xef29a8(0x101)]=!0x1;constructor(_0x3f5b6b){const _0x2a9da6=a0_0xef29a8;super();if(this[_0x2a9da6(0x135)]=_0x3f5b6b['url'][_0x2a9da6(0x126)](/\/$/,''),this[_0x2a9da6(0xf0)]=_0x3f5b6b[_0x2a9da6(0xf0)],this[_0x2a9da6(0xf8)]=_0x3f5b6b[_0x2a9da6(0xf8)],this[_0x2a9da6(0x133)]=_0x3f5b6b[_0x2a9da6(0x133)]||'sdk',this['resumeId']=_0x2a9da6(0xf9)+_0x3f5b6b['alias']+'-'+Date[_0x2a9da6(0x107)]()[_0x2a9da6(0x117)](0x24),this[_0x2a9da6(0x102)]=_0x3f5b6b[_0x2a9da6(0x102)]??0x2bf20,this['reconnectDelay']=_0x3f5b6b[_0x2a9da6(0xfb)]??0xbb8,_0x3f5b6b[_0x2a9da6(0xfc)]!==!0x1)this[_0x2a9da6(0x11b)]();}['log'](_0x19fa64){const _0xb41d30=a0_0xef29a8;console[_0xb41d30(0x128)]('['+new Date()['toTimeString']()[_0xb41d30(0xeb)](0x0,0x8)+_0xb41d30(0x120)+this[_0xb41d30(0xf0)]+']\x20'+_0x19fa64);}async['call'](_0x3517a,_0x276ec0){const _0x55ed06=a0_0xef29a8;let _0x13d4d7={'Content-Type':_0x55ed06(0x106),'Accept':'application/json,\x20text/event-stream'};if(this[_0x55ed06(0xf8)])_0x13d4d7[_0x55ed06(0xe7)]=_0x55ed06(0x136)+this[_0x55ed06(0xf8)];let _0x3506fd=await(await fetch(this[_0x55ed06(0x135)]+_0x55ed06(0x12a),{'method':_0x55ed06(0x118),'headers':_0x13d4d7,'body':JSON['stringify']({'jsonrpc':_0x55ed06(0x10f),'id':Date[_0x55ed06(0x107)](),'method':_0x55ed06(0x131),'params':{'name':_0x3517a,'arguments':_0x276ec0}})}))[_0x55ed06(0xe4)](),_0x107c7a=_0x3506fd[_0x55ed06(0x112)](/data: (.+)/),_0x5dd893=_0x107c7a?JSON[_0x55ed06(0x10d)](_0x107c7a[0x1]):JSON['parse'](_0x3506fd),_0x2eb7f9=_0x5dd893?.[_0x55ed06(0x113)]?.[_0x55ed06(0xfd)]?.[0x0]?.[_0x55ed06(0xe4)];return _0x2eb7f9?JSON[_0x55ed06(0x10d)](_0x2eb7f9):_0x5dd893;}async[a0_0xef29a8(0x11b)](){const _0x39ee87=a0_0xef29a8;if(this['running'])return;this['running']=!0x0,await this['status'](_0x39ee87(0xf4)),this[_0x39ee87(0x128)](_0x39ee87(0x108)),this[_0x39ee87(0x122)]=setInterval(()=>{const _0x2bfb19=_0x39ee87;this['status'](_0x2bfb19(0xf4))['catch'](_0x51d8f4=>this[_0x2bfb19(0x128)](_0x2bfb19(0xf5)+_0x51d8f4['message']));},this[_0x39ee87(0x102)]),this[_0x39ee87(0xf2)]();}async[a0_0xef29a8(0x111)](){const _0x1d3812=a0_0xef29a8;if(this[_0x1d3812(0x101)]=!0x1,this[_0x1d3812(0xe9)]?.['abort'](),this[_0x1d3812(0x122)])clearInterval(this[_0x1d3812(0x122)]);await this[_0x1d3812(0x114)](_0x1d3812(0x105))['catch'](()=>{}),this[_0x1d3812(0x128)](_0x1d3812(0xfe));}async[a0_0xef29a8(0xff)](_0x5697ca,_0x565fc4,_0x26e1fc=a0_0xef29a8(0x10b)){const _0x51c28f=a0_0xef29a8;return this[_0x51c28f(0x134)]('send_task',{'alias':_0x5697ca,'task':_0x565fc4,'priority':_0x26e1fc,'from_session':this['alias']});}async[a0_0xef29a8(0x110)](_0x539344,_0x281ee3){const _0x5b702f=a0_0xef29a8;return this['call'](_0x5b702f(0xe5),{'alias':_0x539344,'message':_0x281ee3,'from_session':this[_0x5b702f(0xf0)]});}async[a0_0xef29a8(0x115)](_0x47ae66,_0x609bd7,_0x2eada7='completed'){const _0x20b1eb=a0_0xef29a8;return this['call'](_0x20b1eb(0x115),{'task_id':_0x47ae66,'text':_0x609bd7,'status':_0x2eada7});}async[a0_0xef29a8(0x114)](_0x41758c,_0x338ed9){const _0x298777=a0_0xef29a8;return this['call'](_0x298777(0x119),{'resume_id':this['resumeId'],'alias':this[_0x298777(0xf0)],'status':_0x41758c,'server':a0_0x521ce2(),'hostname':a0_0x521ce2(),'agent':this[_0x298777(0x133)],'project_dir':process[_0x298777(0xed)](),..._0x338ed9});}async[a0_0xef29a8(0x10a)](){const _0x307676=a0_0xef29a8;return this[_0x307676(0x134)](_0x307676(0x125),{});}async['broadcast'](_0x14ef30,_0x353ea3){const _0x4a4e98=a0_0xef29a8;return this[_0x4a4e98(0x134)](_0x4a4e98(0xfa),{'message':_0x14ef30,'filter_server':_0x353ea3?.[_0x4a4e98(0xef)],'filter_status':_0x353ea3?.[_0x4a4e98(0x114)]});}async[a0_0xef29a8(0xf2)](){const _0x2b1574=a0_0xef29a8;let _0x5a8246=encodeURIComponent(this[_0x2b1574(0xf0)]),_0x466b41=this[_0x2b1574(0x135)]+_0x2b1574(0x130)+_0x5a8246,_0x1e55a2=this['reconnectDelay'];while(this[_0x2b1574(0x101)]){try{this[_0x2b1574(0xe9)]=new AbortController();let _0x9e302d={'Accept':'text/event-stream'};if(this['token'])_0x9e302d[_0x2b1574(0xe7)]=_0x2b1574(0x136)+this[_0x2b1574(0xf8)];let _0x16c7cc=await fetch(_0x466b41,{'headers':_0x9e302d,'signal':this[_0x2b1574(0xe9)]['signal']});if(!_0x16c7cc['ok']||!_0x16c7cc[_0x2b1574(0xf7)]){this[_0x2b1574(0x128)](_0x2b1574(0x11f)+_0x16c7cc['status']),await this[_0x2b1574(0x123)](_0x1e55a2),_0x1e55a2=Math[_0x2b1574(0xe3)](_0x1e55a2*1.5,0xea60);continue;}_0x1e55a2=this[_0x2b1574(0xfb)];let _0x152bcb=_0x16c7cc[_0x2b1574(0xf7)][_0x2b1574(0x12f)](),_0x4dd182=new TextDecoder(),_0x388940='';while(this[_0x2b1574(0x101)]){let {done:_0x90e089,value:_0x44ad62}=await _0x152bcb['read']();if(_0x90e089)break;_0x388940+=_0x4dd182[_0x2b1574(0xf6)](_0x44ad62,{'stream':!0x0});let _0x827bb=_0x388940[_0x2b1574(0x121)]('\x0a');_0x388940=_0x827bb[_0x2b1574(0x11e)]()||'';for(let _0x81c7bb of _0x827bb){if(!_0x81c7bb['startsWith']('data:\x20'))continue;try{let _0x8727b0=JSON['parse'](_0x81c7bb[_0x2b1574(0xeb)](0x6));if(_0x8727b0[_0x2b1574(0xe6)]===_0x2b1574(0x12c)){this['log'](_0x2b1574(0xe8)),this['emit'](_0x2b1574(0x12c));continue;}if(_0x8727b0[_0x2b1574(0xe6)]==='new_task'||_0x8727b0[_0x2b1574(0xe6)]===_0x2b1574(0x109)||_0x8727b0['type']===_0x2b1574(0xfa))await this[_0x2b1574(0x100)]();}catch{}}}}catch(_0x956532){if(_0x956532['name']===_0x2b1574(0xea))break;this[_0x2b1574(0x12d)](_0x2b1574(0xee),_0x956532),this[_0x2b1574(0x128)]('SSE\x20error:\x20'+_0x956532[_0x2b1574(0x110)]);}if(this[_0x2b1574(0x101)])this[_0x2b1574(0x12d)]('disconnected'),this[_0x2b1574(0x128)](_0x2b1574(0x132)+_0x1e55a2/0x3e8+'s...'),await this['sleep'](_0x1e55a2),_0x1e55a2=Math[_0x2b1574(0xe3)](_0x1e55a2*1.5,0xea60);}}async['processInbox'](){const _0x311a3e=a0_0xef29a8;try{let _0x351a1f=(await this[_0x311a3e(0x134)](_0x311a3e(0xf1),{'alias':this['alias'],'limit':0xa}))?.[_0x311a3e(0x11c)]||[];for(let _0x1754aa of _0x351a1f)await this[_0x311a3e(0x134)]('ack_inbox',{'alias':this[_0x311a3e(0xf0)],'message_id':_0x1754aa['id']}),this[_0x311a3e(0x128)]('←\x20'+_0x1754aa[_0x311a3e(0x11a)]+':\x20'+_0x1754aa['content'][_0x311a3e(0xeb)](0x0,0x3c)),this['emit'](_0x311a3e(0x10e),_0x1754aa),this[_0x311a3e(0x12d)](_0x311a3e(0x110),_0x1754aa);}catch(_0x454899){this['log'](_0x311a3e(0xe2)+_0x454899[_0x311a3e(0x110)]);}}[a0_0xef29a8(0x123)](_0x3ae096){return new Promise(_0x40fe90=>setTimeout(_0x40fe90,_0x3ae096));}}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_0x1bfcde=a0_0x3477;(function(_0x4735e4,_0x56291a){const _0x32fcb0=a0_0x3477,_0x4c7414=_0x4735e4();while(!![]){try{const _0x3cdf36=-parseInt(_0x32fcb0(0x24d))/0x1*(-parseInt(_0x32fcb0(0x215))/0x2)+-parseInt(_0x32fcb0(0x234))/0x3+-parseInt(_0x32fcb0(0x1d8))/0x4*(parseInt(_0x32fcb0(0x1e7))/0x5)+parseInt(_0x32fcb0(0x213))/0x6+parseInt(_0x32fcb0(0x24a))/0x7+-parseInt(_0x32fcb0(0x251))/0x8+-parseInt(_0x32fcb0(0x257))/0x9*(-parseInt(_0x32fcb0(0x1d9))/0xa);if(_0x3cdf36===_0x56291a)break;else _0x4c7414['push'](_0x4c7414['shift']());}catch(_0x29e40a){_0x4c7414['push'](_0x4c7414['shift']());}}}(a0_0x1d41,0x38ddb));import{readFileSync as a0_0x1b88b8,existsSync as a0_0x1e344c}from'fs';import{join as a0_0xf9833a}from'path';import{hostname as a0_0x4dcd02}from'os';import{execSync as a0_0x1b6641}from'child_process';import{Server as a0_0xc1fe57}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x90d41f}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x240108,CallToolRequestSchema as a0_0x3d1ab7}from'@modelcontextprotocol/sdk/types.js';function a0_0x1d41(){const _0x3d4c4b=['idle','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','unknown\x20tool','token','parse\x20error:\x20','commhub','Current\x20task\x20description','Reply\x20text\x20/\x20result\x20summary','commhub_reply','find','0.3.0','setRequestHandler','application/json,\x20text/event-stream','application/json','get','utf-8','Task\x20content','catch','blocked','CommHub\x20init\x20failed:\x20','split','type','string','\x22\x20(','slice','Bearer\x20','tmux\x20display-message\x20-p\x20\x27#S\x27','status','toTimeString','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','\x20RESUME_ID=','priority','239880zENqCB','replace','162jqkUiQ','claude-code','cwd','data:\x20','initialize','normal','stderr','from_session','messages','indexOf','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','failed','...\x20TMUX=','parse','http://127.0.0.1:9200','in_progress','low','hub','Target\x20session\x20alias','ack_inbox','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','length','report_status','commhub_send_message',']\x20[commhub]\x20','no\x20response','exit','.env','←\x20message\x20from\x20','message','commhub_send_task','438933BIFiQb','set','working','warning:\x20could\x20not\x20register:\x20','commhub_get_all_status','alias','replied','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','trim','heartbeat\x20failed:\x20','broadcast','from','commhub-channel','commhub_report_status','get_inbox','registered\x20as\x20\x22','Priority\x20(default:\x20normal)','body','SIGINT','statusText','get_all_status','none','324254xrOEJP','startsWith','connected','4161ftdegg','Message\x20content','send_reply','object','1641104aiQddb','cancelled','SSE\x20connection\x20error:\x20','ENV:\x20URL=','\x20priority=','send_task','20259fKUWFX','\x20PROJECT_ENV=','2.0','inbox_count','end','stringify','72764vYJJik','2170IpBPpY','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','notification','connect','send_message','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','shutting\x20down,\x20reporting\x20offline...','content','message_id','notifications/claude/channel','text','completed','/mcp','number','90YvXUKt','error','tools/call','2025-03-26','\x20from\x20','POST','pop','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','MCP\x20stdio\x20connected','\x20ALIAS=','SIGTERM','SSE\x20stream\x20ended,\x20reconnecting...'];a0_0x1d41=function(){return _0x3d4c4b;};return a0_0x1d41();}function a0_0x3477(_0x4cb252,_0x85363b){_0x4cb252=_0x4cb252-0x1d8;const _0x1d4143=a0_0x1d41();let _0x34779a=_0x1d4143[_0x4cb252];return _0x34779a;}function p(_0x2452fe){const _0x5aa658=a0_0x3477;if(!a0_0x1e344c(_0x2452fe))return;for(let _0x188a2a of a0_0x1b88b8(_0x2452fe,_0x5aa658(0x202))[_0x5aa658(0x207)]('\x0a')){let _0x356b85=_0x188a2a[_0x5aa658(0x23c)]();if(!_0x356b85||_0x356b85[_0x5aa658(0x24b)]('#'))continue;let _0x277f23=_0x356b85[_0x5aa658(0x21e)]('=');if(_0x277f23<0x0)continue;let _0xa61733=_0x356b85['slice'](0x0,_0x277f23)[_0x5aa658(0x23c)](),_0x548b01=_0x356b85['slice'](_0x277f23+0x1)[_0x5aa658(0x23c)]()[_0x5aa658(0x214)](/^["']|["']$/g,'');if(!process.env[_0xa61733])process.env[_0xa61733]=_0x548b01;}}var C=process.env.HOME||'~',T=a0_0xf9833a(C,'.claude/channels/commhub');p(a0_0xf9833a(T,a0_0x1bfcde(0x230)));var L=process[a0_0x1bfcde(0x217)]()['replace'](/\//g,'-');p(a0_0xf9833a(T,L,'.env'));function U(){const _0x30c373=a0_0x1bfcde;try{return a0_0x1b6641(_0x30c373(0x20d),{'encoding':_0x30c373(0x202),'timeout':0x7d0})['trim']();}catch{return'';}}function c(){const _0x141b69=a0_0x1bfcde;try{let _0x1c8451=a0_0xf9833a(C,'.anet','config.json');if(a0_0x1e344c(_0x1c8451))return JSON['parse'](a0_0x1b88b8(_0x1c8451,_0x141b69(0x202)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x1bfcde(0x226)]||a0_0x1bfcde(0x223),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x4dcd02(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto['randomUUID'](),X=process.env.COMMHUB_TOKEN||H[a0_0x1bfcde(0x1f6)]||'';function Y(_0x335d64){const _0x21ca9e=a0_0x1bfcde;let _0xa6cc2f=new Date()[_0x21ca9e(0x20f)]()[_0x21ca9e(0x20b)](0x0,0x8);process[_0x21ca9e(0x21b)]['write']('['+_0xa6cc2f+_0x21ca9e(0x22d)+_0x335d64+'\x0a');}function h(_0x1103f2){return new Promise(_0x51957a=>setTimeout(_0x51957a,_0x1103f2));}Y(a0_0x1bfcde(0x254)+D+a0_0x1bfcde(0x1f0)+Z+a0_0x1bfcde(0x211)+w['slice'](0x0,0x8)+a0_0x1bfcde(0x221)+(f||a0_0x1bfcde(0x249))+'\x20CWD='+process[a0_0x1bfcde(0x217)]()+a0_0x1bfcde(0x258)+L);var k=new Map(),K=new a0_0xc1fe57({'name':'commhub-channel','version':a0_0x1bfcde(0x1fd)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x1bfcde(0x210),a0_0x1bfcde(0x23b),a0_0x1bfcde(0x1de),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Session\x20alias:\x20'+Z]['join']('\x0a')});K[a0_0x1bfcde(0x1fe)](a0_0x240108,async()=>({'tools':[{'name':a0_0x1bfcde(0x1fb),'description':a0_0x1bfcde(0x1ee),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x1bfcde(0x209),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x1bfcde(0x209),'description':a0_0x1bfcde(0x1fa)},'status':{'type':a0_0x1bfcde(0x209),'enum':['completed',a0_0x1bfcde(0x220),a0_0x1bfcde(0x252),a0_0x1bfcde(0x205),a0_0x1bfcde(0x1e8),a0_0x1bfcde(0x224)],'description':a0_0x1bfcde(0x1f4)}},'required':[a0_0x1bfcde(0x1e3)]}},{'name':'commhub_report_status','description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x1bfcde(0x250),'properties':{'status':{'type':'string','enum':[a0_0x1bfcde(0x236),'idle',a0_0x1bfcde(0x205),a0_0x1bfcde(0x1e8)]},'task':{'type':a0_0x1bfcde(0x209),'description':a0_0x1bfcde(0x1f9)},'progress':{'type':a0_0x1bfcde(0x1e6),'description':'Progress\x200-100'}},'required':[a0_0x1bfcde(0x20e)]}},{'name':a0_0x1bfcde(0x233),'description':a0_0x1bfcde(0x1da),'inputSchema':{'type':a0_0x1bfcde(0x250),'properties':{'alias':{'type':a0_0x1bfcde(0x209),'description':a0_0x1bfcde(0x227)},'task':{'type':a0_0x1bfcde(0x209),'description':a0_0x1bfcde(0x203)},'priority':{'type':a0_0x1bfcde(0x209),'enum':['high',a0_0x1bfcde(0x21a),a0_0x1bfcde(0x225)],'description':a0_0x1bfcde(0x244)}},'required':['alias','task']}},{'name':a0_0x1bfcde(0x22c),'description':a0_0x1bfcde(0x21f),'inputSchema':{'type':a0_0x1bfcde(0x250),'properties':{'alias':{'type':a0_0x1bfcde(0x209),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x1bfcde(0x209),'description':a0_0x1bfcde(0x24e)}},'required':[a0_0x1bfcde(0x239),'message']}},{'name':'commhub_get_all_status','description':a0_0x1bfcde(0x229),'inputSchema':{'type':a0_0x1bfcde(0x250),'properties':{}}}]}));async function P(_0x316971,_0x3948fc){const _0x51b984=a0_0x1bfcde;let _0x2694a2=await fetch(D+_0x51b984(0x1e5),{'method':_0x51b984(0x1ec),'headers':{'Content-Type':_0x51b984(0x200),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x51b984(0x20c)+X}:{}},'body':JSON[_0x51b984(0x25c)]({'jsonrpc':'2.0','id':0x1,'method':_0x51b984(0x219),'params':{'protocolVersion':_0x51b984(0x1ea),'capabilities':{},'clientInfo':{'name':_0x51b984(0x240),'version':_0x51b984(0x1fd)}}})});if(!_0x2694a2['ok']){let _0x8da0c5=await _0x2694a2[_0x51b984(0x1e3)]();return Y(_0x51b984(0x206)+_0x2694a2[_0x51b984(0x20e)]+'\x20'+_0x8da0c5[_0x51b984(0x20b)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x2694a2[_0x51b984(0x20e)]};}await _0x2694a2[_0x51b984(0x1e3)]();let _0x31123b=(await(await fetch(D+_0x51b984(0x1e5),{'method':_0x51b984(0x1ec),'headers':{'Content-Type':_0x51b984(0x200),'Accept':_0x51b984(0x1ff),...X?{'Authorization':_0x51b984(0x20c)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x51b984(0x259),'id':0x2,'method':_0x51b984(0x1e9),'params':{'name':_0x316971,'arguments':_0x3948fc}})}))['text']())[_0x51b984(0x207)]('\x0a')['find'](_0xf78749=>_0xf78749[_0x51b984(0x24b)](_0x51b984(0x218)));if(_0x31123b){let _0x10da20=JSON['parse'](_0x31123b[_0x51b984(0x20b)](0x6));return _0x10da20?.['result']?.[_0x51b984(0x1e0)]?.[0x0]?.[_0x51b984(0x1e3)]?JSON['parse'](_0x10da20['result'][_0x51b984(0x1e0)][0x0][_0x51b984(0x1e3)]):_0x10da20;}return{'ok':!0x1,'error':_0x51b984(0x22e)};}K[a0_0x1bfcde(0x1fe)](a0_0x3d1ab7,async _0x5ec644=>{const _0x2ad2c=a0_0x1bfcde;let {name:_0x93baa8,arguments:_0x2c4815}=_0x5ec644['params'];if(_0x93baa8==='commhub_reply'){let {task_id:_0x4671f5,text:_0x22d80e,status:_0x15be96}=_0x2c4815;if(_0x15be96===_0x2ad2c(0x1e4)||_0x15be96===_0x2ad2c(0x220)||_0x15be96===_0x2ad2c(0x252)){let _0x2e5106=_0x15be96===_0x2ad2c(0x1e4)?_0x2ad2c(0x23a):_0x15be96,_0x1142b0=_0x4671f5?k[_0x2ad2c(0x201)](_0x4671f5)||_0x2ad2c(0x226):'hub',_0x1a838a=await P(_0x2ad2c(0x24f),{'alias':_0x1142b0,'text':_0x22d80e,'in_reply_to':_0x4671f5||void 0x0,'status':_0x2e5106,'from_session':Z});if(_0x4671f5)k['delete'](_0x4671f5);return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON[_0x2ad2c(0x25c)](_0x1a838a)}]};}let _0x1ebe8d=await P(_0x2ad2c(0x22b),{'resume_id':w,'alias':Z,'status':_0x15be96==='blocked'?_0x2ad2c(0x205):_0x15be96==='error'?_0x2ad2c(0x1e8):'working','task':_0x22d80e[_0x2ad2c(0x20b)](0x0,0xc8),'output':_0x22d80e});return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON[_0x2ad2c(0x25c)](_0x1ebe8d)}]};}if(_0x93baa8===_0x2ad2c(0x241)){let {status:_0x41a26b,task:_0x3ad149,progress:_0x5cfc7e}=_0x2c4815,_0xbb9721=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x41a26b,'task':_0x3ad149,'progress':_0x5cfc7e});return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON[_0x2ad2c(0x25c)](_0xbb9721)}]};}if(_0x93baa8===_0x2ad2c(0x233)){let {alias:_0x537a0e,task:_0x506210,priority:_0x5131c3}=_0x2c4815,_0x467616=await P(_0x2ad2c(0x256),{'alias':_0x537a0e,'task':_0x506210,'priority':_0x5131c3||_0x2ad2c(0x21a),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x2ad2c(0x25c)](_0x467616)}]};}if(_0x93baa8===_0x2ad2c(0x22c)){let {alias:_0x15ab1a,message:_0x2cae7d}=_0x2c4815,_0x3a1d68=await P(_0x2ad2c(0x1dd),{'alias':_0x15ab1a,'message':_0x2cae7d,'from_session':Z});return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON[_0x2ad2c(0x25c)](_0x3a1d68)}]};}if(_0x93baa8===_0x2ad2c(0x238)){let _0x322f88=await P(_0x2ad2c(0x248),{});return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON[_0x2ad2c(0x25c)](_0x322f88)}]};}return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON['stringify']({'error':_0x2ad2c(0x1f5)})}]};});async function v(){const _0x2eff2b=a0_0x1bfcde;let _0x21dfdb=D+'/events/'+encodeURIComponent(Z),_0x23d0ff={};if(X)_0x23d0ff['Authorization']=_0x2eff2b(0x20c)+X;Y('connecting\x20to\x20'+_0x21dfdb);while(!0x0){try{let _0x101c64=await fetch(_0x21dfdb,{'headers':_0x23d0ff});if(!_0x101c64['ok']){Y('SSE\x20error:\x20'+_0x101c64[_0x2eff2b(0x20e)]+'\x20'+_0x101c64[_0x2eff2b(0x247)]),await h(0x1388);continue;}let _0x590abd=_0x101c64[_0x2eff2b(0x245)]['getReader'](),_0x592518=new TextDecoder(),_0x556545='';while(!0x0){let {done:_0x25bf4a,value:_0x2106a3}=await _0x590abd['read']();if(_0x25bf4a)break;_0x556545+=_0x592518['decode'](_0x2106a3,{'stream':!0x0});let _0x48b926=_0x556545[_0x2eff2b(0x207)]('\x0a\x0a');_0x556545=_0x48b926[_0x2eff2b(0x1ed)]()||'';for(let _0x2ceefc of _0x48b926){let _0xe3f426=_0x2ceefc[_0x2eff2b(0x207)]('\x0a')[_0x2eff2b(0x1fc)](_0x281105=>_0x281105[_0x2eff2b(0x24b)](_0x2eff2b(0x218)));if(!_0xe3f426)continue;try{let _0x4b59eb=JSON[_0x2eff2b(0x222)](_0xe3f426['slice'](0x6));await u(_0x4b59eb);}catch(_0x1c9c74){Y(_0x2eff2b(0x1f7)+_0x1c9c74);}}}Y(_0x2eff2b(0x1f2));}catch(_0x3d705e){Y(_0x2eff2b(0x253)+_0x3d705e);}await h(0xbb8);}}async function u(_0x18ef59){const _0x13eb17=a0_0x1bfcde;if(_0x18ef59['type']===_0x13eb17(0x24c)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x18ef59['type']==='new_message'){if(Y(_0x13eb17(0x231)+_0x18ef59[_0x13eb17(0x23f)]+':\x20'+_0x18ef59['message'][_0x13eb17(0x20b)](0x0,0x3c)),await K[_0x13eb17(0x1db)]({'method':_0x13eb17(0x1e2),'params':{'content':_0x18ef59[_0x13eb17(0x232)],'meta':{'sender':_0x18ef59[_0x13eb17(0x23f)]||_0x13eb17(0x226),'sender_id':_0x13eb17(0x1f8),'user':_0x18ef59[_0x13eb17(0x23f)]||_0x13eb17(0x226),'priority':_0x13eb17(0x21a)}}}),_0x18ef59[_0x13eb17(0x1e1)])await P('ack_inbox',{'alias':Z,'message_id':_0x18ef59[_0x13eb17(0x1e1)]});return;}if(_0x18ef59['type']==='new_task'||_0x18ef59[_0x13eb17(0x208)]===_0x13eb17(0x23e)){Y('←\x20'+_0x18ef59[_0x13eb17(0x208)]+':\x20inbox_count='+_0x18ef59[_0x13eb17(0x25a)]+_0x13eb17(0x255)+(_0x18ef59[_0x13eb17(0x212)]||_0x13eb17(0x21a)));let _0x22d86c=await P(_0x13eb17(0x242),{'alias':Z,'limit':0x5});if(_0x22d86c?.['ok']&&_0x22d86c[_0x13eb17(0x21d)]?.[_0x13eb17(0x22a)]>0x0)for(let _0x183b31 of _0x22d86c['messages']){let _0x32cb18={'sender':_0x183b31[_0x13eb17(0x21c)]||_0x13eb17(0x226),'sender_id':_0x13eb17(0x1f8),'user':_0x183b31['from_session']||'hub','task_id':_0x183b31['id'],'priority':_0x183b31[_0x13eb17(0x212)]||_0x13eb17(0x21a)};k[_0x13eb17(0x235)](_0x183b31['id'],_0x183b31[_0x13eb17(0x21c)]||'hub'),await K['notification']({'method':'notifications/claude/channel','params':{'content':_0x183b31['content'],'meta':_0x32cb18}}),Y('→\x20injected\x20task\x20'+_0x183b31['id'][_0x13eb17(0x20b)](0x0,0x8)+_0x13eb17(0x1eb)+_0x183b31[_0x13eb17(0x21c)]+':\x20'+_0x183b31[_0x13eb17(0x1e0)][_0x13eb17(0x20b)](0x0,0x3c)),await P(_0x13eb17(0x228),{'alias':Z,'message_id':_0x183b31['id']});}}}async function S(){const _0x23dbcc=a0_0x1bfcde;let _0x4a99d9=new a0_0x90d41f();await K[_0x23dbcc(0x1dc)](_0x4a99d9),Y(_0x23dbcc(0x1ef)),Y('starting\x20SSE\x20listener...'),v()[_0x23dbcc(0x204)](_0x1f0f98=>Y('SSE\x20fatal:\x20'+_0x1f0f98)),P(_0x23dbcc(0x22b),{'resume_id':w,'alias':Z,'status':_0x23dbcc(0x1f3),'server':a0_0x4dcd02(),'hostname':a0_0x4dcd02(),'agent':_0x23dbcc(0x216),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})['then'](()=>Y(_0x23dbcc(0x243)+Z+_0x23dbcc(0x20a)+w[_0x23dbcc(0x20b)](0x0,0x8)+')'))[_0x23dbcc(0x204)](_0x292b2e=>Y(_0x23dbcc(0x237)+_0x292b2e)),setInterval(()=>{const _0xb9ba01=_0x23dbcc;P('report_status',{'resume_id':w,'alias':Z,'status':_0xb9ba01(0x1f3),'server':a0_0x4dcd02(),'hostname':a0_0x4dcd02(),'agent':_0xb9ba01(0x216),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0xb9ba01(0x204)](_0x35d54f=>Y(_0xb9ba01(0x23d)+_0x35d54f));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}S()[a0_0x1bfcde(0x204)](_0x76d579=>{const _0x4b8e13=a0_0x1bfcde;Y('fatal:\x20'+_0x76d579),process[_0x4b8e13(0x22f)](0x1);});async function N(){const _0x3c9ff6=a0_0x1bfcde;Y(_0x3c9ff6(0x1df)),await P(_0x3c9ff6(0x22b),{'resume_id':w,'alias':Z,'status':'error','task':'session\x20disconnected'})[_0x3c9ff6(0x204)](()=>{}),process[_0x3c9ff6(0x22f)](0x0);}process['stdin']['on'](a0_0x1bfcde(0x25b),()=>N()),process['on'](a0_0x1bfcde(0x1f1),()=>N()),process['on'](a0_0x1bfcde(0x246),()=>N());
|
|
2
|
+
const a0_0x3e6d72=a0_0x17e3;(function(_0x1d3a2b,_0x40421e){const _0x56e7e0=a0_0x17e3,_0xbbec5f=_0x1d3a2b();while(!![]){try{const _0x3023bb=-parseInt(_0x56e7e0(0x22b))/0x1+-parseInt(_0x56e7e0(0x1f1))/0x2*(-parseInt(_0x56e7e0(0x20d))/0x3)+-parseInt(_0x56e7e0(0x233))/0x4*(parseInt(_0x56e7e0(0x215))/0x5)+-parseInt(_0x56e7e0(0x25e))/0x6+-parseInt(_0x56e7e0(0x20e))/0x7*(-parseInt(_0x56e7e0(0x25b))/0x8)+-parseInt(_0x56e7e0(0x211))/0x9*(parseInt(_0x56e7e0(0x236))/0xa)+parseInt(_0x56e7e0(0x254))/0xb;if(_0x3023bb===_0x40421e)break;else _0xbbec5f['push'](_0xbbec5f['shift']());}catch(_0x5d0d4d){_0xbbec5f['push'](_0xbbec5f['shift']());}}}(a0_0x3b9f,0x4b707));import{readFileSync as a0_0x2631e6,existsSync as a0_0x56ee36}from'fs';import{randomUUID as a0_0x1bf8c9}from'crypto';import{join as a0_0x5b5672}from'path';import{hostname as a0_0x342df9}from'os';import{execSync as a0_0x233a98}from'child_process';import{Server as a0_0x198c9f}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x3e4b81}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x4177a8,CallToolRequestSchema as a0_0x443a8f}from'@modelcontextprotocol/sdk/types.js';function p(_0x592312){const _0x34f317=a0_0x17e3;if(!a0_0x56ee36(_0x592312))return;for(let _0x46f4c5 of a0_0x2631e6(_0x592312,_0x34f317(0x210))['split']('\x0a')){let _0x58b316=_0x46f4c5[_0x34f317(0x24c)]();if(!_0x58b316||_0x58b316[_0x34f317(0x231)]('#'))continue;let _0x2a09f4=_0x58b316[_0x34f317(0x266)]('=');if(_0x2a09f4<0x0)continue;let _0x4b3e8e=_0x58b316[_0x34f317(0x208)](0x0,_0x2a09f4)['trim'](),_0x4a79a7=_0x58b316[_0x34f317(0x208)](_0x2a09f4+0x1)['trim']()[_0x34f317(0x27c)](/^["']|["']$/g,'');if(!process.env[_0x4b3e8e])process.env[_0x4b3e8e]=_0x4a79a7;}}var C=process.env.HOME||'~',T=a0_0x5b5672(C,a0_0x3e6d72(0x235));p(a0_0x5b5672(T,'.env'));var L=process[a0_0x3e6d72(0x256)]()[a0_0x3e6d72(0x27c)](/\//g,'-');p(a0_0x5b5672(T,L,a0_0x3e6d72(0x1ff)));function U(){const _0x311930=a0_0x3e6d72;try{return a0_0x233a98(_0x311930(0x227),{'encoding':_0x311930(0x210),'timeout':0x7d0})[_0x311930(0x24c)]();}catch{return'';}}function v(){const _0x3338fd=a0_0x3e6d72;try{let _0x10a3fb=a0_0x5b5672(C,_0x3338fd(0x1f8),'config.json');if(a0_0x56ee36(_0x10a3fb))return JSON[_0x3338fd(0x214)](a0_0x2631e6(_0x10a3fb,_0x3338fd(0x210)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x3e6d72(0x26f)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x342df9(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x1bf8c9(),X=process.env.COMMHUB_TOKEN||H[a0_0x3e6d72(0x225)]||'';function Y(_0x2de9c1){const _0xdebd=a0_0x3e6d72;let _0x32128b=new Date()[_0xdebd(0x252)]()['slice'](0x0,0x8);process[_0xdebd(0x22e)][_0xdebd(0x213)]('['+_0x32128b+']\x20[commhub]\x20'+_0x2de9c1+'\x0a');}function h(_0x2175d1){return new Promise(_0x537899=>setTimeout(_0x537899,_0x2175d1));}Y('ENV:\x20URL='+f+'\x20ALIAS='+Z+a0_0x3e6d72(0x203)+w[a0_0x3e6d72(0x208)](0x0,0x8)+'...\x20TMUX='+(j||a0_0x3e6d72(0x24d))+a0_0x3e6d72(0x25c)+process['cwd']()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x198c9f({'name':a0_0x3e6d72(0x267),'version':a0_0x3e6d72(0x269)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x3e6d72(0x1fb),a0_0x3e6d72(0x228),a0_0x3e6d72(0x238),a0_0x3e6d72(0x247),a0_0x3e6d72(0x261)+Z][a0_0x3e6d72(0x218)]('\x0a')});function a0_0x17e3(_0x2c139a,_0x4d669c){_0x2c139a=_0x2c139a-0x1f0;const _0x3b9fd9=a0_0x3b9f();let _0x17e30d=_0x3b9fd9[_0x2c139a];return _0x17e30d;}K[a0_0x3e6d72(0x219)](a0_0x4177a8,async()=>({'tools':[{'name':'commhub_reply','description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x3e6d72(0x212),'properties':{'task_id':{'type':a0_0x3e6d72(0x23d),'description':a0_0x3e6d72(0x22a)},'text':{'type':a0_0x3e6d72(0x23d),'description':a0_0x3e6d72(0x20c)},'status':{'type':'string','enum':[a0_0x3e6d72(0x230),a0_0x3e6d72(0x223),a0_0x3e6d72(0x241),a0_0x3e6d72(0x202),a0_0x3e6d72(0x273),a0_0x3e6d72(0x258)],'description':a0_0x3e6d72(0x206)}},'required':[a0_0x3e6d72(0x220)]}},{'name':a0_0x3e6d72(0x207),'description':a0_0x3e6d72(0x279),'inputSchema':{'type':a0_0x3e6d72(0x212),'properties':{'status':{'type':a0_0x3e6d72(0x23d),'enum':['working','idle','blocked',a0_0x3e6d72(0x273)]},'task':{'type':a0_0x3e6d72(0x23d),'description':a0_0x3e6d72(0x24e)},'progress':{'type':a0_0x3e6d72(0x201),'description':'Progress\x200-100'}},'required':[a0_0x3e6d72(0x20b)]}},{'name':'commhub_send_task','description':a0_0x3e6d72(0x217),'inputSchema':{'type':a0_0x3e6d72(0x212),'properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'task':{'type':a0_0x3e6d72(0x23d),'description':a0_0x3e6d72(0x23f)},'priority':{'type':'string','enum':[a0_0x3e6d72(0x255),a0_0x3e6d72(0x1f2),a0_0x3e6d72(0x22c)],'description':'Priority\x20(default:\x20normal)'}},'required':['alias',a0_0x3e6d72(0x1fd)]}},{'name':a0_0x3e6d72(0x21b),'description':a0_0x3e6d72(0x243),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x3e6d72(0x23d),'description':a0_0x3e6d72(0x23b)},'message':{'type':a0_0x3e6d72(0x23d),'description':a0_0x3e6d72(0x275)}},'required':[a0_0x3e6d72(0x21e),a0_0x3e6d72(0x22f)]}},{'name':a0_0x3e6d72(0x277),'description':a0_0x3e6d72(0x23c),'inputSchema':{'type':'object','properties':{}}}]}));async function P(_0xd486dd,_0x47f3f8){const _0x573490=a0_0x3e6d72;let _0x35c0c1=await fetch(f+_0x573490(0x263),{'method':'POST','headers':{'Content-Type':_0x573490(0x1f7),'Accept':_0x573490(0x257),...X?{'Authorization':_0x573490(0x24f)+X}:{}},'body':JSON[_0x573490(0x20f)]({'jsonrpc':_0x573490(0x249),'id':0x1,'method':_0x573490(0x234),'params':{'protocolVersion':_0x573490(0x270),'capabilities':{},'clientInfo':{'name':_0x573490(0x267),'version':_0x573490(0x269)}}})});if(!_0x35c0c1['ok']){let _0x3e0c3d=await _0x35c0c1[_0x573490(0x220)]();return Y(_0x573490(0x253)+_0x35c0c1[_0x573490(0x20b)]+'\x20'+_0x3e0c3d[_0x573490(0x208)](0x0,0x64)),{'ok':!0x1,'error':_0x573490(0x26d)+_0x35c0c1[_0x573490(0x20b)]};}await _0x35c0c1[_0x573490(0x220)]();let _0x70041d=(await(await fetch(f+'/mcp',{'method':'POST','headers':{'Content-Type':'application/json','Accept':_0x573490(0x257),...X?{'Authorization':_0x573490(0x24f)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x2,'method':'tools/call','params':{'name':_0xd486dd,'arguments':_0x47f3f8}})}))[_0x573490(0x220)]())['split']('\x0a')[_0x573490(0x232)](_0x46ef7f=>_0x46ef7f[_0x573490(0x231)](_0x573490(0x244)));if(_0x70041d){let _0x5ea2f9=JSON[_0x573490(0x214)](_0x70041d['slice'](0x6));return _0x5ea2f9?.[_0x573490(0x272)]?.[_0x573490(0x237)]?.[0x0]?.[_0x573490(0x220)]?JSON[_0x573490(0x214)](_0x5ea2f9[_0x573490(0x272)][_0x573490(0x237)][0x0][_0x573490(0x220)]):_0x5ea2f9;}return{'ok':!0x1,'error':_0x573490(0x224)};}function a0_0x3b9f(){const _0x2a8db7=['commhub_send_task','\x20from\x20','init\x20failed:\x20','type','hub','2025-03-26','split','result','error','fatal:\x20','Message\x20content','read','commhub_get_all_status','from_session','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.',':\x20inbox_count=','decode','replace','get_all_status','42mKocIe','normal','connecting\x20to\x20','message_id','commhub','get_inbox','application/json','.anet','SIGTERM','connect','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','send_reply','task','idle','.env','SSE\x20stream\x20ended,\x20reconnecting...','number','blocked','\x20RESUME_ID=','warning:\x20could\x20not\x20register:\x20','statusText','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','commhub_report_status','slice','\x20priority=','broadcast','status','Reply\x20text\x20/\x20result\x20summary','10536uWPweg','42bQeUpj','stringify','utf-8','1093914ATnHvJ','object','write','parse','45DHtlho','priority','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','join','setRequestHandler','notifications/claude/channel','commhub_send_message','MCP\x20stdio\x20connected','Authorization','alias','body','text','messages','ready\x20—\x20waiting\x20for\x20events','failed','no\x20response','token','params','tmux\x20display-message\x20-p\x20\x27#S\x27','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','from','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','28174ourXri','low','SSE\x20fatal:\x20','stderr','message','completed','startsWith','find','135816QmglMh','initialize','.claude/channels/commhub','20xwaZqf','content','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','catch','session\x20disconnected','Target\x20session\x20alias','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','string','delete','Task\x20content','commhub_reply','cancelled','send_task','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','data:\x20','stdin','working','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','ack_inbox','2.0','/events/','notification','trim','none','Current\x20task\x20description','Bearer\x20','replied','SIGINT','toTimeString','CommHub\x20init\x20failed:\x20','5255668nOOfRE','high','cwd','application/json,\x20text/event-stream','in_progress','exit','then','711448iMUqqL','\x20CWD=','pop','1195650pDvJbY','report_status','set','Session\x20alias:\x20','end','/mcp','claude-code','send_message','indexOf','commhub-channel','inbox_count','0.3.0','←\x20message\x20from\x20'];a0_0x3b9f=function(){return _0x2a8db7;};return a0_0x3b9f();}K[a0_0x3e6d72(0x219)](a0_0x443a8f,async _0x3eb3ff=>{const _0x170b6d=a0_0x3e6d72;let {name:_0x63a199,arguments:_0x38e36b}=_0x3eb3ff[_0x170b6d(0x226)];if(_0x63a199===_0x170b6d(0x240)){let {task_id:_0x2874ac,text:_0x4d8d97,status:_0x23e766}=_0x38e36b;if(_0x23e766==='completed'||_0x23e766==='failed'||_0x23e766===_0x170b6d(0x241)){let _0x4ec15b=_0x23e766===_0x170b6d(0x230)?_0x170b6d(0x250):_0x23e766,_0xb33690=_0x2874ac?k['get'](_0x2874ac)||_0x170b6d(0x26f):_0x170b6d(0x26f),_0x2e91c2=await P(_0x170b6d(0x1fc),{'alias':_0xb33690,'text':_0x4d8d97,'in_reply_to':_0x2874ac||void 0x0,'status':_0x4ec15b,'from_session':Z});if(_0x2874ac)k[_0x170b6d(0x23e)](_0x2874ac);return{'content':[{'type':_0x170b6d(0x220),'text':JSON['stringify'](_0x2e91c2)}]};}let _0x3242d0=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x23e766===_0x170b6d(0x202)?'blocked':_0x23e766===_0x170b6d(0x273)?_0x170b6d(0x273):_0x170b6d(0x246),'task':_0x4d8d97[_0x170b6d(0x208)](0x0,0xc8),'output':_0x4d8d97});return{'content':[{'type':_0x170b6d(0x220),'text':JSON[_0x170b6d(0x20f)](_0x3242d0)}]};}if(_0x63a199==='commhub_report_status'){let {status:_0x45eeb3,task:_0x3f1c65,progress:_0x3e3dc5}=_0x38e36b,_0x50c84c=await P(_0x170b6d(0x25f),{'resume_id':w,'alias':Z,'status':_0x45eeb3,'task':_0x3f1c65,'progress':_0x3e3dc5});return{'content':[{'type':_0x170b6d(0x220),'text':JSON['stringify'](_0x50c84c)}]};}if(_0x63a199===_0x170b6d(0x26b)){let {alias:_0x31ce6d,task:_0x430e07,priority:_0xa138fa}=_0x38e36b,_0x18362c=await P(_0x170b6d(0x242),{'alias':_0x31ce6d,'task':_0x430e07,'priority':_0xa138fa||_0x170b6d(0x1f2),'from_session':Z});return{'content':[{'type':_0x170b6d(0x220),'text':JSON[_0x170b6d(0x20f)](_0x18362c)}]};}if(_0x63a199===_0x170b6d(0x21b)){let {alias:_0x2c205f,message:_0x5dc537}=_0x38e36b,_0x32a630=await P(_0x170b6d(0x265),{'alias':_0x2c205f,'message':_0x5dc537,'from_session':Z});return{'content':[{'type':_0x170b6d(0x220),'text':JSON[_0x170b6d(0x20f)](_0x32a630)}]};}if(_0x63a199===_0x170b6d(0x277)){let _0x3c9ff7=await P(_0x170b6d(0x1f0),{});return{'content':[{'type':_0x170b6d(0x220),'text':JSON[_0x170b6d(0x20f)](_0x3c9ff7)}]};}return{'content':[{'type':_0x170b6d(0x220),'text':JSON[_0x170b6d(0x20f)]({'error':'unknown\x20tool'})}]};});async function u(){const _0x4bcf30=a0_0x3e6d72;let _0x285c3b=f+_0x4bcf30(0x24a)+encodeURIComponent(Z),_0x490c36={};if(X)_0x490c36[_0x4bcf30(0x21d)]=_0x4bcf30(0x24f)+X;Y(_0x4bcf30(0x1f3)+_0x285c3b);while(!0x0){try{let _0x41f9a7=await fetch(_0x285c3b,{'headers':_0x490c36});if(!_0x41f9a7['ok']){Y('SSE\x20error:\x20'+_0x41f9a7[_0x4bcf30(0x20b)]+'\x20'+_0x41f9a7[_0x4bcf30(0x205)]),await h(0x1388);continue;}let _0x4591a2=_0x41f9a7[_0x4bcf30(0x21f)]['getReader'](),_0x3a5520=new TextDecoder(),_0x2b9692='';while(!0x0){let {done:_0x48ed25,value:_0x4d42cd}=await _0x4591a2[_0x4bcf30(0x276)]();if(_0x48ed25)break;_0x2b9692+=_0x3a5520[_0x4bcf30(0x27b)](_0x4d42cd,{'stream':!0x0});let _0x192dea=_0x2b9692[_0x4bcf30(0x271)]('\x0a\x0a');_0x2b9692=_0x192dea[_0x4bcf30(0x25d)]()||'';for(let _0x435941 of _0x192dea){let _0x7a6b68=_0x435941[_0x4bcf30(0x271)]('\x0a')[_0x4bcf30(0x232)](_0x202540=>_0x202540['startsWith'](_0x4bcf30(0x244)));if(!_0x7a6b68)continue;try{let _0x4cc814=JSON[_0x4bcf30(0x214)](_0x7a6b68[_0x4bcf30(0x208)](0x6));await S(_0x4cc814);}catch(_0xa2dca0){Y('parse\x20error:\x20'+_0xa2dca0);}}}Y(_0x4bcf30(0x200));}catch(_0x6b6443){Y('SSE\x20connection\x20error:\x20'+_0x6b6443);}await h(0xbb8);}}async function S(_0x4e35bb){const _0x49471d=a0_0x3e6d72;if(_0x4e35bb[_0x49471d(0x26e)]==='connected'){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x4e35bb['type']==='new_message'){if(Y(_0x49471d(0x26a)+_0x4e35bb[_0x49471d(0x229)]+':\x20'+_0x4e35bb[_0x49471d(0x22f)][_0x49471d(0x208)](0x0,0x3c)),await K[_0x49471d(0x24b)]({'method':_0x49471d(0x21a),'params':{'content':_0x4e35bb[_0x49471d(0x22f)],'meta':{'sender':_0x4e35bb['from']||_0x49471d(0x26f),'sender_id':_0x49471d(0x1f5),'user':_0x4e35bb[_0x49471d(0x229)]||_0x49471d(0x26f),'priority':_0x49471d(0x1f2)}}}),_0x4e35bb[_0x49471d(0x1f4)])await P(_0x49471d(0x248),{'alias':Z,'message_id':_0x4e35bb[_0x49471d(0x1f4)]});return;}if(_0x4e35bb[_0x49471d(0x26e)]==='new_task'||_0x4e35bb[_0x49471d(0x26e)]===_0x49471d(0x20a)){Y('←\x20'+_0x4e35bb[_0x49471d(0x26e)]+_0x49471d(0x27a)+_0x4e35bb[_0x49471d(0x268)]+_0x49471d(0x209)+(_0x4e35bb[_0x49471d(0x216)]||_0x49471d(0x1f2)));let _0x4dfb76=await P(_0x49471d(0x1f6),{'alias':Z,'limit':0x5});if(_0x4dfb76?.['ok']&&_0x4dfb76[_0x49471d(0x221)]?.['length']>0x0)for(let _0x2e7391 of _0x4dfb76[_0x49471d(0x221)]){let _0x25a297={'sender':_0x2e7391[_0x49471d(0x278)]||_0x49471d(0x26f),'sender_id':_0x49471d(0x1f5),'user':_0x2e7391[_0x49471d(0x278)]||_0x49471d(0x26f),'task_id':_0x2e7391['id'],'priority':_0x2e7391['priority']||_0x49471d(0x1f2)};k[_0x49471d(0x260)](_0x2e7391['id'],_0x2e7391[_0x49471d(0x278)]||_0x49471d(0x26f)),await K[_0x49471d(0x24b)]({'method':_0x49471d(0x21a),'params':{'content':_0x2e7391['content'],'meta':_0x25a297}}),Y('→\x20injected\x20task\x20'+_0x2e7391['id'][_0x49471d(0x208)](0x0,0x8)+_0x49471d(0x26c)+_0x2e7391[_0x49471d(0x278)]+':\x20'+_0x2e7391[_0x49471d(0x237)]['slice'](0x0,0x3c)),await P(_0x49471d(0x248),{'alias':Z,'message_id':_0x2e7391['id']});}}}async function A(){const _0x26c037=a0_0x3e6d72;let _0x135164=new a0_0x3e4b81();await K[_0x26c037(0x1fa)](_0x135164),Y(_0x26c037(0x21c)),Y('starting\x20SSE\x20listener...'),u()[_0x26c037(0x239)](_0x327f5c=>Y(_0x26c037(0x22d)+_0x327f5c)),P('report_status',{'resume_id':w,'alias':Z,'status':_0x26c037(0x1fe),'server':a0_0x342df9(),'hostname':a0_0x342df9(),'agent':_0x26c037(0x264),'project_dir':process[_0x26c037(0x256)](),'tmux_name':j||void 0x0})[_0x26c037(0x25a)](()=>Y('registered\x20as\x20\x22'+Z+'\x22\x20('+w[_0x26c037(0x208)](0x0,0x8)+')'))[_0x26c037(0x239)](_0x451235=>Y(_0x26c037(0x204)+_0x451235)),setInterval(()=>{const _0x3c4b2b=_0x26c037;P(_0x3c4b2b(0x25f),{'resume_id':w,'alias':Z,'status':_0x3c4b2b(0x1fe),'server':a0_0x342df9(),'hostname':a0_0x342df9(),'agent':_0x3c4b2b(0x264),'project_dir':process[_0x3c4b2b(0x256)](),'tmux_name':j||void 0x0})[_0x3c4b2b(0x239)](_0x158b16=>Y('heartbeat\x20failed:\x20'+_0x158b16));},0x2bf20),Y(_0x26c037(0x222));}A()[a0_0x3e6d72(0x239)](_0x556b0f=>{const _0x9289cd=a0_0x3e6d72;Y(_0x9289cd(0x274)+_0x556b0f),process['exit'](0x1);});async function N(){const _0x4f64bf=a0_0x3e6d72;Y('shutting\x20down,\x20reporting\x20offline...'),await P(_0x4f64bf(0x25f),{'resume_id':w,'alias':Z,'status':_0x4f64bf(0x273),'task':_0x4f64bf(0x23a)})[_0x4f64bf(0x239)](()=>{}),process[_0x4f64bf(0x259)](0x0);}process[a0_0x3e6d72(0x245)]['on'](a0_0x3e6d72(0x262),()=>N()),process['on'](a0_0x3e6d72(0x1f9),()=>N()),process['on'](a0_0x3e6d72(0x251),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.0.0",
|
|
3
|
+
"version": "2.0.1-preview.0",
|
|
4
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",
|