@sleep2agi/agent-network 2.1.3-preview.1 → 2.1.3-preview.2
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_0x18d3c6=a0_0xf58a;(function(_0x2617bd,_0xf1631e){const _0x2dc98f=a0_0xf58a,_0x106d10=_0x2617bd();while(!![]){try{const _0x198501=parseInt(_0x2dc98f(0x18c))/0x1*(-parseInt(_0x2dc98f(0x1b6))/0x2)+-parseInt(_0x2dc98f(0x1d4))/0x3+-parseInt(_0x2dc98f(0x1c6))/0x4*(-parseInt(_0x2dc98f(0x1ab))/0x5)+-parseInt(_0x2dc98f(0x1a8))/0x6*(parseInt(_0x2dc98f(0x1d2))/0x7)+parseInt(_0x2dc98f(0x1b7))/0x8*(parseInt(_0x2dc98f(0x1a4))/0x9)+parseInt(_0x2dc98f(0x195))/0xa+-parseInt(_0x2dc98f(0x199))/0xb*(-parseInt(_0x2dc98f(0x1ba))/0xc);if(_0x198501===_0xf1631e)break;else _0x106d10['push'](_0x106d10['shift']());}catch(_0x22987f){_0x106d10['push'](_0x106d10['shift']());}}}(a0_0x3510,0x99e56));import{EventEmitter as a0_0x18eb7a}from'events';function a0_0xf58a(_0x8050a2,_0x2231fe){_0x8050a2=_0x8050a2-0x188;const _0x351015=a0_0x3510();let _0xf58ac1=_0x351015[_0x8050a2];return _0xf58ac1;}import{hostname as a0_0x505b29}from'os';function a0_0x3510(){const _0x464676=['alias','emit','message','offline','task','ack_inbox','heartbeatInterval','sleep','45rcfNlB','inbox\x20error:\x20','call','result','1864788uvnwwI','from_session','error','25jQleIr','new_message','text/event-stream','report_status','body','abort','sdk-','token','pop','running','heartbeat\x20failed:\x20','38PFcMNA','1899224DAnctT','completed','SSE\x20failed:\x20','16776QQnuac','/mcp','parse','getAllStatus','registered','resumeId','cwd','url','send','send_reply','get_all_status','content','542460ziCmnH','heartbeatTimer','connected','agent','now','reconnectDelay','decode','status','get_inbox','s...','read','split','28JFrFRx','log','303108KWSvvp','2.0','stringify','autoConnect','match','slice','SSE\x20connected','name','processInbox','application/json','Authorization','SSE\x20error:\x20','50852hFCpRN','disconnected','idle','connectSSE','toTimeString','Bearer\x20','min','messages','sseAbort','7247860PeAJBF','catch','normal','type','2761HPZyqy','broadcast','text'];a0_0x3510=function(){return _0x464676;};return a0_0x3510();}class T extends a0_0x18eb7a{['url'];[a0_0x18d3c6(0x19c)];['token'];[a0_0x18d3c6(0x1c9)];[a0_0x18d3c6(0x1bf)];[a0_0x18d3c6(0x1a2)];[a0_0x18d3c6(0x1cb)];[a0_0x18d3c6(0x1c7)];['sseAbort'];[a0_0x18d3c6(0x1b4)]=!0x1;constructor(_0x276a4a){const _0x188731=a0_0x18d3c6;super();if(this[_0x188731(0x1c1)]=_0x276a4a[_0x188731(0x1c1)]['replace'](/\/$/,''),this['alias']=_0x276a4a[_0x188731(0x19c)],this[_0x188731(0x1b2)]=_0x276a4a[_0x188731(0x1b2)],this[_0x188731(0x1c9)]=_0x276a4a[_0x188731(0x1c9)]||'sdk',this[_0x188731(0x1bf)]=_0x188731(0x1b1)+_0x276a4a['alias']+'-'+Date[_0x188731(0x1ca)]()['toString'](0x24),this[_0x188731(0x1a2)]=_0x276a4a[_0x188731(0x1a2)]??0x2bf20,this[_0x188731(0x1cb)]=_0x276a4a[_0x188731(0x1cb)]??0xbb8,_0x276a4a[_0x188731(0x1d7)]!==!0x1)this['connect']();}[a0_0x18d3c6(0x1d3)](_0x34fa24){const _0x26688c=a0_0x18d3c6;console[_0x26688c(0x1d3)]('['+new Date()[_0x26688c(0x190)]()['slice'](0x0,0x8)+']\x20[commhub:'+this[_0x26688c(0x19c)]+']\x20'+_0x34fa24);}async['call'](_0x4a845a,_0x4ec2eb){const _0x53f200=a0_0x18d3c6;let _0x1850c7={'Content-Type':_0x53f200(0x189),'Accept':'application/json,\x20text/event-stream'};if(this[_0x53f200(0x1b2)])_0x1850c7['Authorization']=_0x53f200(0x191)+this['token'];let _0x22aee6=await(await fetch(this[_0x53f200(0x1c1)]+_0x53f200(0x1bb),{'method':'POST','headers':_0x1850c7,'body':JSON[_0x53f200(0x1d6)]({'jsonrpc':_0x53f200(0x1d5),'id':Date[_0x53f200(0x1ca)](),'method':'tools/call','params':{'name':_0x4a845a,'arguments':_0x4ec2eb}})}))[_0x53f200(0x19b)](),_0x306c5e=_0x22aee6[_0x53f200(0x1d8)](/data: (.+)/),_0x19b88e=_0x306c5e?JSON['parse'](_0x306c5e[0x1]):JSON[_0x53f200(0x1bc)](_0x22aee6),_0x32ccfe=_0x19b88e?.[_0x53f200(0x1a7)]?.[_0x53f200(0x1c5)]?.[0x0]?.[_0x53f200(0x19b)];return _0x32ccfe?JSON[_0x53f200(0x1bc)](_0x32ccfe):_0x19b88e;}async['connect'](){const _0x149ac5=a0_0x18d3c6;if(this[_0x149ac5(0x1b4)])return;this[_0x149ac5(0x1b4)]=!0x0,await this[_0x149ac5(0x1cd)](_0x149ac5(0x18e)),this[_0x149ac5(0x1d3)](_0x149ac5(0x1be)),this[_0x149ac5(0x1c7)]=setInterval(()=>{const _0x4acb28=_0x149ac5;this['status'](_0x4acb28(0x18e))['catch'](_0x4a47b0=>this['log'](_0x4acb28(0x1b5)+_0x4a47b0[_0x4acb28(0x19e)]));},this[_0x149ac5(0x1a2)]),this[_0x149ac5(0x18f)]();}async['disconnect'](){const _0xe86b89=a0_0x18d3c6;if(this[_0xe86b89(0x1b4)]=!0x1,this['sseAbort']?.[_0xe86b89(0x1b0)](),this[_0xe86b89(0x1c7)])clearInterval(this[_0xe86b89(0x1c7)]);await this[_0xe86b89(0x1cd)](_0xe86b89(0x19f))[_0xe86b89(0x196)](()=>{}),this['log']('disconnected');}async[a0_0x18d3c6(0x1c2)](_0x2ff8af,_0x2f4153,_0x545a6f=a0_0x18d3c6(0x197)){const _0x51bb27=a0_0x18d3c6;return this['call']('send_task',{'alias':_0x2ff8af,'task':_0x2f4153,'priority':_0x545a6f,'from_session':this[_0x51bb27(0x19c)]});}async[a0_0x18d3c6(0x19e)](_0x1e5d8a,_0x37410f){const _0x17ac42=a0_0x18d3c6;return this[_0x17ac42(0x1a6)]('send_message',{'alias':_0x1e5d8a,'message':_0x37410f,'from_session':this[_0x17ac42(0x19c)]});}async['reply'](_0x4475d2,_0x6de670,_0x1f5d64=a0_0x18d3c6(0x1b8)){const _0x19a476=a0_0x18d3c6;return this[_0x19a476(0x1a6)](_0x19a476(0x1c3),{'in_reply_to':_0x4475d2,'text':_0x6de670,'status':_0x1f5d64});}async[a0_0x18d3c6(0x1cd)](_0x49f960,_0x2fb909){const _0x28b1b4=a0_0x18d3c6;return this[_0x28b1b4(0x1a6)](_0x28b1b4(0x1ae),{'resume_id':this[_0x28b1b4(0x1bf)],'alias':this[_0x28b1b4(0x19c)],'status':_0x49f960,'server':a0_0x505b29(),'hostname':a0_0x505b29(),'agent':this[_0x28b1b4(0x1c9)],'project_dir':process[_0x28b1b4(0x1c0)](),..._0x2fb909});}async[a0_0x18d3c6(0x1bd)](){const _0x4aa323=a0_0x18d3c6;return this['call'](_0x4aa323(0x1c4),{});}async['broadcast'](_0x230888,_0x32fdd9){const _0x31383d=a0_0x18d3c6;return this[_0x31383d(0x1a6)](_0x31383d(0x19a),{'message':_0x230888,'filter_server':_0x32fdd9?.['server'],'filter_status':_0x32fdd9?.[_0x31383d(0x1cd)]});}async[a0_0x18d3c6(0x18f)](){const _0x3a0e2f=a0_0x18d3c6;let _0x3937b1=encodeURIComponent(this['alias']),_0x24e045=this['url']+'/events/'+_0x3937b1,_0x359f93=this[_0x3a0e2f(0x1cb)];while(this[_0x3a0e2f(0x1b4)]){try{this[_0x3a0e2f(0x194)]=new AbortController();let _0x4cb5d5={'Accept':_0x3a0e2f(0x1ad)};if(this['token'])_0x4cb5d5[_0x3a0e2f(0x18a)]=_0x3a0e2f(0x191)+this[_0x3a0e2f(0x1b2)];let _0x3df7e5=await fetch(_0x24e045,{'headers':_0x4cb5d5,'signal':this[_0x3a0e2f(0x194)]['signal']});if(!_0x3df7e5['ok']||!_0x3df7e5[_0x3a0e2f(0x1af)]){this[_0x3a0e2f(0x1d3)](_0x3a0e2f(0x1b9)+_0x3df7e5['status']),await this[_0x3a0e2f(0x1a3)](_0x359f93),_0x359f93=Math[_0x3a0e2f(0x192)](_0x359f93*1.5,0xea60);continue;}_0x359f93=this['reconnectDelay'];let _0x47bcd1=_0x3df7e5[_0x3a0e2f(0x1af)]['getReader'](),_0x53bf13=new TextDecoder(),_0x50c09e='';while(this['running']){let {done:_0x34820a,value:_0x3a0734}=await _0x47bcd1[_0x3a0e2f(0x1d0)]();if(_0x34820a)break;_0x50c09e+=_0x53bf13[_0x3a0e2f(0x1cc)](_0x3a0734,{'stream':!0x0});let _0x2a3090=_0x50c09e[_0x3a0e2f(0x1d1)]('\x0a');_0x50c09e=_0x2a3090[_0x3a0e2f(0x1b3)]()||'';for(let _0x2c2628 of _0x2a3090){if(!_0x2c2628['startsWith']('data:\x20'))continue;try{let _0x3b304a=JSON['parse'](_0x2c2628[_0x3a0e2f(0x1d9)](0x6));if(_0x3b304a[_0x3a0e2f(0x198)]===_0x3a0e2f(0x1c8)){this['log'](_0x3a0e2f(0x1da)),this[_0x3a0e2f(0x19d)](_0x3a0e2f(0x1c8));continue;}if(_0x3b304a[_0x3a0e2f(0x198)]==='new_task'||_0x3b304a['type']===_0x3a0e2f(0x1ac)||_0x3b304a['type']===_0x3a0e2f(0x19a))await this[_0x3a0e2f(0x188)]();}catch{}}}}catch(_0x213313){if(_0x213313[_0x3a0e2f(0x1db)]==='AbortError')break;this['emit'](_0x3a0e2f(0x1aa),_0x213313),this[_0x3a0e2f(0x1d3)](_0x3a0e2f(0x18b)+_0x213313[_0x3a0e2f(0x19e)]);}if(this[_0x3a0e2f(0x1b4)])this['emit'](_0x3a0e2f(0x18d)),this[_0x3a0e2f(0x1d3)]('SSE\x20reconnecting\x20in\x20'+_0x359f93/0x3e8+_0x3a0e2f(0x1cf)),await this['sleep'](_0x359f93),_0x359f93=Math[_0x3a0e2f(0x192)](_0x359f93*1.5,0xea60);}}async[a0_0x18d3c6(0x188)](){const _0x3ae3a4=a0_0x18d3c6;try{let _0xed1133=(await this[_0x3ae3a4(0x1a6)](_0x3ae3a4(0x1ce),{'alias':this[_0x3ae3a4(0x19c)],'limit':0xa}))?.[_0x3ae3a4(0x193)]||[];for(let _0xb8fc4c of _0xed1133)await this['call'](_0x3ae3a4(0x1a1),{'alias':this[_0x3ae3a4(0x19c)],'message_id':_0xb8fc4c['id']}),this[_0x3ae3a4(0x1d3)]('←\x20'+_0xb8fc4c[_0x3ae3a4(0x1a9)]+':\x20'+_0xb8fc4c[_0x3ae3a4(0x1c5)][_0x3ae3a4(0x1d9)](0x0,0x3c)),this[_0x3ae3a4(0x19d)](_0x3ae3a4(0x1a0),_0xb8fc4c),this[_0x3ae3a4(0x19d)](_0x3ae3a4(0x19e),_0xb8fc4c);}catch(_0x41f4ee){this['log'](_0x3ae3a4(0x1a5)+_0x41f4ee[_0x3ae3a4(0x19e)]);}}[a0_0x18d3c6(0x1a3)](_0x192983){return new Promise(_0x367390=>setTimeout(_0x367390,_0x192983));}}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_0x2f6bfb=a0_0x35b7;function a0_0x35b7(_0x466ad3,_0x5565b8){_0x466ad3=_0x466ad3-0x1c1;const _0x1c28eb=a0_0x1c28();let _0x35b726=_0x1c28eb[_0x466ad3];return _0x35b726;}(function(_0x1a3bc2,_0x3c595c){const _0x536e14=a0_0x35b7,_0x2978f9=_0x1a3bc2();while(!![]){try{const _0x1ee6c4=parseInt(_0x536e14(0x1e4))/0x1*(-parseInt(_0x536e14(0x210))/0x2)+parseInt(_0x536e14(0x237))/0x3*(parseInt(_0x536e14(0x1d7))/0x4)+-parseInt(_0x536e14(0x21a))/0x5+-parseInt(_0x536e14(0x1e5))/0x6+-parseInt(_0x536e14(0x1fa))/0x7+-parseInt(_0x536e14(0x1cf))/0x8+parseInt(_0x536e14(0x23b))/0x9*(parseInt(_0x536e14(0x1d9))/0xa);if(_0x1ee6c4===_0x3c595c)break;else _0x2978f9['push'](_0x2978f9['shift']());}catch(_0x16c26c){_0x2978f9['push'](_0x2978f9['shift']());}}}(a0_0x1c28,0x94c4b));import{readFileSync as a0_0x527a3e,existsSync as a0_0x202abc}from'fs';import{randomUUID as a0_0x4d4210}from'crypto';import{join as a0_0x14515a}from'path';import{hostname as a0_0x17022b}from'os';import{execSync as a0_0x3fe4ff}from'child_process';function a0_0x1c28(){const _0x48df9d=['delete','3zRlBcS','1743606InFRGP','application/json,\x20text/event-stream','ENV:\x20URL=','commhub_report_status','commhub_reply','status','broadcast','←\x20message\x20from\x20','from','SIGINT','hub','decode','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Current\x20task\x20description','2.0','SSE\x20stream\x20ended,\x20reconnecting...','indexOf','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','alias','messages','commhub_get_all_status','1286621tCDGFE','result','number','write','Priority\x20(default:\x20normal)','notification','get_inbox','data:\x20','Bearer\x20','heartbeat\x20failed:\x20','catch','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','stringify','Reply\x20text\x20/\x20result\x20summary','config.json','failed','token','tmux\x20display-message\x20-p\x20\x27#S\x27','utf-8','0.3.0','then','commhub_send_message','164734eZFhEB','\x20PROJECT_ENV=','toTimeString','report_status','cwd','commhub','low','find','parse','\x20from\x20','5550045KawHHE','claude-code','blocked','SSE\x20fatal:\x20','SSE\x20connection\x20error:\x20','no\x20response','startsWith','in_progress','connected','getReader','SIGTERM','Message\x20content','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','cancelled','length','from_session','\x20RESUME_ID=','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','commhub_send_task','http://127.0.0.1:9200','Task\x20content','content','pop','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','idle','.claude/channels/commhub','application/json','Target\x20session\x20alias','read','11127GGvmQo','replace','ready\x20—\x20waiting\x20for\x20events','object','7650nbJVmN','split','inbox_count','exit','send_reply','error','message','type','POST','2025-03-26','priority','.env','replied','\x22\x20(','Session\x20alias:\x20','slice','setRequestHandler','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','text','notifications/claude/channel','registered\x20as\x20\x22','string','statusText','completed','1493608DcAUeh','connect','join','body','→\x20injected\x20task\x20','init\x20failed:\x20','ack_inbox','unknown\x20tool','520HlnVgQ','get','25240yPAQCy','stderr','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','fatal:\x20','message_id','trim','SSE\x20connected\x20as\x20\x22','normal'];a0_0x1c28=function(){return _0x48df9d;};return a0_0x1c28();}import{Server as a0_0x21afd9}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x2d5b29}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x52dd7a,CallToolRequestSchema as a0_0x20a545}from'@modelcontextprotocol/sdk/types.js';function p(_0x59fd06){const _0x15a5f5=a0_0x35b7;if(!a0_0x202abc(_0x59fd06))return;for(let _0x209ea5 of a0_0x527a3e(_0x59fd06,_0x15a5f5(0x20c))['split']('\x0a')){let _0x423564=_0x209ea5[_0x15a5f5(0x1e0)]();if(!_0x423564||_0x423564[_0x15a5f5(0x220)]('#'))continue;let _0x266907=_0x423564[_0x15a5f5(0x1f5)]('=');if(_0x266907<0x0)continue;let _0x1adfde=_0x423564[_0x15a5f5(0x1c6)](0x0,_0x266907)[_0x15a5f5(0x1e0)](),_0x4e8f6c=_0x423564['slice'](_0x266907+0x1)[_0x15a5f5(0x1e0)]()[_0x15a5f5(0x238)](/^["']|["']$/g,'');if(!process.env[_0x1adfde])process.env[_0x1adfde]=_0x4e8f6c;}}var C=process.env.HOME||'~',T=a0_0x14515a(C,a0_0x2f6bfb(0x233));p(a0_0x14515a(T,a0_0x2f6bfb(0x1c2)));var L=process[a0_0x2f6bfb(0x214)]()[a0_0x2f6bfb(0x238)](/\//g,'-');p(a0_0x14515a(T,L,a0_0x2f6bfb(0x1c2)));function U(){const _0x2e5e6f=a0_0x2f6bfb;try{return a0_0x3fe4ff(_0x2e5e6f(0x20b),{'encoding':_0x2e5e6f(0x20c),'timeout':0x7d0})[_0x2e5e6f(0x1e0)]();}catch{return'';}}function v(){const _0x1475c7=a0_0x2f6bfb;try{let _0x4ee6ee=a0_0x14515a(C,'.anet',_0x1475c7(0x208));if(a0_0x202abc(_0x4ee6ee))return JSON[_0x1475c7(0x218)](a0_0x527a3e(_0x4ee6ee,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x2f6bfb(0x1ef)]||a0_0x2f6bfb(0x22d),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x17022b(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x4d4210(),X=process.env.COMMHUB_TOKEN||H[a0_0x2f6bfb(0x20a)]||'';function Y(_0x1e065a){const _0x13250f=a0_0x2f6bfb;let _0x254ecf=new Date()[_0x13250f(0x212)]()[_0x13250f(0x1c6)](0x0,0x8);process[_0x13250f(0x1da)][_0x13250f(0x1fd)]('['+_0x254ecf+']\x20[commhub]\x20'+_0x1e065a+'\x0a');}function h(_0x2373de){return new Promise(_0x4a7f8f=>setTimeout(_0x4a7f8f,_0x2373de));}Y(a0_0x2f6bfb(0x1e7)+f+'\x20ALIAS='+Z+a0_0x2f6bfb(0x22a)+w[a0_0x2f6bfb(0x1c6)](0x0,0x8)+'...\x20TMUX='+(j||'none')+'\x20CWD='+process[a0_0x2f6bfb(0x214)]()+a0_0x2f6bfb(0x211)+L);var k=new Map(),K=new a0_0x21afd9({'name':'commhub-channel','version':a0_0x2f6bfb(0x20d)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x2f6bfb(0x1dc),a0_0x2f6bfb(0x1f6),a0_0x2f6bfb(0x226),a0_0x2f6bfb(0x1f1),a0_0x2f6bfb(0x1c5)+Z][a0_0x2f6bfb(0x1d1)]('\x0a')});K[a0_0x2f6bfb(0x1c7)](a0_0x52dd7a,async()=>({'tools':[{'name':a0_0x2f6bfb(0x1e9),'description':a0_0x2f6bfb(0x205),'inputSchema':{'type':a0_0x2f6bfb(0x23a),'properties':{'task_id':{'type':'string','description':a0_0x2f6bfb(0x22b)},'text':{'type':a0_0x2f6bfb(0x1cc),'description':a0_0x2f6bfb(0x207)},'status':{'type':a0_0x2f6bfb(0x1cc),'enum':['completed','failed','cancelled','blocked','error',a0_0x2f6bfb(0x221)],'description':a0_0x2f6bfb(0x1c8)}},'required':[a0_0x2f6bfb(0x1c9)]}},{'name':a0_0x2f6bfb(0x1e8),'description':a0_0x2f6bfb(0x1db),'inputSchema':{'type':a0_0x2f6bfb(0x23a),'properties':{'status':{'type':a0_0x2f6bfb(0x1cc),'enum':['working','idle',a0_0x2f6bfb(0x21c),a0_0x2f6bfb(0x240)]},'task':{'type':a0_0x2f6bfb(0x1cc),'description':a0_0x2f6bfb(0x1f2)},'progress':{'type':a0_0x2f6bfb(0x1fc),'description':'Progress\x200-100'}},'required':[a0_0x2f6bfb(0x1ea)]}},{'name':'commhub_send_task','description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x2f6bfb(0x23a),'properties':{'alias':{'type':'string','description':a0_0x2f6bfb(0x235)},'task':{'type':a0_0x2f6bfb(0x1cc),'description':a0_0x2f6bfb(0x22e)},'priority':{'type':a0_0x2f6bfb(0x1cc),'enum':['high',a0_0x2f6bfb(0x1e2),a0_0x2f6bfb(0x216)],'description':a0_0x2f6bfb(0x1fe)}},'required':[a0_0x2f6bfb(0x1f7),'task']}},{'name':a0_0x2f6bfb(0x20f),'description':a0_0x2f6bfb(0x231),'inputSchema':{'type':a0_0x2f6bfb(0x23a),'properties':{'alias':{'type':a0_0x2f6bfb(0x1cc),'description':a0_0x2f6bfb(0x235)},'message':{'type':a0_0x2f6bfb(0x1cc),'description':a0_0x2f6bfb(0x225)}},'required':[a0_0x2f6bfb(0x1f7),a0_0x2f6bfb(0x241)]}},{'name':'commhub_get_all_status','description':a0_0x2f6bfb(0x1dd),'inputSchema':{'type':'object','properties':{}}}]}));async function P(_0xe3f579,_0x48fe73){const _0x38a507=a0_0x2f6bfb;let _0x20d338=await fetch(f+'/mcp',{'method':'POST','headers':{'Content-Type':_0x38a507(0x234),'Accept':_0x38a507(0x1e6),...X?{'Authorization':_0x38a507(0x202)+X}:{}},'body':JSON[_0x38a507(0x206)]({'jsonrpc':_0x38a507(0x1f3),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x38a507(0x244),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x38a507(0x20d)}}})});if(!_0x20d338['ok']){let _0x28d97e=await _0x20d338[_0x38a507(0x1c9)]();return Y('CommHub\x20init\x20failed:\x20'+_0x20d338[_0x38a507(0x1ea)]+'\x20'+_0x28d97e[_0x38a507(0x1c6)](0x0,0x64)),{'ok':!0x1,'error':_0x38a507(0x1d4)+_0x20d338['status']};}await _0x20d338['text']();let _0x34d34b=(await(await fetch(f+'/mcp',{'method':_0x38a507(0x243),'headers':{'Content-Type':_0x38a507(0x234),'Accept':_0x38a507(0x1e6),...X?{'Authorization':_0x38a507(0x202)+X}:{}},'body':JSON[_0x38a507(0x206)]({'jsonrpc':_0x38a507(0x1f3),'id':0x2,'method':'tools/call','params':{'name':_0xe3f579,'arguments':_0x48fe73}})}))[_0x38a507(0x1c9)]())[_0x38a507(0x23c)]('\x0a')[_0x38a507(0x217)](_0x5e0a8e=>_0x5e0a8e[_0x38a507(0x220)](_0x38a507(0x201)));if(_0x34d34b){let _0x151c1f=JSON[_0x38a507(0x218)](_0x34d34b[_0x38a507(0x1c6)](0x6));return _0x151c1f?.[_0x38a507(0x1fb)]?.[_0x38a507(0x22f)]?.[0x0]?.[_0x38a507(0x1c9)]?JSON[_0x38a507(0x218)](_0x151c1f[_0x38a507(0x1fb)]['content'][0x0][_0x38a507(0x1c9)]):_0x151c1f;}return{'ok':!0x1,'error':_0x38a507(0x21f)};}K[a0_0x2f6bfb(0x1c7)](a0_0x20a545,async _0x47b6cb=>{const _0x2e2c33=a0_0x2f6bfb;let {name:_0x650a4b,arguments:_0xfc4a53}=_0x47b6cb['params'];if(_0x650a4b==='commhub_reply'){let {task_id:_0x9f1dfd,text:_0x303a6e,status:_0x23a726}=_0xfc4a53;if(_0x23a726===_0x2e2c33(0x1ce)||_0x23a726===_0x2e2c33(0x209)||_0x23a726===_0x2e2c33(0x227)){let _0x2022e7=_0x23a726==='completed'?_0x2e2c33(0x1c3):_0x23a726,_0x37cd00=_0x9f1dfd?k[_0x2e2c33(0x1d8)](_0x9f1dfd)||'hub':'hub',_0xab4bb8=await P(_0x2e2c33(0x23f),{'alias':_0x37cd00,'text':_0x303a6e,'in_reply_to':_0x9f1dfd||void 0x0,'status':_0x2022e7,'from_session':Z});if(_0x9f1dfd)k[_0x2e2c33(0x1e3)](_0x9f1dfd);return{'content':[{'type':_0x2e2c33(0x1c9),'text':JSON[_0x2e2c33(0x206)](_0xab4bb8)}]};}let _0x1faa44=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x23a726==='blocked'?'blocked':_0x23a726===_0x2e2c33(0x240)?_0x2e2c33(0x240):'working','task':_0x303a6e[_0x2e2c33(0x1c6)](0x0,0xc8),'output':_0x303a6e});return{'content':[{'type':'text','text':JSON[_0x2e2c33(0x206)](_0x1faa44)}]};}if(_0x650a4b===_0x2e2c33(0x1e8)){let {status:_0x16ceeb,task:_0x54ec90,progress:_0x779809}=_0xfc4a53,_0x5e0b1f=await P(_0x2e2c33(0x213),{'resume_id':w,'alias':Z,'status':_0x16ceeb,'task':_0x54ec90,'progress':_0x779809});return{'content':[{'type':_0x2e2c33(0x1c9),'text':JSON[_0x2e2c33(0x206)](_0x5e0b1f)}]};}if(_0x650a4b===_0x2e2c33(0x22c)){let {alias:_0x425fc8,task:_0x530feb,priority:_0x4f0c56}=_0xfc4a53,_0x5085e8=await P('send_task',{'alias':_0x425fc8,'task':_0x530feb,'priority':_0x4f0c56||'normal','from_session':Z});return{'content':[{'type':_0x2e2c33(0x1c9),'text':JSON[_0x2e2c33(0x206)](_0x5085e8)}]};}if(_0x650a4b===_0x2e2c33(0x20f)){let {alias:_0xce30b8,message:_0x182479}=_0xfc4a53,_0x3ed6d7=await P('send_message',{'alias':_0xce30b8,'message':_0x182479,'from_session':Z});return{'content':[{'type':_0x2e2c33(0x1c9),'text':JSON['stringify'](_0x3ed6d7)}]};}if(_0x650a4b===_0x2e2c33(0x1f9)){let _0x399410=await P('get_all_status',{});return{'content':[{'type':_0x2e2c33(0x1c9),'text':JSON['stringify'](_0x399410)}]};}return{'content':[{'type':'text','text':JSON[_0x2e2c33(0x206)]({'error':_0x2e2c33(0x1d6)})}]};});async function u(){const _0x2d68d4=a0_0x2f6bfb;let _0x1fe77d=f+'/events/'+encodeURIComponent(Z),_0x44531c={};if(X)_0x44531c['Authorization']=_0x2d68d4(0x202)+X;Y('connecting\x20to\x20'+_0x1fe77d);while(!0x0){try{let _0x41c01d=await fetch(_0x1fe77d,{'headers':_0x44531c});if(!_0x41c01d['ok']){Y('SSE\x20error:\x20'+_0x41c01d[_0x2d68d4(0x1ea)]+'\x20'+_0x41c01d[_0x2d68d4(0x1cd)]),await h(0x1388);continue;}let _0x1e8f99=_0x41c01d[_0x2d68d4(0x1d2)][_0x2d68d4(0x223)](),_0x7fa0b4=new TextDecoder(),_0x11b9da='';while(!0x0){let {done:_0x31d382,value:_0x483cba}=await _0x1e8f99[_0x2d68d4(0x236)]();if(_0x31d382)break;_0x11b9da+=_0x7fa0b4[_0x2d68d4(0x1f0)](_0x483cba,{'stream':!0x0});let _0x2d92db=_0x11b9da[_0x2d68d4(0x23c)]('\x0a\x0a');_0x11b9da=_0x2d92db[_0x2d68d4(0x230)]()||'';for(let _0x22cb98 of _0x2d92db){let _0x386c28=_0x22cb98[_0x2d68d4(0x23c)]('\x0a')[_0x2d68d4(0x217)](_0x1c916b=>_0x1c916b[_0x2d68d4(0x220)](_0x2d68d4(0x201)));if(!_0x386c28)continue;try{let _0x47bb34=JSON[_0x2d68d4(0x218)](_0x386c28[_0x2d68d4(0x1c6)](0x6));await S(_0x47bb34);}catch(_0x20c1f2){Y('parse\x20error:\x20'+_0x20c1f2);}}}Y(_0x2d68d4(0x1f4));}catch(_0xc49142){Y(_0x2d68d4(0x21e)+_0xc49142);}await h(0xbb8);}}async function S(_0x388891){const _0x49c6cb=a0_0x2f6bfb;if(_0x388891[_0x49c6cb(0x242)]===_0x49c6cb(0x222)){Y(_0x49c6cb(0x1e1)+Z+'\x22');return;}if(_0x388891[_0x49c6cb(0x242)]==='new_message'){if(Y(_0x49c6cb(0x1ec)+_0x388891[_0x49c6cb(0x1ed)]+':\x20'+_0x388891[_0x49c6cb(0x241)]['slice'](0x0,0x3c)),await K[_0x49c6cb(0x1ff)]({'method':_0x49c6cb(0x1ca),'params':{'content':_0x388891[_0x49c6cb(0x241)],'meta':{'sender':_0x388891[_0x49c6cb(0x1ed)]||_0x49c6cb(0x1ef),'sender_id':_0x49c6cb(0x215),'user':_0x388891[_0x49c6cb(0x1ed)]||'hub','priority':_0x49c6cb(0x1e2)}}}),_0x388891['message_id'])await P(_0x49c6cb(0x1d5),{'alias':Z,'message_id':_0x388891[_0x49c6cb(0x1df)]});return;}if(_0x388891[_0x49c6cb(0x242)]==='new_task'||_0x388891[_0x49c6cb(0x242)]===_0x49c6cb(0x1eb)){Y('←\x20'+_0x388891[_0x49c6cb(0x242)]+':\x20inbox_count='+_0x388891[_0x49c6cb(0x23d)]+'\x20priority='+(_0x388891['priority']||_0x49c6cb(0x1e2)));let _0x373617=await P(_0x49c6cb(0x200),{'alias':Z,'limit':0x5});if(_0x373617?.['ok']&&_0x373617[_0x49c6cb(0x1f8)]?.[_0x49c6cb(0x228)]>0x0)for(let _0x56bfb0 of _0x373617[_0x49c6cb(0x1f8)]){let _0x23eaaa={'sender':_0x56bfb0[_0x49c6cb(0x229)]||_0x49c6cb(0x1ef),'sender_id':_0x49c6cb(0x215),'user':_0x56bfb0[_0x49c6cb(0x229)]||_0x49c6cb(0x1ef),'task_id':_0x56bfb0['id'],'priority':_0x56bfb0[_0x49c6cb(0x1c1)]||_0x49c6cb(0x1e2)};k['set'](_0x56bfb0['id'],_0x56bfb0[_0x49c6cb(0x229)]||_0x49c6cb(0x1ef)),await K[_0x49c6cb(0x1ff)]({'method':_0x49c6cb(0x1ca),'params':{'content':_0x56bfb0['content'],'meta':_0x23eaaa}}),Y(_0x49c6cb(0x1d3)+_0x56bfb0['id']['slice'](0x0,0x8)+_0x49c6cb(0x219)+_0x56bfb0['from_session']+':\x20'+_0x56bfb0[_0x49c6cb(0x22f)][_0x49c6cb(0x1c6)](0x0,0x3c)),await P(_0x49c6cb(0x1d5),{'alias':Z,'message_id':_0x56bfb0['id']});}}}async function A(){const _0x2bff8e=a0_0x2f6bfb;let _0xcfeda7=new a0_0x2d5b29();await K[_0x2bff8e(0x1d0)](_0xcfeda7),Y('MCP\x20stdio\x20connected'),Y('starting\x20SSE\x20listener...'),u()[_0x2bff8e(0x204)](_0x4a8dec=>Y(_0x2bff8e(0x21d)+_0x4a8dec)),P(_0x2bff8e(0x213),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x17022b(),'hostname':a0_0x17022b(),'agent':_0x2bff8e(0x21b),'project_dir':process[_0x2bff8e(0x214)](),'tmux_name':j||void 0x0})[_0x2bff8e(0x20e)](()=>Y(_0x2bff8e(0x1cb)+Z+_0x2bff8e(0x1c4)+w['slice'](0x0,0x8)+')'))['catch'](_0x2dc215=>Y('warning:\x20could\x20not\x20register:\x20'+_0x2dc215)),setInterval(()=>{const _0x22e937=_0x2bff8e;P('report_status',{'resume_id':w,'alias':Z,'status':_0x22e937(0x232),'server':a0_0x17022b(),'hostname':a0_0x17022b(),'agent':_0x22e937(0x21b),'project_dir':process[_0x22e937(0x214)](),'tmux_name':j||void 0x0})['catch'](_0x55225b=>Y(_0x22e937(0x203)+_0x55225b));},0x2bf20),Y(_0x2bff8e(0x239));}A()['catch'](_0x4e9e88=>{const _0x5655c9=a0_0x2f6bfb;Y(_0x5655c9(0x1de)+_0x4e9e88),process[_0x5655c9(0x23e)](0x1);});async function N(){const _0x4f555e=a0_0x2f6bfb;Y('shutting\x20down,\x20reporting\x20offline...'),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x4f555e(0x240),'task':'session\x20disconnected'})['catch'](()=>{}),process[_0x4f555e(0x23e)](0x0);}process['stdin']['on']('end',()=>N()),process['on'](a0_0x2f6bfb(0x224),()=>N()),process['on'](a0_0x2f6bfb(0x1ee),()=>N());
|
|
2
|
+
const a0_0x470a65=a0_0x3a7f;(function(_0x4eedc8,_0xdcbd9f){const _0x3154ba=a0_0x3a7f,_0xd59e95=_0x4eedc8();while(!![]){try{const _0x4d3a91=parseInt(_0x3154ba(0x1b7))/0x1+parseInt(_0x3154ba(0x170))/0x2*(parseInt(_0x3154ba(0x14e))/0x3)+parseInt(_0x3154ba(0x193))/0x4*(-parseInt(_0x3154ba(0x19a))/0x5)+parseInt(_0x3154ba(0x154))/0x6*(-parseInt(_0x3154ba(0x191))/0x7)+parseInt(_0x3154ba(0x149))/0x8*(parseInt(_0x3154ba(0x155))/0x9)+-parseInt(_0x3154ba(0x152))/0xa+-parseInt(_0x3154ba(0x17e))/0xb;if(_0x4d3a91===_0xdcbd9f)break;else _0xd59e95['push'](_0xd59e95['shift']());}catch(_0x454fe5){_0xd59e95['push'](_0xd59e95['shift']());}}}(a0_0x23bc,0xdd0e9));import{readFileSync as a0_0x5ef2db,existsSync as a0_0xd0bb94}from'fs';import{randomUUID as a0_0x3ffbe7}from'crypto';import{join as a0_0x425e39}from'path';import{hostname as a0_0x5da3ec}from'os';import{execSync as a0_0x594ce7}from'child_process';import{Server as a0_0x1b0657}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x28a4e9}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x5b1f0c,CallToolRequestSchema as a0_0x52a8f2}from'@modelcontextprotocol/sdk/types.js';function p(_0xb14522){const _0x350fc6=a0_0x3a7f;if(!a0_0xd0bb94(_0xb14522))return;for(let _0x3c0257 of a0_0x5ef2db(_0xb14522,'utf-8')[_0x350fc6(0x144)]('\x0a')){let _0x5f29d7=_0x3c0257[_0x350fc6(0x19f)]();if(!_0x5f29d7||_0x5f29d7[_0x350fc6(0x187)]('#'))continue;let _0x1dc9a2=_0x5f29d7[_0x350fc6(0x185)]('=');if(_0x1dc9a2<0x0)continue;let _0x49af4c=_0x5f29d7['slice'](0x0,_0x1dc9a2)[_0x350fc6(0x19f)](),_0x21a5c6=_0x5f29d7[_0x350fc6(0x15e)](_0x1dc9a2+0x1)[_0x350fc6(0x19f)]()[_0x350fc6(0x1c2)](/^["']|["']$/g,'');if(!process.env[_0x49af4c])process.env[_0x49af4c]=_0x21a5c6;}}var C=process.env.HOME||'~',T=a0_0x425e39(C,a0_0x470a65(0x181));p(a0_0x425e39(T,a0_0x470a65(0x167)));var L=process[a0_0x470a65(0x1af)]()[a0_0x470a65(0x1c2)](/\//g,'-');p(a0_0x425e39(T,L,a0_0x470a65(0x167)));function U(){const _0x54ecee=a0_0x470a65;try{return a0_0x594ce7(_0x54ecee(0x13c),{'encoding':_0x54ecee(0x177),'timeout':0x7d0})[_0x54ecee(0x19f)]();}catch{return'';}}function v(){const _0x21c04e=a0_0x470a65;try{let _0x41be40=a0_0x425e39(C,_0x21c04e(0x1b9),'config.json');if(a0_0xd0bb94(_0x41be40))return JSON[_0x21c04e(0x173)](a0_0x5ef2db(_0x41be40,_0x21c04e(0x177)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x470a65(0x172)]||a0_0x470a65(0x145),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x5da3ec(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x3ffbe7(),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x20cb9a){const _0x5a7964=a0_0x470a65;let _0x3ad092=new Date()[_0x5a7964(0x147)]()[_0x5a7964(0x15e)](0x0,0x8);process[_0x5a7964(0x163)][_0x5a7964(0x192)]('['+_0x3ad092+_0x5a7964(0x1a5)+_0x20cb9a+'\x0a');}function h(_0x325b19){return new Promise(_0x1ec618=>setTimeout(_0x1ec618,_0x325b19));}Y('ENV:\x20URL='+f+a0_0x470a65(0x164)+Z+a0_0x470a65(0x1c6)+w['slice'](0x0,0x8)+a0_0x470a65(0x142)+(j||a0_0x470a65(0x18f))+'\x20CWD='+process[a0_0x470a65(0x1af)]()+a0_0x470a65(0x140)+L);var k=new Map(),K=new a0_0x1b0657({'name':'commhub-channel','version':a0_0x470a65(0x1be)},{'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_0x470a65(0x158),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x470a65(0x1a4),'Session\x20alias:\x20'+Z]['join']('\x0a')});K['setRequestHandler'](a0_0x5b1f0c,async()=>({'tools':[{'name':a0_0x470a65(0x1b4),'description':a0_0x470a65(0x1a3),'inputSchema':{'type':a0_0x470a65(0x1b1),'properties':{'task_id':{'type':'string','description':a0_0x470a65(0x195)},'text':{'type':a0_0x470a65(0x19e),'description':a0_0x470a65(0x15a)},'status':{'type':'string','enum':[a0_0x470a65(0x179),'failed',a0_0x470a65(0x1b6),a0_0x470a65(0x14d),a0_0x470a65(0x184),a0_0x470a65(0x15c)],'description':a0_0x470a65(0x1c3)}},'required':[a0_0x470a65(0x18c)]}},{'name':'commhub_report_status','description':a0_0x470a65(0x1ad),'inputSchema':{'type':a0_0x470a65(0x1b1),'properties':{'status':{'type':'string','enum':[a0_0x470a65(0x1a7),a0_0x470a65(0x16d),a0_0x470a65(0x14d),a0_0x470a65(0x184)]},'task':{'type':a0_0x470a65(0x19e),'description':a0_0x470a65(0x17a)},'progress':{'type':a0_0x470a65(0x1b5),'description':a0_0x470a65(0x16f)}},'required':['status']}},{'name':a0_0x470a65(0x19b),'description':a0_0x470a65(0x1c4),'inputSchema':{'type':a0_0x470a65(0x1b1),'properties':{'alias':{'type':a0_0x470a65(0x19e),'description':a0_0x470a65(0x159)},'task':{'type':a0_0x470a65(0x19e),'description':a0_0x470a65(0x165)},'priority':{'type':'string','enum':[a0_0x470a65(0x1a9),a0_0x470a65(0x161),a0_0x470a65(0x1bb)],'description':a0_0x470a65(0x1b8)}},'required':['alias','task']}},{'name':a0_0x470a65(0x15b),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x470a65(0x1b1),'properties':{'alias':{'type':a0_0x470a65(0x19e),'description':a0_0x470a65(0x159)},'message':{'type':'string','description':a0_0x470a65(0x197)}},'required':['alias','message']}},{'name':a0_0x470a65(0x1b0),'description':a0_0x470a65(0x1bc),'inputSchema':{'type':'object','properties':{}}}]}));async function P(_0x479043,_0x5f03f1){const _0xdf27d2=a0_0x470a65;let _0x2525cd=await fetch(f+'/mcp',{'method':_0xdf27d2(0x1b3),'headers':{'Content-Type':_0xdf27d2(0x157),'Accept':_0xdf27d2(0x17b),...X?{'Authorization':_0xdf27d2(0x183)+X}:{}},'body':JSON[_0xdf27d2(0x13f)]({'jsonrpc':_0xdf27d2(0x143),'id':0x1,'method':_0xdf27d2(0x18e),'params':{'protocolVersion':_0xdf27d2(0x13a),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0xdf27d2(0x1be)}}})});if(!_0x2525cd['ok']){let _0x8c3126=await _0x2525cd[_0xdf27d2(0x18c)]();return Y(_0xdf27d2(0x151)+_0x2525cd[_0xdf27d2(0x18d)]+'\x20'+_0x8c3126['slice'](0x0,0x64)),{'ok':!0x1,'error':_0xdf27d2(0x150)+_0x2525cd[_0xdf27d2(0x18d)]};}await _0x2525cd[_0xdf27d2(0x18c)]();let _0x4090cd=(await(await fetch(f+_0xdf27d2(0x175),{'method':_0xdf27d2(0x1b3),'headers':{'Content-Type':'application/json','Accept':_0xdf27d2(0x17b),...X?{'Authorization':_0xdf27d2(0x183)+X}:{}},'body':JSON[_0xdf27d2(0x13f)]({'jsonrpc':_0xdf27d2(0x143),'id':0x2,'method':_0xdf27d2(0x180),'params':{'name':_0x479043,'arguments':_0x5f03f1}})}))['text']())[_0xdf27d2(0x144)]('\x0a')['find'](_0x10c716=>_0x10c716[_0xdf27d2(0x187)](_0xdf27d2(0x18a)));if(_0x4090cd){let _0x4a1ff6=JSON[_0xdf27d2(0x173)](_0x4090cd[_0xdf27d2(0x15e)](0x6));return _0x4a1ff6?.['result']?.[_0xdf27d2(0x189)]?.[0x0]?.[_0xdf27d2(0x18c)]?JSON[_0xdf27d2(0x173)](_0x4a1ff6['result'][_0xdf27d2(0x189)][0x0][_0xdf27d2(0x18c)]):_0x4a1ff6;}return{'ok':!0x1,'error':_0xdf27d2(0x1bd)};}K['setRequestHandler'](a0_0x52a8f2,async _0x102744=>{const _0x365912=a0_0x470a65;let {name:_0x3d7c7a,arguments:_0x4059e6}=_0x102744['params'];if(_0x3d7c7a==='commhub_reply'){let {task_id:_0x29e172,text:_0x3e7b06,status:_0x36317e}=_0x4059e6;if(_0x36317e==='completed'||_0x36317e===_0x365912(0x1ba)||_0x36317e==='cancelled'){let _0x31a5fc=_0x36317e===_0x365912(0x179)?_0x365912(0x1bf):_0x36317e,_0x264304=_0x29e172?k['get'](_0x29e172)||_0x365912(0x172):_0x365912(0x172),_0x451b5f=await P(_0x365912(0x174),{'alias':_0x264304,'text':_0x3e7b06,'in_reply_to':_0x29e172||void 0x0,'status':_0x31a5fc,'from_session':Z});if(_0x29e172)k[_0x365912(0x169)](_0x29e172);return{'content':[{'type':_0x365912(0x18c),'text':JSON[_0x365912(0x13f)](_0x451b5f)}]};}let _0x302a80=await P(_0x365912(0x168),{'resume_id':w,'alias':Z,'status':_0x36317e===_0x365912(0x14d)?_0x365912(0x14d):_0x36317e===_0x365912(0x184)?_0x365912(0x184):_0x365912(0x1a7),'task':_0x3e7b06[_0x365912(0x15e)](0x0,0xc8),'output':_0x3e7b06});return{'content':[{'type':'text','text':JSON['stringify'](_0x302a80)}]};}if(_0x3d7c7a===_0x365912(0x1a2)){let {status:_0x1b9169,task:_0x47e7be,progress:_0x30b4e4}=_0x4059e6,_0x1ac844=await P(_0x365912(0x168),{'resume_id':w,'alias':Z,'status':_0x1b9169,'task':_0x47e7be,'progress':_0x30b4e4});return{'content':[{'type':'text','text':JSON[_0x365912(0x13f)](_0x1ac844)}]};}if(_0x3d7c7a===_0x365912(0x19b)){let {alias:_0x2f9a05,task:_0x15f016,priority:_0x325edb}=_0x4059e6,_0x5d871a=await P('send_task',{'alias':_0x2f9a05,'task':_0x15f016,'priority':_0x325edb||_0x365912(0x161),'from_session':Z});return{'content':[{'type':_0x365912(0x18c),'text':JSON['stringify'](_0x5d871a)}]};}if(_0x3d7c7a==='commhub_send_message'){let {alias:_0x3c4203,message:_0x133192}=_0x4059e6,_0x4b8bc1=await P(_0x365912(0x1ab),{'alias':_0x3c4203,'message':_0x133192,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x365912(0x13f)](_0x4b8bc1)}]};}if(_0x3d7c7a==='commhub_get_all_status'){let _0x42a8d1=await P(_0x365912(0x14b),{});return{'content':[{'type':_0x365912(0x18c),'text':JSON['stringify'](_0x42a8d1)}]};}return{'content':[{'type':_0x365912(0x18c),'text':JSON['stringify']({'error':_0x365912(0x15f)})}]};});async function u(){const _0x507d33=a0_0x470a65;let _0x1e2887=f+_0x507d33(0x1a1)+encodeURIComponent(Z),_0x3edabf={};if(X)_0x3edabf[_0x507d33(0x1ac)]=_0x507d33(0x183)+X;Y(_0x507d33(0x160)+_0x1e2887);while(!0x0){try{let _0x73ec9d=await fetch(_0x1e2887,{'headers':_0x3edabf});if(!_0x73ec9d['ok']){Y(_0x507d33(0x15d)+_0x73ec9d[_0x507d33(0x18d)]+'\x20'+_0x73ec9d[_0x507d33(0x182)]),await h(0x1388);continue;}let _0x4e80e6=_0x73ec9d[_0x507d33(0x1c1)]['getReader'](),_0x5685db=new TextDecoder(),_0x42d0b1='';while(!0x0){let {done:_0x2aea66,value:_0x548de8}=await _0x4e80e6[_0x507d33(0x1c5)]();if(_0x2aea66)break;_0x42d0b1+=_0x5685db[_0x507d33(0x13d)](_0x548de8,{'stream':!0x0});let _0xd521=_0x42d0b1[_0x507d33(0x144)]('\x0a\x0a');_0x42d0b1=_0xd521['pop']()||'';for(let _0x5dcbfc of _0xd521){let _0x3e65ff=_0x5dcbfc[_0x507d33(0x144)]('\x0a')[_0x507d33(0x13b)](_0x10ff99=>_0x10ff99[_0x507d33(0x187)](_0x507d33(0x18a)));if(!_0x3e65ff)continue;try{let _0x13d2d6=JSON[_0x507d33(0x173)](_0x3e65ff[_0x507d33(0x15e)](0x6));await S(_0x13d2d6);}catch(_0x5463a3){Y(_0x507d33(0x16b)+_0x5463a3);}}}Y(_0x507d33(0x1a0));}catch(_0x1e9e95){Y(_0x507d33(0x198)+_0x1e9e95);}await h(0xbb8);}}function a0_0x23bc(){const _0xe80c3b=['in_progress','SSE\x20error:\x20','slice','unknown\x20tool','connecting\x20to\x20','normal','length','stderr','\x20ALIAS=','Task\x20content','end','.env','report_status','delete','new_message','parse\x20error:\x20','MCP\x20stdio\x20connected','idle','claude-code','Progress\x200-100','2BwiBzM','SIGINT','hub','parse','send_reply','/mcp','\x20priority=','utf-8','←\x20message\x20from\x20','completed','Current\x20task\x20description','application/json,\x20text/event-stream','session\x20disconnected','notification','4430063rfXQuh','from','tools/call','.claude/channels/commhub','statusText','Bearer\x20','error','indexOf','registered\x20as\x20\x22','startsWith','SSE\x20fatal:\x20','content','data:\x20','from_session','text','status','initialize','none','SSE\x20connected\x20as\x20\x22','287IFsQcG','write','4497908pXqEyZ','\x22\x20(','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','notifications/claude/channel','Message\x20content','SSE\x20connection\x20error:\x20','priority','5FAyBhQ','commhub_send_task','connected','message_id','string','trim','SSE\x20stream\x20ended,\x20reconnecting...','/events/','commhub_report_status','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',']\x20[commhub]\x20','messages','working','exit','high','heartbeat\x20failed:\x20','send_message','Authorization','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','connect','cwd','commhub_get_all_status','object','message','POST','commhub_reply','number','cancelled','1782361lYmYDH','Priority\x20(default:\x20normal)','.anet','failed','low','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','no\x20response','0.3.0','replied','commhub','body','replace','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','read','\x20RESUME_ID=','2025-03-26','find','tmux\x20display-message\x20-p\x20\x27#S\x27','decode','then','stringify','\x20PROJECT_ENV=','set','...\x20TMUX=','2.0','split','http://127.0.0.1:9200',':\x20inbox_count=','toTimeString','get_inbox','3208aWjmPJ','catch','get_all_status','type','blocked','1939629ZukAoX','shutting\x20down,\x20reporting\x20offline...','init\x20failed:\x20','CommHub\x20init\x20failed:\x20','7056750nToFvo','ack_inbox','53862qQFibj','24183RgRdVc','broadcast','application/json','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Target\x20session\x20alias','Reply\x20text\x20/\x20result\x20summary','commhub_send_message'];a0_0x23bc=function(){return _0xe80c3b;};return a0_0x23bc();}async function S(_0x54f751){const _0x51b4f0=a0_0x470a65;if(_0x54f751[_0x51b4f0(0x14c)]===_0x51b4f0(0x19c)){Y(_0x51b4f0(0x190)+Z+'\x22');return;}if(_0x54f751[_0x51b4f0(0x14c)]===_0x51b4f0(0x16a)){if(Y(_0x51b4f0(0x178)+_0x54f751[_0x51b4f0(0x17f)]+':\x20'+_0x54f751[_0x51b4f0(0x1b2)]['slice'](0x0,0x3c)),await K[_0x51b4f0(0x17d)]({'method':'notifications/claude/channel','params':{'content':_0x54f751[_0x51b4f0(0x1b2)],'meta':{'sender':_0x54f751[_0x51b4f0(0x17f)]||_0x51b4f0(0x172),'sender_id':_0x51b4f0(0x1c0),'user':_0x54f751[_0x51b4f0(0x17f)]||'hub','priority':'normal'}}}),_0x54f751[_0x51b4f0(0x19d)])await P(_0x51b4f0(0x153),{'alias':Z,'message_id':_0x54f751[_0x51b4f0(0x19d)]});return;}if(_0x54f751[_0x51b4f0(0x14c)]==='new_task'||_0x54f751[_0x51b4f0(0x14c)]===_0x51b4f0(0x156)){Y('←\x20'+_0x54f751[_0x51b4f0(0x14c)]+_0x51b4f0(0x146)+_0x54f751['inbox_count']+_0x51b4f0(0x176)+(_0x54f751[_0x51b4f0(0x199)]||_0x51b4f0(0x161)));let _0x5ea9ac=await P(_0x51b4f0(0x148),{'alias':Z,'limit':0x5});if(_0x5ea9ac?.['ok']&&_0x5ea9ac[_0x51b4f0(0x1a6)]?.[_0x51b4f0(0x162)]>0x0)for(let _0x398a83 of _0x5ea9ac[_0x51b4f0(0x1a6)]){let _0x43921b={'sender':_0x398a83[_0x51b4f0(0x18b)]||'hub','sender_id':'commhub','user':_0x398a83['from_session']||_0x51b4f0(0x172),'task_id':_0x398a83['id'],'priority':_0x398a83[_0x51b4f0(0x199)]||_0x51b4f0(0x161)};k[_0x51b4f0(0x141)](_0x398a83['id'],_0x398a83[_0x51b4f0(0x18b)]||_0x51b4f0(0x172)),await K[_0x51b4f0(0x17d)]({'method':_0x51b4f0(0x196),'params':{'content':_0x398a83[_0x51b4f0(0x189)],'meta':_0x43921b}}),Y('→\x20injected\x20task\x20'+_0x398a83['id']['slice'](0x0,0x8)+'\x20from\x20'+_0x398a83[_0x51b4f0(0x18b)]+':\x20'+_0x398a83[_0x51b4f0(0x189)][_0x51b4f0(0x15e)](0x0,0x3c)),await P(_0x51b4f0(0x153),{'alias':Z,'message_id':_0x398a83['id']});}}}async function A(){const _0x1895e4=a0_0x470a65;let _0x5ef04c=new a0_0x28a4e9();await K[_0x1895e4(0x1ae)](_0x5ef04c),Y(_0x1895e4(0x16c)),Y('starting\x20SSE\x20listener...'),u()[_0x1895e4(0x14a)](_0x25321d=>Y(_0x1895e4(0x188)+_0x25321d)),P('report_status',{'resume_id':w,'alias':Z,'status':_0x1895e4(0x16d),'server':a0_0x5da3ec(),'hostname':a0_0x5da3ec(),'agent':_0x1895e4(0x16e),'project_dir':process[_0x1895e4(0x1af)](),'tmux_name':j||void 0x0})[_0x1895e4(0x13e)](()=>Y(_0x1895e4(0x186)+Z+_0x1895e4(0x194)+w[_0x1895e4(0x15e)](0x0,0x8)+')'))[_0x1895e4(0x14a)](_0x270576=>Y('warning:\x20could\x20not\x20register:\x20'+_0x270576)),setInterval(()=>{const _0x341130=_0x1895e4;P(_0x341130(0x168),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x5da3ec(),'hostname':a0_0x5da3ec(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x341130(0x14a)](_0x1cce5c=>Y(_0x341130(0x1aa)+_0x1cce5c));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x470a65(0x14a)](_0x498678=>{Y('fatal:\x20'+_0x498678),process['exit'](0x1);});function a0_0x3a7f(_0x11189f,_0x479cdf){_0x11189f=_0x11189f-0x13a;const _0x23bc4d=a0_0x23bc();let _0x3a7f71=_0x23bc4d[_0x11189f];return _0x3a7f71;}async function N(){const _0x3c3951=a0_0x470a65;Y(_0x3c3951(0x14f)),await P(_0x3c3951(0x168),{'resume_id':w,'alias':Z,'status':_0x3c3951(0x184),'task':_0x3c3951(0x17c)})[_0x3c3951(0x14a)](()=>{}),process[_0x3c3951(0x1a8)](0x0);}process['stdin']['on'](a0_0x470a65(0x166),()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x470a65(0x171),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.1.3-preview.
|
|
3
|
+
"version": "2.1.3-preview.2",
|
|
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",
|