import runDbClient_default from "../../../data/db/runDbClient.js";
import { getLogger as getLogger$1 } from "../../../logger.js";
import { schedulerWorkflow } from "../workflow/functions/schedulerWorkflow.js";
import { getSchedulerState } from "@inkeep/agents-core";
import { start } from "workflow/api";

//#region src/domains/run/services/SchedulerService.ts
const logger = getLogger$1("SchedulerService");
async function startSchedulerWorkflow() {
	const previous = await getSchedulerState(runDbClient_default)();
	const run = await start(schedulerWorkflow, []);
	logger.info({
		runId: run.runId,
		previousRunId: previous?.currentRunId ?? null
	}, "Scheduler workflow started");
	return {
		runId: run.runId,
		previousRunId: previous?.currentRunId ?? null
	};
}
async function getSchedulerStatus() {
	return getSchedulerState(runDbClient_default)();
}

//#endregion
export { getSchedulerStatus, startSchedulerWorkflow };