UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

40 lines (39 loc) 1.7 kB
import { n as normalizeAgentId } from "./agent-id-CeT3w4ap.js"; import { o as listAgentIds, w as tryResolveAmbientOwnerAgentId } from "./agent-scope-config-DcbEhP0R.js"; import "./session-key-BnWWjqNc.js"; import { i as tryGetLegacyDefaultAgentId } from "./legacy.default-agent-owner-BGwEdQRe.js"; import { a as getChildLogger } from "./logger-DK-iouVT.js"; import "./agent-scope-DbtJyKUL.js"; import { d as resolveCronJobsStorePath } from "./store-K9I-tbar.js"; import { o as isAgentDeletionBlocked } from "./agent-lifecycle-registry-WgCc3vx1.js"; import { t as CronService } from "./service-CWPJ5f9M.js"; //#region src/cron/local-service.ts async function withLocalAgentCronJobsRemoved(agentId, getRuntimeConfig, commit) { const cfg = getRuntimeConfig(); const storePath = resolveCronJobsStorePath(); const service = new CronService({ storePath, cronEnabled: cfg.cron?.enabled !== false, cronConfig: cfg.cron, log: getChildLogger({ module: "cron", storeKey: storePath }), defaultAgentId: tryResolveAmbientOwnerAgentId(cfg), legacyDefaultAgentId: tryGetLegacyDefaultAgentId(cfg), resolveDefaultAgentId: () => tryResolveAmbientOwnerAgentId(getRuntimeConfig()), isAgentAvailable: (id) => !isAgentDeletionBlocked(id) && 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(); } } //#endregion export { withLocalAgentCronJobsRemoved as t };