From 992a1bbbf1bf61603082a0e64124804893bd1540 Mon Sep 17 00:00:00 2001 From: Marius Date: Fri, 20 Feb 2026 13:12:57 +0100 Subject: [PATCH 1/4] feat(vscode): add resizable sidebar to agent manager (#509) * feat(vscode): add resizable sidebar to agent manager Add drag-to-resize support for the agent manager left sidebar using the existing ResizeHandle component. Width defaults to 260px, can be resized between 200px and 40% of the viewport, and persists across webview state recoveries. * fix(vscode): read window.innerWidth at drag time for accurate max sidebar width Evaluate the viewport-based max constraint inside the onResize callback so it reflects the current panel size, not the size at initial render. --- .../agent-manager/AgentManagerApp.tsx | 24 +++++++++++++++---- .../agent-manager/agent-manager.css | 6 ++++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx b/packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx index b2017be6af..3e4ddb2745 100644 --- a/packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx +++ b/packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx @@ -29,6 +29,7 @@ import { DiffComponentProvider } from "@kilocode/kilo-ui/context/diff" import { Code } from "@kilocode/kilo-ui/code" import { Diff } from "@kilocode/kilo-ui/diff" import { Toast } from "@kilocode/kilo-ui/toast" +import { ResizeHandle } from "@kilocode/kilo-ui/resize-handle" import { Icon } from "@kilocode/kilo-ui/icon" import { Button } from "@kilocode/kilo-ui/button" import { IconButton } from "@kilocode/kilo-ui/icon-button" @@ -136,9 +137,14 @@ const AgentManagerContent: Component = () => { const [repoBranch, setRepoBranch] = createSignal() const [deletingWorktrees, setDeletingWorktrees] = createSignal>(new Set()) + const DEFAULT_SIDEBAR_WIDTH = 260 + const MIN_SIDEBAR_WIDTH = 200 + const MAX_SIDEBAR_WIDTH_RATIO = 0.4 + // Recover persisted local session IDs from webview state - const persisted = vscode.getState<{ localSessionIDs?: string[] }>() + const persisted = vscode.getState<{ localSessionIDs?: string[]; sidebarWidth?: number }>() const [localSessionIDs, setLocalSessionIDs] = createSignal(persisted?.localSessionIDs ?? []) + const [sidebarWidth, setSidebarWidth] = createSignal(persisted?.sidebarWidth ?? DEFAULT_SIDEBAR_WIDTH) // Pending local tab counter for generating unique IDs let pendingCounter = 0 @@ -158,9 +164,12 @@ const AgentManagerContent: Component = () => { return id } - // Persist local session IDs to webview state for recovery (exclude pending tabs) + // Persist local session IDs and sidebar width to webview state for recovery (exclude pending tabs) createEffect(() => { - vscode.setState({ localSessionIDs: localSessionIDs().filter((id) => !isPending(id)) }) + vscode.setState({ + localSessionIDs: localSessionIDs().filter((id) => !isPending(id)), + sidebarWidth: sidebarWidth(), + }) }) // Save the currently active tab for the current sidebar context before switching away @@ -625,7 +634,14 @@ const AgentManagerContent: Component = () => { return (
-
+
+ setSidebarWidth(Math.min(width, window.innerWidth * MAX_SIDEBAR_WIDTH_RATIO))} + /> {/* Local workspace item */}