feat(hermes): expose '/v1/capabilities' as the 'hermes_capabilities' Tauri command

Hermes 已在 v2026.5.x 暴露 GET /v1/capabilities 给外部 UI 用作机器可读的能力描述,让前端能动态适配可用 endpoint / feature 而无需用版本号硬匹配。ClawPanel 之前完全没利用这层抽象,本 commit 加一条 Tauri 命令 + Web handler + 前端 wrapper,为后续 chat/runs/approval 等动态降级(老版 Gateway 没有的能力优雅隐藏 UI)打底。
This commit is contained in:
晴天
2026-05-14 02:31:35 +08:00
parent 69cce64985
commit 1d6843c4fb
4 changed files with 37 additions and 0 deletions

View File

@@ -7063,6 +7063,13 @@ const handlers = {
return await resp.json()
},
async hermes_capabilities() {
const url = `${hermesGatewayUrl()}/v1/capabilities`
const resp = await globalThis.fetch(url, { signal: AbortSignal.timeout(5000), headers: { 'User-Agent': 'ClawPanel-Web' } })
if (!resp.ok) throw new Error(`Gateway 返回 HTTP ${resp.status}`)
return await resp.json()
},
async hermes_api_proxy({ method, path: reqPath, body, headers: customHeaders } = {}) {
const url = `${hermesGatewayUrl()}${reqPath}`
const opts = { method: method || 'GET', headers: { 'User-Agent': 'ClawPanel-Web' } }