UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

46 lines (45 loc) • 2.11 kB
import { a as getResolvedLoggerSettings, l as toPinoLikeLogger, r as getChildLogger } from "./logger-DQckz-uQ.mjs"; import { n as normalizeAgentId } from "./agent-id-D1-Q6vR4.mjs"; import { C as tryResolveAmbientOwnerAgentId } from "./agent-scope-config-BU4qc9bA.mjs"; import "./session-key-BC4m_Ly5.mjs"; import { i as listAgentIds } from "./agent-roster-B45JERT5.mjs"; import { i as tryGetLegacyDefaultAgentId } from "./legacy.default-agent-owner-DlHTJ13Y.mjs"; import "./agent-scope-DWB4x52T.mjs"; import { a as isAgentDeletionBlocked } from "./agent-lifecycle-registry-BI2xler2.mjs"; import { t as resolveCronJobsStorePath } from "./paths-D0lej1Bn.mjs"; import { t as GatewayScheduler } from "./gateway-scheduler-DyVQgsqN.mjs"; import "./store-abzXKIps.mjs"; import { t as CronService } from "./service-azEUjirP.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), legacyDefaultAgentId: tryGetLegacyDefaultAgentId(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 };