@sleep2agi/agent-network 2.0.0-preview.30 → 2.0.0-preview.31
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 +3 -2
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x1a01a0=a0_0x16c4;function a0_0x5c64(){const _0x32d7c9=['application/json,\x20text/event-stream','connected','330580LYBoaU','sdk','heartbeat\x20failed:\x20','slice','alias','text','abort','catch','11312DWkZeg','SSE\x20failed:\x20','task','body','replace','11578140KnvFXP','toString','content','text/event-stream','ack_inbox','result','104YHDrkS','offline','new_message','idle','heartbeatInterval','sdk-','1355991IwNcuz','url','1566NTeQdc','getAllStatus','min','token',']\x20[commhub:','/events/','AbortError','sleep','572172gZZhjX','disconnect','registered','Authorization','resumeId','SSE\x20reconnecting\x20in\x20','match','now','connectSSE','application/json','162710sHAnvf','tools/call','name','type','message','heartbeatTimer','messages','processInbox','SSE\x20error:\x20','emit','inbox\x20error:\x20','Bearer\x20','new_task','data:\x20','366483hwwJYs','sseAbort','send','normal','startsWith','decode','running','cwd','disconnected','stringify','pop','getReader','error','server','call','signal','SSE\x20connected','log','parse','get_all_status','agent','2.0','6rSohcN','reconnectDelay','status','read','reply','broadcast'];a0_0x5c64=function(){return _0x32d7c9;};return a0_0x5c64();}(function(_0x360766,_0x21fe94){const _0x3d36ed=a0_0x16c4,_0xb30ae0=_0x360766();while(!![]){try{const _0x458ad=parseInt(_0x3d36ed(0xbd))/0x1+-parseInt(_0x3d36ed(0xb5))/0x2*(-parseInt(_0x3d36ed(0xf8))/0x3)+parseInt(_0x3d36ed(0xd0))/0x4*(parseInt(_0x3d36ed(0xea))/0x5)+parseInt(_0x3d36ed(0xe0))/0x6+parseInt(_0x3d36ed(0xd6))/0x7+-parseInt(_0x3d36ed(0xc5))/0x8*(parseInt(_0x3d36ed(0xd8))/0x9)+-parseInt(_0x3d36ed(0xca))/0xa;if(_0x458ad===_0x21fe94)break;else _0xb30ae0['push'](_0xb30ae0['shift']());}catch(_0x227f6e){_0xb30ae0['push'](_0xb30ae0['shift']());}}}(a0_0x5c64,0x6895c));import{EventEmitter as a0_0xd5e4ef}from'events';function a0_0x16c4(_0x1acac1,_0x4f06ab){_0x1acac1=_0x1acac1-0xb0;const _0x5c646d=a0_0x5c64();let _0x16c4c0=_0x5c646d[_0x1acac1];return _0x16c4c0;}import{hostname as a0_0x2258f5}from'os';class T extends a0_0xd5e4ef{[a0_0x1a01a0(0xd7)];[a0_0x1a01a0(0xc1)];[a0_0x1a01a0(0xdb)];['agent'];[a0_0x1a01a0(0xe4)];['heartbeatInterval'];['reconnectDelay'];['heartbeatTimer'];[a0_0x1a01a0(0xf9)];[a0_0x1a01a0(0xfe)]=!0x1;constructor(_0x4325a3){const _0x1e72aa=a0_0x1a01a0;super();if(this['url']=_0x4325a3[_0x1e72aa(0xd7)][_0x1e72aa(0xc9)](/\/$/,''),this['alias']=_0x4325a3['alias'],this['token']=_0x4325a3[_0x1e72aa(0xdb)],this[_0x1e72aa(0xb3)]=_0x4325a3[_0x1e72aa(0xb3)]||_0x1e72aa(0xbe),this[_0x1e72aa(0xe4)]=_0x1e72aa(0xd5)+_0x4325a3['alias']+'-'+Date[_0x1e72aa(0xe7)]()[_0x1e72aa(0xcb)](0x24),this['heartbeatInterval']=_0x4325a3[_0x1e72aa(0xd4)]??0x2bf20,this[_0x1e72aa(0xb6)]=_0x4325a3[_0x1e72aa(0xb6)]??0xbb8,_0x4325a3['autoConnect']!==!0x1)this['connect']();}['log'](_0x33d25e){const _0x36d8e4=a0_0x1a01a0;console['log']('['+new Date()['toTimeString']()[_0x36d8e4(0xc0)](0x0,0x8)+_0x36d8e4(0xdc)+this[_0x36d8e4(0xc1)]+']\x20'+_0x33d25e);}async[a0_0x1a01a0(0x106)](_0x137713,_0x13d04c){const _0xfd0f66=a0_0x1a01a0;let _0x637e71={'Content-Type':_0xfd0f66(0xe9),'Accept':_0xfd0f66(0xbb)};if(this[_0xfd0f66(0xdb)])_0x637e71[_0xfd0f66(0xe3)]=_0xfd0f66(0xf5)+this[_0xfd0f66(0xdb)];let _0x522e6a=await(await fetch(this[_0xfd0f66(0xd7)]+'/mcp',{'method':'POST','headers':_0x637e71,'body':JSON[_0xfd0f66(0x101)]({'jsonrpc':_0xfd0f66(0xb4),'id':Date['now'](),'method':_0xfd0f66(0xeb),'params':{'name':_0x137713,'arguments':_0x13d04c}})}))[_0xfd0f66(0xc2)](),_0x2f816c=_0x522e6a[_0xfd0f66(0xe6)](/data: (.+)/),_0x35e2be=_0x2f816c?JSON[_0xfd0f66(0xb1)](_0x2f816c[0x1]):JSON[_0xfd0f66(0xb1)](_0x522e6a),_0x14e4b4=_0x35e2be?.[_0xfd0f66(0xcf)]?.[_0xfd0f66(0xcc)]?.[0x0]?.[_0xfd0f66(0xc2)];return _0x14e4b4?JSON[_0xfd0f66(0xb1)](_0x14e4b4):_0x35e2be;}async['connect'](){const _0x149474=a0_0x1a01a0;if(this['running'])return;this[_0x149474(0xfe)]=!0x0,await this[_0x149474(0xb7)](_0x149474(0xd3)),this[_0x149474(0xb0)](_0x149474(0xe2)),this[_0x149474(0xef)]=setInterval(()=>{const _0x5312d2=_0x149474;this[_0x5312d2(0xb7)]('idle')[_0x5312d2(0xc4)](_0x2d74c1=>this['log'](_0x5312d2(0xbf)+_0x2d74c1[_0x5312d2(0xee)]));},this[_0x149474(0xd4)]),this[_0x149474(0xe8)]();}async[a0_0x1a01a0(0xe1)](){const _0x80c26d=a0_0x1a01a0;if(this[_0x80c26d(0xfe)]=!0x1,this[_0x80c26d(0xf9)]?.[_0x80c26d(0xc3)](),this[_0x80c26d(0xef)])clearInterval(this[_0x80c26d(0xef)]);await this[_0x80c26d(0xb7)](_0x80c26d(0xd1))['catch'](()=>{}),this[_0x80c26d(0xb0)]('disconnected');}async[a0_0x1a01a0(0xfa)](_0x5040a7,_0x53259a,_0x2776d5=a0_0x1a01a0(0xfb)){const _0x453827=a0_0x1a01a0;return this[_0x453827(0x106)]('send_task',{'alias':_0x5040a7,'task':_0x53259a,'priority':_0x2776d5,'from_session':this[_0x453827(0xc1)]});}async['message'](_0x16c4fe,_0x9df08a){const _0xc827d6=a0_0x1a01a0;return this[_0xc827d6(0x106)]('send_message',{'alias':_0x16c4fe,'message':_0x9df08a,'from_session':this['alias']});}async[a0_0x1a01a0(0xb9)](_0x58698a,_0x2f9848,_0x3186dd='completed'){const _0x4afe63=a0_0x1a01a0;return this[_0x4afe63(0x106)](_0x4afe63(0xb9),{'task_id':_0x58698a,'text':_0x2f9848,'status':_0x3186dd});}async[a0_0x1a01a0(0xb7)](_0x380ed7,_0x3e0484){const _0x407ce4=a0_0x1a01a0;return this[_0x407ce4(0x106)]('report_status',{'resume_id':this[_0x407ce4(0xe4)],'alias':this[_0x407ce4(0xc1)],'status':_0x380ed7,'server':a0_0x2258f5(),'hostname':a0_0x2258f5(),'agent':this[_0x407ce4(0xb3)],'project_dir':process[_0x407ce4(0xff)](),..._0x3e0484});}async[a0_0x1a01a0(0xd9)](){const _0x5da7a8=a0_0x1a01a0;return this[_0x5da7a8(0x106)](_0x5da7a8(0xb2),{});}async['broadcast'](_0x30f003,_0x2af187){const _0x3b7426=a0_0x1a01a0;return this['call'](_0x3b7426(0xba),{'message':_0x30f003,'filter_server':_0x2af187?.[_0x3b7426(0x105)],'filter_status':_0x2af187?.[_0x3b7426(0xb7)]});}async[a0_0x1a01a0(0xe8)](){const _0x20148c=a0_0x1a01a0;let _0x16a4ac=encodeURIComponent(this[_0x20148c(0xc1)]),_0xfa7987=this[_0x20148c(0xd7)]+_0x20148c(0xdd)+_0x16a4ac,_0x2b39e8=this[_0x20148c(0xb6)];while(this[_0x20148c(0xfe)]){try{this[_0x20148c(0xf9)]=new AbortController();let _0x2a71c0={'Accept':_0x20148c(0xcd)};if(this['token'])_0x2a71c0['Authorization']=_0x20148c(0xf5)+this[_0x20148c(0xdb)];let _0x2bd3d7=await fetch(_0xfa7987,{'headers':_0x2a71c0,'signal':this[_0x20148c(0xf9)][_0x20148c(0x107)]});if(!_0x2bd3d7['ok']||!_0x2bd3d7[_0x20148c(0xc8)]){this[_0x20148c(0xb0)](_0x20148c(0xc6)+_0x2bd3d7[_0x20148c(0xb7)]),await this[_0x20148c(0xdf)](_0x2b39e8),_0x2b39e8=Math[_0x20148c(0xda)](_0x2b39e8*1.5,0xea60);continue;}_0x2b39e8=this[_0x20148c(0xb6)];let _0x4e6d95=_0x2bd3d7['body'][_0x20148c(0x103)](),_0x1c0041=new TextDecoder(),_0x5966c6='';while(this[_0x20148c(0xfe)]){let {done:_0x50db47,value:_0x278563}=await _0x4e6d95[_0x20148c(0xb8)]();if(_0x50db47)break;_0x5966c6+=_0x1c0041[_0x20148c(0xfd)](_0x278563,{'stream':!0x0});let _0x3805a2=_0x5966c6['split']('\x0a');_0x5966c6=_0x3805a2[_0x20148c(0x102)]()||'';for(let _0x4f5a46 of _0x3805a2){if(!_0x4f5a46[_0x20148c(0xfc)](_0x20148c(0xf7)))continue;try{let _0x4bcb25=JSON['parse'](_0x4f5a46[_0x20148c(0xc0)](0x6));if(_0x4bcb25['type']===_0x20148c(0xbc)){this[_0x20148c(0xb0)](_0x20148c(0x108)),this[_0x20148c(0xf3)]('connected');continue;}if(_0x4bcb25[_0x20148c(0xed)]===_0x20148c(0xf6)||_0x4bcb25[_0x20148c(0xed)]===_0x20148c(0xd2)||_0x4bcb25[_0x20148c(0xed)]===_0x20148c(0xba))await this['processInbox']();}catch{}}}}catch(_0x21d9ed){if(_0x21d9ed[_0x20148c(0xec)]===_0x20148c(0xde))break;this['emit'](_0x20148c(0x104),_0x21d9ed),this[_0x20148c(0xb0)](_0x20148c(0xf2)+_0x21d9ed['message']);}if(this[_0x20148c(0xfe)])this['emit'](_0x20148c(0x100)),this[_0x20148c(0xb0)](_0x20148c(0xe5)+_0x2b39e8/0x3e8+'s...'),await this['sleep'](_0x2b39e8),_0x2b39e8=Math[_0x20148c(0xda)](_0x2b39e8*1.5,0xea60);}}async[a0_0x1a01a0(0xf1)](){const _0xa5126f=a0_0x1a01a0;try{let _0x14d376=(await this[_0xa5126f(0x106)]('get_inbox',{'alias':this[_0xa5126f(0xc1)],'limit':0xa}))?.[_0xa5126f(0xf0)]||[];for(let _0x243590 of _0x14d376)await this[_0xa5126f(0x106)](_0xa5126f(0xce),{'alias':this['alias'],'message_id':_0x243590['id']}),this[_0xa5126f(0xb0)]('←\x20'+_0x243590['from_session']+':\x20'+_0x243590['content']['slice'](0x0,0x3c)),this['emit'](_0xa5126f(0xc7),_0x243590),this[_0xa5126f(0xf3)]('message',_0x243590);}catch(_0x154986){this[_0xa5126f(0xb0)](_0xa5126f(0xf4)+_0x154986[_0xa5126f(0xee)]);}}[a0_0x1a01a0(0xdf)](_0x209e13){return new Promise(_0x372837=>setTimeout(_0x372837,_0x209e13));}}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_0x239b19=a0_0x1a81;(function(_0x3bce52,_0x46a7f7){const _0xb3864f=a0_0x1a81,_0x5bd95b=_0x3bce52();while(!![]){try{const _0x3fbb6d=-parseInt(_0xb3864f(0xd6))/0x1*(parseInt(_0xb3864f(0xc0))/0x2)+parseInt(_0xb3864f(0xd5))/0x3+parseInt(_0xb3864f(0x13e))/0x4*(-parseInt(_0xb3864f(0xd8))/0x5)+-parseInt(_0xb3864f(0xf0))/0x6+parseInt(_0xb3864f(0xdd))/0x7*(-parseInt(_0xb3864f(0xd1))/0x8)+-parseInt(_0xb3864f(0x105))/0x9*(-parseInt(_0xb3864f(0x13b))/0xa)+parseInt(_0xb3864f(0x13a))/0xb;if(_0x3fbb6d===_0x46a7f7)break;else _0x5bd95b['push'](_0x5bd95b['shift']());}catch(_0x422f6f){_0x5bd95b['push'](_0x5bd95b['shift']());}}}(a0_0x34b4,0xe35cb));import{readFileSync as a0_0x1a9e50,existsSync as a0_0x10d940}from'fs';import{join as a0_0x4f5619}from'path';import{hostname as a0_0x48ba90}from'os';import{execSync as a0_0x10e8dd}from'child_process';function a0_0x34b4(){const _0x490367=['connecting\x20to\x20','fatal:\x20','.env','result','trim','connect','send_message','/events/','tmux\x20display-message\x20-p\x20\x27#S\x27','completed','get_all_status','notification','error','commhub_report_status','end','commhub_reply','SSE\x20fatal:\x20','Task\x20content','tools/call','string','catch','commhub_get_all_status','commhub_send_message','decode','report_status','pop','messages','in_progress','setRequestHandler','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','→\x20injected\x20task\x20','SIGTERM','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','28637466kpaetN','1060qANdPk','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','commhub-channel','844dRAydr','set','priority','alias','normal','idle','Target\x20session\x20alias','.claude/channels/commhub','message_id','\x20ALIAS=','initialize','SSE\x20stream\x20ended,\x20reconnecting...','336406VPlDRD',':\x20inbox_count=','0.3.0','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','notifications/claude/channel','getReader','length','new_task','Session\x20alias:\x20','cwd','Reply\x20text\x20/\x20result\x20summary','application/json,\x20text/event-stream','ack_inbox','from_session','Priority\x20(default:\x20normal)','slice','56LOXOmZ','statusText','message','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','3163110KLJtlh','9aOvRCc','params','15175SgczTH','token','claude-code','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','stringify','1684837jaeLtn','SSE\x20connected\x20as\x20\x22','\x20from\x20','text','exit','find','2.0','CommHub\x20init\x20failed:\x20','body','broadcast','toTimeString','\x20CWD=','...\x20TMUX=','startsWith','connected','blocked','stderr','high','split','446640OeQZPi','stdin','from','parse','send_task','content','Bearer\x20','failed','application/json','commhub','←\x20message\x20from\x20','heartbeat\x20failed:\x20','inbox_count','session\x20disconnected','object','then','write','join','randomUUID','unknown\x20tool','status','100782hTEqGp','type','hub','SIGINT','utf-8','POST','init\x20failed:\x20','registered\x20as\x20\x22','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','data:\x20','commhub_send_task','Current\x20task\x20description','\x20PROJECT_ENV=','working','/mcp','replied','cancelled',']\x20[commhub]\x20','ENV:\x20URL=','.anet'];a0_0x34b4=function(){return _0x490367;};return a0_0x34b4();}import{Server as a0_0xc2fee7}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x599eed}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x3fabd6,CallToolRequestSchema as a0_0x5a4302}from'@modelcontextprotocol/sdk/types.js';function p(_0x3e6cab){const _0x2dfa49=a0_0x1a81;if(!a0_0x10d940(_0x3e6cab))return;for(let _0x549728 of a0_0x1a9e50(_0x3e6cab,_0x2dfa49(0x109))[_0x2dfa49(0xef)]('\x0a')){let _0x314e8f=_0x549728[_0x2dfa49(0x11d)]();if(!_0x314e8f||_0x314e8f[_0x2dfa49(0xea)]('#'))continue;let _0x1bc2f6=_0x314e8f['indexOf']('=');if(_0x1bc2f6<0x0)continue;let _0x3a3ea2=_0x314e8f[_0x2dfa49(0xd0)](0x0,_0x1bc2f6)[_0x2dfa49(0x11d)](),_0x26355d=_0x314e8f[_0x2dfa49(0xd0)](_0x1bc2f6+0x1)['trim']()['replace'](/^["']|["']$/g,'');if(!process.env[_0x3a3ea2])process.env[_0x3a3ea2]=_0x26355d;}}var C=process.env.HOME||'~',T=a0_0x4f5619(C,a0_0x239b19(0xbb));p(a0_0x4f5619(T,a0_0x239b19(0x11b)));var L=process[a0_0x239b19(0xca)]()['replace'](/\//g,'-');p(a0_0x4f5619(T,L,a0_0x239b19(0x11b)));function U(){const _0x1ce8ad=a0_0x239b19;try{return a0_0x10e8dd(_0x1ce8ad(0x121),{'encoding':_0x1ce8ad(0x109),'timeout':0x7d0})[_0x1ce8ad(0x11d)]();}catch{return'';}}function c(){const _0x3bd8e1=a0_0x239b19;try{let _0xca245a=a0_0x4f5619(C,_0x3bd8e1(0x118),'config.json');if(a0_0x10d940(_0xca245a))return JSON[_0x3bd8e1(0xf3)](a0_0x1a9e50(_0xca245a,'utf-8'));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H['hub']||'http://127.0.0.1:9200',f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x48ba90(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x239b19(0x102)](),X=process.env.COMMHUB_TOKEN||H[a0_0x239b19(0xd9)]||'';function Y(_0x2187ab){const _0x5fb7c4=a0_0x239b19;let _0x3f5abc=new Date()[_0x5fb7c4(0xe7)]()[_0x5fb7c4(0xd0)](0x0,0x8);process[_0x5fb7c4(0xed)][_0x5fb7c4(0x100)]('['+_0x3f5abc+_0x5fb7c4(0x116)+_0x2187ab+'\x0a');}function h(_0x2eb89d){return new Promise(_0x5d3f55=>setTimeout(_0x5d3f55,_0x2eb89d));}Y(a0_0x239b19(0x117)+D+a0_0x239b19(0xbd)+Z+'\x20RESUME_ID='+w[a0_0x239b19(0xd0)](0x0,0x8)+a0_0x239b19(0xe9)+(f||'none')+a0_0x239b19(0xe8)+process[a0_0x239b19(0xca)]()+a0_0x239b19(0x111)+L);var k=new Map(),K=new a0_0xc2fee7({'name':a0_0x239b19(0x13d),'version':a0_0x239b19(0xc2)},{'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_0x239b19(0x10d),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x239b19(0x136),a0_0x239b19(0xc9)+Z][a0_0x239b19(0x101)]('\x0a')});K['setRequestHandler'](a0_0x3fabd6,async()=>({'tools':[{'name':a0_0x239b19(0x128),'description':a0_0x239b19(0x13c),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x239b19(0x12c),'description':a0_0x239b19(0xd4)},'text':{'type':a0_0x239b19(0x12c),'description':a0_0x239b19(0xcb)},'status':{'type':a0_0x239b19(0x12c),'enum':['completed','failed','cancelled',a0_0x239b19(0xec),a0_0x239b19(0x125),a0_0x239b19(0x134)],'description':a0_0x239b19(0xdb)}},'required':[a0_0x239b19(0xe0)]}},{'name':a0_0x239b19(0x126),'description':a0_0x239b19(0xc4),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x239b19(0x12c),'enum':[a0_0x239b19(0x112),a0_0x239b19(0xb9),a0_0x239b19(0xec),'error']},'task':{'type':'string','description':a0_0x239b19(0x110)},'progress':{'type':'number','description':'Progress\x200-100'}},'required':[a0_0x239b19(0x104)]}},{'name':'commhub_send_task','description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x239b19(0x12c),'description':a0_0x239b19(0xba)},'task':{'type':a0_0x239b19(0x12c),'description':a0_0x239b19(0x12a)},'priority':{'type':a0_0x239b19(0x12c),'enum':[a0_0x239b19(0xee),a0_0x239b19(0x142),'low'],'description':a0_0x239b19(0xcf)}},'required':[a0_0x239b19(0x141),'task']}},{'name':a0_0x239b19(0x12f),'description':a0_0x239b19(0xc3),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x239b19(0x12c),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x239b19(0x12c),'description':'Message\x20content'}},'required':[a0_0x239b19(0x141),a0_0x239b19(0xd3)]}},{'name':'commhub_get_all_status','description':a0_0x239b19(0x139),'inputSchema':{'type':a0_0x239b19(0xfe),'properties':{}}}]}));async function P(_0x325294,_0x351bed){const _0x1f6eef=a0_0x239b19;let _0x2ce689=await fetch(D+_0x1f6eef(0x113),{'method':'POST','headers':{'Content-Type':_0x1f6eef(0xf8),'Accept':_0x1f6eef(0xcc),...X?{'Authorization':_0x1f6eef(0xf6)+X}:{}},'body':JSON[_0x1f6eef(0xdc)]({'jsonrpc':_0x1f6eef(0xe3),'id':0x1,'method':_0x1f6eef(0xbe),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x1f6eef(0x13d),'version':'0.3.0'}}})});if(!_0x2ce689['ok']){let _0x46c86e=await _0x2ce689[_0x1f6eef(0xe0)]();return Y(_0x1f6eef(0xe4)+_0x2ce689[_0x1f6eef(0x104)]+'\x20'+_0x46c86e[_0x1f6eef(0xd0)](0x0,0x64)),{'ok':!0x1,'error':_0x1f6eef(0x10b)+_0x2ce689[_0x1f6eef(0x104)]};}await _0x2ce689[_0x1f6eef(0xe0)]();let _0x4eeea1=(await(await fetch(D+'/mcp',{'method':_0x1f6eef(0x10a),'headers':{'Content-Type':_0x1f6eef(0xf8),'Accept':_0x1f6eef(0xcc),...X?{'Authorization':_0x1f6eef(0xf6)+X}:{}},'body':JSON[_0x1f6eef(0xdc)]({'jsonrpc':'2.0','id':0x2,'method':_0x1f6eef(0x12b),'params':{'name':_0x325294,'arguments':_0x351bed}})}))[_0x1f6eef(0xe0)]())['split']('\x0a')[_0x1f6eef(0xe2)](_0x39dd72=>_0x39dd72[_0x1f6eef(0xea)](_0x1f6eef(0x10e)));if(_0x4eeea1){let _0xecb86f=JSON['parse'](_0x4eeea1[_0x1f6eef(0xd0)](0x6));return _0xecb86f?.['result']?.[_0x1f6eef(0xf5)]?.[0x0]?.['text']?JSON[_0x1f6eef(0xf3)](_0xecb86f[_0x1f6eef(0x11c)][_0x1f6eef(0xf5)][0x0][_0x1f6eef(0xe0)]):_0xecb86f;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x239b19(0x135)](a0_0x5a4302,async _0x57cff7=>{const _0x584d0b=a0_0x239b19;let {name:_0x436870,arguments:_0x2ff1af}=_0x57cff7[_0x584d0b(0xd7)];if(_0x436870===_0x584d0b(0x128)){let {task_id:_0x1aaddd,text:_0x779adf,status:_0x10c7fc}=_0x2ff1af;if(_0x10c7fc==='completed'||_0x10c7fc===_0x584d0b(0xf7)||_0x10c7fc===_0x584d0b(0x115)){let _0x3803bd=_0x10c7fc===_0x584d0b(0x122)?_0x584d0b(0x114):_0x10c7fc,_0x435e1d=_0x1aaddd?k['get'](_0x1aaddd)||_0x584d0b(0x107):'hub',_0x382a76=await P('send_reply',{'alias':_0x435e1d,'text':_0x779adf,'in_reply_to':_0x1aaddd||void 0x0,'status':_0x3803bd,'from_session':Z});if(_0x1aaddd)k['delete'](_0x1aaddd);return{'content':[{'type':_0x584d0b(0xe0),'text':JSON[_0x584d0b(0xdc)](_0x382a76)}]};}let _0x2ccc10=await P(_0x584d0b(0x131),{'resume_id':w,'alias':Z,'status':_0x10c7fc===_0x584d0b(0xec)?_0x584d0b(0xec):_0x10c7fc===_0x584d0b(0x125)?_0x584d0b(0x125):_0x584d0b(0x112),'task':_0x779adf[_0x584d0b(0xd0)](0x0,0xc8),'output':_0x779adf});return{'content':[{'type':_0x584d0b(0xe0),'text':JSON[_0x584d0b(0xdc)](_0x2ccc10)}]};}if(_0x436870===_0x584d0b(0x126)){let {status:_0x4f7ae7,task:_0x265cc2,progress:_0x55b481}=_0x2ff1af,_0x31d811=await P(_0x584d0b(0x131),{'resume_id':w,'alias':Z,'status':_0x4f7ae7,'task':_0x265cc2,'progress':_0x55b481});return{'content':[{'type':'text','text':JSON[_0x584d0b(0xdc)](_0x31d811)}]};}if(_0x436870===_0x584d0b(0x10f)){let {alias:_0x55fd4d,task:_0x46707d,priority:_0x11b6ee}=_0x2ff1af,_0x44328a=await P(_0x584d0b(0xf4),{'alias':_0x55fd4d,'task':_0x46707d,'priority':_0x11b6ee||_0x584d0b(0x142),'from_session':Z});return{'content':[{'type':_0x584d0b(0xe0),'text':JSON[_0x584d0b(0xdc)](_0x44328a)}]};}if(_0x436870===_0x584d0b(0x12f)){let {alias:_0x58c5a7,message:_0x3d0f21}=_0x2ff1af,_0x2ccf6a=await P(_0x584d0b(0x11f),{'alias':_0x58c5a7,'message':_0x3d0f21,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x584d0b(0xdc)](_0x2ccf6a)}]};}if(_0x436870===_0x584d0b(0x12e)){let _0x4f61ba=await P(_0x584d0b(0x123),{});return{'content':[{'type':_0x584d0b(0xe0),'text':JSON['stringify'](_0x4f61ba)}]};}return{'content':[{'type':_0x584d0b(0xe0),'text':JSON['stringify']({'error':_0x584d0b(0x103)})}]};});async function v(){const _0x1f049e=a0_0x239b19;let _0x29aa19=D+_0x1f049e(0x120)+encodeURIComponent(Z),_0x27ccf9={};if(X)_0x27ccf9['Authorization']=_0x1f049e(0xf6)+X;Y(_0x1f049e(0x119)+_0x29aa19);while(!0x0){try{let _0x2371de=await fetch(_0x29aa19,{'headers':_0x27ccf9});if(!_0x2371de['ok']){Y('SSE\x20error:\x20'+_0x2371de[_0x1f049e(0x104)]+'\x20'+_0x2371de[_0x1f049e(0xd2)]),await h(0x1388);continue;}let _0x40ce95=_0x2371de[_0x1f049e(0xe5)][_0x1f049e(0xc6)](),_0x582d80=new TextDecoder(),_0x1d7d04='';while(!0x0){let {done:_0x25200f,value:_0x4c5f58}=await _0x40ce95['read']();if(_0x25200f)break;_0x1d7d04+=_0x582d80[_0x1f049e(0x130)](_0x4c5f58,{'stream':!0x0});let _0x5c9f15=_0x1d7d04[_0x1f049e(0xef)]('\x0a\x0a');_0x1d7d04=_0x5c9f15[_0x1f049e(0x132)]()||'';for(let _0x100f36 of _0x5c9f15){let _0x54f162=_0x100f36['split']('\x0a')['find'](_0x16c843=>_0x16c843[_0x1f049e(0xea)](_0x1f049e(0x10e)));if(!_0x54f162)continue;try{let _0x12e259=JSON[_0x1f049e(0xf3)](_0x54f162[_0x1f049e(0xd0)](0x6));await u(_0x12e259);}catch(_0x530e8e){Y('parse\x20error:\x20'+_0x530e8e);}}}Y(_0x1f049e(0xbf));}catch(_0x101a95){Y('SSE\x20connection\x20error:\x20'+_0x101a95);}await h(0xbb8);}}async function u(_0x56fa0f){const _0x4d24ea=a0_0x239b19;if(_0x56fa0f[_0x4d24ea(0x106)]===_0x4d24ea(0xeb)){Y(_0x4d24ea(0xde)+Z+'\x22');return;}if(_0x56fa0f[_0x4d24ea(0x106)]==='new_message'){if(Y(_0x4d24ea(0xfa)+_0x56fa0f[_0x4d24ea(0xf2)]+':\x20'+_0x56fa0f[_0x4d24ea(0xd3)][_0x4d24ea(0xd0)](0x0,0x3c)),await K['notification']({'method':'notifications/claude/channel','params':{'content':_0x56fa0f['message'],'meta':{'sender':_0x56fa0f[_0x4d24ea(0xf2)]||_0x4d24ea(0x107),'sender_id':_0x4d24ea(0xf9),'user':_0x56fa0f[_0x4d24ea(0xf2)]||_0x4d24ea(0x107),'priority':'normal'}}}),_0x56fa0f[_0x4d24ea(0xbc)])await P('ack_inbox',{'alias':Z,'message_id':_0x56fa0f['message_id']});return;}if(_0x56fa0f[_0x4d24ea(0x106)]===_0x4d24ea(0xc8)||_0x56fa0f[_0x4d24ea(0x106)]===_0x4d24ea(0xe6)){Y('←\x20'+_0x56fa0f['type']+_0x4d24ea(0xc1)+_0x56fa0f[_0x4d24ea(0xfc)]+'\x20priority='+(_0x56fa0f[_0x4d24ea(0x140)]||_0x4d24ea(0x142)));let _0x1374be=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x1374be?.['ok']&&_0x1374be['messages']?.[_0x4d24ea(0xc7)]>0x0)for(let _0x2699b9 of _0x1374be[_0x4d24ea(0x133)]){let _0x4604b1={'sender':_0x2699b9[_0x4d24ea(0xce)]||_0x4d24ea(0x107),'sender_id':_0x4d24ea(0xf9),'user':_0x2699b9[_0x4d24ea(0xce)]||_0x4d24ea(0x107),'task_id':_0x2699b9['id'],'priority':_0x2699b9[_0x4d24ea(0x140)]||'normal'};k[_0x4d24ea(0x13f)](_0x2699b9['id'],_0x2699b9['from_session']||_0x4d24ea(0x107)),await K[_0x4d24ea(0x124)]({'method':_0x4d24ea(0xc5),'params':{'content':_0x2699b9[_0x4d24ea(0xf5)],'meta':_0x4604b1}}),Y(_0x4d24ea(0x137)+_0x2699b9['id'][_0x4d24ea(0xd0)](0x0,0x8)+_0x4d24ea(0xdf)+_0x2699b9[_0x4d24ea(0xce)]+':\x20'+_0x2699b9[_0x4d24ea(0xf5)][_0x4d24ea(0xd0)](0x0,0x3c)),await P(_0x4d24ea(0xcd),{'alias':Z,'message_id':_0x2699b9['id']});}}}function a0_0x1a81(_0x417f42,_0x6a7122){_0x417f42=_0x417f42-0xb9;const _0x34b415=a0_0x34b4();let _0x1a81ed=_0x34b415[_0x417f42];return _0x1a81ed;}async function S(){const _0x49b202=a0_0x239b19;let _0x1f21e4=new a0_0x599eed();await K[_0x49b202(0x11e)](_0x1f21e4),Y('MCP\x20stdio\x20connected'),Y('starting\x20SSE\x20listener...'),v()[_0x49b202(0x12d)](_0x3cd4c4=>Y(_0x49b202(0x129)+_0x3cd4c4)),P('report_status',{'resume_id':w,'alias':Z,'status':_0x49b202(0xb9),'server':a0_0x48ba90(),'hostname':a0_0x48ba90(),'agent':_0x49b202(0xda),'project_dir':process[_0x49b202(0xca)](),'tmux_name':f||void 0x0})[_0x49b202(0xff)](()=>Y(_0x49b202(0x10c)+Z+'\x22\x20('+w[_0x49b202(0xd0)](0x0,0x8)+')'))[_0x49b202(0x12d)](_0x1918a3=>Y('warning:\x20could\x20not\x20register:\x20'+_0x1918a3)),setInterval(()=>{const _0x31ab97=_0x49b202;P(_0x31ab97(0x131),{'resume_id':w,'alias':Z,'status':_0x31ab97(0xb9),'server':a0_0x48ba90(),'hostname':a0_0x48ba90(),'agent':_0x31ab97(0xda),'project_dir':process[_0x31ab97(0xca)](),'tmux_name':f||void 0x0})[_0x31ab97(0x12d)](_0x2fea86=>Y(_0x31ab97(0xfb)+_0x2fea86));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}S()[a0_0x239b19(0x12d)](_0xb825e9=>{const _0x4963a7=a0_0x239b19;Y(_0x4963a7(0x11a)+_0xb825e9),process[_0x4963a7(0xe1)](0x1);});async function N(){const _0x48ad11=a0_0x239b19;Y('shutting\x20down,\x20reporting\x20offline...'),await P(_0x48ad11(0x131),{'resume_id':w,'alias':Z,'status':_0x48ad11(0x125),'task':_0x48ad11(0xfd)})[_0x48ad11(0x12d)](()=>{}),process['exit'](0x0);}process[a0_0x239b19(0xf1)]['on'](a0_0x239b19(0x127),()=>N()),process['on'](a0_0x239b19(0x138),()=>N()),process['on'](a0_0x239b19(0x108),()=>N());
|
|
2
|
+
const a0_0x1c5c73=a0_0x5c62;(function(_0x40b4ec,_0x3694ef){const _0x45b717=a0_0x5c62,_0x3aedd4=_0x40b4ec();while(!![]){try{const _0x1216b4=-parseInt(_0x45b717(0xdd))/0x1*(-parseInt(_0x45b717(0xdb))/0x2)+parseInt(_0x45b717(0xb5))/0x3*(parseInt(_0x45b717(0xef))/0x4)+parseInt(_0x45b717(0xf6))/0x5+parseInt(_0x45b717(0xe7))/0x6+parseInt(_0x45b717(0xe2))/0x7+-parseInt(_0x45b717(0xb8))/0x8*(-parseInt(_0x45b717(0x119))/0x9)+-parseInt(_0x45b717(0xcb))/0xa*(parseInt(_0x45b717(0x113))/0xb);if(_0x1216b4===_0x3694ef)break;else _0x3aedd4['push'](_0x3aedd4['shift']());}catch(_0x4a4b51){_0x3aedd4['push'](_0x3aedd4['shift']());}}}(a0_0x1b1e,0xaaab6));import{readFileSync as a0_0x143322,existsSync as a0_0x16109e}from'fs';import{join as a0_0x5a5ae2}from'path';import{hostname as a0_0xcb044c}from'os';import{execSync as a0_0x472028}from'child_process';import{Server as a0_0x3c04e5}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x19c310}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x502a85,CallToolRequestSchema as a0_0x23731f}from'@modelcontextprotocol/sdk/types.js';function p(_0x3179ef){const _0xfd988e=a0_0x5c62;if(!a0_0x16109e(_0x3179ef))return;for(let _0x28c320 of a0_0x143322(_0x3179ef,'utf-8')[_0xfd988e(0x12a)]('\x0a')){let _0x125a5a=_0x28c320['trim']();if(!_0x125a5a||_0x125a5a['startsWith']('#'))continue;let _0x230d25=_0x125a5a['indexOf']('=');if(_0x230d25<0x0)continue;let _0x59b2f0=_0x125a5a[_0xfd988e(0xab)](0x0,_0x230d25)[_0xfd988e(0xaa)](),_0x39a6f3=_0x125a5a['slice'](_0x230d25+0x1)['trim']()[_0xfd988e(0x11a)](/^["']|["']$/g,'');if(!process.env[_0x59b2f0])process.env[_0x59b2f0]=_0x39a6f3;}}var C=process.env.HOME||'~',T=a0_0x5a5ae2(C,a0_0x1c5c73(0xb3));p(a0_0x5a5ae2(T,'.env'));var L=process[a0_0x1c5c73(0x10d)]()['replace'](/\//g,'-');p(a0_0x5a5ae2(T,L,a0_0x1c5c73(0xed)));function U(){const _0x734170=a0_0x1c5c73;try{return a0_0x472028(_0x734170(0xbd),{'encoding':_0x734170(0xfb),'timeout':0x7d0})[_0x734170(0xaa)]();}catch{return'';}}function c(){const _0x3642b7=a0_0x1c5c73;try{let _0x3c9f4e=a0_0x5a5ae2(C,'.anet','config.json');if(a0_0x16109e(_0x3c9f4e))return JSON[_0x3642b7(0xfe)](a0_0x143322(_0x3c9f4e,_0x3642b7(0xfb)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x1c5c73(0xd8)]||'http://127.0.0.1:9200',f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0xcb044c(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x1c5c73(0xad)](),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x94788d){const _0x838e12=a0_0x1c5c73;let _0x6443d7=new Date()[_0x838e12(0xc2)]()[_0x838e12(0xab)](0x0,0x8);process[_0x838e12(0x125)][_0x838e12(0xd6)]('['+_0x6443d7+']\x20[commhub]\x20'+_0x94788d+'\x0a');}function h(_0x5ef533){return new Promise(_0x1c9dad=>setTimeout(_0x1c9dad,_0x5ef533));}Y(a0_0x1c5c73(0x12b)+D+a0_0x1c5c73(0xaf)+Z+'\x20RESUME_ID='+w[a0_0x1c5c73(0xab)](0x0,0x8)+'...\x20TMUX='+(f||a0_0x1c5c73(0x12e))+a0_0x1c5c73(0x122)+process[a0_0x1c5c73(0x10d)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x3c04e5({'name':a0_0x1c5c73(0x112),'version':a0_0x1c5c73(0xf0)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x1c5c73(0xe0),a0_0x1c5c73(0xde),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x1c5c73(0xc4)+Z][a0_0x1c5c73(0xee)]('\x0a')});function a0_0x5c62(_0x2b4896,_0x692b94){_0x2b4896=_0x2b4896-0xa9;const _0x1b1ec=a0_0x1b1e();let _0x5c6227=_0x1b1ec[_0x2b4896];return _0x5c6227;}K['setRequestHandler'](a0_0x502a85,async()=>({'tools':[{'name':a0_0x1c5c73(0x11d),'description':a0_0x1c5c73(0x11c),'inputSchema':{'type':a0_0x1c5c73(0x11f),'properties':{'task_id':{'type':'string','description':a0_0x1c5c73(0x12d)},'text':{'type':a0_0x1c5c73(0xe4),'description':a0_0x1c5c73(0xd4)},'status':{'type':a0_0x1c5c73(0xe4),'enum':[a0_0x1c5c73(0xc5),a0_0x1c5c73(0xb0),a0_0x1c5c73(0x10c),a0_0x1c5c73(0xf5),a0_0x1c5c73(0xf1),a0_0x1c5c73(0x117)],'description':a0_0x1c5c73(0x114)}},'required':['text']}},{'name':a0_0x1c5c73(0x129),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x1c5c73(0x11f),'properties':{'status':{'type':a0_0x1c5c73(0xe4),'enum':['working','idle','blocked',a0_0x1c5c73(0xf1)]},'task':{'type':a0_0x1c5c73(0xe4),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x1c5c73(0xcd),'description':'Progress\x200-100'}},'required':[a0_0x1c5c73(0x105)]}},{'name':a0_0x1c5c73(0x11e),'description':a0_0x1c5c73(0x10b),'inputSchema':{'type':a0_0x1c5c73(0x11f),'properties':{'alias':{'type':a0_0x1c5c73(0xe4),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x1c5c73(0xe4),'description':a0_0x1c5c73(0x110)},'priority':{'type':a0_0x1c5c73(0xe4),'enum':[a0_0x1c5c73(0x104),a0_0x1c5c73(0xca),'low'],'description':a0_0x1c5c73(0x10e)}},'required':[a0_0x1c5c73(0xeb),'task']}},{'name':a0_0x1c5c73(0xf7),'description':a0_0x1c5c73(0x131),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x1c5c73(0xe4),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x1c5c73(0xe4),'description':a0_0x1c5c73(0xf4)}},'required':[a0_0x1c5c73(0xeb),'message']}},{'name':a0_0x1c5c73(0xf2),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x1c5c73(0x11f),'properties':{}}}]}));function a0_0x1b1e(){const _0x8a7701=['tools/call','message_id','\x20priority=','utf-8','replied','SIGTERM','parse','message','length','ack_inbox','notification','send_message','high','status','data:\x20','SSE\x20fatal:\x20','read','idle','new_message','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','cancelled','cwd','Priority\x20(default:\x20normal)','send_task','Task\x20content','type','commhub-channel','22JqnczC','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','body','connecting\x20to\x20','in_progress','fatal:\x20','464985kbHGsh','replace','SIGINT','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','commhub_reply','commhub_send_task','object','decode','initialize','\x20CWD=','params',':\x20inbox_count=','stderr','text','application/json,\x20text/event-stream','stdin','commhub_report_status','split','ENV:\x20URL=','inbox_count','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','none','startsWith','exit','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','Bearer\x20','setRequestHandler','result','trim','slice','connect','randomUUID','registered\x20as\x20\x22','\x20ALIAS=','failed','SSE\x20error:\x20','stringify','.claude/channels/commhub','starting\x20SSE\x20listener...','101967uDrTgf','SSE\x20connected\x20as\x20\x22','application/json','104eRYdmF','messages','get_all_status','2025-03-26','commhub','tmux\x20display-message\x20-p\x20\x27#S\x27','→\x20injected\x20task\x20','priority','heartbeat\x20failed:\x20','from','toTimeString','POST','Session\x20alias:\x20','completed','then','\x22\x20(','statusText','pop','normal','14208790Zdibmq','session\x20disconnected','number','from_session','warning:\x20could\x20not\x20register:\x20','/mcp','content','CommHub\x20init\x20failed:\x20','notifications/claude/channel','Reply\x20text\x20/\x20result\x20summary','MCP\x20stdio\x20connected','write','set','hub','report_status','new_task','2786NQjFMk','catch','243tjFxyF','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','\x20from\x20','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','claude-code','4764725nDdGWe','delete','string','parse\x20error:\x20','ready\x20—\x20waiting\x20for\x20events','7964178xyVQDE','unknown\x20tool','no\x20response','working','alias','/events/','.env','join','44YSXDrO','0.3.0','error','commhub_get_all_status','find','Message\x20content','blocked','743795TrLfeb','commhub_send_message'];a0_0x1b1e=function(){return _0x8a7701;};return a0_0x1b1e();}async function P(_0x11f9be,_0x10faf7){const _0x4aa9d9=a0_0x1c5c73;let _0x161d8a=await fetch(D+_0x4aa9d9(0xd0),{'method':_0x4aa9d9(0xc3),'headers':{'Content-Type':_0x4aa9d9(0xb7),'Accept':_0x4aa9d9(0x127),...X?{'Authorization':_0x4aa9d9(0x132)+X}:{}},'body':JSON[_0x4aa9d9(0xb2)]({'jsonrpc':'2.0','id':0x1,'method':_0x4aa9d9(0x121),'params':{'protocolVersion':_0x4aa9d9(0xbb),'capabilities':{},'clientInfo':{'name':_0x4aa9d9(0x112),'version':_0x4aa9d9(0xf0)}}})});if(!_0x161d8a['ok']){let _0x4d0f9a=await _0x161d8a[_0x4aa9d9(0x126)]();return Y(_0x4aa9d9(0xd2)+_0x161d8a[_0x4aa9d9(0x105)]+'\x20'+_0x4d0f9a[_0x4aa9d9(0xab)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x161d8a[_0x4aa9d9(0x105)]};}await _0x161d8a[_0x4aa9d9(0x126)]();let _0x1c7ee3=(await(await fetch(D+'/mcp',{'method':_0x4aa9d9(0xc3),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x4aa9d9(0x132)+X}:{}},'body':JSON[_0x4aa9d9(0xb2)]({'jsonrpc':'2.0','id':0x2,'method':_0x4aa9d9(0xf8),'params':{'name':_0x11f9be,'arguments':_0x10faf7}})}))[_0x4aa9d9(0x126)]())['split']('\x0a')[_0x4aa9d9(0xf3)](_0x56b94b=>_0x56b94b[_0x4aa9d9(0x12f)](_0x4aa9d9(0x106)));if(_0x1c7ee3){let _0x2f2c26=JSON['parse'](_0x1c7ee3[_0x4aa9d9(0xab)](0x6));return _0x2f2c26?.['result']?.[_0x4aa9d9(0xd1)]?.[0x0]?.[_0x4aa9d9(0x126)]?JSON[_0x4aa9d9(0xfe)](_0x2f2c26[_0x4aa9d9(0xa9)][_0x4aa9d9(0xd1)][0x0][_0x4aa9d9(0x126)]):_0x2f2c26;}return{'ok':!0x1,'error':_0x4aa9d9(0xe9)};}K[a0_0x1c5c73(0x133)](a0_0x23731f,async _0x8b7e1f=>{const _0x555884=a0_0x1c5c73;let {name:_0xe74226,arguments:_0x477034}=_0x8b7e1f[_0x555884(0x123)];if(_0xe74226===_0x555884(0x11d)){let {task_id:_0x1f5090,text:_0x2a826b,status:_0x34459d}=_0x477034;if(_0x34459d===_0x555884(0xc5)||_0x34459d==='failed'||_0x34459d==='cancelled'){let _0x2f0641=_0x34459d===_0x555884(0xc5)?_0x555884(0xfc):_0x34459d,_0x528280=_0x1f5090?k['get'](_0x1f5090)||_0x555884(0xd8):_0x555884(0xd8),_0x44e3a3=await P('send_reply',{'alias':_0x528280,'text':_0x2a826b,'in_reply_to':_0x1f5090||void 0x0,'status':_0x2f0641,'from_session':Z});if(_0x1f5090)k[_0x555884(0xe3)](_0x1f5090);return{'content':[{'type':_0x555884(0x126),'text':JSON['stringify'](_0x44e3a3)}]};}let _0xfddd9e=await P(_0x555884(0xd9),{'resume_id':w,'alias':Z,'status':_0x34459d===_0x555884(0xf5)?_0x555884(0xf5):_0x34459d==='error'?_0x555884(0xf1):_0x555884(0xea),'task':_0x2a826b[_0x555884(0xab)](0x0,0xc8),'output':_0x2a826b});return{'content':[{'type':_0x555884(0x126),'text':JSON['stringify'](_0xfddd9e)}]};}if(_0xe74226===_0x555884(0x129)){let {status:_0x1c6e4e,task:_0x42cc6e,progress:_0x1a25c7}=_0x477034,_0x34e555=await P(_0x555884(0xd9),{'resume_id':w,'alias':Z,'status':_0x1c6e4e,'task':_0x42cc6e,'progress':_0x1a25c7});return{'content':[{'type':_0x555884(0x126),'text':JSON['stringify'](_0x34e555)}]};}if(_0xe74226===_0x555884(0x11e)){let {alias:_0x5d4504,task:_0x5bf0b2,priority:_0x44a9c3}=_0x477034,_0x39178e=await P(_0x555884(0x10f),{'alias':_0x5d4504,'task':_0x5bf0b2,'priority':_0x44a9c3||_0x555884(0xca),'from_session':Z});return{'content':[{'type':_0x555884(0x126),'text':JSON[_0x555884(0xb2)](_0x39178e)}]};}if(_0xe74226===_0x555884(0xf7)){let {alias:_0x5bcbdc,message:_0x5f46c6}=_0x477034,_0x3f7bd2=await P(_0x555884(0x103),{'alias':_0x5bcbdc,'message':_0x5f46c6,'from_session':Z});return{'content':[{'type':_0x555884(0x126),'text':JSON[_0x555884(0xb2)](_0x3f7bd2)}]};}if(_0xe74226===_0x555884(0xf2)){let _0x178685=await P(_0x555884(0xba),{});return{'content':[{'type':_0x555884(0x126),'text':JSON[_0x555884(0xb2)](_0x178685)}]};}return{'content':[{'type':'text','text':JSON['stringify']({'error':_0x555884(0xe8)})}]};});async function v(){const _0x1d9036=a0_0x1c5c73;let _0x554f5a=D+_0x1d9036(0xec)+encodeURIComponent(Z),_0x2704ff={};if(X)_0x2704ff['Authorization']=_0x1d9036(0x132)+X;Y(_0x1d9036(0x116)+_0x554f5a);while(!0x0){try{let _0x3bc7c5=await fetch(_0x554f5a,{'headers':_0x2704ff});if(!_0x3bc7c5['ok']){Y(_0x1d9036(0xb1)+_0x3bc7c5[_0x1d9036(0x105)]+'\x20'+_0x3bc7c5[_0x1d9036(0xc8)]),await h(0x1388);continue;}let _0x1c7055=_0x3bc7c5[_0x1d9036(0x115)]['getReader'](),_0x2fc318=new TextDecoder(),_0x10963='';while(!0x0){let {done:_0x2c438a,value:_0x34f4af}=await _0x1c7055[_0x1d9036(0x108)]();if(_0x2c438a)break;_0x10963+=_0x2fc318[_0x1d9036(0x120)](_0x34f4af,{'stream':!0x0});let _0x5772c2=_0x10963[_0x1d9036(0x12a)]('\x0a\x0a');_0x10963=_0x5772c2[_0x1d9036(0xc9)]()||'';for(let _0x298dea of _0x5772c2){let _0x53d707=_0x298dea[_0x1d9036(0x12a)]('\x0a')['find'](_0x2c3e39=>_0x2c3e39[_0x1d9036(0x12f)](_0x1d9036(0x106)));if(!_0x53d707)continue;try{let _0x67ac4c=JSON[_0x1d9036(0xfe)](_0x53d707[_0x1d9036(0xab)](0x6));await u(_0x67ac4c);}catch(_0x31900b){Y(_0x1d9036(0xe5)+_0x31900b);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x24bc42){Y('SSE\x20connection\x20error:\x20'+_0x24bc42);}await h(0xbb8);}}async function u(_0x8507e9){const _0x18851e=a0_0x1c5c73;if(_0x8507e9[_0x18851e(0x111)]==='connected'){Y(_0x18851e(0xb6)+Z+'\x22');return;}if(_0x8507e9['type']===_0x18851e(0x10a)){if(Y('←\x20message\x20from\x20'+_0x8507e9[_0x18851e(0xc1)]+':\x20'+_0x8507e9['message'][_0x18851e(0xab)](0x0,0x3c)),await K[_0x18851e(0x102)]({'method':_0x18851e(0xd3),'params':{'content':_0x8507e9[_0x18851e(0xff)],'meta':{'sender':_0x8507e9['from']||_0x18851e(0xd8),'sender_id':_0x18851e(0xbc),'user':_0x8507e9[_0x18851e(0xc1)]||_0x18851e(0xd8),'priority':'normal'}}}),_0x8507e9['message_id'])await P(_0x18851e(0x101),{'alias':Z,'message_id':_0x8507e9[_0x18851e(0xf9)]});return;}if(_0x8507e9[_0x18851e(0x111)]===_0x18851e(0xda)||_0x8507e9['type']==='broadcast'){Y('←\x20'+_0x8507e9[_0x18851e(0x111)]+_0x18851e(0x124)+_0x8507e9[_0x18851e(0x12c)]+_0x18851e(0xfa)+(_0x8507e9[_0x18851e(0xbf)]||_0x18851e(0xca)));let _0x2edcd5=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x2edcd5?.['ok']&&_0x2edcd5[_0x18851e(0xb9)]?.[_0x18851e(0x100)]>0x0)for(let _0x288c2b of _0x2edcd5[_0x18851e(0xb9)]){let _0x426fdd={'sender':_0x288c2b['from_session']||_0x18851e(0xd8),'sender_id':_0x18851e(0xbc),'user':_0x288c2b[_0x18851e(0xce)]||'hub','task_id':_0x288c2b['id'],'priority':_0x288c2b[_0x18851e(0xbf)]||_0x18851e(0xca)};k[_0x18851e(0xd7)](_0x288c2b['id'],_0x288c2b['from_session']||_0x18851e(0xd8)),await K[_0x18851e(0x102)]({'method':_0x18851e(0xd3),'params':{'content':_0x288c2b[_0x18851e(0xd1)],'meta':_0x426fdd}}),Y(_0x18851e(0xbe)+_0x288c2b['id']['slice'](0x0,0x8)+_0x18851e(0xdf)+_0x288c2b['from_session']+':\x20'+_0x288c2b['content'][_0x18851e(0xab)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x288c2b['id']});}}}async function S(){const _0x394a46=a0_0x1c5c73;let _0x2fee0f=new a0_0x19c310();await K[_0x394a46(0xac)](_0x2fee0f),Y(_0x394a46(0xd5)),Y(_0x394a46(0xb4)),v()[_0x394a46(0xdc)](_0x12dc02=>Y(_0x394a46(0x107)+_0x12dc02)),P(_0x394a46(0xd9),{'resume_id':w,'alias':Z,'status':_0x394a46(0x109),'server':a0_0xcb044c(),'hostname':a0_0xcb044c(),'agent':'claude-code','project_dir':process[_0x394a46(0x10d)](),'tmux_name':f||void 0x0})[_0x394a46(0xc6)](()=>Y(_0x394a46(0xae)+Z+_0x394a46(0xc7)+w['slice'](0x0,0x8)+')'))['catch'](_0x509650=>Y(_0x394a46(0xcf)+_0x509650)),setInterval(()=>{const _0x10d048=_0x394a46;P(_0x10d048(0xd9),{'resume_id':w,'alias':Z,'status':_0x10d048(0x109),'server':a0_0xcb044c(),'hostname':a0_0xcb044c(),'agent':_0x10d048(0xe1),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x10d048(0xdc)](_0x3699c8=>Y(_0x10d048(0xc0)+_0x3699c8));},0x2bf20),Y(_0x394a46(0xe6));}S()[a0_0x1c5c73(0xdc)](_0x1e7ee8=>{const _0x308609=a0_0x1c5c73;Y(_0x308609(0x118)+_0x1e7ee8),process[_0x308609(0x130)](0x1);});async function N(){const _0xdb45bb=a0_0x1c5c73;Y('shutting\x20down,\x20reporting\x20offline...'),await P('report_status',{'resume_id':w,'alias':Z,'status':_0xdb45bb(0xf1),'task':_0xdb45bb(0xcc)})[_0xdb45bb(0xdc)](()=>{}),process['exit'](0x0);}process[a0_0x1c5c73(0x128)]['on']('end',()=>N()),process['on'](a0_0x1c5c73(0xfd),()=>N()),process['on'](a0_0x1c5c73(0x11b),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.0.0-preview.
|
|
3
|
+
"version": "2.0.0-preview.31",
|
|
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",
|
|
@@ -41,9 +41,10 @@
|
|
|
41
41
|
],
|
|
42
42
|
"author": "sleep2agi",
|
|
43
43
|
"license": "MIT",
|
|
44
|
+
"homepage": "https://anet.vansin.me",
|
|
44
45
|
"repository": {
|
|
45
46
|
"type": "git",
|
|
46
|
-
"url": "https://github.com/sleep2agi/agent-
|
|
47
|
+
"url": "https://github.com/sleep2agi/agent-network",
|
|
47
48
|
"directory": "agent-network"
|
|
48
49
|
},
|
|
49
50
|
"engines": {
|