@sleep2agi/agent-network 2.0.0-preview.26 → 2.0.0-preview.27
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
|
+
const a0_0x9487dc=a0_0x5c6f;(function(_0x34fbc7,_0x4d1ace){const _0x557984=a0_0x5c6f,_0x5e07ae=_0x34fbc7();while(!![]){try{const _0x565cdf=parseInt(_0x557984(0xb9))/0x1*(-parseInt(_0x557984(0x8c))/0x2)+-parseInt(_0x557984(0xb6))/0x3+-parseInt(_0x557984(0xb5))/0x4+-parseInt(_0x557984(0x99))/0x5+parseInt(_0x557984(0x98))/0x6+parseInt(_0x557984(0xc5))/0x7+-parseInt(_0x557984(0x9d))/0x8*(-parseInt(_0x557984(0x92))/0x9);if(_0x565cdf===_0x4d1ace)break;else _0x5e07ae['push'](_0x5e07ae['shift']());}catch(_0x3deadf){_0x5e07ae['push'](_0x5e07ae['shift']());}}}(a0_0x1f57,0xdcf41));import{EventEmitter as a0_0x5c27ad}from'events';import{hostname as a0_0x3dcd27}from'os';class T extends a0_0x5c27ad{[a0_0x9487dc(0x8e)];[a0_0x9487dc(0xb0)];[a0_0x9487dc(0x7c)];[a0_0x9487dc(0xa7)];[a0_0x9487dc(0x9f)];[a0_0x9487dc(0xc8)];[a0_0x9487dc(0x9a)];[a0_0x9487dc(0xa6)];[a0_0x9487dc(0x80)];[a0_0x9487dc(0xa5)]=!0x1;constructor(_0x4290d3){const _0x17d288=a0_0x9487dc;super();if(this[_0x17d288(0x8e)]=_0x4290d3['url'][_0x17d288(0xba)](/\/$/,''),this['alias']=_0x4290d3[_0x17d288(0xb0)],this[_0x17d288(0x7c)]=_0x4290d3['token'],this['agent']=_0x4290d3[_0x17d288(0xa7)]||_0x17d288(0x90),this[_0x17d288(0x9f)]=_0x17d288(0x9b)+_0x4290d3[_0x17d288(0xb0)]+'-'+Date[_0x17d288(0xc4)]()[_0x17d288(0x8f)](0x24),this['heartbeatInterval']=_0x4290d3[_0x17d288(0xc8)]??0x2bf20,this[_0x17d288(0x9a)]=_0x4290d3[_0x17d288(0x9a)]??0xbb8,_0x4290d3[_0x17d288(0xa1)]!==!0x1)this['connect']();}[a0_0x9487dc(0xcb)](_0x32aa51){const _0xe564d1=a0_0x9487dc;console[_0xe564d1(0xcb)]('['+new Date()[_0xe564d1(0xac)]()['slice'](0x0,0x8)+_0xe564d1(0xce)+this[_0xe564d1(0xb0)]+']\x20'+_0x32aa51);}async[a0_0x9487dc(0x91)](_0x210558,_0x32db71){const _0x4b3db2=a0_0x9487dc;let _0xe972fa={'Content-Type':'application/json','Accept':_0x4b3db2(0xae)};if(this[_0x4b3db2(0x7c)])_0xe972fa[_0x4b3db2(0x84)]=_0x4b3db2(0xad)+this[_0x4b3db2(0x7c)];let _0x37b729=await(await fetch(this[_0x4b3db2(0x8e)]+'/mcp',{'method':_0x4b3db2(0xab),'headers':_0xe972fa,'body':JSON[_0x4b3db2(0x9e)]({'jsonrpc':'2.0','id':Date['now'](),'method':_0x4b3db2(0xbf),'params':{'name':_0x210558,'arguments':_0x32db71}})}))[_0x4b3db2(0xc6)](),_0x3c8fa5=_0x37b729['match'](/data: (.+)/),_0x4e08cc=_0x3c8fa5?JSON[_0x4b3db2(0xb2)](_0x3c8fa5[0x1]):JSON[_0x4b3db2(0xb2)](_0x37b729),_0x2d2f5f=_0x4e08cc?.[_0x4b3db2(0x86)]?.[_0x4b3db2(0xaf)]?.[0x0]?.[_0x4b3db2(0xc6)];return _0x2d2f5f?JSON[_0x4b3db2(0xb2)](_0x2d2f5f):_0x4e08cc;}async['connect'](){const _0x1c7774=a0_0x9487dc;if(this[_0x1c7774(0xa5)])return;this[_0x1c7774(0xa5)]=!0x0,await this['status'](_0x1c7774(0xa4)),this['log'](_0x1c7774(0xa3)),this[_0x1c7774(0xa6)]=setInterval(()=>{const _0x10637c=_0x1c7774;this[_0x10637c(0xc9)](_0x10637c(0xa4))[_0x10637c(0xa2)](_0x13ee81=>this[_0x10637c(0xcb)](_0x10637c(0xa9)+_0x13ee81['message']));},this['heartbeatInterval']),this[_0x1c7774(0x7f)]();}async[a0_0x9487dc(0xb8)](){const _0xd9aa9e=a0_0x9487dc;if(this[_0xd9aa9e(0xa5)]=!0x1,this[_0xd9aa9e(0x80)]?.[_0xd9aa9e(0xd1)](),this[_0xd9aa9e(0xa6)])clearInterval(this[_0xd9aa9e(0xa6)]);await this[_0xd9aa9e(0xc9)](_0xd9aa9e(0xa0))[_0xd9aa9e(0xa2)](()=>{}),this[_0xd9aa9e(0xcb)](_0xd9aa9e(0xcd));}async[a0_0x9487dc(0x83)](_0x21b7fa,_0x149f3a,_0x82fedc=a0_0x9487dc(0x89)){const _0xcd835c=a0_0x9487dc;return this[_0xcd835c(0x91)](_0xcd835c(0x8d),{'alias':_0x21b7fa,'task':_0x149f3a,'priority':_0x82fedc,'from_session':this[_0xcd835c(0xb0)]});}async[a0_0x9487dc(0x81)](_0x3d826b,_0x2f52f6){const _0x5b44d0=a0_0x9487dc;return this[_0x5b44d0(0x91)](_0x5b44d0(0xbc),{'alias':_0x3d826b,'message':_0x2f52f6,'from_session':this[_0x5b44d0(0xb0)]});}async[a0_0x9487dc(0x8b)](_0x1fea96,_0x37dde0,_0x4d4a0f=a0_0x9487dc(0xcf)){const _0x2aca58=a0_0x9487dc;return this[_0x2aca58(0x91)](_0x2aca58(0x8b),{'task_id':_0x1fea96,'text':_0x37dde0,'status':_0x4d4a0f});}async[a0_0x9487dc(0xc9)](_0x349891,_0x592f61){const _0x4301fa=a0_0x9487dc;return this[_0x4301fa(0x91)](_0x4301fa(0xc0),{'resume_id':this[_0x4301fa(0x9f)],'alias':this[_0x4301fa(0xb0)],'status':_0x349891,'server':a0_0x3dcd27(),'hostname':a0_0x3dcd27(),'agent':this[_0x4301fa(0xa7)],'project_dir':process[_0x4301fa(0x87)](),..._0x592f61});}async[a0_0x9487dc(0xb1)](){const _0x59c593=a0_0x9487dc;return this[_0x59c593(0x91)]('get_all_status',{});}async[a0_0x9487dc(0xd0)](_0x235953,_0x4be855){const _0x22f188=a0_0x9487dc;return this[_0x22f188(0x91)](_0x22f188(0xd0),{'message':_0x235953,'filter_server':_0x4be855?.[_0x22f188(0xa8)],'filter_status':_0x4be855?.[_0x22f188(0xc9)]});}async[a0_0x9487dc(0x7f)](){const _0x135f05=a0_0x9487dc;let _0x2758f0=encodeURIComponent(this[_0x135f05(0xb0)]),_0x5b90e9=this[_0x135f05(0x8e)]+'/events/'+_0x2758f0,_0x4cc08b=this[_0x135f05(0x9a)];while(this[_0x135f05(0xa5)]){try{this[_0x135f05(0x80)]=new AbortController();let _0x42e234={'Accept':'text/event-stream'};if(this[_0x135f05(0x7c)])_0x42e234[_0x135f05(0x84)]=_0x135f05(0xad)+this['token'];let _0x585123=await fetch(_0x5b90e9,{'headers':_0x42e234,'signal':this[_0x135f05(0x80)]['signal']});if(!_0x585123['ok']||!_0x585123[_0x135f05(0xbb)]){this[_0x135f05(0xcb)](_0x135f05(0xc1)+_0x585123['status']),await this[_0x135f05(0xb7)](_0x4cc08b),_0x4cc08b=Math[_0x135f05(0x82)](_0x4cc08b*1.5,0xea60);continue;}_0x4cc08b=this[_0x135f05(0x9a)];let _0x5be6d6=_0x585123[_0x135f05(0xbb)][_0x135f05(0x97)](),_0x47ebe1=new TextDecoder(),_0x2b2f79='';while(this[_0x135f05(0xa5)]){let {done:_0x4205b2,value:_0x20f8a6}=await _0x5be6d6[_0x135f05(0xc3)]();if(_0x4205b2)break;_0x2b2f79+=_0x47ebe1['decode'](_0x20f8a6,{'stream':!0x0});let _0x1f97e=_0x2b2f79[_0x135f05(0x95)]('\x0a');_0x2b2f79=_0x1f97e[_0x135f05(0xaa)]()||'';for(let _0x36fbb0 of _0x1f97e){if(!_0x36fbb0['startsWith'](_0x135f05(0x8a)))continue;try{let _0x560404=JSON[_0x135f05(0xb2)](_0x36fbb0[_0x135f05(0xbe)](0x6));if(_0x560404[_0x135f05(0x93)]==='connected'){this[_0x135f05(0xcb)](_0x135f05(0xb3)),this[_0x135f05(0x88)]('connected');continue;}if(_0x560404['type']===_0x135f05(0x85)||_0x560404[_0x135f05(0x93)]==='new_message'||_0x560404['type']===_0x135f05(0xd0))await this['processInbox']();}catch{}}}}catch(_0x4712e8){if(_0x4712e8[_0x135f05(0xc2)]===_0x135f05(0xca))break;this[_0x135f05(0x88)](_0x135f05(0xc7),_0x4712e8),this[_0x135f05(0xcb)](_0x135f05(0xcc)+_0x4712e8[_0x135f05(0x81)]);}if(this['running'])this[_0x135f05(0x88)](_0x135f05(0xcd)),this[_0x135f05(0xcb)](_0x135f05(0xb4)+_0x4cc08b/0x3e8+_0x135f05(0x7d)),await this[_0x135f05(0xb7)](_0x4cc08b),_0x4cc08b=Math['min'](_0x4cc08b*1.5,0xea60);}}async[a0_0x9487dc(0xbd)](){const _0x2f6724=a0_0x9487dc;try{let _0x272873=(await this[_0x2f6724(0x91)]('get_inbox',{'alias':this[_0x2f6724(0xb0)],'limit':0xa}))?.['messages']||[];for(let _0x37fc31 of _0x272873)await this[_0x2f6724(0x91)](_0x2f6724(0x94),{'alias':this[_0x2f6724(0xb0)],'message_id':_0x37fc31['id']}),this[_0x2f6724(0xcb)]('←\x20'+_0x37fc31[_0x2f6724(0x96)]+':\x20'+_0x37fc31[_0x2f6724(0xaf)][_0x2f6724(0xbe)](0x0,0x3c)),this['emit'](_0x2f6724(0x9c),_0x37fc31),this[_0x2f6724(0x88)](_0x2f6724(0x81),_0x37fc31);}catch(_0xc99ea){this[_0x2f6724(0xcb)](_0x2f6724(0x7e)+_0xc99ea[_0x2f6724(0x81)]);}}[a0_0x9487dc(0xb7)](_0x2e651){return new Promise(_0x2e350c=>setTimeout(_0x2e350c,_0x2e651));}}function a0_0x1f57(){const _0x486cea=['now','5428535gDiaOl','text','error','heartbeatInterval','status','AbortError','log','SSE\x20error:\x20','disconnected',']\x20[commhub:','completed','broadcast','abort','token','s...','inbox\x20error:\x20','connectSSE','sseAbort','message','min','send','Authorization','new_task','result','cwd','emit','normal','data:\x20','reply','722142MLXedw','send_task','url','toString','sdk','call','9xvePys','type','ack_inbox','split','from_session','getReader','5992104rTgeeg','1738130oADiIL','reconnectDelay','sdk-','task','6310320pUTezZ','stringify','resumeId','offline','autoConnect','catch','registered','idle','running','heartbeatTimer','agent','server','heartbeat\x20failed:\x20','pop','POST','toTimeString','Bearer\x20','application/json,\x20text/event-stream','content','alias','getAllStatus','parse','SSE\x20connected','SSE\x20reconnecting\x20in\x20','766212xdTulH','1189899aHIcFn','sleep','disconnect','2ETXnQq','replace','body','send_message','processInbox','slice','tools/call','report_status','SSE\x20failed:\x20','name','read'];a0_0x1f57=function(){return _0x486cea;};return a0_0x1f57();}var $=T;function a0_0x5c6f(_0x5aec37,_0x453812){_0x5aec37=_0x5aec37-0x7c;const _0x1f5762=a0_0x1f57();let _0x5c6fb6=_0x1f5762[_0x5aec37];return _0x5c6fb6;}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_0x499f72=a0_0x5111;(function(_0x54b761,_0x104e43){const _0x1b6b97=a0_0x5111,_0x590f53=_0x54b761();while(!![]){try{const _0x5ba491=parseInt(_0x1b6b97(0x1f6))/0x1+-parseInt(_0x1b6b97(0x213))/0x2+-parseInt(_0x1b6b97(0x1f9))/0x3+parseInt(_0x1b6b97(0x255))/0x4*(-parseInt(_0x1b6b97(0x214))/0x5)+-parseInt(_0x1b6b97(0x26e))/0x6*(-parseInt(_0x1b6b97(0x209))/0x7)+-parseInt(_0x1b6b97(0x21e))/0x8*(parseInt(_0x1b6b97(0x1f4))/0x9)+parseInt(_0x1b6b97(0x258))/0xa*(parseInt(_0x1b6b97(0x266))/0xb);if(_0x5ba491===_0x104e43)break;else _0x590f53['push'](_0x590f53['shift']());}catch(_0x189aa5){_0x590f53['push'](_0x590f53['shift']());}}}(a0_0x1655,0x396f2));import{readFileSync as a0_0x30c045,existsSync as a0_0x36485a}from'fs';import{join as a0_0x5d5e4c}from'path';import{hostname as a0_0x1bf7b1}from'os';import{execSync as a0_0x5e2245}from'child_process';function a0_0x1655(){const _0x18d5e5=['text','MCP\x20stdio\x20connected','\x20CWD=','.anet','completed','message','join','cwd','→\x20injected\x20task\x20','decode','replied','no\x20response','error','503944ZbCZwg','low','in_progress','15430gWxDLX','0.3.0','/mcp','working','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','Priority\x20(default:\x20normal)','task','application/json,\x20text/event-stream','replace','ready\x20—\x20waiting\x20for\x20events','result','indexOf','type','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','4037woPmsk','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','read','then','stdin','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','.claude/channels/commhub','398958kWmsQR','slice','ack_inbox','getReader','startsWith','Task\x20content','failed','SSE\x20connected\x20as\x20\x22','2025-03-26','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','\x20PROJECT_ENV=','split','body','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','fatal:\x20','tmux\x20display-message\x20-p\x20\x27#S\x27','content','object','normal','token','report_status','unknown\x20tool','toTimeString','messages','185292dBaEqK','high','177067QfVCQw','data:\x20','Authorization','780609wNSXJX','message_id','initialize','setRequestHandler','POST','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','write','parse\x20error:\x20','string','stderr','none','send_task','end','new_message','from_session','commhub_send_message','28eiEdmJ','set','commhub_send_task','Target\x20session\x20alias','find','connecting\x20to\x20','trim','notifications/claude/channel','cancelled','stringify','446354JpSAAt','5YhqMWB','delete','←\x20message\x20from\x20','blocked','Bearer\x20','get','\x20priority=','SIGTERM','commhub','\x22\x20(','64gJBJfg','shutting\x20down,\x20reporting\x20offline...','priority','...\x20TMUX=','application/json','utf-8','SSE\x20stream\x20ended,\x20reconnecting...','parse','starting\x20SSE\x20listener...','Current\x20task\x20description','from','config.json','2.0','send_message','\x20from\x20',']\x20[commhub]\x20','alias','\x20ALIAS=','/events/','catch',':\x20inbox_count=','commhub_get_all_status','status','Reply\x20text\x20/\x20result\x20summary','SSE\x20connection\x20error:\x20','claude-code','broadcast','\x20RESUME_ID=','hub','session\x20disconnected','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','get_all_status','Session\x20alias:\x20','commhub_report_status','.env','CommHub\x20init\x20failed:\x20','idle','new_task','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','statusText','init\x20failed:\x20','commhub_reply'];a0_0x1655=function(){return _0x18d5e5;};return a0_0x1655();}import{Server as a0_0x565864}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x1e1653}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x2d0675,CallToolRequestSchema as a0_0xdd2322}from'@modelcontextprotocol/sdk/types.js';function p(_0x54a714){const _0x528583=a0_0x5111;if(!a0_0x36485a(_0x54a714))return;for(let _0x20fd12 of a0_0x30c045(_0x54a714,_0x528583(0x223))[_0x528583(0x1e7)]('\x0a')){let _0x1c406f=_0x20fd12[_0x528583(0x20f)]();if(!_0x1c406f||_0x1c406f[_0x528583(0x272)]('#'))continue;let _0x160a50=_0x1c406f[_0x528583(0x263)]('=');if(_0x160a50<0x0)continue;let _0x35072b=_0x1c406f[_0x528583(0x26f)](0x0,_0x160a50)['trim'](),_0x281633=_0x1c406f[_0x528583(0x26f)](_0x160a50+0x1)['trim']()[_0x528583(0x260)](/^["']|["']$/g,'');if(!process.env[_0x35072b])process.env[_0x35072b]=_0x281633;}}var C=process.env.HOME||'~',T=a0_0x5d5e4c(C,a0_0x499f72(0x26d));p(a0_0x5d5e4c(T,a0_0x499f72(0x240)));var L=process[a0_0x499f72(0x24f)]()[a0_0x499f72(0x260)](/\//g,'-');p(a0_0x5d5e4c(T,L,a0_0x499f72(0x240)));function U(){const _0x522f34=a0_0x499f72;try{return a0_0x5e2245(_0x522f34(0x1eb),{'encoding':'utf-8','timeout':0x7d0})[_0x522f34(0x20f)]();}catch{return'';}}function c(){const _0x361890=a0_0x499f72;try{let _0x166269=a0_0x5d5e4c(C,_0x361890(0x24b),_0x361890(0x229));if(a0_0x36485a(_0x166269))return JSON['parse'](a0_0x30c045(_0x166269,_0x361890(0x223)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x499f72(0x23a)]||'http://127.0.0.1:9200',f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x1bf7b1(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto['randomUUID'](),X=process.env.COMMHUB_TOKEN||H[a0_0x499f72(0x1ef)]||'';function a0_0x5111(_0x2ce17c,_0x292086){_0x2ce17c=_0x2ce17c-0x1e4;const _0x165555=a0_0x1655();let _0x5111ce=_0x165555[_0x2ce17c];return _0x5111ce;}function Y(_0x59536d){const _0xd49e40=a0_0x499f72;let _0x3c4fbc=new Date()[_0xd49e40(0x1f2)]()[_0xd49e40(0x26f)](0x0,0x8);process[_0xd49e40(0x202)][_0xd49e40(0x1ff)]('['+_0x3c4fbc+_0xd49e40(0x22d)+_0x59536d+'\x0a');}function h(_0x1eb3a9){return new Promise(_0x81347b=>setTimeout(_0x81347b,_0x1eb3a9));}Y('ENV:\x20URL='+D+a0_0x499f72(0x22f)+Z+a0_0x499f72(0x239)+w[a0_0x499f72(0x26f)](0x0,0x8)+a0_0x499f72(0x221)+(f||a0_0x499f72(0x203))+a0_0x499f72(0x24a)+process[a0_0x499f72(0x24f)]()+a0_0x499f72(0x1e6)+L);var k=new Map(),K=new a0_0x565864({'name':'commhub-channel','version':a0_0x499f72(0x259)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x499f72(0x23c),a0_0x499f72(0x26b),a0_0x499f72(0x265),a0_0x499f72(0x1e9),a0_0x499f72(0x23e)+Z][a0_0x499f72(0x24e)]('\x0a')});K['setRequestHandler'](a0_0x2d0675,async()=>({'tools':[{'name':a0_0x499f72(0x247),'description':a0_0x499f72(0x244),'inputSchema':{'type':a0_0x499f72(0x1ed),'properties':{'task_id':{'type':a0_0x499f72(0x201),'description':a0_0x499f72(0x26c)},'text':{'type':'string','description':a0_0x499f72(0x235)},'status':{'type':a0_0x499f72(0x201),'enum':['completed',a0_0x499f72(0x274),a0_0x499f72(0x211),a0_0x499f72(0x217),a0_0x499f72(0x254),a0_0x499f72(0x257)],'description':a0_0x499f72(0x25c)}},'required':[a0_0x499f72(0x248)]}},{'name':a0_0x499f72(0x23f),'description':a0_0x499f72(0x267),'inputSchema':{'type':a0_0x499f72(0x1ed),'properties':{'status':{'type':'string','enum':[a0_0x499f72(0x25b),a0_0x499f72(0x242),a0_0x499f72(0x217),'error']},'task':{'type':a0_0x499f72(0x201),'description':a0_0x499f72(0x227)},'progress':{'type':'number','description':'Progress\x200-100'}},'required':['status']}},{'name':a0_0x499f72(0x20b),'description':a0_0x499f72(0x1e5),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x499f72(0x201),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x499f72(0x201),'description':a0_0x499f72(0x273)},'priority':{'type':a0_0x499f72(0x201),'enum':[a0_0x499f72(0x1f5),a0_0x499f72(0x1ee),a0_0x499f72(0x256)],'description':a0_0x499f72(0x25d)}},'required':[a0_0x499f72(0x22e),a0_0x499f72(0x25e)]}},{'name':a0_0x499f72(0x208),'description':a0_0x499f72(0x1fe),'inputSchema':{'type':'object','properties':{'alias':{'type':'string','description':a0_0x499f72(0x20c)},'message':{'type':a0_0x499f72(0x201),'description':'Message\x20content'}},'required':['alias',a0_0x499f72(0x24d)]}},{'name':'commhub_get_all_status','description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x499f72(0x1ed),'properties':{}}}]}));async function P(_0x927259,_0x371dc8){const _0x10e9d7=a0_0x499f72;let _0x27292d=await fetch(D+_0x10e9d7(0x25a),{'method':_0x10e9d7(0x1fd),'headers':{'Content-Type':_0x10e9d7(0x222),'Accept':_0x10e9d7(0x25f),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x10e9d7(0x212)]({'jsonrpc':_0x10e9d7(0x22a),'id':0x1,'method':_0x10e9d7(0x1fb),'params':{'protocolVersion':_0x10e9d7(0x1e4),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x10e9d7(0x259)}}})});if(!_0x27292d['ok']){let _0x25db72=await _0x27292d[_0x10e9d7(0x248)]();return Y(_0x10e9d7(0x241)+_0x27292d[_0x10e9d7(0x234)]+'\x20'+_0x25db72[_0x10e9d7(0x26f)](0x0,0x64)),{'ok':!0x1,'error':_0x10e9d7(0x246)+_0x27292d[_0x10e9d7(0x234)]};}await _0x27292d[_0x10e9d7(0x248)]();let _0xced4ad=(await(await fetch(D+'/mcp',{'method':_0x10e9d7(0x1fd),'headers':{'Content-Type':_0x10e9d7(0x222),'Accept':_0x10e9d7(0x25f),...X?{'Authorization':_0x10e9d7(0x218)+X}:{}},'body':JSON[_0x10e9d7(0x212)]({'jsonrpc':_0x10e9d7(0x22a),'id':0x2,'method':'tools/call','params':{'name':_0x927259,'arguments':_0x371dc8}})}))['text']())[_0x10e9d7(0x1e7)]('\x0a')[_0x10e9d7(0x20d)](_0x43400a=>_0x43400a['startsWith']('data:\x20'));if(_0xced4ad){let _0x157160=JSON[_0x10e9d7(0x225)](_0xced4ad[_0x10e9d7(0x26f)](0x6));return _0x157160?.[_0x10e9d7(0x262)]?.[_0x10e9d7(0x1ec)]?.[0x0]?.['text']?JSON[_0x10e9d7(0x225)](_0x157160[_0x10e9d7(0x262)][_0x10e9d7(0x1ec)][0x0][_0x10e9d7(0x248)]):_0x157160;}return{'ok':!0x1,'error':_0x10e9d7(0x253)};}K[a0_0x499f72(0x1fc)](a0_0xdd2322,async _0x3c289e=>{const _0x55df36=a0_0x499f72;let {name:_0x439682,arguments:_0x2c8fb0}=_0x3c289e['params'];if(_0x439682===_0x55df36(0x247)){let {task_id:_0x4c168a,text:_0x382c15,status:_0x4794fb}=_0x2c8fb0;if(_0x4794fb===_0x55df36(0x24c)||_0x4794fb===_0x55df36(0x274)||_0x4794fb===_0x55df36(0x211)){let _0x2211ce=_0x4794fb===_0x55df36(0x24c)?_0x55df36(0x252):_0x4794fb,_0x3190b8=_0x4c168a?k[_0x55df36(0x219)](_0x4c168a)||'hub':_0x55df36(0x23a),_0x8ec866=await P('send_reply',{'alias':_0x3190b8,'text':_0x382c15,'in_reply_to':_0x4c168a||void 0x0,'status':_0x2211ce,'from_session':Z});if(_0x4c168a)k[_0x55df36(0x215)](_0x4c168a);return{'content':[{'type':_0x55df36(0x248),'text':JSON['stringify'](_0x8ec866)}]};}let _0x147cdf=await P(_0x55df36(0x1f0),{'resume_id':w,'alias':Z,'status':_0x4794fb===_0x55df36(0x217)?_0x55df36(0x217):_0x4794fb==='error'?_0x55df36(0x254):_0x55df36(0x25b),'task':_0x382c15[_0x55df36(0x26f)](0x0,0xc8),'output':_0x382c15});return{'content':[{'type':_0x55df36(0x248),'text':JSON[_0x55df36(0x212)](_0x147cdf)}]};}if(_0x439682===_0x55df36(0x23f)){let {status:_0xcb65ed,task:_0x42253f,progress:_0x96f293}=_0x2c8fb0,_0xb08848=await P(_0x55df36(0x1f0),{'resume_id':w,'alias':Z,'status':_0xcb65ed,'task':_0x42253f,'progress':_0x96f293});return{'content':[{'type':_0x55df36(0x248),'text':JSON['stringify'](_0xb08848)}]};}if(_0x439682==='commhub_send_task'){let {alias:_0x299323,task:_0x2dd347,priority:_0x2d1848}=_0x2c8fb0,_0x4e3718=await P(_0x55df36(0x204),{'alias':_0x299323,'task':_0x2dd347,'priority':_0x2d1848||_0x55df36(0x1ee),'from_session':Z});return{'content':[{'type':_0x55df36(0x248),'text':JSON[_0x55df36(0x212)](_0x4e3718)}]};}if(_0x439682===_0x55df36(0x208)){let {alias:_0x5e9384,message:_0x2648f4}=_0x2c8fb0,_0x37842c=await P(_0x55df36(0x22b),{'alias':_0x5e9384,'message':_0x2648f4,'from_session':Z});return{'content':[{'type':_0x55df36(0x248),'text':JSON[_0x55df36(0x212)](_0x37842c)}]};}if(_0x439682===_0x55df36(0x233)){let _0x7759ee=await P(_0x55df36(0x23d),{});return{'content':[{'type':_0x55df36(0x248),'text':JSON['stringify'](_0x7759ee)}]};}return{'content':[{'type':'text','text':JSON[_0x55df36(0x212)]({'error':_0x55df36(0x1f1)})}]};});async function v(){const _0x212750=a0_0x499f72;let _0x1de250=D+_0x212750(0x230)+encodeURIComponent(Z),_0x2ce99d={};if(X)_0x2ce99d[_0x212750(0x1f8)]=_0x212750(0x218)+X;Y(_0x212750(0x20e)+_0x1de250);while(!0x0){try{let _0x37055a=await fetch(_0x1de250,{'headers':_0x2ce99d});if(!_0x37055a['ok']){Y('SSE\x20error:\x20'+_0x37055a['status']+'\x20'+_0x37055a[_0x212750(0x245)]),await h(0x1388);continue;}let _0x196c4a=_0x37055a[_0x212750(0x1e8)][_0x212750(0x271)](),_0x3d9377=new TextDecoder(),_0x11b316='';while(!0x0){let {done:_0x5f54b5,value:_0x339c06}=await _0x196c4a[_0x212750(0x268)]();if(_0x5f54b5)break;_0x11b316+=_0x3d9377[_0x212750(0x251)](_0x339c06,{'stream':!0x0});let _0x2277c1=_0x11b316['split']('\x0a\x0a');_0x11b316=_0x2277c1['pop']()||'';for(let _0x2df77a of _0x2277c1){let _0xb6225d=_0x2df77a['split']('\x0a')[_0x212750(0x20d)](_0x28b37b=>_0x28b37b[_0x212750(0x272)](_0x212750(0x1f7)));if(!_0xb6225d)continue;try{let _0x3114e6=JSON[_0x212750(0x225)](_0xb6225d[_0x212750(0x26f)](0x6));await u(_0x3114e6);}catch(_0x28ee94){Y(_0x212750(0x200)+_0x28ee94);}}}Y(_0x212750(0x224));}catch(_0x48049a){Y(_0x212750(0x236)+_0x48049a);}await h(0xbb8);}}async function u(_0x5b06d6){const _0x2ca962=a0_0x499f72;if(_0x5b06d6['type']==='connected'){Y(_0x2ca962(0x275)+Z+'\x22');return;}if(_0x5b06d6[_0x2ca962(0x264)]===_0x2ca962(0x206)){if(Y(_0x2ca962(0x216)+_0x5b06d6[_0x2ca962(0x228)]+':\x20'+_0x5b06d6['message'][_0x2ca962(0x26f)](0x0,0x3c)),await K['notification']({'method':_0x2ca962(0x210),'params':{'content':_0x5b06d6['message'],'meta':{'sender':_0x5b06d6[_0x2ca962(0x228)]||_0x2ca962(0x23a),'sender_id':_0x2ca962(0x21c),'user':_0x5b06d6[_0x2ca962(0x228)]||_0x2ca962(0x23a),'priority':_0x2ca962(0x1ee)}}}),_0x5b06d6['message_id'])await P(_0x2ca962(0x270),{'alias':Z,'message_id':_0x5b06d6[_0x2ca962(0x1fa)]});return;}if(_0x5b06d6[_0x2ca962(0x264)]===_0x2ca962(0x243)||_0x5b06d6[_0x2ca962(0x264)]===_0x2ca962(0x238)){Y('←\x20'+_0x5b06d6[_0x2ca962(0x264)]+_0x2ca962(0x232)+_0x5b06d6['inbox_count']+_0x2ca962(0x21a)+(_0x5b06d6[_0x2ca962(0x220)]||_0x2ca962(0x1ee)));let _0x3a3053=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x3a3053?.['ok']&&_0x3a3053[_0x2ca962(0x1f3)]?.['length']>0x0)for(let _0x104f44 of _0x3a3053[_0x2ca962(0x1f3)]){let _0x3ecefc={'sender':_0x104f44['from_session']||'hub','sender_id':_0x2ca962(0x21c),'user':_0x104f44[_0x2ca962(0x207)]||'hub','task_id':_0x104f44['id'],'priority':_0x104f44[_0x2ca962(0x220)]||_0x2ca962(0x1ee)};k[_0x2ca962(0x20a)](_0x104f44['id'],_0x104f44[_0x2ca962(0x207)]||_0x2ca962(0x23a)),await K['notification']({'method':_0x2ca962(0x210),'params':{'content':_0x104f44[_0x2ca962(0x1ec)],'meta':_0x3ecefc}}),Y(_0x2ca962(0x250)+_0x104f44['id'][_0x2ca962(0x26f)](0x0,0x8)+_0x2ca962(0x22c)+_0x104f44[_0x2ca962(0x207)]+':\x20'+_0x104f44[_0x2ca962(0x1ec)]['slice'](0x0,0x3c)),await P(_0x2ca962(0x270),{'alias':Z,'message_id':_0x104f44['id']});}}}async function S(){const _0x12509c=a0_0x499f72;let _0x290684=new a0_0x1e1653();await K['connect'](_0x290684),Y(_0x12509c(0x249)),Y(_0x12509c(0x226)),v()[_0x12509c(0x231)](_0x2a6615=>Y('SSE\x20fatal:\x20'+_0x2a6615)),P(_0x12509c(0x1f0),{'resume_id':w,'alias':Z,'status':_0x12509c(0x242),'server':a0_0x1bf7b1(),'hostname':a0_0x1bf7b1(),'agent':_0x12509c(0x237),'project_dir':process[_0x12509c(0x24f)](),'tmux_name':f||void 0x0})[_0x12509c(0x269)](()=>Y('registered\x20as\x20\x22'+Z+_0x12509c(0x21d)+w['slice'](0x0,0x8)+')'))['catch'](_0xa75799=>Y('warning:\x20could\x20not\x20register:\x20'+_0xa75799)),setInterval(()=>{const _0x1c2c75=_0x12509c;P('report_status',{'resume_id':w,'alias':Z,'status':_0x1c2c75(0x242),'server':a0_0x1bf7b1(),'hostname':a0_0x1bf7b1(),'agent':_0x1c2c75(0x237),'project_dir':process[_0x1c2c75(0x24f)](),'tmux_name':f||void 0x0})[_0x1c2c75(0x231)](_0x291297=>Y('heartbeat\x20failed:\x20'+_0x291297));},0x2bf20),Y(_0x12509c(0x261));}S()[a0_0x499f72(0x231)](_0x203cfa=>{const _0x25e217=a0_0x499f72;Y(_0x25e217(0x1ea)+_0x203cfa),process['exit'](0x1);});async function N(){const _0x5f0061=a0_0x499f72;Y(_0x5f0061(0x21f)),await P(_0x5f0061(0x1f0),{'resume_id':w,'alias':Z,'status':'error','task':_0x5f0061(0x23b)})[_0x5f0061(0x231)](()=>{}),process['exit'](0x0);}process[a0_0x499f72(0x26a)]['on'](a0_0x499f72(0x205),()=>N()),process['on'](a0_0x499f72(0x21b),()=>N()),process['on']('SIGINT',()=>N());
|
|
2
|
+
const a0_0x1a4c6d=a0_0x2a29;(function(_0x316284,_0x3bb6ee){const _0x3928fb=a0_0x2a29,_0x4e90e7=_0x316284();while(!![]){try{const _0x57a5f7=parseInt(_0x3928fb(0x101))/0x1+parseInt(_0x3928fb(0x135))/0x2*(-parseInt(_0x3928fb(0x168))/0x3)+-parseInt(_0x3928fb(0x169))/0x4+parseInt(_0x3928fb(0x105))/0x5*(-parseInt(_0x3928fb(0xe9))/0x6)+-parseInt(_0x3928fb(0x14d))/0x7+-parseInt(_0x3928fb(0x154))/0x8*(-parseInt(_0x3928fb(0xee))/0x9)+-parseInt(_0x3928fb(0x15d))/0xa*(-parseInt(_0x3928fb(0x165))/0xb);if(_0x57a5f7===_0x3bb6ee)break;else _0x4e90e7['push'](_0x4e90e7['shift']());}catch(_0x4da55f){_0x4e90e7['push'](_0x4e90e7['shift']());}}}(a0_0x4e20,0xd9066));import{readFileSync as a0_0x518d51,existsSync as a0_0x49849a}from'fs';import{join as a0_0x5f4b60}from'path';function a0_0x2a29(_0x50a798,_0x479b7f){_0x50a798=_0x50a798-0xde;const _0x4e20a5=a0_0x4e20();let _0x2a29ed=_0x4e20a5[_0x50a798];return _0x2a29ed;}import{hostname as a0_0x7affab}from'os';import{execSync as a0_0x7b5016}from'child_process';import{Server as a0_0x57d3b4}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x24cd68}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0xbfa1d,CallToolRequestSchema as a0_0x55c7e5}from'@modelcontextprotocol/sdk/types.js';function p(_0xb5b6ac){const _0x13fbf9=a0_0x2a29;if(!a0_0x49849a(_0xb5b6ac))return;for(let _0x362458 of a0_0x518d51(_0xb5b6ac,_0x13fbf9(0x132))[_0x13fbf9(0x120)]('\x0a')){let _0x3fe619=_0x362458[_0x13fbf9(0x131)]();if(!_0x3fe619||_0x3fe619['startsWith']('#'))continue;let _0x23b0af=_0x3fe619[_0x13fbf9(0x158)]('=');if(_0x23b0af<0x0)continue;let _0xbcc12d=_0x3fe619[_0x13fbf9(0x116)](0x0,_0x23b0af)[_0x13fbf9(0x131)](),_0x39e7e1=_0x3fe619['slice'](_0x23b0af+0x1)[_0x13fbf9(0x131)]()[_0x13fbf9(0x143)](/^["']|["']$/g,'');if(!process.env[_0xbcc12d])process.env[_0xbcc12d]=_0x39e7e1;}}var C=process.env.HOME||'~',T=a0_0x5f4b60(C,a0_0x1a4c6d(0xf9));function a0_0x4e20(){const _0x398c4d=['1146PPQfbP','unknown\x20tool','randomUUID','←\x20message\x20from\x20','type','18TSQtfI','stringify','parse\x20error:\x20','data:\x20','\x20RESUME_ID=','new_message','priority','pop','commhub_reply','SSE\x20stream\x20ended,\x20reconnecting...','claude-code','.claude/channels/commhub','get_all_status','heartbeat\x20failed:\x20','high','SIGINT','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','commhub_get_all_status','failed','1472527yjgTaH','Reply\x20text\x20/\x20result\x20summary','catch','setRequestHandler','44925qtJIxu',']\x20[commhub]\x20','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','getReader','stderr','send_task','0.3.0','notification','warning:\x20could\x20not\x20register:\x20','alias','task','.env','stdin','delete','idle','in_progress','low','slice','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','init\x20failed:\x20','commhub_report_status','from','report_status','SSE\x20connection\x20error:\x20','error','SIGTERM','find','split','broadcast','ENV:\x20URL=','Bearer\x20','commhub_send_message','number','from_session','commhub-channel','CommHub\x20init\x20failed:\x20','2025-03-26','normal','Target\x20session\x20alias','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','none','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','completed','session\x20disconnected','trim','utf-8','startsWith','exit','8cDKnZX','status','tools/call','commhub_send_task','shutting\x20down,\x20reporting\x20offline...','message','POST','object','connect','params','/events/','starting\x20SSE\x20listener...','connecting\x20to\x20','get','replace','/mcp','Authorization','connected','result','then','cwd','toTimeString','application/json,\x20text/event-stream','...\x20TMUX=','3803597OHJlvJ','messages','working','→\x20injected\x20task\x20','no\x20response','registered\x20as\x20\x22','commhub','5499784rUUokP','send_message','content',':\x20inbox_count=','indexOf','write','MCP\x20stdio\x20connected','send_reply','hub','18547030DPLUlI','\x20priority=','http://127.0.0.1:9200','Message\x20content','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','\x20ALIAS=','ready\x20—\x20waiting\x20for\x20events','application/json','11IMKSrl','parse','.anet','225006EnWYhU','5014912WiMMpE','replied','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','SSE\x20connected\x20as\x20\x22','config.json','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','tmux\x20display-message\x20-p\x20\x27#S\x27','string','Task\x20content','Progress\x200-100','length','cancelled','message_id','text','blocked','Current\x20task\x20description'];a0_0x4e20=function(){return _0x398c4d;};return a0_0x4e20();}p(a0_0x5f4b60(T,a0_0x1a4c6d(0x110)));var L=process[a0_0x1a4c6d(0x149)]()['replace'](/\//g,'-');p(a0_0x5f4b60(T,L,a0_0x1a4c6d(0x110)));function U(){const _0x1c85f4=a0_0x1a4c6d;try{return a0_0x7b5016(_0x1c85f4(0xdf),{'encoding':_0x1c85f4(0x132),'timeout':0x7d0})[_0x1c85f4(0x131)]();}catch{return'';}}function c(){const _0xa6cdbc=a0_0x1a4c6d;try{let _0x14e44e=a0_0x5f4b60(C,_0xa6cdbc(0x167),_0xa6cdbc(0x16d));if(a0_0x49849a(_0x14e44e))return JSON[_0xa6cdbc(0x166)](a0_0x518d51(_0x14e44e,_0xa6cdbc(0x132)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x1a4c6d(0x15c)]||a0_0x1a4c6d(0x15f),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x7affab(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x1a4c6d(0xeb)](),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0xfe7727){const _0xd16983=a0_0x1a4c6d;let _0x1a968b=new Date()[_0xd16983(0x14a)]()[_0xd16983(0x116)](0x0,0x8);process[_0xd16983(0x109)][_0xd16983(0x159)]('['+_0x1a968b+_0xd16983(0x106)+_0xfe7727+'\x0a');}function h(_0x167e3a){return new Promise(_0x31b634=>setTimeout(_0x31b634,_0x167e3a));}Y(a0_0x1a4c6d(0x122)+D+a0_0x1a4c6d(0x162)+Z+a0_0x1a4c6d(0xf2)+w[a0_0x1a4c6d(0x116)](0x0,0x8)+a0_0x1a4c6d(0x14c)+(f||a0_0x1a4c6d(0x12d))+'\x20CWD='+process[a0_0x1a4c6d(0x149)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x57d3b4({'name':a0_0x1a4c6d(0x127),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x1a4c6d(0x16b),a0_0x1a4c6d(0x161),a0_0x1a4c6d(0x12e),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Session\x20alias:\x20'+Z]['join']('\x0a')});K[a0_0x1a4c6d(0x104)](a0_0xbfa1d,async()=>({'tools':[{'name':a0_0x1a4c6d(0xf6),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x1a4c6d(0x13c),'properties':{'task_id':{'type':a0_0x1a4c6d(0xe0),'description':a0_0x1a4c6d(0xde)},'text':{'type':a0_0x1a4c6d(0xe0),'description':a0_0x1a4c6d(0x102)},'status':{'type':a0_0x1a4c6d(0xe0),'enum':[a0_0x1a4c6d(0x12f),a0_0x1a4c6d(0x100),'cancelled',a0_0x1a4c6d(0xe7),a0_0x1a4c6d(0x11d),a0_0x1a4c6d(0x114)],'description':a0_0x1a4c6d(0x107)}},'required':[a0_0x1a4c6d(0xe6)]}},{'name':a0_0x1a4c6d(0x119),'description':a0_0x1a4c6d(0x12c),'inputSchema':{'type':a0_0x1a4c6d(0x13c),'properties':{'status':{'type':a0_0x1a4c6d(0xe0),'enum':['working',a0_0x1a4c6d(0x113),a0_0x1a4c6d(0xe7),'error']},'task':{'type':a0_0x1a4c6d(0xe0),'description':a0_0x1a4c6d(0xe8)},'progress':{'type':a0_0x1a4c6d(0x125),'description':a0_0x1a4c6d(0xe2)}},'required':[a0_0x1a4c6d(0x136)]}},{'name':a0_0x1a4c6d(0x138),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x1a4c6d(0x13c),'properties':{'alias':{'type':a0_0x1a4c6d(0xe0),'description':a0_0x1a4c6d(0x12b)},'task':{'type':a0_0x1a4c6d(0xe0),'description':a0_0x1a4c6d(0xe1)},'priority':{'type':a0_0x1a4c6d(0xe0),'enum':[a0_0x1a4c6d(0xfc),'normal',a0_0x1a4c6d(0x115)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x1a4c6d(0x10e),a0_0x1a4c6d(0x10f)]}},{'name':a0_0x1a4c6d(0x124),'description':a0_0x1a4c6d(0x117),'inputSchema':{'type':a0_0x1a4c6d(0x13c),'properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'message':{'type':a0_0x1a4c6d(0xe0),'description':a0_0x1a4c6d(0x160)}},'required':[a0_0x1a4c6d(0x10e),a0_0x1a4c6d(0x13a)]}},{'name':a0_0x1a4c6d(0xff),'description':a0_0x1a4c6d(0xfe),'inputSchema':{'type':a0_0x1a4c6d(0x13c),'properties':{}}}]}));async function P(_0x4304a8,_0x84975d){const _0x397ac8=a0_0x1a4c6d;let _0x4b716d=await fetch(D+_0x397ac8(0x144),{'method':_0x397ac8(0x13b),'headers':{'Content-Type':_0x397ac8(0x164),'Accept':_0x397ac8(0x14b),...X?{'Authorization':_0x397ac8(0x123)+X}:{}},'body':JSON[_0x397ac8(0xef)]({'jsonrpc':'2.0','id':0x1,'method':'initialize','params':{'protocolVersion':_0x397ac8(0x129),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x397ac8(0x10b)}}})});if(!_0x4b716d['ok']){let _0x323460=await _0x4b716d['text']();return Y(_0x397ac8(0x128)+_0x4b716d['status']+'\x20'+_0x323460['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x397ac8(0x118)+_0x4b716d[_0x397ac8(0x136)]};}await _0x4b716d[_0x397ac8(0xe6)]();let _0xca4ea0=(await(await fetch(D+'/mcp',{'method':_0x397ac8(0x13b),'headers':{'Content-Type':_0x397ac8(0x164),'Accept':_0x397ac8(0x14b),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x397ac8(0xef)]({'jsonrpc':'2.0','id':0x2,'method':_0x397ac8(0x137),'params':{'name':_0x4304a8,'arguments':_0x84975d}})}))[_0x397ac8(0xe6)]())[_0x397ac8(0x120)]('\x0a')[_0x397ac8(0x11f)](_0x3d8c63=>_0x3d8c63['startsWith']('data:\x20'));if(_0xca4ea0){let _0x444373=JSON[_0x397ac8(0x166)](_0xca4ea0[_0x397ac8(0x116)](0x6));return _0x444373?.[_0x397ac8(0x147)]?.[_0x397ac8(0x156)]?.[0x0]?.[_0x397ac8(0xe6)]?JSON['parse'](_0x444373['result'][_0x397ac8(0x156)][0x0][_0x397ac8(0xe6)]):_0x444373;}return{'ok':!0x1,'error':_0x397ac8(0x151)};}K[a0_0x1a4c6d(0x104)](a0_0x55c7e5,async _0x11944f=>{const _0x17d7f6=a0_0x1a4c6d;let {name:_0x5e1866,arguments:_0x5766d1}=_0x11944f[_0x17d7f6(0x13e)];if(_0x5e1866===_0x17d7f6(0xf6)){let {task_id:_0x293235,text:_0x84e7b6,status:_0x5e8da8}=_0x5766d1;if(_0x5e8da8===_0x17d7f6(0x12f)||_0x5e8da8===_0x17d7f6(0x100)||_0x5e8da8===_0x17d7f6(0xe4)){let _0x11edf0=_0x5e8da8===_0x17d7f6(0x12f)?_0x17d7f6(0x16a):_0x5e8da8,_0x2b069a=_0x293235?k[_0x17d7f6(0x142)](_0x293235)||'hub':'hub',_0x499fe4=await P(_0x17d7f6(0x15b),{'alias':_0x2b069a,'text':_0x84e7b6,'in_reply_to':_0x293235||void 0x0,'status':_0x11edf0,'from_session':Z});if(_0x293235)k[_0x17d7f6(0x112)](_0x293235);return{'content':[{'type':_0x17d7f6(0xe6),'text':JSON[_0x17d7f6(0xef)](_0x499fe4)}]};}let _0x1c1c9f=await P(_0x17d7f6(0x11b),{'resume_id':w,'alias':Z,'status':_0x5e8da8==='blocked'?_0x17d7f6(0xe7):_0x5e8da8===_0x17d7f6(0x11d)?_0x17d7f6(0x11d):_0x17d7f6(0x14f),'task':_0x84e7b6['slice'](0x0,0xc8),'output':_0x84e7b6});return{'content':[{'type':_0x17d7f6(0xe6),'text':JSON[_0x17d7f6(0xef)](_0x1c1c9f)}]};}if(_0x5e1866==='commhub_report_status'){let {status:_0x439ff2,task:_0x45309a,progress:_0x166943}=_0x5766d1,_0x23ea6f=await P(_0x17d7f6(0x11b),{'resume_id':w,'alias':Z,'status':_0x439ff2,'task':_0x45309a,'progress':_0x166943});return{'content':[{'type':_0x17d7f6(0xe6),'text':JSON[_0x17d7f6(0xef)](_0x23ea6f)}]};}if(_0x5e1866==='commhub_send_task'){let {alias:_0x5866f3,task:_0x99da4d,priority:_0xcda01b}=_0x5766d1,_0x2f1a7a=await P(_0x17d7f6(0x10a),{'alias':_0x5866f3,'task':_0x99da4d,'priority':_0xcda01b||_0x17d7f6(0x12a),'from_session':Z});return{'content':[{'type':_0x17d7f6(0xe6),'text':JSON['stringify'](_0x2f1a7a)}]};}if(_0x5e1866===_0x17d7f6(0x124)){let {alias:_0x4baf66,message:_0x2752ba}=_0x5766d1,_0x2b163e=await P(_0x17d7f6(0x155),{'alias':_0x4baf66,'message':_0x2752ba,'from_session':Z});return{'content':[{'type':_0x17d7f6(0xe6),'text':JSON[_0x17d7f6(0xef)](_0x2b163e)}]};}if(_0x5e1866==='commhub_get_all_status'){let _0x2b00b2=await P(_0x17d7f6(0xfa),{});return{'content':[{'type':_0x17d7f6(0xe6),'text':JSON['stringify'](_0x2b00b2)}]};}return{'content':[{'type':_0x17d7f6(0xe6),'text':JSON[_0x17d7f6(0xef)]({'error':_0x17d7f6(0xea)})}]};});async function v(){const _0x4d8dd6=a0_0x1a4c6d;let _0x27a8dd=D+_0x4d8dd6(0x13f)+encodeURIComponent(Z),_0x12815e={};if(X)_0x12815e[_0x4d8dd6(0x145)]=_0x4d8dd6(0x123)+X;Y(_0x4d8dd6(0x141)+_0x27a8dd);while(!0x0){try{let _0x1e2182=await fetch(_0x27a8dd,{'headers':_0x12815e});if(!_0x1e2182['ok']){Y('SSE\x20error:\x20'+_0x1e2182['status']+'\x20'+_0x1e2182['statusText']),await h(0x1388);continue;}let _0x48b506=_0x1e2182['body'][_0x4d8dd6(0x108)](),_0x41f511=new TextDecoder(),_0x358cdf='';while(!0x0){let {done:_0x11edb3,value:_0x2d0985}=await _0x48b506['read']();if(_0x11edb3)break;_0x358cdf+=_0x41f511['decode'](_0x2d0985,{'stream':!0x0});let _0x4a03a1=_0x358cdf[_0x4d8dd6(0x120)]('\x0a\x0a');_0x358cdf=_0x4a03a1[_0x4d8dd6(0xf5)]()||'';for(let _0x5776b1 of _0x4a03a1){let _0x1b37f2=_0x5776b1[_0x4d8dd6(0x120)]('\x0a')[_0x4d8dd6(0x11f)](_0x343b1c=>_0x343b1c[_0x4d8dd6(0x133)](_0x4d8dd6(0xf1)));if(!_0x1b37f2)continue;try{let _0x47c030=JSON[_0x4d8dd6(0x166)](_0x1b37f2['slice'](0x6));await u(_0x47c030);}catch(_0x3366e8){Y(_0x4d8dd6(0xf0)+_0x3366e8);}}}Y(_0x4d8dd6(0xf7));}catch(_0x141051){Y(_0x4d8dd6(0x11c)+_0x141051);}await h(0xbb8);}}async function u(_0x5d95fe){const _0x31743c=a0_0x1a4c6d;if(_0x5d95fe['type']===_0x31743c(0x146)){Y(_0x31743c(0x16c)+Z+'\x22');return;}if(_0x5d95fe[_0x31743c(0xed)]===_0x31743c(0xf3)){if(Y(_0x31743c(0xec)+_0x5d95fe[_0x31743c(0x11a)]+':\x20'+_0x5d95fe[_0x31743c(0x13a)][_0x31743c(0x116)](0x0,0x3c)),await K[_0x31743c(0x10c)]({'method':'notifications/claude/channel','params':{'content':_0x5d95fe[_0x31743c(0x13a)],'meta':{'sender':_0x5d95fe['from']||_0x31743c(0x15c),'sender_id':_0x31743c(0x153),'user':_0x5d95fe['from']||_0x31743c(0x15c),'priority':_0x31743c(0x12a)}}}),_0x5d95fe[_0x31743c(0xe5)])await P('ack_inbox',{'alias':Z,'message_id':_0x5d95fe[_0x31743c(0xe5)]});return;}if(_0x5d95fe[_0x31743c(0xed)]==='new_task'||_0x5d95fe[_0x31743c(0xed)]===_0x31743c(0x121)){Y('←\x20'+_0x5d95fe[_0x31743c(0xed)]+_0x31743c(0x157)+_0x5d95fe['inbox_count']+_0x31743c(0x15e)+(_0x5d95fe[_0x31743c(0xf4)]||_0x31743c(0x12a)));let _0x1d2d2e=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x1d2d2e?.['ok']&&_0x1d2d2e[_0x31743c(0x14e)]?.[_0x31743c(0xe3)]>0x0)for(let _0x551736 of _0x1d2d2e[_0x31743c(0x14e)]){let _0x43ba71={'sender':_0x551736[_0x31743c(0x126)]||'hub','sender_id':_0x31743c(0x153),'user':_0x551736['from_session']||_0x31743c(0x15c),'task_id':_0x551736['id'],'priority':_0x551736['priority']||'normal'};k['set'](_0x551736['id'],_0x551736['from_session']||_0x31743c(0x15c)),await K[_0x31743c(0x10c)]({'method':'notifications/claude/channel','params':{'content':_0x551736[_0x31743c(0x156)],'meta':_0x43ba71}}),Y(_0x31743c(0x150)+_0x551736['id']['slice'](0x0,0x8)+'\x20from\x20'+_0x551736[_0x31743c(0x126)]+':\x20'+_0x551736['content']['slice'](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x551736['id']});}}}async function S(){const _0x527c50=a0_0x1a4c6d;let _0x4bb65b=new a0_0x24cd68();await K[_0x527c50(0x13d)](_0x4bb65b),Y(_0x527c50(0x15a)),Y(_0x527c50(0x140)),v()['catch'](_0x60b717=>Y('SSE\x20fatal:\x20'+_0x60b717)),P(_0x527c50(0x11b),{'resume_id':w,'alias':Z,'status':_0x527c50(0x113),'server':a0_0x7affab(),'hostname':a0_0x7affab(),'agent':_0x527c50(0xf8),'project_dir':process[_0x527c50(0x149)](),'tmux_name':f||void 0x0})[_0x527c50(0x148)](()=>Y(_0x527c50(0x152)+Z+'\x22\x20('+w[_0x527c50(0x116)](0x0,0x8)+')'))[_0x527c50(0x103)](_0x402770=>Y(_0x527c50(0x10d)+_0x402770)),setInterval(()=>{const _0x5728de=_0x527c50;P(_0x5728de(0x11b),{'resume_id':w,'alias':Z,'status':_0x5728de(0x113),'server':a0_0x7affab(),'hostname':a0_0x7affab(),'agent':_0x5728de(0xf8),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x5728de(0x103)](_0x2dab30=>Y(_0x5728de(0xfb)+_0x2dab30));},0x2bf20),Y(_0x527c50(0x163));}S()['catch'](_0x2505d7=>{const _0x15ed8d=a0_0x1a4c6d;Y('fatal:\x20'+_0x2505d7),process[_0x15ed8d(0x134)](0x1);});async function N(){const _0x461c69=a0_0x1a4c6d;Y(_0x461c69(0x139)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x461c69(0x11d),'task':_0x461c69(0x130)})[_0x461c69(0x103)](()=>{}),process[_0x461c69(0x134)](0x0);}process[a0_0x1a4c6d(0x111)]['on']('end',()=>N()),process['on'](a0_0x1a4c6d(0x11e),()=>N()),process['on'](a0_0x1a4c6d(0xfd),()=>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.27",
|
|
4
4
|
"description": "AI Agent Network CLI \u2014 Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 34 commands.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|