Skip to content

Automate browser based workflows with AI

feat(SKY-11764): workflow studio launch polish — button grammar, pane UX, run-view defaults, resilience (#7056)

Celal Zamanoğluc7fead53ffe9
diff --git a/skyvern-frontend/src/components/ApiWebhookActionsMenu.tsx b/skyvern-frontend/src/components/ApiWebhookActionsMenu.tsx
index 13b1b4831..2c11e1bcf 100644
--- a/skyvern-frontend/src/components/ApiWebhookActionsMenu.tsx
+++ b/skyvern-frontend/src/components/ApiWebhookActionsMenu.tsx
@@ -1,4 +1,4 @@
-import { type ReactElement } from "react";
+import { type ReactElement, type ReactNode } from "react";
import { Button } from "@/components/ui/button";
import {
@@ -9,6 +9,11 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
import { toast } from "@/components/ui/use-toast";
import { copyText } from "@/util/copyText";
import {
@@ -25,6 +30,8 @@ type ApiWebhookActionsMenuProps = {
// Single element forwarded to the trigger via Radix `asChild`; when set,
// `size` is unused. Defaults to the solid secondary button (legacy pages).
trigger?: ReactElement;
+ // Radix tooltip on the trigger; the host must provide a TooltipProvider.
+ triggerTooltip?: ReactNode;
};
export function ApiWebhookActionsMenu({
@@ -33,16 +40,27 @@ export function ApiWebhookActionsMenu({
onTestWebhook,
size = "default",
trigger,
+ triggerTooltip,
}: ApiWebhookActionsMenuProps) {
+ const menuTrigger = (
+ <DropdownMenuTrigger asChild>
+ {trigger ?? (
+ <Button type="button" variant="secondary" size={size}>
+ API & Webhooks
+ </Button>
+ )}
+ </DropdownMenuTrigger>
+ );
return (
<DropdownMenu>
- <DropdownMenuTrigger asChild>
- {trigger ?? (
- <Button type="button" variant="secondary" size={size}>
- API & Webhooks
- </Button>
- )}
- </DropdownMenuTrigger>
+ {triggerTooltip ? (
+ <Tooltip>
+ <TooltipTrigger asChild>{menuTrigger}</TooltipTrigger>
+ <TooltipContent side="bottom">{triggerTooltip}</TooltipContent>
+ </Tooltip>
+ ) : (
+ menuTrigger
+ )}
<DropdownMenuContent>
<DropdownMenuLabel className="py-2 text-base">
Re-run via API
diff --git a/skyvern-frontend/src/index.css b/skyvern-frontend/src/index.css
index e753a1e1c..9f76d965c 100644
--- a/skyvern-frontend/src/index.css
+++ b/skyvern-frontend/src/index.css
@@ -54,11 +54,6 @@
--radius: 0.5rem;
- /* studio editor brand accent (#6d6cf6) — opt-in via `studio-accent` utilities, scoped to the workflow studio */
- --studio-accent: 244.8 84.4% 60%;
- --studio-accent-foreground: 0 0% 100%;
- --studio-accent-2: 244.5 100% 71.4%;
-
--slate-elevation-1: 0 0% 98%;
--slate-elevation-2: 0 0% 96%;
--slate-elevation-3: 0 0% 93%;
diff --git a/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx b/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx
index 643452d26..e73a33d2a 100644
--- a/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx
+++ b/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx
@@ -6,7 +6,7 @@ import {
} from "@radix-ui/react-icons";
import { type ReactNode, useEffect, useMemo, useState } from "react";
import { type FieldErrors, useForm } from "react-hook-form";
-import { Link, useLocation, useNavigate, useParams } from "react-router-dom";
+import { Link, useNavigate, useParams } from "react-router-dom";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { z } from "zod";
@@ -47,13 +47,6 @@ import { useBlockScriptsQuery } from "@/routes/workflows/hooks/useBlockScriptsQu
import { constructCacheKeyValueFromParameters } from "@/routes/workflows/editor/utils";
import { useWorkflowQuery } from "@/routes/workflows/hooks/useWorkflowQuery";
import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";
-import { liveSearch } from "@/routes/workflows/studio/liveSearch";
-import {
- RUN_APPEND_PANES,
- STUDIO_PANES_PARAM,
- parsePanesParam,
- withPanesOpen,
-} from "@/routes/workflows/studio/panes";
import { workflowEditorPath } from "./studioNavigation";
import { CredentialSetupPrompt } from "@/components/onboarding/CredentialSetupPrompt";
import { useFeatureFlagVariantKey } from "posthog-js/react";
@@ -331,7 +324,6 @@ function RunWorkflowForm({
const { workflowPermanentId } = useParams();
const credentialGetter = useCredentialGetter();
const navigate = useNavigate();
- const location = useLocation();
const studioEnabled = useWorkflowStudioEnabled();
const queryClient = useQueryClient();
const apiCredential = useApiCredential();
@@ -410,23 +402,11 @@ function RunWorkflowForm({
queryClient.invalidateQueries({
queryKey: ["runs"],
});
- // Only studio-originated launches (Run button, Timeline retry) carry
- // ?panes=; its presence — even explicitly empty (all panes closed) —
- // marks the origin and holds the layout to return to, so the round-trip
- // appends the run surfaces instead of remapping. liveSearch guards this
- // mutation callback against a stale ?panes= closure.
- const carriedPanes = parsePanesParam(
- new URLSearchParams(liveSearch(location.search)).get(
- STUDIO_PANES_PARAM,
- ),
- );
- if (studioEnabled && carriedPanes !== null) {
- const panes = withPanesOpen(carriedPanes, RUN_APPEND_PANES);
- navigate(
- `/agents/${workflowPermanentId}/studio?wr=${response.data.workflow_run_id}&${STUDIO_PANES_PARAM}=${panes.join(",")}`,
- );
- } else if (studioEnabled) {
- // Land in the studio shell; the ?wr= deep link maps the panes.
+ if (studioEnabled) {
+ // A full-run start RESETS the layout: land on the bare ?wr= deep link
+ // so the run mapping (copilot, browser, overview) applies exactly as
+ // it does when cold-entering a run — the editor doesn't ride along
+ // into run-watching. Block runs keep their own append path.
navigate(
`/agents/${workflowPermanentId}/studio?wr=${response.data.workflow_run_id}`,
);
diff --git a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx
index dacb9a8bb..5f266622a 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx
+++ b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx
@@ -20,6 +20,7 @@ import { createPortal } from "react-dom";
import { stringify as convertToYAML } from "yaml";
import { useWorkflowHasChangesStore } from "@/store/WorkflowHasChangesStore";
import { useCopilotActionStore } from "@/store/useCopilotActionStore";
+import { useCopilotHeaderStore } from "@/store/useCopilotHeaderStore";
import { WorkflowCreateYAMLRequest } from "@/routes/workflows/types/workflowYamlTypes";
import { WorkflowApiResponse } from "@/routes/workflows/types/workflowTypes";
import { toast } from "@/components/ui/use-toast";
@@ -806,6 +807,32 @@ export function WorkflowCopilotChat({
[loadChatInPlace],
);
+ // Hand the studio's Copilot pane header its History/New-chat controls.
+ // Stable wrappers over refs keep the registration limited to value changes.
+ const headerHandlersRef = useRef({ handleSelectHistoryChat, handleNewChat });
+ headerHandlersRef.current = { handleSelectHistoryChat, handleNewChat };
+ const headerControlsDisabled = isLoading || isLoadingHistory;
+ useEffect(() => {
+ if (!docked) {
+ return;
+ }
+ const store = useCopilotHeaderStore.getState();
+ store.setControls({
+ workflowPermanentId,
+ currentChatId: workflowCopilotChatId,
+ onSelectChat: (chat) =>
+ headerHandlersRef.current.handleSelectHistoryChat(chat),
+ onNewChat: () => headerHandlersRef.current.handleNewChat(),
+ disabled: headerControlsDisabled,
+ });
+ return () => store.setControls(null);
+ }, [
+ docked,
+ workflowPermanentId,
+ workflowCopilotChatId,
+ headerControlsDisabled,
+ ]);
+
const applyWorkflowUpdate = useCallback(
(
workflow: WorkflowApiResponse,
@@ -2085,61 +2112,62 @@ export function WorkflowCopilotChat({
}
}
>
- {/* Header */}
- <div
- className={
- "flex items-center border-b border-border px-4" +
- (docked
- ? chromeless
- ? " h-11 shrink-0 justify-end"
- : " h-14 shrink-0 justify-between"
- : " cursor-move justify-between py-2")
- }
- onMouseDown={docked ? undefined : handleMouseDown}
- >
- {chromeless ? null : (
+ {/* Header. The studio (chromeless) hosts History/New chat in its
+ Copilot pane header via useCopilotHeaderStore — no row here. */}
+ {chromeless ? null : (
+ <div
+ className={
+ "flex items-center border-b border-border px-4" +
+ (docked
+ ? " h-14 shrink-0 justify-between"
+ : " cursor-move justify-between py-2")
+ }
+ onMouseDown={docked ? undefined : handleMouseDown}
+ >
+ {chromeless ? null : (
+ <div className="flex items-center gap-2">
+ <h3 className="text-sm font-semibold text-foreground">
+ {docked ? "Copilot" : "Agent Copilot (Beta)"}
+ </h3>
+ {docked ? (
+ <span className="rounded bg-slate-elevation3 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground">
+ Beta
+ </span>
+ ) : null}
+ </div>
+ )}
<div className="flex items-center gap-2">
- <h3 className="text-sm font-semibold text-foreground">
- {docked ? "Copilot" : "Agent Copilot (Beta)"}
- </h3>
- {docked ? (
- <span className="rounded bg-studio-accent/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-studio-accent-2">
- Beta
- </span>
- ) : null}
- </div>
- )}
- <div className="flex items-center gap-2">
- <WorkflowCopilotHistory
- workflowPermanentId={workflowPermanentId}
- currentChatId={workflowCopilotChatId}
- onSelect={handleSelectHistoryChat}
- disabled={isLoading || isLoadingHistory}
- />
- <button
- type="button"
- onClick={handleNewChat}
- onMouseDown={(e) => e.stopPropagation()}
- className="rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground"
- >
- New chat
- </button>
- <div className="h-2 w-2 rounded-full bg-emerald-500"></div>
- <span className="text-xs text-muted-foreground">Active</span>
- {/* Only the floating window closes itself; docked chrome is external. */}
- {docked ? null : (
+ <WorkflowCopilotHistory
+ workflowPermanentId={workflowPermanentId}
+ currentChatId={workflowCopilotChatId}
+ onSelect={handleSelectHistoryChat}
+ disabled={isLoading || isLoadingHistory}
+ />
<button
type="button"
- onClick={() => onClose?.()}
+ onClick={handleNewChat}
onMouseDown={(e) => e.stopPropagation()}
- className="ml-2 rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground"
- title="Close"
+ className="rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground"
>
- <Cross2Icon className="h-4 w-4" />
+ New chat
</button>
- )}
+ <div className="h-2 w-2 rounded-full bg-emerald-500"></div>
+ <span className="text-xs text-muted-foreground">Active</span>
+ {/* Only the floating window closes itself; docked chrome is external. */}
+ {docked ? null : (
+ <button
+ type="button"
+ onClick={() => onClose?.()}
+ onMouseDown={(e) => e.stopPropagation()}
+ className="ml-2 rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground"
+ title="Close"
+ >
+ <Cross2Icon className="h-4 w-4" />
+ </button>
+ )}
+ </div>
</div>
- </div>
+ )}
{/* Messages */}
<div className="relative min-h-0 flex-1">
diff --git a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotHistory.tsx b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotHistory.tsx
index 1b873249b..751ebb4a7 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotHistory.tsx
+++ b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotHistory.tsx
@@ -11,6 +11,11 @@ import {
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
import { Skeleton } from "@/components/ui/skeleton";
import { handleInfiniteScroll } from "@/util/utils";
import { compactLocalDateTime } from "@/util/timeFormat";
@@ -23,6 +28,8 @@ interface WorkflowCopilotHistoryProps {
currentChatId: string | null;
onSelect: (chat: WorkflowCopilotChatSummary) => void;
disabled?: boolean;
+ // Icon-only trigger (narrow pane headers); the label moves to a tooltip.
+ compact?: boolean;
}
interface WorkflowCopilotHistoryContentProps {
@@ -138,6 +145,7 @@ function WorkflowCopilotHistory({
currentChatId,
onSelect,
disabled = false,
+ compact = false,
}: WorkflowCopilotHistoryProps) {
const [open, setOpen] = useState(false);
@@ -154,19 +162,38 @@ function WorkflowCopilotHistory({
onSelect(chat);
}
+ const trigger = (
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ disabled={disabled}
+ aria-label="History"
+ onMouseDown={(e) => e.stopPropagation()}
+ className={
+ compact
+ ? "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50"
+ : "flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-50"
+ }
+ >
+ <CounterClockwiseClockIcon
+ className={compact ? "h-3.5 w-3.5" : "h-3 w-3"}
+ aria-hidden="true"
+ />
+ {compact ? null : "History"}
+ </button>
+ </PopoverTrigger>
+ );
+
return (
<Popover open={open} onOpenChange={setOpen}>
- <PopoverTrigger asChild>
- <button
- type="button"
- disabled={disabled}
- onMouseDown={(e) => e.stopPropagation()}
- className="flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-50"
- >
- <CounterClockwiseClockIcon className="h-3 w-3" aria-hidden="true" />
- History
- </button>
- </PopoverTrigger>
+ {compact ? (
+ <Tooltip>
+ <TooltipTrigger asChild>{trigger}</TooltipTrigger>
+ <TooltipContent side="bottom">History</TooltipContent>
+ </Tooltip>
+ ) : (
+ trigger
+ )}
<PopoverContent
className="w-80 p-0"
align="end"
diff --git a/skyvern-frontend/src/routes/workflows/copilot/cards/DiffCard.tsx b/skyvern-frontend/src/routes/workflows/copilot/cards/DiffCard.tsx
index 444860e20..0d3f5f507 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/cards/DiffCard.tsx
+++ b/skyvern-frontend/src/routes/workflows/copilot/cards/DiffCard.tsx
@@ -36,7 +36,7 @@ export function DiffCard({
return (
<div className="rounded-lg border border-border bg-slate-elevation2 p-3">
- <div className="flex items-center gap-2 text-xs font-semibold text-studio-accent-2">
+ <div className="flex items-center gap-2 text-xs font-semibold text-foreground">
<MagicWandIcon className="h-3.5 w-3.5" />
{getDiffCardTitle(turn, { pendingProposal, rejected })}
</div>
diff --git a/skyvern-frontend/src/routes/workflows/copilot/cards/FixCard.tsx b/skyvern-frontend/src/routes/workflows/copilot/cards/FixCard.tsx
index f9543a89d..586a1da2d 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/cards/FixCard.tsx
+++ b/skyvern-frontend/src/routes/workflows/copilot/cards/FixCard.tsx
@@ -47,7 +47,7 @@ export function FixCard({ turn, onFix, onExplain }: FixCardProps) {
<button
type="button"
onClick={onFix}
- className="rounded-md bg-studio-accent px-3 py-1 text-xs font-medium text-foreground hover:bg-studio-accent/90"
+ className="rounded-md bg-cta px-3 py-1 text-xs font-medium text-cta-foreground hover:bg-cta-hover"
>
Fix with Copilot
</button>
diff --git a/skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx b/skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx
index 63c314bbc..b2e2a6525 100644
--- a/skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx
@@ -433,7 +433,8 @@ type Props = {
// Embedded in the studio shell: aligns the block-config sidebar's top/bottom
// edges with the Copilot column instead of the legacy header offsets.
embedded?: boolean;
- // Studio open-pane key; a change recenters the canvas once the layout settles.
+ // Studio pane-layout key (open set + committed divider widths); a change
+ // recenters the canvas once the layout settles.
paneLayoutKey?: string;
};
@@ -1733,9 +1734,11 @@ function FlowRenderer({
runStartAnchoredFit({ width: rect.width, height: rect.height });
}, [embedded, layoutPhase, nodesInitialized, runStartAnchoredFit]);
- // Pane-set/order changes are explicit recenter triggers: a sibling pane
- // toggling shifts the canvas without tripping the stranded threshold, but
- // the flow should read as centered again once the layout settles.
+ // Pane-set/order changes and committed divider resizes (drag release,
+ // double-click reset, keyboard step) are explicit recenter triggers: they
+ // shift the canvas without tripping the stranded threshold, but the flow
+ // should read as centered again once the layout settles. Live drags never
+ // re-fit per frame — widths only commit to the store on release.
const prevPaneLayoutKeyRef = useRef(paneLayoutKey);
useEffect(() => {
if (!embedded || paneLayoutKey === undefined) {
diff --git a/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.test.tsx b/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.test.tsx
new file mode 100644
index 000000000..8b3875cdb
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.test.tsx
@@ -0,0 +1,189 @@
+// @vitest-environment jsdom
+
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { cleanup, render, screen } from "@testing-library/react";
+import { MemoryRouter, Route, Routes } from "react-router-dom";
+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
+
+import { Status } from "@/api/types";
+
+const { workflowQueryMock, runQueryMock, runsQueryMock } = vi.hoisted(() => ({
+ workflowQueryMock: vi.fn(),
+ runQueryMock: vi.fn(),
+ runsQueryMock: vi.fn(),
+}));
+
+vi.mock("@/hooks/useWorkflowStudioEnabled", () => ({
+ useWorkflowStudioEnabled: () => true,
+}));
+vi.mock("../hooks/useWorkflowQuery", () => ({
+ useWorkflowQuery: () => workflowQueryMock(),
+}));
+vi.mock("../hooks/useGlobalWorkflowsQuery", () => ({
+ useGlobalWorkflowsQuery: () => ({ data: [], isLoading: false }),
+}));
+vi.mock("../hooks/useWorkflowRunWithWorkflowQuery", () => ({
+ useWorkflowRunWithWorkflowQuery: () => runQueryMock(),
+}));
+vi.mock("../hooks/useWorkflowRunsQuery", () => ({
+ useWorkflowRunsQuery: () => runsQueryMock(),
+}));
+// Pane bodies own their data wiring (tested in their own suites); the shell
+// contract under test is which of them mount and how the chrome degrades.
+vi.mock("../studio/EditorTab", () => ({
+ EditorTab: () => <div data-testid="editor-tab-body" />,
+}));
+vi.mock("../studio/BrowserTab", () => ({
+ BrowserTab: () => <div data-testid="browser-tab-body" />,
+}));
+vi.mock("../studio/RunTab", () => ({
+ RunTab: () => <div data-testid="run-view-body" />,
+}));
+vi.mock("../studio/StudioBrowserStream", () => ({
+ StudioBrowserStream: () => null,
+}));
+vi.mock("../studio/StudioWorkflowPanels", () => ({
+ StudioWorkflowPanels: () => null,
+}));
+vi.mock("../studio/runview/RunPaneHeader", () => ({
+ RunPaneViewToggles: () => null,
+ RunPaneActions: () => null,
+}));
+vi.mock("@/components/onboarding/ProductTour", () => ({
+ ProductTour: () => null,
+}));
+
+import { WorkflowEditor } from "./WorkflowEditor";
+
+const deletedWorkflow = {
+ workflow_permanent_id: "wpid_del",
+ title: "Deleted agent",
+ deleted_at: "2026-07-01T12:00:00Z",
+ workflow_definition: { blocks: [], parameters: [] },
+ proxy_location: null,
+ webhook_callback_url: null,
+ persist_browser_session: false,
+ cache_key: "",
+} as never;
+
+const liveWorkflow = {
+ workflow_permanent_id: "wpid_live",
+ title: "Live agent",
+ deleted_at: null,
+ workflow_definition: { blocks: [], parameters: [] },
+ proxy_location: null,
+ webhook_callback_url: null,
+ persist_browser_session: false,
+ cache_key: "",
+} as never;
+
+function makeRun(workflow: unknown) {
+ return {
+ workflow_run_id: "wr_1",
+ status: Status.Completed,
+ parameters: {},
+ workflow,
+ } as never;
+}
+
+function renderStudioAt(path: string) {
+ const queryClient = new QueryClient({
+ defaultOptions: { queries: { retry: false } },
+ });
+ return render(
+ <QueryClientProvider client={queryClient}>
+ <MemoryRouter initialEntries={[path]}>
+ <Routes>
+ <Route
+ path="/agents/:workflowPermanentId/studio"
+ element={<WorkflowEditor />}
+ />
+ </Routes>
+ </MemoryRouter>
+ </QueryClientProvider>,
+ );
+}
+
+afterEach(cleanup);
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ runsQueryMock.mockReturnValue({ data: [], isPending: false });
+});
+
+describe("WorkflowEditor deleted-agent run fallback", () => {
+ test("renders the studio run view from the run snapshot when the workflow query 404s", () => {
+ workflowQueryMock.mockReturnValue({
+ data: undefined,
+ isLoading: false,
+ isError: true,
+ });
+ runQueryMock.mockReturnValue({
+ data: makeRun(deletedWorkflow),
+ isLoading: false,
+ });
+
+ renderStudioAt("/agents/wpid_del/studio?wr=wr_1");
+
+ // The run-viewing surfaces are up (this used to render nothing at all).
+ expect(screen.getByTestId("run-view-body")).toBeTruthy();
+ expect(screen.getByTestId("browser-tab-body")).toBeTruthy();
+
+ // Workflow-mutating surfaces degrade: legacy tag, no editor/copilot
+ // bodies, blocked toggles, no save/run actions.
+ expect(screen.getByText(/Agent deleted on/)).toBeTruthy();
+ expect(screen.queryByTestId("editor-tab-body")).toBeNull();
+ expect(
+ screen.getAllByText("Source agent deleted — this run is view-only."),
+ ).toHaveLength(2);
+ expect(
+ (screen.getByRole("button", { name: "Copilot" }) as HTMLButtonElement)
+ .disabled,
+ ).toBe(true);
+ expect(
+ (screen.getByRole("button", { name: "Editor" }) as HTMLButtonElement)
+ .disabled,
+ ).toBe(true);
+ expect(screen.queryByLabelText("Save workflow")).toBeNull();
+ expect(screen.queryByRole("button", { name: /^Run agent$/ })).toBeNull();
+ });
+
+ test("stays on the loading pulse while the run fallback is still loading", () => {
+ workflowQueryMock.mockReturnValue({
+ data: undefined,
+ isLoading: false,
+ isError: true,
+ });
+ runQueryMock.mockReturnValue({ data: undefined, isLoading: true });
+
+ renderStudioAt("/agents/wpid_del/studio?wr=wr_1");
+
+ expect(screen.queryByTestId("run-view-body")).toBeNull();
+ expect(screen.queryByText(/Agent deleted on/)).toBeNull();
+ });
+
+ test("a healthy workflow keeps the full studio (no deleted degradation)", () => {
+ workflowQueryMock.mockReturnValue({
+ data: liveWorkflow,
+ isLoading: false,
+ isError: false,
+ });
+ runQueryMock.mockReturnValue({
+ data: makeRun(liveWorkflow),
+ isLoading: false,
+ });
+
+ renderStudioAt("/agents/wpid_live/studio?wr=wr_1");
+
+ expect(screen.getByTestId("editor-tab-body")).toBeTruthy();
+ expect(screen.queryByText(/Agent deleted on/)).toBeNull();
+ expect(
+ screen.queryByText("Source agent deleted — this run is view-only."),
+ ).toBeNull();
+ expect(screen.getByLabelText("Save workflow")).toBeTruthy();
+ expect(
+ (screen.getByRole("button", { name: "Copilot" }) as HTMLButtonElement)
+ .disabled,
+ ).toBe(false);
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx b/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx
index 57c9c892e..a1014a1c6 100644
--- a/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx
@@ -1,7 +1,8 @@
import { ReactFlowProvider } from "@xyflow/react";
-import { useParams } from "react-router-dom";
+import { useParams, useSearchParams } from "react-router-dom";
import { useEffect } from "react";
import { useWorkflowQuery } from "../hooks/useWorkflowQuery";
+import { useWorkflowRunWithWorkflowQuery } from "../hooks/useWorkflowRunWithWorkflowQuery";
import { getElements } from "./workflowEditorUtils";
import { LogoMinimized } from "@/components/LogoMinimized";
import { WorkflowSettings } from "../types/workflowTypes";
@@ -19,11 +20,32 @@ import { useViaEntryPointCapture } from "../hooks/useViaEntryPointCapture";
function WorkflowEditor() {
const { workflowPermanentId } = useParams();
+ const [searchParams] = useSearchParams();
const studioEnabled = useWorkflowStudioEnabled();
- const { data: workflow, isLoading } = useWorkflowQuery({
+ const {
+ data: fetchedWorkflow,
+ isLoading,
+ isError: workflowQueryFailed,
+ } = useWorkflowQuery({
workflowPermanentId,
});
+ // Runs outlive their agent: the workflow GET 404s once the agent is deleted,
+ // but a ?wr= deep link can still be served from the run's embedded workflow
+ // snapshot (the same query the run panes use), in a read-only degraded mode.
+ const deepLinkRunId = searchParams.get("wr");
+ const { data: fallbackRun, isLoading: fallbackRunIsLoading } =
+ useWorkflowRunWithWorkflowQuery(
+ studioEnabled && deepLinkRunId
+ ? { workflowRunId: deepLinkRunId }
+ : undefined,
+ );
+ const deletedWorkflowSnapshot =
+ studioEnabled && workflowQueryFailed && fallbackRun?.workflow?.deleted_at
+ ? fallbackRun.workflow
+ : undefined;
+ const effectiveWorkflow = fetchedWorkflow ?? deletedWorkflowSnapshot;
+
const { data: globalWorkflows, isLoading: isGlobalWorkflowsLoading } =
useGlobalWorkflowsQuery();
@@ -40,13 +62,18 @@ function WorkflowEditor() {
useViaEntryPointCapture();
useEffect(() => {
- if (workflow) {
- const initialParameters = getInitialParameters(workflow);
+ if (effectiveWorkflow) {
+ const initialParameters = getInitialParameters(effectiveWorkflow);
setParameters(initialParameters);
}
- }, [workflow, setParameters]);
-
- if (isLoading || isGlobalWorkflowsLoading) {
+ }, [effectiveWorkflow, setParameters]);
+
+ const awaitingRunFallback =
+ studioEnabled &&
+ workflowQueryFailed &&
+ Boolean(deepLinkRunId) &&
+ fallbackRunIsLoading;
+ if (isLoading || isGlobalWorkflowsLoading || awaitingRunFallback) {
return (
<div className="flex h-screen w-full items-center justify-center">
<div className="animate-pulse">
@@ -56,9 +83,11 @@ function WorkflowEditor() {
);
}
- if (!workflow) {
+ if (!effectiveWorkflow) {
return null;
}
+ const workflow = effectiveWorkflow;
+ const workflowDeleted = Boolean(workflow.deleted_at);
const isGlobalWorkflow = globalWorkflows?.some(
(globalWorkflow) =>
@@ -97,7 +126,11 @@ function WorkflowEditor() {
errorCodeMapping: workflow.workflow_definition?.error_code_mapping ?? null,
};
- const elements = getElements(blocksToRender, settings, !isGlobalWorkflow);
+ const elements = getElements(
+ blocksToRender,
+ settings,
+ !isGlobalWorkflow && !workflowDeleted,
+ );
return (
<div className="relative flex h-screen w-full flex-col">
diff --git a/skyvern-frontend/src/routes/workflows/editor/WorkflowYamlEditor.tsx b/skyvern-frontend/src/routes/workflows/editor/WorkflowYamlEditor.tsx
index 984e568ac..323f7b556 100644
--- a/skyvern-frontend/src/routes/workflows/editor/WorkflowYamlEditor.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/WorkflowYamlEditor.tsx
@@ -64,11 +64,14 @@ function WorkflowYamlEditor({ variant = "fullscreen" }: Props) {
</span>
) : null}
</div>
- <YamlModeToggle
- mode="code"
- onVisual={switchToVisual}
- disabled={committing}
- />
+ {/* The studio's pane variant hosts this toggle in the pane header. */}
+ {fullscreen ? (
+ <YamlModeToggle
+ mode="code"
+ onVisual={switchToVisual}
+ disabled={committing}
+ />
+ ) : null}
</div>
{error ? (
<div
diff --git a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx
index ba5fdafb9..88f8582c3 100644
--- a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx
@@ -64,6 +64,7 @@ import { useBlockScriptStore } from "@/store/BlockScriptStore";
import { useBlockSidebarWidthStore } from "@/store/BlockSidebarWidthStore";
import { useCacheKeyValueStore } from "@/store/CacheKeyValueStore";
import { useRecordingStore } from "@/store/useRecordingStore";
+import { useStudioShellStore } from "@/store/StudioShellStore";
import { useCopilotActionStore } from "@/store/useCopilotActionStore";
import { useShowAllCodeStore } from "@/store/ShowAllCodeStore";
import { useSidebarSaveStateStore } from "@/store/SidebarSaveStateStore";
@@ -171,7 +172,9 @@ import { WorkflowCopilotChat } from "../copilot/WorkflowCopilotChat";
import { useStudioRunId } from "../studio/useStudioRunId";
import { copilotRunId } from "./copilotRunId";
import { useStudioShellContext } from "../studio/StudioShellContext";
+import { StudioShellPanelPortal } from "../studio/StudioShellPanelPortal";
import { useRecordingLauncherStore } from "@/store/useRecordingLauncherStore";
+import { paneWidthsKey } from "../studio/paneLayout";
import { useStudioPanes } from "../studio/useStudioPanes";
import { WorkflowCopilotButton } from "../copilot/WorkflowCopilotButton";
import { resolveCopilotLiveBrowserReady } from "../copilot/browserReadiness";
@@ -347,6 +350,7 @@ function Workspace({
const { blockLabel, workflowPermanentId } = useParams();
const { copilotPortalEl: studioCopilotPortalEl } = useStudioShellContext();
const { panes: studioPanes, openPane: openStudioPane } = useStudioPanes();
+ const studioPaneWidths = useStudioShellStore((s) => s.paneWidths);
const studioCopilotOpen = studioPanes.includes("copilot");
// Armed iff the workflow has no blocks at mount — the studio shell remounts
// Workspace per workflow, so `workflow` is always populated here. The first
@@ -1619,6 +1623,20 @@ function Workspace({
useWorkflowYamlEditorStore.getState().open(yaml);
};
+ // Expose Code-mode entry to the studio's Editor pane header via the store.
+ // A stable wrapper over a ref keeps the registration from churning while
+ // still calling the latest closure.
+ const enterYamlModeRef = useRef(enterYamlMode);
+ enterYamlModeRef.current = enterYamlMode;
+ useEffect(() => {
+ if (!embedded || isGlobalWorkflow) {
+ return;
+ }
+ const store = useWorkflowYamlEditorStore.getState();
+ store.registerEnterYamlMode(() => enterYamlModeRef.current());
+ return () => store.registerEnterYamlMode(null);
+ }, [embedded, isGlobalWorkflow]);
+
// Commit-on-switch: reparse the edited YAML into the graph via the Copilot's
// non-persisting convert endpoint. Returns false on invalid YAML (stays open).
const commitYaml = async (persist: boolean = false): Promise<boolean> => {
@@ -1790,6 +1808,20 @@ function Workspace({
}
}, [yamlEditorActive, yamlEditorDirty]);
+ // Studio exit from version history/comparison: keep the current version,
+ // clear the comparison, close the panel. Panes stay editor-only.
+ const exitVersionHistory = () => {
+ setWorkflowPanelState({
+ active: false,
+ content: "history",
+ data: {
+ showComparison: false,
+ version1: undefined,
+ version2: undefined,
+ },
+ });
+ };
+
const handleSelectState = (selectedVersion: WorkflowVersion) => {
// Close panels
setWorkflowPanelState({
@@ -1981,6 +2013,7 @@ function Workspace({
onCopilotReviewClose={
workflowPanelState.data.onCopilotReviewClose
}
+ onExit={embedded ? exitVersionHistory : undefined}
/>
</div>
{workflowPanelState.active &&
@@ -1989,6 +2022,7 @@ function Workspace({
<WorkflowHistoryPanel
workflowPermanentId={workflowPermanentId!}
onCompare={handleCompareVersions}
+ onClose={embedded ? exitVersionHistory : undefined}
/>
</div>
)}
@@ -2016,6 +2050,7 @@ function Workspace({
onCopilotReviewClose={
workflowPanelState.data.onCopilotReviewClose
}
+ onExit={embedded ? exitVersionHistory : undefined}
/>
</div>
@@ -2043,7 +2078,7 @@ function Workspace({
opacity: !embedded && headerCollapsed ? 0 : 1,
}}
>
- {workflowPanelState.content === "cacheKeyValues" && (
+ {!embedded && workflowPanelState.content === "cacheKeyValues" && (
<WorkflowCacheKeyValuesPanel
cacheKeyValues={cacheKeyValues}
pending={cacheKeyValuesLoading}
@@ -2081,6 +2116,7 @@ function Workspace({
<WorkflowHistoryPanel
workflowPermanentId={workflowPermanentId!}
onCompare={handleCompareVersions}
+ onClose={embedded ? exitVersionHistory : undefined}
/>
</div>
)}
@@ -2108,7 +2144,11 @@ function Workspace({
initialTitle={initialTitle}
workflow={workflow}
embedded={embedded}
- paneLayoutKey={embedded ? studioPanes.join(",") : undefined}
+ paneLayoutKey={
+ embedded
+ ? `${studioPanes.join(",")}|${paneWidthsKey(studioPaneWidths)}`
+ : undefined
+ }
onRequestDeleteNode={handleRequestDeleteNode}
captureHistoryImmediately={captureWorkflowEditImmediately}
onAddNode={addNode}
@@ -2146,29 +2186,30 @@ function Workspace({
opacity: !embedded && headerCollapsed ? 0 : 1,
}}
>
- {workflowPanelState.content === "cacheKeyValues" && (
- <WorkflowCacheKeyValuesPanel
- cacheKeyValues={cacheKeyValues}
- pending={cacheKeyValuesLoading}
- scriptKey={workflow.cache_key ?? "default"}
- filter={cacheKeyValueFilter ?? undefined}
- onFilterChange={setCacheKeyValueFilter}
- onDelete={(cacheKeyValue) => {
- deleteCacheKeyValue.mutate({
- workflowPermanentId: workflowPermanentId!,
- cacheKeyValue,
- });
- }}
- onPaginate={(page) => {
- setPage(page);
- }}
- onSelect={(cacheKeyValue) => {
- setExplicitCacheKeyValue(cacheKeyValue);
- setCacheKeyValueFilter("");
- closeWorkflowPanel();
- }}
- />
- )}
+ {!embedded &&
+ workflowPanelState.content === "cacheKeyValues" && (
+ <WorkflowCacheKeyValuesPanel
+ cacheKeyValues={cacheKeyValues}
+ pending={cacheKeyValuesLoading}
+ scriptKey={workflow.cache_key ?? "default"}
+ filter={cacheKeyValueFilter ?? undefined}
+ onFilterChange={setCacheKeyValueFilter}
+ onDelete={(cacheKeyValue) => {
+ deleteCacheKeyValue.mutate({
+ workflowPermanentId: workflowPermanentId!,
+ cacheKeyValue,
+ });
+ }}
+ onPaginate={(page) => {
+ setPage(page);
+ }}
+ onSelect={(cacheKeyValue) => {
+ setExplicitCacheKeyValue(cacheKeyValue);
+ setCacheKeyValueFilter("");
+ closeWorkflowPanel();
+ }}
+ />
+ )}
{!embedded &&
workflowPanelState.content === "parameters" && (
<div className="z-30">
@@ -2186,6 +2227,7 @@ function Workspace({
<WorkflowHistoryPanel
workflowPermanentId={workflowPermanentId!}
onCompare={handleCompareVersions}
+ onClose={embedded ? exitVersionHistory : undefined}
/>
</div>
)}
@@ -2218,7 +2260,7 @@ function Workspace({
opacity: headerCollapsed ? 0 : 1,
}}
>
- {workflowPanelState.content === "cacheKeyValues" && (
+ {!embedded && workflowPanelState.content === "cacheKeyValues" && (
<WorkflowCacheKeyValuesPanel
cacheKeyValues={cacheKeyValues}
pending={cacheKeyValuesLoading}
@@ -2252,6 +2294,7 @@ function Workspace({
<WorkflowHistoryPanel
workflowPermanentId={workflowPermanentId!}
onCompare={handleCompareVersions}
+ onClose={embedded ? exitVersionHistory : undefined}
/>
</div>
)}
@@ -2660,7 +2703,7 @@ function Workspace({
{/* timeline narrow */}
<div
className={cn(
- "delay-[300ms] pointer-events-none absolute left-0 top-0 h-full w-[6rem] rounded-l-lg opacity-0 transition-all duration-1000",
+ "pointer-events-none absolute left-0 top-0 h-full w-[6rem] rounded-l-lg opacity-0 transition-all duration-1000 [transition-delay:300ms]",
{
"pointer-events-auto opacity-100":
timelineMode === "narrow",
@@ -2945,11 +2988,47 @@ function Workspace({
}}
/>
- {!yamlEditorActive && !isGlobalWorkflow ? (
+ {/* Studio hosts the toggle in the Editor pane header instead. */}
+ {!yamlEditorActive && !isGlobalWorkflow && !embedded ? (
<div className="absolute right-4 top-3 z-30">
<YamlModeToggle mode="visual" onCode={enterYamlMode} />
</div>
) : null}
+ {/* Studio: the cache key/value panel escapes the Editor pane via the
+ shell-level portal, so the Overview pane's Code view can open it (and
+ close it) even with the Editor pane hidden. */}
+ {embedded ? (
+ <StudioShellPanelPortal
+ open={
+ workflowPanelState.active &&
+ workflowPanelState.content === "cacheKeyValues"
+ }
+ onDismiss={closeWorkflowPanel}
+ >
+ <WorkflowCacheKeyValuesPanel
+ cacheKeyValues={cacheKeyValues}
+ pending={cacheKeyValuesLoading}
+ scriptKey={workflow.cache_key ?? "default"}
+ filter={cacheKeyValueFilter ?? undefined}
+ onFilterChange={setCacheKeyValueFilter}
+ onClose={closeWorkflowPanel}
+ onDelete={(cacheKeyValue) => {
+ deleteCacheKeyValue.mutate({
+ workflowPermanentId: workflowPermanentId!,
+ cacheKeyValue,
+ });
+ }}
+ onPaginate={(page) => {
+ setPage(page);
+ }}
+ onSelect={(cacheKeyValue) => {
+ setExplicitCacheKeyValue(cacheKeyValue);
+ setCacheKeyValueFilter("");
+ closeWorkflowPanel();
+ }}
+ />
+ </StudioShellPanelPortal>
+ ) : null}
{/* Studio: Code mode swaps the Editor pane's content (sibling panes stay
usable); legacy keeps the original full-screen modal overlay. */}
{yamlEditorActive ? (
diff --git a/skyvern-frontend/src/routes/workflows/editor/YamlModeToggle.tsx b/skyvern-frontend/src/routes/workflows/editor/YamlModeToggle.tsx
index 05a82b842..2231c3994 100644
--- a/skyvern-frontend/src/routes/workflows/editor/YamlModeToggle.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/YamlModeToggle.tsx
@@ -1,13 +1,19 @@
import { CodeIcon, EyeOpenIcon } from "@radix-ui/react-icons";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
import { cn } from "@/util/utils";
const segmentClass = (active: boolean) =>
cn(
- "flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors",
+ "flex h-7 items-center gap-1 rounded-md px-2 text-xs transition-colors",
+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
active
- ? "bg-slate-elevation3 text-slate-100"
- : "text-slate-400 hover:text-slate-200",
+ ? "bg-accent text-foreground"
+ : "text-muted-foreground hover:bg-accent/50 hover:text-foreground",
);
type Props = {
@@ -15,37 +21,55 @@ type Props = {
onVisual?: () => void;
onCode?: () => void;
disabled?: boolean;
+ // Icon-only segments (narrow pane headers); labels move to tooltips.
+ compact?: boolean;
};
// Segmented Visual/Code toggle for the workflow editor. "Code" opens the
// full-screen YAML editor; "Visual" commits the YAML back into the canvas.
-export function YamlModeToggle({ mode, onVisual, onCode, disabled }: Props) {
- return (
- <div className="flex items-center gap-0.5 rounded-md border border-slate-700 bg-slate-elevation1 p-0.5">
- {/* The active segment stays focusable (aria-disabled, not disabled) so
- keyboard users can tab to it and hear the pressed state. */}
- <button
- type="button"
- aria-pressed={mode === "visual"}
- aria-disabled={mode === "visual" || undefined}
- disabled={disabled}
- onClick={mode === "visual" ? undefined : onVisual}
- className={segmentClass(mode === "visual")}
- >
- <EyeOpenIcon className="size-3" />
- Visual
- </button>
+export function YamlModeToggle({
+ mode,
+ onVisual,
+ onCode,
+ disabled,
+ compact = false,
+}: Props) {
+ const segment = (
+ label: "Visual" | "Code",
+ icon: React.ReactNode,
+ onClick?: () => void,
+ ) => {
+ const button = (
<button
type="button"
- aria-pressed={mode === "code"}
- aria-disabled={mode === "code" || undefined}
+ aria-pressed={mode === label.toLowerCase()}
+ aria-disabled={mode === label.toLowerCase() || undefined}
+ aria-label={label}
disabled={disabled}
- onClick={mode === "code" ? undefined : onCode}
- className={segmentClass(mode === "code")}
+ onClick={mode === label.toLowerCase() ? undefined : onClick}
+ className={segmentClass(mode === label.toLowerCase())}
>
- <CodeIcon className="size-3" />
- Code
+ {icon}
+ {compact ? null : label}
</button>
+ );
+ if (!compact || disabled) {
+ return button;
+ }
+ return (
+ <Tooltip>
+ <TooltipTrigger asChild>{button}</TooltipTrigger>
+ <TooltipContent side="bottom">{label}</TooltipContent>
+ </Tooltip>
+ );
+ };
+
+ return (
+ <div className="flex items-center gap-1">
+ {/* The active segment stays focusable (aria-disabled, not disabled) so
+ keyboard users can tab to it and hear the pressed state. */}
+ {segment("Visual", <EyeOpenIcon className="size-3" />, onVisual)}
+ {segment("Code", <CodeIcon className="size-3" />, onCode)}
</div>
);
}
diff --git a/skyvern-frontend/src/routes/workflows/editor/header/EditorOverflowMenu.tsx b/skyvern-frontend/src/routes/workflows/editor/header/EditorOverflowMenu.tsx
index 1906f1939..4d608b14a 100644
--- a/skyvern-frontend/src/routes/workflows/editor/header/EditorOverflowMenu.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/header/EditorOverflowMenu.tsx
@@ -36,8 +36,16 @@ import { CodeSubmenu } from "./CodeSubmenu";
export function EditorOverflowMenu({
triggerClassName = "size-10 min-w-[2.5rem]",
+ onVersionHistory,
+ embedded = false,
}: {
triggerClassName?: string;
+ // Studio override: the shell collapses to an editor-only layout before
+ // opening the panel (comparison renders in the editor canvas).
+ onVersionHistory?: () => void;
+ // Embedded (studio) hosts provide their own TooltipProvider with the shell's
+ // fast timing; standalone (legacy header) brings a local one.
+ embedded?: boolean;
} = {}) {
const { workflowPermanentId } = useParams();
const { data: workflow } = useWorkflowQuery({ workflowPermanentId });
@@ -93,32 +101,41 @@ export function EditorOverflowMenu({
templateMutation.mutate(newIsTemplate);
};
+ // Disabled-trigger idiom: the span keeps the tooltip firing (and keyboard
+ // reachable) while recording disables the button underneath.
+ const trigger = (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span
+ className="inline-flex shrink-0"
+ {...(isRecording ? { tabIndex: 0 } : {})}
+ >
+ <DropdownMenuTrigger asChild>
+ <Button
+ disabled={isRecording}
+ size="icon"
+ variant="tertiary"
+ className={triggerClassName}
+ aria-label="More actions"
+ >
+ <DotsHorizontalIcon className="size-5" />
+ </Button>
+ </DropdownMenuTrigger>
+ </span>
+ </TooltipTrigger>
+ <TooltipContent>More actions</TooltipContent>
+ </Tooltip>
+ );
+
return (
<DropdownMenu modal={false}>
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <DropdownMenuTrigger asChild>
- <Button
- disabled={isRecording}
- size="icon"
- variant="tertiary"
- className={triggerClassName}
- aria-label="More actions"
- >
- <DotsHorizontalIcon className="size-5" />
- </Button>
- </DropdownMenuTrigger>
- </TooltipTrigger>
- <TooltipContent>More actions</TooltipContent>
- </Tooltip>
- </TooltipProvider>
+ {embedded ? trigger : <TooltipProvider>{trigger}</TooltipProvider>}
<DropdownMenuContent align="end" className="min-w-[12rem]">
<CodeSubmenu />
{!workflowRunIsRunningOrQueued && (
<DropdownMenuItem
disabled={isRecording}
- onSelect={() => toggleHistoryPanel()}
+ onSelect={() => (onVersionHistory ?? toggleHistoryPanel)()}
>
<CounterClockwiseClockIcon className="mr-2 size-4" />
Version history
diff --git a/skyvern-frontend/src/routes/workflows/editor/hooks/useBlockRunTarget.test.tsx b/skyvern-frontend/src/routes/workflows/editor/hooks/useBlockRunTarget.test.tsx
new file mode 100644
index 000000000..746d89e33
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/editor/hooks/useBlockRunTarget.test.tsx
@@ -0,0 +1,76 @@
+// @vitest-environment jsdom
+
+import { renderHook } from "@testing-library/react";
+import { type ReactNode } from "react";
+import { MemoryRouter, Route, Routes } from "react-router-dom";
+import { describe, expect, test } from "vitest";
+
+import { useBlockRunTarget } from "./useBlockRunTarget";
+
+function wrapperAt(path: string, routePattern: string) {
+ return function Wrapper({ children }: { children: ReactNode }) {
+ return (
+ <MemoryRouter initialEntries={[path]}>
+ <Routes>
+ <Route path={routePattern} element={<>{children}</>} />
+ </Routes>
+ </MemoryRouter>
+ );
+ };
+}
+
+describe("useBlockRunTarget", () => {
+ test("resolves the legacy debugger's path params", () => {
+ const { result } = renderHook(() => useBlockRunTarget(), {
+ wrapper: wrapperAt(
+ "/agents/wpid_1/wr_9/login-block/build",
+ "/agents/:workflowPermanentId/:workflowRunId/:blockLabel/build",
+ ),
+ });
+ expect(result.current).toEqual({
+ workflowRunId: "wr_9",
+ blockLabel: "login-block",
+ });
+ });
+
+ test("resolves the studio's ?wr=/?bl= query params (running-chip + play-disable gate)", () => {
+ // The parity bug: NodeHeader gated only on path params, so a studio block
+ // run (?wr= active) left the block's running chip off and play enabled.
+ const { result } = renderHook(() => useBlockRunTarget(), {
+ wrapper: wrapperAt(
+ "/agents/wpid_1/studio?wr=wr_9&bl=login-block&panes=editor,browser,overview",
+ "/agents/:workflowPermanentId/studio",
+ ),
+ });
+ expect(result.current).toEqual({
+ workflowRunId: "wr_9",
+ blockLabel: "login-block",
+ });
+ });
+
+ test("a full studio run (?wr= without ?bl=) targets no block", () => {
+ const { result } = renderHook(() => useBlockRunTarget(), {
+ wrapper: wrapperAt(
+ "/agents/wpid_1/studio?wr=wr_9",
+ "/agents/:workflowPermanentId/studio",
+ ),
+ });
+ expect(result.current).toEqual({
+ workflowRunId: "wr_9",
+ blockLabel: undefined,
+ });
+ });
+
+ test("no run anywhere resolves to no target", () => {
+ const { result } = renderHook(() => useBlockRunTarget(), {
+ wrapper: wrapperAt(
+ "/agents/wpid_1/edit",
+ "/agents/:workflowPermanentId/edit",
+ ),
+ });
+ expect(result.current).toEqual({
+ workflowRunId: undefined,
+ blockLabel: undefined,
+ });
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/editor/hooks/useBlockRunTarget.ts b/skyvern-frontend/src/routes/workflows/editor/hooks/useBlockRunTarget.ts
new file mode 100644
index 000000000..7add1ec07
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/editor/hooks/useBlockRunTarget.ts
@@ -0,0 +1,20 @@
+import { useParams, useSearchParams } from "react-router-dom";
+
+/**
+ * The block run the editor canvas is focused on. The legacy debugger carries
+ * the run and target block in the path (/:workflowRunId/:blockLabel/build);
+ * the studio carries them in ?wr= / ?bl= so the canvas never re-mounts on a
+ * run start. Block components must gate on whichever shape is present, or the
+ * running chip / stop button / play-disable go inert in the studio.
+ */
+export function useBlockRunTarget(): {
+ workflowRunId: string | undefined;
+ blockLabel: string | undefined;
+} {
+ const { blockLabel, workflowRunId } = useParams();
+ const [searchParams] = useSearchParams();
+ return {
+ workflowRunId: workflowRunId ?? searchParams.get("wr") ?? undefined,
+ blockLabel: blockLabel ?? searchParams.get("bl") ?? undefined,
+ };
+}
diff --git a/skyvern-frontend/src/routes/workflows/editor/hooks/useCacheKeyValueUrlSync.ts b/skyvern-frontend/src/routes/workflows/editor/hooks/useCacheKeyValueUrlSync.ts
index 11a0326e8..8336de45d 100644
--- a/skyvern-frontend/src/routes/workflows/editor/hooks/useCacheKeyValueUrlSync.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/hooks/useCacheKeyValueUrlSync.ts
@@ -1,6 +1,7 @@
import { useEffect } from "react";
-import { useSearchParams } from "react-router-dom";
+import { useNavigate, useSearchParams } from "react-router-dom";
+import { toReadableSearch } from "@/routes/workflows/studio/panes";
import { useCacheKeyValueStore } from "@/store/CacheKeyValueStore";
/**
@@ -10,7 +11,8 @@ import { useCacheKeyValueStore } from "@/store/CacheKeyValueStore";
* A's filter into B's URL before B's init lands.
*/
export function useCacheKeyValueUrlSync(ready: boolean): void {
- const [searchParams, setSearchParams] = useSearchParams();
+ const [searchParams] = useSearchParams();
+ const navigate = useNavigate();
const cacheKeyValue = useCacheKeyValueStore((s) => s.cacheKeyValue);
const isExplicit = useCacheKeyValueStore((s) => s.isExplicit);
@@ -21,14 +23,9 @@ export function useCacheKeyValueUrlSync(ready: boolean): void {
if (!isExplicit) {
if (currentUrlValue !== null) {
- setSearchParams(
- (prev) => {
- const newParams = new URLSearchParams(prev);
- newParams.delete("cache-key-value");
- return newParams;
- },
- { replace: true },
- );
+ const newParams = new URLSearchParams(searchParams);
+ newParams.delete("cache-key-value");
+ navigate({ search: toReadableSearch(newParams) }, { replace: true });
}
return;
}
@@ -36,18 +33,13 @@ export function useCacheKeyValueUrlSync(ready: boolean): void {
const targetValue = cacheKeyValue === "" ? null : cacheKeyValue;
if (currentUrlValue !== targetValue) {
- setSearchParams(
- (prev) => {
- const newParams = new URLSearchParams(prev);
- if (cacheKeyValue === "") {
- newParams.delete("cache-key-value");
- } else {
- newParams.set("cache-key-value", cacheKeyValue);
- }
- return newParams;
- },
- { replace: true },
- );
+ const newParams = new URLSearchParams(searchParams);
+ if (cacheKeyValue === "") {
+ newParams.delete("cache-key-value");
+ } else {
+ newParams.set("cache-key-value", cacheKeyValue);
+ }
+ navigate({ search: toReadableSearch(newParams) }, { replace: true });
}
- }, [ready, cacheKeyValue, isExplicit, searchParams, setSearchParams]);
+ }, [ready, cacheKeyValue, isExplicit, searchParams, navigate]);
}
diff --git a/skyvern-frontend/src/routes/workflows/editor/hooks/useSelectedBlockUrlSync.test.tsx b/skyvern-frontend/src/routes/workflows/editor/hooks/useSelectedBlockUrlSync.test.tsx
index 7661c991d..8f5c2c7fd 100644
--- a/skyvern-frontend/src/routes/workflows/editor/hooks/useSelectedBlockUrlSync.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/hooks/useSelectedBlockUrlSync.test.tsx
@@ -177,6 +177,8 @@ describe("useSelectedBlockUrlSync", () => {
const params = new URLSearchParams(result.current.search);
expect(params.get("panes")).toBe("copilot,editor");
expect(params.get("wr")).toBe("run_1");
+ // The mirror write must not re-encode the panes commas to %2C.
+ expect(result.current.search).toContain("panes=copilot,editor");
} finally {
window.history.replaceState(null, "", "/");
}
diff --git a/skyvern-frontend/src/routes/workflows/editor/hooks/useSelectedBlockUrlSync.ts b/skyvern-frontend/src/routes/workflows/editor/hooks/useSelectedBlockUrlSync.ts
index d33885fcb..79d6f6cad 100644
--- a/skyvern-frontend/src/routes/workflows/editor/hooks/useSelectedBlockUrlSync.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/hooks/useSelectedBlockUrlSync.ts
@@ -1,6 +1,7 @@
import { useCallback, useEffect, useRef } from "react";
-import { useSearchParams } from "react-router-dom";
+import { useNavigate, useSearchParams } from "react-router-dom";
+import { toReadableSearch } from "@/routes/workflows/studio/panes";
import { useWorkflowPanelStore } from "@/store/WorkflowPanelStore";
import { type AppNode, isWorkflowBlockNode } from "../nodes";
@@ -76,11 +77,14 @@ export function useSelectedBlockUrlSync({
nodes,
getNodes,
}: UseSelectedBlockUrlSyncOptions): void {
- const [searchParams, setSearchParams] = useSearchParams();
+ const [searchParams] = useSearchParams();
+ const navigate = useNavigate();
const selectedBlockId = useWorkflowPanelStore((s) => s.selectedBlockId);
const setSelectedBlockId = useWorkflowPanelStore((s) => s.setSelectedBlockId);
const suppressNextSelectionMirrorRef = useRef(false);
const selectedBlockLabelParam = searchParams.get(SELECTED_BLOCK_SEARCH_PARAM);
+ const searchParamsRef = useRef(searchParams);
+ searchParamsRef.current = searchParams;
const getCurrentNodes = useCallback(() => {
const latestNodes = getNodes?.();
@@ -89,14 +93,14 @@ export function useSelectedBlockUrlSync({
// Merge writes against the live URL, not this render's closure: pushState is
// synchronous, so a concurrent navigate (pane toggles writing ?panes=) is
- // already visible there while the closure params can be one commit stale and
+ // already visible there while the closure params can be one render stale and
// would clobber it. window.location is blank under a memory router (tests);
// fall back to the closure, where no such race exists.
const liveParams = useCallback(
- (closure: URLSearchParams) =>
+ () =>
window.location.search !== ""
? new URLSearchParams(window.location.search)
- : new URLSearchParams(closure),
+ : new URLSearchParams(searchParamsRef.current),
[],
);
@@ -111,14 +115,9 @@ export function useSelectedBlockUrlSync({
selectedBlockLabelParam,
);
if (!matchedNodeId) {
- setSearchParams(
- (prev) => {
- const next = liveParams(prev);
- next.delete(SELECTED_BLOCK_SEARCH_PARAM);
- return next;
- },
- { replace: true },
- );
+ const next = liveParams();
+ next.delete(SELECTED_BLOCK_SEARCH_PARAM);
+ navigate({ search: toReadableSearch(next) }, { replace: true });
}
// Must actually move selectedBlockId off the stale block, not just skip
@@ -136,8 +135,8 @@ export function useSelectedBlockUrlSync({
enabled,
getCurrentNodes,
liveParams,
+ navigate,
selectedBlockLabelParam,
- setSearchParams,
setSelectedBlockId,
]);
@@ -163,24 +162,19 @@ export function useSelectedBlockUrlSync({
return;
}
- setSearchParams(
- (prev) => {
- const next = liveParams(prev);
- if (selectedBlockLabel) {
- next.set(SELECTED_BLOCK_SEARCH_PARAM, selectedBlockLabel);
- } else {
- next.delete(SELECTED_BLOCK_SEARCH_PARAM);
- }
- return next;
- },
- { replace: true },
- );
+ const next = liveParams();
+ if (selectedBlockLabel) {
+ next.set(SELECTED_BLOCK_SEARCH_PARAM, selectedBlockLabel);
+ } else {
+ next.delete(SELECTED_BLOCK_SEARCH_PARAM);
+ }
+ navigate({ search: toReadableSearch(next) }, { replace: true });
}, [
enabled,
getCurrentNodes,
liveParams,
+ navigate,
searchParams,
selectedBlockId,
- setSearchParams,
]);
}
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.tsx
index 15f2093af..97260baac 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.tsx
@@ -35,6 +35,7 @@ import { useBrowserSessionRateLimit } from "@/routes/workflows/hooks/useBrowserS
import { useCredentialsQuery } from "@/routes/workflows/hooks/useCredentialsQuery";
import { useDebugSessionQuery } from "@/routes/workflows/hooks/useDebugSessionQuery";
import { useWorkflowQuery } from "@/routes/workflows/hooks/useWorkflowQuery";
+import { useBlockRunTarget } from "@/routes/workflows/editor/hooks/useBlockRunTarget";
import { useWorkflowRunQuery } from "@/routes/workflows/hooks/useWorkflowRunQuery";
import { DebugSessionProfileIncompatibleDialog } from "@/routes/workflows/debugger/DebugSessionProfileIncompatibleDialog";
import {
@@ -251,11 +252,9 @@ function NodeHeader({
}: Props) {
const log = useLogging();
const mode = useWorkflowEditorMode();
- const {
- blockLabel: urlBlockLabel,
- workflowPermanentId,
- workflowRunId,
- } = useParams();
+ const { workflowPermanentId } = useParams();
+ const { workflowRunId: activeWorkflowRunId, blockLabel: targetBlockLabel } =
+ useBlockRunTarget();
const blockOutputsStore = useBlockOutputStore();
const debugStore = useDebugStore();
const recordingStore = useRecordingStore();
@@ -281,7 +280,9 @@ function NodeHeader({
const { resolveLivePanes } = useStudioPanes();
const isDebuggable = debuggableWorkflowBlockTypes.has(type);
const isScriptable = scriptableWorkflowBlockTypes.has(type);
- const { data: workflowRun } = useWorkflowRunQuery();
+ const { data: workflowRun } = useWorkflowRunQuery({
+ workflowRunId: activeWorkflowRunId,
+ });
const workflowRunIsRunningOrQueued =
workflowRun && statusIsRunningOrQueued(workflowRun);
const { isRateLimited } = useBrowserSessionRateLimit(workflowPermanentId);
@@ -297,11 +298,11 @@ function NodeHeader({
const thisBlockIsPlaying =
workflowRunIsRunningOrQueued &&
- urlBlockLabel !== undefined &&
- urlBlockLabel === blockLabel;
+ targetBlockLabel !== undefined &&
+ targetBlockLabel === blockLabel;
const thisBlockIsTargetted =
- urlBlockLabel !== undefined && urlBlockLabel === blockLabel;
+ targetBlockLabel !== undefined && targetBlockLabel === blockLabel;
const isRecording = recordingStore.isRecording;
@@ -367,36 +368,41 @@ function NodeHeader({
});
useEffect(() => {
- if (!workflowRun || !workflowPermanentId || !workflowRunId) {
+ if (
+ !workflowRun ||
+ !workflowPermanentId ||
+ !activeWorkflowRunId ||
+ // Only block-scoped runs toast per block; full runs report via the run
+ // surfaces (?wr= without ?bl=).
+ targetBlockLabel === undefined
+ ) {
return;
}
if (
- workflowRunId === workflowRun?.workflow_run_id &&
+ activeWorkflowRunId === workflowRun?.workflow_run_id &&
statusIsFinalized(workflowRun)
) {
- // navigate(`/workflows/${workflowPermanentId}/build`);
-
if (statusIsAFailureType(workflowRun)) {
toast({
variant: "destructive",
- title: `Agent Block ${urlBlockLabel}: ${workflowRun.status}`,
+ title: `Agent Block ${targetBlockLabel}: ${workflowRun.status}`,
description: `Reason: ${workflowRun.failure_reason}`,
});
} else if (statusIsFinalized(workflowRun)) {
toast({
variant: "success",
- title: `Agent Block ${urlBlockLabel}: ${workflowRun.status}`,
+ title: `Agent Block ${targetBlockLabel}: ${workflowRun.status}`,
});
}
}
}, [
queryClient,
- urlBlockLabel,
+ targetBlockLabel,
navigate,
workflowPermanentId,
workflowRun,
- workflowRunId,
+ activeWorkflowRunId,
]);
const runBlock = useMutation({
@@ -622,7 +628,9 @@ function NodeHeader({
const browserSessionId = debugSession.browser_session_id;
const client = await getClient(credentialGetter);
return client
- .post(`/runs/${browserSessionId}/workflow_run/${workflowRunId}/cancel/`)
+ .post(
+ `/runs/${browserSessionId}/workflow_run/${activeWorkflowRunId}/cancel/`,
+ )
.then((response) => response.data);
},
onSuccess: () => {
diff --git a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowCacheKeyValuesPanel.tsx b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowCacheKeyValuesPanel.tsx
index 83a6b5e74..b541d5c5f 100644
--- a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowCacheKeyValuesPanel.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowCacheKeyValuesPanel.tsx
@@ -87,9 +87,10 @@ function WorkflowCacheKeyValuesPanel({
{onClose && (
<Button
size="icon"
- variant="ghost"
+ variant="outline"
aria-label="Close"
- className="size-7 shrink-0"
+ title="Close"
+ className="h-7 w-7 shrink-0 border-border bg-transparent shadow-none"
onClick={onClose}
>
<Cross2Icon className="size-4" />
diff --git a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowComparisonPanel.tsx b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowComparisonPanel.tsx
index 1588e8e1b..4cf4f0cc1 100644
--- a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowComparisonPanel.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowComparisonPanel.tsx
@@ -34,6 +34,9 @@ type Props = {
onSelectState?: (version: WorkflowVersion) => void;
mode?: ComparisonMode;
onCopilotReviewClose?: (status: CopilotReviewStatus) => void;
+ // History mode: exits comparison without applying a version (the studio's
+ // "Keep current version"). Copilot mode keeps its own close flow.
+ onExit?: () => void;
};
// Mapping from WorkflowBlock.block_type to ReactFlow node.type
@@ -273,6 +276,7 @@ function WorkflowComparisonPanel({
onSelectState,
mode = "history",
onCopilotReviewClose,
+ onExit,
}: Props) {
const comparisons = useMemo(() => {
const blocks1 = version1?.workflow_definition?.blocks || [];
@@ -297,6 +301,20 @@ function WorkflowComparisonPanel({
return () => window.removeEventListener("keydown", handleKeyDown);
}, [mode, onCopilotReviewClose]);
+ // ESC in history mode mirrors "Keep current version" when an exit is wired.
+ useEffect(() => {
+ if (mode !== "history" || !onExit) return;
+
+ const handleKeyDown = (event: KeyboardEvent) => {
+ if (event.key === "Escape") {
+ onExit();
+ }
+ };
+
+ window.addEventListener("keydown", handleKeyDown);
+ return () => window.removeEventListener("keydown", handleKeyDown);
+ }, [mode, onExit]);
+
// Statistics
const stats = useMemo(
() => ({
@@ -354,6 +372,17 @@ function WorkflowComparisonPanel({
<div className="flex h-full w-full flex-col rounded-lg bg-slate-elevation2">
{/* Header */}
<div className="relative flex-shrink-0 p-4 pb-3">
+ {/* History-mode exit: keep the current version, drop the comparison. */}
+ {mode === "history" && onExit && (
+ <button
+ type="button"
+ onClick={onExit}
+ title="Exit comparison (Esc)"
+ className="absolute right-4 top-4 inline-flex h-7 items-center rounded-md border border-border px-2 text-xs font-medium text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
+ >
+ Keep current version
+ </button>
+ )}
{/* Close button for copilot mode */}
{mode === "copilot" && onCopilotReviewClose && (
<button
diff --git a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowHistoryPanel.tsx b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowHistoryPanel.tsx
index 9f89afd75..f8fba388c 100644
--- a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowHistoryPanel.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowHistoryPanel.tsx
@@ -108,9 +108,10 @@ function WorkflowHistoryPanel({
{onClose && (
<Button
size="icon"
- variant="ghost"
+ variant="outline"
aria-label="Close"
- className="size-7"
+ title="Close"
+ className="h-7 w-7 border-border bg-transparent shadow-none"
onClick={onClose}
>
<Cross2Icon className="size-4" />
diff --git a/skyvern-frontend/src/routes/workflows/studio/BlockStatusBar.tsx b/skyvern-frontend/src/routes/workflows/studio/BlockStatusBar.tsx
index b4f6857f9..0180e60fa 100644
--- a/skyvern-frontend/src/routes/workflows/studio/BlockStatusBar.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/BlockStatusBar.tsx
@@ -25,8 +25,8 @@ export function BlockStatusBar({ blockLabel }: { blockLabel: string }) {
if (outcome === "running") {
return (
- <div className="flex items-center gap-2 rounded-md bg-studio-accent/15 px-3 py-2 text-xs font-medium text-studio-accent-2">
- <span className="h-2 w-2 animate-pulse rounded-full bg-studio-accent shadow-[0_0_0_3px_rgba(109,108,246,0.18)]" />
+ <div className="flex items-center gap-2 rounded-md bg-warning/15 px-3 py-2 text-xs font-medium text-warning">
+ <span className="h-2 w-2 animate-pulse rounded-full bg-warning" />
Running… watching the live browser
</div>
);
diff --git a/skyvern-frontend/src/routes/workflows/studio/BrowserPaneHeader.tsx b/skyvern-frontend/src/routes/workflows/studio/BrowserPaneHeader.tsx
index 2f7af0ff9..0d4852a2b 100644
--- a/skyvern-frontend/src/routes/workflows/studio/BrowserPaneHeader.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/BrowserPaneHeader.tsx
@@ -27,17 +27,18 @@ import { toast } from "@/components/ui/use-toast";
import { useBrowserStreamingMode } from "@/hooks/useRuntimeConfig";
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
import { StreamModeBadge } from "@/routes/streaming/StreamDiagnostics";
-import { useRecordingLauncherStore } from "@/store/useRecordingLauncherStore";
import { useRecordingStore } from "@/store/useRecordingStore";
import { useStudioBrowserStore } from "@/store/useStudioBrowserStore";
import { cn } from "@/util/utils";
+import { ControlTooltip } from "./ControlTooltip";
+import { PaneHeaderDivider } from "./PaneHeaderDivider";
import { useBrowserPaneView } from "./useBrowserPaneView";
import { useStudioPaneCompact } from "./StudioShellContext";
import { ViewToggle } from "./ViewToggle";
const ICON_BUTTON =
- "shrink-0 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 disabled:cursor-not-allowed disabled:opacity-40";
+ "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-40";
const RECORDING_ARCHIVED_LABEL =
"Recording archived — contact [email protected] to request restoration";
@@ -50,13 +51,16 @@ export function BrowserPaneViewPills() {
return (
<>
- {compact ? null : (
+ {/* Stream-transport diagnostics are a local-dev aid; deployed builds
+ keep the header clean. */}
+ {compact || !import.meta.env.DEV ? null : (
<StreamModeBadge mode={browserStreamingMode} className="shrink-0" />
)}
+ <PaneHeaderDivider />
<div
role="group"
aria-label="Browser view"
- className="flex shrink-0 items-center gap-0.5 rounded-md border border-slate-700 bg-slate-elevation2 p-0.5"
+ className="flex shrink-0 items-center gap-1"
>
<ViewToggle
active={view === "live"}
@@ -67,7 +71,19 @@ export function BrowserPaneViewPills() {
<span className="h-1.5 w-1.5 animate-pulse rounded-full bg-success" />
}
/>
- {hasRecording ? (
+ {!hasRecording && visuals.recordingArchived ? (
+ <ControlTooltip content={RECORDING_ARCHIVED_LABEL} blocked>
+ <button
+ type="button"
+ disabled
+ aria-label={RECORDING_ARCHIVED_LABEL}
+ className="pointer-events-none inline-flex items-center gap-1.5 rounded px-2 py-1 text-[11px] font-medium text-muted-foreground opacity-60"
+ >
+ <PlayIcon className="h-3 w-3" />
+ {compact ? null : "Recording archived"}
+ </button>
+ </ControlTooltip>
+ ) : (
<ViewToggle
active={view === "recording"}
onClick={() => setView("recording")}
@@ -75,27 +91,14 @@ export function BrowserPaneViewPills() {
label="Recording"
icon={<PlayIcon className="h-3 w-3" />}
/>
- ) : visuals.recordingArchived ? (
- <button
- type="button"
- disabled
- title={RECORDING_ARCHIVED_LABEL}
- aria-label={RECORDING_ARCHIVED_LABEL}
- className="inline-flex cursor-not-allowed items-center gap-1.5 rounded px-2 py-1 text-[11px] font-medium text-muted-foreground opacity-60"
- >
- <PlayIcon className="h-3 w-3" />
- {compact ? null : "Recording archived"}
- </button>
- ) : null}
- {visuals.hasScreenshots ? (
- <ViewToggle
- active={view === "screenshots"}
- onClick={() => setView("screenshots")}
- compact={compact}
- label="Screenshots"
- icon={<ImageIcon className="h-3 w-3" />}
- />
- ) : null}
+ )}
+ <ViewToggle
+ active={view === "screenshots"}
+ onClick={() => setView("screenshots")}
+ compact={compact}
+ label="Screenshots"
+ icon={<ImageIcon className="h-3 w-3" />}
+ />
</div>
</>
);
@@ -110,9 +113,7 @@ export function BrowserPaneActions() {
useBrowserPaneView();
const isRecording = useRecordingStore((s) => s.isRecording);
const manualCapturePaused = useRecordingStore((s) => s.manualCapturePaused);
- const startRecordingAtEnd = useRecordingLauncherStore(
- (s) => s.startRecordingAtEnd,
- );
+ const finishRequested = useRecordingStore((s) => s.finishRequested);
// These act on the debug browser; while the pane streams the run's own
// browser instead, they'd hit an invisible session — disable with a reason.
const debugHidden = liveSurface === "run";
@@ -165,56 +166,75 @@ export function BrowserPaneActions() {
return (
<>
- {isRecording ? (
- <span
- className={cn(
- "flex shrink-0 items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium",
- manualCapturePaused
- ? "bg-amber-500/10 text-amber-500"
- : "bg-red-500/10 text-red-500",
- )}
- >
- <span
- className={cn(
- "h-2 w-2 rounded-full",
- manualCapturePaused ? "bg-amber-500" : "animate-pulse bg-red-500",
- )}
- />
- {compact ? null : manualCapturePaused ? "Paused" : "Recording"}
- </span>
- ) : (
- <Button
- variant="secondary"
- size="sm"
- className="h-7 shrink-0 gap-1.5 px-2 text-xs"
- title="Record browser actions into blocks"
- disabled={!browserSessionId || !startRecordingAtEnd}
- onClick={() => startRecordingAtEnd?.()}
- >
- <span className="h-2 w-2 rounded-full bg-red-500" />
- {compact ? null : "Record"}
- </Button>
- )}
- <button
- type="button"
- title={debugHidden ? blockedTitle : "Reconnect"}
- aria-label="Reconnect browser stream"
- onClick={reload}
- disabled={!browserSessionId || debugHidden}
- className={ICON_BUTTON}
+ {isRecording
+ ? (() => {
+ // Same finish path as the drafts panel's Done: requestFinish stops
+ // capture and the mounted RecordingPanel commits the recorded steps.
+ const stopButton = (
+ <Button
+ variant="outline"
+ size="sm"
+ className={cn(
+ "h-7 shrink-0 gap-1.5 border-border bg-transparent px-2 text-xs shadow-none",
+ manualCapturePaused ? "text-amber-500" : "text-red-500",
+ )}
+ aria-label="Stop recording"
+ disabled={finishRequested}
+ onClick={() => useRecordingStore.getState().requestFinish()}
+ >
+ <span
+ className={cn(
+ "h-2 w-2 rounded-full",
+ manualCapturePaused
+ ? "bg-amber-500"
+ : "animate-pulse bg-red-500",
+ )}
+ />
+ {compact ? null : finishRequested ? "Stopping…" : "Stop"}
+ </Button>
+ );
+ // Labelled → no tooltip; compact collapses to the dot, so the
+ // tooltip carries the action.
+ return compact ? (
+ <ControlTooltip
+ content="Stop recording and save the recorded steps"
+ blocked={finishRequested}
+ >
+ {stopButton}
+ </ControlTooltip>
+ ) : (
+ stopButton
+ );
+ })()
+ : null}
+ <ControlTooltip
+ content={debugHidden ? blockedTitle : "Reconnect"}
+ blocked={!browserSessionId || debugHidden}
>
- <ReloadIcon className="h-3.5 w-3.5" />
- </button>
- <button
- type="button"
- title={debugHidden ? blockedTitle : "Open in new tab"}
- aria-label="Open browser in new tab"
- onClick={openInNewTab}
- disabled={!browserSessionId || debugHidden}
- className={ICON_BUTTON}
+ <button
+ type="button"
+ aria-label="Reconnect browser stream"
+ onClick={reload}
+ disabled={!browserSessionId || debugHidden}
+ className={ICON_BUTTON}
+ >
+ <ReloadIcon className="h-3.5 w-3.5" />
+ </button>
+ </ControlTooltip>
+ <ControlTooltip
+ content={debugHidden ? blockedTitle : "Open in new tab"}
+ blocked={!browserSessionId || debugHidden}
>
- <OpenInNewWindowIcon className="h-3.5 w-3.5" />
- </button>
+ <button
+ type="button"
+ aria-label="Open browser in new tab"
+ onClick={openInNewTab}
+ disabled={!browserSessionId || debugHidden}
+ className={ICON_BUTTON}
+ >
+ <OpenInNewWindowIcon className="h-3.5 w-3.5" />
+ </button>
+ </ControlTooltip>
<Dialog
open={confirmOff}
onOpenChange={(open) => {
@@ -224,17 +244,23 @@ export function BrowserPaneActions() {
setConfirmOff(open);
}}
>
- <DialogTrigger asChild>
- <button
- type="button"
- title={debugHidden ? blockedTitle : "Turn off browser"}
- aria-label="Turn off browser"
- disabled={!workflowPermanentId || !browserSessionId || debugHidden}
- className={ICON_BUTTON}
- >
- <PowerIcon className="h-3.5 w-3.5" />
- </button>
- </DialogTrigger>
+ <ControlTooltip
+ content={debugHidden ? blockedTitle : "Turn off browser"}
+ blocked={!workflowPermanentId || !browserSessionId || debugHidden}
+ >
+ <DialogTrigger asChild>
+ <button
+ type="button"
+ aria-label="Turn off browser"
+ disabled={
+ !workflowPermanentId || !browserSessionId || debugHidden
+ }
+ className={ICON_BUTTON}
+ >
+ <PowerIcon className="h-3.5 w-3.5" />
+ </button>
+ </DialogTrigger>
+ </ControlTooltip>
<DialogContent>
<DialogHeader>
<DialogTitle>Turn off this browser?</DialogTitle>
diff --git a/skyvern-frontend/src/routes/workflows/studio/BrowserPiP.tsx b/skyvern-frontend/src/routes/workflows/studio/BrowserPiP.tsx
index d63ba9ed5..0e22860f3 100644
--- a/skyvern-frontend/src/routes/workflows/studio/BrowserPiP.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/BrowserPiP.tsx
@@ -66,7 +66,7 @@ export function BrowserPiP() {
<div
className={cn(
"absolute bottom-4 right-4 z-30 flex w-[22rem] flex-col overflow-hidden rounded-lg border bg-slate-elevation1 shadow-lg duration-150",
- live ? "border-studio-accent/50" : "border-border",
+ live ? "border-success/50" : "border-border",
minimized
? "animate-out fade-out zoom-out-95"
: "animate-in fade-in zoom-in-95",
diff --git a/skyvern-frontend/src/routes/workflows/studio/BrowserTab.test.tsx b/skyvern-frontend/src/routes/workflows/studio/BrowserTab.test.tsx
index 753e75288..7a3915400 100644
--- a/skyvern-frontend/src/routes/workflows/studio/BrowserTab.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/BrowserTab.test.tsx
@@ -13,6 +13,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ActionTypes, Status, type ActionsApiResponse } from "@/api/types";
+import { TooltipProvider } from "@/components/ui/tooltip";
import { useRecordingStore } from "@/store/useRecordingStore";
import { useRunViewStore } from "@/store/RunViewStore";
import { useStudioBrowserStore } from "@/store/useStudioBrowserStore";
@@ -192,31 +193,34 @@ function renderBrowserPane(initialPath: string) {
const queryClient = new QueryClient();
const view = render(
<QueryClientProvider client={queryClient}>
- <StudioShellContext.Provider
- value={{
- copilotPortalEl: null,
- setEditorStreamSlot: () => {},
- setBrowserStreamSlot,
- setRunStreamSlot: () => {},
- }}
- >
- <MemoryRouter initialEntries={[initialPath]}>
- <Routes>
- <Route
- path="/workflows/:workflowPermanentId/studio"
- element={
- <>
- <div data-testid="pane-header">
- <BrowserPaneViewPills />
- <BrowserPaneActions />
- </div>
- <BrowserTab />
- </>
- }
- />
- </Routes>
- </MemoryRouter>
- </StudioShellContext.Provider>
+ <TooltipProvider delayDuration={0}>
+ <StudioShellContext.Provider
+ value={{
+ copilotPortalEl: null,
+ panelPortalEl: null,
+ setEditorStreamSlot: () => {},
+ setBrowserStreamSlot,
+ setRunStreamSlot: () => {},
+ }}
+ >
+ <MemoryRouter initialEntries={[initialPath]}>
+ <Routes>
+ <Route
+ path="/workflows/:workflowPermanentId/studio"
+ element={
+ <>
+ <div data-testid="pane-header">
+ <BrowserPaneViewPills />
+ <BrowserPaneActions />
+ </div>
+ <BrowserTab />
+ </>
+ }
+ />
+ </Routes>
+ </MemoryRouter>
+ </StudioShellContext.Provider>
+ </TooltipProvider>
</QueryClientProvider>,
);
return { ...view, setBrowserStreamSlot };
@@ -247,8 +251,10 @@ describe("BrowserTab view machine", () => {
expect(
screen.getByRole("button", { name: "Live" }).getAttribute("aria-pressed"),
).toBe("true");
- expect(screen.queryByRole("button", { name: "Recording" })).toBeNull();
- expect(screen.queryByRole("button", { name: "Screenshots" })).toBeNull();
+ // The replay pills stay visible even with nothing to replay; their views
+ // render empty states instead of the pills disappearing.
+ expect(screen.getByRole("button", { name: "Recording" })).toBeTruthy();
+ expect(screen.getByRole("button", { name: "Screenshots" })).toBeTruthy();
});
it("registers the shell stream slot while live", () => {
@@ -266,11 +272,20 @@ describe("BrowserTab view machine", () => {
);
});
- it("defaults an idle workflow with history and no session to the replay", () => {
+ it("edit entry stays on the (booting) live surface, not the latest run's replay", () => {
+ // The latest run has a recording but the URL names no run: the pane must
+ // come up live (warming) instead of flashing the replay while the debug
+ // session boots.
seedRun({ status: Status.Completed, recordingUrl: "https://r.test/1.mp4" });
renderBrowserPane(STUDIO_PATH);
- expect(screen.getByTestId("hero-recording")).toBeTruthy();
+ expect(screen.queryByTestId("hero-recording")).toBeNull();
+ expect(screen.getByTestId("stream-status").textContent).toContain(
+ "Warming up your browser",
+ );
+ expect(
+ screen.getByRole("button", { name: "Live" }).getAttribute("aria-pressed"),
+ ).toBe("true");
});
it("prefers the live debug browser over an old run's replay when idle", () => {
@@ -376,7 +391,26 @@ describe("BrowserTab view machine", () => {
renderBrowserPane(`${STUDIO_PATH}&wr=wr_1&active=act_1`);
expect(screen.getByTestId("browser-pane-stream-slot")).toBeTruthy();
- expect(screen.getByText("Recording", { exact: true })).toBeTruthy();
+ expect(screen.getByRole("button", { name: "Stop recording" })).toBeTruthy();
+ });
+
+ it("the header Stop button requests the same finish path as the drafts panel", () => {
+ seedRun({ status: Status.Completed });
+ mocks.debugSession = { browser_session_id: "pbs_test" };
+ useRecordingStore.setState({ isRecording: true });
+ renderBrowserPane(`${STUDIO_PATH}&wr=wr_1`);
+
+ fireEvent.click(screen.getByRole("button", { name: "Stop recording" }));
+ expect(useRecordingStore.getState().finishRequested).toBe(true);
+ });
+
+ it("a pinned Recording view without a recording shows the empty state", () => {
+ seedRun({ status: Status.Completed });
+ mocks.debugSession = { browser_session_id: "pbs_test" };
+ renderBrowserPane(`${STUDIO_PATH}&wr=wr_1`);
+
+ fireEvent.click(screen.getByRole("button", { name: "Recording" }));
+ expect(screen.getByText("No recording for this run")).toBeTruthy();
});
it("flags a queued block run on the live debug stream", () => {
@@ -471,3 +505,20 @@ describe("BrowserTab pills and selection sync", () => {
).toBe("false");
});
});
+
+describe("stream-mode badge dev gating", () => {
+ afterEach(() => {
+ vi.unstubAllEnvs();
+ });
+
+ it("shows the transport badge in dev builds (vitest runs as dev)", () => {
+ renderBrowserPane(STUDIO_PATH);
+ expect(screen.queryByTestId("stream-mode-badge")).not.toBeNull();
+ });
+
+ it("hides the transport badge outside dev builds", () => {
+ vi.stubEnv("DEV", false);
+ renderBrowserPane(STUDIO_PATH);
+ expect(screen.queryByTestId("stream-mode-badge")).toBeNull();
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/studio/BrowserTab.tsx b/skyvern-frontend/src/routes/workflows/studio/BrowserTab.tsx
index 3e6ed286b..2bce5e546 100644
--- a/skyvern-frontend/src/routes/workflows/studio/BrowserTab.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/BrowserTab.tsx
@@ -110,10 +110,16 @@ export function BrowserTab() {
/>
)
) : view === "recording" ? (
- <HeroRecording
- recordingUrls={recordingUrls}
- onPlay={onRecordingPlay}
- />
+ recordingUrls.length > 0 ? (
+ <HeroRecording
+ recordingUrls={recordingUrls}
+ onPlay={onRecordingPlay}
+ />
+ ) : (
+ <div className="absolute inset-0 grid place-items-center text-sm text-muted-foreground">
+ No recording for this run
+ </div>
+ )
) : heroSelection ? (
<>
<HeroScreenshot selection={heroSelection} running={running} />
@@ -128,7 +134,9 @@ export function BrowserTab() {
</>
) : (
<div className="absolute inset-0 grid place-items-center text-sm text-muted-foreground">
- Waiting for the first action…
+ {visuals.finalized
+ ? "No screenshots for this run"
+ : "Waiting for the first action…"}
</div>
)}
</div>
diff --git a/skyvern-frontend/src/routes/workflows/studio/ControlTooltip.tsx b/skyvern-frontend/src/routes/workflows/studio/ControlTooltip.tsx
new file mode 100644
index 000000000..8ea6c4606
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/studio/ControlTooltip.tsx
@@ -0,0 +1,44 @@
+import { type ReactElement, type ReactNode } from "react";
+
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+import { cn } from "@/util/utils";
+
+/**
+ * Radix tooltip for studio chrome controls that can be disabled. A disabled
+ * button swallows the trigger's pointer/focus events, so the trigger is a span
+ * wrapper (the standard Radix disabled-trigger idiom) — the control must pair
+ * this with `disabled:pointer-events-none` so the span receives the hover.
+ */
+export function ControlTooltip({
+ content,
+ blocked = false,
+ side = "bottom",
+ wrapperClassName,
+ children,
+}: {
+ content: ReactNode;
+ // True while the wrapped control is disabled: keeps the tooltip reachable
+ // from the keyboard by making the wrapper itself focusable.
+ blocked?: boolean;
+ side?: "top" | "bottom" | "left" | "right";
+ wrapperClassName?: string;
+ children: ReactElement;
+}) {
+ return (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span
+ className={cn("inline-flex shrink-0", wrapperClassName)}
+ {...(blocked ? { tabIndex: 0 } : {})}
+ >
+ {children}
+ </span>
+ </TooltipTrigger>
+ <TooltipContent side={side}>{content}</TooltipContent>
+ </Tooltip>
+ );
+}
diff --git a/skyvern-frontend/src/routes/workflows/studio/CopilotPaneHeader.tsx b/skyvern-frontend/src/routes/workflows/studio/CopilotPaneHeader.tsx
new file mode 100644
index 000000000..16c778acd
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/studio/CopilotPaneHeader.tsx
@@ -0,0 +1,63 @@
+import { PlusIcon } from "@radix-ui/react-icons";
+
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+import { useCopilotHeaderStore } from "@/store/useCopilotHeaderStore";
+
+import { WorkflowCopilotHistory } from "../copilot/WorkflowCopilotHistory";
+
+/**
+ * Copilot pane header chrome: the History and New-chat controls the docked
+ * chat registers via useCopilotHeaderStore (its own second header row is gone
+ * in the studio). Renders nothing while no docked chat is mounted.
+ */
+export function CopilotPaneControls() {
+ const controls = useCopilotHeaderStore((s) => s.controls);
+ if (!controls) {
+ return null;
+ }
+ return (
+ <>
+ {/* Icon-only bordered squares per the studio button grammar; labels
+ live in the tooltips and aria-labels. */}
+ <WorkflowCopilotHistory
+ workflowPermanentId={controls.workflowPermanentId}
+ currentChatId={controls.currentChatId}
+ onSelect={controls.onSelectChat}
+ disabled={controls.disabled}
+ compact
+ />
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button
+ type="button"
+ onClick={controls.onNewChat}
+ aria-label="New chat"
+ className="inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
+ >
+ <PlusIcon className="h-3.5 w-3.5" aria-hidden="true" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent side="bottom">New chat</TooltipContent>
+ </Tooltip>
+ </>
+ );
+}
+
+/**
+ * Presence badge on the Copilot pane-header icon, replacing the old "● Active"
+ * text chip (which was an always-on session indicator; the dot keeps that
+ * meaning with the state voiced through the aria-label).
+ */
+export function CopilotActiveDot() {
+ return (
+ <span
+ role="img"
+ aria-label="Copilot session active"
+ className="absolute -bottom-0.5 -right-0.5 h-1.5 w-1.5 rounded-full bg-success ring-2 ring-slate-elevation1"
+ />
+ );
+}
diff --git a/skyvern-frontend/src/routes/workflows/studio/EditorPaneHeader.tsx b/skyvern-frontend/src/routes/workflows/studio/EditorPaneHeader.tsx
new file mode 100644
index 000000000..b637c3475
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/studio/EditorPaneHeader.tsx
@@ -0,0 +1,37 @@
+import {
+ commitYamlDraft,
+ useWorkflowYamlEditorStore,
+} from "@/store/WorkflowYamlEditorStore";
+
+import { YamlModeToggle } from "../editor/YamlModeToggle";
+import { PaneHeaderDivider } from "./PaneHeaderDivider";
+import { useStudioPaneCompact } from "./StudioShellContext";
+
+/**
+ * Editor pane header chrome: the Visual/Code mode toggle, relocated from the
+ * canvas's floating overlay. Entry is registered by the embedded Workspace
+ * (it owns the canvas→YAML serialization); exit is the store's shared
+ * commit-on-switch flow. Hidden for read-only (global) workflows, which never
+ * register an entry point.
+ */
+export function EditorPaneModeToggle() {
+ const compact = useStudioPaneCompact();
+ const active = useWorkflowYamlEditorStore((s) => s.active);
+ const committing = useWorkflowYamlEditorStore((s) => s.committing);
+ const enterYamlMode = useWorkflowYamlEditorStore((s) => s.enterYamlMode);
+ if (!enterYamlMode) {
+ return null;
+ }
+ return (
+ <>
+ <PaneHeaderDivider />
+ <YamlModeToggle
+ mode={active ? "code" : "visual"}
+ compact={compact}
+ disabled={committing}
+ onCode={enterYamlMode}
+ onVisual={() => void commitYamlDraft(false)}
+ />
+ </>
+ );
+}
diff --git a/skyvern-frontend/src/routes/workflows/studio/EditorTab.tsx b/skyvern-frontend/src/routes/workflows/studio/EditorTab.tsx
index 9147f4541..307a47f53 100644
--- a/skyvern-frontend/src/routes/workflows/studio/EditorTab.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/EditorTab.tsx
@@ -13,8 +13,8 @@ export type StudioWorkspaceProps = Omit<
"showBrowser" | "embedded"
>;
-// Editor tab: the real Workspace canvas in embedded mode (the shell owns the top
-// bar + Copilot spine, so Workspace's floating header is suppressed).
+// Editor tab: the real Workspace canvas in embedded mode (the shell owns the
+// top bar and pane chrome, so Workspace's floating header is suppressed).
export function EditorTab(props: StudioWorkspaceProps) {
// Show the overlay only while a commit is genuinely in flight or its blocks
// are landing. Both signals clear on *every* terminal outcome (success, empty,
diff --git a/skyvern-frontend/src/routes/workflows/studio/PaneHeaderDivider.tsx b/skyvern-frontend/src/routes/workflows/studio/PaneHeaderDivider.tsx
new file mode 100644
index 000000000..dc97c269f
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/studio/PaneHeaderDivider.tsx
@@ -0,0 +1,8 @@
+/**
+ * Hairline between a title and its tab cluster (top bar and pane headers) —
+ * part of the studio button grammar (tabs are borderless ghost pills; the
+ * divider carries the visual separation the old pill containers provided).
+ */
+export function PaneHeaderDivider() {
+ return <span aria-hidden className="h-[18px] w-px shrink-0 bg-border" />;
+}
diff --git a/skyvern-frontend/src/routes/workflows/studio/RunTab.tsx b/skyvern-frontend/src/routes/workflows/studio/RunTab.tsx
index ad6fe8c23..aea9dac33 100644
--- a/skyvern-frontend/src/routes/workflows/studio/RunTab.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/RunTab.tsx
@@ -1,12 +1,12 @@
import { useNavigate, useParams, useSearchParams } from "react-router-dom";
-import { STUDIO_PANES_PARAM } from "./panes";
import { RunView } from "./runview/RunView";
import { useStudioInspectedRun } from "./useStudioInspectedRun";
import { useStudioPanes } from "./useStudioPanes";
+import { useStudioWorkflowDeletedAt } from "./StudioShellContext";
/**
- * Timeline pane of the studio shell — the run timeline + run-data view (the
+ * Overview pane of the studio shell — the run timeline + run-data view (the
* Browser pane owns the visuals). Shows the run in the URL when present,
* otherwise the workflow's most recent run.
*/
@@ -14,8 +14,11 @@ export function RunTab() {
const navigate = useNavigate();
const [searchParams] = useSearchParams();
const { workflowPermanentId } = useParams();
- const { openPane, resolveLivePanes } = useStudioPanes();
+ const { openPane } = useStudioPanes();
const { runId, pending } = useStudioInspectedRun();
+ // Fix (Copilot) and Retry both mutate/rerun the workflow — gone with the
+ // source agent, so the CTAs go too (the run stays viewable).
+ const workflowDeleted = useStudioWorkflowDeletedAt() !== null;
// ?bl= marks a block-scoped run; "Retry as-is" would rerun the whole workflow,
// so suppress that CTA for block runs (the block is rerun from the editor).
const isBlockRun = searchParams.has("bl");
@@ -24,23 +27,25 @@ export function RunTab() {
<RunView
workflowRunId={runId}
runIdPending={pending}
- onFix={(seedMessage) => {
- // One replace-navigation opens the Copilot pane and seeds the message via
- // location.state (Workspace reads it as the copilot's initialMessage), so
- // the pane write can't race a separate state-only navigation.
- openPane("copilot", {
- state: { copilotMessage: seedMessage, copilotFixOrigin: true },
- });
- }}
+ onFix={
+ workflowDeleted
+ ? undefined
+ : (seedMessage) => {
+ // One replace-navigation opens the Copilot pane and seeds the message
+ // via location.state (Workspace reads it as the copilot's
+ // initialMessage), so the pane write can't race a separate
+ // state-only navigation.
+ openPane("copilot", {
+ state: { copilotMessage: seedMessage, copilotFixOrigin: true },
+ });
+ }
+ }
onRetry={
- isBlockRun
+ isBlockRun || workflowDeleted
? undefined
- : () =>
- // ?panes= rides through the run form so the post-start navigate
- // restores this exact layout (plus the run surfaces appended).
- navigate(
- `/agents/${workflowPermanentId}/run?${STUDIO_PANES_PARAM}=${resolveLivePanes().join(",")}`,
- )
+ : // The post-start navigate resets the layout to the run mapping,
+ // so the form round-trip carries nothing.
+ () => navigate(`/agents/${workflowPermanentId}/run`)
}
/>
);
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioCoachMark.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioCoachMark.tsx
index 6a075fa13..2d5e47f1e 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioCoachMark.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioCoachMark.tsx
@@ -7,9 +7,9 @@ import { useStudioFirstRunStore } from "@/store/StudioFirstRunStore";
import { liveSearch } from "./liveSearch";
/**
- * One-time callout beside the spine teaching that tabs open side-by-side
- * panes. Suppressed on deep-linked visits (a shared run link is the wrong
- * moment to teach layout); the first pane toggle also dismisses it for good.
+ * One-time callout under the top bar's pane toggles teaching that they open
+ * side-by-side panes. Suppressed on deep-linked visits (a shared run link is
+ * the wrong moment to teach layout); the first pane toggle also dismisses it.
*/
export function StudioCoachMark() {
const coachMarkSeen = useStudioFirstRunStore((s) => s.coachMarkSeen);
@@ -30,16 +30,16 @@ export function StudioCoachMark() {
<div
role="note"
aria-label="Studio panes tip"
- className="absolute left-3 top-8 z-50 w-64 rounded-md border bg-popover p-3 text-popover-foreground shadow-md duration-200 motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-left-2"
+ className="absolute left-1/2 top-3 z-50 w-64 -translate-x-1/2 rounded-md border bg-popover p-3 text-popover-foreground shadow-md duration-200 motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-top-2"
>
<span
aria-hidden
- className="absolute -left-1 top-5 size-2 rotate-45 border-b border-l bg-popover"
+ className="absolute -top-1 left-1/2 size-2 -translate-x-1/2 rotate-45 border-l border-t bg-popover"
/>
<p className="text-xs font-medium">Panes open side by side</p>
<p className="mt-1 text-xs text-muted-foreground">
- Each tab on this rail toggles a pane, so you can watch the browser while
- you edit, or keep Copilot next to a run.
+ Each toggle in the top bar opens a pane, so you can watch the browser
+ while you edit, or keep Copilot next to a run.
</p>
<Button
variant="secondary"
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioPaneDefaults.test.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioPaneDefaults.test.tsx
index 87986701b..584b20053 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioPaneDefaults.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioPaneDefaults.test.tsx
@@ -24,7 +24,7 @@ function PanesProbe() {
return (
<div>
<output data-testid="panes">{panes.join(",")}</output>
- <button onClick={() => togglePane("timeline")}>toggle-timeline</button>
+ <button onClick={() => togglePane("overview")}>toggle-overview</button>
<button onClick={() => openPane("editor")}>open-editor</button>
<button onClick={() => openPane("browser")}>open-browser</button>
</div>
@@ -90,14 +90,14 @@ describe("cold-entry default panes (the four contexts)", () => {
expect(panesText()).toBe("copilot,browser,editor");
});
- test("a run in the URL lands on Copilot + Browser + Timeline", () => {
+ test("a run in the URL lands on Copilot + Browser + Overview", () => {
renderStudio({ path: "/workflows/wpid_1/studio?wr=wr_1" });
- expect(panesText()).toBe("copilot,browser,timeline");
+ expect(panesText()).toBe("copilot,browser,overview");
});
- test("a block-run deep link lands on Editor + Browser + Timeline", () => {
+ test("a block-run deep link lands on Editor + Browser + Overview", () => {
renderStudio({ path: "/workflows/wpid_1/studio?wr=wr_1&bl=block_1" });
- expect(panesText()).toBe("editor,browser,timeline");
+ expect(panesText()).toBe("editor,browser,overview");
});
test("a blocks signal that changes after mount does not reshuffle the panes", () => {
@@ -118,9 +118,9 @@ describe("cold-entry default panes (the four contexts)", () => {
expect(panesText()).toBe("browser");
});
- test("the pre-rename ?panes=run alias presents the Timeline pane", () => {
+ test("the pre-rename ?panes=run alias presents the Overview pane", () => {
renderStudio({ path: "/workflows/wpid_1/studio?panes=copilot,run" });
- expect(panesText()).toBe("copilot,timeline");
+ expect(panesText()).toBe("copilot,overview");
});
test("toggling from the state default writes the default plus the change", () => {
@@ -132,7 +132,7 @@ describe("cold-entry default panes (the four contexts)", () => {
describe("narrow-viewport clamp of shared links", () => {
const FOUR_PANES =
- "/workflows/wpid_1/studio?panes=copilot,editor,browser,timeline";
+ "/workflows/wpid_1/studio?panes=copilot,editor,browser,overview";
test("an over-wide shared link degrades to its fitting prefix", () => {
renderStudio({ path: FOUR_PANES, stageWidth: 600 });
@@ -141,18 +141,18 @@ describe("narrow-viewport clamp of shared links", () => {
test("a wide viewport presents the shared link untouched", () => {
renderStudio({ path: FOUR_PANES, stageWidth: 2000 });
- expect(panesText()).toBe("copilot,editor,browser,timeline");
+ expect(panesText()).toBe("copilot,editor,browser,overview");
});
test("without a measurable stage the list is presented as-is", () => {
renderStudio({ path: FOUR_PANES });
- expect(panesText()).toBe("copilot,editor,browser,timeline");
+ expect(panesText()).toBe("copilot,editor,browser,overview");
});
test("the first pane write clears the clamp and builds on what is shown", () => {
renderStudio({ path: FOUR_PANES, stageWidth: 600 });
- fireEvent.click(screen.getByText("toggle-timeline"));
- expect(panesText()).toBe("copilot,editor,timeline");
+ fireEvent.click(screen.getByText("toggle-overview"));
+ expect(panesText()).toBe("copilot,editor,overview");
});
});
@@ -162,9 +162,9 @@ describe("narrow-viewport nudge", () => {
path: "/workflows/wpid_1/studio?panes=copilot,editor",
stageWidth: 600,
});
- fireEvent.click(screen.getByText("toggle-timeline"));
+ fireEvent.click(screen.getByText("toggle-overview"));
expect(toastMock).toHaveBeenCalledTimes(1);
- expect(panesText()).toBe("copilot,editor,timeline");
+ expect(panesText()).toBe("copilot,editor,overview");
fireEvent.click(screen.getByText("open-browser"));
expect(toastMock).toHaveBeenCalledTimes(1);
expect(useStudioFirstRunStore.getState().narrowNudgeSeen).toBe(true);
@@ -181,10 +181,10 @@ describe("narrow-viewport nudge", () => {
test("closing a pane never nudges", () => {
renderStudio({
- path: "/workflows/wpid_1/studio?panes=copilot,timeline",
+ path: "/workflows/wpid_1/studio?panes=copilot,overview",
stageWidth: 600,
});
- fireEvent.click(screen.getByText("toggle-timeline"));
+ fireEvent.click(screen.getByText("toggle-overview"));
expect(panesText()).toBe("copilot");
expect(toastMock).not.toHaveBeenCalled();
});
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioSpine.test.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioPaneToggles.test.tsx
similarity index 75%
rename from skyvern-frontend/src/routes/workflows/studio/StudioSpine.test.tsx
rename to skyvern-frontend/src/routes/workflows/studio/StudioPaneToggles.test.tsx
index aef36060f..6a578dd2b 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioSpine.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioPaneToggles.test.tsx
@@ -5,9 +5,10 @@ import { MemoryRouter, useLocation } from "react-router-dom";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { Status } from "@/api/types";
+import { TooltipProvider } from "@/components/ui/tooltip";
import { useStudioBrowserStore } from "@/store/useStudioBrowserStore";
-import { StudioSpine } from "./StudioSpine";
+import { StudioPaneToggles } from "./StudioPaneToggles";
const { runsQueryMock, runWithWorkflowMock } = vi.hoisted(() => ({
runsQueryMock: vi.fn(),
@@ -32,7 +33,10 @@ function LocationProbe() {
function renderAt(path = "/workflows/wpid_abc/studio") {
return render(
<MemoryRouter initialEntries={[path]}>
- <StudioSpine />
+ {/* The shell provides this in production (StudioShell root). */}
+ <TooltipProvider delayDuration={0}>
+ <StudioPaneToggles />
+ </TooltipProvider>
<LocationProbe />
</MemoryRouter>,
);
@@ -54,10 +58,10 @@ beforeEach(() => {
runWithWorkflowMock.mockReturnValue({ data: undefined });
});
-describe("StudioSpine structure", () => {
+describe("StudioPaneToggles structure", () => {
test("renders the four peer tabs with icon + label", () => {
renderAt();
- for (const label of ["Copilot", "Editor", "Browser", "Timeline"]) {
+ for (const label of ["Copilot", "Editor", "Browser", "Overview"]) {
expect(tab(new RegExp(`^${label}`))).toBeTruthy();
}
});
@@ -80,19 +84,19 @@ describe("StudioSpine structure", () => {
runsQueryMock.mockReturnValue({ data: [{ status: Status.Completed }] });
renderAt("/workflows/wpid_abc/studio?wr=run_1&panes=copilot");
expect(tab(/^Copilot/).getAttribute("aria-expanded")).toBe("true");
- expect(tab(/^Timeline/).getAttribute("aria-expanded")).toBe("false");
+ expect(tab(/^Overview/).getAttribute("aria-expanded")).toBe("false");
});
- test("a block-run deep link opens Editor, Browser and Timeline", () => {
+ test("a block-run deep link opens Editor, Browser and Overview", () => {
renderAt("/workflows/wpid_abc/studio?wr=run_1&bl=block_1");
expect(tab(/^Editor/).getAttribute("aria-expanded")).toBe("true");
expect(tab(/^Browser/).getAttribute("aria-expanded")).toBe("true");
- expect(tab(/^Timeline/).getAttribute("aria-expanded")).toBe("true");
+ expect(tab(/^Overview/).getAttribute("aria-expanded")).toBe("true");
expect(tab(/^Copilot/).getAttribute("aria-expanded")).toBe("false");
});
});
-describe("StudioSpine pane toggling", () => {
+describe("StudioPaneToggles pane toggling", () => {
test("opening a closed pane appends it in click order", () => {
renderAt();
fireEvent.click(tab(/^Editor/));
@@ -120,55 +124,57 @@ describe("StudioSpine pane toggling", () => {
const params = new URLSearchParams(search);
expect(params.get("wr")).toBe("run_1");
expect(params.get("bl")).toBe("block_1");
- expect(params.get("panes")).toBe("editor,browser,timeline,copilot");
+ expect(params.get("panes")).toBe("editor,browser,overview,copilot");
});
});
-describe("StudioSpine Timeline gating", () => {
- test("disables the Timeline tab until a run exists", () => {
+describe("StudioPaneToggles Overview gating", () => {
+ test("disables the Overview tab until a run exists", () => {
renderAt();
- expect(tab(/^Timeline/).disabled).toBe(true);
+ expect(tab(/^Overview/).disabled).toBe(true);
});
- test("enables the Timeline tab when the workflow has a prior run", () => {
+ test("enables the Overview tab when the workflow has a prior run", () => {
runsQueryMock.mockReturnValue({ data: [{ status: Status.Running }] });
renderAt();
- expect(tab(/^Timeline/).disabled).toBe(false);
+ expect(tab(/^Overview/).disabled).toBe(false);
});
- test("enables the Timeline tab when the URL points at a run (?wr=)", () => {
+ test("enables the Overview tab when the URL points at a run (?wr=)", () => {
renderAt("/workflows/wpid_abc/studio?wr=run_1&panes=copilot");
- expect(tab(/^Timeline/).disabled).toBe(false);
+ expect(tab(/^Overview/).disabled).toBe(false);
});
});
-describe("StudioSpine run-status dot", () => {
+describe("StudioPaneToggles run-status dot", () => {
test("shows a status-colored dot for a finalized run", () => {
runsQueryMock.mockReturnValue({ data: [{ status: Status.Completed }] });
renderAt();
- const dot = tab(/^Timeline/).querySelector(
- "span.absolute.right-1",
+ const dot = tab(/^Overview/).querySelector(
+ "span.absolute.-right-0\\.5",
) as HTMLElement | null;
expect(dot).not.toBeNull();
expect(dot?.className).toContain("bg-badge-success");
});
- test("includes the finalized run status in the Timeline tab accessible name", () => {
+ test("includes the finalized run status in the Overview tab accessible name", () => {
runsQueryMock.mockReturnValue({ data: [{ status: Status.TimedOut }] });
renderAt();
expect(
- screen.getByRole("button", { name: "Timeline, timed out" }),
+ screen.getByRole("button", { name: "Overview, timed out" }),
).toBeTruthy();
});
test("omits the dot while the run is still in flight", () => {
runsQueryMock.mockReturnValue({ data: [{ status: Status.Running }] });
renderAt();
- expect(tab(/^Timeline/).querySelector("span.absolute.right-1")).toBeNull();
+ expect(
+ tab(/^Overview/).querySelector("span.absolute.-right-0\\.5"),
+ ).toBeNull();
});
});
-describe("StudioSpine browser activity", () => {
+describe("StudioPaneToggles browser activity", () => {
test("exposes unseen activity on the Browser tab while its pane is closed", () => {
useStudioBrowserStore.getState().markActivity();
renderAt("/workflows/wpid_abc/studio?panes=copilot");
@@ -194,7 +200,7 @@ describe("StudioSpine browser activity", () => {
});
});
-describe("StudioSpine keyboard navigation", () => {
+describe("StudioPaneToggles keyboard navigation", () => {
test("the rail is a single tab stop (roving tabindex)", () => {
renderAt();
expect(
@@ -204,30 +210,30 @@ describe("StudioSpine keyboard navigation", () => {
).toEqual([0, -1, -1]);
});
- test("ArrowDown moves focus and wraps past the disabled Timeline tab", () => {
+ test("ArrowRight moves focus and wraps past the disabled Overview toggle", () => {
renderAt();
tab(/^Copilot/).focus();
- fireEvent.keyDown(tab(/^Copilot/), { key: "ArrowDown" });
+ fireEvent.keyDown(tab(/^Copilot/), { key: "ArrowRight" });
expect(document.activeElement).toBe(tab(/^Editor/));
- fireEvent.keyDown(tab(/^Editor/), { key: "ArrowDown" });
+ fireEvent.keyDown(tab(/^Editor/), { key: "ArrowRight" });
expect(document.activeElement).toBe(tab(/^Browser/));
- fireEvent.keyDown(tab(/^Browser/), { key: "ArrowDown" });
+ fireEvent.keyDown(tab(/^Browser/), { key: "ArrowRight" });
expect(document.activeElement).toBe(tab(/^Copilot/));
});
- test("ArrowUp wraps to the last enabled tab and Home returns to the first", () => {
+ test("ArrowLeft wraps to the last enabled toggle and Home returns to the first", () => {
runsQueryMock.mockReturnValue({ data: [{ status: Status.Completed }] });
renderAt();
tab(/^Copilot/).focus();
- fireEvent.keyDown(tab(/^Copilot/), { key: "ArrowUp" });
- expect(document.activeElement).toBe(tab(/^Timeline/));
- fireEvent.keyDown(tab(/^Timeline/), { key: "Home" });
+ fireEvent.keyDown(tab(/^Copilot/), { key: "ArrowLeft" });
+ expect(document.activeElement).toBe(tab(/^Overview/));
+ fireEvent.keyDown(tab(/^Overview/), { key: "Home" });
expect(document.activeElement).toBe(tab(/^Copilot/));
});
test("arrow keys move focus without toggling panes", () => {
renderAt();
- fireEvent.keyDown(tab(/^Copilot/), { key: "ArrowDown" });
+ fireEvent.keyDown(tab(/^Copilot/), { key: "ArrowRight" });
expect(currentPanes()).toBeNull();
expect(tab(/^Editor/).getAttribute("aria-expanded")).toBe("false");
});
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioSpine.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioPaneToggles.tsx
similarity index 53%
rename from skyvern-frontend/src/routes/workflows/studio/StudioSpine.tsx
rename to skyvern-frontend/src/routes/workflows/studio/StudioPaneToggles.tsx
index bd51fdee8..0c3837c78 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioSpine.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioPaneToggles.tsx
@@ -1,14 +1,20 @@
-import { useState, type KeyboardEvent } from "react";
+import { useEffect, useState, type KeyboardEvent } from "react";
import { Status } from "@/api/types";
import { useStudioBrowserStore } from "@/store/useStudioBrowserStore";
import { cn } from "@/util/utils";
+import { ControlTooltip } from "./ControlTooltip";
import { studioPanelId, studioTabId } from "./constants";
import { STUDIO_PANE_META } from "./paneMeta";
-import { STUDIO_PANE_IDS, type StudioPaneId } from "./panes";
+import {
+ DELETED_WORKFLOW_BLOCKED_PANES,
+ STUDIO_PANE_IDS,
+ type StudioPaneId,
+} from "./panes";
import { useStudioPanes } from "./useStudioPanes";
import { useStudioRunSignals } from "./useStudioRunSignals";
+import { useStudioWorkflowDeletedAt } from "./StudioShellContext";
// Terminal-only (finalizedRunStatus never returns a live status); mirrors the
// StatusBadge variant buckets so the dot reads the same as the run chip.
@@ -32,18 +38,40 @@ function runStatusLabel(status: Status): string {
return status === Status.TimedOut ? "timed out" : status;
}
+// Mirrors the labels' `hidden xl:inline`: below Tailwind's xl the toggles are
+// icon-only and the tooltip carries the label; with labels visible, enabled
+// toggles have no tooltip (only icon-only controls tooltip).
+function useLabelsCollapsed(): boolean {
+ const [collapsed, setCollapsed] = useState(false);
+ useEffect(() => {
+ if (typeof window.matchMedia !== "function") {
+ return;
+ }
+ const query = window.matchMedia("(min-width: 1280px)");
+ const update = () => setCollapsed(!query.matches);
+ update();
+ query.addEventListener("change", update);
+ return () => query.removeEventListener("change", update);
+ }, []);
+ return collapsed;
+}
+
/**
- * The studio's single vertical tab spine: Copilot, Editor, Browser and
- * Timeline are peer tabs, each toggling its pane open or closed on the stage.
+ * The studio's pane toggles, top-center in the top bar: Copilot, Editor,
+ * Browser and Overview are peer TOGGLES (multi-active, not exclusive tabs) —
+ * each opens or closes its pane on the stage. Labels collapse to icons below
+ * xl so the cluster never crowds the title or the run actions.
*/
-export function StudioSpine() {
+export function StudioPaneToggles() {
const { panes, togglePane } = useStudioPanes();
+ const workflowDeleted = useStudioWorkflowDeletedAt() !== null;
const hasUnseenBrowserActivity = useStudioBrowserStore(
(s) => s.hasUnseenActivity,
);
const clearBrowserActivity = useStudioBrowserStore((s) => s.clearActivity);
const { hasRun, runStatus } = useStudioRunSignals();
+ const labelsCollapsed = useLabelsCollapsed();
const onToggle = (id: StudioPaneId) => {
if (id === "browser" && !panes.includes("browser")) {
@@ -52,15 +80,18 @@ export function StudioSpine() {
togglePane(id);
};
- // Roving tabindex (WAI-ARIA toolbar): the rail is one tab stop; arrow keys
- // move focus across the enabled tabs, Enter/Space toggles.
+ const paneBlockedByDeletion = (id: StudioPaneId) =>
+ workflowDeleted && DELETED_WORKFLOW_BLOCKED_PANES.includes(id);
+
+ // Roving tabindex (WAI-ARIA toolbar): the cluster is one tab stop; arrow
+ // keys move focus across the enabled toggles, Enter/Space toggles.
const [focusedId, setFocusedId] = useState<StudioPaneId>(STUDIO_PANE_IDS[0]!);
const enabledIds = STUDIO_PANE_IDS.filter(
- (id) => !(id === "timeline" && !hasRun),
+ (id) => !(id === "overview" && !hasRun) && !paneBlockedByDeletion(id),
);
const tabStopId = enabledIds.includes(focusedId) ? focusedId : enabledIds[0];
const onKeyDown = (event: KeyboardEvent<HTMLElement>) => {
- const keys = ["ArrowDown", "ArrowUp", "Home", "End"];
+ const keys = ["ArrowRight", "ArrowLeft", "Home", "End"];
if (!keys.includes(event.key) || enabledIds.length === 0) {
return;
}
@@ -70,9 +101,9 @@ export function StudioSpine() {
enabledIds.indexOf(tabStopId ?? enabledIds[0]!),
);
const nextIndex =
- event.key === "ArrowDown"
+ event.key === "ArrowRight"
? (current + 1) % enabledIds.length
- : event.key === "ArrowUp"
+ : event.key === "ArrowLeft"
? (current - 1 + enabledIds.length) % enabledIds.length
: event.key === "Home"
? 0
@@ -85,81 +116,83 @@ export function StudioSpine() {
return (
<nav
aria-label="Studio panes"
- className="flex h-full w-16 shrink-0 flex-col items-center gap-1 border-r border-border bg-slate-elevation1 px-1.5 py-3"
+ className="flex shrink-0 items-center gap-1.5"
onKeyDown={onKeyDown}
>
{STUDIO_PANE_IDS.map((id) => {
const { label, icon: Icon } = STUDIO_PANE_META[id];
const open = panes.includes(id);
- const disabled = id === "timeline" && !hasRun;
+ const blockedByDeletion = paneBlockedByDeletion(id);
+ const disabled = (id === "overview" && !hasRun) || blockedByDeletion;
const showActivityDot =
id === "browser" && hasUnseenBrowserActivity && !open;
- const showRunStatusDot = id === "timeline" && Boolean(runStatus);
+ const showRunStatusDot = id === "overview" && Boolean(runStatus);
const ariaLabel = showActivityDot
? "Browser, new activity"
- : id === "timeline" && runStatus
- ? `Timeline, ${runStatusLabel(runStatus)}`
- : undefined;
- return (
+ : id === "overview" && runStatus
+ ? `Overview, ${runStatusLabel(runStatus)}`
+ : label;
+ const tip = blockedByDeletion
+ ? "Source agent deleted"
+ : disabled
+ ? "Overview: no runs yet"
+ : runStatus && id === "overview"
+ ? `Overview: ${runStatusLabel(runStatus)}`
+ : `${open ? "Close" : "Open"} ${label}`;
+ const button = (
<button
key={id}
id={studioTabId(id)}
type="button"
+ aria-pressed={open}
aria-expanded={open}
aria-controls={studioPanelId(id)}
aria-label={ariaLabel}
disabled={disabled}
tabIndex={id === tabStopId ? 0 : -1}
onFocus={() => setFocusedId(id)}
- title={
- disabled
- ? "Timeline: no runs yet"
- : runStatus && id === "timeline"
- ? `Timeline: ${runStatusLabel(runStatus)}`
- : `${open ? "Close" : "Open"} ${label}`
- }
onClick={() => onToggle(id)}
className={cn(
- "relative flex w-full flex-col items-center gap-1 rounded-md px-1 py-2 text-[10px] font-medium leading-none transition-colors",
+ "relative inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs font-medium transition-colors",
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
open
- ? "bg-studio-accent/15 text-foreground"
- : "text-muted-foreground hover:bg-slate-elevation3 hover:text-foreground",
- disabled &&
- "cursor-default opacity-50 hover:bg-transparent hover:text-muted-foreground",
+ ? "bg-accent text-foreground"
+ : "text-muted-foreground hover:bg-accent/50 hover:text-foreground",
+ disabled && "pointer-events-none opacity-50",
)}
>
- {open ? (
- <span
- aria-hidden
- className="absolute -left-1.5 bottom-2 top-2 w-[3px] rounded-r-full bg-studio-accent"
- />
- ) : null}
- <Icon
- className={cn("size-5", open && "text-studio-accent")}
- aria-hidden
- />
- {label}
+ <Icon className="size-3.5" aria-hidden />
+ <span className="hidden xl:inline">{label}</span>
{showActivityDot ? (
<span
aria-hidden
title="New browser activity"
- className="absolute right-1 top-1 flex size-2"
+ className="absolute -right-0.5 -top-0.5 flex size-2"
>
- <span className="absolute inline-flex h-full w-full rounded-full bg-studio-accent opacity-75 motion-safe:animate-ping" />
- <span className="relative inline-flex size-2 rounded-full bg-studio-accent shadow-[0_0_0_3px_rgba(109,108,246,0.20)]" />
+ <span className="absolute inline-flex h-full w-full rounded-full bg-primary opacity-75 motion-safe:animate-ping" />
+ <span className="relative inline-flex size-2 rounded-full bg-primary" />
</span>
) : showRunStatusDot && runStatus ? (
<span
aria-hidden
className={cn(
- "absolute right-1 top-1 size-2 rounded-full",
+ "absolute -right-0.5 -top-0.5 size-2 rounded-full",
runStatusDotClass(runStatus),
)}
/>
) : null}
</button>
);
+ // Disabled toggles always voice their reason; enabled ones tooltip
+ // only while icon-collapsed.
+ if (!disabled && !labelsCollapsed) {
+ return button;
+ }
+ return (
+ <ControlTooltip key={id} content={tip} blocked={disabled}>
+ {button}
+ </ControlTooltip>
+ );
})}
<span
role="status"
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioShell.test.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioShell.test.tsx
index fb43684e4..545d91585 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioShell.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioShell.test.tsx
@@ -1,6 +1,7 @@
// @vitest-environment jsdom
import { fireEvent, render, screen } from "@testing-library/react";
+import { TooltipProvider } from "@/components/ui/tooltip";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { StudioPane } from "./StudioShell";
@@ -22,16 +23,18 @@ describe("StudioPane header drag", () => {
onMove: vi.fn(),
};
render(
- <StudioPane
- id="copilot"
- open
- order={0}
- flex={undefined}
- reorder={reorder}
- onClose={vi.fn()}
- >
- <div>content</div>
- </StudioPane>,
+ <TooltipProvider delayDuration={0}>
+ <StudioPane
+ id="copilot"
+ open
+ order={0}
+ flex={undefined}
+ reorder={reorder}
+ onClose={vi.fn()}
+ >
+ <div>content</div>
+ </StudioPane>
+ </TooltipProvider>,
);
return {
reorder,
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioShell.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioShell.tsx
index a163681d0..93886f845 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioShell.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioShell.tsx
@@ -10,20 +10,29 @@ import { createPortal } from "react-dom";
import { useParams } from "react-router-dom";
import { Cross2Icon } from "@radix-ui/react-icons";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
import { RecordingPanel } from "@/routes/workflows/editor/recording/RecordingPanel";
import { useRecordedBlocksStore } from "@/store/RecordedBlocksStore";
import { useRecordingStore } from "@/store/useRecordingStore";
import { useStudioShellStore } from "@/store/StudioShellStore";
+import { useWorkflowTitleStore } from "@/store/WorkflowTitleStore";
import { cn } from "@/util/utils";
import { deriveDropIndicator } from "../editor/sortable/dropIndicator";
import { useDebugSessionQuery } from "../hooks/useDebugSessionQuery";
import { BrowserPaneActions, BrowserPaneViewPills } from "./BrowserPaneHeader";
+import { CopilotActiveDot, CopilotPaneControls } from "./CopilotPaneHeader";
+import { EditorPaneModeToggle } from "./EditorPaneHeader";
import { BrowserTab } from "./BrowserTab";
import { EditorTab, type StudioWorkspaceProps } from "./EditorTab";
import { RunTab } from "./RunTab";
-import { RunPaneActions, RunPaneStatusBadge } from "./runview/RunPaneHeader";
+import { RunPaneActions, RunPaneViewToggles } from "./runview/RunPaneHeader";
import { StudioBrowserStream } from "./StudioBrowserStream";
import { StudioCoachMark } from "./StudioCoachMark";
import { studioPanelId, studioTabId } from "./constants";
@@ -47,8 +56,8 @@ import { useStudioPaneDefaults } from "./StudioPaneDefaultsContext";
import {
StudioPaneCompactContext,
StudioShellContext,
+ StudioWorkflowDeletedContext,
} from "./StudioShellContext";
-import { StudioSpine } from "./StudioSpine";
import { StudioStageLauncher } from "./StudioStageLauncher";
import { StudioTopBar } from "./StudioTopBar";
import { StudioWorkflowPanels } from "./StudioWorkflowPanels";
@@ -83,6 +92,7 @@ export function StudioPane({
onClose,
headerExtras,
headerActions,
+ iconBadge,
children,
}: {
id: StudioPaneId;
@@ -95,6 +105,8 @@ export function StudioPane({
headerExtras?: ReactNode;
// Rendered right-aligned, before the close button.
headerActions?: ReactNode;
+ // Presence-badge overlay on the pane icon (e.g. the Copilot active dot).
+ iconBadge?: ReactNode;
children: ReactNode;
}) {
const { label, icon: Icon } = STUDIO_PANE_META[id];
@@ -169,7 +181,6 @@ export function StudioPane({
draggable
aria-label={`${label} pane header`}
aria-keyshortcuts="Control+Shift+ArrowLeft Control+Shift+ArrowRight"
- title={`Drag to reorder the ${label} pane (or Ctrl/Cmd+Shift+←/→)`}
onPointerDownCapture={(event) => {
pointerOnControl.current =
event.target instanceof Element &&
@@ -210,8 +221,19 @@ export function StudioPane({
}}
className="flex h-9 shrink-0 cursor-grab select-none items-center gap-2 border-b border-border px-3 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring active:cursor-grabbing"
>
- <Icon className="size-3.5 shrink-0 text-studio-accent" aria-hidden />
- <span className="min-w-0 truncate text-xs font-medium text-foreground">
+ {/* The drag hint lives on the grip (icon + label) only, so the header's
+ buttons keep their own tooltips instead of inheriting this one. */}
+ <span
+ className="relative shrink-0"
+ title={`Drag to reorder the ${label} pane (or Ctrl/Cmd+Shift+←/→)`}
+ >
+ <Icon className="size-3.5 text-muted-foreground" aria-hidden />
+ {iconBadge}
+ </span>
+ <span
+ className="min-w-0 truncate text-xs font-medium text-foreground"
+ title={`Drag to reorder the ${label} pane (or Ctrl/Cmd+Shift+←/→)`}
+ >
{label}
</span>
<StudioPaneCompactContext.Provider value={compact}>
@@ -219,15 +241,19 @@ export function StudioPane({
<span className="min-w-0 flex-1" />
{headerActions}
</StudioPaneCompactContext.Provider>
- <button
- type="button"
- onClick={onClose}
- title={`Close ${label}`}
- aria-label={`Close ${label} pane`}
- className="shrink-0 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"
- >
- <Cross2Icon className="size-3.5" />
- </button>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button
+ type="button"
+ onClick={onClose}
+ aria-label={`Close ${label} pane`}
+ className="shrink-0 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"
+ >
+ <Cross2Icon className="size-3.5" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent side="bottom">Close {label}</TooltipContent>
+ </Tooltip>
</div>
<div className="min-h-0 min-w-0 flex-1">{children}</div>
{/* Full-pane drop surface while a header drag is live; sits over iframe /
@@ -479,17 +505,36 @@ function StudioPaneDivider({
}
/**
- * Spine + panes shell: one vertical spine whose tabs (Copilot, Editor, Browser,
- * Timeline) each toggle a pane; open panes share the stage side by side in click
- * order (?panes=). The Copilot chat is portaled into its pane from Workspace.
+ * Panes shell: the top bar's pane toggles (Copilot, Editor, Browser, Overview)
+ * each toggle a pane; open panes share the stage side by side in click order
+ * (?panes=). The Copilot chat is portaled into its pane from Workspace.
*/
export function StudioShell(props: StudioWorkspaceProps) {
return (
- <StudioPaneDefaultsProvider
- hasBlocks={props.workflow.workflow_definition.blocks.length > 0}
+ <StudioWorkflowDeletedContext.Provider
+ value={props.workflow.deleted_at ?? null}
>
- <StudioStage {...props} />
- </StudioPaneDefaultsProvider>
+ <StudioPaneDefaultsProvider
+ hasBlocks={props.workflow.workflow_definition.blocks.length > 0}
+ >
+ <StudioStage {...props} />
+ </StudioPaneDefaultsProvider>
+ </StudioWorkflowDeletedContext.Provider>
+ );
+}
+
+/**
+ * Pane body while the source agent is deleted: the pane's normal content would
+ * operate on the missing workflow (Copilot chats, editor saves, debug
+ * browsers), so it never mounts — runs stay viewable from the run panes.
+ */
+function WorkflowDeletedPaneNotice() {
+ return (
+ <div className="flex h-full items-center justify-center p-4">
+ <p className="max-w-xs text-center text-sm text-muted-foreground">
+ Source agent deleted — this run is view-only.
+ </p>
+ </div>
);
}
@@ -497,7 +542,17 @@ function StudioStage(props: StudioWorkspaceProps) {
const { panes, closePane, openPane, setPanesOrder } = useStudioPanes();
const { registerStageElement } = useStudioPaneDefaults();
const { workflowPermanentId } = useParams();
+ const workflowDeleted = Boolean(props.workflow.deleted_at);
const isRecording = useRecordingStore((s) => s.isRecording);
+ // The title store is normally seeded by the embedded Workspace's canvas,
+ // which never mounts for a deleted agent — seed it here instead.
+ const initializeTitle = useWorkflowTitleStore((s) => s.initializeTitle);
+ const initialTitle = props.initialTitle;
+ useEffect(() => {
+ if (workflowDeleted) {
+ initializeTitle(initialTitle);
+ }
+ }, [workflowDeleted, initialTitle, initializeTitle]);
const { data: debugSession } = useDebugSessionQuery({
workflowPermanentId,
enabled: false,
@@ -513,6 +568,7 @@ function StudioStage(props: StudioWorkspaceProps) {
const [copilotPortalEl, setCopilotPortalEl] = useState<HTMLElement | null>(
null,
);
+ const [panelPortalEl, setPanelPortalEl] = useState<HTMLElement | null>(null);
// The live browser stream is mounted once into this detached host and
// re-parented into the owning pane, so it never remounts on pane changes.
@@ -533,15 +589,15 @@ function StudioStage(props: StudioWorkspaceProps) {
const browserOpen = panes.includes("browser");
const editorOpen = panes.includes("editor");
- const timelineOpen = panes.includes("timeline");
+ const overviewOpen = panes.includes("overview");
// Move the persistent stream node into the highest-priority open surface:
- // Browser pane > Timeline pane with a live block run (runStreamSlot registers
+ // Browser pane > Overview pane with a live block run (runStreamSlot registers
// only then) > Editor PiP > offscreen park, which keeps the socket warm.
useLayoutEffect(() => {
const activeSlot = browserOpen
? browserStreamSlot
- : timelineOpen && runStreamSlot
+ : overviewOpen && runStreamSlot
? runStreamSlot
: editorOpen && !pipMinimized
? editorStreamSlot
@@ -555,7 +611,7 @@ function StudioStage(props: StudioWorkspaceProps) {
}, [
browserOpen,
editorOpen,
- timelineOpen,
+ overviewOpen,
pipMinimized,
editorStreamSlot,
browserStreamSlot,
@@ -567,14 +623,15 @@ function StudioStage(props: StudioWorkspaceProps) {
const shellContextValue = useMemo(
() => ({
copilotPortalEl,
+ panelPortalEl,
setEditorStreamSlot,
setBrowserStreamSlot,
setRunStreamSlot,
}),
- [copilotPortalEl],
+ [copilotPortalEl, panelPortalEl],
);
- // The ✕ unmounts with its pane, so hand focus back to the pane's spine tab.
+ // The ✕ unmounts with its pane, so hand focus back to the pane's toggle.
const closeWithFocus = (id: StudioPaneId) => {
closePane(id);
document.getElementById(studioTabId(id))?.focus();
@@ -659,90 +716,117 @@ function StudioStage(props: StudioWorkspaceProps) {
return (
<StudioShellContext.Provider value={shellContextValue}>
- <div className="flex h-full w-full flex-col">
- <StudioTopBar />
- <div className="flex min-h-0 min-w-0 flex-1">
- <StudioSpine />
- {/* Panes keep a fixed DOM order (stable mounts for the canvas, chat and
+ {/* Studio-scoped tooltip timing: the app has no global provider, so this
+ only affects Radix tooltips inside the shell. */}
+ <TooltipProvider delayDuration={200} skipDelayDuration={300}>
+ <div className="flex h-full w-full flex-col">
+ <StudioTopBar />
+ <div className="flex min-h-0 min-w-0 flex-1">
+ {/* Panes keep a fixed DOM order (stable mounts for the canvas, chat and
stream slots); the CSS order carries the layout order instead, so
screen-reader/Tab order stays the fixed order, not the visual one.
Reordering (drag or keyboard) only rewrites CSS order — panes and
the stream singleton never remount. */}
- <div
- ref={registerStageElement}
- className="relative flex min-h-0 min-w-0 flex-1 overflow-hidden p-3"
- >
- <StudioPane {...paneProps("copilot")}>
- <div className="relative h-full w-full">
- {/* Copilot portal target. Kept mounted while the pane is closed
+ <div
+ ref={registerStageElement}
+ className="relative flex min-h-0 min-w-0 flex-1 overflow-hidden p-3"
+ >
+ <StudioPane
+ {...paneProps("copilot")}
+ headerActions={<CopilotPaneControls />}
+ iconBadge={<CopilotActiveDot />}
+ >
+ {workflowDeleted ? (
+ <WorkflowDeletedPaneNotice />
+ ) : (
+ <div className="relative h-full w-full">
+ {/* Copilot portal target. Kept mounted while the pane is closed
— or while recording, when the live-drafts panel covers it —
so an in-flight Copilot turn isn't torn down. */}
- <div
- ref={setCopilotPortalEl}
- className={cn(
- "h-full w-full",
- isRecording && "pointer-events-none",
- )}
- />
- {isRecording && browserSessionId ? (
- <div className="absolute inset-0 duration-150 animate-in fade-in slide-in-from-left-2">
- <RecordingPanel browserSessionId={browserSessionId} />
+ <div
+ ref={setCopilotPortalEl}
+ className={cn(
+ "h-full w-full",
+ isRecording && "pointer-events-none",
+ )}
+ />
+ {isRecording && browserSessionId ? (
+ <div className="absolute inset-0 duration-150 animate-in fade-in slide-in-from-left-2">
+ <RecordingPanel browserSessionId={browserSessionId} />
+ </div>
+ ) : null}
</div>
- ) : null}
- </div>
- </StudioPane>
- <StudioPane {...paneProps("editor")}>
- <EditorTab {...props} />
- </StudioPane>
- {/* Kept mounted (CSS-hidden) so its stream slot stays registered;
+ )}
+ </StudioPane>
+ <StudioPane
+ {...paneProps("editor")}
+ headerExtras={<EditorPaneModeToggle />}
+ >
+ {/* The embedded Workspace boots debug sessions, copilot chats
+ and block-script queries against the workflow — none of
+ which exist once the agent is deleted, so it never mounts. */}
+ {workflowDeleted ? (
+ <WorkflowDeletedPaneNotice />
+ ) : (
+ <EditorTab {...props} />
+ )}
+ </StudioPane>
+ {/* Kept mounted (CSS-hidden) so its stream slot stays registered;
the persistent stream node is re-parented in, not remounted. */}
- <StudioPane
- {...paneProps("browser")}
- headerExtras={<BrowserPaneViewPills />}
- headerActions={<BrowserPaneActions />}
- >
- <BrowserTab />
- </StudioPane>
- <StudioPane
- {...paneProps("timeline")}
- headerExtras={<RunPaneStatusBadge />}
- headerActions={<RunPaneActions />}
- >
- <RunTab />
- </StudioPane>
- {/* Dividers are the inter-pane gaps; stateless, so unlike the panes
+ <StudioPane
+ {...paneProps("browser")}
+ headerExtras={<BrowserPaneViewPills />}
+ headerActions={<BrowserPaneActions />}
+ >
+ <BrowserTab />
+ </StudioPane>
+ <StudioPane
+ {...paneProps("overview")}
+ headerExtras={<RunPaneViewToggles />}
+ headerActions={<RunPaneActions />}
+ >
+ <RunTab />
+ </StudioPane>
+ {/* Dividers are the inter-pane gaps; stateless, so unlike the panes
they can re-render freely as the open list changes. */}
- {panes.slice(1).map((rightId, index) => (
- <StudioPaneDivider
- key={`${panes[index]}:${rightId}`}
- leftId={panes[index]!}
- rightId={rightId}
- order={index * 2 + 1}
- panes={panes}
- onCommit={setPaneWidths}
- onReset={resetPaneWidths}
+ {panes.slice(1).map((rightId, index) => (
+ <StudioPaneDivider
+ key={`${panes[index]}:${rightId}`}
+ leftId={panes[index]!}
+ rightId={rightId}
+ order={index * 2 + 1}
+ panes={panes}
+ onCommit={setPaneWidths}
+ onReset={resetPaneWidths}
+ />
+ ))}
+ {panes.length === 0 ? <StudioStageLauncher /> : null}
+ <StudioCoachMark />
+ <StudioWorkflowPanels />
+ {/* Overlay target for Workspace-wired panels (pointer-events off
+ while empty so the stage stays clickable). */}
+ <div
+ ref={setPanelPortalEl}
+ className="pointer-events-none absolute inset-0 z-40"
/>
- ))}
- {panes.length === 0 ? <StudioStageLauncher /> : null}
- <StudioCoachMark />
- <StudioWorkflowPanels />
- <span
- role="status"
- aria-live="polite"
- aria-atomic="true"
- className="sr-only"
- >
- {reorderAnnouncement}
- </span>
+ <span
+ role="status"
+ aria-live="polite"
+ aria-atomic="true"
+ className="sr-only"
+ >
+ {reorderAnnouncement}
+ </span>
+ </div>
</div>
+ <div
+ ref={setStreamHolderEl}
+ aria-hidden
+ className="h-0 w-0 overflow-hidden"
+ />
+ {createPortal(<StudioBrowserStream />, streamHostEl)}
</div>
- <div
- ref={setStreamHolderEl}
- aria-hidden
- className="h-0 w-0 overflow-hidden"
- />
- {createPortal(<StudioBrowserStream />, streamHostEl)}
- </div>
+ </TooltipProvider>
</StudioShellContext.Provider>
);
}
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioShellContext.ts b/skyvern-frontend/src/routes/workflows/studio/StudioShellContext.ts
index ac7a20615..0f2b0ada2 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioShellContext.ts
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioShellContext.ts
@@ -4,17 +4,21 @@ 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;
+ // Stage-level overlay target for Workspace-wired panels that must outlive a
+ // hidden Editor pane (e.g. the code-cache key/value panel).
+ panelPortalEl: 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;
setBrowserStreamSlot: (el: HTMLElement | null) => void;
- // The Timeline pane registers this for a block run, so the debug-session stream shows
+ // The Overview pane registers this for a block run, so the debug-session stream shows
// there too (same node, view-only); null for a full run keeps it parked.
setRunStreamSlot: (el: HTMLElement | null) => void;
};
export const StudioShellContext = createContext<StudioShellContextValue>({
copilotPortalEl: null,
+ panelPortalEl: null,
setEditorStreamSlot: () => {},
setBrowserStreamSlot: () => {},
setRunStreamSlot: () => {},
@@ -31,3 +35,13 @@ export const StudioPaneCompactContext = createContext(false);
export function useStudioPaneCompact(): boolean {
return useContext(StudioPaneCompactContext);
}
+
+// The source agent's deleted_at when the studio shows a run whose workflow was
+// deleted (the shell runs from the run's embedded snapshot). Workflow-mutating
+// chrome keys off this to degrade: Copilot/Editor panes blocked, top-bar
+// actions replaced by the legacy "Agent deleted on …" tag.
+export const StudioWorkflowDeletedContext = createContext<string | null>(null);
+
+export function useStudioWorkflowDeletedAt(): string | null {
+ return useContext(StudioWorkflowDeletedContext);
+}
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioShellPanelPortal.test.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioShellPanelPortal.test.tsx
new file mode 100644
index 000000000..2bbe88db7
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioShellPanelPortal.test.tsx
@@ -0,0 +1,63 @@
+// @vitest-environment jsdom
+
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
+import { afterEach, describe, expect, test, vi } from "vitest";
+
+import { StudioShellContext } from "./StudioShellContext";
+import { StudioShellPanelPortal } from "./StudioShellPanelPortal";
+
+function renderPortal(open: boolean, onDismiss = vi.fn()) {
+ const target = document.createElement("div");
+ target.setAttribute("data-testid", "stage-target");
+ document.body.appendChild(target);
+ const utils = render(
+ <StudioShellContext.Provider
+ value={{
+ copilotPortalEl: null,
+ panelPortalEl: target,
+ setEditorStreamSlot: () => {},
+ setBrowserStreamSlot: () => {},
+ setRunStreamSlot: () => {},
+ }}
+ >
+ {/* The panel's OWNER subtree can be display:none (a closed Editor pane);
+ the portal must land the content in the shell target regardless. */}
+ <div style={{ display: "none" }}>
+ <StudioShellPanelPortal open={open} onDismiss={onDismiss}>
+ <div data-testid="panel-content">panel</div>
+ </StudioShellPanelPortal>
+ </div>
+ </StudioShellContext.Provider>,
+ );
+ return { target, onDismiss, ...utils };
+}
+
+afterEach(() => {
+ cleanup();
+ document
+ .querySelectorAll('[data-testid="stage-target"]')
+ .forEach((el) => el.remove());
+});
+
+describe("StudioShellPanelPortal", () => {
+ test("renders the panel into the shell target even from a hidden subtree", () => {
+ const { target } = renderPortal(true);
+ expect(
+ target.querySelector('[data-testid="panel-content"]'),
+ ).not.toBeNull();
+ });
+
+ test("renders nothing while closed", () => {
+ const { target } = renderPortal(false);
+ expect(target.querySelector('[data-testid="panel-content"]')).toBeNull();
+ expect(screen.queryByTestId("panel-content")).toBeNull();
+ });
+
+ test("backdrop click and Escape both dismiss", () => {
+ const { target, onDismiss } = renderPortal(true);
+ fireEvent.click(target.firstElementChild as Element);
+ expect(onDismiss).toHaveBeenCalledTimes(1);
+ fireEvent.keyDown(window, { key: "Escape" });
+ expect(onDismiss).toHaveBeenCalledTimes(2);
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioShellPanelPortal.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioShellPanelPortal.tsx
new file mode 100644
index 000000000..c60102eaf
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioShellPanelPortal.tsx
@@ -0,0 +1,51 @@
+import { useEffect, type ReactNode } from "react";
+import { createPortal } from "react-dom";
+
+import { useStudioShellContext } from "./StudioShellContext";
+
+/**
+ * Renders a Workspace-wired panel into the shell's stage-level overlay target,
+ * so it stays visible (and dismissable) even while the Editor pane — the
+ * panel's data owner — is display:none. Dismiss: backdrop click, Esc, and
+ * whatever ✕ the panel itself renders.
+ */
+export function StudioShellPanelPortal({
+ open,
+ onDismiss,
+ children,
+}: {
+ open: boolean;
+ onDismiss: () => void;
+ children: ReactNode;
+}) {
+ const { panelPortalEl } = useStudioShellContext();
+
+ useEffect(() => {
+ if (!open) {
+ return;
+ }
+ const onKeyDown = (event: KeyboardEvent) => {
+ if (event.key === "Escape") {
+ onDismiss();
+ }
+ };
+ window.addEventListener("keydown", onKeyDown);
+ return () => window.removeEventListener("keydown", onKeyDown);
+ }, [open, onDismiss]);
+
+ if (!open || !panelPortalEl) {
+ return null;
+ }
+ return createPortal(
+ <>
+ <div
+ className="pointer-events-auto absolute inset-0"
+ onClick={onDismiss}
+ />
+ <div className="pointer-events-auto absolute right-3 top-3 max-h-[calc(100%-1.5rem)] overflow-y-auto">
+ {children}
+ </div>
+ </>,
+ panelPortalEl,
+ );
+}
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioStageLauncher.test.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioStageLauncher.test.tsx
index d1936f5ef..187c4c52e 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioStageLauncher.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioStageLauncher.test.tsx
@@ -4,6 +4,7 @@ import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import { MemoryRouter, useLocation } from "react-router-dom";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
+import { TooltipProvider } from "@/components/ui/tooltip";
import { useStudioBrowserStore } from "@/store/useStudioBrowserStore";
import { StudioStageLauncher } from "./StudioStageLauncher";
@@ -25,10 +26,12 @@ function LocationProbe() {
function renderAt(path = "/workflows/wpid_1/studio?panes=") {
return render(
- <MemoryRouter initialEntries={[path]}>
- <StudioStageLauncher />
- <LocationProbe />
- </MemoryRouter>,
+ <TooltipProvider delayDuration={0}>
+ <MemoryRouter initialEntries={[path]}>
+ <StudioStageLauncher />
+ <LocationProbe />
+ </MemoryRouter>
+ </TooltipProvider>,
);
}
@@ -50,27 +53,27 @@ beforeEach(() => {
describe("StudioStageLauncher", () => {
test("offers every pane as a labeled button", () => {
renderAt();
- for (const label of ["Copilot", "Editor", "Browser", "Timeline"]) {
+ for (const label of ["Copilot", "Editor", "Browser", "Overview"]) {
expect(
screen.getByRole("button", { name: new RegExp(`^${label}`) }),
).toBeTruthy();
}
});
- test("keeps the Timeline launcher gated until a run exists, with the reason readable", () => {
+ test("keeps the Overview launcher gated until a run exists, with the reason readable", () => {
renderAt();
const timeline = screen.getByRole("button", { name: /no runs yet/ });
expect((timeline as HTMLButtonElement).disabled).toBe(true);
});
- test("enables the Timeline launcher once a run exists", () => {
+ test("enables the Overview launcher once a run exists", () => {
runSignalsMock.mockReturnValue({
hasRun: true,
runStatus: undefined,
knownHasRuns: true,
});
renderAt();
- const timeline = screen.getByRole("button", { name: "Timeline" });
+ const timeline = screen.getByRole("button", { name: "Overview" });
expect((timeline as HTMLButtonElement).disabled).toBe(false);
});
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioStageLauncher.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioStageLauncher.tsx
index a6281b262..e73f0677a 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioStageLauncher.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioStageLauncher.tsx
@@ -1,18 +1,25 @@
import { Button } from "@/components/ui/button";
import { useStudioBrowserStore } from "@/store/useStudioBrowserStore";
+import { ControlTooltip } from "./ControlTooltip";
import { STUDIO_PANE_META } from "./paneMeta";
-import { STUDIO_PANE_IDS, type StudioPaneId } from "./panes";
+import {
+ DELETED_WORKFLOW_BLOCKED_PANES,
+ STUDIO_PANE_IDS,
+ type StudioPaneId,
+} from "./panes";
import { useStudioPanes } from "./useStudioPanes";
import { useStudioRunSignals } from "./useStudioRunSignals";
+import { useStudioWorkflowDeletedAt } from "./StudioShellContext";
/**
* Zero-panes stage: every pane stays one labeled click away instead of the
- * stage dead-ending. Mirrors the spine's Timeline gating.
+ * stage dead-ending. Mirrors the top-bar toggles' Overview gating.
*/
export function StudioStageLauncher() {
const { openPane } = useStudioPanes();
const { hasRun } = useStudioRunSignals();
+ const workflowDeleted = useStudioWorkflowDeletedAt() !== null;
const clearBrowserActivity = useStudioBrowserStore((s) => s.clearActivity);
const open = (id: StudioPaneId) => {
@@ -31,27 +38,46 @@ export function StudioStageLauncher() {
<div className="flex flex-wrap items-center justify-center gap-2">
{STUDIO_PANE_IDS.map((id) => {
const { label, icon: Icon } = STUDIO_PANE_META[id];
- const disabled = id === "timeline" && !hasRun;
- return (
+ const blockedByDeletion =
+ workflowDeleted && DELETED_WORKFLOW_BLOCKED_PANES.includes(id);
+ const disabled =
+ (id === "overview" && !hasRun) || blockedByDeletion;
+ const reason = blockedByDeletion
+ ? "Source agent deleted"
+ : "Overview: no runs yet";
+ const tile = (
<Button
key={id}
type="button"
variant="secondary"
size="sm"
disabled={disabled}
- title={disabled ? "Timeline: no runs yet" : `Open ${label}`}
onClick={() => open(id)}
className="gap-2"
>
<Icon className="size-4" aria-hidden />
{label}
- {/* title isn't exposed on a disabled control; keep the reason
- readable in browse mode. */}
+ {/* The tooltip isn't exposed on a disabled control in browse
+ mode; keep the reason readable there. */}
{disabled ? (
- <span className="sr-only">(no runs yet)</span>
+ <span className="sr-only">
+ (
+ {blockedByDeletion ? "source agent deleted" : "no runs yet"}
+ )
+ </span>
) : null}
</Button>
);
+ // Labelled tiles are self-describing; only a disabled tile
+ // tooltips (its reason).
+ if (!disabled) {
+ return tile;
+ }
+ return (
+ <ControlTooltip key={id} content={reason} blocked>
+ {tile}
+ </ControlTooltip>
+ );
})}
</div>
</div>
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.test.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.test.tsx
index 97415e494..a50dae596 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.test.tsx
@@ -6,6 +6,7 @@ import { MemoryRouter, Route, Routes, useLocation } from "react-router-dom";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { Status } from "@/api/types";
+import { TooltipProvider } from "@/components/ui/tooltip";
const { workflowRunQueryMock } = vi.hoisted(() => ({
workflowRunQueryMock: vi.fn(),
@@ -37,18 +38,20 @@ function renderAt(path: string) {
});
return render(
<QueryClientProvider client={queryClient}>
- <MemoryRouter initialEntries={[path]}>
- <Routes>
- <Route
- path="/workflows/:workflowPermanentId/studio"
- element={<RunStopButton />}
- />
- <Route
- path="/agents/:workflowPermanentId/run"
- element={<LocationProbe />}
- />
- </Routes>
- </MemoryRouter>
+ <TooltipProvider delayDuration={0}>
+ <MemoryRouter initialEntries={[path]}>
+ <Routes>
+ <Route
+ path="/workflows/:workflowPermanentId/studio"
+ element={<RunStopButton />}
+ />
+ <Route
+ path="/agents/:workflowPermanentId/run"
+ element={<LocationProbe />}
+ />
+ </Routes>
+ </MemoryRouter>
+ </TooltipProvider>
</QueryClientProvider>,
);
}
@@ -80,9 +83,10 @@ describe("RunStopButton concurrency with a live block run", () => {
expect(screen.queryByTestId("location")).toBeNull();
fireEvent.click(screen.getByRole("button", { name: "Start full run" }));
- // ?panes= round-trips through the run form.
+ // The form carries nothing: the post-start navigation resets the layout
+ // to the run mapping (copilot, browser, overview).
expect(screen.getByTestId("location").textContent).toBe(
- "/agents/wpid_1/run?panes=editor,browser,timeline",
+ "/agents/wpid_1/run",
);
});
@@ -110,18 +114,18 @@ describe("RunStopButton concurrency with a live block run", () => {
expect(screen.queryByText("Start a full run?")).toBeNull();
expect(screen.getByTestId("location").textContent).toBe(
- "/agents/wpid_1/run?panes=copilot,browser,timeline",
+ "/agents/wpid_1/run",
);
});
- test("an explicit open-panes list is carried through to the run form", () => {
+ test("an editor-open layout is NOT carried into the run form (full runs reset)", () => {
mockRun(Status.Completed);
renderAt("/workflows/wpid_1/studio?wr=wr_1&panes=editor,copilot");
fireEvent.click(screen.getByRole("button", { name: /Run/ }));
expect(screen.getByTestId("location").textContent).toBe(
- "/agents/wpid_1/run?panes=editor,copilot",
+ "/agents/wpid_1/run",
);
});
});
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsx
index 6045954e1..d438c6225 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsx
@@ -28,25 +28,30 @@ import { useRecordingStore } from "@/store/useRecordingStore";
import { useWorkflowHasChangesStore } from "@/store/WorkflowHasChangesStore";
import { useWorkflowPanelStore } from "@/store/WorkflowPanelStore";
import { useWorkflowTitleStore } from "@/store/WorkflowTitleStore";
+import { basicLocalTimeFormat, basicTimeFormat } from "@/util/timeFormat";
import { cn } from "@/util/utils";
import { EditableNodeTitle } from "../editor/nodes/components/EditableNodeTitle";
import { EditorOverflowMenu } from "../editor/header/EditorOverflowMenu";
import { MakeACopyButton } from "../editor/MakeACopyButton";
import { useSaveWorkflow } from "../editor/hooks/useSaveWorkflow";
+import { useToggleHistoryPanel } from "../editor/hooks/useToggleHistoryPanel";
import { useIsGlobalWorkflow } from "../hooks/useIsGlobalWorkflow";
import { useWorkflowRunWithWorkflowQuery } from "../hooks/useWorkflowRunWithWorkflowQuery";
-import { STUDIO_PANES_PARAM } from "./panes";
import { runOutcomeFromStatus } from "./runProjections";
+import { ControlTooltip } from "./ControlTooltip";
+import { PaneHeaderDivider } from "./PaneHeaderDivider";
+import { StudioPaneToggles } from "./StudioPaneToggles";
import { useStudioPanes } from "./useStudioPanes";
import { useStudioRunId } from "./useStudioRunId";
+import { useStudioWorkflowDeletedAt } from "./StudioShellContext";
function TitleSection({ editable = true }: { editable?: boolean }) {
const { title, setTitle } = useWorkflowTitleStore();
const setHasChanges = useWorkflowHasChangesStore((s) => s.setHasChanges);
const isRecording = useRecordingStore((s) => s.isRecording);
return (
- <div className="flex min-w-0 max-w-[18rem] items-center">
+ <div className="flex min-w-0 max-w-[19rem] items-center">
<EditableNodeTitle
editable={editable && !isRecording}
value={title}
@@ -54,8 +59,8 @@ function TitleSection({ editable = true }: { editable?: boolean }) {
setTitle(next);
setHasChanges(true);
}}
- titleClassName="text-base"
- inputClassName="text-base"
+ titleClassName="px-2 text-base"
+ inputClassName="px-2 text-base"
/>
</div>
);
@@ -66,21 +71,22 @@ function SaveButton() {
const isRecording = useRecordingStore((s) => s.isRecording);
const onSave = useSaveWorkflow();
return (
- <Button
- variant="tertiary"
- size="icon"
- className="size-9"
- disabled={isRecording}
- onClick={() => void onSave()}
- title="Save"
- aria-label="Save workflow"
- >
- {saving ? (
- <ReloadIcon className="size-5 animate-spin" />
- ) : (
- <SaveIcon className="size-5" />
- )}
- </Button>
+ <ControlTooltip content="Save workflow" blocked={isRecording}>
+ <Button
+ variant="outline"
+ size="icon"
+ className="h-8 w-8 border-border bg-transparent shadow-none"
+ disabled={isRecording}
+ onClick={() => void onSave()}
+ aria-label="Save workflow"
+ >
+ {saving ? (
+ <ReloadIcon className="size-4 animate-spin" />
+ ) : (
+ <SaveIcon className="size-4" />
+ )}
+ </Button>
+ </ControlTooltip>
);
}
@@ -98,23 +104,32 @@ function PanelToggle({
const close = useWorkflowPanelStore((s) => s.closeWorkflowPanel);
const isRecording = useRecordingStore((s) => s.isRecording);
const isOpen = state.active && state.content === content;
- return (
+ const button = (
<Button
- variant="tertiary"
+ variant="outline"
size={icon ? "icon" : "default"}
disabled={isRecording}
aria-pressed={isOpen}
className={cn(
- isOpen &&
- "border-studio-accent/40 bg-studio-accent/15 text-foreground hover:bg-studio-accent/20",
+ "border-border bg-transparent shadow-none",
+ icon ? "h-8 w-8" : "h-8 px-3 text-xs",
+ isOpen && "bg-accent text-accent-foreground hover:bg-accent/80",
)}
onClick={() => (isOpen ? close() : setState({ active: true, content }))}
- title={label}
aria-label={label}
>
{icon ?? label}
</Button>
);
+ // Only icon-only toggles tooltip; a text label is self-describing.
+ if (!icon) {
+ return button;
+ }
+ return (
+ <ControlTooltip content={label} blocked={isRecording}>
+ {button}
+ </ControlTooltip>
+ );
}
export function RunStopButton() {
@@ -130,7 +145,6 @@ export function RunStopButton() {
);
const activeRunId = workflowRun?.workflow_run_id;
const running = runOutcomeFromStatus(workflowRun?.status) === "running";
- const { resolveLivePanes } = useStudioPanes();
// ?bl= marks the URL run as a block run; a full run can start alongside it
// (they execute concurrently), so Run stays available next to Stop.
const isBlockRun = searchParams.has("bl");
@@ -167,7 +181,9 @@ export function RunStopButton() {
// this exact layout (plus the run surfaces appended) instead of remapping.
const startFullRun = () =>
navigate(
- `/agents/${workflowPermanentId}/run?${STUDIO_PANES_PARAM}=${resolveLivePanes().join(",")}`,
+ // The post-start navigate resets the layout to the run mapping, so the
+ // form round-trip carries nothing.
+ `/agents/${workflowPermanentId}/run`,
);
if (running && activeRunId) {
@@ -177,6 +193,7 @@ export function RunStopButton() {
<Button
variant="destructive"
size="default"
+ className="h-8 px-3"
disabled={cancelRun.isPending || isRecording}
>
{cancelRun.isPending ? (
@@ -216,8 +233,12 @@ export function RunStopButton() {
{stopDialog}
<Dialog>
<DialogTrigger asChild>
- <Button size="default" disabled={isRecording}>
- <PlayIcon className="mr-2 size-4" /> Run
+ <Button
+ size="default"
+ className="h-8 border border-transparent px-3"
+ disabled={isRecording}
+ >
+ <PlayIcon className="mr-2 size-4" /> Run agent
</Button>
</DialogTrigger>
<DialogContent>
@@ -225,7 +246,7 @@ export function RunStopButton() {
<DialogTitle>Start a full run?</DialogTitle>
<DialogDescription>
A block run is still executing. It will keep running — you can
- watch it in the Browser pane while the Timeline pane switches to
+ watch it in the Browser pane while the Overview pane switches to
the new full run.
</DialogDescription>
</DialogHeader>
@@ -243,19 +264,45 @@ export function RunStopButton() {
);
}
return (
- <Button size="default" disabled={isRecording} onClick={startFullRun}>
- <PlayIcon className="mr-2 size-4" /> Run
+ <Button
+ size="default"
+ className="h-8 border border-transparent px-3"
+ disabled={isRecording}
+ onClick={startFullRun}
+ >
+ <PlayIcon className="mr-2 size-4" /> Run agent
</Button>
);
}
export function StudioTopBar() {
const isGlobalWorkflow = useIsGlobalWorkflow();
+ const workflowDeletedAt = useStudioWorkflowDeletedAt();
+ const { setOpenPanes } = useStudioPanes();
+ const toggleHistoryPanel = useToggleHistoryPanel();
+ // Version comparison renders in the editor canvas: collapse to an
+ // editor-only layout on entry (an explicit override, like the full-run
+ // reset). Exiting doesn't restore the previous set — reopen as needed.
+ const openVersionHistory = () => {
+ setOpenPanes(["editor"]);
+ toggleHistoryPanel();
+ };
return (
<div className="flex h-14 shrink-0 items-center gap-3 border-b border-border bg-slate-elevation2 px-4">
- <TitleSection editable={!isGlobalWorkflow} />
- <div className="flex-1" />
- {isGlobalWorkflow ? (
+ <TitleSection editable={!isGlobalWorkflow && !workflowDeletedAt} />
+ <PaneHeaderDivider />
+ <StudioPaneToggles />
+ <div className="min-w-3 flex-1" />
+ {workflowDeletedAt ? (
+ // Legacy run-header tag idiom; every workflow-mutating action (save,
+ // schedule, inputs, run) is gone with the agent.
+ <span
+ title={basicTimeFormat(workflowDeletedAt)}
+ className="shrink-0 text-xs text-muted-foreground"
+ >
+ Agent deleted on {basicLocalTimeFormat(workflowDeletedAt)}
+ </span>
+ ) : isGlobalWorkflow ? (
<MakeACopyButton />
) : (
<div data-tour="editor-actions" className="flex items-center gap-2">
@@ -264,13 +311,17 @@ export function StudioTopBar() {
<PanelToggle
content="schedules"
label="Schedule"
- icon={<CalendarIcon className="size-5" />}
+ icon={<CalendarIcon className="size-4" />}
+ />
+ <EditorOverflowMenu
+ triggerClassName="h-8 w-8 rounded-md border border-border bg-transparent shadow-none"
+ onVersionHistory={openVersionHistory}
+ embedded
/>
- <EditorOverflowMenu triggerClassName="size-9" />
</div>
<div className="h-6 w-px bg-border" aria-hidden />
<div className="flex items-center gap-2">
- <PanelToggle content="parameters" label="Inputs" />
+ <PanelToggle content="parameters" label="Agent Inputs" />
<RunStopButton />
</div>
</div>
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioWorkflowPanels.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioWorkflowPanels.tsx
index 526289913..083db3292 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioWorkflowPanels.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioWorkflowPanels.tsx
@@ -5,7 +5,7 @@ import { WorkflowSchedulePanel } from "../editor/panels/schedulePanel/WorkflowSc
/**
* Inputs / Schedule panels rendered at shell level so they open over any tab —
- * the editor canvas is display:none on Browser/Timeline tabs and would hide them.
+ * the editor canvas is display:none on Browser/Overview tabs and would hide them.
*/
export function StudioWorkflowPanels() {
const state = useWorkflowPanelStore((s) => s.workflowPanelState);
diff --git a/skyvern-frontend/src/routes/workflows/studio/ViewToggle.tsx b/skyvern-frontend/src/routes/workflows/studio/ViewToggle.tsx
index 49cd52e43..4189800d4 100644
--- a/skyvern-frontend/src/routes/workflows/studio/ViewToggle.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/ViewToggle.tsx
@@ -1,8 +1,15 @@
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
import { cn } from "@/util/utils";
/**
- * Segmented-control button shared by the studio's view toggles (run hero,
- * browser pane header). Collapses to its icon when the host header is compact.
+ * Segmented-control button shared by the studio's view toggles (pane headers).
+ * Collapses to its icon when the host header is compact. Labelled states carry
+ * no tooltip (only icon-only controls tooltip); compact moves the label into
+ * one, and an explicit `title` (status info) always shows.
*/
export function ViewToggle({
active,
@@ -19,23 +26,32 @@ export function ViewToggle({
compact: boolean;
title?: string;
}) {
- return (
+ const tip = title ?? (compact ? label : undefined);
+ const button = (
<button
type="button"
onClick={onClick}
- title={title ?? (compact ? label : undefined)}
aria-label={label}
aria-pressed={active}
className={cn(
- "inline-flex items-center gap-1.5 rounded px-2 py-1 text-[11px] font-medium",
+ "inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-[11px] font-medium",
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
active
- ? "bg-studio-accent/15 text-foreground"
- : "text-muted-foreground hover:bg-accent hover:text-accent-foreground",
+ ? "bg-accent text-foreground"
+ : "text-muted-foreground hover:bg-accent/50 hover:text-foreground",
)}
>
{icon}
{compact ? null : label}
</button>
);
+ if (!tip) {
+ return button;
+ }
+ return (
+ <Tooltip>
+ <TooltipTrigger asChild>{button}</TooltipTrigger>
+ <TooltipContent side="bottom">{tip}</TooltipContent>
+ </Tooltip>
+ );
}
diff --git a/skyvern-frontend/src/routes/workflows/studio/browserPaneView.test.ts b/skyvern-frontend/src/routes/workflows/studio/browserPaneView.test.ts
index d4aa37d0d..418d394e7 100644
--- a/skyvern-frontend/src/routes/workflows/studio/browserPaneView.test.ts
+++ b/skyvern-frontend/src/routes/workflows/studio/browserPaneView.test.ts
@@ -9,9 +9,7 @@ const base = {
inspectingRun: false,
blockRunInDebugSession: false,
running: false,
- debugSessionUp: false,
hasRecording: false,
- hasScreenshots: false,
failed: false,
};
@@ -23,12 +21,11 @@ describe("resolveBrowserPaneView", () => {
intent: "live",
inspectingRun: true,
hasRecording: true,
- hasScreenshots: true,
}),
).toBe("live");
});
- it("pins Recording only when a recording exists", () => {
+ it("pins Recording even before its data arrives (empty state)", () => {
expect(
resolveBrowserPaneView({
...base,
@@ -36,30 +33,22 @@ describe("resolveBrowserPaneView", () => {
hasRecording: true,
}),
).toBe("recording");
- expect(
- resolveBrowserPaneView({
- ...base,
- intent: "recording",
- debugSessionUp: true,
- }),
- ).toBe("live");
+ expect(resolveBrowserPaneView({ ...base, intent: "recording" })).toBe(
+ "recording",
+ );
});
- it("pins Screenshots only when screenshots exist", () => {
+ it("pins Screenshots even before its data arrives (empty state)", () => {
+ expect(resolveBrowserPaneView({ ...base, intent: "screenshots" })).toBe(
+ "screenshots",
+ );
expect(
resolveBrowserPaneView({
...base,
intent: "screenshots",
- hasScreenshots: true,
+ hasRecording: true,
}),
).toBe("screenshots");
- expect(
- resolveBrowserPaneView({
- ...base,
- intent: "screenshots",
- debugSessionUp: true,
- }),
- ).toBe("live");
});
it("overrides a stored replay intent when a recording starts", () => {
@@ -70,8 +59,6 @@ describe("resolveBrowserPaneView", () => {
intent,
recording: true,
hasRecording: true,
- hasScreenshots: true,
- debugSessionUp: true,
}),
).toBe("live");
}
@@ -85,7 +72,6 @@ describe("resolveBrowserPaneView", () => {
scrubbing: true,
inspectingRun: true,
hasRecording: true,
- hasScreenshots: true,
}),
).toBe("live");
});
@@ -96,7 +82,6 @@ describe("resolveBrowserPaneView", () => {
...base,
scrubbing: true,
running: true,
- debugSessionUp: true,
}),
).toBe("screenshots");
});
@@ -107,9 +92,7 @@ describe("resolveBrowserPaneView", () => {
...base,
blockRunInDebugSession: true,
inspectingRun: true,
- debugSessionUp: true,
hasRecording: true,
- hasScreenshots: true,
}),
).toBe("live");
});
@@ -125,9 +108,7 @@ describe("resolveBrowserPaneView", () => {
resolveBrowserPaneView({
...base,
inspectingRun: true,
- debugSessionUp: true,
hasRecording: true,
- hasScreenshots: true,
}),
).toBe("recording");
});
@@ -139,33 +120,25 @@ describe("resolveBrowserPaneView", () => {
inspectingRun: true,
failed: true,
hasRecording: true,
- hasScreenshots: true,
}),
).toBe("screenshots");
});
it("defaults to the live debug browser when no run is inspected", () => {
- expect(
- resolveBrowserPaneView({
- ...base,
- debugSessionUp: true,
- hasRecording: true,
- hasScreenshots: true,
- }),
- ).toBe("live");
+ expect(resolveBrowserPaneView({ ...base, hasRecording: true })).toBe(
+ "live",
+ );
});
- it("defaults to the last run's replay when idle with history and no session", () => {
- expect(
- resolveBrowserPaneView({
- ...base,
- hasRecording: true,
- hasScreenshots: true,
- }),
- ).toBe("recording");
- expect(resolveBrowserPaneView({ ...base, hasScreenshots: true })).toBe(
- "screenshots",
+ it("edit entry stays live while the debug session boots, never the latest run's recording", () => {
+ // No ?wr= in the URL; the inspected latest run carries a recording and the
+ // debug session hasn't booted yet — the pane must be live (connecting).
+ expect(resolveBrowserPaneView({ ...base, hasRecording: true })).toBe(
+ "live",
);
+ expect(
+ resolveBrowserPaneView({ ...base, hasRecording: true, failed: true }),
+ ).toBe("live");
});
it("falls back to live (warming up) with nothing to show", () => {
diff --git a/skyvern-frontend/src/routes/workflows/studio/browserPaneView.ts b/skyvern-frontend/src/routes/workflows/studio/browserPaneView.ts
index eebf49621..a8b66e696 100644
--- a/skyvern-frontend/src/routes/workflows/studio/browserPaneView.ts
+++ b/skyvern-frontend/src/routes/workflows/studio/browserPaneView.ts
@@ -15,17 +15,16 @@ type ResolveBrowserPaneViewArgs = {
// stays the surface even after it finalizes (the block-iterate loop).
blockRunInDebugSession: boolean;
running: boolean;
- debugSessionUp: boolean;
hasRecording: boolean;
- hasScreenshots: boolean;
failed: boolean;
};
/**
* The Browser pane's view machine, ported from RunHero's resolveRunHeroCenterView:
* live while running, replay (recording/screenshots) on step-select or once the
- * inspected run finishes, and an idle workflow with history but no live session
- * defaults to the last run's replay instead of an empty stream.
+ * inspected run finishes. Without a run named in the URL (edit context) the
+ * pane is live from the first frame — a booting debug session shows its
+ * connecting state, never a flash of the latest run's replay.
*/
export function resolveBrowserPaneView({
intent,
@@ -34,9 +33,7 @@ export function resolveBrowserPaneView({
inspectingRun,
blockRunInDebugSession,
running,
- debugSessionUp,
hasRecording,
- hasScreenshots,
failed,
}: ResolveBrowserPaneViewArgs): BrowserPaneView {
// An active recording outranks everything, stored replay intents included:
@@ -47,12 +44,12 @@ export function resolveBrowserPaneView({
if (intent === "live") {
return "live";
}
- // A pinned replay intent can outlive its data (reload, run swap); fall back
- // to the machine until there is something to render.
- if (intent === "recording" && hasRecording) {
+ // A pinned replay intent always presents its surface; when the run has no
+ // recording/screenshots (yet), the pane body renders the empty state.
+ if (intent === "recording") {
return "recording";
}
- if (intent === "screenshots" && hasScreenshots) {
+ if (intent === "screenshots") {
return "screenshots";
}
if (scrubbing) {
@@ -67,11 +64,7 @@ export function resolveBrowserPaneView({
if (inspectingRun) {
return hasRecording && !failed ? "recording" : "screenshots";
}
- if (debugSessionUp) {
- return "live";
- }
- if (hasRecording && !failed) {
- return "recording";
- }
- return hasScreenshots ? "screenshots" : "live";
+ // Edit context: the live debug surface immediately (its boot shows the
+ // connecting state); the latest run's replays stay one pill-click away.
+ return "live";
}
diff --git a/skyvern-frontend/src/routes/workflows/studio/constants.ts b/skyvern-frontend/src/routes/workflows/studio/constants.ts
index bf9ad74b6..9ee890baa 100644
--- a/skyvern-frontend/src/routes/workflows/studio/constants.ts
+++ b/skyvern-frontend/src/routes/workflows/studio/constants.ts
@@ -2,6 +2,6 @@
// counter-translate tracks this window (see FlowRenderer).
export const STUDIO_COPILOT_TRANSITION_MS = 300;
-// Stable element ids linking each spine tab to the pane it toggles.
+// Stable element ids linking each top-bar toggle to the pane it controls.
export const studioTabId = (tab: string) => `studio-tab-${tab}`;
export const studioPanelId = (tab: string) => `studio-panel-${tab}`;
diff --git a/skyvern-frontend/src/routes/workflows/studio/paneLayout.test.ts b/skyvern-frontend/src/routes/workflows/studio/paneLayout.test.ts
index b143ccece..2c0c5ee7a 100644
--- a/skyvern-frontend/src/routes/workflows/studio/paneLayout.test.ts
+++ b/skyvern-frontend/src/routes/workflows/studio/paneLayout.test.ts
@@ -7,6 +7,7 @@ import {
movePaneTo,
paneFlex,
paneResizable,
+ paneWidthsKey,
STUDIO_PANE_DEFAULT_WIDTH,
} from "./paneLayout";
import { STUDIO_PANE_MIN_WIDTH, type StudioPaneId } from "./panes";
@@ -18,28 +19,28 @@ describe("greedyPaneOf", () => {
});
test("editor takes over when the browser is closed", () => {
- expect(greedyPaneOf(["copilot", "editor", "timeline"])).toBe("editor");
+ expect(greedyPaneOf(["copilot", "editor", "overview"])).toBe("editor");
});
test("no greedy pane without browser or editor", () => {
- expect(greedyPaneOf(["copilot", "timeline"])).toBeUndefined();
+ expect(greedyPaneOf(["copilot", "overview"])).toBeUndefined();
expect(greedyPaneOf([])).toBeUndefined();
});
});
describe("paneResizable", () => {
test("every pane except the greedy one can hold a pinned width", () => {
- const panes: StudioPaneId[] = ["copilot", "editor", "browser", "timeline"];
+ const panes: StudioPaneId[] = ["copilot", "editor", "browser", "overview"];
expect(paneResizable("copilot", panes)).toBe(true);
expect(paneResizable("editor", panes)).toBe(true);
- expect(paneResizable("timeline", panes)).toBe(true);
+ expect(paneResizable("overview", panes)).toBe(true);
expect(paneResizable("browser", panes)).toBe(false);
});
test("without a greedy pane the last pane flexes instead of pinning", () => {
- const panes: StudioPaneId[] = ["copilot", "timeline"];
+ const panes: StudioPaneId[] = ["copilot", "overview"];
expect(paneResizable("copilot", panes)).toBe(true);
- expect(paneResizable("timeline", panes)).toBe(false);
+ expect(paneResizable("overview", panes)).toBe(false);
});
});
@@ -58,7 +59,7 @@ describe("paneFlex", () => {
});
test("editor becomes the greedy pane when the browser is closed", () => {
- const panes: StudioPaneId[] = ["copilot", "editor", "timeline"];
+ const panes: StudioPaneId[] = ["copilot", "editor", "overview"];
expect(paneFlex("editor", panes, noWidths)).toBe("1 1 0%");
expect(paneFlex("copilot", panes, noWidths)).toBe(
`0 1 ${STUDIO_PANE_DEFAULT_WIDTH}px`,
@@ -66,11 +67,11 @@ describe("paneFlex", () => {
});
test("with neither greedy pane open the remaining panes share equally", () => {
- const panes: StudioPaneId[] = ["copilot", "timeline"];
+ const panes: StudioPaneId[] = ["copilot", "overview"];
expect(paneFlex("copilot", panes, noWidths)).toBe(
`1 1 ${STUDIO_PANE_DEFAULT_WIDTH}px`,
);
- expect(paneFlex("timeline", panes, noWidths)).toBe(
+ expect(paneFlex("overview", panes, noWidths)).toBe(
`1 1 ${STUDIO_PANE_DEFAULT_WIDTH}px`,
);
});
@@ -83,10 +84,10 @@ describe("paneFlex", () => {
});
test("without a greedy pane the last pane ignores its pin so the row fills", () => {
- const panes: StudioPaneId[] = ["copilot", "timeline"];
+ const panes: StudioPaneId[] = ["copilot", "overview"];
const widths = { copilot: 350, timeline: 500 };
expect(paneFlex("copilot", panes, widths)).toBe("0 1 350px");
- expect(paneFlex("timeline", panes, widths)).toBe(
+ expect(paneFlex("overview", panes, widths)).toBe(
`1 1 ${STUDIO_PANE_DEFAULT_WIDTH}px`,
);
});
@@ -124,6 +125,18 @@ describe("clampResizeDelta", () => {
});
});
+describe("paneWidthsKey", () => {
+ test("is stable across key order and changes with any width", () => {
+ expect(paneWidthsKey({ editor: 400, copilot: 300 })).toBe(
+ paneWidthsKey({ copilot: 300, editor: 400 }),
+ );
+ expect(paneWidthsKey({ copilot: 300 })).not.toBe(
+ paneWidthsKey({ copilot: 301 }),
+ );
+ expect(paneWidthsKey({})).toBe("");
+ });
+});
+
describe("movePaneTo / movePaneBy", () => {
const panes: StudioPaneId[] = ["copilot", "editor", "browser"];
@@ -142,8 +155,8 @@ describe("movePaneTo / movePaneBy", () => {
test("dropping on itself or on an unknown pane is a no-op", () => {
expect(movePaneTo(panes, "copilot", "copilot")).toEqual(panes);
- expect(movePaneTo(panes, "timeline", "copilot")).toEqual(panes);
- expect(movePaneTo(panes, "copilot", "timeline")).toEqual(panes);
+ expect(movePaneTo(panes, "overview", "copilot")).toEqual(panes);
+ expect(movePaneTo(panes, "copilot", "overview")).toEqual(panes);
});
test("moves one slot left or right, clamped at the row edges", () => {
diff --git a/skyvern-frontend/src/routes/workflows/studio/paneLayout.ts b/skyvern-frontend/src/routes/workflows/studio/paneLayout.ts
index 56793afd0..dccaa9eff 100644
--- a/skyvern-frontend/src/routes/workflows/studio/paneLayout.ts
+++ b/skyvern-frontend/src/routes/workflows/studio/paneLayout.ts
@@ -66,6 +66,15 @@ export function paneFlex(
// Clamp a divider drag so neither neighbor goes under its min width. The
// neighbors' total is preserved, so panes elsewhere in the row never move.
+// Stable serialization of the committed divider widths, for change detection
+// (the editor re-fits on width commits via FlowRenderer's paneLayoutKey).
+export function paneWidthsKey(widths: PaneWidths): string {
+ return Object.entries(widths)
+ .sort(([a], [b]) => a.localeCompare(b))
+ .map(([id, width]) => `${id}:${width}`)
+ .join(",");
+}
+
export function clampResizeDelta(
delta: number,
left: { id: StudioPaneId; width: number },
diff --git a/skyvern-frontend/src/routes/workflows/studio/paneMeta.ts b/skyvern-frontend/src/routes/workflows/studio/paneMeta.ts
index 94bf930eb..68ab3968e 100644
--- a/skyvern-frontend/src/routes/workflows/studio/paneMeta.ts
+++ b/skyvern-frontend/src/routes/workflows/studio/paneMeta.ts
@@ -2,7 +2,7 @@ import { type ComponentType } from "react";
import {
ChatBubbleIcon,
GlobeIcon,
- ListBulletIcon,
+ ReaderIcon,
Share1Icon,
} from "@radix-ui/react-icons";
@@ -15,5 +15,5 @@ export const STUDIO_PANE_META: Record<
copilot: { label: "Copilot", icon: ChatBubbleIcon },
editor: { label: "Editor", icon: Share1Icon },
browser: { label: "Browser", icon: GlobeIcon },
- timeline: { label: "Timeline", icon: ListBulletIcon },
+ overview: { label: "Overview", icon: ReaderIcon },
};
diff --git a/skyvern-frontend/src/routes/workflows/studio/panes.test.ts b/skyvern-frontend/src/routes/workflows/studio/panes.test.ts
index dc6b8ee05..175c9934a 100644
--- a/skyvern-frontend/src/routes/workflows/studio/panes.test.ts
+++ b/skyvern-frontend/src/routes/workflows/studio/panes.test.ts
@@ -2,6 +2,7 @@ import { describe, expect, test } from "vitest";
import {
DEFAULT_STUDIO_PANES,
+ DELETED_WORKFLOW_BLOCKED_PANES,
RUN_APPEND_PANES,
STUDIO_STAGE_GAP_PX,
STUDIO_STAGE_PADDING_PX,
@@ -11,9 +12,11 @@ import {
panesFitWidth,
panesFromDeepLink,
panesListEqual,
+ panesWithoutDeletedBlocked,
parsePanesParam,
resolveOpenPanes,
searchWithPanes,
+ toReadableSearch,
togglePane,
withPaneClosed,
withPaneOpen,
@@ -31,23 +34,23 @@ describe("parsePanesParam", () => {
test("preserves order", () => {
expect(parsePanesParam("timeline,copilot,editor")).toEqual([
- "timeline",
+ "overview",
"copilot",
"editor",
]);
});
- test("accepts the pre-rename 'run' alias as timeline, in place", () => {
+ test("accepts the pre-rename 'run' alias as overview, in place", () => {
expect(parsePanesParam("copilot,run,browser")).toEqual([
"copilot",
- "timeline",
+ "overview",
"browser",
]);
});
test("dedupes the alias against its canonical id", () => {
- expect(parsePanesParam("run,timeline")).toEqual(["timeline"]);
- expect(parsePanesParam("timeline,run")).toEqual(["timeline"]);
+ expect(parsePanesParam("run,timeline")).toEqual(["overview"]);
+ expect(parsePanesParam("timeline,run")).toEqual(["overview"]);
});
test("drops unknown values", () => {
@@ -73,26 +76,26 @@ describe("parsePanesParam", () => {
});
describe("panesFromDeepLink", () => {
- test("a run deep link opens watch-and-review: Copilot, Browser, Timeline", () => {
+ test("a run deep link opens watch-and-review: Copilot, Browser, Overview", () => {
expect(
panesFromDeepLink({ runId: "wr_123", active: null, blockLabel: null }),
- ).toEqual(["copilot", "browser", "timeline"]);
+ ).toEqual(["copilot", "browser", "overview"]);
});
test("an ?active= deep link opens the same run layout", () => {
expect(
panesFromDeepLink({ runId: null, active: "act_1", blockLabel: null }),
- ).toEqual(["copilot", "browser", "timeline"]);
+ ).toEqual(["copilot", "browser", "overview"]);
});
- test("a block run opens iterate: Editor, Browser, Timeline", () => {
+ test("a block run opens iterate: Editor, Browser, Overview", () => {
expect(
panesFromDeepLink({
runId: "wr_123",
active: null,
blockLabel: "block_1",
}),
- ).toEqual(["editor", "browser", "timeline"]);
+ ).toEqual(["editor", "browser", "overview"]);
});
test("a block label without a run does not force the run layout", () => {
@@ -113,19 +116,19 @@ describe("resolveOpenPanes", () => {
expect(resolveOpenPanes("")).toEqual(["copilot", "browser"]);
});
- test("?wr= resolves to Copilot, Browser and Timeline", () => {
+ test("?wr= resolves to Copilot, Browser and Overview", () => {
expect(resolveOpenPanes("?wr=wr_123")).toEqual([
"copilot",
"browser",
- "timeline",
+ "overview",
]);
});
- test("?wr= plus ?bl= resolves to Editor, Browser and Timeline", () => {
+ test("?wr= plus ?bl= resolves to Editor, Browser and Overview", () => {
expect(resolveOpenPanes("?wr=wr_123&bl=block_1")).toEqual([
"editor",
"browser",
- "timeline",
+ "overview",
]);
});
@@ -133,7 +136,7 @@ describe("resolveOpenPanes", () => {
expect(resolveOpenPanes("?active=act_1")).toEqual([
"copilot",
"browser",
- "timeline",
+ "overview",
]);
});
@@ -143,11 +146,11 @@ describe("resolveOpenPanes", () => {
]);
});
- test("an explicit ?panes=run keeps working as the Timeline pane", () => {
- expect(resolveOpenPanes("?panes=run")).toEqual(["timeline"]);
+ test("an explicit ?panes=run keeps working as the Overview pane", () => {
+ expect(resolveOpenPanes("?panes=run")).toEqual(["overview"]);
expect(resolveOpenPanes("?wr=wr_123&panes=copilot,run")).toEqual([
"copilot",
- "timeline",
+ "overview",
]);
});
@@ -192,11 +195,11 @@ describe("resolveOpenPanes with custom defaults", () => {
expect(resolveOpenPanes("?wr=wr_123", ["copilot", "editor"])).toEqual([
"copilot",
"browser",
- "timeline",
+ "overview",
]);
expect(
resolveOpenPanes("?wr=wr_123&bl=block_1", ["copilot", "editor"]),
- ).toEqual(["editor", "browser", "timeline"]);
+ ).toEqual(["editor", "browser", "overview"]);
});
test("an explicit ?panes= is never overridden by custom defaults", () => {
@@ -240,27 +243,27 @@ describe("panesFitWidth", () => {
describe("fitPanesToWidth", () => {
test("returns the list unchanged when everything fits", () => {
expect(
- fitPanesToWidth(["copilot", "editor", "browser", "timeline"], 2000),
- ).toEqual(["copilot", "editor", "browser", "timeline"]);
+ fitPanesToWidth(["copilot", "editor", "browser", "overview"], 2000),
+ ).toEqual(["copilot", "editor", "browser", "overview"]);
});
test("keeps the longest leading prefix that fits", () => {
// copilot(260) + editor(220) + padding(24) + gap(12) = 516 fits in 600;
// adding browser(260) + gap(12) = 788 does not.
expect(
- fitPanesToWidth(["copilot", "editor", "browser", "timeline"], 600),
+ fitPanesToWidth(["copilot", "editor", "browser", "overview"], 600),
).toEqual(["copilot", "editor"]);
});
test("degrades deterministically by order, not by pane size", () => {
- expect(fitPanesToWidth(["timeline", "copilot", "browser"], 600)).toEqual([
- "timeline",
+ expect(fitPanesToWidth(["overview", "copilot", "browser"], 600)).toEqual([
+ "overview",
"copilot",
]);
});
test("always keeps the first pane even when nothing fits", () => {
- expect(fitPanesToWidth(["browser", "timeline"], 100)).toEqual(["browser"]);
+ expect(fitPanesToWidth(["browser", "overview"], 100)).toEqual(["browser"]);
});
test("keeps an empty list empty", () => {
@@ -270,31 +273,31 @@ describe("fitPanesToWidth", () => {
describe("pane list operations", () => {
test("toggling a closed pane appends it (click order)", () => {
- expect(togglePane(["copilot", "browser"], "timeline")).toEqual([
+ expect(togglePane(["copilot", "browser"], "overview")).toEqual([
"copilot",
"browser",
- "timeline",
+ "overview",
]);
});
test("toggling an open pane splices it out, preserving the others' order", () => {
- expect(togglePane(["copilot", "timeline", "browser"], "timeline")).toEqual([
+ expect(togglePane(["copilot", "overview", "browser"], "overview")).toEqual([
"copilot",
"browser",
]);
});
test("withPaneOpen is a no-op re-order-wise when already open", () => {
- expect(withPaneOpen(["timeline", "copilot"], "copilot")).toEqual([
- "timeline",
+ expect(withPaneOpen(["overview", "copilot"], "copilot")).toEqual([
+ "overview",
"copilot",
]);
});
test("withPanesOpen appends only the missing panes, in the given order", () => {
expect(
- withPanesOpen(["copilot", "browser"], ["timeline", "browser"]),
- ).toEqual(["copilot", "browser", "timeline"]);
+ withPanesOpen(["copilot", "browser"], ["overview", "browser"]),
+ ).toEqual(["copilot", "browser", "overview"]);
});
test("withPaneClosed removes the pane", () => {
@@ -304,32 +307,53 @@ describe("pane list operations", () => {
});
});
-describe("in-app run starts append the run surfaces (continuity rule)", () => {
- test("block ▶ from the workflow layout appends Timeline only", () => {
+describe("toReadableSearch", () => {
+ test("keeps ?panes= commas readable after an unrelated param write", () => {
+ const params = new URLSearchParams("?panes=copilot,browser");
+ params.set("active", "act_1");
+ expect(toReadableSearch(params)).toBe(
+ "?panes=copilot,browser&active=act_1",
+ );
+ });
+
+ test("leaves non-comma encoding intact", () => {
+ const params = new URLSearchParams("?panes=copilot,browser&bl=Block A");
+ expect(toReadableSearch(params)).toBe("?panes=copilot,browser&bl=Block+A");
+ });
+
+ test("returns an empty string when no params remain", () => {
+ expect(toReadableSearch(new URLSearchParams())).toBe("");
+ });
+});
+
+describe("block-run starts append the run surfaces (continuity rule)", () => {
+ // Full-run starts RESET to the ?wr= mapping instead (RunWorkflowForm
+ // navigates to the bare deep link); only block ▶ appends.
+ test("block ▶ from the workflow layout appends Overview only", () => {
expect(
withPanesOpen(["copilot", "browser", "editor"], RUN_APPEND_PANES),
- ).toEqual(["copilot", "browser", "editor", "timeline"]);
+ ).toEqual(["copilot", "browser", "editor", "overview"]);
});
- test("a run start from a Browser-less layout appends Browser then Timeline", () => {
+ test("a block ▶ from a Browser-less layout appends Browser then Overview", () => {
expect(withPanesOpen(["copilot", "editor"], RUN_APPEND_PANES)).toEqual([
"copilot",
"editor",
"browser",
- "timeline",
+ "overview",
]);
});
- test("a run start from the run layout changes nothing", () => {
+ test("a block ▶ from the run layout changes nothing", () => {
expect(
- withPanesOpen(["copilot", "browser", "timeline"], RUN_APPEND_PANES),
- ).toEqual(["copilot", "browser", "timeline"]);
+ withPanesOpen(["copilot", "browser", "overview"], RUN_APPEND_PANES),
+ ).toEqual(["copilot", "browser", "overview"]);
});
- test("a run start from an empty stage opens just the run surfaces", () => {
+ test("a block ▶ from an empty stage opens just the run surfaces", () => {
expect(withPanesOpen([], RUN_APPEND_PANES)).toEqual([
"browser",
- "timeline",
+ "overview",
]);
});
});
@@ -343,12 +367,12 @@ describe("searchWithPanes", () => {
test("preserves unrelated params and replaces an existing ?panes=", () => {
const next = searchWithPanes("?wr=wr_1&panes=timeline", [
- "timeline",
+ "overview",
"editor",
]);
const params = new URLSearchParams(next);
expect(params.get("wr")).toBe("wr_1");
- expect(params.get("panes")).toBe("timeline,editor");
+ expect(params.get("panes")).toBe("overview,editor");
});
test("serializes an empty list as an explicit empty value", () => {
@@ -364,9 +388,28 @@ describe("searchWithPanes", () => {
test("an aliased ?panes=run re-serializes canonically after a write", () => {
const parsed = parsePanesParam("run");
- expect(parsed).toEqual(["timeline"]);
+ expect(parsed).toEqual(["overview"]);
expect(
searchWithPanes("?panes=run", withPaneOpen(parsed!, "copilot")),
- ).toBe("?panes=timeline,copilot");
+ ).toBe("?panes=overview,copilot");
+ });
+});
+
+describe("panesWithoutDeletedBlocked", () => {
+ test("drops the workflow-mutating panes and keeps run-view order", () => {
+ expect(
+ panesWithoutDeletedBlocked(["copilot", "browser", "overview", "editor"]),
+ ).toEqual(["browser", "overview"]);
+ });
+
+ test("is a no-op for an already-viewing-only list", () => {
+ expect(panesWithoutDeletedBlocked(["browser", "overview"])).toEqual([
+ "browser",
+ "overview",
+ ]);
+ });
+
+ test("blocks exactly the copilot and editor panes", () => {
+ expect(DELETED_WORKFLOW_BLOCKED_PANES).toEqual(["copilot", "editor"]);
});
});
diff --git a/skyvern-frontend/src/routes/workflows/studio/panes.ts b/skyvern-frontend/src/routes/workflows/studio/panes.ts
index b93c069d1..8382d794a 100644
--- a/skyvern-frontend/src/routes/workflows/studio/panes.ts
+++ b/skyvern-frontend/src/routes/workflows/studio/panes.ts
@@ -1,18 +1,19 @@
-export type StudioPaneId = "copilot" | "editor" | "browser" | "timeline";
+export type StudioPaneId = "copilot" | "editor" | "browser" | "overview";
export const STUDIO_PANE_IDS: readonly StudioPaneId[] = [
"copilot",
"editor",
"browser",
- "timeline",
+ "overview",
];
export const STUDIO_PANES_PARAM = "panes";
// Accepted forever on parse so pre-rename ?panes= links keep working; the
-// canonical id ("timeline") is what serializes back out.
+// canonical id ("overview") is what serializes back out.
const STUDIO_PANE_ID_ALIASES: Record<string, StudioPaneId> = {
- run: "timeline",
+ run: "overview",
+ timeline: "overview",
};
export const DEFAULT_STUDIO_PANES: readonly StudioPaneId[] = [
@@ -24,10 +25,23 @@ export const DEFAULT_STUDIO_PANES: readonly StudioPaneId[] = [
// is already open — they never rearrange or close panes.
export const RUN_APPEND_PANES: readonly StudioPaneId[] = [
"browser",
- "timeline",
+ "overview",
];
-// Copilot / Editor / Timeline share one narrow floor; the browser viewport
+// Panes that mutate the workflow (Copilot builds, Editor saves) are blocked
+// while the shell shows a run of a deleted agent; run viewing stays.
+export const DELETED_WORKFLOW_BLOCKED_PANES: readonly StudioPaneId[] = [
+ "copilot",
+ "editor",
+];
+
+export function panesWithoutDeletedBlocked(
+ panes: readonly StudioPaneId[],
+): StudioPaneId[] {
+ return panes.filter((id) => !DELETED_WORKFLOW_BLOCKED_PANES.includes(id));
+}
+
+// Copilot / Editor / Overview share one narrow floor; the browser viewport
// keeps a little more room. The stage clamps shared links and nudges on
// over-tight opens against these numbers (fitPanesToWidth below), and divider
// resizes clamp against them too.
@@ -35,7 +49,7 @@ export const STUDIO_PANE_MIN_WIDTH: Record<StudioPaneId, number> = {
copilot: 260,
editor: 260,
browser: 300,
- timeline: 260,
+ overview: 260,
};
// Stage chrome for the fit math; must match the stage p-3 and the divider
@@ -127,10 +141,10 @@ export function panesFromDeepLink(
defaultPanes: readonly StudioPaneId[] = DEFAULT_STUDIO_PANES,
): StudioPaneId[] {
if (params.runId && params.blockLabel) {
- return ["editor", "browser", "timeline"];
+ return ["editor", "browser", "overview"];
}
if (params.runId || params.active) {
- return ["copilot", "browser", "timeline"];
+ return ["copilot", "browser", "overview"];
}
return [...defaultPanes];
}
@@ -188,6 +202,13 @@ export function withPaneClosed(
return panes.filter((p) => p !== id);
}
+// Commas are legal unencoded in query values and parse back identically; keep
+// ?panes=copilot,browser readable no matter which writer serialized last.
+export function toReadableSearch(params: URLSearchParams): string {
+ const raw = params.toString().replace(/%2C/g, ",");
+ return raw ? `?${raw}` : "";
+}
+
// Serialize the open list into a search string, preserving unrelated params.
export function searchWithPanes(
search: string,
@@ -195,7 +216,5 @@ export function searchWithPanes(
): string {
const params = new URLSearchParams(search);
params.set(STUDIO_PANES_PARAM, panes.join(","));
- // Commas are legal unencoded in query values and parse back identically;
- // keep them readable (?panes=copilot,browser).
- return `?${params.toString().replace(/%2C/g, ",")}`;
+ return toReadableSearch(params);
}
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunOutputsSection.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunOutputsSection.tsx
index 8350eb268..dec5c25b8 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunOutputsSection.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunOutputsSection.tsx
@@ -247,11 +247,11 @@ export function RunOutputsSection({
href={file.url}
title={file.url}
aria-label={`Download ${file.filename}`}
- className="group flex items-center gap-2.5 rounded-md border border-border bg-slate-elevation2 px-3 py-2 text-sm text-foreground transition-colors hover:border-studio-accent/40 hover:bg-slate-elevation3"
+ className="group flex items-center gap-2.5 rounded-md border border-border bg-slate-elevation2 px-3 py-2 text-sm text-foreground transition-colors hover:bg-slate-elevation3"
>
<FileIcon className="size-4 shrink-0 text-muted-foreground" />
<span className="min-w-0 flex-1 truncate">{file.filename}</span>
- <DownloadIcon className="size-4 shrink-0 text-muted-foreground transition-colors group-hover:text-studio-accent-2" />
+ <DownloadIcon className="size-4 shrink-0 text-muted-foreground transition-colors group-hover:text-foreground" />
</a>
))}
</div>
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunOverviewSection.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunOverviewSection.tsx
deleted file mode 100644
index 5c2ed2061..000000000
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunOverviewSection.tsx
+++ /dev/null
@@ -1,150 +0,0 @@
-import { ClockIcon, ExclamationTriangleIcon } from "@radix-ui/react-icons";
-import { Link } from "react-router-dom";
-
-import { type WorkflowRunStatusApiResponseWithWorkflow } from "@/api/types";
-import { CopyButton } from "@/components/CopyButton";
-import { FailureCategoryBadge } from "@/components/FailureCategoryBadge";
-import { StatusBadge } from "@/components/StatusBadge";
-import { statusIsFinalized } from "@/routes/tasks/types";
-import { basicLocalTimeFormat, basicTimeFormat } from "@/util/timeFormat";
-
-import { OverviewField } from "./OverviewField";
-
-function StatBlock({ label, value }: { label: string; value: string }) {
- return (
- <div className="min-w-0 flex-1 rounded-lg border border-border bg-slate-elevation2 px-2 py-3 text-center">
- <div className="truncate text-base font-semibold text-foreground">
- {value}
- </div>
- <div className="text-[10px] font-medium uppercase tracking-wide text-muted-foreground">
- {label}
- </div>
- </div>
- );
-}
-
-type RunOverviewSectionProps = {
- workflowRun: WorkflowRunStatusApiResponseWithWorkflow;
- actionCount: number;
- elapsed: string;
-};
-
-/**
- * Overview body view of the Timeline pane: step / action / credit stat blocks plus
- * the run metadata that used to live in the header's Overview popover.
- */
-export function RunOverviewSection({
- workflowRun,
- actionCount,
- elapsed,
-}: RunOverviewSectionProps) {
- const finalized = statusIsFinalized(workflowRun);
- const webhookFailureReason =
- workflowRun.task_v2?.webhook_failure_reason ??
- workflowRun.webhook_failure_reason ??
- null;
- const webhookState = !workflowRun.webhook_callback_url
- ? null
- : webhookFailureReason
- ? "failed"
- : finalized
- ? "delivered"
- : "pending";
- const credits =
- (workflowRun.credits_used ?? 0) + (workflowRun.cached_credits_used ?? 0);
-
- return (
- <div className="flex flex-col gap-4">
- <div className="flex gap-2">
- <StatBlock label="Steps" value={String(workflowRun.total_steps ?? 0)} />
- <StatBlock label="Actions" value={String(actionCount)} />
- <StatBlock label="Credits" value={credits.toLocaleString()} />
- </div>
-
- <div className="flex flex-wrap items-center gap-2">
- <StatusBadge status={workflowRun.status} />
- {workflowRun.failure_category?.length ? (
- <FailureCategoryBadge
- failureCategory={workflowRun.failure_category}
- />
- ) : null}
- </div>
-
- {workflowRun.failure_reason ? (
- <div className="flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm">
- <ExclamationTriangleIcon className="mt-0.5 h-4 w-4 shrink-0 text-destructive" />
- <span className="whitespace-pre-wrap break-words text-foreground">
- {workflowRun.failure_reason}
- </span>
- </div>
- ) : null}
-
- <div className="flex flex-col gap-3">
- {workflowRun.started_at ? (
- <OverviewField label="Started">
- <span
- title={basicTimeFormat(workflowRun.started_at)}
- className="text-xs"
- >
- {basicLocalTimeFormat(workflowRun.started_at)}
- </span>
- </OverviewField>
- ) : null}
- {finalized && workflowRun.finished_at ? (
- <OverviewField label="Finished">
- <span
- title={basicTimeFormat(workflowRun.finished_at)}
- className="text-xs"
- >
- {basicLocalTimeFormat(workflowRun.finished_at)}
- </span>
- </OverviewField>
- ) : null}
- <OverviewField label="Duration">
- <span className="flex items-center gap-1.5 text-xs">
- <ClockIcon className="h-3.5 w-3.5 text-muted-foreground" />
- {elapsed}
- </span>
- </OverviewField>
- <OverviewField label="Run ID">
- <div className="flex items-center gap-1.5">
- <span className="truncate font-mono text-xs">
- {workflowRun.workflow_run_id}
- </span>
- <CopyButton value={workflowRun.workflow_run_id} />
- </div>
- </OverviewField>
- {webhookState ? (
- <OverviewField label="Webhook">
- <span
- className="font-mono text-xs"
- title={webhookFailureReason ?? undefined}
- >
- {webhookState}
- </span>
- </OverviewField>
- ) : null}
- {workflowRun.browser_session_id ? (
- <OverviewField label="Browser session">
- <Link
- to={`/browser-session/${workflowRun.browser_session_id}/stream`}
- className="font-mono text-xs text-studio-accent-2 underline-offset-4 hover:underline"
- >
- {workflowRun.browser_session_id}
- </Link>
- </OverviewField>
- ) : null}
- {workflowRun.browser_profile_id ? (
- <OverviewField label="Browser profile">
- <Link
- to={`/browser-profiles/${workflowRun.browser_profile_id}`}
- className="font-mono text-xs text-studio-accent-2 underline-offset-4 hover:underline"
- >
- {workflowRun.browser_profile_id}
- </Link>
- </OverviewField>
- ) : null}
- </div>
- </div>
- );
-}
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunPaneHeader.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunPaneHeader.tsx
index 51367e1b1..ccdf8c045 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunPaneHeader.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunPaneHeader.tsx
@@ -1,36 +1,184 @@
-import { useState } from "react";
-import { Share1Icon } from "@radix-ui/react-icons";
+import { useCallback, useState } from "react";
+import {
+ ActivityLogIcon,
+ CodeIcon,
+ FileTextIcon,
+ ListBulletIcon,
+ ReloadIcon,
+ Share1Icon,
+} from "@radix-ui/react-icons";
+import { useParams } from "react-router-dom";
import { ApiWebhookActionsMenu } from "@/components/ApiWebhookActionsMenu";
-import { StatusBadge } from "@/components/StatusBadge";
import { WebhookReplayDialog } from "@/components/WebhookReplayDialog";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
import { useApiCredential } from "@/hooks/useApiCredential";
+import { Status } from "@/api/types";
import { statusIsFinalized } from "@/routes/tasks/types";
+import { useRunViewStore } from "@/store/RunViewStore";
+import { useRunPaneViewStore } from "@/store/useRunPaneViewStore";
+import { useStudioBrowserStore } from "@/store/useStudioBrowserStore";
import { type ApiCommandOptions } from "@/util/apiCommands";
import { runsApiBaseUrl } from "@/util/env";
import { cn } from "@/util/utils";
+import { useIsGeneratingCode } from "../../editor/hooks/useIsGeneratingCode";
+import { constructCacheKeyValue } from "../../editor/utils";
import { useWorkflowRunWithWorkflowQuery } from "../../hooks/useWorkflowRunWithWorkflowQuery";
+import { PaneHeaderDivider } from "../PaneHeaderDivider";
+import { runOutcomeFromStatus } from "../runProjections";
+import { studioPanelId } from "../constants";
import { useStudioPaneCompact } from "../StudioShellContext";
import { useStudioInspectedRun } from "../useStudioInspectedRun";
+import { useStudioPanes } from "../useStudioPanes";
+import { ViewToggle } from "../ViewToggle";
/**
- * Left header cluster of the Timeline pane: the inspected run's status pill.
- * Queries dedupe with the pane body via react-query.
+ * Left header cluster of the Overview pane: the Timeline / Inputs / Outputs /
+ * Code view toggles, plus the Live handoff chip while the run executes. The
+ * selected view lives in useRunPaneViewStore; RunView renders the body.
*/
-export function RunPaneStatusBadge() {
+export function RunPaneViewToggles() {
+ const compact = useStudioPaneCompact();
const { runId } = useStudioInspectedRun();
+ const { workflowPermanentId } = useParams();
const { data: workflowRun } = useWorkflowRunWithWorkflowQuery(
runId ? { workflowRunId: runId } : undefined,
);
+ const view = useRunPaneViewStore((s) => s.view);
+ const setView = useRunPaneViewStore((s) => s.setView);
+ const jumpToLive = useRunViewStore((s) => s.jumpToLive);
+ const setBrowserPaneView = useStudioBrowserStore((s) => s.setView);
+ const { openPane } = useStudioPanes();
+ const cacheKey = workflowRun?.workflow?.cache_key ?? "";
+ const codeGenerating = useIsGeneratingCode({
+ cacheKey,
+ cacheKeyValue: constructCacheKeyValue({
+ codeKey: cacheKey,
+ workflow: workflowRun?.workflow,
+ workflowRun,
+ }),
+ // Same guard as the legacy run page: script queries 404 once the source
+ // agent is deleted.
+ workflowPermanentId: workflowRun?.workflow?.deleted_at
+ ? undefined
+ : workflowPermanentId,
+ workflowRunId: runId,
+ });
+
+ const focusBrowserPane = useCallback(() => {
+ // An explicit "watch live": unpin back to the live edge and hand the
+ // Browser pane a live intent (it may be sitting on a replay view).
+ jumpToLive();
+ setBrowserPaneView("live");
+ openPane("browser");
+ // Defer past the pane-open commit so the scroll sees the visible panel.
+ requestAnimationFrame(() => {
+ const reduceMotion =
+ typeof window.matchMedia === "function" &&
+ window.matchMedia("(prefers-reduced-motion: reduce)").matches;
+ document.getElementById(studioPanelId("browser"))?.scrollIntoView({
+ behavior: reduceMotion ? "auto" : "smooth",
+ block: "nearest",
+ inline: "nearest",
+ });
+ });
+ }, [jumpToLive, setBrowserPaneView, openPane]);
+
if (!workflowRun) {
return null;
}
- return <StatusBadge status={workflowRun.status} />;
+ const outcome = runOutcomeFromStatus(workflowRun.status);
+ const provisioning =
+ workflowRun.status === Status.Created ||
+ workflowRun.status === Status.Queued;
+ const showLive = outcome === "running" && !provisioning;
+
+ return (
+ <>
+ <PaneHeaderDivider />
+ <div
+ role="group"
+ aria-label="Run view"
+ className="flex min-w-0 shrink items-center gap-1 overflow-hidden"
+ >
+ <ViewToggle
+ active={view === "timeline"}
+ onClick={() => setView("timeline")}
+ compact={compact}
+ label="Timeline"
+ icon={<ActivityLogIcon className="h-3 w-3" />}
+ />
+ <ViewToggle
+ active={view === "inputs"}
+ onClick={() => setView("inputs")}
+ compact={compact}
+ label="Inputs"
+ icon={<ListBulletIcon className="h-3 w-3" />}
+ />
+ <ViewToggle
+ active={view === "outputs"}
+ onClick={() => setView("outputs")}
+ compact={compact}
+ label="Outputs"
+ icon={<FileTextIcon className="h-3 w-3" />}
+ />
+ <ViewToggle
+ active={view === "code"}
+ onClick={() => setView("code")}
+ compact={compact}
+ label="Code"
+ title={
+ codeGenerating ? "Generating cached code for this run" : undefined
+ }
+ icon={
+ codeGenerating ? (
+ <ReloadIcon
+ data-testid="code-generating-spinner"
+ className="h-3 w-3 animate-spin"
+ />
+ ) : (
+ <CodeIcon className="h-3 w-3" />
+ )
+ }
+ />
+ </div>
+ {showLive
+ ? (() => {
+ const liveChip = (
+ <button
+ type="button"
+ onClick={focusBrowserPane}
+ aria-label="Live"
+ className="inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-border px-2.5 text-[11px] font-medium text-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
+ >
+ <span className="h-1.5 w-1.5 animate-pulse rounded-full bg-success" />
+ {compact ? null : "Live"}
+ </button>
+ );
+ // Labelled → self-describing; icon-collapsed keeps the tooltip.
+ return compact ? (
+ <Tooltip>
+ <TooltipTrigger asChild>{liveChip}</TooltipTrigger>
+ <TooltipContent side="bottom">
+ Watch live in the Browser pane
+ </TooltipContent>
+ </Tooltip>
+ ) : (
+ liveChip
+ );
+ })()
+ : null}
+ </>
+ );
}
/**
- * Right header cluster of the Timeline pane: the API & Webhooks menu for the
+ * Right header cluster of the Overview pane: the API & Webhooks menu for the
* inspected run, relocated from the retired run-hero header.
*/
export function RunPaneActions() {
@@ -44,22 +192,27 @@ export function RunPaneActions() {
if (!workflowRun) {
return null;
}
+ // Legacy parity: the menu re-runs the workflow via API, which is gone with
+ // the source agent.
+ if (workflowRun.workflow?.deleted_at) {
+ return null;
+ }
const finalized = statusIsFinalized(workflowRun);
return (
<>
<ApiWebhookActionsMenu
+ triggerTooltip={compact ? "API & Webhooks" : undefined}
trigger={
<button
type="button"
- title={compact ? "API & Webhooks" : undefined}
aria-label="API & Webhooks"
className={cn(
- "inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium",
- "text-muted-foreground hover:bg-slate-elevation3 hover:text-foreground",
+ "inline-flex h-7 items-center gap-1.5 rounded-md border border-border px-2 text-[11px] font-medium",
+ "text-muted-foreground hover:bg-accent hover:text-accent-foreground",
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
)}
>
- <Share1Icon className="h-4 w-4" />
+ <Share1Icon className="h-3.5 w-3.5" />
{compact ? null : "API & Webhooks"}
</button>
}
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.test.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.test.tsx
new file mode 100644
index 000000000..7d9c9fcbf
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.test.tsx
@@ -0,0 +1,65 @@
+// @vitest-environment jsdom
+
+import { cleanup, render, screen } from "@testing-library/react";
+import { MemoryRouter } from "react-router-dom";
+import { afterEach, describe, expect, test } from "vitest";
+
+import {
+ Status,
+ type WorkflowRunStatusApiResponseWithWorkflow,
+} from "@/api/types";
+
+import { RunSummaryStrip } from "./RunSummaryStrip";
+
+afterEach(cleanup);
+
+function makeRun(
+ overrides: Partial<WorkflowRunStatusApiResponseWithWorkflow> = {},
+): WorkflowRunStatusApiResponseWithWorkflow {
+ return {
+ workflow_run_id: "wr_123",
+ status: Status.Completed,
+ started_at: "2026-07-01T00:00:00Z",
+ finished_at: "2026-07-01T00:05:00Z",
+ failure_category: null,
+ browser_session_id: null,
+ browser_profile_id: null,
+ ...overrides,
+ } as WorkflowRunStatusApiResponseWithWorkflow;
+}
+
+function renderStrip(run: WorkflowRunStatusApiResponseWithWorkflow) {
+ return render(
+ <MemoryRouter>
+ <RunSummaryStrip workflowRun={run} elapsed="5m" />
+ </MemoryRouter>,
+ );
+}
+
+describe("RunSummaryStrip browser session/profile links", () => {
+ test("links the run's browser session and profile at the legacy targets", () => {
+ renderStrip(
+ makeRun({
+ browser_session_id: "pbs_abc",
+ browser_profile_id: "bp_def",
+ }),
+ );
+ expect(
+ screen.getByRole("link", { name: "pbs_abc" }).getAttribute("href"),
+ ).toBe("/browser-session/pbs_abc/stream");
+ expect(
+ screen.getByRole("link", { name: "bp_def" }).getAttribute("href"),
+ ).toBe("/browser-profiles/bp_def");
+ });
+
+ test("renders only the id the run has", () => {
+ renderStrip(makeRun({ browser_session_id: "pbs_abc" }));
+ expect(screen.getByRole("link", { name: "pbs_abc" })).toBeTruthy();
+ expect(screen.queryByTitle("Browser profile")).toBeNull();
+ });
+
+ test("renders no meta line when the run has neither", () => {
+ renderStrip(makeRun());
+ expect(screen.queryByRole("link")).toBeNull();
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.tsx
new file mode 100644
index 000000000..2e7900117
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.tsx
@@ -0,0 +1,104 @@
+import { ClockIcon } from "@radix-ui/react-icons";
+import { Link } from "react-router-dom";
+
+import { type WorkflowRunStatusApiResponseWithWorkflow } from "@/api/types";
+import { CopyButton } from "@/components/CopyButton";
+import { FailureCategoryBadge } from "@/components/FailureCategoryBadge";
+import { StatusBadge } from "@/components/StatusBadge";
+import { statusIsFinalized } from "@/routes/tasks/types";
+import { basicLocalTimeFormat } from "@/util/timeFormat";
+
+type RunSummaryStripProps = {
+ workflowRun: WorkflowRunStatusApiResponseWithWorkflow;
+ elapsed: string;
+};
+
+function RunResourceLink({
+ label,
+ id,
+ to,
+}: {
+ label: string;
+ id: string;
+ to: string;
+}) {
+ return (
+ <span className="flex min-w-0 items-center gap-1">
+ <Link
+ to={to}
+ title={label}
+ className="truncate font-mono text-xs text-muted-foreground underline-offset-4 hover:text-foreground hover:underline"
+ >
+ {id}
+ </Link>
+ <CopyButton value={id} />
+ </span>
+ );
+}
+
+/**
+ * One meta line atop the Timeline view: status · duration · run id. Counts
+ * (blocks/actions/steps/credits) live in the timeline's own header row, and
+ * started/finished timestamps ride the duration tooltip, so the strip never
+ * eats the timeline's vertical budget. Runs with a browser session/profile get
+ * a second quiet line linking them (same targets as the legacy run header).
+ */
+export function RunSummaryStrip({
+ workflowRun,
+ elapsed,
+}: RunSummaryStripProps) {
+ const finalized = statusIsFinalized(workflowRun);
+ const timesTooltip = [
+ workflowRun.started_at
+ ? `Started ${basicLocalTimeFormat(workflowRun.started_at)}`
+ : null,
+ finalized && workflowRun.finished_at
+ ? `Finished ${basicLocalTimeFormat(workflowRun.finished_at)}`
+ : null,
+ ]
+ .filter(Boolean)
+ .join(" · ");
+
+ return (
+ <div className="flex shrink-0 flex-col gap-2">
+ <div className="flex min-w-0 items-center gap-2">
+ <StatusBadge status={workflowRun.status} />
+ {workflowRun.failure_category?.length ? (
+ <FailureCategoryBadge
+ failureCategory={workflowRun.failure_category}
+ />
+ ) : null}
+ <span
+ title={timesTooltip || undefined}
+ className="flex shrink-0 items-center gap-1 text-xs text-muted-foreground"
+ >
+ <ClockIcon className="h-3.5 w-3.5" />
+ {elapsed}
+ </span>
+ <span className="min-w-0 flex-1" />
+ <span className="truncate font-mono text-xs text-muted-foreground">
+ {workflowRun.workflow_run_id}
+ </span>
+ <CopyButton value={workflowRun.workflow_run_id} />
+ </div>
+ {workflowRun.browser_session_id || workflowRun.browser_profile_id ? (
+ <div className="flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1">
+ {workflowRun.browser_session_id ? (
+ <RunResourceLink
+ label="Browser session"
+ id={workflowRun.browser_session_id}
+ to={`/browser-session/${workflowRun.browser_session_id}/stream`}
+ />
+ ) : null}
+ {workflowRun.browser_profile_id ? (
+ <RunResourceLink
+ label="Browser profile"
+ id={workflowRun.browser_profile_id}
+ to={`/browser-profiles/${workflowRun.browser_profile_id}`}
+ />
+ ) : null}
+ </div>
+ ) : null}
+ </div>
+ );
+}
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 a8c3266c9..4c873f400 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx
@@ -7,12 +7,15 @@ import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { type ReactNode } from "react";
import { ActionTypes, Status, type ActionsApiResponse } from "@/api/types";
+import { TooltipProvider } from "@/components/ui/tooltip";
+import { useRunPaneViewStore } from "@/store/useRunPaneViewStore";
import { useRunViewStore } from "@/store/RunViewStore";
import { useStudioBrowserStore } from "@/store/useStudioBrowserStore";
import type {
WorkflowRunBlock,
WorkflowRunTimelineItem,
} from "../../types/workflowRunTypes";
+import { RunPaneViewToggles } from "./RunPaneHeader";
import { RunView } from "./RunView";
const mocks = vi.hoisted(() => ({
@@ -52,6 +55,15 @@ vi.mock("@/components/ui/scroll-area", () => ({
vi.mock("posthog-js/react", () => ({
usePostHog: () => ({ capture: vi.fn() }),
}));
+// The header toggles resolve the inspected run themselves; pin it to the same
+// run the RunView under test renders (avoids the latest-run fallback query).
+vi.mock("../useStudioInspectedRun", () => ({
+ useStudioInspectedRun: () => ({
+ runId: "wr_1",
+ explicit: true,
+ pending: false,
+ }),
+}));
function buildBlock(
overrides: Partial<WorkflowRunBlock> = {},
@@ -215,14 +227,24 @@ function renderRunView(
const queryClient = new QueryClient({
defaultOptions: { queries: { retry: false } },
});
- return render(
+ // Fresh elements per (re)render so React re-runs the mocked hooks; the
+ // component instances (and the MemoryRouter's URL state) are preserved.
+ const makeUi = () => (
<QueryClientProvider client={queryClient}>
<MemoryRouter initialEntries={[initialEntry]}>
- <RunView workflowRunId="wr_1" {...props} />
+ {/* The toggles live in the pane header (StudioShell); render them
+ alongside the body, under a TooltipProvider, the way the shell
+ composes them. */}
+ <TooltipProvider delayDuration={0}>
+ <RunPaneViewToggles />
+ <RunView workflowRunId="wr_1" {...props} />
+ </TooltipProvider>
<LocationSpy />
</MemoryRouter>
- </QueryClientProvider>,
+ </QueryClientProvider>
);
+ const view = render(makeUi());
+ return { ...view, rerenderRunView: () => view.rerender(makeUi()) };
}
afterEach(() => {
@@ -233,6 +255,7 @@ afterEach(() => {
});
beforeEach(() => {
useRunViewStore.getState().reset();
+ useRunPaneViewStore.getState().reset();
useStudioBrowserStore.setState({ view: "auto" });
});
@@ -247,12 +270,11 @@ describe("RunView view toggles", () => {
expect(scope.queryAllByText("checkout-loop").length).toBeGreaterThan(0);
});
- test("Overview view shows the run stat blocks and metadata", () => {
+ test("the Timeline view leads with the summary meta line", () => {
seedCompletedRun({
total_steps: 12,
credits_used: 3,
cached_credits_used: 2,
- webhook_callback_url: "https://example.test/hook",
});
mocks.timeline = [
buildBlockItem(
@@ -265,27 +287,14 @@ describe("RunView view toggles", () => {
const { container } = renderRunView();
const scope = within(container);
- fireEvent.click(scope.getByRole("button", { name: "Overview" }));
-
- expect(scope.getByText("Steps")).not.toBeNull();
- expect(scope.getByText("12")).not.toBeNull();
- expect(scope.getByText("Actions")).not.toBeNull();
- // total credits = credits_used + cached_credits_used
- expect(scope.getByText("5")).not.toBeNull();
+ // status · duration · run id — the counts live in the timeline's own
+ // header row, so the strip carries no stat boxes.
expect(scope.getByText("wr_1")).not.toBeNull();
- expect(scope.getByText("delivered")).not.toBeNull();
- });
-
- test("Overview reports a failed webhook delivery", () => {
- seedCompletedRun({
- webhook_callback_url: "https://example.test/hook",
- webhook_failure_reason: "410 gone",
- });
- const { container } = renderRunView();
- const scope = within(container);
-
- fireEvent.click(scope.getByRole("button", { name: "Overview" }));
- expect(scope.getByText("failed")).not.toBeNull();
+ expect(
+ scope.getAllByText("completed", { exact: false }).length,
+ ).toBeGreaterThan(0);
+ expect(scope.queryByText("Steps")).toBeNull();
+ expect(scope.queryByText("Credits")).toBeNull();
});
test("Inputs view shows the run's input metadata", () => {
@@ -319,13 +328,136 @@ describe("RunView view toggles", () => {
expect(scope.queryByTestId("code-generating-spinner")).not.toBeNull();
});
- test("hides the Inputs and Outputs toggles when the run has neither", () => {
+ test("Inputs and Outputs stay visible without data and show empty states", () => {
seedCompletedRun();
const { container } = renderRunView();
const scope = within(container);
- expect(scope.queryByRole("button", { name: "Inputs" })).toBeNull();
- expect(scope.queryByRole("button", { name: "Outputs" })).toBeNull();
+ fireEvent.click(scope.getByRole("button", { name: "Inputs" }));
+ expect(scope.getByText("No inputs for this run")).not.toBeNull();
+
+ fireEvent.click(scope.getByRole("button", { name: "Outputs" }));
+ expect(scope.getByText("No outputs for this run")).not.toBeNull();
+ });
+});
+
+describe("RunView cold-open selection", () => {
+ function seedTerminalRunWithActions() {
+ mocks.timeline = [
+ buildBlockItem(
+ buildBlock({
+ workflow_run_block_id: "wrb_1",
+ label: "goto-block",
+ // Newest-first, matching the API; the filmstrip reverses per block.
+ actions: [
+ buildAction({ action_id: "act_2", action_order: 1 }),
+ buildAction({ action_id: "act_1", action_order: 0 }),
+ ],
+ }),
+ ),
+ ];
+ mocks.workflowRun = {
+ workflow_run_id: "wr_1",
+ status: Status.Completed,
+ workflow: {
+ workflow_definition: { blocks: [], finally_block_label: null },
+ },
+ };
+ }
+
+ test("a terminal ?wr= deep link with no ?active= selects the last item", () => {
+ seedTerminalRunWithActions();
+ const { getByTestId } = renderRunView({}, "/?wr=wr_1");
+
+ expect(useRunViewStore.getState().pinnedFrameId).toBe("act_2");
+ expect(getByTestId("location-search").textContent).toContain("active=");
+ });
+
+ test("an explicit ?active= deep link wins over the last-item default", () => {
+ seedTerminalRunWithActions();
+ renderRunView({}, "/?wr=wr_1&active=act_1");
+
+ expect(useRunViewStore.getState().pinnedFrameId).toBe("act_1");
+ });
+
+ test("a still-running run keeps following the live edge", () => {
+ seedRunningRun();
+ renderRunView({}, "/?wr=wr_1");
+
+ expect(useRunViewStore.getState().pinnedFrameId).toBeNull();
+ });
+
+ test("a block-iterate link (?bl=) keeps its live surface unselected", () => {
+ seedTerminalRunWithActions();
+ renderRunView({}, "/?wr=wr_1&bl=goto-block");
+
+ expect(useRunViewStore.getState().pinnedFrameId).toBeNull();
+ });
+});
+
+describe("RunView live-watch terminal transition", () => {
+ function seedWatchedRun(status: Status) {
+ mocks.timeline = [
+ buildBlockItem(
+ buildBlock({
+ workflow_run_block_id: "wrb_1",
+ label: "goto-block",
+ // Newest-first, matching the API; the filmstrip reverses per block.
+ actions: [
+ buildAction({ action_id: "act_2", action_order: 1 }),
+ buildAction({ action_id: "act_1", action_order: 0 }),
+ ],
+ }),
+ ),
+ ];
+ mocks.workflowRun = {
+ workflow_run_id: "wr_1",
+ status,
+ browser_session_id: "pbs_1",
+ workflow: {
+ workflow_definition: { blocks: [], finally_block_label: null },
+ },
+ };
+ }
+
+ test("a watched run finishing lands the selection on the last item", () => {
+ seedWatchedRun(Status.Running);
+ const view = renderRunView({}, "/?wr=wr_1");
+ expect(useRunViewStore.getState().pinnedFrameId).toBeNull();
+
+ seedWatchedRun(Status.Completed);
+ view.rerenderRunView();
+
+ // The pin + ?active= hand the Browser pane's auto view to the machine,
+ // which resolves scrubbing to Screenshots on the final item.
+ expect(useRunViewStore.getState().pinnedFrameId).toBe("act_2");
+ expect(view.getByTestId("location-search").textContent).toContain(
+ "active=act_2",
+ );
+ expect(useStudioBrowserStore.getState().view).toBe("auto");
+ });
+
+ test("a view pill pinned mid-watch is never overridden at run end", () => {
+ seedWatchedRun(Status.Running);
+ const view = renderRunView({}, "/?wr=wr_1");
+ useStudioBrowserStore.getState().setView("recording");
+
+ seedWatchedRun(Status.Completed);
+ view.rerenderRunView();
+
+ expect(useRunViewStore.getState().pinnedFrameId).toBeNull();
+ expect(useStudioBrowserStore.getState().view).toBe("recording");
+ });
+
+ test("a timeline pin made mid-watch is never overridden at run end", () => {
+ seedWatchedRun(Status.Running);
+ const view = renderRunView({}, "/?wr=wr_1");
+ useRunViewStore.getState().pinFrame("act_1");
+
+ seedWatchedRun(Status.Completed);
+ view.rerenderRunView();
+
+ expect(useRunViewStore.getState().pinnedFrameId).toBe("act_1");
});
});
@@ -485,17 +617,18 @@ describe("RunView output signals", () => {
const { container } = renderRunView();
const scope = within(container);
- expect(scope.queryByRole("button", { name: "Outputs" })).toBeNull();
+ fireEvent.click(scope.getByRole("button", { name: "Outputs" }));
expect(scope.queryByText("Run errors")).toBeNull();
});
- test("does not offer an Outputs view when run signals are absent", () => {
+ test("shows the Outputs empty state when run signals are absent", () => {
seedCompletedRun();
const { container } = renderRunView();
const scope = within(container);
- expect(scope.queryByRole("button", { name: "Outputs" })).toBeNull();
+ fireEvent.click(scope.getByRole("button", { name: "Outputs" }));
+ expect(scope.getByText("No outputs for this run")).not.toBeNull();
expect(scope.queryByText("Run errors")).toBeNull();
expect(scope.queryByText("Downloaded files")).toBeNull();
});
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx
index 9427b5643..347d30a02 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx
@@ -1,26 +1,19 @@
-import { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { useEffect, useMemo, useRef, useState } from "react";
import {
- ActivityLogIcon,
ClockIcon,
- CodeIcon,
Cross2Icon,
ExclamationTriangleIcon,
- FileTextIcon,
- ListBulletIcon,
- ReaderIcon,
- ReloadIcon,
} from "@radix-ui/react-icons";
-import { useParams, useSearchParams } from "react-router-dom";
+import { useNavigate, useSearchParams } from "react-router-dom";
import { Status } from "@/api/types";
import { Button } from "@/components/ui/button";
import { statusIsFinalized } from "@/routes/tasks/types";
+import { useRunPaneViewStore } from "@/store/useRunPaneViewStore";
import { useRunViewStore } from "@/store/RunViewStore";
import { useStudioBrowserStore } from "@/store/useStudioBrowserStore";
import { isRecord } from "@/util/utils";
-import { useIsGeneratingCode } from "../../editor/hooks/useIsGeneratingCode";
-import { constructCacheKeyValue } from "../../editor/utils";
import { useWorkflowRunTimelineQuery } from "../../hooks/useWorkflowRunTimelineQuery";
import { useWorkflowRunWithWorkflowQuery } from "../../hooks/useWorkflowRunWithWorkflowQuery";
import { WorkflowRunBlockDetail } from "../../workflowRun/WorkflowRunBlockDetail";
@@ -35,9 +28,8 @@ import {
formatElapsed,
runOutcomeFromStatus,
} from "../runProjections";
-import { studioPanelId } from "../constants";
+import { toReadableSearch } from "../panes";
import { useStudioPanes } from "../useStudioPanes";
-import { ViewToggle } from "../ViewToggle";
import { matchFailureTips } from "./failureTips";
import { buildRunFixMessage } from "./runFixMessage";
import { RunInputsSection, type RunInputMeta } from "./RunInputsSection";
@@ -46,8 +38,8 @@ import {
type RunOutputError,
type RunOutputFile,
} from "./RunOutputsSection";
-import { RunOverviewSection } from "./RunOverviewSection";
import { RunPlaceholder } from "./RunPlaceholder";
+import { RunSummaryStrip } from "./RunSummaryStrip";
type RunViewProps = {
workflowRunId?: string;
@@ -58,12 +50,6 @@ type RunViewProps = {
onRetry?: () => void;
};
-type RunPaneView = "timeline" | "overview" | "inputs" | "outputs" | "code";
-
-// Below this row width the view-toggle labels collapse to icons — the pane,
-// not the viewport, decides (studio panes share the stage side by side).
-const TOGGLE_ROW_COMPACT_BELOW_PX = 440;
-
function isRunOutputError(value: unknown): value is RunOutputError {
return isRecord(value);
}
@@ -76,10 +62,11 @@ function normalizeRunOutputErrors(value: unknown): RunOutputError[] {
}
/**
- * Timeline pane body: the run timeline + step detail, with Overview / Inputs /
- * Outputs / Code as sibling views. Visuals (live stream, screenshots,
- * recordings) live in the Browser pane, which follows this pane's selection
- * via RunViewStore and ?active=.
+ * Overview pane body: the run timeline + step detail (under the summary strip),
+ * with Inputs / Outputs / Code as sibling views. The view toggles live in the
+ * pane header (RunPaneViewToggles) and share useRunPaneViewStore. Visuals
+ * (live stream, screenshots, recordings) live in the Browser pane, which
+ * follows this pane's selection via RunViewStore and ?active=.
*/
export function RunView({
workflowRunId,
@@ -93,30 +80,18 @@ export function RunView({
const { data: workflowRun, isLoading } =
useWorkflowRunWithWorkflowQuery(queryOptions);
const { data: timeline } = useWorkflowRunTimelineQuery(queryOptions);
- const { workflowPermanentId } = useParams();
- const cacheKey = workflowRun?.workflow?.cache_key ?? "";
- const codeGenerating = useIsGeneratingCode({
- cacheKey,
- cacheKeyValue: constructCacheKeyValue({
- codeKey: cacheKey,
- workflow: workflowRun?.workflow,
- workflowRun,
- }),
- workflowPermanentId,
- workflowRunId,
- });
const pinnedFrameId = useRunViewStore((s) => s.pinnedFrameId);
const activeIteration = useRunViewStore((s) => s.activeIteration);
const pinFrame = useRunViewStore((s) => s.pinFrame);
- const jumpToLive = useRunViewStore((s) => s.jumpToLive);
const resetRunView = useRunViewStore((s) => s.reset);
- const setBrowserPaneView = useStudioBrowserStore((s) => s.setView);
- const { panes: studioPanes, openPane } = useStudioPanes();
- const runPaneOpen = studioPanes.includes("timeline");
- const [searchParams, setSearchParams] = useSearchParams();
+ const { panes: studioPanes } = useStudioPanes();
+ const runPaneOpen = studioPanes.includes("overview");
+ const navigate = useNavigate();
+ const [searchParams] = useSearchParams();
const searchParamsRef = useRef(searchParams);
searchParamsRef.current = searchParams;
- const [view, setView] = useState<RunPaneView>("timeline");
+ const view = useRunPaneViewStore((s) => s.view);
+ const resetPaneView = useRunPaneViewStore((s) => s.reset);
const [failureDismissed, setFailureDismissed] = useState(false);
const [outputSummary, setOutputSummary] = useState<string | null>(null);
@@ -125,13 +100,13 @@ export function RunView({
useEffect(() => {
resetRunView();
setOutputSummary(null);
- setView("timeline");
+ resetPaneView();
setFailureDismissed(false);
const active = searchParamsRef.current.get("active");
if (active) {
pinFrame(active);
}
- }, [workflowRunId, resetRunView, pinFrame]);
+ }, [workflowRunId, resetRunView, resetPaneView, pinFrame]);
// Mirror the pinned item to ?active= so selection survives reload. Skip the first
// pass after a run change so the seed above doesn't fight the URL.
@@ -141,30 +116,26 @@ export function RunView({
lastMirroredRunRef.current = workflowRunId;
return;
}
- setSearchParams(
- (prev) => {
- // Build on the LIVE URL (prev is this render's closure): a concurrent
- // navigation (block-run launch, pane toggle) is already visible there.
- const base = window.location.search || `?${prev.toString()}`;
- const next = new URLSearchParams(base);
- const desired =
- pinnedFrameId && !/:\d+$/.test(pinnedFrameId) ? pinnedFrameId : null;
- if ((next.get("active") ?? null) === desired) {
- return next;
- }
- if (desired) {
- next.set("active", desired);
- } else {
- next.delete("active");
- }
- return next;
- },
- { replace: true },
+ // Build on the LIVE URL (the ref can be one render stale): a concurrent
+ // navigation (block-run launch, pane toggle) is already visible there.
+ const next = new URLSearchParams(
+ window.location.search || searchParamsRef.current.toString(),
);
- }, [pinnedFrameId, workflowRunId, setSearchParams]);
+ const desired =
+ pinnedFrameId && !/:\d+$/.test(pinnedFrameId) ? pinnedFrameId : null;
+ if ((next.get("active") ?? null) === desired) {
+ return;
+ }
+ if (desired) {
+ next.set("active", desired);
+ } else {
+ next.delete("active");
+ }
+ navigate({ search: toReadableSearch(next) }, { replace: true });
+ }, [pinnedFrameId, workflowRunId, navigate]);
// Stabilize an ?active=-only deep link by ADDING ?wr= when it's absent. Gated on
- // the Timeline pane being open: RunView stays mounted while its pane is closed.
+ // the Overview pane being open: RunView stays mounted while its pane is closed.
//
// The guard reads the LIVE URL, not this render's searchParams: a block-run launch
// navigates to ?wr=&bl= via a separate router update, and this effect can fire from
@@ -181,25 +152,69 @@ export function RunView({
if (new URLSearchParams(window.location.search).get("wr")) {
return;
}
- setSearchParams(
- (prev) => {
- const base = window.location.search || `?${prev.toString()}`;
- const next = new URLSearchParams(base);
- if (next.get("wr")) {
- return next;
- }
- next.set("wr", workflowRunId);
- return next;
- },
- { replace: true },
+ const next = new URLSearchParams(
+ window.location.search || searchParamsRef.current.toString(),
);
- }, [runPaneOpen, workflowRunId, setSearchParams]);
+ if (next.get("wr")) {
+ return;
+ }
+ next.set("wr", workflowRunId);
+ navigate({ search: toReadableSearch(next) }, { replace: true });
+ }, [runPaneOpen, workflowRunId, navigate]);
const frames = useMemo(() => buildFilmstrip(timeline), [timeline]);
const lastFrame = frames.length > 0 ? frames[frames.length - 1] : null;
+ // Landing the selection on the LAST timeline item — so the Browser pane
+ // shows the final screenshot instead of an idle replay — happens on two
+ // paths sharing this one-shot: cold-opening a deep link to an already-
+ // finished run (?wr= with no ?active=), and a run watched live to its
+ // running→terminal transition. Explicit choices always win (?active=, a
+ // user's timeline pin, or — for the live-watch path — a pinned view pill),
+ // and ?bl= block-iterate links keep their live debug surface.
+ const autoPinDecidedForRunRef = useRef<string | undefined>(undefined);
+ const watchedLiveRunRef = useRef<string | undefined>(undefined);
+ useEffect(() => {
+ if (!workflowRunId || autoPinDecidedForRunRef.current === workflowRunId) {
+ return;
+ }
+ if (!workflowRun || !timeline) {
+ return;
+ }
+ if (!statusIsFinalized(workflowRun)) {
+ // Still running: leave the one-shot open so the terminal transition of
+ // a watched run lands the same last-item pin as a cold open.
+ watchedLiveRunRef.current = workflowRunId;
+ return;
+ }
+ autoPinDecidedForRunRef.current = workflowRunId;
+ const watchedLive = watchedLiveRunRef.current === workflowRunId;
+ const params = new URLSearchParams(
+ window.location.search || searchParamsRef.current.toString(),
+ );
+ if (params.get("wr") !== workflowRunId || params.get("active")) {
+ return;
+ }
+ if (params.has("bl")) {
+ return;
+ }
+ if (useRunViewStore.getState().pinnedFrameId) {
+ return;
+ }
+ // A view pill pinned mid-watch is an explicit choice; the ?active= write
+ // that follows a pin would hand the pane back to the machine and override
+ // it. (Cold opens skip this guard: a run swap resets the pill to auto in
+ // useBrowserPaneView, possibly in this same effect flush.)
+ if (watchedLive && useStudioBrowserStore.getState().view !== "auto") {
+ return;
+ }
+ const last = frames.length > 0 ? frames[frames.length - 1] : null;
+ if (last) {
+ pinFrame(last.id);
+ }
+ }, [workflowRunId, workflowRun, timeline, frames, pinFrame]);
+
const outcome = runOutcomeFromStatus(workflowRun?.status);
- const running = outcome === "running";
// A user-canceled run isn't a failure — don't show the "run failed" CTA.
const canceled = workflowRun?.status === Status.Canceled;
const failed = outcome === "failed" && !canceled;
@@ -222,24 +237,6 @@ export function RunView({
[timeline, selectedId, finalized, finallyBlockLabel],
);
- const focusBrowserPane = useCallback(() => {
- // An explicit "watch live": unpin back to the live edge and hand the
- // Browser pane a live intent (it may be sitting on a replay view).
- jumpToLive();
- setBrowserPaneView("live");
- openPane("browser");
- // Defer past the pane-open commit so the scroll sees the visible panel.
- requestAnimationFrame(() => {
- const reduceMotion =
- typeof window.matchMedia === "function" &&
- window.matchMedia("(prefers-reduced-motion: reduce)").matches;
- document.getElementById(studioPanelId("browser"))?.scrollIntoView({
- behavior: reduceMotion ? "auto" : "smooth",
- block: "nearest",
- inline: "nearest",
- });
- });
- }, [jumpToLive, setBrowserPaneView, openPane]);
const fixSeedMessage = useMemo(
() => buildRunFixMessage(workflowRun?.failure_reason ?? null),
[workflowRun?.failure_reason],
@@ -329,26 +326,6 @@ export function RunView({
observerOutput != null ||
webhookFailureReason != null;
- // Collapse toggle labels to icons by the row's own width.
- const hasRun = workflowRun != null;
- const toggleRowRef = useRef<HTMLDivElement>(null);
- const [toggleCompact, setToggleCompact] = useState(false);
- useEffect(() => {
- const el = toggleRowRef.current;
- if (!hasRun || !el || typeof ResizeObserver === "undefined") {
- return;
- }
- const observer = new ResizeObserver((entries) => {
- const width = entries[0]?.contentRect.width ?? 0;
- // A closed pane measures 0 (display:none); keep its last real state.
- if (width > 0) {
- setToggleCompact(width < TOGGLE_ROW_COMPACT_BELOW_PX);
- }
- });
- observer.observe(el);
- return () => observer.disconnect();
- }, [hasRun]);
-
if (!workflowRun) {
return <RunPlaceholder loading={isLoading || runIdPending} />;
}
@@ -358,90 +335,8 @@ export function RunView({
finalized ? (workflowRun.finished_at ?? null) : null,
);
- // A selected view whose data vanished (run change settles late) falls back
- // to the timeline instead of rendering an empty body.
- const resolvedView =
- (view === "inputs" && !hasInputs) || (view === "outputs" && !hasOutputs)
- ? "timeline"
- : view;
-
return (
<div className="flex h-full min-h-0 w-full flex-col">
- <div
- ref={toggleRowRef}
- className="flex shrink-0 items-center gap-2 border-b border-border px-3 py-2"
- >
- <div
- role="group"
- aria-label="Run view"
- className="flex min-w-0 shrink items-center gap-0.5 overflow-hidden rounded-md border border-slate-700 bg-slate-elevation2 p-0.5"
- >
- <ViewToggle
- active={resolvedView === "timeline"}
- onClick={() => setView("timeline")}
- compact={toggleCompact}
- label="Timeline"
- icon={<ActivityLogIcon className="h-3 w-3" />}
- />
- <ViewToggle
- active={resolvedView === "overview"}
- onClick={() => setView("overview")}
- compact={toggleCompact}
- label="Overview"
- icon={<ReaderIcon className="h-3 w-3" />}
- />
- {hasInputs ? (
- <ViewToggle
- active={resolvedView === "inputs"}
- onClick={() => setView("inputs")}
- compact={toggleCompact}
- label="Inputs"
- icon={<ListBulletIcon className="h-3 w-3" />}
- />
- ) : null}
- {hasOutputs ? (
- <ViewToggle
- active={resolvedView === "outputs"}
- onClick={() => setView("outputs")}
- compact={toggleCompact}
- label="Outputs"
- icon={<FileTextIcon className="h-3 w-3" />}
- />
- ) : null}
- <ViewToggle
- active={resolvedView === "code"}
- onClick={() => setView("code")}
- compact={toggleCompact}
- label="Code"
- title={
- codeGenerating ? "Generating cached code for this run" : undefined
- }
- icon={
- codeGenerating ? (
- <ReloadIcon
- data-testid="code-generating-spinner"
- className="h-3 w-3 animate-spin"
- />
- ) : (
- <CodeIcon className="h-3 w-3" />
- )
- }
- />
- </div>
- <span className="min-w-0 flex-1" />
- {running && !provisioning ? (
- <button
- type="button"
- onClick={focusBrowserPane}
- title="Watch live in the Browser pane"
- className="inline-flex shrink-0 items-center gap-1.5 rounded-full border border-border bg-slate-elevation2 px-2.5 py-1 text-[11px] font-medium text-foreground hover:bg-slate-elevation3 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
- >
- <span className="h-1.5 w-1.5 animate-pulse rounded-full bg-success" />
- Live
- </button>
- ) : null}
- </div>
-
<div className="flex min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-hidden p-3">
<WorkflowRunVerificationCodeForm
workflowRunId={workflowRun.workflow_run_id}
@@ -484,11 +379,7 @@ export function RunView({
{onFix || onRetry ? (
<div className="mt-3 flex flex-wrap gap-2">
{onFix ? (
- <Button
- size="sm"
- className="bg-studio-accent text-foreground hover:bg-studio-accent/90"
- onClick={() => onFix(fixSeedMessage)}
- >
+ <Button size="sm" onClick={() => onFix(fixSeedMessage)}>
Fix with Copilot
</Button>
) : null}
@@ -502,71 +393,78 @@ export function RunView({
</div>
) : null}
- {resolvedView === "timeline" ? (
- <div className="grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-3">
- <div className="min-h-0 overflow-hidden">
- <WorkflowRunTimeline
- workflowRunId={workflowRunId}
- hideLiveBadge
- activeItem={activeItem}
- activeIteration={activeIteration}
- onActionItemSelected={(item) => {
- pinFrame(item.action.action_id);
- }}
- onBlockItemSelected={(block) => {
- pinFrame(block.workflow_run_block_id);
- }}
- onThoughtItemSelected={(thought) => {
- pinFrame(thought.thought_id);
- }}
- onLiveStreamSelected={() => {
- pinFrame("stream");
- }}
- onIterationSelected={(loopBlock, iterationIndex) => {
- pinFrame(loopBlock.workflow_run_block_id, iterationIndex);
- }}
- />
- </div>
- <div className="flex min-h-0 flex-col overflow-hidden rounded-lg border border-border bg-slate-elevation1">
- <WorkflowRunBlockDetail
- activeItem={activeItem}
- activeIteration={activeIteration}
- timeline={timeline ?? []}
- timelineReady={Boolean(timeline)}
- showDownloadedFiles
- workflowRunId={workflowRunId}
- onThoughtSelect={(thought) => pinFrame(thought.thought_id)}
- />
+ {view === "timeline" ? (
+ <div className="flex min-h-0 flex-1 flex-col gap-3">
+ <RunSummaryStrip workflowRun={workflowRun} elapsed={elapsed} />
+ <div className="grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-3">
+ <div className="min-h-0 overflow-hidden">
+ <WorkflowRunTimeline
+ workflowRunId={workflowRunId}
+ hideLiveBadge
+ activeItem={activeItem}
+ activeIteration={activeIteration}
+ onActionItemSelected={(item) => {
+ pinFrame(item.action.action_id);
+ }}
+ onBlockItemSelected={(block) => {
+ pinFrame(block.workflow_run_block_id);
+ }}
+ onThoughtItemSelected={(thought) => {
+ pinFrame(thought.thought_id);
+ }}
+ onLiveStreamSelected={() => {
+ pinFrame("stream");
+ }}
+ onIterationSelected={(loopBlock, iterationIndex) => {
+ pinFrame(loopBlock.workflow_run_block_id, iterationIndex);
+ }}
+ />
+ </div>
+ <div className="flex min-h-0 flex-col overflow-hidden rounded-lg border border-border bg-slate-elevation1">
+ <WorkflowRunBlockDetail
+ activeItem={activeItem}
+ activeIteration={activeIteration}
+ timeline={timeline ?? []}
+ timelineReady={Boolean(timeline)}
+ showDownloadedFiles
+ workflowRunId={workflowRunId}
+ onThoughtSelect={(thought) => pinFrame(thought.thought_id)}
+ />
+ </div>
</div>
</div>
- ) : resolvedView === "overview" ? (
+ ) : view === "inputs" ? (
<div className="min-h-0 flex-1 overflow-y-auto rounded-lg border border-border bg-slate-elevation1 p-4">
- <RunOverviewSection
- workflowRun={workflowRun}
- actionCount={frames.length}
- elapsed={elapsed}
- />
- </div>
- ) : resolvedView === "inputs" ? (
- <div className="min-h-0 flex-1 overflow-y-auto rounded-lg border border-border bg-slate-elevation1 p-4">
- <RunInputsSection
- parameters={runInputs.parameters}
- meta={runInputs.meta}
- />
+ {hasInputs ? (
+ <RunInputsSection
+ parameters={runInputs.parameters}
+ meta={runInputs.meta}
+ />
+ ) : (
+ <div className="flex h-full items-center justify-center text-sm text-muted-foreground">
+ No inputs for this run
+ </div>
+ )}
</div>
- ) : resolvedView === "outputs" ? (
+ ) : view === "outputs" ? (
<div className="min-h-0 flex-1 overflow-y-auto rounded-lg border border-border bg-slate-elevation1 p-4">
- <RunOutputsSection
- workflowRunId={workflowRun.workflow_run_id}
- workflowTitle={workflowRun.workflow?.title}
- extractedInformation={extractedInformation}
- files={downloadedFiles}
- errors={runErrors}
- observerOutput={observerOutput}
- webhookFailureReason={webhookFailureReason}
- summary={outputSummary}
- onSummary={setOutputSummary}
- />
+ {hasOutputs ? (
+ <RunOutputsSection
+ workflowRunId={workflowRun.workflow_run_id}
+ workflowTitle={workflowRun.workflow?.title}
+ extractedInformation={extractedInformation}
+ files={downloadedFiles}
+ errors={runErrors}
+ observerOutput={observerOutput}
+ webhookFailureReason={webhookFailureReason}
+ summary={outputSummary}
+ onSummary={setOutputSummary}
+ />
+ ) : (
+ <div className="flex h-full items-center justify-center text-sm text-muted-foreground">
+ No outputs for this run
+ </div>
+ )}
</div>
) : (
<div className="flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-border bg-slate-elevation1 p-2">
diff --git a/skyvern-frontend/src/routes/workflows/studio/useBrowserPaneView.ts b/skyvern-frontend/src/routes/workflows/studio/useBrowserPaneView.ts
index 0c2d4e44d..afec091e7 100644
--- a/skyvern-frontend/src/routes/workflows/studio/useBrowserPaneView.ts
+++ b/skyvern-frontend/src/routes/workflows/studio/useBrowserPaneView.ts
@@ -83,9 +83,7 @@ export function useBrowserPaneView(): BrowserPaneViewState {
inspectingRun: explicit,
blockRunInDebugSession,
running: visuals.running,
- debugSessionUp: debugBrowserSessionId != null,
hasRecording: visuals.recordingUrls.length > 0,
- hasScreenshots: visuals.hasScreenshots,
failed: visuals.failed,
});
diff --git a/skyvern-frontend/src/routes/workflows/studio/useExecutingBlockRun.ts b/skyvern-frontend/src/routes/workflows/studio/useExecutingBlockRun.ts
index 59dd1cc70..e765adb67 100644
--- a/skyvern-frontend/src/routes/workflows/studio/useExecutingBlockRun.ts
+++ b/skyvern-frontend/src/routes/workflows/studio/useExecutingBlockRun.ts
@@ -18,8 +18,8 @@ export function useExecutingBlockRun(): boolean {
const isBlockRun = searchParams.has("bl");
const urlRunId = searchParams.get("wr");
const workflowRunId = isBlockRun && urlRunId ? urlRunId : undefined;
- // Shares the run cache RunView/StudioSpine poll (5s while not finalized), so
- // the gate releases on terminal status even with the Timeline pane closed.
+ // Shares the run cache RunView/StudioPaneToggles poll (5s while not finalized), so
+ // the gate releases on terminal status even with the Overview pane closed.
const { data: workflowRun } = useWorkflowRunWithWorkflowQuery(
workflowRunId ? { workflowRunId } : undefined,
);
diff --git a/skyvern-frontend/src/routes/workflows/studio/useRunVisuals.test.tsx b/skyvern-frontend/src/routes/workflows/studio/useRunVisuals.test.tsx
index 6f355cf78..442613405 100644
--- a/skyvern-frontend/src/routes/workflows/studio/useRunVisuals.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/useRunVisuals.test.tsx
@@ -139,7 +139,7 @@ describe("useRunVisuals loop-iteration threading", () => {
});
});
- test("resolves the Timeline pane's selected iteration from the shared store", () => {
+ test("resolves the Overview pane's selected iteration from the shared store", () => {
seedLoopRun();
useRunViewStore.getState().pinFrame("wrb_loop", 1);
const { result } = renderHook(() => useRunVisuals("wr_1"), { wrapper });
diff --git a/skyvern-frontend/src/routes/workflows/studio/useRunVisuals.ts b/skyvern-frontend/src/routes/workflows/studio/useRunVisuals.ts
index 3c2e3230d..3c1c0795f 100644
--- a/skyvern-frontend/src/routes/workflows/studio/useRunVisuals.ts
+++ b/skyvern-frontend/src/routes/workflows/studio/useRunVisuals.ts
@@ -68,7 +68,7 @@ export function useRunVisuals(workflowRunId: string | undefined): RunVisuals {
const { data: timeline } = useWorkflowRunTimelineQuery(queryOptions);
const [searchParams] = useSearchParams();
const activeParam = searchParams.get("active");
- // The Timeline pane's loop-iteration selection isn't in the URL; read it from the
+ // The Overview pane's loop-iteration selection isn't in the URL; read it from the
// shared store so a selected iteration's screenshot resolves here too.
const activeIteration = useRunViewStore((s) => s.activeIteration);
diff --git a/skyvern-frontend/src/routes/workflows/studio/useStudioPanes.ts b/skyvern-frontend/src/routes/workflows/studio/useStudioPanes.ts
index 73625f6fb..055e79d91 100644
--- a/skyvern-frontend/src/routes/workflows/studio/useStudioPanes.ts
+++ b/skyvern-frontend/src/routes/workflows/studio/useStudioPanes.ts
@@ -8,6 +8,7 @@ import {
import { liveSearch } from "./liveSearch";
import {
panesListEqual,
+ panesWithoutDeletedBlocked,
resolveOpenPanes,
searchWithPanes,
togglePane as togglePaneIn,
@@ -16,6 +17,7 @@ import {
type StudioPaneId,
} from "./panes";
import { useStudioPaneDefaults } from "./StudioPaneDefaultsContext";
+import { useStudioWorkflowDeletedAt } from "./StudioShellContext";
/**
* Pane state lives in the URL (?panes=), so the open set and its order are
@@ -27,16 +29,24 @@ export function useStudioPanes() {
const location = useLocation();
const navigate = useNavigate();
const { defaultPanes, clamp, notePaneWrite } = useStudioPaneDefaults();
+ const workflowDeleted = useStudioWorkflowDeletedAt() !== null;
// The mount-time viewport clamp only masks the exact pane list the URL
// carried at mount; any other list means someone navigated, so present it
- // as-is. The first write clears the clamp for good.
+ // as-is. The first write clears the clamp for good. A deleted source agent
+ // additionally drops the workflow-mutating panes, on reads and writes alike,
+ // so deep links and openPane callers degrade to the run-viewing surfaces.
const present = useCallback(
- (resolved: StudioPaneId[]): StudioPaneId[] =>
- clamp && panesListEqual(resolved, clamp.source)
- ? [...clamp.presented]
- : resolved,
- [clamp],
+ (resolved: StudioPaneId[]): StudioPaneId[] => {
+ const presented =
+ clamp && panesListEqual(resolved, clamp.source)
+ ? [...clamp.presented]
+ : resolved;
+ return workflowDeleted
+ ? panesWithoutDeletedBlocked(presented)
+ : presented;
+ },
+ [clamp, workflowDeleted],
);
const panes = useMemo(
@@ -60,14 +70,23 @@ export function useStudioPanes() {
) => {
const search = liveSearch(location.search);
const current = resolveLivePanes();
- const next = compute(current);
+ const computed = compute(current);
+ const next = workflowDeleted
+ ? panesWithoutDeletedBlocked(computed)
+ : computed;
notePaneWrite({ previous: current, next });
navigate(
{ search: searchWithPanes(search, next) },
{ replace: true, ...options },
);
},
- [navigate, location.search, resolveLivePanes, notePaneWrite],
+ [
+ navigate,
+ location.search,
+ resolveLivePanes,
+ notePaneWrite,
+ workflowDeleted,
+ ],
);
const togglePane = useCallback(
@@ -86,6 +105,13 @@ export function useStudioPanes() {
[applyPanes],
);
+ // Layout override: open exactly this list (explicit moments like the
+ // version-history editor-only view), replacing whatever is open.
+ const setOpenPanes = useCallback(
+ (panes: readonly StudioPaneId[]) => applyPanes(() => [...panes]),
+ [applyPanes],
+ );
+
// Reorder-only write (drag-and-drop / keyboard move): the live URL keeps
// deciding WHICH panes are open; `order` only decides where they sit.
const setPanesOrder = useCallback(
@@ -110,6 +136,7 @@ export function useStudioPanes() {
togglePane,
openPane,
closePane,
+ setOpenPanes,
setPanesOrder,
};
}
diff --git a/skyvern-frontend/src/routes/workflows/studio/useStudioPanesOrder.test.tsx b/skyvern-frontend/src/routes/workflows/studio/useStudioPanesOrder.test.tsx
index 61b8bfadc..7738a8174 100644
--- a/skyvern-frontend/src/routes/workflows/studio/useStudioPanesOrder.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/useStudioPanesOrder.test.tsx
@@ -8,11 +8,12 @@ import { type StudioPaneId } from "./panes";
import { useStudioPanes } from "./useStudioPanes";
function OrderProbe({ order }: { order: StudioPaneId[] }) {
- const { panes, setPanesOrder } = useStudioPanes();
+ const { panes, setPanesOrder, setOpenPanes } = useStudioPanes();
return (
<div>
<output data-testid="panes">{panes.join(",")}</output>
<button onClick={() => setPanesOrder(order)}>set-order</button>
+ <button onClick={() => setOpenPanes(order)}>set-open</button>
</div>
);
}
@@ -25,6 +26,14 @@ function renderWithPanes(search: string, order: StudioPaneId[]) {
);
}
+describe("useStudioPanes setOpenPanes", () => {
+ test("replaces the open set outright (layout override)", () => {
+ renderWithPanes("?panes=copilot,browser,overview", ["editor"]);
+ fireEvent.click(screen.getByText("set-open"));
+ expect(screen.getByTestId("panes").textContent).toBe("editor");
+ });
+});
+
describe("useStudioPanes setPanesOrder", () => {
test("commits a reordered list to the URL", () => {
renderWithPanes("?panes=copilot,editor,browser", [
@@ -41,10 +50,10 @@ describe("useStudioPanes setPanesOrder", () => {
});
test("keeps the open set from the URL: closed panes in the order are dropped, missing ones appended", () => {
- // "timeline" is not open, so it must not open; "browser" is open but
+ // "overview" is not open, so it must not open; "browser" is open but
// absent from the requested order, so it keeps a slot at the end.
renderWithPanes("?panes=copilot,editor,browser", [
- "timeline",
+ "overview",
"editor",
"copilot",
]);
diff --git a/skyvern-frontend/src/routes/workflows/studio/useStudioRunSignals.ts b/skyvern-frontend/src/routes/workflows/studio/useStudioRunSignals.ts
index 6f2293e4e..585cd6ce7 100644
--- a/skyvern-frontend/src/routes/workflows/studio/useStudioRunSignals.ts
+++ b/skyvern-frontend/src/routes/workflows/studio/useStudioRunSignals.ts
@@ -6,7 +6,7 @@ import { finalizedRunStatus } from "./runProjections";
import { useStudioRunId } from "./useStudioRunId";
/**
- * The run facts the shell keys UI off: Run-tab gating, the spine status dot,
+ * The run facts the shell keys UI off: Run-tab gating, the toggle status dot,
* and the first-visit pane default. `knownHasRuns` stays undefined until the
* runs page-1 probe has data, so callers can tell "no runs" from "not loaded".
*/
diff --git a/skyvern-frontend/src/store/WorkflowYamlEditorStore.ts b/skyvern-frontend/src/store/WorkflowYamlEditorStore.ts
index bb27152d0..0b74cd8b4 100644
--- a/skyvern-frontend/src/store/WorkflowYamlEditorStore.ts
+++ b/skyvern-frontend/src/store/WorkflowYamlEditorStore.ts
@@ -19,6 +19,11 @@ type WorkflowYamlEditorState = {
registerCommit: (
commit: ((persist?: boolean) => Promise<boolean>) | null,
) => void;
+ // Serializes the live canvas and opens the editor. Registered by the
+ // embedded Workspace so shell chrome (the Editor pane header's toggle) can
+ // enter Code mode without owning the serialization.
+ enterYamlMode: (() => void) | null;
+ registerEnterYamlMode: (enter: (() => void) | null) => void;
close: () => void;
};
@@ -42,6 +47,8 @@ export const useWorkflowYamlEditorStore = create<WorkflowYamlEditorState>(
setError: (error) => set({ error }),
setCommitting: (committing) => set({ committing }),
registerCommit: (commit) => set({ commit }),
+ enterYamlMode: null,
+ registerEnterYamlMode: (enterYamlMode) => set({ enterYamlMode }),
close: () =>
set({
active: false,
diff --git a/skyvern-frontend/src/store/useCopilotHeaderStore.ts b/skyvern-frontend/src/store/useCopilotHeaderStore.ts
new file mode 100644
index 000000000..1e13832e3
--- /dev/null
+++ b/skyvern-frontend/src/store/useCopilotHeaderStore.ts
@@ -0,0 +1,27 @@
+import { create } from "zustand";
+
+import { type WorkflowCopilotChatSummary } from "@/routes/workflows/copilot/workflowCopilotTypes";
+
+export type CopilotHeaderControls = {
+ workflowPermanentId: string | undefined;
+ currentChatId: string | null;
+ onSelectChat: (chat: WorkflowCopilotChatSummary) => void;
+ onNewChat: () => void;
+ disabled: boolean;
+};
+
+/**
+ * Bridges the docked copilot chat and the studio's Copilot pane header: the
+ * chat registers its History/New-chat controls here so the header (rendered
+ * by StudioShell, outside the chat's tree) can host them. Null when no docked
+ * chat is mounted — the header then renders no controls.
+ */
+type CopilotHeaderState = {
+ controls: CopilotHeaderControls | null;
+ setControls: (controls: CopilotHeaderControls | null) => void;
+};
+
+export const useCopilotHeaderStore = create<CopilotHeaderState>((set) => ({
+ controls: null,
+ setControls: (controls) => set({ controls }),
+}));
diff --git a/skyvern-frontend/src/store/useRunPaneViewStore.ts b/skyvern-frontend/src/store/useRunPaneViewStore.ts
new file mode 100644
index 000000000..6d89e41e5
--- /dev/null
+++ b/skyvern-frontend/src/store/useRunPaneViewStore.ts
@@ -0,0 +1,20 @@
+import { create } from "zustand";
+
+export type RunPaneView = "timeline" | "inputs" | "outputs" | "code";
+
+/**
+ * Which body view the studio's Overview pane shows. Lives in a store because
+ * the toggles render in the pane header (StudioShell) while the body is
+ * RunView; both stay in sync without prop-drilling through the shell.
+ */
+type RunPaneViewState = {
+ view: RunPaneView;
+ setView: (view: RunPaneView) => void;
+ reset: () => void;
+};
+
+export const useRunPaneViewStore = create<RunPaneViewState>((set) => ({
+ view: "timeline",
+ setView: (view) => set({ view }),
+ reset: () => set({ view: "timeline" }),
+}));
diff --git a/skyvern-frontend/tailwind.config.js b/skyvern-frontend/tailwind.config.js
index 1b731e3fa..cc6b426a8 100644
--- a/skyvern-frontend/tailwind.config.js
+++ b/skyvern-frontend/tailwind.config.js
@@ -91,11 +91,6 @@ export default {
cta: "hsl(var(--brand-cta))",
"cta-foreground": "hsl(var(--brand-cta-foreground))",
},
- studio: {
- accent: "hsl(var(--studio-accent))",
- "accent-foreground": "hsl(var(--studio-accent-foreground))",
- "accent-2": "hsl(var(--studio-accent-2))",
- },
},
borderRadius: {
lg: "var(--radius)",