build: upgrade feishu plugin to 2026.3.12 (#482)

This commit is contained in:
paisley
2026-03-14 14:16:21 +08:00
committed by GitHub
Unverified
parent 6988b2b5bf
commit f6de56fa78
7 changed files with 294 additions and 279 deletions

View File

@@ -1019,15 +1019,57 @@ export async function sanitizeOpenClawConfig(): Promise<void> {
// The official feishu plugin registers its channel AS 'feishu' via
// openclaw.plugin.json. An explicit entries.feishu.enabled=false
// (set by older ClawX to disable the legacy built-in) blocks the
// official plugin's channel from starting. Delete it.
// official plugin's channel from starting. Only clean up when the
// new openclaw-lark plugin is already configured (to avoid removing
// a legitimate old-style feishu plugin from users who haven't upgraded).
if (typeof plugins === 'object' && !Array.isArray(plugins)) {
const pluginsObj = plugins as Record<string, unknown>;
const pEntries = pluginsObj.entries as Record<string, Record<string, unknown>> | undefined;
if (pEntries?.feishu) {
console.log('[sanitize] Removing stale plugins.entries.feishu that blocks the official feishu plugin channel');
delete pEntries.feishu;
// ── feishu-openclaw-plugin → openclaw-lark migration ────────
// Plugin @larksuite/openclaw-lark ≥2026.3.12 changed its manifest
// id from 'feishu-openclaw-plugin' to 'openclaw-lark'. Migrate
// both plugins.allow and plugins.entries so Gateway validation
// doesn't reject the config with "plugin not found".
const LEGACY_FEISHU_ID = 'feishu-openclaw-plugin';
const NEW_FEISHU_ID = 'openclaw-lark';
if (Array.isArray(pluginsObj.allow)) {
const allowArr = pluginsObj.allow as string[];
const legacyIdx = allowArr.indexOf(LEGACY_FEISHU_ID);
if (legacyIdx !== -1) {
if (!allowArr.includes(NEW_FEISHU_ID)) {
allowArr[legacyIdx] = NEW_FEISHU_ID;
} else {
allowArr.splice(legacyIdx, 1);
}
console.log(`[sanitize] Migrated plugins.allow: ${LEGACY_FEISHU_ID}${NEW_FEISHU_ID}`);
modified = true;
}
}
if (pEntries?.[LEGACY_FEISHU_ID]) {
if (!pEntries[NEW_FEISHU_ID]) {
pEntries[NEW_FEISHU_ID] = pEntries[LEGACY_FEISHU_ID];
}
delete pEntries[LEGACY_FEISHU_ID];
console.log(`[sanitize] Migrated plugins.entries: ${LEGACY_FEISHU_ID}${NEW_FEISHU_ID}`);
modified = true;
}
// ── Disable bare 'feishu' when openclaw-lark is present ────────
// The Gateway binary automatically adds bare 'feishu' to plugins
// config because the openclaw-lark plugin registers the 'feishu'
// channel. We can't DELETE it (triggers config-change → restart →
// Gateway re-adds it → loop). Instead, disable it so it doesn't
// conflict with openclaw-lark.
const allowArr = Array.isArray(pluginsObj.allow) ? pluginsObj.allow as string[] : [];
const hasNewFeishu = allowArr.includes(NEW_FEISHU_ID) || !!pEntries?.[NEW_FEISHU_ID];
if (hasNewFeishu && pEntries?.feishu) {
if (pEntries.feishu.enabled !== false) {
pEntries.feishu.enabled = false;
console.log(`[sanitize] Disabled bare plugins.entries.feishu (openclaw-lark is configured)`);
modified = true;
}
}
}
// ── channels default-account migration ─────────────────────────