@sleep2agi/agent-network 2.0.0-preview.50 → 2.0.0-preview.52
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_0x1ebe22=a0_0x152e;(function(_0x998633,_0x566851){const _0x153cd7=a0_0x152e,_0x11c7b2=_0x998633();while(!![]){try{const _0xbfdc35=-parseInt(_0x153cd7(0x181))/0x1+-parseInt(_0x153cd7(0x150))/0x2*(-parseInt(_0x153cd7(0x173))/0x3)+-parseInt(_0x153cd7(0x171))/0x4*(parseInt(_0x153cd7(0x179))/0x5)+parseInt(_0x153cd7(0x165))/0x6+-parseInt(_0x153cd7(0x187))/0x7*(-parseInt(_0x153cd7(0x16c))/0x8)+-parseInt(_0x153cd7(0x17d))/0x9+parseInt(_0x153cd7(0x17b))/0xa;if(_0xbfdc35===_0x566851)break;else _0x11c7b2['push'](_0x11c7b2['shift']());}catch(_0x4a0753){_0x11c7b2['push'](_0x11c7b2['shift']());}}}(a0_0x2cc9,0x9e03b));import{EventEmitter as a0_0x44aeb1}from'events';import{hostname as a0_0x5cfded}from'os';function a0_0x152e(_0x17c208,_0x32d456){_0x17c208=_0x17c208-0x138;const _0x2cc9a3=a0_0x2cc9();let _0x152e22=_0x2cc9a3[_0x17c208];return _0x152e22;}class T extends a0_0x44aeb1{['url'];['alias'];[a0_0x1ebe22(0x183)];[a0_0x1ebe22(0x186)];[a0_0x1ebe22(0x155)];['heartbeatInterval'];[a0_0x1ebe22(0x144)];[a0_0x1ebe22(0x142)];[a0_0x1ebe22(0x15f)];[a0_0x1ebe22(0x182)]=!0x1;constructor(_0x331bc0){const _0xdfb2c3=a0_0x1ebe22;super();if(this[_0xdfb2c3(0x143)]=_0x331bc0[_0xdfb2c3(0x143)]['replace'](/\/$/,''),this['alias']=_0x331bc0[_0xdfb2c3(0x14d)],this[_0xdfb2c3(0x183)]=_0x331bc0[_0xdfb2c3(0x183)],this[_0xdfb2c3(0x186)]=_0x331bc0[_0xdfb2c3(0x186)]||_0xdfb2c3(0x156),this[_0xdfb2c3(0x155)]=_0xdfb2c3(0x14f)+_0x331bc0[_0xdfb2c3(0x14d)]+'-'+Date[_0xdfb2c3(0x15c)]()['toString'](0x24),this[_0xdfb2c3(0x17f)]=_0x331bc0['heartbeatInterval']??0x2bf20,this[_0xdfb2c3(0x144)]=_0x331bc0['reconnectDelay']??0xbb8,_0x331bc0[_0xdfb2c3(0x148)]!==!0x1)this[_0xdfb2c3(0x151)]();}[a0_0x1ebe22(0x17e)](_0x31d53a){const _0x45315d=a0_0x1ebe22;console[_0x45315d(0x17e)]('['+new Date()['toTimeString']()[_0x45315d(0x139)](0x0,0x8)+']\x20[commhub:'+this['alias']+']\x20'+_0x31d53a);}async[a0_0x1ebe22(0x159)](_0x34d13c,_0x29ad5f){const _0x22a29b=a0_0x1ebe22;let _0x498613={'Content-Type':'application/json','Accept':_0x22a29b(0x184)};if(this[_0x22a29b(0x183)])_0x498613[_0x22a29b(0x16b)]=_0x22a29b(0x140)+this[_0x22a29b(0x183)];let _0x7dec24=await(await fetch(this[_0x22a29b(0x143)]+_0x22a29b(0x154),{'method':_0x22a29b(0x15d),'headers':_0x498613,'body':JSON[_0x22a29b(0x16f)]({'jsonrpc':'2.0','id':Date['now'](),'method':_0x22a29b(0x16d),'params':{'name':_0x34d13c,'arguments':_0x29ad5f}})}))[_0x22a29b(0x13c)](),_0x1e4cce=_0x7dec24['match'](/data: (.+)/),_0x1f1fdd=_0x1e4cce?JSON['parse'](_0x1e4cce[0x1]):JSON[_0x22a29b(0x13a)](_0x7dec24),_0x4533a9=_0x1f1fdd?.[_0x22a29b(0x152)]?.[_0x22a29b(0x15b)]?.[0x0]?.['text'];return _0x4533a9?JSON[_0x22a29b(0x13a)](_0x4533a9):_0x1f1fdd;}async[a0_0x1ebe22(0x151)](){const _0x5e99dd=a0_0x1ebe22;if(this[_0x5e99dd(0x182)])return;this[_0x5e99dd(0x182)]=!0x0,await this[_0x5e99dd(0x138)]('idle'),this[_0x5e99dd(0x17e)]('registered'),this[_0x5e99dd(0x142)]=setInterval(()=>{const _0x4998dc=_0x5e99dd;this[_0x4998dc(0x138)]('idle')[_0x4998dc(0x174)](_0x4b5c4e=>this[_0x4998dc(0x17e)]('heartbeat\x20failed:\x20'+_0x4b5c4e['message']));},this[_0x5e99dd(0x17f)]),this[_0x5e99dd(0x13d)]();}async[a0_0x1ebe22(0x167)](){const _0x44c981=a0_0x1ebe22;if(this[_0x44c981(0x182)]=!0x1,this[_0x44c981(0x15f)]?.[_0x44c981(0x14b)](),this[_0x44c981(0x142)])clearInterval(this[_0x44c981(0x142)]);await this['status'](_0x44c981(0x175))[_0x44c981(0x174)](()=>{}),this['log'](_0x44c981(0x14e));}async['send'](_0x13825c,_0x1dde7d,_0x508432=a0_0x1ebe22(0x153)){const _0xbbd994=a0_0x1ebe22;return this['call'](_0xbbd994(0x177),{'alias':_0x13825c,'task':_0x1dde7d,'priority':_0x508432,'from_session':this['alias']});}async[a0_0x1ebe22(0x158)](_0x4e2053,_0xeba050){const _0x1ddd2a=a0_0x1ebe22;return this[_0x1ddd2a(0x159)](_0x1ddd2a(0x15a),{'alias':_0x4e2053,'message':_0xeba050,'from_session':this['alias']});}async[a0_0x1ebe22(0x176)](_0xf21aa0,_0x247410,_0x1387ed=a0_0x1ebe22(0x157)){const _0xd578fd=a0_0x1ebe22;return this[_0xd578fd(0x159)](_0xd578fd(0x176),{'task_id':_0xf21aa0,'text':_0x247410,'status':_0x1387ed});}async[a0_0x1ebe22(0x138)](_0x493add,_0x2744ec){const _0x37b42b=a0_0x1ebe22;return this['call'](_0x37b42b(0x172),{'resume_id':this['resumeId'],'alias':this[_0x37b42b(0x14d)],'status':_0x493add,'server':a0_0x5cfded(),'hostname':a0_0x5cfded(),'agent':this[_0x37b42b(0x186)],'project_dir':process[_0x37b42b(0x16a)](),..._0x2744ec});}async['getAllStatus'](){const _0x4249b2=a0_0x1ebe22;return this[_0x4249b2(0x159)](_0x4249b2(0x164),{});}async['broadcast'](_0x476823,_0x503fd1){const _0x16ba9e=a0_0x1ebe22;return this[_0x16ba9e(0x159)](_0x16ba9e(0x149),{'message':_0x476823,'filter_server':_0x503fd1?.[_0x16ba9e(0x162)],'filter_status':_0x503fd1?.[_0x16ba9e(0x138)]});}async[a0_0x1ebe22(0x13d)](){const _0x92a2b8=a0_0x1ebe22;let _0xd6bd4b=encodeURIComponent(this[_0x92a2b8(0x14d)]),_0x199e40=this['url']+_0x92a2b8(0x145)+_0xd6bd4b,_0x590a3d=this['reconnectDelay'];while(this[_0x92a2b8(0x182)]){try{this[_0x92a2b8(0x15f)]=new AbortController();let _0x670b63={'Accept':_0x92a2b8(0x163)};if(this['token'])_0x670b63[_0x92a2b8(0x16b)]='Bearer\x20'+this[_0x92a2b8(0x183)];let _0x8f9538=await fetch(_0x199e40,{'headers':_0x670b63,'signal':this[_0x92a2b8(0x15f)][_0x92a2b8(0x13e)]});if(!_0x8f9538['ok']||!_0x8f9538[_0x92a2b8(0x17a)]){this[_0x92a2b8(0x17e)](_0x92a2b8(0x13f)+_0x8f9538[_0x92a2b8(0x138)]),await this[_0x92a2b8(0x160)](_0x590a3d),_0x590a3d=Math['min'](_0x590a3d*1.5,0xea60);continue;}_0x590a3d=this[_0x92a2b8(0x144)];let _0x4c3c35=_0x8f9538[_0x92a2b8(0x17a)]['getReader'](),_0x3a05cb=new TextDecoder(),_0x1c4f7c='';while(this[_0x92a2b8(0x182)]){let {done:_0x1bda2a,value:_0x1ad433}=await _0x4c3c35[_0x92a2b8(0x147)]();if(_0x1bda2a)break;_0x1c4f7c+=_0x3a05cb[_0x92a2b8(0x14c)](_0x1ad433,{'stream':!0x0});let _0x14d6bf=_0x1c4f7c[_0x92a2b8(0x185)]('\x0a');_0x1c4f7c=_0x14d6bf[_0x92a2b8(0x170)]()||'';for(let _0x4d6e3f of _0x14d6bf){if(!_0x4d6e3f[_0x92a2b8(0x188)]('data:\x20'))continue;try{let _0x9a496b=JSON['parse'](_0x4d6e3f[_0x92a2b8(0x139)](0x6));if(_0x9a496b[_0x92a2b8(0x146)]===_0x92a2b8(0x14a)){this[_0x92a2b8(0x17e)](_0x92a2b8(0x166)),this[_0x92a2b8(0x169)](_0x92a2b8(0x14a));continue;}if(_0x9a496b[_0x92a2b8(0x146)]===_0x92a2b8(0x161)||_0x9a496b[_0x92a2b8(0x146)]===_0x92a2b8(0x168)||_0x9a496b['type']===_0x92a2b8(0x149))await this[_0x92a2b8(0x15e)]();}catch{}}}}catch(_0x58c0a6){if(_0x58c0a6['name']===_0x92a2b8(0x13b))break;this[_0x92a2b8(0x169)](_0x92a2b8(0x141),_0x58c0a6),this[_0x92a2b8(0x17e)]('SSE\x20error:\x20'+_0x58c0a6['message']);}if(this[_0x92a2b8(0x182)])this[_0x92a2b8(0x169)](_0x92a2b8(0x14e)),this[_0x92a2b8(0x17e)](_0x92a2b8(0x178)+_0x590a3d/0x3e8+_0x92a2b8(0x180)),await this[_0x92a2b8(0x160)](_0x590a3d),_0x590a3d=Math['min'](_0x590a3d*1.5,0xea60);}}async[a0_0x1ebe22(0x15e)](){const _0x28c186=a0_0x1ebe22;try{let _0x21e0e3=(await this[_0x28c186(0x159)]('get_inbox',{'alias':this[_0x28c186(0x14d)],'limit':0xa}))?.['messages']||[];for(let _0x4741f7 of _0x21e0e3)await this[_0x28c186(0x159)](_0x28c186(0x17c),{'alias':this[_0x28c186(0x14d)],'message_id':_0x4741f7['id']}),this['log']('←\x20'+_0x4741f7['from_session']+':\x20'+_0x4741f7[_0x28c186(0x15b)][_0x28c186(0x139)](0x0,0x3c)),this[_0x28c186(0x169)](_0x28c186(0x16e),_0x4741f7),this[_0x28c186(0x169)](_0x28c186(0x158),_0x4741f7);}catch(_0x28403d){this[_0x28c186(0x17e)]('inbox\x20error:\x20'+_0x28403d[_0x28c186(0x158)]);}}['sleep'](_0x1362a1){return new Promise(_0x12ff90=>setTimeout(_0x12ff90,_0x1362a1));}}var $=T;export{$ as default,T as CommHub};function a0_0x2cc9(){const _0x54b3f6=['alias','disconnected','sdk-','1159980qRaGSA','connect','result','normal','/mcp','resumeId','sdk','completed','message','call','send_message','content','now','POST','processInbox','sseAbort','sleep','new_task','server','text/event-stream','get_all_status','1732560dYfPUN','SSE\x20connected','disconnect','new_message','emit','cwd','Authorization','530072XRXsKC','tools/call','task','stringify','pop','11068CqewbY','report_status','6StbRNz','catch','offline','reply','send_task','SSE\x20reconnecting\x20in\x20','780LgIKrH','body','5227540fECxHt','ack_inbox','11642157upoAYR','log','heartbeatInterval','s...','659186Pcixoj','running','token','application/json,\x20text/event-stream','split','agent','112IqrkAt','startsWith','status','slice','parse','AbortError','text','connectSSE','signal','SSE\x20failed:\x20','Bearer\x20','error','heartbeatTimer','url','reconnectDelay','/events/','type','read','autoConnect','broadcast','connected','abort','decode'];a0_0x2cc9=function(){return _0x54b3f6;};return a0_0x2cc9();}
|
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_0x407083=a0_0x14bd;(function(_0x7c70e3,_0x50b890){const _0xa3d8e9=a0_0x14bd,_0x342db5=_0x7c70e3();while(!![]){try{const _0x2fbd49=parseInt(_0xa3d8e9(0x20e))/0x1*(-parseInt(_0xa3d8e9(0x21c))/0x2)+parseInt(_0xa3d8e9(0x23d))/0x3+parseInt(_0xa3d8e9(0x238))/0x4+parseInt(_0xa3d8e9(0x1cf))/0x5+-parseInt(_0xa3d8e9(0x241))/0x6*(parseInt(_0xa3d8e9(0x1c9))/0x7)+parseInt(_0xa3d8e9(0x1d4))/0x8*(-parseInt(_0xa3d8e9(0x225))/0x9)+-parseInt(_0xa3d8e9(0x1ca))/0xa*(-parseInt(_0xa3d8e9(0x1dc))/0xb);if(_0x2fbd49===_0x50b890)break;else _0x342db5['push'](_0x342db5['shift']());}catch(_0xece108){_0x342db5['push'](_0x342db5['shift']());}}}(a0_0x5e23,0xee070));import{readFileSync as a0_0xee4f1a,existsSync as a0_0x54198e}from'fs';import{join as a0_0x57c19a}from'path';import{hostname as a0_0x340f05}from'os';import{execSync as a0_0x5a59dc}from'child_process';import{Server as a0_0x5f13d7}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x1c33b2}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x56d93f,CallToolRequestSchema as a0_0x5bdfba}from'@modelcontextprotocol/sdk/types.js';function p(_0x4c30b0){const _0x5c158f=a0_0x14bd;if(!a0_0x54198e(_0x4c30b0))return;for(let _0x58e12c of a0_0xee4f1a(_0x4c30b0,_0x5c158f(0x1e3))[_0x5c158f(0x203)]('\x0a')){let _0xbd85ce=_0x58e12c[_0x5c158f(0x22d)]();if(!_0xbd85ce||_0xbd85ce[_0x5c158f(0x211)]('#'))continue;let _0x51b23d=_0xbd85ce[_0x5c158f(0x1df)]('=');if(_0x51b23d<0x0)continue;let _0x48c3cb=_0xbd85ce[_0x5c158f(0x22f)](0x0,_0x51b23d)['trim'](),_0x5edf61=_0xbd85ce[_0x5c158f(0x22f)](_0x51b23d+0x1)['trim']()['replace'](/^["']|["']$/g,'');if(!process.env[_0x48c3cb])process.env[_0x48c3cb]=_0x5edf61;}}var C=process.env.HOME||'~',T=a0_0x57c19a(C,a0_0x407083(0x205));function a0_0x5e23(){const _0x2489ba=['priority','params','send_reply','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','split','parse\x20error:\x20','.claude/channels/commhub','\x20priority=','message','config.json','text','commhub_send_message','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','SSE\x20connected\x20as\x20\x22','application/json,\x20text/event-stream','24257PLRAUc','Bearer\x20','no\x20response','startsWith','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','toTimeString','\x20PROJECT_ENV=','string','get_all_status','from_session','/events/','.anet','MCP\x20stdio\x20connected','2.0','2XPFeia','Authorization','decode','connecting\x20to\x20','Message\x20content','stderr','Priority\x20(default:\x20normal)','exit','working','423UydWck','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','message_id','Session\x20alias:\x20','type','\x20ALIAS=','Task\x20content','inbox_count','trim','\x22\x20(','slice','commhub-channel','Progress\x200-100','then','http://127.0.0.1:9200','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','object','get_inbox','send_task','1405148HWdXrF','application/json','content','pop','connect','5619192BFboYT','warning:\x20could\x20not\x20register:\x20','Reply\x20text\x20/\x20result\x20summary','blocked','6yhfEbP','set','claude-code','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','cancelled','SSE\x20fatal:\x20','number','hub','Target\x20session\x20alias','commhub_reply','SIGINT','body','find','2025-03-26','fatal:\x20','...\x20TMUX=','SSE\x20connection\x20error:\x20','result','←\x20message\x20from\x20','get','none','13590227KwsbWo','22900gnaZBw','heartbeat\x20failed:\x20','SIGTERM','SSE\x20error:\x20','completed','3587450ywbbih','data:\x20','commhub_send_task','length','parse','212632IdNkNR','unknown\x20tool','POST','shutting\x20down,\x20reporting\x20offline...','from','/mcp','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','.env','5995uavVzS','join','token','indexOf',':\x20inbox_count=','in_progress','error','utf-8','idle','status','new_task','cwd','Current\x20task\x20description','end','low','broadcast','alias','stdin','notification','session\x20disconnected','ENV:\x20URL=','ack_inbox','\x20CWD=','commhub','report_status','commhub_report_status','failed','normal','read','catch','setRequestHandler','new_message','stringify','commhub_get_all_status','0.3.0'];a0_0x5e23=function(){return _0x2489ba;};return a0_0x5e23();}p(a0_0x57c19a(T,a0_0x407083(0x1db)));var L=process[a0_0x407083(0x1e7)]()['replace'](/\//g,'-');p(a0_0x57c19a(T,L,'.env'));function a0_0x14bd(_0x36df9e,_0xbc05){_0x36df9e=_0x36df9e-0x1c9;const _0x5e23a7=a0_0x5e23();let _0x14bdf7=_0x5e23a7[_0x36df9e];return _0x14bdf7;}function U(){try{return a0_0x5a59dc('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':'utf-8','timeout':0x7d0})['trim']();}catch{return'';}}function c(){const _0x373487=a0_0x407083;try{let _0x21964f=a0_0x57c19a(C,_0x373487(0x219),_0x373487(0x208));if(a0_0x54198e(_0x21964f))return JSON[_0x373487(0x1d3)](a0_0xee4f1a(_0x21964f,_0x373487(0x1e3)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x407083(0x248)]||a0_0x407083(0x233),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x340f05(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto['randomUUID'](),X=process.env.COMMHUB_TOKEN||H[a0_0x407083(0x1de)]||'';function Y(_0x2cb7a1){const _0x1a01d5=a0_0x407083;let _0x22a43e=new Date()[_0x1a01d5(0x213)]()[_0x1a01d5(0x22f)](0x0,0x8);process[_0x1a01d5(0x221)]['write']('['+_0x22a43e+']\x20[commhub]\x20'+_0x2cb7a1+'\x0a');}function h(_0x1d40d1){return new Promise(_0x110d21=>setTimeout(_0x110d21,_0x1d40d1));}Y(a0_0x407083(0x1f0)+D+a0_0x407083(0x22a)+Z+'\x20RESUME_ID='+w[a0_0x407083(0x22f)](0x0,0x8)+a0_0x407083(0x250)+(f||a0_0x407083(0x255))+a0_0x407083(0x1f2)+process[a0_0x407083(0x1e7)]()+a0_0x407083(0x214)+L);var k=new Map(),K=new a0_0x5f13d7({'name':a0_0x407083(0x230),'version':'0.3.0'},{'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_0x407083(0x212),a0_0x407083(0x244),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x407083(0x228)+Z][a0_0x407083(0x1dd)]('\x0a')});K[a0_0x407083(0x1fa)](a0_0x56d93f,async()=>({'tools':[{'name':a0_0x407083(0x24a),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x407083(0x235),'properties':{'task_id':{'type':a0_0x407083(0x215),'description':a0_0x407083(0x234)},'text':{'type':a0_0x407083(0x215),'description':a0_0x407083(0x23f)},'status':{'type':a0_0x407083(0x215),'enum':[a0_0x407083(0x1ce),a0_0x407083(0x1f6),a0_0x407083(0x245),a0_0x407083(0x240),a0_0x407083(0x1e2),a0_0x407083(0x1e1)],'description':a0_0x407083(0x1da)}},'required':['text']}},{'name':a0_0x407083(0x1f5),'description':a0_0x407083(0x202),'inputSchema':{'type':a0_0x407083(0x235),'properties':{'status':{'type':'string','enum':[a0_0x407083(0x224),a0_0x407083(0x1e4),'blocked',a0_0x407083(0x1e2)]},'task':{'type':a0_0x407083(0x215),'description':a0_0x407083(0x1e8)},'progress':{'type':a0_0x407083(0x247),'description':a0_0x407083(0x231)}},'required':[a0_0x407083(0x1e5)]}},{'name':a0_0x407083(0x1d1),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x407083(0x235),'properties':{'alias':{'type':a0_0x407083(0x215),'description':a0_0x407083(0x249)},'task':{'type':a0_0x407083(0x215),'description':a0_0x407083(0x22b)},'priority':{'type':a0_0x407083(0x215),'enum':['high','normal',a0_0x407083(0x1ea)],'description':a0_0x407083(0x222)}},'required':[a0_0x407083(0x1ec),'task']}},{'name':a0_0x407083(0x20a),'description':a0_0x407083(0x20b),'inputSchema':{'type':a0_0x407083(0x235),'properties':{'alias':{'type':a0_0x407083(0x215),'description':a0_0x407083(0x249)},'message':{'type':a0_0x407083(0x215),'description':a0_0x407083(0x220)}},'required':[a0_0x407083(0x1ec),'message']}},{'name':'commhub_get_all_status','description':a0_0x407083(0x226),'inputSchema':{'type':'object','properties':{}}}]}));async function P(_0x2671fd,_0x3b9243){const _0x427fdc=a0_0x407083;let _0x27fc49=await fetch(D+'/mcp',{'method':_0x427fdc(0x1d6),'headers':{'Content-Type':_0x427fdc(0x239),'Accept':_0x427fdc(0x20d),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x427fdc(0x21b),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x427fdc(0x24e),'capabilities':{},'clientInfo':{'name':_0x427fdc(0x230),'version':_0x427fdc(0x1fe)}}})});if(!_0x27fc49['ok']){let _0x5afc8e=await _0x27fc49['text']();return Y('CommHub\x20init\x20failed:\x20'+_0x27fc49[_0x427fdc(0x1e5)]+'\x20'+_0x5afc8e['slice'](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x27fc49[_0x427fdc(0x1e5)]};}await _0x27fc49[_0x427fdc(0x209)]();let _0x344832=(await(await fetch(D+_0x427fdc(0x1d9),{'method':'POST','headers':{'Content-Type':_0x427fdc(0x239),'Accept':_0x427fdc(0x20d),...X?{'Authorization':_0x427fdc(0x20f)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x2,'method':'tools/call','params':{'name':_0x2671fd,'arguments':_0x3b9243}})}))['text']())[_0x427fdc(0x203)]('\x0a')['find'](_0x1ba4b5=>_0x1ba4b5[_0x427fdc(0x211)]('data:\x20'));if(_0x344832){let _0x5f48d5=JSON[_0x427fdc(0x1d3)](_0x344832['slice'](0x6));return _0x5f48d5?.[_0x427fdc(0x252)]?.[_0x427fdc(0x23a)]?.[0x0]?.[_0x427fdc(0x209)]?JSON[_0x427fdc(0x1d3)](_0x5f48d5[_0x427fdc(0x252)][_0x427fdc(0x23a)][0x0][_0x427fdc(0x209)]):_0x5f48d5;}return{'ok':!0x1,'error':_0x427fdc(0x210)};}K[a0_0x407083(0x1fa)](a0_0x5bdfba,async _0x434f43=>{const _0x255265=a0_0x407083;let {name:_0x4b1f4c,arguments:_0x3755a9}=_0x434f43[_0x255265(0x200)];if(_0x4b1f4c===_0x255265(0x24a)){let {task_id:_0x293e40,text:_0x1ecc3d,status:_0x378ab4}=_0x3755a9;if(_0x378ab4==='completed'||_0x378ab4==='failed'||_0x378ab4===_0x255265(0x245)){let _0x40fdbe=_0x378ab4===_0x255265(0x1ce)?'replied':_0x378ab4,_0x3e5295=_0x293e40?k[_0x255265(0x254)](_0x293e40)||_0x255265(0x248):_0x255265(0x248),_0x115cdf=await P(_0x255265(0x201),{'alias':_0x3e5295,'text':_0x1ecc3d,'in_reply_to':_0x293e40||void 0x0,'status':_0x40fdbe,'from_session':Z});if(_0x293e40)k['delete'](_0x293e40);return{'content':[{'type':_0x255265(0x209),'text':JSON['stringify'](_0x115cdf)}]};}let _0x72bd0=await P(_0x255265(0x1f4),{'resume_id':w,'alias':Z,'status':_0x378ab4===_0x255265(0x240)?'blocked':_0x378ab4==='error'?_0x255265(0x1e2):_0x255265(0x224),'task':_0x1ecc3d['slice'](0x0,0xc8),'output':_0x1ecc3d});return{'content':[{'type':_0x255265(0x209),'text':JSON[_0x255265(0x1fc)](_0x72bd0)}]};}if(_0x4b1f4c==='commhub_report_status'){let {status:_0x5f1177,task:_0x4030ca,progress:_0xe8f648}=_0x3755a9,_0x548cc3=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x5f1177,'task':_0x4030ca,'progress':_0xe8f648});return{'content':[{'type':_0x255265(0x209),'text':JSON[_0x255265(0x1fc)](_0x548cc3)}]};}if(_0x4b1f4c==='commhub_send_task'){let {alias:_0x330c53,task:_0x51bdb3,priority:_0x209315}=_0x3755a9,_0x92d5e8=await P(_0x255265(0x237),{'alias':_0x330c53,'task':_0x51bdb3,'priority':_0x209315||_0x255265(0x1f7),'from_session':Z});return{'content':[{'type':_0x255265(0x209),'text':JSON[_0x255265(0x1fc)](_0x92d5e8)}]};}if(_0x4b1f4c===_0x255265(0x20a)){let {alias:_0x36657f,message:_0x3dd2c6}=_0x3755a9,_0x6ae8e=await P('send_message',{'alias':_0x36657f,'message':_0x3dd2c6,'from_session':Z});return{'content':[{'type':_0x255265(0x209),'text':JSON[_0x255265(0x1fc)](_0x6ae8e)}]};}if(_0x4b1f4c===_0x255265(0x1fd)){let _0x422e7b=await P(_0x255265(0x216),{});return{'content':[{'type':'text','text':JSON[_0x255265(0x1fc)](_0x422e7b)}]};}return{'content':[{'type':_0x255265(0x209),'text':JSON[_0x255265(0x1fc)]({'error':_0x255265(0x1d5)})}]};});async function v(){const _0x2a6f27=a0_0x407083;let _0x2e0c75=D+_0x2a6f27(0x218)+encodeURIComponent(Z),_0x57e897={};if(X)_0x57e897[_0x2a6f27(0x21d)]=_0x2a6f27(0x20f)+X;Y(_0x2a6f27(0x21f)+_0x2e0c75);while(!0x0){try{let _0x264463=await fetch(_0x2e0c75,{'headers':_0x57e897});if(!_0x264463['ok']){Y(_0x2a6f27(0x1cd)+_0x264463['status']+'\x20'+_0x264463['statusText']),await h(0x1388);continue;}let _0xbd722e=_0x264463[_0x2a6f27(0x24c)]['getReader'](),_0x39c4f0=new TextDecoder(),_0x7f9586='';while(!0x0){let {done:_0x3906dc,value:_0x109096}=await _0xbd722e[_0x2a6f27(0x1f8)]();if(_0x3906dc)break;_0x7f9586+=_0x39c4f0[_0x2a6f27(0x21e)](_0x109096,{'stream':!0x0});let _0xceca92=_0x7f9586['split']('\x0a\x0a');_0x7f9586=_0xceca92[_0x2a6f27(0x23b)]()||'';for(let _0x20386a of _0xceca92){let _0x1e037c=_0x20386a['split']('\x0a')[_0x2a6f27(0x24d)](_0x3eb5b3=>_0x3eb5b3[_0x2a6f27(0x211)](_0x2a6f27(0x1d0)));if(!_0x1e037c)continue;try{let _0x2afc81=JSON[_0x2a6f27(0x1d3)](_0x1e037c[_0x2a6f27(0x22f)](0x6));await u(_0x2afc81);}catch(_0x65809e){Y(_0x2a6f27(0x204)+_0x65809e);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x14c0c0){Y(_0x2a6f27(0x251)+_0x14c0c0);}await h(0xbb8);}}async function u(_0x3d5aa0){const _0xb0a38f=a0_0x407083;if(_0x3d5aa0['type']==='connected'){Y(_0xb0a38f(0x20c)+Z+'\x22');return;}if(_0x3d5aa0['type']===_0xb0a38f(0x1fb)){if(Y(_0xb0a38f(0x253)+_0x3d5aa0[_0xb0a38f(0x1d8)]+':\x20'+_0x3d5aa0['message'][_0xb0a38f(0x22f)](0x0,0x3c)),await K[_0xb0a38f(0x1ee)]({'method':'notifications/claude/channel','params':{'content':_0x3d5aa0[_0xb0a38f(0x207)],'meta':{'sender':_0x3d5aa0[_0xb0a38f(0x1d8)]||_0xb0a38f(0x248),'sender_id':'commhub','user':_0x3d5aa0['from']||'hub','priority':'normal'}}}),_0x3d5aa0[_0xb0a38f(0x227)])await P(_0xb0a38f(0x1f1),{'alias':Z,'message_id':_0x3d5aa0[_0xb0a38f(0x227)]});return;}if(_0x3d5aa0[_0xb0a38f(0x229)]===_0xb0a38f(0x1e6)||_0x3d5aa0['type']===_0xb0a38f(0x1eb)){Y('←\x20'+_0x3d5aa0[_0xb0a38f(0x229)]+_0xb0a38f(0x1e0)+_0x3d5aa0[_0xb0a38f(0x22c)]+_0xb0a38f(0x206)+(_0x3d5aa0[_0xb0a38f(0x1ff)]||_0xb0a38f(0x1f7)));let _0x32faf0=await P(_0xb0a38f(0x236),{'alias':Z,'limit':0x5});if(_0x32faf0?.['ok']&&_0x32faf0['messages']?.[_0xb0a38f(0x1d2)]>0x0)for(let _0x17a59d of _0x32faf0['messages']){let _0x4d6db0={'sender':_0x17a59d['from_session']||_0xb0a38f(0x248),'sender_id':_0xb0a38f(0x1f3),'user':_0x17a59d[_0xb0a38f(0x217)]||_0xb0a38f(0x248),'task_id':_0x17a59d['id'],'priority':_0x17a59d['priority']||_0xb0a38f(0x1f7)};k[_0xb0a38f(0x242)](_0x17a59d['id'],_0x17a59d[_0xb0a38f(0x217)]||_0xb0a38f(0x248)),await K[_0xb0a38f(0x1ee)]({'method':'notifications/claude/channel','params':{'content':_0x17a59d['content'],'meta':_0x4d6db0}}),Y('→\x20injected\x20task\x20'+_0x17a59d['id'][_0xb0a38f(0x22f)](0x0,0x8)+'\x20from\x20'+_0x17a59d[_0xb0a38f(0x217)]+':\x20'+_0x17a59d['content'][_0xb0a38f(0x22f)](0x0,0x3c)),await P(_0xb0a38f(0x1f1),{'alias':Z,'message_id':_0x17a59d['id']});}}}async function S(){const _0x4f2542=a0_0x407083;let _0xa686ee=new a0_0x1c33b2();await K[_0x4f2542(0x23c)](_0xa686ee),Y(_0x4f2542(0x21a)),Y('starting\x20SSE\x20listener...'),v()[_0x4f2542(0x1f9)](_0x166568=>Y(_0x4f2542(0x246)+_0x166568)),P(_0x4f2542(0x1f4),{'resume_id':w,'alias':Z,'status':_0x4f2542(0x1e4),'server':a0_0x340f05(),'hostname':a0_0x340f05(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x4f2542(0x232)](()=>Y('registered\x20as\x20\x22'+Z+_0x4f2542(0x22e)+w['slice'](0x0,0x8)+')'))[_0x4f2542(0x1f9)](_0x295e6e=>Y(_0x4f2542(0x23e)+_0x295e6e)),setInterval(()=>{const _0x409c5c=_0x4f2542;P(_0x409c5c(0x1f4),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x340f05(),'hostname':a0_0x340f05(),'agent':_0x409c5c(0x243),'project_dir':process[_0x409c5c(0x1e7)](),'tmux_name':f||void 0x0})[_0x409c5c(0x1f9)](_0x20bdeb=>Y(_0x409c5c(0x1cb)+_0x20bdeb));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}S()[a0_0x407083(0x1f9)](_0x5a8a6a=>{const _0x13007a=a0_0x407083;Y(_0x13007a(0x24f)+_0x5a8a6a),process['exit'](0x1);});async function N(){const _0x2c0bb9=a0_0x407083;Y(_0x2c0bb9(0x1d7)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x2c0bb9(0x1e2),'task':_0x2c0bb9(0x1ef)})[_0x2c0bb9(0x1f9)](()=>{}),process[_0x2c0bb9(0x223)](0x0);}process[a0_0x407083(0x1ed)]['on'](a0_0x407083(0x1e9),()=>N()),process['on'](a0_0x407083(0x1cc),()=>N()),process['on'](a0_0x407083(0x24b),()=>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.52",
|
|
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",
|