diff --git a/.memory/worklog.json b/.memory/worklog.json index bf0aac4..42db785 100644 --- a/.memory/worklog.json +++ b/.memory/worklog.json @@ -1,19 +1,5 @@ { "entries": [ - { - "files_changed": 1, - "hash": "e54f2e4", - "message": "auto-save 2026-05-07 17:03 (~1)", - "ts": "2026-05-07T17:05:12+08:00", - "type": "commit" - }, - { - "files_changed": 1, - "hash": "e383abf", - "message": "auto-save 2026-05-07 17:10 (~1)", - "ts": "2026-05-07T17:10:43+08:00", - "type": "commit" - }, { "files_changed": 1, "hash": "3680fbd", @@ -3465,6 +3451,19 @@ "type": "session-heartbeat", "message": "Codex 会话活跃 · 最近命令:codex · 分支 master · 2 项未提交变更 · 最近提交:auto-save 2026-05-09 18:25 (~1)", "files_changed": 2 + }, + { + "ts": "2026-05-09T18:31:12+08:00", + "type": "commit", + "message": "auto-save 2026-05-09 18:31 (~2)", + "hash": "7d90784", + "files_changed": 2 + }, + { + "ts": "2026-05-09T10:35:53Z", + "type": "session-heartbeat", + "message": "Codex 会话活跃 · 最近命令:codex · 分支 master · 3 项未提交变更 · 最近提交:auto-save 2026-05-09 18:31 (~2)", + "files_changed": 3 } ] } diff --git a/src/app.js b/src/app.js index 77678a1..cc26238 100644 --- a/src/app.js +++ b/src/app.js @@ -9,6 +9,7 @@ const LS_THEME = "hermes-ui-theme-v1"; const LS_AGENTS = "hermes-ui-agents-v1"; const LS_CUSTOM_SKILLS = "hermes-ui-custom-skills-v1"; const LS_FLOWS = "hermes-ui-flows-v1"; +const LS_TAB = "hermes-ui-active-tab-v1"; const state = { apiBase: "/api/v1", @@ -61,6 +62,7 @@ document.addEventListener("DOMContentLoaded", () => { renderSidebar(); renderChat(); renderAgents(); + restoreActiveTab(); pingBackend(); fetchIP(); setInterval(pingBackend, 30000); @@ -329,10 +331,18 @@ function bindTabs() { btn.addEventListener("click", () => switchTab(btn.dataset.tab)); }); } +function restoreActiveTab() { + const saved = localStorage.getItem(LS_TAB); + if (!saved) return; + if (!document.querySelector(`.side-item[data-tab="${CSS.escape(saved)}"]`)) return; + if (!document.getElementById("tab-" + saved)) return; + switchTab(saved, { persist: false }); +} let _dashboardDirty = true; function markDashboardDirty() { _dashboardDirty = true; } -function switchTab(name) { +function switchTab(name, options = {}) { + if (options.persist !== false) localStorage.setItem(LS_TAB, name); document.querySelectorAll(".side-item").forEach(t => t.classList.toggle("active", t.dataset.tab === name)); document.querySelectorAll(".tab-panel").forEach(p => p.classList.toggle("active", p.id === "tab-" + name)); if (name === "chat") setTimeout(() => document.getElementById("chatInput")?.focus(), 50); diff --git a/src/sw.js b/src/sw.js index ce061bb..8c4c715 100644 --- a/src/sw.js +++ b/src/sw.js @@ -1,6 +1,6 @@ // 爱马仕 Hermes · 轻量 Service Worker // 静态壳走 network-first(拿不到再回退缓存),API 直通 -const CACHE = "hermes-ui-v11"; +const CACHE = "hermes-ui-v12"; const ASSETS = [ "./", "./index.html",