fix(plugins): deprecate deactivate hook alias

This commit is contained in:
Vincent Koc
2026-05-16 18:35:00 +08:00
parent 7e4929e004
commit a85cd65775
9 changed files with 68 additions and 7 deletions

View File

@@ -112,6 +112,8 @@ Current compatibility records include:
- legacy broad SDK imports such as `openclaw/plugin-sdk/compat`
- legacy hook-only plugin shapes and `before_agent_start`
- legacy `api.on("deactivate", ...)` cleanup hook names while plugins migrate to
`gateway_stop`
- legacy `activate(api)` plugin entrypoints while plugins migrate to
`register(api)`
- legacy SDK aliases such as `openclaw/extension-api`,

View File

@@ -145,7 +145,7 @@ observation-only.
**Lifecycle**
- `gateway_start` / `gateway_stop` - start or stop plugin-owned services with the Gateway
- `deactivate` - compatibility alias for `gateway_stop`; prefer `gateway_stop` in new plugins
- `deactivate` - deprecated compatibility alias for `gateway_stop`; use `gateway_stop` in new plugins
- `cron_changed` - observe gateway-owned cron lifecycle changes (added, updated, removed, started, finished, scheduled)
- **`before_install`** - inspect skill or plugin install scans and optionally block
@@ -438,8 +438,8 @@ before the next major release:
- **`before_agent_start`** remains for compatibility. New plugins should use
`before_model_resolve` and `before_prompt_build` instead of the combined
phase.
- **`deactivate`** remains as a cleanup compatibility alias. New plugins should
use `gateway_stop`.
- **`deactivate`** remains as a deprecated cleanup compatibility alias until
after 2026-08-16. New plugins should use `gateway_stop`.
- **`onResolution` in `before_tool_call`** now uses the typed
`PluginApprovalResolution` union (`allow-once` / `allow-always` / `deny` /
`timeout` / `cancelled`) instead of a free-form `string`.

View File

@@ -757,6 +757,29 @@ canonical replacement.
</Accordion>
<Accordion title="deactivate hook → gateway_stop">
**Old**: `api.on("deactivate", handler)`.
**New**: `api.on("gateway_stop", handler)`. The event and context are the
same shutdown cleanup contract; only the hook name changes.
```typescript
// Before
api.on("deactivate", async (event, ctx) => {
await stopPluginService(ctx);
});
// After
api.on("gateway_stop", async (event, ctx) => {
await stopPluginService(ctx);
});
```
`deactivate` remains wired as a deprecated compatibility alias until after
2026-08-16.
</Accordion>
<Accordion title="Provider discovery types → provider catalog types">
Four discovery type aliases are now thin wrappers over the
catalog-era types: