fix(contracts): align Teams guard and MiniMax loader (#61068)

This commit is contained in:
Altay
2026-04-05 02:13:46 +03:00
committed by GitHub
parent 2781897d2c
commit d37e4a6c3a
2 changed files with 24 additions and 7 deletions

View File

@@ -35,9 +35,11 @@ const BUNDLED_EXTENSION_CONFIG_IMPORT_GUARDS = [
path: "extensions/googlechat/src/config-schema.ts",
allowedSpecifier: "openclaw/plugin-sdk/googlechat",
},
// Teams keeps a package-local config barrel so production code does not
// self-import via openclaw/plugin-sdk/msteams from inside the same extension.
{
path: "extensions/msteams/src/config-schema.ts",
allowedSpecifier: "openclaw/plugin-sdk/msteams",
allowedSpecifier: "../config-api.js",
},
] as const;

View File

@@ -84,6 +84,19 @@ function resolveNamedBuilder<T>(moduleExport: unknown, pattern: RegExp): (() =>
return undefined;
}
function resolveNamedBuilders<T>(moduleExport: unknown, pattern: RegExp): Array<() => T> {
if (!moduleExport || typeof moduleExport !== "object") {
return [];
}
const matches: Array<() => T> = [];
for (const [key, value] of Object.entries(moduleExport as Record<string, unknown>)) {
if (pattern.test(key) && typeof value === "function") {
matches.push(value as () => T);
}
}
return matches;
}
function resolveNamedValues<T>(
moduleExport: unknown,
pattern: RegExp,
@@ -315,17 +328,19 @@ export function loadVitestImageGenerationProviderContractRegistry(): ImageGenera
if (!fs.existsSync(testApiPath)) {
continue;
}
const builder = resolveNamedBuilder<ImageGenerationProviderPlugin>(
const builders = resolveNamedBuilders<ImageGenerationProviderPlugin>(
createVitestCapabilityLoader(testApiPath)(testApiPath),
/^build.+ImageGenerationProvider$/u,
);
if (!builder) {
if (builders.length === 0) {
continue;
}
registrations.push({
pluginId: plugin.id,
provider: builder(),
});
registrations.push(
...builders.map((builder) => ({
pluginId: plugin.id,
provider: builder(),
})),
);
unresolvedPluginIds.delete(plugin.id);
}