fix: avoid clobbering sensitive config fields in install/uninstall

openclaw config get returns redacted values for sensitive fields (apiKey,
token, etc). Reading a parent object and writing it back overwrites real
secrets with the __OPENCLAW_REDACTED__ sentinel.

- install step 5: set only the dirigent provider instead of all providers
- uninstall step 2: set only plugins.load.paths instead of entire plugins tree
This commit is contained in:
2026-04-16 14:33:01 +00:00
parent 4cc787ad90
commit ca7b47e683

View File

@@ -197,12 +197,10 @@ if (mode === "install") {
ok("plugin configured");
step(5, 7, "configure no-reply provider");
const providers = getJson("models.providers") || {};
providers[NO_REPLY_PROVIDER_ID] = {
setJson(`models.providers.${NO_REPLY_PROVIDER_ID}`, {
baseUrl: NO_REPLY_BASE_URL, apiKey: NO_REPLY_API_KEY, api: "openai-completions",
models: [{ id: NO_REPLY_MODEL_ID, name: `${NO_REPLY_MODEL_ID} (Custom Provider)`, reasoning: false, input: ["text"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 200000, maxTokens: 8192 }],
};
setJson("models.providers", providers);
});
ok("provider configured");
step(6, 7, "add no-reply model to allowlist");
@@ -229,10 +227,8 @@ if (mode === "uninstall") {
ok("removed plugin entry");
step(2, 4, "remove plugin load path");
const plugins = getJson("plugins") || {};
const paths = Array.isArray(plugins?.load?.paths) ? plugins.load.paths : [];
plugins.load = plugins.load || {}; plugins.load.paths = paths.filter((p) => p !== PLUGIN_INSTALL_DIR);
setJson("plugins", plugins);
const paths = getJson("plugins.load.paths") || [];
setJson("plugins.load.paths", paths.filter((p) => p !== PLUGIN_INSTALL_DIR));
ok("removed load path");
step(3, 4, "remove installed files");