fix(openclaw): update recommended kernel target and delta protocol handling

面板原本只声明 maxProtocol=3 的握手范围,且 chat delta 处理只接受前缀扩展。
连接到 2026.5.12+ 内核时会出现握手兼容问题;agent 输出在内容回滚或重排场景也会
丢失最新文本,前端 streaming 气泡停留在旧前缀。

## Connect 握手协议范围
- 将桌面端 connect frame 的 maxProtocol 从 3 扩展到 4
- 将 Web 模式 connect frame 的 maxProtocol 从 3 扩展到 4
- minProtocol 继续保留 3,用于兼容历史内核
- 范围 [3, 4] 同时覆盖旧内核和 5.12+ 内核,不需要按版本分支

## Chat delta replace 语义
- 当 payload.replace=true 时,无条件覆盖当前 AI 文本缓存
- 保留前缀扩展场景的增量更新逻辑
- 修复内容回滚或重排时文本长度变短导致 UI 不刷新的问题

## 推荐内核版本
- official 推荐目标升到 2026.5.12
- chinese 推荐目标升到 2026.5.12-zh.1
- KERNEL_FLOOR 不变,继续兼容历史安装

## 验证
- cargo check:PASS
- npm run build:PASS
This commit is contained in:
晴天
2026-05-15 18:30:04 +08:00
parent 0b4ef11971
commit 8b690cb6a7
5 changed files with 14 additions and 7 deletions

View File

@@ -189,8 +189,10 @@ export const KERNEL_FLOOR = {
*/
export const KERNEL_TARGET = {
openclaw: {
official: '2026.5.6',
chinese: '2026.5.6-zh.2',
// 内核协议在 5.12 升级到 v4MIN_CLIENT_PROTOCOL_VERSION=4新增增量 chat delta payloads
// 面板通过 connect frame `[minProtocol=3, maxProtocol=4]` 同时兼容新旧内核
official: '2026.5.12',
chinese: '2026.5.12-zh.1',
},
hermes: {
default: '0.13.x',

View File

@@ -1862,7 +1862,10 @@ function handleChatEvent(payload) {
if (c?.audios?.length) _currentAiAudios = c.audios
if (c?.files?.length) _currentAiFiles = c.files
if (c?.tools?.length) _currentAiTools = c.tools
if (c?.text && c.text.length > _currentAiText.length) {
// 增量 delta 协议下,当输出文本不是前缀扩展时(例如内容回滚或重排),
// 对端会带 replace=true此时新文本可能比当前缓存短必须无条件覆盖否则会丢失最新内容。
const isReplace = payload.replace === true
if (c?.text && (isReplace || c.text.length > _currentAiText.length)) {
showTyping(false)
if (!_currentAiBubble) {
_currentAiBubble = createStreamBubble()