@sleep2agi/agent-network 1.3.2 → 1.3.3
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
|
+
function a0_0x2feb(_0x48e73a,_0x58244a){_0x48e73a=_0x48e73a-0x105;const _0x246f48=a0_0x246f();let _0x2feb73=_0x246f48[_0x48e73a];return _0x2feb73;}const a0_0x37038c=a0_0x2feb;(function(_0x4bc205,_0x56a09a){const _0x4cda42=a0_0x2feb,_0xf6e982=_0x4bc205();while(!![]){try{const _0x4a5931=parseInt(_0x4cda42(0x10c))/0x1*(parseInt(_0x4cda42(0x13a))/0x2)+parseInt(_0x4cda42(0x12f))/0x3*(-parseInt(_0x4cda42(0x13d))/0x4)+-parseInt(_0x4cda42(0x152))/0x5*(parseInt(_0x4cda42(0x10a))/0x6)+-parseInt(_0x4cda42(0x154))/0x7*(parseInt(_0x4cda42(0x114))/0x8)+parseInt(_0x4cda42(0x119))/0x9+parseInt(_0x4cda42(0x10d))/0xa*(parseInt(_0x4cda42(0x15e))/0xb)+parseInt(_0x4cda42(0x15a))/0xc*(parseInt(_0x4cda42(0x115))/0xd);if(_0x4a5931===_0x56a09a)break;else _0xf6e982['push'](_0xf6e982['shift']());}catch(_0x4c41cf){_0xf6e982['push'](_0xf6e982['shift']());}}}(a0_0x246f,0x1e5b2));import{EventEmitter as a0_0x4064cf}from'events';import{hostname as a0_0x25a890}from'os';class T extends a0_0x4064cf{[a0_0x37038c(0x157)];[a0_0x37038c(0x139)];[a0_0x37038c(0x138)];[a0_0x37038c(0x151)];['resumeId'];['heartbeatInterval'];[a0_0x37038c(0x14f)];[a0_0x37038c(0x125)];['sseAbort'];['running']=!0x1;constructor(_0x15e7f6){const _0x15c2e6=a0_0x37038c;super();if(this[_0x15c2e6(0x157)]=_0x15e7f6[_0x15c2e6(0x157)][_0x15c2e6(0x140)](/\/$/,''),this[_0x15c2e6(0x139)]=_0x15e7f6[_0x15c2e6(0x139)],this['token']=_0x15e7f6[_0x15c2e6(0x138)],this[_0x15c2e6(0x151)]=_0x15e7f6[_0x15c2e6(0x151)]||_0x15c2e6(0x106),this['resumeId']='sdk-'+_0x15e7f6[_0x15c2e6(0x139)]+'-'+Date['now']()['toString'](0x24),this['heartbeatInterval']=_0x15e7f6['heartbeatInterval']??0x2bf20,this[_0x15c2e6(0x14f)]=_0x15e7f6[_0x15c2e6(0x14f)]??0xbb8,_0x15e7f6[_0x15c2e6(0x153)]!==!0x1)this[_0x15c2e6(0x13e)]();}['log'](_0x170e5c){const _0x24877e=a0_0x37038c;console[_0x24877e(0x11f)]('['+new Date()[_0x24877e(0x15c)]()[_0x24877e(0x117)](0x0,0x8)+_0x24877e(0x13c)+this[_0x24877e(0x139)]+']\x20'+_0x170e5c);}async[a0_0x37038c(0x10e)](_0x5f5ad5,_0x2ad581){const _0x22898c=a0_0x37038c;let _0x122b79={'Content-Type':_0x22898c(0x123),'Accept':'application/json,\x20text/event-stream'};if(this[_0x22898c(0x138)])_0x122b79['Authorization']=_0x22898c(0x107)+this['token'];let _0xfced41=await(await fetch(this[_0x22898c(0x157)]+_0x22898c(0x145),{'method':_0x22898c(0x113),'headers':_0x122b79,'body':JSON[_0x22898c(0x12d)]({'jsonrpc':_0x22898c(0x110),'id':Date['now'](),'method':_0x22898c(0x14e),'params':{'name':_0x5f5ad5,'arguments':_0x2ad581}})}))['text'](),_0x1da0da=_0xfced41[_0x22898c(0x135)](/data: (.+)/),_0x2ebc90=_0x1da0da?JSON['parse'](_0x1da0da[0x1]):JSON[_0x22898c(0x127)](_0xfced41),_0xa5864c=_0x2ebc90?.[_0x22898c(0x128)]?.['content']?.[0x0]?.[_0x22898c(0x122)];return _0xa5864c?JSON[_0x22898c(0x127)](_0xa5864c):_0x2ebc90;}async[a0_0x37038c(0x13e)](){const _0x4478be=a0_0x37038c;if(this[_0x4478be(0x124)])return;this[_0x4478be(0x124)]=!0x0,await this[_0x4478be(0x12a)](_0x4478be(0x11a)),this[_0x4478be(0x11f)](_0x4478be(0x116)),this[_0x4478be(0x125)]=setInterval(()=>{const _0x27ccab=_0x4478be;this[_0x27ccab(0x12a)](_0x27ccab(0x11a))[_0x27ccab(0x12b)](_0x19c6e0=>this[_0x27ccab(0x11f)]('heartbeat\x20failed:\x20'+_0x19c6e0[_0x27ccab(0x147)]));},this[_0x4478be(0x14b)]),this[_0x4478be(0x141)]();}async['disconnect'](){const _0x4bd338=a0_0x37038c;if(this[_0x4bd338(0x124)]=!0x1,this[_0x4bd338(0x108)]?.[_0x4bd338(0x14a)](),this['heartbeatTimer'])clearInterval(this['heartbeatTimer']);await this[_0x4bd338(0x12a)](_0x4bd338(0x120))['catch'](()=>{}),this[_0x4bd338(0x11f)](_0x4bd338(0x150));}async[a0_0x37038c(0x12e)](_0x5652db,_0x29f6b1,_0x3afcd8=a0_0x37038c(0x144)){const _0xecb75d=a0_0x37038c;return this['call'](_0xecb75d(0x158),{'alias':_0x5652db,'task':_0x29f6b1,'priority':_0x3afcd8,'from_session':this[_0xecb75d(0x139)]});}async[a0_0x37038c(0x147)](_0x16511e,_0x34c746){const _0x33df1a=a0_0x37038c;return this['call'](_0x33df1a(0x132),{'alias':_0x16511e,'message':_0x34c746,'from_session':this[_0x33df1a(0x139)]});}async[a0_0x37038c(0x14c)](_0x3603f6,_0x34bbd7,_0xa2f467=a0_0x37038c(0x14d)){const _0x1be251=a0_0x37038c;return this[_0x1be251(0x10e)](_0x1be251(0x14c),{'task_id':_0x3603f6,'text':_0x34bbd7,'status':_0xa2f467});}async['status'](_0x866911,_0x260101){const _0xd0050=a0_0x37038c;return this[_0xd0050(0x10e)](_0xd0050(0x118),{'resume_id':this['resumeId'],'alias':this[_0xd0050(0x139)],'status':_0x866911,'server':a0_0x25a890(),'hostname':a0_0x25a890(),'agent':this['agent'],'project_dir':process['cwd'](),..._0x260101});}async[a0_0x37038c(0x11c)](){const _0x2920b9=a0_0x37038c;return this[_0x2920b9(0x10e)]('get_all_status',{});}async[a0_0x37038c(0x10b)](_0x46bad1,_0x355da6){const _0x3b9e5b=a0_0x37038c;return this[_0x3b9e5b(0x10e)](_0x3b9e5b(0x10b),{'message':_0x46bad1,'filter_server':_0x355da6?.['server'],'filter_status':_0x355da6?.[_0x3b9e5b(0x12a)]});}async[a0_0x37038c(0x141)](){const _0x4282fe=a0_0x37038c;let _0x2d45cf=encodeURIComponent(this['alias']),_0x5ca8e7=this[_0x4282fe(0x157)]+_0x4282fe(0x105)+_0x2d45cf,_0x39a7d7=this[_0x4282fe(0x14f)];while(this[_0x4282fe(0x124)]){try{this[_0x4282fe(0x108)]=new AbortController();let _0x4d24e6={'Accept':_0x4282fe(0x10f)};if(this['token'])_0x4d24e6[_0x4282fe(0x130)]=_0x4282fe(0x107)+this['token'];let _0x44fb06=await fetch(_0x5ca8e7,{'headers':_0x4d24e6,'signal':this[_0x4282fe(0x108)][_0x4282fe(0x12c)]});if(!_0x44fb06['ok']||!_0x44fb06['body']){this[_0x4282fe(0x11f)]('SSE\x20failed:\x20'+_0x44fb06['status']),await this[_0x4282fe(0x15d)](_0x39a7d7),_0x39a7d7=Math[_0x4282fe(0x142)](_0x39a7d7*1.5,0xea60);continue;}_0x39a7d7=this[_0x4282fe(0x14f)];let _0xf07422=_0x44fb06[_0x4282fe(0x159)][_0x4282fe(0x126)](),_0x8c3e0d=new TextDecoder(),_0x4536aa='';while(this[_0x4282fe(0x124)]){let {done:_0x19b94e,value:_0x1385be}=await _0xf07422[_0x4282fe(0x11e)]();if(_0x19b94e)break;_0x4536aa+=_0x8c3e0d[_0x4282fe(0x121)](_0x1385be,{'stream':!0x0});let _0x4d1d63=_0x4536aa['split']('\x0a');_0x4536aa=_0x4d1d63[_0x4282fe(0x109)]()||'';for(let _0x57f908 of _0x4d1d63){if(!_0x57f908['startsWith'](_0x4282fe(0x156)))continue;try{let _0x884879=JSON['parse'](_0x57f908['slice'](0x6));if(_0x884879[_0x4282fe(0x146)]==='connected'){this[_0x4282fe(0x11f)](_0x4282fe(0x15b)),this[_0x4282fe(0x112)](_0x4282fe(0x137));continue;}if(_0x884879[_0x4282fe(0x146)]===_0x4282fe(0x149)||_0x884879[_0x4282fe(0x146)]===_0x4282fe(0x143)||_0x884879[_0x4282fe(0x146)]===_0x4282fe(0x10b))await this[_0x4282fe(0x134)]();}catch{}}}}catch(_0x58b8d5){if(_0x58b8d5[_0x4282fe(0x148)]===_0x4282fe(0x111))break;this[_0x4282fe(0x112)](_0x4282fe(0x136),_0x58b8d5),this['log'](_0x4282fe(0x13f)+_0x58b8d5[_0x4282fe(0x147)]);}if(this[_0x4282fe(0x124)])this[_0x4282fe(0x112)](_0x4282fe(0x150)),this[_0x4282fe(0x11f)](_0x4282fe(0x13b)+_0x39a7d7/0x3e8+_0x4282fe(0x11d)),await this['sleep'](_0x39a7d7),_0x39a7d7=Math[_0x4282fe(0x142)](_0x39a7d7*1.5,0xea60);}}async['processInbox'](){const _0x437f75=a0_0x37038c;try{let _0xeefd85=(await this[_0x437f75(0x10e)]('get_inbox',{'alias':this[_0x437f75(0x139)],'limit':0xa}))?.[_0x437f75(0x129)]||[];for(let _0x2faa10 of _0xeefd85)await this['call'](_0x437f75(0x155),{'alias':this[_0x437f75(0x139)],'message_id':_0x2faa10['id']}),this[_0x437f75(0x11f)]('←\x20'+_0x2faa10['from_session']+':\x20'+_0x2faa10[_0x437f75(0x131)][_0x437f75(0x117)](0x0,0x3c)),this['emit'](_0x437f75(0x133),_0x2faa10),this[_0x437f75(0x112)](_0x437f75(0x147),_0x2faa10);}catch(_0x4a93e8){this['log'](_0x437f75(0x11b)+_0x4a93e8[_0x437f75(0x147)]);}}[a0_0x37038c(0x15d)](_0x5078c2){return new Promise(_0x3cb973=>setTimeout(_0x3cb973,_0x5078c2));}}var $=T;export{$ as default,T as CommHub};function a0_0x246f(){const _0x5c7cd4=['77SUCTjU','/events/','sdk','Bearer\x20','sseAbort','pop','18LMcYgh','broadcast','24666vBMUGu','30610YJSLeI','call','text/event-stream','2.0','AbortError','emit','POST','16GxAezU','169gCCmpk','registered','slice','report_status','1253943RTGrRK','idle','inbox\x20error:\x20','getAllStatus','s...','read','log','offline','decode','text','application/json','running','heartbeatTimer','getReader','parse','result','messages','status','catch','signal','stringify','send','608253fieqVV','Authorization','content','send_message','task','processInbox','match','error','connected','token','alias','8xOUjNl','SSE\x20reconnecting\x20in\x20',']\x20[commhub:','4udvFif','connect','SSE\x20error:\x20','replace','connectSSE','min','new_message','normal','/mcp','type','message','name','new_task','abort','heartbeatInterval','reply','completed','tools/call','reconnectDelay','disconnected','agent','331810tzXCQA','autoConnect','404551AQZMYC','ack_inbox','data:\x20','url','send_task','body','352932ShsXJH','SSE\x20connected','toTimeString','sleep'];a0_0x246f=function(){return _0x5c7cd4;};return a0_0x246f();}
|
package/dist/src/node-server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
const a0_0x2bdfc6=a0_0x20f3;(function(_0x3c4a2c,_0x4d05ca){const _0x3f5b07=a0_0x20f3,_0x35134d=_0x3c4a2c();while(!![]){try{const _0x56c64b=-parseInt(_0x3f5b07(0xbd))/0x1+-parseInt(_0x3f5b07(0x85))/0x2+-parseInt(_0x3f5b07(0xb7))/0x3*(parseInt(_0x3f5b07(0xde))/0x4)+-parseInt(_0x3f5b07(0xfe))/0x5+-parseInt(_0x3f5b07(0xea))/0x6*(parseInt(_0x3f5b07(0xa5))/0x7)+-parseInt(_0x3f5b07(0xbc))/0x8+parseInt(_0x3f5b07(0x89))/0x9;if(_0x56c64b===_0x4d05ca)break;else _0x35134d['push'](_0x35134d['shift']());}catch(_0x5b5423){_0x35134d['push'](_0x35134d['shift']());}}}(a0_0x4dd1,0x7fc6d));import{readFileSync as a0_0x481a21,existsSync as a0_0x4fe6f5}from'fs';import{join as a0_0x409c1d}from'path';import{hostname as a0_0x19ba6e}from'os';import{execSync as a0_0x11e1ee}from'child_process';import{Server as a0_0x1fb0e6}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x4304cb}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x43a6ad,CallToolRequestSchema as a0_0x56dc42}from'@modelcontextprotocol/sdk/types.js';function h(_0x543fc5){const _0x36a909=a0_0x20f3;if(!a0_0x4fe6f5(_0x543fc5))return;for(let _0x32dee1 of a0_0x481a21(_0x543fc5,'utf-8')[_0x36a909(0xe5)]('\x0a')){let _0x195936=_0x32dee1[_0x36a909(0x98)]();if(!_0x195936||_0x195936['startsWith']('#'))continue;let _0x5265da=_0x195936[_0x36a909(0x93)]('=');if(_0x5265da<0x0)continue;let _0x3e5409=_0x195936[_0x36a909(0x9e)](0x0,_0x5265da)['trim'](),_0x1a32d9=_0x195936['slice'](_0x5265da+0x1)[_0x36a909(0x98)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x3e5409])process.env[_0x3e5409]=_0x1a32d9;}}var R=process.env.HOME||'~',p=a0_0x409c1d(R,'.claude/channels/commhub');h(a0_0x409c1d(p,a0_0x2bdfc6(0xfa)));var C=process[a0_0x2bdfc6(0x90)]()[a0_0x2bdfc6(0x8b)](/\//g,'-');h(a0_0x409c1d(p,C,'.env'));function _(){const _0x592b81=a0_0x2bdfc6;try{return a0_0x11e1ee(_0x592b81(0x99),{'encoding':'utf-8','timeout':0x7d0})['trim']();}catch{return'';}}function E(){const _0x59aabb=a0_0x2bdfc6;try{let _0x293e67=a0_0x409c1d(R,_0x59aabb(0xd3),_0x59aabb(0x80));if(a0_0x4fe6f5(_0x293e67))return JSON[_0x59aabb(0x94)](a0_0x481a21(_0x293e67,_0x59aabb(0x7e)));}catch{}return{};}var T=E(),k=process.env.COMMHUB_URL||T[a0_0x2bdfc6(0x82)]||'http://127.0.0.1:9200',q=process.env.COMMHUB_TMUX||_(),Z=process.env.COMMHUB_ALIAS||q||a0_0x19ba6e(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x2bdfc6(0xb1)](),X=process.env.COMMHUB_TOKEN||T[a0_0x2bdfc6(0x101)]||'';function V(_0x30d9eb){const _0x5ce0fa=a0_0x2bdfc6;let _0x361720=new Date()[_0x5ce0fa(0xac)]()[_0x5ce0fa(0x9e)](0x0,0x8);process[_0x5ce0fa(0x104)][_0x5ce0fa(0xca)]('['+_0x361720+_0x5ce0fa(0x100)+_0x30d9eb+'\x0a');}function O(_0x4dc911){return new Promise(_0x8f4655=>setTimeout(_0x8f4655,_0x4dc911));}function a0_0x4dd1(){const _0x2571d3=['normal','warning:\x20could\x20not\x20register:\x20','shutting\x20down,\x20reporting\x20offline...','114760NAwnMo','setRequestHandler','commhub_report_status','SIGINT','ready\x20—\x20waiting\x20for\x20events','send_message','data:\x20','split','text','join','CommHub\x20init\x20failed:\x20','MCP\x20stdio\x20connected','3354PbfphC','SSE\x20connection\x20error:\x20','notification','blocked','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','length','get_all_status','heartbeat\x20failed:\x20','0.3.0','commhub_get_all_status','application/json,\x20text/event-stream','high','/mcp','statusText','→\x20injected\x20task\x20','Current\x20task\x20description','.env','init\x20failed:\x20','exit','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','2468920igGfAW','stdin',']\x20[commhub]\x20','token','stringify',':\x20inbox_count=','stderr','utf-8','body','config.json','params','hub','priority','content','1257390sjIXHo','commhub','status','none','34287174fgGftI','\x20from\x20','replace','object','starting\x20SSE\x20listener...','claude-code','string','cwd','completed','SSE\x20fatal:\x20','indexOf','parse','2025-03-26','connecting\x20to\x20','catch','trim','tmux\x20display-message\x20-p\x20\x27#S\x27','fatal:\x20','parse\x20error:\x20','commhub_send_task','←\x20message\x20from\x20','slice','task','from_session','find','notifications/claude/channel','message','ack_inbox','11963iWgyXz','registered\x20as\x20\x22','tools/call','\x20priority=','error','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','broadcast','toTimeString','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','application/json','POST','Bearer\x20','randomUUID','Message\x20content','alias','send_task','inbox_count','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','3bHSzbh','idle','commhub_send_message','from','startsWith','2434960sFQUrt','875443ckQJds','end','Task\x20status','2.0','working','ENV:\x20URL=','type','/events/','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','pop','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','read','write','Target\x20session\x20alias','number','low','Progress\x200-100','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','commhub-channel','then','initialize','.anet','in_progress','report_status','messages','Priority\x20(default:\x20normal)','no\x20response','message_id','connect'];a0_0x4dd1=function(){return _0x2571d3;};return a0_0x4dd1();}V(a0_0x2bdfc6(0xc2)+k+'\x20ALIAS='+Z+'\x20RESUME_ID='+w[a0_0x2bdfc6(0x9e)](0x0,0x8)+'...\x20TMUX='+(q||a0_0x2bdfc6(0x88))+'\x20CWD='+process[a0_0x2bdfc6(0x90)]()+'\x20PROJECT_ENV='+C);var K=new a0_0x1fb0e6({'name':'commhub-channel','version':a0_0x2bdfc6(0xf2)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x2bdfc6(0xc5),a0_0x2bdfc6(0xad),a0_0x2bdfc6(0xc6),a0_0x2bdfc6(0xee),'Session\x20alias:\x20'+Z][a0_0x2bdfc6(0xe7)]('\x0a')});K[a0_0x2bdfc6(0xdf)](a0_0x43a6ad,async()=>({'tools':[{'name':'commhub_reply','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_0x2bdfc6(0x8f),'description':a0_0x2bdfc6(0xfd)},'text':{'type':a0_0x2bdfc6(0x8f),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x2bdfc6(0x8f),'enum':['completed',a0_0x2bdfc6(0xed),a0_0x2bdfc6(0xa9),a0_0x2bdfc6(0xd4)],'description':a0_0x2bdfc6(0xbf)}},'required':[a0_0x2bdfc6(0xe6)]}},{'name':a0_0x2bdfc6(0xe0),'description':a0_0x2bdfc6(0xaa),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x2bdfc6(0x8f),'enum':[a0_0x2bdfc6(0xc1),a0_0x2bdfc6(0xb8),a0_0x2bdfc6(0xed),a0_0x2bdfc6(0xa9)]},'task':{'type':a0_0x2bdfc6(0x8f),'description':a0_0x2bdfc6(0xf9)},'progress':{'type':a0_0x2bdfc6(0xcc),'description':a0_0x2bdfc6(0xce)}},'required':[a0_0x2bdfc6(0x87)]}},{'name':a0_0x2bdfc6(0x9c),'description':a0_0x2bdfc6(0xcf),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x2bdfc6(0x8f),'description':a0_0x2bdfc6(0xcb)},'task':{'type':'string','description':'Task\x20content'},'priority':{'type':a0_0x2bdfc6(0x8f),'enum':[a0_0x2bdfc6(0xf5),'normal',a0_0x2bdfc6(0xcd)],'description':a0_0x2bdfc6(0xd7)}},'required':['alias','task']}},{'name':a0_0x2bdfc6(0xb9),'description':a0_0x2bdfc6(0xc8),'inputSchema':{'type':a0_0x2bdfc6(0x8c),'properties':{'alias':{'type':a0_0x2bdfc6(0x8f),'description':a0_0x2bdfc6(0xcb)},'message':{'type':a0_0x2bdfc6(0x8f),'description':a0_0x2bdfc6(0xb2)}},'required':[a0_0x2bdfc6(0xb3),a0_0x2bdfc6(0xa3)]}},{'name':a0_0x2bdfc6(0xf3),'description':a0_0x2bdfc6(0xb6),'inputSchema':{'type':a0_0x2bdfc6(0x8c),'properties':{}}}]}));async function P(_0x1568f7,_0xda4d11){const _0x454983=a0_0x2bdfc6;let _0x1503a1=await fetch(k+_0x454983(0xf6),{'method':_0x454983(0xaf),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x454983(0xb0)+X}:{}},'body':JSON[_0x454983(0x102)]({'jsonrpc':_0x454983(0xc0),'id':0x1,'method':_0x454983(0xd2),'params':{'protocolVersion':_0x454983(0x95),'capabilities':{},'clientInfo':{'name':_0x454983(0xd0),'version':_0x454983(0xf2)}}})});if(!_0x1503a1['ok']){let _0x5e5888=await _0x1503a1['text']();return V(_0x454983(0xe8)+_0x1503a1[_0x454983(0x87)]+'\x20'+_0x5e5888['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x454983(0xfb)+_0x1503a1[_0x454983(0x87)]};}await _0x1503a1[_0x454983(0xe6)]();let _0x52c481=(await(await fetch(k+_0x454983(0xf6),{'method':_0x454983(0xaf),'headers':{'Content-Type':_0x454983(0xae),'Accept':_0x454983(0xf4),...X?{'Authorization':_0x454983(0xb0)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x454983(0xc0),'id':0x2,'method':_0x454983(0xa7),'params':{'name':_0x1568f7,'arguments':_0xda4d11}})}))[_0x454983(0xe6)]())[_0x454983(0xe5)]('\x0a')[_0x454983(0xa1)](_0x5ce3a5=>_0x5ce3a5[_0x454983(0xbb)]('data:\x20'));if(_0x52c481){let _0x5eb0e8=JSON[_0x454983(0x94)](_0x52c481[_0x454983(0x9e)](0x6));return _0x5eb0e8?.['result']?.[_0x454983(0x84)]?.[0x0]?.[_0x454983(0xe6)]?JSON['parse'](_0x5eb0e8['result'][_0x454983(0x84)][0x0][_0x454983(0xe6)]):_0x5eb0e8;}return{'ok':!0x1,'error':_0x454983(0xd8)};}K[a0_0x2bdfc6(0xdf)](a0_0x56dc42,async _0x5f4e1e=>{const _0x574856=a0_0x2bdfc6;let {name:_0x2a94b4,arguments:_0x18b057}=_0x5f4e1e[_0x574856(0x81)];if(_0x2a94b4==='commhub_reply'){let {task_id:_0x1badc1,text:_0x220010,status:_0x432102}=_0x18b057;if(_0x432102===_0x574856(0x91)){let _0x7910b2=await P('report_completion',{'alias':Z,'task':_0x1badc1||_0x574856(0x9f),'result':_0x220010});return{'content':[{'type':_0x574856(0xe6),'text':JSON['stringify'](_0x7910b2)}]};}let _0x2de2be=await P(_0x574856(0xd5),{'resume_id':w,'alias':Z,'status':_0x432102==='blocked'?_0x574856(0xed):_0x432102===_0x574856(0xa9)?_0x574856(0xa9):_0x574856(0xc1),'task':_0x220010[_0x574856(0x9e)](0x0,0xc8),'output':_0x220010});return{'content':[{'type':_0x574856(0xe6),'text':JSON[_0x574856(0x102)](_0x2de2be)}]};}if(_0x2a94b4===_0x574856(0xe0)){let {status:_0x81c75a,task:_0x24cd76,progress:_0x1e8b6b}=_0x18b057,_0x2afadd=await P(_0x574856(0xd5),{'resume_id':w,'alias':Z,'status':_0x81c75a,'task':_0x24cd76,'progress':_0x1e8b6b});return{'content':[{'type':'text','text':JSON[_0x574856(0x102)](_0x2afadd)}]};}if(_0x2a94b4===_0x574856(0x9c)){let {alias:_0x3e151a,task:_0x49b954,priority:_0x5413fc}=_0x18b057,_0x1065a8=await P(_0x574856(0xb4),{'alias':_0x3e151a,'task':_0x49b954,'priority':_0x5413fc||_0x574856(0xdb),'from_session':Z});return{'content':[{'type':_0x574856(0xe6),'text':JSON['stringify'](_0x1065a8)}]};}if(_0x2a94b4===_0x574856(0xb9)){let {alias:_0x13060f,message:_0x28873e}=_0x18b057,_0x3d4d42=await P(_0x574856(0xe3),{'alias':_0x13060f,'message':_0x28873e,'from_session':Z});return{'content':[{'type':_0x574856(0xe6),'text':JSON[_0x574856(0x102)](_0x3d4d42)}]};}if(_0x2a94b4==='commhub_get_all_status'){let _0xe5acba=await P(_0x574856(0xf0),{});return{'content':[{'type':'text','text':JSON[_0x574856(0x102)](_0xe5acba)}]};}return{'content':[{'type':_0x574856(0xe6),'text':JSON[_0x574856(0x102)]({'error':'unknown\x20tool'})}]};});async function c(){const _0x29ff67=a0_0x2bdfc6;let _0x454d4e=k+_0x29ff67(0xc4)+encodeURIComponent(Z),_0x2ea9bc={};if(X)_0x2ea9bc['Authorization']=_0x29ff67(0xb0)+X;V(_0x29ff67(0x96)+_0x454d4e);while(!0x0){try{let _0x59df33=await fetch(_0x454d4e,{'headers':_0x2ea9bc});if(!_0x59df33['ok']){V('SSE\x20error:\x20'+_0x59df33['status']+'\x20'+_0x59df33[_0x29ff67(0xf7)]),await O(0x1388);continue;}let _0x4b3577=_0x59df33[_0x29ff67(0x7f)]['getReader'](),_0x1a554f=new TextDecoder(),_0x1ba6ec='';while(!0x0){let {done:_0x5e9616,value:_0x26441b}=await _0x4b3577[_0x29ff67(0xc9)]();if(_0x5e9616)break;_0x1ba6ec+=_0x1a554f['decode'](_0x26441b,{'stream':!0x0});let _0x22f8da=_0x1ba6ec[_0x29ff67(0xe5)]('\x0a\x0a');_0x1ba6ec=_0x22f8da[_0x29ff67(0xc7)]()||'';for(let _0x44308b of _0x22f8da){let _0x5995a8=_0x44308b[_0x29ff67(0xe5)]('\x0a')[_0x29ff67(0xa1)](_0x486e5c=>_0x486e5c[_0x29ff67(0xbb)](_0x29ff67(0xe4)));if(!_0x5995a8)continue;try{let _0x39b74e=JSON['parse'](_0x5995a8[_0x29ff67(0x9e)](0x6));await v(_0x39b74e);}catch(_0xc1ea93){V(_0x29ff67(0x9b)+_0xc1ea93);}}}V('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x178ee1){V(_0x29ff67(0xeb)+_0x178ee1);}await O(0xbb8);}}async function v(_0x2196f2){const _0x5c07d2=a0_0x2bdfc6;if(_0x2196f2[_0x5c07d2(0xc3)]==='connected'){V('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x2196f2[_0x5c07d2(0xc3)]==='new_message'){if(V(_0x5c07d2(0x9d)+_0x2196f2[_0x5c07d2(0xba)]+':\x20'+_0x2196f2[_0x5c07d2(0xa3)][_0x5c07d2(0x9e)](0x0,0x3c)),await K[_0x5c07d2(0xec)]({'method':_0x5c07d2(0xa2),'params':{'content':_0x2196f2[_0x5c07d2(0xa3)],'meta':{'sender':_0x2196f2['from']||_0x5c07d2(0x82),'sender_id':_0x5c07d2(0x86),'user':_0x2196f2[_0x5c07d2(0xba)]||_0x5c07d2(0x82),'priority':_0x5c07d2(0xdb)}}}),_0x2196f2[_0x5c07d2(0xd9)])await P(_0x5c07d2(0xa4),{'alias':Z,'message_id':_0x2196f2[_0x5c07d2(0xd9)]});return;}if(_0x2196f2[_0x5c07d2(0xc3)]==='new_task'||_0x2196f2[_0x5c07d2(0xc3)]===_0x5c07d2(0xab)){V('←\x20'+_0x2196f2[_0x5c07d2(0xc3)]+_0x5c07d2(0x103)+_0x2196f2[_0x5c07d2(0xb5)]+_0x5c07d2(0xa8)+(_0x2196f2[_0x5c07d2(0x83)]||_0x5c07d2(0xdb)));let _0x53d25d=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x53d25d?.['ok']&&_0x53d25d[_0x5c07d2(0xd6)]?.[_0x5c07d2(0xef)]>0x0)for(let _0x194ee3 of _0x53d25d[_0x5c07d2(0xd6)]){let _0x23093f={'sender':_0x194ee3[_0x5c07d2(0xa0)]||_0x5c07d2(0x82),'sender_id':_0x5c07d2(0x86),'user':_0x194ee3[_0x5c07d2(0xa0)]||_0x5c07d2(0x82),'task_id':_0x194ee3['id'],'priority':_0x194ee3[_0x5c07d2(0x83)]||_0x5c07d2(0xdb)};await K[_0x5c07d2(0xec)]({'method':'notifications/claude/channel','params':{'content':_0x194ee3[_0x5c07d2(0x84)],'meta':_0x23093f}}),V(_0x5c07d2(0xf8)+_0x194ee3['id'][_0x5c07d2(0x9e)](0x0,0x8)+_0x5c07d2(0x8a)+_0x194ee3[_0x5c07d2(0xa0)]+':\x20'+_0x194ee3[_0x5c07d2(0x84)][_0x5c07d2(0x9e)](0x0,0x3c)),await P(_0x5c07d2(0xa4),{'alias':Z,'message_id':_0x194ee3['id']});}}}async function u(){const _0x25dae6=a0_0x2bdfc6;let _0x40e114=new a0_0x4304cb();await K[_0x25dae6(0xda)](_0x40e114),V(_0x25dae6(0xe9)),V(_0x25dae6(0x8d)),c()[_0x25dae6(0x97)](_0x3a95ce=>V(_0x25dae6(0x92)+_0x3a95ce)),P(_0x25dae6(0xd5),{'resume_id':w,'alias':Z,'status':_0x25dae6(0xb8),'server':a0_0x19ba6e(),'hostname':a0_0x19ba6e(),'agent':_0x25dae6(0x8e),'project_dir':process[_0x25dae6(0x90)](),'tmux_name':q||void 0x0})[_0x25dae6(0xd1)](()=>V(_0x25dae6(0xa6)+Z+'\x22\x20('+w[_0x25dae6(0x9e)](0x0,0x8)+')'))[_0x25dae6(0x97)](_0x5991a9=>V(_0x25dae6(0xdc)+_0x5991a9)),setInterval(()=>{const _0x425cd1=_0x25dae6;P(_0x425cd1(0xd5),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x19ba6e(),'hostname':a0_0x19ba6e(),'agent':_0x425cd1(0x8e),'project_dir':process[_0x425cd1(0x90)](),'tmux_name':q||void 0x0})[_0x425cd1(0x97)](_0x2c0b90=>V(_0x425cd1(0xf1)+_0x2c0b90));},0x2bf20),V(_0x25dae6(0xe2));}function a0_0x20f3(_0x5d1aca,_0x35fa72){_0x5d1aca=_0x5d1aca-0x7e;const _0x4dd10e=a0_0x4dd1();let _0x20f3dc=_0x4dd10e[_0x5d1aca];return _0x20f3dc;}u()[a0_0x2bdfc6(0x97)](_0x2ffe06=>{const _0x208289=a0_0x2bdfc6;V(_0x208289(0x9a)+_0x2ffe06),process[_0x208289(0xfc)](0x1);});async function f(){const _0x4f61de=a0_0x2bdfc6;V(_0x4f61de(0xdd)),await P(_0x4f61de(0xd5),{'resume_id':w,'alias':Z,'status':_0x4f61de(0xa9),'task':'session\x20disconnected'})[_0x4f61de(0x97)](()=>{}),process[_0x4f61de(0xfc)](0x0);}process[a0_0x2bdfc6(0xff)]['on'](a0_0x2bdfc6(0xbe),()=>f()),process['on']('SIGTERM',()=>f()),process['on'](a0_0x2bdfc6(0xe1),()=>f());
|
|
2
|
+
const a0_0xcfd401=a0_0x1510;(function(_0xdfe7ae,_0x96838b){const _0x1a785c=a0_0x1510,_0x4df9e2=_0xdfe7ae();while(!![]){try{const _0x1253a3=parseInt(_0x1a785c(0x119))/0x1*(-parseInt(_0x1a785c(0x111))/0x2)+parseInt(_0x1a785c(0x131))/0x3*(parseInt(_0x1a785c(0xfc))/0x4)+parseInt(_0x1a785c(0xe7))/0x5*(-parseInt(_0x1a785c(0xe9))/0x6)+-parseInt(_0x1a785c(0xd8))/0x7*(-parseInt(_0x1a785c(0x11a))/0x8)+parseInt(_0x1a785c(0x109))/0x9*(-parseInt(_0x1a785c(0x130))/0xa)+-parseInt(_0x1a785c(0xc8))/0xb+parseInt(_0x1a785c(0xee))/0xc;if(_0x1253a3===_0x96838b)break;else _0x4df9e2['push'](_0x4df9e2['shift']());}catch(_0x3c3156){_0x4df9e2['push'](_0x4df9e2['shift']());}}}(a0_0x4f67,0x1fe21));import{readFileSync as a0_0x3b720b,existsSync as a0_0x1a66c5}from'fs';import{join as a0_0xf6d1eb}from'path';import{hostname as a0_0x481b8d}from'os';function a0_0x1510(_0x19ab6f,_0x1bd3d6){_0x19ab6f=_0x19ab6f-0xc0;const _0x4f670c=a0_0x4f67();let _0x151089=_0x4f670c[_0x19ab6f];return _0x151089;}import{execSync as a0_0x33dd5d}from'child_process';import{Server as a0_0x58faa2}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x7af21f}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x8b0b3a,CallToolRequestSchema as a0_0x468cf3}from'@modelcontextprotocol/sdk/types.js';function h(_0x154c0a){const _0xb4d5d3=a0_0x1510;if(!a0_0x1a66c5(_0x154c0a))return;for(let _0x5924c8 of a0_0x3b720b(_0x154c0a,_0xb4d5d3(0xfb))[_0xb4d5d3(0xf4)]('\x0a')){let _0x8b7b90=_0x5924c8[_0xb4d5d3(0x147)]();if(!_0x8b7b90||_0x8b7b90[_0xb4d5d3(0xda)]('#'))continue;let _0x26a437=_0x8b7b90[_0xb4d5d3(0x13c)]('=');if(_0x26a437<0x0)continue;let _0xc97ae=_0x8b7b90[_0xb4d5d3(0xf8)](0x0,_0x26a437)['trim'](),_0x2fe6bc=_0x8b7b90[_0xb4d5d3(0xf8)](_0x26a437+0x1)[_0xb4d5d3(0x147)]()[_0xb4d5d3(0xe0)](/^["']|["']$/g,'');if(!process.env[_0xc97ae])process.env[_0xc97ae]=_0x2fe6bc;}}var R=process.env.HOME||'~',p=a0_0xf6d1eb(R,a0_0xcfd401(0x14b));h(a0_0xf6d1eb(p,a0_0xcfd401(0x139)));var C=process[a0_0xcfd401(0x142)]()[a0_0xcfd401(0xe0)](/\//g,'-');h(a0_0xf6d1eb(p,C,a0_0xcfd401(0x139)));function _(){try{return a0_0x33dd5d('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':'utf-8','timeout':0x7d0})['trim']();}catch{return'';}}function E(){const _0x3cad2e=a0_0xcfd401;try{let _0xcd43d8=a0_0xf6d1eb(R,_0x3cad2e(0x143),_0x3cad2e(0x13f));if(a0_0x1a66c5(_0xcd43d8))return JSON[_0x3cad2e(0x117)](a0_0x3b720b(_0xcd43d8,_0x3cad2e(0xfb)));}catch{}return{};}var T=E(),k=process.env.COMMHUB_URL||T[a0_0xcfd401(0x107)]||'http://127.0.0.1:9200',q=process.env.COMMHUB_TMUX||_(),Z=process.env.COMMHUB_ALIAS||q||a0_0x481b8d(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0xcfd401(0x106)](),X=process.env.COMMHUB_TOKEN||T[a0_0xcfd401(0xde)]||'';function V(_0x4ebd53){const _0x3ef3f0=a0_0xcfd401;let _0x2b1042=new Date()[_0x3ef3f0(0xdd)]()[_0x3ef3f0(0xf8)](0x0,0x8);process[_0x3ef3f0(0x141)]['write']('['+_0x2b1042+_0x3ef3f0(0x120)+_0x4ebd53+'\x0a');}function O(_0x36ab0e){return new Promise(_0x42efc6=>setTimeout(_0x42efc6,_0x36ab0e));}V(a0_0xcfd401(0x116)+k+'\x20ALIAS='+Z+a0_0xcfd401(0x112)+w[a0_0xcfd401(0xf8)](0x0,0x8)+a0_0xcfd401(0x11e)+(q||'none')+'\x20CWD='+process[a0_0xcfd401(0x142)]()+a0_0xcfd401(0x102)+C);var K=new a0_0x58faa2({'name':a0_0xcfd401(0xcd),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0xcfd401(0x11b),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0xcfd401(0xec),a0_0xcfd401(0x11c),a0_0xcfd401(0x114)+Z][a0_0xcfd401(0xe3)]('\x0a')});function a0_0x4f67(){const _0x5cfd5d=['\x20from\x20','status','data:\x20','messages','0.3.0','2.0','content','error','get_inbox','application/json,\x20text/event-stream','exit','/mcp','decode','2314130IUSNAB','39981BhamSG','Priority\x20(default:\x20normal)','stringify','catch','Authorization','starting\x20SSE\x20listener...','idle','in_progress','.env','SIGTERM','object','indexOf','application/json','parse\x20error:\x20','config.json','MCP\x20stdio\x20connected','stderr','cwd','.anet','pop','type','POST','trim','heartbeat\x20failed:\x20','Reply\x20text\x20/\x20result\x20summary','high','.claude/channels/commhub','initialize','statusText','commhub_report_status','Message\x20content','number','notifications/claude/channel','then','find','commhub_get_all_status','result','report_status','2090517fVqebs','task','from','CommHub\x20init\x20failed:\x20','commhub_send_message','commhub-channel','commhub_reply','SSE\x20error:\x20','tools/call','unknown\x20tool','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','normal','priority','setRequestHandler','message','text','35NmQUBE','Task\x20status','startsWith','broadcast','session\x20disconnected','toTimeString','token','end','replace','send_message','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','join','commhub_send_task','Bearer\x20','Current\x20task\x20description','179710livENl','from_session','12NFsWoF','fatal:\x20','get_all_status','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','\x20priority=','4486548CCDkQR','string','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','connected','claude-code','blocked','split','message_id','commhub','→\x20injected\x20task\x20','slice','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','SSE\x20connection\x20error:\x20','utf-8','28znwpNc','\x22\x20(','ack_inbox','SSE\x20connected\x20as\x20\x22','ready\x20—\x20waiting\x20for\x20events','alias','\x20PROJECT_ENV=','stdin','inbox_count','SSE\x20stream\x20ended,\x20reconnecting...','randomUUID','hub','Progress\x200-100','9KxrSps','working','new_message','Target\x20session\x20alias','completed','body','connecting\x20to\x20','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','36GEPqPN','\x20RESUME_ID=','getReader','Session\x20alias:\x20','new_task','ENV:\x20URL=','parse','/events/','2017AgfUFi','308920TOhWzs','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','send_task','...\x20TMUX=','low',']\x20[commhub]\x20','notification','2025-03-26'];a0_0x4f67=function(){return _0x5cfd5d;};return a0_0x4f67();}K[a0_0xcfd401(0xd5)](a0_0x8b0b3a,async()=>({'tools':[{'name':a0_0xcfd401(0xce),'description':a0_0xcfd401(0xf9),'inputSchema':{'type':a0_0xcfd401(0x13b),'properties':{'task_id':{'type':a0_0xcfd401(0xef),'description':a0_0xcfd401(0x110)},'text':{'type':a0_0xcfd401(0xef),'description':a0_0xcfd401(0x149)},'status':{'type':a0_0xcfd401(0xef),'enum':[a0_0xcfd401(0x10d),a0_0xcfd401(0xf3),'error',a0_0xcfd401(0x138)],'description':a0_0xcfd401(0xd9)}},'required':[a0_0xcfd401(0xd7)]}},{'name':'commhub_report_status','description':a0_0xcfd401(0xe2),'inputSchema':{'type':a0_0xcfd401(0x13b),'properties':{'status':{'type':a0_0xcfd401(0xef),'enum':['working','idle','blocked',a0_0xcfd401(0x12a)]},'task':{'type':a0_0xcfd401(0xef),'description':a0_0xcfd401(0xe6)},'progress':{'type':a0_0xcfd401(0xc1),'description':a0_0xcfd401(0x108)}},'required':[a0_0xcfd401(0x124)]}},{'name':'commhub_send_task','description':a0_0xcfd401(0xd2),'inputSchema':{'type':a0_0xcfd401(0x13b),'properties':{'alias':{'type':a0_0xcfd401(0xef),'description':a0_0xcfd401(0x10c)},'task':{'type':a0_0xcfd401(0xef),'description':'Task\x20content'},'priority':{'type':'string','enum':[a0_0xcfd401(0x14a),'normal',a0_0xcfd401(0x11f)],'description':a0_0xcfd401(0x132)}},'required':[a0_0xcfd401(0x101),a0_0xcfd401(0xc9)]}},{'name':a0_0xcfd401(0xcc),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0xcfd401(0x13b),'properties':{'alias':{'type':a0_0xcfd401(0xef),'description':a0_0xcfd401(0x10c)},'message':{'type':'string','description':a0_0xcfd401(0xc0)}},'required':[a0_0xcfd401(0x101),'message']}},{'name':a0_0xcfd401(0xc5),'description':a0_0xcfd401(0xf0),'inputSchema':{'type':a0_0xcfd401(0x13b),'properties':{}}}]}));async function P(_0x92fc5,_0x210daf){const _0x1e1cd1=a0_0xcfd401;let _0x12f049=await fetch(k+_0x1e1cd1(0x12e),{'method':_0x1e1cd1(0x146),'headers':{'Content-Type':_0x1e1cd1(0x13d),'Accept':_0x1e1cd1(0x12c),...X?{'Authorization':_0x1e1cd1(0xe5)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x1e1cd1(0x128),'id':0x1,'method':_0x1e1cd1(0x14c),'params':{'protocolVersion':_0x1e1cd1(0x122),'capabilities':{},'clientInfo':{'name':_0x1e1cd1(0xcd),'version':_0x1e1cd1(0x127)}}})});if(!_0x12f049['ok']){let _0x5e2d7d=await _0x12f049[_0x1e1cd1(0xd7)]();return V(_0x1e1cd1(0xcb)+_0x12f049[_0x1e1cd1(0x124)]+'\x20'+_0x5e2d7d[_0x1e1cd1(0xf8)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x12f049[_0x1e1cd1(0x124)]};}await _0x12f049['text']();let _0x58fce3=(await(await fetch(k+_0x1e1cd1(0x12e),{'method':_0x1e1cd1(0x146),'headers':{'Content-Type':_0x1e1cd1(0x13d),'Accept':_0x1e1cd1(0x12c),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x1e1cd1(0x133)]({'jsonrpc':'2.0','id':0x2,'method':_0x1e1cd1(0xd0),'params':{'name':_0x92fc5,'arguments':_0x210daf}})}))['text']())['split']('\x0a')[_0x1e1cd1(0xc4)](_0x2a49d7=>_0x2a49d7[_0x1e1cd1(0xda)](_0x1e1cd1(0x125)));if(_0x58fce3){let _0x14daf4=JSON[_0x1e1cd1(0x117)](_0x58fce3[_0x1e1cd1(0xf8)](0x6));return _0x14daf4?.[_0x1e1cd1(0xc6)]?.[_0x1e1cd1(0x129)]?.[0x0]?.['text']?JSON[_0x1e1cd1(0x117)](_0x14daf4[_0x1e1cd1(0xc6)]['content'][0x0]['text']):_0x14daf4;}return{'ok':!0x1,'error':'no\x20response'};}K['setRequestHandler'](a0_0x468cf3,async _0x52dd78=>{const _0x4badd0=a0_0xcfd401;let {name:_0xc93b71,arguments:_0x17d17e}=_0x52dd78['params'];if(_0xc93b71===_0x4badd0(0xce)){let {task_id:_0x2f6632,text:_0xb1c95c,status:_0x25e1fd}=_0x17d17e;if(_0x25e1fd===_0x4badd0(0x10d)){let _0x15a839=await P('report_completion',{'alias':Z,'task':_0x2f6632||_0x4badd0(0xc9),'result':_0xb1c95c});return{'content':[{'type':_0x4badd0(0xd7),'text':JSON['stringify'](_0x15a839)}]};}let _0x509dc9=await P(_0x4badd0(0xc7),{'resume_id':w,'alias':Z,'status':_0x25e1fd===_0x4badd0(0xf3)?'blocked':_0x25e1fd==='error'?_0x4badd0(0x12a):_0x4badd0(0x10a),'task':_0xb1c95c['slice'](0x0,0xc8),'output':_0xb1c95c});return{'content':[{'type':'text','text':JSON['stringify'](_0x509dc9)}]};}if(_0xc93b71===_0x4badd0(0x14e)){let {status:_0x1a547a,task:_0x113cea,progress:_0x476e01}=_0x17d17e,_0x3f64e6=await P(_0x4badd0(0xc7),{'resume_id':w,'alias':Z,'status':_0x1a547a,'task':_0x113cea,'progress':_0x476e01});return{'content':[{'type':'text','text':JSON['stringify'](_0x3f64e6)}]};}if(_0xc93b71===_0x4badd0(0xe4)){let {alias:_0x1df4b8,task:_0x37228d,priority:_0xe43e3c}=_0x17d17e,_0xbb237a=await P(_0x4badd0(0x11d),{'alias':_0x1df4b8,'task':_0x37228d,'priority':_0xe43e3c||_0x4badd0(0xd3),'from_session':Z});return{'content':[{'type':_0x4badd0(0xd7),'text':JSON[_0x4badd0(0x133)](_0xbb237a)}]};}if(_0xc93b71==='commhub_send_message'){let {alias:_0x15d3b,message:_0x4d8c8d}=_0x17d17e,_0x4321bb=await P(_0x4badd0(0xe1),{'alias':_0x15d3b,'message':_0x4d8c8d,'from_session':Z});return{'content':[{'type':_0x4badd0(0xd7),'text':JSON[_0x4badd0(0x133)](_0x4321bb)}]};}if(_0xc93b71===_0x4badd0(0xc5)){let _0x5cb328=await P(_0x4badd0(0xeb),{});return{'content':[{'type':_0x4badd0(0xd7),'text':JSON[_0x4badd0(0x133)](_0x5cb328)}]};}return{'content':[{'type':_0x4badd0(0xd7),'text':JSON[_0x4badd0(0x133)]({'error':_0x4badd0(0xd1)})}]};});async function c(){const _0x17df4a=a0_0xcfd401;let _0x6187e3=k+_0x17df4a(0x118)+encodeURIComponent(Z),_0x3a36e9={};if(X)_0x3a36e9[_0x17df4a(0x135)]=_0x17df4a(0xe5)+X;V(_0x17df4a(0x10f)+_0x6187e3);while(!0x0){try{let _0x1229fc=await fetch(_0x6187e3,{'headers':_0x3a36e9});if(!_0x1229fc['ok']){V(_0x17df4a(0xcf)+_0x1229fc[_0x17df4a(0x124)]+'\x20'+_0x1229fc[_0x17df4a(0x14d)]),await O(0x1388);continue;}let _0x1b20b3=_0x1229fc[_0x17df4a(0x10e)][_0x17df4a(0x113)](),_0xf5555=new TextDecoder(),_0x3e0845='';while(!0x0){let {done:_0x222c24,value:_0x4951f8}=await _0x1b20b3['read']();if(_0x222c24)break;_0x3e0845+=_0xf5555[_0x17df4a(0x12f)](_0x4951f8,{'stream':!0x0});let _0x3117a9=_0x3e0845['split']('\x0a\x0a');_0x3e0845=_0x3117a9[_0x17df4a(0x144)]()||'';for(let _0x4cf524 of _0x3117a9){let _0x524755=_0x4cf524['split']('\x0a')[_0x17df4a(0xc4)](_0x129534=>_0x129534[_0x17df4a(0xda)](_0x17df4a(0x125)));if(!_0x524755)continue;try{let _0x4c97ef=JSON['parse'](_0x524755[_0x17df4a(0xf8)](0x6));await v(_0x4c97ef);}catch(_0x45276f){V(_0x17df4a(0x13e)+_0x45276f);}}}V(_0x17df4a(0x105));}catch(_0x5d7e46){V(_0x17df4a(0xfa)+_0x5d7e46);}await O(0xbb8);}}async function v(_0x4c1928){const _0x2dd2ef=a0_0xcfd401;if(_0x4c1928[_0x2dd2ef(0x145)]===_0x2dd2ef(0xf1)){V(_0x2dd2ef(0xff)+Z+'\x22');return;}if(_0x4c1928['type']===_0x2dd2ef(0x10b)){if(V('←\x20message\x20from\x20'+_0x4c1928[_0x2dd2ef(0xca)]+':\x20'+_0x4c1928['message'][_0x2dd2ef(0xf8)](0x0,0x3c)),await K[_0x2dd2ef(0x121)]({'method':'notifications/claude/channel','params':{'content':_0x4c1928[_0x2dd2ef(0xd6)],'meta':{'sender':_0x4c1928[_0x2dd2ef(0xca)]||_0x2dd2ef(0x107),'sender_id':'commhub','user':_0x4c1928[_0x2dd2ef(0xca)]||_0x2dd2ef(0x107),'priority':_0x2dd2ef(0xd3)}}}),_0x4c1928[_0x2dd2ef(0xf5)])await P(_0x2dd2ef(0xfe),{'alias':Z,'message_id':_0x4c1928[_0x2dd2ef(0xf5)]});return;}if(_0x4c1928[_0x2dd2ef(0x145)]===_0x2dd2ef(0x115)||_0x4c1928[_0x2dd2ef(0x145)]===_0x2dd2ef(0xdb)){V('←\x20'+_0x4c1928[_0x2dd2ef(0x145)]+':\x20inbox_count='+_0x4c1928[_0x2dd2ef(0x104)]+_0x2dd2ef(0xed)+(_0x4c1928[_0x2dd2ef(0xd4)]||_0x2dd2ef(0xd3)));let _0xa6ce8d=await P(_0x2dd2ef(0x12b),{'alias':Z,'limit':0x5});if(_0xa6ce8d?.['ok']&&_0xa6ce8d[_0x2dd2ef(0x126)]?.['length']>0x0)for(let _0x58dbb7 of _0xa6ce8d[_0x2dd2ef(0x126)]){let _0x49bf37={'sender':_0x58dbb7[_0x2dd2ef(0xe8)]||'hub','sender_id':_0x2dd2ef(0xf6),'user':_0x58dbb7[_0x2dd2ef(0xe8)]||_0x2dd2ef(0x107),'task_id':_0x58dbb7['id'],'priority':_0x58dbb7['priority']||'normal'};await K[_0x2dd2ef(0x121)]({'method':_0x2dd2ef(0xc2),'params':{'content':_0x58dbb7[_0x2dd2ef(0x129)],'meta':_0x49bf37}}),V(_0x2dd2ef(0xf7)+_0x58dbb7['id']['slice'](0x0,0x8)+_0x2dd2ef(0x123)+_0x58dbb7['from_session']+':\x20'+_0x58dbb7[_0x2dd2ef(0x129)][_0x2dd2ef(0xf8)](0x0,0x3c)),await P(_0x2dd2ef(0xfe),{'alias':Z,'message_id':_0x58dbb7['id']});}}}async function u(){const _0x22be92=a0_0xcfd401;let _0x20574e=new a0_0x7af21f();await K['connect'](_0x20574e),V(_0x22be92(0x140)),V(_0x22be92(0x136)),c()[_0x22be92(0x134)](_0x4891c9=>V('SSE\x20fatal:\x20'+_0x4891c9)),P(_0x22be92(0xc7),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x481b8d(),'hostname':a0_0x481b8d(),'agent':'claude-code','project_dir':process[_0x22be92(0x142)](),'tmux_name':q||void 0x0})[_0x22be92(0xc3)](()=>V('registered\x20as\x20\x22'+Z+_0x22be92(0xfd)+w[_0x22be92(0xf8)](0x0,0x8)+')'))[_0x22be92(0x134)](_0x1222b7=>V('warning:\x20could\x20not\x20register:\x20'+_0x1222b7)),setInterval(()=>{const _0x2749f5=_0x22be92;P('report_status',{'resume_id':w,'alias':Z,'status':_0x2749f5(0x137),'server':a0_0x481b8d(),'hostname':a0_0x481b8d(),'agent':_0x2749f5(0xf2),'project_dir':process[_0x2749f5(0x142)](),'tmux_name':q||void 0x0})['catch'](_0x530a8d=>V(_0x2749f5(0x148)+_0x530a8d));},0x2bf20),V(_0x22be92(0x100));}u()[a0_0xcfd401(0x134)](_0x2c5d52=>{const _0x128ae4=a0_0xcfd401;V(_0x128ae4(0xea)+_0x2c5d52),process[_0x128ae4(0x12d)](0x1);});async function f(){const _0x3de507=a0_0xcfd401;V('shutting\x20down,\x20reporting\x20offline...'),await P(_0x3de507(0xc7),{'resume_id':w,'alias':Z,'status':_0x3de507(0x12a),'task':_0x3de507(0xdc)})['catch'](()=>{}),process['exit'](0x0);}process[a0_0xcfd401(0x103)]['on'](a0_0xcfd401(0xdf),()=>f()),process['on'](a0_0xcfd401(0x13a),()=>f()),process['on']('SIGINT',()=>f());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "AI Agent Network — Server + Client + Setup in one package. SSE real-time communication for multi-agent orchestration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|