Upgrade openclaw to 4.1 (#742)

This commit is contained in:
paisley
2026-04-02 11:23:24 +08:00
committed by GitHub
Unverified
parent 5a3da41562
commit 06266cb4d2
19 changed files with 208 additions and 785 deletions

View File

@@ -22,7 +22,7 @@ import {
const OPENCLAW_DIR = join(homedir(), '.openclaw');
const CONFIG_FILE = join(OPENCLAW_DIR, 'openclaw.json');
const WECOM_PLUGIN_ID = 'wecom';
const QQBOT_PLUGIN_ID = 'openclaw-qqbot';
// Note: QQBot is a built-in channel since OpenClaw 3.31 — no plugin ID needed.
const WECHAT_PLUGIN_ID = OPENCLAW_WECHAT_CHANNEL_TYPE;
const FEISHU_PLUGIN_ID_CANDIDATES = ['openclaw-lark', 'feishu-openclaw-plugin'] as const;
const DEFAULT_ACCOUNT_ID = 'default';
@@ -48,6 +48,7 @@ const BUILTIN_CHANNEL_IDS = new Set([
'msteams',
'googlechat',
'mattermost',
'qqbot',
]);
// Unique credential key per channel type used for duplicate bot detection.
@@ -464,37 +465,7 @@ async function ensurePluginAllowlist(currentConfig: OpenClawConfig, channelType:
}
}
if (channelType === 'qqbot') {
if (!currentConfig.plugins) {
currentConfig.plugins = {
allow: [QQBOT_PLUGIN_ID],
enabled: true,
entries: {
[QQBOT_PLUGIN_ID]: { enabled: true }
}
};
} else {
currentConfig.plugins.enabled = true;
const allow: string[] = Array.isArray(currentConfig.plugins.allow)
? (currentConfig.plugins.allow as string[])
: [];
// Normalize: remove bare 'qqbot' and ensure the actual manifest ID is present.
const normalizedAllow = allow.filter((pluginId) => pluginId !== 'qqbot');
if (!normalizedAllow.includes(QQBOT_PLUGIN_ID)) {
currentConfig.plugins.allow = [...normalizedAllow, QQBOT_PLUGIN_ID];
} else if (normalizedAllow.length !== allow.length) {
currentConfig.plugins.allow = normalizedAllow;
}
if (!currentConfig.plugins.entries) {
currentConfig.plugins.entries = {};
}
if (!currentConfig.plugins.entries[QQBOT_PLUGIN_ID]) {
currentConfig.plugins.entries[QQBOT_PLUGIN_ID] = {};
}
currentConfig.plugins.entries[QQBOT_PLUGIN_ID].enabled = true;
}
}
// Note: QQBot is a built-in channel since OpenClaw 3.31 — no plugin registration needed.
if (channelType === WECHAT_PLUGIN_ID) {
if (!currentConfig.plugins) {