import { z } from 'zod'; import { PlatformId } from '../../management/platform'; import { ProjectId } from '../../management/project/project'; import { ExecutionToolStatus, PredefinedInputsStructure } from '../agents'; import { AppConnectionValue } from '../app-connection/app-connection'; import { ExecutionState, ExecutionType, ResumePayload } from '../flow-run/execution/execution-output'; import { FlowRunId, RunEnvironment } from '../flow-run/flow-run'; import { FlowVersion } from '../flows/flow-version'; import { PiecePackage } from '../pieces'; import { ScheduleOptions } from '../trigger'; export declare enum EngineOperationType { EXTRACT_PIECE_METADATA = "EXTRACT_PIECE_METADATA", EXECUTE_FLOW = "EXECUTE_FLOW", EXECUTE_PROPERTY = "EXECUTE_PROPERTY", EXECUTE_TRIGGER_HOOK = "EXECUTE_TRIGGER_HOOK", EXECUTE_VALIDATE_AUTH = "EXECUTE_VALIDATE_AUTH" } export declare enum TriggerHookType { ON_ENABLE = "ON_ENABLE", ON_DISABLE = "ON_DISABLE", HANDSHAKE = "HANDSHAKE", RENEW = "RENEW", RUN = "RUN", TEST = "TEST" } export type EngineOperation = ExecuteToolOperation | ExecuteFlowOperation | ExecutePropsOptions | ExecuteTriggerOperation | ExecuteExtractPieceMetadataOperation | ExecuteValidateAuthOperation; export declare const EngineStdout: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; export declare const EngineStderr: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; export type EngineStdout = z.infer; export type EngineStderr = z.infer; export type BaseEngineOperation = { projectId: ProjectId; engineToken: string; internalApiUrl: string; publicApiUrl: string; timeoutInSeconds: number; platformId: PlatformId; }; export type ExecuteValidateAuthOperation = Omit & { piece: PiecePackage; auth: AppConnectionValue; }; export type ExecuteExtractPieceMetadata = PiecePackage & { platformId: PlatformId; }; export type ExecuteExtractPieceMetadataOperation = ExecuteExtractPieceMetadata & { timeoutInSeconds: number; platformId: PlatformId; }; export type ExecuteToolOperation = BaseEngineOperation & { actionName: string; pieceName: string; pieceVersion: string; predefinedInput?: PredefinedInputsStructure; instruction: string; }; export type ExecutePropsOptions = BaseEngineOperation & { piece: PiecePackage; propertyName: string; actionOrTriggerName: string; flowVersion?: FlowVersion; input: Record; sampleData: Record; searchValue?: string; }; type BaseExecuteFlowOperation = BaseEngineOperation & { flowVersion: FlowVersion; flowRunId: FlowRunId; executionType: T; runEnvironment: RunEnvironment; executionState: ExecutionState; workerHandlerId: string | null; httpRequestId: string | null; streamStepProgress: StreamStepProgress; stepNameToTest: string | null; sampleData?: Record; logsUploadUrl?: string; logsFileId?: string; }; export declare enum StreamStepProgress { WEBSOCKET = "WEBSOCKET", NONE = "NONE" } export type BeginExecuteFlowOperation = BaseExecuteFlowOperation & { triggerPayload: unknown; executeTrigger: boolean; }; export type ResumeExecuteFlowOperation = BaseExecuteFlowOperation & { resumePayload: ResumePayload; }; export type ExecuteFlowOperation = BeginExecuteFlowOperation | ResumeExecuteFlowOperation; export type ExecuteTriggerOperation = BaseEngineOperation & { hookType: HT; test: boolean; flowVersion: FlowVersion; webhookUrl: string; triggerPayload?: TriggerPayload; appWebhookUrl?: string; webhookSecret?: string | Record; }; export declare const TriggerPayload: z.ZodObject<{ body: z.ZodUnknown; rawBody: z.ZodOptional; headers: z.ZodRecord; queryParams: z.ZodRecord; }, z.core.$strip>; export type TriggerPayload = { body: T; rawBody?: unknown; headers: Record; queryParams: Record; }; export type EventPayload = { body: B; rawBody?: unknown; method: string; headers: Record; queryParams: Record; }; export type ParseEventResponse = { event?: string; identifierValue?: string; reply?: { headers: Record; body: unknown; }; }; export type AppEventListener = { events: string[]; identifierValue: string; }; type ExecuteTestOrRunTriggerResponse = { message?: string; output: unknown[]; }; type ExecuteHandshakeTriggerResponse = { message?: string; response?: { status: number; body?: unknown; headers?: Record; }; }; type ExecuteOnEnableTriggerResponse = { listeners: AppEventListener[]; scheduleOptions?: ScheduleOptions; }; export declare const EngineHttpResponse: z.ZodObject<{ status: z.ZodNumber; body: z.ZodUnknown; headers: z.ZodRecord; }, z.core.$strip>; export type EngineHttpResponse = z.infer; export type ExecuteTriggerResponse = H extends TriggerHookType.RUN ? ExecuteTestOrRunTriggerResponse : H extends TriggerHookType.HANDSHAKE ? ExecuteHandshakeTriggerResponse : H extends TriggerHookType.TEST ? ExecuteTestOrRunTriggerResponse : H extends TriggerHookType.RENEW ? Record : H extends TriggerHookType.ON_DISABLE ? Record : ExecuteOnEnableTriggerResponse; export type ExecuteToolResponse = { status: ExecutionToolStatus; output?: unknown; resolvedInput: Record; errorMessage?: unknown; }; export declare function normalizeToolOutputToExecuteResponse(raw: unknown): ExecuteToolResponse; export type ExecuteActionResponse = { success: boolean; input: unknown; output: unknown; message?: string; }; type BaseExecuteValidateAuthResponseOutput = { valid: Valid; }; type ValidExecuteValidateAuthResponseOutput = BaseExecuteValidateAuthResponseOutput; type InvalidExecuteValidateAuthResponseOutput = BaseExecuteValidateAuthResponseOutput & { error: string; }; export type ExecuteValidateAuthResponse = ValidExecuteValidateAuthResponseOutput | InvalidExecuteValidateAuthResponseOutput; export type EngineResponse = { status: EngineResponseStatus; response: T; error?: string; }; export declare enum EngineResponseStatus { OK = "OK", USER_FAILURE = "USER_FAILURE", INTERNAL_ERROR = "INTERNAL_ERROR", TIMEOUT = "TIMEOUT", MEMORY_ISSUE = "MEMORY_ISSUE", LOG_SIZE_EXCEEDED = "LOG_SIZE_EXCEEDED" } export {}; //# sourceMappingURL=engine-operation.d.ts.map