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.2 KiB
5.2 KiB
summary, read_when, owner, status, last_updated, title
| summary | read_when | owner | status | last_updated | title | ||
|---|---|---|---|---|---|---|---|
| Plan: Add OpenResponses /v1/responses endpoint and deprecate chat completions cleanly |
|
hanzo-bot | draft | 2026-01-19 | OpenResponses Gateway Plan |
OpenResponses Gateway Integration Plan
Context
HanzoBot Gateway currently exposes a minimal OpenAI-compatible Chat Completions endpoint at
/v1/chat/completions (see OpenAI Chat Completions).
Open Responses is an open inference standard based on the OpenAI Responses API. It is designed
for agentic workflows and uses item-based inputs plus semantic streaming events. The OpenResponses
spec defines /v1/responses, not /v1/chat/completions.
Goals
- Add a
/v1/responsesendpoint that adheres to OpenResponses semantics. - Keep Chat Completions as a compatibility layer that is easy to disable and eventually remove.
- Standardize validation and parsing with isolated, reusable schemas.
Non-goals
- Full OpenResponses feature parity in the first pass (images, files, hosted tools).
- Replacing internal agent execution logic or tool orchestration.
- Changing the existing
/v1/chat/completionsbehavior during the first phase.
Research Summary
Sources: OpenResponses OpenAPI, OpenResponses specification site, and the Hugging Face blog post.
Key points extracted:
POST /v1/responsesacceptsCreateResponseBodyfields likemodel,input(string orItemParam[]),instructions,tools,tool_choice,stream,max_output_tokens, andmax_tool_calls.ItemParamis a discriminated union of:messageitems with rolessystem,developer,user,assistantfunction_callandfunction_call_outputreasoningitem_reference
- Successful responses return a
ResponseResourcewithobject: "response",status, andoutputitems. - Streaming uses semantic events such as:
response.created,response.in_progress,response.completed,response.failedresponse.output_item.added,response.output_item.doneresponse.content_part.added,response.content_part.doneresponse.output_text.delta,response.output_text.done
- The spec requires:
Content-Type: text/event-streamevent:must match the JSONtypefield- terminal event must be literal
[DONE]
- Reasoning items may expose
content,encrypted_content, andsummary. - HF examples include
OpenResponses-Version: latestin requests (optional header).
Proposed Architecture
- Add
src/gateway/open-responses.schema.tscontaining Zod schemas only (no gateway imports). - Add
src/gateway/openresponses-http.ts(oropen-responses-http.ts) for/v1/responses. - Keep
src/gateway/openai-http.tsintact as a legacy compatibility adapter. - Add config
gateway.http.endpoints.responses.enabled(defaultfalse). - Keep
gateway.http.endpoints.chatCompletions.enabledindependent; allow both endpoints to be toggled separately. - Emit a startup warning when Chat Completions is enabled to signal legacy status.
Deprecation Path for Chat Completions
- Maintain strict module boundaries: no shared schema types between responses and chat completions.
- Make Chat Completions opt-in by config so it can be disabled without code changes.
- Update docs to label Chat Completions as legacy once
/v1/responsesis stable. - Optional future step: map Chat Completions requests to the Responses handler for a simpler removal path.
Phase 1 Support Subset
- Accept
inputas string orItemParam[]with message roles andfunction_call_output. - Extract system and developer messages into
extraSystemPrompt. - Use the most recent
userorfunction_call_outputas the current message for agent runs. - Reject unsupported content parts (image/file) with
invalid_request_error. - Return a single assistant message with
output_textcontent. - Return
usagewith zeroed values until token accounting is wired.
Validation Strategy (No SDK)
- Implement Zod schemas for the supported subset of:
CreateResponseBodyItemParam+ message content part unionsResponseResource- Streaming event shapes used by the gateway
- Keep schemas in a single, isolated module to avoid drift and allow future codegen.
Streaming Implementation (Phase 1)
- SSE lines with both
event:anddata:. - Required sequence (minimum viable):
response.createdresponse.output_item.addedresponse.content_part.addedresponse.output_text.delta(repeat as needed)response.output_text.doneresponse.content_part.doneresponse.completed[DONE]
Tests and Verification Plan
- Add e2e coverage for
/v1/responses:- Auth required
- Non-stream response shape
- Stream event ordering and
[DONE] - Session routing with headers and
user
- Keep
src/gateway/openai-http.test.tsunchanged. - Manual: curl to
/v1/responseswithstream: trueand verify event ordering and terminal[DONE].
Doc Updates (Follow-up)
- Add a new docs page for
/v1/responsesusage and examples. - Update
/gateway/openai-http-apiwith a legacy note and pointer to/v1/responses.