按 U-Claw-海外化改造方案.md 与 范围决策记录.md 实施。这是 fork,不回上游: 海外版删掉的正是上游的中国市场默认值。 阶段 0 地基 - 下载源全部改国际:脚本/CI 61 处 + lockfile 880 条 npmmirror URL 归零 (lockfile 那 880 条是 npm 的 resolved 字段,脚本层参数化根本绕不过它) - 移除 install.ps1 里三个第三方 GitHub 加速代理,bundle 改直连 + SHA256 校验 (原来只检查"文件大于 1MB"就解压运行) - 技能内容与分发分离:skills/manifest.json 单一来源,install.sh 1170→658 行、 install.ps1 721→546 行,两者技能内容归零 实测原来是三份不一致:skills-cn 完整、install.sh 约 40%、install.ps1 约 17%, 且 7 个通用技能只有 U 盘版有 —— 一键安装的用户一个能用的技能都没有 - Node 版本三种(v22.14/16/22.1)统一,新建 NODE_VERSION 单一来源 - Config 页三份合一。portable/Config.html 用根相对路径调 API 却只从 file:// 打开, 保存功能已静默失效两个月;现缩为 120 行重定向壳 - 测试接入 CI(此前 node --test 无人运行,所有断言形同虚设) 阶段 1 双语可用 - 浏览器侧 i18n:JSON 为源、生成经典 script(file:// 下 fetch 本地 JSON 被拦) 语言跟盘走不跟机器走:启动器写 data/.openclaw/locale.js - 8 处硬编码 lang="zh-CN" 归零,data-i18n 覆盖 213 处,词条 en/zh 各 279 条 - B3 单框 Key:12 张模型卡 → 一个输入框,前缀识别 provider, 服务端 /api/test-key 发 1-token 请求实测,错误映射成人话 Key 填错到得知:从"直到对话失败"降到 ≤1 秒 - 区域格式 SG:DD/MM/YYYY、12 小时、S$、Asia/Singapore (ICU 在 en-SG 下把 SGD 渲染成裸 $,与美元无法区分,故自行拼 S$) - README 内容分叉而非翻译,§1.3 证据清单逐条清零 阶段 2 降门槛 - 启动逻辑上移 lib/start.mjs:Windows-Start.bat 220→28 行、 Mac-Start.command 235→33 行 修掉 Mac 侧两个 bug:控制台端口硬编码 18788(回落时打开死页)、 微信插件从未在 Mac 上安装 - U 盘根目录 23 → 3 个可点文件,其余进 advanced/ - 首启向导:语言 → 用途(7 角色,manifest 驱动)→ 密钥,答过不再问 - 三档界面,Simple 档隐藏一切技术名词 - 自动自愈:启动失败先自查自修,修不好导出脱敏诊断包 (Doctor 从"用户要知道去点的工具"变成后台机制) 阶段 3 技能库 - 19 个英文技能,planned 归零。sg-weather / sg-transport 的端点均实测过 - SkillHub 从 56 张手写第三方卡片改为 manifest 生成:703→125 行,中文归零 其他 - origin.json 收拢所有运行时地址,tests/origin.test.mjs 保证迁移不会漏 - portable/ 下用户可见中文归零(由断言保证) - 82 项测试 未验证(本机无 Windows / 无 pwsh): - install.ps1、setup.ps1 约 210 行改动从未经 PowerShell 解析器 - 完整启动路径仅在假 node + 假 openclaw 上冒烟 - 8 个 .bat 的盘根推导仅静态断言 详见 U盘实测清单.md 受阻: - 隐藏黑窗口 —— 需代码签名证书(.vbs 已被 Windows 弃用,替代方案都要签名) - 场景卡 —— OpenClaw 上游 Dashboard 无预填 prompt 接口 - 官网 36 条 —— 上游 2026-04-14 拆到私有仓库,无权限
This commit is contained in:
64
CLAUDE.md
64
CLAUDE.md
@@ -29,14 +29,14 @@ Distribution forms:
|
||||
|
||||
```bash
|
||||
# Portable version — build dev copy
|
||||
cd portable && bash setup.sh # Downloads Node.js v22 + OpenClaw + WeChat/QQ plugin to app/
|
||||
bash Mac-Start.command # Launch (Mac ARM64). Windows: Windows-Start.bat
|
||||
cd portable/advanced && bash setup.sh # Downloads Node.js v22 + OpenClaw + plugins into ../app/
|
||||
cd .. && bash "START HERE - Mac.command" # Launch (Mac). Windows: double-click "START HERE - Windows.bat"
|
||||
|
||||
# Copy to USB drive
|
||||
cp -R portable/ /Volumes/YOUR_USB/U-Claw/
|
||||
|
||||
# Electron desktop app
|
||||
cd u-claw-app && bash setup.sh # One-click: Node.js + Electron + deps (China mirrors)
|
||||
cd u-claw-app && bash setup.sh # One-click: Node.js + Electron + deps
|
||||
npm run dev # Dev mode
|
||||
npm run build:mac-arm64 # Build Mac ARM64 DMG
|
||||
npm run build:win # Build Windows NSIS + portable
|
||||
@@ -44,7 +44,7 @@ npm run build:win # Build Windows NSIS + portable
|
||||
# Bootable Linux USB (run on Windows PowerShell as Admin)
|
||||
cd bootable
|
||||
.\1-prepare-usb.ps1 # Write Ventoy to USB (formats drive!)
|
||||
.\2-download-iso.ps1 # Download Ubuntu ISO (~5.8GB, China mirrors)
|
||||
.\2-download-iso.ps1 # Download Ubuntu ISO (~5.8GB)
|
||||
.\3-create-persistence.ps1 # Create 20GB ext4 persistence image
|
||||
.\4-copy-to-usb.ps1 # Copy ISO + persistence + scripts to USB
|
||||
```
|
||||
@@ -56,11 +56,14 @@ node --test tests/ # Run all tests (node:test, no test framework de
|
||||
node --test tests/windows-launchers.test.mjs # Run one test file
|
||||
```
|
||||
|
||||
Tests assert on the **text/behavior of the launcher scripts** (`.bat`/`.command`) — e.g. that
|
||||
`Windows-Start.bat` escapes `^(...^)` parens inside IF blocks and disables OpenClaw bonjour
|
||||
discovery. They read repo files as strings; they do **not** spawn OpenClaw. There is no root
|
||||
`package.json` — tests are not run by the release CI (`.github/workflows/release.yml` only
|
||||
builds and publishes). Run them locally before pushing launcher changes.
|
||||
Tests assert on the **text/behavior of the launchers and shared `.mjs` helpers** — e.g. that the
|
||||
Start launchers stay thin shells over `lib/start.mjs`, that `.bat` files are pure ASCII with CRLF,
|
||||
that no China-routed download source comes back, that the two installers resolve skills the same
|
||||
way, and that every message key exists in every catalogue. They read repo files as strings; they
|
||||
do **not** spawn OpenClaw. There is no root
|
||||
`package.json`. **As of 2026-08-17 tests do run in CI** — `.github/workflows/tests.yml` runs
|
||||
`node --test tests/` on every push and PR. Before that they were local-only, so the guards they
|
||||
encode could regress unnoticed.
|
||||
|
||||
**CI workflows** (`.github/workflows/`): `release.yml` builds Win/Mac portable + desktop and
|
||||
publishes a GitHub Release on tag push. `track-upstream.yml` runs daily (cron) — checks
|
||||
@@ -83,16 +86,24 @@ portable/ THE USB content (= repo + setup.sh downloads)
|
||||
{Mac,Windows}-Install — copy USB → computer (~/.uclaw/ or %USERPROFILE%)
|
||||
{Mac,Windows}-Diagnose — health check / collect logs for bug reports
|
||||
{Mac-OpenClaw-CLI,OpenClaw-CLI.bat} — drop into raw `openclaw` CLI
|
||||
*.html (Welcome, Config, U-Claw, SkillHub) — local UI pages
|
||||
*.html (Welcome, U-Claw, SkillHub) — local UI pages
|
||||
Config.html — redirect shim only; the settings UI itself is
|
||||
config-server/public/index.html (single implementation since 2026-08-17).
|
||||
The old standalone copy called the API on a root-relative path, which
|
||||
cannot work from file:// — Save failed silently for anyone who opened it.
|
||||
config-server/server.js — local HTTP server (port 18788-18798) backing
|
||||
Config.html: writes openclaw.json, WeChat QR login, update-status API
|
||||
lib/ — Node helpers (see "lib/ helpers" below)
|
||||
default-config.json — seed config copied to data/.openclaw/ on first run
|
||||
app/core/ (OpenClaw) + app/runtime/ (Node.js) — downloaded by setup.sh
|
||||
data/.openclaw/openclaw.json — user config (on USB, portable)
|
||||
skills-cn/ — 17 个中国本地化技能(小红书/微博/B站/抖音/知乎/
|
||||
微信公众号/Word/Excel/PPT/天气/搜索/翻译/DeepSeek/
|
||||
图片压缩/PDF工具/二维码/网页转Markdown)
|
||||
skills/ Single source of truth for skill content + distribution (2026-08-17).
|
||||
manifest.json — the only thing installers read
|
||||
en/<id>/SKILL.md — content
|
||||
Replaces the old three-way split (portable/skills-cn/ on disk,
|
||||
heredocs in install.sh, here-strings in install.ps1). See skills/README.md.
|
||||
Installed by lib/install-skills.mjs; release.yml copies skills/ + the
|
||||
installer onto the drive so it can re-install offline.
|
||||
|
||||
u-claw-app/ [DEPRECATED 2026-06-19, archived — not built/published] Electron desktop app
|
||||
(main.js ~400 lines). Kept for archive only; see u-claw-app/DEPRECATED.md.
|
||||
@@ -102,24 +113,31 @@ bootable/ Linux 可启动 U 盘模块(完全独立,不依赖其他
|
||||
4 步 PowerShell 脚本 (Windows 上制作)
|
||||
Ventoy 1.0.99 + Ubuntu 24.04 LTS + casper-rw 持久化
|
||||
linux-setup/ — setup-openclaw.sh 安装到 /opt/u-claw/
|
||||
独立仓库镜像: github.com/dongsheng123132/u-claw-linux
|
||||
独立仓库镜像: gitea.fanghe.it.com/zhenghy/u-claw-linux
|
||||
|
||||
install/ 一键在线安装模块(curl | bash / irm | iex)
|
||||
install.sh (Mac/Linux) + install.ps1 (Windows)
|
||||
7 步流程: 系统检测 → Node.js → OpenClaw → QQ插件 → 技能 → 模型配置 → 启动脚本
|
||||
7 步流程: 系统检测 → Node.js → OpenClaw → QQ插件 → 技能(读 skills/manifest.json) → 模型配置 → 启动脚本
|
||||
安装到 ~/.uclaw/,与 Mac-Install.command 结果相同
|
||||
|
||||
```
|
||||
|
||||
> **Note**: 官网 (u-claw.org) 已拆分到独立私有仓库 [u-claw.org](https://github.com/dongsheng123132/u-claw.org),本仓库不再包含 website/ 和 vercel.json。
|
||||
> **虾航**: AI人导航站 (nav.u-claw.org) 在独立私有仓库 [xiahang](https://github.com/dongsheng123132/xiahang)。
|
||||
> **This is a fork.** Upstream is `github.com/dongsheng123132/u-claw`; we host at
|
||||
> `gitea.fanghe.it.com/zhenghy/u-claw` and do **not** send changes back — the overseas
|
||||
> build removes the China-market defaults that are the point of the upstream project.
|
||||
> See `origin.json` for every URL this build fetches at runtime, and the migration
|
||||
> notes in the workspace root.
|
||||
>
|
||||
> **The website is upstream's and we do not have it.** They split it out on 2026-04-14
|
||||
> (commit `65f830e`) into a private repo of their own. `guide.html` lives there, so the
|
||||
> website work in the overseas plan is blocked until we either get access or build our own.
|
||||
|
||||
Both portable and desktop versions auto-find a free port in range 18789–18799 and start the OpenClaw gateway. On first run, they detect whether a model is configured — if not, they open Config.html; otherwise, they open the dashboard.
|
||||
|
||||
## Key Technical Details
|
||||
|
||||
- **Node.js discovery**: Portable looks at `app/runtime/node-mac-arm64/bin/node`; Electron looks at `resources/runtime/node-{platform}-{arch}` then falls back to system `node`
|
||||
- **China mirrors**: All downloads use `npmmirror.com` — Node.js binaries from `npmmirror.com/mirrors/node`, npm packages from `registry.npmmirror.com`
|
||||
- **Download sources (overseas build, 2026-08-17)**: Node.js binaries from `nodejs.org/dist`, npm packages from `registry.npmjs.org`, GitHub assets direct. No China-routed mirrors or GitHub proxies remain in scripts, launchers or CI — `tests/no-china-sources.test.mjs` fails the build if any come back.
|
||||
- **`OPENCLAW_VERSION` file**: single source of truth for the bundled OpenClaw runtime version (e.g. `2026.6.8`). CI reads it to pin the npm install; it's copied into `portable/` so USB users / `check-update.mjs` can compare installed vs latest. Bump this file to upgrade.
|
||||
- **Environment variables**: `OPENCLAW_HOME`, `OPENCLAW_STATE_DIR`, `OPENCLAW_CONFIG_PATH` control where OpenClaw reads config
|
||||
- **macOS quarantine**: Mac scripts run `xattr -rd com.apple.quarantine` to remove Gatekeeper blocks
|
||||
@@ -140,7 +158,9 @@ Pure-Node, zero-dependency `.mjs` modules (use `fetch` + `node:zlib` only). All
|
||||
| `portable-cache.mjs` | **启动加速核心**:把"重 IO、可重建"的缓存从 U 盘搬到本机硬盘。算出本机缓存根(win `%LOCALAPPDATA%\U-Claw\<slot>` / mac `~/Library/Caches/U-Claw` / linux `$XDG_CACHE_HOME`,UUID 隔离让换盘符仍复用),输出 `NODE_COMPILE_CACHE` 路径,并把 `data/.openclaw/browser` 做成 junction(win)/symlink(mac) 指向本机盘——浏览器 user-data 的海量随机小写不再砸 U 盘。CLI 打印 `KEY=VALUE` 供启动脚本 source。静默失败:取不到就缓存留 U 盘照常启动。 |
|
||||
| `prewarm.mjs` | gateway 首轮预热:端口就绪后后台静默 GET `/ready`→`/status`→`/models`(带 `x-openclaw-token`),把 config/model 子系统在 runtime 内存里热起来,用户首次点发送不再等。零依赖、短超时、后台 detach。 |
|
||||
| `loading.html` | 启动首屏(splash):双击启动后立刻打开,给即时反馈消除"黑窗假死"。本页每秒 fetch `/ready`,gateway 真就绪后自动 `location.replace` 跳 Dashboard——天然规避"gateway 没起就开 Dashboard 拒连"(issue #46/#48)。端口经 `?port=` 传入。 |
|
||||
| `wait-gateway.bat` | Windows 兜底:现由 `loading.html` 首屏轮询并自动跳转;本脚本退居兜底——万一首屏 `file://` fetch 被浏览器拦,仍轮询端口、就绪后开 Dashboard。 |
|
||||
| `start.mjs` | **启动主逻辑(2026-08-17 起)**:运行时检测、数据目录、缓存加速、默认配置、依赖安装、NO_PROXY、微信插件、config-server 启动与端口发现、gateway 端口扫描、首屏与控制台打开、预热、兜底轮询、退出清理。`.bat`/`.command` 退化为 ~30 行的启动壳。这样两平台不会再漂,且所有面向用户的文案可翻译。 |
|
||||
| `i18n.mjs` + `messages/{en,zh-CN}.json` | 启动器与本地页面的词条。语言优先级:显式覆盖 > 盘内配置 `uclaw.locale` > 系统 locale > en —— **语言跟盘走,不跟机器走**。key 用语义命名,缺失自动回落英文。 |
|
||||
| ~~`wait-gateway.bat`~~ | 已移除(2026-08-17)。兜底轮询并入 `start.mjs` 的 `watchGatewayReady()`,现在 macOS 也有了 —— 此前只有 Windows 有。 |
|
||||
| `maintain.sh` | Maintenance/diagnostics script. |
|
||||
|
||||
### 启动加速(吸收自 v2 u-clawx 4.0 的工程经验,2026-06-17)
|
||||
@@ -159,7 +179,7 @@ Pure-Node, zero-dependency `.mjs` modules (use `fetch` + `node:zlib` only). All
|
||||
|
||||
### 模型配置 ("选模型填 Key")
|
||||
|
||||
Config.html 列出国内外大模型供用户挑选。首选卡片是 **虾盘云** (Xiapan Cloud 中转站,`api.u-claw.org/v1`)
|
||||
设置页(`config-server/public/index.html`,旧入口 `Config.html` 会重定向过来)列出模型供用户挑选。首选卡片是 **虾盘云** (Xiapan Cloud 中转站,`api.u-claw.org/v1`)
|
||||
——一个 Key 调用 DeepSeek / Claude / GPT / 通义 等全部模型,但和其它 provider 一样**需要用户自己去
|
||||
`https://u-claw.org/cloud.html` 注册拿 Key**,不再自动开户。其余 provider (DeepSeek/通义/Kimi/智谱/
|
||||
豆包/MiniMax/OpenAI/Claude/Groq/硅基流动/自定义) 填各家官方 Key 即可。配置只写本地
|
||||
@@ -187,14 +207,14 @@ Release artifacts go to GitHub Releases, not the repo.
|
||||
- Mac Apple Silicon (ARM64): ✅ Working
|
||||
- Mac Intel (x64): ✅ Working(portable 需先运行 setup.sh 下载 node-mac-x64)
|
||||
- Windows x64: 🚧 In development
|
||||
- Linux x64 (Bootable USB): ✅ `bootable/` 目录 + 独立仓库 [u-claw-linux](https://github.com/dongsheng123132/u-claw-linux)
|
||||
- Linux x64 (Bootable USB): ✅ `bootable/` 目录 + 独立仓库 [u-claw-linux](https://gitea.fanghe.it.com/zhenghy/u-claw-linux)
|
||||
|
||||
## Bootable Linux Key Details
|
||||
|
||||
- **制作环境**: Windows 10/11 + PowerShell (Admin),4 步脚本
|
||||
- **U 盘要求**: 32GB+ USB 3.0
|
||||
- **技术栈**: Ventoy 1.0.99 引导 → Ubuntu 24.04 ISO → casper-rw 持久化 → OpenClaw 安装到 /opt/u-claw/
|
||||
- **国内镜像**: ISO 下载走清华/阿里/中科大,Node.js 和 npm 走 npmmirror.com
|
||||
- **下载源**: ISO 走 releases.ubuntu.com,Node.js 走 nodejs.org,npm 走 registry.npmjs.org
|
||||
- **Linux 环境变量**: `OPENCLAW_HOME=/opt/u-claw/data/.openclaw`
|
||||
- **bootable/ 完全独立**: 不引用 portable/、u-claw-app/ 的任何文件,修改互不影响
|
||||
- **同步**: bootable/ 内容与 u-claw-linux 仓库保持一致,改一边要记得同步另一边
|
||||
|
||||
Reference in New Issue
Block a user