@sleep2agi/agent-network 2.0.0-preview.51 → 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_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());
|
|
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",
|