Files
bot/docs/platforms/mac/canvas.md
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.6 KiB
Raw Permalink Blame History

summary, read_when, title
summary read_when title
Agent-controlled Canvas panel embedded via WKWebView + custom URL scheme
Implementing the macOS Canvas panel
Adding agent controls for visual workspace
Debugging WKWebView canvas loads
Canvas

Canvas (macOS app)

The macOS app embeds an agent‑controlled Canvas panel using WKWebView. It is a lightweight visual workspace for HTML/CSS/JS, A2UI, and small interactive UI surfaces.

Where Canvas lives

Canvas state is stored under Application Support:

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

The Canvas panel serves those files via a custom URL scheme:

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

Examples:

  • 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

If no index.html exists at the root, the app shows a built‑in scaffold page.

Panel behavior

  • Borderless, resizable panel anchored near the menu bar (or mouse cursor).
  • Remembers size/position per session.
  • Auto‑reloads when local canvas files change.
  • Only one Canvas panel is visible at a time (session is switched as needed).

Canvas can be disabled from Settings → Allow Canvas. When disabled, canvas node commands return CANVAS_DISABLED.

Agent API surface

Canvas is exposed via the Gateway WebSocket, so the agent can:

  • show/hide the panel
  • navigate to a path or URL
  • evaluate JavaScript
  • capture a snapshot image

CLI examples:

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>

Notes:

  • canvas.navigate accepts local canvas paths, http(s) URLs, and file:// URLs.
  • If you pass "/", the Canvas shows the local scaffold or index.html.

A2UI in Canvas

A2UI is hosted by the Gateway canvas host and rendered inside the Canvas panel. When the Gateway advertises a Canvas host, the macOS app auto‑navigates to the A2UI host page on first open.

Default A2UI host URL:

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

A2UI commands (v0.8)

Canvas currently accepts A2UI v0.8 server→client messages:

  • beginRendering
  • surfaceUpdate
  • dataModelUpdate
  • deleteSurface

createSurface (v0.9) is not supported.

CLI example:

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>

Quick smoke:

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

Triggering agent runs from Canvas

Canvas can trigger new agent runs via deep links:

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

Example (in JS):

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

The app prompts for confirmation unless a valid key is provided.

Security notes

  • Canvas scheme blocks directory traversal; files must live under the session root.
  • Local Canvas content uses a custom scheme (no loopback server required).
  • External http(s) URLs are allowed only when explicitly navigated.