refactor: move model catalog normalization into core package

Move model catalog normalization and package-owned catalog schema/types into model-catalog-core while keeping public plugin SDK model catalog declarations on the existing SDK surface. Verified focused tests, package-boundary compile, full build, changed gate, declaration leak grep, CI, and autoreview.
This commit is contained in:
Peter Steinberger
2026-05-30 20:51:11 +01:00
committed by GitHub
parent 961691def2
commit 5891cfec3e
27 changed files with 371 additions and 66 deletions

View File

@@ -10,6 +10,10 @@ const LEGACY_MODEL_CATALOG_BRIDGES = new Map([
path.join(REPO_ROOT, "src/model-catalog/refs.ts"),
"@openclaw/model-catalog-core/model-catalog-refs",
],
[
path.join(REPO_ROOT, "src/model-catalog/normalize.ts"),
"@openclaw/model-catalog-core/model-catalog-normalize",
],
[
path.join(REPO_ROOT, "src/config/model-refs.ts"),
"@openclaw/model-catalog-core/configured-model-refs",

View File

@@ -1,24 +1,24 @@
import fs from "node:fs";
import path from "node:path";
import { normalizeModelCatalog } from "@openclaw/model-catalog-core/model-catalog-normalize";
import { normalizeModelCatalogProviderId } from "@openclaw/model-catalog-core/model-catalog-refs";
import type { ChannelConfigRuntimeSchema } from "../channels/plugins/types.config.js";
import { MANIFEST_KEY } from "../compat/legacy-names.js";
import { ENV_SECRET_REF_ID_RE } from "../config/types.secrets.js";
import { matchRootFileOpenFailure, openRootFileSync } from "../infra/boundary-file-read.js";
import { isBlockedObjectKey } from "../infra/prototype-keys.js";
import {
normalizeModelCatalog,
type ModelCatalog,
type ModelCatalogAlias,
type ModelCatalogCost,
type ModelCatalogDiscovery,
type ModelCatalogInput,
type ModelCatalogModel,
type ModelCatalogProvider,
type ModelCatalogStatus,
type ModelCatalogSuppression,
type ModelCatalogTieredCost,
} from "../model-catalog/index.js";
import type {
ModelCatalog,
ModelCatalogAlias,
ModelCatalogCost,
ModelCatalogDiscovery,
ModelCatalogInput,
ModelCatalogModel,
ModelCatalogProvider,
ModelCatalogStatus,
ModelCatalogSuppression,
ModelCatalogTieredCost,
} from "../model-catalog/types.js";
import type { JsonSchemaObject } from "../shared/json-schema.types.js";
import { normalizeOptionalString } from "../shared/string-coerce.js";
import { normalizeTrimmedStringList } from "../shared/string-normalization.js";

View File

@@ -840,6 +840,20 @@ const WORKSPACE_PACKAGE_ALIAS_ENTRIES = [
srcFile: "model-catalog-refs.ts",
distFile: "model-catalog-refs.mjs",
},
{
packageName: "@openclaw/model-catalog-core",
packageDir: "model-catalog-core",
subpath: "model-catalog-normalize",
srcFile: "model-catalog-normalize.ts",
distFile: "model-catalog-normalize.mjs",
},
{
packageName: "@openclaw/model-catalog-core",
packageDir: "model-catalog-core",
subpath: "model-catalog-types",
srcFile: "model-catalog-types.ts",
distFile: "model-catalog-types.mjs",
},
{
packageName: "@openclaw/model-catalog-core",
packageDir: "model-catalog-core",