/** * Workflow run entrypoint * * Runs inside an ephemeral run execution container. * Executes a single workflow run in complete isolation. * * Environment variables: * - WORKFLOW_RUN_ID: The workflow run to execute * - RUN_EXECUTION_ID: Immutable execution identity assigned by the run manager * - TENANT_PROJECT_SLUG: Tenant's project slug * - TENANT_TOKEN: Tenant's API token * - TENANT_PROJECT_ID: Tenant's project ID * - TENANT_PRODUCTION_MODE: Whether running in production mode * - TENANT_RELEASE_ID: Current release ID (optional) * - REDIS_URL: Redis connection URL * * Exit codes: * - 0: Workflow completed successfully * - 1: Workflow failed * - 2: Configuration error * - 3: Workflow not found */ import type { WorkflowBackend } from "../backends/types.js"; import type { WorkflowExecutor } from "../executor/workflow-executor.js"; import type { WorkflowDefinition } from "../types.js"; /** * Configuration for the workflow run entrypoint. */ export interface WorkflowRunEntrypointConfig { /** Backend for workflow persistence */ backend: WorkflowBackend; /** Workflow executor */ executor: WorkflowExecutor; /** Enable debug logging */ debug?: boolean; } /** * Exit codes for the workflow run entrypoint. */ export declare const EXIT_CODES: { readonly SUCCESS: 0; readonly WORKFLOW_FAILED: 1; readonly CONFIG_ERROR: 2; readonly NOT_FOUND: 3; }; /** * Run the workflow run entrypoint * * This function is the main entrypoint for isolated workflow execution. * It should be called from your container's main script. * * @example * ```typescript * // workflow-runner.ts - Container entrypoint * import { RedisBackend } from "veryfront/workflow"; * import { WorkflowExecutor } from "veryfront/workflow"; * import { runWorkflowRun } from "veryfront/workflow/worker"; * import { getEnv } from "veryfront"; * import { workflows } from "./workflows.ts"; * * const backend = new RedisBackend({ url: getEnv("REDIS_URL")! }); * const executor = new WorkflowExecutor({ backend }); * * // Register all workflows * for (const wf of workflows) { * executor.register(wf); * } * * // Run the workflow run * const exitCode = await runWorkflowRun({ backend, executor }); * if (exitCode !== 0) throw new Error(`Workflow run failed: ${exitCode}`); * ``` */ export declare function runWorkflowRun(config: WorkflowRunEntrypointConfig): Promise; /** * Create a simple workflow run entrypoint script. * * This is a convenience function that creates the entire entrypoint * with Redis backend and executor setup. * * @example * ```typescript * // workflow-runner.ts * import { createWorkflowRunEntrypoint } from "veryfront/workflow/worker"; * import { getEnv } from "veryfront"; * import { workflows } from "./workflows.ts"; * * const run = createWorkflowRunEntrypoint({ * redisUrl: getEnv("REDIS_URL")!, * workflows, * }); * * const exitCode = await run(); * if (exitCode !== 0) throw new Error(`Workflow run failed: ${exitCode}`); * ``` */ export interface CreateWorkflowRunEntrypointOptions { /** Redis URL for backend */ redisUrl: string; /** Workflows to register */ workflows: Array<{ definition: WorkflowDefinition; }>; /** Enable debug logging */ debug?: boolean; } /** Create a workflow run entrypoint. */ export declare function createWorkflowRunEntrypoint(options: CreateWorkflowRunEntrypointOptions): Promise<() => Promise>; //# sourceMappingURL=run-entrypoint.d.ts.map