/** * Shared utilities for analyzing workflow events. * Used by run-actions and trace viewer components. */ import type { Event, WorkflowRunStatus } from '@workflow/world'; /** * Result of analyzing events for a workflow run */ export interface EventAnalysis { /** Whether there are pending sleep/wait calls */ hasPendingSleeps: boolean; /** Whether there are pending steps (started but not completed/failed) */ hasPendingSteps: boolean; /** Whether there are pending hooks (created but not disposed) */ hasPendingHooks: boolean; /** Correlation IDs of pending sleeps */ pendingSleepIds: string[]; /** Correlation IDs of pending steps */ pendingStepIds: string[]; /** Correlation IDs of pending hooks */ pendingHookIds: string[]; /** Timestamp of the last step_started or step_retrying event */ lastStepActivityAt: Date | null; /** Timestamp of the last step completion (step_completed or step_failed) */ lastStepCompletionAt: Date | null; } /** * Analyze events to determine pending sleeps, steps, and hooks. */ export declare function analyzeEvents(events: Event[] | undefined): EventAnalysis; /** * Check if a workflow run status is terminal (completed, failed, or cancelled) */ export declare function isTerminalStatus(status: WorkflowRunStatus | undefined): boolean; /** * Determine if the Re-enqueue button should be shown without the debug flag. * * The Re-enqueue button is shown when the workflow appears to be stuck: * - The workflow is not in a terminal state * - There are no pending sleeps (which would show the Wake up button instead) * - There are no pending hooks (which are waiting for external input) * - Either: * - The last step_started or step_retrying event was >30 minutes ago, OR * - There have been no pending steps for >5 minutes (all steps completed/failed) */ export declare function shouldShowReenqueueButton(events: Event[] | undefined, status: WorkflowRunStatus | undefined): boolean; /** * Check if there are pending steps from an events list. */ export declare function hasPendingStepsFromEvents(events: Event[] | undefined): boolean; /** * Check if there are pending hooks from an events list. */ export declare function hasPendingHooksFromEvents(events: Event[] | undefined): boolean; //# sourceMappingURL=event-analysis.d.ts.map