mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:40:44 +00:00
docs(plugins): clarify runtime config access
This commit is contained in:
@@ -10,7 +10,7 @@ Docs: https://docs.openclaw.ai
|
||||
- Memory/OpenAI-compatible: add optional `memorySearch.inputType`, `queryInputType`, and `documentInputType` config for asymmetric embedding endpoints, including direct query embeddings and provider batch indexing. Carries forward #63313 and #60727. Thanks @HOYALIM and @prospect1314521.
|
||||
- Ollama/memory: add model-specific retrieval query prefixes for `nomic-embed-text`, `qwen3-embedding`, and `mxbai-embed-large` memory-search queries while leaving document batches unchanged. Carries forward #45013. Thanks @laolin5564.
|
||||
- Plugins/providers: move pre-runtime model-id normalization, provider endpoint host metadata, and OpenAI-compatible request-family hints into plugin manifests so core no longer carries bundled-provider routing tables. Thanks @codex.
|
||||
- Plugins/config: deprecate direct plugin config load/write helpers in favor of passed runtime snapshots plus transactional mutation helpers with explicit restart follow-up policy. Thanks @codex.
|
||||
- Plugins/config: deprecate direct plugin config load/write helpers in favor of passed runtime snapshots plus transactional mutation helpers with explicit restart follow-up policy, scanner guardrails, runtime warnings, and revision-based cache invalidation. Thanks @codex.
|
||||
- Plugins/install: allow `OPENCLAW_PLUGIN_STAGE_DIR` to contain layered runtime-dependency roots, resolving read-only preinstalled deps before installing missing deps into the final writable root. Fixes #72396. Thanks @liorb-mountapps.
|
||||
- Control UI: add a raw config pending-changes diff panel that parses JSON5, redacts sensitive values until reveal, and avoids fake raw-edit callbacks when opening the panel. Refs #39831; supersedes #48621 and #46654. Thanks @JiajunBernoulli and @BunsDev.
|
||||
- Control UI: polish the quick settings dashboard grid so common cards align across desktop, tablet, and mobile layouts without wasting horizontal space. Thanks @BunsDev.
|
||||
|
||||
@@ -119,8 +119,9 @@ releases.
|
||||
Mutation results include a typed `followUp` summary for tests and logging;
|
||||
the gateway remains responsible for applying or scheduling the restart.
|
||||
`loadConfig` and `writeConfigFile` remain as deprecated compatibility
|
||||
helpers for external plugins during the migration window. Bundled plugins
|
||||
and repo runtime code are protected by scanner guardrails: new production
|
||||
helpers for external plugins during the migration window and warn once when
|
||||
called. Bundled plugins and repo runtime code are protected by scanner
|
||||
guardrails in `pnpm check:deprecated-internal-config-api`: new production
|
||||
plugin usage fails outright, direct config writes fail, gateway server
|
||||
methods must use the request runtime snapshot, and long-lived runtime
|
||||
modules have zero allowed ambient `loadConfig()` calls.
|
||||
|
||||
@@ -41,9 +41,9 @@ Persist changes with `api.runtime.config.mutateConfigFile(...)` or `api.runtime.
|
||||
|
||||
The mutation helpers return `afterWrite` plus a typed `followUp` summary so callers can log or test whether they requested a restart. The gateway still owns when that restart actually happens.
|
||||
|
||||
`api.runtime.config.loadConfig()` and `api.runtime.config.writeConfigFile(...)` are deprecated compatibility helpers. Bundled plugins must not use them; the architecture guard fails if production plugin code calls them or imports those helpers from plugin SDK subpaths.
|
||||
`api.runtime.config.loadConfig()` and `api.runtime.config.writeConfigFile(...)` are deprecated compatibility helpers. They warn once at runtime, and bundled plugins must not use them; the architecture guard fails if production plugin code calls them or imports those helpers from plugin SDK subpaths.
|
||||
|
||||
Internal OpenClaw runtime code has the same direction: load config once at the CLI, gateway, or process boundary, then pass that value through. Long-lived runtime modules have a zero-tolerance scanner for ambient `loadConfig()` calls; use a passed `cfg`, a request `context.getRuntimeConfig()`, or `getRuntimeConfig()` at an explicit process boundary.
|
||||
Internal OpenClaw runtime code has the same direction: load config once at the CLI, gateway, or process boundary, then pass that value through. Successful mutation writes refresh the process runtime snapshot and advance its internal revision; long-lived caches should key off the runtime-owned cache key instead of serializing config locally. Long-lived runtime modules have a zero-tolerance scanner for ambient `loadConfig()` calls; use a passed `cfg`, a request `context.getRuntimeConfig()`, or `getRuntimeConfig()` at an explicit process boundary.
|
||||
|
||||
## Runtime namespaces
|
||||
|
||||
|
||||
@@ -94,6 +94,14 @@ plugin calls a capability API it does not own. For example,
|
||||
`api.registerMemoryCapability(...)` requires the plugin manifest or exported
|
||||
entry to declare `kind: "memory"`.
|
||||
|
||||
### Testing runtime config access
|
||||
|
||||
Prefer the shared plugin runtime mock from the repo test helpers when testing
|
||||
bundled plugins. Its deprecated `runtime.config.loadConfig()` and
|
||||
`runtime.config.writeConfigFile(...)` mocks throw by default so tests catch new
|
||||
usage of compatibility APIs. Override those mocks only when the test is
|
||||
explicitly covering legacy compatibility behavior.
|
||||
|
||||
### Unit testing a channel plugin
|
||||
|
||||
```typescript
|
||||
|
||||
Reference in New Issue
Block a user