|
| 1 | +import type { OpenClawConfig } from "../../../config/types.openclaw.js"; |
| 2 | +import { |
| 3 | + normalizeLegacyBrowserConfig, |
| 4 | + normalizeLegacyCrossContextMessageConfig, |
| 5 | + normalizeLegacyMediaProviderOptions, |
| 6 | + normalizeLegacyMistralModelMaxTokens, |
| 7 | + normalizeLegacyNanoBananaSkill, |
| 8 | + normalizeLegacyTalkConfig, |
| 9 | + seedMissingDefaultAccountsFromSingleAccountBase, |
| 10 | +} from "./legacy-config-core-normalizers.js"; |
| 11 | +import { migrateLegacyWebFetchConfig } from "./legacy-web-fetch-migrate.js"; |
| 12 | +import { migrateLegacyWebSearchConfig } from "./legacy-web-search-migrate.js"; |
| 13 | +import { migrateLegacyXSearchConfig } from "./legacy-x-search-migrate.js"; |
| 14 | + |
| 15 | +export function normalizeRuntimeCompatibilityConfigValues(cfg: OpenClawConfig): { |
| 16 | + config: OpenClawConfig; |
| 17 | + changes: string[]; |
| 18 | +} { |
| 19 | + const changes: string[] = []; |
| 20 | + let next = seedMissingDefaultAccountsFromSingleAccountBase(cfg, changes); |
| 21 | + next = normalizeLegacyBrowserConfig(next, changes); |
| 22 | + |
| 23 | + for (const migrate of [ |
| 24 | + migrateLegacyWebSearchConfig, |
| 25 | + migrateLegacyWebFetchConfig, |
| 26 | + migrateLegacyXSearchConfig, |
| 27 | + ]) { |
| 28 | + const migrated = migrate(next); |
| 29 | + if (migrated.changes.length === 0) { |
| 30 | + continue; |
| 31 | + } |
| 32 | + next = migrated.config; |
| 33 | + changes.push(...migrated.changes); |
| 34 | + } |
| 35 | + |
| 36 | + next = normalizeLegacyNanoBananaSkill(next, changes); |
| 37 | + next = normalizeLegacyTalkConfig(next, changes); |
| 38 | + next = normalizeLegacyCrossContextMessageConfig(next, changes); |
| 39 | + next = normalizeLegacyMediaProviderOptions(next, changes); |
| 40 | + next = normalizeLegacyMistralModelMaxTokens(next, changes); |
| 41 | + |
| 42 | + return { config: next, changes }; |
| 43 | +} |
0 commit comments