@sleep2agi/agent-network 2.0.0-preview.4 → 2.0.0-preview.6
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
|
-
|
|
1
|
+
function a0_0x2bc2(){const _0x467141=['log','SSE\x20reconnecting\x20in\x20','now','status','url','connect','offline','messages','send_task','toString','27FQlmba','report_status','/mcp','type','567vTDcAj','task','registered','signal','stringify','/events/','running','2514170OxYSpC','2.0','24QPdcUS','new_message','sdk-','reply','content','heartbeatInterval','reconnectDelay',']\x20[commhub:','4824jQGDGi','connectSSE','parse','autoConnect','message','emit','slice','50414zDmaZd','completed','decode','Authorization','getReader','send','2747965AWhGMM','587562vQcLKk','SSE\x20connected','text/event-stream','heartbeat\x20failed:\x20','catch','ack_inbox','sseAbort','SSE\x20failed:\x20','token','startsWith','normal','processInbox','inbox\x20error:\x20','send_message','from_session','get_all_status','SSE\x20error:\x20','broadcast','get_inbox','4026sNvObD','name','idle','sleep','1wuyDsR','s...','application/json','new_task','call','POST','body','11068GFdXyg','tools/call','Bearer\x20','1336616iaFVNM','match','split','agent','disconnect','getAllStatus','text','resumeId','replace','read','data:\x20','heartbeatTimer','toTimeString','cwd','connected','alias','AbortError','disconnected','min'];a0_0x2bc2=function(){return _0x467141;};return a0_0x2bc2();}const a0_0x151ed8=a0_0x149a;(function(_0x522ac3,_0x48c33f){const _0x48c642=a0_0x149a,_0x4f9978=_0x522ac3();while(!![]){try{const _0x337993=parseInt(_0x48c642(0xee))/0x1*(-parseInt(_0x48c642(0xd7))/0x2)+parseInt(_0x48c642(0xb8))/0x3*(-parseInt(_0x48c642(0xf5))/0x4)+parseInt(_0x48c642(0xd6))/0x5+-parseInt(_0x48c642(0xc1))/0x6*(parseInt(_0x48c642(0xd0))/0x7)+-parseInt(_0x48c642(0xf8))/0x8*(-parseInt(_0x48c642(0xb4))/0x9)+parseInt(_0x48c642(0xbf))/0xa+-parseInt(_0x48c642(0xea))/0xb*(parseInt(_0x48c642(0xc9))/0xc);if(_0x337993===_0x48c33f)break;else _0x4f9978['push'](_0x4f9978['shift']());}catch(_0x29198f){_0x4f9978['push'](_0x4f9978['shift']());}}}(a0_0x2bc2,0x4b935));function a0_0x149a(_0x48c686,_0x3bf1ae){_0x48c686=_0x48c686-0xae;const _0x2bc284=a0_0x2bc2();let _0x149aac=_0x2bc284[_0x48c686];return _0x149aac;}import{EventEmitter as a0_0x2bdbfb}from'events';import{hostname as a0_0x1e35e8}from'os';class T extends a0_0x2bdbfb{[a0_0x151ed8(0xae)];[a0_0x151ed8(0x107)];['token'];[a0_0x151ed8(0xfb)];['resumeId'];[a0_0x151ed8(0xc6)];[a0_0x151ed8(0xc7)];[a0_0x151ed8(0x103)];[a0_0x151ed8(0xdd)];[a0_0x151ed8(0xbe)]=!0x1;constructor(_0x52bb3f){const _0x5297c2=a0_0x151ed8;super();if(this[_0x5297c2(0xae)]=_0x52bb3f['url'][_0x5297c2(0x100)](/\/$/,''),this[_0x5297c2(0x107)]=_0x52bb3f['alias'],this['token']=_0x52bb3f[_0x5297c2(0xdf)],this[_0x5297c2(0xfb)]=_0x52bb3f[_0x5297c2(0xfb)]||'sdk',this[_0x5297c2(0xff)]=_0x5297c2(0xc3)+_0x52bb3f['alias']+'-'+Date[_0x5297c2(0x10d)]()[_0x5297c2(0xb3)](0x24),this[_0x5297c2(0xc6)]=_0x52bb3f[_0x5297c2(0xc6)]??0x2bf20,this['reconnectDelay']=_0x52bb3f[_0x5297c2(0xc7)]??0xbb8,_0x52bb3f[_0x5297c2(0xcc)]!==!0x1)this[_0x5297c2(0xaf)]();}['log'](_0x1adcb7){const _0x1ec9e7=a0_0x151ed8;console[_0x1ec9e7(0x10b)]('['+new Date()[_0x1ec9e7(0x104)]()[_0x1ec9e7(0xcf)](0x0,0x8)+_0x1ec9e7(0xc8)+this[_0x1ec9e7(0x107)]+']\x20'+_0x1adcb7);}async[a0_0x151ed8(0xf2)](_0x4d41c2,_0xf9f21e){const _0x3618ef=a0_0x151ed8;let _0x5bf539={'Content-Type':_0x3618ef(0xf0),'Accept':'application/json,\x20text/event-stream'};if(this[_0x3618ef(0xdf)])_0x5bf539[_0x3618ef(0xd3)]=_0x3618ef(0xf7)+this[_0x3618ef(0xdf)];let _0x5bfb1b=await(await fetch(this[_0x3618ef(0xae)]+_0x3618ef(0xb6),{'method':_0x3618ef(0xf3),'headers':_0x5bf539,'body':JSON[_0x3618ef(0xbc)]({'jsonrpc':_0x3618ef(0xc0),'id':Date[_0x3618ef(0x10d)](),'method':_0x3618ef(0xf6),'params':{'name':_0x4d41c2,'arguments':_0xf9f21e}})}))[_0x3618ef(0xfe)](),_0x47ed83=_0x5bfb1b[_0x3618ef(0xf9)](/data: (.+)/),_0xaf3ba1=_0x47ed83?JSON['parse'](_0x47ed83[0x1]):JSON[_0x3618ef(0xcb)](_0x5bfb1b),_0x1fe469=_0xaf3ba1?.['result']?.[_0x3618ef(0xc5)]?.[0x0]?.[_0x3618ef(0xfe)];return _0x1fe469?JSON[_0x3618ef(0xcb)](_0x1fe469):_0xaf3ba1;}async[a0_0x151ed8(0xaf)](){const _0x253601=a0_0x151ed8;if(this[_0x253601(0xbe)])return;this['running']=!0x0,await this['status'](_0x253601(0xec)),this[_0x253601(0x10b)](_0x253601(0xba)),this[_0x253601(0x103)]=setInterval(()=>{const _0x543c42=_0x253601;this[_0x543c42(0x10e)]('idle')[_0x543c42(0xdb)](_0x4c22bd=>this[_0x543c42(0x10b)](_0x543c42(0xda)+_0x4c22bd[_0x543c42(0xcd)]));},this['heartbeatInterval']),this[_0x253601(0xca)]();}async[a0_0x151ed8(0xfc)](){const _0x1bda5d=a0_0x151ed8;if(this[_0x1bda5d(0xbe)]=!0x1,this[_0x1bda5d(0xdd)]?.['abort'](),this['heartbeatTimer'])clearInterval(this[_0x1bda5d(0x103)]);await this[_0x1bda5d(0x10e)](_0x1bda5d(0xb0))[_0x1bda5d(0xdb)](()=>{}),this[_0x1bda5d(0x10b)](_0x1bda5d(0x109));}async[a0_0x151ed8(0xd5)](_0x3ec851,_0x291dea,_0x4f081d=a0_0x151ed8(0xe1)){const _0x22146b=a0_0x151ed8;return this['call'](_0x22146b(0xb2),{'alias':_0x3ec851,'task':_0x291dea,'priority':_0x4f081d,'from_session':this[_0x22146b(0x107)]});}async[a0_0x151ed8(0xcd)](_0x50f069,_0x2bcfd1){const _0x29f462=a0_0x151ed8;return this['call'](_0x29f462(0xe4),{'alias':_0x50f069,'message':_0x2bcfd1,'from_session':this[_0x29f462(0x107)]});}async[a0_0x151ed8(0xc4)](_0x756317,_0x2ee616,_0x3679de=a0_0x151ed8(0xd1)){const _0x455255=a0_0x151ed8;return this[_0x455255(0xf2)](_0x455255(0xc4),{'task_id':_0x756317,'text':_0x2ee616,'status':_0x3679de});}async['status'](_0x299b04,_0x46a288){const _0x5e8dff=a0_0x151ed8;return this[_0x5e8dff(0xf2)](_0x5e8dff(0xb5),{'resume_id':this['resumeId'],'alias':this[_0x5e8dff(0x107)],'status':_0x299b04,'server':a0_0x1e35e8(),'hostname':a0_0x1e35e8(),'agent':this[_0x5e8dff(0xfb)],'project_dir':process[_0x5e8dff(0x105)](),..._0x46a288});}async[a0_0x151ed8(0xfd)](){const _0x109b0d=a0_0x151ed8;return this[_0x109b0d(0xf2)](_0x109b0d(0xe6),{});}async[a0_0x151ed8(0xe8)](_0x45fc24,_0x1afd25){const _0x489298=a0_0x151ed8;return this[_0x489298(0xf2)]('broadcast',{'message':_0x45fc24,'filter_server':_0x1afd25?.['server'],'filter_status':_0x1afd25?.['status']});}async['connectSSE'](){const _0x21a8c3=a0_0x151ed8;let _0x6f02d9=encodeURIComponent(this[_0x21a8c3(0x107)]),_0x266a78=this[_0x21a8c3(0xae)]+_0x21a8c3(0xbd)+_0x6f02d9,_0x5de7e6=this[_0x21a8c3(0xc7)];while(this[_0x21a8c3(0xbe)]){try{this[_0x21a8c3(0xdd)]=new AbortController();let _0x23c709={'Accept':_0x21a8c3(0xd9)};if(this[_0x21a8c3(0xdf)])_0x23c709['Authorization']='Bearer\x20'+this[_0x21a8c3(0xdf)];let _0x426f15=await fetch(_0x266a78,{'headers':_0x23c709,'signal':this[_0x21a8c3(0xdd)][_0x21a8c3(0xbb)]});if(!_0x426f15['ok']||!_0x426f15[_0x21a8c3(0xf4)]){this['log'](_0x21a8c3(0xde)+_0x426f15['status']),await this[_0x21a8c3(0xed)](_0x5de7e6),_0x5de7e6=Math[_0x21a8c3(0x10a)](_0x5de7e6*1.5,0xea60);continue;}_0x5de7e6=this[_0x21a8c3(0xc7)];let _0x20382a=_0x426f15['body'][_0x21a8c3(0xd4)](),_0xb0b4d5=new TextDecoder(),_0x1d4cef='';while(this[_0x21a8c3(0xbe)]){let {done:_0x539602,value:_0x25a0a8}=await _0x20382a[_0x21a8c3(0x101)]();if(_0x539602)break;_0x1d4cef+=_0xb0b4d5[_0x21a8c3(0xd2)](_0x25a0a8,{'stream':!0x0});let _0x1fd4dc=_0x1d4cef[_0x21a8c3(0xfa)]('\x0a');_0x1d4cef=_0x1fd4dc['pop']()||'';for(let _0x1ab166 of _0x1fd4dc){if(!_0x1ab166[_0x21a8c3(0xe0)](_0x21a8c3(0x102)))continue;try{let _0x48dabc=JSON[_0x21a8c3(0xcb)](_0x1ab166[_0x21a8c3(0xcf)](0x6));if(_0x48dabc[_0x21a8c3(0xb7)]===_0x21a8c3(0x106)){this[_0x21a8c3(0x10b)](_0x21a8c3(0xd8)),this[_0x21a8c3(0xce)](_0x21a8c3(0x106));continue;}if(_0x48dabc['type']===_0x21a8c3(0xf1)||_0x48dabc[_0x21a8c3(0xb7)]===_0x21a8c3(0xc2)||_0x48dabc['type']===_0x21a8c3(0xe8))await this[_0x21a8c3(0xe2)]();}catch{}}}}catch(_0x27de2c){if(_0x27de2c[_0x21a8c3(0xeb)]===_0x21a8c3(0x108))break;this['emit']('error',_0x27de2c),this[_0x21a8c3(0x10b)](_0x21a8c3(0xe7)+_0x27de2c[_0x21a8c3(0xcd)]);}if(this['running'])this[_0x21a8c3(0xce)](_0x21a8c3(0x109)),this[_0x21a8c3(0x10b)](_0x21a8c3(0x10c)+_0x5de7e6/0x3e8+_0x21a8c3(0xef)),await this['sleep'](_0x5de7e6),_0x5de7e6=Math[_0x21a8c3(0x10a)](_0x5de7e6*1.5,0xea60);}}async[a0_0x151ed8(0xe2)](){const _0x438c11=a0_0x151ed8;try{let _0x327f67=(await this[_0x438c11(0xf2)](_0x438c11(0xe9),{'alias':this[_0x438c11(0x107)],'limit':0xa}))?.[_0x438c11(0xb1)]||[];for(let _0x68c837 of _0x327f67)await this[_0x438c11(0xf2)](_0x438c11(0xdc),{'alias':this[_0x438c11(0x107)],'message_id':_0x68c837['id']}),this['log']('←\x20'+_0x68c837[_0x438c11(0xe5)]+':\x20'+_0x68c837['content'][_0x438c11(0xcf)](0x0,0x3c)),this[_0x438c11(0xce)](_0x438c11(0xb9),_0x68c837),this['emit'](_0x438c11(0xcd),_0x68c837);}catch(_0x55e4f0){this[_0x438c11(0x10b)](_0x438c11(0xe3)+_0x55e4f0['message']);}}[a0_0x151ed8(0xed)](_0x3e203f){return new Promise(_0x2586a2=>setTimeout(_0x2586a2,_0x3e203f));}}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
|
-
function a0_0x380a(){const _0x3e75bc=['36MlRZMV','cancelled','message','application/json,\x20text/event-stream','find','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','no\x20response','commhub_send_task','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','pop',':\x20inbox_count=','status','failed','slice','.env','SSE\x20connected\x20as\x20\x22','number','replace','Reply\x20text\x20/\x20result\x20summary','blocked','broadcast','split','←\x20message\x20from\x20','replied','in_progress','send_task','unknown\x20tool','hub','config.json','stringify','session\x20disconnected','indexOf','1537833LIhzQU','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','task','utf-8','type','heartbeat\x20failed:\x20','new_message','send_reply','ack_inbox','send_message','messages','join','fatal:\x20','\x20priority=','catch','working','length','message_id','Target\x20session\x20alias','.anet','MCP\x20stdio\x20connected','string','notification','Bearer\x20','POST','http://127.0.0.1:9200','get','commhub_reply','error','new_task','SSE\x20fatal:\x20','startsWith','result','get_all_status','idle','completed','getReader','/mcp','32ospNpH','data:\x20','stdin','\x20from\x20','commhub_send_message','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','from','claude-code','cwd','shutting\x20down,\x20reporting\x20offline...','report_status','priority','from_session','2.0','initialize','commhub-channel','low','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','text','init\x20failed:\x20','\x22\x20(','/events/','setRequestHandler','5211dIVUBw','high','2025-03-26','end','SSE\x20stream\x20ended,\x20reconnecting...','→\x20injected\x20task\x20','token','ready\x20—\x20waiting\x20for\x20events','\x20CWD=','object','3689735WTsjNS','tools/call','then','get_inbox','connect','1616832KzyIpE','trim','notifications/claude/channel','inbox_count','commhub_get_all_status','registered\x20as\x20\x22','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Session\x20alias:\x20','Priority\x20(default:\x20normal)','144cXKerl','2233GajMay','SSE\x20error:\x20','6699760xXOrsE','commhub','178qbSVQA','parse','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','starting\x20SSE\x20listener...','Progress\x200-100','body','commhub_report_status','content','normal','9369lTUWbX','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','\x20RESUME_ID=','15294xTPBYE'];a0_0x380a=function(){return _0x3e75bc;};return a0_0x380a();}const a0_0x662eba=a0_0x2ad0;(function(_0x3c8205,_0xb34067){const _0x193798=a0_0x2ad0,_0x377129=_0x3c8205();while(!![]){try{const _0x5e333b=-parseInt(_0x193798(0x23c))/0x1*(-parseInt(_0x193798(0x259))/0x2)+parseInt(_0x193798(0x1db))/0x3*(parseInt(_0x193798(0x1df))/0x4)+parseInt(_0x193798(0x246))/0x5+parseInt(_0x193798(0x1de))/0x6*(parseInt(_0x193798(0x255))/0x7)+-parseInt(_0x193798(0x225))/0x8*(-parseInt(_0x193798(0x24b))/0x9)+-parseInt(_0x193798(0x257))/0xa+parseInt(_0x193798(0x1ff))/0xb*(-parseInt(_0x193798(0x254))/0xc);if(_0x5e333b===_0xb34067)break;else _0x377129['push'](_0x377129['shift']());}catch(_0xa2a0cb){_0x377129['push'](_0x377129['shift']());}}}(a0_0x380a,0x650f8));import{readFileSync as a0_0xbb5b7,existsSync as a0_0x140c4b}from'fs';import{join as a0_0x1516f9}from'path';import{hostname as a0_0x584493}from'os';import{execSync as a0_0x36b5cf}from'child_process';import{Server as a0_0x15d5b7}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x5397f0}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x52eddb,CallToolRequestSchema as a0_0x578a26}from'@modelcontextprotocol/sdk/types.js';function p(_0x467110){const _0x463a79=a0_0x2ad0;if(!a0_0x140c4b(_0x467110))return;for(let _0x50cf14 of a0_0xbb5b7(_0x467110,_0x463a79(0x202))[_0x463a79(0x1f4)]('\x0a')){let _0x3b01db=_0x50cf14[_0x463a79(0x24c)]();if(!_0x3b01db||_0x3b01db['startsWith']('#'))continue;let _0x33c00c=_0x3b01db[_0x463a79(0x1fe)]('=');if(_0x33c00c<0x0)continue;let _0x377d3b=_0x3b01db[_0x463a79(0x1ec)](0x0,_0x33c00c)[_0x463a79(0x24c)](),_0x2048d3=_0x3b01db[_0x463a79(0x1ec)](_0x33c00c+0x1)[_0x463a79(0x24c)]()[_0x463a79(0x1f0)](/^["']|["']$/g,'');if(!process.env[_0x377d3b])process.env[_0x377d3b]=_0x2048d3;}}var C=process.env.HOME||'~',T=a0_0x1516f9(C,'.claude/channels/commhub');p(a0_0x1516f9(T,a0_0x662eba(0x1ed)));function a0_0x2ad0(_0x39a1fb,_0x421fbe){_0x39a1fb=_0x39a1fb-0x1d8;const _0x380aaa=a0_0x380a();let _0x2ad0e8=_0x380aaa[_0x39a1fb];return _0x2ad0e8;}var L=process[a0_0x662eba(0x22d)]()['replace'](/\//g,'-');p(a0_0x1516f9(T,L,a0_0x662eba(0x1ed)));function U(){const _0x4e3db6=a0_0x662eba;try{return a0_0x36b5cf('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x4e3db6(0x202),'timeout':0x7d0})[_0x4e3db6(0x24c)]();}catch{return'';}}function c(){const _0x14bfa1=a0_0x662eba;try{let _0x4c74e4=a0_0x1516f9(C,_0x14bfa1(0x212),_0x14bfa1(0x1fb));if(a0_0x140c4b(_0x4c74e4))return JSON['parse'](a0_0xbb5b7(_0x4c74e4,_0x14bfa1(0x202)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x662eba(0x1fa)]||a0_0x662eba(0x218),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x584493(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto['randomUUID'](),X=process.env.COMMHUB_TOKEN||H[a0_0x662eba(0x242)]||'';function Y(_0x3956e3){const _0x17f0a3=a0_0x662eba;let _0x36b965=new Date()['toTimeString']()[_0x17f0a3(0x1ec)](0x0,0x8);process['stderr']['write']('['+_0x36b965+']\x20[commhub]\x20'+_0x3956e3+'\x0a');}function h(_0x16eb01){return new Promise(_0x1dcd78=>setTimeout(_0x1dcd78,_0x16eb01));}Y('ENV:\x20URL='+D+'\x20ALIAS='+Z+a0_0x662eba(0x1dd)+w[a0_0x662eba(0x1ec)](0x0,0x8)+'...\x20TMUX='+(f||'none')+a0_0x662eba(0x244)+process[a0_0x662eba(0x22d)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x15d5b7({'name':a0_0x662eba(0x234),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x662eba(0x22a),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x662eba(0x200),a0_0x662eba(0x25b),a0_0x662eba(0x252)+Z][a0_0x662eba(0x20a)]('\x0a')});K[a0_0x662eba(0x23b)](a0_0x52eddb,async()=>({'tools':[{'name':a0_0x662eba(0x21a),'description':a0_0x662eba(0x1e4),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x662eba(0x214),'description':a0_0x662eba(0x236)},'text':{'type':'string','description':a0_0x662eba(0x1f1)},'status':{'type':'string','enum':[a0_0x662eba(0x222),a0_0x662eba(0x1eb),a0_0x662eba(0x1e0),a0_0x662eba(0x1f2),a0_0x662eba(0x21b),a0_0x662eba(0x1f7)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':['text']}},{'name':a0_0x662eba(0x1d8),'description':a0_0x662eba(0x251),'inputSchema':{'type':a0_0x662eba(0x245),'properties':{'status':{'type':a0_0x662eba(0x214),'enum':[a0_0x662eba(0x20e),'idle','blocked',a0_0x662eba(0x21b)]},'task':{'type':a0_0x662eba(0x214),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x662eba(0x1ef),'description':a0_0x662eba(0x25d)}},'required':[a0_0x662eba(0x1ea)]}},{'name':a0_0x662eba(0x1e6),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x662eba(0x214),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x662eba(0x214),'description':'Task\x20content'},'priority':{'type':'string','enum':[a0_0x662eba(0x23d),a0_0x662eba(0x1da),a0_0x662eba(0x235)],'description':a0_0x662eba(0x253)}},'required':['alias',a0_0x662eba(0x201)]}},{'name':a0_0x662eba(0x229),'description':a0_0x662eba(0x1dc),'inputSchema':{'type':a0_0x662eba(0x245),'properties':{'alias':{'type':a0_0x662eba(0x214),'description':a0_0x662eba(0x211)},'message':{'type':'string','description':'Message\x20content'}},'required':['alias','message']}},{'name':a0_0x662eba(0x24f),'description':a0_0x662eba(0x1e7),'inputSchema':{'type':a0_0x662eba(0x245),'properties':{}}}]}));async function P(_0x33190f,_0x27364f){const _0xad1ffd=a0_0x662eba;let _0xe871f4=await fetch(D+'/mcp',{'method':_0xad1ffd(0x217),'headers':{'Content-Type':'application/json','Accept':_0xad1ffd(0x1e2),...X?{'Authorization':_0xad1ffd(0x216)+X}:{}},'body':JSON[_0xad1ffd(0x1fc)]({'jsonrpc':_0xad1ffd(0x232),'id':0x1,'method':_0xad1ffd(0x233),'params':{'protocolVersion':_0xad1ffd(0x23e),'capabilities':{},'clientInfo':{'name':_0xad1ffd(0x234),'version':'0.3.0'}}})});if(!_0xe871f4['ok']){let _0x248afd=await _0xe871f4[_0xad1ffd(0x237)]();return Y('CommHub\x20init\x20failed:\x20'+_0xe871f4[_0xad1ffd(0x1ea)]+'\x20'+_0x248afd[_0xad1ffd(0x1ec)](0x0,0x64)),{'ok':!0x1,'error':_0xad1ffd(0x238)+_0xe871f4[_0xad1ffd(0x1ea)]};}await _0xe871f4[_0xad1ffd(0x237)]();let _0x4aa628=(await(await fetch(D+_0xad1ffd(0x224),{'method':'POST','headers':{'Content-Type':'application/json','Accept':_0xad1ffd(0x1e2),...X?{'Authorization':_0xad1ffd(0x216)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0xad1ffd(0x232),'id':0x2,'method':_0xad1ffd(0x247),'params':{'name':_0x33190f,'arguments':_0x27364f}})}))[_0xad1ffd(0x237)]())[_0xad1ffd(0x1f4)]('\x0a')['find'](_0xe2eb3d=>_0xe2eb3d[_0xad1ffd(0x21e)]('data:\x20'));if(_0x4aa628){let _0x5d3fc1=JSON[_0xad1ffd(0x25a)](_0x4aa628[_0xad1ffd(0x1ec)](0x6));return _0x5d3fc1?.[_0xad1ffd(0x21f)]?.[_0xad1ffd(0x1d9)]?.[0x0]?.[_0xad1ffd(0x237)]?JSON['parse'](_0x5d3fc1[_0xad1ffd(0x21f)][_0xad1ffd(0x1d9)][0x0]['text']):_0x5d3fc1;}return{'ok':!0x1,'error':_0xad1ffd(0x1e5)};}K[a0_0x662eba(0x23b)](a0_0x578a26,async _0x34b487=>{const _0x8337af=a0_0x662eba;let {name:_0x39cf87,arguments:_0x3fc3d1}=_0x34b487['params'];if(_0x39cf87===_0x8337af(0x21a)){let {task_id:_0x5630e7,text:_0x537946,status:_0x1cb157}=_0x3fc3d1;if(_0x1cb157===_0x8337af(0x222)||_0x1cb157===_0x8337af(0x1eb)||_0x1cb157==='cancelled'){let _0x3dccda=_0x1cb157===_0x8337af(0x222)?_0x8337af(0x1f6):_0x1cb157,_0x260dcf=_0x5630e7?k[_0x8337af(0x219)](_0x5630e7)||'hub':_0x8337af(0x1fa),_0x5e9f62=await P(_0x8337af(0x206),{'alias':_0x260dcf,'text':_0x537946,'in_reply_to':_0x5630e7||void 0x0,'status':_0x3dccda,'from_session':Z});if(_0x5630e7)k['delete'](_0x5630e7);return{'content':[{'type':_0x8337af(0x237),'text':JSON[_0x8337af(0x1fc)](_0x5e9f62)}]};}let _0x4a2012=await P(_0x8337af(0x22f),{'resume_id':w,'alias':Z,'status':_0x1cb157===_0x8337af(0x1f2)?_0x8337af(0x1f2):_0x1cb157===_0x8337af(0x21b)?_0x8337af(0x21b):_0x8337af(0x20e),'task':_0x537946[_0x8337af(0x1ec)](0x0,0xc8),'output':_0x537946});return{'content':[{'type':_0x8337af(0x237),'text':JSON[_0x8337af(0x1fc)](_0x4a2012)}]};}if(_0x39cf87===_0x8337af(0x1d8)){let {status:_0x6b9336,task:_0x4e9f8c,progress:_0x53fdc7}=_0x3fc3d1,_0x4a2b50=await P(_0x8337af(0x22f),{'resume_id':w,'alias':Z,'status':_0x6b9336,'task':_0x4e9f8c,'progress':_0x53fdc7});return{'content':[{'type':'text','text':JSON[_0x8337af(0x1fc)](_0x4a2b50)}]};}if(_0x39cf87===_0x8337af(0x1e6)){let {alias:_0x3a1c21,task:_0x12c82e,priority:_0x14d5ca}=_0x3fc3d1,_0x42b810=await P(_0x8337af(0x1f8),{'alias':_0x3a1c21,'task':_0x12c82e,'priority':_0x14d5ca||_0x8337af(0x1da),'from_session':Z});return{'content':[{'type':_0x8337af(0x237),'text':JSON[_0x8337af(0x1fc)](_0x42b810)}]};}if(_0x39cf87===_0x8337af(0x229)){let {alias:_0x570484,message:_0xd8ba89}=_0x3fc3d1,_0x514402=await P(_0x8337af(0x208),{'alias':_0x570484,'message':_0xd8ba89,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x8337af(0x1fc)](_0x514402)}]};}if(_0x39cf87===_0x8337af(0x24f)){let _0x1d2d9b=await P(_0x8337af(0x220),{});return{'content':[{'type':_0x8337af(0x237),'text':JSON[_0x8337af(0x1fc)](_0x1d2d9b)}]};}return{'content':[{'type':_0x8337af(0x237),'text':JSON[_0x8337af(0x1fc)]({'error':_0x8337af(0x1f9)})}]};});async function v(){const _0x150379=a0_0x662eba;let _0x2a74c3=D+_0x150379(0x23a)+encodeURIComponent(Z),_0x290f9a={};if(X)_0x290f9a['Authorization']=_0x150379(0x216)+X;Y('connecting\x20to\x20'+_0x2a74c3);while(!0x0){try{let _0x55c17a=await fetch(_0x2a74c3,{'headers':_0x290f9a});if(!_0x55c17a['ok']){Y(_0x150379(0x256)+_0x55c17a[_0x150379(0x1ea)]+'\x20'+_0x55c17a['statusText']),await h(0x1388);continue;}let _0x5b2d37=_0x55c17a[_0x150379(0x25e)][_0x150379(0x223)](),_0x4e13e7=new TextDecoder(),_0x4f9314='';while(!0x0){let {done:_0x56336c,value:_0x57b68e}=await _0x5b2d37['read']();if(_0x56336c)break;_0x4f9314+=_0x4e13e7['decode'](_0x57b68e,{'stream':!0x0});let _0x1ed35f=_0x4f9314[_0x150379(0x1f4)]('\x0a\x0a');_0x4f9314=_0x1ed35f[_0x150379(0x1e8)]()||'';for(let _0x315a92 of _0x1ed35f){let _0x2c0b91=_0x315a92[_0x150379(0x1f4)]('\x0a')[_0x150379(0x1e3)](_0x35aa8e=>_0x35aa8e[_0x150379(0x21e)](_0x150379(0x226)));if(!_0x2c0b91)continue;try{let _0x5d426b=JSON[_0x150379(0x25a)](_0x2c0b91['slice'](0x6));await u(_0x5d426b);}catch(_0x3abcec){Y('parse\x20error:\x20'+_0x3abcec);}}}Y(_0x150379(0x240));}catch(_0x1fdd3f){Y('SSE\x20connection\x20error:\x20'+_0x1fdd3f);}await h(0xbb8);}}async function u(_0x1d4114){const _0x53f948=a0_0x662eba;if(_0x1d4114[_0x53f948(0x203)]==='connected'){Y(_0x53f948(0x1ee)+Z+'\x22');return;}if(_0x1d4114[_0x53f948(0x203)]===_0x53f948(0x205)){if(Y(_0x53f948(0x1f5)+_0x1d4114[_0x53f948(0x22b)]+':\x20'+_0x1d4114[_0x53f948(0x1e1)][_0x53f948(0x1ec)](0x0,0x3c)),await K[_0x53f948(0x215)]({'method':_0x53f948(0x24d),'params':{'content':_0x1d4114[_0x53f948(0x1e1)],'meta':{'sender':_0x1d4114['from']||'hub','sender_id':_0x53f948(0x258),'user':_0x1d4114[_0x53f948(0x22b)]||_0x53f948(0x1fa),'priority':_0x53f948(0x1da)}}}),_0x1d4114[_0x53f948(0x210)])await P(_0x53f948(0x207),{'alias':Z,'message_id':_0x1d4114[_0x53f948(0x210)]});return;}if(_0x1d4114[_0x53f948(0x203)]===_0x53f948(0x21c)||_0x1d4114[_0x53f948(0x203)]===_0x53f948(0x1f3)){Y('←\x20'+_0x1d4114[_0x53f948(0x203)]+_0x53f948(0x1e9)+_0x1d4114[_0x53f948(0x24e)]+_0x53f948(0x20c)+(_0x1d4114[_0x53f948(0x230)]||_0x53f948(0x1da)));let _0x2566a0=await P(_0x53f948(0x249),{'alias':Z,'limit':0x5});if(_0x2566a0?.['ok']&&_0x2566a0[_0x53f948(0x209)]?.[_0x53f948(0x20f)]>0x0)for(let _0x1af7eb of _0x2566a0[_0x53f948(0x209)]){let _0x4011a3={'sender':_0x1af7eb[_0x53f948(0x231)]||'hub','sender_id':_0x53f948(0x258),'user':_0x1af7eb[_0x53f948(0x231)]||_0x53f948(0x1fa),'task_id':_0x1af7eb['id'],'priority':_0x1af7eb[_0x53f948(0x230)]||_0x53f948(0x1da)};k['set'](_0x1af7eb['id'],_0x1af7eb[_0x53f948(0x231)]||_0x53f948(0x1fa)),await K[_0x53f948(0x215)]({'method':_0x53f948(0x24d),'params':{'content':_0x1af7eb[_0x53f948(0x1d9)],'meta':_0x4011a3}}),Y(_0x53f948(0x241)+_0x1af7eb['id'][_0x53f948(0x1ec)](0x0,0x8)+_0x53f948(0x228)+_0x1af7eb[_0x53f948(0x231)]+':\x20'+_0x1af7eb['content'][_0x53f948(0x1ec)](0x0,0x3c)),await P(_0x53f948(0x207),{'alias':Z,'message_id':_0x1af7eb['id']});}}}async function S(){const _0x4636aa=a0_0x662eba;let _0x125e90=new a0_0x5397f0();await K[_0x4636aa(0x24a)](_0x125e90),Y(_0x4636aa(0x213)),Y(_0x4636aa(0x25c)),v()[_0x4636aa(0x20d)](_0x538d0b=>Y(_0x4636aa(0x21d)+_0x538d0b)),P('report_status',{'resume_id':w,'alias':Z,'status':_0x4636aa(0x221),'server':a0_0x584493(),'hostname':a0_0x584493(),'agent':_0x4636aa(0x22c),'project_dir':process[_0x4636aa(0x22d)](),'tmux_name':f||void 0x0})[_0x4636aa(0x248)](()=>Y(_0x4636aa(0x250)+Z+_0x4636aa(0x239)+w['slice'](0x0,0x8)+')'))[_0x4636aa(0x20d)](_0x24ba88=>Y('warning:\x20could\x20not\x20register:\x20'+_0x24ba88)),setInterval(()=>{const _0xafede5=_0x4636aa;P('report_status',{'resume_id':w,'alias':Z,'status':_0xafede5(0x221),'server':a0_0x584493(),'hostname':a0_0x584493(),'agent':_0xafede5(0x22c),'project_dir':process[_0xafede5(0x22d)](),'tmux_name':f||void 0x0})[_0xafede5(0x20d)](_0x4563b8=>Y(_0xafede5(0x204)+_0x4563b8));},0x2bf20),Y(_0x4636aa(0x243));}S()[a0_0x662eba(0x20d)](_0x615934=>{const _0x385190=a0_0x662eba;Y(_0x385190(0x20b)+_0x615934),process['exit'](0x1);});async function N(){const _0x5b295e=a0_0x662eba;Y(_0x5b295e(0x22e)),await P(_0x5b295e(0x22f),{'resume_id':w,'alias':Z,'status':_0x5b295e(0x21b),'task':_0x5b295e(0x1fd)})[_0x5b295e(0x20d)](()=>{}),process['exit'](0x0);}process[a0_0x662eba(0x227)]['on'](a0_0x662eba(0x23f),()=>N()),process['on']('SIGTERM',()=>N()),process['on']('SIGINT',()=>N());
|
|
2
|
+
const a0_0x3a4eda=a0_0xf8e7;(function(_0x5b900a,_0x407b97){const _0x519df5=a0_0xf8e7,_0x23cb4f=_0x5b900a();while(!![]){try{const _0x20e171=parseInt(_0x519df5(0x232))/0x1*(-parseInt(_0x519df5(0x224))/0x2)+-parseInt(_0x519df5(0x1e9))/0x3+parseInt(_0x519df5(0x251))/0x4*(-parseInt(_0x519df5(0x255))/0x5)+parseInt(_0x519df5(0x1eb))/0x6*(parseInt(_0x519df5(0x1ff))/0x7)+-parseInt(_0x519df5(0x23a))/0x8+-parseInt(_0x519df5(0x1e8))/0x9+parseInt(_0x519df5(0x228))/0xa;if(_0x20e171===_0x407b97)break;else _0x23cb4f['push'](_0x23cb4f['shift']());}catch(_0x29e369){_0x23cb4f['push'](_0x23cb4f['shift']());}}}(a0_0x1e45,0x41faa));import{readFileSync as a0_0x4ad26c,existsSync as a0_0x436b4b}from'fs';import{join as a0_0x51a9be}from'path';import{hostname as a0_0x428b3e}from'os';import{execSync as a0_0x5908f4}from'child_process';import{Server as a0_0x5cebea}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x16de72}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x451801,CallToolRequestSchema as a0_0x4f9edb}from'@modelcontextprotocol/sdk/types.js';function p(_0x3f4f9c){const _0x1ffeba=a0_0xf8e7;if(!a0_0x436b4b(_0x3f4f9c))return;for(let _0x32988c of a0_0x4ad26c(_0x3f4f9c,_0x1ffeba(0x226))['split']('\x0a')){let _0x5c4f2a=_0x32988c[_0x1ffeba(0x229)]();if(!_0x5c4f2a||_0x5c4f2a['startsWith']('#'))continue;let _0x31a605=_0x5c4f2a[_0x1ffeba(0x215)]('=');if(_0x31a605<0x0)continue;let _0x40228d=_0x5c4f2a[_0x1ffeba(0x20a)](0x0,_0x31a605)[_0x1ffeba(0x229)](),_0x1c20db=_0x5c4f2a[_0x1ffeba(0x20a)](_0x31a605+0x1)[_0x1ffeba(0x229)]()[_0x1ffeba(0x234)](/^["']|["']$/g,'');if(!process.env[_0x40228d])process.env[_0x40228d]=_0x1c20db;}}var C=process.env.HOME||'~',T=a0_0x51a9be(C,a0_0x3a4eda(0x1e4));p(a0_0x51a9be(T,a0_0x3a4eda(0x21d)));var L=process[a0_0x3a4eda(0x20e)]()[a0_0x3a4eda(0x234)](/\//g,'-');p(a0_0x51a9be(T,L,a0_0x3a4eda(0x21d)));function U(){const _0x248d17=a0_0x3a4eda;try{return a0_0x5908f4(_0x248d17(0x1db),{'encoding':_0x248d17(0x226),'timeout':0x7d0})['trim']();}catch{return'';}}function c(){const _0x2f7548=a0_0x3a4eda;try{let _0x1c6e9c=a0_0x51a9be(C,_0x2f7548(0x254),_0x2f7548(0x20b));if(a0_0x436b4b(_0x1c6e9c))return JSON['parse'](a0_0x4ad26c(_0x1c6e9c,'utf-8'));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x3a4eda(0x227)]||a0_0x3a4eda(0x1fe),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x428b3e(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x3a4eda(0x262)](),X=process.env.COMMHUB_TOKEN||H[a0_0x3a4eda(0x1e6)]||'';function Y(_0x45ab38){const _0x3e16a2=a0_0x3a4eda;let _0x1c4145=new Date()[_0x3e16a2(0x23f)]()[_0x3e16a2(0x20a)](0x0,0x8);process[_0x3e16a2(0x1f7)][_0x3e16a2(0x23c)]('['+_0x1c4145+_0x3e16a2(0x1f5)+_0x45ab38+'\x0a');}function a0_0xf8e7(_0x1dce20,_0x45042b){_0x1dce20=_0x1dce20-0x1da;const _0x1e4567=a0_0x1e45();let _0xf8e72d=_0x1e4567[_0x1dce20];return _0xf8e72d;}function h(_0x3fbd19){return new Promise(_0x34993f=>setTimeout(_0x34993f,_0x3fbd19));}Y(a0_0x3a4eda(0x25d)+D+'\x20ALIAS='+Z+'\x20RESUME_ID='+w[a0_0x3a4eda(0x20a)](0x0,0x8)+a0_0x3a4eda(0x1df)+(f||'none')+a0_0x3a4eda(0x212)+process[a0_0x3a4eda(0x20e)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x5cebea({'name':a0_0x3a4eda(0x219),'version':a0_0x3a4eda(0x261)},{'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_0x3a4eda(0x242),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x3a4eda(0x249),a0_0x3a4eda(0x20c)+Z][a0_0x3a4eda(0x213)]('\x0a')});K[a0_0x3a4eda(0x1e0)](a0_0x451801,async()=>({'tools':[{'name':a0_0x3a4eda(0x1f3),'description':a0_0x3a4eda(0x260),'inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{'task_id':{'type':a0_0x3a4eda(0x1ef),'description':a0_0x3a4eda(0x244)},'text':{'type':a0_0x3a4eda(0x1ef),'description':a0_0x3a4eda(0x21f)},'status':{'type':'string','enum':[a0_0x3a4eda(0x258),a0_0x3a4eda(0x202),'cancelled',a0_0x3a4eda(0x21c),'error',a0_0x3a4eda(0x208)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x3a4eda(0x1ea)]}},{'name':a0_0x3a4eda(0x259),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{'status':{'type':a0_0x3a4eda(0x1ef),'enum':[a0_0x3a4eda(0x240),a0_0x3a4eda(0x21a),a0_0x3a4eda(0x21c),'error']},'task':{'type':a0_0x3a4eda(0x1ef),'description':'Current\x20task\x20description'},'progress':{'type':'number','description':a0_0x3a4eda(0x22e)}},'required':[a0_0x3a4eda(0x1fb)]}},{'name':a0_0x3a4eda(0x210),'description':a0_0x3a4eda(0x235),'inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{'alias':{'type':a0_0x3a4eda(0x1ef),'description':a0_0x3a4eda(0x236)},'task':{'type':a0_0x3a4eda(0x1ef),'description':a0_0x3a4eda(0x1e2)},'priority':{'type':a0_0x3a4eda(0x1ef),'enum':['high',a0_0x3a4eda(0x23e),'low'],'description':a0_0x3a4eda(0x20d)}},'required':['alias',a0_0x3a4eda(0x22b)]}},{'name':'commhub_send_message','description':a0_0x3a4eda(0x1ee),'inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'message':{'type':'string','description':a0_0x3a4eda(0x22c)}},'required':[a0_0x3a4eda(0x241),'message']}},{'name':a0_0x3a4eda(0x230),'description':a0_0x3a4eda(0x209),'inputSchema':{'type':a0_0x3a4eda(0x1ed),'properties':{}}}]}));function a0_0x1e45(){const _0x3561c2=['text','60oCJIMU','POST','object','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','string','tools/call','/mcp','claude-code','commhub_reply','priority',']\x20[commhub]\x20','initialize','stderr','2025-03-26','params','session\x20disconnected','status','commhub_send_message','application/json,\x20text/event-stream','http://127.0.0.1:9200','45724WuRsIF','notifications/claude/channel','error','failed','replied','content','inbox_count','unknown\x20tool','then','in_progress','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','slice','config.json','Session\x20alias:\x20','Priority\x20(default:\x20normal)','cwd','stringify','commhub_send_task','type','\x20CWD=','join','get_all_status','indexOf','→\x20injected\x20task\x20',':\x20inbox_count=','send_reply','commhub-channel','idle','parse\x20error:\x20','blocked','.env','\x20from\x20','Reply\x20text\x20/\x20result\x20summary','message','\x22\x20(','catch','Bearer\x20','32kOZIqp','no\x20response','utf-8','hub','20570530CUOpvm','trim','find','task','Message\x20content','read','Progress\x200-100','connect','commhub_get_all_status','data:\x20','25238FArZpM','Authorization','replace','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','Target\x20session\x20alias','report_status','split','new_message','3779112EjTGcr','message_id','write','get','normal','toTimeString','working','alias','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','send_message','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','CommHub\x20init\x20failed:\x20','2.0','MCP\x20stdio\x20connected','shutting\x20down,\x20reporting\x20offline...','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','get_inbox','SSE\x20connected\x20as\x20\x22','statusText','notification','fatal:\x20','SSE\x20stream\x20ended,\x20reconnecting...','ready\x20—\x20waiting\x20for\x20events','4YPdoKO','\x20priority=','←\x20message\x20from\x20','.anet','649795tSYyJl','from','set','completed','commhub_report_status','from_session','startsWith','delete','ENV:\x20URL=','application/json','result','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','0.3.0','randomUUID','send_task','connecting\x20to\x20','parse','tmux\x20display-message\x20-p\x20\x27#S\x27','commhub','ack_inbox','registered\x20as\x20\x22','...\x20TMUX=','setRequestHandler','new_task','Task\x20content','SSE\x20connection\x20error:\x20','.claude/channels/commhub','broadcast','token','cancelled','2950524FJqyGx','1554393kDWhky'];a0_0x1e45=function(){return _0x3561c2;};return a0_0x1e45();}async function P(_0x2c1177,_0x47a35e){const _0x109f41=a0_0x3a4eda;let _0x3847d8=await fetch(D+_0x109f41(0x1f1),{'method':_0x109f41(0x1ec),'headers':{'Content-Type':_0x109f41(0x25e),'Accept':_0x109f41(0x1fd),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x109f41(0x246),'id':0x1,'method':_0x109f41(0x1f6),'params':{'protocolVersion':_0x109f41(0x1f8),'capabilities':{},'clientInfo':{'name':_0x109f41(0x219),'version':_0x109f41(0x261)}}})});if(!_0x3847d8['ok']){let _0x1ce112=await _0x3847d8[_0x109f41(0x1ea)]();return Y(_0x109f41(0x245)+_0x3847d8[_0x109f41(0x1fb)]+'\x20'+_0x1ce112['slice'](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x3847d8[_0x109f41(0x1fb)]};}await _0x3847d8[_0x109f41(0x1ea)]();let _0x3f4fd1=(await(await fetch(D+'/mcp',{'method':_0x109f41(0x1ec),'headers':{'Content-Type':_0x109f41(0x25e),'Accept':_0x109f41(0x1fd),...X?{'Authorization':_0x109f41(0x223)+X}:{}},'body':JSON[_0x109f41(0x20f)]({'jsonrpc':_0x109f41(0x246),'id':0x2,'method':_0x109f41(0x1f0),'params':{'name':_0x2c1177,'arguments':_0x47a35e}})}))['text']())[_0x109f41(0x238)]('\x0a')[_0x109f41(0x22a)](_0x44ffd0=>_0x44ffd0['startsWith']('data:\x20'));if(_0x3f4fd1){let _0x3cdd0f=JSON[_0x109f41(0x1da)](_0x3f4fd1[_0x109f41(0x20a)](0x6));return _0x3cdd0f?.[_0x109f41(0x25f)]?.[_0x109f41(0x204)]?.[0x0]?.['text']?JSON[_0x109f41(0x1da)](_0x3cdd0f['result'][_0x109f41(0x204)][0x0][_0x109f41(0x1ea)]):_0x3cdd0f;}return{'ok':!0x1,'error':_0x109f41(0x225)};}K[a0_0x3a4eda(0x1e0)](a0_0x4f9edb,async _0x5081bc=>{const _0x3f5c52=a0_0x3a4eda;let {name:_0x41683c,arguments:_0x46bac0}=_0x5081bc[_0x3f5c52(0x1f9)];if(_0x41683c==='commhub_reply'){let {task_id:_0x59c60d,text:_0xb7914b,status:_0xe50a12}=_0x46bac0;if(_0xe50a12===_0x3f5c52(0x258)||_0xe50a12===_0x3f5c52(0x202)||_0xe50a12===_0x3f5c52(0x1e7)){let _0x580e0c=_0xe50a12===_0x3f5c52(0x258)?_0x3f5c52(0x203):_0xe50a12,_0x2fb477=_0x59c60d?k[_0x3f5c52(0x23d)](_0x59c60d)||_0x3f5c52(0x227):_0x3f5c52(0x227),_0x40d81a=await P(_0x3f5c52(0x218),{'alias':_0x2fb477,'text':_0xb7914b,'in_reply_to':_0x59c60d||void 0x0,'status':_0x580e0c,'from_session':Z});if(_0x59c60d)k[_0x3f5c52(0x25c)](_0x59c60d);return{'content':[{'type':'text','text':JSON[_0x3f5c52(0x20f)](_0x40d81a)}]};}let _0x567574=await P(_0x3f5c52(0x237),{'resume_id':w,'alias':Z,'status':_0xe50a12===_0x3f5c52(0x21c)?_0x3f5c52(0x21c):_0xe50a12===_0x3f5c52(0x201)?_0x3f5c52(0x201):_0x3f5c52(0x240),'task':_0xb7914b['slice'](0x0,0xc8),'output':_0xb7914b});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x567574)}]};}if(_0x41683c===_0x3f5c52(0x259)){let {status:_0x1ee402,task:_0x1d5c87,progress:_0x57353c}=_0x46bac0,_0x411af2=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x1ee402,'task':_0x1d5c87,'progress':_0x57353c});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x411af2)}]};}if(_0x41683c==='commhub_send_task'){let {alias:_0x5991d2,task:_0x37a3cd,priority:_0xae54e7}=_0x46bac0,_0x36ae04=await P(_0x3f5c52(0x263),{'alias':_0x5991d2,'task':_0x37a3cd,'priority':_0xae54e7||_0x3f5c52(0x23e),'from_session':Z});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x36ae04)}]};}if(_0x41683c===_0x3f5c52(0x1fc)){let {alias:_0x50a927,message:_0x516061}=_0x46bac0,_0x26579a=await P(_0x3f5c52(0x243),{'alias':_0x50a927,'message':_0x516061,'from_session':Z});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x26579a)}]};}if(_0x41683c==='commhub_get_all_status'){let _0x399b5e=await P(_0x3f5c52(0x214),{});return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)](_0x399b5e)}]};}return{'content':[{'type':_0x3f5c52(0x1ea),'text':JSON[_0x3f5c52(0x20f)]({'error':_0x3f5c52(0x206)})}]};});async function v(){const _0x78e300=a0_0x3a4eda;let _0x5a8b40=D+'/events/'+encodeURIComponent(Z),_0x2712de={};if(X)_0x2712de[_0x78e300(0x233)]=_0x78e300(0x223)+X;Y(_0x78e300(0x264)+_0x5a8b40);while(!0x0){try{let _0x2ac962=await fetch(_0x5a8b40,{'headers':_0x2712de});if(!_0x2ac962['ok']){Y('SSE\x20error:\x20'+_0x2ac962[_0x78e300(0x1fb)]+'\x20'+_0x2ac962[_0x78e300(0x24c)]),await h(0x1388);continue;}let _0x181179=_0x2ac962['body']['getReader'](),_0x22e9a6=new TextDecoder(),_0x59af77='';while(!0x0){let {done:_0x39b62e,value:_0x450399}=await _0x181179[_0x78e300(0x22d)]();if(_0x39b62e)break;_0x59af77+=_0x22e9a6['decode'](_0x450399,{'stream':!0x0});let _0x5ae4f5=_0x59af77[_0x78e300(0x238)]('\x0a\x0a');_0x59af77=_0x5ae4f5['pop']()||'';for(let _0x2e8108 of _0x5ae4f5){let _0x350c87=_0x2e8108[_0x78e300(0x238)]('\x0a')[_0x78e300(0x22a)](_0x437a64=>_0x437a64[_0x78e300(0x25b)](_0x78e300(0x231)));if(!_0x350c87)continue;try{let _0x1e1d34=JSON[_0x78e300(0x1da)](_0x350c87[_0x78e300(0x20a)](0x6));await u(_0x1e1d34);}catch(_0x558992){Y(_0x78e300(0x21b)+_0x558992);}}}Y(_0x78e300(0x24f));}catch(_0x2f84b9){Y(_0x78e300(0x1e3)+_0x2f84b9);}await h(0xbb8);}}async function u(_0x2bb535){const _0x2de277=a0_0x3a4eda;if(_0x2bb535[_0x2de277(0x211)]==='connected'){Y(_0x2de277(0x24b)+Z+'\x22');return;}if(_0x2bb535[_0x2de277(0x211)]===_0x2de277(0x239)){if(Y(_0x2de277(0x253)+_0x2bb535['from']+':\x20'+_0x2bb535[_0x2de277(0x220)]['slice'](0x0,0x3c)),await K['notification']({'method':_0x2de277(0x200),'params':{'content':_0x2bb535[_0x2de277(0x220)],'meta':{'sender':_0x2bb535[_0x2de277(0x256)]||_0x2de277(0x227),'sender_id':'commhub','user':_0x2bb535[_0x2de277(0x256)]||'hub','priority':_0x2de277(0x23e)}}}),_0x2bb535[_0x2de277(0x23b)])await P(_0x2de277(0x1dd),{'alias':Z,'message_id':_0x2bb535[_0x2de277(0x23b)]});return;}if(_0x2bb535[_0x2de277(0x211)]===_0x2de277(0x1e1)||_0x2bb535[_0x2de277(0x211)]===_0x2de277(0x1e5)){Y('←\x20'+_0x2bb535[_0x2de277(0x211)]+_0x2de277(0x217)+_0x2bb535[_0x2de277(0x205)]+_0x2de277(0x252)+(_0x2bb535['priority']||_0x2de277(0x23e)));let _0x32a9d9=await P(_0x2de277(0x24a),{'alias':Z,'limit':0x5});if(_0x32a9d9?.['ok']&&_0x32a9d9['messages']?.['length']>0x0)for(let _0x2ef2f6 of _0x32a9d9['messages']){let _0x1ed6d1={'sender':_0x2ef2f6['from_session']||_0x2de277(0x227),'sender_id':_0x2de277(0x1dc),'user':_0x2ef2f6[_0x2de277(0x25a)]||_0x2de277(0x227),'task_id':_0x2ef2f6['id'],'priority':_0x2ef2f6[_0x2de277(0x1f4)]||_0x2de277(0x23e)};k[_0x2de277(0x257)](_0x2ef2f6['id'],_0x2ef2f6[_0x2de277(0x25a)]||_0x2de277(0x227)),await K[_0x2de277(0x24d)]({'method':_0x2de277(0x200),'params':{'content':_0x2ef2f6[_0x2de277(0x204)],'meta':_0x1ed6d1}}),Y(_0x2de277(0x216)+_0x2ef2f6['id'][_0x2de277(0x20a)](0x0,0x8)+_0x2de277(0x21e)+_0x2ef2f6[_0x2de277(0x25a)]+':\x20'+_0x2ef2f6[_0x2de277(0x204)]['slice'](0x0,0x3c)),await P(_0x2de277(0x1dd),{'alias':Z,'message_id':_0x2ef2f6['id']});}}}async function S(){const _0x1e697d=a0_0x3a4eda;let _0x442671=new a0_0x16de72();await K[_0x1e697d(0x22f)](_0x442671),Y(_0x1e697d(0x247)),Y('starting\x20SSE\x20listener...'),v()[_0x1e697d(0x222)](_0x2be00c=>Y('SSE\x20fatal:\x20'+_0x2be00c)),P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x428b3e(),'hostname':a0_0x428b3e(),'agent':_0x1e697d(0x1f2),'project_dir':process[_0x1e697d(0x20e)](),'tmux_name':f||void 0x0})[_0x1e697d(0x207)](()=>Y(_0x1e697d(0x1de)+Z+_0x1e697d(0x221)+w[_0x1e697d(0x20a)](0x0,0x8)+')'))['catch'](_0x57a92b=>Y('warning:\x20could\x20not\x20register:\x20'+_0x57a92b)),setInterval(()=>{const _0x1d735e=_0x1e697d;P(_0x1d735e(0x237),{'resume_id':w,'alias':Z,'status':_0x1d735e(0x21a),'server':a0_0x428b3e(),'hostname':a0_0x428b3e(),'agent':_0x1d735e(0x1f2),'project_dir':process[_0x1d735e(0x20e)](),'tmux_name':f||void 0x0})[_0x1d735e(0x222)](_0xfe6cee=>Y('heartbeat\x20failed:\x20'+_0xfe6cee));},0x2bf20),Y(_0x1e697d(0x250));}S()['catch'](_0x2aec6a=>{const _0x536b97=a0_0x3a4eda;Y(_0x536b97(0x24e)+_0x2aec6a),process['exit'](0x1);});async function N(){const _0x3bd35e=a0_0x3a4eda;Y(_0x3bd35e(0x248)),await P(_0x3bd35e(0x237),{'resume_id':w,'alias':Z,'status':_0x3bd35e(0x201),'task':_0x3bd35e(0x1fa)})['catch'](()=>{}),process['exit'](0x0);}process['stdin']['on']('end',()=>N()),process['on']('SIGTERM',()=>N()),process['on']('SIGINT',()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.0.0-preview.
|
|
3
|
+
"version": "2.0.0-preview.6",
|
|
4
4
|
"description": "AI Agent Network — Server + Client + Setup in one package. SSE real-time communication for multi-agent orchestration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|