


























@@ -5,7 +5,7 @@ sidebarTitle: "Migrate to SDK"
55read_when:
66 - You see the OPENCLAW_PLUGIN_SDK_COMPAT_DEPRECATED warning
77 - You see the OPENCLAW_EXTENSION_API_DEPRECATED warning
8- - You use api.registerEmbeddedExtensionFactory
8+ - You used api.registerEmbeddedExtensionFactory before OpenClaw 2026.4.24
99 - You are updating a plugin to the modern plugin architecture
1010 - You maintain an external OpenClaw plugin
1111---
@@ -24,12 +24,14 @@ anything they needed from a single entry point:
2424 new plugin architecture was being built.
2525- **`openclaw/extension-api`** — a bridge that gave plugins direct access to
2626 host-side helpers like the embedded agent runner.
27-- **`api.registerEmbeddedExtensionFactory(...)`** — a Pi-only bundled extension
28- hook that could observe embedded-runner events such as `tool_result`.
27+- **`api.registerEmbeddedExtensionFactory(...)`** — a removed Pi-only bundled
28+ extension hook that could observe embedded-runner events such as
29+`tool_result`.
293030-These surfaces are now **deprecated**. They still work at runtime, but new
31-plugins must not use them, and existing plugins should migrate before the next
32-major release removes them.
31+The broad import surfaces are now **deprecated**. They still work at runtime,
32+but new plugins must not use them, and existing plugins should migrate before
33+the next major release removes them. The Pi-only embedded extension factory
34+registration API has been removed; use tool-result middleware instead.
33353436OpenClaw does not remove or reinterpret documented plugin behavior in the same
3537change that introduces a replacement. Breaking contract changes must first go
@@ -40,6 +42,7 @@ registration behavior.
4042<Warning>
4143 The backwards-compatibility layer will be removed in a future major release.
4244 Plugins that still import from these surfaces will break when that happens.
45+ Pi-only embedded extension factory registrations already no longer load.
4346</Warning>
44474548## Why this changed
@@ -91,19 +94,12 @@ releases.
91949295<Steps>
9396<Step title="Migrate Pi tool-result extensions to middleware">
94-Bundled plugins should replace Pi-only
97+Bundled plugins must replace Pi-only
9598`api.registerEmbeddedExtensionFactory(...)` tool-result handlers with
9699runtime-neutral middleware.
9710098101```typescript
99-// Before: Pi-only compatibility hook
100-api.registerEmbeddedExtensionFactory((pi) => {
101- pi.on("tool_result", async (event) => {
102- return compactToolResult(event);
103- });
104-});
105-106-// After: Pi and Codex runtime dynamic tools
102+// Pi and Codex runtime dynamic tools
107103api.registerAgentToolResultMiddleware(async (event) => {
108104 return compactToolResult(event);
109105}, {
@@ -121,10 +117,8 @@ releases.
121117}
122118```
123119124-Keep `contracts.embeddedExtensionFactories` only for bundled compatibility
125-code that still needs direct Pi embedded-runner events. External plugins
126-cannot register tool-result middleware because it can rewrite high-trust
127-tool output before the model sees it.
120+External plugins cannot register tool-result middleware because it can
121+rewrite high-trust tool output before the model sees it.
128122129123</Step>
130124@@ -624,8 +618,8 @@ canonical replacement.
624618625619<Accordion title="Embedded extension factories → agent tool-result middleware">
626620Covered in "How to migrate → Migrate Pi tool-result extensions to
627-middleware" above. Included here for completeness: the Pi-only
628-`api.registerEmbeddedExtensionFactory(...)` path is deprecated in favor of
621+middleware" above. Included here for completeness: the removed Pi-only
622+`api.registerEmbeddedExtensionFactory(...)` path is replaced by
629623`api.registerAgentToolResultMiddleware(...)` with an explicit runtime
630624list in `contracts.agentToolResultMiddleware`.
631625</Accordion>
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。