import { AutomationCustomer, AutomationError, AutomationJsonObject, AutomationPageRequest, AutomationResourceReference, AutomationSourceApplication } from '../Common'; import { AutomationCapabilityEffectClass } from '../Capabilities'; export declare enum AutomationExecutionStatus { QUEUED = "queued", RUNNING = "running", WAITING = "waiting", SUCCEEDED = "succeeded", FAILED = "failed", CANCELLED = "cancelled", TIMED_OUT = "timedOut" } export declare enum AutomationExecutionStepStatus { PENDING = "pending", RUNNING = "running", WAITING = "waiting", SUCCEEDED = "succeeded", FAILED = "failed", SKIPPED = "skipped", CANCELLED = "cancelled" } export declare enum AutomationExecutionPurpose { PRODUCTION = "production", TEST = "test" } export declare enum AutomationExecutionEffectMode { SIMULATE = "simulate", TEST_TARGETS = "testTargets", REAL = "real" } export declare enum AutomationExecutionScopeKind { FULL = "full", UNTIL_NODE = "untilNode", FROM_NODE = "fromNode", NODE_ONLY = "nodeOnly" } export declare enum AutomationExecutionSourceKind { MANUAL = "manual", FIXTURE = "fixture", CAPTURED_EVENT = "capturedEvent", EXECUTION = "execution", STEP_OUTPUT = "stepOutput" } export declare enum AutomationExecutionLineageOperation { NEW = "new", REPLAY = "replay", RETRY = "retry" } export declare enum AutomationExecutionEffectDecision { EXECUTED = "executed", SIMULATED = "simulated", REDIRECTED = "redirected", BLOCKED = "blocked" } export interface AutomationExecutionScope { kind: AutomationExecutionScopeKind; startNodeId?: string | null; stopNodeId?: string | null; } /** Referencia inmutable a la definición exacta utilizada por una ejecución. */ export interface AutomationFlowSnapshotReference { flowId: string; flowVersionId?: string | null; snapshotId?: string | null; revision: number; contentHash: string; } export interface AutomationExecutionSource { kind: AutomationExecutionSourceKind; fixtureId?: string | null; capturedEventId?: string | null; executionId?: string | null; stepId?: string | null; } export interface AutomationExecutionLineage { operation: AutomationExecutionLineageOperation; sourceExecutionId?: string | null; sourceStepId?: string | null; rootExecutionId?: string | null; } /** Resumen seguro; la política interna completa nunca se expone al caller. */ export interface AutomationExecutionPolicySummary { maxDurationMs?: number | null; maxSteps?: number | null; maxIterations?: number | null; maxItems?: number | null; maxCost?: number | null; currency?: string | null; simulatedClockAt?: string | null; requiresConfirmation: boolean; } export interface AutomationExecutionEffectRecord { id: string; nodeId: string; effectClass: AutomationCapabilityEffectClass; action: string; decision: AutomationExecutionEffectDecision; originalTarget?: AutomationResourceReference | null; effectiveTarget?: AutomationResourceReference | null; preview?: AutomationJsonObject | null; providerReference?: string | null; idempotencyKey?: string | null; warnings?: string[] | null; } /** * Referencia genérica al evento que inició una ejecución. */ export interface AutomationExecutionTrigger { /** Entry Point que aceptó el evento. */ entryPointId: string; /** Aplicación propietaria del evento. */ sourceApplication: AutomationSourceApplication; /** Código estable del tipo de evento. */ eventType: string; /** Entidad principal relacionada con el evento. */ reference?: AutomationResourceReference | null; /** Instante informado por el productor. */ occurredAt?: string | null; /** Snapshot opcional del payload disparador. */ payload?: AutomationJsonObject | null; } /** Identidad completa que debe persistir una ejecución transversal. */ export interface AutomationFlowExecutionReference { flowId: string; flowVersionId: string; entryPointId: string; executionId: string; } /** Contexto que un caller puede aportar al iniciar una ejecución. */ export interface AutomationExecutionContextInput { /** Valores iniciales de variables declaradas por la versión del Flow. */ variables: AutomationJsonObject; /** Extensiones agrupadas por módulo propietario. */ extensions: AutomationJsonObject; } /** Datos confiables establecidos exclusivamente por Automations. */ export interface AutomationExecutionSystemContext { /** Locale BCP 47, por ejemplo es-AR. */ locale?: string | null; /** Zona horaria IANA utilizada por fechas y agendas. */ timeZone?: string | null; /** Usuario, servicio o recurso que originó la ejecución. */ actor?: AutomationResourceReference | null; } /** Contexto persistido y utilizado durante una ejecución. */ export interface AutomationExecutionContext extends AutomationExecutionContextInput { /** Datos confiables agregados por el runtime. */ system: AutomationExecutionSystemContext; } export interface AutomationExecution { id: string; spaceId: string; flowId: string; flowVersionId: string; flowVersion: number; entryPointId: string; status: AutomationExecutionStatus; customer?: AutomationCustomer | null; trigger: AutomationExecutionTrigger; input: AutomationJsonObject; /** Scope tipado y extensible utilizado durante la ejecución. */ context: AutomationExecutionContext; output?: AutomationJsonObject | null; error?: AutomationError | null; createdAt: string; startedAt?: string | null; completedAt?: string | null; cancelledAt?: string | null; cancelledBy?: string | null; correlationId?: string | null; parentExecutionId?: string | null; usage: AutomationExecutionUsage; /** Ausente únicamente en ejecuciones creadas con contratos anteriores. */ purpose?: AutomationExecutionPurpose | null; requestedEffectMode?: AutomationExecutionEffectMode | null; effectiveEffectMode?: AutomationExecutionEffectMode | null; scope?: AutomationExecutionScope | null; source?: AutomationExecutionSource | null; snapshot?: AutomationFlowSnapshotReference | null; lineage?: AutomationExecutionLineage | null; startedBy?: AutomationResourceReference | null; policySummary?: AutomationExecutionPolicySummary | null; testCaseId?: string | null; testCaseRevision?: number | null; } export interface AutomationExecutionStep { id: string; executionId: string; nodeId: string; nodeDefinitionCode: string; nodeDefinitionVersion: number; sequence: number; attempt: number; status: AutomationExecutionStepStatus; input?: AutomationJsonObject | null; output?: AutomationJsonObject | null; error?: AutomationError | null; startedAt?: string | null; completedAt?: string | null; usage: AutomationExecutionUsage; waitingReason?: string | null; skippedReason?: string | null; itemIndex?: number | null; iteration?: number | null; parentStepId?: string | null; takenEdgeIds?: string[] | null; effects?: AutomationExecutionEffectRecord[] | null; } export interface AutomationExecutionUsage { inputTokens: number; outputTokens: number; totalTokens: number; totalCost: number; currency: string; durationMs: number; } export interface AutomationExecutionQuery extends AutomationPageRequest { flowId?: string | null; flowVersionId?: string | null; entryPointId?: string | null; contactId?: string | null; businessId?: string | null; customerSearch?: string | null; statuses?: AutomationExecutionStatus[] | null; createdFrom?: string | null; createdTo?: string | null; correlationId?: string | null; purposes?: AutomationExecutionPurpose[] | null; effectModes?: AutomationExecutionEffectMode[] | null; testCaseId?: string | null; } export interface StartAutomationExecutionRequest { flowId: string; flowVersionId: string; entryPointId: string; customer?: AutomationCustomer | null; trigger: AutomationExecutionTrigger; input: AutomationJsonObject; /** Variables iniciales y extensiones aportadas por el caller. */ context: AutomationExecutionContextInput; idempotencyKey?: string | null; correlationId?: string | null; parentExecutionId?: string | null; } export interface CancelAutomationExecutionRequest { reason?: string | null; } export interface RetryAutomationExecutionRequest { fromStepId?: string | null; inputOverrides?: AutomationJsonObject | null; } export interface AutomationExecutionDetails { execution: AutomationExecution; steps: AutomationExecutionStep[]; }