11import path from "node:path" ;
22import { resolveAgentWorkspaceDir , resolveDefaultAgentId } from "../agents/agent-scope.js" ;
33import { CHANNEL_IDS , normalizeChatChannelId } from "../channels/registry.js" ;
4- import { BUNDLED_AUTO_ENABLE_PROVIDER_PLUGIN_IDS } from "../plugins/bundled-capability-metadata.js" ;
4+ import {
5+ BUNDLED_AUTO_ENABLE_PROVIDER_PLUGIN_IDS ,
6+ BUNDLED_LEGACY_PLUGIN_ID_ALIASES ,
7+ BUNDLED_PROVIDER_PLUGIN_ID_ALIASES ,
8+ } from "../plugins/bundled-capability-metadata.js" ;
59import { withBundledPluginAllowlistCompat } from "../plugins/bundled-compat.js" ;
610import { listBundledWebSearchPluginIds } from "../plugins/bundled-web-search-ids.js" ;
711import {
812 normalizePluginsConfig ,
913 resolveEffectiveEnableState ,
1014 resolveMemorySlotDecision ,
1115} from "../plugins/config-state.js" ;
12- import { loadPluginManifestRegistry } from "../plugins/manifest-registry.js" ;
16+ import {
17+ loadPluginManifestRegistry ,
18+ type PluginManifestRegistry ,
19+ } from "../plugins/manifest-registry.js" ;
1320import { validateJsonSchemaValue } from "../plugins/schema-validator.js" ;
1421import {
1522 hasAvatarUriScheme ,
@@ -35,6 +42,12 @@ import { OpenClawSchema } from "./zod-schema.js";
3542
3643const LEGACY_REMOVED_PLUGIN_IDS = new Set ( [ "google-antigravity-auth" , "google-gemini-cli-auth" ] ) ;
3744
45+ type KnownPluginIdMetadata = {
46+ providerAliases : Readonly < Record < string , string > > ;
47+ legacyAliases : Readonly < Record < string , string > > ;
48+ autoEnableProviderPluginIds : Readonly < Record < string , string > > ;
49+ } ;
50+
3851type UnknownIssueRecord = Record < string , unknown > ;
3952type ConfigPathSegment = string | number ;
4053type AllowedValuesCollection = {
@@ -269,6 +282,27 @@ function collectAllowedValuesFromIssueList(
269282 return { values : collected , incomplete : false , hasValues } ;
270283}
271284
285+ function resolveKnownPluginIds ( params : {
286+ registry : PluginManifestRegistry ;
287+ bundledMetadata : KnownPluginIdMetadata ;
288+ } ) : Set < string > {
289+ const knownIds = new Set ( params . registry . plugins . map ( ( record ) => record . id ) ) ;
290+ // Do not rely on the manifest registry alone: cold-start or missing plugin directories can
291+ // temporarily hide bundled manifests, but config validation still needs to recognize bundled
292+ // aliases and auto-enable provider ids so startup remains resilient during upgrades/recovery.
293+ for ( const aliasMap of [
294+ params . bundledMetadata . providerAliases ,
295+ params . bundledMetadata . legacyAliases ,
296+ params . bundledMetadata . autoEnableProviderPluginIds ,
297+ ] ) {
298+ for ( const [ aliasId , pluginId ] of Object . entries ( aliasMap ) ) {
299+ knownIds . add ( aliasId ) ;
300+ knownIds . add ( pluginId ) ;
301+ }
302+ }
303+ return knownIds ;
304+ }
305+
272306function collectAllowedValuesFromUnknownIssue ( issue : unknown ) : unknown [ ] {
273307 const collection = collectAllowedValuesFromIssue ( issue ) ;
274308 if ( collection . incomplete || ! collection . hasValues ) {
@@ -585,10 +619,14 @@ function validateConfigObjectWithPluginsBase(
585619 const ensureKnownIds = ( ) : Set < string > => {
586620 const info = ensureRegistry ( ) ;
587621 if ( ! info . knownIds ) {
588- info . knownIds = new Set ( [
589- ...info . registry . plugins . map ( ( record ) => record . id ) ,
590- ...Object . values ( BUNDLED_AUTO_ENABLE_PROVIDER_PLUGIN_IDS ) ,
591- ] ) ;
622+ info . knownIds = resolveKnownPluginIds ( {
623+ registry : info . registry ,
624+ bundledMetadata : {
625+ providerAliases : BUNDLED_PROVIDER_PLUGIN_ID_ALIASES ,
626+ legacyAliases : BUNDLED_LEGACY_PLUGIN_ID_ALIASES ,
627+ autoEnableProviderPluginIds : BUNDLED_AUTO_ENABLE_PROVIDER_PLUGIN_IDS ,
628+ } ,
629+ } ) ;
592630 }
593631 return info . knownIds ;
594632 } ;
0 commit comments