+ {completedSteps.map((step, stepIndex) => {
+ const node = nodes.find((n) => n.id === step.nodeId);
+ const displayName =
+ node?.title || node?.data?.title || step.nodeTitle;
+ const StepIcon = NODE_ICONS[step.nodeType] || Circle;
+ const stateVars = step.stateDelta
+ ? Object.entries(step.stateDelta).filter(
+ ([key]) => !['query', 'chat_history'].includes(key),
+ )
+ : [];
- const truncateText = (text: string, maxLength: number) => {
- if (text.length <= maxLength) return text;
- return text.slice(0, maxLength) + '...';
- };
- const hasOutput =
- step.output !== undefined &&
- step.output !== null &&
- formatValue(step.output) !== '';
- const formattedOutput = hasOutput ? formatValue(step.output) : '';
+ const truncateText = (text: string, maxLength: number) => {
+ if (text.length <= maxLength) return text;
+ return text.slice(0, maxLength) + '...';
+ };
+ const hasOutput =
+ step.output !== undefined &&
+ step.output !== null &&
+ formatValue(step.output) !== '';
+ const formattedOutput = hasOutput ? formatValue(step.output) : '';
- return (
-
{
- if (el && stepRefs) stepRefs.current.set(step.nodeId, el);
- }}
- className="bg-muted rounded-xl p-3"
- >
-
-
- {stepIndex + 1}.
-
-
-
-
-
- {displayName}
-
-
- {step.status === 'completed' && (
-
- )}
- {step.status === 'failed' && (
-
- )}
-
-
- {(hasOutput || step.error || stateVars.length > 0) && (
-
- {hasOutput && (
-
-
- {t('agents.workflow.preview.outputLabel')}{' '}
-
-
- {truncateText(formattedOutput, 300)}
-
-
- )}
- {step.error && (
-
-
-
-
- {t('agents.workflow.preview.errorLabel')}{' '}
-
-
- {step.error}
-
-
-
- )}
- {stateVars.length > 0 && (
-
- {stateVars.map(([key, value]) => (
-
-
- {key}:
-
-
- {truncateText(formatValue(value), 50)}
-
-
- ))}
-
- )}
-
+ // A step is a place you read inside: a subtle panel on the
+ // drawer's background, with its output in a filled well.
+ return (
+
{
+ if (el && stepRefs) stepRefs.current.set(step.nodeId, el);
+ }}
+ variant="subtle"
+ padding="sm"
+ >
+
+
+ {stepIndex + 1}.
+
+
+
+ {displayName}
+
+
+ {step.status === 'completed' && (
+
+ )}
+ {step.status === 'failed' && (
+
)}
- );
- })}
-
-