@sleep2agi/agent-network 2.1.13-preview.3 → 2.1.13-preview.4
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_0x286063=a0_0x1315;function a0_0x3941(){const _0x442b41=['call','content','10ycxWPV','toString','task','get_inbox','getReader','server','idle','toTimeString','application/json,\x20text/event-stream','slice','917322eHqsin','startsWith','disconnected','2.0','ack_inbox','completed','56138Hasrjo','normal','min','catch','status','heartbeatTimer','registered','report_status','text','parse','3822136XMbnYv','692046XzQjLc','856076IlipJA','alias','token','connectSSE','get_all_status','stringify','tools/call','read','Bearer\x20','text/event-stream','AbortError','SSE\x20connected','disconnect','send_reply','new_task','Authorization','agent','new_message','abort','inbox\x20error:\x20','error','reply','log','reconnectDelay','SSE\x20error:\x20','sleep','message','getAllStatus','connect','2093385OduKoo','send_task','match','289495NjCiAW','name','body','split','broadcast','s...','offline','SSE\x20failed:\x20','now','url','heartbeat\x20failed:\x20','processInbox','heartbeatInterval','sdk','decode','resumeId','emit','sseAbort','/mcp','messages',']\x20[commhub:','SSE\x20reconnecting\x20in\x20','running','type','send'];a0_0x3941=function(){return _0x442b41;};return a0_0x3941();}(function(_0x2dcd76,_0x13124c){const _0x537895=a0_0x1315,_0x5432b0=_0x2dcd76();while(!![]){try{const _0x441184=parseInt(_0x537895(0xc6))/0x1*(parseInt(_0x537895(0xd6))/0x2)+-parseInt(_0x537895(0xd0))/0x3+parseInt(_0x537895(0xe2))/0x4+parseInt(_0x537895(0x102))/0x5+parseInt(_0x537895(0xe1))/0x6+parseInt(_0x537895(0xff))/0x7+-parseInt(_0x537895(0xe0))/0x8;if(_0x441184===_0x13124c)break;else _0x5432b0['push'](_0x5432b0['shift']());}catch(_0x113a4b){_0x5432b0['push'](_0x5432b0['shift']());}}}(a0_0x3941,0x2cca7));import{EventEmitter as a0_0x2a398f}from'events';import{hostname as a0_0xc43b87}from'os';class T extends a0_0x2a398f{[a0_0x286063(0x10b)];[a0_0x286063(0xe3)];[a0_0x286063(0xe4)];[a0_0x286063(0xf2)];['resumeId'];[a0_0x286063(0x10e)];['reconnectDelay'];[a0_0x286063(0xdb)];[a0_0x286063(0xbc)];[a0_0x286063(0xc1)]=!0x1;constructor(_0x43d346){const _0x196353=a0_0x286063;super();if(this[_0x196353(0x10b)]=_0x43d346[_0x196353(0x10b)]['replace'](/\/$/,''),this[_0x196353(0xe3)]=_0x43d346['alias'],this['token']=_0x43d346['token'],this['agent']=_0x43d346[_0x196353(0xf2)]||_0x196353(0x10f),this[_0x196353(0x111)]='sdk-'+_0x43d346['alias']+'-'+Date['now']()[_0x196353(0xc7)](0x24),this[_0x196353(0x10e)]=_0x43d346[_0x196353(0x10e)]??0x2bf20,this['reconnectDelay']=_0x43d346[_0x196353(0xf9)]??0xbb8,_0x43d346['autoConnect']!==!0x1)this['connect']();}[a0_0x286063(0xf8)](_0x330697){const _0x9a60a7=a0_0x286063;console[_0x9a60a7(0xf8)]('['+new Date()[_0x9a60a7(0xcd)]()[_0x9a60a7(0xcf)](0x0,0x8)+_0x9a60a7(0xbf)+this[_0x9a60a7(0xe3)]+']\x20'+_0x330697);}async[a0_0x286063(0xc4)](_0x21be47,_0x331c16){const _0x4e9a67=a0_0x286063;let _0x59c1b9={'Content-Type':'application/json','Accept':_0x4e9a67(0xce)};if(this[_0x4e9a67(0xe4)])_0x59c1b9[_0x4e9a67(0xf1)]=_0x4e9a67(0xea)+this[_0x4e9a67(0xe4)];let _0x96d609=await(await fetch(this[_0x4e9a67(0x10b)]+_0x4e9a67(0xbd),{'method':'POST','headers':_0x59c1b9,'body':JSON[_0x4e9a67(0xe7)]({'jsonrpc':_0x4e9a67(0xd3),'id':Date[_0x4e9a67(0x10a)](),'method':_0x4e9a67(0xe8),'params':{'name':_0x21be47,'arguments':_0x331c16}})}))[_0x4e9a67(0xde)](),_0x50ebfc=_0x96d609[_0x4e9a67(0x101)](/data: (.+)/),_0x22ad1a=_0x50ebfc?JSON[_0x4e9a67(0xdf)](_0x50ebfc[0x1]):JSON['parse'](_0x96d609),_0xc8e24d=_0x22ad1a?.['result']?.[_0x4e9a67(0xc5)]?.[0x0]?.[_0x4e9a67(0xde)];return _0xc8e24d?JSON['parse'](_0xc8e24d):_0x22ad1a;}async[a0_0x286063(0xfe)](){const _0x1efed0=a0_0x286063;if(this[_0x1efed0(0xc1)])return;this[_0x1efed0(0xc1)]=!0x0,await this[_0x1efed0(0xda)](_0x1efed0(0xcc)),this[_0x1efed0(0xf8)](_0x1efed0(0xdc)),this[_0x1efed0(0xdb)]=setInterval(()=>{const _0x331550=_0x1efed0;this[_0x331550(0xda)](_0x331550(0xcc))[_0x331550(0xd9)](_0x85e8ff=>this['log'](_0x331550(0x10c)+_0x85e8ff[_0x331550(0xfc)]));},this[_0x1efed0(0x10e)]),this[_0x1efed0(0xe5)]();}async[a0_0x286063(0xee)](){const _0x39e1bc=a0_0x286063;if(this[_0x39e1bc(0xc1)]=!0x1,this[_0x39e1bc(0xbc)]?.[_0x39e1bc(0xf4)](),this[_0x39e1bc(0xdb)])clearInterval(this['heartbeatTimer']);await this['status'](_0x39e1bc(0x108))['catch'](()=>{}),this[_0x39e1bc(0xf8)](_0x39e1bc(0xd2));}async[a0_0x286063(0xc3)](_0x42b6b6,_0x43e016,_0x16c0a4=a0_0x286063(0xd7)){const _0x41d49d=a0_0x286063;return this[_0x41d49d(0xc4)](_0x41d49d(0x100),{'alias':_0x42b6b6,'task':_0x43e016,'priority':_0x16c0a4,'from_session':this[_0x41d49d(0xe3)]});}async[a0_0x286063(0xfc)](_0x32d6c3,_0x3564fc){const _0x2c89d1=a0_0x286063;return this[_0x2c89d1(0xc4)]('send_message',{'alias':_0x32d6c3,'message':_0x3564fc,'from_session':this['alias']});}async[a0_0x286063(0xf7)](_0x470ff9,_0x5a1beb,_0x5f3cc6=a0_0x286063(0xd5)){const _0x1fb715=a0_0x286063;return this[_0x1fb715(0xc4)](_0x1fb715(0xef),{'in_reply_to':_0x470ff9,'text':_0x5a1beb,'status':_0x5f3cc6});}async['status'](_0x54c831,_0x86b476){const _0xdcbc5=a0_0x286063;return this[_0xdcbc5(0xc4)](_0xdcbc5(0xdd),{'resume_id':this[_0xdcbc5(0x111)],'alias':this[_0xdcbc5(0xe3)],'status':_0x54c831,'server':a0_0xc43b87(),'hostname':a0_0xc43b87(),'agent':this[_0xdcbc5(0xf2)],'project_dir':process['cwd'](),..._0x86b476});}async[a0_0x286063(0xfd)](){const _0x3ae2c6=a0_0x286063;return this[_0x3ae2c6(0xc4)](_0x3ae2c6(0xe6),{});}async['broadcast'](_0x1ee081,_0x5bedfc){const _0x25ce05=a0_0x286063;return this[_0x25ce05(0xc4)](_0x25ce05(0x106),{'message':_0x1ee081,'filter_server':_0x5bedfc?.[_0x25ce05(0xcb)],'filter_status':_0x5bedfc?.[_0x25ce05(0xda)]});}async[a0_0x286063(0xe5)](){const _0x3eb980=a0_0x286063;let _0x16e05c=encodeURIComponent(this[_0x3eb980(0xe3)]),_0xd36bd8=this[_0x3eb980(0x10b)]+'/events/'+_0x16e05c,_0x3158e4=this[_0x3eb980(0xf9)];while(this[_0x3eb980(0xc1)]){try{this[_0x3eb980(0xbc)]=new AbortController();let _0x41c458={'Accept':_0x3eb980(0xeb)};if(this[_0x3eb980(0xe4)])_0x41c458[_0x3eb980(0xf1)]=_0x3eb980(0xea)+this[_0x3eb980(0xe4)];let _0x16ec00=await fetch(_0xd36bd8,{'headers':_0x41c458,'signal':this['sseAbort']['signal']});if(!_0x16ec00['ok']||!_0x16ec00['body']){this[_0x3eb980(0xf8)](_0x3eb980(0x109)+_0x16ec00[_0x3eb980(0xda)]),await this[_0x3eb980(0xfb)](_0x3158e4),_0x3158e4=Math[_0x3eb980(0xd8)](_0x3158e4*1.5,0xea60);continue;}_0x3158e4=this[_0x3eb980(0xf9)];let _0x3138da=_0x16ec00[_0x3eb980(0x104)][_0x3eb980(0xca)](),_0x347868=new TextDecoder(),_0x1c1c40='';while(this['running']){let {done:_0x28cd71,value:_0x44abca}=await _0x3138da[_0x3eb980(0xe9)]();if(_0x28cd71)break;_0x1c1c40+=_0x347868[_0x3eb980(0x110)](_0x44abca,{'stream':!0x0});let _0x504993=_0x1c1c40[_0x3eb980(0x105)]('\x0a');_0x1c1c40=_0x504993['pop']()||'';for(let _0x30b1eb of _0x504993){if(!_0x30b1eb[_0x3eb980(0xd1)]('data:\x20'))continue;try{let _0x55cf6c=JSON['parse'](_0x30b1eb[_0x3eb980(0xcf)](0x6));if(_0x55cf6c[_0x3eb980(0xc2)]==='connected'){this[_0x3eb980(0xf8)](_0x3eb980(0xed)),this[_0x3eb980(0xbb)]('connected');continue;}if(_0x55cf6c[_0x3eb980(0xc2)]===_0x3eb980(0xf0)||_0x55cf6c[_0x3eb980(0xc2)]===_0x3eb980(0xf3)||_0x55cf6c['type']==='broadcast')await this[_0x3eb980(0x10d)]();}catch{}}}}catch(_0x511c75){if(_0x511c75[_0x3eb980(0x103)]===_0x3eb980(0xec))break;this[_0x3eb980(0xbb)](_0x3eb980(0xf6),_0x511c75),this['log'](_0x3eb980(0xfa)+_0x511c75[_0x3eb980(0xfc)]);}if(this[_0x3eb980(0xc1)])this['emit'](_0x3eb980(0xd2)),this[_0x3eb980(0xf8)](_0x3eb980(0xc0)+_0x3158e4/0x3e8+_0x3eb980(0x107)),await this[_0x3eb980(0xfb)](_0x3158e4),_0x3158e4=Math['min'](_0x3158e4*1.5,0xea60);}}async[a0_0x286063(0x10d)](){const _0x4ab663=a0_0x286063;try{let _0x3d9ed8=(await this['call'](_0x4ab663(0xc9),{'alias':this[_0x4ab663(0xe3)],'limit':0xa}))?.[_0x4ab663(0xbe)]||[];for(let _0x4f1611 of _0x3d9ed8)await this[_0x4ab663(0xc4)](_0x4ab663(0xd4),{'alias':this[_0x4ab663(0xe3)],'message_id':_0x4f1611['id']}),this[_0x4ab663(0xf8)]('←\x20'+_0x4f1611['from_session']+':\x20'+_0x4f1611['content'][_0x4ab663(0xcf)](0x0,0x3c)),this[_0x4ab663(0xbb)](_0x4ab663(0xc8),_0x4f1611),this[_0x4ab663(0xbb)](_0x4ab663(0xfc),_0x4f1611);}catch(_0x3d3c03){this[_0x4ab663(0xf8)](_0x4ab663(0xf5)+_0x3d3c03[_0x4ab663(0xfc)]);}}[a0_0x286063(0xfb)](_0x49d215){return new Promise(_0x48846c=>setTimeout(_0x48846c,_0x49d215));}}var $=T;function a0_0x1315(_0x46775c,_0x1b72ed){_0x46775c=_0x46775c-0xbb;const _0x3941e6=a0_0x3941();let _0x1315e7=_0x3941e6[_0x46775c];return _0x1315e7;}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_0x342db3=a0_0x5504;(function(_0x12756d,_0x241004){const _0x1a1d0b=a0_0x5504,_0x15c8f7=_0x12756d();while(!![]){try{const _0x3f4377=-parseInt(_0x1a1d0b(0x189))/0x1+-parseInt(_0x1a1d0b(0x168))/0x2*(parseInt(_0x1a1d0b(0x140))/0x3)+parseInt(_0x1a1d0b(0x18e))/0x4*(-parseInt(_0x1a1d0b(0x14c))/0x5)+-parseInt(_0x1a1d0b(0x131))/0x6*(parseInt(_0x1a1d0b(0x161))/0x7)+-parseInt(_0x1a1d0b(0x183))/0x8+-parseInt(_0x1a1d0b(0x19c))/0x9+parseInt(_0x1a1d0b(0x160))/0xa*(parseInt(_0x1a1d0b(0x141))/0xb);if(_0x3f4377===_0x241004)break;else _0x15c8f7['push'](_0x15c8f7['shift']());}catch(_0xf3e5eb){_0x15c8f7['push'](_0x15c8f7['shift']());}}}(a0_0x5998,0x351f0));import{readFileSync as a0_0x2cdd80,existsSync as a0_0x3fe832}from'fs';import{randomUUID as a0_0x1f6b75}from'crypto';import{join as a0_0x339687}from'path';function a0_0x5504(_0x554218,_0xf5f8c8){_0x554218=_0x554218-0x116;const _0x5998c3=a0_0x5998();let _0x5504bf=_0x5998c3[_0x554218];return _0x5504bf;}import{hostname as a0_0x45e8fe}from'os';import{execSync as a0_0x579a85}from'child_process';import{Server as a0_0x1ef6db}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x32ee0b}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x187cc9,CallToolRequestSchema as a0_0x4ac55b}from'@modelcontextprotocol/sdk/types.js';function p(_0x17b16d){const _0x16c29a=a0_0x5504;if(!a0_0x3fe832(_0x17b16d))return;for(let _0x3ae40e of a0_0x2cdd80(_0x17b16d,_0x16c29a(0x169))['split']('\x0a')){let _0xf83ebd=_0x3ae40e[_0x16c29a(0x16c)]();if(!_0xf83ebd||_0xf83ebd[_0x16c29a(0x170)]('#'))continue;let _0x16f81d=_0xf83ebd[_0x16c29a(0x12b)]('=');if(_0x16f81d<0x0)continue;let _0x50ea8e=_0xf83ebd[_0x16c29a(0x191)](0x0,_0x16f81d)[_0x16c29a(0x16c)](),_0x4f9e90=_0xf83ebd[_0x16c29a(0x191)](_0x16f81d+0x1)['trim']()[_0x16c29a(0x11d)](/^["']|["']$/g,'');if(!process.env[_0x50ea8e])process.env[_0x50ea8e]=_0x4f9e90;}}var C=process.env.HOME||'~',T=a0_0x339687(C,a0_0x342db3(0x11e));p(a0_0x339687(T,'.env'));var L=process['cwd']()[a0_0x342db3(0x11d)](/\//g,'-');p(a0_0x339687(T,L,a0_0x342db3(0x14b)));function U(){const _0x58e6b5=a0_0x342db3;try{return a0_0x579a85(_0x58e6b5(0x125),{'encoding':'utf-8','timeout':0x7d0})[_0x58e6b5(0x16c)]();}catch{return'';}}function v(){const _0x214aa7=a0_0x342db3;try{let _0x29c596=a0_0x339687(C,'.anet','config.json');if(a0_0x3fe832(_0x29c596))return JSON[_0x214aa7(0x144)](a0_0x2cdd80(_0x29c596,_0x214aa7(0x169)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x342db3(0x135)]||a0_0x342db3(0x1a3),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x45e8fe(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x1f6b75(),X=process.env.COMMHUB_TOKEN||H[a0_0x342db3(0x175)]||'';function Y(_0x23db3b){const _0x2973b2=a0_0x342db3;let _0xc7fa2c=new Date()[_0x2973b2(0x11b)]()[_0x2973b2(0x191)](0x0,0x8);process[_0x2973b2(0x139)][_0x2973b2(0x1a2)]('['+_0xc7fa2c+']\x20[commhub]\x20'+_0x23db3b+'\x0a');}function h(_0x1bc02e){return new Promise(_0x13206c=>setTimeout(_0x13206c,_0x1bc02e));}function a0_0x5998(){const _0x242e2e=['56vTAGOT','commhub_send_task','inbox_count','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','new_task','set','from','2VRwQVP','utf-8','ENV:\x20URL=','working','trim','SSE\x20fatal:\x20','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','CommHub\x20init\x20failed:\x20','startsWith','commhub_reply','normal','statusText','shutting\x20down,\x20reporting\x20offline...','token','params','task','connect','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','stringify','idle','Task\x20content','application/json,\x20text/event-stream','2.0','report_status','split','data:\x20','SSE\x20connection\x20error:\x20','1123896BXEyet','new_message','text','setRequestHandler','cancelled','high','161459XIINMA','delete','initialize','blocked','\x20ALIAS=','1115560kKhThC','failed','message_id','slice','completed','0.3.0','/mcp','registered\x20as\x20\x22','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','Bearer\x20','connecting\x20to\x20','decode','send_task','none','2815992CsizaM','\x22\x20(','connected','ack_inbox','getReader','cwd','write','http://127.0.0.1:9200','\x20RESUME_ID=','error','Priority\x20(default:\x20normal)','SIGINT','2025-03-26','session\x20disconnected','length','Target\x20session\x20alias','toTimeString','from_session','replace','.claude/channels/commhub','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','Reply\x20text\x20/\x20result\x20summary','Message\x20content','commhub','type','←\x20message\x20from\x20','tmux\x20display-message\x20-p\x20\x27#S\x27','get_inbox','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','claude-code','\x20CWD=','notification','indexOf','join','send_reply','notifications/claude/channel','body','message','147396OVGcYX','string','commhub_report_status','messages','hub','application/json','find','number','stderr','status','SSE\x20stream\x20ended,\x20reconnecting...','stdin','POST','alias','SIGTERM','786063zhSVwb','595463kZoDku','pop','object','parse','send_message','MCP\x20stdio\x20connected','starting\x20SSE\x20listener...','Current\x20task\x20description','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','result','.env','5SVPDSf','parse\x20error:\x20','catch','\x20priority=','read','init\x20failed:\x20','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','content','commhub-channel','commhub_send_message','ready\x20—\x20waiting\x20for\x20events','priority','\x20PROJECT_ENV=','no\x20response','SSE\x20connected\x20as\x20\x22','then','\x20from\x20','commhub_get_all_status','SSE\x20error:\x20','broadcast','290uDlcsy'];a0_0x5998=function(){return _0x242e2e;};return a0_0x5998();}Y(a0_0x342db3(0x16a)+f+a0_0x342db3(0x18d)+Z+a0_0x342db3(0x1a4)+w[a0_0x342db3(0x191)](0x0,0x8)+'...\x20TMUX='+(j||a0_0x342db3(0x19b))+a0_0x342db3(0x129)+process[a0_0x342db3(0x1a1)]()+a0_0x342db3(0x158)+L);var k=new Map(),K=new a0_0x1ef6db({'name':'commhub-channel','version':a0_0x342db3(0x193)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x342db3(0x149),a0_0x342db3(0x16e),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x342db3(0x164),'Session\x20alias:\x20'+Z][a0_0x342db3(0x12c)]('\x0a')});K[a0_0x342db3(0x186)](a0_0x187cc9,async()=>({'tools':[{'name':a0_0x342db3(0x171),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x342db3(0x143),'properties':{'task_id':{'type':a0_0x342db3(0x132),'description':a0_0x342db3(0x196)},'text':{'type':a0_0x342db3(0x132),'description':a0_0x342db3(0x120)},'status':{'type':a0_0x342db3(0x132),'enum':[a0_0x342db3(0x192),a0_0x342db3(0x18f),'cancelled',a0_0x342db3(0x18c),'error','in_progress'],'description':a0_0x342db3(0x11f)}},'required':['text']}},{'name':'commhub_report_status','description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x342db3(0x143),'properties':{'status':{'type':a0_0x342db3(0x132),'enum':['working',a0_0x342db3(0x17b),a0_0x342db3(0x18c),'error']},'task':{'type':a0_0x342db3(0x132),'description':a0_0x342db3(0x148)},'progress':{'type':a0_0x342db3(0x138),'description':'Progress\x200-100'}},'required':['status']}},{'name':'commhub_send_task','description':a0_0x342db3(0x152),'inputSchema':{'type':a0_0x342db3(0x143),'properties':{'alias':{'type':a0_0x342db3(0x132),'description':a0_0x342db3(0x11a)},'task':{'type':a0_0x342db3(0x132),'description':a0_0x342db3(0x17c)},'priority':{'type':'string','enum':[a0_0x342db3(0x188),a0_0x342db3(0x172),'low'],'description':a0_0x342db3(0x1a6)}},'required':[a0_0x342db3(0x13e),a0_0x342db3(0x177)]}},{'name':a0_0x342db3(0x155),'description':a0_0x342db3(0x179),'inputSchema':{'type':a0_0x342db3(0x143),'properties':{'alias':{'type':a0_0x342db3(0x132),'description':a0_0x342db3(0x11a)},'message':{'type':a0_0x342db3(0x132),'description':a0_0x342db3(0x121)}},'required':[a0_0x342db3(0x13e),a0_0x342db3(0x130)]}},{'name':'commhub_get_all_status','description':a0_0x342db3(0x127),'inputSchema':{'type':a0_0x342db3(0x143),'properties':{}}}]}));async function P(_0x162405,_0x16117a){const _0x3d451a=a0_0x342db3;let _0x2d118e=await fetch(f+'/mcp',{'method':_0x3d451a(0x13d),'headers':{'Content-Type':_0x3d451a(0x136),'Accept':_0x3d451a(0x17d),...X?{'Authorization':_0x3d451a(0x197)+X}:{}},'body':JSON[_0x3d451a(0x17a)]({'jsonrpc':_0x3d451a(0x17e),'id':0x1,'method':_0x3d451a(0x18b),'params':{'protocolVersion':_0x3d451a(0x117),'capabilities':{},'clientInfo':{'name':_0x3d451a(0x154),'version':_0x3d451a(0x193)}}})});if(!_0x2d118e['ok']){let _0x1de5a5=await _0x2d118e[_0x3d451a(0x185)]();return Y(_0x3d451a(0x16f)+_0x2d118e[_0x3d451a(0x13a)]+'\x20'+_0x1de5a5[_0x3d451a(0x191)](0x0,0x64)),{'ok':!0x1,'error':_0x3d451a(0x151)+_0x2d118e[_0x3d451a(0x13a)]};}await _0x2d118e['text']();let _0x1f828b=(await(await fetch(f+_0x3d451a(0x194),{'method':'POST','headers':{'Content-Type':_0x3d451a(0x136),'Accept':_0x3d451a(0x17d),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x3d451a(0x17a)]({'jsonrpc':_0x3d451a(0x17e),'id':0x2,'method':'tools/call','params':{'name':_0x162405,'arguments':_0x16117a}})}))[_0x3d451a(0x185)]())['split']('\x0a')[_0x3d451a(0x137)](_0x1afaf9=>_0x1afaf9[_0x3d451a(0x170)](_0x3d451a(0x181)));if(_0x1f828b){let _0x329537=JSON[_0x3d451a(0x144)](_0x1f828b[_0x3d451a(0x191)](0x6));return _0x329537?.[_0x3d451a(0x14a)]?.[_0x3d451a(0x153)]?.[0x0]?.[_0x3d451a(0x185)]?JSON[_0x3d451a(0x144)](_0x329537['result'][_0x3d451a(0x153)][0x0][_0x3d451a(0x185)]):_0x329537;}return{'ok':!0x1,'error':_0x3d451a(0x159)};}K[a0_0x342db3(0x186)](a0_0x4ac55b,async _0x5b86eb=>{const _0x386fc8=a0_0x342db3;let {name:_0x34dda5,arguments:_0x404a8a}=_0x5b86eb[_0x386fc8(0x176)];if(_0x34dda5===_0x386fc8(0x171)){let {task_id:_0x3e57e5,text:_0x3b983d,status:_0x16d621}=_0x404a8a;if(_0x16d621===_0x386fc8(0x192)||_0x16d621===_0x386fc8(0x18f)||_0x16d621===_0x386fc8(0x187)){let _0x1f8347=_0x16d621==='completed'?'replied':_0x16d621,_0x190a3a=_0x3e57e5?k['get'](_0x3e57e5)||_0x386fc8(0x135):_0x386fc8(0x135),_0x48094b=await P(_0x386fc8(0x12d),{'alias':_0x190a3a,'text':_0x3b983d,'in_reply_to':_0x3e57e5||void 0x0,'status':_0x1f8347,'from_session':Z});if(_0x3e57e5)k[_0x386fc8(0x18a)](_0x3e57e5);return{'content':[{'type':_0x386fc8(0x185),'text':JSON[_0x386fc8(0x17a)](_0x48094b)}]};}let _0x402c06=await P(_0x386fc8(0x17f),{'resume_id':w,'alias':Z,'status':_0x16d621===_0x386fc8(0x18c)?_0x386fc8(0x18c):_0x16d621==='error'?_0x386fc8(0x1a5):_0x386fc8(0x16b),'task':_0x3b983d['slice'](0x0,0xc8),'output':_0x3b983d});return{'content':[{'type':'text','text':JSON['stringify'](_0x402c06)}]};}if(_0x34dda5===_0x386fc8(0x133)){let {status:_0x726584,task:_0xac9576,progress:_0x2313eb}=_0x404a8a,_0x5a17af=await P(_0x386fc8(0x17f),{'resume_id':w,'alias':Z,'status':_0x726584,'task':_0xac9576,'progress':_0x2313eb});return{'content':[{'type':_0x386fc8(0x185),'text':JSON[_0x386fc8(0x17a)](_0x5a17af)}]};}if(_0x34dda5===_0x386fc8(0x162)){let {alias:_0x3d7387,task:_0xe3bbb1,priority:_0x48456b}=_0x404a8a,_0x34b144=await P(_0x386fc8(0x19a),{'alias':_0x3d7387,'task':_0xe3bbb1,'priority':_0x48456b||'normal','from_session':Z});return{'content':[{'type':'text','text':JSON[_0x386fc8(0x17a)](_0x34b144)}]};}if(_0x34dda5===_0x386fc8(0x155)){let {alias:_0x1f4e96,message:_0xa4bc71}=_0x404a8a,_0x18ecf5=await P(_0x386fc8(0x145),{'alias':_0x1f4e96,'message':_0xa4bc71,'from_session':Z});return{'content':[{'type':_0x386fc8(0x185),'text':JSON[_0x386fc8(0x17a)](_0x18ecf5)}]};}if(_0x34dda5===_0x386fc8(0x15d)){let _0x42317f=await P('get_all_status',{});return{'content':[{'type':_0x386fc8(0x185),'text':JSON[_0x386fc8(0x17a)](_0x42317f)}]};}return{'content':[{'type':'text','text':JSON[_0x386fc8(0x17a)]({'error':'unknown\x20tool'})}]};});async function u(){const _0x121147=a0_0x342db3;let _0xb0ea75=f+'/events/'+encodeURIComponent(Z),_0x314a69={};if(X)_0x314a69['Authorization']=_0x121147(0x197)+X;Y(_0x121147(0x198)+_0xb0ea75);while(!0x0){try{let _0x51de1b=await fetch(_0xb0ea75,{'headers':_0x314a69});if(!_0x51de1b['ok']){Y(_0x121147(0x15e)+_0x51de1b[_0x121147(0x13a)]+'\x20'+_0x51de1b[_0x121147(0x173)]),await h(0x1388);continue;}let _0x1eb1c9=_0x51de1b[_0x121147(0x12f)][_0x121147(0x1a0)](),_0x22f1b1=new TextDecoder(),_0x7d8099='';while(!0x0){let {done:_0x3203cf,value:_0x5d687d}=await _0x1eb1c9[_0x121147(0x150)]();if(_0x3203cf)break;_0x7d8099+=_0x22f1b1[_0x121147(0x199)](_0x5d687d,{'stream':!0x0});let _0x2c5aa6=_0x7d8099[_0x121147(0x180)]('\x0a\x0a');_0x7d8099=_0x2c5aa6[_0x121147(0x142)]()||'';for(let _0x9b8b5c of _0x2c5aa6){let _0x508298=_0x9b8b5c[_0x121147(0x180)]('\x0a')[_0x121147(0x137)](_0x5a7a1a=>_0x5a7a1a[_0x121147(0x170)](_0x121147(0x181)));if(!_0x508298)continue;try{let _0x1bf5ac=JSON[_0x121147(0x144)](_0x508298[_0x121147(0x191)](0x6));await S(_0x1bf5ac);}catch(_0x187917){Y(_0x121147(0x14d)+_0x187917);}}}Y(_0x121147(0x13b));}catch(_0x45e26c){Y(_0x121147(0x182)+_0x45e26c);}await h(0xbb8);}}async function S(_0xd63f39){const _0x7b1702=a0_0x342db3;if(_0xd63f39['type']===_0x7b1702(0x19e)){Y(_0x7b1702(0x15a)+Z+'\x22');return;}if(_0xd63f39[_0x7b1702(0x123)]===_0x7b1702(0x184)){if(Y(_0x7b1702(0x124)+_0xd63f39['from']+':\x20'+_0xd63f39[_0x7b1702(0x130)][_0x7b1702(0x191)](0x0,0x3c)),await K['notification']({'method':_0x7b1702(0x12e),'params':{'content':_0xd63f39[_0x7b1702(0x130)],'meta':{'sender':_0xd63f39[_0x7b1702(0x167)]||'hub','sender_id':'commhub','user':_0xd63f39[_0x7b1702(0x167)]||_0x7b1702(0x135),'priority':_0x7b1702(0x172)}}}),_0xd63f39[_0x7b1702(0x190)])await P(_0x7b1702(0x19f),{'alias':Z,'message_id':_0xd63f39[_0x7b1702(0x190)]});return;}if(_0xd63f39['type']===_0x7b1702(0x165)||_0xd63f39[_0x7b1702(0x123)]===_0x7b1702(0x15f)){Y('←\x20'+_0xd63f39['type']+':\x20inbox_count='+_0xd63f39[_0x7b1702(0x163)]+_0x7b1702(0x14f)+(_0xd63f39['priority']||'normal'));let _0x55e1d8=await P(_0x7b1702(0x126),{'alias':Z,'limit':0x5});if(_0x55e1d8?.['ok']&&_0x55e1d8[_0x7b1702(0x134)]?.[_0x7b1702(0x119)]>0x0)for(let _0x1b51f5 of _0x55e1d8['messages']){let _0x7ac4de={'sender':_0x1b51f5[_0x7b1702(0x11c)]||_0x7b1702(0x135),'sender_id':_0x7b1702(0x122),'user':_0x1b51f5['from_session']||_0x7b1702(0x135),'task_id':_0x1b51f5['id'],'priority':_0x1b51f5[_0x7b1702(0x157)]||_0x7b1702(0x172)};k[_0x7b1702(0x166)](_0x1b51f5['id'],_0x1b51f5[_0x7b1702(0x11c)]||_0x7b1702(0x135)),await K[_0x7b1702(0x12a)]({'method':_0x7b1702(0x12e),'params':{'content':_0x1b51f5[_0x7b1702(0x153)],'meta':_0x7ac4de}}),Y('→\x20injected\x20task\x20'+_0x1b51f5['id'][_0x7b1702(0x191)](0x0,0x8)+_0x7b1702(0x15c)+_0x1b51f5[_0x7b1702(0x11c)]+':\x20'+_0x1b51f5[_0x7b1702(0x153)][_0x7b1702(0x191)](0x0,0x3c)),await P(_0x7b1702(0x19f),{'alias':Z,'message_id':_0x1b51f5['id']});}}}async function A(){const _0x44a3b3=a0_0x342db3;let _0x396d68=new a0_0x32ee0b();await K[_0x44a3b3(0x178)](_0x396d68),Y(_0x44a3b3(0x146)),Y(_0x44a3b3(0x147)),u()[_0x44a3b3(0x14e)](_0x3b4f26=>Y(_0x44a3b3(0x16d)+_0x3b4f26)),P(_0x44a3b3(0x17f),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x45e8fe(),'hostname':a0_0x45e8fe(),'agent':_0x44a3b3(0x128),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x44a3b3(0x15b)](()=>Y(_0x44a3b3(0x195)+Z+_0x44a3b3(0x19d)+w[_0x44a3b3(0x191)](0x0,0x8)+')'))['catch'](_0x27a252=>Y('warning:\x20could\x20not\x20register:\x20'+_0x27a252)),setInterval(()=>{const _0x208d7c=_0x44a3b3;P(_0x208d7c(0x17f),{'resume_id':w,'alias':Z,'status':_0x208d7c(0x17b),'server':a0_0x45e8fe(),'hostname':a0_0x45e8fe(),'agent':'claude-code','project_dir':process[_0x208d7c(0x1a1)](),'tmux_name':j||void 0x0})[_0x208d7c(0x14e)](_0x38b7b1=>Y('heartbeat\x20failed:\x20'+_0x38b7b1));},0x2bf20),Y(_0x44a3b3(0x156));}A()[a0_0x342db3(0x14e)](_0x573daa=>{Y('fatal:\x20'+_0x573daa),process['exit'](0x1);});async function N(){const _0xea304c=a0_0x342db3;Y(_0xea304c(0x174)),await P('report_status',{'resume_id':w,'alias':Z,'status':'error','task':_0xea304c(0x118)})[_0xea304c(0x14e)](()=>{}),process['exit'](0x0);}process[a0_0x342db3(0x13c)]['on']('end',()=>N()),process['on'](a0_0x342db3(0x13f),()=>N()),process['on'](a0_0x342db3(0x116),()=>N());
|
|
2
|
+
const a0_0x1911d7=a0_0x4476;(function(_0x5ddb49,_0x1392c5){const _0x3871ee=a0_0x4476,_0x4cb3b9=_0x5ddb49();while(!![]){try{const _0x4eb9e4=-parseInt(_0x3871ee(0xf2))/0x1+parseInt(_0x3871ee(0x8e))/0x2+-parseInt(_0x3871ee(0xe6))/0x3*(-parseInt(_0x3871ee(0xa4))/0x4)+-parseInt(_0x3871ee(0xc6))/0x5+parseInt(_0x3871ee(0xdf))/0x6+parseInt(_0x3871ee(0xdc))/0x7*(parseInt(_0x3871ee(0xa9))/0x8)+parseInt(_0x3871ee(0xdd))/0x9;if(_0x4eb9e4===_0x1392c5)break;else _0x4cb3b9['push'](_0x4cb3b9['shift']());}catch(_0x24d1c8){_0x4cb3b9['push'](_0x4cb3b9['shift']());}}}(a0_0xa32b,0x6580a));import{readFileSync as a0_0x176b01,existsSync as a0_0x5ebc88}from'fs';import{randomUUID as a0_0xd569bd}from'crypto';function a0_0x4476(_0x382175,_0x4a30ce){_0x382175=_0x382175-0x6b;const _0xa32bfd=a0_0xa32b();let _0x4476d9=_0xa32bfd[_0x382175];return _0x4476d9;}import{join as a0_0x374525}from'path';import{hostname as a0_0x3ef463}from'os';import{execSync as a0_0x2fd266}from'child_process';import{Server as a0_0x23f068}from'@modelcontextprotocol/sdk/server/index.js';function a0_0xa32b(){const _0xa44839=['connect','SIGINT','completed','3hUMkgi',':\x20inbox_count=','cwd','normal','SSE\x20error:\x20','exit','string','status','no\x20response','result','body','set','734399IGyjZD','commhub_send_message','text','\x20RESUME_ID=','ready\x20—\x20waiting\x20for\x20events','report_status','catch','\x20from\x20','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','config.json','SSE\x20fatal:\x20','failed','error','.env','messages','from','fatal:\x20','→\x20injected\x20task\x20','in_progress','shutting\x20down,\x20reporting\x20offline...','new_message','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','commhub_get_all_status','getReader','Progress\x200-100','utf-8','stringify','SSE\x20stream\x20ended,\x20reconnecting...','priority','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','commhub_send_task','find','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','Priority\x20(default:\x20normal)','working','decode','from_session','type','replied','unknown\x20tool','779124WpqmWI','hub','token','high','replace','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','message','get','session\x20disconnected','application/json','join','ENV:\x20URL=','inbox_count','Target\x20session\x20alias','notifications/claude/channel','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','commhub','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','claude-code','Current\x20task\x20description','MCP\x20stdio\x20connected','none','777192UiQNph','stderr','.anet','commhub_report_status','delete','90112XINucP','idle','trim','pop','split',']\x20[commhub]\x20','\x20CWD=','ack_inbox','content','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','send_reply','/mcp','slice','0.3.0','parse\x20error:\x20','/events/','message_id','\x20ALIAS=','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','object','blocked','\x20priority=','tools/call','task','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','2025-03-26','POST','initialize','Message\x20content','1694825DWxBTL','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','Bearer\x20','broadcast','toTimeString','write','\x20PROJECT_ENV=','commhub-channel','length','Authorization','Session\x20alias:\x20','send_message','get_inbox','application/json,\x20text/event-stream','SSE\x20connection\x20error:\x20','data:\x20','alias','2.0','startsWith','warning:\x20could\x20not\x20register:\x20','notification','setRequestHandler','140wnTFPL','615483mHZZLe','...\x20TMUX=','3669546HrIjHw','parse','starting\x20SSE\x20listener...','indexOf'];a0_0xa32b=function(){return _0xa44839;};return a0_0xa32b();}import{StdioServerTransport as a0_0xa0284f}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x57a6fb,CallToolRequestSchema as a0_0x3b3a6b}from'@modelcontextprotocol/sdk/types.js';function p(_0x35ff77){const _0x185f0e=a0_0x4476;if(!a0_0x5ebc88(_0x35ff77))return;for(let _0x1c48ef of a0_0x176b01(_0x35ff77,_0x185f0e(0x7f))[_0x185f0e(0xad)]('\x0a')){let _0x2fa411=_0x1c48ef[_0x185f0e(0xab)]();if(!_0x2fa411||_0x2fa411['startsWith']('#'))continue;let _0x582cb4=_0x2fa411[_0x185f0e(0xe2)]('=');if(_0x582cb4<0x0)continue;let _0x5e4450=_0x2fa411[_0x185f0e(0xb5)](0x0,_0x582cb4)[_0x185f0e(0xab)](),_0x15edad=_0x2fa411['slice'](_0x582cb4+0x1)[_0x185f0e(0xab)]()[_0x185f0e(0x92)](/^["']|["']$/g,'');if(!process.env[_0x5e4450])process.env[_0x5e4450]=_0x15edad;}}var C=process.env.HOME||'~',T=a0_0x374525(C,'.claude/channels/commhub');p(a0_0x374525(T,a0_0x1911d7(0x73)));var L=process['cwd']()[a0_0x1911d7(0x92)](/\//g,'-');p(a0_0x374525(T,L,a0_0x1911d7(0x73)));function U(){const _0xff573=a0_0x1911d7;try{return a0_0x2fd266('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':'utf-8','timeout':0x7d0})[_0xff573(0xab)]();}catch{return'';}}function v(){const _0x211bd9=a0_0x1911d7;try{let _0x31749f=a0_0x374525(C,_0x211bd9(0xa6),_0x211bd9(0x6f));if(a0_0x5ebc88(_0x31749f))return JSON[_0x211bd9(0xe0)](a0_0x176b01(_0x31749f,_0x211bd9(0x7f)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H['hub']||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x3ef463(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0xd569bd(),X=process.env.COMMHUB_TOKEN||H[a0_0x1911d7(0x90)]||'';function Y(_0x458b73){const _0x50f159=a0_0x1911d7;let _0x2e54cf=new Date()[_0x50f159(0xca)]()[_0x50f159(0xb5)](0x0,0x8);process[_0x50f159(0xa5)][_0x50f159(0xcb)]('['+_0x2e54cf+_0x50f159(0xae)+_0x458b73+'\x0a');}function h(_0x28aa51){return new Promise(_0x49077f=>setTimeout(_0x49077f,_0x28aa51));}Y(a0_0x1911d7(0x99)+f+a0_0x1911d7(0xba)+Z+a0_0x1911d7(0xf5)+w[a0_0x1911d7(0xb5)](0x0,0x8)+a0_0x1911d7(0xde)+(j||a0_0x1911d7(0xa3))+a0_0x1911d7(0xaf)+process[a0_0x1911d7(0xe8)]()+a0_0x1911d7(0xcc)+L);var k=new Map(),K=new a0_0x23f068({'name':a0_0x1911d7(0xcd),'version':a0_0x1911d7(0xb6)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x1911d7(0x6e),a0_0x1911d7(0xc1),a0_0x1911d7(0xc7),a0_0x1911d7(0xb2),a0_0x1911d7(0xd0)+Z][a0_0x1911d7(0x98)]('\x0a')});K[a0_0x1911d7(0xdb)](a0_0x57a6fb,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x1911d7(0x7b),'inputSchema':{'type':a0_0x1911d7(0xbc),'properties':{'task_id':{'type':a0_0x1911d7(0xec),'description':a0_0x1911d7(0x9d)},'text':{'type':a0_0x1911d7(0xec),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x1911d7(0xec),'enum':[a0_0x1911d7(0xe5),'failed','cancelled',a0_0x1911d7(0xbd),a0_0x1911d7(0x72),a0_0x1911d7(0x78)],'description':a0_0x1911d7(0xbb)}},'required':[a0_0x1911d7(0xf4)]}},{'name':a0_0x1911d7(0xa7),'description':a0_0x1911d7(0x9f),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x1911d7(0xec),'enum':[a0_0x1911d7(0x88),a0_0x1911d7(0xaa),'blocked',a0_0x1911d7(0x72)]},'task':{'type':a0_0x1911d7(0xec),'description':a0_0x1911d7(0xa1)},'progress':{'type':'number','description':a0_0x1911d7(0x7e)}},'required':[a0_0x1911d7(0xed)]}},{'name':a0_0x1911d7(0x84),'description':a0_0x1911d7(0x93),'inputSchema':{'type':a0_0x1911d7(0xbc),'properties':{'alias':{'type':a0_0x1911d7(0xec),'description':a0_0x1911d7(0x9b)},'task':{'type':a0_0x1911d7(0xec),'description':'Task\x20content'},'priority':{'type':a0_0x1911d7(0xec),'enum':[a0_0x1911d7(0x91),a0_0x1911d7(0xe9),'low'],'description':a0_0x1911d7(0x87)}},'required':['alias',a0_0x1911d7(0xc0)]}},{'name':a0_0x1911d7(0xf3),'description':a0_0x1911d7(0x86),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x1911d7(0xec),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x1911d7(0xec),'description':a0_0x1911d7(0xc5)}},'required':[a0_0x1911d7(0xd6),a0_0x1911d7(0x94)]}},{'name':a0_0x1911d7(0x7c),'description':a0_0x1911d7(0x83),'inputSchema':{'type':a0_0x1911d7(0xbc),'properties':{}}}]}));async function P(_0xd25b62,_0x536664){const _0xf090bd=a0_0x1911d7;let _0x3a90d0=await fetch(f+'/mcp',{'method':_0xf090bd(0xc3),'headers':{'Content-Type':_0xf090bd(0x97),'Accept':_0xf090bd(0xd3),...X?{'Authorization':_0xf090bd(0xc8)+X}:{}},'body':JSON[_0xf090bd(0x80)]({'jsonrpc':_0xf090bd(0xd7),'id':0x1,'method':_0xf090bd(0xc4),'params':{'protocolVersion':_0xf090bd(0xc2),'capabilities':{},'clientInfo':{'name':_0xf090bd(0xcd),'version':'0.3.0'}}})});if(!_0x3a90d0['ok']){let _0x16d2f3=await _0x3a90d0[_0xf090bd(0xf4)]();return Y('CommHub\x20init\x20failed:\x20'+_0x3a90d0['status']+'\x20'+_0x16d2f3[_0xf090bd(0xb5)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x3a90d0['status']};}await _0x3a90d0[_0xf090bd(0xf4)]();let _0x13cfed=(await(await fetch(f+_0xf090bd(0xb4),{'method':_0xf090bd(0xc3),'headers':{'Content-Type':'application/json','Accept':_0xf090bd(0xd3),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0xf090bd(0x80)]({'jsonrpc':_0xf090bd(0xd7),'id':0x2,'method':_0xf090bd(0xbf),'params':{'name':_0xd25b62,'arguments':_0x536664}})}))[_0xf090bd(0xf4)]())[_0xf090bd(0xad)]('\x0a')['find'](_0x348c6d=>_0x348c6d[_0xf090bd(0xd8)]('data:\x20'));if(_0x13cfed){let _0x303305=JSON[_0xf090bd(0xe0)](_0x13cfed[_0xf090bd(0xb5)](0x6));return _0x303305?.[_0xf090bd(0xef)]?.[_0xf090bd(0xb1)]?.[0x0]?.[_0xf090bd(0xf4)]?JSON[_0xf090bd(0xe0)](_0x303305[_0xf090bd(0xef)][_0xf090bd(0xb1)][0x0]['text']):_0x303305;}return{'ok':!0x1,'error':_0xf090bd(0xee)};}K[a0_0x1911d7(0xdb)](a0_0x3b3a6b,async _0x269cc4=>{const _0x2582a2=a0_0x1911d7;let {name:_0x25a8a7,arguments:_0x463e86}=_0x269cc4['params'];if(_0x25a8a7==='commhub_reply'){let {task_id:_0x26c8a3,text:_0x2e549e,status:_0x5866f9}=_0x463e86;if(_0x5866f9===_0x2582a2(0xe5)||_0x5866f9===_0x2582a2(0x71)||_0x5866f9==='cancelled'){let _0x40d23d=_0x5866f9===_0x2582a2(0xe5)?_0x2582a2(0x8c):_0x5866f9,_0x5342b1=_0x26c8a3?k[_0x2582a2(0x95)](_0x26c8a3)||_0x2582a2(0x8f):_0x2582a2(0x8f),_0x46aaae=await P(_0x2582a2(0xb3),{'alias':_0x5342b1,'text':_0x2e549e,'in_reply_to':_0x26c8a3||void 0x0,'status':_0x40d23d,'from_session':Z});if(_0x26c8a3)k[_0x2582a2(0xa8)](_0x26c8a3);return{'content':[{'type':_0x2582a2(0xf4),'text':JSON[_0x2582a2(0x80)](_0x46aaae)}]};}let _0x3f3562=await P(_0x2582a2(0x6b),{'resume_id':w,'alias':Z,'status':_0x5866f9===_0x2582a2(0xbd)?_0x2582a2(0xbd):_0x5866f9===_0x2582a2(0x72)?_0x2582a2(0x72):_0x2582a2(0x88),'task':_0x2e549e[_0x2582a2(0xb5)](0x0,0xc8),'output':_0x2e549e});return{'content':[{'type':'text','text':JSON[_0x2582a2(0x80)](_0x3f3562)}]};}if(_0x25a8a7==='commhub_report_status'){let {status:_0x19a500,task:_0xf50328,progress:_0x4bd999}=_0x463e86,_0x5a335f=await P(_0x2582a2(0x6b),{'resume_id':w,'alias':Z,'status':_0x19a500,'task':_0xf50328,'progress':_0x4bd999});return{'content':[{'type':'text','text':JSON['stringify'](_0x5a335f)}]};}if(_0x25a8a7===_0x2582a2(0x84)){let {alias:_0x15ce2a,task:_0x5147a5,priority:_0x4dcc72}=_0x463e86,_0x2763f4=await P('send_task',{'alias':_0x15ce2a,'task':_0x5147a5,'priority':_0x4dcc72||_0x2582a2(0xe9),'from_session':Z});return{'content':[{'type':_0x2582a2(0xf4),'text':JSON[_0x2582a2(0x80)](_0x2763f4)}]};}if(_0x25a8a7===_0x2582a2(0xf3)){let {alias:_0x48fef1,message:_0x5046f5}=_0x463e86,_0x53a5c1=await P(_0x2582a2(0xd1),{'alias':_0x48fef1,'message':_0x5046f5,'from_session':Z});return{'content':[{'type':_0x2582a2(0xf4),'text':JSON[_0x2582a2(0x80)](_0x53a5c1)}]};}if(_0x25a8a7===_0x2582a2(0x7c)){let _0x174714=await P('get_all_status',{});return{'content':[{'type':_0x2582a2(0xf4),'text':JSON[_0x2582a2(0x80)](_0x174714)}]};}return{'content':[{'type':_0x2582a2(0xf4),'text':JSON[_0x2582a2(0x80)]({'error':_0x2582a2(0x8d)})}]};});async function u(){const _0x21cf0c=a0_0x1911d7;let _0x3e91c5=f+_0x21cf0c(0xb8)+encodeURIComponent(Z),_0x2ffad9={};if(X)_0x2ffad9[_0x21cf0c(0xcf)]=_0x21cf0c(0xc8)+X;Y('connecting\x20to\x20'+_0x3e91c5);while(!0x0){try{let _0x14b750=await fetch(_0x3e91c5,{'headers':_0x2ffad9});if(!_0x14b750['ok']){Y(_0x21cf0c(0xea)+_0x14b750[_0x21cf0c(0xed)]+'\x20'+_0x14b750['statusText']),await h(0x1388);continue;}let _0x1f95ee=_0x14b750[_0x21cf0c(0xf0)][_0x21cf0c(0x7d)](),_0x56990a=new TextDecoder(),_0x518b71='';while(!0x0){let {done:_0x4b842f,value:_0x323d6a}=await _0x1f95ee['read']();if(_0x4b842f)break;_0x518b71+=_0x56990a[_0x21cf0c(0x89)](_0x323d6a,{'stream':!0x0});let _0x364995=_0x518b71[_0x21cf0c(0xad)]('\x0a\x0a');_0x518b71=_0x364995[_0x21cf0c(0xac)]()||'';for(let _0x583b2e of _0x364995){let _0xfeac9f=_0x583b2e['split']('\x0a')[_0x21cf0c(0x85)](_0x22fbbb=>_0x22fbbb['startsWith'](_0x21cf0c(0xd5)));if(!_0xfeac9f)continue;try{let _0x52ae2b=JSON['parse'](_0xfeac9f['slice'](0x6));await S(_0x52ae2b);}catch(_0x2f9b3c){Y(_0x21cf0c(0xb7)+_0x2f9b3c);}}}Y(_0x21cf0c(0x81));}catch(_0x5ae3cc){Y(_0x21cf0c(0xd4)+_0x5ae3cc);}await h(0xbb8);}}async function S(_0x125c2a){const _0xc14f15=a0_0x1911d7;if(_0x125c2a[_0xc14f15(0x8b)]==='connected'){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x125c2a[_0xc14f15(0x8b)]===_0xc14f15(0x7a)){if(Y('←\x20message\x20from\x20'+_0x125c2a[_0xc14f15(0x75)]+':\x20'+_0x125c2a[_0xc14f15(0x94)][_0xc14f15(0xb5)](0x0,0x3c)),await K[_0xc14f15(0xda)]({'method':_0xc14f15(0x9c),'params':{'content':_0x125c2a[_0xc14f15(0x94)],'meta':{'sender':_0x125c2a[_0xc14f15(0x75)]||'hub','sender_id':_0xc14f15(0x9e),'user':_0x125c2a[_0xc14f15(0x75)]||'hub','priority':_0xc14f15(0xe9)}}}),_0x125c2a['message_id'])await P('ack_inbox',{'alias':Z,'message_id':_0x125c2a[_0xc14f15(0xb9)]});return;}if(_0x125c2a['type']==='new_task'||_0x125c2a[_0xc14f15(0x8b)]===_0xc14f15(0xc9)){Y('←\x20'+_0x125c2a[_0xc14f15(0x8b)]+_0xc14f15(0xe7)+_0x125c2a[_0xc14f15(0x9a)]+_0xc14f15(0xbe)+(_0x125c2a[_0xc14f15(0x82)]||_0xc14f15(0xe9)));let _0x41535a=await P(_0xc14f15(0xd2),{'alias':Z,'limit':0x5});if(_0x41535a?.['ok']&&_0x41535a['messages']?.[_0xc14f15(0xce)]>0x0)for(let _0x3f8c3f of _0x41535a[_0xc14f15(0x74)]){let _0x37c646={'sender':_0x3f8c3f[_0xc14f15(0x8a)]||_0xc14f15(0x8f),'sender_id':_0xc14f15(0x9e),'user':_0x3f8c3f[_0xc14f15(0x8a)]||'hub','task_id':_0x3f8c3f['id'],'priority':_0x3f8c3f[_0xc14f15(0x82)]||_0xc14f15(0xe9)};k[_0xc14f15(0xf1)](_0x3f8c3f['id'],_0x3f8c3f[_0xc14f15(0x8a)]||_0xc14f15(0x8f)),await K[_0xc14f15(0xda)]({'method':_0xc14f15(0x9c),'params':{'content':_0x3f8c3f[_0xc14f15(0xb1)],'meta':_0x37c646}}),Y(_0xc14f15(0x77)+_0x3f8c3f['id'][_0xc14f15(0xb5)](0x0,0x8)+_0xc14f15(0x6d)+_0x3f8c3f[_0xc14f15(0x8a)]+':\x20'+_0x3f8c3f[_0xc14f15(0xb1)][_0xc14f15(0xb5)](0x0,0x3c)),await P(_0xc14f15(0xb0),{'alias':Z,'message_id':_0x3f8c3f['id']});}}}async function A(){const _0x3561b3=a0_0x1911d7;let _0xf9a93c=new a0_0xa0284f();await K[_0x3561b3(0xe3)](_0xf9a93c),Y(_0x3561b3(0xa2)),Y(_0x3561b3(0xe1)),u()[_0x3561b3(0x6c)](_0x1af6d3=>Y(_0x3561b3(0x70)+_0x1af6d3)),P(_0x3561b3(0x6b),{'resume_id':w,'alias':Z,'status':_0x3561b3(0xaa),'server':a0_0x3ef463(),'hostname':a0_0x3ef463(),'agent':_0x3561b3(0xa0),'project_dir':process[_0x3561b3(0xe8)](),'tmux_name':j||void 0x0})['then'](()=>Y('registered\x20as\x20\x22'+Z+'\x22\x20('+w[_0x3561b3(0xb5)](0x0,0x8)+')'))[_0x3561b3(0x6c)](_0x3f3681=>Y(_0x3561b3(0xd9)+_0x3f3681)),setInterval(()=>{const _0x5828a5=_0x3561b3;P(_0x5828a5(0x6b),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x3ef463(),'hostname':a0_0x3ef463(),'agent':_0x5828a5(0xa0),'project_dir':process[_0x5828a5(0xe8)](),'tmux_name':j||void 0x0})[_0x5828a5(0x6c)](_0x372efb=>Y('heartbeat\x20failed:\x20'+_0x372efb));},0x2bf20),Y(_0x3561b3(0xf6));}A()[a0_0x1911d7(0x6c)](_0x48fc08=>{const _0x794560=a0_0x1911d7;Y(_0x794560(0x76)+_0x48fc08),process[_0x794560(0xeb)](0x1);});async function N(){const _0x4ae36f=a0_0x1911d7;Y(_0x4ae36f(0x79)),await P(_0x4ae36f(0x6b),{'resume_id':w,'alias':Z,'status':_0x4ae36f(0x72),'task':_0x4ae36f(0x96)})[_0x4ae36f(0x6c)](()=>{}),process[_0x4ae36f(0xeb)](0x0);}process['stdin']['on']('end',()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x1911d7(0xe4),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.1.13-preview.
|
|
3
|
+
"version": "2.1.13-preview.4",
|
|
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",
|