import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable"; import { IAutomation, IAutomationRun, AutomationRunTrigger } from "./automation.js"; import { ICreateAutomationOptions, IUpdateAutomationOptions, IUpdateAutomationRunOptions } from "./automationService.js"; export declare const IAutomationService: import("@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation").ServiceIdentifier; /** * Persistent store for automations and their run history, and the single * mutation point. Scheduler, runner, and UI all flow through it to keep * cross-window propagation, persistence, and observables consistent. */ export interface IAutomationService { readonly _serviceBrand: undefined; /** All defined automations, newest first. */ readonly automations: IObservable; /** All recorded runs across all automations, newest first. */ readonly runs: IObservable; /** Snapshot accessor (no observable dependency). */ getAutomation(id: string): IAutomation | undefined; /** Runs for a single automation, newest first. */ runsFor(automationId: string): IObservable; createAutomation(options: ICreateAutomationOptions): Promise; updateAutomation(id: string, patch: IUpdateAutomationOptions): Promise; deleteAutomation(id: string): Promise; /** Records a new run as `pending`. Throws if the automation does not exist. */ recordRunStart(automationId: string, trigger: AutomationRunTrigger, leaderWindowId: number): Promise; /** Applies a patch to a run; returns the updated run or `undefined` if not found. */ updateRun(runId: string, patch: IUpdateAutomationRunOptions): Promise; /** Most recent `pending`/`running` run for an automation, or `undefined`. Backs the runner's per-automation claim. */ getActiveRunFor(automationId: string): IAutomationRun | undefined; /** Marks all stuck (`pending`/`running`) runs failed. Called on startup to recover from crashes. */ markStaleRunsFailed(reason: string): Promise; /** * Sets `lastRunAt = now` and recomputes `nextRunAt`. Called right after * dispatch so the same automation isn't picked up twice on the next tick. */ advanceNextRunAt(id: string, now?: Date): Promise; }