import type { ActionAutomationContext } from "../action.js"; import type { JobFrontmatter } from "./frontmatter.js"; export type JobRunnerResult = { status: "success"; runId?: string; } | { status: "skipped"; reason: string; runId?: string; }; export interface JobRunnerContext { name: string; path: string; meta: JobFrontmatter; ownerEmail: string; orgId?: string; /** The `automation_runs` row the scheduler opened for this tick. */ historyId: string; manual: boolean; /** The due instant a scheduled tick fired for; `null` for a manual run. */ scheduledFor: string | null; /** Epoch ms the runner should stop starting new work. */ deadlineAt: number; /** Epoch ms the scheduler abandons the runner and records a timeout. */ hardDeadlineAt: number; /** Aborts at `hardDeadlineAt`. */ signal: AbortSignal; /** Rejects once this worker no longer owns the tick. */ assertCanContinue(): Promise; actionAutomation: ActionAutomationContext; } export type JobRunner = (ctx: JobRunnerContext) => Promise; export declare function registerJobRunner(id: string, runner: JobRunner): () => void; export declare function hasJobRunner(id: string): boolean; export declare function getJobRunner(id: string): JobRunner | undefined;