fix: stabilize plugin-sdk test loading

This commit is contained in:
Peter Steinberger
2026-03-27 13:14:11 +00:00
parent 9d10a2e242
commit b5a8d5a230
10 changed files with 524 additions and 104 deletions

View File

@@ -0,0 +1,8 @@
export {
applyLitellmConfig,
applyLitellmProviderConfig,
buildLitellmModelDefinition,
LITELLM_BASE_URL,
LITELLM_DEFAULT_MODEL_ID,
LITELLM_DEFAULT_MODEL_REF,
} from "../../extensions/litellm/onboard.js";

View File

@@ -1,10 +1,48 @@
import type { OpenClawConfig } from "../config/config.js";
import { emptyPluginConfigSchema } from "../plugins/config-schema.js";
import type {
AnyAgentTool,
MediaUnderstandingProviderPlugin,
OpenClawPluginApi,
OpenClawPluginCommandDefinition,
OpenClawPluginConfigSchema,
OpenClawPluginDefinition,
OpenClawPluginService,
OpenClawPluginServiceContext,
OpenClawPluginToolContext,
OpenClawPluginToolFactory,
PluginInteractiveTelegramHandlerContext,
PluginLogger,
ProviderAugmentModelCatalogContext,
ProviderAuthContext,
ProviderAuthDoctorHintContext,
ProviderAuthMethod,
ProviderAuthMethodNonInteractiveContext,
ProviderAuthResult,
ProviderBuildMissingAuthMessageContext,
ProviderBuildUnknownModelHintContext,
ProviderBuiltInModelSuppressionContext,
ProviderBuiltInModelSuppressionResult,
ProviderCacheTtlEligibilityContext,
ProviderCatalogContext,
ProviderCatalogResult,
ProviderDefaultThinkingPolicyContext,
ProviderDiscoveryContext,
ProviderFetchUsageSnapshotContext,
ProviderModernModelPolicyContext,
ProviderNormalizeResolvedModelContext,
ProviderPrepareDynamicModelContext,
ProviderPrepareExtraParamsContext,
ProviderPrepareRuntimeAuthContext,
ProviderPreparedRuntimeAuth,
ProviderResolvedUsageAuth,
ProviderResolveDynamicModelContext,
ProviderResolveUsageAuthContext,
ProviderRuntimeModel,
ProviderThinkingPolicyContext,
ProviderWrapStreamFnContext,
SpeechProviderPlugin,
PluginCommandContext,
} from "../plugins/types.js";
export type {
@@ -50,8 +88,8 @@ export type {
OpenClawPluginDefinition,
PluginLogger,
PluginInteractiveTelegramHandlerContext,
} from "../plugins/types.js";
export type { OpenClawConfig } from "../config/config.js";
};
export type { OpenClawConfig };
export { emptyPluginConfigSchema } from "../plugins/config-schema.js";

View File

@@ -7,7 +7,12 @@ let monolithicSdk = null;
let diagnosticEventsModule = null;
const jitiLoaders = new Map();
const pluginSdkSubpathsCache = new Map();
const shouldPreferSourceInTests = Boolean(process.env.VITEST) || process.env.NODE_ENV === "test";
const shouldPreferSourceInTests =
process.env.OPENCLAW_PLUGIN_SDK_PREFER_DIST === "1"
? false
: Boolean(process.env.VITEST) ||
process.env.NODE_ENV === "test" ||
process.env.OPENCLAW_PLUGIN_SDK_SOURCE_IN_TESTS === "1";
function emptyPluginConfigSchema() {
function error(message) {