diff --git a/src/cron/delivery.test.ts b/src/cron/delivery.test.ts index 56497476adc..970589f228e 100644 --- a/src/cron/delivery.test.ts +++ b/src/cron/delivery.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "vitest"; -import type { CronJob } from "./types.js"; import { resolveCronDeliveryPlan, resolveFailureDestination } from "./delivery.js"; +import type { CronJob } from "./types.js"; function makeJob(overrides: Partial): CronJob { const now = Date.now(); diff --git a/src/cron/delivery.ts b/src/cron/delivery.ts index a65173e7254..b71589d10ce 100644 --- a/src/cron/delivery.ts +++ b/src/cron/delivery.ts @@ -1,14 +1,14 @@ import type { CliDeps } from "../cli/deps.js"; +import { createOutboundSendDeps } from "../cli/outbound-send-deps.js"; import type { CronFailureDestinationConfig } from "../config/types.cron.js"; import type { OpenClawConfig } from "../config/types.js"; -import type { CronDelivery, CronDeliveryMode, CronJob, CronMessageChannel } from "./types.js"; -import { createOutboundSendDeps } from "../cli/outbound-send-deps.js"; import { formatErrorMessage } from "../infra/errors.js"; import { deliverOutboundPayloads } from "../infra/outbound/deliver.js"; import { resolveAgentOutboundIdentity } from "../infra/outbound/identity.js"; import { buildOutboundSessionContext } from "../infra/outbound/session-context.js"; import { getChildLogger } from "../logging.js"; import { resolveDeliveryTarget } from "./isolated-agent/delivery-target.js"; +import type { CronDelivery, CronDeliveryMode, CronJob, CronMessageChannel } from "./types.js"; export type CronDeliveryPlan = { mode: CronDeliveryMode; diff --git a/src/cron/isolated-agent.delivery.test-helpers.ts b/src/cron/isolated-agent.delivery.test-helpers.ts index 5e9ac4516b2..861d80ac7a9 100644 --- a/src/cron/isolated-agent.delivery.test-helpers.ts +++ b/src/cron/isolated-agent.delivery.test-helpers.ts @@ -1,6 +1,6 @@ import { expect, vi } from "vitest"; -import type { CliDeps } from "../cli/deps.js"; import { runEmbeddedPiAgent } from "../agents/pi-embedded.js"; +import type { CliDeps } from "../cli/deps.js"; import { runCronIsolatedAgentTurn } from "./isolated-agent.js"; import { makeCfg, makeJob } from "./isolated-agent.test-harness.js"; diff --git a/src/cron/isolated-agent/delivery-target.ts b/src/cron/isolated-agent/delivery-target.ts index fb558371687..ffc0f3dae5f 100644 --- a/src/cron/isolated-agent/delivery-target.ts +++ b/src/cron/isolated-agent/delivery-target.ts @@ -1,6 +1,5 @@ import type { ChannelId } from "../../channels/plugins/types.js"; import type { OpenClawConfig } from "../../config/config.js"; -import type { OutboundChannel } from "../../infra/outbound/targets.js"; import { loadSessionStore, resolveAgentMainSessionKey, @@ -8,6 +7,7 @@ import { } from "../../config/sessions.js"; import { resolveMessageChannelSelection } from "../../infra/outbound/channel-selection.js"; import { maybeResolveIdLikeTarget } from "../../infra/outbound/target-resolver.js"; +import type { OutboundChannel } from "../../infra/outbound/targets.js"; import { resolveOutboundTarget, resolveSessionDeliveryTarget, diff --git a/src/cron/isolated-agent/run.ts b/src/cron/isolated-agent/run.ts index e3e50aaed95..bca434b11ca 100644 --- a/src/cron/isolated-agent/run.ts +++ b/src/cron/isolated-agent/run.ts @@ -1,7 +1,3 @@ -import type { CliDeps } from "../../cli/outbound-send-deps.js"; -import type { OpenClawConfig } from "../../config/config.js"; -import type { AgentDefaultsConfig } from "../../config/types.js"; -import type { CronJob, CronRunOutcome, CronRunTelemetry } from "../types.js"; import { resolveAgentConfig, resolveAgentDir, @@ -41,11 +37,14 @@ import { normalizeVerboseLevel, supportsXHighThinking, } from "../../auto-reply/thinking.js"; +import type { CliDeps } from "../../cli/outbound-send-deps.js"; +import type { OpenClawConfig } from "../../config/config.js"; import { resolveSessionTranscriptPath, setSessionRuntimeModel, updateSessionStore, } from "../../config/sessions.js"; +import type { AgentDefaultsConfig } from "../../config/types.js"; import { registerAgentRunContext } from "../../infra/agent-events.js"; import { logWarn } from "../../logger.js"; import { normalizeAgentId } from "../../routing/session-key.js"; @@ -56,6 +55,7 @@ import { isExternalHookSession, } from "../../security/external-content.js"; import { resolveCronDeliveryPlan } from "../delivery.js"; +import type { CronJob, CronRunOutcome, CronRunTelemetry } from "../types.js"; import { dispatchCronDelivery, matchesMessagingToolDeliveryTarget, diff --git a/src/cron/normalize.ts b/src/cron/normalize.ts index ecf707f7e02..80cf11d5d76 100644 --- a/src/cron/normalize.ts +++ b/src/cron/normalize.ts @@ -1,4 +1,3 @@ -import type { CronJobCreate, CronJobPatch } from "./types.js"; import { sanitizeAgentId } from "../routing/session-key.js"; import { isRecord } from "../utils.js"; import { normalizeLegacyDeliveryInput } from "./legacy-delivery.js"; @@ -6,6 +5,7 @@ import { parseAbsoluteTimeMs } from "./parse.js"; import { migrateLegacyCronPayload } from "./payload-migration.js"; import { inferLegacyName } from "./service/normalize.js"; import { normalizeCronStaggerMs, resolveDefaultCronStaggerMs } from "./stagger.js"; +import type { CronJobCreate, CronJobPatch } from "./types.js"; type UnknownRecord = Record; diff --git a/src/cron/service.jobs.test.ts b/src/cron/service.jobs.test.ts index df1d0e3081a..aa15ddb5543 100644 --- a/src/cron/service.jobs.test.ts +++ b/src/cron/service.jobs.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "vitest"; -import type { CronServiceState } from "./service/state.js"; -import type { CronJob, CronJobPatch } from "./types.js"; import { applyJobPatch, createJob } from "./service/jobs.js"; +import type { CronServiceState } from "./service/state.js"; import { DEFAULT_TOP_OF_HOUR_STAGGER_MS } from "./stagger.js"; +import type { CronJob, CronJobPatch } from "./types.js"; function expectCronStaggerMs(job: CronJob, expected: number): void { expect(job.schedule.kind).toBe("cron"); diff --git a/src/cron/service/jobs.ts b/src/cron/service/jobs.ts index b7c8b47b60b..8d8128f7c12 100644 --- a/src/cron/service/jobs.ts +++ b/src/cron/service/jobs.ts @@ -1,15 +1,4 @@ import crypto from "node:crypto"; -import type { - CronDelivery, - CronDeliveryPatch, - CronFailureAlert, - CronJob, - CronJobCreate, - CronJobPatch, - CronPayload, - CronPayloadPatch, -} from "../types.js"; -import type { CronServiceState } from "./state.js"; import { normalizeAgentId } from "../../routing/session-key.js"; import { parseAbsoluteTimeMs } from "../parse.js"; import { @@ -22,6 +11,16 @@ import { resolveCronStaggerMs, resolveDefaultCronStaggerMs, } from "../stagger.js"; +import type { + CronDelivery, + CronDeliveryPatch, + CronFailureAlert, + CronJob, + CronJobCreate, + CronJobPatch, + CronPayload, + CronPayloadPatch, +} from "../types.js"; import { normalizeHttpWebhookUrl } from "../webhook-url.js"; import { resolveInitialCronDelivery } from "./initial-delivery.js"; import { @@ -31,6 +30,7 @@ import { normalizePayloadToSystemText, normalizeRequiredName, } from "./normalize.js"; +import type { CronServiceState } from "./state.js"; const STUCK_RUN_MS = 2 * 60 * 60 * 1000; const STAGGER_OFFSET_CACHE_MAX = 4096;