{
  "skill": "uking-install-windows",
  "version": 23,
  "updated": "2026-07-03",
  "notes": "v23: Hermes repair 先清理半截便携 Python 目录并重新 ensure_python，避免 tar 解压中断后直接跑 python -m pip 触发 9009；OpenClaw repair 先停掉 .uking/runtime/node 下的占用进程，降低 npm EBUSY rename。v21: Hermes 对齐 Claude Code 稳定链路——pip 安装后由客户端自动创建配置目录并写虾盘云；repair 增加 pip 缓存清理后再强制重装，降低坏 wheel/半包导致的复装失败。v20: Hermes 改装 hermes-agent[web]——带 web extra 才有 `hermes dashboard` 网页版控制台(FastAPI@127.0.0.1:9119，预编译 React 前端随 wheel 走，无需 Node/npm)。U-King 把网页版设为 Hermes 主推入口(小白怕 TUI，网页里点点就能聊)。装包带 [web] 后 `hermes dashboard` 不再现场 build。 v19: ★Codex CLI 装不上真因翻案——@openai/codex 0.141+ 已把平台二进制打包进主包，v15 加的『单独装 @openai/codex-win32-x64 子包』如今 npm 已下架(npm error 404 @openai/codex-win32-x64@*)。run_steps 第一个失败步骤即中断→codex 其实已能跑(codex-cli 0.141.0)却被判『装不上』；且 repair 里这步排在 GitHub 兜底前、一 404 就让兜底永远轮不到(pc-9500 实测铁证)。修法:steps/repair 都删掉 win32-x64 子包步骤，只留 `npm i -g @openai/codex --include=optional`(旧版平台子包仍兜得住)+GitHub 二进制兜底。 codex-app:winget 商店装完加 60s 轮询等异步注册(避免装上了只是注册没回来被误判失败、白下 650MB MSIX)+winget 缺失时快速转兜底 MSIX。 v18: 便携 Node 解压不再依赖 PowerShell——客户机(#21/#22, 0.9.10)的 Expand-Archive 报「System.Net.ServicePointManager 类初始值设定项引发异常」(这台机 .NET/PowerShell 环境坏/太老,shell 起不来)。改 zip 也走 Win10 自带 System32\\tar.exe -xf(bsdtar 按魔数识别),失败才回退 Expand-Archive(先强制 TLS1.2)。★解压在 exe 编译进二进制,须发版 0.9.11 才生效,skill 热下发救不了它;本条 skill 改动是把 repair『清代理』命令的 `npm... & exit 0`(cmd 调 .cmd 不加 call 会吞后续命令致退出码1假失败)改成 `call npm... & (exit /b 0)`。 v17: 修死链——mirror_fallback 原 cloud.u-claw.org/uking/runtimes 实测 404(并不映射到 OSS),便携 Node/Python 主源(npmmirror)挂时兜底其实是哑的。改成阿里云深圳 OSS 直链(u-claw-updates/uking/runtimes,国内 5MB/s),并把 node/python 运行时同名文件镜像上去。 v16: Codex CLI 加 GitHub 官方二进制兜底——npm 链路(npmmirror 滞后/代理抖动/optional 包被跳)全失败时，直接下 openai/codex 官方 release 单文件 exe(rust-v0.140.0)，GitHub 主源→阿里云深圳 OSS 国内镜像(u-claw-updates/uking/runtimes/codex-win-x64.zip, 实测 200/99MB/5MB-s)两路兜底，解压装到 %USERPROFILE%\bin\\codex.exe(已在 search_paths)。GitHub 一键脚本 chatgpt.com 国内不通已弃。 v15: Codex CLI 装不上的真因修复——@openai/codex 的平台原生二进制（@openai/codex-win32-x64）是 optionalDependency，npmmirror 滞后/客户机代理抖动时被悄悄跳过，导致 codex 包装上了但 `codex --version` 崩。现在主装步骤加 --include=optional 强制拉可选依赖 + 单独补装 win32-x64 子包；repair 增加「放开 npm optional」+「单独补装平台二进制」两步。installer.rs 加 npm_install 的 with_optional 字段。v14: Codex桌面版兜底源修正——原第三条 cloud.u-claw.org/uking/codex-app.msix 实测 404（死链，客户装不上的隐患），换成 agentsmirror R2 直链（codexapp-r2.agentsmirror.com，实测 200/648MB），现两路全活：镜像主域→R2直链。配合 U-King「一键全安装」按钮。v13: 代理自愈——客户机 clash 式代理把 npm proxy 写死全局 npmrc 时，npm install 卡死/报 lookup\"\"。每个 npm 工具的 repair 第一步先清全局 npmrc 代理（--location=global）；底层 installer 也已默认 --proxy=\"\" 绕代理 + 子进程清代理环境变量（实战 DESKTOP-PBDJJB6）。v12: Codex桌面版MSIX下载三级兜底——微软商店winget(主)→第三方镜像agentsmirror(兜底)→自有源cloud.u-claw.org(最后防线，减轻自有服务器负荷)；curl 加 -f 让HTTP错误触发回落。v10: 装前磁盘空间预检（满盘时 curl 报错是天书，us-server 实测仅剩20MB）。v9: Codex桌面版MSIX实际约550MB，修正提示文案+下载超时放宽到40分钟。v8: Codex CLI 解锁到最新版（虾盘云已支持 /v1/responses，不再需要锁 0.80）+ 新增 Codex 桌面版（winget 微软商店渠道，失败回退国内镜像 MSIX）。v7: 运行时下载加服务器备用源。v6: 便携 Python + Hermes。v5: OpenClaw + Node 22.20。",
  "mirror_fallback": "https://u-claw-updates.oss-cn-shenzhen.aliyuncs.com/uking/runtimes",
  "python": {
    "url": "https://registry.npmmirror.com/-/binary/python-build-standalone/20241016/cpython-3.12.7+20241016-x86_64-pc-windows-msvc-install_only.tar.gz",
    "url_mac_arm64": "https://registry.npmmirror.com/-/binary/python-build-standalone/20241016/cpython-3.12.7+20241016-aarch64-apple-darwin-install_only.tar.gz",
    "url_mac_x64": "https://registry.npmmirror.com/-/binary/python-build-standalone/20241016/cpython-3.12.7+20241016-x86_64-apple-darwin-install_only.tar.gz"
  },
  "pip_index": "https://mirrors.aliyun.com/pypi/simple/",
  "node": {
    "version": "v22.20.0",
    "url": "https://registry.npmmirror.com/-/binary/node/v22.20.0/node-v22.20.0-win-x64.zip",
    "dir_name": "node-v22.20.0-win-x64",
    "url_mac_arm64": "https://registry.npmmirror.com/-/binary/node/v22.20.0/node-v22.20.0-darwin-arm64.tar.gz",
    "dir_name_mac_arm64": "node-v22.20.0-darwin-arm64",
    "url_mac_x64": "https://registry.npmmirror.com/-/binary/node/v22.20.0/node-v22.20.0-darwin-x64.tar.gz",
    "dir_name_mac_x64": "node-v22.20.0-darwin-x64"
  },
  "npm_registry": "https://registry.npmmirror.com",
  "tools": {
    "claude-code": {
      "name": "Claude Code CLI",
      "bin": "claude",
      "verify_cmd": "claude --version",
      "steps": [
        {
          "type": "ensure_node",
          "label": "检查 Node.js 运行时（缺失则自动装便携版）"
        },
        {
          "type": "npm_install",
          "label": "安装 Claude Code（npmmirror 国内加速）",
          "package": "@anthropic-ai/claude-code"
        }
      ],
      "repair": [
        {
          "type": "run",
          "label": "清除 npm 全局代理配置（客户机代理常把 npm 拦死）",
          "cmd": "call npm config delete proxy --location=global & call npm config delete https-proxy --location=global & call npm config delete proxy & call npm config delete https-proxy & (exit /b 0)"
        },
        {
          "type": "run",
          "label": "清理 npm 缓存",
          "cmd": "npm cache clean --force"
        },
        {
          "type": "npm_install",
          "label": "强制重装 Claude Code",
          "package": "@anthropic-ai/claude-code",
          "force": true
        }
      ],
      "min_free_mb": 400
    },
    "codex": {
      "name": "Codex CLI",
      "bin": "codex",
      "verify_cmd": "codex --version",
      "steps": [
        {
          "type": "ensure_node",
          "label": "检查 Node.js 运行时（缺失则自动装便携版）"
        },
        {
          "type": "npm_install",
          "label": "安装 Codex CLI 最新版（npmmirror 国内加速；0.141+ 二进制已打包进主包，--include=optional 兜旧版平台子包）",
          "package": "@openai/codex",
          "with_optional": true
        }
      ],
      "repair": [
        {
          "type": "run",
          "label": "停止占用 OpenClaw/npm 全局目录的旧进程（修 EBUSY rename）",
          "cmd": "powershell -NoProfile -NonInteractive -Command \"$nodeRoot=(Join-Path $env:USERPROFILE '.uking\\runtime\\node'); Get-CimInstance Win32_Process | Where-Object { $_.ExecutablePath -and $_.ExecutablePath.StartsWith($nodeRoot,[StringComparison]::OrdinalIgnoreCase) } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }; exit 0\""
        },
        {
          "type": "run",
          "label": "清除 npm 全局代理配置（客户机代理常把 npm 拦死）",
          "cmd": "call npm config delete proxy --location=global & call npm config delete https-proxy --location=global & call npm config delete proxy & call npm config delete https-proxy & (exit /b 0)"
        },
        {
          "type": "run",
          "label": "放开 npm 拉取可选依赖（平台二进制是 optionalDependency，被关掉就装不上 codex 内核）",
          "cmd": "npm config delete optional --location=global & npm config set optional true & exit 0"
        },
        {
          "type": "run",
          "label": "清理 npm 缓存",
          "cmd": "npm cache clean --force"
        },
        {
          "type": "npm_install",
          "label": "强制重装 Codex CLI（含平台二进制）",
          "package": "@openai/codex",
          "with_optional": true,
          "force": true
        },
        {
          "type": "run",
          "label": "兜底：直接下 GitHub 官方 Codex 二进制（npm 全失败时的最后防线；GitHub 主源→阿里云深圳 OSS 国内镜像两路）",
          "cmd": "curl -fL -sS -m 1200 --proxy \"\" -o \"%TEMP%\\codex-cli.zip\" https://github.com/openai/codex/releases/download/rust-v0.140.0/codex-x86_64-pc-windows-msvc.exe.zip || curl -fL -sS -m 1200 --proxy \"\" -o \"%TEMP%\\codex-cli.zip\" https://u-claw-updates.oss-cn-shenzhen.aliyuncs.com/uking/runtimes/codex-win-x64.zip"
        },
        {
          "type": "run",
          "label": "解压官方二进制并装到 %USERPROFILE%\bin\\codex.exe（该目录已在 U-King 探测 PATH 内）",
          "cmd": "powershell -NoProfile -NonInteractive -Command \"$d=$env:USERPROFILE+'\bin'; New-Item -ItemType Directory -Force -Path $d | Out-Null; Expand-Archive -Force -LiteralPath ($env:TEMP+'\\codex-cli.zip') -DestinationPath ($env:TEMP+'\\codex-cli'); Copy-Item -Force ($env:TEMP+'\\codex-cli\\codex-x86_64-pc-windows-msvc.exe') ($d+'\\codex.exe'); if (Test-Path ($d+'\\codex.exe')) { exit 0 } else { exit 1 }\""
        }
      ],
      "min_free_mb": 400
    },
    "codex-app": {
      "name": "Codex 桌面版",
      "bin": "codex-app",
      "verify_cmd": "powershell -NoProfile -NonInteractive -Command \"if (Get-AppxPackage -Name OpenAI.Codex) { (Get-AppxPackage -Name OpenAI.Codex).Version } else { exit 1 }\"",
      "steps": [
        {
          "type": "run",
          "label": "通过微软商店安装 Codex 桌面版（已装则跳过；商店安装较慢，请耐心等待）",
          "cmd": "powershell -NoProfile -NonInteractive -Command \"if (Get-AppxPackage -Name OpenAI.Codex) { Write-Host 'Codex 桌面版已安装，跳过'; exit 0 }; if (-not (Get-Command winget -ErrorAction SilentlyContinue)) { Write-Host 'winget 不可用，转兜底 MSIX'; exit 1 }; winget install --id 9PLM9XGG6VKS --source msstore --accept-package-agreements --accept-source-agreements --disable-interactivity; for ($i=0; $i -lt 12; $i++) { if (Get-AppxPackage -Name OpenAI.Codex) { Write-Host 'Codex 桌面版安装成功'; exit 0 }; Start-Sleep -Seconds 5 }; exit 1\""
        }
      ],
      "repair": [
        {
          "type": "run",
          "label": "下载官方 MSIX 安装包（约 650MB，慢网请耐心等待；镜像主域→镜像 R2 直链 两路兜底）",
          "cmd": "powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command \"$ErrorActionPreference='Stop'; $p=Join-Path $env:TEMP 'codex-app.msix'; Remove-Item $p -Force -ErrorAction SilentlyContinue; $urls=@('https://codexapp.agentsmirror.com/latest/win','https://codexapp-r2.agentsmirror.com/latest/win'); $ok=$false; foreach($u in $urls){ Write-Host ('下载 '+$u); curl.exe -fL -sS -m 2400 -o $p $u; if($LASTEXITCODE -eq 0 -and (Test-Path $p) -and (Get-Item $p).Length -gt 100MB){ $ok=$true; break } }; if(-not $ok){ throw 'Codex MSIX 下载失败或文件不完整，请点手动教程下载' }; Write-Host ('MSIX 已下载 '+[Math]::Round((Get-Item $p).Length/1MB)+' MB')\""
        },
        {
          "type": "run",
          "label": "安装 MSIX（免管理员，按用户安装）",
          "cmd": "powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command \"$p=Join-Path $env:TEMP 'codex-app.msix'; if(-not (Test-Path $p)){ throw '找不到 codex-app.msix，请重新下载安装包' }; Add-AppxPackage -Path $p -ErrorAction Stop; for($i=0; $i -lt 12; $i++){ if(Get-AppxPackage -Name OpenAI.Codex){ Write-Host 'Codex 桌面版安装成功'; exit 0 }; Start-Sleep -Seconds 5 }; throw 'MSIX 安装后未检测到 OpenAI.Codex，请重启 U-King 或按手动教程确认安装状态'\""
        }
      ],
      "min_free_mb": 1500
    },
    "openclaw": {
      "name": "OpenClaw 龙虾",
      "bin": "openclaw",
      "verify_cmd": "openclaw --version",
      "steps": [
        {
          "type": "ensure_node",
          "label": "检查 Node.js 运行时（OpenClaw 需 Node 22.19+）"
        },
        {
          "type": "npm_install",
          "label": "安装 OpenClaw（npm 国内源，绕开官方 git 安装）",
          "package": "openclaw"
        }
      ],
      "repair": [
        {
          "type": "run",
          "label": "停止占用 OpenClaw/npm 全局目录的旧进程（修 EBUSY rename）",
          "cmd": "powershell -NoProfile -NonInteractive -Command \"$nodeRoot=(Join-Path $env:USERPROFILE '.uking\\runtime\\node'); Get-CimInstance Win32_Process | Where-Object { $_.ExecutablePath -and $_.ExecutablePath.StartsWith($nodeRoot,[StringComparison]::OrdinalIgnoreCase) } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }; exit 0\""
        },
        {
          "type": "run",
          "label": "清除 npm 全局代理配置（客户机代理常把 npm 拦死）",
          "cmd": "call npm config delete proxy --location=global & call npm config delete https-proxy --location=global & call npm config delete proxy & call npm config delete https-proxy & (exit /b 0)"
        },
        {
          "type": "run",
          "label": "清理 npm 缓存",
          "cmd": "npm cache clean --force"
        },
        {
          "type": "npm_install",
          "label": "强制重装 OpenClaw",
          "package": "openclaw",
          "force": true
        }
      ],
      "min_free_mb": 500
    },
    "hermes": {
      "name": "Hermes Agent",
      "bin": "hermes",
      "verify_cmd": "hermes --version",
      "steps": [
        {
          "type": "ensure_python",
          "label": "检查 Python 运行时（缺失则自动装便携版）"
        },
        {
          "type": "pip_install",
          "label": "安装 Hermes（pip 阿里源，绕开官方 git 安装）",
          "package": "hermes-agent[web]"
        }
      ],
      "repair": [
        {
          "type": "run",
          "label": "清理损坏的便携 Python 目录（修解压中断 / Truncated tar archive）",
          "cmd": "powershell -NoProfile -NonInteractive -Command \"$p=Join-Path $env:USERPROFILE '.uking\\runtime\\python'; Remove-Item -LiteralPath $p -Recurse -Force -ErrorAction SilentlyContinue; exit 0\""
        },
        {
          "type": "ensure_python",
          "label": "重新下载并解压便携 Python"
        },
        {
          "type": "run",
          "label": "清理 pip 缓存（避免坏 wheel / 半包复用）",
          "cmd": "python -m pip cache purge || exit /b 0"
        },
        {
          "type": "pip_install",
          "label": "强制重装 Hermes",
          "package": "hermes-agent[web]",
          "force": true
        }
      ],
      "min_free_mb": 700
    }
  }
}
