@sleep2agi/agent-network 2.0.3-preview.0 → 2.0.3-preview.1
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 +3 -3
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x21e523=a0_0x1570;(function(_0x157219,_0x5125e0){const _0x335971=a0_0x1570,_0x1c2e3f=_0x157219();while(!![]){try{const _0xff8802=parseInt(_0x335971(0x1e4))/0x1+parseInt(_0x335971(0x22c))/0x2+-parseInt(_0x335971(0x202))/0x3*(parseInt(_0x335971(0x1ee))/0x4)+-parseInt(_0x335971(0x1e5))/0x5+parseInt(_0x335971(0x22a))/0x6*(parseInt(_0x335971(0x1ff))/0x7)+parseInt(_0x335971(0x22d))/0x8+-parseInt(_0x335971(0x211))/0x9*(parseInt(_0x335971(0x1f6))/0xa);if(_0xff8802===_0x5125e0)break;else _0x1c2e3f['push'](_0x1c2e3f['shift']());}catch(_0x5a562b){_0x1c2e3f['push'](_0x1c2e3f['shift']());}}}(a0_0xb4d9,0xe1b0f));import{EventEmitter as a0_0xacfdb8}from'events';function a0_0xb4d9(){const _0x3e127b=['text/event-stream','decode','inbox\x20error:\x20','text','toString','1766276CafODT','1603865ivObju','connect','sseAbort','sdk','broadcast','Authorization','/mcp','startsWith','message','668ItsfvB','/events/','send','pop','server','call','reconnectDelay','new_task','5641430QymiaI','get_all_status','now','heartbeatInterval','signal','split','agent','stringify','result','42hNVrQq','slice','data:\x20','6747YXQddk','disconnected','disconnect','resumeId',']\x20[commhub:','connectSSE','sdk-','s...','type','normal','abort','body','idle','alias','heartbeat\x20failed:\x20','36daGzaQ','emit','Bearer\x20','registered','tools/call','status','error','AbortError','log','application/json','catch','parse','sleep','token','match','POST','reply','processInbox','send_message','SSE\x20failed:\x20','completed','content','heartbeatTimer','min','replace','297582IBiJSJ','get_inbox','3178688bkFvdM','1793256WuGOcu','name','new_message','messages','SSE\x20error:\x20','getReader','running','send_task','read','2.0','url'];a0_0xb4d9=function(){return _0x3e127b;};return a0_0xb4d9();}import{hostname as a0_0x68f641}from'os';class T extends a0_0xacfdb8{[a0_0x21e523(0x237)];[a0_0x21e523(0x20f)];[a0_0x21e523(0x21e)];[a0_0x21e523(0x1fc)];[a0_0x21e523(0x205)];[a0_0x21e523(0x1f9)];['reconnectDelay'];[a0_0x21e523(0x227)];['sseAbort'];[a0_0x21e523(0x233)]=!0x1;constructor(_0x53860e){const _0x431afc=a0_0x21e523;super();if(this[_0x431afc(0x237)]=_0x53860e[_0x431afc(0x237)][_0x431afc(0x229)](/\/$/,''),this['alias']=_0x53860e['alias'],this[_0x431afc(0x21e)]=_0x53860e[_0x431afc(0x21e)],this[_0x431afc(0x1fc)]=_0x53860e['agent']||_0x431afc(0x1e8),this[_0x431afc(0x205)]=_0x431afc(0x208)+_0x53860e[_0x431afc(0x20f)]+'-'+Date[_0x431afc(0x1f8)]()[_0x431afc(0x1e3)](0x24),this[_0x431afc(0x1f9)]=_0x53860e[_0x431afc(0x1f9)]??0x2bf20,this[_0x431afc(0x1f4)]=_0x53860e[_0x431afc(0x1f4)]??0xbb8,_0x53860e['autoConnect']!==!0x1)this[_0x431afc(0x1e6)]();}[a0_0x21e523(0x219)](_0x2d5317){const _0x329d59=a0_0x21e523;console[_0x329d59(0x219)]('['+new Date()['toTimeString']()[_0x329d59(0x200)](0x0,0x8)+_0x329d59(0x206)+this[_0x329d59(0x20f)]+']\x20'+_0x2d5317);}async[a0_0x21e523(0x1f3)](_0xac9f99,_0x23756a){const _0x4d0d0f=a0_0x21e523;let _0x561435={'Content-Type':_0x4d0d0f(0x21a),'Accept':'application/json,\x20text/event-stream'};if(this[_0x4d0d0f(0x21e)])_0x561435[_0x4d0d0f(0x1ea)]=_0x4d0d0f(0x213)+this[_0x4d0d0f(0x21e)];let _0x39c0b2=await(await fetch(this[_0x4d0d0f(0x237)]+_0x4d0d0f(0x1eb),{'method':_0x4d0d0f(0x220),'headers':_0x561435,'body':JSON[_0x4d0d0f(0x1fd)]({'jsonrpc':_0x4d0d0f(0x236),'id':Date['now'](),'method':_0x4d0d0f(0x215),'params':{'name':_0xac9f99,'arguments':_0x23756a}})}))[_0x4d0d0f(0x1e2)](),_0x1331c0=_0x39c0b2[_0x4d0d0f(0x21f)](/data: (.+)/),_0x2c03d8=_0x1331c0?JSON['parse'](_0x1331c0[0x1]):JSON['parse'](_0x39c0b2),_0x342d65=_0x2c03d8?.[_0x4d0d0f(0x1fe)]?.['content']?.[0x0]?.[_0x4d0d0f(0x1e2)];return _0x342d65?JSON[_0x4d0d0f(0x21c)](_0x342d65):_0x2c03d8;}async[a0_0x21e523(0x1e6)](){const _0x3a6f4b=a0_0x21e523;if(this[_0x3a6f4b(0x233)])return;this[_0x3a6f4b(0x233)]=!0x0,await this[_0x3a6f4b(0x216)](_0x3a6f4b(0x20e)),this[_0x3a6f4b(0x219)](_0x3a6f4b(0x214)),this[_0x3a6f4b(0x227)]=setInterval(()=>{const _0x5724df=_0x3a6f4b;this['status'](_0x5724df(0x20e))['catch'](_0x107ce3=>this[_0x5724df(0x219)](_0x5724df(0x210)+_0x107ce3[_0x5724df(0x1ed)]));},this[_0x3a6f4b(0x1f9)]),this[_0x3a6f4b(0x207)]();}async[a0_0x21e523(0x204)](){const _0x353d54=a0_0x21e523;if(this[_0x353d54(0x233)]=!0x1,this['sseAbort']?.[_0x353d54(0x20c)](),this[_0x353d54(0x227)])clearInterval(this['heartbeatTimer']);await this[_0x353d54(0x216)]('offline')[_0x353d54(0x21b)](()=>{}),this[_0x353d54(0x219)](_0x353d54(0x203));}async[a0_0x21e523(0x1f0)](_0xa66faf,_0x3ea9f8,_0x1ae9bf=a0_0x21e523(0x20b)){const _0x36122a=a0_0x21e523;return this['call'](_0x36122a(0x234),{'alias':_0xa66faf,'task':_0x3ea9f8,'priority':_0x1ae9bf,'from_session':this['alias']});}async['message'](_0x1667a8,_0x521159){const _0x571af5=a0_0x21e523;return this[_0x571af5(0x1f3)](_0x571af5(0x223),{'alias':_0x1667a8,'message':_0x521159,'from_session':this[_0x571af5(0x20f)]});}async[a0_0x21e523(0x221)](_0x3ba2a,_0x2381b8,_0x2d4ea6=a0_0x21e523(0x225)){const _0x2aa6fd=a0_0x21e523;return this[_0x2aa6fd(0x1f3)](_0x2aa6fd(0x221),{'task_id':_0x3ba2a,'text':_0x2381b8,'status':_0x2d4ea6});}async['status'](_0x39f87c,_0x25af02){const _0x202585=a0_0x21e523;return this[_0x202585(0x1f3)]('report_status',{'resume_id':this[_0x202585(0x205)],'alias':this[_0x202585(0x20f)],'status':_0x39f87c,'server':a0_0x68f641(),'hostname':a0_0x68f641(),'agent':this[_0x202585(0x1fc)],'project_dir':process['cwd'](),..._0x25af02});}async['getAllStatus'](){const _0x522226=a0_0x21e523;return this[_0x522226(0x1f3)](_0x522226(0x1f7),{});}async[a0_0x21e523(0x1e9)](_0x41527b,_0xd0232){const _0xf6f75d=a0_0x21e523;return this['call'](_0xf6f75d(0x1e9),{'message':_0x41527b,'filter_server':_0xd0232?.[_0xf6f75d(0x1f2)],'filter_status':_0xd0232?.[_0xf6f75d(0x216)]});}async[a0_0x21e523(0x207)](){const _0x358ebf=a0_0x21e523;let _0x56b96f=encodeURIComponent(this[_0x358ebf(0x20f)]),_0x1fe3b3=this[_0x358ebf(0x237)]+_0x358ebf(0x1ef)+_0x56b96f,_0x36c26d=this['reconnectDelay'];while(this['running']){try{this[_0x358ebf(0x1e7)]=new AbortController();let _0x29e3c9={'Accept':_0x358ebf(0x238)};if(this[_0x358ebf(0x21e)])_0x29e3c9[_0x358ebf(0x1ea)]='Bearer\x20'+this[_0x358ebf(0x21e)];let _0x25cd14=await fetch(_0x1fe3b3,{'headers':_0x29e3c9,'signal':this[_0x358ebf(0x1e7)][_0x358ebf(0x1fa)]});if(!_0x25cd14['ok']||!_0x25cd14[_0x358ebf(0x20d)]){this[_0x358ebf(0x219)](_0x358ebf(0x224)+_0x25cd14[_0x358ebf(0x216)]),await this['sleep'](_0x36c26d),_0x36c26d=Math[_0x358ebf(0x228)](_0x36c26d*1.5,0xea60);continue;}_0x36c26d=this[_0x358ebf(0x1f4)];let _0x241913=_0x25cd14[_0x358ebf(0x20d)][_0x358ebf(0x232)](),_0x45a23b=new TextDecoder(),_0x19f16f='';while(this[_0x358ebf(0x233)]){let {done:_0x52f314,value:_0x4b87fe}=await _0x241913[_0x358ebf(0x235)]();if(_0x52f314)break;_0x19f16f+=_0x45a23b[_0x358ebf(0x239)](_0x4b87fe,{'stream':!0x0});let _0x5eecdd=_0x19f16f[_0x358ebf(0x1fb)]('\x0a');_0x19f16f=_0x5eecdd[_0x358ebf(0x1f1)]()||'';for(let _0x3d4584 of _0x5eecdd){if(!_0x3d4584[_0x358ebf(0x1ec)](_0x358ebf(0x201)))continue;try{let _0x5777d9=JSON[_0x358ebf(0x21c)](_0x3d4584[_0x358ebf(0x200)](0x6));if(_0x5777d9['type']==='connected'){this['log']('SSE\x20connected'),this[_0x358ebf(0x212)]('connected');continue;}if(_0x5777d9['type']===_0x358ebf(0x1f5)||_0x5777d9['type']===_0x358ebf(0x22f)||_0x5777d9[_0x358ebf(0x20a)]===_0x358ebf(0x1e9))await this['processInbox']();}catch{}}}}catch(_0x3a7539){if(_0x3a7539[_0x358ebf(0x22e)]===_0x358ebf(0x218))break;this[_0x358ebf(0x212)](_0x358ebf(0x217),_0x3a7539),this['log'](_0x358ebf(0x231)+_0x3a7539[_0x358ebf(0x1ed)]);}if(this['running'])this[_0x358ebf(0x212)]('disconnected'),this[_0x358ebf(0x219)]('SSE\x20reconnecting\x20in\x20'+_0x36c26d/0x3e8+_0x358ebf(0x209)),await this[_0x358ebf(0x21d)](_0x36c26d),_0x36c26d=Math[_0x358ebf(0x228)](_0x36c26d*1.5,0xea60);}}async[a0_0x21e523(0x222)](){const _0x4febda=a0_0x21e523;try{let _0x4ad83b=(await this[_0x4febda(0x1f3)](_0x4febda(0x22b),{'alias':this['alias'],'limit':0xa}))?.[_0x4febda(0x230)]||[];for(let _0x330cda of _0x4ad83b)await this[_0x4febda(0x1f3)]('ack_inbox',{'alias':this[_0x4febda(0x20f)],'message_id':_0x330cda['id']}),this[_0x4febda(0x219)]('←\x20'+_0x330cda['from_session']+':\x20'+_0x330cda[_0x4febda(0x226)][_0x4febda(0x200)](0x0,0x3c)),this[_0x4febda(0x212)]('task',_0x330cda),this[_0x4febda(0x212)](_0x4febda(0x1ed),_0x330cda);}catch(_0x4dfc39){this[_0x4febda(0x219)](_0x4febda(0x1e1)+_0x4dfc39[_0x4febda(0x1ed)]);}}[a0_0x21e523(0x21d)](_0x3b6837){return new Promise(_0x2844b6=>setTimeout(_0x2844b6,_0x3b6837));}}var $=T;function a0_0x1570(_0x4369b8,_0x31e62b){_0x4369b8=_0x4369b8-0x1e1;const _0xb4d949=a0_0xb4d9();let _0x157030=_0xb4d949[_0x4369b8];return _0x157030;}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_0x51d63f=a0_0x1553;(function(_0x246343,_0xf37cd0){const _0x43ee9d=a0_0x1553,_0xdd07d=_0x246343();while(!![]){try{const _0xa4a345=parseInt(_0x43ee9d(0x1d5))/0x1+-parseInt(_0x43ee9d(0x177))/0x2*(-parseInt(_0x43ee9d(0x1a5))/0x3)+parseInt(_0x43ee9d(0x173))/0x4*(parseInt(_0x43ee9d(0x18c))/0x5)+parseInt(_0x43ee9d(0x17a))/0x6+-parseInt(_0x43ee9d(0x184))/0x7*(parseInt(_0x43ee9d(0x1da))/0x8)+-parseInt(_0x43ee9d(0x1ec))/0x9*(-parseInt(_0x43ee9d(0x1ae))/0xa)+-parseInt(_0x43ee9d(0x1c9))/0xb*(parseInt(_0x43ee9d(0x1bb))/0xc);if(_0xa4a345===_0xf37cd0)break;else _0xdd07d['push'](_0xdd07d['shift']());}catch(_0x3bf01d){_0xdd07d['push'](_0xdd07d['shift']());}}}(a0_0x892a,0x3641b));import{readFileSync as a0_0x189bc7,existsSync as a0_0x339850}from'fs';import{randomUUID as a0_0x5bd3a9}from'crypto';function a0_0x1553(_0x2f7437,_0x2e552e){_0x2f7437=_0x2f7437-0x15c;const _0x892a83=a0_0x892a();let _0x1553aa=_0x892a83[_0x2f7437];return _0x1553aa;}import{join as a0_0x50650a}from'path';import{hostname as a0_0x29d6ec}from'os';function a0_0x892a(){const _0x63b7ae=['heartbeat\x20failed:\x20','9594hhxWCm','statusText','setRequestHandler',':\x20inbox_count=','broadcast','MCP\x20stdio\x20connected','message','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','connected','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','slice','exit','ack_inbox','\x20CWD=','messages','write','claude-code','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','\x22\x20(','set','body','string','unknown\x20tool','new_task','488564XyZHLn',']\x20[commhub]\x20','content','status','691830xlDLIJ','toTimeString','http://127.0.0.1:9200','42246uQCJKo','parse\x20error:\x20','initialize','Message\x20content','low','commhub_report_status','inbox_count','/mcp','init\x20failed:\x20','type','147546VOVRIf','from','SIGINT','SSE\x20connected\x20as\x20\x22','Session\x20alias:\x20','.env','normal','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','10OKSJBN','Reply\x20text\x20/\x20result\x20summary','read','commhub_get_all_status','hub','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','length','SIGTERM','decode','catch','from_session','→\x20injected\x20task\x20','end','...\x20TMUX=','\x20from\x20','alias','Authorization','get','in_progress','split','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','POST','cwd','result','delete','3ewLifF','params','trim','shutting\x20down,\x20reporting\x20offline...','text','no\x20response','send_task','replace','token','50VPEgIH','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','startsWith','error','commhub_send_task','join','\x20priority=','high','utf-8','stdin','\x20PROJECT_ENV=','fatal:\x20','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','12IjMhmT','ENV:\x20URL=','Task\x20content','stringify','.anet','2025-03-26','task','commhub_reply','.claude/channels/commhub','\x20ALIAS=','application/json,\x20text/event-stream','blocked','parse','working','2519781dTgbvd','message_id','report_status','2.0','idle','0.3.0','notification','priority','session\x20disconnected','application/json','object','SSE\x20connection\x20error:\x20','80596GigsSt','commhub-channel','completed','commhub','Target\x20session\x20alias','88gBYhor','failed','CommHub\x20init\x20failed:\x20','warning:\x20could\x20not\x20register:\x20','none','Bearer\x20','commhub_send_message','find','/events/','ready\x20—\x20waiting\x20for\x20events','registered\x20as\x20\x22','notifications/claude/channel','data:\x20','Current\x20task\x20description','cancelled','←\x20message\x20from\x20','tools/call'];a0_0x892a=function(){return _0x63b7ae;};return a0_0x892a();}import{execSync as a0_0x91fe92}from'child_process';import{Server as a0_0x3392c5}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0xef4093}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x1dbfd2,CallToolRequestSchema as a0_0x79331d}from'@modelcontextprotocol/sdk/types.js';function p(_0x26271e){const _0x2daa02=a0_0x1553;if(!a0_0x339850(_0x26271e))return;for(let _0x1a770f of a0_0x189bc7(_0x26271e,_0x2daa02(0x1b6))[_0x2daa02(0x19f)]('\x0a')){let _0x5a047b=_0x1a770f[_0x2daa02(0x1a7)]();if(!_0x5a047b||_0x5a047b[_0x2daa02(0x1b0)]('#'))continue;let _0x3602cb=_0x5a047b['indexOf']('=');if(_0x3602cb<0x0)continue;let _0x3e3480=_0x5a047b[_0x2daa02(0x165)](0x0,_0x3602cb)[_0x2daa02(0x1a7)](),_0x1ba47f=_0x5a047b[_0x2daa02(0x165)](_0x3602cb+0x1)[_0x2daa02(0x1a7)]()[_0x2daa02(0x1ac)](/^["']|["']$/g,'');if(!process.env[_0x3e3480])process.env[_0x3e3480]=_0x1ba47f;}}var C=process.env.HOME||'~',T=a0_0x50650a(C,a0_0x51d63f(0x1c3));p(a0_0x50650a(T,'.env'));var L=process[a0_0x51d63f(0x1a2)]()['replace'](/\//g,'-');p(a0_0x50650a(T,L,a0_0x51d63f(0x189)));function U(){const _0x41fb69=a0_0x51d63f;try{return a0_0x91fe92('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x41fb69(0x1b6),'timeout':0x7d0})[_0x41fb69(0x1a7)]();}catch{return'';}}function v(){const _0x4a376d=a0_0x51d63f;try{let _0x9fb395=a0_0x50650a(C,_0x4a376d(0x1bf),'config.json');if(a0_0x339850(_0x9fb395))return JSON[_0x4a376d(0x1c7)](a0_0x189bc7(_0x9fb395,_0x4a376d(0x1b6)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x51d63f(0x190)]||a0_0x51d63f(0x179),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x29d6ec(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x5bd3a9(),X=process.env.COMMHUB_TOKEN||H[a0_0x51d63f(0x1ad)]||'';function Y(_0x2c9c3a){const _0x351a87=a0_0x51d63f;let _0x39deae=new Date()[_0x351a87(0x178)]()['slice'](0x0,0x8);process['stderr'][_0x351a87(0x16a)]('['+_0x39deae+_0x351a87(0x174)+_0x2c9c3a+'\x0a');}function h(_0x1cd24e){return new Promise(_0x21528b=>setTimeout(_0x21528b,_0x1cd24e));}Y(a0_0x51d63f(0x1bc)+f+a0_0x51d63f(0x1c4)+Z+'\x20RESUME_ID='+w[a0_0x51d63f(0x165)](0x0,0x8)+a0_0x51d63f(0x199)+(j||a0_0x51d63f(0x1de))+a0_0x51d63f(0x168)+process[a0_0x51d63f(0x1a2)]()+a0_0x51d63f(0x1b8)+L);var k=new Map(),K=new a0_0x3392c5({'name':a0_0x51d63f(0x1d6),'version':a0_0x51d63f(0x1ce)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':['Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>',a0_0x51d63f(0x1af),a0_0x51d63f(0x16c),a0_0x51d63f(0x1a0),a0_0x51d63f(0x188)+Z][a0_0x51d63f(0x1b3)]('\x0a')});K['setRequestHandler'](a0_0x1dbfd2,async()=>({'tools':[{'name':a0_0x51d63f(0x1c2),'description':a0_0x51d63f(0x162),'inputSchema':{'type':a0_0x51d63f(0x1d3),'properties':{'task_id':{'type':'string','description':a0_0x51d63f(0x191)},'text':{'type':a0_0x51d63f(0x170),'description':a0_0x51d63f(0x18d)},'status':{'type':a0_0x51d63f(0x170),'enum':[a0_0x51d63f(0x1d7),a0_0x51d63f(0x1db),'cancelled','blocked','error',a0_0x51d63f(0x19e)],'description':a0_0x51d63f(0x18b)}},'required':['text']}},{'name':'commhub_report_status','description':a0_0x51d63f(0x164),'inputSchema':{'type':a0_0x51d63f(0x1d3),'properties':{'status':{'type':a0_0x51d63f(0x170),'enum':[a0_0x51d63f(0x1c8),a0_0x51d63f(0x1cd),a0_0x51d63f(0x1c6),'error']},'task':{'type':a0_0x51d63f(0x170),'description':a0_0x51d63f(0x1e7)},'progress':{'type':'number','description':'Progress\x200-100'}},'required':[a0_0x51d63f(0x176)]}},{'name':a0_0x51d63f(0x1b2),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x51d63f(0x1d3),'properties':{'alias':{'type':a0_0x51d63f(0x170),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x51d63f(0x170),'description':a0_0x51d63f(0x1bd)},'priority':{'type':a0_0x51d63f(0x170),'enum':[a0_0x51d63f(0x1b5),a0_0x51d63f(0x18a),a0_0x51d63f(0x17e)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x51d63f(0x19b),a0_0x51d63f(0x1c1)]}},{'name':a0_0x51d63f(0x1e0),'description':a0_0x51d63f(0x1ba),'inputSchema':{'type':a0_0x51d63f(0x1d3),'properties':{'alias':{'type':'string','description':a0_0x51d63f(0x1d9)},'message':{'type':a0_0x51d63f(0x170),'description':a0_0x51d63f(0x17d)}},'required':['alias','message']}},{'name':a0_0x51d63f(0x18f),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x51d63f(0x1d3),'properties':{}}}]}));async function P(_0x4ded7a,_0x15263b){const _0x9c1116=a0_0x51d63f;let _0x125299=await fetch(f+'/mcp',{'method':_0x9c1116(0x1a1),'headers':{'Content-Type':_0x9c1116(0x1d2),'Accept':_0x9c1116(0x1c5),...X?{'Authorization':_0x9c1116(0x1df)+X}:{}},'body':JSON[_0x9c1116(0x1be)]({'jsonrpc':_0x9c1116(0x1cc),'id':0x1,'method':_0x9c1116(0x17c),'params':{'protocolVersion':_0x9c1116(0x1c0),'capabilities':{},'clientInfo':{'name':_0x9c1116(0x1d6),'version':_0x9c1116(0x1ce)}}})});if(!_0x125299['ok']){let _0x3bcf8c=await _0x125299[_0x9c1116(0x1a9)]();return Y(_0x9c1116(0x1dc)+_0x125299[_0x9c1116(0x176)]+'\x20'+_0x3bcf8c[_0x9c1116(0x165)](0x0,0x64)),{'ok':!0x1,'error':_0x9c1116(0x182)+_0x125299['status']};}await _0x125299[_0x9c1116(0x1a9)]();let _0xd24996=(await(await fetch(f+_0x9c1116(0x181),{'method':_0x9c1116(0x1a1),'headers':{'Content-Type':_0x9c1116(0x1d2),'Accept':_0x9c1116(0x1c5),...X?{'Authorization':_0x9c1116(0x1df)+X}:{}},'body':JSON[_0x9c1116(0x1be)]({'jsonrpc':'2.0','id':0x2,'method':_0x9c1116(0x1ea),'params':{'name':_0x4ded7a,'arguments':_0x15263b}})}))[_0x9c1116(0x1a9)]())[_0x9c1116(0x19f)]('\x0a')[_0x9c1116(0x1e1)](_0xefcaa6=>_0xefcaa6['startsWith']('data:\x20'));if(_0xd24996){let _0x3e967f=JSON[_0x9c1116(0x1c7)](_0xd24996['slice'](0x6));return _0x3e967f?.[_0x9c1116(0x1a3)]?.[_0x9c1116(0x175)]?.[0x0]?.['text']?JSON[_0x9c1116(0x1c7)](_0x3e967f[_0x9c1116(0x1a3)]['content'][0x0][_0x9c1116(0x1a9)]):_0x3e967f;}return{'ok':!0x1,'error':_0x9c1116(0x1aa)};}K[a0_0x51d63f(0x15d)](a0_0x79331d,async _0x14d2c1=>{const _0x487a88=a0_0x51d63f;let {name:_0x293598,arguments:_0x7570e9}=_0x14d2c1[_0x487a88(0x1a6)];if(_0x293598===_0x487a88(0x1c2)){let {task_id:_0x33247f,text:_0x3601a7,status:_0x2e2ef2}=_0x7570e9;if(_0x2e2ef2===_0x487a88(0x1d7)||_0x2e2ef2==='failed'||_0x2e2ef2===_0x487a88(0x1e8)){let _0x1c4f42=_0x2e2ef2==='completed'?'replied':_0x2e2ef2,_0x138fc3=_0x33247f?k[_0x487a88(0x19d)](_0x33247f)||_0x487a88(0x190):_0x487a88(0x190),_0x1008cb=await P('send_reply',{'alias':_0x138fc3,'text':_0x3601a7,'in_reply_to':_0x33247f||void 0x0,'status':_0x1c4f42,'from_session':Z});if(_0x33247f)k[_0x487a88(0x1a4)](_0x33247f);return{'content':[{'type':_0x487a88(0x1a9),'text':JSON[_0x487a88(0x1be)](_0x1008cb)}]};}let _0x4fc7ec=await P(_0x487a88(0x1cb),{'resume_id':w,'alias':Z,'status':_0x2e2ef2===_0x487a88(0x1c6)?'blocked':_0x2e2ef2==='error'?_0x487a88(0x1b1):_0x487a88(0x1c8),'task':_0x3601a7['slice'](0x0,0xc8),'output':_0x3601a7});return{'content':[{'type':_0x487a88(0x1a9),'text':JSON['stringify'](_0x4fc7ec)}]};}if(_0x293598===_0x487a88(0x17f)){let {status:_0x356971,task:_0x3bef7a,progress:_0x988567}=_0x7570e9,_0x21daac=await P(_0x487a88(0x1cb),{'resume_id':w,'alias':Z,'status':_0x356971,'task':_0x3bef7a,'progress':_0x988567});return{'content':[{'type':_0x487a88(0x1a9),'text':JSON[_0x487a88(0x1be)](_0x21daac)}]};}if(_0x293598==='commhub_send_task'){let {alias:_0x58ffe7,task:_0x380ae8,priority:_0x47ff69}=_0x7570e9,_0x3d1492=await P(_0x487a88(0x1ab),{'alias':_0x58ffe7,'task':_0x380ae8,'priority':_0x47ff69||_0x487a88(0x18a),'from_session':Z});return{'content':[{'type':_0x487a88(0x1a9),'text':JSON['stringify'](_0x3d1492)}]};}if(_0x293598===_0x487a88(0x1e0)){let {alias:_0x5334e3,message:_0x540662}=_0x7570e9,_0x3c733c=await P('send_message',{'alias':_0x5334e3,'message':_0x540662,'from_session':Z});return{'content':[{'type':_0x487a88(0x1a9),'text':JSON[_0x487a88(0x1be)](_0x3c733c)}]};}if(_0x293598==='commhub_get_all_status'){let _0x177c90=await P('get_all_status',{});return{'content':[{'type':_0x487a88(0x1a9),'text':JSON['stringify'](_0x177c90)}]};}return{'content':[{'type':_0x487a88(0x1a9),'text':JSON[_0x487a88(0x1be)]({'error':_0x487a88(0x171)})}]};});async function u(){const _0x3ee9fc=a0_0x51d63f;let _0x109fab=f+_0x3ee9fc(0x1e2)+encodeURIComponent(Z),_0x5236f0={};if(X)_0x5236f0[_0x3ee9fc(0x19c)]=_0x3ee9fc(0x1df)+X;Y('connecting\x20to\x20'+_0x109fab);while(!0x0){try{let _0x8e24b5=await fetch(_0x109fab,{'headers':_0x5236f0});if(!_0x8e24b5['ok']){Y('SSE\x20error:\x20'+_0x8e24b5['status']+'\x20'+_0x8e24b5[_0x3ee9fc(0x15c)]),await h(0x1388);continue;}let _0x4c720f=_0x8e24b5[_0x3ee9fc(0x16f)]['getReader'](),_0x1e7099=new TextDecoder(),_0x240b40='';while(!0x0){let {done:_0x119cc4,value:_0x11c7cf}=await _0x4c720f[_0x3ee9fc(0x18e)]();if(_0x119cc4)break;_0x240b40+=_0x1e7099[_0x3ee9fc(0x194)](_0x11c7cf,{'stream':!0x0});let _0x2b324f=_0x240b40[_0x3ee9fc(0x19f)]('\x0a\x0a');_0x240b40=_0x2b324f['pop']()||'';for(let _0x229957 of _0x2b324f){let _0x8ed258=_0x229957['split']('\x0a')[_0x3ee9fc(0x1e1)](_0xc2f680=>_0xc2f680[_0x3ee9fc(0x1b0)](_0x3ee9fc(0x1e6)));if(!_0x8ed258)continue;try{let _0x5f4cd0=JSON[_0x3ee9fc(0x1c7)](_0x8ed258[_0x3ee9fc(0x165)](0x6));await S(_0x5f4cd0);}catch(_0x58f1e5){Y(_0x3ee9fc(0x17b)+_0x58f1e5);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x67a721){Y(_0x3ee9fc(0x1d4)+_0x67a721);}await h(0xbb8);}}async function S(_0x2ff1a8){const _0x8aedc6=a0_0x51d63f;if(_0x2ff1a8[_0x8aedc6(0x183)]===_0x8aedc6(0x163)){Y(_0x8aedc6(0x187)+Z+'\x22');return;}if(_0x2ff1a8[_0x8aedc6(0x183)]==='new_message'){if(Y(_0x8aedc6(0x1e9)+_0x2ff1a8[_0x8aedc6(0x185)]+':\x20'+_0x2ff1a8[_0x8aedc6(0x161)][_0x8aedc6(0x165)](0x0,0x3c)),await K[_0x8aedc6(0x1cf)]({'method':'notifications/claude/channel','params':{'content':_0x2ff1a8[_0x8aedc6(0x161)],'meta':{'sender':_0x2ff1a8[_0x8aedc6(0x185)]||_0x8aedc6(0x190),'sender_id':_0x8aedc6(0x1d8),'user':_0x2ff1a8[_0x8aedc6(0x185)]||_0x8aedc6(0x190),'priority':_0x8aedc6(0x18a)}}}),_0x2ff1a8[_0x8aedc6(0x1ca)])await P(_0x8aedc6(0x167),{'alias':Z,'message_id':_0x2ff1a8[_0x8aedc6(0x1ca)]});return;}if(_0x2ff1a8[_0x8aedc6(0x183)]===_0x8aedc6(0x172)||_0x2ff1a8[_0x8aedc6(0x183)]===_0x8aedc6(0x15f)){Y('←\x20'+_0x2ff1a8['type']+_0x8aedc6(0x15e)+_0x2ff1a8[_0x8aedc6(0x180)]+_0x8aedc6(0x1b4)+(_0x2ff1a8[_0x8aedc6(0x1d0)]||_0x8aedc6(0x18a)));let _0x4ee615=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x4ee615?.['ok']&&_0x4ee615[_0x8aedc6(0x169)]?.[_0x8aedc6(0x192)]>0x0)for(let _0x188044 of _0x4ee615['messages']){let _0x2a1c1c={'sender':_0x188044[_0x8aedc6(0x196)]||_0x8aedc6(0x190),'sender_id':'commhub','user':_0x188044[_0x8aedc6(0x196)]||'hub','task_id':_0x188044['id'],'priority':_0x188044[_0x8aedc6(0x1d0)]||'normal'};k[_0x8aedc6(0x16e)](_0x188044['id'],_0x188044[_0x8aedc6(0x196)]||_0x8aedc6(0x190)),await K['notification']({'method':_0x8aedc6(0x1e5),'params':{'content':_0x188044['content'],'meta':_0x2a1c1c}}),Y(_0x8aedc6(0x197)+_0x188044['id']['slice'](0x0,0x8)+_0x8aedc6(0x19a)+_0x188044['from_session']+':\x20'+_0x188044[_0x8aedc6(0x175)][_0x8aedc6(0x165)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x188044['id']});}}}async function A(){const _0x5940b6=a0_0x51d63f;let _0x44525f=new a0_0xef4093();await K['connect'](_0x44525f),Y(_0x5940b6(0x160)),Y('starting\x20SSE\x20listener...'),u()[_0x5940b6(0x195)](_0x5abf77=>Y('SSE\x20fatal:\x20'+_0x5abf77)),P(_0x5940b6(0x1cb),{'resume_id':w,'alias':Z,'status':_0x5940b6(0x1cd),'server':a0_0x29d6ec(),'hostname':a0_0x29d6ec(),'agent':_0x5940b6(0x16b),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})['then'](()=>Y(_0x5940b6(0x1e4)+Z+_0x5940b6(0x16d)+w[_0x5940b6(0x165)](0x0,0x8)+')'))['catch'](_0x1f94af=>Y(_0x5940b6(0x1dd)+_0x1f94af)),setInterval(()=>{const _0x55fa6a=_0x5940b6;P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x29d6ec(),'hostname':a0_0x29d6ec(),'agent':_0x55fa6a(0x16b),'project_dir':process[_0x55fa6a(0x1a2)](),'tmux_name':j||void 0x0})['catch'](_0x46a733=>Y(_0x55fa6a(0x1eb)+_0x46a733));},0x2bf20),Y(_0x5940b6(0x1e3));}A()[a0_0x51d63f(0x195)](_0x1588ab=>{const _0x58c150=a0_0x51d63f;Y(_0x58c150(0x1b9)+_0x1588ab),process[_0x58c150(0x166)](0x1);});async function N(){const _0x4da88b=a0_0x51d63f;Y(_0x4da88b(0x1a8)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x4da88b(0x1b1),'task':_0x4da88b(0x1d1)})[_0x4da88b(0x195)](()=>{}),process[_0x4da88b(0x166)](0x0);}process[a0_0x51d63f(0x1b7)]['on'](a0_0x51d63f(0x198),()=>N()),process['on'](a0_0x51d63f(0x193),()=>N()),process['on'](a0_0x51d63f(0x186),()=>N());
|
|
2
|
+
const a0_0x1fb043=a0_0x3fd0;function a0_0x3fd0(_0x3fed2d,_0x3bceba){_0x3fed2d=_0x3fed2d-0x17e;const _0x260636=a0_0x2606();let _0x3fd068=_0x260636[_0x3fed2d];return _0x3fd068;}(function(_0x2b7026,_0x1f6ba7){const _0x3d37b0=a0_0x3fd0,_0x5a8ecb=_0x2b7026();while(!![]){try{const _0x176bc1=parseInt(_0x3d37b0(0x1ad))/0x1*(-parseInt(_0x3d37b0(0x1fd))/0x2)+-parseInt(_0x3d37b0(0x1aa))/0x3*(parseInt(_0x3d37b0(0x1e5))/0x4)+parseInt(_0x3d37b0(0x194))/0x5+-parseInt(_0x3d37b0(0x1e7))/0x6+parseInt(_0x3d37b0(0x18e))/0x7+parseInt(_0x3d37b0(0x1bd))/0x8*(-parseInt(_0x3d37b0(0x1bc))/0x9)+parseInt(_0x3d37b0(0x20a))/0xa;if(_0x176bc1===_0x1f6ba7)break;else _0x5a8ecb['push'](_0x5a8ecb['shift']());}catch(_0x550600){_0x5a8ecb['push'](_0x5a8ecb['shift']());}}}(a0_0x2606,0xb9b46));import{readFileSync as a0_0x380778,existsSync as a0_0x2b920d}from'fs';import{randomUUID as a0_0xceeb96}from'crypto';import{join as a0_0x165ce1}from'path';import{hostname as a0_0x57eb8e}from'os';import{execSync as a0_0x3aab6c}from'child_process';import{Server as a0_0x17a9ad}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x286539}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x4acb31,CallToolRequestSchema as a0_0x5c4c62}from'@modelcontextprotocol/sdk/types.js';function p(_0x1bc723){const _0x28a8fb=a0_0x3fd0;if(!a0_0x2b920d(_0x1bc723))return;for(let _0x57174f of a0_0x380778(_0x1bc723,'utf-8')['split']('\x0a')){let _0x5de1f2=_0x57174f[_0x28a8fb(0x192)]();if(!_0x5de1f2||_0x5de1f2[_0x28a8fb(0x1c9)]('#'))continue;let _0x4f1516=_0x5de1f2[_0x28a8fb(0x191)]('=');if(_0x4f1516<0x0)continue;let _0x50f9c2=_0x5de1f2[_0x28a8fb(0x1af)](0x0,_0x4f1516)[_0x28a8fb(0x192)](),_0x3d613e=_0x5de1f2[_0x28a8fb(0x1af)](_0x4f1516+0x1)['trim']()[_0x28a8fb(0x1d7)](/^["']|["']$/g,'');if(!process.env[_0x50f9c2])process.env[_0x50f9c2]=_0x3d613e;}}var C=process.env.HOME||'~',T=a0_0x165ce1(C,a0_0x1fb043(0x205));p(a0_0x165ce1(T,a0_0x1fb043(0x1b6)));var L=process[a0_0x1fb043(0x1f5)]()[a0_0x1fb043(0x1d7)](/\//g,'-');p(a0_0x165ce1(T,L,a0_0x1fb043(0x1b6)));function U(){const _0x149ec2=a0_0x1fb043;try{return a0_0x3aab6c('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x149ec2(0x1d1),'timeout':0x7d0})['trim']();}catch{return'';}}function v(){const _0x1f9f22=a0_0x1fb043;try{let _0x3b7d0b=a0_0x165ce1(C,_0x1f9f22(0x1d2),_0x1f9f22(0x1a4));if(a0_0x2b920d(_0x3b7d0b))return JSON['parse'](a0_0x380778(_0x3b7d0b,_0x1f9f22(0x1d1)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H['hub']||a0_0x1fb043(0x184),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x57eb8e(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0xceeb96(),X=process.env.COMMHUB_TOKEN||H[a0_0x1fb043(0x1d3)]||'';function Y(_0x45f162){const _0x364bce=a0_0x1fb043;let _0x350016=new Date()[_0x364bce(0x19e)]()['slice'](0x0,0x8);process['stderr'][_0x364bce(0x1d6)]('['+_0x350016+_0x364bce(0x19b)+_0x45f162+'\x0a');}function h(_0xfe00dc){return new Promise(_0x5904cb=>setTimeout(_0x5904cb,_0xfe00dc));}Y('ENV:\x20URL='+f+a0_0x1fb043(0x204)+Z+a0_0x1fb043(0x1fc)+w['slice'](0x0,0x8)+a0_0x1fb043(0x1e1)+(j||a0_0x1fb043(0x1df))+a0_0x1fb043(0x18a)+process[a0_0x1fb043(0x1f5)]()+a0_0x1fb043(0x1b2)+L);function a0_0x2606(){const _0x1c7dd5=['fatal:\x20','split','881548cmymNe','Progress\x200-100','1566804UGBSxi','0.3.0','shutting\x20down,\x20reporting\x20offline...','setRequestHandler','string','POST','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','Bearer\x20','hub','connected','commhub','SIGINT','from','notification','cwd','idle','Task\x20content','error','2.0','type','registered\x20as\x20\x22','\x20RESUME_ID=','816984vSIjog',':\x20inbox_count=','commhub_send_task','set','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','send_reply','message_id','\x20ALIAS=','.claude/channels/commhub','CommHub\x20init\x20failed:\x20','SSE\x20connection\x20error:\x20','working','/mcp','35125280noGmfb','then','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','number','tools/call','stringify','initialize','commhub_get_all_status','get','length','blocked','http://127.0.0.1:9200','parse','←\x20message\x20from\x20','params','exit','new_message','\x20CWD=','high','read','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','365799eQLyHq','join','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','indexOf','trim','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','4910100vVcXQj','SSE\x20error:\x20','SSE\x20stream\x20ended,\x20reconnecting...','from_session','normal','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','pop',']\x20[commhub]\x20','parse\x20error:\x20','find','toTimeString','\x20priority=','object','messages','inbox_count','MCP\x20stdio\x20connected','config.json','status','Session\x20alias:\x20','send_task','application/json,\x20text/event-stream','message','15zOBPNb','application/json','Priority\x20(default:\x20normal)','3ZcrPuL','end','slice','session\x20disconnected','text','\x20PROJECT_ENV=','priority','commhub_report_status','\x20from\x20','.env','get_inbox','SIGTERM','failed','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','no\x20response','10778526sEcFbU','8faiQVR','broadcast','SSE\x20fatal:\x20','Reply\x20text\x20/\x20result\x20summary','in_progress','\x22\x20(','heartbeat\x20failed:\x20','content','task','body','delete','cancelled','startsWith','report_status','commhub_send_message','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','unknown\x20tool','get_all_status','2025-03-26','completed','utf-8','.anet','token','alias','claude-code','write','replace','commhub_reply','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','data:\x20','Target\x20session\x20alias','result','Authorization','notifications/claude/channel','none','catch','...\x20TMUX=','connecting\x20to\x20'];a0_0x2606=function(){return _0x1c7dd5;};return a0_0x2606();}var k=new Map(),K=new a0_0x17a9ad({'name':'commhub-channel','version':a0_0x1fb043(0x1e8)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x1fb043(0x1d9),a0_0x1fb043(0x201),a0_0x1fb043(0x1cc),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x1fb043(0x1a6)+Z][a0_0x1fb043(0x18f)]('\x0a')});K[a0_0x1fb043(0x1ea)](a0_0x4acb31,async()=>({'tools':[{'name':a0_0x1fb043(0x1d8),'description':a0_0x1fb043(0x199),'inputSchema':{'type':a0_0x1fb043(0x1a0),'properties':{'task_id':{'type':'string','description':a0_0x1fb043(0x193)},'text':{'type':a0_0x1fb043(0x1eb),'description':a0_0x1fb043(0x1c0)},'status':{'type':a0_0x1fb043(0x1eb),'enum':[a0_0x1fb043(0x1d0),'failed',a0_0x1fb043(0x1c8),a0_0x1fb043(0x183),a0_0x1fb043(0x1f8),a0_0x1fb043(0x1c1)],'description':a0_0x1fb043(0x1ed)}},'required':['text']}},{'name':a0_0x1fb043(0x1b4),'description':a0_0x1fb043(0x1ba),'inputSchema':{'type':a0_0x1fb043(0x1a0),'properties':{'status':{'type':a0_0x1fb043(0x1eb),'enum':[a0_0x1fb043(0x208),a0_0x1fb043(0x1f6),a0_0x1fb043(0x183),a0_0x1fb043(0x1f8)]},'task':{'type':a0_0x1fb043(0x1eb),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x1fb043(0x20d),'description':a0_0x1fb043(0x1e6)}},'required':['status']}},{'name':a0_0x1fb043(0x1ff),'description':a0_0x1fb043(0x18d),'inputSchema':{'type':a0_0x1fb043(0x1a0),'properties':{'alias':{'type':a0_0x1fb043(0x1eb),'description':a0_0x1fb043(0x1db)},'task':{'type':'string','description':a0_0x1fb043(0x1f7)},'priority':{'type':a0_0x1fb043(0x1eb),'enum':[a0_0x1fb043(0x18b),a0_0x1fb043(0x198),'low'],'description':a0_0x1fb043(0x1ac)}},'required':[a0_0x1fb043(0x1d4),a0_0x1fb043(0x1c5)]}},{'name':a0_0x1fb043(0x1cb),'description':a0_0x1fb043(0x190),'inputSchema':{'type':a0_0x1fb043(0x1a0),'properties':{'alias':{'type':'string','description':a0_0x1fb043(0x1db)},'message':{'type':a0_0x1fb043(0x1eb),'description':'Message\x20content'}},'required':[a0_0x1fb043(0x1d4),'message']}},{'name':'commhub_get_all_status','description':a0_0x1fb043(0x20c),'inputSchema':{'type':a0_0x1fb043(0x1a0),'properties':{}}}]}));async function P(_0xf24d51,_0x25567d){const _0x1c5c98=a0_0x1fb043;let _0x406c43=await fetch(f+_0x1c5c98(0x209),{'method':_0x1c5c98(0x1ec),'headers':{'Content-Type':_0x1c5c98(0x1ab),'Accept':_0x1c5c98(0x1a8),...X?{'Authorization':_0x1c5c98(0x1ee)+X}:{}},'body':JSON[_0x1c5c98(0x17e)]({'jsonrpc':_0x1c5c98(0x1f9),'id':0x1,'method':_0x1c5c98(0x17f),'params':{'protocolVersion':_0x1c5c98(0x1cf),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x1c5c98(0x1e8)}}})});if(!_0x406c43['ok']){let _0x4b1f01=await _0x406c43[_0x1c5c98(0x1b1)]();return Y(_0x1c5c98(0x206)+_0x406c43['status']+'\x20'+_0x4b1f01[_0x1c5c98(0x1af)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x406c43['status']};}await _0x406c43[_0x1c5c98(0x1b1)]();let _0x2727b0=(await(await fetch(f+_0x1c5c98(0x209),{'method':_0x1c5c98(0x1ec),'headers':{'Content-Type':_0x1c5c98(0x1ab),'Accept':_0x1c5c98(0x1a8),...X?{'Authorization':_0x1c5c98(0x1ee)+X}:{}},'body':JSON[_0x1c5c98(0x17e)]({'jsonrpc':_0x1c5c98(0x1f9),'id':0x2,'method':_0x1c5c98(0x20e),'params':{'name':_0xf24d51,'arguments':_0x25567d}})}))[_0x1c5c98(0x1b1)]())[_0x1c5c98(0x1e4)]('\x0a')[_0x1c5c98(0x19d)](_0x53466d=>_0x53466d[_0x1c5c98(0x1c9)]('data:\x20'));if(_0x2727b0){let _0x21e172=JSON[_0x1c5c98(0x185)](_0x2727b0['slice'](0x6));return _0x21e172?.[_0x1c5c98(0x1dc)]?.[_0x1c5c98(0x1c4)]?.[0x0]?.['text']?JSON[_0x1c5c98(0x185)](_0x21e172[_0x1c5c98(0x1dc)][_0x1c5c98(0x1c4)][0x0]['text']):_0x21e172;}return{'ok':!0x1,'error':_0x1c5c98(0x1bb)};}K[a0_0x1fb043(0x1ea)](a0_0x5c4c62,async _0x468feb=>{const _0x37b00b=a0_0x1fb043;let {name:_0x5ce16a,arguments:_0x339e03}=_0x468feb[_0x37b00b(0x187)];if(_0x5ce16a===_0x37b00b(0x1d8)){let {task_id:_0x41730d,text:_0x4afb44,status:_0x16d189}=_0x339e03;if(_0x16d189==='completed'||_0x16d189===_0x37b00b(0x1b9)||_0x16d189===_0x37b00b(0x1c8)){let _0x4dbd70=_0x16d189===_0x37b00b(0x1d0)?'replied':_0x16d189,_0x3e2b75=_0x41730d?k[_0x37b00b(0x181)](_0x41730d)||_0x37b00b(0x1ef):_0x37b00b(0x1ef),_0x14b666=await P(_0x37b00b(0x202),{'alias':_0x3e2b75,'text':_0x4afb44,'in_reply_to':_0x41730d||void 0x0,'status':_0x4dbd70,'from_session':Z});if(_0x41730d)k[_0x37b00b(0x1c7)](_0x41730d);return{'content':[{'type':_0x37b00b(0x1b1),'text':JSON[_0x37b00b(0x17e)](_0x14b666)}]};}let _0x3a3c88=await P(_0x37b00b(0x1ca),{'resume_id':w,'alias':Z,'status':_0x16d189===_0x37b00b(0x183)?_0x37b00b(0x183):_0x16d189===_0x37b00b(0x1f8)?_0x37b00b(0x1f8):_0x37b00b(0x208),'task':_0x4afb44[_0x37b00b(0x1af)](0x0,0xc8),'output':_0x4afb44});return{'content':[{'type':'text','text':JSON[_0x37b00b(0x17e)](_0x3a3c88)}]};}if(_0x5ce16a===_0x37b00b(0x1b4)){let {status:_0x4fd357,task:_0x3e9829,progress:_0x3eecf}=_0x339e03,_0x58d0ff=await P(_0x37b00b(0x1ca),{'resume_id':w,'alias':Z,'status':_0x4fd357,'task':_0x3e9829,'progress':_0x3eecf});return{'content':[{'type':_0x37b00b(0x1b1),'text':JSON[_0x37b00b(0x17e)](_0x58d0ff)}]};}if(_0x5ce16a===_0x37b00b(0x1ff)){let {alias:_0x4fe7a2,task:_0x588f77,priority:_0x1cb584}=_0x339e03,_0x5a1cac=await P(_0x37b00b(0x1a7),{'alias':_0x4fe7a2,'task':_0x588f77,'priority':_0x1cb584||'normal','from_session':Z});return{'content':[{'type':_0x37b00b(0x1b1),'text':JSON[_0x37b00b(0x17e)](_0x5a1cac)}]};}if(_0x5ce16a==='commhub_send_message'){let {alias:_0x17fccc,message:_0x4bc11e}=_0x339e03,_0x470091=await P('send_message',{'alias':_0x17fccc,'message':_0x4bc11e,'from_session':Z});return{'content':[{'type':_0x37b00b(0x1b1),'text':JSON[_0x37b00b(0x17e)](_0x470091)}]};}if(_0x5ce16a===_0x37b00b(0x180)){let _0x3689da=await P(_0x37b00b(0x1ce),{});return{'content':[{'type':_0x37b00b(0x1b1),'text':JSON[_0x37b00b(0x17e)](_0x3689da)}]};}return{'content':[{'type':_0x37b00b(0x1b1),'text':JSON['stringify']({'error':_0x37b00b(0x1cd)})}]};});async function u(){const _0x45b215=a0_0x1fb043;let _0x36a486=f+'/events/'+encodeURIComponent(Z),_0x143674={};if(X)_0x143674[_0x45b215(0x1dd)]='Bearer\x20'+X;Y(_0x45b215(0x1e2)+_0x36a486);while(!0x0){try{let _0x17a88c=await fetch(_0x36a486,{'headers':_0x143674});if(!_0x17a88c['ok']){Y(_0x45b215(0x195)+_0x17a88c[_0x45b215(0x1a5)]+'\x20'+_0x17a88c['statusText']),await h(0x1388);continue;}let _0x25fd68=_0x17a88c[_0x45b215(0x1c6)]['getReader'](),_0x4e492f=new TextDecoder(),_0x114249='';while(!0x0){let {done:_0x1cbef3,value:_0x1d8b6c}=await _0x25fd68[_0x45b215(0x18c)]();if(_0x1cbef3)break;_0x114249+=_0x4e492f['decode'](_0x1d8b6c,{'stream':!0x0});let _0x171be8=_0x114249[_0x45b215(0x1e4)]('\x0a\x0a');_0x114249=_0x171be8[_0x45b215(0x19a)]()||'';for(let _0x55e1d6 of _0x171be8){let _0x515745=_0x55e1d6[_0x45b215(0x1e4)]('\x0a')[_0x45b215(0x19d)](_0x22c3cc=>_0x22c3cc[_0x45b215(0x1c9)](_0x45b215(0x1da)));if(!_0x515745)continue;try{let _0x20039a=JSON[_0x45b215(0x185)](_0x515745[_0x45b215(0x1af)](0x6));await S(_0x20039a);}catch(_0x6e7b3c){Y(_0x45b215(0x19c)+_0x6e7b3c);}}}Y(_0x45b215(0x196));}catch(_0x2bb4e1){Y(_0x45b215(0x207)+_0x2bb4e1);}await h(0xbb8);}}async function S(_0xa325f0){const _0x3e81fa=a0_0x1fb043;if(_0xa325f0[_0x3e81fa(0x1fa)]===_0x3e81fa(0x1f0)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0xa325f0[_0x3e81fa(0x1fa)]===_0x3e81fa(0x189)){if(Y(_0x3e81fa(0x186)+_0xa325f0[_0x3e81fa(0x1f3)]+':\x20'+_0xa325f0[_0x3e81fa(0x1a9)]['slice'](0x0,0x3c)),await K[_0x3e81fa(0x1f4)]({'method':_0x3e81fa(0x1de),'params':{'content':_0xa325f0[_0x3e81fa(0x1a9)],'meta':{'sender':_0xa325f0[_0x3e81fa(0x1f3)]||_0x3e81fa(0x1ef),'sender_id':_0x3e81fa(0x1f1),'user':_0xa325f0[_0x3e81fa(0x1f3)]||_0x3e81fa(0x1ef),'priority':_0x3e81fa(0x198)}}}),_0xa325f0[_0x3e81fa(0x203)])await P('ack_inbox',{'alias':Z,'message_id':_0xa325f0[_0x3e81fa(0x203)]});return;}if(_0xa325f0[_0x3e81fa(0x1fa)]==='new_task'||_0xa325f0['type']===_0x3e81fa(0x1be)){Y('←\x20'+_0xa325f0[_0x3e81fa(0x1fa)]+_0x3e81fa(0x1fe)+_0xa325f0[_0x3e81fa(0x1a2)]+_0x3e81fa(0x19f)+(_0xa325f0[_0x3e81fa(0x1b3)]||'normal'));let _0x2f1f03=await P(_0x3e81fa(0x1b7),{'alias':Z,'limit':0x5});if(_0x2f1f03?.['ok']&&_0x2f1f03[_0x3e81fa(0x1a1)]?.[_0x3e81fa(0x182)]>0x0)for(let _0x2eb657 of _0x2f1f03['messages']){let _0x4ec2a0={'sender':_0x2eb657[_0x3e81fa(0x197)]||_0x3e81fa(0x1ef),'sender_id':_0x3e81fa(0x1f1),'user':_0x2eb657[_0x3e81fa(0x197)]||_0x3e81fa(0x1ef),'task_id':_0x2eb657['id'],'priority':_0x2eb657[_0x3e81fa(0x1b3)]||'normal'};k[_0x3e81fa(0x200)](_0x2eb657['id'],_0x2eb657[_0x3e81fa(0x197)]||_0x3e81fa(0x1ef)),await K[_0x3e81fa(0x1f4)]({'method':_0x3e81fa(0x1de),'params':{'content':_0x2eb657[_0x3e81fa(0x1c4)],'meta':_0x4ec2a0}}),Y('→\x20injected\x20task\x20'+_0x2eb657['id']['slice'](0x0,0x8)+_0x3e81fa(0x1b5)+_0x2eb657[_0x3e81fa(0x197)]+':\x20'+_0x2eb657[_0x3e81fa(0x1c4)]['slice'](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x2eb657['id']});}}}async function A(){const _0x4ce97b=a0_0x1fb043;let _0x472b50=new a0_0x286539();await K['connect'](_0x472b50),Y(_0x4ce97b(0x1a3)),Y('starting\x20SSE\x20listener...'),u()[_0x4ce97b(0x1e0)](_0x687ce=>Y(_0x4ce97b(0x1bf)+_0x687ce)),P(_0x4ce97b(0x1ca),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x57eb8e(),'hostname':a0_0x57eb8e(),'agent':_0x4ce97b(0x1d5),'project_dir':process[_0x4ce97b(0x1f5)](),'tmux_name':j||void 0x0})[_0x4ce97b(0x20b)](()=>Y(_0x4ce97b(0x1fb)+Z+_0x4ce97b(0x1c2)+w[_0x4ce97b(0x1af)](0x0,0x8)+')'))[_0x4ce97b(0x1e0)](_0x14566b=>Y('warning:\x20could\x20not\x20register:\x20'+_0x14566b)),setInterval(()=>{const _0x4297ea=_0x4ce97b;P('report_status',{'resume_id':w,'alias':Z,'status':_0x4297ea(0x1f6),'server':a0_0x57eb8e(),'hostname':a0_0x57eb8e(),'agent':'claude-code','project_dir':process[_0x4297ea(0x1f5)](),'tmux_name':j||void 0x0})[_0x4297ea(0x1e0)](_0x33f9ad=>Y(_0x4297ea(0x1c3)+_0x33f9ad));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x1fb043(0x1e0)](_0xbaaa87=>{const _0x5440fc=a0_0x1fb043;Y(_0x5440fc(0x1e3)+_0xbaaa87),process[_0x5440fc(0x188)](0x1);});async function N(){const _0x19cfe7=a0_0x1fb043;Y(_0x19cfe7(0x1e9)),await P('report_status',{'resume_id':w,'alias':Z,'status':'error','task':_0x19cfe7(0x1b0)})['catch'](()=>{}),process['exit'](0x0);}process['stdin']['on'](a0_0x1fb043(0x1ae),()=>N()),process['on'](a0_0x1fb043(0x1b8),()=>N()),process['on'](a0_0x1fb043(0x1f2),()=>N());
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.0.3-preview.
|
|
4
|
-
"description": "AI Agent Network CLI
|
|
3
|
+
"version": "2.0.3-preview.1",
|
|
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",
|
|
7
7
|
"types": "dist/client.d.ts",
|
|
@@ -59,4 +59,4 @@
|
|
|
59
59
|
"node-pty": "^1.1.0",
|
|
60
60
|
"typescript": "^5.0.0"
|
|
61
61
|
}
|
|
62
|
-
}
|
|
62
|
+
}
|