@sleep2agi/agent-network 2.0.0-preview.3 → 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/README.md +215 -73
- package/dist/bin/cli.js +1 -1
- package/dist/src/client.js +1 -1
- package/dist/src/node-server.js +1 -1
- package/package.json +9 -7
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
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_0x4957c1=a0_0x36b6;(function(_0x5cfc08,_0x26d444){const _0x544013=a0_0x36b6,_0x4118bd=_0x5cfc08();while(!![]){try{const _0x356a51=-parseInt(_0x544013(0x21b))/0x1+parseInt(_0x544013(0x1d6))/0x2+parseInt(_0x544013(0x1a8))/0x3+parseInt(_0x544013(0x20c))/0x4*(-parseInt(_0x544013(0x1d8))/0x5)+parseInt(_0x544013(0x20a))/0x6+parseInt(_0x544013(0x1fb))/0x7*(parseInt(_0x544013(0x1c1))/0x8)+-parseInt(_0x544013(0x1fd))/0x9*(parseInt(_0x544013(0x1b4))/0xa);if(_0x356a51===_0x26d444)break;else _0x4118bd['push'](_0x4118bd['shift']());}catch(_0x15b9fe){_0x4118bd['push'](_0x4118bd['shift']());}}}(a0_0x34b0,0x67f4b));import{readFileSync as a0_0x28cb05,existsSync as a0_0x3d5593}from'fs';import{join as a0_0x4064a4}from'path';import{hostname as a0_0x4c3551}from'os';import{execSync as a0_0x137dd9}from'child_process';import{Server as a0_0x5255db}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x850b9d}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x42c78f,CallToolRequestSchema as a0_0x5bca13}from'@modelcontextprotocol/sdk/types.js';function p(_0x3aa21d){const _0x1747dc=a0_0x36b6;if(!a0_0x3d5593(_0x3aa21d))return;for(let _0x1f6d9c of a0_0x28cb05(_0x3aa21d,_0x1747dc(0x1c7))['split']('\x0a')){let _0x18b267=_0x1f6d9c[_0x1747dc(0x1c8)]();if(!_0x18b267||_0x18b267[_0x1747dc(0x1e9)]('#'))continue;let _0xf4145b=_0x18b267['indexOf']('=');if(_0xf4145b<0x0)continue;let _0x4a033a=_0x18b267[_0x1747dc(0x221)](0x0,_0xf4145b)[_0x1747dc(0x1c8)](),_0x2df4c3=_0x18b267[_0x1747dc(0x221)](_0xf4145b+0x1)['trim']()[_0x1747dc(0x1a4)](/^["']|["']$/g,'');if(!process.env[_0x4a033a])process.env[_0x4a033a]=_0x2df4c3;}}var C=process.env.HOME||'~',T=a0_0x4064a4(C,a0_0x4957c1(0x1d2));p(a0_0x4064a4(T,'.env'));var L=process[a0_0x4957c1(0x1d0)]()[a0_0x4957c1(0x1a4)](/\//g,'-');p(a0_0x4064a4(T,L,a0_0x4957c1(0x1e1)));function U(){const _0x287058=a0_0x4957c1;try{return a0_0x137dd9(_0x287058(0x207),{'encoding':_0x287058(0x1c7),'timeout':0x7d0})[_0x287058(0x1c8)]();}catch{return'';}}function c(){const _0x347e97=a0_0x4957c1;try{let _0x111b3a=a0_0x4064a4(C,_0x347e97(0x1bf),_0x347e97(0x1b1));if(a0_0x3d5593(_0x111b3a))return JSON['parse'](a0_0x28cb05(_0x111b3a,_0x347e97(0x1c7)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H['hub']||a0_0x4957c1(0x1c3),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x4c3551(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x4957c1(0x206)](),X=process.env.COMMHUB_TOKEN||H[a0_0x4957c1(0x1ac)]||'';function Y(_0x431e37){const _0x318122=a0_0x4957c1;let _0x4a8a2c=new Date()[_0x318122(0x1e0)]()[_0x318122(0x221)](0x0,0x8);process[_0x318122(0x1b0)][_0x318122(0x19f)]('['+_0x4a8a2c+_0x318122(0x216)+_0x431e37+'\x0a');}function a0_0x34b0(){const _0x1aecc0=['statusText','in_progress','startsWith','\x20CWD=','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','none','starting\x20SSE\x20listener...','get','ENV:\x20URL=','connecting\x20to\x20','failed','set','status','alias',':\x20inbox_count=','CommHub\x20init\x20failed:\x20','error','from_session','broadcast','0.3.0','217DneiLb','string','27PmYrGc','high','/mcp','SSE\x20fatal:\x20','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','pop','result','object','tools/call','randomUUID','tmux\x20display-message\x20-p\x20\x27#S\x27','commhub_reply','\x20priority=','4868646cBwaSV','SIGINT','4YNgYhI','SSE\x20error:\x20','Bearer\x20','cancelled','commhub','unknown\x20tool','commhub-channel','task','Progress\x200-100','params',']\x20[commhub]\x20','commhub_send_task','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','Target\x20session\x20alias','setRequestHandler','580858MYYMQr','warning:\x20could\x20not\x20register:\x20','notification','MCP\x20stdio\x20connected','commhub_get_all_status','priority','slice','idle','blocked','content','hub','exit','write','new_message','Authorization','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','application/json,\x20text/event-stream','replace','from','decode','type','1591974IBzcAB','send_message','stringify','\x20from\x20','token','number','catch','Current\x20task\x20description','stderr','config.json','commhub_report_status','ack_inbox','69820GvgDsq','Session\x20alias:\x20','claude-code','parse','\x20ALIAS=','data:\x20','commhub_send_message','replied','Reply\x20text\x20/\x20result\x20summary','←\x20message\x20from\x20','→\x20injected\x20task\x20','.anet','read','21752WWrnTj','report_status','http://127.0.0.1:9200','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','SSE\x20connected\x20as\x20\x22','2.0','utf-8','trim','registered\x20as\x20\x22','connect','working','split','normal','stdin','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','cwd','getReader','.claude/channels/commhub','parse\x20error:\x20','application/json','Message\x20content','77532ALtbrW','Priority\x20(default:\x20normal)','2187735nBTxrP','text','\x22\x20(','completed','message','end','find','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','toTimeString','.env','\x20PROJECT_ENV=','send_reply','...\x20TMUX=','notifications/claude/channel','get_all_status'];a0_0x34b0=function(){return _0x1aecc0;};return a0_0x34b0();}function h(_0x419e0f){return new Promise(_0x524967=>setTimeout(_0x524967,_0x419e0f));}Y(a0_0x4957c1(0x1ef)+D+a0_0x4957c1(0x1b8)+Z+'\x20RESUME_ID='+w[a0_0x4957c1(0x221)](0x0,0x8)+a0_0x4957c1(0x1e4)+(f||a0_0x4957c1(0x1ec))+a0_0x4957c1(0x1ea)+process[a0_0x4957c1(0x1d0)]()+a0_0x4957c1(0x1e2)+L);var k=new Map(),K=new a0_0x5255db({'name':'commhub-channel','version':'0.3.0'},{'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_0x4957c1(0x1cf),a0_0x4957c1(0x201),a0_0x4957c1(0x1b5)+Z]['join']('\x0a')});K[a0_0x4957c1(0x21a)](a0_0x42c78f,async()=>({'tools':[{'name':a0_0x4957c1(0x208),'description':a0_0x4957c1(0x1df),'inputSchema':{'type':a0_0x4957c1(0x204),'properties':{'task_id':{'type':a0_0x4957c1(0x1fc),'description':a0_0x4957c1(0x1c4)},'text':{'type':a0_0x4957c1(0x1fc),'description':a0_0x4957c1(0x1bc)},'status':{'type':a0_0x4957c1(0x1fc),'enum':[a0_0x4957c1(0x1db),a0_0x4957c1(0x1f1),'cancelled','blocked',a0_0x4957c1(0x1f7),a0_0x4957c1(0x1e8)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x4957c1(0x1d9)]}},{'name':a0_0x4957c1(0x1b2),'description':a0_0x4957c1(0x1eb),'inputSchema':{'type':a0_0x4957c1(0x204),'properties':{'status':{'type':a0_0x4957c1(0x1fc),'enum':[a0_0x4957c1(0x1cb),'idle',a0_0x4957c1(0x223),'error']},'task':{'type':'string','description':a0_0x4957c1(0x1af)},'progress':{'type':a0_0x4957c1(0x1ad),'description':a0_0x4957c1(0x214)}},'required':['status']}},{'name':a0_0x4957c1(0x217),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x4957c1(0x204),'properties':{'alias':{'type':a0_0x4957c1(0x1fc),'description':a0_0x4957c1(0x219)},'task':{'type':a0_0x4957c1(0x1fc),'description':'Task\x20content'},'priority':{'type':'string','enum':[a0_0x4957c1(0x1fe),a0_0x4957c1(0x1cd),'low'],'description':a0_0x4957c1(0x1d7)}},'required':[a0_0x4957c1(0x1f4),a0_0x4957c1(0x213)]}},{'name':a0_0x4957c1(0x1ba),'description':a0_0x4957c1(0x1a2),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x4957c1(0x1fc),'description':a0_0x4957c1(0x219)},'message':{'type':a0_0x4957c1(0x1fc),'description':a0_0x4957c1(0x1d5)}},'required':[a0_0x4957c1(0x1f4),a0_0x4957c1(0x1dc)]}},{'name':a0_0x4957c1(0x21f),'description':a0_0x4957c1(0x218),'inputSchema':{'type':a0_0x4957c1(0x204),'properties':{}}}]}));async function P(_0x3ef730,_0x3b6c5e){const _0x48c4f5=a0_0x4957c1;let _0x46ae85=await fetch(D+'/mcp',{'method':'POST','headers':{'Content-Type':_0x48c4f5(0x1d4),'Accept':_0x48c4f5(0x1a3),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x48c4f5(0x1c6),'id':0x1,'method':'initialize','params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x48c4f5(0x212),'version':_0x48c4f5(0x1fa)}}})});if(!_0x46ae85['ok']){let _0x51201d=await _0x46ae85['text']();return Y(_0x48c4f5(0x1f6)+_0x46ae85[_0x48c4f5(0x1f3)]+'\x20'+_0x51201d[_0x48c4f5(0x221)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x46ae85[_0x48c4f5(0x1f3)]};}await _0x46ae85[_0x48c4f5(0x1d9)]();let _0x5f2f0d=(await(await fetch(D+_0x48c4f5(0x1ff),{'method':'POST','headers':{'Content-Type':_0x48c4f5(0x1d4),'Accept':_0x48c4f5(0x1a3),...X?{'Authorization':_0x48c4f5(0x20e)+X}:{}},'body':JSON[_0x48c4f5(0x1aa)]({'jsonrpc':'2.0','id':0x2,'method':_0x48c4f5(0x205),'params':{'name':_0x3ef730,'arguments':_0x3b6c5e}})}))[_0x48c4f5(0x1d9)]())[_0x48c4f5(0x1cc)]('\x0a')[_0x48c4f5(0x1de)](_0xb529f8=>_0xb529f8[_0x48c4f5(0x1e9)](_0x48c4f5(0x1b9)));if(_0x5f2f0d){let _0x31148d=JSON['parse'](_0x5f2f0d['slice'](0x6));return _0x31148d?.[_0x48c4f5(0x203)]?.[_0x48c4f5(0x19c)]?.[0x0]?.[_0x48c4f5(0x1d9)]?JSON[_0x48c4f5(0x1b7)](_0x31148d['result'][_0x48c4f5(0x19c)][0x0][_0x48c4f5(0x1d9)]):_0x31148d;}return{'ok':!0x1,'error':'no\x20response'};}function a0_0x36b6(_0x2666e8,_0x54aafa){_0x2666e8=_0x2666e8-0x19c;const _0x34b026=a0_0x34b0();let _0x36b6ab=_0x34b026[_0x2666e8];return _0x36b6ab;}K[a0_0x4957c1(0x21a)](a0_0x5bca13,async _0x612858=>{const _0x326213=a0_0x4957c1;let {name:_0x3cdeac,arguments:_0x227cca}=_0x612858[_0x326213(0x215)];if(_0x3cdeac===_0x326213(0x208)){let {task_id:_0xf25d4e,text:_0x2db8a5,status:_0x4660c3}=_0x227cca;if(_0x4660c3==='completed'||_0x4660c3===_0x326213(0x1f1)||_0x4660c3===_0x326213(0x20f)){let _0x16537d=_0x4660c3===_0x326213(0x1db)?_0x326213(0x1bb):_0x4660c3,_0x2842ac=_0xf25d4e?k[_0x326213(0x1ee)](_0xf25d4e)||_0x326213(0x19d):_0x326213(0x19d),_0x4a5dfd=await P(_0x326213(0x1e3),{'alias':_0x2842ac,'text':_0x2db8a5,'in_reply_to':_0xf25d4e||void 0x0,'status':_0x16537d,'from_session':Z});if(_0xf25d4e)k['delete'](_0xf25d4e);return{'content':[{'type':_0x326213(0x1d9),'text':JSON[_0x326213(0x1aa)](_0x4a5dfd)}]};}let _0xc3d2a2=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x4660c3===_0x326213(0x223)?_0x326213(0x223):_0x4660c3==='error'?_0x326213(0x1f7):'working','task':_0x2db8a5[_0x326213(0x221)](0x0,0xc8),'output':_0x2db8a5});return{'content':[{'type':_0x326213(0x1d9),'text':JSON[_0x326213(0x1aa)](_0xc3d2a2)}]};}if(_0x3cdeac==='commhub_report_status'){let {status:_0x33cbbd,task:_0x11c979,progress:_0x2b4ad1}=_0x227cca,_0x36329f=await P(_0x326213(0x1c2),{'resume_id':w,'alias':Z,'status':_0x33cbbd,'task':_0x11c979,'progress':_0x2b4ad1});return{'content':[{'type':_0x326213(0x1d9),'text':JSON['stringify'](_0x36329f)}]};}if(_0x3cdeac==='commhub_send_task'){let {alias:_0xa357dd,task:_0x2545e4,priority:_0x251be8}=_0x227cca,_0x260203=await P('send_task',{'alias':_0xa357dd,'task':_0x2545e4,'priority':_0x251be8||'normal','from_session':Z});return{'content':[{'type':_0x326213(0x1d9),'text':JSON['stringify'](_0x260203)}]};}if(_0x3cdeac==='commhub_send_message'){let {alias:_0xdb2727,message:_0x1f6de4}=_0x227cca,_0x362113=await P(_0x326213(0x1a9),{'alias':_0xdb2727,'message':_0x1f6de4,'from_session':Z});return{'content':[{'type':_0x326213(0x1d9),'text':JSON['stringify'](_0x362113)}]};}if(_0x3cdeac===_0x326213(0x21f)){let _0x2323bc=await P(_0x326213(0x1e6),{});return{'content':[{'type':'text','text':JSON[_0x326213(0x1aa)](_0x2323bc)}]};}return{'content':[{'type':_0x326213(0x1d9),'text':JSON[_0x326213(0x1aa)]({'error':_0x326213(0x211)})}]};});async function v(){const _0x5f1877=a0_0x4957c1;let _0x53679d=D+'/events/'+encodeURIComponent(Z),_0x236bf8={};if(X)_0x236bf8[_0x5f1877(0x1a1)]=_0x5f1877(0x20e)+X;Y(_0x5f1877(0x1f0)+_0x53679d);while(!0x0){try{let _0x4f494e=await fetch(_0x53679d,{'headers':_0x236bf8});if(!_0x4f494e['ok']){Y(_0x5f1877(0x20d)+_0x4f494e[_0x5f1877(0x1f3)]+'\x20'+_0x4f494e[_0x5f1877(0x1e7)]),await h(0x1388);continue;}let _0x451689=_0x4f494e['body'][_0x5f1877(0x1d1)](),_0x1824b6=new TextDecoder(),_0x3271d2='';while(!0x0){let {done:_0x453d70,value:_0x1329a3}=await _0x451689[_0x5f1877(0x1c0)]();if(_0x453d70)break;_0x3271d2+=_0x1824b6[_0x5f1877(0x1a6)](_0x1329a3,{'stream':!0x0});let _0x370482=_0x3271d2['split']('\x0a\x0a');_0x3271d2=_0x370482[_0x5f1877(0x202)]()||'';for(let _0x438c3f of _0x370482){let _0x3e0b83=_0x438c3f[_0x5f1877(0x1cc)]('\x0a')[_0x5f1877(0x1de)](_0x1a9851=>_0x1a9851[_0x5f1877(0x1e9)](_0x5f1877(0x1b9)));if(!_0x3e0b83)continue;try{let _0x5600c6=JSON[_0x5f1877(0x1b7)](_0x3e0b83[_0x5f1877(0x221)](0x6));await u(_0x5600c6);}catch(_0x48fcf3){Y(_0x5f1877(0x1d3)+_0x48fcf3);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x4a17ac){Y('SSE\x20connection\x20error:\x20'+_0x4a17ac);}await h(0xbb8);}}async function u(_0x33d2cb){const _0x516fdf=a0_0x4957c1;if(_0x33d2cb[_0x516fdf(0x1a7)]==='connected'){Y(_0x516fdf(0x1c5)+Z+'\x22');return;}if(_0x33d2cb[_0x516fdf(0x1a7)]===_0x516fdf(0x1a0)){if(Y(_0x516fdf(0x1bd)+_0x33d2cb['from']+':\x20'+_0x33d2cb[_0x516fdf(0x1dc)]['slice'](0x0,0x3c)),await K[_0x516fdf(0x21d)]({'method':_0x516fdf(0x1e5),'params':{'content':_0x33d2cb['message'],'meta':{'sender':_0x33d2cb['from']||'hub','sender_id':_0x516fdf(0x210),'user':_0x33d2cb[_0x516fdf(0x1a5)]||_0x516fdf(0x19d),'priority':_0x516fdf(0x1cd)}}}),_0x33d2cb['message_id'])await P(_0x516fdf(0x1b3),{'alias':Z,'message_id':_0x33d2cb['message_id']});return;}if(_0x33d2cb[_0x516fdf(0x1a7)]==='new_task'||_0x33d2cb[_0x516fdf(0x1a7)]===_0x516fdf(0x1f9)){Y('←\x20'+_0x33d2cb[_0x516fdf(0x1a7)]+_0x516fdf(0x1f5)+_0x33d2cb['inbox_count']+_0x516fdf(0x209)+(_0x33d2cb[_0x516fdf(0x220)]||_0x516fdf(0x1cd)));let _0x1cb3e7=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x1cb3e7?.['ok']&&_0x1cb3e7['messages']?.['length']>0x0)for(let _0x346302 of _0x1cb3e7['messages']){let _0x5d3bee={'sender':_0x346302['from_session']||_0x516fdf(0x19d),'sender_id':'commhub','user':_0x346302[_0x516fdf(0x1f8)]||_0x516fdf(0x19d),'task_id':_0x346302['id'],'priority':_0x346302[_0x516fdf(0x220)]||_0x516fdf(0x1cd)};k[_0x516fdf(0x1f2)](_0x346302['id'],_0x346302[_0x516fdf(0x1f8)]||_0x516fdf(0x19d)),await K[_0x516fdf(0x21d)]({'method':_0x516fdf(0x1e5),'params':{'content':_0x346302[_0x516fdf(0x19c)],'meta':_0x5d3bee}}),Y(_0x516fdf(0x1be)+_0x346302['id'][_0x516fdf(0x221)](0x0,0x8)+_0x516fdf(0x1ab)+_0x346302[_0x516fdf(0x1f8)]+':\x20'+_0x346302[_0x516fdf(0x19c)]['slice'](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x346302['id']});}}}async function S(){const _0x5c3ce0=a0_0x4957c1;let _0x51b854=new a0_0x850b9d();await K[_0x5c3ce0(0x1ca)](_0x51b854),Y(_0x5c3ce0(0x21e)),Y(_0x5c3ce0(0x1ed)),v()['catch'](_0x2983ee=>Y(_0x5c3ce0(0x200)+_0x2983ee)),P(_0x5c3ce0(0x1c2),{'resume_id':w,'alias':Z,'status':_0x5c3ce0(0x222),'server':a0_0x4c3551(),'hostname':a0_0x4c3551(),'agent':_0x5c3ce0(0x1b6),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})['then'](()=>Y(_0x5c3ce0(0x1c9)+Z+_0x5c3ce0(0x1da)+w[_0x5c3ce0(0x221)](0x0,0x8)+')'))[_0x5c3ce0(0x1ae)](_0x3a969d=>Y(_0x5c3ce0(0x21c)+_0x3a969d)),setInterval(()=>{const _0x18a330=_0x5c3ce0;P(_0x18a330(0x1c2),{'resume_id':w,'alias':Z,'status':_0x18a330(0x222),'server':a0_0x4c3551(),'hostname':a0_0x4c3551(),'agent':'claude-code','project_dir':process[_0x18a330(0x1d0)](),'tmux_name':f||void 0x0})['catch'](_0x1f9088=>Y('heartbeat\x20failed:\x20'+_0x1f9088));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}S()[a0_0x4957c1(0x1ae)](_0x26372f=>{Y('fatal:\x20'+_0x26372f),process['exit'](0x1);});async function N(){const _0x44db85=a0_0x4957c1;Y('shutting\x20down,\x20reporting\x20offline...'),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x44db85(0x1f7),'task':'session\x20disconnected'})[_0x44db85(0x1ae)](()=>{}),process[_0x44db85(0x19e)](0x0);}process[a0_0x4957c1(0x1ce)]['on'](a0_0x4957c1(0x1dd),()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x4957c1(0x20b),()=>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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.0.0-preview.
|
|
4
|
-
"description": "AI Agent Network
|
|
3
|
+
"version": "2.0.0-preview.31",
|
|
4
|
+
"description": "AI Agent Network CLI \u2014 Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 39 commands.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|
|
7
7
|
"types": "dist/client.d.ts",
|
|
@@ -31,18 +31,20 @@
|
|
|
31
31
|
"mcp",
|
|
32
32
|
"sse",
|
|
33
33
|
"claude",
|
|
34
|
+
"codex",
|
|
34
35
|
"openai",
|
|
35
36
|
"minimax",
|
|
36
37
|
"orchestration",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"multi-agent",
|
|
39
|
+
"cli",
|
|
40
|
+
"anet"
|
|
40
41
|
],
|
|
41
42
|
"author": "sleep2agi",
|
|
42
43
|
"license": "MIT",
|
|
44
|
+
"homepage": "https://anet.vansin.me",
|
|
43
45
|
"repository": {
|
|
44
46
|
"type": "git",
|
|
45
|
-
"url": "https://github.com/sleep2agi/agent-
|
|
47
|
+
"url": "https://github.com/sleep2agi/agent-network",
|
|
46
48
|
"directory": "agent-network"
|
|
47
49
|
},
|
|
48
50
|
"engines": {
|
|
@@ -57,4 +59,4 @@
|
|
|
57
59
|
"node-pty": "^1.1.0",
|
|
58
60
|
"typescript": "^5.0.0"
|
|
59
61
|
}
|
|
60
|
-
}
|
|
62
|
+
}
|