fix feishu conflict (#850)
This commit is contained in:
committed by
GitHub
Unverified
parent
03c40985e1
commit
54ec784545
@@ -411,7 +411,9 @@ async function ensurePluginAllowlist(currentConfig: OpenClawConfig, channelType:
|
||||
allow: [feishuPluginId],
|
||||
enabled: true,
|
||||
entries: {
|
||||
[feishuPluginId]: { enabled: true }
|
||||
[feishuPluginId]: { enabled: true },
|
||||
// Disable the built-in feishu plugin when using openclaw-lark
|
||||
...(feishuPluginId !== 'feishu' ? { feishu: { enabled: false } } : {}),
|
||||
}
|
||||
};
|
||||
} else {
|
||||
@@ -432,8 +434,15 @@ async function ensurePluginAllowlist(currentConfig: OpenClawConfig, channelType:
|
||||
if (!currentConfig.plugins.entries) {
|
||||
currentConfig.plugins.entries = {};
|
||||
}
|
||||
// Remove conflicting feishu entries; keep only the resolved plugin id.
|
||||
delete currentConfig.plugins.entries['feishu'];
|
||||
// Remove conflicting feishu plugin entries; keep only the resolved plugin id.
|
||||
// When the resolved plugin id is NOT 'feishu', explicitly disable the
|
||||
// built-in feishu plugin (OpenClaw ships one in dist/extensions/feishu/)
|
||||
// to prevent it from conflicting with the official openclaw-lark plugin.
|
||||
if (feishuPluginId !== 'feishu') {
|
||||
currentConfig.plugins.entries['feishu'] = { enabled: false };
|
||||
} else {
|
||||
delete currentConfig.plugins.entries['feishu'];
|
||||
}
|
||||
for (const candidateId of FEISHU_PLUGIN_ID_CANDIDATES) {
|
||||
if (candidateId !== feishuPluginId) {
|
||||
delete currentConfig.plugins.entries[candidateId];
|
||||
|
||||
@@ -1665,29 +1665,30 @@ export async function sanitizeOpenClawConfig(): Promise<void> {
|
||||
}
|
||||
|
||||
|
||||
// ── Remove bare 'feishu' when canonical feishu plugin is present ──
|
||||
// The Gateway binary automatically adds bare 'feishu' to plugins.allow
|
||||
// because the official plugin registers the 'feishu' channel.
|
||||
// However, there's no plugin with id='feishu', so Gateway validation
|
||||
// fails with "plugin not found: feishu". Remove it from allow[] and
|
||||
// disable the entries.feishu entry to prevent Gateway from re-adding it.
|
||||
// ── Disable built-in 'feishu' when official openclaw-lark plugin is active ──
|
||||
// OpenClaw ships a built-in 'feishu' extension in dist/extensions/feishu/
|
||||
// that conflicts with the official @larksuite/openclaw-lark plugin
|
||||
// (id: 'openclaw-lark'). When the canonical feishu plugin is NOT the
|
||||
// built-in 'feishu' itself, we must:
|
||||
// 1. Remove bare 'feishu' from plugins.allow
|
||||
// 2. Always set plugins.entries.feishu = { enabled: false } to explicitly
|
||||
// disable the built-in — it loads automatically unless disabled.
|
||||
const allowArr2 = Array.isArray(pluginsObj.allow) ? pluginsObj.allow as string[] : [];
|
||||
const hasCanonicalFeishu = allowArr2.includes(canonicalFeishuId) || !!pEntries[canonicalFeishuId];
|
||||
if (hasCanonicalFeishu) {
|
||||
if (hasCanonicalFeishu && canonicalFeishuId !== 'feishu') {
|
||||
// Remove bare 'feishu' from plugins.allow
|
||||
const bareFeishuIdx = allowArr2.indexOf('feishu');
|
||||
if (bareFeishuIdx !== -1) {
|
||||
allowArr2.splice(bareFeishuIdx, 1);
|
||||
console.log('[sanitize] Removed bare "feishu" from plugins.allow (feishu plugin is configured)');
|
||||
console.log('[sanitize] Removed bare "feishu" from plugins.allow (openclaw-lark plugin is configured)');
|
||||
modified = true;
|
||||
}
|
||||
// Disable bare 'feishu' in plugins.entries so Gateway won't re-add it
|
||||
if (pEntries.feishu) {
|
||||
if (pEntries.feishu.enabled !== false) {
|
||||
pEntries.feishu.enabled = false;
|
||||
console.log('[sanitize] Disabled bare plugins.entries.feishu (feishu plugin is configured)');
|
||||
modified = true;
|
||||
}
|
||||
// Always ensure the built-in feishu plugin is explicitly disabled.
|
||||
// Built-in extensions load automatically unless plugins.entries.<id>.enabled = false.
|
||||
if (!pEntries.feishu || pEntries.feishu.enabled !== false) {
|
||||
pEntries.feishu = { ...(pEntries.feishu || {}), enabled: false };
|
||||
console.log('[sanitize] Disabled built-in feishu plugin (openclaw-lark plugin is configured)');
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user