UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

33 lines (32 loc) • 1.84 kB
import { l as isRecord } from "./record-coerce-CVPuDqcc.mjs"; //#region src/cron/inference-binding.ts /** Stored bindings are private scheduler state, never accepted from public job input. */ function normalizeCronInferenceBinding(e) { if (e === void 0) return; if (!isRecord(e)) throw new Error("Invalid automation inference binding."); const t = e; if (t.version !== 1 || typeof t.provider !== "string" || !t.provider.trim() || typeof t.profileId !== "string" || !t.profileId.trim() || typeof t.authorizationId !== "string" || !/^[a-f0-9]{64}$/.test(t.authorizationId) || t.authRequirement !== "api-key" && t.authRequirement !== "subscription" || t.source !== "auto" && t.source !== "user" || t.runtime !== void 0 && (typeof t.runtime !== "string" || !t.runtime.trim())) throw new Error("Invalid automation inference binding; explicitly select an account again."); return { version: 1, provider: t.provider, profileId: t.profileId, authorizationId: t.authorizationId, authRequirement: t.authRequirement, source: t.source, ...t.runtime !== void 0 ? { runtime: t.runtime } : {} }; } /** * The session runtime fields a run resolves its runtime from. A binding with a captured * runtime supplies it, so a runtime override copied into the cron session entry cannot move * the job onto a runtime its account was not captured for. */ function resolveCronRuntimeSessionEntry(e, t) { return e?.runtime ? { agentRuntimeOverride: e.runtime } : t; } /** Names a binding's account and captured runtime for scheduled-run errors. */ function describeCronInferenceBinding(e) { return e.runtime ? `account ${e.profileId} on runtime ${e.runtime}` : `account ${e.profileId} (no recorded runtime)`; } //#endregion export { normalizeCronInferenceBinding as n, resolveCronRuntimeSessionEntry as r, describeCronInferenceBinding as t };