feat(plugins): narrow CLI loading via activation planning (#65120)

* feat(plugins): narrow cli loading via activation planning

* fix(plugins): normalize primary CLI command nullability

* fix(plugins): enforce activation planner exhaustiveness
This commit is contained in:
Vincent Koc
2026-04-12 09:07:47 +01:00
committed by GitHub
parent 24051ddf38
commit a9c7c2e1ed
8 changed files with 379 additions and 7 deletions

View File

@@ -527,6 +527,9 @@ actual behavior such as hooks, tools, commands, or provider flows.
Optional manifest `activation` and `setup` blocks stay on the control plane.
They are metadata-only descriptors for activation planning and setup discovery;
they do not replace runtime registration, `register(...)`, or `setupEntry`.
The first activation consumer now uses manifest command hints to narrow CLI
plugin loading when a primary command is known, instead of always loading every
CLI-capable plugin up front.
Setup discovery now prefers descriptor-owned ids such as `setup.providers` and
`setup.cliBackends` to narrow candidate plugins before it falls back to

View File

@@ -221,6 +221,9 @@ should activate it later.
This block is metadata only. It does not register runtime behavior, and it does
not replace `register(...)`, `setupEntry`, or other runtime/plugin entrypoints.
Current consumers use it as a narrowing hint before broader plugin loading, so
missing activation metadata only costs performance; it should not change
correctness.
```json
{
@@ -242,6 +245,10 @@ not replace `register(...)`, `setupEntry`, or other runtime/plugin entrypoints.
| `onRoutes` | No | `string[]` | Route kinds that should activate this plugin. |
| `onCapabilities` | No | `Array<"provider" \| "channel" \| "tool" \| "hook">` | Broad capability hints used by control-plane activation planning. |
For command-triggered planning specifically, OpenClaw still falls back to
legacy `commandAliases[].cliCommand` or `commandAliases[].name` when a plugin
has not added explicit `activation.onCommands` metadata yet.
## setup reference
Use `setup` when setup and onboarding surfaces need cheap plugin-owned metadata