@sleep2agi/agent-network 2.1.6-preview.2 → 2.1.7-preview.1
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
|
-
const
|
|
1
|
+
function a0_0x4c06(_0x4278ed,_0x52979c){_0x4278ed=_0x4278ed-0x1ca;const _0x2dcd0b=a0_0x2dcd();let _0x4c0603=_0x2dcd0b[_0x4278ed];return _0x4c0603;}function a0_0x2dcd(){const _0x56312f=['/events/','log','4459464OxKQiP','type','abort','reply','send_reply',']\x20[commhub:','messages','data:\x20','body','connect','completed','1165966OnJLpQ','SSE\x20reconnecting\x20in\x20','now','disconnect','send','160152FjzzqS','getReader','error','send_message','new_task','from_session','get_all_status','new_message','application/json','AbortError','parse','disconnected','heartbeatInterval','min','toString','sdk','sleep','status','processInbox','text/event-stream','Authorization','broadcast','8OUttEP','normal','getAllStatus','call','text','task','alias','9290350chTqis','name','resumeId','Bearer\x20','registered','read','9anMSOf','reconnectDelay','offline','slice','cwd','autoConnect','862673NBDEdh','token','SSE\x20connected','562108LJbfdw','heartbeatTimer','POST','ack_inbox','connected','577775fPbwQV','heartbeat\x20failed:\x20','message','content','idle','agent','get_inbox','signal','emit','server','running','toTimeString','/mcp','inbox\x20error:\x20','s...','url','connectSSE','send_task','startsWith','catch','sseAbort','75lMKcrb'];a0_0x2dcd=function(){return _0x56312f;};return a0_0x2dcd();}const a0_0x1bcb36=a0_0x4c06;(function(_0x3ae62a,_0x4f4f81){const _0x152414=a0_0x4c06,_0x34be04=_0x3ae62a();while(!![]){try{const _0x382fbe=-parseInt(_0x152414(0x218))/0x1+parseInt(_0x152414(0x1e2))/0x2+-parseInt(_0x152414(0x20a))/0x3*(-parseInt(_0x152414(0x213))/0x4)+parseInt(_0x152414(0x1d4))/0x5*(-parseInt(_0x152414(0x1e7))/0x6)+-parseInt(_0x152414(0x210))/0x7*(parseInt(_0x152414(0x1fd))/0x8)+-parseInt(_0x152414(0x1d7))/0x9+parseInt(_0x152414(0x204))/0xa;if(_0x382fbe===_0x4f4f81)break;else _0x34be04['push'](_0x34be04['shift']());}catch(_0x1ab0fb){_0x34be04['push'](_0x34be04['shift']());}}}(a0_0x2dcd,0x52345));import{EventEmitter as a0_0xbed7b2}from'events';import{hostname as a0_0x187a06}from'os';class T extends a0_0xbed7b2{[a0_0x1bcb36(0x1ce)];[a0_0x1bcb36(0x203)];['token'];['agent'];[a0_0x1bcb36(0x206)];[a0_0x1bcb36(0x1f3)];[a0_0x1bcb36(0x20b)];[a0_0x1bcb36(0x214)];[a0_0x1bcb36(0x1d3)];[a0_0x1bcb36(0x222)]=!0x1;constructor(_0x277232){const _0x5d7ce0=a0_0x1bcb36;super();if(this[_0x5d7ce0(0x1ce)]=_0x277232[_0x5d7ce0(0x1ce)]['replace'](/\/$/,''),this[_0x5d7ce0(0x203)]=_0x277232[_0x5d7ce0(0x203)],this[_0x5d7ce0(0x211)]=_0x277232[_0x5d7ce0(0x211)],this[_0x5d7ce0(0x21d)]=_0x277232['agent']||_0x5d7ce0(0x1f6),this['resumeId']='sdk-'+_0x277232['alias']+'-'+Date[_0x5d7ce0(0x1e4)]()[_0x5d7ce0(0x1f5)](0x24),this[_0x5d7ce0(0x1f3)]=_0x277232[_0x5d7ce0(0x1f3)]??0x2bf20,this[_0x5d7ce0(0x20b)]=_0x277232[_0x5d7ce0(0x20b)]??0xbb8,_0x277232[_0x5d7ce0(0x20f)]!==!0x1)this[_0x5d7ce0(0x1e0)]();}[a0_0x1bcb36(0x1d6)](_0xd8cac1){const _0x44a761=a0_0x1bcb36;console[_0x44a761(0x1d6)]('['+new Date()[_0x44a761(0x1ca)]()[_0x44a761(0x20d)](0x0,0x8)+_0x44a761(0x1dc)+this[_0x44a761(0x203)]+']\x20'+_0xd8cac1);}async[a0_0x1bcb36(0x200)](_0x55dc0b,_0x32b552){const _0x15729e=a0_0x1bcb36;let _0x393bb5={'Content-Type':_0x15729e(0x1ef),'Accept':'application/json,\x20text/event-stream'};if(this[_0x15729e(0x211)])_0x393bb5['Authorization']=_0x15729e(0x207)+this[_0x15729e(0x211)];let _0x456b02=await(await fetch(this[_0x15729e(0x1ce)]+_0x15729e(0x1cb),{'method':_0x15729e(0x215),'headers':_0x393bb5,'body':JSON['stringify']({'jsonrpc':'2.0','id':Date[_0x15729e(0x1e4)](),'method':'tools/call','params':{'name':_0x55dc0b,'arguments':_0x32b552}})}))['text'](),_0x4fe18b=_0x456b02['match'](/data: (.+)/),_0x2deb58=_0x4fe18b?JSON['parse'](_0x4fe18b[0x1]):JSON[_0x15729e(0x1f1)](_0x456b02),_0x2fd1df=_0x2deb58?.['result']?.[_0x15729e(0x21b)]?.[0x0]?.[_0x15729e(0x201)];return _0x2fd1df?JSON[_0x15729e(0x1f1)](_0x2fd1df):_0x2deb58;}async[a0_0x1bcb36(0x1e0)](){const _0x28d267=a0_0x1bcb36;if(this[_0x28d267(0x222)])return;this[_0x28d267(0x222)]=!0x0,await this[_0x28d267(0x1f8)](_0x28d267(0x21c)),this[_0x28d267(0x1d6)](_0x28d267(0x208)),this['heartbeatTimer']=setInterval(()=>{const _0x411bf9=_0x28d267;this['status'](_0x411bf9(0x21c))[_0x411bf9(0x1d2)](_0x58d108=>this[_0x411bf9(0x1d6)](_0x411bf9(0x219)+_0x58d108[_0x411bf9(0x21a)]));},this[_0x28d267(0x1f3)]),this[_0x28d267(0x1cf)]();}async[a0_0x1bcb36(0x1e5)](){const _0x3ae405=a0_0x1bcb36;if(this[_0x3ae405(0x222)]=!0x1,this['sseAbort']?.[_0x3ae405(0x1d9)](),this[_0x3ae405(0x214)])clearInterval(this[_0x3ae405(0x214)]);await this[_0x3ae405(0x1f8)](_0x3ae405(0x20c))[_0x3ae405(0x1d2)](()=>{}),this[_0x3ae405(0x1d6)](_0x3ae405(0x1f2));}async[a0_0x1bcb36(0x1e6)](_0x83d07b,_0x3d4627,_0x2d47a=a0_0x1bcb36(0x1fe)){const _0x2bc916=a0_0x1bcb36;return this[_0x2bc916(0x200)](_0x2bc916(0x1d0),{'alias':_0x83d07b,'task':_0x3d4627,'priority':_0x2d47a,'from_session':this[_0x2bc916(0x203)]});}async[a0_0x1bcb36(0x21a)](_0x38a64b,_0x280c9b){const _0x3ed462=a0_0x1bcb36;return this[_0x3ed462(0x200)](_0x3ed462(0x1ea),{'alias':_0x38a64b,'message':_0x280c9b,'from_session':this[_0x3ed462(0x203)]});}async[a0_0x1bcb36(0x1da)](_0x17a544,_0x4c0804,_0x5d803c=a0_0x1bcb36(0x1e1)){const _0x228fe8=a0_0x1bcb36;return this[_0x228fe8(0x200)](_0x228fe8(0x1db),{'in_reply_to':_0x17a544,'text':_0x4c0804,'status':_0x5d803c});}async[a0_0x1bcb36(0x1f8)](_0x2a736a,_0x1fd8fc){const _0x13c311=a0_0x1bcb36;return this[_0x13c311(0x200)]('report_status',{'resume_id':this[_0x13c311(0x206)],'alias':this[_0x13c311(0x203)],'status':_0x2a736a,'server':a0_0x187a06(),'hostname':a0_0x187a06(),'agent':this[_0x13c311(0x21d)],'project_dir':process[_0x13c311(0x20e)](),..._0x1fd8fc});}async[a0_0x1bcb36(0x1ff)](){const _0x5743fe=a0_0x1bcb36;return this['call'](_0x5743fe(0x1ed),{});}async['broadcast'](_0x21a7fa,_0xac0c8f){const _0x36c0a4=a0_0x1bcb36;return this[_0x36c0a4(0x200)](_0x36c0a4(0x1fc),{'message':_0x21a7fa,'filter_server':_0xac0c8f?.[_0x36c0a4(0x221)],'filter_status':_0xac0c8f?.[_0x36c0a4(0x1f8)]});}async[a0_0x1bcb36(0x1cf)](){const _0x2993fc=a0_0x1bcb36;let _0x53377c=encodeURIComponent(this[_0x2993fc(0x203)]),_0x55fba0=this[_0x2993fc(0x1ce)]+_0x2993fc(0x1d5)+_0x53377c,_0x1139e5=this[_0x2993fc(0x20b)];while(this[_0x2993fc(0x222)]){try{this[_0x2993fc(0x1d3)]=new AbortController();let _0x278b7a={'Accept':_0x2993fc(0x1fa)};if(this[_0x2993fc(0x211)])_0x278b7a[_0x2993fc(0x1fb)]='Bearer\x20'+this[_0x2993fc(0x211)];let _0x1ebf4f=await fetch(_0x55fba0,{'headers':_0x278b7a,'signal':this['sseAbort'][_0x2993fc(0x21f)]});if(!_0x1ebf4f['ok']||!_0x1ebf4f[_0x2993fc(0x1df)]){this['log']('SSE\x20failed:\x20'+_0x1ebf4f[_0x2993fc(0x1f8)]),await this['sleep'](_0x1139e5),_0x1139e5=Math[_0x2993fc(0x1f4)](_0x1139e5*1.5,0xea60);continue;}_0x1139e5=this[_0x2993fc(0x20b)];let _0xb3b768=_0x1ebf4f[_0x2993fc(0x1df)][_0x2993fc(0x1e8)](),_0x1531d6=new TextDecoder(),_0x3241d8='';while(this['running']){let {done:_0x1db703,value:_0x58f617}=await _0xb3b768[_0x2993fc(0x209)]();if(_0x1db703)break;_0x3241d8+=_0x1531d6['decode'](_0x58f617,{'stream':!0x0});let _0x528279=_0x3241d8['split']('\x0a');_0x3241d8=_0x528279['pop']()||'';for(let _0x401779 of _0x528279){if(!_0x401779[_0x2993fc(0x1d1)](_0x2993fc(0x1de)))continue;try{let _0x2fbe3e=JSON[_0x2993fc(0x1f1)](_0x401779[_0x2993fc(0x20d)](0x6));if(_0x2fbe3e[_0x2993fc(0x1d8)]===_0x2993fc(0x217)){this['log'](_0x2993fc(0x212)),this[_0x2993fc(0x220)](_0x2993fc(0x217));continue;}if(_0x2fbe3e['type']===_0x2993fc(0x1eb)||_0x2fbe3e[_0x2993fc(0x1d8)]===_0x2993fc(0x1ee)||_0x2fbe3e['type']===_0x2993fc(0x1fc))await this[_0x2993fc(0x1f9)]();}catch{}}}}catch(_0x2441ed){if(_0x2441ed[_0x2993fc(0x205)]===_0x2993fc(0x1f0))break;this[_0x2993fc(0x220)](_0x2993fc(0x1e9),_0x2441ed),this[_0x2993fc(0x1d6)]('SSE\x20error:\x20'+_0x2441ed[_0x2993fc(0x21a)]);}if(this[_0x2993fc(0x222)])this[_0x2993fc(0x220)](_0x2993fc(0x1f2)),this[_0x2993fc(0x1d6)](_0x2993fc(0x1e3)+_0x1139e5/0x3e8+_0x2993fc(0x1cd)),await this[_0x2993fc(0x1f7)](_0x1139e5),_0x1139e5=Math[_0x2993fc(0x1f4)](_0x1139e5*1.5,0xea60);}}async['processInbox'](){const _0x127aef=a0_0x1bcb36;try{let _0x3a07fb=(await this[_0x127aef(0x200)](_0x127aef(0x21e),{'alias':this['alias'],'limit':0xa}))?.[_0x127aef(0x1dd)]||[];for(let _0x18359c of _0x3a07fb)await this[_0x127aef(0x200)](_0x127aef(0x216),{'alias':this[_0x127aef(0x203)],'message_id':_0x18359c['id']}),this[_0x127aef(0x1d6)]('←\x20'+_0x18359c[_0x127aef(0x1ec)]+':\x20'+_0x18359c['content'][_0x127aef(0x20d)](0x0,0x3c)),this[_0x127aef(0x220)](_0x127aef(0x202),_0x18359c),this[_0x127aef(0x220)]('message',_0x18359c);}catch(_0x53516f){this['log'](_0x127aef(0x1cc)+_0x53516f[_0x127aef(0x21a)]);}}['sleep'](_0x3cba50){return new Promise(_0x49cd53=>setTimeout(_0x49cd53,_0x3cba50));}}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_0x5126d1=a0_0x5c8c;(function(_0x2974b4,_0x3edda7){const _0x565834=a0_0x5c8c,_0x3ebfee=_0x2974b4();while(!![]){try{const _0x4ed6d2=parseInt(_0x565834(0x1b9))/0x1*(-parseInt(_0x565834(0x1dd))/0x2)+-parseInt(_0x565834(0x1c3))/0x3+parseInt(_0x565834(0x1fa))/0x4*(-parseInt(_0x565834(0x22a))/0x5)+parseInt(_0x565834(0x1c0))/0x6+-parseInt(_0x565834(0x1cb))/0x7*(parseInt(_0x565834(0x1a0))/0x8)+parseInt(_0x565834(0x20a))/0x9*(parseInt(_0x565834(0x1c6))/0xa)+parseInt(_0x565834(0x1ef))/0xb*(parseInt(_0x565834(0x1e8))/0xc);if(_0x4ed6d2===_0x3edda7)break;else _0x3ebfee['push'](_0x3ebfee['shift']());}catch(_0x1950a9){_0x3ebfee['push'](_0x3ebfee['shift']());}}}(a0_0x670b,0xb03f4));import{readFileSync as a0_0x17b92a,existsSync as a0_0x39f9c0}from'fs';import{randomUUID as a0_0x4db9dd}from'crypto';function a0_0x5c8c(_0x4aaeba,_0x3cf3a0){_0x4aaeba=_0x4aaeba-0x19e;const _0x670bd7=a0_0x670b();let _0x5c8c3a=_0x670bd7[_0x4aaeba];return _0x5c8c3a;}import{join as a0_0x231bb7}from'path';import{hostname as a0_0x595711}from'os';import{execSync as a0_0x5d3536}from'child_process';import{Server as a0_0x22fb80}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x28ce4f}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x188e3a,CallToolRequestSchema as a0_0xd37ac3}from'@modelcontextprotocol/sdk/types.js';function p(_0x245bce){const _0x1a9262=a0_0x5c8c;if(!a0_0x39f9c0(_0x245bce))return;for(let _0x3caab3 of a0_0x17b92a(_0x245bce,'utf-8')[_0x1a9262(0x1e6)]('\x0a')){let _0xaa8359=_0x3caab3['trim']();if(!_0xaa8359||_0xaa8359[_0x1a9262(0x1e9)]('#'))continue;let _0x2ea5ec=_0xaa8359[_0x1a9262(0x1f4)]('=');if(_0x2ea5ec<0x0)continue;let _0x232952=_0xaa8359[_0x1a9262(0x1d0)](0x0,_0x2ea5ec)[_0x1a9262(0x1d2)](),_0x5b337b=_0xaa8359[_0x1a9262(0x1d0)](_0x2ea5ec+0x1)[_0x1a9262(0x1d2)]()[_0x1a9262(0x1af)](/^["']|["']$/g,'');if(!process.env[_0x232952])process.env[_0x232952]=_0x5b337b;}}var C=process.env.HOME||'~',T=a0_0x231bb7(C,a0_0x5126d1(0x220));p(a0_0x231bb7(T,a0_0x5126d1(0x1b2)));function a0_0x670b(){const _0x4bb5c8=['...\x20TMUX=','Target\x20session\x20alias','ENV:\x20URL=','commhub_report_status','notifications/claude/channel','Progress\x200-100','result','unknown\x20tool','SIGINT','text','Session\x20alias:\x20','inbox_count','hub','.claude/channels/commhub','fatal:\x20','blocked','SSE\x20fatal:\x20','0.3.0','content','\x20ALIAS=','delete','MCP\x20stdio\x20connected','end','266575OajnXM','heartbeat\x20failed:\x20','get','tools/call','stderr','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','commhub','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','toTimeString','priority','56lcbhux','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','2025-03-26','body','ack_inbox','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','report_status','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','parse','message_id','CommHub\x20init\x20failed:\x20','commhub_send_message','cancelled','low','exit','replace','type','params','.env','read','cwd','messages','shutting\x20down,\x20reporting\x20offline...','Bearer\x20',':\x20inbox_count=','22811UKJjGB','initialize','\x20CWD=','POST','init\x20failed:\x20','utf-8','string','4258470eeoCzy','Reply\x20text\x20/\x20result\x20summary','working','301305iLNKPe','commhub-channel','commhub_get_all_status','5204990jhCFWP','pop','commhub_reply','Priority\x20(default:\x20normal)','error','812427DfdQpJ','SSE\x20connection\x20error:\x20','http://127.0.0.1:9200','session\x20disconnected','claude-code','slice','broadcast','trim','then','application/json','completed',']\x20[commhub]\x20','/mcp','message','connecting\x20to\x20','send_message','connect','alias','60GaJxgH','get_all_status','normal','ready\x20—\x20waiting\x20for\x20events','new_message','\x20PROJECT_ENV=','stringify','application/json,\x20text/event-stream','get_inbox','split','\x20RESUME_ID=','4369812EDKfYy','startsWith','registered\x20as\x20\x22','new_task','SIGTERM','SSE\x20stream\x20ended,\x20reconnecting...','from','22aHZmYC','object','2.0','catch','idle','indexOf','from_session','stdin','status','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','send_task','12vowqko','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','length','\x22\x20(','failed','token','setRequestHandler','tmux\x20display-message\x20-p\x20\x27#S\x27','Task\x20content','replied','write','parse\x20error:\x20','Current\x20task\x20description','data:\x20','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','18eesHzn','set','find','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','\x20priority=','\x20from\x20','send_reply','getReader','task'];a0_0x670b=function(){return _0x4bb5c8;};return a0_0x670b();}var L=process[a0_0x5126d1(0x1b4)]()[a0_0x5126d1(0x1af)](/\//g,'-');p(a0_0x231bb7(T,L,'.env'));function U(){const _0x3a8ba9=a0_0x5126d1;try{return a0_0x5d3536(_0x3a8ba9(0x202),{'encoding':'utf-8','timeout':0x7d0})[_0x3a8ba9(0x1d2)]();}catch{return'';}}function v(){const _0x3a1b41=a0_0x5126d1;try{let _0x5c5a4b=a0_0x231bb7(C,'.anet','config.json');if(a0_0x39f9c0(_0x5c5a4b))return JSON[_0x3a1b41(0x1a8)](a0_0x17b92a(_0x5c5a4b,_0x3a1b41(0x1be)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x5126d1(0x21f)]||a0_0x5126d1(0x1cd),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x595711(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x4db9dd(),X=process.env.COMMHUB_TOKEN||H[a0_0x5126d1(0x200)]||'';function Y(_0x403dcf){const _0x146d7b=a0_0x5126d1;let _0x3cbbfc=new Date()[_0x146d7b(0x19e)]()[_0x146d7b(0x1d0)](0x0,0x8);process[_0x146d7b(0x22e)][_0x146d7b(0x205)]('['+_0x3cbbfc+_0x146d7b(0x1d6)+_0x403dcf+'\x0a');}function h(_0xb25c73){return new Promise(_0x3d854d=>setTimeout(_0x3d854d,_0xb25c73));}Y(a0_0x5126d1(0x215)+f+a0_0x5126d1(0x226)+Z+a0_0x5126d1(0x1e7)+w[a0_0x5126d1(0x1d0)](0x0,0x8)+a0_0x5126d1(0x213)+(j||'none')+a0_0x5126d1(0x1bb)+process[a0_0x5126d1(0x1b4)]()+a0_0x5126d1(0x1e2)+L);var k=new Map(),K=new a0_0x22fb80({'name':'commhub-channel','version':a0_0x5126d1(0x224)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x5126d1(0x1fb),a0_0x5126d1(0x209),a0_0x5126d1(0x231),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x5126d1(0x21d)+Z]['join']('\x0a')});K[a0_0x5126d1(0x201)](a0_0x188e3a,async()=>({'tools':[{'name':a0_0x5126d1(0x1c8),'description':a0_0x5126d1(0x1fc),'inputSchema':{'type':a0_0x5126d1(0x1f0),'properties':{'task_id':{'type':a0_0x5126d1(0x1bf),'description':a0_0x5126d1(0x1a1)},'text':{'type':a0_0x5126d1(0x1bf),'description':a0_0x5126d1(0x1c1)},'status':{'type':a0_0x5126d1(0x1bf),'enum':[a0_0x5126d1(0x1d5),a0_0x5126d1(0x1ff),a0_0x5126d1(0x1ac),a0_0x5126d1(0x222),'error','in_progress'],'description':a0_0x5126d1(0x1a7)}},'required':[a0_0x5126d1(0x21c)]}},{'name':a0_0x5126d1(0x216),'description':a0_0x5126d1(0x1f8),'inputSchema':{'type':a0_0x5126d1(0x1f0),'properties':{'status':{'type':a0_0x5126d1(0x1bf),'enum':[a0_0x5126d1(0x1c2),a0_0x5126d1(0x1f3),a0_0x5126d1(0x222),'error']},'task':{'type':a0_0x5126d1(0x1bf),'description':a0_0x5126d1(0x207)},'progress':{'type':'number','description':a0_0x5126d1(0x218)}},'required':[a0_0x5126d1(0x1f7)]}},{'name':'commhub_send_task','description':a0_0x5126d1(0x1a5),'inputSchema':{'type':a0_0x5126d1(0x1f0),'properties':{'alias':{'type':a0_0x5126d1(0x1bf),'description':a0_0x5126d1(0x214)},'task':{'type':a0_0x5126d1(0x1bf),'description':a0_0x5126d1(0x203)},'priority':{'type':a0_0x5126d1(0x1bf),'enum':['high',a0_0x5126d1(0x1df),a0_0x5126d1(0x1ad)],'description':a0_0x5126d1(0x1c9)}},'required':[a0_0x5126d1(0x1dc),a0_0x5126d1(0x212)]}},{'name':a0_0x5126d1(0x1ab),'description':a0_0x5126d1(0x22f),'inputSchema':{'type':a0_0x5126d1(0x1f0),'properties':{'alias':{'type':a0_0x5126d1(0x1bf),'description':a0_0x5126d1(0x214)},'message':{'type':a0_0x5126d1(0x1bf),'description':'Message\x20content'}},'required':[a0_0x5126d1(0x1dc),a0_0x5126d1(0x1d8)]}},{'name':a0_0x5126d1(0x1c5),'description':a0_0x5126d1(0x20d),'inputSchema':{'type':a0_0x5126d1(0x1f0),'properties':{}}}]}));async function P(_0x410619,_0x4479e3){const _0x587c3f=a0_0x5126d1;let _0x2c35b9=await fetch(f+_0x587c3f(0x1d7),{'method':_0x587c3f(0x1bc),'headers':{'Content-Type':_0x587c3f(0x1d4),'Accept':_0x587c3f(0x1e4),...X?{'Authorization':_0x587c3f(0x1b7)+X}:{}},'body':JSON[_0x587c3f(0x1e3)]({'jsonrpc':_0x587c3f(0x1f1),'id':0x1,'method':_0x587c3f(0x1ba),'params':{'protocolVersion':_0x587c3f(0x1a2),'capabilities':{},'clientInfo':{'name':_0x587c3f(0x1c4),'version':_0x587c3f(0x224)}}})});if(!_0x2c35b9['ok']){let _0x411cfe=await _0x2c35b9[_0x587c3f(0x21c)]();return Y(_0x587c3f(0x1aa)+_0x2c35b9[_0x587c3f(0x1f7)]+'\x20'+_0x411cfe[_0x587c3f(0x1d0)](0x0,0x64)),{'ok':!0x1,'error':_0x587c3f(0x1bd)+_0x2c35b9['status']};}await _0x2c35b9[_0x587c3f(0x21c)]();let _0x39a469=(await(await fetch(f+_0x587c3f(0x1d7),{'method':_0x587c3f(0x1bc),'headers':{'Content-Type':'application/json','Accept':_0x587c3f(0x1e4),...X?{'Authorization':_0x587c3f(0x1b7)+X}:{}},'body':JSON[_0x587c3f(0x1e3)]({'jsonrpc':_0x587c3f(0x1f1),'id':0x2,'method':_0x587c3f(0x22d),'params':{'name':_0x410619,'arguments':_0x4479e3}})}))[_0x587c3f(0x21c)]())[_0x587c3f(0x1e6)]('\x0a')[_0x587c3f(0x20c)](_0x32d45b=>_0x32d45b[_0x587c3f(0x1e9)](_0x587c3f(0x208)));if(_0x39a469){let _0x1a78d0=JSON[_0x587c3f(0x1a8)](_0x39a469[_0x587c3f(0x1d0)](0x6));return _0x1a78d0?.[_0x587c3f(0x219)]?.['content']?.[0x0]?.['text']?JSON[_0x587c3f(0x1a8)](_0x1a78d0[_0x587c3f(0x219)]['content'][0x0][_0x587c3f(0x21c)]):_0x1a78d0;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x5126d1(0x201)](a0_0xd37ac3,async _0x540e0a=>{const _0x29d3e8=a0_0x5126d1;let {name:_0x1ed9f9,arguments:_0x342e38}=_0x540e0a[_0x29d3e8(0x1b1)];if(_0x1ed9f9===_0x29d3e8(0x1c8)){let {task_id:_0xd128f9,text:_0x1580e6,status:_0x4f5454}=_0x342e38;if(_0x4f5454==='completed'||_0x4f5454===_0x29d3e8(0x1ff)||_0x4f5454===_0x29d3e8(0x1ac)){let _0x62a1da=_0x4f5454===_0x29d3e8(0x1d5)?_0x29d3e8(0x204):_0x4f5454,_0x1ce2b0=_0xd128f9?k[_0x29d3e8(0x22c)](_0xd128f9)||'hub':_0x29d3e8(0x21f),_0xddce7=await P(_0x29d3e8(0x210),{'alias':_0x1ce2b0,'text':_0x1580e6,'in_reply_to':_0xd128f9||void 0x0,'status':_0x62a1da,'from_session':Z});if(_0xd128f9)k[_0x29d3e8(0x227)](_0xd128f9);return{'content':[{'type':_0x29d3e8(0x21c),'text':JSON[_0x29d3e8(0x1e3)](_0xddce7)}]};}let _0xd6ae3d=await P(_0x29d3e8(0x1a6),{'resume_id':w,'alias':Z,'status':_0x4f5454===_0x29d3e8(0x222)?_0x29d3e8(0x222):_0x4f5454===_0x29d3e8(0x1ca)?_0x29d3e8(0x1ca):'working','task':_0x1580e6['slice'](0x0,0xc8),'output':_0x1580e6});return{'content':[{'type':'text','text':JSON['stringify'](_0xd6ae3d)}]};}if(_0x1ed9f9===_0x29d3e8(0x216)){let {status:_0x5795a3,task:_0xe075ca,progress:_0x125862}=_0x342e38,_0x4d95b3=await P(_0x29d3e8(0x1a6),{'resume_id':w,'alias':Z,'status':_0x5795a3,'task':_0xe075ca,'progress':_0x125862});return{'content':[{'type':'text','text':JSON[_0x29d3e8(0x1e3)](_0x4d95b3)}]};}if(_0x1ed9f9==='commhub_send_task'){let {alias:_0xf6fe91,task:_0x3a9859,priority:_0x801d02}=_0x342e38,_0x5a143a=await P(_0x29d3e8(0x1f9),{'alias':_0xf6fe91,'task':_0x3a9859,'priority':_0x801d02||'normal','from_session':Z});return{'content':[{'type':'text','text':JSON[_0x29d3e8(0x1e3)](_0x5a143a)}]};}if(_0x1ed9f9===_0x29d3e8(0x1ab)){let {alias:_0x24a57b,message:_0x3b710c}=_0x342e38,_0x1333f0=await P(_0x29d3e8(0x1da),{'alias':_0x24a57b,'message':_0x3b710c,'from_session':Z});return{'content':[{'type':_0x29d3e8(0x21c),'text':JSON[_0x29d3e8(0x1e3)](_0x1333f0)}]};}if(_0x1ed9f9===_0x29d3e8(0x1c5)){let _0x483d8f=await P(_0x29d3e8(0x1de),{});return{'content':[{'type':_0x29d3e8(0x21c),'text':JSON[_0x29d3e8(0x1e3)](_0x483d8f)}]};}return{'content':[{'type':_0x29d3e8(0x21c),'text':JSON[_0x29d3e8(0x1e3)]({'error':_0x29d3e8(0x21a)})}]};});async function u(){const _0x50314b=a0_0x5126d1;let _0x5f257f=f+'/events/'+encodeURIComponent(Z),_0x18fa7f={};if(X)_0x18fa7f['Authorization']=_0x50314b(0x1b7)+X;Y(_0x50314b(0x1d9)+_0x5f257f);while(!0x0){try{let _0x4c404c=await fetch(_0x5f257f,{'headers':_0x18fa7f});if(!_0x4c404c['ok']){Y('SSE\x20error:\x20'+_0x4c404c['status']+'\x20'+_0x4c404c['statusText']),await h(0x1388);continue;}let _0x3bda2e=_0x4c404c[_0x50314b(0x1a3)][_0x50314b(0x211)](),_0x103be7=new TextDecoder(),_0x5511b3='';while(!0x0){let {done:_0x4e1c1a,value:_0x2fa44d}=await _0x3bda2e[_0x50314b(0x1b3)]();if(_0x4e1c1a)break;_0x5511b3+=_0x103be7['decode'](_0x2fa44d,{'stream':!0x0});let _0x4f3353=_0x5511b3['split']('\x0a\x0a');_0x5511b3=_0x4f3353[_0x50314b(0x1c7)]()||'';for(let _0x564258 of _0x4f3353){let _0x5e28e3=_0x564258[_0x50314b(0x1e6)]('\x0a')[_0x50314b(0x20c)](_0x3dc961=>_0x3dc961[_0x50314b(0x1e9)](_0x50314b(0x208)));if(!_0x5e28e3)continue;try{let _0x2087a6=JSON[_0x50314b(0x1a8)](_0x5e28e3['slice'](0x6));await S(_0x2087a6);}catch(_0x35d4d0){Y(_0x50314b(0x206)+_0x35d4d0);}}}Y(_0x50314b(0x1ed));}catch(_0x5efc36){Y(_0x50314b(0x1cc)+_0x5efc36);}await h(0xbb8);}}async function S(_0x2fa765){const _0xdceee1=a0_0x5126d1;if(_0x2fa765[_0xdceee1(0x1b0)]==='connected'){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x2fa765['type']===_0xdceee1(0x1e1)){if(Y('←\x20message\x20from\x20'+_0x2fa765['from']+':\x20'+_0x2fa765[_0xdceee1(0x1d8)][_0xdceee1(0x1d0)](0x0,0x3c)),await K['notification']({'method':_0xdceee1(0x217),'params':{'content':_0x2fa765['message'],'meta':{'sender':_0x2fa765[_0xdceee1(0x1ee)]||'hub','sender_id':_0xdceee1(0x230),'user':_0x2fa765[_0xdceee1(0x1ee)]||_0xdceee1(0x21f),'priority':_0xdceee1(0x1df)}}}),_0x2fa765[_0xdceee1(0x1a9)])await P(_0xdceee1(0x1a4),{'alias':Z,'message_id':_0x2fa765['message_id']});return;}if(_0x2fa765[_0xdceee1(0x1b0)]===_0xdceee1(0x1eb)||_0x2fa765[_0xdceee1(0x1b0)]===_0xdceee1(0x1d1)){Y('←\x20'+_0x2fa765[_0xdceee1(0x1b0)]+_0xdceee1(0x1b8)+_0x2fa765[_0xdceee1(0x21e)]+_0xdceee1(0x20e)+(_0x2fa765[_0xdceee1(0x19f)]||_0xdceee1(0x1df)));let _0x5b7ba6=await P(_0xdceee1(0x1e5),{'alias':Z,'limit':0x5});if(_0x5b7ba6?.['ok']&&_0x5b7ba6['messages']?.[_0xdceee1(0x1fd)]>0x0)for(let _0xd05125 of _0x5b7ba6[_0xdceee1(0x1b5)]){let _0x444693={'sender':_0xd05125[_0xdceee1(0x1f5)]||'hub','sender_id':_0xdceee1(0x230),'user':_0xd05125[_0xdceee1(0x1f5)]||_0xdceee1(0x21f),'task_id':_0xd05125['id'],'priority':_0xd05125[_0xdceee1(0x19f)]||'normal'};k[_0xdceee1(0x20b)](_0xd05125['id'],_0xd05125[_0xdceee1(0x1f5)]||_0xdceee1(0x21f)),await K['notification']({'method':_0xdceee1(0x217),'params':{'content':_0xd05125['content'],'meta':_0x444693}}),Y('→\x20injected\x20task\x20'+_0xd05125['id'][_0xdceee1(0x1d0)](0x0,0x8)+_0xdceee1(0x20f)+_0xd05125[_0xdceee1(0x1f5)]+':\x20'+_0xd05125[_0xdceee1(0x225)][_0xdceee1(0x1d0)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0xd05125['id']});}}}async function A(){const _0x3a9c1f=a0_0x5126d1;let _0x64aa7e=new a0_0x28ce4f();await K[_0x3a9c1f(0x1db)](_0x64aa7e),Y(_0x3a9c1f(0x228)),Y('starting\x20SSE\x20listener...'),u()['catch'](_0x12d8b2=>Y(_0x3a9c1f(0x223)+_0x12d8b2)),P(_0x3a9c1f(0x1a6),{'resume_id':w,'alias':Z,'status':_0x3a9c1f(0x1f3),'server':a0_0x595711(),'hostname':a0_0x595711(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x3a9c1f(0x1d3)](()=>Y(_0x3a9c1f(0x1ea)+Z+_0x3a9c1f(0x1fe)+w[_0x3a9c1f(0x1d0)](0x0,0x8)+')'))[_0x3a9c1f(0x1f2)](_0x19e45a=>Y('warning:\x20could\x20not\x20register:\x20'+_0x19e45a)),setInterval(()=>{const _0xb7f409=_0x3a9c1f;P(_0xb7f409(0x1a6),{'resume_id':w,'alias':Z,'status':_0xb7f409(0x1f3),'server':a0_0x595711(),'hostname':a0_0x595711(),'agent':_0xb7f409(0x1cf),'project_dir':process[_0xb7f409(0x1b4)](),'tmux_name':j||void 0x0})[_0xb7f409(0x1f2)](_0x22a229=>Y(_0xb7f409(0x22b)+_0x22a229));},0x2bf20),Y(_0x3a9c1f(0x1e0));}A()[a0_0x5126d1(0x1f2)](_0x20d4c7=>{const _0x96f8d9=a0_0x5126d1;Y(_0x96f8d9(0x221)+_0x20d4c7),process[_0x96f8d9(0x1ae)](0x1);});async function N(){const _0x3f9f24=a0_0x5126d1;Y(_0x3f9f24(0x1b6)),await P(_0x3f9f24(0x1a6),{'resume_id':w,'alias':Z,'status':_0x3f9f24(0x1ca),'task':_0x3f9f24(0x1ce)})[_0x3f9f24(0x1f2)](()=>{}),process[_0x3f9f24(0x1ae)](0x0);}process[a0_0x5126d1(0x1f6)]['on'](a0_0x5126d1(0x229),()=>N()),process['on'](a0_0x5126d1(0x1ec),()=>N()),process['on'](a0_0x5126d1(0x21b),()=>N());
|
|
2
|
+
const a0_0x36e548=a0_0x4da2;(function(_0x15023d,_0x56c55a){const _0x354547=a0_0x4da2,_0x4801c5=_0x15023d();while(!![]){try{const _0x5423a6=parseInt(_0x354547(0xe6))/0x1+-parseInt(_0x354547(0xdb))/0x2+parseInt(_0x354547(0x127))/0x3*(parseInt(_0x354547(0x102))/0x4)+-parseInt(_0x354547(0xf4))/0x5+parseInt(_0x354547(0xd7))/0x6+parseInt(_0x354547(0xb8))/0x7*(parseInt(_0x354547(0xfc))/0x8)+parseInt(_0x354547(0xe5))/0x9*(-parseInt(_0x354547(0xc9))/0xa);if(_0x5423a6===_0x56c55a)break;else _0x4801c5['push'](_0x4801c5['shift']());}catch(_0x498900){_0x4801c5['push'](_0x4801c5['shift']());}}}(a0_0x4b45,0x8ba81));import{readFileSync as a0_0x2a0a99,existsSync as a0_0xb71bfe}from'fs';import{randomUUID as a0_0x5cdfd1}from'crypto';import{join as a0_0xfb859b}from'path';import{hostname as a0_0x4755b6}from'os';import{execSync as a0_0x6dff69}from'child_process';function a0_0x4b45(){const _0x4c475c=['read','inbox_count','text','content','message_id','blocked','slice','hub','fatal:\x20','registered\x20as\x20\x22','\x22\x20(','\x20ALIAS=','ready\x20—\x20waiting\x20for\x20events','messages','ENV:\x20URL=','shutting\x20down,\x20reporting\x20offline...','7DQpXXK','commhub-channel','status','split','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','no\x20response','application/json,\x20text/event-stream','from','Priority\x20(default:\x20normal)','Message\x20content','trim','.anet','ack_inbox','body','startsWith','.env','write','90xWxJes',':\x20inbox_count=','none','2.0','replied','notification','stdin','commhub','data:\x20','\x20CWD=','replace','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','commhub_get_all_status','message','4568622AdBJNK','SIGTERM','POST','connecting\x20to\x20','545944KfPIbE','from_session','connected','token','get_inbox','application/json','SSE\x20error:\x20','claude-code','delete','SSE\x20connected\x20as\x20\x22','1018467bHVlms','1024237IlBUVm','SSE\x20stream\x20ended,\x20reconnecting...','Target\x20session\x20alias','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','statusText','.claude/channels/commhub','indexOf','Bearer\x20','notifications/claude/channel','high','\x20RESUME_ID=','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','commhub_send_message','utf-8','4694885mlcNkw','commhub_report_status','...\x20TMUX=','toTimeString','error','exit','send_message','warning:\x20could\x20not\x20register:\x20','7531144EYsvIt','broadcast','completed','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','normal','failed','4rwucYE','stringify','get_all_status',']\x20[commhub]\x20','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','object','cwd','Authorization','heartbeat\x20failed:\x20','parse','alias','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','SIGINT','length','→\x20injected\x20task\x20','Task\x20content','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','parse\x20error:\x20','priority','initialize','http://127.0.0.1:9200','then','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','in_progress','cancelled','/mcp','working','\x20PROJECT_ENV=','stderr','get','CommHub\x20init\x20failed:\x20','unknown\x20tool','catch','Current\x20task\x20description','new_task','pop','setRequestHandler','226146JnRwTn','tmux\x20display-message\x20-p\x20\x27#S\x27','send_task','commhub_send_task','find','string','type','idle','tools/call','←\x20message\x20from\x20','low','\x20from\x20','report_status','starting\x20SSE\x20listener...'];a0_0x4b45=function(){return _0x4c475c;};return a0_0x4b45();}import{Server as a0_0x1d4dd0}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x2099b0}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x2180f5,CallToolRequestSchema as a0_0x16fa10}from'@modelcontextprotocol/sdk/types.js';function p(_0x1ba07d){const _0x207c97=a0_0x4da2;if(!a0_0xb71bfe(_0x1ba07d))return;for(let _0x4485a0 of a0_0x2a0a99(_0x1ba07d,_0x207c97(0xf3))['split']('\x0a')){let _0x6ef96b=_0x4485a0[_0x207c97(0xc2)]();if(!_0x6ef96b||_0x6ef96b[_0x207c97(0xc6)]('#'))continue;let _0x4ac9ae=_0x6ef96b[_0x207c97(0xec)]('=');if(_0x4ac9ae<0x0)continue;let _0x4aeed8=_0x6ef96b['slice'](0x0,_0x4ac9ae)['trim'](),_0x3770c6=_0x6ef96b['slice'](_0x4ac9ae+0x1)['trim']()[_0x207c97(0xd3)](/^["']|["']$/g,'');if(!process.env[_0x4aeed8])process.env[_0x4aeed8]=_0x3770c6;}}var C=process.env.HOME||'~',T=a0_0xfb859b(C,a0_0x36e548(0xeb));p(a0_0xfb859b(T,'.env'));var L=process['cwd']()[a0_0x36e548(0xd3)](/\//g,'-');p(a0_0xfb859b(T,L,a0_0x36e548(0xc7)));function U(){const _0x256740=a0_0x36e548;try{return a0_0x6dff69(_0x256740(0x128),{'encoding':'utf-8','timeout':0x7d0})[_0x256740(0xc2)]();}catch{return'';}}function a0_0x4da2(_0x2d5593,_0x480305){_0x2d5593=_0x2d5593-0xac;const _0x4b4555=a0_0x4b45();let _0x4da297=_0x4b4555[_0x2d5593];return _0x4da297;}function v(){const _0x25c1b9=a0_0x36e548;try{let _0x51838f=a0_0xfb859b(C,_0x25c1b9(0xc3),'config.json');if(a0_0xb71bfe(_0x51838f))return JSON[_0x25c1b9(0x10b)](a0_0x2a0a99(_0x51838f,_0x25c1b9(0xf3)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x36e548(0xaf)]||a0_0x36e548(0x116),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x4755b6(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x5cdfd1(),X=process.env.COMMHUB_TOKEN||H[a0_0x36e548(0xde)]||'';function Y(_0xb7dee){const _0x2e75a7=a0_0x36e548;let _0x227f4d=new Date()[_0x2e75a7(0xf7)]()[_0x2e75a7(0xae)](0x0,0x8);process[_0x2e75a7(0x11e)][_0x2e75a7(0xc8)]('['+_0x227f4d+_0x2e75a7(0x105)+_0xb7dee+'\x0a');}function h(_0x5f2dc4){return new Promise(_0x49e025=>setTimeout(_0x49e025,_0x5f2dc4));}Y(a0_0x36e548(0xb6)+f+a0_0x36e548(0xb3)+Z+a0_0x36e548(0xf0)+w['slice'](0x0,0x8)+a0_0x36e548(0xf6)+(j||a0_0x36e548(0xcb))+a0_0x36e548(0xd2)+process['cwd']()+a0_0x36e548(0x11d)+L);var k=new Map(),K=new a0_0x1d4dd0({'name':a0_0x36e548(0xb9),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x36e548(0x106),a0_0x36e548(0x118),a0_0x36e548(0xe9),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Session\x20alias:\x20'+Z]['join']('\x0a')});K[a0_0x36e548(0x126)](a0_0x2180f5,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x36e548(0xd4),'inputSchema':{'type':a0_0x36e548(0x107),'properties':{'task_id':{'type':a0_0x36e548(0x12c),'description':a0_0x36e548(0xf1)},'text':{'type':a0_0x36e548(0x12c),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x36e548(0x12c),'enum':[a0_0x36e548(0xfe),a0_0x36e548(0x101),a0_0x36e548(0x11a),a0_0x36e548(0xad),a0_0x36e548(0xf8),a0_0x36e548(0x119)],'description':a0_0x36e548(0xbc)}},'required':[a0_0x36e548(0x137)]}},{'name':'commhub_report_status','description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':'object','properties':{'status':{'type':a0_0x36e548(0x12c),'enum':[a0_0x36e548(0x11c),a0_0x36e548(0x12e),'blocked',a0_0x36e548(0xf8)]},'task':{'type':a0_0x36e548(0x12c),'description':a0_0x36e548(0x123)},'progress':{'type':'number','description':'Progress\x200-100'}},'required':[a0_0x36e548(0xba)]}},{'name':'commhub_send_task','description':a0_0x36e548(0xff),'inputSchema':{'type':a0_0x36e548(0x107),'properties':{'alias':{'type':a0_0x36e548(0x12c),'description':a0_0x36e548(0xe8)},'task':{'type':a0_0x36e548(0x12c),'description':a0_0x36e548(0x111)},'priority':{'type':a0_0x36e548(0x12c),'enum':[a0_0x36e548(0xef),a0_0x36e548(0x100),a0_0x36e548(0x131)],'description':a0_0x36e548(0xc0)}},'required':[a0_0x36e548(0x10c),'task']}},{'name':a0_0x36e548(0xf2),'description':a0_0x36e548(0x10d),'inputSchema':{'type':a0_0x36e548(0x107),'properties':{'alias':{'type':'string','description':a0_0x36e548(0xe8)},'message':{'type':a0_0x36e548(0x12c),'description':a0_0x36e548(0xc1)}},'required':[a0_0x36e548(0x10c),a0_0x36e548(0xd6)]}},{'name':'commhub_get_all_status','description':a0_0x36e548(0x112),'inputSchema':{'type':a0_0x36e548(0x107),'properties':{}}}]}));async function P(_0x478e1e,_0x3a1aca){const _0x3dbe9b=a0_0x36e548;let _0x52df02=await fetch(f+_0x3dbe9b(0x11b),{'method':_0x3dbe9b(0xd9),'headers':{'Content-Type':_0x3dbe9b(0xe0),'Accept':_0x3dbe9b(0xbe),...X?{'Authorization':_0x3dbe9b(0xed)+X}:{}},'body':JSON[_0x3dbe9b(0x103)]({'jsonrpc':_0x3dbe9b(0xcc),'id':0x1,'method':_0x3dbe9b(0x115),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x3dbe9b(0xb9),'version':'0.3.0'}}})});if(!_0x52df02['ok']){let _0x1ce142=await _0x52df02[_0x3dbe9b(0x137)]();return Y(_0x3dbe9b(0x120)+_0x52df02['status']+'\x20'+_0x1ce142[_0x3dbe9b(0xae)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x52df02[_0x3dbe9b(0xba)]};}await _0x52df02[_0x3dbe9b(0x137)]();let _0x177e2a=(await(await fetch(f+_0x3dbe9b(0x11b),{'method':_0x3dbe9b(0xd9),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x3dbe9b(0xed)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x3dbe9b(0xcc),'id':0x2,'method':_0x3dbe9b(0x12f),'params':{'name':_0x478e1e,'arguments':_0x3a1aca}})}))[_0x3dbe9b(0x137)]())[_0x3dbe9b(0xbb)]('\x0a')['find'](_0x4bc2a9=>_0x4bc2a9[_0x3dbe9b(0xc6)](_0x3dbe9b(0xd1)));if(_0x177e2a){let _0xb08949=JSON[_0x3dbe9b(0x10b)](_0x177e2a[_0x3dbe9b(0xae)](0x6));return _0xb08949?.['result']?.['content']?.[0x0]?.[_0x3dbe9b(0x137)]?JSON[_0x3dbe9b(0x10b)](_0xb08949['result']['content'][0x0][_0x3dbe9b(0x137)]):_0xb08949;}return{'ok':!0x1,'error':_0x3dbe9b(0xbd)};}K['setRequestHandler'](a0_0x16fa10,async _0x3d487c=>{const _0x569980=a0_0x36e548;let {name:_0xf89910,arguments:_0x81fc24}=_0x3d487c['params'];if(_0xf89910==='commhub_reply'){let {task_id:_0x25dede,text:_0x23d0dd,status:_0x1547e6}=_0x81fc24;if(_0x1547e6==='completed'||_0x1547e6==='failed'||_0x1547e6==='cancelled'){let _0x1b3f3d=_0x1547e6===_0x569980(0xfe)?_0x569980(0xcd):_0x1547e6,_0x3d5d2e=_0x25dede?k[_0x569980(0x11f)](_0x25dede)||_0x569980(0xaf):_0x569980(0xaf),_0x314769=await P('send_reply',{'alias':_0x3d5d2e,'text':_0x23d0dd,'in_reply_to':_0x25dede||void 0x0,'status':_0x1b3f3d,'from_session':Z});if(_0x25dede)k[_0x569980(0xe3)](_0x25dede);return{'content':[{'type':_0x569980(0x137),'text':JSON[_0x569980(0x103)](_0x314769)}]};}let _0x529169=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x1547e6==='blocked'?_0x569980(0xad):_0x1547e6===_0x569980(0xf8)?'error':_0x569980(0x11c),'task':_0x23d0dd[_0x569980(0xae)](0x0,0xc8),'output':_0x23d0dd});return{'content':[{'type':_0x569980(0x137),'text':JSON[_0x569980(0x103)](_0x529169)}]};}if(_0xf89910===_0x569980(0xf5)){let {status:_0x327f35,task:_0x2c5373,progress:_0xa7db04}=_0x81fc24,_0x59cad3=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x327f35,'task':_0x2c5373,'progress':_0xa7db04});return{'content':[{'type':'text','text':JSON[_0x569980(0x103)](_0x59cad3)}]};}if(_0xf89910===_0x569980(0x12a)){let {alias:_0x50437d,task:_0x215ab0,priority:_0x45505b}=_0x81fc24,_0x4ddedd=await P(_0x569980(0x129),{'alias':_0x50437d,'task':_0x215ab0,'priority':_0x45505b||_0x569980(0x100),'from_session':Z});return{'content':[{'type':_0x569980(0x137),'text':JSON[_0x569980(0x103)](_0x4ddedd)}]};}if(_0xf89910==='commhub_send_message'){let {alias:_0x4c0f55,message:_0x3dc41f}=_0x81fc24,_0x59cba1=await P(_0x569980(0xfa),{'alias':_0x4c0f55,'message':_0x3dc41f,'from_session':Z});return{'content':[{'type':_0x569980(0x137),'text':JSON[_0x569980(0x103)](_0x59cba1)}]};}if(_0xf89910===_0x569980(0xd5)){let _0x20d755=await P(_0x569980(0x104),{});return{'content':[{'type':_0x569980(0x137),'text':JSON[_0x569980(0x103)](_0x20d755)}]};}return{'content':[{'type':_0x569980(0x137),'text':JSON[_0x569980(0x103)]({'error':_0x569980(0x121)})}]};});async function u(){const _0x2b3124=a0_0x36e548;let _0x46fe40=f+'/events/'+encodeURIComponent(Z),_0x2e93a2={};if(X)_0x2e93a2[_0x2b3124(0x109)]=_0x2b3124(0xed)+X;Y(_0x2b3124(0xda)+_0x46fe40);while(!0x0){try{let _0x3a27fa=await fetch(_0x46fe40,{'headers':_0x2e93a2});if(!_0x3a27fa['ok']){Y(_0x2b3124(0xe1)+_0x3a27fa[_0x2b3124(0xba)]+'\x20'+_0x3a27fa[_0x2b3124(0xea)]),await h(0x1388);continue;}let _0x422278=_0x3a27fa[_0x2b3124(0xc5)]['getReader'](),_0x49f707=new TextDecoder(),_0x128b9d='';while(!0x0){let {done:_0x53dcd7,value:_0x548d1a}=await _0x422278[_0x2b3124(0x135)]();if(_0x53dcd7)break;_0x128b9d+=_0x49f707['decode'](_0x548d1a,{'stream':!0x0});let _0x41f7cc=_0x128b9d['split']('\x0a\x0a');_0x128b9d=_0x41f7cc[_0x2b3124(0x125)]()||'';for(let _0x3beadf of _0x41f7cc){let _0x173673=_0x3beadf[_0x2b3124(0xbb)]('\x0a')[_0x2b3124(0x12b)](_0x183992=>_0x183992[_0x2b3124(0xc6)](_0x2b3124(0xd1)));if(!_0x173673)continue;try{let _0x5b442e=JSON[_0x2b3124(0x10b)](_0x173673[_0x2b3124(0xae)](0x6));await S(_0x5b442e);}catch(_0x25fee4){Y(_0x2b3124(0x113)+_0x25fee4);}}}Y(_0x2b3124(0xe7));}catch(_0xb41f17){Y('SSE\x20connection\x20error:\x20'+_0xb41f17);}await h(0xbb8);}}async function S(_0x5e3788){const _0x1e790d=a0_0x36e548;if(_0x5e3788[_0x1e790d(0x12d)]===_0x1e790d(0xdd)){Y(_0x1e790d(0xe4)+Z+'\x22');return;}if(_0x5e3788['type']==='new_message'){if(Y(_0x1e790d(0x130)+_0x5e3788['from']+':\x20'+_0x5e3788[_0x1e790d(0xd6)][_0x1e790d(0xae)](0x0,0x3c)),await K[_0x1e790d(0xce)]({'method':_0x1e790d(0xee),'params':{'content':_0x5e3788['message'],'meta':{'sender':_0x5e3788[_0x1e790d(0xbf)]||_0x1e790d(0xaf),'sender_id':_0x1e790d(0xd0),'user':_0x5e3788[_0x1e790d(0xbf)]||'hub','priority':_0x1e790d(0x100)}}}),_0x5e3788['message_id'])await P(_0x1e790d(0xc4),{'alias':Z,'message_id':_0x5e3788[_0x1e790d(0xac)]});return;}if(_0x5e3788[_0x1e790d(0x12d)]===_0x1e790d(0x124)||_0x5e3788[_0x1e790d(0x12d)]===_0x1e790d(0xfd)){Y('←\x20'+_0x5e3788[_0x1e790d(0x12d)]+_0x1e790d(0xca)+_0x5e3788[_0x1e790d(0x136)]+'\x20priority='+(_0x5e3788['priority']||_0x1e790d(0x100)));let _0x319bcd=await P(_0x1e790d(0xdf),{'alias':Z,'limit':0x5});if(_0x319bcd?.['ok']&&_0x319bcd[_0x1e790d(0xb5)]?.[_0x1e790d(0x10f)]>0x0)for(let _0x4519a7 of _0x319bcd[_0x1e790d(0xb5)]){let _0x5a92b4={'sender':_0x4519a7[_0x1e790d(0xdc)]||_0x1e790d(0xaf),'sender_id':_0x1e790d(0xd0),'user':_0x4519a7[_0x1e790d(0xdc)]||_0x1e790d(0xaf),'task_id':_0x4519a7['id'],'priority':_0x4519a7[_0x1e790d(0x114)]||_0x1e790d(0x100)};k['set'](_0x4519a7['id'],_0x4519a7[_0x1e790d(0xdc)]||_0x1e790d(0xaf)),await K['notification']({'method':_0x1e790d(0xee),'params':{'content':_0x4519a7[_0x1e790d(0x138)],'meta':_0x5a92b4}}),Y(_0x1e790d(0x110)+_0x4519a7['id'][_0x1e790d(0xae)](0x0,0x8)+_0x1e790d(0x132)+_0x4519a7[_0x1e790d(0xdc)]+':\x20'+_0x4519a7[_0x1e790d(0x138)][_0x1e790d(0xae)](0x0,0x3c)),await P(_0x1e790d(0xc4),{'alias':Z,'message_id':_0x4519a7['id']});}}}async function A(){const _0x2803ad=a0_0x36e548;let _0x5b8eb3=new a0_0x2099b0();await K['connect'](_0x5b8eb3),Y('MCP\x20stdio\x20connected'),Y(_0x2803ad(0x134)),u()[_0x2803ad(0x122)](_0x2ad811=>Y('SSE\x20fatal:\x20'+_0x2ad811)),P(_0x2803ad(0x133),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x4755b6(),'hostname':a0_0x4755b6(),'agent':_0x2803ad(0xe2),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x2803ad(0x117)](()=>Y(_0x2803ad(0xb1)+Z+_0x2803ad(0xb2)+w[_0x2803ad(0xae)](0x0,0x8)+')'))[_0x2803ad(0x122)](_0x463f49=>Y(_0x2803ad(0xfb)+_0x463f49)),setInterval(()=>{const _0x5ec367=_0x2803ad;P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x4755b6(),'hostname':a0_0x4755b6(),'agent':'claude-code','project_dir':process[_0x5ec367(0x108)](),'tmux_name':j||void 0x0})[_0x5ec367(0x122)](_0x40b5bd=>Y(_0x5ec367(0x10a)+_0x40b5bd));},0x2bf20),Y(_0x2803ad(0xb4));}A()['catch'](_0x1e58ab=>{const _0x2aae5b=a0_0x36e548;Y(_0x2aae5b(0xb0)+_0x1e58ab),process[_0x2aae5b(0xf9)](0x1);});async function N(){const _0x1604d1=a0_0x36e548;Y(_0x1604d1(0xb7)),await P(_0x1604d1(0x133),{'resume_id':w,'alias':Z,'status':'error','task':'session\x20disconnected'})[_0x1604d1(0x122)](()=>{}),process['exit'](0x0);}process[a0_0x36e548(0xcf)]['on']('end',()=>N()),process['on'](a0_0x36e548(0xd8),()=>N()),process['on'](a0_0x36e548(0x10e),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.7-preview.1",
|
|
4
4
|
"description": "AI Agent Network CLI — Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 39 commands.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|