From bd3f58c18f540d78474dfa8390f03aad868b2990 Mon Sep 17 00:00:00 2001 From: bingshuo <565183519@qq.com> Date: Sat, 30 May 2026 18:52:54 +0800 Subject: [PATCH] =?UTF-8?q?rename:=20=E5=85=89=E6=B9=96=E9=A9=B1=E5=8A=A8?= =?UTF-8?q?=E5=BC=95=E6=93=8E=20v2.0=20(Guanghu=20Drive=20Engine)=EF=BC=8C?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=90=8D=20guanghu-engine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/gatekeeper.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/gatekeeper.js b/tools/gatekeeper.js index d8c314b..371b443 100644 --- a/tools/gatekeeper.js +++ b/tools/gatekeeper.js @@ -1,12 +1,12 @@ #!/usr/bin/env node /* ═══════════════════════════════════════ - 铸渊守门人 v2.0 · HLDP万能语言接口 - 新增 /hlpd 端点 — HLDP模块翻译执行 + 光湖驱动引擎 v2.0 · Guanghu Drive Engine + HLDP万能语言接口 — HLDP进,指令出 ═══════════════════════════════════════ */ const http=require('http'),fs=require('fs'),path=require('path'),crypto=require('crypto'),{exec}=require('child_process'),os=require('os'); -const PORT=parseInt(process.env.GATEKEEPER_PORT||process.argv[2]||'3910',10); +const PORT=parseInt(process.env.ENGINE_PORT||process.env.GATEKEEPER_PORT||process.argv[2]||'3910',10); const DATA_DIR=path.join(os.homedir(),'.gatekeeper'); const CMD_TIMEOUT=30000,MAX_OUTPUT=100000,RATE_LIMIT=60; @@ -21,7 +21,7 @@ if(!API_SECRET){ fs.writeFileSync(SECRET_FILE,API_SECRET,{mode:0o600}); console.log(''); console.log('══════════════════════════════════════════════'); - console.log(' 🔐 铸渊看门人 · 首次启动'); + console.log(' 🔐 光湖驱动引擎 · 首次启动'); console.log(''); console.log(' ╭─ API 密钥(请复制保存)'); console.log(' ├─ '+API_SECRET); @@ -37,7 +37,7 @@ function log(level,action,detail){ const ts=new Date().toISOString(); const line='['+ts+'] ['+level+'] '+action+(detail?' | '+detail:''); console.log(line); - try{const lf=path.join(DATA_DIR,'gatekeeper.log');fs.appendFileSync(lf,line+'\n');}catch(e){} + try{const lf=path.join(DATA_DIR,'engine.log');fs.appendFileSync(lf,line+'\n');}catch(e){} } const RC={}; @@ -74,7 +74,7 @@ function fmtBytes(b){if(b===0)return'0 B';const k=1024,sizes=['B','KB','MB','GB' /* ═══════════════════════════════════════ - HLDP 翻译层 v1.0 — 守门人 v2.0 新增 + HLDP 翻译层 v1.0 — 光湖驱动引擎 v2.0 ═══════════════════════════════════════ */ function parseHLDP(text){ @@ -150,11 +150,11 @@ const server=http.createServer(async(req,res)=>{ log('INFO','exec_result','exit='+r.code); jr(res,200,{ok:r.code===0,stdout:r.stdout,stderr:r.stderr,exitCode:r.code}); }else if(route==='/health'){ - jr(res,200,{ok:true,service:'zhuyuan-gatekeeper',version:'2.0.0',uptime:process.uptime().toFixed(0)+'s',timestamp:new Date().toISOString()}); + jr(res,200,{ok:true,service:'guanghu-engine',version:'2.0.0',uptime:process.uptime().toFixed(0)+'s',timestamp:new Date().toISOString()}); }else if(route==='/status'){ log('INFO','status',''); const total=os.totalmem(),free=os.freemem(); - jr(res,200,{ok:true,hostname:os.hostname(),platform:os.platform(),arch:os.arch(),cpus:os.cpus().length,uptime:os.uptime(),uptime_str:fmtUptime(os.uptime()),memory:{total:fmtBytes(total),free:fmtBytes(free),used:fmtBytes(total-free),usage:((total-free)/total*100).toFixed(1)+'%'},load:os.loadavg().map(n=>+n.toFixed(2)),gatekeeper:{version:'2.0.0',port:PORT,uptime:process.uptime().toFixed(0)+'s'}}); + jr(res,200,{ok:true,hostname:os.hostname(),platform:os.platform(),arch:os.arch(),cpus:os.cpus().length,uptime:os.uptime(),uptime_str:fmtUptime(os.uptime()),memory:{total:fmtBytes(total),free:fmtBytes(free),used:fmtBytes(total-free),usage:((total-free)/total*100).toFixed(1)+'%'},load:os.loadavg().map(n=>+n.toFixed(2)),engine:{version:'2.0.0',port:PORT,uptime:process.uptime().toFixed(0)+'s'}}); }else if(route==='/hlpd'){ const b=await parseBody(req); if(!b||!b.hlpd){jr(res,400,{error:'缺少 hlpd 参数'});return;} @@ -214,7 +214,7 @@ server.on('error',(e)=>{ server.listen(PORT,'0.0.0.0',()=>{ const h=os.hostname(); log('INFO','startup','host='+h+' port='+PORT+' v2.0'); - console.log(' ⚔️ 铸渊守门人 v2.0 · HLDP 已就绪'); + console.log(' ⚔️ 光湖驱动引擎 v2.0 · HLDP 已就绪'); console.log(' 主机名: '+h+' 端口: '+PORT); });