UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

72 lines (71 loc) • 2.76 kB
import { t as DEFAULT_ACCOUNT_ID } from "./account-id-BqKT3GuY.mjs"; import { i as getLoadedChannelPluginForRead } from "./registry-loaded-NYWUyLLC.mjs"; import { i as resolveChannelTarget } from "./target-resolver-DZ4okT3e.mjs"; import { i as resolveChannelDefaultAccountId } from "./helpers-ELZNDAnv.mjs"; import { r as resolveOutboundChannelPlugin } from "./channel-resolution-DjtSMYUG.mjs"; import { a as resolveOutboundSessionRoute } from "./outbound-session-BGK8YYPT.mjs"; import { d as mapAllowFromEntries } from "./channel-config-helpers-ByHw7EOT.mjs"; import { i as resolveProactiveDeliveryTargetWithSessionRoute } from "./targets-CiRFkgHi.mjs"; import { t as resolveFirstBoundAccountId } from "./bound-account-read-BQzP0D0m.mjs"; //#region src/cron/isolated-agent/delivery-target.runtime.ts /** Runtime-loaded channel target helpers used by cron delivery resolution. */ /** Picks the channel's own default account for a delivery that names none and has no binding. */ function resolveChannelDefaultAccountIdForDelivery(e) { const t = resolveOutboundChannelPlugin({ ...e, allowBootstrap: true }); const n = t ? resolveChannelDefaultAccountId({ plugin: t, cfg: e.cfg }) : void 0; return n === "default" ? void 0 : n; } /** Resolves a cron delivery target through channel plugins with bootstrap allowed. */ async function resolveChannelTargetForDelivery(e) { const t = resolveOutboundChannelPlugin({ channel: e.channel, cfg: e.cfg, agentId: e.agentId, allowBootstrap: true }); try { return await resolveChannelTarget({ cfg: e.cfg, channel: e.channel, input: e.input, accountId: e.accountId, unknownTargetMode: "normalized", plugin: t }); } catch (e) { return { ok: false, error: e instanceof Error ? e : new Error(String(e)) }; } } /** Resolves the outbound session route used for cron delivery threading and mirrors. */ async function resolveOutboundSessionRouteForDelivery(e) { const t = resolveOutboundChannelPlugin({ channel: e.channel, cfg: e.cfg, agentId: e.agentId, allowBootstrap: true }); return await resolveOutboundSessionRoute({ ...e, plugin: t }); } /** Returns whether a channel can canonicalize outbound cron delivery sessions. */ function channelCanResolveOutboundSessionRoute(e) { return Boolean(resolveOutboundChannelPlugin({ channel: e.channel, cfg: e.cfg, agentId: e.agentId, allowBootstrap: true })?.messaging?.resolveOutboundSessionRoute); } //#endregion export { channelCanResolveOutboundSessionRoute, getLoadedChannelPluginForRead, mapAllowFromEntries, resolveChannelDefaultAccountIdForDelivery, resolveChannelTargetForDelivery, resolveFirstBoundAccountId, resolveOutboundSessionRouteForDelivery, resolveProactiveDeliveryTargetWithSessionRoute };