import type { World } from '#compiled/@workflow/world/index.js'; import { Run } from './run.js'; /** * Reset the `deploymentId: 'latest'` no-op warn-once guard. Test-only — * exported so unit tests can exercise the warn path across `start()` calls. * * @internal */ export declare function _resetLatestNoOpWarnForTests(): void; export interface StartOptionsBase { /** * The world to use for the workflow run creation, * by default the world is inferred from the environment variables. */ world?: World; /** * The spec version to use for the workflow run. Defaults to the latest version. */ specVersion?: number; /** * Plaintext attributes to seed on the run as it is created. * * Available for native-attributes runs (spec version 4 and later). */ attributes?: Record; /** * Permit reserved `$`-prefixed keys in `attributes`. The `$` namespace * is reserved for framework/library code built on top of the workflow * SDK (telemetry, agent metadata, platform-emitted tags, etc.); user * code MUST NOT write keys in it, and validation rejects them so * accidental collisions with tooling-owned keys can't slip through. * * Only flip this to `true` if your caller is itself a framework or * library that owns a `$`-prefixed sub-namespace and knows the * conventions of any other tools writing into it. Same semantics as * the `experimental_setAttributes` option of the same name. */ allowReservedAttributes?: boolean; } export interface StartOptionsWithDeploymentId extends StartOptionsBase { /** * The deployment ID to use for the workflow run. * * By default, this is automatically inferred from environment variables * when deploying to Vercel. * * Set to `'latest'` to automatically resolve the most recent deployment * for the current environment (same production target or git branch). * This is only meaningful in worlds with atomic, immutable deployments * (currently Vercel). In other worlds (local dev, Postgres) there is no * notion of multiple deployments to resolve between, so `'latest'` has no * effect — a warning is logged and the run targets the current deployment. * * **Note:** When `deploymentId` is provided, the argument and return types become `unknown` * since there is no guarantee the types will be consistent across deployments. */ deploymentId: 'latest' | (string & {}); } export interface StartOptionsWithoutDeploymentId extends StartOptionsBase { deploymentId?: undefined; } /** * Options for starting a workflow run. */ export type StartOptions = StartOptionsWithDeploymentId | StartOptionsWithoutDeploymentId; /** * Represents an imported workflow function. */ export type WorkflowFunction = (...args: TArgs) => Promise; /** * Represents the generated metadata of a workflow function. */ export type WorkflowMetadata = { workflowId: string; }; /** * Starts a workflow run. * * @param workflow - The imported workflow function to start. * @param args - The arguments to pass to the workflow (optional). * @param options - The options for the workflow run (optional). * @returns The unique run ID for the newly started workflow invocation. */ export declare function start(workflow: WorkflowFunction | WorkflowMetadata, args: unknown[], options: StartOptionsWithDeploymentId): Promise>; export declare function start(workflow: WorkflowFunction<[], TResult> | WorkflowMetadata, options: StartOptionsWithDeploymentId): Promise>; export declare function start(workflow: WorkflowFunction | WorkflowMetadata, args: TArgs, options?: StartOptionsWithoutDeploymentId): Promise>; export declare function start(workflow: WorkflowFunction<[], TResult> | WorkflowMetadata, options?: StartOptionsWithoutDeploymentId): Promise>; //# sourceMappingURL=start.d.ts.map