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.
5.7 KiB
5.7 KiB
read_when, summary, title, x-i18n
| read_when | summary | title | x-i18n | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
用于智能体的相机捕获(iOS 节点 + macOS 应用):照片(jpg)和短视频片段(mp4) | 相机捕获 |
|
相机捕获(智能体)
HanzoBot 支持用于智能体工作流的相机捕获:
- iOS 节点(通过 Gateway 网关配对):通过
node.invoke捕获照片(jpg)或短视频片段(mp4,可选音频)。 - Android 节点(通过 Gateway 网关配对):通过
node.invoke捕获照片(jpg)或短视频片段(mp4,可选音频)。 - macOS 应用(通过 Gateway 网关的节点):通过
node.invoke捕获照片(jpg)或短视频片段(mp4,可选音频)。
所有相机访问都受用户控制的设置限制。
iOS 节点
用户设置(默认开启)
- iOS 设置标签页 → 相机 → 允许相机(
camera.enabled)- 默认:开启(缺少键时视为启用)。
- 关闭时:
camera.*命令返回CAMERA_DISABLED。
命令(通过 Gateway 网关 node.invoke)
-
camera.list- 响应载荷:
devices:{ id, name, position, deviceType }数组
- 响应载荷:
-
camera.snap- 参数:
facing:front|back(默认:front)maxWidth:数字(可选;iOS 节点默认1600)quality:0..1(可选;默认0.9)format:当前为jpgdelayMs:数字(可选;默认0)deviceId:字符串(可选;来自camera.list)
- 响应载荷:
format: "jpg"base64: "<...>"width、height
- 载荷保护:照片会重新压缩以保持 base64 载荷小于 5 MB。
- 参数:
-
camera.clip- 参数:
facing:front|back(默认:front)durationMs:数字(默认3000,上限60000)includeAudio:布尔值(默认true)format:当前为mp4deviceId:字符串(可选;来自camera.list)
- 响应载荷:
format: "mp4"base64: "<...>"durationMshasAudio
- 参数:
前台要求
与 canvas.* 类似,iOS 节点仅允许在前台执行 camera.* 命令。后台调用返回 NODE_BACKGROUND_UNAVAILABLE。
CLI 辅助工具(临时文件 + MEDIA)
获取附件最简单的方法是通过 CLI 辅助工具,它将解码的媒体写入临时文件并打印 MEDIA:<path>。
示例:
hanzo-bot nodes camera snap --node <id> # default: both front + back (2 MEDIA lines)
hanzo-bot nodes camera snap --node <id> --facing front
hanzo-bot nodes camera clip --node <id> --duration 3000
hanzo-bot nodes camera clip --node <id> --no-audio
注意事项:
nodes camera snap默认拍摄两个方向以给智能体提供两个视角。- 输出文件是临时的(在操作系统临时目录中),除非你构建自己的包装器。
Android 节点
用户设置(默认开启)
- Android 设置页 → 相机 → 允许相机(
camera.enabled)- 默认:开启(缺少键时视为启用)。
- 关闭时:
camera.*命令返回CAMERA_DISABLED。
权限
- Android 需要运行时权限:
CAMERA用于camera.snap和camera.clip。RECORD_AUDIO用于includeAudio=true时的camera.clip。
如果缺少权限,应用会在可能时提示;如果被拒绝,camera.* 请求会失败并返回 *_PERMISSION_REQUIRED 错误。
前台要求
与 canvas.* 类似,Android 节点仅允许在前台执行 camera.* 命令。后台调用返回 NODE_BACKGROUND_UNAVAILABLE。
载荷保护
照片会重新压缩以保持 base64 载荷小于 5 MB。
macOS 应用
用户设置(默认关闭)
macOS 配套应用暴露一个复选框:
- 设置 → 通用 → 允许相机(
hanzo-bot.cameraEnabled)- 默认:关闭
- 关闭时:相机请求返回"用户已禁用相机"。
CLI 辅助工具(节点调用)
使用主 hanzo-bot CLI 在 macOS 节点上调用相机命令。
示例:
hanzo-bot nodes camera list --node <id> # list camera ids
hanzo-bot nodes camera snap --node <id> # prints MEDIA:<path>
hanzo-bot nodes camera snap --node <id> --max-width 1280
hanzo-bot nodes camera snap --node <id> --delay-ms 2000
hanzo-bot nodes camera snap --node <id> --device-id <id>
hanzo-bot nodes camera clip --node <id> --duration 10s # prints MEDIA:<path>
hanzo-bot nodes camera clip --node <id> --duration-ms 3000 # prints MEDIA:<path> (legacy flag)
hanzo-bot nodes camera clip --node <id> --device-id <id>
hanzo-bot nodes camera clip --node <id> --no-audio
注意事项:
hanzo-bot nodes camera snap默认maxWidth=1600,除非被覆盖。- 在 macOS 上,
camera.snap在预热/曝光稳定后等待delayMs(默认 2000ms)再捕获。 - 照片载荷会重新压缩以保持 base64 小于 5 MB。
安全性 + 实际限制
- 相机和麦克风访问会触发通常的操作系统权限提示(并需要 Info.plist 中的使用说明字符串)。
- 视频片段有上限(当前
<= 60s)以避免过大的节点载荷(base64 开销 + 消息限制)。
macOS 屏幕视频(操作系统级别)
对于屏幕视频(非相机),使用 macOS 配套应用:
hanzo-bot nodes screen record --node <id> --duration 10s --fps 15 # prints MEDIA:<path>
注意事项:
- 需要 macOS 屏幕录制权限(TCC)。