@sleep2agi/agent-network 2.0.3-preview.3 → 2.0.3-preview.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +1 -1
- package/dist/src/client.js +1 -1
- package/dist/src/node-server.js +1 -1
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0xf03d1c=a0_0x1204;(function(_0x28468d,_0x472b14){const _0x8c9c64=a0_0x1204,_0x580548=_0x28468d();while(!![]){try{const _0x47a8a9=parseInt(_0x8c9c64(0x116))/0x1+-parseInt(_0x8c9c64(0x133))/0x2+-parseInt(_0x8c9c64(0xef))/0x3*(parseInt(_0x8c9c64(0xe6))/0x4)+-parseInt(_0x8c9c64(0xed))/0x5+-parseInt(_0x8c9c64(0x126))/0x6+-parseInt(_0x8c9c64(0xfe))/0x7+parseInt(_0x8c9c64(0x12c))/0x8*(parseInt(_0x8c9c64(0xf9))/0x9);if(_0x47a8a9===_0x472b14)break;else _0x580548['push'](_0x580548['shift']());}catch(_0x4d89bc){_0x580548['push'](_0x580548['shift']());}}}(a0_0x3eb5,0x92d26));import{EventEmitter as a0_0x465e08}from'events';import{hostname as a0_0xa32fd4}from'os';class T extends a0_0x465e08{[a0_0xf03d1c(0x109)];[a0_0xf03d1c(0xf6)];[a0_0xf03d1c(0xe5)];[a0_0xf03d1c(0xdd)];[a0_0xf03d1c(0x125)];['heartbeatInterval'];[a0_0xf03d1c(0x111)];[a0_0xf03d1c(0x103)];['sseAbort'];[a0_0xf03d1c(0x113)]=!0x1;constructor(_0x247cb8){const _0xf029ad=a0_0xf03d1c;super();if(this[_0xf029ad(0x109)]=_0x247cb8[_0xf029ad(0x109)][_0xf029ad(0x12b)](/\/$/,''),this[_0xf029ad(0xf6)]=_0x247cb8[_0xf029ad(0xf6)],this['token']=_0x247cb8['token'],this[_0xf029ad(0xdd)]=_0x247cb8[_0xf029ad(0xdd)]||'sdk',this[_0xf029ad(0x125)]='sdk-'+_0x247cb8[_0xf029ad(0xf6)]+'-'+Date[_0xf029ad(0xf1)]()[_0xf029ad(0x105)](0x24),this[_0xf029ad(0x110)]=_0x247cb8['heartbeatInterval']??0x2bf20,this['reconnectDelay']=_0x247cb8['reconnectDelay']??0xbb8,_0x247cb8[_0xf029ad(0xe2)]!==!0x1)this['connect']();}['log'](_0xe86a0f){const _0x589cf2=a0_0xf03d1c;console[_0x589cf2(0xe9)]('['+new Date()[_0x589cf2(0x119)]()['slice'](0x0,0x8)+_0x589cf2(0x12e)+this[_0x589cf2(0xf6)]+']\x20'+_0xe86a0f);}async['call'](_0xd474b1,_0x5ab1cb){const _0x99da59=a0_0xf03d1c;let _0x258ac9={'Content-Type':_0x99da59(0x104),'Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x258ac9[_0x99da59(0xe4)]=_0x99da59(0x11a)+this[_0x99da59(0xe5)];let _0x1255a2=await(await fetch(this['url']+_0x99da59(0xe0),{'method':_0x99da59(0xf2),'headers':_0x258ac9,'body':JSON[_0x99da59(0xdb)]({'jsonrpc':_0x99da59(0xec),'id':Date['now'](),'method':'tools/call','params':{'name':_0xd474b1,'arguments':_0x5ab1cb}})}))[_0x99da59(0xee)](),_0x402abc=_0x1255a2['match'](/data: (.+)/),_0x2a05e1=_0x402abc?JSON[_0x99da59(0xf5)](_0x402abc[0x1]):JSON['parse'](_0x1255a2),_0x5ab79a=_0x2a05e1?.[_0x99da59(0x120)]?.['content']?.[0x0]?.[_0x99da59(0xee)];return _0x5ab79a?JSON['parse'](_0x5ab79a):_0x2a05e1;}async[a0_0xf03d1c(0xe7)](){const _0x1ac6cf=a0_0xf03d1c;if(this[_0x1ac6cf(0x113)])return;this[_0x1ac6cf(0x113)]=!0x0,await this[_0x1ac6cf(0x112)]('idle'),this[_0x1ac6cf(0xe9)]('registered'),this[_0x1ac6cf(0x103)]=setInterval(()=>{const _0x45bcc2=_0x1ac6cf;this[_0x45bcc2(0x112)](_0x45bcc2(0x10f))[_0x45bcc2(0x121)](_0x1fed41=>this['log'](_0x45bcc2(0x114)+_0x1fed41[_0x45bcc2(0x130)]));},this['heartbeatInterval']),this[_0x1ac6cf(0x129)]();}async['disconnect'](){const _0x3185ed=a0_0xf03d1c;if(this['running']=!0x1,this[_0x3185ed(0x131)]?.[_0x3185ed(0x124)](),this[_0x3185ed(0x103)])clearInterval(this[_0x3185ed(0x103)]);await this[_0x3185ed(0x112)](_0x3185ed(0xfa))[_0x3185ed(0x121)](()=>{}),this[_0x3185ed(0xe9)](_0x3185ed(0x10a));}async[a0_0xf03d1c(0xf7)](_0x51967c,_0x14c3aa,_0x26eff6=a0_0xf03d1c(0x11e)){const _0x509530=a0_0xf03d1c;return this[_0x509530(0x10c)]('send_task',{'alias':_0x51967c,'task':_0x14c3aa,'priority':_0x26eff6,'from_session':this[_0x509530(0xf6)]});}async['message'](_0x327263,_0x4b6f05){const _0x40c94c=a0_0xf03d1c;return this[_0x40c94c(0x10c)](_0x40c94c(0xde),{'alias':_0x327263,'message':_0x4b6f05,'from_session':this[_0x40c94c(0xf6)]});}async[a0_0xf03d1c(0xfc)](_0x5ac465,_0x291aca,_0x140300=a0_0xf03d1c(0x11c)){const _0x16b0da=a0_0xf03d1c;return this[_0x16b0da(0x10c)]('reply',{'task_id':_0x5ac465,'text':_0x291aca,'status':_0x140300});}async['status'](_0x904060,_0x49651d){const _0x951d4f=a0_0xf03d1c;return this[_0x951d4f(0x10c)](_0x951d4f(0x12f),{'resume_id':this[_0x951d4f(0x125)],'alias':this[_0x951d4f(0xf6)],'status':_0x904060,'server':a0_0xa32fd4(),'hostname':a0_0xa32fd4(),'agent':this['agent'],'project_dir':process[_0x951d4f(0xf3)](),..._0x49651d});}async[a0_0xf03d1c(0xdc)](){const _0x2df97f=a0_0xf03d1c;return this[_0x2df97f(0x10c)](_0x2df97f(0x11b),{});}async[a0_0xf03d1c(0x10d)](_0x585a0f,_0x25c8a9){const _0xd22068=a0_0xf03d1c;return this[_0xd22068(0x10c)]('broadcast',{'message':_0x585a0f,'filter_server':_0x25c8a9?.[_0xd22068(0x100)],'filter_status':_0x25c8a9?.['status']});}async[a0_0xf03d1c(0x129)](){const _0x2add10=a0_0xf03d1c;let _0x4b6613=encodeURIComponent(this[_0x2add10(0xf6)]),_0x31feef=this[_0x2add10(0x109)]+_0x2add10(0xeb)+_0x4b6613,_0x315919=this[_0x2add10(0x111)];while(this[_0x2add10(0x113)]){try{this['sseAbort']=new AbortController();let _0x2968e4={'Accept':_0x2add10(0x122)};if(this[_0x2add10(0xe5)])_0x2968e4[_0x2add10(0xe4)]=_0x2add10(0x11a)+this[_0x2add10(0xe5)];let _0x30895f=await fetch(_0x31feef,{'headers':_0x2968e4,'signal':this['sseAbort'][_0x2add10(0xfd)]});if(!_0x30895f['ok']||!_0x30895f[_0x2add10(0xdf)]){this[_0x2add10(0xe9)](_0x2add10(0x102)+_0x30895f['status']),await this[_0x2add10(0xe3)](_0x315919),_0x315919=Math[_0x2add10(0xfb)](_0x315919*1.5,0xea60);continue;}_0x315919=this[_0x2add10(0x111)];let _0x152ff5=_0x30895f['body'][_0x2add10(0x123)](),_0x51af08=new TextDecoder(),_0x776ec7='';while(this['running']){let {done:_0xf52cb2,value:_0x38adbc}=await _0x152ff5[_0x2add10(0x106)]();if(_0xf52cb2)break;_0x776ec7+=_0x51af08[_0x2add10(0xea)](_0x38adbc,{'stream':!0x0});let _0x551e6b=_0x776ec7[_0x2add10(0x117)]('\x0a');_0x776ec7=_0x551e6b[_0x2add10(0x12d)]()||'';for(let _0x5f5f27 of _0x551e6b){if(!_0x5f5f27['startsWith'](_0x2add10(0x115)))continue;try{let _0x521cf1=JSON['parse'](_0x5f5f27['slice'](0x6));if(_0x521cf1[_0x2add10(0xe8)]==='connected'){this[_0x2add10(0xe9)](_0x2add10(0x11d)),this[_0x2add10(0xe1)](_0x2add10(0x11f));continue;}if(_0x521cf1['type']===_0x2add10(0xff)||_0x521cf1[_0x2add10(0xe8)]===_0x2add10(0xf8)||_0x521cf1[_0x2add10(0xe8)]===_0x2add10(0x10d))await this[_0x2add10(0x108)]();}catch{}}}}catch(_0x35a9e4){if(_0x35a9e4[_0x2add10(0x118)]===_0x2add10(0x101))break;this[_0x2add10(0xe1)](_0x2add10(0xda),_0x35a9e4),this[_0x2add10(0xe9)]('SSE\x20error:\x20'+_0x35a9e4[_0x2add10(0x130)]);}if(this[_0x2add10(0x113)])this[_0x2add10(0xe1)]('disconnected'),this[_0x2add10(0xe9)](_0x2add10(0x128)+_0x315919/0x3e8+_0x2add10(0x132)),await this[_0x2add10(0xe3)](_0x315919),_0x315919=Math[_0x2add10(0xfb)](_0x315919*1.5,0xea60);}}async['processInbox'](){const _0x33606c=a0_0xf03d1c;try{let _0x3037a3=(await this[_0x33606c(0x10c)](_0x33606c(0x10b),{'alias':this[_0x33606c(0xf6)],'limit':0xa}))?.[_0x33606c(0xf4)]||[];for(let _0xcfc378 of _0x3037a3)await this['call'](_0x33606c(0xf0),{'alias':this[_0x33606c(0xf6)],'message_id':_0xcfc378['id']}),this[_0x33606c(0xe9)]('←\x20'+_0xcfc378[_0x33606c(0x12a)]+':\x20'+_0xcfc378[_0x33606c(0x127)]['slice'](0x0,0x3c)),this[_0x33606c(0xe1)](_0x33606c(0x107),_0xcfc378),this[_0x33606c(0xe1)]('message',_0xcfc378);}catch(_0x5c2524){this[_0x33606c(0xe9)](_0x33606c(0x10e)+_0x5c2524[_0x33606c(0x130)]);}}['sleep'](_0x2d3fa8){return new Promise(_0x35afc6=>setTimeout(_0x35afc6,_0x2d3fa8));}}function a0_0x1204(_0x501cc8,_0x5da263){_0x501cc8=_0x501cc8-0xda;const _0x3eb5d1=a0_0x3eb5();let _0x120407=_0x3eb5d1[_0x501cc8];return _0x120407;}var $=T;export{$ as default,T as CommHub};function a0_0x3eb5(){const _0xa9696=['text/event-stream','getReader','abort','resumeId','1205448znzhxP','content','SSE\x20reconnecting\x20in\x20','connectSSE','from_session','replace','57520QPeeDR','pop',']\x20[commhub:','report_status','message','sseAbort','s...','1051994hnUkTO','error','stringify','getAllStatus','agent','send_message','body','/mcp','emit','autoConnect','sleep','Authorization','token','304gPlAKx','connect','type','log','decode','/events/','2.0','5850485btPjlv','text','1962pxgAJY','ack_inbox','now','POST','cwd','messages','parse','alias','send','new_message','2772fJWvfA','offline','min','reply','signal','2484412byeGca','new_task','server','AbortError','SSE\x20failed:\x20','heartbeatTimer','application/json','toString','read','task','processInbox','url','disconnected','get_inbox','call','broadcast','inbox\x20error:\x20','idle','heartbeatInterval','reconnectDelay','status','running','heartbeat\x20failed:\x20','data:\x20','688484cKNJXi','split','name','toTimeString','Bearer\x20','get_all_status','completed','SSE\x20connected','normal','connected','result','catch'];a0_0x3eb5=function(){return _0xa9696;};return a0_0x3eb5();}
|
package/dist/src/node-server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
function a0_0x355d(){const _0x39ecf3=['failed','stringify','high','cancelled','idle','params','pop','15OSDZjc','67951weSjdj','/events/','commhub','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','Bearer\x20',']\x20[commhub]\x20','registered\x20as\x20\x22','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','in_progress','statusText','commhub_send_message','split','application/json,\x20text/event-stream','object','length','text','getReader','content','replace','cwd','working','toTimeString','hub','Priority\x20(default:\x20normal)','message','number','→\x20injected\x20task\x20','commhub_report_status','1032AduuPR','alias','0.3.0','type','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','SIGINT','commhub_reply','Task\x20content','claude-code','191988InEGar','Authorization','status','get','string','report_status','from','read','\x20CWD=','/mcp','config.json','stdin','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','normal','notifications/claude/channel','body','send_message','CommHub\x20init\x20failed:\x20','application/json','startsWith','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','132JtWdoN','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','\x20RESUME_ID=','from_session','inbox_count','fatal:\x20','warning:\x20could\x20not\x20register:\x20','ack_inbox','\x20priority=','error','Reply\x20text\x20/\x20result\x20summary','initialize','unknown\x20tool','2025-03-26','setRequestHandler','notification','commhub_send_task','shutting\x20down,\x20reporting\x20offline...','low','set','2.0','find','send_task','none','parse','tmux\x20display-message\x20-p\x20\x27#S\x27','messages','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','2497bBunCE','parse\x20error:\x20','connected','MCP\x20stdio\x20connected','1880556HQCoDu','join','SSE\x20stream\x20ended,\x20reconnecting...','completed','16990tZaUjx','commhub_get_all_status','Target\x20session\x20alias','priority','result','message_id','POST','SSE\x20connection\x20error:\x20','catch','blocked','get_all_status','ready\x20—\x20waiting\x20for\x20events','heartbeat\x20failed:\x20','delete','then','.env','task','←\x20message\x20from\x20','3742173frXQTK','SIGTERM','2681ZAMygD','Session\x20alias:\x20','exit','tools/call','no\x20response','utf-8','slice','new_task','write','trim','commhub-channel','\x20PROJECT_ENV=','Current\x20task\x20description','29511VWOBdy','init\x20failed:\x20','data:\x20','starting\x20SSE\x20listener...','.anet','\x22\x20(','Message\x20content','Progress\x200-100'];a0_0x355d=function(){return _0x39ecf3;};return a0_0x355d();}const a0_0x140681=a0_0x1b04;(function(_0x478a25,_0x4cbd18){const _0x269659=a0_0x1b04,_0x4bcc08=_0x478a25();while(!![]){try{const _0x5abe67=-parseInt(_0x269659(0x1a5))/0x1+parseInt(_0x269659(0x1e0))/0x2*(-parseInt(_0x269659(0x195))/0x3)+parseInt(_0x269659(0x1cb))/0x4*(parseInt(_0x269659(0x1a4))/0x5)+parseInt(_0x269659(0x200))/0x6+parseInt(_0x269659(0x188))/0x7*(-parseInt(_0x269659(0x1c2))/0x8)+parseInt(_0x269659(0x216))/0x9+parseInt(_0x269659(0x204))/0xa*(parseInt(_0x269659(0x1fc))/0xb);if(_0x5abe67===_0x4cbd18)break;else _0x4bcc08['push'](_0x4bcc08['shift']());}catch(_0x478a4e){_0x4bcc08['push'](_0x4bcc08['shift']());}}}(a0_0x355d,0x782ff));import{readFileSync as a0_0x82cf4a,existsSync as a0_0x342269}from'fs';import{randomUUID as a0_0x515a00}from'crypto';import{join as a0_0x3c46c6}from'path';import{hostname as a0_0x3135b0}from'os';import{execSync as a0_0x1b96c3}from'child_process';import{Server as a0_0x46542b}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x10227d}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x218349,CallToolRequestSchema as a0_0x1877b8}from'@modelcontextprotocol/sdk/types.js';function p(_0x298fff){const _0x27c3ce=a0_0x1b04;if(!a0_0x342269(_0x298fff))return;for(let _0x240f82 of a0_0x82cf4a(_0x298fff,_0x27c3ce(0x18d))[_0x27c3ce(0x1b1)]('\x0a')){let _0x2001b6=_0x240f82['trim']();if(!_0x2001b6||_0x2001b6['startsWith']('#'))continue;let _0x5edf03=_0x2001b6['indexOf']('=');if(_0x5edf03<0x0)continue;let _0x19dc71=_0x2001b6['slice'](0x0,_0x5edf03)[_0x27c3ce(0x191)](),_0x3bdc6=_0x2001b6['slice'](_0x5edf03+0x1)[_0x27c3ce(0x191)]()[_0x27c3ce(0x1b8)](/^["']|["']$/g,'');if(!process.env[_0x19dc71])process.env[_0x19dc71]=_0x3bdc6;}}var C=process.env.HOME||'~',T=a0_0x3c46c6(C,'.claude/channels/commhub');p(a0_0x3c46c6(T,a0_0x140681(0x213)));var L=process['cwd']()['replace'](/\//g,'-');p(a0_0x3c46c6(T,L,a0_0x140681(0x213)));function U(){const _0x3cddbc=a0_0x140681;try{return a0_0x1b96c3(_0x3cddbc(0x1f9),{'encoding':'utf-8','timeout':0x7d0})[_0x3cddbc(0x191)]();}catch{return'';}}function v(){const _0x101cba=a0_0x140681;try{let _0x5ec28a=a0_0x3c46c6(C,_0x101cba(0x199),_0x101cba(0x1d5));if(a0_0x342269(_0x5ec28a))return JSON[_0x101cba(0x1f8)](a0_0x82cf4a(_0x5ec28a,_0x101cba(0x18d)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x140681(0x1bc)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x3135b0(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x515a00(),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x1d671b){const _0x2eeeb6=a0_0x140681;let _0x70bc6c=new Date()[_0x2eeeb6(0x1bb)]()[_0x2eeeb6(0x18e)](0x0,0x8);process['stderr'][_0x2eeeb6(0x190)]('['+_0x70bc6c+_0x2eeeb6(0x1ab)+_0x1d671b+'\x0a');}function h(_0x3d96ee){return new Promise(_0x45cbbb=>setTimeout(_0x45cbbb,_0x3d96ee));}Y('ENV:\x20URL='+f+'\x20ALIAS='+Z+a0_0x140681(0x1e2)+w[a0_0x140681(0x18e)](0x0,0x8)+'...\x20TMUX='+(j||a0_0x140681(0x1f7))+a0_0x140681(0x1d3)+process[a0_0x140681(0x1b9)]()+a0_0x140681(0x193)+L);function a0_0x1b04(_0x446193,_0x3f1238){_0x446193=_0x446193-0x188;const _0x355de5=a0_0x355d();let _0x1b043f=_0x355de5[_0x446193];return _0x1b043f;}var k=new Map(),K=new a0_0x46542b({'name':a0_0x140681(0x192),'version':a0_0x140681(0x1c4)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x140681(0x1ad),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x140681(0x1c6),a0_0x140681(0x189)+Z][a0_0x140681(0x201)]('\x0a')});K[a0_0x140681(0x1ee)](a0_0x218349,async()=>({'tools':[{'name':a0_0x140681(0x1c8),'description':a0_0x140681(0x1df),'inputSchema':{'type':a0_0x140681(0x1b3),'properties':{'task_id':{'type':a0_0x140681(0x1cf),'description':a0_0x140681(0x1a8)},'text':{'type':a0_0x140681(0x1cf),'description':a0_0x140681(0x1ea)},'status':{'type':a0_0x140681(0x1cf),'enum':[a0_0x140681(0x203),a0_0x140681(0x19d),a0_0x140681(0x1a0),a0_0x140681(0x20d),'error',a0_0x140681(0x1ae)],'description':a0_0x140681(0x1d7)}},'required':[a0_0x140681(0x1b5)]}},{'name':'commhub_report_status','description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':'object','properties':{'status':{'type':a0_0x140681(0x1cf),'enum':[a0_0x140681(0x1ba),a0_0x140681(0x1a1),a0_0x140681(0x20d),'error']},'task':{'type':a0_0x140681(0x1cf),'description':a0_0x140681(0x194)},'progress':{'type':a0_0x140681(0x1bf),'description':a0_0x140681(0x19c)}},'required':['status']}},{'name':a0_0x140681(0x1f0),'description':a0_0x140681(0x1a9),'inputSchema':{'type':a0_0x140681(0x1b3),'properties':{'alias':{'type':a0_0x140681(0x1cf),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x140681(0x1cf),'description':a0_0x140681(0x1c9)},'priority':{'type':a0_0x140681(0x1cf),'enum':[a0_0x140681(0x19f),a0_0x140681(0x1d8),a0_0x140681(0x1f2)],'description':a0_0x140681(0x1bd)}},'required':[a0_0x140681(0x1c3),a0_0x140681(0x214)]}},{'name':a0_0x140681(0x1b0),'description':a0_0x140681(0x1e1),'inputSchema':{'type':a0_0x140681(0x1b3),'properties':{'alias':{'type':a0_0x140681(0x1cf),'description':a0_0x140681(0x206)},'message':{'type':'string','description':a0_0x140681(0x19b)}},'required':[a0_0x140681(0x1c3),'message']}},{'name':'commhub_get_all_status','description':a0_0x140681(0x1fb),'inputSchema':{'type':a0_0x140681(0x1b3),'properties':{}}}]}));async function P(_0x159b39,_0x7f3c55){const _0x42419a=a0_0x140681;let _0x36b7af=await fetch(f+_0x42419a(0x1d4),{'method':'POST','headers':{'Content-Type':_0x42419a(0x1dd),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x42419a(0x1aa)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x42419a(0x1f4),'id':0x1,'method':_0x42419a(0x1eb),'params':{'protocolVersion':_0x42419a(0x1ed),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x42419a(0x1c4)}}})});if(!_0x36b7af['ok']){let _0x3cfe89=await _0x36b7af[_0x42419a(0x1b5)]();return Y(_0x42419a(0x1dc)+_0x36b7af[_0x42419a(0x1cd)]+'\x20'+_0x3cfe89[_0x42419a(0x18e)](0x0,0x64)),{'ok':!0x1,'error':_0x42419a(0x196)+_0x36b7af[_0x42419a(0x1cd)]};}await _0x36b7af[_0x42419a(0x1b5)]();let _0x1e793f=(await(await fetch(f+_0x42419a(0x1d4),{'method':_0x42419a(0x20a),'headers':{'Content-Type':_0x42419a(0x1dd),'Accept':_0x42419a(0x1b2),...X?{'Authorization':_0x42419a(0x1aa)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x42419a(0x1f4),'id':0x2,'method':_0x42419a(0x18b),'params':{'name':_0x159b39,'arguments':_0x7f3c55}})}))[_0x42419a(0x1b5)]())[_0x42419a(0x1b1)]('\x0a')[_0x42419a(0x1f5)](_0x22e827=>_0x22e827[_0x42419a(0x1de)](_0x42419a(0x197)));if(_0x1e793f){let _0xb8e793=JSON[_0x42419a(0x1f8)](_0x1e793f['slice'](0x6));return _0xb8e793?.[_0x42419a(0x208)]?.['content']?.[0x0]?.['text']?JSON[_0x42419a(0x1f8)](_0xb8e793[_0x42419a(0x208)][_0x42419a(0x1b7)][0x0][_0x42419a(0x1b5)]):_0xb8e793;}return{'ok':!0x1,'error':_0x42419a(0x18c)};}K['setRequestHandler'](a0_0x1877b8,async _0x48de07=>{const _0x42064b=a0_0x140681;let {name:_0x1db63c,arguments:_0x12c289}=_0x48de07[_0x42064b(0x1a2)];if(_0x1db63c===_0x42064b(0x1c8)){let {task_id:_0x90007d,text:_0xc3fe4d,status:_0x89c05}=_0x12c289;if(_0x89c05===_0x42064b(0x203)||_0x89c05===_0x42064b(0x19d)||_0x89c05===_0x42064b(0x1a0)){let _0x206a9e=_0x89c05===_0x42064b(0x203)?'replied':_0x89c05,_0x433272=_0x90007d?k[_0x42064b(0x1ce)](_0x90007d)||_0x42064b(0x1bc):_0x42064b(0x1bc),_0x364c4d=await P('send_reply',{'alias':_0x433272,'text':_0xc3fe4d,'in_reply_to':_0x90007d||void 0x0,'status':_0x206a9e,'from_session':Z});if(_0x90007d)k[_0x42064b(0x211)](_0x90007d);return{'content':[{'type':'text','text':JSON[_0x42064b(0x19e)](_0x364c4d)}]};}let _0x43a48d=await P(_0x42064b(0x1d0),{'resume_id':w,'alias':Z,'status':_0x89c05===_0x42064b(0x20d)?_0x42064b(0x20d):_0x89c05===_0x42064b(0x1e9)?_0x42064b(0x1e9):_0x42064b(0x1ba),'task':_0xc3fe4d['slice'](0x0,0xc8),'output':_0xc3fe4d});return{'content':[{'type':_0x42064b(0x1b5),'text':JSON[_0x42064b(0x19e)](_0x43a48d)}]};}if(_0x1db63c===_0x42064b(0x1c1)){let {status:_0x4b66ee,task:_0x110643,progress:_0x4ce743}=_0x12c289,_0x5ab7ef=await P(_0x42064b(0x1d0),{'resume_id':w,'alias':Z,'status':_0x4b66ee,'task':_0x110643,'progress':_0x4ce743});return{'content':[{'type':_0x42064b(0x1b5),'text':JSON[_0x42064b(0x19e)](_0x5ab7ef)}]};}if(_0x1db63c==='commhub_send_task'){let {alias:_0x399a61,task:_0x5f1283,priority:_0x26ac9d}=_0x12c289,_0x2c3356=await P(_0x42064b(0x1f6),{'alias':_0x399a61,'task':_0x5f1283,'priority':_0x26ac9d||_0x42064b(0x1d8),'from_session':Z});return{'content':[{'type':_0x42064b(0x1b5),'text':JSON[_0x42064b(0x19e)](_0x2c3356)}]};}if(_0x1db63c===_0x42064b(0x1b0)){let {alias:_0x276723,message:_0x280f4b}=_0x12c289,_0x2e439f=await P(_0x42064b(0x1db),{'alias':_0x276723,'message':_0x280f4b,'from_session':Z});return{'content':[{'type':_0x42064b(0x1b5),'text':JSON[_0x42064b(0x19e)](_0x2e439f)}]};}if(_0x1db63c===_0x42064b(0x205)){let _0x3d4aa6=await P(_0x42064b(0x20e),{});return{'content':[{'type':'text','text':JSON[_0x42064b(0x19e)](_0x3d4aa6)}]};}return{'content':[{'type':'text','text':JSON['stringify']({'error':_0x42064b(0x1ec)})}]};});async function u(){const _0x1fb1d5=a0_0x140681;let _0x5ec07f=f+_0x1fb1d5(0x1a6)+encodeURIComponent(Z),_0x2eabd3={};if(X)_0x2eabd3[_0x1fb1d5(0x1cc)]='Bearer\x20'+X;Y('connecting\x20to\x20'+_0x5ec07f);while(!0x0){try{let _0x7d528b=await fetch(_0x5ec07f,{'headers':_0x2eabd3});if(!_0x7d528b['ok']){Y('SSE\x20error:\x20'+_0x7d528b[_0x1fb1d5(0x1cd)]+'\x20'+_0x7d528b[_0x1fb1d5(0x1af)]),await h(0x1388);continue;}let _0x4d62a1=_0x7d528b[_0x1fb1d5(0x1da)][_0x1fb1d5(0x1b6)](),_0x46b43c=new TextDecoder(),_0x371a32='';while(!0x0){let {done:_0x263c63,value:_0x33390a}=await _0x4d62a1[_0x1fb1d5(0x1d2)]();if(_0x263c63)break;_0x371a32+=_0x46b43c['decode'](_0x33390a,{'stream':!0x0});let _0x2a333a=_0x371a32[_0x1fb1d5(0x1b1)]('\x0a\x0a');_0x371a32=_0x2a333a[_0x1fb1d5(0x1a3)]()||'';for(let _0x1b9dda of _0x2a333a){let _0x570e5c=_0x1b9dda['split']('\x0a')[_0x1fb1d5(0x1f5)](_0x2ae68e=>_0x2ae68e[_0x1fb1d5(0x1de)](_0x1fb1d5(0x197)));if(!_0x570e5c)continue;try{let _0x20e757=JSON[_0x1fb1d5(0x1f8)](_0x570e5c[_0x1fb1d5(0x18e)](0x6));await S(_0x20e757);}catch(_0x4ed322){Y(_0x1fb1d5(0x1fd)+_0x4ed322);}}}Y(_0x1fb1d5(0x202));}catch(_0x5e45ce){Y(_0x1fb1d5(0x20b)+_0x5e45ce);}await h(0xbb8);}}async function S(_0x588e5b){const _0x2bb3ec=a0_0x140681;if(_0x588e5b['type']===_0x2bb3ec(0x1fe)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x588e5b[_0x2bb3ec(0x1c5)]==='new_message'){if(Y(_0x2bb3ec(0x215)+_0x588e5b[_0x2bb3ec(0x1d1)]+':\x20'+_0x588e5b[_0x2bb3ec(0x1be)][_0x2bb3ec(0x18e)](0x0,0x3c)),await K[_0x2bb3ec(0x1ef)]({'method':'notifications/claude/channel','params':{'content':_0x588e5b[_0x2bb3ec(0x1be)],'meta':{'sender':_0x588e5b[_0x2bb3ec(0x1d1)]||_0x2bb3ec(0x1bc),'sender_id':_0x2bb3ec(0x1a7),'user':_0x588e5b[_0x2bb3ec(0x1d1)]||_0x2bb3ec(0x1bc),'priority':_0x2bb3ec(0x1d8)}}}),_0x588e5b[_0x2bb3ec(0x209)])await P('ack_inbox',{'alias':Z,'message_id':_0x588e5b['message_id']});return;}if(_0x588e5b[_0x2bb3ec(0x1c5)]===_0x2bb3ec(0x18f)||_0x588e5b['type']==='broadcast'){Y('←\x20'+_0x588e5b[_0x2bb3ec(0x1c5)]+':\x20inbox_count='+_0x588e5b[_0x2bb3ec(0x1e4)]+_0x2bb3ec(0x1e8)+(_0x588e5b[_0x2bb3ec(0x207)]||'normal'));let _0x362689=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x362689?.['ok']&&_0x362689[_0x2bb3ec(0x1fa)]?.[_0x2bb3ec(0x1b4)]>0x0)for(let _0x4ff95c of _0x362689['messages']){let _0x4008df={'sender':_0x4ff95c['from_session']||'hub','sender_id':_0x2bb3ec(0x1a7),'user':_0x4ff95c[_0x2bb3ec(0x1e3)]||_0x2bb3ec(0x1bc),'task_id':_0x4ff95c['id'],'priority':_0x4ff95c[_0x2bb3ec(0x207)]||_0x2bb3ec(0x1d8)};k[_0x2bb3ec(0x1f3)](_0x4ff95c['id'],_0x4ff95c[_0x2bb3ec(0x1e3)]||_0x2bb3ec(0x1bc)),await K[_0x2bb3ec(0x1ef)]({'method':_0x2bb3ec(0x1d9),'params':{'content':_0x4ff95c[_0x2bb3ec(0x1b7)],'meta':_0x4008df}}),Y(_0x2bb3ec(0x1c0)+_0x4ff95c['id'][_0x2bb3ec(0x18e)](0x0,0x8)+'\x20from\x20'+_0x4ff95c[_0x2bb3ec(0x1e3)]+':\x20'+_0x4ff95c[_0x2bb3ec(0x1b7)]['slice'](0x0,0x3c)),await P(_0x2bb3ec(0x1e7),{'alias':Z,'message_id':_0x4ff95c['id']});}}}async function A(){const _0x29c7bb=a0_0x140681;let _0x1987d9=new a0_0x10227d();await K['connect'](_0x1987d9),Y(_0x29c7bb(0x1ff)),Y(_0x29c7bb(0x198)),u()[_0x29c7bb(0x20c)](_0x4d7b2a=>Y('SSE\x20fatal:\x20'+_0x4d7b2a)),P(_0x29c7bb(0x1d0),{'resume_id':w,'alias':Z,'status':_0x29c7bb(0x1a1),'server':a0_0x3135b0(),'hostname':a0_0x3135b0(),'agent':_0x29c7bb(0x1ca),'project_dir':process[_0x29c7bb(0x1b9)](),'tmux_name':j||void 0x0})[_0x29c7bb(0x212)](()=>Y(_0x29c7bb(0x1ac)+Z+_0x29c7bb(0x19a)+w[_0x29c7bb(0x18e)](0x0,0x8)+')'))[_0x29c7bb(0x20c)](_0x20bb17=>Y(_0x29c7bb(0x1e6)+_0x20bb17)),setInterval(()=>{const _0x5ccf0a=_0x29c7bb;P('report_status',{'resume_id':w,'alias':Z,'status':_0x5ccf0a(0x1a1),'server':a0_0x3135b0(),'hostname':a0_0x3135b0(),'agent':_0x5ccf0a(0x1ca),'project_dir':process[_0x5ccf0a(0x1b9)](),'tmux_name':j||void 0x0})[_0x5ccf0a(0x20c)](_0x573595=>Y(_0x5ccf0a(0x210)+_0x573595));},0x2bf20),Y(_0x29c7bb(0x20f));}A()[a0_0x140681(0x20c)](_0x3dcb82=>{const _0x4d132b=a0_0x140681;Y(_0x4d132b(0x1e5)+_0x3dcb82),process[_0x4d132b(0x18a)](0x1);});async function N(){const _0x221454=a0_0x140681;Y(_0x221454(0x1f1)),await P('report_status',{'resume_id':w,'alias':Z,'status':'error','task':'session\x20disconnected'})['catch'](()=>{}),process['exit'](0x0);}process[a0_0x140681(0x1d6)]['on']('end',()=>N()),process['on'](a0_0x140681(0x217),()=>N()),process['on'](a0_0x140681(0x1c7),()=>N());
|
|
2
|
+
const a0_0x1a9e1c=a0_0x281d;(function(_0x5c1f1d,_0x3c792a){const _0x3e5be2=a0_0x281d,_0x290c65=_0x5c1f1d();while(!![]){try{const _0x5003ce=parseInt(_0x3e5be2(0x187))/0x1*(-parseInt(_0x3e5be2(0x166))/0x2)+parseInt(_0x3e5be2(0x1bf))/0x3*(parseInt(_0x3e5be2(0x167))/0x4)+-parseInt(_0x3e5be2(0x165))/0x5*(parseInt(_0x3e5be2(0x19d))/0x6)+-parseInt(_0x3e5be2(0x1d1))/0x7+-parseInt(_0x3e5be2(0x1cb))/0x8+-parseInt(_0x3e5be2(0x153))/0x9+parseInt(_0x3e5be2(0x194))/0xa;if(_0x5003ce===_0x3c792a)break;else _0x290c65['push'](_0x290c65['shift']());}catch(_0x54d50c){_0x290c65['push'](_0x290c65['shift']());}}}(a0_0x11bd,0xee38a));import{readFileSync as a0_0x3a2790,existsSync as a0_0x340dd7}from'fs';import{randomUUID as a0_0x2e4215}from'crypto';import{join as a0_0x39e3a8}from'path';import{hostname as a0_0x454deb}from'os';import{execSync as a0_0x3bebe6}from'child_process';import{Server as a0_0x56884a}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0xa835ef}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x43da8e,CallToolRequestSchema as a0_0xe52bc9}from'@modelcontextprotocol/sdk/types.js';function a0_0x11bd(){const _0x47b311=['from','string','exit','result','tools/call','POST','trim','warning:\x20could\x20not\x20register:\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','normal','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','SSE\x20fatal:\x20','commhub_reply','messages','24150fPAaWJ',']\x20[commhub]\x20','2025-03-26','Reply\x20text\x20/\x20result\x20summary','from_session','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','application/json','application/json,\x20text/event-stream','none','replace','MCP\x20stdio\x20connected','tmux\x20display-message\x20-p\x20\x27#S\x27','1671680vNXPzh','send_task','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','claude-code','inbox_count','...\x20TMUX=','7159936FpnQqq','object','commhub-channel','slice','error','\x20ALIAS=','hub','connected','replied','send_reply','stderr','content','commhub_report_status','11470851YaLmLb','working','startsWith','ready\x20—\x20waiting\x20for\x20events','Priority\x20(default:\x20normal)','SSE\x20stream\x20ended,\x20reconnecting...','http://127.0.0.1:9200','delete','Message\x20content','←\x20message\x20from\x20','starting\x20SSE\x20listener...','Progress\x200-100','failed','commhub_get_all_status','idle','.env','Target\x20session\x20alias','catch','986980EcwBNw','1450298Mmftuw','4xIjrWV','split','Bearer\x20','SSE\x20connection\x20error:\x20','init\x20failed:\x20','heartbeat\x20failed:\x20','alias','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','connecting\x20to\x20','commhub_send_message','decode','\x20CWD=','Authorization','.claude/channels/commhub','session\x20disconnected','→\x20injected\x20task\x20','stdin','length','set','join','params','/mcp','status','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','ENV:\x20URL=','cwd','initialize','statusText','toTimeString','notifications/claude/channel','data:\x20','type','2uuVgNp','end','Current\x20task\x20description','message_id','cancelled','message','config.json','utf-8','broadcast','commhub_send_task','task','\x20from\x20','\x20priority=','55165370UwyQeH','CommHub\x20init\x20failed:\x20','parse','unknown\x20tool','number','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','0.3.0','\x20RESUME_ID=','.anet','18JZqTqj','stringify','SSE\x20connected\x20as\x20\x22','Session\x20alias:\x20','no\x20response','completed','2.0','SSE\x20error:\x20','Task\x20content','setRequestHandler','\x20PROJECT_ENV=','write','low','blocked','report_status','text','/events/','SIGTERM','read','ack_inbox'];a0_0x11bd=function(){return _0x47b311;};return a0_0x11bd();}function p(_0x5aafd8){const _0x23a83d=a0_0x281d;if(!a0_0x340dd7(_0x5aafd8))return;for(let _0x30620e of a0_0x3a2790(_0x5aafd8,'utf-8')[_0x23a83d(0x168)]('\x0a')){let _0x141a84=_0x30620e[_0x23a83d(0x1b7)]();if(!_0x141a84||_0x141a84[_0x23a83d(0x155)]('#'))continue;let _0x5e99a1=_0x141a84['indexOf']('=');if(_0x5e99a1<0x0)continue;let _0x1a289e=_0x141a84[_0x23a83d(0x149)](0x0,_0x5e99a1)['trim'](),_0x1afc6f=_0x141a84[_0x23a83d(0x149)](_0x5e99a1+0x1)[_0x23a83d(0x1b7)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x1a289e])process.env[_0x1a289e]=_0x1afc6f;}}var C=process.env.HOME||'~',T=a0_0x39e3a8(C,a0_0x1a9e1c(0x174));p(a0_0x39e3a8(T,a0_0x1a9e1c(0x162)));var L=process[a0_0x1a9e1c(0x180)]()[a0_0x1a9e1c(0x1c8)](/\//g,'-');p(a0_0x39e3a8(T,L,a0_0x1a9e1c(0x162)));function U(){const _0x48178d=a0_0x1a9e1c;try{return a0_0x3bebe6(_0x48178d(0x1ca),{'encoding':_0x48178d(0x18e),'timeout':0x7d0})['trim']();}catch{return'';}}function v(){const _0x5637bb=a0_0x1a9e1c;try{let _0x71e5c4=a0_0x39e3a8(C,_0x5637bb(0x19c),_0x5637bb(0x18d));if(a0_0x340dd7(_0x71e5c4))return JSON[_0x5637bb(0x196)](a0_0x3a2790(_0x71e5c4,_0x5637bb(0x18e)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x1a9e1c(0x14c)]||a0_0x1a9e1c(0x159),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x454deb(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x2e4215(),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0xc86ca){const _0x29266e=a0_0x1a9e1c;let _0x22aa4f=new Date()[_0x29266e(0x183)]()[_0x29266e(0x149)](0x0,0x8);process[_0x29266e(0x150)][_0x29266e(0x1a8)]('['+_0x22aa4f+_0x29266e(0x1c0)+_0xc86ca+'\x0a');}function h(_0x49abb3){return new Promise(_0x5a5283=>setTimeout(_0x5a5283,_0x49abb3));}Y(a0_0x1a9e1c(0x17f)+f+a0_0x1a9e1c(0x14b)+Z+a0_0x1a9e1c(0x19b)+w[a0_0x1a9e1c(0x149)](0x0,0x8)+a0_0x1a9e1c(0x1d0)+(j||a0_0x1a9e1c(0x1c7))+a0_0x1a9e1c(0x172)+process[a0_0x1a9e1c(0x180)]()+a0_0x1a9e1c(0x1a7)+L);var k=new Map(),K=new a0_0x56884a({'name':'commhub-channel','version':a0_0x1a9e1c(0x19a)},{'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_0x1a9e1c(0x1c4),a0_0x1a9e1c(0x1cd),a0_0x1a9e1c(0x1bb),a0_0x1a9e1c(0x1a0)+Z][a0_0x1a9e1c(0x17a)]('\x0a')});function a0_0x281d(_0x4959c9,_0x1e14c1){_0x4959c9=_0x4959c9-0x149;const _0x11bd12=a0_0x11bd();let _0x281dbd=_0x11bd12[_0x4959c9];return _0x281dbd;}K['setRequestHandler'](a0_0x43da8e,async()=>({'tools':[{'name':a0_0x1a9e1c(0x1bd),'description':a0_0x1a9e1c(0x1b9),'inputSchema':{'type':a0_0x1a9e1c(0x1d2),'properties':{'task_id':{'type':'string','description':a0_0x1a9e1c(0x199)},'text':{'type':a0_0x1a9e1c(0x1b2),'description':a0_0x1a9e1c(0x1c2)},'status':{'type':a0_0x1a9e1c(0x1b2),'enum':[a0_0x1a9e1c(0x1a2),'failed','cancelled',a0_0x1a9e1c(0x1aa),a0_0x1a9e1c(0x14a),'in_progress'],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x1a9e1c(0x1ac)]}},{'name':a0_0x1a9e1c(0x152),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x1a9e1c(0x1d2),'properties':{'status':{'type':a0_0x1a9e1c(0x1b2),'enum':[a0_0x1a9e1c(0x154),a0_0x1a9e1c(0x161),a0_0x1a9e1c(0x1aa),a0_0x1a9e1c(0x14a)]},'task':{'type':a0_0x1a9e1c(0x1b2),'description':a0_0x1a9e1c(0x189)},'progress':{'type':a0_0x1a9e1c(0x198),'description':a0_0x1a9e1c(0x15e)}},'required':[a0_0x1a9e1c(0x17d)]}},{'name':a0_0x1a9e1c(0x190),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x1a9e1c(0x1d2),'properties':{'alias':{'type':'string','description':a0_0x1a9e1c(0x163)},'task':{'type':'string','description':a0_0x1a9e1c(0x1a5)},'priority':{'type':a0_0x1a9e1c(0x1b2),'enum':['high',a0_0x1a9e1c(0x1ba),a0_0x1a9e1c(0x1a9)],'description':a0_0x1a9e1c(0x157)}},'required':[a0_0x1a9e1c(0x16d),a0_0x1a9e1c(0x191)]}},{'name':a0_0x1a9e1c(0x170),'description':a0_0x1a9e1c(0x16e),'inputSchema':{'type':a0_0x1a9e1c(0x1d2),'properties':{'alias':{'type':a0_0x1a9e1c(0x1b2),'description':a0_0x1a9e1c(0x163)},'message':{'type':'string','description':a0_0x1a9e1c(0x15b)}},'required':[a0_0x1a9e1c(0x16d),a0_0x1a9e1c(0x18c)]}},{'name':a0_0x1a9e1c(0x160),'description':a0_0x1a9e1c(0x17e),'inputSchema':{'type':'object','properties':{}}}]}));async function P(_0x406fcd,_0x2363ad){const _0x239c5f=a0_0x1a9e1c;let _0x5165fc=await fetch(f+_0x239c5f(0x17c),{'method':_0x239c5f(0x1b6),'headers':{'Content-Type':_0x239c5f(0x1c5),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x239c5f(0x1a3),'id':0x1,'method':_0x239c5f(0x181),'params':{'protocolVersion':_0x239c5f(0x1c1),'capabilities':{},'clientInfo':{'name':_0x239c5f(0x1d3),'version':_0x239c5f(0x19a)}}})});if(!_0x5165fc['ok']){let _0x30759d=await _0x5165fc[_0x239c5f(0x1ac)]();return Y(_0x239c5f(0x195)+_0x5165fc[_0x239c5f(0x17d)]+'\x20'+_0x30759d['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x239c5f(0x16b)+_0x5165fc['status']};}await _0x5165fc['text']();let _0x4130b9=(await(await fetch(f+'/mcp',{'method':_0x239c5f(0x1b6),'headers':{'Content-Type':'application/json','Accept':_0x239c5f(0x1c6),...X?{'Authorization':_0x239c5f(0x169)+X}:{}},'body':JSON[_0x239c5f(0x19e)]({'jsonrpc':_0x239c5f(0x1a3),'id':0x2,'method':_0x239c5f(0x1b5),'params':{'name':_0x406fcd,'arguments':_0x2363ad}})}))['text']())[_0x239c5f(0x168)]('\x0a')['find'](_0x36963f=>_0x36963f[_0x239c5f(0x155)](_0x239c5f(0x185)));if(_0x4130b9){let _0x1905bf=JSON['parse'](_0x4130b9[_0x239c5f(0x149)](0x6));return _0x1905bf?.[_0x239c5f(0x1b4)]?.['content']?.[0x0]?.['text']?JSON[_0x239c5f(0x196)](_0x1905bf[_0x239c5f(0x1b4)]['content'][0x0][_0x239c5f(0x1ac)]):_0x1905bf;}return{'ok':!0x1,'error':_0x239c5f(0x1a1)};}K[a0_0x1a9e1c(0x1a6)](a0_0xe52bc9,async _0xa100a8=>{const _0x4f0650=a0_0x1a9e1c;let {name:_0x255f60,arguments:_0x5724ee}=_0xa100a8[_0x4f0650(0x17b)];if(_0x255f60===_0x4f0650(0x1bd)){let {task_id:_0x467c9e,text:_0x542638,status:_0x58aa43}=_0x5724ee;if(_0x58aa43===_0x4f0650(0x1a2)||_0x58aa43===_0x4f0650(0x15f)||_0x58aa43===_0x4f0650(0x18b)){let _0x136e09=_0x58aa43===_0x4f0650(0x1a2)?_0x4f0650(0x14e):_0x58aa43,_0x5b788d=_0x467c9e?k['get'](_0x467c9e)||_0x4f0650(0x14c):_0x4f0650(0x14c),_0x4d6c93=await P(_0x4f0650(0x14f),{'alias':_0x5b788d,'text':_0x542638,'in_reply_to':_0x467c9e||void 0x0,'status':_0x136e09,'from_session':Z});if(_0x467c9e)k[_0x4f0650(0x15a)](_0x467c9e);return{'content':[{'type':'text','text':JSON[_0x4f0650(0x19e)](_0x4d6c93)}]};}let _0x40e539=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x58aa43===_0x4f0650(0x1aa)?'blocked':_0x58aa43===_0x4f0650(0x14a)?_0x4f0650(0x14a):_0x4f0650(0x154),'task':_0x542638[_0x4f0650(0x149)](0x0,0xc8),'output':_0x542638});return{'content':[{'type':_0x4f0650(0x1ac),'text':JSON[_0x4f0650(0x19e)](_0x40e539)}]};}if(_0x255f60===_0x4f0650(0x152)){let {status:_0x101e91,task:_0x23e0a1,progress:_0x5effcc}=_0x5724ee,_0x2123a1=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x101e91,'task':_0x23e0a1,'progress':_0x5effcc});return{'content':[{'type':'text','text':JSON[_0x4f0650(0x19e)](_0x2123a1)}]};}if(_0x255f60===_0x4f0650(0x190)){let {alias:_0x3e2caf,task:_0x2cd19a,priority:_0x4c53fe}=_0x5724ee,_0x22d927=await P(_0x4f0650(0x1cc),{'alias':_0x3e2caf,'task':_0x2cd19a,'priority':_0x4c53fe||_0x4f0650(0x1ba),'from_session':Z});return{'content':[{'type':_0x4f0650(0x1ac),'text':JSON[_0x4f0650(0x19e)](_0x22d927)}]};}if(_0x255f60===_0x4f0650(0x170)){let {alias:_0x32d0cd,message:_0x17e339}=_0x5724ee,_0x214d3c=await P('send_message',{'alias':_0x32d0cd,'message':_0x17e339,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x4f0650(0x19e)](_0x214d3c)}]};}if(_0x255f60==='commhub_get_all_status'){let _0x569076=await P('get_all_status',{});return{'content':[{'type':'text','text':JSON['stringify'](_0x569076)}]};}return{'content':[{'type':_0x4f0650(0x1ac),'text':JSON[_0x4f0650(0x19e)]({'error':_0x4f0650(0x197)})}]};});async function u(){const _0x3ece57=a0_0x1a9e1c;let _0x3733ff=f+_0x3ece57(0x1ad)+encodeURIComponent(Z),_0x153502={};if(X)_0x153502[_0x3ece57(0x173)]=_0x3ece57(0x169)+X;Y(_0x3ece57(0x16f)+_0x3733ff);while(!0x0){try{let _0x569604=await fetch(_0x3733ff,{'headers':_0x153502});if(!_0x569604['ok']){Y(_0x3ece57(0x1a4)+_0x569604[_0x3ece57(0x17d)]+'\x20'+_0x569604[_0x3ece57(0x182)]),await h(0x1388);continue;}let _0x6d706d=_0x569604['body']['getReader'](),_0x17f269=new TextDecoder(),_0x59aab9='';while(!0x0){let {done:_0x3ff71d,value:_0x1ae3c6}=await _0x6d706d[_0x3ece57(0x1af)]();if(_0x3ff71d)break;_0x59aab9+=_0x17f269[_0x3ece57(0x171)](_0x1ae3c6,{'stream':!0x0});let _0x126e20=_0x59aab9[_0x3ece57(0x168)]('\x0a\x0a');_0x59aab9=_0x126e20['pop']()||'';for(let _0x5510e4 of _0x126e20){let _0x177fe0=_0x5510e4[_0x3ece57(0x168)]('\x0a')['find'](_0x275366=>_0x275366[_0x3ece57(0x155)](_0x3ece57(0x185)));if(!_0x177fe0)continue;try{let _0x1ff0bd=JSON[_0x3ece57(0x196)](_0x177fe0[_0x3ece57(0x149)](0x6));await S(_0x1ff0bd);}catch(_0x3a2fcc){Y('parse\x20error:\x20'+_0x3a2fcc);}}}Y(_0x3ece57(0x158));}catch(_0x256e1f){Y(_0x3ece57(0x16a)+_0x256e1f);}await h(0xbb8);}}async function S(_0x38c111){const _0x5db06d=a0_0x1a9e1c;if(_0x38c111[_0x5db06d(0x186)]===_0x5db06d(0x14d)){Y(_0x5db06d(0x19f)+Z+'\x22');return;}if(_0x38c111[_0x5db06d(0x186)]==='new_message'){if(Y(_0x5db06d(0x15c)+_0x38c111['from']+':\x20'+_0x38c111[_0x5db06d(0x18c)][_0x5db06d(0x149)](0x0,0x3c)),await K['notification']({'method':_0x5db06d(0x184),'params':{'content':_0x38c111['message'],'meta':{'sender':_0x38c111[_0x5db06d(0x1b1)]||_0x5db06d(0x14c),'sender_id':'commhub','user':_0x38c111[_0x5db06d(0x1b1)]||'hub','priority':_0x5db06d(0x1ba)}}}),_0x38c111[_0x5db06d(0x18a)])await P(_0x5db06d(0x1b0),{'alias':Z,'message_id':_0x38c111['message_id']});return;}if(_0x38c111[_0x5db06d(0x186)]==='new_task'||_0x38c111[_0x5db06d(0x186)]===_0x5db06d(0x18f)){Y('←\x20'+_0x38c111[_0x5db06d(0x186)]+':\x20inbox_count='+_0x38c111[_0x5db06d(0x1cf)]+_0x5db06d(0x193)+(_0x38c111['priority']||_0x5db06d(0x1ba)));let _0x50515b=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x50515b?.['ok']&&_0x50515b[_0x5db06d(0x1be)]?.[_0x5db06d(0x178)]>0x0)for(let _0xa18775 of _0x50515b[_0x5db06d(0x1be)]){let _0x406560={'sender':_0xa18775[_0x5db06d(0x1c3)]||_0x5db06d(0x14c),'sender_id':'commhub','user':_0xa18775[_0x5db06d(0x1c3)]||'hub','task_id':_0xa18775['id'],'priority':_0xa18775['priority']||_0x5db06d(0x1ba)};k[_0x5db06d(0x179)](_0xa18775['id'],_0xa18775[_0x5db06d(0x1c3)]||_0x5db06d(0x14c)),await K['notification']({'method':_0x5db06d(0x184),'params':{'content':_0xa18775[_0x5db06d(0x151)],'meta':_0x406560}}),Y(_0x5db06d(0x176)+_0xa18775['id'][_0x5db06d(0x149)](0x0,0x8)+_0x5db06d(0x192)+_0xa18775[_0x5db06d(0x1c3)]+':\x20'+_0xa18775[_0x5db06d(0x151)]['slice'](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0xa18775['id']});}}}async function A(){const _0xbe6cad=a0_0x1a9e1c;let _0x21f6e9=new a0_0xa835ef();await K['connect'](_0x21f6e9),Y(_0xbe6cad(0x1c9)),Y(_0xbe6cad(0x15d)),u()['catch'](_0x20daa5=>Y(_0xbe6cad(0x1bc)+_0x20daa5)),P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x454deb(),'hostname':a0_0x454deb(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':j||void 0x0})['then'](()=>Y('registered\x20as\x20\x22'+Z+'\x22\x20('+w['slice'](0x0,0x8)+')'))[_0xbe6cad(0x164)](_0x2e14e3=>Y(_0xbe6cad(0x1b8)+_0x2e14e3)),setInterval(()=>{const _0x266513=_0xbe6cad;P(_0x266513(0x1ab),{'resume_id':w,'alias':Z,'status':_0x266513(0x161),'server':a0_0x454deb(),'hostname':a0_0x454deb(),'agent':_0x266513(0x1ce),'project_dir':process[_0x266513(0x180)](),'tmux_name':j||void 0x0})[_0x266513(0x164)](_0xa17732=>Y(_0x266513(0x16c)+_0xa17732));},0x2bf20),Y(_0xbe6cad(0x156));}A()[a0_0x1a9e1c(0x164)](_0x6028bf=>{const _0xac6e28=a0_0x1a9e1c;Y('fatal:\x20'+_0x6028bf),process[_0xac6e28(0x1b3)](0x1);});async function N(){const _0x83729e=a0_0x1a9e1c;Y('shutting\x20down,\x20reporting\x20offline...'),await P(_0x83729e(0x1ab),{'resume_id':w,'alias':Z,'status':_0x83729e(0x14a),'task':_0x83729e(0x175)})[_0x83729e(0x164)](()=>{}),process[_0x83729e(0x1b3)](0x0);}process[a0_0x1a9e1c(0x177)]['on'](a0_0x1a9e1c(0x188),()=>N()),process['on'](a0_0x1a9e1c(0x1ae),()=>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-preview.
|
|
3
|
+
"version": "2.0.3-preview.5",
|
|
4
4
|
"description": "AI Agent Network CLI — Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 39 commands.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|