UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

39 lines (38 loc) • 1.5 kB
//#region src/channels/account-resolution.ts /** Prefer fresh operational preparation without retrying failures through the legacy hook. */ async function resolveChannelAccount(e) { const { config: t } = e.plugin; return t.resolveAccountAsync ? await t.resolveAccountAsync(e.cfg, e.accountId) : t.resolveAccount(e.cfg, e.accountId); } async function channelHasConfiguredState(e) { const { config: t } = e.plugin; const n = { cfg: e.cfg, env: e.env }; return t.hasConfiguredStateAsync ? await t.hasConfiguredStateAsync(n) : t.hasConfiguredState?.(n); } /** Async hooks own their result; an empty result or failure never retries a legacy hook. */ async function resolveChannelAllowFrom(e) { const { config: t } = e.plugin; const n = { cfg: e.cfg, accountId: e.accountId }; return t.resolveAllowFromAsync ? await t.resolveAllowFromAsync(n) : t.resolveAllowFrom?.(n); } async function describeChannelAccount(e) { const { config: t } = e.plugin; return t.describeAccountAsync ? await t.describeAccountAsync(e.account, e.cfg) : t.describeAccount?.(e.account, e.cfg); } async function resolvePluginDmPolicy(e) { const { security: t } = e.plugin; const n = { cfg: e.cfg, accountId: e.accountId, account: e.account }; return t?.resolveDmPolicyAsync ? await t.resolveDmPolicyAsync(n) : t?.resolveDmPolicy?.(n); } //#endregion export { resolvePluginDmPolicy as a, resolveChannelAllowFrom as i, describeChannelAccount as n, resolveChannelAccount as r, channelHasConfiguredState as t };