@sleep2agi/agent-network 2.0.3-preview.6 → 2.0.3-preview.8
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/README.md +33 -21
- 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_0x9020(_0x4a1639,_0x124ab2){_0x4a1639=_0x4a1639-0x1bd;const _0x303dd5=a0_0x303d();let _0x902060=_0x303dd5[_0x4a1639];return _0x902060;}const a0_0x1af585=a0_0x9020;(function(_0x1e3a4b,_0x91b717){const _0x38cc6c=a0_0x9020,_0x1744d5=_0x1e3a4b();while(!![]){try{const _0x51acca=-parseInt(_0x38cc6c(0x1df))/0x1+parseInt(_0x38cc6c(0x1de))/0x2+-parseInt(_0x38cc6c(0x1d8))/0x3*(-parseInt(_0x38cc6c(0x205))/0x4)+parseInt(_0x38cc6c(0x1fd))/0x5+parseInt(_0x38cc6c(0x1f9))/0x6*(-parseInt(_0x38cc6c(0x1fc))/0x7)+parseInt(_0x38cc6c(0x1e4))/0x8+-parseInt(_0x38cc6c(0x1bf))/0x9*(-parseInt(_0x38cc6c(0x1c5))/0xa);if(_0x51acca===_0x91b717)break;else _0x1744d5['push'](_0x1744d5['shift']());}catch(_0x2b5aeb){_0x1744d5['push'](_0x1744d5['shift']());}}}(a0_0x303d,0x40396));import{EventEmitter as a0_0x3c5632}from'events';function a0_0x303d(){const _0x4c4382=['get_inbox','stringify','text/event-stream','offline','status','disconnected','report_status','server','url','emit','SSE\x20error:\x20','abort','type','s...','decode','normal','12muTKSm','broadcast','heartbeatTimer','987952yAVeVT','688485hLynfI','heartbeat\x20failed:\x20','from_session','read','startsWith','agent','tools/call','/mcp','4VCtxmT','Authorization','connectSSE','text','application/json','name','sdk-','reply','ack_inbox','toTimeString','get_all_status','disconnect','messages','parse','3200031fddiAa','content','SSE\x20connected','send_message','connected','SSE\x20failed:\x20','10MmuTyl','task','sseAbort','alias','heartbeatInterval','error','AbortError','reconnectDelay','pop','body','min','message','autoConnect','token','catch','split','log','registered','call','90327zWcbbA','result','connect','replace','idle','new_task','733668OioZQB','459874SNsJQM','SSE\x20reconnecting\x20in\x20','running','cwd','data:\x20','920072dmSYOW','slice','getReader','now','resumeId'];a0_0x303d=function(){return _0x4c4382;};return a0_0x303d();}import{hostname as a0_0x146331}from'os';class T extends a0_0x3c5632{['url'];[a0_0x1af585(0x1c8)];['token'];['agent'];[a0_0x1af585(0x1e8)];[a0_0x1af585(0x1c9)];[a0_0x1af585(0x1cc)];[a0_0x1af585(0x1fb)];[a0_0x1af585(0x1c7)];[a0_0x1af585(0x1e1)]=!0x1;constructor(_0x1f1d87){const _0xb73fe6=a0_0x1af585;super();if(this[_0xb73fe6(0x1f1)]=_0x1f1d87[_0xb73fe6(0x1f1)][_0xb73fe6(0x1db)](/\/$/,''),this['alias']=_0x1f1d87[_0xb73fe6(0x1c8)],this[_0xb73fe6(0x1d2)]=_0x1f1d87[_0xb73fe6(0x1d2)],this['agent']=_0x1f1d87[_0xb73fe6(0x202)]||'sdk',this[_0xb73fe6(0x1e8)]=_0xb73fe6(0x20b)+_0x1f1d87['alias']+'-'+Date['now']()['toString'](0x24),this[_0xb73fe6(0x1c9)]=_0x1f1d87[_0xb73fe6(0x1c9)]??0x2bf20,this[_0xb73fe6(0x1cc)]=_0x1f1d87[_0xb73fe6(0x1cc)]??0xbb8,_0x1f1d87[_0xb73fe6(0x1d1)]!==!0x1)this[_0xb73fe6(0x1da)]();}[a0_0x1af585(0x1d5)](_0x4b9695){const _0xd452f7=a0_0x1af585;console[_0xd452f7(0x1d5)]('['+new Date()[_0xd452f7(0x20e)]()[_0xd452f7(0x1e5)](0x0,0x8)+']\x20[commhub:'+this[_0xd452f7(0x1c8)]+']\x20'+_0x4b9695);}async['call'](_0x5a978a,_0x324115){const _0x38db84=a0_0x1af585;let _0x19974c={'Content-Type':_0x38db84(0x209),'Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x19974c['Authorization']='Bearer\x20'+this[_0x38db84(0x1d2)];let _0x568d25=await(await fetch(this[_0x38db84(0x1f1)]+_0x38db84(0x204),{'method':'POST','headers':_0x19974c,'body':JSON[_0x38db84(0x1ea)]({'jsonrpc':'2.0','id':Date[_0x38db84(0x1e7)](),'method':_0x38db84(0x203),'params':{'name':_0x5a978a,'arguments':_0x324115}})}))[_0x38db84(0x208)](),_0x14f051=_0x568d25['match'](/data: (.+)/),_0x4e4243=_0x14f051?JSON[_0x38db84(0x1be)](_0x14f051[0x1]):JSON[_0x38db84(0x1be)](_0x568d25),_0x289d40=_0x4e4243?.[_0x38db84(0x1d9)]?.[_0x38db84(0x1c0)]?.[0x0]?.[_0x38db84(0x208)];return _0x289d40?JSON[_0x38db84(0x1be)](_0x289d40):_0x4e4243;}async[a0_0x1af585(0x1da)](){const _0x5b12d3=a0_0x1af585;if(this[_0x5b12d3(0x1e1)])return;this[_0x5b12d3(0x1e1)]=!0x0,await this['status'](_0x5b12d3(0x1dc)),this[_0x5b12d3(0x1d5)](_0x5b12d3(0x1d6)),this[_0x5b12d3(0x1fb)]=setInterval(()=>{const _0x9e898a=_0x5b12d3;this['status'](_0x9e898a(0x1dc))[_0x9e898a(0x1d3)](_0xfe24d0=>this[_0x9e898a(0x1d5)](_0x9e898a(0x1fe)+_0xfe24d0[_0x9e898a(0x1d0)]));},this[_0x5b12d3(0x1c9)]),this[_0x5b12d3(0x207)]();}async[a0_0x1af585(0x210)](){const _0x502b0f=a0_0x1af585;if(this[_0x502b0f(0x1e1)]=!0x1,this[_0x502b0f(0x1c7)]?.[_0x502b0f(0x1f4)](),this['heartbeatTimer'])clearInterval(this[_0x502b0f(0x1fb)]);await this[_0x502b0f(0x1ed)](_0x502b0f(0x1ec))[_0x502b0f(0x1d3)](()=>{}),this['log'](_0x502b0f(0x1ee));}async['send'](_0x33bfc7,_0x3ceb34,_0xcef331=a0_0x1af585(0x1f8)){const _0x2abe41=a0_0x1af585;return this[_0x2abe41(0x1d7)]('send_task',{'alias':_0x33bfc7,'task':_0x3ceb34,'priority':_0xcef331,'from_session':this[_0x2abe41(0x1c8)]});}async['message'](_0x6c15dc,_0x92f715){const _0x4c7808=a0_0x1af585;return this[_0x4c7808(0x1d7)](_0x4c7808(0x1c2),{'alias':_0x6c15dc,'message':_0x92f715,'from_session':this[_0x4c7808(0x1c8)]});}async[a0_0x1af585(0x20c)](_0x3282d5,_0x2a6015,_0x46ec74='completed'){const _0x2c26e3=a0_0x1af585;return this[_0x2c26e3(0x1d7)](_0x2c26e3(0x20c),{'task_id':_0x3282d5,'text':_0x2a6015,'status':_0x46ec74});}async[a0_0x1af585(0x1ed)](_0x42dfa6,_0x26ce79){const _0x38e38e=a0_0x1af585;return this[_0x38e38e(0x1d7)](_0x38e38e(0x1ef),{'resume_id':this['resumeId'],'alias':this['alias'],'status':_0x42dfa6,'server':a0_0x146331(),'hostname':a0_0x146331(),'agent':this['agent'],'project_dir':process[_0x38e38e(0x1e2)](),..._0x26ce79});}async['getAllStatus'](){const _0x2b2cd9=a0_0x1af585;return this['call'](_0x2b2cd9(0x20f),{});}async[a0_0x1af585(0x1fa)](_0x3e276c,_0x2a63a5){const _0x1b7877=a0_0x1af585;return this[_0x1b7877(0x1d7)](_0x1b7877(0x1fa),{'message':_0x3e276c,'filter_server':_0x2a63a5?.[_0x1b7877(0x1f0)],'filter_status':_0x2a63a5?.['status']});}async['connectSSE'](){const _0x11dbe3=a0_0x1af585;let _0x25fb80=encodeURIComponent(this[_0x11dbe3(0x1c8)]),_0x2611e2=this['url']+'/events/'+_0x25fb80,_0x27a3f5=this[_0x11dbe3(0x1cc)];while(this[_0x11dbe3(0x1e1)]){try{this[_0x11dbe3(0x1c7)]=new AbortController();let _0x181911={'Accept':_0x11dbe3(0x1eb)};if(this[_0x11dbe3(0x1d2)])_0x181911[_0x11dbe3(0x206)]='Bearer\x20'+this['token'];let _0x25e1f5=await fetch(_0x2611e2,{'headers':_0x181911,'signal':this['sseAbort']['signal']});if(!_0x25e1f5['ok']||!_0x25e1f5[_0x11dbe3(0x1ce)]){this['log'](_0x11dbe3(0x1c4)+_0x25e1f5[_0x11dbe3(0x1ed)]),await this['sleep'](_0x27a3f5),_0x27a3f5=Math['min'](_0x27a3f5*1.5,0xea60);continue;}_0x27a3f5=this[_0x11dbe3(0x1cc)];let _0x3e0646=_0x25e1f5[_0x11dbe3(0x1ce)][_0x11dbe3(0x1e6)](),_0x25e866=new TextDecoder(),_0x9cbde6='';while(this[_0x11dbe3(0x1e1)]){let {done:_0x5ab50b,value:_0x58b4fa}=await _0x3e0646[_0x11dbe3(0x200)]();if(_0x5ab50b)break;_0x9cbde6+=_0x25e866[_0x11dbe3(0x1f7)](_0x58b4fa,{'stream':!0x0});let _0x415c12=_0x9cbde6[_0x11dbe3(0x1d4)]('\x0a');_0x9cbde6=_0x415c12[_0x11dbe3(0x1cd)]()||'';for(let _0xe3645f of _0x415c12){if(!_0xe3645f[_0x11dbe3(0x201)](_0x11dbe3(0x1e3)))continue;try{let _0x54223e=JSON[_0x11dbe3(0x1be)](_0xe3645f[_0x11dbe3(0x1e5)](0x6));if(_0x54223e[_0x11dbe3(0x1f5)]==='connected'){this['log'](_0x11dbe3(0x1c1)),this[_0x11dbe3(0x1f2)](_0x11dbe3(0x1c3));continue;}if(_0x54223e[_0x11dbe3(0x1f5)]===_0x11dbe3(0x1dd)||_0x54223e[_0x11dbe3(0x1f5)]==='new_message'||_0x54223e[_0x11dbe3(0x1f5)]===_0x11dbe3(0x1fa))await this['processInbox']();}catch{}}}}catch(_0x13e236){if(_0x13e236[_0x11dbe3(0x20a)]===_0x11dbe3(0x1cb))break;this['emit'](_0x11dbe3(0x1ca),_0x13e236),this['log'](_0x11dbe3(0x1f3)+_0x13e236['message']);}if(this['running'])this[_0x11dbe3(0x1f2)](_0x11dbe3(0x1ee)),this[_0x11dbe3(0x1d5)](_0x11dbe3(0x1e0)+_0x27a3f5/0x3e8+_0x11dbe3(0x1f6)),await this['sleep'](_0x27a3f5),_0x27a3f5=Math[_0x11dbe3(0x1cf)](_0x27a3f5*1.5,0xea60);}}async['processInbox'](){const _0x72b6f6=a0_0x1af585;try{let _0x38d482=(await this['call'](_0x72b6f6(0x1e9),{'alias':this['alias'],'limit':0xa}))?.[_0x72b6f6(0x1bd)]||[];for(let _0x33d211 of _0x38d482)await this[_0x72b6f6(0x1d7)](_0x72b6f6(0x20d),{'alias':this['alias'],'message_id':_0x33d211['id']}),this['log']('←\x20'+_0x33d211[_0x72b6f6(0x1ff)]+':\x20'+_0x33d211[_0x72b6f6(0x1c0)][_0x72b6f6(0x1e5)](0x0,0x3c)),this[_0x72b6f6(0x1f2)](_0x72b6f6(0x1c6),_0x33d211),this['emit'](_0x72b6f6(0x1d0),_0x33d211);}catch(_0x4cf21e){this[_0x72b6f6(0x1d5)]('inbox\x20error:\x20'+_0x4cf21e[_0x72b6f6(0x1d0)]);}}['sleep'](_0x2e826c){return new Promise(_0x2f9146=>setTimeout(_0x2f9146,_0x2e826c));}}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_0x7aafc0=a0_0x1020;(function(_0x7bf55e,_0x5c5022){const _0x707f38=a0_0x1020,_0x4b8f9a=_0x7bf55e();while(!![]){try{const _0x4e50b4=-parseInt(_0x707f38(0x23b))/0x1*(-parseInt(_0x707f38(0x1cf))/0x2)+-parseInt(_0x707f38(0x1db))/0x3+parseInt(_0x707f38(0x1eb))/0x4*(parseInt(_0x707f38(0x242))/0x5)+-parseInt(_0x707f38(0x239))/0x6*(-parseInt(_0x707f38(0x215))/0x7)+-parseInt(_0x707f38(0x23e))/0x8*(parseInt(_0x707f38(0x1cc))/0x9)+-parseInt(_0x707f38(0x1dc))/0xa*(-parseInt(_0x707f38(0x220))/0xb)+-parseInt(_0x707f38(0x237))/0xc*(-parseInt(_0x707f38(0x1cb))/0xd);if(_0x4e50b4===_0x5c5022)break;else _0x4b8f9a['push'](_0x4b8f9a['shift']());}catch(_0x5aa56c){_0x4b8f9a['push'](_0x4b8f9a['shift']());}}}(a0_0x5d18,0xa9bd4));import{readFileSync as a0_0x47030e,existsSync as a0_0x18d67c}from'fs';import{randomUUID as a0_0x3b37a1}from'crypto';function a0_0x5d18(){const _0x106f55=['object','write','data:\x20','config.json','failed','130mToxTs','126531VYWusQ','setRequestHandler','\x20RESUME_ID=','186620aYOArC','application/json,\x20text/event-stream','notifications/claude/channel','/events/','shutting\x20down,\x20reporting\x20offline...','body','working','messages','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','from_session','idle','SIGTERM','2018004MbXOAH','3409720KTShiQ','new_task','registered\x20as\x20\x22','alias','POST','/mcp','priority','report_status','replied','commhub_get_all_status','application/json','then','\x20CWD=','Task\x20content','slice','1760404mmjnRb','SSE\x20connection\x20error:\x20','connecting\x20to\x20','getReader','Priority\x20(default:\x20normal)','init\x20failed:\x20','commhub-channel','ENV:\x20URL=','read','connected','get_inbox','toTimeString','commhub_report_status','message','message_id','find','from',':\x20inbox_count=','.env','no\x20response','send_message','2025-03-26','normal','params','utf-8','warning:\x20could\x20not\x20register:\x20','heartbeat\x20failed:\x20','exit','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','tools/call','completed','\x22\x20(','initialize','in_progress','claude-code','parse\x20error:\x20','cwd','commhub_send_message','parse','ack_inbox','text','connect','273Crcwir','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','catch','trim','notification','send_reply','Authorization','token','...\x20TMUX=','SSE\x20connected\x20as\x20\x22','low','22FgvdqG','join','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','2.0','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','split','commhub','ready\x20—\x20waiting\x20for\x20events','new_message','error','Message\x20content','\x20priority=','http://127.0.0.1:9200','\x20PROJECT_ENV=','string','type','starting\x20SSE\x20listener...','startsWith','status','hub','get_all_status','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','598716UtqlTo','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','13956KYzQbV','send_task','4FfmHYb','MCP\x20stdio\x20connected','blocked','408SGgYTC','commhub_send_task','session\x20disconnected','commhub_reply','5QJMuem','→\x20injected\x20task\x20','content','cancelled','tmux\x20display-message\x20-p\x20\x27#S\x27','Reply\x20text\x20/\x20result\x20summary','replace','SSE\x20error:\x20','number','length','0.3.0','Session\x20alias:\x20','.anet','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','Target\x20session\x20alias','.claude/channels/commhub','result','Bearer\x20','stringify','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.',']\x20[commhub]\x20'];a0_0x5d18=function(){return _0x106f55;};return a0_0x5d18();}import{join as a0_0x3deadb}from'path';import{hostname as a0_0x489ef2}from'os';import{execSync as a0_0x31affa}from'child_process';import{Server as a0_0x3943df}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x533ba}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x489023,CallToolRequestSchema as a0_0x31c89a}from'@modelcontextprotocol/sdk/types.js';function p(_0x3bdd4e){const _0x1f7d16=a0_0x1020;if(!a0_0x18d67c(_0x3bdd4e))return;for(let _0x52e74e of a0_0x47030e(_0x3bdd4e,_0x1f7d16(0x203))['split']('\x0a')){let _0x459fc9=_0x52e74e[_0x1f7d16(0x218)]();if(!_0x459fc9||_0x459fc9['startsWith']('#'))continue;let _0x369c90=_0x459fc9['indexOf']('=');if(_0x369c90<0x0)continue;let _0x5659a5=_0x459fc9['slice'](0x0,_0x369c90)[_0x1f7d16(0x218)](),_0x4d93f0=_0x459fc9[_0x1f7d16(0x1ea)](_0x369c90+0x1)['trim']()[_0x1f7d16(0x248)](/^["']|["']$/g,'');if(!process.env[_0x5659a5])process.env[_0x5659a5]=_0x4d93f0;}}var C=process.env.HOME||'~',T=a0_0x3deadb(C,a0_0x7aafc0(0x252));p(a0_0x3deadb(T,a0_0x7aafc0(0x1fd)));var L=process[a0_0x7aafc0(0x20f)]()[a0_0x7aafc0(0x248)](/\//g,'-');p(a0_0x3deadb(T,L,'.env'));function a0_0x1020(_0x30d993,_0x13d000){_0x30d993=_0x30d993-0x1c6;const _0x5d1895=a0_0x5d18();let _0x1020a9=_0x5d1895[_0x30d993];return _0x1020a9;}function U(){const _0xe27dff=a0_0x7aafc0;try{return a0_0x31affa(_0xe27dff(0x246),{'encoding':'utf-8','timeout':0x7d0})[_0xe27dff(0x218)]();}catch{return'';}}function v(){const _0x59f6a2=a0_0x7aafc0;try{let _0x492bff=a0_0x3deadb(C,_0x59f6a2(0x24e),_0x59f6a2(0x1c9));if(a0_0x18d67c(_0x492bff))return JSON['parse'](a0_0x47030e(_0x492bff,_0x59f6a2(0x203)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x7aafc0(0x234)]||a0_0x7aafc0(0x22d),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x489ef2(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x3b37a1(),X=process.env.COMMHUB_TOKEN||H[a0_0x7aafc0(0x21c)]||'';function Y(_0x1a5d1f){const _0x1756c7=a0_0x7aafc0;let _0x327b17=new Date()[_0x1756c7(0x1f6)]()[_0x1756c7(0x1ea)](0x0,0x8);process['stderr'][_0x1756c7(0x1c7)]('['+_0x327b17+_0x1756c7(0x257)+_0x1a5d1f+'\x0a');}function h(_0x11832b){return new Promise(_0x1ef16b=>setTimeout(_0x1ef16b,_0x11832b));}Y(a0_0x7aafc0(0x1f2)+f+'\x20ALIAS='+Z+a0_0x7aafc0(0x1ce)+w['slice'](0x0,0x8)+a0_0x7aafc0(0x21d)+(j||'none')+a0_0x7aafc0(0x1e8)+process['cwd']()+a0_0x7aafc0(0x22e)+L);var k=new Map(),K=new a0_0x3943df({'name':'commhub-channel','version':a0_0x7aafc0(0x24c)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x7aafc0(0x1d7),a0_0x7aafc0(0x216),a0_0x7aafc0(0x207),a0_0x7aafc0(0x224),a0_0x7aafc0(0x24d)+Z][a0_0x7aafc0(0x221)]('\x0a')});K[a0_0x7aafc0(0x1cd)](a0_0x489023,async()=>({'tools':[{'name':a0_0x7aafc0(0x241),'description':a0_0x7aafc0(0x238),'inputSchema':{'type':a0_0x7aafc0(0x1c6),'properties':{'task_id':{'type':a0_0x7aafc0(0x22f),'description':a0_0x7aafc0(0x225)},'text':{'type':a0_0x7aafc0(0x22f),'description':a0_0x7aafc0(0x247)},'status':{'type':a0_0x7aafc0(0x22f),'enum':[a0_0x7aafc0(0x209),'failed',a0_0x7aafc0(0x245),a0_0x7aafc0(0x23d),a0_0x7aafc0(0x22a),a0_0x7aafc0(0x20c)],'description':a0_0x7aafc0(0x222)}},'required':[a0_0x7aafc0(0x213)]}},{'name':a0_0x7aafc0(0x1f7),'description':a0_0x7aafc0(0x236),'inputSchema':{'type':a0_0x7aafc0(0x1c6),'properties':{'status':{'type':a0_0x7aafc0(0x22f),'enum':['working',a0_0x7aafc0(0x1d9),a0_0x7aafc0(0x23d),a0_0x7aafc0(0x22a)]},'task':{'type':'string','description':'Current\x20task\x20description'},'progress':{'type':a0_0x7aafc0(0x24a),'description':'Progress\x200-100'}},'required':[a0_0x7aafc0(0x233)]}},{'name':a0_0x7aafc0(0x23f),'description':a0_0x7aafc0(0x250),'inputSchema':{'type':a0_0x7aafc0(0x1c6),'properties':{'alias':{'type':a0_0x7aafc0(0x22f),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x7aafc0(0x22f),'description':a0_0x7aafc0(0x1e9)},'priority':{'type':'string','enum':['high',a0_0x7aafc0(0x201),a0_0x7aafc0(0x21f)],'description':a0_0x7aafc0(0x1ef)}},'required':[a0_0x7aafc0(0x1df),'task']}},{'name':a0_0x7aafc0(0x210),'description':a0_0x7aafc0(0x24f),'inputSchema':{'type':a0_0x7aafc0(0x1c6),'properties':{'alias':{'type':a0_0x7aafc0(0x22f),'description':a0_0x7aafc0(0x251)},'message':{'type':a0_0x7aafc0(0x22f),'description':a0_0x7aafc0(0x22b)}},'required':[a0_0x7aafc0(0x1df),a0_0x7aafc0(0x1f8)]}},{'name':a0_0x7aafc0(0x1e5),'description':a0_0x7aafc0(0x256),'inputSchema':{'type':a0_0x7aafc0(0x1c6),'properties':{}}}]}));async function P(_0x7871ca,_0x2274d8){const _0x14149f=a0_0x7aafc0;let _0x3a6df4=await fetch(f+_0x14149f(0x1e1),{'method':_0x14149f(0x1e0),'headers':{'Content-Type':_0x14149f(0x1e6),'Accept':_0x14149f(0x1d0),...X?{'Authorization':_0x14149f(0x254)+X}:{}},'body':JSON[_0x14149f(0x255)]({'jsonrpc':_0x14149f(0x223),'id':0x1,'method':_0x14149f(0x20b),'params':{'protocolVersion':_0x14149f(0x200),'capabilities':{},'clientInfo':{'name':_0x14149f(0x1f1),'version':_0x14149f(0x24c)}}})});if(!_0x3a6df4['ok']){let _0x2c1fc3=await _0x3a6df4[_0x14149f(0x213)]();return Y('CommHub\x20init\x20failed:\x20'+_0x3a6df4[_0x14149f(0x233)]+'\x20'+_0x2c1fc3['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x14149f(0x1f0)+_0x3a6df4[_0x14149f(0x233)]};}await _0x3a6df4['text']();let _0x288c11=(await(await fetch(f+_0x14149f(0x1e1),{'method':_0x14149f(0x1e0),'headers':{'Content-Type':_0x14149f(0x1e6),'Accept':_0x14149f(0x1d0),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x14149f(0x255)]({'jsonrpc':'2.0','id':0x2,'method':_0x14149f(0x208),'params':{'name':_0x7871ca,'arguments':_0x2274d8}})}))[_0x14149f(0x213)]())[_0x14149f(0x226)]('\x0a')[_0x14149f(0x1fa)](_0x52866c=>_0x52866c[_0x14149f(0x232)]('data:\x20'));if(_0x288c11){let _0x2d873e=JSON['parse'](_0x288c11[_0x14149f(0x1ea)](0x6));return _0x2d873e?.[_0x14149f(0x253)]?.[_0x14149f(0x244)]?.[0x0]?.['text']?JSON[_0x14149f(0x211)](_0x2d873e['result']['content'][0x0][_0x14149f(0x213)]):_0x2d873e;}return{'ok':!0x1,'error':_0x14149f(0x1fe)};}K[a0_0x7aafc0(0x1cd)](a0_0x31c89a,async _0x1d0067=>{const _0x515652=a0_0x7aafc0;let {name:_0x26a559,arguments:_0x474d90}=_0x1d0067[_0x515652(0x202)];if(_0x26a559===_0x515652(0x241)){let {task_id:_0x196152,text:_0x58bb5b,status:_0x5b26d5}=_0x474d90;if(_0x5b26d5===_0x515652(0x209)||_0x5b26d5===_0x515652(0x1ca)||_0x5b26d5==='cancelled'){let _0x18b396=_0x5b26d5===_0x515652(0x209)?_0x515652(0x1e4):_0x5b26d5,_0x1eae17=_0x196152?k['get'](_0x196152)||_0x515652(0x234):_0x515652(0x234),_0x4cac5e=await P(_0x515652(0x21a),{'alias':_0x1eae17,'text':_0x58bb5b,'in_reply_to':_0x196152||void 0x0,'status':_0x18b396,'from_session':Z});if(_0x196152)k['delete'](_0x196152);return{'content':[{'type':'text','text':JSON['stringify'](_0x4cac5e)}]};}let _0x1ae3d0=await P(_0x515652(0x1e3),{'resume_id':w,'alias':Z,'status':_0x5b26d5===_0x515652(0x23d)?_0x515652(0x23d):_0x5b26d5===_0x515652(0x22a)?'error':_0x515652(0x1d5),'task':_0x58bb5b[_0x515652(0x1ea)](0x0,0xc8),'output':_0x58bb5b});return{'content':[{'type':_0x515652(0x213),'text':JSON[_0x515652(0x255)](_0x1ae3d0)}]};}if(_0x26a559==='commhub_report_status'){let {status:_0x25d90c,task:_0x2fbf05,progress:_0x3b3441}=_0x474d90,_0x33bfb2=await P(_0x515652(0x1e3),{'resume_id':w,'alias':Z,'status':_0x25d90c,'task':_0x2fbf05,'progress':_0x3b3441});return{'content':[{'type':_0x515652(0x213),'text':JSON[_0x515652(0x255)](_0x33bfb2)}]};}if(_0x26a559===_0x515652(0x23f)){let {alias:_0x486ce3,task:_0xcd6c7d,priority:_0x3ba9a6}=_0x474d90,_0x37f5b5=await P(_0x515652(0x23a),{'alias':_0x486ce3,'task':_0xcd6c7d,'priority':_0x3ba9a6||'normal','from_session':Z});return{'content':[{'type':'text','text':JSON[_0x515652(0x255)](_0x37f5b5)}]};}if(_0x26a559===_0x515652(0x210)){let {alias:_0x4ba60f,message:_0xd6c0e2}=_0x474d90,_0x44c703=await P(_0x515652(0x1ff),{'alias':_0x4ba60f,'message':_0xd6c0e2,'from_session':Z});return{'content':[{'type':_0x515652(0x213),'text':JSON['stringify'](_0x44c703)}]};}if(_0x26a559===_0x515652(0x1e5)){let _0x3689f3=await P(_0x515652(0x235),{});return{'content':[{'type':_0x515652(0x213),'text':JSON[_0x515652(0x255)](_0x3689f3)}]};}return{'content':[{'type':_0x515652(0x213),'text':JSON['stringify']({'error':'unknown\x20tool'})}]};});async function u(){const _0x18573d=a0_0x7aafc0;let _0x24a1e4=f+_0x18573d(0x1d2)+encodeURIComponent(Z),_0x3cd109={};if(X)_0x3cd109[_0x18573d(0x21b)]='Bearer\x20'+X;Y(_0x18573d(0x1ed)+_0x24a1e4);while(!0x0){try{let _0x53b5a4=await fetch(_0x24a1e4,{'headers':_0x3cd109});if(!_0x53b5a4['ok']){Y(_0x18573d(0x249)+_0x53b5a4[_0x18573d(0x233)]+'\x20'+_0x53b5a4['statusText']),await h(0x1388);continue;}let _0x5b9fa7=_0x53b5a4[_0x18573d(0x1d4)][_0x18573d(0x1ee)](),_0x31e5bd=new TextDecoder(),_0x4b9817='';while(!0x0){let {done:_0x48fedb,value:_0x129061}=await _0x5b9fa7[_0x18573d(0x1f3)]();if(_0x48fedb)break;_0x4b9817+=_0x31e5bd['decode'](_0x129061,{'stream':!0x0});let _0x1ff549=_0x4b9817[_0x18573d(0x226)]('\x0a\x0a');_0x4b9817=_0x1ff549['pop']()||'';for(let _0x3480cd of _0x1ff549){let _0x18b610=_0x3480cd[_0x18573d(0x226)]('\x0a')['find'](_0x4053f8=>_0x4053f8[_0x18573d(0x232)](_0x18573d(0x1c8)));if(!_0x18b610)continue;try{let _0x805be8=JSON[_0x18573d(0x211)](_0x18b610[_0x18573d(0x1ea)](0x6));await S(_0x805be8);}catch(_0x4750d1){Y(_0x18573d(0x20e)+_0x4750d1);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0xaf70a8){Y(_0x18573d(0x1ec)+_0xaf70a8);}await h(0xbb8);}}async function S(_0xd38945){const _0x460aef=a0_0x7aafc0;if(_0xd38945[_0x460aef(0x230)]===_0x460aef(0x1f4)){Y(_0x460aef(0x21e)+Z+'\x22');return;}if(_0xd38945[_0x460aef(0x230)]===_0x460aef(0x229)){if(Y('←\x20message\x20from\x20'+_0xd38945['from']+':\x20'+_0xd38945[_0x460aef(0x1f8)][_0x460aef(0x1ea)](0x0,0x3c)),await K[_0x460aef(0x219)]({'method':_0x460aef(0x1d1),'params':{'content':_0xd38945[_0x460aef(0x1f8)],'meta':{'sender':_0xd38945['from']||_0x460aef(0x234),'sender_id':_0x460aef(0x227),'user':_0xd38945[_0x460aef(0x1fb)]||_0x460aef(0x234),'priority':_0x460aef(0x201)}}}),_0xd38945[_0x460aef(0x1f9)])await P('ack_inbox',{'alias':Z,'message_id':_0xd38945[_0x460aef(0x1f9)]});return;}if(_0xd38945[_0x460aef(0x230)]===_0x460aef(0x1dd)||_0xd38945['type']==='broadcast'){Y('←\x20'+_0xd38945[_0x460aef(0x230)]+_0x460aef(0x1fc)+_0xd38945['inbox_count']+_0x460aef(0x22c)+(_0xd38945[_0x460aef(0x1e2)]||'normal'));let _0x551679=await P(_0x460aef(0x1f5),{'alias':Z,'limit':0x5});if(_0x551679?.['ok']&&_0x551679['messages']?.[_0x460aef(0x24b)]>0x0)for(let _0x491421 of _0x551679[_0x460aef(0x1d6)]){let _0x3c4a29={'sender':_0x491421[_0x460aef(0x1d8)]||'hub','sender_id':_0x460aef(0x227),'user':_0x491421[_0x460aef(0x1d8)]||_0x460aef(0x234),'task_id':_0x491421['id'],'priority':_0x491421[_0x460aef(0x1e2)]||_0x460aef(0x201)};k['set'](_0x491421['id'],_0x491421['from_session']||_0x460aef(0x234)),await K[_0x460aef(0x219)]({'method':_0x460aef(0x1d1),'params':{'content':_0x491421[_0x460aef(0x244)],'meta':_0x3c4a29}}),Y(_0x460aef(0x243)+_0x491421['id'][_0x460aef(0x1ea)](0x0,0x8)+'\x20from\x20'+_0x491421[_0x460aef(0x1d8)]+':\x20'+_0x491421[_0x460aef(0x244)][_0x460aef(0x1ea)](0x0,0x3c)),await P(_0x460aef(0x212),{'alias':Z,'message_id':_0x491421['id']});}}}async function A(){const _0x365014=a0_0x7aafc0;let _0x2b9fcb=new a0_0x533ba();await K[_0x365014(0x214)](_0x2b9fcb),Y(_0x365014(0x23c)),Y(_0x365014(0x231)),u()[_0x365014(0x217)](_0x385c4c=>Y('SSE\x20fatal:\x20'+_0x385c4c)),P(_0x365014(0x1e3),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x489ef2(),'hostname':a0_0x489ef2(),'agent':_0x365014(0x20d),'project_dir':process[_0x365014(0x20f)](),'tmux_name':j||void 0x0})[_0x365014(0x1e7)](()=>Y(_0x365014(0x1de)+Z+_0x365014(0x20a)+w[_0x365014(0x1ea)](0x0,0x8)+')'))[_0x365014(0x217)](_0x57f140=>Y(_0x365014(0x204)+_0x57f140)),setInterval(()=>{const _0x55cfab=_0x365014;P('report_status',{'resume_id':w,'alias':Z,'status':_0x55cfab(0x1d9),'server':a0_0x489ef2(),'hostname':a0_0x489ef2(),'agent':_0x55cfab(0x20d),'project_dir':process[_0x55cfab(0x20f)](),'tmux_name':j||void 0x0})[_0x55cfab(0x217)](_0x3785f5=>Y(_0x55cfab(0x205)+_0x3785f5));},0x2bf20),Y(_0x365014(0x228));}A()[a0_0x7aafc0(0x217)](_0x216056=>{Y('fatal:\x20'+_0x216056),process['exit'](0x1);});async function N(){const _0x38a203=a0_0x7aafc0;Y(_0x38a203(0x1d3)),await P(_0x38a203(0x1e3),{'resume_id':w,'alias':Z,'status':_0x38a203(0x22a),'task':_0x38a203(0x240)})[_0x38a203(0x217)](()=>{}),process[_0x38a203(0x206)](0x0);}process['stdin']['on']('end',()=>N()),process['on'](a0_0x7aafc0(0x1da),()=>N()),process['on']('SIGINT',()=>N());
|
|
2
|
+
const a0_0x3cdc6d=a0_0x1ddf;(function(_0xa5ccd5,_0x6b8032){const _0x57815c=a0_0x1ddf,_0x45ac01=_0xa5ccd5();while(!![]){try{const _0x407bea=-parseInt(_0x57815c(0x130))/0x1+parseInt(_0x57815c(0x10d))/0x2+-parseInt(_0x57815c(0x160))/0x3+-parseInt(_0x57815c(0x117))/0x4*(parseInt(_0x57815c(0x147))/0x5)+-parseInt(_0x57815c(0x16a))/0x6+-parseInt(_0x57815c(0xfd))/0x7+-parseInt(_0x57815c(0x131))/0x8*(-parseInt(_0x57815c(0x14d))/0x9);if(_0x407bea===_0x6b8032)break;else _0x45ac01['push'](_0x45ac01['shift']());}catch(_0x4f8d89){_0x45ac01['push'](_0x45ac01['shift']());}}}(a0_0x466d,0x834f7));import{readFileSync as a0_0x24596e,existsSync as a0_0x46cf61}from'fs';import{randomUUID as a0_0x436cfd}from'crypto';import{join as a0_0x1dc3d2}from'path';import{hostname as a0_0x50d3aa}from'os';import{execSync as a0_0x3c4ef6}from'child_process';import{Server as a0_0x1ea5f3}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x317865}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x342c09,CallToolRequestSchema as a0_0x21dfe5}from'@modelcontextprotocol/sdk/types.js';function a0_0x466d(){const _0x119a42=['commhub-channel','\x22\x20(','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','broadcast','/mcp','completed','SSE\x20fatal:\x20','low','.env','then','\x20ALIAS=','application/json,\x20text/event-stream','stringify','commhub_reply','Bearer\x20','commhub_send_message','\x20RESUME_ID=','send_reply','\x20PROJECT_ENV=','290865CSPuty','content','.claude/channels/commhub','initialize','working','failed','22242078DUjxav','messages','parse\x20error:\x20','type','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','←\x20message\x20from\x20','token','number','get','claude-code','notifications/claude/channel','ENV:\x20URL=','unknown\x20tool','send_message','getReader','stdin','cancelled','fatal:\x20','priority','1376814suSmCo','result','trim','slice','cwd','blocked','in_progress','connect','0.3.0','inbox_count','2720892jEjNSb','text','SIGINT','length','\x20from\x20','join','idle','Target\x20session\x20alias','exit','Progress\x200-100','stderr','replace','heartbeat\x20failed:\x20','catch','startsWith','from_session','indexOf','2.0','SSE\x20connected\x20as\x20\x22','starting\x20SSE\x20listener...','.anet','object','string','setRequestHandler','2540272CvruDf','new_message','set','params','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','utf-8','get_all_status','2025-03-26','registered\x20as\x20\x22',':\x20inbox_count=','ready\x20—\x20waiting\x20for\x20events','POST','normal','message','ack_inbox','report_status','1459566qJURKD','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','commhub_send_task','parse','CommHub\x20init\x20failed:\x20','send_task','session\x20disconnected','split','...\x20TMUX=','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','36VzAdhN','hub','notification','Priority\x20(default:\x20normal)','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','pop','Reply\x20text\x20/\x20result\x20summary','commhub_report_status','commhub','get_inbox','SSE\x20connection\x20error:\x20','message_id','/events/','high','find','status','SIGTERM',']\x20[commhub]\x20','Task\x20content','from','init\x20failed:\x20','connecting\x20to\x20','shutting\x20down,\x20reporting\x20offline...','Session\x20alias:\x20','replied','864405xYWwZB','8PYUiZf','Current\x20task\x20description','error'];a0_0x466d=function(){return _0x119a42;};return a0_0x466d();}function p(_0x72baf3){const _0x2e7531=a0_0x1ddf;if(!a0_0x46cf61(_0x72baf3))return;for(let _0x28f43e of a0_0x24596e(_0x72baf3,_0x2e7531(0x102))[_0x2e7531(0x114)]('\x0a')){let _0x42e717=_0x28f43e[_0x2e7531(0x162)]();if(!_0x42e717||_0x42e717['startsWith']('#'))continue;let _0x48b3e2=_0x42e717[_0x2e7531(0x17a)]('=');if(_0x48b3e2<0x0)continue;let _0x2ca38a=_0x42e717[_0x2e7531(0x163)](0x0,_0x48b3e2)[_0x2e7531(0x162)](),_0x48d37e=_0x42e717[_0x2e7531(0x163)](_0x48b3e2+0x1)[_0x2e7531(0x162)]()[_0x2e7531(0x175)](/^["']|["']$/g,'');if(!process.env[_0x2ca38a])process.env[_0x2ca38a]=_0x48d37e;}}var C=process.env.HOME||'~',T=a0_0x1dc3d2(C,a0_0x3cdc6d(0x149));p(a0_0x1dc3d2(T,'.env'));var L=process['cwd']()[a0_0x3cdc6d(0x175)](/\//g,'-');p(a0_0x1dc3d2(T,L,a0_0x3cdc6d(0x13c)));function U(){const _0x4080b0=a0_0x3cdc6d;try{return a0_0x3c4ef6('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x4080b0(0x102),'timeout':0x7d0})[_0x4080b0(0x162)]();}catch{return'';}}function v(){const _0x35c949=a0_0x3cdc6d;try{let _0x52790e=a0_0x1dc3d2(C,_0x35c949(0x17e),'config.json');if(a0_0x46cf61(_0x52790e))return JSON[_0x35c949(0x110)](a0_0x24596e(_0x52790e,_0x35c949(0x102)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x3cdc6d(0x118)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x50d3aa(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x436cfd(),X=process.env.COMMHUB_TOKEN||H[a0_0x3cdc6d(0x153)]||'';function Y(_0x5220b4){const _0x5be9ae=a0_0x3cdc6d;let _0x572c6e=new Date()['toTimeString']()[_0x5be9ae(0x163)](0x0,0x8);process[_0x5be9ae(0x174)]['write']('['+_0x572c6e+_0x5be9ae(0x128)+_0x5220b4+'\x0a');}function h(_0x2b6083){return new Promise(_0x34f95e=>setTimeout(_0x34f95e,_0x2b6083));}function a0_0x1ddf(_0x395c30,_0x522e6a){_0x395c30=_0x395c30-0xfd;const _0x466d66=a0_0x466d();let _0x1ddff8=_0x466d66[_0x395c30];return _0x1ddff8;}Y(a0_0x3cdc6d(0x158)+f+a0_0x3cdc6d(0x13e)+Z+a0_0x3cdc6d(0x144)+w['slice'](0x0,0x8)+a0_0x3cdc6d(0x115)+(j||'none')+'\x20CWD='+process['cwd']()+a0_0x3cdc6d(0x146)+L);var k=new Map(),K=new a0_0x1ea5f3({'name':a0_0x3cdc6d(0x134),'version':a0_0x3cdc6d(0x168)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x3cdc6d(0x10e),a0_0x3cdc6d(0x136),a0_0x3cdc6d(0x101),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x3cdc6d(0x12e)+Z][a0_0x3cdc6d(0x16f)]('\x0a')});K[a0_0x3cdc6d(0x181)](a0_0x342c09,async()=>({'tools':[{'name':a0_0x3cdc6d(0x141),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x3cdc6d(0x17f),'properties':{'task_id':{'type':a0_0x3cdc6d(0x180),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x3cdc6d(0x180),'description':a0_0x3cdc6d(0x11d)},'status':{'type':a0_0x3cdc6d(0x180),'enum':[a0_0x3cdc6d(0x139),a0_0x3cdc6d(0x14c),a0_0x3cdc6d(0x15d),a0_0x3cdc6d(0x165),a0_0x3cdc6d(0x133),a0_0x3cdc6d(0x166)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x3cdc6d(0x16b)]}},{'name':a0_0x3cdc6d(0x11e),'description':a0_0x3cdc6d(0x11b),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x3cdc6d(0x180),'enum':[a0_0x3cdc6d(0x14b),'idle',a0_0x3cdc6d(0x165),'error']},'task':{'type':a0_0x3cdc6d(0x180),'description':a0_0x3cdc6d(0x132)},'progress':{'type':a0_0x3cdc6d(0x154),'description':a0_0x3cdc6d(0x173)}},'required':[a0_0x3cdc6d(0x126)]}},{'name':'commhub_send_task','description':a0_0x3cdc6d(0x151),'inputSchema':{'type':a0_0x3cdc6d(0x17f),'properties':{'alias':{'type':a0_0x3cdc6d(0x180),'description':a0_0x3cdc6d(0x171)},'task':{'type':a0_0x3cdc6d(0x180),'description':a0_0x3cdc6d(0x129)},'priority':{'type':a0_0x3cdc6d(0x180),'enum':[a0_0x3cdc6d(0x124),a0_0x3cdc6d(0x109),a0_0x3cdc6d(0x13b)],'description':a0_0x3cdc6d(0x11a)}},'required':['alias','task']}},{'name':a0_0x3cdc6d(0x143),'description':a0_0x3cdc6d(0x116),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x3cdc6d(0x180),'description':a0_0x3cdc6d(0x171)},'message':{'type':a0_0x3cdc6d(0x180),'description':'Message\x20content'}},'required':['alias',a0_0x3cdc6d(0x10a)]}},{'name':'commhub_get_all_status','description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x3cdc6d(0x17f),'properties':{}}}]}));async function P(_0x47ae8c,_0x350fbf){const _0x37b017=a0_0x3cdc6d;let _0x109bd4=await fetch(f+'/mcp',{'method':_0x37b017(0x108),'headers':{'Content-Type':'application/json','Accept':_0x37b017(0x13f),...X?{'Authorization':_0x37b017(0x142)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x37b017(0x17b),'id':0x1,'method':_0x37b017(0x14a),'params':{'protocolVersion':_0x37b017(0x104),'capabilities':{},'clientInfo':{'name':_0x37b017(0x134),'version':'0.3.0'}}})});if(!_0x109bd4['ok']){let _0x10f848=await _0x109bd4[_0x37b017(0x16b)]();return Y(_0x37b017(0x111)+_0x109bd4[_0x37b017(0x126)]+'\x20'+_0x10f848[_0x37b017(0x163)](0x0,0x64)),{'ok':!0x1,'error':_0x37b017(0x12b)+_0x109bd4[_0x37b017(0x126)]};}await _0x109bd4[_0x37b017(0x16b)]();let _0x44cc69=(await(await fetch(f+_0x37b017(0x138),{'method':_0x37b017(0x108),'headers':{'Content-Type':'application/json','Accept':_0x37b017(0x13f),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x37b017(0x17b),'id':0x2,'method':'tools/call','params':{'name':_0x47ae8c,'arguments':_0x350fbf}})}))['text']())[_0x37b017(0x114)]('\x0a')[_0x37b017(0x125)](_0x5037a8=>_0x5037a8[_0x37b017(0x178)]('data:\x20'));if(_0x44cc69){let _0x460977=JSON[_0x37b017(0x110)](_0x44cc69[_0x37b017(0x163)](0x6));return _0x460977?.[_0x37b017(0x161)]?.[_0x37b017(0x148)]?.[0x0]?.['text']?JSON['parse'](_0x460977['result'][_0x37b017(0x148)][0x0][_0x37b017(0x16b)]):_0x460977;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x3cdc6d(0x181)](a0_0x21dfe5,async _0x2f466e=>{const _0x4274f3=a0_0x3cdc6d;let {name:_0x5aa1ef,arguments:_0x48e82f}=_0x2f466e[_0x4274f3(0x100)];if(_0x5aa1ef===_0x4274f3(0x141)){let {task_id:_0x557f76,text:_0x44369d,status:_0x11ecce}=_0x48e82f;if(_0x11ecce===_0x4274f3(0x139)||_0x11ecce===_0x4274f3(0x14c)||_0x11ecce===_0x4274f3(0x15d)){let _0x4db73c=_0x11ecce==='completed'?_0x4274f3(0x12f):_0x11ecce,_0x554602=_0x557f76?k[_0x4274f3(0x155)](_0x557f76)||_0x4274f3(0x118):'hub',_0x546db1=await P(_0x4274f3(0x145),{'alias':_0x554602,'text':_0x44369d,'in_reply_to':_0x557f76||void 0x0,'status':_0x4db73c,'from_session':Z});if(_0x557f76)k['delete'](_0x557f76);return{'content':[{'type':'text','text':JSON[_0x4274f3(0x140)](_0x546db1)}]};}let _0x4ef87f=await P(_0x4274f3(0x10c),{'resume_id':w,'alias':Z,'status':_0x11ecce===_0x4274f3(0x165)?_0x4274f3(0x165):_0x11ecce===_0x4274f3(0x133)?_0x4274f3(0x133):_0x4274f3(0x14b),'task':_0x44369d[_0x4274f3(0x163)](0x0,0xc8),'output':_0x44369d});return{'content':[{'type':_0x4274f3(0x16b),'text':JSON[_0x4274f3(0x140)](_0x4ef87f)}]};}if(_0x5aa1ef===_0x4274f3(0x11e)){let {status:_0x499cbd,task:_0x48bb5b,progress:_0x45c8f7}=_0x48e82f,_0x463f93=await P(_0x4274f3(0x10c),{'resume_id':w,'alias':Z,'status':_0x499cbd,'task':_0x48bb5b,'progress':_0x45c8f7});return{'content':[{'type':_0x4274f3(0x16b),'text':JSON[_0x4274f3(0x140)](_0x463f93)}]};}if(_0x5aa1ef===_0x4274f3(0x10f)){let {alias:_0x2f58f6,task:_0x2b913b,priority:_0x51fdce}=_0x48e82f,_0xac5a81=await P(_0x4274f3(0x112),{'alias':_0x2f58f6,'task':_0x2b913b,'priority':_0x51fdce||_0x4274f3(0x109),'from_session':Z});return{'content':[{'type':_0x4274f3(0x16b),'text':JSON[_0x4274f3(0x140)](_0xac5a81)}]};}if(_0x5aa1ef===_0x4274f3(0x143)){let {alias:_0x287a13,message:_0x211042}=_0x48e82f,_0x5240f7=await P(_0x4274f3(0x15a),{'alias':_0x287a13,'message':_0x211042,'from_session':Z});return{'content':[{'type':_0x4274f3(0x16b),'text':JSON['stringify'](_0x5240f7)}]};}if(_0x5aa1ef==='commhub_get_all_status'){let _0x5c30e0=await P(_0x4274f3(0x103),{});return{'content':[{'type':_0x4274f3(0x16b),'text':JSON[_0x4274f3(0x140)](_0x5c30e0)}]};}return{'content':[{'type':_0x4274f3(0x16b),'text':JSON[_0x4274f3(0x140)]({'error':_0x4274f3(0x159)})}]};});async function u(){const _0x3b890e=a0_0x3cdc6d;let _0x3a1743=f+_0x3b890e(0x123)+encodeURIComponent(Z),_0x4e6897={};if(X)_0x4e6897['Authorization']=_0x3b890e(0x142)+X;Y(_0x3b890e(0x12c)+_0x3a1743);while(!0x0){try{let _0x2eb1c0=await fetch(_0x3a1743,{'headers':_0x4e6897});if(!_0x2eb1c0['ok']){Y('SSE\x20error:\x20'+_0x2eb1c0[_0x3b890e(0x126)]+'\x20'+_0x2eb1c0['statusText']),await h(0x1388);continue;}let _0x390275=_0x2eb1c0['body'][_0x3b890e(0x15b)](),_0x2b3665=new TextDecoder(),_0x3991dd='';while(!0x0){let {done:_0x36df9e,value:_0x5189ec}=await _0x390275['read']();if(_0x36df9e)break;_0x3991dd+=_0x2b3665['decode'](_0x5189ec,{'stream':!0x0});let _0x5c54c1=_0x3991dd['split']('\x0a\x0a');_0x3991dd=_0x5c54c1[_0x3b890e(0x11c)]()||'';for(let _0x15080c of _0x5c54c1){let _0x1801b1=_0x15080c[_0x3b890e(0x114)]('\x0a')[_0x3b890e(0x125)](_0x1fbce7=>_0x1fbce7['startsWith']('data:\x20'));if(!_0x1801b1)continue;try{let _0x801a2d=JSON[_0x3b890e(0x110)](_0x1801b1[_0x3b890e(0x163)](0x6));await S(_0x801a2d);}catch(_0x2b76aa){Y(_0x3b890e(0x14f)+_0x2b76aa);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x331d90){Y(_0x3b890e(0x121)+_0x331d90);}await h(0xbb8);}}async function S(_0x31b33c){const _0x21ae69=a0_0x3cdc6d;if(_0x31b33c[_0x21ae69(0x150)]==='connected'){Y(_0x21ae69(0x17c)+Z+'\x22');return;}if(_0x31b33c[_0x21ae69(0x150)]===_0x21ae69(0xfe)){if(Y(_0x21ae69(0x152)+_0x31b33c['from']+':\x20'+_0x31b33c['message']['slice'](0x0,0x3c)),await K[_0x21ae69(0x119)]({'method':_0x21ae69(0x157),'params':{'content':_0x31b33c[_0x21ae69(0x10a)],'meta':{'sender':_0x31b33c[_0x21ae69(0x12a)]||_0x21ae69(0x118),'sender_id':_0x21ae69(0x11f),'user':_0x31b33c[_0x21ae69(0x12a)]||_0x21ae69(0x118),'priority':'normal'}}}),_0x31b33c[_0x21ae69(0x122)])await P(_0x21ae69(0x10b),{'alias':Z,'message_id':_0x31b33c[_0x21ae69(0x122)]});return;}if(_0x31b33c[_0x21ae69(0x150)]==='new_task'||_0x31b33c[_0x21ae69(0x150)]===_0x21ae69(0x137)){Y('←\x20'+_0x31b33c[_0x21ae69(0x150)]+_0x21ae69(0x106)+_0x31b33c[_0x21ae69(0x169)]+'\x20priority='+(_0x31b33c[_0x21ae69(0x15f)]||_0x21ae69(0x109)));let _0x5bc2bc=await P(_0x21ae69(0x120),{'alias':Z,'limit':0x5});if(_0x5bc2bc?.['ok']&&_0x5bc2bc['messages']?.[_0x21ae69(0x16d)]>0x0)for(let _0x12de38 of _0x5bc2bc[_0x21ae69(0x14e)]){let _0x122393={'sender':_0x12de38[_0x21ae69(0x179)]||'hub','sender_id':_0x21ae69(0x11f),'user':_0x12de38[_0x21ae69(0x179)]||'hub','task_id':_0x12de38['id'],'priority':_0x12de38['priority']||_0x21ae69(0x109)};k[_0x21ae69(0xff)](_0x12de38['id'],_0x12de38['from_session']||_0x21ae69(0x118)),await K[_0x21ae69(0x119)]({'method':_0x21ae69(0x157),'params':{'content':_0x12de38[_0x21ae69(0x148)],'meta':_0x122393}}),Y('→\x20injected\x20task\x20'+_0x12de38['id']['slice'](0x0,0x8)+_0x21ae69(0x16e)+_0x12de38[_0x21ae69(0x179)]+':\x20'+_0x12de38[_0x21ae69(0x148)][_0x21ae69(0x163)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x12de38['id']});}}}async function A(){const _0x4c61e7=a0_0x3cdc6d;let _0x3224f5=new a0_0x317865();await K[_0x4c61e7(0x167)](_0x3224f5),Y('MCP\x20stdio\x20connected'),Y(_0x4c61e7(0x17d)),u()[_0x4c61e7(0x177)](_0x1a7cb1=>Y(_0x4c61e7(0x13a)+_0x1a7cb1)),P(_0x4c61e7(0x10c),{'resume_id':w,'alias':Z,'status':_0x4c61e7(0x170),'server':a0_0x50d3aa(),'hostname':a0_0x50d3aa(),'agent':'claude-code','project_dir':process[_0x4c61e7(0x164)](),'tmux_name':j||void 0x0})[_0x4c61e7(0x13d)](()=>Y(_0x4c61e7(0x105)+Z+_0x4c61e7(0x135)+w[_0x4c61e7(0x163)](0x0,0x8)+')'))['catch'](_0x733b9c=>Y('warning:\x20could\x20not\x20register:\x20'+_0x733b9c)),setInterval(()=>{const _0x53886d=_0x4c61e7;P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x50d3aa(),'hostname':a0_0x50d3aa(),'agent':_0x53886d(0x156),'project_dir':process[_0x53886d(0x164)](),'tmux_name':j||void 0x0})[_0x53886d(0x177)](_0x2832cd=>Y(_0x53886d(0x176)+_0x2832cd));},0x2bf20),Y(_0x4c61e7(0x107));}A()[a0_0x3cdc6d(0x177)](_0x56a953=>{const _0x11b615=a0_0x3cdc6d;Y(_0x11b615(0x15e)+_0x56a953),process[_0x11b615(0x172)](0x1);});async function N(){const _0x37858c=a0_0x3cdc6d;Y(_0x37858c(0x12d)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x37858c(0x133),'task':_0x37858c(0x113)})[_0x37858c(0x177)](()=>{}),process[_0x37858c(0x172)](0x0);}process[a0_0x3cdc6d(0x15c)]['on']('end',()=>N()),process['on'](a0_0x3cdc6d(0x127),()=>N()),process['on'](a0_0x3cdc6d(0x16c),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.0.3-preview.
|
|
3
|
+
"version": "2.0.3-preview.8",
|
|
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",
|