@@ -27,6 +27,7 @@ import {
2727 executionLogsAtom ,
2828 selectedExecutionIdAtom ,
2929} from "@/lib/workflow-store" ;
30+ import { findActionById } from "@/plugins" ;
3031import { Button } from "../ui/button" ;
3132import { Spinner } from "../ui/spinner" ;
3233
@@ -68,7 +69,7 @@ function getOutputConfig(nodeType: string): OutputDisplayConfig | undefined {
6869// Helper to extract the displayable value from output based on config
6970function getOutputDisplayValue (
7071 output : unknown ,
71- config : OutputDisplayConfig
72+ config : { type : "image" | "video" | "url" ; field : string }
7273) : string | undefined {
7374 if ( typeof output !== "object" || output === null ) {
7475 return ;
@@ -265,31 +266,51 @@ function CollapsibleSection({
265266function OutputDisplay ( {
266267 output,
267268 input,
269+ actionType,
268270} : {
269271 output : unknown ;
270272 input ?: unknown ;
273+ actionType ?: string ;
271274} ) {
272- // Get actionType from input to look up the output config
273- const actionType =
274- typeof input === "object" && input !== null
275- ? ( input as Record < string , unknown > ) . actionType
276- : undefined ;
277- const config =
278- typeof actionType === "string" ? getOutputConfig ( actionType ) : undefined ;
279- const displayValue = config
280- ? getOutputDisplayValue ( output , config )
275+ // Look up action from plugin registry to get outputConfig (including custom components)
276+ const action = actionType ? findActionById ( actionType ) : undefined ;
277+ const pluginConfig = action ?. outputConfig ;
278+
279+ // Fall back to auto-generated config for legacy support (only built-in types)
280+ const builtInConfig = actionType ? getOutputConfig ( actionType ) : undefined ;
281+
282+ // Get the effective built-in config (plugin config if not component, else auto-generated)
283+ const effectiveBuiltInConfig =
284+ pluginConfig ?. type !== "component" ? pluginConfig : builtInConfig ;
285+
286+ // Get display value for built-in types (image/video/url)
287+ const displayValue = effectiveBuiltInConfig
288+ ? getOutputDisplayValue ( output , effectiveBuiltInConfig )
281289 : undefined ;
282290
283291 // Check for legacy base64 image
284- const isLegacyBase64 = ! config && isBase64ImageOutput ( output ) ;
292+ const isLegacyBase64 =
293+ ! ( pluginConfig || builtInConfig ) && isBase64ImageOutput ( output ) ;
285294
286295 const renderRichResult = ( ) => {
287- if ( config && displayValue ) {
288- switch ( config . type ) {
296+ // Priority 1: Custom component from plugin outputConfig
297+ if ( pluginConfig ?. type === "component" ) {
298+ const CustomComponent = pluginConfig . component ;
299+ return (
300+ < div className = "overflow-hidden rounded-lg border bg-muted/50 p-3" >
301+ < CustomComponent input = { input } output = { output } />
302+ </ div >
303+ ) ;
304+ }
305+
306+ // Priority 2: Built-in output config (image/video/url)
307+ if ( effectiveBuiltInConfig && displayValue ) {
308+ switch ( effectiveBuiltInConfig . type ) {
289309 case "image" : {
290310 // Handle base64 images by adding data URI prefix if needed
291311 const imageSrc =
292- config . field === "base64" && ! displayValue . startsWith ( "data:" )
312+ effectiveBuiltInConfig . field === "base64" &&
313+ ! displayValue . startsWith ( "data:" )
293314 ? `data:image/png;base64,${ displayValue } `
294315 : displayValue ;
295316 return (
@@ -355,6 +376,12 @@ function OutputDisplay({
355376 const richResult = renderRichResult ( ) ;
356377 const hasRichResult = richResult !== null ;
357378
379+ // Determine external link for URL type configs
380+ const externalLink =
381+ effectiveBuiltInConfig ?. type === "url" && displayValue
382+ ? displayValue
383+ : undefined ;
384+
358385 return (
359386 < >
360387 { /* Always show JSON output */ }
@@ -368,7 +395,7 @@ function OutputDisplay({
368395 { hasRichResult && (
369396 < CollapsibleSection
370397 defaultExpanded
371- externalLink = { config ?. type === "url" ? displayValue : undefined }
398+ externalLink = { externalLink }
372399 title = "Result"
373400 >
374401 { richResult }
@@ -458,7 +485,11 @@ function ExecutionLogEntry({
458485 </ CollapsibleSection >
459486 ) }
460487 { log . output !== null && log . output !== undefined && (
461- < OutputDisplay input = { log . input } output = { log . output } />
488+ < OutputDisplay
489+ actionType = { log . nodeType }
490+ input = { log . input }
491+ output = { log . output }
492+ />
462493 ) }
463494 { log . error && (
464495 < CollapsibleSection
0 commit comments