@sleep2agi/agent-network 2.2.7 → 2.2.8-preview.0
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_0x126c(_0x9d5e15,_0x454483){_0x9d5e15=_0x9d5e15-0x19f;const _0x2d9f5a=a0_0x2d9f();let _0x126c53=_0x2d9f5a[_0x9d5e15];return _0x126c53;}const a0_0x2a1977=a0_0x126c;(function(_0x1112c6,_0x482e9d){const _0x2af74f=a0_0x126c,_0x88a286=_0x1112c6();while(!![]){try{const _0x1ef32f=parseInt(_0x2af74f(0x1d4))/0x1+parseInt(_0x2af74f(0x1a5))/0x2*(-parseInt(_0x2af74f(0x1e9))/0x3)+parseInt(_0x2af74f(0x1ac))/0x4*(parseInt(_0x2af74f(0x1b6))/0x5)+-parseInt(_0x2af74f(0x1d3))/0x6*(parseInt(_0x2af74f(0x1cf))/0x7)+parseInt(_0x2af74f(0x1a7))/0x8+-parseInt(_0x2af74f(0x1dd))/0x9*(-parseInt(_0x2af74f(0x1c0))/0xa)+-parseInt(_0x2af74f(0x1d9))/0xb;if(_0x1ef32f===_0x482e9d)break;else _0x88a286['push'](_0x88a286['shift']());}catch(_0x1e4549){_0x88a286['push'](_0x88a286['shift']());}}}(a0_0x2d9f,0x8282c));import{EventEmitter as a0_0x55dfd5}from'events';import{hostname as a0_0x13df40}from'os';class T extends a0_0x55dfd5{[a0_0x2a1977(0x1c5)];[a0_0x2a1977(0x1b8)];[a0_0x2a1977(0x1df)];['agent'];['resumeId'];[a0_0x2a1977(0x1d5)];[a0_0x2a1977(0x1ce)];['heartbeatTimer'];['sseAbort'];['running']=!0x1;constructor(_0x52d248){const _0x4fc0c1=a0_0x2a1977;super();if(this[_0x4fc0c1(0x1c5)]=_0x52d248[_0x4fc0c1(0x1c5)][_0x4fc0c1(0x1a8)](/\/$/,''),this[_0x4fc0c1(0x1b8)]=_0x52d248[_0x4fc0c1(0x1b8)],this[_0x4fc0c1(0x1df)]=_0x52d248[_0x4fc0c1(0x1df)],this['agent']=_0x52d248[_0x4fc0c1(0x1a9)]||_0x4fc0c1(0x1d7),this['resumeId']=_0x4fc0c1(0x1b3)+_0x52d248[_0x4fc0c1(0x1b8)]+'-'+Date[_0x4fc0c1(0x1c2)]()['toString'](0x24),this[_0x4fc0c1(0x1d5)]=_0x52d248[_0x4fc0c1(0x1d5)]??0x2bf20,this['reconnectDelay']=_0x52d248[_0x4fc0c1(0x1ce)]??0xbb8,_0x52d248['autoConnect']!==!0x1)this[_0x4fc0c1(0x1e4)]();}['log'](_0x3d4433){const _0x334914=a0_0x2a1977;console[_0x334914(0x1c8)]('['+new Date()[_0x334914(0x19f)]()[_0x334914(0x1de)](0x0,0x8)+']\x20[commhub:'+this['alias']+']\x20'+_0x3d4433);}async[a0_0x2a1977(0x1d1)](_0x1942ba,_0x11dd5c){const _0x31f739=a0_0x2a1977;let _0x192176={'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream'};if(this[_0x31f739(0x1df)])_0x192176[_0x31f739(0x1f0)]=_0x31f739(0x1c1)+this[_0x31f739(0x1df)];let _0x55a6c0=await(await fetch(this[_0x31f739(0x1c5)]+_0x31f739(0x1a1),{'method':'POST','headers':_0x192176,'body':JSON[_0x31f739(0x1ea)]({'jsonrpc':_0x31f739(0x1ae),'id':Date['now'](),'method':_0x31f739(0x1cb),'params':{'name':_0x1942ba,'arguments':_0x11dd5c}})}))[_0x31f739(0x1e5)](),_0x218020=_0x55a6c0[_0x31f739(0x1aa)](/data: (.+)/),_0x66773d=_0x218020?JSON[_0x31f739(0x1b2)](_0x218020[0x1]):JSON['parse'](_0x55a6c0),_0x5b34a7=_0x66773d?.[_0x31f739(0x1e8)]?.[_0x31f739(0x1b4)]?.[0x0]?.[_0x31f739(0x1e5)];return _0x5b34a7?JSON[_0x31f739(0x1b2)](_0x5b34a7):_0x66773d;}async[a0_0x2a1977(0x1e4)](){const _0x260df2=a0_0x2a1977;if(this[_0x260df2(0x1da)])return;this[_0x260df2(0x1da)]=!0x0,await this['status']('idle'),this[_0x260df2(0x1c8)]('registered'),this['heartbeatTimer']=setInterval(()=>{const _0x31aaef=_0x260df2;this['status']('idle')[_0x31aaef(0x1bf)](_0x4f9b3a=>this[_0x31aaef(0x1c8)](_0x31aaef(0x1db)+_0x4f9b3a[_0x31aaef(0x1d8)]));},this['heartbeatInterval']),this[_0x260df2(0x1b5)]();}async[a0_0x2a1977(0x1af)](){const _0x20b5f7=a0_0x2a1977;if(this[_0x20b5f7(0x1da)]=!0x1,this[_0x20b5f7(0x1ec)]?.['abort'](),this[_0x20b5f7(0x1cd)])clearInterval(this['heartbeatTimer']);await this[_0x20b5f7(0x1ef)]('offline')[_0x20b5f7(0x1bf)](()=>{}),this[_0x20b5f7(0x1c8)](_0x20b5f7(0x1c3));}async[a0_0x2a1977(0x1be)](_0x16bb5d,_0x267873,_0x255f90='normal'){const _0x6dc0e8=a0_0x2a1977;return this[_0x6dc0e8(0x1d1)](_0x6dc0e8(0x1e6),{'alias':_0x16bb5d,'task':_0x267873,'priority':_0x255f90,'from_session':this['alias']});}async['message'](_0x40c11b,_0xf8289e){const _0x26d5f2=a0_0x2a1977;return this[_0x26d5f2(0x1d1)](_0x26d5f2(0x1cc),{'alias':_0x40c11b,'message':_0xf8289e,'from_session':this[_0x26d5f2(0x1b8)]});}async['reply'](_0x4ea6ce,_0x28209b,_0x5986f3=a0_0x2a1977(0x1a3)){const _0x5d7d49=a0_0x2a1977;return this[_0x5d7d49(0x1d1)]('send_reply',{'in_reply_to':_0x4ea6ce,'text':_0x28209b,'status':_0x5986f3});}async['status'](_0x1d7abf,_0x58a898){const _0x2a500f=a0_0x2a1977;return this['call'](_0x2a500f(0x1c9),{'resume_id':this[_0x2a500f(0x1b7)],'alias':this[_0x2a500f(0x1b8)],'status':_0x1d7abf,'server':a0_0x13df40(),'hostname':a0_0x13df40(),'agent':this[_0x2a500f(0x1a9)],'project_dir':process['cwd'](),..._0x58a898});}async[a0_0x2a1977(0x1bb)](){const _0x3c479a=a0_0x2a1977;return this[_0x3c479a(0x1d1)]('get_all_status',{});}async[a0_0x2a1977(0x1b9)](_0x52199c,_0x206caa){const _0x25bb33=a0_0x2a1977;return this['call'](_0x25bb33(0x1b9),{'message':_0x52199c,'filter_server':_0x206caa?.[_0x25bb33(0x1a0)],'filter_status':_0x206caa?.[_0x25bb33(0x1ef)]});}async['connectSSE'](){const _0x1d4a37=a0_0x2a1977;let _0x1a0baf=encodeURIComponent(this['alias']),_0x55ff5b=this['url']+_0x1d4a37(0x1b0)+_0x1a0baf,_0x2b2287=this['reconnectDelay'];while(this[_0x1d4a37(0x1da)]){try{this[_0x1d4a37(0x1ec)]=new AbortController();let _0x1ae577={'Accept':'text/event-stream'};if(this['token'])_0x1ae577[_0x1d4a37(0x1f0)]=_0x1d4a37(0x1c1)+this[_0x1d4a37(0x1df)];let _0x29da24=await fetch(_0x55ff5b,{'headers':_0x1ae577,'signal':this['sseAbort'][_0x1d4a37(0x1ed)]});if(!_0x29da24['ok']||!_0x29da24[_0x1d4a37(0x1e1)]){this[_0x1d4a37(0x1c8)](_0x1d4a37(0x1a4)+_0x29da24[_0x1d4a37(0x1ef)]),await this['sleep'](_0x2b2287),_0x2b2287=Math[_0x1d4a37(0x1d6)](_0x2b2287*1.5,0xea60);continue;}_0x2b2287=this[_0x1d4a37(0x1ce)];let _0xe9bcc2=_0x29da24[_0x1d4a37(0x1e1)][_0x1d4a37(0x1e0)](),_0x259a32=new TextDecoder(),_0x1d2857='';while(this['running']){let {done:_0x5940fd,value:_0x203cc2}=await _0xe9bcc2[_0x1d4a37(0x1bd)]();if(_0x5940fd)break;_0x1d2857+=_0x259a32[_0x1d4a37(0x1c7)](_0x203cc2,{'stream':!0x0});let _0x94d418=_0x1d2857[_0x1d4a37(0x1e2)]('\x0a');_0x1d2857=_0x94d418[_0x1d4a37(0x1e7)]()||'';for(let _0x386506 of _0x94d418){if(!_0x386506[_0x1d4a37(0x1bc)](_0x1d4a37(0x1d2)))continue;try{let _0xd7aabf=JSON[_0x1d4a37(0x1b2)](_0x386506['slice'](0x6));if(_0xd7aabf[_0x1d4a37(0x1a2)]==='connected'){this[_0x1d4a37(0x1c8)](_0x1d4a37(0x1d0)),this[_0x1d4a37(0x1dc)](_0x1d4a37(0x1eb));continue;}if(_0xd7aabf['type']==='new_task'||_0xd7aabf['type']==='new_message'||_0xd7aabf[_0x1d4a37(0x1a2)]===_0x1d4a37(0x1b9))await this['processInbox']();}catch{}}}}catch(_0x270c39){if(_0x270c39[_0x1d4a37(0x1ee)]==='AbortError')break;this['emit'](_0x1d4a37(0x1a6),_0x270c39),this[_0x1d4a37(0x1c8)](_0x1d4a37(0x1c6)+_0x270c39[_0x1d4a37(0x1d8)]);}if(this[_0x1d4a37(0x1da)])this[_0x1d4a37(0x1dc)](_0x1d4a37(0x1c3)),this[_0x1d4a37(0x1c8)](_0x1d4a37(0x1ad)+_0x2b2287/0x3e8+'s...'),await this['sleep'](_0x2b2287),_0x2b2287=Math['min'](_0x2b2287*1.5,0xea60);}}async[a0_0x2a1977(0x1ba)](){const _0x1c8080=a0_0x2a1977;try{let _0x5b9e23=(await this['call'](_0x1c8080(0x1e3),{'alias':this[_0x1c8080(0x1b8)],'limit':0xa}))?.['messages']||[];for(let _0x31cc99 of _0x5b9e23)await this['call'](_0x1c8080(0x1b1),{'alias':this[_0x1c8080(0x1b8)],'message_id':_0x31cc99['id']}),this[_0x1c8080(0x1c8)]('←\x20'+_0x31cc99[_0x1c8080(0x1ca)]+':\x20'+_0x31cc99['content'][_0x1c8080(0x1de)](0x0,0x3c)),this[_0x1c8080(0x1dc)](_0x1c8080(0x1ab),_0x31cc99),this[_0x1c8080(0x1dc)](_0x1c8080(0x1d8),_0x31cc99);}catch(_0x74ba21){this[_0x1c8080(0x1c8)]('inbox\x20error:\x20'+_0x74ba21['message']);}}[a0_0x2a1977(0x1c4)](_0x4c6cc0){return new Promise(_0x1af24b=>setTimeout(_0x1af24b,_0x4c6cc0));}}function a0_0x2d9f(){const _0x40123b=['running','heartbeat\x20failed:\x20','emit','171JgBUet','slice','token','getReader','body','split','get_inbox','connect','text','send_task','pop','result','861xcpYZt','stringify','connected','sseAbort','signal','name','status','Authorization','toTimeString','server','/mcp','type','completed','SSE\x20failed:\x20','514mghZmq','error','2942152akRBDR','replace','agent','match','task','441576cSaUCf','SSE\x20reconnecting\x20in\x20','2.0','disconnect','/events/','ack_inbox','parse','sdk-','content','connectSSE','20RNOjKf','resumeId','alias','broadcast','processInbox','getAllStatus','startsWith','read','send','catch','525430zmQbmn','Bearer\x20','now','disconnected','sleep','url','SSE\x20error:\x20','decode','log','report_status','from_session','tools/call','send_message','heartbeatTimer','reconnectDelay','1566047KGfRIz','SSE\x20connected','call','data:\x20','12dsPWIs','440020JgOWbo','heartbeatInterval','min','sdk','message','13110999BRRHaN'];a0_0x2d9f=function(){return _0x40123b;};return a0_0x2d9f();}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_0x40833c=a0_0x1de6;(function(_0x8dc7ff,_0x5c1b25){const _0x2ad476=a0_0x1de6,_0x34afb4=_0x8dc7ff();while(!![]){try{const _0x39010e=-parseInt(_0x2ad476(0x104))/0x1*(parseInt(_0x2ad476(0x108))/0x2)+-parseInt(_0x2ad476(0xec))/0x3*(parseInt(_0x2ad476(0xbb))/0x4)+parseInt(_0x2ad476(0xd0))/0x5*(-parseInt(_0x2ad476(0xf2))/0x6)+-parseInt(_0x2ad476(0xad))/0x7*(-parseInt(_0x2ad476(0xc1))/0x8)+parseInt(_0x2ad476(0xe5))/0x9*(parseInt(_0x2ad476(0xce))/0xa)+parseInt(_0x2ad476(0xdc))/0xb*(parseInt(_0x2ad476(0x111))/0xc)+-parseInt(_0x2ad476(0xe2))/0xd*(-parseInt(_0x2ad476(0x9e))/0xe);if(_0x39010e===_0x5c1b25)break;else _0x34afb4['push'](_0x34afb4['shift']());}catch(_0x47a2c2){_0x34afb4['push'](_0x34afb4['shift']());}}}(a0_0x3f31,0xc5b1a));import{readFileSync as a0_0x14f765,existsSync as a0_0x1aeafd}from'fs';import{randomUUID as a0_0x3819dc}from'crypto';function a0_0x3f31(){const _0x1c2f85=['error','messages','SSE\x20connection\x20error:\x20','1773104ollHyc','broadcast','\x22\x20(','SSE\x20fatal:\x20','stdin','setRequestHandler','shutting\x20down,\x20reporting\x20offline...','fatal:\x20','normal','catch','Current\x20task\x20description','utf-8','application/json','5494690HLTGlu','POST','99445lhxgol','\x20from\x20','\x20ALIAS=','Authorization','startsWith','report_status','pop','stringify','blocked','no\x20response','commhub','heartbeat\x20failed:\x20','66XGWKDE','Reply\x20text\x20/\x20result\x20summary','offline','get_all_status','completed','from_session','1265797zfSbeS',':\x20inbox_count=','ENV:\x20URL=','18LKEWot','status','http://127.0.0.1:9200','hub','claude-code','params','2.0','701169rJNoLE','then','commhub_send_message','none','set','body','6CMVjHt','failed','priority','send_reply','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','.claude/channels/commhub','.env','notification','registered\x20as\x20\x22','find','connecting\x20to\x20','session\x20disconnected','CommHub\x20init\x20failed:\x20','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','Progress\x200-100','data:\x20','Bearer\x20','type','737421PYzHgZ','tools/call','join','write','4rwdTTr','trim','exit','Session\x20alias:\x20','2025-03-26','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','get_inbox','content','replace','476964CnTKrE','working','new_task','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','parse','commhub_report_status','connected','ready\x20—\x20waiting\x20for\x20events','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','SSE\x20connected\x20as\x20\x22','MCP\x20stdio\x20connected','cwd','config.json','SSE\x20stream\x20ended,\x20reconnecting...','in_progress','SIGINT','send_task','notifications/claude/channel','commhub_get_all_status','send_message','split','cancelled','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','alias','replied','84OLGuou','slice','←\x20message\x20from\x20','commhub-channel','from','/mcp','\x20PROJECT_ENV=','parse\x20error:\x20','application/json,\x20text/event-stream','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','length','result','token','get','text','49nELbvV','stderr','ack_inbox','commhub_reply','/events/','object','message','idle','string','read',']\x20[commhub]\x20','Message\x20content','delete','commhub_send_task','20NzAYbw','0.3.0','statusText'];a0_0x3f31=function(){return _0x1c2f85;};return a0_0x3f31();}import{join as a0_0x13d10e}from'path';import{hostname as a0_0x569c50}from'os';import{execSync as a0_0x5b612a}from'child_process';import{Server as a0_0x23a3b2}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x34239d}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x3af468,CallToolRequestSchema as a0_0x18b3f2}from'@modelcontextprotocol/sdk/types.js';function p(_0x3f5266){const _0xd3b58f=a0_0x1de6;if(!a0_0x1aeafd(_0x3f5266))return;for(let _0x1ac711 of a0_0x14f765(_0x3f5266,_0xd3b58f(0xcc))[_0xd3b58f(0x98)]('\x0a')){let _0x1033e3=_0x1ac711[_0xd3b58f(0x109)]();if(!_0x1033e3||_0x1033e3['startsWith']('#'))continue;let _0xb6ff76=_0x1033e3['indexOf']('=');if(_0xb6ff76<0x0)continue;let _0xd61d6f=_0x1033e3['slice'](0x0,_0xb6ff76)['trim'](),_0x47486c=_0x1033e3['slice'](_0xb6ff76+0x1)[_0xd3b58f(0x109)]()[_0xd3b58f(0x110)](/^["']|["']$/g,'');if(!process.env[_0xd61d6f])process.env[_0xd61d6f]=_0x47486c;}}var C=process.env.HOME||'~',T=a0_0x13d10e(C,a0_0x40833c(0xf7));p(a0_0x13d10e(T,a0_0x40833c(0xf8)));var L=process[a0_0x40833c(0x8f)]()[a0_0x40833c(0x110)](/\//g,'-');p(a0_0x13d10e(T,L,a0_0x40833c(0xf8)));function U(){const _0x21837b=a0_0x40833c;try{return a0_0x5b612a('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x21837b(0xcc),'timeout':0x7d0})['trim']();}catch{return'';}}function v(){const _0x308008=a0_0x40833c;try{let _0x5eb1c0=a0_0x13d10e(C,'.anet',_0x308008(0x90));if(a0_0x1aeafd(_0x5eb1c0))return JSON[_0x308008(0x88)](a0_0x14f765(_0x5eb1c0,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x40833c(0xe8)]||a0_0x40833c(0xe7),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x569c50(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x3819dc(),X=process.env.COMMHUB_TOKEN||H[a0_0x40833c(0xaa)]||'';function Y(_0x54de99){const _0x846eb=a0_0x40833c;let _0xf4c59a=new Date()['toTimeString']()[_0x846eb(0x9f)](0x0,0x8);process[_0x846eb(0xae)][_0x846eb(0x107)]('['+_0xf4c59a+_0x846eb(0xb7)+_0x54de99+'\x0a');}function h(_0x5868b5){return new Promise(_0x425ead=>setTimeout(_0x425ead,_0x5868b5));}function a0_0x1de6(_0x2d5b59,_0x313087){_0x2d5b59=_0x2d5b59-0x85;const _0x3f3188=a0_0x3f31();let _0x1de6dc=_0x3f3188[_0x2d5b59];return _0x1de6dc;}Y(a0_0x40833c(0xe4)+f+a0_0x40833c(0xd2)+Z+'\x20RESUME_ID='+w[a0_0x40833c(0x9f)](0x0,0x8)+'...\x20TMUX='+(j||a0_0x40833c(0xef))+'\x20CWD='+process[a0_0x40833c(0x8f)]()+a0_0x40833c(0xa4)+L);var k=new Map(),K=new a0_0x23a3b2({'name':'commhub-channel','version':a0_0x40833c(0xbc)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x40833c(0xa7),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x40833c(0x9a),a0_0x40833c(0xf6),a0_0x40833c(0x10b)+Z][a0_0x40833c(0x106)]('\x0a')});K['setRequestHandler'](a0_0x3af468,async()=>({'tools':[{'name':a0_0x40833c(0xb0),'description':a0_0x40833c(0x8c),'inputSchema':{'type':a0_0x40833c(0xb2),'properties':{'task_id':{'type':a0_0x40833c(0xb5),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x40833c(0xb5),'description':a0_0x40833c(0xdd)},'status':{'type':a0_0x40833c(0xb5),'enum':['completed',a0_0x40833c(0xf3),'cancelled',a0_0x40833c(0xd8),'error',a0_0x40833c(0x92)],'description':a0_0x40833c(0x10d)}},'required':['text']}},{'name':a0_0x40833c(0x89),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x40833c(0xb2),'properties':{'status':{'type':a0_0x40833c(0xb5),'enum':[a0_0x40833c(0x85),a0_0x40833c(0xb4),a0_0x40833c(0xd8),a0_0x40833c(0xbe)]},'task':{'type':a0_0x40833c(0xb5),'description':a0_0x40833c(0xcb)},'progress':{'type':'number','description':a0_0x40833c(0x100)}},'required':[a0_0x40833c(0xe6)]}},{'name':a0_0x40833c(0xba),'description':a0_0x40833c(0x87),'inputSchema':{'type':a0_0x40833c(0xb2),'properties':{'alias':{'type':a0_0x40833c(0xb5),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x40833c(0xb5),'description':'Task\x20content'},'priority':{'type':'string','enum':['high','normal','low'],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x40833c(0x9c),'task']}},{'name':a0_0x40833c(0xee),'description':a0_0x40833c(0x9b),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x40833c(0xb5),'description':'Target\x20session\x20alias'},'message':{'type':'string','description':a0_0x40833c(0xb8)}},'required':[a0_0x40833c(0x9c),a0_0x40833c(0xb3)]}},{'name':a0_0x40833c(0x96),'description':a0_0x40833c(0xff),'inputSchema':{'type':'object','properties':{}}}]}));async function P(_0x3ee4cf,_0x56d041){const _0x396ddf=a0_0x40833c;let _0x4a229c=await fetch(f+_0x396ddf(0xa3),{'method':_0x396ddf(0xcf),'headers':{'Content-Type':_0x396ddf(0xcd),'Accept':_0x396ddf(0xa6),...X?{'Authorization':_0x396ddf(0x102)+X}:{}},'body':JSON[_0x396ddf(0xd7)]({'jsonrpc':_0x396ddf(0xeb),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x396ddf(0x10c),'capabilities':{},'clientInfo':{'name':_0x396ddf(0xa1),'version':_0x396ddf(0xbc)}}})});if(!_0x4a229c['ok']){let _0x3c1844=await _0x4a229c[_0x396ddf(0xac)]();return Y(_0x396ddf(0xfe)+_0x4a229c[_0x396ddf(0xe6)]+'\x20'+_0x3c1844[_0x396ddf(0x9f)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x4a229c[_0x396ddf(0xe6)]};}await _0x4a229c['text']();let _0x1be050=(await(await fetch(f+_0x396ddf(0xa3),{'method':_0x396ddf(0xcf),'headers':{'Content-Type':_0x396ddf(0xcd),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x396ddf(0x102)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x2,'method':_0x396ddf(0x105),'params':{'name':_0x3ee4cf,'arguments':_0x56d041}})}))[_0x396ddf(0xac)]())[_0x396ddf(0x98)]('\x0a')[_0x396ddf(0xfb)](_0x42fce8=>_0x42fce8[_0x396ddf(0xd4)](_0x396ddf(0x101)));if(_0x1be050){let _0xd5d3bd=JSON[_0x396ddf(0x88)](_0x1be050[_0x396ddf(0x9f)](0x6));return _0xd5d3bd?.[_0x396ddf(0xa9)]?.[_0x396ddf(0x10f)]?.[0x0]?.['text']?JSON[_0x396ddf(0x88)](_0xd5d3bd[_0x396ddf(0xa9)][_0x396ddf(0x10f)][0x0][_0x396ddf(0xac)]):_0xd5d3bd;}return{'ok':!0x1,'error':_0x396ddf(0xd9)};}K[a0_0x40833c(0xc6)](a0_0x18b3f2,async _0x2841f4=>{const _0x5cc7b4=a0_0x40833c;let {name:_0x87c849,arguments:_0x4b8432}=_0x2841f4[_0x5cc7b4(0xea)];if(_0x87c849===_0x5cc7b4(0xb0)){let {task_id:_0x21a24b,text:_0x4711b2,status:_0x585f4c}=_0x4b8432;if(_0x585f4c===_0x5cc7b4(0xe0)||_0x585f4c===_0x5cc7b4(0xf3)||_0x585f4c===_0x5cc7b4(0x99)){let _0x4827ae=_0x585f4c==='completed'?_0x5cc7b4(0x9d):_0x585f4c,_0x4e57ec=_0x21a24b?k[_0x5cc7b4(0xab)](_0x21a24b)||_0x5cc7b4(0xe8):_0x5cc7b4(0xe8),_0x24982d=await P(_0x5cc7b4(0xf5),{'alias':_0x4e57ec,'text':_0x4711b2,'in_reply_to':_0x21a24b||void 0x0,'status':_0x4827ae,'from_session':Z});if(_0x21a24b)k[_0x5cc7b4(0xb9)](_0x21a24b);return{'content':[{'type':'text','text':JSON['stringify'](_0x24982d)}]};}let _0x41a7c6=await P(_0x5cc7b4(0xd5),{'resume_id':w,'alias':Z,'status':_0x585f4c===_0x5cc7b4(0xd8)?_0x5cc7b4(0xd8):_0x585f4c===_0x5cc7b4(0xbe)?'error':_0x5cc7b4(0x85),'task':_0x4711b2[_0x5cc7b4(0x9f)](0x0,0xc8),'output':_0x4711b2});return{'content':[{'type':_0x5cc7b4(0xac),'text':JSON[_0x5cc7b4(0xd7)](_0x41a7c6)}]};}if(_0x87c849===_0x5cc7b4(0x89)){let {status:_0x22dedf,task:_0x12f7ac,progress:_0x568235}=_0x4b8432,_0x57072c=await P(_0x5cc7b4(0xd5),{'resume_id':w,'alias':Z,'status':_0x22dedf,'task':_0x12f7ac,'progress':_0x568235});return{'content':[{'type':_0x5cc7b4(0xac),'text':JSON[_0x5cc7b4(0xd7)](_0x57072c)}]};}if(_0x87c849===_0x5cc7b4(0xba)){let {alias:_0x3ce135,task:_0x578862,priority:_0x83b81a}=_0x4b8432,_0x28bf08=await P(_0x5cc7b4(0x94),{'alias':_0x3ce135,'task':_0x578862,'priority':_0x83b81a||_0x5cc7b4(0xc9),'from_session':Z});return{'content':[{'type':_0x5cc7b4(0xac),'text':JSON[_0x5cc7b4(0xd7)](_0x28bf08)}]};}if(_0x87c849===_0x5cc7b4(0xee)){let {alias:_0x1568aa,message:_0x546ab9}=_0x4b8432,_0x5b518e=await P(_0x5cc7b4(0x97),{'alias':_0x1568aa,'message':_0x546ab9,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x5cc7b4(0xd7)](_0x5b518e)}]};}if(_0x87c849==='commhub_get_all_status'){let _0x4f460d=await P(_0x5cc7b4(0xdf),{});return{'content':[{'type':'text','text':JSON[_0x5cc7b4(0xd7)](_0x4f460d)}]};}return{'content':[{'type':_0x5cc7b4(0xac),'text':JSON['stringify']({'error':'unknown\x20tool'})}]};});async function u(){const _0x364460=a0_0x40833c;let _0x280b6b=f+_0x364460(0xb1)+encodeURIComponent(Z),_0x32f883={};if(X)_0x32f883[_0x364460(0xd3)]=_0x364460(0x102)+X;Y(_0x364460(0xfc)+_0x280b6b);while(!0x0){try{let _0x15c405=await fetch(_0x280b6b,{'headers':_0x32f883});if(!_0x15c405['ok']){Y('SSE\x20error:\x20'+_0x15c405[_0x364460(0xe6)]+'\x20'+_0x15c405[_0x364460(0xbd)]),await h(0x1388);continue;}let _0x47c322=_0x15c405[_0x364460(0xf1)]['getReader'](),_0x185cc6=new TextDecoder(),_0x486f38='';while(!0x0){let {done:_0x1f7f80,value:_0x2c3cd3}=await _0x47c322[_0x364460(0xb6)]();if(_0x1f7f80)break;_0x486f38+=_0x185cc6['decode'](_0x2c3cd3,{'stream':!0x0});let _0x3a8b9d=_0x486f38['split']('\x0a\x0a');_0x486f38=_0x3a8b9d[_0x364460(0xd6)]()||'';for(let _0x54c154 of _0x3a8b9d){let _0x4697a3=_0x54c154['split']('\x0a')[_0x364460(0xfb)](_0x2957dd=>_0x2957dd[_0x364460(0xd4)]('data:\x20'));if(!_0x4697a3)continue;try{let _0x23e3b1=JSON[_0x364460(0x88)](_0x4697a3['slice'](0x6));await S(_0x23e3b1);}catch(_0x1ced78){Y(_0x364460(0xa5)+_0x1ced78);}}}Y(_0x364460(0x91));}catch(_0x12416f){Y(_0x364460(0xc0)+_0x12416f);}await h(0xbb8);}}async function S(_0x59268f){const _0x753b36=a0_0x40833c;if(_0x59268f[_0x753b36(0x103)]===_0x753b36(0x8a)){Y(_0x753b36(0x8d)+Z+'\x22');return;}if(_0x59268f[_0x753b36(0x103)]==='new_message'){if(Y(_0x753b36(0xa0)+_0x59268f[_0x753b36(0xa2)]+':\x20'+_0x59268f[_0x753b36(0xb3)][_0x753b36(0x9f)](0x0,0x3c)),await K['notification']({'method':_0x753b36(0x95),'params':{'content':_0x59268f[_0x753b36(0xb3)],'meta':{'sender':_0x59268f[_0x753b36(0xa2)]||_0x753b36(0xe8),'sender_id':_0x753b36(0xda),'user':_0x59268f[_0x753b36(0xa2)]||'hub','priority':_0x753b36(0xc9)}}}),_0x59268f['message_id'])await P(_0x753b36(0xaf),{'alias':Z,'message_id':_0x59268f['message_id']});return;}if(_0x59268f[_0x753b36(0x103)]===_0x753b36(0x86)||_0x59268f[_0x753b36(0x103)]===_0x753b36(0xc2)){Y('←\x20'+_0x59268f['type']+_0x753b36(0xe3)+_0x59268f['inbox_count']+'\x20priority='+(_0x59268f[_0x753b36(0xf4)]||_0x753b36(0xc9)));let _0x592a86=await P(_0x753b36(0x10e),{'alias':Z,'limit':0x5});if(_0x592a86?.['ok']&&_0x592a86[_0x753b36(0xbf)]?.[_0x753b36(0xa8)]>0x0)for(let _0x3086d3 of _0x592a86[_0x753b36(0xbf)]){let _0x3c8cf7={'sender':_0x3086d3[_0x753b36(0xe1)]||_0x753b36(0xe8),'sender_id':_0x753b36(0xda),'user':_0x3086d3[_0x753b36(0xe1)]||_0x753b36(0xe8),'task_id':_0x3086d3['id'],'priority':_0x3086d3[_0x753b36(0xf4)]||_0x753b36(0xc9)};k[_0x753b36(0xf0)](_0x3086d3['id'],_0x3086d3[_0x753b36(0xe1)]||_0x753b36(0xe8)),await K[_0x753b36(0xf9)]({'method':'notifications/claude/channel','params':{'content':_0x3086d3[_0x753b36(0x10f)],'meta':_0x3c8cf7}}),Y('→\x20injected\x20task\x20'+_0x3086d3['id']['slice'](0x0,0x8)+_0x753b36(0xd1)+_0x3086d3[_0x753b36(0xe1)]+':\x20'+_0x3086d3[_0x753b36(0x10f)][_0x753b36(0x9f)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x3086d3['id']});}}}async function A(){const _0x432a8b=a0_0x40833c;let _0x5d32d6=new a0_0x34239d();await K['connect'](_0x5d32d6),Y(_0x432a8b(0x8e)),Y('starting\x20SSE\x20listener...'),u()[_0x432a8b(0xca)](_0xd4595d=>Y(_0x432a8b(0xc4)+_0xd4595d)),P(_0x432a8b(0xd5),{'resume_id':w,'alias':Z,'status':_0x432a8b(0xb4),'server':a0_0x569c50(),'hostname':a0_0x569c50(),'agent':_0x432a8b(0xe9),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x432a8b(0xed)](()=>Y(_0x432a8b(0xfa)+Z+_0x432a8b(0xc3)+w[_0x432a8b(0x9f)](0x0,0x8)+')'))[_0x432a8b(0xca)](_0x813b2e=>Y('warning:\x20could\x20not\x20register:\x20'+_0x813b2e)),setInterval(()=>{const _0x6c9884=_0x432a8b;P(_0x6c9884(0xd5),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x569c50(),'hostname':a0_0x569c50(),'agent':_0x6c9884(0xe9),'project_dir':process[_0x6c9884(0x8f)](),'tmux_name':j||void 0x0})['catch'](_0xd6e1d4=>Y(_0x6c9884(0xdb)+_0xd6e1d4));},0x2bf20),Y(_0x432a8b(0x8b));}A()['catch'](_0x49c861=>{const _0xa5070d=a0_0x40833c;Y(_0xa5070d(0xc8)+_0x49c861),process[_0xa5070d(0x10a)](0x1);});async function N(){const _0x46bbdf=a0_0x40833c;Y(_0x46bbdf(0xc7)),await P(_0x46bbdf(0xd5),{'resume_id':w,'alias':Z,'status':_0x46bbdf(0xde),'task':_0x46bbdf(0xfd)})[_0x46bbdf(0xca)](()=>{}),process[_0x46bbdf(0x10a)](0x0);}process[a0_0x40833c(0xc5)]['on']('end',()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x40833c(0x93),()=>N());
|
|
2
|
+
const a0_0x12fd92=a0_0xb9af;(function(_0x6b7d2b,_0x345f46){const _0x3a9f25=a0_0xb9af,_0x13b723=_0x6b7d2b();while(!![]){try{const _0x367df2=parseInt(_0x3a9f25(0x135))/0x1+-parseInt(_0x3a9f25(0xf9))/0x2+-parseInt(_0x3a9f25(0xf6))/0x3+-parseInt(_0x3a9f25(0xfc))/0x4*(parseInt(_0x3a9f25(0x136))/0x5)+parseInt(_0x3a9f25(0xfa))/0x6+parseInt(_0x3a9f25(0xcf))/0x7+parseInt(_0x3a9f25(0x12d))/0x8;if(_0x367df2===_0x345f46)break;else _0x13b723['push'](_0x13b723['shift']());}catch(_0x5ad698){_0x13b723['push'](_0x13b723['shift']());}}}(a0_0x27e7,0x34871));import{readFileSync as a0_0x5e37d4,existsSync as a0_0x139094}from'fs';import{randomUUID as a0_0x318c5c}from'crypto';function a0_0xb9af(_0xc5381c,_0x118927){_0xc5381c=_0xc5381c-0xbb;const _0x27e77b=a0_0x27e7();let _0xb9af67=_0x27e77b[_0xc5381c];return _0xb9af67;}import{join as a0_0x4d66b4}from'path';import{hostname as a0_0x9279cc}from'os';import{execSync as a0_0x487d31}from'child_process';import{Server as a0_0x1c6ad5}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x4739e1}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x4c9982,CallToolRequestSchema as a0_0x12ae3e}from'@modelcontextprotocol/sdk/types.js';function a0_0x27e7(){const _0x2fe38f=['Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','POST','stdin','setRequestHandler','...\x20TMUX=','SSE\x20connected\x20as\x20\x22','delete','Bearer\x20','shutting\x20down,\x20reporting\x20offline...','blocked','init\x20failed:\x20','.anet','/mcp','commhub_reply','number','new_task','397839NXzFbZ','starting\x20SSE\x20listener...','indexOf','393210xyxsOJ','1739604ckvqwD','stderr','1516288BiaspI','SIGTERM','toTimeString','Task\x20content','Session\x20alias:\x20','Target\x20session\x20alias','get','send_task','message_id','send_message','application/json','find','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','message','failed','commhub-channel','claude-code','replace','set','status','2025-03-26','commhub_get_all_status','0.3.0','commhub','length','replied','from_session','Authorization','report_status','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','warning:\x20could\x20not\x20register:\x20','text','SSE\x20fatal:\x20','error','ack_inbox','registered\x20as\x20\x22','new_message','connecting\x20to\x20','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','catch','.claude/channels/commhub','token',':\x20inbox_count=','utf-8','get_all_status','slice','read','parse','4426592FRUMNF','\x20from\x20','2.0','working','CommHub\x20init\x20failed:\x20','params','heartbeat\x20failed:\x20','object','7250bQlrYP','5GaoHWX','parse\x20error:\x20','result','stringify','string','then','/events/','commhub_send_message','notification','trim','get_inbox',']\x20[commhub]\x20','\x20priority=','startsWith','broadcast','ENV:\x20URL=','getReader','http://127.0.0.1:9200','pop','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','\x20ALIAS=','data:\x20','completed','SSE\x20error:\x20','end','content','normal','idle','send_reply','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','split','commhub_send_task','hub','write','statusText','\x22\x20(','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','510545AKwiuQ','config.json','notifications/claude/channel','.env','cancelled','\x20PROJECT_ENV=','tmux\x20display-message\x20-p\x20\x27#S\x27','task','priority','\x20CWD=','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','ready\x20—\x20waiting\x20for\x20events','type','exit','cwd','commhub_report_status','low','connect','connected','Message\x20content','decode','messages','from'];a0_0x27e7=function(){return _0x2fe38f;};return a0_0x27e7();}function p(_0x5d90a8){const _0x1511a4=a0_0xb9af;if(!a0_0x139094(_0x5d90a8))return;for(let _0x239be1 of a0_0x5e37d4(_0x5d90a8,_0x1511a4(0x128))[_0x1511a4(0xc8)]('\x0a')){let _0x36cf39=_0x239be1[_0x1511a4(0x13f)]();if(!_0x36cf39||_0x36cf39[_0x1511a4(0x143)]('#'))continue;let _0x386605=_0x36cf39[_0x1511a4(0xf8)]('=');if(_0x386605<0x0)continue;let _0x3d3658=_0x36cf39[_0x1511a4(0x12a)](0x0,_0x386605)[_0x1511a4(0x13f)](),_0x131433=_0x36cf39['slice'](_0x386605+0x1)['trim']()[_0x1511a4(0x10d)](/^["']|["']$/g,'');if(!process.env[_0x3d3658])process.env[_0x3d3658]=_0x131433;}}var C=process.env.HOME||'~',T=a0_0x4d66b4(C,a0_0x12fd92(0x125));p(a0_0x4d66b4(T,a0_0x12fd92(0xd2)));var L=process[a0_0x12fd92(0xdd)]()[a0_0x12fd92(0x10d)](/\//g,'-');p(a0_0x4d66b4(T,L,a0_0x12fd92(0xd2)));function U(){const _0x38c738=a0_0x12fd92;try{return a0_0x487d31(_0x38c738(0xd5),{'encoding':'utf-8','timeout':0x7d0})[_0x38c738(0x13f)]();}catch{return'';}}function v(){const _0x47695b=a0_0x12fd92;try{let _0x2a8eb9=a0_0x4d66b4(C,_0x47695b(0xf1),_0x47695b(0xd0));if(a0_0x139094(_0x2a8eb9))return JSON['parse'](a0_0x5e37d4(_0x2a8eb9,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x12fd92(0xca)]||a0_0x12fd92(0xbb),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x9279cc(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x318c5c(),X=process.env.COMMHUB_TOKEN||H[a0_0x12fd92(0x126)]||'';function Y(_0x30e154){const _0x296e82=a0_0x12fd92;let _0x16ec26=new Date()[_0x296e82(0xfe)]()[_0x296e82(0x12a)](0x0,0x8);process[_0x296e82(0xfb)][_0x296e82(0xcb)]('['+_0x16ec26+_0x296e82(0x141)+_0x30e154+'\x0a');}function h(_0x37ede7){return new Promise(_0x14b114=>setTimeout(_0x14b114,_0x37ede7));}Y(a0_0x12fd92(0x145)+f+a0_0x12fd92(0xbe)+Z+'\x20RESUME_ID='+w[a0_0x12fd92(0x12a)](0x0,0x8)+a0_0x12fd92(0xea)+(j||'none')+a0_0x12fd92(0xd8)+process[a0_0x12fd92(0xdd)]()+a0_0x12fd92(0xd4)+L);var k=new Map(),K=new a0_0x1c6ad5({'name':a0_0x12fd92(0x10b),'version':a0_0x12fd92(0x112)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x12fd92(0xce),a0_0x12fd92(0x122),a0_0x12fd92(0xc7),a0_0x12fd92(0x123),a0_0x12fd92(0x100)+Z]['join']('\x0a')});K[a0_0x12fd92(0xe9)](a0_0x4c9982,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_0x12fd92(0x13a),'description':a0_0x12fd92(0x108)},'text':{'type':a0_0x12fd92(0x13a),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x12fd92(0x13a),'enum':[a0_0x12fd92(0xc0),a0_0x12fd92(0x10a),a0_0x12fd92(0xd3),a0_0x12fd92(0xef),'error','in_progress'],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':['text']}},{'name':a0_0x12fd92(0xde),'description':a0_0x12fd92(0xd9),'inputSchema':{'type':'object','properties':{'status':{'type':'string','enum':[a0_0x12fd92(0x130),a0_0x12fd92(0xc5),a0_0x12fd92(0xef),'error']},'task':{'type':a0_0x12fd92(0x13a),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x12fd92(0xf4),'description':'Progress\x200-100'}},'required':[a0_0x12fd92(0x10f)]}},{'name':a0_0x12fd92(0xc9),'description':a0_0x12fd92(0x119),'inputSchema':{'type':a0_0x12fd92(0x134),'properties':{'alias':{'type':a0_0x12fd92(0x13a),'description':a0_0x12fd92(0x101)},'task':{'type':a0_0x12fd92(0x13a),'description':a0_0x12fd92(0xff)},'priority':{'type':a0_0x12fd92(0x13a),'enum':['high',a0_0x12fd92(0xc4),a0_0x12fd92(0xdf)],'description':'Priority\x20(default:\x20normal)'}},'required':['alias',a0_0x12fd92(0xd6)]}},{'name':a0_0x12fd92(0x13d),'description':a0_0x12fd92(0xbd),'inputSchema':{'type':a0_0x12fd92(0x134),'properties':{'alias':{'type':a0_0x12fd92(0x13a),'description':a0_0x12fd92(0x101)},'message':{'type':a0_0x12fd92(0x13a),'description':a0_0x12fd92(0xe2)}},'required':['alias',a0_0x12fd92(0x109)]}},{'name':a0_0x12fd92(0x111),'description':a0_0x12fd92(0xe6),'inputSchema':{'type':a0_0x12fd92(0x134),'properties':{}}}]}));async function P(_0x3d8f6a,_0x2451f6){const _0x22f130=a0_0x12fd92;let _0x543b42=await fetch(f+_0x22f130(0xf2),{'method':_0x22f130(0xe7),'headers':{'Content-Type':_0x22f130(0x106),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x22f130(0xed)+X}:{}},'body':JSON[_0x22f130(0x139)]({'jsonrpc':_0x22f130(0x12f),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x22f130(0x110),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':'0.3.0'}}})});if(!_0x543b42['ok']){let _0x90c2bd=await _0x543b42['text']();return Y(_0x22f130(0x131)+_0x543b42['status']+'\x20'+_0x90c2bd[_0x22f130(0x12a)](0x0,0x64)),{'ok':!0x1,'error':_0x22f130(0xf0)+_0x543b42[_0x22f130(0x10f)]};}await _0x543b42[_0x22f130(0x11b)]();let _0x4830a2=(await(await fetch(f+'/mcp',{'method':_0x22f130(0xe7),'headers':{'Content-Type':_0x22f130(0x106),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x22f130(0xed)+X}:{}},'body':JSON[_0x22f130(0x139)]({'jsonrpc':_0x22f130(0x12f),'id':0x2,'method':'tools/call','params':{'name':_0x3d8f6a,'arguments':_0x2451f6}})}))[_0x22f130(0x11b)]())[_0x22f130(0xc8)]('\x0a')[_0x22f130(0x107)](_0x4e85c1=>_0x4e85c1[_0x22f130(0x143)](_0x22f130(0xbf)));if(_0x4830a2){let _0x4219be=JSON['parse'](_0x4830a2[_0x22f130(0x12a)](0x6));return _0x4219be?.[_0x22f130(0x138)]?.[_0x22f130(0xc3)]?.[0x0]?.[_0x22f130(0x11b)]?JSON[_0x22f130(0x12c)](_0x4219be[_0x22f130(0x138)][_0x22f130(0xc3)][0x0]['text']):_0x4219be;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x12fd92(0xe9)](a0_0x12ae3e,async _0x549de7=>{const _0x37ea36=a0_0x12fd92;let {name:_0x31c40f,arguments:_0x10f8fd}=_0x549de7[_0x37ea36(0x132)];if(_0x31c40f===_0x37ea36(0xf3)){let {task_id:_0x4efe,text:_0x4a4267,status:_0x1b7472}=_0x10f8fd;if(_0x1b7472===_0x37ea36(0xc0)||_0x1b7472==='failed'||_0x1b7472==='cancelled'){let _0x2be706=_0x1b7472===_0x37ea36(0xc0)?_0x37ea36(0x115):_0x1b7472,_0x39b38b=_0x4efe?k[_0x37ea36(0x102)](_0x4efe)||_0x37ea36(0xca):_0x37ea36(0xca),_0x5ad692=await P(_0x37ea36(0xc6),{'alias':_0x39b38b,'text':_0x4a4267,'in_reply_to':_0x4efe||void 0x0,'status':_0x2be706,'from_session':Z});if(_0x4efe)k[_0x37ea36(0xec)](_0x4efe);return{'content':[{'type':'text','text':JSON[_0x37ea36(0x139)](_0x5ad692)}]};}let _0x339078=await P(_0x37ea36(0x118),{'resume_id':w,'alias':Z,'status':_0x1b7472===_0x37ea36(0xef)?'blocked':_0x1b7472===_0x37ea36(0x11d)?_0x37ea36(0x11d):_0x37ea36(0x130),'task':_0x4a4267['slice'](0x0,0xc8),'output':_0x4a4267});return{'content':[{'type':'text','text':JSON[_0x37ea36(0x139)](_0x339078)}]};}if(_0x31c40f===_0x37ea36(0xde)){let {status:_0x3cfbf8,task:_0x5de56c,progress:_0x427f6a}=_0x10f8fd,_0x51bf54=await P(_0x37ea36(0x118),{'resume_id':w,'alias':Z,'status':_0x3cfbf8,'task':_0x5de56c,'progress':_0x427f6a});return{'content':[{'type':'text','text':JSON[_0x37ea36(0x139)](_0x51bf54)}]};}if(_0x31c40f===_0x37ea36(0xc9)){let {alias:_0x51a2ac,task:_0x52cdcb,priority:_0x2ea18c}=_0x10f8fd,_0x9c223b=await P(_0x37ea36(0x103),{'alias':_0x51a2ac,'task':_0x52cdcb,'priority':_0x2ea18c||'normal','from_session':Z});return{'content':[{'type':_0x37ea36(0x11b),'text':JSON[_0x37ea36(0x139)](_0x9c223b)}]};}if(_0x31c40f===_0x37ea36(0x13d)){let {alias:_0x453d95,message:_0x48f7eb}=_0x10f8fd,_0x1603a7=await P(_0x37ea36(0x105),{'alias':_0x453d95,'message':_0x48f7eb,'from_session':Z});return{'content':[{'type':_0x37ea36(0x11b),'text':JSON[_0x37ea36(0x139)](_0x1603a7)}]};}if(_0x31c40f===_0x37ea36(0x111)){let _0x5bf7b6=await P(_0x37ea36(0x129),{});return{'content':[{'type':_0x37ea36(0x11b),'text':JSON[_0x37ea36(0x139)](_0x5bf7b6)}]};}return{'content':[{'type':_0x37ea36(0x11b),'text':JSON['stringify']({'error':'unknown\x20tool'})}]};});async function u(){const _0x411db2=a0_0x12fd92;let _0x5a75f6=f+_0x411db2(0x13c)+encodeURIComponent(Z),_0x41f118={};if(X)_0x41f118[_0x411db2(0x117)]='Bearer\x20'+X;Y(_0x411db2(0x121)+_0x5a75f6);while(!0x0){try{let _0x2c59d5=await fetch(_0x5a75f6,{'headers':_0x41f118});if(!_0x2c59d5['ok']){Y(_0x411db2(0xc1)+_0x2c59d5[_0x411db2(0x10f)]+'\x20'+_0x2c59d5[_0x411db2(0xcc)]),await h(0x1388);continue;}let _0x19418c=_0x2c59d5['body'][_0x411db2(0x146)](),_0x512f12=new TextDecoder(),_0x47e9f4='';while(!0x0){let {done:_0x55acaa,value:_0x35aedd}=await _0x19418c[_0x411db2(0x12b)]();if(_0x55acaa)break;_0x47e9f4+=_0x512f12[_0x411db2(0xe3)](_0x35aedd,{'stream':!0x0});let _0xf265bd=_0x47e9f4[_0x411db2(0xc8)]('\x0a\x0a');_0x47e9f4=_0xf265bd[_0x411db2(0xbc)]()||'';for(let _0x5044ae of _0xf265bd){let _0x38faef=_0x5044ae[_0x411db2(0xc8)]('\x0a')[_0x411db2(0x107)](_0x5ec8f9=>_0x5ec8f9[_0x411db2(0x143)]('data:\x20'));if(!_0x38faef)continue;try{let _0x4dc15f=JSON[_0x411db2(0x12c)](_0x38faef['slice'](0x6));await S(_0x4dc15f);}catch(_0x200d96){Y(_0x411db2(0x137)+_0x200d96);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x4f0910){Y('SSE\x20connection\x20error:\x20'+_0x4f0910);}await h(0xbb8);}}async function S(_0x3cd753){const _0x132bd6=a0_0x12fd92;if(_0x3cd753[_0x132bd6(0xdb)]===_0x132bd6(0xe1)){Y(_0x132bd6(0xeb)+Z+'\x22');return;}if(_0x3cd753[_0x132bd6(0xdb)]===_0x132bd6(0x120)){if(Y('←\x20message\x20from\x20'+_0x3cd753[_0x132bd6(0xe5)]+':\x20'+_0x3cd753[_0x132bd6(0x109)][_0x132bd6(0x12a)](0x0,0x3c)),await K[_0x132bd6(0x13e)]({'method':_0x132bd6(0xd1),'params':{'content':_0x3cd753['message'],'meta':{'sender':_0x3cd753['from']||_0x132bd6(0xca),'sender_id':'commhub','user':_0x3cd753[_0x132bd6(0xe5)]||'hub','priority':_0x132bd6(0xc4)}}}),_0x3cd753[_0x132bd6(0x104)])await P(_0x132bd6(0x11e),{'alias':Z,'message_id':_0x3cd753[_0x132bd6(0x104)]});return;}if(_0x3cd753[_0x132bd6(0xdb)]===_0x132bd6(0xf5)||_0x3cd753[_0x132bd6(0xdb)]===_0x132bd6(0x144)){Y('←\x20'+_0x3cd753[_0x132bd6(0xdb)]+_0x132bd6(0x127)+_0x3cd753['inbox_count']+_0x132bd6(0x142)+(_0x3cd753[_0x132bd6(0xd7)]||_0x132bd6(0xc4)));let _0x402bc6=await P(_0x132bd6(0x140),{'alias':Z,'limit':0x5});if(_0x402bc6?.['ok']&&_0x402bc6['messages']?.[_0x132bd6(0x114)]>0x0)for(let _0xe262b1 of _0x402bc6[_0x132bd6(0xe4)]){let _0x324ed1={'sender':_0xe262b1[_0x132bd6(0x116)]||_0x132bd6(0xca),'sender_id':_0x132bd6(0x113),'user':_0xe262b1[_0x132bd6(0x116)]||'hub','task_id':_0xe262b1['id'],'priority':_0xe262b1[_0x132bd6(0xd7)]||_0x132bd6(0xc4)};k[_0x132bd6(0x10e)](_0xe262b1['id'],_0xe262b1['from_session']||_0x132bd6(0xca)),await K[_0x132bd6(0x13e)]({'method':_0x132bd6(0xd1),'params':{'content':_0xe262b1['content'],'meta':_0x324ed1}}),Y('→\x20injected\x20task\x20'+_0xe262b1['id'][_0x132bd6(0x12a)](0x0,0x8)+_0x132bd6(0x12e)+_0xe262b1[_0x132bd6(0x116)]+':\x20'+_0xe262b1[_0x132bd6(0xc3)][_0x132bd6(0x12a)](0x0,0x3c)),await P(_0x132bd6(0x11e),{'alias':Z,'message_id':_0xe262b1['id']});}}}async function A(){const _0x2838c4=a0_0x12fd92;let _0x138631=new a0_0x4739e1();await K[_0x2838c4(0xe0)](_0x138631),Y('MCP\x20stdio\x20connected'),Y(_0x2838c4(0xf7)),u()[_0x2838c4(0x124)](_0x5097e6=>Y(_0x2838c4(0x11c)+_0x5097e6)),P(_0x2838c4(0x118),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x9279cc(),'hostname':a0_0x9279cc(),'agent':'claude-code','project_dir':process[_0x2838c4(0xdd)](),'tmux_name':j||void 0x0})[_0x2838c4(0x13b)](()=>Y(_0x2838c4(0x11f)+Z+_0x2838c4(0xcd)+w[_0x2838c4(0x12a)](0x0,0x8)+')'))[_0x2838c4(0x124)](_0x4b74b2=>Y(_0x2838c4(0x11a)+_0x4b74b2)),setInterval(()=>{const _0x17869c=_0x2838c4;P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x9279cc(),'hostname':a0_0x9279cc(),'agent':_0x17869c(0x10c),'project_dir':process[_0x17869c(0xdd)](),'tmux_name':j||void 0x0})['catch'](_0x2e02f5=>Y(_0x17869c(0x133)+_0x2e02f5));},0x2bf20),Y(_0x2838c4(0xda));}A()['catch'](_0x47e9f5=>{Y('fatal:\x20'+_0x47e9f5),process['exit'](0x1);});async function N(){const _0x3fbdeb=a0_0x12fd92;Y(_0x3fbdeb(0xee)),await P(_0x3fbdeb(0x118),{'resume_id':w,'alias':Z,'status':'offline','task':'session\x20disconnected'})[_0x3fbdeb(0x124)](()=>{}),process[_0x3fbdeb(0xdc)](0x0);}process[a0_0x12fd92(0xe8)]['on'](a0_0x12fd92(0xc2),()=>N()),process['on'](a0_0x12fd92(0xfd),()=>N()),process['on']('SIGINT',()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8-preview.0",
|
|
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",
|