Skip to content

Commit f693ac1

Browse files
committed
refactor(config): share canonical deep merge
1 parent 04b684c commit f693ac1

17 files changed

Lines changed: 36 additions & 201 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Docs: https://docs.openclaw.ai
66

77
### Changes
88

9+
- **Plugin config merging:** expose the canonical deep-merge policy through the plugin SDK, migrate Voice Call to it, and remove the duplicate merge engine and direct `defu` dependency.
910
- **Skill Workshop history review:** add a manual, newest-first session scan that progressively searches older substantial work for conservative skill ideas, stores only SQLite cursor metadata, and leaves up to three results as pending proposals even when autonomous self-learning is disabled. (#106182)
1011
- **SQLite snapshots:** add `openclaw backup sqlite create|list|verify|restore` for compact, verified global and per-agent database artifacts with fresh-target-only restore. (#94805) Thanks @giodl73-repo.
1112
- **GPT-5.6 Ultra and runtime switching:** support Sol, Terra, and Luna across OpenClaw and Codex engines; keep model, runtime, and thinking selection atomic through `/model` and fallback; and add live matrix coverage for both harnesses. (#98021) Thanks @anyech.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
9bc00d1b67cf1902b3deb36a79553684cccd0cf5d405e9bf0373065ec1e1005f plugin-sdk-api-baseline.json
2-
517cab00f614e15bf68b68468b0398c9faae6a8035dbfd7512e6527d815046c5 plugin-sdk-api-baseline.jsonl
1+
e511874a61fa05dc67613e171fb9617102525db3efbe4c7240da0d3e84c270d8 plugin-sdk-api-baseline.json
2+
575271760452cbd7da8fb57eef8ffce527254ccb876aaefd850c13b9522dd744 plugin-sdk-api-baseline.jsonl

docs/plugins/sdk-migration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ SDK.
153153
| Need | Import |
154154
| --- | --- |
155155
| Config types such as `OpenClawConfig` | `openclaw/plugin-sdk/config-contracts` |
156-
| Already-loaded config assertions and plugin-entry config lookup | `openclaw/plugin-sdk/plugin-config-runtime` |
156+
| Already-loaded config assertions, plugin-entry config lookup, and config merging | `openclaw/plugin-sdk/plugin-config-runtime` |
157157
| Current runtime snapshot reads | `openclaw/plugin-sdk/runtime-config-snapshot` |
158158
| Config writes | `openclaw/plugin-sdk/config-mutation` |
159159
| Session store helpers | `openclaw/plugin-sdk/session-store-runtime` |

docs/plugins/sdk-runtime.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The mutation helpers return `afterWrite` plus a typed `followUp` summary so call
4747
`api.runtime.config.loadConfig()` and `api.runtime.config.writeConfigFile(...)` are deprecated. They warn once per plugin at runtime and remain available only for old external plugins during the migration window. Bundled plugins must not use them: an internal config boundary guard fails the build if plugin code calls them or imports those helpers from plugin SDK subpaths. Use `current()`, a passed-in `cfg`, `mutateConfigFile(...)`, or `replaceConfigFile(...)` instead.
4848
</Warning>
4949

50-
For direct SDK imports, prefer the focused config subpaths over the broad `openclaw/plugin-sdk/config-runtime` compatibility barrel: `config-contracts` for types, `plugin-config-runtime` for already-loaded config assertions and plugin entry lookup, `runtime-config-snapshot` for current process snapshots, and `config-mutation` for writes. Bundled plugin tests should mock these focused subpaths directly instead of mocking the broad compatibility barrel.
50+
For direct SDK imports, prefer the focused config subpaths over the broad `openclaw/plugin-sdk/config-runtime` compatibility barrel: `config-contracts` for types, `plugin-config-runtime` for already-loaded config assertions, plugin entry lookup, and canonical config merging, `runtime-config-snapshot` for current process snapshots, and `config-mutation` for writes. Bundled plugin tests should mock these focused subpaths directly instead of mocking the broad compatibility barrel.
5151

5252
Internal OpenClaw runtime code follows 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.
5353

docs/plugins/sdk-subpaths.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ usage endpoint failed or returned no usable usage data.
263263
| `plugin-sdk/gateway-method-runtime` | Reserved Gateway method dispatch helper for plugin HTTP routes that declare `contracts.gatewayMethodDispatch: ["authenticated-request"]` |
264264
| `plugin-sdk/gateway-runtime` | Gateway client, event-loop-ready client start helper, gateway CLI RPC, gateway protocol errors, advertised LAN host resolution, and channel-status patch helpers |
265265
| `plugin-sdk/config-contracts` | Focused type-only config surface for plugin config shapes such as `OpenClawConfig` and channel/provider config types |
266-
| `plugin-sdk/plugin-config-runtime` | Runtime plugin-config lookup helpers such as `requireRuntimeConfig`, `resolvePluginConfigObject`, and `resolveLivePluginConfigObject` |
266+
| `plugin-sdk/plugin-config-runtime` | Runtime plugin-config helpers such as `mergeDeep`, `requireRuntimeConfig`, `resolvePluginConfigObject`, and `resolveLivePluginConfigObject` |
267267
| `plugin-sdk/config-mutation` | Transactional config mutation helpers such as `mutateConfigFile`, `replaceConfigFile`, and `logConfigUpdated` |
268268
| `plugin-sdk/message-tool-delivery-hints` | Shared message-tool delivery metadata hint strings |
269269
| `plugin-sdk/runtime-config-snapshot` | Current process config snapshot helpers such as `getRuntimeConfig`, `getRuntimeConfigSnapshot`, and test snapshot setters |

extensions/voice-call/npm-shrinkwrap.json

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/voice-call/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
},
99
"type": "module",
1010
"dependencies": {
11-
"defu": "6.1.5",
1211
"typebox": "1.3.3",
1312
"ws": "8.21.0",
1413
"zod": "4.4.3"

extensions/voice-call/src/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Voice Call helper module supports config behavior.
2+
import { mergeDeep } from "openclaw/plugin-sdk/plugin-config-runtime";
23
import { REALTIME_VOICE_AGENT_CONSULT_TOOL_POLICIES } from "openclaw/plugin-sdk/realtime-voice";
34
import { normalizeAgentId, parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
45
import {
@@ -14,7 +15,6 @@ import {
1415
import { normalizeWebhookPath } from "openclaw/plugin-sdk/webhook-ingress";
1516
import { z } from "zod";
1617
import { TtsConfigSchema } from "../api.js";
17-
import { deepMergeDefined } from "./deep-merge.js";
1818
import { TWILIO_REGIONS } from "./providers/twilio-region.js";
1919
import { DEFAULT_VOICE_CALL_REALTIME_INSTRUCTIONS } from "./realtime-defaults.js";
2020

@@ -550,7 +550,7 @@ function normalizeVoiceCallTtsConfig(
550550
return undefined;
551551
}
552552

553-
return TtsConfigSchema.parse(deepMergeDefined(defaults ?? {}, overrides ?? {}));
553+
return TtsConfigSchema.parse(mergeDeep(defaults ?? {}, overrides ?? {}));
554554
}
555555

556556
function normalizePhoneRouteKey(phone: string | undefined): string {

extensions/voice-call/src/deep-merge.test.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.

extensions/voice-call/src/deep-merge.ts

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)