@sleep2agi/agent-network 2.0.0 → 2.0.1-preview.1
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 +120 -206
- 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
|
+
function a0_0x91cc(_0x309140,_0x58b6bc){_0x309140=_0x309140-0x1c3;const _0x35da70=a0_0x35da();let _0x91ccac=_0x35da70[_0x309140];return _0x91ccac;}function a0_0x35da(){const _0x426ded=['sdk-','signal','connect','getReader','reply','autoConnect','replace','707802KyNghk','type','token','text','3085840mCOdqz','alias','call','abort','offline','body','disconnect','log','server','split','Bearer\x20','3507931iUlYso','resumeId','stringify','/events/','match','result','55qjOCYU','parse','heartbeatInterval','toTimeString','registered','connectSSE','catch','sseAbort','slice','text/event-stream','send_task','message','min','broadcast','/mcp','emit','agent','send','SSE\x20failed:\x20','get_all_status','heartbeat\x20failed:\x20','application/json,\x20text/event-stream','now','content','770931CQqxuD','running','url','inbox\x20error:\x20','disconnected','7914BFWwCy','SSE\x20reconnecting\x20in\x20','connected','report_status','reconnectDelay','AbortError','208881qdmrUZ','data:\x20','application/json','2.0','s...','SSE\x20error:\x20','status','from_session','38059030cHJXVW','idle','sleep','decode','Authorization','POST','read','392QsVfQF','794ruKgxB','tools/call','toString','task','processInbox','heartbeatTimer'];a0_0x35da=function(){return _0x426ded;};return a0_0x35da();}const a0_0x4e50cb=a0_0x91cc;(function(_0x166df0,_0x3912ff){const _0x13e9ac=a0_0x91cc,_0x5190c4=_0x166df0();while(!![]){try{const _0x45add6=-parseInt(_0x13e9ac(0x1c7))/0x1+-parseInt(_0x13e9ac(0x1e2))/0x2*(parseInt(_0x13e9ac(0x1cc))/0x3)+-parseInt(_0x13e9ac(0x1f3))/0x4+-parseInt(_0x13e9ac(0x204))/0x5*(-parseInt(_0x13e9ac(0x1ef))/0x6)+-parseInt(_0x13e9ac(0x1fe))/0x7+-parseInt(_0x13e9ac(0x1e1))/0x8*(parseInt(_0x13e9ac(0x1d2))/0x9)+parseInt(_0x13e9ac(0x1da))/0xa;if(_0x45add6===_0x3912ff)break;else _0x5190c4['push'](_0x5190c4['shift']());}catch(_0x20da51){_0x5190c4['push'](_0x5190c4['shift']());}}}(a0_0x35da,0xd5be1));import{EventEmitter as a0_0x122f3a}from'events';import{hostname as a0_0x1ecbc1}from'os';class T extends a0_0x122f3a{[a0_0x4e50cb(0x1c9)];[a0_0x4e50cb(0x1f4)];[a0_0x4e50cb(0x1f1)];[a0_0x4e50cb(0x214)];['resumeId'];['heartbeatInterval'];[a0_0x4e50cb(0x1d0)];['heartbeatTimer'];['sseAbort'];[a0_0x4e50cb(0x1c8)]=!0x1;constructor(_0x2346ab){const _0x45bd7a=a0_0x4e50cb;super();if(this[_0x45bd7a(0x1c9)]=_0x2346ab[_0x45bd7a(0x1c9)][_0x45bd7a(0x1ee)](/\/$/,''),this[_0x45bd7a(0x1f4)]=_0x2346ab[_0x45bd7a(0x1f4)],this[_0x45bd7a(0x1f1)]=_0x2346ab[_0x45bd7a(0x1f1)],this['agent']=_0x2346ab[_0x45bd7a(0x214)]||'sdk',this['resumeId']=_0x45bd7a(0x1e8)+_0x2346ab[_0x45bd7a(0x1f4)]+'-'+Date[_0x45bd7a(0x1c5)]()[_0x45bd7a(0x1e4)](0x24),this[_0x45bd7a(0x206)]=_0x2346ab[_0x45bd7a(0x206)]??0x2bf20,this[_0x45bd7a(0x1d0)]=_0x2346ab['reconnectDelay']??0xbb8,_0x2346ab[_0x45bd7a(0x1ed)]!==!0x1)this[_0x45bd7a(0x1ea)]();}[a0_0x4e50cb(0x1fa)](_0x342b94){const _0x4b4743=a0_0x4e50cb;console[_0x4b4743(0x1fa)]('['+new Date()[_0x4b4743(0x207)]()[_0x4b4743(0x20c)](0x0,0x8)+']\x20[commhub:'+this['alias']+']\x20'+_0x342b94);}async[a0_0x4e50cb(0x1f5)](_0x2e8310,_0x37c275){const _0x513daa=a0_0x4e50cb;let _0x36b76d={'Content-Type':_0x513daa(0x1d4),'Accept':_0x513daa(0x1c4)};if(this[_0x513daa(0x1f1)])_0x36b76d[_0x513daa(0x1de)]=_0x513daa(0x1fd)+this[_0x513daa(0x1f1)];let _0xf6b805=await(await fetch(this['url']+_0x513daa(0x212),{'method':_0x513daa(0x1df),'headers':_0x36b76d,'body':JSON[_0x513daa(0x200)]({'jsonrpc':_0x513daa(0x1d5),'id':Date[_0x513daa(0x1c5)](),'method':_0x513daa(0x1e3),'params':{'name':_0x2e8310,'arguments':_0x37c275}})}))[_0x513daa(0x1f2)](),_0x15f8c6=_0xf6b805[_0x513daa(0x202)](/data: (.+)/),_0x2ac0c6=_0x15f8c6?JSON['parse'](_0x15f8c6[0x1]):JSON[_0x513daa(0x205)](_0xf6b805),_0x5a589d=_0x2ac0c6?.[_0x513daa(0x203)]?.['content']?.[0x0]?.[_0x513daa(0x1f2)];return _0x5a589d?JSON['parse'](_0x5a589d):_0x2ac0c6;}async['connect'](){const _0x751aea=a0_0x4e50cb;if(this['running'])return;this[_0x751aea(0x1c8)]=!0x0,await this[_0x751aea(0x1d8)](_0x751aea(0x1db)),this['log'](_0x751aea(0x208)),this['heartbeatTimer']=setInterval(()=>{const _0x467820=_0x751aea;this['status'](_0x467820(0x1db))[_0x467820(0x20a)](_0x4a82ea=>this[_0x467820(0x1fa)](_0x467820(0x1c3)+_0x4a82ea[_0x467820(0x20f)]));},this[_0x751aea(0x206)]),this[_0x751aea(0x209)]();}async[a0_0x4e50cb(0x1f9)](){const _0x547761=a0_0x4e50cb;if(this[_0x547761(0x1c8)]=!0x1,this[_0x547761(0x20b)]?.[_0x547761(0x1f6)](),this[_0x547761(0x1e7)])clearInterval(this[_0x547761(0x1e7)]);await this[_0x547761(0x1d8)](_0x547761(0x1f7))[_0x547761(0x20a)](()=>{}),this[_0x547761(0x1fa)](_0x547761(0x1cb));}async[a0_0x4e50cb(0x215)](_0x37c972,_0x153c7e,_0x4d213c='normal'){const _0x21dbd1=a0_0x4e50cb;return this['call'](_0x21dbd1(0x20e),{'alias':_0x37c972,'task':_0x153c7e,'priority':_0x4d213c,'from_session':this[_0x21dbd1(0x1f4)]});}async[a0_0x4e50cb(0x20f)](_0x3dc34e,_0x256af8){return this['call']('send_message',{'alias':_0x3dc34e,'message':_0x256af8,'from_session':this['alias']});}async[a0_0x4e50cb(0x1ec)](_0x420179,_0x42bebf,_0x5479ba='completed'){const _0x199a8f=a0_0x4e50cb;return this[_0x199a8f(0x1f5)](_0x199a8f(0x1ec),{'task_id':_0x420179,'text':_0x42bebf,'status':_0x5479ba});}async[a0_0x4e50cb(0x1d8)](_0xa9a1da,_0x288590){const _0x2261ee=a0_0x4e50cb;return this['call'](_0x2261ee(0x1cf),{'resume_id':this[_0x2261ee(0x1ff)],'alias':this[_0x2261ee(0x1f4)],'status':_0xa9a1da,'server':a0_0x1ecbc1(),'hostname':a0_0x1ecbc1(),'agent':this[_0x2261ee(0x214)],'project_dir':process['cwd'](),..._0x288590});}async['getAllStatus'](){const _0x560949=a0_0x4e50cb;return this['call'](_0x560949(0x217),{});}async[a0_0x4e50cb(0x211)](_0x43a17f,_0x105746){const _0x44db4e=a0_0x4e50cb;return this[_0x44db4e(0x1f5)]('broadcast',{'message':_0x43a17f,'filter_server':_0x105746?.[_0x44db4e(0x1fb)],'filter_status':_0x105746?.['status']});}async[a0_0x4e50cb(0x209)](){const _0x54db6a=a0_0x4e50cb;let _0x1d1cc0=encodeURIComponent(this[_0x54db6a(0x1f4)]),_0x4ffebc=this['url']+_0x54db6a(0x201)+_0x1d1cc0,_0x43e7f5=this[_0x54db6a(0x1d0)];while(this[_0x54db6a(0x1c8)]){try{this[_0x54db6a(0x20b)]=new AbortController();let _0x2ef5fc={'Accept':_0x54db6a(0x20d)};if(this['token'])_0x2ef5fc['Authorization']='Bearer\x20'+this['token'];let _0x3e5746=await fetch(_0x4ffebc,{'headers':_0x2ef5fc,'signal':this['sseAbort'][_0x54db6a(0x1e9)]});if(!_0x3e5746['ok']||!_0x3e5746[_0x54db6a(0x1f8)]){this[_0x54db6a(0x1fa)](_0x54db6a(0x216)+_0x3e5746[_0x54db6a(0x1d8)]),await this[_0x54db6a(0x1dc)](_0x43e7f5),_0x43e7f5=Math[_0x54db6a(0x210)](_0x43e7f5*1.5,0xea60);continue;}_0x43e7f5=this[_0x54db6a(0x1d0)];let _0x4def0a=_0x3e5746['body'][_0x54db6a(0x1eb)](),_0x444812=new TextDecoder(),_0x3a0120='';while(this[_0x54db6a(0x1c8)]){let {done:_0x42b3de,value:_0x5f5829}=await _0x4def0a[_0x54db6a(0x1e0)]();if(_0x42b3de)break;_0x3a0120+=_0x444812[_0x54db6a(0x1dd)](_0x5f5829,{'stream':!0x0});let _0x327683=_0x3a0120[_0x54db6a(0x1fc)]('\x0a');_0x3a0120=_0x327683['pop']()||'';for(let _0x282eee of _0x327683){if(!_0x282eee['startsWith'](_0x54db6a(0x1d3)))continue;try{let _0x523b21=JSON[_0x54db6a(0x205)](_0x282eee[_0x54db6a(0x20c)](0x6));if(_0x523b21['type']===_0x54db6a(0x1ce)){this[_0x54db6a(0x1fa)]('SSE\x20connected'),this[_0x54db6a(0x213)](_0x54db6a(0x1ce));continue;}if(_0x523b21[_0x54db6a(0x1f0)]==='new_task'||_0x523b21[_0x54db6a(0x1f0)]==='new_message'||_0x523b21['type']===_0x54db6a(0x211))await this[_0x54db6a(0x1e6)]();}catch{}}}}catch(_0x5de1b4){if(_0x5de1b4['name']===_0x54db6a(0x1d1))break;this[_0x54db6a(0x213)]('error',_0x5de1b4),this[_0x54db6a(0x1fa)](_0x54db6a(0x1d7)+_0x5de1b4['message']);}if(this[_0x54db6a(0x1c8)])this[_0x54db6a(0x213)](_0x54db6a(0x1cb)),this[_0x54db6a(0x1fa)](_0x54db6a(0x1cd)+_0x43e7f5/0x3e8+_0x54db6a(0x1d6)),await this[_0x54db6a(0x1dc)](_0x43e7f5),_0x43e7f5=Math[_0x54db6a(0x210)](_0x43e7f5*1.5,0xea60);}}async[a0_0x4e50cb(0x1e6)](){const _0x2ee228=a0_0x4e50cb;try{let _0x4074a5=(await this['call']('get_inbox',{'alias':this[_0x2ee228(0x1f4)],'limit':0xa}))?.['messages']||[];for(let _0x115670 of _0x4074a5)await this[_0x2ee228(0x1f5)]('ack_inbox',{'alias':this[_0x2ee228(0x1f4)],'message_id':_0x115670['id']}),this[_0x2ee228(0x1fa)]('←\x20'+_0x115670[_0x2ee228(0x1d9)]+':\x20'+_0x115670[_0x2ee228(0x1c6)][_0x2ee228(0x20c)](0x0,0x3c)),this['emit'](_0x2ee228(0x1e5),_0x115670),this[_0x2ee228(0x213)](_0x2ee228(0x20f),_0x115670);}catch(_0x4c6052){this[_0x2ee228(0x1fa)](_0x2ee228(0x1ca)+_0x4c6052[_0x2ee228(0x20f)]);}}[a0_0x4e50cb(0x1dc)](_0x3499d3){return new Promise(_0x62ed29=>setTimeout(_0x62ed29,_0x3499d3));}}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_0x1bfcde=a0_0x3477;(function(_0x4735e4,_0x56291a){const _0x32fcb0=a0_0x3477,_0x4c7414=_0x4735e4();while(!![]){try{const _0x3cdf36=-parseInt(_0x32fcb0(0x24d))/0x1*(-parseInt(_0x32fcb0(0x215))/0x2)+-parseInt(_0x32fcb0(0x234))/0x3+-parseInt(_0x32fcb0(0x1d8))/0x4*(parseInt(_0x32fcb0(0x1e7))/0x5)+parseInt(_0x32fcb0(0x213))/0x6+parseInt(_0x32fcb0(0x24a))/0x7+-parseInt(_0x32fcb0(0x251))/0x8+-parseInt(_0x32fcb0(0x257))/0x9*(-parseInt(_0x32fcb0(0x1d9))/0xa);if(_0x3cdf36===_0x56291a)break;else _0x4c7414['push'](_0x4c7414['shift']());}catch(_0x29e40a){_0x4c7414['push'](_0x4c7414['shift']());}}}(a0_0x1d41,0x38ddb));import{readFileSync as a0_0x1b88b8,existsSync as a0_0x1e344c}from'fs';import{join as a0_0xf9833a}from'path';import{hostname as a0_0x4dcd02}from'os';import{execSync as a0_0x1b6641}from'child_process';import{Server as a0_0xc1fe57}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x90d41f}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x240108,CallToolRequestSchema as a0_0x3d1ab7}from'@modelcontextprotocol/sdk/types.js';function a0_0x1d41(){const _0x3d4c4b=['idle','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','unknown\x20tool','token','parse\x20error:\x20','commhub','Current\x20task\x20description','Reply\x20text\x20/\x20result\x20summary','commhub_reply','find','0.3.0','setRequestHandler','application/json,\x20text/event-stream','application/json','get','utf-8','Task\x20content','catch','blocked','CommHub\x20init\x20failed:\x20','split','type','string','\x22\x20(','slice','Bearer\x20','tmux\x20display-message\x20-p\x20\x27#S\x27','status','toTimeString','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','\x20RESUME_ID=','priority','239880zENqCB','replace','162jqkUiQ','claude-code','cwd','data:\x20','initialize','normal','stderr','from_session','messages','indexOf','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','failed','...\x20TMUX=','parse','http://127.0.0.1:9200','in_progress','low','hub','Target\x20session\x20alias','ack_inbox','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','length','report_status','commhub_send_message',']\x20[commhub]\x20','no\x20response','exit','.env','←\x20message\x20from\x20','message','commhub_send_task','438933BIFiQb','set','working','warning:\x20could\x20not\x20register:\x20','commhub_get_all_status','alias','replied','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','trim','heartbeat\x20failed:\x20','broadcast','from','commhub-channel','commhub_report_status','get_inbox','registered\x20as\x20\x22','Priority\x20(default:\x20normal)','body','SIGINT','statusText','get_all_status','none','324254xrOEJP','startsWith','connected','4161ftdegg','Message\x20content','send_reply','object','1641104aiQddb','cancelled','SSE\x20connection\x20error:\x20','ENV:\x20URL=','\x20priority=','send_task','20259fKUWFX','\x20PROJECT_ENV=','2.0','inbox_count','end','stringify','72764vYJJik','2170IpBPpY','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','notification','connect','send_message','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','shutting\x20down,\x20reporting\x20offline...','content','message_id','notifications/claude/channel','text','completed','/mcp','number','90YvXUKt','error','tools/call','2025-03-26','\x20from\x20','POST','pop','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','MCP\x20stdio\x20connected','\x20ALIAS=','SIGTERM','SSE\x20stream\x20ended,\x20reconnecting...'];a0_0x1d41=function(){return _0x3d4c4b;};return a0_0x1d41();}function a0_0x3477(_0x4cb252,_0x85363b){_0x4cb252=_0x4cb252-0x1d8;const _0x1d4143=a0_0x1d41();let _0x34779a=_0x1d4143[_0x4cb252];return _0x34779a;}function p(_0x2452fe){const _0x5aa658=a0_0x3477;if(!a0_0x1e344c(_0x2452fe))return;for(let _0x188a2a of a0_0x1b88b8(_0x2452fe,_0x5aa658(0x202))[_0x5aa658(0x207)]('\x0a')){let _0x356b85=_0x188a2a[_0x5aa658(0x23c)]();if(!_0x356b85||_0x356b85[_0x5aa658(0x24b)]('#'))continue;let _0x277f23=_0x356b85[_0x5aa658(0x21e)]('=');if(_0x277f23<0x0)continue;let _0xa61733=_0x356b85['slice'](0x0,_0x277f23)[_0x5aa658(0x23c)](),_0x548b01=_0x356b85['slice'](_0x277f23+0x1)[_0x5aa658(0x23c)]()[_0x5aa658(0x214)](/^["']|["']$/g,'');if(!process.env[_0xa61733])process.env[_0xa61733]=_0x548b01;}}var C=process.env.HOME||'~',T=a0_0xf9833a(C,'.claude/channels/commhub');p(a0_0xf9833a(T,a0_0x1bfcde(0x230)));var L=process[a0_0x1bfcde(0x217)]()['replace'](/\//g,'-');p(a0_0xf9833a(T,L,'.env'));function U(){const _0x30c373=a0_0x1bfcde;try{return a0_0x1b6641(_0x30c373(0x20d),{'encoding':_0x30c373(0x202),'timeout':0x7d0})['trim']();}catch{return'';}}function c(){const _0x141b69=a0_0x1bfcde;try{let _0x1c8451=a0_0xf9833a(C,'.anet','config.json');if(a0_0x1e344c(_0x1c8451))return JSON['parse'](a0_0x1b88b8(_0x1c8451,_0x141b69(0x202)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x1bfcde(0x226)]||a0_0x1bfcde(0x223),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x4dcd02(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto['randomUUID'](),X=process.env.COMMHUB_TOKEN||H[a0_0x1bfcde(0x1f6)]||'';function Y(_0x335d64){const _0x21ca9e=a0_0x1bfcde;let _0xa6cc2f=new Date()[_0x21ca9e(0x20f)]()[_0x21ca9e(0x20b)](0x0,0x8);process[_0x21ca9e(0x21b)]['write']('['+_0xa6cc2f+_0x21ca9e(0x22d)+_0x335d64+'\x0a');}function h(_0x1103f2){return new Promise(_0x51957a=>setTimeout(_0x51957a,_0x1103f2));}Y(a0_0x1bfcde(0x254)+D+a0_0x1bfcde(0x1f0)+Z+a0_0x1bfcde(0x211)+w['slice'](0x0,0x8)+a0_0x1bfcde(0x221)+(f||a0_0x1bfcde(0x249))+'\x20CWD='+process[a0_0x1bfcde(0x217)]()+a0_0x1bfcde(0x258)+L);var k=new Map(),K=new a0_0xc1fe57({'name':'commhub-channel','version':a0_0x1bfcde(0x1fd)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x1bfcde(0x210),a0_0x1bfcde(0x23b),a0_0x1bfcde(0x1de),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Session\x20alias:\x20'+Z]['join']('\x0a')});K[a0_0x1bfcde(0x1fe)](a0_0x240108,async()=>({'tools':[{'name':a0_0x1bfcde(0x1fb),'description':a0_0x1bfcde(0x1ee),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x1bfcde(0x209),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x1bfcde(0x209),'description':a0_0x1bfcde(0x1fa)},'status':{'type':a0_0x1bfcde(0x209),'enum':['completed',a0_0x1bfcde(0x220),a0_0x1bfcde(0x252),a0_0x1bfcde(0x205),a0_0x1bfcde(0x1e8),a0_0x1bfcde(0x224)],'description':a0_0x1bfcde(0x1f4)}},'required':[a0_0x1bfcde(0x1e3)]}},{'name':'commhub_report_status','description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x1bfcde(0x250),'properties':{'status':{'type':'string','enum':[a0_0x1bfcde(0x236),'idle',a0_0x1bfcde(0x205),a0_0x1bfcde(0x1e8)]},'task':{'type':a0_0x1bfcde(0x209),'description':a0_0x1bfcde(0x1f9)},'progress':{'type':a0_0x1bfcde(0x1e6),'description':'Progress\x200-100'}},'required':[a0_0x1bfcde(0x20e)]}},{'name':a0_0x1bfcde(0x233),'description':a0_0x1bfcde(0x1da),'inputSchema':{'type':a0_0x1bfcde(0x250),'properties':{'alias':{'type':a0_0x1bfcde(0x209),'description':a0_0x1bfcde(0x227)},'task':{'type':a0_0x1bfcde(0x209),'description':a0_0x1bfcde(0x203)},'priority':{'type':a0_0x1bfcde(0x209),'enum':['high',a0_0x1bfcde(0x21a),a0_0x1bfcde(0x225)],'description':a0_0x1bfcde(0x244)}},'required':['alias','task']}},{'name':a0_0x1bfcde(0x22c),'description':a0_0x1bfcde(0x21f),'inputSchema':{'type':a0_0x1bfcde(0x250),'properties':{'alias':{'type':a0_0x1bfcde(0x209),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x1bfcde(0x209),'description':a0_0x1bfcde(0x24e)}},'required':[a0_0x1bfcde(0x239),'message']}},{'name':'commhub_get_all_status','description':a0_0x1bfcde(0x229),'inputSchema':{'type':a0_0x1bfcde(0x250),'properties':{}}}]}));async function P(_0x316971,_0x3948fc){const _0x51b984=a0_0x1bfcde;let _0x2694a2=await fetch(D+_0x51b984(0x1e5),{'method':_0x51b984(0x1ec),'headers':{'Content-Type':_0x51b984(0x200),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x51b984(0x20c)+X}:{}},'body':JSON[_0x51b984(0x25c)]({'jsonrpc':'2.0','id':0x1,'method':_0x51b984(0x219),'params':{'protocolVersion':_0x51b984(0x1ea),'capabilities':{},'clientInfo':{'name':_0x51b984(0x240),'version':_0x51b984(0x1fd)}}})});if(!_0x2694a2['ok']){let _0x8da0c5=await _0x2694a2[_0x51b984(0x1e3)]();return Y(_0x51b984(0x206)+_0x2694a2[_0x51b984(0x20e)]+'\x20'+_0x8da0c5[_0x51b984(0x20b)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x2694a2[_0x51b984(0x20e)]};}await _0x2694a2[_0x51b984(0x1e3)]();let _0x31123b=(await(await fetch(D+_0x51b984(0x1e5),{'method':_0x51b984(0x1ec),'headers':{'Content-Type':_0x51b984(0x200),'Accept':_0x51b984(0x1ff),...X?{'Authorization':_0x51b984(0x20c)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x51b984(0x259),'id':0x2,'method':_0x51b984(0x1e9),'params':{'name':_0x316971,'arguments':_0x3948fc}})}))['text']())[_0x51b984(0x207)]('\x0a')['find'](_0xf78749=>_0xf78749[_0x51b984(0x24b)](_0x51b984(0x218)));if(_0x31123b){let _0x10da20=JSON['parse'](_0x31123b[_0x51b984(0x20b)](0x6));return _0x10da20?.['result']?.[_0x51b984(0x1e0)]?.[0x0]?.[_0x51b984(0x1e3)]?JSON['parse'](_0x10da20['result'][_0x51b984(0x1e0)][0x0][_0x51b984(0x1e3)]):_0x10da20;}return{'ok':!0x1,'error':_0x51b984(0x22e)};}K[a0_0x1bfcde(0x1fe)](a0_0x3d1ab7,async _0x5ec644=>{const _0x2ad2c=a0_0x1bfcde;let {name:_0x93baa8,arguments:_0x2c4815}=_0x5ec644['params'];if(_0x93baa8==='commhub_reply'){let {task_id:_0x4671f5,text:_0x22d80e,status:_0x15be96}=_0x2c4815;if(_0x15be96===_0x2ad2c(0x1e4)||_0x15be96===_0x2ad2c(0x220)||_0x15be96===_0x2ad2c(0x252)){let _0x2e5106=_0x15be96===_0x2ad2c(0x1e4)?_0x2ad2c(0x23a):_0x15be96,_0x1142b0=_0x4671f5?k[_0x2ad2c(0x201)](_0x4671f5)||_0x2ad2c(0x226):'hub',_0x1a838a=await P(_0x2ad2c(0x24f),{'alias':_0x1142b0,'text':_0x22d80e,'in_reply_to':_0x4671f5||void 0x0,'status':_0x2e5106,'from_session':Z});if(_0x4671f5)k['delete'](_0x4671f5);return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON[_0x2ad2c(0x25c)](_0x1a838a)}]};}let _0x1ebe8d=await P(_0x2ad2c(0x22b),{'resume_id':w,'alias':Z,'status':_0x15be96==='blocked'?_0x2ad2c(0x205):_0x15be96==='error'?_0x2ad2c(0x1e8):'working','task':_0x22d80e[_0x2ad2c(0x20b)](0x0,0xc8),'output':_0x22d80e});return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON[_0x2ad2c(0x25c)](_0x1ebe8d)}]};}if(_0x93baa8===_0x2ad2c(0x241)){let {status:_0x41a26b,task:_0x3ad149,progress:_0x5cfc7e}=_0x2c4815,_0xbb9721=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x41a26b,'task':_0x3ad149,'progress':_0x5cfc7e});return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON[_0x2ad2c(0x25c)](_0xbb9721)}]};}if(_0x93baa8===_0x2ad2c(0x233)){let {alias:_0x537a0e,task:_0x506210,priority:_0x5131c3}=_0x2c4815,_0x467616=await P(_0x2ad2c(0x256),{'alias':_0x537a0e,'task':_0x506210,'priority':_0x5131c3||_0x2ad2c(0x21a),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x2ad2c(0x25c)](_0x467616)}]};}if(_0x93baa8===_0x2ad2c(0x22c)){let {alias:_0x15ab1a,message:_0x2cae7d}=_0x2c4815,_0x3a1d68=await P(_0x2ad2c(0x1dd),{'alias':_0x15ab1a,'message':_0x2cae7d,'from_session':Z});return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON[_0x2ad2c(0x25c)](_0x3a1d68)}]};}if(_0x93baa8===_0x2ad2c(0x238)){let _0x322f88=await P(_0x2ad2c(0x248),{});return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON[_0x2ad2c(0x25c)](_0x322f88)}]};}return{'content':[{'type':_0x2ad2c(0x1e3),'text':JSON['stringify']({'error':_0x2ad2c(0x1f5)})}]};});async function v(){const _0x2eff2b=a0_0x1bfcde;let _0x21dfdb=D+'/events/'+encodeURIComponent(Z),_0x23d0ff={};if(X)_0x23d0ff['Authorization']=_0x2eff2b(0x20c)+X;Y('connecting\x20to\x20'+_0x21dfdb);while(!0x0){try{let _0x101c64=await fetch(_0x21dfdb,{'headers':_0x23d0ff});if(!_0x101c64['ok']){Y('SSE\x20error:\x20'+_0x101c64[_0x2eff2b(0x20e)]+'\x20'+_0x101c64[_0x2eff2b(0x247)]),await h(0x1388);continue;}let _0x590abd=_0x101c64[_0x2eff2b(0x245)]['getReader'](),_0x592518=new TextDecoder(),_0x556545='';while(!0x0){let {done:_0x25bf4a,value:_0x2106a3}=await _0x590abd['read']();if(_0x25bf4a)break;_0x556545+=_0x592518['decode'](_0x2106a3,{'stream':!0x0});let _0x48b926=_0x556545[_0x2eff2b(0x207)]('\x0a\x0a');_0x556545=_0x48b926[_0x2eff2b(0x1ed)]()||'';for(let _0x2ceefc of _0x48b926){let _0xe3f426=_0x2ceefc[_0x2eff2b(0x207)]('\x0a')[_0x2eff2b(0x1fc)](_0x281105=>_0x281105[_0x2eff2b(0x24b)](_0x2eff2b(0x218)));if(!_0xe3f426)continue;try{let _0x4b59eb=JSON[_0x2eff2b(0x222)](_0xe3f426['slice'](0x6));await u(_0x4b59eb);}catch(_0x1c9c74){Y(_0x2eff2b(0x1f7)+_0x1c9c74);}}}Y(_0x2eff2b(0x1f2));}catch(_0x3d705e){Y(_0x2eff2b(0x253)+_0x3d705e);}await h(0xbb8);}}async function u(_0x18ef59){const _0x13eb17=a0_0x1bfcde;if(_0x18ef59['type']===_0x13eb17(0x24c)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x18ef59['type']==='new_message'){if(Y(_0x13eb17(0x231)+_0x18ef59[_0x13eb17(0x23f)]+':\x20'+_0x18ef59['message'][_0x13eb17(0x20b)](0x0,0x3c)),await K[_0x13eb17(0x1db)]({'method':_0x13eb17(0x1e2),'params':{'content':_0x18ef59[_0x13eb17(0x232)],'meta':{'sender':_0x18ef59[_0x13eb17(0x23f)]||_0x13eb17(0x226),'sender_id':_0x13eb17(0x1f8),'user':_0x18ef59[_0x13eb17(0x23f)]||_0x13eb17(0x226),'priority':_0x13eb17(0x21a)}}}),_0x18ef59[_0x13eb17(0x1e1)])await P('ack_inbox',{'alias':Z,'message_id':_0x18ef59[_0x13eb17(0x1e1)]});return;}if(_0x18ef59['type']==='new_task'||_0x18ef59[_0x13eb17(0x208)]===_0x13eb17(0x23e)){Y('←\x20'+_0x18ef59[_0x13eb17(0x208)]+':\x20inbox_count='+_0x18ef59[_0x13eb17(0x25a)]+_0x13eb17(0x255)+(_0x18ef59[_0x13eb17(0x212)]||_0x13eb17(0x21a)));let _0x22d86c=await P(_0x13eb17(0x242),{'alias':Z,'limit':0x5});if(_0x22d86c?.['ok']&&_0x22d86c[_0x13eb17(0x21d)]?.[_0x13eb17(0x22a)]>0x0)for(let _0x183b31 of _0x22d86c['messages']){let _0x32cb18={'sender':_0x183b31[_0x13eb17(0x21c)]||_0x13eb17(0x226),'sender_id':_0x13eb17(0x1f8),'user':_0x183b31['from_session']||'hub','task_id':_0x183b31['id'],'priority':_0x183b31[_0x13eb17(0x212)]||_0x13eb17(0x21a)};k[_0x13eb17(0x235)](_0x183b31['id'],_0x183b31[_0x13eb17(0x21c)]||'hub'),await K['notification']({'method':'notifications/claude/channel','params':{'content':_0x183b31['content'],'meta':_0x32cb18}}),Y('→\x20injected\x20task\x20'+_0x183b31['id'][_0x13eb17(0x20b)](0x0,0x8)+_0x13eb17(0x1eb)+_0x183b31[_0x13eb17(0x21c)]+':\x20'+_0x183b31[_0x13eb17(0x1e0)][_0x13eb17(0x20b)](0x0,0x3c)),await P(_0x13eb17(0x228),{'alias':Z,'message_id':_0x183b31['id']});}}}async function S(){const _0x23dbcc=a0_0x1bfcde;let _0x4a99d9=new a0_0x90d41f();await K[_0x23dbcc(0x1dc)](_0x4a99d9),Y(_0x23dbcc(0x1ef)),Y('starting\x20SSE\x20listener...'),v()[_0x23dbcc(0x204)](_0x1f0f98=>Y('SSE\x20fatal:\x20'+_0x1f0f98)),P(_0x23dbcc(0x22b),{'resume_id':w,'alias':Z,'status':_0x23dbcc(0x1f3),'server':a0_0x4dcd02(),'hostname':a0_0x4dcd02(),'agent':_0x23dbcc(0x216),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})['then'](()=>Y(_0x23dbcc(0x243)+Z+_0x23dbcc(0x20a)+w[_0x23dbcc(0x20b)](0x0,0x8)+')'))[_0x23dbcc(0x204)](_0x292b2e=>Y(_0x23dbcc(0x237)+_0x292b2e)),setInterval(()=>{const _0xb9ba01=_0x23dbcc;P('report_status',{'resume_id':w,'alias':Z,'status':_0xb9ba01(0x1f3),'server':a0_0x4dcd02(),'hostname':a0_0x4dcd02(),'agent':_0xb9ba01(0x216),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0xb9ba01(0x204)](_0x35d54f=>Y(_0xb9ba01(0x23d)+_0x35d54f));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}S()[a0_0x1bfcde(0x204)](_0x76d579=>{const _0x4b8e13=a0_0x1bfcde;Y('fatal:\x20'+_0x76d579),process[_0x4b8e13(0x22f)](0x1);});async function N(){const _0x3c9ff6=a0_0x1bfcde;Y(_0x3c9ff6(0x1df)),await P(_0x3c9ff6(0x22b),{'resume_id':w,'alias':Z,'status':'error','task':'session\x20disconnected'})[_0x3c9ff6(0x204)](()=>{}),process[_0x3c9ff6(0x22f)](0x0);}process['stdin']['on'](a0_0x1bfcde(0x25b),()=>N()),process['on'](a0_0x1bfcde(0x1f1),()=>N()),process['on'](a0_0x1bfcde(0x246),()=>N());
|
|
2
|
+
const a0_0x1f921f=a0_0x5b87;(function(_0x92ca2d,_0xdcabd2){const _0xd815c6=a0_0x5b87,_0x56e5cc=_0x92ca2d();while(!![]){try{const _0x283ba2=-parseInt(_0xd815c6(0x22c))/0x1*(parseInt(_0xd815c6(0x1df))/0x2)+-parseInt(_0xd815c6(0x234))/0x3+parseInt(_0xd815c6(0x1f8))/0x4*(parseInt(_0xd815c6(0x21d))/0x5)+-parseInt(_0xd815c6(0x21e))/0x6+parseInt(_0xd815c6(0x232))/0x7*(parseInt(_0xd815c6(0x1de))/0x8)+parseInt(_0xd815c6(0x1d1))/0x9+parseInt(_0xd815c6(0x207))/0xa*(parseInt(_0xd815c6(0x233))/0xb);if(_0x283ba2===_0xdcabd2)break;else _0x56e5cc['push'](_0x56e5cc['shift']());}catch(_0x5c2d9a){_0x56e5cc['push'](_0x56e5cc['shift']());}}}(a0_0x4216,0x594b5));import{readFileSync as a0_0x4f884a,existsSync as a0_0x587c12}from'fs';function a0_0x5b87(_0x25f8d6,_0x412276){_0x25f8d6=_0x25f8d6-0x1d1;const _0x421618=a0_0x4216();let _0x5b8784=_0x421618[_0x25f8d6];return _0x5b8784;}import{randomUUID as a0_0x34b683}from'crypto';import{join as a0_0x1f98a4}from'path';import{hostname as a0_0x116d52}from'os';import{execSync as a0_0x1be896}from'child_process';import{Server as a0_0x146840}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x51fe97}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x140c99,CallToolRequestSchema as a0_0x5560f9}from'@modelcontextprotocol/sdk/types.js';function p(_0x4c8407){const _0x56e4a2=a0_0x5b87;if(!a0_0x587c12(_0x4c8407))return;for(let _0x54e779 of a0_0x4f884a(_0x4c8407,_0x56e4a2(0x25e))[_0x56e4a2(0x201)]('\x0a')){let _0x4abdb9=_0x54e779[_0x56e4a2(0x23a)]();if(!_0x4abdb9||_0x4abdb9[_0x56e4a2(0x20c)]('#'))continue;let _0x45b178=_0x4abdb9['indexOf']('=');if(_0x45b178<0x0)continue;let _0x138b39=_0x4abdb9['slice'](0x0,_0x45b178)[_0x56e4a2(0x23a)](),_0xbaf729=_0x4abdb9['slice'](_0x45b178+0x1)[_0x56e4a2(0x23a)]()[_0x56e4a2(0x223)](/^["']|["']$/g,'');if(!process.env[_0x138b39])process.env[_0x138b39]=_0xbaf729;}}var C=process.env.HOME||'~',T=a0_0x1f98a4(C,'.claude/channels/commhub');p(a0_0x1f98a4(T,a0_0x1f921f(0x211)));var L=process[a0_0x1f921f(0x240)]()['replace'](/\//g,'-');p(a0_0x1f98a4(T,L,'.env'));function U(){const _0xeff77c=a0_0x1f921f;try{return a0_0x1be896(_0xeff77c(0x206),{'encoding':'utf-8','timeout':0x7d0})['trim']();}catch{return'';}}function v(){const _0x3cc6ab=a0_0x1f921f;try{let _0x1cd45a=a0_0x1f98a4(C,_0x3cc6ab(0x23e),_0x3cc6ab(0x248));if(a0_0x587c12(_0x1cd45a))return JSON[_0x3cc6ab(0x1e9)](a0_0x4f884a(_0x1cd45a,_0x3cc6ab(0x25e)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x1f921f(0x251)]||a0_0x1f921f(0x21c),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x116d52(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x34b683(),X=process.env.COMMHUB_TOKEN||H[a0_0x1f921f(0x227)]||'';function Y(_0x4213b6){const _0x422b10=a0_0x1f921f;let _0x5ecf92=new Date()['toTimeString']()[_0x422b10(0x21a)](0x0,0x8);process[_0x422b10(0x20f)]['write']('['+_0x5ecf92+_0x422b10(0x23d)+_0x4213b6+'\x0a');}function h(_0xa02ce3){return new Promise(_0x20421e=>setTimeout(_0x20421e,_0xa02ce3));}Y(a0_0x1f921f(0x21f)+f+a0_0x1f921f(0x222)+Z+a0_0x1f921f(0x20d)+w[a0_0x1f921f(0x21a)](0x0,0x8)+a0_0x1f921f(0x246)+(j||'none')+a0_0x1f921f(0x252)+process['cwd']()+a0_0x1f921f(0x1d2)+L);var k=new Map(),K=new a0_0x146840({'name':a0_0x1f921f(0x237),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x1f921f(0x24a),a0_0x1f921f(0x1db),a0_0x1f921f(0x20e),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x1f921f(0x24d)+Z][a0_0x1f921f(0x1fa)]('\x0a')});function a0_0x4216(){const _0x105537=['data:\x20','new_task','catch','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Bearer\x20','number','get_inbox','inbox_count','working','utf-8','182529ZOINzN','\x20PROJECT_ENV=','priority','from','Priority\x20(default:\x20normal)','SSE\x20connected\x20as\x20\x22','end','registered\x20as\x20\x22','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','heartbeat\x20failed:\x20','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Target\x20session\x20alias','tools/call','8sBXZiU','2BJlfWU','message_id','message','notifications/claude/channel','commhub_send_message','unknown\x20tool','type','no\x20response','commhub','/events/','parse','replied','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','connected','messages','stdin','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','find','2.0','connect','get','read','body','send_reply','session\x20disconnected','500316vXzOOy','initialize','join','commhub_get_all_status','Task\x20content','CommHub\x20init\x20failed:\x20','task','Current\x20task\x20description','text','split','application/json,\x20text/event-stream','idle','cancelled','decode','tmux\x20display-message\x20-p\x20\x27#S\x27','10hhfINw','getReader','new_message','setRequestHandler','/mcp','startsWith','\x20RESUME_ID=','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','stderr','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','.env','SSE\x20connection\x20error:\x20','then','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','object','low','string','2025-03-26','content','slice','←\x20message\x20from\x20','http://127.0.0.1:9200','15TjTHUq','2518674fGuppK','ENV:\x20URL=','statusText','→\x20injected\x20task\x20','\x20ALIAS=','replace','error','Message\x20content','ready\x20—\x20waiting\x20for\x20events','token','SIGTERM','init\x20failed:\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','stringify','440261NqyNjG','length','exit','status','SSE\x20fatal:\x20','ack_inbox','4935679hRftfi','3686155viKmnL','629793vmvGFX','Reply\x20text\x20/\x20result\x20summary','result','commhub-channel','get_all_status','report_status','trim','POST','commhub_reply',']\x20[commhub]\x20','.anet','alias','cwd','normal','failed','completed','claude-code','commhub_report_status','...\x20TMUX=','notification','config.json','blocked','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','application/json','commhub_send_task','Session\x20alias:\x20','\x20priority=','warning:\x20could\x20not\x20register:\x20','0.3.0','hub','\x20CWD=','from_session','send_message'];a0_0x4216=function(){return _0x105537;};return a0_0x4216();}K[a0_0x1f921f(0x20a)](a0_0x140c99,async()=>({'tools':[{'name':a0_0x1f921f(0x23c),'description':a0_0x1f921f(0x22a),'inputSchema':{'type':a0_0x1f921f(0x215),'properties':{'task_id':{'type':a0_0x1f921f(0x217),'description':a0_0x1f921f(0x214)},'text':{'type':'string','description':a0_0x1f921f(0x235)},'status':{'type':'string','enum':[a0_0x1f921f(0x243),a0_0x1f921f(0x242),a0_0x1f921f(0x204),a0_0x1f921f(0x249),'error','in_progress'],'description':a0_0x1f921f(0x210)}},'required':[a0_0x1f921f(0x200)]}},{'name':a0_0x1f921f(0x245),'description':a0_0x1f921f(0x258),'inputSchema':{'type':a0_0x1f921f(0x215),'properties':{'status':{'type':a0_0x1f921f(0x217),'enum':[a0_0x1f921f(0x25d),'idle',a0_0x1f921f(0x249),a0_0x1f921f(0x224)]},'task':{'type':a0_0x1f921f(0x217),'description':a0_0x1f921f(0x1ff)},'progress':{'type':a0_0x1f921f(0x25a),'description':'Progress\x200-100'}},'required':[a0_0x1f921f(0x22f)]}},{'name':a0_0x1f921f(0x24c),'description':a0_0x1f921f(0x1eb),'inputSchema':{'type':a0_0x1f921f(0x215),'properties':{'alias':{'type':a0_0x1f921f(0x217),'description':a0_0x1f921f(0x1dc)},'task':{'type':a0_0x1f921f(0x217),'description':a0_0x1f921f(0x1fc)},'priority':{'type':a0_0x1f921f(0x217),'enum':['high','normal',a0_0x1f921f(0x216)],'description':a0_0x1f921f(0x1d5)}},'required':['alias',a0_0x1f921f(0x1fe)]}},{'name':a0_0x1f921f(0x1e3),'description':a0_0x1f921f(0x1d9),'inputSchema':{'type':a0_0x1f921f(0x215),'properties':{'alias':{'type':a0_0x1f921f(0x217),'description':a0_0x1f921f(0x1dc)},'message':{'type':'string','description':a0_0x1f921f(0x225)}},'required':[a0_0x1f921f(0x23f),a0_0x1f921f(0x1e1)]}},{'name':a0_0x1f921f(0x1fb),'description':a0_0x1f921f(0x1ef),'inputSchema':{'type':a0_0x1f921f(0x215),'properties':{}}}]}));async function P(_0x21579c,_0x2263f1){const _0xf9c0c8=a0_0x1f921f;let _0x4c0e0e=await fetch(f+_0xf9c0c8(0x20b),{'method':_0xf9c0c8(0x23b),'headers':{'Content-Type':_0xf9c0c8(0x24b),'Accept':_0xf9c0c8(0x202),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x1,'method':_0xf9c0c8(0x1f9),'params':{'protocolVersion':_0xf9c0c8(0x218),'capabilities':{},'clientInfo':{'name':_0xf9c0c8(0x237),'version':_0xf9c0c8(0x250)}}})});if(!_0x4c0e0e['ok']){let _0x503d5b=await _0x4c0e0e[_0xf9c0c8(0x200)]();return Y(_0xf9c0c8(0x1fd)+_0x4c0e0e[_0xf9c0c8(0x22f)]+'\x20'+_0x503d5b[_0xf9c0c8(0x21a)](0x0,0x64)),{'ok':!0x1,'error':_0xf9c0c8(0x229)+_0x4c0e0e[_0xf9c0c8(0x22f)]};}await _0x4c0e0e['text']();let _0x4a2b2b=(await(await fetch(f+'/mcp',{'method':_0xf9c0c8(0x23b),'headers':{'Content-Type':'application/json','Accept':_0xf9c0c8(0x202),...X?{'Authorization':_0xf9c0c8(0x259)+X}:{}},'body':JSON[_0xf9c0c8(0x22b)]({'jsonrpc':_0xf9c0c8(0x1f1),'id':0x2,'method':_0xf9c0c8(0x1dd),'params':{'name':_0x21579c,'arguments':_0x2263f1}})}))[_0xf9c0c8(0x200)]())[_0xf9c0c8(0x201)]('\x0a')[_0xf9c0c8(0x1f0)](_0x5aad60=>_0x5aad60[_0xf9c0c8(0x20c)](_0xf9c0c8(0x255)));if(_0x4a2b2b){let _0x2ce1cc=JSON[_0xf9c0c8(0x1e9)](_0x4a2b2b[_0xf9c0c8(0x21a)](0x6));return _0x2ce1cc?.[_0xf9c0c8(0x236)]?.[_0xf9c0c8(0x219)]?.[0x0]?.[_0xf9c0c8(0x200)]?JSON[_0xf9c0c8(0x1e9)](_0x2ce1cc[_0xf9c0c8(0x236)][_0xf9c0c8(0x219)][0x0]['text']):_0x2ce1cc;}return{'ok':!0x1,'error':_0xf9c0c8(0x1e6)};}K[a0_0x1f921f(0x20a)](a0_0x5560f9,async _0x2da047=>{const _0x5df8e8=a0_0x1f921f;let {name:_0x5bd268,arguments:_0x4175d3}=_0x2da047['params'];if(_0x5bd268===_0x5df8e8(0x23c)){let {task_id:_0x4959e8,text:_0x203018,status:_0x3ea46c}=_0x4175d3;if(_0x3ea46c==='completed'||_0x3ea46c===_0x5df8e8(0x242)||_0x3ea46c==='cancelled'){let _0x5ac1e0=_0x3ea46c===_0x5df8e8(0x243)?_0x5df8e8(0x1ea):_0x3ea46c,_0x57d812=_0x4959e8?k[_0x5df8e8(0x1f3)](_0x4959e8)||_0x5df8e8(0x251):_0x5df8e8(0x251),_0x559d4c=await P(_0x5df8e8(0x1f6),{'alias':_0x57d812,'text':_0x203018,'in_reply_to':_0x4959e8||void 0x0,'status':_0x5ac1e0,'from_session':Z});if(_0x4959e8)k['delete'](_0x4959e8);return{'content':[{'type':_0x5df8e8(0x200),'text':JSON[_0x5df8e8(0x22b)](_0x559d4c)}]};}let _0x596c81=await P(_0x5df8e8(0x239),{'resume_id':w,'alias':Z,'status':_0x3ea46c==='blocked'?_0x5df8e8(0x249):_0x3ea46c===_0x5df8e8(0x224)?_0x5df8e8(0x224):_0x5df8e8(0x25d),'task':_0x203018[_0x5df8e8(0x21a)](0x0,0xc8),'output':_0x203018});return{'content':[{'type':_0x5df8e8(0x200),'text':JSON[_0x5df8e8(0x22b)](_0x596c81)}]};}if(_0x5bd268===_0x5df8e8(0x245)){let {status:_0x2dd303,task:_0x33bf6b,progress:_0xf3b3e3}=_0x4175d3,_0x25b3fa=await P(_0x5df8e8(0x239),{'resume_id':w,'alias':Z,'status':_0x2dd303,'task':_0x33bf6b,'progress':_0xf3b3e3});return{'content':[{'type':_0x5df8e8(0x200),'text':JSON[_0x5df8e8(0x22b)](_0x25b3fa)}]};}if(_0x5bd268===_0x5df8e8(0x24c)){let {alias:_0x1e1f5e,task:_0x33477c,priority:_0x2a2ab5}=_0x4175d3,_0x17b25b=await P('send_task',{'alias':_0x1e1f5e,'task':_0x33477c,'priority':_0x2a2ab5||_0x5df8e8(0x241),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x5df8e8(0x22b)](_0x17b25b)}]};}if(_0x5bd268===_0x5df8e8(0x1e3)){let {alias:_0x49a7bd,message:_0x3595dd}=_0x4175d3,_0x48a20a=await P(_0x5df8e8(0x254),{'alias':_0x49a7bd,'message':_0x3595dd,'from_session':Z});return{'content':[{'type':_0x5df8e8(0x200),'text':JSON[_0x5df8e8(0x22b)](_0x48a20a)}]};}if(_0x5bd268===_0x5df8e8(0x1fb)){let _0x223836=await P(_0x5df8e8(0x238),{});return{'content':[{'type':'text','text':JSON['stringify'](_0x223836)}]};}return{'content':[{'type':_0x5df8e8(0x200),'text':JSON[_0x5df8e8(0x22b)]({'error':_0x5df8e8(0x1e4)})}]};});async function u(){const _0x16cec5=a0_0x1f921f;let _0x575aa7=f+_0x16cec5(0x1e8)+encodeURIComponent(Z),_0x57fe5b={};if(X)_0x57fe5b['Authorization']=_0x16cec5(0x259)+X;Y('connecting\x20to\x20'+_0x575aa7);while(!0x0){try{let _0x25dda5=await fetch(_0x575aa7,{'headers':_0x57fe5b});if(!_0x25dda5['ok']){Y('SSE\x20error:\x20'+_0x25dda5[_0x16cec5(0x22f)]+'\x20'+_0x25dda5[_0x16cec5(0x220)]),await h(0x1388);continue;}let _0x1daa25=_0x25dda5[_0x16cec5(0x1f5)][_0x16cec5(0x208)](),_0x32d971=new TextDecoder(),_0x4c0f86='';while(!0x0){let {done:_0x517ed8,value:_0x55076d}=await _0x1daa25[_0x16cec5(0x1f4)]();if(_0x517ed8)break;_0x4c0f86+=_0x32d971[_0x16cec5(0x205)](_0x55076d,{'stream':!0x0});let _0x25ff0f=_0x4c0f86[_0x16cec5(0x201)]('\x0a\x0a');_0x4c0f86=_0x25ff0f['pop']()||'';for(let _0x1911e4 of _0x25ff0f){let _0x4be4f2=_0x1911e4[_0x16cec5(0x201)]('\x0a')[_0x16cec5(0x1f0)](_0x41ad3e=>_0x41ad3e[_0x16cec5(0x20c)]('data:\x20'));if(!_0x4be4f2)continue;try{let _0x301d3b=JSON[_0x16cec5(0x1e9)](_0x4be4f2['slice'](0x6));await S(_0x301d3b);}catch(_0x2801d8){Y('parse\x20error:\x20'+_0x2801d8);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x573617){Y(_0x16cec5(0x212)+_0x573617);}await h(0xbb8);}}async function S(_0x136b3c){const _0x11d270=a0_0x1f921f;if(_0x136b3c[_0x11d270(0x1e5)]===_0x11d270(0x1ec)){Y(_0x11d270(0x1d6)+Z+'\x22');return;}if(_0x136b3c[_0x11d270(0x1e5)]===_0x11d270(0x209)){if(Y(_0x11d270(0x21b)+_0x136b3c[_0x11d270(0x1d4)]+':\x20'+_0x136b3c['message'][_0x11d270(0x21a)](0x0,0x3c)),await K['notification']({'method':_0x11d270(0x1e2),'params':{'content':_0x136b3c[_0x11d270(0x1e1)],'meta':{'sender':_0x136b3c['from']||_0x11d270(0x251),'sender_id':'commhub','user':_0x136b3c['from']||_0x11d270(0x251),'priority':_0x11d270(0x241)}}}),_0x136b3c[_0x11d270(0x1e0)])await P(_0x11d270(0x231),{'alias':Z,'message_id':_0x136b3c[_0x11d270(0x1e0)]});return;}if(_0x136b3c['type']===_0x11d270(0x256)||_0x136b3c['type']==='broadcast'){Y('←\x20'+_0x136b3c[_0x11d270(0x1e5)]+':\x20inbox_count='+_0x136b3c[_0x11d270(0x25c)]+_0x11d270(0x24e)+(_0x136b3c[_0x11d270(0x1d3)]||_0x11d270(0x241)));let _0x35ba66=await P(_0x11d270(0x25b),{'alias':Z,'limit':0x5});if(_0x35ba66?.['ok']&&_0x35ba66[_0x11d270(0x1ed)]?.[_0x11d270(0x22d)]>0x0)for(let _0x3e23a4 of _0x35ba66['messages']){let _0x2f9160={'sender':_0x3e23a4['from_session']||_0x11d270(0x251),'sender_id':_0x11d270(0x1e7),'user':_0x3e23a4[_0x11d270(0x253)]||_0x11d270(0x251),'task_id':_0x3e23a4['id'],'priority':_0x3e23a4[_0x11d270(0x1d3)]||_0x11d270(0x241)};k['set'](_0x3e23a4['id'],_0x3e23a4[_0x11d270(0x253)]||_0x11d270(0x251)),await K[_0x11d270(0x247)]({'method':'notifications/claude/channel','params':{'content':_0x3e23a4['content'],'meta':_0x2f9160}}),Y(_0x11d270(0x221)+_0x3e23a4['id']['slice'](0x0,0x8)+'\x20from\x20'+_0x3e23a4['from_session']+':\x20'+_0x3e23a4[_0x11d270(0x219)][_0x11d270(0x21a)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x3e23a4['id']});}}}async function A(){const _0x1a7e37=a0_0x1f921f;let _0x50cce9=new a0_0x51fe97();await K[_0x1a7e37(0x1f2)](_0x50cce9),Y('MCP\x20stdio\x20connected'),Y('starting\x20SSE\x20listener...'),u()[_0x1a7e37(0x257)](_0xac0d9b=>Y(_0x1a7e37(0x230)+_0xac0d9b)),P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x116d52(),'hostname':a0_0x116d52(),'agent':_0x1a7e37(0x244),'project_dir':process[_0x1a7e37(0x240)](),'tmux_name':j||void 0x0})[_0x1a7e37(0x213)](()=>Y(_0x1a7e37(0x1d8)+Z+'\x22\x20('+w['slice'](0x0,0x8)+')'))[_0x1a7e37(0x257)](_0x5dc817=>Y(_0x1a7e37(0x24f)+_0x5dc817)),setInterval(()=>{const _0x7ff878=_0x1a7e37;P('report_status',{'resume_id':w,'alias':Z,'status':_0x7ff878(0x203),'server':a0_0x116d52(),'hostname':a0_0x116d52(),'agent':_0x7ff878(0x244),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x7ff878(0x257)](_0x24ac6b=>Y(_0x7ff878(0x1da)+_0x24ac6b));},0x2bf20),Y(_0x1a7e37(0x226));}A()[a0_0x1f921f(0x257)](_0x50ad74=>{const _0x1a5465=a0_0x1f921f;Y('fatal:\x20'+_0x50ad74),process[_0x1a5465(0x22e)](0x1);});async function N(){const _0x146193=a0_0x1f921f;Y('shutting\x20down,\x20reporting\x20offline...'),await P(_0x146193(0x239),{'resume_id':w,'alias':Z,'status':'error','task':_0x146193(0x1f7)})[_0x146193(0x257)](()=>{}),process['exit'](0x0);}process[a0_0x1f921f(0x1ee)]['on'](a0_0x1f921f(0x1d7),()=>N()),process['on'](a0_0x1f921f(0x228),()=>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.
|
|
3
|
+
"version": "2.0.1-preview.1",
|
|
4
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",
|