Plugin SDK

One-line summary

The Plugin SDK is a 543-line re-export aggregation layer that provides a stable public API surface for extension authors, abstracting OpenClaw's internal implementation details.

Responsibilities

  • Re-export 150+ types and functions as the stable plugin authoring API
  • Provide helpers for HTTP routes, webhooks, media payloads, OAuth, file locking
  • Abstract internal module boundaries so plugins don't depend on internal paths
  • Enable channel plugin composition and reuse across extensions

Architecture diagram

Key source files

FileLinesRole
src/plugin-sdk/index.ts543Single entry point: all re-exports for plugin authors

Key exports (categories)

CategoryExamples
Plugin contractChannelPlugin, ChannelConfigSchema, OpenClawPluginApi
Adapter typesChannelConfigAdapter, ChannelSecurityAdapter, ChannelOutboundAdapter, etc.
Config typesOpenClawConfig, RuntimeEnv
Payload typesOutboundReplyPayload, MediaPayload, AgentMediaPayload
Gateway typesGatewayRequestHandler, RespondFn
HTTP helpersregisterPluginHttpRoute(), normalizePluginHttpPath()
Webhook helpersregisterWebhookTarget(), resolveWebhookTargets()
Media helpersbuildAgentMediaPayload(), buildMediaPayload()
Auth helpersbuildOauthProviderAuthResult()
Status helpersbuildBaseAccountStatusSnapshot(), buildBaseChannelStatusSummary()
Policy helpersresolveRuntimeGroupPolicy(), resolveSenderCommandAuthorization()
File lockingacquireFileLock(), withFileLock()

How it connects to other modules

  • Depends on: channels/plugins/, plugins/, gateway/, config/, agents/ (re-exports from these)
  • Depended by: All 38 extensions in extensions/*/

My blind spots

  • Version stability guarantees — is there a semver contract for the SDK?
  • Which exports are considered stable vs experimental
  • How breaking changes in internal modules propagate to the SDK

Change frequency

  • index.ts: Medium — new exports added as features ship; removals are rare (backward compatibility)