Files
openclaw/src/agents/model-selection-cli.ts
Peter Steinberger cdb8d32bcc refactor(agents): consolidate model normalization (#112772)
* refactor(agents): consolidate model normalization

* docs(agents): clarify normalization boundary
2026-07-22 19:19:41 -04:00

21 lines
887 B
TypeScript

/**
* Detects providers whose model selections are backed by CLI runtimes.
*/
import type { OpenClawConfig } from "../config/types.openclaw.js";
import { resolveRuntimeCliBackends } from "../plugins/cli-backends.runtime.js";
import { resolvePluginSetupCliBackendDescriptor } from "../plugins/setup-registry.runtime.js";
import { normalizeProviderId } from "./model-ref-shared.js";
/** Return true when a provider id resolves to a configured or plugin CLI backend. */
export function isCliProvider(provider: string, cfg?: OpenClawConfig): boolean {
const normalized = normalizeProviderId(provider);
const cliBackends = resolveRuntimeCliBackends();
if (cliBackends.some((backend) => normalizeProviderId(backend.id) === normalized)) {
return true;
}
if (resolvePluginSetupCliBackendDescriptor({ backend: normalized, config: cfg })) {
return true;
}
return false;
}