2026-03-20 10:04:11 -07:00
|
|
|
---
|
|
|
|
|
title: "Plugin SDK Migration"
|
2026-03-20 10:32:51 -07:00
|
|
|
sidebarTitle: "SDK Migration"
|
2026-03-20 10:54:48 -07:00
|
|
|
summary: "Migrate from the deprecated openclaw/plugin-sdk/compat import to focused subpath imports"
|
2026-03-20 10:04:11 -07:00
|
|
|
read_when:
|
|
|
|
|
- You see the OPENCLAW_PLUGIN_SDK_COMPAT_DEPRECATED warning
|
2026-03-20 10:54:48 -07:00
|
|
|
- You are updating a plugin from the monolithic import to scoped subpaths
|
2026-03-20 10:04:11 -07:00
|
|
|
- You maintain an external OpenClaw plugin
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Plugin SDK Migration
|
|
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
The `openclaw/plugin-sdk/compat` import is deprecated. All plugins should use
|
|
|
|
|
**focused subpath imports** (`openclaw/plugin-sdk/\<subpath\>`) instead.
|
2026-03-20 10:04:11 -07:00
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
<Info>
|
|
|
|
|
The compat import still works at runtime. This is a deprecation warning, not
|
|
|
|
|
a breaking change yet. But new plugins **must not** use it, and existing
|
|
|
|
|
plugins should migrate before the next major release removes it.
|
|
|
|
|
</Info>
|
2026-03-20 10:04:11 -07:00
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
## Why this changed
|
2026-03-20 10:04:11 -07:00
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
The old monolithic `openclaw/plugin-sdk/compat` re-exported everything from one
|
|
|
|
|
entry point. This caused slow startup (importing one helper loaded dozens of
|
|
|
|
|
unrelated modules), circular dependency risk, and an unclear API surface.
|
2026-03-20 10:04:11 -07:00
|
|
|
|
|
|
|
|
Focused subpaths fix all three: each subpath is a small, self-contained module
|
|
|
|
|
with a clear purpose.
|
|
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
## Migration steps
|
2026-03-20 10:04:11 -07:00
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
<Steps>
|
|
|
|
|
<Step title="Find deprecated imports">
|
|
|
|
|
Search your plugin for imports from the compat path:
|
2026-03-20 10:04:11 -07:00
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
```bash
|
|
|
|
|
grep -r "plugin-sdk/compat" my-plugin/
|
|
|
|
|
```
|
2026-03-20 10:04:11 -07:00
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
</Step>
|
2026-03-20 10:04:11 -07:00
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
<Step title="Replace with focused subpaths">
|
|
|
|
|
Each export maps to a specific subpath. Replace the import source:
|
2026-03-20 10:04:11 -07:00
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
```typescript
|
|
|
|
|
// Before (deprecated)
|
|
|
|
|
import {
|
|
|
|
|
createChannelReplyPipeline,
|
|
|
|
|
createPluginRuntimeStore,
|
|
|
|
|
resolveControlCommandGate,
|
|
|
|
|
} from "openclaw/plugin-sdk/compat";
|
2026-03-20 10:04:11 -07:00
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
// After (focused subpaths)
|
|
|
|
|
import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline";
|
|
|
|
|
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
|
|
|
import { resolveControlCommandGate } from "openclaw/plugin-sdk/command-auth";
|
|
|
|
|
```
|
2026-03-20 10:04:11 -07:00
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
See the [subpath reference](#subpath-reference) below for the full mapping.
|
2026-03-20 10:04:11 -07:00
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
</Step>
|
2026-03-20 10:04:11 -07:00
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
<Step title="Build and test">
|
|
|
|
|
```bash
|
|
|
|
|
pnpm build
|
|
|
|
|
pnpm test -- my-plugin/
|
|
|
|
|
```
|
|
|
|
|
</Step>
|
|
|
|
|
</Steps>
|
2026-03-20 10:04:11 -07:00
|
|
|
|
|
|
|
|
## Subpath reference
|
|
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
<Accordion title="Full subpath table">
|
|
|
|
|
| Subpath | Purpose | Key exports |
|
|
|
|
|
| --- | --- | --- |
|
|
|
|
|
| `plugin-sdk/core` | Plugin entry definitions, base types | `defineChannelPluginEntry`, `definePluginEntry` |
|
|
|
|
|
| `plugin-sdk/channel-setup` | Setup wizard adapters | `createOptionalChannelSetupSurface` |
|
|
|
|
|
| `plugin-sdk/channel-pairing` | DM pairing primitives | `createChannelPairingController` |
|
|
|
|
|
| `plugin-sdk/channel-reply-pipeline` | Reply prefix + typing wiring | `createChannelReplyPipeline` |
|
|
|
|
|
| `plugin-sdk/channel-config-helpers` | Config adapter factories | `createHybridChannelConfigAdapter` |
|
|
|
|
|
| `plugin-sdk/channel-config-schema` | Config schema builders | Channel config schema types |
|
|
|
|
|
| `plugin-sdk/channel-policy` | Group/DM policy resolution | `resolveChannelGroupRequireMention` |
|
|
|
|
|
| `plugin-sdk/channel-lifecycle` | Account status tracking | `createAccountStatusSink` |
|
|
|
|
|
| `plugin-sdk/channel-runtime` | Runtime wiring helpers | Channel runtime utilities |
|
|
|
|
|
| `plugin-sdk/channel-send-result` | Send result types | Reply result types |
|
|
|
|
|
| `plugin-sdk/runtime-store` | Persistent plugin storage | `createPluginRuntimeStore` |
|
|
|
|
|
| `plugin-sdk/allow-from` | Allowlist formatting | `formatAllowFromLowercase` |
|
|
|
|
|
| `plugin-sdk/allowlist-resolution` | Allowlist input mapping | `mapAllowlistResolutionInputs` |
|
|
|
|
|
| `plugin-sdk/command-auth` | Command gating | `resolveControlCommandGate` |
|
|
|
|
|
| `plugin-sdk/secret-input` | Secret input parsing | Secret input helpers |
|
|
|
|
|
| `plugin-sdk/webhook-ingress` | Webhook request helpers | Webhook target utilities |
|
|
|
|
|
| `plugin-sdk/reply-payload` | Message reply types | Reply payload types |
|
|
|
|
|
| `plugin-sdk/provider-onboard` | Provider onboarding patches | Onboarding config helpers |
|
|
|
|
|
| `plugin-sdk/keyed-async-queue` | Ordered async queue | `KeyedAsyncQueue` |
|
|
|
|
|
| `plugin-sdk/testing` | Test utilities | Test helpers and mocks |
|
|
|
|
|
</Accordion>
|
|
|
|
|
|
|
|
|
|
Use the narrowest subpath that matches the job. If you cannot find an export,
|
2026-03-20 10:04:11 -07:00
|
|
|
check the source at `src/plugin-sdk/` or ask in Discord.
|
|
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
## Removal timeline
|
2026-03-20 10:04:11 -07:00
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
| When | What happens |
|
|
|
|
|
| ---------------------- | --------------------------------------------------------------- |
|
|
|
|
|
| **Now** | Compat import emits a runtime deprecation warning |
|
|
|
|
|
| **Next major release** | Compat import will be removed; plugins still using it will fail |
|
2026-03-20 10:04:11 -07:00
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
All core plugins have already been migrated. External plugins should migrate
|
|
|
|
|
before the next major release.
|
2026-03-20 10:04:11 -07:00
|
|
|
|
|
|
|
|
## Suppressing the warning temporarily
|
|
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
Set this environment variable while you work on migrating:
|
2026-03-20 10:04:11 -07:00
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
OPENCLAW_SUPPRESS_PLUGIN_SDK_COMPAT_WARNING=1 openclaw gateway run
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
This is a temporary escape hatch, not a permanent solution.
|
|
|
|
|
|
|
|
|
|
## Related
|
|
|
|
|
|
2026-03-20 10:54:48 -07:00
|
|
|
- [Building Plugins](/plugins/building-plugins)
|
2026-03-20 10:04:11 -07:00
|
|
|
- [Plugin Architecture](/plugins/architecture)
|
|
|
|
|
- [Plugin Manifest](/plugins/manifest)
|