@sleep2agi/agent-network 2.2.11-preview.2 → 2.2.12-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
|
+
const a0_0x3db2c5=a0_0x52fe;(function(_0x281bbd,_0x3dfb45){const _0x592f5d=a0_0x52fe,_0x57700a=_0x281bbd();while(!![]){try{const _0x68b525=parseInt(_0x592f5d(0x18b))/0x1*(-parseInt(_0x592f5d(0x178))/0x2)+-parseInt(_0x592f5d(0x1b6))/0x3+-parseInt(_0x592f5d(0x18d))/0x4+-parseInt(_0x592f5d(0x16e))/0x5+parseInt(_0x592f5d(0x179))/0x6*(parseInt(_0x592f5d(0x19f))/0x7)+parseInt(_0x592f5d(0x1a7))/0x8*(parseInt(_0x592f5d(0x184))/0x9)+parseInt(_0x592f5d(0x18e))/0xa;if(_0x68b525===_0x3dfb45)break;else _0x57700a['push'](_0x57700a['shift']());}catch(_0x233527){_0x57700a['push'](_0x57700a['shift']());}}}(a0_0x5441,0xd57b1));import{EventEmitter as a0_0x122919}from'events';function a0_0x52fe(_0x358531,_0x52d9ef){_0x358531=_0x358531-0x166;const _0x54418d=a0_0x5441();let _0x52fe5d=_0x54418d[_0x358531];return _0x52fe5d;}import{hostname as a0_0x14c083}from'os';class T extends a0_0x122919{[a0_0x3db2c5(0x188)];['alias'];[a0_0x3db2c5(0x194)];[a0_0x3db2c5(0x176)];['resumeId'];['heartbeatInterval'];[a0_0x3db2c5(0x1a6)];[a0_0x3db2c5(0x17e)];[a0_0x3db2c5(0x1b7)];[a0_0x3db2c5(0x198)]=!0x1;constructor(_0x50701e){const _0x50b1ee=a0_0x3db2c5;super();if(this[_0x50b1ee(0x188)]=_0x50701e['url'][_0x50b1ee(0x1a8)](/\/$/,''),this[_0x50b1ee(0x193)]=_0x50701e[_0x50b1ee(0x193)],this['token']=_0x50701e[_0x50b1ee(0x194)],this[_0x50b1ee(0x176)]=_0x50701e[_0x50b1ee(0x176)]||_0x50b1ee(0x1bc),this['resumeId']='sdk-'+_0x50701e[_0x50b1ee(0x193)]+'-'+Date[_0x50b1ee(0x19b)]()[_0x50b1ee(0x1b5)](0x24),this[_0x50b1ee(0x195)]=_0x50701e['heartbeatInterval']??0x2bf20,this[_0x50b1ee(0x1a6)]=_0x50701e['reconnectDelay']??0xbb8,_0x50701e[_0x50b1ee(0x185)]!==!0x1)this[_0x50b1ee(0x1bb)]();}[a0_0x3db2c5(0x1a5)](_0x10a526){const _0x630c4e=a0_0x3db2c5;console[_0x630c4e(0x1a5)]('['+new Date()[_0x630c4e(0x1a3)]()[_0x630c4e(0x1af)](0x0,0x8)+_0x630c4e(0x19d)+this[_0x630c4e(0x193)]+']\x20'+_0x10a526);}async[a0_0x3db2c5(0x16b)](_0x319d41,_0x373a6a){const _0x4d3e04=a0_0x3db2c5;let _0x136868={'Content-Type':'application/json','Accept':_0x4d3e04(0x16d)};if(this['token'])_0x136868[_0x4d3e04(0x1ba)]=_0x4d3e04(0x1ad)+this[_0x4d3e04(0x194)];let _0x37a93c=await(await fetch(this[_0x4d3e04(0x188)]+_0x4d3e04(0x17b),{'method':_0x4d3e04(0x1bd),'headers':_0x136868,'body':JSON[_0x4d3e04(0x19a)]({'jsonrpc':_0x4d3e04(0x180),'id':Date['now'](),'method':_0x4d3e04(0x1b9),'params':{'name':_0x319d41,'arguments':_0x373a6a}})}))[_0x4d3e04(0x183)](),_0x5b491b=_0x37a93c[_0x4d3e04(0x1b1)](/data: (.+)/),_0xf82ef=_0x5b491b?JSON[_0x4d3e04(0x18a)](_0x5b491b[0x1]):JSON[_0x4d3e04(0x18a)](_0x37a93c),_0x4154a9=_0xf82ef?.[_0x4d3e04(0x171)]?.[_0x4d3e04(0x17f)]?.[0x0]?.[_0x4d3e04(0x183)];return _0x4154a9?JSON['parse'](_0x4154a9):_0xf82ef;}async[a0_0x3db2c5(0x1bb)](){const _0x30940a=a0_0x3db2c5;if(this['running'])return;this[_0x30940a(0x198)]=!0x0,await this[_0x30940a(0x192)]('idle'),this[_0x30940a(0x1a5)](_0x30940a(0x170)),this[_0x30940a(0x17e)]=setInterval(()=>{const _0x48273d=_0x30940a;this[_0x48273d(0x192)](_0x48273d(0x174))['catch'](_0x223a63=>this[_0x48273d(0x1a5)](_0x48273d(0x175)+_0x223a63['message']));},this[_0x30940a(0x195)]),this[_0x30940a(0x16c)]();}async['disconnect'](){const _0x2dfc6b=a0_0x3db2c5;if(this[_0x2dfc6b(0x198)]=!0x1,this[_0x2dfc6b(0x1b7)]?.[_0x2dfc6b(0x169)](),this['heartbeatTimer'])clearInterval(this[_0x2dfc6b(0x17e)]);await this[_0x2dfc6b(0x192)](_0x2dfc6b(0x168))[_0x2dfc6b(0x186)](()=>{}),this[_0x2dfc6b(0x1a5)](_0x2dfc6b(0x172));}async[a0_0x3db2c5(0x1ab)](_0x33f070,_0x24b24e,_0x439d93='normal'){const _0x37315c=a0_0x3db2c5;return this[_0x37315c(0x16b)]('send_task',{'alias':_0x33f070,'task':_0x24b24e,'priority':_0x439d93,'from_session':this[_0x37315c(0x193)]});}async[a0_0x3db2c5(0x18c)](_0x1a7d5f,_0xce6a8f){const _0x18f0a4=a0_0x3db2c5;return this[_0x18f0a4(0x16b)](_0x18f0a4(0x1a9),{'alias':_0x1a7d5f,'message':_0xce6a8f,'from_session':this[_0x18f0a4(0x193)]});}async[a0_0x3db2c5(0x173)](_0x47ba32,_0x11726b,_0x1c3b29='completed'){const _0x3dfc74=a0_0x3db2c5;return this[_0x3dfc74(0x16b)](_0x3dfc74(0x182),{'in_reply_to':_0x47ba32,'text':_0x11726b,'status':_0x1c3b29});}async[a0_0x3db2c5(0x192)](_0x5c4c5a,_0x1886a3){const _0xeceab=a0_0x3db2c5;return this[_0xeceab(0x16b)](_0xeceab(0x16f),{'resume_id':this[_0xeceab(0x1b2)],'alias':this[_0xeceab(0x193)],'status':_0x5c4c5a,'server':a0_0x14c083(),'hostname':a0_0x14c083(),'agent':this['agent'],'project_dir':process[_0xeceab(0x19c)](),..._0x1886a3});}async[a0_0x3db2c5(0x19e)](){const _0x4a2621=a0_0x3db2c5;return this[_0x4a2621(0x16b)](_0x4a2621(0x197),{});}async[a0_0x3db2c5(0x16a)](_0x2b74db,_0x21f2fc){const _0x3a971d=a0_0x3db2c5;return this['call'](_0x3a971d(0x16a),{'message':_0x2b74db,'filter_server':_0x21f2fc?.['server'],'filter_status':_0x21f2fc?.[_0x3a971d(0x192)]});}async['connectSSE'](){const _0x57503d=a0_0x3db2c5;let _0x1e8f49=encodeURIComponent(this[_0x57503d(0x193)]),_0x46761c=this[_0x57503d(0x188)]+'/events/'+_0x1e8f49,_0x417716=this[_0x57503d(0x1a6)];while(this[_0x57503d(0x198)]){try{this[_0x57503d(0x1b7)]=new AbortController();let _0x274737={'Accept':'text/event-stream'};if(this['token'])_0x274737[_0x57503d(0x1ba)]=_0x57503d(0x1ad)+this[_0x57503d(0x194)];let _0x1ef899=await fetch(_0x46761c,{'headers':_0x274737,'signal':this['sseAbort']['signal']});if(!_0x1ef899['ok']||!_0x1ef899[_0x57503d(0x177)]){this['log'](_0x57503d(0x190)+_0x1ef899[_0x57503d(0x192)]),await this[_0x57503d(0x196)](_0x417716),_0x417716=Math['min'](_0x417716*1.5,0xea60);continue;}_0x417716=this[_0x57503d(0x1a6)];let _0x5ae397=_0x1ef899[_0x57503d(0x177)][_0x57503d(0x189)](),_0x36e474=new TextDecoder(),_0x450177='';while(this['running']){let {done:_0x529e59,value:_0x5422fd}=await _0x5ae397[_0x57503d(0x18f)]();if(_0x529e59)break;_0x450177+=_0x36e474[_0x57503d(0x1a1)](_0x5422fd,{'stream':!0x0});let _0x13cc2b=_0x450177[_0x57503d(0x181)]('\x0a');_0x450177=_0x13cc2b[_0x57503d(0x1b3)]()||'';for(let _0x1f8f7f of _0x13cc2b){if(!_0x1f8f7f[_0x57503d(0x199)](_0x57503d(0x1b4)))continue;try{let _0x360ee9=JSON[_0x57503d(0x18a)](_0x1f8f7f[_0x57503d(0x1af)](0x6));if(_0x360ee9[_0x57503d(0x1a2)]===_0x57503d(0x187)){this[_0x57503d(0x1a5)](_0x57503d(0x1a4)),this['emit']('connected');continue;}if(_0x360ee9[_0x57503d(0x1a2)]===_0x57503d(0x1b8)||_0x360ee9[_0x57503d(0x1a2)]===_0x57503d(0x1ae)||_0x360ee9['type']===_0x57503d(0x16a))await this[_0x57503d(0x1ac)]();}catch{}}}}catch(_0x43d654){if(_0x43d654[_0x57503d(0x166)]===_0x57503d(0x17a))break;this[_0x57503d(0x17c)](_0x57503d(0x1b0),_0x43d654),this['log']('SSE\x20error:\x20'+_0x43d654[_0x57503d(0x18c)]);}if(this[_0x57503d(0x198)])this[_0x57503d(0x17c)]('disconnected'),this[_0x57503d(0x1a5)](_0x57503d(0x1aa)+_0x417716/0x3e8+_0x57503d(0x167)),await this['sleep'](_0x417716),_0x417716=Math[_0x57503d(0x1a0)](_0x417716*1.5,0xea60);}}async['processInbox'](){const _0x195e73=a0_0x3db2c5;try{let _0x369f7c=(await this['call'](_0x195e73(0x191),{'alias':this[_0x195e73(0x193)],'limit':0xa}))?.['messages']||[];for(let _0xabd1c of _0x369f7c)await this[_0x195e73(0x16b)]('ack_inbox',{'alias':this['alias'],'message_id':_0xabd1c['id']}),this[_0x195e73(0x1a5)]('←\x20'+_0xabd1c['from_session']+':\x20'+_0xabd1c[_0x195e73(0x17f)][_0x195e73(0x1af)](0x0,0x3c)),this['emit'](_0x195e73(0x17d),_0xabd1c),this[_0x195e73(0x17c)](_0x195e73(0x18c),_0xabd1c);}catch(_0x45d1cd){this[_0x195e73(0x1a5)]('inbox\x20error:\x20'+_0x45d1cd[_0x195e73(0x18c)]);}}['sleep'](_0x1f48c1){return new Promise(_0x33a527=>setTimeout(_0x33a527,_0x1f48c1));}}var $=T;function a0_0x5441(){const _0x4ec13d=['12248181DOedfO','autoConnect','catch','connected','url','getReader','parse','39579EcEqDG','message','5952524SZoXUO','34440260lPESnB','read','SSE\x20failed:\x20','get_inbox','status','alias','token','heartbeatInterval','sleep','get_all_status','running','startsWith','stringify','now','cwd',']\x20[commhub:','getAllStatus','227087fItcGc','min','decode','type','toTimeString','SSE\x20connected','log','reconnectDelay','8wPWMoi','replace','send_message','SSE\x20reconnecting\x20in\x20','send','processInbox','Bearer\x20','new_message','slice','error','match','resumeId','pop','data:\x20','toString','3235404VmxTFK','sseAbort','new_task','tools/call','Authorization','connect','sdk','POST','name','s...','offline','abort','broadcast','call','connectSSE','application/json,\x20text/event-stream','5327260CemIFB','report_status','registered','result','disconnected','reply','idle','heartbeat\x20failed:\x20','agent','body','20votSnw','18ttfGoW','AbortError','/mcp','emit','task','heartbeatTimer','content','2.0','split','send_reply','text'];a0_0x5441=function(){return _0x4ec13d;};return a0_0x5441();}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_0x4fb80b=a0_0x1914;(function(_0xc862c,_0x444d3b){const _0x1b862e=a0_0x1914,_0x53e58b=_0xc862c();while(!![]){try{const _0x2622d2=-parseInt(_0x1b862e(0x1cc))/0x1*(-parseInt(_0x1b862e(0x1c1))/0x2)+-parseInt(_0x1b862e(0x1f5))/0x3*(parseInt(_0x1b862e(0x1c2))/0x4)+-parseInt(_0x1b862e(0x1f0))/0x5+parseInt(_0x1b862e(0x19e))/0x6*(-parseInt(_0x1b862e(0x177))/0x7)+parseInt(_0x1b862e(0x1b5))/0x8+parseInt(_0x1b862e(0x1a9))/0x9+-parseInt(_0x1b862e(0x163))/0xa;if(_0x2622d2===_0x444d3b)break;else _0x53e58b['push'](_0x53e58b['shift']());}catch(_0x1b84fa){_0x53e58b['push'](_0x53e58b['shift']());}}}(a0_0xca92,0xecbe3));function a0_0x1914(_0x2934e7,_0xd23b12){_0x2934e7=_0x2934e7-0x15c;const _0xca929b=a0_0xca92();let _0x1914c7=_0xca929b[_0x2934e7];return _0x1914c7;}function a0_0xca92(){const _0x2338c4=['working','failed','new_task','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','offline','SSE\x20stream\x20ended,\x20reconnecting...','commhub','SSE\x20connected\x20as\x20\x22',']\x20[commhub]\x20','type','parse\x20error:\x20','stderr','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','utf-8','slice','normal','now','7PPYkUA','commhub_reply','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','content','join','split','Authorization','Target\x20session\x20alias','init\x20failed:\x20','replace','/events/','→\x20injected\x20task\x20','cancelled','statusText','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','broadcast','in_progress','trim','...\x20TMUX=','text','SSE\x20fatal:\x20','2025-03-26','catch','(none)','\x20priority=','inbox_count','ready\x20—\x20waiting\x20for\x20events','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','connecting\x20to\x20','from','initialize','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','completed','read','status','starting\x20SSE\x20listener...','commhub_get_all_status','params','.anet','2378358gvvPiE','re-registered\x20as\x20\x22','Session\x20alias:\x20','set','get','application/json,\x20text/event-stream','find','\x22\x20after\x20SSE\x20reconnect','commhub_send_message','from_session','POST','9248463YhraDB','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','0.3.0','commhub-channel','notifications/claude/channel','message_id','write','data:\x20','\x22\x20(','http://127.0.0.1:9200','\x20RESUME_ID=','\x20from\x20','8433208nFVwiL','/mcp','claude-code','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','messages','commhub_send_task','tools/call','high','stdin','alias','Message\x20content','get_all_status','30QRdBlh','702024Nprdvc','Priority\x20(default:\x20normal)','connected','idle','shutting\x20down,\x20reporting\x20offline...','message','token','pid','send_task','getReader','95649Zhsqng','blocked','connect','end','stringify','new_message','task','cwd','setRequestHandler','heartbeat\x20failed:\x20','send_message','replied','Bearer\x20','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','notification','MCP\x20stdio\x20connected','startsWith',':\x20inbox_count=','error','unattributed-','object','number','[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20','commhub_report_status','tmux\x20display-message\x20-p\x20\x27#S\x27','report_status','string',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','priority','result','pop','ack_inbox','2.0','indexOf','.claude/channels/commhub','length','3367155mdCxzF','then','SIGTERM','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','.env','15GyIGGv','body','Current\x20task\x20description','fatal:\x20','application/json','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','exit','config.json','SIGINT','min','hub','re-register\x20failed:\x20','parse','5994400lTxfBI','←\x20message\x20from\x20','decode'];a0_0xca92=function(){return _0x2338c4;};return a0_0xca92();}import{readFileSync as a0_0x774c42,existsSync as a0_0x343d0e}from'fs';import{randomUUID as a0_0x33cf1e}from'crypto';import{join as a0_0xfa3780}from'path';import{hostname as a0_0x2b37e1}from'os';import{execSync as a0_0x58c2dc}from'child_process';import{Server as a0_0x40b735}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x22656e}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x2ccd61,CallToolRequestSchema as a0_0x19d300}from'@modelcontextprotocol/sdk/types.js';function I(_0x82d1a0){const _0x351c0c=a0_0x1914;if(!a0_0x343d0e(_0x82d1a0))return;for(let _0x3d48b0 of a0_0x774c42(_0x82d1a0,_0x351c0c(0x173))[_0x351c0c(0x17c)]('\x0a')){let _0x1e521d=_0x3d48b0[_0x351c0c(0x188)]();if(!_0x1e521d||_0x1e521d[_0x351c0c(0x1dc)]('#'))continue;let _0x1038a8=_0x1e521d[_0x351c0c(0x1ed)]('=');if(_0x1038a8<0x0)continue;let _0x116e87=_0x1e521d['slice'](0x0,_0x1038a8)[_0x351c0c(0x188)](),_0x43dbd1=_0x1e521d[_0x351c0c(0x174)](_0x1038a8+0x1)[_0x351c0c(0x188)]()[_0x351c0c(0x180)](/^["']|["']$/g,'');if(!process.env[_0x116e87])process.env[_0x116e87]=_0x43dbd1;}}var L=process.env.HOME||'~',U=a0_0xfa3780(L,a0_0x4fb80b(0x1ee));I(a0_0xfa3780(U,'.env'));var v=process['cwd']()[a0_0x4fb80b(0x180)](/\//g,'-');I(a0_0xfa3780(U,v,a0_0x4fb80b(0x1f4)));function d(){const _0x2c4011=a0_0x4fb80b;try{return a0_0x58c2dc(_0x2c4011(0x1e4),{'encoding':_0x2c4011(0x173),'timeout':0x7d0})[_0x2c4011(0x188)]();}catch{return'';}}function m(){const _0x32d6d8=a0_0x4fb80b;try{let _0x1bdd86=a0_0xfa3780(L,_0x32d6d8(0x19d),_0x32d6d8(0x15d));if(a0_0x343d0e(_0x1bdd86))return JSON['parse'](a0_0x774c42(_0x1bdd86,'utf-8'));}catch{}return{};}var u=m(),j=process.env.COMMHUB_URL||u[a0_0x4fb80b(0x160)]||a0_0x4fb80b(0x1b2),f=process.env.COMMHUB_TMUX||d();function r(){const _0x11182f=a0_0x4fb80b;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x11182f(0x188)]())return process.env.COMMHUB_ALIAS['trim']();return process['stderr'][_0x11182f(0x1af)](_0x11182f(0x1e2)+('would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME='+(f||_0x11182f(0x18e))+'\x20/\x20hostname='+a0_0x2b37e1()+_0x11182f(0x1b8))),_0x11182f(0x1df)+process[_0x11182f(0x1c9)];}var G=r(),K=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x33cf1e(),F=process.env.COMMHUB_TOKEN||u[a0_0x4fb80b(0x1c8)]||'';function W(_0xde7b8a){const _0x3ca3b7=a0_0x4fb80b;let _0x2d34a5=new Date()['toTimeString']()[_0x3ca3b7(0x174)](0x0,0x8);process[_0x3ca3b7(0x171)]['write']('['+_0x2d34a5+_0x3ca3b7(0x16e)+_0xde7b8a+'\x0a');}function N(_0x132788){return new Promise(_0x18740e=>setTimeout(_0x18740e,_0x132788));}W('ENV:\x20URL='+j+'\x20ALIAS='+G+a0_0x4fb80b(0x1b3)+K[a0_0x4fb80b(0x174)](0x0,0x8)+a0_0x4fb80b(0x189)+(f||'none')+'\x20CWD='+process[a0_0x4fb80b(0x1d3)]()+'\x20PROJECT_ENV='+v);var D=new Map(),x=new a0_0x40b735({'name':a0_0x4fb80b(0x1ac),'version':a0_0x4fb80b(0x1ab)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x4fb80b(0x1fa),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x4fb80b(0x185),a0_0x4fb80b(0x192),a0_0x4fb80b(0x1a0)+G][a0_0x4fb80b(0x17b)]('\x0a')});x[a0_0x4fb80b(0x1d4)](a0_0x2ccd61,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x4fb80b(0x1f3),'inputSchema':{'type':a0_0x4fb80b(0x1e0),'properties':{'task_id':{'type':a0_0x4fb80b(0x1e6),'description':a0_0x4fb80b(0x179)},'text':{'type':a0_0x4fb80b(0x1e6),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':'string','enum':[a0_0x4fb80b(0x197),a0_0x4fb80b(0x167),a0_0x4fb80b(0x183),a0_0x4fb80b(0x1cd),a0_0x4fb80b(0x1de),a0_0x4fb80b(0x187)],'description':a0_0x4fb80b(0x1d9)}},'required':[a0_0x4fb80b(0x18a)]}},{'name':a0_0x4fb80b(0x1e3),'description':a0_0x4fb80b(0x196),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x4fb80b(0x1e6),'enum':[a0_0x4fb80b(0x166),a0_0x4fb80b(0x1c5),a0_0x4fb80b(0x1cd),'error']},'task':{'type':a0_0x4fb80b(0x1e6),'description':a0_0x4fb80b(0x1f7)},'progress':{'type':a0_0x4fb80b(0x1e1),'description':'Progress\x200-100'}},'required':[a0_0x4fb80b(0x199)]}},{'name':a0_0x4fb80b(0x1ba),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x4fb80b(0x1e0),'properties':{'alias':{'type':'string','description':a0_0x4fb80b(0x17e)},'task':{'type':a0_0x4fb80b(0x1e6),'description':'Task\x20content'},'priority':{'type':a0_0x4fb80b(0x1e6),'enum':[a0_0x4fb80b(0x1bc),a0_0x4fb80b(0x175),'low'],'description':a0_0x4fb80b(0x1c3)}},'required':[a0_0x4fb80b(0x1be),a0_0x4fb80b(0x1d2)]}},{'name':a0_0x4fb80b(0x1a6),'description':a0_0x4fb80b(0x1aa),'inputSchema':{'type':a0_0x4fb80b(0x1e0),'properties':{'alias':{'type':a0_0x4fb80b(0x1e6),'description':a0_0x4fb80b(0x17e)},'message':{'type':a0_0x4fb80b(0x1e6),'description':a0_0x4fb80b(0x1bf)}},'required':[a0_0x4fb80b(0x1be),a0_0x4fb80b(0x1c7)]}},{'name':a0_0x4fb80b(0x19b),'description':a0_0x4fb80b(0x169),'inputSchema':{'type':a0_0x4fb80b(0x1e0),'properties':{}}}]}));async function Y(_0x201887,_0x2cc8f4){const _0x4fb1a5=a0_0x4fb80b;let _0x2adbc3=await fetch(j+_0x4fb1a5(0x1b6),{'method':'POST','headers':{'Content-Type':_0x4fb1a5(0x1f9),'Accept':'application/json,\x20text/event-stream',...F?{'Authorization':_0x4fb1a5(0x1d8)+F}:{}},'body':JSON['stringify']({'jsonrpc':_0x4fb1a5(0x1ec),'id':0x1,'method':_0x4fb1a5(0x195),'params':{'protocolVersion':_0x4fb1a5(0x18c),'capabilities':{},'clientInfo':{'name':_0x4fb1a5(0x1ac),'version':_0x4fb1a5(0x1ab)}}})});if(!_0x2adbc3['ok']){let _0x2e9cc5=await _0x2adbc3[_0x4fb1a5(0x18a)]();return W('CommHub\x20init\x20failed:\x20'+_0x2adbc3[_0x4fb1a5(0x199)]+'\x20'+_0x2e9cc5[_0x4fb1a5(0x174)](0x0,0x64)),{'ok':!0x1,'error':_0x4fb1a5(0x17f)+_0x2adbc3[_0x4fb1a5(0x199)]};}await _0x2adbc3[_0x4fb1a5(0x18a)]();let _0x5b8fb4=(await(await fetch(j+_0x4fb1a5(0x1b6),{'method':_0x4fb1a5(0x1a8),'headers':{'Content-Type':'application/json','Accept':_0x4fb1a5(0x1a3),...F?{'Authorization':_0x4fb1a5(0x1d8)+F}:{}},'body':JSON[_0x4fb1a5(0x1d0)]({'jsonrpc':_0x4fb1a5(0x1ec),'id':0x2,'method':_0x4fb1a5(0x1bb),'params':{'name':_0x201887,'arguments':_0x2cc8f4}})}))[_0x4fb1a5(0x18a)]())[_0x4fb1a5(0x17c)]('\x0a')[_0x4fb1a5(0x1a4)](_0x2dc275=>_0x2dc275['startsWith'](_0x4fb1a5(0x1b0)));if(_0x5b8fb4){let _0x2293fe=JSON[_0x4fb1a5(0x162)](_0x5b8fb4[_0x4fb1a5(0x174)](0x6));return _0x2293fe?.[_0x4fb1a5(0x1e9)]?.[_0x4fb1a5(0x17a)]?.[0x0]?.[_0x4fb1a5(0x18a)]?JSON[_0x4fb1a5(0x162)](_0x2293fe[_0x4fb1a5(0x1e9)][_0x4fb1a5(0x17a)][0x0]['text']):_0x2293fe;}return{'ok':!0x1,'error':'no\x20response'};}x[a0_0x4fb80b(0x1d4)](a0_0x19d300,async _0x4a23f5=>{const _0x1207a1=a0_0x4fb80b;let {name:_0x98a3a3,arguments:_0x54145c}=_0x4a23f5[_0x1207a1(0x19c)];if(_0x98a3a3===_0x1207a1(0x178)){let {task_id:_0x20afde,text:_0xea1fd7,status:_0x4c7da0}=_0x54145c;if(_0x4c7da0===_0x1207a1(0x197)||_0x4c7da0===_0x1207a1(0x167)||_0x4c7da0===_0x1207a1(0x183)){let _0xd2fdb3=_0x4c7da0===_0x1207a1(0x197)?_0x1207a1(0x1d7):_0x4c7da0,_0x2431a7=_0x20afde?D[_0x1207a1(0x1a2)](_0x20afde)||_0x1207a1(0x160):'hub',_0x1ad06a=await Y('send_reply',{'alias':_0x2431a7,'text':_0xea1fd7,'in_reply_to':_0x20afde||void 0x0,'status':_0xd2fdb3,'from_session':G});if(_0x20afde)D['delete'](_0x20afde);return{'content':[{'type':_0x1207a1(0x18a),'text':JSON[_0x1207a1(0x1d0)](_0x1ad06a)}]};}let _0x340cb3=await Y(_0x1207a1(0x1e5),{'resume_id':K,'alias':G,'status':_0x4c7da0===_0x1207a1(0x1cd)?_0x1207a1(0x1cd):_0x4c7da0===_0x1207a1(0x1de)?_0x1207a1(0x1de):_0x1207a1(0x166),'task':_0xea1fd7['slice'](0x0,0xc8),'output':_0xea1fd7});return{'content':[{'type':_0x1207a1(0x18a),'text':JSON[_0x1207a1(0x1d0)](_0x340cb3)}]};}if(_0x98a3a3==='commhub_report_status'){let {status:_0x14a07c,task:_0x27e7b9,progress:_0x4f6d0b}=_0x54145c,_0x14a23c=await Y(_0x1207a1(0x1e5),{'resume_id':K,'alias':G,'status':_0x14a07c,'task':_0x27e7b9,'progress':_0x4f6d0b});return{'content':[{'type':'text','text':JSON[_0x1207a1(0x1d0)](_0x14a23c)}]};}if(_0x98a3a3==='commhub_send_task'){let {alias:_0x2cda7b,task:_0x59c2d1,priority:_0x677fc8}=_0x54145c,_0x2e76bd=await Y(_0x1207a1(0x1ca),{'alias':_0x2cda7b,'task':_0x59c2d1,'priority':_0x677fc8||_0x1207a1(0x175),'from_session':G});return{'content':[{'type':_0x1207a1(0x18a),'text':JSON[_0x1207a1(0x1d0)](_0x2e76bd)}]};}if(_0x98a3a3===_0x1207a1(0x1a6)){let {alias:_0x40f923,message:_0x4b4cb4}=_0x54145c,_0x4df591=await Y(_0x1207a1(0x1d6),{'alias':_0x40f923,'message':_0x4b4cb4,'from_session':G});return{'content':[{'type':_0x1207a1(0x18a),'text':JSON['stringify'](_0x4df591)}]};}if(_0x98a3a3===_0x1207a1(0x19b)){let _0x4aa76d=await Y(_0x1207a1(0x1c0),{});return{'content':[{'type':'text','text':JSON[_0x1207a1(0x1d0)](_0x4aa76d)}]};}return{'content':[{'type':_0x1207a1(0x18a),'text':JSON[_0x1207a1(0x1d0)]({'error':'unknown\x20tool'})}]};});var O=0x3e8,R=0x7530,T=0x36ee80;async function l(){const _0x7c76f8=a0_0x4fb80b;try{await Y(_0x7c76f8(0x1e5),{'resume_id':K,'alias':G,'status':_0x7c76f8(0x1c5),'server':a0_0x2b37e1(),'hostname':a0_0x2b37e1(),'agent':_0x7c76f8(0x1b7),'project_dir':process['cwd'](),'tmux_name':f||void 0x0}),W(_0x7c76f8(0x19f)+G+_0x7c76f8(0x1a5));}catch(_0xe443a7){W(_0x7c76f8(0x161)+_0xe443a7);}}async function o(){const _0x203c48=a0_0x4fb80b;let _0x45f29f=j+_0x203c48(0x181)+encodeURIComponent(G),_0x19cd4e={};if(F)_0x19cd4e[_0x203c48(0x17d)]=_0x203c48(0x1d8)+F;W(_0x203c48(0x193)+_0x45f29f);let _0x3b9e98=O,_0x4164f2=!0x0,_0x47b9c3=null;while(!0x0){try{let _0x2e50f8=await fetch(_0x45f29f,{'headers':_0x19cd4e});if(!_0x2e50f8['ok']){if(W('SSE\x20error:\x20'+_0x2e50f8[_0x203c48(0x199)]+'\x20'+_0x2e50f8[_0x203c48(0x184)]),_0x47b9c3=_0x47b9c3??Date['now'](),Date[_0x203c48(0x176)]()-_0x47b9c3>T){W(_0x203c48(0x172)+j+_0x203c48(0x1e7));return;}await N(_0x3b9e98),_0x3b9e98=Math[_0x203c48(0x15f)](_0x3b9e98*0x2,R);continue;}let _0x1c690e=_0x2e50f8[_0x203c48(0x1f6)][_0x203c48(0x1cb)](),_0x1aa62a=new TextDecoder(),_0x14d073='';_0x3b9e98=O;while(!0x0){let {done:_0x57d11c,value:_0x1f670f}=await _0x1c690e[_0x203c48(0x198)]();if(_0x57d11c)break;_0x14d073+=_0x1aa62a[_0x203c48(0x165)](_0x1f670f,{'stream':!0x0});let _0x3f4714=_0x14d073[_0x203c48(0x17c)]('\x0a\x0a');_0x14d073=_0x3f4714[_0x203c48(0x1ea)]()||'';for(let _0x24004c of _0x3f4714){let _0x5c888a=_0x24004c[_0x203c48(0x17c)]('\x0a')['find'](_0x21053e=>_0x21053e[_0x203c48(0x1dc)](_0x203c48(0x1b0)));if(!_0x5c888a)continue;try{let _0x196e88=JSON[_0x203c48(0x162)](_0x5c888a[_0x203c48(0x174)](0x6));if(await a(_0x196e88),_0x196e88[_0x203c48(0x16f)]==='connected'){if(_0x47b9c3=null,!_0x4164f2)await l();_0x4164f2=!0x1;}}catch(_0x24f941){W(_0x203c48(0x170)+_0x24f941);}}}W(_0x203c48(0x16b));}catch(_0x34ccf3){W('SSE\x20connection\x20error:\x20'+_0x34ccf3);}if(_0x47b9c3=_0x47b9c3??Date[_0x203c48(0x176)](),Date['now']()-_0x47b9c3>T){W(_0x203c48(0x172)+j+')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。');return;}await N(_0x3b9e98),_0x3b9e98=Math['min'](_0x3b9e98*0x2,R);}}async function a(_0x5a8ea3){const _0x1a3830=a0_0x4fb80b;if(_0x5a8ea3[_0x1a3830(0x16f)]===_0x1a3830(0x1c4)){W(_0x1a3830(0x16d)+G+'\x22');return;}if(_0x5a8ea3[_0x1a3830(0x16f)]===_0x1a3830(0x1d1)){if(W(_0x1a3830(0x164)+_0x5a8ea3[_0x1a3830(0x194)]+':\x20'+_0x5a8ea3['message'][_0x1a3830(0x174)](0x0,0x3c)),await x[_0x1a3830(0x1da)]({'method':_0x1a3830(0x1ad),'params':{'content':_0x5a8ea3[_0x1a3830(0x1c7)],'meta':{'sender':_0x5a8ea3[_0x1a3830(0x194)]||_0x1a3830(0x160),'sender_id':'commhub','user':_0x5a8ea3['from']||_0x1a3830(0x160),'priority':_0x1a3830(0x175)}}}),_0x5a8ea3['message_id'])await Y(_0x1a3830(0x1eb),{'alias':G,'message_id':_0x5a8ea3[_0x1a3830(0x1ae)]});return;}if(_0x5a8ea3[_0x1a3830(0x16f)]===_0x1a3830(0x168)||_0x5a8ea3[_0x1a3830(0x16f)]===_0x1a3830(0x186)){W('←\x20'+_0x5a8ea3[_0x1a3830(0x16f)]+_0x1a3830(0x1dd)+_0x5a8ea3[_0x1a3830(0x190)]+_0x1a3830(0x18f)+(_0x5a8ea3[_0x1a3830(0x1e8)]||_0x1a3830(0x175)));let _0x502149=await Y('get_inbox',{'alias':G,'limit':0x5});if(_0x502149?.['ok']&&_0x502149[_0x1a3830(0x1b9)]?.[_0x1a3830(0x1ef)]>0x0)for(let _0x38ef37 of _0x502149[_0x1a3830(0x1b9)]){let _0x54478f={'sender':_0x38ef37[_0x1a3830(0x1a7)]||'hub','sender_id':_0x1a3830(0x16c),'user':_0x38ef37[_0x1a3830(0x1a7)]||_0x1a3830(0x160),'task_id':_0x38ef37['id'],'priority':_0x38ef37[_0x1a3830(0x1e8)]||_0x1a3830(0x175)};D[_0x1a3830(0x1a1)](_0x38ef37['id'],_0x38ef37[_0x1a3830(0x1a7)]||_0x1a3830(0x160)),await x[_0x1a3830(0x1da)]({'method':'notifications/claude/channel','params':{'content':_0x38ef37[_0x1a3830(0x17a)],'meta':_0x54478f}}),W(_0x1a3830(0x182)+_0x38ef37['id'][_0x1a3830(0x174)](0x0,0x8)+_0x1a3830(0x1b4)+_0x38ef37[_0x1a3830(0x1a7)]+':\x20'+_0x38ef37[_0x1a3830(0x17a)][_0x1a3830(0x174)](0x0,0x3c)),await Y(_0x1a3830(0x1eb),{'alias':G,'message_id':_0x38ef37['id']});}}}async function n(){const _0x22cf6c=a0_0x4fb80b;let _0x25f026=new a0_0x22656e();await x[_0x22cf6c(0x1ce)](_0x25f026),W(_0x22cf6c(0x1db)),W(_0x22cf6c(0x19a)),o()[_0x22cf6c(0x18d)](_0x3a404d=>W(_0x22cf6c(0x18b)+_0x3a404d)),Y('report_status',{'resume_id':K,'alias':G,'status':_0x22cf6c(0x1c5),'server':a0_0x2b37e1(),'hostname':a0_0x2b37e1(),'agent':_0x22cf6c(0x1b7),'project_dir':process[_0x22cf6c(0x1d3)](),'tmux_name':f||void 0x0})[_0x22cf6c(0x1f1)](()=>W('registered\x20as\x20\x22'+G+_0x22cf6c(0x1b1)+K[_0x22cf6c(0x174)](0x0,0x8)+')'))[_0x22cf6c(0x18d)](_0x3728df=>W('warning:\x20could\x20not\x20register:\x20'+_0x3728df)),setInterval(()=>{const _0x3741dc=_0x22cf6c;Y(_0x3741dc(0x1e5),{'resume_id':K,'alias':G,'status':'idle','server':a0_0x2b37e1(),'hostname':a0_0x2b37e1(),'agent':_0x3741dc(0x1b7),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x3741dc(0x18d)](_0xad9917=>W(_0x3741dc(0x1d5)+_0xad9917));},0x2bf20),W(_0x22cf6c(0x191));}n()['catch'](_0x2c9c38=>{const _0x4422e3=a0_0x4fb80b;W(_0x4422e3(0x1f8)+_0x2c9c38),process['exit'](0x1);});async function b(){const _0x21e1df=a0_0x4fb80b;W(_0x21e1df(0x1c6)),await Y(_0x21e1df(0x1e5),{'resume_id':K,'alias':G,'status':_0x21e1df(0x16a),'task':'session\x20disconnected'})[_0x21e1df(0x18d)](()=>{}),process[_0x21e1df(0x15c)](0x0);}process[a0_0x4fb80b(0x1bd)]['on'](a0_0x4fb80b(0x1cf),()=>b()),process['on'](a0_0x4fb80b(0x1f2),()=>b()),process['on'](a0_0x4fb80b(0x15e),()=>b());
|
|
2
|
+
const a0_0x1033ff=a0_0x4b4a;(function(_0x316723,_0x725ce4){const _0x538359=a0_0x4b4a,_0x1ef86e=_0x316723();while(!![]){try{const _0x55a3cd=-parseInt(_0x538359(0x22d))/0x1+-parseInt(_0x538359(0x21f))/0x2+parseInt(_0x538359(0x200))/0x3*(parseInt(_0x538359(0x1d0))/0x4)+-parseInt(_0x538359(0x203))/0x5*(parseInt(_0x538359(0x1cd))/0x6)+parseInt(_0x538359(0x1fc))/0x7+parseInt(_0x538359(0x204))/0x8*(parseInt(_0x538359(0x237))/0x9)+parseInt(_0x538359(0x1d3))/0xa*(parseInt(_0x538359(0x1f0))/0xb);if(_0x55a3cd===_0x725ce4)break;else _0x1ef86e['push'](_0x1ef86e['shift']());}catch(_0x5b6736){_0x1ef86e['push'](_0x1ef86e['shift']());}}}(a0_0x298f,0x966c1));import{readFileSync as a0_0x28cd7f,existsSync as a0_0x2bfb7c}from'fs';import{randomUUID as a0_0x48e2be}from'crypto';import{join as a0_0x2a2455}from'path';import{hostname as a0_0x3a4734}from'os';import{execSync as a0_0x3da7e1}from'child_process';import{Server as a0_0x578c2a}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x3136c8}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0xb907d7,CallToolRequestSchema as a0_0x2e9c4a}from'@modelcontextprotocol/sdk/types.js';function I(_0x45bce3){const _0x376228=a0_0x4b4a;if(!a0_0x2bfb7c(_0x45bce3))return;for(let _0x124384 of a0_0x28cd7f(_0x45bce3,_0x376228(0x1a6))['split']('\x0a')){let _0x5368e7=_0x124384[_0x376228(0x1f1)]();if(!_0x5368e7||_0x5368e7[_0x376228(0x234)]('#'))continue;let _0x4b7bc4=_0x5368e7['indexOf']('=');if(_0x4b7bc4<0x0)continue;let _0x23c91a=_0x5368e7['slice'](0x0,_0x4b7bc4)[_0x376228(0x1f1)](),_0x377e33=_0x5368e7[_0x376228(0x238)](_0x4b7bc4+0x1)['trim']()['replace'](/^["']|["']$/g,'');if(!process.env[_0x23c91a])process.env[_0x23c91a]=_0x377e33;}}var L=process.env.HOME||'~',U=a0_0x2a2455(L,a0_0x1033ff(0x236));function a0_0x298f(){const _0xe930cc=['\x20CWD=','pop','min','application/json','report_status','completed','alias','application/json,\x20text/event-stream',']\x20[commhub]\x20',':\x20inbox_count=','commhub_send_message','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','config.json','registered\x20as\x20\x22','content','SSE\x20error:\x20','http://127.0.0.1:9200','token','number','\x20ALIAS=','\x20/\x20hostname=','status','Target\x20session\x20alias','getReader','setRequestHandler','(none)','parse','notification','parse\x20error:\x20','3632910qykORZ','SSE\x20fatal:\x20','init\x20failed:\x20','26960hZOiQK','type','commhub_reply','137140YpavWB','.env','from_session','2.0','connected','SIGTERM','Priority\x20(default:\x20normal)','idle','replace','priority','stringify','tools/call','[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20','get','2025-03-26','messages','cwd','←\x20message\x20from\x20','text','commhub','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','commhub_send_task','data:\x20','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','split',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','body','re-registered\x20as\x20\x22','normal','1342FOtDpY','trim','read','error','Bearer\x20','blocked','failed','\x20priority=','offline','hub','Reply\x20text\x20/\x20result\x20summary','set','1957662StmbhJ','result','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','\x20from\x20','213evYgwF','send_task','inbox_count','5PwdxiW','10432aVnJov','ENV:\x20URL=','0.3.0','length','join','working','new_task','warning:\x20could\x20not\x20register:\x20','string','Message\x20content','high','tmux\x20display-message\x20-p\x20\x27#S\x27','no\x20response','send_reply','→\x20injected\x20task\x20','fatal:\x20','re-register\x20failed:\x20','\x22\x20(','SIGINT','object','initialize','catch','cancelled','message_id','ack_inbox','\x22\x20after\x20SSE\x20reconnect','replied','1456234IrOGNZ','commhub-channel','.anet','get_all_status','heartbeat\x20failed:\x20','now','claude-code','CommHub\x20init\x20failed:\x20','Task\x20content','\x20PROJECT_ENV=','/events/','pid','session\x20disconnected','task','750207bPIfXl','from','delete','broadcast','notifications/claude/channel','decode','in_progress','startsWith','new_message','.claude/channels/commhub','1854IKKDkA','slice','low','toTimeString','commhub_report_status','unknown\x20tool','end','find','\x20RESUME_ID=','shutting\x20down,\x20reporting\x20offline...','Current\x20task\x20description','POST','connecting\x20to\x20','utf-8','stdin','write','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','stderr','Session\x20alias:\x20','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','exit','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'];a0_0x298f=function(){return _0xe930cc;};return a0_0x298f();}I(a0_0x2a2455(U,a0_0x1033ff(0x1d4)));var v=process['cwd']()[a0_0x1033ff(0x1db)](/\//g,'-');I(a0_0x2a2455(U,v,a0_0x1033ff(0x1d4)));function d(){const _0xa3c55d=a0_0x1033ff;try{return a0_0x3da7e1(_0xa3c55d(0x20f),{'encoding':_0xa3c55d(0x1a6),'timeout':0x7d0})[_0xa3c55d(0x1f1)]();}catch{return'';}}function m(){const _0x54a24e=a0_0x1033ff;try{let _0x46ad29=a0_0x2a2455(L,_0x54a24e(0x221),_0x54a24e(0x1bc));if(a0_0x2bfb7c(_0x46ad29))return JSON[_0x54a24e(0x1ca)](a0_0x28cd7f(_0x46ad29,_0x54a24e(0x1a6)));}catch{}return{};}var u=m(),j=process.env.COMMHUB_URL||u[a0_0x1033ff(0x1f9)]||a0_0x1033ff(0x1c0),f=process.env.COMMHUB_TMUX||d();function a0_0x4b4a(_0x3cc7dc,_0x4b7744){_0x3cc7dc=_0x3cc7dc-0x1a6;const _0x298fa7=a0_0x298f();let _0x4b4afd=_0x298fa7[_0x3cc7dc];return _0x4b4afd;}function r(){const _0x3a3fe7=a0_0x1033ff;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x3a3fe7(0x1f1)]())return process.env.COMMHUB_ALIAS['trim']();return process[_0x3a3fe7(0x1aa)][_0x3a3fe7(0x1a8)](_0x3a3fe7(0x1df)+(_0x3a3fe7(0x1a9)+(f||_0x3a3fe7(0x1c9))+_0x3a3fe7(0x1c4)+a0_0x3a4734()+_0x3a3fe7(0x1e7))),'unattributed-'+process[_0x3a3fe7(0x22a)];}var G=r(),K=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x48e2be(),F=process.env.COMMHUB_TOKEN||u[a0_0x1033ff(0x1c1)]||'';function W(_0x45e607){const _0x1ad47a=a0_0x1033ff;let _0x5920c5=new Date()[_0x1ad47a(0x23a)]()[_0x1ad47a(0x238)](0x0,0x8);process[_0x1ad47a(0x1aa)][_0x1ad47a(0x1a8)]('['+_0x5920c5+_0x1ad47a(0x1b8)+_0x45e607+'\x0a');}function N(_0xf80fe8){return new Promise(_0x517ef4=>setTimeout(_0x517ef4,_0xf80fe8));}W(a0_0x1033ff(0x205)+j+a0_0x1033ff(0x1c3)+G+a0_0x1033ff(0x23f)+K[a0_0x1033ff(0x238)](0x0,0x8)+'...\x20TMUX='+(f||'none')+a0_0x1033ff(0x1b0)+process['cwd']()+a0_0x1033ff(0x228)+v);var D=new Map(),x=new a0_0x578c2a({'name':a0_0x1033ff(0x220),'version':a0_0x1033ff(0x206)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x1033ff(0x1ae),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x1033ff(0x1ea),a0_0x1033ff(0x1ab)+G][a0_0x1033ff(0x208)]('\x0a')});x[a0_0x1033ff(0x1c8)](a0_0xb907d7,async()=>({'tools':[{'name':a0_0x1033ff(0x1d2),'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_0x1033ff(0x20c),'description':a0_0x1033ff(0x1af)},'text':{'type':'string','description':a0_0x1033ff(0x1fa)},'status':{'type':a0_0x1033ff(0x20c),'enum':[a0_0x1033ff(0x1b5),a0_0x1033ff(0x1f6),a0_0x1033ff(0x21a),a0_0x1033ff(0x1f5),a0_0x1033ff(0x1f3),a0_0x1033ff(0x233)],'description':a0_0x1033ff(0x1bb)}},'required':[a0_0x1033ff(0x1e5)]}},{'name':a0_0x1033ff(0x23b),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x1033ff(0x217),'properties':{'status':{'type':a0_0x1033ff(0x20c),'enum':[a0_0x1033ff(0x209),a0_0x1033ff(0x1da),'blocked',a0_0x1033ff(0x1f3)]},'task':{'type':a0_0x1033ff(0x20c),'description':a0_0x1033ff(0x241)},'progress':{'type':a0_0x1033ff(0x1c2),'description':'Progress\x200-100'}},'required':[a0_0x1033ff(0x1c5)]}},{'name':a0_0x1033ff(0x1e8),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x1033ff(0x217),'properties':{'alias':{'type':a0_0x1033ff(0x20c),'description':a0_0x1033ff(0x1c6)},'task':{'type':a0_0x1033ff(0x20c),'description':a0_0x1033ff(0x227)},'priority':{'type':a0_0x1033ff(0x20c),'enum':[a0_0x1033ff(0x20e),a0_0x1033ff(0x1ef),a0_0x1033ff(0x239)],'description':a0_0x1033ff(0x1d9)}},'required':[a0_0x1033ff(0x1b6),a0_0x1033ff(0x22c)]}},{'name':a0_0x1033ff(0x1ba),'description':a0_0x1033ff(0x1ac),'inputSchema':{'type':a0_0x1033ff(0x217),'properties':{'alias':{'type':'string','description':a0_0x1033ff(0x1c6)},'message':{'type':a0_0x1033ff(0x20c),'description':a0_0x1033ff(0x20d)}},'required':['alias','message']}},{'name':'commhub_get_all_status','description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x1033ff(0x217),'properties':{}}}]}));async function Y(_0x562860,_0x267738){const _0x54f7e2=a0_0x1033ff;let _0x8e3425=await fetch(j+'/mcp',{'method':_0x54f7e2(0x242),'headers':{'Content-Type':'application/json','Accept':_0x54f7e2(0x1b7),...F?{'Authorization':_0x54f7e2(0x1f4)+F}:{}},'body':JSON[_0x54f7e2(0x1dd)]({'jsonrpc':_0x54f7e2(0x1d6),'id':0x1,'method':_0x54f7e2(0x218),'params':{'protocolVersion':_0x54f7e2(0x1e1),'capabilities':{},'clientInfo':{'name':_0x54f7e2(0x220),'version':'0.3.0'}}})});if(!_0x8e3425['ok']){let _0x5e7dce=await _0x8e3425[_0x54f7e2(0x1e5)]();return W(_0x54f7e2(0x226)+_0x8e3425[_0x54f7e2(0x1c5)]+'\x20'+_0x5e7dce[_0x54f7e2(0x238)](0x0,0x64)),{'ok':!0x1,'error':_0x54f7e2(0x1cf)+_0x8e3425['status']};}await _0x8e3425[_0x54f7e2(0x1e5)]();let _0x513cd3=(await(await fetch(j+'/mcp',{'method':_0x54f7e2(0x242),'headers':{'Content-Type':_0x54f7e2(0x1b3),'Accept':_0x54f7e2(0x1b7),...F?{'Authorization':_0x54f7e2(0x1f4)+F}:{}},'body':JSON[_0x54f7e2(0x1dd)]({'jsonrpc':_0x54f7e2(0x1d6),'id':0x2,'method':_0x54f7e2(0x1de),'params':{'name':_0x562860,'arguments':_0x267738}})}))[_0x54f7e2(0x1e5)]())['split']('\x0a')[_0x54f7e2(0x23e)](_0x3d5813=>_0x3d5813[_0x54f7e2(0x234)](_0x54f7e2(0x1e9)));if(_0x513cd3){let _0x365d34=JSON[_0x54f7e2(0x1ca)](_0x513cd3[_0x54f7e2(0x238)](0x6));return _0x365d34?.['result']?.[_0x54f7e2(0x1be)]?.[0x0]?.['text']?JSON[_0x54f7e2(0x1ca)](_0x365d34[_0x54f7e2(0x1fd)][_0x54f7e2(0x1be)][0x0][_0x54f7e2(0x1e5)]):_0x365d34;}return{'ok':!0x1,'error':_0x54f7e2(0x210)};}x[a0_0x1033ff(0x1c8)](a0_0x2e9c4a,async _0x3da651=>{const _0x54b0c7=a0_0x1033ff;let {name:_0x17364a,arguments:_0x329ea2}=_0x3da651['params'];if(_0x17364a==='commhub_reply'){let {task_id:_0xacc3f6,text:_0xe1bead,status:_0x1d4dd9}=_0x329ea2;if(_0x1d4dd9===_0x54b0c7(0x1b5)||_0x1d4dd9==='failed'||_0x1d4dd9===_0x54b0c7(0x21a)){let _0x5a07a1=_0x1d4dd9===_0x54b0c7(0x1b5)?_0x54b0c7(0x21e):_0x1d4dd9,_0x52767e=_0xacc3f6?D[_0x54b0c7(0x1e0)](_0xacc3f6)||_0x54b0c7(0x1f9):_0x54b0c7(0x1f9),_0x38ab5f=await Y(_0x54b0c7(0x211),{'alias':_0x52767e,'text':_0xe1bead,'in_reply_to':_0xacc3f6||void 0x0,'status':_0x5a07a1,'from_session':G});if(_0xacc3f6)D[_0x54b0c7(0x22f)](_0xacc3f6);return{'content':[{'type':_0x54b0c7(0x1e5),'text':JSON[_0x54b0c7(0x1dd)](_0x38ab5f)}]};}let _0x2fd84f=await Y(_0x54b0c7(0x1b4),{'resume_id':K,'alias':G,'status':_0x1d4dd9==='blocked'?_0x54b0c7(0x1f5):_0x1d4dd9==='error'?_0x54b0c7(0x1f3):'working','task':_0xe1bead[_0x54b0c7(0x238)](0x0,0xc8),'output':_0xe1bead});return{'content':[{'type':_0x54b0c7(0x1e5),'text':JSON[_0x54b0c7(0x1dd)](_0x2fd84f)}]};}if(_0x17364a==='commhub_report_status'){let {status:_0x1d3e95,task:_0x4e522d,progress:_0x21d48c}=_0x329ea2,_0xcb1aa1=await Y(_0x54b0c7(0x1b4),{'resume_id':K,'alias':G,'status':_0x1d3e95,'task':_0x4e522d,'progress':_0x21d48c});return{'content':[{'type':_0x54b0c7(0x1e5),'text':JSON[_0x54b0c7(0x1dd)](_0xcb1aa1)}]};}if(_0x17364a===_0x54b0c7(0x1e8)){let {alias:_0x530c4e,task:_0x2d3367,priority:_0x3f65a3}=_0x329ea2,_0x65bcad=await Y(_0x54b0c7(0x201),{'alias':_0x530c4e,'task':_0x2d3367,'priority':_0x3f65a3||_0x54b0c7(0x1ef),'from_session':G});return{'content':[{'type':'text','text':JSON[_0x54b0c7(0x1dd)](_0x65bcad)}]};}if(_0x17364a===_0x54b0c7(0x1ba)){let {alias:_0x53207a,message:_0x51bb7c}=_0x329ea2,_0x3d979e=await Y('send_message',{'alias':_0x53207a,'message':_0x51bb7c,'from_session':G});return{'content':[{'type':_0x54b0c7(0x1e5),'text':JSON[_0x54b0c7(0x1dd)](_0x3d979e)}]};}if(_0x17364a==='commhub_get_all_status'){let _0x11748f=await Y(_0x54b0c7(0x222),{});return{'content':[{'type':_0x54b0c7(0x1e5),'text':JSON[_0x54b0c7(0x1dd)](_0x11748f)}]};}return{'content':[{'type':_0x54b0c7(0x1e5),'text':JSON['stringify']({'error':_0x54b0c7(0x23c)})}]};});var O=0x3e8,R=0x7530,T=0x36ee80;async function l(){const _0x46b7bd=a0_0x1033ff;try{await Y(_0x46b7bd(0x1b4),{'resume_id':K,'alias':G,'status':'idle','server':a0_0x3a4734(),'hostname':a0_0x3a4734(),'agent':_0x46b7bd(0x225),'project_dir':process['cwd'](),'tmux_name':f||void 0x0}),W(_0x46b7bd(0x1ee)+G+_0x46b7bd(0x21d));}catch(_0x3d050c){W(_0x46b7bd(0x214)+_0x3d050c);}}async function o(){const _0x264fb2=a0_0x1033ff;let _0x16dee9=j+_0x264fb2(0x229)+encodeURIComponent(G),_0x4d7b41={};if(F)_0x4d7b41['Authorization']=_0x264fb2(0x1f4)+F;W(_0x264fb2(0x243)+_0x16dee9);let _0xd26a3f=O,_0x33d261=!0x0,_0x237d0f=null;while(!0x0){try{let _0x4f076e=await fetch(_0x16dee9,{'headers':_0x4d7b41});if(!_0x4f076e['ok']){if(W(_0x264fb2(0x1bf)+_0x4f076e[_0x264fb2(0x1c5)]+'\x20'+_0x4f076e['statusText']),_0x237d0f=_0x237d0f??Date['now'](),Date[_0x264fb2(0x224)]()-_0x237d0f>T){W(_0x264fb2(0x1fe)+j+_0x264fb2(0x1ec));return;}await N(_0xd26a3f),_0xd26a3f=Math[_0x264fb2(0x1b2)](_0xd26a3f*0x2,R);continue;}let _0x5f4933=_0x4f076e[_0x264fb2(0x1ed)][_0x264fb2(0x1c7)](),_0x2ca031=new TextDecoder(),_0x45d7d9='';_0xd26a3f=O;while(!0x0){let {done:_0x4f5977,value:_0x343b38}=await _0x5f4933[_0x264fb2(0x1f2)]();if(_0x4f5977)break;_0x45d7d9+=_0x2ca031[_0x264fb2(0x232)](_0x343b38,{'stream':!0x0});let _0x2709bb=_0x45d7d9['split']('\x0a\x0a');_0x45d7d9=_0x2709bb[_0x264fb2(0x1b1)]()||'';for(let _0x550ca5 of _0x2709bb){let _0x2d87ee=_0x550ca5[_0x264fb2(0x1eb)]('\x0a')[_0x264fb2(0x23e)](_0x52a32c=>_0x52a32c[_0x264fb2(0x234)](_0x264fb2(0x1e9)));if(!_0x2d87ee)continue;try{let _0x5d14c1=JSON['parse'](_0x2d87ee['slice'](0x6));if(await a(_0x5d14c1),_0x5d14c1[_0x264fb2(0x1d1)]==='connected'){if(_0x237d0f=null,!_0x33d261)await l();_0x33d261=!0x1;}}catch(_0x3476e9){W(_0x264fb2(0x1cc)+_0x3476e9);}}}W('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x194493){W('SSE\x20connection\x20error:\x20'+_0x194493);}if(_0x237d0f=_0x237d0f??Date[_0x264fb2(0x224)](),Date[_0x264fb2(0x224)]()-_0x237d0f>T){W(_0x264fb2(0x1fe)+j+')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。');return;}await N(_0xd26a3f),_0xd26a3f=Math[_0x264fb2(0x1b2)](_0xd26a3f*0x2,R);}}async function a(_0x45f619){const _0x47ed91=a0_0x1033ff;if(_0x45f619[_0x47ed91(0x1d1)]===_0x47ed91(0x1d7)){W('SSE\x20connected\x20as\x20\x22'+G+'\x22');return;}if(_0x45f619[_0x47ed91(0x1d1)]===_0x47ed91(0x235)){if(W(_0x47ed91(0x1e4)+_0x45f619[_0x47ed91(0x22e)]+':\x20'+_0x45f619['message'][_0x47ed91(0x238)](0x0,0x3c)),await x[_0x47ed91(0x1cb)]({'method':_0x47ed91(0x231),'params':{'content':_0x45f619['message'],'meta':{'sender':_0x45f619[_0x47ed91(0x22e)]||_0x47ed91(0x1f9),'sender_id':_0x47ed91(0x1e6),'user':_0x45f619[_0x47ed91(0x22e)]||_0x47ed91(0x1f9),'priority':'normal'}}}),_0x45f619[_0x47ed91(0x21b)])await Y(_0x47ed91(0x21c),{'alias':G,'message_id':_0x45f619[_0x47ed91(0x21b)]});return;}if(_0x45f619[_0x47ed91(0x1d1)]===_0x47ed91(0x20a)||_0x45f619[_0x47ed91(0x1d1)]===_0x47ed91(0x230)){W('←\x20'+_0x45f619[_0x47ed91(0x1d1)]+_0x47ed91(0x1b9)+_0x45f619[_0x47ed91(0x202)]+_0x47ed91(0x1f7)+(_0x45f619[_0x47ed91(0x1dc)]||_0x47ed91(0x1ef)));let _0x32d6e7=await Y('get_inbox',{'alias':G,'limit':0x5});if(_0x32d6e7?.['ok']&&_0x32d6e7[_0x47ed91(0x1e2)]?.[_0x47ed91(0x207)]>0x0)for(let _0x878324 of _0x32d6e7[_0x47ed91(0x1e2)]){let _0x18d9f8={'sender':_0x878324[_0x47ed91(0x1d5)]||_0x47ed91(0x1f9),'sender_id':'commhub','user':_0x878324[_0x47ed91(0x1d5)]||_0x47ed91(0x1f9),'task_id':_0x878324['id'],'priority':_0x878324[_0x47ed91(0x1dc)]||_0x47ed91(0x1ef)};D[_0x47ed91(0x1fb)](_0x878324['id'],_0x878324[_0x47ed91(0x1d5)]||'hub'),await x[_0x47ed91(0x1cb)]({'method':'notifications/claude/channel','params':{'content':_0x878324[_0x47ed91(0x1be)],'meta':_0x18d9f8}}),W(_0x47ed91(0x212)+_0x878324['id'][_0x47ed91(0x238)](0x0,0x8)+_0x47ed91(0x1ff)+_0x878324[_0x47ed91(0x1d5)]+':\x20'+_0x878324[_0x47ed91(0x1be)][_0x47ed91(0x238)](0x0,0x3c)),await Y(_0x47ed91(0x21c),{'alias':G,'message_id':_0x878324['id']});}}}async function n(){const _0x4f536e=a0_0x1033ff;let _0x39c826=new a0_0x3136c8();await x['connect'](_0x39c826),W('MCP\x20stdio\x20connected'),W('starting\x20SSE\x20listener...'),o()[_0x4f536e(0x219)](_0x1b2956=>W(_0x4f536e(0x1ce)+_0x1b2956)),Y(_0x4f536e(0x1b4),{'resume_id':K,'alias':G,'status':_0x4f536e(0x1da),'server':a0_0x3a4734(),'hostname':a0_0x3a4734(),'agent':'claude-code','project_dir':process[_0x4f536e(0x1e3)](),'tmux_name':f||void 0x0})['then'](()=>W(_0x4f536e(0x1bd)+G+_0x4f536e(0x215)+K['slice'](0x0,0x8)+')'))[_0x4f536e(0x219)](_0x5d7cda=>W(_0x4f536e(0x20b)+_0x5d7cda)),setInterval(()=>{const _0x2c1116=_0x4f536e;Y(_0x2c1116(0x1b4),{'resume_id':K,'alias':G,'status':_0x2c1116(0x1da),'server':a0_0x3a4734(),'hostname':a0_0x3a4734(),'agent':_0x2c1116(0x225),'project_dir':process[_0x2c1116(0x1e3)](),'tmux_name':f||void 0x0})[_0x2c1116(0x219)](_0x1bb189=>W(_0x2c1116(0x223)+_0x1bb189));},0x2bf20),W('ready\x20—\x20waiting\x20for\x20events');}n()[a0_0x1033ff(0x219)](_0x310fcf=>{const _0x493d4e=a0_0x1033ff;W(_0x493d4e(0x213)+_0x310fcf),process[_0x493d4e(0x1ad)](0x1);});async function b(){const _0x347219=a0_0x1033ff;W(_0x347219(0x240)),await Y('report_status',{'resume_id':K,'alias':G,'status':_0x347219(0x1f8),'task':_0x347219(0x22b)})[_0x347219(0x219)](()=>{}),process[_0x347219(0x1ad)](0x0);}process[a0_0x1033ff(0x1a7)]['on'](a0_0x1033ff(0x23d),()=>b()),process['on'](a0_0x1033ff(0x1d8),()=>b()),process['on'](a0_0x1033ff(0x216),()=>b());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.12-preview.0",
|
|
4
4
|
"description": "AI Agent Network CLI \u2014 Local-first multi-agent orchestration across 4 runtimes (Claude Code CLI / Claude Agent SDK / Codex SDK / Grok Build ACP) and 8+ LLM providers (Anthropic / OpenAI / xAI Grok / MiniMax / DeepSeek / GLM / Kimi / InternLM / Xiaomi MiMo / OpenRouter). Apache 2.0.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|