diff --git a/src/cron/isolated-agent/run-executor.runtime.ts b/src/cron/isolated-agent/run-executor.runtime.ts new file mode 100644 index 00000000000..27750600561 --- /dev/null +++ b/src/cron/isolated-agent/run-executor.runtime.ts @@ -0,0 +1 @@ +export { executeCronRun, type CronExecutionResult } from "./run-executor.js"; diff --git a/src/cron/isolated-agent/run.ts b/src/cron/isolated-agent/run.ts index f0db9a6f1ee..e87d6182ede 100644 --- a/src/cron/isolated-agent/run.ts +++ b/src/cron/isolated-agent/run.ts @@ -19,7 +19,6 @@ import { } from "./helpers.js"; import { resolveCronModelSelection } from "./model-selection.js"; import { buildCronAgentDefaultsConfig } from "./run-config.js"; -import { executeCronRun, type CronExecutionResult } from "./run-executor.js"; import { createPersistCronSessionEntry, markCronSessionPreRun, @@ -61,6 +60,7 @@ import { resolveCronSkillsSnapshot } from "./skills-snapshot.js"; let sessionStoreRuntimePromise: | Promise | undefined; +let cronExecutorRuntimePromise: Promise | undefined; let cronAuthProfileRuntimePromise: | Promise | undefined; @@ -74,6 +74,11 @@ async function loadSessionStoreRuntime() { return await sessionStoreRuntimePromise; } +async function loadCronExecutorRuntime() { + cronExecutorRuntimePromise ??= import("./run-executor.runtime.js"); + return await cronExecutorRuntimePromise; +} + async function loadCronAuthProfileRuntime() { cronAuthProfileRuntimePromise ??= import("./run-auth-profile.runtime.js"); return await cronAuthProfileRuntimePromise; @@ -102,6 +107,8 @@ function resolveNonNegativeNumber(value: number | undefined): number | undefined export type { RunCronAgentTurnResult } from "./run.types.js"; +type CronExecutionRuntime = typeof import("./run-executor.runtime.js"); +type CronExecutionResult = Awaited>; type ResolvedCronDeliveryTarget = Awaited>; type CronModelCatalogRuntime = typeof import("./run-model-catalog.runtime.js"); @@ -716,6 +723,7 @@ export async function runCronIsolatedAgentTurn(params: { } try { + const { executeCronRun } = await loadCronExecutorRuntime(); const execution = await executeCronRun({ cfg: params.cfg, cfgWithAgentDefaults: prepared.context.cfgWithAgentDefaults,