build: upgrade feishu plugin to 2026.3.12 (#482)
This commit is contained in:
committed by
GitHub
Unverified
parent
6988b2b5bf
commit
f6de56fa78
@@ -16,7 +16,8 @@ import { withConfigLock } from './config-mutex';
|
||||
const OPENCLAW_DIR = join(homedir(), '.openclaw');
|
||||
const CONFIG_FILE = join(OPENCLAW_DIR, 'openclaw.json');
|
||||
const WECOM_PLUGIN_ID = 'wecom-openclaw-plugin';
|
||||
const FEISHU_PLUGIN_ID = 'feishu-openclaw-plugin';
|
||||
const FEISHU_PLUGIN_ID = 'openclaw-lark';
|
||||
const LEGACY_FEISHU_PLUGIN_ID = 'feishu-openclaw-plugin';
|
||||
const DEFAULT_ACCOUNT_ID = 'default';
|
||||
const CHANNEL_TOP_LEVEL_KEYS_TO_KEEP = new Set(['accounts', 'defaultAccount', 'enabled']);
|
||||
|
||||
@@ -112,7 +113,10 @@ function ensurePluginAllowlist(currentConfig: OpenClawConfig, channelType: strin
|
||||
const allow: string[] = Array.isArray(currentConfig.plugins.allow)
|
||||
? (currentConfig.plugins.allow as string[])
|
||||
: [];
|
||||
const normalizedAllow = allow.filter((pluginId) => pluginId !== 'feishu');
|
||||
// Remove legacy IDs: 'feishu' (built-in) and old 'feishu-openclaw-plugin'
|
||||
const normalizedAllow = allow.filter(
|
||||
(pluginId) => pluginId !== 'feishu' && pluginId !== LEGACY_FEISHU_PLUGIN_ID
|
||||
);
|
||||
if (!normalizedAllow.includes(FEISHU_PLUGIN_ID)) {
|
||||
currentConfig.plugins.allow = [...normalizedAllow, FEISHU_PLUGIN_ID];
|
||||
} else if (normalizedAllow.length !== allow.length) {
|
||||
@@ -122,10 +126,9 @@ function ensurePluginAllowlist(currentConfig: OpenClawConfig, channelType: strin
|
||||
if (!currentConfig.plugins.entries) {
|
||||
currentConfig.plugins.entries = {};
|
||||
}
|
||||
// Remove legacy 'feishu' entry — the official plugin registers its
|
||||
// channel AS 'feishu' via openclaw.plugin.json, so an explicit
|
||||
// entries.feishu.enabled=false would block the official plugin's channel.
|
||||
// Remove legacy entries that would conflict with the current plugin ID
|
||||
delete currentConfig.plugins.entries['feishu'];
|
||||
delete currentConfig.plugins.entries[LEGACY_FEISHU_PLUGIN_ID];
|
||||
|
||||
if (!currentConfig.plugins.entries[FEISHU_PLUGIN_ID]) {
|
||||
currentConfig.plugins.entries[FEISHU_PLUGIN_ID] = {};
|
||||
|
||||
@@ -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 ─────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user