mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 07:30:43 +00:00
Fixes the session-list plugin metadata hot path by reusing the active workspace-scoped plugin metadata snapshot for manifest model-id normalization and setup CLI backend fallback. Also keeps model-pricing collection on its provided manifest registry and fixes the CI-only hoisted test mock failure. Validated with targeted plugin/gateway/model-selection tests, CI-shaped gateway startup shard, Testbox `pnpm check:changed`, and green PR CI. Thanks @rolandrscheel.
21 lines
892 B
TypeScript
21 lines
892 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 backends = cfg?.agents?.defaults?.cliBackends ?? {};
|
|
if (Object.keys(backends).some((key) => normalizeProviderId(key) === normalized)) {
|
|
return true;
|
|
}
|
|
const cliBackends = resolveRuntimeCliBackends();
|
|
if (cliBackends.some((backend) => normalizeProviderId(backend.id) === normalized)) {
|
|
return true;
|
|
}
|
|
if (resolvePluginSetupCliBackendRuntime({ backend: normalized, config: cfg })) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|