UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

25 lines (24 loc) • 1.29 kB
import { n as normalizeAgentId } from "./agent-id-CQjtp2ft.mjs"; import { j as parseAgentSessionKey } from "./session-key-CqAyZeVk.mjs"; //#region src/cron/agent-id.ts const CRON_AGENT_SELECTION_REQUIRED_MESSAGE = "Agent-less cron job has no resolvable owner. Pass --agent <id> when creating or editing the job, or set agents.defaults.systemAgent.agentId."; var CronAgentSelectionRequiredError = class extends Error { constructor() { super(CRON_AGENT_SELECTION_REQUIRED_MESSAGE); this.code = "AGENT_SELECTION_REQUIRED"; this.name = "CronAgentSelectionRequiredError"; } }; /** Resolves cron ownership: explicit non-blank id, scoped session key, then configured default. */ function tryResolveCronJobEffectiveAgentId(e, t) { const n = e.agentId?.trim() || parseAgentSessionKey(e.sessionKey)?.agentId || t?.trim(); return n ? normalizeAgentId(n) : void 0; } /** Requires an owner before cron execution or an owner-scoped mutation. */ function resolveCronJobEffectiveAgentId(e, t) { const n = tryResolveCronJobEffectiveAgentId(e, t); if (!n) throw new CronAgentSelectionRequiredError(); return n; } //#endregion export { tryResolveCronJobEffectiveAgentId as i, CronAgentSelectionRequiredError as n, resolveCronJobEffectiveAgentId as r, CRON_AGENT_SELECTION_REQUIRED_MESSAGE as t };