mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-25 16:12:13 +00:00
docs(plugin-sdk): document public SDK surface
This commit is contained in:
@@ -52,6 +52,7 @@ export type { OpenClawConfig } from "../config/config.js";
|
||||
|
||||
export { emptyPluginConfigSchema } from "../plugins/config-schema.js";
|
||||
|
||||
/** Options for a plugin entry that registers providers, tools, commands, or services. */
|
||||
type DefinePluginEntryOptions = {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -61,6 +62,7 @@ type DefinePluginEntryOptions = {
|
||||
register: (api: OpenClawPluginApi) => void;
|
||||
};
|
||||
|
||||
/** Normalized object shape that OpenClaw loads from a plugin entry module. */
|
||||
type DefinedPluginEntry = {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -69,13 +71,20 @@ type DefinedPluginEntry = {
|
||||
register: NonNullable<OpenClawPluginDefinition["register"]>;
|
||||
} & Pick<OpenClawPluginDefinition, "kind">;
|
||||
|
||||
/** Resolve either a concrete config schema or a lazy schema factory. */
|
||||
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.
|
||||
/**
|
||||
* Canonical entry helper for non-channel plugins.
|
||||
*
|
||||
* Use this for provider, tool, command, service, memory, and context-engine
|
||||
* plugins. Channel plugins should use `defineChannelPluginEntry(...)` from
|
||||
* `openclaw/plugin-sdk/core` so they inherit the channel capability wiring.
|
||||
*/
|
||||
export function definePluginEntry({
|
||||
id,
|
||||
name,
|
||||
|
||||
Reference in New Issue
Block a user