@sleep2agi/agent-network 2.0.0-preview.54 → 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_0x42116b=a0_0x24f4;(function(_0xd1cd08,_0x47a706){const _0x525a2e=a0_0x24f4,_0x426beb=_0xd1cd08();while(!![]){try{const _0x2b26c8=parseInt(_0x525a2e(0x22d))/0x1*(parseInt(_0x525a2e(0x1c2))/0x2)+-parseInt(_0x525a2e(0x1f5))/0x3+parseInt(_0x525a2e(0x1c4))/0x4*(parseInt(_0x525a2e(0x1be))/0x5)+-parseInt(_0x525a2e(0x1d5))/0x6*(parseInt(_0x525a2e(0x1cc))/0x7)+-parseInt(_0x525a2e(0x208))/0x8+parseInt(_0x525a2e(0x1e4))/0x9*(-parseInt(_0x525a2e(0x1d0))/0xa)+parseInt(_0x525a2e(0x1e7))/0xb;if(_0x2b26c8===_0x47a706)break;else _0x426beb['push'](_0x426beb['shift']());}catch(_0x407f73){_0x426beb['push'](_0x426beb['shift']());}}}(a0_0x2069,0x82397));import{readFileSync as a0_0x523992,existsSync as a0_0x5969cd}from'fs';import{join as a0_0x4a19e5}from'path';import{hostname as a0_0x35bd51}from'os';import{execSync as a0_0x5d8605}from'child_process';import{Server as a0_0x2b93e8}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x4e7fb4}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x3f50a2,CallToolRequestSchema as a0_0x982208}from'@modelcontextprotocol/sdk/types.js';function p(_0x5a58fb){const _0x7fa3d0=a0_0x24f4;if(!a0_0x5969cd(_0x5a58fb))return;for(let _0xd40755 of a0_0x523992(_0x5a58fb,_0x7fa3d0(0x235))[_0x7fa3d0(0x23c)]('\x0a')){let _0x5803c7=_0xd40755[_0x7fa3d0(0x22a)]();if(!_0x5803c7||_0x5803c7[_0x7fa3d0(0x233)]('#'))continue;let _0xdcc6bf=_0x5803c7[_0x7fa3d0(0x1cd)]('=');if(_0xdcc6bf<0x0)continue;let _0x472f7e=_0x5803c7['slice'](0x0,_0xdcc6bf)['trim'](),_0x204dfa=_0x5803c7[_0x7fa3d0(0x211)](_0xdcc6bf+0x1)[_0x7fa3d0(0x22a)]()[_0x7fa3d0(0x1c7)](/^["']|["']$/g,'');if(!process.env[_0x472f7e])process.env[_0x472f7e]=_0x204dfa;}}var C=process.env.HOME||'~',T=a0_0x4a19e5(C,a0_0x42116b(0x1ff));p(a0_0x4a19e5(T,a0_0x42116b(0x1ee)));var L=process[a0_0x42116b(0x213)]()['replace'](/\//g,'-');p(a0_0x4a19e5(T,L,a0_0x42116b(0x1ee)));function U(){const _0x557529=a0_0x42116b;try{return a0_0x5d8605(_0x557529(0x215),{'encoding':'utf-8','timeout':0x7d0})[_0x557529(0x22a)]();}catch{return'';}}function a0_0x24f4(_0x70edf3,_0x169f92){_0x70edf3=_0x70edf3-0x1ab;const _0x206936=a0_0x2069();let _0x24f498=_0x206936[_0x70edf3];return _0x24f498;}function c(){const _0x1d48b2=a0_0x42116b;try{let _0x41d9b6=a0_0x4a19e5(C,_0x1d48b2(0x1ab),_0x1d48b2(0x21b));if(a0_0x5969cd(_0x41d9b6))return JSON['parse'](a0_0x523992(_0x41d9b6,_0x1d48b2(0x235)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x42116b(0x206)]||a0_0x42116b(0x21c),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x35bd51(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto['randomUUID'](),X=process.env.COMMHUB_TOKEN||H[a0_0x42116b(0x207)]||'';function a0_0x2069(){const _0x9d185f=['Message\x20content','priority','stringify','session\x20disconnected','commhub-channel','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','slice','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','cwd','catch','tmux\x20display-message\x20-p\x20\x27#S\x27','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','\x20PROJECT_ENV=','connected','blocked','CommHub\x20init\x20failed:\x20','config.json','http://127.0.0.1:9200','pop','body','messages','then','commhub_reply','claude-code','read','initialize','high','send_message','notifications/claude/channel','normal','connecting\x20to\x20','trim','exit','application/json','33386RuztON','tools/call','message','error','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','SIGINT','startsWith','\x20priority=','utf-8','send_reply','warning:\x20could\x20not\x20register:\x20','fatal:\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','registered\x20as\x20\x22',']\x20[commhub]\x20','split','.anet','SSE\x20stream\x20ended,\x20reconnecting...','\x20ALIAS=','connect','find','get','Reply\x20text\x20/\x20result\x20summary','write','0.3.0','commhub_send_task','Target\x20session\x20alias','status','\x20RESUME_ID=','starting\x20SSE\x20listener...','commhub','decode','SIGTERM','working','stderr','2430XrxTqr',':\x20inbox_count=','object','SSE\x20connected\x20as\x20\x22','56mEycdK','number','5640ZDtFhO','2.0','end','replace','init\x20failed:\x20','idle','\x20from\x20','stdin','7nxhjSt','indexOf','inbox_count','2025-03-26','9807160SYOhaV','getReader','parse','failed','cancelled','1473810vAglmD','data:\x20','←\x20message\x20from\x20','string','content','type','→\x20injected\x20task\x20','commhub_send_message','completed','get_inbox','from_session','text','SSE\x20connection\x20error:\x20','in_progress','commhub_get_all_status','9oGHAyJ','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','result','10378951CWDDHE','none','/mcp','set','...\x20TMUX=','new_task','delete','.env','Priority\x20(default:\x20normal)','no\x20response','parse\x20error:\x20','POST','get_all_status','ack_inbox','997917gDcBaP','application/json,\x20text/event-stream','commhub_report_status','broadcast','new_message','report_status','replied','Progress\x200-100','SSE\x20fatal:\x20','setRequestHandler','.claude/channels/commhub','Session\x20alias:\x20','SSE\x20error:\x20','Bearer\x20','params','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','from','hub','token','3769760pOPCzy','statusText','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.'];a0_0x2069=function(){return _0x9d185f;};return a0_0x2069();}function Y(_0x501077){const _0x4d38e3=a0_0x42116b;let _0x2bba64=new Date()['toTimeString']()[_0x4d38e3(0x211)](0x0,0x8);process[_0x4d38e3(0x1bd)][_0x4d38e3(0x1b2)]('['+_0x2bba64+_0x4d38e3(0x23b)+_0x501077+'\x0a');}function h(_0x37281f){return new Promise(_0x1cc53c=>setTimeout(_0x1cc53c,_0x37281f));}Y('ENV:\x20URL='+D+a0_0x42116b(0x1ad)+Z+a0_0x42116b(0x1b7)+w[a0_0x42116b(0x211)](0x0,0x8)+a0_0x42116b(0x1eb)+(f||a0_0x42116b(0x1e8))+'\x20CWD='+process['cwd']()+a0_0x42116b(0x217)+L);var k=new Map(),K=new a0_0x2b93e8({'name':a0_0x42116b(0x20f),'version':a0_0x42116b(0x1b3)},{'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_0x42116b(0x210),a0_0x42116b(0x20a),a0_0x42116b(0x200)+Z]['join']('\x0a')});K[a0_0x42116b(0x1fe)](a0_0x3f50a2,async()=>({'tools':[{'name':a0_0x42116b(0x221),'description':a0_0x42116b(0x239),'inputSchema':{'type':a0_0x42116b(0x1c0),'properties':{'task_id':{'type':a0_0x42116b(0x1d8),'description':a0_0x42116b(0x1e5)},'text':{'type':a0_0x42116b(0x1d8),'description':a0_0x42116b(0x1b1)},'status':{'type':a0_0x42116b(0x1d8),'enum':[a0_0x42116b(0x1dd),a0_0x42116b(0x1d3),a0_0x42116b(0x1d4),a0_0x42116b(0x219),a0_0x42116b(0x230),a0_0x42116b(0x1e2)],'description':a0_0x42116b(0x216)}},'required':[a0_0x42116b(0x1e0)]}},{'name':a0_0x42116b(0x1f7),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':'object','properties':{'status':{'type':a0_0x42116b(0x1d8),'enum':[a0_0x42116b(0x1bc),a0_0x42116b(0x1c9),a0_0x42116b(0x219),a0_0x42116b(0x230)]},'task':{'type':a0_0x42116b(0x1d8),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x42116b(0x1c3),'description':a0_0x42116b(0x1fc)}},'required':['status']}},{'name':a0_0x42116b(0x1b4),'description':a0_0x42116b(0x204),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x42116b(0x1d8),'description':a0_0x42116b(0x1b5)},'task':{'type':a0_0x42116b(0x1d8),'description':'Task\x20content'},'priority':{'type':a0_0x42116b(0x1d8),'enum':[a0_0x42116b(0x225),a0_0x42116b(0x228),'low'],'description':a0_0x42116b(0x1ef)}},'required':['alias','task']}},{'name':a0_0x42116b(0x1dc),'description':a0_0x42116b(0x212),'inputSchema':{'type':a0_0x42116b(0x1c0),'properties':{'alias':{'type':a0_0x42116b(0x1d8),'description':a0_0x42116b(0x1b5)},'message':{'type':a0_0x42116b(0x1d8),'description':a0_0x42116b(0x20b)}},'required':['alias',a0_0x42116b(0x22f)]}},{'name':a0_0x42116b(0x1e3),'description':a0_0x42116b(0x231),'inputSchema':{'type':a0_0x42116b(0x1c0),'properties':{}}}]}));async function P(_0x33bcee,_0x453762){const _0x309128=a0_0x42116b;let _0x4acbce=await fetch(D+_0x309128(0x1e9),{'method':_0x309128(0x1f2),'headers':{'Content-Type':_0x309128(0x22c),'Accept':_0x309128(0x1f6),...X?{'Authorization':_0x309128(0x202)+X}:{}},'body':JSON[_0x309128(0x20d)]({'jsonrpc':'2.0','id':0x1,'method':_0x309128(0x224),'params':{'protocolVersion':_0x309128(0x1cf),'capabilities':{},'clientInfo':{'name':_0x309128(0x20f),'version':_0x309128(0x1b3)}}})});if(!_0x4acbce['ok']){let _0x564d62=await _0x4acbce[_0x309128(0x1e0)]();return Y(_0x309128(0x21a)+_0x4acbce[_0x309128(0x1b6)]+'\x20'+_0x564d62[_0x309128(0x211)](0x0,0x64)),{'ok':!0x1,'error':_0x309128(0x1c8)+_0x4acbce[_0x309128(0x1b6)]};}await _0x4acbce[_0x309128(0x1e0)]();let _0x189004=(await(await fetch(D+_0x309128(0x1e9),{'method':_0x309128(0x1f2),'headers':{'Content-Type':_0x309128(0x22c),'Accept':_0x309128(0x1f6),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x309128(0x20d)]({'jsonrpc':_0x309128(0x1c5),'id':0x2,'method':_0x309128(0x22e),'params':{'name':_0x33bcee,'arguments':_0x453762}})}))[_0x309128(0x1e0)]())[_0x309128(0x23c)]('\x0a')[_0x309128(0x1af)](_0x137318=>_0x137318[_0x309128(0x233)]('data:\x20'));if(_0x189004){let _0x6380df=JSON[_0x309128(0x1d2)](_0x189004['slice'](0x6));return _0x6380df?.['result']?.[_0x309128(0x1d9)]?.[0x0]?.['text']?JSON[_0x309128(0x1d2)](_0x6380df[_0x309128(0x1e6)][_0x309128(0x1d9)][0x0][_0x309128(0x1e0)]):_0x6380df;}return{'ok':!0x1,'error':_0x309128(0x1f0)};}K['setRequestHandler'](a0_0x982208,async _0x8f54f5=>{const _0x331e57=a0_0x42116b;let {name:_0x2f290b,arguments:_0x33e019}=_0x8f54f5[_0x331e57(0x203)];if(_0x2f290b===_0x331e57(0x221)){let {task_id:_0x28fa92,text:_0xd4f012,status:_0x14cd44}=_0x33e019;if(_0x14cd44===_0x331e57(0x1dd)||_0x14cd44===_0x331e57(0x1d3)||_0x14cd44==='cancelled'){let _0x249d6e=_0x14cd44===_0x331e57(0x1dd)?_0x331e57(0x1fb):_0x14cd44,_0x581e69=_0x28fa92?k[_0x331e57(0x1b0)](_0x28fa92)||_0x331e57(0x206):_0x331e57(0x206),_0x499557=await P(_0x331e57(0x236),{'alias':_0x581e69,'text':_0xd4f012,'in_reply_to':_0x28fa92||void 0x0,'status':_0x249d6e,'from_session':Z});if(_0x28fa92)k[_0x331e57(0x1ed)](_0x28fa92);return{'content':[{'type':_0x331e57(0x1e0),'text':JSON[_0x331e57(0x20d)](_0x499557)}]};}let _0x55b53b=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x14cd44==='blocked'?'blocked':_0x14cd44==='error'?_0x331e57(0x230):'working','task':_0xd4f012['slice'](0x0,0xc8),'output':_0xd4f012});return{'content':[{'type':_0x331e57(0x1e0),'text':JSON[_0x331e57(0x20d)](_0x55b53b)}]};}if(_0x2f290b===_0x331e57(0x1f7)){let {status:_0x153b58,task:_0x51e22b,progress:_0x44db87}=_0x33e019,_0x573b93=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x153b58,'task':_0x51e22b,'progress':_0x44db87});return{'content':[{'type':'text','text':JSON[_0x331e57(0x20d)](_0x573b93)}]};}if(_0x2f290b===_0x331e57(0x1b4)){let {alias:_0x14f7f3,task:_0x4baff2,priority:_0x3d1c46}=_0x33e019,_0x1108a7=await P('send_task',{'alias':_0x14f7f3,'task':_0x4baff2,'priority':_0x3d1c46||_0x331e57(0x228),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x331e57(0x20d)](_0x1108a7)}]};}if(_0x2f290b===_0x331e57(0x1dc)){let {alias:_0x62f1d7,message:_0x57e558}=_0x33e019,_0x4329c2=await P(_0x331e57(0x226),{'alias':_0x62f1d7,'message':_0x57e558,'from_session':Z});return{'content':[{'type':_0x331e57(0x1e0),'text':JSON['stringify'](_0x4329c2)}]};}if(_0x2f290b===_0x331e57(0x1e3)){let _0x36d17b=await P(_0x331e57(0x1f3),{});return{'content':[{'type':'text','text':JSON[_0x331e57(0x20d)](_0x36d17b)}]};}return{'content':[{'type':_0x331e57(0x1e0),'text':JSON[_0x331e57(0x20d)]({'error':'unknown\x20tool'})}]};});async function v(){const _0x4b4167=a0_0x42116b;let _0x39cac6=D+'/events/'+encodeURIComponent(Z),_0x4f9955={};if(X)_0x4f9955['Authorization']=_0x4b4167(0x202)+X;Y(_0x4b4167(0x229)+_0x39cac6);while(!0x0){try{let _0x1857d6=await fetch(_0x39cac6,{'headers':_0x4f9955});if(!_0x1857d6['ok']){Y(_0x4b4167(0x201)+_0x1857d6['status']+'\x20'+_0x1857d6[_0x4b4167(0x209)]),await h(0x1388);continue;}let _0x479896=_0x1857d6[_0x4b4167(0x21e)][_0x4b4167(0x1d1)](),_0x3ec651=new TextDecoder(),_0xba9da3='';while(!0x0){let {done:_0x57ef70,value:_0x52de9c}=await _0x479896[_0x4b4167(0x223)]();if(_0x57ef70)break;_0xba9da3+=_0x3ec651[_0x4b4167(0x1ba)](_0x52de9c,{'stream':!0x0});let _0x4f43a8=_0xba9da3[_0x4b4167(0x23c)]('\x0a\x0a');_0xba9da3=_0x4f43a8[_0x4b4167(0x21d)]()||'';for(let _0x41e8a3 of _0x4f43a8){let _0x10f500=_0x41e8a3[_0x4b4167(0x23c)]('\x0a')[_0x4b4167(0x1af)](_0x527618=>_0x527618[_0x4b4167(0x233)](_0x4b4167(0x1d6)));if(!_0x10f500)continue;try{let _0x1eb835=JSON[_0x4b4167(0x1d2)](_0x10f500[_0x4b4167(0x211)](0x6));await u(_0x1eb835);}catch(_0xe7ff23){Y(_0x4b4167(0x1f1)+_0xe7ff23);}}}Y(_0x4b4167(0x1ac));}catch(_0x5885ff){Y(_0x4b4167(0x1e1)+_0x5885ff);}await h(0xbb8);}}async function u(_0x39b755){const _0x41548a=a0_0x42116b;if(_0x39b755[_0x41548a(0x1da)]===_0x41548a(0x218)){Y(_0x41548a(0x1c1)+Z+'\x22');return;}if(_0x39b755[_0x41548a(0x1da)]===_0x41548a(0x1f9)){if(Y(_0x41548a(0x1d7)+_0x39b755['from']+':\x20'+_0x39b755[_0x41548a(0x22f)][_0x41548a(0x211)](0x0,0x3c)),await K['notification']({'method':_0x41548a(0x227),'params':{'content':_0x39b755[_0x41548a(0x22f)],'meta':{'sender':_0x39b755[_0x41548a(0x205)]||_0x41548a(0x206),'sender_id':'commhub','user':_0x39b755['from']||_0x41548a(0x206),'priority':_0x41548a(0x228)}}}),_0x39b755['message_id'])await P('ack_inbox',{'alias':Z,'message_id':_0x39b755['message_id']});return;}if(_0x39b755[_0x41548a(0x1da)]===_0x41548a(0x1ec)||_0x39b755[_0x41548a(0x1da)]===_0x41548a(0x1f8)){Y('←\x20'+_0x39b755[_0x41548a(0x1da)]+_0x41548a(0x1bf)+_0x39b755[_0x41548a(0x1ce)]+_0x41548a(0x234)+(_0x39b755[_0x41548a(0x20c)]||_0x41548a(0x228)));let _0x33a809=await P(_0x41548a(0x1de),{'alias':Z,'limit':0x5});if(_0x33a809?.['ok']&&_0x33a809['messages']?.['length']>0x0)for(let _0x315863 of _0x33a809[_0x41548a(0x21f)]){let _0x44dddd={'sender':_0x315863[_0x41548a(0x1df)]||_0x41548a(0x206),'sender_id':_0x41548a(0x1b9),'user':_0x315863[_0x41548a(0x1df)]||_0x41548a(0x206),'task_id':_0x315863['id'],'priority':_0x315863[_0x41548a(0x20c)]||_0x41548a(0x228)};k[_0x41548a(0x1ea)](_0x315863['id'],_0x315863[_0x41548a(0x1df)]||_0x41548a(0x206)),await K['notification']({'method':'notifications/claude/channel','params':{'content':_0x315863[_0x41548a(0x1d9)],'meta':_0x44dddd}}),Y(_0x41548a(0x1db)+_0x315863['id'][_0x41548a(0x211)](0x0,0x8)+_0x41548a(0x1ca)+_0x315863[_0x41548a(0x1df)]+':\x20'+_0x315863[_0x41548a(0x1d9)][_0x41548a(0x211)](0x0,0x3c)),await P(_0x41548a(0x1f4),{'alias':Z,'message_id':_0x315863['id']});}}}async function S(){const _0x363426=a0_0x42116b;let _0x229269=new a0_0x4e7fb4();await K[_0x363426(0x1ae)](_0x229269),Y('MCP\x20stdio\x20connected'),Y(_0x363426(0x1b8)),v()[_0x363426(0x214)](_0x32a34a=>Y(_0x363426(0x1fd)+_0x32a34a)),P(_0x363426(0x1fa),{'resume_id':w,'alias':Z,'status':_0x363426(0x1c9),'server':a0_0x35bd51(),'hostname':a0_0x35bd51(),'agent':_0x363426(0x222),'project_dir':process[_0x363426(0x213)](),'tmux_name':f||void 0x0})[_0x363426(0x220)](()=>Y(_0x363426(0x23a)+Z+'\x22\x20('+w['slice'](0x0,0x8)+')'))[_0x363426(0x214)](_0x1dcd69=>Y(_0x363426(0x237)+_0x1dcd69)),setInterval(()=>{const _0x47a424=_0x363426;P(_0x47a424(0x1fa),{'resume_id':w,'alias':Z,'status':_0x47a424(0x1c9),'server':a0_0x35bd51(),'hostname':a0_0x35bd51(),'agent':'claude-code','project_dir':process[_0x47a424(0x213)](),'tmux_name':f||void 0x0})[_0x47a424(0x214)](_0x4131d3=>Y('heartbeat\x20failed:\x20'+_0x4131d3));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}S()[a0_0x42116b(0x214)](_0x14c8ab=>{const _0x21ab99=a0_0x42116b;Y(_0x21ab99(0x238)+_0x14c8ab),process[_0x21ab99(0x22b)](0x1);});async function N(){const _0x2ebf03=a0_0x42116b;Y('shutting\x20down,\x20reporting\x20offline...'),await P(_0x2ebf03(0x1fa),{'resume_id':w,'alias':Z,'status':_0x2ebf03(0x230),'task':_0x2ebf03(0x20e)})[_0x2ebf03(0x214)](()=>{}),process[_0x2ebf03(0x22b)](0x0);}process[a0_0x42116b(0x1cb)]['on'](a0_0x42116b(0x1c6),()=>N()),process['on'](a0_0x42116b(0x1bb),()=>N()),process['on'](a0_0x42116b(0x232),()=>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",
|