惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
C
Check Point Blog
J
Java Code Geeks
腾讯CDC
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 三生石上(FineUI控件)
Apple Machine Learning Research
Apple Machine Learning Research
大猫的无限游戏
大猫的无限游戏
Engineering at Meta
Engineering at Meta
罗磊的独立博客
Last Week in AI
Last Week in AI
B
Blog
IT之家
IT之家
S
SegmentFault 最新的问题
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
博客园 - 聂微东
U
Unit 42
有赞技术团队
有赞技术团队
Y
Y Combinator Blog
MyScale Blog
MyScale Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix: preserve runtime config during source plugin activat...
shakkernerd · 2026-04-27 · via Recent Commits to openclaw:main

@@ -0,0 +1,105 @@

1+

import type { OpenClawConfig } from "../config/types.openclaw.js";

2+

import { isRecord } from "../utils.js";

3+4+

function hasOwnValue(record: Record<string, unknown>, key: string): boolean {

5+

return Object.prototype.hasOwnProperty.call(record, key);

6+

}

7+8+

function mergeChannelActivationSections(params: {

9+

runtimeConfig: OpenClawConfig;

10+

activationConfig: OpenClawConfig;

11+

}): OpenClawConfig {

12+

const activationChannels = params.activationConfig.channels;

13+

if (!isRecord(activationChannels)) {

14+

return params.runtimeConfig;

15+

}

16+17+

const runtimeChannels = isRecord(params.runtimeConfig.channels)

18+

? params.runtimeConfig.channels

19+

: {};

20+

let nextChannels: Record<string, unknown> | undefined;

21+22+

for (const [channelId, activationChannel] of Object.entries(activationChannels)) {

23+

if (!isRecord(activationChannel) || !hasOwnValue(activationChannel, "enabled")) {

24+

continue;

25+

}

26+

const runtimeChannel = runtimeChannels[channelId];

27+

const runtimeChannelRecord = isRecord(runtimeChannel) ? runtimeChannel : {};

28+

nextChannels ??= { ...runtimeChannels };

29+

nextChannels[channelId] = {

30+

...runtimeChannelRecord,

31+

enabled: activationChannel.enabled,

32+

};

33+

}

34+35+

if (nextChannels === undefined) {

36+

return params.runtimeConfig;

37+

}

38+

return {

39+

...params.runtimeConfig,

40+

channels: nextChannels as OpenClawConfig["channels"],

41+

};

42+

}

43+44+

function mergePluginActivationSections(params: {

45+

runtimeConfig: OpenClawConfig;

46+

activationConfig: OpenClawConfig;

47+

}): OpenClawConfig {

48+

const activationPlugins = params.activationConfig.plugins;

49+

if (!isRecord(activationPlugins)) {

50+

return params.runtimeConfig;

51+

}

52+53+

const runtimePlugins = isRecord(params.runtimeConfig.plugins) ? params.runtimeConfig.plugins : {};

54+

let nextPlugins: Record<string, unknown> | undefined;

55+56+

if (Array.isArray(activationPlugins.allow)) {

57+

nextPlugins = {

58+

...runtimePlugins,

59+

allow: [...activationPlugins.allow],

60+

};

61+

}

62+63+

const activationEntries = activationPlugins.entries;

64+

if (isRecord(activationEntries)) {

65+

const runtimeEntries = isRecord(runtimePlugins.entries) ? runtimePlugins.entries : {};

66+

let nextEntries: Record<string, unknown> | undefined;

67+

for (const [pluginId, activationEntry] of Object.entries(activationEntries)) {

68+

if (!isRecord(activationEntry) || !hasOwnValue(activationEntry, "enabled")) {

69+

continue;

70+

}

71+

const runtimeEntry = runtimeEntries[pluginId];

72+

const runtimeEntryRecord = isRecord(runtimeEntry) ? runtimeEntry : {};

73+

nextEntries ??= { ...runtimeEntries };

74+

nextEntries[pluginId] = {

75+

...runtimeEntryRecord,

76+

enabled: activationEntry.enabled,

77+

};

78+

}

79+

if (nextEntries !== undefined) {

80+

nextPlugins = {

81+

...runtimePlugins,

82+

...nextPlugins,

83+

entries: nextEntries,

84+

};

85+

}

86+

}

87+88+

if (nextPlugins === undefined) {

89+

return params.runtimeConfig;

90+

}

91+

return {

92+

...params.runtimeConfig,

93+

plugins: nextPlugins as OpenClawConfig["plugins"],

94+

};

95+

}

96+97+

export function mergeActivationSectionsIntoRuntimeConfig(params: {

98+

runtimeConfig: OpenClawConfig;

99+

activationConfig: OpenClawConfig;

100+

}): OpenClawConfig {

101+

return mergePluginActivationSections({

102+

...params,

103+

runtimeConfig: mergeChannelActivationSections(params),

104+

});

105+

}