@sleep2agi/agent-network 2.0.0-preview.53 → 2.0.0-preview.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +1 -1
- package/dist/src/client.js +1 -1
- package/dist/src/node-server.js +1 -1
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a0_0x1aef(_0x251803,_0x8a4f28){_0x251803=_0x251803-0x1be;const _0x1714c2=a0_0x1714();let _0x1aefe6=_0x1714c2[_0x251803];return _0x1aefe6;}const a0_0x351fef=a0_0x1aef;(function(_0x56268b,_0x1e62f3){const _0x174d65=a0_0x1aef,_0x327546=_0x56268b();while(!![]){try{const _0x1bb8d6=-parseInt(_0x174d65(0x1e8))/0x1*(parseInt(_0x174d65(0x1f9))/0x2)+-parseInt(_0x174d65(0x1c6))/0x3+-parseInt(_0x174d65(0x1be))/0x4*(-parseInt(_0x174d65(0x1d6))/0x5)+parseInt(_0x174d65(0x1d3))/0x6*(parseInt(_0x174d65(0x1db))/0x7)+-parseInt(_0x174d65(0x1f0))/0x8+-parseInt(_0x174d65(0x207))/0x9+-parseInt(_0x174d65(0x1d5))/0xa*(-parseInt(_0x174d65(0x1e6))/0xb);if(_0x1bb8d6===_0x1e62f3)break;else _0x327546['push'](_0x327546['shift']());}catch(_0x3d74be){_0x327546['push'](_0x327546['shift']());}}}(a0_0x1714,0x27f6d));import{EventEmitter as a0_0x5a42cf}from'events';function a0_0x1714(){const _0x52770f=['/mcp','error','2USzYjk','pop','application/json,\x20text/event-stream','log','body','getAllStatus','normal','messages','idle','inbox\x20error:\x20','server','disconnected','/events/','signal','2285253soOhTK','task','SSE\x20error:\x20','offline','processInbox','sleep','connect','slice','reply','heartbeatTimer','SSE\x20connected','registered','271292eIyNqT','sdk','emit','toTimeString','status','match','send_message','read','404226muOYVm','split','running','catch','AbortError','cwd','from_session','type','agent',']\x20[commhub:','reconnectDelay','url','connectSSE','60khBRAk','call','20AeTtdb','5CPjDQT','disconnect','tools/call','new_message','message','3766fKqNjZ','min','replace','Authorization','s...','sseAbort','getReader','ack_inbox','toString','token','broadcast','5228311NERJKc','alias','280279MeFKMj','connected','startsWith','SSE\x20failed:\x20','application/json','resumeId','get_all_status','now','1529392vcVSyh','parse','heartbeatInterval','heartbeat\x20failed:\x20','text','content','Bearer\x20'];a0_0x1714=function(){return _0x52770f;};return a0_0x1714();}import{hostname as a0_0x5b7974}from'os';class T extends a0_0x5a42cf{[a0_0x351fef(0x1d1)];[a0_0x351fef(0x1e7)];[a0_0x351fef(0x1e4)];[a0_0x351fef(0x1ce)];[a0_0x351fef(0x1ed)];['heartbeatInterval'];['reconnectDelay'];[a0_0x351fef(0x210)];[a0_0x351fef(0x1e0)];[a0_0x351fef(0x1c8)]=!0x1;constructor(_0x2736ce){const _0xe9135b=a0_0x351fef;super();if(this[_0xe9135b(0x1d1)]=_0x2736ce[_0xe9135b(0x1d1)][_0xe9135b(0x1dd)](/\/$/,''),this[_0xe9135b(0x1e7)]=_0x2736ce[_0xe9135b(0x1e7)],this[_0xe9135b(0x1e4)]=_0x2736ce[_0xe9135b(0x1e4)],this[_0xe9135b(0x1ce)]=_0x2736ce[_0xe9135b(0x1ce)]||_0xe9135b(0x1bf),this[_0xe9135b(0x1ed)]='sdk-'+_0x2736ce[_0xe9135b(0x1e7)]+'-'+Date[_0xe9135b(0x1ef)]()[_0xe9135b(0x1e3)](0x24),this['heartbeatInterval']=_0x2736ce[_0xe9135b(0x1f2)]??0x2bf20,this[_0xe9135b(0x1d0)]=_0x2736ce[_0xe9135b(0x1d0)]??0xbb8,_0x2736ce['autoConnect']!==!0x1)this[_0xe9135b(0x20d)]();}[a0_0x351fef(0x1fc)](_0xa7f462){const _0x3ddafd=a0_0x351fef;console[_0x3ddafd(0x1fc)]('['+new Date()[_0x3ddafd(0x1c1)]()[_0x3ddafd(0x20e)](0x0,0x8)+_0x3ddafd(0x1cf)+this[_0x3ddafd(0x1e7)]+']\x20'+_0xa7f462);}async['call'](_0x4d5cc2,_0x56d0ef){const _0x5bf8c0=a0_0x351fef;let _0x63156={'Content-Type':_0x5bf8c0(0x1ec),'Accept':_0x5bf8c0(0x1fb)};if(this[_0x5bf8c0(0x1e4)])_0x63156[_0x5bf8c0(0x1de)]='Bearer\x20'+this['token'];let _0x97f18b=await(await fetch(this[_0x5bf8c0(0x1d1)]+_0x5bf8c0(0x1f7),{'method':'POST','headers':_0x63156,'body':JSON['stringify']({'jsonrpc':'2.0','id':Date[_0x5bf8c0(0x1ef)](),'method':_0x5bf8c0(0x1d8),'params':{'name':_0x4d5cc2,'arguments':_0x56d0ef}})}))[_0x5bf8c0(0x1f4)](),_0x1f6678=_0x97f18b[_0x5bf8c0(0x1c3)](/data: (.+)/),_0x49b075=_0x1f6678?JSON[_0x5bf8c0(0x1f1)](_0x1f6678[0x1]):JSON[_0x5bf8c0(0x1f1)](_0x97f18b),_0x35e271=_0x49b075?.['result']?.[_0x5bf8c0(0x1f5)]?.[0x0]?.[_0x5bf8c0(0x1f4)];return _0x35e271?JSON[_0x5bf8c0(0x1f1)](_0x35e271):_0x49b075;}async[a0_0x351fef(0x20d)](){const _0x26cf1c=a0_0x351fef;if(this[_0x26cf1c(0x1c8)])return;this[_0x26cf1c(0x1c8)]=!0x0,await this['status'](_0x26cf1c(0x201)),this[_0x26cf1c(0x1fc)](_0x26cf1c(0x212)),this['heartbeatTimer']=setInterval(()=>{const _0x29a25e=_0x26cf1c;this[_0x29a25e(0x1c2)](_0x29a25e(0x201))[_0x29a25e(0x1c9)](_0xf7195f=>this['log'](_0x29a25e(0x1f3)+_0xf7195f['message']));},this[_0x26cf1c(0x1f2)]),this[_0x26cf1c(0x1d2)]();}async[a0_0x351fef(0x1d7)](){const _0x2b8c17=a0_0x351fef;if(this['running']=!0x1,this[_0x2b8c17(0x1e0)]?.['abort'](),this['heartbeatTimer'])clearInterval(this[_0x2b8c17(0x210)]);await this['status'](_0x2b8c17(0x20a))[_0x2b8c17(0x1c9)](()=>{}),this[_0x2b8c17(0x1fc)](_0x2b8c17(0x204));}async['send'](_0x4e88ac,_0xe11131,_0x1e1cc3=a0_0x351fef(0x1ff)){const _0x26afc0=a0_0x351fef;return this[_0x26afc0(0x1d4)]('send_task',{'alias':_0x4e88ac,'task':_0xe11131,'priority':_0x1e1cc3,'from_session':this[_0x26afc0(0x1e7)]});}async[a0_0x351fef(0x1da)](_0x1d4d4e,_0x514f43){const _0xfe871e=a0_0x351fef;return this[_0xfe871e(0x1d4)](_0xfe871e(0x1c4),{'alias':_0x1d4d4e,'message':_0x514f43,'from_session':this[_0xfe871e(0x1e7)]});}async[a0_0x351fef(0x20f)](_0x2956ce,_0x44de6a,_0x37e111='completed'){const _0x255534=a0_0x351fef;return this['call'](_0x255534(0x20f),{'task_id':_0x2956ce,'text':_0x44de6a,'status':_0x37e111});}async['status'](_0x58d819,_0x12ae54){const _0x5c6fa0=a0_0x351fef;return this[_0x5c6fa0(0x1d4)]('report_status',{'resume_id':this[_0x5c6fa0(0x1ed)],'alias':this[_0x5c6fa0(0x1e7)],'status':_0x58d819,'server':a0_0x5b7974(),'hostname':a0_0x5b7974(),'agent':this[_0x5c6fa0(0x1ce)],'project_dir':process[_0x5c6fa0(0x1cb)](),..._0x12ae54});}async[a0_0x351fef(0x1fe)](){const _0x108998=a0_0x351fef;return this[_0x108998(0x1d4)](_0x108998(0x1ee),{});}async[a0_0x351fef(0x1e5)](_0x1a52e0,_0x51daff){const _0x65666a=a0_0x351fef;return this[_0x65666a(0x1d4)](_0x65666a(0x1e5),{'message':_0x1a52e0,'filter_server':_0x51daff?.[_0x65666a(0x203)],'filter_status':_0x51daff?.[_0x65666a(0x1c2)]});}async['connectSSE'](){const _0x7941f0=a0_0x351fef;let _0x226cf6=encodeURIComponent(this['alias']),_0x89b9a3=this[_0x7941f0(0x1d1)]+_0x7941f0(0x205)+_0x226cf6,_0x15ba6a=this[_0x7941f0(0x1d0)];while(this[_0x7941f0(0x1c8)]){try{this[_0x7941f0(0x1e0)]=new AbortController();let _0x31af3f={'Accept':'text/event-stream'};if(this[_0x7941f0(0x1e4)])_0x31af3f[_0x7941f0(0x1de)]=_0x7941f0(0x1f6)+this['token'];let _0xba3e48=await fetch(_0x89b9a3,{'headers':_0x31af3f,'signal':this[_0x7941f0(0x1e0)][_0x7941f0(0x206)]});if(!_0xba3e48['ok']||!_0xba3e48[_0x7941f0(0x1fd)]){this['log'](_0x7941f0(0x1eb)+_0xba3e48['status']),await this[_0x7941f0(0x20c)](_0x15ba6a),_0x15ba6a=Math['min'](_0x15ba6a*1.5,0xea60);continue;}_0x15ba6a=this[_0x7941f0(0x1d0)];let _0x51fb17=_0xba3e48[_0x7941f0(0x1fd)][_0x7941f0(0x1e1)](),_0x3dbebc=new TextDecoder(),_0x32acbc='';while(this[_0x7941f0(0x1c8)]){let {done:_0x5b0dd7,value:_0x23e212}=await _0x51fb17[_0x7941f0(0x1c5)]();if(_0x5b0dd7)break;_0x32acbc+=_0x3dbebc['decode'](_0x23e212,{'stream':!0x0});let _0x3baa51=_0x32acbc[_0x7941f0(0x1c7)]('\x0a');_0x32acbc=_0x3baa51[_0x7941f0(0x1fa)]()||'';for(let _0x233b4a of _0x3baa51){if(!_0x233b4a[_0x7941f0(0x1ea)]('data:\x20'))continue;try{let _0x59ecff=JSON[_0x7941f0(0x1f1)](_0x233b4a['slice'](0x6));if(_0x59ecff[_0x7941f0(0x1cd)]==='connected'){this['log'](_0x7941f0(0x211)),this['emit'](_0x7941f0(0x1e9));continue;}if(_0x59ecff[_0x7941f0(0x1cd)]==='new_task'||_0x59ecff['type']===_0x7941f0(0x1d9)||_0x59ecff[_0x7941f0(0x1cd)]===_0x7941f0(0x1e5))await this[_0x7941f0(0x20b)]();}catch{}}}}catch(_0x137e79){if(_0x137e79['name']===_0x7941f0(0x1ca))break;this[_0x7941f0(0x1c0)](_0x7941f0(0x1f8),_0x137e79),this[_0x7941f0(0x1fc)](_0x7941f0(0x209)+_0x137e79['message']);}if(this[_0x7941f0(0x1c8)])this[_0x7941f0(0x1c0)]('disconnected'),this['log']('SSE\x20reconnecting\x20in\x20'+_0x15ba6a/0x3e8+_0x7941f0(0x1df)),await this[_0x7941f0(0x20c)](_0x15ba6a),_0x15ba6a=Math[_0x7941f0(0x1dc)](_0x15ba6a*1.5,0xea60);}}async[a0_0x351fef(0x20b)](){const _0x291d0b=a0_0x351fef;try{let _0x206d24=(await this[_0x291d0b(0x1d4)]('get_inbox',{'alias':this[_0x291d0b(0x1e7)],'limit':0xa}))?.[_0x291d0b(0x200)]||[];for(let _0x278e59 of _0x206d24)await this['call'](_0x291d0b(0x1e2),{'alias':this[_0x291d0b(0x1e7)],'message_id':_0x278e59['id']}),this[_0x291d0b(0x1fc)]('←\x20'+_0x278e59[_0x291d0b(0x1cc)]+':\x20'+_0x278e59[_0x291d0b(0x1f5)][_0x291d0b(0x20e)](0x0,0x3c)),this[_0x291d0b(0x1c0)](_0x291d0b(0x208),_0x278e59),this[_0x291d0b(0x1c0)]('message',_0x278e59);}catch(_0x22157a){this[_0x291d0b(0x1fc)](_0x291d0b(0x202)+_0x22157a[_0x291d0b(0x1da)]);}}['sleep'](_0x57eefd){return new Promise(_0x4d9156=>setTimeout(_0x4d9156,_0x57eefd));}}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_0x54652c=a0_0x19dc;(function(_0x40d398,_0x35e5c5){const _0x5766b9=a0_0x19dc,_0x5d2b57=_0x40d398();while(!![]){try{const _0x5476f2=parseInt(_0x5766b9(0x1dc))/0x1+parseInt(_0x5766b9(0x221))/0x2+-parseInt(_0x5766b9(0x1ef))/0x3+parseInt(_0x5766b9(0x20f))/0x4*(-parseInt(_0x5766b9(0x1c8))/0x5)+parseInt(_0x5766b9(0x22a))/0x6+-parseInt(_0x5766b9(0x23b))/0x7*(-parseInt(_0x5766b9(0x1db))/0x8)+-parseInt(_0x5766b9(0x1f0))/0x9;if(_0x5476f2===_0x35e5c5)break;else _0x5d2b57['push'](_0x5d2b57['shift']());}catch(_0x4aee39){_0x5d2b57['push'](_0x5d2b57['shift']());}}}(a0_0x6ab5,0xb032a));import{readFileSync as a0_0xc9d2c0,existsSync as a0_0x1c3fdd}from'fs';import{join as a0_0x3b76ce}from'path';function a0_0x6ab5(){const _0x3655f3=['startsWith','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','hub','SSE\x20stream\x20ended,\x20reconnecting...','type','setRequestHandler','Current\x20task\x20description','SSE\x20connection\x20error:\x20','ready\x20—\x20waiting\x20for\x20events','report_status','slice','0.3.0','failed','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','2.0',']\x20[commhub]\x20','from','send_message','get','http://127.0.0.1:9200','claude-code','\x20CWD=','pop','join','decode','20qUzYFp','message','delete','application/json,\x20text/event-stream','params','catch','working','string','CommHub\x20init\x20failed:\x20','data:\x20','\x20ALIAS=','commhub_report_status',':\x20inbox_count=','commhub_get_all_status','indexOf','new_task','connect','warning:\x20could\x20not\x20register:\x20','Session\x20alias:\x20','82856hhFvZy','1099778skDwqB','replied','write','end','replace','init\x20failed:\x20','tmux\x20display-message\x20-p\x20\x27#S\x27','in_progress','notifications/claude/channel','Target\x20session\x20alias','task','heartbeat\x20failed:\x20','broadcast','alias','priority','ENV:\x20URL=','Progress\x200-100','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','SSE\x20error:\x20','1667406opSWBR','6592347JlluYg','registered\x20as\x20\x22','→\x20injected\x20task\x20','cancelled','session\x20disconnected','application/json','\x20from\x20','trim','set','idle','/mcp','send_task','low','...\x20TMUX=','\x20priority=','read','none','send_reply','MCP\x20stdio\x20connected','/events/','.env','statusText','text','.anet','object','Bearer\x20','no\x20response','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','result','POST','inbox_count','1089908BbojXv','split','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','\x22\x20(','get_all_status','find','new_message','notification','utf-8','messages','Authorization','SSE\x20fatal:\x20','Message\x20content','from_session','message_id','status','error','2025-03-26','1381628uQwfRF','randomUUID','number','SSE\x20connected\x20as\x20\x22','parse','blocked','.claude/channels/commhub','exit','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','2884482FxFaDA','SIGINT','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','content','body','normal','commhub_send_task','parse\x20error:\x20','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','commhub','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','stringify','cwd','commhub_send_message','commhub-channel','stderr','ack_inbox','560HiannT','stdin','Task\x20content','fatal:\x20','completed'];a0_0x6ab5=function(){return _0x3655f3;};return a0_0x6ab5();}import{hostname as a0_0x4504be}from'os';import{execSync as a0_0x29b471}from'child_process';import{Server as a0_0x4082a5}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x394dd5}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x55132f,CallToolRequestSchema as a0_0x57c382}from'@modelcontextprotocol/sdk/types.js';function p(_0x431c4d){const _0x2f3c07=a0_0x19dc;if(!a0_0x1c3fdd(_0x431c4d))return;for(let _0x1f529c of a0_0xc9d2c0(_0x431c4d,_0x2f3c07(0x217))[_0x2f3c07(0x210)]('\x0a')){let _0x4b59e0=_0x1f529c['trim']();if(!_0x4b59e0||_0x4b59e0[_0x2f3c07(0x240)]('#'))continue;let _0x4fb241=_0x4b59e0[_0x2f3c07(0x1d6)]('=');if(_0x4fb241<0x0)continue;let _0x47af4e=_0x4b59e0[_0x2f3c07(0x24a)](0x0,_0x4fb241)[_0x2f3c07(0x1f7)](),_0x4754cc=_0x4b59e0['slice'](_0x4fb241+0x1)[_0x2f3c07(0x1f7)]()[_0x2f3c07(0x1e0)](/^["']|["']$/g,'');if(!process.env[_0x47af4e])process.env[_0x47af4e]=_0x4754cc;}}var C=process.env.HOME||'~',T=a0_0x3b76ce(C,a0_0x54652c(0x227));p(a0_0x3b76ce(T,a0_0x54652c(0x204)));var L=process['cwd']()[a0_0x54652c(0x1e0)](/\//g,'-');p(a0_0x3b76ce(T,L,'.env'));function U(){const _0x5ced20=a0_0x54652c;try{return a0_0x29b471(_0x5ced20(0x1e2),{'encoding':'utf-8','timeout':0x7d0})[_0x5ced20(0x1f7)]();}catch{return'';}}function a0_0x19dc(_0x139df9,_0x44aac4){_0x139df9=_0x139df9-0x1c2;const _0x6ab524=a0_0x6ab5();let _0x19dcd4=_0x6ab524[_0x139df9];return _0x19dcd4;}function c(){const _0x4af0e8=a0_0x54652c;try{let _0x2e023d=a0_0x3b76ce(C,_0x4af0e8(0x207),'config.json');if(a0_0x1c3fdd(_0x2e023d))return JSON[_0x4af0e8(0x225)](a0_0xc9d2c0(_0x2e023d,'utf-8'));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x54652c(0x242)]||a0_0x54652c(0x1c2),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x4504be(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x54652c(0x222)](),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x3b3ff3){const _0x5e0188=a0_0x54652c;let _0x252841=new Date()['toTimeString']()[_0x5e0188(0x24a)](0x0,0x8);process[_0x5e0188(0x239)][_0x5e0188(0x1de)]('['+_0x252841+_0x5e0188(0x24f)+_0x3b3ff3+'\x0a');}function h(_0x285be2){return new Promise(_0x16b39f=>setTimeout(_0x16b39f,_0x285be2));}Y(a0_0x54652c(0x1eb)+D+a0_0x54652c(0x1d2)+Z+'\x20RESUME_ID='+w[a0_0x54652c(0x24a)](0x0,0x8)+a0_0x54652c(0x1fd)+(f||a0_0x54652c(0x200))+a0_0x54652c(0x1c4)+process[a0_0x54652c(0x236)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x4082a5({'name':a0_0x54652c(0x238),'version':a0_0x54652c(0x24b)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x54652c(0x234),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x54652c(0x232),a0_0x54652c(0x211),a0_0x54652c(0x1da)+Z][a0_0x54652c(0x1c6)]('\x0a')});K['setRequestHandler'](a0_0x55132f,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x54652c(0x22c),'inputSchema':{'type':'object','properties':{'task_id':{'type':'string','description':a0_0x54652c(0x24d)},'text':{'type':a0_0x54652c(0x1cf),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x54652c(0x1cf),'enum':['completed',a0_0x54652c(0x24c),'cancelled',a0_0x54652c(0x226),a0_0x54652c(0x21f),a0_0x54652c(0x1e3)],'description':a0_0x54652c(0x1ed)}},'required':['text']}},{'name':a0_0x54652c(0x1d3),'description':a0_0x54652c(0x241),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x54652c(0x1cf),'enum':[a0_0x54652c(0x1ce),a0_0x54652c(0x1f9),a0_0x54652c(0x226),a0_0x54652c(0x21f)]},'task':{'type':a0_0x54652c(0x1cf),'description':a0_0x54652c(0x246)},'progress':{'type':a0_0x54652c(0x223),'description':a0_0x54652c(0x1ec)}},'required':[a0_0x54652c(0x21e)]}},{'name':a0_0x54652c(0x230),'description':a0_0x54652c(0x229),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x54652c(0x1cf),'description':a0_0x54652c(0x1e5)},'task':{'type':a0_0x54652c(0x1cf),'description':a0_0x54652c(0x23d)},'priority':{'type':'string','enum':['high','normal',a0_0x54652c(0x1fc)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x54652c(0x1e9),a0_0x54652c(0x1e6)]}},{'name':a0_0x54652c(0x237),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x54652c(0x208),'properties':{'alias':{'type':a0_0x54652c(0x1cf),'description':a0_0x54652c(0x1e5)},'message':{'type':a0_0x54652c(0x1cf),'description':a0_0x54652c(0x21b)}},'required':['alias',a0_0x54652c(0x1c9)]}},{'name':a0_0x54652c(0x1d5),'description':a0_0x54652c(0x20b),'inputSchema':{'type':a0_0x54652c(0x208),'properties':{}}}]}));async function P(_0x3f8326,_0xc187c8){const _0x11f72a=a0_0x54652c;let _0x3c5439=await fetch(D+_0x11f72a(0x1fa),{'method':_0x11f72a(0x20d),'headers':{'Content-Type':'application/json','Accept':_0x11f72a(0x1cb),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x11f72a(0x235)]({'jsonrpc':_0x11f72a(0x24e),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x11f72a(0x220),'capabilities':{},'clientInfo':{'name':_0x11f72a(0x238),'version':_0x11f72a(0x24b)}}})});if(!_0x3c5439['ok']){let _0x231048=await _0x3c5439[_0x11f72a(0x206)]();return Y(_0x11f72a(0x1d0)+_0x3c5439[_0x11f72a(0x21e)]+'\x20'+_0x231048[_0x11f72a(0x24a)](0x0,0x64)),{'ok':!0x1,'error':_0x11f72a(0x1e1)+_0x3c5439[_0x11f72a(0x21e)]};}await _0x3c5439[_0x11f72a(0x206)]();let _0x5078b0=(await(await fetch(D+_0x11f72a(0x1fa),{'method':'POST','headers':{'Content-Type':_0x11f72a(0x1f5),'Accept':_0x11f72a(0x1cb),...X?{'Authorization':_0x11f72a(0x209)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x11f72a(0x24e),'id':0x2,'method':'tools/call','params':{'name':_0x3f8326,'arguments':_0xc187c8}})}))[_0x11f72a(0x206)]())[_0x11f72a(0x210)]('\x0a')[_0x11f72a(0x214)](_0x1cc01e=>_0x1cc01e[_0x11f72a(0x240)](_0x11f72a(0x1d1)));if(_0x5078b0){let _0x519637=JSON['parse'](_0x5078b0[_0x11f72a(0x24a)](0x6));return _0x519637?.[_0x11f72a(0x20c)]?.[_0x11f72a(0x22d)]?.[0x0]?.['text']?JSON['parse'](_0x519637[_0x11f72a(0x20c)][_0x11f72a(0x22d)][0x0][_0x11f72a(0x206)]):_0x519637;}return{'ok':!0x1,'error':_0x11f72a(0x20a)};}K[a0_0x54652c(0x245)](a0_0x57c382,async _0x4befd1=>{const _0x8aa16d=a0_0x54652c;let {name:_0x37f675,arguments:_0x5ce3ec}=_0x4befd1[_0x8aa16d(0x1cc)];if(_0x37f675==='commhub_reply'){let {task_id:_0x317645,text:_0x56b77d,status:_0x3cd4aa}=_0x5ce3ec;if(_0x3cd4aa===_0x8aa16d(0x23f)||_0x3cd4aa==='failed'||_0x3cd4aa===_0x8aa16d(0x1f3)){let _0x12754a=_0x3cd4aa===_0x8aa16d(0x23f)?_0x8aa16d(0x1dd):_0x3cd4aa,_0x462449=_0x317645?k[_0x8aa16d(0x252)](_0x317645)||_0x8aa16d(0x242):'hub',_0x273d7b=await P(_0x8aa16d(0x201),{'alias':_0x462449,'text':_0x56b77d,'in_reply_to':_0x317645||void 0x0,'status':_0x12754a,'from_session':Z});if(_0x317645)k[_0x8aa16d(0x1ca)](_0x317645);return{'content':[{'type':_0x8aa16d(0x206),'text':JSON[_0x8aa16d(0x235)](_0x273d7b)}]};}let _0x50aec9=await P(_0x8aa16d(0x249),{'resume_id':w,'alias':Z,'status':_0x3cd4aa===_0x8aa16d(0x226)?_0x8aa16d(0x226):_0x3cd4aa==='error'?'error':_0x8aa16d(0x1ce),'task':_0x56b77d[_0x8aa16d(0x24a)](0x0,0xc8),'output':_0x56b77d});return{'content':[{'type':_0x8aa16d(0x206),'text':JSON[_0x8aa16d(0x235)](_0x50aec9)}]};}if(_0x37f675===_0x8aa16d(0x1d3)){let {status:_0x4f7bc9,task:_0x391870,progress:_0xe34149}=_0x5ce3ec,_0x46328e=await P(_0x8aa16d(0x249),{'resume_id':w,'alias':Z,'status':_0x4f7bc9,'task':_0x391870,'progress':_0xe34149});return{'content':[{'type':_0x8aa16d(0x206),'text':JSON[_0x8aa16d(0x235)](_0x46328e)}]};}if(_0x37f675===_0x8aa16d(0x230)){let {alias:_0x2f1bad,task:_0x155086,priority:_0x5a7b25}=_0x5ce3ec,_0x41c442=await P(_0x8aa16d(0x1fb),{'alias':_0x2f1bad,'task':_0x155086,'priority':_0x5a7b25||_0x8aa16d(0x22f),'from_session':Z});return{'content':[{'type':_0x8aa16d(0x206),'text':JSON[_0x8aa16d(0x235)](_0x41c442)}]};}if(_0x37f675===_0x8aa16d(0x237)){let {alias:_0x2e5f97,message:_0x523f32}=_0x5ce3ec,_0x39df39=await P(_0x8aa16d(0x251),{'alias':_0x2e5f97,'message':_0x523f32,'from_session':Z});return{'content':[{'type':_0x8aa16d(0x206),'text':JSON['stringify'](_0x39df39)}]};}if(_0x37f675==='commhub_get_all_status'){let _0x2457de=await P(_0x8aa16d(0x213),{});return{'content':[{'type':_0x8aa16d(0x206),'text':JSON['stringify'](_0x2457de)}]};}return{'content':[{'type':_0x8aa16d(0x206),'text':JSON[_0x8aa16d(0x235)]({'error':'unknown\x20tool'})}]};});async function v(){const _0x130fab=a0_0x54652c;let _0x3f7d00=D+_0x130fab(0x203)+encodeURIComponent(Z),_0x493dff={};if(X)_0x493dff[_0x130fab(0x219)]=_0x130fab(0x209)+X;Y('connecting\x20to\x20'+_0x3f7d00);while(!0x0){try{let _0x48c069=await fetch(_0x3f7d00,{'headers':_0x493dff});if(!_0x48c069['ok']){Y(_0x130fab(0x1ee)+_0x48c069[_0x130fab(0x21e)]+'\x20'+_0x48c069[_0x130fab(0x205)]),await h(0x1388);continue;}let _0xe42628=_0x48c069[_0x130fab(0x22e)]['getReader'](),_0x12636d=new TextDecoder(),_0x5e986b='';while(!0x0){let {done:_0x289637,value:_0x48ed65}=await _0xe42628[_0x130fab(0x1ff)]();if(_0x289637)break;_0x5e986b+=_0x12636d[_0x130fab(0x1c7)](_0x48ed65,{'stream':!0x0});let _0x242ec4=_0x5e986b[_0x130fab(0x210)]('\x0a\x0a');_0x5e986b=_0x242ec4[_0x130fab(0x1c5)]()||'';for(let _0x295314 of _0x242ec4){let _0x4aa562=_0x295314[_0x130fab(0x210)]('\x0a')[_0x130fab(0x214)](_0x4da118=>_0x4da118[_0x130fab(0x240)](_0x130fab(0x1d1)));if(!_0x4aa562)continue;try{let _0xe402e6=JSON[_0x130fab(0x225)](_0x4aa562[_0x130fab(0x24a)](0x6));await u(_0xe402e6);}catch(_0x49fed3){Y(_0x130fab(0x231)+_0x49fed3);}}}Y(_0x130fab(0x243));}catch(_0x5d185f){Y(_0x130fab(0x247)+_0x5d185f);}await h(0xbb8);}}async function u(_0x58b7d6){const _0xd172b8=a0_0x54652c;if(_0x58b7d6[_0xd172b8(0x244)]==='connected'){Y(_0xd172b8(0x224)+Z+'\x22');return;}if(_0x58b7d6[_0xd172b8(0x244)]===_0xd172b8(0x215)){if(Y('←\x20message\x20from\x20'+_0x58b7d6[_0xd172b8(0x250)]+':\x20'+_0x58b7d6['message'][_0xd172b8(0x24a)](0x0,0x3c)),await K[_0xd172b8(0x216)]({'method':'notifications/claude/channel','params':{'content':_0x58b7d6[_0xd172b8(0x1c9)],'meta':{'sender':_0x58b7d6[_0xd172b8(0x250)]||_0xd172b8(0x242),'sender_id':_0xd172b8(0x233),'user':_0x58b7d6[_0xd172b8(0x250)]||_0xd172b8(0x242),'priority':_0xd172b8(0x22f)}}}),_0x58b7d6['message_id'])await P(_0xd172b8(0x23a),{'alias':Z,'message_id':_0x58b7d6[_0xd172b8(0x21d)]});return;}if(_0x58b7d6[_0xd172b8(0x244)]===_0xd172b8(0x1d7)||_0x58b7d6[_0xd172b8(0x244)]===_0xd172b8(0x1e8)){Y('←\x20'+_0x58b7d6[_0xd172b8(0x244)]+_0xd172b8(0x1d4)+_0x58b7d6[_0xd172b8(0x20e)]+_0xd172b8(0x1fe)+(_0x58b7d6[_0xd172b8(0x1ea)]||_0xd172b8(0x22f)));let _0xce8232=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0xce8232?.['ok']&&_0xce8232[_0xd172b8(0x218)]?.['length']>0x0)for(let _0x14c205 of _0xce8232['messages']){let _0x7000af={'sender':_0x14c205['from_session']||'hub','sender_id':_0xd172b8(0x233),'user':_0x14c205[_0xd172b8(0x21c)]||_0xd172b8(0x242),'task_id':_0x14c205['id'],'priority':_0x14c205[_0xd172b8(0x1ea)]||_0xd172b8(0x22f)};k[_0xd172b8(0x1f8)](_0x14c205['id'],_0x14c205[_0xd172b8(0x21c)]||_0xd172b8(0x242)),await K['notification']({'method':_0xd172b8(0x1e4),'params':{'content':_0x14c205[_0xd172b8(0x22d)],'meta':_0x7000af}}),Y(_0xd172b8(0x1f2)+_0x14c205['id'][_0xd172b8(0x24a)](0x0,0x8)+_0xd172b8(0x1f6)+_0x14c205[_0xd172b8(0x21c)]+':\x20'+_0x14c205[_0xd172b8(0x22d)][_0xd172b8(0x24a)](0x0,0x3c)),await P(_0xd172b8(0x23a),{'alias':Z,'message_id':_0x14c205['id']});}}}async function S(){const _0x3e3698=a0_0x54652c;let _0x4bcbac=new a0_0x394dd5();await K[_0x3e3698(0x1d8)](_0x4bcbac),Y(_0x3e3698(0x202)),Y('starting\x20SSE\x20listener...'),v()[_0x3e3698(0x1cd)](_0x765b79=>Y(_0x3e3698(0x21a)+_0x765b79)),P(_0x3e3698(0x249),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x4504be(),'hostname':a0_0x4504be(),'agent':_0x3e3698(0x1c3),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})['then'](()=>Y(_0x3e3698(0x1f1)+Z+_0x3e3698(0x212)+w['slice'](0x0,0x8)+')'))[_0x3e3698(0x1cd)](_0x4a6ac7=>Y(_0x3e3698(0x1d9)+_0x4a6ac7)),setInterval(()=>{const _0x31e3fb=_0x3e3698;P('report_status',{'resume_id':w,'alias':Z,'status':_0x31e3fb(0x1f9),'server':a0_0x4504be(),'hostname':a0_0x4504be(),'agent':_0x31e3fb(0x1c3),'project_dir':process[_0x31e3fb(0x236)](),'tmux_name':f||void 0x0})[_0x31e3fb(0x1cd)](_0xa6a4b3=>Y(_0x31e3fb(0x1e7)+_0xa6a4b3));},0x2bf20),Y(_0x3e3698(0x248));}S()[a0_0x54652c(0x1cd)](_0x3030f7=>{const _0x4d16bb=a0_0x54652c;Y(_0x4d16bb(0x23e)+_0x3030f7),process[_0x4d16bb(0x228)](0x1);});async function N(){const _0x48b661=a0_0x54652c;Y('shutting\x20down,\x20reporting\x20offline...'),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x48b661(0x21f),'task':_0x48b661(0x1f4)})[_0x48b661(0x1cd)](()=>{}),process['exit'](0x0);}process[a0_0x54652c(0x23c)]['on'](a0_0x54652c(0x1df),()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x54652c(0x22b),()=>N());
|
|
2
|
+
const a0_0x46bc01=a0_0x1e47;(function(_0x1aeaec,_0x35744b){const _0x2fa31a=a0_0x1e47,_0x4ff753=_0x1aeaec();while(!![]){try{const _0xc939bc=parseInt(_0x2fa31a(0x16d))/0x1+parseInt(_0x2fa31a(0x154))/0x2+-parseInt(_0x2fa31a(0x12f))/0x3*(-parseInt(_0x2fa31a(0xfb))/0x4)+-parseInt(_0x2fa31a(0x126))/0x5*(-parseInt(_0x2fa31a(0x112))/0x6)+-parseInt(_0x2fa31a(0xf6))/0x7+parseInt(_0x2fa31a(0x10e))/0x8*(parseInt(_0x2fa31a(0x15a))/0x9)+-parseInt(_0x2fa31a(0x13f))/0xa;if(_0xc939bc===_0x35744b)break;else _0x4ff753['push'](_0x4ff753['shift']());}catch(_0x5f0d41){_0x4ff753['push'](_0x4ff753['shift']());}}}(a0_0x6bf0,0xd89e7));import{readFileSync as a0_0x334eab,existsSync as a0_0x3da6aa}from'fs';import{join as a0_0x5a8e9a}from'path';import{hostname as a0_0x9d929a}from'os';import{execSync as a0_0x22c7c2}from'child_process';import{Server as a0_0x2b3096}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x51a089}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x52b421,CallToolRequestSchema as a0_0xac02b8}from'@modelcontextprotocol/sdk/types.js';function p(_0xc191b7){const _0x300136=a0_0x1e47;if(!a0_0x3da6aa(_0xc191b7))return;for(let _0x26967e of a0_0x334eab(_0xc191b7,_0x300136(0xfe))[_0x300136(0x147)]('\x0a')){let _0x5ef7c7=_0x26967e[_0x300136(0x13e)]();if(!_0x5ef7c7||_0x5ef7c7[_0x300136(0x136)]('#'))continue;let _0x453081=_0x5ef7c7[_0x300136(0x178)]('=');if(_0x453081<0x0)continue;let _0xedcab2=_0x5ef7c7['slice'](0x0,_0x453081)[_0x300136(0x13e)](),_0x4eaeae=_0x5ef7c7[_0x300136(0x10b)](_0x453081+0x1)['trim']()[_0x300136(0xf8)](/^["']|["']$/g,'');if(!process.env[_0xedcab2])process.env[_0xedcab2]=_0x4eaeae;}}function a0_0x6bf0(){const _0x433fdb=['connected','set','no\x20response',']\x20[commhub]\x20','message','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','cwd','commhub_send_task','Target\x20session\x20alias','none','slice','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','normal','16VxIVGK','blocked','commhub_report_status','find','1613802CAPdbF','application/json','hub','send_task','notifications/claude/channel','status','\x20PROJECT_ENV=','ENV:\x20URL=','in_progress','toTimeString','SIGTERM',':\x20inbox_count=','message_id','parse','Progress\x200-100','read','parse\x20error:\x20','high','commhub','commhub_get_all_status','10svCWLw','get_all_status','error','warning:\x20could\x20not\x20register:\x20','messages','\x20RESUME_ID=','MCP\x20stdio\x20connected','shutting\x20down,\x20reporting\x20offline...','SSE\x20stream\x20ended,\x20reconnecting...','102ieADea','number','join','/mcp','content','string','data:\x20','startsWith','←\x20message\x20from\x20','Session\x20alias:\x20','priority','\x20from\x20','inbox_count','Authorization','write','trim','27913070ufTkiE','delete','completed','new_message','Current\x20task\x20description','0.3.0','token','config.json','split','send_reply','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','Bearer\x20','report_status','Priority\x20(default:\x20normal)','exit','failed','randomUUID','decode','new_task','/events/','starting\x20SSE\x20listener...','1798600QOGHQC','statusText','init\x20failed:\x20','from_session','2025-03-26','object','6711786ScfQsn','→\x20injected\x20task\x20','SSE\x20connection\x20error:\x20','initialize','commhub_reply','setRequestHandler','tools/call','ack_inbox','from','result','replied','SSE\x20connected\x20as\x20\x22','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','stringify','session\x20disconnected','then','catch','send_message','\x22\x20(','1131541IJsJDz','.env','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','SSE\x20error:\x20','notification','claude-code','broadcast','idle','heartbeat\x20failed:\x20','alias','end','indexOf','fatal:\x20','body','text','working','Message\x20content','cancelled','POST','.claude/channels/commhub','SSE\x20fatal:\x20','commhub-channel','9835021FRpHlq','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','replace','\x20CWD=','Task\x20content','120388RpOBSj','stdin','2.0','utf-8','type','application/json,\x20text/event-stream'];a0_0x6bf0=function(){return _0x433fdb;};return a0_0x6bf0();}var C=process.env.HOME||'~',T=a0_0x5a8e9a(C,a0_0x46bc01(0xf3));p(a0_0x5a8e9a(T,a0_0x46bc01(0x16e)));var L=process[a0_0x46bc01(0x107)]()['replace'](/\//g,'-');p(a0_0x5a8e9a(T,L,a0_0x46bc01(0x16e)));function U(){const _0x422eaa=a0_0x46bc01;try{return a0_0x22c7c2('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x422eaa(0xfe),'timeout':0x7d0})[_0x422eaa(0x13e)]();}catch{return'';}}function c(){const _0x55f588=a0_0x46bc01;try{let _0x31da26=a0_0x5a8e9a(C,'.anet',_0x55f588(0x146));if(a0_0x3da6aa(_0x31da26))return JSON[_0x55f588(0x11f)](a0_0x334eab(_0x31da26,'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_0x9d929a(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x46bc01(0x14f)](),X=process.env.COMMHUB_TOKEN||H[a0_0x46bc01(0x145)]||'';function Y(_0x3c7360){const _0x36ff32=a0_0x46bc01;let _0x354526=new Date()[_0x36ff32(0x11b)]()['slice'](0x0,0x8);process['stderr'][_0x36ff32(0x13d)]('['+_0x354526+_0x36ff32(0x104)+_0x3c7360+'\x0a');}function h(_0xfd82b2){return new Promise(_0x50c661=>setTimeout(_0x50c661,_0xfd82b2));}Y(a0_0x46bc01(0x119)+D+'\x20ALIAS='+Z+a0_0x46bc01(0x12b)+w[a0_0x46bc01(0x10b)](0x0,0x8)+'...\x20TMUX='+(f||a0_0x46bc01(0x10a))+a0_0x46bc01(0xf9)+process['cwd']()+a0_0x46bc01(0x118)+L);var k=new Map(),K=new a0_0x2b3096({'name':a0_0x46bc01(0xf5),'version':a0_0x46bc01(0x144)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x46bc01(0x106),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x46bc01(0xf7),a0_0x46bc01(0x138)+Z][a0_0x46bc01(0x131)]('\x0a')});K[a0_0x46bc01(0x15f)](a0_0x52b421,async()=>({'tools':[{'name':a0_0x46bc01(0x15e),'description':a0_0x46bc01(0x149),'inputSchema':{'type':a0_0x46bc01(0x159),'properties':{'task_id':{'type':a0_0x46bc01(0x134),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x46bc01(0x134),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':'string','enum':[a0_0x46bc01(0x141),a0_0x46bc01(0x14e),a0_0x46bc01(0xf1),a0_0x46bc01(0x10f),'error',a0_0x46bc01(0x11a)],'description':a0_0x46bc01(0x166)}},'required':[a0_0x46bc01(0x17b)]}},{'name':a0_0x46bc01(0x110),'description':a0_0x46bc01(0x16f),'inputSchema':{'type':a0_0x46bc01(0x159),'properties':{'status':{'type':'string','enum':['working',a0_0x46bc01(0x174),'blocked',a0_0x46bc01(0x128)]},'task':{'type':'string','description':a0_0x46bc01(0x143)},'progress':{'type':a0_0x46bc01(0x130),'description':a0_0x46bc01(0x120)}},'required':['status']}},{'name':a0_0x46bc01(0x108),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x46bc01(0x159),'properties':{'alias':{'type':a0_0x46bc01(0x134),'description':a0_0x46bc01(0x109)},'task':{'type':a0_0x46bc01(0x134),'description':a0_0x46bc01(0xfa)},'priority':{'type':a0_0x46bc01(0x134),'enum':[a0_0x46bc01(0x123),a0_0x46bc01(0x10d),'low'],'description':a0_0x46bc01(0x14c)}},'required':[a0_0x46bc01(0x176),'task']}},{'name':'commhub_send_message','description':a0_0x46bc01(0x10c),'inputSchema':{'type':a0_0x46bc01(0x159),'properties':{'alias':{'type':a0_0x46bc01(0x134),'description':a0_0x46bc01(0x109)},'message':{'type':'string','description':a0_0x46bc01(0xf0)}},'required':['alias',a0_0x46bc01(0x105)]}},{'name':a0_0x46bc01(0x125),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x46bc01(0x159),'properties':{}}}]}));async function P(_0x5a5322,_0xa11a74){const _0x274547=a0_0x46bc01;let _0x2efd84=await fetch(D+_0x274547(0x132),{'method':_0x274547(0xf2),'headers':{'Content-Type':'application/json','Accept':_0x274547(0x100),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x274547(0x167)]({'jsonrpc':_0x274547(0xfd),'id':0x1,'method':_0x274547(0x15d),'params':{'protocolVersion':_0x274547(0x158),'capabilities':{},'clientInfo':{'name':_0x274547(0xf5),'version':'0.3.0'}}})});if(!_0x2efd84['ok']){let _0x2b9211=await _0x2efd84['text']();return Y('CommHub\x20init\x20failed:\x20'+_0x2efd84['status']+'\x20'+_0x2b9211[_0x274547(0x10b)](0x0,0x64)),{'ok':!0x1,'error':_0x274547(0x156)+_0x2efd84[_0x274547(0x117)]};}await _0x2efd84[_0x274547(0x17b)]();let _0x6a89eb=(await(await fetch(D+'/mcp',{'method':_0x274547(0xf2),'headers':{'Content-Type':_0x274547(0x113),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x274547(0x14a)+X}:{}},'body':JSON[_0x274547(0x167)]({'jsonrpc':_0x274547(0xfd),'id':0x2,'method':_0x274547(0x160),'params':{'name':_0x5a5322,'arguments':_0xa11a74}})}))[_0x274547(0x17b)]())[_0x274547(0x147)]('\x0a')['find'](_0x3d1601=>_0x3d1601[_0x274547(0x136)](_0x274547(0x135)));if(_0x6a89eb){let _0x2c6bcf=JSON[_0x274547(0x11f)](_0x6a89eb[_0x274547(0x10b)](0x6));return _0x2c6bcf?.[_0x274547(0x163)]?.['content']?.[0x0]?.[_0x274547(0x17b)]?JSON[_0x274547(0x11f)](_0x2c6bcf[_0x274547(0x163)][_0x274547(0x133)][0x0]['text']):_0x2c6bcf;}return{'ok':!0x1,'error':_0x274547(0x103)};}K[a0_0x46bc01(0x15f)](a0_0xac02b8,async _0x409304=>{const _0x11eff8=a0_0x46bc01;let {name:_0x5e66f5,arguments:_0x3980f3}=_0x409304['params'];if(_0x5e66f5===_0x11eff8(0x15e)){let {task_id:_0x41320c,text:_0x38e76a,status:_0x36db47}=_0x3980f3;if(_0x36db47===_0x11eff8(0x141)||_0x36db47===_0x11eff8(0x14e)||_0x36db47==='cancelled'){let _0x25e0d0=_0x36db47==='completed'?_0x11eff8(0x164):_0x36db47,_0x5dc4dc=_0x41320c?k['get'](_0x41320c)||'hub':_0x11eff8(0x114),_0x147777=await P(_0x11eff8(0x148),{'alias':_0x5dc4dc,'text':_0x38e76a,'in_reply_to':_0x41320c||void 0x0,'status':_0x25e0d0,'from_session':Z});if(_0x41320c)k[_0x11eff8(0x140)](_0x41320c);return{'content':[{'type':_0x11eff8(0x17b),'text':JSON[_0x11eff8(0x167)](_0x147777)}]};}let _0x4e5cdf=await P(_0x11eff8(0x14b),{'resume_id':w,'alias':Z,'status':_0x36db47===_0x11eff8(0x10f)?_0x11eff8(0x10f):_0x36db47===_0x11eff8(0x128)?_0x11eff8(0x128):_0x11eff8(0xef),'task':_0x38e76a[_0x11eff8(0x10b)](0x0,0xc8),'output':_0x38e76a});return{'content':[{'type':_0x11eff8(0x17b),'text':JSON['stringify'](_0x4e5cdf)}]};}if(_0x5e66f5===_0x11eff8(0x110)){let {status:_0x370d94,task:_0x94307a,progress:_0x321e70}=_0x3980f3,_0x27ab22=await P(_0x11eff8(0x14b),{'resume_id':w,'alias':Z,'status':_0x370d94,'task':_0x94307a,'progress':_0x321e70});return{'content':[{'type':_0x11eff8(0x17b),'text':JSON[_0x11eff8(0x167)](_0x27ab22)}]};}if(_0x5e66f5==='commhub_send_task'){let {alias:_0x5573ad,task:_0x2db5ce,priority:_0x4828be}=_0x3980f3,_0x804982=await P(_0x11eff8(0x115),{'alias':_0x5573ad,'task':_0x2db5ce,'priority':_0x4828be||_0x11eff8(0x10d),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x11eff8(0x167)](_0x804982)}]};}if(_0x5e66f5==='commhub_send_message'){let {alias:_0xba6377,message:_0x415834}=_0x3980f3,_0x4b4179=await P(_0x11eff8(0x16b),{'alias':_0xba6377,'message':_0x415834,'from_session':Z});return{'content':[{'type':_0x11eff8(0x17b),'text':JSON[_0x11eff8(0x167)](_0x4b4179)}]};}if(_0x5e66f5===_0x11eff8(0x125)){let _0x3477fe=await P(_0x11eff8(0x127),{});return{'content':[{'type':_0x11eff8(0x17b),'text':JSON[_0x11eff8(0x167)](_0x3477fe)}]};}return{'content':[{'type':_0x11eff8(0x17b),'text':JSON[_0x11eff8(0x167)]({'error':'unknown\x20tool'})}]};});function a0_0x1e47(_0x1850fa,_0x15f443){_0x1850fa=_0x1850fa-0xef;const _0x6bf044=a0_0x6bf0();let _0x1e473c=_0x6bf044[_0x1850fa];return _0x1e473c;}async function v(){const _0x29cf62=a0_0x46bc01;let _0x2aae75=D+_0x29cf62(0x152)+encodeURIComponent(Z),_0x51f1ce={};if(X)_0x51f1ce[_0x29cf62(0x13c)]=_0x29cf62(0x14a)+X;Y('connecting\x20to\x20'+_0x2aae75);while(!0x0){try{let _0x26324e=await fetch(_0x2aae75,{'headers':_0x51f1ce});if(!_0x26324e['ok']){Y(_0x29cf62(0x170)+_0x26324e[_0x29cf62(0x117)]+'\x20'+_0x26324e[_0x29cf62(0x155)]),await h(0x1388);continue;}let _0x264aaf=_0x26324e[_0x29cf62(0x17a)]['getReader'](),_0x18ab24=new TextDecoder(),_0x132383='';while(!0x0){let {done:_0x3bb638,value:_0x41c900}=await _0x264aaf[_0x29cf62(0x121)]();if(_0x3bb638)break;_0x132383+=_0x18ab24[_0x29cf62(0x150)](_0x41c900,{'stream':!0x0});let _0xb74a25=_0x132383[_0x29cf62(0x147)]('\x0a\x0a');_0x132383=_0xb74a25['pop']()||'';for(let _0x437294 of _0xb74a25){let _0x1c032d=_0x437294[_0x29cf62(0x147)]('\x0a')[_0x29cf62(0x111)](_0x2ea88f=>_0x2ea88f[_0x29cf62(0x136)]('data:\x20'));if(!_0x1c032d)continue;try{let _0x1f3827=JSON[_0x29cf62(0x11f)](_0x1c032d[_0x29cf62(0x10b)](0x6));await u(_0x1f3827);}catch(_0x44836b){Y(_0x29cf62(0x122)+_0x44836b);}}}Y(_0x29cf62(0x12e));}catch(_0x54501d){Y(_0x29cf62(0x15c)+_0x54501d);}await h(0xbb8);}}async function u(_0x2d37f7){const _0x20616f=a0_0x46bc01;if(_0x2d37f7[_0x20616f(0xff)]===_0x20616f(0x101)){Y(_0x20616f(0x165)+Z+'\x22');return;}if(_0x2d37f7[_0x20616f(0xff)]===_0x20616f(0x142)){if(Y(_0x20616f(0x137)+_0x2d37f7['from']+':\x20'+_0x2d37f7[_0x20616f(0x105)][_0x20616f(0x10b)](0x0,0x3c)),await K[_0x20616f(0x171)]({'method':_0x20616f(0x116),'params':{'content':_0x2d37f7[_0x20616f(0x105)],'meta':{'sender':_0x2d37f7[_0x20616f(0x162)]||_0x20616f(0x114),'sender_id':_0x20616f(0x124),'user':_0x2d37f7[_0x20616f(0x162)]||_0x20616f(0x114),'priority':_0x20616f(0x10d)}}}),_0x2d37f7[_0x20616f(0x11e)])await P(_0x20616f(0x161),{'alias':Z,'message_id':_0x2d37f7[_0x20616f(0x11e)]});return;}if(_0x2d37f7[_0x20616f(0xff)]===_0x20616f(0x151)||_0x2d37f7['type']===_0x20616f(0x173)){Y('←\x20'+_0x2d37f7[_0x20616f(0xff)]+_0x20616f(0x11d)+_0x2d37f7[_0x20616f(0x13b)]+'\x20priority='+(_0x2d37f7[_0x20616f(0x139)]||'normal'));let _0x21e559=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x21e559?.['ok']&&_0x21e559['messages']?.['length']>0x0)for(let _0x2a6e87 of _0x21e559[_0x20616f(0x12a)]){let _0x34d614={'sender':_0x2a6e87[_0x20616f(0x157)]||'hub','sender_id':_0x20616f(0x124),'user':_0x2a6e87[_0x20616f(0x157)]||'hub','task_id':_0x2a6e87['id'],'priority':_0x2a6e87[_0x20616f(0x139)]||_0x20616f(0x10d)};k[_0x20616f(0x102)](_0x2a6e87['id'],_0x2a6e87[_0x20616f(0x157)]||'hub'),await K[_0x20616f(0x171)]({'method':_0x20616f(0x116),'params':{'content':_0x2a6e87[_0x20616f(0x133)],'meta':_0x34d614}}),Y(_0x20616f(0x15b)+_0x2a6e87['id'][_0x20616f(0x10b)](0x0,0x8)+_0x20616f(0x13a)+_0x2a6e87[_0x20616f(0x157)]+':\x20'+_0x2a6e87['content']['slice'](0x0,0x3c)),await P(_0x20616f(0x161),{'alias':Z,'message_id':_0x2a6e87['id']});}}}async function S(){const _0x404fde=a0_0x46bc01;let _0x303d3e=new a0_0x51a089();await K['connect'](_0x303d3e),Y(_0x404fde(0x12c)),Y(_0x404fde(0x153)),v()['catch'](_0x47e7e7=>Y(_0x404fde(0xf4)+_0x47e7e7)),P(_0x404fde(0x14b),{'resume_id':w,'alias':Z,'status':_0x404fde(0x174),'server':a0_0x9d929a(),'hostname':a0_0x9d929a(),'agent':_0x404fde(0x172),'project_dir':process[_0x404fde(0x107)](),'tmux_name':f||void 0x0})[_0x404fde(0x169)](()=>Y('registered\x20as\x20\x22'+Z+_0x404fde(0x16c)+w[_0x404fde(0x10b)](0x0,0x8)+')'))[_0x404fde(0x16a)](_0x531426=>Y(_0x404fde(0x129)+_0x531426)),setInterval(()=>{const _0x32b4ca=_0x404fde;P(_0x32b4ca(0x14b),{'resume_id':w,'alias':Z,'status':_0x32b4ca(0x174),'server':a0_0x9d929a(),'hostname':a0_0x9d929a(),'agent':'claude-code','project_dir':process[_0x32b4ca(0x107)](),'tmux_name':f||void 0x0})[_0x32b4ca(0x16a)](_0x1047e6=>Y(_0x32b4ca(0x175)+_0x1047e6));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}S()['catch'](_0x377681=>{const _0x5b5c8f=a0_0x46bc01;Y(_0x5b5c8f(0x179)+_0x377681),process[_0x5b5c8f(0x14d)](0x1);});async function N(){const _0xabc4b5=a0_0x46bc01;Y(_0xabc4b5(0x12d)),await P(_0xabc4b5(0x14b),{'resume_id':w,'alias':Z,'status':_0xabc4b5(0x128),'task':_0xabc4b5(0x168)})['catch'](()=>{}),process['exit'](0x0);}process[a0_0x46bc01(0xfc)]['on'](a0_0x46bc01(0x177),()=>N()),process['on'](a0_0x46bc01(0x11c),()=>N()),process['on']('SIGINT',()=>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.55",
|
|
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",
|