Skip to content

Automate browser based workflows with AI

feat(SKY-11596): make studio settings sidebar a grid column like the Copilot (#6931)

Celal Zamanoğlu29dfa9dc3703
diff --git a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx
index 370a59825..3f92480a7 100644
--- a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx
@@ -1552,7 +1552,12 @@ function Workspace({
className="relative h-full w-full"
style={
{
- [BLOCK_SIDEBAR_WIDTH_VAR]: `${renderedBlockSidebarWidth}px`,
+ // In studio the settings panel is its own grid column (StudioShell), so
+ // the Stage already reflows; zero the var so on-canvas overlays don't
+ // double-offset. Legacy keeps the overlay's measured width.
+ [BLOCK_SIDEBAR_WIDTH_VAR]: embedded
+ ? "0px"
+ : `${renderedBlockSidebarWidth}px`,
} as React.CSSProperties
}
>
@@ -1719,7 +1724,9 @@ function Workspace({
className={cn(
"absolute z-30 transition-all duration-300 ease-out",
embedded ? "top-3" : "top-[8.5rem]",
- blockSidebarOpen
+ // Studio: the settings panel is a separate grid column, so
+ // in-stage sub-panels anchor to the Stage edge, never offset.
+ !embedded && blockSidebarOpen
? HEADER_RIGHT_INSET_OPEN
: HEADER_RIGHT_INSET_CLOSED,
)}
@@ -1817,7 +1824,7 @@ function Workspace({
// Studio's top bar is above the canvas, so the panel drops
// from the canvas top; legacy's header is inside it.
embedded ? "top-3" : "top-[8.5rem]",
- blockSidebarOpen
+ !embedded && blockSidebarOpen
? HEADER_RIGHT_INSET_OPEN
: HEADER_RIGHT_INSET_CLOSED,
)}
diff --git a/skyvern-frontend/src/routes/workflows/editor/hooks/useSettingsSidebarLayout.test.tsx b/skyvern-frontend/src/routes/workflows/editor/hooks/useSettingsSidebarLayout.test.tsx
new file mode 100644
index 000000000..03cc69718
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/editor/hooks/useSettingsSidebarLayout.test.tsx
@@ -0,0 +1,107 @@
+// @vitest-environment jsdom
+
+import { act, renderHook } from "@testing-library/react";
+import { type ReactNode } from "react";
+import { MemoryRouter } from "react-router-dom";
+import { beforeEach, describe, expect, test } from "vitest";
+
+import { useStudioShellStore } from "@/store/StudioShellStore";
+import { useWorkflowPanelStore } from "@/store/WorkflowPanelStore";
+import type { WorkflowVersion } from "@/routes/workflows/hooks/useWorkflowVersionsQuery";
+
+import { useSettingsSidebarLayout } from "./useSettingsSidebarLayout";
+
+function wrapper({ children }: { children: ReactNode }) {
+ return (
+ <MemoryRouter initialEntries={["/workflows/wpid_abc/edit"]}>
+ {children}
+ </MemoryRouter>
+ );
+}
+
+beforeEach(() => {
+ useWorkflowPanelStore.getState().setSelectedBlockId(null);
+ useWorkflowPanelStore.getState().setWorkflowPanelState({
+ active: false,
+ content: "parameters",
+ });
+ useStudioShellStore.getState().reset();
+});
+
+describe("useSettingsSidebarLayout", () => {
+ test("closed when nothing is selected and no library is open", () => {
+ const { result } = renderHook(() => useSettingsSidebarLayout(), {
+ wrapper,
+ });
+ expect(result.current).toEqual({
+ open: false,
+ isLibrary: false,
+ nodeSelected: false,
+ collapsed: false,
+ });
+ });
+
+ test("a selected block opens the column collapsed (studio starts collapsed)", () => {
+ act(() => {
+ useWorkflowPanelStore.getState().setSelectedBlockId("block-a");
+ });
+ const { result } = renderHook(() => useSettingsSidebarLayout(), {
+ wrapper,
+ });
+ expect(result.current.open).toBe(true);
+ expect(result.current.nodeSelected).toBe(true);
+ expect(result.current.isLibrary).toBe(false);
+ expect(result.current.collapsed).toBe(true);
+ });
+
+ test("expanding the studio settings clears collapsed", () => {
+ act(() => {
+ useWorkflowPanelStore.getState().setSelectedBlockId("block-a");
+ useStudioShellStore.getState().setSettingsCollapsed(false);
+ });
+ const { result } = renderHook(() => useSettingsSidebarLayout(), {
+ wrapper,
+ });
+ expect(result.current.open).toBe(true);
+ expect(result.current.collapsed).toBe(false);
+ });
+
+ test("the comparison view keeps the column closed even with a block selected", () => {
+ act(() => {
+ useWorkflowPanelStore.getState().setSelectedBlockId("block-a");
+ useWorkflowPanelStore.getState().setWorkflowPanelState({
+ active: true,
+ content: "parameters",
+ data: {
+ showComparison: true,
+ version1: {} as WorkflowVersion,
+ version2: {} as WorkflowVersion,
+ },
+ });
+ });
+ const { result } = renderHook(() => useSettingsSidebarLayout(), {
+ wrapper,
+ });
+ expect(result.current.open).toBe(false);
+ expect(result.current.nodeSelected).toBe(false);
+ expect(result.current.collapsed).toBe(false);
+ });
+
+ test("the node library opens the column but is never collapsible", () => {
+ act(() => {
+ useWorkflowPanelStore.getState().setWorkflowPanelState({
+ active: true,
+ content: "nodeLibrary",
+ });
+ // ...even while the studio is in its collapsed state.
+ useStudioShellStore.getState().setSettingsCollapsed(true);
+ });
+ const { result } = renderHook(() => useSettingsSidebarLayout(), {
+ wrapper,
+ });
+ expect(result.current.open).toBe(true);
+ expect(result.current.isLibrary).toBe(true);
+ expect(result.current.nodeSelected).toBe(false);
+ expect(result.current.collapsed).toBe(false);
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/editor/hooks/useSettingsSidebarLayout.ts b/skyvern-frontend/src/routes/workflows/editor/hooks/useSettingsSidebarLayout.ts
new file mode 100644
index 000000000..22455e6d0
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/editor/hooks/useSettingsSidebarLayout.ts
@@ -0,0 +1,50 @@
+import { useWorkflowPanelStore } from "@/store/WorkflowPanelStore";
+import { useStudioShellStore } from "@/store/StudioShellStore";
+
+import { isBlockSidebarOpen } from "../blockSidebar";
+import { useWorkflowEditorMode } from "./useWorkflowEditorMode";
+
+type SettingsSidebarLayout = {
+ // The settings surface is visible at all (a block/start node is selected, or
+ // the block library drawer is open).
+ open: boolean;
+ // The library drawer (not collapsible) rather than a block's config form.
+ isLibrary: boolean;
+ // A block/start node is selected, so the panel can collapse to a rail.
+ nodeSelected: boolean;
+ // The panel is showing as a collapsed rail (only for a selected node).
+ collapsed: boolean;
+};
+
+// Single source of truth for the studio settings sidebar's layout state, shared
+// by StudioShell (which sizes the grid column) and BlockConfigSidebar (which
+// renders the body/rail) so the two can't drift.
+export function useSettingsSidebarLayout(): SettingsSidebarLayout {
+ const mode = useWorkflowEditorMode();
+ const selectedBlockId = useWorkflowPanelStore((s) => s.selectedBlockId);
+ const workflowPanelState = useWorkflowPanelStore((s) => s.workflowPanelState);
+ const studioSettingsCollapsed = useStudioShellStore(
+ (s) => s.settingsCollapsed,
+ );
+
+ // The comparison view replaces FlowRenderer (and thus the portaled settings
+ // panel) in the Stage, so there'd be no content for the column — keep it
+ // closed so it doesn't reserve an empty strip that shrinks the comparison.
+ const comparisonActive = Boolean(
+ workflowPanelState.data?.showComparison &&
+ workflowPanelState.data?.version1 &&
+ workflowPanelState.data?.version2,
+ );
+ const isLibrary =
+ workflowPanelState.active && workflowPanelState.content === "nodeLibrary";
+ const nodeSelected =
+ !comparisonActive &&
+ mode !== "build" &&
+ selectedBlockId !== null &&
+ !isLibrary;
+ const open =
+ !comparisonActive && isBlockSidebarOpen(mode, selectedBlockId, isLibrary);
+ const collapsed = nodeSelected && studioSettingsCollapsed;
+
+ return { open, isLibrary, nodeSelected, collapsed };
+}
diff --git a/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigSidebar.test.tsx b/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigSidebar.test.tsx
index b5ff26df6..677fa477c 100644
--- a/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigSidebar.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigSidebar.test.tsx
@@ -87,6 +87,7 @@ import { useWorkflowPanelStore } from "@/store/WorkflowPanelStore";
import { BLOCK_FORMS, type WorkflowBlockNodeType } from "./BlockConfigForm";
import { BlockConfigSidebar } from "./BlockConfigSidebar";
import { getContainedBlockSidebarWidth } from "../blockSidebar";
+import { StudioShellContext } from "../../studio/StudioShellContext";
// EditableNodeTitle (used by the editable block title) measures truncation
// via ResizeObserver, which jsdom does not implement. Stubbed per-test in
@@ -137,6 +138,33 @@ afterEach(() => {
}
});
+// In studio the embedded sidebar portals its surface into the StudioShell
+// settings column (settingsPortalEl). Provide a real portal target via context
+// so the portaled content lands in the document and `screen` can query it.
+function renderEmbedded(initialPath = "/workflows/wpid_abc/edit") {
+ const settingsPortalEl = document.createElement("div");
+ const settingsRailPortalEl = document.createElement("div");
+ document.body.appendChild(settingsPortalEl);
+ document.body.appendChild(settingsRailPortalEl);
+ const result = render(
+ <MemoryRouter initialEntries={[initialPath]}>
+ <StudioShellContext.Provider
+ value={{
+ copilotPortalEl: null,
+ settingsPortalEl,
+ settingsRailPortalEl,
+ setEditorStreamSlot: () => {},
+ setBrowserStreamSlot: () => {},
+ setRunStreamSlot: () => {},
+ }}
+ >
+ <BlockConfigSidebar embedded />
+ </StudioShellContext.Provider>
+ </MemoryRouter>,
+ );
+ return { ...result, settingsPortalEl, settingsRailPortalEl };
+}
+
describe("BlockConfigSidebar mount stability (SKY-9360)", () => {
test("renders the aside with the slide-in animation when a block is selected", () => {
act(() => {
@@ -454,11 +482,7 @@ describe("BlockConfigSidebar settings collapse (SKY-11481)", () => {
act(() => {
useWorkflowPanelStore.getState().setSelectedBlockId("start-block");
});
- render(
- <MemoryRouter initialEntries={["/workflows/wpid_abc/edit"]}>
- <BlockConfigSidebar embedded />
- </MemoryRouter>,
- );
+ renderEmbedded();
expect(screen.getByTestId("settings-rail")).toBeDefined();
expect(useStudioShellStore.getState().settingsCollapsed).toBe(true);
@@ -472,11 +496,7 @@ describe("BlockConfigSidebar settings collapse (SKY-11481)", () => {
act(() => {
useWorkflowPanelStore.getState().setSelectedBlockId("block-a");
});
- render(
- <MemoryRouter initialEntries={["/workflows/wpid_abc/edit"]}>
- <BlockConfigSidebar embedded />
- </MemoryRouter>,
- );
+ renderEmbedded();
const rail = screen.getByTestId("settings-rail");
expect(rail.textContent).toContain("Alpha");
@@ -489,11 +509,7 @@ describe("BlockConfigSidebar settings collapse (SKY-11481)", () => {
act(() => {
useWorkflowPanelStore.getState().setSelectedBlockId("start-block");
});
- render(
- <MemoryRouter initialEntries={["/workflows/wpid_abc/edit"]}>
- <BlockConfigSidebar embedded />
- </MemoryRouter>,
- );
+ renderEmbedded();
fireEvent.click(screen.getByRole("button", { name: "Show settings" }));
@@ -510,11 +526,7 @@ describe("BlockConfigSidebar settings collapse (SKY-11481)", () => {
useStudioShellStore.getState().setSettingsCollapsed(false);
useWorkflowPanelStore.getState().setSelectedBlockId("block-a");
});
- render(
- <MemoryRouter initialEntries={["/workflows/wpid_abc/edit"]}>
- <BlockConfigSidebar embedded />
- </MemoryRouter>,
- );
+ renderEmbedded();
expect(screen.queryByTestId("settings-rail")).toBeNull();
expect(
@@ -531,36 +543,51 @@ describe("BlockConfigSidebar settings collapse (SKY-11481)", () => {
);
});
- test("the embedded shell uses the 0.75rem top + right inset mirroring the Copilot column", () => {
- // The 0.75rem inset now lives on the animated shell (Resizable root), not
- // the rail; collapsed and expanded both anchor there. The top inset matches
- // the Copilot column's py-3 (0.75rem) so the two rails align below the
- // workflow header instead of the panel sitting flush against it (SKY-11383).
+ test("the embedded panel portals its surface into the StudioShell settings column", () => {
+ // The panel is now a StudioShell grid column: the shell owns position,
+ // insets, and width, so the embedded surface is portaled into the provided
+ // settings column rather than self-positioning in the canvas.
act(() => {
useWorkflowPanelStore.getState().setSelectedBlockId("start-block");
});
- const { rerender } = render(
- <MemoryRouter initialEntries={["/workflows/wpid_abc/edit"]}>
- <BlockConfigSidebar embedded />
- </MemoryRouter>,
- );
- const railShell =
- screen.getByTestId("settings-rail").parentElement?.parentElement;
- expect(railShell?.style.top).toBe("0.75rem");
- expect(railShell?.style.right).toBe("0.75rem");
+ const { settingsPortalEl, settingsRailPortalEl } = renderEmbedded();
+
+ // Collapsed by default: the rail renders in its own column slot, the body
+ // (clipped under it) in the main settings slot.
+ expect(
+ settingsRailPortalEl.querySelector('[data-testid="settings-rail"]'),
+ ).not.toBeNull();
+ expect(
+ settingsPortalEl.querySelector('[data-testid="block-config-sidebar"]'),
+ ).not.toBeNull();
act(() => {
useStudioShellStore.getState().setSettingsCollapsed(false);
});
- rerender(
+
+ // Expanded: the body stays in the settings slot and the rail is gone.
+ expect(
+ settingsPortalEl.querySelector('[data-testid="block-config-sidebar"]'),
+ ).not.toBeNull();
+ expect(
+ settingsRailPortalEl.querySelector('[data-testid="settings-rail"]'),
+ ).toBeNull();
+ });
+
+ test("embedded renders nothing when the studio settings column is absent", () => {
+ // Without a StudioShell portal target the panel renders nothing rather than
+ // falling back to an in-canvas overlay.
+ act(() => {
+ useWorkflowPanelStore.getState().setSelectedBlockId("block-a");
+ });
+ render(
<MemoryRouter initialEntries={["/workflows/wpid_abc/edit"]}>
<BlockConfigSidebar embedded />
</MemoryRouter>,
);
- const panelShell = screen.getByTestId("block-config-sidebar").parentElement
- ?.parentElement;
- expect(panelShell?.style.top).toBe("0.75rem");
- expect(panelShell?.style.right).toBe("0.75rem");
+
+ expect(screen.queryByTestId("block-config-sidebar")).toBeNull();
+ expect(screen.queryByTestId("settings-rail")).toBeNull();
});
test("legacy (non-embedded) editor does not collapse and keeps the close button", () => {
diff --git a/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigSidebar.tsx b/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigSidebar.tsx
index 33b10f232..c36de4ea6 100644
--- a/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigSidebar.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigSidebar.tsx
@@ -8,6 +8,7 @@ import {
import { useNodesData, useReactFlow } from "@xyflow/react";
import { Resizable } from "re-resizable";
import { useEffect, useLayoutEffect, useRef, useState } from "react";
+import { createPortal } from "react-dom";
import {
BLOCK_SIDEBAR_WIDTH_MAX,
@@ -36,12 +37,8 @@ import {
import { BlockConfigForm } from "./BlockConfigForm";
import { useHasInteractedThisSession } from "./useHasInteractedThisSession";
import { WorkflowNodeLibraryPanel } from "./WorkflowNodeLibraryPanel";
-import {
- STUDIO_COPILOT_COLLAPSE_EASE,
- STUDIO_COPILOT_RAIL_WIDTH,
- STUDIO_COPILOT_TRANSITION_EASE,
- STUDIO_COPILOT_TRANSITION_MS,
-} from "../../studio/constants";
+import { STUDIO_COPILOT_RAIL_WIDTH } from "../../studio/constants";
+import { useStudioShellContext } from "../../studio/StudioShellContext";
import type { AddNodeProps } from "../Workspace";
// React Flow node type → backend WorkflowBlockType. The two diverge in
@@ -141,32 +138,29 @@ function SettingsRail({
identity,
onExpand,
}: Readonly<{ identity: SidebarIdentity; onExpand: () => void }>) {
- // Opaque background covers the clipped panel underneath immediately (no
- // show-through "open-flicker"); only the controls fade in, like Copilot.
+ // Self-contained bordered card filling the rail slot (mirrors CopilotRail) so
+ // its left edge reads as a panel edge; fades in like the Copilot rail.
return (
<div
data-testid="settings-rail"
- style={{ width: SETTINGS_RAIL_WIDTH }}
- className="absolute right-0 top-0 h-full bg-slate-elevation2"
+ className="flex h-full w-full flex-col items-center gap-3 rounded-xl border border-border bg-slate-elevation2 py-3 shadow-xl duration-300 animate-in fade-in"
>
- <div className="flex h-full flex-col items-center gap-3 py-3 duration-300 animate-in fade-in">
- <button
- type="button"
- onClick={onExpand}
- title="Show settings"
- aria-label="Show settings"
- className="rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
- >
- <ChevronLeftIcon className="h-4 w-4" />
- </button>
- <SidebarIdentityIcon identity={identity} />
- <span
- className="mt-1 max-h-[60%] overflow-hidden text-ellipsis text-xs font-medium tracking-wide text-muted-foreground"
- style={{ writingMode: "vertical-rl" }}
- >
- {identity.label}
- </span>
- </div>
+ <button
+ type="button"
+ onClick={onExpand}
+ title="Show settings"
+ aria-label="Show settings"
+ className="rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
+ >
+ <ChevronLeftIcon className="h-4 w-4" />
+ </button>
+ <SidebarIdentityIcon identity={identity} />
+ <span
+ className="mt-1 max-h-[60%] overflow-hidden text-ellipsis text-xs font-medium tracking-wide text-muted-foreground"
+ style={{ writingMode: "vertical-rl" }}
+ >
+ {identity.label}
+ </span>
</div>
);
}
@@ -424,6 +418,7 @@ function BlockConfigSidebar({
const setStudioSettingsCollapsed = useStudioShellStore(
(state) => state.setSettingsCollapsed,
);
+ const { settingsPortalEl, settingsRailPortalEl } = useStudioShellContext();
const containedWidth = getContainedBlockSidebarWidth(
width,
editorShellMetrics.width,
@@ -469,13 +464,10 @@ function BlockConfigSidebar({
const settingsCollapsed = isCollapsibleSettings && studioSettingsCollapsed;
const selectedIdentity = getSidebarIdentity(selectedNode);
- // Transition stays on so the toggle always animates (like Copilot); dropped
- // mid-drag, where the live width is tracked so the body follows the handle.
- const [isResizing, setIsResizing] = useState(false);
- const [resizingWidth, setResizingWidth] = useState<number | null>(null);
-
useLayoutEffect(() => {
- if (!sidebarVisible) {
+ // Legacy overlay only: studio sizes its column in StudioShell, so the
+ // contained-width measurement and rendered-width var are unused there.
+ if (!sidebarVisible || embedded) {
setEditorShellMetrics({
gutterPx: getBlockSidebarGutterPx(null),
width: null,
@@ -520,15 +512,21 @@ function BlockConfigSidebar({
};
// Re-measure on collapse toggle: the shell width changes, so the contained
// width bounds need refreshing.
- }, [sidebarVisible, settingsCollapsed]);
+ }, [sidebarVisible, settingsCollapsed, embedded]);
useLayoutEffect(() => {
- if (!sidebarVisible) {
+ if (!sidebarVisible || embedded) {
return;
}
setRenderedWidth(settingsCollapsed ? SETTINGS_RAIL_WIDTH : containedWidth);
- }, [settingsCollapsed, containedWidth, setRenderedWidth, sidebarVisible]);
+ }, [
+ settingsCollapsed,
+ containedWidth,
+ setRenderedWidth,
+ sidebarVisible,
+ embedded,
+ ]);
// In build mode the block-config form is unavailable, but the node library
// must still render so users can insert blocks from the canvas.
@@ -540,30 +538,70 @@ function BlockConfigSidebar({
return null;
}
- // Fixed body width tracks the live handle while resizing, the stored width
- // otherwise — never the rail width, so the clipping shell never reflows it.
- const bodyWidth =
- isResizing && resizingWidth !== null ? resizingWidth : containedWidth;
+ // Studio: the panel is a StudioShell grid column (the shell owns the width,
+ // collapse rail, and resize), so we portal the surface into that column and
+ // fill it. The body stays mounted but inert while collapsed so the shell's
+ // width animation can clip it without it reflowing.
+ if (embedded) {
+ // The expanded panel and the collapsed rail portal into separate StudioShell
+ // slots (the shell owns their sizing/position), mirroring the Copilot's
+ // fixed chat + separate rail overlay. The body stays mounted but inert while
+ // collapsed so the shell's width animation can clip it without reflow.
+ const bodyCard = (
+ <div className="relative h-full w-full overflow-hidden rounded-xl border border-border bg-slate-elevation2 shadow-xl">
+ <aside
+ data-testid="block-config-sidebar"
+ className={cn(
+ "flex h-full w-full flex-col",
+ settingsCollapsed && "pointer-events-none",
+ )}
+ >
+ {showLibrary ? (
+ <BlockLibrarySidebarBody
+ onAddNode={(props) => onAddNode?.(props)}
+ onClose={closeWorkflowPanel}
+ />
+ ) : selectedBlockId !== null ? (
+ <BlockConfigSidebarBody
+ selectedBlockId={selectedBlockId}
+ identity={selectedIdentity}
+ onClose={() => setSelectedBlockId(null)}
+ onCollapse={
+ isCollapsibleSettings
+ ? () => setStudioSettingsCollapsed(true)
+ : undefined
+ }
+ />
+ ) : null}
+ </aside>
+ </div>
+ );
+
+ return (
+ <>
+ {settingsPortalEl ? createPortal(bodyCard, settingsPortalEl) : null}
+ {settingsCollapsed && settingsRailPortalEl
+ ? createPortal(
+ <SettingsRail
+ identity={selectedIdentity}
+ onExpand={() => setStudioSettingsCollapsed(false)}
+ />,
+ settingsRailPortalEl,
+ )
+ : null}
+ </>
+ );
+ }
return (
<Resizable
ref={resizableRef}
- size={{
- width:
- embedded && settingsCollapsed ? SETTINGS_RAIL_WIDTH : containedWidth,
- height: "auto",
- }}
- minWidth={
- embedded && settingsCollapsed ? SETTINGS_RAIL_WIDTH : containedMinWidth
- }
+ size={{ width: containedWidth, height: "auto" }}
+ minWidth={containedMinWidth}
maxWidth={containedMaxWidth}
- enable={{ left: !(embedded && settingsCollapsed) }}
- onResizeStart={() => setIsResizing(true)}
- onResize={(_e, _dir, ref) => setResizingWidth(ref.offsetWidth)}
+ enable={{ left: true }}
onResizeStop={(_e, _dir, ref) => {
setWidth(ref.offsetWidth);
- setIsResizing(false);
- setResizingWidth(null);
}}
handleClasses={{ left: "block-sidebar-resize-handle" }}
handleStyles={{
@@ -575,21 +613,9 @@ function BlockConfigSidebar({
}}
style={{
position: "absolute",
- top: embedded ? "0.75rem" : mode === "build" ? "7rem" : "2rem",
- // Embedded mirrors the Copilot column's uniform py-3/pl-3 (0.75rem)
- // inset; legacy keeps its wider 1.5rem gutter.
- right: embedded ? "0.75rem" : "1.5rem",
- bottom: embedded ? "0.75rem" : "1.5rem",
- // Copilot's open/collapse curve, always on so the toggle animates with
- // no snap; dropped mid-drag so a resize tracks the handle 1:1.
- transition:
- embedded && !isResizing
- ? `width ${STUDIO_COPILOT_TRANSITION_MS}ms ${
- settingsCollapsed
- ? STUDIO_COPILOT_COLLAPSE_EASE
- : STUDIO_COPILOT_TRANSITION_EASE
- }`
- : undefined,
+ top: mode === "build" ? "7rem" : "2rem",
+ right: "1.5rem",
+ bottom: "1.5rem",
}}
className="z-30"
>
@@ -601,23 +627,7 @@ function BlockConfigSidebar({
>
<aside
data-testid="block-config-sidebar"
- style={
- embedded
- ? {
- position: "absolute",
- inset: 0,
- left: "auto",
- width: bodyWidth,
- }
- : undefined
- }
- className={cn(
- "flex h-full flex-col",
- // Collapsed: the rail covers it; disable the clipped strip.
- embedded && settingsCollapsed && "pointer-events-none",
- !embedded &&
- "w-full duration-200 ease-out animate-in slide-in-from-right-5",
- )}
+ className="flex h-full w-full flex-col duration-200 ease-out animate-in slide-in-from-right-5"
>
{showLibrary ? (
<BlockLibrarySidebarBody
@@ -629,20 +639,9 @@ function BlockConfigSidebar({
selectedBlockId={selectedBlockId}
identity={selectedIdentity}
onClose={() => setSelectedBlockId(null)}
- onCollapse={
- isCollapsibleSettings
- ? () => setStudioSettingsCollapsed(true)
- : undefined
- }
/>
) : null}
</aside>
- {embedded && settingsCollapsed ? (
- <SettingsRail
- identity={selectedIdentity}
- onExpand={() => setStudioSettingsCollapsed(false)}
- />
- ) : null}
</div>
</Resizable>
);
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioShell.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioShell.tsx
index 4d02bd29a..3fe1f9e3f 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioShell.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioShell.tsx
@@ -1,10 +1,24 @@
-import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
+import {
+ useCallback,
+ useEffect,
+ useLayoutEffect,
+ useMemo,
+ useRef,
+ useState,
+} from "react";
import { createPortal } from "react-dom";
import { useSearchParams } from "react-router-dom";
+import {
+ BLOCK_SIDEBAR_WIDTH_MAX,
+ BLOCK_SIDEBAR_WIDTH_MIN,
+ useBlockSidebarWidthStore,
+} from "@/store/BlockSidebarWidthStore";
import { useStudioShellStore } from "@/store/StudioShellStore";
import { cn } from "@/util/utils";
+import { useSettingsSidebarLayout } from "../editor/hooks/useSettingsSidebarLayout";
+
import { BrowserTab } from "./BrowserTab";
import { CopilotRail } from "./CopilotRail";
import { EditorTab, type StudioWorkspaceProps } from "./EditorTab";
@@ -24,6 +38,16 @@ import { StudioShellContext } from "./StudioShellContext";
import { StudioTopBar } from "./StudioTopBar";
import { StudioWorkflowPanels } from "./StudioWorkflowPanels";
+// Keyboard arrow-key resize step for the settings separator (px).
+const SETTINGS_RESIZE_STEP = 24;
+
+function clampSettingsWidth(next: number): number {
+ return Math.min(
+ BLOCK_SIDEBAR_WIDTH_MAX,
+ Math.max(BLOCK_SIDEBAR_WIDTH_MIN, Math.round(next)),
+ );
+}
+
/**
* Spine + Stage shell: a persistent Copilot column beside a Stage that swaps the
* Editor and Run tabs. The Copilot is portaled in from the embedded Workspace.
@@ -37,6 +61,11 @@ export function StudioShell(props: StudioWorkspaceProps) {
const [copilotPortalEl, setCopilotPortalEl] = useState<HTMLElement | null>(
null,
);
+ const [settingsPortalEl, setSettingsPortalEl] = useState<HTMLElement | null>(
+ null,
+ );
+ const [settingsRailPortalEl, setSettingsRailPortalEl] =
+ useState<HTMLElement | null>(null);
// The live browser stream is mounted once into this detached host and
// re-parented into the active surface, so it never remounts on tab switch.
@@ -87,11 +116,13 @@ export function StudioShell(props: StudioWorkspaceProps) {
const shellContextValue = useMemo(
() => ({
copilotPortalEl,
+ settingsPortalEl,
+ settingsRailPortalEl,
setEditorStreamSlot,
setBrowserStreamSlot,
setRunStreamSlot,
}),
- [copilotPortalEl],
+ [copilotPortalEl, settingsPortalEl, settingsRailPortalEl],
);
// Pick the initial tab from the deep link ONCE per mount; must not re-fire on
@@ -112,6 +143,87 @@ export function StudioShell(props: StudioWorkspaceProps) {
? STUDIO_COPILOT_RAIL_WIDTH
: STUDIO_COPILOT_WIDTH;
+ // Settings sidebar as a third grid column (mirrors the Copilot): the panel is
+ // portaled in from FlowRenderer, but its column width lives here so opening,
+ // collapsing, and resizing it reflow the Stage instead of overlaying it.
+ const { open: settingsOpen, collapsed: settingsCollapsed } =
+ useSettingsSidebarLayout();
+ const committedSettingsWidth = useBlockSidebarWidthStore((s) => s.width);
+ const setBlockSidebarWidth = useBlockSidebarWidthStore((s) => s.setWidth);
+ const [settingsDragWidth, setSettingsDragWidth] = useState<number | null>(
+ null,
+ );
+ const isResizingSettings = settingsDragWidth !== null;
+ const expandedSettingsWidth = settingsDragWidth ?? committedSettingsWidth;
+ // The settings panel lives in the (CSS-hidden but still mounted) Editor tab,
+ // so only reserve its column there — otherwise it'd float over Browser/Run.
+ const settingsColumnActive = settingsOpen && tab === "editor";
+ const settingsColumnWidth = !settingsColumnActive
+ ? 0
+ : settingsCollapsed
+ ? STUDIO_COPILOT_RAIL_WIDTH
+ : expandedSettingsWidth;
+ // The body is interactive only on the Editor tab while expanded, the rail only
+ // while collapsed there. Mark the other (still-mounted, clipped) subtree inert
+ // so keyboard/screen-reader users can't reach off-screen controls.
+ const settingsBodyInert = !(settingsColumnActive && !settingsCollapsed);
+ const settingsRailInert = !(settingsColumnActive && settingsCollapsed);
+
+ // Teardown for an in-progress drag, invoked on drop AND on unmount, so the
+ // window listeners + body cursor lock never leak if the shell unmounts mid-drag.
+ const settingsDragTeardownRef = useRef<(() => void) | null>(null);
+ useEffect(() => () => settingsDragTeardownRef.current?.(), []);
+
+ const handleSettingsResizePointerDown = useCallback(
+ (event: React.PointerEvent<HTMLDivElement>) => {
+ event.preventDefault();
+ const startX = event.clientX;
+ const startWidth = committedSettingsWidth;
+ // Dragging left (toward the Stage) widens the right-docked panel.
+ const widthAt = (clientX: number) =>
+ clampSettingsWidth(startWidth + startX - clientX);
+ const previousCursor = document.body.style.cursor;
+ const previousUserSelect = document.body.style.userSelect;
+ document.body.style.cursor = "col-resize";
+ document.body.style.userSelect = "none";
+ const handleMove = (moveEvent: PointerEvent) => {
+ setSettingsDragWidth(widthAt(moveEvent.clientX));
+ };
+ function handleUp(upEvent?: PointerEvent) {
+ window.removeEventListener("pointermove", handleMove);
+ window.removeEventListener("pointerup", handleUp);
+ document.body.style.cursor = previousCursor;
+ document.body.style.userSelect = previousUserSelect;
+ settingsDragTeardownRef.current = null;
+ if (upEvent) {
+ setBlockSidebarWidth(widthAt(upEvent.clientX));
+ }
+ setSettingsDragWidth(null);
+ }
+ settingsDragTeardownRef.current = () => handleUp();
+ window.addEventListener("pointermove", handleMove);
+ window.addEventListener("pointerup", handleUp);
+ },
+ [committedSettingsWidth, setBlockSidebarWidth],
+ );
+
+ const handleSettingsResizeKeyDown = useCallback(
+ (event: React.KeyboardEvent<HTMLDivElement>) => {
+ if (event.key === "ArrowLeft") {
+ event.preventDefault();
+ setBlockSidebarWidth(
+ clampSettingsWidth(committedSettingsWidth + SETTINGS_RESIZE_STEP),
+ );
+ } else if (event.key === "ArrowRight") {
+ event.preventDefault();
+ setBlockSidebarWidth(
+ clampSettingsWidth(committedSettingsWidth - SETTINGS_RESIZE_STEP),
+ );
+ }
+ },
+ [committedSettingsWidth, setBlockSidebarWidth],
+ );
+
return (
<StudioShellContext.Provider value={shellContextValue}>
<div className="flex h-full w-full flex-col">
@@ -119,13 +231,16 @@ export function StudioShell(props: StudioWorkspaceProps) {
<div
className="grid min-h-0 flex-1"
style={{
- gridTemplateColumns: `${copilotWidth}px minmax(0, 1fr)`,
+ gridTemplateColumns: `${copilotWidth}px minmax(0, 1fr) ${settingsColumnWidth}px`,
gridTemplateRows: "minmax(0, 1fr)",
- transition: `grid-template-columns ${STUDIO_COPILOT_TRANSITION_MS}ms ${
- copilotCollapsed
- ? STUDIO_COPILOT_COLLAPSE_EASE
- : STUDIO_COPILOT_TRANSITION_EASE
- }`,
+ // Dropped mid-drag so a settings resize tracks the handle 1:1.
+ transition: isResizingSettings
+ ? "none"
+ : `grid-template-columns ${STUDIO_COPILOT_TRANSITION_MS}ms ${
+ copilotCollapsed || settingsCollapsed
+ ? STUDIO_COPILOT_COLLAPSE_EASE
+ : STUDIO_COPILOT_TRANSITION_EASE
+ }`,
}}
>
{/* Copilot portal target. Kept mounted (parked offscreen) when
@@ -188,6 +303,55 @@ export function StudioShell(props: StudioWorkspaceProps) {
</div>
<StudioWorkflowPanels />
</div>
+ {/* Settings portal target. The agent/block settings panel is portaled
+ in here from FlowRenderer (it needs React Flow context), so it lives
+ as a grid column that reflows the Stage like the Copilot does. The
+ inner target is fixed at the expanded width and right-pinned so the
+ open/collapse clip never reflows the panel body. */}
+ <div className="relative h-full min-w-0 overflow-hidden">
+ {/* Expanded panel: fixed width, right-pinned, clipped by the column.
+ pr-3 mirrors the Copilot's outer inset (gap to the window edge). */}
+ <div
+ ref={setSettingsPortalEl}
+ style={{ width: expandedSettingsWidth }}
+ className="absolute inset-y-0 right-0 py-3 pr-3"
+ // inert removes the clipped body from a11y tree + tab order when
+ // it's hidden (off the Editor tab, or collapsed under the rail).
+ {...(settingsBodyInert ? { inert: "" } : {})}
+ />
+ {/* Collapsed rail: a self-contained card overlay (mirrors CopilotRail).
+ Kept mounted so its portal target is stable; only interactive while
+ collapsed so it never blocks the expanded panel underneath. */}
+ <div
+ style={{ width: STUDIO_COPILOT_RAIL_WIDTH }}
+ className="pointer-events-none absolute inset-y-0 right-0 py-3 pr-3"
+ >
+ <div
+ ref={setSettingsRailPortalEl}
+ className={cn(
+ "h-full w-full",
+ settingsRailInert
+ ? "pointer-events-none"
+ : "pointer-events-auto",
+ )}
+ {...(settingsRailInert ? { inert: "" } : {})}
+ />
+ </div>
+ {settingsColumnActive && !settingsCollapsed ? (
+ <div
+ role="separator"
+ aria-orientation="vertical"
+ aria-label="Resize settings"
+ aria-valuenow={expandedSettingsWidth}
+ aria-valuemin={BLOCK_SIDEBAR_WIDTH_MIN}
+ aria-valuemax={BLOCK_SIDEBAR_WIDTH_MAX}
+ tabIndex={0}
+ onPointerDown={handleSettingsResizePointerDown}
+ onKeyDown={handleSettingsResizeKeyDown}
+ className="absolute inset-y-0 left-0 z-40 w-3 cursor-col-resize focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
+ />
+ ) : null}
+ </div>
</div>
<div
ref={setStreamHolderEl}
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioShellContext.ts b/skyvern-frontend/src/routes/workflows/studio/StudioShellContext.ts
index d77fbd4f4..94e5278ff 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioShellContext.ts
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioShellContext.ts
@@ -4,6 +4,14 @@ type StudioShellContextValue = {
// Left-column target Workspace portals the docked Copilot into; null when
// collapsed or when Workspace isn't embedded in the studio shell.
copilotPortalEl: HTMLElement | null;
+ // Right-column target FlowRenderer portals the agent/block settings panel
+ // into, so it lives as a grid column (sizing the Stage) instead of an overlay;
+ // null when Workspace isn't embedded in the studio shell.
+ settingsPortalEl: HTMLElement | null;
+ // Separate target for the collapsed settings rail, so it can be a
+ // self-contained card overlay (mirroring the Copilot rail) rather than a clip
+ // of the expanded panel.
+ settingsRailPortalEl: HTMLElement | null;
// Tabs register their stream container so the shell can re-parent the single
// persistent stream node into the active surface without remounting it.
setEditorStreamSlot: (el: HTMLElement | null) => void;
@@ -15,6 +23,8 @@ type StudioShellContextValue = {
export const StudioShellContext = createContext<StudioShellContextValue>({
copilotPortalEl: null,
+ settingsPortalEl: null,
+ settingsRailPortalEl: null,
setEditorStreamSlot: () => {},
setBrowserStreamSlot: () => {},
setRunStreamSlot: () => {},
diff --git a/skyvern-frontend/src/store/BlockSidebarWidthStore.test.ts b/skyvern-frontend/src/store/BlockSidebarWidthStore.test.ts
index fc1416fcc..10d3aeca4 100644
--- a/skyvern-frontend/src/store/BlockSidebarWidthStore.test.ts
+++ b/skyvern-frontend/src/store/BlockSidebarWidthStore.test.ts
@@ -70,6 +70,42 @@ describe("BlockSidebarWidthStore", () => {
test("constants form a sane range", () => {
expect(BLOCK_SIDEBAR_WIDTH_MIN).toBe(320);
expect(BLOCK_SIDEBAR_WIDTH_MAX).toBe(640);
- expect(BLOCK_SIDEBAR_WIDTH_DEFAULT).toBe(360);
+ // Matches the studio Copilot column width (STUDIO_COPILOT_WIDTH = 450).
+ expect(BLOCK_SIDEBAR_WIDTH_DEFAULT).toBe(450);
+ expect(BLOCK_SIDEBAR_WIDTH_DEFAULT).toBeGreaterThanOrEqual(
+ BLOCK_SIDEBAR_WIDTH_MIN,
+ );
+ expect(BLOCK_SIDEBAR_WIDTH_DEFAULT).toBeLessThanOrEqual(
+ BLOCK_SIDEBAR_WIDTH_MAX,
+ );
+ });
+
+ describe("v0 -> v1 migration", () => {
+ async function rehydrateFromV0(persistedWidth: number) {
+ localStorage.setItem(
+ BLOCK_SIDEBAR_WIDTH_STORAGE_KEY,
+ JSON.stringify({ state: { width: persistedWidth }, version: 0 }),
+ );
+ await useBlockSidebarWidthStore.persist.rehydrate();
+ }
+
+ test("moves the old default (360) to the new default", async () => {
+ await rehydrateFromV0(360);
+ expect(useBlockSidebarWidthStore.getState().width).toBe(
+ BLOCK_SIDEBAR_WIDTH_DEFAULT,
+ );
+ });
+
+ test("keeps a deliberately-customized in-range width", async () => {
+ await rehydrateFromV0(520);
+ expect(useBlockSidebarWidthStore.getState().width).toBe(520);
+ });
+
+ test("resets an out-of-range width to the default", async () => {
+ await rehydrateFromV0(9999);
+ expect(useBlockSidebarWidthStore.getState().width).toBe(
+ BLOCK_SIDEBAR_WIDTH_DEFAULT,
+ );
+ });
});
});
diff --git a/skyvern-frontend/src/store/BlockSidebarWidthStore.ts b/skyvern-frontend/src/store/BlockSidebarWidthStore.ts
index 8b4b57f0c..2ee30dc16 100644
--- a/skyvern-frontend/src/store/BlockSidebarWidthStore.ts
+++ b/skyvern-frontend/src/store/BlockSidebarWidthStore.ts
@@ -3,7 +3,12 @@ import { persist, createJSONStorage } from "zustand/middleware";
export const BLOCK_SIDEBAR_WIDTH_MIN = 320;
export const BLOCK_SIDEBAR_WIDTH_MAX = 640;
-export const BLOCK_SIDEBAR_WIDTH_DEFAULT = 360;
+// Matches the Copilot column (STUDIO_COPILOT_WIDTH) so the two studio rails open
+// to the same width; still drag-resizable within MIN/MAX.
+export const BLOCK_SIDEBAR_WIDTH_DEFAULT = 450;
+// The pre-v1 default; v0 sessions that never customized the width hold this, and
+// should move to the new default rather than keep the old narrower one.
+const BLOCK_SIDEBAR_WIDTH_OLD_DEFAULT = 360;
export const BLOCK_SIDEBAR_WIDTH_STORAGE_KEY = "skyvern.blockSidebarWidth";
type BlockSidebarWidthStore = {
@@ -45,6 +50,19 @@ const useBlockSidebarWidthStore = create<BlockSidebarWidthStore>()(
name: BLOCK_SIDEBAR_WIDTH_STORAGE_KEY,
storage: createJSONStorage(() => localStorage),
partialize: (state) => ({ width: state.width }),
+ // Bumped when the default changed 360 -> 450 (match the Copilot column).
+ // Move the old default (and any out-of-range value) to the new default,
+ // but keep a width the user deliberately dragged within range.
+ version: 1,
+ migrate: (persisted) => {
+ const prev = (persisted as { width?: number } | null)?.width;
+ const keep =
+ typeof prev === "number" &&
+ prev !== BLOCK_SIDEBAR_WIDTH_OLD_DEFAULT &&
+ prev >= BLOCK_SIDEBAR_WIDTH_MIN &&
+ prev <= BLOCK_SIDEBAR_WIDTH_MAX;
+ return { width: keep ? prev : BLOCK_SIDEBAR_WIDTH_DEFAULT };
+ },
},
),
);