Skip to content

Automate browser based workflows with AI

feat: improve workflow run page feedback during execution (SKY-8345) (#5136)

Celal Zamanoğlu4510c45d9126
diff --git a/skyvern-frontend/src/index.css b/skyvern-frontend/src/index.css
index 9dc2281f4..5d04f88aa 100644
--- a/skyvern-frontend/src/index.css
+++ b/skyvern-frontend/src/index.css
@@ -78,11 +78,11 @@
--input: 215.3 25% 26.7%;
--ring: 212.7 26.8% 83.9%;
- --slate-elevation-1: 228 45% 9%;
- --slate-elevation-2: 228 37% 10.6%;
- --slate-elevation-3: 227 30% 12%;
- --slate-elevation-4: 231 26% 14%;
- --slate-elevation-5: 230 22% 16%;
+ --slate-elevation-1: 228 45% 10%;
+ --slate-elevation-2: 228 37% 12%;
+ --slate-elevation-3: 227 30% 14%;
+ --slate-elevation-4: 231 26% 18%;
+ --slate-elevation-5: 230 22% 22%;
}
}
diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/ActionCard.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/ActionCard.tsx
index d6154c374..6cb72e12b 100644
--- a/skyvern-frontend/src/routes/workflows/workflowRun/ActionCard.tsx
+++ b/skyvern-frontend/src/routes/workflows/workflowRun/ActionCard.tsx
@@ -20,9 +20,10 @@ type Props = {
index: number;
active: boolean;
onClick: React.DOMAttributes<HTMLDivElement>["onClick"];
+ cardClassName?: string;
};
-function ActionCard({ action, onClick, active, index }: Props) {
+function ActionCard({ action, onClick, active, index, cardClassName }: Props) {
// Wait actions always succeed — they intentionally return ActionFailure
// from the backend but completing a wait is expected, not a failure.
const success =
@@ -35,7 +36,7 @@ function ActionCard({ action, onClick, active, index }: Props) {
active={active}
status={success ? "success" : "failure"}
onClick={onClick}
- className="flex"
+ className={cardClassName ? `flex ${cardClassName}` : "flex"}
>
<div className="flex-1 space-y-2 p-4 pl-5">
<div className="flex justify-between">
diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/RunCard.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/RunCard.tsx
index db7f61806..68151dfbe 100644
--- a/skyvern-frontend/src/routes/workflows/workflowRun/RunCard.tsx
+++ b/skyvern-frontend/src/routes/workflows/workflowRun/RunCard.tsx
@@ -31,16 +31,15 @@ function RunCard({
return (
<div
+ data-slot="runcard"
className={cn(
- "bg-slate-elevation3",
- status != null
- ? "rounded-lg border-2 border-transparent"
- : "rounded-md border",
+ "rounded-lg bg-slate-elevation4 ring-1 ring-transparent transition-all duration-200",
+ status != null && "border-l-2 border-l-transparent",
{
- "cursor-pointer hover:border-slate-50": !!onClick,
+ "cursor-pointer hover:ring-white/20": !!onClick,
"border-l-destructive": status === "failure",
"border-l-success": status === "success",
- "border-slate-50": active,
+ "ring-white/20": active,
},
className,
)}
diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/ThoughtCard.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/ThoughtCard.tsx
index 4ec04543e..961a3dc22 100644
--- a/skyvern-frontend/src/routes/workflows/workflowRun/ThoughtCard.tsx
+++ b/skyvern-frontend/src/routes/workflows/workflowRun/ThoughtCard.tsx
@@ -8,14 +8,17 @@ type Props = {
active: boolean;
thought: ObserverThought;
onClick: (thought: ObserverThought) => void;
+ cardClassName?: string;
};
-function ThoughtCard({ thought, onClick, active }: Props) {
+function ThoughtCard({ thought, onClick, active, cardClassName }: Props) {
return (
<RunCard
active={active}
onClick={() => onClick(thought)}
- className="space-y-3 p-4"
+ className={
+ cardClassName ? `space-y-3 p-4 ${cardClassName}` : "space-y-3 p-4"
+ }
>
<div className="flex justify-between">
<div className="flex gap-3">
diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.tsx
index f56fe2e66..a81a8001b 100644
--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.tsx
+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.tsx
@@ -3,6 +3,7 @@ import { Skeleton } from "@/components/ui/skeleton";
import { statusIsFinalized, statusIsNotFinalized } from "@/routes/tasks/types";
import { cn } from "@/util/utils";
import { DotFilledIcon } from "@radix-ui/react-icons";
+import { useEffect, useRef } from "react";
import { useWorkflowRunWithWorkflowQuery } from "../hooks/useWorkflowRunWithWorkflowQuery";
import { useWorkflowRunTimelineQuery } from "../hooks/useWorkflowRunTimelineQuery";
import {
@@ -41,6 +42,27 @@ function WorkflowRunTimeline({
const { data: workflowRunTimeline, isLoading: workflowRunTimelineIsLoading } =
useWorkflowRunTimelineQuery();
+ // Track known item IDs so we can animate only newly-arrived items
+ const knownItemIdsRef = useRef<Set<string>>(new Set());
+ const isInitialRenderRef = useRef(true);
+
+ // After each render, sync the known set and clear the initial-render flag.
+ // Important: the isNew check in the JSX below runs during render (before
+ // this effect), so it correctly compares against the previous render's set.
+ useEffect(() => {
+ if (!workflowRunTimeline) return;
+ const ids = new Set<string>();
+ for (const item of workflowRunTimeline) {
+ if (isBlockItem(item)) {
+ ids.add(item.block.workflow_run_block_id);
+ } else if (isThoughtItem(item)) {
+ ids.add(item.thought.thought_id);
+ }
+ }
+ knownItemIdsRef.current = ids;
+ isInitialRenderRef.current = false;
+ }, [workflowRunTimeline]);
+
if (workflowRunIsLoading || workflowRunTimelineIsLoading) {
return <Skeleton className="h-full w-full" />;
}
@@ -70,53 +92,83 @@ function WorkflowRunTimeline({
</div>
<ScrollArea>
<ScrollAreaViewport className="h-[37rem] max-h-[37rem]">
- <div className="space-y-4">
+ <div className="space-y-4 p-1">
{workflowRunIsNotFinalized && (
<div
key="stream"
className={cn(
- "flex cursor-pointer rounded-lg border-2 bg-slate-elevation3 p-4 hover:border-slate-50",
+ "flex cursor-pointer items-center gap-2 rounded-lg bg-gradient-to-r from-red-500/10 to-slate-elevation3 px-3 py-2 text-sm transition-colors duration-150 hover:from-red-500/20",
{
- "border-slate-50": activeItem === "stream",
+ "bg-slate-elevation5 from-red-500/20":
+ activeItem === "stream",
},
)}
onClick={onLiveStreamSelected}
>
- <div className="flex items-center gap-2">
- <DotFilledIcon className="h-6 w-6 text-destructive" />
- Live
- </div>
+ <DotFilledIcon className="h-5 w-5 animate-pulse text-destructive" />
+ Live
+ </div>
+ )}
+ {workflowRunIsNotFinalized && workflowRunTimeline.length === 0 && (
+ <div className="flex items-center justify-center py-8 text-sm text-slate-400">
+ Formulating actions...
</div>
)}
{workflowRunIsFinalized && workflowRunTimeline.length === 0 && (
<div>Workflow timeline is empty</div>
)}
{workflowRunTimeline?.map((timelineItem) => {
+ const itemId = isBlockItem(timelineItem)
+ ? timelineItem.block.workflow_run_block_id
+ : isThoughtItem(timelineItem)
+ ? timelineItem.thought.thought_id
+ : null;
+ const isNew =
+ itemId !== null &&
+ !isInitialRenderRef.current &&
+ !knownItemIdsRef.current.has(itemId);
+
if (isBlockItem(timelineItem)) {
return (
- <WorkflowRunTimelineBlockItem
+ <div
key={timelineItem.block.workflow_run_block_id}
- subItems={timelineItem.children}
- activeItem={activeItem}
- block={timelineItem.block}
- onActionClick={onActionItemSelected}
- onBlockItemClick={onBlockItemSelected}
- onThoughtCardClick={onObserverThoughtCardSelected}
- finallyBlockLabel={finallyBlockLabel}
- />
+ className={cn({
+ "duration-300 animate-in fade-in slide-in-from-top-3":
+ isNew,
+ })}
+ >
+ <WorkflowRunTimelineBlockItem
+ subItems={timelineItem.children}
+ activeItem={activeItem}
+ block={timelineItem.block}
+ onActionClick={onActionItemSelected}
+ onBlockItemClick={onBlockItemSelected}
+ onThoughtCardClick={onObserverThoughtCardSelected}
+ finallyBlockLabel={finallyBlockLabel}
+ workflowRunIsFinalized={workflowRunIsFinalized}
+ />
+ </div>
);
}
if (isThoughtItem(timelineItem)) {
return (
- <ThoughtCard
+ <div
key={timelineItem.thought.thought_id}
- active={
- isObserverThought(activeItem) &&
- activeItem.thought_id === timelineItem.thought.thought_id
- }
- onClick={onObserverThoughtCardSelected}
- thought={timelineItem.thought}
- />
+ className={cn({
+ "duration-300 animate-in fade-in slide-in-from-top-3":
+ isNew,
+ })}
+ >
+ <ThoughtCard
+ active={
+ isObserverThought(activeItem) &&
+ activeItem.thought_id ===
+ timelineItem.thought.thought_id
+ }
+ onClick={onObserverThoughtCardSelected}
+ thought={timelineItem.thought}
+ />
+ </div>
);
}
})}
diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.tsx
index eefdeaa82..795f71cee 100644
--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.tsx
+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.tsx
@@ -5,9 +5,11 @@ import {
CrossCircledIcon,
CubeIcon,
ExternalLinkIcon,
+ ReloadIcon,
} from "@radix-ui/react-icons";
import { useCallback, useEffect, useMemo, useState } from "react";
import { Link } from "react-router-dom";
+import { useShimmerText } from "./useShimmerText";
import { Status } from "@/api/types";
import {
@@ -48,6 +50,7 @@ type Props = {
onActionClick: (action: ActionItem) => void;
onThoughtCardClick: (thought: ObserverThought) => void;
finallyBlockLabel?: string | null;
+ workflowRunIsFinalized?: boolean;
};
type LoopIterationGroup = {
@@ -56,6 +59,30 @@ type LoopIterationGroup = {
items: Array<WorkflowRunTimelineItem>;
};
+const blockElevationByDepth = [
+ "bg-slate-elevation3",
+ "bg-slate-elevation4",
+ "bg-slate-elevation5",
+];
+
+const cardElevationByDepth = [
+ "bg-slate-elevation4",
+ "bg-slate-elevation5",
+ "bg-slate-elevation5",
+];
+
+function getBlockElevation(depth: number): string {
+ return blockElevationByDepth[
+ Math.min(depth, blockElevationByDepth.length - 1)
+ ]!;
+}
+
+function getCardElevation(depth: number): string {
+ return cardElevationByDepth[
+ Math.min(depth, cardElevationByDepth.length - 1)
+ ]!;
+}
+
function stringifyTimelineValue(value: unknown): string {
if (value === null || value === undefined) {
return "null";
@@ -209,6 +236,7 @@ type TimelineSubItemsProps = {
onActionClick: (action: ActionItem) => void;
onThoughtCardClick: (thought: ObserverThought) => void;
finallyBlockLabel?: string | null;
+ workflowRunIsFinalized?: boolean;
};
function TimelineSubItems({
@@ -219,6 +247,7 @@ function TimelineSubItems({
onActionClick,
onThoughtCardClick,
finallyBlockLabel,
+ workflowRunIsFinalized,
}: TimelineSubItemsProps) {
return (
<div className="space-y-3">
@@ -235,6 +264,7 @@ function TimelineSubItems({
onBlockItemClick={onBlockItemClick}
onThoughtCardClick={onThoughtCardClick}
finallyBlockLabel={finallyBlockLabel}
+ workflowRunIsFinalized={workflowRunIsFinalized}
/>
);
}
@@ -249,6 +279,7 @@ function TimelineSubItems({
}
onClick={onThoughtCardClick}
thought={item.thought}
+ cardClassName={getCardElevation(depth)}
/>
);
}
@@ -266,6 +297,7 @@ function WorkflowRunTimelineBlockItem({
onActionClick,
onThoughtCardClick,
finallyBlockLabel,
+ workflowRunIsFinalized = false,
}: Props) {
const actions = block.actions ?? [];
const isFinallyBlock = finallyBlockLabel && block.label === finallyBlockLabel;
@@ -290,6 +322,9 @@ function WorkflowRunTimelineBlockItem({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
+ const isRunning = block.status === Status.Running && !workflowRunIsFinalized;
+ const shimmerTitleRef = useShimmerText<HTMLSpanElement>(isRunning);
+ const shimmerLabelRef = useShimmerText<HTMLSpanElement>(isRunning);
const showStatusIndicator = block.status !== null;
const showSuccessIndicator =
@@ -379,14 +414,16 @@ function WorkflowRunTimelineBlockItem({
<div
className={cn({
"ml-3 pl-3": depth > 0,
- "border-l border-slate-700": depth === 1,
+ "border-l border-slate-700": depth > 0,
})}
>
<div
+ data-slot="block-item"
className={cn(
- "cursor-pointer space-y-4 rounded border border-slate-600 p-4",
+ "cursor-pointer rounded-lg ring-1 ring-transparent transition-all duration-200 [&:hover:not(:has([data-slot=runcard]:hover,[data-slot=block-item]:hover))]:ring-white/20",
+ getBlockElevation(depth),
{
- "border-slate-50":
+ "ring-white/20":
isWorkflowRunBlock(activeItem) &&
activeItem.workflow_run_block_id === block.workflow_run_block_id,
},
@@ -397,331 +434,350 @@ function WorkflowRunTimelineBlockItem({
}}
ref={refCallback}
>
- <div className="space-y-2">
- <div className="flex justify-between">
- <div className="flex gap-3">
- <div className="rounded bg-slate-elevation5 p-2">
- <WorkflowBlockIcon
- workflowBlockType={block.block_type}
- className="size-6"
- />
- </div>
+ <div className="space-y-4 p-4">
+ <div className="space-y-2">
+ <div className="flex justify-between">
+ <div className="flex gap-3">
+ <div className="relative rounded bg-slate-800 p-2">
+ <WorkflowBlockIcon
+ workflowBlockType={block.block_type}
+ className="size-6"
+ />
+ {isRunning && (
+ <div className="absolute -bottom-1 -left-1 rounded-full bg-slate-elevation3 p-0.5">
+ <ReloadIcon className="size-3 animate-spin text-slate-400" />
+ </div>
+ )}
+ </div>
- <div className="flex flex-col gap-1">
- <span className="text-sm">
- {workflowBlockTitle[block.block_type]}
- </span>
- <span className="flex gap-2 text-xs text-slate-400">
- {block.label}
- </span>
- {isFinallyBlock && (
- <span className="w-fit rounded bg-amber-500 px-1.5 py-0.5 text-[10px] font-medium text-black">
- Execute on any outcome
+ <div className="flex flex-col gap-1">
+ <span ref={shimmerTitleRef} className="text-sm">
+ {workflowBlockTitle[block.block_type]}
</span>
+ <span
+ ref={shimmerLabelRef}
+ className="flex gap-2 text-xs text-slate-400"
+ >
+ {block.label}
+ </span>
+ {isFinallyBlock && (
+ <span className="w-fit rounded bg-amber-500 px-1.5 py-0.5 text-[10px] font-medium text-black">
+ Execute on any outcome
+ </span>
+ )}
+ </div>
+ </div>
+ <div className="flex gap-2">
+ {showFailureIndicator && (
+ <div className="self-start rounded bg-slate-elevation5 px-2 py-1">
+ <CrossCircledIcon className="size-4 text-destructive" />
+ </div>
+ )}
+ {showSuccessIndicator && (
+ <div className="self-start rounded bg-slate-elevation5 px-2 py-1">
+ <CheckCircledIcon className="size-4 text-success" />
+ </div>
)}
+ <div className="flex flex-col items-end gap-[1px]">
+ <div className="flex gap-1 self-start rounded bg-slate-elevation5 px-2 py-1">
+ {showDiagnosticLink ? (
+ <Link
+ to={`/tasks/${block.task_id}/diagnostics`}
+ onClick={(event) => event.stopPropagation()}
+ >
+ <div className="flex gap-1">
+ <ExternalLinkIcon className="size-4" />
+ <span className="text-xs">Diagnostics</span>
+ </div>
+ </Link>
+ ) : (
+ <>
+ <CubeIcon className="size-4" />
+ <span className="text-xs">Block</span>
+ </>
+ )}
+ </div>
+ {duration && showDuration && (
+ <div className="pr-[5px] text-xs text-[#00ecff]">
+ {duration}
+ </div>
+ )}
+ </div>
</div>
</div>
- <div className="flex gap-2">
- {showFailureIndicator && (
- <div className="self-start rounded bg-slate-elevation5 px-2 py-1">
- <CrossCircledIcon className="size-4 text-destructive" />
- </div>
- )}
- {showSuccessIndicator && (
- <div className="self-start rounded bg-slate-elevation5 px-2 py-1">
- <CheckCircledIcon className="size-4 text-success" />
+ {block.description ? (
+ <div className="text-xs text-slate-400">{block.description}</div>
+ ) : null}
+ {isLoopBlock && (
+ <div className="space-y-2 rounded bg-slate-elevation5 px-3 py-2 text-xs">
+ <div className="text-slate-300">
+ Iterable values:{" "}
+ <span className="font-medium text-slate-200">
+ {loopValues.length}
+ </span>
</div>
- )}
- <div className="flex flex-col items-end gap-[1px]">
- <div className="flex gap-1 self-start rounded bg-slate-elevation5 px-2 py-1">
- {showDiagnosticLink ? (
- <Link
- to={`/tasks/${block.task_id}/diagnostics`}
- onClick={(event) => event.stopPropagation()}
- >
- <div className="flex gap-1">
- <ExternalLinkIcon className="size-4" />
- <span className="text-xs">Diagnostics</span>
+ {loopValues.length > 0 && (
+ <div className="max-h-40 space-y-1 overflow-y-auto pr-1">
+ {loopValues.map((value, index) => (
+ <div key={index} className="text-slate-400">
+ <span className="mr-1 text-slate-500">[{index}]</span>
+ <code className="rounded bg-slate-elevation1 px-1 py-0.5 font-mono text-slate-300">
+ {truncateValue(stringifyTimelineValue(value), 120)}
+ </code>
</div>
- </Link>
- ) : (
- <>
- <CubeIcon className="size-4" />
- <span className="text-xs">Block</span>
- </>
- )}
- </div>
- {duration && showDuration && (
- <div className="pr-[5px] text-xs text-[#00ecff]">
- {duration}
+ ))}
</div>
)}
</div>
- </div>
- </div>
- {block.description ? (
- <div className="text-xs text-slate-400">{block.description}</div>
- ) : null}
- {isLoopBlock && (
- <div className="space-y-2 rounded bg-slate-elevation5 px-3 py-2 text-xs">
- <div className="text-slate-300">
- Iterable values:{" "}
- <span className="font-medium text-slate-200">
- {loopValues.length}
- </span>
+ )}
+ {block.block_type === "conditional" && block.executed_branch_id && (
+ <div className="space-y-2 rounded bg-slate-elevation5 px-3 py-2 text-xs">
+ {hasEvaluations(block.output) && block.output.evaluations ? (
+ // New format: show all branch evaluations
+ <div className="space-y-2">
+ {block.output.evaluations.map((evaluation, index) => (
+ <div
+ key={evaluation.branch_id || index}
+ className={cn(
+ "rounded border px-2 py-1.5",
+ evaluation.is_matched
+ ? "border-success/50 bg-success/10"
+ : "border-slate-600 bg-slate-elevation3",
+ )}
+ >
+ {evaluation.is_default ? (
+ <div className="text-slate-300">
+ <span className="font-medium">Default branch</span>
+ {evaluation.is_matched && (
+ <span className="ml-2 text-success">
+ ✓ Matched
+ </span>
+ )}
+ </div>
+ ) : (
+ <div className="space-y-1">
+ <div className="text-slate-400">
+ <code className="rounded bg-slate-elevation1 px-1 py-0.5 font-mono text-slate-300">
+ {evaluation.original_expression}
+ </code>
+ </div>
+ {evaluation.rendered_expression &&
+ evaluation.rendered_expression !==
+ evaluation.original_expression && (
+ <div className="text-slate-400">
+ → rendered to{" "}
+ <code className="rounded bg-slate-elevation1 px-1 py-0.5 font-mono text-slate-200">
+ {evaluation.rendered_expression}
+ </code>
+ </div>
+ )}
+ <div className="flex items-center gap-2">
+ <span className="text-slate-400">
+ evaluated to
+ </span>
+ <span
+ className={cn(
+ "font-medium",
+ evaluation.result
+ ? "text-success"
+ : "text-red-400",
+ )}
+ >
+ {evaluation.result ? "True" : "False"}
+ </span>
+ {evaluation.is_matched && (
+ <span className="text-success">✓ Matched</span>
+ )}
+ </div>
+ </div>
+ )}
+ {evaluation.is_matched &&
+ evaluation.next_block_label && (
+ <div className="mt-1 text-slate-400">
+ → Executing next block:{" "}
+ <span className="font-medium text-slate-300">
+ {evaluation.next_block_label}
+ </span>
+ </div>
+ )}
+ </div>
+ ))}
+ </div>
+ ) : (
+ // Fallback: old format without evaluations array
+ <>
+ {block.executed_branch_expression !== null &&
+ block.executed_branch_expression !== undefined ? (
+ <div className="text-slate-300">
+ Condition{" "}
+ <code className="rounded bg-slate-elevation3 px-1.5 py-0.5 font-mono text-slate-200">
+ {block.executed_branch_expression}
+ </code>{" "}
+ evaluated to{" "}
+ <span className="font-medium text-success">True</span>
+ </div>
+ ) : (
+ <div className="text-slate-300">
+ No conditions matched, executing default branch
+ </div>
+ )}
+ {block.executed_branch_next_block && (
+ <div className="text-slate-400">
+ → Executing next block:{" "}
+ <span className="font-medium text-slate-300">
+ {block.executed_branch_next_block}
+ </span>
+ </div>
+ )}
+ </>
+ )}
</div>
- {loopValues.length > 0 && (
- <div className="max-h-40 space-y-1 overflow-y-auto pr-1">
- {loopValues.map((value, index) => (
- <div key={index} className="text-slate-400">
- <span className="mr-1 text-slate-500">[{index}]</span>
- <code className="rounded bg-slate-elevation1 px-1 py-0.5 font-mono text-slate-300">
- {truncateValue(stringifyTimelineValue(value), 120)}
- </code>
+ )}
+ </div>
+
+ {block.block_type === "human_interaction" && (
+ <WorkflowRunHumanInteraction workflowRunBlock={block} />
+ )}
+
+ {actions.map((action, index) => {
+ return (
+ <ActionCard
+ key={action.action_id}
+ action={action}
+ active={
+ isAction(activeItem) &&
+ activeItem.action_id === action.action_id
+ }
+ index={actions.length - index}
+ onClick={(event) => {
+ event.stopPropagation();
+ const actionItem: ActionItem = {
+ block,
+ action,
+ };
+ onActionClick(actionItem);
+ }}
+ cardClassName={getCardElevation(depth)}
+ />
+ );
+ })}
+
+ {hasNestedChildren && isLoopBlock && (
+ <div className="space-y-2">
+ {loopIterationGroups.map((group, groupIndex) => {
+ const loopValueFromIterable =
+ group.index !== null ? loopValues[group.index] ?? null : null;
+ const iterationNumber =
+ group.index !== null ? group.index + 1 : groupIndex + 1;
+ const currentValuePreview = truncateValue(
+ stringifyTimelineValue(
+ loopValueFromIterable ?? group.currentValue,
+ ),
+ 140,
+ );
+
+ return (
+ <Collapsible
+ key={`${group.index ?? "unknown"}-${groupIndex}`}
+ open={openLoopGroups.has(groupIndex)}
+ onOpenChange={(open) => {
+ setOpenLoopGroups((prev) => {
+ const next = new Set(prev);
+ if (open) {
+ next.add(groupIndex);
+ } else {
+ next.delete(groupIndex);
+ }
+ return next;
+ });
+ }}
+ >
+ <div className="rounded border border-slate-700 bg-slate-elevation4">
+ <CollapsibleTrigger asChild>
+ <button
+ className="group flex w-full items-center justify-between gap-2 px-2 py-1 text-left"
+ onClick={(event) => event.stopPropagation()}
+ >
+ <div className="flex items-center gap-1.5">
+ <ChevronRightIcon className="size-4 text-slate-300 transition-transform group-data-[state=open]:rotate-90" />
+ <span className="text-xs text-slate-200">{`Iteration ${iterationNumber}`}</span>
+ </div>
+ <code className="max-w-[70%] truncate rounded bg-slate-elevation1 px-1 py-0.5 text-[11px] text-slate-300">
+ current_value: {currentValuePreview}
+ </code>
+ </button>
+ </CollapsibleTrigger>
</div>
- ))}
- </div>
- )}
+ <CollapsibleContent className="px-2 pb-2 pt-2">
+ <TimelineSubItems
+ items={group.items}
+ activeItem={activeItem}
+ depth={depth + 1}
+ onActionClick={onActionClick}
+ onBlockItemClick={onBlockItemClick}
+ onThoughtCardClick={onThoughtCardClick}
+ finallyBlockLabel={finallyBlockLabel}
+ workflowRunIsFinalized={workflowRunIsFinalized}
+ />
+ </CollapsibleContent>
+ </Collapsible>
+ );
+ })}
</div>
)}
- {block.block_type === "conditional" && block.executed_branch_id && (
- <div className="space-y-2 rounded bg-slate-elevation5 px-3 py-2 text-xs">
- {hasEvaluations(block.output) && block.output.evaluations ? (
- // New format: show all branch evaluations
- <div className="space-y-2">
- {block.output.evaluations.map((evaluation, index) => (
- <div
- key={evaluation.branch_id || index}
- className={cn(
- "rounded border px-2 py-1.5",
- evaluation.is_matched
- ? "border-success/50 bg-success/10"
- : "border-slate-600 bg-slate-elevation3",
- )}
- >
- {evaluation.is_default ? (
- <div className="text-slate-300">
- <span className="font-medium">Default branch</span>
- {evaluation.is_matched && (
- <span className="ml-2 text-success">✓ Matched</span>
- )}
- </div>
+
+ {hasNestedChildren && isConditionalBlock && (
+ <Collapsible open={childrenOpen} onOpenChange={setChildrenOpen}>
+ <div className="rounded border border-slate-700 bg-slate-elevation4 px-2 py-1.5">
+ <CollapsibleTrigger asChild>
+ <button
+ className="flex w-full items-center justify-between gap-2 text-left"
+ onClick={(event) => event.stopPropagation()}
+ >
+ <div className="flex items-center gap-1.5 text-xs text-slate-200">
+ {childrenOpen ? (
+ <ChevronDownIcon className="size-4" />
) : (
- <div className="space-y-1">
- <div className="text-slate-400">
- <code className="rounded bg-slate-elevation1 px-1 py-0.5 font-mono text-slate-300">
- {evaluation.original_expression}
- </code>
- </div>
- {evaluation.rendered_expression &&
- evaluation.rendered_expression !==
- evaluation.original_expression && (
- <div className="text-slate-400">
- → rendered to{" "}
- <code className="rounded bg-slate-elevation1 px-1 py-0.5 font-mono text-slate-200">
- {evaluation.rendered_expression}
- </code>
- </div>
- )}
- <div className="flex items-center gap-2">
- <span className="text-slate-400">evaluated to</span>
- <span
- className={cn(
- "font-medium",
- evaluation.result
- ? "text-success"
- : "text-red-400",
- )}
- >
- {evaluation.result ? "True" : "False"}
- </span>
- {evaluation.is_matched && (
- <span className="text-success">✓ Matched</span>
- )}
- </div>
- </div>
+ <ChevronRightIcon className="size-4" />
)}
- {evaluation.is_matched && evaluation.next_block_label && (
- <div className="mt-1 text-slate-400">
- → Executing next block:{" "}
- <span className="font-medium text-slate-300">
- {evaluation.next_block_label}
- </span>
- </div>
- )}
- </div>
- ))}
- </div>
- ) : (
- // Fallback: old format without evaluations array
- <>
- {block.executed_branch_expression !== null &&
- block.executed_branch_expression !== undefined ? (
- <div className="text-slate-300">
- Condition{" "}
- <code className="rounded bg-slate-elevation3 px-1.5 py-0.5 font-mono text-slate-200">
- {block.executed_branch_expression}
- </code>{" "}
- evaluated to{" "}
- <span className="font-medium text-success">True</span>
+ <span>{`Executed branch blocks (${subItems.length})`}</span>
</div>
- ) : (
- <div className="text-slate-300">
- No conditions matched, executing default branch
- </div>
- )}
- {block.executed_branch_next_block && (
- <div className="text-slate-400">
- → Executing next block:{" "}
- <span className="font-medium text-slate-300">
- {block.executed_branch_next_block}
+ {block.executed_branch_next_block && (
+ <span className="text-[11px] text-slate-400">
+ next: {block.executed_branch_next_block}
</span>
- </div>
- )}
- </>
- )}
- </div>
+ )}
+ </button>
+ </CollapsibleTrigger>
+ </div>
+ <CollapsibleContent className="space-y-2 pt-2">
+ <TimelineSubItems
+ items={subItems}
+ activeItem={activeItem}
+ depth={depth + 1}
+ onActionClick={onActionClick}
+ onBlockItemClick={onBlockItemClick}
+ onThoughtCardClick={onThoughtCardClick}
+ finallyBlockLabel={finallyBlockLabel}
+ workflowRunIsFinalized={workflowRunIsFinalized}
+ />
+ </CollapsibleContent>
+ </Collapsible>
)}
- </div>
-
- {block.block_type === "human_interaction" && (
- <WorkflowRunHumanInteraction workflowRunBlock={block} />
- )}
- {actions.map((action, index) => {
- return (
- <ActionCard
- key={action.action_id}
- action={action}
- active={
- isAction(activeItem) &&
- activeItem.action_id === action.action_id
- }
- index={actions.length - index}
- onClick={(event) => {
- event.stopPropagation();
- const actionItem: ActionItem = {
- block,
- action,
- };
- onActionClick(actionItem);
- }}
+ {hasNestedChildren && !isLoopBlock && !isConditionalBlock && (
+ <TimelineSubItems
+ items={subItems}
+ activeItem={activeItem}
+ depth={depth + 1}
+ onActionClick={onActionClick}
+ onBlockItemClick={onBlockItemClick}
+ onThoughtCardClick={onThoughtCardClick}
+ finallyBlockLabel={finallyBlockLabel}
+ workflowRunIsFinalized={workflowRunIsFinalized}
/>
- );
- })}
-
- {hasNestedChildren && isLoopBlock && (
- <div className="space-y-2">
- {loopIterationGroups.map((group, groupIndex) => {
- const loopValueFromIterable =
- group.index !== null ? loopValues[group.index] ?? null : null;
- const iterationNumber =
- group.index !== null ? group.index + 1 : groupIndex + 1;
- const currentValuePreview = truncateValue(
- stringifyTimelineValue(
- loopValueFromIterable ?? group.currentValue,
- ),
- 140,
- );
-
- return (
- <Collapsible
- key={`${group.index ?? "unknown"}-${groupIndex}`}
- open={openLoopGroups.has(groupIndex)}
- onOpenChange={(open) => {
- setOpenLoopGroups((prev) => {
- const next = new Set(prev);
- if (open) {
- next.add(groupIndex);
- } else {
- next.delete(groupIndex);
- }
- return next;
- });
- }}
- >
- <div className="rounded border border-slate-700 bg-slate-elevation4">
- <CollapsibleTrigger asChild>
- <button
- className="group flex w-full items-center justify-between gap-2 px-2 py-1 text-left"
- onClick={(event) => event.stopPropagation()}
- >
- <div className="flex items-center gap-1.5">
- <ChevronRightIcon className="size-4 text-slate-300 transition-transform group-data-[state=open]:rotate-90" />
- <span className="text-xs text-slate-200">{`Iteration ${iterationNumber}`}</span>
- </div>
- <code className="max-w-[70%] truncate rounded bg-slate-elevation1 px-1 py-0.5 text-[11px] text-slate-300">
- current_value: {currentValuePreview}
- </code>
- </button>
- </CollapsibleTrigger>
- </div>
- <CollapsibleContent className="px-2 pb-2 pt-2">
- <TimelineSubItems
- items={group.items}
- activeItem={activeItem}
- depth={depth + 1}
- onActionClick={onActionClick}
- onBlockItemClick={onBlockItemClick}
- onThoughtCardClick={onThoughtCardClick}
- finallyBlockLabel={finallyBlockLabel}
- />
- </CollapsibleContent>
- </Collapsible>
- );
- })}
- </div>
- )}
-
- {hasNestedChildren && isConditionalBlock && (
- <Collapsible open={childrenOpen} onOpenChange={setChildrenOpen}>
- <div className="rounded border border-slate-700 bg-slate-elevation4 px-2 py-1.5">
- <CollapsibleTrigger asChild>
- <button
- className="flex w-full items-center justify-between gap-2 text-left"
- onClick={(event) => event.stopPropagation()}
- >
- <div className="flex items-center gap-1.5 text-xs text-slate-200">
- {childrenOpen ? (
- <ChevronDownIcon className="size-4" />
- ) : (
- <ChevronRightIcon className="size-4" />
- )}
- <span>{`Executed branch blocks (${subItems.length})`}</span>
- </div>
- {block.executed_branch_next_block && (
- <span className="text-[11px] text-slate-400">
- next: {block.executed_branch_next_block}
- </span>
- )}
- </button>
- </CollapsibleTrigger>
- </div>
- <CollapsibleContent className="space-y-2 pt-2">
- <TimelineSubItems
- items={subItems}
- activeItem={activeItem}
- depth={depth + 1}
- onActionClick={onActionClick}
- onBlockItemClick={onBlockItemClick}
- onThoughtCardClick={onThoughtCardClick}
- finallyBlockLabel={finallyBlockLabel}
- />
- </CollapsibleContent>
- </Collapsible>
- )}
-
- {hasNestedChildren && !isLoopBlock && !isConditionalBlock && (
- <TimelineSubItems
- items={subItems}
- activeItem={activeItem}
- depth={depth + 1}
- onActionClick={onActionClick}
- onBlockItemClick={onBlockItemClick}
- onThoughtCardClick={onThoughtCardClick}
- finallyBlockLabel={finallyBlockLabel}
- />
- )}
+ )}
+ </div>
</div>
</div>
);
diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/useShimmerText.ts b/skyvern-frontend/src/routes/workflows/workflowRun/useShimmerText.ts
new file mode 100644
index 000000000..b71b48cf9
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/workflowRun/useShimmerText.ts
@@ -0,0 +1,43 @@
+import { useCallback, useEffect, useState } from "react";
+
+function useShimmerText<T extends HTMLElement = HTMLElement>(active: boolean) {
+ const [element, setElement] = useState<T | null>(null);
+
+ const ref = useCallback((el: T | null) => {
+ setElement(el);
+ }, []);
+
+ useEffect(() => {
+ if (!active || !element) return;
+
+ // Apply static styles for background-clip: text
+ element.style.background =
+ "linear-gradient(90deg, rgba(255,255,255,0.4) 25%, rgba(255,255,255,1) 50%, rgba(255,255,255,0.4) 75%)";
+ element.style.backgroundSize = "200% 100%";
+ element.style.webkitBackgroundClip = "text";
+ element.style.backgroundClip = "text";
+ element.style.webkitTextFillColor = "transparent";
+
+ const animation = element.animate(
+ [
+ { backgroundPosition: "200% center" },
+ { backgroundPosition: "-200% center" },
+ ],
+ { duration: 2000, iterations: Infinity, easing: "linear" },
+ );
+
+ return () => {
+ animation.cancel();
+ element.style.background = "";
+ element.style.backgroundSize = "";
+ element.style.backgroundPosition = "";
+ element.style.webkitBackgroundClip = "";
+ element.style.backgroundClip = "";
+ element.style.webkitTextFillColor = "";
+ };
+ }, [active, element]);
+
+ return ref;
+}
+
+export { useShimmerText };