@sleep2agi/agent-network 2.1.4-preview.1 → 2.1.4-preview.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +1 -1
- package/dist/src/client.js +1 -1
- package/dist/src/node-server.js +1 -1
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x2fbdc=a0_0x4287;(function(_0x30a7cb,_0x19559a){const _0x2e5f6b=a0_0x4287,_0x216fa9=_0x30a7cb();while(!![]){try{const _0x4e2cf7=-parseInt(_0x2e5f6b(0x1f5))/0x1*(parseInt(_0x2e5f6b(0x1d3))/0x2)+-parseInt(_0x2e5f6b(0x1bb))/0x3*(parseInt(_0x2e5f6b(0x1a8))/0x4)+-parseInt(_0x2e5f6b(0x1d9))/0x5+parseInt(_0x2e5f6b(0x1b6))/0x6+-parseInt(_0x2e5f6b(0x1c3))/0x7*(-parseInt(_0x2e5f6b(0x1e2))/0x8)+-parseInt(_0x2e5f6b(0x1b3))/0x9*(parseInt(_0x2e5f6b(0x1ca))/0xa)+parseInt(_0x2e5f6b(0x1bc))/0xb*(parseInt(_0x2e5f6b(0x1ee))/0xc);if(_0x4e2cf7===_0x19559a)break;else _0x216fa9['push'](_0x216fa9['shift']());}catch(_0x586b16){_0x216fa9['push'](_0x216fa9['shift']());}}}(a0_0x5acb,0x6acbb));function a0_0x5acb(){const _0x35b097=['read','startsWith','SSE\x20failed:\x20','message','ack_inbox','2512520GamJvz','Authorization','url','connected','normal','from_session','type','offline','heartbeatInterval','264jMGPSb','reconnectDelay','connect','min','alias','data:\x20','replace','body','signal','processInbox','cwd','slice','22668bMcJvD','s...','parse','send','call','stringify','pop','13hPBbaf','broadcast','decode','emit','content','task','application/json,\x20text/event-stream','log','running','437336MzDiNW','/events/','now','report_status','connectSSE','send_reply','idle','new_task','sdk','split','new_message','857421SQGnIJ','SSE\x20connected','disconnect','1099056DCdAVv','AbortError','registered','Bearer\x20','inbox\x20error:\x20','18dnkkJv','12782BRJzFp','tools/call','resumeId','heartbeat\x20failed:\x20','disconnected','reply','sleep','26684mcDtpD','name','agent','get_all_status','completed','status','catch','20xtEaTY','get_inbox','token','heartbeatTimer','POST','messages','sseAbort','text','abort','110386aAiuhY'];a0_0x5acb=function(){return _0x35b097;};return a0_0x5acb();}function a0_0x4287(_0x59693a,_0x3b6972){_0x59693a=_0x59693a-0x1a0;const _0x5acb1e=a0_0x5acb();let _0x428761=_0x5acb1e[_0x59693a];return _0x428761;}import{EventEmitter as a0_0x365f9f}from'events';import{hostname as a0_0x2aa09e}from'os';class T extends a0_0x365f9f{[a0_0x2fbdc(0x1db)];[a0_0x2fbdc(0x1e6)];[a0_0x2fbdc(0x1cc)];[a0_0x2fbdc(0x1c5)];['resumeId'];['heartbeatInterval'];[a0_0x2fbdc(0x1e3)];[a0_0x2fbdc(0x1cd)];[a0_0x2fbdc(0x1d0)];['running']=!0x1;constructor(_0x5843d2){const _0x4c0af9=a0_0x2fbdc;super();if(this[_0x4c0af9(0x1db)]=_0x5843d2[_0x4c0af9(0x1db)][_0x4c0af9(0x1e8)](/\/$/,''),this[_0x4c0af9(0x1e6)]=_0x5843d2[_0x4c0af9(0x1e6)],this[_0x4c0af9(0x1cc)]=_0x5843d2[_0x4c0af9(0x1cc)],this[_0x4c0af9(0x1c5)]=_0x5843d2[_0x4c0af9(0x1c5)]||_0x4c0af9(0x1b0),this[_0x4c0af9(0x1be)]='sdk-'+_0x5843d2[_0x4c0af9(0x1e6)]+'-'+Date[_0x4c0af9(0x1aa)]()['toString'](0x24),this[_0x4c0af9(0x1e1)]=_0x5843d2[_0x4c0af9(0x1e1)]??0x2bf20,this[_0x4c0af9(0x1e3)]=_0x5843d2[_0x4c0af9(0x1e3)]??0xbb8,_0x5843d2['autoConnect']!==!0x1)this[_0x4c0af9(0x1e4)]();}['log'](_0x3c65a7){const _0x376946=a0_0x2fbdc;console[_0x376946(0x1a6)]('['+new Date()['toTimeString']()[_0x376946(0x1ed)](0x0,0x8)+']\x20[commhub:'+this[_0x376946(0x1e6)]+']\x20'+_0x3c65a7);}async[a0_0x2fbdc(0x1f2)](_0x430500,_0x2a7954){const _0x388d28=a0_0x2fbdc;let _0x72314={'Content-Type':'application/json','Accept':_0x388d28(0x1a5)};if(this[_0x388d28(0x1cc)])_0x72314['Authorization']='Bearer\x20'+this[_0x388d28(0x1cc)];let _0x249f05=await(await fetch(this[_0x388d28(0x1db)]+'/mcp',{'method':_0x388d28(0x1ce),'headers':_0x72314,'body':JSON[_0x388d28(0x1f3)]({'jsonrpc':'2.0','id':Date[_0x388d28(0x1aa)](),'method':_0x388d28(0x1bd),'params':{'name':_0x430500,'arguments':_0x2a7954}})}))[_0x388d28(0x1d1)](),_0x33d9b5=_0x249f05['match'](/data: (.+)/),_0x313078=_0x33d9b5?JSON['parse'](_0x33d9b5[0x1]):JSON[_0x388d28(0x1f0)](_0x249f05),_0x4efcb0=_0x313078?.['result']?.[_0x388d28(0x1a3)]?.[0x0]?.[_0x388d28(0x1d1)];return _0x4efcb0?JSON['parse'](_0x4efcb0):_0x313078;}async[a0_0x2fbdc(0x1e4)](){const _0x3fa2f1=a0_0x2fbdc;if(this[_0x3fa2f1(0x1a7)])return;this[_0x3fa2f1(0x1a7)]=!0x0,await this[_0x3fa2f1(0x1c8)](_0x3fa2f1(0x1ae)),this['log'](_0x3fa2f1(0x1b8)),this[_0x3fa2f1(0x1cd)]=setInterval(()=>{const _0x206bea=_0x3fa2f1;this['status'](_0x206bea(0x1ae))[_0x206bea(0x1c9)](_0xc08f34=>this[_0x206bea(0x1a6)](_0x206bea(0x1bf)+_0xc08f34[_0x206bea(0x1d7)]));},this[_0x3fa2f1(0x1e1)]),this[_0x3fa2f1(0x1ac)]();}async[a0_0x2fbdc(0x1b5)](){const _0x8d4c90=a0_0x2fbdc;if(this['running']=!0x1,this[_0x8d4c90(0x1d0)]?.[_0x8d4c90(0x1d2)](),this[_0x8d4c90(0x1cd)])clearInterval(this[_0x8d4c90(0x1cd)]);await this[_0x8d4c90(0x1c8)](_0x8d4c90(0x1e0))[_0x8d4c90(0x1c9)](()=>{}),this[_0x8d4c90(0x1a6)]('disconnected');}async[a0_0x2fbdc(0x1f1)](_0x2a6750,_0x59d654,_0x11a907=a0_0x2fbdc(0x1dd)){const _0x503107=a0_0x2fbdc;return this[_0x503107(0x1f2)]('send_task',{'alias':_0x2a6750,'task':_0x59d654,'priority':_0x11a907,'from_session':this['alias']});}async['message'](_0x3e1784,_0x2d5953){const _0x111be2=a0_0x2fbdc;return this['call']('send_message',{'alias':_0x3e1784,'message':_0x2d5953,'from_session':this[_0x111be2(0x1e6)]});}async[a0_0x2fbdc(0x1c1)](_0x4964a9,_0x116ff3,_0x10598d=a0_0x2fbdc(0x1c7)){const _0x1ebca0=a0_0x2fbdc;return this[_0x1ebca0(0x1f2)](_0x1ebca0(0x1ad),{'in_reply_to':_0x4964a9,'text':_0x116ff3,'status':_0x10598d});}async['status'](_0x5bb231,_0x241ae8){const _0x4d5765=a0_0x2fbdc;return this[_0x4d5765(0x1f2)](_0x4d5765(0x1ab),{'resume_id':this[_0x4d5765(0x1be)],'alias':this[_0x4d5765(0x1e6)],'status':_0x5bb231,'server':a0_0x2aa09e(),'hostname':a0_0x2aa09e(),'agent':this['agent'],'project_dir':process[_0x4d5765(0x1ec)](),..._0x241ae8});}async['getAllStatus'](){const _0x2e8cf8=a0_0x2fbdc;return this[_0x2e8cf8(0x1f2)](_0x2e8cf8(0x1c6),{});}async[a0_0x2fbdc(0x1a0)](_0x41b149,_0x18f905){const _0x382f3e=a0_0x2fbdc;return this[_0x382f3e(0x1f2)](_0x382f3e(0x1a0),{'message':_0x41b149,'filter_server':_0x18f905?.['server'],'filter_status':_0x18f905?.[_0x382f3e(0x1c8)]});}async[a0_0x2fbdc(0x1ac)](){const _0x3e4f28=a0_0x2fbdc;let _0x1732ad=encodeURIComponent(this[_0x3e4f28(0x1e6)]),_0xdc8b30=this[_0x3e4f28(0x1db)]+_0x3e4f28(0x1a9)+_0x1732ad,_0x3624ef=this['reconnectDelay'];while(this[_0x3e4f28(0x1a7)]){try{this['sseAbort']=new AbortController();let _0x462178={'Accept':'text/event-stream'};if(this['token'])_0x462178[_0x3e4f28(0x1da)]=_0x3e4f28(0x1b9)+this[_0x3e4f28(0x1cc)];let _0x3d708f=await fetch(_0xdc8b30,{'headers':_0x462178,'signal':this['sseAbort'][_0x3e4f28(0x1ea)]});if(!_0x3d708f['ok']||!_0x3d708f[_0x3e4f28(0x1e9)]){this[_0x3e4f28(0x1a6)](_0x3e4f28(0x1d6)+_0x3d708f[_0x3e4f28(0x1c8)]),await this[_0x3e4f28(0x1c2)](_0x3624ef),_0x3624ef=Math['min'](_0x3624ef*1.5,0xea60);continue;}_0x3624ef=this['reconnectDelay'];let _0x531614=_0x3d708f[_0x3e4f28(0x1e9)]['getReader'](),_0x9e8c43=new TextDecoder(),_0x1127e5='';while(this[_0x3e4f28(0x1a7)]){let {done:_0x4b07a8,value:_0x1ec9f4}=await _0x531614[_0x3e4f28(0x1d4)]();if(_0x4b07a8)break;_0x1127e5+=_0x9e8c43[_0x3e4f28(0x1a1)](_0x1ec9f4,{'stream':!0x0});let _0x4a7e31=_0x1127e5[_0x3e4f28(0x1b1)]('\x0a');_0x1127e5=_0x4a7e31[_0x3e4f28(0x1f4)]()||'';for(let _0x47223d of _0x4a7e31){if(!_0x47223d[_0x3e4f28(0x1d5)](_0x3e4f28(0x1e7)))continue;try{let _0x25c75d=JSON[_0x3e4f28(0x1f0)](_0x47223d['slice'](0x6));if(_0x25c75d[_0x3e4f28(0x1df)]===_0x3e4f28(0x1dc)){this['log'](_0x3e4f28(0x1b4)),this[_0x3e4f28(0x1a2)](_0x3e4f28(0x1dc));continue;}if(_0x25c75d[_0x3e4f28(0x1df)]===_0x3e4f28(0x1af)||_0x25c75d[_0x3e4f28(0x1df)]===_0x3e4f28(0x1b2)||_0x25c75d[_0x3e4f28(0x1df)]===_0x3e4f28(0x1a0))await this[_0x3e4f28(0x1eb)]();}catch{}}}}catch(_0x52246f){if(_0x52246f[_0x3e4f28(0x1c4)]===_0x3e4f28(0x1b7))break;this[_0x3e4f28(0x1a2)]('error',_0x52246f),this[_0x3e4f28(0x1a6)]('SSE\x20error:\x20'+_0x52246f['message']);}if(this[_0x3e4f28(0x1a7)])this[_0x3e4f28(0x1a2)](_0x3e4f28(0x1c0)),this[_0x3e4f28(0x1a6)]('SSE\x20reconnecting\x20in\x20'+_0x3624ef/0x3e8+_0x3e4f28(0x1ef)),await this[_0x3e4f28(0x1c2)](_0x3624ef),_0x3624ef=Math[_0x3e4f28(0x1e5)](_0x3624ef*1.5,0xea60);}}async[a0_0x2fbdc(0x1eb)](){const _0x47c3e1=a0_0x2fbdc;try{let _0x38f8d0=(await this[_0x47c3e1(0x1f2)](_0x47c3e1(0x1cb),{'alias':this['alias'],'limit':0xa}))?.[_0x47c3e1(0x1cf)]||[];for(let _0x4b7d90 of _0x38f8d0)await this[_0x47c3e1(0x1f2)](_0x47c3e1(0x1d8),{'alias':this[_0x47c3e1(0x1e6)],'message_id':_0x4b7d90['id']}),this[_0x47c3e1(0x1a6)]('←\x20'+_0x4b7d90[_0x47c3e1(0x1de)]+':\x20'+_0x4b7d90['content'][_0x47c3e1(0x1ed)](0x0,0x3c)),this[_0x47c3e1(0x1a2)](_0x47c3e1(0x1a4),_0x4b7d90),this[_0x47c3e1(0x1a2)](_0x47c3e1(0x1d7),_0x4b7d90);}catch(_0x3f77ce){this[_0x47c3e1(0x1a6)](_0x47c3e1(0x1ba)+_0x3f77ce[_0x47c3e1(0x1d7)]);}}[a0_0x2fbdc(0x1c2)](_0x41d52c){return new Promise(_0x2db790=>setTimeout(_0x2db790,_0x41d52c));}}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_0x5b38a4=a0_0x55df;(function(_0x436eea,_0x125448){const _0x449d99=a0_0x55df,_0x1b9ccc=_0x436eea();while(!![]){try{const _0x52d89d=parseInt(_0x449d99(0x1cf))/0x1*(-parseInt(_0x449d99(0x1d3))/0x2)+-parseInt(_0x449d99(0x1d1))/0x3+parseInt(_0x449d99(0x1bf))/0x4*(parseInt(_0x449d99(0x235))/0x5)+parseInt(_0x449d99(0x247))/0x6+-parseInt(_0x449d99(0x1f4))/0x7*(-parseInt(_0x449d99(0x1c7))/0x8)+-parseInt(_0x449d99(0x1f5))/0x9+parseInt(_0x449d99(0x211))/0xa;if(_0x52d89d===_0x125448)break;else _0x1b9ccc['push'](_0x1b9ccc['shift']());}catch(_0x1173f6){_0x1b9ccc['push'](_0x1b9ccc['shift']());}}}(a0_0x2ea5,0x57148));import{readFileSync as a0_0x3f5c70,existsSync as a0_0x350bc6}from'fs';function a0_0x2ea5(){const _0x5c37ac=['SIGTERM','ready\x20—\x20waiting\x20for\x20events','type','connect','cancelled','end','56TWxDmj','completed','SSE\x20connected\x20as\x20\x22','session\x20disconnected','/mcp','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','fatal:\x20','.claude/channels/commhub','7Wmnkbr',':\x20inbox_count=','1775151UIWFmn','application/json','69262tLbhlO','messages','registered\x20as\x20\x22','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','Progress\x200-100','commhub_get_all_status','number','stringify','normal','commhub_reply','getReader','send_task','Bearer\x20','error','ENV:\x20URL=','from_session','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','.anet',']\x20[commhub]\x20','find','read','commhub-channel','get_inbox','init\x20failed:\x20','http://127.0.0.1:9200','startsWith','result','POST','unknown\x20tool','\x20PROJECT_ENV=','commhub_send_message','failed','Current\x20task\x20description','40971pNAzKp','469665khdBbu','2.0','notifications/claude/channel','token','SIGINT','Message\x20content','SSE\x20connection\x20error:\x20','commhub_report_status','from','string','delete','new_message','stdin','shutting\x20down,\x20reporting\x20offline...','utf-8','CommHub\x20init\x20failed:\x20','...\x20TMUX=','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','config.json','Reply\x20text\x20/\x20result\x20summary','report_status','working','send_message','commhub','commhub_send_task','2025-03-26','parse','body','5467470wZKkVl','length','initialize','content','none','.env','join','SSE\x20error:\x20','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','message','text','message_id','warning:\x20could\x20not\x20register:\x20','alias','get_all_status','statusText','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','priority','\x20ALIAS=','indexOf','connecting\x20to\x20','in_progress','tools/call','task','catch','ack_inbox','new_task','inbox_count','broadcast','status','connected','blocked','0.3.0','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','params','cwd','22985OFEEvM','Priority\x20(default:\x20normal)','claude-code','application/json,\x20text/event-stream','replace','decode','trim','data:\x20','split','hub','write','set','pop','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','idle','object','parse\x20error:\x20','slice','3738612uHzWMH','\x20from\x20','\x20CWD=','exit','28RdvqUR','starting\x20SSE\x20listener...'];a0_0x2ea5=function(){return _0x5c37ac;};return a0_0x2ea5();}function a0_0x55df(_0x5f350e,_0x5bc098){_0x5f350e=_0x5f350e-0x1bd;const _0x2ea557=a0_0x2ea5();let _0x55df61=_0x2ea557[_0x5f350e];return _0x55df61;}import{randomUUID as a0_0x9694bc}from'crypto';import{join as a0_0x4d4127}from'path';import{hostname as a0_0x5aeccf}from'os';import{execSync as a0_0xf91634}from'child_process';import{Server as a0_0x4ac13f}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x4b1cae}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0xafe26,CallToolRequestSchema as a0_0x1bcf14}from'@modelcontextprotocol/sdk/types.js';function p(_0x1be2e8){const _0x39869f=a0_0x55df;if(!a0_0x350bc6(_0x1be2e8))return;for(let _0x83c282 of a0_0x3f5c70(_0x1be2e8,_0x39869f(0x203))[_0x39869f(0x23d)]('\x0a')){let _0x369eba=_0x83c282[_0x39869f(0x23b)]();if(!_0x369eba||_0x369eba[_0x39869f(0x1ec)]('#'))continue;let _0x277320=_0x369eba[_0x39869f(0x224)]('=');if(_0x277320<0x0)continue;let _0x159727=_0x369eba[_0x39869f(0x246)](0x0,_0x277320)[_0x39869f(0x23b)](),_0x52db11=_0x369eba[_0x39869f(0x246)](_0x277320+0x1)[_0x39869f(0x23b)]()[_0x39869f(0x239)](/^["']|["']$/g,'');if(!process.env[_0x159727])process.env[_0x159727]=_0x52db11;}}var C=process.env.HOME||'~',T=a0_0x4d4127(C,a0_0x5b38a4(0x1ce));p(a0_0x4d4127(T,'.env'));var L=process['cwd']()[a0_0x5b38a4(0x239)](/\//g,'-');p(a0_0x4d4127(T,L,a0_0x5b38a4(0x216)));function U(){const _0x23c3df=a0_0x5b38a4;try{return a0_0xf91634('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':'utf-8','timeout':0x7d0})[_0x23c3df(0x23b)]();}catch{return'';}}function v(){const _0x5c1453=a0_0x5b38a4;try{let _0x468df1=a0_0x4d4127(C,_0x5c1453(0x1e4),_0x5c1453(0x207));if(a0_0x350bc6(_0x468df1))return JSON['parse'](a0_0x3f5c70(_0x468df1,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x5b38a4(0x23e)]||a0_0x5b38a4(0x1eb),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x5aeccf(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x9694bc(),X=process.env.COMMHUB_TOKEN||H[a0_0x5b38a4(0x1f8)]||'';function Y(_0x281fdc){const _0x2e8772=a0_0x5b38a4;let _0x3711dd=new Date()['toTimeString']()[_0x2e8772(0x246)](0x0,0x8);process['stderr'][_0x2e8772(0x23f)]('['+_0x3711dd+_0x2e8772(0x1e5)+_0x281fdc+'\x0a');}function h(_0x40f46e){return new Promise(_0x332d90=>setTimeout(_0x332d90,_0x40f46e));}Y(a0_0x5b38a4(0x1e1)+f+a0_0x5b38a4(0x223)+Z+'\x20RESUME_ID='+w[a0_0x5b38a4(0x246)](0x0,0x8)+a0_0x5b38a4(0x205)+(j||a0_0x5b38a4(0x215))+a0_0x5b38a4(0x1bd)+process[a0_0x5b38a4(0x234)]()+a0_0x5b38a4(0x1f0)+L);var k=new Map(),K=new a0_0x4ac13f({'name':a0_0x5b38a4(0x1e8),'version':a0_0x5b38a4(0x231)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x5b38a4(0x242),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x5b38a4(0x221),a0_0x5b38a4(0x1e3),'Session\x20alias:\x20'+Z][a0_0x5b38a4(0x217)]('\x0a')});K['setRequestHandler'](a0_0xafe26,async()=>({'tools':[{'name':a0_0x5b38a4(0x1dc),'description':a0_0x5b38a4(0x232),'inputSchema':{'type':a0_0x5b38a4(0x244),'properties':{'task_id':{'type':a0_0x5b38a4(0x1fe),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x5b38a4(0x1fe),'description':a0_0x5b38a4(0x208)},'status':{'type':a0_0x5b38a4(0x1fe),'enum':[a0_0x5b38a4(0x1c8),a0_0x5b38a4(0x1f2),'cancelled',a0_0x5b38a4(0x230),a0_0x5b38a4(0x1e0),a0_0x5b38a4(0x226)],'description':a0_0x5b38a4(0x1d6)}},'required':[a0_0x5b38a4(0x21b)]}},{'name':a0_0x5b38a4(0x1fc),'description':a0_0x5b38a4(0x219),'inputSchema':{'type':a0_0x5b38a4(0x244),'properties':{'status':{'type':a0_0x5b38a4(0x1fe),'enum':[a0_0x5b38a4(0x20a),'idle',a0_0x5b38a4(0x230),'error']},'task':{'type':'string','description':a0_0x5b38a4(0x1f3)},'progress':{'type':a0_0x5b38a4(0x1d9),'description':a0_0x5b38a4(0x1d7)}},'required':['status']}},{'name':a0_0x5b38a4(0x20d),'description':a0_0x5b38a4(0x206),'inputSchema':{'type':a0_0x5b38a4(0x244),'properties':{'alias':{'type':a0_0x5b38a4(0x1fe),'description':'Target\x20session\x20alias'},'task':{'type':'string','description':'Task\x20content'},'priority':{'type':'string','enum':['high',a0_0x5b38a4(0x1db),'low'],'description':a0_0x5b38a4(0x236)}},'required':[a0_0x5b38a4(0x21e),a0_0x5b38a4(0x228)]}},{'name':a0_0x5b38a4(0x1f1),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x5b38a4(0x244),'properties':{'alias':{'type':a0_0x5b38a4(0x1fe),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x5b38a4(0x1fe),'description':a0_0x5b38a4(0x1fa)}},'required':[a0_0x5b38a4(0x21e),a0_0x5b38a4(0x21a)]}},{'name':'commhub_get_all_status','description':a0_0x5b38a4(0x1cc),'inputSchema':{'type':a0_0x5b38a4(0x244),'properties':{}}}]}));async function P(_0x3cc048,_0x2fc1c6){const _0x351904=a0_0x5b38a4;let _0x4574b6=await fetch(f+_0x351904(0x1cb),{'method':'POST','headers':{'Content-Type':_0x351904(0x1d2),'Accept':_0x351904(0x238),...X?{'Authorization':_0x351904(0x1df)+X}:{}},'body':JSON[_0x351904(0x1da)]({'jsonrpc':_0x351904(0x1f6),'id':0x1,'method':_0x351904(0x213),'params':{'protocolVersion':_0x351904(0x20e),'capabilities':{},'clientInfo':{'name':_0x351904(0x1e8),'version':_0x351904(0x231)}}})});if(!_0x4574b6['ok']){let _0x3db7ea=await _0x4574b6[_0x351904(0x21b)]();return Y(_0x351904(0x204)+_0x4574b6[_0x351904(0x22e)]+'\x20'+_0x3db7ea[_0x351904(0x246)](0x0,0x64)),{'ok':!0x1,'error':_0x351904(0x1ea)+_0x4574b6[_0x351904(0x22e)]};}await _0x4574b6[_0x351904(0x21b)]();let _0x3c8ca2=(await(await fetch(f+_0x351904(0x1cb),{'method':_0x351904(0x1ee),'headers':{'Content-Type':_0x351904(0x1d2),'Accept':_0x351904(0x238),...X?{'Authorization':_0x351904(0x1df)+X}:{}},'body':JSON[_0x351904(0x1da)]({'jsonrpc':'2.0','id':0x2,'method':_0x351904(0x227),'params':{'name':_0x3cc048,'arguments':_0x2fc1c6}})}))[_0x351904(0x21b)]())[_0x351904(0x23d)]('\x0a')[_0x351904(0x1e6)](_0x327010=>_0x327010[_0x351904(0x1ec)]('data:\x20'));if(_0x3c8ca2){let _0x580582=JSON[_0x351904(0x20f)](_0x3c8ca2['slice'](0x6));return _0x580582?.['result']?.[_0x351904(0x214)]?.[0x0]?.[_0x351904(0x21b)]?JSON[_0x351904(0x20f)](_0x580582[_0x351904(0x1ed)]['content'][0x0][_0x351904(0x21b)]):_0x580582;}return{'ok':!0x1,'error':'no\x20response'};}K['setRequestHandler'](a0_0x1bcf14,async _0xa00534=>{const _0x2f3b82=a0_0x5b38a4;let {name:_0x3bedaa,arguments:_0x55a39d}=_0xa00534[_0x2f3b82(0x233)];if(_0x3bedaa===_0x2f3b82(0x1dc)){let {task_id:_0x3887c2,text:_0x31088,status:_0x2f1318}=_0x55a39d;if(_0x2f1318===_0x2f3b82(0x1c8)||_0x2f1318===_0x2f3b82(0x1f2)||_0x2f1318===_0x2f3b82(0x1c5)){let _0x546230=_0x2f1318===_0x2f3b82(0x1c8)?'replied':_0x2f1318,_0x3e79b2=_0x3887c2?k['get'](_0x3887c2)||_0x2f3b82(0x23e):'hub',_0x2542db=await P('send_reply',{'alias':_0x3e79b2,'text':_0x31088,'in_reply_to':_0x3887c2||void 0x0,'status':_0x546230,'from_session':Z});if(_0x3887c2)k[_0x2f3b82(0x1ff)](_0x3887c2);return{'content':[{'type':_0x2f3b82(0x21b),'text':JSON[_0x2f3b82(0x1da)](_0x2542db)}]};}let _0x2f3243=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x2f1318===_0x2f3b82(0x230)?_0x2f3b82(0x230):_0x2f1318===_0x2f3b82(0x1e0)?'error':'working','task':_0x31088[_0x2f3b82(0x246)](0x0,0xc8),'output':_0x31088});return{'content':[{'type':_0x2f3b82(0x21b),'text':JSON[_0x2f3b82(0x1da)](_0x2f3243)}]};}if(_0x3bedaa===_0x2f3b82(0x1fc)){let {status:_0x10c65f,task:_0x2c36bd,progress:_0x247cbc}=_0x55a39d,_0x30f8ac=await P(_0x2f3b82(0x209),{'resume_id':w,'alias':Z,'status':_0x10c65f,'task':_0x2c36bd,'progress':_0x247cbc});return{'content':[{'type':_0x2f3b82(0x21b),'text':JSON[_0x2f3b82(0x1da)](_0x30f8ac)}]};}if(_0x3bedaa==='commhub_send_task'){let {alias:_0x4ff75d,task:_0x10e012,priority:_0x3fbc1d}=_0x55a39d,_0x454590=await P(_0x2f3b82(0x1de),{'alias':_0x4ff75d,'task':_0x10e012,'priority':_0x3fbc1d||_0x2f3b82(0x1db),'from_session':Z});return{'content':[{'type':_0x2f3b82(0x21b),'text':JSON[_0x2f3b82(0x1da)](_0x454590)}]};}if(_0x3bedaa==='commhub_send_message'){let {alias:_0x158663,message:_0x2972d8}=_0x55a39d,_0x41e35b=await P(_0x2f3b82(0x20b),{'alias':_0x158663,'message':_0x2972d8,'from_session':Z});return{'content':[{'type':_0x2f3b82(0x21b),'text':JSON[_0x2f3b82(0x1da)](_0x41e35b)}]};}if(_0x3bedaa===_0x2f3b82(0x1d8)){let _0x52cfd2=await P(_0x2f3b82(0x21f),{});return{'content':[{'type':'text','text':JSON[_0x2f3b82(0x1da)](_0x52cfd2)}]};}return{'content':[{'type':_0x2f3b82(0x21b),'text':JSON[_0x2f3b82(0x1da)]({'error':_0x2f3b82(0x1ef)})}]};});async function u(){const _0x17a5cf=a0_0x5b38a4;let _0x316201=f+'/events/'+encodeURIComponent(Z),_0x22fae2={};if(X)_0x22fae2['Authorization']=_0x17a5cf(0x1df)+X;Y(_0x17a5cf(0x225)+_0x316201);while(!0x0){try{let _0x4f8d34=await fetch(_0x316201,{'headers':_0x22fae2});if(!_0x4f8d34['ok']){Y(_0x17a5cf(0x218)+_0x4f8d34['status']+'\x20'+_0x4f8d34[_0x17a5cf(0x220)]),await h(0x1388);continue;}let _0x34fade=_0x4f8d34[_0x17a5cf(0x210)][_0x17a5cf(0x1dd)](),_0x3336d7=new TextDecoder(),_0x3a6c53='';while(!0x0){let {done:_0x3fc006,value:_0x4d0d00}=await _0x34fade[_0x17a5cf(0x1e7)]();if(_0x3fc006)break;_0x3a6c53+=_0x3336d7[_0x17a5cf(0x23a)](_0x4d0d00,{'stream':!0x0});let _0x282bd3=_0x3a6c53[_0x17a5cf(0x23d)]('\x0a\x0a');_0x3a6c53=_0x282bd3[_0x17a5cf(0x241)]()||'';for(let _0x31bd77 of _0x282bd3){let _0x4908a2=_0x31bd77['split']('\x0a')['find'](_0x33654a=>_0x33654a[_0x17a5cf(0x1ec)](_0x17a5cf(0x23c)));if(!_0x4908a2)continue;try{let _0x38059e=JSON['parse'](_0x4908a2[_0x17a5cf(0x246)](0x6));await S(_0x38059e);}catch(_0x4d7da0){Y(_0x17a5cf(0x245)+_0x4d7da0);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x2773ee){Y(_0x17a5cf(0x1fb)+_0x2773ee);}await h(0xbb8);}}async function S(_0x5427d0){const _0x5cdf77=a0_0x5b38a4;if(_0x5427d0[_0x5cdf77(0x1c3)]===_0x5cdf77(0x22f)){Y(_0x5cdf77(0x1c9)+Z+'\x22');return;}if(_0x5427d0[_0x5cdf77(0x1c3)]===_0x5cdf77(0x200)){if(Y('←\x20message\x20from\x20'+_0x5427d0[_0x5cdf77(0x1fd)]+':\x20'+_0x5427d0[_0x5cdf77(0x21a)][_0x5cdf77(0x246)](0x0,0x3c)),await K['notification']({'method':_0x5cdf77(0x1f7),'params':{'content':_0x5427d0['message'],'meta':{'sender':_0x5427d0[_0x5cdf77(0x1fd)]||_0x5cdf77(0x23e),'sender_id':_0x5cdf77(0x20c),'user':_0x5427d0[_0x5cdf77(0x1fd)]||'hub','priority':_0x5cdf77(0x1db)}}}),_0x5427d0[_0x5cdf77(0x21c)])await P('ack_inbox',{'alias':Z,'message_id':_0x5427d0['message_id']});return;}if(_0x5427d0['type']===_0x5cdf77(0x22b)||_0x5427d0[_0x5cdf77(0x1c3)]===_0x5cdf77(0x22d)){Y('←\x20'+_0x5427d0[_0x5cdf77(0x1c3)]+_0x5cdf77(0x1d0)+_0x5427d0[_0x5cdf77(0x22c)]+'\x20priority='+(_0x5427d0[_0x5cdf77(0x222)]||_0x5cdf77(0x1db)));let _0x3a7891=await P(_0x5cdf77(0x1e9),{'alias':Z,'limit':0x5});if(_0x3a7891?.['ok']&&_0x3a7891[_0x5cdf77(0x1d4)]?.[_0x5cdf77(0x212)]>0x0)for(let _0x14d46f of _0x3a7891[_0x5cdf77(0x1d4)]){let _0x3ccd22={'sender':_0x14d46f['from_session']||_0x5cdf77(0x23e),'sender_id':'commhub','user':_0x14d46f[_0x5cdf77(0x1e2)]||'hub','task_id':_0x14d46f['id'],'priority':_0x14d46f[_0x5cdf77(0x222)]||_0x5cdf77(0x1db)};k[_0x5cdf77(0x240)](_0x14d46f['id'],_0x14d46f[_0x5cdf77(0x1e2)]||'hub'),await K['notification']({'method':_0x5cdf77(0x1f7),'params':{'content':_0x14d46f[_0x5cdf77(0x214)],'meta':_0x3ccd22}}),Y('→\x20injected\x20task\x20'+_0x14d46f['id'][_0x5cdf77(0x246)](0x0,0x8)+_0x5cdf77(0x248)+_0x14d46f[_0x5cdf77(0x1e2)]+':\x20'+_0x14d46f[_0x5cdf77(0x214)][_0x5cdf77(0x246)](0x0,0x3c)),await P(_0x5cdf77(0x22a),{'alias':Z,'message_id':_0x14d46f['id']});}}}async function A(){const _0x30c63b=a0_0x5b38a4;let _0x49b604=new a0_0x4b1cae();await K[_0x30c63b(0x1c4)](_0x49b604),Y('MCP\x20stdio\x20connected'),Y(_0x30c63b(0x1c0)),u()[_0x30c63b(0x229)](_0x577ef6=>Y('SSE\x20fatal:\x20'+_0x577ef6)),P(_0x30c63b(0x209),{'resume_id':w,'alias':Z,'status':_0x30c63b(0x243),'server':a0_0x5aeccf(),'hostname':a0_0x5aeccf(),'agent':'claude-code','project_dir':process[_0x30c63b(0x234)](),'tmux_name':j||void 0x0})['then'](()=>Y(_0x30c63b(0x1d5)+Z+'\x22\x20('+w[_0x30c63b(0x246)](0x0,0x8)+')'))['catch'](_0x2c30bc=>Y(_0x30c63b(0x21d)+_0x2c30bc)),setInterval(()=>{const _0x6a50c=_0x30c63b;P(_0x6a50c(0x209),{'resume_id':w,'alias':Z,'status':_0x6a50c(0x243),'server':a0_0x5aeccf(),'hostname':a0_0x5aeccf(),'agent':_0x6a50c(0x237),'project_dir':process[_0x6a50c(0x234)](),'tmux_name':j||void 0x0})[_0x6a50c(0x229)](_0x46b41b=>Y('heartbeat\x20failed:\x20'+_0x46b41b));},0x2bf20),Y(_0x30c63b(0x1c2));}A()[a0_0x5b38a4(0x229)](_0x5aa789=>{const _0x2efa0c=a0_0x5b38a4;Y(_0x2efa0c(0x1cd)+_0x5aa789),process['exit'](0x1);});async function N(){const _0x4f3440=a0_0x5b38a4;Y(_0x4f3440(0x202)),await P(_0x4f3440(0x209),{'resume_id':w,'alias':Z,'status':_0x4f3440(0x1e0),'task':_0x4f3440(0x1ca)})[_0x4f3440(0x229)](()=>{}),process[_0x4f3440(0x1be)](0x0);}process[a0_0x5b38a4(0x201)]['on'](a0_0x5b38a4(0x1c6),()=>N()),process['on'](a0_0x5b38a4(0x1c1),()=>N()),process['on'](a0_0x5b38a4(0x1f9),()=>N());
|
|
2
|
+
const a0_0x1d97d9=a0_0x26ec;(function(_0x560c46,_0x5ca9b7){const _0x5dcee1=a0_0x26ec,_0x3788ec=_0x560c46();while(!![]){try{const _0x402515=parseInt(_0x5dcee1(0x120))/0x1+parseInt(_0x5dcee1(0x12d))/0x2*(parseInt(_0x5dcee1(0x15a))/0x3)+parseInt(_0x5dcee1(0xed))/0x4+parseInt(_0x5dcee1(0x117))/0x5+parseInt(_0x5dcee1(0x118))/0x6*(-parseInt(_0x5dcee1(0xea))/0x7)+-parseInt(_0x5dcee1(0x15d))/0x8+-parseInt(_0x5dcee1(0x159))/0x9;if(_0x402515===_0x5ca9b7)break;else _0x3788ec['push'](_0x3788ec['shift']());}catch(_0x23e63b){_0x3788ec['push'](_0x3788ec['shift']());}}}(a0_0x2503,0x96820));import{readFileSync as a0_0x5670ad,existsSync as a0_0x479f7e}from'fs';import{randomUUID as a0_0x22177b}from'crypto';import{join as a0_0x519551}from'path';import{hostname as a0_0x4959c5}from'os';import{execSync as a0_0x733f1f}from'child_process';import{Server as a0_0x7f10e0}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x3e00f8}from'@modelcontextprotocol/sdk/server/stdio.js';function a0_0x26ec(_0x4a193c,_0x490853){_0x4a193c=_0x4a193c-0xea;const _0x2503cb=a0_0x2503();let _0x26ec5e=_0x2503cb[_0x4a193c];return _0x26ec5e;}import{ListToolsRequestSchema as a0_0x42bf75,CallToolRequestSchema as a0_0xef3e5d}from'@modelcontextprotocol/sdk/types.js';function p(_0x5eaee5){const _0x1cb860=a0_0x26ec;if(!a0_0x479f7e(_0x5eaee5))return;for(let _0x267aae of a0_0x5670ad(_0x5eaee5,'utf-8')['split']('\x0a')){let _0x29be3d=_0x267aae['trim']();if(!_0x29be3d||_0x29be3d['startsWith']('#'))continue;let _0x5102bb=_0x29be3d[_0x1cb860(0x16c)]('=');if(_0x5102bb<0x0)continue;let _0x533a61=_0x29be3d[_0x1cb860(0x169)](0x0,_0x5102bb)[_0x1cb860(0x12c)](),_0x27aae5=_0x29be3d[_0x1cb860(0x169)](_0x5102bb+0x1)[_0x1cb860(0x12c)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x533a61])process.env[_0x533a61]=_0x27aae5;}}var C=process.env.HOME||'~',T=a0_0x519551(C,a0_0x1d97d9(0x147));p(a0_0x519551(T,a0_0x1d97d9(0x125)));var L=process['cwd']()[a0_0x1d97d9(0x16f)](/\//g,'-');p(a0_0x519551(T,L,a0_0x1d97d9(0x125)));function U(){const _0x387c0e=a0_0x1d97d9;try{return a0_0x733f1f(_0x387c0e(0x102),{'encoding':_0x387c0e(0x105),'timeout':0x7d0})[_0x387c0e(0x12c)]();}catch{return'';}}function v(){const _0x3960e5=a0_0x1d97d9;try{let _0x58d078=a0_0x519551(C,_0x3960e5(0x119),_0x3960e5(0xf6));if(a0_0x479f7e(_0x58d078))return JSON[_0x3960e5(0x16d)](a0_0x5670ad(_0x58d078,_0x3960e5(0x105)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x1d97d9(0xfd)]||a0_0x1d97d9(0xfa),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x4959c5(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x22177b(),X=process.env.COMMHUB_TOKEN||H[a0_0x1d97d9(0x128)]||'';function Y(_0x57914d){const _0x11500c=a0_0x1d97d9;let _0x2a282d=new Date()[_0x11500c(0x16a)]()['slice'](0x0,0x8);process[_0x11500c(0x11a)]['write']('['+_0x2a282d+_0x11500c(0x153)+_0x57914d+'\x0a');}function h(_0x3cd941){return new Promise(_0x51f766=>setTimeout(_0x51f766,_0x3cd941));}Y(a0_0x1d97d9(0xeb)+f+a0_0x1d97d9(0x10e)+Z+'\x20RESUME_ID='+w[a0_0x1d97d9(0x169)](0x0,0x8)+a0_0x1d97d9(0x115)+(j||'none')+'\x20CWD='+process[a0_0x1d97d9(0xfc)]()+a0_0x1d97d9(0x162)+L);function a0_0x2503(){const _0x17f894=['/mcp','.claude/channels/commhub','Bearer\x20','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','SIGINT','\x20priority=','Authorization','Priority\x20(default:\x20normal)','text','initialize','data:\x20','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','working',']\x20[commhub]\x20','idle','get_all_status','connected','status','failed','8016813FUXKTf','9zShHkg','SSE\x20connection\x20error:\x20','decode','3166928rLPnfk','Message\x20content','from_session','POST','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','\x20PROJECT_ENV=','notifications/claude/channel','message_id','commhub_reply','→\x20injected\x20task\x20','send_message','commhub_get_all_status','slice','toTimeString','shutting\x20down,\x20reporting\x20offline...','indexOf','parse','\x20from\x20','replace','init\x20failed:\x20','14pCSDmA','ENV:\x20URL=','application/json,\x20text/event-stream','2099892jDgArD','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','application/json','tools/call','SIGTERM','2.0','broadcast','starting\x20SSE\x20listener...','MCP\x20stdio\x20connected','config.json','split','find','object','http://127.0.0.1:9200','from','cwd','hub','messages','ack_inbox','notification','connecting\x20to\x20','tmux\x20display-message\x20-p\x20\x27#S\x27','in_progress','registered\x20as\x20\x22','utf-8','catch','report_status','claude-code','startsWith','normal','type','get','statusText','\x20ALIAS=','content','/events/','high','end','priority','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','...\x20TMUX=','error','463135MkxjXQ','186156wQmJSs','.anet','stderr','commhub_report_status','Reply\x20text\x20/\x20result\x20summary','low','Task\x20content','completed','697734ckFWvk','string','stdin','message','commhub','.env','Target\x20session\x20alias','length','token','Progress\x200-100','result','fatal:\x20','trim','433214BlxjiC','SSE\x20fatal:\x20','stringify','inbox_count',':\x20inbox_count=','SSE\x20error:\x20','2025-03-26','cancelled','parse\x20error:\x20','body','delete','pop','join','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','alias','←\x20message\x20from\x20','connect','blocked','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','exit','0.3.0','commhub_send_message','commhub_send_task','heartbeat\x20failed:\x20'];a0_0x2503=function(){return _0x17f894;};return a0_0x2503();}var k=new Map(),K=new a0_0x7f10e0({'name':'commhub-channel','version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x1d97d9(0x140),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x1d97d9(0xee),a0_0x1d97d9(0x13a),'Session\x20alias:\x20'+Z][a0_0x1d97d9(0x139)]('\x0a')});K['setRequestHandler'](a0_0x42bf75,async()=>({'tools':[{'name':a0_0x1d97d9(0x165),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x1d97d9(0xf9),'properties':{'task_id':{'type':a0_0x1d97d9(0x121),'description':a0_0x1d97d9(0x114)},'text':{'type':a0_0x1d97d9(0x121),'description':a0_0x1d97d9(0x11c)},'status':{'type':a0_0x1d97d9(0x121),'enum':[a0_0x1d97d9(0x11f),a0_0x1d97d9(0x158),a0_0x1d97d9(0x134),a0_0x1d97d9(0x13f),a0_0x1d97d9(0x116),a0_0x1d97d9(0x103)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x1d97d9(0x14e)]}},{'name':a0_0x1d97d9(0x11b),'description':a0_0x1d97d9(0x151),'inputSchema':{'type':'object','properties':{'status':{'type':'string','enum':[a0_0x1d97d9(0x152),a0_0x1d97d9(0x154),a0_0x1d97d9(0x13f),a0_0x1d97d9(0x116)]},'task':{'type':a0_0x1d97d9(0x121),'description':'Current\x20task\x20description'},'progress':{'type':'number','description':a0_0x1d97d9(0x129)}},'required':['status']}},{'name':a0_0x1d97d9(0x144),'description':a0_0x1d97d9(0x161),'inputSchema':{'type':a0_0x1d97d9(0xf9),'properties':{'alias':{'type':'string','description':a0_0x1d97d9(0x126)},'task':{'type':a0_0x1d97d9(0x121),'description':a0_0x1d97d9(0x11e)},'priority':{'type':a0_0x1d97d9(0x121),'enum':[a0_0x1d97d9(0x111),'normal',a0_0x1d97d9(0x11d)],'description':a0_0x1d97d9(0x14d)}},'required':['alias','task']}},{'name':a0_0x1d97d9(0x143),'description':a0_0x1d97d9(0x13b),'inputSchema':{'type':a0_0x1d97d9(0xf9),'properties':{'alias':{'type':a0_0x1d97d9(0x121),'description':a0_0x1d97d9(0x126)},'message':{'type':a0_0x1d97d9(0x121),'description':a0_0x1d97d9(0x15e)}},'required':[a0_0x1d97d9(0x13c),'message']}},{'name':a0_0x1d97d9(0x168),'description':a0_0x1d97d9(0x149),'inputSchema':{'type':a0_0x1d97d9(0xf9),'properties':{}}}]}));async function P(_0x39e458,_0x8d7f1a){const _0x5bae19=a0_0x1d97d9;let _0x10a625=await fetch(f+_0x5bae19(0x146),{'method':_0x5bae19(0x160),'headers':{'Content-Type':'application/json','Accept':_0x5bae19(0xec),...X?{'Authorization':_0x5bae19(0x148)+X}:{}},'body':JSON[_0x5bae19(0x12f)]({'jsonrpc':_0x5bae19(0xf2),'id':0x1,'method':_0x5bae19(0x14f),'params':{'protocolVersion':_0x5bae19(0x133),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x5bae19(0x142)}}})});if(!_0x10a625['ok']){let _0x40aa3d=await _0x10a625['text']();return Y('CommHub\x20init\x20failed:\x20'+_0x10a625[_0x5bae19(0x157)]+'\x20'+_0x40aa3d['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x5bae19(0x170)+_0x10a625['status']};}await _0x10a625['text']();let _0x3b844b=(await(await fetch(f+'/mcp',{'method':_0x5bae19(0x160),'headers':{'Content-Type':_0x5bae19(0xef),'Accept':_0x5bae19(0xec),...X?{'Authorization':_0x5bae19(0x148)+X}:{}},'body':JSON[_0x5bae19(0x12f)]({'jsonrpc':'2.0','id':0x2,'method':_0x5bae19(0xf0),'params':{'name':_0x39e458,'arguments':_0x8d7f1a}})}))[_0x5bae19(0x14e)]())[_0x5bae19(0xf7)]('\x0a')[_0x5bae19(0xf8)](_0x4a2f0a=>_0x4a2f0a[_0x5bae19(0x109)](_0x5bae19(0x150)));if(_0x3b844b){let _0x3cedd3=JSON[_0x5bae19(0x16d)](_0x3b844b[_0x5bae19(0x169)](0x6));return _0x3cedd3?.[_0x5bae19(0x12a)]?.[_0x5bae19(0x10f)]?.[0x0]?.[_0x5bae19(0x14e)]?JSON[_0x5bae19(0x16d)](_0x3cedd3['result'][_0x5bae19(0x10f)][0x0][_0x5bae19(0x14e)]):_0x3cedd3;}return{'ok':!0x1,'error':'no\x20response'};}K['setRequestHandler'](a0_0xef3e5d,async _0x37557f=>{const _0x268dfc=a0_0x1d97d9;let {name:_0x32050d,arguments:_0x138e6a}=_0x37557f['params'];if(_0x32050d===_0x268dfc(0x165)){let {task_id:_0x124c1b,text:_0x2a25c6,status:_0x2d5645}=_0x138e6a;if(_0x2d5645==='completed'||_0x2d5645===_0x268dfc(0x158)||_0x2d5645===_0x268dfc(0x134)){let _0x5bacf5=_0x2d5645===_0x268dfc(0x11f)?'replied':_0x2d5645,_0xd429c6=_0x124c1b?k[_0x268dfc(0x10c)](_0x124c1b)||_0x268dfc(0xfd):_0x268dfc(0xfd),_0x2a78ad=await P('send_reply',{'alias':_0xd429c6,'text':_0x2a25c6,'in_reply_to':_0x124c1b||void 0x0,'status':_0x5bacf5,'from_session':Z});if(_0x124c1b)k[_0x268dfc(0x137)](_0x124c1b);return{'content':[{'type':_0x268dfc(0x14e),'text':JSON[_0x268dfc(0x12f)](_0x2a78ad)}]};}let _0x111483=await P(_0x268dfc(0x107),{'resume_id':w,'alias':Z,'status':_0x2d5645===_0x268dfc(0x13f)?_0x268dfc(0x13f):_0x2d5645===_0x268dfc(0x116)?_0x268dfc(0x116):_0x268dfc(0x152),'task':_0x2a25c6[_0x268dfc(0x169)](0x0,0xc8),'output':_0x2a25c6});return{'content':[{'type':_0x268dfc(0x14e),'text':JSON[_0x268dfc(0x12f)](_0x111483)}]};}if(_0x32050d==='commhub_report_status'){let {status:_0x3ff70f,task:_0x400bdf,progress:_0x191b26}=_0x138e6a,_0x13165e=await P(_0x268dfc(0x107),{'resume_id':w,'alias':Z,'status':_0x3ff70f,'task':_0x400bdf,'progress':_0x191b26});return{'content':[{'type':_0x268dfc(0x14e),'text':JSON[_0x268dfc(0x12f)](_0x13165e)}]};}if(_0x32050d===_0x268dfc(0x144)){let {alias:_0x35fd30,task:_0xa6b7c8,priority:_0x3e8e82}=_0x138e6a,_0x526c61=await P('send_task',{'alias':_0x35fd30,'task':_0xa6b7c8,'priority':_0x3e8e82||_0x268dfc(0x10a),'from_session':Z});return{'content':[{'type':_0x268dfc(0x14e),'text':JSON['stringify'](_0x526c61)}]};}if(_0x32050d==='commhub_send_message'){let {alias:_0x105ff2,message:_0xbf523d}=_0x138e6a,_0x30fd7f=await P(_0x268dfc(0x167),{'alias':_0x105ff2,'message':_0xbf523d,'from_session':Z});return{'content':[{'type':_0x268dfc(0x14e),'text':JSON[_0x268dfc(0x12f)](_0x30fd7f)}]};}if(_0x32050d===_0x268dfc(0x168)){let _0x3f5536=await P(_0x268dfc(0x155),{});return{'content':[{'type':_0x268dfc(0x14e),'text':JSON[_0x268dfc(0x12f)](_0x3f5536)}]};}return{'content':[{'type':_0x268dfc(0x14e),'text':JSON[_0x268dfc(0x12f)]({'error':'unknown\x20tool'})}]};});async function u(){const _0x5c74e4=a0_0x1d97d9;let _0x3a65d7=f+_0x5c74e4(0x110)+encodeURIComponent(Z),_0x509137={};if(X)_0x509137[_0x5c74e4(0x14c)]='Bearer\x20'+X;Y(_0x5c74e4(0x101)+_0x3a65d7);while(!0x0){try{let _0x869a1f=await fetch(_0x3a65d7,{'headers':_0x509137});if(!_0x869a1f['ok']){Y(_0x5c74e4(0x132)+_0x869a1f['status']+'\x20'+_0x869a1f[_0x5c74e4(0x10d)]),await h(0x1388);continue;}let _0x332c71=_0x869a1f[_0x5c74e4(0x136)]['getReader'](),_0x3f5199=new TextDecoder(),_0x3f8f99='';while(!0x0){let {done:_0x1998eb,value:_0x2e98f9}=await _0x332c71['read']();if(_0x1998eb)break;_0x3f8f99+=_0x3f5199[_0x5c74e4(0x15c)](_0x2e98f9,{'stream':!0x0});let _0x3d0668=_0x3f8f99[_0x5c74e4(0xf7)]('\x0a\x0a');_0x3f8f99=_0x3d0668[_0x5c74e4(0x138)]()||'';for(let _0x5168cf of _0x3d0668){let _0x1fcf69=_0x5168cf['split']('\x0a')[_0x5c74e4(0xf8)](_0x4be908=>_0x4be908[_0x5c74e4(0x109)](_0x5c74e4(0x150)));if(!_0x1fcf69)continue;try{let _0x23b095=JSON[_0x5c74e4(0x16d)](_0x1fcf69[_0x5c74e4(0x169)](0x6));await S(_0x23b095);}catch(_0x1d14af){Y(_0x5c74e4(0x135)+_0x1d14af);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x44c04d){Y(_0x5c74e4(0x15b)+_0x44c04d);}await h(0xbb8);}}async function S(_0xbca1a4){const _0x408f55=a0_0x1d97d9;if(_0xbca1a4['type']===_0x408f55(0x156)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0xbca1a4['type']==='new_message'){if(Y(_0x408f55(0x13d)+_0xbca1a4[_0x408f55(0xfb)]+':\x20'+_0xbca1a4[_0x408f55(0x123)][_0x408f55(0x169)](0x0,0x3c)),await K[_0x408f55(0x100)]({'method':_0x408f55(0x163),'params':{'content':_0xbca1a4['message'],'meta':{'sender':_0xbca1a4[_0x408f55(0xfb)]||_0x408f55(0xfd),'sender_id':'commhub','user':_0xbca1a4[_0x408f55(0xfb)]||'hub','priority':_0x408f55(0x10a)}}}),_0xbca1a4[_0x408f55(0x164)])await P(_0x408f55(0xff),{'alias':Z,'message_id':_0xbca1a4[_0x408f55(0x164)]});return;}if(_0xbca1a4[_0x408f55(0x10b)]==='new_task'||_0xbca1a4[_0x408f55(0x10b)]===_0x408f55(0xf3)){Y('←\x20'+_0xbca1a4['type']+_0x408f55(0x131)+_0xbca1a4[_0x408f55(0x130)]+_0x408f55(0x14b)+(_0xbca1a4['priority']||_0x408f55(0x10a)));let _0x36024b=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x36024b?.['ok']&&_0x36024b[_0x408f55(0xfe)]?.[_0x408f55(0x127)]>0x0)for(let _0x2cd5cd of _0x36024b[_0x408f55(0xfe)]){let _0x1a832e={'sender':_0x2cd5cd['from_session']||_0x408f55(0xfd),'sender_id':_0x408f55(0x124),'user':_0x2cd5cd[_0x408f55(0x15f)]||_0x408f55(0xfd),'task_id':_0x2cd5cd['id'],'priority':_0x2cd5cd[_0x408f55(0x113)]||_0x408f55(0x10a)};k['set'](_0x2cd5cd['id'],_0x2cd5cd[_0x408f55(0x15f)]||_0x408f55(0xfd)),await K[_0x408f55(0x100)]({'method':_0x408f55(0x163),'params':{'content':_0x2cd5cd[_0x408f55(0x10f)],'meta':_0x1a832e}}),Y(_0x408f55(0x166)+_0x2cd5cd['id']['slice'](0x0,0x8)+_0x408f55(0x16e)+_0x2cd5cd['from_session']+':\x20'+_0x2cd5cd[_0x408f55(0x10f)]['slice'](0x0,0x3c)),await P(_0x408f55(0xff),{'alias':Z,'message_id':_0x2cd5cd['id']});}}}async function A(){const _0x4c1b46=a0_0x1d97d9;let _0xe6f425=new a0_0x3e00f8();await K[_0x4c1b46(0x13e)](_0xe6f425),Y(_0x4c1b46(0xf5)),Y(_0x4c1b46(0xf4)),u()[_0x4c1b46(0x106)](_0x49ca4a=>Y(_0x4c1b46(0x12e)+_0x49ca4a)),P('report_status',{'resume_id':w,'alias':Z,'status':_0x4c1b46(0x154),'server':a0_0x4959c5(),'hostname':a0_0x4959c5(),'agent':_0x4c1b46(0x108),'project_dir':process[_0x4c1b46(0xfc)](),'tmux_name':j||void 0x0})['then'](()=>Y(_0x4c1b46(0x104)+Z+'\x22\x20('+w['slice'](0x0,0x8)+')'))[_0x4c1b46(0x106)](_0x13dbe3=>Y('warning:\x20could\x20not\x20register:\x20'+_0x13dbe3)),setInterval(()=>{const _0x349923=_0x4c1b46;P(_0x349923(0x107),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x4959c5(),'hostname':a0_0x4959c5(),'agent':_0x349923(0x108),'project_dir':process[_0x349923(0xfc)](),'tmux_name':j||void 0x0})[_0x349923(0x106)](_0x210ec2=>Y(_0x349923(0x145)+_0x210ec2));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x1d97d9(0x106)](_0x151f02=>{const _0x18bbd7=a0_0x1d97d9;Y(_0x18bbd7(0x12b)+_0x151f02),process[_0x18bbd7(0x141)](0x1);});async function N(){const _0x2b1653=a0_0x1d97d9;Y(_0x2b1653(0x16b)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x2b1653(0x116),'task':'session\x20disconnected'})[_0x2b1653(0x106)](()=>{}),process[_0x2b1653(0x141)](0x0);}process[a0_0x1d97d9(0x122)]['on'](a0_0x1d97d9(0x112),()=>N()),process['on'](a0_0x1d97d9(0xf1),()=>N()),process['on'](a0_0x1d97d9(0x14a),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.1.4-preview.
|
|
3
|
+
"version": "2.1.4-preview.10",
|
|
4
4
|
"description": "AI Agent Network CLI — Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 39 commands.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|