feat(hermes): Batch 1 §E - Sessions 导出(走 dashboard /api/sessions/{id}/messages)

校对稿订正:不走 CLI `hermes sessions export`,直接调 dashboard 9119 HTTP API。

## 后端
- 新 Tauri 命令 hermes_session_export(session_id):
  · GET http://127.0.0.1:{dashboard_port}/api/sessions/{id}/messages
  · 拿原始 JSON 返回前端
  · 错误提示「请先启动 Dashboard」(dashboard server 必须运行)

## 前端
- tauri-api.js: hermesSessionExport wrapper
- sessions.js: 详情面板「打开会话 / Pin / 导出 / 删除」并列布局
  · 点导出 → Blob + URL.createObjectURL + a.download 浏览器下载 hermes-session-{id}.json
  · toast 成功/失败
- dev-api.js: Web 模式 handler 同步调 dashboard 端口

## i18n
- sessionsExport / sessionsExportSuccess / sessionsExportFailed × 3 语言
This commit is contained in:
晴天
2026-05-14 04:54:25 +08:00
parent 832bb9a6ef
commit 112963b2b7
6 changed files with 83 additions and 0 deletions

View File

@@ -7209,6 +7209,19 @@ const handlers = {
return await resp.json().catch(() => ({ ok: true }))
},
// Batch 1 §E: Sessions 导出(走 dashboard 9119
async hermes_session_export({ sessionId } = {}) {
if (!sessionId) throw new Error('session_id 不能为空')
const port = handlers._hermesDashboardPort()
const url = `http://127.0.0.1:${port}/api/sessions/${encodeURIComponent(sessionId)}/messages`
const resp = await globalThis.fetch(url, { signal: AbortSignal.timeout(30000) })
if (!resp.ok) {
const body = await resp.text().catch(() => '')
throw new Error(`export 失败 HTTP ${resp.status}: ${body}(提示:请先启动 Dashboard`)
}
return await resp.json()
},
// Batch 1 §C-bis: Approval Flow — POST /v1/runs/{run_id}/approval { choice }
async hermes_run_approval({ runId, choice } = {}) {
if (!runId) throw new Error('run_id 不能为空')