Skip to content

Automate browser based workflows with AI

Show all block prompts under Agent inputs in the Workflow Studio run view (#7473)

Celal Zamanoğludcf09499edf0
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunInputsSection.test.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunInputsSection.test.tsx
new file mode 100644
index 000000000..c3e1eb248
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunInputsSection.test.tsx
@@ -0,0 +1,180 @@
+// @vitest-environment jsdom
+
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
+import { afterEach, describe, expect, test, vi } from "vitest";
+
+import { RunInputsSection } from "./RunInputsSection";
+
+vi.mock("./OverviewCodeBlock", () => ({
+ OverviewCodeBlock: ({ value }: { value: string }) => <pre>{value}</pre>,
+}));
+
+const emptyProps = {
+ parameters: [],
+ blockPrompts: [],
+ meta: [],
+};
+
+afterEach(() => {
+ cleanup();
+ vi.restoreAllMocks();
+});
+
+describe("RunInputsSection", () => {
+ test("renders block labels and prompts under a Block prompts section", () => {
+ render(
+ <RunInputsSection
+ {...emptyProps}
+ blockPrompts={[
+ {
+ blockLabel: "summary block",
+ blockType: "text_prompt",
+ fields: [{ fieldLabel: "Prompt", prompt: "Summarize the input" }],
+ },
+ ]}
+ />,
+ );
+
+ expect(screen.queryByText("Block prompts")).not.toBeNull();
+ expect(screen.queryByText("summary block")).not.toBeNull();
+ expect(screen.queryByText("Summarize the input")).not.toBeNull();
+ });
+
+ test("gates parameters-only, prompts-only, combined, and empty states", () => {
+ const parametersOnly = render(
+ <RunInputsSection
+ {...emptyProps}
+ parameters={[["synthetic_key", "synthetic value"]]}
+ />,
+ );
+ expect(screen.queryByText("Agent inputs")).not.toBeNull();
+ expect(screen.queryByText(/synthetic_key/)).not.toBeNull();
+ parametersOnly.unmount();
+
+ const promptsOnly = render(
+ <RunInputsSection
+ {...emptyProps}
+ blockPrompts={[
+ {
+ blockLabel: "prompt-only block",
+ blockType: "text_prompt",
+ fields: [{ fieldLabel: "Prompt", prompt: "Prompt-only value" }],
+ },
+ ]}
+ />,
+ );
+ expect(screen.queryByText("Block prompts")).not.toBeNull();
+ expect(screen.queryByText("Agent inputs")).toBeNull();
+ expect(screen.queryByText("Prompt-only value")).not.toBeNull();
+ promptsOnly.unmount();
+
+ const combined = render(
+ <RunInputsSection
+ {...emptyProps}
+ parameters={[["combined_key", "combined value"]]}
+ blockPrompts={[
+ {
+ blockLabel: "combined block",
+ blockType: "text_prompt",
+ fields: [{ fieldLabel: "Prompt", prompt: "Combined prompt" }],
+ },
+ ]}
+ />,
+ );
+ const parameterJson = screen.getByText(/combined_key/);
+ const combinedPrompt = screen.getByText("Combined prompt");
+ expect(
+ parameterJson.compareDocumentPosition(combinedPrompt) &
+ Node.DOCUMENT_POSITION_FOLLOWING,
+ ).not.toBe(0);
+ // Agent inputs and Block prompts are distinct sibling sections.
+ expect(screen.queryByText("Agent inputs")).not.toBeNull();
+ expect(screen.queryByText("Block prompts")).not.toBeNull();
+ combined.unmount();
+
+ const empty = render(<RunInputsSection {...emptyProps} />);
+ expect(empty.container.firstChild).toBeNull();
+ });
+
+ test("labels every prompt inset, including single-field blocks", () => {
+ render(
+ <RunInputsSection
+ {...emptyProps}
+ blockPrompts={[
+ {
+ blockLabel: "single-field block",
+ blockType: "text_prompt",
+ fields: [{ fieldLabel: "Prompt", prompt: "Single prompt" }],
+ },
+ {
+ blockLabel: "multi-field block",
+ blockType: "task",
+ fields: [
+ { fieldLabel: "Navigation goal", prompt: "Navigate somewhere" },
+ { fieldLabel: "Extraction goal", prompt: "Extract something" },
+ ],
+ },
+ ]}
+ />,
+ );
+
+ // The locked mock labels every inset, single-field blocks included.
+ expect(screen.queryByText("Prompt")).not.toBeNull();
+ expect(screen.queryByText("Navigation goal")).not.toBeNull();
+ expect(screen.queryByText("Extraction goal")).not.toBeNull();
+ });
+
+ test("renders the expansion toggle when measured content overflows", () => {
+ // jsdom has no layout engine, so it cannot measure line-clamp overflow itself.
+ vi.spyOn(HTMLElement.prototype, "scrollHeight", "get").mockReturnValue(80);
+ vi.spyOn(HTMLElement.prototype, "clientHeight", "get").mockReturnValue(48);
+
+ render(
+ <RunInputsSection
+ {...emptyProps}
+ blockPrompts={[
+ {
+ blockLabel: "long prompt block",
+ blockType: "text_prompt",
+ fields: [
+ {
+ fieldLabel: "Prompt",
+ prompt:
+ "A synthetic prompt long enough to overflow three lines.",
+ },
+ ],
+ },
+ ]}
+ />,
+ );
+
+ expect(screen.queryByRole("button", { name: "Show more" })).not.toBeNull();
+ });
+
+ test("bounds the collapsed render and toggles many-line prompts without layout", () => {
+ // 20 short lines: jsdom can't measure height, so the line-count cap alone
+ // must drive the toggle and keep the hidden lines out of the DOM.
+ const prompt = Array.from({ length: 20 }, (_, i) => `line ${i + 1}`).join(
+ "\n",
+ );
+ render(
+ <RunInputsSection
+ {...emptyProps}
+ blockPrompts={[
+ {
+ blockLabel: "long block",
+ blockType: "text_prompt",
+ fields: [{ fieldLabel: "Prompt", prompt }],
+ },
+ ]}
+ />,
+ );
+
+ expect(screen.queryByText("line 6")).not.toBeNull();
+ expect(screen.queryByText("line 7")).toBeNull();
+ const toggle = screen.getByRole("button", { name: "Show more" });
+
+ fireEvent.click(toggle);
+ expect(screen.queryByText("line 20")).not.toBeNull();
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunInputsSection.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunInputsSection.tsx
index 9efbed721..db53813d5 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunInputsSection.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunInputsSection.tsx
@@ -1,24 +1,149 @@
+import {
+ useCallback,
+ useEffect,
+ useId,
+ useLayoutEffect,
+ useRef,
+ useState,
+} from "react";
+import { defaultSettingsTokyoNightStorm } from "@uiw/codemirror-theme-tokyo-night-storm";
+
+import { CopyButton } from "@/components/CopyButton";
+import { Button } from "@/components/ui/button";
+import { workflowBlockTitle } from "@/routes/workflows/editor/nodes/types";
+
+import type { BlockPrompt } from "./blockPrompts";
import { OverviewCodeBlock } from "./OverviewCodeBlock";
-import { OverviewField } from "./OverviewField";
export type RunInputMeta = { label: string; value: string };
type RunInputsSectionProps = {
// Ordered [key, value] entries for the agent (workflow) inputs this run used.
parameters: Array<[string, unknown]>;
+ blockPrompts: BlockPrompt[];
// Run-level non-parameter inputs (webhook, proxy, headers, …).
meta: RunInputMeta[];
};
-export function RunInputsSection({ parameters, meta }: RunInputsSectionProps) {
- if (parameters.length === 0 && meta.length === 0) {
+// The background/foreground CodeMirror paints for the JSON Agent-inputs block
+// (tokyoNightStorm). Prompts are plain text, so this inset reproduces the
+// OverviewCodeBlock chrome without mounting a CodeMirror per prompt.
+const CODE_INSET_BG = defaultSettingsTokyoNightStorm.background ?? "#24283b";
+const CODE_INSET_FG = defaultSettingsTokyoNightStorm.foreground ?? "#7982a9";
+// Collapsed height shows ~4 lines; render a few past that so the clamp is filled,
+// but not the whole prompt — an unbounded paste would otherwise build thousands
+// of hidden line nodes.
+const COLLAPSED_LINE_CAP = 6;
+
+function PromptCodeInset({ prompt }: { prompt: string }) {
+ const [expanded, setExpanded] = useState(false);
+ const [overflows, setOverflows] = useState(false);
+ const contentId = useId();
+ const boxRef = useRef<HTMLDivElement>(null);
+ const measureOverflow = useCallback(() => {
+ const element = boxRef.current;
+ if (element) {
+ setOverflows(element.scrollHeight > element.clientHeight);
+ }
+ }, []);
+
+ useLayoutEffect(() => {
+ if (!expanded) {
+ measureOverflow();
+ }
+ }, [expanded, measureOverflow, prompt]);
+
+ useEffect(() => {
+ if (expanded || typeof ResizeObserver === "undefined") {
+ return;
+ }
+ const element = boxRef.current;
+ if (!element) {
+ return;
+ }
+ // Width changes (pane resize) re-wrap the prompt and can flip the overflow
+ // verdict even though the collapsed height is pinned — so keep observing.
+ const observer = new ResizeObserver(measureOverflow);
+ observer.observe(element);
+ return () => observer.disconnect();
+ }, [expanded, measureOverflow]);
+
+ const lines = prompt.split("\n");
+ const visibleLines = expanded ? lines : lines.slice(0, COLLAPSED_LINE_CAP);
+ const showToggle = overflows || lines.length > COLLAPSED_LINE_CAP;
+
+ return (
+ <div className="flex flex-col items-start">
+ <div className="relative w-full">
+ <CopyButton
+ value={prompt}
+ className="absolute right-2 top-2 z-10 h-7 w-7 bg-slate-elevation3/80 text-muted-foreground backdrop-blur hover:bg-slate-elevation4 hover:text-foreground"
+ />
+ <div
+ id={contentId}
+ ref={boxRef}
+ style={{ backgroundColor: CODE_INSET_BG, color: CODE_INSET_FG }}
+ // ~3 lines at the inset's 12px/1.4; a height clamp (not line-clamp-3)
+ // so the per-line number gutter rows stay intact.
+ className={`overflow-hidden rounded-md py-1 font-mono text-xs leading-[1.4] ${expanded ? "" : "max-h-[66px]"}`}
+ >
+ {visibleLines.map((line, index) => (
+ <div key={index} className="flex items-start">
+ <span className="min-w-[22px] shrink-0 select-none whitespace-nowrap pl-[5px] pr-2 text-right">
+ {index + 1}
+ </span>
+ {/* pr-10 clears the absolute copy button so a full-width wrapped
+ first line isn't occluded. */}
+ <span className="min-w-0 flex-1 whitespace-pre-wrap break-words pl-1.5 pr-10">
+ {line === "" ? " " : line}
+ </span>
+ </div>
+ ))}
+ </div>
+ {!expanded && showToggle ? (
+ <div
+ aria-hidden
+ className="pointer-events-none absolute inset-x-0 bottom-0 h-[26px] rounded-b-md"
+ style={{
+ background: `linear-gradient(to bottom, transparent, ${CODE_INSET_BG})`,
+ }}
+ />
+ ) : null}
+ </div>
+ {showToggle ? (
+ <Button
+ type="button"
+ variant="link"
+ size="sm"
+ className="mt-1.5 h-auto justify-start p-0 text-xs text-muted-foreground hover:text-foreground"
+ aria-controls={contentId}
+ aria-expanded={expanded}
+ onClick={() => setExpanded((value) => !value)}
+ >
+ {expanded ? "Show less" : "Show more"}
+ </Button>
+ ) : null}
+ </div>
+ );
+}
+
+export function RunInputsSection({
+ parameters,
+ blockPrompts,
+ meta,
+}: RunInputsSectionProps) {
+ if (
+ parameters.length === 0 &&
+ blockPrompts.length === 0 &&
+ meta.length === 0
+ ) {
return null;
}
const agentInputs = Object.fromEntries(parameters);
return (
- <div className="flex flex-col gap-5">
+ <div className="flex flex-col gap-6">
{parameters.length > 0 ? (
<div className="flex flex-col gap-2">
<span className="text-xs font-medium text-muted-foreground">
@@ -30,16 +155,68 @@ export function RunInputsSection({ parameters, meta }: RunInputsSectionProps) {
/>
</div>
) : null}
+ {blockPrompts.length > 0 ? (
+ <div className="flex flex-col gap-3">
+ <span className="text-xs font-medium text-muted-foreground">
+ Block prompts
+ </span>
+ <div className="flex flex-col gap-[18px]">
+ {blockPrompts.map((block, index) => {
+ const typeLabel = workflowBlockTitle[block.blockType];
+ return (
+ <div
+ // Block labels are only softly unique across loop scopes, so
+ // pair with the flattened index to keep keys stable.
+ key={`${block.blockLabel}-${index}`}
+ >
+ <div className="mb-2.5 font-mono text-sm font-medium text-foreground">
+ {block.blockLabel}
+ {typeLabel ? (
+ <span className="ml-2 font-sans font-normal text-muted-foreground">
+ {typeLabel}
+ </span>
+ ) : null}
+ </div>
+ <div className="flex flex-col gap-3">
+ {block.fields.map((field) => (
+ <div key={field.fieldLabel} className="flex flex-col">
+ <span className="mb-1.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground">
+ {field.fieldLabel}
+ </span>
+ <PromptCodeInset prompt={field.prompt} />
+ </div>
+ ))}
+ </div>
+ </div>
+ );
+ })}
+ </div>
+ </div>
+ ) : null}
{meta.length > 0 ? (
<div className="flex flex-col gap-3">
<span className="text-xs font-medium text-muted-foreground">
Other inputs
</span>
- {meta.map((entry) => (
- <OverviewField key={entry.label} label={entry.label}>
- <span className="break-all">{entry.value}</span>
- </OverviewField>
- ))}
+ <div className="overflow-hidden rounded-lg border border-border bg-slate-elevation2">
+ {meta.map((entry) => (
+ <div
+ key={entry.label}
+ className="group flex items-start gap-3 border-t border-border px-3 py-[9px] first:border-t-0"
+ >
+ <span className="w-32 shrink-0 pt-px text-[11px] font-medium uppercase tracking-wide text-muted-foreground">
+ {entry.label}
+ </span>
+ <span className="min-w-0 flex-1 break-words text-sm text-foreground">
+ {entry.value}
+ </span>
+ <CopyButton
+ value={entry.value}
+ className="h-6 w-6 shrink-0 text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100"
+ />
+ </div>
+ ))}
+ </div>
</div>
) : null}
</div>
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx
index 6192cffa4..937e8f818 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx
@@ -357,6 +357,33 @@ describe("RunView view toggles", () => {
fireEvent.click(scope.getByRole("button", { name: "Outputs" }));
expect(scope.getByText("No outputs for this run")).not.toBeNull();
});
+
+ test("definition block prompts count as run inputs", () => {
+ seedCompletedRun({
+ workflow: {
+ workflow_definition: {
+ blocks: [
+ {
+ block_type: "navigation",
+ label: "navigation block",
+ navigation_goal: "Navigate to the next synthetic step",
+ },
+ ],
+ finally_block_label: null,
+ },
+ },
+ });
+ const { container } = renderRunView();
+ const scope = within(container);
+
+ fireEvent.click(scope.getByRole("button", { name: "Inputs" }));
+
+ expect(scope.queryByText("navigation block")).not.toBeNull();
+ expect(
+ scope.queryByText("Navigate to the next synthetic step"),
+ ).not.toBeNull();
+ expect(scope.queryByText("No inputs for this run")).toBeNull();
+ });
});
describe("RunView cold-open selection", () => {
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx
index e5d4e5b67..4681f0ff8 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx
@@ -33,6 +33,7 @@ import {
} from "../runProjections";
import { toReadableSearch } from "../panes";
import { useStudioPanes } from "../useStudioPanes";
+import { collectBlockPrompts } from "./blockPrompts";
import { matchFailureTips } from "./failureTips";
import { buildRunFixMessage } from "./runFixMessage";
import { RunInputsSection, type RunInputMeta } from "./RunInputsSection";
@@ -287,6 +288,9 @@ export function RunView({
const runInputs = useMemo(() => {
const definitionParameters =
workflowRun?.workflow?.workflow_definition?.parameters;
+ const blockPrompts = collectBlockPrompts(
+ workflowRun?.workflow?.workflow_definition?.blocks ?? [],
+ );
const runParameters =
(workflowRun?.parameters as Record<string, unknown> | undefined) ?? {};
const parameters = getOrderedRunParameters(
@@ -309,7 +313,7 @@ export function RunView({
pushMeta("Browser session", workflowRun?.browser_session_id);
pushMeta("Run with", workflowRun?.run_with);
pushMeta("Max screenshot scrolls", workflowRun?.max_screenshot_scrolls);
- return { parameters, meta };
+ return { parameters, blockPrompts, meta };
}, [workflowRun]);
// Task 2.0 runs carry their output (and any webhook failure) on task_v2,
@@ -321,7 +325,9 @@ export function RunView({
null;
const hasInputs =
- runInputs.parameters.length > 0 || runInputs.meta.length > 0;
+ runInputs.parameters.length > 0 ||
+ runInputs.blockPrompts.length > 0 ||
+ runInputs.meta.length > 0;
const hasOutputs = runHasOutputs(workflowRun);
if (!workflowRun) {
@@ -453,6 +459,7 @@ export function RunView({
{hasInputs ? (
<RunInputsSection
parameters={runInputs.parameters}
+ blockPrompts={runInputs.blockPrompts}
meta={runInputs.meta}
/>
) : (
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/blockPrompts.test.ts b/skyvern-frontend/src/routes/workflows/studio/runview/blockPrompts.test.ts
new file mode 100644
index 000000000..9ac51cb75
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/blockPrompts.test.ts
@@ -0,0 +1,207 @@
+import { describe, expect, test } from "vitest";
+
+import type { WorkflowBlock } from "../../types/workflowTypes";
+import { collectBlockPrompts } from "./blockPrompts";
+
+function block(value: Record<string, unknown>): WorkflowBlock {
+ return {
+ output_parameter: { key: "synthetic_output" },
+ continue_on_failure: false,
+ model: null,
+ ...value,
+ } as unknown as WorkflowBlock;
+}
+
+describe("collectBlockPrompts", () => {
+ test("collects all six fields in priority order and keeps multiple fields per block", () => {
+ const prompts = collectBlockPrompts([
+ block({
+ block_type: "task",
+ label: "multi-field block",
+ navigation_goal: "Navigate to the next step",
+ data_extraction_goal: "Extract the summary",
+ complete_criterion: "Stop after success",
+ terminate_criterion: "Stop after failure",
+ }),
+ block({
+ block_type: "text_prompt",
+ label: "prompt block",
+ prompt: "Summarize the supplied text",
+ }),
+ block({
+ block_type: "human_interaction",
+ label: "instruction block",
+ instructions: "Request a confirmation",
+ }),
+ ]);
+
+ expect(prompts).toEqual([
+ {
+ blockLabel: "multi-field block",
+ blockType: "task",
+ fields: [
+ {
+ fieldLabel: "Navigation goal",
+ prompt: "Navigate to the next step",
+ },
+ {
+ fieldLabel: "Extraction goal",
+ prompt: "Extract the summary",
+ },
+ {
+ fieldLabel: "Completion criterion",
+ prompt: "Stop after success",
+ },
+ {
+ fieldLabel: "Termination criterion",
+ prompt: "Stop after failure",
+ },
+ ],
+ },
+ {
+ blockLabel: "prompt block",
+ blockType: "text_prompt",
+ fields: [
+ { fieldLabel: "Prompt", prompt: "Summarize the supplied text" },
+ ],
+ },
+ {
+ blockLabel: "instruction block",
+ blockType: "human_interaction",
+ fields: [
+ { fieldLabel: "Instructions", prompt: "Request a confirmation" },
+ ],
+ },
+ ]);
+ });
+
+ test("emits a block with only a termination criterion", () => {
+ expect(
+ collectBlockPrompts([
+ block({
+ block_type: "validation",
+ label: "termination-only block",
+ complete_criterion: null,
+ terminate_criterion: "Terminate when the value is invalid",
+ }),
+ ]),
+ ).toEqual([
+ {
+ blockLabel: "termination-only block",
+ blockType: "validation",
+ fields: [
+ {
+ fieldLabel: "Termination criterion",
+ prompt: "Terminate when the value is invalid",
+ },
+ ],
+ },
+ ]);
+ });
+
+ test("flattens nested for and while loops in pre-order", () => {
+ const prompts = collectBlockPrompts([
+ block({
+ block_type: "task_v2",
+ label: "first block",
+ prompt: "First prompt",
+ }),
+ block({
+ block_type: "for_loop",
+ label: "outer loop",
+ loop_blocks: [
+ block({
+ block_type: "text_prompt",
+ label: "for child",
+ prompt: "For-loop prompt",
+ }),
+ block({
+ block_type: "while_loop",
+ label: "inner loop",
+ condition: {
+ criteria_type: "prompt",
+ expression: "Deferred condition prompt",
+ description: null,
+ },
+ loop_blocks: [
+ block({
+ block_type: "human_interaction",
+ label: "while child",
+ instructions: "While-loop instructions",
+ }),
+ ],
+ }),
+ ],
+ }),
+ ]);
+
+ expect(prompts.map(({ blockLabel }) => blockLabel)).toEqual([
+ "first block",
+ "for child",
+ "while child",
+ ]);
+ });
+
+ test("preserves non-empty whitespace, newlines, and templates verbatim", () => {
+ const prompt = " First line\n {{ synthetic_parameter }}\n Last line ";
+
+ expect(
+ collectBlockPrompts([
+ block({ block_type: "code", label: "template block", prompt }),
+ ]),
+ ).toEqual([
+ {
+ blockLabel: "template block",
+ blockType: "code",
+ fields: [{ fieldLabel: "Prompt", prompt }],
+ },
+ ]);
+ });
+
+ test("omits null, empty, whitespace-only, and non-prompt fields", () => {
+ expect(
+ collectBlockPrompts([
+ block({
+ block_type: "task",
+ label: "empty prompt fields",
+ navigation_goal: null,
+ data_extraction_goal: "",
+ complete_criterion: " ",
+ terminate_criterion: null,
+ }),
+ block({
+ block_type: "goto_url",
+ label: "url block",
+ url: "/synthetic",
+ }),
+ block({ block_type: "wait", label: "wait block", wait_sec: 1 }),
+ block({
+ block_type: "http_request",
+ label: "request block",
+ url: "/synthetic",
+ }),
+ ]),
+ ).toEqual([]);
+ });
+
+ test("does not mutate the input definition", () => {
+ const blocks = [
+ block({
+ block_type: "for_loop",
+ label: "loop block",
+ loop_blocks: [
+ block({
+ block_type: "task_v2",
+ label: "nested block",
+ prompt: "Nested prompt",
+ }),
+ ],
+ }),
+ ];
+ const before = JSON.stringify(blocks);
+
+ collectBlockPrompts(blocks);
+
+ expect(JSON.stringify(blocks)).toBe(before);
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/blockPrompts.ts b/skyvern-frontend/src/routes/workflows/studio/runview/blockPrompts.ts
new file mode 100644
index 000000000..6c9d1daaf
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/blockPrompts.ts
@@ -0,0 +1,58 @@
+import {
+ type WorkflowBlock,
+ type WorkflowBlockType,
+} from "../../types/workflowTypes";
+import { visitWorkflowBlocks } from "../../workflowBlockUtils";
+
+export type BlockPromptField = { fieldLabel: string; prompt: string };
+export type BlockPrompt = {
+ blockLabel: string;
+ blockType: WorkflowBlockType;
+ fields: BlockPromptField[];
+};
+
+function getBlockFields(block: WorkflowBlock): BlockPromptField[] {
+ const fields: BlockPromptField[] = [];
+ const push = (fieldLabel: string, value: unknown) => {
+ if (typeof value === "string" && value.trim().length > 0) {
+ fields.push({ fieldLabel, prompt: value });
+ }
+ };
+
+ if ("navigation_goal" in block) {
+ push("Navigation goal", block.navigation_goal);
+ }
+ if ("data_extraction_goal" in block) {
+ push("Extraction goal", block.data_extraction_goal);
+ }
+ if ("prompt" in block) {
+ push("Prompt", block.prompt);
+ }
+ if ("instructions" in block) {
+ push("Instructions", block.instructions);
+ }
+ if ("complete_criterion" in block) {
+ push("Completion criterion", block.complete_criterion);
+ }
+ if ("terminate_criterion" in block) {
+ push("Termination criterion", block.terminate_criterion);
+ }
+
+ return fields;
+}
+
+// Conditional-branch and while-loop natural-language criteria are intentionally excluded.
+export function collectBlockPrompts(blocks: WorkflowBlock[]): BlockPrompt[] {
+ const out: BlockPrompt[] = [];
+ visitWorkflowBlocks(blocks, (block) => {
+ const fields = getBlockFields(block);
+ if (fields.length > 0) {
+ out.push({
+ blockLabel: block.label,
+ blockType: block.block_type,
+ fields,
+ });
+ }
+ });
+ return out;
+}