openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
58 lines (57 loc) • 2.38 kB
JavaScript
import { f as resolveEffectiveEnableState, u as normalizePluginsConfig } from "./config-state-B1JlHgba.mjs";
import { a as loadInstalledPluginIndex } from "./installed-plugin-index-DYqse_gE.mjs";
import { a as createPluginInstallRecordMap, u as setPluginInstallRecordMapEntry } from "./installed-plugin-index-row-CdwQuK63.mjs";
import { o as resolveTrustedSourceLinkedOfficialClawHubInstall, s as resolveTrustedSourceLinkedOfficialNpmInstall } from "./official-external-install-records-DHqBi8wk.mjs";
import { t as createInstalledPluginOwnershipResolver } from "./installed-plugin-package-ownership-BAh5IZ9-.mjs";
import { o as resolveSourceCheckoutBundledPluginIds } from "./bundled-sources-CIS6N5EC.mjs";
import { r as runPluginPayloadSmokeCheck } from "./payload-verification-BFPGDf3M.mjs";
//#region src/plugins/active-payload-verification.ts
/** Runs the static payload check without repair, installs, or network access. */
async function runActivePluginPayloadSmokeCheck(e) {
return await runPluginPayloadSmokeCheck({
records: filterRecordsToActive(e),
env: e.env
});
}
/** Selects the installed records covered by update/startup payload verification. */
function filterRecordsToActive(e) {
const t = e.env ?? process.env;
const n = normalizePluginsConfig(e.cfg.plugins);
const r = e.cfg.plugins?.load?.paths?.length ? createInstalledPluginOwnershipResolver(loadInstalledPluginIndex({
config: e.cfg,
installRecords: e.records,
env: t
}), t) : void 0;
const i = resolveSourceCheckoutBundledPluginIds({
config: e.cfg,
installRecords: e.records,
env: t
});
const a = createPluginInstallRecordMap();
for (const [t, o] of Object.entries(e.records)) {
if (!o || typeof o !== "object") continue;
const s = r?.resolveUpdate(t);
if (i.has(t) || s?.ok && s.value.kind === "operator-managed") continue;
if (resolveEffectiveEnableState({
id: t,
origin: "global",
config: n,
rootConfig: e.cfg
}).enabled) {
setPluginInstallRecordMapEntry(a, t, o);
continue;
}
const c = resolveTrustedSourceLinkedOfficialNpmInstall({
pluginId: t,
record: o
})?.npmSpec;
const l = resolveTrustedSourceLinkedOfficialClawHubInstall({
pluginId: t,
record: o
})?.clawhubSpec;
if (c || l) setPluginInstallRecordMapEntry(a, t, o);
}
return a;
}
//#endregion
export { runActivePluginPayloadSmokeCheck as n, filterRecordsToActive as t };