UNPKG

@bernierllc/temporal-workflow-ui

Version:

Thin domain-specific wrapper around @bernierllc/generic-workflow-ui for Temporal workflows

240 lines (239 loc) 7.6 kB
/** * Temporal Retry Policy * Defines how Temporal should retry failed activities */ export interface TemporalRetryPolicy { /** Maximum number of retry attempts */ maximumAttempts: number; /** Coefficient to multiply the backoff interval by after each retry */ backoffCoefficient?: number; /** Initial retry interval in milliseconds */ initialInterval?: number; /** Maximum retry interval in milliseconds */ maximumInterval?: number; /** Error types that should not be retried */ nonRetryableErrorTypes?: string[]; } /** * Temporal Timeout Configuration * Defines various timeout settings for Temporal activities */ export interface TemporalTimeout { /** Total time from scheduling to completion */ scheduleToCloseTimeout?: number; /** Time from scheduling to start */ scheduleToStartTimeout?: number; /** Time from start to completion */ startToCloseTimeout?: number; } /** * Task Queue Configuration * Defines a Temporal task queue */ export interface TaskQueue { /** Unique identifier */ id: string; /** Queue name */ name: string; /** Optional description */ description?: string; /** Number of workers assigned to this queue */ workerCount?: number; /** Whether this is the default queue */ isDefault?: boolean; } /** * Temporal Activity Metadata * Metadata specific to Temporal activities */ export interface TemporalActivityMetadata { nodeType: 'activity'; /** Name of the Temporal activity */ activityName: string; /** Task queue the activity runs on */ taskQueue: string | TaskQueue; /** Retry policy for the activity */ retryPolicy?: TemporalRetryPolicy; /** Timeout configuration */ timeout?: TemporalTimeout; /** Activity input parameters */ parameters?: Record<string, any>; /** Heartbeat timeout in milliseconds */ heartbeatTimeout?: number; /** Whether this is a local activity */ localActivity?: boolean; } /** * Temporal Agent Metadata * Metadata for AI agent activities in Temporal workflows */ export interface TemporalAgentMetadata { nodeType: 'agent'; /** ID of the agent prompt */ agentPromptId: string; /** Display name of the agent */ agentName: string; /** Task queue the agent runs on */ taskQueue: string | TaskQueue; /** AI model provider (e.g., 'openai', 'anthropic') */ modelProvider?: string; /** Specific model name */ modelName?: string; /** Temperature for AI generation */ temperature?: number; /** Maximum tokens to generate */ maxTokens?: number; /** Retry policy for agent failures */ retryPolicy?: TemporalRetryPolicy; /** Timeout configuration */ timeout?: TemporalTimeout; } /** * Temporal Signal Metadata * Metadata for Temporal signal operations */ export interface TemporalSignalMetadata { nodeType: 'signal'; /** Name of the signal */ signalName: string; /** Type of signal operation */ signalType?: 'send' | 'receive'; /** Target workflow ID for signal sending */ targetWorkflowId?: string; /** Signal timeout in milliseconds */ timeout?: number; } /** * Temporal Trigger Metadata * Metadata for workflow triggers */ export interface TemporalTriggerMetadata { nodeType: 'trigger'; /** Type of trigger */ triggerType: 'manual' | 'schedule' | 'signal' | 'api'; /** Cron expression for schedule triggers */ scheduleSpec?: string; /** Trigger parameters */ parameters?: Record<string, any>; } /** * Temporal Child Workflow Metadata * Metadata for child workflow invocations */ export interface TemporalChildWorkflowMetadata { nodeType: 'child-workflow'; /** Name of the child workflow */ workflowName: string; /** Task queue for the child workflow */ taskQueue: string | TaskQueue; /** Retry policy for the child workflow */ retryPolicy?: TemporalRetryPolicy; /** Timeout configuration */ timeout?: TemporalTimeout; /** Input parameters for the child workflow */ parameters?: Record<string, any>; /** Signal to parent workflow configuration */ signalToParent?: { /** Name of the signal to send to parent */ signalName: string; /** Whether to auto-create the signal handler in parent */ autoCreate?: boolean; /** Optional queue name for work queue coordination */ queueName?: string; }; /** Query parent workflow configuration */ queryParent?: { /** Name of the query to send to parent */ queryName: string; /** Optional queue name for work queue coordination */ queueName?: string; }; /** Block execution until these dependencies complete */ blockUntil?: string[]; } /** * Temporal Parallel Metadata * Metadata for parallel execution nodes */ export interface TemporalParallelMetadata { nodeType: 'parallel'; /** IDs of parallel branches */ branches: string[]; /** Wait strategy */ waitStrategy?: 'all' | 'any' | 'first-success'; } /** * Temporal Condition Metadata * Metadata for conditional branching */ export interface TemporalConditionMetadata { nodeType: 'condition'; /** Condition expression (JavaScript) */ expression: string; /** Branch IDs for true/false outcomes */ trueBranch: string; falseBranch: string; } /** * Temporal Query Metadata * Metadata for query operations (parent-child communication) */ export interface TemporalQueryMetadata { nodeType: 'query'; /** Name of the query */ queryName: string; /** Type of query operation */ queryType?: 'send' | 'receive'; /** Target workflow ID for query sending */ targetWorkflowId?: string; /** Return type of the query */ returnType?: string; /** Query timeout in milliseconds */ timeout?: number; } /** * Temporal Scheduled Workflow Metadata * Metadata for cron-scheduled child workflows */ export interface TemporalScheduledWorkflowMetadata { nodeType: 'scheduled-workflow'; /** Name of the child workflow to schedule */ workflowName: string; /** Task queue for the scheduled workflow */ taskQueue: string | TaskQueue; /** Cron expression for scheduling */ cronExpression: string; /** Retry policy for the scheduled workflow */ retryPolicy?: TemporalRetryPolicy; /** Timeout configuration */ timeout?: TemporalTimeout; /** Input parameters for the scheduled workflow */ parameters?: Record<string, any>; /** Timezone for cron schedule (default: UTC) */ timezone?: string; } /** * Temporal Work Queue Metadata * Metadata for work queue coordinator pattern */ export interface TemporalWorkQueueMetadata { nodeType: 'work-queue'; /** Unique queue identifier */ queueId: string; /** Queue name */ queueName: string; /** Signal name for adding work to queue */ signalName: string; /** Query name for checking queue status */ queryName: string; /** Maximum queue size */ maxSize?: number; /** Priority level (higher = processed first) */ priority?: number; /** Task queue for processing work items */ taskQueue?: string | TaskQueue; } /** * Union of all Temporal metadata types */ export type TemporalNodeMetadata = TemporalActivityMetadata | TemporalAgentMetadata | TemporalSignalMetadata | TemporalTriggerMetadata | TemporalChildWorkflowMetadata | TemporalParallelMetadata | TemporalConditionMetadata | TemporalQueryMetadata | TemporalScheduledWorkflowMetadata | TemporalWorkQueueMetadata;