@sleep2agi/agent-network 2.1.15 → 2.2.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_0x12deed=a0_0x2bb5;(function(_0x53c94e,_0x1d11c4){const _0x41ede7=a0_0x2bb5,_0x26e1dd=_0x53c94e();while(!![]){try{const _0x26b690=-parseInt(_0x41ede7(0xe5))/0x1+parseInt(_0x41ede7(0x114))/0x2+-parseInt(_0x41ede7(0xf7))/0x3*(-parseInt(_0x41ede7(0x109))/0x4)+-parseInt(_0x41ede7(0xc9))/0x5*(-parseInt(_0x41ede7(0x106))/0x6)+-parseInt(_0x41ede7(0xdf))/0x7*(parseInt(_0x41ede7(0xef))/0x8)+-parseInt(_0x41ede7(0xe0))/0x9*(-parseInt(_0x41ede7(0xc5))/0xa)+parseInt(_0x41ede7(0xd8))/0xb*(-parseInt(_0x41ede7(0xc7))/0xc);if(_0x26b690===_0x1d11c4)break;else _0x26e1dd['push'](_0x26e1dd['shift']());}catch(_0x2c421c){_0x26e1dd['push'](_0x26e1dd['shift']());}}}(a0_0xfa7b,0xdeca3));import{EventEmitter as a0_0x2aa4f6}from'events';function a0_0x2bb5(_0x592789,_0x16ed20){_0x592789=_0x592789-0xc4;const _0xfa7b89=a0_0xfa7b();let _0x2bb553=_0xfa7b89[_0x592789];return _0x2bb553;}import{hostname as a0_0x4f4a3e}from'os';function a0_0xfa7b(){const _0x2af9c3=['task','new_task','POST','abort','message','token','connect','910978jSlXcO','error','signal','tools/call','70NNnjSe','disconnect','12IDJnbh','/events/','10NPYPOa','match','SSE\x20reconnecting\x20in\x20','2.0','url','completed','alias','disconnected','now','heartbeatTimer','SSE\x20connected','text/event-stream','heartbeatInterval','body','reconnectDelay','26325277XDAhAW','get_all_status','send','s...','application/json,\x20text/event-stream','connected','offline','77zxXBZr','2106099AerlCx','new_message','heartbeat\x20failed:\x20','registered','connectSSE','92685nxDbjC','send_task','application/json','getAllStatus','idle','name','emit','broadcast','slice','toTimeString','322736RkHdSc','Authorization','from_session','sleep','running','sseAbort','type','agent','16257GNQGPk','parse','SSE\x20error:\x20','server','call','normal','send_message','result','Bearer\x20','processInbox','AbortError','log','autoConnect','catch','min','2530986BNhmCG','getReader','stringify','668uTpZFn','resumeId','status','sdk'];a0_0xfa7b=function(){return _0x2af9c3;};return a0_0xfa7b();}class T extends a0_0x2aa4f6{[a0_0x12deed(0xcd)];[a0_0x12deed(0xcf)];[a0_0x12deed(0x112)];[a0_0x12deed(0xf6)];[a0_0x12deed(0x10a)];[a0_0x12deed(0xd5)];[a0_0x12deed(0xd7)];[a0_0x12deed(0xd2)];[a0_0x12deed(0xf4)];['running']=!0x1;constructor(_0x2be3cf){const _0x505419=a0_0x12deed;super();if(this['url']=_0x2be3cf['url']['replace'](/\/$/,''),this[_0x505419(0xcf)]=_0x2be3cf[_0x505419(0xcf)],this[_0x505419(0x112)]=_0x2be3cf[_0x505419(0x112)],this[_0x505419(0xf6)]=_0x2be3cf['agent']||_0x505419(0x10c),this[_0x505419(0x10a)]='sdk-'+_0x2be3cf[_0x505419(0xcf)]+'-'+Date[_0x505419(0xd1)]()['toString'](0x24),this['heartbeatInterval']=_0x2be3cf['heartbeatInterval']??0x2bf20,this[_0x505419(0xd7)]=_0x2be3cf[_0x505419(0xd7)]??0xbb8,_0x2be3cf[_0x505419(0x103)]!==!0x1)this['connect']();}['log'](_0x2d941d){const _0x1c853a=a0_0x12deed;console[_0x1c853a(0x102)]('['+new Date()[_0x1c853a(0xee)]()[_0x1c853a(0xed)](0x0,0x8)+']\x20[commhub:'+this[_0x1c853a(0xcf)]+']\x20'+_0x2d941d);}async['call'](_0x19c970,_0x1b3948){const _0x27fbd8=a0_0x12deed;let _0x27e058={'Content-Type':_0x27fbd8(0xe7),'Accept':_0x27fbd8(0xdc)};if(this[_0x27fbd8(0x112)])_0x27e058[_0x27fbd8(0xf0)]=_0x27fbd8(0xff)+this[_0x27fbd8(0x112)];let _0x17e091=await(await fetch(this[_0x27fbd8(0xcd)]+'/mcp',{'method':_0x27fbd8(0x10f),'headers':_0x27e058,'body':JSON[_0x27fbd8(0x108)]({'jsonrpc':_0x27fbd8(0xcc),'id':Date[_0x27fbd8(0xd1)](),'method':_0x27fbd8(0xc4),'params':{'name':_0x19c970,'arguments':_0x1b3948}})}))['text'](),_0x3d9f0e=_0x17e091[_0x27fbd8(0xca)](/data: (.+)/),_0x11979f=_0x3d9f0e?JSON['parse'](_0x3d9f0e[0x1]):JSON[_0x27fbd8(0xf8)](_0x17e091),_0x4d775f=_0x11979f?.[_0x27fbd8(0xfe)]?.['content']?.[0x0]?.['text'];return _0x4d775f?JSON[_0x27fbd8(0xf8)](_0x4d775f):_0x11979f;}async[a0_0x12deed(0x113)](){const _0x58356a=a0_0x12deed;if(this['running'])return;this[_0x58356a(0xf3)]=!0x0,await this[_0x58356a(0x10b)]('idle'),this['log'](_0x58356a(0xe3)),this[_0x58356a(0xd2)]=setInterval(()=>{const _0x1d53c5=_0x58356a;this[_0x1d53c5(0x10b)](_0x1d53c5(0xe9))['catch'](_0x3dc340=>this[_0x1d53c5(0x102)](_0x1d53c5(0xe2)+_0x3dc340[_0x1d53c5(0x111)]));},this[_0x58356a(0xd5)]),this[_0x58356a(0xe4)]();}async[a0_0x12deed(0xc6)](){const _0x2d056e=a0_0x12deed;if(this[_0x2d056e(0xf3)]=!0x1,this['sseAbort']?.[_0x2d056e(0x110)](),this['heartbeatTimer'])clearInterval(this[_0x2d056e(0xd2)]);await this[_0x2d056e(0x10b)](_0x2d056e(0xde))[_0x2d056e(0x104)](()=>{}),this[_0x2d056e(0x102)](_0x2d056e(0xd0));}async[a0_0x12deed(0xda)](_0x327653,_0x52ace7,_0x4da68e=a0_0x12deed(0xfc)){const _0x4dcace=a0_0x12deed;return this[_0x4dcace(0xfb)](_0x4dcace(0xe6),{'alias':_0x327653,'task':_0x52ace7,'priority':_0x4da68e,'from_session':this[_0x4dcace(0xcf)]});}async[a0_0x12deed(0x111)](_0x51dece,_0x27aa90){const _0x1521c7=a0_0x12deed;return this[_0x1521c7(0xfb)](_0x1521c7(0xfd),{'alias':_0x51dece,'message':_0x27aa90,'from_session':this['alias']});}async['reply'](_0xe41ad7,_0x43cfec,_0x56e6ce=a0_0x12deed(0xce)){const _0x27e528=a0_0x12deed;return this[_0x27e528(0xfb)]('send_reply',{'in_reply_to':_0xe41ad7,'text':_0x43cfec,'status':_0x56e6ce});}async['status'](_0x1edb1e,_0x2870da){const _0x190862=a0_0x12deed;return this[_0x190862(0xfb)]('report_status',{'resume_id':this[_0x190862(0x10a)],'alias':this[_0x190862(0xcf)],'status':_0x1edb1e,'server':a0_0x4f4a3e(),'hostname':a0_0x4f4a3e(),'agent':this[_0x190862(0xf6)],'project_dir':process['cwd'](),..._0x2870da});}async[a0_0x12deed(0xe8)](){const _0x14e469=a0_0x12deed;return this[_0x14e469(0xfb)](_0x14e469(0xd9),{});}async[a0_0x12deed(0xec)](_0x4743f6,_0x9d2f6f){const _0x467805=a0_0x12deed;return this[_0x467805(0xfb)](_0x467805(0xec),{'message':_0x4743f6,'filter_server':_0x9d2f6f?.[_0x467805(0xfa)],'filter_status':_0x9d2f6f?.[_0x467805(0x10b)]});}async[a0_0x12deed(0xe4)](){const _0x37ec04=a0_0x12deed;let _0xb40d7b=encodeURIComponent(this['alias']),_0x103f8b=this['url']+_0x37ec04(0xc8)+_0xb40d7b,_0x4540ec=this[_0x37ec04(0xd7)];while(this[_0x37ec04(0xf3)]){try{this[_0x37ec04(0xf4)]=new AbortController();let _0x49abfa={'Accept':_0x37ec04(0xd4)};if(this[_0x37ec04(0x112)])_0x49abfa[_0x37ec04(0xf0)]='Bearer\x20'+this[_0x37ec04(0x112)];let _0x56f5f7=await fetch(_0x103f8b,{'headers':_0x49abfa,'signal':this[_0x37ec04(0xf4)][_0x37ec04(0x116)]});if(!_0x56f5f7['ok']||!_0x56f5f7[_0x37ec04(0xd6)]){this['log']('SSE\x20failed:\x20'+_0x56f5f7['status']),await this[_0x37ec04(0xf2)](_0x4540ec),_0x4540ec=Math[_0x37ec04(0x105)](_0x4540ec*1.5,0xea60);continue;}_0x4540ec=this[_0x37ec04(0xd7)];let _0xc6acc6=_0x56f5f7['body'][_0x37ec04(0x107)](),_0x4fc84d=new TextDecoder(),_0x561998='';while(this[_0x37ec04(0xf3)]){let {done:_0x26cf99,value:_0x1acc10}=await _0xc6acc6['read']();if(_0x26cf99)break;_0x561998+=_0x4fc84d['decode'](_0x1acc10,{'stream':!0x0});let _0x4fb816=_0x561998['split']('\x0a');_0x561998=_0x4fb816['pop']()||'';for(let _0xaf9dc2 of _0x4fb816){if(!_0xaf9dc2['startsWith']('data:\x20'))continue;try{let _0x380188=JSON[_0x37ec04(0xf8)](_0xaf9dc2[_0x37ec04(0xed)](0x6));if(_0x380188['type']==='connected'){this['log'](_0x37ec04(0xd3)),this[_0x37ec04(0xeb)](_0x37ec04(0xdd));continue;}if(_0x380188[_0x37ec04(0xf5)]===_0x37ec04(0x10e)||_0x380188[_0x37ec04(0xf5)]===_0x37ec04(0xe1)||_0x380188[_0x37ec04(0xf5)]===_0x37ec04(0xec))await this[_0x37ec04(0x100)]();}catch{}}}}catch(_0x28c3f8){if(_0x28c3f8[_0x37ec04(0xea)]===_0x37ec04(0x101))break;this[_0x37ec04(0xeb)](_0x37ec04(0x115),_0x28c3f8),this['log'](_0x37ec04(0xf9)+_0x28c3f8[_0x37ec04(0x111)]);}if(this[_0x37ec04(0xf3)])this[_0x37ec04(0xeb)](_0x37ec04(0xd0)),this[_0x37ec04(0x102)](_0x37ec04(0xcb)+_0x4540ec/0x3e8+_0x37ec04(0xdb)),await this[_0x37ec04(0xf2)](_0x4540ec),_0x4540ec=Math[_0x37ec04(0x105)](_0x4540ec*1.5,0xea60);}}async[a0_0x12deed(0x100)](){const _0x84777d=a0_0x12deed;try{let _0x190d94=(await this[_0x84777d(0xfb)]('get_inbox',{'alias':this[_0x84777d(0xcf)],'limit':0xa}))?.['messages']||[];for(let _0x5b10f5 of _0x190d94)await this['call']('ack_inbox',{'alias':this[_0x84777d(0xcf)],'message_id':_0x5b10f5['id']}),this['log']('←\x20'+_0x5b10f5[_0x84777d(0xf1)]+':\x20'+_0x5b10f5['content'][_0x84777d(0xed)](0x0,0x3c)),this['emit'](_0x84777d(0x10d),_0x5b10f5),this[_0x84777d(0xeb)](_0x84777d(0x111),_0x5b10f5);}catch(_0x5ad896){this[_0x84777d(0x102)]('inbox\x20error:\x20'+_0x5ad896[_0x84777d(0x111)]);}}[a0_0x12deed(0xf2)](_0x128d44){return new Promise(_0x32bd93=>setTimeout(_0x32bd93,_0x128d44));}}var $=T;export{$ as default,T as CommHub};
|
package/dist/src/node-server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
const a0_0x3239df=a0_0x2066;(function(_0x342b2a,_0x68c555){const _0x62a2d2=a0_0x2066,_0x44aa10=_0x342b2a();while(!![]){try{const _0x49097a=parseInt(_0x62a2d2(0xb7))/0x1*(-parseInt(_0x62a2d2(0x88))/0x2)+parseInt(_0x62a2d2(0xea))/0x3+parseInt(_0x62a2d2(0x99))/0x4+parseInt(_0x62a2d2(0xd8))/0x5*(parseInt(_0x62a2d2(0xc0))/0x6)+parseInt(_0x62a2d2(0xe0))/0x7+parseInt(_0x62a2d2(0x8d))/0x8*(-parseInt(_0x62a2d2(0xaf))/0x9)+parseInt(_0x62a2d2(0xfc))/0xa*(-parseInt(_0x62a2d2(0x91))/0xb);if(_0x49097a===_0x68c555)break;else _0x44aa10['push'](_0x44aa10['shift']());}catch(_0x5ba4a8){_0x44aa10['push'](_0x44aa10['shift']());}}}(a0_0x441b,0x3be78));import{readFileSync as a0_0x4231bd,existsSync as a0_0x52e76f}from'fs';import{randomUUID as a0_0x516cd6}from'crypto';import{join as a0_0x3bef62}from'path';import{hostname as a0_0x48d882}from'os';import{execSync as a0_0x2e94d1}from'child_process';import{Server as a0_0x39a9d8}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x322fa5}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x2f12d5,CallToolRequestSchema as a0_0x2fc727}from'@modelcontextprotocol/sdk/types.js';function p(_0x28809a){const _0x65397c=a0_0x2066;if(!a0_0x52e76f(_0x28809a))return;for(let _0x3a7755 of a0_0x4231bd(_0x28809a,_0x65397c(0xa0))[_0x65397c(0x86)]('\x0a')){let _0x2f835f=_0x3a7755[_0x65397c(0xc1)]();if(!_0x2f835f||_0x2f835f['startsWith']('#'))continue;let _0xd932d2=_0x2f835f[_0x65397c(0x100)]('=');if(_0xd932d2<0x0)continue;let _0x5dfee7=_0x2f835f['slice'](0x0,_0xd932d2)[_0x65397c(0xc1)](),_0xa26c66=_0x2f835f[_0x65397c(0xcb)](_0xd932d2+0x1)[_0x65397c(0xc1)]()[_0x65397c(0xca)](/^["']|["']$/g,'');if(!process.env[_0x5dfee7])process.env[_0x5dfee7]=_0xa26c66;}}var C=process.env.HOME||'~',T=a0_0x3bef62(C,a0_0x3239df(0xc6));p(a0_0x3bef62(T,'.env'));var L=process[a0_0x3239df(0xcc)]()['replace'](/\//g,'-');p(a0_0x3bef62(T,L,a0_0x3239df(0x7f)));function U(){const _0x3065ba=a0_0x3239df;try{return a0_0x2e94d1(_0x3065ba(0xda),{'encoding':'utf-8','timeout':0x7d0})[_0x3065ba(0xc1)]();}catch{return'';}}function v(){const _0x5dfb34=a0_0x3239df;try{let _0x5eb307=a0_0x3bef62(C,_0x5dfb34(0xa5),'config.json');if(a0_0x52e76f(_0x5eb307))return JSON[_0x5dfb34(0xbe)](a0_0x4231bd(_0x5eb307,_0x5dfb34(0xa0)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x3239df(0x103)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x48d882(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x516cd6(),X=process.env.COMMHUB_TOKEN||H[a0_0x3239df(0xe7)]||'';function a0_0x441b(){const _0x15fcf4=['message_id','number','replace','slice','cwd','Bearer\x20','set','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','notification','text','send_reply','message','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','initialize','\x20ALIAS=','pop','195oqVAJW','join','tmux\x20display-message\x20-p\x20\x27#S\x27','\x20from\x20','application/json,\x20text/event-stream','in_progress','2.0','commhub_report_status','2304547RxXhoW','data:\x20','priority','failed','completed','Current\x20task\x20description','body','token','Task\x20content','stderr','945993ycNTkd','Progress\x200-100','Target\x20session\x20alias','fatal:\x20','2025-03-26','find','tools/call','none','no\x20response','heartbeat\x20failed:\x20','string','normal','stringify','broadcast','SSE\x20error:\x20','setRequestHandler','catch','toTimeString','80uBdVvW','error','ack_inbox','send_message','indexOf','SSE\x20connected\x20as\x20\x22','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','hub','decode','working','getReader','commhub_send_task','Priority\x20(default:\x20normal)','end','starting\x20SSE\x20listener...','length','parse\x20error:\x20','.env','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','task','←\x20message\x20from\x20','init\x20failed:\x20','content','from_session','split','Authorization','8CUPrUW','SSE\x20fatal:\x20','blocked','params','notifications/claude/channel','8PAcWvc','report_status','commhub_send_message','POST','462297GbeNag','ENV:\x20URL=','unknown\x20tool','warning:\x20could\x20not\x20register:\x20','get','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','cancelled','session\x20disconnected','1031140DRHtvV','type','CommHub\x20init\x20failed:\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','MCP\x20stdio\x20connected','application/json','messages','utf-8','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','→\x20injected\x20task\x20','get_inbox','0.3.0','.anet','idle','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','\x20PROJECT_ENV=','connected','Message\x20content','status','high','SSE\x20stream\x20ended,\x20reconnecting...','2092995ohBYLR','\x22\x20(','exit','commhub-channel','from','commhub_get_all_status','get_all_status','low','82519dSKaEC','claude-code','commhub','delete',']\x20[commhub]\x20','alias','commhub_reply','parse','/mcp','37212vAVugH','trim','object','then','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','SIGTERM','.claude/channels/commhub','shutting\x20down,\x20reporting\x20offline...'];a0_0x441b=function(){return _0x15fcf4;};return a0_0x441b();}function Y(_0x5d65e2){const _0x3f6af5=a0_0x3239df;let _0x2197e4=new Date()[_0x3f6af5(0xfb)]()[_0x3f6af5(0xcb)](0x0,0x8);process[_0x3f6af5(0xe9)]['write']('['+_0x2197e4+_0x3f6af5(0xbb)+_0x5d65e2+'\x0a');}function h(_0x4477d0){return new Promise(_0x538751=>setTimeout(_0x538751,_0x4477d0));}Y(a0_0x3239df(0x92)+f+a0_0x3239df(0xd6)+Z+'\x20RESUME_ID='+w[a0_0x3239df(0xcb)](0x0,0x8)+'...\x20TMUX='+(j||a0_0x3239df(0xf1))+'\x20CWD='+process[a0_0x3239df(0xcc)]()+a0_0x3239df(0xa9)+L);var k=new Map(),K=new a0_0x39a9d8({'name':a0_0x3239df(0xb2),'version':a0_0x3239df(0xa4)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x3239df(0xd4),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x3239df(0x102),a0_0x3239df(0xa8),'Session\x20alias:\x20'+Z][a0_0x3239df(0xd9)]('\x0a')});K[a0_0x3239df(0xf9)](a0_0x2f12d5,async()=>({'tools':[{'name':a0_0x3239df(0xbd),'description':a0_0x3239df(0x9c),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x3239df(0xf4),'description':a0_0x3239df(0xcf)},'text':{'type':a0_0x3239df(0xf4),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':'string','enum':[a0_0x3239df(0xe4),a0_0x3239df(0xe3),'cancelled',a0_0x3239df(0x8a),a0_0x3239df(0xfd),a0_0x3239df(0xdd)],'description':a0_0x3239df(0x80)}},'required':['text']}},{'name':a0_0x3239df(0xdf),'description':a0_0x3239df(0xa1),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x3239df(0xf4),'enum':[a0_0x3239df(0x105),a0_0x3239df(0xa6),a0_0x3239df(0x8a),a0_0x3239df(0xfd)]},'task':{'type':a0_0x3239df(0xf4),'description':a0_0x3239df(0xe5)},'progress':{'type':a0_0x3239df(0xc9),'description':a0_0x3239df(0xeb)}},'required':[a0_0x3239df(0xac)]}},{'name':a0_0x3239df(0x79),'description':a0_0x3239df(0xc4),'inputSchema':{'type':a0_0x3239df(0xc2),'properties':{'alias':{'type':a0_0x3239df(0xf4),'description':a0_0x3239df(0xec)},'task':{'type':a0_0x3239df(0xf4),'description':a0_0x3239df(0xe8)},'priority':{'type':a0_0x3239df(0xf4),'enum':[a0_0x3239df(0xad),a0_0x3239df(0xf5),a0_0x3239df(0xb6)],'description':a0_0x3239df(0x7a)}},'required':[a0_0x3239df(0xbc),a0_0x3239df(0x81)]}},{'name':a0_0x3239df(0x8f),'description':a0_0x3239df(0x96),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x3239df(0xf4),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x3239df(0xf4),'description':a0_0x3239df(0xab)}},'required':[a0_0x3239df(0xbc),'message']}},{'name':a0_0x3239df(0xb4),'description':a0_0x3239df(0xa7),'inputSchema':{'type':a0_0x3239df(0xc2),'properties':{}}}]}));async function P(_0x2d45d0,_0x46dc62){const _0x5e9335=a0_0x3239df;let _0x24fa8b=await fetch(f+'/mcp',{'method':_0x5e9335(0x90),'headers':{'Content-Type':_0x5e9335(0x9e),'Accept':_0x5e9335(0xdc),...X?{'Authorization':_0x5e9335(0xcd)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x1,'method':_0x5e9335(0xd5),'params':{'protocolVersion':_0x5e9335(0xee),'capabilities':{},'clientInfo':{'name':_0x5e9335(0xb2),'version':_0x5e9335(0xa4)}}})});if(!_0x24fa8b['ok']){let _0x3457a8=await _0x24fa8b[_0x5e9335(0xd1)]();return Y(_0x5e9335(0x9b)+_0x24fa8b['status']+'\x20'+_0x3457a8[_0x5e9335(0xcb)](0x0,0x64)),{'ok':!0x1,'error':_0x5e9335(0x83)+_0x24fa8b[_0x5e9335(0xac)]};}await _0x24fa8b[_0x5e9335(0xd1)]();let _0xd2d0f1=(await(await fetch(f+_0x5e9335(0xbf),{'method':_0x5e9335(0x90),'headers':{'Content-Type':_0x5e9335(0x9e),'Accept':_0x5e9335(0xdc),...X?{'Authorization':_0x5e9335(0xcd)+X}:{}},'body':JSON[_0x5e9335(0xf6)]({'jsonrpc':_0x5e9335(0xde),'id':0x2,'method':_0x5e9335(0xf0),'params':{'name':_0x2d45d0,'arguments':_0x46dc62}})}))[_0x5e9335(0xd1)]())['split']('\x0a')['find'](_0x180a03=>_0x180a03['startsWith'](_0x5e9335(0xe1)));if(_0xd2d0f1){let _0x53ebd3=JSON[_0x5e9335(0xbe)](_0xd2d0f1[_0x5e9335(0xcb)](0x6));return _0x53ebd3?.['result']?.['content']?.[0x0]?.[_0x5e9335(0xd1)]?JSON[_0x5e9335(0xbe)](_0x53ebd3['result'][_0x5e9335(0x84)][0x0]['text']):_0x53ebd3;}return{'ok':!0x1,'error':_0x5e9335(0xf2)};}K['setRequestHandler'](a0_0x2fc727,async _0x20a0f2=>{const _0x48d347=a0_0x3239df;let {name:_0x557927,arguments:_0x136c45}=_0x20a0f2[_0x48d347(0x8b)];if(_0x557927===_0x48d347(0xbd)){let {task_id:_0x472824,text:_0x30d68b,status:_0x48cd20}=_0x136c45;if(_0x48cd20===_0x48d347(0xe4)||_0x48cd20===_0x48d347(0xe3)||_0x48cd20===_0x48d347(0x97)){let _0x333335=_0x48cd20===_0x48d347(0xe4)?'replied':_0x48cd20,_0x30d095=_0x472824?k[_0x48d347(0x95)](_0x472824)||_0x48d347(0x103):'hub',_0x4830de=await P(_0x48d347(0xd2),{'alias':_0x30d095,'text':_0x30d68b,'in_reply_to':_0x472824||void 0x0,'status':_0x333335,'from_session':Z});if(_0x472824)k[_0x48d347(0xba)](_0x472824);return{'content':[{'type':_0x48d347(0xd1),'text':JSON[_0x48d347(0xf6)](_0x4830de)}]};}let _0x560267=await P(_0x48d347(0x8e),{'resume_id':w,'alias':Z,'status':_0x48cd20==='blocked'?_0x48d347(0x8a):_0x48cd20==='error'?_0x48d347(0xfd):'working','task':_0x30d68b[_0x48d347(0xcb)](0x0,0xc8),'output':_0x30d68b});return{'content':[{'type':'text','text':JSON[_0x48d347(0xf6)](_0x560267)}]};}if(_0x557927==='commhub_report_status'){let {status:_0x22ebfb,task:_0x7451bd,progress:_0x2cdae3}=_0x136c45,_0x2b5932=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x22ebfb,'task':_0x7451bd,'progress':_0x2cdae3});return{'content':[{'type':_0x48d347(0xd1),'text':JSON[_0x48d347(0xf6)](_0x2b5932)}]};}if(_0x557927===_0x48d347(0x79)){let {alias:_0xe02bf2,task:_0x97c14d,priority:_0x1e3cc3}=_0x136c45,_0xbb6c47=await P('send_task',{'alias':_0xe02bf2,'task':_0x97c14d,'priority':_0x1e3cc3||_0x48d347(0xf5),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x48d347(0xf6)](_0xbb6c47)}]};}if(_0x557927===_0x48d347(0x8f)){let {alias:_0xa8d992,message:_0x57d7a5}=_0x136c45,_0x46c756=await P(_0x48d347(0xff),{'alias':_0xa8d992,'message':_0x57d7a5,'from_session':Z});return{'content':[{'type':_0x48d347(0xd1),'text':JSON['stringify'](_0x46c756)}]};}if(_0x557927===_0x48d347(0xb4)){let _0x484a88=await P(_0x48d347(0xb5),{});return{'content':[{'type':'text','text':JSON[_0x48d347(0xf6)](_0x484a88)}]};}return{'content':[{'type':_0x48d347(0xd1),'text':JSON[_0x48d347(0xf6)]({'error':_0x48d347(0x93)})}]};});async function u(){const _0x3916b3=a0_0x3239df;let _0x52f3b0=f+'/events/'+encodeURIComponent(Z),_0x9fb352={};if(X)_0x9fb352[_0x3916b3(0x87)]=_0x3916b3(0xcd)+X;Y('connecting\x20to\x20'+_0x52f3b0);while(!0x0){try{let _0x40f540=await fetch(_0x52f3b0,{'headers':_0x9fb352});if(!_0x40f540['ok']){Y(_0x3916b3(0xf8)+_0x40f540[_0x3916b3(0xac)]+'\x20'+_0x40f540['statusText']),await h(0x1388);continue;}let _0x185d4b=_0x40f540[_0x3916b3(0xe6)][_0x3916b3(0x78)](),_0x468141=new TextDecoder(),_0x1e5b3c='';while(!0x0){let {done:_0x301665,value:_0x5bcf82}=await _0x185d4b['read']();if(_0x301665)break;_0x1e5b3c+=_0x468141[_0x3916b3(0x104)](_0x5bcf82,{'stream':!0x0});let _0x912117=_0x1e5b3c[_0x3916b3(0x86)]('\x0a\x0a');_0x1e5b3c=_0x912117[_0x3916b3(0xd7)]()||'';for(let _0x381e01 of _0x912117){let _0x132fe2=_0x381e01[_0x3916b3(0x86)]('\x0a')[_0x3916b3(0xef)](_0x23fad3=>_0x23fad3['startsWith']('data:\x20'));if(!_0x132fe2)continue;try{let _0x32762a=JSON['parse'](_0x132fe2[_0x3916b3(0xcb)](0x6));await S(_0x32762a);}catch(_0x33d293){Y(_0x3916b3(0x7e)+_0x33d293);}}}Y(_0x3916b3(0xae));}catch(_0x48fec8){Y('SSE\x20connection\x20error:\x20'+_0x48fec8);}await h(0xbb8);}}function a0_0x2066(_0x40d1c4,_0x2047ff){_0x40d1c4=_0x40d1c4-0x78;const _0x441b88=a0_0x441b();let _0x2066c5=_0x441b88[_0x40d1c4];return _0x2066c5;}async function S(_0x1546ec){const _0x6994a8=a0_0x3239df;if(_0x1546ec[_0x6994a8(0x9a)]===_0x6994a8(0xaa)){Y(_0x6994a8(0x101)+Z+'\x22');return;}if(_0x1546ec[_0x6994a8(0x9a)]==='new_message'){if(Y(_0x6994a8(0x82)+_0x1546ec[_0x6994a8(0xb3)]+':\x20'+_0x1546ec[_0x6994a8(0xd3)]['slice'](0x0,0x3c)),await K['notification']({'method':'notifications/claude/channel','params':{'content':_0x1546ec['message'],'meta':{'sender':_0x1546ec['from']||_0x6994a8(0x103),'sender_id':_0x6994a8(0xb9),'user':_0x1546ec[_0x6994a8(0xb3)]||_0x6994a8(0x103),'priority':'normal'}}}),_0x1546ec[_0x6994a8(0xc8)])await P(_0x6994a8(0xfe),{'alias':Z,'message_id':_0x1546ec[_0x6994a8(0xc8)]});return;}if(_0x1546ec['type']==='new_task'||_0x1546ec[_0x6994a8(0x9a)]===_0x6994a8(0xf7)){Y('←\x20'+_0x1546ec[_0x6994a8(0x9a)]+':\x20inbox_count='+_0x1546ec['inbox_count']+'\x20priority='+(_0x1546ec[_0x6994a8(0xe2)]||_0x6994a8(0xf5)));let _0x310a13=await P(_0x6994a8(0xa3),{'alias':Z,'limit':0x5});if(_0x310a13?.['ok']&&_0x310a13['messages']?.[_0x6994a8(0x7d)]>0x0)for(let _0x19bf89 of _0x310a13[_0x6994a8(0x9f)]){let _0x918acc={'sender':_0x19bf89[_0x6994a8(0x85)]||_0x6994a8(0x103),'sender_id':_0x6994a8(0xb9),'user':_0x19bf89['from_session']||'hub','task_id':_0x19bf89['id'],'priority':_0x19bf89[_0x6994a8(0xe2)]||'normal'};k[_0x6994a8(0xce)](_0x19bf89['id'],_0x19bf89[_0x6994a8(0x85)]||_0x6994a8(0x103)),await K[_0x6994a8(0xd0)]({'method':_0x6994a8(0x8c),'params':{'content':_0x19bf89[_0x6994a8(0x84)],'meta':_0x918acc}}),Y(_0x6994a8(0xa2)+_0x19bf89['id'][_0x6994a8(0xcb)](0x0,0x8)+_0x6994a8(0xdb)+_0x19bf89[_0x6994a8(0x85)]+':\x20'+_0x19bf89[_0x6994a8(0x84)]['slice'](0x0,0x3c)),await P(_0x6994a8(0xfe),{'alias':Z,'message_id':_0x19bf89['id']});}}}async function A(){const _0x43e3b8=a0_0x3239df;let _0x591fd6=new a0_0x322fa5();await K['connect'](_0x591fd6),Y(_0x43e3b8(0x9d)),Y(_0x43e3b8(0x7c)),u()[_0x43e3b8(0xfa)](_0x580236=>Y(_0x43e3b8(0x89)+_0x580236)),P(_0x43e3b8(0x8e),{'resume_id':w,'alias':Z,'status':_0x43e3b8(0xa6),'server':a0_0x48d882(),'hostname':a0_0x48d882(),'agent':'claude-code','project_dir':process[_0x43e3b8(0xcc)](),'tmux_name':j||void 0x0})[_0x43e3b8(0xc3)](()=>Y('registered\x20as\x20\x22'+Z+_0x43e3b8(0xb0)+w[_0x43e3b8(0xcb)](0x0,0x8)+')'))['catch'](_0x35e00f=>Y(_0x43e3b8(0x94)+_0x35e00f)),setInterval(()=>{const _0x54d784=_0x43e3b8;P(_0x54d784(0x8e),{'resume_id':w,'alias':Z,'status':_0x54d784(0xa6),'server':a0_0x48d882(),'hostname':a0_0x48d882(),'agent':_0x54d784(0xb8),'project_dir':process[_0x54d784(0xcc)](),'tmux_name':j||void 0x0})[_0x54d784(0xfa)](_0xf3b218=>Y(_0x54d784(0xf3)+_0xf3b218));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x3239df(0xfa)](_0x137969=>{const _0x556a30=a0_0x3239df;Y(_0x556a30(0xed)+_0x137969),process[_0x556a30(0xb1)](0x1);});async function N(){const _0x5290e6=a0_0x3239df;Y(_0x5290e6(0xc7)),await P(_0x5290e6(0x8e),{'resume_id':w,'alias':Z,'status':'error','task':_0x5290e6(0x98)})['catch'](()=>{}),process[_0x5290e6(0xb1)](0x0);}process['stdin']['on'](a0_0x3239df(0x7b),()=>N()),process['on'](a0_0x3239df(0xc5),()=>N()),process['on']('SIGINT',()=>N());
|
|
2
|
+
const a0_0x5426cb=a0_0x5867;(function(_0x3eac44,_0x31c121){const _0xb1c39b=a0_0x5867,_0x46a402=_0x3eac44();while(!![]){try{const _0x5b17a0=parseInt(_0xb1c39b(0x269))/0x1+parseInt(_0xb1c39b(0x256))/0x2*(parseInt(_0xb1c39b(0x1fa))/0x3)+-parseInt(_0xb1c39b(0x267))/0x4*(-parseInt(_0xb1c39b(0x1f0))/0x5)+-parseInt(_0xb1c39b(0x225))/0x6+parseInt(_0xb1c39b(0x25f))/0x7+-parseInt(_0xb1c39b(0x1e1))/0x8+-parseInt(_0xb1c39b(0x1e4))/0x9;if(_0x5b17a0===_0x31c121)break;else _0x46a402['push'](_0x46a402['shift']());}catch(_0x258a07){_0x46a402['push'](_0x46a402['shift']());}}}(a0_0x1b33,0xc4dcd));import{readFileSync as a0_0x5e1a22,existsSync as a0_0x27dc4c}from'fs';import{randomUUID as a0_0x68ff34}from'crypto';import{join as a0_0x1d5732}from'path';import{hostname as a0_0x171ac2}from'os';import{execSync as a0_0x25654c}from'child_process';import{Server as a0_0x2a2aae}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x5867(_0x38233f,_0xf45c0f){_0x38233f=_0x38233f-0x1df;const _0x1b3313=a0_0x1b33();let _0x586773=_0x1b3313[_0x38233f];return _0x586773;}import{StdioServerTransport as a0_0x58ce57}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x281aee,CallToolRequestSchema as a0_0x3401cc}from'@modelcontextprotocol/sdk/types.js';function p(_0x27de4d){const _0x515a16=a0_0x5867;if(!a0_0x27dc4c(_0x27de4d))return;for(let _0x250081 of a0_0x5e1a22(_0x27de4d,_0x515a16(0x217))[_0x515a16(0x1e6)]('\x0a')){let _0x2ef262=_0x250081[_0x515a16(0x209)]();if(!_0x2ef262||_0x2ef262[_0x515a16(0x255)]('#'))continue;let _0xcbf6f1=_0x2ef262[_0x515a16(0x1e2)]('=');if(_0xcbf6f1<0x0)continue;let _0x944f17=_0x2ef262['slice'](0x0,_0xcbf6f1)[_0x515a16(0x209)](),_0x5d5869=_0x2ef262[_0x515a16(0x25b)](_0xcbf6f1+0x1)[_0x515a16(0x209)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x944f17])process.env[_0x944f17]=_0x5d5869;}}var C=process.env.HOME||'~',T=a0_0x1d5732(C,a0_0x5426cb(0x235));p(a0_0x1d5732(T,a0_0x5426cb(0x24b)));var L=process['cwd']()[a0_0x5426cb(0x22d)](/\//g,'-');p(a0_0x1d5732(T,L,a0_0x5426cb(0x24b)));function U(){const _0xa1f99=a0_0x5426cb;try{return a0_0x25654c(_0xa1f99(0x238),{'encoding':_0xa1f99(0x217),'timeout':0x7d0})['trim']();}catch{return'';}}function v(){const _0x2b3543=a0_0x5426cb;try{let _0x5163e3=a0_0x1d5732(C,_0x2b3543(0x254),'config.json');if(a0_0x27dc4c(_0x5163e3))return JSON[_0x2b3543(0x226)](a0_0x5e1a22(_0x5163e3,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x5426cb(0x1ec)]||a0_0x5426cb(0x23a),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x171ac2(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x68ff34(),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x32cc8f){const _0x351ca4=a0_0x5426cb;let _0x2c5313=new Date()['toTimeString']()[_0x351ca4(0x25b)](0x0,0x8);process[_0x351ca4(0x26a)]['write']('['+_0x2c5313+_0x351ca4(0x1f4)+_0x32cc8f+'\x0a');}function h(_0x4ec703){return new Promise(_0x2795e1=>setTimeout(_0x2795e1,_0x4ec703));}Y('ENV:\x20URL='+f+a0_0x5426cb(0x218)+Z+'\x20RESUME_ID='+w['slice'](0x0,0x8)+a0_0x5426cb(0x253)+(j||a0_0x5426cb(0x216))+a0_0x5426cb(0x206)+process[a0_0x5426cb(0x22b)]()+a0_0x5426cb(0x1ee)+L);var k=new Map(),K=new a0_0x2a2aae({'name':a0_0x5426cb(0x1eb),'version':a0_0x5426cb(0x1ef)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x5426cb(0x265),a0_0x5426cb(0x20c),a0_0x5426cb(0x250),a0_0x5426cb(0x24e),a0_0x5426cb(0x259)+Z][a0_0x5426cb(0x234)]('\x0a')});K[a0_0x5426cb(0x241)](a0_0x281aee,async()=>({'tools':[{'name':a0_0x5426cb(0x1f8),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x5426cb(0x21f),'properties':{'task_id':{'type':a0_0x5426cb(0x1f2),'description':a0_0x5426cb(0x203)},'text':{'type':a0_0x5426cb(0x1f2),'description':a0_0x5426cb(0x213)},'status':{'type':'string','enum':[a0_0x5426cb(0x236),a0_0x5426cb(0x20e),'cancelled',a0_0x5426cb(0x262),a0_0x5426cb(0x23e),a0_0x5426cb(0x230)],'description':a0_0x5426cb(0x242)}},'required':[a0_0x5426cb(0x261)]}},{'name':a0_0x5426cb(0x1e5),'description':a0_0x5426cb(0x20f),'inputSchema':{'type':'object','properties':{'status':{'type':'string','enum':[a0_0x5426cb(0x221),'idle','blocked',a0_0x5426cb(0x23e)]},'task':{'type':a0_0x5426cb(0x1f2),'description':'Current\x20task\x20description'},'progress':{'type':'number','description':a0_0x5426cb(0x219)}},'required':['status']}},{'name':a0_0x5426cb(0x266),'description':a0_0x5426cb(0x1e3),'inputSchema':{'type':a0_0x5426cb(0x21f),'properties':{'alias':{'type':'string','description':a0_0x5426cb(0x268)},'task':{'type':'string','description':a0_0x5426cb(0x248)},'priority':{'type':a0_0x5426cb(0x1f2),'enum':['high',a0_0x5426cb(0x243),a0_0x5426cb(0x21a)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x5426cb(0x21c),'task']}},{'name':a0_0x5426cb(0x23b),'description':a0_0x5426cb(0x252),'inputSchema':{'type':'object','properties':{'alias':{'type':'string','description':a0_0x5426cb(0x268)},'message':{'type':'string','description':a0_0x5426cb(0x237)}},'required':['alias',a0_0x5426cb(0x223)]}},{'name':a0_0x5426cb(0x247),'description':a0_0x5426cb(0x21e),'inputSchema':{'type':a0_0x5426cb(0x21f),'properties':{}}}]}));async function P(_0x387f7b,_0x148d9e){const _0x41b9cc=a0_0x5426cb;let _0x35de6c=await fetch(f+_0x41b9cc(0x23f),{'method':'POST','headers':{'Content-Type':_0x41b9cc(0x1f1),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x41b9cc(0x22e)]({'jsonrpc':_0x41b9cc(0x263),'id':0x1,'method':_0x41b9cc(0x25d),'params':{'protocolVersion':_0x41b9cc(0x200),'capabilities':{},'clientInfo':{'name':_0x41b9cc(0x1eb),'version':'0.3.0'}}})});if(!_0x35de6c['ok']){let _0x2de668=await _0x35de6c['text']();return Y(_0x41b9cc(0x212)+_0x35de6c[_0x41b9cc(0x24a)]+'\x20'+_0x2de668[_0x41b9cc(0x25b)](0x0,0x64)),{'ok':!0x1,'error':_0x41b9cc(0x20b)+_0x35de6c[_0x41b9cc(0x24a)]};}await _0x35de6c[_0x41b9cc(0x261)]();let _0x126755=(await(await fetch(f+_0x41b9cc(0x23f),{'method':_0x41b9cc(0x1f7),'headers':{'Content-Type':_0x41b9cc(0x1f1),'Accept':_0x41b9cc(0x1fc),...X?{'Authorization':_0x41b9cc(0x214)+X}:{}},'body':JSON[_0x41b9cc(0x22e)]({'jsonrpc':_0x41b9cc(0x263),'id':0x2,'method':_0x41b9cc(0x1fd),'params':{'name':_0x387f7b,'arguments':_0x148d9e}})}))[_0x41b9cc(0x261)]())[_0x41b9cc(0x1e6)]('\x0a')[_0x41b9cc(0x1fb)](_0x5f6192=>_0x5f6192['startsWith'](_0x41b9cc(0x264)));if(_0x126755){let _0x438036=JSON[_0x41b9cc(0x226)](_0x126755[_0x41b9cc(0x25b)](0x6));return _0x438036?.[_0x41b9cc(0x1ed)]?.[_0x41b9cc(0x231)]?.[0x0]?.[_0x41b9cc(0x261)]?JSON[_0x41b9cc(0x226)](_0x438036[_0x41b9cc(0x1ed)]['content'][0x0]['text']):_0x438036;}return{'ok':!0x1,'error':_0x41b9cc(0x1e9)};}K[a0_0x5426cb(0x241)](a0_0x3401cc,async _0x237f87=>{const _0x78f058=a0_0x5426cb;let {name:_0x4b2118,arguments:_0x1855ba}=_0x237f87[_0x78f058(0x202)];if(_0x4b2118===_0x78f058(0x1f8)){let {task_id:_0x1e08c5,text:_0x591cfa,status:_0x229e09}=_0x1855ba;if(_0x229e09===_0x78f058(0x236)||_0x229e09==='failed'||_0x229e09===_0x78f058(0x1ff)){let _0x8d6d58=_0x229e09===_0x78f058(0x236)?_0x78f058(0x24d):_0x229e09,_0xbbc2d9=_0x1e08c5?k[_0x78f058(0x21d)](_0x1e08c5)||_0x78f058(0x1ec):_0x78f058(0x1ec),_0x430f41=await P(_0x78f058(0x246),{'alias':_0xbbc2d9,'text':_0x591cfa,'in_reply_to':_0x1e08c5||void 0x0,'status':_0x8d6d58,'from_session':Z});if(_0x1e08c5)k[_0x78f058(0x204)](_0x1e08c5);return{'content':[{'type':_0x78f058(0x261),'text':JSON[_0x78f058(0x22e)](_0x430f41)}]};}let _0xe92c87=await P(_0x78f058(0x22a),{'resume_id':w,'alias':Z,'status':_0x229e09==='blocked'?'blocked':_0x229e09==='error'?'error':_0x78f058(0x221),'task':_0x591cfa[_0x78f058(0x25b)](0x0,0xc8),'output':_0x591cfa});return{'content':[{'type':_0x78f058(0x261),'text':JSON[_0x78f058(0x22e)](_0xe92c87)}]};}if(_0x4b2118==='commhub_report_status'){let {status:_0xe04031,task:_0xacbf8d,progress:_0xc4a56a}=_0x1855ba,_0x15eab7=await P(_0x78f058(0x22a),{'resume_id':w,'alias':Z,'status':_0xe04031,'task':_0xacbf8d,'progress':_0xc4a56a});return{'content':[{'type':_0x78f058(0x261),'text':JSON[_0x78f058(0x22e)](_0x15eab7)}]};}if(_0x4b2118==='commhub_send_task'){let {alias:_0x18a8a4,task:_0x411016,priority:_0x3b006b}=_0x1855ba,_0x5b1c6f=await P(_0x78f058(0x25a),{'alias':_0x18a8a4,'task':_0x411016,'priority':_0x3b006b||'normal','from_session':Z});return{'content':[{'type':_0x78f058(0x261),'text':JSON[_0x78f058(0x22e)](_0x5b1c6f)}]};}if(_0x4b2118===_0x78f058(0x23b)){let {alias:_0x34256a,message:_0xe512f2}=_0x1855ba,_0x26b67b=await P(_0x78f058(0x25e),{'alias':_0x34256a,'message':_0xe512f2,'from_session':Z});return{'content':[{'type':_0x78f058(0x261),'text':JSON[_0x78f058(0x22e)](_0x26b67b)}]};}if(_0x4b2118===_0x78f058(0x247)){let _0x1ace3f=await P(_0x78f058(0x1fe),{});return{'content':[{'type':_0x78f058(0x261),'text':JSON[_0x78f058(0x22e)](_0x1ace3f)}]};}return{'content':[{'type':_0x78f058(0x261),'text':JSON[_0x78f058(0x22e)]({'error':_0x78f058(0x244)})}]};});async function u(){const _0x2b82df=a0_0x5426cb;let _0x4c6bc5=f+_0x2b82df(0x23d)+encodeURIComponent(Z),_0x5c9fb0={};if(X)_0x5c9fb0[_0x2b82df(0x25c)]=_0x2b82df(0x214)+X;Y(_0x2b82df(0x20d)+_0x4c6bc5);while(!0x0){try{let _0x17eb52=await fetch(_0x4c6bc5,{'headers':_0x5c9fb0});if(!_0x17eb52['ok']){Y(_0x2b82df(0x1f6)+_0x17eb52[_0x2b82df(0x24a)]+'\x20'+_0x17eb52['statusText']),await h(0x1388);continue;}let _0x4611a6=_0x17eb52[_0x2b82df(0x23c)]['getReader'](),_0x37f829=new TextDecoder(),_0x58d942='';while(!0x0){let {done:_0x1fb04c,value:_0x4f0b92}=await _0x4611a6[_0x2b82df(0x26b)]();if(_0x1fb04c)break;_0x58d942+=_0x37f829['decode'](_0x4f0b92,{'stream':!0x0});let _0x4be363=_0x58d942[_0x2b82df(0x1e6)]('\x0a\x0a');_0x58d942=_0x4be363[_0x2b82df(0x215)]()||'';for(let _0x5c06ba of _0x4be363){let _0x1a1a0a=_0x5c06ba[_0x2b82df(0x1e6)]('\x0a')[_0x2b82df(0x1fb)](_0x5295cb=>_0x5295cb[_0x2b82df(0x255)](_0x2b82df(0x264)));if(!_0x1a1a0a)continue;try{let _0x107eb3=JSON[_0x2b82df(0x226)](_0x1a1a0a[_0x2b82df(0x25b)](0x6));await S(_0x107eb3);}catch(_0x3a02d4){Y(_0x2b82df(0x22c)+_0x3a02d4);}}}Y(_0x2b82df(0x1f9));}catch(_0x162976){Y(_0x2b82df(0x1f3)+_0x162976);}await h(0xbb8);}}async function S(_0x266872){const _0x44f447=a0_0x5426cb;if(_0x266872[_0x44f447(0x222)]==='connected'){Y(_0x44f447(0x257)+Z+'\x22');return;}if(_0x266872['type']==='new_message'){if(Y(_0x44f447(0x260)+_0x266872['from']+':\x20'+_0x266872[_0x44f447(0x223)][_0x44f447(0x25b)](0x0,0x3c)),await K[_0x44f447(0x210)]({'method':'notifications/claude/channel','params':{'content':_0x266872['message'],'meta':{'sender':_0x266872['from']||_0x44f447(0x1ec),'sender_id':'commhub','user':_0x266872['from']||_0x44f447(0x1ec),'priority':_0x44f447(0x243)}}}),_0x266872[_0x44f447(0x20a)])await P(_0x44f447(0x207),{'alias':Z,'message_id':_0x266872[_0x44f447(0x20a)]});return;}if(_0x266872[_0x44f447(0x222)]===_0x44f447(0x1e7)||_0x266872['type']===_0x44f447(0x22f)){Y('←\x20'+_0x266872[_0x44f447(0x222)]+_0x44f447(0x240)+_0x266872[_0x44f447(0x205)]+_0x44f447(0x24c)+(_0x266872[_0x44f447(0x249)]||'normal'));let _0xe7f3bd=await P(_0x44f447(0x227),{'alias':Z,'limit':0x5});if(_0xe7f3bd?.['ok']&&_0xe7f3bd[_0x44f447(0x220)]?.[_0x44f447(0x258)]>0x0)for(let _0x5703b6 of _0xe7f3bd[_0x44f447(0x220)]){let _0x3dfb18={'sender':_0x5703b6[_0x44f447(0x229)]||_0x44f447(0x1ec),'sender_id':'commhub','user':_0x5703b6['from_session']||'hub','task_id':_0x5703b6['id'],'priority':_0x5703b6[_0x44f447(0x249)]||_0x44f447(0x243)};k[_0x44f447(0x201)](_0x5703b6['id'],_0x5703b6[_0x44f447(0x229)]||_0x44f447(0x1ec)),await K['notification']({'method':_0x44f447(0x233),'params':{'content':_0x5703b6[_0x44f447(0x231)],'meta':_0x3dfb18}}),Y(_0x44f447(0x232)+_0x5703b6['id'][_0x44f447(0x25b)](0x0,0x8)+_0x44f447(0x1e0)+_0x5703b6[_0x44f447(0x229)]+':\x20'+_0x5703b6[_0x44f447(0x231)][_0x44f447(0x25b)](0x0,0x3c)),await P(_0x44f447(0x207),{'alias':Z,'message_id':_0x5703b6['id']});}}}async function A(){const _0x290db9=a0_0x5426cb;let _0x59d612=new a0_0x58ce57();await K[_0x290db9(0x24f)](_0x59d612),Y('MCP\x20stdio\x20connected'),Y(_0x290db9(0x251)),u()[_0x290db9(0x245)](_0x5b409c=>Y(_0x290db9(0x211)+_0x5b409c)),P('report_status',{'resume_id':w,'alias':Z,'status':_0x290db9(0x1ea),'server':a0_0x171ac2(),'hostname':a0_0x171ac2(),'agent':_0x290db9(0x1df),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x290db9(0x239)](()=>Y(_0x290db9(0x224)+Z+'\x22\x20('+w[_0x290db9(0x25b)](0x0,0x8)+')'))[_0x290db9(0x245)](_0x4277e7=>Y(_0x290db9(0x208)+_0x4277e7)),setInterval(()=>{const _0x545132=_0x290db9;P(_0x545132(0x22a),{'resume_id':w,'alias':Z,'status':_0x545132(0x1ea),'server':a0_0x171ac2(),'hostname':a0_0x171ac2(),'agent':_0x545132(0x1df),'project_dir':process[_0x545132(0x22b)](),'tmux_name':j||void 0x0})[_0x545132(0x245)](_0x4f8b25=>Y('heartbeat\x20failed:\x20'+_0x4f8b25));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x5426cb(0x245)](_0x250919=>{const _0x5424fb=a0_0x5426cb;Y(_0x5424fb(0x228)+_0x250919),process[_0x5424fb(0x1f5)](0x1);});async function N(){const _0x4174e5=a0_0x5426cb;Y('shutting\x20down,\x20reporting\x20offline...'),await P('report_status',{'resume_id':w,'alias':Z,'status':'error','task':'session\x20disconnected'})[_0x4174e5(0x245)](()=>{}),process['exit'](0x0);}process[a0_0x5426cb(0x21b)]['on'](a0_0x5426cb(0x1e8),()=>N()),process['on']('SIGTERM',()=>N()),process['on']('SIGINT',()=>N());function a0_0x1b33(){const _0x205916=['params','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','delete','inbox_count','\x20CWD=','ack_inbox','warning:\x20could\x20not\x20register:\x20','trim','message_id','init\x20failed:\x20','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','connecting\x20to\x20','failed','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','notification','SSE\x20fatal:\x20','CommHub\x20init\x20failed:\x20','Reply\x20text\x20/\x20result\x20summary','Bearer\x20','pop','none','utf-8','\x20ALIAS=','Progress\x200-100','low','stdin','alias','get','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','object','messages','working','type','message','registered\x20as\x20\x22','6025416CElYfd','parse','get_inbox','fatal:\x20','from_session','report_status','cwd','parse\x20error:\x20','replace','stringify','broadcast','in_progress','content','→\x20injected\x20task\x20','notifications/claude/channel','join','.claude/channels/commhub','completed','Message\x20content','tmux\x20display-message\x20-p\x20\x27#S\x27','then','http://127.0.0.1:9200','commhub_send_message','body','/events/','error','/mcp',':\x20inbox_count=','setRequestHandler','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','normal','unknown\x20tool','catch','send_reply','commhub_get_all_status','Task\x20content','priority','status','.env','\x20priority=','replied','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','connect','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','starting\x20SSE\x20listener...','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','...\x20TMUX=','.anet','startsWith','299494qvSbfA','SSE\x20connected\x20as\x20\x22','length','Session\x20alias:\x20','send_task','slice','Authorization','initialize','send_message','8475390Smldfp','←\x20message\x20from\x20','text','blocked','2.0','data:\x20','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','commhub_send_task','31604gvAmQv','Target\x20session\x20alias','976368VTbSTj','stderr','read','claude-code','\x20from\x20','8155184iHSPep','indexOf','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','3015171YzLSBv','commhub_report_status','split','new_task','end','no\x20response','idle','commhub-channel','hub','result','\x20PROJECT_ENV=','0.3.0','145MoobzY','application/json','string','SSE\x20connection\x20error:\x20',']\x20[commhub]\x20','exit','SSE\x20error:\x20','POST','commhub_reply','SSE\x20stream\x20ended,\x20reconnecting...','15wRbJKl','find','application/json,\x20text/event-stream','tools/call','get_all_status','cancelled','2025-03-26','set'];a0_0x1b33=function(){return _0x205916;};return a0_0x1b33();}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "AI Agent Network CLI — 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",
|