@sleep2agi/agent-network 2.0.1-preview.1 → 2.0.1-preview.2
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
|
+
function a0_0x4892(_0xd0535f,_0x46e1cb){_0xd0535f=_0xd0535f-0x19b;const _0x109ccb=a0_0x109c();let _0x489264=_0x109ccb[_0xd0535f];return _0x489264;}const a0_0x5bc1c6=a0_0x4892;(function(_0x30178d,_0x4e669b){const _0x8cc219=a0_0x4892,_0x27f089=_0x30178d();while(!![]){try{const _0xbfca65=parseInt(_0x8cc219(0x1d7))/0x1*(-parseInt(_0x8cc219(0x1a0))/0x2)+-parseInt(_0x8cc219(0x1a7))/0x3*(-parseInt(_0x8cc219(0x1a5))/0x4)+-parseInt(_0x8cc219(0x1d2))/0x5+-parseInt(_0x8cc219(0x1db))/0x6*(parseInt(_0x8cc219(0x1e7))/0x7)+-parseInt(_0x8cc219(0x1a4))/0x8*(-parseInt(_0x8cc219(0x19c))/0x9)+parseInt(_0x8cc219(0x1b3))/0xa+parseInt(_0x8cc219(0x1a8))/0xb*(parseInt(_0x8cc219(0x1f6))/0xc);if(_0xbfca65===_0x4e669b)break;else _0x27f089['push'](_0x27f089['shift']());}catch(_0x41cee8){_0x27f089['push'](_0x27f089['shift']());}}}(a0_0x109c,0x2274f));import{EventEmitter as a0_0x52f46f}from'events';function a0_0x109c(){const _0x19629e=['application/json','call','running','/mcp','AbortError','1800491VPIroK','slice','SSE\x20failed:\x20','body','send','s...','get_all_status','Bearer\x20','min','send_message','completed','error','agent','cwd','processInbox','408396WIUven','new_task','alias','736794gLTTqR','status','Authorization','sseAbort','2ZxwGnV','broadcast','report_status','token','8ezTJHy','16tVPvLi','autoConnect','83445KqcNrx','77tSmYWO','abort','name','resumeId','heartbeat\x20failed:\x20','server','getAllStatus','inbox\x20error:\x20','decode','send_task','get_inbox','2579270FEDqgJ','type','read','getReader','replace','message','task','reconnectDelay','emit','signal','offline','text','catch','reply','result','content','heartbeatTimer','messages','new_message','sleep','stringify','connectSSE','registered','connected','normal','url','disconnect','log','data:\x20','heartbeatInterval','disconnected','477975zQPXqm','now','2.0','ack_inbox','pop','195341vyImEN','sdk-','match','toTimeString','6iLsCrB','SSE\x20error:\x20','sdk','toString','parse','SSE\x20reconnecting\x20in\x20','connect'];a0_0x109c=function(){return _0x19629e;};return a0_0x109c();}import{hostname as a0_0x4aad74}from'os';class T extends a0_0x52f46f{[a0_0x5bc1c6(0x1cc)];[a0_0x5bc1c6(0x19b)];[a0_0x5bc1c6(0x1a3)];['agent'];[a0_0x5bc1c6(0x1ab)];[a0_0x5bc1c6(0x1d0)];[a0_0x5bc1c6(0x1ba)];['heartbeatTimer'];[a0_0x5bc1c6(0x19f)];['running']=!0x1;constructor(_0x57f41e){const _0x556df0=a0_0x5bc1c6;super();if(this[_0x556df0(0x1cc)]=_0x57f41e['url'][_0x556df0(0x1b7)](/\/$/,''),this[_0x556df0(0x19b)]=_0x57f41e['alias'],this['token']=_0x57f41e[_0x556df0(0x1a3)],this[_0x556df0(0x1f3)]=_0x57f41e[_0x556df0(0x1f3)]||_0x556df0(0x1dd),this[_0x556df0(0x1ab)]=_0x556df0(0x1d8)+_0x57f41e['alias']+'-'+Date[_0x556df0(0x1d3)]()[_0x556df0(0x1de)](0x24),this[_0x556df0(0x1d0)]=_0x57f41e['heartbeatInterval']??0x2bf20,this[_0x556df0(0x1ba)]=_0x57f41e[_0x556df0(0x1ba)]??0xbb8,_0x57f41e[_0x556df0(0x1a6)]!==!0x1)this[_0x556df0(0x1e1)]();}['log'](_0x6cdb03){const _0x5e6113=a0_0x5bc1c6;console['log']('['+new Date()[_0x5e6113(0x1da)]()['slice'](0x0,0x8)+']\x20[commhub:'+this[_0x5e6113(0x19b)]+']\x20'+_0x6cdb03);}async['call'](_0x53bcf6,_0x761c4b){const _0x41122f=a0_0x5bc1c6;let _0x3f5fb1={'Content-Type':_0x41122f(0x1e2),'Accept':'application/json,\x20text/event-stream'};if(this[_0x41122f(0x1a3)])_0x3f5fb1[_0x41122f(0x19e)]=_0x41122f(0x1ee)+this[_0x41122f(0x1a3)];let _0x4d9d5b=await(await fetch(this[_0x41122f(0x1cc)]+_0x41122f(0x1e5),{'method':'POST','headers':_0x3f5fb1,'body':JSON[_0x41122f(0x1c7)]({'jsonrpc':_0x41122f(0x1d4),'id':Date['now'](),'method':'tools/call','params':{'name':_0x53bcf6,'arguments':_0x761c4b}})}))[_0x41122f(0x1be)](),_0x29121e=_0x4d9d5b[_0x41122f(0x1d9)](/data: (.+)/),_0x1d3a6b=_0x29121e?JSON[_0x41122f(0x1df)](_0x29121e[0x1]):JSON[_0x41122f(0x1df)](_0x4d9d5b),_0x1285c2=_0x1d3a6b?.[_0x41122f(0x1c1)]?.['content']?.[0x0]?.[_0x41122f(0x1be)];return _0x1285c2?JSON['parse'](_0x1285c2):_0x1d3a6b;}async[a0_0x5bc1c6(0x1e1)](){const _0x7c55f7=a0_0x5bc1c6;if(this['running'])return;this[_0x7c55f7(0x1e4)]=!0x0,await this[_0x7c55f7(0x19d)]('idle'),this['log'](_0x7c55f7(0x1c9)),this[_0x7c55f7(0x1c3)]=setInterval(()=>{const _0x5a80be=_0x7c55f7;this[_0x5a80be(0x19d)]('idle')['catch'](_0x216a80=>this[_0x5a80be(0x1ce)](_0x5a80be(0x1ac)+_0x216a80[_0x5a80be(0x1b8)]));},this['heartbeatInterval']),this[_0x7c55f7(0x1c8)]();}async[a0_0x5bc1c6(0x1cd)](){const _0x4f2210=a0_0x5bc1c6;if(this[_0x4f2210(0x1e4)]=!0x1,this['sseAbort']?.[_0x4f2210(0x1a9)](),this[_0x4f2210(0x1c3)])clearInterval(this[_0x4f2210(0x1c3)]);await this[_0x4f2210(0x19d)](_0x4f2210(0x1bd))[_0x4f2210(0x1bf)](()=>{}),this[_0x4f2210(0x1ce)](_0x4f2210(0x1d1));}async[a0_0x5bc1c6(0x1eb)](_0x36746a,_0x18cbbf,_0x5ef447=a0_0x5bc1c6(0x1cb)){const _0x1f61ff=a0_0x5bc1c6;return this[_0x1f61ff(0x1e3)](_0x1f61ff(0x1b1),{'alias':_0x36746a,'task':_0x18cbbf,'priority':_0x5ef447,'from_session':this[_0x1f61ff(0x19b)]});}async[a0_0x5bc1c6(0x1b8)](_0x25499e,_0x35af98){const _0x26dc96=a0_0x5bc1c6;return this['call'](_0x26dc96(0x1f0),{'alias':_0x25499e,'message':_0x35af98,'from_session':this['alias']});}async[a0_0x5bc1c6(0x1c0)](_0x282f1d,_0x391c0f,_0x342219=a0_0x5bc1c6(0x1f1)){const _0x1025ac=a0_0x5bc1c6;return this[_0x1025ac(0x1e3)](_0x1025ac(0x1c0),{'task_id':_0x282f1d,'text':_0x391c0f,'status':_0x342219});}async[a0_0x5bc1c6(0x19d)](_0x30062b,_0x4ba7ac){const _0x393721=a0_0x5bc1c6;return this[_0x393721(0x1e3)](_0x393721(0x1a2),{'resume_id':this['resumeId'],'alias':this[_0x393721(0x19b)],'status':_0x30062b,'server':a0_0x4aad74(),'hostname':a0_0x4aad74(),'agent':this[_0x393721(0x1f3)],'project_dir':process[_0x393721(0x1f4)](),..._0x4ba7ac});}async[a0_0x5bc1c6(0x1ae)](){const _0x3664a6=a0_0x5bc1c6;return this['call'](_0x3664a6(0x1ed),{});}async[a0_0x5bc1c6(0x1a1)](_0xaedb0c,_0x952ea3){const _0x22f47f=a0_0x5bc1c6;return this['call']('broadcast',{'message':_0xaedb0c,'filter_server':_0x952ea3?.[_0x22f47f(0x1ad)],'filter_status':_0x952ea3?.['status']});}async[a0_0x5bc1c6(0x1c8)](){const _0x5a1dfe=a0_0x5bc1c6;let _0x2d52df=encodeURIComponent(this[_0x5a1dfe(0x19b)]),_0xa1a742=this['url']+'/events/'+_0x2d52df,_0x1f259f=this['reconnectDelay'];while(this[_0x5a1dfe(0x1e4)]){try{this[_0x5a1dfe(0x19f)]=new AbortController();let _0x4a59bc={'Accept':'text/event-stream'};if(this['token'])_0x4a59bc[_0x5a1dfe(0x19e)]=_0x5a1dfe(0x1ee)+this['token'];let _0x4b6bd1=await fetch(_0xa1a742,{'headers':_0x4a59bc,'signal':this[_0x5a1dfe(0x19f)][_0x5a1dfe(0x1bc)]});if(!_0x4b6bd1['ok']||!_0x4b6bd1[_0x5a1dfe(0x1ea)]){this['log'](_0x5a1dfe(0x1e9)+_0x4b6bd1['status']),await this[_0x5a1dfe(0x1c6)](_0x1f259f),_0x1f259f=Math[_0x5a1dfe(0x1ef)](_0x1f259f*1.5,0xea60);continue;}_0x1f259f=this[_0x5a1dfe(0x1ba)];let _0x4d3f52=_0x4b6bd1[_0x5a1dfe(0x1ea)][_0x5a1dfe(0x1b6)](),_0x2b9462=new TextDecoder(),_0x5c4c0f='';while(this[_0x5a1dfe(0x1e4)]){let {done:_0x312201,value:_0x249c2a}=await _0x4d3f52[_0x5a1dfe(0x1b5)]();if(_0x312201)break;_0x5c4c0f+=_0x2b9462[_0x5a1dfe(0x1b0)](_0x249c2a,{'stream':!0x0});let _0x2bd12b=_0x5c4c0f['split']('\x0a');_0x5c4c0f=_0x2bd12b[_0x5a1dfe(0x1d6)]()||'';for(let _0x27f03b of _0x2bd12b){if(!_0x27f03b['startsWith'](_0x5a1dfe(0x1cf)))continue;try{let _0x190573=JSON[_0x5a1dfe(0x1df)](_0x27f03b[_0x5a1dfe(0x1e8)](0x6));if(_0x190573[_0x5a1dfe(0x1b4)]===_0x5a1dfe(0x1ca)){this[_0x5a1dfe(0x1ce)]('SSE\x20connected'),this['emit'](_0x5a1dfe(0x1ca));continue;}if(_0x190573[_0x5a1dfe(0x1b4)]===_0x5a1dfe(0x1f7)||_0x190573[_0x5a1dfe(0x1b4)]===_0x5a1dfe(0x1c5)||_0x190573['type']==='broadcast')await this['processInbox']();}catch{}}}}catch(_0x1273a8){if(_0x1273a8[_0x5a1dfe(0x1aa)]===_0x5a1dfe(0x1e6))break;this[_0x5a1dfe(0x1bb)](_0x5a1dfe(0x1f2),_0x1273a8),this[_0x5a1dfe(0x1ce)](_0x5a1dfe(0x1dc)+_0x1273a8[_0x5a1dfe(0x1b8)]);}if(this[_0x5a1dfe(0x1e4)])this[_0x5a1dfe(0x1bb)](_0x5a1dfe(0x1d1)),this[_0x5a1dfe(0x1ce)](_0x5a1dfe(0x1e0)+_0x1f259f/0x3e8+_0x5a1dfe(0x1ec)),await this[_0x5a1dfe(0x1c6)](_0x1f259f),_0x1f259f=Math['min'](_0x1f259f*1.5,0xea60);}}async[a0_0x5bc1c6(0x1f5)](){const _0x24b8be=a0_0x5bc1c6;try{let _0x194f12=(await this[_0x24b8be(0x1e3)](_0x24b8be(0x1b2),{'alias':this[_0x24b8be(0x19b)],'limit':0xa}))?.[_0x24b8be(0x1c4)]||[];for(let _0x19b82d of _0x194f12)await this[_0x24b8be(0x1e3)](_0x24b8be(0x1d5),{'alias':this[_0x24b8be(0x19b)],'message_id':_0x19b82d['id']}),this[_0x24b8be(0x1ce)]('←\x20'+_0x19b82d['from_session']+':\x20'+_0x19b82d[_0x24b8be(0x1c2)]['slice'](0x0,0x3c)),this[_0x24b8be(0x1bb)](_0x24b8be(0x1b9),_0x19b82d),this[_0x24b8be(0x1bb)](_0x24b8be(0x1b8),_0x19b82d);}catch(_0x27a2dd){this['log'](_0x24b8be(0x1af)+_0x27a2dd['message']);}}['sleep'](_0x4be5d9){return new Promise(_0x155ed6=>setTimeout(_0x155ed6,_0x4be5d9));}}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_0x1f921f=a0_0x5b87;(function(_0x92ca2d,_0xdcabd2){const _0xd815c6=a0_0x5b87,_0x56e5cc=_0x92ca2d();while(!![]){try{const _0x283ba2=-parseInt(_0xd815c6(0x22c))/0x1*(parseInt(_0xd815c6(0x1df))/0x2)+-parseInt(_0xd815c6(0x234))/0x3+parseInt(_0xd815c6(0x1f8))/0x4*(parseInt(_0xd815c6(0x21d))/0x5)+-parseInt(_0xd815c6(0x21e))/0x6+parseInt(_0xd815c6(0x232))/0x7*(parseInt(_0xd815c6(0x1de))/0x8)+parseInt(_0xd815c6(0x1d1))/0x9+parseInt(_0xd815c6(0x207))/0xa*(parseInt(_0xd815c6(0x233))/0xb);if(_0x283ba2===_0xdcabd2)break;else _0x56e5cc['push'](_0x56e5cc['shift']());}catch(_0x5c2d9a){_0x56e5cc['push'](_0x56e5cc['shift']());}}}(a0_0x4216,0x594b5));import{readFileSync as a0_0x4f884a,existsSync as a0_0x587c12}from'fs';function a0_0x5b87(_0x25f8d6,_0x412276){_0x25f8d6=_0x25f8d6-0x1d1;const _0x421618=a0_0x4216();let _0x5b8784=_0x421618[_0x25f8d6];return _0x5b8784;}import{randomUUID as a0_0x34b683}from'crypto';import{join as a0_0x1f98a4}from'path';import{hostname as a0_0x116d52}from'os';import{execSync as a0_0x1be896}from'child_process';import{Server as a0_0x146840}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x51fe97}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x140c99,CallToolRequestSchema as a0_0x5560f9}from'@modelcontextprotocol/sdk/types.js';function p(_0x4c8407){const _0x56e4a2=a0_0x5b87;if(!a0_0x587c12(_0x4c8407))return;for(let _0x54e779 of a0_0x4f884a(_0x4c8407,_0x56e4a2(0x25e))[_0x56e4a2(0x201)]('\x0a')){let _0x4abdb9=_0x54e779[_0x56e4a2(0x23a)]();if(!_0x4abdb9||_0x4abdb9[_0x56e4a2(0x20c)]('#'))continue;let _0x45b178=_0x4abdb9['indexOf']('=');if(_0x45b178<0x0)continue;let _0x138b39=_0x4abdb9['slice'](0x0,_0x45b178)[_0x56e4a2(0x23a)](),_0xbaf729=_0x4abdb9['slice'](_0x45b178+0x1)[_0x56e4a2(0x23a)]()[_0x56e4a2(0x223)](/^["']|["']$/g,'');if(!process.env[_0x138b39])process.env[_0x138b39]=_0xbaf729;}}var C=process.env.HOME||'~',T=a0_0x1f98a4(C,'.claude/channels/commhub');p(a0_0x1f98a4(T,a0_0x1f921f(0x211)));var L=process[a0_0x1f921f(0x240)]()['replace'](/\//g,'-');p(a0_0x1f98a4(T,L,'.env'));function U(){const _0xeff77c=a0_0x1f921f;try{return a0_0x1be896(_0xeff77c(0x206),{'encoding':'utf-8','timeout':0x7d0})['trim']();}catch{return'';}}function v(){const _0x3cc6ab=a0_0x1f921f;try{let _0x1cd45a=a0_0x1f98a4(C,_0x3cc6ab(0x23e),_0x3cc6ab(0x248));if(a0_0x587c12(_0x1cd45a))return JSON[_0x3cc6ab(0x1e9)](a0_0x4f884a(_0x1cd45a,_0x3cc6ab(0x25e)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x1f921f(0x251)]||a0_0x1f921f(0x21c),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x116d52(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x34b683(),X=process.env.COMMHUB_TOKEN||H[a0_0x1f921f(0x227)]||'';function Y(_0x4213b6){const _0x422b10=a0_0x1f921f;let _0x5ecf92=new Date()['toTimeString']()[_0x422b10(0x21a)](0x0,0x8);process[_0x422b10(0x20f)]['write']('['+_0x5ecf92+_0x422b10(0x23d)+_0x4213b6+'\x0a');}function h(_0xa02ce3){return new Promise(_0x20421e=>setTimeout(_0x20421e,_0xa02ce3));}Y(a0_0x1f921f(0x21f)+f+a0_0x1f921f(0x222)+Z+a0_0x1f921f(0x20d)+w[a0_0x1f921f(0x21a)](0x0,0x8)+a0_0x1f921f(0x246)+(j||'none')+a0_0x1f921f(0x252)+process['cwd']()+a0_0x1f921f(0x1d2)+L);var k=new Map(),K=new a0_0x146840({'name':a0_0x1f921f(0x237),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x1f921f(0x24a),a0_0x1f921f(0x1db),a0_0x1f921f(0x20e),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x1f921f(0x24d)+Z][a0_0x1f921f(0x1fa)]('\x0a')});function a0_0x4216(){const _0x105537=['data:\x20','new_task','catch','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Bearer\x20','number','get_inbox','inbox_count','working','utf-8','182529ZOINzN','\x20PROJECT_ENV=','priority','from','Priority\x20(default:\x20normal)','SSE\x20connected\x20as\x20\x22','end','registered\x20as\x20\x22','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','heartbeat\x20failed:\x20','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Target\x20session\x20alias','tools/call','8sBXZiU','2BJlfWU','message_id','message','notifications/claude/channel','commhub_send_message','unknown\x20tool','type','no\x20response','commhub','/events/','parse','replied','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','connected','messages','stdin','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','find','2.0','connect','get','read','body','send_reply','session\x20disconnected','500316vXzOOy','initialize','join','commhub_get_all_status','Task\x20content','CommHub\x20init\x20failed:\x20','task','Current\x20task\x20description','text','split','application/json,\x20text/event-stream','idle','cancelled','decode','tmux\x20display-message\x20-p\x20\x27#S\x27','10hhfINw','getReader','new_message','setRequestHandler','/mcp','startsWith','\x20RESUME_ID=','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','stderr','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','.env','SSE\x20connection\x20error:\x20','then','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','object','low','string','2025-03-26','content','slice','←\x20message\x20from\x20','http://127.0.0.1:9200','15TjTHUq','2518674fGuppK','ENV:\x20URL=','statusText','→\x20injected\x20task\x20','\x20ALIAS=','replace','error','Message\x20content','ready\x20—\x20waiting\x20for\x20events','token','SIGTERM','init\x20failed:\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','stringify','440261NqyNjG','length','exit','status','SSE\x20fatal:\x20','ack_inbox','4935679hRftfi','3686155viKmnL','629793vmvGFX','Reply\x20text\x20/\x20result\x20summary','result','commhub-channel','get_all_status','report_status','trim','POST','commhub_reply',']\x20[commhub]\x20','.anet','alias','cwd','normal','failed','completed','claude-code','commhub_report_status','...\x20TMUX=','notification','config.json','blocked','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','application/json','commhub_send_task','Session\x20alias:\x20','\x20priority=','warning:\x20could\x20not\x20register:\x20','0.3.0','hub','\x20CWD=','from_session','send_message'];a0_0x4216=function(){return _0x105537;};return a0_0x4216();}K[a0_0x1f921f(0x20a)](a0_0x140c99,async()=>({'tools':[{'name':a0_0x1f921f(0x23c),'description':a0_0x1f921f(0x22a),'inputSchema':{'type':a0_0x1f921f(0x215),'properties':{'task_id':{'type':a0_0x1f921f(0x217),'description':a0_0x1f921f(0x214)},'text':{'type':'string','description':a0_0x1f921f(0x235)},'status':{'type':'string','enum':[a0_0x1f921f(0x243),a0_0x1f921f(0x242),a0_0x1f921f(0x204),a0_0x1f921f(0x249),'error','in_progress'],'description':a0_0x1f921f(0x210)}},'required':[a0_0x1f921f(0x200)]}},{'name':a0_0x1f921f(0x245),'description':a0_0x1f921f(0x258),'inputSchema':{'type':a0_0x1f921f(0x215),'properties':{'status':{'type':a0_0x1f921f(0x217),'enum':[a0_0x1f921f(0x25d),'idle',a0_0x1f921f(0x249),a0_0x1f921f(0x224)]},'task':{'type':a0_0x1f921f(0x217),'description':a0_0x1f921f(0x1ff)},'progress':{'type':a0_0x1f921f(0x25a),'description':'Progress\x200-100'}},'required':[a0_0x1f921f(0x22f)]}},{'name':a0_0x1f921f(0x24c),'description':a0_0x1f921f(0x1eb),'inputSchema':{'type':a0_0x1f921f(0x215),'properties':{'alias':{'type':a0_0x1f921f(0x217),'description':a0_0x1f921f(0x1dc)},'task':{'type':a0_0x1f921f(0x217),'description':a0_0x1f921f(0x1fc)},'priority':{'type':a0_0x1f921f(0x217),'enum':['high','normal',a0_0x1f921f(0x216)],'description':a0_0x1f921f(0x1d5)}},'required':['alias',a0_0x1f921f(0x1fe)]}},{'name':a0_0x1f921f(0x1e3),'description':a0_0x1f921f(0x1d9),'inputSchema':{'type':a0_0x1f921f(0x215),'properties':{'alias':{'type':a0_0x1f921f(0x217),'description':a0_0x1f921f(0x1dc)},'message':{'type':'string','description':a0_0x1f921f(0x225)}},'required':[a0_0x1f921f(0x23f),a0_0x1f921f(0x1e1)]}},{'name':a0_0x1f921f(0x1fb),'description':a0_0x1f921f(0x1ef),'inputSchema':{'type':a0_0x1f921f(0x215),'properties':{}}}]}));async function P(_0x21579c,_0x2263f1){const _0xf9c0c8=a0_0x1f921f;let _0x4c0e0e=await fetch(f+_0xf9c0c8(0x20b),{'method':_0xf9c0c8(0x23b),'headers':{'Content-Type':_0xf9c0c8(0x24b),'Accept':_0xf9c0c8(0x202),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x1,'method':_0xf9c0c8(0x1f9),'params':{'protocolVersion':_0xf9c0c8(0x218),'capabilities':{},'clientInfo':{'name':_0xf9c0c8(0x237),'version':_0xf9c0c8(0x250)}}})});if(!_0x4c0e0e['ok']){let _0x503d5b=await _0x4c0e0e[_0xf9c0c8(0x200)]();return Y(_0xf9c0c8(0x1fd)+_0x4c0e0e[_0xf9c0c8(0x22f)]+'\x20'+_0x503d5b[_0xf9c0c8(0x21a)](0x0,0x64)),{'ok':!0x1,'error':_0xf9c0c8(0x229)+_0x4c0e0e[_0xf9c0c8(0x22f)]};}await _0x4c0e0e['text']();let _0x4a2b2b=(await(await fetch(f+'/mcp',{'method':_0xf9c0c8(0x23b),'headers':{'Content-Type':'application/json','Accept':_0xf9c0c8(0x202),...X?{'Authorization':_0xf9c0c8(0x259)+X}:{}},'body':JSON[_0xf9c0c8(0x22b)]({'jsonrpc':_0xf9c0c8(0x1f1),'id':0x2,'method':_0xf9c0c8(0x1dd),'params':{'name':_0x21579c,'arguments':_0x2263f1}})}))[_0xf9c0c8(0x200)]())[_0xf9c0c8(0x201)]('\x0a')[_0xf9c0c8(0x1f0)](_0x5aad60=>_0x5aad60[_0xf9c0c8(0x20c)](_0xf9c0c8(0x255)));if(_0x4a2b2b){let _0x2ce1cc=JSON[_0xf9c0c8(0x1e9)](_0x4a2b2b[_0xf9c0c8(0x21a)](0x6));return _0x2ce1cc?.[_0xf9c0c8(0x236)]?.[_0xf9c0c8(0x219)]?.[0x0]?.[_0xf9c0c8(0x200)]?JSON[_0xf9c0c8(0x1e9)](_0x2ce1cc[_0xf9c0c8(0x236)][_0xf9c0c8(0x219)][0x0]['text']):_0x2ce1cc;}return{'ok':!0x1,'error':_0xf9c0c8(0x1e6)};}K[a0_0x1f921f(0x20a)](a0_0x5560f9,async _0x2da047=>{const _0x5df8e8=a0_0x1f921f;let {name:_0x5bd268,arguments:_0x4175d3}=_0x2da047['params'];if(_0x5bd268===_0x5df8e8(0x23c)){let {task_id:_0x4959e8,text:_0x203018,status:_0x3ea46c}=_0x4175d3;if(_0x3ea46c==='completed'||_0x3ea46c===_0x5df8e8(0x242)||_0x3ea46c==='cancelled'){let _0x5ac1e0=_0x3ea46c===_0x5df8e8(0x243)?_0x5df8e8(0x1ea):_0x3ea46c,_0x57d812=_0x4959e8?k[_0x5df8e8(0x1f3)](_0x4959e8)||_0x5df8e8(0x251):_0x5df8e8(0x251),_0x559d4c=await P(_0x5df8e8(0x1f6),{'alias':_0x57d812,'text':_0x203018,'in_reply_to':_0x4959e8||void 0x0,'status':_0x5ac1e0,'from_session':Z});if(_0x4959e8)k['delete'](_0x4959e8);return{'content':[{'type':_0x5df8e8(0x200),'text':JSON[_0x5df8e8(0x22b)](_0x559d4c)}]};}let _0x596c81=await P(_0x5df8e8(0x239),{'resume_id':w,'alias':Z,'status':_0x3ea46c==='blocked'?_0x5df8e8(0x249):_0x3ea46c===_0x5df8e8(0x224)?_0x5df8e8(0x224):_0x5df8e8(0x25d),'task':_0x203018[_0x5df8e8(0x21a)](0x0,0xc8),'output':_0x203018});return{'content':[{'type':_0x5df8e8(0x200),'text':JSON[_0x5df8e8(0x22b)](_0x596c81)}]};}if(_0x5bd268===_0x5df8e8(0x245)){let {status:_0x2dd303,task:_0x33bf6b,progress:_0xf3b3e3}=_0x4175d3,_0x25b3fa=await P(_0x5df8e8(0x239),{'resume_id':w,'alias':Z,'status':_0x2dd303,'task':_0x33bf6b,'progress':_0xf3b3e3});return{'content':[{'type':_0x5df8e8(0x200),'text':JSON[_0x5df8e8(0x22b)](_0x25b3fa)}]};}if(_0x5bd268===_0x5df8e8(0x24c)){let {alias:_0x1e1f5e,task:_0x33477c,priority:_0x2a2ab5}=_0x4175d3,_0x17b25b=await P('send_task',{'alias':_0x1e1f5e,'task':_0x33477c,'priority':_0x2a2ab5||_0x5df8e8(0x241),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x5df8e8(0x22b)](_0x17b25b)}]};}if(_0x5bd268===_0x5df8e8(0x1e3)){let {alias:_0x49a7bd,message:_0x3595dd}=_0x4175d3,_0x48a20a=await P(_0x5df8e8(0x254),{'alias':_0x49a7bd,'message':_0x3595dd,'from_session':Z});return{'content':[{'type':_0x5df8e8(0x200),'text':JSON[_0x5df8e8(0x22b)](_0x48a20a)}]};}if(_0x5bd268===_0x5df8e8(0x1fb)){let _0x223836=await P(_0x5df8e8(0x238),{});return{'content':[{'type':'text','text':JSON['stringify'](_0x223836)}]};}return{'content':[{'type':_0x5df8e8(0x200),'text':JSON[_0x5df8e8(0x22b)]({'error':_0x5df8e8(0x1e4)})}]};});async function u(){const _0x16cec5=a0_0x1f921f;let _0x575aa7=f+_0x16cec5(0x1e8)+encodeURIComponent(Z),_0x57fe5b={};if(X)_0x57fe5b['Authorization']=_0x16cec5(0x259)+X;Y('connecting\x20to\x20'+_0x575aa7);while(!0x0){try{let _0x25dda5=await fetch(_0x575aa7,{'headers':_0x57fe5b});if(!_0x25dda5['ok']){Y('SSE\x20error:\x20'+_0x25dda5[_0x16cec5(0x22f)]+'\x20'+_0x25dda5[_0x16cec5(0x220)]),await h(0x1388);continue;}let _0x1daa25=_0x25dda5[_0x16cec5(0x1f5)][_0x16cec5(0x208)](),_0x32d971=new TextDecoder(),_0x4c0f86='';while(!0x0){let {done:_0x517ed8,value:_0x55076d}=await _0x1daa25[_0x16cec5(0x1f4)]();if(_0x517ed8)break;_0x4c0f86+=_0x32d971[_0x16cec5(0x205)](_0x55076d,{'stream':!0x0});let _0x25ff0f=_0x4c0f86[_0x16cec5(0x201)]('\x0a\x0a');_0x4c0f86=_0x25ff0f['pop']()||'';for(let _0x1911e4 of _0x25ff0f){let _0x4be4f2=_0x1911e4[_0x16cec5(0x201)]('\x0a')[_0x16cec5(0x1f0)](_0x41ad3e=>_0x41ad3e[_0x16cec5(0x20c)]('data:\x20'));if(!_0x4be4f2)continue;try{let _0x301d3b=JSON[_0x16cec5(0x1e9)](_0x4be4f2['slice'](0x6));await S(_0x301d3b);}catch(_0x2801d8){Y('parse\x20error:\x20'+_0x2801d8);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x573617){Y(_0x16cec5(0x212)+_0x573617);}await h(0xbb8);}}async function S(_0x136b3c){const _0x11d270=a0_0x1f921f;if(_0x136b3c[_0x11d270(0x1e5)]===_0x11d270(0x1ec)){Y(_0x11d270(0x1d6)+Z+'\x22');return;}if(_0x136b3c[_0x11d270(0x1e5)]===_0x11d270(0x209)){if(Y(_0x11d270(0x21b)+_0x136b3c[_0x11d270(0x1d4)]+':\x20'+_0x136b3c['message'][_0x11d270(0x21a)](0x0,0x3c)),await K['notification']({'method':_0x11d270(0x1e2),'params':{'content':_0x136b3c[_0x11d270(0x1e1)],'meta':{'sender':_0x136b3c['from']||_0x11d270(0x251),'sender_id':'commhub','user':_0x136b3c['from']||_0x11d270(0x251),'priority':_0x11d270(0x241)}}}),_0x136b3c[_0x11d270(0x1e0)])await P(_0x11d270(0x231),{'alias':Z,'message_id':_0x136b3c[_0x11d270(0x1e0)]});return;}if(_0x136b3c['type']===_0x11d270(0x256)||_0x136b3c['type']==='broadcast'){Y('←\x20'+_0x136b3c[_0x11d270(0x1e5)]+':\x20inbox_count='+_0x136b3c[_0x11d270(0x25c)]+_0x11d270(0x24e)+(_0x136b3c[_0x11d270(0x1d3)]||_0x11d270(0x241)));let _0x35ba66=await P(_0x11d270(0x25b),{'alias':Z,'limit':0x5});if(_0x35ba66?.['ok']&&_0x35ba66[_0x11d270(0x1ed)]?.[_0x11d270(0x22d)]>0x0)for(let _0x3e23a4 of _0x35ba66['messages']){let _0x2f9160={'sender':_0x3e23a4['from_session']||_0x11d270(0x251),'sender_id':_0x11d270(0x1e7),'user':_0x3e23a4[_0x11d270(0x253)]||_0x11d270(0x251),'task_id':_0x3e23a4['id'],'priority':_0x3e23a4[_0x11d270(0x1d3)]||_0x11d270(0x241)};k['set'](_0x3e23a4['id'],_0x3e23a4[_0x11d270(0x253)]||_0x11d270(0x251)),await K[_0x11d270(0x247)]({'method':'notifications/claude/channel','params':{'content':_0x3e23a4['content'],'meta':_0x2f9160}}),Y(_0x11d270(0x221)+_0x3e23a4['id']['slice'](0x0,0x8)+'\x20from\x20'+_0x3e23a4['from_session']+':\x20'+_0x3e23a4[_0x11d270(0x219)][_0x11d270(0x21a)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x3e23a4['id']});}}}async function A(){const _0x1a7e37=a0_0x1f921f;let _0x50cce9=new a0_0x51fe97();await K[_0x1a7e37(0x1f2)](_0x50cce9),Y('MCP\x20stdio\x20connected'),Y('starting\x20SSE\x20listener...'),u()[_0x1a7e37(0x257)](_0xac0d9b=>Y(_0x1a7e37(0x230)+_0xac0d9b)),P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x116d52(),'hostname':a0_0x116d52(),'agent':_0x1a7e37(0x244),'project_dir':process[_0x1a7e37(0x240)](),'tmux_name':j||void 0x0})[_0x1a7e37(0x213)](()=>Y(_0x1a7e37(0x1d8)+Z+'\x22\x20('+w['slice'](0x0,0x8)+')'))[_0x1a7e37(0x257)](_0x5dc817=>Y(_0x1a7e37(0x24f)+_0x5dc817)),setInterval(()=>{const _0x7ff878=_0x1a7e37;P('report_status',{'resume_id':w,'alias':Z,'status':_0x7ff878(0x203),'server':a0_0x116d52(),'hostname':a0_0x116d52(),'agent':_0x7ff878(0x244),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x7ff878(0x257)](_0x24ac6b=>Y(_0x7ff878(0x1da)+_0x24ac6b));},0x2bf20),Y(_0x1a7e37(0x226));}A()[a0_0x1f921f(0x257)](_0x50ad74=>{const _0x1a5465=a0_0x1f921f;Y('fatal:\x20'+_0x50ad74),process[_0x1a5465(0x22e)](0x1);});async function N(){const _0x146193=a0_0x1f921f;Y('shutting\x20down,\x20reporting\x20offline...'),await P(_0x146193(0x239),{'resume_id':w,'alias':Z,'status':'error','task':_0x146193(0x1f7)})[_0x146193(0x257)](()=>{}),process['exit'](0x0);}process[a0_0x1f921f(0x1ee)]['on'](a0_0x1f921f(0x1d7),()=>N()),process['on'](a0_0x1f921f(0x228),()=>N()),process['on']('SIGINT',()=>N());
|
|
2
|
+
const a0_0x58d48d=a0_0x7abb;(function(_0x2366a3,_0x5c6867){const _0x14a577=a0_0x7abb,_0xbe9a4e=_0x2366a3();while(!![]){try{const _0x555280=-parseInt(_0x14a577(0x22b))/0x1*(-parseInt(_0x14a577(0x24f))/0x2)+parseInt(_0x14a577(0x22a))/0x3+parseInt(_0x14a577(0x1dd))/0x4+-parseInt(_0x14a577(0x1f8))/0x5+parseInt(_0x14a577(0x1de))/0x6*(parseInt(_0x14a577(0x1fc))/0x7)+parseInt(_0x14a577(0x225))/0x8+-parseInt(_0x14a577(0x1ce))/0x9;if(_0x555280===_0x5c6867)break;else _0xbe9a4e['push'](_0xbe9a4e['shift']());}catch(_0x436f1d){_0xbe9a4e['push'](_0xbe9a4e['shift']());}}}(a0_0x46ed,0x1fd8e));import{readFileSync as a0_0x456a1f,existsSync as a0_0x17f0d8}from'fs';function a0_0x7abb(_0x42b1c4,_0x4854c0){_0x42b1c4=_0x42b1c4-0x1cc;const _0x46edb1=a0_0x46ed();let _0x7abb53=_0x46edb1[_0x42b1c4];return _0x7abb53;}import{randomUUID as a0_0x593fe0}from'crypto';import{join as a0_0x7684c2}from'path';import{hostname as a0_0x2d76a3}from'os';import{execSync as a0_0x1cdeae}from'child_process';import{Server as a0_0x5ee593}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x4d824c}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x7900e3,CallToolRequestSchema as a0_0x4ea3e6}from'@modelcontextprotocol/sdk/types.js';function p(_0x462df2){const _0x2e397a=a0_0x7abb;if(!a0_0x17f0d8(_0x462df2))return;for(let _0x5c3144 of a0_0x456a1f(_0x462df2,_0x2e397a(0x1eb))[_0x2e397a(0x1df)]('\x0a')){let _0x2edc76=_0x5c3144[_0x2e397a(0x24e)]();if(!_0x2edc76||_0x2edc76[_0x2e397a(0x21c)]('#'))continue;let _0xcc28b=_0x2edc76[_0x2e397a(0x23b)]('=');if(_0xcc28b<0x0)continue;let _0x324622=_0x2edc76[_0x2e397a(0x245)](0x0,_0xcc28b)[_0x2e397a(0x24e)](),_0x350f6f=_0x2edc76[_0x2e397a(0x245)](_0xcc28b+0x1)[_0x2e397a(0x24e)]()[_0x2e397a(0x240)](/^["']|["']$/g,'');if(!process.env[_0x324622])process.env[_0x324622]=_0x350f6f;}}var C=process.env.HOME||'~',T=a0_0x7684c2(C,a0_0x58d48d(0x217));p(a0_0x7684c2(T,a0_0x58d48d(0x230)));var L=process['cwd']()['replace'](/\//g,'-');p(a0_0x7684c2(T,L,a0_0x58d48d(0x230)));function U(){const _0x88dd50=a0_0x58d48d;try{return a0_0x1cdeae(_0x88dd50(0x1f5),{'encoding':_0x88dd50(0x1eb),'timeout':0x7d0})[_0x88dd50(0x24e)]();}catch{return'';}}function v(){const _0x41a5aa=a0_0x58d48d;try{let _0x16e764=a0_0x7684c2(C,_0x41a5aa(0x206),_0x41a5aa(0x22d));if(a0_0x17f0d8(_0x16e764))return JSON[_0x41a5aa(0x224)](a0_0x456a1f(_0x16e764,_0x41a5aa(0x1eb)));}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_0x2d76a3(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x593fe0(),X=process.env.COMMHUB_TOKEN||H[a0_0x58d48d(0x208)]||'';function Y(_0x320eed){const _0x134024=a0_0x58d48d;let _0x4223c8=new Date()['toTimeString']()[_0x134024(0x245)](0x0,0x8);process[_0x134024(0x1f9)][_0x134024(0x220)]('['+_0x4223c8+']\x20[commhub]\x20'+_0x320eed+'\x0a');}function h(_0x18c76a){return new Promise(_0x483c3d=>setTimeout(_0x483c3d,_0x18c76a));}Y(a0_0x58d48d(0x1ec)+f+a0_0x58d48d(0x215)+Z+a0_0x58d48d(0x237)+w[a0_0x58d48d(0x245)](0x0,0x8)+'...\x20TMUX='+(j||a0_0x58d48d(0x22e))+a0_0x58d48d(0x1d0)+process['cwd']()+a0_0x58d48d(0x20a)+L);function a0_0x46ed(){const _0x510255=['parse\x20error:\x20','idle','shutting\x20down,\x20reporting\x20offline...','low','session\x20disconnected','data:\x20','Authorization','4634514HVcZBo','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','\x20CWD=','completed',':\x20inbox_count=','get','commhub_report_status','type','SSE\x20error:\x20','string','working','Bearer\x20','commhub_reply','commhub_send_message','from_session','923480SlaOdK','204ZjlZwf','split','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','getReader','status','CommHub\x20init\x20failed:\x20','report_status','/events/','number','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','connect','←\x20message\x20from\x20','Progress\x200-100','utf-8','ENV:\x20URL=','application/json','decode','commhub_send_task','broadcast','init\x20failed:\x20','SIGTERM','\x22\x20(','/mcp','tmux\x20display-message\x20-p\x20\x27#S\x27','blocked','from','1006720fNGfQY','stderr','connecting\x20to\x20','connected','11214Dnhrul','SSE\x20stream\x20ended,\x20reconnecting...','registered\x20as\x20\x22','new_message','\x20from\x20','catch','2025-03-26','object','no\x20response','POST','.anet','Session\x20alias:\x20','token','Priority\x20(default:\x20normal)','\x20PROJECT_ENV=','stringify','initialize','message_id','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','unknown\x20tool','exit','MCP\x20stdio\x20connected','setRequestHandler','fatal:\x20','claude-code','\x20ALIAS=','alias','.claude/channels/commhub','→\x20injected\x20task\x20','commhub-channel','notification','inbox_count','startsWith','SIGINT','Target\x20session\x20alias','ready\x20—\x20waiting\x20for\x20events','write','application/json,\x20text/event-stream','content','result','parse','1135544qEkBeY','message','\x20priority=','cwd','ack_inbox','570147Vsyxck','38HPXcwo','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','config.json','none','starting\x20SSE\x20listener...','.env','replied','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','read','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','cancelled','text','\x20RESUME_ID=','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','messages','normal','indexOf','stdin','statusText','notifications/claude/channel','commhub','replace','send_task','find','new_task','delete','slice','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','high','get_all_status','send_message','task','hub','SSE\x20connection\x20error:\x20','commhub_get_all_status','trim','12074iwqHhM','error'];a0_0x46ed=function(){return _0x510255;};return a0_0x46ed();}var k=new Map(),K=new a0_0x5ee593({'name':'commhub-channel','version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x58d48d(0x234),a0_0x58d48d(0x1e0),a0_0x58d48d(0x238),a0_0x58d48d(0x1e7),a0_0x58d48d(0x207)+Z]['join']('\x0a')});K[a0_0x58d48d(0x212)](a0_0x7900e3,async()=>({'tools':[{'name':a0_0x58d48d(0x1da),'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_0x58d48d(0x1d7),'description':a0_0x58d48d(0x232)},'text':{'type':a0_0x58d48d(0x1d7),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':'string','enum':[a0_0x58d48d(0x1d1),'failed','cancelled',a0_0x58d48d(0x1f6),a0_0x58d48d(0x250),'in_progress'],'description':a0_0x58d48d(0x1cf)}},'required':['text']}},{'name':a0_0x58d48d(0x1d4),'description':a0_0x58d48d(0x20e),'inputSchema':{'type':a0_0x58d48d(0x203),'properties':{'status':{'type':a0_0x58d48d(0x1d7),'enum':[a0_0x58d48d(0x1d8),a0_0x58d48d(0x252),a0_0x58d48d(0x1f6),a0_0x58d48d(0x250)]},'task':{'type':a0_0x58d48d(0x1d7),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x58d48d(0x1e6),'description':a0_0x58d48d(0x1ea)}},'required':['status']}},{'name':a0_0x58d48d(0x1ef),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x58d48d(0x203),'properties':{'alias':{'type':a0_0x58d48d(0x1d7),'description':a0_0x58d48d(0x21e)},'task':{'type':a0_0x58d48d(0x1d7),'description':'Task\x20content'},'priority':{'type':a0_0x58d48d(0x1d7),'enum':[a0_0x58d48d(0x247),'normal',a0_0x58d48d(0x254)],'description':a0_0x58d48d(0x209)}},'required':[a0_0x58d48d(0x216),a0_0x58d48d(0x24a)]}},{'name':a0_0x58d48d(0x1db),'description':a0_0x58d48d(0x22c),'inputSchema':{'type':a0_0x58d48d(0x203),'properties':{'alias':{'type':a0_0x58d48d(0x1d7),'description':a0_0x58d48d(0x21e)},'message':{'type':a0_0x58d48d(0x1d7),'description':'Message\x20content'}},'required':[a0_0x58d48d(0x216),a0_0x58d48d(0x226)]}},{'name':'commhub_get_all_status','description':a0_0x58d48d(0x246),'inputSchema':{'type':a0_0x58d48d(0x203),'properties':{}}}]}));async function P(_0x3e6836,_0x2e9b8c){const _0x24922c=a0_0x58d48d;let _0x266deb=await fetch(f+_0x24922c(0x1f4),{'method':_0x24922c(0x205),'headers':{'Content-Type':_0x24922c(0x1ed),'Accept':_0x24922c(0x221),...X?{'Authorization':_0x24922c(0x1d9)+X}:{}},'body':JSON[_0x24922c(0x20b)]({'jsonrpc':'2.0','id':0x1,'method':_0x24922c(0x20c),'params':{'protocolVersion':_0x24922c(0x202),'capabilities':{},'clientInfo':{'name':_0x24922c(0x219),'version':'0.3.0'}}})});if(!_0x266deb['ok']){let _0x123578=await _0x266deb[_0x24922c(0x236)]();return Y(_0x24922c(0x1e3)+_0x266deb[_0x24922c(0x1e2)]+'\x20'+_0x123578[_0x24922c(0x245)](0x0,0x64)),{'ok':!0x1,'error':_0x24922c(0x1f1)+_0x266deb[_0x24922c(0x1e2)]};}await _0x266deb['text']();let _0x5050c1=(await(await fetch(f+_0x24922c(0x1f4),{'method':_0x24922c(0x205),'headers':{'Content-Type':'application/json','Accept':_0x24922c(0x221),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x24922c(0x20b)]({'jsonrpc':'2.0','id':0x2,'method':'tools/call','params':{'name':_0x3e6836,'arguments':_0x2e9b8c}})}))[_0x24922c(0x236)]())[_0x24922c(0x1df)]('\x0a')[_0x24922c(0x242)](_0x40d201=>_0x40d201[_0x24922c(0x21c)]('data:\x20'));if(_0x5050c1){let _0x4d4b2f=JSON[_0x24922c(0x224)](_0x5050c1['slice'](0x6));return _0x4d4b2f?.[_0x24922c(0x223)]?.[_0x24922c(0x222)]?.[0x0]?.[_0x24922c(0x236)]?JSON[_0x24922c(0x224)](_0x4d4b2f[_0x24922c(0x223)][_0x24922c(0x222)][0x0][_0x24922c(0x236)]):_0x4d4b2f;}return{'ok':!0x1,'error':_0x24922c(0x204)};}K[a0_0x58d48d(0x212)](a0_0x4ea3e6,async _0x5eeb50=>{const _0x3daec5=a0_0x58d48d;let {name:_0x5c2862,arguments:_0x3ce248}=_0x5eeb50['params'];if(_0x5c2862==='commhub_reply'){let {task_id:_0xf43fb8,text:_0x20843d,status:_0x4a44cd}=_0x3ce248;if(_0x4a44cd===_0x3daec5(0x1d1)||_0x4a44cd==='failed'||_0x4a44cd===_0x3daec5(0x235)){let _0x539c27=_0x4a44cd===_0x3daec5(0x1d1)?_0x3daec5(0x231):_0x4a44cd,_0x54259f=_0xf43fb8?k[_0x3daec5(0x1d3)](_0xf43fb8)||'hub':'hub',_0x1e8a90=await P('send_reply',{'alias':_0x54259f,'text':_0x20843d,'in_reply_to':_0xf43fb8||void 0x0,'status':_0x539c27,'from_session':Z});if(_0xf43fb8)k[_0x3daec5(0x244)](_0xf43fb8);return{'content':[{'type':'text','text':JSON[_0x3daec5(0x20b)](_0x1e8a90)}]};}let _0x51a6bd=await P(_0x3daec5(0x1e4),{'resume_id':w,'alias':Z,'status':_0x4a44cd===_0x3daec5(0x1f6)?_0x3daec5(0x1f6):_0x4a44cd===_0x3daec5(0x250)?_0x3daec5(0x250):_0x3daec5(0x1d8),'task':_0x20843d['slice'](0x0,0xc8),'output':_0x20843d});return{'content':[{'type':'text','text':JSON['stringify'](_0x51a6bd)}]};}if(_0x5c2862==='commhub_report_status'){let {status:_0x487cb1,task:_0x1973d9,progress:_0x33c2ab}=_0x3ce248,_0x5be67a=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x487cb1,'task':_0x1973d9,'progress':_0x33c2ab});return{'content':[{'type':_0x3daec5(0x236),'text':JSON[_0x3daec5(0x20b)](_0x5be67a)}]};}if(_0x5c2862===_0x3daec5(0x1ef)){let {alias:_0x5b3ebd,task:_0x34af65,priority:_0x12c167}=_0x3ce248,_0x3b9a41=await P(_0x3daec5(0x241),{'alias':_0x5b3ebd,'task':_0x34af65,'priority':_0x12c167||_0x3daec5(0x23a),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x3daec5(0x20b)](_0x3b9a41)}]};}if(_0x5c2862==='commhub_send_message'){let {alias:_0x79f536,message:_0x48078a}=_0x3ce248,_0x15784f=await P(_0x3daec5(0x249),{'alias':_0x79f536,'message':_0x48078a,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x3daec5(0x20b)](_0x15784f)}]};}if(_0x5c2862===_0x3daec5(0x24d)){let _0x47f836=await P(_0x3daec5(0x248),{});return{'content':[{'type':_0x3daec5(0x236),'text':JSON[_0x3daec5(0x20b)](_0x47f836)}]};}return{'content':[{'type':_0x3daec5(0x236),'text':JSON['stringify']({'error':_0x3daec5(0x20f)})}]};});async function u(){const _0x1b6c47=a0_0x58d48d;let _0x14d390=f+_0x1b6c47(0x1e5)+encodeURIComponent(Z),_0x5ba063={};if(X)_0x5ba063[_0x1b6c47(0x1cd)]=_0x1b6c47(0x1d9)+X;Y(_0x1b6c47(0x1fa)+_0x14d390);while(!0x0){try{let _0x510480=await fetch(_0x14d390,{'headers':_0x5ba063});if(!_0x510480['ok']){Y(_0x1b6c47(0x1d6)+_0x510480[_0x1b6c47(0x1e2)]+'\x20'+_0x510480[_0x1b6c47(0x23d)]),await h(0x1388);continue;}let _0xa8f26e=_0x510480['body'][_0x1b6c47(0x1e1)](),_0x3ff95f=new TextDecoder(),_0x4b5dea='';while(!0x0){let {done:_0x569108,value:_0x56fcb8}=await _0xa8f26e[_0x1b6c47(0x233)]();if(_0x569108)break;_0x4b5dea+=_0x3ff95f[_0x1b6c47(0x1ee)](_0x56fcb8,{'stream':!0x0});let _0x56bfd0=_0x4b5dea['split']('\x0a\x0a');_0x4b5dea=_0x56bfd0['pop']()||'';for(let _0x4a499e of _0x56bfd0){let _0x507b1e=_0x4a499e[_0x1b6c47(0x1df)]('\x0a')['find'](_0x2b3b2d=>_0x2b3b2d[_0x1b6c47(0x21c)](_0x1b6c47(0x1cc)));if(!_0x507b1e)continue;try{let _0x4f9262=JSON[_0x1b6c47(0x224)](_0x507b1e[_0x1b6c47(0x245)](0x6));await S(_0x4f9262);}catch(_0x1b0554){Y(_0x1b6c47(0x251)+_0x1b0554);}}}Y(_0x1b6c47(0x1fd));}catch(_0x5a6245){Y(_0x1b6c47(0x24c)+_0x5a6245);}await h(0xbb8);}}async function S(_0x1e72a0){const _0x4b1689=a0_0x58d48d;if(_0x1e72a0[_0x4b1689(0x1d5)]===_0x4b1689(0x1fb)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x1e72a0[_0x4b1689(0x1d5)]===_0x4b1689(0x1ff)){if(Y(_0x4b1689(0x1e9)+_0x1e72a0['from']+':\x20'+_0x1e72a0[_0x4b1689(0x226)]['slice'](0x0,0x3c)),await K[_0x4b1689(0x21a)]({'method':_0x4b1689(0x23e),'params':{'content':_0x1e72a0[_0x4b1689(0x226)],'meta':{'sender':_0x1e72a0[_0x4b1689(0x1f7)]||_0x4b1689(0x24b),'sender_id':_0x4b1689(0x23f),'user':_0x1e72a0[_0x4b1689(0x1f7)]||_0x4b1689(0x24b),'priority':_0x4b1689(0x23a)}}}),_0x1e72a0[_0x4b1689(0x20d)])await P(_0x4b1689(0x229),{'alias':Z,'message_id':_0x1e72a0['message_id']});return;}if(_0x1e72a0[_0x4b1689(0x1d5)]===_0x4b1689(0x243)||_0x1e72a0[_0x4b1689(0x1d5)]===_0x4b1689(0x1f0)){Y('←\x20'+_0x1e72a0['type']+_0x4b1689(0x1d2)+_0x1e72a0[_0x4b1689(0x21b)]+_0x4b1689(0x227)+(_0x1e72a0['priority']||_0x4b1689(0x23a)));let _0x11cdb7=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x11cdb7?.['ok']&&_0x11cdb7[_0x4b1689(0x239)]?.['length']>0x0)for(let _0x168c80 of _0x11cdb7['messages']){let _0x1e499d={'sender':_0x168c80[_0x4b1689(0x1dc)]||_0x4b1689(0x24b),'sender_id':_0x4b1689(0x23f),'user':_0x168c80[_0x4b1689(0x1dc)]||_0x4b1689(0x24b),'task_id':_0x168c80['id'],'priority':_0x168c80['priority']||_0x4b1689(0x23a)};k['set'](_0x168c80['id'],_0x168c80[_0x4b1689(0x1dc)]||_0x4b1689(0x24b)),await K[_0x4b1689(0x21a)]({'method':'notifications/claude/channel','params':{'content':_0x168c80[_0x4b1689(0x222)],'meta':_0x1e499d}}),Y(_0x4b1689(0x218)+_0x168c80['id'][_0x4b1689(0x245)](0x0,0x8)+_0x4b1689(0x200)+_0x168c80[_0x4b1689(0x1dc)]+':\x20'+_0x168c80['content']['slice'](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x168c80['id']});}}}async function A(){const _0x26989f=a0_0x58d48d;let _0x4777b8=new a0_0x4d824c();await K[_0x26989f(0x1e8)](_0x4777b8),Y(_0x26989f(0x211)),Y(_0x26989f(0x22f)),u()['catch'](_0x19e6c4=>Y('SSE\x20fatal:\x20'+_0x19e6c4)),P('report_status',{'resume_id':w,'alias':Z,'status':_0x26989f(0x252),'server':a0_0x2d76a3(),'hostname':a0_0x2d76a3(),'agent':_0x26989f(0x214),'project_dir':process[_0x26989f(0x228)](),'tmux_name':j||void 0x0})['then'](()=>Y(_0x26989f(0x1fe)+Z+_0x26989f(0x1f3)+w[_0x26989f(0x245)](0x0,0x8)+')'))['catch'](_0x4c3ff1=>Y('warning:\x20could\x20not\x20register:\x20'+_0x4c3ff1)),setInterval(()=>{const _0xb3e565=_0x26989f;P(_0xb3e565(0x1e4),{'resume_id':w,'alias':Z,'status':_0xb3e565(0x252),'server':a0_0x2d76a3(),'hostname':a0_0x2d76a3(),'agent':_0xb3e565(0x214),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0xb3e565(0x201)](_0x17b62d=>Y('heartbeat\x20failed:\x20'+_0x17b62d));},0x2bf20),Y(_0x26989f(0x21f));}A()['catch'](_0x4d846c=>{const _0x453c66=a0_0x58d48d;Y(_0x453c66(0x213)+_0x4d846c),process[_0x453c66(0x210)](0x1);});async function N(){const _0x1eadef=a0_0x58d48d;Y(_0x1eadef(0x253)),await P(_0x1eadef(0x1e4),{'resume_id':w,'alias':Z,'status':_0x1eadef(0x250),'task':_0x1eadef(0x255)})[_0x1eadef(0x201)](()=>{}),process['exit'](0x0);}process[a0_0x58d48d(0x23c)]['on']('end',()=>N()),process['on'](a0_0x58d48d(0x1f2),()=>N()),process['on'](a0_0x58d48d(0x21d),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.0.1-preview.
|
|
3
|
+
"version": "2.0.1-preview.2",
|
|
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",
|