Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
feat(SKY-10692): Workflow Studio — redesigned editor, browser & run viewing (opt-in preview) (#6782)
Celal Zamanoğlu54752d8b646b
diff --git a/skyvern-frontend/src/components/ApiWebhookActionsMenu.tsx b/skyvern-frontend/src/components/ApiWebhookActionsMenu.tsxindex 3c696f7fe..7e143e34f 100644--- a/skyvern-frontend/src/components/ApiWebhookActionsMenu.tsx+++ b/skyvern-frontend/src/components/ApiWebhookActionsMenu.tsx@@ -19,17 +19,19 @@ type ApiWebhookActionsMenuProps = {runId?: string;webhookDisabled?: boolean;onTestWebhook: () => void;+ size?: "default" | "sm";};export function ApiWebhookActionsMenu({getOptions,webhookDisabled = false,onTestWebhook,+ size = "default",}: ApiWebhookActionsMenuProps) {return (<DropdownMenu><DropdownMenuTrigger asChild>- <Button type="button" variant="secondary">+ <Button type="button" variant="secondary" size={size}>API & Webhooks</Button></DropdownMenuTrigger>diff --git a/skyvern-frontend/src/components/BrowserStream.tsx b/skyvern-frontend/src/components/BrowserStream.tsxindex 3fff348bd..7773cb83f 100644--- a/skyvern-frontend/src/components/BrowserStream.tsx+++ b/skyvern-frontend/src/components/BrowserStream.tsx@@ -562,18 +562,23 @@ function BrowserStream({// eslint-disable-next-line react-hooks/exhaustive-deps}, [interactive, isMessageConnected, userIsControlling]);- // Effect to handle window resize trigger for NoVNC canvas+ // noVNC (1.5.0) only rescales via its own observer, which gets swallowed on+ // re-parent; re-asserting scaleViewport on resize forces a recompute (skip 0×0).useEffect(() => {- if (!resizeTrigger || !canvasContainer || !rfbRef.current) {+ if (!canvasContainer || typeof ResizeObserver === "undefined") {return;}-- // const originalDisplay = canvasContainer.style.display;- // canvasContainer.style.display = "none";- // canvasContainer.offsetHeight;- // canvasContainer.style.display = originalDisplay;- // window.dispatchEvent(new Event("resize"));- }, [resizeTrigger, canvasContainer]);+ const rescale = () => {+ const rect = canvasContainer.getBoundingClientRect();+ if (rect.width > 0 && rect.height > 0 && rfbRef.current) {+ rfbRef.current.scaleViewport = true;+ }+ };+ rescale();+ const observer = new ResizeObserver(rescale);+ observer.observe(canvasContainer);+ return () => observer.disconnect();+ }, [canvasContainer, resizeTrigger]);// Effect to show toast when task or workflow reaches a final state based on hook updatesuseEffect(() => {diff --git a/skyvern-frontend/src/components/onboarding/CopilotCTAStep.test.tsx b/skyvern-frontend/src/components/onboarding/CopilotCTAStep.test.tsxindex 4c7775c6b..1f435d204 100644--- a/skyvern-frontend/src/components/onboarding/CopilotCTAStep.test.tsx+++ b/skyvern-frontend/src/components/onboarding/CopilotCTAStep.test.tsx@@ -10,9 +10,14 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import { MemoryRouter } from "react-router-dom";import { afterEach, describe, expect, it, vi } from "vitest";-const { mockPost, mockNavigate } = vi.hoisted(() => ({+const { mockPost, mockNavigate, studioState } = vi.hoisted(() => ({mockPost: vi.fn(),mockNavigate: vi.fn(),+ studioState: { enabled: true },+}));++vi.mock("@/hooks/useWorkflowStudioEnabled", () => ({+ useWorkflowStudioEnabled: () => studioState.enabled,}));vi.mock("react-router-dom", async (importOriginal) => {@@ -77,6 +82,7 @@ function setup(onBusyChange?: (busy: boolean) => void) {afterEach(() => {cleanup();vi.clearAllMocks();+ studioState.enabled = true;});describe("CopilotCTAStep", () => {@@ -98,7 +104,26 @@ describe("CopilotCTAStep", () => {);});- it("hands the prompt off to /build with it in location state", async () => {+ it("hands the prompt off to /edit with it in location state", async () => {+ mockPost.mockResolvedValue({+ data: { workflow_permanent_id: "wpid_x" },+ });+ setup();++ fireEvent.change(screen.getByRole("textbox"), {+ target: { value: "fill out my form" },+ });+ fireEvent.click(screen.getByRole("button", { name: "Create with AI" }));++ await waitFor(() =>+ expect(mockNavigate).toHaveBeenCalledWith("/workflows/wpid_x/studio", {+ state: { copilotMessage: "fill out my form" },+ }),+ );+ });++ it("hands the prompt off to /build when the studio preview is off", async () => {+ studioState.enabled = false;mockPost.mockResolvedValue({data: { workflow_permanent_id: "wpid_x" },});diff --git a/skyvern-frontend/src/components/onboarding/CopilotCTAStep.tsx b/skyvern-frontend/src/components/onboarding/CopilotCTAStep.tsxindex 279b6876b..c49e92a88 100644--- a/skyvern-frontend/src/components/onboarding/CopilotCTAStep.tsx+++ b/skyvern-frontend/src/components/onboarding/CopilotCTAStep.tsx@@ -18,6 +18,8 @@ import { OnboardingTelemetry } from "@/util/onboarding/OnboardingTelemetry";import { useGlobalWorkflowsQuery } from "@/routes/workflows/hooks/useGlobalWorkflowsQuery";import { useCreateWorkflowMutation } from "@/routes/workflows/hooks/useCreateWorkflowMutation";import { convert } from "@/routes/workflows/editor/workflowEditorUtils";+import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";+import { workflowEditorPath } from "@/routes/workflows/studioNavigation";import type { WorkflowApiResponse } from "@/routes/workflows/types/workflowTypes";import type { WorkflowCreateYAMLRequest } from "@/routes/workflows/types/workflowYamlTypes";import {@@ -62,6 +64,7 @@ function CopilotCTAStep({onBusyChange,}: Readonly<CopilotCTAStepProps>) {const navigate = useNavigate();+ const studioEnabled = useWorkflowStudioEnabled();const credentialGetter = useCredentialGetter();const queryClient = useQueryClient();@@ -104,9 +107,12 @@ function CopilotCTAStep({// first_workflow_created funnel event fires for copilot-first users.queryClient.invalidateQueries({ queryKey: ["userOnboarding"] });onDismiss();- navigate(`/workflows/${workflow.workflow_permanent_id}/build`, {- state: { copilotMessage: prompt },- });+ navigate(+ workflowEditorPath(workflow.workflow_permanent_id, studioEnabled),+ {+ state: { copilotMessage: prompt },+ },+ );},onError: () => {setShowFallback(true);diff --git a/skyvern-frontend/src/components/onboarding/CredentialSetupPrompt.test.tsx b/skyvern-frontend/src/components/onboarding/CredentialSetupPrompt.test.tsxindex be71fd976..13b853b0b 100644--- a/skyvern-frontend/src/components/onboarding/CredentialSetupPrompt.test.tsx+++ b/skyvern-frontend/src/components/onboarding/CredentialSetupPrompt.test.tsx@@ -10,6 +10,11 @@ vi.mock("@/util/onboarding/credentialSetupTelemetry", () => ({},}));+const { studioState } = vi.hoisted(() => ({ studioState: { enabled: true } }));+vi.mock("@/hooks/useWorkflowStudioEnabled", () => ({+ useWorkflowStudioEnabled: () => studioState.enabled,+}));+import { CredentialSetupTelemetry } from "@/util/onboarding/credentialSetupTelemetry";import { CredentialSetupPrompt } from "./CredentialSetupPrompt";@@ -27,6 +32,7 @@ function renderPrompt(blocks: Array<{ label: string }>) {afterEach(() => {cleanup();vi.clearAllMocks();+ studioState.enabled = true;});describe("CredentialSetupPrompt", () => {@@ -41,6 +47,16 @@ describe("CredentialSetupPrompt", () => {2,);+ const cta = screen.getByRole("link", {+ name: /set up credentials in the editor/i,+ });+ expect(cta.getAttribute("href")).toBe("/workflows/wpid_123/studio");+ });++ it("routes the CTA to /build when the studio preview is off", () => {+ studioState.enabled = false;+ renderPrompt([{ label: "Login" }]);+const cta = screen.getByRole("link", {name: /set up credentials in the editor/i,});diff --git a/skyvern-frontend/src/components/onboarding/CredentialSetupPrompt.tsx b/skyvern-frontend/src/components/onboarding/CredentialSetupPrompt.tsxindex d271f28b7..db5ac8ea7 100644--- a/skyvern-frontend/src/components/onboarding/CredentialSetupPrompt.tsx+++ b/skyvern-frontend/src/components/onboarding/CredentialSetupPrompt.tsx@@ -5,6 +5,8 @@ import { ExclamationTriangleIcon } from "@radix-ui/react-icons";import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";import { Button } from "@/components/ui/button";import { CredentialSetupTelemetry } from "@/util/onboarding/credentialSetupTelemetry";+import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";+import { workflowEditorPath } from "@/routes/workflows/studioNavigation";type CredentialSetupPromptProps = {workflowPermanentId: string;@@ -23,6 +25,7 @@ function CredentialSetupPrompt({blocksMissingCredentials,}: Readonly<CredentialSetupPromptProps>) {const blockCount = blocksMissingCredentials.length;+ const studioEnabled = useWorkflowStudioEnabled();const shownRef = useRef(false);useEffect(() => {@@ -51,7 +54,7 @@ function CredentialSetupPrompt({</ul><Button asChild size="sm" className="mt-3"><Link- to={`/workflows/${workflowPermanentId}/build`}+ to={workflowEditorPath(workflowPermanentId, studioEnabled)}onClick={() =>CredentialSetupTelemetry.credentialSetupCtaClicked("run_parameters",diff --git a/skyvern-frontend/src/components/onboarding/FirstRunRecoveryGuidance.test.tsx b/skyvern-frontend/src/components/onboarding/FirstRunRecoveryGuidance.test.tsxindex f453cf6b6..4b8a4a83e 100644--- a/skyvern-frontend/src/components/onboarding/FirstRunRecoveryGuidance.test.tsx+++ b/skyvern-frontend/src/components/onboarding/FirstRunRecoveryGuidance.test.tsx@@ -12,6 +12,11 @@ vi.mock("react-router-dom", async (importOriginal) => {vi.mock("posthog-js", () => ({ default: { capture: vi.fn() } }));+const { studioState } = vi.hoisted(() => ({ studioState: { enabled: true } }));+vi.mock("@/hooks/useWorkflowStudioEnabled", () => ({+ useWorkflowStudioEnabled: () => studioState.enabled,+}));+describe("getRecoveryPaths", () => {it("always returns at least two paths (AC1)", () => {for (const category of [@@ -54,6 +59,7 @@ describe("getRecoveryPaths", () => {describe("FirstRunRecoveryGuidance", () => {beforeEach(() => {vi.clearAllMocks();+ studioState.enabled = true;});afterEach(() => {cleanup();@@ -110,6 +116,19 @@ describe("FirstRunRecoveryGuidance", () => {});it("navigates to the workflow editor with the permanent id (AC2 wiring)", () => {+ const { getByTestId } = render(+ <FirstRunRecoveryGuidance+ surface="runs"+ failureCategory="element_not_found"+ workflowPermanentId="wpid_123"+ />,+ );+ fireEvent.click(getByTestId("recovery-path-edit_workflow"));+ expect(navigateMock).toHaveBeenCalledWith("/workflows/wpid_123/studio");+ });++ it("navigates to /build when the studio preview is off (AC2 wiring)", () => {+ studioState.enabled = false;const { getByTestId } = render(<FirstRunRecoveryGuidancesurface="runs"diff --git a/skyvern-frontend/src/components/onboarding/FirstRunRecoveryGuidance.tsx b/skyvern-frontend/src/components/onboarding/FirstRunRecoveryGuidance.tsxindex 7f8557b36..29c9e619b 100644--- a/skyvern-frontend/src/components/onboarding/FirstRunRecoveryGuidance.tsx+++ b/skyvern-frontend/src/components/onboarding/FirstRunRecoveryGuidance.tsx@@ -10,6 +10,8 @@ import {type RecoveryPath,type RecoveryPathId,} from "./recoveryPaths";+import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";+import { workflowEditorPath } from "@/routes/workflows/studioNavigation";const DOCS_URL = "https://docs.skyvern.com";const SUPPORT_URL = "mailto:[email protected]";@@ -28,6 +30,7 @@ function FirstRunRecoveryGuidance({onRetry,}: Props) {const navigate = useNavigate();+ const studioEnabled = useWorkflowStudioEnabled();const paths = getRecoveryPaths(failureCategory);const shownRef = useRef(false);@@ -50,7 +53,7 @@ function FirstRunRecoveryGuidance({function routeFor(id: RecoveryPathId): string {if (id === "edit_workflow") {return workflowPermanentId- ? `/workflows/${workflowPermanentId}/build`+ ? workflowEditorPath(workflowPermanentId, studioEnabled): "/workflows";}return "/credentials";diff --git a/skyvern-frontend/src/hooks/useWorkflowStudioEnabled.ts b/skyvern-frontend/src/hooks/useWorkflowStudioEnabled.tsnew file mode 100644index 000000000..8ed363946--- /dev/null+++ b/skyvern-frontend/src/hooks/useWorkflowStudioEnabled.ts@@ -0,0 +1,9 @@+import { useFeatureFlagEnabled } from "posthog-js/react";++import { WORKFLOW_STUDIO_FLAG } from "@/util/featureFlags";++// Client-side eval so the flag reflects per-user opt-in (PostHog person property),+// not the per-org server-evaluated path. Gates the whole studio redesign.+export function useWorkflowStudioEnabled(): boolean {+ return useFeatureFlagEnabled(WORKFLOW_STUDIO_FLAG) ?? false;+}diff --git a/skyvern-frontend/src/index.css b/skyvern-frontend/src/index.cssindex 9f76d965c..e753a1e1c 100644--- a/skyvern-frontend/src/index.css+++ b/skyvern-frontend/src/index.css@@ -54,6 +54,11 @@--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/router.tsx b/skyvern-frontend/src/router.tsxindex 1872c5718..859f4d105 100644--- a/skyvern-frontend/src/router.tsx+++ b/skyvern-frontend/src/router.tsx@@ -1,5 +1,10 @@import { Navigate, Outlet, createBrowserRouter } from "react-router-dom";-import { DebugToBuildRedirect } from "@/routes/workflows/DebugToBuildRedirect";+import {+ BuildRoute,+ DebugRoute,+ EditRoute,+ StudioRoute,+} from "@/routes/workflows/StudioRouteGates";import { BrowserSession } from "@/routes/browserSessions/BrowserSession";import { BrowserSessions } from "@/routes/browserSessions/BrowserSessions";import { PageLayout } from "./components/PageLayout";@@ -15,7 +20,6 @@ import { TaskDetails } from "./routes/tasks/detail/TaskDetails";import { TaskParameters } from "./routes/tasks/detail/TaskParameters";import { TaskRecording } from "./routes/tasks/detail/TaskRecording";import { TasksPage } from "./routes/tasks/list/TasksPage";-import { Debugger } from "@/routes/workflows/debugger/Debugger";import { WorkflowPage } from "./routes/workflows/WorkflowPage";import { WorkflowScriptDetailPage } from "./routes/workflows/WorkflowScriptDetailPage";import { WorkflowScriptsPage } from "./routes/workflows/WorkflowScriptsPage";@@ -23,7 +27,6 @@ import { WorkflowRun } from "./routes/workflows/WorkflowRun";import { WorkflowRunParameters } from "./routes/workflows/WorkflowRunParameters";import { Workflows } from "./routes/workflows/Workflows";import { WorkflowsPageLayout } from "./routes/workflows/WorkflowsPageLayout";-import { WorkflowEditor } from "./routes/workflows/editor/WorkflowEditor";import { WorkflowPostRunParameters } from "./routes/workflows/workflowRun/WorkflowPostRunParameters";import { WorkflowRunOutput } from "./routes/workflows/workflowRun/WorkflowRunOutput";import { WorkflowRunOverview } from "./routes/workflows/workflowRun/WorkflowRunOverview";@@ -229,23 +232,27 @@ const router = createBrowserRouter([},{path: "build",- element: <Debugger />,+ element: <BuildRoute />,},{path: ":workflowRunId/:blockLabel/build",- element: <Debugger />,+ element: <BuildRoute />,},{path: "debug",- element: <DebugToBuildRedirect />,+ element: <DebugRoute />,},{path: ":workflowRunId/:blockLabel/debug",- element: <DebugToBuildRedirect />,+ element: <DebugRoute />,},{path: "edit",- element: <WorkflowEditor />,+ element: <EditRoute />,+ },+ {+ path: "studio",+ element: <StudioRoute />,},{path: "run",diff --git a/skyvern-frontend/src/routes/browserSessions/BrowserSessionStream.tsx b/skyvern-frontend/src/routes/browserSessions/BrowserSessionStream.tsxindex fcea06d3e..6a066c992 100644--- a/skyvern-frontend/src/routes/browserSessions/BrowserSessionStream.tsx+++ b/skyvern-frontend/src/routes/browserSessions/BrowserSessionStream.tsx@@ -96,6 +96,7 @@ interface Props {interactive?: boolean;showControlButtons?: boolean;onReadyChange?: (isReady: boolean, browserSessionId: string | null) => void;+ onUrlChange?: (url: string) => void;}function BrowserSessionStream({@@ -103,6 +104,7 @@ function BrowserSessionStream({interactive = false,showControlButtons = false,onReadyChange,+ onUrlChange,}: Props) {const [streamImgSrc, setStreamImgSrc] = useState<string>("");const [streamFormat, setStreamFormat] = useState<string>("png");@@ -278,6 +280,10 @@ function BrowserSessionStream({const isReady = streamImgSrc.length > 0;+ useEffect(() => {+ onUrlChange?.(currentUrl);+ }, [currentUrl, onUrlChange]);+useEffect(() => {// browserSessionId intentionally not a dep: re-firing on prop change// before isReady resets would spuriously report (true, newSessionId).diff --git a/skyvern-frontend/src/routes/discover/WorkflowTemplates.tsx b/skyvern-frontend/src/routes/discover/WorkflowTemplates.tsxindex 8f5f5006f..4ea886ac7 100644--- a/skyvern-frontend/src/routes/discover/WorkflowTemplates.tsx+++ b/skyvern-frontend/src/routes/discover/WorkflowTemplates.tsx@@ -1,4 +1,6 @@import { Skeleton } from "@/components/ui/skeleton";+import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";+import { workflowEditorPath } from "@/routes/workflows/studioNavigation";import { useGlobalWorkflowsQuery } from "../workflows/hooks/useGlobalWorkflowsQuery";import { useNavigate } from "react-router-dom";import { WorkflowTemplateCard } from "./WorkflowTemplateCard";@@ -15,6 +17,7 @@ import {function WorkflowTemplates() {const { data: workflowTemplates, isLoading } = useGlobalWorkflowsQuery();const navigate = useNavigate();+ const studioEnabled = useWorkflowStudioEnabled();if (isLoading) {return (@@ -54,7 +57,10 @@ function WorkflowTemplates() {}onClick={() => {navigate(- `/workflows/${workflow.workflow_permanent_id}/build`,+ workflowEditorPath(+ workflow.workflow_permanent_id,+ studioEnabled,+ ),);}}/>diff --git a/skyvern-frontend/src/routes/history/RunHistory.test.tsx b/skyvern-frontend/src/routes/history/RunHistory.test.tsxindex ea267e69f..56f196a13 100644--- a/skyvern-frontend/src/routes/history/RunHistory.test.tsx+++ b/skyvern-frontend/src/routes/history/RunHistory.test.tsx@@ -39,6 +39,7 @@ vi.mock("use-debounce", () => ({vi.mock("posthog-js/react", () => ({useFeatureFlagVariantKey: () => undefined,+ useFeatureFlagEnabled: () => false,}));vi.mock("@/hooks/useRunsQuery", () => ({diff --git a/skyvern-frontend/src/routes/history/RunHistory.tsx b/skyvern-frontend/src/routes/history/RunHistory.tsxindex 3a0f71a17..d02f1c4b2 100644--- a/skyvern-frontend/src/routes/history/RunHistory.tsx+++ b/skyvern-frontend/src/routes/history/RunHistory.tsx@@ -42,6 +42,7 @@ import {TableRow,} from "@/components/ui/table";import { useRunsQuery } from "@/hooks/useRunsQuery";+import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";import {basicLocalTimeFormat,basicTimeFormat,@@ -105,9 +106,17 @@ function inferTriggerType(run: TaskRunListItem): TriggerType | null {return null;}-function getRunNavigationPath(run: TaskRunListItem): string {+function getRunNavigationPath(+ run: TaskRunListItem,+ studioEnabled: boolean,+): string {switch (run.task_run_type) {case TaskRunType.WorkflowRun:+ // With the studio on, workflow runs open in its Run tab; otherwise they+ // use the standalone run page (also the fallback when there is no wpid).+ return studioEnabled && run.workflow_permanent_id+ ? `/workflows/${run.workflow_permanent_id}/studio?wr=${run.run_id}`+ : `/runs/${run.run_id}`;case TaskRunType.TaskV2:return `/runs/${run.run_id}`;case TaskRunType.TaskV1:@@ -147,6 +156,7 @@ function RunHistory() {search: effectiveSearch,});const navigate = useNavigate();+ const studioEnabled = useWorkflowStudioEnabled();const { data: rawNextPageRuns } = useRunsQuery({page: page + 1,@@ -239,7 +249,7 @@ function RunHistory() {);const isWorkflowRun = run.task_run_type === TaskRunType.WorkflowRun;const isExpanded = isWorkflowRun && expandedRows.has(run.run_id);- const navPath = getRunNavigationPath(run);+ const navPath = getRunNavigationPath(run, studioEnabled);const triggerType = inferTriggerType(run);const titleContent =diff --git a/skyvern-frontend/src/routes/root/useSidebarHidden.ts b/skyvern-frontend/src/routes/root/useSidebarHidden.tsindex 9b86e3db9..1c5af286d 100644--- a/skyvern-frontend/src/routes/root/useSidebarHidden.ts+++ b/skyvern-frontend/src/routes/root/useSidebarHidden.ts@@ -8,6 +8,9 @@ function useSidebarHidden({ hideBrowserSessions = false }: Options = {}) {const [searchParams] = useSearchParams();const embed = searchParams.get("embed");const workflowEditMatch = useMatch("/workflows/:workflowPermanentId/edit");+ const workflowStudioMatch = useMatch(+ "/workflows/:workflowPermanentId/studio",+ );const workflowBuildMatch = useMatch("/workflows/:workflowPermanentId/build");const workflowBlockBuildMatch = useMatch("/workflows/:workflowPermanentId/:workflowRunId/:blockLabel/build",@@ -23,6 +26,7 @@ function useSidebarHidden({ hideBrowserSessions = false }: Options = {}) {return Boolean(workflowEditMatch ||+ workflowStudioMatch ||workflowBuildMatch ||workflowBlockBuildMatch ||workflowDebugMatch ||diff --git a/skyvern-frontend/src/routes/streaming/InteractiveStreamView.tsx b/skyvern-frontend/src/routes/streaming/InteractiveStreamView.tsxindex b99bf31eb..426ca3a77 100644--- a/skyvern-frontend/src/routes/streaming/InteractiveStreamView.tsx+++ b/skyvern-frontend/src/routes/streaming/InteractiveStreamView.tsx@@ -21,6 +21,7 @@ interface InteractiveStreamViewProps {handleKeyUp: (e: React.KeyboardEvent) => void;};currentUrl?: string;+ centered?: boolean;}function UrlBar({ url }: { url: string }) {@@ -43,6 +44,7 @@ function InteractiveStreamView({showControlButtons,handlers,currentUrl,+ centered,}: InteractiveStreamViewProps) {const imgDataUrl = `data:image/${streamFormat};base64,${streamImgSrc}`;@@ -88,6 +90,23 @@ function InteractiveStreamView({);}+ // Plain img (not ZoomableImage) so h-full resolves here; ZoomableImage's bare+ // auto-height wrapper collapses the height and pins the frame to the top.+ if (centered) {+ return (+ <div className="flex h-full w-full flex-col">+ {currentUrl && <UrlBar url={currentUrl} />}+ <img+ src={imgDataUrl}+ className={cn(+ "min-h-0 w-full flex-1 object-contain",+ currentUrl ? "rounded-b-md" : "rounded-md",+ )}+ />+ </div>+ );+ }+return (<div className="h-full w-full">{currentUrl && <UrlBar url={currentUrl} />}diff --git a/skyvern-frontend/src/routes/tasks/create/PromptBox.tsx b/skyvern-frontend/src/routes/tasks/create/PromptBox.tsxindex 8bbd27e64..b2d367a08 100644--- a/skyvern-frontend/src/routes/tasks/create/PromptBox.tsx+++ b/skyvern-frontend/src/routes/tasks/create/PromptBox.tsx@@ -44,6 +44,8 @@ import { ImprovePrompt } from "@/components/ImprovePrompt";import { SpeechInputButton } from "@/components/SpeechInputButton";import { cn } from "@/util/utils";import { useSpeechToTextField } from "@/hooks/useSpeechToTextField";+import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";+import { workflowEditorPath } from "@/routes/workflows/studioNavigation";const exampleCases = [{@@ -139,6 +141,7 @@ function buildBlankWorkflowRequest(function PromptBox({ enableCopilotHandoff = false }: PromptBoxProps) {const navigate = useNavigate();+ const studioEnabled = useWorkflowStudioEnabled();const [prompt, setPrompt] = useState<string>("");const credentialGetter = useCredentialGetter();const queryClient = useQueryClient();@@ -235,7 +238,9 @@ function PromptBox({ enableCopilotHandoff = false }: PromptBoxProps) {setAutoplay(workflow.workflow_permanent_id, firstBlock.label);}- navigate(`/workflows/${workflow.workflow_permanent_id}/build`);+ navigate(+ workflowEditorPath(workflow.workflow_permanent_id, studioEnabled),+ );},onError: (error: AxiosError) => {toast({@@ -275,9 +280,12 @@ function PromptBox({ enableCopilotHandoff = false }: PromptBoxProps) {onSuccess: ({ data: workflow, prompt }) => {queryClient.invalidateQueries({ queryKey: ["workflows"] });queryClient.invalidateQueries({ queryKey: ["folders"] });- navigate(`/workflows/${workflow.workflow_permanent_id}/build`, {- state: { copilotMessage: prompt },- });+ navigate(+ workflowEditorPath(workflow.workflow_permanent_id, studioEnabled),+ {+ state: { copilotMessage: prompt },+ },+ );},onError: (error: AxiosError) => {toast({diff --git a/skyvern-frontend/src/routes/workflows/LegacyBuildRedirect.tsx b/skyvern-frontend/src/routes/workflows/LegacyBuildRedirect.tsxnew file mode 100644index 000000000..8a1274372--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/LegacyBuildRedirect.tsx@@ -0,0 +1,25 @@+import { Navigate, useLocation, useParams } from "react-router-dom";++/**+ * Legacy /build and /debug URLs land on /studio; block-run URLs carry the run+ * as ?wr=&bl= so the Run tab opens in block mode.+ */+function LegacyBuildRedirect() {+ const { workflowPermanentId, workflowRunId, blockLabel } = useParams();+ const location = useLocation();+ // Block-run URLs carry the run as ?wr=&bl=; plain /build keeps its own search+ // (e.g. ?via= onboarding telemetry) rather than dropping it.+ const query =+ workflowRunId && blockLabel+ ? `?wr=${workflowRunId}&bl=${encodeURIComponent(blockLabel)}`+ : location.search;+ return (+ <Navigate+ to={`/workflows/${workflowPermanentId}/studio${query}`}+ state={location.state}+ replace+ />+ );+}++export { LegacyBuildRedirect };diff --git a/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx b/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsxindex 11e094dab..41c547c04 100644--- a/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx+++ b/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx@@ -46,6 +46,9 @@ import { useCredentialGetter } from "@/hooks/useCredentialGetter";import { useBlockScriptsQuery } from "@/routes/workflows/hooks/useBlockScriptsQuery";import { constructCacheKeyValueFromParameters } from "@/routes/workflows/editor/utils";import { useWorkflowQuery } from "@/routes/workflows/hooks/useWorkflowQuery";+import { useStudioShellStore } from "@/store/StudioShellStore";+import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";+import { workflowEditorPath } from "./studioNavigation";import { CredentialSetupPrompt } from "@/components/onboarding/CredentialSetupPrompt";import { useFeatureFlagVariantKey } from "posthog-js/react";import { EXPERIMENT } from "@/util/onboarding/experimentConfig";@@ -322,6 +325,7 @@ function RunWorkflowForm({const { workflowPermanentId } = useParams();const credentialGetter = useCredentialGetter();const navigate = useNavigate();+ const studioEnabled = useWorkflowStudioEnabled();const queryClient = useQueryClient();const apiCredential = useApiCredential();const { data: workflow } = useWorkflowQuery({ workflowPermanentId });@@ -399,11 +403,19 @@ function RunWorkflowForm({queryClient.invalidateQueries({queryKey: ["runs"],});- navigate(- env.useNewRunsUrl- ? `/runs/${response.data.workflow_run_id}`- : `/workflows/${workflowPermanentId}/${response.data.workflow_run_id}/overview`,- );+ if (studioEnabled) {+ // Land in the studio shell with the Run tab live.+ useStudioShellStore.getState().setTab("run");+ navigate(+ `/workflows/${workflowPermanentId}/studio?wr=${response.data.workflow_run_id}`,+ );+ } else {+ navigate(+ env.useNewRunsUrl+ ? `/runs/${response.data.workflow_run_id}`+ : `/workflows/${workflowPermanentId}/${response.data.workflow_run_id}/overview`,+ );+ }},onError: (error: AxiosError) => {const detail = (error.response?.data as { detail?: string })?.detail;@@ -658,7 +670,7 @@ function RunWorkflowForm({</ul><p className="mt-2"><Link- to={`/workflows/${workflowPermanentId}/build`}+ to={workflowEditorPath(workflowPermanentId, studioEnabled)}className="underline hover:no-underline">Go to the editordiff --git a/skyvern-frontend/src/routes/workflows/StudioRouteGates.tsx b/skyvern-frontend/src/routes/workflows/StudioRouteGates.tsxnew file mode 100644index 000000000..12b7088f2--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/StudioRouteGates.tsx@@ -0,0 +1,66 @@+import { Navigate, useLocation, useParams } from "react-router-dom";++import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";++import { DebugToBuildRedirect } from "./DebugToBuildRedirect";+import { LegacyBuildRedirect } from "./LegacyBuildRedirect";+import { Debugger } from "./debugger/Debugger";+import { WorkflowEditor } from "./editor/WorkflowEditor";++/**+ * /build (and block-build) routes. With the studio preview on, these redirect+ * into the editor; off, they render the legacy Debugger.+ */+export function BuildRoute() {+ const studioEnabled = useWorkflowStudioEnabled();+ return studioEnabled ? <LegacyBuildRedirect /> : <Debugger />;+}++/**+ * /debug (and block-debug) routes. With the studio preview on, these redirect+ * into the editor; off, they fall back to the legacy debug→build redirect.+ */+export function DebugRoute() {+ const studioEnabled = useWorkflowStudioEnabled();+ return studioEnabled ? <LegacyBuildRedirect /> : <DebugToBuildRedirect />;+}++/**+ * /studio — the studio shell when the preview is on; off, bounce to the legacy+ * /edit editor so a shared studio link never strands a non-flagged user.+ */+export function StudioRoute() {+ const studioEnabled = useWorkflowStudioEnabled();+ const { workflowPermanentId } = useParams();+ const location = useLocation();+ if (studioEnabled) {+ return <WorkflowEditor />;+ }+ return (+ <Navigate+ to={`/workflows/${workflowPermanentId}/edit${location.search}`}+ state={location.state}+ replace+ />+ );+}++/**+ * /edit — the legacy editor when the preview is off; on, the studio lives at+ * /studio, so redirect there (preserving query + state) for old links.+ */+export function EditRoute() {+ const studioEnabled = useWorkflowStudioEnabled();+ const { workflowPermanentId } = useParams();+ const location = useLocation();+ if (studioEnabled) {+ return (+ <Navigate+ to={`/workflows/${workflowPermanentId}/studio${location.search}`}+ state={location.state}+ replace+ />+ );+ }+ return <WorkflowEditor />;+}diff --git a/skyvern-frontend/src/routes/workflows/WorkflowPage.tsx b/skyvern-frontend/src/routes/workflows/WorkflowPage.tsxindex 9ec0b7f41..7ae43c0fb 100644--- a/skyvern-frontend/src/routes/workflows/WorkflowPage.tsx+++ b/skyvern-frontend/src/routes/workflows/WorkflowPage.tsx@@ -65,11 +65,12 @@ import {TooltipTrigger,} from "@/components/ui/tooltip";import { RunParametersDialog } from "./workflowRun/RunParametersDialog";-import * as env from "@/util/env";import { getClient } from "@/api/AxiosClient";import { useQuery } from "@tanstack/react-query";import { useCredentialGetter } from "@/hooks/useCredentialGetter";import { useGlobalWorkflowsQuery } from "./hooks/useGlobalWorkflowsQuery";+import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";+import { legacyRunDetailPath, workflowEditorPath } from "./studioNavigation";import { TableSearchInput } from "@/components/TableSearchInput";import { useKeywordSearch } from "./hooks/useKeywordSearch";import { useParameterExpansion } from "./hooks/useParameterExpansion";@@ -102,6 +103,7 @@ function WorkflowPage() {const page = searchParams.get("page") ? Number(searchParams.get("page")) : 1;const [statusFilters, setStatusFilters] = useState<Array<Status>>([]);const navigate = useNavigate();+ const studioEnabled = useWorkflowStudioEnabled();const PAGE_SIZE_OPTIONS = ["10", "25", "50"];const pageSize = Number(searchParams.get("page_size") || "10");@@ -209,7 +211,7 @@ function WorkflowPage() {</Button><Button asChild variant="secondary"><Link- to={`/workflows/${workflowPermanentId}/build`}+ to={workflowEditorPath(workflowPermanentId, studioEnabled)}data-testid="workflow-open-editor-link"><Pencil2Icon className="mr-2 size-4" />@@ -319,9 +321,12 @@ function WorkflowPage() {{/* Main run row */}<TableRowonClick={(event) => {- const url = env.useNewRunsUrl- ? `/runs/${workflowRun.workflow_run_id}`- : `/workflows/${workflowPermanentId}/${workflowRun.workflow_run_id}/overview`;+ const url = studioEnabled+ ? `/workflows/${workflowPermanentId}/studio?wr=${workflowRun.workflow_run_id}`+ : legacyRunDetailPath(+ workflowPermanentId,+ workflowRun.workflow_run_id,+ );if (event.ctrlKey || event.metaKey) {window.open(diff --git a/skyvern-frontend/src/routes/workflows/WorkflowRun.tsx b/skyvern-frontend/src/routes/workflows/WorkflowRun.tsxindex ffd1c6507..df3cf0b47 100644--- a/skyvern-frontend/src/routes/workflows/WorkflowRun.tsx+++ b/skyvern-frontend/src/routes/workflows/WorkflowRun.tsx@@ -34,7 +34,13 @@ import {ReloadIcon,} from "@radix-ui/react-icons";import { useMutation, useQueryClient } from "@tanstack/react-query";-import { Link, Outlet, useNavigate, useSearchParams } from "react-router-dom";+import {+ Link,+ Navigate,+ Outlet,+ useNavigate,+ useSearchParams,+} from "react-router-dom";import {statusIsAFailureType,statusIsCancellable,@@ -68,6 +74,8 @@ import { ScriptUpdateCard } from "@/routes/workflows/workflowRun/ScriptUpdateCarimport { useFallbackEpisodesQuery } from "@/routes/workflows/hooks/useFallbackEpisodesQuery";import { useRunsQuery } from "@/hooks/useRunsQuery";import { useOnboardingStateOptional } from "@/store/onboarding/useOnboardingState";+import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";+import { workflowEditorPath } from "@/routes/workflows/studioNavigation";import { FirstRunRecoveryGuidance } from "@/components/onboarding/FirstRunRecoveryGuidance";import { useFeatureFlagVariantKey } from "posthog-js/react";import { EXPERIMENT } from "@/util/onboarding/experimentConfig";@@ -147,6 +155,7 @@ function WorkflowRun() {const apiCredential = useApiCredential();const queryClient = useQueryClient();const navigate = useNavigate();+ const studioEnabled = useWorkflowStudioEnabled();const onboarding = useOnboardingStateOptional();const {@@ -520,6 +529,25 @@ function WorkflowRun() {return <Status404 />;}+ // With the preview on, route legacy run links into the studio Run tab+ // (preserving the selected item); flag-off keeps this legacy run view.+ if (studioEnabled && !isEmbedded && workflowRunId && workflowPermanentId) {+ const studioParams = new URLSearchParams();+ studioParams.set("wr", workflowRunId);+ if (active) {+ studioParams.set("active", active);+ }+ if (iterationParam) {+ studioParams.set("iteration", iterationParam);+ }+ return (+ <Navigate+ to={`/workflows/${workflowPermanentId}/studio?${studioParams.toString()}`}+ replace+ />+ );+ }+return (<div className="space-y-8">{!isEmbedded && (@@ -626,7 +654,10 @@ function WorkflowRun() {/><Button asChild variant="secondary"><Link- to={`/workflows/${workflowPermanentId}/build`}+ to={workflowEditorPath(+ workflowPermanentId ?? "",+ studioEnabled,+ )}data-testid="workflow-open-editor-link"><Pencil2Icon className="mr-2 h-4 w-4" />diff --git a/skyvern-frontend/src/routes/workflows/WorkflowScriptsPage.tsx b/skyvern-frontend/src/routes/workflows/WorkflowScriptsPage.tsxindex 8fe76ce94..b518cd163 100644--- a/skyvern-frontend/src/routes/workflows/WorkflowScriptsPage.tsx+++ b/skyvern-frontend/src/routes/workflows/WorkflowScriptsPage.tsx@@ -43,6 +43,8 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";import { type AxiosError } from "axios";import { Fragment, useState } from "react";import { Link, useNavigate, useParams } from "react-router-dom";+import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";+import { workflowEditorPath } from "./studioNavigation";import { usePinScriptMutation } from "./hooks/usePinScriptMutation";import { useScriptVersionsQuery } from "./hooks/useScriptVersionsQuery";import { useWorkflowQuery } from "./hooks/useWorkflowQuery";@@ -479,6 +481,7 @@ function ScriptRow({function WorkflowScriptsPage() {const { workflowPermanentId } = useParams();const navigate = useNavigate();+ const studioEnabled = useWorkflowStudioEnabled();const { data: workflow, isLoading: workflowIsLoading } = useWorkflowQuery({workflowPermanentId,@@ -529,7 +532,9 @@ function WorkflowScriptsPage() {/>)}<Button asChild variant="secondary">- <Link to={`/workflows/${workflowPermanentId}/build`}>+ <Link+ to={workflowEditorPath(workflowPermanentId ?? "", studioEnabled)}+ ><Pencil2Icon className="mr-2 size-4" />Edit</Link>diff --git a/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx b/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsxindex f17a4ba50..e1f91c13f 100644--- a/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx+++ b/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx@@ -70,6 +70,9 @@ import React, {useState,} from "react";import { Link, useNavigate, useSearchParams } from "react-router-dom";++import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";+import { workflowEditorPath } from "./studioNavigation";import { useDebounce } from "use-debounce";import {DropdownMenu,@@ -156,6 +159,7 @@ function WorkflowsFlat() {const credentialGetter = useCredentialGetter();const queryClient = useQueryClient();const navigate = useNavigate();+ const studioEnabled = useWorkflowStudioEnabled();const createWorkflowMutation = useCreateWorkflowMutation();const [searchParams, setSearchParams] = useSearchParams();const [search, setSearch] = useState("");@@ -1129,7 +1133,10 @@ function WorkflowsFlat() {onClick={(event) => {handleIconClick(event,- `/workflows/${workflow.workflow_permanent_id}/build`,+ workflowEditorPath(+ workflow.workflow_permanent_id,+ studioEnabled,+ ),);}}>diff --git a/skyvern-frontend/src/routes/workflows/WorkflowsPageLayout.tsx b/skyvern-frontend/src/routes/workflows/WorkflowsPageLayout.tsxindex ea9dfb694..7ba5cc720 100644--- a/skyvern-frontend/src/routes/workflows/WorkflowsPageLayout.tsx+++ b/skyvern-frontend/src/routes/workflows/WorkflowsPageLayout.tsx@@ -5,6 +5,9 @@ function WorkflowsPageLayout() {const [searchParams] = useSearchParams();const embed = searchParams.get("embed");const workflowEditMatch = useMatch("/workflows/:workflowPermanentId/edit");+ const workflowStudioMatch = useMatch(+ "/workflows/:workflowPermanentId/studio",+ );const workflowBuildMatch = useMatch("/workflows/:workflowPermanentId/build");const workflowBlockBuildMatch = useMatch("/workflows/:workflowPermanentId/:workflowRunId/:blockLabel/build",@@ -15,6 +18,7 @@ function WorkflowsPageLayout() {);const match =workflowEditMatch ||+ workflowStudioMatch ||workflowBuildMatch ||workflowBlockBuildMatch ||workflowDebugMatch ||diff --git a/skyvern-frontend/src/routes/workflows/components/tree/WorkflowRow.tsx b/skyvern-frontend/src/routes/workflows/components/tree/WorkflowRow.tsxindex 186f78bd8..9296a5b3b 100644--- a/skyvern-frontend/src/routes/workflows/components/tree/WorkflowRow.tsx+++ b/skyvern-frontend/src/routes/workflows/components/tree/WorkflowRow.tsx@@ -19,6 +19,8 @@ import {import { basicTimeFormat, compactLocalDateTime } from "@/util/timeFormat";import { WorkflowApiResponse } from "../../types/workflowTypes";import { WorkflowActions } from "../../WorkflowActions";+import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";+import { workflowEditorPath } from "../../studioNavigation";import { HighlightText } from "../HighlightText";import { ParameterDisplayInline } from "../ParameterDisplayInline";import { TagChipList } from "../tagging/TagChipList";@@ -68,6 +70,7 @@ function WorkflowRow({ workflow, depth = 0 }: WorkflowRowProps) {handleRowClick,handleIconClick,} = useWorkflowsListContext();+ const studioEnabled = useWorkflowStudioEnabled();const parameterItems = (workflow.workflow_definition?.parameters ?? []).filter((p) => p.parameter_type !== "output")@@ -262,7 +265,10 @@ function WorkflowRow({ workflow, depth = 0 }: WorkflowRowProps) {onClick={(event) => {handleIconClick(event,- `/workflows/${workflow.workflow_permanent_id}/build`,+ workflowEditorPath(+ workflow.workflow_permanent_id,+ studioEnabled,+ ),);}}>diff --git a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsxindex 43f4bf41a..f6347340e 100644--- a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx+++ b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx@@ -14,8 +14,10 @@ import {ReloadIcon,Cross2Icon,ChevronDownIcon,+ ChevronRightIcon,CheckIcon,} from "@radix-ui/react-icons";+import { createPortal } from "react-dom";import { stringify as convertToYAML } from "yaml";import { useWorkflowHasChangesStore } from "@/store/WorkflowHasChangesStore";import { useCopilotActionStore } from "@/store/useCopilotActionStore";@@ -55,6 +57,8 @@ import {} from "./sendQueue";import { shouldAutoApplyWorkflowResponse } from "./proposalDisposition";import { NarrativeView } from "./NarrativeView";+import { DiffCard, shouldShowDiffCard } from "./cards/DiffCard";+import { FixCard, shouldShowFixCard } from "./cards/FixCard";import {EMPTY_NARRATIVE,NarrativeEvent,@@ -336,6 +340,13 @@ interface WorkflowCopilotChatProps {isLiveBrowserReady?: boolean;initialMessage?: string;onInitialMessageConsumed?: () => void;+ // Render as a docked panel (no float/drag/resize) instead of a floating window.+ docked?: boolean;+ // Collapse the docked panel to a rail. Only used when `docked`.+ onCollapse?: () => void;+ // When docked, render into this element via a portal (keeps the component in+ // its parent's React tree so canvas callbacks stay wired) instead of inline.+ portalTarget?: HTMLElement | null;}// Snap-back state keyed by turn_id so rapid resubmits don't clobber a prior@@ -404,6 +415,9 @@ export function WorkflowCopilotChat({isLiveBrowserReady = false,initialMessage,onInitialMessageConsumed,+ docked = false,+ onCollapse,+ portalTarget,}: WorkflowCopilotChatProps = {}) {const copilotV2Flag = useFeatureFlag("ENABLE_WORKFLOW_COPILOT_V2");const codeBlockModeFlag = useFeatureFlag("WORKFLOW_COPILOT_CODE_BLOCK_MODE");@@ -1970,24 +1984,42 @@ export function WorkflowCopilotChat({: "Listening…": browserStatusText;- return (+ const content = (<div- className="fixed z-50 flex flex-col rounded-lg border border-border bg-slate-elevation1 text-foreground shadow-2xl"- style={{- left: `${position.x}px`,- top: `${position.y}px`,- width: `${size.width}px`,- height: `${size.height}px`,- }}+ className={+ docked+ ? "relative flex h-full w-full flex-col overflow-hidden rounded-lg border border-border bg-slate-elevation1 text-foreground"+ : "fixed z-50 flex flex-col rounded-lg border border-border bg-slate-elevation1 text-foreground shadow-2xl"+ }+ style={+ docked+ ? undefined+ : {+ left: `${position.x}px`,+ top: `${position.y}px`,+ width: `${size.width}px`,+ height: `${size.height}px`,+ }+ }>{/* Header */}<div- className="flex cursor-move items-center justify-between border-b border-border px-4 py-2"- onMouseDown={handleMouseDown}+ className={+ "flex items-center justify-between border-b border-border px-4" ++ (docked ? " h-14 shrink-0" : " cursor-move py-2")+ }+ onMouseDown={docked ? undefined : handleMouseDown}>- <h3 className="text-sm font-semibold text-foreground">- Agent Copilot (Beta)- </h3>+ <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"><WorkflowCopilotHistoryworkflowPermanentId={workflowPermanentId}@@ -2005,15 +2037,28 @@ export function WorkflowCopilotChat({</button><div className="h-2 w-2 rounded-full bg-emerald-500"></div><span className="text-xs text-muted-foreground">Active</span>- <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>+ {docked ? (+ onCollapse ? (+ <button+ type="button"+ onClick={onCollapse}+ className="ml-2 rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground"+ title="Collapse Copilot"+ >+ <ChevronRightIcon className="h-4 w-4" />+ </button>+ ) : 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>@@ -2100,6 +2145,21 @@ export function WorkflowCopilotChat({</button></div>) : null}+ {docked && shouldShowDiffCard(message.narrative) ? (+ <DiffCard turn={message.narrative} />+ ) : null}+ {docked &&+ isLastMessage &&+ shouldShowFixCard(message.narrative) ? (+ <FixCard+ turn={message.narrative}+ onFix={() =>+ handleSend(+ "The last run failed — diagnose the failure and fix it, then re-run.",+ )+ }+ />+ ) : null}</div>);}@@ -2397,48 +2457,57 @@ export function WorkflowCopilotChat({</div>{/* Resize Handles */}- {/* Corners */}- <div- className="absolute bottom-0 right-0 z-10 h-3 w-3 cursor-nwse-resize"- onMouseDown={(e) => handleResizeMouseDown(e, "se")}- title="Resize"- />- <div- className="absolute bottom-0 left-0 z-10 h-3 w-3 cursor-nesw-resize"- onMouseDown={(e) => handleResizeMouseDown(e, "sw")}- title="Resize"- />- <div- className="absolute right-0 top-0 z-10 h-3 w-3 cursor-nesw-resize"- onMouseDown={(e) => handleResizeMouseDown(e, "ne")}- title="Resize"- />- <div- className="absolute left-0 top-0 z-10 h-3 w-3 cursor-nwse-resize"- onMouseDown={(e) => handleResizeMouseDown(e, "nw")}- title="Resize"- />- {/* Edges */}- <div- className="absolute left-3 right-3 top-0 z-10 h-1 cursor-ns-resize"- onMouseDown={(e) => handleResizeMouseDown(e, "n")}- title="Resize"- />- <div- className="absolute bottom-0 left-3 right-3 z-10 h-1 cursor-ns-resize"- onMouseDown={(e) => handleResizeMouseDown(e, "s")}- title="Resize"- />- <div- className="absolute bottom-3 left-0 top-3 z-10 w-1 cursor-ew-resize"- onMouseDown={(e) => handleResizeMouseDown(e, "w")}- title="Resize"- />- <div- className="absolute bottom-3 right-0 top-3 z-10 w-1 cursor-ew-resize"- onMouseDown={(e) => handleResizeMouseDown(e, "e")}- title="Resize"- />+ {!docked && (+ <>+ {/* Corners */}+ <div+ className="absolute bottom-0 right-0 z-10 h-3 w-3 cursor-nwse-resize"+ onMouseDown={(e) => handleResizeMouseDown(e, "se")}+ title="Resize"+ />+ <div+ className="absolute bottom-0 left-0 z-10 h-3 w-3 cursor-nesw-resize"+ onMouseDown={(e) => handleResizeMouseDown(e, "sw")}+ title="Resize"+ />+ <div+ className="absolute right-0 top-0 z-10 h-3 w-3 cursor-nesw-resize"+ onMouseDown={(e) => handleResizeMouseDown(e, "ne")}+ title="Resize"+ />+ <div+ className="absolute left-0 top-0 z-10 h-3 w-3 cursor-nwse-resize"+ onMouseDown={(e) => handleResizeMouseDown(e, "nw")}+ title="Resize"+ />+ {/* Edges */}+ <div+ className="absolute left-3 right-3 top-0 z-10 h-1 cursor-ns-resize"+ onMouseDown={(e) => handleResizeMouseDown(e, "n")}+ title="Resize"+ />+ <div+ className="absolute bottom-0 left-3 right-3 z-10 h-1 cursor-ns-resize"+ onMouseDown={(e) => handleResizeMouseDown(e, "s")}+ title="Resize"+ />+ <div+ className="absolute bottom-3 left-0 top-3 z-10 w-1 cursor-ew-resize"+ onMouseDown={(e) => handleResizeMouseDown(e, "w")}+ title="Resize"+ />+ <div+ className="absolute bottom-3 right-0 top-3 z-10 w-1 cursor-ew-resize"+ onMouseDown={(e) => handleResizeMouseDown(e, "e")}+ title="Resize"+ />+ </>+ )}</div>);++ if (docked) {+ return portalTarget ? createPortal(content, portalTarget) : null;+ }+ return content;}diff --git a/skyvern-frontend/src/routes/workflows/copilot/cards/DiffCard.tsx b/skyvern-frontend/src/routes/workflows/copilot/cards/DiffCard.tsxnew file mode 100644index 000000000..c314c40a2--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/copilot/cards/DiffCard.tsx@@ -0,0 +1,60 @@+import { MagicWandIcon } from "@radix-ui/react-icons";++import { TurnNarrativeState } from "../narrativeState";++// eslint-disable-next-line react-refresh/only-export-components+export function shouldShowDiffCard(turn: TurnNarrativeState): boolean {+ if (!turn.draft) {+ return false;+ }+ if (turn.proposalDisposition === "no_proposal") {+ return false;+ }+ return turn.draft.blockLabels.length > 0;+}++export function DiffCard({ turn }: { turn: TurnNarrativeState }) {+ const draft = turn.draft;+ if (!draft) {+ return null;+ }+ const priorLabels = new Set(+ turn.blocks.filter((b) => b.state === "drafted").map((b) => b.label),+ );+ const removed = [...priorLabels].filter(+ (label) => !draft.blockLabels.includes(label),+ );++ 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">+ <MagicWandIcon className="h-3.5 w-3.5" />+ {draft.summary ?? "Proposed changes"}+ </div>+ {draft.blockLabels.length > 0 ? (+ <div className="mt-2">+ <div className="text-[10px] font-bold uppercase tracking-wide text-success">+ Added+ </div>+ {draft.blockLabels.map((label) => (+ <div key={label} className="ml-2 text-xs text-foreground">+ + {label}+ </div>+ ))}+ </div>+ ) : null}+ {removed.length > 0 ? (+ <div className="mt-2">+ <div className="text-[10px] font-bold uppercase tracking-wide text-destructive">+ Removed+ </div>+ {removed.map((label) => (+ <div key={label} className="ml-2 text-xs text-foreground">+ - {label}+ </div>+ ))}+ </div>+ ) : null}+ </div>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/copilot/cards/FixCard.tsx b/skyvern-frontend/src/routes/workflows/copilot/cards/FixCard.tsxnew file mode 100644index 000000000..9a79d81bd--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/copilot/cards/FixCard.tsx@@ -0,0 +1,66 @@+import { ExclamationTriangleIcon } from "@radix-ui/react-icons";++import { TurnNarrativeState } from "../narrativeState";++// eslint-disable-next-line react-refresh/only-export-components+export function shouldShowFixCard(turn: TurnNarrativeState): boolean {+ return (+ turn.terminal === "error" || turn.blocks.some((b) => b.state === "failed")+ );+}++function failedBlockError(turn: TurnNarrativeState): string | null {+ const failed = turn.blocks.find((b) => b.state === "failed");+ if (!failed) {+ return null;+ }+ const lastResult = [...failed.activity]+ .reverse()+ .find((e) => e.kind === "tool_result");+ return (+ lastResult?.text ??+ failed.activity[failed.activity.length - 1]?.text ??+ null+ );+}++type FixCardProps = {+ turn: TurnNarrativeState;+ onFix: () => void;+ onExplain?: () => void;+};++export function FixCard({ turn, onFix, onExplain }: FixCardProps) {+ const headline =+ turn.terminalMessage ??+ failedBlockError(turn) ??+ "The last run hit an error.";++ return (+ <div className="rounded-lg border border-destructive/40 bg-destructive/10 p-3">+ <div className="flex items-center gap-2 text-sm font-semibold text-foreground">+ <ExclamationTriangleIcon className="h-4 w-4 text-destructive" />+ Run failed — here's a fix+ </div>+ <p className="mt-1 text-xs text-muted-foreground">{headline}</p>+ <div className="mt-2 flex flex-wrap gap-2">+ <button+ type="button"+ onClick={onFix}+ className="rounded-md bg-studio-accent px-3 py-1 text-xs font-medium text-studio-accent-foreground hover:bg-studio-accent/90"+ >+ Fix with Copilot+ </button>+ {onExplain ? (+ <button+ type="button"+ onClick={onExplain}+ className="rounded-md border border-border px-3 py-1 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground"+ >+ Explain+ </button>+ ) : null}+ </div>+ </div>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx b/skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsxindex a72991416..ef3b64393 100644--- a/skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx+++ b/skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx@@ -48,7 +48,14 @@ import {} from "@xyflow/react";import "@xyflow/react/dist/style.css";import { nanoid } from "nanoid";-import { useCallback, useEffect, useMemo, useRef, useState } from "react";+import {+ useCallback,+ useEffect,+ useLayoutEffect,+ useMemo,+ useRef,+ useState,+} from "react";import { useDebouncedCallback } from "use-debounce";import { useBlocker, useParams } from "react-router-dom";import {@@ -381,6 +388,9 @@ type Props = {onLayoutPhaseChange?: (phase: "pre-layout" | "initial-load" | "ready",) => void;+ // Width of a left-side panel (the studio Copilot column) the canvas sits right+ // of; the chain shifts left by half of it to read as page-centered, not pane.+ centerOffsetX?: number;};function FlowRenderer({@@ -404,6 +414,7 @@ function FlowRenderer({captureHistoryImmediately,onAddNode,onLayoutPhaseChange,+ centerOffsetX = 0,}: Props) {const { blockLabel: targettedBlockLabel } = useParams();const reactFlowInstance = useReactFlow();@@ -459,13 +470,25 @@ function FlowRenderer({maxZoom: options?.maxZoom ?? 1,duration,});+ // fitView centers on the editor pane (right of the Copilot panel); once it+ // settles, nudge left by half the panel so it reads as page-centered.+ if (centerOffsetX > 0) {+ window.setTimeout(() => {+ const vp = reactFlowInstance.getViewport();+ reactFlowInstance.setViewport({+ x: vp.x - centerOffsetX / 2,+ y: vp.y,+ zoom: vp.zoom,+ });+ }, duration + 10);+ }// Small safety buffer so a frame near the tail of the animation cannot// re-enter `constrainPan` before the final viewport lands.window.setTimeout(() => {fitViewInProgressRef.current = false;}, duration + 50);},- [reactFlowInstance],+ [reactFlowInstance, centerOffsetX],);// Keep a ref so the keyboard handler can pick up the latest closure without@@ -474,6 +497,23 @@ function FlowRenderer({const runFitViewRef = useRef(runFitView);runFitViewRef.current = runFitView;+ // React Flow's viewport is in canvas coords, so a Copilot collapse/expand would+ // jump the chain by the width delta — counter-translate to keep blocks put.+ const prevCenterOffsetRef = useRef(centerOffsetX);+ useLayoutEffect(() => {+ const delta = centerOffsetX - prevCenterOffsetRef.current;+ prevCenterOffsetRef.current = centerOffsetX;+ if (delta === 0) {+ return;+ }+ const viewport = reactFlowInstance.getViewport();+ reactFlowInstance.setViewport({+ x: viewport.x - delta,+ y: viewport.y,+ zoom: viewport.zoom,+ });+ }, [centerOffsetX, reactFlowInstance]);+// Canvas zoom + fit-view keyboard shortcuts. Gated to non-read-only// canvases for the same reason as the Escape handler above. Skip when// the user is typing in any text field so Cmd+- in a textarea still@@ -1488,6 +1528,42 @@ function FlowRenderer({// eslint-disable-next-line react-hooks/exhaustive-deps}, [historyApplyTrigger]);+ // Fit once, when first visible (non-zero) and measured — a hidden mount fits at+ // zero size; once-only so returning to the editor preserves the user's pan/zoom.+ const hasInitialFitRef = useRef(false);+ useEffect(() => {+ // Studio-only: the legacy canvas keeps React Flow's own mount fit and must+ // not be auto-fit here. centerOffsetX is > 0 only in the studio shell.+ if (centerOffsetX <= 0) {+ return;+ }+ if (hasInitialFitRef.current) {+ return;+ }+ const el = editorElementRef.current;+ if (!el) {+ return;+ }+ let observer: ResizeObserver | null = null;+ const tryFit = () => {+ if (hasInitialFitRef.current) {+ return;+ }+ const visible =+ (editorElementRef.current?.getBoundingClientRect().width ?? 0) > 0;+ if (!visible || !nodesInitialized) {+ return;+ }+ hasInitialFitRef.current = true;+ runFitView({ duration: 0 });+ observer?.disconnect();+ };+ observer = new ResizeObserver(tryFit);+ observer.observe(el);+ tryFit();+ return () => observer?.disconnect();+ }, [runFitView, nodesInitialized, centerOffsetX]);+const zoomLock = 1 as const;const yLockMax = 140 as const;@@ -1513,7 +1589,9 @@ function FlowRenderer({const idealWidth = hasHttpBlock ? 580 : hasLoopBlock ? 498 : 475;const split = (width - idealWidth) / 2;- return Math.max(24, split);+ // Shift left by half the left panel so the locked position matches the+ // page-centered fit (see runFitView).+ return Math.max(24, split - centerOffsetX / 2);};useOnChange(debugStore.isDebugMode, (newValue) => {diff --git a/skyvern-frontend/src/routes/workflows/editor/MakeACopyButton.tsx b/skyvern-frontend/src/routes/workflows/editor/MakeACopyButton.tsxnew file mode 100644index 000000000..c7dec6d83--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/editor/MakeACopyButton.tsx@@ -0,0 +1,37 @@+import { CopyIcon, ReloadIcon } from "@radix-ui/react-icons";+import { useParams } from "react-router-dom";++import { Button } from "@/components/ui/button";++import { useCreateWorkflowMutation } from "../hooks/useCreateWorkflowMutation";+import { useGlobalWorkflowsQuery } from "../hooks/useGlobalWorkflowsQuery";+import { convert } from "./workflowEditorUtils";++function MakeACopyButton() {+ const { workflowPermanentId } = useParams();+ const { data: globalWorkflows } = useGlobalWorkflowsQuery();+ const createWorkflowMutation = useCreateWorkflowMutation();++ const handleClick = () => {+ const workflow = globalWorkflows?.find(+ (w) => w.workflow_permanent_id === workflowPermanentId,+ );+ if (!workflow) {+ return;+ }+ createWorkflowMutation.mutate(convert(workflow));+ };++ return (+ <Button size="lg" onClick={handleClick}>+ {createWorkflowMutation.isPending ? (+ <ReloadIcon className="mr-3 h-6 w-6 animate-spin" />+ ) : (+ <CopyIcon className="mr-3 h-6 w-6" />+ )}+ Make a Copy to Edit+ </Button>+ );+}++export { MakeACopyButton };diff --git a/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx b/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsxindex c043745db..1eeb6263c 100644--- a/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx+++ b/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx@@ -10,15 +10,18 @@ import { useGlobalWorkflowsQuery } from "../hooks/useGlobalWorkflowsQuery";import { useBlockOutputStore } from "@/store/BlockOutputStore";import { useWorkflowParametersStore } from "@/store/WorkflowParametersStore";import { getInitialParameters } from "./utils";+import { StudioShell } from "../studio/StudioShell";import { Workspace } from "./Workspace";import { ProductTour } from "@/components/onboarding/ProductTour";import { useProductTourShortcut } from "@/hooks/useProductTourShortcut";import { useMountEffect } from "@/hooks/useMountEffect";+import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";function WorkflowEditor() {const { workflowPermanentId } = useParams();const [searchParams] = useSearchParams();const posthog = usePostHog();+ const studioEnabled = useWorkflowStudioEnabled();const { data: workflow, isLoading } = useWorkflowQuery({workflowPermanentId,});@@ -113,16 +116,26 @@ function WorkflowEditor() {{elements.validationError.message}</div>) : null}- <div className="relative flex flex-1">+ <div className="relative flex min-h-0 flex-1"><ReactFlowProvider>- <Workspace- key={workflowPermanentId}- initialEdges={elements.edges}- initialNodes={elements.nodes}- initialTitle={workflow.title}- showBrowser={false}- workflow={workflow}- />+ {studioEnabled ? (+ <StudioShell+ key={workflowPermanentId}+ initialEdges={elements.edges}+ initialNodes={elements.nodes}+ initialTitle={workflow.title}+ workflow={workflow}+ />+ ) : (+ <Workspace+ key={workflowPermanentId}+ initialEdges={elements.edges}+ initialNodes={elements.nodes}+ initialTitle={workflow.title}+ showBrowser={false}+ workflow={workflow}+ />+ )}</ReactFlowProvider></div><ProductTour />diff --git a/skyvern-frontend/src/routes/workflows/editor/WorkflowHeader.tsx b/skyvern-frontend/src/routes/workflows/editor/WorkflowHeader.tsxindex d9f448266..f8194f8e6 100644--- a/skyvern-frontend/src/routes/workflows/editor/WorkflowHeader.tsx+++ b/skyvern-frontend/src/routes/workflows/editor/WorkflowHeader.tsx@@ -2,7 +2,6 @@ import {CalendarIcon,ChevronDownIcon,ChevronUpIcon,- CopyIcon,PlayIcon,ReloadIcon,} from "@radix-ui/react-icons";@@ -20,7 +19,7 @@ import {} from "@/components/ui/tooltip";import { statusIsRunningOrQueued } from "@/routes/tasks/types";import { useGlobalWorkflowsQuery } from "../hooks/useGlobalWorkflowsQuery";-import { useCreateWorkflowMutation } from "../hooks/useCreateWorkflowMutation";+import { MakeACopyButton } from "./MakeACopyButton";import { useWorkflowQuery } from "@/routes/workflows/hooks/useWorkflowQuery";import { useWorkflowRunQuery } from "@/routes/workflows/hooks/useWorkflowRunQuery";import { useCacheKeyValueStore } from "@/store/CacheKeyValueStore";@@ -38,7 +37,6 @@ import { useSaveWorkflow } from "./hooks/useSaveWorkflow";import { useToggleCodeView } from "./hooks/useToggleCodeView";import { useWorkflowHeaderCollapseStore } from "./useWorkflowHeaderCollapseStore";import { WorkflowHeaderCollapseTab } from "./WorkflowHeaderCollapseTab";-import { convert } from "./workflowEditorUtils";function useIsGlobalWorkflow(): boolean {const { workflowPermanentId } = useParams();@@ -65,33 +63,6 @@ function GeneratingCodeButton() {);}-function MakeACopyButton() {- const { workflowPermanentId } = useParams();- const { data: globalWorkflows } = useGlobalWorkflowsQuery();- const createWorkflowMutation = useCreateWorkflowMutation();-- const handleClick = () => {- const workflow = globalWorkflows?.find(- (w) => w.workflow_permanent_id === workflowPermanentId,- );- if (!workflow) {- return;- }- createWorkflowMutation.mutate(convert(workflow));- };-- return (- <Button size="lg" onClick={handleClick}>- {createWorkflowMutation.isPending ? (- <ReloadIcon className="mr-3 h-6 w-6 animate-spin" />- ) : (- <CopyIcon className="mr-3 h-6 w-6" />- )}- Make a Copy to Edit- </Button>- );-}-function BrowserModeButton() {const navigate = useNavigate();const { workflowPermanentId } = useParams();diff --git a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsxindex 62b882b8c..edc4fc784 100644--- a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx+++ b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx@@ -142,6 +142,12 @@ import { shouldKeepExistingEdgeForInsertion } from "./workflowInsertion";import { constructCacheKeyValue, getInitialParameters } from "./utils";import { WorkflowCopilotChat } from "../copilot/WorkflowCopilotChat";+import { useStudioShellContext } from "../studio/StudioShellContext";+import {+ STUDIO_COPILOT_RAIL_WIDTH,+ STUDIO_COPILOT_WIDTH,+} from "../studio/constants";+import { useStudioShellStore } from "@/store/StudioShellStore";import { WorkflowCopilotButton } from "../copilot/WorkflowCopilotButton";import { resolveCopilotLiveBrowserReady } from "../copilot/browserReadiness";@@ -189,6 +195,9 @@ type Props = Pick<FlowRendererProps, "initialTitle" | "workflow"> & {initialNodes: Array<AppNode>;initialEdges: Array<Edge>;showBrowser?: boolean;+ // When embedded in the Spine+Stage StudioShell, the shell provides the top+ // bar, so Workspace suppresses its own floating WorkflowHeader.+ embedded?: boolean;};export type AddNodeProps = {@@ -215,7 +224,13 @@ function bash(text: string, alternateText?: string) {);}-function CopyAndExplainCode({ code }: { code: string }) {+function CopyAndExplainCode({+ code,+ showCopy = true,+}: {+ code: string;+ showCopy?: boolean;+}) {const [isOpen, setIsOpen] = useState(false);const numCodeLines = code.split("\n").length;@@ -260,7 +275,7 @@ function CopyAndExplainCode({ code }: { code: string }) {</DialogFooter></DialogContent></Dialog>- <CopyText text={code} />+ {showCopy ? <CopyText text={code} /> : null}</div>);}@@ -294,9 +309,23 @@ function Workspace({initialEdges,initialTitle,showBrowser = false,+ embedded = false,workflow,}: Props) {const { blockLabel, workflowPermanentId } = useParams();+ const { copilotPortalEl: studioCopilotPortalEl } = useStudioShellContext();+ const studioCopilotCollapsed = useStudioShellStore((s) => s.copilotCollapsed);+ const studioSetCopilotCollapsed = useStudioShellStore(+ (s) => s.setCopilotCollapsed,+ );+ const studioSetTab = useStudioShellStore((s) => s.setTab);+ // The studio canvas sits right of the Copilot column; offset the fit by the+ // column width so the chain centers on the whole page, not just the pane.+ const studioCanvasCenterOffset = embedded+ ? studioCopilotCollapsed+ ? STUDIO_COPILOT_RAIL_WIDTH+ : STUDIO_COPILOT_WIDTH+ : 0;const location = useLocation();const navigate = useNavigate();const locationState = location.state as { copilotMessage?: unknown } | null;@@ -651,8 +680,10 @@ function Workspace({(!activeDebugSession || activeDebugSession.vnc_streaming_supported);const showCdpBrowserPanel =isCdpStreamingMode && shouldFetchDebugSession && !isRateLimited;+ // Embedded: the shell owns the stream, so bind the copilot once the backend+ // session exists — else it gets a null id and the backend spins a separate browser.const copilotRequiresLiveBrowser =- showBrowser && shouldFetchDebugSession && !isRateLimited;+ (showBrowser || embedded) && shouldFetchDebugSession && !isRateLimited;// readyBrowserSessionId is keyed to the browser session id rather than a// bare boolean: when activeDebugSession's id changes, stale ready state// from the previous session cannot leak into the next render.@@ -661,7 +692,7 @@ function Workspace({readyBrowserSessionId && readyBrowserSessionId === liveBrowserSessionId,),hasBackendSession: Boolean(liveBrowserSessionId),- headlessTurnDrainEnabled,+ headlessTurnDrainEnabled: headlessTurnDrainEnabled || embedded,});const handleLiveBrowserReadyChange = useCallback(@@ -733,7 +764,12 @@ function Workspace({// payload resolves.const cacheKeyInitWpidRef = useRef<string | null>(null);useEffect(() => {- useWorkflowPanelStore.getState().setSelectedBlockId(null);+ // Studio defaults the selection to the start node on open (legacy keeps it+ // empty); fires only on workflow change, so tab-switch selection persists.+ const startNodeId = embedded+ ? (initialNodes.find((node) => node.type === "start")?.id ?? null)+ : null;+ useWorkflowPanelStore.getState().setSelectedBlockId(startNodeId);useShowAllCodeStore.getState().reset();useSidebarSaveStateStore.getState().reset();cacheKeyInitWpidRef.current = null;@@ -746,6 +782,9 @@ function Workspace({} else {setShouldFetchDebugSession(false);}+ // initialNodes/embedded read from the mount closure on purpose; as deps they+ // would re-fire this reset on every workflow refetch.+ // eslint-disable-next-line react-hooks/exhaustive-deps}, [workflowPermanentId, queryClient]);useEffect(() => {@@ -1507,26 +1546,57 @@ function Workspace({</Dialog>{/* header panel */}- <div- className={cn(- "absolute left-6 top-8 z-40 h-20 transition-all duration-300 ease-out",- headerEffectiveSidebarOpen- ? HEADER_RIGHT_INSET_OPEN- : HEADER_RIGHT_INSET_CLOSED,- )}- style={{- transform: headerCollapsed- ? "translateY(calc(-100% - 2rem))"- : "translateY(0)",- }}- >- <WorkflowHeader />- </div>+ {!embedded && (+ <div+ className={cn(+ "absolute left-6 top-8 z-40 h-20 transition-all duration-300 ease-out",+ headerEffectiveSidebarOpen+ ? HEADER_RIGHT_INSET_OPEN+ : HEADER_RIGHT_INSET_CLOSED,+ )}+ style={{+ transform: headerCollapsed+ ? "translateY(calc(-100% - 2rem))"+ : "translateY(0)",+ }}+ >+ <WorkflowHeader />+ </div>+ )}{/* comparison view (takes precedence over both browser and non-browser modes) */}{workflowPanelState.data?.showComparison &&workflowPanelState.data?.version1 &&- workflowPanelState.data?.version2 ? (+ workflowPanelState.data?.version2 &&+ embedded ? (+ // Studio: a flex row so Agent History docks beside the comparison; the+ // legacy absolute layout below assumes the old full-width editor.+ <div className="flex h-full w-full gap-3 overflow-hidden p-3">+ <div className="min-w-0 flex-1">+ <WorkflowComparisonPanel+ key={`${workflowPanelState.data.version1.workflow_id}v${workflowPanelState.data.version1.version}-${workflowPanelState.data.version2.workflow_id}v${workflowPanelState.data.version2.version}`}+ version1={workflowPanelState.data.version1}+ version2={workflowPanelState.data.version2}+ onSelectState={handleSelectState}+ mode={workflowPanelState.data.mode}+ onCopilotReviewClose={+ workflowPanelState.data.onCopilotReviewClose+ }+ />+ </div>+ {workflowPanelState.active &&+ workflowPanelState.content === "history" && (+ <div className="shrink-0">+ <WorkflowHistoryPanel+ workflowPermanentId={workflowPermanentId!}+ onCompare={handleCompareVersions}+ />+ </div>+ )}+ </div>+ ) : workflowPanelState.data?.showComparison &&+ workflowPanelState.data?.version1 &&+ workflowPanelState.data?.version2 ? (<div className="relative flex h-full w-full overflow-hidden overflow-x-hidden">{/* comparison view */}<div@@ -1554,7 +1624,8 @@ function Workspace({{workflowPanelState.active && (<divclassName={cn(- "absolute top-[8.5rem] z-30 transition-all duration-300 ease-out",+ "absolute z-30 transition-all duration-300 ease-out",+ embedded ? "top-3" : "top-[8.5rem]",blockSidebarOpen? HEADER_RIGHT_INSET_OPEN: HEADER_RIGHT_INSET_CLOSED,@@ -1564,10 +1635,11 @@ function Workspace({workflowPanelState.content === "nodeLibrary"? "calc(100vh - 14rem)": "unset",- transform: headerCollapsed- ? "translateY(calc(-100% - 8.5rem))"- : "translateY(0)",- opacity: headerCollapsed ? 0 : 1,+ transform:+ !embedded && headerCollapsed+ ? "translateY(calc(-100% - 8.5rem))"+ : "translateY(0)",+ opacity: !embedded && headerCollapsed ? 0 : 1,}}>{workflowPanelState.content === "cacheKeyValues" && (@@ -1629,6 +1701,7 @@ function Workspace({onEdgesChange={onEdgesChange}initialTitle={initialTitle}workflow={workflow}+ centerOffsetX={studioCanvasCenterOffset}onRequestDeleteNode={handleRequestDeleteNode}captureHistoryImmediately={captureWorkflowEditImmediately}onAddNode={addNode}@@ -1638,7 +1711,7 @@ function Workspace({{/* sub panels */}{workflowPanelState.active && (<>- {workflowPanelState.content === "schedules" && (+ {!embedded && workflowPanelState.content === "schedules" && (<divclassName="absolute inset-0 z-20"onClick={closeWorkflowPanel}@@ -1646,7 +1719,10 @@ function Workspace({)}<divclassName={cn(- "absolute top-[8.5rem] z-30 transition-all duration-300 ease-out",+ "absolute z-30 transition-all duration-300 ease-out",+ // Studio's top bar is above the canvas, so the panel drops+ // from the canvas top; legacy's header is inside it.+ embedded ? "top-3" : "top-[8.5rem]",blockSidebarOpen? HEADER_RIGHT_INSET_OPEN: HEADER_RIGHT_INSET_CLOSED,@@ -1656,10 +1732,11 @@ function Workspace({workflowPanelState.content === "nodeLibrary"? "calc(100vh - 14rem)": "unset",- transform: headerCollapsed- ? "translateY(calc(-100% - 8.5rem))"- : "translateY(0)",- opacity: headerCollapsed ? 0 : 1,+ transform:+ !embedded && headerCollapsed+ ? "translateY(calc(-100% - 8.5rem))"+ : "translateY(0)",+ opacity: !embedded && headerCollapsed ? 0 : 1,}}>{workflowPanelState.content === "cacheKeyValues" && (@@ -1685,16 +1762,18 @@ function Workspace({}}/>)}- {workflowPanelState.content === "parameters" && (- <div className="z-30">- <WorkflowParametersPanel />- </div>- )}- {workflowPanelState.content === "schedules" && (- <div className="z-30">- <WorkflowSchedulePanel onClose={closeWorkflowPanel} />- </div>- )}+ {!embedded &&+ workflowPanelState.content === "parameters" && (+ <div className="z-30">+ <WorkflowParametersPanel />+ </div>+ )}+ {!embedded &&+ workflowPanelState.content === "schedules" && (+ <div className="z-30">+ <WorkflowSchedulePanel onClose={closeWorkflowPanel} />+ </div>+ )}{workflowPanelState.content === "history" && (<div className="pointer-events-auto relative right-0 top-[3.5rem] z-30 h-[calc(100vh-14rem)]"><WorkflowHistoryPanel@@ -2175,7 +2254,14 @@ function Workspace({)}<WorkflowCopilotChat- isOpen={showBrowser && isCopilotOpen}+ isOpen={+ embedded ? !studioCopilotCollapsed : showBrowser && isCopilotOpen+ }+ docked={embedded}+ portalTarget={embedded ? studioCopilotPortalEl : undefined}+ onCollapse={+ embedded ? () => studioSetCopilotCollapsed(true) : undefined+ }onClose={() => setIsCopilotOpen(false)}onMessageCountChange={setCopilotMessageCount}buttonRef={copilotButtonRef}@@ -2347,8 +2433,12 @@ function Workspace({}};- // Hide chat and show comparison+ // Hide chat and show comparison. The comparison renders on the+ // editor canvas, so surface the editor tab when docked in the studio.setIsCopilotOpen(false);+ if (embedded) {+ studioSetTab("editor");+ }setWorkflowPanelState({active: false,content: "history",diff --git a/skyvern-frontend/src/routes/workflows/editor/__tests__/WorkflowAddMenu.test.tsx b/skyvern-frontend/src/routes/workflows/editor/__tests__/WorkflowAddMenu.test.tsxindex 9b8711979..f7d045475 100644--- a/skyvern-frontend/src/routes/workflows/editor/__tests__/WorkflowAddMenu.test.tsx+++ b/skyvern-frontend/src/routes/workflows/editor/__tests__/WorkflowAddMenu.test.tsx@@ -32,7 +32,9 @@ const initialRecording = useRecordingStore.getState();function renderInDebugMode() {return render(- <DebugStoreContext.Provider value={{ isDebugMode: true }}>+ <DebugStoreContext.Provider+ value={{ isDebugMode: true, blockRunsEnabled: false }}+ ><WorkflowAddMenuonAdd={() => {}}onRecord={() => {}}diff --git a/skyvern-frontend/src/routes/workflows/editor/edges/EdgeWithAddButton.test.tsx b/skyvern-frontend/src/routes/workflows/editor/edges/EdgeWithAddButton.test.tsxindex 1f0e6f5de..00a82a7b4 100644--- a/skyvern-frontend/src/routes/workflows/editor/edges/EdgeWithAddButton.test.tsx+++ b/skyvern-frontend/src/routes/workflows/editor/edges/EdgeWithAddButton.test.tsx@@ -61,7 +61,9 @@ const initialRecording = useRecordingStore.getState();function renderEdge(props: Partial<EdgeProps> = {}) {return render(- <DebugStoreContext.Provider value={{ isDebugMode: false }}>+ <DebugStoreContext.Provider+ value={{ isDebugMode: false, blockRunsEnabled: false }}+ ><EdgeWithAddButton{...({id: "edge",diff --git a/skyvern-frontend/src/routes/workflows/editor/hooks/useIsGeneratingCode.ts b/skyvern-frontend/src/routes/workflows/editor/hooks/useIsGeneratingCode.tsindex 782669e97..d687b361a 100644--- a/skyvern-frontend/src/routes/workflows/editor/hooks/useIsGeneratingCode.ts+++ b/skyvern-frontend/src/routes/workflows/editor/hooks/useIsGeneratingCode.ts@@ -6,14 +6,18 @@ type Params = {cacheKey: string;cacheKeyValue: string;workflowPermanentId: string | undefined;+ workflowRunId?: string;};export function useIsGeneratingCode({cacheKey,cacheKeyValue,workflowPermanentId,+ workflowRunId,}: Params): boolean {- const { data: workflowRun } = useWorkflowRunQuery();+ const { data: workflowRun } = useWorkflowRunQuery(+ workflowRunId ? { workflowRunId } : undefined,+ );const { data: blockScriptsPublished } = useBlockScriptsQuery({cacheKey,cacheKeyValue,diff --git a/skyvern-frontend/src/routes/workflows/editor/hooks/useWorkflowEditorMode.ts b/skyvern-frontend/src/routes/workflows/editor/hooks/useWorkflowEditorMode.tsindex 0e054f587..c6ead3395 100644--- a/skyvern-frontend/src/routes/workflows/editor/hooks/useWorkflowEditorMode.ts+++ b/skyvern-frontend/src/routes/workflows/editor/hooks/useWorkflowEditorMode.ts@@ -2,12 +2,9 @@ import { useLocation } from "react-router-dom";type WorkflowEditorMode = "edit" | "build";-// `/edit` either ends the path or is followed by `/`. This matches the-// React Router definitions in cloud/router.tsx where the workflow editor-// has both bare `/edit` and (potentially future) nested edit subpaths.-// Anything else — including `/build`, run-targeted `/build`, and unrelated-// pages like `/runs` — falls back to 'build'.-const EDIT_PATH_PATTERN = /\/edit(?:$|\/)/;+// `/studio` (flag on) is the same edit surface legacy served at `/edit`, so both+// map to 'edit'; anything else (`/build`, `/runs`, …) falls back to 'build'.+const EDIT_PATH_PATTERN = /\/(?:edit|studio)(?:$|\/)/;function useWorkflowEditorMode(): WorkflowEditorMode {const { pathname } = useLocation();diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/NodeAdderNode/NodeAdderNode.test.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/NodeAdderNode/NodeAdderNode.test.tsxindex 0e200bb3d..9b844e1c5 100644--- a/skyvern-frontend/src/routes/workflows/editor/nodes/NodeAdderNode/NodeAdderNode.test.tsx+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/NodeAdderNode/NodeAdderNode.test.tsx@@ -61,7 +61,9 @@ const initialWorkflowSettings = useWorkflowSettingsStore.getState();function renderNodeAdder(props: Partial<NodeProps<NodeAdderNodeType>>) {return render(- <DebugStoreContext.Provider value={{ isDebugMode: false }}>+ <DebugStoreContext.Provider+ value={{ isDebugMode: false, blockRunsEnabled: false }}+ ><NodeAdderNode{...({id: "adder",diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/TaskNode.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/TaskNode.tsxindex 1283740b9..db1c1de55 100644--- a/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/TaskNode.tsx+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/TaskNode.tsx@@ -7,6 +7,8 @@ import { BlockCodeEditor } from "@/routes/workflows/components/BlockCodeEditor";import { statusIsRunningOrQueued } from "@/routes/tasks/types";import { useWorkflowRunQuery } from "@/routes/workflows/hooks/useWorkflowRunQuery";import { useBlockScriptStore } from "@/store/BlockScriptStore";+import { BlockStatusBar } from "@/routes/workflows/studio/BlockStatusBar";+import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";import { cn } from "@/util/utils";import { useCollapseContext } from "../../collapse/CollapseContext";@@ -18,6 +20,7 @@ import type { TaskNode } from "./types";function TaskNode({ id, data, type }: NodeProps<TaskNode>) {const [facing, setFacing] = useState<"front" | "back">("front");+ const studioEnabled = useWorkflowStudioEnabled();const blockScriptStore = useBlockScriptStore();const { editable, label } = data;const script = blockScriptStore.scripts[label];@@ -70,6 +73,7 @@ function TaskNode({ id, data, type }: NodeProps<TaskNode>) {totpUrl={data.totpVerificationUrl}type={type}/>+ {studioEnabled && <BlockStatusBar blockLabel={label} />}<NodeBody><BuildModeOnly><TaskEditor blockId={id} />diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.tsxindex 1c69e31bf..22a107a2c 100644--- a/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.tsx+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.tsx@@ -22,6 +22,7 @@ import { StatusBadge } from "@/components/StatusBadge";import { toast } from "@/components/ui/use-toast";import { useLogging } from "@/hooks/useLogging";import { useCredentialGetter } from "@/hooks/useCredentialGetter";+import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";import { useOnChange } from "@/hooks/useOnChange";import { useAutoplayStore } from "@/store/useAutoplayStore";@@ -56,6 +57,7 @@ import { getInitialValues } from "@/routes/workflows/utils";import { useDebuggerLastRunValuesStore } from "@/store/DebuggerLastRunValuesStore";import { useBlockOutputStore } from "@/store/BlockOutputStore";import { useDebugStore } from "@/store/useDebugStore";+import { useStudioShellStore } from "@/store/StudioShellStore";import { useRecordingStore } from "@/store/useRecordingStore";import { useWorkflowPanelStore } from "@/store/WorkflowPanelStore";import { useWorkflowSave } from "@/store/WorkflowHasChangesStore";@@ -262,6 +264,7 @@ function NodeHeader({const toggleScriptForNodeCallback = useToggleScriptForNodeCallback();const credentialGetter = useCredentialGetter();const navigate = useNavigate();+ const studioEnabled = useWorkflowStudioEnabled();const queryClient = useQueryClient();const location = useLocation();const isDebuggable = debuggableWorkflowBlockTypes.has(type);@@ -549,9 +552,16 @@ function NodeHeader({description: "The agent block run has been started successfully",});- navigate(- `/workflows/${workflowPermanentId}/${response.data.run_id}/${label}/build`,- );+ if (studioEnabled) {+ useStudioShellStore.getState().setTab("browser");+ navigate(+ `/workflows/${workflowPermanentId}/studio?wr=${response.data.run_id}&bl=${encodeURIComponent(label)}`,+ );+ } else {+ navigate(+ `/workflows/${workflowPermanentId}/${response.data.run_id}/${label}/build`,+ );+ }},onError: (error: AxiosError | ValidationFailureError) => {// The block-validation gate threw a typed error and already showed@@ -999,31 +1009,32 @@ function NodeHeader({</button></div>)}- {debugStore.isDebugMode && isDebuggable && (- <button- disabled={workflowRunIsRunningOrQueued}- className={cn("rounded p-1 disabled:opacity-50", {- "hover:bg-muted": workflowRunIsRunningOrQueued,- })}- >- {runBlock.isPending ? (- <ReloadIcon className="size-6 animate-spin" />- ) : (- <PlayIcon- className={cn("size-6", {- "pointer-events-none fill-gray-500 text-gray-500":- workflowRunIsRunningOrQueued ||- !workflowPermanentId ||- debugSession === undefined ||- isRecording,- })}- onClick={() => {- void handleOnPlay();- }}- />- )}- </button>- )}+ {(debugStore.isDebugMode || debugStore.blockRunsEnabled) &&+ isDebuggable && (+ <button+ disabled={workflowRunIsRunningOrQueued}+ className={cn("rounded p-1 disabled:opacity-50", {+ "hover:bg-muted": workflowRunIsRunningOrQueued,+ })}+ >+ {runBlock.isPending ? (+ <ReloadIcon className="size-6 animate-spin" />+ ) : (+ <PlayIcon+ className={cn("size-6", {+ "pointer-events-none fill-gray-500 text-gray-500":+ workflowRunIsRunningOrQueued ||+ !workflowPermanentId ||+ debugSession === undefined ||+ isRecording,+ })}+ onClick={() => {+ void handleOnPlay();+ }}+ />+ )}+ </button>+ )}{collapseToggleButton}{disabled ? null : (<div>diff --git a/skyvern-frontend/src/routes/workflows/hooks/useCreateWorkflowMutation.ts b/skyvern-frontend/src/routes/workflows/hooks/useCreateWorkflowMutation.tsindex c8a685f14..58cf1a149 100644--- a/skyvern-frontend/src/routes/workflows/hooks/useCreateWorkflowMutation.ts+++ b/skyvern-frontend/src/routes/workflows/hooks/useCreateWorkflowMutation.ts@@ -7,6 +7,8 @@ import { stringify as convertToYAML } from "yaml";import { WorkflowApiResponse } from "../types/workflowTypes";import { toast } from "@/components/ui/use-toast";import { OnboardingTelemetry } from "@/util/onboarding/OnboardingTelemetry";+import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";+import { workflowEditorPath } from "../studioNavigation";import axios from "axios";type CreateWorkflowInput = WorkflowCreateYAMLRequest & { _via?: string };@@ -31,6 +33,7 @@ function useCreateWorkflowMutation() {const queryClient = useQueryClient();const credentialGetter = useCredentialGetter();const navigate = useNavigate();+ const studioEnabled = useWorkflowStudioEnabled();return useMutation({mutationFn: async (input: CreateWorkflowInput) => {const { _via: _, ...workflow } = input;@@ -66,7 +69,11 @@ function useCreateWorkflowMutation() {}const search = via ? `?via=${encodeURIComponent(via)}` : "";navigate(- `/workflows/${response.data.workflow_permanent_id}/build${search}`,+ workflowEditorPath(+ response.data.workflow_permanent_id,+ studioEnabled,+ search,+ ),);},onError: (error) => {diff --git a/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRunQuery.ts b/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRunQuery.tsindex 6569142a6..e73c236ad 100644--- a/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRunQuery.ts+++ b/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRunQuery.ts@@ -15,8 +15,9 @@ import {useActiveOrgId,} from "@/store/ActiveOrgContext";-function useWorkflowRunQuery() {- const workflowRunId = useFirstParam("workflowRunId", "runId");+function useWorkflowRunQuery(options?: { workflowRunId?: string }) {+ const urlWorkflowRunId = useFirstParam("workflowRunId", "runId");+ const workflowRunId = options?.workflowRunId ?? urlWorkflowRunId;const { workflowPermanentId } = useParams();const credentialGetter = useCredentialGetter();const { data: globalWorkflows } = useGlobalWorkflowsQuery();diff --git a/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRunTimelineQuery.ts b/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRunTimelineQuery.tsindex 5bf7137be..468872bcb 100644--- a/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRunTimelineQuery.ts+++ b/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRunTimelineQuery.ts@@ -17,15 +17,16 @@ import {useActiveOrgId,} from "@/store/ActiveOrgContext";-function useWorkflowRunTimelineQuery() {- const workflowRunId = useFirstParam("workflowRunId", "runId");+function useWorkflowRunTimelineQuery(options?: { workflowRunId?: string }) {+ const urlWorkflowRunId = useFirstParam("workflowRunId", "runId");+ const workflowRunId = options?.workflowRunId ?? urlWorkflowRunId;const credentialGetter = useCredentialGetter();const activeOrgId = useActiveOrgId();const activeOrgQueryKeyScope = getActiveOrgQueryKeyScope(activeOrgId);const queryClient = useQueryClient();const { data: globalWorkflows } = useGlobalWorkflowsQuery();const { data: workflowRun, dataUpdatedAt } =- useWorkflowRunWithWorkflowQuery();+ useWorkflowRunWithWorkflowQuery(options);const workflow = workflowRun?.workflow;const workflowPermanentId = workflow?.workflow_permanent_id;diff --git a/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRunWithWorkflowQuery.ts b/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRunWithWorkflowQuery.tsindex 5f38001b7..0429269a5 100644--- a/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRunWithWorkflowQuery.ts+++ b/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRunWithWorkflowQuery.ts@@ -13,8 +13,9 @@ import {useActiveOrgId,} from "@/store/ActiveOrgContext";-function useWorkflowRunWithWorkflowQuery() {- const workflowRunId = useFirstParam("workflowRunId", "runId");+function useWorkflowRunWithWorkflowQuery(options?: { workflowRunId?: string }) {+ const urlWorkflowRunId = useFirstParam("workflowRunId", "runId");+ const workflowRunId = options?.workflowRunId ?? urlWorkflowRunId;const credentialGetter = useCredentialGetter();const activeOrgId = useActiveOrgId();const activeOrgQueryKeyScope = getActiveOrgQueryKeyScope(activeOrgId);diff --git a/skyvern-frontend/src/routes/workflows/studio/BlockStatusBar.tsx b/skyvern-frontend/src/routes/workflows/studio/BlockStatusBar.tsxnew file mode 100644index 000000000..b4f6857f9--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/BlockStatusBar.tsx@@ -0,0 +1,52 @@+import { useMemo } from "react";+import {+ CheckCircledIcon,+ ExclamationTriangleIcon,+} from "@radix-ui/react-icons";+import { useWorkflowRunTimelineQuery } from "../hooks/useWorkflowRunTimelineQuery";+import { buildBlockStatusMap, runOutcomeFromStatus } from "./runProjections";+import { useStudioRunId } from "./useStudioRunId";++/**+ * Inline per-block run status on the block card. Renders nothing in plain edit+ * mode (no run → no timeline), so it is purely additive over the node.+ */+export function BlockStatusBar({ blockLabel }: { blockLabel: string }) {+ const runId = useStudioRunId();+ const { data: timeline } = useWorkflowRunTimelineQuery(+ runId ? { workflowRunId: runId } : undefined,+ );+ const statusMap = useMemo(() => buildBlockStatusMap(timeline), [timeline]);+ const state = statusMap[blockLabel];+ if (!state || !state.status) {+ return null;+ }+ const outcome = runOutcomeFromStatus(state.status);++ 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)]" />+ Running… watching the live browser+ </div>+ );+ }+ if (outcome === "failed") {+ return (+ <div className="flex items-center gap-2 rounded-md bg-destructive/15 px-3 py-2 text-xs font-medium text-destructive">+ <ExclamationTriangleIcon className="h-3.5 w-3.5" />+ Failed — see Copilot for the fix+ </div>+ );+ }+ if (outcome === "success") {+ return (+ <div className="flex items-center gap-2 rounded-md bg-success/15 px-3 py-2 text-xs font-medium text-success">+ <CheckCircledIcon className="h-3.5 w-3.5" />+ Completed+ {state.actionCount > 0 ? ` · ${state.actionCount} actions` : null}+ </div>+ );+ }+ return null;+}diff --git a/skyvern-frontend/src/routes/workflows/studio/BrowserPiP.tsx b/skyvern-frontend/src/routes/workflows/studio/BrowserPiP.tsxnew file mode 100644index 000000000..193a8c2b1--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/BrowserPiP.tsx@@ -0,0 +1,132 @@+import {+ ChevronDownIcon,+ EnterFullScreenIcon,+ GlobeIcon,+} from "@radix-ui/react-icons";+import { useParams } from "react-router-dom";++import { useStudioShellStore } from "@/store/StudioShellStore";+import { cn } from "@/util/utils";++import { useDebugSessionQuery } from "../hooks/useDebugSessionQuery";+import { useStudioShellContext } from "./StudioShellContext";+import { usePresence } from "./usePresence";++/**+ * Picture-in-picture preview of the persistent debug browser. The stream node+ * lives in the shell and is re-parented into this slot, so it never re-boots.+ */+export function BrowserPiP() {+ const minimized = useStudioShellStore((s) => s.pipMinimized);+ const setMinimized = useStudioShellStore((s) => s.setPipMinimized);+ const setTab = useStudioShellStore((s) => s.setTab);+ const { setEditorStreamSlot } = useStudioShellContext();++ const { workflowPermanentId } = useParams();+ // The session is owned (fetched) by the editor's Workspace; read it passively.+ const { data: debugSession } = useDebugSessionQuery({+ workflowPermanentId,+ enabled: false,+ });+ const sessionId = debugSession?.browser_session_id ?? null;+ const live = Boolean(sessionId);+ const stateLabel = live ? "live" : "starting";++ // Keep the outgoing element mounted briefly so it can animate out.+ const pillPresent = usePresence(minimized, 150);+ const cardPresent = usePresence(!minimized, 150);++ return (+ <>+ {pillPresent ? (+ <button+ type="button"+ onClick={() => setMinimized(false)}+ title="Show live browser"+ className={cn(+ "absolute bottom-4 right-4 z-30 inline-flex items-center gap-2 rounded-full border border-border bg-slate-elevation1 px-3 py-2 text-xs text-foreground shadow-lg duration-150 hover:bg-slate-elevation2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",+ minimized+ ? "animate-in fade-in zoom-in-95"+ : "animate-out fade-out zoom-out-95",+ )}+ >+ <span+ className={cn(+ "h-2 w-2 rounded-full",+ live ? "animate-pulse bg-success" : "bg-muted-foreground/50",+ )}+ />+ <GlobeIcon className="h-3.5 w-3.5" /> Live Browser+ <span className="text-muted-foreground/70">· {stateLabel}</span>+ </button>+ ) : null}++ {cardPresent ? (+ <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",+ minimized+ ? "animate-out fade-out zoom-out-95"+ : "animate-in fade-in zoom-in-95",+ )}+ >+ <div className="flex items-center gap-2 border-b border-border px-3 py-2">+ <span+ className={cn(+ "h-2 w-2 rounded-full",+ live ? "animate-pulse bg-success" : "bg-muted-foreground/50",+ )}+ />+ <span className="inline-flex items-center gap-1.5 text-xs font-medium text-foreground">+ <GlobeIcon className="h-3.5 w-3.5" /> Live Browser+ </span>+ <span className="text-[11px] uppercase tracking-wide text-muted-foreground/70">+ {stateLabel}+ </span>+ <div className="flex-1" />+ <button+ type="button"+ onClick={() => setTab("browser")}+ aria-label="Expand to Browser tab"+ title="Expand to Browser tab"+ className="rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"+ >+ <EnterFullScreenIcon className="h-3.5 w-3.5" />+ </button>+ <button+ type="button"+ onClick={() => setMinimized(true)}+ title="Minimize"+ aria-label="Minimize live browser"+ className="rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"+ >+ <ChevronDownIcon className="h-4 w-4" />+ </button>+ </div>+ <button+ type="button"+ onClick={() => setTab("browser")}+ title="Expand to Browser tab"+ aria-label="Expand to Browser tab"+ className="relative block h-[12rem] w-full bg-slate-elevation2 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring"+ >+ {sessionId ? (+ <div ref={setEditorStreamSlot} className="absolute inset-0" />+ ) : (+ <span className="flex h-full flex-col items-center justify-center gap-1 text-center text-muted-foreground">+ <GlobeIcon className="h-6 w-6" />+ <b className="text-sm font-semibold text-foreground">+ Starting browser…+ </b>+ <i className="text-xs not-italic text-muted-foreground/70">+ Your live browser is warming up+ </i>+ </span>+ )}+ </button>+ </div>+ ) : null}+ </>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/BrowserTab.tsx b/skyvern-frontend/src/routes/workflows/studio/BrowserTab.tsxnew file mode 100644index 000000000..de67bb44e--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/BrowserTab.tsx@@ -0,0 +1,202 @@+import {+ GlobeIcon,+ OpenInNewWindowIcon,+ ReloadIcon,+} from "@radix-ui/react-icons";+import { AxiosError } from "axios";+import { useMutation, useQueryClient } from "@tanstack/react-query";+import { useState } from "react";+import { useParams } from "react-router-dom";++import { getClient } from "@/api/AxiosClient";+import { DebugSessionApiResponse } from "@/api/types";+import { PowerIcon } from "@/components/icons/PowerIcon";+import { Button } from "@/components/ui/button";+import {+ Dialog,+ DialogClose,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ DialogTrigger,+} from "@/components/ui/dialog";+import { toast } from "@/components/ui/use-toast";+import { useBrowserStreamingMode } from "@/hooks/useRuntimeConfig";+import { useCredentialGetter } from "@/hooks/useCredentialGetter";+import {+ StreamModeBadge,+ StreamStatusPanel,+} from "@/routes/streaming/StreamDiagnostics";+import { useStudioBrowserStore } from "@/store/useStudioBrowserStore";++import { useDebugSessionQuery } from "../hooks/useDebugSessionQuery";+import { useStudioShellContext } from "./StudioShellContext";++const ICON_BUTTON =+ "shrink-0 rounded p-1.5 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";++/**+ * Browser tab of the studio shell — the persistent debug browser. The stream node+ * lives in the shell and is re-parented into this tab's slot.+ */+export function BrowserTab() {+ const { workflowPermanentId } = useParams();+ const { setBrowserStreamSlot } = useStudioShellContext();+ const { browserStreamingMode } = useBrowserStreamingMode();+ const credentialGetter = useCredentialGetter();+ const queryClient = useQueryClient();+ const { data: debugSession } = useDebugSessionQuery({+ workflowPermanentId,+ enabled: false,+ });+ const browserSessionId = debugSession?.browser_session_id ?? null;++ const streamUrl = useStudioBrowserStore((s) => s.streamUrl);+ const reload = useStudioBrowserStore((s) => s.reload);+ const [confirmOff, setConfirmOff] = useState(false);++ const cycleBrowser = useMutation({+ mutationFn: async (workflowId: string) => {+ const client = await getClient(credentialGetter, "sans-api-v1");+ return client.post<DebugSessionApiResponse>(+ `/debug-session/${workflowId}/new`,+ );+ },+ onSuccess: (response) => {+ queryClient.setQueryData(+ ["debugSession", workflowPermanentId],+ response.data,+ );+ void queryClient.invalidateQueries({+ queryKey: ["debugSession", workflowPermanentId],+ });+ setConfirmOff(false);+ toast({+ variant: "success",+ title: "Browser restarted",+ description: "A fresh browser is starting.",+ });+ },+ onError: (error: AxiosError) => {+ toast({+ variant: "destructive",+ title: "Failed to turn off browser",+ description: error.message,+ });+ },+ });++ const openInNewTab = () => {+ if (!browserSessionId) {+ return;+ }+ window.open(+ `${window.location.origin}/browser-session/${browserSessionId}`,+ "_blank",+ "noopener",+ );+ };++ return (+ <div className="flex h-full min-h-0 w-full flex-col gap-3 p-3">+ <div className="flex shrink-0 items-center gap-1.5 rounded-lg border border-border bg-slate-elevation1 px-3 py-2">+ <GlobeIcon className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />+ <span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">+ {streamUrl || "Live browser"}+ </span>+ <button+ type="button"+ title="Reconnect"+ aria-label="Reconnect browser stream"+ onClick={reload}+ disabled={!browserSessionId}+ className={ICON_BUTTON}+ >+ <ReloadIcon className="h-4 w-4" />+ </button>+ <button+ type="button"+ title="Open in new tab"+ aria-label="Open browser in new tab"+ onClick={openInNewTab}+ disabled={!browserSessionId}+ className={ICON_BUTTON}+ >+ <OpenInNewWindowIcon className="h-4 w-4" />+ </button>+ <StreamModeBadge mode={browserStreamingMode} className="shrink-0" />+ <Dialog+ open={confirmOff}+ onOpenChange={(open) => {+ if (!open && cycleBrowser.isPending) {+ return;+ }+ setConfirmOff(open);+ }}+ >+ <DialogTrigger asChild>+ <button+ type="button"+ title="Turn off browser"+ aria-label="Turn off browser"+ disabled={!workflowPermanentId || !browserSessionId}+ className={ICON_BUTTON}+ >+ <PowerIcon className="h-4 w-4" />+ </button>+ </DialogTrigger>+ <DialogContent>+ <DialogHeader>+ <DialogTitle>Turn off this browser?</DialogTitle>+ <DialogDescription>+ This ends the current browser and starts a fresh one. Anything+ in progress here will stop.+ </DialogDescription>+ </DialogHeader>+ <DialogFooter>+ <DialogClose asChild>+ <Button variant="secondary" disabled={cycleBrowser.isPending}>+ Cancel+ </Button>+ </DialogClose>+ <Button+ variant="destructive"+ disabled={!workflowPermanentId || cycleBrowser.isPending}+ onClick={() =>+ workflowPermanentId &&+ cycleBrowser.mutate(workflowPermanentId)+ }+ >+ {cycleBrowser.isPending ? (+ <>+ <ReloadIcon className="mr-2 size-4 animate-spin" />+ Turning off…+ </>+ ) : (+ "Turn off"+ )}+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ </div>++ <div className="relative flex min-h-0 flex-1 items-center justify-center overflow-hidden rounded-lg border border-border bg-slate-950">+ {browserSessionId ? (+ <div ref={setBrowserStreamSlot} className="absolute inset-0" />+ ) : (+ <StreamStatusPanel+ diagnostic={{+ title: "Warming up your browser",+ detail:+ "Spinning up the debug browser — this only takes a moment.",+ pending: true,+ }}+ />+ )}+ </div>+ </div>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/CopilotRail.tsx b/skyvern-frontend/src/routes/workflows/studio/CopilotRail.tsxnew file mode 100644index 000000000..bc7014842--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/CopilotRail.tsx@@ -0,0 +1,24 @@+import { ChevronRightIcon } from "@radix-ui/react-icons";++export function CopilotRail({ onExpand }: { onExpand: () => void }) {+ return (+ <div className="flex h-full w-full flex-col items-center gap-3 rounded-lg border border-border bg-slate-elevation1 py-3">+ <button+ type="button"+ onClick={onExpand}+ title="Show Copilot"+ aria-label="Show Copilot"+ className="rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"+ >+ <ChevronRightIcon className="h-4 w-4" />+ </button>+ <span className="h-2 w-2 rounded-full bg-studio-accent shadow-[0_0_0_4px_rgba(109,108,246,0.18)]" />+ <span+ className="mt-1 text-xs font-medium tracking-wide text-muted-foreground"+ style={{ writingMode: "vertical-rl" }}+ >+ Copilot+ </span>+ </div>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/EditorTab.tsx b/skyvern-frontend/src/routes/workflows/studio/EditorTab.tsxnew file mode 100644index 000000000..2c5329bde--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/EditorTab.tsx@@ -0,0 +1,22 @@+import { type ComponentProps } from "react";++import { Workspace } from "@/routes/workflows/editor/Workspace";++// PiP shelved for now — no good placement (copilot left, settings right, Pylon corner).+// import { BrowserPiP } from "./BrowserPiP";++export type StudioWorkspaceProps = Omit<+ ComponentProps<typeof Workspace>,+ "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).+export function EditorTab(props: StudioWorkspaceProps) {+ return (+ <div className="relative h-full w-full">+ <Workspace {...props} showBrowser={false} embedded />+ {/* <BrowserPiP /> */}+ </div>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/RunTab.tsx b/skyvern-frontend/src/routes/workflows/studio/RunTab.tsxnew file mode 100644index 000000000..6b1148f4e--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/RunTab.tsx@@ -0,0 +1,32 @@+import { useNavigate, useParams } from "react-router-dom";++import { useStudioShellStore } from "@/store/StudioShellStore";++import { useWorkflowRunsQuery } from "../hooks/useWorkflowRunsQuery";+import { RunView } from "./runview/RunView";+import { useStudioRunId } from "./useStudioRunId";++/**+ * Run tab of the studio shell — the fused hero + filmstrip RunView. Shows the+ * run in the URL when present, otherwise the workflow's most recent run.+ */+export function RunTab() {+ const navigate = useNavigate();+ const urlRunId = useStudioRunId();+ const { workflowPermanentId } = useParams();+ const setCopilotCollapsed = useStudioShellStore((s) => s.setCopilotCollapsed);+ const { data: runs } = useWorkflowRunsQuery({+ workflowPermanentId,+ page: 1,+ pageSize: 1,+ });+ const runId = urlRunId ?? runs?.[0]?.workflow_run_id;++ return (+ <RunView+ workflowRunId={runId}+ onFix={() => setCopilotCollapsed(false)}+ onRetry={() => navigate(`/workflows/${workflowPermanentId}/run`)}+ />+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/StreamPresenter.tsx b/skyvern-frontend/src/routes/workflows/studio/StreamPresenter.tsxnew file mode 100644index 000000000..7657b44c0--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/StreamPresenter.tsx@@ -0,0 +1,48 @@+import { BrowserStream } from "@/components/BrowserStream";+import { useBrowserStreamingMode } from "@/hooks/useRuntimeConfig";+import { BrowserSessionStream } from "@/routes/browserSessions/BrowserSessionStream";++type StreamPresenterProps = {+ browserSessionId: string;+ interactive?: boolean;+ showControlButtons?: boolean;+ isRecording?: boolean;+ // Only the CDP transport carries the page URL; VNC is pixels-only and never+ // calls this.+ onUrlChange?: (url: string) => void;+};++/**+ * Transport-agnostic live browser stream: picks VNC vs CDP from runtime config,+ * honoring the recording override (recording requires VNC).+ */+export function StreamPresenter({+ browserSessionId,+ interactive = false,+ showControlButtons = false,+ isRecording = false,+ onUrlChange,+}: StreamPresenterProps) {+ const { browserStreamingMode } = useBrowserStreamingMode();+ const useCdp = browserStreamingMode === "cdp" && !isRecording;++ if (useCdp) {+ return (+ <BrowserSessionStream+ browserSessionId={browserSessionId}+ interactive={interactive}+ showControlButtons={showControlButtons}+ onUrlChange={onUrlChange}+ />+ );+ }++ return (+ <BrowserStream+ browserSessionId={browserSessionId}+ interactive={interactive}+ showControlButtons={showControlButtons}+ exfiltrate={isRecording}+ />+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioBrowserStream.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioBrowserStream.tsxnew file mode 100644index 000000000..1aec92626--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/StudioBrowserStream.tsx@@ -0,0 +1,47 @@+import { useEffect } from "react";+import { useParams } from "react-router-dom";++import { useRecordingStore } from "@/store/useRecordingStore";+import { useStudioBrowserStore } from "@/store/useStudioBrowserStore";+import { useStudioShellStore } from "@/store/StudioShellStore";++import { useDebugSessionQuery } from "../hooks/useDebugSessionQuery";+import { StreamPresenter } from "./StreamPresenter";++/**+ * The studio's single live-browser stream, portaled into a host node re-parented+ * between the PiP and Browser tab so the socket persists instead of re-booting.+ */+export function StudioBrowserStream() {+ const { workflowPermanentId } = useParams();+ const tab = useStudioShellStore((s) => s.tab);+ const isRecording = useRecordingStore((s) => s.isRecording);+ const reloadNonce = useStudioBrowserStore((s) => s.reloadNonce);+ const setStreamUrl = useStudioBrowserStore((s) => s.setStreamUrl);+ const reset = useStudioBrowserStore((s) => s.reset);+ const { data: debugSession } = useDebugSessionQuery({+ workflowPermanentId,+ enabled: false,+ });+ const browserSessionId = debugSession?.browser_session_id ?? null;++ useEffect(() => {+ reset();+ return () => reset();+ }, [browserSessionId, reset]);++ if (!browserSessionId) {+ return null;+ }++ return (+ <StreamPresenter+ key={`${browserSessionId}:${reloadNonce}`}+ browserSessionId={browserSessionId}+ interactive={false}+ showControlButtons={tab === "browser"}+ isRecording={isRecording}+ onUrlChange={setStreamUrl}+ />+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioShell.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioShell.tsxnew file mode 100644index 000000000..349a09074--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/StudioShell.tsx@@ -0,0 +1,196 @@+import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";+import { createPortal } from "react-dom";+import { useSearchParams } from "react-router-dom";++import { useStudioShellStore } from "@/store/StudioShellStore";+import { cn } from "@/util/utils";++import { BrowserTab } from "./BrowserTab";+import { CopilotRail } from "./CopilotRail";+import { EditorTab, type StudioWorkspaceProps } from "./EditorTab";+import { RunTab } from "./RunTab";+import { StudioBrowserStream } from "./StudioBrowserStream";+import {+ STUDIO_COPILOT_RAIL_WIDTH,+ STUDIO_COPILOT_WIDTH,+ studioPanelId,+ studioTabId,+} from "./constants";+import { StudioShellContext } from "./StudioShellContext";+import { StudioTopBar } from "./StudioTopBar";+import { StudioWorkflowPanels } from "./StudioWorkflowPanels";+import { usePresence } from "./usePresence";++/**+ * Spine + Stage shell: a persistent Copilot column beside a Stage that swaps the+ * Editor and Run tabs. The Copilot is portaled in from the embedded Workspace.+ */+export function StudioShell(props: StudioWorkspaceProps) {+ const tab = useStudioShellStore((s) => s.tab);+ const setTab = useStudioShellStore((s) => s.setTab);+ const copilotCollapsed = useStudioShellStore((s) => s.copilotCollapsed);+ const setCopilotCollapsed = useStudioShellStore((s) => s.setCopilotCollapsed);+ const pipMinimized = useStudioShellStore((s) => s.pipMinimized);+ const [copilotPortalEl, setCopilotPortalEl] = useState<HTMLElement | null>(+ null,+ );++ // The live browser stream is mounted once into this detached host and+ // re-parented into the active surface, so it never remounts on tab switch.+ const [streamHostEl] = useState(() => {+ const el = document.createElement("div");+ el.className = "h-full w-full";+ return el;+ });+ const [editorStreamSlot, setEditorStreamSlot] = useState<HTMLElement | null>(+ null,+ );+ const [browserStreamSlot, setBrowserStreamSlot] =+ useState<HTMLElement | null>(null);+ const [streamHolderEl, setStreamHolderEl] = useState<HTMLElement | null>(+ null,+ );++ // Move the persistent stream node into the showing surface (PiP / Browser tab),+ // parking it in the offscreen holder otherwise so the socket stays warm.+ useLayoutEffect(() => {+ const activeSlot =+ tab === "browser"+ ? browserStreamSlot+ : tab === "editor" && !pipMinimized+ ? editorStreamSlot+ : null;+ const dest = activeSlot ?? streamHolderEl;+ if (dest && streamHostEl.parentElement !== dest) {+ // BrowserStream re-asserts scaleViewport on its own resize, so it rescales+ // itself on re-parent to a different-sized slot — no resize nudge needed.+ dest.appendChild(streamHostEl);+ }+ }, [+ tab,+ pipMinimized,+ editorStreamSlot,+ browserStreamSlot,+ streamHolderEl,+ streamHostEl,+ ]);++ const shellContextValue = useMemo(+ () => ({ copilotPortalEl, setEditorStreamSlot, setBrowserStreamSlot }),+ [copilotPortalEl],+ );++ // Pick the initial tab from the deep link ONCE per mount; must not re-fire on+ // later URL writes (the Run tab writes ?wr=/?active=) or it fights manual switches.+ const [searchParams] = useSearchParams();+ const deepLinkRunId = searchParams.get("wr");+ const deepLinkBlockLabel = searchParams.get("bl");+ const deepLinkActive = searchParams.get("active");+ const initialTabAppliedRef = useRef(false);+ useEffect(() => {+ if (initialTabAppliedRef.current) {+ return;+ }+ initialTabAppliedRef.current = true;+ if (deepLinkRunId && deepLinkBlockLabel) {+ setTab("browser");+ return;+ }+ if (deepLinkRunId || deepLinkActive) {+ setTab("run");+ return;+ }+ setTab("editor");+ }, [deepLinkRunId, deepLinkBlockLabel, deepLinkActive, setTab]);++ const copilotWidth = copilotCollapsed+ ? STUDIO_COPILOT_RAIL_WIDTH+ : STUDIO_COPILOT_WIDTH;++ // Keep the collapsed rail mounted briefly after expanding so it can fade out.+ const railPresent = usePresence(copilotCollapsed, 150);++ return (+ <StudioShellContext.Provider value={shellContextValue}>+ <div className="flex h-full w-full flex-col">+ <StudioTopBar />+ <div+ className="grid min-h-0 flex-1"+ style={{+ gridTemplateColumns: `${copilotWidth}px minmax(0, 1fr)`,+ gridTemplateRows: "minmax(0, 1fr)",+ }}+ >+ {/* Copilot portal target. Kept mounted (parked offscreen) when+ collapsed so an in-flight Copilot stream isn't torn down. */}+ <div className="relative h-full min-w-0">+ <div+ ref={setCopilotPortalEl}+ className={+ copilotCollapsed+ ? "h-0 w-0 overflow-hidden"+ : "h-full w-full py-3 pl-3 duration-150 animate-in fade-in slide-in-from-left-2"+ }+ />+ {railPresent ? (+ <div+ // Fixed rail width so it doesn't stretch to the expanded+ // column while fading out on expand.+ style={{ width: STUDIO_COPILOT_RAIL_WIDTH }}+ className={cn(+ "absolute left-0 top-0 h-full py-3 pl-3 duration-150",+ copilotCollapsed+ ? "animate-in fade-in"+ : "animate-out fade-out",+ )}+ >+ <CopilotRail onExpand={() => setCopilotCollapsed(false)} />+ </div>+ ) : null}+ </div>+ <div className="relative h-full min-h-0 min-w-0 overflow-hidden">+ <div+ role="tabpanel"+ id={studioPanelId("editor")}+ aria-labelledby={studioTabId("editor")}+ className={+ tab === "editor" ? "h-full w-full" : "hidden h-full w-full"+ }+ >+ <EditorTab {...props} />+ </div>+ {/* Kept mounted (CSS-hidden) so its stream slot stays registered;+ the persistent stream node is re-parented in, not remounted. */}+ <div+ role="tabpanel"+ id={studioPanelId("browser")}+ aria-labelledby={studioTabId("browser")}+ className={+ tab === "browser" ? "h-full w-full" : "hidden h-full w-full"+ }+ >+ <BrowserTab />+ </div>+ <div+ role="tabpanel"+ id={studioPanelId("run")}+ aria-labelledby={studioTabId("run")}+ className={+ tab === "run" ? "h-full w-full" : "hidden h-full w-full"+ }+ >+ <RunTab />+ </div>+ <StudioWorkflowPanels />+ </div>+ </div>+ <div+ ref={setStreamHolderEl}+ aria-hidden+ className="h-0 w-0 overflow-hidden"+ />+ {createPortal(<StudioBrowserStream />, streamHostEl)}+ </div>+ </StudioShellContext.Provider>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioShellContext.ts b/skyvern-frontend/src/routes/workflows/studio/StudioShellContext.tsnew file mode 100644index 000000000..a05bd02ce--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/StudioShellContext.ts@@ -0,0 +1,21 @@+import { createContext, useContext } from "react";++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;+ // 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;+};++export const StudioShellContext = createContext<StudioShellContextValue>({+ copilotPortalEl: null,+ setEditorStreamSlot: () => {},+ setBrowserStreamSlot: () => {},+});++export function useStudioShellContext(): StudioShellContextValue {+ return useContext(StudioShellContext);+}diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsxnew file mode 100644index 000000000..2043285ec--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsx@@ -0,0 +1,388 @@+import { type KeyboardEvent, type ReactNode } from "react";+import { AxiosError } from "axios";+import {+ CalendarIcon,+ PlayIcon,+ ReloadIcon,+ StopIcon,+} from "@radix-ui/react-icons";+import { useMutation, useQueryClient } from "@tanstack/react-query";+import { useNavigate, useParams } from "react-router-dom";++import { getClient } from "@/api/AxiosClient";+import { SaveIcon } from "@/components/icons/SaveIcon";+import { Button } from "@/components/ui/button";+import {+ Dialog,+ DialogClose,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ DialogTrigger,+} from "@/components/ui/dialog";+import { toast } from "@/components/ui/use-toast";+import { useCredentialGetter } from "@/hooks/useCredentialGetter";+import { useCacheKeyValueStore } from "@/store/CacheKeyValueStore";+import { useRecordingStore } from "@/store/useRecordingStore";+import { useStudioShellStore, type StudioTab } from "@/store/StudioShellStore";+import { useWorkflowHasChangesStore } from "@/store/WorkflowHasChangesStore";+import { useWorkflowPanelStore } from "@/store/WorkflowPanelStore";+import { useWorkflowTitleStore } from "@/store/WorkflowTitleStore";+import { cn } from "@/util/utils";++import { EditableNodeTitle } from "../editor/nodes/components/EditableNodeTitle";+import { EditorOverflowMenu } from "../editor/header/EditorOverflowMenu";+import { MakeACopyButton } from "../editor/MakeACopyButton";+import { useIsGeneratingCode } from "../editor/hooks/useIsGeneratingCode";+import { useSaveWorkflow } from "../editor/hooks/useSaveWorkflow";+import { useGlobalWorkflowsQuery } from "../hooks/useGlobalWorkflowsQuery";+import { useWorkflowQuery } from "../hooks/useWorkflowQuery";+import { useWorkflowRunWithWorkflowQuery } from "../hooks/useWorkflowRunWithWorkflowQuery";+import { useWorkflowRunsQuery } from "../hooks/useWorkflowRunsQuery";+import { studioPanelId, studioTabId } from "./constants";+import { runOutcomeFromStatus } from "./runProjections";+import { useStudioRunId } from "./useStudioRunId";++function useIsGlobalWorkflow(): boolean {+ const { workflowPermanentId } = useParams();+ const { data: globalWorkflows } = useGlobalWorkflowsQuery();+ return Boolean(+ globalWorkflows?.some(+ (w) => w.workflow_permanent_id === workflowPermanentId,+ ),+ );+}++function GeneratingCodeIndicator() {+ const { workflowPermanentId } = useParams();+ const urlRunId = useStudioRunId();+ const { data: runs } = useWorkflowRunsQuery({+ workflowPermanentId,+ page: 1,+ pageSize: 1,+ });+ const workflowRunId = urlRunId ?? runs?.[0]?.workflow_run_id;+ const { data: workflow } = useWorkflowQuery({ workflowPermanentId });+ const cacheKeyValue = useCacheKeyValueStore((s) => s.cacheKeyValue);+ const isGeneratingCode = useIsGeneratingCode({+ cacheKey: workflow?.cache_key ?? "",+ cacheKeyValue,+ workflowPermanentId,+ workflowRunId,+ });++ if (!isGeneratingCode) {+ return null;+ }++ return (+ <span+ className="inline-flex items-center gap-2 rounded-md bg-slate-elevation3 px-3 py-1.5 text-sm font-medium text-muted-foreground"+ title="Generating cached code for this run"+ >+ <ReloadIcon className="size-4 animate-spin" />+ Code+ </span>+ );+}++function StudioTabs() {+ const tab = useStudioShellStore((s) => s.tab);+ const setTab = useStudioShellStore((s) => s.setTab);+ const urlRunId = useStudioRunId();+ const { workflowPermanentId } = useParams();+ const { data: urlRun } = useWorkflowRunWithWorkflowQuery(+ urlRunId ? { workflowRunId: urlRunId } : undefined,+ );+ const { data: runs } = useWorkflowRunsQuery({+ workflowPermanentId,+ page: 1,+ pageSize: 1,+ });+ const latestRun = runs?.[0];+ const hasRun = Boolean(urlRunId) || (runs?.length ?? 0) > 0;+ const outcome = runOutcomeFromStatus(+ urlRunId ? urlRun?.status : latestRun?.status,+ );++ const runBadge =+ outcome === "running"+ ? { label: "live", cls: "bg-studio-accent/20 text-studio-accent-2" }+ : outcome === "failed"+ ? { label: "failed", cls: "bg-destructive/20 text-destructive" }+ : outcome === "success"+ ? { label: "passed", cls: "bg-success/20 text-success" }+ : null;++ const tabs: Array<{ id: StudioTab; label: string; disabled: boolean }> = [+ { id: "editor", label: "Editor", disabled: false },+ { id: "browser", label: "Browser", disabled: false },+ { id: "run", label: "Run", disabled: !hasRun },+ ];++ // Roving arrow-key navigation across the enabled tabs (WAI-ARIA tabs).+ const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {+ const keys = ["ArrowRight", "ArrowLeft", "Home", "End"];+ if (!keys.includes(event.key)) {+ return;+ }+ event.preventDefault();+ const enabled = tabs.filter((t) => !t.disabled);+ const current = enabled.findIndex((t) => t.id === tab);+ const last = enabled.length - 1;+ const nextIndex =+ event.key === "ArrowRight"+ ? (current + 1) % enabled.length+ : event.key === "ArrowLeft"+ ? (current - 1 + enabled.length) % enabled.length+ : event.key === "Home"+ ? 0+ : last;+ const next = enabled[nextIndex];+ if (next) {+ setTab(next.id);+ document.getElementById(studioTabId(next.id))?.focus();+ }+ };++ return (+ <div+ role="tablist"+ aria-label="Studio view"+ className="flex items-center gap-1"+ onKeyDown={onKeyDown}+ >+ {tabs.map((t) => {+ const selected = tab === t.id;+ return (+ <button+ key={t.id}+ id={studioTabId(t.id)}+ type="button"+ role="tab"+ aria-selected={selected}+ aria-controls={studioPanelId(t.id)}+ tabIndex={selected ? 0 : -1}+ disabled={t.disabled}+ onClick={() => !t.disabled && setTab(t.id)}+ className={cn(+ "flex items-center gap-2 rounded-md px-3 py-1.5 text-sm font-medium transition-colors",+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",+ selected+ ? "bg-studio-accent/15 text-studio-accent-2 ring-1 ring-inset ring-studio-accent/40"+ : "text-muted-foreground hover:bg-slate-elevation3 hover:text-foreground",+ t.disabled &&+ "cursor-default opacity-50 hover:bg-transparent hover:text-muted-foreground",+ )}+ >+ {t.label}+ {t.id === "run" && runBadge ? (+ <span+ className={cn(+ "rounded px-1.5 py-0.5 text-[10px] font-semibold",+ runBadge.cls,+ )}+ >+ {runBadge.label}+ </span>+ ) : null}+ </button>+ );+ })}+ </div>+ );+}++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">+ <EditableNodeTitle+ editable={editable && !isRecording}+ value={title}+ onChange={(next) => {+ setTitle(next);+ setHasChanges(true);+ }}+ titleClassName="text-base"+ inputClassName="text-base"+ />+ </div>+ );+}++function SaveButton() {+ const saving = useWorkflowHasChangesStore((s) => s.saveIsPending);+ 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>+ );+}++function PanelToggle({+ content,+ label,+ icon,+}: {+ content: "parameters" | "schedules";+ label: string;+ icon?: ReactNode;+}) {+ const state = useWorkflowPanelStore((s) => s.workflowPanelState);+ const setState = useWorkflowPanelStore((s) => s.setWorkflowPanelState);+ const close = useWorkflowPanelStore((s) => s.closeWorkflowPanel);+ const isRecording = useRecordingStore((s) => s.isRecording);+ const isOpen = state.active && state.content === content;+ return (+ <Button+ variant="tertiary"+ size={icon ? "icon" : "lg"}+ className={icon ? "size-9" : undefined}+ disabled={isRecording}+ onClick={() => (isOpen ? close() : setState({ active: true, content }))}+ title={label}+ aria-label={label}+ >+ {icon ?? label}+ </Button>+ );+}++function RunStopButton() {+ const navigate = useNavigate();+ const { workflowPermanentId } = useParams();+ const runId = useStudioRunId();+ const queryClient = useQueryClient();+ const credentialGetter = useCredentialGetter();+ const isRecording = useRecordingStore((s) => s.isRecording);+ const { data: workflowRun } = useWorkflowRunWithWorkflowQuery(+ runId ? { workflowRunId: runId } : undefined,+ );+ const activeRunId = workflowRun?.workflow_run_id;+ const running = runOutcomeFromStatus(workflowRun?.status) === "running";++ const cancelRun = useMutation({+ mutationFn: async () => {+ const client = await getClient(credentialGetter);+ return client+ .post(`/workflows/runs/${activeRunId}/cancel`)+ .then((response) => response.data);+ },+ onSuccess: () => {+ queryClient.invalidateQueries({ queryKey: ["workflowRun", activeRunId] });+ queryClient.invalidateQueries({+ queryKey: ["workflowRun", workflowPermanentId, activeRunId],+ });+ queryClient.invalidateQueries({ queryKey: ["workflowRuns"] });+ toast({+ variant: "success",+ title: "Run canceled",+ description: "The agent run has been canceled.",+ });+ },+ onError: (error: AxiosError) => {+ toast({+ variant: "destructive",+ title: "Failed to cancel run",+ description: error.message,+ });+ },+ });++ if (running && activeRunId) {+ return (+ <Dialog>+ <DialogTrigger asChild>+ <Button+ variant="destructive"+ size="lg"+ disabled={cancelRun.isPending || isRecording}+ >+ {cancelRun.isPending ? (+ <ReloadIcon className="mr-2 size-4 animate-spin" />+ ) : (+ <StopIcon className="mr-2 size-4" />+ )}+ Stop+ </Button>+ </DialogTrigger>+ <DialogContent>+ <DialogHeader>+ <DialogTitle>Stop this run?</DialogTitle>+ <DialogDescription>+ The agent will stop where it is. You can rerun the workflow at any+ time.+ </DialogDescription>+ </DialogHeader>+ <DialogFooter>+ <DialogClose asChild>+ <Button variant="secondary">Keep running</Button>+ </DialogClose>+ <DialogClose asChild>+ <Button variant="destructive" onClick={() => cancelRun.mutate()}>+ Stop run+ </Button>+ </DialogClose>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ );+ }+ return (+ <Button+ size="lg"+ className="bg-studio-accent text-studio-accent-foreground hover:bg-studio-accent/90"+ disabled={isRecording}+ onClick={() => navigate(`/workflows/${workflowPermanentId}/run`)}+ >+ <PlayIcon className="mr-2 size-4" /> Run+ </Button>+ );+}++export function StudioTopBar() {+ const isGlobalWorkflow = useIsGlobalWorkflow();+ return (+ <div className="flex h-14 shrink-0 items-center gap-3 border-b border-border bg-slate-elevation2 px-4">+ <TitleSection editable={!isGlobalWorkflow} />+ <StudioTabs />+ <div className="flex-1" />+ <GeneratingCodeIndicator />+ {isGlobalWorkflow ? (+ <MakeACopyButton />+ ) : (+ <div data-tour="editor-actions" className="flex items-center gap-3">+ <SaveButton />+ <PanelToggle+ content="schedules"+ label="Schedule"+ icon={<CalendarIcon className="size-5" />}+ />+ <EditorOverflowMenu />+ <div className="mx-1 h-6 w-px bg-border" />+ <PanelToggle content="parameters" label="Inputs" />+ <RunStopButton />+ </div>+ )}+ </div>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioWorkflowPanels.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioWorkflowPanels.tsxnew file mode 100644index 000000000..3726191f6--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/StudioWorkflowPanels.tsx@@ -0,0 +1,39 @@+import { useWorkflowPanelStore } from "@/store/WorkflowPanelStore";++import { WorkflowParametersPanel } from "../editor/panels/WorkflowParametersPanel";+import { WorkflowSchedulePanel } from "../editor/panels/schedulePanel/WorkflowSchedulePanel";++/**+ * Inputs / Schedule panels rendered at shell level so they open over any tab —+ * the editor canvas is display:none on Browser/Run tabs and would hide them.+ */+export function StudioWorkflowPanels() {+ const state = useWorkflowPanelStore((s) => s.workflowPanelState);+ const close = useWorkflowPanelStore((s) => s.closeWorkflowPanel);++ const content =+ state.active &&+ (state.content === "parameters" || state.content === "schedules")+ ? state.content+ : null;+ if (!content) {+ return null;+ }++ return (+ <>+ <div className="absolute inset-0 z-30" onClick={close} />+ {content === "parameters" ? (+ // No overflow clipping: the "Add Input" form opens to the panel's left+ // (negative offset), and overflow-y:auto would force overflow-x and clip it.+ <div className="absolute right-3 top-3 z-40">+ <WorkflowParametersPanel />+ </div>+ ) : (+ <div className="absolute right-3 top-3 z-40 max-h-[calc(100%-1.5rem)] overflow-y-auto">+ <WorkflowSchedulePanel onClose={close} />+ </div>+ )}+ </>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/constants.ts b/skyvern-frontend/src/routes/workflows/studio/constants.tsnew file mode 100644index 000000000..edcb0d3e2--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/constants.ts@@ -0,0 +1,7 @@+// Width of the docked Copilot spine (px), and its collapsed-rail width.+export const STUDIO_COPILOT_WIDTH = 450;+export const STUDIO_COPILOT_RAIL_WIDTH = 60;++// Stable element ids linking each tab to its panel (WAI-ARIA tabs pattern).+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/runProjections.test.ts b/skyvern-frontend/src/routes/workflows/studio/runProjections.test.tsnew file mode 100644index 000000000..8de4eb1bf--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/runProjections.test.ts@@ -0,0 +1,265 @@+import { describe, expect, test } from "vitest";++import { ActionsApiResponse, Status } from "@/api/types";+import {+ WorkflowRunBlock,+ WorkflowRunTimelineBlockItem,+ WorkflowRunTimelineItem,+} from "@/routes/workflows/types/workflowRunTypes";+import {+ buildActionIndex,+ buildBlockStatusMap,+ buildFilmstrip,+ runOutcomeFromStatus,+} from "./runProjections";++let idCounter = 0;+const uid = (prefix: string) => `${prefix}_${++idCounter}`;++function action(+ overrides: Partial<ActionsApiResponse> = {},+): ActionsApiResponse {+ return {+ action_id: uid("act"),+ action_type: "click",+ status: Status.Completed,+ task_id: null,+ step_id: "step_1",+ step_order: 0,+ action_order: 0,+ confidence_float: null,+ description: null,+ reasoning: null,+ intention: null,+ response: null,+ created_by: null,+ text: null,+ screenshot_artifact_id: null,+ ...overrides,+ };+}++function blockItem(+ block: Partial<WorkflowRunBlock>,+ children: WorkflowRunTimelineItem[] = [],+): WorkflowRunTimelineBlockItem {+ return {+ type: "block",+ thought: null,+ children,+ created_at: "2026-01-01T00:00:00Z",+ modified_at: "2026-01-01T00:00:00Z",+ block: {+ workflow_run_block_id: uid("wrb"),+ workflow_run_id: "wr_1",+ parent_workflow_run_block_id: null,+ block_type: "task",+ label: null,+ description: null,+ title: null,+ status: Status.Completed,+ failure_reason: null,+ output: null,+ continue_on_failure: false,+ task_id: null,+ url: null,+ navigation_goal: null,+ navigation_payload: null,+ data_extraction_goal: null,+ data_schema: null,+ terminate_criterion: null,+ complete_criterion: null,+ include_action_history_in_verification: null,+ engine: null,+ actions: null,+ created_at: "2026-01-01T00:00:00Z",+ modified_at: "2026-01-01T00:00:00Z",+ duration: null,+ loop_values: null,+ current_value: null,+ current_index: null,+ ...block,+ },+ };+}++describe("runOutcomeFromStatus", () => {+ test("idle when there is no status", () => {+ expect(runOutcomeFromStatus(null)).toBe("idle");+ expect(runOutcomeFromStatus(undefined)).toBe("idle");+ });++ test("running for in-flight statuses", () => {+ expect(runOutcomeFromStatus(Status.Created)).toBe("running");+ expect(runOutcomeFromStatus(Status.Queued)).toBe("running");+ expect(runOutcomeFromStatus(Status.Running)).toBe("running");+ expect(runOutcomeFromStatus(Status.Paused)).toBe("running");+ });++ test("success only for completed", () => {+ expect(runOutcomeFromStatus(Status.Completed)).toBe("success");+ });++ test("failed for failure types and canceled", () => {+ expect(runOutcomeFromStatus(Status.Failed)).toBe("failed");+ expect(runOutcomeFromStatus(Status.Terminated)).toBe("failed");+ expect(runOutcomeFromStatus(Status.TimedOut)).toBe("failed");+ expect(runOutcomeFromStatus(Status.Canceled)).toBe("failed");+ });+});++describe("buildFilmstrip", () => {+ test("empty or undefined timeline yields no frames", () => {+ expect(buildFilmstrip(undefined)).toEqual([]);+ expect(buildFilmstrip([])).toEqual([]);+ });++ test("orders a block's actions oldest-first with a 1-based index", () => {+ // block.actions arrives newest-first (created_at desc); the strip reverses+ // it to oldest-first so it matches the run timeline tree.+ const frames = buildFilmstrip([+ blockItem({+ label: "block_1",+ actions: [+ action({ action_id: "newest", action_type: "click" }),+ action({ action_id: "oldest", action_type: "goto_url" }),+ ],+ }),+ ]);+ expect(frames.map((f) => f.id)).toEqual(["oldest", "newest"]);+ expect(frames.map((f) => f.index)).toEqual([1, 2]);+ expect(frames.map((f) => f.isBlockStart)).toEqual([true, false]);+ });++ test("marks block boundaries across a multi-block run", () => {+ const frames = buildFilmstrip([+ blockItem({+ workflow_run_block_id: "b1",+ label: "block_1",+ actions: [action({ action_id: "a1" })],+ }),+ blockItem({+ workflow_run_block_id: "b2",+ label: "block_2",+ actions: [action({ action_id: "a2" }), action({ action_id: "a3" })],+ }),+ ]);+ expect(frames.map((f) => f.isBlockStart)).toEqual([true, true, false]);+ expect(frames.map((f) => f.index)).toEqual([1, 2, 3]);+ expect(frames.map((f) => f.blockLabel)).toEqual([+ "block_1",+ "block_2",+ "block_2",+ ]);+ });++ test("recurses into loop children", () => {+ const frames = buildFilmstrip([+ blockItem({ block_type: "for_loop", label: "loop", actions: null }, [+ blockItem({+ workflow_run_block_id: "i1",+ label: "inner",+ actions: [action({ action_id: "a1" })],+ }),+ blockItem({+ workflow_run_block_id: "i2",+ label: "inner",+ actions: [action({ action_id: "a2" })],+ }),+ ]),+ ]);+ expect(frames.map((f) => f.id)).toEqual(["a1", "a2"]);+ });++ test("label prefers intention, then description, then readable action type", () => {+ // Actions are passed newest-first; the strip renders them oldest-first.+ const frames = buildFilmstrip([+ blockItem({+ label: "b",+ actions: [+ action({ intention: "Submit search", description: "x" }),+ action({ intention: null, description: "Dismiss cookie" }),+ action({+ intention: null,+ description: null,+ reasoning: null,+ action_type: "scroll",+ }),+ ],+ }),+ ]);+ expect(frames.map((f) => f.label)).toEqual([+ "Scroll",+ "Dismiss cookie",+ "Submit search",+ ]);+ });+});++describe("buildBlockStatusMap", () => {+ test("keys by label with status, action count, and failure reason", () => {+ const map = buildBlockStatusMap([+ blockItem({+ label: "block_1",+ status: Status.Completed,+ actions: [action(), action()],+ }),+ blockItem({+ label: "block_2",+ status: Status.Failed,+ failure_reason: "boom",+ actions: [action()],+ }),+ ]);+ expect(map["block_1"]).toMatchObject({+ status: Status.Completed,+ actionCount: 2,+ });+ expect(map["block_2"]).toMatchObject({+ status: Status.Failed,+ failureReason: "boom",+ actionCount: 1,+ });+ });++ test("latest occurrence wins for looped block labels", () => {+ const map = buildBlockStatusMap([+ blockItem({ block_type: "for_loop", label: "loop", actions: null }, [+ blockItem({+ label: "inner",+ status: Status.Completed,+ actions: [action()],+ }),+ blockItem({+ label: "inner",+ status: Status.Failed,+ actions: [action(), action()],+ }),+ ]),+ ]);+ expect(map["inner"]).toMatchObject({+ status: Status.Failed,+ actionCount: 2,+ });+ });+});++describe("buildActionIndex", () => {+ test("maps action_id to the action across blocks and loop children", () => {+ const a1 = action({ action_id: "a1" });+ const a2 = action({ action_id: "a2" });+ const index = buildActionIndex([+ blockItem({ label: "block_1", actions: [a1] }),+ blockItem({ block_type: "for_loop", label: "loop", actions: null }, [+ blockItem({ label: "inner", actions: [a2] }),+ ]),+ ]);+ expect(index.get("a1")).toBe(a1);+ expect(index.get("a2")).toBe(a2);+ expect(index.size).toBe(2);+ });++ test("empty timeline yields an empty index", () => {+ expect(buildActionIndex(undefined).size).toBe(0);+ });+});diff --git a/skyvern-frontend/src/routes/workflows/studio/runProjections.ts b/skyvern-frontend/src/routes/workflows/studio/runProjections.tsnew file mode 100644index 000000000..dad6d27e6--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/runProjections.ts@@ -0,0 +1,194 @@+import {+ ActionsApiResponse,+ ActionType,+ ReadableActionTypes,+ Status,+} from "@/api/types";+import { statusIsAFailureType } from "@/routes/tasks/types";+import {+ isBlockItem,+ WorkflowRunTimelineItem,+} from "@/routes/workflows/types/workflowRunTypes";+import { flattenTimelineChronologically } from "@/routes/workflows/workflowRun/workflowTimelineUtils";+import { normalizeUtcTimestamp } from "@/util/timeFormat";++export type RunOutcome = "idle" | "running" | "failed" | "success";++// Run timestamps are naive ISO (no Z), so normalize to UTC before diffing — else+// a live run's (now - start) is skewed by the local timezone offset.+export function formatElapsed(+ startIso: string | null,+ endIso: string | null,+): string {+ if (!startIso) {+ return "—";+ }+ const start = new Date(normalizeUtcTimestamp(startIso)).getTime();+ if (Number.isNaN(start)) {+ return "—";+ }+ const endMs = endIso+ ? new Date(normalizeUtcTimestamp(endIso)).getTime()+ : Date.now();+ const end = Number.isNaN(endMs) ? Date.now() : endMs;+ const sec = Math.max(0, Math.round((end - start) / 1000));+ if (sec < 60) {+ return `${sec}s`;+ }+ return `${Math.floor(sec / 60)}m ${sec % 60}s`;+}++export function runOutcomeFromStatus(+ status: Status | null | undefined,+): RunOutcome {+ if (!status) {+ return "idle";+ }+ if (status === Status.Completed) {+ return "success";+ }+ if (statusIsAFailureType({ status }) || status === Status.Canceled) {+ return "failed";+ }+ return "running";+}++export type FilmstripFrame = {+ id: string;+ index: number;+ blockId: string;+ blockLabel: string | null;+ isBlockStart: boolean;+ actionType: ActionType;+ label: string;+ status: Status;+ screenshotArtifactId: string | null;+ stepId: string | null;+ actionOrder: number | null;+};++function actionLabel(action: ActionsApiResponse): string {+ const candidate =+ action.intention?.trim() ||+ action.description?.trim() ||+ action.reasoning?.trim();+ if (candidate) {+ // Goto actions surface as "page.goto <url>"; show just the URL.+ return candidate.replace(/^page\.goto\s+/i, "");+ }+ return ReadableActionTypes[action.action_type] ?? action.action_type;+}++/**+ * Flattens the run timeline tree into the ordered action frames the filmstrip+ * renders. Thought items (no screenshot) go to the details panel, not the strip.+ */+export function buildFilmstrip(+ timeline: WorkflowRunTimelineItem[] | undefined,+): FilmstripFrame[] {+ const frames: FilmstripFrame[] = [];++ // Raw timeline is newest-first; flatten chronologically so the strip reads+ // oldest→newest left-to-right and live-edge scroll lands on the newest action.+ const ordered = flattenTimelineChronologically(timeline ?? []);++ const walk = (items: WorkflowRunTimelineItem[]): void => {+ for (const item of items) {+ if (isBlockItem(item)) {+ const block = item.block;+ // block.actions is newest-first; reverse to oldest-first so the strip+ // matches the run timeline tree (which reverses it the same way).+ [...(block.actions ?? [])].reverse().forEach((action, i) => {+ frames.push({+ id: action.action_id ?? `${block.workflow_run_block_id}:${i}`,+ index: 0,+ blockId: block.workflow_run_block_id,+ blockLabel: block.label,+ isBlockStart: false,+ actionType: action.action_type,+ label: actionLabel(action),+ status: action.status,+ screenshotArtifactId: action.screenshot_artifact_id ?? null,+ stepId: action.step_id,+ actionOrder: action.action_order,+ });+ });+ }+ if (item.children.length > 0) {+ walk(item.children);+ }+ }+ };++ walk(ordered);++ frames.forEach((frame, i) => {+ const prev = i > 0 ? frames[i - 1] : undefined;+ frame.index = i + 1;+ frame.isBlockStart = !prev || prev.blockId !== frame.blockId;+ });++ return frames;+}++export type BlockRunState = {+ status: Status | null;+ actionCount: number;+ failureReason: string | null;+ duration: number | null;+};++/**+ * Per-block run state keyed by block label, driving the editor BlockCard's inline+ * status bar. For looped blocks the latest occurrence wins.+ */+export function buildBlockStatusMap(+ timeline: WorkflowRunTimelineItem[] | undefined,+): Record<string, BlockRunState> {+ const byLabel: Record<string, BlockRunState> = {};++ const walk = (items: WorkflowRunTimelineItem[]): void => {+ for (const item of items) {+ if (isBlockItem(item)) {+ const block = item.block;+ if (block.label) {+ byLabel[block.label] = {+ status: block.status,+ actionCount: block.actions?.length ?? 0,+ failureReason: block.failure_reason,+ duration: block.duration,+ };+ }+ }+ if (item.children.length > 0) {+ walk(item.children);+ }+ }+ };++ walk(timeline ?? []);+ return byLabel;+}++/** action_id → action, for the run details panel to look up a pinned frame. */+export function buildActionIndex(+ timeline: WorkflowRunTimelineItem[] | undefined,+): Map<string, ActionsApiResponse> {+ const index = new Map<string, ActionsApiResponse>();+ const walk = (items: WorkflowRunTimelineItem[]): void => {+ for (const item of items) {+ if (isBlockItem(item)) {+ for (const action of item.block.actions ?? []) {+ if (action.action_id) {+ index.set(action.action_id, action);+ }+ }+ }+ if (item.children.length > 0) {+ walk(item.children);+ }+ }+ };+ walk(timeline ?? []);+ return index;+}diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/Filmstrip.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/Filmstrip.tsxnew file mode 100644index 000000000..bf8683b23--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/runview/Filmstrip.tsx@@ -0,0 +1,120 @@+import { Fragment, useEffect, useRef } from "react";+import { CounterClockwiseClockIcon } from "@radix-ui/react-icons";++import { ReadableActionTypes, Status } from "@/api/types";+import { Skeleton } from "@/components/ui/skeleton";+import { statusIsAFailureType } from "@/routes/tasks/types";+import { actionTypeIcons } from "@/routes/workflows/components/actionTypeIcons";+import { useRunViewStore } from "@/store/RunViewStore";+import { cn } from "@/util/utils";++import { FilmstripFrame } from "../runProjections";+import { FilmstripThumbnail } from "./FilmstripThumbnail";++function frameFailed(status: Status): boolean {+ return statusIsAFailureType({ status }) || status === Status.Canceled;+}++export function Filmstrip({+ frames,+ shownFrameId,+ running,+}: {+ frames: FilmstripFrame[];+ shownFrameId: string | null;+ running: boolean;+}) {+ const pinFrame = useRunViewStore((s) => s.pinFrame);+ const pinnedFrameId = useRunViewStore((s) => s.pinnedFrameId);+ const stripRef = useRef<HTMLDivElement>(null);++ // Follow the live edge while the user hasn't pinned a frame.+ useEffect(() => {+ if (pinnedFrameId == null && stripRef.current) {+ stripRef.current.scrollLeft = stripRef.current.scrollWidth;+ }+ }, [frames.length, pinnedFrameId]);++ return (+ <div className="shrink-0 overflow-hidden rounded-lg border border-border bg-slate-elevation2">+ <div className="flex items-center justify-between gap-3 px-4 pb-1 pt-2">+ <span className="inline-flex items-center gap-2 text-xs font-semibold text-muted-foreground">+ <CounterClockwiseClockIcon className="h-3.5 w-3.5" />+ Action timeline+ </span>+ <span className="text-[11px] text-muted-foreground/70">+ {frames.length} action{frames.length === 1 ? "" : "s"} · click a frame+ to inspect+ </span>+ </div>+ <div+ ref={stripRef}+ className="flex items-stretch gap-0 overflow-x-auto px-4 pb-3 pt-1"+ >+ {frames.length === 0 && !running ? (+ <div className="px-1 py-4 text-xs text-muted-foreground/70">+ Actions will appear here as the run progresses.+ </div>+ ) : null}+ {frames.map((frame, i) => {+ const active = frame.id === shownFrameId;+ const failed = frameFailed(frame.status);+ return (+ <Fragment key={frame.id}>+ {frame.isBlockStart && i > 0 ? (+ <div+ className="mx-2 flex w-px shrink-0 items-center self-stretch bg-border"+ title={frame.blockLabel ?? undefined}+ />+ ) : null}+ <button+ type="button"+ onClick={() => pinFrame(frame.id)}+ aria-label={`Inspect step: ${frame.label}`}+ className={cn(+ "group flex w-[8.5rem] shrink-0 flex-col gap-1.5 rounded-md border border-transparent p-1.5 text-left transition-colors hover:border-border",+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",+ active &&+ "border-studio-accent/60 bg-slate-elevation3 ring-1 ring-studio-accent/50",+ failed &&+ active &&+ "border-destructive/60 ring-destructive/50",+ )}+ >+ <div className="relative h-[4.75rem] overflow-hidden rounded bg-slate-elevation3">+ <FilmstripThumbnail+ artifactId={frame.screenshotArtifactId}+ alt={frame.label}+ />+ <span className="absolute left-1 top-1 rounded bg-black/60 px-1.5 py-0.5 font-mono text-[9.5px] font-bold text-white">+ {frame.index}+ </span>+ <span+ className={cn(+ "absolute bottom-1 right-1 grid h-5 w-5 place-items-center rounded text-white",+ failed ? "bg-destructive" : "bg-success",+ )}+ >+ {actionTypeIcons[frame.actionType]}+ </span>+ </div>+ <div className="truncate text-[11.5px] font-medium text-foreground">+ {frame.label}+ </div>+ <div className="font-mono text-[10px] text-muted-foreground/70">+ {ReadableActionTypes[frame.actionType] ?? frame.actionType}+ </div>+ </button>+ </Fragment>+ );+ })}+ {running ? (+ <div className="flex w-[8.5rem] shrink-0 flex-col gap-1.5 p-1.5">+ <Skeleton className="h-[4.75rem] rounded" />+ <Skeleton variant="text" lines={2} className="gap-1.5" />+ </div>+ ) : null}+ </div>+ </div>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/FilmstripThumbnail.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/FilmstripThumbnail.tsxnew file mode 100644index 000000000..6ad8293e0--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/runview/FilmstripThumbnail.tsx@@ -0,0 +1,69 @@+import { ImageIcon } from "@radix-ui/react-icons";+import { useQuery } from "@tanstack/react-query";+import { useState } from "react";++import { getClient } from "@/api/AxiosClient";+import { ArtifactApiResponse } from "@/api/types";+import { Skeleton } from "@/components/ui/skeleton";+import { useCredentialGetter } from "@/hooks/useCredentialGetter";+import { getImageURL } from "@/routes/tasks/detail/artifactUtils";+import { cn } from "@/util/utils";++export function FilmstripThumbnail({+ artifactId,+ alt,+}: {+ artifactId: string | null;+ alt: string;+}) {+ const credentialGetter = useCredentialGetter();+ const [imgLoaded, setImgLoaded] = useState(false);+ // Shares the ["artifact", id] cache key with ActionScreenshot, so the hero+ // and the strip thumbnail reuse a single fetch per action.+ const { data } = useQuery<ArtifactApiResponse>({+ queryKey: ["artifact", artifactId],+ queryFn: async () => {+ const client = await getClient(credentialGetter, "sans-api-v1");+ return client+ .get(`/artifacts/${artifactId}`)+ .then((response) => response.data);+ },+ enabled: Boolean(artifactId),+ refetchOnWindowFocus: false,+ refetchOnMount: false,+ staleTime: Infinity,+ retry: 1,+ });++ // Some actions (e.g. terminate) never capture a screenshot — show a neutral+ // placeholder instead of an empty black box.+ if (!artifactId || data?.archived) {+ return (+ <div className="flex h-full w-full items-center justify-center bg-slate-elevation3">+ <ImageIcon className="h-5 w-5 text-muted-foreground/40" />+ </div>+ );+ }++ // While the artifact resolves and the image paints, show a skeleton rather+ // than a black box; fade the screenshot in once it has actually loaded.+ return (+ <div className="relative h-full w-full bg-slate-elevation3">+ {data ? (+ <img+ src={getImageURL(data)}+ alt={alt}+ onLoad={() => setImgLoaded(true)}+ className={cn(+ "h-full w-full object-cover object-top transition-opacity",+ imgLoaded ? "opacity-100" : "opacity-0",+ )}+ loading="lazy"+ />+ ) : null}+ {!imgLoaded ? (+ <Skeleton className="absolute inset-0 rounded-none" />+ ) : null}+ </div>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/HeroRecording.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/HeroRecording.tsxnew file mode 100644index 000000000..61dafa16b--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/runview/HeroRecording.tsx@@ -0,0 +1,89 @@+import { useState } from "react";++import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";++type HeroRecordingProps = {+ recordingUrls: string[];+ onPlay?: (index: number) => void;+};++/**+ * A single recording. Once metadata loads, an empty (0-second) recording+ * shows a placeholder instead of a player that can't play anything.+ */+function RecordingPlayer({+ url,+ onPlay,+}: {+ url: string;+ onPlay?: () => void;+}) {+ const [isEmpty, setIsEmpty] = useState(false);++ // Just after a run finishes duration can be Infinity at loadedmetadata and only+ // settle later (durationchange), so check both or an empty recording shows a player.+ const checkEmpty = (event: React.SyntheticEvent<HTMLVideoElement>) => {+ const duration = event.currentTarget.duration;+ if (Number.isFinite(duration) && duration < 0.5) {+ setIsEmpty(true);+ }+ };++ if (isEmpty) {+ return (+ <div className="absolute inset-0 grid place-items-center bg-black/30 p-6 text-center text-sm text-muted-foreground">+ This recording is empty — nothing was captured (0 seconds).+ </div>+ );+ }++ return (+ <video+ src={url}+ controls+ preload="metadata"+ className="absolute inset-0 h-full w-full bg-black object-contain"+ onLoadedMetadata={checkEmpty}+ onDurationChange={checkEmpty}+ onPlay={onPlay}+ />+ );+}++/**+ * The run recording shown in the hero center. A single recording fills the+ * letterboxed area; multiple recordings get one tab each.+ */+export function HeroRecording({ recordingUrls, onPlay }: HeroRecordingProps) {+ if (recordingUrls.length === 1) {+ const url = recordingUrls[0];+ if (!url) {+ return null;+ }+ return <RecordingPlayer url={url} onPlay={() => onPlay?.(0)} />;+ }++ return (+ <Tabs+ defaultValue="0"+ className="absolute inset-0 flex flex-col bg-black/30"+ >+ <TabsList className="m-2 self-center bg-slate-elevation2">+ {recordingUrls.map((_, index) => (+ <TabsTrigger key={index} value={String(index)}>+ Recording {index + 1}+ </TabsTrigger>+ ))}+ </TabsList>+ {recordingUrls.map((url, index) => (+ <TabsContent+ key={index}+ value={String(index)}+ className="relative mt-0 min-h-0 flex-1"+ >+ <RecordingPlayer url={url} onPlay={() => onPlay?.(index)} />+ </TabsContent>+ ))}+ </Tabs>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/HeroScreenshot.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/HeroScreenshot.tsxnew file mode 100644index 000000000..1690c7f72--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/runview/HeroScreenshot.tsx@@ -0,0 +1,58 @@+import { ReloadIcon } from "@radix-ui/react-icons";+import { useQuery } from "@tanstack/react-query";++import { getClient } from "@/api/AxiosClient";+import { ArtifactApiResponse } from "@/api/types";+import { useCredentialGetter } from "@/hooks/useCredentialGetter";+import { getImageURL } from "@/routes/tasks/detail/artifactUtils";++/**+ * The pinned/active action screenshot, letterboxed to fit the run hero. Shares the+ * ["artifact", id] cache with the filmstrip thumbnails so each is fetched once.+ */+export function HeroScreenshot({ artifactId }: { artifactId: string | null }) {+ const credentialGetter = useCredentialGetter();+ const { data, isLoading } = useQuery<ArtifactApiResponse>({+ queryKey: ["artifact", artifactId],+ queryFn: async () => {+ const client = await getClient(credentialGetter, "sans-api-v1");+ return client+ .get(`/artifacts/${artifactId}`)+ .then((response) => response.data);+ },+ enabled: Boolean(artifactId),+ refetchOnWindowFocus: false,+ refetchOnMount: false,+ staleTime: Infinity,+ retry: 1,+ });++ if (!artifactId) {+ return (+ <div className="absolute inset-0 grid place-items-center text-sm text-muted-foreground">+ No screenshot for this action.+ </div>+ );+ }+ if (isLoading) {+ return (+ <div className="absolute inset-0 flex items-center justify-center gap-2 text-sm text-muted-foreground">+ <ReloadIcon className="h-5 w-5 animate-spin" /> Loading screenshot…+ </div>+ );+ }+ if (!data || data.archived) {+ return (+ <div className="absolute inset-0 grid place-items-center text-sm text-muted-foreground">+ Screenshot unavailable.+ </div>+ );+ }+ return (+ <img+ src={getImageURL(data)}+ alt="action screenshot"+ className="absolute inset-0 h-full w-full object-contain"+ />+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunDetailsButton.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunDetailsButton.tsxnew file mode 100644index 000000000..20ca0dae1--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunDetailsButton.tsx@@ -0,0 +1,129 @@+import { InfoCircledIcon } from "@radix-ui/react-icons";+import { Link } from "react-router-dom";++import { type FailureCategory, type Status } from "@/api/types";+import { CopyButton } from "@/components/CopyButton";+import { FailureCategoryBadge } from "@/components/FailureCategoryBadge";+import { StatusBadge } from "@/components/StatusBadge";+import {+ Popover,+ PopoverContent,+ PopoverTrigger,+} from "@/components/ui/popover";+import { basicLocalTimeFormat, basicTimeFormat } from "@/util/timeFormat";+import { cn } from "@/util/utils";++type RunDetailsButtonProps = {+ workflowRunId: string;+ status: Status;+ startedAt: string | null;+ finishedAt: string | null;+ failureReason: string | null;+ failureCategory: Array<FailureCategory> | null;+ browserSessionId: string | null;+ browserProfileId: string | null;+};++function DetailRow({+ label,+ children,+}: {+ label: string;+ children: React.ReactNode;+}) {+ return (+ <div className="flex items-start justify-between gap-4">+ <span className="text-xs text-muted-foreground">{label}</span>+ <div className="min-w-0 text-right text-sm">{children}</div>+ </div>+ );+}++export function RunDetailsButton({+ workflowRunId,+ status,+ startedAt,+ finishedAt,+ failureReason,+ failureCategory,+ browserSessionId,+ browserProfileId,+}: RunDetailsButtonProps) {+ return (+ <Popover>+ <PopoverTrigger asChild>+ <button+ type="button"+ 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",+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",+ )}+ >+ <InfoCircledIcon className="h-4 w-4" />+ Details+ </button>+ </PopoverTrigger>+ <PopoverContent+ align="end"+ className="flex w-[24rem] max-w-[90vw] flex-col gap-3"+ >+ <DetailRow label="Run ID">+ <div className="flex items-center justify-end gap-1">+ <span className="truncate font-mono text-xs">{workflowRunId}</span>+ <CopyButton value={workflowRunId} />+ </div>+ </DetailRow>+ <DetailRow label="Status">+ <StatusBadge status={status} />+ </DetailRow>+ {failureCategory?.length ? (+ <DetailRow label="Failure">+ <FailureCategoryBadge failureCategory={failureCategory} />+ </DetailRow>+ ) : null}+ {failureReason ? (+ <DetailRow label="Reason">+ <span className="whitespace-pre-wrap break-words text-destructive">+ {failureReason}+ </span>+ </DetailRow>+ ) : null}+ {startedAt ? (+ <DetailRow label="Started">+ <span title={basicTimeFormat(startedAt)}>+ {basicLocalTimeFormat(startedAt)}+ </span>+ </DetailRow>+ ) : null}+ {finishedAt ? (+ <DetailRow label="Finished">+ <span title={basicTimeFormat(finishedAt)}>+ {basicLocalTimeFormat(finishedAt)}+ </span>+ </DetailRow>+ ) : null}+ {browserSessionId ? (+ <DetailRow label="Browser session">+ <Link+ to={`/browser-session/${browserSessionId}/stream`}+ className="truncate font-mono text-xs underline underline-offset-4"+ >+ {browserSessionId}+ </Link>+ </DetailRow>+ ) : null}+ {browserProfileId ? (+ <DetailRow label="Browser profile">+ <Link+ to={`/browser-profiles/${browserProfileId}`}+ className="truncate font-mono text-xs underline underline-offset-4"+ >+ {browserProfileId}+ </Link>+ </DetailRow>+ ) : null}+ </PopoverContent>+ </Popover>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.tsxnew file mode 100644index 000000000..5d62a42f4--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.tsx@@ -0,0 +1,302 @@+import { type ReactNode, useEffect, useState } from "react";+import {+ CodeIcon,+ CounterClockwiseClockIcon,+ ExclamationTriangleIcon,+ GlobeIcon,+ PlayIcon,+} from "@radix-ui/react-icons";++import { Button } from "@/components/ui/button";+import { StreamStatusPanel } from "@/routes/streaming/StreamDiagnostics";+import { useRunViewStore } from "@/store/RunViewStore";+import { cn } from "@/util/utils";++import { WorkflowRunCode } from "../../workflowRun/WorkflowRunCode";+import { FilmstripFrame } from "../runProjections";+import { HeroRecording } from "./HeroRecording";+import { HeroScreenshot } from "./HeroScreenshot";+import { RunLiveStream } from "./RunLiveStream";++type RunHeroProps = {+ workflowRunId: string;+ shownFrame: FilmstripFrame | null;+ running: boolean;+ provisioning: boolean;+ isPaused: boolean;+ failed: boolean;+ failureReason: string | null;+ browserSessionId: string | null;+ recordingUrls: string[];+ elapsed: string;+ details?: ReactNode;+ inputs?: ReactNode;+ outputs?: ReactNode;+ actions?: ReactNode;+ onRecordingPlay?: (index: number) => void;+ onFix?: () => void;+ onRetry?: () => void;+};++type CenterView = "code" | "stream" | "recording" | "screenshot";++function ViewToggle({+ active,+ onClick,+ icon,+ children,+}: {+ active: boolean;+ onClick: () => void;+ icon?: React.ReactNode;+ children: React.ReactNode;+}) {+ return (+ <button+ type="button"+ onClick={onClick}+ className={cn(+ "inline-flex items-center gap-1.5 rounded px-2 py-1 text-[11px] font-medium",+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",+ active+ ? "bg-studio-accent/15 text-studio-accent-2"+ : "text-muted-foreground hover:bg-accent hover:text-accent-foreground",+ )}+ >+ {icon}+ {children}+ </button>+ );+}++export function RunHero({+ workflowRunId,+ shownFrame,+ running,+ provisioning,+ isPaused,+ failed,+ failureReason,+ browserSessionId,+ recordingUrls,+ elapsed,+ details,+ inputs,+ outputs,+ actions,+ onRecordingPlay,+ onFix,+ onRetry,+}: RunHeroProps) {+ const pinnedFrameId = useRunViewStore((s) => s.pinnedFrameId);+ const pinFrame = useRunViewStore((s) => s.pinFrame);+ const jumpToLive = useRunViewStore((s) => s.jumpToLive);+ const codeOpen = useRunViewStore((s) => s.codeOpen);+ const setCodeOpen = useRunViewStore((s) => s.setCodeOpen);++ // The live page URL comes from the stream frames (CDP); reset per run.+ const [streamUrl, setStreamUrl] = useState<string | null>(null);+ useEffect(() => {+ setStreamUrl(null);+ }, [workflowRunId]);++ const scrubbing = pinnedFrameId != null && pinnedFrameId !== "stream";+ const hasRecording = recordingUrls.length > 0;++ // A failed run defaults to its last screenshot so the fix/retry CTA is+ // visible; otherwise a finished run defaults to the recording.+ const center: CenterView = codeOpen+ ? "code"+ : running && !scrubbing+ ? "stream"+ : scrubbing+ ? "screenshot"+ : hasRecording && !failed+ ? "recording"+ : "screenshot";++ const headerLabel =+ center === "stream"+ ? // VNC streams carry no page URL (pixels only); only the CDP path sets+ // streamUrl, so fall back to a neutral label instead of "Loading…".+ (streamUrl ?? "Live browser")+ : center === "recording"+ ? "Recording"+ : center === "code"+ ? "Generated code"+ : (shownFrame?.label ?? "Screenshot");++ const headerIcon =+ center === "recording" ? (+ <PlayIcon className="h-3 w-3 shrink-0" />+ ) : center === "code" ? (+ <CodeIcon className="h-3 w-3 shrink-0" />+ ) : (+ <GlobeIcon className="h-3 w-3 shrink-0" />+ );++ return (+ <div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-border bg-slate-elevation1">+ <div className="flex items-center gap-2 border-b border-border px-3 py-2">+ <div className="flex min-w-0 flex-1 items-center gap-1.5 truncate rounded bg-slate-elevation3 px-2 py-1 text-xs text-muted-foreground">+ {headerIcon}+ <span className="truncate">{headerLabel}</span>+ </div>+ <div className="flex shrink-0 items-center gap-1">+ {running ? (+ <ViewToggle+ active={center === "stream"}+ onClick={() => pinFrame("stream")}+ icon={+ <span className="h-1.5 w-1.5 animate-pulse rounded-full bg-success" />+ }+ >+ Live+ </ViewToggle>+ ) : hasRecording ? (+ <ViewToggle+ active={center === "recording"}+ onClick={jumpToLive}+ icon={<PlayIcon className="h-3 w-3" />}+ >+ Recording+ </ViewToggle>+ ) : null}+ <ViewToggle+ active={center === "code"}+ onClick={() => setCodeOpen(!codeOpen)}+ icon={<CodeIcon className="h-3 w-3" />}+ >+ Code+ </ViewToggle>+ {details ? (+ <>+ <div className="mx-0.5 h-4 w-px bg-border" />+ {details}+ </>+ ) : null}+ {inputs ? (+ <>+ <div className="mx-0.5 h-4 w-px bg-border" />+ {inputs}+ </>+ ) : null}+ {outputs ? (+ <>+ <div className="mx-0.5 h-4 w-px bg-border" />+ {outputs}+ </>+ ) : null}+ {actions ? (+ <>+ <div className="mx-0.5 h-4 w-px bg-border" />+ {actions}+ </>+ ) : null}+ <span+ className="ml-1 whitespace-nowrap font-mono text-[11px] tabular-nums text-muted-foreground"+ title="Elapsed"+ >+ {elapsed}+ </span>+ </div>+ </div>++ <div className="relative min-h-0 flex-1 overflow-hidden bg-slate-950">+ {center === "code" ? (+ <div className="absolute inset-0 flex flex-col overflow-hidden bg-slate-elevation1 p-2">+ <WorkflowRunCode+ workflowRunId={workflowRunId}+ showCacheKeyValueSelector+ />+ </div>+ ) : center === "stream" ? (+ provisioning ? (+ // Mounting the stream while the run is still queued opens a socket+ // the backend never feeds; wait until the run is actually running.+ <div className="absolute inset-0">+ <StreamStatusPanel+ diagnostic={{+ title: "Starting the browser",+ detail: "Getting your run's browser ready…",+ pending: true,+ }}+ />+ </div>+ ) : (+ <RunLiveStream+ workflowRunId={workflowRunId}+ browserSessionId={browserSessionId}+ interactive={isPaused}+ onUrlChange={setStreamUrl}+ />+ )+ ) : center === "recording" ? (+ <HeroRecording+ recordingUrls={recordingUrls}+ onPlay={onRecordingPlay}+ />+ ) : shownFrame ? (+ <HeroScreenshot artifactId={shownFrame.screenshotArtifactId} />+ ) : (+ <div className="absolute inset-0 grid place-items-center text-sm text-muted-foreground">+ Waiting for the first action…+ </div>+ )}++ {center === "screenshot" && scrubbing && shownFrame ? (+ <div className="absolute left-3 top-3 flex max-w-[26rem] items-center gap-2 rounded-md bg-black/70 px-3 py-1.5 text-xs text-white backdrop-blur">+ <CounterClockwiseClockIcon className="h-3.5 w-3.5 shrink-0" />+ <span className="truncate">+ Inspecting step · <b>{shownFrame.label}</b>+ </span>+ {running ? (+ <button+ type="button"+ onClick={() => pinFrame("stream")}+ className="ml-1 inline-flex items-center gap-1.5 rounded-full bg-white/15 px-2 py-0.5 text-[11px] hover:bg-white/25 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white"+ >+ <span className="h-1.5 w-1.5 animate-pulse rounded-full bg-success" />+ Jump to live+ </button>+ ) : hasRecording ? (+ <button+ type="button"+ onClick={jumpToLive}+ className="ml-1 inline-flex items-center gap-1.5 rounded-full bg-white/15 px-2 py-0.5 text-[11px] hover:bg-white/25 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white"+ >+ <PlayIcon className="h-3 w-3" />+ Recording+ </button>+ ) : null}+ </div>+ ) : null}++ {center === "screenshot" && failed && !scrubbing ? (+ <div className="absolute inset-x-0 bottom-0 m-4 rounded-lg border border-destructive/40 bg-slate-elevation1/95 p-4 shadow-lg backdrop-blur">+ <div className="flex items-center gap-2 text-sm font-semibold text-foreground">+ <ExclamationTriangleIcon className="h-4 w-4 text-destructive" />+ {failureReason ?? "The run failed."}+ </div>+ <div className="mt-3 flex flex-wrap gap-2">+ {onFix ? (+ <Button+ size="sm"+ className="bg-studio-accent text-studio-accent-foreground hover:bg-studio-accent/90"+ onClick={onFix}+ >+ Fix with Copilot+ </Button>+ ) : null}+ {onRetry ? (+ <Button size="sm" variant="secondary" onClick={onRetry}>+ Retry as-is+ </Button>+ ) : null}+ </div>+ </div>+ ) : null}+ </div>+ </div>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunInputsButton.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunInputsButton.tsxnew file mode 100644index 000000000..2041f0638--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunInputsButton.tsx@@ -0,0 +1,87 @@+import { ListBulletIcon } from "@radix-ui/react-icons";++import {+ Popover,+ PopoverContent,+ PopoverTrigger,+} from "@/components/ui/popover";+import { ScrollArea, ScrollAreaViewport } from "@/components/ui/scroll-area";+import { CodeEditor } from "@/routes/workflows/components/CodeEditor";+import { cn } from "@/util/utils";++export type RunInputMeta = { label: string; value: string };++type RunInputsButtonProps = {+ // Ordered [key, value] entries for the agent (workflow) inputs this run used.+ parameters: Array<[string, unknown]>;+ // Run-level non-parameter inputs (webhook, proxy, headers, …).+ meta: RunInputMeta[];+};++export function RunInputsButton({ parameters, meta }: RunInputsButtonProps) {+ if (parameters.length === 0 && meta.length === 0) {+ return null;+ }++ const agentInputs = Object.fromEntries(parameters);++ return (+ <Popover>+ <PopoverTrigger asChild>+ <button+ type="button"+ 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",+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",+ )}+ >+ <ListBulletIcon className="h-4 w-4" />+ Inputs+ </button>+ </PopoverTrigger>+ <PopoverContent+ align="end"+ className="flex w-[30rem] max-w-[90vw] flex-col gap-4"+ >+ {parameters.length > 0 ? (+ <div className="flex flex-col gap-2">+ <span className="text-xs font-semibold text-foreground">+ Agent inputs+ </span>+ <CodeEditor+ language="json"+ value={JSON.stringify(agentInputs, null, 2)}+ readOnly+ maxHeight="220px"+ />+ </div>+ ) : null}+ {meta.length > 0 ? (+ <div className="flex flex-col gap-2">+ <span className="text-xs font-semibold text-foreground">+ Other inputs+ </span>+ <ScrollArea>+ <ScrollAreaViewport className="max-h-[180px]">+ <div className="flex flex-col gap-2">+ {meta.map((entry) => (+ <div+ key={entry.label}+ className="flex flex-col gap-0.5 text-sm"+ >+ <span className="text-xs text-muted-foreground">+ {entry.label}+ </span>+ <span className="break-all">{entry.value}</span>+ </div>+ ))}+ </div>+ </ScrollAreaViewport>+ </ScrollArea>+ </div>+ ) : null}+ </PopoverContent>+ </Popover>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunLiveStream.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunLiveStream.tsxnew file mode 100644index 000000000..a0687e350--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunLiveStream.tsx@@ -0,0 +1,58 @@+import { useEffect, useState } from "react";++import { BrowserStream } from "@/components/BrowserStream";+import { useBrowserStreamingMode } from "@/hooks/useRuntimeConfig";++import { WorkflowRunStream } from "../../workflowRun/WorkflowRunStream";++type RunLiveStreamProps = {+ workflowRunId: string;+ browserSessionId: string | null;+ interactive: boolean;+ // Live page URL from the CDP frames; the VNC path doesn't surface one yet.+ onUrlChange?: (url: string) => void;+};++/**+ * Live browser for a workflow run, mirroring WorkflowRunOverview: VNC keyed by the+ * browser session, with a CDP fallback when VNC is wrong or closes early.+ */+export function RunLiveStream({+ workflowRunId,+ browserSessionId,+ interactive,+ onUrlChange,+}: RunLiveStreamProps) {+ const { browserStreamingMode } = useBrowserStreamingMode();+ const [vncFailed, setVncFailed] = useState(false);++ useEffect(() => {+ setVncFailed(false);+ }, [browserSessionId]);++ const useVnc =+ Boolean(browserSessionId) && browserStreamingMode !== "cdp" && !vncFailed;++ if (useVnc && browserSessionId) {+ return (+ <BrowserStream+ key={browserSessionId}+ browserSessionId={browserSessionId}+ interactive={interactive}+ showControlButtons={interactive}+ onClose={() => setVncFailed(true)}+ />+ );+ }++ return (+ <WorkflowRunStream+ workflowRunId={workflowRunId}+ alwaysShowStream+ interactive={interactive}+ showControlButtons={interactive}+ onUrlChange={onUrlChange}+ centered+ />+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunOutputsButton.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunOutputsButton.tsxnew file mode 100644index 000000000..72230d189--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunOutputsButton.tsx@@ -0,0 +1,124 @@+import { useEffect, useState } from "react";+import { FileIcon, FileTextIcon } from "@radix-ui/react-icons";++import { SummarizeOutput } from "@/components/SummarizeOutput";+import {+ Popover,+ PopoverContent,+ PopoverTrigger,+} from "@/components/ui/popover";+import { ScrollArea, ScrollAreaViewport } from "@/components/ui/scroll-area";+import { CodeEditor } from "@/routes/workflows/components/CodeEditor";+import { cn } from "@/util/utils";++export type RunOutputFile = { url: string; filename: string };++type RunOutputsButtonProps = {+ workflowRunId: string;+ workflowTitle?: string | null;+ extractedInformation: Record<string, unknown> | null;+ files: RunOutputFile[];+};++export function RunOutputsButton({+ workflowRunId,+ workflowTitle,+ extractedInformation,+ files,+}: RunOutputsButtonProps) {+ const [summary, setSummary] = useState<string | null>(null);+ useEffect(() => {+ setSummary(null);+ }, [workflowRunId]);++ const hasExtracted =+ extractedInformation != null &&+ Object.values(extractedInformation).some((value) => value !== null);+ if (!hasExtracted && files.length === 0) {+ return null;+ }++ const extractedJson = JSON.stringify(extractedInformation ?? {});++ return (+ <Popover>+ <PopoverTrigger asChild>+ <button+ type="button"+ 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",+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",+ )}+ >+ <FileTextIcon className="h-4 w-4" />+ Outputs+ </button>+ </PopoverTrigger>+ <PopoverContent+ align="end"+ className="flex w-[30rem] max-w-[90vw] flex-col gap-4"+ >+ {hasExtracted ? (+ <div className="flex flex-col gap-2">+ <div className="flex items-center justify-between">+ <span className="text-xs font-semibold text-foreground">+ Extracted information+ </span>+ <SummarizeOutput+ contextKey={`run:${workflowRunId}`}+ outputJson={extractedJson}+ workflowTitle={workflowTitle}+ hasSummary={summary !== null}+ onSummary={setSummary}+ />+ </div>+ {summary !== null ? (+ <div+ role="status"+ aria-live="polite"+ className="whitespace-pre-wrap rounded bg-slate-elevation3 p-3 text-sm"+ >+ {summary}+ </div>+ ) : null}+ <CodeEditor+ language="json"+ value={JSON.stringify(extractedInformation, null, 2)}+ readOnly+ maxHeight="220px"+ />+ </div>+ ) : null}+ {files.length > 0 ? (+ <div className="flex flex-col gap-2">+ <span className="text-xs font-semibold text-foreground">+ Downloaded files+ </span>+ <ScrollArea>+ <ScrollAreaViewport className="max-h-[180px]">+ <div className="flex flex-col gap-2">+ {files.map((file) => (+ <div+ key={file.url}+ title={file.url}+ className="flex items-center gap-2 text-sm"+ >+ <FileIcon className="size-4 shrink-0" />+ <a+ href={file.url}+ className="truncate underline underline-offset-4"+ >+ {file.filename}+ </a>+ </div>+ ))}+ </div>+ </ScrollAreaViewport>+ </ScrollArea>+ </div>+ ) : null}+ </PopoverContent>+ </Popover>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsxnew file mode 100644index 000000000..6069594b0--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx@@ -0,0 +1,374 @@+import { useCallback, useEffect, useMemo, useRef, useState } from "react";+import { usePostHog } from "posthog-js/react";+import { useSearchParams } from "react-router-dom";++import { Status } from "@/api/types";+import { ApiWebhookActionsMenu } from "@/components/ApiWebhookActionsMenu";+import { WebhookReplayDialog } from "@/components/WebhookReplayDialog";+import { useApiCredential } from "@/hooks/useApiCredential";+import { statusIsFinalized } from "@/routes/tasks/types";+import { useRunViewStore } from "@/store/RunViewStore";+import { useStudioShellStore } from "@/store/StudioShellStore";+import { type ApiCommandOptions } from "@/util/apiCommands";+import { runsApiBaseUrl } from "@/util/env";++import { useWorkflowRunTimelineQuery } from "../../hooks/useWorkflowRunTimelineQuery";+import { useWorkflowRunWithWorkflowQuery } from "../../hooks/useWorkflowRunWithWorkflowQuery";+import { WorkflowRunBlockDetail } from "../../workflowRun/WorkflowRunBlockDetail";+import { WorkflowRunTimeline } from "../../workflowRun/WorkflowRunTimeline";+import { WorkflowRunVerificationCodeForm } from "../../workflowRun/WorkflowRunVerificationCodeForm";+import { pickDownloadedFileFilename } from "../../workflowRun/blockDownloadedFiles";+import { getRecordingUrls } from "../../workflowRun/recordingUrls";+import { findActiveItem } from "../../workflowRun/workflowTimelineUtils";+import { getOrderedRunParameters } from "../../utils";+import {+ buildFilmstrip,+ formatElapsed,+ runOutcomeFromStatus,+} from "../runProjections";+import { Filmstrip } from "./Filmstrip";+import { RunDetailsButton } from "./RunDetailsButton";+import { RunHero } from "./RunHero";+import { RunInputsButton, type RunInputMeta } from "./RunInputsButton";+import { RunOutputsButton, type RunOutputFile } from "./RunOutputsButton";++type RunViewProps = {+ workflowRunId?: string;+ onFix?: () => void;+ onRetry?: () => void;+};++/**+ * Fused run view: browser hero + action filmstrip on the left, run timeline tree+ * + block detail on the right, sharing one pinned item via RunViewStore.+ */+export function RunView({ workflowRunId, onFix, onRetry }: RunViewProps) {+ const queryOptions = workflowRunId ? { workflowRunId } : undefined;+ const { data: workflowRun } = useWorkflowRunWithWorkflowQuery(queryOptions);+ const { data: timeline } = useWorkflowRunTimelineQuery(queryOptions);+ const pinnedFrameId = useRunViewStore((s) => s.pinnedFrameId);+ const pinFrame = useRunViewStore((s) => s.pinFrame);+ const resetRunView = useRunViewStore((s) => s.reset);+ const studioTab = useStudioShellStore((s) => s.tab);+ const [searchParams, setSearchParams] = useSearchParams();+ const searchParamsRef = useRef(searchParams);+ searchParamsRef.current = searchParams;+ const postHog = usePostHog();+ const apiCredential = useApiCredential();+ const [activeIteration, setActiveIteration] = useState<number | null>(null);+ const [replayOpen, setReplayOpen] = useState(false);++ const recordingUrls = useMemo(+ () => getRecordingUrls(workflowRun),+ [workflowRun],+ );+ const onRecordingPlay = useCallback(+ (index: number) => {+ if (!workflowRun) {+ return;+ }+ postHog.capture("run.recording.viewed", {+ org_id: workflowRun.workflow?.organization_id,+ run_id: workflowRun.workflow_run_id,+ recording_index: index,+ recording_count: recordingUrls.length,+ });+ },+ [postHog, workflowRun, recordingUrls.length],+ );++ // A pinned frame belongs to one run; drop it when the run changes, then re-seed+ // from ?active= to restore a deep-linked selection.+ useEffect(() => {+ resetRunView();+ const active = searchParamsRef.current.get("active");+ if (active) {+ pinFrame(active);+ }+ }, [workflowRunId, resetRunView, 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.+ const lastMirroredRunRef = useRef<string | undefined>(undefined);+ useEffect(() => {+ if (lastMirroredRunRef.current !== workflowRunId) {+ lastMirroredRunRef.current = workflowRunId;+ return;+ }+ setSearchParams(+ (prev) => {+ const desired =+ pinnedFrameId && !/:\d+$/.test(pinnedFrameId) ? pinnedFrameId : null;+ if ((prev.get("active") ?? null) === desired) {+ return prev;+ }+ const next = new URLSearchParams(prev);+ if (desired) {+ next.set("active", desired);+ } else {+ next.delete("active");+ }+ return next;+ },+ { replace: true },+ );+ }, [pinnedFrameId, workflowRunId, setSearchParams]);++ // Pin the resolved run into ?wr= while the Run tab shows it (an ?active=-only link+ // becomes stable). Gated on the tab: RunView also mounts under Editor, no ?wr= there.+ useEffect(() => {+ if (studioTab !== "run") {+ return;+ }+ const resolvedRunId = workflowRun?.workflow_run_id;+ if (!resolvedRunId) {+ return;+ }+ setSearchParams(+ (prev) => {+ if (prev.get("wr") === resolvedRunId && !prev.has("bl")) {+ return prev;+ }+ const next = new URLSearchParams(prev);+ next.set("wr", resolvedRunId);+ // Viewing the run, not the block-run browser — drop stale ?bl= so a reload+ // doesn't snap back to the Browser tab.+ next.delete("bl");+ return next;+ },+ { replace: true },+ );+ }, [studioTab, workflowRun, setSearchParams]);++ const frames = useMemo(() => buildFilmstrip(timeline), [timeline]);++ 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;++ const lastFrame = frames.length > 0 ? frames[frames.length - 1] : null;+ const shownFrame =+ (pinnedFrameId ? frames.find((f) => f.id === pinnedFrameId) : undefined) ??+ lastFrame ??+ null;++ const finalized = workflowRun ? statusIsFinalized(workflowRun) : false;+ const finallyBlockLabel =+ workflowRun?.workflow?.workflow_definition?.finally_block_label ?? null;+ const selectedId =+ pinnedFrameId ?? (running ? "stream" : lastFrame?.id) ?? null;+ const activeItem = useMemo(+ () =>+ findActiveItem(timeline ?? [], selectedId, finalized, finallyBlockLabel),+ [timeline, selectedId, finalized, finallyBlockLabel],+ );++ const extractedInformation = useMemo<Record<string, unknown> | null>(() => {+ const outputs = workflowRun?.outputs;+ return typeof outputs === "object" &&+ outputs !== null &&+ "extracted_information" in outputs+ ? (outputs.extracted_information as Record<string, unknown>)+ : null;+ }, [workflowRun]);++ const downloadedFiles = useMemo<RunOutputFile[]>(() => {+ const urls = workflowRun?.downloaded_file_urls ?? [];+ const filenameByUrl = new Map<string, string>();+ for (const file of workflowRun?.downloaded_files ?? []) {+ if (file.filename) {+ filenameByUrl.set(file.url, file.filename);+ }+ }+ return urls.map((url) => ({+ url,+ filename: pickDownloadedFileFilename(url, filenameByUrl),+ }));+ }, [workflowRun]);++ const hasOutputs =+ (extractedInformation != null &&+ Object.values(extractedInformation).some((value) => value !== null)) ||+ downloadedFiles.length > 0;++ const runInputs = useMemo(() => {+ const definitionParameters =+ workflowRun?.workflow?.workflow_definition?.parameters;+ const runParameters =+ (workflowRun?.parameters as Record<string, unknown> | undefined) ?? {};+ const parameters = getOrderedRunParameters(+ definitionParameters,+ runParameters,+ );+ const meta: RunInputMeta[] = [];+ const pushMeta = (label: string, value: unknown) => {+ if (value === null || value === undefined || value === "") {+ return;+ }+ meta.push({+ label,+ value: typeof value === "string" ? value : JSON.stringify(value),+ });+ };+ pushMeta("Webhook URL", workflowRun?.webhook_callback_url);+ pushMeta("Proxy", workflowRun?.proxy_location);+ pushMeta("Extra HTTP headers", workflowRun?.extra_http_headers);+ pushMeta("Browser session", workflowRun?.browser_session_id);+ pushMeta("Run with", workflowRun?.run_with);+ pushMeta("Max screenshot scrolls", workflowRun?.max_screenshot_scrolls);+ return { parameters, meta };+ }, [workflowRun]);++ if (!workflowRun) {+ return (+ <div className="flex h-full w-full items-center justify-center p-8 text-center text-sm text-muted-foreground">+ Run the workflow to watch it live here.+ </div>+ );+ }++ const elapsed = formatElapsed(+ workflowRun.started_at ?? workflowRun.created_at ?? null,+ finalized ? (workflowRun.finished_at ?? null) : null,+ );++ return (+ <div className="flex h-full min-h-0 w-full flex-col px-3 pt-3">+ <div className="flex min-h-0 flex-1 items-stretch gap-3 overflow-hidden">+ <div className="flex min-w-0 flex-1 flex-col gap-3 overflow-hidden">+ <WorkflowRunVerificationCodeForm+ workflowRunId={workflowRun.workflow_run_id}+ />+ <RunHero+ workflowRunId={workflowRun.workflow_run_id}+ shownFrame={shownFrame}+ running={running}+ provisioning={+ workflowRun.status === Status.Created ||+ workflowRun.status === Status.Queued+ }+ isPaused={workflowRun.status === Status.Paused}+ failed={failed}+ failureReason={workflowRun.failure_reason ?? null}+ browserSessionId={workflowRun.browser_session_id ?? null}+ recordingUrls={recordingUrls}+ elapsed={elapsed}+ details={+ <RunDetailsButton+ workflowRunId={workflowRun.workflow_run_id}+ status={workflowRun.status}+ startedAt={workflowRun.started_at ?? null}+ finishedAt={workflowRun.finished_at ?? null}+ failureReason={workflowRun.failure_reason ?? null}+ failureCategory={workflowRun.failure_category ?? null}+ browserSessionId={workflowRun.browser_session_id ?? null}+ browserProfileId={workflowRun.browser_profile_id ?? null}+ />+ }+ inputs={+ <RunInputsButton+ parameters={runInputs.parameters}+ meta={runInputs.meta}+ />+ }+ outputs={+ hasOutputs ? (+ <RunOutputsButton+ workflowRunId={workflowRun.workflow_run_id}+ workflowTitle={workflowRun.workflow?.title}+ extractedInformation={extractedInformation}+ files={downloadedFiles}+ />+ ) : undefined+ }+ actions={+ <>+ <ApiWebhookActionsMenu+ size="sm"+ getOptions={() => {+ const headers: Record<string, string> = {+ "Content-Type": "application/json",+ "x-api-key": apiCredential ?? "<your-api-key>",+ };+ const body: Record<string, unknown> = {+ workflow_id: workflowRun.workflow?.workflow_permanent_id,+ parameters: workflowRun.parameters,+ proxy_location: workflowRun.proxy_location,+ };+ if (workflowRun.max_screenshot_scrolls != null) {+ body.max_screenshot_scrolls =+ workflowRun.max_screenshot_scrolls;+ }+ if (workflowRun.webhook_callback_url) {+ body.webhook_url = workflowRun.webhook_callback_url;+ }+ return {+ method: "POST",+ url: `${runsApiBaseUrl}/run/workflows`,+ body,+ headers,+ } satisfies ApiCommandOptions;+ }}+ webhookDisabled={!finalized}+ onTestWebhook={() => setReplayOpen(true)}+ />+ <WebhookReplayDialog+ runId={workflowRun.workflow_run_id}+ disabled={!finalized}+ open={replayOpen}+ onOpenChange={setReplayOpen}+ hideTrigger+ />+ </>+ }+ onRecordingPlay={onRecordingPlay}+ onFix={onFix}+ onRetry={onRetry}+ />+ <Filmstrip+ frames={frames}+ shownFrameId={shownFrame?.id ?? null}+ running={running}+ />+ </div>+ <div className="relative w-[26rem] shrink-0">+ <div className="absolute inset-0 grid grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-3">+ <div className="min-h-0 overflow-hidden">+ <WorkflowRunTimeline+ workflowRunId={workflowRunId}+ 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) => {+ setActiveIteration(iterationIndex);+ pinFrame(loopBlock.workflow_run_block_id);+ }}+ />+ </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}+ onActionSelect={(payload) => pinFrame(payload.action.action_id)}+ onThoughtSelect={(thought) => pinFrame(thought.thought_id)}+ />+ </div>+ </div>+ </div>+ </div>+ </div>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/studio/usePresence.ts b/skyvern-frontend/src/routes/workflows/studio/usePresence.tsnew file mode 100644index 000000000..a9241c696--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/usePresence.ts@@ -0,0 +1,20 @@+import { useEffect, useState } from "react";++/**+ * Keep an element mounted through its exit animation: when `open` flips false it+ * stays mounted for `exitMs` so the animation can play, then unmounts.+ */+export function usePresence(open: boolean, exitMs = 150): boolean {+ const [present, setPresent] = useState(open);++ useEffect(() => {+ if (open) {+ setPresent(true);+ return;+ }+ const timer = window.setTimeout(() => setPresent(false), exitMs);+ return () => window.clearTimeout(timer);+ }, [open, exitMs]);++ return present;+}diff --git a/skyvern-frontend/src/routes/workflows/studio/useStudioRunId.ts b/skyvern-frontend/src/routes/workflows/studio/useStudioRunId.tsnew file mode 100644index 000000000..232acdf19--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/useStudioRunId.ts@@ -0,0 +1,13 @@+import { useSearchParams } from "react-router-dom";++import { useFirstParam } from "@/hooks/useFirstParam";++/**+ * The run the studio shell is focused on. Shell-started runs carry the id in ?wr=+ * (path params would re-layout the canvas); legacy routes carry it as a path param.+ */+export function useStudioRunId(): string | undefined {+ const [searchParams] = useSearchParams();+ const urlRunId = useFirstParam("workflowRunId", "runId");+ return searchParams.get("wr") ?? urlRunId;+}diff --git a/skyvern-frontend/src/routes/workflows/studioNavigation.ts b/skyvern-frontend/src/routes/workflows/studioNavigation.tsnew file mode 100644index 000000000..d9cdc2874--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studioNavigation.ts@@ -0,0 +1,27 @@+import * as env from "@/util/env";++/**+ * Where "open the editor" links point. With the studio preview on, the editor+ * lives at /studio; off, it is the legacy /build debugger surface.+ */+export function workflowEditorPath(+ workflowPermanentId: string,+ studioEnabled: boolean,+ search = "",+): string {+ const leaf = studioEnabled ? "studio" : "build";+ return `/workflows/${workflowPermanentId}/${leaf}${search}`;+}++/**+ * Legacy (studio-off) destination for viewing a finished workflow run, honoring+ * the existing useNewRunsUrl split between the global and per-workflow pages.+ */+export function legacyRunDetailPath(+ workflowPermanentId: string,+ workflowRunId: string,+): string {+ return env.useNewRunsUrl+ ? `/runs/${workflowRunId}`+ : `/workflows/${workflowPermanentId}/${workflowRunId}/overview`;+}diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/ScriptFixInput.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/ScriptFixInput.tsxindex c8b2f1653..c25a90926 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/ScriptFixInput.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/ScriptFixInput.tsx@@ -7,23 +7,46 @@ import { toast } from "@/components/ui/use-toast";import { useReviewScriptMutation } from "../hooks/useReviewScriptMutation";import type { ReviewScriptResponse } from "../types/scriptTypes";+function ScriptFixTriggerButton({ onClick }: { onClick: () => void }) {+ return (+ <Button variant="outline" size="sm" className="gap-1.5" onClick={onClick}>+ <MagicWandIcon className="h-3.5 w-3.5" />+ Fix with AI+ </Button>+ );+}+interface Props {workflowPermanentId: string;workflowRunId?: string;onScriptUpdated?: (data: ReviewScriptResponse) => void;+ // Controlled open state: when provided, the internal trigger is hidden so the+ // parent can place it elsewhere. Self-managed when omitted.+ open?: boolean;+ onOpenChange?: (open: boolean) => void;}function ScriptFixInput({workflowPermanentId,workflowRunId,onScriptUpdated,+ open: openProp,+ onOpenChange,}: Props) {- const [isOpen, setIsOpen] = useState(false);+ const isControlled = openProp !== undefined;+ const [openState, setOpenState] = useState(false);+ const isOpen = isControlled ? Boolean(openProp) : openState;+ const setIsOpen = (next: boolean) => {+ if (!isControlled) {+ setOpenState(next);+ }+ onOpenChange?.(next);+ };const [instructions, setInstructions] = useState("");// Reset state when navigating between runs or workflowsuseEffect(() => {- setIsOpen(false);+ setOpenState(false);setInstructions("");}, [workflowRunId, workflowPermanentId]);@@ -57,20 +80,17 @@ function ScriptFixInput({});};+ // Controlled mode: the parent owns the trigger, so render only the panel.+ if (isControlled && !isOpen) {+ return null;+ }+return (<div className="flex w-full flex-col gap-2">- {/* Trigger button — always visible in collapsed state */}- {!isOpen && (+ {/* Trigger button — only when self-managed (uncontrolled). */}+ {!isControlled && !isOpen && (<div className="flex justify-end">- <Button- variant="outline"- size="sm"- className="gap-1.5"- onClick={() => setIsOpen(true)}- >- <MagicWandIcon className="h-3.5 w-3.5" />- Fix with AI- </Button>+ <ScriptFixTriggerButton onClick={() => setIsOpen(true)} /></div>)}{/* Expanded input panel */}@@ -128,4 +148,4 @@ function ScriptFixInput({);}-export { ScriptFixInput };+export { ScriptFixInput, ScriptFixTriggerButton };diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunBlockDetail.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunBlockDetail.tsxindex f03642b33..d086a3dc3 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunBlockDetail.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunBlockDetail.tsx@@ -1,6 +1,8 @@import type { ActionsApiResponse } from "@/api/types";-import { useState } from "react";+import { useMemo, useState } from "react";+import { FileIcon } from "@radix-ui/react-icons";import { ActionCardCompact } from "@/routes/tasks/detail/ActionCardCompact";+import { useWorkflowRunWithWorkflowQuery } from "../hooks/useWorkflowRunWithWorkflowQuery";import {isAction,isObserverThought,@@ -9,6 +11,10 @@ import {type WorkflowRunBlock,type WorkflowRunTimelineItem,} from "../types/workflowRunTypes";+import {+ getBlockDownloadedFileUrls,+ pickDownloadedFileFilename,+} from "./blockDownloadedFiles";import type { WorkflowRunOverviewActiveElement } from "./WorkflowRunOverview";import {findBlockSurroundingAction,@@ -37,6 +43,8 @@ type Props = {activeIteration?: number | null;timeline: Array<WorkflowRunTimelineItem>;timelineReady?: boolean;+ showDownloadedFiles?: boolean;+ workflowRunId?: string;onActionSelect?: (payload: {block: WorkflowRunBlock;action: ActionsApiResponse;@@ -48,6 +56,64 @@ function isLoopBlock(block: WorkflowRunBlock): boolean {return block.block_type === "for_loop" || block.block_type === "while_loop";}+function BlockDownloadedFiles({+ block,+ workflowRunId,+}: {+ block: WorkflowRunBlock;+ workflowRunId?: string;+}) {+ const { data: workflowRun } = useWorkflowRunWithWorkflowQuery(+ workflowRunId ? { workflowRunId } : undefined,+ );+ const files = useMemo(() => {+ const freshUrls = workflowRun?.downloaded_file_urls ?? [];+ const urls = getBlockDownloadedFileUrls(block.output, freshUrls);+ if (urls.length === 0) {+ return [];+ }+ const filenameByUrl = new Map<string, string>();+ for (const file of workflowRun?.downloaded_files ?? []) {+ if (file.filename) {+ filenameByUrl.set(file.url, file.filename);+ }+ }+ return urls.map((url) => ({+ url,+ filename: pickDownloadedFileFilename(url, filenameByUrl),+ }));+ }, [block.output, workflowRun]);++ if (files.length === 0) {+ return null;+ }++ return (+ <div className="border-b border-slate-700 bg-slate-elevation1 px-3 py-3">+ <div className="mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-500">+ Downloaded files+ </div>+ <div className="flex flex-col gap-2">+ {files.map((file) => (+ <div+ key={file.url}+ title={file.url}+ className="flex items-center gap-2 text-sm"+ >+ <FileIcon className="size-4 shrink-0 text-slate-400" />+ <a+ href={file.url}+ className="truncate underline underline-offset-4"+ >+ {file.filename}+ </a>+ </div>+ ))}+ </div>+ </div>+ );+}+function SelectedActionHeader({action,block,@@ -144,6 +210,8 @@ function WorkflowRunBlockDetail({activeIteration = null,timeline,timelineReady = true,+ showDownloadedFiles = false,+ workflowRunId,onActionSelect,onThoughtSelect,}: Props) {@@ -263,6 +331,12 @@ function WorkflowRunBlockDetail({/>)}{resolvedBlock && <BlockInspector block={resolvedBlock} />}+ {resolvedBlock && showDownloadedFiles && (+ <BlockDownloadedFiles+ block={resolvedBlock}+ workflowRunId={workflowRunId}+ />+ )}{body}</div></div>diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunCode.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunCode.tsxindex d898063f4..ca6f89b2c 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunCode.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunCode.tsx@@ -9,6 +9,7 @@ import {SelectValue,} from "@/components/ui/select";import { Button } from "@/components/ui/button";+import { Skeleton } from "@/components/ui/skeleton";import { HelpTooltip } from "@/components/HelpTooltip";import { statusIsFinalized } from "@/routes/tasks/types";import { CodeEditor } from "@/routes/workflows/components/CodeEditor";@@ -25,22 +26,53 @@ import { useCredentialGetter } from "@/hooks/useCredentialGetter";import { useToast } from "@/components/ui/use-toast";import { Pencil1Icon } from "@radix-ui/react-icons";-import { CopyAndExplainCode } from "../editor/Workspace";-import { ScriptFixInput } from "./ScriptFixInput";+import { CopyAndExplainCode, CopyText } from "../editor/Workspace";+import { ScriptFixInput, ScriptFixTriggerButton } from "./ScriptFixInput";const enableCodeBlock =import.meta.env.VITE_ENABLE_CODE_BLOCK?.toLowerCase() === "true";+const CODE_SKELETON_WIDTHS = [+ "w-1/3",+ "w-2/3",+ "w-1/2",+ "w-3/4",+ "w-1/4",+ "w-2/3",+ "w-1/2",+ "w-5/6",+ "w-1/3",+ "w-3/5",+ "w-1/2",+ "w-2/3",+];++function CodeLoadingSkeleton() {+ return (+ <div className="flex h-full w-full flex-col gap-2.5 overflow-hidden bg-slate-elevation3 p-4">+ {CODE_SKELETON_WIDTHS.map((width, i) => (+ <Skeleton key={i} className={cn("h-3", width)} />+ ))}+ </div>+ );+}+interface Props {showCacheKeyValueSelector?: boolean;+ workflowRunId?: string;}function WorkflowRunCode(props?: Props) {const showCacheKeyValueSelector = props?.showCacheKeyValueSelector ?? false;+ // The studio passes an explicit workflowRunId; legacy call sites don't. Gate+ // the redesigned toolbar/skeleton on it so legacy renders origin/main parity.+ const studioLayout = Boolean(props?.workflowRunId);const queryClient = useQueryClient();const credentialGetter = useCredentialGetter();const { toast } = useToast();- const { data: workflowRun } = useWorkflowRunWithWorkflowQuery();+ const { data: workflowRun } = useWorkflowRunWithWorkflowQuery(+ props?.workflowRunId ? { workflowRunId: props.workflowRunId } : undefined,+ );const workflow = workflowRun?.workflow;const workflowPermanentId = workflow?.workflow_permanent_id;const cacheKey = workflow?.cache_key ?? "";@@ -60,16 +92,20 @@ function WorkflowRunCode(props?: Props) {const [hasPublishedCode, setHasPublishedCode] = useState(false);- const { data: blockScriptsPending } = useBlockScriptsQuery({- cacheKey,- cacheKeyValue,- workflowPermanentId,- pollIntervalMs: !hasPublishedCode && !isFinalized ? 3000 : undefined,- status: "pending",- workflowRunId: workflowRun?.workflow_run_id,- });+ const { data: blockScriptsPending, isLoading: blockScriptsPendingLoading } =+ useBlockScriptsQuery({+ cacheKey,+ cacheKeyValue,+ workflowPermanentId,+ pollIntervalMs: !hasPublishedCode && !isFinalized ? 3000 : undefined,+ status: "pending",+ workflowRunId: workflowRun?.workflow_run_id,+ });- const { data: blockScriptsPublished } = useBlockScriptsQuery({+ const {+ data: blockScriptsPublished,+ isLoading: blockScriptsPublishedLoading,+ } = useBlockScriptsQuery({cacheKey,cacheKeyValue,workflowPermanentId,@@ -100,6 +136,7 @@ function WorkflowRunCode(props?: Props) {setSelectedVersion(null);setIsEditing(false);setEditedCode("");+ setFixOpen(false);}, [scriptId, currentVersion]);// Fetch available versions for this script@@ -141,6 +178,7 @@ function WorkflowRunCode(props?: Props) {// --- Edit mode state ---const [isEditing, setIsEditing] = useState(false);+ const [fixOpen, setFixOpen] = useState(false);const [editedCode, setEditedCode] = useState("");const originalCodeRef = useRef("");@@ -271,6 +309,23 @@ function WorkflowRunCode(props?: Props) {[setSelectedVersion],);+ if (studioLayout && code.length === 0) {+ // Still generating (run in flight) or the code query hasn't resolved yet —+ // show a skeleton rather than a premature "no code" message.+ if (+ isGeneratingCode ||+ blockScriptsPendingLoading ||+ blockScriptsPublishedLoading+ ) {+ return <CodeLoadingSkeleton />;+ }+ return (+ <div className="flex items-center justify-center bg-slate-elevation3 p-8 text-sm text-muted-foreground">+ No code has been generated yet.+ </div>+ );+ }+if (code.length === 0 && !isGeneratingCode) {return (<div className="flex items-center justify-center bg-slate-elevation3 p-8">@@ -338,6 +393,19 @@ function WorkflowRunCode(props?: Props) {</div>) : null;+ // Fix-with-AI trigger lives in the studio toolbar; the expand panel renders+ // below. Legacy keeps ScriptFixInput's own inline trigger.+ const fixTrigger =+ studioLayout &&+ enableCodeBlock &&+ code.length > 0 &&+ isFinalized &&+ workflowPermanentId &&+ !isEditing &&+ !fixOpen ? (+ <ScriptFixTriggerButton onClick={() => setFixOpen(true)} />+ ) : null;+// Version selector — "Used → Generated" chips instead of dropdownconst activeChipVersion = selectedVersion ?? generatedVersion ?? usedVersion;@@ -388,6 +456,7 @@ function WorkflowRunCode(props?: Props) {<div className="flex items-center justify-end gap-2">{editButton}{editActions}+ {fixTrigger}{versionSelector}{!isEditing && code.length > 0 && <CopyAndExplainCode code={code} />}</div>@@ -399,6 +468,8 @@ function WorkflowRunCode(props?: Props) {workflowPermanentId={workflowPermanentId}workflowRunId={workflowRun?.workflow_run_id}onScriptUpdated={handleScriptUpdated}+ open={studioLayout ? fixOpen : undefined}+ onOpenChange={studioLayout ? setFixOpen : undefined}/>)}<CodeEditor@@ -428,55 +499,97 @@ function WorkflowRunCode(props?: Props) {cacheKeyValueSet.add(cacheKeyValueForWorkflowRun);}+ const cacheKeyVariantSelector =+ cacheKeyValueSet.size > 0 ? (+ <div className="flex items-center gap-1.5">+ <HelpTooltip+ content={+ !isFinalized+ ? "The cached variant the generated code is stored under."+ : "Which cached code variant to view."+ }+ />+ <Select+ disabled={!isFinalized || isEditing}+ value={cacheKeyValue}+ onValueChange={(v: string) => setCacheKeyValue(v)}+ >+ <SelectTrigger className="h-7 max-w-[15rem] gap-1.5 rounded-full border-slate-700 px-2.5 text-xs [&>span]:text-ellipsis">+ <SelectValue placeholder="Variant" />+ </SelectTrigger>+ <SelectContent>+ {Array.from(cacheKeyValueSet)+ .sort()+ .map((value, i) => {+ const v = value+ ? value.length === 0+ ? "default"+ : value+ : "default";++ return (+ <SelectItem key={`${v}-${i}`} value={v}>+ {value === cacheKeyValueForWorkflowRun &&+ isFinalized === true ? (+ <span className="underline">{v}</span>+ ) : (+ v+ )}+ </SelectItem>+ );+ })}+ </SelectContent>+ </Select>+ </div>+ ) : null;++ if (!studioLayout) {+ return (+ <div className="flex h-full w-full flex-col items-end justify-center gap-2">+ <div className="flex w-full items-center justify-end gap-2">+ {editButton}+ {editActions}+ {versionSelector}+ {cacheKeyVariantSelector}+ {!isEditing && code.length > 0 && <CopyAndExplainCode code={code} />}+ </div>+ {enableCodeBlock &&+ code.length > 0 &&+ isFinalized &&+ workflowPermanentId && (+ <ScriptFixInput+ workflowPermanentId={workflowPermanentId}+ workflowRunId={workflowRun?.workflow_run_id}+ onScriptUpdated={handleScriptUpdated}+ />+ )}+ <CodeEditor+ className={cn("h-full w-full overflow-y-scroll", {+ "animate-pulse": isGeneratingCode || isLoadingVersion,+ })}+ language="python"+ value={isEditing ? editedCode : code}+ onChange={isEditing ? setEditedCode : undefined}+ lineWrap={false}+ readOnly={!isEditing}+ fontSize={10}+ />+ </div>+ );+ }+return (- <div className="flex h-full w-full flex-col items-end justify-center gap-2">- <div className="flex w-full items-center justify-end gap-2">+ <div className="flex h-full w-full flex-col gap-2">+ <div className="flex w-full items-center gap-2">+ {versionSelector}+ {cacheKeyVariantSelector}+ <div className="flex-1" />+ {!isEditing && code.length > 0 && (+ <CopyAndExplainCode code={code} showCopy={false} />+ )}{editButton}{editActions}- {versionSelector}- {cacheKeyValueSet.size > 0 ? (- <div className="flex items-center gap-1.5">- <HelpTooltip- content={- !isFinalized- ? "The cached variant the generated code is stored under."- : "Which cached code variant to view."- }- />- <Select- disabled={!isFinalized || isEditing}- value={cacheKeyValue}- onValueChange={(v: string) => setCacheKeyValue(v)}- >- <SelectTrigger className="h-7 max-w-[15rem] gap-1.5 rounded-full border-slate-700 px-2.5 text-xs [&>span]:text-ellipsis">- <SelectValue placeholder="Variant" />- </SelectTrigger>- <SelectContent>- {Array.from(cacheKeyValueSet)- .sort()- .map((value, i) => {- const v = value- ? value.length === 0- ? "default"- : value- : "default";-- return (- <SelectItem key={`${v}-${i}`} value={v}>- {value === cacheKeyValueForWorkflowRun &&- isFinalized === true ? (- <span className="underline">{v}</span>- ) : (- v- )}- </SelectItem>- );- })}- </SelectContent>- </Select>- </div>- ) : null}- {!isEditing && code.length > 0 && <CopyAndExplainCode code={code} />}+ {fixTrigger}</div>{enableCodeBlock &&code.length > 0 &&@@ -486,19 +599,28 @@ function WorkflowRunCode(props?: Props) {workflowPermanentId={workflowPermanentId}workflowRunId={workflowRun?.workflow_run_id}onScriptUpdated={handleScriptUpdated}+ open={fixOpen}+ onOpenChange={setFixOpen}/>)}- <CodeEditor- className={cn("h-full w-full overflow-y-scroll", {- "animate-pulse": isGeneratingCode || isLoadingVersion,- })}- language="python"- value={isEditing ? editedCode : code}- onChange={isEditing ? setEditedCode : undefined}- lineWrap={false}- readOnly={!isEditing}- fontSize={10}- />+ <div className="relative min-h-0 w-full flex-1">+ <CodeEditor+ className={cn("h-full w-full overflow-y-scroll", {+ "animate-pulse": isGeneratingCode || isLoadingVersion,+ })}+ language="python"+ value={isEditing ? editedCode : code}+ onChange={isEditing ? setEditedCode : undefined}+ lineWrap={false}+ readOnly={!isEditing}+ fontSize={10}+ />+ {!isEditing && code.length > 0 ? (+ <div className="absolute right-3 top-3 z-10 rounded bg-slate-elevation2/80 backdrop-blur-sm">+ <CopyText text={code} />+ </div>+ ) : null}+ </div></div>);}diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunRecording.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunRecording.tsxindex 6df7f3cf4..6189372eb 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunRecording.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunRecording.tsx@@ -1,25 +1,12 @@import { usePostHog } from "posthog-js/react";import { useWorkflowRunWithWorkflowQuery } from "../hooks/useWorkflowRunWithWorkflowQuery";-import { artifactApiBaseUrl } from "@/util/env";--function resolveUrl(url: string): string {- if (url.startsWith("file://")) {- return `${artifactApiBaseUrl}/artifact/recording?path=${url.slice(7)}`;- }- return url;-}+import { getRecordingUrls } from "./recordingUrls";function WorkflowRunRecording() {const postHog = usePostHog();const { data: workflowRun } = useWorkflowRunWithWorkflowQuery();- const rawUrls =- workflowRun?.recording_urls && workflowRun.recording_urls.length > 0- ? workflowRun.recording_urls- : workflowRun?.recording_url- ? [workflowRun.recording_url]- : [];- const recordingUrls = rawUrls.map(resolveUrl);+ const recordingUrls = getRecordingUrls(workflowRun);if (!workflowRun || recordingUrls.length === 0) {if (workflowRun?.recording_archived) {diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunStream.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunStream.tsxindex 1e0f9453d..ce24b0ab6 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunStream.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunStream.tsx@@ -22,6 +22,7 @@ type StreamMessage = {format?: string;viewport_width?: number;viewport_height?: number;+ url?: string;};const STARTING_DIAGNOSTIC: StreamDiagnostic = {@@ -77,6 +78,12 @@ interface Props {alwaysShowStream?: boolean;interactive?: boolean;showControlButtons?: boolean;+ // When set, stream this run instead of the URL's (studio shell).+ workflowRunId?: string;+ // Surfaces the live page URL each frame carries (studio header).+ onUrlChange?: (url: string) => void;+ // Studio centers the frame; legacy keeps the zoomable image.+ centered?: boolean;}const wssBaseUrl = import.meta.env.VITE_WSS_BASE_URL;@@ -85,9 +92,18 @@ function WorkflowRunStream({alwaysShowStream = false,interactive = false,showControlButtons = false,+ workflowRunId: workflowRunIdProp,+ onUrlChange,+ centered,}: Props = {}) {- const workflowRunId = useFirstParam("workflowRunId", "runId");- const { data: workflowRun } = useWorkflowRunWithWorkflowQuery();+ // Held in a ref so a new callback identity doesn't reconnect the socket.+ const onUrlChangeRef = useRef(onUrlChange);+ onUrlChangeRef.current = onUrlChange;+ const urlWorkflowRunId = useFirstParam("workflowRunId", "runId");+ const workflowRunId = workflowRunIdProp ?? urlWorkflowRunId;+ const { data: workflowRun } = useWorkflowRunWithWorkflowQuery(+ workflowRunIdProp ? { workflowRunId: workflowRunIdProp } : undefined,+ );const [streamImgSrc, setStreamImgSrc] = useState<string>("");const [streamFormat, setStreamFormat] = useState<string>("png");const [viewportWidth, setViewportWidth] = useState(1280);@@ -167,6 +183,9 @@ function WorkflowRunStream({if (message.viewport_height) {setViewportHeight(message.viewport_height);}+ if (message.url) {+ onUrlChangeRef.current?.(message.url);+ }if (!message.screenshot && message.status) {setDiagnostic(diagnosticForStatus(message.status));}@@ -291,6 +310,7 @@ function WorkflowRunStream({containerRef={containerRef}showControlButtons={showControlButtons}handlers={handlers}+ centered={centered}/>);}diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.tsxindex da871e85b..56c9622e5 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.tsx@@ -32,6 +32,8 @@ import {type Props = {activeItem: WorkflowRunOverviewActiveElement;activeIteration?: number | null;+ // When set, read this run's timeline instead of the URL's (studio shell).+ workflowRunId?: string;onLiveStreamSelected: () => void;onActionItemSelected: (item: ActionItem) => void;onBlockItemSelected: (item: WorkflowRunBlock) => void;@@ -81,6 +83,7 @@ function buildBlockOrderIndex(function WorkflowRunTimeline({activeItem,activeIteration = null,+ workflowRunId,onLiveStreamSelected,onActionItemSelected,onBlockItemSelected,@@ -88,10 +91,10 @@ function WorkflowRunTimeline({onIterationSelected,}: Props) {const { data: workflowRun, isLoading: workflowRunIsLoading } =- useWorkflowRunWithWorkflowQuery();+ useWorkflowRunWithWorkflowQuery({ workflowRunId });const { data: workflowRunTimeline, isLoading: workflowRunTimelineIsLoading } =- useWorkflowRunTimelineQuery();+ useWorkflowRunTimelineQuery({ workflowRunId });const displayTimeline = useMemo(() => flattenTimelineChronologically(workflowRunTimeline ?? []),[workflowRunTimeline],diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunVerificationCodeForm.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunVerificationCodeForm.tsxindex a0ac8fccce6..22bf92b21 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunVerificationCodeForm.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunVerificationCodeForm.tsx@@ -3,9 +3,15 @@ import { statusIsFinalized } from "@/routes/tasks/types";import { useWorkflowRunWithWorkflowQuery } from "../hooks/useWorkflowRunWithWorkflowQuery";import { useQueryClient } from "@tanstack/react-query";-function WorkflowRunVerificationCodeForm() {+function WorkflowRunVerificationCodeForm({+ workflowRunId,+}: {+ workflowRunId?: string;+} = {}) {const queryClient = useQueryClient();- const { data: workflowRun } = useWorkflowRunWithWorkflowQuery();+ const { data: workflowRun } = useWorkflowRunWithWorkflowQuery(+ workflowRunId ? { workflowRunId } : undefined,+ );const isRunFinalized = workflowRun ? statusIsFinalized(workflowRun) : false;const isWaitingForCode =diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/recordingUrls.ts b/skyvern-frontend/src/routes/workflows/workflowRun/recordingUrls.tsnew file mode 100644index 000000000..58de82acf--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/workflowRun/recordingUrls.ts@@ -0,0 +1,28 @@+import { artifactApiBaseUrl } from "@/util/env";++function resolveRecordingUrl(url: string): string {+ if (url.startsWith("file://")) {+ return `${artifactApiBaseUrl}/artifact/recording?path=${url.slice(7)}`;+ }+ return url;+}++type RecordingSource = {+ recording_urls?: string[] | null;+ recording_url?: string | null;+};++export function getRecordingUrls(+ workflowRun: RecordingSource | null | undefined,+): string[] {+ if (!workflowRun) {+ return [];+ }+ const raw =+ workflowRun.recording_urls && workflowRun.recording_urls.length > 0+ ? workflowRun.recording_urls+ : workflowRun.recording_url+ ? [workflowRun.recording_url]+ : [];+ return raw.map(resolveRecordingUrl);+}diff --git a/skyvern-frontend/src/store/DebugStoreContext.tsx b/skyvern-frontend/src/store/DebugStoreContext.tsxindex 87924fb98..e1733d455 100644--- a/skyvern-frontend/src/store/DebugStoreContext.tsx+++ b/skyvern-frontend/src/store/DebugStoreContext.tsx@@ -1,6 +1,8 @@import React, { createContext, useMemo } from "react";import { useMatch } from "react-router-dom";+import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";+function useIsDebugMode() {const workflowBuildMatch = useMatch("/workflows/:workflowPermanentId/build");const workflowBlockBuildMatch = useMatch(@@ -12,8 +14,21 @@ function useIsDebugMode() {);}+// Studio offers block runs without the constrained debug-view chrome; the active+// block run is carried in query params (not the path) so the canvas doesn't re-layout.+function useBlockRunsEnabled() {+ const editMatch = useMatch("/workflows/:workflowPermanentId/edit");+ const studioMatch = useMatch("/workflows/:workflowPermanentId/studio");+ const studioEnabled = useWorkflowStudioEnabled();+ return useMemo(+ () => studioEnabled && Boolean(editMatch || studioMatch),+ [studioEnabled, editMatch, studioMatch],+ );+}+export type DebugStoreContextType = {isDebugMode: boolean;+ blockRunsEnabled: boolean;};// eslint-disable-next-line react-refresh/only-export-components@@ -25,9 +40,10 @@ export const DebugStoreProvider: React.FC<{ children: React.ReactNode }> = ({children,}) => {const isDebugMode = useIsDebugMode();+ const blockRunsEnabled = useBlockRunsEnabled();return (- <DebugStoreContext.Provider value={{ isDebugMode }}>+ <DebugStoreContext.Provider value={{ isDebugMode, blockRunsEnabled }}>{children}</DebugStoreContext.Provider>);diff --git a/skyvern-frontend/src/store/RunViewStore.ts b/skyvern-frontend/src/store/RunViewStore.tsnew file mode 100644index 000000000..f28a97aae--- /dev/null+++ b/skyvern-frontend/src/store/RunViewStore.ts@@ -0,0 +1,23 @@+import { create } from "zustand";++type RunViewState = {+ // The frame the user is inspecting. null means "follow the live edge" while+ // running, or the recording once finalized.+ pinnedFrameId: string | null;+ // Whether the generated-code viewer is taking over the hero center.+ codeOpen: boolean;+ pinFrame: (id: string) => void;+ jumpToLive: () => void;+ setCodeOpen: (open: boolean) => void;+ reset: () => void;+};++export const useRunViewStore = create<RunViewState>((set) => ({+ pinnedFrameId: null,+ codeOpen: false,+ // Inspecting a frame or jumping to live/recording always closes the code view.+ pinFrame: (id) => set({ pinnedFrameId: id, codeOpen: false }),+ jumpToLive: () => set({ pinnedFrameId: null, codeOpen: false }),+ setCodeOpen: (open) => set({ codeOpen: open }),+ reset: () => set({ pinnedFrameId: null, codeOpen: false }),+}));diff --git a/skyvern-frontend/src/store/StudioShellStore.ts b/skyvern-frontend/src/store/StudioShellStore.tsnew file mode 100644index 000000000..bf846dd1e--- /dev/null+++ b/skyvern-frontend/src/store/StudioShellStore.ts@@ -0,0 +1,49 @@+import { create } from "zustand";+import { persist, createJSONStorage } from "zustand/middleware";++export type StudioTab = "editor" | "browser" | "run";++type StudioShellState = {+ tab: StudioTab;+ copilotCollapsed: boolean;+ pipMinimized: boolean;+ setTab: (tab: StudioTab) => void;+ setCopilotCollapsed: (collapsed: boolean) => void;+ toggleCopilot: () => void;+ setPipMinimized: (minimized: boolean) => void;+ togglePip: () => void;+ reset: () => void;+};++const DEFAULTS = {+ tab: "editor" as StudioTab,+ copilotCollapsed: false,+ pipMinimized: false,+};++export const STUDIO_SHELL_STORAGE_KEY = "skyvern.studioShell";++export const useStudioShellStore = create<StudioShellState>()(+ persist(+ (set) => ({+ ...DEFAULTS,+ setTab: (tab) => set({ tab }),+ setCopilotCollapsed: (copilotCollapsed) => set({ copilotCollapsed }),+ toggleCopilot: () =>+ set((state) => ({ copilotCollapsed: !state.copilotCollapsed })),+ setPipMinimized: (pipMinimized) => set({ pipMinimized }),+ togglePip: () => set((state) => ({ pipMinimized: !state.pipMinimized })),+ reset: () => set(DEFAULTS),+ }),+ {+ name: STUDIO_SHELL_STORAGE_KEY,+ storage: createJSONStorage(() => localStorage),+ // `tab` is intentionally not persisted: the Run tab is gated on hasRun,+ // so each session starts on the editor.+ partialize: (state) => ({+ copilotCollapsed: state.copilotCollapsed,+ pipMinimized: state.pipMinimized,+ }),+ },+ ),+);diff --git a/skyvern-frontend/src/store/useStudioBrowserStore.ts b/skyvern-frontend/src/store/useStudioBrowserStore.tsnew file mode 100644index 000000000..ad92b4f81--- /dev/null+++ b/skyvern-frontend/src/store/useStudioBrowserStore.ts@@ -0,0 +1,21 @@+import { create } from "zustand";++/**+ * Bridges the studio's single live-browser stream and the Browser tab's chrome:+ * the stream publishes its URL here; the toolbar drives a reconnect back into it.+ */+type StudioBrowserState = {+ streamUrl: string | null;+ reloadNonce: number;+ setStreamUrl: (url: string | null) => void;+ reload: () => void;+ reset: () => void;+};++export const useStudioBrowserStore = create<StudioBrowserState>()((set) => ({+ streamUrl: null,+ reloadNonce: 0,+ setStreamUrl: (streamUrl) => set({ streamUrl }),+ reload: () => set((state) => ({ reloadNonce: state.reloadNonce + 1 })),+ reset: () => set({ streamUrl: null }),+}));diff --git a/skyvern-frontend/src/util/featureFlags.ts b/skyvern-frontend/src/util/featureFlags.tsindex 0095f36d5..9734ed767 100644--- a/skyvern-frontend/src/util/featureFlags.ts+++ b/skyvern-frontend/src/util/featureFlags.ts@@ -20,3 +20,7 @@ export const WORKFLOW_TAGGING_FLAG = "WORKFLOW_TAGGING";// Opt-in (0% base rollout) preview gating the workflows directory-tree view.// Not enrolled reads as disabled, so the default stays the flat folders/list.export const WORKFLOWS_DIRECTORY_TREE_FLAG = "WORKFLOWS_DIRECTORY_TREE";++// Opt-in (0% base rollout) preview gating the redesigned workflow studio.+// Not enrolled reads as disabled, so the default stays the legacy editor.+export const WORKFLOW_STUDIO_FLAG = "workflow_studio_v2";diff --git a/skyvern-frontend/src/util/onboarding/contextualHints.test.ts b/skyvern-frontend/src/util/onboarding/contextualHints.test.tsindex 857a598ab..ee3fe6bdf 100644--- a/skyvern-frontend/src/util/onboarding/contextualHints.test.ts+++ b/skyvern-frontend/src/util/onboarding/contextualHints.test.ts@@ -17,10 +17,10 @@ describe("HINT_REGISTRY", () => {expect(keys.size).toBe(HINT_REGISTRY.length);});- it("matches the editor route only for the build editor path", () => {+ it("matches both the build and edit editor paths", () => {const block = HINT_REGISTRY.find((h) => h.id === "add-another-block")!;expect(block.matchRoute("/workflows/wpid_123/build")).toBe(true);- expect(block.matchRoute("/workflows/wpid_123/edit")).toBe(false);+ expect(block.matchRoute("/workflows/wpid_123/edit")).toBe(true);expect(block.matchRoute("/workflows")).toBe(false);expect(block.matchRoute("/workflows/wpid_123/runs")).toBe(false);});diff --git a/skyvern-frontend/src/util/onboarding/contextualHints.ts b/skyvern-frontend/src/util/onboarding/contextualHints.tsindex b0ee15c4e..d10603698 100644--- a/skyvern-frontend/src/util/onboarding/contextualHints.ts+++ b/skyvern-frontend/src/util/onboarding/contextualHints.ts@@ -21,7 +21,7 @@ export type ContextualHint = {};};-const EDITOR_ROUTE = /^\/workflows\/[^/]+\/build$/;+const EDITOR_ROUTE = /^\/workflows\/[^/]+\/(?:build|edit|studio)$/;export const HINT_REGISTRY: readonly ContextualHint[] = [{diff --git a/skyvern-frontend/src/util/timeFormat.ts b/skyvern-frontend/src/util/timeFormat.tsindex 4eb0f1dbb..c9894954e 100644--- a/skyvern-frontend/src/util/timeFormat.ts+++ b/skyvern-frontend/src/util/timeFormat.ts@@ -134,6 +134,7 @@ function formatExecutionTime(}export {+ normalizeUtcTimestamp,basicLocalTimeFormat,compactLocalDateTime,basicTimeFormat,diff --git a/skyvern-frontend/tailwind.config.js b/skyvern-frontend/tailwind.config.jsindex cc6b426a8..1b731e3fa 100644--- a/skyvern-frontend/tailwind.config.js+++ b/skyvern-frontend/tailwind.config.js@@ -91,6 +91,11 @@ 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)",