openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
40 lines (39 loc) • 2.04 kB
JavaScript
import { t as isPluginEnabledByDefaultForPlatform } from "./default-enablement-DLXVIwwO.mjs";
import { t as normalizePluginPolicyId } from "./plugin-policy-id-CkilMowp.mjs";
import { p as resolveEffectivePluginActivationState } from "./config-state-B1JlHgba.mjs";
//#region src/plugins/manifest-owner-policy.ts
/** True when a manifest owner comes from a bundled plugin. */
function isBundledManifestOwner(e) {
return e.origin === "bundled";
}
/** True when config explicitly trusts a plugin as a manifest owner. */
function hasExplicitManifestOwnerTrust(e) {
const t = normalizePluginPolicyId(e.plugin.id);
return e.normalizedConfig.allow.includes(t) || e.normalizedConfig.entries[t]?.enabled === true;
}
/** True when a plugin passes global enablement, allowlist, denylist, and disabled checks. */
function passesManifestOwnerBasePolicy(e) {
return resolveManifestOwnerBasePolicyBlock(e) === null;
}
/** Resolves the base policy block reason for a manifest owner plugin. */
function resolveManifestOwnerBasePolicyBlock(e) {
if (!e.normalizedConfig.enabled) return "plugins-disabled";
const t = normalizePluginPolicyId(e.plugin.id);
if (e.normalizedConfig.deny.includes(t)) return "blocked-by-denylist";
if (e.normalizedConfig.entries[t]?.enabled === false) return "plugin-disabled";
if (e.allowRestrictiveAllowlistBypass !== true && e.normalizedConfig.allow.length > 0 && !e.normalizedConfig.allow.includes(t)) return "not-in-allowlist";
return null;
}
/** Resolves whether a manifest owner plugin is effectively activated. */
function isActivatedManifestOwner(e) {
return resolveEffectivePluginActivationState({
id: e.plugin.id,
origin: e.plugin.origin,
channelIds: e.plugin.channels,
config: e.normalizedConfig,
rootConfig: e.rootConfig,
enabledByDefault: isPluginEnabledByDefaultForPlatform(e.plugin)
}).activated;
}
//#endregion
export { resolveManifestOwnerBasePolicyBlock as a, passesManifestOwnerBasePolicy as i, isActivatedManifestOwner as n, isBundledManifestOwner as r, hasExplicitManifestOwnerTrust as t };