openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
44 lines (43 loc) • 1.96 kB
JavaScript
import { a as getResolvedLoggerSettings, l as toPinoLikeLogger, r as getChildLogger } from "./logger-BhL9CiBr.mjs";
import { t as GatewayScheduler } from "./gateway-scheduler-B6bteUrw.mjs";
import { n as normalizeAgentId } from "./agent-id-D1-Q6vR4.mjs";
import "./session-key-DY3MOX4N.mjs";
import { i as listAgentIds } from "./agent-roster-DH6r_8f4.mjs";
import { C as tryResolveAmbientOwnerAgentId } from "./agent-scope-config-BEk6-ThS.mjs";
import "./agent-scope-bJOokm5r.mjs";
import { r as isAgentDeletionBlocked } from "./agent-lifecycle-registry-CxGB4gfC.mjs";
import { t as resolveCronJobsStorePath } from "./paths-Dqy-ZJ8r.mjs";
import "./store-l4f-3zyW.mjs";
import { t as CronService } from "./service-DnmPiLd1.mjs";
//#region src/cron/local-service.ts
async function withLocalAgentCronJobsRemoved(agentId, getRuntimeConfig, commit) {
const cfg = getRuntimeConfig();
const storePath = resolveCronJobsStorePath();
const scheduler = new GatewayScheduler();
const service = new CronService({
scheduler,
storePath,
cronEnabled: cfg.cron?.enabled ?? true,
cronConfig: cfg.cron,
log: toPinoLikeLogger(getChildLogger({
module: "cron",
storeKey: storePath
}), getResolvedLoggerSettings().level),
defaultAgentId: tryResolveAmbientOwnerAgentId(cfg),
resolveDefaultAgentId: () => tryResolveAmbientOwnerAgentId(getRuntimeConfig()),
isAgentAvailable: (id, database, facts) => !(facts?.deletionBlocked ?? isAgentDeletionBlocked(id, {}, database)) && listAgentIds(getRuntimeConfig()).some((configuredId) => normalizeAgentId(configuredId) === id),
enqueueSystemEvent: () => false,
requestHeartbeat: () => {},
runIsolatedAgentJob: async () => {
throw new Error("Cron execution is unavailable in local service context.");
}
});
try {
return await service.removeAgentJobsTransactional(agentId, commit);
} finally {
service.stop();
await scheduler.stop();
}
}
//#endregion
export { withLocalAgentCronJobsRemoved as t };