fix(gateway): support latest hello server version payload

OpenClaw 2026.5.18/2026.5.19 still uses Gateway WS protocol v4
(PROTOCOL_VERSION=4, MIN_CLIENT_PROTOCOL_VERSION=4), so there is no v5
handshake to implement. The compatibility break is the hello payload
shape: current upstream sends the runtime version at `hello.server.version`
while ClawPanel only read the old flat `hello.serverVersion` field.

Read both shapes so latest kernels keep populating wsClient.serverVersion,
which in turn keeps Dashboard display, kernel snapshot feature gates and
isLatest checks working after the WebSocket handshake succeeds.

Also bump the recommended OpenClaw targets to the current npm latests:
- official: 2026.5.19
- chinese: 2026.5.18-zh.1

Verification:
- node --test tests/kernel.test.js
- npm run build
- manual module check: simulated both hello.server.version and legacy
  hello.serverVersion payloads, both report serverVersion and protocol v4
This commit is contained in:
晴天
2026-05-21 14:25:10 +08:00
parent 230b5e6dca
commit a50000a933
5 changed files with 10 additions and 8 deletions

View File

@@ -9,10 +9,10 @@
},
"default": {
"official": {
"recommended": "2026.5.12"
"recommended": "2026.5.19"
},
"chinese": {
"recommended": "2026.5.12-zh.2"
"recommended": "2026.5.18-zh.1"
}
},
"panels": {

View File

@@ -196,8 +196,8 @@ export const KERNEL_TARGET = {
// 不要与 dev-api.js 中设备签名 payload 字符串前缀 `v3|deviceId|...` 混淆——
// 后者是 **device signature payload 字符串格式版本**,两者完全独立、互不相关。
// 即使在 v4 握手协议下,签名 payload 字符串仍以 `v3|` 开头(这是 payload schema 版本)。
official: '2026.5.12',
chinese: '2026.5.12-zh.2',
official: '2026.5.19',
chinese: '2026.5.18-zh.1',
},
hermes: {
default: '0.13.x',

View File

@@ -2,7 +2,7 @@
* 内核版本与特性门控
*
* 此模块是 ClawPanel 多内核版本兼容的核心:
* - 连接 Gateway 成功后,从 hello.serverVersion 构造 kernel snapshot
* - 连接 Gateway 成功后,从 hello.server.version / hello.serverVersion 构造 kernel snapshot
* - 页面通过 hasFeature(id) 同步查询特性可用性
* - 低于硬地板时通过 onKernelChange 触发 floor blocker
*

View File

@@ -660,7 +660,7 @@ export class WsClient {
this._authRetryCount = 0
this._hello = payload || null
this._snapshot = payload?.snapshot || null
this._serverVersion = payload?.serverVersion || null
this._serverVersion = payload?.serverVersion || payload?.server?.version || null
// 新连接 → 清空 method 降级缓存(可能换了 Gateway 版本)
this.resetCompatCache()
const defaults = this._snapshot?.sessionDefaults

View File

@@ -160,10 +160,12 @@ test('buildSnapshot edge case: version slightly below 5.6 feature requirement',
})
test('buildSnapshot.isLatest works against KERNEL_TARGET', () => {
const at_target = buildSnapshot('openclaw', '2026.5.6')
const at_target = buildSnapshot('openclaw', '2026.5.19')
const at_chinese_target = buildSnapshot('openclaw', '2026.5.18-zh.1')
const above_target = buildSnapshot('openclaw', '2026.6.0')
const below_target = buildSnapshot('openclaw', '2026.5.5')
const below_target = buildSnapshot('openclaw', '2026.5.18')
assert.equal(at_target.isLatest, true)
assert.equal(at_chinese_target.isLatest, true)
assert.equal(above_target.isLatest, true)
assert.equal(below_target.isLatest, false)
})