import type { HumanReviewOptions, HumanReviewResult } from '../review/index.ts'; import type { Duration } from '../types.ts'; import type { Context } from './index.ts'; import type { ContextInternals } from './internals.ts'; import type { ContextOperationRequest } from './operation-request.ts'; import type { OffloadReference, StreamReference, StreamSink } from './types.ts'; export type PreparedSleepOperation = { cached: true; } | { cached: false; milliseconds: number; request: ContextOperationRequest; step: number; }; export declare function prepareSleepOperation(internals: ContextInternals, duration: Duration): PreparedSleepOperation; export declare function completePreparedSleepOperation(context: Context, prepared: Exclude): Generator; export declare function sleep(context: Context, internals: ContextInternals, duration: Duration): Generator; export declare function waitForSignal(context: Context, internals: ContextInternals, name: string): Generator; /** * Read the absolute deadline anchor for a `ctx.waitUntil` step, writing it on the * first evaluation. Read-first so a crash/replay never resets the window: the * timeout is measured from the original first yield, and the anchor lands in the * checkpoint committed at that yield — the same atomicity the activity * schedule-to-close anchor (`readOrInitActivityDispatchedAt`) relies on. * * Returns `undefined` when no timeout was supplied (wait forever). */ export declare function readOrInitConditionDeadline(internals: ContextInternals, step: number, timeout: Duration | undefined): number | undefined; /** * Wait until `predicate` returns `true`, re-evaluated by the engine each time the * workflow is driven forward (an `onUpdate` handler mutating state, or the * optional timeout). The predicate is a non-serializable closure held in-process, * never checkpointed. Once the wait outcome has been checkpointed, replay returns * the cached outcome and does not re-invoke the predicate. A predicate that * throws fails the workflow at the `yield*` call site (like a throwing activity). * Inline execution only. * * With no `timeout` the generator yields `void` (waits forever). With a `timeout` * it yields `true` when the predicate was met or `false` when the deadline * elapsed first. */ export declare function waitUntil(context: Context, internals: ContextInternals, predicate: () => boolean, timeout?: Duration): Generator; export declare function getVersion(_context: Context, internals: ContextInternals, changeId: string, minSupported: number, maxSupported: number): Generator; export declare function waitForUpdate(context: Context, internals: ContextInternals, name: string): Generator void; }, unknown>; export declare function review(context: Context, internals: ContextInternals, options: HumanReviewOptions): Generator; export declare function offload(context: Context, internals: ContextInternals, key: string, fn: () => Promise): Generator; export declare function stream(context: Context, internals: ContextInternals, key: string, fn: (sink: StreamSink) => AsyncGenerator): Generator; export declare function load(context: Context, internals: ContextInternals, reference: OffloadReference): Generator; export declare function archive(context: Context, internals: ContextInternals, key: string, data: unknown): Generator;