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

5.8 KiB
Raw Permalink Blame History

read_when, summary, title, x-i18n
read_when summary title x-i18n
你希望 HanzoBot 通过 Nostr 接收私信
你正在设置去中心化消息
通过 NIP-04 加密消息的 Nostr 私信渠道 Nostr
generated_at model provider source_hash source_path workflow
2026-02-03T07:44:13Z claude-opus-4-5 pi 6b9fe4c74bf5e7c0f59bbaa129ec5270fd29a248551a8a9a7dde6cff8fb46111 channels/nostr.md 15

Nostr

状态: 可选插件(默认禁用)。

Nostr 是一个去中心化的社交网络协议。此渠道使 HanzoBot 能够通过 NIP-04 接收和回复加密私信(DMs)。

安装(按需)

新手引导(推荐)

  • 新手引导向导(hanzo-bot onboard)和 hanzo-bot channels add 会列出可选的渠道插件。
  • 选择 Nostr 会提示你按需安装插件。

安装默认值:

  • Dev 渠道 + git checkout 可用: 使用本地插件路径。
  • Stable/Beta: 从 npm 下载。

你可以随时在提示中覆盖选择。

手动安装

hanzo-bot plugins install @hanzo/bot-nostr

使用本地 checkout(开发工作流):

hanzo-bot plugins install --link <path-to-hanzo-bot>/extensions/nostr

安装或启用插件后重启 Gateway 网关。

快速设置

  1. 生成 Nostr 密钥对(如需要):
# 使用 nak
nak key generate
  1. 添加到配置:
{
  "channels": {
    "nostr": {
      "privateKey": "${NOSTR_PRIVATE_KEY}"
    }
  }
}
  1. 导出密钥:
export NOSTR_PRIVATE_KEY="nsec1..."
  1. 重启 Gateway 网关。

配置参考

键 类型 默认值 描述
privateKey string 必填 nsec 或十六进制格式的私钥
relays string[] ['wss://relay.damus.io', 'wss://nos.lol'] 中继 URL(WebSocket)
dmPolicy string pairing 私信访问策略
allowFrom string[] [] 允许的发送者公钥
enabled boolean true 启用/禁用渠道
name string - 显示名称
profile object - NIP-01 个人资料元数据

个人资料元数据

个人资料数据作为 NIP-01 kind:0 事件发布。你可以从控制界面(Channels -> Nostr -> Profile)管理它,或直接在配置中设置。

示例:

{
  "channels": {
    "nostr": {
      "privateKey": "${NOSTR_PRIVATE_KEY}",
      "profile": {
        "name": "hanzo-bot",
        "displayName": "HanzoBot",
        "about": "Personal assistant DM bot",
        "picture": "https://example.com/avatar.png",
        "banner": "https://example.com/banner.png",
        "website": "https://example.com",
        "nip05": "[email protected]",
        "lud16": "[email protected]"
      }
    }
  }
}

注意事项:

  • 个人资料 URL 必须使用 https://。
  • 从中继导入会合并字段并保留本地覆盖。

访问控制

私信策略

  • pairing(默认):未知发送者会收到配对码。
  • allowlist:只有 allowFrom 中的公钥可以发送私信。
  • open:公开接收私信(需要 allowFrom: ["*"])。
  • disabled:忽略接收的私信。

允许列表示例

{
  "channels": {
    "nostr": {
      "privateKey": "${NOSTR_PRIVATE_KEY}",
      "dmPolicy": "allowlist",
      "allowFrom": ["npub1abc...", "npub1xyz..."]
    }
  }
}

密钥格式

接受的格式:

  • 私钥: nsec... 或 64 字符十六进制
  • 公钥(allowFrom): npub... 或十六进制

中继

默认值:relay.damus.io 和 nos.lol。

{
  "channels": {
    "nostr": {
      "privateKey": "${NOSTR_PRIVATE_KEY}",
      "relays": ["wss://relay.damus.io", "wss://relay.primal.net", "wss://nostr.wine"]
    }
  }
}

提示:

  • 使用 2-3 个中继以实现冗余。
  • 避免使用过多中继(延迟、重复)。
  • 付费中继可以提高可靠性。
  • 本地中继适合测试(ws://localhost:7777)。

协议支持

NIP 状态 描述
NIP-01 已支持 基本事件格式 + 个人资料元数据
NIP-04 已支持 加密私信(kind:4)
NIP-17 计划中 礼物包装私信
NIP-44 计划中 版本化加密

测试

本地中继

# 启动 strfry
docker run -p 7777:7777 ghcr.io/hoytech/strfry
{
  "channels": {
    "nostr": {
      "privateKey": "${NOSTR_PRIVATE_KEY}",
      "relays": ["ws://localhost:7777"]
    }
  }
}

手动测试

  1. 从日志中记下机器人公钥(npub)。
  2. 打开 Nostr 客户端(Damus、Amethyst 等)。
  3. 向机器人公钥发送私信。
  4. 验证响应。

故障排除

未收到消息

  • 验证私钥是否有效。
  • 确保中继 URL 可访问并使用 wss://(本地使用 ws://)。
  • 确认 enabled 不是 false。
  • 检查 Gateway 网关日志中的中继连接错误。

未发送响应

  • 检查中继是否接受写入。
  • 验证出站连接。
  • 注意中继速率限制。

重复响应

  • 使用多个中继时属于正常现象。
  • 消息按事件 ID 去重;只有首次投递会触发响应。

安全

  • 切勿提交私钥。
  • 使用环境变量存储密钥。
  • 生产环境机器人考虑使用 allowlist。

限制(MVP)

  • 仅支持私信(不支持群聊)。
  • 不支持媒体附件。
  • 仅支持 NIP-04(计划支持 NIP-17 礼物包装)。