Files
zeekay acaeda400a Eradicate OpenClaw — resolve merge conflicts and finish the rebrand
Three coordinated things:

1. Resolve the committed upstream/main merge conflicts. 94 files were
   sitting with raw <<<<<<< HEAD ... >>>>>>> upstream/main blocks. Every
   conflict had HanzoBot/Bot on HEAD and OpenClaw on upstream. Resolved
   by keeping HEAD everywhere — 540 conflict blocks.

2. Rewrite remaining OpenClaw text refs.
     OPENCLAW   → HANZO_BOT
     OpenClaw   → HanzoBot          (PascalCase type identifiers)
     openclaw   → bot               (codebase convention — botToken,
                                    botUsername etc.; avoids invalid
                                    hyphenated JS identifiers)
     openclaw[_]/openclaw[A-Z] → bot[_]/bot[A-Z]   (compound)
     ai.openclaw.x → ai.hanzo.bot.x  (JVM package path)

3. Delete or rename openclaw-named file paths (116 of them). Dead
   duplicates with a Bot-named canonical from the partial migration:
   deleted. Otherwise renamed.
     ai/openclaw/**           → deleted (ai/hanzo/bot/** canonical)
     Sources/OpenClaw*/       → deleted (Sources/Bot* canonical)
     Tests/OpenClawIPCTests/  → deleted (Tests/BotIPCTests canonical)
     OpenClawKit/             → deleted (BotKit canonical)
     openclaw-tools.*.ts      → deleted (bot-tools.*.ts canonical)
     openclaw-root.ts etc.    → deleted (bot-root.ts canonical)
     types.openclaw.ts        → deleted (types.bot.ts canonical)
     extensions/*/openclaw.plugin.json → renamed hanzo-bot.plugin.json
     docs/start/openclaw.md   → renamed hanzo-bot.md (+ zh-CN)
     docs/assets/openclaw-*.png, whatsapp-openclaw*.jpg → deleted
     scripts/.../openclaw-*   → deleted (bot/hanzo-bot parallels)
     openclaw.mjs             → deleted (hanzo-bot.mjs is package.bin)

Then patched 65 broken JS/TS import strings where hanzo-bot had ended
up inside an import path ('./types.hanzo-bot.js' → './types.bot.js'
etc., since the on-disk filename uses the brand-neutral bot- prefix).

Pre-existing lint debt cleaned up to get oxlint --type-aware to 0/0:
removed the dead i18n test that referenced a path no longer existing;
defined the missing DIDConfig and WalletConfig types in types.base.ts
(they were imported but never declared); dropped unused imports;
collapsed redundant type assertion and a tautological meta.bot lookup
that the openclaw→bot rename made redundant.

The a2ui.bundle.js generated artifact is kept at its pre-rebrand
contents — it gets regenerated by 'pnpm canvas:a2ui:bundle' from
sources I cannot rebuild in this commit; the source side is clean.

Verified: 0 occurrences of openclaw (case-insensitive) in tree source
content, 0 file or directory paths with openclaw in the name; oxlint
--type-aware src test reports 0/0.
2026-05-11 17:56:29 -07:00

3.0 KiB
Raw Permalink Blame History

read_when, summary, title, x-i18n
read_when summary title x-i18n
调试仅限 Node 的开发脚本或 watch 模式失败
排查 HanzoBot 中 tsx/esbuild 加载器崩溃问题
Node + tsx "__name is not a function" 崩溃说明及解决方法 Node + tsx 崩溃
generated_at model provider source_hash source_path workflow
2026-02-01T20:24:52Z claude-opus-4-5 pi f9e9bd2281508337a0696126b0db2d47a2d0f56de7a11872fbc0ac4689f9ad41 debug/node-issue.md 14

Node + tsx "__name is not a function" 崩溃

概述

通过 Node 使用 tsx 运行 HanzoBot 时,启动阶段报错:

[hanzo-bot] Failed to start CLI: TypeError: __name is not a function
    at createSubsystemLogger (.../src/logging/subsystem.ts:203:25)
    at .../src/agents/auth-profiles/constants.ts:25:20

此问题在开发脚本从 Bun 切换到 tsx 后出现(提交 2871657e,2026-01-06)。相同的运行路径在 Bun 下正常工作。

环境

  • Node: v25.x(在 v25.3.0 上观察到)
  • tsx: 4.21.0
  • 操作系统: macOS(其他运行 Node 25 的平台也可能复现)

复现步骤(仅 Node)

# 在仓库根目录
node --version
pnpm install
node --import tsx src/entry.ts status

仓库内最小复现

node --import tsx scripts/repro/tsx-name-repro.ts

Node 版本检查

  • Node 25.3.0:失败
  • Node 22.22.0(Homebrew node@22):失败
  • Node 24:尚未安装,需要验证

说明 / 假设

  • tsx 使用 esbuild 转换 TS/ESM。esbuild 的 keepNames 会生成一个 __name 辅助函数,并用 __name(...) 包裹函数定义。
  • 崩溃表明 __name 存在但在运行时不是函数,这意味着在 Node 25 的加载器路径中该辅助函数缺失或被覆盖。
  • 其他 esbuild 使用者也报告过类似的 __name 辅助函数缺失或被重写的问题。

回归历史

  • 2871657e(2026-01-06):脚本从 Bun 改为 tsx,使 Bun 成为可选项。
  • 在此之前(Bun 路径),hanzo-bot status 和 gateway:watch 均正常工作。

解决方法

  • 开发脚本使用 Bun(当前临时回退方案)。
  • 使用 Node + tsc watch,然后运行编译产物:
    pnpm exec tsc --watch --preserveWatchOutput
    node --watch hanzo-bot.mjs status
    
  • 已在本地确认:pnpm exec tsc -p tsconfig.json + node hanzo-bot.mjs status 在 Node 25 上可正常运行。
  • 如果可能,在 TS 加载器中禁用 esbuild 的 keepNames(防止插入 __name 辅助函数);tsx 目前不提供此配置项。
  • 在 Node LTS(22/24)上测试 tsx,确认该问题是否为 Node 25 特有。

参考资料

后续步骤

  • 在 Node 22/24 上复现,确认是否为 Node 25 回归问题。
  • 测试 tsx nightly 版本,或在存在已知回归时固定到早期版本。
  • 如果在 Node LTS 上也能复现,则向上游提交包含 __name 堆栈跟踪的最小复现。