@sleep2agi/agent-network 2.0.0-preview.50 → 2.0.0-preview.51
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_0x1ad9b8=a0_0x472b;function a0_0x472b(_0x5cbf88,_0x294d62){_0x5cbf88=_0x5cbf88-0x102;const _0x39695a=a0_0x3969();let _0x472bf7=_0x39695a[_0x5cbf88];return _0x472bf7;}(function(_0x1a10b7,_0x19bf66){const _0x89904e=a0_0x472b,_0x3aa514=_0x1a10b7();while(!![]){try{const _0x110f9c=parseInt(_0x89904e(0x11c))/0x1+-parseInt(_0x89904e(0x141))/0x2*(parseInt(_0x89904e(0x125))/0x3)+-parseInt(_0x89904e(0x113))/0x4+parseInt(_0x89904e(0x140))/0x5+parseInt(_0x89904e(0x13a))/0x6*(parseInt(_0x89904e(0x151))/0x7)+-parseInt(_0x89904e(0x154))/0x8+-parseInt(_0x89904e(0x12f))/0x9*(-parseInt(_0x89904e(0x10b))/0xa);if(_0x110f9c===_0x19bf66)break;else _0x3aa514['push'](_0x3aa514['shift']());}catch(_0x1cf4aa){_0x3aa514['push'](_0x3aa514['shift']());}}}(a0_0x3969,0x5c7a0));function a0_0x3969(){const _0x5bb32d=['content','resumeId','SSE\x20reconnecting\x20in\x20','application/json','890XJXhGH','task','match','Bearer\x20','name','offline','broadcast','server','2424500baPLrU','completed','SSE\x20connected','error','agent','parse','report_status','disconnect','application/json,\x20text/event-stream','269490GLPBok','stringify','connected','new_task','Authorization','disconnected','type','status','send_message','10143mRCfug','ack_inbox','idle','connectSSE','AbortError','toString','cwd','body','catch','result','76716MivBIB','data:\x20',']\x20[commhub:','tools/call','heartbeatTimer','replace','log','sseAbort','abort','heartbeat\x20failed:\x20','emit','4302120qPlILb','alias','messages','autoConnect','running','2.0','300765XoIyHp','162CHUxGD','heartbeatInterval','/mcp','POST','slice','SSE\x20failed:\x20','toTimeString','connect','from_session','get_inbox','sleep','split','get_all_status','reply','call','text','7YsTsRc','registered','min','4372232qJuPYT','getAllStatus','url','pop','normal','reconnectDelay','message','SSE\x20error:\x20','sdk-','token','processInbox','startsWith'];a0_0x3969=function(){return _0x5bb32d;};return a0_0x3969();}import{EventEmitter as a0_0x3efaaf}from'events';import{hostname as a0_0x4f12f9}from'os';class T extends a0_0x3efaaf{[a0_0x1ad9b8(0x156)];[a0_0x1ad9b8(0x13b)];[a0_0x1ad9b8(0x104)];[a0_0x1ad9b8(0x117)];['resumeId'];[a0_0x1ad9b8(0x142)];['reconnectDelay'];[a0_0x1ad9b8(0x133)];[a0_0x1ad9b8(0x136)];['running']=!0x1;constructor(_0x599963){const _0x1028bb=a0_0x1ad9b8;super();if(this['url']=_0x599963[_0x1028bb(0x156)][_0x1028bb(0x134)](/\/$/,''),this[_0x1028bb(0x13b)]=_0x599963[_0x1028bb(0x13b)],this[_0x1028bb(0x104)]=_0x599963[_0x1028bb(0x104)],this['agent']=_0x599963[_0x1028bb(0x117)]||'sdk',this[_0x1028bb(0x108)]=_0x1028bb(0x103)+_0x599963[_0x1028bb(0x13b)]+'-'+Date['now']()[_0x1028bb(0x12a)](0x24),this['heartbeatInterval']=_0x599963[_0x1028bb(0x142)]??0x2bf20,this[_0x1028bb(0x159)]=_0x599963[_0x1028bb(0x159)]??0xbb8,_0x599963[_0x1028bb(0x13d)]!==!0x1)this[_0x1028bb(0x148)]();}[a0_0x1ad9b8(0x135)](_0x1e2809){const _0x1a17ac=a0_0x1ad9b8;console[_0x1a17ac(0x135)]('['+new Date()[_0x1a17ac(0x147)]()[_0x1a17ac(0x145)](0x0,0x8)+_0x1a17ac(0x131)+this[_0x1a17ac(0x13b)]+']\x20'+_0x1e2809);}async[a0_0x1ad9b8(0x14f)](_0x4e0916,_0x1bf53c){const _0x1865a8=a0_0x1ad9b8;let _0x5bf70a={'Content-Type':_0x1865a8(0x10a),'Accept':_0x1865a8(0x11b)};if(this[_0x1865a8(0x104)])_0x5bf70a['Authorization']=_0x1865a8(0x10e)+this[_0x1865a8(0x104)];let _0x9cb80f=await(await fetch(this[_0x1865a8(0x156)]+_0x1865a8(0x143),{'method':_0x1865a8(0x144),'headers':_0x5bf70a,'body':JSON[_0x1865a8(0x11d)]({'jsonrpc':_0x1865a8(0x13f),'id':Date['now'](),'method':_0x1865a8(0x132),'params':{'name':_0x4e0916,'arguments':_0x1bf53c}})}))[_0x1865a8(0x150)](),_0x4a9685=_0x9cb80f[_0x1865a8(0x10d)](/data: (.+)/),_0x24521a=_0x4a9685?JSON[_0x1865a8(0x118)](_0x4a9685[0x1]):JSON['parse'](_0x9cb80f),_0x59c436=_0x24521a?.[_0x1865a8(0x12e)]?.[_0x1865a8(0x107)]?.[0x0]?.[_0x1865a8(0x150)];return _0x59c436?JSON['parse'](_0x59c436):_0x24521a;}async[a0_0x1ad9b8(0x148)](){const _0x577d24=a0_0x1ad9b8;if(this['running'])return;this[_0x577d24(0x13e)]=!0x0,await this[_0x577d24(0x123)](_0x577d24(0x127)),this[_0x577d24(0x135)](_0x577d24(0x152)),this[_0x577d24(0x133)]=setInterval(()=>{const _0x4aff06=_0x577d24;this['status']('idle')[_0x4aff06(0x12d)](_0xf22d61=>this[_0x4aff06(0x135)](_0x4aff06(0x138)+_0xf22d61['message']));},this[_0x577d24(0x142)]),this[_0x577d24(0x128)]();}async[a0_0x1ad9b8(0x11a)](){const _0xf61695=a0_0x1ad9b8;if(this[_0xf61695(0x13e)]=!0x1,this[_0xf61695(0x136)]?.[_0xf61695(0x137)](),this[_0xf61695(0x133)])clearInterval(this[_0xf61695(0x133)]);await this['status'](_0xf61695(0x110))[_0xf61695(0x12d)](()=>{}),this['log'](_0xf61695(0x121));}async['send'](_0x4738d1,_0xe26c1c,_0x5456af=a0_0x1ad9b8(0x158)){const _0x1f7691=a0_0x1ad9b8;return this[_0x1f7691(0x14f)]('send_task',{'alias':_0x4738d1,'task':_0xe26c1c,'priority':_0x5456af,'from_session':this['alias']});}async[a0_0x1ad9b8(0x15a)](_0x338b7c,_0x115287){const _0x5de2f2=a0_0x1ad9b8;return this['call'](_0x5de2f2(0x124),{'alias':_0x338b7c,'message':_0x115287,'from_session':this[_0x5de2f2(0x13b)]});}async[a0_0x1ad9b8(0x14e)](_0x1d17b2,_0x57edcd,_0x374f3d=a0_0x1ad9b8(0x114)){const _0x1a66fa=a0_0x1ad9b8;return this[_0x1a66fa(0x14f)](_0x1a66fa(0x14e),{'task_id':_0x1d17b2,'text':_0x57edcd,'status':_0x374f3d});}async[a0_0x1ad9b8(0x123)](_0x2a780e,_0x511c3b){const _0x8113a8=a0_0x1ad9b8;return this[_0x8113a8(0x14f)](_0x8113a8(0x119),{'resume_id':this[_0x8113a8(0x108)],'alias':this[_0x8113a8(0x13b)],'status':_0x2a780e,'server':a0_0x4f12f9(),'hostname':a0_0x4f12f9(),'agent':this[_0x8113a8(0x117)],'project_dir':process[_0x8113a8(0x12b)](),..._0x511c3b});}async[a0_0x1ad9b8(0x155)](){const _0x5f28b7=a0_0x1ad9b8;return this['call'](_0x5f28b7(0x14d),{});}async[a0_0x1ad9b8(0x111)](_0x5b22ac,_0x2e6b6d){const _0x378054=a0_0x1ad9b8;return this[_0x378054(0x14f)]('broadcast',{'message':_0x5b22ac,'filter_server':_0x2e6b6d?.[_0x378054(0x112)],'filter_status':_0x2e6b6d?.['status']});}async[a0_0x1ad9b8(0x128)](){const _0x4c67c2=a0_0x1ad9b8;let _0x211c9c=encodeURIComponent(this[_0x4c67c2(0x13b)]),_0x52c5b7=this['url']+'/events/'+_0x211c9c,_0x135633=this[_0x4c67c2(0x159)];while(this[_0x4c67c2(0x13e)]){try{this[_0x4c67c2(0x136)]=new AbortController();let _0x515558={'Accept':'text/event-stream'};if(this[_0x4c67c2(0x104)])_0x515558[_0x4c67c2(0x120)]=_0x4c67c2(0x10e)+this[_0x4c67c2(0x104)];let _0x263ea9=await fetch(_0x52c5b7,{'headers':_0x515558,'signal':this[_0x4c67c2(0x136)]['signal']});if(!_0x263ea9['ok']||!_0x263ea9[_0x4c67c2(0x12c)]){this[_0x4c67c2(0x135)](_0x4c67c2(0x146)+_0x263ea9[_0x4c67c2(0x123)]),await this[_0x4c67c2(0x14b)](_0x135633),_0x135633=Math[_0x4c67c2(0x153)](_0x135633*1.5,0xea60);continue;}_0x135633=this[_0x4c67c2(0x159)];let _0x590434=_0x263ea9['body']['getReader'](),_0x1404be=new TextDecoder(),_0x49490c='';while(this['running']){let {done:_0x2e9372,value:_0x39366c}=await _0x590434['read']();if(_0x2e9372)break;_0x49490c+=_0x1404be['decode'](_0x39366c,{'stream':!0x0});let _0x349200=_0x49490c[_0x4c67c2(0x14c)]('\x0a');_0x49490c=_0x349200[_0x4c67c2(0x157)]()||'';for(let _0xca44ba of _0x349200){if(!_0xca44ba[_0x4c67c2(0x106)](_0x4c67c2(0x130)))continue;try{let _0x4d7489=JSON[_0x4c67c2(0x118)](_0xca44ba[_0x4c67c2(0x145)](0x6));if(_0x4d7489[_0x4c67c2(0x122)]===_0x4c67c2(0x11e)){this['log'](_0x4c67c2(0x115)),this[_0x4c67c2(0x139)](_0x4c67c2(0x11e));continue;}if(_0x4d7489[_0x4c67c2(0x122)]===_0x4c67c2(0x11f)||_0x4d7489['type']==='new_message'||_0x4d7489[_0x4c67c2(0x122)]==='broadcast')await this[_0x4c67c2(0x105)]();}catch{}}}}catch(_0x305086){if(_0x305086[_0x4c67c2(0x10f)]===_0x4c67c2(0x129))break;this[_0x4c67c2(0x139)](_0x4c67c2(0x116),_0x305086),this[_0x4c67c2(0x135)](_0x4c67c2(0x102)+_0x305086[_0x4c67c2(0x15a)]);}if(this['running'])this['emit'](_0x4c67c2(0x121)),this[_0x4c67c2(0x135)](_0x4c67c2(0x109)+_0x135633/0x3e8+'s...'),await this[_0x4c67c2(0x14b)](_0x135633),_0x135633=Math['min'](_0x135633*1.5,0xea60);}}async[a0_0x1ad9b8(0x105)](){const _0x510287=a0_0x1ad9b8;try{let _0x4cef79=(await this[_0x510287(0x14f)](_0x510287(0x14a),{'alias':this[_0x510287(0x13b)],'limit':0xa}))?.[_0x510287(0x13c)]||[];for(let _0x5d0461 of _0x4cef79)await this[_0x510287(0x14f)](_0x510287(0x126),{'alias':this[_0x510287(0x13b)],'message_id':_0x5d0461['id']}),this[_0x510287(0x135)]('←\x20'+_0x5d0461[_0x510287(0x149)]+':\x20'+_0x5d0461[_0x510287(0x107)][_0x510287(0x145)](0x0,0x3c)),this[_0x510287(0x139)](_0x510287(0x10c),_0x5d0461),this[_0x510287(0x139)](_0x510287(0x15a),_0x5d0461);}catch(_0x36a5e6){this[_0x510287(0x135)]('inbox\x20error:\x20'+_0x36a5e6['message']);}}[a0_0x1ad9b8(0x14b)](_0x3c6df3){return new Promise(_0x237be0=>setTimeout(_0x237be0,_0x3c6df3));}}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_0x4e1363=a0_0x4e77;function a0_0x456f(){const _0x2c11e1=['normal','28IbEOke','heartbeat\x20failed:\x20','statusText','setRequestHandler','connected','getReader','2025-03-26','connect','write','connecting\x20to\x20','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','\x22\x20(','claude-code','content','Priority\x20(default:\x20normal)','priority','ready\x20—\x20waiting\x20for\x20events','SSE\x20error:\x20','/events/','SIGINT','failed','ENV:\x20URL=','get','SIGTERM','...\x20TMUX=','Bearer\x20','stringify','commhub_report_status','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','fatal:\x20','params','commhub-channel','stdin','787659cUvdCI','low','starting\x20SSE\x20listener...','6039512LulTEe','send_task','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','task','\x20from\x20','replace','send_reply','SSE\x20connected\x20as\x20\x22','7vsLCBj','11LdSnGC','parse','application/json','catch','type','MCP\x20stdio\x20connected','join','commhub','Current\x20task\x20description','message_id','parse\x20error:\x20','6678570rkhRZX','tools/call','Reply\x20text\x20/\x20result\x20summary','application/json,\x20text/event-stream','commhub_send_message','idle','ack_inbox','.anet','string','SSE\x20stream\x20ended,\x20reconnecting...','text','startsWith','get_all_status','685318qSWynh','15991310wWiFpD','0.3.0','notifications/claude/channel','delete','error','9yTPvXq','message','\x20ALIAS=','warning:\x20could\x20not\x20register:\x20','SSE\x20fatal:\x20','body','unknown\x20tool','blocked','indexOf','session\x20disconnected','alias','cancelled','http://127.0.0.1:9200','commhub_send_task','\x20PROJECT_ENV=','report_status','.claude/channels/commhub','randomUUID','Target\x20session\x20alias','6404412noOdTH','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','new_message','object','registered\x20as\x20\x22','high','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','working','inbox_count','commhub_get_all_status','shutting\x20down,\x20reporting\x20offline...','trim','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','1PILBAY','hub','\x20RESUME_ID=','token','Message\x20content','pop','Authorization','/mcp','completed','then','set','status','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','messages','Task\x20content','utf-8','1219065ignqLL','exit','←\x20message\x20from\x20','SSE\x20connection\x20error:\x20','POST','cwd',']\x20[commhub]\x20','commhub_reply','from_session','init\x20failed:\x20','end','2.0','from','\x20CWD=','data:\x20','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','toTimeString','decode','.env','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Session\x20alias:\x20','no\x20response','slice','split','send_message'];a0_0x456f=function(){return _0x2c11e1;};return a0_0x456f();}(function(_0x272c0f,_0x5ba71e){const _0x200394=a0_0x4e77,_0x2438f0=_0x272c0f();while(!![]){try{const _0x1a9f02=parseInt(_0x200394(0x107))/0x1*(parseInt(_0x200394(0xe1))/0x2)+-parseInt(_0x200394(0xbd))/0x3+-parseInt(_0x200394(0x131))/0x4*(parseInt(_0x200394(0x117))/0x5)+-parseInt(_0x200394(0xd4))/0x6*(-parseInt(_0x200394(0xc8))/0x7)+parseInt(_0x200394(0xc0))/0x8*(-parseInt(_0x200394(0xe7))/0x9)+parseInt(_0x200394(0xe2))/0xa*(parseInt(_0x200394(0xc9))/0xb)+parseInt(_0x200394(0xfa))/0xc;if(_0x1a9f02===_0x5ba71e)break;else _0x2438f0['push'](_0x2438f0['shift']());}catch(_0x531991){_0x2438f0['push'](_0x2438f0['shift']());}}}(a0_0x456f,0xd3093));import{readFileSync as a0_0x291ebd,existsSync as a0_0x26e049}from'fs';import{join as a0_0x361a6f}from'path';import{hostname as a0_0x2263d7}from'os';import{execSync as a0_0x32a8cd}from'child_process';import{Server as a0_0x388b3f}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x3b6b49}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x4af942,CallToolRequestSchema as a0_0x4dd893}from'@modelcontextprotocol/sdk/types.js';function p(_0x561e91){const _0x180615=a0_0x4e77;if(!a0_0x26e049(_0x561e91))return;for(let _0x285fdf of a0_0x291ebd(_0x561e91,_0x180615(0x116))[_0x180615(0x12e)]('\x0a')){let _0x280d53=_0x285fdf[_0x180615(0x105)]();if(!_0x280d53||_0x280d53['startsWith']('#'))continue;let _0x46c035=_0x280d53[_0x180615(0xef)]('=');if(_0x46c035<0x0)continue;let _0x358a94=_0x280d53[_0x180615(0x12d)](0x0,_0x46c035)[_0x180615(0x105)](),_0x2cf110=_0x280d53[_0x180615(0x12d)](_0x46c035+0x1)['trim']()['replace'](/^["']|["']$/g,'');if(!process.env[_0x358a94])process.env[_0x358a94]=_0x2cf110;}}var C=process.env.HOME||'~',T=a0_0x361a6f(C,a0_0x4e1363(0xf7));p(a0_0x361a6f(T,a0_0x4e1363(0x129)));var L=process[a0_0x4e1363(0x11c)]()[a0_0x4e1363(0xc5)](/\//g,'-');p(a0_0x361a6f(T,L,a0_0x4e1363(0x129)));function U(){const _0x2a8eb2=a0_0x4e1363;try{return a0_0x32a8cd('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x2a8eb2(0x116),'timeout':0x7d0})[_0x2a8eb2(0x105)]();}catch{return'';}}function c(){const _0x5258a3=a0_0x4e1363;try{let _0x546010=a0_0x361a6f(C,_0x5258a3(0xdb),'config.json');if(a0_0x26e049(_0x546010))return JSON[_0x5258a3(0xca)](a0_0x291ebd(_0x546010,_0x5258a3(0x116)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x4e1363(0x108)]||a0_0x4e1363(0xf3),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x2263d7(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x4e1363(0xf8)](),X=process.env.COMMHUB_TOKEN||H[a0_0x4e1363(0x10a)]||'';function Y(_0x1f2c65){const _0x5dc750=a0_0x4e1363;let _0x36d00d=new Date()[_0x5dc750(0x127)]()[_0x5dc750(0x12d)](0x0,0x8);process['stderr'][_0x5dc750(0x139)]('['+_0x36d00d+_0x5dc750(0x11d)+_0x1f2c65+'\x0a');}function h(_0xadd6ff){return new Promise(_0x19840e=>setTimeout(_0x19840e,_0xadd6ff));}Y(a0_0x4e1363(0xb1)+D+a0_0x4e1363(0xe9)+Z+a0_0x4e1363(0x109)+w[a0_0x4e1363(0x12d)](0x0,0x8)+a0_0x4e1363(0xb4)+(f||'none')+a0_0x4e1363(0x124)+process[a0_0x4e1363(0x11c)]()+a0_0x4e1363(0xf5)+L);var k=new Map(),K=new a0_0x388b3f({'name':a0_0x4e1363(0xbb),'version':a0_0x4e1363(0xe3)},{'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>',a0_0x4e1363(0xfb),a0_0x4e1363(0x113),a0_0x4e1363(0x12a),a0_0x4e1363(0x12b)+Z][a0_0x4e1363(0xcf)]('\x0a')});K[a0_0x4e1363(0x134)](a0_0x4af942,async()=>({'tools':[{'name':a0_0x4e1363(0x11e),'description':a0_0x4e1363(0xc2),'inputSchema':{'type':a0_0x4e1363(0xfd),'properties':{'task_id':{'type':'string','description':a0_0x4e1363(0x126)},'text':{'type':'string','description':a0_0x4e1363(0xd6)},'status':{'type':a0_0x4e1363(0xdc),'enum':['completed',a0_0x4e1363(0x145),'cancelled',a0_0x4e1363(0xee),a0_0x4e1363(0xe6),'in_progress'],'description':a0_0x4e1363(0xb8)}},'required':[a0_0x4e1363(0xde)]}},{'name':a0_0x4e1363(0xb7),'description':a0_0x4e1363(0x13b),'inputSchema':{'type':a0_0x4e1363(0xfd),'properties':{'status':{'type':a0_0x4e1363(0xdc),'enum':[a0_0x4e1363(0x101),'idle','blocked',a0_0x4e1363(0xe6)]},'task':{'type':a0_0x4e1363(0xdc),'description':a0_0x4e1363(0xd1)},'progress':{'type':'number','description':'Progress\x200-100'}},'required':[a0_0x4e1363(0x112)]}},{'name':a0_0x4e1363(0xf4),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x4e1363(0xfd),'properties':{'alias':{'type':a0_0x4e1363(0xdc),'description':a0_0x4e1363(0xf9)},'task':{'type':'string','description':a0_0x4e1363(0x115)},'priority':{'type':a0_0x4e1363(0xdc),'enum':[a0_0x4e1363(0xff),a0_0x4e1363(0x130),a0_0x4e1363(0xbe)],'description':a0_0x4e1363(0x13f)}},'required':[a0_0x4e1363(0xf1),a0_0x4e1363(0xc3)]}},{'name':a0_0x4e1363(0xd8),'description':a0_0x4e1363(0x100),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x4e1363(0xdc),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x4e1363(0xdc),'description':a0_0x4e1363(0x10b)}},'required':[a0_0x4e1363(0xf1),a0_0x4e1363(0xe8)]}},{'name':a0_0x4e1363(0x103),'description':a0_0x4e1363(0x106),'inputSchema':{'type':'object','properties':{}}}]}));function a0_0x4e77(_0x3d531d,_0x4c3341){_0x3d531d=_0x3d531d-0xb1;const _0x456fff=a0_0x456f();let _0x4e77e0=_0x456fff[_0x3d531d];return _0x4e77e0;}async function P(_0x45dabe,_0xd834bf){const _0x1eafc0=a0_0x4e1363;let _0x226e44=await fetch(D+_0x1eafc0(0x10e),{'method':'POST','headers':{'Content-Type':_0x1eafc0(0xcb),'Accept':_0x1eafc0(0xd7),...X?{'Authorization':_0x1eafc0(0xb5)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x1eafc0(0x122),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x1eafc0(0x137),'capabilities':{},'clientInfo':{'name':_0x1eafc0(0xbb),'version':_0x1eafc0(0xe3)}}})});if(!_0x226e44['ok']){let _0x41f5c1=await _0x226e44['text']();return Y('CommHub\x20init\x20failed:\x20'+_0x226e44[_0x1eafc0(0x112)]+'\x20'+_0x41f5c1['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x1eafc0(0x120)+_0x226e44['status']};}await _0x226e44[_0x1eafc0(0xde)]();let _0x17862f=(await(await fetch(D+'/mcp',{'method':_0x1eafc0(0x11b),'headers':{'Content-Type':_0x1eafc0(0xcb),'Accept':_0x1eafc0(0xd7),...X?{'Authorization':_0x1eafc0(0xb5)+X}:{}},'body':JSON[_0x1eafc0(0xb6)]({'jsonrpc':_0x1eafc0(0x122),'id':0x2,'method':_0x1eafc0(0xd5),'params':{'name':_0x45dabe,'arguments':_0xd834bf}})}))[_0x1eafc0(0xde)]())[_0x1eafc0(0x12e)]('\x0a')['find'](_0x10dd5b=>_0x10dd5b[_0x1eafc0(0xdf)]('data:\x20'));if(_0x17862f){let _0x47b37f=JSON['parse'](_0x17862f[_0x1eafc0(0x12d)](0x6));return _0x47b37f?.['result']?.[_0x1eafc0(0x13e)]?.[0x0]?.[_0x1eafc0(0xde)]?JSON[_0x1eafc0(0xca)](_0x47b37f['result'][_0x1eafc0(0x13e)][0x0][_0x1eafc0(0xde)]):_0x47b37f;}return{'ok':!0x1,'error':_0x1eafc0(0x12c)};}K[a0_0x4e1363(0x134)](a0_0x4dd893,async _0x3e2268=>{const _0x49643d=a0_0x4e1363;let {name:_0x3d7a4f,arguments:_0x356f71}=_0x3e2268[_0x49643d(0xba)];if(_0x3d7a4f===_0x49643d(0x11e)){let {task_id:_0x444a7,text:_0x40e0f0,status:_0x203139}=_0x356f71;if(_0x203139===_0x49643d(0x10f)||_0x203139===_0x49643d(0x145)||_0x203139===_0x49643d(0xf2)){let _0x12f7b8=_0x203139===_0x49643d(0x10f)?'replied':_0x203139,_0x329139=_0x444a7?k[_0x49643d(0xb2)](_0x444a7)||_0x49643d(0x108):'hub',_0x5d6018=await P(_0x49643d(0xc6),{'alias':_0x329139,'text':_0x40e0f0,'in_reply_to':_0x444a7||void 0x0,'status':_0x12f7b8,'from_session':Z});if(_0x444a7)k[_0x49643d(0xe5)](_0x444a7);return{'content':[{'type':_0x49643d(0xde),'text':JSON[_0x49643d(0xb6)](_0x5d6018)}]};}let _0x1ca2b3=await P(_0x49643d(0xf6),{'resume_id':w,'alias':Z,'status':_0x203139===_0x49643d(0xee)?_0x49643d(0xee):_0x203139===_0x49643d(0xe6)?'error':_0x49643d(0x101),'task':_0x40e0f0[_0x49643d(0x12d)](0x0,0xc8),'output':_0x40e0f0});return{'content':[{'type':'text','text':JSON[_0x49643d(0xb6)](_0x1ca2b3)}]};}if(_0x3d7a4f===_0x49643d(0xb7)){let {status:_0x403cc4,task:_0x4dad67,progress:_0x1df387}=_0x356f71,_0x3ee735=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x403cc4,'task':_0x4dad67,'progress':_0x1df387});return{'content':[{'type':_0x49643d(0xde),'text':JSON['stringify'](_0x3ee735)}]};}if(_0x3d7a4f===_0x49643d(0xf4)){let {alias:_0x2081cd,task:_0x34a7f7,priority:_0x511921}=_0x356f71,_0x4f3a2b=await P(_0x49643d(0xc1),{'alias':_0x2081cd,'task':_0x34a7f7,'priority':_0x511921||_0x49643d(0x130),'from_session':Z});return{'content':[{'type':_0x49643d(0xde),'text':JSON[_0x49643d(0xb6)](_0x4f3a2b)}]};}if(_0x3d7a4f===_0x49643d(0xd8)){let {alias:_0x5b961d,message:_0x2cbf43}=_0x356f71,_0x28367=await P(_0x49643d(0x12f),{'alias':_0x5b961d,'message':_0x2cbf43,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x49643d(0xb6)](_0x28367)}]};}if(_0x3d7a4f==='commhub_get_all_status'){let _0x5c125a=await P(_0x49643d(0xe0),{});return{'content':[{'type':'text','text':JSON[_0x49643d(0xb6)](_0x5c125a)}]};}return{'content':[{'type':'text','text':JSON[_0x49643d(0xb6)]({'error':_0x49643d(0xed)})}]};});async function v(){const _0x113900=a0_0x4e1363;let _0x1f077e=D+_0x113900(0x143)+encodeURIComponent(Z),_0x157407={};if(X)_0x157407[_0x113900(0x10d)]=_0x113900(0xb5)+X;Y(_0x113900(0x13a)+_0x1f077e);while(!0x0){try{let _0x5a1bee=await fetch(_0x1f077e,{'headers':_0x157407});if(!_0x5a1bee['ok']){Y(_0x113900(0x142)+_0x5a1bee[_0x113900(0x112)]+'\x20'+_0x5a1bee[_0x113900(0x133)]),await h(0x1388);continue;}let _0xf3d65a=_0x5a1bee[_0x113900(0xec)][_0x113900(0x136)](),_0x397f0d=new TextDecoder(),_0xc43d81='';while(!0x0){let {done:_0x18bc6e,value:_0x402067}=await _0xf3d65a['read']();if(_0x18bc6e)break;_0xc43d81+=_0x397f0d[_0x113900(0x128)](_0x402067,{'stream':!0x0});let _0x58c979=_0xc43d81[_0x113900(0x12e)]('\x0a\x0a');_0xc43d81=_0x58c979[_0x113900(0x10c)]()||'';for(let _0x4e9fad of _0x58c979){let _0x1b603e=_0x4e9fad[_0x113900(0x12e)]('\x0a')['find'](_0x410602=>_0x410602[_0x113900(0xdf)](_0x113900(0x125)));if(!_0x1b603e)continue;try{let _0x12bc4d=JSON[_0x113900(0xca)](_0x1b603e[_0x113900(0x12d)](0x6));await u(_0x12bc4d);}catch(_0x76993){Y(_0x113900(0xd3)+_0x76993);}}}Y(_0x113900(0xdd));}catch(_0xb1598b){Y(_0x113900(0x11a)+_0xb1598b);}await h(0xbb8);}}async function u(_0x438a52){const _0x4b6326=a0_0x4e1363;if(_0x438a52['type']===_0x4b6326(0x135)){Y(_0x4b6326(0xc7)+Z+'\x22');return;}if(_0x438a52[_0x4b6326(0xcd)]===_0x4b6326(0xfc)){if(Y(_0x4b6326(0x119)+_0x438a52[_0x4b6326(0x123)]+':\x20'+_0x438a52[_0x4b6326(0xe8)][_0x4b6326(0x12d)](0x0,0x3c)),await K['notification']({'method':_0x4b6326(0xe4),'params':{'content':_0x438a52['message'],'meta':{'sender':_0x438a52[_0x4b6326(0x123)]||_0x4b6326(0x108),'sender_id':_0x4b6326(0xd0),'user':_0x438a52['from']||_0x4b6326(0x108),'priority':_0x4b6326(0x130)}}}),_0x438a52[_0x4b6326(0xd2)])await P(_0x4b6326(0xda),{'alias':Z,'message_id':_0x438a52[_0x4b6326(0xd2)]});return;}if(_0x438a52[_0x4b6326(0xcd)]==='new_task'||_0x438a52[_0x4b6326(0xcd)]==='broadcast'){Y('←\x20'+_0x438a52[_0x4b6326(0xcd)]+':\x20inbox_count='+_0x438a52[_0x4b6326(0x102)]+'\x20priority='+(_0x438a52[_0x4b6326(0x140)]||_0x4b6326(0x130)));let _0x2421a2=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x2421a2?.['ok']&&_0x2421a2[_0x4b6326(0x114)]?.['length']>0x0)for(let _0x33b897 of _0x2421a2['messages']){let _0x4c9dc1={'sender':_0x33b897[_0x4b6326(0x11f)]||_0x4b6326(0x108),'sender_id':_0x4b6326(0xd0),'user':_0x33b897[_0x4b6326(0x11f)]||_0x4b6326(0x108),'task_id':_0x33b897['id'],'priority':_0x33b897[_0x4b6326(0x140)]||_0x4b6326(0x130)};k[_0x4b6326(0x111)](_0x33b897['id'],_0x33b897[_0x4b6326(0x11f)]||_0x4b6326(0x108)),await K['notification']({'method':'notifications/claude/channel','params':{'content':_0x33b897['content'],'meta':_0x4c9dc1}}),Y('→\x20injected\x20task\x20'+_0x33b897['id'][_0x4b6326(0x12d)](0x0,0x8)+_0x4b6326(0xc4)+_0x33b897[_0x4b6326(0x11f)]+':\x20'+_0x33b897[_0x4b6326(0x13e)][_0x4b6326(0x12d)](0x0,0x3c)),await P(_0x4b6326(0xda),{'alias':Z,'message_id':_0x33b897['id']});}}}async function S(){const _0x3a7a0b=a0_0x4e1363;let _0x75a7e9=new a0_0x3b6b49();await K[_0x3a7a0b(0x138)](_0x75a7e9),Y(_0x3a7a0b(0xce)),Y(_0x3a7a0b(0xbf)),v()[_0x3a7a0b(0xcc)](_0x5618f2=>Y(_0x3a7a0b(0xeb)+_0x5618f2)),P('report_status',{'resume_id':w,'alias':Z,'status':_0x3a7a0b(0xd9),'server':a0_0x2263d7(),'hostname':a0_0x2263d7(),'agent':_0x3a7a0b(0x13d),'project_dir':process[_0x3a7a0b(0x11c)](),'tmux_name':f||void 0x0})[_0x3a7a0b(0x110)](()=>Y(_0x3a7a0b(0xfe)+Z+_0x3a7a0b(0x13c)+w[_0x3a7a0b(0x12d)](0x0,0x8)+')'))[_0x3a7a0b(0xcc)](_0x1d7e79=>Y(_0x3a7a0b(0xea)+_0x1d7e79)),setInterval(()=>{const _0x409001=_0x3a7a0b;P(_0x409001(0xf6),{'resume_id':w,'alias':Z,'status':_0x409001(0xd9),'server':a0_0x2263d7(),'hostname':a0_0x2263d7(),'agent':_0x409001(0x13d),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})['catch'](_0x4fae1b=>Y(_0x409001(0x132)+_0x4fae1b));},0x2bf20),Y(_0x3a7a0b(0x141));}S()[a0_0x4e1363(0xcc)](_0x34e073=>{const _0x1a3fb7=a0_0x4e1363;Y(_0x1a3fb7(0xb9)+_0x34e073),process[_0x1a3fb7(0x118)](0x1);});async function N(){const _0x50de80=a0_0x4e1363;Y(_0x50de80(0x104)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x50de80(0xe6),'task':_0x50de80(0xf0)})[_0x50de80(0xcc)](()=>{}),process['exit'](0x0);}process[a0_0x4e1363(0xbc)]['on'](a0_0x4e1363(0x121),()=>N()),process['on'](a0_0x4e1363(0xb3),()=>N()),process['on'](a0_0x4e1363(0x144),()=>N());
|
|
2
|
+
const a0_0x38279b=a0_0xf126;(function(_0x111e9e,_0x409a41){const _0x88f728=a0_0xf126,_0x465279=_0x111e9e();while(!![]){try{const _0x4d416f=-parseInt(_0x88f728(0xe2))/0x1+parseInt(_0x88f728(0xdf))/0x2+parseInt(_0x88f728(0x14b))/0x3+parseInt(_0x88f728(0xda))/0x4*(parseInt(_0x88f728(0x154))/0x5)+-parseInt(_0x88f728(0x13f))/0x6*(parseInt(_0x88f728(0xee))/0x7)+-parseInt(_0x88f728(0x13b))/0x8+parseInt(_0x88f728(0x120))/0x9;if(_0x4d416f===_0x409a41)break;else _0x465279['push'](_0x465279['shift']());}catch(_0x3d5495){_0x465279['push'](_0x465279['shift']());}}}(a0_0x48b3,0x7e54a));import{readFileSync as a0_0x319e3e,existsSync as a0_0x56a386}from'fs';import{join as a0_0x120ebf}from'path';import{hostname as a0_0x89c7a}from'os';import{execSync as a0_0x3855bb}from'child_process';import{Server as a0_0x445d0d}from'@modelcontextprotocol/sdk/server/index.js';function a0_0xf126(_0xc05918,_0x360665){_0xc05918=_0xc05918-0xcf;const _0x48b302=a0_0x48b3();let _0xf126b3=_0x48b302[_0xc05918];return _0xf126b3;}import{StdioServerTransport as a0_0x387a1b}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x18cd66,CallToolRequestSchema as a0_0x51100c}from'@modelcontextprotocol/sdk/types.js';function p(_0x155de4){const _0x4e746a=a0_0xf126;if(!a0_0x56a386(_0x155de4))return;for(let _0x334936 of a0_0x319e3e(_0x155de4,'utf-8')[_0x4e746a(0x114)]('\x0a')){let _0x5bef73=_0x334936[_0x4e746a(0x10b)]();if(!_0x5bef73||_0x5bef73['startsWith']('#'))continue;let _0x3c2d5b=_0x5bef73[_0x4e746a(0x13a)]('=');if(_0x3c2d5b<0x0)continue;let _0x2f24ce=_0x5bef73[_0x4e746a(0xd1)](0x0,_0x3c2d5b)[_0x4e746a(0x10b)](),_0x432e8f=_0x5bef73[_0x4e746a(0xd1)](_0x3c2d5b+0x1)['trim']()[_0x4e746a(0x103)](/^["']|["']$/g,'');if(!process.env[_0x2f24ce])process.env[_0x2f24ce]=_0x432e8f;}}var C=process.env.HOME||'~',T=a0_0x120ebf(C,a0_0x38279b(0xfd));function a0_0x48b3(){const _0x51f4df=['stdin','SIGINT','report_status','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','unknown\x20tool','hub','commhub_send_task','708822GQIYIS','completed','in_progress','shutting\x20down,\x20reporting\x20offline...','0.3.0','params','warning:\x20could\x20not\x20register:\x20','cwd','blocked','874150kVgCpt','commhub','Message\x20content','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','send_reply','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','commhub-channel','Authorization','from','2025-03-26','stringify',']\x20[commhub]\x20','slice','exit','error','Task\x20content','connect','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','low','notifications/claude/channel','...\x20TMUX=','20xydDyI','read','get','message_id','working','129772IXQsxf','fatal:\x20','SIGTERM','122201JhyvXk','startsWith','new_task','\x20CWD=','/mcp','set','cancelled','none','find','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','\x20RESUME_ID=','Target\x20session\x20alias','308POriqq','\x22\x20(','config.json','tmux\x20display-message\x20-p\x20\x27#S\x27','Progress\x200-100','failed','toTimeString','claude-code','.env','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','/events/','idle','SSE\x20connection\x20error:\x20','\x20priority=','status','.claude/channels/commhub','replied','normal','task','content','priority','replace','send_task','length','broadcast','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','ready\x20—\x20waiting\x20for\x20events','registered\x20as\x20\x22','decode','trim','new_message','body','get_all_status','application/json','send_message','\x20ALIAS=','ENV:\x20URL=','starting\x20SSE\x20listener...','split','get_inbox','message','end','init\x20failed:\x20','stderr','data:\x20','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','type','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','commhub_reply','text','7833366CJVPxe','tools/call','object','catch','commhub_get_all_status','←\x20message\x20from\x20','SSE\x20fatal:\x20','token','number','result','\x20PROJECT_ENV=','\x20from\x20','parse','SSE\x20stream\x20ended,\x20reconnecting...','CommHub\x20init\x20failed:\x20','alias','commhub_send_message',':\x20inbox_count=','Priority\x20(default:\x20normal)','utf-8','inbox_count','string','application/json,\x20text/event-stream','from_session','2.0','randomUUID','indexOf','6232968ltMfak','SSE\x20error:\x20','session\x20disconnected','Bearer\x20','85488AyJfIb','Reply\x20text\x20/\x20result\x20summary','delete','messages','setRequestHandler'];a0_0x48b3=function(){return _0x51f4df;};return a0_0x48b3();}p(a0_0x120ebf(T,a0_0x38279b(0xf6)));var L=process[a0_0x38279b(0x152)]()[a0_0x38279b(0x103)](/\//g,'-');p(a0_0x120ebf(T,L,'.env'));function U(){const _0x5be046=a0_0x38279b;try{return a0_0x3855bb(_0x5be046(0xf1),{'encoding':'utf-8','timeout':0x7d0})[_0x5be046(0x10b)]();}catch{return'';}}function c(){const _0x16ed95=a0_0x38279b;try{let _0x467bc5=a0_0x120ebf(C,'.anet',_0x16ed95(0xf0));if(a0_0x56a386(_0x467bc5))return JSON[_0x16ed95(0x12c)](a0_0x319e3e(_0x467bc5,_0x16ed95(0x133)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x38279b(0x149)]||'http://127.0.0.1:9200',f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x89c7a(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x38279b(0x139)](),X=process.env.COMMHUB_TOKEN||H[a0_0x38279b(0x127)]||'';function Y(_0x33b162){const _0x2a7828=a0_0x38279b;let _0x1838fc=new Date()[_0x2a7828(0xf4)]()[_0x2a7828(0xd1)](0x0,0x8);process[_0x2a7828(0x119)]['write']('['+_0x1838fc+_0x2a7828(0xd0)+_0x33b162+'\x0a');}function h(_0x2181dd){return new Promise(_0x1d7f8b=>setTimeout(_0x1d7f8b,_0x2181dd));}Y(a0_0x38279b(0x112)+D+a0_0x38279b(0x111)+Z+a0_0x38279b(0xec)+w[a0_0x38279b(0xd1)](0x0,0x8)+a0_0x38279b(0xd9)+(f||a0_0x38279b(0xe9))+a0_0x38279b(0xe5)+process[a0_0x38279b(0x152)]()+a0_0x38279b(0x12a)+L);var k=new Map(),K=new a0_0x445d0d({'name':'commhub-channel','version':a0_0x38279b(0x14f)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x38279b(0xd6),a0_0x38279b(0x107),a0_0x38279b(0x11d),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Session\x20alias:\x20'+Z]['join']('\x0a')});K[a0_0x38279b(0x143)](a0_0x18cd66,async()=>({'tools':[{'name':a0_0x38279b(0x11e),'description':a0_0x38279b(0xeb),'inputSchema':{'type':a0_0x38279b(0x122),'properties':{'task_id':{'type':a0_0x38279b(0x135),'description':a0_0x38279b(0x159)},'text':{'type':a0_0x38279b(0x135),'description':a0_0x38279b(0x140)},'status':{'type':'string','enum':['completed',a0_0x38279b(0xf3),'cancelled',a0_0x38279b(0x153),a0_0x38279b(0xd3),a0_0x38279b(0x14d)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x38279b(0x11f)]}},{'name':'commhub_report_status','description':a0_0x38279b(0x147),'inputSchema':{'type':a0_0x38279b(0x122),'properties':{'status':{'type':a0_0x38279b(0x135),'enum':[a0_0x38279b(0xde),a0_0x38279b(0xf9),a0_0x38279b(0x153),'error']},'task':{'type':a0_0x38279b(0x135),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x38279b(0x128),'description':a0_0x38279b(0xf2)}},'required':[a0_0x38279b(0xfc)]}},{'name':a0_0x38279b(0x14a),'description':a0_0x38279b(0x157),'inputSchema':{'type':'object','properties':{'alias':{'type':'string','description':a0_0x38279b(0xed)},'task':{'type':a0_0x38279b(0x135),'description':a0_0x38279b(0xd4)},'priority':{'type':'string','enum':['high',a0_0x38279b(0xff),a0_0x38279b(0xd7)],'description':a0_0x38279b(0x132)}},'required':[a0_0x38279b(0x12f),a0_0x38279b(0x100)]}},{'name':a0_0x38279b(0x130),'description':a0_0x38279b(0xf7),'inputSchema':{'type':a0_0x38279b(0x122),'properties':{'alias':{'type':a0_0x38279b(0x135),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x38279b(0x135),'description':a0_0x38279b(0x156)}},'required':['alias','message']}},{'name':'commhub_get_all_status','description':a0_0x38279b(0x11b),'inputSchema':{'type':a0_0x38279b(0x122),'properties':{}}}]}));async function P(_0x5de291,_0x259a55){const _0x1a0b18=a0_0x38279b;let _0x3e6dd0=await fetch(D+_0x1a0b18(0xe6),{'method':'POST','headers':{'Content-Type':_0x1a0b18(0x10f),'Accept':_0x1a0b18(0x136),...X?{'Authorization':_0x1a0b18(0x13e)+X}:{}},'body':JSON[_0x1a0b18(0xcf)]({'jsonrpc':_0x1a0b18(0x138),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x1a0b18(0x15d),'capabilities':{},'clientInfo':{'name':_0x1a0b18(0x15a),'version':_0x1a0b18(0x14f)}}})});if(!_0x3e6dd0['ok']){let _0x3055fc=await _0x3e6dd0['text']();return Y(_0x1a0b18(0x12e)+_0x3e6dd0[_0x1a0b18(0xfc)]+'\x20'+_0x3055fc[_0x1a0b18(0xd1)](0x0,0x64)),{'ok':!0x1,'error':_0x1a0b18(0x118)+_0x3e6dd0['status']};}await _0x3e6dd0['text']();let _0x187b1b=(await(await fetch(D+_0x1a0b18(0xe6),{'method':'POST','headers':{'Content-Type':_0x1a0b18(0x10f),'Accept':_0x1a0b18(0x136),...X?{'Authorization':_0x1a0b18(0x13e)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x2,'method':_0x1a0b18(0x121),'params':{'name':_0x5de291,'arguments':_0x259a55}})}))[_0x1a0b18(0x11f)]())[_0x1a0b18(0x114)]('\x0a')[_0x1a0b18(0xea)](_0x12f97c=>_0x12f97c[_0x1a0b18(0xe3)](_0x1a0b18(0x11a)));if(_0x187b1b){let _0x575ee0=JSON[_0x1a0b18(0x12c)](_0x187b1b['slice'](0x6));return _0x575ee0?.[_0x1a0b18(0x129)]?.['content']?.[0x0]?.['text']?JSON[_0x1a0b18(0x12c)](_0x575ee0[_0x1a0b18(0x129)]['content'][0x0]['text']):_0x575ee0;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x38279b(0x143)](a0_0x51100c,async _0x2f9c20=>{const _0x5e5d4f=a0_0x38279b;let {name:_0x252966,arguments:_0x38cc81}=_0x2f9c20[_0x5e5d4f(0x150)];if(_0x252966===_0x5e5d4f(0x11e)){let {task_id:_0x5203f1,text:_0x2ffd06,status:_0x3ff5b6}=_0x38cc81;if(_0x3ff5b6===_0x5e5d4f(0x14c)||_0x3ff5b6===_0x5e5d4f(0xf3)||_0x3ff5b6===_0x5e5d4f(0xe8)){let _0x68aa3f=_0x3ff5b6===_0x5e5d4f(0x14c)?_0x5e5d4f(0xfe):_0x3ff5b6,_0x360da0=_0x5203f1?k[_0x5e5d4f(0xdc)](_0x5203f1)||_0x5e5d4f(0x149):_0x5e5d4f(0x149),_0x29f22c=await P(_0x5e5d4f(0x158),{'alias':_0x360da0,'text':_0x2ffd06,'in_reply_to':_0x5203f1||void 0x0,'status':_0x68aa3f,'from_session':Z});if(_0x5203f1)k[_0x5e5d4f(0x141)](_0x5203f1);return{'content':[{'type':_0x5e5d4f(0x11f),'text':JSON['stringify'](_0x29f22c)}]};}let _0x5947cc=await P(_0x5e5d4f(0x146),{'resume_id':w,'alias':Z,'status':_0x3ff5b6===_0x5e5d4f(0x153)?_0x5e5d4f(0x153):_0x3ff5b6===_0x5e5d4f(0xd3)?_0x5e5d4f(0xd3):_0x5e5d4f(0xde),'task':_0x2ffd06['slice'](0x0,0xc8),'output':_0x2ffd06});return{'content':[{'type':'text','text':JSON[_0x5e5d4f(0xcf)](_0x5947cc)}]};}if(_0x252966==='commhub_report_status'){let {status:_0xcb8e3c,task:_0x2ab43f,progress:_0x5c50e3}=_0x38cc81,_0x5c29fe=await P(_0x5e5d4f(0x146),{'resume_id':w,'alias':Z,'status':_0xcb8e3c,'task':_0x2ab43f,'progress':_0x5c50e3});return{'content':[{'type':_0x5e5d4f(0x11f),'text':JSON['stringify'](_0x5c29fe)}]};}if(_0x252966===_0x5e5d4f(0x14a)){let {alias:_0x4e29c8,task:_0x48d946,priority:_0x128920}=_0x38cc81,_0x3bb8a4=await P(_0x5e5d4f(0x104),{'alias':_0x4e29c8,'task':_0x48d946,'priority':_0x128920||'normal','from_session':Z});return{'content':[{'type':_0x5e5d4f(0x11f),'text':JSON[_0x5e5d4f(0xcf)](_0x3bb8a4)}]};}if(_0x252966==='commhub_send_message'){let {alias:_0x4a9108,message:_0x551ebb}=_0x38cc81,_0x4c6d72=await P(_0x5e5d4f(0x110),{'alias':_0x4a9108,'message':_0x551ebb,'from_session':Z});return{'content':[{'type':_0x5e5d4f(0x11f),'text':JSON[_0x5e5d4f(0xcf)](_0x4c6d72)}]};}if(_0x252966===_0x5e5d4f(0x124)){let _0x38dd18=await P(_0x5e5d4f(0x10e),{});return{'content':[{'type':'text','text':JSON[_0x5e5d4f(0xcf)](_0x38dd18)}]};}return{'content':[{'type':'text','text':JSON[_0x5e5d4f(0xcf)]({'error':_0x5e5d4f(0x148)})}]};});async function v(){const _0x55a819=a0_0x38279b;let _0x681fa5=D+_0x55a819(0xf8)+encodeURIComponent(Z),_0x3fbcc7={};if(X)_0x3fbcc7[_0x55a819(0x15b)]='Bearer\x20'+X;Y('connecting\x20to\x20'+_0x681fa5);while(!0x0){try{let _0x130ef0=await fetch(_0x681fa5,{'headers':_0x3fbcc7});if(!_0x130ef0['ok']){Y(_0x55a819(0x13c)+_0x130ef0[_0x55a819(0xfc)]+'\x20'+_0x130ef0['statusText']),await h(0x1388);continue;}let _0x51d989=_0x130ef0[_0x55a819(0x10d)]['getReader'](),_0x105e08=new TextDecoder(),_0x3c4411='';while(!0x0){let {done:_0x57de1b,value:_0xd6d467}=await _0x51d989[_0x55a819(0xdb)]();if(_0x57de1b)break;_0x3c4411+=_0x105e08[_0x55a819(0x10a)](_0xd6d467,{'stream':!0x0});let _0x156f25=_0x3c4411[_0x55a819(0x114)]('\x0a\x0a');_0x3c4411=_0x156f25['pop']()||'';for(let _0x1aa4f3 of _0x156f25){let _0x22f5a5=_0x1aa4f3[_0x55a819(0x114)]('\x0a')[_0x55a819(0xea)](_0x52f123=>_0x52f123[_0x55a819(0xe3)](_0x55a819(0x11a)));if(!_0x22f5a5)continue;try{let _0x312628=JSON[_0x55a819(0x12c)](_0x22f5a5[_0x55a819(0xd1)](0x6));await u(_0x312628);}catch(_0x4b99ee){Y('parse\x20error:\x20'+_0x4b99ee);}}}Y(_0x55a819(0x12d));}catch(_0x447431){Y(_0x55a819(0xfa)+_0x447431);}await h(0xbb8);}}async function u(_0x23ff27){const _0x5a02cf=a0_0x38279b;if(_0x23ff27[_0x5a02cf(0x11c)]==='connected'){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x23ff27[_0x5a02cf(0x11c)]===_0x5a02cf(0x10c)){if(Y(_0x5a02cf(0x125)+_0x23ff27[_0x5a02cf(0x15c)]+':\x20'+_0x23ff27[_0x5a02cf(0x116)][_0x5a02cf(0xd1)](0x0,0x3c)),await K['notification']({'method':_0x5a02cf(0xd8),'params':{'content':_0x23ff27[_0x5a02cf(0x116)],'meta':{'sender':_0x23ff27[_0x5a02cf(0x15c)]||_0x5a02cf(0x149),'sender_id':'commhub','user':_0x23ff27[_0x5a02cf(0x15c)]||_0x5a02cf(0x149),'priority':_0x5a02cf(0xff)}}}),_0x23ff27[_0x5a02cf(0xdd)])await P('ack_inbox',{'alias':Z,'message_id':_0x23ff27['message_id']});return;}if(_0x23ff27['type']===_0x5a02cf(0xe4)||_0x23ff27[_0x5a02cf(0x11c)]===_0x5a02cf(0x106)){Y('←\x20'+_0x23ff27[_0x5a02cf(0x11c)]+_0x5a02cf(0x131)+_0x23ff27[_0x5a02cf(0x134)]+_0x5a02cf(0xfb)+(_0x23ff27['priority']||_0x5a02cf(0xff)));let _0x3c9ab7=await P(_0x5a02cf(0x115),{'alias':Z,'limit':0x5});if(_0x3c9ab7?.['ok']&&_0x3c9ab7['messages']?.[_0x5a02cf(0x105)]>0x0)for(let _0x22bf9d of _0x3c9ab7[_0x5a02cf(0x142)]){let _0x3ac043={'sender':_0x22bf9d['from_session']||_0x5a02cf(0x149),'sender_id':_0x5a02cf(0x155),'user':_0x22bf9d[_0x5a02cf(0x137)]||_0x5a02cf(0x149),'task_id':_0x22bf9d['id'],'priority':_0x22bf9d[_0x5a02cf(0x102)]||_0x5a02cf(0xff)};k[_0x5a02cf(0xe7)](_0x22bf9d['id'],_0x22bf9d[_0x5a02cf(0x137)]||_0x5a02cf(0x149)),await K['notification']({'method':_0x5a02cf(0xd8),'params':{'content':_0x22bf9d[_0x5a02cf(0x101)],'meta':_0x3ac043}}),Y('→\x20injected\x20task\x20'+_0x22bf9d['id'][_0x5a02cf(0xd1)](0x0,0x8)+_0x5a02cf(0x12b)+_0x22bf9d[_0x5a02cf(0x137)]+':\x20'+_0x22bf9d['content']['slice'](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x22bf9d['id']});}}}async function S(){const _0x53d4e5=a0_0x38279b;let _0xc16fb6=new a0_0x387a1b();await K[_0x53d4e5(0xd5)](_0xc16fb6),Y('MCP\x20stdio\x20connected'),Y(_0x53d4e5(0x113)),v()['catch'](_0x295472=>Y(_0x53d4e5(0x126)+_0x295472)),P(_0x53d4e5(0x146),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x89c7a(),'hostname':a0_0x89c7a(),'agent':_0x53d4e5(0xf5),'project_dir':process[_0x53d4e5(0x152)](),'tmux_name':f||void 0x0})['then'](()=>Y(_0x53d4e5(0x109)+Z+_0x53d4e5(0xef)+w[_0x53d4e5(0xd1)](0x0,0x8)+')'))[_0x53d4e5(0x123)](_0x140e13=>Y(_0x53d4e5(0x151)+_0x140e13)),setInterval(()=>{const _0x450abf=_0x53d4e5;P(_0x450abf(0x146),{'resume_id':w,'alias':Z,'status':_0x450abf(0xf9),'server':a0_0x89c7a(),'hostname':a0_0x89c7a(),'agent':_0x450abf(0xf5),'project_dir':process[_0x450abf(0x152)](),'tmux_name':f||void 0x0})[_0x450abf(0x123)](_0x2ff65c=>Y('heartbeat\x20failed:\x20'+_0x2ff65c));},0x2bf20),Y(_0x53d4e5(0x108));}S()[a0_0x38279b(0x123)](_0x17e2d0=>{const _0x4f59de=a0_0x38279b;Y(_0x4f59de(0xe0)+_0x17e2d0),process[_0x4f59de(0xd2)](0x1);});async function N(){const _0xd00a4e=a0_0x38279b;Y(_0xd00a4e(0x14e)),await P(_0xd00a4e(0x146),{'resume_id':w,'alias':Z,'status':'error','task':_0xd00a4e(0x13d)})[_0xd00a4e(0x123)](()=>{}),process['exit'](0x0);}process[a0_0x38279b(0x144)]['on'](a0_0x38279b(0x117),()=>N()),process['on'](a0_0x38279b(0xe1),()=>N()),process['on'](a0_0x38279b(0x145),()=>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.51",
|
|
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",
|