@sleep2agi/agent-network 2.0.0-preview.55 → 2.0.0-preview.57
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
|
-
function
|
|
1
|
+
const a0_0x49d020=a0_0x3194;function a0_0x3194(_0x49d784,_0xa413df){_0x49d784=_0x49d784-0x147;const _0xfd949b=a0_0xfd94();let _0x319488=_0xfd949b[_0x49d784];return _0x319488;}function a0_0xfd94(){const _0x31406a=['AbortError','name','toString','application/json','POST','SSE\x20reconnecting\x20in\x20','5262984CPcyjg','connectSSE','1zzTKmv','cwd','1640880qXaekf','report_status','now','heartbeatTimer','autoConnect','data:\x20','from_session','SSE\x20failed:\x20','normal','stringify','sleep','connected','disconnect','min','/events/','match','/mcp','5794285RypInt','sdk-','get_all_status','message','sdk','4304124YjEqhO','registered','signal','disconnected','token','connect','get_inbox','alias','processInbox','split','replace','read','call','pop','sseAbort','s...','url','content','send_task','4586260WrvCBt','getReader','new_task','send','20037KzsGMq',']\x20[commhub:','type','Authorization','running','slice','catch','heartbeat\x20failed:\x20','body','2.0','reconnectDelay','getAllStatus','broadcast','Bearer\x20','messages','idle','result','reply','text/event-stream','SSE\x20error:\x20','parse','heartbeatInterval','task','toTimeString','8lZlaYe','log','agent','emit','status','resumeId','1334258roKLgv'];a0_0xfd94=function(){return _0x31406a;};return a0_0xfd94();}(function(_0x29eb2c,_0x258117){const _0x4d392d=a0_0x3194,_0x162bb4=_0x29eb2c();while(!![]){try{const _0x228981=parseInt(_0x4d392d(0x194))/0x1*(parseInt(_0x4d392d(0x18b))/0x2)+-parseInt(_0x4d392d(0x16d))/0x3+-parseInt(_0x4d392d(0x156))/0x4+-parseInt(_0x4d392d(0x169))/0x5+parseInt(_0x4d392d(0x192))/0x6+parseInt(_0x4d392d(0x151))/0x7*(parseInt(_0x4d392d(0x185))/0x8)+parseInt(_0x4d392d(0x196))/0x9;if(_0x228981===_0x258117)break;else _0x162bb4['push'](_0x162bb4['shift']());}catch(_0x4c4909){_0x162bb4['push'](_0x162bb4['shift']());}}}(a0_0xfd94,0x875a6));import{EventEmitter as a0_0x377555}from'events';import{hostname as a0_0x1fd2da}from'os';class T extends a0_0x377555{[a0_0x49d020(0x166)];[a0_0x49d020(0x15d)];[a0_0x49d020(0x15a)];[a0_0x49d020(0x187)];[a0_0x49d020(0x18a)];['heartbeatInterval'];[a0_0x49d020(0x177)];[a0_0x49d020(0x199)];[a0_0x49d020(0x164)];[a0_0x49d020(0x171)]=!0x1;constructor(_0x33ab87){const _0x41cd21=a0_0x49d020;super();if(this['url']=_0x33ab87['url'][_0x41cd21(0x160)](/\/$/,''),this[_0x41cd21(0x15d)]=_0x33ab87['alias'],this[_0x41cd21(0x15a)]=_0x33ab87[_0x41cd21(0x15a)],this['agent']=_0x33ab87[_0x41cd21(0x187)]||_0x41cd21(0x155),this[_0x41cd21(0x18a)]=_0x41cd21(0x152)+_0x33ab87['alias']+'-'+Date[_0x41cd21(0x198)]()[_0x41cd21(0x18e)](0x24),this['heartbeatInterval']=_0x33ab87['heartbeatInterval']??0x2bf20,this[_0x41cd21(0x177)]=_0x33ab87[_0x41cd21(0x177)]??0xbb8,_0x33ab87[_0x41cd21(0x19a)]!==!0x1)this['connect']();}[a0_0x49d020(0x186)](_0x29933e){const _0xe0705c=a0_0x49d020;console[_0xe0705c(0x186)]('['+new Date()[_0xe0705c(0x184)]()[_0xe0705c(0x172)](0x0,0x8)+_0xe0705c(0x16e)+this['alias']+']\x20'+_0x29933e);}async['call'](_0x33c44f,_0x3bf56b){const _0x3f76a3=a0_0x49d020;let _0x5299bb={'Content-Type':_0x3f76a3(0x18f),'Accept':'application/json,\x20text/event-stream'};if(this[_0x3f76a3(0x15a)])_0x5299bb['Authorization']=_0x3f76a3(0x17a)+this[_0x3f76a3(0x15a)];let _0x56d05a=await(await fetch(this['url']+_0x3f76a3(0x150),{'method':_0x3f76a3(0x190),'headers':_0x5299bb,'body':JSON[_0x3f76a3(0x149)]({'jsonrpc':_0x3f76a3(0x176),'id':Date[_0x3f76a3(0x198)](),'method':'tools/call','params':{'name':_0x33c44f,'arguments':_0x3bf56b}})}))['text'](),_0x1dec8d=_0x56d05a[_0x3f76a3(0x14f)](/data: (.+)/),_0x141451=_0x1dec8d?JSON[_0x3f76a3(0x181)](_0x1dec8d[0x1]):JSON['parse'](_0x56d05a),_0x513b91=_0x141451?.[_0x3f76a3(0x17d)]?.[_0x3f76a3(0x167)]?.[0x0]?.['text'];return _0x513b91?JSON[_0x3f76a3(0x181)](_0x513b91):_0x141451;}async[a0_0x49d020(0x15b)](){const _0x42c55f=a0_0x49d020;if(this[_0x42c55f(0x171)])return;this[_0x42c55f(0x171)]=!0x0,await this['status'](_0x42c55f(0x17c)),this[_0x42c55f(0x186)](_0x42c55f(0x157)),this[_0x42c55f(0x199)]=setInterval(()=>{const _0x262aab=_0x42c55f;this[_0x262aab(0x189)](_0x262aab(0x17c))[_0x262aab(0x173)](_0x36e2b3=>this[_0x262aab(0x186)](_0x262aab(0x174)+_0x36e2b3[_0x262aab(0x154)]));},this[_0x42c55f(0x182)]),this['connectSSE']();}async[a0_0x49d020(0x14c)](){const _0x11e7e9=a0_0x49d020;if(this[_0x11e7e9(0x171)]=!0x1,this[_0x11e7e9(0x164)]?.['abort'](),this['heartbeatTimer'])clearInterval(this[_0x11e7e9(0x199)]);await this['status']('offline')['catch'](()=>{}),this[_0x11e7e9(0x186)](_0x11e7e9(0x159));}async[a0_0x49d020(0x16c)](_0x389712,_0x233a7d,_0x4eaccd=a0_0x49d020(0x148)){const _0x5282b2=a0_0x49d020;return this['call'](_0x5282b2(0x168),{'alias':_0x389712,'task':_0x233a7d,'priority':_0x4eaccd,'from_session':this[_0x5282b2(0x15d)]});}async['message'](_0x288ff0,_0x27630e){const _0x44ee67=a0_0x49d020;return this[_0x44ee67(0x162)]('send_message',{'alias':_0x288ff0,'message':_0x27630e,'from_session':this[_0x44ee67(0x15d)]});}async[a0_0x49d020(0x17e)](_0x307d81,_0x38a95d,_0x19351b='completed'){return this['call']('reply',{'task_id':_0x307d81,'text':_0x38a95d,'status':_0x19351b});}async[a0_0x49d020(0x189)](_0x4a1391,_0x1628f5){const _0x2ffbd7=a0_0x49d020;return this['call'](_0x2ffbd7(0x197),{'resume_id':this[_0x2ffbd7(0x18a)],'alias':this[_0x2ffbd7(0x15d)],'status':_0x4a1391,'server':a0_0x1fd2da(),'hostname':a0_0x1fd2da(),'agent':this[_0x2ffbd7(0x187)],'project_dir':process[_0x2ffbd7(0x195)](),..._0x1628f5});}async[a0_0x49d020(0x178)](){const _0x515b77=a0_0x49d020;return this['call'](_0x515b77(0x153),{});}async[a0_0x49d020(0x179)](_0x803774,_0x4e08e7){const _0x58c446=a0_0x49d020;return this[_0x58c446(0x162)](_0x58c446(0x179),{'message':_0x803774,'filter_server':_0x4e08e7?.['server'],'filter_status':_0x4e08e7?.[_0x58c446(0x189)]});}async[a0_0x49d020(0x193)](){const _0x3aa5cc=a0_0x49d020;let _0x3271be=encodeURIComponent(this[_0x3aa5cc(0x15d)]),_0x4d8f0d=this[_0x3aa5cc(0x166)]+_0x3aa5cc(0x14e)+_0x3271be,_0x5d9c4d=this[_0x3aa5cc(0x177)];while(this[_0x3aa5cc(0x171)]){try{this['sseAbort']=new AbortController();let _0x17b518={'Accept':_0x3aa5cc(0x17f)};if(this[_0x3aa5cc(0x15a)])_0x17b518[_0x3aa5cc(0x170)]='Bearer\x20'+this['token'];let _0xdea271=await fetch(_0x4d8f0d,{'headers':_0x17b518,'signal':this['sseAbort'][_0x3aa5cc(0x158)]});if(!_0xdea271['ok']||!_0xdea271[_0x3aa5cc(0x175)]){this[_0x3aa5cc(0x186)](_0x3aa5cc(0x147)+_0xdea271[_0x3aa5cc(0x189)]),await this['sleep'](_0x5d9c4d),_0x5d9c4d=Math[_0x3aa5cc(0x14d)](_0x5d9c4d*1.5,0xea60);continue;}_0x5d9c4d=this[_0x3aa5cc(0x177)];let _0x366450=_0xdea271['body'][_0x3aa5cc(0x16a)](),_0x35562b=new TextDecoder(),_0x144076='';while(this['running']){let {done:_0x1bb4b4,value:_0x140ecc}=await _0x366450[_0x3aa5cc(0x161)]();if(_0x1bb4b4)break;_0x144076+=_0x35562b['decode'](_0x140ecc,{'stream':!0x0});let _0x187203=_0x144076[_0x3aa5cc(0x15f)]('\x0a');_0x144076=_0x187203[_0x3aa5cc(0x163)]()||'';for(let _0x2b2585 of _0x187203){if(!_0x2b2585['startsWith'](_0x3aa5cc(0x19b)))continue;try{let _0x3797f6=JSON['parse'](_0x2b2585[_0x3aa5cc(0x172)](0x6));if(_0x3797f6[_0x3aa5cc(0x16f)]===_0x3aa5cc(0x14b)){this['log']('SSE\x20connected'),this['emit'](_0x3aa5cc(0x14b));continue;}if(_0x3797f6[_0x3aa5cc(0x16f)]===_0x3aa5cc(0x16b)||_0x3797f6[_0x3aa5cc(0x16f)]==='new_message'||_0x3797f6[_0x3aa5cc(0x16f)]===_0x3aa5cc(0x179))await this[_0x3aa5cc(0x15e)]();}catch{}}}}catch(_0x535429){if(_0x535429[_0x3aa5cc(0x18d)]===_0x3aa5cc(0x18c))break;this[_0x3aa5cc(0x188)]('error',_0x535429),this[_0x3aa5cc(0x186)](_0x3aa5cc(0x180)+_0x535429[_0x3aa5cc(0x154)]);}if(this[_0x3aa5cc(0x171)])this[_0x3aa5cc(0x188)](_0x3aa5cc(0x159)),this[_0x3aa5cc(0x186)](_0x3aa5cc(0x191)+_0x5d9c4d/0x3e8+_0x3aa5cc(0x165)),await this[_0x3aa5cc(0x14a)](_0x5d9c4d),_0x5d9c4d=Math[_0x3aa5cc(0x14d)](_0x5d9c4d*1.5,0xea60);}}async[a0_0x49d020(0x15e)](){const _0xf52d2e=a0_0x49d020;try{let _0x5cbde8=(await this[_0xf52d2e(0x162)](_0xf52d2e(0x15c),{'alias':this[_0xf52d2e(0x15d)],'limit':0xa}))?.[_0xf52d2e(0x17b)]||[];for(let _0x4996aa of _0x5cbde8)await this[_0xf52d2e(0x162)]('ack_inbox',{'alias':this[_0xf52d2e(0x15d)],'message_id':_0x4996aa['id']}),this[_0xf52d2e(0x186)]('←\x20'+_0x4996aa[_0xf52d2e(0x19c)]+':\x20'+_0x4996aa[_0xf52d2e(0x167)]['slice'](0x0,0x3c)),this[_0xf52d2e(0x188)](_0xf52d2e(0x183),_0x4996aa),this['emit'](_0xf52d2e(0x154),_0x4996aa);}catch(_0x3be932){this['log']('inbox\x20error:\x20'+_0x3be932[_0xf52d2e(0x154)]);}}[a0_0x49d020(0x14a)](_0x5e8f59){return new Promise(_0x149264=>setTimeout(_0x149264,_0x5e8f59));}}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_0x46bc01=a0_0x1e47;(function(_0x1aeaec,_0x35744b){const _0x2fa31a=a0_0x1e47,_0x4ff753=_0x1aeaec();while(!![]){try{const _0xc939bc=parseInt(_0x2fa31a(0x16d))/0x1+parseInt(_0x2fa31a(0x154))/0x2+-parseInt(_0x2fa31a(0x12f))/0x3*(-parseInt(_0x2fa31a(0xfb))/0x4)+-parseInt(_0x2fa31a(0x126))/0x5*(-parseInt(_0x2fa31a(0x112))/0x6)+-parseInt(_0x2fa31a(0xf6))/0x7+parseInt(_0x2fa31a(0x10e))/0x8*(parseInt(_0x2fa31a(0x15a))/0x9)+-parseInt(_0x2fa31a(0x13f))/0xa;if(_0xc939bc===_0x35744b)break;else _0x4ff753['push'](_0x4ff753['shift']());}catch(_0x5f0d41){_0x4ff753['push'](_0x4ff753['shift']());}}}(a0_0x6bf0,0xd89e7));import{readFileSync as a0_0x334eab,existsSync as a0_0x3da6aa}from'fs';import{join as a0_0x5a8e9a}from'path';import{hostname as a0_0x9d929a}from'os';import{execSync as a0_0x22c7c2}from'child_process';import{Server as a0_0x2b3096}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x51a089}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x52b421,CallToolRequestSchema as a0_0xac02b8}from'@modelcontextprotocol/sdk/types.js';function p(_0xc191b7){const _0x300136=a0_0x1e47;if(!a0_0x3da6aa(_0xc191b7))return;for(let _0x26967e of a0_0x334eab(_0xc191b7,_0x300136(0xfe))[_0x300136(0x147)]('\x0a')){let _0x5ef7c7=_0x26967e[_0x300136(0x13e)]();if(!_0x5ef7c7||_0x5ef7c7[_0x300136(0x136)]('#'))continue;let _0x453081=_0x5ef7c7[_0x300136(0x178)]('=');if(_0x453081<0x0)continue;let _0xedcab2=_0x5ef7c7['slice'](0x0,_0x453081)[_0x300136(0x13e)](),_0x4eaeae=_0x5ef7c7[_0x300136(0x10b)](_0x453081+0x1)['trim']()[_0x300136(0xf8)](/^["']|["']$/g,'');if(!process.env[_0xedcab2])process.env[_0xedcab2]=_0x4eaeae;}}function a0_0x6bf0(){const _0x433fdb=['connected','set','no\x20response',']\x20[commhub]\x20','message','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','cwd','commhub_send_task','Target\x20session\x20alias','none','slice','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','normal','16VxIVGK','blocked','commhub_report_status','find','1613802CAPdbF','application/json','hub','send_task','notifications/claude/channel','status','\x20PROJECT_ENV=','ENV:\x20URL=','in_progress','toTimeString','SIGTERM',':\x20inbox_count=','message_id','parse','Progress\x200-100','read','parse\x20error:\x20','high','commhub','commhub_get_all_status','10svCWLw','get_all_status','error','warning:\x20could\x20not\x20register:\x20','messages','\x20RESUME_ID=','MCP\x20stdio\x20connected','shutting\x20down,\x20reporting\x20offline...','SSE\x20stream\x20ended,\x20reconnecting...','102ieADea','number','join','/mcp','content','string','data:\x20','startsWith','←\x20message\x20from\x20','Session\x20alias:\x20','priority','\x20from\x20','inbox_count','Authorization','write','trim','27913070ufTkiE','delete','completed','new_message','Current\x20task\x20description','0.3.0','token','config.json','split','send_reply','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','Bearer\x20','report_status','Priority\x20(default:\x20normal)','exit','failed','randomUUID','decode','new_task','/events/','starting\x20SSE\x20listener...','1798600QOGHQC','statusText','init\x20failed:\x20','from_session','2025-03-26','object','6711786ScfQsn','→\x20injected\x20task\x20','SSE\x20connection\x20error:\x20','initialize','commhub_reply','setRequestHandler','tools/call','ack_inbox','from','result','replied','SSE\x20connected\x20as\x20\x22','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','stringify','session\x20disconnected','then','catch','send_message','\x22\x20(','1131541IJsJDz','.env','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','SSE\x20error:\x20','notification','claude-code','broadcast','idle','heartbeat\x20failed:\x20','alias','end','indexOf','fatal:\x20','body','text','working','Message\x20content','cancelled','POST','.claude/channels/commhub','SSE\x20fatal:\x20','commhub-channel','9835021FRpHlq','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','replace','\x20CWD=','Task\x20content','120388RpOBSj','stdin','2.0','utf-8','type','application/json,\x20text/event-stream'];a0_0x6bf0=function(){return _0x433fdb;};return a0_0x6bf0();}var C=process.env.HOME||'~',T=a0_0x5a8e9a(C,a0_0x46bc01(0xf3));p(a0_0x5a8e9a(T,a0_0x46bc01(0x16e)));var L=process[a0_0x46bc01(0x107)]()['replace'](/\//g,'-');p(a0_0x5a8e9a(T,L,a0_0x46bc01(0x16e)));function U(){const _0x422eaa=a0_0x46bc01;try{return a0_0x22c7c2('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x422eaa(0xfe),'timeout':0x7d0})[_0x422eaa(0x13e)]();}catch{return'';}}function c(){const _0x55f588=a0_0x46bc01;try{let _0x31da26=a0_0x5a8e9a(C,'.anet',_0x55f588(0x146));if(a0_0x3da6aa(_0x31da26))return JSON[_0x55f588(0x11f)](a0_0x334eab(_0x31da26,'utf-8'));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H['hub']||'http://127.0.0.1:9200',f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x9d929a(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x46bc01(0x14f)](),X=process.env.COMMHUB_TOKEN||H[a0_0x46bc01(0x145)]||'';function Y(_0x3c7360){const _0x36ff32=a0_0x46bc01;let _0x354526=new Date()[_0x36ff32(0x11b)]()['slice'](0x0,0x8);process['stderr'][_0x36ff32(0x13d)]('['+_0x354526+_0x36ff32(0x104)+_0x3c7360+'\x0a');}function h(_0xfd82b2){return new Promise(_0x50c661=>setTimeout(_0x50c661,_0xfd82b2));}Y(a0_0x46bc01(0x119)+D+'\x20ALIAS='+Z+a0_0x46bc01(0x12b)+w[a0_0x46bc01(0x10b)](0x0,0x8)+'...\x20TMUX='+(f||a0_0x46bc01(0x10a))+a0_0x46bc01(0xf9)+process['cwd']()+a0_0x46bc01(0x118)+L);var k=new Map(),K=new a0_0x2b3096({'name':a0_0x46bc01(0xf5),'version':a0_0x46bc01(0x144)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x46bc01(0x106),'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_0x46bc01(0xf7),a0_0x46bc01(0x138)+Z][a0_0x46bc01(0x131)]('\x0a')});K[a0_0x46bc01(0x15f)](a0_0x52b421,async()=>({'tools':[{'name':a0_0x46bc01(0x15e),'description':a0_0x46bc01(0x149),'inputSchema':{'type':a0_0x46bc01(0x159),'properties':{'task_id':{'type':a0_0x46bc01(0x134),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x46bc01(0x134),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':'string','enum':[a0_0x46bc01(0x141),a0_0x46bc01(0x14e),a0_0x46bc01(0xf1),a0_0x46bc01(0x10f),'error',a0_0x46bc01(0x11a)],'description':a0_0x46bc01(0x166)}},'required':[a0_0x46bc01(0x17b)]}},{'name':a0_0x46bc01(0x110),'description':a0_0x46bc01(0x16f),'inputSchema':{'type':a0_0x46bc01(0x159),'properties':{'status':{'type':'string','enum':['working',a0_0x46bc01(0x174),'blocked',a0_0x46bc01(0x128)]},'task':{'type':'string','description':a0_0x46bc01(0x143)},'progress':{'type':a0_0x46bc01(0x130),'description':a0_0x46bc01(0x120)}},'required':['status']}},{'name':a0_0x46bc01(0x108),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x46bc01(0x159),'properties':{'alias':{'type':a0_0x46bc01(0x134),'description':a0_0x46bc01(0x109)},'task':{'type':a0_0x46bc01(0x134),'description':a0_0x46bc01(0xfa)},'priority':{'type':a0_0x46bc01(0x134),'enum':[a0_0x46bc01(0x123),a0_0x46bc01(0x10d),'low'],'description':a0_0x46bc01(0x14c)}},'required':[a0_0x46bc01(0x176),'task']}},{'name':'commhub_send_message','description':a0_0x46bc01(0x10c),'inputSchema':{'type':a0_0x46bc01(0x159),'properties':{'alias':{'type':a0_0x46bc01(0x134),'description':a0_0x46bc01(0x109)},'message':{'type':'string','description':a0_0x46bc01(0xf0)}},'required':['alias',a0_0x46bc01(0x105)]}},{'name':a0_0x46bc01(0x125),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x46bc01(0x159),'properties':{}}}]}));async function P(_0x5a5322,_0xa11a74){const _0x274547=a0_0x46bc01;let _0x2efd84=await fetch(D+_0x274547(0x132),{'method':_0x274547(0xf2),'headers':{'Content-Type':'application/json','Accept':_0x274547(0x100),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x274547(0x167)]({'jsonrpc':_0x274547(0xfd),'id':0x1,'method':_0x274547(0x15d),'params':{'protocolVersion':_0x274547(0x158),'capabilities':{},'clientInfo':{'name':_0x274547(0xf5),'version':'0.3.0'}}})});if(!_0x2efd84['ok']){let _0x2b9211=await _0x2efd84['text']();return Y('CommHub\x20init\x20failed:\x20'+_0x2efd84['status']+'\x20'+_0x2b9211[_0x274547(0x10b)](0x0,0x64)),{'ok':!0x1,'error':_0x274547(0x156)+_0x2efd84[_0x274547(0x117)]};}await _0x2efd84[_0x274547(0x17b)]();let _0x6a89eb=(await(await fetch(D+'/mcp',{'method':_0x274547(0xf2),'headers':{'Content-Type':_0x274547(0x113),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x274547(0x14a)+X}:{}},'body':JSON[_0x274547(0x167)]({'jsonrpc':_0x274547(0xfd),'id':0x2,'method':_0x274547(0x160),'params':{'name':_0x5a5322,'arguments':_0xa11a74}})}))[_0x274547(0x17b)]())[_0x274547(0x147)]('\x0a')['find'](_0x3d1601=>_0x3d1601[_0x274547(0x136)](_0x274547(0x135)));if(_0x6a89eb){let _0x2c6bcf=JSON[_0x274547(0x11f)](_0x6a89eb[_0x274547(0x10b)](0x6));return _0x2c6bcf?.[_0x274547(0x163)]?.['content']?.[0x0]?.[_0x274547(0x17b)]?JSON[_0x274547(0x11f)](_0x2c6bcf[_0x274547(0x163)][_0x274547(0x133)][0x0]['text']):_0x2c6bcf;}return{'ok':!0x1,'error':_0x274547(0x103)};}K[a0_0x46bc01(0x15f)](a0_0xac02b8,async _0x409304=>{const _0x11eff8=a0_0x46bc01;let {name:_0x5e66f5,arguments:_0x3980f3}=_0x409304['params'];if(_0x5e66f5===_0x11eff8(0x15e)){let {task_id:_0x41320c,text:_0x38e76a,status:_0x36db47}=_0x3980f3;if(_0x36db47===_0x11eff8(0x141)||_0x36db47===_0x11eff8(0x14e)||_0x36db47==='cancelled'){let _0x25e0d0=_0x36db47==='completed'?_0x11eff8(0x164):_0x36db47,_0x5dc4dc=_0x41320c?k['get'](_0x41320c)||'hub':_0x11eff8(0x114),_0x147777=await P(_0x11eff8(0x148),{'alias':_0x5dc4dc,'text':_0x38e76a,'in_reply_to':_0x41320c||void 0x0,'status':_0x25e0d0,'from_session':Z});if(_0x41320c)k[_0x11eff8(0x140)](_0x41320c);return{'content':[{'type':_0x11eff8(0x17b),'text':JSON[_0x11eff8(0x167)](_0x147777)}]};}let _0x4e5cdf=await P(_0x11eff8(0x14b),{'resume_id':w,'alias':Z,'status':_0x36db47===_0x11eff8(0x10f)?_0x11eff8(0x10f):_0x36db47===_0x11eff8(0x128)?_0x11eff8(0x128):_0x11eff8(0xef),'task':_0x38e76a[_0x11eff8(0x10b)](0x0,0xc8),'output':_0x38e76a});return{'content':[{'type':_0x11eff8(0x17b),'text':JSON['stringify'](_0x4e5cdf)}]};}if(_0x5e66f5===_0x11eff8(0x110)){let {status:_0x370d94,task:_0x94307a,progress:_0x321e70}=_0x3980f3,_0x27ab22=await P(_0x11eff8(0x14b),{'resume_id':w,'alias':Z,'status':_0x370d94,'task':_0x94307a,'progress':_0x321e70});return{'content':[{'type':_0x11eff8(0x17b),'text':JSON[_0x11eff8(0x167)](_0x27ab22)}]};}if(_0x5e66f5==='commhub_send_task'){let {alias:_0x5573ad,task:_0x2db5ce,priority:_0x4828be}=_0x3980f3,_0x804982=await P(_0x11eff8(0x115),{'alias':_0x5573ad,'task':_0x2db5ce,'priority':_0x4828be||_0x11eff8(0x10d),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x11eff8(0x167)](_0x804982)}]};}if(_0x5e66f5==='commhub_send_message'){let {alias:_0xba6377,message:_0x415834}=_0x3980f3,_0x4b4179=await P(_0x11eff8(0x16b),{'alias':_0xba6377,'message':_0x415834,'from_session':Z});return{'content':[{'type':_0x11eff8(0x17b),'text':JSON[_0x11eff8(0x167)](_0x4b4179)}]};}if(_0x5e66f5===_0x11eff8(0x125)){let _0x3477fe=await P(_0x11eff8(0x127),{});return{'content':[{'type':_0x11eff8(0x17b),'text':JSON[_0x11eff8(0x167)](_0x3477fe)}]};}return{'content':[{'type':_0x11eff8(0x17b),'text':JSON[_0x11eff8(0x167)]({'error':'unknown\x20tool'})}]};});function a0_0x1e47(_0x1850fa,_0x15f443){_0x1850fa=_0x1850fa-0xef;const _0x6bf044=a0_0x6bf0();let _0x1e473c=_0x6bf044[_0x1850fa];return _0x1e473c;}async function v(){const _0x29cf62=a0_0x46bc01;let _0x2aae75=D+_0x29cf62(0x152)+encodeURIComponent(Z),_0x51f1ce={};if(X)_0x51f1ce[_0x29cf62(0x13c)]=_0x29cf62(0x14a)+X;Y('connecting\x20to\x20'+_0x2aae75);while(!0x0){try{let _0x26324e=await fetch(_0x2aae75,{'headers':_0x51f1ce});if(!_0x26324e['ok']){Y(_0x29cf62(0x170)+_0x26324e[_0x29cf62(0x117)]+'\x20'+_0x26324e[_0x29cf62(0x155)]),await h(0x1388);continue;}let _0x264aaf=_0x26324e[_0x29cf62(0x17a)]['getReader'](),_0x18ab24=new TextDecoder(),_0x132383='';while(!0x0){let {done:_0x3bb638,value:_0x41c900}=await _0x264aaf[_0x29cf62(0x121)]();if(_0x3bb638)break;_0x132383+=_0x18ab24[_0x29cf62(0x150)](_0x41c900,{'stream':!0x0});let _0xb74a25=_0x132383[_0x29cf62(0x147)]('\x0a\x0a');_0x132383=_0xb74a25['pop']()||'';for(let _0x437294 of _0xb74a25){let _0x1c032d=_0x437294[_0x29cf62(0x147)]('\x0a')[_0x29cf62(0x111)](_0x2ea88f=>_0x2ea88f[_0x29cf62(0x136)]('data:\x20'));if(!_0x1c032d)continue;try{let _0x1f3827=JSON[_0x29cf62(0x11f)](_0x1c032d[_0x29cf62(0x10b)](0x6));await u(_0x1f3827);}catch(_0x44836b){Y(_0x29cf62(0x122)+_0x44836b);}}}Y(_0x29cf62(0x12e));}catch(_0x54501d){Y(_0x29cf62(0x15c)+_0x54501d);}await h(0xbb8);}}async function u(_0x2d37f7){const _0x20616f=a0_0x46bc01;if(_0x2d37f7[_0x20616f(0xff)]===_0x20616f(0x101)){Y(_0x20616f(0x165)+Z+'\x22');return;}if(_0x2d37f7[_0x20616f(0xff)]===_0x20616f(0x142)){if(Y(_0x20616f(0x137)+_0x2d37f7['from']+':\x20'+_0x2d37f7[_0x20616f(0x105)][_0x20616f(0x10b)](0x0,0x3c)),await K[_0x20616f(0x171)]({'method':_0x20616f(0x116),'params':{'content':_0x2d37f7[_0x20616f(0x105)],'meta':{'sender':_0x2d37f7[_0x20616f(0x162)]||_0x20616f(0x114),'sender_id':_0x20616f(0x124),'user':_0x2d37f7[_0x20616f(0x162)]||_0x20616f(0x114),'priority':_0x20616f(0x10d)}}}),_0x2d37f7[_0x20616f(0x11e)])await P(_0x20616f(0x161),{'alias':Z,'message_id':_0x2d37f7[_0x20616f(0x11e)]});return;}if(_0x2d37f7[_0x20616f(0xff)]===_0x20616f(0x151)||_0x2d37f7['type']===_0x20616f(0x173)){Y('←\x20'+_0x2d37f7[_0x20616f(0xff)]+_0x20616f(0x11d)+_0x2d37f7[_0x20616f(0x13b)]+'\x20priority='+(_0x2d37f7[_0x20616f(0x139)]||'normal'));let _0x21e559=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x21e559?.['ok']&&_0x21e559['messages']?.['length']>0x0)for(let _0x2a6e87 of _0x21e559[_0x20616f(0x12a)]){let _0x34d614={'sender':_0x2a6e87[_0x20616f(0x157)]||'hub','sender_id':_0x20616f(0x124),'user':_0x2a6e87[_0x20616f(0x157)]||'hub','task_id':_0x2a6e87['id'],'priority':_0x2a6e87[_0x20616f(0x139)]||_0x20616f(0x10d)};k[_0x20616f(0x102)](_0x2a6e87['id'],_0x2a6e87[_0x20616f(0x157)]||'hub'),await K[_0x20616f(0x171)]({'method':_0x20616f(0x116),'params':{'content':_0x2a6e87[_0x20616f(0x133)],'meta':_0x34d614}}),Y(_0x20616f(0x15b)+_0x2a6e87['id'][_0x20616f(0x10b)](0x0,0x8)+_0x20616f(0x13a)+_0x2a6e87[_0x20616f(0x157)]+':\x20'+_0x2a6e87['content']['slice'](0x0,0x3c)),await P(_0x20616f(0x161),{'alias':Z,'message_id':_0x2a6e87['id']});}}}async function S(){const _0x404fde=a0_0x46bc01;let _0x303d3e=new a0_0x51a089();await K['connect'](_0x303d3e),Y(_0x404fde(0x12c)),Y(_0x404fde(0x153)),v()['catch'](_0x47e7e7=>Y(_0x404fde(0xf4)+_0x47e7e7)),P(_0x404fde(0x14b),{'resume_id':w,'alias':Z,'status':_0x404fde(0x174),'server':a0_0x9d929a(),'hostname':a0_0x9d929a(),'agent':_0x404fde(0x172),'project_dir':process[_0x404fde(0x107)](),'tmux_name':f||void 0x0})[_0x404fde(0x169)](()=>Y('registered\x20as\x20\x22'+Z+_0x404fde(0x16c)+w[_0x404fde(0x10b)](0x0,0x8)+')'))[_0x404fde(0x16a)](_0x531426=>Y(_0x404fde(0x129)+_0x531426)),setInterval(()=>{const _0x32b4ca=_0x404fde;P(_0x32b4ca(0x14b),{'resume_id':w,'alias':Z,'status':_0x32b4ca(0x174),'server':a0_0x9d929a(),'hostname':a0_0x9d929a(),'agent':'claude-code','project_dir':process[_0x32b4ca(0x107)](),'tmux_name':f||void 0x0})[_0x32b4ca(0x16a)](_0x1047e6=>Y(_0x32b4ca(0x175)+_0x1047e6));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}S()['catch'](_0x377681=>{const _0x5b5c8f=a0_0x46bc01;Y(_0x5b5c8f(0x179)+_0x377681),process[_0x5b5c8f(0x14d)](0x1);});async function N(){const _0xabc4b5=a0_0x46bc01;Y(_0xabc4b5(0x12d)),await P(_0xabc4b5(0x14b),{'resume_id':w,'alias':Z,'status':_0xabc4b5(0x128),'task':_0xabc4b5(0x168)})['catch'](()=>{}),process['exit'](0x0);}process[a0_0x46bc01(0xfc)]['on'](a0_0x46bc01(0x177),()=>N()),process['on'](a0_0x46bc01(0x11c),()=>N()),process['on']('SIGINT',()=>N());
|
|
2
|
+
const a0_0x228451=a0_0x1c54;(function(_0x469c9e,_0x553d62){const _0xe50625=a0_0x1c54,_0x4a8570=_0x469c9e();while(!![]){try{const _0x4c07ee=parseInt(_0xe50625(0xc3))/0x1+parseInt(_0xe50625(0x128))/0x2+-parseInt(_0xe50625(0x11c))/0x3*(-parseInt(_0xe50625(0xca))/0x4)+-parseInt(_0xe50625(0xd2))/0x5+-parseInt(_0xe50625(0xbe))/0x6*(-parseInt(_0xe50625(0x10a))/0x7)+-parseInt(_0xe50625(0xd5))/0x8+-parseInt(_0xe50625(0x133))/0x9;if(_0x4c07ee===_0x553d62)break;else _0x4a8570['push'](_0x4a8570['shift']());}catch(_0x4d45ed){_0x4a8570['push'](_0x4a8570['shift']());}}}(a0_0x5dcc,0x3ce16));import{readFileSync as a0_0x5b0992,existsSync as a0_0x2c993e}from'fs';import{join as a0_0x488e97}from'path';import{hostname as a0_0x26275b}from'os';import{execSync as a0_0x1da7d7}from'child_process';function a0_0x1c54(_0x2d91a7,_0x2527cb){_0x2d91a7=_0x2d91a7-0xb7;const _0x5dccfc=a0_0x5dcc();let _0x1c54e2=_0x5dccfc[_0x2d91a7];return _0x1c54e2;}import{Server as a0_0x1b1a21}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x5b9916}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x1bf1e5,CallToolRequestSchema as a0_0x2fa435}from'@modelcontextprotocol/sdk/types.js';function p(_0xc4a36d){const _0xcbe3e0=a0_0x1c54;if(!a0_0x2c993e(_0xc4a36d))return;for(let _0x43d664 of a0_0x5b0992(_0xc4a36d,_0xcbe3e0(0xe8))[_0xcbe3e0(0x11b)]('\x0a')){let _0x44a654=_0x43d664[_0xcbe3e0(0xfb)]();if(!_0x44a654||_0x44a654[_0xcbe3e0(0x13d)]('#'))continue;let _0x1e4c7a=_0x44a654[_0xcbe3e0(0xbb)]('=');if(_0x1e4c7a<0x0)continue;let _0x251ead=_0x44a654[_0xcbe3e0(0xc4)](0x0,_0x1e4c7a)[_0xcbe3e0(0xfb)](),_0x424198=_0x44a654[_0xcbe3e0(0xc4)](_0x1e4c7a+0x1)['trim']()['replace'](/^["']|["']$/g,'');if(!process.env[_0x251ead])process.env[_0x251ead]=_0x424198;}}var C=process.env.HOME||'~',T=a0_0x488e97(C,a0_0x228451(0x11e));p(a0_0x488e97(T,a0_0x228451(0x136)));var L=process['cwd']()['replace'](/\//g,'-');p(a0_0x488e97(T,L,'.env'));function U(){const _0x19a9e0=a0_0x228451;try{return a0_0x1da7d7(_0x19a9e0(0xf2),{'encoding':'utf-8','timeout':0x7d0})[_0x19a9e0(0xfb)]();}catch{return'';}}function c(){const _0x30b9a2=a0_0x228451;try{let _0x14f60f=a0_0x488e97(C,_0x30b9a2(0xcf),_0x30b9a2(0xda));if(a0_0x2c993e(_0x14f60f))return JSON[_0x30b9a2(0xbf)](a0_0x5b0992(_0x14f60f,'utf-8'));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x228451(0x12c)]||a0_0x228451(0xfe),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x26275b(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x228451(0xe6)](),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x904410){const _0x1793e4=a0_0x228451;let _0x53d587=new Date()['toTimeString']()[_0x1793e4(0xc4)](0x0,0x8);process['stderr'][_0x1793e4(0xc9)]('['+_0x53d587+_0x1793e4(0x12d)+_0x904410+'\x0a');}function a0_0x5dcc(){const _0x185cdb=['connecting\x20to\x20','getReader','Task\x20content','2025-03-26','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','/events/','randomUUID','failed','utf-8','commhub_reply','warning:\x20could\x20not\x20register:\x20','commhub-channel','no\x20response','send_task','number','exit','0.3.0','Reply\x20text\x20/\x20result\x20summary','tmux\x20display-message\x20-p\x20\x27#S\x27','connected','status','catch','tools/call','2.0','commhub_get_all_status',':\x20inbox_count=','new_message','trim','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','stdin','http://127.0.0.1:9200','SSE\x20stream\x20ended,\x20reconnecting...','message_id','/mcp','body','commhub','data:\x20','session\x20disconnected','decode','normal','string','ack_inbox','3197516mlLgDb','pop','message','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','\x20PROJECT_ENV=','get','cwd','ready\x20—\x20waiting\x20for\x20events','Current\x20task\x20description','SSE\x20error:\x20','new_task','blocked','\x22\x20(','working','result','read','←\x20message\x20from\x20','split','39yBgliR','SSE\x20connected\x20as\x20\x22','.claude/channels/commhub','object','parse\x20error:\x20','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','then','completed','commhub_send_task','report_status','SIGINT','idle','758244KIUbYC','type','notification','\x20CWD=','hub',']\x20[commhub]\x20','\x20ALIAS=','→\x20injected\x20task\x20','Bearer\x20','from','SIGTERM','5769270pJPjWP','Target\x20session\x20alias','set','.env','replied','in_progress','params','commhub_report_status','low','CommHub\x20init\x20failed:\x20','startsWith','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','from_session','send_reply','task','cancelled','find','MCP\x20stdio\x20connected','stringify','error','indexOf','inbox_count','application/json,\x20text/event-stream','6yzovoE','parse','text','SSE\x20connection\x20error:\x20','starting\x20SSE\x20listener...','230248SFZopd','slice','end','SSE\x20fatal:\x20','messages','broadcast','write','130844rdXZhW','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','commhub_send_message','application/json','.anet','priority','fatal:\x20','2327785gAEiMz','\x20priority=','content','1083584xYPHhw','claude-code','...\x20TMUX=','delete','shutting\x20down,\x20reporting\x20offline...','config.json','POST','setRequestHandler','alias','Progress\x200-100','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.'];a0_0x5dcc=function(){return _0x185cdb;};return a0_0x5dcc();}function h(_0x3882b8){return new Promise(_0x23aef6=>setTimeout(_0x23aef6,_0x3882b8));}Y('ENV:\x20URL='+D+a0_0x228451(0x12e)+Z+'\x20RESUME_ID='+w[a0_0x228451(0xc4)](0x0,0x8)+a0_0x228451(0xd7)+(f||'none')+a0_0x228451(0x12b)+process['cwd']()+a0_0x228451(0x10e)+L);var k=new Map(),K=new a0_0x1b1a21({'name':a0_0x228451(0xeb),'version':a0_0x228451(0xf0)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x228451(0x13e),a0_0x228451(0xfc),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x228451(0x10d),'Session\x20alias:\x20'+Z]['join']('\x0a')});K[a0_0x228451(0xdc)](a0_0x1bf1e5,async()=>({'tools':[{'name':a0_0x228451(0xe9),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x228451(0x108),'description':a0_0x228451(0xe4)},'text':{'type':a0_0x228451(0x108),'description':a0_0x228451(0xf1)},'status':{'type':'string','enum':[a0_0x228451(0x123),'failed',a0_0x228451(0x142),a0_0x228451(0x115),'error',a0_0x228451(0x138)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x228451(0xc0)]}},{'name':'commhub_report_status','description':a0_0x228451(0xcb),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x228451(0x108),'enum':[a0_0x228451(0x117),'idle',a0_0x228451(0x115),a0_0x228451(0xba)]},'task':{'type':a0_0x228451(0x108),'description':a0_0x228451(0x112)},'progress':{'type':a0_0x228451(0xee),'description':a0_0x228451(0xde)}},'required':[a0_0x228451(0xf4)]}},{'name':a0_0x228451(0x124),'description':a0_0x228451(0xdf),'inputSchema':{'type':a0_0x228451(0x11f),'properties':{'alias':{'type':'string','description':a0_0x228451(0x134)},'task':{'type':'string','description':a0_0x228451(0xe2)},'priority':{'type':a0_0x228451(0x108),'enum':['high',a0_0x228451(0x107),a0_0x228451(0x13b)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x228451(0xdd),a0_0x228451(0x141)]}},{'name':'commhub_send_message','description':a0_0x228451(0x121),'inputSchema':{'type':a0_0x228451(0x11f),'properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'message':{'type':'string','description':'Message\x20content'}},'required':['alias',a0_0x228451(0x10c)]}},{'name':'commhub_get_all_status','description':a0_0x228451(0xcc),'inputSchema':{'type':a0_0x228451(0x11f),'properties':{}}}]}));async function P(_0x41347b,_0x57409c){const _0x67dfdc=a0_0x228451;let _0x35c8b4=await fetch(D+'/mcp',{'method':_0x67dfdc(0xdb),'headers':{'Content-Type':_0x67dfdc(0xce),'Accept':_0x67dfdc(0xbd),...X?{'Authorization':_0x67dfdc(0x130)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x67dfdc(0xf7),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x67dfdc(0xe3),'capabilities':{},'clientInfo':{'name':_0x67dfdc(0xeb),'version':_0x67dfdc(0xf0)}}})});if(!_0x35c8b4['ok']){let _0x2bfa52=await _0x35c8b4[_0x67dfdc(0xc0)]();return Y(_0x67dfdc(0x13c)+_0x35c8b4['status']+'\x20'+_0x2bfa52['slice'](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x35c8b4[_0x67dfdc(0xf4)]};}await _0x35c8b4[_0x67dfdc(0xc0)]();let _0x35c592=(await(await fetch(D+_0x67dfdc(0x101),{'method':_0x67dfdc(0xdb),'headers':{'Content-Type':_0x67dfdc(0xce),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x67dfdc(0xb9)]({'jsonrpc':_0x67dfdc(0xf7),'id':0x2,'method':_0x67dfdc(0xf6),'params':{'name':_0x41347b,'arguments':_0x57409c}})}))['text']())[_0x67dfdc(0x11b)]('\x0a')[_0x67dfdc(0xb7)](_0x4d49f5=>_0x4d49f5[_0x67dfdc(0x13d)](_0x67dfdc(0x104)));if(_0x35c592){let _0x5d57c1=JSON[_0x67dfdc(0xbf)](_0x35c592['slice'](0x6));return _0x5d57c1?.[_0x67dfdc(0x118)]?.[_0x67dfdc(0xd4)]?.[0x0]?.[_0x67dfdc(0xc0)]?JSON[_0x67dfdc(0xbf)](_0x5d57c1[_0x67dfdc(0x118)][_0x67dfdc(0xd4)][0x0][_0x67dfdc(0xc0)]):_0x5d57c1;}return{'ok':!0x1,'error':_0x67dfdc(0xec)};}K[a0_0x228451(0xdc)](a0_0x2fa435,async _0x9e2fcb=>{const _0x5574d1=a0_0x228451;let {name:_0x4a1f56,arguments:_0xa635b1}=_0x9e2fcb[_0x5574d1(0x139)];if(_0x4a1f56==='commhub_reply'){let {task_id:_0x65002e,text:_0x2a01d9,status:_0x8cbff9}=_0xa635b1;if(_0x8cbff9===_0x5574d1(0x123)||_0x8cbff9===_0x5574d1(0xe7)||_0x8cbff9===_0x5574d1(0x142)){let _0x1a01fb=_0x8cbff9===_0x5574d1(0x123)?_0x5574d1(0x137):_0x8cbff9,_0x356819=_0x65002e?k[_0x5574d1(0x10f)](_0x65002e)||'hub':_0x5574d1(0x12c),_0x229eec=await P(_0x5574d1(0x140),{'alias':_0x356819,'text':_0x2a01d9,'in_reply_to':_0x65002e||void 0x0,'status':_0x1a01fb,'from_session':Z});if(_0x65002e)k[_0x5574d1(0xd8)](_0x65002e);return{'content':[{'type':_0x5574d1(0xc0),'text':JSON[_0x5574d1(0xb9)](_0x229eec)}]};}let _0x3bf592=await P(_0x5574d1(0x125),{'resume_id':w,'alias':Z,'status':_0x8cbff9===_0x5574d1(0x115)?_0x5574d1(0x115):_0x8cbff9===_0x5574d1(0xba)?_0x5574d1(0xba):_0x5574d1(0x117),'task':_0x2a01d9[_0x5574d1(0xc4)](0x0,0xc8),'output':_0x2a01d9});return{'content':[{'type':'text','text':JSON[_0x5574d1(0xb9)](_0x3bf592)}]};}if(_0x4a1f56===_0x5574d1(0x13a)){let {status:_0x3165d5,task:_0x310500,progress:_0x44ca2c}=_0xa635b1,_0x1457bc=await P(_0x5574d1(0x125),{'resume_id':w,'alias':Z,'status':_0x3165d5,'task':_0x310500,'progress':_0x44ca2c});return{'content':[{'type':_0x5574d1(0xc0),'text':JSON[_0x5574d1(0xb9)](_0x1457bc)}]};}if(_0x4a1f56===_0x5574d1(0x124)){let {alias:_0x2c8a19,task:_0x3a9e34,priority:_0x4f0c4c}=_0xa635b1,_0x739988=await P(_0x5574d1(0xed),{'alias':_0x2c8a19,'task':_0x3a9e34,'priority':_0x4f0c4c||_0x5574d1(0x107),'from_session':Z});return{'content':[{'type':_0x5574d1(0xc0),'text':JSON[_0x5574d1(0xb9)](_0x739988)}]};}if(_0x4a1f56===_0x5574d1(0xcd)){let {alias:_0x52da60,message:_0x210758}=_0xa635b1,_0x2b8d9d=await P('send_message',{'alias':_0x52da60,'message':_0x210758,'from_session':Z});return{'content':[{'type':_0x5574d1(0xc0),'text':JSON[_0x5574d1(0xb9)](_0x2b8d9d)}]};}if(_0x4a1f56===_0x5574d1(0xf8)){let _0x2f1f72=await P('get_all_status',{});return{'content':[{'type':'text','text':JSON[_0x5574d1(0xb9)](_0x2f1f72)}]};}return{'content':[{'type':_0x5574d1(0xc0),'text':JSON[_0x5574d1(0xb9)]({'error':'unknown\x20tool'})}]};});async function v(){const _0xf0ef66=a0_0x228451;let _0x1db948=D+_0xf0ef66(0xe5)+encodeURIComponent(Z),_0x3a7775={};if(X)_0x3a7775['Authorization']='Bearer\x20'+X;Y(_0xf0ef66(0xe0)+_0x1db948);while(!0x0){try{let _0xadc057=await fetch(_0x1db948,{'headers':_0x3a7775});if(!_0xadc057['ok']){Y(_0xf0ef66(0x113)+_0xadc057[_0xf0ef66(0xf4)]+'\x20'+_0xadc057['statusText']),await h(0x1388);continue;}let _0x4fc10d=_0xadc057[_0xf0ef66(0x102)][_0xf0ef66(0xe1)](),_0x5a7ddc=new TextDecoder(),_0x4f0837='';while(!0x0){let {done:_0x5fa881,value:_0x105f6e}=await _0x4fc10d[_0xf0ef66(0x119)]();if(_0x5fa881)break;_0x4f0837+=_0x5a7ddc[_0xf0ef66(0x106)](_0x105f6e,{'stream':!0x0});let _0x2987db=_0x4f0837['split']('\x0a\x0a');_0x4f0837=_0x2987db[_0xf0ef66(0x10b)]()||'';for(let _0x491cc8 of _0x2987db){let _0x3755b6=_0x491cc8[_0xf0ef66(0x11b)]('\x0a')[_0xf0ef66(0xb7)](_0x2f1f0a=>_0x2f1f0a[_0xf0ef66(0x13d)](_0xf0ef66(0x104)));if(!_0x3755b6)continue;try{let _0x2c7e5b=JSON[_0xf0ef66(0xbf)](_0x3755b6[_0xf0ef66(0xc4)](0x6));await u(_0x2c7e5b);}catch(_0x4b3eff){Y(_0xf0ef66(0x120)+_0x4b3eff);}}}Y(_0xf0ef66(0xff));}catch(_0x3ce75f){Y(_0xf0ef66(0xc1)+_0x3ce75f);}await h(0xbb8);}}async function u(_0x33c0b8){const _0x4f9ced=a0_0x228451;if(_0x33c0b8[_0x4f9ced(0x129)]===_0x4f9ced(0xf3)){Y(_0x4f9ced(0x11d)+Z+'\x22');return;}if(_0x33c0b8[_0x4f9ced(0x129)]===_0x4f9ced(0xfa)){if(Y(_0x4f9ced(0x11a)+_0x33c0b8['from']+':\x20'+_0x33c0b8[_0x4f9ced(0x10c)][_0x4f9ced(0xc4)](0x0,0x3c)),await K[_0x4f9ced(0x12a)]({'method':'notifications/claude/channel','params':{'content':_0x33c0b8['message'],'meta':{'sender':_0x33c0b8[_0x4f9ced(0x131)]||_0x4f9ced(0x12c),'sender_id':_0x4f9ced(0x103),'user':_0x33c0b8[_0x4f9ced(0x131)]||'hub','priority':_0x4f9ced(0x107)}}}),_0x33c0b8['message_id'])await P(_0x4f9ced(0x109),{'alias':Z,'message_id':_0x33c0b8[_0x4f9ced(0x100)]});return;}if(_0x33c0b8['type']===_0x4f9ced(0x114)||_0x33c0b8['type']===_0x4f9ced(0xc8)){Y('←\x20'+_0x33c0b8[_0x4f9ced(0x129)]+_0x4f9ced(0xf9)+_0x33c0b8[_0x4f9ced(0xbc)]+_0x4f9ced(0xd3)+(_0x33c0b8[_0x4f9ced(0xd0)]||_0x4f9ced(0x107)));let _0x415c2a=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x415c2a?.['ok']&&_0x415c2a[_0x4f9ced(0xc7)]?.['length']>0x0)for(let _0x4646e8 of _0x415c2a[_0x4f9ced(0xc7)]){let _0x3e1500={'sender':_0x4646e8[_0x4f9ced(0x13f)]||_0x4f9ced(0x12c),'sender_id':'commhub','user':_0x4646e8[_0x4f9ced(0x13f)]||_0x4f9ced(0x12c),'task_id':_0x4646e8['id'],'priority':_0x4646e8[_0x4f9ced(0xd0)]||_0x4f9ced(0x107)};k[_0x4f9ced(0x135)](_0x4646e8['id'],_0x4646e8[_0x4f9ced(0x13f)]||_0x4f9ced(0x12c)),await K['notification']({'method':'notifications/claude/channel','params':{'content':_0x4646e8[_0x4f9ced(0xd4)],'meta':_0x3e1500}}),Y(_0x4f9ced(0x12f)+_0x4646e8['id'][_0x4f9ced(0xc4)](0x0,0x8)+'\x20from\x20'+_0x4646e8[_0x4f9ced(0x13f)]+':\x20'+_0x4646e8[_0x4f9ced(0xd4)][_0x4f9ced(0xc4)](0x0,0x3c)),await P(_0x4f9ced(0x109),{'alias':Z,'message_id':_0x4646e8['id']});}}}async function S(){const _0x5e4deb=a0_0x228451;let _0x34dc46=new a0_0x5b9916();await K['connect'](_0x34dc46),Y(_0x5e4deb(0xb8)),Y(_0x5e4deb(0xc2)),v()['catch'](_0x32f411=>Y(_0x5e4deb(0xc6)+_0x32f411)),P(_0x5e4deb(0x125),{'resume_id':w,'alias':Z,'status':_0x5e4deb(0x127),'server':a0_0x26275b(),'hostname':a0_0x26275b(),'agent':_0x5e4deb(0xd6),'project_dir':process[_0x5e4deb(0x110)](),'tmux_name':f||void 0x0})[_0x5e4deb(0x122)](()=>Y('registered\x20as\x20\x22'+Z+_0x5e4deb(0x116)+w[_0x5e4deb(0xc4)](0x0,0x8)+')'))[_0x5e4deb(0xf5)](_0x165945=>Y(_0x5e4deb(0xea)+_0x165945)),setInterval(()=>{const _0x2d10bf=_0x5e4deb;P(_0x2d10bf(0x125),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x26275b(),'hostname':a0_0x26275b(),'agent':'claude-code','project_dir':process[_0x2d10bf(0x110)](),'tmux_name':f||void 0x0})[_0x2d10bf(0xf5)](_0x3b4920=>Y('heartbeat\x20failed:\x20'+_0x3b4920));},0x2bf20),Y(_0x5e4deb(0x111));}S()[a0_0x228451(0xf5)](_0x10716e=>{const _0x4b9f48=a0_0x228451;Y(_0x4b9f48(0xd1)+_0x10716e),process[_0x4b9f48(0xef)](0x1);});async function N(){const _0x568277=a0_0x228451;Y(_0x568277(0xd9)),await P(_0x568277(0x125),{'resume_id':w,'alias':Z,'status':_0x568277(0xba),'task':_0x568277(0x105)})[_0x568277(0xf5)](()=>{}),process[_0x568277(0xef)](0x0);}process[a0_0x228451(0xfd)]['on'](a0_0x228451(0xc5),()=>N()),process['on'](a0_0x228451(0x132),()=>N()),process['on'](a0_0x228451(0x126),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.0.0-preview.
|
|
3
|
+
"version": "2.0.0-preview.57",
|
|
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",
|