mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-23 14:45:46 +00:00
fix(contracts): align Teams guard and MiniMax loader (#61068)
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user