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.1 KiB
HanzoBot ACP Bridge
This document describes how the HanzoBot ACP (Agent Client Protocol) bridge works, how it maps ACP sessions to Gateway sessions, and how IDEs should invoke it.
Overview
hanzo-bot acp exposes an ACP agent over stdio and forwards prompts to a running
HanzoBot Gateway over WebSocket. It keeps ACP session ids mapped to Gateway
session keys so IDEs can reconnect to the same agent transcript or reset it on
request.
Key goals:
- Minimal ACP surface area (stdio, NDJSON).
- Stable session mapping across reconnects.
- Works with existing Gateway session store (list/resolve/reset).
- Safe defaults (isolated ACP session keys by default).
How can I use this
Use ACP when an IDE or tooling speaks Agent Client Protocol and you want it to drive a HanzoBot Gateway session.
Quick steps:
- Run a Gateway (local or remote).
- Configure the Gateway target (
gateway.remote.url+ auth) or pass flags. - Point the IDE to run
hanzo-bot acpover stdio.
Example config:
hanzo-bot config set gateway.remote.url wss://gateway-host:18789
hanzo-bot config set gateway.remote.token <token>
Example run:
hanzo-bot acp --url wss://gateway-host:18789 --token <token>
Selecting agents
ACP does not pick agents directly. It routes by the Gateway session key.
Use agent-scoped session keys to target a specific agent:
hanzo-bot acp --session agent:main:main
hanzo-bot acp --session agent:design:main
hanzo-bot acp --session agent:qa:bug-123
Each ACP session maps to a single Gateway session key. One agent can have many
sessions; ACP defaults to an isolated acp:<uuid> session unless you override
the key or label.
Zed editor setup
Add a custom ACP agent in ~/.config/zed/settings.json:
{
"agent_servers": {
"HanzoBot ACP": {
"type": "custom",
"command": "hanzo-bot",
"args": ["acp"],
"env": {}
}
}
}
To target a specific Gateway or agent:
{
"agent_servers": {
"HanzoBot ACP": {
"type": "custom",
"command": "hanzo-bot",
"args": [
"acp",
"--url",
"wss://gateway-host:18789",
"--token",
"<token>",
"--session",
"agent:design:main"
],
"env": {}
}
}
}
In Zed, open the Agent panel and select “HanzoBot ACP” to start a thread.
Execution Model
- ACP client spawns
hanzo-bot acpand speaks ACP messages over stdio. - The bridge connects to the Gateway using existing auth config (or CLI flags).
- ACP
prompttranslates to Gatewaychat.send. - Gateway streaming events are translated back into ACP streaming events.
- ACP
cancelmaps to Gatewaychat.abortfor the active run.
Session Mapping
By default each ACP session is mapped to a dedicated Gateway session key:
acp:<uuid>unless overridden.
You can override or reuse sessions in two ways:
- CLI defaults
hanzo-bot acp --session agent:main:main
hanzo-bot acp --session-label "support inbox"
hanzo-bot acp --reset-session
- ACP metadata per session
{
"_meta": {
"sessionKey": "agent:main:main",
"sessionLabel": "support inbox",
"resetSession": true,
"requireExisting": false
}
}
Rules:
sessionKey: direct Gateway session key.sessionLabel: resolve an existing session by label.resetSession: mint a new transcript for the key before first use.requireExisting: fail if the key/label does not exist.
Session Listing
ACP listSessions maps to Gateway sessions.list and returns a filtered
summary suitable for IDE session pickers. _meta.limit can cap the number of
sessions returned.
Prompt Translation
ACP prompt inputs are converted into a Gateway chat.send:
textandresourceblocks become prompt text.resource_linkwith image mime types become attachments.- The working directory can be prefixed into the prompt (default on, can be
disabled with
--no-prefix-cwd).
Gateway streaming events are translated into ACP message and tool_call
updates. Terminal Gateway states map to ACP done with stop reasons:
complete->stopaborted->cancelerror->error
Auth + Gateway Discovery
hanzo-bot acp resolves the Gateway URL and auth from CLI flags or config:
--url/--token/--passwordtake precedence.- Otherwise use configured
gateway.remote.*settings.
Operational Notes
- ACP sessions are stored in memory for the bridge process lifetime.
- Gateway session state is persisted by the Gateway itself.
--verboselogs ACP/Gateway bridge events to stderr (never stdout).- ACP runs can be canceled and the active run id is tracked per session.
Compatibility
- ACP bridge uses
@agentclientprotocol/sdk(currently 0.13.x). - Works with ACP clients that implement
initialize,newSession,loadSession,prompt,cancel, andlistSessions.
Testing
- Unit:
src/acp/session.test.tscovers run id lifecycle. - Full gate:
pnpm build && pnpm check && pnpm test && pnpm docs:build.
Related Docs
- CLI usage:
docs/cli/acp.md - Session model:
docs/concepts/session.md - Session management internals:
docs/reference/session-management-compaction.md