@sleep2agi/agent-network 2.0.0-preview.4 → 2.0.0-preview.41
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/README.md +215 -73
- 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 +9 -7
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x4af8a7=a0_0x12c3;function a0_0x32a7(){const _0x48ef0e=['toTimeString','reply','sseAbort','send_task','60yfZQDB','task','heartbeatTimer','decode','sdk-','disconnect','POST','heartbeatInterval','120bnwiim','registered','toString','body','connect','error','5805lgSCGO','offline','split','Authorization','url','catch','signal','get_all_status','agent','status','26439171ThxwyN','broadcast','290148mAFFmC','connected','slice','now','application/json','AbortError','read','SSE\x20error:\x20','connectSSE','normal','SSE\x20failed:\x20','messages','send','emit','Bearer\x20','idle','token','SSE\x20connected','disconnected','running','content','from_session','application/json,\x20text/event-stream','min','heartbeat\x20failed:\x20','2.0','parse','log','data:\x20','141566KPIdhF','text','new_message','send_message','tools/call','processInbox','getReader','5679625uxAxDn','18680kXUkYu','/mcp','message','/events/','inbox\x20error:\x20','call','alias','reconnectDelay','server','SSE\x20reconnecting\x20in\x20','report_status','4794364kBbPXP','startsWith','stringify','1047954MgdaFJ','cwd','text/event-stream','resumeId','completed','type','10NfgpvN'];a0_0x32a7=function(){return _0x48ef0e;};return a0_0x32a7();}(function(_0x3358ac,_0x107d98){const _0x275c92=a0_0x12c3,_0x1210f3=_0x3358ac();while(!![]){try{const _0x22529e=parseInt(_0x275c92(0x135))/0x1+-parseInt(_0x275c92(0x177))/0x2*(-parseInt(_0x275c92(0x140))/0x3)+parseInt(_0x275c92(0x132))/0x4+parseInt(_0x275c92(0x148))/0x5*(-parseInt(_0x275c92(0x15a))/0x6)+-parseInt(_0x275c92(0x17e))/0x7+parseInt(_0x275c92(0x17f))/0x8*(parseInt(_0x275c92(0x14e))/0x9)+-parseInt(_0x275c92(0x13b))/0xa*(parseInt(_0x275c92(0x158))/0xb);if(_0x22529e===_0x107d98)break;else _0x1210f3['push'](_0x1210f3['shift']());}catch(_0x22040c){_0x1210f3['push'](_0x1210f3['shift']());}}}(a0_0x32a7,0xc18b0));function a0_0x12c3(_0x54ccab,_0x2217fc){_0x54ccab=_0x54ccab-0x12b;const _0x32a714=a0_0x32a7();let _0x12c393=_0x32a714[_0x54ccab];return _0x12c393;}import{EventEmitter as a0_0x4114bf}from'events';import{hostname as a0_0x431c59}from'os';class T extends a0_0x4114bf{[a0_0x4af8a7(0x152)];[a0_0x4af8a7(0x12d)];[a0_0x4af8a7(0x16a)];[a0_0x4af8a7(0x156)];['resumeId'];[a0_0x4af8a7(0x147)];[a0_0x4af8a7(0x12e)];[a0_0x4af8a7(0x142)];[a0_0x4af8a7(0x13e)];[a0_0x4af8a7(0x16d)]=!0x1;constructor(_0x1b407d){const _0x32d240=a0_0x4af8a7;super();if(this[_0x32d240(0x152)]=_0x1b407d['url']['replace'](/\/$/,''),this[_0x32d240(0x12d)]=_0x1b407d[_0x32d240(0x12d)],this[_0x32d240(0x16a)]=_0x1b407d[_0x32d240(0x16a)],this[_0x32d240(0x156)]=_0x1b407d[_0x32d240(0x156)]||'sdk',this[_0x32d240(0x138)]=_0x32d240(0x144)+_0x1b407d[_0x32d240(0x12d)]+'-'+Date[_0x32d240(0x15d)]()[_0x32d240(0x14a)](0x24),this[_0x32d240(0x147)]=_0x1b407d[_0x32d240(0x147)]??0x2bf20,this[_0x32d240(0x12e)]=_0x1b407d['reconnectDelay']??0xbb8,_0x1b407d['autoConnect']!==!0x1)this[_0x32d240(0x14c)]();}[a0_0x4af8a7(0x175)](_0x3b5d58){const _0x4b398c=a0_0x4af8a7;console[_0x4b398c(0x175)]('['+new Date()[_0x4b398c(0x13c)]()['slice'](0x0,0x8)+']\x20[commhub:'+this['alias']+']\x20'+_0x3b5d58);}async['call'](_0x3ddabd,_0x1300e7){const _0x145ca5=a0_0x4af8a7;let _0x3d4fe0={'Content-Type':_0x145ca5(0x15e),'Accept':_0x145ca5(0x170)};if(this[_0x145ca5(0x16a)])_0x3d4fe0[_0x145ca5(0x151)]=_0x145ca5(0x168)+this[_0x145ca5(0x16a)];let _0x28866e=await(await fetch(this[_0x145ca5(0x152)]+_0x145ca5(0x180),{'method':_0x145ca5(0x146),'headers':_0x3d4fe0,'body':JSON[_0x145ca5(0x134)]({'jsonrpc':_0x145ca5(0x173),'id':Date[_0x145ca5(0x15d)](),'method':_0x145ca5(0x17b),'params':{'name':_0x3ddabd,'arguments':_0x1300e7}})}))[_0x145ca5(0x178)](),_0x8b75e5=_0x28866e['match'](/data: (.+)/),_0x105336=_0x8b75e5?JSON['parse'](_0x8b75e5[0x1]):JSON[_0x145ca5(0x174)](_0x28866e),_0x5c5257=_0x105336?.['result']?.[_0x145ca5(0x16e)]?.[0x0]?.[_0x145ca5(0x178)];return _0x5c5257?JSON[_0x145ca5(0x174)](_0x5c5257):_0x105336;}async['connect'](){const _0x420562=a0_0x4af8a7;if(this[_0x420562(0x16d)])return;this[_0x420562(0x16d)]=!0x0,await this['status'](_0x420562(0x169)),this[_0x420562(0x175)](_0x420562(0x149)),this['heartbeatTimer']=setInterval(()=>{const _0x5f3752=_0x420562;this[_0x5f3752(0x157)](_0x5f3752(0x169))[_0x5f3752(0x153)](_0x12d5cf=>this[_0x5f3752(0x175)](_0x5f3752(0x172)+_0x12d5cf[_0x5f3752(0x181)]));},this[_0x420562(0x147)]),this[_0x420562(0x162)]();}async[a0_0x4af8a7(0x145)](){const _0x22ba87=a0_0x4af8a7;if(this[_0x22ba87(0x16d)]=!0x1,this[_0x22ba87(0x13e)]?.['abort'](),this['heartbeatTimer'])clearInterval(this['heartbeatTimer']);await this['status'](_0x22ba87(0x14f))['catch'](()=>{}),this[_0x22ba87(0x175)](_0x22ba87(0x16c));}async[a0_0x4af8a7(0x166)](_0x13dc9c,_0x55e3c5,_0x26b0a4=a0_0x4af8a7(0x163)){const _0x50b26a=a0_0x4af8a7;return this[_0x50b26a(0x12c)](_0x50b26a(0x13f),{'alias':_0x13dc9c,'task':_0x55e3c5,'priority':_0x26b0a4,'from_session':this[_0x50b26a(0x12d)]});}async['message'](_0x403117,_0x4fd5f9){const _0x490dbc=a0_0x4af8a7;return this[_0x490dbc(0x12c)](_0x490dbc(0x17a),{'alias':_0x403117,'message':_0x4fd5f9,'from_session':this[_0x490dbc(0x12d)]});}async[a0_0x4af8a7(0x13d)](_0x3109db,_0x4e9ca0,_0x497edf=a0_0x4af8a7(0x139)){const _0x19cfe8=a0_0x4af8a7;return this['call'](_0x19cfe8(0x13d),{'task_id':_0x3109db,'text':_0x4e9ca0,'status':_0x497edf});}async[a0_0x4af8a7(0x157)](_0x31849e,_0x536837){const _0x333b28=a0_0x4af8a7;return this[_0x333b28(0x12c)](_0x333b28(0x131),{'resume_id':this[_0x333b28(0x138)],'alias':this[_0x333b28(0x12d)],'status':_0x31849e,'server':a0_0x431c59(),'hostname':a0_0x431c59(),'agent':this['agent'],'project_dir':process[_0x333b28(0x136)](),..._0x536837});}async['getAllStatus'](){const _0x2a14be=a0_0x4af8a7;return this[_0x2a14be(0x12c)](_0x2a14be(0x155),{});}async[a0_0x4af8a7(0x159)](_0xdc4ec,_0x4bd205){const _0x253a47=a0_0x4af8a7;return this[_0x253a47(0x12c)](_0x253a47(0x159),{'message':_0xdc4ec,'filter_server':_0x4bd205?.[_0x253a47(0x12f)],'filter_status':_0x4bd205?.['status']});}async[a0_0x4af8a7(0x162)](){const _0x460af8=a0_0x4af8a7;let _0x535d6f=encodeURIComponent(this['alias']),_0x531b79=this['url']+_0x460af8(0x182)+_0x535d6f,_0x5afb7e=this[_0x460af8(0x12e)];while(this[_0x460af8(0x16d)]){try{this['sseAbort']=new AbortController();let _0x57440d={'Accept':_0x460af8(0x137)};if(this['token'])_0x57440d[_0x460af8(0x151)]='Bearer\x20'+this[_0x460af8(0x16a)];let _0x7d3ce5=await fetch(_0x531b79,{'headers':_0x57440d,'signal':this[_0x460af8(0x13e)][_0x460af8(0x154)]});if(!_0x7d3ce5['ok']||!_0x7d3ce5[_0x460af8(0x14b)]){this['log'](_0x460af8(0x164)+_0x7d3ce5[_0x460af8(0x157)]),await this['sleep'](_0x5afb7e),_0x5afb7e=Math[_0x460af8(0x171)](_0x5afb7e*1.5,0xea60);continue;}_0x5afb7e=this[_0x460af8(0x12e)];let _0x3ddea7=_0x7d3ce5[_0x460af8(0x14b)][_0x460af8(0x17d)](),_0x3915e3=new TextDecoder(),_0x20c4e8='';while(this[_0x460af8(0x16d)]){let {done:_0x1818d9,value:_0x3fc862}=await _0x3ddea7[_0x460af8(0x160)]();if(_0x1818d9)break;_0x20c4e8+=_0x3915e3[_0x460af8(0x143)](_0x3fc862,{'stream':!0x0});let _0x24251e=_0x20c4e8[_0x460af8(0x150)]('\x0a');_0x20c4e8=_0x24251e['pop']()||'';for(let _0x30017f of _0x24251e){if(!_0x30017f[_0x460af8(0x133)](_0x460af8(0x176)))continue;try{let _0xb5d7b0=JSON[_0x460af8(0x174)](_0x30017f['slice'](0x6));if(_0xb5d7b0[_0x460af8(0x13a)]===_0x460af8(0x15b)){this[_0x460af8(0x175)](_0x460af8(0x16b)),this[_0x460af8(0x167)]('connected');continue;}if(_0xb5d7b0[_0x460af8(0x13a)]==='new_task'||_0xb5d7b0[_0x460af8(0x13a)]===_0x460af8(0x179)||_0xb5d7b0['type']===_0x460af8(0x159))await this[_0x460af8(0x17c)]();}catch{}}}}catch(_0x570425){if(_0x570425['name']===_0x460af8(0x15f))break;this[_0x460af8(0x167)](_0x460af8(0x14d),_0x570425),this[_0x460af8(0x175)](_0x460af8(0x161)+_0x570425[_0x460af8(0x181)]);}if(this[_0x460af8(0x16d)])this[_0x460af8(0x167)](_0x460af8(0x16c)),this[_0x460af8(0x175)](_0x460af8(0x130)+_0x5afb7e/0x3e8+'s...'),await this['sleep'](_0x5afb7e),_0x5afb7e=Math['min'](_0x5afb7e*1.5,0xea60);}}async[a0_0x4af8a7(0x17c)](){const _0x6bd666=a0_0x4af8a7;try{let _0x40e76d=(await this[_0x6bd666(0x12c)]('get_inbox',{'alias':this[_0x6bd666(0x12d)],'limit':0xa}))?.[_0x6bd666(0x165)]||[];for(let _0x9e9a24 of _0x40e76d)await this[_0x6bd666(0x12c)]('ack_inbox',{'alias':this[_0x6bd666(0x12d)],'message_id':_0x9e9a24['id']}),this[_0x6bd666(0x175)]('←\x20'+_0x9e9a24[_0x6bd666(0x16f)]+':\x20'+_0x9e9a24[_0x6bd666(0x16e)][_0x6bd666(0x15c)](0x0,0x3c)),this[_0x6bd666(0x167)](_0x6bd666(0x141),_0x9e9a24),this[_0x6bd666(0x167)]('message',_0x9e9a24);}catch(_0x932959){this['log'](_0x6bd666(0x12b)+_0x932959[_0x6bd666(0x181)]);}}['sleep'](_0x163cca){return new Promise(_0x26fce7=>setTimeout(_0x26fce7,_0x163cca));}}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_0x2c027c=a0_0x348c;(function(_0xb23cb,_0x173d13){const _0x16c195=a0_0x348c,_0x2e7cd1=_0xb23cb();while(!![]){try{const _0x3a04f9=parseInt(_0x16c195(0xce))/0x1+-parseInt(_0x16c195(0x134))/0x2*(parseInt(_0x16c195(0xd2))/0x3)+-parseInt(_0x16c195(0x128))/0x4+parseInt(_0x16c195(0x102))/0x5*(parseInt(_0x16c195(0x132))/0x6)+parseInt(_0x16c195(0x12e))/0x7+-parseInt(_0x16c195(0x103))/0x8+parseInt(_0x16c195(0x13e))/0x9;if(_0x3a04f9===_0x173d13)break;else _0x2e7cd1['push'](_0x2e7cd1['shift']());}catch(_0x11a921){_0x2e7cd1['push'](_0x2e7cd1['shift']());}}}(a0_0x4f35,0xed144));import{readFileSync as a0_0x2c4611,existsSync as a0_0x2c3034}from'fs';import{join as a0_0x51ff7b}from'path';import{hostname as a0_0x5cfa45}from'os';function a0_0x348c(_0x222074,_0x373792){_0x222074=_0x222074-0xb6;const _0x4f3541=a0_0x4f35();let _0x348cd1=_0x4f3541[_0x222074];return _0x348cd1;}import{execSync as a0_0x19311e}from'child_process';import{Server as a0_0x801a2c}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x283180}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x297b20,CallToolRequestSchema as a0_0x26574f}from'@modelcontextprotocol/sdk/types.js';function p(_0x40fb32){const _0x972b36=a0_0x348c;if(!a0_0x2c3034(_0x40fb32))return;for(let _0x3b4f23 of a0_0x2c4611(_0x40fb32,_0x972b36(0xeb))['split']('\x0a')){let _0x3434a=_0x3b4f23[_0x972b36(0xb6)]();if(!_0x3434a||_0x3434a[_0x972b36(0x11f)]('#'))continue;let _0x4f6a33=_0x3434a[_0x972b36(0x147)]('=');if(_0x4f6a33<0x0)continue;let _0x3bfccc=_0x3434a['slice'](0x0,_0x4f6a33)[_0x972b36(0xb6)](),_0x2563d6=_0x3434a[_0x972b36(0x11e)](_0x4f6a33+0x1)[_0x972b36(0xb6)]()[_0x972b36(0x110)](/^["']|["']$/g,'');if(!process.env[_0x3bfccc])process.env[_0x3bfccc]=_0x2563d6;}}var C=process.env.HOME||'~',T=a0_0x51ff7b(C,a0_0x2c027c(0xfd));p(a0_0x51ff7b(T,a0_0x2c027c(0xe9)));var L=process[a0_0x2c027c(0xcc)]()[a0_0x2c027c(0x110)](/\//g,'-');function a0_0x4f35(){const _0x1c9321=['application/json','.env','join','utf-8','2.0','get','commhub-channel','delete','messages','tmux\x20display-message\x20-p\x20\x27#S\x27','commhub_reply','0.3.0','body','object','get_all_status','message_id','split','SSE\x20error:\x20','\x20PROJECT_ENV=','Message\x20content','type','.claude/channels/commhub','commhub_get_all_status','read','new_message','Priority\x20(default:\x20normal)','2332910cjXCaX','6234024OffEUT','none','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','string','new_task','failed','SIGINT','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','exit','blocked','then','heartbeat\x20failed:\x20','hub','replace','2025-03-26','write','status','unknown\x20tool','alias','SSE\x20connection\x20error:\x20','error','SSE\x20fatal:\x20','task','toTimeString','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','notification','parse','slice','startsWith','ack_inbox','normal','stderr','claude-code','broadcast','working','commhub_send_message','stdin','2806948oTaSZI','shutting\x20down,\x20reporting\x20offline...','fatal:\x20','from','setRequestHandler','commhub_send_task','10878364TriUIA','/events/','registered\x20as\x20\x22','notifications/claude/channel','18XBeWLZ','report_status','3052502CnNoVj','get_inbox','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','Session\x20alias:\x20','Reply\x20text\x20/\x20result\x20summary','SSE\x20stream\x20ended,\x20reconnecting...','application/json,\x20text/event-stream','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','\x20from\x20','catch','5058369ruAqZI','Target\x20session\x20alias','find','completed','replied','number','send_task','Bearer\x20','initialize','indexOf','trim','data:\x20','http://127.0.0.1:9200','idle','getReader','from_session','Task\x20content','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','message','/mcp','priority','.anet','set','randomUUID','←\x20message\x20from\x20','\x20CWD=','tools/call','high','POST','ENV:\x20URL=','ready\x20—\x20waiting\x20for\x20events','in_progress','cwd','commhub','462478qWxlfc','text','decode','init\x20failed:\x20','3gBzpNr','result','Authorization','\x22\x20(',':\x20inbox_count=','starting\x20SSE\x20listener...','warning:\x20could\x20not\x20register:\x20','connected','cancelled','session\x20disconnected','MCP\x20stdio\x20connected','no\x20response','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','commhub_report_status','length','content','inbox_count','stringify','connecting\x20to\x20','Progress\x200-100','CommHub\x20init\x20failed:\x20','\x20RESUME_ID='];a0_0x4f35=function(){return _0x1c9321;};return a0_0x4f35();}p(a0_0x51ff7b(T,L,a0_0x2c027c(0xe9)));function U(){const _0x191841=a0_0x2c027c;try{return a0_0x19311e(_0x191841(0xf1),{'encoding':_0x191841(0xeb),'timeout':0x7d0})[_0x191841(0xb6)]();}catch{return'';}}function c(){const _0x16d0bc=a0_0x2c027c;try{let _0x2ee6ae=a0_0x51ff7b(C,_0x16d0bc(0xc1),'config.json');if(a0_0x2c3034(_0x2ee6ae))return JSON['parse'](a0_0x2c4611(_0x2ee6ae,_0x16d0bc(0xeb)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x2c027c(0x10f)]||a0_0x2c027c(0xb8),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x5cfa45(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x2c027c(0xc3)](),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0xa932cb){const _0x219f3e=a0_0x2c027c;let _0x3c0edb=new Date()[_0x219f3e(0x11a)]()[_0x219f3e(0x11e)](0x0,0x8);process[_0x219f3e(0x122)][_0x219f3e(0x112)]('['+_0x3c0edb+']\x20[commhub]\x20'+_0xa932cb+'\x0a');}function h(_0x24999e){return new Promise(_0xc0349c=>setTimeout(_0xc0349c,_0x24999e));}Y(a0_0x2c027c(0xc9)+D+'\x20ALIAS='+Z+a0_0x2c027c(0xe7)+w['slice'](0x0,0x8)+'...\x20TMUX='+(f||a0_0x2c027c(0x104))+a0_0x2c027c(0xc5)+process[a0_0x2c027c(0xcc)]()+a0_0x2c027c(0xfa)+L);var k=new Map(),K=new a0_0x801a2c({'name':a0_0x2c027c(0xee),'version':a0_0x2c027c(0xf3)},{'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_0x2c027c(0x105),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x2c027c(0x137)+Z][a0_0x2c027c(0xea)]('\x0a')});K[a0_0x2c027c(0x12c)](a0_0x297b20,async()=>({'tools':[{'name':a0_0x2c027c(0xf2),'description':a0_0x2c027c(0x13b),'inputSchema':{'type':'object','properties':{'task_id':{'type':'string','description':a0_0x2c027c(0x10a)},'text':{'type':a0_0x2c027c(0x106),'description':a0_0x2c027c(0x138)},'status':{'type':a0_0x2c027c(0x106),'enum':['completed',a0_0x2c027c(0x108),a0_0x2c027c(0xda),'blocked',a0_0x2c027c(0x117),a0_0x2c027c(0xcb)],'description':a0_0x2c027c(0x136)}},'required':[a0_0x2c027c(0xcf)]}},{'name':a0_0x2c027c(0xdf),'description':a0_0x2c027c(0xbd),'inputSchema':{'type':a0_0x2c027c(0xf5),'properties':{'status':{'type':a0_0x2c027c(0x106),'enum':[a0_0x2c027c(0x125),a0_0x2c027c(0xb9),a0_0x2c027c(0x10c),a0_0x2c027c(0x117)]},'task':{'type':a0_0x2c027c(0x106),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x2c027c(0x143),'description':a0_0x2c027c(0xe5)}},'required':[a0_0x2c027c(0x113)]}},{'name':a0_0x2c027c(0x12d),'description':a0_0x2c027c(0xde),'inputSchema':{'type':a0_0x2c027c(0xf5),'properties':{'alias':{'type':a0_0x2c027c(0x106),'description':a0_0x2c027c(0x13f)},'task':{'type':a0_0x2c027c(0x106),'description':a0_0x2c027c(0xbc)},'priority':{'type':a0_0x2c027c(0x106),'enum':[a0_0x2c027c(0xc7),'normal','low'],'description':a0_0x2c027c(0x101)}},'required':[a0_0x2c027c(0x115),a0_0x2c027c(0x119)]}},{'name':a0_0x2c027c(0x126),'description':a0_0x2c027c(0x11b),'inputSchema':{'type':a0_0x2c027c(0xf5),'properties':{'alias':{'type':'string','description':a0_0x2c027c(0x13f)},'message':{'type':'string','description':a0_0x2c027c(0xfb)}},'required':[a0_0x2c027c(0x115),'message']}},{'name':a0_0x2c027c(0xfe),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x2c027c(0xf5),'properties':{}}}]}));async function P(_0x88e25f,_0x1e6652){const _0x545e4e=a0_0x2c027c;let _0x36eee5=await fetch(D+_0x545e4e(0xbf),{'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x545e4e(0x145)+X}:{}},'body':JSON[_0x545e4e(0xe3)]({'jsonrpc':_0x545e4e(0xec),'id':0x1,'method':_0x545e4e(0x146),'params':{'protocolVersion':_0x545e4e(0x111),'capabilities':{},'clientInfo':{'name':_0x545e4e(0xee),'version':'0.3.0'}}})});if(!_0x36eee5['ok']){let _0x4a9f80=await _0x36eee5['text']();return Y(_0x545e4e(0xe6)+_0x36eee5['status']+'\x20'+_0x4a9f80[_0x545e4e(0x11e)](0x0,0x64)),{'ok':!0x1,'error':_0x545e4e(0xd1)+_0x36eee5[_0x545e4e(0x113)]};}await _0x36eee5[_0x545e4e(0xcf)]();let _0x3bb177=(await(await fetch(D+_0x545e4e(0xbf),{'method':_0x545e4e(0xc8),'headers':{'Content-Type':_0x545e4e(0xe8),'Accept':_0x545e4e(0x13a),...X?{'Authorization':_0x545e4e(0x145)+X}:{}},'body':JSON[_0x545e4e(0xe3)]({'jsonrpc':'2.0','id':0x2,'method':_0x545e4e(0xc6),'params':{'name':_0x88e25f,'arguments':_0x1e6652}})}))['text']())[_0x545e4e(0xf8)]('\x0a')[_0x545e4e(0x140)](_0x5e9310=>_0x5e9310[_0x545e4e(0x11f)]('data:\x20'));if(_0x3bb177){let _0x451660=JSON[_0x545e4e(0x11d)](_0x3bb177['slice'](0x6));return _0x451660?.['result']?.[_0x545e4e(0xe1)]?.[0x0]?.[_0x545e4e(0xcf)]?JSON[_0x545e4e(0x11d)](_0x451660[_0x545e4e(0xd3)][_0x545e4e(0xe1)][0x0][_0x545e4e(0xcf)]):_0x451660;}return{'ok':!0x1,'error':_0x545e4e(0xdd)};}K[a0_0x2c027c(0x12c)](a0_0x26574f,async _0x1b1aad=>{const _0x69641f=a0_0x2c027c;let {name:_0x4134e1,arguments:_0xbd39bb}=_0x1b1aad['params'];if(_0x4134e1==='commhub_reply'){let {task_id:_0x3fb8f2,text:_0x59eef9,status:_0x409bd0}=_0xbd39bb;if(_0x409bd0===_0x69641f(0x141)||_0x409bd0==='failed'||_0x409bd0==='cancelled'){let _0xc04a2c=_0x409bd0==='completed'?_0x69641f(0x142):_0x409bd0,_0x169462=_0x3fb8f2?k[_0x69641f(0xed)](_0x3fb8f2)||'hub':_0x69641f(0x10f),_0x5d4a01=await P('send_reply',{'alias':_0x169462,'text':_0x59eef9,'in_reply_to':_0x3fb8f2||void 0x0,'status':_0xc04a2c,'from_session':Z});if(_0x3fb8f2)k[_0x69641f(0xef)](_0x3fb8f2);return{'content':[{'type':_0x69641f(0xcf),'text':JSON[_0x69641f(0xe3)](_0x5d4a01)}]};}let _0x19aeb7=await P(_0x69641f(0x133),{'resume_id':w,'alias':Z,'status':_0x409bd0===_0x69641f(0x10c)?_0x69641f(0x10c):_0x409bd0===_0x69641f(0x117)?_0x69641f(0x117):_0x69641f(0x125),'task':_0x59eef9['slice'](0x0,0xc8),'output':_0x59eef9});return{'content':[{'type':_0x69641f(0xcf),'text':JSON['stringify'](_0x19aeb7)}]};}if(_0x4134e1===_0x69641f(0xdf)){let {status:_0xd5288a,task:_0x22d27c,progress:_0x5b4dc6}=_0xbd39bb,_0x4186a9=await P(_0x69641f(0x133),{'resume_id':w,'alias':Z,'status':_0xd5288a,'task':_0x22d27c,'progress':_0x5b4dc6});return{'content':[{'type':_0x69641f(0xcf),'text':JSON[_0x69641f(0xe3)](_0x4186a9)}]};}if(_0x4134e1===_0x69641f(0x12d)){let {alias:_0x47f0f5,task:_0xbca806,priority:_0x325587}=_0xbd39bb,_0x12e3c3=await P(_0x69641f(0x144),{'alias':_0x47f0f5,'task':_0xbca806,'priority':_0x325587||'normal','from_session':Z});return{'content':[{'type':_0x69641f(0xcf),'text':JSON[_0x69641f(0xe3)](_0x12e3c3)}]};}if(_0x4134e1===_0x69641f(0x126)){let {alias:_0x5ddc47,message:_0x434e1b}=_0xbd39bb,_0x19496f=await P('send_message',{'alias':_0x5ddc47,'message':_0x434e1b,'from_session':Z});return{'content':[{'type':_0x69641f(0xcf),'text':JSON[_0x69641f(0xe3)](_0x19496f)}]};}if(_0x4134e1===_0x69641f(0xfe)){let _0x4e9ffd=await P(_0x69641f(0xf6),{});return{'content':[{'type':_0x69641f(0xcf),'text':JSON[_0x69641f(0xe3)](_0x4e9ffd)}]};}return{'content':[{'type':_0x69641f(0xcf),'text':JSON[_0x69641f(0xe3)]({'error':_0x69641f(0x114)})}]};});async function v(){const _0x27dcdd=a0_0x2c027c;let _0x26620c=D+_0x27dcdd(0x12f)+encodeURIComponent(Z),_0x384661={};if(X)_0x384661[_0x27dcdd(0xd4)]=_0x27dcdd(0x145)+X;Y(_0x27dcdd(0xe4)+_0x26620c);while(!0x0){try{let _0x35954=await fetch(_0x26620c,{'headers':_0x384661});if(!_0x35954['ok']){Y(_0x27dcdd(0xf9)+_0x35954[_0x27dcdd(0x113)]+'\x20'+_0x35954['statusText']),await h(0x1388);continue;}let _0x23c8ab=_0x35954[_0x27dcdd(0xf4)][_0x27dcdd(0xba)](),_0x5760e3=new TextDecoder(),_0x1ddade='';while(!0x0){let {done:_0x5d1a05,value:_0x5bb714}=await _0x23c8ab[_0x27dcdd(0xff)]();if(_0x5d1a05)break;_0x1ddade+=_0x5760e3[_0x27dcdd(0xd0)](_0x5bb714,{'stream':!0x0});let _0x191c1a=_0x1ddade[_0x27dcdd(0xf8)]('\x0a\x0a');_0x1ddade=_0x191c1a['pop']()||'';for(let _0x123f20 of _0x191c1a){let _0x2da935=_0x123f20[_0x27dcdd(0xf8)]('\x0a')[_0x27dcdd(0x140)](_0x2baf1d=>_0x2baf1d[_0x27dcdd(0x11f)](_0x27dcdd(0xb7)));if(!_0x2da935)continue;try{let _0x4bd2c2=JSON[_0x27dcdd(0x11d)](_0x2da935[_0x27dcdd(0x11e)](0x6));await u(_0x4bd2c2);}catch(_0x3ea619){Y('parse\x20error:\x20'+_0x3ea619);}}}Y(_0x27dcdd(0x139));}catch(_0x1b88a0){Y(_0x27dcdd(0x116)+_0x1b88a0);}await h(0xbb8);}}async function u(_0x4c7779){const _0x3955b1=a0_0x2c027c;if(_0x4c7779['type']===_0x3955b1(0xd9)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x4c7779[_0x3955b1(0xfc)]===_0x3955b1(0x100)){if(Y(_0x3955b1(0xc4)+_0x4c7779[_0x3955b1(0x12b)]+':\x20'+_0x4c7779[_0x3955b1(0xbe)]['slice'](0x0,0x3c)),await K[_0x3955b1(0x11c)]({'method':_0x3955b1(0x131),'params':{'content':_0x4c7779[_0x3955b1(0xbe)],'meta':{'sender':_0x4c7779[_0x3955b1(0x12b)]||'hub','sender_id':_0x3955b1(0xcd),'user':_0x4c7779[_0x3955b1(0x12b)]||_0x3955b1(0x10f),'priority':_0x3955b1(0x121)}}}),_0x4c7779[_0x3955b1(0xf7)])await P('ack_inbox',{'alias':Z,'message_id':_0x4c7779[_0x3955b1(0xf7)]});return;}if(_0x4c7779[_0x3955b1(0xfc)]===_0x3955b1(0x107)||_0x4c7779[_0x3955b1(0xfc)]===_0x3955b1(0x124)){Y('←\x20'+_0x4c7779['type']+_0x3955b1(0xd6)+_0x4c7779[_0x3955b1(0xe2)]+'\x20priority='+(_0x4c7779[_0x3955b1(0xc0)]||_0x3955b1(0x121)));let _0xe8e31a=await P(_0x3955b1(0x135),{'alias':Z,'limit':0x5});if(_0xe8e31a?.['ok']&&_0xe8e31a[_0x3955b1(0xf0)]?.[_0x3955b1(0xe0)]>0x0)for(let _0x354409 of _0xe8e31a['messages']){let _0x313746={'sender':_0x354409[_0x3955b1(0xbb)]||_0x3955b1(0x10f),'sender_id':_0x3955b1(0xcd),'user':_0x354409[_0x3955b1(0xbb)]||_0x3955b1(0x10f),'task_id':_0x354409['id'],'priority':_0x354409[_0x3955b1(0xc0)]||'normal'};k[_0x3955b1(0xc2)](_0x354409['id'],_0x354409['from_session']||_0x3955b1(0x10f)),await K[_0x3955b1(0x11c)]({'method':_0x3955b1(0x131),'params':{'content':_0x354409[_0x3955b1(0xe1)],'meta':_0x313746}}),Y('→\x20injected\x20task\x20'+_0x354409['id'][_0x3955b1(0x11e)](0x0,0x8)+_0x3955b1(0x13c)+_0x354409[_0x3955b1(0xbb)]+':\x20'+_0x354409['content'][_0x3955b1(0x11e)](0x0,0x3c)),await P(_0x3955b1(0x120),{'alias':Z,'message_id':_0x354409['id']});}}}async function S(){const _0x3f55d1=a0_0x2c027c;let _0x120135=new a0_0x283180();await K['connect'](_0x120135),Y(_0x3f55d1(0xdc)),Y(_0x3f55d1(0xd7)),v()[_0x3f55d1(0x13d)](_0x5d6608=>Y(_0x3f55d1(0x118)+_0x5d6608)),P(_0x3f55d1(0x133),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x5cfa45(),'hostname':a0_0x5cfa45(),'agent':_0x3f55d1(0x123),'project_dir':process[_0x3f55d1(0xcc)](),'tmux_name':f||void 0x0})[_0x3f55d1(0x10d)](()=>Y(_0x3f55d1(0x130)+Z+_0x3f55d1(0xd5)+w['slice'](0x0,0x8)+')'))[_0x3f55d1(0x13d)](_0x3fc2b4=>Y(_0x3f55d1(0xd8)+_0x3fc2b4)),setInterval(()=>{const _0x49d513=_0x3f55d1;P(_0x49d513(0x133),{'resume_id':w,'alias':Z,'status':_0x49d513(0xb9),'server':a0_0x5cfa45(),'hostname':a0_0x5cfa45(),'agent':_0x49d513(0x123),'project_dir':process[_0x49d513(0xcc)](),'tmux_name':f||void 0x0})['catch'](_0x363d1c=>Y(_0x49d513(0x10e)+_0x363d1c));},0x2bf20),Y(_0x3f55d1(0xca));}S()[a0_0x2c027c(0x13d)](_0x86d667=>{const _0x1b0efc=a0_0x2c027c;Y(_0x1b0efc(0x12a)+_0x86d667),process[_0x1b0efc(0x10b)](0x1);});async function N(){const _0x42e05f=a0_0x2c027c;Y(_0x42e05f(0x129)),await P(_0x42e05f(0x133),{'resume_id':w,'alias':Z,'status':_0x42e05f(0x117),'task':_0x42e05f(0xdb)})[_0x42e05f(0x13d)](()=>{}),process['exit'](0x0);}process[a0_0x2c027c(0x127)]['on']('end',()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x2c027c(0x109),()=>N());
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.0.0-preview.
|
|
4
|
-
"description": "AI Agent Network
|
|
3
|
+
"version": "2.0.0-preview.41",
|
|
4
|
+
"description": "AI Agent Network CLI \u2014 Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 39 commands.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|
|
7
7
|
"types": "dist/client.d.ts",
|
|
@@ -31,18 +31,20 @@
|
|
|
31
31
|
"mcp",
|
|
32
32
|
"sse",
|
|
33
33
|
"claude",
|
|
34
|
+
"codex",
|
|
34
35
|
"openai",
|
|
35
36
|
"minimax",
|
|
36
37
|
"orchestration",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"multi-agent",
|
|
39
|
+
"cli",
|
|
40
|
+
"anet"
|
|
40
41
|
],
|
|
41
42
|
"author": "sleep2agi",
|
|
42
43
|
"license": "MIT",
|
|
44
|
+
"homepage": "https://anet.vansin.me",
|
|
43
45
|
"repository": {
|
|
44
46
|
"type": "git",
|
|
45
|
-
"url": "https://github.com/sleep2agi/agent-
|
|
47
|
+
"url": "https://github.com/sleep2agi/agent-network",
|
|
46
48
|
"directory": "agent-network"
|
|
47
49
|
},
|
|
48
50
|
"engines": {
|
|
@@ -57,4 +59,4 @@
|
|
|
57
59
|
"node-pty": "^1.1.0",
|
|
58
60
|
"typescript": "^5.0.0"
|
|
59
61
|
}
|
|
60
|
-
}
|
|
62
|
+
}
|