mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
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.
3.0 KiB
3.0 KiB
read_when, summary, title, x-i18n
| read_when | summary | title | x-i18n | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
HanzoBot 应用的 macOS IPC 架构、Gateway 网关节点传输和 PeekabooBridge | macOS IPC |
|
HanzoBot macOS IPC 架构
当前模型: 一个本地 Unix 套接字将节点主机服务连接到 macOS 应用,用于 exec 审批 + system.run。存在一个 hanzo-bot-mac 调试 CLI 用于发现/连接检查;智能体操作仍通过 Gateway 网关 WebSocket 和 node.invoke 流转。UI 自动化使用 PeekabooBridge。
目标
- 单个 GUI 应用实例拥有所有面向 TCC 的工作(通知、屏幕录制、麦克风、语音、AppleScript)。
- 小型自动化接口:Gateway 网关 + 节点命令,加上用于 UI 自动化的 PeekabooBridge。
- 可预测的权限:始终是同一个签名的 bundle ID,由 launchd 启动,因此 TCC 授权保持有效。
工作原理
Gateway 网关 + 节点传输
- 应用运行 Gateway 网关(本地模式)并作为节点连接到它。
- 智能体操作通过
node.invoke执行(例如system.run、system.notify、canvas.*)。
节点服务 + 应用 IPC
- 一个无头节点主机服务连接到 Gateway 网关 WebSocket。
system.run请求通过本地 Unix 套接字转发到 macOS 应用。- 应用在 UI 上下文中执行 exec,必要时提示,并返回输出。
图示(SCI):
Agent -> Gateway -> Node Service (WS)
| IPC (UDS + token + HMAC + TTL)
v
Mac App (UI + TCC + system.run)
PeekabooBridge(UI 自动化)
- UI 自动化使用名为
bridge.sock的单独 UNIX 套接字和 PeekabooBridge JSON 协议。 - 主机优先顺序(客户端侧):Peekaboo.app → Claude.app → HanzoBot.app → 本地执行。
- 安全性:桥接主机需要允许的 TeamID;仅 DEBUG 的同 UID 逃逸通道由
PEEKABOO_ALLOW_UNSIGNED_SOCKET_CLIENTS=1保护(Peekaboo 约定)。 - 参见:PeekabooBridge 用法了解详情。
操作流程
- 重启/重建:
SIGN_IDENTITY="Apple Development: <Developer Name> (<TEAMID>)" scripts/restart-mac.sh- 终止现有实例
- Swift 构建 + 打包
- 写入/引导/启动 LaunchAgent
- 单实例:如果具有相同 bundle ID 的另一个实例正在运行,应用会提前退出。
加固注意事项
- 优先要求所有特权接口的 TeamID 匹配。
- PeekabooBridge:
PEEKABOO_ALLOW_UNSIGNED_SOCKET_CLIENTS=1(仅 DEBUG)可能允许同 UID 调用者用于本地开发。 - 所有通信仅保持本地;不暴露网络套接字。
- TCC 提示仅源自 GUI 应用包;在重建时保持签名的 bundle ID 稳定。
- IPC 加固:套接字模式
0600、令牌、对等 UID 检查、HMAC 质询/响应、短 TTL。