diff --git a/src/commands/models/list.model-projection.ts b/src/commands/models/list.model-projection.ts index e5a0b2788fef..7dbcf4b0f0af 100644 --- a/src/commands/models/list.model-projection.ts +++ b/src/commands/models/list.model-projection.ts @@ -2,7 +2,7 @@ import { resolveProviderPolicySurface } from "../../plugins/provider-public-arti import type { ProviderRuntimeModel } from "../../plugins/provider-runtime-model.types.js"; import { createLazyImportLoader } from "../../shared/lazy-promise.js"; import type { ListRowModel } from "./list.model-row.js"; -import type { RowBuilderContext } from "./list.rows.js"; +import type { RowBuilderContext } from "./list.row-context.js"; type ProviderRuntimeModule = typeof import("../../plugins/provider-runtime.js"); diff --git a/src/commands/models/list.row-context.ts b/src/commands/models/list.row-context.ts new file mode 100644 index 000000000000..8e57f90e3dc3 --- /dev/null +++ b/src/commands/models/list.row-context.ts @@ -0,0 +1,27 @@ +import type { OpenClawConfig } from "../../config/types.openclaw.js"; +import type { PluginMetadataSnapshot } from "../../plugins/plugin-metadata-snapshot.types.js"; +import type { ModelListAuthIndex } from "./list.auth-index.js"; +import type { ConfiguredEntry } from "./list.types.js"; + +type RowFilter = { + provider?: string; + local?: boolean; +}; + +/** Context shared by every model-list row source builder. */ +export type RowBuilderContext = { + cfg: OpenClawConfig; + agentId?: string; + agentDir: string; + inheritedAuthDir?: string; + authIndex: ModelListAuthIndex; + providerDiscoveryProviderIds?: readonly string[]; + providerRuntimeDiscoveryProviderIds?: readonly string[]; + availableKeys?: Set; + configuredByKey: Map; + discoveredKeys: Set; + filter: RowFilter; + skipRuntimeModelSuppression?: boolean; + metadataSnapshot?: PluginMetadataSnapshot; + workspaceDir?: string; +}; diff --git a/src/commands/models/list.rows.ts b/src/commands/models/list.rows.ts index 537c1d0a0e5c..598be5c02e63 100644 --- a/src/commands/models/list.rows.ts +++ b/src/commands/models/list.rows.ts @@ -17,50 +17,23 @@ import { } from "../../agents/model-suppression.js"; import { openAIModelCatalogRoutePolicy } from "../../agents/openai-model-routes.js"; import type { ModelDefinitionConfig, ModelProviderConfig } from "../../config/types.models.js"; -import type { OpenClawConfig } from "../../config/types.openclaw.js"; import type { ModelRegistry } from "../../llm/model-registry.js"; import type { Model } from "../../llm/types.js"; -import type { PluginMetadataSnapshot } from "../../plugins/plugin-metadata-snapshot.types.js"; import { createLazyImportLoader } from "../../shared/lazy-promise.js"; -import type { - ModelListAuthEvaluation, - ModelListAuthIndex, - ModelListAuthRef, -} from "./list.auth-index.js"; +import type { ModelListAuthEvaluation, ModelListAuthRef } from "./list.auth-index.js"; import { isLocalBaseUrl } from "./list.local-url.js"; import { normalizeConfiguredProviderListRow } from "./list.model-projection.js"; import type { ListRowModel } from "./list.model-row.js"; import { toModelRow } from "./list.model-row.js"; +import type { RowBuilderContext } from "./list.row-context.js"; import type { ConfiguredEntry, ModelRow } from "./list.types.js"; import { canonicalizeModelCatalogProviderAlias } from "./provider-aliases.js"; -type ConfiguredByKey = Map; type ModelCatalogModule = typeof import("../../agents/prepared-model-catalog.js"); type ModelResolverModule = typeof import("../../agents/embedded-agent-runner/model.js"); type ScopedModelCatalogModule = typeof import("./list.scoped-catalog.js"); -type RowFilter = { - provider?: string; - local?: boolean; -}; - -/** Context shared by every model-list row source builder. */ -export type RowBuilderContext = { - cfg: OpenClawConfig; - agentId?: string; - agentDir: string; - inheritedAuthDir?: string; - authIndex: ModelListAuthIndex; - providerDiscoveryProviderIds?: readonly string[]; - providerRuntimeDiscoveryProviderIds?: readonly string[]; - availableKeys?: Set; - configuredByKey: ConfiguredByKey; - discoveredKeys: Set; - filter: RowFilter; - skipRuntimeModelSuppression?: boolean; - metadataSnapshot?: PluginMetadataSnapshot; - workspaceDir?: string; -}; +export type { RowBuilderContext } from "./list.row-context.js"; const modelCatalogModuleLoader = createLazyImportLoader( () => import("../../agents/prepared-model-catalog.js"),