fix(config): split plugin auto enable types

This commit is contained in:
Vincent Koc
2026-04-09 08:11:33 +01:00
parent 7c72b694f1
commit 2ac71d9488
6 changed files with 61 additions and 50 deletions

View File

@@ -4,9 +4,11 @@ import { detectPluginAutoEnableCandidates } from "./plugin-auto-enable.detect.js
import {
materializePluginAutoEnableCandidatesInternal,
resolvePluginAutoEnableManifestRegistry,
type PluginAutoEnableCandidate,
type PluginAutoEnableResult,
} from "./plugin-auto-enable.shared.js";
import type {
PluginAutoEnableCandidate,
PluginAutoEnableResult,
} from "./plugin-auto-enable.types.js";
export function materializePluginAutoEnableCandidates(params: {
config?: OpenClawConfig;

View File

@@ -4,8 +4,8 @@ import {
configMayNeedPluginAutoEnable,
resolveConfiguredPluginAutoEnableCandidates,
resolvePluginAutoEnableManifestRegistry,
type PluginAutoEnableCandidate,
} from "./plugin-auto-enable.shared.js";
import type { PluginAutoEnableCandidate } from "./plugin-auto-enable.types.js";
export function detectPluginAutoEnableCandidates(params: {
config?: OpenClawConfig;

View File

@@ -6,7 +6,7 @@ import { normalizeOptionalString } from "../shared/string-coerce.js";
import { normalizeStringEntries } from "../shared/string-normalization.js";
import { isRecord, resolveConfigDir, resolveUserPath } from "../utils.js";
import type { OpenClawConfig } from "./config.js";
import type { PluginAutoEnableCandidate } from "./plugin-auto-enable.shared.js";
import type { PluginAutoEnableCandidate } from "./plugin-auto-enable.types.js";
type ExternalCatalogChannelEntry = {
id: string;

View File

@@ -17,53 +17,16 @@ import { isRecord } from "../utils.js";
import { isChannelConfigured } from "./channel-configured.js";
import type { OpenClawConfig } from "./config.js";
import { shouldSkipPreferredPluginAutoEnable } from "./plugin-auto-enable.prefer-over.js";
import type {
PluginAutoEnableCandidate,
PluginAutoEnableResult,
} from "./plugin-auto-enable.types.js";
import { ensurePluginAllowlisted } from "./plugins-allowlist.js";
import { isBlockedObjectKey } from "./prototype-keys.js";
export type PluginAutoEnableCandidate =
| {
pluginId: string;
kind: "channel-configured";
channelId: string;
}
| {
pluginId: string;
kind: "provider-auth-configured";
providerId: string;
}
| {
pluginId: string;
kind: "provider-model-configured";
modelRef: string;
}
| {
pluginId: string;
kind: "web-fetch-provider-selected";
providerId: string;
}
| {
pluginId: string;
kind: "plugin-web-search-configured";
}
| {
pluginId: string;
kind: "plugin-web-fetch-configured";
}
| {
pluginId: string;
kind: "plugin-tool-configured";
}
| {
pluginId: string;
kind: "setup-auto-enable";
reason: string;
};
export type PluginAutoEnableResult = {
config: OpenClawConfig;
changes: string[];
autoEnabledReasons: Record<string, string[]>;
};
export type {
PluginAutoEnableCandidate,
PluginAutoEnableResult,
} from "./plugin-auto-enable.types.js";
const EMPTY_PLUGIN_MANIFEST_REGISTRY: PluginManifestRegistry = {
plugins: [],

View File

@@ -6,5 +6,5 @@ export { detectPluginAutoEnableCandidates } from "./plugin-auto-enable.detect.js
export type {
PluginAutoEnableCandidate,
PluginAutoEnableResult,
} from "./plugin-auto-enable.shared.js";
} from "./plugin-auto-enable.types.js";
export { resolvePluginAutoEnableCandidateReason } from "./plugin-auto-enable.shared.js";

View File

@@ -0,0 +1,46 @@
import type { OpenClawConfig } from "./config.js";
export type PluginAutoEnableCandidate =
| {
pluginId: string;
kind: "channel-configured";
channelId: string;
}
| {
pluginId: string;
kind: "provider-auth-configured";
providerId: string;
}
| {
pluginId: string;
kind: "provider-model-configured";
modelRef: string;
}
| {
pluginId: string;
kind: "web-fetch-provider-selected";
providerId: string;
}
| {
pluginId: string;
kind: "plugin-web-search-configured";
}
| {
pluginId: string;
kind: "plugin-web-fetch-configured";
}
| {
pluginId: string;
kind: "plugin-tool-configured";
}
| {
pluginId: string;
kind: "setup-auto-enable";
reason: string;
};
export type PluginAutoEnableResult = {
config: OpenClawConfig;
changes: string[];
autoEnabledReasons: Record<string, string[]>;
};