mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:20:43 +00:00
refactor(plugins): prefer setup descriptors for setup lookup (#64786)
* refactor(plugins): prefer setup descriptors for setup lookup * fix(plugins): harden setup descriptor lookup * fix(plugins): keep sync cli backend setup results * fix(plugins): resolve setup registry rebase * fix(plugins): preserve fail-closed cli backend lookup * fix(plugins): fail closed on shadowed setup owners * fix(plugins): swallow async setup register rejections
This commit is contained in:
@@ -528,6 +528,13 @@ 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`.
|
||||
|
||||
Setup discovery now prefers descriptor-owned ids such as `setup.providers` and
|
||||
`setup.cliBackends` to narrow candidate plugins before it falls back to
|
||||
`setup-api` for plugins that still need setup-time runtime hooks. If more than
|
||||
one discovered plugin claims the same normalized setup provider or CLI backend
|
||||
id, setup lookup refuses the ambiguous owner instead of relying on discovery
|
||||
order.
|
||||
|
||||
### What the loader caches
|
||||
|
||||
OpenClaw keeps short in-process caches for:
|
||||
|
||||
@@ -268,22 +268,33 @@ Top-level `cliBackends` stays valid and continues to describe CLI inference
|
||||
backends. `setup.cliBackends` is the setup-specific descriptor surface for
|
||||
control-plane/setup flows that should stay metadata-only.
|
||||
|
||||
When present, `setup.providers` and `setup.cliBackends` are the preferred
|
||||
descriptor-first lookup surface for setup discovery. If the descriptor only
|
||||
narrows the candidate plugin and setup still needs richer setup-time runtime
|
||||
hooks, set `requiresRuntime: true` and keep `setup-api` in place as the
|
||||
fallback execution path.
|
||||
|
||||
Because setup lookup can execute plugin-owned `setup-api` code, normalized
|
||||
`setup.providers[].id` and `setup.cliBackends[]` values must stay unique across
|
||||
discovered plugins. Ambiguous ownership fails closed instead of picking a
|
||||
winner from discovery order.
|
||||
|
||||
### setup.providers reference
|
||||
|
||||
| Field | Required | Type | What it means |
|
||||
| ------------- | -------- | ---------- | ---------------------------------------------------------------------------------- |
|
||||
| `id` | Yes | `string` | Provider id exposed during setup or onboarding. |
|
||||
| `authMethods` | No | `string[]` | Setup/auth method ids this provider supports without loading full runtime. |
|
||||
| `envVars` | No | `string[]` | Env vars that generic setup/status surfaces can check before plugin runtime loads. |
|
||||
| Field | Required | Type | What it means |
|
||||
| ------------- | -------- | ---------- | ------------------------------------------------------------------------------------ |
|
||||
| `id` | Yes | `string` | Provider id exposed during setup or onboarding. Keep normalized ids globally unique. |
|
||||
| `authMethods` | No | `string[]` | Setup/auth method ids this provider supports without loading full runtime. |
|
||||
| `envVars` | No | `string[]` | Env vars that generic setup/status surfaces can check before plugin runtime loads. |
|
||||
|
||||
### setup fields
|
||||
|
||||
| Field | Required | Type | What it means |
|
||||
| ------------------ | -------- | ---------- | --------------------------------------------------------------------------- |
|
||||
| `providers` | No | `object[]` | Provider setup descriptors exposed during setup and onboarding. |
|
||||
| `cliBackends` | No | `string[]` | Setup-time backend ids available without full runtime activation. |
|
||||
| `configMigrations` | No | `string[]` | Config migration ids owned by this plugin's setup surface. |
|
||||
| `requiresRuntime` | No | `boolean` | Whether setup still needs plugin runtime execution after descriptor lookup. |
|
||||
| Field | Required | Type | What it means |
|
||||
| ------------------ | -------- | ---------- | --------------------------------------------------------------------------------------------------- |
|
||||
| `providers` | No | `object[]` | Provider setup descriptors exposed during setup and onboarding. |
|
||||
| `cliBackends` | No | `string[]` | Setup-time backend ids used for descriptor-first setup lookup. Keep normalized ids globally unique. |
|
||||
| `configMigrations` | No | `string[]` | Config migration ids owned by this plugin's setup surface. |
|
||||
| `requiresRuntime` | No | `boolean` | Whether setup still needs `setup-api` execution after descriptor lookup. |
|
||||
|
||||
## uiHints reference
|
||||
|
||||
|
||||
Reference in New Issue
Block a user