@sleep2agi/agent-network 2.2.9 → 2.2.10-preview.0
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_0x5b3dd7=a0_0x249e;(function(_0x1157ec,_0x51baa0){const _0x1f4d79=a0_0x249e,_0x5f4104=_0x1157ec();while(!![]){try{const _0x4d73fe=-parseInt(_0x1f4d79(0x13b))/0x1+-parseInt(_0x1f4d79(0x15c))/0x2*(parseInt(_0x1f4d79(0x15a))/0x3)+-parseInt(_0x1f4d79(0x16e))/0x4*(parseInt(_0x1f4d79(0x134))/0x5)+parseInt(_0x1f4d79(0x166))/0x6+parseInt(_0x1f4d79(0x155))/0x7+parseInt(_0x1f4d79(0x154))/0x8+-parseInt(_0x1f4d79(0x11f))/0x9;if(_0x4d73fe===_0x51baa0)break;else _0x5f4104['push'](_0x5f4104['shift']());}catch(_0x10b574){_0x5f4104['push'](_0x5f4104['shift']());}}}(a0_0x9753,0xb81fc));import{EventEmitter as a0_0xbb4376}from'events';import{hostname as a0_0x4524d7}from'os';function a0_0x249e(_0x426a9c,_0x5003c7){_0x426a9c=_0x426a9c-0x11a;const _0x97537e=a0_0x9753();let _0x249eb6=_0x97537e[_0x426a9c];return _0x249eb6;}class T extends a0_0xbb4376{[a0_0x5b3dd7(0x146)];[a0_0x5b3dd7(0x159)];[a0_0x5b3dd7(0x129)];[a0_0x5b3dd7(0x131)];[a0_0x5b3dd7(0x139)];['heartbeatInterval'];[a0_0x5b3dd7(0x13d)];['heartbeatTimer'];[a0_0x5b3dd7(0x133)];[a0_0x5b3dd7(0x125)]=!0x1;constructor(_0x4d8685){const _0x193433=a0_0x5b3dd7;super();if(this['url']=_0x4d8685['url']['replace'](/\/$/,''),this['alias']=_0x4d8685[_0x193433(0x159)],this[_0x193433(0x129)]=_0x4d8685['token'],this[_0x193433(0x131)]=_0x4d8685['agent']||_0x193433(0x122),this[_0x193433(0x139)]='sdk-'+_0x4d8685[_0x193433(0x159)]+'-'+Date['now']()['toString'](0x24),this[_0x193433(0x149)]=_0x4d8685[_0x193433(0x149)]??0x2bf20,this[_0x193433(0x13d)]=_0x4d8685[_0x193433(0x13d)]??0xbb8,_0x4d8685[_0x193433(0x168)]!==!0x1)this[_0x193433(0x12b)]();}[a0_0x5b3dd7(0x16c)](_0x457b1b){const _0x3a4374=a0_0x5b3dd7;console[_0x3a4374(0x16c)]('['+new Date()[_0x3a4374(0x16a)]()[_0x3a4374(0x167)](0x0,0x8)+_0x3a4374(0x135)+this[_0x3a4374(0x159)]+']\x20'+_0x457b1b);}async[a0_0x5b3dd7(0x160)](_0x3c6f22,_0x2c260b){const _0x204862=a0_0x5b3dd7;let _0x4d2147={'Content-Type':_0x204862(0x120),'Accept':_0x204862(0x142)};if(this[_0x204862(0x129)])_0x4d2147[_0x204862(0x16b)]=_0x204862(0x123)+this['token'];let _0x14703a=await(await fetch(this[_0x204862(0x146)]+'/mcp',{'method':_0x204862(0x151),'headers':_0x4d2147,'body':JSON['stringify']({'jsonrpc':_0x204862(0x158),'id':Date['now'](),'method':_0x204862(0x15d),'params':{'name':_0x3c6f22,'arguments':_0x2c260b}})}))['text'](),_0x3d251b=_0x14703a[_0x204862(0x14a)](/data: (.+)/),_0x4e9951=_0x3d251b?JSON[_0x204862(0x164)](_0x3d251b[0x1]):JSON['parse'](_0x14703a),_0x293b66=_0x4e9951?.[_0x204862(0x153)]?.[_0x204862(0x11b)]?.[0x0]?.[_0x204862(0x148)];return _0x293b66?JSON[_0x204862(0x164)](_0x293b66):_0x4e9951;}async[a0_0x5b3dd7(0x12b)](){const _0xf57458=a0_0x5b3dd7;if(this[_0xf57458(0x125)])return;this[_0xf57458(0x125)]=!0x0,await this['status'](_0xf57458(0x152)),this['log'](_0xf57458(0x161)),this[_0xf57458(0x11a)]=setInterval(()=>{const _0x123c78=_0xf57458;this['status']('idle')['catch'](_0x20751b=>this['log'](_0x123c78(0x12f)+_0x20751b['message']));},this['heartbeatInterval']),this['connectSSE']();}async['disconnect'](){const _0x220173=a0_0x5b3dd7;if(this['running']=!0x1,this[_0x220173(0x133)]?.[_0x220173(0x12e)](),this['heartbeatTimer'])clearInterval(this[_0x220173(0x11a)]);await this['status']('offline')[_0x220173(0x141)](()=>{}),this[_0x220173(0x16c)](_0x220173(0x163));}async[a0_0x5b3dd7(0x12c)](_0x598a46,_0x345248,_0x5216bb=a0_0x5b3dd7(0x127)){const _0x23eef1=a0_0x5b3dd7;return this[_0x23eef1(0x160)](_0x23eef1(0x12d),{'alias':_0x598a46,'task':_0x345248,'priority':_0x5216bb,'from_session':this[_0x23eef1(0x159)]});}async[a0_0x5b3dd7(0x128)](_0x1c585c,_0x462f88){const _0x42639a=a0_0x5b3dd7;return this['call']('send_message',{'alias':_0x1c585c,'message':_0x462f88,'from_session':this[_0x42639a(0x159)]});}async[a0_0x5b3dd7(0x130)](_0x2132f5,_0x110d4e,_0x12dedd='completed'){const _0x94d783=a0_0x5b3dd7;return this[_0x94d783(0x160)]('send_reply',{'in_reply_to':_0x2132f5,'text':_0x110d4e,'status':_0x12dedd});}async[a0_0x5b3dd7(0x13f)](_0x5ac4d3,_0x55a57c){const _0x175324=a0_0x5b3dd7;return this[_0x175324(0x160)](_0x175324(0x14d),{'resume_id':this[_0x175324(0x139)],'alias':this[_0x175324(0x159)],'status':_0x5ac4d3,'server':a0_0x4524d7(),'hostname':a0_0x4524d7(),'agent':this['agent'],'project_dir':process[_0x175324(0x11c)](),..._0x55a57c});}async[a0_0x5b3dd7(0x11e)](){const _0x16b459=a0_0x5b3dd7;return this[_0x16b459(0x160)](_0x16b459(0x124),{});}async[a0_0x5b3dd7(0x143)](_0x3b338f,_0x41c6d1){const _0x380458=a0_0x5b3dd7;return this[_0x380458(0x160)](_0x380458(0x143),{'message':_0x3b338f,'filter_server':_0x41c6d1?.['server'],'filter_status':_0x41c6d1?.[_0x380458(0x13f)]});}async[a0_0x5b3dd7(0x15e)](){const _0x2ab305=a0_0x5b3dd7;let _0x1e5cc5=encodeURIComponent(this[_0x2ab305(0x159)]),_0x37c5af=this[_0x2ab305(0x146)]+'/events/'+_0x1e5cc5,_0x4f0e4a=this[_0x2ab305(0x13d)];while(this[_0x2ab305(0x125)]){try{this[_0x2ab305(0x133)]=new AbortController();let _0x4ea25e={'Accept':_0x2ab305(0x12a)};if(this[_0x2ab305(0x129)])_0x4ea25e[_0x2ab305(0x16b)]=_0x2ab305(0x123)+this[_0x2ab305(0x129)];let _0x3a9374=await fetch(_0x37c5af,{'headers':_0x4ea25e,'signal':this[_0x2ab305(0x133)][_0x2ab305(0x136)]});if(!_0x3a9374['ok']||!_0x3a9374['body']){this[_0x2ab305(0x16c)](_0x2ab305(0x121)+_0x3a9374[_0x2ab305(0x13f)]),await this[_0x2ab305(0x169)](_0x4f0e4a),_0x4f0e4a=Math['min'](_0x4f0e4a*1.5,0xea60);continue;}_0x4f0e4a=this[_0x2ab305(0x13d)];let _0x48b330=_0x3a9374[_0x2ab305(0x11d)][_0x2ab305(0x14b)](),_0x354651=new TextDecoder(),_0x32d3db='';while(this['running']){let {done:_0x2a1b2e,value:_0xa5e675}=await _0x48b330[_0x2ab305(0x162)]();if(_0x2a1b2e)break;_0x32d3db+=_0x354651[_0x2ab305(0x13c)](_0xa5e675,{'stream':!0x0});let _0xce65ac=_0x32d3db[_0x2ab305(0x144)]('\x0a');_0x32d3db=_0xce65ac['pop']()||'';for(let _0x13e4a5 of _0xce65ac){if(!_0x13e4a5[_0x2ab305(0x15b)](_0x2ab305(0x13a)))continue;try{let _0x3f31d0=JSON[_0x2ab305(0x164)](_0x13e4a5[_0x2ab305(0x167)](0x6));if(_0x3f31d0[_0x2ab305(0x14c)]==='connected'){this[_0x2ab305(0x16c)](_0x2ab305(0x16d)),this['emit']('connected');continue;}if(_0x3f31d0[_0x2ab305(0x14c)]===_0x2ab305(0x14e)||_0x3f31d0['type']===_0x2ab305(0x147)||_0x3f31d0[_0x2ab305(0x14c)]===_0x2ab305(0x143))await this[_0x2ab305(0x126)]();}catch{}}}}catch(_0x9ad5cf){if(_0x9ad5cf[_0x2ab305(0x14f)]===_0x2ab305(0x145))break;this['emit'](_0x2ab305(0x132),_0x9ad5cf),this[_0x2ab305(0x16c)](_0x2ab305(0x156)+_0x9ad5cf[_0x2ab305(0x128)]);}if(this[_0x2ab305(0x125)])this[_0x2ab305(0x13e)](_0x2ab305(0x163)),this[_0x2ab305(0x16c)](_0x2ab305(0x137)+_0x4f0e4a/0x3e8+_0x2ab305(0x165)),await this[_0x2ab305(0x169)](_0x4f0e4a),_0x4f0e4a=Math[_0x2ab305(0x150)](_0x4f0e4a*1.5,0xea60);}}async[a0_0x5b3dd7(0x126)](){const _0x184820=a0_0x5b3dd7;try{let _0x35769f=(await this[_0x184820(0x160)]('get_inbox',{'alias':this[_0x184820(0x159)],'limit':0xa}))?.[_0x184820(0x138)]||[];for(let _0x5663c8 of _0x35769f)await this[_0x184820(0x160)](_0x184820(0x15f),{'alias':this[_0x184820(0x159)],'message_id':_0x5663c8['id']}),this[_0x184820(0x16c)]('←\x20'+_0x5663c8[_0x184820(0x157)]+':\x20'+_0x5663c8[_0x184820(0x11b)][_0x184820(0x167)](0x0,0x3c)),this[_0x184820(0x13e)](_0x184820(0x140),_0x5663c8),this['emit'](_0x184820(0x128),_0x5663c8);}catch(_0x31d476){this[_0x184820(0x16c)]('inbox\x20error:\x20'+_0x31d476[_0x184820(0x128)]);}}[a0_0x5b3dd7(0x169)](_0xdfdd6a){return new Promise(_0x3bb3b3=>setTimeout(_0x3bb3b3,_0xdfdd6a));}}var $=T;function a0_0x9753(){const _0x32ed08=['SSE\x20error:\x20','from_session','2.0','alias','235380EZqmzU','startsWith','6CqQycP','tools/call','connectSSE','ack_inbox','call','registered','read','disconnected','parse','s...','4362456otTOWA','slice','autoConnect','sleep','toTimeString','Authorization','log','SSE\x20connected','80MmyVjF','heartbeatTimer','content','cwd','body','getAllStatus','2363103HSVozd','application/json','SSE\x20failed:\x20','sdk','Bearer\x20','get_all_status','running','processInbox','normal','message','token','text/event-stream','connect','send','send_task','abort','heartbeat\x20failed:\x20','reply','agent','error','sseAbort','113590ctFboX',']\x20[commhub:','signal','SSE\x20reconnecting\x20in\x20','messages','resumeId','data:\x20','1204245pygTrA','decode','reconnectDelay','emit','status','task','catch','application/json,\x20text/event-stream','broadcast','split','AbortError','url','new_message','text','heartbeatInterval','match','getReader','type','report_status','new_task','name','min','POST','idle','result','8588408uVnnCf','7770679btseCe'];a0_0x9753=function(){return _0x32ed08;};return a0_0x9753();}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_0x13d088=a0_0x22f5;(function(_0x20efdd,_0x51f030){const _0x3d1ba5=a0_0x22f5,_0x3833d1=_0x20efdd();while(!![]){try{const _0xfe93d1=-parseInt(_0x3d1ba5(0xff))/0x1+parseInt(_0x3d1ba5(0x11c))/0x2*(parseInt(_0x3d1ba5(0x147))/0x3)+-parseInt(_0x3d1ba5(0x111))/0x4*(parseInt(_0x3d1ba5(0x10c))/0x5)+-parseInt(_0x3d1ba5(0x157))/0x6*(parseInt(_0x3d1ba5(0x165))/0x7)+parseInt(_0x3d1ba5(0xfd))/0x8*(-parseInt(_0x3d1ba5(0x12e))/0x9)+parseInt(_0x3d1ba5(0x12c))/0xa*(parseInt(_0x3d1ba5(0x14a))/0xb)+parseInt(_0x3d1ba5(0xfc))/0xc*(parseInt(_0x3d1ba5(0x13b))/0xd);if(_0xfe93d1===_0x51f030)break;else _0x3833d1['push'](_0x3833d1['shift']());}catch(_0x314816){_0x3833d1['push'](_0x3833d1['shift']());}}}(a0_0x43de,0x706f1));function a0_0x22f5(_0x10eb0a,_0x546f45){_0x10eb0a=_0x10eb0a-0xfb;const _0x43de2b=a0_0x43de();let _0x22f565=_0x43de2b[_0x10eb0a];return _0x22f565;}import{readFileSync as a0_0x2656ec,existsSync as a0_0xb1d132}from'fs';import{randomUUID as a0_0x631b14}from'crypto';import{join as a0_0x3096ee}from'path';import{hostname as a0_0x3993dc}from'os';import{execSync as a0_0x328062}from'child_process';import{Server as a0_0x18e457}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x1fb6d6}from'@modelcontextprotocol/sdk/server/stdio.js';function a0_0x43de(){const _0x1d85c4=['fatal:\x20','end','commhub-channel','22256lPNngG','hub','set','alias',']\x20[commhub]\x20','cancelled','type','join','\x20priority=','Message\x20content','commhub_reply','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','3sludoJ','notification','config.json','3564737TSvIZE','failed','tools/call','Bearer\x20','notifications/claude/channel','CommHub\x20init\x20failed:\x20','broadcast','from','ack_inbox','Target\x20session\x20alias','MCP\x20stdio\x20connected','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','application/json,\x20text/event-stream','12LiNUKR','tmux\x20display-message\x20-p\x20\x27#S\x27','get_all_status','status','completed','priority','commhub_send_message','data:\x20','in_progress','SSE\x20connection\x20error:\x20','blocked','delete','no\x20response','inbox_count','2350747ZUKRvB','send_message','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','application/json','replace','text','registered\x20as\x20\x22','.env','result','error','commhub_send_task','claude-code','exit','commhub','report_status','content','message_id','slice','Priority\x20(default:\x20normal)','/mcp','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','commhub_report_status','startsWith','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','ready\x20—\x20waiting\x20for\x20events','→\x20injected\x20task\x20','catch','string','Progress\x200-100','from_session','getReader','7284dcgnLZ','233608oZYybD','.anet','323201vZKIeN','unknown\x20tool','body','\x22\x20(','read','new_message','parse','SSE\x20stream\x20ended,\x20reconnecting...','commhub_get_all_status','messages','setRequestHandler','session\x20disconnected','SSE\x20connected\x20as\x20\x22','545Zizfpr','idle','Reply\x20text\x20/\x20result\x20summary','cwd','number','3248IFzSZF','POST','params','init\x20failed:\x20','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','connect','SSE\x20fatal:\x20','none','.claude/channels/commhub','trim','get_inbox','589154VMyHBU','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','normal','then','message','\x20RESUME_ID=','\x20CWD=','connecting\x20to\x20','task','←\x20message\x20from\x20','parse\x20error:\x20','2.0','length','utf-8','stderr','write','20kgyljK','find','135AqqKjo','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','stringify','http://127.0.0.1:9200','Session\x20alias:\x20','split','object','0.3.0','...\x20TMUX=','\x20ALIAS='];a0_0x43de=function(){return _0x1d85c4;};return a0_0x43de();}import{ListToolsRequestSchema as a0_0x1510ef,CallToolRequestSchema as a0_0x356cf4}from'@modelcontextprotocol/sdk/types.js';function p(_0x90a5d1){const _0x47e656=a0_0x22f5;if(!a0_0xb1d132(_0x90a5d1))return;for(let _0x2bc4f9 of a0_0x2656ec(_0x90a5d1,_0x47e656(0x129))[_0x47e656(0x133)]('\x0a')){let _0x59a98b=_0x2bc4f9[_0x47e656(0x11a)]();if(!_0x59a98b||_0x59a98b[_0x47e656(0x17b)]('#'))continue;let _0x2a8d1b=_0x59a98b['indexOf']('=');if(_0x2a8d1b<0x0)continue;let _0x6e5a34=_0x59a98b[_0x47e656(0x176)](0x0,_0x2a8d1b)[_0x47e656(0x11a)](),_0x95b3da=_0x59a98b['slice'](_0x2a8d1b+0x1)[_0x47e656(0x11a)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x6e5a34])process.env[_0x6e5a34]=_0x95b3da;}}var C=process.env.HOME||'~',T=a0_0x3096ee(C,a0_0x13d088(0x119));p(a0_0x3096ee(T,a0_0x13d088(0x16c)));var L=process[a0_0x13d088(0x10f)]()[a0_0x13d088(0x169)](/\//g,'-');p(a0_0x3096ee(T,L,a0_0x13d088(0x16c)));function U(){const _0x4c3352=a0_0x13d088;try{return a0_0x328062(_0x4c3352(0x158),{'encoding':_0x4c3352(0x129),'timeout':0x7d0})[_0x4c3352(0x11a)]();}catch{return'';}}function v(){const _0x258173=a0_0x13d088;try{let _0x28e704=a0_0x3096ee(C,_0x258173(0xfe),_0x258173(0x149));if(a0_0xb1d132(_0x28e704))return JSON[_0x258173(0x105)](a0_0x2656ec(_0x28e704,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x13d088(0x13c)]||a0_0x13d088(0x131),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x3993dc(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x631b14(),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x5b34e2){const _0x3d3b28=a0_0x13d088;let _0x359ddd=new Date()['toTimeString']()[_0x3d3b28(0x176)](0x0,0x8);process[_0x3d3b28(0x12a)][_0x3d3b28(0x12b)]('['+_0x359ddd+_0x3d3b28(0x13f)+_0x5b34e2+'\x0a');}function h(_0x5e4181){return new Promise(_0x2a640b=>setTimeout(_0x2a640b,_0x5e4181));}Y('ENV:\x20URL='+f+a0_0x13d088(0x137)+Z+a0_0x13d088(0x121)+w[a0_0x13d088(0x176)](0x0,0x8)+a0_0x13d088(0x136)+(j||a0_0x13d088(0x118))+a0_0x13d088(0x122)+process['cwd']()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x18e457({'name':'commhub-channel','version':a0_0x13d088(0x135)},{'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_0x13d088(0x146),a0_0x13d088(0x11d),a0_0x13d088(0x12f),a0_0x13d088(0x132)+Z][a0_0x13d088(0x142)]('\x0a')});K[a0_0x13d088(0x109)](a0_0x1510ef,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x13d088(0x167),'inputSchema':{'type':a0_0x13d088(0x134),'properties':{'task_id':{'type':a0_0x13d088(0x180),'description':a0_0x13d088(0x115)},'text':{'type':'string','description':a0_0x13d088(0x10e)},'status':{'type':'string','enum':[a0_0x13d088(0x15b),'failed',a0_0x13d088(0x140),a0_0x13d088(0x161),a0_0x13d088(0x16e),a0_0x13d088(0x15f)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x13d088(0x16a)]}},{'name':a0_0x13d088(0x17a),'description':a0_0x13d088(0x17c),'inputSchema':{'type':a0_0x13d088(0x134),'properties':{'status':{'type':a0_0x13d088(0x180),'enum':['working','idle','blocked',a0_0x13d088(0x16e)]},'task':{'type':a0_0x13d088(0x180),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x13d088(0x110),'description':a0_0x13d088(0x181)}},'required':[a0_0x13d088(0x15a)]}},{'name':a0_0x13d088(0x16f),'description':a0_0x13d088(0x155),'inputSchema':{'type':a0_0x13d088(0x134),'properties':{'alias':{'type':a0_0x13d088(0x180),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x13d088(0x180),'description':'Task\x20content'},'priority':{'type':a0_0x13d088(0x180),'enum':['high',a0_0x13d088(0x11e),'low'],'description':a0_0x13d088(0x177)}},'required':[a0_0x13d088(0x13e),a0_0x13d088(0x124)]}},{'name':a0_0x13d088(0x15d),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x13d088(0x134),'properties':{'alias':{'type':a0_0x13d088(0x180),'description':a0_0x13d088(0x153)},'message':{'type':a0_0x13d088(0x180),'description':a0_0x13d088(0x144)}},'required':['alias',a0_0x13d088(0x120)]}},{'name':a0_0x13d088(0x107),'description':a0_0x13d088(0x179),'inputSchema':{'type':a0_0x13d088(0x134),'properties':{}}}]}));async function P(_0x15c931,_0x2ebb47){const _0x51c364=a0_0x13d088;let _0x931b8f=await fetch(f+'/mcp',{'method':_0x51c364(0x112),'headers':{'Content-Type':_0x51c364(0x168),'Accept':_0x51c364(0x156),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x51c364(0x130)]({'jsonrpc':_0x51c364(0x127),'id':0x1,'method':'initialize','params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x51c364(0x13a),'version':_0x51c364(0x135)}}})});if(!_0x931b8f['ok']){let _0x28d4c3=await _0x931b8f[_0x51c364(0x16a)]();return Y(_0x51c364(0x14f)+_0x931b8f[_0x51c364(0x15a)]+'\x20'+_0x28d4c3['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x51c364(0x114)+_0x931b8f[_0x51c364(0x15a)]};}await _0x931b8f['text']();let _0x52d765=(await(await fetch(f+_0x51c364(0x178),{'method':_0x51c364(0x112),'headers':{'Content-Type':'application/json','Accept':_0x51c364(0x156),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x51c364(0x130)]({'jsonrpc':_0x51c364(0x127),'id':0x2,'method':_0x51c364(0x14c),'params':{'name':_0x15c931,'arguments':_0x2ebb47}})}))['text']())[_0x51c364(0x133)]('\x0a')[_0x51c364(0x12d)](_0x30db94=>_0x30db94[_0x51c364(0x17b)]('data:\x20'));if(_0x52d765){let _0x377ec9=JSON[_0x51c364(0x105)](_0x52d765[_0x51c364(0x176)](0x6));return _0x377ec9?.[_0x51c364(0x16d)]?.[_0x51c364(0x174)]?.[0x0]?.[_0x51c364(0x16a)]?JSON[_0x51c364(0x105)](_0x377ec9[_0x51c364(0x16d)]['content'][0x0][_0x51c364(0x16a)]):_0x377ec9;}return{'ok':!0x1,'error':_0x51c364(0x163)};}K[a0_0x13d088(0x109)](a0_0x356cf4,async _0x48aa44=>{const _0x15450f=a0_0x13d088;let {name:_0x434e8d,arguments:_0x47e8cc}=_0x48aa44[_0x15450f(0x113)];if(_0x434e8d===_0x15450f(0x145)){let {task_id:_0x53d0a5,text:_0x185a20,status:_0x35f2fd}=_0x47e8cc;if(_0x35f2fd==='completed'||_0x35f2fd===_0x15450f(0x14b)||_0x35f2fd==='cancelled'){let _0x4495f9=_0x35f2fd===_0x15450f(0x15b)?'replied':_0x35f2fd,_0x57a6b3=_0x53d0a5?k['get'](_0x53d0a5)||_0x15450f(0x13c):'hub',_0x46ab54=await P('send_reply',{'alias':_0x57a6b3,'text':_0x185a20,'in_reply_to':_0x53d0a5||void 0x0,'status':_0x4495f9,'from_session':Z});if(_0x53d0a5)k[_0x15450f(0x162)](_0x53d0a5);return{'content':[{'type':_0x15450f(0x16a),'text':JSON[_0x15450f(0x130)](_0x46ab54)}]};}let _0x40178a=await P(_0x15450f(0x173),{'resume_id':w,'alias':Z,'status':_0x35f2fd===_0x15450f(0x161)?_0x15450f(0x161):_0x35f2fd===_0x15450f(0x16e)?_0x15450f(0x16e):'working','task':_0x185a20[_0x15450f(0x176)](0x0,0xc8),'output':_0x185a20});return{'content':[{'type':'text','text':JSON['stringify'](_0x40178a)}]};}if(_0x434e8d===_0x15450f(0x17a)){let {status:_0x3eebdb,task:_0x5b51a8,progress:_0x5db1c3}=_0x47e8cc,_0x4c2852=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x3eebdb,'task':_0x5b51a8,'progress':_0x5db1c3});return{'content':[{'type':_0x15450f(0x16a),'text':JSON[_0x15450f(0x130)](_0x4c2852)}]};}if(_0x434e8d===_0x15450f(0x16f)){let {alias:_0xa4e1a7,task:_0x519ea3,priority:_0x19e843}=_0x47e8cc,_0xc3cbd8=await P('send_task',{'alias':_0xa4e1a7,'task':_0x519ea3,'priority':_0x19e843||_0x15450f(0x11e),'from_session':Z});return{'content':[{'type':_0x15450f(0x16a),'text':JSON[_0x15450f(0x130)](_0xc3cbd8)}]};}if(_0x434e8d===_0x15450f(0x15d)){let {alias:_0x41c1bf,message:_0x287cb9}=_0x47e8cc,_0xd92124=await P(_0x15450f(0x166),{'alias':_0x41c1bf,'message':_0x287cb9,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x15450f(0x130)](_0xd92124)}]};}if(_0x434e8d==='commhub_get_all_status'){let _0x3ed235=await P(_0x15450f(0x159),{});return{'content':[{'type':'text','text':JSON[_0x15450f(0x130)](_0x3ed235)}]};}return{'content':[{'type':_0x15450f(0x16a),'text':JSON['stringify']({'error':_0x15450f(0x100)})}]};});async function u(){const _0x395be5=a0_0x13d088;let _0x4c0f46=f+'/events/'+encodeURIComponent(Z),_0x233776={};if(X)_0x233776['Authorization']=_0x395be5(0x14d)+X;Y(_0x395be5(0x123)+_0x4c0f46);while(!0x0){try{let _0x563601=await fetch(_0x4c0f46,{'headers':_0x233776});if(!_0x563601['ok']){Y('SSE\x20error:\x20'+_0x563601[_0x395be5(0x15a)]+'\x20'+_0x563601['statusText']),await h(0x1388);continue;}let _0x5d23f6=_0x563601[_0x395be5(0x101)][_0x395be5(0xfb)](),_0xb908f0=new TextDecoder(),_0x5e85ab='';while(!0x0){let {done:_0x3312ea,value:_0x158316}=await _0x5d23f6[_0x395be5(0x103)]();if(_0x3312ea)break;_0x5e85ab+=_0xb908f0['decode'](_0x158316,{'stream':!0x0});let _0x4ee484=_0x5e85ab[_0x395be5(0x133)]('\x0a\x0a');_0x5e85ab=_0x4ee484['pop']()||'';for(let _0x19998c of _0x4ee484){let _0x303ea9=_0x19998c[_0x395be5(0x133)]('\x0a')['find'](_0x1c86dc=>_0x1c86dc[_0x395be5(0x17b)](_0x395be5(0x15e)));if(!_0x303ea9)continue;try{let _0xe31ef5=JSON['parse'](_0x303ea9[_0x395be5(0x176)](0x6));await S(_0xe31ef5);}catch(_0x3adc49){Y(_0x395be5(0x126)+_0x3adc49);}}}Y(_0x395be5(0x106));}catch(_0x81aaf1){Y(_0x395be5(0x160)+_0x81aaf1);}await h(0xbb8);}}async function S(_0x15354b){const _0x32e992=a0_0x13d088;if(_0x15354b[_0x32e992(0x141)]==='connected'){Y(_0x32e992(0x10b)+Z+'\x22');return;}if(_0x15354b['type']===_0x32e992(0x104)){if(Y(_0x32e992(0x125)+_0x15354b['from']+':\x20'+_0x15354b[_0x32e992(0x120)][_0x32e992(0x176)](0x0,0x3c)),await K[_0x32e992(0x148)]({'method':'notifications/claude/channel','params':{'content':_0x15354b['message'],'meta':{'sender':_0x15354b[_0x32e992(0x151)]||_0x32e992(0x13c),'sender_id':'commhub','user':_0x15354b[_0x32e992(0x151)]||_0x32e992(0x13c),'priority':_0x32e992(0x11e)}}}),_0x15354b[_0x32e992(0x175)])await P(_0x32e992(0x152),{'alias':Z,'message_id':_0x15354b[_0x32e992(0x175)]});return;}if(_0x15354b[_0x32e992(0x141)]==='new_task'||_0x15354b[_0x32e992(0x141)]===_0x32e992(0x150)){Y('←\x20'+_0x15354b['type']+':\x20inbox_count='+_0x15354b[_0x32e992(0x164)]+_0x32e992(0x143)+(_0x15354b[_0x32e992(0x15c)]||_0x32e992(0x11e)));let _0x5561df=await P(_0x32e992(0x11b),{'alias':Z,'limit':0x5});if(_0x5561df?.['ok']&&_0x5561df['messages']?.[_0x32e992(0x128)]>0x0)for(let _0x1be0a4 of _0x5561df[_0x32e992(0x108)]){let _0x2647de={'sender':_0x1be0a4['from_session']||_0x32e992(0x13c),'sender_id':_0x32e992(0x172),'user':_0x1be0a4[_0x32e992(0x182)]||'hub','task_id':_0x1be0a4['id'],'priority':_0x1be0a4[_0x32e992(0x15c)]||_0x32e992(0x11e)};k[_0x32e992(0x13d)](_0x1be0a4['id'],_0x1be0a4[_0x32e992(0x182)]||_0x32e992(0x13c)),await K['notification']({'method':_0x32e992(0x14e),'params':{'content':_0x1be0a4[_0x32e992(0x174)],'meta':_0x2647de}}),Y(_0x32e992(0x17e)+_0x1be0a4['id']['slice'](0x0,0x8)+'\x20from\x20'+_0x1be0a4[_0x32e992(0x182)]+':\x20'+_0x1be0a4['content']['slice'](0x0,0x3c)),await P(_0x32e992(0x152),{'alias':Z,'message_id':_0x1be0a4['id']});}}}async function A(){const _0x32cf70=a0_0x13d088;let _0x566630=new a0_0x1fb6d6();await K[_0x32cf70(0x116)](_0x566630),Y(_0x32cf70(0x154)),Y('starting\x20SSE\x20listener...'),u()[_0x32cf70(0x17f)](_0x434fbe=>Y(_0x32cf70(0x117)+_0x434fbe)),P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x3993dc(),'hostname':a0_0x3993dc(),'agent':_0x32cf70(0x170),'project_dir':process[_0x32cf70(0x10f)](),'tmux_name':j||void 0x0})[_0x32cf70(0x11f)](()=>Y(_0x32cf70(0x16b)+Z+_0x32cf70(0x102)+w[_0x32cf70(0x176)](0x0,0x8)+')'))[_0x32cf70(0x17f)](_0xc32ec=>Y('warning:\x20could\x20not\x20register:\x20'+_0xc32ec)),setInterval(()=>{const _0x655e5c=_0x32cf70;P(_0x655e5c(0x173),{'resume_id':w,'alias':Z,'status':_0x655e5c(0x10d),'server':a0_0x3993dc(),'hostname':a0_0x3993dc(),'agent':_0x655e5c(0x170),'project_dir':process[_0x655e5c(0x10f)](),'tmux_name':j||void 0x0})['catch'](_0x414f2a=>Y('heartbeat\x20failed:\x20'+_0x414f2a));},0x2bf20),Y(_0x32cf70(0x17d));}A()['catch'](_0x1b5642=>{const _0x42bd22=a0_0x13d088;Y(_0x42bd22(0x138)+_0x1b5642),process[_0x42bd22(0x171)](0x1);});async function N(){const _0x2f13cb=a0_0x13d088;Y('shutting\x20down,\x20reporting\x20offline...'),await P(_0x2f13cb(0x173),{'resume_id':w,'alias':Z,'status':'offline','task':_0x2f13cb(0x10a)})[_0x2f13cb(0x17f)](()=>{}),process['exit'](0x0);}process['stdin']['on'](a0_0x13d088(0x139),()=>N()),process['on']('SIGTERM',()=>N()),process['on']('SIGINT',()=>N());
|
|
2
|
+
const a0_0x48b9d3=a0_0x194b;(function(_0x3bfcd6,_0x209a7f){const _0x540da7=a0_0x194b,_0x554ce9=_0x3bfcd6();while(!![]){try{const _0x3510a3=-parseInt(_0x540da7(0x23a))/0x1+-parseInt(_0x540da7(0x226))/0x2+parseInt(_0x540da7(0x241))/0x3+-parseInt(_0x540da7(0x243))/0x4+parseInt(_0x540da7(0x1dc))/0x5*(parseInt(_0x540da7(0x221))/0x6)+parseInt(_0x540da7(0x1e6))/0x7+parseInt(_0x540da7(0x251))/0x8;if(_0x3510a3===_0x209a7f)break;else _0x554ce9['push'](_0x554ce9['shift']());}catch(_0xa350ff){_0x554ce9['push'](_0x554ce9['shift']());}}}(a0_0x38ef,0x8ed43));import{readFileSync as a0_0x5de7be,existsSync as a0_0x540d33}from'fs';import{randomUUID as a0_0x1b06e1}from'crypto';import{join as a0_0x551c08}from'path';import{hostname as a0_0x9d3687}from'os';import{execSync as a0_0x119dce}from'child_process';import{Server as a0_0x4b1c55}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x1b48fa}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x456e9a,CallToolRequestSchema as a0_0x1e6ad6}from'@modelcontextprotocol/sdk/types.js';function p(_0x5a9704){const _0x56d57d=a0_0x194b;if(!a0_0x540d33(_0x5a9704))return;for(let _0x387268 of a0_0x5de7be(_0x5a9704,_0x56d57d(0x210))[_0x56d57d(0x22e)]('\x0a')){let _0x34a581=_0x387268['trim']();if(!_0x34a581||_0x34a581[_0x56d57d(0x203)]('#'))continue;let _0x255c50=_0x34a581[_0x56d57d(0x1e2)]('=');if(_0x255c50<0x0)continue;let _0x53c75b=_0x34a581[_0x56d57d(0x21f)](0x0,_0x255c50)['trim'](),_0x104260=_0x34a581[_0x56d57d(0x21f)](_0x255c50+0x1)[_0x56d57d(0x23c)]()[_0x56d57d(0x24a)](/^["']|["']$/g,'');if(!process.env[_0x53c75b])process.env[_0x53c75b]=_0x104260;}}var C=process.env.HOME||'~',T=a0_0x551c08(C,a0_0x48b9d3(0x1fb));p(a0_0x551c08(T,a0_0x48b9d3(0x222)));var L=process[a0_0x48b9d3(0x24e)]()[a0_0x48b9d3(0x24a)](/\//g,'-');p(a0_0x551c08(T,L,a0_0x48b9d3(0x222)));function U(){const _0x4d4c2c=a0_0x48b9d3;try{return a0_0x119dce('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x4d4c2c(0x210),'timeout':0x7d0})[_0x4d4c2c(0x23c)]();}catch{return'';}}function v(){const _0x2e48f3=a0_0x48b9d3;try{let _0x388367=a0_0x551c08(C,_0x2e48f3(0x248),_0x2e48f3(0x24c));if(a0_0x540d33(_0x388367))return JSON['parse'](a0_0x5de7be(_0x388367,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x48b9d3(0x200)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x9d3687(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x1b06e1(),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x3e0c55){const _0x27dc2f=a0_0x48b9d3;let _0x5ef037=new Date()[_0x27dc2f(0x204)]()[_0x27dc2f(0x21f)](0x0,0x8);process['stderr'][_0x27dc2f(0x23b)]('['+_0x5ef037+_0x27dc2f(0x214)+_0x3e0c55+'\x0a');}function h(_0x1253d6){return new Promise(_0x3e647d=>setTimeout(_0x3e647d,_0x1253d6));}Y(a0_0x48b9d3(0x218)+f+a0_0x48b9d3(0x236)+Z+'\x20RESUME_ID='+w[a0_0x48b9d3(0x21f)](0x0,0x8)+a0_0x48b9d3(0x1f5)+(j||a0_0x48b9d3(0x1e1))+a0_0x48b9d3(0x256)+process['cwd']()+a0_0x48b9d3(0x1e0)+L);var k=new Map(),K=new a0_0x4b1c55({'name':a0_0x48b9d3(0x20e),'version':a0_0x48b9d3(0x252)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x48b9d3(0x21b),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x48b9d3(0x206),'Session\x20alias:\x20'+Z][a0_0x48b9d3(0x247)]('\x0a')});K[a0_0x48b9d3(0x216)](a0_0x456e9a,async()=>({'tools':[{'name':a0_0x48b9d3(0x1e4),'description':a0_0x48b9d3(0x1e3),'inputSchema':{'type':a0_0x48b9d3(0x225),'properties':{'task_id':{'type':a0_0x48b9d3(0x257),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x48b9d3(0x257),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':'string','enum':[a0_0x48b9d3(0x1f2),a0_0x48b9d3(0x21a),a0_0x48b9d3(0x217),'blocked','error','in_progress'],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x48b9d3(0x1ec)]}},{'name':a0_0x48b9d3(0x220),'description':a0_0x48b9d3(0x233),'inputSchema':{'type':a0_0x48b9d3(0x225),'properties':{'status':{'type':a0_0x48b9d3(0x257),'enum':['working',a0_0x48b9d3(0x1d9),'blocked','error']},'task':{'type':a0_0x48b9d3(0x257),'description':a0_0x48b9d3(0x1f9)},'progress':{'type':a0_0x48b9d3(0x1ef),'description':a0_0x48b9d3(0x25d)}},'required':[a0_0x48b9d3(0x22a)]}},{'name':a0_0x48b9d3(0x227),'description':a0_0x48b9d3(0x229),'inputSchema':{'type':a0_0x48b9d3(0x225),'properties':{'alias':{'type':a0_0x48b9d3(0x257),'description':a0_0x48b9d3(0x1ea)},'task':{'type':a0_0x48b9d3(0x257),'description':'Task\x20content'},'priority':{'type':a0_0x48b9d3(0x257),'enum':['high',a0_0x48b9d3(0x23f),a0_0x48b9d3(0x1de)],'description':a0_0x48b9d3(0x230)}},'required':['alias','task']}},{'name':a0_0x48b9d3(0x207),'description':a0_0x48b9d3(0x1f8),'inputSchema':{'type':a0_0x48b9d3(0x225),'properties':{'alias':{'type':'string','description':a0_0x48b9d3(0x1ea)},'message':{'type':'string','description':a0_0x48b9d3(0x208)}},'required':[a0_0x48b9d3(0x20f),a0_0x48b9d3(0x234)]}},{'name':a0_0x48b9d3(0x1f4),'description':a0_0x48b9d3(0x240),'inputSchema':{'type':'object','properties':{}}}]}));async function P(_0x2ca8d4,_0x20d565){const _0x346e6b=a0_0x48b9d3;let _0x57c985=await fetch(f+_0x346e6b(0x223),{'method':_0x346e6b(0x1db),'headers':{'Content-Type':_0x346e6b(0x20d),'Accept':_0x346e6b(0x1eb),...X?{'Authorization':_0x346e6b(0x205)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x346e6b(0x239),'id':0x1,'method':'initialize','params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x346e6b(0x20e),'version':'0.3.0'}}})});if(!_0x57c985['ok']){let _0x1fd4f1=await _0x57c985[_0x346e6b(0x1ec)]();return Y(_0x346e6b(0x22b)+_0x57c985[_0x346e6b(0x22a)]+'\x20'+_0x1fd4f1['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x346e6b(0x259)+_0x57c985[_0x346e6b(0x22a)]};}await _0x57c985[_0x346e6b(0x1ec)]();let _0x1ba636=(await(await fetch(f+_0x346e6b(0x223),{'method':_0x346e6b(0x1db),'headers':{'Content-Type':'application/json','Accept':_0x346e6b(0x1eb),...X?{'Authorization':_0x346e6b(0x205)+X}:{}},'body':JSON[_0x346e6b(0x25b)]({'jsonrpc':_0x346e6b(0x239),'id':0x2,'method':_0x346e6b(0x1e7),'params':{'name':_0x2ca8d4,'arguments':_0x20d565}})}))[_0x346e6b(0x1ec)]())[_0x346e6b(0x22e)]('\x0a')[_0x346e6b(0x1df)](_0x11e71e=>_0x11e71e[_0x346e6b(0x203)]('data:\x20'));if(_0x1ba636){let _0x44b122=JSON[_0x346e6b(0x22f)](_0x1ba636[_0x346e6b(0x21f)](0x6));return _0x44b122?.['result']?.[_0x346e6b(0x258)]?.[0x0]?.[_0x346e6b(0x1ec)]?JSON[_0x346e6b(0x22f)](_0x44b122[_0x346e6b(0x231)][_0x346e6b(0x258)][0x0]['text']):_0x44b122;}return{'ok':!0x1,'error':_0x346e6b(0x1f0)};}K[a0_0x48b9d3(0x216)](a0_0x1e6ad6,async _0x3c9440=>{const _0x1476bf=a0_0x48b9d3;let {name:_0x36ceec,arguments:_0x4d402e}=_0x3c9440[_0x1476bf(0x20c)];if(_0x36ceec===_0x1476bf(0x1e4)){let {task_id:_0x423cbc,text:_0x12b6f0,status:_0x586175}=_0x4d402e;if(_0x586175===_0x1476bf(0x1f2)||_0x586175===_0x1476bf(0x21a)||_0x586175===_0x1476bf(0x217)){let _0x41fb93=_0x586175===_0x1476bf(0x1f2)?_0x1476bf(0x24f):_0x586175,_0xde1c3a=_0x423cbc?k[_0x1476bf(0x1fe)](_0x423cbc)||_0x1476bf(0x200):'hub',_0x26aa70=await P(_0x1476bf(0x219),{'alias':_0xde1c3a,'text':_0x12b6f0,'in_reply_to':_0x423cbc||void 0x0,'status':_0x41fb93,'from_session':Z});if(_0x423cbc)k[_0x1476bf(0x1f6)](_0x423cbc);return{'content':[{'type':'text','text':JSON['stringify'](_0x26aa70)}]};}let _0x50aecb=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x586175===_0x1476bf(0x202)?_0x1476bf(0x202):_0x586175===_0x1476bf(0x22d)?'error':_0x1476bf(0x21c),'task':_0x12b6f0[_0x1476bf(0x21f)](0x0,0xc8),'output':_0x12b6f0});return{'content':[{'type':_0x1476bf(0x1ec),'text':JSON[_0x1476bf(0x25b)](_0x50aecb)}]};}if(_0x36ceec===_0x1476bf(0x220)){let {status:_0x54c963,task:_0x1c4cdd,progress:_0x34ea44}=_0x4d402e,_0x140fa3=await P(_0x1476bf(0x232),{'resume_id':w,'alias':Z,'status':_0x54c963,'task':_0x1c4cdd,'progress':_0x34ea44});return{'content':[{'type':_0x1476bf(0x1ec),'text':JSON[_0x1476bf(0x25b)](_0x140fa3)}]};}if(_0x36ceec==='commhub_send_task'){let {alias:_0x4ac086,task:_0x3e6e57,priority:_0x34c915}=_0x4d402e,_0x2c0bb0=await P(_0x1476bf(0x1fd),{'alias':_0x4ac086,'task':_0x3e6e57,'priority':_0x34c915||_0x1476bf(0x23f),'from_session':Z});return{'content':[{'type':_0x1476bf(0x1ec),'text':JSON[_0x1476bf(0x25b)](_0x2c0bb0)}]};}if(_0x36ceec==='commhub_send_message'){let {alias:_0x453831,message:_0x28650e}=_0x4d402e,_0x57c1fc=await P('send_message',{'alias':_0x453831,'message':_0x28650e,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x1476bf(0x25b)](_0x57c1fc)}]};}if(_0x36ceec===_0x1476bf(0x1f4)){let _0x201747=await P('get_all_status',{});return{'content':[{'type':_0x1476bf(0x1ec),'text':JSON[_0x1476bf(0x25b)](_0x201747)}]};}return{'content':[{'type':'text','text':JSON['stringify']({'error':'unknown\x20tool'})}]};});function a0_0x194b(_0x4dbdff,_0x10e22a){_0x4dbdff=_0x4dbdff-0x1d9;const _0x38ef6c=a0_0x38ef();let _0x194ba0=_0x38ef6c[_0x4dbdff];return _0x194ba0;}async function u(){const _0x3a14fd=a0_0x48b9d3;let _0x56c3bd=f+'/events/'+encodeURIComponent(Z),_0x4555b5={};if(X)_0x4555b5[_0x3a14fd(0x211)]='Bearer\x20'+X;Y(_0x3a14fd(0x24b)+_0x56c3bd);while(!0x0){try{let _0x368968=await fetch(_0x56c3bd,{'headers':_0x4555b5});if(!_0x368968['ok']){Y('SSE\x20error:\x20'+_0x368968[_0x3a14fd(0x22a)]+'\x20'+_0x368968[_0x3a14fd(0x209)]),await h(0x1388);continue;}let _0x282255=_0x368968[_0x3a14fd(0x253)]['getReader'](),_0x4eaba5=new TextDecoder(),_0x47e716='';while(!0x0){let {done:_0x5c952a,value:_0x460598}=await _0x282255[_0x3a14fd(0x1fc)]();if(_0x5c952a)break;_0x47e716+=_0x4eaba5['decode'](_0x460598,{'stream':!0x0});let _0x5b79b0=_0x47e716[_0x3a14fd(0x22e)]('\x0a\x0a');_0x47e716=_0x5b79b0[_0x3a14fd(0x235)]()||'';for(let _0x37a414 of _0x5b79b0){let _0x494c11=_0x37a414[_0x3a14fd(0x22e)]('\x0a')[_0x3a14fd(0x1df)](_0x47a8c4=>_0x47a8c4[_0x3a14fd(0x203)](_0x3a14fd(0x1f7)));if(!_0x494c11)continue;try{let _0x4d39fc=JSON[_0x3a14fd(0x22f)](_0x494c11[_0x3a14fd(0x21f)](0x6));await S(_0x4d39fc);}catch(_0x2c121b){Y(_0x3a14fd(0x1f1)+_0x2c121b);}}}Y(_0x3a14fd(0x1ff));}catch(_0x4fd87d){Y('SSE\x20connection\x20error:\x20'+_0x4fd87d);}await h(0xbb8);}}function a0_0x38ef(){const _0x150711=['.anet','notification','replace','connecting\x20to\x20','config.json','fatal:\x20','cwd','replied','heartbeat\x20failed:\x20','5792232BGmWCk','0.3.0','body','end','from','\x20CWD=','string','content','init\x20failed:\x20','claude-code','stringify','SSE\x20fatal:\x20','Progress\x200-100','type','idle','catch','POST','5TbCyPX','exit','low','find','\x20PROJECT_ENV=','none','indexOf','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','commhub_reply','ready\x20—\x20waiting\x20for\x20events','2122484SkFALo','tools/call','inbox_count','set','Target\x20session\x20alias','application/json,\x20text/event-stream','text','messages','broadcast','number','no\x20response','parse\x20error:\x20','completed','message_id','commhub_get_all_status','...\x20TMUX=','delete','data:\x20','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','Current\x20task\x20description','commhub','.claude/channels/commhub','read','send_task','get','SSE\x20stream\x20ended,\x20reconnecting...','hub','session\x20disconnected','blocked','startsWith','toTimeString','Bearer\x20','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','commhub_send_message','Message\x20content','statusText','notifications/claude/channel','connect','params','application/json','commhub-channel','alias','utf-8','Authorization','connected','stdin',']\x20[commhub]\x20','registered\x20as\x20\x22','setRequestHandler','cancelled','ENV:\x20URL=','send_reply','failed','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','working','new_task','\x22\x20(','slice','commhub_report_status','5323062RaUUAh','.env','/mcp','offline','object','332388ooGrck','commhub_send_task','priority','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','status','CommHub\x20init\x20failed:\x20','ack_inbox','error','split','parse','Priority\x20(default:\x20normal)','result','report_status','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','message','pop','\x20ALIAS=','\x20priority=','\x20from\x20','2.0','982074kOCqIi','write','trim','SIGINT',':\x20inbox_count=','normal','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','2745303ZAxrvk','→\x20injected\x20task\x20','4384896dAoalU','MCP\x20stdio\x20connected','SIGTERM','from_session','join'];a0_0x38ef=function(){return _0x150711;};return a0_0x38ef();}async function S(_0x574dce){const _0xbb02a2=a0_0x48b9d3;if(_0x574dce[_0xbb02a2(0x25e)]===_0xbb02a2(0x212)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x574dce[_0xbb02a2(0x25e)]==='new_message'){if(Y('←\x20message\x20from\x20'+_0x574dce[_0xbb02a2(0x255)]+':\x20'+_0x574dce['message'][_0xbb02a2(0x21f)](0x0,0x3c)),await K[_0xbb02a2(0x249)]({'method':_0xbb02a2(0x20a),'params':{'content':_0x574dce['message'],'meta':{'sender':_0x574dce[_0xbb02a2(0x255)]||'hub','sender_id':_0xbb02a2(0x1fa),'user':_0x574dce[_0xbb02a2(0x255)]||'hub','priority':_0xbb02a2(0x23f)}}}),_0x574dce[_0xbb02a2(0x1f3)])await P(_0xbb02a2(0x22c),{'alias':Z,'message_id':_0x574dce[_0xbb02a2(0x1f3)]});return;}if(_0x574dce[_0xbb02a2(0x25e)]===_0xbb02a2(0x21d)||_0x574dce[_0xbb02a2(0x25e)]===_0xbb02a2(0x1ee)){Y('←\x20'+_0x574dce[_0xbb02a2(0x25e)]+_0xbb02a2(0x23e)+_0x574dce[_0xbb02a2(0x1e8)]+_0xbb02a2(0x237)+(_0x574dce['priority']||_0xbb02a2(0x23f)));let _0xe61478=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0xe61478?.['ok']&&_0xe61478['messages']?.['length']>0x0)for(let _0x47ef02 of _0xe61478[_0xbb02a2(0x1ed)]){let _0x4e4745={'sender':_0x47ef02[_0xbb02a2(0x246)]||_0xbb02a2(0x200),'sender_id':'commhub','user':_0x47ef02[_0xbb02a2(0x246)]||_0xbb02a2(0x200),'task_id':_0x47ef02['id'],'priority':_0x47ef02[_0xbb02a2(0x228)]||_0xbb02a2(0x23f)};k[_0xbb02a2(0x1e9)](_0x47ef02['id'],_0x47ef02['from_session']||_0xbb02a2(0x200)),await K[_0xbb02a2(0x249)]({'method':_0xbb02a2(0x20a),'params':{'content':_0x47ef02['content'],'meta':_0x4e4745}}),Y(_0xbb02a2(0x242)+_0x47ef02['id'][_0xbb02a2(0x21f)](0x0,0x8)+_0xbb02a2(0x238)+_0x47ef02[_0xbb02a2(0x246)]+':\x20'+_0x47ef02['content'][_0xbb02a2(0x21f)](0x0,0x3c)),await P(_0xbb02a2(0x22c),{'alias':Z,'message_id':_0x47ef02['id']});}}}async function A(){const _0x2992a3=a0_0x48b9d3;let _0x23c592=new a0_0x1b48fa();await K[_0x2992a3(0x20b)](_0x23c592),Y(_0x2992a3(0x244)),Y('starting\x20SSE\x20listener...'),u()[_0x2992a3(0x1da)](_0x31ef47=>Y(_0x2992a3(0x25c)+_0x31ef47)),P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x9d3687(),'hostname':a0_0x9d3687(),'agent':_0x2992a3(0x25a),'project_dir':process[_0x2992a3(0x24e)](),'tmux_name':j||void 0x0})['then'](()=>Y(_0x2992a3(0x215)+Z+_0x2992a3(0x21e)+w[_0x2992a3(0x21f)](0x0,0x8)+')'))[_0x2992a3(0x1da)](_0x5c7152=>Y('warning:\x20could\x20not\x20register:\x20'+_0x5c7152)),setInterval(()=>{const _0x1b6695=_0x2992a3;P(_0x1b6695(0x232),{'resume_id':w,'alias':Z,'status':_0x1b6695(0x1d9),'server':a0_0x9d3687(),'hostname':a0_0x9d3687(),'agent':'claude-code','project_dir':process[_0x1b6695(0x24e)](),'tmux_name':j||void 0x0})[_0x1b6695(0x1da)](_0xce11bc=>Y(_0x1b6695(0x250)+_0xce11bc));},0x2bf20),Y(_0x2992a3(0x1e5));}A()[a0_0x48b9d3(0x1da)](_0x55932a=>{const _0x4e693e=a0_0x48b9d3;Y(_0x4e693e(0x24d)+_0x55932a),process['exit'](0x1);});async function N(){const _0x3c3296=a0_0x48b9d3;Y('shutting\x20down,\x20reporting\x20offline...'),await P(_0x3c3296(0x232),{'resume_id':w,'alias':Z,'status':_0x3c3296(0x224),'task':_0x3c3296(0x201)})[_0x3c3296(0x1da)](()=>{}),process[_0x3c3296(0x1dd)](0x0);}process[a0_0x48b9d3(0x213)]['on'](a0_0x48b9d3(0x254),()=>N()),process['on'](a0_0x48b9d3(0x245),()=>N()),process['on'](a0_0x48b9d3(0x23d),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.10-preview.0",
|
|
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",
|