openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.57 kB
JavaScript
import{n as normalizeAgentId}from"./agent-id-cOfqmfln.mjs";import"./session-key-BPgKfU2m.mjs";import{i as listAgentIds}from"./agent-roster-4XrgUgPK.mjs";import{O as tryResolveAmbientOwnerAgentId}from"./agent-scope-config-CG9CFpGX.mjs";import{d as toPinoLikeLogger,i as getFileLogLevel,r as getChildLogger}from"./logger-bB_ZfEX5.mjs";import{t as GatewayScheduler}from"./gateway-scheduler-C24cnvAu.mjs";import"./agent-scope-Dw5XRSEh.mjs";import{i as resolveCronJobsStorePathAsync}from"./paths-BFxu7LPC.mjs";import"./store-GnAg_zUK.mjs";import{t as CronService}from"./service-BnXeWfHi.mjs";
//!src/cron/local-service.ts
async function withLocalCronService(e,t){const n=e();const r=await resolveCronJobsStorePathAsync();const i=new GatewayScheduler;const a=new CronService({scheduler:i,storePath:r,cronEnabled:n.cron?.enabled??true,cronConfig:n.cron,log:toPinoLikeLogger(getChildLogger({module:`cron`,storeKey:r}),getFileLogLevel()),defaultAgentId:tryResolveAmbientOwnerAgentId(n),resolveDefaultAgentId:()=>tryResolveAmbientOwnerAgentId(e()),isAgentAvailable:(t,n)=>!n.deletionBlocked&&listAgentIds(e()).some(e=>normalizeAgentId(e)===t),enqueueSystemEvent:()=>false,runIsolatedAgentJob:async()=>{throw new Error(`Cron execution is unavailable in local service context.`)}});a.pauseScheduling();try{return await t(a)}finally{a.stop();await a.waitForIdle();await i.stop()}}async function withLocalAgentCronJobsRemoved(e,t,n){return await withLocalCronService(t,async t=>t.removeAgentJobsTransactional(e,n))}export{withLocalCronService as n,withLocalAgentCronJobsRemoved as t};