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.8 KiB
Raw Permalink Blame History

read_when, summary, title, x-i18n
read_when summary title x-i18n
实现 macOS Canvas 面板
为可视化工作区添加智能体控制
调试 WKWebView canvas 加载
通过 WKWebView + 自定义 URL 方案嵌入的智能体控制 Canvas 面板 Canvas
generated_at model provider source_hash source_path workflow
2026-02-03T07:52:39Z claude-opus-4-5 pi e39caa21542e839d9f59ad0bf7ecefb379225ed7e8f00cd59131d188f193bec6 platforms/mac/canvas.md 15

Canvas(macOS 应用)

macOS 应用使用 WKWebView 嵌入一个智能体控制的 Canvas 面板。它是一个用于 HTML/CSS/JS、A2UI 和小型交互式界面的轻量级可视化工作区。

Canvas 存储位置

Canvas 状态存储在 Application Support 下:

  • ~/Library/Application Support/HanzoBot/canvas/<session>/...

Canvas 面板通过自定义 URL 方案提供这些文件:

  • hanzo-bot-canvas://<session>/<path>

示例:

  • hanzo-bot-canvas://main/ → <canvasRoot>/main/index.html
  • hanzo-bot-canvas://main/assets/app.css → <canvasRoot>/main/assets/app.css
  • hanzo-bot-canvas://main/widgets/todo/ → <canvasRoot>/main/widgets/todo/index.html

如果根目录下没有 index.html,应用会显示一个内置脚手架页面。

面板行为

  • 无边框、可调整大小的面板,锚定在菜单栏(或鼠标光标)附近。
  • 记住每个会话的大小/位置。
  • 当本地 canvas 文件更改时自动重新加载。
  • 一次只显示一个 Canvas 面板(根据需要切换会话)。

可以从设置 → 允许 Canvas 禁用 Canvas。禁用时,canvas 节点命令返回 CANVAS_DISABLED。

智能体 API 接口

Canvas 通过 Gateway 网关 WebSocket 暴露,因此智能体可以:

  • 显示/隐藏面板
  • 导航到路径或 URL
  • 执行 JavaScript
  • 捕获快照图像

CLI 示例:

hanzo-bot nodes canvas present --node <id>
hanzo-bot nodes canvas navigate --node <id> --url "/"
hanzo-bot nodes canvas eval --node <id> --js "document.title"
hanzo-bot nodes canvas snapshot --node <id>

注意事项:

  • canvas.navigate 接受本地 canvas 路径、http(s) URL 和 file:// URL。
  • 如果传递 "/",Canvas 会显示本地脚手架或 index.html。

Canvas 中的 A2UI

A2UI 由 Gateway 网关 canvas 主机托管并在 Canvas 面板内渲染。 当 Gateway 网关广播 Canvas 主机时,macOS 应用在首次打开时自动导航到 A2UI 主机页面。

默认 A2UI 主机 URL:

http://<gateway-host>:18793/__bot__/a2ui/

A2UI 命令(v0.8)

Canvas 目前接受 A2UI v0.8 服务器→客户端消息:

  • beginRendering
  • surfaceUpdate
  • dataModelUpdate
  • deleteSurface

createSurface(v0.9)不受支持。

CLI 示例:

cat > /tmp/a2ui-v0.8.jsonl <<'EOFA2'
{"surfaceUpdate":{"surfaceId":"main","components":[{"id":"root","component":{"Column":{"children":{"explicitList":["title","content"]}}}},{"id":"title","component":{"Text":{"text":{"literalString":"Canvas (A2UI v0.8)"},"usageHint":"h1"}}},{"id":"content","component":{"Text":{"text":{"literalString":"If you can read this, A2UI push works."},"usageHint":"body"}}}]}}
{"beginRendering":{"surfaceId":"main","root":"root"}}
EOFA2

hanzo-bot nodes canvas a2ui push --jsonl /tmp/a2ui-v0.8.jsonl --node <id>

快速测试:

hanzo-bot nodes canvas a2ui push --node <id> --text "Hello from A2UI"

从 Canvas 触发智能体运行

Canvas 可以通过深层链接触发新的智能体运行:

  • hanzo-bot://agent?...

示例(在 JS 中):

window.location.href = "hanzo-bot://agent?message=Review%20this%20design";

除非提供有效密钥,否则应用会提示确认。

安全注意事项

  • Canvas 方案阻止目录遍历;文件必须位于会话根目录下。
  • 本地 Canvas 内容使用自定义方案(不需要 loopback 服务器)。
  • 仅在显式导航时允许外部 http(s) URL。