mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-27 03:49:51 +02:00
18 lines
843 B
TypeScript
18 lines
843 B
TypeScript
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
|
import { resolveRuntimeCliBackends } from "../plugins/cli-backends.runtime.js";
|
|
import { resolvePluginSetupCliBackendRuntime } from "../plugins/setup-registry.runtime.js";
|
|
import { normalizeProviderId } from "./model-selection-normalize.js";
|
|
|
|
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 (resolvePluginSetupCliBackendRuntime({ backend: normalized })) {
|
|
return true;
|
|
}
|
|
const backends = cfg?.agents?.defaults?.cliBackends ?? {};
|
|
return Object.keys(backends).some((key) => normalizeProviderId(key) === normalized);
|
|
}
|