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

@@ -222,6 +222,7 @@ const BUILTIN_CHANNEL_IDS = new Set([
'msteams',
'googlechat',
'mattermost',
'qqbot',
]);
const AUTH_PROFILE_PROVIDER_KEY_MAP: Record<string, string> = {
'openai-codex': 'openai',
@@ -1507,34 +1508,21 @@ export async function sanitizeOpenClawConfig(): Promise<void> {
modified = true;
}
// ── qqbot → openclaw-qqbot migration ────────────────────────
// The qqbot npm package (@tencent-connect/openclaw-qqbot) declares
// id="openclaw-qqbot" in its manifest, but older ClawX versions
// wrote bare "qqbot" into plugins.allow. Migrate to the manifest ID
// so the Gateway can resolve the plugin correctly.
const LEGACY_QQBOT_ID = 'qqbot';
const NEW_QQBOT_ID = 'openclaw-qqbot';
if (Array.isArray(pluginsObj.allow)) {
const allowArr = pluginsObj.allow as string[];
const legacyIdx = allowArr.indexOf(LEGACY_QQBOT_ID);
if (legacyIdx !== -1) {
if (!allowArr.includes(NEW_QQBOT_ID)) {
allowArr[legacyIdx] = NEW_QQBOT_ID;
} else {
allowArr.splice(legacyIdx, 1);
}
console.log(`[sanitize] Migrated plugins.allow: ${LEGACY_QQBOT_ID}${NEW_QQBOT_ID}`);
// ── qqbot built-in channel cleanup ──────────────────────────
// OpenClaw 3.31 moved qqbot from a third-party plugin to a built-in
// channel. Clean up legacy plugin entries (both bare "qqbot" and
// manifest-declared "openclaw-qqbot") from plugins.entries.
// plugins.allow is left untouched — having openclaw-qqbot there is harmless.
// The channel config under channels.qqbot is preserved and works
// identically with the built-in channel.
const QQBOT_PLUGIN_IDS = ['qqbot', 'openclaw-qqbot'] as const;
for (const qqbotId of QQBOT_PLUGIN_IDS) {
if (pEntries?.[qqbotId]) {
delete pEntries[qqbotId];
console.log(`[sanitize] Removed built-in channel plugin from plugins.entries: ${qqbotId}`);
modified = true;
}
}
if (pEntries?.[LEGACY_QQBOT_ID]) {
if (!pEntries[NEW_QQBOT_ID]) {
pEntries[NEW_QQBOT_ID] = pEntries[LEGACY_QQBOT_ID];
}
delete pEntries[LEGACY_QQBOT_ID];
console.log(`[sanitize] Migrated plugins.entries: ${LEGACY_QQBOT_ID}${NEW_QQBOT_ID}`);
modified = true;
}
// ── qwen-portal → modelstudio migration ────────────────────
// OpenClaw 2026.3.28 deprecated qwen-portal OAuth (portal.qwen.ai)