feat(portable): 内网/局域网可用性工具包 + 启动绕代理 (v2.1.10)

便携版在内网/离线/受控浏览器环境下"配不上、用不了、查不清"的三个痛点工具化,
Win + Mac 双端,纯 Node 零依赖脚本,中文提示由 node 打印(.bat 保持纯 ASCII,
.command 保持 LF),三端真机验证(本机 Win / Mac mini / 客户机 pc-7512)。

新增工具:
- lib/intranet-check.mjs (+ Windows-IntranetFix.bat / Mac-IntranetFix.command)
  一键体检: 代理env + 直连可达 + 真发一条对话,分清"网络不通 vs 配置错"。
- lib/setup-local-model.mjs (+ Windows-LocalModel.bat / Mac-LocalModel.command)
  纯命令行配 Ollama / newapi 并当场实测,绕开打不开的 Control UI;写前自动备份+merge。
- lib/resolve-no-proxy.mjs 接入 Windows-Start.bat / Mac-Start.command:
  把配置里的模型 host 写进 NO_PROXY,避免系统代理劫持内网模型请求
  (OpenClaw 自身只 bypass loopback CDP,不管模型 host)。
- OpenClaw-Doctor.bat / Mac-OpenClaw-Doctor.command: 官方 doctor 的隔离进阶入口
  (只读、非交互;doctor 实跑慢且 TTY-only,故不进客户一键流程)。

测试: tests/windows-launchers.test.mjs 新增回归
- 客户面 .bat 必须纯 ASCII (UTF-8 中文会被 GBK cmd 读乱,报 usebackq 不是命令)
- macOS .command 必须 LF-only (CRLF 触发 bad interpreter: /bin/bash^M)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
hfshfg
2026-06-22 18:51:16 +08:00
parent 7805ee01f7
commit 3439db32ad
13 changed files with 815 additions and 2 deletions

View File

@@ -0,0 +1,54 @@
@echo off
chcp 65001 >nul 2>&1
title U-Claw - OpenClaw Doctor (advanced)
setlocal
REM Official OpenClaw health check (English, advanced users).
REM NOTE: run this AFTER U-Claw is already running (double-click Windows-Start.bat
REM first), otherwise doctor stalls while probing a gateway that is not up yet.
REM Read-only: we deliberately do NOT pass --fix/--repair/--force.
set "UCLAW_DIR=%~dp0"
set "APP_DIR=%UCLAW_DIR%app"
set "CORE_DIR=%APP_DIR%\core"
set "DATA_DIR=%UCLAW_DIR%data"
set "STATE_DIR=%DATA_DIR%\.openclaw"
set "NODE_BIN=%APP_DIR%\runtime\node-win-x64\node.exe"
set "OPENCLAW_MJS=%CORE_DIR%\node_modules\openclaw\openclaw.mjs"
set "OPENCLAW_HOME=%DATA_DIR%"
set "OPENCLAW_STATE_DIR=%STATE_DIR%"
set "OPENCLAW_CONFIG_PATH=%STATE_DIR%\openclaw.json"
set "OPENCLAW_DISABLE_BONJOUR=1"
if not exist "%NODE_BIN%" (
echo [ERROR] Node runtime not found. Put this file inside your U-Claw folder.
echo.
pause
exit /b 1
)
if not exist "%OPENCLAW_MJS%" (
echo [ERROR] OpenClaw runtime not found ^(app\core\node_modules\openclaw^).
echo.
pause
exit /b 1
)
echo.
echo ========================================
echo OpenClaw Doctor (official, English)
echo ========================================
echo This is the upstream deep health check. It can take a while and is in
echo English. Make sure U-Claw is ALREADY running first.
echo If it seems stuck, press Ctrl+C to stop - it is safe (read-only).
echo.
pause
"%NODE_BIN%" "%OPENCLAW_MJS%" doctor --non-interactive
echo.
echo ----------------------------------------
echo Doctor finished. For a quick Chinese check of your model connection,
echo use Windows-IntranetFix.bat instead.
echo.
pause