import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext, z as ActorForkLink, J as ActorLogger, az as QueueFilterName, aE as QueueNextOptions, aF as QueueResultMessageForName, aD as QueueNextBatchOptions, aK as Registry, a8 as Client, ar as InferEventArgs, as as InferSchemaMap } from './config-Ch-SMJ-n.js'; import { WorkflowContextInterface, StepConfig, TryStepResult, TryStepConfig, TryBlockResult, TryBlockConfig, LoopResult, LoopConfig, BranchConfig, BranchOutput, EntryKindType } from '@rivetkit/workflow-engine'; import { A as AnyDatabaseProvider, I as InferDatabaseClient } from './config-CBTr4IhE.js'; type WorkflowActorQueueNextOptions = Omit, "signal">; type WorkflowActorQueueNextOptionsFallback = Omit, "signal">; type WorkflowActorQueueNextBatchOptions = Omit, "signal">; type WorkflowActorQueueNextBatchOptionsFallback = Omit, "signal">; type WorkflowStepRun = (step: WorkflowStepContext) => Promise; type WorkflowStepRollback = (step: WorkflowStepContext, output: T) => Promise; type WorkflowContextRun = (ctx: WorkflowContext) => Promise; type WorkflowStepConfig = Omit, "run" | "rollback"> & { run: WorkflowStepRun; rollback?: WorkflowStepRollback; }; type WorkflowTryStepConfig = Omit, "run" | "rollback"> & { run: WorkflowStepRun; rollback?: WorkflowStepRollback; }; type WorkflowTryConfig = Omit, "run"> & { run: WorkflowContextRun; }; type WorkflowLoopConfig = Omit, "run"> & { run: (ctx: WorkflowContext, state: S) => Promise | (S extends undefined ? undefined | void : never)>; }; type WorkflowBranchConfig = { run: WorkflowContextRun; }; declare const DEACTIVATE_STEP: unique symbol; /** * The context handed to a workflow step (`step` / `tryStep` callbacks). This is * the only scope where actor data (state, vars, db, client) and side effects * (broadcast, queue.send) are reachable. It is valid only while its step is * executing; using it after the step resolves throws. */ declare class WorkflowStepContext, TQueues extends QueueSchemaConfig = Record> { #private; constructor(runCtx: RunContext, onGuardViolation: () => void); [DEACTIVATE_STEP](): void; get actorId(): string; get name(): string; get key(): string[]; get forkChain(): ActorForkLink[]; get namespace(): string; get log(): ActorLogger; get abortSignal(): AbortSignal; /** @deprecated Actor state was deprecated in 3.0 and will be removed in a future version. Store durable data in SQLite (`c.db`) and in-memory data in `c.vars`. See https://rivet.dev/actors/docs/deprecated/state */ get state(): TState extends never ? never : TState; get vars(): TVars extends never ? never : TVars; get db(): TDatabase extends never ? never : InferDatabaseClient; client = Registry>(): Client; broadcast(name: K, ...args: InferEventArgs[K]>): void; broadcast(name: keyof TEvents extends never ? string : never, ...args: Array): void; /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */ get queue(): { send: { (name: K, body: InferSchemaMap[K]): Promise; (name: keyof TQueues extends never ? string : never, body: unknown): Promise; }; }; /** * Holds the actor awake for the duration of the provided promise. The actor * cannot idle-sleep or finalize the sleep grace period until the promise * settles. */ keepAwake(promise: Promise): Promise; /** * Registers a promise that the sleep grace period will wait on. Use this for * best-effort flush/cleanup work that may complete inside the grace window. */ waitUntil(promise: Promise): void; destroy(): void; } /** * The context handed to the workflow function and to orchestration callbacks * (`try` / `loop` / `race` / `join`). It exposes the deterministic, replayable * workflow primitives (step, sleep, queue waits, control flow). It deliberately * does NOT expose actor data; reach `state`, `db`, `vars`, `client`, and * `broadcast` through the step context passed to `step` / `tryStep`. */ declare class WorkflowContext, TQueues extends QueueSchemaConfig = Record> { #private; constructor(inner: WorkflowContextInterface, runCtx: RunContext); get workflowId(): string; get abortSignal(): AbortSignal; get actorId(): string; get name(): string; get key(): string[]; get forkChain(): ActorForkLink[]; get namespace(): string; get log(): ActorLogger; /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */ get queue(): { next: { , const TCompletable extends boolean = false>(name: string, opts?: WorkflowActorQueueNextOptions): Promise>; (name: string, opts?: WorkflowActorQueueNextOptionsFallback): Promise, TCompletable>>; }; nextBatch: { , const TCompletable extends boolean = false>(name: string, opts?: WorkflowActorQueueNextBatchOptions): Promise>>; (name: string, opts?: WorkflowActorQueueNextBatchOptionsFallback): Promise, TCompletable>>>; }; }; step(name: string, run: WorkflowStepRun): Promise; step(config: WorkflowStepConfig): Promise; tryStep(name: string, run: WorkflowStepRun): Promise>; tryStep(config: WorkflowTryStepConfig): Promise>; try(name: string, run: WorkflowContextRun): Promise>; try(config: WorkflowTryConfig): Promise>; loop(name: string, run: (ctx: WorkflowContext) => Promise | undefined | void>): Promise; loop(config: WorkflowLoopConfig): Promise; sleep(name: string, durationMs: number): Promise; sleepUntil(name: string, timestampMs: number): Promise; rollbackCheckpoint(name: string): Promise; join>>(name: string, branches: T): Promise<{ [K in keyof T]: Awaited>; }>; join>>(name: string, branches: T): Promise<{ [K in keyof T]: BranchOutput; }>; race(name: string, branches: Array<{ name: string; run: WorkflowContextRun; }>): Promise<{ winner: string; value: T; }>; removed(name: string, originalType: EntryKindType): Promise; getVersion(name: string, latest: number): Promise; isEvicted(): boolean; } type WorkflowContextOf = AD extends BaseActorDefinition ? WorkflowContext : never; type WorkflowLoopContextOf = WorkflowContextOf; type WorkflowBranchContextOf = WorkflowContextOf; type WorkflowStepContextOf = AD extends BaseActorDefinition ? WorkflowStepContext : never; export { type WorkflowBranchContextOf as W, type WorkflowContextOf as a, type WorkflowLoopContextOf as b, type WorkflowStepContextOf as c, WorkflowContext as d, type WorkflowBranchConfig as e, type WorkflowLoopConfig as f, type WorkflowStepConfig as g, WorkflowStepContext as h, type WorkflowTryConfig as i, type WorkflowTryStepConfig as j };