mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-04 23:21:40 +00:00
* refactor(agents): consolidate model normalization * docs(agents): clarify normalization boundary
21 lines
887 B
TypeScript
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;
|
|
}
|