From 2fa23bd71d73af2f3f26398856c965234d4c0cd8 Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 3 Jun 2026 15:49:52 +0800 Subject: [PATCH] fix(web): restore v02 workbench layout --- web/hwlab-cloud-web/app.ts | 16 +++++++-- web/hwlab-cloud-web/index.html | 3 +- web/hwlab-cloud-web/scripts/check.ts | 31 +++++++++++++++++ web/hwlab-cloud-web/session-tabs.test.ts | 7 ++++ web/hwlab-cloud-web/styles.css | 44 ++++++++++++++++++++++-- 5 files changed, 94 insertions(+), 7 deletions(-) diff --git a/web/hwlab-cloud-web/app.ts b/web/hwlab-cloud-web/app.ts index 9fe9002d..77087de1 100644 --- a/web/hwlab-cloud-web/app.ts +++ b/web/hwlab-cloud-web/app.ts @@ -290,6 +290,7 @@ initSessionSidebar(); initCopySessionIdButton(); initCodeAgentTimeoutControl(); initConversationScrollMemory(); +renderConversation(); initCommandBar(); initLiveBuildOverlay(); initWorkbenchLogout(el.logoutButton); @@ -620,11 +621,11 @@ function refreshSessionSidebar(options = {}) { } function renderSessionSidebar() { - const view = sessionTabsFromConversations(sessionSidebarConversations(), { + const view = safeSessionTabsView(() => sessionTabsFromConversations(sessionSidebarConversations(), { selectedConversationId: state.conversationId, selectedSessionId: state.sessionId, activeTraceId: state.activeTraceId - }); + })); replaceChildren(el.sessionTabs, ...view.tabs.map(sessionTabButton)); const pending = Boolean(state.sessionList.pendingAction); el.sessionCreate.disabled = pending; @@ -634,6 +635,17 @@ function renderSessionSidebar() { el.sessionStatus.title = state.sessionList.error || state.sessionList.loadedAt || "session list not loaded"; } +function safeSessionTabsView(factory) { + try { + const view = factory(); + if (Array.isArray(view?.tabs)) return view; + state.sessionList.error = "session tabs renderer returned an invalid view"; + } catch (error) { + state.sessionList.error = error?.message || String(error); + } + return { tabs: [], activeKey: null, activeConversation: null }; +} + function renderCopySessionIdButton(activeConversation) { if (!el.copySessionId) return; const conversationId = textOf(activeConversation?.conversationId) || textOf(state.conversationId); diff --git a/web/hwlab-cloud-web/index.html b/web/hwlab-cloud-web/index.html index e23167e1..f3a1eed4 100644 --- a/web/hwlab-cloud-web/index.html +++ b/web/hwlab-cloud-web/index.html @@ -208,7 +208,7 @@ - ->