mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-22 07:20:59 +00:00
96 lines
2.8 KiB
TypeScript
96 lines
2.8 KiB
TypeScript
import { emptyPluginConfigSchema } from "../plugins/config-schema.js";
|
|
import type {
|
|
OpenClawPluginApi,
|
|
OpenClawPluginCommandDefinition,
|
|
OpenClawPluginConfigSchema,
|
|
OpenClawPluginDefinition,
|
|
PluginInteractiveTelegramHandlerContext,
|
|
} from "../plugins/types.js";
|
|
|
|
export type {
|
|
AnyAgentTool,
|
|
MediaUnderstandingProviderPlugin,
|
|
OpenClawPluginApi,
|
|
PluginCommandContext,
|
|
OpenClawPluginConfigSchema,
|
|
ProviderDiscoveryContext,
|
|
ProviderCatalogContext,
|
|
ProviderCatalogResult,
|
|
ProviderAugmentModelCatalogContext,
|
|
ProviderBuiltInModelSuppressionContext,
|
|
ProviderBuiltInModelSuppressionResult,
|
|
ProviderBuildMissingAuthMessageContext,
|
|
ProviderCacheTtlEligibilityContext,
|
|
ProviderDefaultThinkingPolicyContext,
|
|
ProviderFetchUsageSnapshotContext,
|
|
ProviderModernModelPolicyContext,
|
|
ProviderPreparedRuntimeAuth,
|
|
ProviderResolvedUsageAuth,
|
|
ProviderPrepareExtraParamsContext,
|
|
ProviderPrepareDynamicModelContext,
|
|
ProviderPrepareRuntimeAuthContext,
|
|
ProviderResolveUsageAuthContext,
|
|
ProviderResolveDynamicModelContext,
|
|
ProviderNormalizeResolvedModelContext,
|
|
ProviderRuntimeModel,
|
|
SpeechProviderPlugin,
|
|
ProviderThinkingPolicyContext,
|
|
ProviderWrapStreamFnContext,
|
|
OpenClawPluginService,
|
|
OpenClawPluginServiceContext,
|
|
ProviderAuthContext,
|
|
ProviderAuthDoctorHintContext,
|
|
ProviderAuthMethodNonInteractiveContext,
|
|
ProviderAuthMethod,
|
|
ProviderAuthResult,
|
|
OpenClawPluginCommandDefinition,
|
|
OpenClawPluginDefinition,
|
|
PluginLogger,
|
|
PluginInteractiveTelegramHandlerContext,
|
|
} from "../plugins/types.js";
|
|
export type { OpenClawConfig } from "../config/config.js";
|
|
|
|
export { emptyPluginConfigSchema } from "../plugins/config-schema.js";
|
|
|
|
type DefinePluginEntryOptions = {
|
|
id: string;
|
|
name: string;
|
|
description: string;
|
|
kind?: OpenClawPluginDefinition["kind"];
|
|
configSchema?: OpenClawPluginConfigSchema | (() => OpenClawPluginConfigSchema);
|
|
register: (api: OpenClawPluginApi) => void;
|
|
};
|
|
|
|
type DefinedPluginEntry = {
|
|
id: string;
|
|
name: string;
|
|
description: string;
|
|
configSchema: OpenClawPluginConfigSchema;
|
|
register: NonNullable<OpenClawPluginDefinition["register"]>;
|
|
} & Pick<OpenClawPluginDefinition, "kind">;
|
|
|
|
function resolvePluginConfigSchema(
|
|
configSchema: DefinePluginEntryOptions["configSchema"] = emptyPluginConfigSchema,
|
|
): OpenClawPluginConfigSchema {
|
|
return typeof configSchema === "function" ? configSchema() : configSchema;
|
|
}
|
|
|
|
// Small entry surface for provider and command plugins that do not need channel helpers.
|
|
export function definePluginEntry({
|
|
id,
|
|
name,
|
|
description,
|
|
kind,
|
|
configSchema = emptyPluginConfigSchema,
|
|
register,
|
|
}: DefinePluginEntryOptions): DefinedPluginEntry {
|
|
return {
|
|
id,
|
|
name,
|
|
description,
|
|
...(kind ? { kind } : {}),
|
|
configSchema: resolvePluginConfigSchema(configSchema),
|
|
register,
|
|
};
|
|
}
|