From e696d29f2f7aa4188b1425f52d4ddf0fdfc178e8 Mon Sep 17 00:00:00 2001 From: g1nation Date: Fri, 1 May 2026 19:33:35 +0900 Subject: [PATCH] chore: bump version to v2.33.5 and optimize sidebar UI --- PATCHNOTES.md | 7 +++++ package.json | 2 +- src/sidebarProvider.ts | 64 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 64 insertions(+), 9 deletions(-) diff --git a/PATCHNOTES.md b/PATCHNOTES.md index 5805c53..a391cce 100644 --- a/PATCHNOTES.md +++ b/PATCHNOTES.md @@ -1,3 +1,10 @@ +# Patch Notes - v2.33.5 (2026-05-01) + +## 🎨 UI Refinement +- **Sidebar Provider Update:** Optimized sidebar rendering and event handling for smoother navigation. + +--- + # Patch Notes - v2.33.4 (2026-05-01) ## 🛠️ Manual Refinement & Stabilization diff --git a/package.json b/package.json index 49ae05f..a93e86f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "g1nation", "displayName": "G1nation", "description": "High-performance autonomous local AI coding agent for VS Code. Features vectorized inference, asynchronous task management, and 100% offline processing.", - "version": "2.33.4", + "version": "2.33.5", "publisher": "connectailab", "license": "MIT", "icon": "assets/icon.png", diff --git a/src/sidebarProvider.ts b/src/sidebarProvider.ts index b50632c..df3cb61 100644 --- a/src/sidebarProvider.ts +++ b/src/sidebarProvider.ts @@ -322,7 +322,7 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn } const sessions = this._getSessions(); - const session = sessions.find(s => s.id === id); + const session = sessions.find(s => s.id === id) || this._getSessionById(id); if (session) { const history = Array.isArray(session.history) ? session.history : []; if (history.length === 0) { @@ -409,6 +409,35 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn .slice(0, 50); } + private _getSessionById(id: string): ChatSession | null { + const rawSessions = this._context.globalState.get('chat_sessions', []) || []; + const raw = rawSessions.find((session: any) => String(session?.id) === String(id)); + if (!raw) return null; + + const history = Array.isArray(raw.history) + ? raw.history.filter((message: any) => + message + && (message.role === 'user' || message.role === 'assistant' || message.role === 'system') + && message.content !== undefined + ) + : []; + if (history.length === 0) return null; + + const firstMsg = history.find((message: ChatMessage) => message.role === 'user')?.content; + const fallbackTitle = typeof firstMsg === 'string' + ? firstMsg.substring(0, 50).replace(/\n/g, ' ') + (firstMsg.length > 50 ? '...' : '') + : 'Chat Session'; + + return { + id: String(raw.id), + title: String(raw.title || fallbackTitle), + timestamp: typeof raw.timestamp === 'number' ? raw.timestamp : Date.now(), + history, + brainProfileId: String(raw.brainProfileId || getActiveBrainProfile().id), + negativePrompt: String(raw.negativePrompt || '') + }; + } + private async _putSessions(sessions: ChatSession[]) { await this._context.globalState.update('chat_sessions', sessions.slice(0, 50)); } @@ -2108,15 +2137,21 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn break; case 'restoreHistory': case 'sessionLoaded': - const historyData = msg.type === 'sessionLoaded' ? msg.value : msg; - const history = Array.isArray(historyData.history) ? historyData.history : (Array.isArray(historyData) ? historyData : []); + const historyPayload = msg.type === 'sessionLoaded' ? msg.value : msg.value; + const history = Array.isArray(historyPayload) + ? historyPayload + : (Array.isArray(historyPayload?.history) ? historyPayload.history : []); if (history && history.length > 0) { chat.innerHTML = ''; - history.forEach(m => addMsg(m.content, m.role === 'assistant' ? 'assistant' : 'user', m.rationale)); + history.forEach(m => { + if (!m || m.internal) return; + addMsg(m.content, m.role === 'assistant' ? 'assistant' : 'user', m.rationale); + }); + chat.scrollTop = chat.scrollHeight; } - if (historyData.negativePrompt !== undefined) { - negativePrompt.value = historyData.negativePrompt; + if (historyPayload?.negativePrompt !== undefined) { + negativePrompt.value = historyPayload.negativePrompt; } historyOverlay.classList.remove('visible'); break; @@ -2163,8 +2198,21 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn historyList.innerHTML = ''; msg.value.forEach(s => { const el = document.createElement('div'); el.className = 'history-item'; - el.innerHTML = \`
\${s.title}
\${new Date(s.timestamp).toLocaleString()} · \${s.messageCount} msgs
\`; - el.onclick = () => vscode.postMessage({ type: 'loadSession', id: s.id }); + el.setAttribute('role', 'button'); + el.tabIndex = 0; + el.dataset.sessionId = s.id; + el.innerHTML = \`
\${s.title}
\${new Date(s.timestamp).toLocaleString()} · \${s.messageCount} msgs
\`; + const load = () => { + if (!el.dataset.sessionId) return; + vscode.postMessage({ type: 'loadSession', id: el.dataset.sessionId }); + }; + el.addEventListener('click', load); + el.addEventListener('keydown', event => { + if (event.key === 'Enter' || event.key === ' ') { + event.preventDefault(); + load(); + } + }); historyList.appendChild(el); }); break;