openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
42 lines (41 loc) • 1.64 kB
JavaScript
import { n as normalizeAgentId } from "./agent-id-CQjtp2ft.mjs";
import "./session-key-CqAyZeVk.mjs";
import { i as listAgentIds } from "./agent-roster-t1ooUdXp.mjs";
import { O as tryResolveAmbientOwnerAgentId } from "./agent-scope-config-DmXgFGKP.mjs";
import { o as getResolvedLoggerSettings, r as getChildLogger, u as toPinoLikeLogger } from "./logger-1QDNfT7Y.mjs";
import { t as GatewayScheduler } from "./gateway-scheduler-BApPBa3S.mjs";
import "./agent-scope-BwB8YH6y.mjs";
import { i as resolveCronJobsStorePathAsync } from "./paths-CY4cvrR6.mjs";
import "./store-DaG-8LOU.mjs";
import { t as CronService } from "./service-ClGTKS0v.mjs";
//#region src/cron/local-service.ts
async function withLocalAgentCronJobsRemoved(e, t, n) {
const r = t();
const i = await resolveCronJobsStorePathAsync();
const a = new GatewayScheduler();
const o = new CronService({
scheduler: a,
storePath: i,
cronEnabled: r.cron?.enabled ?? true,
cronConfig: r.cron,
log: toPinoLikeLogger(getChildLogger({
module: "cron",
storeKey: i
}), getResolvedLoggerSettings().level),
defaultAgentId: tryResolveAmbientOwnerAgentId(r),
resolveDefaultAgentId: () => tryResolveAmbientOwnerAgentId(t()),
isAgentAvailable: (e, n) => !n.deletionBlocked && listAgentIds(t()).some((t) => normalizeAgentId(t) === e),
enqueueSystemEvent: () => false,
runIsolatedAgentJob: async () => {
throw new Error("Cron execution is unavailable in local service context.");
}
});
try {
return await o.removeAgentJobsTransactional(e, n);
} finally {
o.stop();
await a.stop();
}
}
//#endregion
export { withLocalAgentCronJobsRemoved as t };