UNPKG

@hotmeshio/hotmesh

Version:

Permanent-Memory Workflows & AI Agents

25 lines (24 loc) 879 B
/** * Sleeps the workflow for a specified duration, deterministically. * On replay, it will not actually sleep again, but resume after sleep. * * @example * // Basic usage - sleep for a specific duration * await MemFlow.workflow.sleepFor('2 seconds'); * * @example * // Using with Promise.all for parallel operations * const [greeting, timeInSeconds] = await Promise.all([ * someActivity(name), * MemFlow.workflow.sleepFor('1 second') * ]); * * @example * // Multiple sequential sleeps * await MemFlow.workflow.sleepFor('1 seconds'); // First pause * await MemFlow.workflow.sleepFor('2 seconds'); // Second pause * * @param {string} duration - A human-readable duration string (e.g., '1m', '2 hours', '30 seconds'). * @returns {Promise<number>} The resolved duration in seconds. */ export declare function sleepFor(duration: string): Promise<number>;