mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 06:30:43 +00:00
fix(outbound): restore generic delivery and security seams
This commit is contained in:
@@ -53,6 +53,46 @@ export function resolvePluginRuntimeRecord(
|
||||
};
|
||||
}
|
||||
|
||||
export function resolvePluginRuntimeRecordByEntryBaseNames(
|
||||
entryBaseNames: string[],
|
||||
onMissing?: () => never,
|
||||
): PluginRuntimeRecord | null {
|
||||
const manifestRegistry = loadPluginManifestRegistry({
|
||||
config: readPluginBoundaryConfigSafely(),
|
||||
cache: true,
|
||||
});
|
||||
const matches = manifestRegistry.plugins.filter((plugin) => {
|
||||
if (!plugin?.source) {
|
||||
return false;
|
||||
}
|
||||
const record = {
|
||||
rootDir: plugin.rootDir,
|
||||
source: plugin.source,
|
||||
};
|
||||
return entryBaseNames.every(
|
||||
(entryBaseName) => resolvePluginRuntimeModulePath(record, entryBaseName) !== null,
|
||||
);
|
||||
});
|
||||
if (matches.length === 0) {
|
||||
if (onMissing) {
|
||||
onMissing();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (matches.length > 1) {
|
||||
const pluginIds = matches.map((plugin) => plugin.id).join(", ");
|
||||
throw new Error(
|
||||
`plugin runtime boundary is ambiguous for entries [${entryBaseNames.join(", ")}]: ${pluginIds}`,
|
||||
);
|
||||
}
|
||||
const record = matches[0];
|
||||
return {
|
||||
...(record.origin ? { origin: record.origin } : {}),
|
||||
rootDir: record.rootDir,
|
||||
source: record.source,
|
||||
};
|
||||
}
|
||||
|
||||
export function resolvePluginRuntimeModulePath(
|
||||
record: Pick<PluginRuntimeRecord, "rootDir" | "source">,
|
||||
entryBaseName: string,
|
||||
|
||||
Reference in New Issue
Block a user