mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 15:00:25 +00:00
fix(config): split plugin auto enable types
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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";
|
||||
|
||||
46
src/config/plugin-auto-enable.types.ts
Normal file
46
src/config/plugin-auto-enable.types.ts
Normal 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[]>;
|
||||
};
|
||||
Reference in New Issue
Block a user