@mastra/core
Version:
22 lines • 1.56 kB
TypeScript
export declare function setRunLeaseFence(runId: string, fence: () => Promise<void>): void;
/**
* Another runtime in the process (for example a second Mastra instance) may have registered
* the same run id since, so a run that ends clears only its own check.
*/
export declare function clearRunLeaseFence(runId: string, fence: () => Promise<void>): void;
/** Drop every registered check. Tests only: a worker that runs files without isolation reuses run ids. */
export declare function __resetRunLeaseFencesForTests(): void;
/** Throws when the run no longer holds its thread lease. */
export declare function verifyRunLease(runId: string | undefined): Promise<void>;
/** Marks a step of the run this object owns as running. Call the returned function once the step has settled. */
export declare function startRunStep(owner: object | undefined): () => void;
/** Calls `callback` once no step of the run this object owns is running: right away when none is. */
export declare function whenRunStepsSettle(owner: object | undefined, callback: () => void): void;
/** Whether a step of the run this object owns is running right now. */
export declare function hasRunningRunStep(owner: object | undefined): boolean;
/**
* Whether the run this object owns has a step running, or had one settle within the last `withinMs`. A run that was
* aborted has none worth waiting for, even while a step is still winding down.
*/
export declare function isRunStepActive(owner: object | undefined, withinMs: number): boolean;
//# sourceMappingURL=run-lease-fence.d.ts.map