Skip to content

Automate browser based workflows with AI

Fix default open Studio Copilot (#7022)

Aaron Perez53474e4ce78c
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.test.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.test.tsx
index 4537ed4e3..9b467bb3a 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.test.tsx
@@ -1,6 +1,12 @@
// @vitest-environment jsdom
-import { cleanup, fireEvent, render, screen } from "@testing-library/react";
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ within,
+} from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { useRunViewStore } from "@/store/RunViewStore";
@@ -269,6 +275,160 @@ describe("RunHero header dedupe", () => {
});
});
+describe("RunHero recording navigation", () => {
+ test("live-pinned running runs can switch from recording back to the final run frame after finalizing", () => {
+ useRunViewStore.getState().pinFrame("stream");
+ const finalFrameSelection = { kind: "thought" as const, thoughtId: "t1" };
+ const { rerender } = render(
+ <RunHero {...baseProps} showDebugStream={false} />,
+ );
+
+ expect(screen.queryByRole("button", { name: "Run" })).toBeNull();
+
+ rerender(
+ <RunHero
+ {...baseProps}
+ showDebugStream={false}
+ running={false}
+ recordingUrls={["https://example.com/rec.mp4"]}
+ heroSelection={finalFrameSelection}
+ heroLabel="Final frame"
+ />,
+ );
+
+ expect(screen.queryByTestId("hero-recording")).not.toBeNull();
+ expect(screen.queryByRole("button", { name: "Run" })).not.toBeNull();
+
+ fireEvent.click(screen.getByRole("button", { name: "Run" }));
+ expect(screen.queryByTestId("hero-screenshot")).not.toBeNull();
+ expect(screen.queryByTestId("hero-recording")).toBeNull();
+ });
+
+ test("finalized runs can switch from the default recording back to the run frame", () => {
+ render(
+ <RunHero
+ {...baseProps}
+ showDebugStream={false}
+ running={false}
+ recordingUrls={["https://example.com/rec.mp4"]}
+ heroSelection={{ kind: "thought", thoughtId: "t1" }}
+ heroLabel="Final frame"
+ />,
+ );
+
+ expect(screen.queryByTestId("hero-recording")).not.toBeNull();
+ expect(screen.queryByTestId("hero-screenshot")).toBeNull();
+
+ fireEvent.click(screen.getByRole("button", { name: "Run" }));
+ expect(screen.queryByTestId("hero-screenshot")).not.toBeNull();
+ expect(screen.queryByTestId("hero-recording")).toBeNull();
+
+ fireEvent.click(screen.getByRole("button", { name: "Recording" }));
+ expect(screen.queryByTestId("hero-recording")).not.toBeNull();
+ expect(screen.queryByTestId("hero-screenshot")).toBeNull();
+ });
+
+ test("explicit run view stays selected while the frame selection reloads", () => {
+ const { rerender } = render(
+ <RunHero
+ {...baseProps}
+ showDebugStream={false}
+ running={false}
+ recordingUrls={["https://example.com/rec.mp4"]}
+ heroSelection={{ kind: "thought", thoughtId: "t1" }}
+ heroLabel="Final frame"
+ />,
+ );
+
+ fireEvent.click(screen.getByRole("button", { name: "Run" }));
+ expect(screen.queryByTestId("hero-screenshot")).not.toBeNull();
+
+ rerender(
+ <RunHero
+ {...baseProps}
+ showDebugStream={false}
+ running={false}
+ recordingUrls={["https://example.com/rec.mp4"]}
+ heroSelection={null}
+ heroLabel="Final frame"
+ />,
+ );
+
+ expect(screen.queryByText("Waiting for the first action…")).not.toBeNull();
+ expect(screen.queryByRole("button", { name: "Run" })).not.toBeNull();
+ expect(screen.queryByTestId("hero-recording")).toBeNull();
+ });
+
+ test("failed runs with a recording can open it from the run frame", () => {
+ render(
+ <RunHero
+ {...baseProps}
+ showDebugStream={false}
+ running={false}
+ failed
+ recordingUrls={["https://example.com/rec.mp4"]}
+ heroSelection={{ kind: "thought", thoughtId: "t1" }}
+ heroLabel="Failure frame"
+ />,
+ );
+
+ expect(screen.queryByTestId("hero-screenshot")).not.toBeNull();
+ expect(screen.queryByTestId("hero-recording")).toBeNull();
+
+ fireEvent.click(screen.getByRole("button", { name: "Recording" }));
+ expect(screen.queryByTestId("hero-recording")).not.toBeNull();
+ expect(screen.queryByTestId("hero-screenshot")).toBeNull();
+ });
+
+ test("failed runs without a frame can return from recording to the run view", () => {
+ render(
+ <RunHero
+ {...baseProps}
+ showDebugStream={false}
+ running={false}
+ failed
+ recordingUrls={["https://example.com/rec.mp4"]}
+ />,
+ );
+
+ expect(screen.queryByRole("button", { name: "Run" })).not.toBeNull();
+
+ fireEvent.click(screen.getByRole("button", { name: "Recording" }));
+ expect(screen.queryByTestId("hero-recording")).not.toBeNull();
+
+ fireEvent.click(screen.getByRole("button", { name: "Run" }));
+ expect(screen.queryByText("Waiting for the first action…")).not.toBeNull();
+ expect(screen.queryByTestId("hero-recording")).toBeNull();
+ });
+
+ test("scrubbed failed runs can open the recording from the inspection overlay", () => {
+ useRunViewStore.getState().pinFrame("f1");
+ render(
+ <RunHero
+ {...baseProps}
+ showDebugStream={false}
+ running={false}
+ failed
+ recordingUrls={["https://example.com/rec.mp4"]}
+ heroSelection={{ kind: "thought", thoughtId: "t1" }}
+ heroLabel="Failure frame"
+ />,
+ );
+
+ expect(screen.queryByTestId("hero-screenshot")).not.toBeNull();
+ expect(screen.queryByTestId("hero-recording")).toBeNull();
+
+ const overlay = screen.getByText("Failure frame").closest("div");
+ if (!overlay) {
+ throw new Error("Expected the inspection overlay to be visible");
+ }
+
+ fireEvent.click(within(overlay).getByRole("button", { name: "Recording" }));
+ expect(screen.queryByTestId("hero-recording")).not.toBeNull();
+ expect(screen.queryByTestId("hero-screenshot")).toBeNull();
+ });
+});
+
describe("RunHero failure banner", () => {
const failedProps = {
...baseProps,
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.tsx
index 3732c0033..dcb0e41c9 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.tsx
@@ -15,7 +15,7 @@ import {
import { Button } from "@/components/ui/button";
import { StreamStatusPanel } from "@/routes/streaming/StreamDiagnostics";
-import { type RunCenterView, useRunViewStore } from "@/store/RunViewStore";
+import { useRunViewStore } from "@/store/RunViewStore";
import { cn } from "@/util/utils";
import { WorkflowRunCode } from "../../workflowRun/WorkflowRunCode";
@@ -23,6 +23,7 @@ import { useStudioShellContext } from "../StudioShellContext";
import { matchFailureTips } from "./failureTips";
import { HeroRecording } from "./HeroRecording";
import { HeroScreenshot, type HeroSelection } from "./HeroScreenshot";
+import { resolveRunHeroCenterView } from "./runHeroCenter";
import { RunLiveStream } from "./RunLiveStream";
type RunHeroProps = {
@@ -59,78 +60,12 @@ type RunHeroProps = {
onRetry?: () => void;
};
-type CenterView =
- | "code"
- | "inputs"
- | "outputs"
- | "stream"
- | "recording"
- | "screenshot";
-
// Below this header width the toggle/dropdown labels collapse to icons.
const HEADER_COMPACT_BELOW_PX = 640;
const RECORDING_ARCHIVED_LABEL =
"Recording archived — contact [email protected] to request restoration";
-// RunCenterView stores user intent; the hero renders screenshots in one surface.
-function resolveCenterView({
- centerView,
- hasScreenshots,
- hasInputs,
- hasOutputs,
- scrubbing,
- showDebugStream,
- debugStreamInBrowserPane,
- recordingOpen,
- hasRecording,
- running,
- failed,
-}: {
- centerView: RunCenterView;
- hasScreenshots: boolean;
- hasInputs: boolean;
- hasOutputs: boolean;
- scrubbing: boolean;
- showDebugStream: boolean;
- debugStreamInBrowserPane: boolean;
- recordingOpen: boolean;
- hasRecording: boolean;
- running: boolean;
- failed: boolean;
-}): CenterView {
- if (centerView === "screenshots" && hasScreenshots) {
- return "screenshot";
- }
- if (centerView === "code") {
- return "code";
- }
- if (centerView === "inputs" && hasInputs) {
- return "inputs";
- }
- if (centerView === "outputs" && hasOutputs) {
- return "outputs";
- }
- if (scrubbing) {
- return "screenshot";
- }
- if (showDebugStream) {
- if (recordingOpen && hasRecording) {
- return "recording";
- }
- // The Browser pane owns the singleton stream node; the hero shows
- // live-edge screenshots and its Live chip points at that pane instead.
- return debugStreamInBrowserPane ? "screenshot" : "stream";
- }
- if (running) {
- return "stream";
- }
- if (hasRecording && !failed) {
- return "recording";
- }
- return "screenshot";
-}
-
function ViewToggle({
active,
onClick,
@@ -235,18 +170,16 @@ export function RunHero({
const scrubbing = pinnedFrameId != null && pinnedFrameId !== "stream";
const hasRecording = recordingUrls.length > 0;
- // An explicit tab wins; otherwise a block run defaults to the live debug
- // stream and a full run to its stream (running) / recording / screenshot.
- const center = resolveCenterView({
+ const center = resolveRunHeroCenterView({
centerView,
hasScreenshots,
hasInputs: Boolean(inputs),
hasOutputs: Boolean(outputs),
+ hasRecording,
scrubbing,
showDebugStream,
debugStreamInBrowserPane,
recordingOpen,
- hasRecording,
running,
failed,
});
@@ -272,6 +205,8 @@ export function RunHero({
const toggleCenter = (view: "code" | "inputs" | "outputs") =>
setCenterView(centerView === view ? "default" : view);
+ const showRunToggle =
+ Boolean(heroSelection) || centerView === "screenshot" || failed;
return (
<div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-border bg-slate-elevation1">
@@ -331,13 +266,24 @@ export function RunHero({
}
/>
) : hasRecording ? (
- <ViewToggle
- active={center === "recording"}
- onClick={jumpToLive}
- compact={compact}
- label="Recording"
- icon={<PlayIcon className="h-3 w-3" />}
- />
+ <>
+ {showRunToggle ? (
+ <ViewToggle
+ active={center === "screenshot"}
+ onClick={() => setCenterView("screenshot")}
+ compact={compact}
+ label="Run"
+ icon={<CounterClockwiseClockIcon className="h-3 w-3" />}
+ />
+ ) : null}
+ <ViewToggle
+ active={center === "recording"}
+ onClick={() => setCenterView("recording")}
+ compact={compact}
+ label="Recording"
+ icon={<PlayIcon className="h-3 w-3" />}
+ />
+ </>
) : recordingArchived ? (
<button
type="button"
@@ -521,7 +467,10 @@ export function RunHero({
) : hasRecording ? (
<button
type="button"
- onClick={jumpToLive}
+ onClick={() => {
+ // Preserve the inspected frame so "Run" returns to this step.
+ setCenterView("recording");
+ }}
className="ml-1 inline-flex items-center gap-1.5 rounded-full bg-white/15 px-2 py-0.5 text-[11px] hover:bg-white/25 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white"
>
<PlayIcon className="h-3 w-3" />
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx
index 701f26462..a195eed1d 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx
@@ -18,6 +18,7 @@ import type {
WorkflowRunTimelineItem,
} from "../../types/workflowRunTypes";
import { RunView } from "./RunView";
+import { getSelectedRunFrameId } from "./runFrameSelection";
const mocks = vi.hoisted(() => ({
workflowRun: undefined as unknown,
@@ -182,6 +183,80 @@ afterEach(() => {
});
beforeEach(() => useRunViewStore.getState().reset());
+describe("getSelectedRunFrameId", () => {
+ test("defaults to live stream while a run is running", () => {
+ expect(
+ getSelectedRunFrameId({
+ pinnedFrameId: null,
+ running: true,
+ lastFrameId: "action_1",
+ }),
+ ).toBe("stream");
+ });
+
+ test("preserves an explicit pinned frame while a run is running", () => {
+ expect(
+ getSelectedRunFrameId({
+ pinnedFrameId: "action_1",
+ running: true,
+ lastFrameId: "action_2",
+ }),
+ ).toBe("action_1");
+ });
+
+ test("uses the latest frame while a running run shows screenshots", () => {
+ expect(
+ getSelectedRunFrameId({
+ pinnedFrameId: null,
+ running: true,
+ showingScreenshots: true,
+ lastFrameId: "action_2",
+ }),
+ ).toBe("action_2");
+ });
+
+ test("uses the final frame after a live stream pin outlives a completed run", () => {
+ expect(
+ getSelectedRunFrameId({
+ pinnedFrameId: "stream",
+ running: false,
+ lastFrameId: "action_2",
+ }),
+ ).toBe("action_2");
+ });
+
+ test("preserves an explicit pinned frame after a run finalizes", () => {
+ expect(
+ getSelectedRunFrameId({
+ pinnedFrameId: "action_1",
+ running: false,
+ lastFrameId: "action_2",
+ }),
+ ).toBe("action_1");
+ });
+
+ test("defaults to the final frame after a run finalizes without a pin", () => {
+ expect(
+ getSelectedRunFrameId({
+ pinnedFrameId: null,
+ running: false,
+ lastFrameId: "action_2",
+ }),
+ ).toBe("action_2");
+ });
+
+ test("uses the latest frame while the Browser pane owns a live debug stream", () => {
+ expect(
+ getSelectedRunFrameId({
+ pinnedFrameId: null,
+ running: true,
+ debugStreamInBrowserPane: true,
+ lastFrameId: "action_2",
+ }),
+ ).toBe("action_2");
+ });
+});
+
function seedLiveBlockRun() {
mocks.debugSession = { browser_session_id: "pbs_1" };
mocks.timeline = [
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx
index 553ba5e58..d50a2b93d 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx
@@ -49,6 +49,7 @@ import { RunInputsSection, type RunInputMeta } from "./RunInputsSection";
import { RunOutputsSection, type RunOutputFile } from "./RunOutputsSection";
import { RunOverviewButton } from "./RunOverviewButton";
import { RunPlaceholder } from "./RunPlaceholder";
+import { getSelectedRunFrameId } from "./runFrameSelection";
type RunViewProps = {
workflowRunId?: string;
@@ -257,16 +258,13 @@ export function RunView({
const finalized = workflowRun ? statusIsFinalized(workflowRun) : false;
const finallyBlockLabel =
workflowRun?.workflow?.workflow_definition?.finally_block_label ?? null;
- const rawSelectedId =
- pinnedFrameId ??
- (running && !showingScreenshots ? "stream" : lastFrame?.id) ??
- null;
- // A "stream" selection has no hero surface while the Browser pane hosts the
- // debug node; follow the newest frame so screenshots track the live edge.
- const selectedId =
- rawSelectedId === "stream" && debugStreamInBrowserPane
- ? (lastFrame?.id ?? null)
- : rawSelectedId;
+ const selectedId = getSelectedRunFrameId({
+ pinnedFrameId,
+ running,
+ showingScreenshots,
+ debugStreamInBrowserPane,
+ lastFrameId: lastFrame?.id ?? null,
+ });
const activeItem = useMemo(
() =>
findActiveItem(timeline ?? [], selectedId, finalized, finallyBlockLabel),
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/runFrameSelection.ts b/skyvern-frontend/src/routes/workflows/studio/runview/runFrameSelection.ts
new file mode 100644
index 000000000..7dd4c179d
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/runFrameSelection.ts
@@ -0,0 +1,25 @@
+export function getSelectedRunFrameId({
+ pinnedFrameId,
+ running,
+ showingScreenshots = false,
+ debugStreamInBrowserPane = false,
+ lastFrameId,
+}: {
+ pinnedFrameId: string | null;
+ running: boolean;
+ showingScreenshots?: boolean;
+ debugStreamInBrowserPane?: boolean;
+ lastFrameId: string | null;
+}): string | null {
+ const selectedId =
+ running && !showingScreenshots
+ ? (pinnedFrameId ?? "stream")
+ : pinnedFrameId === "stream"
+ ? lastFrameId
+ : (pinnedFrameId ?? lastFrameId);
+
+ if (selectedId === "stream" && debugStreamInBrowserPane) {
+ return lastFrameId;
+ }
+ return selectedId;
+}
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/runHeroCenter.test.ts b/skyvern-frontend/src/routes/workflows/studio/runview/runHeroCenter.test.ts
new file mode 100644
index 000000000..436e9bceb
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/runHeroCenter.test.ts
@@ -0,0 +1,149 @@
+import { describe, expect, test } from "vitest";
+
+import { resolveRunHeroCenterView } from "./runHeroCenter";
+
+const defaultArgs = {
+ centerView: "default" as const,
+ hasScreenshots: false,
+ hasInputs: false,
+ hasOutputs: false,
+ hasRecording: false,
+ scrubbing: false,
+ showDebugStream: false,
+ debugStreamInBrowserPane: false,
+ recordingOpen: false,
+ running: false,
+ failed: false,
+};
+
+describe("resolveRunHeroCenterView", () => {
+ test("uses the screenshots tab when screenshots are available", () => {
+ expect(
+ resolveRunHeroCenterView({
+ ...defaultArgs,
+ centerView: "screenshots",
+ hasScreenshots: true,
+ }),
+ ).toBe("screenshot");
+ });
+
+ test("uses explicit content tabs when their content exists", () => {
+ expect(
+ resolveRunHeroCenterView({
+ ...defaultArgs,
+ centerView: "code",
+ }),
+ ).toBe("code");
+ expect(
+ resolveRunHeroCenterView({
+ ...defaultArgs,
+ centerView: "inputs",
+ hasInputs: true,
+ }),
+ ).toBe("inputs");
+ expect(
+ resolveRunHeroCenterView({
+ ...defaultArgs,
+ centerView: "outputs",
+ hasOutputs: true,
+ }),
+ ).toBe("outputs");
+ });
+
+ test("falls back when an explicit content tab has no content", () => {
+ expect(
+ resolveRunHeroCenterView({
+ ...defaultArgs,
+ centerView: "inputs",
+ hasRecording: true,
+ }),
+ ).toBe("recording");
+ expect(
+ resolveRunHeroCenterView({
+ ...defaultArgs,
+ centerView: "outputs",
+ }),
+ ).toBe("screenshot");
+ });
+
+ test("keeps explicit recording and run-frame overrides in finalized runs", () => {
+ expect(
+ resolveRunHeroCenterView({
+ ...defaultArgs,
+ centerView: "recording",
+ hasRecording: true,
+ }),
+ ).toBe("recording");
+ expect(
+ resolveRunHeroCenterView({
+ ...defaultArgs,
+ centerView: "screenshot",
+ hasRecording: true,
+ }),
+ ).toBe("screenshot");
+ });
+
+ test("prioritizes scrubbed run frames before live or recording defaults", () => {
+ expect(
+ resolveRunHeroCenterView({
+ ...defaultArgs,
+ scrubbing: true,
+ showDebugStream: true,
+ recordingOpen: true,
+ hasRecording: true,
+ }),
+ ).toBe("screenshot");
+ });
+
+ test("defaults block runs to the live debug stream unless recording is open", () => {
+ expect(
+ resolveRunHeroCenterView({
+ ...defaultArgs,
+ showDebugStream: true,
+ hasRecording: true,
+ }),
+ ).toBe("stream");
+ expect(
+ resolveRunHeroCenterView({
+ ...defaultArgs,
+ showDebugStream: true,
+ recordingOpen: true,
+ hasRecording: true,
+ }),
+ ).toBe("recording");
+ });
+
+ test("uses screenshots while the Browser pane owns a block run debug stream", () => {
+ expect(
+ resolveRunHeroCenterView({
+ ...defaultArgs,
+ showDebugStream: true,
+ debugStreamInBrowserPane: true,
+ hasRecording: true,
+ }),
+ ).toBe("screenshot");
+ });
+
+ test("defaults full runs by lifecycle and failure state", () => {
+ expect(
+ resolveRunHeroCenterView({
+ ...defaultArgs,
+ running: true,
+ hasRecording: true,
+ }),
+ ).toBe("stream");
+ expect(
+ resolveRunHeroCenterView({
+ ...defaultArgs,
+ hasRecording: true,
+ }),
+ ).toBe("recording");
+ expect(
+ resolveRunHeroCenterView({
+ ...defaultArgs,
+ failed: true,
+ hasRecording: true,
+ }),
+ ).toBe("screenshot");
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/runHeroCenter.ts b/skyvern-frontend/src/routes/workflows/studio/runview/runHeroCenter.ts
new file mode 100644
index 000000000..e2bb4dd08
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/runHeroCenter.ts
@@ -0,0 +1,73 @@
+import type { RunCenterView } from "@/store/RunViewStore";
+
+// Rendered center panels are narrower than store intents: "default" is resolved
+// away here, while "stream" is renderer-only and never stored as a center tab.
+export type RunHeroCenterView =
+ | "code"
+ | "inputs"
+ | "outputs"
+ | "stream"
+ | "recording"
+ | "screenshot";
+
+type ResolveRunHeroCenterViewArgs = {
+ centerView: RunCenterView;
+ hasScreenshots: boolean;
+ hasInputs: boolean;
+ hasOutputs: boolean;
+ hasRecording: boolean;
+ scrubbing: boolean;
+ showDebugStream: boolean;
+ debugStreamInBrowserPane: boolean;
+ recordingOpen: boolean;
+ running: boolean;
+ failed: boolean;
+};
+
+export function resolveRunHeroCenterView({
+ centerView,
+ hasScreenshots,
+ hasInputs,
+ hasOutputs,
+ hasRecording,
+ scrubbing,
+ showDebugStream,
+ debugStreamInBrowserPane,
+ recordingOpen,
+ running,
+ failed,
+}: ResolveRunHeroCenterViewArgs): RunHeroCenterView {
+ if (centerView === "screenshots" && hasScreenshots) {
+ return "screenshot";
+ }
+ if (centerView === "code") {
+ return "code";
+ }
+ if (centerView === "inputs" && hasInputs) {
+ return "inputs";
+ }
+ if (centerView === "outputs" && hasOutputs) {
+ return "outputs";
+ }
+ if (centerView === "recording" && hasRecording) {
+ return "recording";
+ }
+ // A recording override can outlive the URLs during a reload; use the normal
+ // fallback order until there is a recording to render.
+ if (centerView === "screenshot") {
+ return "screenshot";
+ }
+ if (scrubbing) {
+ return "screenshot";
+ }
+ if (showDebugStream) {
+ if (recordingOpen && hasRecording) {
+ return "recording";
+ }
+ return debugStreamInBrowserPane ? "screenshot" : "stream";
+ }
+ if (running) {
+ return "stream";
+ }
+ return hasRecording && !failed ? "recording" : "screenshot";
+}
diff --git a/skyvern-frontend/src/store/RunViewStore.ts b/skyvern-frontend/src/store/RunViewStore.ts
index b4f098119..15f108b00 100644
--- a/skyvern-frontend/src/store/RunViewStore.ts
+++ b/skyvern-frontend/src/store/RunViewStore.ts
@@ -5,6 +5,8 @@ import { create } from "zustand";
export type RunCenterView =
| "default"
| "screenshots"
+ | "recording"
+ | "screenshot"
| "code"
| "inputs"
| "outputs";
diff --git a/skyvern-frontend/src/store/StudioShellStore.test.ts b/skyvern-frontend/src/store/StudioShellStore.test.ts
new file mode 100644
index 000000000..310a2a6bb
--- /dev/null
+++ b/skyvern-frontend/src/store/StudioShellStore.test.ts
@@ -0,0 +1,45 @@
+// @vitest-environment jsdom
+
+import { beforeEach, describe, expect, test } from "vitest";
+
+import {
+ STUDIO_SHELL_STORAGE_KEY,
+ useStudioShellStore,
+} from "./StudioShellStore";
+
+beforeEach(() => {
+ localStorage.clear();
+ useStudioShellStore.getState().reset();
+});
+
+describe("StudioShellStore", () => {
+ test("defaults PiP to expanded", () => {
+ expect(useStudioShellStore.getState().pipMinimized).toBe(false);
+ });
+
+ test("persists only PiP shell state", () => {
+ useStudioShellStore.getState().setPipMinimized(true);
+
+ const raw = localStorage.getItem(STUDIO_SHELL_STORAGE_KEY);
+ expect(raw).not.toBeNull();
+ expect(JSON.parse(raw!).state).toEqual({ pipMinimized: true });
+ });
+
+ test("migrates stale v0 Copilot collapse without restoring it", async () => {
+ localStorage.setItem(
+ STUDIO_SHELL_STORAGE_KEY,
+ JSON.stringify({
+ state: { copilotCollapsed: true, pipMinimized: true },
+ version: 0,
+ }),
+ );
+
+ await useStudioShellStore.persist.rehydrate();
+
+ const state = useStudioShellStore.getState();
+ expect(state.pipMinimized).toBe(true);
+ expect(
+ "copilotCollapsed" in (state as unknown as Record<string, unknown>),
+ ).toBe(false);
+ });
+});