import { FileIcon } from "@radix-ui/react-icons"; import { CodeEditor } from "../components/CodeEditor"; import { useWorkflowRunQuery } from "../hooks/useWorkflowRunQuery"; import { useActiveWorkflowRunItem } from "@/routes/workflows/workflowRun/useActiveWorkflowRunItem"; import { hasExtractedInformation, isAction, isWorkflowRunBlock, } from "../types/workflowRunTypes"; import { findBlockSurroundingAction } from "@/routes/workflows/workflowRun/workflowTimelineUtils"; import { useWorkflowRunTimelineQuery } from "../hooks/useWorkflowRunTimelineQuery"; import { Status } from "@/api/types"; import { AutoResizingTextarea } from "@/components/AutoResizingTextarea/AutoResizingTextarea"; import { isTaskVariantBlock } from "../types/workflowTypes"; function DebuggerRunOutput() { const { data: workflowRunTimeline, isLoading: workflowRunTimelineIsLoading } = useWorkflowRunTimelineQuery(); const [activeItem] = useActiveWorkflowRunItem(); const { data: workflowRun } = useWorkflowRunQuery(); if (workflowRunTimelineIsLoading) { return
Loading...
; } if (!workflowRunTimeline) { return null; } function getActiveBlock() { if (!workflowRunTimeline) { return; } if (isWorkflowRunBlock(activeItem)) { return activeItem; } if (isAction(activeItem)) { return findBlockSurroundingAction( workflowRunTimeline, activeItem.action_id, ); } } const activeBlock = getActiveBlock(); const showExtractedInformation = activeBlock && isTaskVariantBlock(activeBlock) && activeBlock.status === Status.Completed; const outputs = workflowRun?.outputs; const fileUrls = workflowRun?.downloaded_file_urls ?? []; const observerOutput = workflowRun?.task_v2?.output; const webhookFailureReasonData = workflowRun?.task_v2?.webhook_failure_reason ?? workflowRun?.webhook_failure_reason; return (
{webhookFailureReasonData ? (

Webhook Failure Reason

{webhookFailureReasonData}
) : null} {activeBlock ? (

Block Outputs

{activeBlock.output === null ? (
This block has no outputs
) : isTaskVariantBlock(activeBlock) ? (

{showExtractedInformation ? "Extracted Information" : "Failure Reason"}

{showExtractedInformation ? ( ) : ( )}
) : (

Output

)}
) : null} {observerOutput ? (

Task 2.0 Output

) : null}

Workflow Run Outputs

Workflow Run Downloaded Files

{fileUrls.length > 0 ? ( fileUrls.map((url, index) => { return (
{`File ${index + 1}`}
); }) ) : (
No files downloaded
)}
); } export { DebuggerRunOutput };