@sleep2agi/agent-network 2.1.10-preview.0 → 2.1.12-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_0x550ebc=a0_0x4806;function a0_0x5523(){const _0x506683=['7OrRNcI','2.0','catch','min','s...','heartbeat\x20failed:\x20','heartbeatInterval','match','toString','Authorization','application/json,\x20text/event-stream','heartbeatTimer','content','sdk','text/event-stream','get_inbox','/events/','data:\x20','sleep','slice','disconnect','log','decode','call','9iEyNAH','agent','read','Bearer\x20','url','message','processInbox','parse','token','startsWith','499938lSSjJW','200712iMaKWJ','/mcp','name','broadcast','sdk-','connect','text','report_status','body','new_task','signal','type','2522930RpQfzM','running','now','pop','send_reply','emit','split','inbox\x20error:\x20','connectSSE','SSE\x20error:\x20','disconnected','337375rsqOZz','tools/call','from_session','sseAbort','9KEKbBk','1868880ARIalz','toTimeString','reply','alias','autoConnect','POST','messages','ack_inbox',']\x20[commhub:','reconnectDelay','connected','offline','new_message','69268UipxrA','getReader','2011976SlVtOR','resumeId','SSE\x20failed:\x20','send_task','registered','status','application/json','SSE\x20connected'];a0_0x5523=function(){return _0x506683;};return a0_0x5523();}(function(_0x4a8dea,_0x4d5140){const _0x10a9a4=a0_0x4806,_0x32b7bb=_0x4a8dea();while(!![]){try{const _0x3b62f4=parseInt(_0x10a9a4(0x8d))/0x1+parseInt(_0x10a9a4(0x76))/0x2+-parseInt(_0x10a9a4(0xc1))/0x3*(-parseInt(_0x10a9a4(0x9f))/0x4)+-parseInt(_0x10a9a4(0x92))/0x5+parseInt(_0x10a9a4(0x75))/0x6*(parseInt(_0x10a9a4(0xa9))/0x7)+parseInt(_0x10a9a4(0xa1))/0x8*(parseInt(_0x10a9a4(0x91))/0x9)+-parseInt(_0x10a9a4(0x82))/0xa;if(_0x3b62f4===_0x4d5140)break;else _0x32b7bb['push'](_0x32b7bb['shift']());}catch(_0x274ec2){_0x32b7bb['push'](_0x32b7bb['shift']());}}}(a0_0x5523,0x30721));import{EventEmitter as a0_0x36312f}from'events';function a0_0x4806(_0x4a0f13,_0x1c5530){_0x4a0f13=_0x4a0f13-0x70;const _0x5523f2=a0_0x5523();let _0x4806b9=_0x5523f2[_0x4a0f13];return _0x4806b9;}import{hostname as a0_0x20f246}from'os';class T extends a0_0x36312f{[a0_0x550ebc(0xc5)];[a0_0x550ebc(0x95)];['token'];['agent'];[a0_0x550ebc(0xa2)];['heartbeatInterval'];[a0_0x550ebc(0x9b)];[a0_0x550ebc(0xb4)];[a0_0x550ebc(0x90)];[a0_0x550ebc(0x83)]=!0x1;constructor(_0xd46b74){const _0x1a0084=a0_0x550ebc;super();if(this['url']=_0xd46b74[_0x1a0084(0xc5)]['replace'](/\/$/,''),this[_0x1a0084(0x95)]=_0xd46b74['alias'],this[_0x1a0084(0x73)]=_0xd46b74['token'],this[_0x1a0084(0xc2)]=_0xd46b74['agent']||_0x1a0084(0xb6),this[_0x1a0084(0xa2)]=_0x1a0084(0x7a)+_0xd46b74[_0x1a0084(0x95)]+'-'+Date['now']()[_0x1a0084(0xb1)](0x24),this[_0x1a0084(0xaf)]=_0xd46b74['heartbeatInterval']??0x2bf20,this[_0x1a0084(0x9b)]=_0xd46b74['reconnectDelay']??0xbb8,_0xd46b74[_0x1a0084(0x96)]!==!0x1)this[_0x1a0084(0x7b)]();}[a0_0x550ebc(0xbe)](_0x654a2c){const _0x3dacc6=a0_0x550ebc;console[_0x3dacc6(0xbe)]('['+new Date()[_0x3dacc6(0x93)]()['slice'](0x0,0x8)+_0x3dacc6(0x9a)+this[_0x3dacc6(0x95)]+']\x20'+_0x654a2c);}async[a0_0x550ebc(0xc0)](_0x2192f8,_0x5ed30c){const _0xae711c=a0_0x550ebc;let _0x412115={'Content-Type':_0xae711c(0xa7),'Accept':_0xae711c(0xb3)};if(this[_0xae711c(0x73)])_0x412115['Authorization']='Bearer\x20'+this['token'];let _0x160417=await(await fetch(this[_0xae711c(0xc5)]+_0xae711c(0x77),{'method':_0xae711c(0x97),'headers':_0x412115,'body':JSON['stringify']({'jsonrpc':_0xae711c(0xaa),'id':Date[_0xae711c(0x84)](),'method':_0xae711c(0x8e),'params':{'name':_0x2192f8,'arguments':_0x5ed30c}})}))[_0xae711c(0x7c)](),_0x209303=_0x160417[_0xae711c(0xb0)](/data: (.+)/),_0x23dd7d=_0x209303?JSON[_0xae711c(0x72)](_0x209303[0x1]):JSON[_0xae711c(0x72)](_0x160417),_0x516e52=_0x23dd7d?.['result']?.[_0xae711c(0xb5)]?.[0x0]?.[_0xae711c(0x7c)];return _0x516e52?JSON[_0xae711c(0x72)](_0x516e52):_0x23dd7d;}async['connect'](){const _0x12de6f=a0_0x550ebc;if(this[_0x12de6f(0x83)])return;this[_0x12de6f(0x83)]=!0x0,await this[_0x12de6f(0xa6)]('idle'),this[_0x12de6f(0xbe)](_0x12de6f(0xa5)),this[_0x12de6f(0xb4)]=setInterval(()=>{const _0x4c0b1f=_0x12de6f;this[_0x4c0b1f(0xa6)]('idle')[_0x4c0b1f(0xab)](_0x20d220=>this['log'](_0x4c0b1f(0xae)+_0x20d220[_0x4c0b1f(0x70)]));},this['heartbeatInterval']),this[_0x12de6f(0x8a)]();}async[a0_0x550ebc(0xbd)](){const _0xc1ce93=a0_0x550ebc;if(this['running']=!0x1,this[_0xc1ce93(0x90)]?.['abort'](),this['heartbeatTimer'])clearInterval(this[_0xc1ce93(0xb4)]);await this[_0xc1ce93(0xa6)](_0xc1ce93(0x9d))[_0xc1ce93(0xab)](()=>{}),this[_0xc1ce93(0xbe)](_0xc1ce93(0x8c));}async['send'](_0x15d405,_0x544f51,_0x1d7c0d='normal'){const _0x5389cc=a0_0x550ebc;return this['call'](_0x5389cc(0xa4),{'alias':_0x15d405,'task':_0x544f51,'priority':_0x1d7c0d,'from_session':this[_0x5389cc(0x95)]});}async[a0_0x550ebc(0x70)](_0x42d2aa,_0x123f52){const _0x3ecb19=a0_0x550ebc;return this['call']('send_message',{'alias':_0x42d2aa,'message':_0x123f52,'from_session':this[_0x3ecb19(0x95)]});}async[a0_0x550ebc(0x94)](_0x3006b7,_0x28a585,_0xb4a28f='completed'){const _0x48610f=a0_0x550ebc;return this['call'](_0x48610f(0x86),{'in_reply_to':_0x3006b7,'text':_0x28a585,'status':_0xb4a28f});}async[a0_0x550ebc(0xa6)](_0x40846e,_0x3593d8){const _0x209999=a0_0x550ebc;return this[_0x209999(0xc0)](_0x209999(0x7d),{'resume_id':this[_0x209999(0xa2)],'alias':this[_0x209999(0x95)],'status':_0x40846e,'server':a0_0x20f246(),'hostname':a0_0x20f246(),'agent':this['agent'],'project_dir':process['cwd'](),..._0x3593d8});}async['getAllStatus'](){return this['call']('get_all_status',{});}async['broadcast'](_0x1d5c3f,_0x499d6d){const _0x46d672=a0_0x550ebc;return this[_0x46d672(0xc0)]('broadcast',{'message':_0x1d5c3f,'filter_server':_0x499d6d?.['server'],'filter_status':_0x499d6d?.[_0x46d672(0xa6)]});}async[a0_0x550ebc(0x8a)](){const _0x3fbc45=a0_0x550ebc;let _0x191487=encodeURIComponent(this[_0x3fbc45(0x95)]),_0xac551a=this['url']+_0x3fbc45(0xb9)+_0x191487,_0x5beeb3=this[_0x3fbc45(0x9b)];while(this['running']){try{this[_0x3fbc45(0x90)]=new AbortController();let _0x1e2b65={'Accept':_0x3fbc45(0xb7)};if(this[_0x3fbc45(0x73)])_0x1e2b65[_0x3fbc45(0xb2)]=_0x3fbc45(0xc4)+this['token'];let _0x4b46d7=await fetch(_0xac551a,{'headers':_0x1e2b65,'signal':this[_0x3fbc45(0x90)][_0x3fbc45(0x80)]});if(!_0x4b46d7['ok']||!_0x4b46d7[_0x3fbc45(0x7e)]){this['log'](_0x3fbc45(0xa3)+_0x4b46d7[_0x3fbc45(0xa6)]),await this[_0x3fbc45(0xbb)](_0x5beeb3),_0x5beeb3=Math[_0x3fbc45(0xac)](_0x5beeb3*1.5,0xea60);continue;}_0x5beeb3=this[_0x3fbc45(0x9b)];let _0x5826dc=_0x4b46d7[_0x3fbc45(0x7e)][_0x3fbc45(0xa0)](),_0x3a9e78=new TextDecoder(),_0x542b47='';while(this['running']){let {done:_0x182c1f,value:_0x5330bb}=await _0x5826dc[_0x3fbc45(0xc3)]();if(_0x182c1f)break;_0x542b47+=_0x3a9e78[_0x3fbc45(0xbf)](_0x5330bb,{'stream':!0x0});let _0x550521=_0x542b47[_0x3fbc45(0x88)]('\x0a');_0x542b47=_0x550521[_0x3fbc45(0x85)]()||'';for(let _0x2a118f of _0x550521){if(!_0x2a118f[_0x3fbc45(0x74)](_0x3fbc45(0xba)))continue;try{let _0x445877=JSON[_0x3fbc45(0x72)](_0x2a118f[_0x3fbc45(0xbc)](0x6));if(_0x445877[_0x3fbc45(0x81)]===_0x3fbc45(0x9c)){this[_0x3fbc45(0xbe)](_0x3fbc45(0xa8)),this[_0x3fbc45(0x87)]('connected');continue;}if(_0x445877[_0x3fbc45(0x81)]===_0x3fbc45(0x7f)||_0x445877[_0x3fbc45(0x81)]===_0x3fbc45(0x9e)||_0x445877[_0x3fbc45(0x81)]===_0x3fbc45(0x79))await this[_0x3fbc45(0x71)]();}catch{}}}}catch(_0x404870){if(_0x404870[_0x3fbc45(0x78)]==='AbortError')break;this[_0x3fbc45(0x87)]('error',_0x404870),this['log'](_0x3fbc45(0x8b)+_0x404870[_0x3fbc45(0x70)]);}if(this['running'])this[_0x3fbc45(0x87)]('disconnected'),this[_0x3fbc45(0xbe)]('SSE\x20reconnecting\x20in\x20'+_0x5beeb3/0x3e8+_0x3fbc45(0xad)),await this[_0x3fbc45(0xbb)](_0x5beeb3),_0x5beeb3=Math['min'](_0x5beeb3*1.5,0xea60);}}async['processInbox'](){const _0x4f3b21=a0_0x550ebc;try{let _0xb947c1=(await this[_0x4f3b21(0xc0)](_0x4f3b21(0xb8),{'alias':this[_0x4f3b21(0x95)],'limit':0xa}))?.[_0x4f3b21(0x98)]||[];for(let _0x5b1e2f of _0xb947c1)await this[_0x4f3b21(0xc0)](_0x4f3b21(0x99),{'alias':this[_0x4f3b21(0x95)],'message_id':_0x5b1e2f['id']}),this[_0x4f3b21(0xbe)]('←\x20'+_0x5b1e2f[_0x4f3b21(0x8f)]+':\x20'+_0x5b1e2f[_0x4f3b21(0xb5)][_0x4f3b21(0xbc)](0x0,0x3c)),this[_0x4f3b21(0x87)]('task',_0x5b1e2f),this[_0x4f3b21(0x87)](_0x4f3b21(0x70),_0x5b1e2f);}catch(_0x5bd976){this['log'](_0x4f3b21(0x89)+_0x5bd976[_0x4f3b21(0x70)]);}}['sleep'](_0x26489e){return new Promise(_0x182053=>setTimeout(_0x182053,_0x26489e));}}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_0x52bbdc=a0_0x250e;(function(_0x18ea8c,_0x39b332){const _0x34b338=a0_0x250e,_0x33e680=_0x18ea8c();while(!![]){try{const _0x351db6=-parseInt(_0x34b338(0x21d))/0x1+parseInt(_0x34b338(0x1eb))/0x2+-parseInt(_0x34b338(0x21f))/0x3*(-parseInt(_0x34b338(0x249))/0x4)+parseInt(_0x34b338(0x220))/0x5+-parseInt(_0x34b338(0x210))/0x6*(parseInt(_0x34b338(0x22d))/0x7)+-parseInt(_0x34b338(0x1ff))/0x8*(-parseInt(_0x34b338(0x20a))/0x9)+-parseInt(_0x34b338(0x213))/0xa*(parseInt(_0x34b338(0x236))/0xb);if(_0x351db6===_0x39b332)break;else _0x33e680['push'](_0x33e680['shift']());}catch(_0x1e73da){_0x33e680['push'](_0x33e680['shift']());}}}(a0_0x4f56,0x28096));import{readFileSync as a0_0x21a876,existsSync as a0_0x2c53d8}from'fs';import{randomUUID as a0_0x16f3a8}from'crypto';import{join as a0_0xacfc47}from'path';import{hostname as a0_0xbe43f3}from'os';import{execSync as a0_0x205802}from'child_process';import{Server as a0_0x30ee14}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x37debf}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x3e6577,CallToolRequestSchema as a0_0x53b3cc}from'@modelcontextprotocol/sdk/types.js';function p(_0xa95185){const _0x290b46=a0_0x250e;if(!a0_0x2c53d8(_0xa95185))return;for(let _0xfb91c4 of a0_0x21a876(_0xa95185,'utf-8')[_0x290b46(0x21b)]('\x0a')){let _0x37fd84=_0xfb91c4[_0x290b46(0x256)]();if(!_0x37fd84||_0x37fd84[_0x290b46(0x20f)]('#'))continue;let _0x4f711c=_0x37fd84['indexOf']('=');if(_0x4f711c<0x0)continue;let _0x4894c8=_0x37fd84['slice'](0x0,_0x4f711c)[_0x290b46(0x256)](),_0x4e6295=_0x37fd84[_0x290b46(0x1e4)](_0x4f711c+0x1)['trim']()[_0x290b46(0x1f1)](/^["']|["']$/g,'');if(!process.env[_0x4894c8])process.env[_0x4894c8]=_0x4e6295;}}var C=process.env.HOME||'~',T=a0_0xacfc47(C,'.claude/channels/commhub');p(a0_0xacfc47(T,a0_0x52bbdc(0x225)));var L=process[a0_0x52bbdc(0x22a)]()['replace'](/\//g,'-');p(a0_0xacfc47(T,L,'.env'));function U(){const _0x34674b=a0_0x52bbdc;try{return a0_0x205802(_0x34674b(0x1f0),{'encoding':_0x34674b(0x1e5),'timeout':0x7d0})[_0x34674b(0x256)]();}catch{return'';}}function v(){const _0x4862a2=a0_0x52bbdc;try{let _0xf66d5d=a0_0xacfc47(C,_0x4862a2(0x268),_0x4862a2(0x227));if(a0_0x2c53d8(_0xf66d5d))return JSON[_0x4862a2(0x1f3)](a0_0x21a876(_0xf66d5d,_0x4862a2(0x1e5)));}catch{}return{};}function a0_0x4f56(){const _0x58d00d=['connected',']\x20[commhub]\x20','Bearer\x20','commhub_send_message','claude-code','notification','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','\x20RESUME_ID=','2025-03-26','application/json,\x20text/event-stream','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','warning:\x20could\x20not\x20register:\x20','398488VBAzZa','end','type','Current\x20task\x20description','→\x20injected\x20task\x20','heartbeat\x20failed:\x20','low','unknown\x20tool','commhub_send_task','catch','join','idle','stdin','trim','from_session','working','priority','initialize','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','result','commhub','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','message','SIGINT','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','stringify','2.0','\x20priority=','normal','POST','send_task','.anet','content','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','setRequestHandler','...\x20TMUX=','connecting\x20to\x20','notifications/claude/channel','starting\x20SSE\x20listener...','Reply\x20text\x20/\x20result\x20summary','slice','utf-8','message_id','status','\x20PROJECT_ENV=','tools/call','\x22\x20(','303504IBpvee','statusText','report_status','SIGTERM','object','tmux\x20display-message\x20-p\x20\x27#S\x27','replace','CommHub\x20init\x20failed:\x20','parse','parse\x20error:\x20','token','commhub_reply','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','get','init\x20failed:\x20','high','task','session\x20disconnected','get_inbox','37616Ddxzsc','completed','Target\x20session\x20alias','Progress\x200-100','body','http://127.0.0.1:9200','application/json','ack_inbox','send_reply','broadcast','new_message','513oQZNRI','hub','fatal:\x20','SSE\x20stream\x20ended,\x20reconnecting...','Message\x20content','startsWith','164472mverKB','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','error','3571430anGwqD','\x20CWD=','get_all_status','pop','/mcp','stderr','Task\x20content','Authorization','split','then','154909VqKhwA','send_message','9whLSzN','61170sCCepQ','SSE\x20error:\x20','set','/events/','from','.env','data:\x20','config.json','0.3.0','blocked','cwd','write','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','14lvVsmv','find','commhub_get_all_status','cancelled','failed','string','shutting\x20down,\x20reporting\x20offline...','text','SSE\x20connection\x20error:\x20','11WFBVWi','length','exit','number','none','messages','replied'];a0_0x4f56=function(){return _0x58d00d;};return a0_0x4f56();}var H=v(),f=process.env.COMMHUB_URL||H['hub']||a0_0x52bbdc(0x204),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0xbe43f3(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x16f3a8(),X=process.env.COMMHUB_TOKEN||H[a0_0x52bbdc(0x1f5)]||'';function a0_0x250e(_0x2e29db,_0x1c3fdd){_0x2e29db=_0x2e29db-0x1de;const _0x4f56d4=a0_0x4f56();let _0x250e5f=_0x4f56d4[_0x2e29db];return _0x250e5f;}function Y(_0x3e0db6){const _0x4d9cdc=a0_0x52bbdc;let _0x11f1a1=new Date()['toTimeString']()['slice'](0x0,0x8);process[_0x4d9cdc(0x218)][_0x4d9cdc(0x22b)]('['+_0x11f1a1+_0x4d9cdc(0x23e)+_0x3e0db6+'\x0a');}function h(_0x52619e){return new Promise(_0x4deee9=>setTimeout(_0x4deee9,_0x52619e));}Y('ENV:\x20URL='+f+'\x20ALIAS='+Z+a0_0x52bbdc(0x244)+w['slice'](0x0,0x8)+a0_0x52bbdc(0x1df)+(j||a0_0x52bbdc(0x23a))+a0_0x52bbdc(0x214)+process[a0_0x52bbdc(0x22a)]()+a0_0x52bbdc(0x1e8)+L);var k=new Map(),K=new a0_0x30ee14({'name':'commhub-channel','version':a0_0x52bbdc(0x228)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x52bbdc(0x261),a0_0x52bbdc(0x25b),a0_0x52bbdc(0x247),a0_0x52bbdc(0x22c),'Session\x20alias:\x20'+Z][a0_0x52bbdc(0x253)]('\x0a')});K['setRequestHandler'](a0_0x3e6577,async()=>({'tools':[{'name':a0_0x52bbdc(0x1f6),'description':a0_0x52bbdc(0x211),'inputSchema':{'type':a0_0x52bbdc(0x1ef),'properties':{'task_id':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x243)},'text':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x1e3)},'status':{'type':a0_0x52bbdc(0x232),'enum':[a0_0x52bbdc(0x200),a0_0x52bbdc(0x231),'cancelled',a0_0x52bbdc(0x229),a0_0x52bbdc(0x212),'in_progress'],'description':a0_0x52bbdc(0x1f8)}},'required':[a0_0x52bbdc(0x234)]}},{'name':'commhub_report_status','description':a0_0x52bbdc(0x26a),'inputSchema':{'type':a0_0x52bbdc(0x1ef),'properties':{'status':{'type':a0_0x52bbdc(0x232),'enum':[a0_0x52bbdc(0x258),a0_0x52bbdc(0x254),a0_0x52bbdc(0x229),a0_0x52bbdc(0x212)]},'task':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x24c)},'progress':{'type':a0_0x52bbdc(0x239),'description':a0_0x52bbdc(0x202)}},'required':[a0_0x52bbdc(0x1e7)]}},{'name':a0_0x52bbdc(0x251),'description':a0_0x52bbdc(0x1f7),'inputSchema':{'type':a0_0x52bbdc(0x1ef),'properties':{'alias':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x201)},'task':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x219)},'priority':{'type':a0_0x52bbdc(0x232),'enum':[a0_0x52bbdc(0x1fb),'normal',a0_0x52bbdc(0x24f)],'description':'Priority\x20(default:\x20normal)'}},'required':['alias',a0_0x52bbdc(0x1fc)]}},{'name':a0_0x52bbdc(0x240),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x52bbdc(0x1ef),'properties':{'alias':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x201)},'message':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x20e)}},'required':['alias',a0_0x52bbdc(0x25f)]}},{'name':a0_0x52bbdc(0x22f),'description':a0_0x52bbdc(0x25e),'inputSchema':{'type':a0_0x52bbdc(0x1ef),'properties':{}}}]}));async function P(_0x4ee747,_0x3f61ac){const _0x2d26d3=a0_0x52bbdc;let _0x1db480=await fetch(f+_0x2d26d3(0x217),{'method':_0x2d26d3(0x266),'headers':{'Content-Type':_0x2d26d3(0x205),'Accept':_0x2d26d3(0x246),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x2d26d3(0x262)]({'jsonrpc':_0x2d26d3(0x263),'id':0x1,'method':_0x2d26d3(0x25a),'params':{'protocolVersion':_0x2d26d3(0x245),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x2d26d3(0x228)}}})});if(!_0x1db480['ok']){let _0x74db3a=await _0x1db480[_0x2d26d3(0x234)]();return Y(_0x2d26d3(0x1f2)+_0x1db480[_0x2d26d3(0x1e7)]+'\x20'+_0x74db3a[_0x2d26d3(0x1e4)](0x0,0x64)),{'ok':!0x1,'error':_0x2d26d3(0x1fa)+_0x1db480[_0x2d26d3(0x1e7)]};}await _0x1db480[_0x2d26d3(0x234)]();let _0x473466=(await(await fetch(f+_0x2d26d3(0x217),{'method':'POST','headers':{'Content-Type':_0x2d26d3(0x205),'Accept':_0x2d26d3(0x246),...X?{'Authorization':_0x2d26d3(0x23f)+X}:{}},'body':JSON[_0x2d26d3(0x262)]({'jsonrpc':_0x2d26d3(0x263),'id':0x2,'method':_0x2d26d3(0x1e9),'params':{'name':_0x4ee747,'arguments':_0x3f61ac}})}))[_0x2d26d3(0x234)]())[_0x2d26d3(0x21b)]('\x0a')[_0x2d26d3(0x22e)](_0x702a40=>_0x702a40['startsWith'](_0x2d26d3(0x226)));if(_0x473466){let _0x425675=JSON['parse'](_0x473466[_0x2d26d3(0x1e4)](0x6));return _0x425675?.[_0x2d26d3(0x25c)]?.[_0x2d26d3(0x269)]?.[0x0]?.[_0x2d26d3(0x234)]?JSON[_0x2d26d3(0x1f3)](_0x425675[_0x2d26d3(0x25c)][_0x2d26d3(0x269)][0x0][_0x2d26d3(0x234)]):_0x425675;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x52bbdc(0x1de)](a0_0x53b3cc,async _0x351ef0=>{const _0x6fef36=a0_0x52bbdc;let {name:_0x190361,arguments:_0x2f7355}=_0x351ef0['params'];if(_0x190361===_0x6fef36(0x1f6)){let {task_id:_0x1b3ec9,text:_0x56a23e,status:_0x386669}=_0x2f7355;if(_0x386669==='completed'||_0x386669===_0x6fef36(0x231)||_0x386669===_0x6fef36(0x230)){let _0x137a8e=_0x386669===_0x6fef36(0x200)?_0x6fef36(0x23c):_0x386669,_0x20fb1c=_0x1b3ec9?k[_0x6fef36(0x1f9)](_0x1b3ec9)||_0x6fef36(0x20b):_0x6fef36(0x20b),_0x26527e=await P(_0x6fef36(0x207),{'alias':_0x20fb1c,'text':_0x56a23e,'in_reply_to':_0x1b3ec9||void 0x0,'status':_0x137a8e,'from_session':Z});if(_0x1b3ec9)k['delete'](_0x1b3ec9);return{'content':[{'type':'text','text':JSON[_0x6fef36(0x262)](_0x26527e)}]};}let _0x80d99a=await P(_0x6fef36(0x1ed),{'resume_id':w,'alias':Z,'status':_0x386669===_0x6fef36(0x229)?_0x6fef36(0x229):_0x386669===_0x6fef36(0x212)?'error':_0x6fef36(0x258),'task':_0x56a23e[_0x6fef36(0x1e4)](0x0,0xc8),'output':_0x56a23e});return{'content':[{'type':_0x6fef36(0x234),'text':JSON['stringify'](_0x80d99a)}]};}if(_0x190361==='commhub_report_status'){let {status:_0x56103d,task:_0x177e8b,progress:_0x4213b1}=_0x2f7355,_0x2fa32f=await P(_0x6fef36(0x1ed),{'resume_id':w,'alias':Z,'status':_0x56103d,'task':_0x177e8b,'progress':_0x4213b1});return{'content':[{'type':_0x6fef36(0x234),'text':JSON[_0x6fef36(0x262)](_0x2fa32f)}]};}if(_0x190361===_0x6fef36(0x251)){let {alias:_0xe65640,task:_0x2a083d,priority:_0x33f281}=_0x2f7355,_0x369a69=await P(_0x6fef36(0x267),{'alias':_0xe65640,'task':_0x2a083d,'priority':_0x33f281||_0x6fef36(0x265),'from_session':Z});return{'content':[{'type':_0x6fef36(0x234),'text':JSON[_0x6fef36(0x262)](_0x369a69)}]};}if(_0x190361===_0x6fef36(0x240)){let {alias:_0x509e7c,message:_0x263b54}=_0x2f7355,_0x4d98f3=await P(_0x6fef36(0x21e),{'alias':_0x509e7c,'message':_0x263b54,'from_session':Z});return{'content':[{'type':_0x6fef36(0x234),'text':JSON[_0x6fef36(0x262)](_0x4d98f3)}]};}if(_0x190361===_0x6fef36(0x22f)){let _0x1affe5=await P(_0x6fef36(0x215),{});return{'content':[{'type':_0x6fef36(0x234),'text':JSON[_0x6fef36(0x262)](_0x1affe5)}]};}return{'content':[{'type':_0x6fef36(0x234),'text':JSON['stringify']({'error':_0x6fef36(0x250)})}]};});async function u(){const _0x31d8f=a0_0x52bbdc;let _0xfac32c=f+_0x31d8f(0x223)+encodeURIComponent(Z),_0x2404f4={};if(X)_0x2404f4[_0x31d8f(0x21a)]=_0x31d8f(0x23f)+X;Y(_0x31d8f(0x1e0)+_0xfac32c);while(!0x0){try{let _0x401695=await fetch(_0xfac32c,{'headers':_0x2404f4});if(!_0x401695['ok']){Y(_0x31d8f(0x221)+_0x401695[_0x31d8f(0x1e7)]+'\x20'+_0x401695[_0x31d8f(0x1ec)]),await h(0x1388);continue;}let _0x30f520=_0x401695[_0x31d8f(0x203)]['getReader'](),_0x2da09e=new TextDecoder(),_0x5a4313='';while(!0x0){let {done:_0x6aae45,value:_0xc53875}=await _0x30f520['read']();if(_0x6aae45)break;_0x5a4313+=_0x2da09e['decode'](_0xc53875,{'stream':!0x0});let _0x5ae5cf=_0x5a4313[_0x31d8f(0x21b)]('\x0a\x0a');_0x5a4313=_0x5ae5cf[_0x31d8f(0x216)]()||'';for(let _0x103939 of _0x5ae5cf){let _0x2b5ddd=_0x103939[_0x31d8f(0x21b)]('\x0a')[_0x31d8f(0x22e)](_0x1b0b1a=>_0x1b0b1a['startsWith'](_0x31d8f(0x226)));if(!_0x2b5ddd)continue;try{let _0x201a7d=JSON[_0x31d8f(0x1f3)](_0x2b5ddd[_0x31d8f(0x1e4)](0x6));await S(_0x201a7d);}catch(_0x4808c9){Y(_0x31d8f(0x1f4)+_0x4808c9);}}}Y(_0x31d8f(0x20d));}catch(_0x5c3b26){Y(_0x31d8f(0x235)+_0x5c3b26);}await h(0xbb8);}}async function S(_0x230ff0){const _0x166403=a0_0x52bbdc;if(_0x230ff0[_0x166403(0x24b)]===_0x166403(0x23d)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x230ff0['type']===_0x166403(0x209)){if(Y('←\x20message\x20from\x20'+_0x230ff0[_0x166403(0x224)]+':\x20'+_0x230ff0[_0x166403(0x25f)][_0x166403(0x1e4)](0x0,0x3c)),await K['notification']({'method':_0x166403(0x1e1),'params':{'content':_0x230ff0['message'],'meta':{'sender':_0x230ff0['from']||_0x166403(0x20b),'sender_id':_0x166403(0x25d),'user':_0x230ff0[_0x166403(0x224)]||_0x166403(0x20b),'priority':_0x166403(0x265)}}}),_0x230ff0[_0x166403(0x1e6)])await P(_0x166403(0x206),{'alias':Z,'message_id':_0x230ff0[_0x166403(0x1e6)]});return;}if(_0x230ff0[_0x166403(0x24b)]==='new_task'||_0x230ff0[_0x166403(0x24b)]===_0x166403(0x208)){Y('←\x20'+_0x230ff0['type']+':\x20inbox_count='+_0x230ff0['inbox_count']+_0x166403(0x264)+(_0x230ff0['priority']||_0x166403(0x265)));let _0x3f58e2=await P(_0x166403(0x1fe),{'alias':Z,'limit':0x5});if(_0x3f58e2?.['ok']&&_0x3f58e2[_0x166403(0x23b)]?.[_0x166403(0x237)]>0x0)for(let _0x38e1ab of _0x3f58e2['messages']){let _0x101c3c={'sender':_0x38e1ab[_0x166403(0x257)]||'hub','sender_id':_0x166403(0x25d),'user':_0x38e1ab[_0x166403(0x257)]||_0x166403(0x20b),'task_id':_0x38e1ab['id'],'priority':_0x38e1ab[_0x166403(0x259)]||_0x166403(0x265)};k[_0x166403(0x222)](_0x38e1ab['id'],_0x38e1ab[_0x166403(0x257)]||_0x166403(0x20b)),await K[_0x166403(0x242)]({'method':'notifications/claude/channel','params':{'content':_0x38e1ab[_0x166403(0x269)],'meta':_0x101c3c}}),Y(_0x166403(0x24d)+_0x38e1ab['id'][_0x166403(0x1e4)](0x0,0x8)+'\x20from\x20'+_0x38e1ab[_0x166403(0x257)]+':\x20'+_0x38e1ab[_0x166403(0x269)][_0x166403(0x1e4)](0x0,0x3c)),await P(_0x166403(0x206),{'alias':Z,'message_id':_0x38e1ab['id']});}}}async function A(){const _0x7b3b30=a0_0x52bbdc;let _0x118f0e=new a0_0x37debf();await K['connect'](_0x118f0e),Y('MCP\x20stdio\x20connected'),Y(_0x7b3b30(0x1e2)),u()[_0x7b3b30(0x252)](_0x514f32=>Y('SSE\x20fatal:\x20'+_0x514f32)),P(_0x7b3b30(0x1ed),{'resume_id':w,'alias':Z,'status':_0x7b3b30(0x254),'server':a0_0xbe43f3(),'hostname':a0_0xbe43f3(),'agent':_0x7b3b30(0x241),'project_dir':process[_0x7b3b30(0x22a)](),'tmux_name':j||void 0x0})[_0x7b3b30(0x21c)](()=>Y('registered\x20as\x20\x22'+Z+_0x7b3b30(0x1ea)+w[_0x7b3b30(0x1e4)](0x0,0x8)+')'))['catch'](_0x362126=>Y(_0x7b3b30(0x248)+_0x362126)),setInterval(()=>{const _0x1d3fe1=_0x7b3b30;P(_0x1d3fe1(0x1ed),{'resume_id':w,'alias':Z,'status':_0x1d3fe1(0x254),'server':a0_0xbe43f3(),'hostname':a0_0xbe43f3(),'agent':_0x1d3fe1(0x241),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x1d3fe1(0x252)](_0x3ecae5=>Y(_0x1d3fe1(0x24e)+_0x3ecae5));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x52bbdc(0x252)](_0x272e8b=>{const _0x18e83c=a0_0x52bbdc;Y(_0x18e83c(0x20c)+_0x272e8b),process[_0x18e83c(0x238)](0x1);});async function N(){const _0x2b8b9a=a0_0x52bbdc;Y(_0x2b8b9a(0x233)),await P(_0x2b8b9a(0x1ed),{'resume_id':w,'alias':Z,'status':_0x2b8b9a(0x212),'task':_0x2b8b9a(0x1fd)})[_0x2b8b9a(0x252)](()=>{}),process[_0x2b8b9a(0x238)](0x0);}process[a0_0x52bbdc(0x255)]['on'](a0_0x52bbdc(0x24a),()=>N()),process['on'](a0_0x52bbdc(0x1ee),()=>N()),process['on'](a0_0x52bbdc(0x260),()=>N());
|
|
2
|
+
const a0_0x2a7bc2=a0_0x5965;(function(_0x20de9a,_0x438990){const _0xf0f5d4=a0_0x5965,_0x376be0=_0x20de9a();while(!![]){try{const _0x2ee734=parseInt(_0xf0f5d4(0x244))/0x1*(parseInt(_0xf0f5d4(0x1df))/0x2)+parseInt(_0xf0f5d4(0x1d2))/0x3*(parseInt(_0xf0f5d4(0x21c))/0x4)+parseInt(_0xf0f5d4(0x245))/0x5+-parseInt(_0xf0f5d4(0x237))/0x6+parseInt(_0xf0f5d4(0x249))/0x7+parseInt(_0xf0f5d4(0x203))/0x8+parseInt(_0xf0f5d4(0x1d4))/0x9*(-parseInt(_0xf0f5d4(0x219))/0xa);if(_0x2ee734===_0x438990)break;else _0x376be0['push'](_0x376be0['shift']());}catch(_0x1b096c){_0x376be0['push'](_0x376be0['shift']());}}}(a0_0x45e1,0xcfbc7));import{readFileSync as a0_0x20fcda,existsSync as a0_0x95a135}from'fs';import{randomUUID as a0_0x2c3804}from'crypto';import{join as a0_0x5c38f4}from'path';function a0_0x5965(_0x342d3e,_0x48895b){_0x342d3e=_0x342d3e-0x1c8;const _0x45e18e=a0_0x45e1();let _0x5965c0=_0x45e18e[_0x342d3e];return _0x5965c0;}import{hostname as a0_0x365044}from'os';import{execSync as a0_0x473140}from'child_process';import{Server as a0_0x336f4f}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x34f7b6}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x19afaa,CallToolRequestSchema as a0_0x53e0b2}from'@modelcontextprotocol/sdk/types.js';function p(_0x1f7bf7){const _0x2f6041=a0_0x5965;if(!a0_0x95a135(_0x1f7bf7))return;for(let _0x3f90cc of a0_0x20fcda(_0x1f7bf7,_0x2f6041(0x1e9))[_0x2f6041(0x1d9)]('\x0a')){let _0x49a1b7=_0x3f90cc[_0x2f6041(0x228)]();if(!_0x49a1b7||_0x49a1b7[_0x2f6041(0x233)]('#'))continue;let _0x1b4cad=_0x49a1b7[_0x2f6041(0x202)]('=');if(_0x1b4cad<0x0)continue;let _0x214bcf=_0x49a1b7[_0x2f6041(0x1e4)](0x0,_0x1b4cad)[_0x2f6041(0x228)](),_0x1a2646=_0x49a1b7['slice'](_0x1b4cad+0x1)[_0x2f6041(0x228)]()[_0x2f6041(0x23f)](/^["']|["']$/g,'');if(!process.env[_0x214bcf])process.env[_0x214bcf]=_0x1a2646;}}var C=process.env.HOME||'~',T=a0_0x5c38f4(C,a0_0x2a7bc2(0x1fa));function a0_0x45e1(){const _0x202670=['\x22\x20(','read','stderr','startsWith','cancelled','write','Message\x20content','4419228WUPpjM','starting\x20SSE\x20listener...','pop','...\x20TMUX=','delete','\x20priority=','commhub_report_status','string','replace','length','MCP\x20stdio\x20connected','message','heartbeat\x20failed:\x20','43626DlXdku','2931455UuPrUL','error','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','find','5684070gluQBw','parse\x20error:\x20','.anet','set','catch','number','working','object','Reply\x20text\x20/\x20result\x20summary','application/json,\x20text/event-stream','←\x20message\x20from\x20','89265eLYeHT','.env','1161Qiuxvm','connect','commhub_get_all_status','0.3.0','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','split','get','stringify','shutting\x20down,\x20reporting\x20offline...','from_session','application/json','30odrTjM','join','\x20RESUME_ID=','commhub','SSE\x20fatal:\x20','slice','commhub_send_task','\x20ALIAS=','content','no\x20response','utf-8','http://127.0.0.1:9200','result','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','alias','idle','report_status','connecting\x20to\x20','Bearer\x20','tmux\x20display-message\x20-p\x20\x27#S\x27','→\x20injected\x20task\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','config.json','send_message','init\x20failed:\x20','SSE\x20stream\x20ended,\x20reconnecting...','commhub_reply','.claude/channels/commhub','SSE\x20connection\x20error:\x20','2.0','getReader','2025-03-26','from',']\x20[commhub]\x20','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','indexOf','3664248qlIwjf','commhub-channel','blocked','parse','data:\x20','/mcp','broadcast','connected','cwd','Session\x20alias:\x20','priority','none','exit','in_progress','message_id','initialize','status','warning:\x20could\x20not\x20register:\x20','setRequestHandler','notifications/claude/channel','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','notification','73880UEpffL','\x20PROJECT_ENV=','failed','4QbOPLw','new_message','claude-code','CommHub\x20init\x20failed:\x20','SIGTERM','type','completed','text','messages','Progress\x200-100','SIGINT','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','trim','Target\x20session\x20alias','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','statusText','hub','get_inbox','get_all_status','normal'];a0_0x45e1=function(){return _0x202670;};return a0_0x45e1();}p(a0_0x5c38f4(T,'.env'));var L=process[a0_0x2a7bc2(0x20b)]()[a0_0x2a7bc2(0x23f)](/\//g,'-');p(a0_0x5c38f4(T,L,a0_0x2a7bc2(0x1d3)));function U(){const _0x9dca61=a0_0x2a7bc2;try{return a0_0x473140(_0x9dca61(0x1f2),{'encoding':_0x9dca61(0x1e9),'timeout':0x7d0})[_0x9dca61(0x228)]();}catch{return'';}}function v(){const _0x4fd165=a0_0x2a7bc2;try{let _0x57dc24=a0_0x5c38f4(C,_0x4fd165(0x1c9),_0x4fd165(0x1f5));if(a0_0x95a135(_0x57dc24))return JSON['parse'](a0_0x20fcda(_0x57dc24,_0x4fd165(0x1e9)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x2a7bc2(0x22c)]||a0_0x2a7bc2(0x1ea),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x365044(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x2c3804(),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x574716){const _0x442a0b=a0_0x2a7bc2;let _0x57ffac=new Date()['toTimeString']()[_0x442a0b(0x1e4)](0x0,0x8);process[_0x442a0b(0x232)][_0x442a0b(0x235)]('['+_0x57ffac+_0x442a0b(0x200)+_0x574716+'\x0a');}function h(_0x29531b){return new Promise(_0x5c162e=>setTimeout(_0x5c162e,_0x29531b));}Y('ENV:\x20URL='+f+a0_0x2a7bc2(0x1e6)+Z+a0_0x2a7bc2(0x1e1)+w['slice'](0x0,0x8)+a0_0x2a7bc2(0x23a)+(j||a0_0x2a7bc2(0x20e))+'\x20CWD='+process[a0_0x2a7bc2(0x20b)]()+a0_0x2a7bc2(0x21a)+L);var k=new Map(),K=new a0_0x336f4f({'name':'commhub-channel','version':a0_0x2a7bc2(0x1d7)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x2a7bc2(0x227),a0_0x2a7bc2(0x1d8),a0_0x2a7bc2(0x201),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x2a7bc2(0x20c)+Z][a0_0x2a7bc2(0x1e0)]('\x0a')});K[a0_0x2a7bc2(0x215)](a0_0x19afaa,async()=>({'tools':[{'name':a0_0x2a7bc2(0x1f9),'description':a0_0x2a7bc2(0x1f4),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x2a7bc2(0x23e),'description':a0_0x2a7bc2(0x247)},'text':{'type':a0_0x2a7bc2(0x23e),'description':a0_0x2a7bc2(0x1cf)},'status':{'type':'string','enum':['completed',a0_0x2a7bc2(0x21b),a0_0x2a7bc2(0x234),a0_0x2a7bc2(0x205),a0_0x2a7bc2(0x246),a0_0x2a7bc2(0x210)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x2a7bc2(0x223)]}},{'name':'commhub_report_status','description':a0_0x2a7bc2(0x1ec),'inputSchema':{'type':a0_0x2a7bc2(0x1ce),'properties':{'status':{'type':'string','enum':['working',a0_0x2a7bc2(0x1ee),a0_0x2a7bc2(0x205),'error']},'task':{'type':a0_0x2a7bc2(0x23e),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x2a7bc2(0x1cc),'description':a0_0x2a7bc2(0x225)}},'required':['status']}},{'name':'commhub_send_task','description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x2a7bc2(0x1ce),'properties':{'alias':{'type':a0_0x2a7bc2(0x23e),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x2a7bc2(0x23e),'description':'Task\x20content'},'priority':{'type':a0_0x2a7bc2(0x23e),'enum':['high',a0_0x2a7bc2(0x22f),'low'],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x2a7bc2(0x1ed),'task']}},{'name':'commhub_send_message','description':a0_0x2a7bc2(0x217),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x2a7bc2(0x23e),'description':a0_0x2a7bc2(0x229)},'message':{'type':a0_0x2a7bc2(0x23e),'description':a0_0x2a7bc2(0x236)}},'required':[a0_0x2a7bc2(0x1ed),a0_0x2a7bc2(0x242)]}},{'name':a0_0x2a7bc2(0x1d6),'description':a0_0x2a7bc2(0x22a),'inputSchema':{'type':'object','properties':{}}}]}));async function P(_0x2326ee,_0x149be1){const _0x19aa68=a0_0x2a7bc2;let _0x4a4a60=await fetch(f+_0x19aa68(0x208),{'method':'POST','headers':{'Content-Type':_0x19aa68(0x1de),'Accept':_0x19aa68(0x1d0),...X?{'Authorization':_0x19aa68(0x1f1)+X}:{}},'body':JSON[_0x19aa68(0x1db)]({'jsonrpc':_0x19aa68(0x1fc),'id':0x1,'method':_0x19aa68(0x212),'params':{'protocolVersion':_0x19aa68(0x1fe),'capabilities':{},'clientInfo':{'name':_0x19aa68(0x204),'version':_0x19aa68(0x1d7)}}})});if(!_0x4a4a60['ok']){let _0x42693b=await _0x4a4a60[_0x19aa68(0x223)]();return Y(_0x19aa68(0x21f)+_0x4a4a60[_0x19aa68(0x213)]+'\x20'+_0x42693b[_0x19aa68(0x1e4)](0x0,0x64)),{'ok':!0x1,'error':_0x19aa68(0x1f7)+_0x4a4a60[_0x19aa68(0x213)]};}await _0x4a4a60['text']();let _0x248d5c=(await(await fetch(f+'/mcp',{'method':'POST','headers':{'Content-Type':_0x19aa68(0x1de),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x19aa68(0x1f1)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x2,'method':'tools/call','params':{'name':_0x2326ee,'arguments':_0x149be1}})}))['text']())['split']('\x0a')[_0x19aa68(0x248)](_0x2d65dc=>_0x2d65dc[_0x19aa68(0x233)](_0x19aa68(0x207)));if(_0x248d5c){let _0x311c68=JSON[_0x19aa68(0x206)](_0x248d5c[_0x19aa68(0x1e4)](0x6));return _0x311c68?.[_0x19aa68(0x1eb)]?.[_0x19aa68(0x1e7)]?.[0x0]?.['text']?JSON[_0x19aa68(0x206)](_0x311c68['result'][_0x19aa68(0x1e7)][0x0][_0x19aa68(0x223)]):_0x311c68;}return{'ok':!0x1,'error':_0x19aa68(0x1e8)};}K[a0_0x2a7bc2(0x215)](a0_0x53e0b2,async _0x41be04=>{const _0x3bbce4=a0_0x2a7bc2;let {name:_0x297bd6,arguments:_0x4cb444}=_0x41be04['params'];if(_0x297bd6==='commhub_reply'){let {task_id:_0x253483,text:_0x5dde3f,status:_0x39de18}=_0x4cb444;if(_0x39de18===_0x3bbce4(0x222)||_0x39de18===_0x3bbce4(0x21b)||_0x39de18===_0x3bbce4(0x234)){let _0x133a88=_0x39de18===_0x3bbce4(0x222)?'replied':_0x39de18,_0x2c9d21=_0x253483?k[_0x3bbce4(0x1da)](_0x253483)||_0x3bbce4(0x22c):_0x3bbce4(0x22c),_0x1ba52f=await P('send_reply',{'alias':_0x2c9d21,'text':_0x5dde3f,'in_reply_to':_0x253483||void 0x0,'status':_0x133a88,'from_session':Z});if(_0x253483)k[_0x3bbce4(0x23b)](_0x253483);return{'content':[{'type':'text','text':JSON[_0x3bbce4(0x1db)](_0x1ba52f)}]};}let _0x309b3f=await P(_0x3bbce4(0x1ef),{'resume_id':w,'alias':Z,'status':_0x39de18===_0x3bbce4(0x205)?_0x3bbce4(0x205):_0x39de18===_0x3bbce4(0x246)?_0x3bbce4(0x246):_0x3bbce4(0x1cd),'task':_0x5dde3f['slice'](0x0,0xc8),'output':_0x5dde3f});return{'content':[{'type':_0x3bbce4(0x223),'text':JSON['stringify'](_0x309b3f)}]};}if(_0x297bd6===_0x3bbce4(0x23d)){let {status:_0x59166a,task:_0xd987c7,progress:_0x2f4c53}=_0x4cb444,_0x3845a3=await P(_0x3bbce4(0x1ef),{'resume_id':w,'alias':Z,'status':_0x59166a,'task':_0xd987c7,'progress':_0x2f4c53});return{'content':[{'type':_0x3bbce4(0x223),'text':JSON['stringify'](_0x3845a3)}]};}if(_0x297bd6===_0x3bbce4(0x1e5)){let {alias:_0x32d70a,task:_0x955d72,priority:_0x119acc}=_0x4cb444,_0x29b915=await P('send_task',{'alias':_0x32d70a,'task':_0x955d72,'priority':_0x119acc||_0x3bbce4(0x22f),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x3bbce4(0x1db)](_0x29b915)}]};}if(_0x297bd6==='commhub_send_message'){let {alias:_0x46d694,message:_0x3f6096}=_0x4cb444,_0x3ece3a=await P(_0x3bbce4(0x1f6),{'alias':_0x46d694,'message':_0x3f6096,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x3bbce4(0x1db)](_0x3ece3a)}]};}if(_0x297bd6==='commhub_get_all_status'){let _0x580fc0=await P(_0x3bbce4(0x22e),{});return{'content':[{'type':_0x3bbce4(0x223),'text':JSON[_0x3bbce4(0x1db)](_0x580fc0)}]};}return{'content':[{'type':_0x3bbce4(0x223),'text':JSON['stringify']({'error':'unknown\x20tool'})}]};});async function u(){const _0x5d1522=a0_0x2a7bc2;let _0x5f1e39=f+'/events/'+encodeURIComponent(Z),_0x3e151f={};if(X)_0x3e151f['Authorization']='Bearer\x20'+X;Y(_0x5d1522(0x1f0)+_0x5f1e39);while(!0x0){try{let _0x13af81=await fetch(_0x5f1e39,{'headers':_0x3e151f});if(!_0x13af81['ok']){Y('SSE\x20error:\x20'+_0x13af81[_0x5d1522(0x213)]+'\x20'+_0x13af81[_0x5d1522(0x22b)]),await h(0x1388);continue;}let _0x254989=_0x13af81['body'][_0x5d1522(0x1fd)](),_0x45b0bd=new TextDecoder(),_0xdde1de='';while(!0x0){let {done:_0x20bf2e,value:_0x571dbe}=await _0x254989[_0x5d1522(0x231)]();if(_0x20bf2e)break;_0xdde1de+=_0x45b0bd['decode'](_0x571dbe,{'stream':!0x0});let _0x15777a=_0xdde1de[_0x5d1522(0x1d9)]('\x0a\x0a');_0xdde1de=_0x15777a[_0x5d1522(0x239)]()||'';for(let _0x5d7074 of _0x15777a){let _0x2720e1=_0x5d7074[_0x5d1522(0x1d9)]('\x0a')[_0x5d1522(0x248)](_0x35290f=>_0x35290f['startsWith']('data:\x20'));if(!_0x2720e1)continue;try{let _0x3b690e=JSON[_0x5d1522(0x206)](_0x2720e1['slice'](0x6));await S(_0x3b690e);}catch(_0x5e9336){Y(_0x5d1522(0x1c8)+_0x5e9336);}}}Y(_0x5d1522(0x1f8));}catch(_0x2d4cb4){Y(_0x5d1522(0x1fb)+_0x2d4cb4);}await h(0xbb8);}}async function S(_0x4fd973){const _0x6a95ec=a0_0x2a7bc2;if(_0x4fd973[_0x6a95ec(0x221)]===_0x6a95ec(0x20a)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x4fd973['type']===_0x6a95ec(0x21d)){if(Y(_0x6a95ec(0x1d1)+_0x4fd973[_0x6a95ec(0x1ff)]+':\x20'+_0x4fd973[_0x6a95ec(0x242)][_0x6a95ec(0x1e4)](0x0,0x3c)),await K[_0x6a95ec(0x218)]({'method':'notifications/claude/channel','params':{'content':_0x4fd973[_0x6a95ec(0x242)],'meta':{'sender':_0x4fd973[_0x6a95ec(0x1ff)]||_0x6a95ec(0x22c),'sender_id':'commhub','user':_0x4fd973[_0x6a95ec(0x1ff)]||_0x6a95ec(0x22c),'priority':_0x6a95ec(0x22f)}}}),_0x4fd973[_0x6a95ec(0x211)])await P('ack_inbox',{'alias':Z,'message_id':_0x4fd973[_0x6a95ec(0x211)]});return;}if(_0x4fd973[_0x6a95ec(0x221)]==='new_task'||_0x4fd973[_0x6a95ec(0x221)]===_0x6a95ec(0x209)){Y('←\x20'+_0x4fd973[_0x6a95ec(0x221)]+':\x20inbox_count='+_0x4fd973['inbox_count']+_0x6a95ec(0x23c)+(_0x4fd973[_0x6a95ec(0x20d)]||_0x6a95ec(0x22f)));let _0x44a74d=await P(_0x6a95ec(0x22d),{'alias':Z,'limit':0x5});if(_0x44a74d?.['ok']&&_0x44a74d[_0x6a95ec(0x224)]?.[_0x6a95ec(0x240)]>0x0)for(let _0x166c3e of _0x44a74d['messages']){let _0x45505a={'sender':_0x166c3e[_0x6a95ec(0x1dd)]||_0x6a95ec(0x22c),'sender_id':_0x6a95ec(0x1e2),'user':_0x166c3e[_0x6a95ec(0x1dd)]||'hub','task_id':_0x166c3e['id'],'priority':_0x166c3e[_0x6a95ec(0x20d)]||_0x6a95ec(0x22f)};k[_0x6a95ec(0x1ca)](_0x166c3e['id'],_0x166c3e[_0x6a95ec(0x1dd)]||_0x6a95ec(0x22c)),await K[_0x6a95ec(0x218)]({'method':_0x6a95ec(0x216),'params':{'content':_0x166c3e['content'],'meta':_0x45505a}}),Y(_0x6a95ec(0x1f3)+_0x166c3e['id'][_0x6a95ec(0x1e4)](0x0,0x8)+'\x20from\x20'+_0x166c3e[_0x6a95ec(0x1dd)]+':\x20'+_0x166c3e['content']['slice'](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x166c3e['id']});}}}async function A(){const _0x22299f=a0_0x2a7bc2;let _0x251707=new a0_0x34f7b6();await K[_0x22299f(0x1d5)](_0x251707),Y(_0x22299f(0x241)),Y(_0x22299f(0x238)),u()[_0x22299f(0x1cb)](_0x249d37=>Y(_0x22299f(0x1e3)+_0x249d37)),P(_0x22299f(0x1ef),{'resume_id':w,'alias':Z,'status':_0x22299f(0x1ee),'server':a0_0x365044(),'hostname':a0_0x365044(),'agent':'claude-code','project_dir':process[_0x22299f(0x20b)](),'tmux_name':j||void 0x0})['then'](()=>Y('registered\x20as\x20\x22'+Z+_0x22299f(0x230)+w['slice'](0x0,0x8)+')'))[_0x22299f(0x1cb)](_0x19d461=>Y(_0x22299f(0x214)+_0x19d461)),setInterval(()=>{const _0x5d37cc=_0x22299f;P(_0x5d37cc(0x1ef),{'resume_id':w,'alias':Z,'status':_0x5d37cc(0x1ee),'server':a0_0x365044(),'hostname':a0_0x365044(),'agent':_0x5d37cc(0x21e),'project_dir':process[_0x5d37cc(0x20b)](),'tmux_name':j||void 0x0})[_0x5d37cc(0x1cb)](_0x49942c=>Y(_0x5d37cc(0x243)+_0x49942c));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x2a7bc2(0x1cb)](_0x2942f8=>{const _0x260ac4=a0_0x2a7bc2;Y('fatal:\x20'+_0x2942f8),process[_0x260ac4(0x20f)](0x1);});async function N(){const _0x20667d=a0_0x2a7bc2;Y(_0x20667d(0x1dc)),await P(_0x20667d(0x1ef),{'resume_id':w,'alias':Z,'status':'error','task':'session\x20disconnected'})[_0x20667d(0x1cb)](()=>{}),process[_0x20667d(0x20f)](0x0);}process['stdin']['on']('end',()=>N()),process['on'](a0_0x2a7bc2(0x220),()=>N()),process['on'](a0_0x2a7bc2(0x226),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.12-preview.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",
|